aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Makefile54
-rw-r--r--arch/arm/boot/compressed/Makefile3
-rw-r--r--arch/arm/boot/compressed/head-xscale.S1
-rw-r--r--arch/arm/boot/compressed/head.S2
-rw-r--r--arch/arm/boot/compressed/misc.c2
-rw-r--r--arch/arm/common/locomo.c2
-rw-r--r--arch/arm/common/sa1111.c2
-rw-r--r--arch/arm/common/sharpsl_pm.c11
-rw-r--r--arch/arm/common/time-acorn.c2
-rw-r--r--arch/arm/common/uengine.c3
-rw-r--r--arch/arm/include/asm/Kbuild3
-rw-r--r--arch/arm/include/asm/a.out-core.h49
-rw-r--r--arch/arm/include/asm/a.out.h34
-rw-r--r--arch/arm/include/asm/assembler.h116
-rw-r--r--arch/arm/include/asm/atomic.h212
-rw-r--r--arch/arm/include/asm/auxvec.h4
-rw-r--r--arch/arm/include/asm/bitops.h340
-rw-r--r--arch/arm/include/asm/bug.h24
-rw-r--r--arch/arm/include/asm/bugs.h21
-rw-r--r--arch/arm/include/asm/byteorder.h58
-rw-r--r--arch/arm/include/asm/cache.h10
-rw-r--r--arch/arm/include/asm/cacheflush.h537
-rw-r--r--arch/arm/include/asm/checksum.h139
-rw-r--r--arch/arm/include/asm/cnt32_to_63.h78
-rw-r--r--arch/arm/include/asm/cpu-multi32.h69
-rw-r--r--arch/arm/include/asm/cpu-single.h44
-rw-r--r--arch/arm/include/asm/cpu.h25
-rw-r--r--arch/arm/include/asm/cputime.h6
-rw-r--r--arch/arm/include/asm/current.h15
-rw-r--r--arch/arm/include/asm/delay.h44
-rw-r--r--arch/arm/include/asm/device.h15
-rw-r--r--arch/arm/include/asm/div64.h227
-rw-r--r--arch/arm/include/asm/dma-mapping.h458
-rw-r--r--arch/arm/include/asm/dma.h143
-rw-r--r--arch/arm/include/asm/domain.h78
-rw-r--r--arch/arm/include/asm/ecard.h219
-rw-r--r--arch/arm/include/asm/elf.h116
-rw-r--r--arch/arm/include/asm/emergency-restart.h6
-rw-r--r--arch/arm/include/asm/errno.h6
-rw-r--r--arch/arm/include/asm/fb.h19
-rw-r--r--arch/arm/include/asm/fcntl.h11
-rw-r--r--arch/arm/include/asm/fiq.h37
-rw-r--r--arch/arm/include/asm/flat.h19
-rw-r--r--arch/arm/include/asm/floppy.h148
-rw-r--r--arch/arm/include/asm/fpstate.h93
-rw-r--r--arch/arm/include/asm/ftrace.h14
-rw-r--r--arch/arm/include/asm/futex.h6
-rw-r--r--arch/arm/include/asm/glue.h149
-rw-r--r--arch/arm/include/asm/gpio.h7
-rw-r--r--arch/arm/include/asm/hardirq.h32
-rw-r--r--arch/arm/include/asm/hardware/arm_timer.h21
-rw-r--r--arch/arm/include/asm/hardware/arm_twd.h21
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h56
-rw-r--r--arch/arm/include/asm/hardware/clps7111.h184
-rw-r--r--arch/arm/include/asm/hardware/cs89712.h49
-rw-r--r--arch/arm/include/asm/hardware/debug-8250.S29
-rw-r--r--arch/arm/include/asm/hardware/debug-pl01x.S29
-rw-r--r--arch/arm/include/asm/hardware/dec21285.h147
-rw-r--r--arch/arm/include/asm/hardware/entry-macro-iomd.S139
-rw-r--r--arch/arm/include/asm/hardware/ep7211.h40
-rw-r--r--arch/arm/include/asm/hardware/ep7212.h83
-rw-r--r--arch/arm/include/asm/hardware/gic.h42
-rw-r--r--arch/arm/include/asm/hardware/icst307.h38
-rw-r--r--arch/arm/include/asm/hardware/icst525.h36
-rw-r--r--arch/arm/include/asm/hardware/ioc.h72
-rw-r--r--arch/arm/include/asm/hardware/iomd.h226
-rw-r--r--arch/arm/include/asm/hardware/iop3xx-adma.h888
-rw-r--r--arch/arm/include/asm/hardware/iop3xx-gpio.h73
-rw-r--r--arch/arm/include/asm/hardware/iop3xx.h312
-rw-r--r--arch/arm/include/asm/hardware/iop_adma.h116
-rw-r--r--arch/arm/include/asm/hardware/it8152.h99
-rw-r--r--arch/arm/include/asm/hardware/linkup-l1110.h48
-rw-r--r--arch/arm/include/asm/hardware/locomo.h217
-rw-r--r--arch/arm/include/asm/hardware/memc.h26
-rw-r--r--arch/arm/include/asm/hardware/pci_v3.h186
-rw-r--r--arch/arm/include/asm/hardware/sa1111.h581
-rw-r--r--arch/arm/include/asm/hardware/scoop.h69
-rw-r--r--arch/arm/include/asm/hardware/sharpsl_pm.h106
-rw-r--r--arch/arm/include/asm/hardware/ssp.h28
-rw-r--r--arch/arm/include/asm/hardware/uengine.h62
-rw-r--r--arch/arm/include/asm/hardware/vic.h45
-rw-r--r--arch/arm/include/asm/hw_irq.h27
-rw-r--r--arch/arm/include/asm/hwcap.h29
-rw-r--r--arch/arm/include/asm/ide.h23
-rw-r--r--arch/arm/include/asm/io.h287
-rw-r--r--arch/arm/include/asm/ioctl.h1
-rw-r--r--arch/arm/include/asm/ioctls.h84
-rw-r--r--arch/arm/include/asm/ipcbuf.h29
-rw-r--r--arch/arm/include/asm/irq.h28
-rw-r--r--arch/arm/include/asm/irq_regs.h1
-rw-r--r--arch/arm/include/asm/irqflags.h132
-rw-r--r--arch/arm/include/asm/kdebug.h1
-rw-r--r--arch/arm/include/asm/kexec.h31
-rw-r--r--arch/arm/include/asm/kgdb.h104
-rw-r--r--arch/arm/include/asm/kmap_types.h24
-rw-r--r--arch/arm/include/asm/kprobes.h79
-rw-r--r--arch/arm/include/asm/leds.h50
-rw-r--r--arch/arm/include/asm/limits.h11
-rw-r--r--arch/arm/include/asm/linkage.h11
-rw-r--r--arch/arm/include/asm/local.h1
-rw-r--r--arch/arm/include/asm/locks.h274
-rw-r--r--arch/arm/include/asm/mach/arch.h60
-rw-r--r--arch/arm/include/asm/mach/dma.h57
-rw-r--r--arch/arm/include/asm/mach/flash.h39
-rw-r--r--arch/arm/include/asm/mach/irda.h20
-rw-r--r--arch/arm/include/asm/mach/irq.h34
-rw-r--r--arch/arm/include/asm/mach/map.h36
-rw-r--r--arch/arm/include/asm/mach/mmc.h15
-rw-r--r--arch/arm/include/asm/mach/pci.h72
-rw-r--r--arch/arm/include/asm/mach/serial_at91.h33
-rw-r--r--arch/arm/include/asm/mach/serial_sa1100.h31
-rw-r--r--arch/arm/include/asm/mach/sharpsl_param.h37
-rw-r--r--arch/arm/include/asm/mach/time.h57
-rw-r--r--arch/arm/include/asm/mach/udc_pxa2xx.h29
-rw-r--r--arch/arm/include/asm/mc146818rtc.h28
-rw-r--r--arch/arm/include/asm/memory.h334
-rw-r--r--arch/arm/include/asm/mman.h17
-rw-r--r--arch/arm/include/asm/mmu.h33
-rw-r--r--arch/arm/include/asm/mmu_context.h117
-rw-r--r--arch/arm/include/asm/mmzone.h30
-rw-r--r--arch/arm/include/asm/module.h18
-rw-r--r--arch/arm/include/asm/msgbuf.h31
-rw-r--r--arch/arm/include/asm/mtd-xip.h26
-rw-r--r--arch/arm/include/asm/mutex.h127
-rw-r--r--arch/arm/include/asm/nwflash.h9
-rw-r--r--arch/arm/include/asm/page-nommu.h49
-rw-r--r--arch/arm/include/asm/page.h199
-rw-r--r--arch/arm/include/asm/param.h31
-rw-r--r--arch/arm/include/asm/parport.h18
-rw-r--r--arch/arm/include/asm/pci.h91
-rw-r--r--arch/arm/include/asm/percpu.h6
-rw-r--r--arch/arm/include/asm/pgalloc.h136
-rw-r--r--arch/arm/include/asm/pgtable-hwdef.h90
-rw-r--r--arch/arm/include/asm/pgtable-nommu.h118
-rw-r--r--arch/arm/include/asm/pgtable.h401
-rw-r--r--arch/arm/include/asm/poll.h1
-rw-r--r--arch/arm/include/asm/posix_types.h77
-rw-r--r--arch/arm/include/asm/proc-fns.h241
-rw-r--r--arch/arm/include/asm/processor.h131
-rw-r--r--arch/arm/include/asm/procinfo.h49
-rw-r--r--arch/arm/include/asm/ptrace.h162
-rw-r--r--arch/arm/include/asm/resource.h6
-rw-r--r--arch/arm/include/asm/scatterlist.h27
-rw-r--r--arch/arm/include/asm/sections.h1
-rw-r--r--arch/arm/include/asm/segment.h11
-rw-r--r--arch/arm/include/asm/sembuf.h25
-rw-r--r--arch/arm/include/asm/serial.h19
-rw-r--r--arch/arm/include/asm/setup.h226
-rw-r--r--arch/arm/include/asm/shmbuf.h42
-rw-r--r--arch/arm/include/asm/shmparam.h16
-rw-r--r--arch/arm/include/asm/sigcontext.h34
-rw-r--r--arch/arm/include/asm/siginfo.h6
-rw-r--r--arch/arm/include/asm/signal.h164
-rw-r--r--arch/arm/include/asm/sizes.h56
-rw-r--r--arch/arm/include/asm/smp.h147
-rw-r--r--arch/arm/include/asm/socket.h57
-rw-r--r--arch/arm/include/asm/sockios.h13
-rw-r--r--arch/arm/include/asm/sparsemem.h10
-rw-r--r--arch/arm/include/asm/spinlock.h224
-rw-r--r--arch/arm/include/asm/spinlock_types.h20
-rw-r--r--arch/arm/include/asm/stat.h87
-rw-r--r--arch/arm/include/asm/statfs.h42
-rw-r--r--arch/arm/include/asm/string.h50
-rw-r--r--arch/arm/include/asm/suspend.h4
-rw-r--r--arch/arm/include/asm/system.h388
-rw-r--r--arch/arm/include/asm/termbits.h197
-rw-r--r--arch/arm/include/asm/termios.h92
-rw-r--r--arch/arm/include/asm/therm.h28
-rw-r--r--arch/arm/include/asm/thread_info.h153
-rw-r--r--arch/arm/include/asm/thread_notify.h48
-rw-r--r--arch/arm/include/asm/timex.h24
-rw-r--r--arch/arm/include/asm/tlb.h94
-rw-r--r--arch/arm/include/asm/tlbflush.h500
-rw-r--r--arch/arm/include/asm/topology.h6
-rw-r--r--arch/arm/include/asm/traps.h29
-rw-r--r--arch/arm/include/asm/types.h31
-rw-r--r--arch/arm/include/asm/uaccess.h444
-rw-r--r--arch/arm/include/asm/ucontext.h103
-rw-r--r--arch/arm/include/asm/unaligned.h19
-rw-r--r--arch/arm/include/asm/unistd.h450
-rw-r--r--arch/arm/include/asm/user.h84
-rw-r--r--arch/arm/include/asm/vfp.h84
-rw-r--r--arch/arm/include/asm/vfpmacros.h47
-rw-r--r--arch/arm/include/asm/vga.h12
-rw-r--r--arch/arm/include/asm/xor.h141
-rw-r--r--arch/arm/kernel/crunch-bits.S2
-rw-r--r--arch/arm/kernel/crunch.c2
-rw-r--r--arch/arm/kernel/debug.S2
-rw-r--r--arch/arm/kernel/ecard.c2
-rw-r--r--arch/arm/kernel/entry-armv.S2
-rw-r--r--arch/arm/kernel/entry-common.S2
-rw-r--r--arch/arm/kernel/head-common.S2
-rw-r--r--arch/arm/kernel/head-nommu.S1
-rw-r--r--arch/arm/kernel/irq.c1
-rw-r--r--arch/arm/kernel/process.c2
-rw-r--r--arch/arm/lib/ecard.S2
-rw-r--r--arch/arm/lib/getuser.S2
-rw-r--r--arch/arm/lib/io-readsw-armv3.S2
-rw-r--r--arch/arm/lib/io-writesw-armv3.S2
-rw-r--r--arch/arm/lib/putuser.S2
-rw-r--r--arch/arm/mach-aaec2000/aaed2000.c4
-rw-r--r--arch/arm/mach-aaec2000/core.c2
-rw-r--r--arch/arm/mach-aaec2000/include/mach/aaec2000.h207
-rw-r--r--arch/arm/mach-aaec2000/include/mach/aaed2000.h40
-rw-r--r--arch/arm/mach-aaec2000/include/mach/debug-macro.S37
-rw-r--r--arch/arm/mach-aaec2000/include/mach/dma.h9
-rw-r--r--arch/arm/mach-aaec2000/include/mach/entry-macro.S40
-rw-r--r--arch/arm/mach-aaec2000/include/mach/hardware.h50
-rw-r--r--arch/arm/mach-aaec2000/include/mach/io.h20
-rw-r--r--arch/arm/mach-aaec2000/include/mach/irqs.h46
-rw-r--r--arch/arm/mach-aaec2000/include/mach/memory.h30
-rw-r--r--arch/arm/mach-aaec2000/include/mach/system.h24
-rw-r--r--arch/arm/mach-aaec2000/include/mach/timex.h18
-rw-r--r--arch/arm/mach-aaec2000/include/mach/uncompress.h46
-rw-r--r--arch/arm/mach-aaec2000/include/mach/vmalloc.h16
-rw-r--r--arch/arm/mach-at91/at91cap9.c8
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c10
-rw-r--r--arch/arm/mach-at91/at91rm9200.c6
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c8
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260.c10
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c12
-rw-r--r--arch/arm/mach-at91/at91sam9261.c8
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c10
-rw-r--r--arch/arm/mach-at91/at91sam9263.c8
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c10
-rw-r--r--arch/arm/mach-at91/at91sam926x_time.c2
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c10
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c10
-rw-r--r--arch/arm/mach-at91/at91x40.c6
-rw-r--r--arch/arm/mach-at91/at91x40_time.c4
-rw-r--r--arch/arm/mach-at91/board-1arm.c6
-rw-r--r--arch/arm/mach-at91/board-cam60.c6
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c10
-rw-r--r--arch/arm/mach-at91/board-carmeva.c6
-rw-r--r--arch/arm/mach-at91/board-csb337.c6
-rw-r--r--arch/arm/mach-at91/board-csb637.c6
-rw-r--r--arch/arm/mach-at91/board-dk.c8
-rw-r--r--arch/arm/mach-at91/board-eb01.c4
-rw-r--r--arch/arm/mach-at91/board-eb9200.c6
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c6
-rw-r--r--arch/arm/mach-at91/board-ek.c8
-rw-r--r--arch/arm/mach-at91/board-kafa.c6
-rw-r--r--arch/arm/mach-at91/board-kb9202.c8
-rw-r--r--arch/arm/mach-at91/board-picotux200.c8
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c8
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c6
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c6
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c8
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c8
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c6
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c8
-rw-r--r--arch/arm/mach-at91/board-usb-a9260.c8
-rw-r--r--arch/arm/mach-at91/board-usb-a9263.c8
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c8
-rw-r--r--arch/arm/mach-at91/clock.c7
-rw-r--r--arch/arm/mach-at91/gpio.c6
-rw-r--r--arch/arm/mach-at91/include/mach/at91_adc.h61
-rw-r--r--arch/arm/mach-at91/include/mach/at91_aic.h53
-rw-r--r--arch/arm/mach-at91/include/mach/at91_dbgu.h66
-rw-r--r--arch/arm/mach-at91/include/mach/at91_mci.h113
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pio.h49
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pit.h29
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc.h111
-rw-r--r--arch/arm/mach-at91/include/mach/at91_rstc.h38
-rw-r--r--arch/arm/mach-at91/include/mach/at91_rtc.h75
-rw-r--r--arch/arm/mach-at91/include/mach/at91_rtt.h32
-rw-r--r--arch/arm/mach-at91/include/mach/at91_shdwc.h35
-rw-r--r--arch/arm/mach-at91/include/mach/at91_spi.h81
-rw-r--r--arch/arm/mach-at91/include/mach/at91_ssc.h106
-rw-r--r--arch/arm/mach-at91/include/mach/at91_st.h49
-rw-r--r--arch/arm/mach-at91/include/mach/at91_tc.h146
-rw-r--r--arch/arm/mach-at91/include/mach/at91_twi.h68
-rw-r--r--arch/arm/mach-at91/include/mach/at91_wdt.h34
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9.h126
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h100
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9_matrix.h137
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200.h115
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200_emac.h138
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200_mc.h160
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9260.h138
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9260_matrix.h78
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9261.h105
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9261_matrix.h62
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9263.h127
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9263_matrix.h129
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_sdramc.h83
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_smc.h73
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9rl.h115
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h96
-rw-r--r--arch/arm/mach-at91/include/mach/at91x40.h55
-rw-r--r--arch/arm/mach-at91/include/mach/board.h172
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h103
-rw-r--r--arch/arm/mach-at91/include/mach/debug-macro.S39
-rw-r--r--arch/arm/mach-at91/include/mach/dma.h19
-rw-r--r--arch/arm/mach-at91/include/mach/entry-macro.S32
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h252
-rw-r--r--arch/arm/mach-at91/include/mach/hardware.h92
-rw-r--r--arch/arm/mach-at91/include/mach/io.h48
-rw-r--r--arch/arm/mach-at91/include/mach/irqs.h48
-rw-r--r--arch/arm/mach-at91/include/mach/memory.h39
-rw-r--r--arch/arm/mach-at91/include/mach/system.h53
-rw-r--r--arch/arm/mach-at91/include/mach/timex.h77
-rw-r--r--arch/arm/mach-at91/include/mach/uncompress.h76
-rw-r--r--arch/arm/mach-at91/include/mach/vmalloc.h26
-rw-r--r--arch/arm/mach-at91/irq.c3
-rw-r--r--arch/arm/mach-at91/leds.c5
-rw-r--r--arch/arm/mach-at91/pm.c17
-rw-r--r--arch/arm/mach-clps711x/autcpu12.c4
-rw-r--r--arch/arm/mach-clps711x/cdb89712.c2
-rw-r--r--arch/arm/mach-clps711x/ceiva.c2
-rw-r--r--arch/arm/mach-clps711x/edb7211-mm.c2
-rw-r--r--arch/arm/mach-clps711x/fortunet.c2
-rw-r--r--arch/arm/mach-clps711x/include/mach/autcpu12.h78
-rw-r--r--arch/arm/mach-clps711x/include/mach/debug-macro.S46
-rw-r--r--arch/arm/mach-clps711x/include/mach/dma.h19
-rw-r--r--arch/arm/mach-clps711x/include/mach/entry-macro.S58
-rw-r--r--arch/arm/mach-clps711x/include/mach/hardware.h237
-rw-r--r--arch/arm/mach-clps711x/include/mach/io.h38
-rw-r--r--arch/arm/mach-clps711x/include/mach/irqs.h53
-rw-r--r--arch/arm/mach-clps711x/include/mach/memory.h94
-rw-r--r--arch/arm/mach-clps711x/include/mach/syspld.h121
-rw-r--r--arch/arm/mach-clps711x/include/mach/system.h40
-rw-r--r--arch/arm/mach-clps711x/include/mach/time.h49
-rw-r--r--arch/arm/mach-clps711x/include/mach/timex.h23
-rw-r--r--arch/arm/mach-clps711x/include/mach/uncompress.h59
-rw-r--r--arch/arm/mach-clps711x/include/mach/vmalloc.h20
-rw-r--r--arch/arm/mach-clps711x/irq.c2
-rw-r--r--arch/arm/mach-clps711x/mm.c2
-rw-r--r--arch/arm/mach-clps711x/p720t-leds.c2
-rw-r--r--arch/arm/mach-clps711x/p720t.c4
-rw-r--r--arch/arm/mach-clps711x/time.c2
-rw-r--r--arch/arm/mach-clps7500/core.c2
-rw-r--r--arch/arm/mach-clps7500/include/mach/acornfb.h33
-rw-r--r--arch/arm/mach-clps7500/include/mach/debug-macro.S21
-rw-r--r--arch/arm/mach-clps7500/include/mach/dma.h21
-rw-r--r--arch/arm/mach-clps7500/include/mach/entry-macro.S16
-rw-r--r--arch/arm/mach-clps7500/include/mach/hardware.h67
-rw-r--r--arch/arm/mach-clps7500/include/mach/io.h255
-rw-r--r--arch/arm/mach-clps7500/include/mach/irq.h32
-rw-r--r--arch/arm/mach-clps7500/include/mach/irqs.h66
-rw-r--r--arch/arm/mach-clps7500/include/mach/memory.h35
-rw-r--r--arch/arm/mach-clps7500/include/mach/system.h23
-rw-r--r--arch/arm/mach-clps7500/include/mach/timex.h13
-rw-r--r--arch/arm/mach-clps7500/include/mach/uncompress.h35
-rw-r--r--arch/arm/mach-clps7500/include/mach/vmalloc.h4
-rw-r--r--arch/arm/mach-davinci/board-evm.c4
-rw-r--r--arch/arm/mach-davinci/clock.c4
-rw-r--r--arch/arm/mach-davinci/gpio.c6
-rw-r--r--arch/arm/mach-davinci/include/mach/clock.h22
-rw-r--r--arch/arm/mach-davinci/include/mach/common.h19
-rw-r--r--arch/arm/mach-davinci/include/mach/debug-macro.S21
-rw-r--r--arch/arm/mach-davinci/include/mach/dma.h16
-rw-r--r--arch/arm/mach-davinci/include/mach/entry-macro.S32
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio.h159
-rw-r--r--arch/arm/mach-davinci/include/mach/hardware.h52
-rw-r--r--arch/arm/mach-davinci/include/mach/i2c.h21
-rw-r--r--arch/arm/mach-davinci/include/mach/io.h79
-rw-r--r--arch/arm/mach-davinci/include/mach/irqs.h105
-rw-r--r--arch/arm/mach-davinci/include/mach/memory.h64
-rw-r--r--arch/arm/mach-davinci/include/mach/mux.h55
-rw-r--r--arch/arm/mach-davinci/include/mach/psc.h76
-rw-r--r--arch/arm/mach-davinci/include/mach/serial.h20
-rw-r--r--arch/arm/mach-davinci/include/mach/system.h29
-rw-r--r--arch/arm/mach-davinci/include/mach/timex.h17
-rw-r--r--arch/arm/mach-davinci/include/mach/uncompress.h35
-rw-r--r--arch/arm/mach-davinci/include/mach/vmalloc.h15
-rw-r--r--arch/arm/mach-davinci/io.c2
-rw-r--r--arch/arm/mach-davinci/irq.c2
-rw-r--r--arch/arm/mach-davinci/mux.c4
-rw-r--r--arch/arm/mach-davinci/psc.c6
-rw-r--r--arch/arm/mach-davinci/serial.c6
-rw-r--r--arch/arm/mach-davinci/time.c4
-rw-r--r--arch/arm/mach-ebsa110/core.c2
-rw-r--r--arch/arm/mach-ebsa110/include/mach/debug-macro.S21
-rw-r--r--arch/arm/mach-ebsa110/include/mach/dma.h11
-rw-r--r--arch/arm/mach-ebsa110/include/mach/entry-macro.S39
-rw-r--r--arch/arm/mach-ebsa110/include/mach/hardware.h63
-rw-r--r--arch/arm/mach-ebsa110/include/mach/io.h92
-rw-r--r--arch/arm/mach-ebsa110/include/mach/irqs.h20
-rw-r--r--arch/arm/mach-ebsa110/include/mach/memory.h37
-rw-r--r--arch/arm/mach-ebsa110/include/mach/system.h39
-rw-r--r--arch/arm/mach-ebsa110/include/mach/timex.h19
-rw-r--r--arch/arm/mach-ebsa110/include/mach/uncompress.h45
-rw-r--r--arch/arm/mach-ebsa110/include/mach/vmalloc.h10
-rw-r--r--arch/arm/mach-ebsa110/io.c2
-rw-r--r--arch/arm/mach-ebsa110/leds.c2
-rw-r--r--arch/arm/mach-ep93xx/adssphere.c2
-rw-r--r--arch/arm/mach-ep93xx/clock.c2
-rw-r--r--arch/arm/mach-ep93xx/core.c4
-rw-r--r--arch/arm/mach-ep93xx/edb9302.c2
-rw-r--r--arch/arm/mach-ep93xx/edb9302a.c2
-rw-r--r--arch/arm/mach-ep93xx/edb9307.c2
-rw-r--r--arch/arm/mach-ep93xx/edb9312.c2
-rw-r--r--arch/arm/mach-ep93xx/edb9315.c2
-rw-r--r--arch/arm/mach-ep93xx/edb9315a.c2
-rw-r--r--arch/arm/mach-ep93xx/gesbc9312.c2
-rw-r--r--arch/arm/mach-ep93xx/gpio.c2
-rw-r--r--arch/arm/mach-ep93xx/include/mach/debug-macro.S22
-rw-r--r--arch/arm/mach-ep93xx/include/mach/dma.h3
-rw-r--r--arch/arm/mach-ep93xx/include/mach/entry-macro.S59
-rw-r--r--arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h133
-rw-r--r--arch/arm/mach-ep93xx/include/mach/gesbc9312.h3
-rw-r--r--arch/arm/mach-ep93xx/include/mach/gpio.h128
-rw-r--r--arch/arm/mach-ep93xx/include/mach/hardware.h16
-rw-r--r--arch/arm/mach-ep93xx/include/mach/io.h8
-rw-r--r--arch/arm/mach-ep93xx/include/mach/irqs.h78
-rw-r--r--arch/arm/mach-ep93xx/include/mach/memory.h14
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h20
-rw-r--r--arch/arm/mach-ep93xx/include/mach/system.h26
-rw-r--r--arch/arm/mach-ep93xx/include/mach/timex.h5
-rw-r--r--arch/arm/mach-ep93xx/include/mach/ts72xx.h101
-rw-r--r--arch/arm/mach-ep93xx/include/mach/uncompress.h85
-rw-r--r--arch/arm/mach-ep93xx/include/mach/vmalloc.h5
-rw-r--r--arch/arm/mach-ep93xx/micro9.c2
-rw-r--r--arch/arm/mach-ep93xx/ts72xx.c2
-rw-r--r--arch/arm/mach-footbridge/ebsa285-leds.c2
-rw-r--r--arch/arm/mach-footbridge/include/mach/debug-macro.S57
-rw-r--r--arch/arm/mach-footbridge/include/mach/dma.h25
-rw-r--r--arch/arm/mach-footbridge/include/mach/entry-macro.S113
-rw-r--r--arch/arm/mach-footbridge/include/mach/hardware.h105
-rw-r--r--arch/arm/mach-footbridge/include/mach/io.h39
-rw-r--r--arch/arm/mach-footbridge/include/mach/irqs.h98
-rw-r--r--arch/arm/mach-footbridge/include/mach/memory.h67
-rw-r--r--arch/arm/mach-footbridge/include/mach/system.h69
-rw-r--r--arch/arm/mach-footbridge/include/mach/timex.h18
-rw-r--r--arch/arm/mach-footbridge/include/mach/uncompress.h38
-rw-r--r--arch/arm/mach-footbridge/include/mach/vmalloc.h10
-rw-r--r--arch/arm/mach-footbridge/isa-irq.c2
-rw-r--r--arch/arm/mach-footbridge/netwinder-leds.c2
-rw-r--r--arch/arm/mach-footbridge/time.c4
-rw-r--r--arch/arm/mach-h720x/common.c4
-rw-r--r--arch/arm/mach-h720x/cpu-h7201.c4
-rw-r--r--arch/arm/mach-h720x/cpu-h7202.c4
-rw-r--r--arch/arm/mach-h720x/h7201-eval.c2
-rw-r--r--arch/arm/mach-h720x/h7202-eval.c2
-rw-r--r--arch/arm/mach-h720x/include/mach/boards.h53
-rw-r--r--arch/arm/mach-h720x/include/mach/debug-macro.S40
-rw-r--r--arch/arm/mach-h720x/include/mach/dma.h26
-rw-r--r--arch/arm/mach-h720x/include/mach/entry-macro.S66
-rw-r--r--arch/arm/mach-h720x/include/mach/h7201-regs.h67
-rw-r--r--arch/arm/mach-h720x/include/mach/h7202-regs.h155
-rw-r--r--arch/arm/mach-h720x/include/mach/hardware.h192
-rw-r--r--arch/arm/mach-h720x/include/mach/io.h24
-rw-r--r--arch/arm/mach-h720x/include/mach/irqs.h116
-rw-r--r--arch/arm/mach-h720x/include/mach/memory.h29
-rw-r--r--arch/arm/mach-h720x/include/mach/system.h33
-rw-r--r--arch/arm/mach-h720x/include/mach/timex.h15
-rw-r--r--arch/arm/mach-h720x/include/mach/uncompress.h37
-rw-r--r--arch/arm/mach-h720x/include/mach/vmalloc.h10
-rw-r--r--arch/arm/mach-imx/clock.c7
-rw-r--r--arch/arm/mach-imx/cpufreq.c2
-rw-r--r--arch/arm/mach-imx/dma.c4
-rw-r--r--arch/arm/mach-imx/generic.c11
-rw-r--r--arch/arm/mach-imx/include/mach/debug-macro.S34
-rw-r--r--arch/arm/mach-imx/include/mach/dma.h56
-rw-r--r--arch/arm/mach-imx/include/mach/entry-macro.S32
-rw-r--r--arch/arm/mach-imx/include/mach/gpio.h102
-rw-r--r--arch/arm/mach-imx/include/mach/hardware.h91
-rw-r--r--arch/arm/mach-imx/include/mach/imx-dma.h94
-rw-r--r--arch/arm/mach-imx/include/mach/imx-regs.h482
-rw-r--r--arch/arm/mach-imx/include/mach/imx-uart.h12
-rw-r--r--arch/arm/mach-imx/include/mach/imxfb.h37
-rw-r--r--arch/arm/mach-imx/include/mach/io.h30
-rw-r--r--arch/arm/mach-imx/include/mach/irqs.h116
-rw-r--r--arch/arm/mach-imx/include/mach/memory.h36
-rw-r--r--arch/arm/mach-imx/include/mach/mmc.h15
-rw-r--r--arch/arm/mach-imx/include/mach/mx1ads.h36
-rw-r--r--arch/arm/mach-imx/include/mach/spi_imx.h72
-rw-r--r--arch/arm/mach-imx/include/mach/system.h40
-rw-r--r--arch/arm/mach-imx/include/mach/timex.h26
-rw-r--r--arch/arm/mach-imx/include/mach/uncompress.h71
-rw-r--r--arch/arm/mach-imx/include/mach/vmalloc.h20
-rw-r--r--arch/arm/mach-imx/irq.c2
-rw-r--r--arch/arm/mach-imx/leds-mx1ads.c2
-rw-r--r--arch/arm/mach-imx/mx1ads.c10
-rw-r--r--arch/arm/mach-imx/time.c2
-rw-r--r--arch/arm/mach-integrator/core.c4
-rw-r--r--arch/arm/mach-integrator/cpu.c2
-rw-r--r--arch/arm/mach-integrator/impd1.c4
-rw-r--r--arch/arm/mach-integrator/include/mach/bits.h61
-rw-r--r--arch/arm/mach-integrator/include/mach/cm.h36
-rw-r--r--arch/arm/mach-integrator/include/mach/debug-macro.S22
-rw-r--r--arch/arm/mach-integrator/include/mach/dma.h19
-rw-r--r--arch/arm/mach-integrator/include/mach/entry-macro.S44
-rw-r--r--arch/arm/mach-integrator/include/mach/hardware.h48
-rw-r--r--arch/arm/mach-integrator/include/mach/impd1.h18
-rw-r--r--arch/arm/mach-integrator/include/mach/io.h36
-rw-r--r--arch/arm/mach-integrator/include/mach/irqs.h82
-rw-r--r--arch/arm/mach-integrator/include/mach/lm.h23
-rw-r--r--arch/arm/mach-integrator/include/mach/memory.h39
-rw-r--r--arch/arm/mach-integrator/include/mach/platform.h469
-rw-r--r--arch/arm/mach-integrator/include/mach/system.h44
-rw-r--r--arch/arm/mach-integrator/include/mach/timex.h26
-rw-r--r--arch/arm/mach-integrator/include/mach/uncompress.h50
-rw-r--r--arch/arm/mach-integrator/include/mach/vmalloc.h20
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c4
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c6
-rw-r--r--arch/arm/mach-integrator/leds.c4
-rw-r--r--arch/arm/mach-integrator/lm.c2
-rw-r--r--arch/arm/mach-integrator/pci_v3.c2
-rw-r--r--arch/arm/mach-iop13xx/include/mach/adma.h537
-rw-r--r--arch/arm/mach-iop13xx/include/mach/debug-macro.S26
-rw-r--r--arch/arm/mach-iop13xx/include/mach/dma.h3
-rw-r--r--arch/arm/mach-iop13xx/include/mach/entry-macro.S45
-rw-r--r--arch/arm/mach-iop13xx/include/mach/hardware.h28
-rw-r--r--arch/arm/mach-iop13xx/include/mach/io.h41
-rw-r--r--arch/arm/mach-iop13xx/include/mach/iop13xx.h526
-rw-r--r--arch/arm/mach-iop13xx/include/mach/iq81340.h28
-rw-r--r--arch/arm/mach-iop13xx/include/mach/irqs.h196
-rw-r--r--arch/arm/mach-iop13xx/include/mach/memory.h64
-rw-r--r--arch/arm/mach-iop13xx/include/mach/msi.h11
-rw-r--r--arch/arm/mach-iop13xx/include/mach/pci.h57
-rw-r--r--arch/arm/mach-iop13xx/include/mach/system.h27
-rw-r--r--arch/arm/mach-iop13xx/include/mach/time.h107
-rw-r--r--arch/arm/mach-iop13xx/include/mach/timex.h3
-rw-r--r--arch/arm/mach-iop13xx/include/mach/uncompress.h23
-rw-r--r--arch/arm/mach-iop13xx/include/mach/vmalloc.h4
-rw-r--r--arch/arm/mach-iop13xx/io.c2
-rw-r--r--arch/arm/mach-iop13xx/iq81340mc.c6
-rw-r--r--arch/arm/mach-iop13xx/iq81340sc.c6
-rw-r--r--arch/arm/mach-iop13xx/irq.c7
-rw-r--r--arch/arm/mach-iop13xx/pci.c4
-rw-r--r--arch/arm/mach-iop13xx/setup.c2
-rw-r--r--arch/arm/mach-iop32x/em7210.c4
-rw-r--r--arch/arm/mach-iop32x/glantank.c4
-rw-r--r--arch/arm/mach-iop32x/include/mach/adma.h5
-rw-r--r--arch/arm/mach-iop32x/include/mach/debug-macro.S20
-rw-r--r--arch/arm/mach-iop32x/include/mach/dma.h9
-rw-r--r--arch/arm/mach-iop32x/include/mach/entry-macro.S36
-rw-r--r--arch/arm/mach-iop32x/include/mach/glantank.h13
-rw-r--r--arch/arm/mach-iop32x/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-iop32x/include/mach/hardware.h44
-rw-r--r--arch/arm/mach-iop32x/include/mach/io.h27
-rw-r--r--arch/arm/mach-iop32x/include/mach/iop32x.h37
-rw-r--r--arch/arm/mach-iop32x/include/mach/iq31244.h17
-rw-r--r--arch/arm/mach-iop32x/include/mach/iq80321.h17
-rw-r--r--arch/arm/mach-iop32x/include/mach/irqs.h50
-rw-r--r--arch/arm/mach-iop32x/include/mach/memory.h26
-rw-r--r--arch/arm/mach-iop32x/include/mach/n2100.h19
-rw-r--r--arch/arm/mach-iop32x/include/mach/system.h33
-rw-r--r--arch/arm/mach-iop32x/include/mach/time.h4
-rw-r--r--arch/arm/mach-iop32x/include/mach/timex.h9
-rw-r--r--arch/arm/mach-iop32x/include/mach/uncompress.h39
-rw-r--r--arch/arm/mach-iop32x/include/mach/vmalloc.h5
-rw-r--r--arch/arm/mach-iop32x/iq31244.c4
-rw-r--r--arch/arm/mach-iop32x/iq80321.c4
-rw-r--r--arch/arm/mach-iop32x/irq.c2
-rw-r--r--arch/arm/mach-iop32x/n2100.c4
-rw-r--r--arch/arm/mach-iop33x/include/mach/adma.h5
-rw-r--r--arch/arm/mach-iop33x/include/mach/debug-macro.S24
-rw-r--r--arch/arm/mach-iop33x/include/mach/dma.h9
-rw-r--r--arch/arm/mach-iop33x/include/mach/entry-macro.S37
-rw-r--r--arch/arm/mach-iop33x/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-iop33x/include/mach/hardware.h46
-rw-r--r--arch/arm/mach-iop33x/include/mach/io.h27
-rw-r--r--arch/arm/mach-iop33x/include/mach/iop33x.h43
-rw-r--r--arch/arm/mach-iop33x/include/mach/iq80331.h16
-rw-r--r--arch/arm/mach-iop33x/include/mach/iq80332.h16
-rw-r--r--arch/arm/mach-iop33x/include/mach/irqs.h60
-rw-r--r--arch/arm/mach-iop33x/include/mach/memory.h26
-rw-r--r--arch/arm/mach-iop33x/include/mach/system.h22
-rw-r--r--arch/arm/mach-iop33x/include/mach/time.h4
-rw-r--r--arch/arm/mach-iop33x/include/mach/timex.h9
-rw-r--r--arch/arm/mach-iop33x/include/mach/uncompress.h37
-rw-r--r--arch/arm/mach-iop33x/include/mach/vmalloc.h5
-rw-r--r--arch/arm/mach-iop33x/iq80331.c4
-rw-r--r--arch/arm/mach-iop33x/iq80332.c4
-rw-r--r--arch/arm/mach-iop33x/irq.c2
-rw-r--r--arch/arm/mach-iop33x/uart.c3
-rw-r--r--arch/arm/mach-ixp2000/core.c4
-rw-r--r--arch/arm/mach-ixp2000/enp2611.c2
-rw-r--r--arch/arm/mach-ixp2000/include/mach/debug-macro.S27
-rw-r--r--arch/arm/mach-ixp2000/include/mach/dma.h9
-rw-r--r--arch/arm/mach-ixp2000/include/mach/enp2611.h46
-rw-r--r--arch/arm/mach-ixp2000/include/mach/entry-macro.S60
-rw-r--r--arch/arm/mach-ixp2000/include/mach/gpio.h48
-rw-r--r--arch/arm/mach-ixp2000/include/mach/hardware.h44
-rw-r--r--arch/arm/mach-ixp2000/include/mach/io.h134
-rw-r--r--arch/arm/mach-ixp2000/include/mach/irqs.h207
-rw-r--r--arch/arm/mach-ixp2000/include/mach/ixdp2x00.h92
-rw-r--r--arch/arm/mach-ixp2000/include/mach/ixdp2x01.h57
-rw-r--r--arch/arm/mach-ixp2000/include/mach/ixp2000-regs.h457
-rw-r--r--arch/arm/mach-ixp2000/include/mach/memory.h34
-rw-r--r--arch/arm/mach-ixp2000/include/mach/platform.h152
-rw-r--r--arch/arm/mach-ixp2000/include/mach/system.h49
-rw-r--r--arch/arm/mach-ixp2000/include/mach/timex.h13
-rw-r--r--arch/arm/mach-ixp2000/include/mach/uncompress.h47
-rw-r--r--arch/arm/mach-ixp2000/include/mach/vmalloc.h20
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c2
-rw-r--r--arch/arm/mach-ixp2000/ixdp2800.c2
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x00.c4
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x01.c2
-rw-r--r--arch/arm/mach-ixp2000/pci.c2
-rw-r--r--arch/arm/mach-ixp23xx/core.c3
-rw-r--r--arch/arm/mach-ixp23xx/espresso.c2
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/debug-macro.S26
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/dma.h3
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/entry-macro.S37
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/hardware.h37
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/io.h54
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/irqs.h223
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/ixdp2351.h89
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/ixp23xx.h298
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/memory.h48
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/platform.h57
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/system.h33
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/time.h3
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/timex.h7
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/uncompress.h40
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/vmalloc.h10
-rw-r--r--arch/arm/mach-ixp23xx/ixdp2351.c2
-rw-r--r--arch/arm/mach-ixp23xx/pci.c3
-rw-r--r--arch/arm/mach-ixp23xx/roadrunner.c2
-rw-r--r--arch/arm/mach-ixp4xx/avila-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/avila-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/common.c4
-rw-r--r--arch/arm/mach-ixp4xx/coyote-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/gateway7001-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/gateway7001-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-pci.c4
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-setup.c4
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/avila.h39
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/coyote.h33
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/cpu.h46
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/debug-macro.S24
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/dma.h21
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/dsmg600.h52
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/entry-macro.S47
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/fsg.h50
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/gpio.h73
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/gtwx5715.h116
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/hardware.h50
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/io.h569
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/irqs.h138
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/ixdp425.h39
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h638
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/memory.h40
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/nas100d.h52
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/npe.h39
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/nslu2.h55
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/platform.h173
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/prpmc1100.h33
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/qmgr.h126
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/system.h42
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/timex.h15
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/udc.h8
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/uncompress.h57
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/vmalloc.h5
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/ixdpg425-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_npe.c2
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_qmgr.c2
-rw-r--r--arch/arm/mach-ixp4xx/wg302v2-pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/wg302v2-setup.c2
-rw-r--r--arch/arm/mach-kirkwood/addr-map.c2
-rw-r--r--arch/arm/mach-kirkwood/common.c2
-rw-r--r--arch/arm/mach-kirkwood/db88f6281-bp-setup.c2
-rw-r--r--arch/arm/mach-kirkwood/include/mach/debug-macro.S20
-rw-r--r--arch/arm/mach-kirkwood/include/mach/dma.h1
-rw-r--r--arch/arm/mach-kirkwood/include/mach/entry-macro.S40
-rw-r--r--arch/arm/mach-kirkwood/include/mach/hardware.h21
-rw-r--r--arch/arm/mach-kirkwood/include/mach/io.h26
-rw-r--r--arch/arm/mach-kirkwood/include/mach/irqs.h63
-rw-r--r--arch/arm/mach-kirkwood/include/mach/kirkwood.h100
-rw-r--r--arch/arm/mach-kirkwood/include/mach/memory.h14
-rw-r--r--arch/arm/mach-kirkwood/include/mach/system.h37
-rw-r--r--arch/arm/mach-kirkwood/include/mach/timex.h11
-rw-r--r--arch/arm/mach-kirkwood/include/mach/uncompress.h47
-rw-r--r--arch/arm/mach-kirkwood/include/mach/vmalloc.h5
-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-ks8695/board-micrel.c2
-rw-r--r--arch/arm/mach-ks8695/cpu.c6
-rw-r--r--arch/arm/mach-ks8695/devices.c6
-rw-r--r--arch/arm/mach-ks8695/gpio.c6
-rw-r--r--arch/arm/mach-ks8695/include/mach/debug-macro.S38
-rw-r--r--arch/arm/mach-ks8695/include/mach/devices.h37
-rw-r--r--arch/arm/mach-ks8695/include/mach/dma.h17
-rw-r--r--arch/arm/mach-ks8695/include/mach/entry-macro.S53
-rw-r--r--arch/arm/mach-ks8695/include/mach/gpio.h79
-rw-r--r--arch/arm/mach-ks8695/include/mach/hardware.h49
-rw-r--r--arch/arm/mach-ks8695/include/mach/io.h19
-rw-r--r--arch/arm/mach-ks8695/include/mach/irqs.h54
-rw-r--r--arch/arm/mach-ks8695/include/mach/memory.h49
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-gpio.h55
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-hpna.h25
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-irq.h41
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-lan.h65
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-mem.h89
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-misc.h97
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-pci.h53
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-switch.h66
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-sys.h34
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-timer.h40
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-uart.h92
-rw-r--r--arch/arm/mach-ks8695/include/mach/regs-wan.h65
-rw-r--r--arch/arm/mach-ks8695/include/mach/system.h48
-rw-r--r--arch/arm/mach-ks8695/include/mach/timex.h20
-rw-r--r--arch/arm/mach-ks8695/include/mach/uncompress.h37
-rw-r--r--arch/arm/mach-ks8695/include/mach/vmalloc.h19
-rw-r--r--arch/arm/mach-ks8695/irq.c6
-rw-r--r--arch/arm/mach-ks8695/leds.c5
-rw-r--r--arch/arm/mach-ks8695/pci.c6
-rw-r--r--arch/arm/mach-ks8695/time.c4
-rw-r--r--arch/arm/mach-l7200/core.c2
-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/dma.h23
-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.h27
-rw-r--r--arch/arm/mach-l7200/include/mach/irqs.h56
-rw-r--r--arch/arm/mach-l7200/include/mach/memory.h29
-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/arch-kev7a400.c2
-rw-r--r--arch/arm/mach-lh7a40x/arch-lpd7a40x.c2
-rw-r--r--arch/arm/mach-lh7a40x/clcd.c3
-rw-r--r--arch/arm/mach-lh7a40x/clocks.c4
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/clocks.h18
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/constants.h91
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/debug-macro.S39
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/dma.h86
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/entry-macro.S149
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/hardware.h62
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/io.h22
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/irqs.h200
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/memory.h76
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/registers.h224
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/ssp.h71
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/system.h19
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/timex.h17
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/uncompress.h38
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/vmalloc.h10
-rw-r--r--arch/arm/mach-lh7a40x/irq-lh7a400.c4
-rw-r--r--arch/arm/mach-lh7a40x/irq-lh7a404.c4
-rw-r--r--arch/arm/mach-lh7a40x/irq-lpd7a40x.c4
-rw-r--r--arch/arm/mach-lh7a40x/ssp-cpld.c4
-rw-r--r--arch/arm/mach-lh7a40x/time.c2
-rw-r--r--arch/arm/mach-loki/addr-map.c2
-rw-r--r--arch/arm/mach-loki/common.c2
-rw-r--r--arch/arm/mach-loki/include/mach/debug-macro.S20
-rw-r--r--arch/arm/mach-loki/include/mach/dma.h1
-rw-r--r--arch/arm/mach-loki/include/mach/entry-macro.S30
-rw-r--r--arch/arm/mach-loki/include/mach/hardware.h15
-rw-r--r--arch/arm/mach-loki/include/mach/io.h26
-rw-r--r--arch/arm/mach-loki/include/mach/irqs.h58
-rw-r--r--arch/arm/mach-loki/include/mach/loki.h97
-rw-r--r--arch/arm/mach-loki/include/mach/memory.h14
-rw-r--r--arch/arm/mach-loki/include/mach/system.h37
-rw-r--r--arch/arm/mach-loki/include/mach/timex.h11
-rw-r--r--arch/arm/mach-loki/include/mach/uncompress.h47
-rw-r--r--arch/arm/mach-loki/include/mach/vmalloc.h5
-rw-r--r--arch/arm/mach-loki/lb88rc8480-setup.c2
-rw-r--r--arch/arm/mach-msm/board-halibut.c6
-rw-r--r--arch/arm/mach-msm/common.c4
-rw-r--r--arch/arm/mach-msm/dma.c2
-rw-r--r--arch/arm/mach-msm/idle.S2
-rw-r--r--arch/arm/mach-msm/include/mach/board.h37
-rw-r--r--arch/arm/mach-msm/include/mach/debug-macro.S40
-rw-r--r--arch/arm/mach-msm/include/mach/dma.h151
-rw-r--r--arch/arm/mach-msm/include/mach/entry-macro.S38
-rw-r--r--arch/arm/mach-msm/include/mach/hardware.h18
-rw-r--r--arch/arm/mach-msm/include/mach/io.h33
-rw-r--r--arch/arm/mach-msm/include/mach/irqs.h90
-rw-r--r--arch/arm/mach-msm/include/mach/memory.h27
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap.h104
-rw-r--r--arch/arm/mach-msm/include/mach/system.h23
-rw-r--r--arch/arm/mach-msm/include/mach/timex.h21
-rw-r--r--arch/arm/mach-msm/include/mach/uncompress.h36
-rw-r--r--arch/arm/mach-msm/include/mach/vmalloc.h22
-rw-r--r--arch/arm/mach-msm/io.c6
-rw-r--r--arch/arm/mach-msm/irq.c4
-rw-r--r--arch/arm/mach-msm/timer.c2
-rw-r--r--arch/arm/mach-mv78xx0/common.c2
-rw-r--r--arch/arm/mach-mv78xx0/db78x00-bp-setup.c2
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/debug-macro.S20
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/dma.h1
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/entry-macro.S39
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/hardware.h21
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/io.h26
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/irqs.h91
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/memory.h14
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/mv78xx0.h126
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/system.h37
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/timex.h9
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/uncompress.h47
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/vmalloc.h5
-rw-r--r--arch/arm/mach-mv78xx0/irq.c2
-rw-r--r--arch/arm/mach-mx2/clock_imx27.c5
-rw-r--r--arch/arm/mach-mx2/cpu_imx27.c2
-rw-r--r--arch/arm/mach-mx2/crm_regs.h2
-rw-r--r--arch/arm/mach-mx2/devices.c2
-rw-r--r--arch/arm/mach-mx2/generic.c2
-rw-r--r--arch/arm/mach-mx2/mx27ads.c12
-rw-r--r--arch/arm/mach-mx2/pcm038.c10
-rw-r--r--arch/arm/mach-mx2/pcm970-baseboard.c3
-rw-r--r--arch/arm/mach-mx2/serial.c4
-rw-r--r--arch/arm/mach-mx2/system.c2
-rw-r--r--arch/arm/mach-mx3/clock.c2
-rw-r--r--arch/arm/mach-mx3/devices.c4
-rw-r--r--arch/arm/mach-mx3/iomux.c6
-rw-r--r--arch/arm/mach-mx3/mm.c4
-rw-r--r--arch/arm/mach-mx3/mx31ads.c6
-rw-r--r--arch/arm/mach-mx3/mx31lite.c6
-rw-r--r--arch/arm/mach-mx3/pcm037.c10
-rw-r--r--arch/arm/mach-netx/fb.c4
-rw-r--r--arch/arm/mach-netx/generic.c4
-rw-r--r--arch/arm/mach-netx/include/mach/debug-macro.S38
-rw-r--r--arch/arm/mach-netx/include/mach/dma.h21
-rw-r--r--arch/arm/mach-netx/include/mach/entry-macro.S41
-rw-r--r--arch/arm/mach-netx/include/mach/eth.h27
-rw-r--r--arch/arm/mach-netx/include/mach/hardware.h39
-rw-r--r--arch/arm/mach-netx/include/mach/io.h28
-rw-r--r--arch/arm/mach-netx/include/mach/irqs.h70
-rw-r--r--arch/arm/mach-netx/include/mach/memory.h36
-rw-r--r--arch/arm/mach-netx/include/mach/netx-regs.h410
-rw-r--r--arch/arm/mach-netx/include/mach/param.h18
-rw-r--r--arch/arm/mach-netx/include/mach/pfifo.h54
-rw-r--r--arch/arm/mach-netx/include/mach/system.h38
-rw-r--r--arch/arm/mach-netx/include/mach/timex.h20
-rw-r--r--arch/arm/mach-netx/include/mach/uncompress.h76
-rw-r--r--arch/arm/mach-netx/include/mach/vmalloc.h19
-rw-r--r--arch/arm/mach-netx/include/mach/xc.h42
-rw-r--r--arch/arm/mach-netx/nxdb500.c6
-rw-r--r--arch/arm/mach-netx/nxdkn.c6
-rw-r--r--arch/arm/mach-netx/nxeb500hmi.c6
-rw-r--r--arch/arm/mach-netx/pfifo.c6
-rw-r--r--arch/arm/mach-netx/time.c4
-rw-r--r--arch/arm/mach-netx/xc.c6
-rw-r--r--arch/arm/mach-ns9xxx/board-a9m9750dev.c12
-rw-r--r--arch/arm/mach-ns9xxx/gpio-ns9360.c4
-rw-r--r--arch/arm/mach-ns9xxx/gpio.c6
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/board.h42
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/debug-macro.S22
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/dma.h14
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/entry-macro.S28
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/gpio.h47
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/hardware.h79
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/io.h20
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/irqs.h86
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/memory.h27
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/module.h60
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/processor-ns9360.h32
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/processor.h42
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/regs-bbu.h45
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/regs-board-a9m9750dev.h24
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/regs-mem.h135
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/regs-sys-common.h31
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/regs-sys-ns9360.h148
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/system.h35
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/timex.h20
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/uncompress.h164
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/vmalloc.h16
-rw-r--r--arch/arm/mach-ns9xxx/irq.c7
-rw-r--r--arch/arm/mach-ns9xxx/mach-cc9p9360dev.c2
-rw-r--r--arch/arm/mach-ns9xxx/mach-cc9p9360js.c2
-rw-r--r--arch/arm/mach-ns9xxx/plat-serial8250.c4
-rw-r--r--arch/arm/mach-ns9xxx/processor-ns9360.c4
-rw-r--r--arch/arm/mach-ns9xxx/time-ns9360.c8
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c16
-rw-r--r--arch/arm/mach-omap1/board-fsample.c20
-rw-r--r--arch/arm/mach-omap1/board-generic.c12
-rw-r--r--arch/arm/mach-omap1/board-h2-mmc.c4
-rw-r--r--arch/arm/mach-omap1/board-h2.c22
-rw-r--r--arch/arm/mach-omap1/board-h3-mmc.c4
-rw-r--r--arch/arm/mach-omap1/board-h3.c26
-rw-r--r--arch/arm/mach-omap1/board-innovator.c20
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c22
-rw-r--r--arch/arm/mach-omap1/board-osk.c16
-rw-r--r--arch/arm/mach-omap1/board-palmte.c24
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c26
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c24
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c18
-rw-r--r--arch/arm/mach-omap1/board-sx1-mmc.c6
-rw-r--r--arch/arm/mach-omap1/board-sx1.c22
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c12
-rw-r--r--arch/arm/mach-omap1/clock.c8
-rw-r--r--arch/arm/mach-omap1/devices.c11
-rw-r--r--arch/arm/mach-omap1/fpga.c6
-rw-r--r--arch/arm/mach-omap1/io.c4
-rw-r--r--arch/arm/mach-omap1/irq.c6
-rw-r--r--arch/arm/mach-omap1/leds-h2p2-debug.c6
-rw-r--r--arch/arm/mach-omap1/leds-innovator.c2
-rw-r--r--arch/arm/mach-omap1/leds-osk.c4
-rw-r--r--arch/arm/mach-omap1/leds.c4
-rw-r--r--arch/arm/mach-omap1/mailbox.c4
-rw-r--r--arch/arm/mach-omap1/mcbsp.c10
-rw-r--r--arch/arm/mach-omap1/mux.c2
-rw-r--r--arch/arm/mach-omap1/pm.c21
-rw-r--r--arch/arm/mach-omap1/serial.c10
-rw-r--r--arch/arm/mach-omap1/sleep.S4
-rw-r--r--arch/arm/mach-omap1/sram.S4
-rw-r--r--arch/arm/mach-omap1/time.c2
-rw-r--r--arch/arm/mach-omap1/timer32k.c4
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c12
-rw-r--r--arch/arm/mach-omap2/board-apollon.c18
-rw-r--r--arch/arm/mach-omap2/board-generic.c12
-rw-r--r--arch/arm/mach-omap2/board-h4.c26
-rw-r--r--arch/arm/mach-omap2/clock.c6
-rw-r--r--arch/arm/mach-omap2/clock.h2
-rw-r--r--arch/arm/mach-omap2/clock24xx.c4
-rw-r--r--arch/arm/mach-omap2/clock34xx.c4
-rw-r--r--arch/arm/mach-omap2/clock34xx.h2
-rw-r--r--arch/arm/mach-omap2/control.c4
-rw-r--r--arch/arm/mach-omap2/devices.c12
-rw-r--r--arch/arm/mach-omap2/gpmc.c2
-rw-r--r--arch/arm/mach-omap2/id.c4
-rw-r--r--arch/arm/mach-omap2/io.c4
-rw-r--r--arch/arm/mach-omap2/irq.c2
-rw-r--r--arch/arm/mach-omap2/mailbox.c4
-rw-r--r--arch/arm/mach-omap2/mcbsp.c8
-rw-r--r--arch/arm/mach-omap2/memory.c6
-rw-r--r--arch/arm/mach-omap2/mux.c4
-rw-r--r--arch/arm/mach-omap2/pm.c9
-rw-r--r--arch/arm/mach-omap2/prcm.c4
-rw-r--r--arch/arm/mach-omap2/sdrc.h2
-rw-r--r--arch/arm/mach-omap2/serial.c4
-rw-r--r--arch/arm/mach-omap2/sleep.S4
-rw-r--r--arch/arm/mach-omap2/sram242x.S4
-rw-r--r--arch/arm/mach-omap2/sram243x.S4
-rw-r--r--arch/arm/mach-omap2/timer-gp.c2
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c6
-rw-r--r--arch/arm/mach-orion5x/addr-map.c2
-rw-r--r--arch/arm/mach-orion5x/common.c4
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c2
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c2
-rw-r--r--arch/arm/mach-orion5x/gpio.c2
-rw-r--r--arch/arm/mach-orion5x/include/mach/debug-macro.S22
-rw-r--r--arch/arm/mach-orion5x/include/mach/dma.h1
-rw-r--r--arch/arm/mach-orion5x/include/mach/entry-macro.S31
-rw-r--r--arch/arm/mach-orion5x/include/mach/gpio.h28
-rw-r--r--arch/arm/mach-orion5x/include/mach/hardware.h21
-rw-r--r--arch/arm/mach-orion5x/include/mach/io.h63
-rw-r--r--arch/arm/mach-orion5x/include/mach/irqs.h62
-rw-r--r--arch/arm/mach-orion5x/include/mach/memory.h16
-rw-r--r--arch/arm/mach-orion5x/include/mach/orion5x.h162
-rw-r--r--arch/arm/mach-orion5x/include/mach/system.h32
-rw-r--r--arch/arm/mach-orion5x/include/mach/timex.h13
-rw-r--r--arch/arm/mach-orion5x/include/mach/uncompress.h49
-rw-r--r--arch/arm/mach-orion5x/include/mach/vmalloc.h5
-rw-r--r--arch/arm/mach-orion5x/irq.c2
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c2
-rw-r--r--arch/arm/mach-orion5x/mpp.c2
-rw-r--r--arch/arm/mach-orion5x/mss2-setup.c2
-rw-r--r--arch/arm/mach-orion5x/mv2120-setup.c2
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c2
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c2
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c2
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c2
-rw-r--r--arch/arm/mach-orion5x/ts409-setup.c2
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c2
-rw-r--r--arch/arm/mach-orion5x/wnr854t-setup.c2
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c2
-rw-r--r--arch/arm/mach-pnx4008/clock.c4
-rw-r--r--arch/arm/mach-pnx4008/core.c8
-rw-r--r--arch/arm/mach-pnx4008/dma.c4
-rw-r--r--arch/arm/mach-pnx4008/gpio.c4
-rw-r--r--arch/arm/mach-pnx4008/i2c.c4
-rw-r--r--arch/arm/mach-pnx4008/include/mach/clock.h62
-rw-r--r--arch/arm/mach-pnx4008/include/mach/debug-macro.S23
-rw-r--r--arch/arm/mach-pnx4008/include/mach/dma.h162
-rw-r--r--arch/arm/mach-pnx4008/include/mach/entry-macro.S127
-rw-r--r--arch/arm/mach-pnx4008/include/mach/gpio.h241
-rw-r--r--arch/arm/mach-pnx4008/include/mach/hardware.h32
-rw-r--r--arch/arm/mach-pnx4008/include/mach/i2c.h67
-rw-r--r--arch/arm/mach-pnx4008/include/mach/io.h21
-rw-r--r--arch/arm/mach-pnx4008/include/mach/irq.h42
-rw-r--r--arch/arm/mach-pnx4008/include/mach/irqs.h215
-rw-r--r--arch/arm/mach-pnx4008/include/mach/memory.h24
-rw-r--r--arch/arm/mach-pnx4008/include/mach/param.h21
-rw-r--r--arch/arm/mach-pnx4008/include/mach/platform.h69
-rw-r--r--arch/arm/mach-pnx4008/include/mach/pm.h33
-rw-r--r--arch/arm/mach-pnx4008/include/mach/system.h38
-rw-r--r--arch/arm/mach-pnx4008/include/mach/timex.h73
-rw-r--r--arch/arm/mach-pnx4008/include/mach/uncompress.h46
-rw-r--r--arch/arm/mach-pnx4008/include/mach/vmalloc.h20
-rw-r--r--arch/arm/mach-pnx4008/irq.c5
-rw-r--r--arch/arm/mach-pnx4008/pm.c5
-rw-r--r--arch/arm/mach-pnx4008/serial.c8
-rw-r--r--arch/arm/mach-pnx4008/sleep.S2
-rw-r--r--arch/arm/mach-pnx4008/time.c2
-rw-r--r--arch/arm/mach-pxa/akita-ioexp.c2
-rw-r--r--arch/arm/mach-pxa/clock.c6
-rw-r--r--arch/arm/mach-pxa/cm-x270-pci.c2
-rw-r--r--arch/arm/mach-pxa/cm-x270.c16
-rw-r--r--arch/arm/mach-pxa/colibri.c8
-rw-r--r--arch/arm/mach-pxa/corgi.c18
-rw-r--r--arch/arm/mach-pxa/corgi_lcd.c12
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c12
-rw-r--r--arch/arm/mach-pxa/corgi_ssp.c10
-rw-r--r--arch/arm/mach-pxa/cpu-pxa.c6
-rw-r--r--arch/arm/mach-pxa/devices.c26
-rw-r--r--arch/arm/mach-pxa/dma.c4
-rw-r--r--arch/arm/mach-pxa/e400_lcd.c4
-rw-r--r--arch/arm/mach-pxa/em-x270.c16
-rw-r--r--arch/arm/mach-pxa/eseries.c2
-rw-r--r--arch/arm/mach-pxa/eseries_udc.c8
-rw-r--r--arch/arm/mach-pxa/ezx.c12
-rw-r--r--arch/arm/mach-pxa/generic.c6
-rw-r--r--arch/arm/mach-pxa/gpio.c6
-rw-r--r--arch/arm/mach-pxa/gumstix.c14
-rw-r--r--arch/arm/mach-pxa/idp.c14
-rw-r--r--arch/arm/mach-pxa/include/mach/akita.h32
-rw-r--r--arch/arm/mach-pxa/include/mach/audio.h17
-rw-r--r--arch/arm/mach-pxa/include/mach/bitfield.h113
-rw-r--r--arch/arm/mach-pxa/include/mach/camera.h48
-rw-r--r--arch/arm/mach-pxa/include/mach/colibri.h19
-rw-r--r--arch/arm/mach-pxa/include/mach/corgi.h109
-rw-r--r--arch/arm/mach-pxa/include/mach/debug-macro.S25
-rw-r--r--arch/arm/mach-pxa/include/mach/dma.h50
-rw-r--r--arch/arm/mach-pxa/include/mach/entry-macro.S57
-rw-r--r--arch/arm/mach-pxa/include/mach/eseries-gpio.h50
-rw-r--r--arch/arm/mach-pxa/include/mach/eseries-irq.h27
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio.h65
-rw-r--r--arch/arm/mach-pxa/include/mach/gumstix.h96
-rw-r--r--arch/arm/mach-pxa/include/mach/hardware.h235
-rw-r--r--arch/arm/mach-pxa/include/mach/i2c.h77
-rw-r--r--arch/arm/mach-pxa/include/mach/idp.h199
-rw-r--r--arch/arm/mach-pxa/include/mach/io.h20
-rw-r--r--arch/arm/mach-pxa/include/mach/irda.h23
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h264
-rw-r--r--arch/arm/mach-pxa/include/mach/littleton.h6
-rw-r--r--arch/arm/mach-pxa/include/mach/lpd270.h38
-rw-r--r--arch/arm/mach-pxa/include/mach/lubbock.h40
-rw-r--r--arch/arm/mach-pxa/include/mach/magician.h117
-rw-r--r--arch/arm/mach-pxa/include/mach/mainstone.h120
-rw-r--r--arch/arm/mach-pxa/include/mach/memory.h52
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa25x.h161
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa27x.h433
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h133
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa300.h575
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa320.h447
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h252
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa930.h491
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp.h319
-rw-r--r--arch/arm/mach-pxa/include/mach/mmc.h23
-rw-r--r--arch/arm/mach-pxa/include/mach/mtd-xip.h37
-rw-r--r--arch/arm/mach-pxa/include/mach/ohci.h20
-rw-r--r--arch/arm/mach-pxa/include/mach/palmtx.h106
-rw-r--r--arch/arm/mach-pxa/include/mach/pcm027.h75
-rw-r--r--arch/arm/mach-pxa/include/mach/pcm990_baseboard.h275
-rw-r--r--arch/arm/mach-pxa/include/mach/pm.h27
-rw-r--r--arch/arm/mach-pxa/include/mach/poodle.h75
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa-regs.h1070
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa25x-udc.h163
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa27x-udc.h257
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa27x_keypad.h58
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h368
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa2xx-regs.h246
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa2xx_spi.h46
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa3xx-regs.h183
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa3xx_nand.h20
-rw-r--r--arch/arm/mach-pxa/include/mach/pxafb.h151
-rw-r--r--arch/arm/mach-pxa/include/mach/regs-lcd.h180
-rw-r--r--arch/arm/mach-pxa/include/mach/regs-ssp.h127
-rw-r--r--arch/arm/mach-pxa/include/mach/reset.h18
-rw-r--r--arch/arm/mach-pxa/include/mach/sharpsl.h34
-rw-r--r--arch/arm/mach-pxa/include/mach/spitz.h158
-rw-r--r--arch/arm/mach-pxa/include/mach/ssp.h83
-rw-r--r--arch/arm/mach-pxa/include/mach/system.h24
-rw-r--r--arch/arm/mach-pxa/include/mach/timex.h26
-rw-r--r--arch/arm/mach-pxa/include/mach/tosa.h198
-rw-r--r--arch/arm/mach-pxa/include/mach/tosa_bt.h22
-rw-r--r--arch/arm/mach-pxa/include/mach/trizeps4.h106
-rw-r--r--arch/arm/mach-pxa/include/mach/udc.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/uncompress.h45
-rw-r--r--arch/arm/mach-pxa/include/mach/vmalloc.h11
-rw-r--r--arch/arm/mach-pxa/include/mach/zylonite.h47
-rw-r--r--arch/arm/mach-pxa/irq.c4
-rw-r--r--arch/arm/mach-pxa/leds-idp.c6
-rw-r--r--arch/arm/mach-pxa/leds-lubbock.c6
-rw-r--r--arch/arm/mach-pxa/leds-mainstone.c6
-rw-r--r--arch/arm/mach-pxa/leds-trizeps4.c8
-rw-r--r--arch/arm/mach-pxa/littleton.c18
-rw-r--r--arch/arm/mach-pxa/lpd270.c20
-rw-r--r--arch/arm/mach-pxa/lubbock.c24
-rw-r--r--arch/arm/mach-pxa/magician.c20
-rw-r--r--arch/arm/mach-pxa/mainstone.c24
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c8
-rw-r--r--arch/arm/mach-pxa/mfp-pxa3xx.c8
-rw-r--r--arch/arm/mach-pxa/palmtx.c18
-rw-r--r--arch/arm/mach-pxa/pcm027.c12
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c19
-rw-r--r--arch/arm/mach-pxa/pm.c8
-rw-r--r--arch/arm/mach-pxa/poodle.c22
-rw-r--r--arch/arm/mach-pxa/pwm.c2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c16
-rw-r--r--arch/arm/mach-pxa/pxa27x.c20
-rw-r--r--arch/arm/mach-pxa/pxa2xx.c12
-rw-r--r--arch/arm/mach-pxa/pxa300.c6
-rw-r--r--arch/arm/mach-pxa/pxa320.c8
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c14
-rw-r--r--arch/arm/mach-pxa/pxa930.c4
-rw-r--r--arch/arm/mach-pxa/reset.c4
-rw-r--r--arch/arm/mach-pxa/saar.c6
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c10
-rw-r--r--arch/arm/mach-pxa/sleep.S6
-rw-r--r--arch/arm/mach-pxa/spitz.c28
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c12
-rw-r--r--arch/arm/mach-pxa/ssp.c8
-rw-r--r--arch/arm/mach-pxa/standby.S6
-rw-r--r--arch/arm/mach-pxa/tavorevb.c6
-rw-r--r--arch/arm/mach-pxa/time.c2
-rw-r--r--arch/arm/mach-pxa/tosa-bt.c2
-rw-r--r--arch/arm/mach-pxa/tosa.c18
-rw-r--r--arch/arm/mach-pxa/trizeps4.c20
-rw-r--r--arch/arm/mach-pxa/zylonite.c16
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c6
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c6
-rw-r--r--arch/arm/mach-realview/core.c2
-rw-r--r--arch/arm/mach-realview/include/mach/board-eb.h191
-rw-r--r--arch/arm/mach-realview/include/mach/board-pb1176.h152
-rw-r--r--arch/arm/mach-realview/include/mach/board-pb11mp.h186
-rw-r--r--arch/arm/mach-realview/include/mach/debug-macro.S22
-rw-r--r--arch/arm/mach-realview/include/mach/dma.h20
-rw-r--r--arch/arm/mach-realview/include/mach/entry-macro.S81
-rw-r--r--arch/arm/mach-realview/include/mach/hardware.h31
-rw-r--r--arch/arm/mach-realview/include/mach/io.h33
-rw-r--r--arch/arm/mach-realview/include/mach/irqs.h38
-rw-r--r--arch/arm/mach-realview/include/mach/memory.h38
-rw-r--r--arch/arm/mach-realview/include/mach/platform.h293
-rw-r--r--arch/arm/mach-realview/include/mach/scu.h13
-rw-r--r--arch/arm/mach-realview/include/mach/smp.h30
-rw-r--r--arch/arm/mach-realview/include/mach/system.h51
-rw-r--r--arch/arm/mach-realview/include/mach/timex.h23
-rw-r--r--arch/arm/mach-realview/include/mach/uncompress.h72
-rw-r--r--arch/arm/mach-realview/include/mach/vmalloc.h21
-rw-r--r--arch/arm/mach-realview/localtimer.c2
-rw-r--r--arch/arm/mach-realview/platsmp.c8
-rw-r--r--arch/arm/mach-realview/realview_eb.c6
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c6
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c6
-rw-r--r--arch/arm/mach-rpc/dma.c2
-rw-r--r--arch/arm/mach-rpc/include/mach/acornfb.h140
-rw-r--r--arch/arm/mach-rpc/include/mach/debug-macro.S25
-rw-r--r--arch/arm/mach-rpc/include/mach/dma.h33
-rw-r--r--arch/arm/mach-rpc/include/mach/entry-macro.S16
-rw-r--r--arch/arm/mach-rpc/include/mach/hardware.h83
-rw-r--r--arch/arm/mach-rpc/include/mach/io.h258
-rw-r--r--arch/arm/mach-rpc/include/mach/irqs.h46
-rw-r--r--arch/arm/mach-rpc/include/mach/memory.h39
-rw-r--r--arch/arm/mach-rpc/include/mach/system.h27
-rw-r--r--arch/arm/mach-rpc/include/mach/timex.h17
-rw-r--r--arch/arm/mach-rpc/include/mach/uncompress.h198
-rw-r--r--arch/arm/mach-rpc/include/mach/vmalloc.h10
-rw-r--r--arch/arm/mach-rpc/riscpc.c2
-rw-r--r--arch/arm/mach-s3c2400/gpio.c4
-rw-r--r--arch/arm/mach-s3c2400/include/mach/map.h66
-rw-r--r--arch/arm/mach-s3c2400/include/mach/memory.h23
-rw-r--r--arch/arm/mach-s3c2410/bast-ide.c6
-rw-r--r--arch/arm/mach-s3c2410/bast-irq.c8
-rw-r--r--arch/arm/mach-s3c2410/clock.c6
-rw-r--r--arch/arm/mach-s3c2410/dma.c10
-rw-r--r--arch/arm/mach-s3c2410/gpio.c4
-rw-r--r--arch/arm/mach-s3c2410/h1940-bluetooth.c6
-rw-r--r--arch/arm/mach-s3c2410/include/mach/anubis-cpld.h25
-rw-r--r--arch/arm/mach-s3c2410/include/mach/anubis-irq.h21
-rw-r--r--arch/arm/mach-s3c2410/include/mach/anubis-map.h38
-rw-r--r--arch/arm/mach-s3c2410/include/mach/audio.h45
-rw-r--r--arch/arm/mach-s3c2410/include/mach/bast-cpld.h53
-rw-r--r--arch/arm/mach-s3c2410/include/mach/bast-irq.h29
-rw-r--r--arch/arm/mach-s3c2410/include/mach/bast-map.h146
-rw-r--r--arch/arm/mach-s3c2410/include/mach/bast-pmu.h40
-rw-r--r--arch/arm/mach-s3c2410/include/mach/debug-macro.S102
-rw-r--r--arch/arm/mach-s3c2410/include/mach/dma.h453
-rw-r--r--arch/arm/mach-s3c2410/include/mach/entry-macro.S78
-rw-r--r--arch/arm/mach-s3c2410/include/mach/fb.h74
-rw-r--r--arch/arm/mach-s3c2410/include/mach/gpio.h18
-rw-r--r--arch/arm/mach-s3c2410/include/mach/h1940-latch.h64
-rw-r--r--arch/arm/mach-s3c2410/include/mach/h1940.h21
-rw-r--r--arch/arm/mach-s3c2410/include/mach/hardware.h137
-rw-r--r--arch/arm/mach-s3c2410/include/mach/idle.h24
-rw-r--r--arch/arm/mach-s3c2410/include/mach/io.h218
-rw-r--r--arch/arm/mach-s3c2410/include/mach/irqs.h166
-rw-r--r--arch/arm/mach-s3c2410/include/mach/leds-gpio.h28
-rw-r--r--arch/arm/mach-s3c2410/include/mach/map.h178
-rw-r--r--arch/arm/mach-s3c2410/include/mach/memory.h19
-rw-r--r--arch/arm/mach-s3c2410/include/mach/osiris-cpld.h30
-rw-r--r--arch/arm/mach-s3c2410/include/mach/osiris-map.h42
-rw-r--r--arch/arm/mach-s3c2410/include/mach/otom-map.h30
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-clock.h197
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-dsc.h184
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-gpio.h1163
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-gpioj.h106
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-irq.h43
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-lcd.h162
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-mem.h220
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-power.h40
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h29
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-s3c2412.h23
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h195
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-sdi.h127
-rw-r--r--arch/arm/mach-s3c2410/include/mach/reset.h22
-rw-r--r--arch/arm/mach-s3c2410/include/mach/spi-gpio.h27
-rw-r--r--arch/arm/mach-s3c2410/include/mach/spi.h25
-rw-r--r--arch/arm/mach-s3c2410/include/mach/system-reset.h64
-rw-r--r--arch/arm/mach-s3c2410/include/mach/system.h58
-rw-r--r--arch/arm/mach-s3c2410/include/mach/timex.h26
-rw-r--r--arch/arm/mach-s3c2410/include/mach/uncompress.h52
-rw-r--r--arch/arm/mach-s3c2410/include/mach/usb-control.h41
-rw-r--r--arch/arm/mach-s3c2410/include/mach/vmalloc.h20
-rw-r--r--arch/arm/mach-s3c2410/include/mach/vr1000-cpld.h18
-rw-r--r--arch/arm/mach-s3c2410/include/mach/vr1000-irq.h26
-rw-r--r--arch/arm/mach-s3c2410/include/mach/vr1000-map.h110
-rw-r--r--arch/arm/mach-s3c2410/mach-amlm5900.c8
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c16
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c14
-rw-r--r--arch/arm/mach-s3c2410/mach-n30.c10
-rw-r--r--arch/arm/mach-s3c2410/mach-otom.c6
-rw-r--r--arch/arm/mach-s3c2410/mach-qt2410.c12
-rw-r--r--arch/arm/mach-s3c2410/mach-smdk2410.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-tct_hammer.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c14
-rw-r--r--arch/arm/mach-s3c2410/nor-simtec.c6
-rw-r--r--arch/arm/mach-s3c2410/pm-h1940.S6
-rw-r--r--arch/arm/mach-s3c2410/pm.c6
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.c4
-rw-r--r--arch/arm/mach-s3c2410/sleep.S10
-rw-r--r--arch/arm/mach-s3c2410/usb-simtec.c10
-rw-r--r--arch/arm/mach-s3c2412/clock.c6
-rw-r--r--arch/arm/mach-s3c2412/dma.c10
-rw-r--r--arch/arm/mach-s3c2412/gpio.c4
-rw-r--r--arch/arm/mach-s3c2412/irq.c8
-rw-r--r--arch/arm/mach-s3c2412/mach-jive.c12
-rw-r--r--arch/arm/mach-s3c2412/mach-smdk2413.c10
-rw-r--r--arch/arm/mach-s3c2412/mach-vstms.c10
-rw-r--r--arch/arm/mach-s3c2412/pm.c10
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c18
-rw-r--r--arch/arm/mach-s3c2412/sleep.S6
-rw-r--r--arch/arm/mach-s3c2440/clock.c4
-rw-r--r--arch/arm/mach-s3c2440/dma.c10
-rw-r--r--arch/arm/mach-s3c2440/dsc.c6
-rw-r--r--arch/arm/mach-s3c2440/irq.c6
-rw-r--r--arch/arm/mach-s3c2440/mach-anubis.c14
-rw-r--r--arch/arm/mach-s3c2440/mach-at2440evb.c8
-rw-r--r--arch/arm/mach-s3c2440/mach-nexcoder.c4
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c12
-rw-r--r--arch/arm/mach-s3c2440/mach-rx3715.c10
-rw-r--r--arch/arm/mach-s3c2440/mach-smdk2440.c10
-rw-r--r--arch/arm/mach-s3c2440/s3c2440.c2
-rw-r--r--arch/arm/mach-s3c2442/clock.c4
-rw-r--r--arch/arm/mach-s3c2443/clock.c4
-rw-r--r--arch/arm/mach-s3c2443/dma.c10
-rw-r--r--arch/arm/mach-s3c2443/irq.c6
-rw-r--r--arch/arm/mach-s3c2443/mach-smdk2443.c10
-rw-r--r--arch/arm/mach-s3c2443/s3c2443.c6
-rw-r--r--arch/arm/mach-sa1100/assabet.c6
-rw-r--r--arch/arm/mach-sa1100/badge4.c6
-rw-r--r--arch/arm/mach-sa1100/cerf.c6
-rw-r--r--arch/arm/mach-sa1100/clock.c2
-rw-r--r--arch/arm/mach-sa1100/collie.c6
-rw-r--r--arch/arm/mach-sa1100/collie_pm.c5
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1100.c2
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1110.c2
-rw-r--r--arch/arm/mach-sa1100/dma.c4
-rw-r--r--arch/arm/mach-sa1100/generic.c2
-rw-r--r--arch/arm/mach-sa1100/gpio.c2
-rw-r--r--arch/arm/mach-sa1100/h3600.c10
-rw-r--r--arch/arm/mach-sa1100/hackkit.c2
-rw-r--r--arch/arm/mach-sa1100/include/mach/SA-1100.h2072
-rw-r--r--arch/arm/mach-sa1100/include/mach/SA-1101.h925
-rw-r--r--arch/arm/mach-sa1100/include/mach/SA-1111.h5
-rw-r--r--arch/arm/mach-sa1100/include/mach/assabet.h105
-rw-r--r--arch/arm/mach-sa1100/include/mach/badge4.h75
-rw-r--r--arch/arm/mach-sa1100/include/mach/bitfield.h113
-rw-r--r--arch/arm/mach-sa1100/include/mach/cerf.h28
-rw-r--r--arch/arm/mach-sa1100/include/mach/collie.h88
-rw-r--r--arch/arm/mach-sa1100/include/mach/debug-macro.S58
-rw-r--r--arch/arm/mach-sa1100/include/mach/dma.h117
-rw-r--r--arch/arm/mach-sa1100/include/mach/entry-macro.S47
-rw-r--r--arch/arm/mach-sa1100/include/mach/gpio.h68
-rw-r--r--arch/arm/mach-sa1100/include/mach/h3600.h169
-rw-r--r--arch/arm/mach-sa1100/include/mach/h3600_gpio.h540
-rw-r--r--arch/arm/mach-sa1100/include/mach/hardware.h57
-rw-r--r--arch/arm/mach-sa1100/include/mach/ide.h75
-rw-r--r--arch/arm/mach-sa1100/include/mach/io.h26
-rw-r--r--arch/arm/mach-sa1100/include/mach/irqs.h197
-rw-r--r--arch/arm/mach-sa1100/include/mach/jornada720.h27
-rw-r--r--arch/arm/mach-sa1100/include/mach/lart.h13
-rw-r--r--arch/arm/mach-sa1100/include/mach/mcp.h21
-rw-r--r--arch/arm/mach-sa1100/include/mach/memory.h68
-rw-r--r--arch/arm/mach-sa1100/include/mach/mtd-xip.h26
-rw-r--r--arch/arm/mach-sa1100/include/mach/neponset.h74
-rw-r--r--arch/arm/mach-sa1100/include/mach/reset.h18
-rw-r--r--arch/arm/mach-sa1100/include/mach/shannon.h43
-rw-r--r--arch/arm/mach-sa1100/include/mach/simpad.h112
-rw-r--r--arch/arm/mach-sa1100/include/mach/system.h22
-rw-r--r--arch/arm/mach-sa1100/include/mach/timex.h12
-rw-r--r--arch/arm/mach-sa1100/include/mach/uncompress.h50
-rw-r--r--arch/arm/mach-sa1100/include/mach/vmalloc.h4
-rw-r--r--arch/arm/mach-sa1100/irq.c2
-rw-r--r--arch/arm/mach-sa1100/jornada720.c2
-rw-r--r--arch/arm/mach-sa1100/jornada720_ssp.c4
-rw-r--r--arch/arm/mach-sa1100/lart.c4
-rw-r--r--arch/arm/mach-sa1100/leds-assabet.c4
-rw-r--r--arch/arm/mach-sa1100/leds-badge4.c2
-rw-r--r--arch/arm/mach-sa1100/leds-cerf.c2
-rw-r--r--arch/arm/mach-sa1100/leds-hackkit.c2
-rw-r--r--arch/arm/mach-sa1100/leds-lart.c2
-rw-r--r--arch/arm/mach-sa1100/leds-simpad.c4
-rw-r--r--arch/arm/mach-sa1100/neponset.c6
-rw-r--r--arch/arm/mach-sa1100/pleb.c4
-rw-r--r--arch/arm/mach-sa1100/pm.c2
-rw-r--r--arch/arm/mach-sa1100/shannon.c6
-rw-r--r--arch/arm/mach-sa1100/simpad.c6
-rw-r--r--arch/arm/mach-sa1100/sleep.S2
-rw-r--r--arch/arm/mach-sa1100/ssp.c2
-rw-r--r--arch/arm/mach-sa1100/time.c2
-rw-r--r--arch/arm/mach-shark/include/mach/debug-macro.S31
-rw-r--r--arch/arm/mach-shark/include/mach/dma.h18
-rw-r--r--arch/arm/mach-shark/include/mach/entry-macro.S41
-rw-r--r--arch/arm/mach-shark/include/mach/hardware.h51
-rw-r--r--arch/arm/mach-shark/include/mach/io.h56
-rw-r--r--arch/arm/mach-shark/include/mach/irqs.h13
-rw-r--r--arch/arm/mach-shark/include/mach/memory.h48
-rw-r--r--arch/arm/mach-shark/include/mach/system.h28
-rw-r--r--arch/arm/mach-shark/include/mach/timex.h7
-rw-r--r--arch/arm/mach-shark/include/mach/uncompress.h51
-rw-r--r--arch/arm/mach-shark/include/mach/vmalloc.h4
-rw-r--r--arch/arm/mach-shark/irq.c2
-rw-r--r--arch/arm/mach-shark/leds.c2
-rw-r--r--arch/arm/mach-versatile/core.c2
-rw-r--r--arch/arm/mach-versatile/include/mach/debug-macro.S23
-rw-r--r--arch/arm/mach-versatile/include/mach/dma.h20
-rw-r--r--arch/arm/mach-versatile/include/mach/entry-macro.S44
-rw-r--r--arch/arm/mach-versatile/include/mach/hardware.h52
-rw-r--r--arch/arm/mach-versatile/include/mach/io.h32
-rw-r--r--arch/arm/mach-versatile/include/mach/irqs.h211
-rw-r--r--arch/arm/mach-versatile/include/mach/memory.h38
-rw-r--r--arch/arm/mach-versatile/include/mach/platform.h510
-rw-r--r--arch/arm/mach-versatile/include/mach/system.h49
-rw-r--r--arch/arm/mach-versatile/include/mach/timex.h23
-rw-r--r--arch/arm/mach-versatile/include/mach/uncompress.h46
-rw-r--r--arch/arm/mach-versatile/include/mach/vmalloc.h21
-rw-r--r--arch/arm/mach-versatile/pci.c2
-rw-r--r--arch/arm/mach-versatile/versatile_ab.c2
-rw-r--r--arch/arm/mach-versatile/versatile_pb.c2
-rw-r--r--arch/arm/mm/Kconfig10
-rw-r--r--arch/arm/mm/cache-v3.S2
-rw-r--r--arch/arm/mm/cache-v4.S2
-rw-r--r--arch/arm/mm/cache-v4wt.S2
-rw-r--r--arch/arm/mm/cache-xsc3l2.c182
-rw-r--r--arch/arm/mm/init.c32
-rw-r--r--arch/arm/mm/ioremap.c2
-rw-r--r--arch/arm/mm/proc-arm720.S2
-rw-r--r--arch/arm/mm/proc-sa110.S2
-rw-r--r--arch/arm/mm/proc-sa1100.S2
-rw-r--r--arch/arm/mm/proc-xsc3.S24
-rw-r--r--arch/arm/nwfpe/fpa11.h2
-rw-r--r--arch/arm/oprofile/op_model_mpcore.c2
-rw-r--r--arch/arm/plat-iop/adma.c2
-rw-r--r--arch/arm/plat-iop/i2c.c3
-rw-r--r--arch/arm/plat-iop/io.c2
-rw-r--r--arch/arm/plat-iop/pci.c3
-rw-r--r--arch/arm/plat-iop/time.c4
-rw-r--r--arch/arm/plat-mxc/clock.c2
-rw-r--r--arch/arm/plat-mxc/gpio.c2
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx27ads.h354
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31ads.h117
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31lite.h38
-rw-r--r--arch/arm/plat-mxc/include/mach/board-pcm037.h27
-rw-r--r--arch/arm/plat-mxc/include/mach/board-pcm038.h41
-rw-r--r--arch/arm/plat-mxc/include/mach/clock.h67
-rw-r--r--arch/arm/plat-mxc/include/mach/common.h20
-rw-r--r--arch/arm/plat-mxc/include/mach/debug-macro.S49
-rw-r--r--arch/arm/plat-mxc/include/mach/dma.h14
-rw-r--r--arch/arm/plat-mxc/include/mach/entry-macro.S39
-rw-r--r--arch/arm/plat-mxc/include/mach/gpio.h42
-rw-r--r--arch/arm/plat-mxc/include/mach/hardware.h37
-rw-r--r--arch/arm/plat-mxc/include/mach/iim.h77
-rw-r--r--arch/arm/plat-mxc/include/mach/imx-uart.h32
-rw-r--r--arch/arm/plat-mxc/include/mach/io.h22
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h372
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx3.h501
-rw-r--r--arch/arm/plat-mxc/include/mach/irqs.h16
-rw-r--r--arch/arm/plat-mxc/include/mach/memory.h29
-rw-r--r--arch/arm/plat-mxc/include/mach/mx27.h302
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h384
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc.h36
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc_timer.h158
-rw-r--r--arch/arm/plat-mxc/include/mach/system.h34
-rw-r--r--arch/arm/plat-mxc/include/mach/timex.h25
-rw-r--r--arch/arm/plat-mxc/include/mach/uncompress.h78
-rw-r--r--arch/arm/plat-mxc/include/mach/vmalloc.h26
-rw-r--r--arch/arm/plat-mxc/iomux-mx1-mx2.c4
-rw-r--r--arch/arm/plat-mxc/irq.c2
-rw-r--r--arch/arm/plat-mxc/time.c6
-rw-r--r--arch/arm/plat-omap/clock.c2
-rw-r--r--arch/arm/plat-omap/common.c14
-rw-r--r--arch/arm/plat-omap/cpu-omap.c2
-rw-r--r--arch/arm/plat-omap/debug-devices.c6
-rw-r--r--arch/arm/plat-omap/debug-leds.c6
-rw-r--r--arch/arm/plat-omap/devices.c14
-rw-r--r--arch/arm/plat-omap/dma.c4
-rw-r--r--arch/arm/plat-omap/dmtimer.c6
-rw-r--r--arch/arm/plat-omap/fb.c9
-rw-r--r--arch/arm/plat-omap/gpio.c6
-rw-r--r--arch/arm/plat-omap/i2c.c3
-rw-r--r--arch/arm/plat-omap/include/mach/aic23.h116
-rw-r--r--arch/arm/plat-omap/include/mach/blizzard.h12
-rw-r--r--arch/arm/plat-omap/include/mach/board-2430sdp.h39
-rw-r--r--arch/arm/plat-omap/include/mach/board-ams-delta.h76
-rw-r--r--arch/arm/plat-omap/include/mach/board-apollon.h38
-rw-r--r--arch/arm/plat-omap/include/mach/board-fsample.h51
-rw-r--r--arch/arm/plat-omap/include/mach/board-h2.h41
-rw-r--r--arch/arm/plat-omap/include/mach/board-h3.h36
-rw-r--r--arch/arm/plat-omap/include/mach/board-h4.h35
-rw-r--r--arch/arm/plat-omap/include/mach/board-innovator.h52
-rw-r--r--arch/arm/plat-omap/include/mach/board-nokia.h54
-rw-r--r--arch/arm/plat-omap/include/mach/board-osk.h47
-rw-r--r--arch/arm/plat-omap/include/mach/board-palmte.h32
-rw-r--r--arch/arm/plat-omap/include/mach/board-palmtt.h23
-rw-r--r--arch/arm/plat-omap/include/mach/board-palmz71.h26
-rw-r--r--arch/arm/plat-omap/include/mach/board-perseus2.h39
-rw-r--r--arch/arm/plat-omap/include/mach/board-sx1.h52
-rw-r--r--arch/arm/plat-omap/include/mach/board-voiceblue.h20
-rw-r--r--arch/arm/plat-omap/include/mach/board.h186
-rw-r--r--arch/arm/plat-omap/include/mach/clock.h162
-rw-r--r--arch/arm/plat-omap/include/mach/common.h69
-rw-r--r--arch/arm/plat-omap/include/mach/control.h189
-rw-r--r--arch/arm/plat-omap/include/mach/cpu.h402
-rw-r--r--arch/arm/plat-omap/include/mach/debug-macro.S58
-rw-r--r--arch/arm/plat-omap/include/mach/dma.h570
-rw-r--r--arch/arm/plat-omap/include/mach/dmtimer.h84
-rw-r--r--arch/arm/plat-omap/include/mach/dsp_common.h40
-rw-r--r--arch/arm/plat-omap/include/mach/eac.h100
-rw-r--r--arch/arm/plat-omap/include/mach/entry-macro.S89
-rw-r--r--arch/arm/plat-omap/include/mach/fpga.h197
-rw-r--r--arch/arm/plat-omap/include/mach/gpio-switch.h54
-rw-r--r--arch/arm/plat-omap/include/mach/gpio.h122
-rw-r--r--arch/arm/plat-omap/include/mach/gpioexpander.h35
-rw-r--r--arch/arm/plat-omap/include/mach/gpmc.h96
-rw-r--r--arch/arm/plat-omap/include/mach/hardware.h355
-rw-r--r--arch/arm/plat-omap/include/mach/hwa742.h12
-rw-r--r--arch/arm/plat-omap/include/mach/io.h197
-rw-r--r--arch/arm/plat-omap/include/mach/irda.h37
-rw-r--r--arch/arm/plat-omap/include/mach/irqs.h332
-rw-r--r--arch/arm/plat-omap/include/mach/keypad.h39
-rw-r--r--arch/arm/plat-omap/include/mach/lcd_mipid.h24
-rw-r--r--arch/arm/plat-omap/include/mach/led.h24
-rw-r--r--arch/arm/plat-omap/include/mach/mailbox.h73
-rw-r--r--arch/arm/plat-omap/include/mach/mcbsp.h380
-rw-r--r--arch/arm/plat-omap/include/mach/mcspi.h15
-rw-r--r--arch/arm/plat-omap/include/mach/memory.h103
-rw-r--r--arch/arm/plat-omap/include/mach/menelaus.h49
-rw-r--r--arch/arm/plat-omap/include/mach/mmc.h74
-rw-r--r--arch/arm/plat-omap/include/mach/mtd-xip.h61
-rw-r--r--arch/arm/plat-omap/include/mach/mux.h615
-rw-r--r--arch/arm/plat-omap/include/mach/nand.h24
-rw-r--r--arch/arm/plat-omap/include/mach/omap-alsa.h123
-rw-r--r--arch/arm/plat-omap/include/mach/omap1510.h48
-rw-r--r--arch/arm/plat-omap/include/mach/omap16xx.h197
-rw-r--r--arch/arm/plat-omap/include/mach/omap24xx.h107
-rw-r--r--arch/arm/plat-omap/include/mach/omap34xx.h72
-rw-r--r--arch/arm/plat-omap/include/mach/omap730.h102
-rw-r--r--arch/arm/plat-omap/include/mach/omapfb.h395
-rw-r--r--arch/arm/plat-omap/include/mach/onenand.h21
-rw-r--r--arch/arm/plat-omap/include/mach/param.h8
-rw-r--r--arch/arm/plat-omap/include/mach/pm.h356
-rw-r--r--arch/arm/plat-omap/include/mach/prcm.h33
-rw-r--r--arch/arm/plat-omap/include/mach/sdrc.h75
-rw-r--r--arch/arm/plat-omap/include/mach/serial.h37
-rw-r--r--arch/arm/plat-omap/include/mach/sram.h56
-rw-r--r--arch/arm/plat-omap/include/mach/system.h49
-rw-r--r--arch/arm/plat-omap/include/mach/tc.h106
-rw-r--r--arch/arm/plat-omap/include/mach/timex.h41
-rw-r--r--arch/arm/plat-omap/include/mach/uncompress.h83
-rw-r--r--arch/arm/plat-omap/include/mach/usb.h141
-rw-r--r--arch/arm/plat-omap/include/mach/vmalloc.h21
-rw-r--r--arch/arm/plat-omap/mailbox.c2
-rw-r--r--arch/arm/plat-omap/mcbsp.c4
-rw-r--r--arch/arm/plat-omap/mux.c2
-rw-r--r--arch/arm/plat-omap/ocpi.c2
-rw-r--r--arch/arm/plat-omap/sram.c6
-rw-r--r--arch/arm/plat-omap/usb.c10
-rw-r--r--arch/arm/plat-orion/time.c2
-rw-r--r--arch/arm/plat-s3c24xx/clock.c6
-rw-r--r--arch/arm/plat-s3c24xx/common-smdk.c6
-rw-r--r--arch/arm/plat-s3c24xx/cpu.c6
-rw-r--r--arch/arm/plat-s3c24xx/devs.c4
-rw-r--r--arch/arm/plat-s3c24xx/dma.c4
-rw-r--r--arch/arm/plat-s3c24xx/gpio.c4
-rw-r--r--arch/arm/plat-s3c24xx/gpiolib.c4
-rw-r--r--arch/arm/plat-s3c24xx/irq.c6
-rw-r--r--arch/arm/plat-s3c24xx/pm-simtec.c8
-rw-r--r--arch/arm/plat-s3c24xx/pm.c10
-rw-r--r--arch/arm/plat-s3c24xx/pwm-clock.c6
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x-clock.c4
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x-irq.c6
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x.c10
-rw-r--r--arch/arm/plat-s3c24xx/sleep.S10
-rw-r--r--arch/arm/plat-s3c24xx/time.c4
-rw-r--r--arch/arm/tools/Makefile1
-rw-r--r--arch/avr32/Makefile7
-rw-r--r--arch/avr32/boards/atngw100/flash.c2
-rw-r--r--arch/avr32/boards/atngw100/setup.c8
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c10
-rw-r--r--arch/avr32/boards/atstk1000/atstk1003.c8
-rw-r--r--arch/avr32/boards/atstk1000/atstk1004.c8
-rw-r--r--arch/avr32/boards/atstk1000/flash.c2
-rw-r--r--arch/avr32/boards/atstk1000/setup.c6
-rw-r--r--arch/avr32/include/asm/Kbuild3
-rw-r--r--arch/avr32/include/asm/a.out.h (renamed from arch/sh/include/asm/a.out.h)6
-rw-r--r--arch/avr32/include/asm/addrspace.h43
-rw-r--r--arch/avr32/include/asm/asm.h102
-rw-r--r--arch/avr32/include/asm/atmel-mci.h9
-rw-r--r--arch/avr32/include/asm/atomic.h201
-rw-r--r--arch/avr32/include/asm/auxvec.h4
-rw-r--r--arch/avr32/include/asm/bitops.h301
-rw-r--r--arch/avr32/include/asm/bug.h73
-rw-r--r--arch/avr32/include/asm/bugs.h15
-rw-r--r--arch/avr32/include/asm/byteorder.h31
-rw-r--r--arch/avr32/include/asm/cache.h38
-rw-r--r--arch/avr32/include/asm/cachectl.h11
-rw-r--r--arch/avr32/include/asm/cacheflush.h131
-rw-r--r--arch/avr32/include/asm/checksum.h152
-rw-r--r--arch/avr32/include/asm/cputime.h6
-rw-r--r--arch/avr32/include/asm/current.h15
-rw-r--r--arch/avr32/include/asm/delay.h26
-rw-r--r--arch/avr32/include/asm/device.h7
-rw-r--r--arch/avr32/include/asm/div64.h6
-rw-r--r--arch/avr32/include/asm/dma-mapping.h349
-rw-r--r--arch/avr32/include/asm/dma.h8
-rw-r--r--arch/avr32/include/asm/elf.h108
-rw-r--r--arch/avr32/include/asm/emergency-restart.h6
-rw-r--r--arch/avr32/include/asm/errno.h6
-rw-r--r--arch/avr32/include/asm/fb.h21
-rw-r--r--arch/avr32/include/asm/fcntl.h6
-rw-r--r--arch/avr32/include/asm/futex.h6
-rw-r--r--arch/avr32/include/asm/gpio.h6
-rw-r--r--arch/avr32/include/asm/hardirq.h34
-rw-r--r--arch/avr32/include/asm/hw_irq.h9
-rw-r--r--arch/avr32/include/asm/io.h312
-rw-r--r--arch/avr32/include/asm/ioctl.h6
-rw-r--r--arch/avr32/include/asm/ioctls.h87
-rw-r--r--arch/avr32/include/asm/ipcbuf.h29
-rw-r--r--arch/avr32/include/asm/irq.h24
-rw-r--r--arch/avr32/include/asm/irq_regs.h1
-rw-r--r--arch/avr32/include/asm/irqflags.h68
-rw-r--r--arch/avr32/include/asm/kdebug.h11
-rw-r--r--arch/avr32/include/asm/kmap_types.h30
-rw-r--r--arch/avr32/include/asm/kprobes.h35
-rw-r--r--arch/avr32/include/asm/linkage.h7
-rw-r--r--arch/avr32/include/asm/local.h6
-rw-r--r--arch/avr32/include/asm/mach/serial_at91.h33
-rw-r--r--arch/avr32/include/asm/mman.h17
-rw-r--r--arch/avr32/include/asm/mmu.h10
-rw-r--r--arch/avr32/include/asm/mmu_context.h148
-rw-r--r--arch/avr32/include/asm/module.h28
-rw-r--r--arch/avr32/include/asm/msgbuf.h31
-rw-r--r--arch/avr32/include/asm/mutex.h9
-rw-r--r--arch/avr32/include/asm/numnodes.h7
-rw-r--r--arch/avr32/include/asm/ocd.h543
-rw-r--r--arch/avr32/include/asm/page.h104
-rw-r--r--arch/avr32/include/asm/param.h23
-rw-r--r--arch/avr32/include/asm/pci.h10
-rw-r--r--arch/avr32/include/asm/percpu.h6
-rw-r--r--arch/avr32/include/asm/pgalloc.h98
-rw-r--r--arch/avr32/include/asm/pgtable-2level.h47
-rw-r--r--arch/avr32/include/asm/pgtable.h377
-rw-r--r--arch/avr32/include/asm/poll.h1
-rw-r--r--arch/avr32/include/asm/posix_types.h125
-rw-r--r--arch/avr32/include/asm/processor.h178
-rw-r--r--arch/avr32/include/asm/ptrace.h157
-rw-r--r--arch/avr32/include/asm/resource.h6
-rw-r--r--arch/avr32/include/asm/scatterlist.h26
-rw-r--r--arch/avr32/include/asm/sections.h6
-rw-r--r--arch/avr32/include/asm/sembuf.h25
-rw-r--r--arch/avr32/include/asm/serial.h13
-rw-r--r--arch/avr32/include/asm/setup.h138
-rw-r--r--arch/avr32/include/asm/shmbuf.h42
-rw-r--r--arch/avr32/include/asm/shmparam.h6
-rw-r--r--arch/avr32/include/asm/sigcontext.h34
-rw-r--r--arch/avr32/include/asm/siginfo.h6
-rw-r--r--arch/avr32/include/asm/signal.h168
-rw-r--r--arch/avr32/include/asm/socket.h57
-rw-r--r--arch/avr32/include/asm/sockios.h13
-rw-r--r--arch/avr32/include/asm/stat.h79
-rw-r--r--arch/avr32/include/asm/statfs.h6
-rw-r--r--arch/avr32/include/asm/string.h17
-rw-r--r--arch/avr32/include/asm/sysreg.h291
-rw-r--r--arch/avr32/include/asm/system.h178
-rw-r--r--arch/avr32/include/asm/termbits.h195
-rw-r--r--arch/avr32/include/asm/termios.h62
-rw-r--r--arch/avr32/include/asm/thread_info.h115
-rw-r--r--arch/avr32/include/asm/timex.h39
-rw-r--r--arch/avr32/include/asm/tlb.h32
-rw-r--r--arch/avr32/include/asm/tlbflush.h32
-rw-r--r--arch/avr32/include/asm/topology.h6
-rw-r--r--arch/avr32/include/asm/traps.h23
-rw-r--r--arch/avr32/include/asm/types.h37
-rw-r--r--arch/avr32/include/asm/uaccess.h324
-rw-r--r--arch/avr32/include/asm/ucontext.h12
-rw-r--r--arch/avr32/include/asm/unaligned.h21
-rw-r--r--arch/avr32/include/asm/unistd.h345
-rw-r--r--arch/avr32/include/asm/user.h65
-rw-r--r--arch/avr32/include/asm/xor.h6
-rw-r--r--arch/avr32/kernel/process.c2
-rw-r--r--arch/avr32/kernel/setup.c4
-rw-r--r--arch/avr32/kernel/time.c2
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c8
-rw-r--r--arch/avr32/mach-at32ap/hsmc.c2
-rw-r--r--arch/avr32/mach-at32ap/include/mach/at32ap700x.h49
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h121
-rw-r--r--arch/avr32/mach-at32ap/include/mach/cpu.h35
-rw-r--r--arch/avr32/mach-at32ap/include/mach/gpio.h45
-rw-r--r--arch/avr32/mach-at32ap/include/mach/init.h18
-rw-r--r--arch/avr32/mach-at32ap/include/mach/io.h39
-rw-r--r--arch/avr32/mach-at32ap/include/mach/irq.h14
-rw-r--r--arch/avr32/mach-at32ap/include/mach/pm.h51
-rw-r--r--arch/avr32/mach-at32ap/include/mach/portmux.h29
-rw-r--r--arch/avr32/mach-at32ap/include/mach/smc.h113
-rw-r--r--arch/avr32/mach-at32ap/include/mach/sram.h30
-rw-r--r--arch/avr32/mach-at32ap/pio.c2
-rw-r--r--arch/avr32/mach-at32ap/pm-at32ap700x.S2
-rw-r--r--arch/avr32/mach-at32ap/pm.c4
-rw-r--r--arch/m68k/mac/baboon.c1
-rw-r--r--arch/m68k/mac/via.c1
-rw-r--r--arch/mips/emma2rh/markeins/setup.c1
-rw-r--r--arch/mips/jazz/setup.c2
-rw-r--r--arch/mn10300/kernel/module.c4
-rw-r--r--arch/powerpc/Kconfig.debug2
-rw-r--r--arch/powerpc/boot/dts/mpc8610_hpcd.dts5
-rw-r--r--arch/powerpc/boot/io.h2
-rw-r--r--arch/powerpc/include/asm/8253pit.h10
-rw-r--r--arch/powerpc/include/asm/8xx_immap.h564
-rw-r--r--arch/powerpc/include/asm/Kbuild37
-rw-r--r--arch/powerpc/include/asm/a.out.h20
-rw-r--r--arch/powerpc/include/asm/abs_addr.h75
-rw-r--r--arch/powerpc/include/asm/agp.h22
-rw-r--r--arch/powerpc/include/asm/asm-compat.h69
-rw-r--r--arch/powerpc/include/asm/atomic.h479
-rw-r--r--arch/powerpc/include/asm/auxvec.h19
-rw-r--r--arch/powerpc/include/asm/backlight.h41
-rw-r--r--arch/powerpc/include/asm/bitops.h410
-rw-r--r--arch/powerpc/include/asm/bootx.h171
-rw-r--r--arch/powerpc/include/asm/btext.h28
-rw-r--r--arch/powerpc/include/asm/bug.h121
-rw-r--r--arch/powerpc/include/asm/bugs.h18
-rw-r--r--arch/powerpc/include/asm/byteorder.h89
-rw-r--r--arch/powerpc/include/asm/cache.h45
-rw-r--r--arch/powerpc/include/asm/cacheflush.h75
-rw-r--r--arch/powerpc/include/asm/cell-pmu.h105
-rw-r--r--arch/powerpc/include/asm/cell-regs.h315
-rw-r--r--arch/powerpc/include/asm/checksum.h117
-rw-r--r--arch/powerpc/include/asm/clk_interface.h20
-rw-r--r--arch/powerpc/include/asm/code-patching.h54
-rw-r--r--arch/powerpc/include/asm/compat.h214
-rw-r--r--arch/powerpc/include/asm/cpm.h106
-rw-r--r--arch/powerpc/include/asm/cpm1.h652
-rw-r--r--arch/powerpc/include/asm/cpm2.h1195
-rw-r--r--arch/powerpc/include/asm/cputable.h514
-rw-r--r--arch/powerpc/include/asm/cputhreads.h71
-rw-r--r--arch/powerpc/include/asm/cputime.h235
-rw-r--r--arch/powerpc/include/asm/current.h40
-rw-r--r--arch/powerpc/include/asm/dbdma.h108
-rw-r--r--arch/powerpc/include/asm/dcr-generic.h49
-rw-r--r--arch/powerpc/include/asm/dcr-mmio.h61
-rw-r--r--arch/powerpc/include/asm/dcr-native.h116
-rw-r--r--arch/powerpc/include/asm/dcr-regs.h149
-rw-r--r--arch/powerpc/include/asm/dcr.h78
-rw-r--r--arch/powerpc/include/asm/delay.h34
-rw-r--r--arch/powerpc/include/asm/device.h24
-rw-r--r--arch/powerpc/include/asm/div64.h1
-rw-r--r--arch/powerpc/include/asm/dma-mapping.h474
-rw-r--r--arch/powerpc/include/asm/dma.h360
-rw-r--r--arch/powerpc/include/asm/edac.h40
-rw-r--r--arch/powerpc/include/asm/eeh.h211
-rw-r--r--arch/powerpc/include/asm/eeh_event.h53
-rw-r--r--arch/powerpc/include/asm/elf.h424
-rw-r--r--arch/powerpc/include/asm/emergency-restart.h1
-rw-r--r--arch/powerpc/include/asm/errno.h11
-rw-r--r--arch/powerpc/include/asm/exception.h311
-rw-r--r--arch/powerpc/include/asm/fb.h21
-rw-r--r--arch/powerpc/include/asm/fcntl.h11
-rw-r--r--arch/powerpc/include/asm/feature-fixups.h126
-rw-r--r--arch/powerpc/include/asm/firmware.h132
-rw-r--r--arch/powerpc/include/asm/fixmap.h106
-rw-r--r--arch/powerpc/include/asm/floppy.h213
-rw-r--r--arch/powerpc/include/asm/fs_pd.h50
-rw-r--r--arch/powerpc/include/asm/fsl_gtm.h47
-rw-r--r--arch/powerpc/include/asm/fsl_lbc.h311
-rw-r--r--arch/powerpc/include/asm/ftrace.h14
-rw-r--r--arch/powerpc/include/asm/futex.h117
-rw-r--r--arch/powerpc/include/asm/gpio.h56
-rw-r--r--arch/powerpc/include/asm/grackle.h12
-rw-r--r--arch/powerpc/include/asm/hardirq.h29
-rw-r--r--arch/powerpc/include/asm/heathrow.h67
-rw-r--r--arch/powerpc/include/asm/highmem.h138
-rw-r--r--arch/powerpc/include/asm/hugetlb.h75
-rw-r--r--arch/powerpc/include/asm/hvcall.h296
-rw-r--r--arch/powerpc/include/asm/hvconsole.h41
-rw-r--r--arch/powerpc/include/asm/hvcserver.h59
-rw-r--r--arch/powerpc/include/asm/hw_irq.h135
-rw-r--r--arch/powerpc/include/asm/hydra.h102
-rw-r--r--arch/powerpc/include/asm/i8259.h12
-rw-r--r--arch/powerpc/include/asm/ibmebus.h60
-rw-r--r--arch/powerpc/include/asm/ide.h58
-rw-r--r--arch/powerpc/include/asm/immap_86xx.h156
-rw-r--r--arch/powerpc/include/asm/immap_cpm2.h650
-rw-r--r--arch/powerpc/include/asm/immap_qe.h483
-rw-r--r--arch/powerpc/include/asm/io-defs.h60
-rw-r--r--arch/powerpc/include/asm/io.h787
-rw-r--r--arch/powerpc/include/asm/ioctl.h13
-rw-r--r--arch/powerpc/include/asm/ioctls.h110
-rw-r--r--arch/powerpc/include/asm/iommu.h131
-rw-r--r--arch/powerpc/include/asm/ipcbuf.h34
-rw-r--r--arch/powerpc/include/asm/ipic.h84
-rw-r--r--arch/powerpc/include/asm/irq.h366
-rw-r--r--arch/powerpc/include/asm/irq_regs.h2
-rw-r--r--arch/powerpc/include/asm/irqflags.h42
-rw-r--r--arch/powerpc/include/asm/iseries/alpaca.h31
-rw-r--r--arch/powerpc/include/asm/iseries/hv_call.h111
-rw-r--r--arch/powerpc/include/asm/iseries/hv_call_event.h201
-rw-r--r--arch/powerpc/include/asm/iseries/hv_call_sc.h50
-rw-r--r--arch/powerpc/include/asm/iseries/hv_call_xm.h61
-rw-r--r--arch/powerpc/include/asm/iseries/hv_lp_config.h128
-rw-r--r--arch/powerpc/include/asm/iseries/hv_lp_event.h162
-rw-r--r--arch/powerpc/include/asm/iseries/hv_types.h112
-rw-r--r--arch/powerpc/include/asm/iseries/iommu.h41
-rw-r--r--arch/powerpc/include/asm/iseries/it_lp_queue.h78
-rw-r--r--arch/powerpc/include/asm/iseries/lpar_map.h85
-rw-r--r--arch/powerpc/include/asm/iseries/mf.h51
-rw-r--r--arch/powerpc/include/asm/iseries/vio.h265
-rw-r--r--arch/powerpc/include/asm/kdebug.h15
-rw-r--r--arch/powerpc/include/asm/kdump.h35
-rw-r--r--arch/powerpc/include/asm/kexec.h160
-rw-r--r--arch/powerpc/include/asm/keylargo.h261
-rw-r--r--arch/powerpc/include/asm/kgdb.h63
-rw-r--r--arch/powerpc/include/asm/kmap_types.h33
-rw-r--r--arch/powerpc/include/asm/kprobes.h118
-rw-r--r--arch/powerpc/include/asm/kvm.h55
-rw-r--r--arch/powerpc/include/asm/kvm_asm.h55
-rw-r--r--arch/powerpc/include/asm/kvm_host.h155
-rw-r--r--arch/powerpc/include/asm/kvm_para.h37
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h95
-rw-r--r--arch/powerpc/include/asm/libata-portmap.h12
-rw-r--r--arch/powerpc/include/asm/linkage.h6
-rw-r--r--arch/powerpc/include/asm/lmb.h15
-rw-r--r--arch/powerpc/include/asm/local.h200
-rw-r--r--arch/powerpc/include/asm/lppaca.h159
-rw-r--r--arch/powerpc/include/asm/lv1call.h348
-rw-r--r--arch/powerpc/include/asm/machdep.h365
-rw-r--r--arch/powerpc/include/asm/macio.h142
-rw-r--r--arch/powerpc/include/asm/mc146818rtc.h36
-rw-r--r--arch/powerpc/include/asm/mediabay.h43
-rw-r--r--arch/powerpc/include/asm/mman.h63
-rw-r--r--arch/powerpc/include/asm/mmu-40x.h63
-rw-r--r--arch/powerpc/include/asm/mmu-44x.h76
-rw-r--r--arch/powerpc/include/asm/mmu-8xx.h145
-rw-r--r--arch/powerpc/include/asm/mmu-fsl-booke.h82
-rw-r--r--arch/powerpc/include/asm/mmu-hash32.h83
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h478
-rw-r--r--arch/powerpc/include/asm/mmu.h26
-rw-r--r--arch/powerpc/include/asm/mmu_context.h280
-rw-r--r--arch/powerpc/include/asm/mmzone.h47
-rw-r--r--arch/powerpc/include/asm/module.h77
-rw-r--r--arch/powerpc/include/asm/mpc512x.h22
-rw-r--r--arch/powerpc/include/asm/mpc52xx.h295
-rw-r--r--arch/powerpc/include/asm/mpc52xx_psc.h276
-rw-r--r--arch/powerpc/include/asm/mpc6xx.h6
-rw-r--r--arch/powerpc/include/asm/mpc8260.h25
-rw-r--r--arch/powerpc/include/asm/mpc86xx.h33
-rw-r--r--arch/powerpc/include/asm/mpc8xx.h12
-rw-r--r--arch/powerpc/include/asm/mpic.h481
-rw-r--r--arch/powerpc/include/asm/msgbuf.h33
-rw-r--r--arch/powerpc/include/asm/mutex.h9
-rw-r--r--arch/powerpc/include/asm/nvram.h139
-rw-r--r--arch/powerpc/include/asm/of_device.h31
-rw-r--r--arch/powerpc/include/asm/of_platform.h42
-rw-r--r--arch/powerpc/include/asm/ohare.h54
-rw-r--r--arch/powerpc/include/asm/oprofile_impl.h134
-rw-r--r--arch/powerpc/include/asm/pSeries_reconfig.h29
-rw-r--r--arch/powerpc/include/asm/paca.h112
-rw-r--r--arch/powerpc/include/asm/page.h225
-rw-r--r--arch/powerpc/include/asm/page_32.h38
-rw-r--r--arch/powerpc/include/asm/page_64.h185
-rw-r--r--arch/powerpc/include/asm/param.h22
-rw-r--r--arch/powerpc/include/asm/parport.h39
-rw-r--r--arch/powerpc/include/asm/pasemi_dma.h538
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h302
-rw-r--r--arch/powerpc/include/asm/pci.h228
-rw-r--r--arch/powerpc/include/asm/percpu.h24
-rw-r--r--arch/powerpc/include/asm/pgalloc-32.h43
-rw-r--r--arch/powerpc/include/asm/pgalloc-64.h166
-rw-r--r--arch/powerpc/include/asm/pgalloc.h12
-rw-r--r--arch/powerpc/include/asm/pgtable-4k.h117
-rw-r--r--arch/powerpc/include/asm/pgtable-64k.h155
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc32.h802
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h468
-rw-r--r--arch/powerpc/include/asm/pgtable.h57
-rw-r--r--arch/powerpc/include/asm/phyp_dump.h47
-rw-r--r--arch/powerpc/include/asm/pmac_feature.h405
-rw-r--r--arch/powerpc/include/asm/pmac_low_i2c.h107
-rw-r--r--arch/powerpc/include/asm/pmac_pfunc.h252
-rw-r--r--arch/powerpc/include/asm/pmc.h37
-rw-r--r--arch/powerpc/include/asm/pmi.h66
-rw-r--r--arch/powerpc/include/asm/poll.h1
-rw-r--r--arch/powerpc/include/asm/posix_types.h128
-rw-r--r--arch/powerpc/include/asm/ppc-pci.h149
-rw-r--r--arch/powerpc/include/asm/ppc4xx.h18
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h689
-rw-r--r--arch/powerpc/include/asm/processor.h314
-rw-r--r--arch/powerpc/include/asm/prom.h356
-rw-r--r--arch/powerpc/include/asm/ps3.h519
-rw-r--r--arch/powerpc/include/asm/ps3av.h744
-rw-r--r--arch/powerpc/include/asm/ps3fb.h44
-rw-r--r--arch/powerpc/include/asm/ps3stor.h71
-rw-r--r--arch/powerpc/include/asm/ptrace.h293
-rw-r--r--arch/powerpc/include/asm/qe.h642
-rw-r--r--arch/powerpc/include/asm/qe_ic.h128
-rw-r--r--arch/powerpc/include/asm/reg.h788
-rw-r--r--arch/powerpc/include/asm/reg_8xx.h42
-rw-r--r--arch/powerpc/include/asm/reg_booke.h501
-rw-r--r--arch/powerpc/include/asm/reg_fsl_emb.h72
-rw-r--r--arch/powerpc/include/asm/resource.h1
-rw-r--r--arch/powerpc/include/asm/rheap.h89
-rw-r--r--arch/powerpc/include/asm/rio.h18
-rw-r--r--arch/powerpc/include/asm/rtas.h247
-rw-r--r--arch/powerpc/include/asm/rtc.h78
-rw-r--r--arch/powerpc/include/asm/rwsem.h173
-rw-r--r--arch/powerpc/include/asm/scatterlist.h50
-rw-r--r--arch/powerpc/include/asm/seccomp.h20
-rw-r--r--arch/powerpc/include/asm/sections.h22
-rw-r--r--arch/powerpc/include/asm/sembuf.h36
-rw-r--r--arch/powerpc/include/asm/serial.h24
-rw-r--r--arch/powerpc/include/asm/setjmp.h18
-rw-r--r--arch/powerpc/include/asm/setup.h6
-rw-r--r--arch/powerpc/include/asm/shmbuf.h59
-rw-r--r--arch/powerpc/include/asm/shmparam.h6
-rw-r--r--arch/powerpc/include/asm/sigcontext.h87
-rw-r--r--arch/powerpc/include/asm/siginfo.h26
-rw-r--r--arch/powerpc/include/asm/signal.h150
-rw-r--r--arch/powerpc/include/asm/smp.h127
-rw-r--r--arch/powerpc/include/asm/smu.h700
-rw-r--r--arch/powerpc/include/asm/socket.h64
-rw-r--r--arch/powerpc/include/asm/sockios.h20
-rw-r--r--arch/powerpc/include/asm/sparsemem.h32
-rw-r--r--arch/powerpc/include/asm/spinlock.h295
-rw-r--r--arch/powerpc/include/asm/spinlock_types.h20
-rw-r--r--arch/powerpc/include/asm/spu.h732
-rw-r--r--arch/powerpc/include/asm/spu_csa.h266
-rw-r--r--arch/powerpc/include/asm/spu_info.h54
-rw-r--r--arch/powerpc/include/asm/spu_priv1.h236
-rw-r--r--arch/powerpc/include/asm/sstep.h27
-rw-r--r--arch/powerpc/include/asm/stat.h81
-rw-r--r--arch/powerpc/include/asm/statfs.h60
-rw-r--r--arch/powerpc/include/asm/string.h32
-rw-r--r--arch/powerpc/include/asm/suspend.h9
-rw-r--r--arch/powerpc/include/asm/synch.h44
-rw-r--r--arch/powerpc/include/asm/syscall.h84
-rw-r--r--arch/powerpc/include/asm/syscalls.h52
-rw-r--r--arch/powerpc/include/asm/systbl.h324
-rw-r--r--arch/powerpc/include/asm/system.h548
-rw-r--r--arch/powerpc/include/asm/tce.h50
-rw-r--r--arch/powerpc/include/asm/termbits.h209
-rw-r--r--arch/powerpc/include/asm/termios.h85
-rw-r--r--arch/powerpc/include/asm/thread_info.h161
-rw-r--r--arch/powerpc/include/asm/time.h255
-rw-r--r--arch/powerpc/include/asm/timex.h50
-rw-r--r--arch/powerpc/include/asm/tlb.h81
-rw-r--r--arch/powerpc/include/asm/tlbflush.h166
-rw-r--r--arch/powerpc/include/asm/topology.h117
-rw-r--r--arch/powerpc/include/asm/tsi108.h121
-rw-r--r--arch/powerpc/include/asm/tsi108_irq.h124
-rw-r--r--arch/powerpc/include/asm/tsi108_pci.h45
-rw-r--r--arch/powerpc/include/asm/types.h75
-rw-r--r--arch/powerpc/include/asm/uaccess.h496
-rw-r--r--arch/powerpc/include/asm/ucc.h64
-rw-r--r--arch/powerpc/include/asm/ucc_fast.h244
-rw-r--r--arch/powerpc/include/asm/ucc_slow.h290
-rw-r--r--arch/powerpc/include/asm/ucontext.h40
-rw-r--r--arch/powerpc/include/asm/udbg.h55
-rw-r--r--arch/powerpc/include/asm/uic.h21
-rw-r--r--arch/powerpc/include/asm/unaligned.h16
-rw-r--r--arch/powerpc/include/asm/uninorth.h229
-rw-r--r--arch/powerpc/include/asm/unistd.h398
-rw-r--r--arch/powerpc/include/asm/user.h51
-rw-r--r--arch/powerpc/include/asm/vdso.h78
-rw-r--r--arch/powerpc/include/asm/vdso_datapage.h121
-rw-r--r--arch/powerpc/include/asm/vga.h53
-rw-r--r--arch/powerpc/include/asm/vio.h118
-rw-r--r--arch/powerpc/include/asm/xilinx_intc.h20
-rw-r--r--arch/powerpc/include/asm/xmon.h33
-rw-r--r--arch/powerpc/include/asm/xor.h1
-rw-r--r--arch/powerpc/kernel/Makefile14
-rw-r--r--arch/powerpc/kernel/cpu_setup_44x.S6
-rw-r--r--arch/powerpc/kernel/irq.c25
-rw-r--r--arch/powerpc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/vdso.c2
-rw-r--r--arch/powerpc/lib/Makefile2
-rw-r--r--arch/powerpc/mm/mem.c2
-rw-r--r--arch/powerpc/mm/ppc_mmu_32.c4
-rw-r--r--arch/powerpc/mm/tlb_64.c2
-rw-r--r--arch/powerpc/platforms/52xx/Makefile4
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_smp.c2
-rw-r--r--arch/powerpc/platforms/Makefile6
-rw-r--r--arch/powerpc/platforms/powermac/Makefile3
-rw-r--r--arch/powerpc/sysdev/Makefile2
-rw-r--r--arch/s390/include/asm/Kbuild15
-rw-r--r--arch/s390/include/asm/airq.h19
-rw-r--r--arch/s390/include/asm/appldata.h90
-rw-r--r--arch/s390/include/asm/atomic.h285
-rw-r--r--arch/s390/include/asm/auxvec.h4
-rw-r--r--arch/s390/include/asm/bitops.h884
-rw-r--r--arch/s390/include/asm/bug.h70
-rw-r--r--arch/s390/include/asm/bugs.h22
-rw-r--r--arch/s390/include/asm/byteorder.h125
-rw-r--r--arch/s390/include/asm/cache.h19
-rw-r--r--arch/s390/include/asm/cacheflush.h31
-rw-r--r--arch/s390/include/asm/ccwdev.h192
-rw-r--r--arch/s390/include/asm/ccwgroup.h69
-rw-r--r--arch/s390/include/asm/checksum.h166
-rw-r--r--arch/s390/include/asm/chpid.h56
-rw-r--r--arch/s390/include/asm/chsc.h127
-rw-r--r--arch/s390/include/asm/cio.h514
-rw-r--r--arch/s390/include/asm/cmb.h58
-rw-r--r--arch/s390/include/asm/compat.h233
-rw-r--r--arch/s390/include/asm/cpcmd.h34
-rw-r--r--arch/s390/include/asm/cpu.h33
-rw-r--r--arch/s390/include/asm/cputime.h177
-rw-r--r--arch/s390/include/asm/current.h23
-rw-r--r--arch/s390/include/asm/dasd.h270
-rw-r--r--arch/s390/include/asm/debug.h261
-rw-r--r--arch/s390/include/asm/delay.h22
-rw-r--r--arch/s390/include/asm/device.h7
-rw-r--r--arch/s390/include/asm/diag.h39
-rw-r--r--arch/s390/include/asm/div64.h1
-rw-r--r--arch/s390/include/asm/dma.h16
-rw-r--r--arch/s390/include/asm/ebcdic.h49
-rw-r--r--arch/s390/include/asm/elf.h196
-rw-r--r--arch/s390/include/asm/emergency-restart.h6
-rw-r--r--arch/s390/include/asm/errno.h13
-rw-r--r--arch/s390/include/asm/etr.h258
-rw-r--r--arch/s390/include/asm/extmem.h33
-rw-r--r--arch/s390/include/asm/fb.h12
-rw-r--r--arch/s390/include/asm/fcntl.h1
-rw-r--r--arch/s390/include/asm/fcx.h311
-rw-r--r--arch/s390/include/asm/futex.h52
-rw-r--r--arch/s390/include/asm/hardirq.h51
-rw-r--r--arch/s390/include/asm/hugetlb.h184
-rw-r--r--arch/s390/include/asm/idals.h256
-rw-r--r--arch/s390/include/asm/io.h54
-rw-r--r--arch/s390/include/asm/ioctl.h1
-rw-r--r--arch/s390/include/asm/ioctls.h92
-rw-r--r--arch/s390/include/asm/ipcbuf.h31
-rw-r--r--arch/s390/include/asm/ipl.h168
-rw-r--r--arch/s390/include/asm/irq.h23
-rw-r--r--arch/s390/include/asm/irq_regs.h1
-rw-r--r--arch/s390/include/asm/irqflags.h106
-rw-r--r--arch/s390/include/asm/isc.h25
-rw-r--r--arch/s390/include/asm/itcw.h30
-rw-r--r--arch/s390/include/asm/kdebug.h27
-rw-r--r--arch/s390/include/asm/kexec.h43
-rw-r--r--arch/s390/include/asm/kmap_types.h23
-rw-r--r--arch/s390/include/asm/kprobes.h103
-rw-r--r--arch/s390/include/asm/kvm.h45
-rw-r--r--arch/s390/include/asm/kvm_host.h235
-rw-r--r--arch/s390/include/asm/kvm_para.h150
-rw-r--r--arch/s390/include/asm/kvm_virtio.h63
-rw-r--r--arch/s390/include/asm/linkage.h6
-rw-r--r--arch/s390/include/asm/local.h1
-rw-r--r--arch/s390/include/asm/lowcore.h433
-rw-r--r--arch/s390/include/asm/mathemu.h29
-rw-r--r--arch/s390/include/asm/mman.h25
-rw-r--r--arch/s390/include/asm/mmu.h13
-rw-r--r--arch/s390/include/asm/mmu_context.h77
-rw-r--r--arch/s390/include/asm/module.h46
-rw-r--r--arch/s390/include/asm/monwriter.h33
-rw-r--r--arch/s390/include/asm/msgbuf.h37
-rw-r--r--arch/s390/include/asm/mutex.h9
-rw-r--r--arch/s390/include/asm/page.h155
-rw-r--r--arch/s390/include/asm/param.h30
-rw-r--r--arch/s390/include/asm/pci.h10
-rw-r--r--arch/s390/include/asm/percpu.h37
-rw-r--r--arch/s390/include/asm/pgalloc.h174
-rw-r--r--arch/s390/include/asm/pgtable.h1093
-rw-r--r--arch/s390/include/asm/poll.h1
-rw-r--r--arch/s390/include/asm/posix_types.h111
-rw-r--r--arch/s390/include/asm/processor.h360
-rw-r--r--arch/s390/include/asm/ptrace.h499
-rw-r--r--arch/s390/include/asm/qdio.h382
-rw-r--r--arch/s390/include/asm/qeth.h78
-rw-r--r--arch/s390/include/asm/reset.h21
-rw-r--r--arch/s390/include/asm/resource.h15
-rw-r--r--arch/s390/include/asm/rwsem.h387
-rw-r--r--arch/s390/include/asm/s390_ext.h32
-rw-r--r--arch/s390/include/asm/s390_rdev.h15
-rw-r--r--arch/s390/include/asm/scatterlist.h19
-rw-r--r--arch/s390/include/asm/schid.h32
-rw-r--r--arch/s390/include/asm/sclp.h58
-rw-r--r--arch/s390/include/asm/sections.h8
-rw-r--r--arch/s390/include/asm/segment.h4
-rw-r--r--arch/s390/include/asm/sembuf.h29
-rw-r--r--arch/s390/include/asm/setup.h140
-rw-r--r--arch/s390/include/asm/sfp-machine.h142
-rw-r--r--arch/s390/include/asm/sfp-util.h77
-rw-r--r--arch/s390/include/asm/shmbuf.h48
-rw-r--r--arch/s390/include/asm/shmparam.h13
-rw-r--r--arch/s390/include/asm/sigcontext.h71
-rw-r--r--arch/s390/include/asm/siginfo.h18
-rw-r--r--arch/s390/include/asm/signal.h172
-rw-r--r--arch/s390/include/asm/sigp.h126
-rw-r--r--arch/s390/include/asm/smp.h116
-rw-r--r--arch/s390/include/asm/socket.h65
-rw-r--r--arch/s390/include/asm/sockios.h21
-rw-r--r--arch/s390/include/asm/sparsemem.h18
-rw-r--r--arch/s390/include/asm/spinlock.h178
-rw-r--r--arch/s390/include/asm/spinlock_types.h20
-rw-r--r--arch/s390/include/asm/stat.h105
-rw-r--r--arch/s390/include/asm/statfs.h71
-rw-r--r--arch/s390/include/asm/string.h143
-rw-r--r--arch/s390/include/asm/suspend.h5
-rw-r--r--arch/s390/include/asm/sysinfo.h121
-rw-r--r--arch/s390/include/asm/system.h462
-rw-r--r--arch/s390/include/asm/tape390.h103
-rw-r--r--arch/s390/include/asm/termbits.h206
-rw-r--r--arch/s390/include/asm/termios.h67
-rw-r--r--arch/s390/include/asm/thread_info.h118
-rw-r--r--arch/s390/include/asm/timer.h65
-rw-r--r--arch/s390/include/asm/timex.h88
-rw-r--r--arch/s390/include/asm/tlb.h156
-rw-r--r--arch/s390/include/asm/tlbflush.h140
-rw-r--r--arch/s390/include/asm/todclk.h23
-rw-r--r--arch/s390/include/asm/topology.h33
-rw-r--r--arch/s390/include/asm/types.h63
-rw-r--r--arch/s390/include/asm/uaccess.h363
-rw-r--r--arch/s390/include/asm/ucontext.h20
-rw-r--r--arch/s390/include/asm/unaligned.h13
-rw-r--r--arch/s390/include/asm/unistd.h411
-rw-r--r--arch/s390/include/asm/user.h76
-rw-r--r--arch/s390/include/asm/vtoc.h203
-rw-r--r--arch/s390/include/asm/xor.h1
-rw-r--r--arch/s390/include/asm/zcrypt.h276
-rw-r--r--arch/sh/Kconfig27
-rw-r--r--arch/sh/Kconfig.debug2
-rw-r--r--arch/sh/Makefile16
-rw-r--r--arch/sh/boards/Makefile2
-rw-r--r--arch/sh/boards/board-ap325rxa.c1
-rw-r--r--arch/sh/boards/mach-se/7343/irq.c1
-rw-r--r--arch/sh/boards/mach-systemh/irq.c3
-rw-r--r--arch/sh/configs/dreamcast_defconfig14
-rw-r--r--arch/sh/include/asm/ptrace.h9
-rw-r--r--arch/sh/include/asm/seccomp.h10
-rw-r--r--arch/sh/include/asm/thread_info.h51
-rw-r--r--arch/sh/include/asm/tlb_64.h12
-rw-r--r--arch/sh/include/cpu-sh2/cpu/cache.h6
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/addrspace.h10
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/cache.h3
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/cacheflush.h34
-rw-r--r--arch/sh/kernel/cpu/sh4/sq.c2
-rw-r--r--arch/sh/kernel/cpu/sh5/entry.S19
-rw-r--r--arch/sh/kernel/entry-common.S16
-rw-r--r--arch/sh/kernel/machine_kexec.c8
-rw-r--r--arch/sh/kernel/module.c7
-rw-r--r--arch/sh/kernel/ptrace_32.c157
-rw-r--r--arch/sh/kernel/ptrace_64.c144
-rw-r--r--arch/sh/kernel/setup.c20
-rw-r--r--arch/sh/kernel/signal_32.c22
-rw-r--r--arch/sh/kernel/signal_64.c166
-rw-r--r--arch/sh/mm/Kconfig1
-rw-r--r--arch/sh/mm/Makefile_3211
-rw-r--r--arch/sh/mm/cache-sh2.c45
-rw-r--r--arch/sh/mm/cache-sh2a.c129
-rw-r--r--arch/sh/mm/tlb-sh5.c20
-rw-r--r--arch/sh/tools/Makefile4
-rw-r--r--arch/sparc/include/asm/futex_64.h2
-rw-r--r--arch/sparc/include/asm/irq_64.h3
-rw-r--r--arch/sparc/include/asm/of_platform.h26
-rw-r--r--arch/sparc/include/asm/of_platform_32.h24
-rw-r--r--arch/sparc/include/asm/of_platform_64.h25
-rw-r--r--arch/sparc/include/asm/ptrace_32.h20
-rw-r--r--arch/sparc/include/asm/ptrace_64.h39
-rw-r--r--arch/sparc64/kernel/irq.c19
-rw-r--r--arch/sparc64/kernel/of_device.c5
-rw-r--r--arch/sparc64/kernel/process.c110
-rw-r--r--arch/sparc64/kernel/signal.c7
-rw-r--r--arch/sparc64/kernel/smp.c298
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c1
-rw-r--r--arch/sparc64/kernel/traps.c10
-rw-r--r--arch/sparc64/mm/tsb.c5
-rw-r--r--arch/sparc64/mm/ultra.S42
-rw-r--r--arch/xtensa/kernel/xtensa_ksyms.c1
2099 files changed, 143299 insertions, 2517 deletions
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 2f0747744236..703a44fa0f9b 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -97,9 +97,7 @@ textofs-y := 0x00008000
97 machine-$(CONFIG_ARCH_RPC) := rpc 97 machine-$(CONFIG_ARCH_RPC) := rpc
98 machine-$(CONFIG_ARCH_EBSA110) := ebsa110 98 machine-$(CONFIG_ARCH_EBSA110) := ebsa110
99 machine-$(CONFIG_ARCH_CLPS7500) := clps7500 99 machine-$(CONFIG_ARCH_CLPS7500) := clps7500
100 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500
101 machine-$(CONFIG_FOOTBRIDGE) := footbridge 100 machine-$(CONFIG_FOOTBRIDGE) := footbridge
102 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285
103 machine-$(CONFIG_ARCH_SHARK) := shark 101 machine-$(CONFIG_ARCH_SHARK) := shark
104 machine-$(CONFIG_ARCH_SA1100) := sa1100 102 machine-$(CONFIG_ARCH_SA1100) := sa1100
105ifeq ($(CONFIG_ARCH_SA1100),y) 103ifeq ($(CONFIG_ARCH_SA1100),y)
@@ -114,13 +112,15 @@ endif
114 machine-$(CONFIG_ARCH_IOP32X) := iop32x 112 machine-$(CONFIG_ARCH_IOP32X) := iop32x
115 machine-$(CONFIG_ARCH_IOP33X) := iop33x 113 machine-$(CONFIG_ARCH_IOP33X) := iop33x
116 machine-$(CONFIG_ARCH_IOP13XX) := iop13xx 114 machine-$(CONFIG_ARCH_IOP13XX) := iop13xx
115 plat-$(CONFIG_PLAT_IOP) := iop
117 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx 116 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
118 machine-$(CONFIG_ARCH_IXP2000) := ixp2000 117 machine-$(CONFIG_ARCH_IXP2000) := ixp2000
119 machine-$(CONFIG_ARCH_IXP23XX) := ixp23xx 118 machine-$(CONFIG_ARCH_IXP23XX) := ixp23xx
120 machine-$(CONFIG_ARCH_OMAP1) := omap1 119 machine-$(CONFIG_ARCH_OMAP1) := omap1
121 machine-$(CONFIG_ARCH_OMAP2) := omap2 120 machine-$(CONFIG_ARCH_OMAP2) := omap2
122 incdir-$(CONFIG_ARCH_OMAP) := omap 121 plat-$(CONFIG_ARCH_OMAP) := omap
123 machine-$(CONFIG_ARCH_S3C2410) := s3c2410 122 machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2400 s3c2412 s3c2440 s3c2442 s3c2443
123 plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx
124 machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x 124 machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x
125 machine-$(CONFIG_ARCH_VERSATILE) := versatile 125 machine-$(CONFIG_ARCH_VERSATILE) := versatile
126 machine-$(CONFIG_ARCH_IMX) := imx 126 machine-$(CONFIG_ARCH_IMX) := imx
@@ -135,10 +135,11 @@ endif
135 machine-$(CONFIG_ARCH_DAVINCI) := davinci 135 machine-$(CONFIG_ARCH_DAVINCI) := davinci
136 machine-$(CONFIG_ARCH_KIRKWOOD) := kirkwood 136 machine-$(CONFIG_ARCH_KIRKWOOD) := kirkwood
137 machine-$(CONFIG_ARCH_KS8695) := ks8695 137 machine-$(CONFIG_ARCH_KS8695) := ks8695
138 incdir-$(CONFIG_ARCH_MXC) := mxc 138 plat-$(CONFIG_ARCH_MXC) := mxc
139 machine-$(CONFIG_ARCH_MX2) := mx2 139 machine-$(CONFIG_ARCH_MX2) := mx2
140 machine-$(CONFIG_ARCH_MX3) := mx3 140 machine-$(CONFIG_ARCH_MX3) := mx3
141 machine-$(CONFIG_ARCH_ORION5X) := orion5x 141 machine-$(CONFIG_ARCH_ORION5X) := orion5x
142 plat-$(CONFIG_PLAT_ORION) := orion
142 machine-$(CONFIG_ARCH_MSM7X00A) := msm 143 machine-$(CONFIG_ARCH_MSM7X00A) := msm
143 machine-$(CONFIG_ARCH_LOKI) := loki 144 machine-$(CONFIG_ARCH_LOKI) := loki
144 machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0 145 machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0
@@ -153,17 +154,22 @@ endif
153# The byte offset of the kernel image in RAM from the start of RAM. 154# The byte offset of the kernel image in RAM from the start of RAM.
154TEXT_OFFSET := $(textofs-y) 155TEXT_OFFSET := $(textofs-y)
155 156
156ifeq ($(incdir-y),) 157# The first directory contains additional information for the boot setup code
157incdir-y := $(machine-y)
158endif
159INCDIR := arch-$(incdir-y)
160
161ifneq ($(machine-y),) 158ifneq ($(machine-y),)
162MACHINE := arch/arm/mach-$(machine-y)/ 159MACHINE := arch/arm/mach-$(word 1,$(machine-y))/
163else 160else
164MACHINE := 161MACHINE :=
165endif 162endif
166 163
164machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
165platdirs := $(patsubst %,arch/arm/plat-%/,$(plat-y))
166
167ifeq ($(KBUILD_SRC),)
168KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(machdirs) $(platdirs))
169else
170KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
171endif
172
167export TEXT_OFFSET GZFLAGS MMUEXT 173export TEXT_OFFSET GZFLAGS MMUEXT
168 174
169# Do we have FASTFPE? 175# Do we have FASTFPE?
@@ -174,23 +180,11 @@ endif
174 180
175# If we have a machine-specific directory, then include it in the build. 181# If we have a machine-specific directory, then include it in the build.
176core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ 182core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
177core-y += $(MACHINE) 183core-y += $(machdirs) $(platdirs)
178core-$(CONFIG_ARCH_S3C2410) += arch/arm/mach-s3c2400/
179core-$(CONFIG_ARCH_S3C2410) += arch/arm/mach-s3c2412/
180core-$(CONFIG_ARCH_S3C2410) += arch/arm/mach-s3c2440/
181core-$(CONFIG_ARCH_S3C2410) += arch/arm/mach-s3c2442/
182core-$(CONFIG_ARCH_S3C2410) += arch/arm/mach-s3c2443/
183core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ 184core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/
184core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) 185core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ)
185core-$(CONFIG_VFP) += arch/arm/vfp/ 186core-$(CONFIG_VFP) += arch/arm/vfp/
186 187
187# If we have a common platform directory, then include it in the build.
188core-$(CONFIG_PLAT_IOP) += arch/arm/plat-iop/
189core-$(CONFIG_PLAT_ORION) += arch/arm/plat-orion/
190core-$(CONFIG_ARCH_OMAP) += arch/arm/plat-omap/
191core-$(CONFIG_PLAT_S3C24XX) += arch/arm/plat-s3c24xx/
192core-$(CONFIG_ARCH_MXC) += arch/arm/plat-mxc/
193
194drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ 188drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
195 189
196libs-y := arch/arm/lib/ $(libs-y) 190libs-y := arch/arm/lib/ $(libs-y)
@@ -210,20 +204,10 @@ boot := arch/arm/boot
210# them changed. We use .arch to indicate when they were updated 204# them changed. We use .arch to indicate when they were updated
211# last, otherwise make uses the target directory mtime. 205# last, otherwise make uses the target directory mtime.
212 206
213include/asm-arm/.arch: $(wildcard include/config/arch/*.h) include/config/auto.conf
214 @echo ' SYMLINK include/asm-arm/arch -> include/asm-arm/$(INCDIR)'
215ifneq ($(KBUILD_SRC),)
216 $(Q)mkdir -p include/asm-arm
217 $(Q)ln -fsn $(srctree)/include/asm-arm/$(INCDIR) include/asm-arm/arch
218else
219 $(Q)ln -fsn $(INCDIR) include/asm-arm/arch
220endif
221 @touch $@
222
223archprepare: maketools 207archprepare: maketools
224 208
225PHONY += maketools FORCE 209PHONY += maketools FORCE
226maketools: include/linux/version.h include/asm-arm/.arch FORCE 210maketools: include/linux/version.h FORCE
227 $(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h 211 $(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h
228 212
229# Convert bzImage to zImage 213# Convert bzImage to zImage
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 95baac4939e0..94462a097f86 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -112,6 +112,3 @@ $(obj)/font.c: $(FONTC)
112 112
113$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile .config 113$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile .config
114 @sed "$(SEDFLAGS)" < $< > $@ 114 @sed "$(SEDFLAGS)" < $< > $@
115
116$(obj)/misc.o: $(obj)/misc.c include/asm/arch/uncompress.h lib/inflate.c
117
diff --git a/arch/arm/boot/compressed/head-xscale.S b/arch/arm/boot/compressed/head-xscale.S
index dd3fbd6766e1..aa5ee49c5c5a 100644
--- a/arch/arm/boot/compressed/head-xscale.S
+++ b/arch/arm/boot/compressed/head-xscale.S
@@ -6,7 +6,6 @@
6 */ 6 */
7 7
8#include <linux/linkage.h> 8#include <linux/linkage.h>
9#include <asm/mach-types.h>
10 9
11 .section ".start", "ax" 10 .section ".start", "ax"
12 11
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index de41daeab5e9..d42f89b7760b 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -37,7 +37,7 @@
37 37
38#else 38#else
39 39
40#include <asm/arch/debug-macro.S> 40#include <mach/debug-macro.S>
41 41
42 .macro writeb, ch, rb 42 .macro writeb, ch, rb
43 senduart \ch, \rb 43 senduart \ch, \rb
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 7145cc7c04f0..65ce8fff29db 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -27,7 +27,7 @@ unsigned int __machine_arch_type;
27static void putstr(const char *ptr); 27static void putstr(const char *ptr);
28 28
29#include <linux/compiler.h> 29#include <linux/compiler.h>
30#include <asm/arch/uncompress.h> 30#include <mach/uncompress.h>
31 31
32#ifdef CONFIG_DEBUG_ICEDCC 32#ifdef CONFIG_DEBUG_ICEDCC
33 33
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 85579654d3b7..283051eaf931 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -25,7 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/mach/irq.h> 31#include <asm/mach/irq.h>
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index f6d3fdda7067..ec8a5471bf06 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -26,7 +26,7 @@
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/irq.h> 32#include <asm/irq.h>
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
index 8822b684d474..db8309161408 100644
--- a/arch/arm/common/sharpsl_pm.c
+++ b/arch/arm/common/sharpsl_pm.c
@@ -26,13 +26,12 @@
26#include <linux/apm-emulation.h> 26#include <linux/apm-emulation.h>
27#include <linux/suspend.h> 27#include <linux/suspend.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/mach-types.h>
31#include <asm/irq.h> 30#include <asm/irq.h>
32#include <asm/arch/pm.h> 31#include <mach/pm.h>
33#include <asm/arch/pxa-regs.h> 32#include <mach/pxa-regs.h>
34#include <asm/arch/pxa2xx-regs.h> 33#include <mach/pxa2xx-regs.h>
35#include <asm/arch/sharpsl.h> 34#include <mach/sharpsl.h>
36#include <asm/hardware/sharpsl_pm.h> 35#include <asm/hardware/sharpsl_pm.h>
37 36
38/* 37/*
diff --git a/arch/arm/common/time-acorn.c b/arch/arm/common/time-acorn.c
index d544da414731..df0983aafe69 100644
--- a/arch/arm/common/time-acorn.c
+++ b/arch/arm/common/time-acorn.c
@@ -18,7 +18,7 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20 20
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/hardware/ioc.h> 23#include <asm/hardware/ioc.h>
24 24
diff --git a/arch/arm/common/uengine.c b/arch/arm/common/uengine.c
index 117cab30bd36..7ecd3c0ab011 100644
--- a/arch/arm/common/uengine.c
+++ b/arch/arm/common/uengine.c
@@ -16,8 +16,7 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/string.h> 18#include <linux/string.h>
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20#include <asm/arch/hardware.h>
21#include <asm/hardware/uengine.h> 20#include <asm/hardware/uengine.h>
22#include <asm/io.h> 21#include <asm/io.h>
23 22
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
new file mode 100644
index 000000000000..73237bd130a2
--- /dev/null
+++ b/arch/arm/include/asm/Kbuild
@@ -0,0 +1,3 @@
1include include/asm-generic/Kbuild.asm
2
3unifdef-y += hwcap.h
diff --git a/arch/arm/include/asm/a.out-core.h b/arch/arm/include/asm/a.out-core.h
new file mode 100644
index 000000000000..93d04acaa31f
--- /dev/null
+++ b/arch/arm/include/asm/a.out-core.h
@@ -0,0 +1,49 @@
1/* a.out coredump register dumper
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_A_OUT_CORE_H
13#define _ASM_A_OUT_CORE_H
14
15#ifdef __KERNEL__
16
17#include <linux/user.h>
18#include <linux/elfcore.h>
19
20/*
21 * fill in the user structure for an a.out core dump
22 */
23static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
24{
25 struct task_struct *tsk = current;
26
27 dump->magic = CMAGIC;
28 dump->start_code = tsk->mm->start_code;
29 dump->start_stack = regs->ARM_sp & ~(PAGE_SIZE - 1);
30
31 dump->u_tsize = (tsk->mm->end_code - tsk->mm->start_code) >> PAGE_SHIFT;
32 dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> PAGE_SHIFT;
33 dump->u_ssize = 0;
34
35 dump->u_debugreg[0] = tsk->thread.debug.bp[0].address;
36 dump->u_debugreg[1] = tsk->thread.debug.bp[1].address;
37 dump->u_debugreg[2] = tsk->thread.debug.bp[0].insn.arm;
38 dump->u_debugreg[3] = tsk->thread.debug.bp[1].insn.arm;
39 dump->u_debugreg[4] = tsk->thread.debug.nsaved;
40
41 if (dump->start_stack < 0x04000000)
42 dump->u_ssize = (0x04000000 - dump->start_stack) >> PAGE_SHIFT;
43
44 dump->regs = *regs;
45 dump->u_fpvalid = dump_fpu (regs, &dump->u_fp);
46}
47
48#endif /* __KERNEL__ */
49#endif /* _ASM_A_OUT_CORE_H */
diff --git a/arch/arm/include/asm/a.out.h b/arch/arm/include/asm/a.out.h
new file mode 100644
index 000000000000..79489fdcc8b8
--- /dev/null
+++ b/arch/arm/include/asm/a.out.h
@@ -0,0 +1,34 @@
1#ifndef __ARM_A_OUT_H__
2#define __ARM_A_OUT_H__
3
4#include <linux/personality.h>
5#include <asm/types.h>
6
7struct exec
8{
9 __u32 a_info; /* Use macros N_MAGIC, etc for access */
10 __u32 a_text; /* length of text, in bytes */
11 __u32 a_data; /* length of data, in bytes */
12 __u32 a_bss; /* length of uninitialized data area for file, in bytes */
13 __u32 a_syms; /* length of symbol table data in file, in bytes */
14 __u32 a_entry; /* start address */
15 __u32 a_trsize; /* length of relocation info for text, in bytes */
16 __u32 a_drsize; /* length of relocation info for data, in bytes */
17};
18
19/*
20 * This is always the same
21 */
22#define N_TXTADDR(a) (0x00008000)
23
24#define N_TRSIZE(a) ((a).a_trsize)
25#define N_DRSIZE(a) ((a).a_drsize)
26#define N_SYMSIZE(a) ((a).a_syms)
27
28#define M_ARM 103
29
30#ifndef LIBRARY_START_TEXT
31#define LIBRARY_START_TEXT (0x00c00000)
32#endif
33
34#endif /* __A_OUT_GNU_H__ */
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
new file mode 100644
index 000000000000..6116e4893c0a
--- /dev/null
+++ b/arch/arm/include/asm/assembler.h
@@ -0,0 +1,116 @@
1/*
2 * arch/arm/include/asm/assembler.h
3 *
4 * Copyright (C) 1996-2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This file contains arm architecture specific defines
11 * for the different processors.
12 *
13 * Do not include any C declarations in this file - it is included by
14 * assembler source.
15 */
16#ifndef __ASSEMBLY__
17#error "Only include this from assembly code"
18#endif
19
20#include <asm/ptrace.h>
21
22/*
23 * Endian independent macros for shifting bytes within registers.
24 */
25#ifndef __ARMEB__
26#define pull lsr
27#define push lsl
28#define get_byte_0 lsl #0
29#define get_byte_1 lsr #8
30#define get_byte_2 lsr #16
31#define get_byte_3 lsr #24
32#define put_byte_0 lsl #0
33#define put_byte_1 lsl #8
34#define put_byte_2 lsl #16
35#define put_byte_3 lsl #24
36#else
37#define pull lsl
38#define push lsr
39#define get_byte_0 lsr #24
40#define get_byte_1 lsr #16
41#define get_byte_2 lsr #8
42#define get_byte_3 lsl #0
43#define put_byte_0 lsl #24
44#define put_byte_1 lsl #16
45#define put_byte_2 lsl #8
46#define put_byte_3 lsl #0
47#endif
48
49/*
50 * Data preload for architectures that support it
51 */
52#if __LINUX_ARM_ARCH__ >= 5
53#define PLD(code...) code
54#else
55#define PLD(code...)
56#endif
57
58/*
59 * This can be used to enable code to cacheline align the destination
60 * pointer when bulk writing to memory. Experiments on StrongARM and
61 * XScale didn't show this a worthwhile thing to do when the cache is not
62 * set to write-allocate (this would need further testing on XScale when WA
63 * is used).
64 *
65 * On Feroceon there is much to gain however, regardless of cache mode.
66 */
67#ifdef CONFIG_CPU_FEROCEON
68#define CALGN(code...) code
69#else
70#define CALGN(code...)
71#endif
72
73/*
74 * Enable and disable interrupts
75 */
76#if __LINUX_ARM_ARCH__ >= 6
77 .macro disable_irq
78 cpsid i
79 .endm
80
81 .macro enable_irq
82 cpsie i
83 .endm
84#else
85 .macro disable_irq
86 msr cpsr_c, #PSR_I_BIT | SVC_MODE
87 .endm
88
89 .macro enable_irq
90 msr cpsr_c, #SVC_MODE
91 .endm
92#endif
93
94/*
95 * Save the current IRQ state and disable IRQs. Note that this macro
96 * assumes FIQs are enabled, and that the processor is in SVC mode.
97 */
98 .macro save_and_disable_irqs, oldcpsr
99 mrs \oldcpsr, cpsr
100 disable_irq
101 .endm
102
103/*
104 * Restore interrupt state previously stored in a register. We don't
105 * guarantee that this will preserve the flags.
106 */
107 .macro restore_irqs, oldcpsr
108 msr cpsr_c, \oldcpsr
109 .endm
110
111#define USER(x...) \
1129999: x; \
113 .section __ex_table,"a"; \
114 .align 3; \
115 .long 9999b,9001f; \
116 .previous
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
new file mode 100644
index 000000000000..325f881ccb50
--- /dev/null
+++ b/arch/arm/include/asm/atomic.h
@@ -0,0 +1,212 @@
1/*
2 * arch/arm/include/asm/atomic.h
3 *
4 * Copyright (C) 1996 Russell King.
5 * Copyright (C) 2002 Deep Blue Solutions Ltd.
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#ifndef __ASM_ARM_ATOMIC_H
12#define __ASM_ARM_ATOMIC_H
13
14#include <linux/compiler.h>
15#include <asm/system.h>
16
17typedef struct { volatile int counter; } atomic_t;
18
19#define ATOMIC_INIT(i) { (i) }
20
21#ifdef __KERNEL__
22
23#define atomic_read(v) ((v)->counter)
24
25#if __LINUX_ARM_ARCH__ >= 6
26
27/*
28 * ARMv6 UP and SMP safe atomic ops. We use load exclusive and
29 * store exclusive to ensure that these are atomic. We may loop
30 * to ensure that the update happens. Writing to 'v->counter'
31 * without using the following operations WILL break the atomic
32 * nature of these ops.
33 */
34static inline void atomic_set(atomic_t *v, int i)
35{
36 unsigned long tmp;
37
38 __asm__ __volatile__("@ atomic_set\n"
39"1: ldrex %0, [%1]\n"
40" strex %0, %2, [%1]\n"
41" teq %0, #0\n"
42" bne 1b"
43 : "=&r" (tmp)
44 : "r" (&v->counter), "r" (i)
45 : "cc");
46}
47
48static inline int atomic_add_return(int i, atomic_t *v)
49{
50 unsigned long tmp;
51 int result;
52
53 __asm__ __volatile__("@ atomic_add_return\n"
54"1: ldrex %0, [%2]\n"
55" add %0, %0, %3\n"
56" strex %1, %0, [%2]\n"
57" teq %1, #0\n"
58" bne 1b"
59 : "=&r" (result), "=&r" (tmp)
60 : "r" (&v->counter), "Ir" (i)
61 : "cc");
62
63 return result;
64}
65
66static inline int atomic_sub_return(int i, atomic_t *v)
67{
68 unsigned long tmp;
69 int result;
70
71 __asm__ __volatile__("@ atomic_sub_return\n"
72"1: ldrex %0, [%2]\n"
73" sub %0, %0, %3\n"
74" strex %1, %0, [%2]\n"
75" teq %1, #0\n"
76" bne 1b"
77 : "=&r" (result), "=&r" (tmp)
78 : "r" (&v->counter), "Ir" (i)
79 : "cc");
80
81 return result;
82}
83
84static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
85{
86 unsigned long oldval, res;
87
88 do {
89 __asm__ __volatile__("@ atomic_cmpxchg\n"
90 "ldrex %1, [%2]\n"
91 "mov %0, #0\n"
92 "teq %1, %3\n"
93 "strexeq %0, %4, [%2]\n"
94 : "=&r" (res), "=&r" (oldval)
95 : "r" (&ptr->counter), "Ir" (old), "r" (new)
96 : "cc");
97 } while (res);
98
99 return oldval;
100}
101
102static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
103{
104 unsigned long tmp, tmp2;
105
106 __asm__ __volatile__("@ atomic_clear_mask\n"
107"1: ldrex %0, [%2]\n"
108" bic %0, %0, %3\n"
109" strex %1, %0, [%2]\n"
110" teq %1, #0\n"
111" bne 1b"
112 : "=&r" (tmp), "=&r" (tmp2)
113 : "r" (addr), "Ir" (mask)
114 : "cc");
115}
116
117#else /* ARM_ARCH_6 */
118
119#include <asm/system.h>
120
121#ifdef CONFIG_SMP
122#error SMP not supported on pre-ARMv6 CPUs
123#endif
124
125#define atomic_set(v,i) (((v)->counter) = (i))
126
127static inline int atomic_add_return(int i, atomic_t *v)
128{
129 unsigned long flags;
130 int val;
131
132 raw_local_irq_save(flags);
133 val = v->counter;
134 v->counter = val += i;
135 raw_local_irq_restore(flags);
136
137 return val;
138}
139
140static inline int atomic_sub_return(int i, atomic_t *v)
141{
142 unsigned long flags;
143 int val;
144
145 raw_local_irq_save(flags);
146 val = v->counter;
147 v->counter = val -= i;
148 raw_local_irq_restore(flags);
149
150 return val;
151}
152
153static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
154{
155 int ret;
156 unsigned long flags;
157
158 raw_local_irq_save(flags);
159 ret = v->counter;
160 if (likely(ret == old))
161 v->counter = new;
162 raw_local_irq_restore(flags);
163
164 return ret;
165}
166
167static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
168{
169 unsigned long flags;
170
171 raw_local_irq_save(flags);
172 *addr &= ~mask;
173 raw_local_irq_restore(flags);
174}
175
176#endif /* __LINUX_ARM_ARCH__ */
177
178#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
179
180static inline int atomic_add_unless(atomic_t *v, int a, int u)
181{
182 int c, old;
183
184 c = atomic_read(v);
185 while (c != u && (old = atomic_cmpxchg((v), c, c + a)) != c)
186 c = old;
187 return c != u;
188}
189#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
190
191#define atomic_add(i, v) (void) atomic_add_return(i, v)
192#define atomic_inc(v) (void) atomic_add_return(1, v)
193#define atomic_sub(i, v) (void) atomic_sub_return(i, v)
194#define atomic_dec(v) (void) atomic_sub_return(1, v)
195
196#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0)
197#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0)
198#define atomic_inc_return(v) (atomic_add_return(1, v))
199#define atomic_dec_return(v) (atomic_sub_return(1, v))
200#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
201
202#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
203
204/* Atomic operations are already serializing on ARM */
205#define smp_mb__before_atomic_dec() barrier()
206#define smp_mb__after_atomic_dec() barrier()
207#define smp_mb__before_atomic_inc() barrier()
208#define smp_mb__after_atomic_inc() barrier()
209
210#include <asm-generic/atomic.h>
211#endif
212#endif
diff --git a/arch/arm/include/asm/auxvec.h b/arch/arm/include/asm/auxvec.h
new file mode 100644
index 000000000000..c0536f6b29a7
--- /dev/null
+++ b/arch/arm/include/asm/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMARM_AUXVEC_H
2#define __ASMARM_AUXVEC_H
3
4#endif
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
new file mode 100644
index 000000000000..9a1db20e032a
--- /dev/null
+++ b/arch/arm/include/asm/bitops.h
@@ -0,0 +1,340 @@
1/*
2 * Copyright 1995, Russell King.
3 * Various bits and pieces copyrights include:
4 * Linus Torvalds (test_bit).
5 * Big endian support: Copyright 2001, Nicolas Pitre
6 * reworked by rmk.
7 *
8 * bit 0 is the LSB of an "unsigned long" quantity.
9 *
10 * Please note that the code in this file should never be included
11 * from user space. Many of these are not implemented in assembler
12 * since they would be too costly. Also, they require privileged
13 * instructions (which are not available from user mode) to ensure
14 * that they are atomic.
15 */
16
17#ifndef __ASM_ARM_BITOPS_H
18#define __ASM_ARM_BITOPS_H
19
20#ifdef __KERNEL__
21
22#ifndef _LINUX_BITOPS_H
23#error only <linux/bitops.h> can be included directly
24#endif
25
26#include <linux/compiler.h>
27#include <asm/system.h>
28
29#define smp_mb__before_clear_bit() mb()
30#define smp_mb__after_clear_bit() mb()
31
32/*
33 * These functions are the basis of our bit ops.
34 *
35 * First, the atomic bitops. These use native endian.
36 */
37static inline void ____atomic_set_bit(unsigned int bit, volatile unsigned long *p)
38{
39 unsigned long flags;
40 unsigned long mask = 1UL << (bit & 31);
41
42 p += bit >> 5;
43
44 raw_local_irq_save(flags);
45 *p |= mask;
46 raw_local_irq_restore(flags);
47}
48
49static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long *p)
50{
51 unsigned long flags;
52 unsigned long mask = 1UL << (bit & 31);
53
54 p += bit >> 5;
55
56 raw_local_irq_save(flags);
57 *p &= ~mask;
58 raw_local_irq_restore(flags);
59}
60
61static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned long *p)
62{
63 unsigned long flags;
64 unsigned long mask = 1UL << (bit & 31);
65
66 p += bit >> 5;
67
68 raw_local_irq_save(flags);
69 *p ^= mask;
70 raw_local_irq_restore(flags);
71}
72
73static inline int
74____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p)
75{
76 unsigned long flags;
77 unsigned int res;
78 unsigned long mask = 1UL << (bit & 31);
79
80 p += bit >> 5;
81
82 raw_local_irq_save(flags);
83 res = *p;
84 *p = res | mask;
85 raw_local_irq_restore(flags);
86
87 return res & mask;
88}
89
90static inline int
91____atomic_test_and_clear_bit(unsigned int bit, volatile unsigned long *p)
92{
93 unsigned long flags;
94 unsigned int res;
95 unsigned long mask = 1UL << (bit & 31);
96
97 p += bit >> 5;
98
99 raw_local_irq_save(flags);
100 res = *p;
101 *p = res & ~mask;
102 raw_local_irq_restore(flags);
103
104 return res & mask;
105}
106
107static inline int
108____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
109{
110 unsigned long flags;
111 unsigned int res;
112 unsigned long mask = 1UL << (bit & 31);
113
114 p += bit >> 5;
115
116 raw_local_irq_save(flags);
117 res = *p;
118 *p = res ^ mask;
119 raw_local_irq_restore(flags);
120
121 return res & mask;
122}
123
124#include <asm-generic/bitops/non-atomic.h>
125
126/*
127 * A note about Endian-ness.
128 * -------------------------
129 *
130 * When the ARM is put into big endian mode via CR15, the processor
131 * merely swaps the order of bytes within words, thus:
132 *
133 * ------------ physical data bus bits -----------
134 * D31 ... D24 D23 ... D16 D15 ... D8 D7 ... D0
135 * little byte 3 byte 2 byte 1 byte 0
136 * big byte 0 byte 1 byte 2 byte 3
137 *
138 * This means that reading a 32-bit word at address 0 returns the same
139 * value irrespective of the endian mode bit.
140 *
141 * Peripheral devices should be connected with the data bus reversed in
142 * "Big Endian" mode. ARM Application Note 61 is applicable, and is
143 * available from http://www.arm.com/.
144 *
145 * The following assumes that the data bus connectivity for big endian
146 * mode has been followed.
147 *
148 * Note that bit 0 is defined to be 32-bit word bit 0, not byte 0 bit 0.
149 */
150
151/*
152 * Little endian assembly bitops. nr = 0 -> byte 0 bit 0.
153 */
154extern void _set_bit_le(int nr, volatile unsigned long * p);
155extern void _clear_bit_le(int nr, volatile unsigned long * p);
156extern void _change_bit_le(int nr, volatile unsigned long * p);
157extern int _test_and_set_bit_le(int nr, volatile unsigned long * p);
158extern int _test_and_clear_bit_le(int nr, volatile unsigned long * p);
159extern int _test_and_change_bit_le(int nr, volatile unsigned long * p);
160extern int _find_first_zero_bit_le(const void * p, unsigned size);
161extern int _find_next_zero_bit_le(const void * p, int size, int offset);
162extern int _find_first_bit_le(const unsigned long *p, unsigned size);
163extern int _find_next_bit_le(const unsigned long *p, int size, int offset);
164
165/*
166 * Big endian assembly bitops. nr = 0 -> byte 3 bit 0.
167 */
168extern void _set_bit_be(int nr, volatile unsigned long * p);
169extern void _clear_bit_be(int nr, volatile unsigned long * p);
170extern void _change_bit_be(int nr, volatile unsigned long * p);
171extern int _test_and_set_bit_be(int nr, volatile unsigned long * p);
172extern int _test_and_clear_bit_be(int nr, volatile unsigned long * p);
173extern int _test_and_change_bit_be(int nr, volatile unsigned long * p);
174extern int _find_first_zero_bit_be(const void * p, unsigned size);
175extern int _find_next_zero_bit_be(const void * p, int size, int offset);
176extern int _find_first_bit_be(const unsigned long *p, unsigned size);
177extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
178
179#ifndef CONFIG_SMP
180/*
181 * The __* form of bitops are non-atomic and may be reordered.
182 */
183#define ATOMIC_BITOP_LE(name,nr,p) \
184 (__builtin_constant_p(nr) ? \
185 ____atomic_##name(nr, p) : \
186 _##name##_le(nr,p))
187
188#define ATOMIC_BITOP_BE(name,nr,p) \
189 (__builtin_constant_p(nr) ? \
190 ____atomic_##name(nr, p) : \
191 _##name##_be(nr,p))
192#else
193#define ATOMIC_BITOP_LE(name,nr,p) _##name##_le(nr,p)
194#define ATOMIC_BITOP_BE(name,nr,p) _##name##_be(nr,p)
195#endif
196
197#define NONATOMIC_BITOP(name,nr,p) \
198 (____nonatomic_##name(nr, p))
199
200#ifndef __ARMEB__
201/*
202 * These are the little endian, atomic definitions.
203 */
204#define set_bit(nr,p) ATOMIC_BITOP_LE(set_bit,nr,p)
205#define clear_bit(nr,p) ATOMIC_BITOP_LE(clear_bit,nr,p)
206#define change_bit(nr,p) ATOMIC_BITOP_LE(change_bit,nr,p)
207#define test_and_set_bit(nr,p) ATOMIC_BITOP_LE(test_and_set_bit,nr,p)
208#define test_and_clear_bit(nr,p) ATOMIC_BITOP_LE(test_and_clear_bit,nr,p)
209#define test_and_change_bit(nr,p) ATOMIC_BITOP_LE(test_and_change_bit,nr,p)
210#define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz)
211#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off)
212#define find_first_bit(p,sz) _find_first_bit_le(p,sz)
213#define find_next_bit(p,sz,off) _find_next_bit_le(p,sz,off)
214
215#define WORD_BITOFF_TO_LE(x) ((x))
216
217#else
218
219/*
220 * These are the big endian, atomic definitions.
221 */
222#define set_bit(nr,p) ATOMIC_BITOP_BE(set_bit,nr,p)
223#define clear_bit(nr,p) ATOMIC_BITOP_BE(clear_bit,nr,p)
224#define change_bit(nr,p) ATOMIC_BITOP_BE(change_bit,nr,p)
225#define test_and_set_bit(nr,p) ATOMIC_BITOP_BE(test_and_set_bit,nr,p)
226#define test_and_clear_bit(nr,p) ATOMIC_BITOP_BE(test_and_clear_bit,nr,p)
227#define test_and_change_bit(nr,p) ATOMIC_BITOP_BE(test_and_change_bit,nr,p)
228#define find_first_zero_bit(p,sz) _find_first_zero_bit_be(p,sz)
229#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_be(p,sz,off)
230#define find_first_bit(p,sz) _find_first_bit_be(p,sz)
231#define find_next_bit(p,sz,off) _find_next_bit_be(p,sz,off)
232
233#define WORD_BITOFF_TO_LE(x) ((x) ^ 0x18)
234
235#endif
236
237#if __LINUX_ARM_ARCH__ < 5
238
239#include <asm-generic/bitops/ffz.h>
240#include <asm-generic/bitops/__ffs.h>
241#include <asm-generic/bitops/fls.h>
242#include <asm-generic/bitops/ffs.h>
243
244#else
245
246static inline int constant_fls(int x)
247{
248 int r = 32;
249
250 if (!x)
251 return 0;
252 if (!(x & 0xffff0000u)) {
253 x <<= 16;
254 r -= 16;
255 }
256 if (!(x & 0xff000000u)) {
257 x <<= 8;
258 r -= 8;
259 }
260 if (!(x & 0xf0000000u)) {
261 x <<= 4;
262 r -= 4;
263 }
264 if (!(x & 0xc0000000u)) {
265 x <<= 2;
266 r -= 2;
267 }
268 if (!(x & 0x80000000u)) {
269 x <<= 1;
270 r -= 1;
271 }
272 return r;
273}
274
275/*
276 * On ARMv5 and above those functions can be implemented around
277 * the clz instruction for much better code efficiency.
278 */
279
280#define __fls(x) \
281 ( __builtin_constant_p(x) ? constant_fls(x) : \
282 ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) )
283
284/* Implement fls() in C so that 64-bit args are suitably truncated */
285static inline int fls(int x)
286{
287 return __fls(x);
288}
289
290#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
291#define __ffs(x) (ffs(x) - 1)
292#define ffz(x) __ffs( ~(x) )
293
294#endif
295
296#include <asm-generic/bitops/fls64.h>
297
298#include <asm-generic/bitops/sched.h>
299#include <asm-generic/bitops/hweight.h>
300#include <asm-generic/bitops/lock.h>
301
302/*
303 * Ext2 is defined to use little-endian byte ordering.
304 * These do not need to be atomic.
305 */
306#define ext2_set_bit(nr,p) \
307 __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
308#define ext2_set_bit_atomic(lock,nr,p) \
309 test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
310#define ext2_clear_bit(nr,p) \
311 __test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
312#define ext2_clear_bit_atomic(lock,nr,p) \
313 test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
314#define ext2_test_bit(nr,p) \
315 test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
316#define ext2_find_first_zero_bit(p,sz) \
317 _find_first_zero_bit_le(p,sz)
318#define ext2_find_next_zero_bit(p,sz,off) \
319 _find_next_zero_bit_le(p,sz,off)
320#define ext2_find_next_bit(p, sz, off) \
321 _find_next_bit_le(p, sz, off)
322
323/*
324 * Minix is defined to use little-endian byte ordering.
325 * These do not need to be atomic.
326 */
327#define minix_set_bit(nr,p) \
328 __set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
329#define minix_test_bit(nr,p) \
330 test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
331#define minix_test_and_set_bit(nr,p) \
332 __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
333#define minix_test_and_clear_bit(nr,p) \
334 __test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
335#define minix_find_first_zero_bit(p,sz) \
336 _find_first_zero_bit_le(p,sz)
337
338#endif /* __KERNEL__ */
339
340#endif /* _ARM_BITOPS_H */
diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
new file mode 100644
index 000000000000..7b62351f097d
--- /dev/null
+++ b/arch/arm/include/asm/bug.h
@@ -0,0 +1,24 @@
1#ifndef _ASMARM_BUG_H
2#define _ASMARM_BUG_H
3
4
5#ifdef CONFIG_BUG
6#ifdef CONFIG_DEBUG_BUGVERBOSE
7extern void __bug(const char *file, int line) __attribute__((noreturn));
8
9/* give file/line information */
10#define BUG() __bug(__FILE__, __LINE__)
11
12#else
13
14/* this just causes an oops */
15#define BUG() (*(int *)0 = 0)
16
17#endif
18
19#define HAVE_ARCH_BUG
20#endif
21
22#include <asm-generic/bug.h>
23
24#endif
diff --git a/arch/arm/include/asm/bugs.h b/arch/arm/include/asm/bugs.h
new file mode 100644
index 000000000000..a97f1ea708d1
--- /dev/null
+++ b/arch/arm/include/asm/bugs.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/include/asm/bugs.h
3 *
4 * Copyright (C) 1995-2003 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_BUGS_H
11#define __ASM_BUGS_H
12
13#ifdef CONFIG_MMU
14extern void check_writebuffer_bugs(void);
15
16#define check_bugs() check_writebuffer_bugs()
17#else
18#define check_bugs() do { } while (0)
19#endif
20
21#endif
diff --git a/arch/arm/include/asm/byteorder.h b/arch/arm/include/asm/byteorder.h
new file mode 100644
index 000000000000..4fbfb22f65a0
--- /dev/null
+++ b/arch/arm/include/asm/byteorder.h
@@ -0,0 +1,58 @@
1/*
2 * arch/arm/include/asm/byteorder.h
3 *
4 * ARM Endian-ness. In little endian mode, the data bus is connected such
5 * that byte accesses appear as:
6 * 0 = d0...d7, 1 = d8...d15, 2 = d16...d23, 3 = d24...d31
7 * and word accesses (data or instruction) appear as:
8 * d0...d31
9 *
10 * When in big endian mode, byte accesses appear as:
11 * 0 = d24...d31, 1 = d16...d23, 2 = d8...d15, 3 = d0...d7
12 * and word accesses (data or instruction) appear as:
13 * d0...d31
14 */
15#ifndef __ASM_ARM_BYTEORDER_H
16#define __ASM_ARM_BYTEORDER_H
17
18#include <linux/compiler.h>
19#include <asm/types.h>
20
21static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
22{
23 __u32 t;
24
25#ifndef __thumb__
26 if (!__builtin_constant_p(x)) {
27 /*
28 * The compiler needs a bit of a hint here to always do the
29 * right thing and not screw it up to different degrees
30 * depending on the gcc version.
31 */
32 asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x));
33 } else
34#endif
35 t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */
36
37 x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */
38 t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */
39 x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */
40
41 return x;
42}
43
44#define __arch__swab32(x) ___arch__swab32(x)
45
46#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
47# define __BYTEORDER_HAS_U64__
48# define __SWAB_64_THRU_32__
49#endif
50
51#ifdef __ARMEB__
52#include <linux/byteorder/big_endian.h>
53#else
54#include <linux/byteorder/little_endian.h>
55#endif
56
57#endif
58
diff --git a/arch/arm/include/asm/cache.h b/arch/arm/include/asm/cache.h
new file mode 100644
index 000000000000..cb7a9e97fd7e
--- /dev/null
+++ b/arch/arm/include/asm/cache.h
@@ -0,0 +1,10 @@
1/*
2 * arch/arm/include/asm/cache.h
3 */
4#ifndef __ASMARM_CACHE_H
5#define __ASMARM_CACHE_H
6
7#define L1_CACHE_SHIFT 5
8#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
9
10#endif
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
new file mode 100644
index 000000000000..9073d9c6567e
--- /dev/null
+++ b/arch/arm/include/asm/cacheflush.h
@@ -0,0 +1,537 @@
1/*
2 * arch/arm/include/asm/cacheflush.h
3 *
4 * Copyright (C) 1999-2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _ASMARM_CACHEFLUSH_H
11#define _ASMARM_CACHEFLUSH_H
12
13#include <linux/sched.h>
14#include <linux/mm.h>
15
16#include <asm/glue.h>
17#include <asm/shmparam.h>
18
19#define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT)
20
21/*
22 * Cache Model
23 * ===========
24 */
25#undef _CACHE
26#undef MULTI_CACHE
27
28#if defined(CONFIG_CPU_CACHE_V3)
29# ifdef _CACHE
30# define MULTI_CACHE 1
31# else
32# define _CACHE v3
33# endif
34#endif
35
36#if defined(CONFIG_CPU_CACHE_V4)
37# ifdef _CACHE
38# define MULTI_CACHE 1
39# else
40# define _CACHE v4
41# endif
42#endif
43
44#if defined(CONFIG_CPU_ARM920T) || defined(CONFIG_CPU_ARM922T) || \
45 defined(CONFIG_CPU_ARM925T) || defined(CONFIG_CPU_ARM1020)
46# define MULTI_CACHE 1
47#endif
48
49#if defined(CONFIG_CPU_ARM926T)
50# ifdef _CACHE
51# define MULTI_CACHE 1
52# else
53# define _CACHE arm926
54# endif
55#endif
56
57#if defined(CONFIG_CPU_ARM940T)
58# ifdef _CACHE
59# define MULTI_CACHE 1
60# else
61# define _CACHE arm940
62# endif
63#endif
64
65#if defined(CONFIG_CPU_ARM946E)
66# ifdef _CACHE
67# define MULTI_CACHE 1
68# else
69# define _CACHE arm946
70# endif
71#endif
72
73#if defined(CONFIG_CPU_CACHE_V4WB)
74# ifdef _CACHE
75# define MULTI_CACHE 1
76# else
77# define _CACHE v4wb
78# endif
79#endif
80
81#if defined(CONFIG_CPU_XSCALE)
82# ifdef _CACHE
83# define MULTI_CACHE 1
84# else
85# define _CACHE xscale
86# endif
87#endif
88
89#if defined(CONFIG_CPU_XSC3)
90# ifdef _CACHE
91# define MULTI_CACHE 1
92# else
93# define _CACHE xsc3
94# endif
95#endif
96
97#if defined(CONFIG_CPU_FEROCEON)
98# define MULTI_CACHE 1
99#endif
100
101#if defined(CONFIG_CPU_V6)
102//# ifdef _CACHE
103# define MULTI_CACHE 1
104//# else
105//# define _CACHE v6
106//# endif
107#endif
108
109#if defined(CONFIG_CPU_V7)
110//# ifdef _CACHE
111# define MULTI_CACHE 1
112//# else
113//# define _CACHE v7
114//# endif
115#endif
116
117#if !defined(_CACHE) && !defined(MULTI_CACHE)
118#error Unknown cache maintainence model
119#endif
120
121/*
122 * This flag is used to indicate that the page pointed to by a pte
123 * is dirty and requires cleaning before returning it to the user.
124 */
125#define PG_dcache_dirty PG_arch_1
126
127/*
128 * MM Cache Management
129 * ===================
130 *
131 * The arch/arm/mm/cache-*.S and arch/arm/mm/proc-*.S files
132 * implement these methods.
133 *
134 * Start addresses are inclusive and end addresses are exclusive;
135 * start addresses should be rounded down, end addresses up.
136 *
137 * See Documentation/cachetlb.txt for more information.
138 * Please note that the implementation of these, and the required
139 * effects are cache-type (VIVT/VIPT/PIPT) specific.
140 *
141 * flush_cache_kern_all()
142 *
143 * Unconditionally clean and invalidate the entire cache.
144 *
145 * flush_cache_user_mm(mm)
146 *
147 * Clean and invalidate all user space cache entries
148 * before a change of page tables.
149 *
150 * flush_cache_user_range(start, end, flags)
151 *
152 * Clean and invalidate a range of cache entries in the
153 * specified address space before a change of page tables.
154 * - start - user start address (inclusive, page aligned)
155 * - end - user end address (exclusive, page aligned)
156 * - flags - vma->vm_flags field
157 *
158 * coherent_kern_range(start, end)
159 *
160 * Ensure coherency between the Icache and the Dcache in the
161 * region described by start, end. If you have non-snooping
162 * Harvard caches, you need to implement this function.
163 * - start - virtual start address
164 * - end - virtual end address
165 *
166 * DMA Cache Coherency
167 * ===================
168 *
169 * dma_inv_range(start, end)
170 *
171 * Invalidate (discard) the specified virtual address range.
172 * May not write back any entries. If 'start' or 'end'
173 * are not cache line aligned, those lines must be written
174 * back.
175 * - start - virtual start address
176 * - end - virtual end address
177 *
178 * dma_clean_range(start, end)
179 *
180 * Clean (write back) the specified virtual address range.
181 * - start - virtual start address
182 * - end - virtual end address
183 *
184 * dma_flush_range(start, end)
185 *
186 * Clean and invalidate the specified virtual address range.
187 * - start - virtual start address
188 * - end - virtual end address
189 */
190
191struct cpu_cache_fns {
192 void (*flush_kern_all)(void);
193 void (*flush_user_all)(void);
194 void (*flush_user_range)(unsigned long, unsigned long, unsigned int);
195
196 void (*coherent_kern_range)(unsigned long, unsigned long);
197 void (*coherent_user_range)(unsigned long, unsigned long);
198 void (*flush_kern_dcache_page)(void *);
199
200 void (*dma_inv_range)(const void *, const void *);
201 void (*dma_clean_range)(const void *, const void *);
202 void (*dma_flush_range)(const void *, const void *);
203};
204
205struct outer_cache_fns {
206 void (*inv_range)(unsigned long, unsigned long);
207 void (*clean_range)(unsigned long, unsigned long);
208 void (*flush_range)(unsigned long, unsigned long);
209};
210
211/*
212 * Select the calling method
213 */
214#ifdef MULTI_CACHE
215
216extern struct cpu_cache_fns cpu_cache;
217
218#define __cpuc_flush_kern_all cpu_cache.flush_kern_all
219#define __cpuc_flush_user_all cpu_cache.flush_user_all
220#define __cpuc_flush_user_range cpu_cache.flush_user_range
221#define __cpuc_coherent_kern_range cpu_cache.coherent_kern_range
222#define __cpuc_coherent_user_range cpu_cache.coherent_user_range
223#define __cpuc_flush_dcache_page cpu_cache.flush_kern_dcache_page
224
225/*
226 * These are private to the dma-mapping API. Do not use directly.
227 * Their sole purpose is to ensure that data held in the cache
228 * is visible to DMA, or data written by DMA to system memory is
229 * visible to the CPU.
230 */
231#define dmac_inv_range cpu_cache.dma_inv_range
232#define dmac_clean_range cpu_cache.dma_clean_range
233#define dmac_flush_range cpu_cache.dma_flush_range
234
235#else
236
237#define __cpuc_flush_kern_all __glue(_CACHE,_flush_kern_cache_all)
238#define __cpuc_flush_user_all __glue(_CACHE,_flush_user_cache_all)
239#define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range)
240#define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range)
241#define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
242#define __cpuc_flush_dcache_page __glue(_CACHE,_flush_kern_dcache_page)
243
244extern void __cpuc_flush_kern_all(void);
245extern void __cpuc_flush_user_all(void);
246extern void __cpuc_flush_user_range(unsigned long, unsigned long, unsigned int);
247extern void __cpuc_coherent_kern_range(unsigned long, unsigned long);
248extern void __cpuc_coherent_user_range(unsigned long, unsigned long);
249extern void __cpuc_flush_dcache_page(void *);
250
251/*
252 * These are private to the dma-mapping API. Do not use directly.
253 * Their sole purpose is to ensure that data held in the cache
254 * is visible to DMA, or data written by DMA to system memory is
255 * visible to the CPU.
256 */
257#define dmac_inv_range __glue(_CACHE,_dma_inv_range)
258#define dmac_clean_range __glue(_CACHE,_dma_clean_range)
259#define dmac_flush_range __glue(_CACHE,_dma_flush_range)
260
261extern void dmac_inv_range(const void *, const void *);
262extern void dmac_clean_range(const void *, const void *);
263extern void dmac_flush_range(const void *, const void *);
264
265#endif
266
267#ifdef CONFIG_OUTER_CACHE
268
269extern struct outer_cache_fns outer_cache;
270
271static inline void outer_inv_range(unsigned long start, unsigned long end)
272{
273 if (outer_cache.inv_range)
274 outer_cache.inv_range(start, end);
275}
276static inline void outer_clean_range(unsigned long start, unsigned long end)
277{
278 if (outer_cache.clean_range)
279 outer_cache.clean_range(start, end);
280}
281static inline void outer_flush_range(unsigned long start, unsigned long end)
282{
283 if (outer_cache.flush_range)
284 outer_cache.flush_range(start, end);
285}
286
287#else
288
289static inline void outer_inv_range(unsigned long start, unsigned long end)
290{ }
291static inline void outer_clean_range(unsigned long start, unsigned long end)
292{ }
293static inline void outer_flush_range(unsigned long start, unsigned long end)
294{ }
295
296#endif
297
298/*
299 * flush_cache_vmap() is used when creating mappings (eg, via vmap,
300 * vmalloc, ioremap etc) in kernel space for pages. Since the
301 * direct-mappings of these pages may contain cached data, we need
302 * to do a full cache flush to ensure that writebacks don't corrupt
303 * data placed into these pages via the new mappings.
304 */
305#define flush_cache_vmap(start, end) flush_cache_all()
306#define flush_cache_vunmap(start, end) flush_cache_all()
307
308/*
309 * Copy user data from/to a page which is mapped into a different
310 * processes address space. Really, we want to allow our "user
311 * space" model to handle this.
312 */
313#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
314 do { \
315 memcpy(dst, src, len); \
316 flush_ptrace_access(vma, page, vaddr, dst, len, 1);\
317 } while (0)
318
319#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
320 do { \
321 memcpy(dst, src, len); \
322 } while (0)
323
324/*
325 * Convert calls to our calling convention.
326 */
327#define flush_cache_all() __cpuc_flush_kern_all()
328#ifndef CONFIG_CPU_CACHE_VIPT
329static inline void flush_cache_mm(struct mm_struct *mm)
330{
331 if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask))
332 __cpuc_flush_user_all();
333}
334
335static inline void
336flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
337{
338 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask))
339 __cpuc_flush_user_range(start & PAGE_MASK, PAGE_ALIGN(end),
340 vma->vm_flags);
341}
342
343static inline void
344flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn)
345{
346 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) {
347 unsigned long addr = user_addr & PAGE_MASK;
348 __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
349 }
350}
351
352static inline void
353flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
354 unsigned long uaddr, void *kaddr,
355 unsigned long len, int write)
356{
357 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) {
358 unsigned long addr = (unsigned long)kaddr;
359 __cpuc_coherent_kern_range(addr, addr + len);
360 }
361}
362#else
363extern void flush_cache_mm(struct mm_struct *mm);
364extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
365extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn);
366extern void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
367 unsigned long uaddr, void *kaddr,
368 unsigned long len, int write);
369#endif
370
371#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
372
373/*
374 * flush_cache_user_range is used when we want to ensure that the
375 * Harvard caches are synchronised for the user space address range.
376 * This is used for the ARM private sys_cacheflush system call.
377 */
378#define flush_cache_user_range(vma,start,end) \
379 __cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
380
381/*
382 * Perform necessary cache operations to ensure that data previously
383 * stored within this range of addresses can be executed by the CPU.
384 */
385#define flush_icache_range(s,e) __cpuc_coherent_kern_range(s,e)
386
387/*
388 * Perform necessary cache operations to ensure that the TLB will
389 * see data written in the specified area.
390 */
391#define clean_dcache_area(start,size) cpu_dcache_clean_area(start, size)
392
393/*
394 * flush_dcache_page is used when the kernel has written to the page
395 * cache page at virtual address page->virtual.
396 *
397 * If this page isn't mapped (ie, page_mapping == NULL), or it might
398 * have userspace mappings, then we _must_ always clean + invalidate
399 * the dcache entries associated with the kernel mapping.
400 *
401 * Otherwise we can defer the operation, and clean the cache when we are
402 * about to change to user space. This is the same method as used on SPARC64.
403 * See update_mmu_cache for the user space part.
404 */
405extern void flush_dcache_page(struct page *);
406
407extern void __flush_dcache_page(struct address_space *mapping, struct page *page);
408
409static inline void __flush_icache_all(void)
410{
411 asm("mcr p15, 0, %0, c7, c5, 0 @ invalidate I-cache\n"
412 :
413 : "r" (0));
414}
415
416#define ARCH_HAS_FLUSH_ANON_PAGE
417static inline void flush_anon_page(struct vm_area_struct *vma,
418 struct page *page, unsigned long vmaddr)
419{
420 extern void __flush_anon_page(struct vm_area_struct *vma,
421 struct page *, unsigned long);
422 if (PageAnon(page))
423 __flush_anon_page(vma, page, vmaddr);
424}
425
426#define flush_dcache_mmap_lock(mapping) \
427 spin_lock_irq(&(mapping)->tree_lock)
428#define flush_dcache_mmap_unlock(mapping) \
429 spin_unlock_irq(&(mapping)->tree_lock)
430
431#define flush_icache_user_range(vma,page,addr,len) \
432 flush_dcache_page(page)
433
434/*
435 * We don't appear to need to do anything here. In fact, if we did, we'd
436 * duplicate cache flushing elsewhere performed by flush_dcache_page().
437 */
438#define flush_icache_page(vma,page) do { } while (0)
439
440static inline void flush_ioremap_region(unsigned long phys, void __iomem *virt,
441 unsigned offset, size_t size)
442{
443 const void *start = (void __force *)virt + offset;
444 dmac_inv_range(start, start + size);
445}
446
447#define __cacheid_present(val) (val != read_cpuid(CPUID_ID))
448#define __cacheid_type_v7(val) ((val & (7 << 29)) == (4 << 29))
449
450#define __cacheid_vivt_prev7(val) ((val & (15 << 25)) != (14 << 25))
451#define __cacheid_vipt_prev7(val) ((val & (15 << 25)) == (14 << 25))
452#define __cacheid_vipt_nonaliasing_prev7(val) ((val & (15 << 25 | 1 << 23)) == (14 << 25))
453#define __cacheid_vipt_aliasing_prev7(val) ((val & (15 << 25 | 1 << 23)) == (14 << 25 | 1 << 23))
454
455#define __cacheid_vivt(val) (__cacheid_type_v7(val) ? 0 : __cacheid_vivt_prev7(val))
456#define __cacheid_vipt(val) (__cacheid_type_v7(val) ? 1 : __cacheid_vipt_prev7(val))
457#define __cacheid_vipt_nonaliasing(val) (__cacheid_type_v7(val) ? 1 : __cacheid_vipt_nonaliasing_prev7(val))
458#define __cacheid_vipt_aliasing(val) (__cacheid_type_v7(val) ? 0 : __cacheid_vipt_aliasing_prev7(val))
459#define __cacheid_vivt_asid_tagged_instr(val) (__cacheid_type_v7(val) ? ((val & (3 << 14)) == (1 << 14)) : 0)
460
461#if defined(CONFIG_CPU_CACHE_VIVT) && !defined(CONFIG_CPU_CACHE_VIPT)
462/*
463 * VIVT caches only
464 */
465#define cache_is_vivt() 1
466#define cache_is_vipt() 0
467#define cache_is_vipt_nonaliasing() 0
468#define cache_is_vipt_aliasing() 0
469#define icache_is_vivt_asid_tagged() 0
470
471#elif !defined(CONFIG_CPU_CACHE_VIVT) && defined(CONFIG_CPU_CACHE_VIPT)
472/*
473 * VIPT caches only
474 */
475#define cache_is_vivt() 0
476#define cache_is_vipt() 1
477#define cache_is_vipt_nonaliasing() \
478 ({ \
479 unsigned int __val = read_cpuid(CPUID_CACHETYPE); \
480 __cacheid_vipt_nonaliasing(__val); \
481 })
482
483#define cache_is_vipt_aliasing() \
484 ({ \
485 unsigned int __val = read_cpuid(CPUID_CACHETYPE); \
486 __cacheid_vipt_aliasing(__val); \
487 })
488
489#define icache_is_vivt_asid_tagged() \
490 ({ \
491 unsigned int __val = read_cpuid(CPUID_CACHETYPE); \
492 __cacheid_vivt_asid_tagged_instr(__val); \
493 })
494
495#else
496/*
497 * VIVT or VIPT caches. Note that this is unreliable since ARM926
498 * and V6 CPUs satisfy the "(val & (15 << 25)) == (14 << 25)" test.
499 * There's no way to tell from the CacheType register what type (!)
500 * the cache is.
501 */
502#define cache_is_vivt() \
503 ({ \
504 unsigned int __val = read_cpuid(CPUID_CACHETYPE); \
505 (!__cacheid_present(__val)) || __cacheid_vivt(__val); \
506 })
507
508#define cache_is_vipt() \
509 ({ \
510 unsigned int __val = read_cpuid(CPUID_CACHETYPE); \
511 __cacheid_present(__val) && __cacheid_vipt(__val); \
512 })
513
514#define cache_is_vipt_nonaliasing() \
515 ({ \
516 unsigned int __val = read_cpuid(CPUID_CACHETYPE); \
517 __cacheid_present(__val) && \
518 __cacheid_vipt_nonaliasing(__val); \
519 })
520
521#define cache_is_vipt_aliasing() \
522 ({ \
523 unsigned int __val = read_cpuid(CPUID_CACHETYPE); \
524 __cacheid_present(__val) && \
525 __cacheid_vipt_aliasing(__val); \
526 })
527
528#define icache_is_vivt_asid_tagged() \
529 ({ \
530 unsigned int __val = read_cpuid(CPUID_CACHETYPE); \
531 __cacheid_present(__val) && \
532 __cacheid_vivt_asid_tagged_instr(__val); \
533 })
534
535#endif
536
537#endif
diff --git a/arch/arm/include/asm/checksum.h b/arch/arm/include/asm/checksum.h
new file mode 100644
index 000000000000..6dcc16430868
--- /dev/null
+++ b/arch/arm/include/asm/checksum.h
@@ -0,0 +1,139 @@
1/*
2 * arch/arm/include/asm/checksum.h
3 *
4 * IP checksum routines
5 *
6 * Copyright (C) Original authors of ../asm-i386/checksum.h
7 * Copyright (C) 1996-1999 Russell King
8 */
9#ifndef __ASM_ARM_CHECKSUM_H
10#define __ASM_ARM_CHECKSUM_H
11
12#include <linux/in6.h>
13
14/*
15 * computes the checksum of a memory block at buff, length len,
16 * and adds in "sum" (32-bit)
17 *
18 * returns a 32-bit number suitable for feeding into itself
19 * or csum_tcpudp_magic
20 *
21 * this function must be called with even lengths, except
22 * for the last fragment, which may be odd
23 *
24 * it's best to have buff aligned on a 32-bit boundary
25 */
26__wsum csum_partial(const void *buff, int len, __wsum sum);
27
28/*
29 * the same as csum_partial, but copies from src while it
30 * checksums, and handles user-space pointer exceptions correctly, when needed.
31 *
32 * here even more important to align src and dst on a 32-bit (or even
33 * better 64-bit) boundary
34 */
35
36__wsum
37csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
38
39__wsum
40csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr);
41
42/*
43 * Fold a partial checksum without adding pseudo headers
44 */
45static inline __sum16 csum_fold(__wsum sum)
46{
47 __asm__(
48 "add %0, %1, %1, ror #16 @ csum_fold"
49 : "=r" (sum)
50 : "r" (sum)
51 : "cc");
52 return (__force __sum16)(~(__force u32)sum >> 16);
53}
54
55/*
56 * This is a version of ip_compute_csum() optimized for IP headers,
57 * which always checksum on 4 octet boundaries.
58 */
59static inline __sum16
60ip_fast_csum(const void *iph, unsigned int ihl)
61{
62 unsigned int tmp1;
63 __wsum sum;
64
65 __asm__ __volatile__(
66 "ldr %0, [%1], #4 @ ip_fast_csum \n\
67 ldr %3, [%1], #4 \n\
68 sub %2, %2, #5 \n\
69 adds %0, %0, %3 \n\
70 ldr %3, [%1], #4 \n\
71 adcs %0, %0, %3 \n\
72 ldr %3, [%1], #4 \n\
731: adcs %0, %0, %3 \n\
74 ldr %3, [%1], #4 \n\
75 tst %2, #15 @ do this carefully \n\
76 subne %2, %2, #1 @ without destroying \n\
77 bne 1b @ the carry flag \n\
78 adcs %0, %0, %3 \n\
79 adc %0, %0, #0"
80 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1)
81 : "1" (iph), "2" (ihl)
82 : "cc", "memory");
83 return csum_fold(sum);
84}
85
86static inline __wsum
87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
88 unsigned short proto, __wsum sum)
89{
90 __asm__(
91 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\
92 adcs %0, %0, %3 \n"
93#ifdef __ARMEB__
94 "adcs %0, %0, %4 \n"
95#else
96 "adcs %0, %0, %4, lsl #8 \n"
97#endif
98 "adcs %0, %0, %5 \n\
99 adc %0, %0, #0"
100 : "=&r"(sum)
101 : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto))
102 : "cc");
103 return sum;
104}
105/*
106 * computes the checksum of the TCP/UDP pseudo-header
107 * returns a 16-bit checksum, already complemented
108 */
109static inline __sum16
110csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
111 unsigned short proto, __wsum sum)
112{
113 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
114}
115
116
117/*
118 * this routine is used for miscellaneous IP-like checksums, mainly
119 * in icmp.c
120 */
121static inline __sum16
122ip_compute_csum(const void *buff, int len)
123{
124 return csum_fold(csum_partial(buff, len, 0));
125}
126
127#define _HAVE_ARCH_IPV6_CSUM
128extern __wsum
129__csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __be32 len,
130 __be32 proto, __wsum sum);
131
132static inline __sum16
133csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __u32 len,
134 unsigned short proto, __wsum sum)
135{
136 return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len),
137 htonl(proto), sum));
138}
139#endif
diff --git a/arch/arm/include/asm/cnt32_to_63.h b/arch/arm/include/asm/cnt32_to_63.h
new file mode 100644
index 000000000000..480c873fa746
--- /dev/null
+++ b/arch/arm/include/asm/cnt32_to_63.h
@@ -0,0 +1,78 @@
1/*
2 * include/asm/cnt32_to_63.h -- extend a 32-bit counter to 63 bits
3 *
4 * Author: Nicolas Pitre
5 * Created: December 3, 2006
6 * Copyright: MontaVista Software, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
11 */
12
13#ifndef __INCLUDE_CNT32_TO_63_H__
14#define __INCLUDE_CNT32_TO_63_H__
15
16#include <linux/compiler.h>
17#include <asm/types.h>
18#include <asm/byteorder.h>
19
20/*
21 * Prototype: u64 cnt32_to_63(u32 cnt)
22 * Many hardware clock counters are only 32 bits wide and therefore have
23 * a relatively short period making wrap-arounds rather frequent. This
24 * is a problem when implementing sched_clock() for example, where a 64-bit
25 * non-wrapping monotonic value is expected to be returned.
26 *
27 * To overcome that limitation, let's extend a 32-bit counter to 63 bits
28 * in a completely lock free fashion. Bits 0 to 31 of the clock are provided
29 * by the hardware while bits 32 to 62 are stored in memory. The top bit in
30 * memory is used to synchronize with the hardware clock half-period. When
31 * the top bit of both counters (hardware and in memory) differ then the
32 * memory is updated with a new value, incrementing it when the hardware
33 * counter wraps around.
34 *
35 * Because a word store in memory is atomic then the incremented value will
36 * always be in synch with the top bit indicating to any potential concurrent
37 * reader if the value in memory is up to date or not with regards to the
38 * needed increment. And any race in updating the value in memory is harmless
39 * as the same value would simply be stored more than once.
40 *
41 * The only restriction for the algorithm to work properly is that this
42 * code must be executed at least once per each half period of the 32-bit
43 * counter to properly update the state bit in memory. This is usually not a
44 * problem in practice, but if it is then a kernel timer could be scheduled
45 * to manage for this code to be executed often enough.
46 *
47 * Note that the top bit (bit 63) in the returned value should be considered
48 * as garbage. It is not cleared here because callers are likely to use a
49 * multiplier on the returned value which can get rid of the top bit
50 * implicitly by making the multiplier even, therefore saving on a runtime
51 * clear-bit instruction. Otherwise caller must remember to clear the top
52 * bit explicitly.
53 */
54
55/* this is used only to give gcc a clue about good code generation */
56typedef union {
57 struct {
58#if defined(__LITTLE_ENDIAN)
59 u32 lo, hi;
60#elif defined(__BIG_ENDIAN)
61 u32 hi, lo;
62#endif
63 };
64 u64 val;
65} cnt32_to_63_t;
66
67#define cnt32_to_63(cnt_lo) \
68({ \
69 static volatile u32 __m_cnt_hi = 0; \
70 cnt32_to_63_t __x; \
71 __x.hi = __m_cnt_hi; \
72 __x.lo = (cnt_lo); \
73 if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \
74 __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \
75 __x.val; \
76})
77
78#endif
diff --git a/arch/arm/include/asm/cpu-multi32.h b/arch/arm/include/asm/cpu-multi32.h
new file mode 100644
index 000000000000..e2b5b0b2116a
--- /dev/null
+++ b/arch/arm/include/asm/cpu-multi32.h
@@ -0,0 +1,69 @@
1/*
2 * arch/arm/include/asm/cpu-multi32.h
3 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <asm/page.h>
11
12struct mm_struct;
13
14/*
15 * Don't change this structure - ASM code
16 * relies on it.
17 */
18extern struct processor {
19 /* MISC
20 * get data abort address/flags
21 */
22 void (*_data_abort)(unsigned long pc);
23 /*
24 * Retrieve prefetch fault address
25 */
26 unsigned long (*_prefetch_abort)(unsigned long lr);
27 /*
28 * Set up any processor specifics
29 */
30 void (*_proc_init)(void);
31 /*
32 * Disable any processor specifics
33 */
34 void (*_proc_fin)(void);
35 /*
36 * Special stuff for a reset
37 */
38 void (*reset)(unsigned long addr) __attribute__((noreturn));
39 /*
40 * Idle the processor
41 */
42 int (*_do_idle)(void);
43 /*
44 * Processor architecture specific
45 */
46 /*
47 * clean a virtual address range from the
48 * D-cache without flushing the cache.
49 */
50 void (*dcache_clean_area)(void *addr, int size);
51
52 /*
53 * Set the page table
54 */
55 void (*switch_mm)(unsigned long pgd_phys, struct mm_struct *mm);
56 /*
57 * Set a possibly extended PTE. Non-extended PTEs should
58 * ignore 'ext'.
59 */
60 void (*set_pte_ext)(pte_t *ptep, pte_t pte, unsigned int ext);
61} processor;
62
63#define cpu_proc_init() processor._proc_init()
64#define cpu_proc_fin() processor._proc_fin()
65#define cpu_reset(addr) processor.reset(addr)
66#define cpu_do_idle() processor._do_idle()
67#define cpu_dcache_clean_area(addr,sz) processor.dcache_clean_area(addr,sz)
68#define cpu_set_pte_ext(ptep,pte,ext) processor.set_pte_ext(ptep,pte,ext)
69#define cpu_do_switch_mm(pgd,mm) processor.switch_mm(pgd,mm)
diff --git a/arch/arm/include/asm/cpu-single.h b/arch/arm/include/asm/cpu-single.h
new file mode 100644
index 000000000000..f073a6d2a406
--- /dev/null
+++ b/arch/arm/include/asm/cpu-single.h
@@ -0,0 +1,44 @@
1/*
2 * arch/arm/include/asm/cpu-single.h
3 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10/*
11 * Single CPU
12 */
13#ifdef __STDC__
14#define __catify_fn(name,x) name##x
15#else
16#define __catify_fn(name,x) name/**/x
17#endif
18#define __cpu_fn(name,x) __catify_fn(name,x)
19
20/*
21 * If we are supporting multiple CPUs, then we must use a table of
22 * function pointers for this lot. Otherwise, we can optimise the
23 * table away.
24 */
25#define cpu_proc_init __cpu_fn(CPU_NAME,_proc_init)
26#define cpu_proc_fin __cpu_fn(CPU_NAME,_proc_fin)
27#define cpu_reset __cpu_fn(CPU_NAME,_reset)
28#define cpu_do_idle __cpu_fn(CPU_NAME,_do_idle)
29#define cpu_dcache_clean_area __cpu_fn(CPU_NAME,_dcache_clean_area)
30#define cpu_do_switch_mm __cpu_fn(CPU_NAME,_switch_mm)
31#define cpu_set_pte_ext __cpu_fn(CPU_NAME,_set_pte_ext)
32
33#include <asm/page.h>
34
35struct mm_struct;
36
37/* declare all the functions as extern */
38extern void cpu_proc_init(void);
39extern void cpu_proc_fin(void);
40extern int cpu_do_idle(void);
41extern void cpu_dcache_clean_area(void *, int);
42extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
43extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext);
44extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
diff --git a/arch/arm/include/asm/cpu.h b/arch/arm/include/asm/cpu.h
new file mode 100644
index 000000000000..634b2d7c612a
--- /dev/null
+++ b/arch/arm/include/asm/cpu.h
@@ -0,0 +1,25 @@
1/*
2 * arch/arm/include/asm/cpu.h
3 *
4 * Copyright (C) 2004-2005 ARM Ltd.
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_ARM_CPU_H
11#define __ASM_ARM_CPU_H
12
13#include <linux/percpu.h>
14
15struct cpuinfo_arm {
16 struct cpu cpu;
17#ifdef CONFIG_SMP
18 struct task_struct *idle;
19 unsigned int loops_per_jiffy;
20#endif
21};
22
23DECLARE_PER_CPU(struct cpuinfo_arm, cpu_data);
24
25#endif
diff --git a/arch/arm/include/asm/cputime.h b/arch/arm/include/asm/cputime.h
new file mode 100644
index 000000000000..3a8002a5fec7
--- /dev/null
+++ b/arch/arm/include/asm/cputime.h
@@ -0,0 +1,6 @@
1#ifndef __ARM_CPUTIME_H
2#define __ARM_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __ARM_CPUTIME_H */
diff --git a/arch/arm/include/asm/current.h b/arch/arm/include/asm/current.h
new file mode 100644
index 000000000000..75d21e2a3ff7
--- /dev/null
+++ b/arch/arm/include/asm/current.h
@@ -0,0 +1,15 @@
1#ifndef _ASMARM_CURRENT_H
2#define _ASMARM_CURRENT_H
3
4#include <linux/thread_info.h>
5
6static inline struct task_struct *get_current(void) __attribute_const__;
7
8static inline struct task_struct *get_current(void)
9{
10 return current_thread_info()->task;
11}
12
13#define current (get_current())
14
15#endif /* _ASMARM_CURRENT_H */
diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h
new file mode 100644
index 000000000000..b2deda181549
--- /dev/null
+++ b/arch/arm/include/asm/delay.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 1995-2004 Russell King
3 *
4 * Delay routines, using a pre-computed "loops_per_second" value.
5 */
6#ifndef __ASM_ARM_DELAY_H
7#define __ASM_ARM_DELAY_H
8
9#include <asm/param.h> /* HZ */
10
11extern void __delay(int loops);
12
13/*
14 * This function intentionally does not exist; if you see references to
15 * it, it means that you're calling udelay() with an out of range value.
16 *
17 * With currently imposed limits, this means that we support a max delay
18 * of 2000us. Further limits: HZ<=1000 and bogomips<=3355
19 */
20extern void __bad_udelay(void);
21
22/*
23 * division by multiplication: you don't have to worry about
24 * loss of precision.
25 *
26 * Use only for very small delays ( < 1 msec). Should probably use a
27 * lookup table, really, as the multiplications take much too long with
28 * short delays. This is a "reasonable" implementation, though (and the
29 * first constant multiplications gets optimized away if the delay is
30 * a constant)
31 */
32extern void __udelay(unsigned long usecs);
33extern void __const_udelay(unsigned long);
34
35#define MAX_UDELAY_MS 2
36
37#define udelay(n) \
38 (__builtin_constant_p(n) ? \
39 ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \
40 __const_udelay((n) * ((2199023U*HZ)>>11))) : \
41 __udelay(n))
42
43#endif /* defined(_ARM_DELAY_H) */
44
diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h
new file mode 100644
index 000000000000..c61642b40603
--- /dev/null
+++ b/arch/arm/include/asm/device.h
@@ -0,0 +1,15 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef ASMARM_DEVICE_H
7#define ASMARM_DEVICE_H
8
9struct dev_archdata {
10#ifdef CONFIG_DMABOUNCE
11 struct dmabounce_device_info *dmabounce;
12#endif
13};
14
15#endif
diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h
new file mode 100644
index 000000000000..5001390be958
--- /dev/null
+++ b/arch/arm/include/asm/div64.h
@@ -0,0 +1,227 @@
1#ifndef __ASM_ARM_DIV64
2#define __ASM_ARM_DIV64
3
4#include <asm/system.h>
5#include <linux/types.h>
6
7/*
8 * The semantics of do_div() are:
9 *
10 * uint32_t do_div(uint64_t *n, uint32_t base)
11 * {
12 * uint32_t remainder = *n % base;
13 * *n = *n / base;
14 * return remainder;
15 * }
16 *
17 * In other words, a 64-bit dividend with a 32-bit divisor producing
18 * a 64-bit result and a 32-bit remainder. To accomplish this optimally
19 * we call a special __do_div64 helper with completely non standard
20 * calling convention for arguments and results (beware).
21 */
22
23#ifdef __ARMEB__
24#define __xh "r0"
25#define __xl "r1"
26#else
27#define __xl "r0"
28#define __xh "r1"
29#endif
30
31#define __do_div_asm(n, base) \
32({ \
33 register unsigned int __base asm("r4") = base; \
34 register unsigned long long __n asm("r0") = n; \
35 register unsigned long long __res asm("r2"); \
36 register unsigned int __rem asm(__xh); \
37 asm( __asmeq("%0", __xh) \
38 __asmeq("%1", "r2") \
39 __asmeq("%2", "r0") \
40 __asmeq("%3", "r4") \
41 "bl __do_div64" \
42 : "=r" (__rem), "=r" (__res) \
43 : "r" (__n), "r" (__base) \
44 : "ip", "lr", "cc"); \
45 n = __res; \
46 __rem; \
47})
48
49#if __GNUC__ < 4
50
51/*
52 * gcc versions earlier than 4.0 are simply too problematic for the
53 * optimized implementation below. First there is gcc PR 15089 that
54 * tend to trig on more complex constructs, spurious .global __udivsi3
55 * are inserted even if none of those symbols are referenced in the
56 * generated code, and those gcc versions are not able to do constant
57 * propagation on long long values anyway.
58 */
59#define do_div(n, base) __do_div_asm(n, base)
60
61#elif __GNUC__ >= 4
62
63#include <asm/bug.h>
64
65/*
66 * If the divisor happens to be constant, we determine the appropriate
67 * inverse at compile time to turn the division into a few inline
68 * multiplications instead which is much faster. And yet only if compiling
69 * for ARMv4 or higher (we need umull/umlal) and if the gcc version is
70 * sufficiently recent to perform proper long long constant propagation.
71 * (It is unfortunate that gcc doesn't perform all this internally.)
72 */
73#define do_div(n, base) \
74({ \
75 unsigned int __r, __b = (base); \
76 if (!__builtin_constant_p(__b) || __b == 0 || \
77 (__LINUX_ARM_ARCH__ < 4 && (__b & (__b - 1)) != 0)) { \
78 /* non-constant divisor (or zero): slow path */ \
79 __r = __do_div_asm(n, __b); \
80 } else if ((__b & (__b - 1)) == 0) { \
81 /* Trivial: __b is constant and a power of 2 */ \
82 /* gcc does the right thing with this code. */ \
83 __r = n; \
84 __r &= (__b - 1); \
85 n /= __b; \
86 } else { \
87 /* Multiply by inverse of __b: n/b = n*(p/b)/p */ \
88 /* We rely on the fact that most of this code gets */ \
89 /* optimized away at compile time due to constant */ \
90 /* propagation and only a couple inline assembly */ \
91 /* instructions should remain. Better avoid any */ \
92 /* code construct that might prevent that. */ \
93 unsigned long long __res, __x, __t, __m, __n = n; \
94 unsigned int __c, __p, __z = 0; \
95 /* preserve low part of n for reminder computation */ \
96 __r = __n; \
97 /* determine number of bits to represent __b */ \
98 __p = 1 << __div64_fls(__b); \
99 /* compute __m = ((__p << 64) + __b - 1) / __b */ \
100 __m = (~0ULL / __b) * __p; \
101 __m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b; \
102 /* compute __res = __m*(~0ULL/__b*__b-1)/(__p << 64) */ \
103 __x = ~0ULL / __b * __b - 1; \
104 __res = (__m & 0xffffffff) * (__x & 0xffffffff); \
105 __res >>= 32; \
106 __res += (__m & 0xffffffff) * (__x >> 32); \
107 __t = __res; \
108 __res += (__x & 0xffffffff) * (__m >> 32); \
109 __t = (__res < __t) ? (1ULL << 32) : 0; \
110 __res = (__res >> 32) + __t; \
111 __res += (__m >> 32) * (__x >> 32); \
112 __res /= __p; \
113 /* Now sanitize and optimize what we've got. */ \
114 if (~0ULL % (__b / (__b & -__b)) == 0) { \
115 /* those cases can be simplified with: */ \
116 __n /= (__b & -__b); \
117 __m = ~0ULL / (__b / (__b & -__b)); \
118 __p = 1; \
119 __c = 1; \
120 } else if (__res != __x / __b) { \
121 /* We can't get away without a correction */ \
122 /* to compensate for bit truncation errors. */ \
123 /* To avoid it we'd need an additional bit */ \
124 /* to represent __m which would overflow it. */ \
125 /* Instead we do m=p/b and n/b=(n*m+m)/p. */ \
126 __c = 1; \
127 /* Compute __m = (__p << 64) / __b */ \
128 __m = (~0ULL / __b) * __p; \
129 __m += ((~0ULL % __b + 1) * __p) / __b; \
130 } else { \
131 /* Reduce __m/__p, and try to clear bit 31 */ \
132 /* of __m when possible otherwise that'll */ \
133 /* need extra overflow handling later. */ \
134 unsigned int __bits = -(__m & -__m); \
135 __bits |= __m >> 32; \
136 __bits = (~__bits) << 1; \
137 /* If __bits == 0 then setting bit 31 is */ \
138 /* unavoidable. Simply apply the maximum */ \
139 /* possible reduction in that case. */ \
140 /* Otherwise the MSB of __bits indicates the */ \
141 /* best reduction we should apply. */ \
142 if (!__bits) { \
143 __p /= (__m & -__m); \
144 __m /= (__m & -__m); \
145 } else { \
146 __p >>= __div64_fls(__bits); \
147 __m >>= __div64_fls(__bits); \
148 } \
149 /* No correction needed. */ \
150 __c = 0; \
151 } \
152 /* Now we have a combination of 2 conditions: */ \
153 /* 1) whether or not we need a correction (__c), and */ \
154 /* 2) whether or not there might be an overflow in */ \
155 /* the cross product (__m & ((1<<63) | (1<<31))) */ \
156 /* Select the best insn combination to perform the */ \
157 /* actual __m * __n / (__p << 64) operation. */ \
158 if (!__c) { \
159 asm ( "umull %Q0, %R0, %1, %Q2\n\t" \
160 "mov %Q0, #0" \
161 : "=&r" (__res) \
162 : "r" (__m), "r" (__n) \
163 : "cc" ); \
164 } else if (!(__m & ((1ULL << 63) | (1ULL << 31)))) { \
165 __res = __m; \
166 asm ( "umlal %Q0, %R0, %Q1, %Q2\n\t" \
167 "mov %Q0, #0" \
168 : "+r" (__res) \
169 : "r" (__m), "r" (__n) \
170 : "cc" ); \
171 } else { \
172 asm ( "umull %Q0, %R0, %Q1, %Q2\n\t" \
173 "cmn %Q0, %Q1\n\t" \
174 "adcs %R0, %R0, %R1\n\t" \
175 "adc %Q0, %3, #0" \
176 : "=&r" (__res) \
177 : "r" (__m), "r" (__n), "r" (__z) \
178 : "cc" ); \
179 } \
180 if (!(__m & ((1ULL << 63) | (1ULL << 31)))) { \
181 asm ( "umlal %R0, %Q0, %R1, %Q2\n\t" \
182 "umlal %R0, %Q0, %Q1, %R2\n\t" \
183 "mov %R0, #0\n\t" \
184 "umlal %Q0, %R0, %R1, %R2" \
185 : "+r" (__res) \
186 : "r" (__m), "r" (__n) \
187 : "cc" ); \
188 } else { \
189 asm ( "umlal %R0, %Q0, %R2, %Q3\n\t" \
190 "umlal %R0, %1, %Q2, %R3\n\t" \
191 "mov %R0, #0\n\t" \
192 "adds %Q0, %1, %Q0\n\t" \
193 "adc %R0, %R0, #0\n\t" \
194 "umlal %Q0, %R0, %R2, %R3" \
195 : "+r" (__res), "+r" (__z) \
196 : "r" (__m), "r" (__n) \
197 : "cc" ); \
198 } \
199 __res /= __p; \
200 /* The reminder can be computed with 32-bit regs */ \
201 /* only, and gcc is good at that. */ \
202 { \
203 unsigned int __res0 = __res; \
204 unsigned int __b0 = __b; \
205 __r -= __res0 * __b0; \
206 } \
207 /* BUG_ON(__r >= __b || __res * __b + __r != n); */ \
208 n = __res; \
209 } \
210 __r; \
211})
212
213/* our own fls implementation to make sure constant propagation is fine */
214#define __div64_fls(bits) \
215({ \
216 unsigned int __left = (bits), __nr = 0; \
217 if (__left & 0xffff0000) __nr += 16, __left >>= 16; \
218 if (__left & 0x0000ff00) __nr += 8, __left >>= 8; \
219 if (__left & 0x000000f0) __nr += 4, __left >>= 4; \
220 if (__left & 0x0000000c) __nr += 2, __left >>= 2; \
221 if (__left & 0x00000002) __nr += 1; \
222 __nr; \
223})
224
225#endif
226
227#endif
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
new file mode 100644
index 000000000000..45329fca1b64
--- /dev/null
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -0,0 +1,458 @@
1#ifndef ASMARM_DMA_MAPPING_H
2#define ASMARM_DMA_MAPPING_H
3
4#ifdef __KERNEL__
5
6#include <linux/mm.h> /* need struct page */
7
8#include <linux/scatterlist.h>
9
10#include <asm-generic/dma-coherent.h>
11
12/*
13 * DMA-consistent mapping functions. These allocate/free a region of
14 * uncached, unwrite-buffered mapped memory space for use with DMA
15 * devices. This is the "generic" version. The PCI specific version
16 * is in pci.h
17 *
18 * Note: Drivers should NOT use this function directly, as it will break
19 * platforms with CONFIG_DMABOUNCE.
20 * Use the driver DMA support - see dma-mapping.h (dma_sync_*)
21 */
22extern void dma_cache_maint(const void *kaddr, size_t size, int rw);
23
24/*
25 * Return whether the given device DMA address mask can be supported
26 * properly. For example, if your device can only drive the low 24-bits
27 * during bus mastering, then you would pass 0x00ffffff as the mask
28 * to this function.
29 *
30 * FIXME: This should really be a platform specific issue - we should
31 * return false if GFP_DMA allocations may not satisfy the supplied 'mask'.
32 */
33static inline int dma_supported(struct device *dev, u64 mask)
34{
35 return dev->dma_mask && *dev->dma_mask != 0;
36}
37
38static inline int dma_set_mask(struct device *dev, u64 dma_mask)
39{
40 if (!dev->dma_mask || !dma_supported(dev, dma_mask))
41 return -EIO;
42
43 *dev->dma_mask = dma_mask;
44
45 return 0;
46}
47
48static inline int dma_get_cache_alignment(void)
49{
50 return 32;
51}
52
53static inline int dma_is_consistent(struct device *dev, dma_addr_t handle)
54{
55 return !!arch_is_coherent();
56}
57
58/*
59 * DMA errors are defined by all-bits-set in the DMA address.
60 */
61static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
62{
63 return dma_addr == ~0;
64}
65
66/*
67 * Dummy noncoherent implementation. We don't provide a dma_cache_sync
68 * function so drivers using this API are highlighted with build warnings.
69 */
70static inline void *
71dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp)
72{
73 return NULL;
74}
75
76static inline void
77dma_free_noncoherent(struct device *dev, size_t size, void *cpu_addr,
78 dma_addr_t handle)
79{
80}
81
82/**
83 * dma_alloc_coherent - allocate consistent memory for DMA
84 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
85 * @size: required memory size
86 * @handle: bus-specific DMA address
87 *
88 * Allocate some uncached, unbuffered memory for a device for
89 * performing DMA. This function allocates pages, and will
90 * return the CPU-viewed address, and sets @handle to be the
91 * device-viewed address.
92 */
93extern void *
94dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp);
95
96/**
97 * dma_free_coherent - free memory allocated by dma_alloc_coherent
98 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
99 * @size: size of memory originally requested in dma_alloc_coherent
100 * @cpu_addr: CPU-view address returned from dma_alloc_coherent
101 * @handle: device-view address returned from dma_alloc_coherent
102 *
103 * Free (and unmap) a DMA buffer previously allocated by
104 * dma_alloc_coherent().
105 *
106 * References to memory and mappings associated with cpu_addr/handle
107 * during and after this call executing are illegal.
108 */
109extern void
110dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
111 dma_addr_t handle);
112
113/**
114 * dma_mmap_coherent - map a coherent DMA allocation into user space
115 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
116 * @vma: vm_area_struct describing requested user mapping
117 * @cpu_addr: kernel CPU-view address returned from dma_alloc_coherent
118 * @handle: device-view address returned from dma_alloc_coherent
119 * @size: size of memory originally requested in dma_alloc_coherent
120 *
121 * Map a coherent DMA buffer previously allocated by dma_alloc_coherent
122 * into user space. The coherent DMA buffer must not be freed by the
123 * driver until the user space mapping has been released.
124 */
125int dma_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
126 void *cpu_addr, dma_addr_t handle, size_t size);
127
128
129/**
130 * dma_alloc_writecombine - allocate writecombining memory for DMA
131 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
132 * @size: required memory size
133 * @handle: bus-specific DMA address
134 *
135 * Allocate some uncached, buffered memory for a device for
136 * performing DMA. This function allocates pages, and will
137 * return the CPU-viewed address, and sets @handle to be the
138 * device-viewed address.
139 */
140extern void *
141dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp);
142
143#define dma_free_writecombine(dev,size,cpu_addr,handle) \
144 dma_free_coherent(dev,size,cpu_addr,handle)
145
146int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
147 void *cpu_addr, dma_addr_t handle, size_t size);
148
149
150/**
151 * dma_map_single - map a single buffer for streaming DMA
152 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
153 * @cpu_addr: CPU direct mapped address of buffer
154 * @size: size of buffer to map
155 * @dir: DMA transfer direction
156 *
157 * Ensure that any data held in the cache is appropriately discarded
158 * or written back.
159 *
160 * The device owns this memory once this call has completed. The CPU
161 * can regain ownership by calling dma_unmap_single() or
162 * dma_sync_single_for_cpu().
163 */
164#ifndef CONFIG_DMABOUNCE
165static inline dma_addr_t
166dma_map_single(struct device *dev, void *cpu_addr, size_t size,
167 enum dma_data_direction dir)
168{
169 if (!arch_is_coherent())
170 dma_cache_maint(cpu_addr, size, dir);
171
172 return virt_to_dma(dev, (unsigned long)cpu_addr);
173}
174#else
175extern dma_addr_t dma_map_single(struct device *,void *, size_t, enum dma_data_direction);
176#endif
177
178/**
179 * dma_map_page - map a portion of a page for streaming DMA
180 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
181 * @page: page that buffer resides in
182 * @offset: offset into page for start of buffer
183 * @size: size of buffer to map
184 * @dir: DMA transfer direction
185 *
186 * Ensure that any data held in the cache is appropriately discarded
187 * or written back.
188 *
189 * The device owns this memory once this call has completed. The CPU
190 * can regain ownership by calling dma_unmap_page() or
191 * dma_sync_single_for_cpu().
192 */
193static inline dma_addr_t
194dma_map_page(struct device *dev, struct page *page,
195 unsigned long offset, size_t size,
196 enum dma_data_direction dir)
197{
198 return dma_map_single(dev, page_address(page) + offset, size, (int)dir);
199}
200
201/**
202 * dma_unmap_single - unmap a single buffer previously mapped
203 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
204 * @handle: DMA address of buffer
205 * @size: size of buffer to map
206 * @dir: DMA transfer direction
207 *
208 * Unmap a single streaming mode DMA translation. The handle and size
209 * must match what was provided in the previous dma_map_single() call.
210 * All other usages are undefined.
211 *
212 * After this call, reads by the CPU to the buffer are guaranteed to see
213 * whatever the device wrote there.
214 */
215#ifndef CONFIG_DMABOUNCE
216static inline void
217dma_unmap_single(struct device *dev, dma_addr_t handle, size_t size,
218 enum dma_data_direction dir)
219{
220 /* nothing to do */
221}
222#else
223extern void dma_unmap_single(struct device *, dma_addr_t, size_t, enum dma_data_direction);
224#endif
225
226/**
227 * dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
228 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
229 * @handle: DMA address of buffer
230 * @size: size of buffer to map
231 * @dir: DMA transfer direction
232 *
233 * Unmap a single streaming mode DMA translation. The handle and size
234 * must match what was provided in the previous dma_map_single() call.
235 * All other usages are undefined.
236 *
237 * After this call, reads by the CPU to the buffer are guaranteed to see
238 * whatever the device wrote there.
239 */
240static inline void
241dma_unmap_page(struct device *dev, dma_addr_t handle, size_t size,
242 enum dma_data_direction dir)
243{
244 dma_unmap_single(dev, handle, size, (int)dir);
245}
246
247/**
248 * dma_map_sg - map a set of SG buffers for streaming mode DMA
249 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
250 * @sg: list of buffers
251 * @nents: number of buffers to map
252 * @dir: DMA transfer direction
253 *
254 * Map a set of buffers described by scatterlist in streaming
255 * mode for DMA. This is the scatter-gather version of the
256 * above dma_map_single interface. Here the scatter gather list
257 * elements are each tagged with the appropriate dma address
258 * and length. They are obtained via sg_dma_{address,length}(SG).
259 *
260 * NOTE: An implementation may be able to use a smaller number of
261 * DMA address/length pairs than there are SG table elements.
262 * (for example via virtual mapping capabilities)
263 * The routine returns the number of addr/length pairs actually
264 * used, at most nents.
265 *
266 * Device ownership issues as mentioned above for dma_map_single are
267 * the same here.
268 */
269#ifndef CONFIG_DMABOUNCE
270static inline int
271dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
272 enum dma_data_direction dir)
273{
274 int i;
275
276 for (i = 0; i < nents; i++, sg++) {
277 char *virt;
278
279 sg->dma_address = page_to_dma(dev, sg_page(sg)) + sg->offset;
280 virt = sg_virt(sg);
281
282 if (!arch_is_coherent())
283 dma_cache_maint(virt, sg->length, dir);
284 }
285
286 return nents;
287}
288#else
289extern int dma_map_sg(struct device *, struct scatterlist *, int, enum dma_data_direction);
290#endif
291
292/**
293 * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
294 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
295 * @sg: list of buffers
296 * @nents: number of buffers to map
297 * @dir: DMA transfer direction
298 *
299 * Unmap a set of streaming mode DMA translations.
300 * Again, CPU read rules concerning calls here are the same as for
301 * dma_unmap_single() above.
302 */
303#ifndef CONFIG_DMABOUNCE
304static inline void
305dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
306 enum dma_data_direction dir)
307{
308
309 /* nothing to do */
310}
311#else
312extern void dma_unmap_sg(struct device *, struct scatterlist *, int, enum dma_data_direction);
313#endif
314
315
316/**
317 * dma_sync_single_for_cpu
318 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
319 * @handle: DMA address of buffer
320 * @size: size of buffer to map
321 * @dir: DMA transfer direction
322 *
323 * Make physical memory consistent for a single streaming mode DMA
324 * translation after a transfer.
325 *
326 * If you perform a dma_map_single() but wish to interrogate the
327 * buffer using the cpu, yet do not wish to teardown the PCI dma
328 * mapping, you must call this function before doing so. At the
329 * next point you give the PCI dma address back to the card, you
330 * must first the perform a dma_sync_for_device, and then the
331 * device again owns the buffer.
332 */
333#ifndef CONFIG_DMABOUNCE
334static inline void
335dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, size_t size,
336 enum dma_data_direction dir)
337{
338 if (!arch_is_coherent())
339 dma_cache_maint((void *)dma_to_virt(dev, handle), size, dir);
340}
341
342static inline void
343dma_sync_single_for_device(struct device *dev, dma_addr_t handle, size_t size,
344 enum dma_data_direction dir)
345{
346 if (!arch_is_coherent())
347 dma_cache_maint((void *)dma_to_virt(dev, handle), size, dir);
348}
349#else
350extern void dma_sync_single_for_cpu(struct device*, dma_addr_t, size_t, enum dma_data_direction);
351extern void dma_sync_single_for_device(struct device*, dma_addr_t, size_t, enum dma_data_direction);
352#endif
353
354
355/**
356 * dma_sync_sg_for_cpu
357 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
358 * @sg: list of buffers
359 * @nents: number of buffers to map
360 * @dir: DMA transfer direction
361 *
362 * Make physical memory consistent for a set of streaming
363 * mode DMA translations after a transfer.
364 *
365 * The same as dma_sync_single_for_* but for a scatter-gather list,
366 * same rules and usage.
367 */
368#ifndef CONFIG_DMABOUNCE
369static inline void
370dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
371 enum dma_data_direction dir)
372{
373 int i;
374
375 for (i = 0; i < nents; i++, sg++) {
376 char *virt = sg_virt(sg);
377 if (!arch_is_coherent())
378 dma_cache_maint(virt, sg->length, dir);
379 }
380}
381
382static inline void
383dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
384 enum dma_data_direction dir)
385{
386 int i;
387
388 for (i = 0; i < nents; i++, sg++) {
389 char *virt = sg_virt(sg);
390 if (!arch_is_coherent())
391 dma_cache_maint(virt, sg->length, dir);
392 }
393}
394#else
395extern void dma_sync_sg_for_cpu(struct device*, struct scatterlist*, int, enum dma_data_direction);
396extern void dma_sync_sg_for_device(struct device*, struct scatterlist*, int, enum dma_data_direction);
397#endif
398
399#ifdef CONFIG_DMABOUNCE
400/*
401 * For SA-1111, IXP425, and ADI systems the dma-mapping functions are "magic"
402 * and utilize bounce buffers as needed to work around limited DMA windows.
403 *
404 * On the SA-1111, a bug limits DMA to only certain regions of RAM.
405 * On the IXP425, the PCI inbound window is 64MB (256MB total RAM)
406 * On some ADI engineering systems, PCI inbound window is 32MB (12MB total RAM)
407 *
408 * The following are helper functions used by the dmabounce subystem
409 *
410 */
411
412/**
413 * dmabounce_register_dev
414 *
415 * @dev: valid struct device pointer
416 * @small_buf_size: size of buffers to use with small buffer pool
417 * @large_buf_size: size of buffers to use with large buffer pool (can be 0)
418 *
419 * This function should be called by low-level platform code to register
420 * a device as requireing DMA buffer bouncing. The function will allocate
421 * appropriate DMA pools for the device.
422 *
423 */
424extern int dmabounce_register_dev(struct device *, unsigned long, unsigned long);
425
426/**
427 * dmabounce_unregister_dev
428 *
429 * @dev: valid struct device pointer
430 *
431 * This function should be called by low-level platform code when device
432 * that was previously registered with dmabounce_register_dev is removed
433 * from the system.
434 *
435 */
436extern void dmabounce_unregister_dev(struct device *);
437
438/**
439 * dma_needs_bounce
440 *
441 * @dev: valid struct device pointer
442 * @dma_handle: dma_handle of unbounced buffer
443 * @size: size of region being mapped
444 *
445 * Platforms that utilize the dmabounce mechanism must implement
446 * this function.
447 *
448 * The dmabounce routines call this function whenever a dma-mapping
449 * is requested to determine whether a given buffer needs to be bounced
450 * or not. The function must return 0 if the buffer is OK for
451 * DMA access and 1 if the buffer needs to be bounced.
452 *
453 */
454extern int dma_needs_bounce(struct device*, dma_addr_t, size_t);
455#endif /* CONFIG_DMABOUNCE */
456
457#endif /* __KERNEL__ */
458#endif
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
new file mode 100644
index 000000000000..75154b193117
--- /dev/null
+++ b/arch/arm/include/asm/dma.h
@@ -0,0 +1,143 @@
1#ifndef __ASM_ARM_DMA_H
2#define __ASM_ARM_DMA_H
3
4typedef unsigned int dmach_t;
5
6#include <linux/spinlock.h>
7#include <asm/system.h>
8#include <asm/scatterlist.h>
9#include <mach/dma.h>
10
11/*
12 * This is the maximum virtual address which can be DMA'd from.
13 */
14#ifndef MAX_DMA_ADDRESS
15#define MAX_DMA_ADDRESS 0xffffffff
16#endif
17
18/*
19 * DMA modes
20 */
21typedef unsigned int dmamode_t;
22
23#define DMA_MODE_MASK 3
24
25#define DMA_MODE_READ 0
26#define DMA_MODE_WRITE 1
27#define DMA_MODE_CASCADE 2
28#define DMA_AUTOINIT 4
29
30extern spinlock_t dma_spin_lock;
31
32static inline unsigned long claim_dma_lock(void)
33{
34 unsigned long flags;
35 spin_lock_irqsave(&dma_spin_lock, flags);
36 return flags;
37}
38
39static inline void release_dma_lock(unsigned long flags)
40{
41 spin_unlock_irqrestore(&dma_spin_lock, flags);
42}
43
44/* Clear the 'DMA Pointer Flip Flop'.
45 * Write 0 for LSB/MSB, 1 for MSB/LSB access.
46 */
47#define clear_dma_ff(channel)
48
49/* Set only the page register bits of the transfer address.
50 *
51 * NOTE: This is an architecture specific function, and should
52 * be hidden from the drivers
53 */
54extern void set_dma_page(dmach_t channel, char pagenr);
55
56/* Request a DMA channel
57 *
58 * Some architectures may need to do allocate an interrupt
59 */
60extern int request_dma(dmach_t channel, const char * device_id);
61
62/* Free a DMA channel
63 *
64 * Some architectures may need to do free an interrupt
65 */
66extern void free_dma(dmach_t channel);
67
68/* Enable DMA for this channel
69 *
70 * On some architectures, this may have other side effects like
71 * enabling an interrupt and setting the DMA registers.
72 */
73extern void enable_dma(dmach_t channel);
74
75/* Disable DMA for this channel
76 *
77 * On some architectures, this may have other side effects like
78 * disabling an interrupt or whatever.
79 */
80extern void disable_dma(dmach_t channel);
81
82/* Test whether the specified channel has an active DMA transfer
83 */
84extern int dma_channel_active(dmach_t channel);
85
86/* Set the DMA scatter gather list for this channel
87 *
88 * This should not be called if a DMA channel is enabled,
89 * especially since some DMA architectures don't update the
90 * DMA address immediately, but defer it to the enable_dma().
91 */
92extern void set_dma_sg(dmach_t channel, struct scatterlist *sg, int nr_sg);
93
94/* Set the DMA address for this channel
95 *
96 * This should not be called if a DMA channel is enabled,
97 * especially since some DMA architectures don't update the
98 * DMA address immediately, but defer it to the enable_dma().
99 */
100extern void __set_dma_addr(dmach_t channel, void *addr);
101#define set_dma_addr(channel, addr) \
102 __set_dma_addr(channel, bus_to_virt(addr))
103
104/* Set the DMA byte count for this channel
105 *
106 * This should not be called if a DMA channel is enabled,
107 * especially since some DMA architectures don't update the
108 * DMA count immediately, but defer it to the enable_dma().
109 */
110extern void set_dma_count(dmach_t channel, unsigned long count);
111
112/* Set the transfer direction for this channel
113 *
114 * This should not be called if a DMA channel is enabled,
115 * especially since some DMA architectures don't update the
116 * DMA transfer direction immediately, but defer it to the
117 * enable_dma().
118 */
119extern void set_dma_mode(dmach_t channel, dmamode_t mode);
120
121/* Set the transfer speed for this channel
122 */
123extern void set_dma_speed(dmach_t channel, int cycle_ns);
124
125/* Get DMA residue count. After a DMA transfer, this
126 * should return zero. Reading this while a DMA transfer is
127 * still in progress will return unpredictable results.
128 * If called before the channel has been used, it may return 1.
129 * Otherwise, it returns the number of _bytes_ left to transfer.
130 */
131extern int get_dma_residue(dmach_t channel);
132
133#ifndef NO_DMA
134#define NO_DMA 255
135#endif
136
137#ifdef CONFIG_PCI
138extern int isa_dma_bridge_buggy;
139#else
140#define isa_dma_bridge_buggy (0)
141#endif
142
143#endif /* _ARM_DMA_H */
diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
new file mode 100644
index 000000000000..cc7ef4080711
--- /dev/null
+++ b/arch/arm/include/asm/domain.h
@@ -0,0 +1,78 @@
1/*
2 * arch/arm/include/asm/domain.h
3 *
4 * Copyright (C) 1999 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_PROC_DOMAIN_H
11#define __ASM_PROC_DOMAIN_H
12
13/*
14 * Domain numbers
15 *
16 * DOMAIN_IO - domain 2 includes all IO only
17 * DOMAIN_USER - domain 1 includes all user memory only
18 * DOMAIN_KERNEL - domain 0 includes all kernel memory only
19 *
20 * The domain numbering depends on whether we support 36 physical
21 * address for I/O or not. Addresses above the 32 bit boundary can
22 * only be mapped using supersections and supersections can only
23 * be set for domain 0. We could just default to DOMAIN_IO as zero,
24 * but there may be systems with supersection support and no 36-bit
25 * addressing. In such cases, we want to map system memory with
26 * supersections to reduce TLB misses and footprint.
27 *
28 * 36-bit addressing and supersections are only available on
29 * CPUs based on ARMv6+ or the Intel XSC3 core.
30 */
31#ifndef CONFIG_IO_36
32#define DOMAIN_KERNEL 0
33#define DOMAIN_TABLE 0
34#define DOMAIN_USER 1
35#define DOMAIN_IO 2
36#else
37#define DOMAIN_KERNEL 2
38#define DOMAIN_TABLE 2
39#define DOMAIN_USER 1
40#define DOMAIN_IO 0
41#endif
42
43/*
44 * Domain types
45 */
46#define DOMAIN_NOACCESS 0
47#define DOMAIN_CLIENT 1
48#define DOMAIN_MANAGER 3
49
50#define domain_val(dom,type) ((type) << (2*(dom)))
51
52#ifndef __ASSEMBLY__
53
54#ifdef CONFIG_MMU
55#define set_domain(x) \
56 do { \
57 __asm__ __volatile__( \
58 "mcr p15, 0, %0, c3, c0 @ set domain" \
59 : : "r" (x)); \
60 isb(); \
61 } while (0)
62
63#define modify_domain(dom,type) \
64 do { \
65 struct thread_info *thread = current_thread_info(); \
66 unsigned int domain = thread->cpu_domain; \
67 domain &= ~domain_val(dom, DOMAIN_MANAGER); \
68 thread->cpu_domain = domain | domain_val(dom, type); \
69 set_domain(thread->cpu_domain); \
70 } while (0)
71
72#else
73#define set_domain(x) do { } while (0)
74#define modify_domain(dom,type) do { } while (0)
75#endif
76
77#endif
78#endif /* !__ASSEMBLY__ */
diff --git a/arch/arm/include/asm/ecard.h b/arch/arm/include/asm/ecard.h
new file mode 100644
index 000000000000..29f2610efc70
--- /dev/null
+++ b/arch/arm/include/asm/ecard.h
@@ -0,0 +1,219 @@
1/*
2 * arch/arm/include/asm/ecard.h
3 *
4 * definitions for expansion cards
5 *
6 * This is a new system as from Linux 1.2.3
7 *
8 * Changelog:
9 * 11-12-1996 RMK Further minor improvements
10 * 12-09-1997 RMK Added interrupt enable/disable for card level
11 *
12 * Reference: Acorns Risc OS 3 Programmers Reference Manuals.
13 */
14
15#ifndef __ASM_ECARD_H
16#define __ASM_ECARD_H
17
18/*
19 * Currently understood cards (but not necessarily
20 * supported):
21 * Manufacturer Product ID
22 */
23#define MANU_ACORN 0x0000
24#define PROD_ACORN_SCSI 0x0002
25#define PROD_ACORN_ETHER1 0x0003
26#define PROD_ACORN_MFM 0x000b
27
28#define MANU_ANT2 0x0011
29#define PROD_ANT_ETHER3 0x00a4
30
31#define MANU_ATOMWIDE 0x0017
32#define PROD_ATOMWIDE_3PSERIAL 0x0090
33
34#define MANU_IRLAM_INSTRUMENTS 0x001f
35#define MANU_IRLAM_INSTRUMENTS_ETHERN 0x5678
36
37#define MANU_OAK 0x0021
38#define PROD_OAK_SCSI 0x0058
39
40#define MANU_MORLEY 0x002b
41#define PROD_MORLEY_SCSI_UNCACHED 0x0067
42
43#define MANU_CUMANA 0x003a
44#define PROD_CUMANA_SCSI_2 0x003a
45#define PROD_CUMANA_SCSI_1 0x00a0
46
47#define MANU_ICS 0x003c
48#define PROD_ICS_IDE 0x00ae
49
50#define MANU_ICS2 0x003d
51#define PROD_ICS2_IDE 0x00ae
52
53#define MANU_SERPORT 0x003f
54#define PROD_SERPORT_DSPORT 0x00b9
55
56#define MANU_ARXE 0x0041
57#define PROD_ARXE_SCSI 0x00be
58
59#define MANU_I3 0x0046
60#define PROD_I3_ETHERLAN500 0x00d4
61#define PROD_I3_ETHERLAN600 0x00ec
62#define PROD_I3_ETHERLAN600A 0x011e
63
64#define MANU_ANT 0x0053
65#define PROD_ANT_ETHERM 0x00d8
66#define PROD_ANT_ETHERB 0x00e4
67
68#define MANU_ALSYSTEMS 0x005b
69#define PROD_ALSYS_SCSIATAPI 0x0107
70
71#define MANU_MCS 0x0063
72#define PROD_MCS_CONNECT32 0x0125
73
74#define MANU_EESOX 0x0064
75#define PROD_EESOX_SCSI2 0x008c
76
77#define MANU_YELLOWSTONE 0x0096
78#define PROD_YELLOWSTONE_RAPIDE32 0x0120
79
80#ifdef ECARD_C
81#define CONST
82#else
83#define CONST const
84#endif
85
86#define MAX_ECARDS 9
87
88struct ecard_id { /* Card ID structure */
89 unsigned short manufacturer;
90 unsigned short product;
91 void *data;
92};
93
94struct in_ecid { /* Packed card ID information */
95 unsigned short product; /* Product code */
96 unsigned short manufacturer; /* Manufacturer code */
97 unsigned char id:4; /* Simple ID */
98 unsigned char cd:1; /* Chunk dir present */
99 unsigned char is:1; /* Interrupt status pointers */
100 unsigned char w:2; /* Width */
101 unsigned char country; /* Country */
102 unsigned char irqmask; /* IRQ mask */
103 unsigned char fiqmask; /* FIQ mask */
104 unsigned long irqoff; /* IRQ offset */
105 unsigned long fiqoff; /* FIQ offset */
106};
107
108typedef struct expansion_card ecard_t;
109typedef unsigned long *loader_t;
110
111typedef struct expansion_card_ops { /* Card handler routines */
112 void (*irqenable)(ecard_t *ec, int irqnr);
113 void (*irqdisable)(ecard_t *ec, int irqnr);
114 int (*irqpending)(ecard_t *ec);
115 void (*fiqenable)(ecard_t *ec, int fiqnr);
116 void (*fiqdisable)(ecard_t *ec, int fiqnr);
117 int (*fiqpending)(ecard_t *ec);
118} expansioncard_ops_t;
119
120#define ECARD_NUM_RESOURCES (6)
121
122#define ECARD_RES_IOCSLOW (0)
123#define ECARD_RES_IOCMEDIUM (1)
124#define ECARD_RES_IOCFAST (2)
125#define ECARD_RES_IOCSYNC (3)
126#define ECARD_RES_MEMC (4)
127#define ECARD_RES_EASI (5)
128
129#define ecard_resource_start(ec,nr) ((ec)->resource[nr].start)
130#define ecard_resource_end(ec,nr) ((ec)->resource[nr].end)
131#define ecard_resource_len(ec,nr) ((ec)->resource[nr].end - \
132 (ec)->resource[nr].start + 1)
133#define ecard_resource_flags(ec,nr) ((ec)->resource[nr].flags)
134
135/*
136 * This contains all the info needed on an expansion card
137 */
138struct expansion_card {
139 struct expansion_card *next;
140
141 struct device dev;
142 struct resource resource[ECARD_NUM_RESOURCES];
143
144 /* Public data */
145 void __iomem *irqaddr; /* address of IRQ register */
146 void __iomem *fiqaddr; /* address of FIQ register */
147 unsigned char irqmask; /* IRQ mask */
148 unsigned char fiqmask; /* FIQ mask */
149 unsigned char claimed; /* Card claimed? */
150 unsigned char easi; /* EASI card */
151
152 void *irq_data; /* Data for use for IRQ by card */
153 void *fiq_data; /* Data for use for FIQ by card */
154 const expansioncard_ops_t *ops; /* Enable/Disable Ops for card */
155
156 CONST unsigned int slot_no; /* Slot number */
157 CONST unsigned int dma; /* DMA number (for request_dma) */
158 CONST unsigned int irq; /* IRQ number (for request_irq) */
159 CONST unsigned int fiq; /* FIQ number (for request_irq) */
160 CONST struct in_ecid cid; /* Card Identification */
161
162 /* Private internal data */
163 const char *card_desc; /* Card description */
164 CONST unsigned int podaddr; /* Base Linux address for card */
165 CONST loader_t loader; /* loader program */
166 u64 dma_mask;
167};
168
169void ecard_setirq(struct expansion_card *ec, const struct expansion_card_ops *ops, void *irq_data);
170
171struct in_chunk_dir {
172 unsigned int start_offset;
173 union {
174 unsigned char string[256];
175 unsigned char data[1];
176 } d;
177};
178
179/*
180 * Read a chunk from an expansion card
181 * cd : where to put read data
182 * ec : expansion card info struct
183 * id : id number to find
184 * num: (n+1)'th id to find.
185 */
186extern int ecard_readchunk (struct in_chunk_dir *cd, struct expansion_card *ec, int id, int num);
187
188/*
189 * Request and release ecard resources
190 */
191extern int ecard_request_resources(struct expansion_card *ec);
192extern void ecard_release_resources(struct expansion_card *ec);
193
194void __iomem *ecardm_iomap(struct expansion_card *ec, unsigned int res,
195 unsigned long offset, unsigned long maxsize);
196#define ecardm_iounmap(__ec, __addr) devm_iounmap(&(__ec)->dev, __addr)
197
198extern struct bus_type ecard_bus_type;
199
200#define ECARD_DEV(_d) container_of((_d), struct expansion_card, dev)
201
202struct ecard_driver {
203 int (*probe)(struct expansion_card *, const struct ecard_id *id);
204 void (*remove)(struct expansion_card *);
205 void (*shutdown)(struct expansion_card *);
206 const struct ecard_id *id_table;
207 unsigned int id;
208 struct device_driver drv;
209};
210
211#define ECARD_DRV(_d) container_of((_d), struct ecard_driver, drv)
212
213#define ecard_set_drvdata(ec,data) dev_set_drvdata(&(ec)->dev, (data))
214#define ecard_get_drvdata(ec) dev_get_drvdata(&(ec)->dev)
215
216int ecard_register_driver(struct ecard_driver *);
217void ecard_remove_driver(struct ecard_driver *);
218
219#endif
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
new file mode 100644
index 000000000000..4ca751627489
--- /dev/null
+++ b/arch/arm/include/asm/elf.h
@@ -0,0 +1,116 @@
1#ifndef __ASMARM_ELF_H
2#define __ASMARM_ELF_H
3
4#include <asm/hwcap.h>
5
6#ifndef __ASSEMBLY__
7/*
8 * ELF register definitions..
9 */
10#include <asm/ptrace.h>
11#include <asm/user.h>
12
13typedef unsigned long elf_greg_t;
14typedef unsigned long elf_freg_t[3];
15
16#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
17typedef elf_greg_t elf_gregset_t[ELF_NGREG];
18
19typedef struct user_fp elf_fpregset_t;
20#endif
21
22#define EM_ARM 40
23#define EF_ARM_APCS26 0x08
24#define EF_ARM_SOFT_FLOAT 0x200
25#define EF_ARM_EABI_MASK 0xFF000000
26
27#define R_ARM_NONE 0
28#define R_ARM_PC24 1
29#define R_ARM_ABS32 2
30#define R_ARM_CALL 28
31#define R_ARM_JUMP24 29
32
33/*
34 * These are used to set parameters in the core dumps.
35 */
36#define ELF_CLASS ELFCLASS32
37#ifdef __ARMEB__
38#define ELF_DATA ELFDATA2MSB
39#else
40#define ELF_DATA ELFDATA2LSB
41#endif
42#define ELF_ARCH EM_ARM
43
44#ifndef __ASSEMBLY__
45/*
46 * This yields a string that ld.so will use to load implementation
47 * specific libraries for optimization. This is more specific in
48 * intent than poking at uname or /proc/cpuinfo.
49 *
50 * For now we just provide a fairly general string that describes the
51 * processor family. This could be made more specific later if someone
52 * implemented optimisations that require it. 26-bit CPUs give you
53 * "v1l" for ARM2 (no SWP) and "v2l" for anything else (ARM1 isn't
54 * supported). 32-bit CPUs give you "v3[lb]" for anything based on an
55 * ARM6 or ARM7 core and "armv4[lb]" for anything based on a StrongARM-1
56 * core.
57 */
58#define ELF_PLATFORM_SIZE 8
59#define ELF_PLATFORM (elf_platform)
60
61extern char elf_platform[];
62#endif
63
64/*
65 * This is used to ensure we don't load something for the wrong architecture.
66 */
67#define elf_check_arch(x) ((x)->e_machine == EM_ARM && ELF_PROC_OK(x))
68
69/*
70 * 32-bit code is always OK. Some cpus can do 26-bit, some can't.
71 */
72#define ELF_PROC_OK(x) (ELF_THUMB_OK(x) && ELF_26BIT_OK(x))
73
74#define ELF_THUMB_OK(x) \
75 ((elf_hwcap & HWCAP_THUMB && ((x)->e_entry & 1) == 1) || \
76 ((x)->e_entry & 3) == 0)
77
78#define ELF_26BIT_OK(x) \
79 ((elf_hwcap & HWCAP_26BIT && (x)->e_flags & EF_ARM_APCS26) || \
80 ((x)->e_flags & EF_ARM_APCS26) == 0)
81
82#define USE_ELF_CORE_DUMP
83#define ELF_EXEC_PAGESIZE 4096
84
85/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
86 use of this is to invoke "./ld.so someprog" to test out a new version of
87 the loader. We need to make sure that it is out of the way of the program
88 that it will "exec", and that there is sufficient room for the brk. */
89
90#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
91
92/* When the program starts, a1 contains a pointer to a function to be
93 registered with atexit, as per the SVR4 ABI. A value of 0 means we
94 have no such handler. */
95#define ELF_PLAT_INIT(_r, load_addr) (_r)->ARM_r0 = 0
96
97/*
98 * Since the FPA coprocessor uses CP1 and CP2, and iWMMXt uses CP0
99 * and CP1, we only enable access to the iWMMXt coprocessor if the
100 * binary is EABI or softfloat (and thus, guaranteed not to use
101 * FPA instructions.)
102 */
103#define SET_PERSONALITY(ex, ibcs2) \
104 do { \
105 if ((ex).e_flags & EF_ARM_APCS26) { \
106 set_personality(PER_LINUX); \
107 } else { \
108 set_personality(PER_LINUX_32BIT); \
109 if (elf_hwcap & HWCAP_IWMMXT && (ex).e_flags & (EF_ARM_EABI_MASK | EF_ARM_SOFT_FLOAT)) \
110 set_thread_flag(TIF_USING_IWMMXT); \
111 else \
112 clear_thread_flag(TIF_USING_IWMMXT); \
113 } \
114 } while (0)
115
116#endif
diff --git a/arch/arm/include/asm/emergency-restart.h b/arch/arm/include/asm/emergency-restart.h
new file mode 100644
index 000000000000..108d8c48e42e
--- /dev/null
+++ b/arch/arm/include/asm/emergency-restart.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/arch/arm/include/asm/errno.h b/arch/arm/include/asm/errno.h
new file mode 100644
index 000000000000..6e60f0612bb6
--- /dev/null
+++ b/arch/arm/include/asm/errno.h
@@ -0,0 +1,6 @@
1#ifndef _ARM_ERRNO_H
2#define _ARM_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#endif
diff --git a/arch/arm/include/asm/fb.h b/arch/arm/include/asm/fb.h
new file mode 100644
index 000000000000..d92e99cd8c8a
--- /dev/null
+++ b/arch/arm/include/asm/fb.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/arch/arm/include/asm/fcntl.h b/arch/arm/include/asm/fcntl.h
new file mode 100644
index 000000000000..a80b6607b2ef
--- /dev/null
+++ b/arch/arm/include/asm/fcntl.h
@@ -0,0 +1,11 @@
1#ifndef _ARM_FCNTL_H
2#define _ARM_FCNTL_H
3
4#define O_DIRECTORY 040000 /* must be a directory */
5#define O_NOFOLLOW 0100000 /* don't follow links */
6#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
7#define O_LARGEFILE 0400000
8
9#include <asm-generic/fcntl.h>
10
11#endif
diff --git a/arch/arm/include/asm/fiq.h b/arch/arm/include/asm/fiq.h
new file mode 100644
index 000000000000..2242ce22ec6c
--- /dev/null
+++ b/arch/arm/include/asm/fiq.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/include/asm/fiq.h
3 *
4 * Support for FIQ on ARM architectures.
5 * Written by Philip Blundell <philb@gnu.org>, 1998
6 * Re-written by Russell King
7 */
8
9#ifndef __ASM_FIQ_H
10#define __ASM_FIQ_H
11
12#include <asm/ptrace.h>
13
14struct fiq_handler {
15 struct fiq_handler *next;
16 /* Name
17 */
18 const char *name;
19 /* Called to ask driver to relinquish/
20 * reacquire FIQ
21 * return zero to accept, or -<errno>
22 */
23 int (*fiq_op)(void *, int relinquish);
24 /* data for the relinquish/reacquire functions
25 */
26 void *dev_id;
27};
28
29extern int claim_fiq(struct fiq_handler *f);
30extern void release_fiq(struct fiq_handler *f);
31extern void set_fiq_handler(void *start, unsigned int length);
32extern void set_fiq_regs(struct pt_regs *regs);
33extern void get_fiq_regs(struct pt_regs *regs);
34extern void enable_fiq(int fiq);
35extern void disable_fiq(int fiq);
36
37#endif
diff --git a/arch/arm/include/asm/flat.h b/arch/arm/include/asm/flat.h
new file mode 100644
index 000000000000..1d77e51907f6
--- /dev/null
+++ b/arch/arm/include/asm/flat.h
@@ -0,0 +1,19 @@
1/*
2 * arch/arm/include/asm/flat.h -- uClinux flat-format executables
3 */
4
5#ifndef __ARM_FLAT_H__
6#define __ARM_FLAT_H__
7
8/* An odd number of words will be pushed after this alignment, so
9 deliberately misalign the value. */
10#define flat_stack_align(sp) sp = (void *)(((unsigned long)(sp) - 4) | 4)
11#define flat_argvp_envp_on_stack() 1
12#define flat_old_ram_flag(flags) (flags)
13#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
14#define flat_get_addr_from_rp(rp, relval, flags, persistent) get_unaligned(rp)
15#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp)
16#define flat_get_relocate_addr(rel) (rel)
17#define flat_set_persistent(relval, p) 0
18
19#endif /* __ARM_FLAT_H__ */
diff --git a/arch/arm/include/asm/floppy.h b/arch/arm/include/asm/floppy.h
new file mode 100644
index 000000000000..c9f03eccc9d8
--- /dev/null
+++ b/arch/arm/include/asm/floppy.h
@@ -0,0 +1,148 @@
1/*
2 * arch/arm/include/asm/floppy.h
3 *
4 * Copyright (C) 1996-2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Note that we don't touch FLOPPY_DMA nor FLOPPY_IRQ here
11 */
12#ifndef __ASM_ARM_FLOPPY_H
13#define __ASM_ARM_FLOPPY_H
14#if 0
15#include <mach/floppy.h>
16#endif
17
18#define fd_outb(val,port) \
19 do { \
20 if ((port) == FD_DOR) \
21 fd_setdor((val)); \
22 else \
23 outb((val),(port)); \
24 } while(0)
25
26#define fd_inb(port) inb((port))
27#define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
28 IRQF_DISABLED,"floppy",NULL)
29#define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL)
30#define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK)
31#define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK)
32
33static inline int fd_dma_setup(void *data, unsigned int length,
34 unsigned int mode, unsigned long addr)
35{
36 set_dma_mode(DMA_FLOPPY, mode);
37 __set_dma_addr(DMA_FLOPPY, data);
38 set_dma_count(DMA_FLOPPY, length);
39 virtual_dma_port = addr;
40 enable_dma(DMA_FLOPPY);
41 return 0;
42}
43#define fd_dma_setup fd_dma_setup
44
45#define fd_request_dma() request_dma(DMA_FLOPPY,"floppy")
46#define fd_free_dma() free_dma(DMA_FLOPPY)
47#define fd_disable_dma() disable_dma(DMA_FLOPPY)
48
49/* need to clean up dma.h */
50#define DMA_FLOPPYDISK DMA_FLOPPY
51
52/* Floppy_selects is the list of DOR's to select drive fd
53 *
54 * On initialisation, the floppy list is scanned, and the drives allocated
55 * in the order that they are found. This is done by seeking the drive
56 * to a non-zero track, and then restoring it to track 0. If an error occurs,
57 * then there is no floppy drive present. [to be put back in again]
58 */
59static unsigned char floppy_selects[2][4] =
60{
61 { 0x10, 0x21, 0x23, 0x33 },
62 { 0x10, 0x21, 0x23, 0x33 }
63};
64
65#define fd_setdor(dor) \
66do { \
67 int new_dor = (dor); \
68 if (new_dor & 0xf0) \
69 new_dor = (new_dor & 0x0c) | floppy_selects[fdc][new_dor & 3]; \
70 else \
71 new_dor &= 0x0c; \
72 outb(new_dor, FD_DOR); \
73} while (0)
74
75/*
76 * Someday, we'll automatically detect which drives are present...
77 */
78static inline void fd_scandrives (void)
79{
80#if 0
81 int floppy, drive_count;
82
83 fd_disable_irq();
84 raw_cmd = &default_raw_cmd;
85 raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_SEEK;
86 raw_cmd->track = 0;
87 raw_cmd->rate = ?;
88 drive_count = 0;
89 for (floppy = 0; floppy < 4; floppy ++) {
90 current_drive = drive_count;
91 /*
92 * Turn on floppy motor
93 */
94 if (start_motor(redo_fd_request))
95 continue;
96 /*
97 * Set up FDC
98 */
99 fdc_specify();
100 /*
101 * Tell FDC to recalibrate
102 */
103 output_byte(FD_RECALIBRATE);
104 LAST_OUT(UNIT(floppy));
105 /* wait for command to complete */
106 if (!successful) {
107 int i;
108 for (i = drive_count; i < 3; i--)
109 floppy_selects[fdc][i] = floppy_selects[fdc][i + 1];
110 floppy_selects[fdc][3] = 0;
111 floppy -= 1;
112 } else
113 drive_count++;
114 }
115#else
116 floppy_selects[0][0] = 0x10;
117 floppy_selects[0][1] = 0x21;
118 floppy_selects[0][2] = 0x23;
119 floppy_selects[0][3] = 0x33;
120#endif
121}
122
123#define FDC1 (0x3f0)
124
125#define FLOPPY0_TYPE 4
126#define FLOPPY1_TYPE 4
127
128#define N_FDC 1
129#define N_DRIVE 4
130
131#define CROSS_64KB(a,s) (0)
132
133/*
134 * This allows people to reverse the order of
135 * fd0 and fd1, in case their hardware is
136 * strangely connected (as some RiscPCs
137 * and A5000s seem to be).
138 */
139static void driveswap(int *ints, int dummy, int dummy2)
140{
141 floppy_selects[0][0] ^= floppy_selects[0][1];
142 floppy_selects[0][1] ^= floppy_selects[0][0];
143 floppy_selects[0][0] ^= floppy_selects[0][1];
144}
145
146#define EXTRA_FLOPPY_PARAMS ,{ "driveswap", &driveswap, NULL, 0, 0 }
147
148#endif
diff --git a/arch/arm/include/asm/fpstate.h b/arch/arm/include/asm/fpstate.h
new file mode 100644
index 000000000000..ee5e03efc1bb
--- /dev/null
+++ b/arch/arm/include/asm/fpstate.h
@@ -0,0 +1,93 @@
1/*
2 * arch/arm/include/asm/fpstate.h
3 *
4 * Copyright (C) 1995 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARM_FPSTATE_H
12#define __ASM_ARM_FPSTATE_H
13
14
15#ifndef __ASSEMBLY__
16
17/*
18 * VFP storage area has:
19 * - FPEXC, FPSCR, FPINST and FPINST2.
20 * - 16 or 32 double precision data registers
21 * - an implementation-dependant word of state for FLDMX/FSTMX (pre-ARMv6)
22 *
23 * FPEXC will always be non-zero once the VFP has been used in this process.
24 */
25
26struct vfp_hard_struct {
27#ifdef CONFIG_VFPv3
28 __u64 fpregs[32];
29#else
30 __u64 fpregs[16];
31#endif
32#if __LINUX_ARM_ARCH__ < 6
33 __u32 fpmx_state;
34#endif
35 __u32 fpexc;
36 __u32 fpscr;
37 /*
38 * VFP implementation specific state
39 */
40 __u32 fpinst;
41 __u32 fpinst2;
42
43#ifdef CONFIG_SMP
44 __u32 cpu;
45#endif
46};
47
48union vfp_state {
49 struct vfp_hard_struct hard;
50};
51
52extern void vfp_flush_thread(union vfp_state *);
53extern void vfp_release_thread(union vfp_state *);
54
55#define FP_HARD_SIZE 35
56
57struct fp_hard_struct {
58 unsigned int save[FP_HARD_SIZE]; /* as yet undefined */
59};
60
61#define FP_SOFT_SIZE 35
62
63struct fp_soft_struct {
64 unsigned int save[FP_SOFT_SIZE]; /* undefined information */
65};
66
67#define IWMMXT_SIZE 0x98
68
69struct iwmmxt_struct {
70 unsigned int save[IWMMXT_SIZE / sizeof(unsigned int)];
71};
72
73union fp_state {
74 struct fp_hard_struct hard;
75 struct fp_soft_struct soft;
76#ifdef CONFIG_IWMMXT
77 struct iwmmxt_struct iwmmxt;
78#endif
79};
80
81#define FP_SIZE (sizeof(union fp_state) / sizeof(int))
82
83struct crunch_state {
84 unsigned int mvdx[16][2];
85 unsigned int mvax[4][3];
86 unsigned int dspsc[2];
87};
88
89#define CRUNCH_SIZE sizeof(struct crunch_state)
90
91#endif
92
93#endif
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
new file mode 100644
index 000000000000..584ef9a8e5a5
--- /dev/null
+++ b/arch/arm/include/asm/ftrace.h
@@ -0,0 +1,14 @@
1#ifndef _ASM_ARM_FTRACE
2#define _ASM_ARM_FTRACE
3
4#ifdef CONFIG_FTRACE
5#define MCOUNT_ADDR ((long)(mcount))
6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
7
8#ifndef __ASSEMBLY__
9extern void mcount(void);
10#endif
11
12#endif
13
14#endif /* _ASM_ARM_FTRACE */
diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
new file mode 100644
index 000000000000..6a332a9f099c
--- /dev/null
+++ b/arch/arm/include/asm/futex.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#include <asm-generic/futex.h>
5
6#endif
diff --git a/arch/arm/include/asm/glue.h b/arch/arm/include/asm/glue.h
new file mode 100644
index 000000000000..a0e39d5d00c9
--- /dev/null
+++ b/arch/arm/include/asm/glue.h
@@ -0,0 +1,149 @@
1/*
2 * arch/arm/include/asm/glue.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 * Copyright (C) 2000-2002 Deep Blue Solutions Ltd.
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 file provides the glue to stick the processor-specific bits
12 * into the kernel in an efficient manner. The idea is to use branches
13 * when we're only targetting one class of TLB, or indirect calls
14 * when we're targetting multiple classes of TLBs.
15 */
16#ifdef __KERNEL__
17
18
19#ifdef __STDC__
20#define ____glue(name,fn) name##fn
21#else
22#define ____glue(name,fn) name/**/fn
23#endif
24#define __glue(name,fn) ____glue(name,fn)
25
26
27
28/*
29 * Data Abort Model
30 * ================
31 *
32 * We have the following to choose from:
33 * arm6 - ARM6 style
34 * arm7 - ARM7 style
35 * v4_early - ARMv4 without Thumb early abort handler
36 * v4t_late - ARMv4 with Thumb late abort handler
37 * v4t_early - ARMv4 with Thumb early abort handler
38 * v5tej_early - ARMv5 with Thumb and Java early abort handler
39 * xscale - ARMv5 with Thumb with Xscale extensions
40 * v6_early - ARMv6 generic early abort handler
41 * v7_early - ARMv7 generic early abort handler
42 */
43#undef CPU_DABORT_HANDLER
44#undef MULTI_DABORT
45
46#if defined(CONFIG_CPU_ARM610)
47# ifdef CPU_DABORT_HANDLER
48# define MULTI_DABORT 1
49# else
50# define CPU_DABORT_HANDLER cpu_arm6_data_abort
51# endif
52#endif
53
54#if defined(CONFIG_CPU_ARM710)
55# ifdef CPU_DABORT_HANDLER
56# define MULTI_DABORT 1
57# else
58# define CPU_DABORT_HANDLER cpu_arm7_data_abort
59# endif
60#endif
61
62#ifdef CONFIG_CPU_ABRT_LV4T
63# ifdef CPU_DABORT_HANDLER
64# define MULTI_DABORT 1
65# else
66# define CPU_DABORT_HANDLER v4t_late_abort
67# endif
68#endif
69
70#ifdef CONFIG_CPU_ABRT_EV4
71# ifdef CPU_DABORT_HANDLER
72# define MULTI_DABORT 1
73# else
74# define CPU_DABORT_HANDLER v4_early_abort
75# endif
76#endif
77
78#ifdef CONFIG_CPU_ABRT_EV4T
79# ifdef CPU_DABORT_HANDLER
80# define MULTI_DABORT 1
81# else
82# define CPU_DABORT_HANDLER v4t_early_abort
83# endif
84#endif
85
86#ifdef CONFIG_CPU_ABRT_EV5TJ
87# ifdef CPU_DABORT_HANDLER
88# define MULTI_DABORT 1
89# else
90# define CPU_DABORT_HANDLER v5tj_early_abort
91# endif
92#endif
93
94#ifdef CONFIG_CPU_ABRT_EV5T
95# ifdef CPU_DABORT_HANDLER
96# define MULTI_DABORT 1
97# else
98# define CPU_DABORT_HANDLER v5t_early_abort
99# endif
100#endif
101
102#ifdef CONFIG_CPU_ABRT_EV6
103# ifdef CPU_DABORT_HANDLER
104# define MULTI_DABORT 1
105# else
106# define CPU_DABORT_HANDLER v6_early_abort
107# endif
108#endif
109
110#ifdef CONFIG_CPU_ABRT_EV7
111# ifdef CPU_DABORT_HANDLER
112# define MULTI_DABORT 1
113# else
114# define CPU_DABORT_HANDLER v7_early_abort
115# endif
116#endif
117
118#ifndef CPU_DABORT_HANDLER
119#error Unknown data abort handler type
120#endif
121
122/*
123 * Prefetch abort handler. If the CPU has an IFAR use that, otherwise
124 * use the address of the aborted instruction
125 */
126#undef CPU_PABORT_HANDLER
127#undef MULTI_PABORT
128
129#ifdef CONFIG_CPU_PABRT_IFAR
130# ifdef CPU_PABORT_HANDLER
131# define MULTI_PABORT 1
132# else
133# define CPU_PABORT_HANDLER(reg, insn) mrc p15, 0, reg, cr6, cr0, 2
134# endif
135#endif
136
137#ifdef CONFIG_CPU_PABRT_NOIFAR
138# ifdef CPU_PABORT_HANDLER
139# define MULTI_PABORT 1
140# else
141# define CPU_PABORT_HANDLER(reg, insn) mov reg, insn
142# endif
143#endif
144
145#ifndef CPU_PABORT_HANDLER
146#error Unknown prefetch abort handler type
147#endif
148
149#endif
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
new file mode 100644
index 000000000000..166a7a3e2840
--- /dev/null
+++ b/arch/arm/include/asm/gpio.h
@@ -0,0 +1,7 @@
1#ifndef _ARCH_ARM_GPIO_H
2#define _ARCH_ARM_GPIO_H
3
4/* not all ARM platforms necessarily support this API ... */
5#include <mach/gpio.h>
6
7#endif /* _ARCH_ARM_GPIO_H */
diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h
new file mode 100644
index 000000000000..182310b99195
--- /dev/null
+++ b/arch/arm/include/asm/hardirq.h
@@ -0,0 +1,32 @@
1#ifndef __ASM_HARDIRQ_H
2#define __ASM_HARDIRQ_H
3
4#include <linux/cache.h>
5#include <linux/threads.h>
6#include <asm/irq.h>
7
8typedef struct {
9 unsigned int __softirq_pending;
10 unsigned int local_timer_irqs;
11} ____cacheline_aligned irq_cpustat_t;
12
13#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
14
15#if NR_IRQS > 256
16#define HARDIRQ_BITS 9
17#else
18#define HARDIRQ_BITS 8
19#endif
20
21/*
22 * The hardirq mask has to be large enough to have space
23 * for potentially all IRQ sources in the system nesting
24 * on a single CPU:
25 */
26#if (1 << HARDIRQ_BITS) < NR_IRQS
27# error HARDIRQ_BITS is too low!
28#endif
29
30#define __ARCH_IRQ_EXIT_IRQS_DISABLED 1
31
32#endif /* __ASM_HARDIRQ_H */
diff --git a/arch/arm/include/asm/hardware/arm_timer.h b/arch/arm/include/asm/hardware/arm_timer.h
new file mode 100644
index 000000000000..04be3bdf46b8
--- /dev/null
+++ b/arch/arm/include/asm/hardware/arm_timer.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_ARM_HARDWARE_ARM_TIMER_H
2#define __ASM_ARM_HARDWARE_ARM_TIMER_H
3
4#define TIMER_LOAD 0x00
5#define TIMER_VALUE 0x04
6#define TIMER_CTRL 0x08
7#define TIMER_CTRL_ONESHOT (1 << 0)
8#define TIMER_CTRL_32BIT (1 << 1)
9#define TIMER_CTRL_DIV1 (0 << 2)
10#define TIMER_CTRL_DIV16 (1 << 2)
11#define TIMER_CTRL_DIV256 (2 << 2)
12#define TIMER_CTRL_IE (1 << 5) /* Interrupt Enable (versatile only) */
13#define TIMER_CTRL_PERIODIC (1 << 6)
14#define TIMER_CTRL_ENABLE (1 << 7)
15
16#define TIMER_INTCLR 0x0c
17#define TIMER_RIS 0x10
18#define TIMER_MIS 0x14
19#define TIMER_BGLOAD 0x18
20
21#endif
diff --git a/arch/arm/include/asm/hardware/arm_twd.h b/arch/arm/include/asm/hardware/arm_twd.h
new file mode 100644
index 000000000000..e521b70713c8
--- /dev/null
+++ b/arch/arm/include/asm/hardware/arm_twd.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_HARDWARE_TWD_H
2#define __ASM_HARDWARE_TWD_H
3
4#define TWD_TIMER_LOAD 0x00
5#define TWD_TIMER_COUNTER 0x04
6#define TWD_TIMER_CONTROL 0x08
7#define TWD_TIMER_INTSTAT 0x0C
8
9#define TWD_WDOG_LOAD 0x20
10#define TWD_WDOG_COUNTER 0x24
11#define TWD_WDOG_CONTROL 0x28
12#define TWD_WDOG_INTSTAT 0x2C
13#define TWD_WDOG_RESETSTAT 0x30
14#define TWD_WDOG_DISABLE 0x34
15
16#define TWD_TIMER_CONTROL_ENABLE (1 << 0)
17#define TWD_TIMER_CONTROL_ONESHOT (0 << 1)
18#define TWD_TIMER_CONTROL_PERIODIC (1 << 1)
19#define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2)
20
21#endif
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
new file mode 100644
index 000000000000..64f2252a25cd
--- /dev/null
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -0,0 +1,56 @@
1/*
2 * arch/arm/include/asm/hardware/cache-l2x0.h
3 *
4 * Copyright (C) 2007 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __ASM_ARM_HARDWARE_L2X0_H
21#define __ASM_ARM_HARDWARE_L2X0_H
22
23#define L2X0_CACHE_ID 0x000
24#define L2X0_CACHE_TYPE 0x004
25#define L2X0_CTRL 0x100
26#define L2X0_AUX_CTRL 0x104
27#define L2X0_EVENT_CNT_CTRL 0x200
28#define L2X0_EVENT_CNT1_CFG 0x204
29#define L2X0_EVENT_CNT0_CFG 0x208
30#define L2X0_EVENT_CNT1_VAL 0x20C
31#define L2X0_EVENT_CNT0_VAL 0x210
32#define L2X0_INTR_MASK 0x214
33#define L2X0_MASKED_INTR_STAT 0x218
34#define L2X0_RAW_INTR_STAT 0x21C
35#define L2X0_INTR_CLEAR 0x220
36#define L2X0_CACHE_SYNC 0x730
37#define L2X0_INV_LINE_PA 0x770
38#define L2X0_INV_WAY 0x77C
39#define L2X0_CLEAN_LINE_PA 0x7B0
40#define L2X0_CLEAN_LINE_IDX 0x7B8
41#define L2X0_CLEAN_WAY 0x7BC
42#define L2X0_CLEAN_INV_LINE_PA 0x7F0
43#define L2X0_CLEAN_INV_LINE_IDX 0x7F8
44#define L2X0_CLEAN_INV_WAY 0x7FC
45#define L2X0_LOCKDOWN_WAY_D 0x900
46#define L2X0_LOCKDOWN_WAY_I 0x904
47#define L2X0_TEST_OPERATION 0xF00
48#define L2X0_LINE_DATA 0xF10
49#define L2X0_LINE_TAG 0xF30
50#define L2X0_DEBUG_CTRL 0xF40
51
52#ifndef __ASSEMBLY__
53extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask);
54#endif
55
56#endif
diff --git a/arch/arm/include/asm/hardware/clps7111.h b/arch/arm/include/asm/hardware/clps7111.h
new file mode 100644
index 000000000000..44477225aed6
--- /dev/null
+++ b/arch/arm/include/asm/hardware/clps7111.h
@@ -0,0 +1,184 @@
1/*
2 * arch/arm/include/asm/hardware/clps7111.h
3 *
4 * This file contains the hardware definitions of the CLPS7111 internal
5 * registers.
6 *
7 * Copyright (C) 2000 Deep Blue Solutions Ltd.
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#ifndef __ASM_HARDWARE_CLPS7111_H
24#define __ASM_HARDWARE_CLPS7111_H
25
26#define CLPS7111_PHYS_BASE (0x80000000)
27
28#ifndef __ASSEMBLY__
29#define clps_readb(off) __raw_readb(CLPS7111_BASE + (off))
30#define clps_readw(off) __raw_readw(CLPS7111_BASE + (off))
31#define clps_readl(off) __raw_readl(CLPS7111_BASE + (off))
32#define clps_writeb(val,off) __raw_writeb(val, CLPS7111_BASE + (off))
33#define clps_writew(val,off) __raw_writew(val, CLPS7111_BASE + (off))
34#define clps_writel(val,off) __raw_writel(val, CLPS7111_BASE + (off))
35#endif
36
37#define PADR (0x0000)
38#define PBDR (0x0001)
39#define PDDR (0x0003)
40#define PADDR (0x0040)
41#define PBDDR (0x0041)
42#define PDDDR (0x0043)
43#define PEDR (0x0080)
44#define PEDDR (0x00c0)
45#define SYSCON1 (0x0100)
46#define SYSFLG1 (0x0140)
47#define MEMCFG1 (0x0180)
48#define MEMCFG2 (0x01c0)
49#define DRFPR (0x0200)
50#define INTSR1 (0x0240)
51#define INTMR1 (0x0280)
52#define LCDCON (0x02c0)
53#define TC1D (0x0300)
54#define TC2D (0x0340)
55#define RTCDR (0x0380)
56#define RTCMR (0x03c0)
57#define PMPCON (0x0400)
58#define CODR (0x0440)
59#define UARTDR1 (0x0480)
60#define UBRLCR1 (0x04c0)
61#define SYNCIO (0x0500)
62#define PALLSW (0x0540)
63#define PALMSW (0x0580)
64#define STFCLR (0x05c0)
65#define BLEOI (0x0600)
66#define MCEOI (0x0640)
67#define TEOI (0x0680)
68#define TC1EOI (0x06c0)
69#define TC2EOI (0x0700)
70#define RTCEOI (0x0740)
71#define UMSEOI (0x0780)
72#define COEOI (0x07c0)
73#define HALT (0x0800)
74#define STDBY (0x0840)
75
76#define FBADDR (0x1000)
77#define SYSCON2 (0x1100)
78#define SYSFLG2 (0x1140)
79#define INTSR2 (0x1240)
80#define INTMR2 (0x1280)
81#define UARTDR2 (0x1480)
82#define UBRLCR2 (0x14c0)
83#define SS2DR (0x1500)
84#define SRXEOF (0x1600)
85#define SS2POP (0x16c0)
86#define KBDEOI (0x1700)
87
88/* common bits: SYSCON1 / SYSCON2 */
89#define SYSCON_UARTEN (1 << 8)
90
91#define SYSCON1_KBDSCAN(x) ((x) & 15)
92#define SYSCON1_KBDSCANMASK (15)
93#define SYSCON1_TC1M (1 << 4)
94#define SYSCON1_TC1S (1 << 5)
95#define SYSCON1_TC2M (1 << 6)
96#define SYSCON1_TC2S (1 << 7)
97#define SYSCON1_UART1EN SYSCON_UARTEN
98#define SYSCON1_BZTOG (1 << 9)
99#define SYSCON1_BZMOD (1 << 10)
100#define SYSCON1_DBGEN (1 << 11)
101#define SYSCON1_LCDEN (1 << 12)
102#define SYSCON1_CDENTX (1 << 13)
103#define SYSCON1_CDENRX (1 << 14)
104#define SYSCON1_SIREN (1 << 15)
105#define SYSCON1_ADCKSEL(x) (((x) & 3) << 16)
106#define SYSCON1_ADCKSEL_MASK (3 << 16)
107#define SYSCON1_EXCKEN (1 << 18)
108#define SYSCON1_WAKEDIS (1 << 19)
109#define SYSCON1_IRTXM (1 << 20)
110
111/* common bits: SYSFLG1 / SYSFLG2 */
112#define SYSFLG_UBUSY (1 << 11)
113#define SYSFLG_URXFE (1 << 22)
114#define SYSFLG_UTXFF (1 << 23)
115
116#define SYSFLG1_MCDR (1 << 0)
117#define SYSFLG1_DCDET (1 << 1)
118#define SYSFLG1_WUDR (1 << 2)
119#define SYSFLG1_WUON (1 << 3)
120#define SYSFLG1_CTS (1 << 8)
121#define SYSFLG1_DSR (1 << 9)
122#define SYSFLG1_DCD (1 << 10)
123#define SYSFLG1_UBUSY SYSFLG_UBUSY
124#define SYSFLG1_NBFLG (1 << 12)
125#define SYSFLG1_RSTFLG (1 << 13)
126#define SYSFLG1_PFFLG (1 << 14)
127#define SYSFLG1_CLDFLG (1 << 15)
128#define SYSFLG1_URXFE SYSFLG_URXFE
129#define SYSFLG1_UTXFF SYSFLG_UTXFF
130#define SYSFLG1_CRXFE (1 << 24)
131#define SYSFLG1_CTXFF (1 << 25)
132#define SYSFLG1_SSIBUSY (1 << 26)
133#define SYSFLG1_ID (1 << 29)
134
135#define SYSFLG2_SSRXOF (1 << 0)
136#define SYSFLG2_RESVAL (1 << 1)
137#define SYSFLG2_RESFRM (1 << 2)
138#define SYSFLG2_SS2RXFE (1 << 3)
139#define SYSFLG2_SS2TXFF (1 << 4)
140#define SYSFLG2_SS2TXUF (1 << 5)
141#define SYSFLG2_CKMODE (1 << 6)
142#define SYSFLG2_UBUSY SYSFLG_UBUSY
143#define SYSFLG2_URXFE SYSFLG_URXFE
144#define SYSFLG2_UTXFF SYSFLG_UTXFF
145
146#define LCDCON_GSEN (1 << 30)
147#define LCDCON_GSMD (1 << 31)
148
149#define SYSCON2_SERSEL (1 << 0)
150#define SYSCON2_KBD6 (1 << 1)
151#define SYSCON2_DRAMZ (1 << 2)
152#define SYSCON2_KBWEN (1 << 3)
153#define SYSCON2_SS2TXEN (1 << 4)
154#define SYSCON2_PCCARD1 (1 << 5)
155#define SYSCON2_PCCARD2 (1 << 6)
156#define SYSCON2_SS2RXEN (1 << 7)
157#define SYSCON2_UART2EN SYSCON_UARTEN
158#define SYSCON2_SS2MAEN (1 << 9)
159#define SYSCON2_OSTB (1 << 12)
160#define SYSCON2_CLKENSL (1 << 13)
161#define SYSCON2_BUZFREQ (1 << 14)
162
163/* common bits: UARTDR1 / UARTDR2 */
164#define UARTDR_FRMERR (1 << 8)
165#define UARTDR_PARERR (1 << 9)
166#define UARTDR_OVERR (1 << 10)
167
168/* common bits: UBRLCR1 / UBRLCR2 */
169#define UBRLCR_BAUD_MASK ((1 << 12) - 1)
170#define UBRLCR_BREAK (1 << 12)
171#define UBRLCR_PRTEN (1 << 13)
172#define UBRLCR_EVENPRT (1 << 14)
173#define UBRLCR_XSTOP (1 << 15)
174#define UBRLCR_FIFOEN (1 << 16)
175#define UBRLCR_WRDLEN5 (0 << 17)
176#define UBRLCR_WRDLEN6 (1 << 17)
177#define UBRLCR_WRDLEN7 (2 << 17)
178#define UBRLCR_WRDLEN8 (3 << 17)
179#define UBRLCR_WRDLEN_MASK (3 << 17)
180
181#define SYNCIO_SMCKEN (1 << 13)
182#define SYNCIO_TXFRMEN (1 << 14)
183
184#endif /* __ASM_HARDWARE_CLPS7111_H */
diff --git a/arch/arm/include/asm/hardware/cs89712.h b/arch/arm/include/asm/hardware/cs89712.h
new file mode 100644
index 000000000000..f75626933e94
--- /dev/null
+++ b/arch/arm/include/asm/hardware/cs89712.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/include/asm/hardware/cs89712.h
3 *
4 * This file contains the hardware definitions of the CS89712
5 * additional internal registers.
6 *
7 * Copyright (C) 2001 Thomas Gleixner autronix automation <gleixner@autronix.de>
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24#ifndef __ASM_HARDWARE_CS89712_H
25#define __ASM_HARDWARE_CS89712_H
26
27/*
28* CS89712 additional registers
29*/
30
31#define PCDR 0x0002 /* Port C Data register ---------------------------- */
32#define PCDDR 0x0042 /* Port C Data Direction register ------------------ */
33#define SDCONF 0x2300 /* SDRAM Configuration register ---------------------*/
34#define SDRFPR 0x2340 /* SDRAM Refresh period register --------------------*/
35
36#define SDCONF_ACTIVE (1 << 10)
37#define SDCONF_CLKCTL (1 << 9)
38#define SDCONF_WIDTH_4 (0 << 7)
39#define SDCONF_WIDTH_8 (1 << 7)
40#define SDCONF_WIDTH_16 (2 << 7)
41#define SDCONF_WIDTH_32 (3 << 7)
42#define SDCONF_SIZE_16 (0 << 5)
43#define SDCONF_SIZE_64 (1 << 5)
44#define SDCONF_SIZE_128 (2 << 5)
45#define SDCONF_SIZE_256 (3 << 5)
46#define SDCONF_CASLAT_2 (2)
47#define SDCONF_CASLAT_3 (3)
48
49#endif /* __ASM_HARDWARE_CS89712_H */
diff --git a/arch/arm/include/asm/hardware/debug-8250.S b/arch/arm/include/asm/hardware/debug-8250.S
new file mode 100644
index 000000000000..22c689255e6e
--- /dev/null
+++ b/arch/arm/include/asm/hardware/debug-8250.S
@@ -0,0 +1,29 @@
1/*
2 * arch/arm/include/asm/hardware/debug-8250.S
3 *
4 * Copyright (C) 1994-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/serial_reg.h>
11
12 .macro senduart,rd,rx
13 strb \rd, [\rx, #UART_TX << UART_SHIFT]
14 .endm
15
16 .macro busyuart,rd,rx
171002: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT]
18 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
19 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
20 bne 1002b
21 .endm
22
23 .macro waituart,rd,rx
24#ifdef FLOW_CONTROL
251001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT]
26 tst \rd, #UART_MSR_CTS
27 beq 1001b
28#endif
29 .endm
diff --git a/arch/arm/include/asm/hardware/debug-pl01x.S b/arch/arm/include/asm/hardware/debug-pl01x.S
new file mode 100644
index 000000000000..f9fd083eff63
--- /dev/null
+++ b/arch/arm/include/asm/hardware/debug-pl01x.S
@@ -0,0 +1,29 @@
1/* arch/arm/include/asm/hardware/debug-pl01x.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#include <linux/amba/serial.h>
14
15 .macro senduart,rd,rx
16 strb \rd, [\rx, #UART01x_DR]
17 .endm
18
19 .macro waituart,rd,rx
201001: ldr \rd, [\rx, #UART01x_FR]
21 tst \rd, #UART01x_FR_TXFF
22 bne 1001b
23 .endm
24
25 .macro busyuart,rd,rx
261001: ldr \rd, [\rx, #UART01x_FR]
27 tst \rd, #UART01x_FR_BUSY
28 bne 1001b
29 .endm
diff --git a/arch/arm/include/asm/hardware/dec21285.h b/arch/arm/include/asm/hardware/dec21285.h
new file mode 100644
index 000000000000..0d7552751aaf
--- /dev/null
+++ b/arch/arm/include/asm/hardware/dec21285.h
@@ -0,0 +1,147 @@
1/*
2 * arch/arm/include/asm/hardware/dec21285.h
3 *
4 * Copyright (C) 1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * DC21285 registers
11 */
12#define DC21285_PCI_IACK 0x79000000
13#define DC21285_ARMCSR_BASE 0x42000000
14#define DC21285_PCI_TYPE_0_CONFIG 0x7b000000
15#define DC21285_PCI_TYPE_1_CONFIG 0x7a000000
16#define DC21285_OUTBOUND_WRITE_FLUSH 0x78000000
17#define DC21285_FLASH 0x41000000
18#define DC21285_PCI_IO 0x7c000000
19#define DC21285_PCI_MEM 0x80000000
20
21#ifndef __ASSEMBLY__
22#include <mach/hardware.h>
23#define DC21285_IO(x) ((volatile unsigned long *)(ARMCSR_BASE+(x)))
24#else
25#define DC21285_IO(x) (x)
26#endif
27
28#define CSR_PCICMD DC21285_IO(0x0004)
29#define CSR_CLASSREV DC21285_IO(0x0008)
30#define CSR_PCICACHELINESIZE DC21285_IO(0x000c)
31#define CSR_PCICSRBASE DC21285_IO(0x0010)
32#define CSR_PCICSRIOBASE DC21285_IO(0x0014)
33#define CSR_PCISDRAMBASE DC21285_IO(0x0018)
34#define CSR_PCIROMBASE DC21285_IO(0x0030)
35#define CSR_MBOX0 DC21285_IO(0x0050)
36#define CSR_MBOX1 DC21285_IO(0x0054)
37#define CSR_MBOX2 DC21285_IO(0x0058)
38#define CSR_MBOX3 DC21285_IO(0x005c)
39#define CSR_DOORBELL DC21285_IO(0x0060)
40#define CSR_DOORBELL_SETUP DC21285_IO(0x0064)
41#define CSR_ROMWRITEREG DC21285_IO(0x0068)
42#define CSR_CSRBASEMASK DC21285_IO(0x00f8)
43#define CSR_CSRBASEOFFSET DC21285_IO(0x00fc)
44#define CSR_SDRAMBASEMASK DC21285_IO(0x0100)
45#define CSR_SDRAMBASEOFFSET DC21285_IO(0x0104)
46#define CSR_ROMBASEMASK DC21285_IO(0x0108)
47#define CSR_SDRAMTIMING DC21285_IO(0x010c)
48#define CSR_SDRAMADDRSIZE0 DC21285_IO(0x0110)
49#define CSR_SDRAMADDRSIZE1 DC21285_IO(0x0114)
50#define CSR_SDRAMADDRSIZE2 DC21285_IO(0x0118)
51#define CSR_SDRAMADDRSIZE3 DC21285_IO(0x011c)
52#define CSR_I2O_INFREEHEAD DC21285_IO(0x0120)
53#define CSR_I2O_INPOSTTAIL DC21285_IO(0x0124)
54#define CSR_I2O_OUTPOSTHEAD DC21285_IO(0x0128)
55#define CSR_I2O_OUTFREETAIL DC21285_IO(0x012c)
56#define CSR_I2O_INFREECOUNT DC21285_IO(0x0130)
57#define CSR_I2O_OUTPOSTCOUNT DC21285_IO(0x0134)
58#define CSR_I2O_INPOSTCOUNT DC21285_IO(0x0138)
59#define CSR_SA110_CNTL DC21285_IO(0x013c)
60#define SA110_CNTL_INITCMPLETE (1 << 0)
61#define SA110_CNTL_ASSERTSERR (1 << 1)
62#define SA110_CNTL_RXSERR (1 << 3)
63#define SA110_CNTL_SA110DRAMPARITY (1 << 4)
64#define SA110_CNTL_PCISDRAMPARITY (1 << 5)
65#define SA110_CNTL_DMASDRAMPARITY (1 << 6)
66#define SA110_CNTL_DISCARDTIMER (1 << 8)
67#define SA110_CNTL_PCINRESET (1 << 9)
68#define SA110_CNTL_I2O_256 (0 << 10)
69#define SA110_CNTL_I20_512 (1 << 10)
70#define SA110_CNTL_I2O_1024 (2 << 10)
71#define SA110_CNTL_I2O_2048 (3 << 10)
72#define SA110_CNTL_I2O_4096 (4 << 10)
73#define SA110_CNTL_I2O_8192 (5 << 10)
74#define SA110_CNTL_I2O_16384 (6 << 10)
75#define SA110_CNTL_I2O_32768 (7 << 10)
76#define SA110_CNTL_WATCHDOG (1 << 13)
77#define SA110_CNTL_ROMWIDTH_UNDEF (0 << 14)
78#define SA110_CNTL_ROMWIDTH_16 (1 << 14)
79#define SA110_CNTL_ROMWIDTH_32 (2 << 14)
80#define SA110_CNTL_ROMWIDTH_8 (3 << 14)
81#define SA110_CNTL_ROMACCESSTIME(x) ((x)<<16)
82#define SA110_CNTL_ROMBURSTTIME(x) ((x)<<20)
83#define SA110_CNTL_ROMTRISTATETIME(x) ((x)<<24)
84#define SA110_CNTL_XCSDIR(x) ((x)<<28)
85#define SA110_CNTL_PCICFN (1 << 31)
86
87/*
88 * footbridge_cfn_mode() is used when we want
89 * to check whether we are the central function
90 */
91#define __footbridge_cfn_mode() (*CSR_SA110_CNTL & SA110_CNTL_PCICFN)
92#if defined(CONFIG_FOOTBRIDGE_HOST) && defined(CONFIG_FOOTBRIDGE_ADDIN)
93#define footbridge_cfn_mode() __footbridge_cfn_mode()
94#elif defined(CONFIG_FOOTBRIDGE_HOST)
95#define footbridge_cfn_mode() (1)
96#else
97#define footbridge_cfn_mode() (0)
98#endif
99
100#define CSR_PCIADDR_EXTN DC21285_IO(0x0140)
101#define CSR_PREFETCHMEMRANGE DC21285_IO(0x0144)
102#define CSR_XBUS_CYCLE DC21285_IO(0x0148)
103#define CSR_XBUS_IOSTROBE DC21285_IO(0x014c)
104#define CSR_DOORBELL_PCI DC21285_IO(0x0150)
105#define CSR_DOORBELL_SA110 DC21285_IO(0x0154)
106#define CSR_UARTDR DC21285_IO(0x0160)
107#define CSR_RXSTAT DC21285_IO(0x0164)
108#define CSR_H_UBRLCR DC21285_IO(0x0168)
109#define CSR_M_UBRLCR DC21285_IO(0x016c)
110#define CSR_L_UBRLCR DC21285_IO(0x0170)
111#define CSR_UARTCON DC21285_IO(0x0174)
112#define CSR_UARTFLG DC21285_IO(0x0178)
113#define CSR_IRQ_STATUS DC21285_IO(0x0180)
114#define CSR_IRQ_RAWSTATUS DC21285_IO(0x0184)
115#define CSR_IRQ_ENABLE DC21285_IO(0x0188)
116#define CSR_IRQ_DISABLE DC21285_IO(0x018c)
117#define CSR_IRQ_SOFT DC21285_IO(0x0190)
118#define CSR_FIQ_STATUS DC21285_IO(0x0280)
119#define CSR_FIQ_RAWSTATUS DC21285_IO(0x0284)
120#define CSR_FIQ_ENABLE DC21285_IO(0x0288)
121#define CSR_FIQ_DISABLE DC21285_IO(0x028c)
122#define CSR_FIQ_SOFT DC21285_IO(0x0290)
123#define CSR_TIMER1_LOAD DC21285_IO(0x0300)
124#define CSR_TIMER1_VALUE DC21285_IO(0x0304)
125#define CSR_TIMER1_CNTL DC21285_IO(0x0308)
126#define CSR_TIMER1_CLR DC21285_IO(0x030c)
127#define CSR_TIMER2_LOAD DC21285_IO(0x0320)
128#define CSR_TIMER2_VALUE DC21285_IO(0x0324)
129#define CSR_TIMER2_CNTL DC21285_IO(0x0328)
130#define CSR_TIMER2_CLR DC21285_IO(0x032c)
131#define CSR_TIMER3_LOAD DC21285_IO(0x0340)
132#define CSR_TIMER3_VALUE DC21285_IO(0x0344)
133#define CSR_TIMER3_CNTL DC21285_IO(0x0348)
134#define CSR_TIMER3_CLR DC21285_IO(0x034c)
135#define CSR_TIMER4_LOAD DC21285_IO(0x0360)
136#define CSR_TIMER4_VALUE DC21285_IO(0x0364)
137#define CSR_TIMER4_CNTL DC21285_IO(0x0368)
138#define CSR_TIMER4_CLR DC21285_IO(0x036c)
139
140#define TIMER_CNTL_ENABLE (1 << 7)
141#define TIMER_CNTL_AUTORELOAD (1 << 6)
142#define TIMER_CNTL_DIV1 (0)
143#define TIMER_CNTL_DIV16 (1 << 2)
144#define TIMER_CNTL_DIV256 (2 << 2)
145#define TIMER_CNTL_CNTEXT (3 << 2)
146
147
diff --git a/arch/arm/include/asm/hardware/entry-macro-iomd.S b/arch/arm/include/asm/hardware/entry-macro-iomd.S
new file mode 100644
index 000000000000..e0af4983723f
--- /dev/null
+++ b/arch/arm/include/asm/hardware/entry-macro-iomd.S
@@ -0,0 +1,139 @@
1/*
2 * arch/arm/include/asm/hardware/entry-macro-iomd.S
3 *
4 * Low-level IRQ helper macros for IOC/IOMD 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
11/* IOC / IOMD based hardware */
12#include <asm/hardware/iomd.h>
13
14 .macro disable_fiq
15 mov r12, #ioc_base_high
16 .if ioc_base_low
17 orr r12, r12, #ioc_base_low
18 .endif
19 strb r12, [r12, #0x38] @ Disable FIQ register
20 .endm
21
22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
23 ldrb \irqstat, [\base, #IOMD_IRQREQB] @ get high priority first
24 ldr \tmp, =irq_prio_h
25 teq \irqstat, #0
26#ifdef IOMD_BASE
27 ldreqb \irqstat, [\base, #IOMD_DMAREQ] @ get dma
28 addeq \tmp, \tmp, #256 @ irq_prio_h table size
29 teqeq \irqstat, #0
30 bne 2406f
31#endif
32 ldreqb \irqstat, [\base, #IOMD_IRQREQA] @ get low priority
33 addeq \tmp, \tmp, #256 @ irq_prio_d table size
34 teqeq \irqstat, #0
35#ifdef IOMD_IRQREQC
36 ldreqb \irqstat, [\base, #IOMD_IRQREQC]
37 addeq \tmp, \tmp, #256 @ irq_prio_l table size
38 teqeq \irqstat, #0
39#endif
40#ifdef IOMD_IRQREQD
41 ldreqb \irqstat, [\base, #IOMD_IRQREQD]
42 addeq \tmp, \tmp, #256 @ irq_prio_lc table size
43 teqeq \irqstat, #0
44#endif
452406: ldrneb \irqnr, [\tmp, \irqstat] @ get IRQ number
46 .endm
47
48/*
49 * Interrupt table (incorporates priority). Please note that we
50 * rely on the order of these tables (see above code).
51 */
52 .align 5
53irq_prio_h: .byte 0, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
54 .byte 12, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
55 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
56 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
57 .byte 14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
58 .byte 14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
59 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
60 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
61 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
62 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
63 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
64 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
65 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
66 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
67 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
68 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
69#ifdef IOMD_BASE
70irq_prio_d: .byte 0,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
71 .byte 20,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
72 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
73 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
74 .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
75 .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
76 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
77 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
78 .byte 23,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
79 .byte 23,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
80 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
81 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
82 .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
83 .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
84 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
85 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
86#endif
87irq_prio_l: .byte 0, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
88 .byte 4, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
89 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
90 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
91 .byte 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
92 .byte 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
93 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
94 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
95 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
96 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
97 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
98 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
99 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
100 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
101 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
102 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
103#ifdef IOMD_IRQREQC
104irq_prio_lc: .byte 24,24,25,24,26,26,26,26,27,27,27,27,27,27,27,27
105 .byte 28,24,25,24,26,26,26,26,27,27,27,27,27,27,27,27
106 .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
107 .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
108 .byte 30,30,30,30,30,30,30,30,27,27,27,27,27,27,27,27
109 .byte 30,30,30,30,30,30,30,30,27,27,27,27,27,27,27,27
110 .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
111 .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
112 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
113 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
114 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
115 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
116 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
117 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
118 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
119 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
120#endif
121#ifdef IOMD_IRQREQD
122irq_prio_ld: .byte 40,40,41,40,42,42,42,42,43,43,43,43,43,43,43,43
123 .byte 44,40,41,40,42,42,42,42,43,43,43,43,43,43,43,43
124 .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
125 .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
126 .byte 46,46,46,46,46,46,46,46,43,43,43,43,43,43,43,43
127 .byte 46,46,46,46,46,46,46,46,43,43,43,43,43,43,43,43
128 .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
129 .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
130 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
131 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
132 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
133 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
134 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
135 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
136 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
137 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
138#endif
139
diff --git a/arch/arm/include/asm/hardware/ep7211.h b/arch/arm/include/asm/hardware/ep7211.h
new file mode 100644
index 000000000000..654d5f625c49
--- /dev/null
+++ b/arch/arm/include/asm/hardware/ep7211.h
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/include/asm/hardware/ep7211.h
3 *
4 * This file contains the hardware definitions of the EP7211 internal
5 * registers.
6 *
7 * Copyright (C) 2001 Blue Mug, Inc. All Rights Reserved.
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#ifndef __ASM_HARDWARE_EP7211_H
24#define __ASM_HARDWARE_EP7211_H
25
26#include <asm/hardware/clps7111.h>
27
28/*
29 * define EP7211_BASE to be the base address of the region
30 * you want to access.
31 */
32
33#define EP7211_PHYS_BASE (0x80000000)
34
35/*
36 * XXX miket@bluemug.com: need to introduce EP7211 registers (those not
37 * present in 7212) here.
38 */
39
40#endif /* __ASM_HARDWARE_EP7211_H */
diff --git a/arch/arm/include/asm/hardware/ep7212.h b/arch/arm/include/asm/hardware/ep7212.h
new file mode 100644
index 000000000000..3b43bbeaf1db
--- /dev/null
+++ b/arch/arm/include/asm/hardware/ep7212.h
@@ -0,0 +1,83 @@
1/*
2 * arch/arm/include/asm/hardware/ep7212.h
3 *
4 * This file contains the hardware definitions of the EP7212 internal
5 * registers.
6 *
7 * Copyright (C) 2000 Deep Blue Solutions Ltd.
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#ifndef __ASM_HARDWARE_EP7212_H
24#define __ASM_HARDWARE_EP7212_H
25
26/*
27 * define EP7212_BASE to be the base address of the region
28 * you want to access.
29 */
30
31#define EP7212_PHYS_BASE (0x80000000)
32
33#ifndef __ASSEMBLY__
34#define ep_readl(off) __raw_readl(EP7212_BASE + (off))
35#define ep_writel(val,off) __raw_writel(val, EP7212_BASE + (off))
36#endif
37
38/*
39 * These registers are specific to the EP7212 only
40 */
41#define DAIR 0x2000
42#define DAIR0 0x2040
43#define DAIDR1 0x2080
44#define DAIDR2 0x20c0
45#define DAISR 0x2100
46#define SYSCON3 0x2200
47#define INTSR3 0x2240
48#define INTMR3 0x2280
49#define LEDFLSH 0x22c0
50
51#define DAIR_DAIEN (1 << 16)
52#define DAIR_ECS (1 << 17)
53#define DAIR_LCTM (1 << 19)
54#define DAIR_LCRM (1 << 20)
55#define DAIR_RCTM (1 << 21)
56#define DAIR_RCRM (1 << 22)
57#define DAIR_LBM (1 << 23)
58
59#define DAIDR2_FIFOEN (1 << 15)
60#define DAIDR2_FIFOLEFT (0x0d << 16)
61#define DAIDR2_FIFORIGHT (0x11 << 16)
62
63#define DAISR_RCTS (1 << 0)
64#define DAISR_RCRS (1 << 1)
65#define DAISR_LCTS (1 << 2)
66#define DAISR_LCRS (1 << 3)
67#define DAISR_RCTU (1 << 4)
68#define DAISR_RCRO (1 << 5)
69#define DAISR_LCTU (1 << 6)
70#define DAISR_LCRO (1 << 7)
71#define DAISR_RCNF (1 << 8)
72#define DAISR_RCNE (1 << 9)
73#define DAISR_LCNF (1 << 10)
74#define DAISR_LCNE (1 << 11)
75#define DAISR_FIFO (1 << 12)
76
77#define SYSCON3_ADCCON (1 << 0)
78#define SYSCON3_DAISEL (1 << 3)
79#define SYSCON3_ADCCKNSEN (1 << 4)
80#define SYSCON3_FASTWAKE (1 << 8)
81#define SYSCON3_DAIEN (1 << 9)
82
83#endif /* __ASM_HARDWARE_EP7212_H */
diff --git a/arch/arm/include/asm/hardware/gic.h b/arch/arm/include/asm/hardware/gic.h
new file mode 100644
index 000000000000..4924914af188
--- /dev/null
+++ b/arch/arm/include/asm/hardware/gic.h
@@ -0,0 +1,42 @@
1/*
2 * arch/arm/include/asm/hardware/gic.h
3 *
4 * Copyright (C) 2002 ARM Limited, All Rights Reserved.
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_ARM_HARDWARE_GIC_H
11#define __ASM_ARM_HARDWARE_GIC_H
12
13#include <linux/compiler.h>
14
15#define GIC_CPU_CTRL 0x00
16#define GIC_CPU_PRIMASK 0x04
17#define GIC_CPU_BINPOINT 0x08
18#define GIC_CPU_INTACK 0x0c
19#define GIC_CPU_EOI 0x10
20#define GIC_CPU_RUNNINGPRI 0x14
21#define GIC_CPU_HIGHPRI 0x18
22
23#define GIC_DIST_CTRL 0x000
24#define GIC_DIST_CTR 0x004
25#define GIC_DIST_ENABLE_SET 0x100
26#define GIC_DIST_ENABLE_CLEAR 0x180
27#define GIC_DIST_PENDING_SET 0x200
28#define GIC_DIST_PENDING_CLEAR 0x280
29#define GIC_DIST_ACTIVE_BIT 0x300
30#define GIC_DIST_PRI 0x400
31#define GIC_DIST_TARGET 0x800
32#define GIC_DIST_CONFIG 0xc00
33#define GIC_DIST_SOFTINT 0xf00
34
35#ifndef __ASSEMBLY__
36void gic_dist_init(unsigned int gic_nr, void __iomem *base, unsigned int irq_start);
37void gic_cpu_init(unsigned int gic_nr, void __iomem *base);
38void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
39void gic_raise_softirq(cpumask_t cpumask, unsigned int irq);
40#endif
41
42#endif
diff --git a/arch/arm/include/asm/hardware/icst307.h b/arch/arm/include/asm/hardware/icst307.h
new file mode 100644
index 000000000000..554f128a1046
--- /dev/null
+++ b/arch/arm/include/asm/hardware/icst307.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/include/asm/hardware/icst307.h
3 *
4 * Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
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 * Support functions for calculating clocks/divisors for the ICS307
11 * clock generators. See http://www.icst.com/ for more information
12 * on these devices.
13 *
14 * This file is similar to the icst525.h file
15 */
16#ifndef ASMARM_HARDWARE_ICST307_H
17#define ASMARM_HARDWARE_ICST307_H
18
19struct icst307_params {
20 unsigned long ref;
21 unsigned long vco_max; /* inclusive */
22 unsigned short vd_min; /* inclusive */
23 unsigned short vd_max; /* inclusive */
24 unsigned char rd_min; /* inclusive */
25 unsigned char rd_max; /* inclusive */
26};
27
28struct icst307_vco {
29 unsigned short v;
30 unsigned char r;
31 unsigned char s;
32};
33
34unsigned long icst307_khz(const struct icst307_params *p, struct icst307_vco vco);
35struct icst307_vco icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq);
36struct icst307_vco icst307_ps_to_vco(const struct icst307_params *p, unsigned long period);
37
38#endif
diff --git a/arch/arm/include/asm/hardware/icst525.h b/arch/arm/include/asm/hardware/icst525.h
new file mode 100644
index 000000000000..58f0dc43e2ed
--- /dev/null
+++ b/arch/arm/include/asm/hardware/icst525.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/include/asm/hardware/icst525.h
3 *
4 * Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
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 * Support functions for calculating clocks/divisors for the ICST525
11 * clock generators. See http://www.icst.com/ for more information
12 * on these devices.
13 */
14#ifndef ASMARM_HARDWARE_ICST525_H
15#define ASMARM_HARDWARE_ICST525_H
16
17struct icst525_params {
18 unsigned long ref;
19 unsigned long vco_max; /* inclusive */
20 unsigned short vd_min; /* inclusive */
21 unsigned short vd_max; /* inclusive */
22 unsigned char rd_min; /* inclusive */
23 unsigned char rd_max; /* inclusive */
24};
25
26struct icst525_vco {
27 unsigned short v;
28 unsigned char r;
29 unsigned char s;
30};
31
32unsigned long icst525_khz(const struct icst525_params *p, struct icst525_vco vco);
33struct icst525_vco icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq);
34struct icst525_vco icst525_ps_to_vco(const struct icst525_params *p, unsigned long period);
35
36#endif
diff --git a/arch/arm/include/asm/hardware/ioc.h b/arch/arm/include/asm/hardware/ioc.h
new file mode 100644
index 000000000000..1f6b8013becb
--- /dev/null
+++ b/arch/arm/include/asm/hardware/ioc.h
@@ -0,0 +1,72 @@
1/*
2 * arch/arm/include/asm/hardware/ioc.h
3 *
4 * Copyright (C) Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Use these macros to read/write the IOC. All it does is perform the actual
11 * read/write.
12 */
13#ifndef __ASMARM_HARDWARE_IOC_H
14#define __ASMARM_HARDWARE_IOC_H
15
16#ifndef __ASSEMBLY__
17
18/*
19 * We use __raw_base variants here so that we give the compiler the
20 * chance to keep IOC_BASE in a register.
21 */
22#define ioc_readb(off) __raw_readb(IOC_BASE + (off))
23#define ioc_writeb(val,off) __raw_writeb(val, IOC_BASE + (off))
24
25#endif
26
27#define IOC_CONTROL (0x00)
28#define IOC_KARTTX (0x04)
29#define IOC_KARTRX (0x04)
30
31#define IOC_IRQSTATA (0x10)
32#define IOC_IRQREQA (0x14)
33#define IOC_IRQCLRA (0x14)
34#define IOC_IRQMASKA (0x18)
35
36#define IOC_IRQSTATB (0x20)
37#define IOC_IRQREQB (0x24)
38#define IOC_IRQMASKB (0x28)
39
40#define IOC_FIQSTAT (0x30)
41#define IOC_FIQREQ (0x34)
42#define IOC_FIQMASK (0x38)
43
44#define IOC_T0CNTL (0x40)
45#define IOC_T0LTCHL (0x40)
46#define IOC_T0CNTH (0x44)
47#define IOC_T0LTCHH (0x44)
48#define IOC_T0GO (0x48)
49#define IOC_T0LATCH (0x4c)
50
51#define IOC_T1CNTL (0x50)
52#define IOC_T1LTCHL (0x50)
53#define IOC_T1CNTH (0x54)
54#define IOC_T1LTCHH (0x54)
55#define IOC_T1GO (0x58)
56#define IOC_T1LATCH (0x5c)
57
58#define IOC_T2CNTL (0x60)
59#define IOC_T2LTCHL (0x60)
60#define IOC_T2CNTH (0x64)
61#define IOC_T2LTCHH (0x64)
62#define IOC_T2GO (0x68)
63#define IOC_T2LATCH (0x6c)
64
65#define IOC_T3CNTL (0x70)
66#define IOC_T3LTCHL (0x70)
67#define IOC_T3CNTH (0x74)
68#define IOC_T3LTCHH (0x74)
69#define IOC_T3GO (0x78)
70#define IOC_T3LATCH (0x7c)
71
72#endif
diff --git a/arch/arm/include/asm/hardware/iomd.h b/arch/arm/include/asm/hardware/iomd.h
new file mode 100644
index 000000000000..9c5afbd71a69
--- /dev/null
+++ b/arch/arm/include/asm/hardware/iomd.h
@@ -0,0 +1,226 @@
1/*
2 * arch/arm/include/asm/hardware/iomd.h
3 *
4 * Copyright (C) 1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This file contains information out the IOMD ASIC used in the
11 * Acorn RiscPC and subsequently integrated into the CLPS7500 chips.
12 */
13#ifndef __ASMARM_HARDWARE_IOMD_H
14#define __ASMARM_HARDWARE_IOMD_H
15
16
17#ifndef __ASSEMBLY__
18
19/*
20 * We use __raw_base variants here so that we give the compiler the
21 * chance to keep IOC_BASE in a register.
22 */
23#define iomd_readb(off) __raw_readb(IOMD_BASE + (off))
24#define iomd_readl(off) __raw_readl(IOMD_BASE + (off))
25#define iomd_writeb(val,off) __raw_writeb(val, IOMD_BASE + (off))
26#define iomd_writel(val,off) __raw_writel(val, IOMD_BASE + (off))
27
28#endif
29
30#define IOMD_CONTROL (0x000)
31#define IOMD_KARTTX (0x004)
32#define IOMD_KARTRX (0x004)
33#define IOMD_KCTRL (0x008)
34
35#ifdef CONFIG_ARCH_CLPS7500
36#define IOMD_IOLINES (0x00C)
37#endif
38
39#define IOMD_IRQSTATA (0x010)
40#define IOMD_IRQREQA (0x014)
41#define IOMD_IRQCLRA (0x014)
42#define IOMD_IRQMASKA (0x018)
43
44#ifdef CONFIG_ARCH_CLPS7500
45#define IOMD_SUSMODE (0x01C)
46#endif
47
48#define IOMD_IRQSTATB (0x020)
49#define IOMD_IRQREQB (0x024)
50#define IOMD_IRQMASKB (0x028)
51
52#define IOMD_FIQSTAT (0x030)
53#define IOMD_FIQREQ (0x034)
54#define IOMD_FIQMASK (0x038)
55
56#ifdef CONFIG_ARCH_CLPS7500
57#define IOMD_CLKCTL (0x03C)
58#endif
59
60#define IOMD_T0CNTL (0x040)
61#define IOMD_T0LTCHL (0x040)
62#define IOMD_T0CNTH (0x044)
63#define IOMD_T0LTCHH (0x044)
64#define IOMD_T0GO (0x048)
65#define IOMD_T0LATCH (0x04c)
66
67#define IOMD_T1CNTL (0x050)
68#define IOMD_T1LTCHL (0x050)
69#define IOMD_T1CNTH (0x054)
70#define IOMD_T1LTCHH (0x054)
71#define IOMD_T1GO (0x058)
72#define IOMD_T1LATCH (0x05c)
73
74#ifdef CONFIG_ARCH_CLPS7500
75#define IOMD_IRQSTATC (0x060)
76#define IOMD_IRQREQC (0x064)
77#define IOMD_IRQMASKC (0x068)
78
79#define IOMD_VIDMUX (0x06c)
80
81#define IOMD_IRQSTATD (0x070)
82#define IOMD_IRQREQD (0x074)
83#define IOMD_IRQMASKD (0x078)
84#endif
85
86#define IOMD_ROMCR0 (0x080)
87#define IOMD_ROMCR1 (0x084)
88#ifdef CONFIG_ARCH_RPC
89#define IOMD_DRAMCR (0x088)
90#endif
91#define IOMD_REFCR (0x08C)
92
93#define IOMD_FSIZE (0x090)
94#define IOMD_ID0 (0x094)
95#define IOMD_ID1 (0x098)
96#define IOMD_VERSION (0x09C)
97
98#ifdef CONFIG_ARCH_RPC
99#define IOMD_MOUSEX (0x0A0)
100#define IOMD_MOUSEY (0x0A4)
101#endif
102
103#ifdef CONFIG_ARCH_CLPS7500
104#define IOMD_MSEDAT (0x0A8)
105#define IOMD_MSECTL (0x0Ac)
106#endif
107
108#ifdef CONFIG_ARCH_RPC
109#define IOMD_DMATCR (0x0C0)
110#endif
111#define IOMD_IOTCR (0x0C4)
112#define IOMD_ECTCR (0x0C8)
113#ifdef CONFIG_ARCH_RPC
114#define IOMD_DMAEXT (0x0CC)
115#endif
116#ifdef CONFIG_ARCH_CLPS7500
117#define IOMD_ASTCR (0x0CC)
118#define IOMD_DRAMCR (0x0D0)
119#define IOMD_SELFREF (0x0D4)
120#define IOMD_ATODICR (0x0E0)
121#define IOMD_ATODSR (0x0E4)
122#define IOMD_ATODCC (0x0E8)
123#define IOMD_ATODCNT1 (0x0EC)
124#define IOMD_ATODCNT2 (0x0F0)
125#define IOMD_ATODCNT3 (0x0F4)
126#define IOMD_ATODCNT4 (0x0F8)
127#endif
128
129#ifdef CONFIG_ARCH_RPC
130#define DMA_EXT_IO0 1
131#define DMA_EXT_IO1 2
132#define DMA_EXT_IO2 4
133#define DMA_EXT_IO3 8
134
135#define IOMD_IO0CURA (0x100)
136#define IOMD_IO0ENDA (0x104)
137#define IOMD_IO0CURB (0x108)
138#define IOMD_IO0ENDB (0x10C)
139#define IOMD_IO0CR (0x110)
140#define IOMD_IO0ST (0x114)
141
142#define IOMD_IO1CURA (0x120)
143#define IOMD_IO1ENDA (0x124)
144#define IOMD_IO1CURB (0x128)
145#define IOMD_IO1ENDB (0x12C)
146#define IOMD_IO1CR (0x130)
147#define IOMD_IO1ST (0x134)
148
149#define IOMD_IO2CURA (0x140)
150#define IOMD_IO2ENDA (0x144)
151#define IOMD_IO2CURB (0x148)
152#define IOMD_IO2ENDB (0x14C)
153#define IOMD_IO2CR (0x150)
154#define IOMD_IO2ST (0x154)
155
156#define IOMD_IO3CURA (0x160)
157#define IOMD_IO3ENDA (0x164)
158#define IOMD_IO3CURB (0x168)
159#define IOMD_IO3ENDB (0x16C)
160#define IOMD_IO3CR (0x170)
161#define IOMD_IO3ST (0x174)
162#endif
163
164#define IOMD_SD0CURA (0x180)
165#define IOMD_SD0ENDA (0x184)
166#define IOMD_SD0CURB (0x188)
167#define IOMD_SD0ENDB (0x18C)
168#define IOMD_SD0CR (0x190)
169#define IOMD_SD0ST (0x194)
170
171#ifdef CONFIG_ARCH_RPC
172#define IOMD_SD1CURA (0x1A0)
173#define IOMD_SD1ENDA (0x1A4)
174#define IOMD_SD1CURB (0x1A8)
175#define IOMD_SD1ENDB (0x1AC)
176#define IOMD_SD1CR (0x1B0)
177#define IOMD_SD1ST (0x1B4)
178#endif
179
180#define IOMD_CURSCUR (0x1C0)
181#define IOMD_CURSINIT (0x1C4)
182
183#define IOMD_VIDCUR (0x1D0)
184#define IOMD_VIDEND (0x1D4)
185#define IOMD_VIDSTART (0x1D8)
186#define IOMD_VIDINIT (0x1DC)
187#define IOMD_VIDCR (0x1E0)
188
189#define IOMD_DMASTAT (0x1F0)
190#define IOMD_DMAREQ (0x1F4)
191#define IOMD_DMAMASK (0x1F8)
192
193#define DMA_END_S (1 << 31)
194#define DMA_END_L (1 << 30)
195
196#define DMA_CR_C 0x80
197#define DMA_CR_D 0x40
198#define DMA_CR_E 0x20
199
200#define DMA_ST_OFL 4
201#define DMA_ST_INT 2
202#define DMA_ST_AB 1
203
204/*
205 * DMA (MEMC) compatibility
206 */
207#define HALF_SAM vram_half_sam
208#define VDMA_ALIGNMENT (HALF_SAM * 2)
209#define VDMA_XFERSIZE (HALF_SAM)
210#define VDMA_INIT IOMD_VIDINIT
211#define VDMA_START IOMD_VIDSTART
212#define VDMA_END IOMD_VIDEND
213
214#ifndef __ASSEMBLY__
215extern unsigned int vram_half_sam;
216#define video_set_dma(start,end,offset) \
217do { \
218 outl (SCREEN_START + start, VDMA_START); \
219 outl (SCREEN_START + end - VDMA_XFERSIZE, VDMA_END); \
220 if (offset >= end - VDMA_XFERSIZE) \
221 offset |= 0x40000000; \
222 outl (SCREEN_START + offset, VDMA_INIT); \
223} while (0)
224#endif
225
226#endif
diff --git a/arch/arm/include/asm/hardware/iop3xx-adma.h b/arch/arm/include/asm/hardware/iop3xx-adma.h
new file mode 100644
index 000000000000..87bff09633aa
--- /dev/null
+++ b/arch/arm/include/asm/hardware/iop3xx-adma.h
@@ -0,0 +1,888 @@
1/*
2 * Copyright © 2006, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 */
18#ifndef _ADMA_H
19#define _ADMA_H
20#include <linux/types.h>
21#include <linux/io.h>
22#include <mach/hardware.h>
23#include <asm/hardware/iop_adma.h>
24
25/* Memory copy units */
26#define DMA_CCR(chan) (chan->mmr_base + 0x0)
27#define DMA_CSR(chan) (chan->mmr_base + 0x4)
28#define DMA_DAR(chan) (chan->mmr_base + 0xc)
29#define DMA_NDAR(chan) (chan->mmr_base + 0x10)
30#define DMA_PADR(chan) (chan->mmr_base + 0x14)
31#define DMA_PUADR(chan) (chan->mmr_base + 0x18)
32#define DMA_LADR(chan) (chan->mmr_base + 0x1c)
33#define DMA_BCR(chan) (chan->mmr_base + 0x20)
34#define DMA_DCR(chan) (chan->mmr_base + 0x24)
35
36/* Application accelerator unit */
37#define AAU_ACR(chan) (chan->mmr_base + 0x0)
38#define AAU_ASR(chan) (chan->mmr_base + 0x4)
39#define AAU_ADAR(chan) (chan->mmr_base + 0x8)
40#define AAU_ANDAR(chan) (chan->mmr_base + 0xc)
41#define AAU_SAR(src, chan) (chan->mmr_base + (0x10 + ((src) << 2)))
42#define AAU_DAR(chan) (chan->mmr_base + 0x20)
43#define AAU_ABCR(chan) (chan->mmr_base + 0x24)
44#define AAU_ADCR(chan) (chan->mmr_base + 0x28)
45#define AAU_SAR_EDCR(src_edc) (chan->mmr_base + (0x02c + ((src_edc-4) << 2)))
46#define AAU_EDCR0_IDX 8
47#define AAU_EDCR1_IDX 17
48#define AAU_EDCR2_IDX 26
49
50#define DMA0_ID 0
51#define DMA1_ID 1
52#define AAU_ID 2
53
54struct iop3xx_aau_desc_ctrl {
55 unsigned int int_en:1;
56 unsigned int blk1_cmd_ctrl:3;
57 unsigned int blk2_cmd_ctrl:3;
58 unsigned int blk3_cmd_ctrl:3;
59 unsigned int blk4_cmd_ctrl:3;
60 unsigned int blk5_cmd_ctrl:3;
61 unsigned int blk6_cmd_ctrl:3;
62 unsigned int blk7_cmd_ctrl:3;
63 unsigned int blk8_cmd_ctrl:3;
64 unsigned int blk_ctrl:2;
65 unsigned int dual_xor_en:1;
66 unsigned int tx_complete:1;
67 unsigned int zero_result_err:1;
68 unsigned int zero_result_en:1;
69 unsigned int dest_write_en:1;
70};
71
72struct iop3xx_aau_e_desc_ctrl {
73 unsigned int reserved:1;
74 unsigned int blk1_cmd_ctrl:3;
75 unsigned int blk2_cmd_ctrl:3;
76 unsigned int blk3_cmd_ctrl:3;
77 unsigned int blk4_cmd_ctrl:3;
78 unsigned int blk5_cmd_ctrl:3;
79 unsigned int blk6_cmd_ctrl:3;
80 unsigned int blk7_cmd_ctrl:3;
81 unsigned int blk8_cmd_ctrl:3;
82 unsigned int reserved2:7;
83};
84
85struct iop3xx_dma_desc_ctrl {
86 unsigned int pci_transaction:4;
87 unsigned int int_en:1;
88 unsigned int dac_cycle_en:1;
89 unsigned int mem_to_mem_en:1;
90 unsigned int crc_data_tx_en:1;
91 unsigned int crc_gen_en:1;
92 unsigned int crc_seed_dis:1;
93 unsigned int reserved:21;
94 unsigned int crc_tx_complete:1;
95};
96
97struct iop3xx_desc_dma {
98 u32 next_desc;
99 union {
100 u32 pci_src_addr;
101 u32 pci_dest_addr;
102 u32 src_addr;
103 };
104 union {
105 u32 upper_pci_src_addr;
106 u32 upper_pci_dest_addr;
107 };
108 union {
109 u32 local_pci_src_addr;
110 u32 local_pci_dest_addr;
111 u32 dest_addr;
112 };
113 u32 byte_count;
114 union {
115 u32 desc_ctrl;
116 struct iop3xx_dma_desc_ctrl desc_ctrl_field;
117 };
118 u32 crc_addr;
119};
120
121struct iop3xx_desc_aau {
122 u32 next_desc;
123 u32 src[4];
124 u32 dest_addr;
125 u32 byte_count;
126 union {
127 u32 desc_ctrl;
128 struct iop3xx_aau_desc_ctrl desc_ctrl_field;
129 };
130 union {
131 u32 src_addr;
132 u32 e_desc_ctrl;
133 struct iop3xx_aau_e_desc_ctrl e_desc_ctrl_field;
134 } src_edc[31];
135};
136
137struct iop3xx_aau_gfmr {
138 unsigned int gfmr1:8;
139 unsigned int gfmr2:8;
140 unsigned int gfmr3:8;
141 unsigned int gfmr4:8;
142};
143
144struct iop3xx_desc_pq_xor {
145 u32 next_desc;
146 u32 src[3];
147 union {
148 u32 data_mult1;
149 struct iop3xx_aau_gfmr data_mult1_field;
150 };
151 u32 dest_addr;
152 u32 byte_count;
153 union {
154 u32 desc_ctrl;
155 struct iop3xx_aau_desc_ctrl desc_ctrl_field;
156 };
157 union {
158 u32 src_addr;
159 u32 e_desc_ctrl;
160 struct iop3xx_aau_e_desc_ctrl e_desc_ctrl_field;
161 u32 data_multiplier;
162 struct iop3xx_aau_gfmr data_mult_field;
163 u32 reserved;
164 } src_edc_gfmr[19];
165};
166
167struct iop3xx_desc_dual_xor {
168 u32 next_desc;
169 u32 src0_addr;
170 u32 src1_addr;
171 u32 h_src_addr;
172 u32 d_src_addr;
173 u32 h_dest_addr;
174 u32 byte_count;
175 union {
176 u32 desc_ctrl;
177 struct iop3xx_aau_desc_ctrl desc_ctrl_field;
178 };
179 u32 d_dest_addr;
180};
181
182union iop3xx_desc {
183 struct iop3xx_desc_aau *aau;
184 struct iop3xx_desc_dma *dma;
185 struct iop3xx_desc_pq_xor *pq_xor;
186 struct iop3xx_desc_dual_xor *dual_xor;
187 void *ptr;
188};
189
190static inline int iop_adma_get_max_xor(void)
191{
192 return 32;
193}
194
195static inline u32 iop_chan_get_current_descriptor(struct iop_adma_chan *chan)
196{
197 int id = chan->device->id;
198
199 switch (id) {
200 case DMA0_ID:
201 case DMA1_ID:
202 return __raw_readl(DMA_DAR(chan));
203 case AAU_ID:
204 return __raw_readl(AAU_ADAR(chan));
205 default:
206 BUG();
207 }
208 return 0;
209}
210
211static inline void iop_chan_set_next_descriptor(struct iop_adma_chan *chan,
212 u32 next_desc_addr)
213{
214 int id = chan->device->id;
215
216 switch (id) {
217 case DMA0_ID:
218 case DMA1_ID:
219 __raw_writel(next_desc_addr, DMA_NDAR(chan));
220 break;
221 case AAU_ID:
222 __raw_writel(next_desc_addr, AAU_ANDAR(chan));
223 break;
224 }
225
226}
227
228#define IOP_ADMA_STATUS_BUSY (1 << 10)
229#define IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT (1024)
230#define IOP_ADMA_XOR_MAX_BYTE_COUNT (16 * 1024 * 1024)
231#define IOP_ADMA_MAX_BYTE_COUNT (16 * 1024 * 1024)
232
233static inline int iop_chan_is_busy(struct iop_adma_chan *chan)
234{
235 u32 status = __raw_readl(DMA_CSR(chan));
236 return (status & IOP_ADMA_STATUS_BUSY) ? 1 : 0;
237}
238
239static inline int iop_desc_is_aligned(struct iop_adma_desc_slot *desc,
240 int num_slots)
241{
242 /* num_slots will only ever be 1, 2, 4, or 8 */
243 return (desc->idx & (num_slots - 1)) ? 0 : 1;
244}
245
246/* to do: support large (i.e. > hw max) buffer sizes */
247static inline int iop_chan_memcpy_slot_count(size_t len, int *slots_per_op)
248{
249 *slots_per_op = 1;
250 return 1;
251}
252
253/* to do: support large (i.e. > hw max) buffer sizes */
254static inline int iop_chan_memset_slot_count(size_t len, int *slots_per_op)
255{
256 *slots_per_op = 1;
257 return 1;
258}
259
260static inline int iop3xx_aau_xor_slot_count(size_t len, int src_cnt,
261 int *slots_per_op)
262{
263 static const char slot_count_table[] = {
264 1, 1, 1, 1, /* 01 - 04 */
265 2, 2, 2, 2, /* 05 - 08 */
266 4, 4, 4, 4, /* 09 - 12 */
267 4, 4, 4, 4, /* 13 - 16 */
268 8, 8, 8, 8, /* 17 - 20 */
269 8, 8, 8, 8, /* 21 - 24 */
270 8, 8, 8, 8, /* 25 - 28 */
271 8, 8, 8, 8, /* 29 - 32 */
272 };
273 *slots_per_op = slot_count_table[src_cnt - 1];
274 return *slots_per_op;
275}
276
277static inline int
278iop_chan_interrupt_slot_count(int *slots_per_op, struct iop_adma_chan *chan)
279{
280 switch (chan->device->id) {
281 case DMA0_ID:
282 case DMA1_ID:
283 return iop_chan_memcpy_slot_count(0, slots_per_op);
284 case AAU_ID:
285 return iop3xx_aau_xor_slot_count(0, 2, slots_per_op);
286 default:
287 BUG();
288 }
289 return 0;
290}
291
292static inline int iop_chan_xor_slot_count(size_t len, int src_cnt,
293 int *slots_per_op)
294{
295 int slot_cnt = iop3xx_aau_xor_slot_count(len, src_cnt, slots_per_op);
296
297 if (len <= IOP_ADMA_XOR_MAX_BYTE_COUNT)
298 return slot_cnt;
299
300 len -= IOP_ADMA_XOR_MAX_BYTE_COUNT;
301 while (len > IOP_ADMA_XOR_MAX_BYTE_COUNT) {
302 len -= IOP_ADMA_XOR_MAX_BYTE_COUNT;
303 slot_cnt += *slots_per_op;
304 }
305
306 if (len)
307 slot_cnt += *slots_per_op;
308
309 return slot_cnt;
310}
311
312/* zero sum on iop3xx is limited to 1k at a time so it requires multiple
313 * descriptors
314 */
315static inline int iop_chan_zero_sum_slot_count(size_t len, int src_cnt,
316 int *slots_per_op)
317{
318 int slot_cnt = iop3xx_aau_xor_slot_count(len, src_cnt, slots_per_op);
319
320 if (len <= IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT)
321 return slot_cnt;
322
323 len -= IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT;
324 while (len > IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT) {
325 len -= IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT;
326 slot_cnt += *slots_per_op;
327 }
328
329 if (len)
330 slot_cnt += *slots_per_op;
331
332 return slot_cnt;
333}
334
335static inline u32 iop_desc_get_dest_addr(struct iop_adma_desc_slot *desc,
336 struct iop_adma_chan *chan)
337{
338 union iop3xx_desc hw_desc = { .ptr = desc->hw_desc, };
339
340 switch (chan->device->id) {
341 case DMA0_ID:
342 case DMA1_ID:
343 return hw_desc.dma->dest_addr;
344 case AAU_ID:
345 return hw_desc.aau->dest_addr;
346 default:
347 BUG();
348 }
349 return 0;
350}
351
352static inline u32 iop_desc_get_byte_count(struct iop_adma_desc_slot *desc,
353 struct iop_adma_chan *chan)
354{
355 union iop3xx_desc hw_desc = { .ptr = desc->hw_desc, };
356
357 switch (chan->device->id) {
358 case DMA0_ID:
359 case DMA1_ID:
360 return hw_desc.dma->byte_count;
361 case AAU_ID:
362 return hw_desc.aau->byte_count;
363 default:
364 BUG();
365 }
366 return 0;
367}
368
369/* translate the src_idx to a descriptor word index */
370static inline int __desc_idx(int src_idx)
371{
372 static const int desc_idx_table[] = { 0, 0, 0, 0,
373 0, 1, 2, 3,
374 5, 6, 7, 8,
375 9, 10, 11, 12,
376 14, 15, 16, 17,
377 18, 19, 20, 21,
378 23, 24, 25, 26,
379 27, 28, 29, 30,
380 };
381
382 return desc_idx_table[src_idx];
383}
384
385static inline u32 iop_desc_get_src_addr(struct iop_adma_desc_slot *desc,
386 struct iop_adma_chan *chan,
387 int src_idx)
388{
389 union iop3xx_desc hw_desc = { .ptr = desc->hw_desc, };
390
391 switch (chan->device->id) {
392 case DMA0_ID:
393 case DMA1_ID:
394 return hw_desc.dma->src_addr;
395 case AAU_ID:
396 break;
397 default:
398 BUG();
399 }
400
401 if (src_idx < 4)
402 return hw_desc.aau->src[src_idx];
403 else
404 return hw_desc.aau->src_edc[__desc_idx(src_idx)].src_addr;
405}
406
407static inline void iop3xx_aau_desc_set_src_addr(struct iop3xx_desc_aau *hw_desc,
408 int src_idx, dma_addr_t addr)
409{
410 if (src_idx < 4)
411 hw_desc->src[src_idx] = addr;
412 else
413 hw_desc->src_edc[__desc_idx(src_idx)].src_addr = addr;
414}
415
416static inline void
417iop_desc_init_memcpy(struct iop_adma_desc_slot *desc, unsigned long flags)
418{
419 struct iop3xx_desc_dma *hw_desc = desc->hw_desc;
420 union {
421 u32 value;
422 struct iop3xx_dma_desc_ctrl field;
423 } u_desc_ctrl;
424
425 u_desc_ctrl.value = 0;
426 u_desc_ctrl.field.mem_to_mem_en = 1;
427 u_desc_ctrl.field.pci_transaction = 0xe; /* memory read block */
428 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
429 hw_desc->desc_ctrl = u_desc_ctrl.value;
430 hw_desc->upper_pci_src_addr = 0;
431 hw_desc->crc_addr = 0;
432}
433
434static inline void
435iop_desc_init_memset(struct iop_adma_desc_slot *desc, unsigned long flags)
436{
437 struct iop3xx_desc_aau *hw_desc = desc->hw_desc;
438 union {
439 u32 value;
440 struct iop3xx_aau_desc_ctrl field;
441 } u_desc_ctrl;
442
443 u_desc_ctrl.value = 0;
444 u_desc_ctrl.field.blk1_cmd_ctrl = 0x2; /* memory block fill */
445 u_desc_ctrl.field.dest_write_en = 1;
446 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
447 hw_desc->desc_ctrl = u_desc_ctrl.value;
448}
449
450static inline u32
451iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt,
452 unsigned long flags)
453{
454 int i, shift;
455 u32 edcr;
456 union {
457 u32 value;
458 struct iop3xx_aau_desc_ctrl field;
459 } u_desc_ctrl;
460
461 u_desc_ctrl.value = 0;
462 switch (src_cnt) {
463 case 25 ... 32:
464 u_desc_ctrl.field.blk_ctrl = 0x3; /* use EDCR[2:0] */
465 edcr = 0;
466 shift = 1;
467 for (i = 24; i < src_cnt; i++) {
468 edcr |= (1 << shift);
469 shift += 3;
470 }
471 hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = edcr;
472 src_cnt = 24;
473 /* fall through */
474 case 17 ... 24:
475 if (!u_desc_ctrl.field.blk_ctrl) {
476 hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = 0;
477 u_desc_ctrl.field.blk_ctrl = 0x3; /* use EDCR[2:0] */
478 }
479 edcr = 0;
480 shift = 1;
481 for (i = 16; i < src_cnt; i++) {
482 edcr |= (1 << shift);
483 shift += 3;
484 }
485 hw_desc->src_edc[AAU_EDCR1_IDX].e_desc_ctrl = edcr;
486 src_cnt = 16;
487 /* fall through */
488 case 9 ... 16:
489 if (!u_desc_ctrl.field.blk_ctrl)
490 u_desc_ctrl.field.blk_ctrl = 0x2; /* use EDCR0 */
491 edcr = 0;
492 shift = 1;
493 for (i = 8; i < src_cnt; i++) {
494 edcr |= (1 << shift);
495 shift += 3;
496 }
497 hw_desc->src_edc[AAU_EDCR0_IDX].e_desc_ctrl = edcr;
498 src_cnt = 8;
499 /* fall through */
500 case 2 ... 8:
501 shift = 1;
502 for (i = 0; i < src_cnt; i++) {
503 u_desc_ctrl.value |= (1 << shift);
504 shift += 3;
505 }
506
507 if (!u_desc_ctrl.field.blk_ctrl && src_cnt > 4)
508 u_desc_ctrl.field.blk_ctrl = 0x1; /* use mini-desc */
509 }
510
511 u_desc_ctrl.field.dest_write_en = 1;
512 u_desc_ctrl.field.blk1_cmd_ctrl = 0x7; /* direct fill */
513 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
514 hw_desc->desc_ctrl = u_desc_ctrl.value;
515
516 return u_desc_ctrl.value;
517}
518
519static inline void
520iop_desc_init_xor(struct iop_adma_desc_slot *desc, int src_cnt,
521 unsigned long flags)
522{
523 iop3xx_desc_init_xor(desc->hw_desc, src_cnt, flags);
524}
525
526/* return the number of operations */
527static inline int
528iop_desc_init_zero_sum(struct iop_adma_desc_slot *desc, int src_cnt,
529 unsigned long flags)
530{
531 int slot_cnt = desc->slot_cnt, slots_per_op = desc->slots_per_op;
532 struct iop3xx_desc_aau *hw_desc, *prev_hw_desc, *iter;
533 union {
534 u32 value;
535 struct iop3xx_aau_desc_ctrl field;
536 } u_desc_ctrl;
537 int i, j;
538
539 hw_desc = desc->hw_desc;
540
541 for (i = 0, j = 0; (slot_cnt -= slots_per_op) >= 0;
542 i += slots_per_op, j++) {
543 iter = iop_hw_desc_slot_idx(hw_desc, i);
544 u_desc_ctrl.value = iop3xx_desc_init_xor(iter, src_cnt, flags);
545 u_desc_ctrl.field.dest_write_en = 0;
546 u_desc_ctrl.field.zero_result_en = 1;
547 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
548 iter->desc_ctrl = u_desc_ctrl.value;
549
550 /* for the subsequent descriptors preserve the store queue
551 * and chain them together
552 */
553 if (i) {
554 prev_hw_desc =
555 iop_hw_desc_slot_idx(hw_desc, i - slots_per_op);
556 prev_hw_desc->next_desc =
557 (u32) (desc->async_tx.phys + (i << 5));
558 }
559 }
560
561 return j;
562}
563
564static inline void
565iop_desc_init_null_xor(struct iop_adma_desc_slot *desc, int src_cnt,
566 unsigned long flags)
567{
568 struct iop3xx_desc_aau *hw_desc = desc->hw_desc;
569 union {
570 u32 value;
571 struct iop3xx_aau_desc_ctrl field;
572 } u_desc_ctrl;
573
574 u_desc_ctrl.value = 0;
575 switch (src_cnt) {
576 case 25 ... 32:
577 u_desc_ctrl.field.blk_ctrl = 0x3; /* use EDCR[2:0] */
578 hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = 0;
579 /* fall through */
580 case 17 ... 24:
581 if (!u_desc_ctrl.field.blk_ctrl) {
582 hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = 0;
583 u_desc_ctrl.field.blk_ctrl = 0x3; /* use EDCR[2:0] */
584 }
585 hw_desc->src_edc[AAU_EDCR1_IDX].e_desc_ctrl = 0;
586 /* fall through */
587 case 9 ... 16:
588 if (!u_desc_ctrl.field.blk_ctrl)
589 u_desc_ctrl.field.blk_ctrl = 0x2; /* use EDCR0 */
590 hw_desc->src_edc[AAU_EDCR0_IDX].e_desc_ctrl = 0;
591 /* fall through */
592 case 1 ... 8:
593 if (!u_desc_ctrl.field.blk_ctrl && src_cnt > 4)
594 u_desc_ctrl.field.blk_ctrl = 0x1; /* use mini-desc */
595 }
596
597 u_desc_ctrl.field.dest_write_en = 0;
598 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
599 hw_desc->desc_ctrl = u_desc_ctrl.value;
600}
601
602static inline void iop_desc_set_byte_count(struct iop_adma_desc_slot *desc,
603 struct iop_adma_chan *chan,
604 u32 byte_count)
605{
606 union iop3xx_desc hw_desc = { .ptr = desc->hw_desc, };
607
608 switch (chan->device->id) {
609 case DMA0_ID:
610 case DMA1_ID:
611 hw_desc.dma->byte_count = byte_count;
612 break;
613 case AAU_ID:
614 hw_desc.aau->byte_count = byte_count;
615 break;
616 default:
617 BUG();
618 }
619}
620
621static inline void
622iop_desc_init_interrupt(struct iop_adma_desc_slot *desc,
623 struct iop_adma_chan *chan)
624{
625 union iop3xx_desc hw_desc = { .ptr = desc->hw_desc, };
626
627 switch (chan->device->id) {
628 case DMA0_ID:
629 case DMA1_ID:
630 iop_desc_init_memcpy(desc, 1);
631 hw_desc.dma->byte_count = 0;
632 hw_desc.dma->dest_addr = 0;
633 hw_desc.dma->src_addr = 0;
634 break;
635 case AAU_ID:
636 iop_desc_init_null_xor(desc, 2, 1);
637 hw_desc.aau->byte_count = 0;
638 hw_desc.aau->dest_addr = 0;
639 hw_desc.aau->src[0] = 0;
640 hw_desc.aau->src[1] = 0;
641 break;
642 default:
643 BUG();
644 }
645}
646
647static inline void
648iop_desc_set_zero_sum_byte_count(struct iop_adma_desc_slot *desc, u32 len)
649{
650 int slots_per_op = desc->slots_per_op;
651 struct iop3xx_desc_aau *hw_desc = desc->hw_desc, *iter;
652 int i = 0;
653
654 if (len <= IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT) {
655 hw_desc->byte_count = len;
656 } else {
657 do {
658 iter = iop_hw_desc_slot_idx(hw_desc, i);
659 iter->byte_count = IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT;
660 len -= IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT;
661 i += slots_per_op;
662 } while (len > IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT);
663
664 if (len) {
665 iter = iop_hw_desc_slot_idx(hw_desc, i);
666 iter->byte_count = len;
667 }
668 }
669}
670
671static inline void iop_desc_set_dest_addr(struct iop_adma_desc_slot *desc,
672 struct iop_adma_chan *chan,
673 dma_addr_t addr)
674{
675 union iop3xx_desc hw_desc = { .ptr = desc->hw_desc, };
676
677 switch (chan->device->id) {
678 case DMA0_ID:
679 case DMA1_ID:
680 hw_desc.dma->dest_addr = addr;
681 break;
682 case AAU_ID:
683 hw_desc.aau->dest_addr = addr;
684 break;
685 default:
686 BUG();
687 }
688}
689
690static inline void iop_desc_set_memcpy_src_addr(struct iop_adma_desc_slot *desc,
691 dma_addr_t addr)
692{
693 struct iop3xx_desc_dma *hw_desc = desc->hw_desc;
694 hw_desc->src_addr = addr;
695}
696
697static inline void
698iop_desc_set_zero_sum_src_addr(struct iop_adma_desc_slot *desc, int src_idx,
699 dma_addr_t addr)
700{
701
702 struct iop3xx_desc_aau *hw_desc = desc->hw_desc, *iter;
703 int slot_cnt = desc->slot_cnt, slots_per_op = desc->slots_per_op;
704 int i;
705
706 for (i = 0; (slot_cnt -= slots_per_op) >= 0;
707 i += slots_per_op, addr += IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT) {
708 iter = iop_hw_desc_slot_idx(hw_desc, i);
709 iop3xx_aau_desc_set_src_addr(iter, src_idx, addr);
710 }
711}
712
713static inline void iop_desc_set_xor_src_addr(struct iop_adma_desc_slot *desc,
714 int src_idx, dma_addr_t addr)
715{
716
717 struct iop3xx_desc_aau *hw_desc = desc->hw_desc, *iter;
718 int slot_cnt = desc->slot_cnt, slots_per_op = desc->slots_per_op;
719 int i;
720
721 for (i = 0; (slot_cnt -= slots_per_op) >= 0;
722 i += slots_per_op, addr += IOP_ADMA_XOR_MAX_BYTE_COUNT) {
723 iter = iop_hw_desc_slot_idx(hw_desc, i);
724 iop3xx_aau_desc_set_src_addr(iter, src_idx, addr);
725 }
726}
727
728static inline void iop_desc_set_next_desc(struct iop_adma_desc_slot *desc,
729 u32 next_desc_addr)
730{
731 /* hw_desc->next_desc is the same location for all channels */
732 union iop3xx_desc hw_desc = { .ptr = desc->hw_desc, };
733 BUG_ON(hw_desc.dma->next_desc);
734 hw_desc.dma->next_desc = next_desc_addr;
735}
736
737static inline u32 iop_desc_get_next_desc(struct iop_adma_desc_slot *desc)
738{
739 /* hw_desc->next_desc is the same location for all channels */
740 union iop3xx_desc hw_desc = { .ptr = desc->hw_desc, };
741 return hw_desc.dma->next_desc;
742}
743
744static inline void iop_desc_clear_next_desc(struct iop_adma_desc_slot *desc)
745{
746 /* hw_desc->next_desc is the same location for all channels */
747 union iop3xx_desc hw_desc = { .ptr = desc->hw_desc, };
748 hw_desc.dma->next_desc = 0;
749}
750
751static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc,
752 u32 val)
753{
754 struct iop3xx_desc_aau *hw_desc = desc->hw_desc;
755 hw_desc->src[0] = val;
756}
757
758static inline int iop_desc_get_zero_result(struct iop_adma_desc_slot *desc)
759{
760 struct iop3xx_desc_aau *hw_desc = desc->hw_desc;
761 struct iop3xx_aau_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field;
762
763 BUG_ON(!(desc_ctrl.tx_complete && desc_ctrl.zero_result_en));
764 return desc_ctrl.zero_result_err;
765}
766
767static inline void iop_chan_append(struct iop_adma_chan *chan)
768{
769 u32 dma_chan_ctrl;
770
771 dma_chan_ctrl = __raw_readl(DMA_CCR(chan));
772 dma_chan_ctrl |= 0x2;
773 __raw_writel(dma_chan_ctrl, DMA_CCR(chan));
774}
775
776static inline u32 iop_chan_get_status(struct iop_adma_chan *chan)
777{
778 return __raw_readl(DMA_CSR(chan));
779}
780
781static inline void iop_chan_disable(struct iop_adma_chan *chan)
782{
783 u32 dma_chan_ctrl = __raw_readl(DMA_CCR(chan));
784 dma_chan_ctrl &= ~1;
785 __raw_writel(dma_chan_ctrl, DMA_CCR(chan));
786}
787
788static inline void iop_chan_enable(struct iop_adma_chan *chan)
789{
790 u32 dma_chan_ctrl = __raw_readl(DMA_CCR(chan));
791
792 dma_chan_ctrl |= 1;
793 __raw_writel(dma_chan_ctrl, DMA_CCR(chan));
794}
795
796static inline void iop_adma_device_clear_eot_status(struct iop_adma_chan *chan)
797{
798 u32 status = __raw_readl(DMA_CSR(chan));
799 status &= (1 << 9);
800 __raw_writel(status, DMA_CSR(chan));
801}
802
803static inline void iop_adma_device_clear_eoc_status(struct iop_adma_chan *chan)
804{
805 u32 status = __raw_readl(DMA_CSR(chan));
806 status &= (1 << 8);
807 __raw_writel(status, DMA_CSR(chan));
808}
809
810static inline void iop_adma_device_clear_err_status(struct iop_adma_chan *chan)
811{
812 u32 status = __raw_readl(DMA_CSR(chan));
813
814 switch (chan->device->id) {
815 case DMA0_ID:
816 case DMA1_ID:
817 status &= (1 << 5) | (1 << 3) | (1 << 2) | (1 << 1);
818 break;
819 case AAU_ID:
820 status &= (1 << 5);
821 break;
822 default:
823 BUG();
824 }
825
826 __raw_writel(status, DMA_CSR(chan));
827}
828
829static inline int
830iop_is_err_int_parity(unsigned long status, struct iop_adma_chan *chan)
831{
832 return 0;
833}
834
835static inline int
836iop_is_err_mcu_abort(unsigned long status, struct iop_adma_chan *chan)
837{
838 return 0;
839}
840
841static inline int
842iop_is_err_int_tabort(unsigned long status, struct iop_adma_chan *chan)
843{
844 return 0;
845}
846
847static inline int
848iop_is_err_int_mabort(unsigned long status, struct iop_adma_chan *chan)
849{
850 return test_bit(5, &status);
851}
852
853static inline int
854iop_is_err_pci_tabort(unsigned long status, struct iop_adma_chan *chan)
855{
856 switch (chan->device->id) {
857 case DMA0_ID:
858 case DMA1_ID:
859 return test_bit(2, &status);
860 default:
861 return 0;
862 }
863}
864
865static inline int
866iop_is_err_pci_mabort(unsigned long status, struct iop_adma_chan *chan)
867{
868 switch (chan->device->id) {
869 case DMA0_ID:
870 case DMA1_ID:
871 return test_bit(3, &status);
872 default:
873 return 0;
874 }
875}
876
877static inline int
878iop_is_err_split_tx(unsigned long status, struct iop_adma_chan *chan)
879{
880 switch (chan->device->id) {
881 case DMA0_ID:
882 case DMA1_ID:
883 return test_bit(1, &status);
884 default:
885 return 0;
886 }
887}
888#endif /* _ADMA_H */
diff --git a/arch/arm/include/asm/hardware/iop3xx-gpio.h b/arch/arm/include/asm/hardware/iop3xx-gpio.h
new file mode 100644
index 000000000000..b69d972b1f7d
--- /dev/null
+++ b/arch/arm/include/asm/hardware/iop3xx-gpio.h
@@ -0,0 +1,73 @@
1/*
2 * arch/arm/include/asm/hardware/iop3xx-gpio.h
3 *
4 * IOP3xx GPIO wrappers
5 *
6 * Copyright (c) 2008 Arnaud Patard <arnaud.patard@rtp-net.org>
7 * Based on IXP4XX gpio.h file
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#ifndef __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
26#define __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
27
28#include <mach/hardware.h>
29#include <asm-generic/gpio.h>
30
31#define IOP3XX_N_GPIOS 8
32
33static inline int gpio_get_value(unsigned gpio)
34{
35 if (gpio > IOP3XX_N_GPIOS)
36 return __gpio_get_value(gpio);
37
38 return gpio_line_get(gpio);
39}
40
41static inline void gpio_set_value(unsigned gpio, int value)
42{
43 if (gpio > IOP3XX_N_GPIOS) {
44 __gpio_set_value(gpio, value);
45 return;
46 }
47 gpio_line_set(gpio, value);
48}
49
50static inline int gpio_cansleep(unsigned gpio)
51{
52 if (gpio < IOP3XX_N_GPIOS)
53 return 0;
54 else
55 return __gpio_cansleep(gpio);
56}
57
58/*
59 * The GPIOs are not generating any interrupt
60 * Note : manuals are not clear about this
61 */
62static inline int gpio_to_irq(int gpio)
63{
64 return -EINVAL;
65}
66
67static inline int irq_to_gpio(int gpio)
68{
69 return -EINVAL;
70}
71
72#endif
73
diff --git a/arch/arm/include/asm/hardware/iop3xx.h b/arch/arm/include/asm/hardware/iop3xx.h
new file mode 100644
index 000000000000..4b8e7f559929
--- /dev/null
+++ b/arch/arm/include/asm/hardware/iop3xx.h
@@ -0,0 +1,312 @@
1/*
2 * arch/arm/include/asm/hardware/iop3xx.h
3 *
4 * Intel IOP32X and IOP33X register definitions
5 *
6 * Author: Rory Bolt <rorybolt@pacbell.net>
7 * Copyright (C) 2002 Rory Bolt
8 * Copyright (C) 2004 Intel Corp.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __IOP3XX_H
16#define __IOP3XX_H
17
18/*
19 * IOP3XX GPIO handling
20 */
21#define GPIO_IN 0
22#define GPIO_OUT 1
23#define GPIO_LOW 0
24#define GPIO_HIGH 1
25#define IOP3XX_GPIO_LINE(x) (x)
26
27#ifndef __ASSEMBLY__
28extern void gpio_line_config(int line, int direction);
29extern int gpio_line_get(int line);
30extern void gpio_line_set(int line, int value);
31extern int init_atu;
32extern int iop3xx_get_init_atu(void);
33#endif
34
35
36/*
37 * IOP3XX processor registers
38 */
39#define IOP3XX_PERIPHERAL_PHYS_BASE 0xffffe000
40#define IOP3XX_PERIPHERAL_VIRT_BASE 0xfeffe000
41#define IOP3XX_PERIPHERAL_SIZE 0x00002000
42#define IOP3XX_PERIPHERAL_UPPER_PA (IOP3XX_PERIPHERAL_PHYS_BASE +\
43 IOP3XX_PERIPHERAL_SIZE - 1)
44#define IOP3XX_PERIPHERAL_UPPER_VA (IOP3XX_PERIPHERAL_VIRT_BASE +\
45 IOP3XX_PERIPHERAL_SIZE - 1)
46#define IOP3XX_PMMR_PHYS_TO_VIRT(addr) (u32) ((u32) (addr) -\
47 (IOP3XX_PERIPHERAL_PHYS_BASE\
48 - IOP3XX_PERIPHERAL_VIRT_BASE))
49#define IOP3XX_REG_ADDR(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + (reg))
50
51/* Address Translation Unit */
52#define IOP3XX_ATUVID (volatile u16 *)IOP3XX_REG_ADDR(0x0100)
53#define IOP3XX_ATUDID (volatile u16 *)IOP3XX_REG_ADDR(0x0102)
54#define IOP3XX_ATUCMD (volatile u16 *)IOP3XX_REG_ADDR(0x0104)
55#define IOP3XX_ATUSR (volatile u16 *)IOP3XX_REG_ADDR(0x0106)
56#define IOP3XX_ATURID (volatile u8 *)IOP3XX_REG_ADDR(0x0108)
57#define IOP3XX_ATUCCR (volatile u32 *)IOP3XX_REG_ADDR(0x0109)
58#define IOP3XX_ATUCLSR (volatile u8 *)IOP3XX_REG_ADDR(0x010c)
59#define IOP3XX_ATULT (volatile u8 *)IOP3XX_REG_ADDR(0x010d)
60#define IOP3XX_ATUHTR (volatile u8 *)IOP3XX_REG_ADDR(0x010e)
61#define IOP3XX_ATUBIST (volatile u8 *)IOP3XX_REG_ADDR(0x010f)
62#define IOP3XX_IABAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0110)
63#define IOP3XX_IAUBAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0114)
64#define IOP3XX_IABAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0118)
65#define IOP3XX_IAUBAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x011c)
66#define IOP3XX_IABAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0120)
67#define IOP3XX_IAUBAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0124)
68#define IOP3XX_ASVIR (volatile u16 *)IOP3XX_REG_ADDR(0x012c)
69#define IOP3XX_ASIR (volatile u16 *)IOP3XX_REG_ADDR(0x012e)
70#define IOP3XX_ERBAR (volatile u32 *)IOP3XX_REG_ADDR(0x0130)
71#define IOP3XX_ATUILR (volatile u8 *)IOP3XX_REG_ADDR(0x013c)
72#define IOP3XX_ATUIPR (volatile u8 *)IOP3XX_REG_ADDR(0x013d)
73#define IOP3XX_ATUMGNT (volatile u8 *)IOP3XX_REG_ADDR(0x013e)
74#define IOP3XX_ATUMLAT (volatile u8 *)IOP3XX_REG_ADDR(0x013f)
75#define IOP3XX_IALR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0140)
76#define IOP3XX_IATVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0144)
77#define IOP3XX_ERLR (volatile u32 *)IOP3XX_REG_ADDR(0x0148)
78#define IOP3XX_ERTVR (volatile u32 *)IOP3XX_REG_ADDR(0x014c)
79#define IOP3XX_IALR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0150)
80#define IOP3XX_IALR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0154)
81#define IOP3XX_IATVR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0158)
82#define IOP3XX_OIOWTVR (volatile u32 *)IOP3XX_REG_ADDR(0x015c)
83#define IOP3XX_OMWTVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0160)
84#define IOP3XX_OUMWTVR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0164)
85#define IOP3XX_OMWTVR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0168)
86#define IOP3XX_OUMWTVR1 (volatile u32 *)IOP3XX_REG_ADDR(0x016c)
87#define IOP3XX_OUDWTVR (volatile u32 *)IOP3XX_REG_ADDR(0x0178)
88#define IOP3XX_ATUCR (volatile u32 *)IOP3XX_REG_ADDR(0x0180)
89#define IOP3XX_PCSR (volatile u32 *)IOP3XX_REG_ADDR(0x0184)
90#define IOP3XX_ATUISR (volatile u32 *)IOP3XX_REG_ADDR(0x0188)
91#define IOP3XX_ATUIMR (volatile u32 *)IOP3XX_REG_ADDR(0x018c)
92#define IOP3XX_IABAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0190)
93#define IOP3XX_IAUBAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0194)
94#define IOP3XX_IALR3 (volatile u32 *)IOP3XX_REG_ADDR(0x0198)
95#define IOP3XX_IATVR3 (volatile u32 *)IOP3XX_REG_ADDR(0x019c)
96#define IOP3XX_OCCAR (volatile u32 *)IOP3XX_REG_ADDR(0x01a4)
97#define IOP3XX_OCCDR (volatile u32 *)IOP3XX_REG_ADDR(0x01ac)
98#define IOP3XX_PDSCR (volatile u32 *)IOP3XX_REG_ADDR(0x01bc)
99#define IOP3XX_PMCAPID (volatile u8 *)IOP3XX_REG_ADDR(0x01c0)
100#define IOP3XX_PMNEXT (volatile u8 *)IOP3XX_REG_ADDR(0x01c1)
101#define IOP3XX_APMCR (volatile u16 *)IOP3XX_REG_ADDR(0x01c2)
102#define IOP3XX_APMCSR (volatile u16 *)IOP3XX_REG_ADDR(0x01c4)
103#define IOP3XX_PCIXCAPID (volatile u8 *)IOP3XX_REG_ADDR(0x01e0)
104#define IOP3XX_PCIXNEXT (volatile u8 *)IOP3XX_REG_ADDR(0x01e1)
105#define IOP3XX_PCIXCMD (volatile u16 *)IOP3XX_REG_ADDR(0x01e2)
106#define IOP3XX_PCIXSR (volatile u32 *)IOP3XX_REG_ADDR(0x01e4)
107#define IOP3XX_PCIIRSR (volatile u32 *)IOP3XX_REG_ADDR(0x01ec)
108#define IOP3XX_PCSR_OUT_Q_BUSY (1 << 15)
109#define IOP3XX_PCSR_IN_Q_BUSY (1 << 14)
110#define IOP3XX_ATUCR_OUT_EN (1 << 1)
111
112#define IOP3XX_INIT_ATU_DEFAULT 0
113#define IOP3XX_INIT_ATU_DISABLE -1
114#define IOP3XX_INIT_ATU_ENABLE 1
115
116/* Messaging Unit */
117#define IOP3XX_IMR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0310)
118#define IOP3XX_IMR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0314)
119#define IOP3XX_OMR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0318)
120#define IOP3XX_OMR1 (volatile u32 *)IOP3XX_REG_ADDR(0x031c)
121#define IOP3XX_IDR (volatile u32 *)IOP3XX_REG_ADDR(0x0320)
122#define IOP3XX_IISR (volatile u32 *)IOP3XX_REG_ADDR(0x0324)
123#define IOP3XX_IIMR (volatile u32 *)IOP3XX_REG_ADDR(0x0328)
124#define IOP3XX_ODR (volatile u32 *)IOP3XX_REG_ADDR(0x032c)
125#define IOP3XX_OISR (volatile u32 *)IOP3XX_REG_ADDR(0x0330)
126#define IOP3XX_OIMR (volatile u32 *)IOP3XX_REG_ADDR(0x0334)
127#define IOP3XX_MUCR (volatile u32 *)IOP3XX_REG_ADDR(0x0350)
128#define IOP3XX_QBAR (volatile u32 *)IOP3XX_REG_ADDR(0x0354)
129#define IOP3XX_IFHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0360)
130#define IOP3XX_IFTPR (volatile u32 *)IOP3XX_REG_ADDR(0x0364)
131#define IOP3XX_IPHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0368)
132#define IOP3XX_IPTPR (volatile u32 *)IOP3XX_REG_ADDR(0x036c)
133#define IOP3XX_OFHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0370)
134#define IOP3XX_OFTPR (volatile u32 *)IOP3XX_REG_ADDR(0x0374)
135#define IOP3XX_OPHPR (volatile u32 *)IOP3XX_REG_ADDR(0x0378)
136#define IOP3XX_OPTPR (volatile u32 *)IOP3XX_REG_ADDR(0x037c)
137#define IOP3XX_IAR (volatile u32 *)IOP3XX_REG_ADDR(0x0380)
138
139/* DMA Controller */
140#define IOP3XX_DMA_PHYS_BASE(chan) (IOP3XX_PERIPHERAL_PHYS_BASE + \
141 (0x400 + (chan << 6)))
142#define IOP3XX_DMA_UPPER_PA(chan) (IOP3XX_DMA_PHYS_BASE(chan) + 0x27)
143
144/* Peripheral bus interface */
145#define IOP3XX_PBCR (volatile u32 *)IOP3XX_REG_ADDR(0x0680)
146#define IOP3XX_PBISR (volatile u32 *)IOP3XX_REG_ADDR(0x0684)
147#define IOP3XX_PBBAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0688)
148#define IOP3XX_PBLR0 (volatile u32 *)IOP3XX_REG_ADDR(0x068c)
149#define IOP3XX_PBBAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0690)
150#define IOP3XX_PBLR1 (volatile u32 *)IOP3XX_REG_ADDR(0x0694)
151#define IOP3XX_PBBAR2 (volatile u32 *)IOP3XX_REG_ADDR(0x0698)
152#define IOP3XX_PBLR2 (volatile u32 *)IOP3XX_REG_ADDR(0x069c)
153#define IOP3XX_PBBAR3 (volatile u32 *)IOP3XX_REG_ADDR(0x06a0)
154#define IOP3XX_PBLR3 (volatile u32 *)IOP3XX_REG_ADDR(0x06a4)
155#define IOP3XX_PBBAR4 (volatile u32 *)IOP3XX_REG_ADDR(0x06a8)
156#define IOP3XX_PBLR4 (volatile u32 *)IOP3XX_REG_ADDR(0x06ac)
157#define IOP3XX_PBBAR5 (volatile u32 *)IOP3XX_REG_ADDR(0x06b0)
158#define IOP3XX_PBLR5 (volatile u32 *)IOP3XX_REG_ADDR(0x06b4)
159#define IOP3XX_PMBR0 (volatile u32 *)IOP3XX_REG_ADDR(0x06c0)
160#define IOP3XX_PMBR1 (volatile u32 *)IOP3XX_REG_ADDR(0x06e0)
161#define IOP3XX_PMBR2 (volatile u32 *)IOP3XX_REG_ADDR(0x06e4)
162
163/* Peripheral performance monitoring unit */
164#define IOP3XX_GTMR (volatile u32 *)IOP3XX_REG_ADDR(0x0700)
165#define IOP3XX_ESR (volatile u32 *)IOP3XX_REG_ADDR(0x0704)
166#define IOP3XX_EMISR (volatile u32 *)IOP3XX_REG_ADDR(0x0708)
167#define IOP3XX_GTSR (volatile u32 *)IOP3XX_REG_ADDR(0x0710)
168/* PERCR0 DOESN'T EXIST - index from 1! */
169#define IOP3XX_PERCR0 (volatile u32 *)IOP3XX_REG_ADDR(0x0710)
170
171/* General Purpose I/O */
172#define IOP3XX_GPOE (volatile u32 *)IOP3XX_GPIO_REG(0x0000)
173#define IOP3XX_GPID (volatile u32 *)IOP3XX_GPIO_REG(0x0004)
174#define IOP3XX_GPOD (volatile u32 *)IOP3XX_GPIO_REG(0x0008)
175
176/* Timers */
177#define IOP3XX_TU_TMR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0000)
178#define IOP3XX_TU_TMR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0004)
179#define IOP3XX_TU_TCR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0008)
180#define IOP3XX_TU_TCR1 (volatile u32 *)IOP3XX_TIMER_REG(0x000c)
181#define IOP3XX_TU_TRR0 (volatile u32 *)IOP3XX_TIMER_REG(0x0010)
182#define IOP3XX_TU_TRR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0014)
183#define IOP3XX_TU_TISR (volatile u32 *)IOP3XX_TIMER_REG(0x0018)
184#define IOP3XX_TU_WDTCR (volatile u32 *)IOP3XX_TIMER_REG(0x001c)
185#define IOP_TMR_EN 0x02
186#define IOP_TMR_RELOAD 0x04
187#define IOP_TMR_PRIVILEGED 0x08
188#define IOP_TMR_RATIO_1_1 0x00
189
190/* Watchdog timer definitions */
191#define IOP_WDTCR_EN_ARM 0x1e1e1e1e
192#define IOP_WDTCR_EN 0xe1e1e1e1
193/* iop3xx does not support stopping the watchdog, so we just re-arm */
194#define IOP_WDTCR_DIS_ARM (IOP_WDTCR_EN_ARM)
195#define IOP_WDTCR_DIS (IOP_WDTCR_EN)
196
197/* Application accelerator unit */
198#define IOP3XX_AAU_PHYS_BASE (IOP3XX_PERIPHERAL_PHYS_BASE + 0x800)
199#define IOP3XX_AAU_UPPER_PA (IOP3XX_AAU_PHYS_BASE + 0xa7)
200
201/* I2C bus interface unit */
202#define IOP3XX_ICR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1680)
203#define IOP3XX_ISR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1684)
204#define IOP3XX_ISAR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1688)
205#define IOP3XX_IDBR0 (volatile u32 *)IOP3XX_REG_ADDR(0x168c)
206#define IOP3XX_IBMR0 (volatile u32 *)IOP3XX_REG_ADDR(0x1694)
207#define IOP3XX_ICR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a0)
208#define IOP3XX_ISR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a4)
209#define IOP3XX_ISAR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16a8)
210#define IOP3XX_IDBR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16ac)
211#define IOP3XX_IBMR1 (volatile u32 *)IOP3XX_REG_ADDR(0x16b4)
212
213
214/*
215 * IOP3XX I/O and Mem space regions for PCI autoconfiguration
216 */
217#define IOP3XX_PCI_LOWER_MEM_PA 0x80000000
218
219#define IOP3XX_PCI_IO_WINDOW_SIZE 0x00010000
220#define IOP3XX_PCI_LOWER_IO_PA 0x90000000
221#define IOP3XX_PCI_LOWER_IO_VA 0xfe000000
222#define IOP3XX_PCI_LOWER_IO_BA 0x90000000
223#define IOP3XX_PCI_UPPER_IO_PA (IOP3XX_PCI_LOWER_IO_PA +\
224 IOP3XX_PCI_IO_WINDOW_SIZE - 1)
225#define IOP3XX_PCI_UPPER_IO_VA (IOP3XX_PCI_LOWER_IO_VA +\
226 IOP3XX_PCI_IO_WINDOW_SIZE - 1)
227#define IOP3XX_PCI_IO_PHYS_TO_VIRT(addr) (((u32) (addr) -\
228 IOP3XX_PCI_LOWER_IO_PA) +\
229 IOP3XX_PCI_LOWER_IO_VA)
230
231
232#ifndef __ASSEMBLY__
233void iop3xx_map_io(void);
234void iop_init_cp6_handler(void);
235void iop_init_time(unsigned long tickrate);
236unsigned long iop_gettimeoffset(void);
237
238static inline void write_tmr0(u32 val)
239{
240 asm volatile("mcr p6, 0, %0, c0, c1, 0" : : "r" (val));
241}
242
243static inline void write_tmr1(u32 val)
244{
245 asm volatile("mcr p6, 0, %0, c1, c1, 0" : : "r" (val));
246}
247
248static inline u32 read_tcr0(void)
249{
250 u32 val;
251 asm volatile("mrc p6, 0, %0, c2, c1, 0" : "=r" (val));
252 return val;
253}
254
255static inline u32 read_tcr1(void)
256{
257 u32 val;
258 asm volatile("mrc p6, 0, %0, c3, c1, 0" : "=r" (val));
259 return val;
260}
261
262static inline void write_trr0(u32 val)
263{
264 asm volatile("mcr p6, 0, %0, c4, c1, 0" : : "r" (val));
265}
266
267static inline void write_trr1(u32 val)
268{
269 asm volatile("mcr p6, 0, %0, c5, c1, 0" : : "r" (val));
270}
271
272static inline void write_tisr(u32 val)
273{
274 asm volatile("mcr p6, 0, %0, c6, c1, 0" : : "r" (val));
275}
276
277static inline u32 read_wdtcr(void)
278{
279 u32 val;
280 asm volatile("mrc p6, 0, %0, c7, c1, 0":"=r" (val));
281 return val;
282}
283static inline void write_wdtcr(u32 val)
284{
285 asm volatile("mcr p6, 0, %0, c7, c1, 0"::"r" (val));
286}
287
288extern unsigned long get_iop_tick_rate(void);
289
290/* only iop13xx has these registers, we define these to present a
291 * common register interface for the iop_wdt driver.
292 */
293#define IOP_RCSR_WDT (0)
294static inline u32 read_rcsr(void)
295{
296 return 0;
297}
298static inline void write_wdtsr(u32 val)
299{
300 do { } while (0);
301}
302
303extern struct platform_device iop3xx_dma_0_channel;
304extern struct platform_device iop3xx_dma_1_channel;
305extern struct platform_device iop3xx_aau_channel;
306extern struct platform_device iop3xx_i2c0_device;
307extern struct platform_device iop3xx_i2c1_device;
308
309#endif
310
311
312#endif
diff --git a/arch/arm/include/asm/hardware/iop_adma.h b/arch/arm/include/asm/hardware/iop_adma.h
new file mode 100644
index 000000000000..cb7e3611bcba
--- /dev/null
+++ b/arch/arm/include/asm/hardware/iop_adma.h
@@ -0,0 +1,116 @@
1/*
2 * Copyright © 2006, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 */
18#ifndef IOP_ADMA_H
19#define IOP_ADMA_H
20#include <linux/types.h>
21#include <linux/dmaengine.h>
22#include <linux/interrupt.h>
23
24#define IOP_ADMA_SLOT_SIZE 32
25#define IOP_ADMA_THRESHOLD 4
26
27/**
28 * struct iop_adma_device - internal representation of an ADMA device
29 * @pdev: Platform device
30 * @id: HW ADMA Device selector
31 * @dma_desc_pool: base of DMA descriptor region (DMA address)
32 * @dma_desc_pool_virt: base of DMA descriptor region (CPU address)
33 * @common: embedded struct dma_device
34 */
35struct iop_adma_device {
36 struct platform_device *pdev;
37 int id;
38 dma_addr_t dma_desc_pool;
39 void *dma_desc_pool_virt;
40 struct dma_device common;
41};
42
43/**
44 * struct iop_adma_chan - internal representation of an ADMA device
45 * @pending: allows batching of hardware operations
46 * @completed_cookie: identifier for the most recently completed operation
47 * @lock: serializes enqueue/dequeue operations to the slot pool
48 * @mmr_base: memory mapped register base
49 * @chain: device chain view of the descriptors
50 * @device: parent device
51 * @common: common dmaengine channel object members
52 * @last_used: place holder for allocation to continue from where it left off
53 * @all_slots: complete domain of slots usable by the channel
54 * @slots_allocated: records the actual size of the descriptor slot pool
55 * @irq_tasklet: bottom half where iop_adma_slot_cleanup runs
56 */
57struct iop_adma_chan {
58 int pending;
59 dma_cookie_t completed_cookie;
60 spinlock_t lock; /* protects the descriptor slot pool */
61 void __iomem *mmr_base;
62 struct list_head chain;
63 struct iop_adma_device *device;
64 struct dma_chan common;
65 struct iop_adma_desc_slot *last_used;
66 struct list_head all_slots;
67 int slots_allocated;
68 struct tasklet_struct irq_tasklet;
69};
70
71/**
72 * struct iop_adma_desc_slot - IOP-ADMA software descriptor
73 * @slot_node: node on the iop_adma_chan.all_slots list
74 * @chain_node: node on the op_adma_chan.chain list
75 * @hw_desc: virtual address of the hardware descriptor chain
76 * @phys: hardware address of the hardware descriptor chain
77 * @group_head: first operation in a transaction
78 * @slot_cnt: total slots used in an transaction (group of operations)
79 * @slots_per_op: number of slots per operation
80 * @idx: pool index
81 * @unmap_src_cnt: number of xor sources
82 * @unmap_len: transaction bytecount
83 * @async_tx: support for the async_tx api
84 * @group_list: list of slots that make up a multi-descriptor transaction
85 * for example transfer lengths larger than the supported hw max
86 * @xor_check_result: result of zero sum
87 * @crc32_result: result crc calculation
88 */
89struct iop_adma_desc_slot {
90 struct list_head slot_node;
91 struct list_head chain_node;
92 void *hw_desc;
93 struct iop_adma_desc_slot *group_head;
94 u16 slot_cnt;
95 u16 slots_per_op;
96 u16 idx;
97 u16 unmap_src_cnt;
98 size_t unmap_len;
99 struct dma_async_tx_descriptor async_tx;
100 union {
101 u32 *xor_check_result;
102 u32 *crc32_result;
103 };
104};
105
106struct iop_adma_platform_data {
107 int hw_id;
108 dma_cap_mask_t cap_mask;
109 size_t pool_size;
110};
111
112#define to_iop_sw_desc(addr_hw_desc) \
113 container_of(addr_hw_desc, struct iop_adma_desc_slot, hw_desc)
114#define iop_hw_desc_slot_idx(hw_desc, idx) \
115 ( (void *) (((unsigned long) hw_desc) + ((idx) << 5)) )
116#endif
diff --git a/arch/arm/include/asm/hardware/it8152.h b/arch/arm/include/asm/hardware/it8152.h
new file mode 100644
index 000000000000..74b5fff7f575
--- /dev/null
+++ b/arch/arm/include/asm/hardware/it8152.h
@@ -0,0 +1,99 @@
1/*
2 * linux/include/arm/hardware/it8152.h
3 *
4 * Copyright Compulab Ltd., 2006,2007
5 * Mike Rapoport <mike@compulab.co.il>
6 *
7 * ITE 8152 companion chip register definitions
8 */
9
10#ifndef __ASM_HARDWARE_IT8152_H
11#define __ASM_HARDWARE_IT8152_H
12extern unsigned long it8152_base_address;
13
14#define IT8152_IO_BASE (it8152_base_address + 0x03e00000)
15#define IT8152_CFGREG_BASE (it8152_base_address + 0x03f00000)
16
17#define __REG_IT8152(x) (it8152_base_address + (x))
18
19#define IT8152_PCI_CFG_ADDR __REG_IT8152(0x3f00800)
20#define IT8152_PCI_CFG_DATA __REG_IT8152(0x3f00804)
21
22#define IT8152_INTC_LDCNIRR __REG_IT8152(0x3f00300)
23#define IT8152_INTC_LDPNIRR __REG_IT8152(0x3f00304)
24#define IT8152_INTC_LDCNIMR __REG_IT8152(0x3f00308)
25#define IT8152_INTC_LDPNIMR __REG_IT8152(0x3f0030C)
26#define IT8152_INTC_LDNITR __REG_IT8152(0x3f00310)
27#define IT8152_INTC_LDNIAR __REG_IT8152(0x3f00314)
28#define IT8152_INTC_LPCNIRR __REG_IT8152(0x3f00320)
29#define IT8152_INTC_LPPNIRR __REG_IT8152(0x3f00324)
30#define IT8152_INTC_LPCNIMR __REG_IT8152(0x3f00328)
31#define IT8152_INTC_LPPNIMR __REG_IT8152(0x3f0032C)
32#define IT8152_INTC_LPNITR __REG_IT8152(0x3f00330)
33#define IT8152_INTC_LPNIAR __REG_IT8152(0x3f00334)
34#define IT8152_INTC_PDCNIRR __REG_IT8152(0x3f00340)
35#define IT8152_INTC_PDPNIRR __REG_IT8152(0x3f00344)
36#define IT8152_INTC_PDCNIMR __REG_IT8152(0x3f00348)
37#define IT8152_INTC_PDPNIMR __REG_IT8152(0x3f0034C)
38#define IT8152_INTC_PDNITR __REG_IT8152(0x3f00350)
39#define IT8152_INTC_PDNIAR __REG_IT8152(0x3f00354)
40#define IT8152_INTC_INTC_TYPER __REG_IT8152(0x3f003FC)
41
42#define IT8152_GPIO_GPDR __REG_IT8152(0x3f00500)
43
44/*
45 Interrupt controller per register summary:
46 ---------------------------------------
47 LCDNIRR:
48 IT8152_LD_IRQ(8) PCICLK stop
49 IT8152_LD_IRQ(7) MCLK ready
50 IT8152_LD_IRQ(6) s/w
51 IT8152_LD_IRQ(5) UART
52 IT8152_LD_IRQ(4) GPIO
53 IT8152_LD_IRQ(3) TIMER 4
54 IT8152_LD_IRQ(2) TIMER 3
55 IT8152_LD_IRQ(1) TIMER 2
56 IT8152_LD_IRQ(0) TIMER 1
57
58 LPCNIRR:
59 IT8152_LP_IRQ(x) serial IRQ x
60
61 PCIDNIRR:
62 IT8152_PD_IRQ(14) PCISERR
63 IT8152_PD_IRQ(13) CPU/PCI bridge target abort (h2pTADR)
64 IT8152_PD_IRQ(12) CPU/PCI bridge master abort (h2pMADR)
65 IT8152_PD_IRQ(11) PCI INTD
66 IT8152_PD_IRQ(10) PCI INTC
67 IT8152_PD_IRQ(9) PCI INTB
68 IT8152_PD_IRQ(8) PCI INTA
69 IT8152_PD_IRQ(7) serial INTD
70 IT8152_PD_IRQ(6) serial INTC
71 IT8152_PD_IRQ(5) serial INTB
72 IT8152_PD_IRQ(4) serial INTA
73 IT8152_PD_IRQ(3) serial IRQ IOCHK (IOCHKR)
74 IT8152_PD_IRQ(2) chaining DMA (CDMAR)
75 IT8152_PD_IRQ(1) USB (USBR)
76 IT8152_PD_IRQ(0) Audio controller (ACR)
77 */
78/* frequently used interrupts */
79#define IT8152_PCISERR IT8152_PD_IRQ(14)
80#define IT8152_H2PTADR IT8152_PD_IRQ(13)
81#define IT8152_H2PMAR IT8152_PD_IRQ(12)
82#define IT8152_PCI_INTD IT8152_PD_IRQ(11)
83#define IT8152_PCI_INTC IT8152_PD_IRQ(10)
84#define IT8152_PCI_INTB IT8152_PD_IRQ(9)
85#define IT8152_PCI_INTA IT8152_PD_IRQ(8)
86#define IT8152_CDMA_INT IT8152_PD_IRQ(2)
87#define IT8152_USB_INT IT8152_PD_IRQ(1)
88#define IT8152_AUDIO_INT IT8152_PD_IRQ(0)
89
90struct pci_dev;
91struct pci_sys_data;
92
93extern void it8152_irq_demux(unsigned int irq, struct irq_desc *desc);
94extern void it8152_init_irq(void);
95extern int it8152_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
96extern int it8152_pci_setup(int nr, struct pci_sys_data *sys);
97extern struct pci_bus *it8152_pci_scan_bus(int nr, struct pci_sys_data *sys);
98
99#endif /* __ASM_HARDWARE_IT8152_H */
diff --git a/arch/arm/include/asm/hardware/linkup-l1110.h b/arch/arm/include/asm/hardware/linkup-l1110.h
new file mode 100644
index 000000000000..7ec91168a576
--- /dev/null
+++ b/arch/arm/include/asm/hardware/linkup-l1110.h
@@ -0,0 +1,48 @@
1/*
2*
3* Definitions for H3600 Handheld Computer
4*
5* Copyright 2001 Compaq Computer Corporation.
6*
7* Use consistent with the GNU GPL is permitted,
8* provided that this copyright notice is
9* preserved in its entirety in all copies and derived works.
10*
11* COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
12* AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
13* FITNESS FOR ANY PARTICULAR PURPOSE.
14*
15* Author: Jamey Hicks.
16*
17*/
18
19/* LinkUp Systems PCCard/CompactFlash Interface for SA-1100 */
20
21/* PC Card Status Register */
22#define LINKUP_PRS_S1 (1 << 0) /* voltage control bits S1-S4 */
23#define LINKUP_PRS_S2 (1 << 1)
24#define LINKUP_PRS_S3 (1 << 2)
25#define LINKUP_PRS_S4 (1 << 3)
26#define LINKUP_PRS_BVD1 (1 << 4)
27#define LINKUP_PRS_BVD2 (1 << 5)
28#define LINKUP_PRS_VS1 (1 << 6)
29#define LINKUP_PRS_VS2 (1 << 7)
30#define LINKUP_PRS_RDY (1 << 8)
31#define LINKUP_PRS_CD1 (1 << 9)
32#define LINKUP_PRS_CD2 (1 << 10)
33
34/* PC Card Command Register */
35#define LINKUP_PRC_S1 (1 << 0)
36#define LINKUP_PRC_S2 (1 << 1)
37#define LINKUP_PRC_S3 (1 << 2)
38#define LINKUP_PRC_S4 (1 << 3)
39#define LINKUP_PRC_RESET (1 << 4)
40#define LINKUP_PRC_APOE (1 << 5) /* Auto Power Off Enable: clears S1-S4 when either nCD goes high */
41#define LINKUP_PRC_CFE (1 << 6) /* CompactFlash mode Enable: addresses A[10:0] only, A[25:11] high */
42#define LINKUP_PRC_SOE (1 << 7) /* signal output driver enable */
43#define LINKUP_PRC_SSP (1 << 8) /* sock select polarity: 0 for socket 0, 1 for socket 1 */
44#define LINKUP_PRC_MBZ (1 << 15) /* must be zero */
45
46struct linkup_l1110 {
47 volatile short prc;
48};
diff --git a/arch/arm/include/asm/hardware/locomo.h b/arch/arm/include/asm/hardware/locomo.h
new file mode 100644
index 000000000000..954b1be991b4
--- /dev/null
+++ b/arch/arm/include/asm/hardware/locomo.h
@@ -0,0 +1,217 @@
1/*
2 * arch/arm/include/asm/hardware/locomo.h
3 *
4 * This file contains the definitions for the LoCoMo G/A Chip
5 *
6 * (C) Copyright 2004 John Lenz
7 *
8 * May be copied or modified under the terms of the GNU General Public
9 * License. See linux/COPYING for more information.
10 *
11 * Based on sa1111.h
12 */
13#ifndef _ASM_ARCH_LOCOMO
14#define _ASM_ARCH_LOCOMO
15
16#define locomo_writel(val,addr) ({ *(volatile u16 *)(addr) = (val); })
17#define locomo_readl(addr) (*(volatile u16 *)(addr))
18
19/* LOCOMO version */
20#define LOCOMO_VER 0x00
21
22/* Pin status */
23#define LOCOMO_ST 0x04
24
25/* Pin status */
26#define LOCOMO_C32K 0x08
27
28/* Interrupt controller */
29#define LOCOMO_ICR 0x0C
30
31/* MCS decoder for boot selecting */
32#define LOCOMO_MCSX0 0x10
33#define LOCOMO_MCSX1 0x14
34#define LOCOMO_MCSX2 0x18
35#define LOCOMO_MCSX3 0x1c
36
37/* Touch panel controller */
38#define LOCOMO_ASD 0x20 /* AD start delay */
39#define LOCOMO_HSD 0x28 /* HSYS delay */
40#define LOCOMO_HSC 0x2c /* HSYS period */
41#define LOCOMO_TADC 0x30 /* tablet ADC clock */
42
43
44/* Long time timer */
45#define LOCOMO_LTC 0xd8 /* LTC interrupt setting */
46#define LOCOMO_LTINT 0xdc /* LTC interrupt */
47
48/* DAC control signal for LCD (COMADJ ) */
49#define LOCOMO_DAC 0xe0
50/* DAC control */
51#define LOCOMO_DAC_SCLOEB 0x08 /* SCL pin output data */
52#define LOCOMO_DAC_TEST 0x04 /* Test bit */
53#define LOCOMO_DAC_SDA 0x02 /* SDA pin level (read-only) */
54#define LOCOMO_DAC_SDAOEB 0x01 /* SDA pin output data */
55
56/* SPI interface */
57#define LOCOMO_SPI 0x60
58#define LOCOMO_SPIMD 0x00 /* SPI mode setting */
59#define LOCOMO_SPICT 0x04 /* SPI mode control */
60#define LOCOMO_SPIST 0x08 /* SPI status */
61#define LOCOMO_SPI_TEND (1 << 3) /* Transfer end bit */
62#define LOCOMO_SPI_REND (1 << 2) /* Receive end bit */
63#define LOCOMO_SPI_RFW (1 << 1) /* write buffer bit */
64#define LOCOMO_SPI_RFR (1) /* read buffer bit */
65
66#define LOCOMO_SPIIS 0x10 /* SPI interrupt status */
67#define LOCOMO_SPIWE 0x14 /* SPI interrupt status write enable */
68#define LOCOMO_SPIIE 0x18 /* SPI interrupt enable */
69#define LOCOMO_SPIIR 0x1c /* SPI interrupt request */
70#define LOCOMO_SPITD 0x20 /* SPI transfer data write */
71#define LOCOMO_SPIRD 0x24 /* SPI receive data read */
72#define LOCOMO_SPITS 0x28 /* SPI transfer data shift */
73#define LOCOMO_SPIRS 0x2C /* SPI receive data shift */
74
75/* GPIO */
76#define LOCOMO_GPD 0x90 /* GPIO direction */
77#define LOCOMO_GPE 0x94 /* GPIO input enable */
78#define LOCOMO_GPL 0x98 /* GPIO level */
79#define LOCOMO_GPO 0x9c /* GPIO out data setting */
80#define LOCOMO_GRIE 0xa0 /* GPIO rise detection */
81#define LOCOMO_GFIE 0xa4 /* GPIO fall detection */
82#define LOCOMO_GIS 0xa8 /* GPIO edge detection status */
83#define LOCOMO_GWE 0xac /* GPIO status write enable */
84#define LOCOMO_GIE 0xb0 /* GPIO interrupt enable */
85#define LOCOMO_GIR 0xb4 /* GPIO interrupt request */
86#define LOCOMO_GPIO(Nb) (0x01 << (Nb))
87#define LOCOMO_GPIO_RTS LOCOMO_GPIO(0)
88#define LOCOMO_GPIO_CTS LOCOMO_GPIO(1)
89#define LOCOMO_GPIO_DSR LOCOMO_GPIO(2)
90#define LOCOMO_GPIO_DTR LOCOMO_GPIO(3)
91#define LOCOMO_GPIO_LCD_VSHA_ON LOCOMO_GPIO(4)
92#define LOCOMO_GPIO_LCD_VSHD_ON LOCOMO_GPIO(5)
93#define LOCOMO_GPIO_LCD_VEE_ON LOCOMO_GPIO(6)
94#define LOCOMO_GPIO_LCD_MOD LOCOMO_GPIO(7)
95#define LOCOMO_GPIO_DAC_ON LOCOMO_GPIO(8)
96#define LOCOMO_GPIO_FL_VR LOCOMO_GPIO(9)
97#define LOCOMO_GPIO_DAC_SDATA LOCOMO_GPIO(10)
98#define LOCOMO_GPIO_DAC_SCK LOCOMO_GPIO(11)
99#define LOCOMO_GPIO_DAC_SLOAD LOCOMO_GPIO(12)
100#define LOCOMO_GPIO_CARD_DETECT LOCOMO_GPIO(13)
101#define LOCOMO_GPIO_WRITE_PROT LOCOMO_GPIO(14)
102#define LOCOMO_GPIO_CARD_POWER LOCOMO_GPIO(15)
103
104/* Start the definitions of the devices. Each device has an initial
105 * base address and a series of offsets from that base address. */
106
107/* Keyboard controller */
108#define LOCOMO_KEYBOARD 0x40
109#define LOCOMO_KIB 0x00 /* KIB level */
110#define LOCOMO_KSC 0x04 /* KSTRB control */
111#define LOCOMO_KCMD 0x08 /* KSTRB command */
112#define LOCOMO_KIC 0x0c /* Key interrupt */
113
114/* Front light adjustment controller */
115#define LOCOMO_FRONTLIGHT 0xc8
116#define LOCOMO_ALS 0x00 /* Adjust light cycle */
117#define LOCOMO_ALD 0x04 /* Adjust light duty */
118
119#define LOCOMO_ALC_EN 0x8000
120
121/* Backlight controller: TFT signal */
122#define LOCOMO_BACKLIGHT 0x38
123#define LOCOMO_TC 0x00 /* TFT control signal */
124#define LOCOMO_CPSD 0x04 /* CPS delay */
125
126/* Audio controller */
127#define LOCOMO_AUDIO 0x54
128#define LOCOMO_ACC 0x00 /* Audio clock */
129#define LOCOMO_PAIF 0xD0 /* PCM audio interface */
130/* Audio clock */
131#define LOCOMO_ACC_XON 0x80
132#define LOCOMO_ACC_XEN 0x40
133#define LOCOMO_ACC_XSEL0 0x00
134#define LOCOMO_ACC_XSEL1 0x20
135#define LOCOMO_ACC_MCLKEN 0x10
136#define LOCOMO_ACC_64FSEN 0x08
137#define LOCOMO_ACC_CLKSEL000 0x00 /* mclk 2 */
138#define LOCOMO_ACC_CLKSEL001 0x01 /* mclk 3 */
139#define LOCOMO_ACC_CLKSEL010 0x02 /* mclk 4 */
140#define LOCOMO_ACC_CLKSEL011 0x03 /* mclk 6 */
141#define LOCOMO_ACC_CLKSEL100 0x04 /* mclk 8 */
142#define LOCOMO_ACC_CLKSEL101 0x05 /* mclk 12 */
143/* PCM audio interface */
144#define LOCOMO_PAIF_SCINV 0x20
145#define LOCOMO_PAIF_SCEN 0x10
146#define LOCOMO_PAIF_LRCRST 0x08
147#define LOCOMO_PAIF_LRCEVE 0x04
148#define LOCOMO_PAIF_LRCINV 0x02
149#define LOCOMO_PAIF_LRCEN 0x01
150
151/* LED controller */
152#define LOCOMO_LED 0xe8
153#define LOCOMO_LPT0 0x00
154#define LOCOMO_LPT1 0x04
155/* LED control */
156#define LOCOMO_LPT_TOFH 0x80
157#define LOCOMO_LPT_TOFL 0x08
158#define LOCOMO_LPT_TOH(TOH) ((TOH & 0x7) << 4)
159#define LOCOMO_LPT_TOL(TOL) ((TOL & 0x7))
160
161extern struct bus_type locomo_bus_type;
162
163#define LOCOMO_DEVID_KEYBOARD 0
164#define LOCOMO_DEVID_FRONTLIGHT 1
165#define LOCOMO_DEVID_BACKLIGHT 2
166#define LOCOMO_DEVID_AUDIO 3
167#define LOCOMO_DEVID_LED 4
168#define LOCOMO_DEVID_UART 5
169#define LOCOMO_DEVID_SPI 6
170
171struct locomo_dev {
172 struct device dev;
173 unsigned int devid;
174 unsigned int irq[1];
175
176 void *mapbase;
177 unsigned long length;
178
179 u64 dma_mask;
180};
181
182#define LOCOMO_DEV(_d) container_of((_d), struct locomo_dev, dev)
183
184#define locomo_get_drvdata(d) dev_get_drvdata(&(d)->dev)
185#define locomo_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, p)
186
187struct locomo_driver {
188 struct device_driver drv;
189 unsigned int devid;
190 int (*probe)(struct locomo_dev *);
191 int (*remove)(struct locomo_dev *);
192 int (*suspend)(struct locomo_dev *, pm_message_t);
193 int (*resume)(struct locomo_dev *);
194};
195
196#define LOCOMO_DRV(_d) container_of((_d), struct locomo_driver, drv)
197
198#define LOCOMO_DRIVER_NAME(_ldev) ((_ldev)->dev.driver->name)
199
200void locomo_lcd_power(struct locomo_dev *, int, unsigned int);
201
202int locomo_driver_register(struct locomo_driver *);
203void locomo_driver_unregister(struct locomo_driver *);
204
205/* GPIO control functions */
206void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir);
207int locomo_gpio_read_level(struct device *dev, unsigned int bits);
208int locomo_gpio_read_output(struct device *dev, unsigned int bits);
209void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set);
210
211/* M62332 control function */
212void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel);
213
214/* Frontlight control */
215void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf);
216
217#endif
diff --git a/arch/arm/include/asm/hardware/memc.h b/arch/arm/include/asm/hardware/memc.h
new file mode 100644
index 000000000000..42ba7c167d1f
--- /dev/null
+++ b/arch/arm/include/asm/hardware/memc.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/include/asm/hardware/memc.h
3 *
4 * Copyright (C) Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#define VDMA_ALIGNMENT PAGE_SIZE
11#define VDMA_XFERSIZE 16
12#define VDMA_INIT 0
13#define VDMA_START 1
14#define VDMA_END 2
15
16#ifndef __ASSEMBLY__
17extern void memc_write(unsigned int reg, unsigned long val);
18
19#define video_set_dma(start,end,offset) \
20do { \
21 memc_write (VDMA_START, (start >> 2)); \
22 memc_write (VDMA_END, (end - VDMA_XFERSIZE) >> 2); \
23 memc_write (VDMA_INIT, (offset >> 2)); \
24} while (0)
25
26#endif
diff --git a/arch/arm/include/asm/hardware/pci_v3.h b/arch/arm/include/asm/hardware/pci_v3.h
new file mode 100644
index 000000000000..2811c7e2cfdf
--- /dev/null
+++ b/arch/arm/include/asm/hardware/pci_v3.h
@@ -0,0 +1,186 @@
1/*
2 * arch/arm/include/asm/hardware/pci_v3.h
3 *
4 * Internal header file PCI V3 chip
5 *
6 * Copyright (C) ARM Limited
7 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd.
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#ifndef ASM_ARM_HARDWARE_PCI_V3_H
24#define ASM_ARM_HARDWARE_PCI_V3_H
25
26/* -------------------------------------------------------------------------------
27 * V3 Local Bus to PCI Bridge definitions
28 * -------------------------------------------------------------------------------
29 * Registers (these are taken from page 129 of the EPC User's Manual Rev 1.04
30 * All V3 register names are prefaced by V3_ to avoid clashing with any other
31 * PCI definitions. Their names match the user's manual.
32 *
33 * I'm assuming that I20 is disabled.
34 *
35 */
36#define V3_PCI_VENDOR 0x00000000
37#define V3_PCI_DEVICE 0x00000002
38#define V3_PCI_CMD 0x00000004
39#define V3_PCI_STAT 0x00000006
40#define V3_PCI_CC_REV 0x00000008
41#define V3_PCI_HDR_CFG 0x0000000C
42#define V3_PCI_IO_BASE 0x00000010
43#define V3_PCI_BASE0 0x00000014
44#define V3_PCI_BASE1 0x00000018
45#define V3_PCI_SUB_VENDOR 0x0000002C
46#define V3_PCI_SUB_ID 0x0000002E
47#define V3_PCI_ROM 0x00000030
48#define V3_PCI_BPARAM 0x0000003C
49#define V3_PCI_MAP0 0x00000040
50#define V3_PCI_MAP1 0x00000044
51#define V3_PCI_INT_STAT 0x00000048
52#define V3_PCI_INT_CFG 0x0000004C
53#define V3_LB_BASE0 0x00000054
54#define V3_LB_BASE1 0x00000058
55#define V3_LB_MAP0 0x0000005E
56#define V3_LB_MAP1 0x00000062
57#define V3_LB_BASE2 0x00000064
58#define V3_LB_MAP2 0x00000066
59#define V3_LB_SIZE 0x00000068
60#define V3_LB_IO_BASE 0x0000006E
61#define V3_FIFO_CFG 0x00000070
62#define V3_FIFO_PRIORITY 0x00000072
63#define V3_FIFO_STAT 0x00000074
64#define V3_LB_ISTAT 0x00000076
65#define V3_LB_IMASK 0x00000077
66#define V3_SYSTEM 0x00000078
67#define V3_LB_CFG 0x0000007A
68#define V3_PCI_CFG 0x0000007C
69#define V3_DMA_PCI_ADR0 0x00000080
70#define V3_DMA_PCI_ADR1 0x00000090
71#define V3_DMA_LOCAL_ADR0 0x00000084
72#define V3_DMA_LOCAL_ADR1 0x00000094
73#define V3_DMA_LENGTH0 0x00000088
74#define V3_DMA_LENGTH1 0x00000098
75#define V3_DMA_CSR0 0x0000008B
76#define V3_DMA_CSR1 0x0000009B
77#define V3_DMA_CTLB_ADR0 0x0000008C
78#define V3_DMA_CTLB_ADR1 0x0000009C
79#define V3_DMA_DELAY 0x000000E0
80#define V3_MAIL_DATA 0x000000C0
81#define V3_PCI_MAIL_IEWR 0x000000D0
82#define V3_PCI_MAIL_IERD 0x000000D2
83#define V3_LB_MAIL_IEWR 0x000000D4
84#define V3_LB_MAIL_IERD 0x000000D6
85#define V3_MAIL_WR_STAT 0x000000D8
86#define V3_MAIL_RD_STAT 0x000000DA
87#define V3_QBA_MAP 0x000000DC
88
89/* PCI COMMAND REGISTER bits
90 */
91#define V3_COMMAND_M_FBB_EN (1 << 9)
92#define V3_COMMAND_M_SERR_EN (1 << 8)
93#define V3_COMMAND_M_PAR_EN (1 << 6)
94#define V3_COMMAND_M_MASTER_EN (1 << 2)
95#define V3_COMMAND_M_MEM_EN (1 << 1)
96#define V3_COMMAND_M_IO_EN (1 << 0)
97
98/* SYSTEM REGISTER bits
99 */
100#define V3_SYSTEM_M_RST_OUT (1 << 15)
101#define V3_SYSTEM_M_LOCK (1 << 14)
102
103/* PCI_CFG bits
104 */
105#define V3_PCI_CFG_M_I2O_EN (1 << 15)
106#define V3_PCI_CFG_M_IO_REG_DIS (1 << 14)
107#define V3_PCI_CFG_M_IO_DIS (1 << 13)
108#define V3_PCI_CFG_M_EN3V (1 << 12)
109#define V3_PCI_CFG_M_RETRY_EN (1 << 10)
110#define V3_PCI_CFG_M_AD_LOW1 (1 << 9)
111#define V3_PCI_CFG_M_AD_LOW0 (1 << 8)
112
113/* PCI_BASE register bits (PCI -> Local Bus)
114 */
115#define V3_PCI_BASE_M_ADR_BASE 0xFFF00000
116#define V3_PCI_BASE_M_ADR_BASEL 0x000FFF00
117#define V3_PCI_BASE_M_PREFETCH (1 << 3)
118#define V3_PCI_BASE_M_TYPE (3 << 1)
119#define V3_PCI_BASE_M_IO (1 << 0)
120
121/* PCI MAP register bits (PCI -> Local bus)
122 */
123#define V3_PCI_MAP_M_MAP_ADR 0xFFF00000
124#define V3_PCI_MAP_M_RD_POST_INH (1 << 15)
125#define V3_PCI_MAP_M_ROM_SIZE (3 << 10)
126#define V3_PCI_MAP_M_SWAP (3 << 8)
127#define V3_PCI_MAP_M_ADR_SIZE 0x000000F0
128#define V3_PCI_MAP_M_REG_EN (1 << 1)
129#define V3_PCI_MAP_M_ENABLE (1 << 0)
130
131/*
132 * LB_BASE0,1 register bits (Local bus -> PCI)
133 */
134#define V3_LB_BASE_ADR_BASE 0xfff00000
135#define V3_LB_BASE_SWAP (3 << 8)
136#define V3_LB_BASE_ADR_SIZE (15 << 4)
137#define V3_LB_BASE_PREFETCH (1 << 3)
138#define V3_LB_BASE_ENABLE (1 << 0)
139
140#define V3_LB_BASE_ADR_SIZE_1MB (0 << 4)
141#define V3_LB_BASE_ADR_SIZE_2MB (1 << 4)
142#define V3_LB_BASE_ADR_SIZE_4MB (2 << 4)
143#define V3_LB_BASE_ADR_SIZE_8MB (3 << 4)
144#define V3_LB_BASE_ADR_SIZE_16MB (4 << 4)
145#define V3_LB_BASE_ADR_SIZE_32MB (5 << 4)
146#define V3_LB_BASE_ADR_SIZE_64MB (6 << 4)
147#define V3_LB_BASE_ADR_SIZE_128MB (7 << 4)
148#define V3_LB_BASE_ADR_SIZE_256MB (8 << 4)
149#define V3_LB_BASE_ADR_SIZE_512MB (9 << 4)
150#define V3_LB_BASE_ADR_SIZE_1GB (10 << 4)
151#define V3_LB_BASE_ADR_SIZE_2GB (11 << 4)
152
153#define v3_addr_to_lb_base(a) ((a) & V3_LB_BASE_ADR_BASE)
154
155/*
156 * LB_MAP0,1 register bits (Local bus -> PCI)
157 */
158#define V3_LB_MAP_MAP_ADR 0xfff0
159#define V3_LB_MAP_TYPE (7 << 1)
160#define V3_LB_MAP_AD_LOW_EN (1 << 0)
161
162#define V3_LB_MAP_TYPE_IACK (0 << 1)
163#define V3_LB_MAP_TYPE_IO (1 << 1)
164#define V3_LB_MAP_TYPE_MEM (3 << 1)
165#define V3_LB_MAP_TYPE_CONFIG (5 << 1)
166#define V3_LB_MAP_TYPE_MEM_MULTIPLE (6 << 1)
167
168#define v3_addr_to_lb_map(a) (((a) >> 16) & V3_LB_MAP_MAP_ADR)
169
170/*
171 * LB_BASE2 register bits (Local bus -> PCI IO)
172 */
173#define V3_LB_BASE2_ADR_BASE 0xff00
174#define V3_LB_BASE2_SWAP (3 << 6)
175#define V3_LB_BASE2_ENABLE (1 << 0)
176
177#define v3_addr_to_lb_base2(a) (((a) >> 16) & V3_LB_BASE2_ADR_BASE)
178
179/*
180 * LB_MAP2 register bits (Local bus -> PCI IO)
181 */
182#define V3_LB_MAP2_MAP_ADR 0xff00
183
184#define v3_addr_to_lb_map2(a) (((a) >> 16) & V3_LB_MAP2_MAP_ADR)
185
186#endif
diff --git a/arch/arm/include/asm/hardware/sa1111.h b/arch/arm/include/asm/hardware/sa1111.h
new file mode 100644
index 000000000000..5da2595759e5
--- /dev/null
+++ b/arch/arm/include/asm/hardware/sa1111.h
@@ -0,0 +1,581 @@
1/*
2 * arch/arm/include/asm/hardware/sa1111.h
3 *
4 * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
5 *
6 * This file contains definitions for the SA-1111 Companion Chip.
7 * (Structure and naming borrowed from SA-1101.h, by Peter Danielsson.)
8 *
9 * Macro that calculates real address for registers in the SA-1111
10 */
11
12#ifndef _ASM_ARCH_SA1111
13#define _ASM_ARCH_SA1111
14
15#include <mach/bitfield.h>
16
17/*
18 * The SA1111 is always located at virtual 0xf4000000, and is always
19 * "native" endian.
20 */
21
22#define SA1111_VBASE 0xf4000000
23
24/* Don't use these! */
25#define SA1111_p2v( x ) ((x) - SA1111_BASE + SA1111_VBASE)
26#define SA1111_v2p( x ) ((x) - SA1111_VBASE + SA1111_BASE)
27
28#ifndef __ASSEMBLY__
29#define _SA1111(x) ((x) + sa1111->resource.start)
30#endif
31
32#define sa1111_writel(val,addr) __raw_writel(val, addr)
33#define sa1111_readl(addr) __raw_readl(addr)
34
35/*
36 * 26 bits of the SA-1110 address bus are available to the SA-1111.
37 * Use these when feeding target addresses to the DMA engines.
38 */
39
40#define SA1111_ADDR_WIDTH (26)
41#define SA1111_ADDR_MASK ((1<<SA1111_ADDR_WIDTH)-1)
42#define SA1111_DMA_ADDR(x) ((x)&SA1111_ADDR_MASK)
43
44/*
45 * Don't ask the (SAC) DMA engines to move less than this amount.
46 */
47
48#define SA1111_SAC_DMA_MIN_XFER (0x800)
49
50/*
51 * System Bus Interface (SBI)
52 *
53 * Registers
54 * SKCR Control Register
55 * SMCR Shared Memory Controller Register
56 * SKID ID Register
57 */
58#define SA1111_SKCR 0x0000
59#define SA1111_SMCR 0x0004
60#define SA1111_SKID 0x0008
61
62#define SKCR_PLL_BYPASS (1<<0)
63#define SKCR_RCLKEN (1<<1)
64#define SKCR_SLEEP (1<<2)
65#define SKCR_DOZE (1<<3)
66#define SKCR_VCO_OFF (1<<4)
67#define SKCR_SCANTSTEN (1<<5)
68#define SKCR_CLKTSTEN (1<<6)
69#define SKCR_RDYEN (1<<7)
70#define SKCR_SELAC (1<<8)
71#define SKCR_OPPC (1<<9)
72#define SKCR_PLLTSTEN (1<<10)
73#define SKCR_USBIOTSTEN (1<<11)
74/*
75 * Don't believe the specs! Take them, throw them outside. Leave them
76 * there for a week. Spit on them. Walk on them. Stamp on them.
77 * Pour gasoline over them and finally burn them. Now think about coding.
78 * - The October 1999 errata (278260-007) says its bit 13, 1 to enable.
79 * - The Feb 2001 errata (278260-010) says that the previous errata
80 * (278260-009) is wrong, and its bit actually 12, fixed in spec
81 * 278242-003.
82 * - The SA1111 manual (278242) says bit 12, but 0 to enable.
83 * - Reality is bit 13, 1 to enable.
84 * -- rmk
85 */
86#define SKCR_OE_EN (1<<13)
87
88#define SMCR_DTIM (1<<0)
89#define SMCR_MBGE (1<<1)
90#define SMCR_DRAC_0 (1<<2)
91#define SMCR_DRAC_1 (1<<3)
92#define SMCR_DRAC_2 (1<<4)
93#define SMCR_DRAC Fld(3, 2)
94#define SMCR_CLAT (1<<5)
95
96#define SKID_SIREV_MASK (0x000000f0)
97#define SKID_MTREV_MASK (0x0000000f)
98#define SKID_ID_MASK (0xffffff00)
99#define SKID_SA1111_ID (0x690cc200)
100
101/*
102 * System Controller
103 *
104 * Registers
105 * SKPCR Power Control Register
106 * SKCDR Clock Divider Register
107 * SKAUD Audio Clock Divider Register
108 * SKPMC PS/2 Mouse Clock Divider Register
109 * SKPTC PS/2 Track Pad Clock Divider Register
110 * SKPEN0 PWM0 Enable Register
111 * SKPWM0 PWM0 Clock Register
112 * SKPEN1 PWM1 Enable Register
113 * SKPWM1 PWM1 Clock Register
114 */
115#define SA1111_SKPCR 0x0200
116#define SA1111_SKCDR 0x0204
117#define SA1111_SKAUD 0x0208
118#define SA1111_SKPMC 0x020c
119#define SA1111_SKPTC 0x0210
120#define SA1111_SKPEN0 0x0214
121#define SA1111_SKPWM0 0x0218
122#define SA1111_SKPEN1 0x021c
123#define SA1111_SKPWM1 0x0220
124
125#define SKPCR_UCLKEN (1<<0)
126#define SKPCR_ACCLKEN (1<<1)
127#define SKPCR_I2SCLKEN (1<<2)
128#define SKPCR_L3CLKEN (1<<3)
129#define SKPCR_SCLKEN (1<<4)
130#define SKPCR_PMCLKEN (1<<5)
131#define SKPCR_PTCLKEN (1<<6)
132#define SKPCR_DCLKEN (1<<7)
133#define SKPCR_PWMCLKEN (1<<8)
134
135/*
136 * USB Host controller
137 */
138#define SA1111_USB 0x0400
139
140/*
141 * Offsets from SA1111_USB_BASE
142 */
143#define SA1111_USB_STATUS 0x0118
144#define SA1111_USB_RESET 0x011c
145#define SA1111_USB_IRQTEST 0x0120
146
147#define USB_RESET_FORCEIFRESET (1 << 0)
148#define USB_RESET_FORCEHCRESET (1 << 1)
149#define USB_RESET_CLKGENRESET (1 << 2)
150#define USB_RESET_SIMSCALEDOWN (1 << 3)
151#define USB_RESET_USBINTTEST (1 << 4)
152#define USB_RESET_SLEEPSTBYEN (1 << 5)
153#define USB_RESET_PWRSENSELOW (1 << 6)
154#define USB_RESET_PWRCTRLLOW (1 << 7)
155
156#define USB_STATUS_IRQHCIRMTWKUP (1 << 7)
157#define USB_STATUS_IRQHCIBUFFACC (1 << 8)
158#define USB_STATUS_NIRQHCIM (1 << 9)
159#define USB_STATUS_NHCIMFCLR (1 << 10)
160#define USB_STATUS_USBPWRSENSE (1 << 11)
161
162/*
163 * Serial Audio Controller
164 *
165 * Registers
166 * SACR0 Serial Audio Common Control Register
167 * SACR1 Serial Audio Alternate Mode (I2C/MSB) Control Register
168 * SACR2 Serial Audio AC-link Control Register
169 * SASR0 Serial Audio I2S/MSB Interface & FIFO Status Register
170 * SASR1 Serial Audio AC-link Interface & FIFO Status Register
171 * SASCR Serial Audio Status Clear Register
172 * L3_CAR L3 Control Bus Address Register
173 * L3_CDR L3 Control Bus Data Register
174 * ACCAR AC-link Command Address Register
175 * ACCDR AC-link Command Data Register
176 * ACSAR AC-link Status Address Register
177 * ACSDR AC-link Status Data Register
178 * SADTCS Serial Audio DMA Transmit Control/Status Register
179 * SADTSA Serial Audio DMA Transmit Buffer Start Address A
180 * SADTCA Serial Audio DMA Transmit Buffer Count Register A
181 * SADTSB Serial Audio DMA Transmit Buffer Start Address B
182 * SADTCB Serial Audio DMA Transmit Buffer Count Register B
183 * SADRCS Serial Audio DMA Receive Control/Status Register
184 * SADRSA Serial Audio DMA Receive Buffer Start Address A
185 * SADRCA Serial Audio DMA Receive Buffer Count Register A
186 * SADRSB Serial Audio DMA Receive Buffer Start Address B
187 * SADRCB Serial Audio DMA Receive Buffer Count Register B
188 * SAITR Serial Audio Interrupt Test Register
189 * SADR Serial Audio Data Register (16 x 32-bit)
190 */
191
192#define SA1111_SERAUDIO 0x0600
193
194/*
195 * These are offsets from the above base.
196 */
197#define SA1111_SACR0 0x00
198#define SA1111_SACR1 0x04
199#define SA1111_SACR2 0x08
200#define SA1111_SASR0 0x0c
201#define SA1111_SASR1 0x10
202#define SA1111_SASCR 0x18
203#define SA1111_L3_CAR 0x1c
204#define SA1111_L3_CDR 0x20
205#define SA1111_ACCAR 0x24
206#define SA1111_ACCDR 0x28
207#define SA1111_ACSAR 0x2c
208#define SA1111_ACSDR 0x30
209#define SA1111_SADTCS 0x34
210#define SA1111_SADTSA 0x38
211#define SA1111_SADTCA 0x3c
212#define SA1111_SADTSB 0x40
213#define SA1111_SADTCB 0x44
214#define SA1111_SADRCS 0x48
215#define SA1111_SADRSA 0x4c
216#define SA1111_SADRCA 0x50
217#define SA1111_SADRSB 0x54
218#define SA1111_SADRCB 0x58
219#define SA1111_SAITR 0x5c
220#define SA1111_SADR 0x80
221
222#ifndef CONFIG_ARCH_PXA
223
224#define SACR0_ENB (1<<0)
225#define SACR0_BCKD (1<<2)
226#define SACR0_RST (1<<3)
227
228#define SACR1_AMSL (1<<0)
229#define SACR1_L3EN (1<<1)
230#define SACR1_L3MB (1<<2)
231#define SACR1_DREC (1<<3)
232#define SACR1_DRPL (1<<4)
233#define SACR1_ENLBF (1<<5)
234
235#define SACR2_TS3V (1<<0)
236#define SACR2_TS4V (1<<1)
237#define SACR2_WKUP (1<<2)
238#define SACR2_DREC (1<<3)
239#define SACR2_DRPL (1<<4)
240#define SACR2_ENLBF (1<<5)
241#define SACR2_RESET (1<<6)
242
243#define SASR0_TNF (1<<0)
244#define SASR0_RNE (1<<1)
245#define SASR0_BSY (1<<2)
246#define SASR0_TFS (1<<3)
247#define SASR0_RFS (1<<4)
248#define SASR0_TUR (1<<5)
249#define SASR0_ROR (1<<6)
250#define SASR0_L3WD (1<<16)
251#define SASR0_L3RD (1<<17)
252
253#define SASR1_TNF (1<<0)
254#define SASR1_RNE (1<<1)
255#define SASR1_BSY (1<<2)
256#define SASR1_TFS (1<<3)
257#define SASR1_RFS (1<<4)
258#define SASR1_TUR (1<<5)
259#define SASR1_ROR (1<<6)
260#define SASR1_CADT (1<<16)
261#define SASR1_SADR (1<<17)
262#define SASR1_RSTO (1<<18)
263#define SASR1_CLPM (1<<19)
264#define SASR1_CRDY (1<<20)
265#define SASR1_RS3V (1<<21)
266#define SASR1_RS4V (1<<22)
267
268#define SASCR_TUR (1<<5)
269#define SASCR_ROR (1<<6)
270#define SASCR_DTS (1<<16)
271#define SASCR_RDD (1<<17)
272#define SASCR_STO (1<<18)
273
274#define SADTCS_TDEN (1<<0)
275#define SADTCS_TDIE (1<<1)
276#define SADTCS_TDBDA (1<<3)
277#define SADTCS_TDSTA (1<<4)
278#define SADTCS_TDBDB (1<<5)
279#define SADTCS_TDSTB (1<<6)
280#define SADTCS_TBIU (1<<7)
281
282#define SADRCS_RDEN (1<<0)
283#define SADRCS_RDIE (1<<1)
284#define SADRCS_RDBDA (1<<3)
285#define SADRCS_RDSTA (1<<4)
286#define SADRCS_RDBDB (1<<5)
287#define SADRCS_RDSTB (1<<6)
288#define SADRCS_RBIU (1<<7)
289
290#define SAD_CS_DEN (1<<0)
291#define SAD_CS_DIE (1<<1) /* Not functional on metal 1 */
292#define SAD_CS_DBDA (1<<3) /* Not functional on metal 1 */
293#define SAD_CS_DSTA (1<<4)
294#define SAD_CS_DBDB (1<<5) /* Not functional on metal 1 */
295#define SAD_CS_DSTB (1<<6)
296#define SAD_CS_BIU (1<<7) /* Not functional on metal 1 */
297
298#define SAITR_TFS (1<<0)
299#define SAITR_RFS (1<<1)
300#define SAITR_TUR (1<<2)
301#define SAITR_ROR (1<<3)
302#define SAITR_CADT (1<<4)
303#define SAITR_SADR (1<<5)
304#define SAITR_RSTO (1<<6)
305#define SAITR_TDBDA (1<<8)
306#define SAITR_TDBDB (1<<9)
307#define SAITR_RDBDA (1<<10)
308#define SAITR_RDBDB (1<<11)
309
310#endif /* !CONFIG_ARCH_PXA */
311
312/*
313 * General-Purpose I/O Interface
314 *
315 * Registers
316 * PA_DDR GPIO Block A Data Direction
317 * PA_DRR/PA_DWR GPIO Block A Data Value Register (read/write)
318 * PA_SDR GPIO Block A Sleep Direction
319 * PA_SSR GPIO Block A Sleep State
320 * PB_DDR GPIO Block B Data Direction
321 * PB_DRR/PB_DWR GPIO Block B Data Value Register (read/write)
322 * PB_SDR GPIO Block B Sleep Direction
323 * PB_SSR GPIO Block B Sleep State
324 * PC_DDR GPIO Block C Data Direction
325 * PC_DRR/PC_DWR GPIO Block C Data Value Register (read/write)
326 * PC_SDR GPIO Block C Sleep Direction
327 * PC_SSR GPIO Block C Sleep State
328 */
329
330#define _PA_DDR _SA1111( 0x1000 )
331#define _PA_DRR _SA1111( 0x1004 )
332#define _PA_DWR _SA1111( 0x1004 )
333#define _PA_SDR _SA1111( 0x1008 )
334#define _PA_SSR _SA1111( 0x100c )
335#define _PB_DDR _SA1111( 0x1010 )
336#define _PB_DRR _SA1111( 0x1014 )
337#define _PB_DWR _SA1111( 0x1014 )
338#define _PB_SDR _SA1111( 0x1018 )
339#define _PB_SSR _SA1111( 0x101c )
340#define _PC_DDR _SA1111( 0x1020 )
341#define _PC_DRR _SA1111( 0x1024 )
342#define _PC_DWR _SA1111( 0x1024 )
343#define _PC_SDR _SA1111( 0x1028 )
344#define _PC_SSR _SA1111( 0x102c )
345
346#define SA1111_GPIO 0x1000
347
348#define SA1111_GPIO_PADDR (0x000)
349#define SA1111_GPIO_PADRR (0x004)
350#define SA1111_GPIO_PADWR (0x004)
351#define SA1111_GPIO_PASDR (0x008)
352#define SA1111_GPIO_PASSR (0x00c)
353#define SA1111_GPIO_PBDDR (0x010)
354#define SA1111_GPIO_PBDRR (0x014)
355#define SA1111_GPIO_PBDWR (0x014)
356#define SA1111_GPIO_PBSDR (0x018)
357#define SA1111_GPIO_PBSSR (0x01c)
358#define SA1111_GPIO_PCDDR (0x020)
359#define SA1111_GPIO_PCDRR (0x024)
360#define SA1111_GPIO_PCDWR (0x024)
361#define SA1111_GPIO_PCSDR (0x028)
362#define SA1111_GPIO_PCSSR (0x02c)
363
364#define GPIO_A0 (1 << 0)
365#define GPIO_A1 (1 << 1)
366#define GPIO_A2 (1 << 2)
367#define GPIO_A3 (1 << 3)
368
369#define GPIO_B0 (1 << 8)
370#define GPIO_B1 (1 << 9)
371#define GPIO_B2 (1 << 10)
372#define GPIO_B3 (1 << 11)
373#define GPIO_B4 (1 << 12)
374#define GPIO_B5 (1 << 13)
375#define GPIO_B6 (1 << 14)
376#define GPIO_B7 (1 << 15)
377
378#define GPIO_C0 (1 << 16)
379#define GPIO_C1 (1 << 17)
380#define GPIO_C2 (1 << 18)
381#define GPIO_C3 (1 << 19)
382#define GPIO_C4 (1 << 20)
383#define GPIO_C5 (1 << 21)
384#define GPIO_C6 (1 << 22)
385#define GPIO_C7 (1 << 23)
386
387/*
388 * Interrupt Controller
389 *
390 * Registers
391 * INTTEST0 Test register 0
392 * INTTEST1 Test register 1
393 * INTEN0 Interrupt Enable register 0
394 * INTEN1 Interrupt Enable register 1
395 * INTPOL0 Interrupt Polarity selection 0
396 * INTPOL1 Interrupt Polarity selection 1
397 * INTTSTSEL Interrupt source selection
398 * INTSTATCLR0 Interrupt Status/Clear 0
399 * INTSTATCLR1 Interrupt Status/Clear 1
400 * INTSET0 Interrupt source set 0
401 * INTSET1 Interrupt source set 1
402 * WAKE_EN0 Wake-up source enable 0
403 * WAKE_EN1 Wake-up source enable 1
404 * WAKE_POL0 Wake-up polarity selection 0
405 * WAKE_POL1 Wake-up polarity selection 1
406 */
407#define SA1111_INTC 0x1600
408
409/*
410 * These are offsets from the above base.
411 */
412#define SA1111_INTTEST0 0x0000
413#define SA1111_INTTEST1 0x0004
414#define SA1111_INTEN0 0x0008
415#define SA1111_INTEN1 0x000c
416#define SA1111_INTPOL0 0x0010
417#define SA1111_INTPOL1 0x0014
418#define SA1111_INTTSTSEL 0x0018
419#define SA1111_INTSTATCLR0 0x001c
420#define SA1111_INTSTATCLR1 0x0020
421#define SA1111_INTSET0 0x0024
422#define SA1111_INTSET1 0x0028
423#define SA1111_WAKEEN0 0x002c
424#define SA1111_WAKEEN1 0x0030
425#define SA1111_WAKEPOL0 0x0034
426#define SA1111_WAKEPOL1 0x0038
427
428/*
429 * PS/2 Trackpad and Mouse Interfaces
430 *
431 * Registers
432 * PS2CR Control Register
433 * PS2STAT Status Register
434 * PS2DATA Transmit/Receive Data register
435 * PS2CLKDIV Clock Division Register
436 * PS2PRECNT Clock Precount Register
437 * PS2TEST1 Test register 1
438 * PS2TEST2 Test register 2
439 * PS2TEST3 Test register 3
440 * PS2TEST4 Test register 4
441 */
442
443#define SA1111_KBD 0x0a00
444#define SA1111_MSE 0x0c00
445
446/*
447 * These are offsets from the above bases.
448 */
449#define SA1111_PS2CR 0x0000
450#define SA1111_PS2STAT 0x0004
451#define SA1111_PS2DATA 0x0008
452#define SA1111_PS2CLKDIV 0x000c
453#define SA1111_PS2PRECNT 0x0010
454
455#define PS2CR_ENA 0x08
456#define PS2CR_FKD 0x02
457#define PS2CR_FKC 0x01
458
459#define PS2STAT_STP 0x0100
460#define PS2STAT_TXE 0x0080
461#define PS2STAT_TXB 0x0040
462#define PS2STAT_RXF 0x0020
463#define PS2STAT_RXB 0x0010
464#define PS2STAT_ENA 0x0008
465#define PS2STAT_RXP 0x0004
466#define PS2STAT_KBD 0x0002
467#define PS2STAT_KBC 0x0001
468
469/*
470 * PCMCIA Interface
471 *
472 * Registers
473 * PCSR Status Register
474 * PCCR Control Register
475 * PCSSR Sleep State Register
476 */
477
478#define SA1111_PCMCIA 0x1600
479
480/*
481 * These are offsets from the above base.
482 */
483#define SA1111_PCCR 0x0000
484#define SA1111_PCSSR 0x0004
485#define SA1111_PCSR 0x0008
486
487#define PCSR_S0_READY (1<<0)
488#define PCSR_S1_READY (1<<1)
489#define PCSR_S0_DETECT (1<<2)
490#define PCSR_S1_DETECT (1<<3)
491#define PCSR_S0_VS1 (1<<4)
492#define PCSR_S0_VS2 (1<<5)
493#define PCSR_S1_VS1 (1<<6)
494#define PCSR_S1_VS2 (1<<7)
495#define PCSR_S0_WP (1<<8)
496#define PCSR_S1_WP (1<<9)
497#define PCSR_S0_BVD1 (1<<10)
498#define PCSR_S0_BVD2 (1<<11)
499#define PCSR_S1_BVD1 (1<<12)
500#define PCSR_S1_BVD2 (1<<13)
501
502#define PCCR_S0_RST (1<<0)
503#define PCCR_S1_RST (1<<1)
504#define PCCR_S0_FLT (1<<2)
505#define PCCR_S1_FLT (1<<3)
506#define PCCR_S0_PWAITEN (1<<4)
507#define PCCR_S1_PWAITEN (1<<5)
508#define PCCR_S0_PSE (1<<6)
509#define PCCR_S1_PSE (1<<7)
510
511#define PCSSR_S0_SLEEP (1<<0)
512#define PCSSR_S1_SLEEP (1<<1)
513
514
515
516
517extern struct bus_type sa1111_bus_type;
518
519#define SA1111_DEVID_SBI 0
520#define SA1111_DEVID_SK 1
521#define SA1111_DEVID_USB 2
522#define SA1111_DEVID_SAC 3
523#define SA1111_DEVID_SSP 4
524#define SA1111_DEVID_PS2 5
525#define SA1111_DEVID_GPIO 6
526#define SA1111_DEVID_INT 7
527#define SA1111_DEVID_PCMCIA 8
528
529struct sa1111_dev {
530 struct device dev;
531 unsigned int devid;
532 struct resource res;
533 void __iomem *mapbase;
534 unsigned int skpcr_mask;
535 unsigned int irq[6];
536 u64 dma_mask;
537};
538
539#define SA1111_DEV(_d) container_of((_d), struct sa1111_dev, dev)
540
541#define sa1111_get_drvdata(d) dev_get_drvdata(&(d)->dev)
542#define sa1111_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, p)
543
544struct sa1111_driver {
545 struct device_driver drv;
546 unsigned int devid;
547 int (*probe)(struct sa1111_dev *);
548 int (*remove)(struct sa1111_dev *);
549 int (*suspend)(struct sa1111_dev *, pm_message_t);
550 int (*resume)(struct sa1111_dev *);
551};
552
553#define SA1111_DRV(_d) container_of((_d), struct sa1111_driver, drv)
554
555#define SA1111_DRIVER_NAME(_sadev) ((_sadev)->dev.driver->name)
556
557/*
558 * These frob the SKPCR register.
559 */
560void sa1111_enable_device(struct sa1111_dev *);
561void sa1111_disable_device(struct sa1111_dev *);
562
563unsigned int sa1111_pll_clock(struct sa1111_dev *);
564
565#define SA1111_AUDIO_ACLINK 0
566#define SA1111_AUDIO_I2S 1
567
568void sa1111_select_audio_mode(struct sa1111_dev *sadev, int mode);
569int sa1111_set_audio_rate(struct sa1111_dev *sadev, int rate);
570int sa1111_get_audio_rate(struct sa1111_dev *sadev);
571
572int sa1111_check_dma_bug(dma_addr_t addr);
573
574int sa1111_driver_register(struct sa1111_driver *);
575void sa1111_driver_unregister(struct sa1111_driver *);
576
577void sa1111_set_io_dir(struct sa1111_dev *sadev, unsigned int bits, unsigned int dir, unsigned int sleep_dir);
578void sa1111_set_io(struct sa1111_dev *sadev, unsigned int bits, unsigned int v);
579void sa1111_set_sleep_io(struct sa1111_dev *sadev, unsigned int bits, unsigned int v);
580
581#endif /* _ASM_ARCH_SA1111 */
diff --git a/arch/arm/include/asm/hardware/scoop.h b/arch/arm/include/asm/hardware/scoop.h
new file mode 100644
index 000000000000..dfb8330599f9
--- /dev/null
+++ b/arch/arm/include/asm/hardware/scoop.h
@@ -0,0 +1,69 @@
1/*
2 * Definitions for the SCOOP interface found on various Sharp PDAs
3 *
4 * Copyright (c) 2004 Richard Purdie
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#define SCOOP_MCR 0x00
13#define SCOOP_CDR 0x04
14#define SCOOP_CSR 0x08
15#define SCOOP_CPR 0x0C
16#define SCOOP_CCR 0x10
17#define SCOOP_IRR 0x14
18#define SCOOP_IRM 0x14
19#define SCOOP_IMR 0x18
20#define SCOOP_ISR 0x1C
21#define SCOOP_GPCR 0x20
22#define SCOOP_GPWR 0x24
23#define SCOOP_GPRR 0x28
24
25#define SCOOP_GPCR_PA22 ( 1 << 12 )
26#define SCOOP_GPCR_PA21 ( 1 << 11 )
27#define SCOOP_GPCR_PA20 ( 1 << 10 )
28#define SCOOP_GPCR_PA19 ( 1 << 9 )
29#define SCOOP_GPCR_PA18 ( 1 << 8 )
30#define SCOOP_GPCR_PA17 ( 1 << 7 )
31#define SCOOP_GPCR_PA16 ( 1 << 6 )
32#define SCOOP_GPCR_PA15 ( 1 << 5 )
33#define SCOOP_GPCR_PA14 ( 1 << 4 )
34#define SCOOP_GPCR_PA13 ( 1 << 3 )
35#define SCOOP_GPCR_PA12 ( 1 << 2 )
36#define SCOOP_GPCR_PA11 ( 1 << 1 )
37
38struct scoop_config {
39 unsigned short io_out;
40 unsigned short io_dir;
41 unsigned short suspend_clr;
42 unsigned short suspend_set;
43 int gpio_base;
44};
45
46/* Structure for linking scoop devices to PCMCIA sockets */
47struct scoop_pcmcia_dev {
48 struct device *dev; /* Pointer to this socket's scoop device */
49 int irq; /* irq for socket */
50 int cd_irq;
51 const char *cd_irq_str;
52 unsigned char keep_vs;
53 unsigned char keep_rd;
54};
55
56struct scoop_pcmcia_config {
57 struct scoop_pcmcia_dev *devs;
58 int num_devs;
59 void (*pcmcia_init)(void);
60 void (*power_ctrl)(struct device *scoop, unsigned short cpr, int nr);
61};
62
63extern struct scoop_pcmcia_config *platform_scoop_config;
64
65void reset_scoop(struct device *dev);
66unsigned short __deprecated set_scoop_gpio(struct device *dev, unsigned short bit);
67unsigned short __deprecated reset_scoop_gpio(struct device *dev, unsigned short bit);
68unsigned short read_scoop_reg(struct device *dev, unsigned short reg);
69void write_scoop_reg(struct device *dev, unsigned short reg, unsigned short data);
diff --git a/arch/arm/include/asm/hardware/sharpsl_pm.h b/arch/arm/include/asm/hardware/sharpsl_pm.h
new file mode 100644
index 000000000000..2d00db22b981
--- /dev/null
+++ b/arch/arm/include/asm/hardware/sharpsl_pm.h
@@ -0,0 +1,106 @@
1/*
2 * SharpSL Battery/PM Driver
3 *
4 * Copyright (c) 2004-2005 Richard Purdie
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include <linux/interrupt.h>
13
14struct sharpsl_charger_machinfo {
15 void (*init)(void);
16 void (*exit)(void);
17 int gpio_acin;
18 int gpio_batfull;
19 int batfull_irq;
20 int gpio_batlock;
21 int gpio_fatal;
22 void (*discharge)(int);
23 void (*discharge1)(int);
24 void (*charge)(int);
25 void (*measure_temp)(int);
26 void (*presuspend)(void);
27 void (*postsuspend)(void);
28 void (*earlyresume)(void);
29 unsigned long (*read_devdata)(int);
30#define SHARPSL_BATT_VOLT 1
31#define SHARPSL_BATT_TEMP 2
32#define SHARPSL_ACIN_VOLT 3
33#define SHARPSL_STATUS_ACIN 4
34#define SHARPSL_STATUS_LOCK 5
35#define SHARPSL_STATUS_CHRGFULL 6
36#define SHARPSL_STATUS_FATAL 7
37 unsigned long (*charger_wakeup)(void);
38 int (*should_wakeup)(unsigned int resume_on_alarm);
39 void (*backlight_limit)(int);
40 int (*backlight_get_status) (void);
41 int charge_on_volt;
42 int charge_on_temp;
43 int charge_acin_high;
44 int charge_acin_low;
45 int fatal_acin_volt;
46 int fatal_noacin_volt;
47 int bat_levels;
48 struct battery_thresh *bat_levels_noac;
49 struct battery_thresh *bat_levels_acin;
50 struct battery_thresh *bat_levels_noac_bl;
51 struct battery_thresh *bat_levels_acin_bl;
52 int status_high_acin;
53 int status_low_acin;
54 int status_high_noac;
55 int status_low_noac;
56};
57
58struct battery_thresh {
59 int voltage;
60 int percentage;
61};
62
63struct battery_stat {
64 int ac_status; /* APM AC Present/Not Present */
65 int mainbat_status; /* APM Main Battery Status */
66 int mainbat_percent; /* Main Battery Percentage Charge */
67 int mainbat_voltage; /* Main Battery Voltage */
68};
69
70struct sharpsl_pm_status {
71 struct device *dev;
72 struct timer_list ac_timer;
73 struct timer_list chrg_full_timer;
74
75 int charge_mode;
76#define CHRG_ERROR (-1)
77#define CHRG_OFF (0)
78#define CHRG_ON (1)
79#define CHRG_DONE (2)
80
81 unsigned int flags;
82#define SHARPSL_SUSPENDED (1 << 0) /* Device is Suspended */
83#define SHARPSL_ALARM_ACTIVE (1 << 1) /* Alarm is for charging event (not user) */
84#define SHARPSL_BL_LIMIT (1 << 2) /* Backlight Intensity Limited */
85#define SHARPSL_APM_QUEUED (1 << 3) /* APM Event Queued */
86#define SHARPSL_DO_OFFLINE_CHRG (1 << 4) /* Trigger the offline charger */
87
88 int full_count;
89 unsigned long charge_start_time;
90 struct sharpsl_charger_machinfo *machinfo;
91 struct battery_stat battstat;
92};
93
94extern struct sharpsl_pm_status sharpsl_pm;
95
96
97#define SHARPSL_LED_ERROR 2
98#define SHARPSL_LED_ON 1
99#define SHARPSL_LED_OFF 0
100
101void sharpsl_battery_kick(void);
102void sharpsl_pm_led(int val);
103irqreturn_t sharpsl_ac_isr(int irq, void *dev_id);
104irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id);
105irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id);
106
diff --git a/arch/arm/include/asm/hardware/ssp.h b/arch/arm/include/asm/hardware/ssp.h
new file mode 100644
index 000000000000..3b42e181997c
--- /dev/null
+++ b/arch/arm/include/asm/hardware/ssp.h
@@ -0,0 +1,28 @@
1/*
2 * ssp.h
3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
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 SSP_H
11#define SSP_H
12
13struct ssp_state {
14 unsigned int cr0;
15 unsigned int cr1;
16};
17
18int ssp_write_word(u16 data);
19int ssp_read_word(u16 *data);
20int ssp_flush(void);
21void ssp_enable(void);
22void ssp_disable(void);
23void ssp_save_state(struct ssp_state *ssp);
24void ssp_restore_state(struct ssp_state *ssp);
25int ssp_init(void);
26void ssp_exit(void);
27
28#endif
diff --git a/arch/arm/include/asm/hardware/uengine.h b/arch/arm/include/asm/hardware/uengine.h
new file mode 100644
index 000000000000..b442d65c6593
--- /dev/null
+++ b/arch/arm/include/asm/hardware/uengine.h
@@ -0,0 +1,62 @@
1/*
2 * Generic library functions for the microengines found on the Intel
3 * IXP2000 series of network processors.
4 *
5 * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org>
6 * Dedicated to Marija Kulikova.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as
10 * published by the Free Software Foundation; either version 2.1 of the
11 * License, or (at your option) any later version.
12 */
13
14#ifndef __IXP2000_UENGINE_H
15#define __IXP2000_UENGINE_H
16
17extern u32 ixp2000_uengine_mask;
18
19struct ixp2000_uengine_code
20{
21 u32 cpu_model_bitmask;
22 u8 cpu_min_revision;
23 u8 cpu_max_revision;
24
25 u32 uengine_parameters;
26
27 struct ixp2000_reg_value {
28 int reg;
29 u32 value;
30 } *initial_reg_values;
31
32 int num_insns;
33 u8 *insns;
34};
35
36u32 ixp2000_uengine_csr_read(int uengine, int offset);
37void ixp2000_uengine_csr_write(int uengine, int offset, u32 value);
38void ixp2000_uengine_reset(u32 uengine_mask);
39void ixp2000_uengine_set_mode(int uengine, u32 mode);
40void ixp2000_uengine_load_microcode(int uengine, u8 *ucode, int insns);
41void ixp2000_uengine_init_context(int uengine, int context, int pc);
42void ixp2000_uengine_start_contexts(int uengine, u8 ctx_mask);
43void ixp2000_uengine_stop_contexts(int uengine, u8 ctx_mask);
44int ixp2000_uengine_load(int uengine, struct ixp2000_uengine_code *c);
45
46#define IXP2000_UENGINE_8_CONTEXTS 0x00000000
47#define IXP2000_UENGINE_4_CONTEXTS 0x80000000
48#define IXP2000_UENGINE_PRN_UPDATE_EVERY 0x40000000
49#define IXP2000_UENGINE_PRN_UPDATE_ON_ACCESS 0x00000000
50#define IXP2000_UENGINE_NN_FROM_SELF 0x00100000
51#define IXP2000_UENGINE_NN_FROM_PREVIOUS 0x00000000
52#define IXP2000_UENGINE_ASSERT_EMPTY_AT_3 0x000c0000
53#define IXP2000_UENGINE_ASSERT_EMPTY_AT_2 0x00080000
54#define IXP2000_UENGINE_ASSERT_EMPTY_AT_1 0x00040000
55#define IXP2000_UENGINE_ASSERT_EMPTY_AT_0 0x00000000
56#define IXP2000_UENGINE_LM_ADDR1_GLOBAL 0x00020000
57#define IXP2000_UENGINE_LM_ADDR1_PER_CONTEXT 0x00000000
58#define IXP2000_UENGINE_LM_ADDR0_GLOBAL 0x00010000
59#define IXP2000_UENGINE_LM_ADDR0_PER_CONTEXT 0x00000000
60
61
62#endif
diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h
new file mode 100644
index 000000000000..263f2c362a30
--- /dev/null
+++ b/arch/arm/include/asm/hardware/vic.h
@@ -0,0 +1,45 @@
1/*
2 * arch/arm/include/asm/hardware/vic.h
3 *
4 * Copyright (c) ARM Limited 2003. All rights reserved.
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#ifndef __ASM_ARM_HARDWARE_VIC_H
21#define __ASM_ARM_HARDWARE_VIC_H
22
23#define VIC_IRQ_STATUS 0x00
24#define VIC_FIQ_STATUS 0x04
25#define VIC_RAW_STATUS 0x08
26#define VIC_INT_SELECT 0x0c /* 1 = FIQ, 0 = IRQ */
27#define VIC_INT_ENABLE 0x10 /* 1 = enable, 0 = disable */
28#define VIC_INT_ENABLE_CLEAR 0x14
29#define VIC_INT_SOFT 0x18
30#define VIC_INT_SOFT_CLEAR 0x1c
31#define VIC_PROTECT 0x20
32#define VIC_VECT_ADDR 0x30
33#define VIC_DEF_VECT_ADDR 0x34
34
35#define VIC_VECT_ADDR0 0x100 /* 0 to 15 */
36#define VIC_VECT_CNTL0 0x200 /* 0 to 15 */
37#define VIC_ITCR 0x300 /* VIC test control register */
38
39#define VIC_VECT_CNTL_ENABLE (1 << 5)
40
41#ifndef __ASSEMBLY__
42void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources);
43#endif
44
45#endif
diff --git a/arch/arm/include/asm/hw_irq.h b/arch/arm/include/asm/hw_irq.h
new file mode 100644
index 000000000000..90831f6f5f5c
--- /dev/null
+++ b/arch/arm/include/asm/hw_irq.h
@@ -0,0 +1,27 @@
1/*
2 * Nothing to see here yet
3 */
4#ifndef _ARCH_ARM_HW_IRQ_H
5#define _ARCH_ARM_HW_IRQ_H
6
7static inline void ack_bad_irq(int irq)
8{
9 extern unsigned long irq_err_count;
10 irq_err_count++;
11}
12
13/*
14 * Obsolete inline function for calling irq descriptor handlers.
15 */
16static inline void desc_handle_irq(unsigned int irq, struct irq_desc *desc)
17{
18 desc->handle_irq(irq, desc);
19}
20
21void set_irq_flags(unsigned int irq, unsigned int flags);
22
23#define IRQF_VALID (1 << 0)
24#define IRQF_PROBE (1 << 1)
25#define IRQF_NOAUTOEN (1 << 2)
26
27#endif
diff --git a/arch/arm/include/asm/hwcap.h b/arch/arm/include/asm/hwcap.h
new file mode 100644
index 000000000000..81f4c899a555
--- /dev/null
+++ b/arch/arm/include/asm/hwcap.h
@@ -0,0 +1,29 @@
1#ifndef __ASMARM_HWCAP_H
2#define __ASMARM_HWCAP_H
3
4/*
5 * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP
6 */
7#define HWCAP_SWP 1
8#define HWCAP_HALF 2
9#define HWCAP_THUMB 4
10#define HWCAP_26BIT 8 /* Play it safe */
11#define HWCAP_FAST_MULT 16
12#define HWCAP_FPA 32
13#define HWCAP_VFP 64
14#define HWCAP_EDSP 128
15#define HWCAP_JAVA 256
16#define HWCAP_IWMMXT 512
17#define HWCAP_CRUNCH 1024
18#define HWCAP_THUMBEE 2048
19
20#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
21/*
22 * This yields a mask that user programs can use to figure out what
23 * instruction set this cpu supports.
24 */
25#define ELF_HWCAP (elf_hwcap)
26extern unsigned int elf_hwcap;
27#endif
28
29#endif
diff --git a/arch/arm/include/asm/ide.h b/arch/arm/include/asm/ide.h
new file mode 100644
index 000000000000..b507ce8e5019
--- /dev/null
+++ b/arch/arm/include/asm/ide.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/include/asm/ide.h
3 *
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
5 */
6
7/*
8 * This file contains the ARM architecture specific IDE code.
9 */
10
11#ifndef __ASMARM_IDE_H
12#define __ASMARM_IDE_H
13
14#ifdef __KERNEL__
15
16#define __ide_mm_insw(port,addr,len) readsw(port,addr,len)
17#define __ide_mm_insl(port,addr,len) readsl(port,addr,len)
18#define __ide_mm_outsw(port,addr,len) writesw(port,addr,len)
19#define __ide_mm_outsl(port,addr,len) writesl(port,addr,len)
20
21#endif /* __KERNEL__ */
22
23#endif /* __ASMARM_IDE_H */
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
new file mode 100644
index 000000000000..94a95d7fafd6
--- /dev/null
+++ b/arch/arm/include/asm/io.h
@@ -0,0 +1,287 @@
1/*
2 * arch/arm/include/asm/io.h
3 *
4 * Copyright (C) 1996-2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Modifications:
11 * 16-Sep-1996 RMK Inlined the inx/outx functions & optimised for both
12 * constant addresses and variable addresses.
13 * 04-Dec-1997 RMK Moved a lot of this stuff to the new architecture
14 * specific IO header files.
15 * 27-Mar-1999 PJB Second parameter of memcpy_toio is const..
16 * 04-Apr-1999 PJB Added check_signature.
17 * 12-Dec-1999 RMK More cleanups
18 * 18-Jun-2000 RMK Removed virt_to_* and friends definitions
19 * 05-Oct-2004 BJD Moved memory string functions to use void __iomem
20 */
21#ifndef __ASM_ARM_IO_H
22#define __ASM_ARM_IO_H
23
24#ifdef __KERNEL__
25
26#include <linux/types.h>
27#include <asm/byteorder.h>
28#include <asm/memory.h>
29
30/*
31 * ISA I/O bus memory addresses are 1:1 with the physical address.
32 */
33#define isa_virt_to_bus virt_to_phys
34#define isa_page_to_bus page_to_phys
35#define isa_bus_to_virt phys_to_virt
36
37/*
38 * Generic IO read/write. These perform native-endian accesses. Note
39 * that some architectures will want to re-define __raw_{read,write}w.
40 */
41extern void __raw_writesb(void __iomem *addr, const void *data, int bytelen);
42extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen);
43extern void __raw_writesl(void __iomem *addr, const void *data, int longlen);
44
45extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen);
46extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
47extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
48
49#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a) = (v))
50#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v))
51#define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a) = (v))
52
53#define __raw_readb(a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a))
54#define __raw_readw(a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a))
55#define __raw_readl(a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a))
56
57/*
58 * Architecture ioremap implementation.
59 */
60#define MT_DEVICE 0
61#define MT_DEVICE_NONSHARED 1
62#define MT_DEVICE_CACHED 2
63#define MT_DEVICE_IXP2000 3
64/*
65 * types 4 onwards can be found in asm/mach/map.h and are undefined
66 * for ioremap
67 */
68
69/*
70 * __arm_ioremap takes CPU physical address.
71 * __arm_ioremap_pfn takes a Page Frame Number and an offset into that page
72 */
73extern void __iomem * __arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
74extern void __iomem * __arm_ioremap(unsigned long, size_t, unsigned int);
75extern void __iounmap(volatile void __iomem *addr);
76
77/*
78 * Bad read/write accesses...
79 */
80extern void __readwrite_bug(const char *fn);
81
82/*
83 * Now, pick up the machine-defined IO definitions
84 */
85#include <mach/io.h>
86
87/*
88 * IO port access primitives
89 * -------------------------
90 *
91 * The ARM doesn't have special IO access instructions; all IO is memory
92 * mapped. Note that these are defined to perform little endian accesses
93 * only. Their primary purpose is to access PCI and ISA peripherals.
94 *
95 * Note that for a big endian machine, this implies that the following
96 * big endian mode connectivity is in place, as described by numerous
97 * ARM documents:
98 *
99 * PCI: D0-D7 D8-D15 D16-D23 D24-D31
100 * ARM: D24-D31 D16-D23 D8-D15 D0-D7
101 *
102 * The machine specific io.h include defines __io to translate an "IO"
103 * address to a memory address.
104 *
105 * Note that we prevent GCC re-ordering or caching values in expressions
106 * by introducing sequence points into the in*() definitions. Note that
107 * __raw_* do not guarantee this behaviour.
108 *
109 * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space.
110 */
111#ifdef __io
112#define outb(v,p) __raw_writeb(v,__io(p))
113#define outw(v,p) __raw_writew((__force __u16) \
114 cpu_to_le16(v),__io(p))
115#define outl(v,p) __raw_writel((__force __u32) \
116 cpu_to_le32(v),__io(p))
117
118#define inb(p) ({ __u8 __v = __raw_readb(__io(p)); __v; })
119#define inw(p) ({ __u16 __v = le16_to_cpu((__force __le16) \
120 __raw_readw(__io(p))); __v; })
121#define inl(p) ({ __u32 __v = le32_to_cpu((__force __le32) \
122 __raw_readl(__io(p))); __v; })
123
124#define outsb(p,d,l) __raw_writesb(__io(p),d,l)
125#define outsw(p,d,l) __raw_writesw(__io(p),d,l)
126#define outsl(p,d,l) __raw_writesl(__io(p),d,l)
127
128#define insb(p,d,l) __raw_readsb(__io(p),d,l)
129#define insw(p,d,l) __raw_readsw(__io(p),d,l)
130#define insl(p,d,l) __raw_readsl(__io(p),d,l)
131#endif
132
133#define outb_p(val,port) outb((val),(port))
134#define outw_p(val,port) outw((val),(port))
135#define outl_p(val,port) outl((val),(port))
136#define inb_p(port) inb((port))
137#define inw_p(port) inw((port))
138#define inl_p(port) inl((port))
139
140#define outsb_p(port,from,len) outsb(port,from,len)
141#define outsw_p(port,from,len) outsw(port,from,len)
142#define outsl_p(port,from,len) outsl(port,from,len)
143#define insb_p(port,to,len) insb(port,to,len)
144#define insw_p(port,to,len) insw(port,to,len)
145#define insl_p(port,to,len) insl(port,to,len)
146
147/*
148 * String version of IO memory access ops:
149 */
150extern void _memcpy_fromio(void *, const volatile void __iomem *, size_t);
151extern void _memcpy_toio(volatile void __iomem *, const void *, size_t);
152extern void _memset_io(volatile void __iomem *, int, size_t);
153
154#define mmiowb()
155
156/*
157 * Memory access primitives
158 * ------------------------
159 *
160 * These perform PCI memory accesses via an ioremap region. They don't
161 * take an address as such, but a cookie.
162 *
163 * Again, this are defined to perform little endian accesses. See the
164 * IO port primitives for more information.
165 */
166#ifdef __mem_pci
167#define readb(c) ({ __u8 __v = __raw_readb(__mem_pci(c)); __v; })
168#define readw(c) ({ __u16 __v = le16_to_cpu((__force __le16) \
169 __raw_readw(__mem_pci(c))); __v; })
170#define readl(c) ({ __u32 __v = le32_to_cpu((__force __le32) \
171 __raw_readl(__mem_pci(c))); __v; })
172#define readb_relaxed(addr) readb(addr)
173#define readw_relaxed(addr) readw(addr)
174#define readl_relaxed(addr) readl(addr)
175
176#define readsb(p,d,l) __raw_readsb(__mem_pci(p),d,l)
177#define readsw(p,d,l) __raw_readsw(__mem_pci(p),d,l)
178#define readsl(p,d,l) __raw_readsl(__mem_pci(p),d,l)
179
180#define writeb(v,c) __raw_writeb(v,__mem_pci(c))
181#define writew(v,c) __raw_writew((__force __u16) \
182 cpu_to_le16(v),__mem_pci(c))
183#define writel(v,c) __raw_writel((__force __u32) \
184 cpu_to_le32(v),__mem_pci(c))
185
186#define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l)
187#define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l)
188#define writesl(p,d,l) __raw_writesl(__mem_pci(p),d,l)
189
190#define memset_io(c,v,l) _memset_io(__mem_pci(c),(v),(l))
191#define memcpy_fromio(a,c,l) _memcpy_fromio((a),__mem_pci(c),(l))
192#define memcpy_toio(c,a,l) _memcpy_toio(__mem_pci(c),(a),(l))
193
194#elif !defined(readb)
195
196#define readb(c) (__readwrite_bug("readb"),0)
197#define readw(c) (__readwrite_bug("readw"),0)
198#define readl(c) (__readwrite_bug("readl"),0)
199#define writeb(v,c) __readwrite_bug("writeb")
200#define writew(v,c) __readwrite_bug("writew")
201#define writel(v,c) __readwrite_bug("writel")
202
203#define check_signature(io,sig,len) (0)
204
205#endif /* __mem_pci */
206
207/*
208 * ioremap and friends.
209 *
210 * ioremap takes a PCI memory address, as specified in
211 * Documentation/IO-mapping.txt.
212 *
213 */
214#ifndef __arch_ioremap
215#define ioremap(cookie,size) __arm_ioremap(cookie, size, MT_DEVICE)
216#define ioremap_nocache(cookie,size) __arm_ioremap(cookie, size, MT_DEVICE)
217#define ioremap_cached(cookie,size) __arm_ioremap(cookie, size, MT_DEVICE_CACHED)
218#define iounmap(cookie) __iounmap(cookie)
219#else
220#define ioremap(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE)
221#define ioremap_nocache(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE)
222#define ioremap_cached(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE_CACHED)
223#define iounmap(cookie) __arch_iounmap(cookie)
224#endif
225
226/*
227 * io{read,write}{8,16,32} macros
228 */
229#ifndef ioread8
230#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; })
231#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __v; })
232#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __v; })
233
234#define iowrite8(v,p) __raw_writeb(v, p)
235#define iowrite16(v,p) __raw_writew((__force __u16)cpu_to_le16(v), p)
236#define iowrite32(v,p) __raw_writel((__force __u32)cpu_to_le32(v), p)
237
238#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
239#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)
240#define ioread32_rep(p,d,c) __raw_readsl(p,d,c)
241
242#define iowrite8_rep(p,s,c) __raw_writesb(p,s,c)
243#define iowrite16_rep(p,s,c) __raw_writesw(p,s,c)
244#define iowrite32_rep(p,s,c) __raw_writesl(p,s,c)
245
246extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
247extern void ioport_unmap(void __iomem *addr);
248#endif
249
250struct pci_dev;
251
252extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen);
253extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
254
255/*
256 * can the hardware map this into one segment or not, given no other
257 * constraints.
258 */
259#define BIOVEC_MERGEABLE(vec1, vec2) \
260 ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2)))
261
262#ifdef CONFIG_MMU
263#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
264extern int valid_phys_addr_range(unsigned long addr, size_t size);
265extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
266#endif
267
268/*
269 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
270 * access
271 */
272#define xlate_dev_mem_ptr(p) __va(p)
273
274/*
275 * Convert a virtual cached pointer to an uncached pointer
276 */
277#define xlate_dev_kmem_ptr(p) p
278
279/*
280 * Register ISA memory and port locations for glibc iopl/inb/outb
281 * emulation.
282 */
283extern void register_isa_ports(unsigned int mmio, unsigned int io,
284 unsigned int io_shift);
285
286#endif /* __KERNEL__ */
287#endif /* __ASM_ARM_IO_H */
diff --git a/arch/arm/include/asm/ioctl.h b/arch/arm/include/asm/ioctl.h
new file mode 100644
index 000000000000..b279fe06dfe5
--- /dev/null
+++ b/arch/arm/include/asm/ioctl.h
@@ -0,0 +1 @@
#include <asm-generic/ioctl.h>
diff --git a/arch/arm/include/asm/ioctls.h b/arch/arm/include/asm/ioctls.h
new file mode 100644
index 000000000000..a91d8a1523cf
--- /dev/null
+++ b/arch/arm/include/asm/ioctls.h
@@ -0,0 +1,84 @@
1#ifndef __ASM_ARM_IOCTLS_H
2#define __ASM_ARM_IOCTLS_H
3
4#include <asm/ioctl.h>
5
6/* 0x54 is just a magic number to make these relatively unique ('T') */
7
8#define TCGETS 0x5401
9#define TCSETS 0x5402
10#define TCSETSW 0x5403
11#define TCSETSF 0x5404
12#define TCGETA 0x5405
13#define TCSETA 0x5406
14#define TCSETAW 0x5407
15#define TCSETAF 0x5408
16#define TCSBRK 0x5409
17#define TCXONC 0x540A
18#define TCFLSH 0x540B
19#define TIOCEXCL 0x540C
20#define TIOCNXCL 0x540D
21#define TIOCSCTTY 0x540E
22#define TIOCGPGRP 0x540F
23#define TIOCSPGRP 0x5410
24#define TIOCOUTQ 0x5411
25#define TIOCSTI 0x5412
26#define TIOCGWINSZ 0x5413
27#define TIOCSWINSZ 0x5414
28#define TIOCMGET 0x5415
29#define TIOCMBIS 0x5416
30#define TIOCMBIC 0x5417
31#define TIOCMSET 0x5418
32#define TIOCGSOFTCAR 0x5419
33#define TIOCSSOFTCAR 0x541A
34#define FIONREAD 0x541B
35#define TIOCINQ FIONREAD
36#define TIOCLINUX 0x541C
37#define TIOCCONS 0x541D
38#define TIOCGSERIAL 0x541E
39#define TIOCSSERIAL 0x541F
40#define TIOCPKT 0x5420
41#define FIONBIO 0x5421
42#define TIOCNOTTY 0x5422
43#define TIOCSETD 0x5423
44#define TIOCGETD 0x5424
45#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
46#define TIOCSBRK 0x5427 /* BSD compatibility */
47#define TIOCCBRK 0x5428 /* BSD compatibility */
48#define TIOCGSID 0x5429 /* Return the session ID of FD */
49#define TCGETS2 _IOR('T',0x2A, struct termios2)
50#define TCSETS2 _IOW('T',0x2B, struct termios2)
51#define TCSETSW2 _IOW('T',0x2C, struct termios2)
52#define TCSETSF2 _IOW('T',0x2D, struct termios2)
53#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
54#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
55
56#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
57#define FIOCLEX 0x5451
58#define FIOASYNC 0x5452
59#define TIOCSERCONFIG 0x5453
60#define TIOCSERGWILD 0x5454
61#define TIOCSERSWILD 0x5455
62#define TIOCGLCKTRMIOS 0x5456
63#define TIOCSLCKTRMIOS 0x5457
64#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
65#define TIOCSERGETLSR 0x5459 /* Get line status register */
66#define TIOCSERGETMULTI 0x545A /* Get multiport config */
67#define TIOCSERSETMULTI 0x545B /* Set multiport config */
68
69#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
70#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
71#define FIOQSIZE 0x545E
72
73/* Used for packet mode */
74#define TIOCPKT_DATA 0
75#define TIOCPKT_FLUSHREAD 1
76#define TIOCPKT_FLUSHWRITE 2
77#define TIOCPKT_STOP 4
78#define TIOCPKT_START 8
79#define TIOCPKT_NOSTOP 16
80#define TIOCPKT_DOSTOP 32
81
82#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
83
84#endif
diff --git a/arch/arm/include/asm/ipcbuf.h b/arch/arm/include/asm/ipcbuf.h
new file mode 100644
index 000000000000..97683975f7df
--- /dev/null
+++ b/arch/arm/include/asm/ipcbuf.h
@@ -0,0 +1,29 @@
1#ifndef __ASMARM_IPCBUF_H
2#define __ASMARM_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __ASMARM_IPCBUF_H */
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
new file mode 100644
index 000000000000..d6786090d02c
--- /dev/null
+++ b/arch/arm/include/asm/irq.h
@@ -0,0 +1,28 @@
1#ifndef __ASM_ARM_IRQ_H
2#define __ASM_ARM_IRQ_H
3
4#include <mach/irqs.h>
5
6#ifndef irq_canonicalize
7#define irq_canonicalize(i) (i)
8#endif
9
10#ifndef NR_IRQS
11#define NR_IRQS 128
12#endif
13
14/*
15 * Use this value to indicate lack of interrupt
16 * capability
17 */
18#ifndef NO_IRQ
19#define NO_IRQ ((unsigned int)(-1))
20#endif
21
22#ifndef __ASSEMBLY__
23struct irqaction;
24extern void migrate_irqs(void);
25#endif
26
27#endif
28
diff --git a/arch/arm/include/asm/irq_regs.h b/arch/arm/include/asm/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/arch/arm/include/asm/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/arch/arm/include/asm/irqflags.h b/arch/arm/include/asm/irqflags.h
new file mode 100644
index 000000000000..6d09974e6646
--- /dev/null
+++ b/arch/arm/include/asm/irqflags.h
@@ -0,0 +1,132 @@
1#ifndef __ASM_ARM_IRQFLAGS_H
2#define __ASM_ARM_IRQFLAGS_H
3
4#ifdef __KERNEL__
5
6#include <asm/ptrace.h>
7
8/*
9 * CPU interrupt mask handling.
10 */
11#if __LINUX_ARM_ARCH__ >= 6
12
13#define raw_local_irq_save(x) \
14 ({ \
15 __asm__ __volatile__( \
16 "mrs %0, cpsr @ local_irq_save\n" \
17 "cpsid i" \
18 : "=r" (x) : : "memory", "cc"); \
19 })
20
21#define raw_local_irq_enable() __asm__("cpsie i @ __sti" : : : "memory", "cc")
22#define raw_local_irq_disable() __asm__("cpsid i @ __cli" : : : "memory", "cc")
23#define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc")
24#define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc")
25
26#else
27
28/*
29 * Save the current interrupt enable state & disable IRQs
30 */
31#define raw_local_irq_save(x) \
32 ({ \
33 unsigned long temp; \
34 (void) (&temp == &x); \
35 __asm__ __volatile__( \
36 "mrs %0, cpsr @ local_irq_save\n" \
37" orr %1, %0, #128\n" \
38" msr cpsr_c, %1" \
39 : "=r" (x), "=r" (temp) \
40 : \
41 : "memory", "cc"); \
42 })
43
44/*
45 * Enable IRQs
46 */
47#define raw_local_irq_enable() \
48 ({ \
49 unsigned long temp; \
50 __asm__ __volatile__( \
51 "mrs %0, cpsr @ local_irq_enable\n" \
52" bic %0, %0, #128\n" \
53" msr cpsr_c, %0" \
54 : "=r" (temp) \
55 : \
56 : "memory", "cc"); \
57 })
58
59/*
60 * Disable IRQs
61 */
62#define raw_local_irq_disable() \
63 ({ \
64 unsigned long temp; \
65 __asm__ __volatile__( \
66 "mrs %0, cpsr @ local_irq_disable\n" \
67" orr %0, %0, #128\n" \
68" msr cpsr_c, %0" \
69 : "=r" (temp) \
70 : \
71 : "memory", "cc"); \
72 })
73
74/*
75 * Enable FIQs
76 */
77#define local_fiq_enable() \
78 ({ \
79 unsigned long temp; \
80 __asm__ __volatile__( \
81 "mrs %0, cpsr @ stf\n" \
82" bic %0, %0, #64\n" \
83" msr cpsr_c, %0" \
84 : "=r" (temp) \
85 : \
86 : "memory", "cc"); \
87 })
88
89/*
90 * Disable FIQs
91 */
92#define local_fiq_disable() \
93 ({ \
94 unsigned long temp; \
95 __asm__ __volatile__( \
96 "mrs %0, cpsr @ clf\n" \
97" orr %0, %0, #64\n" \
98" msr cpsr_c, %0" \
99 : "=r" (temp) \
100 : \
101 : "memory", "cc"); \
102 })
103
104#endif
105
106/*
107 * Save the current interrupt enable state.
108 */
109#define raw_local_save_flags(x) \
110 ({ \
111 __asm__ __volatile__( \
112 "mrs %0, cpsr @ local_save_flags" \
113 : "=r" (x) : : "memory", "cc"); \
114 })
115
116/*
117 * restore saved IRQ & FIQ state
118 */
119#define raw_local_irq_restore(x) \
120 __asm__ __volatile__( \
121 "msr cpsr_c, %0 @ local_irq_restore\n" \
122 : \
123 : "r" (x) \
124 : "memory", "cc")
125
126#define raw_irqs_disabled_flags(flags) \
127({ \
128 (int)((flags) & PSR_I_BIT); \
129})
130
131#endif
132#endif
diff --git a/arch/arm/include/asm/kdebug.h b/arch/arm/include/asm/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/arch/arm/include/asm/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/arch/arm/include/asm/kexec.h b/arch/arm/include/asm/kexec.h
new file mode 100644
index 000000000000..c8986bb99ed5
--- /dev/null
+++ b/arch/arm/include/asm/kexec.h
@@ -0,0 +1,31 @@
1#ifndef _ARM_KEXEC_H
2#define _ARM_KEXEC_H
3
4#ifdef CONFIG_KEXEC
5
6/* Maximum physical address we can use pages from */
7#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
8/* Maximum address we can reach in physical address mode */
9#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
10/* Maximum address we can use for the control code buffer */
11#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
12
13#define KEXEC_CONTROL_CODE_SIZE 4096
14
15#define KEXEC_ARCH KEXEC_ARCH_ARM
16
17#define KEXEC_ARM_ATAGS_OFFSET 0x1000
18#define KEXEC_ARM_ZIMAGE_OFFSET 0x8000
19
20#ifndef __ASSEMBLY__
21
22struct kimage;
23/* Provide a dummy definition to avoid build failures. */
24static inline void crash_setup_regs(struct pt_regs *newregs,
25 struct pt_regs *oldregs) { }
26
27#endif /* __ASSEMBLY__ */
28
29#endif /* CONFIG_KEXEC */
30
31#endif /* _ARM_KEXEC_H */
diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h
new file mode 100644
index 000000000000..67af4b841984
--- /dev/null
+++ b/arch/arm/include/asm/kgdb.h
@@ -0,0 +1,104 @@
1/*
2 * ARM KGDB support
3 *
4 * Author: Deepak Saxena <dsaxena@mvista.com>
5 *
6 * Copyright (C) 2002 MontaVista Software Inc.
7 *
8 */
9
10#ifndef __ARM_KGDB_H__
11#define __ARM_KGDB_H__
12
13#include <linux/ptrace.h>
14
15/*
16 * GDB assumes that we're a user process being debugged, so
17 * it will send us an SWI command to write into memory as the
18 * debug trap. When an SWI occurs, the next instruction addr is
19 * placed into R14_svc before jumping to the vector trap.
20 * This doesn't work for kernel debugging as we are already in SVC
21 * we would loose the kernel's LR, which is a bad thing. This
22 * is bad thing.
23 *
24 * By doing this as an undefined instruction trap, we force a mode
25 * switch from SVC to UND mode, allowing us to save full kernel state.
26 *
27 * We also define a KGDB_COMPILED_BREAK which can be used to compile
28 * in breakpoints. This is important for things like sysrq-G and for
29 * the initial breakpoint from trap_init().
30 *
31 * Note to ARM HW designers: Add real trap support like SH && PPC to
32 * make our lives much much simpler. :)
33 */
34#define BREAK_INSTR_SIZE 4
35#define GDB_BREAKINST 0xef9f0001
36#define KGDB_BREAKINST 0xe7ffdefe
37#define KGDB_COMPILED_BREAK 0xe7ffdeff
38#define CACHE_FLUSH_IS_SAFE 1
39
40#ifndef __ASSEMBLY__
41
42static inline void arch_kgdb_breakpoint(void)
43{
44 asm(".word 0xe7ffdeff");
45}
46
47extern void kgdb_handle_bus_error(void);
48extern int kgdb_fault_expected;
49
50#endif /* !__ASSEMBLY__ */
51
52/*
53 * From Kevin Hilman:
54 *
55 * gdb is expecting the following registers layout.
56 *
57 * r0-r15: 1 long word each
58 * f0-f7: unused, 3 long words each !!
59 * fps: unused, 1 long word
60 * cpsr: 1 long word
61 *
62 * Even though f0-f7 and fps are not used, they need to be
63 * present in the registers sent for correct processing in
64 * the host-side gdb.
65 *
66 * In particular, it is crucial that CPSR is in the right place,
67 * otherwise gdb will not be able to correctly interpret stepping over
68 * conditional branches.
69 */
70#define _GP_REGS 16
71#define _FP_REGS 8
72#define _EXTRA_REGS 2
73#define GDB_MAX_REGS (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS)
74
75#define KGDB_MAX_NO_CPUS 1
76#define BUFMAX 400
77#define NUMREGBYTES (GDB_MAX_REGS << 2)
78#define NUMCRITREGBYTES (32 << 2)
79
80#define _R0 0
81#define _R1 1
82#define _R2 2
83#define _R3 3
84#define _R4 4
85#define _R5 5
86#define _R6 6
87#define _R7 7
88#define _R8 8
89#define _R9 9
90#define _R10 10
91#define _FP 11
92#define _IP 12
93#define _SPT 13
94#define _LR 14
95#define _PC 15
96#define _CPSR (GDB_MAX_REGS - 1)
97
98/*
99 * So that we can denote the end of a frame for tracing,
100 * in the simple case:
101 */
102#define CFI_END_FRAME(func) __CFI_END_FRAME(_PC, _SPT, func)
103
104#endif /* __ASM_KGDB_H__ */
diff --git a/arch/arm/include/asm/kmap_types.h b/arch/arm/include/asm/kmap_types.h
new file mode 100644
index 000000000000..45def13ee17a
--- /dev/null
+++ b/arch/arm/include/asm/kmap_types.h
@@ -0,0 +1,24 @@
1#ifndef __ARM_KMAP_TYPES_H
2#define __ARM_KMAP_TYPES_H
3
4/*
5 * This is the "bare minimum". AIO seems to require this.
6 */
7enum km_type {
8 KM_BOUNCE_READ,
9 KM_SKB_SUNRPC_DATA,
10 KM_SKB_DATA_SOFTIRQ,
11 KM_USER0,
12 KM_USER1,
13 KM_BIO_SRC_IRQ,
14 KM_BIO_DST_IRQ,
15 KM_PTE0,
16 KM_PTE1,
17 KM_IRQ0,
18 KM_IRQ1,
19 KM_SOFTIRQ0,
20 KM_SOFTIRQ1,
21 KM_TYPE_NR
22};
23
24#endif
diff --git a/arch/arm/include/asm/kprobes.h b/arch/arm/include/asm/kprobes.h
new file mode 100644
index 000000000000..a5d0d99ad387
--- /dev/null
+++ b/arch/arm/include/asm/kprobes.h
@@ -0,0 +1,79 @@
1/*
2 * arch/arm/include/asm/kprobes.h
3 *
4 * Copyright (C) 2006, 2007 Motorola Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * 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 GNU
13 * General Public License for more details.
14 */
15
16#ifndef _ARM_KPROBES_H
17#define _ARM_KPROBES_H
18
19#include <linux/types.h>
20#include <linux/ptrace.h>
21#include <linux/percpu.h>
22
23#define __ARCH_WANT_KPROBES_INSN_SLOT
24#define MAX_INSN_SIZE 2
25#define MAX_STACK_SIZE 64 /* 32 would probably be OK */
26
27/*
28 * This undefined instruction must be unique and
29 * reserved solely for kprobes' use.
30 */
31#define KPROBE_BREAKPOINT_INSTRUCTION 0xe7f001f8
32
33#define regs_return_value(regs) ((regs)->ARM_r0)
34#define flush_insn_slot(p) do { } while (0)
35#define kretprobe_blacklist_size 0
36
37typedef u32 kprobe_opcode_t;
38
39struct kprobe;
40typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *);
41
42/* Architecture specific copy of original instruction. */
43struct arch_specific_insn {
44 kprobe_opcode_t *insn;
45 kprobe_insn_handler_t *insn_handler;
46};
47
48struct prev_kprobe {
49 struct kprobe *kp;
50 unsigned int status;
51};
52
53/* per-cpu kprobe control block */
54struct kprobe_ctlblk {
55 unsigned int kprobe_status;
56 struct prev_kprobe prev_kprobe;
57 struct pt_regs jprobe_saved_regs;
58 char jprobes_stack[MAX_STACK_SIZE];
59};
60
61void arch_remove_kprobe(struct kprobe *);
62void kretprobe_trampoline(void);
63
64int kprobe_trap_handler(struct pt_regs *regs, unsigned int instr);
65int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
66int kprobe_exceptions_notify(struct notifier_block *self,
67 unsigned long val, void *data);
68
69enum kprobe_insn {
70 INSN_REJECTED,
71 INSN_GOOD,
72 INSN_GOOD_NO_SLOT
73};
74
75enum kprobe_insn arm_kprobe_decode_insn(kprobe_opcode_t,
76 struct arch_specific_insn *);
77void __init arm_kprobe_decode_init(void);
78
79#endif /* _ARM_KPROBES_H */
diff --git a/arch/arm/include/asm/leds.h b/arch/arm/include/asm/leds.h
new file mode 100644
index 000000000000..c545739f39b7
--- /dev/null
+++ b/arch/arm/include/asm/leds.h
@@ -0,0 +1,50 @@
1/*
2 * arch/arm/include/asm/leds.h
3 *
4 * Copyright (C) 1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Event-driven interface for LEDs on machines
11 * Added led_start and led_stop- Alex Holden, 28th Dec 1998.
12 */
13#ifndef ASM_ARM_LEDS_H
14#define ASM_ARM_LEDS_H
15
16
17typedef enum {
18 led_idle_start,
19 led_idle_end,
20 led_timer,
21 led_start,
22 led_stop,
23 led_claim, /* override idle & timer leds */
24 led_release, /* restore idle & timer leds */
25 led_start_timer_mode,
26 led_stop_timer_mode,
27 led_green_on,
28 led_green_off,
29 led_amber_on,
30 led_amber_off,
31 led_red_on,
32 led_red_off,
33 led_blue_on,
34 led_blue_off,
35 /*
36 * I want this between led_timer and led_start, but
37 * someone has decided to export this to user space
38 */
39 led_halted
40} led_event_t;
41
42/* Use this routine to handle LEDs */
43
44#ifdef CONFIG_LEDS
45extern void (*leds_event)(led_event_t);
46#else
47#define leds_event(e)
48#endif
49
50#endif
diff --git a/arch/arm/include/asm/limits.h b/arch/arm/include/asm/limits.h
new file mode 100644
index 000000000000..08d8c6600804
--- /dev/null
+++ b/arch/arm/include/asm/limits.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_PIPE_H
2#define __ASM_PIPE_H
3
4#ifndef PAGE_SIZE
5#include <asm/page.h>
6#endif
7
8#define PIPE_BUF PAGE_SIZE
9
10#endif
11
diff --git a/arch/arm/include/asm/linkage.h b/arch/arm/include/asm/linkage.h
new file mode 100644
index 000000000000..5a25632b1bc0
--- /dev/null
+++ b/arch/arm/include/asm/linkage.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4#define __ALIGN .align 0
5#define __ALIGN_STR ".align 0"
6
7#define ENDPROC(name) \
8 .type name, %function; \
9 END(name)
10
11#endif
diff --git a/arch/arm/include/asm/local.h b/arch/arm/include/asm/local.h
new file mode 100644
index 000000000000..c11c530f74d0
--- /dev/null
+++ b/arch/arm/include/asm/local.h
@@ -0,0 +1 @@
#include <asm-generic/local.h>
diff --git a/arch/arm/include/asm/locks.h b/arch/arm/include/asm/locks.h
new file mode 100644
index 000000000000..ef4c897772d1
--- /dev/null
+++ b/arch/arm/include/asm/locks.h
@@ -0,0 +1,274 @@
1/*
2 * arch/arm/include/asm/locks.h
3 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Interrupt safe locking assembler.
11 */
12#ifndef __ASM_PROC_LOCKS_H
13#define __ASM_PROC_LOCKS_H
14
15#if __LINUX_ARM_ARCH__ >= 6
16
17#define __down_op(ptr,fail) \
18 ({ \
19 __asm__ __volatile__( \
20 "@ down_op\n" \
21"1: ldrex lr, [%0]\n" \
22" sub lr, lr, %1\n" \
23" strex ip, lr, [%0]\n" \
24" teq ip, #0\n" \
25" bne 1b\n" \
26" teq lr, #0\n" \
27" movmi ip, %0\n" \
28" blmi " #fail \
29 : \
30 : "r" (ptr), "I" (1) \
31 : "ip", "lr", "cc"); \
32 smp_mb(); \
33 })
34
35#define __down_op_ret(ptr,fail) \
36 ({ \
37 unsigned int ret; \
38 __asm__ __volatile__( \
39 "@ down_op_ret\n" \
40"1: ldrex lr, [%1]\n" \
41" sub lr, lr, %2\n" \
42" strex ip, lr, [%1]\n" \
43" teq ip, #0\n" \
44" bne 1b\n" \
45" teq lr, #0\n" \
46" movmi ip, %1\n" \
47" movpl ip, #0\n" \
48" blmi " #fail "\n" \
49" mov %0, ip" \
50 : "=&r" (ret) \
51 : "r" (ptr), "I" (1) \
52 : "ip", "lr", "cc"); \
53 smp_mb(); \
54 ret; \
55 })
56
57#define __up_op(ptr,wake) \
58 ({ \
59 smp_mb(); \
60 __asm__ __volatile__( \
61 "@ up_op\n" \
62"1: ldrex lr, [%0]\n" \
63" add lr, lr, %1\n" \
64" strex ip, lr, [%0]\n" \
65" teq ip, #0\n" \
66" bne 1b\n" \
67" cmp lr, #0\n" \
68" movle ip, %0\n" \
69" blle " #wake \
70 : \
71 : "r" (ptr), "I" (1) \
72 : "ip", "lr", "cc"); \
73 })
74
75/*
76 * The value 0x01000000 supports up to 128 processors and
77 * lots of processes. BIAS must be chosen such that sub'ing
78 * BIAS once per CPU will result in the long remaining
79 * negative.
80 */
81#define RW_LOCK_BIAS 0x01000000
82#define RW_LOCK_BIAS_STR "0x01000000"
83
84#define __down_op_write(ptr,fail) \
85 ({ \
86 __asm__ __volatile__( \
87 "@ down_op_write\n" \
88"1: ldrex lr, [%0]\n" \
89" sub lr, lr, %1\n" \
90" strex ip, lr, [%0]\n" \
91" teq ip, #0\n" \
92" bne 1b\n" \
93" teq lr, #0\n" \
94" movne ip, %0\n" \
95" blne " #fail \
96 : \
97 : "r" (ptr), "I" (RW_LOCK_BIAS) \
98 : "ip", "lr", "cc"); \
99 smp_mb(); \
100 })
101
102#define __up_op_write(ptr,wake) \
103 ({ \
104 smp_mb(); \
105 __asm__ __volatile__( \
106 "@ up_op_write\n" \
107"1: ldrex lr, [%0]\n" \
108" adds lr, lr, %1\n" \
109" strex ip, lr, [%0]\n" \
110" teq ip, #0\n" \
111" bne 1b\n" \
112" movcs ip, %0\n" \
113" blcs " #wake \
114 : \
115 : "r" (ptr), "I" (RW_LOCK_BIAS) \
116 : "ip", "lr", "cc"); \
117 })
118
119#define __down_op_read(ptr,fail) \
120 __down_op(ptr, fail)
121
122#define __up_op_read(ptr,wake) \
123 ({ \
124 smp_mb(); \
125 __asm__ __volatile__( \
126 "@ up_op_read\n" \
127"1: ldrex lr, [%0]\n" \
128" add lr, lr, %1\n" \
129" strex ip, lr, [%0]\n" \
130" teq ip, #0\n" \
131" bne 1b\n" \
132" teq lr, #0\n" \
133" moveq ip, %0\n" \
134" bleq " #wake \
135 : \
136 : "r" (ptr), "I" (1) \
137 : "ip", "lr", "cc"); \
138 })
139
140#else
141
142#define __down_op(ptr,fail) \
143 ({ \
144 __asm__ __volatile__( \
145 "@ down_op\n" \
146" mrs ip, cpsr\n" \
147" orr lr, ip, #128\n" \
148" msr cpsr_c, lr\n" \
149" ldr lr, [%0]\n" \
150" subs lr, lr, %1\n" \
151" str lr, [%0]\n" \
152" msr cpsr_c, ip\n" \
153" movmi ip, %0\n" \
154" blmi " #fail \
155 : \
156 : "r" (ptr), "I" (1) \
157 : "ip", "lr", "cc"); \
158 smp_mb(); \
159 })
160
161#define __down_op_ret(ptr,fail) \
162 ({ \
163 unsigned int ret; \
164 __asm__ __volatile__( \
165 "@ down_op_ret\n" \
166" mrs ip, cpsr\n" \
167" orr lr, ip, #128\n" \
168" msr cpsr_c, lr\n" \
169" ldr lr, [%1]\n" \
170" subs lr, lr, %2\n" \
171" str lr, [%1]\n" \
172" msr cpsr_c, ip\n" \
173" movmi ip, %1\n" \
174" movpl ip, #0\n" \
175" blmi " #fail "\n" \
176" mov %0, ip" \
177 : "=&r" (ret) \
178 : "r" (ptr), "I" (1) \
179 : "ip", "lr", "cc"); \
180 smp_mb(); \
181 ret; \
182 })
183
184#define __up_op(ptr,wake) \
185 ({ \
186 smp_mb(); \
187 __asm__ __volatile__( \
188 "@ up_op\n" \
189" mrs ip, cpsr\n" \
190" orr lr, ip, #128\n" \
191" msr cpsr_c, lr\n" \
192" ldr lr, [%0]\n" \
193" adds lr, lr, %1\n" \
194" str lr, [%0]\n" \
195" msr cpsr_c, ip\n" \
196" movle ip, %0\n" \
197" blle " #wake \
198 : \
199 : "r" (ptr), "I" (1) \
200 : "ip", "lr", "cc"); \
201 })
202
203/*
204 * The value 0x01000000 supports up to 128 processors and
205 * lots of processes. BIAS must be chosen such that sub'ing
206 * BIAS once per CPU will result in the long remaining
207 * negative.
208 */
209#define RW_LOCK_BIAS 0x01000000
210#define RW_LOCK_BIAS_STR "0x01000000"
211
212#define __down_op_write(ptr,fail) \
213 ({ \
214 __asm__ __volatile__( \
215 "@ down_op_write\n" \
216" mrs ip, cpsr\n" \
217" orr lr, ip, #128\n" \
218" msr cpsr_c, lr\n" \
219" ldr lr, [%0]\n" \
220" subs lr, lr, %1\n" \
221" str lr, [%0]\n" \
222" msr cpsr_c, ip\n" \
223" movne ip, %0\n" \
224" blne " #fail \
225 : \
226 : "r" (ptr), "I" (RW_LOCK_BIAS) \
227 : "ip", "lr", "cc"); \
228 smp_mb(); \
229 })
230
231#define __up_op_write(ptr,wake) \
232 ({ \
233 __asm__ __volatile__( \
234 "@ up_op_write\n" \
235" mrs ip, cpsr\n" \
236" orr lr, ip, #128\n" \
237" msr cpsr_c, lr\n" \
238" ldr lr, [%0]\n" \
239" adds lr, lr, %1\n" \
240" str lr, [%0]\n" \
241" msr cpsr_c, ip\n" \
242" movcs ip, %0\n" \
243" blcs " #wake \
244 : \
245 : "r" (ptr), "I" (RW_LOCK_BIAS) \
246 : "ip", "lr", "cc"); \
247 smp_mb(); \
248 })
249
250#define __down_op_read(ptr,fail) \
251 __down_op(ptr, fail)
252
253#define __up_op_read(ptr,wake) \
254 ({ \
255 smp_mb(); \
256 __asm__ __volatile__( \
257 "@ up_op_read\n" \
258" mrs ip, cpsr\n" \
259" orr lr, ip, #128\n" \
260" msr cpsr_c, lr\n" \
261" ldr lr, [%0]\n" \
262" adds lr, lr, %1\n" \
263" str lr, [%0]\n" \
264" msr cpsr_c, ip\n" \
265" moveq ip, %0\n" \
266" bleq " #wake \
267 : \
268 : "r" (ptr), "I" (1) \
269 : "ip", "lr", "cc"); \
270 })
271
272#endif
273
274#endif
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
new file mode 100644
index 000000000000..c59842dc7cb8
--- /dev/null
+++ b/arch/arm/include/asm/mach/arch.h
@@ -0,0 +1,60 @@
1/*
2 * arch/arm/include/asm/mach/arch.h
3 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASSEMBLY__
12
13struct tag;
14struct meminfo;
15struct sys_timer;
16
17struct machine_desc {
18 /*
19 * Note! The first four elements are used
20 * by assembler code in head.S, head-common.S
21 */
22 unsigned int nr; /* architecture number */
23 unsigned int phys_io; /* start of physical io */
24 unsigned int io_pg_offst; /* byte offset for io
25 * page tabe entry */
26
27 const char *name; /* architecture name */
28 unsigned long boot_params; /* tagged list */
29
30 unsigned int video_start; /* start of video RAM */
31 unsigned int video_end; /* end of video RAM */
32
33 unsigned int reserve_lp0 :1; /* never has lp0 */
34 unsigned int reserve_lp1 :1; /* never has lp1 */
35 unsigned int reserve_lp2 :1; /* never has lp2 */
36 unsigned int soft_reboot :1; /* soft reboot */
37 void (*fixup)(struct machine_desc *,
38 struct tag *, char **,
39 struct meminfo *);
40 void (*map_io)(void);/* IO mapping function */
41 void (*init_irq)(void);
42 struct sys_timer *timer; /* system tick timer */
43 void (*init_machine)(void);
44};
45
46/*
47 * Set of macros to define architecture features. This is built into
48 * a table by the linker.
49 */
50#define MACHINE_START(_type,_name) \
51static const struct machine_desc __mach_desc_##_type \
52 __used \
53 __attribute__((__section__(".arch.info.init"))) = { \
54 .nr = MACH_TYPE_##_type, \
55 .name = _name,
56
57#define MACHINE_END \
58};
59
60#endif
diff --git a/arch/arm/include/asm/mach/dma.h b/arch/arm/include/asm/mach/dma.h
new file mode 100644
index 000000000000..fc7278ea7146
--- /dev/null
+++ b/arch/arm/include/asm/mach/dma.h
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/include/asm/mach/dma.h
3 *
4 * Copyright (C) 1998-2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This header file describes the interface between the generic DMA handler
11 * (dma.c) and the architecture-specific DMA backends (dma-*.c)
12 */
13
14struct dma_struct;
15typedef struct dma_struct dma_t;
16
17struct dma_ops {
18 int (*request)(dmach_t, dma_t *); /* optional */
19 void (*free)(dmach_t, dma_t *); /* optional */
20 void (*enable)(dmach_t, dma_t *); /* mandatory */
21 void (*disable)(dmach_t, dma_t *); /* mandatory */
22 int (*residue)(dmach_t, dma_t *); /* optional */
23 int (*setspeed)(dmach_t, dma_t *, int); /* optional */
24 char *type;
25};
26
27struct dma_struct {
28 void *addr; /* single DMA address */
29 unsigned long count; /* single DMA size */
30 struct scatterlist buf; /* single DMA */
31 int sgcount; /* number of DMA SG */
32 struct scatterlist *sg; /* DMA Scatter-Gather List */
33
34 unsigned int active:1; /* Transfer active */
35 unsigned int invalid:1; /* Address/Count changed */
36
37 dmamode_t dma_mode; /* DMA mode */
38 int speed; /* DMA speed */
39
40 unsigned int lock; /* Device is allocated */
41 const char *device_id; /* Device name */
42
43 unsigned int dma_base; /* Controller base address */
44 int dma_irq; /* Controller IRQ */
45 struct scatterlist cur_sg; /* Current controller buffer */
46 unsigned int state;
47
48 struct dma_ops *d_ops;
49};
50
51/* Prototype: void arch_dma_init(dma)
52 * Purpose : Initialise architecture specific DMA
53 * Params : dma - pointer to array of DMA structures
54 */
55extern void arch_dma_init(dma_t *dma);
56
57extern void isa_init_dma(dma_t *dma);
diff --git a/arch/arm/include/asm/mach/flash.h b/arch/arm/include/asm/mach/flash.h
new file mode 100644
index 000000000000..4ca69fe2c850
--- /dev/null
+++ b/arch/arm/include/asm/mach/flash.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/include/asm/mach/flash.h
3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
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 ASMARM_MACH_FLASH_H
11#define ASMARM_MACH_FLASH_H
12
13struct mtd_partition;
14struct mtd_info;
15
16/*
17 * map_name: the map probe function name
18 * name: flash device name (eg, as used with mtdparts=)
19 * width: width of mapped device
20 * init: method called at driver/device initialisation
21 * exit: method called at driver/device removal
22 * set_vpp: method called to enable or disable VPP
23 * mmcontrol: method called to enable or disable Sync. Burst Read in OneNAND
24 * parts: optional array of mtd_partitions for static partitioning
25 * nr_parts: number of mtd_partitions for static partitoning
26 */
27struct flash_platform_data {
28 const char *map_name;
29 const char *name;
30 unsigned int width;
31 int (*init)(void);
32 void (*exit)(void);
33 void (*set_vpp)(int on);
34 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
35 struct mtd_partition *parts;
36 unsigned int nr_parts;
37};
38
39#endif
diff --git a/arch/arm/include/asm/mach/irda.h b/arch/arm/include/asm/mach/irda.h
new file mode 100644
index 000000000000..38f77b5e56cf
--- /dev/null
+++ b/arch/arm/include/asm/mach/irda.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/include/asm/mach/irda.h
3 *
4 * Copyright (C) 2004 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_MACH_IRDA_H
11#define __ASM_ARM_MACH_IRDA_H
12
13struct irda_platform_data {
14 int (*startup)(struct device *);
15 void (*shutdown)(struct device *);
16 int (*set_power)(struct device *, unsigned int state);
17 void (*set_speed)(struct device *, unsigned int speed);
18};
19
20#endif
diff --git a/arch/arm/include/asm/mach/irq.h b/arch/arm/include/asm/mach/irq.h
new file mode 100644
index 000000000000..acac5302e4ea
--- /dev/null
+++ b/arch/arm/include/asm/mach/irq.h
@@ -0,0 +1,34 @@
1/*
2 * arch/arm/include/asm/mach/irq.h
3 *
4 * Copyright (C) 1995-2000 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_MACH_IRQ_H
11#define __ASM_ARM_MACH_IRQ_H
12
13#include <linux/irq.h>
14
15struct seq_file;
16
17/*
18 * This is internal. Do not use it.
19 */
20extern void (*init_arch_irq)(void);
21extern void init_FIQ(void);
22extern int show_fiq_list(struct seq_file *, void *);
23
24/*
25 * This is for easy migration, but should be changed in the source
26 */
27#define do_bad_IRQ(irq,desc) \
28do { \
29 spin_lock(&desc->lock); \
30 handle_bad_irq(irq, desc); \
31 spin_unlock(&desc->lock); \
32} while(0)
33
34#endif
diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
new file mode 100644
index 000000000000..06f583b13999
--- /dev/null
+++ b/arch/arm/include/asm/mach/map.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/include/asm/map.h
3 *
4 * Copyright (C) 1999-2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Page table mapping constructs and function prototypes
11 */
12#include <asm/io.h>
13
14struct map_desc {
15 unsigned long virtual;
16 unsigned long pfn;
17 unsigned long length;
18 unsigned int type;
19};
20
21/* types 0-3 are defined in asm/io.h */
22#define MT_CACHECLEAN 4
23#define MT_MINICLEAN 5
24#define MT_LOW_VECTORS 6
25#define MT_HIGH_VECTORS 7
26#define MT_MEMORY 8
27#define MT_ROM 9
28
29#define MT_NONSHARED_DEVICE MT_DEVICE_NONSHARED
30#define MT_IXP2000_DEVICE MT_DEVICE_IXP2000
31
32#ifdef CONFIG_MMU
33extern void iotable_init(struct map_desc *, int);
34#else
35#define iotable_init(map,num) do { } while (0)
36#endif
diff --git a/arch/arm/include/asm/mach/mmc.h b/arch/arm/include/asm/mach/mmc.h
new file mode 100644
index 000000000000..4da332b03144
--- /dev/null
+++ b/arch/arm/include/asm/mach/mmc.h
@@ -0,0 +1,15 @@
1/*
2 * arch/arm/include/asm/mach/mmc.h
3 */
4#ifndef ASMARM_MACH_MMC_H
5#define ASMARM_MACH_MMC_H
6
7#include <linux/mmc/host.h>
8
9struct mmc_platform_data {
10 unsigned int ocr_mask; /* available voltages */
11 u32 (*translate_vdd)(struct device *, unsigned int);
12 unsigned int (*status)(struct device *);
13};
14
15#endif
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
new file mode 100644
index 000000000000..32da1ae17e06
--- /dev/null
+++ b/arch/arm/include/asm/mach/pci.h
@@ -0,0 +1,72 @@
1/*
2 * arch/arm/include/asm/mach/pci.h
3 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11struct pci_sys_data;
12struct pci_bus;
13
14struct hw_pci {
15 struct list_head buses;
16 int nr_controllers;
17 int (*setup)(int nr, struct pci_sys_data *);
18 struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
19 void (*preinit)(void);
20 void (*postinit)(void);
21 u8 (*swizzle)(struct pci_dev *dev, u8 *pin);
22 int (*map_irq)(struct pci_dev *dev, u8 slot, u8 pin);
23};
24
25/*
26 * Per-controller structure
27 */
28struct pci_sys_data {
29 struct list_head node;
30 int busnr; /* primary bus number */
31 u64 mem_offset; /* bus->cpu memory mapping offset */
32 unsigned long io_offset; /* bus->cpu IO mapping offset */
33 struct pci_bus *bus; /* PCI bus */
34 struct resource *resource[3]; /* Primary PCI bus resources */
35 /* Bridge swizzling */
36 u8 (*swizzle)(struct pci_dev *, u8 *);
37 /* IRQ mapping */
38 int (*map_irq)(struct pci_dev *, u8, u8);
39 struct hw_pci *hw;
40};
41
42/*
43 * This is the standard PCI-PCI bridge swizzling algorithm.
44 */
45u8 pci_std_swizzle(struct pci_dev *dev, u8 *pinp);
46
47/*
48 * Call this with your hw_pci struct to initialise the PCI system.
49 */
50void pci_common_init(struct hw_pci *);
51
52/*
53 * PCI controllers
54 */
55extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
56extern struct pci_bus *iop3xx_pci_scan_bus(int nr, struct pci_sys_data *);
57extern void iop3xx_pci_preinit(void);
58extern void iop3xx_pci_preinit_cond(void);
59
60extern int dc21285_setup(int nr, struct pci_sys_data *);
61extern struct pci_bus *dc21285_scan_bus(int nr, struct pci_sys_data *);
62extern void dc21285_preinit(void);
63extern void dc21285_postinit(void);
64
65extern int via82c505_setup(int nr, struct pci_sys_data *);
66extern struct pci_bus *via82c505_scan_bus(int nr, struct pci_sys_data *);
67extern void via82c505_init(void *sysdata);
68
69extern int pci_v3_setup(int nr, struct pci_sys_data *);
70extern struct pci_bus *pci_v3_scan_bus(int nr, struct pci_sys_data *);
71extern void pci_v3_preinit(void);
72extern void pci_v3_postinit(void);
diff --git a/arch/arm/include/asm/mach/serial_at91.h b/arch/arm/include/asm/mach/serial_at91.h
new file mode 100644
index 000000000000..ea6d063923b8
--- /dev/null
+++ b/arch/arm/include/asm/mach/serial_at91.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/include/asm/mach/serial_at91.h
3 *
4 * Based on serial_sa1100.h by Nicolas Pitre
5 *
6 * Copyright (C) 2002 ATMEL Rousset
7 *
8 * Low level machine dependent UART functions.
9 */
10
11struct uart_port;
12
13/*
14 * This is a temporary structure for registering these
15 * functions; it is intended to be discarded after boot.
16 */
17struct atmel_port_fns {
18 void (*set_mctrl)(struct uart_port *, u_int);
19 u_int (*get_mctrl)(struct uart_port *);
20 void (*enable_ms)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23 int (*open)(struct uart_port *);
24 void (*close)(struct uart_port *);
25};
26
27#if defined(CONFIG_SERIAL_ATMEL)
28void atmel_register_uart_fns(struct atmel_port_fns *fns);
29#else
30#define atmel_register_uart_fns(fns) do { } while (0)
31#endif
32
33
diff --git a/arch/arm/include/asm/mach/serial_sa1100.h b/arch/arm/include/asm/mach/serial_sa1100.h
new file mode 100644
index 000000000000..d09064bf95a0
--- /dev/null
+++ b/arch/arm/include/asm/mach/serial_sa1100.h
@@ -0,0 +1,31 @@
1/*
2 * arch/arm/include/asm/mach/serial_sa1100.h
3 *
4 * Author: Nicolas Pitre
5 *
6 * Moved and changed lots, Russell King
7 *
8 * Low level machine dependent UART functions.
9 */
10
11struct uart_port;
12struct uart_info;
13
14/*
15 * This is a temporary structure for registering these
16 * functions; it is intended to be discarded after boot.
17 */
18struct sa1100_port_fns {
19 void (*set_mctrl)(struct uart_port *, u_int);
20 u_int (*get_mctrl)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23};
24
25#ifdef CONFIG_SERIAL_SA1100
26void sa1100_register_uart_fns(struct sa1100_port_fns *fns);
27void sa1100_register_uart(int idx, int port);
28#else
29#define sa1100_register_uart_fns(fns) do { } while (0)
30#define sa1100_register_uart(idx,port) do { } while (0)
31#endif
diff --git a/arch/arm/include/asm/mach/sharpsl_param.h b/arch/arm/include/asm/mach/sharpsl_param.h
new file mode 100644
index 000000000000..7a24ecf04220
--- /dev/null
+++ b/arch/arm/include/asm/mach/sharpsl_param.h
@@ -0,0 +1,37 @@
1/*
2 * Hardware parameter area specific to Sharp SL series devices
3 *
4 * Copyright (c) 2005 Richard Purdie
5 *
6 * Based on Sharp's 2.4 kernel patches
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
14struct sharpsl_param_info {
15 unsigned int comadj_keyword;
16 unsigned int comadj;
17
18 unsigned int uuid_keyword;
19 unsigned char uuid[16];
20
21 unsigned int touch_keyword;
22 unsigned int touch_xp;
23 unsigned int touch_yp;
24 unsigned int touch_xd;
25 unsigned int touch_yd;
26
27 unsigned int adadj_keyword;
28 unsigned int adadj;
29
30 unsigned int phad_keyword;
31 unsigned int phadadj;
32} __attribute__((packed));
33
34
35extern struct sharpsl_param_info sharpsl_param;
36extern void sharpsl_save_param(void);
37
diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h
new file mode 100644
index 000000000000..b2cc1fcd0400
--- /dev/null
+++ b/arch/arm/include/asm/mach/time.h
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/include/asm/mach/time.h
3 *
4 * Copyright (C) 2004 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_MACH_TIME_H
11#define __ASM_ARM_MACH_TIME_H
12
13#include <linux/sysdev.h>
14
15/*
16 * This is our kernel timer structure.
17 *
18 * - init
19 * Initialise the kernels jiffy timer source, claim interrupt
20 * using setup_irq. This is called early on during initialisation
21 * while interrupts are still disabled on the local CPU.
22 * - suspend
23 * Suspend the kernel jiffy timer source, if necessary. This
24 * is called with interrupts disabled, after all normal devices
25 * have been suspended. If no action is required, set this to
26 * NULL.
27 * - resume
28 * Resume the kernel jiffy timer source, if necessary. This
29 * is called with interrupts disabled before any normal devices
30 * are resumed. If no action is required, set this to NULL.
31 * - offset
32 * Return the timer offset in microseconds since the last timer
33 * interrupt. Note: this must take account of any unprocessed
34 * timer interrupt which may be pending.
35 */
36struct sys_timer {
37 struct sys_device dev;
38 void (*init)(void);
39 void (*suspend)(void);
40 void (*resume)(void);
41#ifndef CONFIG_GENERIC_TIME
42 unsigned long (*offset)(void);
43#endif
44};
45
46extern struct sys_timer *system_timer;
47extern void timer_tick(void);
48
49/*
50 * Kernel time keeping support.
51 */
52struct timespec;
53extern int (*set_rtc)(void);
54extern void save_time_delta(struct timespec *delta, struct timespec *rtc);
55extern void restore_time_delta(struct timespec *delta, struct timespec *rtc);
56
57#endif
diff --git a/arch/arm/include/asm/mach/udc_pxa2xx.h b/arch/arm/include/asm/mach/udc_pxa2xx.h
new file mode 100644
index 000000000000..270902c353fd
--- /dev/null
+++ b/arch/arm/include/asm/mach/udc_pxa2xx.h
@@ -0,0 +1,29 @@
1/*
2 * arch/arm/include/asm/mach/udc_pxa2xx.h
3 *
4 * This supports machine-specific differences in how the PXA2xx
5 * USB Device Controller (UDC) is wired.
6 *
7 * It is set in linux/arch/arm/mach-pxa/<machine>.c or in
8 * linux/arch/mach-ixp4xx/<machine>.c and used in
9 * the probe routine of linux/drivers/usb/gadget/pxa2xx_udc.c
10 */
11
12struct pxa2xx_udc_mach_info {
13 int (*udc_is_connected)(void); /* do we see host? */
14 void (*udc_command)(int cmd);
15#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
16#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
17
18 /* Boards following the design guidelines in the developer's manual,
19 * with on-chip GPIOs not Lubbock's weird hardware, can have a sane
20 * VBUS IRQ and omit the methods above. Store the GPIO number
21 * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits.
22 * Note that sometimes the signals go through inverters...
23 */
24 bool gpio_vbus_inverted;
25 u16 gpio_vbus; /* high == vbus present */
26 bool gpio_pullup_inverted;
27 u16 gpio_pullup; /* high == pullup activated */
28};
29
diff --git a/arch/arm/include/asm/mc146818rtc.h b/arch/arm/include/asm/mc146818rtc.h
new file mode 100644
index 000000000000..e1ca48a9e973
--- /dev/null
+++ b/arch/arm/include/asm/mc146818rtc.h
@@ -0,0 +1,28 @@
1/*
2 * Machine dependent access functions for RTC registers.
3 */
4#ifndef _ASM_MC146818RTC_H
5#define _ASM_MC146818RTC_H
6
7#include <mach/irqs.h>
8#include <asm/io.h>
9
10#ifndef RTC_PORT
11#define RTC_PORT(x) (0x70 + (x))
12#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
13#endif
14
15/*
16 * The yet supported machines all access the RTC index register via
17 * an ISA port access but the way to access the date register differs ...
18 */
19#define CMOS_READ(addr) ({ \
20outb_p((addr),RTC_PORT(0)); \
21inb_p(RTC_PORT(1)); \
22})
23#define CMOS_WRITE(val, addr) ({ \
24outb_p((addr),RTC_PORT(0)); \
25outb_p((val),RTC_PORT(1)); \
26})
27
28#endif /* _ASM_MC146818RTC_H */
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
new file mode 100644
index 000000000000..1e070a2b561a
--- /dev/null
+++ b/arch/arm/include/asm/memory.h
@@ -0,0 +1,334 @@
1/*
2 * arch/arm/include/asm/memory.h
3 *
4 * Copyright (C) 2000-2002 Russell King
5 * modification for nommu, Hyok S. Choi, 2004
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 * Note: this file should not be included by non-asm/.h files
12 */
13#ifndef __ASM_ARM_MEMORY_H
14#define __ASM_ARM_MEMORY_H
15
16/*
17 * Allow for constants defined here to be used from assembly code
18 * by prepending the UL suffix only with actual C code compilation.
19 */
20#ifndef __ASSEMBLY__
21#define UL(x) (x##UL)
22#else
23#define UL(x) (x)
24#endif
25
26#include <linux/compiler.h>
27#include <mach/memory.h>
28#include <asm/sizes.h>
29
30#ifdef CONFIG_MMU
31
32#ifndef TASK_SIZE
33/*
34 * TASK_SIZE - the maximum size of a user space task.
35 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
36 */
37#define TASK_SIZE UL(0xbf000000)
38#define TASK_UNMAPPED_BASE UL(0x40000000)
39#endif
40
41/*
42 * The maximum size of a 26-bit user space task.
43 */
44#define TASK_SIZE_26 UL(0x04000000)
45
46/*
47 * Page offset: 3GB
48 */
49#ifndef PAGE_OFFSET
50#define PAGE_OFFSET UL(0xc0000000)
51#endif
52
53/*
54 * The module space lives between the addresses given by TASK_SIZE
55 * and PAGE_OFFSET - it must be within 32MB of the kernel text.
56 */
57#define MODULE_END (PAGE_OFFSET)
58#define MODULE_START (MODULE_END - 16*1048576)
59
60#if TASK_SIZE > MODULE_START
61#error Top of user space clashes with start of module space
62#endif
63
64/*
65 * The XIP kernel gets mapped at the bottom of the module vm area.
66 * Since we use sections to map it, this macro replaces the physical address
67 * with its virtual address while keeping offset from the base section.
68 */
69#define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff))
70
71/*
72 * Allow 16MB-aligned ioremap pages
73 */
74#define IOREMAP_MAX_ORDER 24
75
76#else /* CONFIG_MMU */
77
78/*
79 * The limitation of user task size can grow up to the end of free ram region.
80 * It is difficult to define and perhaps will never meet the original meaning
81 * of this define that was meant to.
82 * Fortunately, there is no reference for this in noMMU mode, for now.
83 */
84#ifndef TASK_SIZE
85#define TASK_SIZE (CONFIG_DRAM_SIZE)
86#endif
87
88#ifndef TASK_UNMAPPED_BASE
89#define TASK_UNMAPPED_BASE UL(0x00000000)
90#endif
91
92#ifndef PHYS_OFFSET
93#define PHYS_OFFSET (CONFIG_DRAM_BASE)
94#endif
95
96#ifndef END_MEM
97#define END_MEM (CONFIG_DRAM_BASE + CONFIG_DRAM_SIZE)
98#endif
99
100#ifndef PAGE_OFFSET
101#define PAGE_OFFSET (PHYS_OFFSET)
102#endif
103
104/*
105 * The module can be at any place in ram in nommu mode.
106 */
107#define MODULE_END (END_MEM)
108#define MODULE_START (PHYS_OFFSET)
109
110#endif /* !CONFIG_MMU */
111
112/*
113 * Size of DMA-consistent memory region. Must be multiple of 2M,
114 * between 2MB and 14MB inclusive.
115 */
116#ifndef CONSISTENT_DMA_SIZE
117#define CONSISTENT_DMA_SIZE SZ_2M
118#endif
119
120/*
121 * Physical vs virtual RAM address space conversion. These are
122 * private definitions which should NOT be used outside memory.h
123 * files. Use virt_to_phys/phys_to_virt/__pa/__va instead.
124 */
125#ifndef __virt_to_phys
126#define __virt_to_phys(x) ((x) - PAGE_OFFSET + PHYS_OFFSET)
127#define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET)
128#endif
129
130/*
131 * Convert a physical address to a Page Frame Number and back
132 */
133#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
134#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
135
136#ifndef __ASSEMBLY__
137
138/*
139 * The DMA mask corresponding to the maximum bus address allocatable
140 * using GFP_DMA. The default here places no restriction on DMA
141 * allocations. This must be the smallest DMA mask in the system,
142 * so a successful GFP_DMA allocation will always satisfy this.
143 */
144#ifndef ISA_DMA_THRESHOLD
145#define ISA_DMA_THRESHOLD (0xffffffffULL)
146#endif
147
148#ifndef arch_adjust_zones
149#define arch_adjust_zones(node,size,holes) do { } while (0)
150#endif
151
152/*
153 * PFNs are used to describe any physical page; this means
154 * PFN 0 == physical address 0.
155 *
156 * This is the PFN of the first RAM page in the kernel
157 * direct-mapped view. We assume this is the first page
158 * of RAM in the mem_map as well.
159 */
160#define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
161
162/*
163 * These are *only* valid on the kernel direct mapped RAM memory.
164 * Note: Drivers should NOT use these. They are the wrong
165 * translation for translating DMA addresses. Use the driver
166 * DMA support - see dma-mapping.h.
167 */
168static inline unsigned long virt_to_phys(void *x)
169{
170 return __virt_to_phys((unsigned long)(x));
171}
172
173static inline void *phys_to_virt(unsigned long x)
174{
175 return (void *)(__phys_to_virt((unsigned long)(x)));
176}
177
178/*
179 * Drivers should NOT use these either.
180 */
181#define __pa(x) __virt_to_phys((unsigned long)(x))
182#define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
183#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
184
185/*
186 * Virtual <-> DMA view memory address translations
187 * Again, these are *only* valid on the kernel direct mapped RAM
188 * memory. Use of these is *deprecated* (and that doesn't mean
189 * use the __ prefixed forms instead.) See dma-mapping.h.
190 */
191static inline __deprecated unsigned long virt_to_bus(void *x)
192{
193 return __virt_to_bus((unsigned long)x);
194}
195
196static inline __deprecated void *bus_to_virt(unsigned long x)
197{
198 return (void *)__bus_to_virt(x);
199}
200
201/*
202 * Conversion between a struct page and a physical address.
203 *
204 * Note: when converting an unknown physical address to a
205 * struct page, the resulting pointer must be validated
206 * using VALID_PAGE(). It must return an invalid struct page
207 * for any physical address not corresponding to a system
208 * RAM address.
209 *
210 * page_to_pfn(page) convert a struct page * to a PFN number
211 * pfn_to_page(pfn) convert a _valid_ PFN number to struct page *
212 * pfn_valid(pfn) indicates whether a PFN number is valid
213 *
214 * virt_to_page(k) convert a _valid_ virtual address to struct page *
215 * virt_addr_valid(k) indicates whether a virtual address is valid
216 */
217#ifndef CONFIG_DISCONTIGMEM
218
219#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
220
221#ifndef CONFIG_SPARSEMEM
222#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
223#endif
224
225#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
226#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
227
228#define PHYS_TO_NID(addr) (0)
229
230#else /* CONFIG_DISCONTIGMEM */
231
232/*
233 * This is more complex. We have a set of mem_map arrays spread
234 * around in memory.
235 */
236#include <linux/numa.h>
237
238#define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn)
239#define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT)
240
241#define pfn_valid(pfn) \
242 ({ \
243 unsigned int nid = PFN_TO_NID(pfn); \
244 int valid = nid < MAX_NUMNODES; \
245 if (valid) { \
246 pg_data_t *node = NODE_DATA(nid); \
247 valid = (pfn - node->node_start_pfn) < \
248 node->node_spanned_pages; \
249 } \
250 valid; \
251 })
252
253#define virt_to_page(kaddr) \
254 (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
255
256#define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < MAX_NUMNODES)
257
258/*
259 * Common discontigmem stuff.
260 * PHYS_TO_NID is used by the ARM kernel/setup.c
261 */
262#define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT)
263
264/*
265 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
266 * and returns the mem_map of that node.
267 */
268#define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
269
270/*
271 * Given a page frame number, find the owning node of the memory
272 * and returns the mem_map of that node.
273 */
274#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
275
276#ifdef NODE_MEM_SIZE_BITS
277#define NODE_MEM_SIZE_MASK ((1 << NODE_MEM_SIZE_BITS) - 1)
278
279/*
280 * Given a kernel address, find the home node of the underlying memory.
281 */
282#define KVADDR_TO_NID(addr) \
283 (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MEM_SIZE_BITS)
284
285/*
286 * Given a page frame number, convert it to a node id.
287 */
288#define PFN_TO_NID(pfn) \
289 (((pfn) - PHYS_PFN_OFFSET) >> (NODE_MEM_SIZE_BITS - PAGE_SHIFT))
290
291/*
292 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
293 * and returns the index corresponding to the appropriate page in the
294 * node's mem_map.
295 */
296#define LOCAL_MAP_NR(addr) \
297 (((unsigned long)(addr) & NODE_MEM_SIZE_MASK) >> PAGE_SHIFT)
298
299#endif /* NODE_MEM_SIZE_BITS */
300
301#endif /* !CONFIG_DISCONTIGMEM */
302
303/*
304 * For BIO. "will die". Kill me when bio_to_phys() and bvec_to_phys() die.
305 */
306#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
307
308/*
309 * Optional device DMA address remapping. Do _not_ use directly!
310 * We should really eliminate virt_to_bus() here - it's deprecated.
311 */
312#ifndef __arch_page_to_dma
313#define page_to_dma(dev, page) ((dma_addr_t)__virt_to_bus((unsigned long)page_address(page)))
314#define dma_to_virt(dev, addr) ((void *)__bus_to_virt(addr))
315#define virt_to_dma(dev, addr) ((dma_addr_t)__virt_to_bus((unsigned long)(addr)))
316#else
317#define page_to_dma(dev, page) (__arch_page_to_dma(dev, page))
318#define dma_to_virt(dev, addr) (__arch_dma_to_virt(dev, addr))
319#define virt_to_dma(dev, addr) (__arch_virt_to_dma(dev, addr))
320#endif
321
322/*
323 * Optional coherency support. Currently used only by selected
324 * Intel XSC3-based systems.
325 */
326#ifndef arch_is_coherent
327#define arch_is_coherent() 0
328#endif
329
330#endif
331
332#include <asm-generic/memory_model.h>
333
334#endif
diff --git a/arch/arm/include/asm/mman.h b/arch/arm/include/asm/mman.h
new file mode 100644
index 000000000000..54570d2e95b7
--- /dev/null
+++ b/arch/arm/include/asm/mman.h
@@ -0,0 +1,17 @@
1#ifndef __ARM_MMAN_H__
2#define __ARM_MMAN_H__
3
4#include <asm-generic/mman.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __ARM_MMAN_H__ */
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
new file mode 100644
index 000000000000..53099d4ee421
--- /dev/null
+++ b/arch/arm/include/asm/mmu.h
@@ -0,0 +1,33 @@
1#ifndef __ARM_MMU_H
2#define __ARM_MMU_H
3
4#ifdef CONFIG_MMU
5
6typedef struct {
7#ifdef CONFIG_CPU_HAS_ASID
8 unsigned int id;
9#endif
10 unsigned int kvm_seq;
11} mm_context_t;
12
13#ifdef CONFIG_CPU_HAS_ASID
14#define ASID(mm) ((mm)->context.id & 255)
15#else
16#define ASID(mm) (0)
17#endif
18
19#else
20
21/*
22 * From nommu.h:
23 * Copyright (C) 2002, David McCullough <davidm@snapgear.com>
24 * modified for 2.6 by Hyok S. Choi <hyok.choi@samsung.com>
25 */
26typedef struct {
27 struct vm_list_struct *vmlist;
28 unsigned long end_brk;
29} mm_context_t;
30
31#endif
32
33#endif
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
new file mode 100644
index 000000000000..a301e446007f
--- /dev/null
+++ b/arch/arm/include/asm/mmu_context.h
@@ -0,0 +1,117 @@
1/*
2 * arch/arm/include/asm/mmu_context.h
3 *
4 * Copyright (C) 1996 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Changelog:
11 * 27-06-1996 RMK Created
12 */
13#ifndef __ASM_ARM_MMU_CONTEXT_H
14#define __ASM_ARM_MMU_CONTEXT_H
15
16#include <linux/compiler.h>
17#include <asm/cacheflush.h>
18#include <asm/proc-fns.h>
19#include <asm-generic/mm_hooks.h>
20
21void __check_kvm_seq(struct mm_struct *mm);
22
23#ifdef CONFIG_CPU_HAS_ASID
24
25/*
26 * On ARMv6, we have the following structure in the Context ID:
27 *
28 * 31 7 0
29 * +-------------------------+-----------+
30 * | process ID | ASID |
31 * +-------------------------+-----------+
32 * | context ID |
33 * +-------------------------------------+
34 *
35 * The ASID is used to tag entries in the CPU caches and TLBs.
36 * The context ID is used by debuggers and trace logic, and
37 * should be unique within all running processes.
38 */
39#define ASID_BITS 8
40#define ASID_MASK ((~0) << ASID_BITS)
41#define ASID_FIRST_VERSION (1 << ASID_BITS)
42
43extern unsigned int cpu_last_asid;
44
45void __init_new_context(struct task_struct *tsk, struct mm_struct *mm);
46void __new_context(struct mm_struct *mm);
47
48static inline void check_context(struct mm_struct *mm)
49{
50 if (unlikely((mm->context.id ^ cpu_last_asid) >> ASID_BITS))
51 __new_context(mm);
52
53 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq))
54 __check_kvm_seq(mm);
55}
56
57#define init_new_context(tsk,mm) (__init_new_context(tsk,mm),0)
58
59#else
60
61static inline void check_context(struct mm_struct *mm)
62{
63 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq))
64 __check_kvm_seq(mm);
65}
66
67#define init_new_context(tsk,mm) 0
68
69#endif
70
71#define destroy_context(mm) do { } while(0)
72
73/*
74 * This is called when "tsk" is about to enter lazy TLB mode.
75 *
76 * mm: describes the currently active mm context
77 * tsk: task which is entering lazy tlb
78 * cpu: cpu number which is entering lazy tlb
79 *
80 * tsk->mm will be NULL
81 */
82static inline void
83enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
84{
85}
86
87/*
88 * This is the actual mm switch as far as the scheduler
89 * is concerned. No registers are touched. We avoid
90 * calling the CPU specific function when the mm hasn't
91 * actually changed.
92 */
93static inline void
94switch_mm(struct mm_struct *prev, struct mm_struct *next,
95 struct task_struct *tsk)
96{
97#ifdef CONFIG_MMU
98 unsigned int cpu = smp_processor_id();
99
100#ifdef CONFIG_SMP
101 /* check for possible thread migration */
102 if (!cpus_empty(next->cpu_vm_mask) && !cpu_isset(cpu, next->cpu_vm_mask))
103 __flush_icache_all();
104#endif
105 if (!cpu_test_and_set(cpu, next->cpu_vm_mask) || prev != next) {
106 check_context(next);
107 cpu_switch_mm(next->pgd, next);
108 if (cache_is_vivt())
109 cpu_clear(cpu, prev->cpu_vm_mask);
110 }
111#endif
112}
113
114#define deactivate_mm(tsk,mm) do { } while (0)
115#define activate_mm(prev,next) switch_mm(prev, next, NULL)
116
117#endif
diff --git a/arch/arm/include/asm/mmzone.h b/arch/arm/include/asm/mmzone.h
new file mode 100644
index 000000000000..ae63a4fd28c8
--- /dev/null
+++ b/arch/arm/include/asm/mmzone.h
@@ -0,0 +1,30 @@
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/module.h b/arch/arm/include/asm/module.h
new file mode 100644
index 000000000000..24b168dc31a3
--- /dev/null
+++ b/arch/arm/include/asm/module.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_ARM_MODULE_H
2#define _ASM_ARM_MODULE_H
3
4struct mod_arch_specific
5{
6 int foo;
7};
8
9#define Elf_Shdr Elf32_Shdr
10#define Elf_Sym Elf32_Sym
11#define Elf_Ehdr Elf32_Ehdr
12
13/*
14 * Include the ARM architecture version.
15 */
16#define MODULE_ARCH_VERMAGIC "ARMv" __stringify(__LINUX_ARM_ARCH__) " "
17
18#endif /* _ASM_ARM_MODULE_H */
diff --git a/arch/arm/include/asm/msgbuf.h b/arch/arm/include/asm/msgbuf.h
new file mode 100644
index 000000000000..33b35b946eaa
--- /dev/null
+++ b/arch/arm/include/asm/msgbuf.h
@@ -0,0 +1,31 @@
1#ifndef _ASMARM_MSGBUF_H
2#define _ASMARM_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* _ASMARM_MSGBUF_H */
diff --git a/arch/arm/include/asm/mtd-xip.h b/arch/arm/include/asm/mtd-xip.h
new file mode 100644
index 000000000000..4225372a26f3
--- /dev/null
+++ b/arch/arm/include/asm/mtd-xip.h
@@ -0,0 +1,26 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Nicolas Pitre
7 * Created: Nov 2, 2004
8 * Copyright: (C) 2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
15 */
16
17#ifndef __ARM_MTD_XIP_H__
18#define __ARM_MTD_XIP_H__
19
20#include <mach/hardware.h>
21#include <mach/mtd-xip.h>
22
23/* fill instruction prefetch */
24#define xip_iprefetch() do { asm volatile (".rep 8; nop; .endr"); } while (0)
25
26#endif /* __ARM_MTD_XIP_H__ */
diff --git a/arch/arm/include/asm/mutex.h b/arch/arm/include/asm/mutex.h
new file mode 100644
index 000000000000..93226cf23ae0
--- /dev/null
+++ b/arch/arm/include/asm/mutex.h
@@ -0,0 +1,127 @@
1/*
2 * arch/arm/include/asm/mutex.h
3 *
4 * ARM optimized mutex locking primitives
5 *
6 * Please look into asm-generic/mutex-xchg.h for a formal definition.
7 */
8#ifndef _ASM_MUTEX_H
9#define _ASM_MUTEX_H
10
11#if __LINUX_ARM_ARCH__ < 6
12/* On pre-ARMv6 hardware the swp based implementation is the most efficient. */
13# include <asm-generic/mutex-xchg.h>
14#else
15
16/*
17 * Attempting to lock a mutex on ARMv6+ can be done with a bastardized
18 * atomic decrement (it is not a reliable atomic decrement but it satisfies
19 * the defined semantics for our purpose, while being smaller and faster
20 * than a real atomic decrement or atomic swap. The idea is to attempt
21 * decrementing the lock value only once. If once decremented it isn't zero,
22 * or if its store-back fails due to a dispute on the exclusive store, we
23 * simply bail out immediately through the slow path where the lock will be
24 * reattempted until it succeeds.
25 */
26static inline void
27__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
28{
29 int __ex_flag, __res;
30
31 __asm__ (
32
33 "ldrex %0, [%2] \n\t"
34 "sub %0, %0, #1 \n\t"
35 "strex %1, %0, [%2] "
36
37 : "=&r" (__res), "=&r" (__ex_flag)
38 : "r" (&(count)->counter)
39 : "cc","memory" );
40
41 __res |= __ex_flag;
42 if (unlikely(__res != 0))
43 fail_fn(count);
44}
45
46static inline int
47__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
48{
49 int __ex_flag, __res;
50
51 __asm__ (
52
53 "ldrex %0, [%2] \n\t"
54 "sub %0, %0, #1 \n\t"
55 "strex %1, %0, [%2] "
56
57 : "=&r" (__res), "=&r" (__ex_flag)
58 : "r" (&(count)->counter)
59 : "cc","memory" );
60
61 __res |= __ex_flag;
62 if (unlikely(__res != 0))
63 __res = fail_fn(count);
64 return __res;
65}
66
67/*
68 * Same trick is used for the unlock fast path. However the original value,
69 * rather than the result, is used to test for success in order to have
70 * better generated assembly.
71 */
72static inline void
73__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
74{
75 int __ex_flag, __res, __orig;
76
77 __asm__ (
78
79 "ldrex %0, [%3] \n\t"
80 "add %1, %0, #1 \n\t"
81 "strex %2, %1, [%3] "
82
83 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)
84 : "r" (&(count)->counter)
85 : "cc","memory" );
86
87 __orig |= __ex_flag;
88 if (unlikely(__orig != 0))
89 fail_fn(count);
90}
91
92/*
93 * If the unlock was done on a contended lock, or if the unlock simply fails
94 * then the mutex remains locked.
95 */
96#define __mutex_slowpath_needs_to_unlock() 1
97
98/*
99 * For __mutex_fastpath_trylock we use another construct which could be
100 * described as a "single value cmpxchg".
101 *
102 * This provides the needed trylock semantics like cmpxchg would, but it is
103 * lighter and less generic than a true cmpxchg implementation.
104 */
105static inline int
106__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
107{
108 int __ex_flag, __res, __orig;
109
110 __asm__ (
111
112 "1: ldrex %0, [%3] \n\t"
113 "subs %1, %0, #1 \n\t"
114 "strexeq %2, %1, [%3] \n\t"
115 "movlt %0, #0 \n\t"
116 "cmpeq %2, #0 \n\t"
117 "bgt 1b "
118
119 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)
120 : "r" (&count->counter)
121 : "cc", "memory" );
122
123 return __orig;
124}
125
126#endif
127#endif
diff --git a/arch/arm/include/asm/nwflash.h b/arch/arm/include/asm/nwflash.h
new file mode 100644
index 000000000000..04e5a557a884
--- /dev/null
+++ b/arch/arm/include/asm/nwflash.h
@@ -0,0 +1,9 @@
1#ifndef _FLASH_H
2#define _FLASH_H
3
4#define FLASH_MINOR 160 /* MAJOR is 10 - miscdevice */
5#define CMD_WRITE_DISABLE 0
6#define CMD_WRITE_ENABLE 0x28
7#define CMD_WRITE_BASE64K_ENABLE 0x47
8
9#endif /* _FLASH_H */
diff --git a/arch/arm/include/asm/page-nommu.h b/arch/arm/include/asm/page-nommu.h
new file mode 100644
index 000000000000..3574c0deb37f
--- /dev/null
+++ b/arch/arm/include/asm/page-nommu.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/include/asm/page-nommu.h
3 *
4 * Copyright (C) 2004 Hyok S. Choi
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 _ASMARM_PAGE_NOMMU_H
12#define _ASMARM_PAGE_NOMMU_H
13
14#if !defined(CONFIG_SMALL_TASKS) && PAGE_SHIFT < 13
15#define KTHREAD_SIZE (8192)
16#else
17#define KTHREAD_SIZE PAGE_SIZE
18#endif
19
20#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
21#define free_user_page(page, addr) free_page(addr)
22
23#define clear_page(page) memset((page), 0, PAGE_SIZE)
24#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
25
26#define clear_user_page(page, vaddr, pg) clear_page(page)
27#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
28
29/*
30 * These are used to make use of C type-checking..
31 */
32typedef unsigned long pte_t;
33typedef unsigned long pmd_t;
34typedef unsigned long pgd_t[2];
35typedef unsigned long pgprot_t;
36
37#define pte_val(x) (x)
38#define pmd_val(x) (x)
39#define pgd_val(x) ((x)[0])
40#define pgprot_val(x) (x)
41
42#define __pte(x) (x)
43#define __pmd(x) (x)
44#define __pgprot(x) (x)
45
46extern unsigned long memory_start;
47extern unsigned long memory_end;
48
49#endif
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
new file mode 100644
index 000000000000..cf2e2680daaa
--- /dev/null
+++ b/arch/arm/include/asm/page.h
@@ -0,0 +1,199 @@
1/*
2 * arch/arm/include/asm/page.h
3 *
4 * Copyright (C) 1995-2003 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _ASMARM_PAGE_H
11#define _ASMARM_PAGE_H
12
13/* PAGE_SHIFT determines the page size */
14#define PAGE_SHIFT 12
15#define PAGE_SIZE (1UL << PAGE_SHIFT)
16#define PAGE_MASK (~(PAGE_SIZE-1))
17
18#ifndef __ASSEMBLY__
19
20#ifndef CONFIG_MMU
21
22#include "page-nommu.h"
23
24#else
25
26#include <asm/glue.h>
27
28/*
29 * User Space Model
30 * ================
31 *
32 * This section selects the correct set of functions for dealing with
33 * page-based copying and clearing for user space for the particular
34 * processor(s) we're building for.
35 *
36 * We have the following to choose from:
37 * v3 - ARMv3
38 * v4wt - ARMv4 with writethrough cache, without minicache
39 * v4wb - ARMv4 with writeback cache, without minicache
40 * v4_mc - ARMv4 with minicache
41 * xscale - Xscale
42 * xsc3 - XScalev3
43 */
44#undef _USER
45#undef MULTI_USER
46
47#ifdef CONFIG_CPU_COPY_V3
48# ifdef _USER
49# define MULTI_USER 1
50# else
51# define _USER v3
52# endif
53#endif
54
55#ifdef CONFIG_CPU_COPY_V4WT
56# ifdef _USER
57# define MULTI_USER 1
58# else
59# define _USER v4wt
60# endif
61#endif
62
63#ifdef CONFIG_CPU_COPY_V4WB
64# ifdef _USER
65# define MULTI_USER 1
66# else
67# define _USER v4wb
68# endif
69#endif
70
71#ifdef CONFIG_CPU_COPY_FEROCEON
72# ifdef _USER
73# define MULTI_USER 1
74# else
75# define _USER feroceon
76# endif
77#endif
78
79#ifdef CONFIG_CPU_SA1100
80# ifdef _USER
81# define MULTI_USER 1
82# else
83# define _USER v4_mc
84# endif
85#endif
86
87#ifdef CONFIG_CPU_XSCALE
88# ifdef _USER
89# define MULTI_USER 1
90# else
91# define _USER xscale_mc
92# endif
93#endif
94
95#ifdef CONFIG_CPU_XSC3
96# ifdef _USER
97# define MULTI_USER 1
98# else
99# define _USER xsc3_mc
100# endif
101#endif
102
103#ifdef CONFIG_CPU_COPY_V6
104# define MULTI_USER 1
105#endif
106
107#if !defined(_USER) && !defined(MULTI_USER)
108#error Unknown user operations model
109#endif
110
111struct cpu_user_fns {
112 void (*cpu_clear_user_page)(void *p, unsigned long user);
113 void (*cpu_copy_user_page)(void *to, const void *from,
114 unsigned long user);
115};
116
117#ifdef MULTI_USER
118extern struct cpu_user_fns cpu_user;
119
120#define __cpu_clear_user_page cpu_user.cpu_clear_user_page
121#define __cpu_copy_user_page cpu_user.cpu_copy_user_page
122
123#else
124
125#define __cpu_clear_user_page __glue(_USER,_clear_user_page)
126#define __cpu_copy_user_page __glue(_USER,_copy_user_page)
127
128extern void __cpu_clear_user_page(void *p, unsigned long user);
129extern void __cpu_copy_user_page(void *to, const void *from,
130 unsigned long user);
131#endif
132
133#define clear_user_page(addr,vaddr,pg) __cpu_clear_user_page(addr, vaddr)
134#define copy_user_page(to,from,vaddr,pg) __cpu_copy_user_page(to, from, vaddr)
135
136#define clear_page(page) memzero((void *)(page), PAGE_SIZE)
137extern void copy_page(void *to, const void *from);
138
139#undef STRICT_MM_TYPECHECKS
140
141#ifdef STRICT_MM_TYPECHECKS
142/*
143 * These are used to make use of C type-checking..
144 */
145typedef struct { unsigned long pte; } pte_t;
146typedef struct { unsigned long pmd; } pmd_t;
147typedef struct { unsigned long pgd[2]; } pgd_t;
148typedef struct { unsigned long pgprot; } pgprot_t;
149
150#define pte_val(x) ((x).pte)
151#define pmd_val(x) ((x).pmd)
152#define pgd_val(x) ((x).pgd[0])
153#define pgprot_val(x) ((x).pgprot)
154
155#define __pte(x) ((pte_t) { (x) } )
156#define __pmd(x) ((pmd_t) { (x) } )
157#define __pgprot(x) ((pgprot_t) { (x) } )
158
159#else
160/*
161 * .. while these make it easier on the compiler
162 */
163typedef unsigned long pte_t;
164typedef unsigned long pmd_t;
165typedef unsigned long pgd_t[2];
166typedef unsigned long pgprot_t;
167
168#define pte_val(x) (x)
169#define pmd_val(x) (x)
170#define pgd_val(x) ((x)[0])
171#define pgprot_val(x) (x)
172
173#define __pte(x) (x)
174#define __pmd(x) (x)
175#define __pgprot(x) (x)
176
177#endif /* STRICT_MM_TYPECHECKS */
178
179#endif /* CONFIG_MMU */
180
181typedef struct page *pgtable_t;
182
183#include <asm/memory.h>
184
185#endif /* !__ASSEMBLY__ */
186
187#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
188 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
189
190/*
191 * With EABI on ARMv5 and above we must have 64-bit aligned slab pointers.
192 */
193#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)
194#define ARCH_SLAB_MINALIGN 8
195#endif
196
197#include <asm-generic/page.h>
198
199#endif
diff --git a/arch/arm/include/asm/param.h b/arch/arm/include/asm/param.h
new file mode 100644
index 000000000000..8b24bf94c06b
--- /dev/null
+++ b/arch/arm/include/asm/param.h
@@ -0,0 +1,31 @@
1/*
2 * arch/arm/include/asm/param.h
3 *
4 * Copyright (C) 1995-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_PARAM_H
11#define __ASM_PARAM_H
12
13#ifdef __KERNEL__
14# define HZ CONFIG_HZ /* Internal kernel timer frequency */
15# define USER_HZ 100 /* User interfaces are in "ticks" */
16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
17#else
18# define HZ 100
19#endif
20
21#define EXEC_PAGESIZE 4096
22
23#ifndef NOGROUP
24#define NOGROUP (-1)
25#endif
26
27/* max length of hostname */
28#define MAXHOSTNAMELEN 64
29
30#endif
31
diff --git a/arch/arm/include/asm/parport.h b/arch/arm/include/asm/parport.h
new file mode 100644
index 000000000000..26e94b09035a
--- /dev/null
+++ b/arch/arm/include/asm/parport.h
@@ -0,0 +1,18 @@
1/*
2 * arch/arm/include/asm/parport.h: ARM-specific parport initialisation
3 *
4 * Copyright (C) 1999, 2000 Tim Waugh <tim@cyberelk.demon.co.uk>
5 *
6 * This file should only be included by drivers/parport/parport_pc.c.
7 */
8
9#ifndef __ASMARM_PARPORT_H
10#define __ASMARM_PARPORT_H
11
12static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma);
13static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
14{
15 return parport_pc_find_isa_ports (autoirq, autodma);
16}
17
18#endif /* !(_ASMARM_PARPORT_H) */
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
new file mode 100644
index 000000000000..721c03d53f4b
--- /dev/null
+++ b/arch/arm/include/asm/pci.h
@@ -0,0 +1,91 @@
1#ifndef ASMARM_PCI_H
2#define ASMARM_PCI_H
3
4#ifdef __KERNEL__
5#include <asm-generic/pci-dma-compat.h>
6
7#include <mach/hardware.h> /* for PCIBIOS_MIN_* */
8
9#define pcibios_scan_all_fns(a, b) 0
10
11#ifdef CONFIG_PCI_HOST_ITE8152
12/* ITE bridge requires setting latency timer to avoid early bus access
13 termination by PIC bus mater devices
14*/
15extern void pcibios_set_master(struct pci_dev *dev);
16#else
17static inline void pcibios_set_master(struct pci_dev *dev)
18{
19 /* No special bus mastering setup handling */
20}
21#endif
22
23static inline void pcibios_penalize_isa_irq(int irq, int active)
24{
25 /* We don't do dynamic PCI IRQ allocation */
26}
27
28/*
29 * The PCI address space does equal the physical memory address space.
30 * The networking and block device layers use this boolean for bounce
31 * buffer decisions.
32 */
33#define PCI_DMA_BUS_IS_PHYS (0)
34
35/*
36 * Whether pci_unmap_{single,page} is a nop depends upon the
37 * configuration.
38 */
39#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
40#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME;
41#define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
42#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
43#define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
44#define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
45
46#ifdef CONFIG_PCI
47static inline void pci_dma_burst_advice(struct pci_dev *pdev,
48 enum pci_dma_burst_strategy *strat,
49 unsigned long *strategy_parameter)
50{
51 *strat = PCI_DMA_BURST_INFINITY;
52 *strategy_parameter = ~0UL;
53}
54#endif
55
56#define HAVE_PCI_MMAP
57extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
58 enum pci_mmap_state mmap_state, int write_combine);
59
60extern void
61pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
62 struct resource *res);
63
64extern void
65pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
66 struct pci_bus_region *region);
67
68static inline struct resource *
69pcibios_select_root(struct pci_dev *pdev, struct resource *res)
70{
71 struct resource *root = NULL;
72
73 if (res->flags & IORESOURCE_IO)
74 root = &ioport_resource;
75 if (res->flags & IORESOURCE_MEM)
76 root = &iomem_resource;
77
78 return root;
79}
80
81/*
82 * Dummy implementation; always return 0.
83 */
84static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
85{
86 return 0;
87}
88
89#endif /* __KERNEL__ */
90
91#endif
diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h
new file mode 100644
index 000000000000..b4e32d8ec072
--- /dev/null
+++ b/arch/arm/include/asm/percpu.h
@@ -0,0 +1,6 @@
1#ifndef __ARM_PERCPU
2#define __ARM_PERCPU
3
4#include <asm-generic/percpu.h>
5
6#endif
diff --git a/arch/arm/include/asm/pgalloc.h b/arch/arm/include/asm/pgalloc.h
new file mode 100644
index 000000000000..3dcd64bf1824
--- /dev/null
+++ b/arch/arm/include/asm/pgalloc.h
@@ -0,0 +1,136 @@
1/*
2 * arch/arm/include/asm/pgalloc.h
3 *
4 * Copyright (C) 2000-2001 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _ASMARM_PGALLOC_H
11#define _ASMARM_PGALLOC_H
12
13#include <asm/domain.h>
14#include <asm/pgtable-hwdef.h>
15#include <asm/processor.h>
16#include <asm/cacheflush.h>
17#include <asm/tlbflush.h>
18
19#define check_pgt_cache() do { } while (0)
20
21#ifdef CONFIG_MMU
22
23#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER))
24#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_KERNEL))
25
26/*
27 * Since we have only two-level page tables, these are trivial
28 */
29#define pmd_alloc_one(mm,addr) ({ BUG(); ((pmd_t *)2); })
30#define pmd_free(mm, pmd) do { } while (0)
31#define pgd_populate(mm,pmd,pte) BUG()
32
33extern pgd_t *get_pgd_slow(struct mm_struct *mm);
34extern void free_pgd_slow(struct mm_struct *mm, pgd_t *pgd);
35
36#define pgd_alloc(mm) get_pgd_slow(mm)
37#define pgd_free(mm, pgd) free_pgd_slow(mm, pgd)
38
39/*
40 * Allocate one PTE table.
41 *
42 * This actually allocates two hardware PTE tables, but we wrap this up
43 * into one table thus:
44 *
45 * +------------+
46 * | h/w pt 0 |
47 * +------------+
48 * | h/w pt 1 |
49 * +------------+
50 * | Linux pt 0 |
51 * +------------+
52 * | Linux pt 1 |
53 * +------------+
54 */
55static inline pte_t *
56pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
57{
58 pte_t *pte;
59
60 pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
61 if (pte) {
62 clean_dcache_area(pte, sizeof(pte_t) * PTRS_PER_PTE);
63 pte += PTRS_PER_PTE;
64 }
65
66 return pte;
67}
68
69static inline pgtable_t
70pte_alloc_one(struct mm_struct *mm, unsigned long addr)
71{
72 struct page *pte;
73
74 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
75 if (pte) {
76 void *page = page_address(pte);
77 clean_dcache_area(page, sizeof(pte_t) * PTRS_PER_PTE);
78 pgtable_page_ctor(pte);
79 }
80
81 return pte;
82}
83
84/*
85 * Free one PTE table.
86 */
87static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
88{
89 if (pte) {
90 pte -= PTRS_PER_PTE;
91 free_page((unsigned long)pte);
92 }
93}
94
95static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
96{
97 pgtable_page_dtor(pte);
98 __free_page(pte);
99}
100
101static inline void __pmd_populate(pmd_t *pmdp, unsigned long pmdval)
102{
103 pmdp[0] = __pmd(pmdval);
104 pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t));
105 flush_pmd_entry(pmdp);
106}
107
108/*
109 * Populate the pmdp entry with a pointer to the pte. This pmd is part
110 * of the mm address space.
111 *
112 * Ensure that we always set both PMD entries.
113 */
114static inline void
115pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
116{
117 unsigned long pte_ptr = (unsigned long)ptep;
118
119 /*
120 * The pmd must be loaded with the physical
121 * address of the PTE table
122 */
123 pte_ptr -= PTRS_PER_PTE * sizeof(void *);
124 __pmd_populate(pmdp, __pa(pte_ptr) | _PAGE_KERNEL_TABLE);
125}
126
127static inline void
128pmd_populate(struct mm_struct *mm, pmd_t *pmdp, pgtable_t ptep)
129{
130 __pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE);
131}
132#define pmd_pgtable(pmd) pmd_page(pmd)
133
134#endif /* CONFIG_MMU */
135
136#endif
diff --git a/arch/arm/include/asm/pgtable-hwdef.h b/arch/arm/include/asm/pgtable-hwdef.h
new file mode 100644
index 000000000000..fd1521d5cb9d
--- /dev/null
+++ b/arch/arm/include/asm/pgtable-hwdef.h
@@ -0,0 +1,90 @@
1/*
2 * arch/arm/include/asm/pgtable-hwdef.h
3 *
4 * Copyright (C) 1995-2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _ASMARM_PGTABLE_HWDEF_H
11#define _ASMARM_PGTABLE_HWDEF_H
12
13/*
14 * Hardware page table definitions.
15 *
16 * + Level 1 descriptor (PMD)
17 * - common
18 */
19#define PMD_TYPE_MASK (3 << 0)
20#define PMD_TYPE_FAULT (0 << 0)
21#define PMD_TYPE_TABLE (1 << 0)
22#define PMD_TYPE_SECT (2 << 0)
23#define PMD_BIT4 (1 << 4)
24#define PMD_DOMAIN(x) ((x) << 5)
25#define PMD_PROTECTION (1 << 9) /* v5 */
26/*
27 * - section
28 */
29#define PMD_SECT_BUFFERABLE (1 << 2)
30#define PMD_SECT_CACHEABLE (1 << 3)
31#define PMD_SECT_XN (1 << 4) /* v6 */
32#define PMD_SECT_AP_WRITE (1 << 10)
33#define PMD_SECT_AP_READ (1 << 11)
34#define PMD_SECT_TEX(x) ((x) << 12) /* v5 */
35#define PMD_SECT_APX (1 << 15) /* v6 */
36#define PMD_SECT_S (1 << 16) /* v6 */
37#define PMD_SECT_nG (1 << 17) /* v6 */
38#define PMD_SECT_SUPER (1 << 18) /* v6 */
39
40#define PMD_SECT_UNCACHED (0)
41#define PMD_SECT_BUFFERED (PMD_SECT_BUFFERABLE)
42#define PMD_SECT_WT (PMD_SECT_CACHEABLE)
43#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
44#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE)
45#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
46#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2))
47
48/*
49 * - coarse table (not used)
50 */
51
52/*
53 * + Level 2 descriptor (PTE)
54 * - common
55 */
56#define PTE_TYPE_MASK (3 << 0)
57#define PTE_TYPE_FAULT (0 << 0)
58#define PTE_TYPE_LARGE (1 << 0)
59#define PTE_TYPE_SMALL (2 << 0)
60#define PTE_TYPE_EXT (3 << 0) /* v5 */
61#define PTE_BUFFERABLE (1 << 2)
62#define PTE_CACHEABLE (1 << 3)
63
64/*
65 * - extended small page/tiny page
66 */
67#define PTE_EXT_XN (1 << 0) /* v6 */
68#define PTE_EXT_AP_MASK (3 << 4)
69#define PTE_EXT_AP0 (1 << 4)
70#define PTE_EXT_AP1 (2 << 4)
71#define PTE_EXT_AP_UNO_SRO (0 << 4)
72#define PTE_EXT_AP_UNO_SRW (PTE_EXT_AP0)
73#define PTE_EXT_AP_URO_SRW (PTE_EXT_AP1)
74#define PTE_EXT_AP_URW_SRW (PTE_EXT_AP1|PTE_EXT_AP0)
75#define PTE_EXT_TEX(x) ((x) << 6) /* v5 */
76#define PTE_EXT_APX (1 << 9) /* v6 */
77#define PTE_EXT_COHERENT (1 << 9) /* XScale3 */
78#define PTE_EXT_SHARED (1 << 10) /* v6 */
79#define PTE_EXT_NG (1 << 11) /* v6 */
80
81/*
82 * - small page
83 */
84#define PTE_SMALL_AP_MASK (0xff << 4)
85#define PTE_SMALL_AP_UNO_SRO (0x00 << 4)
86#define PTE_SMALL_AP_UNO_SRW (0x55 << 4)
87#define PTE_SMALL_AP_URO_SRW (0xaa << 4)
88#define PTE_SMALL_AP_URW_SRW (0xff << 4)
89
90#endif
diff --git a/arch/arm/include/asm/pgtable-nommu.h b/arch/arm/include/asm/pgtable-nommu.h
new file mode 100644
index 000000000000..b011f2e939aa
--- /dev/null
+++ b/arch/arm/include/asm/pgtable-nommu.h
@@ -0,0 +1,118 @@
1/*
2 * arch/arm/include/asm/pgtable-nommu.h
3 *
4 * Copyright (C) 1995-2002 Russell King
5 * Copyright (C) 2004 Hyok S. Choi
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#ifndef _ASMARM_PGTABLE_NOMMU_H
12#define _ASMARM_PGTABLE_NOMMU_H
13
14#ifndef __ASSEMBLY__
15
16#include <linux/slab.h>
17#include <asm/processor.h>
18#include <asm/page.h>
19
20/*
21 * Trivial page table functions.
22 */
23#define pgd_present(pgd) (1)
24#define pgd_none(pgd) (0)
25#define pgd_bad(pgd) (0)
26#define pgd_clear(pgdp)
27#define kern_addr_valid(addr) (1)
28#define pmd_offset(a, b) ((void *)0)
29/* FIXME */
30/*
31 * PMD_SHIFT determines the size of the area a second-level page table can map
32 * PGDIR_SHIFT determines what a third-level page table entry can map
33 */
34#define PGDIR_SHIFT 21
35
36#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
37#define PGDIR_MASK (~(PGDIR_SIZE-1))
38/* FIXME */
39
40#define PAGE_NONE __pgprot(0)
41#define PAGE_SHARED __pgprot(0)
42#define PAGE_COPY __pgprot(0)
43#define PAGE_READONLY __pgprot(0)
44#define PAGE_KERNEL __pgprot(0)
45
46#define swapper_pg_dir ((pgd_t *) 0)
47
48#define __swp_type(x) (0)
49#define __swp_offset(x) (0)
50#define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
51#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
52#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
53
54
55typedef pte_t *pte_addr_t;
56
57static inline int pte_file(pte_t pte) { return 0; }
58
59/*
60 * ZERO_PAGE is a global shared page that is always zero: used
61 * for zero-mapped memory areas etc..
62 */
63#define ZERO_PAGE(vaddr) (virt_to_page(0))
64
65/*
66 * Mark the prot value as uncacheable and unbufferable.
67 */
68#define pgprot_noncached(prot) __pgprot(0)
69#define pgprot_writecombine(prot) __pgprot(0)
70
71
72/*
73 * These would be in other places but having them here reduces the diffs.
74 */
75extern unsigned int kobjsize(const void *objp);
76
77/*
78 * No page table caches to initialise.
79 */
80#define pgtable_cache_init() do { } while (0)
81#define io_remap_page_range remap_page_range
82#define io_remap_pfn_range remap_pfn_range
83
84
85/*
86 * All 32bit addresses are effectively valid for vmalloc...
87 * Sort of meaningless for non-VM targets.
88 */
89#define VMALLOC_START 0
90#define VMALLOC_END 0xffffffff
91
92#define FIRST_USER_ADDRESS (0)
93
94#include <asm-generic/pgtable.h>
95
96#else
97
98/*
99 * dummy tlb and user structures.
100 */
101#define v3_tlb_fns (0)
102#define v4_tlb_fns (0)
103#define v4wb_tlb_fns (0)
104#define v4wbi_tlb_fns (0)
105#define v6wbi_tlb_fns (0)
106#define v7wbi_tlb_fns (0)
107
108#define v3_user_fns (0)
109#define v4_user_fns (0)
110#define v4_mc_user_fns (0)
111#define v4wb_user_fns (0)
112#define v4wt_user_fns (0)
113#define v6_user_fns (0)
114#define xscale_mc_user_fns (0)
115
116#endif /*__ASSEMBLY__*/
117
118#endif /* _ASMARM_PGTABLE_H */
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
new file mode 100644
index 000000000000..8e21ef15bd74
--- /dev/null
+++ b/arch/arm/include/asm/pgtable.h
@@ -0,0 +1,401 @@
1/*
2 * arch/arm/include/asm/pgtable.h
3 *
4 * Copyright (C) 1995-2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _ASMARM_PGTABLE_H
11#define _ASMARM_PGTABLE_H
12
13#include <asm-generic/4level-fixup.h>
14#include <asm/proc-fns.h>
15
16#ifndef CONFIG_MMU
17
18#include "pgtable-nommu.h"
19
20#else
21
22#include <asm/memory.h>
23#include <mach/vmalloc.h>
24#include <asm/pgtable-hwdef.h>
25
26/*
27 * Just any arbitrary offset to the start of the vmalloc VM area: the
28 * current 8MB value just means that there will be a 8MB "hole" after the
29 * physical memory until the kernel virtual memory starts. That means that
30 * any out-of-bounds memory accesses will hopefully be caught.
31 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
32 * area for the same reason. ;)
33 *
34 * Note that platforms may override VMALLOC_START, but they must provide
35 * VMALLOC_END. VMALLOC_END defines the (exclusive) limit of this space,
36 * which may not overlap IO space.
37 */
38#ifndef VMALLOC_START
39#define VMALLOC_OFFSET (8*1024*1024)
40#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
41#endif
42
43/*
44 * Hardware-wise, we have a two level page table structure, where the first
45 * level has 4096 entries, and the second level has 256 entries. Each entry
46 * is one 32-bit word. Most of the bits in the second level entry are used
47 * by hardware, and there aren't any "accessed" and "dirty" bits.
48 *
49 * Linux on the other hand has a three level page table structure, which can
50 * be wrapped to fit a two level page table structure easily - using the PGD
51 * and PTE only. However, Linux also expects one "PTE" table per page, and
52 * at least a "dirty" bit.
53 *
54 * Therefore, we tweak the implementation slightly - we tell Linux that we
55 * have 2048 entries in the first level, each of which is 8 bytes (iow, two
56 * hardware pointers to the second level.) The second level contains two
57 * hardware PTE tables arranged contiguously, followed by Linux versions
58 * which contain the state information Linux needs. We, therefore, end up
59 * with 512 entries in the "PTE" level.
60 *
61 * This leads to the page tables having the following layout:
62 *
63 * pgd pte
64 * | |
65 * +--------+ +0
66 * | |-----> +------------+ +0
67 * +- - - - + +4 | h/w pt 0 |
68 * | |-----> +------------+ +1024
69 * +--------+ +8 | h/w pt 1 |
70 * | | +------------+ +2048
71 * +- - - - + | Linux pt 0 |
72 * | | +------------+ +3072
73 * +--------+ | Linux pt 1 |
74 * | | +------------+ +4096
75 *
76 * See L_PTE_xxx below for definitions of bits in the "Linux pt", and
77 * PTE_xxx for definitions of bits appearing in the "h/w pt".
78 *
79 * PMD_xxx definitions refer to bits in the first level page table.
80 *
81 * The "dirty" bit is emulated by only granting hardware write permission
82 * iff the page is marked "writable" and "dirty" in the Linux PTE. This
83 * means that a write to a clean page will cause a permission fault, and
84 * the Linux MM layer will mark the page dirty via handle_pte_fault().
85 * For the hardware to notice the permission change, the TLB entry must
86 * be flushed, and ptep_set_access_flags() does that for us.
87 *
88 * The "accessed" or "young" bit is emulated by a similar method; we only
89 * allow accesses to the page if the "young" bit is set. Accesses to the
90 * page will cause a fault, and handle_pte_fault() will set the young bit
91 * for us as long as the page is marked present in the corresponding Linux
92 * PTE entry. Again, ptep_set_access_flags() will ensure that the TLB is
93 * up to date.
94 *
95 * However, when the "young" bit is cleared, we deny access to the page
96 * by clearing the hardware PTE. Currently Linux does not flush the TLB
97 * for us in this case, which means the TLB will retain the transation
98 * until either the TLB entry is evicted under pressure, or a context
99 * switch which changes the user space mapping occurs.
100 */
101#define PTRS_PER_PTE 512
102#define PTRS_PER_PMD 1
103#define PTRS_PER_PGD 2048
104
105/*
106 * PMD_SHIFT determines the size of the area a second-level page table can map
107 * PGDIR_SHIFT determines what a third-level page table entry can map
108 */
109#define PMD_SHIFT 21
110#define PGDIR_SHIFT 21
111
112#define LIBRARY_TEXT_START 0x0c000000
113
114#ifndef __ASSEMBLY__
115extern void __pte_error(const char *file, int line, unsigned long val);
116extern void __pmd_error(const char *file, int line, unsigned long val);
117extern void __pgd_error(const char *file, int line, unsigned long val);
118
119#define pte_ERROR(pte) __pte_error(__FILE__, __LINE__, pte_val(pte))
120#define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd_val(pmd))
121#define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd_val(pgd))
122#endif /* !__ASSEMBLY__ */
123
124#define PMD_SIZE (1UL << PMD_SHIFT)
125#define PMD_MASK (~(PMD_SIZE-1))
126#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
127#define PGDIR_MASK (~(PGDIR_SIZE-1))
128
129/*
130 * This is the lowest virtual address we can permit any user space
131 * mapping to be mapped at. This is particularly important for
132 * non-high vector CPUs.
133 */
134#define FIRST_USER_ADDRESS PAGE_SIZE
135
136#define FIRST_USER_PGD_NR 1
137#define USER_PTRS_PER_PGD ((TASK_SIZE/PGDIR_SIZE) - FIRST_USER_PGD_NR)
138
139/*
140 * section address mask and size definitions.
141 */
142#define SECTION_SHIFT 20
143#define SECTION_SIZE (1UL << SECTION_SHIFT)
144#define SECTION_MASK (~(SECTION_SIZE-1))
145
146/*
147 * ARMv6 supersection address mask and size definitions.
148 */
149#define SUPERSECTION_SHIFT 24
150#define SUPERSECTION_SIZE (1UL << SUPERSECTION_SHIFT)
151#define SUPERSECTION_MASK (~(SUPERSECTION_SIZE-1))
152
153/*
154 * "Linux" PTE definitions.
155 *
156 * We keep two sets of PTEs - the hardware and the linux version.
157 * This allows greater flexibility in the way we map the Linux bits
158 * onto the hardware tables, and allows us to have YOUNG and DIRTY
159 * bits.
160 *
161 * The PTE table pointer refers to the hardware entries; the "Linux"
162 * entries are stored 1024 bytes below.
163 */
164#define L_PTE_PRESENT (1 << 0)
165#define L_PTE_FILE (1 << 1) /* only when !PRESENT */
166#define L_PTE_YOUNG (1 << 1)
167#define L_PTE_BUFFERABLE (1 << 2) /* matches PTE */
168#define L_PTE_CACHEABLE (1 << 3) /* matches PTE */
169#define L_PTE_USER (1 << 4)
170#define L_PTE_WRITE (1 << 5)
171#define L_PTE_EXEC (1 << 6)
172#define L_PTE_DIRTY (1 << 7)
173#define L_PTE_SHARED (1 << 10) /* shared(v6), coherent(xsc3) */
174
175#ifndef __ASSEMBLY__
176
177/*
178 * The pgprot_* and protection_map entries will be fixed up in runtime
179 * to include the cachable and bufferable bits based on memory policy,
180 * as well as any architecture dependent bits like global/ASID and SMP
181 * shared mapping bits.
182 */
183#define _L_PTE_DEFAULT L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_CACHEABLE | L_PTE_BUFFERABLE
184#define _L_PTE_READ L_PTE_USER | L_PTE_EXEC
185
186extern pgprot_t pgprot_user;
187extern pgprot_t pgprot_kernel;
188
189#define PAGE_NONE pgprot_user
190#define PAGE_COPY __pgprot(pgprot_val(pgprot_user) | _L_PTE_READ)
191#define PAGE_SHARED __pgprot(pgprot_val(pgprot_user) | _L_PTE_READ | \
192 L_PTE_WRITE)
193#define PAGE_READONLY __pgprot(pgprot_val(pgprot_user) | _L_PTE_READ)
194#define PAGE_KERNEL pgprot_kernel
195
196#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT)
197#define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ)
198#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_WRITE)
199#define __PAGE_READONLY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ)
200
201#endif /* __ASSEMBLY__ */
202
203/*
204 * The table below defines the page protection levels that we insert into our
205 * Linux page table version. These get translated into the best that the
206 * architecture can perform. Note that on most ARM hardware:
207 * 1) We cannot do execute protection
208 * 2) If we could do execute protection, then read is implied
209 * 3) write implies read permissions
210 */
211#define __P000 __PAGE_NONE
212#define __P001 __PAGE_READONLY
213#define __P010 __PAGE_COPY
214#define __P011 __PAGE_COPY
215#define __P100 __PAGE_READONLY
216#define __P101 __PAGE_READONLY
217#define __P110 __PAGE_COPY
218#define __P111 __PAGE_COPY
219
220#define __S000 __PAGE_NONE
221#define __S001 __PAGE_READONLY
222#define __S010 __PAGE_SHARED
223#define __S011 __PAGE_SHARED
224#define __S100 __PAGE_READONLY
225#define __S101 __PAGE_READONLY
226#define __S110 __PAGE_SHARED
227#define __S111 __PAGE_SHARED
228
229#ifndef __ASSEMBLY__
230/*
231 * ZERO_PAGE is a global shared page that is always zero: used
232 * for zero-mapped memory areas etc..
233 */
234extern struct page *empty_zero_page;
235#define ZERO_PAGE(vaddr) (empty_zero_page)
236
237#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)
238#define pfn_pte(pfn,prot) (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
239
240#define pte_none(pte) (!pte_val(pte))
241#define pte_clear(mm,addr,ptep) set_pte_ext(ptep, __pte(0), 0)
242#define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
243#define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
244#define pte_offset_map(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
245#define pte_offset_map_nested(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
246#define pte_unmap(pte) do { } while (0)
247#define pte_unmap_nested(pte) do { } while (0)
248
249#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext)
250
251#define set_pte_at(mm,addr,ptep,pteval) do { \
252 set_pte_ext(ptep, pteval, (addr) >= TASK_SIZE ? 0 : PTE_EXT_NG); \
253 } while (0)
254
255/*
256 * The following only work if pte_present() is true.
257 * Undefined behaviour if not..
258 */
259#define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT)
260#define pte_write(pte) (pte_val(pte) & L_PTE_WRITE)
261#define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY)
262#define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG)
263#define pte_special(pte) (0)
264
265/*
266 * The following only works if pte_present() is not true.
267 */
268#define pte_file(pte) (pte_val(pte) & L_PTE_FILE)
269#define pte_to_pgoff(x) (pte_val(x) >> 2)
270#define pgoff_to_pte(x) __pte(((x) << 2) | L_PTE_FILE)
271
272#define PTE_FILE_MAX_BITS 30
273
274#define PTE_BIT_FUNC(fn,op) \
275static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; }
276
277PTE_BIT_FUNC(wrprotect, &= ~L_PTE_WRITE);
278PTE_BIT_FUNC(mkwrite, |= L_PTE_WRITE);
279PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY);
280PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY);
281PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG);
282PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG);
283
284static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
285
286/*
287 * Mark the prot value as uncacheable and unbufferable.
288 */
289#define pgprot_noncached(prot) __pgprot(pgprot_val(prot) & ~(L_PTE_CACHEABLE | L_PTE_BUFFERABLE))
290#define pgprot_writecombine(prot) __pgprot(pgprot_val(prot) & ~L_PTE_CACHEABLE)
291
292#define pmd_none(pmd) (!pmd_val(pmd))
293#define pmd_present(pmd) (pmd_val(pmd))
294#define pmd_bad(pmd) (pmd_val(pmd) & 2)
295
296#define copy_pmd(pmdpd,pmdps) \
297 do { \
298 pmdpd[0] = pmdps[0]; \
299 pmdpd[1] = pmdps[1]; \
300 flush_pmd_entry(pmdpd); \
301 } while (0)
302
303#define pmd_clear(pmdp) \
304 do { \
305 pmdp[0] = __pmd(0); \
306 pmdp[1] = __pmd(0); \
307 clean_pmd_entry(pmdp); \
308 } while (0)
309
310static inline pte_t *pmd_page_vaddr(pmd_t pmd)
311{
312 unsigned long ptr;
313
314 ptr = pmd_val(pmd) & ~(PTRS_PER_PTE * sizeof(void *) - 1);
315 ptr += PTRS_PER_PTE * sizeof(void *);
316
317 return __va(ptr);
318}
319
320#define pmd_page(pmd) virt_to_page(__va(pmd_val(pmd)))
321
322/*
323 * Permanent address of a page. We never have highmem, so this is trivial.
324 */
325#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT))
326
327/*
328 * Conversion functions: convert a page and protection to a page entry,
329 * and a page entry and page directory to the page they refer to.
330 */
331#define mk_pte(page,prot) pfn_pte(page_to_pfn(page),prot)
332
333/*
334 * The "pgd_xxx()" functions here are trivial for a folded two-level
335 * setup: the pgd is never bad, and a pmd always exists (as it's folded
336 * into the pgd entry)
337 */
338#define pgd_none(pgd) (0)
339#define pgd_bad(pgd) (0)
340#define pgd_present(pgd) (1)
341#define pgd_clear(pgdp) do { } while (0)
342#define set_pgd(pgd,pgdp) do { } while (0)
343
344/* to find an entry in a page-table-directory */
345#define pgd_index(addr) ((addr) >> PGDIR_SHIFT)
346
347#define pgd_offset(mm, addr) ((mm)->pgd+pgd_index(addr))
348
349/* to find an entry in a kernel page-table-directory */
350#define pgd_offset_k(addr) pgd_offset(&init_mm, addr)
351
352/* Find an entry in the second-level page table.. */
353#define pmd_offset(dir, addr) ((pmd_t *)(dir))
354
355/* Find an entry in the third-level page table.. */
356#define __pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
357
358static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
359{
360 const unsigned long mask = L_PTE_EXEC | L_PTE_WRITE | L_PTE_USER;
361 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
362 return pte;
363}
364
365extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
366
367/* Encode and decode a swap entry.
368 *
369 * We support up to 32GB of swap on 4k machines
370 */
371#define __swp_type(x) (((x).val >> 2) & 0x7f)
372#define __swp_offset(x) ((x).val >> 9)
373#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 9) })
374#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
375#define __swp_entry_to_pte(swp) ((pte_t) { (swp).val })
376
377/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
378/* FIXME: this is not correct */
379#define kern_addr_valid(addr) (1)
380
381#include <asm-generic/pgtable.h>
382
383/*
384 * We provide our own arch_get_unmapped_area to cope with VIPT caches.
385 */
386#define HAVE_ARCH_UNMAPPED_AREA
387
388/*
389 * remap a physical page `pfn' of size `size' with page protection `prot'
390 * into virtual address `from'
391 */
392#define io_remap_pfn_range(vma,from,pfn,size,prot) \
393 remap_pfn_range(vma, from, pfn, size, prot)
394
395#define pgtable_cache_init() do { } while (0)
396
397#endif /* !__ASSEMBLY__ */
398
399#endif /* CONFIG_MMU */
400
401#endif /* _ASMARM_PGTABLE_H */
diff --git a/arch/arm/include/asm/poll.h b/arch/arm/include/asm/poll.h
new file mode 100644
index 000000000000..c98509d3149e
--- /dev/null
+++ b/arch/arm/include/asm/poll.h
@@ -0,0 +1 @@
#include <asm-generic/poll.h>
diff --git a/arch/arm/include/asm/posix_types.h b/arch/arm/include/asm/posix_types.h
new file mode 100644
index 000000000000..2446d23bfdbf
--- /dev/null
+++ b/arch/arm/include/asm/posix_types.h
@@ -0,0 +1,77 @@
1/*
2 * arch/arm/include/asm/posix_types.h
3 *
4 * Copyright (C) 1996-1998 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Changelog:
11 * 27-06-1996 RMK Created
12 */
13#ifndef __ARCH_ARM_POSIX_TYPES_H
14#define __ARCH_ARM_POSIX_TYPES_H
15
16/*
17 * This file is generally used by user-level software, so you need to
18 * be a little careful about namespace pollution etc. Also, we cannot
19 * assume GCC is being used.
20 */
21
22typedef unsigned long __kernel_ino_t;
23typedef unsigned short __kernel_mode_t;
24typedef unsigned short __kernel_nlink_t;
25typedef long __kernel_off_t;
26typedef int __kernel_pid_t;
27typedef unsigned short __kernel_ipc_pid_t;
28typedef unsigned short __kernel_uid_t;
29typedef unsigned short __kernel_gid_t;
30typedef unsigned int __kernel_size_t;
31typedef int __kernel_ssize_t;
32typedef int __kernel_ptrdiff_t;
33typedef long __kernel_time_t;
34typedef long __kernel_suseconds_t;
35typedef long __kernel_clock_t;
36typedef int __kernel_timer_t;
37typedef int __kernel_clockid_t;
38typedef int __kernel_daddr_t;
39typedef char * __kernel_caddr_t;
40typedef unsigned short __kernel_uid16_t;
41typedef unsigned short __kernel_gid16_t;
42typedef unsigned int __kernel_uid32_t;
43typedef unsigned int __kernel_gid32_t;
44
45typedef unsigned short __kernel_old_uid_t;
46typedef unsigned short __kernel_old_gid_t;
47typedef unsigned short __kernel_old_dev_t;
48
49#ifdef __GNUC__
50typedef long long __kernel_loff_t;
51#endif
52
53typedef struct {
54 int val[2];
55} __kernel_fsid_t;
56
57#if defined(__KERNEL__)
58
59#undef __FD_SET
60#define __FD_SET(fd, fdsetp) \
61 (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] |= (1<<((fd) & 31)))
62
63#undef __FD_CLR
64#define __FD_CLR(fd, fdsetp) \
65 (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] &= ~(1<<((fd) & 31)))
66
67#undef __FD_ISSET
68#define __FD_ISSET(fd, fdsetp) \
69 ((((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] & (1<<((fd) & 31))) != 0)
70
71#undef __FD_ZERO
72#define __FD_ZERO(fdsetp) \
73 (memset (fdsetp, 0, sizeof (*(fd_set *)(fdsetp))))
74
75#endif
76
77#endif
diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h
new file mode 100644
index 000000000000..db80203b68e0
--- /dev/null
+++ b/arch/arm/include/asm/proc-fns.h
@@ -0,0 +1,241 @@
1/*
2 * arch/arm/include/asm/proc-fns.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
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#ifndef __ASM_PROCFNS_H
12#define __ASM_PROCFNS_H
13
14#ifdef __KERNEL__
15
16
17/*
18 * Work out if we need multiple CPU support
19 */
20#undef MULTI_CPU
21#undef CPU_NAME
22
23/*
24 * CPU_NAME - the prefix for CPU related functions
25 */
26
27#ifdef CONFIG_CPU_32
28# ifdef CONFIG_CPU_ARM610
29# ifdef CPU_NAME
30# undef MULTI_CPU
31# define MULTI_CPU
32# else
33# define CPU_NAME cpu_arm6
34# endif
35# endif
36# ifdef CONFIG_CPU_ARM7TDMI
37# ifdef CPU_NAME
38# undef MULTI_CPU
39# define MULTI_CPU
40# else
41# define CPU_NAME cpu_arm7tdmi
42# endif
43# endif
44# ifdef CONFIG_CPU_ARM710
45# ifdef CPU_NAME
46# undef MULTI_CPU
47# define MULTI_CPU
48# else
49# define CPU_NAME cpu_arm7
50# endif
51# endif
52# ifdef CONFIG_CPU_ARM720T
53# ifdef CPU_NAME
54# undef MULTI_CPU
55# define MULTI_CPU
56# else
57# define CPU_NAME cpu_arm720
58# endif
59# endif
60# ifdef CONFIG_CPU_ARM740T
61# ifdef CPU_NAME
62# undef MULTI_CPU
63# define MULTI_CPU
64# else
65# define CPU_NAME cpu_arm740
66# endif
67# endif
68# ifdef CONFIG_CPU_ARM9TDMI
69# ifdef CPU_NAME
70# undef MULTI_CPU
71# define MULTI_CPU
72# else
73# define CPU_NAME cpu_arm9tdmi
74# endif
75# endif
76# ifdef CONFIG_CPU_ARM920T
77# ifdef CPU_NAME
78# undef MULTI_CPU
79# define MULTI_CPU
80# else
81# define CPU_NAME cpu_arm920
82# endif
83# endif
84# ifdef CONFIG_CPU_ARM922T
85# ifdef CPU_NAME
86# undef MULTI_CPU
87# define MULTI_CPU
88# else
89# define CPU_NAME cpu_arm922
90# endif
91# endif
92# ifdef CONFIG_CPU_ARM925T
93# ifdef CPU_NAME
94# undef MULTI_CPU
95# define MULTI_CPU
96# else
97# define CPU_NAME cpu_arm925
98# endif
99# endif
100# ifdef CONFIG_CPU_ARM926T
101# ifdef CPU_NAME
102# undef MULTI_CPU
103# define MULTI_CPU
104# else
105# define CPU_NAME cpu_arm926
106# endif
107# endif
108# ifdef CONFIG_CPU_ARM940T
109# ifdef CPU_NAME
110# undef MULTI_CPU
111# define MULTI_CPU
112# else
113# define CPU_NAME cpu_arm940
114# endif
115# endif
116# ifdef CONFIG_CPU_ARM946E
117# ifdef CPU_NAME
118# undef MULTI_CPU
119# define MULTI_CPU
120# else
121# define CPU_NAME cpu_arm946
122# endif
123# endif
124# ifdef CONFIG_CPU_SA110
125# ifdef CPU_NAME
126# undef MULTI_CPU
127# define MULTI_CPU
128# else
129# define CPU_NAME cpu_sa110
130# endif
131# endif
132# ifdef CONFIG_CPU_SA1100
133# ifdef CPU_NAME
134# undef MULTI_CPU
135# define MULTI_CPU
136# else
137# define CPU_NAME cpu_sa1100
138# endif
139# endif
140# ifdef CONFIG_CPU_ARM1020
141# ifdef CPU_NAME
142# undef MULTI_CPU
143# define MULTI_CPU
144# else
145# define CPU_NAME cpu_arm1020
146# endif
147# endif
148# ifdef CONFIG_CPU_ARM1020E
149# ifdef CPU_NAME
150# undef MULTI_CPU
151# define MULTI_CPU
152# else
153# define CPU_NAME cpu_arm1020e
154# endif
155# endif
156# ifdef CONFIG_CPU_ARM1022
157# ifdef CPU_NAME
158# undef MULTI_CPU
159# define MULTI_CPU
160# else
161# define CPU_NAME cpu_arm1022
162# endif
163# endif
164# ifdef CONFIG_CPU_ARM1026
165# ifdef CPU_NAME
166# undef MULTI_CPU
167# define MULTI_CPU
168# else
169# define CPU_NAME cpu_arm1026
170# endif
171# endif
172# ifdef CONFIG_CPU_XSCALE
173# ifdef CPU_NAME
174# undef MULTI_CPU
175# define MULTI_CPU
176# else
177# define CPU_NAME cpu_xscale
178# endif
179# endif
180# ifdef CONFIG_CPU_XSC3
181# ifdef CPU_NAME
182# undef MULTI_CPU
183# define MULTI_CPU
184# else
185# define CPU_NAME cpu_xsc3
186# endif
187# endif
188# ifdef CONFIG_CPU_FEROCEON
189# ifdef CPU_NAME
190# undef MULTI_CPU
191# define MULTI_CPU
192# else
193# define CPU_NAME cpu_feroceon
194# endif
195# endif
196# ifdef CONFIG_CPU_V6
197# ifdef CPU_NAME
198# undef MULTI_CPU
199# define MULTI_CPU
200# else
201# define CPU_NAME cpu_v6
202# endif
203# endif
204# ifdef CONFIG_CPU_V7
205# ifdef CPU_NAME
206# undef MULTI_CPU
207# define MULTI_CPU
208# else
209# define CPU_NAME cpu_v7
210# endif
211# endif
212#endif
213
214#ifndef __ASSEMBLY__
215
216#ifndef MULTI_CPU
217#include <asm/cpu-single.h>
218#else
219#include <asm/cpu-multi32.h>
220#endif
221
222#include <asm/memory.h>
223
224#ifdef CONFIG_MMU
225
226#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
227
228#define cpu_get_pgd() \
229 ({ \
230 unsigned long pg; \
231 __asm__("mrc p15, 0, %0, c2, c0, 0" \
232 : "=r" (pg) : : "cc"); \
233 pg &= ~0x3fff; \
234 (pgd_t *)phys_to_virt(pg); \
235 })
236
237#endif
238
239#endif /* __ASSEMBLY__ */
240#endif /* __KERNEL__ */
241#endif /* __ASM_PROCFNS_H */
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
new file mode 100644
index 000000000000..b01d5e7e3d5a
--- /dev/null
+++ b/arch/arm/include/asm/processor.h
@@ -0,0 +1,131 @@
1/*
2 * arch/arm/include/asm/processor.h
3 *
4 * Copyright (C) 1995-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARM_PROCESSOR_H
12#define __ASM_ARM_PROCESSOR_H
13
14/*
15 * Default implementation of macro that returns current
16 * instruction pointer ("program counter").
17 */
18#define current_text_addr() ({ __label__ _l; _l: &&_l;})
19
20#ifdef __KERNEL__
21
22#include <asm/ptrace.h>
23#include <asm/types.h>
24
25#ifdef __KERNEL__
26#define STACK_TOP ((current->personality == PER_LINUX_32BIT) ? \
27 TASK_SIZE : TASK_SIZE_26)
28#define STACK_TOP_MAX TASK_SIZE
29#endif
30
31union debug_insn {
32 u32 arm;
33 u16 thumb;
34};
35
36struct debug_entry {
37 u32 address;
38 union debug_insn insn;
39};
40
41struct debug_info {
42 int nsaved;
43 struct debug_entry bp[2];
44};
45
46struct thread_struct {
47 /* fault info */
48 unsigned long address;
49 unsigned long trap_no;
50 unsigned long error_code;
51 /* debugging */
52 struct debug_info debug;
53};
54
55#define INIT_THREAD { }
56
57#ifdef CONFIG_MMU
58#define nommu_start_thread(regs) do { } while (0)
59#else
60#define nommu_start_thread(regs) regs->ARM_r10 = current->mm->start_data
61#endif
62
63#define start_thread(regs,pc,sp) \
64({ \
65 unsigned long *stack = (unsigned long *)sp; \
66 set_fs(USER_DS); \
67 memzero(regs->uregs, sizeof(regs->uregs)); \
68 if (current->personality & ADDR_LIMIT_32BIT) \
69 regs->ARM_cpsr = USR_MODE; \
70 else \
71 regs->ARM_cpsr = USR26_MODE; \
72 if (elf_hwcap & HWCAP_THUMB && pc & 1) \
73 regs->ARM_cpsr |= PSR_T_BIT; \
74 regs->ARM_pc = pc & ~1; /* pc */ \
75 regs->ARM_sp = sp; /* sp */ \
76 regs->ARM_r2 = stack[2]; /* r2 (envp) */ \
77 regs->ARM_r1 = stack[1]; /* r1 (argv) */ \
78 regs->ARM_r0 = stack[0]; /* r0 (argc) */ \
79 nommu_start_thread(regs); \
80})
81
82/* Forward declaration, a strange C thing */
83struct task_struct;
84
85/* Free all resources held by a thread. */
86extern void release_thread(struct task_struct *);
87
88/* Prepare to copy thread state - unlazy all lazy status */
89#define prepare_to_copy(tsk) do { } while (0)
90
91unsigned long get_wchan(struct task_struct *p);
92
93#define cpu_relax() barrier()
94
95/*
96 * Create a new kernel thread
97 */
98extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
99
100#define task_pt_regs(p) \
101 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
102
103#define KSTK_EIP(tsk) task_pt_regs(tsk)->ARM_pc
104#define KSTK_ESP(tsk) task_pt_regs(tsk)->ARM_sp
105
106/*
107 * Prefetching support - only ARMv5.
108 */
109#if __LINUX_ARM_ARCH__ >= 5
110
111#define ARCH_HAS_PREFETCH
112static inline void prefetch(const void *ptr)
113{
114 __asm__ __volatile__(
115 "pld\t%0"
116 :
117 : "o" (*(char *)ptr)
118 : "cc");
119}
120
121#define ARCH_HAS_PREFETCHW
122#define prefetchw(ptr) prefetch(ptr)
123
124#define ARCH_HAS_SPINLOCK_PREFETCH
125#define spin_lock_prefetch(x) do { } while (0)
126
127#endif
128
129#endif
130
131#endif /* __ASM_ARM_PROCESSOR_H */
diff --git a/arch/arm/include/asm/procinfo.h b/arch/arm/include/asm/procinfo.h
new file mode 100644
index 000000000000..ca52e584ef74
--- /dev/null
+++ b/arch/arm/include/asm/procinfo.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/include/asm/procinfo.h
3 *
4 * Copyright (C) 1996-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_PROCINFO_H
11#define __ASM_PROCINFO_H
12
13#ifdef __KERNEL__
14
15struct cpu_tlb_fns;
16struct cpu_user_fns;
17struct cpu_cache_fns;
18struct processor;
19
20/*
21 * Note! struct processor is always defined if we're
22 * using MULTI_CPU, otherwise this entry is unused,
23 * but still exists.
24 *
25 * NOTE! The following structure is defined by assembly
26 * language, NOT C code. For more information, check:
27 * arch/arm/mm/proc-*.S and arch/arm/kernel/head.S
28 */
29struct proc_info_list {
30 unsigned int cpu_val;
31 unsigned int cpu_mask;
32 unsigned long __cpu_mm_mmu_flags; /* used by head.S */
33 unsigned long __cpu_io_mmu_flags; /* used by head.S */
34 unsigned long __cpu_flush; /* used by head.S */
35 const char *arch_name;
36 const char *elf_name;
37 unsigned int elf_hwcap;
38 const char *cpu_name;
39 struct processor *proc;
40 struct cpu_tlb_fns *tlb;
41 struct cpu_user_fns *user;
42 struct cpu_cache_fns *cache;
43};
44
45#else /* __KERNEL__ */
46#include <asm/elf.h>
47#warning "Please include asm/elf.h instead"
48#endif /* __KERNEL__ */
49#endif
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
new file mode 100644
index 000000000000..b415c0e85458
--- /dev/null
+++ b/arch/arm/include/asm/ptrace.h
@@ -0,0 +1,162 @@
1/*
2 * arch/arm/include/asm/ptrace.h
3 *
4 * Copyright (C) 1996-2003 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_PTRACE_H
11#define __ASM_ARM_PTRACE_H
12
13#include <asm/hwcap.h>
14
15#define PTRACE_GETREGS 12
16#define PTRACE_SETREGS 13
17#define PTRACE_GETFPREGS 14
18#define PTRACE_SETFPREGS 15
19/* PTRACE_ATTACH is 16 */
20/* PTRACE_DETACH is 17 */
21#define PTRACE_GETWMMXREGS 18
22#define PTRACE_SETWMMXREGS 19
23/* 20 is unused */
24#define PTRACE_OLDSETOPTIONS 21
25#define PTRACE_GET_THREAD_AREA 22
26#define PTRACE_SET_SYSCALL 23
27/* PTRACE_SYSCALL is 24 */
28#define PTRACE_GETCRUNCHREGS 25
29#define PTRACE_SETCRUNCHREGS 26
30
31/*
32 * PSR bits
33 */
34#define USR26_MODE 0x00000000
35#define FIQ26_MODE 0x00000001
36#define IRQ26_MODE 0x00000002
37#define SVC26_MODE 0x00000003
38#define USR_MODE 0x00000010
39#define FIQ_MODE 0x00000011
40#define IRQ_MODE 0x00000012
41#define SVC_MODE 0x00000013
42#define ABT_MODE 0x00000017
43#define UND_MODE 0x0000001b
44#define SYSTEM_MODE 0x0000001f
45#define MODE32_BIT 0x00000010
46#define MODE_MASK 0x0000001f
47#define PSR_T_BIT 0x00000020
48#define PSR_F_BIT 0x00000040
49#define PSR_I_BIT 0x00000080
50#define PSR_A_BIT 0x00000100
51#define PSR_J_BIT 0x01000000
52#define PSR_Q_BIT 0x08000000
53#define PSR_V_BIT 0x10000000
54#define PSR_C_BIT 0x20000000
55#define PSR_Z_BIT 0x40000000
56#define PSR_N_BIT 0x80000000
57#define PCMASK 0
58
59/*
60 * Groups of PSR bits
61 */
62#define PSR_f 0xff000000 /* Flags */
63#define PSR_s 0x00ff0000 /* Status */
64#define PSR_x 0x0000ff00 /* Extension */
65#define PSR_c 0x000000ff /* Control */
66
67#ifndef __ASSEMBLY__
68
69/*
70 * This struct defines the way the registers are stored on the
71 * stack during a system call. Note that sizeof(struct pt_regs)
72 * has to be a multiple of 8.
73 */
74struct pt_regs {
75 long uregs[18];
76};
77
78#define ARM_cpsr uregs[16]
79#define ARM_pc uregs[15]
80#define ARM_lr uregs[14]
81#define ARM_sp uregs[13]
82#define ARM_ip uregs[12]
83#define ARM_fp uregs[11]
84#define ARM_r10 uregs[10]
85#define ARM_r9 uregs[9]
86#define ARM_r8 uregs[8]
87#define ARM_r7 uregs[7]
88#define ARM_r6 uregs[6]
89#define ARM_r5 uregs[5]
90#define ARM_r4 uregs[4]
91#define ARM_r3 uregs[3]
92#define ARM_r2 uregs[2]
93#define ARM_r1 uregs[1]
94#define ARM_r0 uregs[0]
95#define ARM_ORIG_r0 uregs[17]
96
97#ifdef __KERNEL__
98
99#define user_mode(regs) \
100 (((regs)->ARM_cpsr & 0xf) == 0)
101
102#ifdef CONFIG_ARM_THUMB
103#define thumb_mode(regs) \
104 (((regs)->ARM_cpsr & PSR_T_BIT))
105#else
106#define thumb_mode(regs) (0)
107#endif
108
109#define isa_mode(regs) \
110 ((((regs)->ARM_cpsr & PSR_J_BIT) >> 23) | \
111 (((regs)->ARM_cpsr & PSR_T_BIT) >> 5))
112
113#define processor_mode(regs) \
114 ((regs)->ARM_cpsr & MODE_MASK)
115
116#define interrupts_enabled(regs) \
117 (!((regs)->ARM_cpsr & PSR_I_BIT))
118
119#define fast_interrupts_enabled(regs) \
120 (!((regs)->ARM_cpsr & PSR_F_BIT))
121
122/* Are the current registers suitable for user mode?
123 * (used to maintain security in signal handlers)
124 */
125static inline int valid_user_regs(struct pt_regs *regs)
126{
127 if (user_mode(regs) && (regs->ARM_cpsr & PSR_I_BIT) == 0) {
128 regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT);
129 return 1;
130 }
131
132 /*
133 * Force CPSR to something logical...
134 */
135 regs->ARM_cpsr &= PSR_f | PSR_s | (PSR_x & ~PSR_A_BIT) | PSR_T_BIT | MODE32_BIT;
136 if (!(elf_hwcap & HWCAP_26BIT))
137 regs->ARM_cpsr |= USR_MODE;
138
139 return 0;
140}
141
142#define pc_pointer(v) \
143 ((v) & ~PCMASK)
144
145#define instruction_pointer(regs) \
146 (pc_pointer((regs)->ARM_pc))
147
148#ifdef CONFIG_SMP
149extern unsigned long profile_pc(struct pt_regs *regs);
150#else
151#define profile_pc(regs) instruction_pointer(regs)
152#endif
153
154#define predicate(x) ((x) & 0xf0000000)
155#define PREDICATE_ALWAYS 0xe0000000
156
157#endif /* __KERNEL__ */
158
159#endif /* __ASSEMBLY__ */
160
161#endif
162
diff --git a/arch/arm/include/asm/resource.h b/arch/arm/include/asm/resource.h
new file mode 100644
index 000000000000..734b581b5b6a
--- /dev/null
+++ b/arch/arm/include/asm/resource.h
@@ -0,0 +1,6 @@
1#ifndef _ARM_RESOURCE_H
2#define _ARM_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif
diff --git a/arch/arm/include/asm/scatterlist.h b/arch/arm/include/asm/scatterlist.h
new file mode 100644
index 000000000000..ca0a37d03400
--- /dev/null
+++ b/arch/arm/include/asm/scatterlist.h
@@ -0,0 +1,27 @@
1#ifndef _ASMARM_SCATTERLIST_H
2#define _ASMARM_SCATTERLIST_H
3
4#include <asm/memory.h>
5#include <asm/types.h>
6
7struct scatterlist {
8#ifdef CONFIG_DEBUG_SG
9 unsigned long sg_magic;
10#endif
11 unsigned long page_link;
12 unsigned int offset; /* buffer offset */
13 dma_addr_t dma_address; /* dma address */
14 unsigned int length; /* length */
15};
16
17/*
18 * These macros should be used after a pci_map_sg call has been done
19 * to get bus addresses of each of the SG entries and their lengths.
20 * You should only work with the number of sg entries pci_map_sg
21 * returns, or alternatively stop on the first sg_dma_len(sg) which
22 * is 0.
23 */
24#define sg_dma_address(sg) ((sg)->dma_address)
25#define sg_dma_len(sg) ((sg)->length)
26
27#endif /* _ASMARM_SCATTERLIST_H */
diff --git a/arch/arm/include/asm/sections.h b/arch/arm/include/asm/sections.h
new file mode 100644
index 000000000000..2b8c5160388f
--- /dev/null
+++ b/arch/arm/include/asm/sections.h
@@ -0,0 +1 @@
#include <asm-generic/sections.h>
diff --git a/arch/arm/include/asm/segment.h b/arch/arm/include/asm/segment.h
new file mode 100644
index 000000000000..9e24c21f6304
--- /dev/null
+++ b/arch/arm/include/asm/segment.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_ARM_SEGMENT_H
2#define __ASM_ARM_SEGMENT_H
3
4#define __KERNEL_CS 0x0
5#define __KERNEL_DS 0x0
6
7#define __USER_CS 0x1
8#define __USER_DS 0x1
9
10#endif /* __ASM_ARM_SEGMENT_H */
11
diff --git a/arch/arm/include/asm/sembuf.h b/arch/arm/include/asm/sembuf.h
new file mode 100644
index 000000000000..1c0283954289
--- /dev/null
+++ b/arch/arm/include/asm/sembuf.h
@@ -0,0 +1,25 @@
1#ifndef _ASMARM_SEMBUF_H
2#define _ASMARM_SEMBUF_H
3
4/*
5 * The semid64_ds structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* _ASMARM_SEMBUF_H */
diff --git a/arch/arm/include/asm/serial.h b/arch/arm/include/asm/serial.h
new file mode 100644
index 000000000000..ebb049091e26
--- /dev/null
+++ b/arch/arm/include/asm/serial.h
@@ -0,0 +1,19 @@
1/*
2 * arch/arm/include/asm/serial.h
3 *
4 * Copyright (C) 1996 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Changelog:
11 * 15-10-1996 RMK Created
12 */
13
14#ifndef __ASM_SERIAL_H
15#define __ASM_SERIAL_H
16
17#define BASE_BAUD (1843200 / 16)
18
19#endif
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
new file mode 100644
index 000000000000..7bbf105463f1
--- /dev/null
+++ b/arch/arm/include/asm/setup.h
@@ -0,0 +1,226 @@
1/*
2 * linux/include/asm/setup.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Structure passed to kernel to tell it about the
11 * hardware it's running on. See Documentation/arm/Setup
12 * for more info.
13 */
14#ifndef __ASMARM_SETUP_H
15#define __ASMARM_SETUP_H
16
17#include <asm/types.h>
18
19#define COMMAND_LINE_SIZE 1024
20
21/* The list ends with an ATAG_NONE node. */
22#define ATAG_NONE 0x00000000
23
24struct tag_header {
25 __u32 size;
26 __u32 tag;
27};
28
29/* The list must start with an ATAG_CORE node */
30#define ATAG_CORE 0x54410001
31
32struct tag_core {
33 __u32 flags; /* bit 0 = read-only */
34 __u32 pagesize;
35 __u32 rootdev;
36};
37
38/* it is allowed to have multiple ATAG_MEM nodes */
39#define ATAG_MEM 0x54410002
40
41struct tag_mem32 {
42 __u32 size;
43 __u32 start; /* physical start address */
44};
45
46/* VGA text type displays */
47#define ATAG_VIDEOTEXT 0x54410003
48
49struct tag_videotext {
50 __u8 x;
51 __u8 y;
52 __u16 video_page;
53 __u8 video_mode;
54 __u8 video_cols;
55 __u16 video_ega_bx;
56 __u8 video_lines;
57 __u8 video_isvga;
58 __u16 video_points;
59};
60
61/* describes how the ramdisk will be used in kernel */
62#define ATAG_RAMDISK 0x54410004
63
64struct tag_ramdisk {
65 __u32 flags; /* bit 0 = load, bit 1 = prompt */
66 __u32 size; /* decompressed ramdisk size in _kilo_ bytes */
67 __u32 start; /* starting block of floppy-based RAM disk image */
68};
69
70/* describes where the compressed ramdisk image lives (virtual address) */
71/*
72 * this one accidentally used virtual addresses - as such,
73 * it's deprecated.
74 */
75#define ATAG_INITRD 0x54410005
76
77/* describes where the compressed ramdisk image lives (physical address) */
78#define ATAG_INITRD2 0x54420005
79
80struct tag_initrd {
81 __u32 start; /* physical start address */
82 __u32 size; /* size of compressed ramdisk image in bytes */
83};
84
85/* board serial number. "64 bits should be enough for everybody" */
86#define ATAG_SERIAL 0x54410006
87
88struct tag_serialnr {
89 __u32 low;
90 __u32 high;
91};
92
93/* board revision */
94#define ATAG_REVISION 0x54410007
95
96struct tag_revision {
97 __u32 rev;
98};
99
100/* initial values for vesafb-type framebuffers. see struct screen_info
101 * in include/linux/tty.h
102 */
103#define ATAG_VIDEOLFB 0x54410008
104
105struct tag_videolfb {
106 __u16 lfb_width;
107 __u16 lfb_height;
108 __u16 lfb_depth;
109 __u16 lfb_linelength;
110 __u32 lfb_base;
111 __u32 lfb_size;
112 __u8 red_size;
113 __u8 red_pos;
114 __u8 green_size;
115 __u8 green_pos;
116 __u8 blue_size;
117 __u8 blue_pos;
118 __u8 rsvd_size;
119 __u8 rsvd_pos;
120};
121
122/* command line: \0 terminated string */
123#define ATAG_CMDLINE 0x54410009
124
125struct tag_cmdline {
126 char cmdline[1]; /* this is the minimum size */
127};
128
129/* acorn RiscPC specific information */
130#define ATAG_ACORN 0x41000101
131
132struct tag_acorn {
133 __u32 memc_control_reg;
134 __u32 vram_pages;
135 __u8 sounddefault;
136 __u8 adfsdrives;
137};
138
139/* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */
140#define ATAG_MEMCLK 0x41000402
141
142struct tag_memclk {
143 __u32 fmemclk;
144};
145
146struct tag {
147 struct tag_header hdr;
148 union {
149 struct tag_core core;
150 struct tag_mem32 mem;
151 struct tag_videotext videotext;
152 struct tag_ramdisk ramdisk;
153 struct tag_initrd initrd;
154 struct tag_serialnr serialnr;
155 struct tag_revision revision;
156 struct tag_videolfb videolfb;
157 struct tag_cmdline cmdline;
158
159 /*
160 * Acorn specific
161 */
162 struct tag_acorn acorn;
163
164 /*
165 * DC21285 specific
166 */
167 struct tag_memclk memclk;
168 } u;
169};
170
171struct tagtable {
172 __u32 tag;
173 int (*parse)(const struct tag *);
174};
175
176#define tag_member_present(tag,member) \
177 ((unsigned long)(&((struct tag *)0L)->member + 1) \
178 <= (tag)->hdr.size * 4)
179
180#define tag_next(t) ((struct tag *)((__u32 *)(t) + (t)->hdr.size))
181#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
182
183#define for_each_tag(t,base) \
184 for (t = base; t->hdr.size; t = tag_next(t))
185
186#ifdef __KERNEL__
187
188#define __tag __used __attribute__((__section__(".taglist.init")))
189#define __tagtable(tag, fn) \
190static struct tagtable __tagtable_##fn __tag = { tag, fn }
191
192/*
193 * Memory map description
194 */
195#ifdef CONFIG_ARCH_LH7A40X
196# define NR_BANKS 16
197#else
198# define NR_BANKS 8
199#endif
200
201struct membank {
202 unsigned long start;
203 unsigned long size;
204 int node;
205};
206
207struct meminfo {
208 int nr_banks;
209 struct membank bank[NR_BANKS];
210};
211
212/*
213 * Early command line parameters.
214 */
215struct early_params {
216 const char *arg;
217 void (*fn)(char **p);
218};
219
220#define __early_param(name,fn) \
221static struct early_params __early_##fn __used \
222__attribute__((__section__(".early_param.init"))) = { name, fn }
223
224#endif /* __KERNEL__ */
225
226#endif
diff --git a/arch/arm/include/asm/shmbuf.h b/arch/arm/include/asm/shmbuf.h
new file mode 100644
index 000000000000..2e5c67ba1c97
--- /dev/null
+++ b/arch/arm/include/asm/shmbuf.h
@@ -0,0 +1,42 @@
1#ifndef _ASMARM_SHMBUF_H
2#define _ASMARM_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* _ASMARM_SHMBUF_H */
diff --git a/arch/arm/include/asm/shmparam.h b/arch/arm/include/asm/shmparam.h
new file mode 100644
index 000000000000..a5223b3a9bf9
--- /dev/null
+++ b/arch/arm/include/asm/shmparam.h
@@ -0,0 +1,16 @@
1#ifndef _ASMARM_SHMPARAM_H
2#define _ASMARM_SHMPARAM_H
3
4/*
5 * This should be the size of the virtually indexed cache/ways,
6 * or page size, whichever is greater since the cache aliases
7 * every size/ways bytes.
8 */
9#define SHMLBA (4 * PAGE_SIZE) /* attach addr a multiple of this */
10
11/*
12 * Enforce SHMLBA in shmat
13 */
14#define __ARCH_FORCE_SHMLBA
15
16#endif /* _ASMARM_SHMPARAM_H */
diff --git a/arch/arm/include/asm/sigcontext.h b/arch/arm/include/asm/sigcontext.h
new file mode 100644
index 000000000000..fc0b80b6a6fc
--- /dev/null
+++ b/arch/arm/include/asm/sigcontext.h
@@ -0,0 +1,34 @@
1#ifndef _ASMARM_SIGCONTEXT_H
2#define _ASMARM_SIGCONTEXT_H
3
4/*
5 * Signal context structure - contains all info to do with the state
6 * before the signal handler was invoked. Note: only add new entries
7 * to the end of the structure.
8 */
9struct sigcontext {
10 unsigned long trap_no;
11 unsigned long error_code;
12 unsigned long oldmask;
13 unsigned long arm_r0;
14 unsigned long arm_r1;
15 unsigned long arm_r2;
16 unsigned long arm_r3;
17 unsigned long arm_r4;
18 unsigned long arm_r5;
19 unsigned long arm_r6;
20 unsigned long arm_r7;
21 unsigned long arm_r8;
22 unsigned long arm_r9;
23 unsigned long arm_r10;
24 unsigned long arm_fp;
25 unsigned long arm_ip;
26 unsigned long arm_sp;
27 unsigned long arm_lr;
28 unsigned long arm_pc;
29 unsigned long arm_cpsr;
30 unsigned long fault_address;
31};
32
33
34#endif
diff --git a/arch/arm/include/asm/siginfo.h b/arch/arm/include/asm/siginfo.h
new file mode 100644
index 000000000000..5e21852e6039
--- /dev/null
+++ b/arch/arm/include/asm/siginfo.h
@@ -0,0 +1,6 @@
1#ifndef _ASMARM_SIGINFO_H
2#define _ASMARM_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif
diff --git a/arch/arm/include/asm/signal.h b/arch/arm/include/asm/signal.h
new file mode 100644
index 000000000000..d0fb487aba4f
--- /dev/null
+++ b/arch/arm/include/asm/signal.h
@@ -0,0 +1,164 @@
1#ifndef _ASMARM_SIGNAL_H
2#define _ASMARM_SIGNAL_H
3
4#include <linux/types.h>
5
6/* Avoid too many header ordering problems. */
7struct siginfo;
8
9#ifdef __KERNEL__
10/* Most things should be clean enough to redefine this at will, if care
11 is taken to make libc match. */
12
13#define _NSIG 64
14#define _NSIG_BPW 32
15#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
16
17typedef unsigned long old_sigset_t; /* at least 32 bits */
18
19typedef struct {
20 unsigned long sig[_NSIG_WORDS];
21} sigset_t;
22
23#else
24/* Here we must cater to libcs that poke about in kernel headers. */
25
26#define NSIG 32
27typedef unsigned long sigset_t;
28
29#endif /* __KERNEL__ */
30
31#define SIGHUP 1
32#define SIGINT 2
33#define SIGQUIT 3
34#define SIGILL 4
35#define SIGTRAP 5
36#define SIGABRT 6
37#define SIGIOT 6
38#define SIGBUS 7
39#define SIGFPE 8
40#define SIGKILL 9
41#define SIGUSR1 10
42#define SIGSEGV 11
43#define SIGUSR2 12
44#define SIGPIPE 13
45#define SIGALRM 14
46#define SIGTERM 15
47#define SIGSTKFLT 16
48#define SIGCHLD 17
49#define SIGCONT 18
50#define SIGSTOP 19
51#define SIGTSTP 20
52#define SIGTTIN 21
53#define SIGTTOU 22
54#define SIGURG 23
55#define SIGXCPU 24
56#define SIGXFSZ 25
57#define SIGVTALRM 26
58#define SIGPROF 27
59#define SIGWINCH 28
60#define SIGIO 29
61#define SIGPOLL SIGIO
62/*
63#define SIGLOST 29
64*/
65#define SIGPWR 30
66#define SIGSYS 31
67#define SIGUNUSED 31
68
69/* These should not be considered constants from userland. */
70#define SIGRTMIN 32
71#define SIGRTMAX _NSIG
72
73#define SIGSWI 32
74
75/*
76 * SA_FLAGS values:
77 *
78 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
79 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
80 * SA_SIGINFO deliver the signal with SIGINFO structs
81 * SA_THIRTYTWO delivers the signal in 32-bit mode, even if the task
82 * is running in 26-bit.
83 * SA_ONSTACK allows alternate signal stacks (see sigaltstack(2)).
84 * SA_RESTART flag to get restarting signals (which were the default long ago)
85 * SA_NODEFER prevents the current signal from being masked in the handler.
86 * SA_RESETHAND clears the handler when the signal is delivered.
87 *
88 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
89 * Unix names RESETHAND and NODEFER respectively.
90 */
91#define SA_NOCLDSTOP 0x00000001
92#define SA_NOCLDWAIT 0x00000002
93#define SA_SIGINFO 0x00000004
94#define SA_THIRTYTWO 0x02000000
95#define SA_RESTORER 0x04000000
96#define SA_ONSTACK 0x08000000
97#define SA_RESTART 0x10000000
98#define SA_NODEFER 0x40000000
99#define SA_RESETHAND 0x80000000
100
101#define SA_NOMASK SA_NODEFER
102#define SA_ONESHOT SA_RESETHAND
103
104
105/*
106 * sigaltstack controls
107 */
108#define SS_ONSTACK 1
109#define SS_DISABLE 2
110
111#define MINSIGSTKSZ 2048
112#define SIGSTKSZ 8192
113
114#include <asm-generic/signal.h>
115
116#ifdef __KERNEL__
117struct old_sigaction {
118 __sighandler_t sa_handler;
119 old_sigset_t sa_mask;
120 unsigned long sa_flags;
121 __sigrestore_t sa_restorer;
122};
123
124struct sigaction {
125 __sighandler_t sa_handler;
126 unsigned long sa_flags;
127 __sigrestore_t sa_restorer;
128 sigset_t sa_mask; /* mask last for extensibility */
129};
130
131struct k_sigaction {
132 struct sigaction sa;
133};
134
135#else
136/* Here we must cater to libcs that poke about in kernel headers. */
137
138struct sigaction {
139 union {
140 __sighandler_t _sa_handler;
141 void (*_sa_sigaction)(int, struct siginfo *, void *);
142 } _u;
143 sigset_t sa_mask;
144 unsigned long sa_flags;
145 void (*sa_restorer)(void);
146};
147
148#define sa_handler _u._sa_handler
149#define sa_sigaction _u._sa_sigaction
150
151#endif /* __KERNEL__ */
152
153typedef struct sigaltstack {
154 void __user *ss_sp;
155 int ss_flags;
156 size_t ss_size;
157} stack_t;
158
159#ifdef __KERNEL__
160#include <asm/sigcontext.h>
161#define ptrace_signal_deliver(regs, cookie) do { } while (0)
162#endif
163
164#endif
diff --git a/arch/arm/include/asm/sizes.h b/arch/arm/include/asm/sizes.h
new file mode 100644
index 000000000000..503843db1565
--- /dev/null
+++ b/arch/arm/include/asm/sizes.h
@@ -0,0 +1,56 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */
16/* DO NOT EDIT!! - this file automatically generated
17 * from .s file by awk -f s2h.awk
18 */
19/* Size definitions
20 * Copyright (C) ARM Limited 1998. All rights reserved.
21 */
22
23#ifndef __sizes_h
24#define __sizes_h 1
25
26/* handy sizes */
27#define SZ_16 0x00000010
28#define SZ_256 0x00000100
29#define SZ_512 0x00000200
30
31#define SZ_1K 0x00000400
32#define SZ_4K 0x00001000
33#define SZ_8K 0x00002000
34#define SZ_16K 0x00004000
35#define SZ_64K 0x00010000
36#define SZ_128K 0x00020000
37#define SZ_256K 0x00040000
38#define SZ_512K 0x00080000
39
40#define SZ_1M 0x00100000
41#define SZ_2M 0x00200000
42#define SZ_4M 0x00400000
43#define SZ_8M 0x00800000
44#define SZ_16M 0x01000000
45#define SZ_32M 0x02000000
46#define SZ_64M 0x04000000
47#define SZ_128M 0x08000000
48#define SZ_256M 0x10000000
49#define SZ_512M 0x20000000
50
51#define SZ_1G 0x40000000
52#define SZ_2G 0x80000000
53
54#endif
55
56/* END */
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
new file mode 100644
index 000000000000..727b5c042e52
--- /dev/null
+++ b/arch/arm/include/asm/smp.h
@@ -0,0 +1,147 @@
1/*
2 * arch/arm/include/asm/smp.h
3 *
4 * Copyright (C) 2004-2005 ARM Ltd.
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_ARM_SMP_H
11#define __ASM_ARM_SMP_H
12
13#include <linux/threads.h>
14#include <linux/cpumask.h>
15#include <linux/thread_info.h>
16
17#include <mach/smp.h>
18
19#ifndef CONFIG_SMP
20# error "<asm/smp.h> included in non-SMP build"
21#endif
22
23#define raw_smp_processor_id() (current_thread_info()->cpu)
24
25/*
26 * at the moment, there's not a big penalty for changing CPUs
27 * (the >big< penalty is running SMP in the first place)
28 */
29#define PROC_CHANGE_PENALTY 15
30
31struct seq_file;
32
33/*
34 * generate IPI list text
35 */
36extern void show_ipi_list(struct seq_file *p);
37
38/*
39 * Called from assembly code, this handles an IPI.
40 */
41asmlinkage void do_IPI(struct pt_regs *regs);
42
43/*
44 * Setup the SMP cpu_possible_map
45 */
46extern void smp_init_cpus(void);
47
48/*
49 * Move global data into per-processor storage.
50 */
51extern void smp_store_cpu_info(unsigned int cpuid);
52
53/*
54 * Raise an IPI cross call on CPUs in callmap.
55 */
56extern void smp_cross_call(cpumask_t callmap);
57
58/*
59 * Broadcast a timer interrupt to the other CPUs.
60 */
61extern void smp_send_timer(void);
62
63/*
64 * Broadcast a clock event to other CPUs.
65 */
66extern void smp_timer_broadcast(cpumask_t mask);
67
68/*
69 * Boot a secondary CPU, and assign it the specified idle task.
70 * This also gives us the initial stack to use for this CPU.
71 */
72extern int boot_secondary(unsigned int cpu, struct task_struct *);
73
74/*
75 * Called from platform specific assembly code, this is the
76 * secondary CPU entry point.
77 */
78asmlinkage void secondary_start_kernel(void);
79
80/*
81 * Perform platform specific initialisation of the specified CPU.
82 */
83extern void platform_secondary_init(unsigned int cpu);
84
85/*
86 * Initial data for bringing up a secondary CPU.
87 */
88struct secondary_data {
89 unsigned long pgdir;
90 void *stack;
91};
92extern struct secondary_data secondary_data;
93
94extern int __cpu_disable(void);
95extern int mach_cpu_disable(unsigned int cpu);
96
97extern void __cpu_die(unsigned int cpu);
98extern void cpu_die(void);
99
100extern void platform_cpu_die(unsigned int cpu);
101extern int platform_cpu_kill(unsigned int cpu);
102extern void platform_cpu_enable(unsigned int cpu);
103
104extern void arch_send_call_function_single_ipi(int cpu);
105extern void arch_send_call_function_ipi(cpumask_t mask);
106
107/*
108 * Local timer interrupt handling function (can be IPI'ed).
109 */
110extern void local_timer_interrupt(void);
111
112#ifdef CONFIG_LOCAL_TIMERS
113
114/*
115 * Stop a local timer interrupt.
116 */
117extern void local_timer_stop(unsigned int cpu);
118
119/*
120 * Platform provides this to acknowledge a local timer IRQ
121 */
122extern int local_timer_ack(void);
123
124#else
125
126static inline void local_timer_stop(unsigned int cpu)
127{
128}
129
130#endif
131
132/*
133 * Setup a local timer interrupt for a CPU.
134 */
135extern void local_timer_setup(unsigned int cpu);
136
137/*
138 * show local interrupt info
139 */
140extern void show_local_irqs(struct seq_file *);
141
142/*
143 * Called from assembly, this is the local timer IRQ handler
144 */
145asmlinkage void do_local_timer(struct pt_regs *);
146
147#endif /* ifndef __ASM_ARM_SMP_H */
diff --git a/arch/arm/include/asm/socket.h b/arch/arm/include/asm/socket.h
new file mode 100644
index 000000000000..6817be9573a6
--- /dev/null
+++ b/arch/arm/include/asm/socket.h
@@ -0,0 +1,57 @@
1#ifndef _ASMARM_SOCKET_H
2#define _ASMARM_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43
44#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29
46#define SCM_TIMESTAMP SO_TIMESTAMP
47
48#define SO_ACCEPTCONN 30
49
50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54
55#define SO_MARK 36
56
57#endif /* _ASM_SOCKET_H */
diff --git a/arch/arm/include/asm/sockios.h b/arch/arm/include/asm/sockios.h
new file mode 100644
index 000000000000..a2588a2512df
--- /dev/null
+++ b/arch/arm/include/asm/sockios.h
@@ -0,0 +1,13 @@
1#ifndef __ARCH_ARM_SOCKIOS_H
2#define __ARCH_ARM_SOCKIOS_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif
diff --git a/arch/arm/include/asm/sparsemem.h b/arch/arm/include/asm/sparsemem.h
new file mode 100644
index 000000000000..277158191a0d
--- /dev/null
+++ b/arch/arm/include/asm/sparsemem.h
@@ -0,0 +1,10 @@
1#ifndef ASMARM_SPARSEMEM_H
2#define ASMARM_SPARSEMEM_H
3
4#include <asm/memory.h>
5
6#define MAX_PHYSADDR_BITS 32
7#define MAX_PHYSMEM_BITS 32
8#define SECTION_SIZE_BITS NODE_MEM_SIZE_BITS
9
10#endif
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
new file mode 100644
index 000000000000..2b41ebbfa7ff
--- /dev/null
+++ b/arch/arm/include/asm/spinlock.h
@@ -0,0 +1,224 @@
1#ifndef __ASM_SPINLOCK_H
2#define __ASM_SPINLOCK_H
3
4#if __LINUX_ARM_ARCH__ < 6
5#error SMP not supported on pre-ARMv6 CPUs
6#endif
7
8/*
9 * ARMv6 Spin-locking.
10 *
11 * We exclusively read the old value. If it is zero, we may have
12 * won the lock, so we try exclusively storing it. A memory barrier
13 * is required after we get a lock, and before we release it, because
14 * V6 CPUs are assumed to have weakly ordered memory.
15 *
16 * Unlocked value: 0
17 * Locked value: 1
18 */
19
20#define __raw_spin_is_locked(x) ((x)->lock != 0)
21#define __raw_spin_unlock_wait(lock) \
22 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
23
24#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
25
26static inline void __raw_spin_lock(raw_spinlock_t *lock)
27{
28 unsigned long tmp;
29
30 __asm__ __volatile__(
31"1: ldrex %0, [%1]\n"
32" teq %0, #0\n"
33#ifdef CONFIG_CPU_32v6K
34" wfene\n"
35#endif
36" strexeq %0, %2, [%1]\n"
37" teqeq %0, #0\n"
38" bne 1b"
39 : "=&r" (tmp)
40 : "r" (&lock->lock), "r" (1)
41 : "cc");
42
43 smp_mb();
44}
45
46static inline int __raw_spin_trylock(raw_spinlock_t *lock)
47{
48 unsigned long tmp;
49
50 __asm__ __volatile__(
51" ldrex %0, [%1]\n"
52" teq %0, #0\n"
53" strexeq %0, %2, [%1]"
54 : "=&r" (tmp)
55 : "r" (&lock->lock), "r" (1)
56 : "cc");
57
58 if (tmp == 0) {
59 smp_mb();
60 return 1;
61 } else {
62 return 0;
63 }
64}
65
66static inline void __raw_spin_unlock(raw_spinlock_t *lock)
67{
68 smp_mb();
69
70 __asm__ __volatile__(
71" str %1, [%0]\n"
72#ifdef CONFIG_CPU_32v6K
73" mcr p15, 0, %1, c7, c10, 4\n" /* DSB */
74" sev"
75#endif
76 :
77 : "r" (&lock->lock), "r" (0)
78 : "cc");
79}
80
81/*
82 * RWLOCKS
83 *
84 *
85 * Write locks are easy - we just set bit 31. When unlocking, we can
86 * just write zero since the lock is exclusively held.
87 */
88
89static inline void __raw_write_lock(raw_rwlock_t *rw)
90{
91 unsigned long tmp;
92
93 __asm__ __volatile__(
94"1: ldrex %0, [%1]\n"
95" teq %0, #0\n"
96#ifdef CONFIG_CPU_32v6K
97" wfene\n"
98#endif
99" strexeq %0, %2, [%1]\n"
100" teq %0, #0\n"
101" bne 1b"
102 : "=&r" (tmp)
103 : "r" (&rw->lock), "r" (0x80000000)
104 : "cc");
105
106 smp_mb();
107}
108
109static inline int __raw_write_trylock(raw_rwlock_t *rw)
110{
111 unsigned long tmp;
112
113 __asm__ __volatile__(
114"1: ldrex %0, [%1]\n"
115" teq %0, #0\n"
116" strexeq %0, %2, [%1]"
117 : "=&r" (tmp)
118 : "r" (&rw->lock), "r" (0x80000000)
119 : "cc");
120
121 if (tmp == 0) {
122 smp_mb();
123 return 1;
124 } else {
125 return 0;
126 }
127}
128
129static inline void __raw_write_unlock(raw_rwlock_t *rw)
130{
131 smp_mb();
132
133 __asm__ __volatile__(
134 "str %1, [%0]\n"
135#ifdef CONFIG_CPU_32v6K
136" mcr p15, 0, %1, c7, c10, 4\n" /* DSB */
137" sev\n"
138#endif
139 :
140 : "r" (&rw->lock), "r" (0)
141 : "cc");
142}
143
144/* write_can_lock - would write_trylock() succeed? */
145#define __raw_write_can_lock(x) ((x)->lock == 0)
146
147/*
148 * Read locks are a bit more hairy:
149 * - Exclusively load the lock value.
150 * - Increment it.
151 * - Store new lock value if positive, and we still own this location.
152 * If the value is negative, we've already failed.
153 * - If we failed to store the value, we want a negative result.
154 * - If we failed, try again.
155 * Unlocking is similarly hairy. We may have multiple read locks
156 * currently active. However, we know we won't have any write
157 * locks.
158 */
159static inline void __raw_read_lock(raw_rwlock_t *rw)
160{
161 unsigned long tmp, tmp2;
162
163 __asm__ __volatile__(
164"1: ldrex %0, [%2]\n"
165" adds %0, %0, #1\n"
166" strexpl %1, %0, [%2]\n"
167#ifdef CONFIG_CPU_32v6K
168" wfemi\n"
169#endif
170" rsbpls %0, %1, #0\n"
171" bmi 1b"
172 : "=&r" (tmp), "=&r" (tmp2)
173 : "r" (&rw->lock)
174 : "cc");
175
176 smp_mb();
177}
178
179static inline void __raw_read_unlock(raw_rwlock_t *rw)
180{
181 unsigned long tmp, tmp2;
182
183 smp_mb();
184
185 __asm__ __volatile__(
186"1: ldrex %0, [%2]\n"
187" sub %0, %0, #1\n"
188" strex %1, %0, [%2]\n"
189" teq %1, #0\n"
190" bne 1b"
191#ifdef CONFIG_CPU_32v6K
192"\n cmp %0, #0\n"
193" mcreq p15, 0, %0, c7, c10, 4\n"
194" seveq"
195#endif
196 : "=&r" (tmp), "=&r" (tmp2)
197 : "r" (&rw->lock)
198 : "cc");
199}
200
201static inline int __raw_read_trylock(raw_rwlock_t *rw)
202{
203 unsigned long tmp, tmp2 = 1;
204
205 __asm__ __volatile__(
206"1: ldrex %0, [%2]\n"
207" adds %0, %0, #1\n"
208" strexpl %1, %0, [%2]\n"
209 : "=&r" (tmp), "+r" (tmp2)
210 : "r" (&rw->lock)
211 : "cc");
212
213 smp_mb();
214 return tmp2 == 0;
215}
216
217/* read_can_lock - would read_trylock() succeed? */
218#define __raw_read_can_lock(x) ((x)->lock < 0x80000000)
219
220#define _raw_spin_relax(lock) cpu_relax()
221#define _raw_read_relax(lock) cpu_relax()
222#define _raw_write_relax(lock) cpu_relax()
223
224#endif /* __ASM_SPINLOCK_H */
diff --git a/arch/arm/include/asm/spinlock_types.h b/arch/arm/include/asm/spinlock_types.h
new file mode 100644
index 000000000000..43e83f6d2ee5
--- /dev/null
+++ b/arch/arm/include/asm/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int lock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/arch/arm/include/asm/stat.h b/arch/arm/include/asm/stat.h
new file mode 100644
index 000000000000..42c0c13999d5
--- /dev/null
+++ b/arch/arm/include/asm/stat.h
@@ -0,0 +1,87 @@
1#ifndef _ASMARM_STAT_H
2#define _ASMARM_STAT_H
3
4struct __old_kernel_stat {
5 unsigned short st_dev;
6 unsigned short st_ino;
7 unsigned short st_mode;
8 unsigned short st_nlink;
9 unsigned short st_uid;
10 unsigned short st_gid;
11 unsigned short st_rdev;
12 unsigned long st_size;
13 unsigned long st_atime;
14 unsigned long st_mtime;
15 unsigned long st_ctime;
16};
17
18#define STAT_HAVE_NSEC
19
20struct stat {
21#if defined(__ARMEB__)
22 unsigned short st_dev;
23 unsigned short __pad1;
24#else
25 unsigned long st_dev;
26#endif
27 unsigned long st_ino;
28 unsigned short st_mode;
29 unsigned short st_nlink;
30 unsigned short st_uid;
31 unsigned short st_gid;
32#if defined(__ARMEB__)
33 unsigned short st_rdev;
34 unsigned short __pad2;
35#else
36 unsigned long st_rdev;
37#endif
38 unsigned long st_size;
39 unsigned long st_blksize;
40 unsigned long st_blocks;
41 unsigned long st_atime;
42 unsigned long st_atime_nsec;
43 unsigned long st_mtime;
44 unsigned long st_mtime_nsec;
45 unsigned long st_ctime;
46 unsigned long st_ctime_nsec;
47 unsigned long __unused4;
48 unsigned long __unused5;
49};
50
51/* This matches struct stat64 in glibc2.1, hence the absolutely
52 * insane amounts of padding around dev_t's.
53 * Note: The kernel zero's the padded region because glibc might read them
54 * in the hope that the kernel has stretched to using larger sizes.
55 */
56struct stat64 {
57 unsigned long long st_dev;
58 unsigned char __pad0[4];
59
60#define STAT64_HAS_BROKEN_ST_INO 1
61 unsigned long __st_ino;
62 unsigned int st_mode;
63 unsigned int st_nlink;
64
65 unsigned long st_uid;
66 unsigned long st_gid;
67
68 unsigned long long st_rdev;
69 unsigned char __pad3[4];
70
71 long long st_size;
72 unsigned long st_blksize;
73 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
74
75 unsigned long st_atime;
76 unsigned long st_atime_nsec;
77
78 unsigned long st_mtime;
79 unsigned long st_mtime_nsec;
80
81 unsigned long st_ctime;
82 unsigned long st_ctime_nsec;
83
84 unsigned long long st_ino;
85};
86
87#endif
diff --git a/arch/arm/include/asm/statfs.h b/arch/arm/include/asm/statfs.h
new file mode 100644
index 000000000000..a02e6a8c3d70
--- /dev/null
+++ b/arch/arm/include/asm/statfs.h
@@ -0,0 +1,42 @@
1#ifndef _ASMARM_STATFS_H
2#define _ASMARM_STATFS_H
3
4#ifndef __KERNEL_STRICT_NAMES
5# include <linux/types.h>
6typedef __kernel_fsid_t fsid_t;
7#endif
8
9struct statfs {
10 __u32 f_type;
11 __u32 f_bsize;
12 __u32 f_blocks;
13 __u32 f_bfree;
14 __u32 f_bavail;
15 __u32 f_files;
16 __u32 f_ffree;
17 __kernel_fsid_t f_fsid;
18 __u32 f_namelen;
19 __u32 f_frsize;
20 __u32 f_spare[5];
21};
22
23/*
24 * With EABI there is 4 bytes of padding added to this structure.
25 * Let's pack it so the padding goes away to simplify dual ABI support.
26 * Note that user space does NOT have to pack this structure.
27 */
28struct statfs64 {
29 __u32 f_type;
30 __u32 f_bsize;
31 __u64 f_blocks;
32 __u64 f_bfree;
33 __u64 f_bavail;
34 __u64 f_files;
35 __u64 f_ffree;
36 __kernel_fsid_t f_fsid;
37 __u32 f_namelen;
38 __u32 f_frsize;
39 __u32 f_spare[5];
40} __attribute__ ((packed,aligned(4)));
41
42#endif
diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h
new file mode 100644
index 000000000000..e50c4a39b699
--- /dev/null
+++ b/arch/arm/include/asm/string.h
@@ -0,0 +1,50 @@
1#ifndef __ASM_ARM_STRING_H
2#define __ASM_ARM_STRING_H
3
4/*
5 * We don't do inline string functions, since the
6 * optimised inline asm versions are not small.
7 */
8
9#define __HAVE_ARCH_STRRCHR
10extern char * strrchr(const char * s, int c);
11
12#define __HAVE_ARCH_STRCHR
13extern char * strchr(const char * s, int c);
14
15#define __HAVE_ARCH_MEMCPY
16extern void * memcpy(void *, const void *, __kernel_size_t);
17
18#define __HAVE_ARCH_MEMMOVE
19extern void * memmove(void *, const void *, __kernel_size_t);
20
21#define __HAVE_ARCH_MEMCHR
22extern void * memchr(const void *, int, __kernel_size_t);
23
24#define __HAVE_ARCH_MEMZERO
25#define __HAVE_ARCH_MEMSET
26extern void * memset(void *, int, __kernel_size_t);
27
28extern void __memzero(void *ptr, __kernel_size_t n);
29
30#define memset(p,v,n) \
31 ({ \
32 void *__p = (p); size_t __n = n; \
33 if ((__n) != 0) { \
34 if (__builtin_constant_p((v)) && (v) == 0) \
35 __memzero((__p),(__n)); \
36 else \
37 memset((__p),(v),(__n)); \
38 } \
39 (__p); \
40 })
41
42#define memzero(p,n) \
43 ({ \
44 void *__p = (p); size_t __n = n; \
45 if ((__n) != 0) \
46 __memzero((__p),(__n)); \
47 (__p); \
48 })
49
50#endif
diff --git a/arch/arm/include/asm/suspend.h b/arch/arm/include/asm/suspend.h
new file mode 100644
index 000000000000..cf0d0bdee74d
--- /dev/null
+++ b/arch/arm/include/asm/suspend.h
@@ -0,0 +1,4 @@
1#ifndef _ASMARM_SUSPEND_H
2#define _ASMARM_SUSPEND_H
3
4#endif
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
new file mode 100644
index 000000000000..514af792a598
--- /dev/null
+++ b/arch/arm/include/asm/system.h
@@ -0,0 +1,388 @@
1#ifndef __ASM_ARM_SYSTEM_H
2#define __ASM_ARM_SYSTEM_H
3
4#ifdef __KERNEL__
5
6#include <asm/memory.h>
7
8#define CPU_ARCH_UNKNOWN 0
9#define CPU_ARCH_ARMv3 1
10#define CPU_ARCH_ARMv4 2
11#define CPU_ARCH_ARMv4T 3
12#define CPU_ARCH_ARMv5 4
13#define CPU_ARCH_ARMv5T 5
14#define CPU_ARCH_ARMv5TE 6
15#define CPU_ARCH_ARMv5TEJ 7
16#define CPU_ARCH_ARMv6 8
17#define CPU_ARCH_ARMv7 9
18
19/*
20 * CR1 bits (CP#15 CR1)
21 */
22#define CR_M (1 << 0) /* MMU enable */
23#define CR_A (1 << 1) /* Alignment abort enable */
24#define CR_C (1 << 2) /* Dcache enable */
25#define CR_W (1 << 3) /* Write buffer enable */
26#define CR_P (1 << 4) /* 32-bit exception handler */
27#define CR_D (1 << 5) /* 32-bit data address range */
28#define CR_L (1 << 6) /* Implementation defined */
29#define CR_B (1 << 7) /* Big endian */
30#define CR_S (1 << 8) /* System MMU protection */
31#define CR_R (1 << 9) /* ROM MMU protection */
32#define CR_F (1 << 10) /* Implementation defined */
33#define CR_Z (1 << 11) /* Implementation defined */
34#define CR_I (1 << 12) /* Icache enable */
35#define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */
36#define CR_RR (1 << 14) /* Round Robin cache replacement */
37#define CR_L4 (1 << 15) /* LDR pc can set T bit */
38#define CR_DT (1 << 16)
39#define CR_IT (1 << 18)
40#define CR_ST (1 << 19)
41#define CR_FI (1 << 21) /* Fast interrupt (lower latency mode) */
42#define CR_U (1 << 22) /* Unaligned access operation */
43#define CR_XP (1 << 23) /* Extended page tables */
44#define CR_VE (1 << 24) /* Vectored interrupts */
45
46#define CPUID_ID 0
47#define CPUID_CACHETYPE 1
48#define CPUID_TCM 2
49#define CPUID_TLBTYPE 3
50
51/*
52 * This is used to ensure the compiler did actually allocate the register we
53 * asked it for some inline assembly sequences. Apparently we can't trust
54 * the compiler from one version to another so a bit of paranoia won't hurt.
55 * This string is meant to be concatenated with the inline asm string and
56 * will cause compilation to stop on mismatch.
57 * (for details, see gcc PR 15089)
58 */
59#define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t"
60
61#ifndef __ASSEMBLY__
62
63#include <linux/linkage.h>
64#include <linux/stringify.h>
65#include <linux/irqflags.h>
66
67#ifdef CONFIG_CPU_CP15
68#define read_cpuid(reg) \
69 ({ \
70 unsigned int __val; \
71 asm("mrc p15, 0, %0, c0, c0, " __stringify(reg) \
72 : "=r" (__val) \
73 : \
74 : "cc"); \
75 __val; \
76 })
77#else
78extern unsigned int processor_id;
79#define read_cpuid(reg) (processor_id)
80#endif
81
82/*
83 * The CPU ID never changes at run time, so we might as well tell the
84 * compiler that it's constant. Use this function to read the CPU ID
85 * rather than directly reading processor_id or read_cpuid() directly.
86 */
87static inline unsigned int read_cpuid_id(void) __attribute_const__;
88
89static inline unsigned int read_cpuid_id(void)
90{
91 return read_cpuid(CPUID_ID);
92}
93
94#define __exception __attribute__((section(".exception.text")))
95
96struct thread_info;
97struct task_struct;
98
99/* information about the system we're running on */
100extern unsigned int system_rev;
101extern unsigned int system_serial_low;
102extern unsigned int system_serial_high;
103extern unsigned int mem_fclk_21285;
104
105struct pt_regs;
106
107void die(const char *msg, struct pt_regs *regs, int err)
108 __attribute__((noreturn));
109
110struct siginfo;
111void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info,
112 unsigned long err, unsigned long trap);
113
114void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
115 struct pt_regs *),
116 int sig, const char *name);
117
118#define xchg(ptr,x) \
119 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
120
121extern asmlinkage void __backtrace(void);
122extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
123
124struct mm_struct;
125extern void show_pte(struct mm_struct *mm, unsigned long addr);
126extern void __show_regs(struct pt_regs *);
127
128extern int cpu_architecture(void);
129extern void cpu_init(void);
130
131void arm_machine_restart(char mode);
132extern void (*arm_pm_restart)(char str);
133
134/*
135 * Intel's XScale3 core supports some v6 features (supersections, L2)
136 * but advertises itself as v5 as it does not support the v6 ISA. For
137 * this reason, we need a way to explicitly test for this type of CPU.
138 */
139#ifndef CONFIG_CPU_XSC3
140#define cpu_is_xsc3() 0
141#else
142static inline int cpu_is_xsc3(void)
143{
144 extern unsigned int processor_id;
145
146 if ((processor_id & 0xffffe000) == 0x69056000)
147 return 1;
148
149 return 0;
150}
151#endif
152
153#if !defined(CONFIG_CPU_XSCALE) && !defined(CONFIG_CPU_XSC3)
154#define cpu_is_xscale() 0
155#else
156#define cpu_is_xscale() 1
157#endif
158
159#define UDBG_UNDEFINED (1 << 0)
160#define UDBG_SYSCALL (1 << 1)
161#define UDBG_BADABORT (1 << 2)
162#define UDBG_SEGV (1 << 3)
163#define UDBG_BUS (1 << 4)
164
165extern unsigned int user_debug;
166
167#if __LINUX_ARM_ARCH__ >= 4
168#define vectors_high() (cr_alignment & CR_V)
169#else
170#define vectors_high() (0)
171#endif
172
173#if __LINUX_ARM_ARCH__ >= 7
174#define isb() __asm__ __volatile__ ("isb" : : : "memory")
175#define dsb() __asm__ __volatile__ ("dsb" : : : "memory")
176#define dmb() __asm__ __volatile__ ("dmb" : : : "memory")
177#elif defined(CONFIG_CPU_XSC3) || __LINUX_ARM_ARCH__ == 6
178#define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
179 : : "r" (0) : "memory")
180#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
181 : : "r" (0) : "memory")
182#define dmb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
183 : : "r" (0) : "memory")
184#else
185#define isb() __asm__ __volatile__ ("" : : : "memory")
186#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
187 : : "r" (0) : "memory")
188#define dmb() __asm__ __volatile__ ("" : : : "memory")
189#endif
190
191#ifndef CONFIG_SMP
192#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
193#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
194#define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
195#define smp_mb() barrier()
196#define smp_rmb() barrier()
197#define smp_wmb() barrier()
198#else
199#define mb() dmb()
200#define rmb() dmb()
201#define wmb() dmb()
202#define smp_mb() dmb()
203#define smp_rmb() dmb()
204#define smp_wmb() dmb()
205#endif
206#define read_barrier_depends() do { } while(0)
207#define smp_read_barrier_depends() do { } while(0)
208
209#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
210#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
211
212extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
213extern unsigned long cr_alignment; /* defined in entry-armv.S */
214
215static inline unsigned int get_cr(void)
216{
217 unsigned int val;
218 asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
219 return val;
220}
221
222static inline void set_cr(unsigned int val)
223{
224 asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR"
225 : : "r" (val) : "cc");
226 isb();
227}
228
229#ifndef CONFIG_SMP
230extern void adjust_cr(unsigned long mask, unsigned long set);
231#endif
232
233#define CPACC_FULL(n) (3 << (n * 2))
234#define CPACC_SVC(n) (1 << (n * 2))
235#define CPACC_DISABLE(n) (0 << (n * 2))
236
237static inline unsigned int get_copro_access(void)
238{
239 unsigned int val;
240 asm("mrc p15, 0, %0, c1, c0, 2 @ get copro access"
241 : "=r" (val) : : "cc");
242 return val;
243}
244
245static inline void set_copro_access(unsigned int val)
246{
247 asm volatile("mcr p15, 0, %0, c1, c0, 2 @ set copro access"
248 : : "r" (val) : "cc");
249 isb();
250}
251
252/*
253 * switch_mm() may do a full cache flush over the context switch,
254 * so enable interrupts over the context switch to avoid high
255 * latency.
256 */
257#define __ARCH_WANT_INTERRUPTS_ON_CTXSW
258
259/*
260 * switch_to(prev, next) should switch from task `prev' to `next'
261 * `prev' will never be the same as `next'. schedule() itself
262 * contains the memory barrier to tell GCC not to cache `current'.
263 */
264extern struct task_struct *__switch_to(struct task_struct *, struct thread_info *, struct thread_info *);
265
266#define switch_to(prev,next,last) \
267do { \
268 last = __switch_to(prev,task_thread_info(prev), task_thread_info(next)); \
269} while (0)
270
271#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110)
272/*
273 * On the StrongARM, "swp" is terminally broken since it bypasses the
274 * cache totally. This means that the cache becomes inconsistent, and,
275 * since we use normal loads/stores as well, this is really bad.
276 * Typically, this causes oopsen in filp_close, but could have other,
277 * more disasterous effects. There are two work-arounds:
278 * 1. Disable interrupts and emulate the atomic swap
279 * 2. Clean the cache, perform atomic swap, flush the cache
280 *
281 * We choose (1) since its the "easiest" to achieve here and is not
282 * dependent on the processor type.
283 *
284 * NOTE that this solution won't work on an SMP system, so explcitly
285 * forbid it here.
286 */
287#define swp_is_buggy
288#endif
289
290static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
291{
292 extern void __bad_xchg(volatile void *, int);
293 unsigned long ret;
294#ifdef swp_is_buggy
295 unsigned long flags;
296#endif
297#if __LINUX_ARM_ARCH__ >= 6
298 unsigned int tmp;
299#endif
300
301 switch (size) {
302#if __LINUX_ARM_ARCH__ >= 6
303 case 1:
304 asm volatile("@ __xchg1\n"
305 "1: ldrexb %0, [%3]\n"
306 " strexb %1, %2, [%3]\n"
307 " teq %1, #0\n"
308 " bne 1b"
309 : "=&r" (ret), "=&r" (tmp)
310 : "r" (x), "r" (ptr)
311 : "memory", "cc");
312 break;
313 case 4:
314 asm volatile("@ __xchg4\n"
315 "1: ldrex %0, [%3]\n"
316 " strex %1, %2, [%3]\n"
317 " teq %1, #0\n"
318 " bne 1b"
319 : "=&r" (ret), "=&r" (tmp)
320 : "r" (x), "r" (ptr)
321 : "memory", "cc");
322 break;
323#elif defined(swp_is_buggy)
324#ifdef CONFIG_SMP
325#error SMP is not supported on this platform
326#endif
327 case 1:
328 raw_local_irq_save(flags);
329 ret = *(volatile unsigned char *)ptr;
330 *(volatile unsigned char *)ptr = x;
331 raw_local_irq_restore(flags);
332 break;
333
334 case 4:
335 raw_local_irq_save(flags);
336 ret = *(volatile unsigned long *)ptr;
337 *(volatile unsigned long *)ptr = x;
338 raw_local_irq_restore(flags);
339 break;
340#else
341 case 1:
342 asm volatile("@ __xchg1\n"
343 " swpb %0, %1, [%2]"
344 : "=&r" (ret)
345 : "r" (x), "r" (ptr)
346 : "memory", "cc");
347 break;
348 case 4:
349 asm volatile("@ __xchg4\n"
350 " swp %0, %1, [%2]"
351 : "=&r" (ret)
352 : "r" (x), "r" (ptr)
353 : "memory", "cc");
354 break;
355#endif
356 default:
357 __bad_xchg(ptr, size), ret = 0;
358 break;
359 }
360
361 return ret;
362}
363
364extern void disable_hlt(void);
365extern void enable_hlt(void);
366
367#include <asm-generic/cmpxchg-local.h>
368
369/*
370 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
371 * them available.
372 */
373#define cmpxchg_local(ptr, o, n) \
374 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
375 (unsigned long)(n), sizeof(*(ptr))))
376#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
377
378#ifndef CONFIG_SMP
379#include <asm-generic/cmpxchg.h>
380#endif
381
382#endif /* __ASSEMBLY__ */
383
384#define arch_align_stack(x) (x)
385
386#endif /* __KERNEL__ */
387
388#endif
diff --git a/arch/arm/include/asm/termbits.h b/arch/arm/include/asm/termbits.h
new file mode 100644
index 000000000000..f784d11f40b5
--- /dev/null
+++ b/arch/arm/include/asm/termbits.h
@@ -0,0 +1,197 @@
1#ifndef __ASM_ARM_TERMBITS_H
2#define __ASM_ARM_TERMBITS_H
3
4typedef unsigned char cc_t;
5typedef unsigned int speed_t;
6typedef unsigned int tcflag_t;
7
8#define NCCS 19
9struct termios {
10 tcflag_t c_iflag; /* input mode flags */
11 tcflag_t c_oflag; /* output mode flags */
12 tcflag_t c_cflag; /* control mode flags */
13 tcflag_t c_lflag; /* local mode flags */
14 cc_t c_line; /* line discipline */
15 cc_t c_cc[NCCS]; /* control characters */
16};
17
18struct termios2 {
19 tcflag_t c_iflag; /* input mode flags */
20 tcflag_t c_oflag; /* output mode flags */
21 tcflag_t c_cflag; /* control mode flags */
22 tcflag_t c_lflag; /* local mode flags */
23 cc_t c_line; /* line discipline */
24 cc_t c_cc[NCCS]; /* control characters */
25 speed_t c_ispeed; /* input speed */
26 speed_t c_ospeed; /* output speed */
27};
28
29struct ktermios {
30 tcflag_t c_iflag; /* input mode flags */
31 tcflag_t c_oflag; /* output mode flags */
32 tcflag_t c_cflag; /* control mode flags */
33 tcflag_t c_lflag; /* local mode flags */
34 cc_t c_line; /* line discipline */
35 cc_t c_cc[NCCS]; /* control characters */
36 speed_t c_ispeed; /* input speed */
37 speed_t c_ospeed; /* output speed */
38};
39
40
41/* c_cc characters */
42#define VINTR 0
43#define VQUIT 1
44#define VERASE 2
45#define VKILL 3
46#define VEOF 4
47#define VTIME 5
48#define VMIN 6
49#define VSWTC 7
50#define VSTART 8
51#define VSTOP 9
52#define VSUSP 10
53#define VEOL 11
54#define VREPRINT 12
55#define VDISCARD 13
56#define VWERASE 14
57#define VLNEXT 15
58#define VEOL2 16
59
60/* c_iflag bits */
61#define IGNBRK 0000001
62#define BRKINT 0000002
63#define IGNPAR 0000004
64#define PARMRK 0000010
65#define INPCK 0000020
66#define ISTRIP 0000040
67#define INLCR 0000100
68#define IGNCR 0000200
69#define ICRNL 0000400
70#define IUCLC 0001000
71#define IXON 0002000
72#define IXANY 0004000
73#define IXOFF 0010000
74#define IMAXBEL 0020000
75#define IUTF8 0040000
76
77/* c_oflag bits */
78#define OPOST 0000001
79#define OLCUC 0000002
80#define ONLCR 0000004
81#define OCRNL 0000010
82#define ONOCR 0000020
83#define ONLRET 0000040
84#define OFILL 0000100
85#define OFDEL 0000200
86#define NLDLY 0000400
87#define NL0 0000000
88#define NL1 0000400
89#define CRDLY 0003000
90#define CR0 0000000
91#define CR1 0001000
92#define CR2 0002000
93#define CR3 0003000
94#define TABDLY 0014000
95#define TAB0 0000000
96#define TAB1 0004000
97#define TAB2 0010000
98#define TAB3 0014000
99#define XTABS 0014000
100#define BSDLY 0020000
101#define BS0 0000000
102#define BS1 0020000
103#define VTDLY 0040000
104#define VT0 0000000
105#define VT1 0040000
106#define FFDLY 0100000
107#define FF0 0000000
108#define FF1 0100000
109
110/* c_cflag bit meaning */
111#define CBAUD 0010017
112#define B0 0000000 /* hang up */
113#define B50 0000001
114#define B75 0000002
115#define B110 0000003
116#define B134 0000004
117#define B150 0000005
118#define B200 0000006
119#define B300 0000007
120#define B600 0000010
121#define B1200 0000011
122#define B1800 0000012
123#define B2400 0000013
124#define B4800 0000014
125#define B9600 0000015
126#define B19200 0000016
127#define B38400 0000017
128#define EXTA B19200
129#define EXTB B38400
130#define CSIZE 0000060
131#define CS5 0000000
132#define CS6 0000020
133#define CS7 0000040
134#define CS8 0000060
135#define CSTOPB 0000100
136#define CREAD 0000200
137#define PARENB 0000400
138#define PARODD 0001000
139#define HUPCL 0002000
140#define CLOCAL 0004000
141#define CBAUDEX 0010000
142#define BOTHER 0010000
143#define B57600 0010001
144#define B115200 0010002
145#define B230400 0010003
146#define B460800 0010004
147#define B500000 0010005
148#define B576000 0010006
149#define B921600 0010007
150#define B1000000 0010010
151#define B1152000 0010011
152#define B1500000 0010012
153#define B2000000 0010013
154#define B2500000 0010014
155#define B3000000 0010015
156#define B3500000 0010016
157#define B4000000 0010017
158#define CIBAUD 002003600000 /* input baud rate */
159#define CMSPAR 010000000000 /* mark or space (stick) parity */
160#define CRTSCTS 020000000000 /* flow control */
161
162#define IBSHIFT 16
163
164/* c_lflag bits */
165#define ISIG 0000001
166#define ICANON 0000002
167#define XCASE 0000004
168#define ECHO 0000010
169#define ECHOE 0000020
170#define ECHOK 0000040
171#define ECHONL 0000100
172#define NOFLSH 0000200
173#define TOSTOP 0000400
174#define ECHOCTL 0001000
175#define ECHOPRT 0002000
176#define ECHOKE 0004000
177#define FLUSHO 0010000
178#define PENDIN 0040000
179#define IEXTEN 0100000
180
181/* tcflow() and TCXONC use these */
182#define TCOOFF 0
183#define TCOON 1
184#define TCIOFF 2
185#define TCION 3
186
187/* tcflush() and TCFLSH use these */
188#define TCIFLUSH 0
189#define TCOFLUSH 1
190#define TCIOFLUSH 2
191
192/* tcsetattr uses these */
193#define TCSANOW 0
194#define TCSADRAIN 1
195#define TCSAFLUSH 2
196
197#endif /* __ASM_ARM_TERMBITS_H */
diff --git a/arch/arm/include/asm/termios.h b/arch/arm/include/asm/termios.h
new file mode 100644
index 000000000000..293e3f1bc3f2
--- /dev/null
+++ b/arch/arm/include/asm/termios.h
@@ -0,0 +1,92 @@
1#ifndef __ASM_ARM_TERMIOS_H
2#define __ASM_ARM_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24#ifdef __KERNEL__
25/* intr=^C quit=^| erase=del kill=^U
26 eof=^D vtime=\0 vmin=\1 sxtc=\0
27 start=^Q stop=^S susp=^Z eol=\0
28 reprint=^R discard=^U werase=^W lnext=^V
29 eol2=\0
30*/
31#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
32#endif
33
34/* modem lines */
35#define TIOCM_LE 0x001
36#define TIOCM_DTR 0x002
37#define TIOCM_RTS 0x004
38#define TIOCM_ST 0x008
39#define TIOCM_SR 0x010
40#define TIOCM_CTS 0x020
41#define TIOCM_CAR 0x040
42#define TIOCM_RNG 0x080
43#define TIOCM_DSR 0x100
44#define TIOCM_CD TIOCM_CAR
45#define TIOCM_RI TIOCM_RNG
46#define TIOCM_OUT1 0x2000
47#define TIOCM_OUT2 0x4000
48#define TIOCM_LOOP 0x8000
49
50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
51
52#ifdef __KERNEL__
53
54/*
55 * Translate a "termio" structure into a "termios". Ugh.
56 */
57#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
58 unsigned short __tmp; \
59 get_user(__tmp,&(termio)->x); \
60 *(unsigned short *) &(termios)->x = __tmp; \
61}
62
63#define user_termio_to_kernel_termios(termios, termio) \
64({ \
65 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
66 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
67 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
68 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
69 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
70})
71
72/*
73 * Translate a "termios" structure into a "termio". Ugh.
74 */
75#define kernel_termios_to_user_termio(termio, termios) \
76({ \
77 put_user((termios)->c_iflag, &(termio)->c_iflag); \
78 put_user((termios)->c_oflag, &(termio)->c_oflag); \
79 put_user((termios)->c_cflag, &(termio)->c_cflag); \
80 put_user((termios)->c_lflag, &(termio)->c_lflag); \
81 put_user((termios)->c_line, &(termio)->c_line); \
82 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
83})
84
85#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
86#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
87#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
88#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
89
90#endif /* __KERNEL__ */
91
92#endif /* __ASM_ARM_TERMIOS_H */
diff --git a/arch/arm/include/asm/therm.h b/arch/arm/include/asm/therm.h
new file mode 100644
index 000000000000..f002f0197d78
--- /dev/null
+++ b/arch/arm/include/asm/therm.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/include/asm/therm.h: Definitions for Dallas Semiconductor
3 * DS1620 thermometer driver (as used in the Rebel.com NetWinder)
4 */
5#ifndef __ASM_THERM_H
6#define __ASM_THERM_H
7
8/* ioctl numbers for /dev/therm */
9#define CMD_SET_THERMOSTATE 0x53
10#define CMD_GET_THERMOSTATE 0x54
11#define CMD_GET_STATUS 0x56
12#define CMD_GET_TEMPERATURE 0x57
13#define CMD_SET_THERMOSTATE2 0x58
14#define CMD_GET_THERMOSTATE2 0x59
15#define CMD_GET_TEMPERATURE2 0x5a
16#define CMD_GET_FAN 0x5b
17#define CMD_SET_FAN 0x5c
18
19#define FAN_OFF 0
20#define FAN_ON 1
21#define FAN_ALWAYS_ON 2
22
23struct therm {
24 int hi;
25 int lo;
26};
27
28#endif
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
new file mode 100644
index 000000000000..e56fa48e4ae7
--- /dev/null
+++ b/arch/arm/include/asm/thread_info.h
@@ -0,0 +1,153 @@
1/*
2 * arch/arm/include/asm/thread_info.h
3 *
4 * Copyright (C) 2002 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_THREAD_INFO_H
11#define __ASM_ARM_THREAD_INFO_H
12
13#ifdef __KERNEL__
14
15#include <linux/compiler.h>
16#include <asm/fpstate.h>
17
18#define THREAD_SIZE_ORDER 1
19#define THREAD_SIZE 8192
20#define THREAD_START_SP (THREAD_SIZE - 8)
21
22#ifndef __ASSEMBLY__
23
24struct task_struct;
25struct exec_domain;
26
27#include <asm/types.h>
28#include <asm/domain.h>
29
30typedef unsigned long mm_segment_t;
31
32struct cpu_context_save {
33 __u32 r4;
34 __u32 r5;
35 __u32 r6;
36 __u32 r7;
37 __u32 r8;
38 __u32 r9;
39 __u32 sl;
40 __u32 fp;
41 __u32 sp;
42 __u32 pc;
43 __u32 extra[2]; /* Xscale 'acc' register, etc */
44};
45
46/*
47 * low level task data that entry.S needs immediate access to.
48 * __switch_to() assumes cpu_context follows immediately after cpu_domain.
49 */
50struct thread_info {
51 unsigned long flags; /* low level flags */
52 int preempt_count; /* 0 => preemptable, <0 => bug */
53 mm_segment_t addr_limit; /* address limit */
54 struct task_struct *task; /* main task structure */
55 struct exec_domain *exec_domain; /* execution domain */
56 __u32 cpu; /* cpu */
57 __u32 cpu_domain; /* cpu domain */
58 struct cpu_context_save cpu_context; /* cpu context */
59 __u32 syscall; /* syscall number */
60 __u8 used_cp[16]; /* thread used copro */
61 unsigned long tp_value;
62 struct crunch_state crunchstate;
63 union fp_state fpstate __attribute__((aligned(8)));
64 union vfp_state vfpstate;
65#ifdef CONFIG_ARM_THUMBEE
66 unsigned long thumbee_state; /* ThumbEE Handler Base register */
67#endif
68 struct restart_block restart_block;
69};
70
71#define INIT_THREAD_INFO(tsk) \
72{ \
73 .task = &tsk, \
74 .exec_domain = &default_exec_domain, \
75 .flags = 0, \
76 .preempt_count = 1, \
77 .addr_limit = KERNEL_DS, \
78 .cpu_domain = domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \
79 domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \
80 domain_val(DOMAIN_IO, DOMAIN_CLIENT), \
81 .restart_block = { \
82 .fn = do_no_restart_syscall, \
83 }, \
84}
85
86#define init_thread_info (init_thread_union.thread_info)
87#define init_stack (init_thread_union.stack)
88
89/*
90 * how to get the thread information struct from C
91 */
92static inline struct thread_info *current_thread_info(void) __attribute_const__;
93
94static inline struct thread_info *current_thread_info(void)
95{
96 register unsigned long sp asm ("sp");
97 return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
98}
99
100#define thread_saved_pc(tsk) \
101 ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
102#define thread_saved_fp(tsk) \
103 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
104
105extern void crunch_task_disable(struct thread_info *);
106extern void crunch_task_copy(struct thread_info *, void *);
107extern void crunch_task_restore(struct thread_info *, void *);
108extern void crunch_task_release(struct thread_info *);
109
110extern void iwmmxt_task_disable(struct thread_info *);
111extern void iwmmxt_task_copy(struct thread_info *, void *);
112extern void iwmmxt_task_restore(struct thread_info *, void *);
113extern void iwmmxt_task_release(struct thread_info *);
114extern void iwmmxt_task_switch(struct thread_info *);
115
116#endif
117
118/*
119 * We use bit 30 of the preempt_count to indicate that kernel
120 * preemption is occurring. See <asm/hardirq.h>.
121 */
122#define PREEMPT_ACTIVE 0x40000000
123
124/*
125 * thread information flags:
126 * TIF_SYSCALL_TRACE - syscall trace active
127 * TIF_SIGPENDING - signal pending
128 * TIF_NEED_RESCHED - rescheduling necessary
129 * TIF_USEDFPU - FPU was used by this task this quantum (SMP)
130 * TIF_POLLING_NRFLAG - true if poll_idle() is polling TIF_NEED_RESCHED
131 */
132#define TIF_SIGPENDING 0
133#define TIF_NEED_RESCHED 1
134#define TIF_SYSCALL_TRACE 8
135#define TIF_POLLING_NRFLAG 16
136#define TIF_USING_IWMMXT 17
137#define TIF_MEMDIE 18
138#define TIF_FREEZE 19
139
140#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
141#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
142#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
143#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
144#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
145#define _TIF_FREEZE (1 << TIF_FREEZE)
146
147/*
148 * Change these and you break ASM code in entry-common.S
149 */
150#define _TIF_WORK_MASK 0x000000ff
151
152#endif /* __KERNEL__ */
153#endif /* __ASM_ARM_THREAD_INFO_H */
diff --git a/arch/arm/include/asm/thread_notify.h b/arch/arm/include/asm/thread_notify.h
new file mode 100644
index 000000000000..f27379d7f72a
--- /dev/null
+++ b/arch/arm/include/asm/thread_notify.h
@@ -0,0 +1,48 @@
1/*
2 * arch/arm/include/asm/thread_notify.h
3 *
4 * Copyright (C) 2006 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef ASMARM_THREAD_NOTIFY_H
11#define ASMARM_THREAD_NOTIFY_H
12
13#ifdef __KERNEL__
14
15#ifndef __ASSEMBLY__
16
17#include <linux/notifier.h>
18#include <asm/thread_info.h>
19
20static inline int thread_register_notifier(struct notifier_block *n)
21{
22 extern struct atomic_notifier_head thread_notify_head;
23 return atomic_notifier_chain_register(&thread_notify_head, n);
24}
25
26static inline void thread_unregister_notifier(struct notifier_block *n)
27{
28 extern struct atomic_notifier_head thread_notify_head;
29 atomic_notifier_chain_unregister(&thread_notify_head, n);
30}
31
32static inline void thread_notify(unsigned long rc, struct thread_info *thread)
33{
34 extern struct atomic_notifier_head thread_notify_head;
35 atomic_notifier_call_chain(&thread_notify_head, rc, thread);
36}
37
38#endif
39
40/*
41 * These are the reason codes for the thread notifier.
42 */
43#define THREAD_NOTIFY_FLUSH 0
44#define THREAD_NOTIFY_RELEASE 1
45#define THREAD_NOTIFY_SWITCH 2
46
47#endif
48#endif
diff --git a/arch/arm/include/asm/timex.h b/arch/arm/include/asm/timex.h
new file mode 100644
index 000000000000..3be8de3adaba
--- /dev/null
+++ b/arch/arm/include/asm/timex.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/include/asm/timex.h
3 *
4 * Copyright (C) 1997,1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Architecture Specific TIME specifications
11 */
12#ifndef _ASMARM_TIMEX_H
13#define _ASMARM_TIMEX_H
14
15#include <mach/timex.h>
16
17typedef unsigned long cycles_t;
18
19static inline cycles_t get_cycles (void)
20{
21 return 0;
22}
23
24#endif
diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h
new file mode 100644
index 000000000000..857f1dfac794
--- /dev/null
+++ b/arch/arm/include/asm/tlb.h
@@ -0,0 +1,94 @@
1/*
2 * arch/arm/include/asm/tlb.h
3 *
4 * Copyright (C) 2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Experimentation shows that on a StrongARM, it appears to be faster
11 * to use the "invalidate whole tlb" rather than "invalidate single
12 * tlb" for this.
13 *
14 * This appears true for both the process fork+exit case, as well as
15 * the munmap-large-area case.
16 */
17#ifndef __ASMARM_TLB_H
18#define __ASMARM_TLB_H
19
20#include <asm/cacheflush.h>
21#include <asm/tlbflush.h>
22
23#ifndef CONFIG_MMU
24
25#include <linux/pagemap.h>
26#include <asm-generic/tlb.h>
27
28#else /* !CONFIG_MMU */
29
30#include <asm/pgalloc.h>
31
32/*
33 * TLB handling. This allows us to remove pages from the page
34 * tables, and efficiently handle the TLB issues.
35 */
36struct mmu_gather {
37 struct mm_struct *mm;
38 unsigned int fullmm;
39};
40
41DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
42
43static inline struct mmu_gather *
44tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
45{
46 struct mmu_gather *tlb = &get_cpu_var(mmu_gathers);
47
48 tlb->mm = mm;
49 tlb->fullmm = full_mm_flush;
50
51 return tlb;
52}
53
54static inline void
55tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
56{
57 if (tlb->fullmm)
58 flush_tlb_mm(tlb->mm);
59
60 /* keep the page table cache within bounds */
61 check_pgt_cache();
62
63 put_cpu_var(mmu_gathers);
64}
65
66#define tlb_remove_tlb_entry(tlb,ptep,address) do { } while (0)
67
68/*
69 * In the case of tlb vma handling, we can optimise these away in the
70 * case where we're doing a full MM flush. When we're doing a munmap,
71 * the vmas are adjusted to only cover the region to be torn down.
72 */
73static inline void
74tlb_start_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
75{
76 if (!tlb->fullmm)
77 flush_cache_range(vma, vma->vm_start, vma->vm_end);
78}
79
80static inline void
81tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
82{
83 if (!tlb->fullmm)
84 flush_tlb_range(vma, vma->vm_start, vma->vm_end);
85}
86
87#define tlb_remove_page(tlb,page) free_page_and_swap_cache(page)
88#define pte_free_tlb(tlb, ptep) pte_free((tlb)->mm, ptep)
89#define pmd_free_tlb(tlb, pmdp) pmd_free((tlb)->mm, pmdp)
90
91#define tlb_migrate_finish(mm) do { } while (0)
92
93#endif /* CONFIG_MMU */
94#endif
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
new file mode 100644
index 000000000000..0d0d40f1b599
--- /dev/null
+++ b/arch/arm/include/asm/tlbflush.h
@@ -0,0 +1,500 @@
1/*
2 * arch/arm/include/asm/tlbflush.h
3 *
4 * Copyright (C) 1999-2003 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _ASMARM_TLBFLUSH_H
11#define _ASMARM_TLBFLUSH_H
12
13
14#ifndef CONFIG_MMU
15
16#define tlb_flush(tlb) ((void) tlb)
17
18#else /* CONFIG_MMU */
19
20#include <asm/glue.h>
21
22#define TLB_V3_PAGE (1 << 0)
23#define TLB_V4_U_PAGE (1 << 1)
24#define TLB_V4_D_PAGE (1 << 2)
25#define TLB_V4_I_PAGE (1 << 3)
26#define TLB_V6_U_PAGE (1 << 4)
27#define TLB_V6_D_PAGE (1 << 5)
28#define TLB_V6_I_PAGE (1 << 6)
29
30#define TLB_V3_FULL (1 << 8)
31#define TLB_V4_U_FULL (1 << 9)
32#define TLB_V4_D_FULL (1 << 10)
33#define TLB_V4_I_FULL (1 << 11)
34#define TLB_V6_U_FULL (1 << 12)
35#define TLB_V6_D_FULL (1 << 13)
36#define TLB_V6_I_FULL (1 << 14)
37
38#define TLB_V6_U_ASID (1 << 16)
39#define TLB_V6_D_ASID (1 << 17)
40#define TLB_V6_I_ASID (1 << 18)
41
42#define TLB_L2CLEAN_FR (1 << 29) /* Feroceon */
43#define TLB_DCLEAN (1 << 30)
44#define TLB_WB (1 << 31)
45
46/*
47 * MMU TLB Model
48 * =============
49 *
50 * We have the following to choose from:
51 * v3 - ARMv3
52 * v4 - ARMv4 without write buffer
53 * v4wb - ARMv4 with write buffer without I TLB flush entry instruction
54 * v4wbi - ARMv4 with write buffer with I TLB flush entry instruction
55 * fr - Feroceon (v4wbi with non-outer-cacheable page table walks)
56 * v6wbi - ARMv6 with write buffer with I TLB flush entry instruction
57 */
58#undef _TLB
59#undef MULTI_TLB
60
61#define v3_tlb_flags (TLB_V3_FULL | TLB_V3_PAGE)
62
63#ifdef CONFIG_CPU_TLB_V3
64# define v3_possible_flags v3_tlb_flags
65# define v3_always_flags v3_tlb_flags
66# ifdef _TLB
67# define MULTI_TLB 1
68# else
69# define _TLB v3
70# endif
71#else
72# define v3_possible_flags 0
73# define v3_always_flags (-1UL)
74#endif
75
76#define v4_tlb_flags (TLB_V4_U_FULL | TLB_V4_U_PAGE)
77
78#ifdef CONFIG_CPU_TLB_V4WT
79# define v4_possible_flags v4_tlb_flags
80# define v4_always_flags v4_tlb_flags
81# ifdef _TLB
82# define MULTI_TLB 1
83# else
84# define _TLB v4
85# endif
86#else
87# define v4_possible_flags 0
88# define v4_always_flags (-1UL)
89#endif
90
91#define v4wbi_tlb_flags (TLB_WB | TLB_DCLEAN | \
92 TLB_V4_I_FULL | TLB_V4_D_FULL | \
93 TLB_V4_I_PAGE | TLB_V4_D_PAGE)
94
95#ifdef CONFIG_CPU_TLB_V4WBI
96# define v4wbi_possible_flags v4wbi_tlb_flags
97# define v4wbi_always_flags v4wbi_tlb_flags
98# ifdef _TLB
99# define MULTI_TLB 1
100# else
101# define _TLB v4wbi
102# endif
103#else
104# define v4wbi_possible_flags 0
105# define v4wbi_always_flags (-1UL)
106#endif
107
108#define fr_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_L2CLEAN_FR | \
109 TLB_V4_I_FULL | TLB_V4_D_FULL | \
110 TLB_V4_I_PAGE | TLB_V4_D_PAGE)
111
112#ifdef CONFIG_CPU_TLB_FEROCEON
113# define fr_possible_flags fr_tlb_flags
114# define fr_always_flags fr_tlb_flags
115# ifdef _TLB
116# define MULTI_TLB 1
117# else
118# define _TLB v4wbi
119# endif
120#else
121# define fr_possible_flags 0
122# define fr_always_flags (-1UL)
123#endif
124
125#define v4wb_tlb_flags (TLB_WB | TLB_DCLEAN | \
126 TLB_V4_I_FULL | TLB_V4_D_FULL | \
127 TLB_V4_D_PAGE)
128
129#ifdef CONFIG_CPU_TLB_V4WB
130# define v4wb_possible_flags v4wb_tlb_flags
131# define v4wb_always_flags v4wb_tlb_flags
132# ifdef _TLB
133# define MULTI_TLB 1
134# else
135# define _TLB v4wb
136# endif
137#else
138# define v4wb_possible_flags 0
139# define v4wb_always_flags (-1UL)
140#endif
141
142#define v6wbi_tlb_flags (TLB_WB | TLB_DCLEAN | \
143 TLB_V6_I_FULL | TLB_V6_D_FULL | \
144 TLB_V6_I_PAGE | TLB_V6_D_PAGE | \
145 TLB_V6_I_ASID | TLB_V6_D_ASID)
146
147#ifdef CONFIG_CPU_TLB_V6
148# define v6wbi_possible_flags v6wbi_tlb_flags
149# define v6wbi_always_flags v6wbi_tlb_flags
150# ifdef _TLB
151# define MULTI_TLB 1
152# else
153# define _TLB v6wbi
154# endif
155#else
156# define v6wbi_possible_flags 0
157# define v6wbi_always_flags (-1UL)
158#endif
159
160#ifdef CONFIG_CPU_TLB_V7
161# define v7wbi_possible_flags v6wbi_tlb_flags
162# define v7wbi_always_flags v6wbi_tlb_flags
163# ifdef _TLB
164# define MULTI_TLB 1
165# else
166# define _TLB v7wbi
167# endif
168#else
169# define v7wbi_possible_flags 0
170# define v7wbi_always_flags (-1UL)
171#endif
172
173#ifndef _TLB
174#error Unknown TLB model
175#endif
176
177#ifndef __ASSEMBLY__
178
179#include <linux/sched.h>
180
181struct cpu_tlb_fns {
182 void (*flush_user_range)(unsigned long, unsigned long, struct vm_area_struct *);
183 void (*flush_kern_range)(unsigned long, unsigned long);
184 unsigned long tlb_flags;
185};
186
187/*
188 * Select the calling method
189 */
190#ifdef MULTI_TLB
191
192#define __cpu_flush_user_tlb_range cpu_tlb.flush_user_range
193#define __cpu_flush_kern_tlb_range cpu_tlb.flush_kern_range
194
195#else
196
197#define __cpu_flush_user_tlb_range __glue(_TLB,_flush_user_tlb_range)
198#define __cpu_flush_kern_tlb_range __glue(_TLB,_flush_kern_tlb_range)
199
200extern void __cpu_flush_user_tlb_range(unsigned long, unsigned long, struct vm_area_struct *);
201extern void __cpu_flush_kern_tlb_range(unsigned long, unsigned long);
202
203#endif
204
205extern struct cpu_tlb_fns cpu_tlb;
206
207#define __cpu_tlb_flags cpu_tlb.tlb_flags
208
209/*
210 * TLB Management
211 * ==============
212 *
213 * The arch/arm/mm/tlb-*.S files implement these methods.
214 *
215 * The TLB specific code is expected to perform whatever tests it
216 * needs to determine if it should invalidate the TLB for each
217 * call. Start addresses are inclusive and end addresses are
218 * exclusive; it is safe to round these addresses down.
219 *
220 * flush_tlb_all()
221 *
222 * Invalidate the entire TLB.
223 *
224 * flush_tlb_mm(mm)
225 *
226 * Invalidate all TLB entries in a particular address
227 * space.
228 * - mm - mm_struct describing address space
229 *
230 * flush_tlb_range(mm,start,end)
231 *
232 * Invalidate a range of TLB entries in the specified
233 * address space.
234 * - mm - mm_struct describing address space
235 * - start - start address (may not be aligned)
236 * - end - end address (exclusive, may not be aligned)
237 *
238 * flush_tlb_page(vaddr,vma)
239 *
240 * Invalidate the specified page in the specified address range.
241 * - vaddr - virtual address (may not be aligned)
242 * - vma - vma_struct describing address range
243 *
244 * flush_kern_tlb_page(kaddr)
245 *
246 * Invalidate the TLB entry for the specified page. The address
247 * will be in the kernels virtual memory space. Current uses
248 * only require the D-TLB to be invalidated.
249 * - kaddr - Kernel virtual memory address
250 */
251
252/*
253 * We optimise the code below by:
254 * - building a set of TLB flags that might be set in __cpu_tlb_flags
255 * - building a set of TLB flags that will always be set in __cpu_tlb_flags
256 * - if we're going to need __cpu_tlb_flags, access it once and only once
257 *
258 * This allows us to build optimal assembly for the single-CPU type case,
259 * and as close to optimal given the compiler constrants for multi-CPU
260 * case. We could do better for the multi-CPU case if the compiler
261 * implemented the "%?" method, but this has been discontinued due to too
262 * many people getting it wrong.
263 */
264#define possible_tlb_flags (v3_possible_flags | \
265 v4_possible_flags | \
266 v4wbi_possible_flags | \
267 fr_possible_flags | \
268 v4wb_possible_flags | \
269 v6wbi_possible_flags)
270
271#define always_tlb_flags (v3_always_flags & \
272 v4_always_flags & \
273 v4wbi_always_flags & \
274 fr_always_flags & \
275 v4wb_always_flags & \
276 v6wbi_always_flags)
277
278#define tlb_flag(f) ((always_tlb_flags & (f)) || (__tlb_flag & possible_tlb_flags & (f)))
279
280static inline void local_flush_tlb_all(void)
281{
282 const int zero = 0;
283 const unsigned int __tlb_flag = __cpu_tlb_flags;
284
285 if (tlb_flag(TLB_WB))
286 dsb();
287
288 if (tlb_flag(TLB_V3_FULL))
289 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc");
290 if (tlb_flag(TLB_V4_U_FULL | TLB_V6_U_FULL))
291 asm("mcr p15, 0, %0, c8, c7, 0" : : "r" (zero) : "cc");
292 if (tlb_flag(TLB_V4_D_FULL | TLB_V6_D_FULL))
293 asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc");
294 if (tlb_flag(TLB_V4_I_FULL | TLB_V6_I_FULL))
295 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
296
297 if (tlb_flag(TLB_V6_I_FULL | TLB_V6_D_FULL |
298 TLB_V6_I_PAGE | TLB_V6_D_PAGE |
299 TLB_V6_I_ASID | TLB_V6_D_ASID)) {
300 /* flush the branch target cache */
301 asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc");
302 dsb();
303 isb();
304 }
305}
306
307static inline void local_flush_tlb_mm(struct mm_struct *mm)
308{
309 const int zero = 0;
310 const int asid = ASID(mm);
311 const unsigned int __tlb_flag = __cpu_tlb_flags;
312
313 if (tlb_flag(TLB_WB))
314 dsb();
315
316 if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask)) {
317 if (tlb_flag(TLB_V3_FULL))
318 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc");
319 if (tlb_flag(TLB_V4_U_FULL))
320 asm("mcr p15, 0, %0, c8, c7, 0" : : "r" (zero) : "cc");
321 if (tlb_flag(TLB_V4_D_FULL))
322 asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc");
323 if (tlb_flag(TLB_V4_I_FULL))
324 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
325 }
326
327 if (tlb_flag(TLB_V6_U_ASID))
328 asm("mcr p15, 0, %0, c8, c7, 2" : : "r" (asid) : "cc");
329 if (tlb_flag(TLB_V6_D_ASID))
330 asm("mcr p15, 0, %0, c8, c6, 2" : : "r" (asid) : "cc");
331 if (tlb_flag(TLB_V6_I_ASID))
332 asm("mcr p15, 0, %0, c8, c5, 2" : : "r" (asid) : "cc");
333
334 if (tlb_flag(TLB_V6_I_FULL | TLB_V6_D_FULL |
335 TLB_V6_I_PAGE | TLB_V6_D_PAGE |
336 TLB_V6_I_ASID | TLB_V6_D_ASID)) {
337 /* flush the branch target cache */
338 asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc");
339 dsb();
340 }
341}
342
343static inline void
344local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
345{
346 const int zero = 0;
347 const unsigned int __tlb_flag = __cpu_tlb_flags;
348
349 uaddr = (uaddr & PAGE_MASK) | ASID(vma->vm_mm);
350
351 if (tlb_flag(TLB_WB))
352 dsb();
353
354 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) {
355 if (tlb_flag(TLB_V3_PAGE))
356 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (uaddr) : "cc");
357 if (tlb_flag(TLB_V4_U_PAGE))
358 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (uaddr) : "cc");
359 if (tlb_flag(TLB_V4_D_PAGE))
360 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc");
361 if (tlb_flag(TLB_V4_I_PAGE))
362 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc");
363 if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL))
364 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
365 }
366
367 if (tlb_flag(TLB_V6_U_PAGE))
368 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (uaddr) : "cc");
369 if (tlb_flag(TLB_V6_D_PAGE))
370 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc");
371 if (tlb_flag(TLB_V6_I_PAGE))
372 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc");
373
374 if (tlb_flag(TLB_V6_I_FULL | TLB_V6_D_FULL |
375 TLB_V6_I_PAGE | TLB_V6_D_PAGE |
376 TLB_V6_I_ASID | TLB_V6_D_ASID)) {
377 /* flush the branch target cache */
378 asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc");
379 dsb();
380 }
381}
382
383static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
384{
385 const int zero = 0;
386 const unsigned int __tlb_flag = __cpu_tlb_flags;
387
388 kaddr &= PAGE_MASK;
389
390 if (tlb_flag(TLB_WB))
391 dsb();
392
393 if (tlb_flag(TLB_V3_PAGE))
394 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (kaddr) : "cc");
395 if (tlb_flag(TLB_V4_U_PAGE))
396 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (kaddr) : "cc");
397 if (tlb_flag(TLB_V4_D_PAGE))
398 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc");
399 if (tlb_flag(TLB_V4_I_PAGE))
400 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc");
401 if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL))
402 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
403
404 if (tlb_flag(TLB_V6_U_PAGE))
405 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (kaddr) : "cc");
406 if (tlb_flag(TLB_V6_D_PAGE))
407 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc");
408 if (tlb_flag(TLB_V6_I_PAGE))
409 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc");
410
411 if (tlb_flag(TLB_V6_I_FULL | TLB_V6_D_FULL |
412 TLB_V6_I_PAGE | TLB_V6_D_PAGE |
413 TLB_V6_I_ASID | TLB_V6_D_ASID)) {
414 /* flush the branch target cache */
415 asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc");
416 dsb();
417 isb();
418 }
419}
420
421/*
422 * flush_pmd_entry
423 *
424 * Flush a PMD entry (word aligned, or double-word aligned) to
425 * RAM if the TLB for the CPU we are running on requires this.
426 * This is typically used when we are creating PMD entries.
427 *
428 * clean_pmd_entry
429 *
430 * Clean (but don't drain the write buffer) if the CPU requires
431 * these operations. This is typically used when we are removing
432 * PMD entries.
433 */
434static inline void flush_pmd_entry(pmd_t *pmd)
435{
436 const unsigned int __tlb_flag = __cpu_tlb_flags;
437
438 if (tlb_flag(TLB_DCLEAN))
439 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd"
440 : : "r" (pmd) : "cc");
441
442 if (tlb_flag(TLB_L2CLEAN_FR))
443 asm("mcr p15, 1, %0, c15, c9, 1 @ L2 flush_pmd"
444 : : "r" (pmd) : "cc");
445
446 if (tlb_flag(TLB_WB))
447 dsb();
448}
449
450static inline void clean_pmd_entry(pmd_t *pmd)
451{
452 const unsigned int __tlb_flag = __cpu_tlb_flags;
453
454 if (tlb_flag(TLB_DCLEAN))
455 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd"
456 : : "r" (pmd) : "cc");
457
458 if (tlb_flag(TLB_L2CLEAN_FR))
459 asm("mcr p15, 1, %0, c15, c9, 1 @ L2 flush_pmd"
460 : : "r" (pmd) : "cc");
461}
462
463#undef tlb_flag
464#undef always_tlb_flags
465#undef possible_tlb_flags
466
467/*
468 * Convert calls to our calling convention.
469 */
470#define local_flush_tlb_range(vma,start,end) __cpu_flush_user_tlb_range(start,end,vma)
471#define local_flush_tlb_kernel_range(s,e) __cpu_flush_kern_tlb_range(s,e)
472
473#ifndef CONFIG_SMP
474#define flush_tlb_all local_flush_tlb_all
475#define flush_tlb_mm local_flush_tlb_mm
476#define flush_tlb_page local_flush_tlb_page
477#define flush_tlb_kernel_page local_flush_tlb_kernel_page
478#define flush_tlb_range local_flush_tlb_range
479#define flush_tlb_kernel_range local_flush_tlb_kernel_range
480#else
481extern void flush_tlb_all(void);
482extern void flush_tlb_mm(struct mm_struct *mm);
483extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr);
484extern void flush_tlb_kernel_page(unsigned long kaddr);
485extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
486extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
487#endif
488
489/*
490 * if PG_dcache_dirty is set for the page, we need to ensure that any
491 * cache entries for the kernels virtual memory range are written
492 * back to the page.
493 */
494extern void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte);
495
496#endif
497
498#endif /* CONFIG_MMU */
499
500#endif
diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h
new file mode 100644
index 000000000000..accbd7cad9b5
--- /dev/null
+++ b/arch/arm/include/asm/topology.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_ARM_TOPOLOGY_H
2#define _ASM_ARM_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* _ASM_ARM_TOPOLOGY_H */
diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h
new file mode 100644
index 000000000000..aa399aec568e
--- /dev/null
+++ b/arch/arm/include/asm/traps.h
@@ -0,0 +1,29 @@
1#ifndef _ASMARM_TRAP_H
2#define _ASMARM_TRAP_H
3
4#include <linux/list.h>
5
6struct undef_hook {
7 struct list_head node;
8 u32 instr_mask;
9 u32 instr_val;
10 u32 cpsr_mask;
11 u32 cpsr_val;
12 int (*fn)(struct pt_regs *regs, unsigned int instr);
13};
14
15void register_undef_hook(struct undef_hook *hook);
16void unregister_undef_hook(struct undef_hook *hook);
17
18static inline int in_exception_text(unsigned long ptr)
19{
20 extern char __exception_text_start[];
21 extern char __exception_text_end[];
22
23 return ptr >= (unsigned long)&__exception_text_start &&
24 ptr < (unsigned long)&__exception_text_end;
25}
26
27extern void __init early_trap_init(void);
28
29#endif
diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
new file mode 100644
index 000000000000..345df01534a4
--- /dev/null
+++ b/arch/arm/include/asm/types.h
@@ -0,0 +1,31 @@
1#ifndef __ASM_ARM_TYPES_H
2#define __ASM_ARM_TYPES_H
3
4#include <asm-generic/int-ll64.h>
5
6#ifndef __ASSEMBLY__
7
8typedef unsigned short umode_t;
9
10#endif /* __ASSEMBLY__ */
11
12/*
13 * These aren't exported outside the kernel to avoid name space clashes
14 */
15#ifdef __KERNEL__
16
17#define BITS_PER_LONG 32
18
19#ifndef __ASSEMBLY__
20
21/* Dma addresses are 32-bits wide. */
22
23typedef u32 dma_addr_t;
24typedef u32 dma64_addr_t;
25
26#endif /* __ASSEMBLY__ */
27
28#endif /* __KERNEL__ */
29
30#endif
31
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
new file mode 100644
index 000000000000..d0f51ff900b5
--- /dev/null
+++ b/arch/arm/include/asm/uaccess.h
@@ -0,0 +1,444 @@
1/*
2 * arch/arm/include/asm/uaccess.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef _ASMARM_UACCESS_H
9#define _ASMARM_UACCESS_H
10
11/*
12 * User space memory access functions
13 */
14#include <linux/sched.h>
15#include <asm/errno.h>
16#include <asm/memory.h>
17#include <asm/domain.h>
18#include <asm/system.h>
19
20#define VERIFY_READ 0
21#define VERIFY_WRITE 1
22
23/*
24 * The exception table consists of pairs of addresses: the first is the
25 * address of an instruction that is allowed to fault, and the second is
26 * the address at which the program should continue. No registers are
27 * modified, so it is entirely up to the continuation code to figure out
28 * what to do.
29 *
30 * All the routines below use bits of fixup code that are out of line
31 * with the main instruction path. This means when everything is well,
32 * we don't even have to jump over them. Further, they do not intrude
33 * on our cache or tlb entries.
34 */
35
36struct exception_table_entry
37{
38 unsigned long insn, fixup;
39};
40
41extern int fixup_exception(struct pt_regs *regs);
42
43/*
44 * These two are intentionally not defined anywhere - if the kernel
45 * code generates any references to them, that's a bug.
46 */
47extern int __get_user_bad(void);
48extern int __put_user_bad(void);
49
50/*
51 * Note that this is actually 0x1,0000,0000
52 */
53#define KERNEL_DS 0x00000000
54#define get_ds() (KERNEL_DS)
55
56#ifdef CONFIG_MMU
57
58#define USER_DS TASK_SIZE
59#define get_fs() (current_thread_info()->addr_limit)
60
61static inline void set_fs(mm_segment_t fs)
62{
63 current_thread_info()->addr_limit = fs;
64 modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_CLIENT : DOMAIN_MANAGER);
65}
66
67#define segment_eq(a,b) ((a) == (b))
68
69#define __addr_ok(addr) ({ \
70 unsigned long flag; \
71 __asm__("cmp %2, %0; movlo %0, #0" \
72 : "=&r" (flag) \
73 : "0" (current_thread_info()->addr_limit), "r" (addr) \
74 : "cc"); \
75 (flag == 0); })
76
77/* We use 33-bit arithmetic here... */
78#define __range_ok(addr,size) ({ \
79 unsigned long flag, roksum; \
80 __chk_user_ptr(addr); \
81 __asm__("adds %1, %2, %3; sbcccs %1, %1, %0; movcc %0, #0" \
82 : "=&r" (flag), "=&r" (roksum) \
83 : "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit) \
84 : "cc"); \
85 flag; })
86
87/*
88 * Single-value transfer routines. They automatically use the right
89 * size if we just have the right pointer type. Note that the functions
90 * which read from user space (*get_*) need to take care not to leak
91 * kernel data even if the calling code is buggy and fails to check
92 * the return value. This means zeroing out the destination variable
93 * or buffer on error. Normally this is done out of line by the
94 * fixup code, but there are a few places where it intrudes on the
95 * main code path. When we only write to user space, there is no
96 * problem.
97 */
98extern int __get_user_1(void *);
99extern int __get_user_2(void *);
100extern int __get_user_4(void *);
101
102#define __get_user_x(__r2,__p,__e,__s,__i...) \
103 __asm__ __volatile__ ( \
104 __asmeq("%0", "r0") __asmeq("%1", "r2") \
105 "bl __get_user_" #__s \
106 : "=&r" (__e), "=r" (__r2) \
107 : "0" (__p) \
108 : __i, "cc")
109
110#define get_user(x,p) \
111 ({ \
112 register const typeof(*(p)) __user *__p asm("r0") = (p);\
113 register unsigned long __r2 asm("r2"); \
114 register int __e asm("r0"); \
115 switch (sizeof(*(__p))) { \
116 case 1: \
117 __get_user_x(__r2, __p, __e, 1, "lr"); \
118 break; \
119 case 2: \
120 __get_user_x(__r2, __p, __e, 2, "r3", "lr"); \
121 break; \
122 case 4: \
123 __get_user_x(__r2, __p, __e, 4, "lr"); \
124 break; \
125 default: __e = __get_user_bad(); break; \
126 } \
127 x = (typeof(*(p))) __r2; \
128 __e; \
129 })
130
131extern int __put_user_1(void *, unsigned int);
132extern int __put_user_2(void *, unsigned int);
133extern int __put_user_4(void *, unsigned int);
134extern int __put_user_8(void *, unsigned long long);
135
136#define __put_user_x(__r2,__p,__e,__s) \
137 __asm__ __volatile__ ( \
138 __asmeq("%0", "r0") __asmeq("%2", "r2") \
139 "bl __put_user_" #__s \
140 : "=&r" (__e) \
141 : "0" (__p), "r" (__r2) \
142 : "ip", "lr", "cc")
143
144#define put_user(x,p) \
145 ({ \
146 register const typeof(*(p)) __r2 asm("r2") = (x); \
147 register const typeof(*(p)) __user *__p asm("r0") = (p);\
148 register int __e asm("r0"); \
149 switch (sizeof(*(__p))) { \
150 case 1: \
151 __put_user_x(__r2, __p, __e, 1); \
152 break; \
153 case 2: \
154 __put_user_x(__r2, __p, __e, 2); \
155 break; \
156 case 4: \
157 __put_user_x(__r2, __p, __e, 4); \
158 break; \
159 case 8: \
160 __put_user_x(__r2, __p, __e, 8); \
161 break; \
162 default: __e = __put_user_bad(); break; \
163 } \
164 __e; \
165 })
166
167#else /* CONFIG_MMU */
168
169/*
170 * uClinux has only one addr space, so has simplified address limits.
171 */
172#define USER_DS KERNEL_DS
173
174#define segment_eq(a,b) (1)
175#define __addr_ok(addr) (1)
176#define __range_ok(addr,size) (0)
177#define get_fs() (KERNEL_DS)
178
179static inline void set_fs(mm_segment_t fs)
180{
181}
182
183#define get_user(x,p) __get_user(x,p)
184#define put_user(x,p) __put_user(x,p)
185
186#endif /* CONFIG_MMU */
187
188#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
189
190/*
191 * The "__xxx" versions of the user access functions do not verify the
192 * address space - it must have been done previously with a separate
193 * "access_ok()" call.
194 *
195 * The "xxx_error" versions set the third argument to EFAULT if an
196 * error occurs, and leave it unchanged on success. Note that these
197 * versions are void (ie, don't return a value as such).
198 */
199#define __get_user(x,ptr) \
200({ \
201 long __gu_err = 0; \
202 __get_user_err((x),(ptr),__gu_err); \
203 __gu_err; \
204})
205
206#define __get_user_error(x,ptr,err) \
207({ \
208 __get_user_err((x),(ptr),err); \
209 (void) 0; \
210})
211
212#define __get_user_err(x,ptr,err) \
213do { \
214 unsigned long __gu_addr = (unsigned long)(ptr); \
215 unsigned long __gu_val; \
216 __chk_user_ptr(ptr); \
217 switch (sizeof(*(ptr))) { \
218 case 1: __get_user_asm_byte(__gu_val,__gu_addr,err); break; \
219 case 2: __get_user_asm_half(__gu_val,__gu_addr,err); break; \
220 case 4: __get_user_asm_word(__gu_val,__gu_addr,err); break; \
221 default: (__gu_val) = __get_user_bad(); \
222 } \
223 (x) = (__typeof__(*(ptr)))__gu_val; \
224} while (0)
225
226#define __get_user_asm_byte(x,addr,err) \
227 __asm__ __volatile__( \
228 "1: ldrbt %1,[%2],#0\n" \
229 "2:\n" \
230 " .section .fixup,\"ax\"\n" \
231 " .align 2\n" \
232 "3: mov %0, %3\n" \
233 " mov %1, #0\n" \
234 " b 2b\n" \
235 " .previous\n" \
236 " .section __ex_table,\"a\"\n" \
237 " .align 3\n" \
238 " .long 1b, 3b\n" \
239 " .previous" \
240 : "+r" (err), "=&r" (x) \
241 : "r" (addr), "i" (-EFAULT) \
242 : "cc")
243
244#ifndef __ARMEB__
245#define __get_user_asm_half(x,__gu_addr,err) \
246({ \
247 unsigned long __b1, __b2; \
248 __get_user_asm_byte(__b1, __gu_addr, err); \
249 __get_user_asm_byte(__b2, __gu_addr + 1, err); \
250 (x) = __b1 | (__b2 << 8); \
251})
252#else
253#define __get_user_asm_half(x,__gu_addr,err) \
254({ \
255 unsigned long __b1, __b2; \
256 __get_user_asm_byte(__b1, __gu_addr, err); \
257 __get_user_asm_byte(__b2, __gu_addr + 1, err); \
258 (x) = (__b1 << 8) | __b2; \
259})
260#endif
261
262#define __get_user_asm_word(x,addr,err) \
263 __asm__ __volatile__( \
264 "1: ldrt %1,[%2],#0\n" \
265 "2:\n" \
266 " .section .fixup,\"ax\"\n" \
267 " .align 2\n" \
268 "3: mov %0, %3\n" \
269 " mov %1, #0\n" \
270 " b 2b\n" \
271 " .previous\n" \
272 " .section __ex_table,\"a\"\n" \
273 " .align 3\n" \
274 " .long 1b, 3b\n" \
275 " .previous" \
276 : "+r" (err), "=&r" (x) \
277 : "r" (addr), "i" (-EFAULT) \
278 : "cc")
279
280#define __put_user(x,ptr) \
281({ \
282 long __pu_err = 0; \
283 __put_user_err((x),(ptr),__pu_err); \
284 __pu_err; \
285})
286
287#define __put_user_error(x,ptr,err) \
288({ \
289 __put_user_err((x),(ptr),err); \
290 (void) 0; \
291})
292
293#define __put_user_err(x,ptr,err) \
294do { \
295 unsigned long __pu_addr = (unsigned long)(ptr); \
296 __typeof__(*(ptr)) __pu_val = (x); \
297 __chk_user_ptr(ptr); \
298 switch (sizeof(*(ptr))) { \
299 case 1: __put_user_asm_byte(__pu_val,__pu_addr,err); break; \
300 case 2: __put_user_asm_half(__pu_val,__pu_addr,err); break; \
301 case 4: __put_user_asm_word(__pu_val,__pu_addr,err); break; \
302 case 8: __put_user_asm_dword(__pu_val,__pu_addr,err); break; \
303 default: __put_user_bad(); \
304 } \
305} while (0)
306
307#define __put_user_asm_byte(x,__pu_addr,err) \
308 __asm__ __volatile__( \
309 "1: strbt %1,[%2],#0\n" \
310 "2:\n" \
311 " .section .fixup,\"ax\"\n" \
312 " .align 2\n" \
313 "3: mov %0, %3\n" \
314 " b 2b\n" \
315 " .previous\n" \
316 " .section __ex_table,\"a\"\n" \
317 " .align 3\n" \
318 " .long 1b, 3b\n" \
319 " .previous" \
320 : "+r" (err) \
321 : "r" (x), "r" (__pu_addr), "i" (-EFAULT) \
322 : "cc")
323
324#ifndef __ARMEB__
325#define __put_user_asm_half(x,__pu_addr,err) \
326({ \
327 unsigned long __temp = (unsigned long)(x); \
328 __put_user_asm_byte(__temp, __pu_addr, err); \
329 __put_user_asm_byte(__temp >> 8, __pu_addr + 1, err); \
330})
331#else
332#define __put_user_asm_half(x,__pu_addr,err) \
333({ \
334 unsigned long __temp = (unsigned long)(x); \
335 __put_user_asm_byte(__temp >> 8, __pu_addr, err); \
336 __put_user_asm_byte(__temp, __pu_addr + 1, err); \
337})
338#endif
339
340#define __put_user_asm_word(x,__pu_addr,err) \
341 __asm__ __volatile__( \
342 "1: strt %1,[%2],#0\n" \
343 "2:\n" \
344 " .section .fixup,\"ax\"\n" \
345 " .align 2\n" \
346 "3: mov %0, %3\n" \
347 " b 2b\n" \
348 " .previous\n" \
349 " .section __ex_table,\"a\"\n" \
350 " .align 3\n" \
351 " .long 1b, 3b\n" \
352 " .previous" \
353 : "+r" (err) \
354 : "r" (x), "r" (__pu_addr), "i" (-EFAULT) \
355 : "cc")
356
357#ifndef __ARMEB__
358#define __reg_oper0 "%R2"
359#define __reg_oper1 "%Q2"
360#else
361#define __reg_oper0 "%Q2"
362#define __reg_oper1 "%R2"
363#endif
364
365#define __put_user_asm_dword(x,__pu_addr,err) \
366 __asm__ __volatile__( \
367 "1: strt " __reg_oper1 ", [%1], #4\n" \
368 "2: strt " __reg_oper0 ", [%1], #0\n" \
369 "3:\n" \
370 " .section .fixup,\"ax\"\n" \
371 " .align 2\n" \
372 "4: mov %0, %3\n" \
373 " b 3b\n" \
374 " .previous\n" \
375 " .section __ex_table,\"a\"\n" \
376 " .align 3\n" \
377 " .long 1b, 4b\n" \
378 " .long 2b, 4b\n" \
379 " .previous" \
380 : "+r" (err), "+r" (__pu_addr) \
381 : "r" (x), "i" (-EFAULT) \
382 : "cc")
383
384
385#ifdef CONFIG_MMU
386extern unsigned long __must_check __copy_from_user(void *to, const void __user *from, unsigned long n);
387extern unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n);
388extern unsigned long __must_check __clear_user(void __user *addr, unsigned long n);
389#else
390#define __copy_from_user(to,from,n) (memcpy(to, (void __force *)from, n), 0)
391#define __copy_to_user(to,from,n) (memcpy((void __force *)to, from, n), 0)
392#define __clear_user(addr,n) (memset((void __force *)addr, 0, n), 0)
393#endif
394
395extern unsigned long __must_check __strncpy_from_user(char *to, const char __user *from, unsigned long count);
396extern unsigned long __must_check __strnlen_user(const char __user *s, long n);
397
398static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)
399{
400 if (access_ok(VERIFY_READ, from, n))
401 n = __copy_from_user(to, from, n);
402 else /* security hole - plug it */
403 memzero(to, n);
404 return n;
405}
406
407static inline unsigned long __must_check copy_to_user(void __user *to, const void *from, unsigned long n)
408{
409 if (access_ok(VERIFY_WRITE, to, n))
410 n = __copy_to_user(to, from, n);
411 return n;
412}
413
414#define __copy_to_user_inatomic __copy_to_user
415#define __copy_from_user_inatomic __copy_from_user
416
417static inline unsigned long __must_check clear_user(void __user *to, unsigned long n)
418{
419 if (access_ok(VERIFY_WRITE, to, n))
420 n = __clear_user(to, n);
421 return n;
422}
423
424static inline long __must_check strncpy_from_user(char *dst, const char __user *src, long count)
425{
426 long res = -EFAULT;
427 if (access_ok(VERIFY_READ, src, 1))
428 res = __strncpy_from_user(dst, src, count);
429 return res;
430}
431
432#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
433
434static inline long __must_check strnlen_user(const char __user *s, long n)
435{
436 unsigned long res = 0;
437
438 if (__addr_ok(s))
439 res = __strnlen_user(s, n);
440
441 return res;
442}
443
444#endif /* _ASMARM_UACCESS_H */
diff --git a/arch/arm/include/asm/ucontext.h b/arch/arm/include/asm/ucontext.h
new file mode 100644
index 000000000000..bf65e9f4525d
--- /dev/null
+++ b/arch/arm/include/asm/ucontext.h
@@ -0,0 +1,103 @@
1#ifndef _ASMARM_UCONTEXT_H
2#define _ASMARM_UCONTEXT_H
3
4#include <asm/fpstate.h>
5
6/*
7 * struct sigcontext only has room for the basic registers, but struct
8 * ucontext now has room for all registers which need to be saved and
9 * restored. Coprocessor registers are stored in uc_regspace. Each
10 * coprocessor's saved state should start with a documented 32-bit magic
11 * number, followed by a 32-bit word giving the coproccesor's saved size.
12 * uc_regspace may be expanded if necessary, although this takes some
13 * coordination with glibc.
14 */
15
16struct ucontext {
17 unsigned long uc_flags;
18 struct ucontext *uc_link;
19 stack_t uc_stack;
20 struct sigcontext uc_mcontext;
21 sigset_t uc_sigmask;
22 /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
23 int __unused[32 - (sizeof (sigset_t) / sizeof (int))];
24 /* Last for extensibility. Eight byte aligned because some
25 coprocessors require eight byte alignment. */
26 unsigned long uc_regspace[128] __attribute__((__aligned__(8)));
27};
28
29#ifdef __KERNEL__
30
31/*
32 * Coprocessor save state. The magic values and specific
33 * coprocessor's layouts are part of the userspace ABI. Each one of
34 * these should be a multiple of eight bytes and aligned to eight
35 * bytes, to prevent unpredictable padding in the signal frame.
36 */
37
38#ifdef CONFIG_CRUNCH
39#define CRUNCH_MAGIC 0x5065cf03
40#define CRUNCH_STORAGE_SIZE (CRUNCH_SIZE + 8)
41
42struct crunch_sigframe {
43 unsigned long magic;
44 unsigned long size;
45 struct crunch_state storage;
46} __attribute__((__aligned__(8)));
47#endif
48
49#ifdef CONFIG_IWMMXT
50/* iwmmxt_area is 0x98 bytes long, preceeded by 8 bytes of signature */
51#define IWMMXT_MAGIC 0x12ef842a
52#define IWMMXT_STORAGE_SIZE (IWMMXT_SIZE + 8)
53
54struct iwmmxt_sigframe {
55 unsigned long magic;
56 unsigned long size;
57 struct iwmmxt_struct storage;
58} __attribute__((__aligned__(8)));
59#endif /* CONFIG_IWMMXT */
60
61#ifdef CONFIG_VFP
62#if __LINUX_ARM_ARCH__ < 6
63/* For ARM pre-v6, we use fstmiax and fldmiax. This adds one extra
64 * word after the registers, and a word of padding at the end for
65 * alignment. */
66#define VFP_MAGIC 0x56465001
67#define VFP_STORAGE_SIZE 152
68#else
69#define VFP_MAGIC 0x56465002
70#define VFP_STORAGE_SIZE 144
71#endif
72
73struct vfp_sigframe
74{
75 unsigned long magic;
76 unsigned long size;
77 union vfp_state storage;
78};
79#endif /* CONFIG_VFP */
80
81/*
82 * Auxiliary signal frame. This saves stuff like FP state.
83 * The layout of this structure is not part of the user ABI,
84 * because the config options aren't. uc_regspace is really
85 * one of these.
86 */
87struct aux_sigframe {
88#ifdef CONFIG_CRUNCH
89 struct crunch_sigframe crunch;
90#endif
91#ifdef CONFIG_IWMMXT
92 struct iwmmxt_sigframe iwmmxt;
93#endif
94#if 0 && defined CONFIG_VFP /* Not yet saved. */
95 struct vfp_sigframe vfp;
96#endif
97 /* Something that isn't a valid magic number for any coprocessor. */
98 unsigned long end_magic;
99} __attribute__((__aligned__(8)));
100
101#endif
102
103#endif /* !_ASMARM_UCONTEXT_H */
diff --git a/arch/arm/include/asm/unaligned.h b/arch/arm/include/asm/unaligned.h
new file mode 100644
index 000000000000..44593a894903
--- /dev/null
+++ b/arch/arm/include/asm/unaligned.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_ARM_UNALIGNED_H
2#define _ASM_ARM_UNALIGNED_H
3
4#include <linux/unaligned/le_byteshift.h>
5#include <linux/unaligned/be_byteshift.h>
6#include <linux/unaligned/generic.h>
7
8/*
9 * Select endianness
10 */
11#ifndef __ARMEB__
12#define get_unaligned __get_unaligned_le
13#define put_unaligned __put_unaligned_le
14#else
15#define get_unaligned __get_unaligned_be
16#define put_unaligned __put_unaligned_be
17#endif
18
19#endif /* _ASM_ARM_UNALIGNED_H */
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
new file mode 100644
index 000000000000..f95fbb2fcb5f
--- /dev/null
+++ b/arch/arm/include/asm/unistd.h
@@ -0,0 +1,450 @@
1/*
2 * arch/arm/include/asm/unistd.h
3 *
4 * Copyright (C) 2001-2005 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Please forward _all_ changes to this file to rmk@arm.linux.org.uk,
11 * no matter what the change is. Thanks!
12 */
13#ifndef __ASM_ARM_UNISTD_H
14#define __ASM_ARM_UNISTD_H
15
16#define __NR_OABI_SYSCALL_BASE 0x900000
17
18#if defined(__thumb__) || defined(__ARM_EABI__)
19#define __NR_SYSCALL_BASE 0
20#else
21#define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE
22#endif
23
24/*
25 * This file contains the system call numbers.
26 */
27
28#define __NR_restart_syscall (__NR_SYSCALL_BASE+ 0)
29#define __NR_exit (__NR_SYSCALL_BASE+ 1)
30#define __NR_fork (__NR_SYSCALL_BASE+ 2)
31#define __NR_read (__NR_SYSCALL_BASE+ 3)
32#define __NR_write (__NR_SYSCALL_BASE+ 4)
33#define __NR_open (__NR_SYSCALL_BASE+ 5)
34#define __NR_close (__NR_SYSCALL_BASE+ 6)
35 /* 7 was sys_waitpid */
36#define __NR_creat (__NR_SYSCALL_BASE+ 8)
37#define __NR_link (__NR_SYSCALL_BASE+ 9)
38#define __NR_unlink (__NR_SYSCALL_BASE+ 10)
39#define __NR_execve (__NR_SYSCALL_BASE+ 11)
40#define __NR_chdir (__NR_SYSCALL_BASE+ 12)
41#define __NR_time (__NR_SYSCALL_BASE+ 13)
42#define __NR_mknod (__NR_SYSCALL_BASE+ 14)
43#define __NR_chmod (__NR_SYSCALL_BASE+ 15)
44#define __NR_lchown (__NR_SYSCALL_BASE+ 16)
45 /* 17 was sys_break */
46 /* 18 was sys_stat */
47#define __NR_lseek (__NR_SYSCALL_BASE+ 19)
48#define __NR_getpid (__NR_SYSCALL_BASE+ 20)
49#define __NR_mount (__NR_SYSCALL_BASE+ 21)
50#define __NR_umount (__NR_SYSCALL_BASE+ 22)
51#define __NR_setuid (__NR_SYSCALL_BASE+ 23)
52#define __NR_getuid (__NR_SYSCALL_BASE+ 24)
53#define __NR_stime (__NR_SYSCALL_BASE+ 25)
54#define __NR_ptrace (__NR_SYSCALL_BASE+ 26)
55#define __NR_alarm (__NR_SYSCALL_BASE+ 27)
56 /* 28 was sys_fstat */
57#define __NR_pause (__NR_SYSCALL_BASE+ 29)
58#define __NR_utime (__NR_SYSCALL_BASE+ 30)
59 /* 31 was sys_stty */
60 /* 32 was sys_gtty */
61#define __NR_access (__NR_SYSCALL_BASE+ 33)
62#define __NR_nice (__NR_SYSCALL_BASE+ 34)
63 /* 35 was sys_ftime */
64#define __NR_sync (__NR_SYSCALL_BASE+ 36)
65#define __NR_kill (__NR_SYSCALL_BASE+ 37)
66#define __NR_rename (__NR_SYSCALL_BASE+ 38)
67#define __NR_mkdir (__NR_SYSCALL_BASE+ 39)
68#define __NR_rmdir (__NR_SYSCALL_BASE+ 40)
69#define __NR_dup (__NR_SYSCALL_BASE+ 41)
70#define __NR_pipe (__NR_SYSCALL_BASE+ 42)
71#define __NR_times (__NR_SYSCALL_BASE+ 43)
72 /* 44 was sys_prof */
73#define __NR_brk (__NR_SYSCALL_BASE+ 45)
74#define __NR_setgid (__NR_SYSCALL_BASE+ 46)
75#define __NR_getgid (__NR_SYSCALL_BASE+ 47)
76 /* 48 was sys_signal */
77#define __NR_geteuid (__NR_SYSCALL_BASE+ 49)
78#define __NR_getegid (__NR_SYSCALL_BASE+ 50)
79#define __NR_acct (__NR_SYSCALL_BASE+ 51)
80#define __NR_umount2 (__NR_SYSCALL_BASE+ 52)
81 /* 53 was sys_lock */
82#define __NR_ioctl (__NR_SYSCALL_BASE+ 54)
83#define __NR_fcntl (__NR_SYSCALL_BASE+ 55)
84 /* 56 was sys_mpx */
85#define __NR_setpgid (__NR_SYSCALL_BASE+ 57)
86 /* 58 was sys_ulimit */
87 /* 59 was sys_olduname */
88#define __NR_umask (__NR_SYSCALL_BASE+ 60)
89#define __NR_chroot (__NR_SYSCALL_BASE+ 61)
90#define __NR_ustat (__NR_SYSCALL_BASE+ 62)
91#define __NR_dup2 (__NR_SYSCALL_BASE+ 63)
92#define __NR_getppid (__NR_SYSCALL_BASE+ 64)
93#define __NR_getpgrp (__NR_SYSCALL_BASE+ 65)
94#define __NR_setsid (__NR_SYSCALL_BASE+ 66)
95#define __NR_sigaction (__NR_SYSCALL_BASE+ 67)
96 /* 68 was sys_sgetmask */
97 /* 69 was sys_ssetmask */
98#define __NR_setreuid (__NR_SYSCALL_BASE+ 70)
99#define __NR_setregid (__NR_SYSCALL_BASE+ 71)
100#define __NR_sigsuspend (__NR_SYSCALL_BASE+ 72)
101#define __NR_sigpending (__NR_SYSCALL_BASE+ 73)
102#define __NR_sethostname (__NR_SYSCALL_BASE+ 74)
103#define __NR_setrlimit (__NR_SYSCALL_BASE+ 75)
104#define __NR_getrlimit (__NR_SYSCALL_BASE+ 76) /* Back compat 2GB limited rlimit */
105#define __NR_getrusage (__NR_SYSCALL_BASE+ 77)
106#define __NR_gettimeofday (__NR_SYSCALL_BASE+ 78)
107#define __NR_settimeofday (__NR_SYSCALL_BASE+ 79)
108#define __NR_getgroups (__NR_SYSCALL_BASE+ 80)
109#define __NR_setgroups (__NR_SYSCALL_BASE+ 81)
110#define __NR_select (__NR_SYSCALL_BASE+ 82)
111#define __NR_symlink (__NR_SYSCALL_BASE+ 83)
112 /* 84 was sys_lstat */
113#define __NR_readlink (__NR_SYSCALL_BASE+ 85)
114#define __NR_uselib (__NR_SYSCALL_BASE+ 86)
115#define __NR_swapon (__NR_SYSCALL_BASE+ 87)
116#define __NR_reboot (__NR_SYSCALL_BASE+ 88)
117#define __NR_readdir (__NR_SYSCALL_BASE+ 89)
118#define __NR_mmap (__NR_SYSCALL_BASE+ 90)
119#define __NR_munmap (__NR_SYSCALL_BASE+ 91)
120#define __NR_truncate (__NR_SYSCALL_BASE+ 92)
121#define __NR_ftruncate (__NR_SYSCALL_BASE+ 93)
122#define __NR_fchmod (__NR_SYSCALL_BASE+ 94)
123#define __NR_fchown (__NR_SYSCALL_BASE+ 95)
124#define __NR_getpriority (__NR_SYSCALL_BASE+ 96)
125#define __NR_setpriority (__NR_SYSCALL_BASE+ 97)
126 /* 98 was sys_profil */
127#define __NR_statfs (__NR_SYSCALL_BASE+ 99)
128#define __NR_fstatfs (__NR_SYSCALL_BASE+100)
129 /* 101 was sys_ioperm */
130#define __NR_socketcall (__NR_SYSCALL_BASE+102)
131#define __NR_syslog (__NR_SYSCALL_BASE+103)
132#define __NR_setitimer (__NR_SYSCALL_BASE+104)
133#define __NR_getitimer (__NR_SYSCALL_BASE+105)
134#define __NR_stat (__NR_SYSCALL_BASE+106)
135#define __NR_lstat (__NR_SYSCALL_BASE+107)
136#define __NR_fstat (__NR_SYSCALL_BASE+108)
137 /* 109 was sys_uname */
138 /* 110 was sys_iopl */
139#define __NR_vhangup (__NR_SYSCALL_BASE+111)
140 /* 112 was sys_idle */
141#define __NR_syscall (__NR_SYSCALL_BASE+113) /* syscall to call a syscall! */
142#define __NR_wait4 (__NR_SYSCALL_BASE+114)
143#define __NR_swapoff (__NR_SYSCALL_BASE+115)
144#define __NR_sysinfo (__NR_SYSCALL_BASE+116)
145#define __NR_ipc (__NR_SYSCALL_BASE+117)
146#define __NR_fsync (__NR_SYSCALL_BASE+118)
147#define __NR_sigreturn (__NR_SYSCALL_BASE+119)
148#define __NR_clone (__NR_SYSCALL_BASE+120)
149#define __NR_setdomainname (__NR_SYSCALL_BASE+121)
150#define __NR_uname (__NR_SYSCALL_BASE+122)
151 /* 123 was sys_modify_ldt */
152#define __NR_adjtimex (__NR_SYSCALL_BASE+124)
153#define __NR_mprotect (__NR_SYSCALL_BASE+125)
154#define __NR_sigprocmask (__NR_SYSCALL_BASE+126)
155 /* 127 was sys_create_module */
156#define __NR_init_module (__NR_SYSCALL_BASE+128)
157#define __NR_delete_module (__NR_SYSCALL_BASE+129)
158 /* 130 was sys_get_kernel_syms */
159#define __NR_quotactl (__NR_SYSCALL_BASE+131)
160#define __NR_getpgid (__NR_SYSCALL_BASE+132)
161#define __NR_fchdir (__NR_SYSCALL_BASE+133)
162#define __NR_bdflush (__NR_SYSCALL_BASE+134)
163#define __NR_sysfs (__NR_SYSCALL_BASE+135)
164#define __NR_personality (__NR_SYSCALL_BASE+136)
165 /* 137 was sys_afs_syscall */
166#define __NR_setfsuid (__NR_SYSCALL_BASE+138)
167#define __NR_setfsgid (__NR_SYSCALL_BASE+139)
168#define __NR__llseek (__NR_SYSCALL_BASE+140)
169#define __NR_getdents (__NR_SYSCALL_BASE+141)
170#define __NR__newselect (__NR_SYSCALL_BASE+142)
171#define __NR_flock (__NR_SYSCALL_BASE+143)
172#define __NR_msync (__NR_SYSCALL_BASE+144)
173#define __NR_readv (__NR_SYSCALL_BASE+145)
174#define __NR_writev (__NR_SYSCALL_BASE+146)
175#define __NR_getsid (__NR_SYSCALL_BASE+147)
176#define __NR_fdatasync (__NR_SYSCALL_BASE+148)
177#define __NR__sysctl (__NR_SYSCALL_BASE+149)
178#define __NR_mlock (__NR_SYSCALL_BASE+150)
179#define __NR_munlock (__NR_SYSCALL_BASE+151)
180#define __NR_mlockall (__NR_SYSCALL_BASE+152)
181#define __NR_munlockall (__NR_SYSCALL_BASE+153)
182#define __NR_sched_setparam (__NR_SYSCALL_BASE+154)
183#define __NR_sched_getparam (__NR_SYSCALL_BASE+155)
184#define __NR_sched_setscheduler (__NR_SYSCALL_BASE+156)
185#define __NR_sched_getscheduler (__NR_SYSCALL_BASE+157)
186#define __NR_sched_yield (__NR_SYSCALL_BASE+158)
187#define __NR_sched_get_priority_max (__NR_SYSCALL_BASE+159)
188#define __NR_sched_get_priority_min (__NR_SYSCALL_BASE+160)
189#define __NR_sched_rr_get_interval (__NR_SYSCALL_BASE+161)
190#define __NR_nanosleep (__NR_SYSCALL_BASE+162)
191#define __NR_mremap (__NR_SYSCALL_BASE+163)
192#define __NR_setresuid (__NR_SYSCALL_BASE+164)
193#define __NR_getresuid (__NR_SYSCALL_BASE+165)
194 /* 166 was sys_vm86 */
195 /* 167 was sys_query_module */
196#define __NR_poll (__NR_SYSCALL_BASE+168)
197#define __NR_nfsservctl (__NR_SYSCALL_BASE+169)
198#define __NR_setresgid (__NR_SYSCALL_BASE+170)
199#define __NR_getresgid (__NR_SYSCALL_BASE+171)
200#define __NR_prctl (__NR_SYSCALL_BASE+172)
201#define __NR_rt_sigreturn (__NR_SYSCALL_BASE+173)
202#define __NR_rt_sigaction (__NR_SYSCALL_BASE+174)
203#define __NR_rt_sigprocmask (__NR_SYSCALL_BASE+175)
204#define __NR_rt_sigpending (__NR_SYSCALL_BASE+176)
205#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE+177)
206#define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE+178)
207#define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179)
208#define __NR_pread64 (__NR_SYSCALL_BASE+180)
209#define __NR_pwrite64 (__NR_SYSCALL_BASE+181)
210#define __NR_chown (__NR_SYSCALL_BASE+182)
211#define __NR_getcwd (__NR_SYSCALL_BASE+183)
212#define __NR_capget (__NR_SYSCALL_BASE+184)
213#define __NR_capset (__NR_SYSCALL_BASE+185)
214#define __NR_sigaltstack (__NR_SYSCALL_BASE+186)
215#define __NR_sendfile (__NR_SYSCALL_BASE+187)
216 /* 188 reserved */
217 /* 189 reserved */
218#define __NR_vfork (__NR_SYSCALL_BASE+190)
219#define __NR_ugetrlimit (__NR_SYSCALL_BASE+191) /* SuS compliant getrlimit */
220#define __NR_mmap2 (__NR_SYSCALL_BASE+192)
221#define __NR_truncate64 (__NR_SYSCALL_BASE+193)
222#define __NR_ftruncate64 (__NR_SYSCALL_BASE+194)
223#define __NR_stat64 (__NR_SYSCALL_BASE+195)
224#define __NR_lstat64 (__NR_SYSCALL_BASE+196)
225#define __NR_fstat64 (__NR_SYSCALL_BASE+197)
226#define __NR_lchown32 (__NR_SYSCALL_BASE+198)
227#define __NR_getuid32 (__NR_SYSCALL_BASE+199)
228#define __NR_getgid32 (__NR_SYSCALL_BASE+200)
229#define __NR_geteuid32 (__NR_SYSCALL_BASE+201)
230#define __NR_getegid32 (__NR_SYSCALL_BASE+202)
231#define __NR_setreuid32 (__NR_SYSCALL_BASE+203)
232#define __NR_setregid32 (__NR_SYSCALL_BASE+204)
233#define __NR_getgroups32 (__NR_SYSCALL_BASE+205)
234#define __NR_setgroups32 (__NR_SYSCALL_BASE+206)
235#define __NR_fchown32 (__NR_SYSCALL_BASE+207)
236#define __NR_setresuid32 (__NR_SYSCALL_BASE+208)
237#define __NR_getresuid32 (__NR_SYSCALL_BASE+209)
238#define __NR_setresgid32 (__NR_SYSCALL_BASE+210)
239#define __NR_getresgid32 (__NR_SYSCALL_BASE+211)
240#define __NR_chown32 (__NR_SYSCALL_BASE+212)
241#define __NR_setuid32 (__NR_SYSCALL_BASE+213)
242#define __NR_setgid32 (__NR_SYSCALL_BASE+214)
243#define __NR_setfsuid32 (__NR_SYSCALL_BASE+215)
244#define __NR_setfsgid32 (__NR_SYSCALL_BASE+216)
245#define __NR_getdents64 (__NR_SYSCALL_BASE+217)
246#define __NR_pivot_root (__NR_SYSCALL_BASE+218)
247#define __NR_mincore (__NR_SYSCALL_BASE+219)
248#define __NR_madvise (__NR_SYSCALL_BASE+220)
249#define __NR_fcntl64 (__NR_SYSCALL_BASE+221)
250 /* 222 for tux */
251 /* 223 is unused */
252#define __NR_gettid (__NR_SYSCALL_BASE+224)
253#define __NR_readahead (__NR_SYSCALL_BASE+225)
254#define __NR_setxattr (__NR_SYSCALL_BASE+226)
255#define __NR_lsetxattr (__NR_SYSCALL_BASE+227)
256#define __NR_fsetxattr (__NR_SYSCALL_BASE+228)
257#define __NR_getxattr (__NR_SYSCALL_BASE+229)
258#define __NR_lgetxattr (__NR_SYSCALL_BASE+230)
259#define __NR_fgetxattr (__NR_SYSCALL_BASE+231)
260#define __NR_listxattr (__NR_SYSCALL_BASE+232)
261#define __NR_llistxattr (__NR_SYSCALL_BASE+233)
262#define __NR_flistxattr (__NR_SYSCALL_BASE+234)
263#define __NR_removexattr (__NR_SYSCALL_BASE+235)
264#define __NR_lremovexattr (__NR_SYSCALL_BASE+236)
265#define __NR_fremovexattr (__NR_SYSCALL_BASE+237)
266#define __NR_tkill (__NR_SYSCALL_BASE+238)
267#define __NR_sendfile64 (__NR_SYSCALL_BASE+239)
268#define __NR_futex (__NR_SYSCALL_BASE+240)
269#define __NR_sched_setaffinity (__NR_SYSCALL_BASE+241)
270#define __NR_sched_getaffinity (__NR_SYSCALL_BASE+242)
271#define __NR_io_setup (__NR_SYSCALL_BASE+243)
272#define __NR_io_destroy (__NR_SYSCALL_BASE+244)
273#define __NR_io_getevents (__NR_SYSCALL_BASE+245)
274#define __NR_io_submit (__NR_SYSCALL_BASE+246)
275#define __NR_io_cancel (__NR_SYSCALL_BASE+247)
276#define __NR_exit_group (__NR_SYSCALL_BASE+248)
277#define __NR_lookup_dcookie (__NR_SYSCALL_BASE+249)
278#define __NR_epoll_create (__NR_SYSCALL_BASE+250)
279#define __NR_epoll_ctl (__NR_SYSCALL_BASE+251)
280#define __NR_epoll_wait (__NR_SYSCALL_BASE+252)
281#define __NR_remap_file_pages (__NR_SYSCALL_BASE+253)
282 /* 254 for set_thread_area */
283 /* 255 for get_thread_area */
284#define __NR_set_tid_address (__NR_SYSCALL_BASE+256)
285#define __NR_timer_create (__NR_SYSCALL_BASE+257)
286#define __NR_timer_settime (__NR_SYSCALL_BASE+258)
287#define __NR_timer_gettime (__NR_SYSCALL_BASE+259)
288#define __NR_timer_getoverrun (__NR_SYSCALL_BASE+260)
289#define __NR_timer_delete (__NR_SYSCALL_BASE+261)
290#define __NR_clock_settime (__NR_SYSCALL_BASE+262)
291#define __NR_clock_gettime (__NR_SYSCALL_BASE+263)
292#define __NR_clock_getres (__NR_SYSCALL_BASE+264)
293#define __NR_clock_nanosleep (__NR_SYSCALL_BASE+265)
294#define __NR_statfs64 (__NR_SYSCALL_BASE+266)
295#define __NR_fstatfs64 (__NR_SYSCALL_BASE+267)
296#define __NR_tgkill (__NR_SYSCALL_BASE+268)
297#define __NR_utimes (__NR_SYSCALL_BASE+269)
298#define __NR_arm_fadvise64_64 (__NR_SYSCALL_BASE+270)
299#define __NR_pciconfig_iobase (__NR_SYSCALL_BASE+271)
300#define __NR_pciconfig_read (__NR_SYSCALL_BASE+272)
301#define __NR_pciconfig_write (__NR_SYSCALL_BASE+273)
302#define __NR_mq_open (__NR_SYSCALL_BASE+274)
303#define __NR_mq_unlink (__NR_SYSCALL_BASE+275)
304#define __NR_mq_timedsend (__NR_SYSCALL_BASE+276)
305#define __NR_mq_timedreceive (__NR_SYSCALL_BASE+277)
306#define __NR_mq_notify (__NR_SYSCALL_BASE+278)
307#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279)
308#define __NR_waitid (__NR_SYSCALL_BASE+280)
309#define __NR_socket (__NR_SYSCALL_BASE+281)
310#define __NR_bind (__NR_SYSCALL_BASE+282)
311#define __NR_connect (__NR_SYSCALL_BASE+283)
312#define __NR_listen (__NR_SYSCALL_BASE+284)
313#define __NR_accept (__NR_SYSCALL_BASE+285)
314#define __NR_getsockname (__NR_SYSCALL_BASE+286)
315#define __NR_getpeername (__NR_SYSCALL_BASE+287)
316#define __NR_socketpair (__NR_SYSCALL_BASE+288)
317#define __NR_send (__NR_SYSCALL_BASE+289)
318#define __NR_sendto (__NR_SYSCALL_BASE+290)
319#define __NR_recv (__NR_SYSCALL_BASE+291)
320#define __NR_recvfrom (__NR_SYSCALL_BASE+292)
321#define __NR_shutdown (__NR_SYSCALL_BASE+293)
322#define __NR_setsockopt (__NR_SYSCALL_BASE+294)
323#define __NR_getsockopt (__NR_SYSCALL_BASE+295)
324#define __NR_sendmsg (__NR_SYSCALL_BASE+296)
325#define __NR_recvmsg (__NR_SYSCALL_BASE+297)
326#define __NR_semop (__NR_SYSCALL_BASE+298)
327#define __NR_semget (__NR_SYSCALL_BASE+299)
328#define __NR_semctl (__NR_SYSCALL_BASE+300)
329#define __NR_msgsnd (__NR_SYSCALL_BASE+301)
330#define __NR_msgrcv (__NR_SYSCALL_BASE+302)
331#define __NR_msgget (__NR_SYSCALL_BASE+303)
332#define __NR_msgctl (__NR_SYSCALL_BASE+304)
333#define __NR_shmat (__NR_SYSCALL_BASE+305)
334#define __NR_shmdt (__NR_SYSCALL_BASE+306)
335#define __NR_shmget (__NR_SYSCALL_BASE+307)
336#define __NR_shmctl (__NR_SYSCALL_BASE+308)
337#define __NR_add_key (__NR_SYSCALL_BASE+309)
338#define __NR_request_key (__NR_SYSCALL_BASE+310)
339#define __NR_keyctl (__NR_SYSCALL_BASE+311)
340#define __NR_semtimedop (__NR_SYSCALL_BASE+312)
341#define __NR_vserver (__NR_SYSCALL_BASE+313)
342#define __NR_ioprio_set (__NR_SYSCALL_BASE+314)
343#define __NR_ioprio_get (__NR_SYSCALL_BASE+315)
344#define __NR_inotify_init (__NR_SYSCALL_BASE+316)
345#define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317)
346#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318)
347#define __NR_mbind (__NR_SYSCALL_BASE+319)
348#define __NR_get_mempolicy (__NR_SYSCALL_BASE+320)
349#define __NR_set_mempolicy (__NR_SYSCALL_BASE+321)
350#define __NR_openat (__NR_SYSCALL_BASE+322)
351#define __NR_mkdirat (__NR_SYSCALL_BASE+323)
352#define __NR_mknodat (__NR_SYSCALL_BASE+324)
353#define __NR_fchownat (__NR_SYSCALL_BASE+325)
354#define __NR_futimesat (__NR_SYSCALL_BASE+326)
355#define __NR_fstatat64 (__NR_SYSCALL_BASE+327)
356#define __NR_unlinkat (__NR_SYSCALL_BASE+328)
357#define __NR_renameat (__NR_SYSCALL_BASE+329)
358#define __NR_linkat (__NR_SYSCALL_BASE+330)
359#define __NR_symlinkat (__NR_SYSCALL_BASE+331)
360#define __NR_readlinkat (__NR_SYSCALL_BASE+332)
361#define __NR_fchmodat (__NR_SYSCALL_BASE+333)
362#define __NR_faccessat (__NR_SYSCALL_BASE+334)
363 /* 335 for pselect6 */
364 /* 336 for ppoll */
365#define __NR_unshare (__NR_SYSCALL_BASE+337)
366#define __NR_set_robust_list (__NR_SYSCALL_BASE+338)
367#define __NR_get_robust_list (__NR_SYSCALL_BASE+339)
368#define __NR_splice (__NR_SYSCALL_BASE+340)
369#define __NR_arm_sync_file_range (__NR_SYSCALL_BASE+341)
370#define __NR_sync_file_range2 __NR_arm_sync_file_range
371#define __NR_tee (__NR_SYSCALL_BASE+342)
372#define __NR_vmsplice (__NR_SYSCALL_BASE+343)
373#define __NR_move_pages (__NR_SYSCALL_BASE+344)
374#define __NR_getcpu (__NR_SYSCALL_BASE+345)
375 /* 346 for epoll_pwait */
376#define __NR_kexec_load (__NR_SYSCALL_BASE+347)
377#define __NR_utimensat (__NR_SYSCALL_BASE+348)
378#define __NR_signalfd (__NR_SYSCALL_BASE+349)
379#define __NR_timerfd_create (__NR_SYSCALL_BASE+350)
380#define __NR_eventfd (__NR_SYSCALL_BASE+351)
381#define __NR_fallocate (__NR_SYSCALL_BASE+352)
382#define __NR_timerfd_settime (__NR_SYSCALL_BASE+353)
383#define __NR_timerfd_gettime (__NR_SYSCALL_BASE+354)
384
385/*
386 * The following SWIs are ARM private.
387 */
388#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000)
389#define __ARM_NR_breakpoint (__ARM_NR_BASE+1)
390#define __ARM_NR_cacheflush (__ARM_NR_BASE+2)
391#define __ARM_NR_usr26 (__ARM_NR_BASE+3)
392#define __ARM_NR_usr32 (__ARM_NR_BASE+4)
393#define __ARM_NR_set_tls (__ARM_NR_BASE+5)
394
395/*
396 * The following syscalls are obsolete and no longer available for EABI.
397 */
398#if defined(__ARM_EABI__) && !defined(__KERNEL__)
399#undef __NR_time
400#undef __NR_umount
401#undef __NR_stime
402#undef __NR_alarm
403#undef __NR_utime
404#undef __NR_getrlimit
405#undef __NR_select
406#undef __NR_readdir
407#undef __NR_mmap
408#undef __NR_socketcall
409#undef __NR_syscall
410#undef __NR_ipc
411#endif
412
413#ifdef __KERNEL__
414
415#define __ARCH_WANT_IPC_PARSE_VERSION
416#define __ARCH_WANT_STAT64
417#define __ARCH_WANT_SYS_GETHOSTNAME
418#define __ARCH_WANT_SYS_PAUSE
419#define __ARCH_WANT_SYS_GETPGRP
420#define __ARCH_WANT_SYS_LLSEEK
421#define __ARCH_WANT_SYS_NICE
422#define __ARCH_WANT_SYS_SIGPENDING
423#define __ARCH_WANT_SYS_SIGPROCMASK
424#define __ARCH_WANT_SYS_RT_SIGACTION
425
426#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
427#define __ARCH_WANT_SYS_TIME
428#define __ARCH_WANT_SYS_OLDUMOUNT
429#define __ARCH_WANT_SYS_ALARM
430#define __ARCH_WANT_SYS_UTIME
431#define __ARCH_WANT_SYS_OLD_GETRLIMIT
432#define __ARCH_WANT_OLD_READDIR
433#define __ARCH_WANT_SYS_SOCKETCALL
434#endif
435
436/*
437 * "Conditional" syscalls
438 *
439 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
440 * but it doesn't work on all toolchains, so we just do it by hand
441 */
442#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
443
444/*
445 * Unimplemented (or alternatively implemented) syscalls
446 */
447#define __IGNORE_fadvise64_64 1
448
449#endif /* __KERNEL__ */
450#endif /* __ASM_ARM_UNISTD_H */
diff --git a/arch/arm/include/asm/user.h b/arch/arm/include/asm/user.h
new file mode 100644
index 000000000000..825c1e7c582d
--- /dev/null
+++ b/arch/arm/include/asm/user.h
@@ -0,0 +1,84 @@
1#ifndef _ARM_USER_H
2#define _ARM_USER_H
3
4#include <asm/page.h>
5#include <asm/ptrace.h>
6/* Core file format: The core file is written in such a way that gdb
7 can understand it and provide useful information to the user (under
8 linux we use the 'trad-core' bfd). There are quite a number of
9 obstacles to being able to view the contents of the floating point
10 registers, and until these are solved you will not be able to view the
11 contents of them. Actually, you can read in the core file and look at
12 the contents of the user struct to find out what the floating point
13 registers contain.
14 The actual file contents are as follows:
15 UPAGE: 1 page consisting of a user struct that tells gdb what is present
16 in the file. Directly after this is a copy of the task_struct, which
17 is currently not used by gdb, but it may come in useful at some point.
18 All of the registers are stored as part of the upage. The upage should
19 always be only one page.
20 DATA: The data area is stored. We use current->end_text to
21 current->brk to pick up all of the user variables, plus any memory
22 that may have been malloced. No attempt is made to determine if a page
23 is demand-zero or if a page is totally unused, we just cover the entire
24 range. All of the addresses are rounded in such a way that an integral
25 number of pages is written.
26 STACK: We need the stack information in order to get a meaningful
27 backtrace. We need to write the data from (esp) to
28 current->start_stack, so we round each of these off in order to be able
29 to write an integer number of pages.
30 The minimum core file size is 3 pages, or 12288 bytes.
31*/
32
33struct user_fp {
34 struct fp_reg {
35 unsigned int sign1:1;
36 unsigned int unused:15;
37 unsigned int sign2:1;
38 unsigned int exponent:14;
39 unsigned int j:1;
40 unsigned int mantissa1:31;
41 unsigned int mantissa0:32;
42 } fpregs[8];
43 unsigned int fpsr:32;
44 unsigned int fpcr:32;
45 unsigned char ftype[8];
46 unsigned int init_flag;
47};
48
49/* When the kernel dumps core, it starts by dumping the user struct -
50 this will be used by gdb to figure out where the data and stack segments
51 are within the file, and what virtual addresses to use. */
52struct user{
53/* We start with the registers, to mimic the way that "memory" is returned
54 from the ptrace(3,...) function. */
55 struct pt_regs regs; /* Where the registers are actually stored */
56/* ptrace does not yet supply these. Someday.... */
57 int u_fpvalid; /* True if math co-processor being used. */
58 /* for this mess. Not yet used. */
59/* The rest of this junk is to help gdb figure out what goes where */
60 unsigned long int u_tsize; /* Text segment size (pages). */
61 unsigned long int u_dsize; /* Data segment size (pages). */
62 unsigned long int u_ssize; /* Stack segment size (pages). */
63 unsigned long start_code; /* Starting virtual address of text. */
64 unsigned long start_stack; /* Starting virtual address of stack area.
65 This is actually the bottom of the stack,
66 the top of the stack is always found in the
67 esp register. */
68 long int signal; /* Signal that caused the core dump. */
69 int reserved; /* No longer used */
70 unsigned long u_ar0; /* Used by gdb to help find the values for */
71 /* the registers. */
72 unsigned long magic; /* To uniquely identify a core file */
73 char u_comm[32]; /* User command that was responsible */
74 int u_debugreg[8];
75 struct user_fp u_fp; /* FP state */
76 struct user_fp_struct * u_fp0;/* Used by gdb to help find the values for */
77 /* the FP registers. */
78};
79#define NBPG PAGE_SIZE
80#define UPAGES 1
81#define HOST_TEXT_START_ADDR (u.start_code)
82#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
83
84#endif /* _ARM_USER_H */
diff --git a/arch/arm/include/asm/vfp.h b/arch/arm/include/asm/vfp.h
new file mode 100644
index 000000000000..f4ab34fd4f72
--- /dev/null
+++ b/arch/arm/include/asm/vfp.h
@@ -0,0 +1,84 @@
1/*
2 * arch/arm/include/asm/vfp.h
3 *
4 * VFP register definitions.
5 * First, the standard VFP set.
6 */
7
8#define FPSID cr0
9#define FPSCR cr1
10#define MVFR1 cr6
11#define MVFR0 cr7
12#define FPEXC cr8
13#define FPINST cr9
14#define FPINST2 cr10
15
16/* FPSID bits */
17#define FPSID_IMPLEMENTER_BIT (24)
18#define FPSID_IMPLEMENTER_MASK (0xff << FPSID_IMPLEMENTER_BIT)
19#define FPSID_SOFTWARE (1<<23)
20#define FPSID_FORMAT_BIT (21)
21#define FPSID_FORMAT_MASK (0x3 << FPSID_FORMAT_BIT)
22#define FPSID_NODOUBLE (1<<20)
23#define FPSID_ARCH_BIT (16)
24#define FPSID_ARCH_MASK (0xF << FPSID_ARCH_BIT)
25#define FPSID_PART_BIT (8)
26#define FPSID_PART_MASK (0xFF << FPSID_PART_BIT)
27#define FPSID_VARIANT_BIT (4)
28#define FPSID_VARIANT_MASK (0xF << FPSID_VARIANT_BIT)
29#define FPSID_REV_BIT (0)
30#define FPSID_REV_MASK (0xF << FPSID_REV_BIT)
31
32/* FPEXC bits */
33#define FPEXC_EX (1 << 31)
34#define FPEXC_EN (1 << 30)
35#define FPEXC_DEX (1 << 29)
36#define FPEXC_FP2V (1 << 28)
37#define FPEXC_VV (1 << 27)
38#define FPEXC_TFV (1 << 26)
39#define FPEXC_LENGTH_BIT (8)
40#define FPEXC_LENGTH_MASK (7 << FPEXC_LENGTH_BIT)
41#define FPEXC_IDF (1 << 7)
42#define FPEXC_IXF (1 << 4)
43#define FPEXC_UFF (1 << 3)
44#define FPEXC_OFF (1 << 2)
45#define FPEXC_DZF (1 << 1)
46#define FPEXC_IOF (1 << 0)
47#define FPEXC_TRAP_MASK (FPEXC_IDF|FPEXC_IXF|FPEXC_UFF|FPEXC_OFF|FPEXC_DZF|FPEXC_IOF)
48
49/* FPSCR bits */
50#define FPSCR_DEFAULT_NAN (1<<25)
51#define FPSCR_FLUSHTOZERO (1<<24)
52#define FPSCR_ROUND_NEAREST (0<<22)
53#define FPSCR_ROUND_PLUSINF (1<<22)
54#define FPSCR_ROUND_MINUSINF (2<<22)
55#define FPSCR_ROUND_TOZERO (3<<22)
56#define FPSCR_RMODE_BIT (22)
57#define FPSCR_RMODE_MASK (3 << FPSCR_RMODE_BIT)
58#define FPSCR_STRIDE_BIT (20)
59#define FPSCR_STRIDE_MASK (3 << FPSCR_STRIDE_BIT)
60#define FPSCR_LENGTH_BIT (16)
61#define FPSCR_LENGTH_MASK (7 << FPSCR_LENGTH_BIT)
62#define FPSCR_IOE (1<<8)
63#define FPSCR_DZE (1<<9)
64#define FPSCR_OFE (1<<10)
65#define FPSCR_UFE (1<<11)
66#define FPSCR_IXE (1<<12)
67#define FPSCR_IDE (1<<15)
68#define FPSCR_IOC (1<<0)
69#define FPSCR_DZC (1<<1)
70#define FPSCR_OFC (1<<2)
71#define FPSCR_UFC (1<<3)
72#define FPSCR_IXC (1<<4)
73#define FPSCR_IDC (1<<7)
74
75/* MVFR0 bits */
76#define MVFR0_A_SIMD_BIT (0)
77#define MVFR0_A_SIMD_MASK (0xf << MVFR0_A_SIMD_BIT)
78
79/* Bit patterns for decoding the packaged operation descriptors */
80#define VFPOPDESC_LENGTH_BIT (9)
81#define VFPOPDESC_LENGTH_MASK (0x07 << VFPOPDESC_LENGTH_BIT)
82#define VFPOPDESC_UNUSED_BIT (24)
83#define VFPOPDESC_UNUSED_MASK (0xFF << VFPOPDESC_UNUSED_BIT)
84#define VFPOPDESC_OPDESC_MASK (~(VFPOPDESC_LENGTH_MASK | VFPOPDESC_UNUSED_MASK))
diff --git a/arch/arm/include/asm/vfpmacros.h b/arch/arm/include/asm/vfpmacros.h
new file mode 100644
index 000000000000..422f3cc204a2
--- /dev/null
+++ b/arch/arm/include/asm/vfpmacros.h
@@ -0,0 +1,47 @@
1/*
2 * arch/arm/include/asm/vfpmacros.h
3 *
4 * Assembler-only file containing VFP macros and register definitions.
5 */
6#include "vfp.h"
7
8@ Macros to allow building with old toolkits (with no VFP support)
9 .macro VFPFMRX, rd, sysreg, cond
10 MRC\cond p10, 7, \rd, \sysreg, cr0, 0 @ FMRX \rd, \sysreg
11 .endm
12
13 .macro VFPFMXR, sysreg, rd, cond
14 MCR\cond p10, 7, \rd, \sysreg, cr0, 0 @ FMXR \sysreg, \rd
15 .endm
16
17 @ read all the working registers back into the VFP
18 .macro VFPFLDMIA, base, tmp
19#if __LINUX_ARM_ARCH__ < 6
20 LDC p11, cr0, [\base],#33*4 @ FLDMIAX \base!, {d0-d15}
21#else
22 LDC p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d0-d15}
23#endif
24#ifdef CONFIG_VFPv3
25 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
26 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
27 cmp \tmp, #2 @ 32 x 64bit registers?
28 ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
29 addne \base, \base, #32*4 @ step over unused register space
30#endif
31 .endm
32
33 @ write all the working registers out of the VFP
34 .macro VFPFSTMIA, base, tmp
35#if __LINUX_ARM_ARCH__ < 6
36 STC p11, cr0, [\base],#33*4 @ FSTMIAX \base!, {d0-d15}
37#else
38 STC p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d0-d15}
39#endif
40#ifdef CONFIG_VFPv3
41 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
42 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
43 cmp \tmp, #2 @ 32 x 64bit registers?
44 stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
45 addne \base, \base, #32*4 @ step over unused register space
46#endif
47 .endm
diff --git a/arch/arm/include/asm/vga.h b/arch/arm/include/asm/vga.h
new file mode 100644
index 000000000000..6a3cd2a2f670
--- /dev/null
+++ b/arch/arm/include/asm/vga.h
@@ -0,0 +1,12 @@
1#ifndef ASMARM_VGA_H
2#define ASMARM_VGA_H
3
4#include <mach/hardware.h>
5#include <asm/io.h>
6
7#define VGA_MAP_MEM(x,s) (PCIMEM_BASE + (x))
8
9#define vga_readb(x) (*((volatile unsigned char *)x))
10#define vga_writeb(x,y) (*((volatile unsigned char *)y) = (x))
11
12#endif
diff --git a/arch/arm/include/asm/xor.h b/arch/arm/include/asm/xor.h
new file mode 100644
index 000000000000..7604673dc427
--- /dev/null
+++ b/arch/arm/include/asm/xor.h
@@ -0,0 +1,141 @@
1/*
2 * arch/arm/include/asm/xor.h
3 *
4 * Copyright (C) 2001 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <asm-generic/xor.h>
11
12#define __XOR(a1, a2) a1 ^= a2
13
14#define GET_BLOCK_2(dst) \
15 __asm__("ldmia %0, {%1, %2}" \
16 : "=r" (dst), "=r" (a1), "=r" (a2) \
17 : "0" (dst))
18
19#define GET_BLOCK_4(dst) \
20 __asm__("ldmia %0, {%1, %2, %3, %4}" \
21 : "=r" (dst), "=r" (a1), "=r" (a2), "=r" (a3), "=r" (a4) \
22 : "0" (dst))
23
24#define XOR_BLOCK_2(src) \
25 __asm__("ldmia %0!, {%1, %2}" \
26 : "=r" (src), "=r" (b1), "=r" (b2) \
27 : "0" (src)); \
28 __XOR(a1, b1); __XOR(a2, b2);
29
30#define XOR_BLOCK_4(src) \
31 __asm__("ldmia %0!, {%1, %2, %3, %4}" \
32 : "=r" (src), "=r" (b1), "=r" (b2), "=r" (b3), "=r" (b4) \
33 : "0" (src)); \
34 __XOR(a1, b1); __XOR(a2, b2); __XOR(a3, b3); __XOR(a4, b4)
35
36#define PUT_BLOCK_2(dst) \
37 __asm__ __volatile__("stmia %0!, {%2, %3}" \
38 : "=r" (dst) \
39 : "0" (dst), "r" (a1), "r" (a2))
40
41#define PUT_BLOCK_4(dst) \
42 __asm__ __volatile__("stmia %0!, {%2, %3, %4, %5}" \
43 : "=r" (dst) \
44 : "0" (dst), "r" (a1), "r" (a2), "r" (a3), "r" (a4))
45
46static void
47xor_arm4regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
48{
49 unsigned int lines = bytes / sizeof(unsigned long) / 4;
50 register unsigned int a1 __asm__("r4");
51 register unsigned int a2 __asm__("r5");
52 register unsigned int a3 __asm__("r6");
53 register unsigned int a4 __asm__("r7");
54 register unsigned int b1 __asm__("r8");
55 register unsigned int b2 __asm__("r9");
56 register unsigned int b3 __asm__("ip");
57 register unsigned int b4 __asm__("lr");
58
59 do {
60 GET_BLOCK_4(p1);
61 XOR_BLOCK_4(p2);
62 PUT_BLOCK_4(p1);
63 } while (--lines);
64}
65
66static void
67xor_arm4regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
68 unsigned long *p3)
69{
70 unsigned int lines = bytes / sizeof(unsigned long) / 4;
71 register unsigned int a1 __asm__("r4");
72 register unsigned int a2 __asm__("r5");
73 register unsigned int a3 __asm__("r6");
74 register unsigned int a4 __asm__("r7");
75 register unsigned int b1 __asm__("r8");
76 register unsigned int b2 __asm__("r9");
77 register unsigned int b3 __asm__("ip");
78 register unsigned int b4 __asm__("lr");
79
80 do {
81 GET_BLOCK_4(p1);
82 XOR_BLOCK_4(p2);
83 XOR_BLOCK_4(p3);
84 PUT_BLOCK_4(p1);
85 } while (--lines);
86}
87
88static void
89xor_arm4regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
90 unsigned long *p3, unsigned long *p4)
91{
92 unsigned int lines = bytes / sizeof(unsigned long) / 2;
93 register unsigned int a1 __asm__("r8");
94 register unsigned int a2 __asm__("r9");
95 register unsigned int b1 __asm__("ip");
96 register unsigned int b2 __asm__("lr");
97
98 do {
99 GET_BLOCK_2(p1);
100 XOR_BLOCK_2(p2);
101 XOR_BLOCK_2(p3);
102 XOR_BLOCK_2(p4);
103 PUT_BLOCK_2(p1);
104 } while (--lines);
105}
106
107static void
108xor_arm4regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
109 unsigned long *p3, unsigned long *p4, unsigned long *p5)
110{
111 unsigned int lines = bytes / sizeof(unsigned long) / 2;
112 register unsigned int a1 __asm__("r8");
113 register unsigned int a2 __asm__("r9");
114 register unsigned int b1 __asm__("ip");
115 register unsigned int b2 __asm__("lr");
116
117 do {
118 GET_BLOCK_2(p1);
119 XOR_BLOCK_2(p2);
120 XOR_BLOCK_2(p3);
121 XOR_BLOCK_2(p4);
122 XOR_BLOCK_2(p5);
123 PUT_BLOCK_2(p1);
124 } while (--lines);
125}
126
127static struct xor_block_template xor_block_arm4regs = {
128 .name = "arm4regs",
129 .do_2 = xor_arm4regs_2,
130 .do_3 = xor_arm4regs_3,
131 .do_4 = xor_arm4regs_4,
132 .do_5 = xor_arm4regs_5,
133};
134
135#undef XOR_TRY_TEMPLATES
136#define XOR_TRY_TEMPLATES \
137 do { \
138 xor_speed(&xor_block_arm4regs); \
139 xor_speed(&xor_block_8regs); \
140 xor_speed(&xor_block_32regs); \
141 } while (0)
diff --git a/arch/arm/kernel/crunch-bits.S b/arch/arm/kernel/crunch-bits.S
index a26886758c67..0ec9bb48fab9 100644
--- a/arch/arm/kernel/crunch-bits.S
+++ b/arch/arm/kernel/crunch-bits.S
@@ -16,7 +16,7 @@
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/thread_info.h> 17#include <asm/thread_info.h>
18#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
19#include <asm/arch/ep93xx-regs.h> 19#include <mach/ep93xx-regs.h>
20 20
21/* 21/*
22 * We can't use hex constants here due to a bug in gas. 22 * We can't use hex constants here due to a bug in gas.
diff --git a/arch/arm/kernel/crunch.c b/arch/arm/kernel/crunch.c
index 627d79414c9d..3b6a1c293ee4 100644
--- a/arch/arm/kernel/crunch.c
+++ b/arch/arm/kernel/crunch.c
@@ -15,7 +15,7 @@
15#include <linux/signal.h> 15#include <linux/signal.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <asm/arch/ep93xx-regs.h> 18#include <mach/ep93xx-regs.h>
19#include <asm/thread_notify.h> 19#include <asm/thread_notify.h>
20#include <asm/io.h> 20#include <asm/io.h>
21 21
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index 5617566477b4..9550ff0ddde4 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -80,7 +80,7 @@
80#endif /* CONFIG_CPU_V6 */ 80#endif /* CONFIG_CPU_V6 */
81 81
82#else 82#else
83#include <asm/arch/debug-macro.S> 83#include <mach/debug-macro.S>
84#endif /* CONFIG_DEBUG_ICEDCC */ 84#endif /* CONFIG_DEBUG_ICEDCC */
85 85
86/* 86/*
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index f5cfdabcb87d..7a50575a8d4d 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -46,7 +46,7 @@
46 46
47#include <asm/dma.h> 47#include <asm/dma.h>
48#include <asm/ecard.h> 48#include <asm/ecard.h>
49#include <asm/hardware.h> 49#include <mach/hardware.h>
50#include <asm/irq.h> 50#include <asm/irq.h>
51#include <asm/mmu_context.h> 51#include <asm/mmu_context.h>
52#include <asm/mach/irq.h> 52#include <asm/mach/irq.h>
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 7dca225752c1..617e509d60df 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -18,7 +18,7 @@
18#include <asm/memory.h> 18#include <asm/memory.h>
19#include <asm/glue.h> 19#include <asm/glue.h>
20#include <asm/vfpmacros.h> 20#include <asm/vfpmacros.h>
21#include <asm/arch/entry-macro.S> 21#include <mach/entry-macro.S>
22#include <asm/thread_notify.h> 22#include <asm/thread_notify.h>
23 23
24#include "entry-header.S" 24#include "entry-header.S"
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 84694e88b428..060d7e2e9f64 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -10,7 +10,7 @@
10 10
11#include <asm/unistd.h> 11#include <asm/unistd.h>
12#include <asm/ftrace.h> 12#include <asm/ftrace.h>
13#include <asm/arch/entry-macro.S> 13#include <mach/entry-macro.S>
14 14
15#include "entry-header.S" 15#include "entry-header.S"
16 16
diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index 7e9c00a8a412..1c3c6ea5f9e7 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -181,7 +181,7 @@ ENTRY(lookup_processor_type)
181 ldmfd sp!, {r4 - r7, r9, pc} 181 ldmfd sp!, {r4 - r7, r9, pc}
182 182
183/* 183/*
184 * Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for 184 * Look in <asm/procinfo.h> and arch/arm/kernel/arch.[ch] for
185 * more information about the __proc_info and __arch_info structures. 185 * more information about the __proc_info and __arch_info structures.
186 */ 186 */
187 .long __proc_info_begin 187 .long __proc_info_begin
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 5d78ffb8a9a7..27329bd32037 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -15,7 +15,6 @@
15#include <linux/init.h> 15#include <linux/init.h>
16 16
17#include <asm/assembler.h> 17#include <asm/assembler.h>
18#include <asm/mach-types.h>
19#include <asm/ptrace.h> 18#include <asm/ptrace.h>
20#include <asm/asm-offsets.h> 19#include <asm/asm-offsets.h>
21#include <asm/thread_info.h> 20#include <asm/thread_info.h>
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 11dcd52e51be..f88efb135b70 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -38,6 +38,7 @@
38#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
39 39
40#include <asm/system.h> 40#include <asm/system.h>
41#include <asm/mach/irq.h>
41#include <asm/mach/time.h> 42#include <asm/mach/time.h>
42 43
43/* 44/*
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 89bfded70a1f..3fd882337064 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -51,7 +51,7 @@ extern void setup_mm_for_reboot(char mode);
51 51
52static volatile int hlt_counter; 52static volatile int hlt_counter;
53 53
54#include <asm/arch/system.h> 54#include <mach/system.h>
55 55
56void disable_hlt(void) 56void disable_hlt(void)
57{ 57{
diff --git a/arch/arm/lib/ecard.S b/arch/arm/lib/ecard.S
index c55aaa2a2088..8678eb2b7a60 100644
--- a/arch/arm/lib/ecard.S
+++ b/arch/arm/lib/ecard.S
@@ -12,7 +12,7 @@
12 */ 12 */
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15#include <asm/hardware.h> 15#include <mach/hardware.h>
16 16
17#define CPSR2SPSR(rt) \ 17#define CPSR2SPSR(rt) \
18 mrs rt, cpsr; \ 18 mrs rt, cpsr; \
diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S
index 1dd8ea4f9a9c..2034d4dbe6ad 100644
--- a/arch/arm/lib/getuser.S
+++ b/arch/arm/lib/getuser.S
@@ -20,7 +20,7 @@
20 * r2, r3 contains the zero-extended value 20 * r2, r3 contains the zero-extended value
21 * lr corrupted 21 * lr corrupted
22 * 22 *
23 * No other registers must be altered. (see include/asm-arm/uaccess.h 23 * No other registers must be altered. (see <asm/uaccess.h>
24 * for specific ASM register usage). 24 * for specific ASM register usage).
25 * 25 *
26 * Note that ADDR_LIMIT is either 0 or 0xc0000000. 26 * Note that ADDR_LIMIT is either 0 or 0xc0000000.
diff --git a/arch/arm/lib/io-readsw-armv3.S b/arch/arm/lib/io-readsw-armv3.S
index 4ef904185142..9aaf7c72065d 100644
--- a/arch/arm/lib/io-readsw-armv3.S
+++ b/arch/arm/lib/io-readsw-armv3.S
@@ -9,7 +9,7 @@
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <asm/assembler.h> 11#include <asm/assembler.h>
12#include <asm/hardware.h> 12#include <mach/hardware.h>
13 13
14.Linsw_bad_alignment: 14.Linsw_bad_alignment:
15 adr r0, .Linsw_bad_align_msg 15 adr r0, .Linsw_bad_align_msg
diff --git a/arch/arm/lib/io-writesw-armv3.S b/arch/arm/lib/io-writesw-armv3.S
index 1607a29f49b7..cd34503e424d 100644
--- a/arch/arm/lib/io-writesw-armv3.S
+++ b/arch/arm/lib/io-writesw-armv3.S
@@ -9,7 +9,7 @@
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <asm/assembler.h> 11#include <asm/assembler.h>
12#include <asm/hardware.h> 12#include <mach/hardware.h>
13 13
14.Loutsw_bad_alignment: 14.Loutsw_bad_alignment:
15 adr r0, .Loutsw_bad_align_msg 15 adr r0, .Loutsw_bad_align_msg
diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S
index 8620afe54f72..08ec7dffa52e 100644
--- a/arch/arm/lib/putuser.S
+++ b/arch/arm/lib/putuser.S
@@ -20,7 +20,7 @@
20 * Outputs: r0 is the error code 20 * Outputs: r0 is the error code
21 * lr corrupted 21 * lr corrupted
22 * 22 *
23 * No other registers must be altered. (see include/asm-arm/uaccess.h 23 * No other registers must be altered. (see <asm/uaccess.h>
24 * for specific ASM register usage). 24 * for specific ASM register usage).
25 * 25 *
26 * Note that ADDR_LIMIT is either 0 or 0xc0000000 26 * Note that ADDR_LIMIT is either 0 or 0xc0000000
diff --git a/arch/arm/mach-aaec2000/aaed2000.c b/arch/arm/mach-aaec2000/aaed2000.c
index 83f57da3184c..81a3ecc0d104 100644
--- a/arch/arm/mach-aaec2000/aaed2000.c
+++ b/arch/arm/mach-aaec2000/aaed2000.c
@@ -20,14 +20,14 @@
20#include <asm/setup.h> 20#include <asm/setup.h>
21#include <asm/memory.h> 21#include <asm/memory.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/irq.h> 24#include <asm/irq.h>
25 25
26#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <asm/arch/aaed2000.h> 30#include <mach/aaed2000.h>
31 31
32#include "core.h" 32#include "core.h"
33 33
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c
index b016be2b0e35..dfb26bc23d1a 100644
--- a/arch/arm/mach-aaec2000/core.c
+++ b/arch/arm/mach-aaec2000/core.c
@@ -20,7 +20,7 @@
20#include <linux/timex.h> 20#include <linux/timex.h>
21#include <linux/signal.h> 21#include <linux/signal.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/irq.h> 24#include <asm/irq.h>
25#include <asm/sizes.h> 25#include <asm/sizes.h>
26 26
diff --git a/arch/arm/mach-aaec2000/include/mach/aaec2000.h b/arch/arm/mach-aaec2000/include/mach/aaec2000.h
new file mode 100644
index 000000000000..bc729c42f843
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/aaec2000.h
@@ -0,0 +1,207 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/aaec2000.h
3 *
4 * AAEC-2000 registers definition
5 *
6 * Copyright (c) 2005 Nicolas Bellido Y Ortega
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ASM_ARCH_AAEC2000_H
14#define __ASM_ARCH_AAEC2000_H
15
16#ifndef __ASM_ARCH_HARDWARE_H
17#error You must include hardware.h not this file
18#endif /* __ASM_ARCH_HARDWARE_H */
19
20/* Chip selects */
21#define AAEC_CS0 0x00000000
22#define AAEC_CS1 0x10000000
23#define AAEC_CS2 0x20000000
24#define AAEC_CS3 0x30000000
25
26/* Flash */
27#define AAEC_FLASH_BASE AAEC_CS0
28#define AAEC_FLASH_SIZE SZ_64M
29
30/* Interrupt controller */
31#define IRQ_BASE __REG(0x80000500)
32#define IRQ_INTSR __REG(0x80000500) /* Int Status Register */
33#define IRQ_INTRSR __REG(0x80000504) /* Int Raw (unmasked) Status */
34#define IRQ_INTENS __REG(0x80000508) /* Int Enable Set */
35#define IRQ_INTENC __REG(0x8000050c) /* Int Enable Clear */
36
37/* UART 1 */
38#define UART1_BASE __REG(0x80000600)
39#define UART1_DR __REG(0x80000600) /* Data/FIFO Register */
40#define UART1_LCR __REG(0x80000604) /* Link Control Register */
41#define UART1_BRCR __REG(0x80000608) /* Baud Rate Control Register */
42#define UART1_CR __REG(0x8000060c) /* Control Register */
43#define UART1_SR __REG(0x80000610) /* Status Register */
44#define UART1_INT __REG(0x80000614) /* Interrupt Status Register */
45#define UART1_INTM __REG(0x80000618) /* Interrupt Mask Register */
46#define UART1_INTRES __REG(0x8000061c) /* Int Result (masked status) Register */
47
48/* UART 2 */
49#define UART2_BASE __REG(0x80000700)
50#define UART2_DR __REG(0x80000700) /* Data/FIFO Register */
51#define UART2_LCR __REG(0x80000704) /* Link Control Register */
52#define UART2_BRCR __REG(0x80000708) /* Baud Rate Control Register */
53#define UART2_CR __REG(0x8000070c) /* Control Register */
54#define UART2_SR __REG(0x80000710) /* Status Register */
55#define UART2_INT __REG(0x80000714) /* Interrupt Status Register */
56#define UART2_INTM __REG(0x80000718) /* Interrupt Mask Register */
57#define UART2_INTRES __REG(0x8000071c) /* Int Result (masked status) Register */
58
59/* UART 3 */
60#define UART3_BASE __REG(0x80000800)
61#define UART3_DR __REG(0x80000800) /* Data/FIFO Register */
62#define UART3_LCR __REG(0x80000804) /* Link Control Register */
63#define UART3_BRCR __REG(0x80000808) /* Baud Rate Control Register */
64#define UART3_CR __REG(0x8000080c) /* Control Register */
65#define UART3_SR __REG(0x80000810) /* Status Register */
66#define UART3_INT __REG(0x80000814) /* Interrupt Status Register */
67#define UART3_INTM __REG(0x80000818) /* Interrupt Mask Register */
68#define UART3_INTRES __REG(0x8000081c) /* Int Result (masked status) Register */
69
70/* These are used in some places */
71#define _UART1_BASE __PREG(UART1_BASE)
72#define _UART2_BASE __PREG(UART2_BASE)
73#define _UART3_BASE __PREG(UART3_BASE)
74
75/* UART Registers Offsets */
76#define UART_DR 0x00
77#define UART_LCR 0x04
78#define UART_BRCR 0x08
79#define UART_CR 0x0c
80#define UART_SR 0x10
81#define UART_INT 0x14
82#define UART_INTM 0x18
83#define UART_INTRES 0x1c
84
85/* UART_LCR Bitmask */
86#define UART_LCR_BRK (1 << 0) /* Send Break */
87#define UART_LCR_PEN (1 << 1) /* Parity Enable */
88#define UART_LCR_EP (1 << 2) /* Even/Odd Parity */
89#define UART_LCR_S2 (1 << 3) /* One/Two Stop bits */
90#define UART_LCR_FIFO (1 << 4) /* FIFO Enable */
91#define UART_LCR_WL5 (0 << 5) /* Word Length - 5 bits */
92#define UART_LCR_WL6 (1 << 5) /* Word Length - 6 bits */
93#define UART_LCR_WL7 (1 << 6) /* Word Length - 7 bits */
94#define UART_LCR_WL8 (1 << 7) /* Word Length - 8 bits */
95
96/* UART_CR Bitmask */
97#define UART_CR_EN (1 << 0) /* UART Enable */
98#define UART_CR_SIR (1 << 1) /* IrDA SIR Enable */
99#define UART_CR_SIRLP (1 << 2) /* Low Power IrDA Enable */
100#define UART_CR_RXP (1 << 3) /* Receive Pin Polarity */
101#define UART_CR_TXP (1 << 4) /* Transmit Pin Polarity */
102#define UART_CR_MXP (1 << 5) /* Modem Pin Polarity */
103#define UART_CR_LOOP (1 << 6) /* Loopback Mode */
104
105/* UART_SR Bitmask */
106#define UART_SR_CTS (1 << 0) /* Clear To Send Status */
107#define UART_SR_DSR (1 << 1) /* Data Set Ready Status */
108#define UART_SR_DCD (1 << 2) /* Data Carrier Detect Status */
109#define UART_SR_TxBSY (1 << 3) /* Transmitter Busy Status */
110#define UART_SR_RxFE (1 << 4) /* Receive FIFO Empty Status */
111#define UART_SR_TxFF (1 << 5) /* Transmit FIFO Full Status */
112#define UART_SR_RxFF (1 << 6) /* Receive FIFO Full Status */
113#define UART_SR_TxFE (1 << 7) /* Transmit FIFO Empty Status */
114
115/* UART_INT Bitmask */
116#define UART_INT_RIS (1 << 0) /* Rx Interrupt */
117#define UART_INT_TIS (1 << 1) /* Tx Interrupt */
118#define UART_INT_MIS (1 << 2) /* Modem Interrupt */
119#define UART_INT_RTIS (1 << 3) /* Receive Timeout Interrupt */
120
121/* Timer 1 */
122#define TIMER1_BASE __REG(0x80000c00)
123#define TIMER1_LOAD __REG(0x80000c00) /* Timer 1 Load Register */
124#define TIMER1_VAL __REG(0x80000c04) /* Timer 1 Value Register */
125#define TIMER1_CTRL __REG(0x80000c08) /* Timer 1 Control Register */
126#define TIMER1_CLEAR __REG(0x80000c0c) /* Timer 1 Clear Register */
127
128/* Timer 2 */
129#define TIMER2_BASE __REG(0x80000d00)
130#define TIMER2_LOAD __REG(0x80000d00) /* Timer 2 Load Register */
131#define TIMER2_VAL __REG(0x80000d04) /* Timer 2 Value Register */
132#define TIMER2_CTRL __REG(0x80000d08) /* Timer 2 Control Register */
133#define TIMER2_CLEAR __REG(0x80000d0c) /* Timer 2 Clear Register */
134
135/* Timer 3 */
136#define TIMER3_BASE __REG(0x80000e00)
137#define TIMER3_LOAD __REG(0x80000e00) /* Timer 3 Load Register */
138#define TIMER3_VAL __REG(0x80000e04) /* Timer 3 Value Register */
139#define TIMER3_CTRL __REG(0x80000e08) /* Timer 3 Control Register */
140#define TIMER3_CLEAR __REG(0x80000e0c) /* Timer 3 Clear Register */
141
142/* Timer Control register bits */
143#define TIMER_CTRL_ENABLE (1 << 7) /* Enable (Start Timer) */
144#define TIMER_CTRL_PERIODIC (1 << 6) /* Periodic Running Mode */
145#define TIMER_CTRL_FREE_RUNNING (0 << 6) /* Normal Running Mode */
146#define TIMER_CTRL_CLKSEL_508K (1 << 3) /* 508KHz Clock select (Timer 1, 2) */
147#define TIMER_CTRL_CLKSEL_2K (0 << 3) /* 2KHz Clock Select (Timer 1, 2) */
148
149/* Power and State Control */
150#define POWER_BASE __REG(0x80000400)
151#define POWER_PWRSR __REG(0x80000400) /* Power Status Register */
152#define POWER_PWRCNT __REG(0x80000404) /* Power/Clock control */
153#define POWER_HALT __REG(0x80000408) /* Power Idle Mode */
154#define POWER_STDBY __REG(0x8000040c) /* Power Standby Mode */
155#define POWER_BLEOI __REG(0x80000410) /* Battery Low End of Interrupt */
156#define POWER_MCEOI __REG(0x80000414) /* Media Changed EoI */
157#define POWER_TEOI __REG(0x80000418) /* Tick EoI */
158#define POWER_STFCLR __REG(0x8000041c) /* NbFlg, RSTFlg, PFFlg, CLDFlg Clear */
159#define POWER_CLKSET __REG(0x80000420) /* Clock Speed Control */
160
161/* GPIO Registers */
162#define AAEC_GPIO_PHYS 0x80000e00
163
164#define AAEC_GPIO_PADR __REG(AAEC_GPIO_PHYS + 0x00)
165#define AAEC_GPIO_PBDR __REG(AAEC_GPIO_PHYS + 0x04)
166#define AAEC_GPIO_PCDR __REG(AAEC_GPIO_PHYS + 0x08)
167#define AAEC_GPIO_PDDR __REG(AAEC_GPIO_PHYS + 0x0c)
168#define AAEC_GPIO_PADDR __REG(AAEC_GPIO_PHYS + 0x10)
169#define AAEC_GPIO_PBDDR __REG(AAEC_GPIO_PHYS + 0x14)
170#define AAEC_GPIO_PCDDR __REG(AAEC_GPIO_PHYS + 0x18)
171#define AAEC_GPIO_PDDDR __REG(AAEC_GPIO_PHYS + 0x1c)
172#define AAEC_GPIO_PEDR __REG(AAEC_GPIO_PHYS + 0x20)
173#define AAEC_GPIO_PEDDR __REG(AAEC_GPIO_PHYS + 0x24)
174#define AAEC_GPIO_KSCAN __REG(AAEC_GPIO_PHYS + 0x28)
175#define AAEC_GPIO_PINMUX __REG(AAEC_GPIO_PHYS + 0x2c)
176#define AAEC_GPIO_PFDR __REG(AAEC_GPIO_PHYS + 0x30)
177#define AAEC_GPIO_PFDDR __REG(AAEC_GPIO_PHYS + 0x34)
178#define AAEC_GPIO_PGDR __REG(AAEC_GPIO_PHYS + 0x38)
179#define AAEC_GPIO_PGDDR __REG(AAEC_GPIO_PHYS + 0x3c)
180#define AAEC_GPIO_PHDR __REG(AAEC_GPIO_PHYS + 0x40)
181#define AAEC_GPIO_PHDDR __REG(AAEC_GPIO_PHYS + 0x44)
182#define AAEC_GPIO_RAZ __REG(AAEC_GPIO_PHYS + 0x48)
183#define AAEC_GPIO_INTTYPE1 __REG(AAEC_GPIO_PHYS + 0x4c)
184#define AAEC_GPIO_INTTYPE2 __REG(AAEC_GPIO_PHYS + 0x50)
185#define AAEC_GPIO_FEOI __REG(AAEC_GPIO_PHYS + 0x54)
186#define AAEC_GPIO_INTEN __REG(AAEC_GPIO_PHYS + 0x58)
187#define AAEC_GPIO_INTSTATUS __REG(AAEC_GPIO_PHYS + 0x5c)
188#define AAEC_GPIO_RAWINTSTATUS __REG(AAEC_GPIO_PHYS + 0x60)
189#define AAEC_GPIO_DB __REG(AAEC_GPIO_PHYS + 0x64)
190#define AAEC_GPIO_PAPINDR __REG(AAEC_GPIO_PHYS + 0x68)
191#define AAEC_GPIO_PBPINDR __REG(AAEC_GPIO_PHYS + 0x6c)
192#define AAEC_GPIO_PCPINDR __REG(AAEC_GPIO_PHYS + 0x70)
193#define AAEC_GPIO_PDPINDR __REG(AAEC_GPIO_PHYS + 0x74)
194#define AAEC_GPIO_PEPINDR __REG(AAEC_GPIO_PHYS + 0x78)
195#define AAEC_GPIO_PFPINDR __REG(AAEC_GPIO_PHYS + 0x7c)
196#define AAEC_GPIO_PGPINDR __REG(AAEC_GPIO_PHYS + 0x80)
197#define AAEC_GPIO_PHPINDR __REG(AAEC_GPIO_PHYS + 0x84)
198
199#define AAEC_GPIO_PINMUX_PE0CON (1 << 0)
200#define AAEC_GPIO_PINMUX_PD0CON (1 << 1)
201#define AAEC_GPIO_PINMUX_CODECON (1 << 2)
202#define AAEC_GPIO_PINMUX_UART3CON (1 << 3)
203
204/* LCD Controller */
205#define AAEC_CLCD_PHYS 0x80003000
206
207#endif /* __ARM_ARCH_AAEC2000_H */
diff --git a/arch/arm/mach-aaec2000/include/mach/aaed2000.h b/arch/arm/mach-aaec2000/include/mach/aaed2000.h
new file mode 100644
index 000000000000..f821295ca71b
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/aaed2000.h
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/aaed2000.h
3 *
4 * AAED-2000 specific bits definition
5 *
6 * Copyright (c) 2005 Nicolas Bellido Y Ortega
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ASM_ARCH_AAED2000_H
14#define __ASM_ARCH_AAED2000_H
15
16/* External GPIOs. */
17
18#define EXT_GPIO_PBASE AAEC_CS3
19#define EXT_GPIO_VBASE 0xf8100000
20#define EXT_GPIO_LENGTH 0x00001000
21
22#define __ext_gpio_p2v(x) ((x) - EXT_GPIO_PBASE + EXT_GPIO_VBASE)
23#define __ext_gpio_v2p(x) ((x) + EXT_GPIO_PBASE - EXT_GPIO_VBASE)
24
25#define __EXT_GPIO_REG(x) (*((volatile u32 *)__ext_gpio_p2v(x)))
26#define __EXT_GPIO_PREG(x) (__ext_gpio_v2p((u32)&(x)))
27
28#define AAED_EXT_GPIO __EXT_GPIO_REG(EXT_GPIO_PBASE)
29
30#define AAED_EGPIO_KBD_SCAN 0x00003fff /* Keyboard scan data */
31#define AAED_EGPIO_PWR_INT 0x00008fff /* Smart battery charger interrupt */
32#define AAED_EGPIO_SWITCHED 0x000f0000 /* DIP Switches */
33#define AAED_EGPIO_USB_VBUS 0x00400000 /* USB Vbus sense */
34#define AAED_EGPIO_LCD_PWR_EN 0x02000000 /* LCD and backlight PWR enable */
35#define AAED_EGPIO_nLED0 0x20000000 /* LED 0 */
36#define AAED_EGPIO_nLED1 0x20000000 /* LED 1 */
37#define AAED_EGPIO_nLED2 0x20000000 /* LED 2 */
38
39
40#endif /* __ARM_ARCH_AAED2000_H */
diff --git a/arch/arm/mach-aaec2000/include/mach/debug-macro.S b/arch/arm/mach-aaec2000/include/mach/debug-macro.S
new file mode 100644
index 000000000000..0b6351d7c389
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/debug-macro.S
@@ -0,0 +1,37 @@
1/* arch/arm/mach-aaec2000/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (c) 2005 Nicolas Bellido Y Ortega
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#include "hardware.h"
13 .macro addruart,rx
14 mrc p15, 0, \rx, c1, c0
15 tst \rx, #1 @ MMU enabled?
16 moveq \rx, #0x80000000 @ physical
17 movne \rx, #io_p2v(0x80000000) @ virtual
18 orr \rx, \rx, #0x00000800
19 .endm
20
21 .macro senduart,rd,rx
22 str \rd, [\rx, #0]
23 .endm
24
25 .macro busyuart,rd,rx
261002: ldr \rd, [\rx, #0x10]
27 tst \rd, #(1 << 7)
28 beq 1002b
29 .endm
30
31 .macro waituart,rd,rx
32#if 0
331001: ldr \rd, [\rx, #0x10]
34 tst \rd, #(1 << 5)
35 beq 1001b
36#endif
37 .endm
diff --git a/arch/arm/mach-aaec2000/include/mach/dma.h b/arch/arm/mach-aaec2000/include/mach/dma.h
new file mode 100644
index 000000000000..2da846c72fe7
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/dma.h
@@ -0,0 +1,9 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/dma.h
3 *
4 * Copyright (c) 2005 Nicolas Bellido Y Ortega
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 */
diff --git a/arch/arm/mach-aaec2000/include/mach/entry-macro.S b/arch/arm/mach-aaec2000/include/mach/entry-macro.S
new file mode 100644
index 000000000000..c8fb34469007
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/entry-macro.S
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper for aaec-2000 based platforms
5 *
6 * Copyright (c) 2005 Nicolas Bellido Y Ortega
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13#include <mach/irqs.h>
14
15 .macro disable_fiq
16 .endm
17
18 .macro get_irqnr_preamble, base, tmp
19 .endm
20
21 .macro arch_ret_to_user, tmp1, tmp2
22 .endm
23
24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
25 mov r4, #0xf8000000
26 add r4, r4, #0x00000500
27 mov \base, r4
28 ldr \irqstat, [\base, #0]
29 cmp \irqstat, #0
30 bne 1001f
31 ldr \irqnr, =NR_IRQS+1
32 b 1003f
331001: mov \irqnr, #0
341002: ands \tmp, \irqstat, #1
35 mov \irqstat, \irqstat, LSR #1
36 add \irqnr, \irqnr, #1
37 beq 1002b
38 sub \irqnr, \irqnr, #1
391003:
40 .endm
diff --git a/arch/arm/mach-aaec2000/include/mach/hardware.h b/arch/arm/mach-aaec2000/include/mach/hardware.h
new file mode 100644
index 000000000000..965a6f6672d6
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/hardware.h
@@ -0,0 +1,50 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/hardware.h
3 *
4 * Copyright (c) 2005 Nicolas Bellido Y Ortega
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_HARDWARE_H
12#define __ASM_ARCH_HARDWARE_H
13
14#include <asm/sizes.h>
15#include <mach/aaec2000.h>
16
17/* The kernel is loaded at physical address 0xf8000000.
18 * We map the IO space a bit after
19 */
20#define PIO_APB_BASE 0x80000000
21#define VIO_APB_BASE 0xf8000000
22#define IO_APB_LENGTH 0x2000
23#define PIO_AHB_BASE 0x80002000
24#define VIO_AHB_BASE 0xf8002000
25#define IO_AHB_LENGTH 0x2000
26
27#define VIO_BASE VIO_APB_BASE
28#define PIO_BASE PIO_APB_BASE
29
30#define io_p2v(x) ( (x) - PIO_BASE + VIO_BASE )
31#define io_v2p(x) ( (x) + PIO_BASE - VIO_BASE )
32
33#ifndef __ASSEMBLY__
34
35#include <asm/types.h>
36
37/* FIXME: Is it needed to optimize this a la pxa ?? */
38#define __REG(x) (*((volatile u32 *)io_p2v(x)))
39#define __PREG(x) (io_v2p((u32)&(x)))
40
41#else /* __ASSEMBLY__ */
42
43#define __REG(x) io_p2v(x)
44#define __PREG(x) io_v2p(x)
45
46#endif
47
48#include "aaec2000.h"
49
50#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-aaec2000/include/mach/io.h b/arch/arm/mach-aaec2000/include/mach/io.h
new file mode 100644
index 000000000000..c87c24de1110
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/io.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/io.h
3 *
4 * Copied from asm/arch/sa1100/io.h
5 */
6#ifndef __ASM_ARM_ARCH_IO_H
7#define __ASM_ARM_ARCH_IO_H
8
9#include <mach/hardware.h>
10
11#define IO_SPACE_LIMIT 0xffffffff
12
13/*
14 * We don't actually have real ISA nor PCI buses, but there is so many
15 * drivers out there that might just work if we fake them...
16 */
17#define __io(a) ((void __iomem *)(a))
18#define __mem_pci(a) (a)
19
20#endif
diff --git a/arch/arm/mach-aaec2000/include/mach/irqs.h b/arch/arm/mach-aaec2000/include/mach/irqs.h
new file mode 100644
index 000000000000..bf45c6d2f294
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/irqs.h
@@ -0,0 +1,46 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/irqs.h
3 *
4 * Copyright (c) 2005 Nicolas Bellido Y Ortega
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_IRQS_H
12#define __ASM_ARCH_IRQS_H
13
14
15#define INT_GPIOF0_FIQ 0 /* External GPIO Port F O Fast Interrupt Input */
16#define INT_BL_FIQ 1 /* Battery Low Fast Interrupt */
17#define INT_WE_FIQ 2 /* Watchdog Expired Fast Interrupt */
18#define INT_MV_FIQ 3 /* Media Changed Interrupt */
19#define INT_SC 4 /* Sound Codec Interrupt */
20#define INT_GPIO1 5 /* GPIO Port F Configurable Int 1 */
21#define INT_GPIO2 6 /* GPIO Port F Configurable Int 2 */
22#define INT_GPIO3 7 /* GPIO Port F Configurable Int 3 */
23#define INT_TMR1_OFL 8 /* Timer 1 Overflow Interrupt */
24#define INT_TMR2_OFL 9 /* Timer 2 Overflow Interrupt */
25#define INT_RTC_CM 10 /* RTC Compare Match Interrupt */
26#define INT_TICK 11 /* 64Hz Tick Interrupt */
27#define INT_UART1 12 /* UART1 Interrupt */
28#define INT_UART2 13 /* UART2 & Modem State Changed Interrupt */
29#define INT_LCD 14 /* LCD Interrupt */
30#define INT_SSI 15 /* SSI End of Transfer Interrupt */
31#define INT_UART3 16 /* UART3 Interrupt */
32#define INT_SCI 17 /* SCI Interrupt */
33#define INT_AAC 18 /* Advanced Audio Codec Interrupt */
34#define INT_MMC 19 /* MMC Interrupt */
35#define INT_USB 20 /* USB Interrupt */
36#define INT_DMA 21 /* DMA Interrupt */
37#define INT_TMR3_UOFL 22 /* Timer 3 Underflow Interrupt */
38#define INT_GPIO4 23 /* GPIO Port F Configurable Int 4 */
39#define INT_GPIO5 24 /* GPIO Port F Configurable Int 4 */
40#define INT_GPIO6 25 /* GPIO Port F Configurable Int 4 */
41#define INT_GPIO7 26 /* GPIO Port F Configurable Int 4 */
42#define INT_BMI 27 /* BMI Interrupt */
43
44#define NR_IRQS (INT_BMI + 1)
45
46#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-aaec2000/include/mach/memory.h b/arch/arm/mach-aaec2000/include/mach/memory.h
new file mode 100644
index 000000000000..56ae900a482e
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/memory.h
@@ -0,0 +1,30 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/memory.h
3 *
4 * Copyright (c) 2005 Nicolas Bellido Y Ortega
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_MEMORY_H
12#define __ASM_ARCH_MEMORY_H
13
14
15#define PHYS_OFFSET UL(0xf0000000)
16
17#define __virt_to_bus(x) __virt_to_phys(x)
18#define __bus_to_virt(x) __phys_to_virt(x)
19
20/*
21 * The nodes are the followings:
22 *
23 * node 0: 0xf000.0000 - 0xf3ff.ffff
24 * node 1: 0xf400.0000 - 0xf7ff.ffff
25 * node 2: 0xf800.0000 - 0xfbff.ffff
26 * node 3: 0xfc00.0000 - 0xffff.ffff
27 */
28#define NODE_MEM_SIZE_BITS 26
29
30#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-aaec2000/include/mach/system.h b/arch/arm/mach-aaec2000/include/mach/system.h
new file mode 100644
index 000000000000..8f4115d734ce
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/system.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-aaed2000/include/mach/system.h
3 *
4 * Copyright (c) 2005 Nicolas Bellido Y Ortega
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_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H
13
14static inline void arch_idle(void)
15{
16 cpu_do_idle();
17}
18
19static inline void arch_reset(char mode)
20{
21 cpu_reset(0);
22}
23
24#endif /* __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-aaec2000/include/mach/timex.h b/arch/arm/mach-aaec2000/include/mach/timex.h
new file mode 100644
index 000000000000..6c8edf4a8828
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/timex.h
@@ -0,0 +1,18 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/timex.h
3 *
4 * AAEC-2000 Architecture timex specification
5 *
6 * Copyright (c) 2005 Nicolas Bellido Y Ortega
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ASM_ARCH_TIMEX_H
14#define __ASM_ARCH_TIMEX_H
15
16#define CLOCK_TICK_RATE 508000
17
18#endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-aaec2000/include/mach/uncompress.h b/arch/arm/mach-aaec2000/include/mach/uncompress.h
new file mode 100644
index 000000000000..381ecad1a1bb
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/uncompress.h
@@ -0,0 +1,46 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/uncompress.h
3 *
4 * Copyright (c) 2005 Nicolas Bellido Y Ortega
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_UNCOMPRESS_H
12#define __ASM_ARCH_UNCOMPRESS_H
13
14#include "hardware.h"
15
16#define UART(x) (*(volatile unsigned long *)(serial_port + (x)))
17
18static void putc(int c)
19{
20 unsigned long serial_port;
21 do {
22 serial_port = _UART3_BASE;
23 if (UART(UART_CR) & UART_CR_EN) break;
24 serial_port = _UART1_BASE;
25 if (UART(UART_CR) & UART_CR_EN) break;
26 serial_port = _UART2_BASE;
27 if (UART(UART_CR) & UART_CR_EN) break;
28 return;
29 } while (0);
30
31 /* wait for space in the UART's transmitter */
32 while ((UART(UART_SR) & UART_SR_TxFF))
33 barrier();
34
35 /* send the character out. */
36 UART(UART_DR) = c;
37}
38
39static inline void flush(void)
40{
41}
42
43#define arch_decomp_setup()
44#define arch_decomp_wdog()
45
46#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-aaec2000/include/mach/vmalloc.h b/arch/arm/mach-aaec2000/include/mach/vmalloc.h
new file mode 100644
index 000000000000..551f68f666bf
--- /dev/null
+++ b/arch/arm/mach-aaec2000/include/mach/vmalloc.h
@@ -0,0 +1,16 @@
1/*
2 * arch/arm/mach-aaec2000/include/mach/vmalloc.h
3 *
4 * Copyright (c) 2005 Nicolas Bellido Y Ortega
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_VMALLOC_H
12#define __ASM_ARCH_VMALLOC_H
13
14#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
15
16#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index 933fa8f55cbc..638948c16770 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -17,10 +17,10 @@
17 17
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20#include <asm/arch/at91cap9.h> 20#include <mach/at91cap9.h>
21#include <asm/arch/at91_pmc.h> 21#include <mach/at91_pmc.h>
22#include <asm/arch/at91_rstc.h> 22#include <mach/at91_rstc.h>
23#include <asm/arch/at91_shdwc.h> 23#include <mach/at91_shdwc.h>
24 24
25#include "generic.h" 25#include "generic.h"
26#include "clock.h" 26#include "clock.h"
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index 25765f1afca9..abb4aac8fa98 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -20,11 +20,11 @@
20 20
21#include <video/atmel_lcdc.h> 21#include <video/atmel_lcdc.h>
22 22
23#include <asm/arch/board.h> 23#include <mach/board.h>
24#include <asm/arch/gpio.h> 24#include <mach/gpio.h>
25#include <asm/arch/at91cap9.h> 25#include <mach/at91cap9.h>
26#include <asm/arch/at91cap9_matrix.h> 26#include <mach/at91cap9_matrix.h>
27#include <asm/arch/at91sam9_smc.h> 27#include <mach/at91sam9_smc.h>
28 28
29#include "generic.h" 29#include "generic.h"
30 30
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index d688c1dbd925..28594fcc88e3 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -14,9 +14,9 @@
14 14
15#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17#include <asm/arch/at91rm9200.h> 17#include <mach/at91rm9200.h>
18#include <asm/arch/at91_pmc.h> 18#include <mach/at91_pmc.h>
19#include <asm/arch/at91_st.h> 19#include <mach/at91_st.h>
20 20
21#include "generic.h" 21#include "generic.h"
22#include "clock.h" 22#include "clock.h"
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index d2c5c84bf6b8..9338825cfcd7 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -17,10 +17,10 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
19 19
20#include <asm/arch/board.h> 20#include <mach/board.h>
21#include <asm/arch/gpio.h> 21#include <mach/gpio.h>
22#include <asm/arch/at91rm9200.h> 22#include <mach/at91rm9200.h>
23#include <asm/arch/at91rm9200_mc.h> 23#include <mach/at91rm9200_mc.h>
24 24
25#include "generic.h" 25#include "generic.h"
26 26
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index 50392ff71513..a72e798a2a40 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -26,7 +26,7 @@
26 26
27#include <asm/mach/time.h> 27#include <asm/mach/time.h>
28 28
29#include <asm/arch/at91_st.h> 29#include <mach/at91_st.h>
30 30
31static unsigned long last_crtr; 31static unsigned long last_crtr;
32static u32 irqmask; 32static u32 irqmask;
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 380f12a12200..accb69ec478e 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -15,11 +15,11 @@
15 15
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18#include <asm/arch/cpu.h> 18#include <mach/cpu.h>
19#include <asm/arch/at91sam9260.h> 19#include <mach/at91sam9260.h>
20#include <asm/arch/at91_pmc.h> 20#include <mach/at91_pmc.h>
21#include <asm/arch/at91_rstc.h> 21#include <mach/at91_rstc.h>
22#include <asm/arch/at91_shdwc.h> 22#include <mach/at91_shdwc.h>
23 23
24#include "generic.h" 24#include "generic.h"
25#include "clock.h" 25#include "clock.h"
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index f5fec0a9cf49..7774d17dde74 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -16,12 +16,12 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h> 17#include <linux/i2c-gpio.h>
18 18
19#include <asm/arch/board.h> 19#include <mach/board.h>
20#include <asm/arch/gpio.h> 20#include <mach/gpio.h>
21#include <asm/arch/cpu.h> 21#include <mach/cpu.h>
22#include <asm/arch/at91sam9260.h> 22#include <mach/at91sam9260.h>
23#include <asm/arch/at91sam9260_matrix.h> 23#include <mach/at91sam9260_matrix.h>
24#include <asm/arch/at91sam9_smc.h> 24#include <mach/at91sam9_smc.h>
25 25
26#include "generic.h" 26#include "generic.h"
27 27
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 35bf6fd52516..7b51a59ae8b3 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -15,10 +15,10 @@
15 15
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18#include <asm/arch/at91sam9261.h> 18#include <mach/at91sam9261.h>
19#include <asm/arch/at91_pmc.h> 19#include <mach/at91_pmc.h>
20#include <asm/arch/at91_rstc.h> 20#include <mach/at91_rstc.h>
21#include <asm/arch/at91_shdwc.h> 21#include <mach/at91_shdwc.h>
22 22
23#include "generic.h" 23#include "generic.h"
24#include "clock.h" 24#include "clock.h"
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index b80860e31383..6b89172310c7 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -20,11 +20,11 @@
20#include <linux/fb.h> 20#include <linux/fb.h>
21#include <video/atmel_lcdc.h> 21#include <video/atmel_lcdc.h>
22 22
23#include <asm/arch/board.h> 23#include <mach/board.h>
24#include <asm/arch/gpio.h> 24#include <mach/gpio.h>
25#include <asm/arch/at91sam9261.h> 25#include <mach/at91sam9261.h>
26#include <asm/arch/at91sam9261_matrix.h> 26#include <mach/at91sam9261_matrix.h>
27#include <asm/arch/at91sam9_smc.h> 27#include <mach/at91sam9_smc.h>
28 28
29#include "generic.h" 29#include "generic.h"
30 30
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 052074a9f2d3..80bfab5680e2 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -15,10 +15,10 @@
15 15
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18#include <asm/arch/at91sam9263.h> 18#include <mach/at91sam9263.h>
19#include <asm/arch/at91_pmc.h> 19#include <mach/at91_pmc.h>
20#include <asm/arch/at91_rstc.h> 20#include <mach/at91_rstc.h>
21#include <asm/arch/at91_shdwc.h> 21#include <mach/at91_shdwc.h>
22 22
23#include "generic.h" 23#include "generic.h"
24#include "clock.h" 24#include "clock.h"
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 42108d02f593..c93992f55dc9 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -19,11 +19,11 @@
19#include <linux/fb.h> 19#include <linux/fb.h>
20#include <video/atmel_lcdc.h> 20#include <video/atmel_lcdc.h>
21 21
22#include <asm/arch/board.h> 22#include <mach/board.h>
23#include <asm/arch/gpio.h> 23#include <mach/gpio.h>
24#include <asm/arch/at91sam9263.h> 24#include <mach/at91sam9263.h>
25#include <asm/arch/at91sam9263_matrix.h> 25#include <mach/at91sam9263_matrix.h>
26#include <asm/arch/at91sam9_smc.h> 26#include <mach/at91sam9_smc.h>
27 27
28#include "generic.h" 28#include "generic.h"
29 29
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index 5cecbd7de6a6..122fd77ed580 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -17,7 +17,7 @@
17 17
18#include <asm/mach/time.h> 18#include <asm/mach/time.h>
19 19
20#include <asm/arch/at91_pit.h> 20#include <mach/at91_pit.h>
21 21
22 22
23#define PIT_CPIV(x) ((x) & AT91_PIT_CPIV) 23#define PIT_CPIV(x) ((x) & AT91_PIT_CPIV)
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 902c79893ec7..556bddf35b45 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -14,11 +14,11 @@
14 14
15#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17#include <asm/arch/cpu.h> 17#include <mach/cpu.h>
18#include <asm/arch/at91sam9rl.h> 18#include <mach/at91sam9rl.h>
19#include <asm/arch/at91_pmc.h> 19#include <mach/at91_pmc.h>
20#include <asm/arch/at91_rstc.h> 20#include <mach/at91_rstc.h>
21#include <asm/arch/at91_shdwc.h> 21#include <mach/at91_shdwc.h>
22 22
23#include "generic.h" 23#include "generic.h"
24#include "clock.h" 24#include "clock.h"
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 9c61576f1c8d..620886341fb5 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -16,11 +16,11 @@
16#include <linux/fb.h> 16#include <linux/fb.h>
17#include <video/atmel_lcdc.h> 17#include <video/atmel_lcdc.h>
18 18
19#include <asm/arch/board.h> 19#include <mach/board.h>
20#include <asm/arch/gpio.h> 20#include <mach/gpio.h>
21#include <asm/arch/at91sam9rl.h> 21#include <mach/at91sam9rl.h>
22#include <asm/arch/at91sam9rl_matrix.h> 22#include <mach/at91sam9rl_matrix.h>
23#include <asm/arch/at91sam9_smc.h> 23#include <mach/at91sam9_smc.h>
24 24
25#include "generic.h" 25#include "generic.h"
26 26
diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c
index f44647738ee4..ad3ec85b2790 100644
--- a/arch/arm/mach-at91/at91x40.c
+++ b/arch/arm/mach-at91/at91x40.c
@@ -14,9 +14,9 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/arch/at91x40.h> 17#include <mach/at91x40.h>
18#include <asm/arch/at91_st.h> 18#include <mach/at91_st.h>
19#include <asm/arch/timex.h> 19#include <mach/timex.h>
20#include "generic.h" 20#include "generic.h"
21 21
22/* 22/*
diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c
index eddc882f1b4a..869b5e28d195 100644
--- a/arch/arm/mach-at91/at91x40_time.c
+++ b/arch/arm/mach-at91/at91x40_time.c
@@ -23,10 +23,10 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/time.h> 25#include <linux/time.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/mach/time.h> 28#include <asm/mach/time.h>
29#include <asm/arch/at91_tc.h> 29#include <mach/at91_tc.h>
30 30
31/* 31/*
32 * 3 counter/timer units present. 32 * 3 counter/timer units present.
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index 2d3d4b6f7b02..9b27d167bff0 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -24,7 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/setup.h> 28#include <asm/setup.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
@@ -33,8 +33,8 @@
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
35 35
36#include <asm/arch/board.h> 36#include <mach/board.h>
37#include <asm/arch/gpio.h> 37#include <mach/gpio.h>
38 38
39#include "generic.h" 39#include "generic.h"
40 40
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index af2c33aff1a8..cdddca54b938 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -28,7 +28,7 @@
28#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
29#include <linux/spi/flash.h> 29#include <linux/spi/flash.h>
30 30
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/setup.h> 32#include <asm/setup.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
@@ -37,8 +37,8 @@
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
39 39
40#include <asm/arch/board.h> 40#include <mach/board.h>
41#include <asm/arch/gpio.h> 41#include <mach/gpio.h>
42 42
43#include "generic.h" 43#include "generic.h"
44 44
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index 1f4725972edc..196199552eb6 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -33,7 +33,7 @@
33 33
34#include <video/atmel_lcdc.h> 34#include <video/atmel_lcdc.h>
35 35
36#include <asm/hardware.h> 36#include <mach/hardware.h>
37#include <asm/setup.h> 37#include <asm/setup.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/irq.h> 39#include <asm/irq.h>
@@ -42,10 +42,10 @@
42#include <asm/mach/map.h> 42#include <asm/mach/map.h>
43#include <asm/mach/irq.h> 43#include <asm/mach/irq.h>
44 44
45#include <asm/arch/board.h> 45#include <mach/board.h>
46#include <asm/arch/gpio.h> 46#include <mach/gpio.h>
47#include <asm/arch/at91cap9_matrix.h> 47#include <mach/at91cap9_matrix.h>
48#include <asm/arch/at91sam9_smc.h> 48#include <mach/at91sam9_smc.h>
49 49
50#include "generic.h" 50#include "generic.h"
51 51
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 9854fc3dd1f2..afa1ff0e9577 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -25,7 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/setup.h> 29#include <asm/setup.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
@@ -34,8 +34,8 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36 36
37#include <asm/arch/board.h> 37#include <mach/board.h>
38#include <asm/arch/gpio.h> 38#include <mach/gpio.h>
39 39
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 81f1ebb4e964..cb7c9a8fa487 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -28,7 +28,7 @@
28#include <linux/input.h> 28#include <linux/input.h>
29#include <linux/gpio_keys.h> 29#include <linux/gpio_keys.h>
30 30
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/setup.h> 32#include <asm/setup.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
@@ -37,8 +37,8 @@
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
39 39
40#include <asm/arch/board.h> 40#include <mach/board.h>
41#include <asm/arch/gpio.h> 41#include <mach/gpio.h>
42 42
43#include "generic.h" 43#include "generic.h"
44 44
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index bb1a5474ddab..8db8bd8babd9 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -25,7 +25,7 @@
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/setup.h> 29#include <asm/setup.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
@@ -34,8 +34,8 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36 36
37#include <asm/arch/board.h> 37#include <mach/board.h>
38#include <asm/arch/gpio.h> 38#include <mach/gpio.h>
39 39
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c
index 02a70b2f355b..43e1aa7ecef7 100644
--- a/arch/arm/mach-at91/board-dk.c
+++ b/arch/arm/mach-at91/board-dk.c
@@ -29,7 +29,7 @@
29#include <linux/spi/spi.h> 29#include <linux/spi/spi.h>
30#include <linux/mtd/physmap.h> 30#include <linux/mtd/physmap.h>
31 31
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/setup.h> 33#include <asm/setup.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
@@ -38,9 +38,9 @@
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
39#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
40 40
41#include <asm/arch/board.h> 41#include <mach/board.h>
42#include <asm/arch/gpio.h> 42#include <mach/gpio.h>
43#include <asm/arch/at91rm9200_mc.h> 43#include <mach/at91rm9200_mc.h>
44 44
45#include "generic.h" 45#include "generic.h"
46 46
diff --git a/arch/arm/mach-at91/board-eb01.c b/arch/arm/mach-at91/board-eb01.c
index 0c1e3858e7df..1f9d3cb64c50 100644
--- a/arch/arm/mach-at91/board-eb01.c
+++ b/arch/arm/mach-at91/board-eb01.c
@@ -24,10 +24,10 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30#include <asm/arch/board.h> 30#include <mach/board.h>
31#include "generic.h" 31#include "generic.h"
32 32
33static void __init at91eb01_map_io(void) 33static void __init at91eb01_map_io(void)
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 3fe054e0056b..528656761ff7 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -25,7 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/device.h> 26#include <linux/device.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/setup.h> 29#include <asm/setup.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
@@ -34,8 +34,8 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36 36
37#include <asm/arch/board.h> 37#include <mach/board.h>
38#include <asm/arch/gpio.h> 38#include <mach/gpio.h>
39 39
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index e77fad443835..bfeee8a2af28 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -27,7 +27,7 @@
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <linux/spi/flash.h> 28#include <linux/spi/flash.h>
29 29
30#include <asm/hardware.h> 30#include <mach/hardware.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
@@ -36,8 +36,8 @@
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
38 38
39#include <asm/arch/board.h> 39#include <mach/board.h>
40#include <asm/arch/gpio.h> 40#include <mach/gpio.h>
41 41
42#include "generic.h" 42#include "generic.h"
43 43
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c
index 74aa4325eab3..60626e7a3490 100644
--- a/arch/arm/mach-at91/board-ek.c
+++ b/arch/arm/mach-at91/board-ek.c
@@ -29,7 +29,7 @@
29#include <linux/spi/spi.h> 29#include <linux/spi/spi.h>
30#include <linux/mtd/physmap.h> 30#include <linux/mtd/physmap.h>
31 31
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/setup.h> 33#include <asm/setup.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
@@ -38,9 +38,9 @@
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
39#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
40 40
41#include <asm/arch/board.h> 41#include <mach/board.h>
42#include <asm/arch/gpio.h> 42#include <mach/gpio.h>
43#include <asm/arch/at91rm9200_mc.h> 43#include <mach/at91rm9200_mc.h>
44 44
45#include "generic.h" 45#include "generic.h"
46 46
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index cf1b7b2f76fb..a87956c0a74f 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -24,7 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/setup.h> 28#include <asm/setup.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
@@ -33,8 +33,8 @@
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
35 35
36#include <asm/arch/board.h> 36#include <mach/board.h>
37#include <asm/arch/gpio.h> 37#include <mach/gpio.h>
38 38
39#include "generic.h" 39#include "generic.h"
40 40
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 082ed59365a4..fe9b9913fa3c 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -25,7 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/setup.h> 29#include <asm/setup.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
@@ -34,10 +34,10 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36 36
37#include <asm/arch/board.h> 37#include <mach/board.h>
38#include <asm/arch/gpio.h> 38#include <mach/gpio.h>
39 39
40#include <asm/arch/at91rm9200_mc.h> 40#include <mach/at91rm9200_mc.h>
41 41
42#include "generic.h" 42#include "generic.h"
43 43
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 6acb55c09ae5..dbc912d633c7 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -27,7 +27,7 @@
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <linux/mtd/physmap.h> 28#include <linux/mtd/physmap.h>
29 29
30#include <asm/hardware.h> 30#include <mach/hardware.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
@@ -36,9 +36,9 @@
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
38 38
39#include <asm/arch/board.h> 39#include <mach/board.h>
40#include <asm/arch/gpio.h> 40#include <mach/gpio.h>
41#include <asm/arch/at91rm9200_mc.h> 41#include <mach/at91rm9200_mc.h>
42 42
43#include "generic.h" 43#include "generic.h"
44 44
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 33b1ccdb516d..4c28413426c2 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -30,7 +30,7 @@
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/clk.h> 31#include <linux/clk.h>
32 32
33#include <asm/hardware.h> 33#include <mach/hardware.h>
34#include <asm/setup.h> 34#include <asm/setup.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
@@ -39,9 +39,9 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
41 41
42#include <asm/arch/board.h> 42#include <mach/board.h>
43#include <asm/arch/gpio.h> 43#include <mach/gpio.h>
44#include <asm/arch/at91_shdwc.h> 44#include <mach/at91_shdwc.h>
45 45
46#include "generic.h" 46#include "generic.h"
47 47
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 3cd5f8d0e2e2..e4910cb26c16 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -27,7 +27,7 @@
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
29 29
30#include <asm/hardware.h> 30#include <mach/hardware.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
@@ -36,8 +36,8 @@
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
38 38
39#include <asm/arch/board.h> 39#include <mach/board.h>
40#include <asm/arch/gpio.h> 40#include <mach/gpio.h>
41 41
42#include "generic.h" 42#include "generic.h"
43 43
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index daf93a588068..cb20e70b3b06 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -28,7 +28,7 @@
28#include <linux/spi/at73c213.h> 28#include <linux/spi/at73c213.h>
29#include <linux/clk.h> 29#include <linux/clk.h>
30 30
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/setup.h> 32#include <asm/setup.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
@@ -37,8 +37,8 @@
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
39 39
40#include <asm/arch/board.h> 40#include <mach/board.h>
41#include <asm/arch/gpio.h> 41#include <mach/gpio.h>
42 42
43#include "generic.h" 43#include "generic.h"
44 44
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 12bf527f93be..1a9963b811c7 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -35,7 +35,7 @@
35 35
36#include <video/atmel_lcdc.h> 36#include <video/atmel_lcdc.h>
37 37
38#include <asm/hardware.h> 38#include <mach/hardware.h>
39#include <asm/setup.h> 39#include <asm/setup.h>
40#include <asm/mach-types.h> 40#include <asm/mach-types.h>
41#include <asm/irq.h> 41#include <asm/irq.h>
@@ -44,9 +44,9 @@
44#include <asm/mach/map.h> 44#include <asm/mach/map.h>
45#include <asm/mach/irq.h> 45#include <asm/mach/irq.h>
46 46
47#include <asm/arch/board.h> 47#include <mach/board.h>
48#include <asm/arch/gpio.h> 48#include <mach/gpio.h>
49#include <asm/arch/at91sam9_smc.h> 49#include <mach/at91sam9_smc.h>
50 50
51#include "generic.h" 51#include "generic.h"
52 52
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 63121197f8c9..b1d11960a735 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -32,7 +32,7 @@
32 32
33#include <video/atmel_lcdc.h> 33#include <video/atmel_lcdc.h>
34 34
35#include <asm/hardware.h> 35#include <mach/hardware.h>
36#include <asm/setup.h> 36#include <asm/setup.h>
37#include <asm/mach-types.h> 37#include <asm/mach-types.h>
38#include <asm/irq.h> 38#include <asm/irq.h>
@@ -41,9 +41,9 @@
41#include <asm/mach/map.h> 41#include <asm/mach/map.h>
42#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
43 43
44#include <asm/arch/board.h> 44#include <mach/board.h>
45#include <asm/arch/gpio.h> 45#include <mach/gpio.h>
46#include <asm/arch/at91sam9_smc.h> 46#include <mach/at91sam9_smc.h>
47 47
48#include "generic.h" 48#include "generic.h"
49 49
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index e0c07952cc34..d4eba5c0ce02 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -26,7 +26,7 @@
26#include <linux/spi/at73c213.h> 26#include <linux/spi/at73c213.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/setup.h> 30#include <asm/setup.h>
31#include <asm/mach-types.h> 31#include <asm/mach-types.h>
32#include <asm/irq.h> 32#include <asm/irq.h>
@@ -35,8 +35,8 @@
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
37 37
38#include <asm/arch/board.h> 38#include <mach/board.h>
39#include <asm/arch/gpio.h> 39#include <mach/gpio.h>
40 40
41#include "generic.h" 41#include "generic.h"
42 42
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 66e77bb2e079..c6dce49c388c 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -18,7 +18,7 @@
18 18
19#include <video/atmel_lcdc.h> 19#include <video/atmel_lcdc.h>
20 20
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/setup.h> 22#include <asm/setup.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/irq.h> 24#include <asm/irq.h>
@@ -27,9 +27,9 @@
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <asm/arch/board.h> 30#include <mach/board.h>
31#include <asm/arch/gpio.h> 31#include <mach/gpio.h>
32#include <asm/arch/at91sam9_smc.h> 32#include <mach/at91sam9_smc.h>
33 33
34#include "generic.h" 34#include "generic.h"
35 35
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
index 2f4ecac150d9..f9d0b65da40b 100644
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -30,7 +30,7 @@
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/clk.h> 31#include <linux/clk.h>
32 32
33#include <asm/hardware.h> 33#include <mach/hardware.h>
34#include <asm/setup.h> 34#include <asm/setup.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
@@ -39,9 +39,9 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
41 41
42#include <asm/arch/board.h> 42#include <mach/board.h>
43#include <asm/arch/gpio.h> 43#include <mach/gpio.h>
44#include <asm/arch/at91_shdwc.h> 44#include <mach/at91_shdwc.h>
45 45
46#include "generic.h" 46#include "generic.h"
47 47
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
index 0e9649d3eda1..673e5c27214d 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -29,7 +29,7 @@
29#include <linux/gpio_keys.h> 29#include <linux/gpio_keys.h>
30#include <linux/input.h> 30#include <linux/input.h>
31 31
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/setup.h> 33#include <asm/setup.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
@@ -38,9 +38,9 @@
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
39#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
40 40
41#include <asm/arch/board.h> 41#include <mach/board.h>
42#include <asm/arch/gpio.h> 42#include <mach/gpio.h>
43#include <asm/arch/at91_shdwc.h> 43#include <mach/at91_shdwc.h>
44 44
45#include "generic.h" 45#include "generic.h"
46 46
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index bbbfd06f5e0c..36b380aad006 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -33,7 +33,7 @@
33#include <linux/gpio_keys.h> 33#include <linux/gpio_keys.h>
34#include <linux/input.h> 34#include <linux/input.h>
35 35
36#include <asm/hardware.h> 36#include <mach/hardware.h>
37#include <asm/setup.h> 37#include <asm/setup.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/irq.h> 39#include <asm/irq.h>
@@ -42,9 +42,9 @@
42#include <asm/mach/map.h> 42#include <asm/mach/map.h>
43#include <asm/mach/irq.h> 43#include <asm/mach/irq.h>
44 44
45#include <asm/arch/board.h> 45#include <mach/board.h>
46#include <asm/arch/gpio.h> 46#include <mach/gpio.h>
47#include <asm/arch/at91rm9200_mc.h> 47#include <mach/at91rm9200_mc.h>
48 48
49#include "generic.h" 49#include "generic.h"
50 50
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 464bdbbf74df..f5c2847161f5 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -24,11 +24,10 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25 25
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/mach-types.h>
28 27
29#include <asm/hardware.h> 28#include <mach/hardware.h>
30#include <asm/arch/at91_pmc.h> 29#include <mach/at91_pmc.h>
31#include <asm/arch/cpu.h> 30#include <mach/cpu.h>
32 31
33#include "clock.h" 32#include "clock.h"
34 33
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index ee4964abcaf5..8392d5b517f1 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -20,9 +20,9 @@
20#include <linux/module.h> 20#include <linux/module.h>
21 21
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/arch/at91_pio.h> 24#include <mach/at91_pio.h>
25#include <asm/arch/gpio.h> 25#include <mach/gpio.h>
26 26
27#include "generic.h" 27#include "generic.h"
28 28
diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
new file mode 100644
index 000000000000..8e7ed5c90817
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_adc.h
@@ -0,0 +1,61 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_adc.h
3 *
4 * Copyright (C) SAN People
5 *
6 * Analog-to-Digital Converter (ADC) registers.
7 * Based on AT91SAM9260 datasheet revision D.
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#ifndef AT91_ADC_H
16#define AT91_ADC_H
17
18#define AT91_ADC_CR 0x00 /* Control Register */
19#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
20#define AT91_ADC_START (1 << 1) /* Start Conversion */
21
22#define AT91_ADC_MR 0x04 /* Mode Register */
23#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
24#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
25#define AT91_ADC_TRGSEL_TC0 (0 << 1)
26#define AT91_ADC_TRGSEL_TC1 (1 << 1)
27#define AT91_ADC_TRGSEL_TC2 (2 << 1)
28#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
29#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
30#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
31#define AT91_ADC_PRESCAL (0x3f << 8) /* Prescalar Rate Selection */
32#define AT91_ADC_PRESCAL_(x) ((x) << 8)
33#define AT91_ADC_STARTUP (0x1f << 16) /* Startup Up Time */
34#define AT91_ADC_STARTUP_(x) ((x) << 16)
35#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
36#define AT91_ADC_SHTIM_(x) ((x) << 24)
37
38#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
39#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
40#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
41#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
42
43#define AT91_ADC_SR 0x1C /* Status Register */
44#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
45#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
46#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
47#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
48#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
49#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
50
51#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
52#define AT91_ADC_LDATA (0x3ff)
53
54#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
55#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
56#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
57
58#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
59#define AT91_ADC_DATA (0x3ff)
60
61#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_aic.h b/arch/arm/mach-at91/include/mach/at91_aic.h
new file mode 100644
index 000000000000..03566799d3be
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_aic.h
@@ -0,0 +1,53 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_aic.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Advanced Interrupt Controller (AIC) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_AIC_H
17#define AT91_AIC_H
18
19#define AT91_AIC_SMR(n) (AT91_AIC + ((n) * 4)) /* Source Mode Registers 0-31 */
20#define AT91_AIC_PRIOR (7 << 0) /* Priority Level */
21#define AT91_AIC_SRCTYPE (3 << 5) /* Interrupt Source Type */
22#define AT91_AIC_SRCTYPE_LOW (0 << 5)
23#define AT91_AIC_SRCTYPE_FALLING (1 << 5)
24#define AT91_AIC_SRCTYPE_HIGH (2 << 5)
25#define AT91_AIC_SRCTYPE_RISING (3 << 5)
26
27#define AT91_AIC_SVR(n) (AT91_AIC + 0x80 + ((n) * 4)) /* Source Vector Registers 0-31 */
28#define AT91_AIC_IVR (AT91_AIC + 0x100) /* Interrupt Vector Register */
29#define AT91_AIC_FVR (AT91_AIC + 0x104) /* Fast Interrupt Vector Register */
30#define AT91_AIC_ISR (AT91_AIC + 0x108) /* Interrupt Status Register */
31#define AT91_AIC_IRQID (0x1f << 0) /* Current Interrupt Identifier */
32
33#define AT91_AIC_IPR (AT91_AIC + 0x10c) /* Interrupt Pending Register */
34#define AT91_AIC_IMR (AT91_AIC + 0x110) /* Interrupt Mask Register */
35#define AT91_AIC_CISR (AT91_AIC + 0x114) /* Core Interrupt Status Register */
36#define AT91_AIC_NFIQ (1 << 0) /* nFIQ Status */
37#define AT91_AIC_NIRQ (1 << 1) /* nIRQ Status */
38
39#define AT91_AIC_IECR (AT91_AIC + 0x120) /* Interrupt Enable Command Register */
40#define AT91_AIC_IDCR (AT91_AIC + 0x124) /* Interrupt Disable Command Register */
41#define AT91_AIC_ICCR (AT91_AIC + 0x128) /* Interrupt Clear Command Register */
42#define AT91_AIC_ISCR (AT91_AIC + 0x12c) /* Interrupt Set Command Register */
43#define AT91_AIC_EOICR (AT91_AIC + 0x130) /* End of Interrupt Command Register */
44#define AT91_AIC_SPU (AT91_AIC + 0x134) /* Spurious Interrupt Vector Register */
45#define AT91_AIC_DCR (AT91_AIC + 0x138) /* Debug Control Register */
46#define AT91_AIC_DCR_PROT (1 << 0) /* Protection Mode */
47#define AT91_AIC_DCR_GMSK (1 << 1) /* General Mask */
48
49#define AT91_AIC_FFER (AT91_AIC + 0x140) /* Fast Forcing Enable Register [SAM9 only] */
50#define AT91_AIC_FFDR (AT91_AIC + 0x144) /* Fast Forcing Disable Register [SAM9 only] */
51#define AT91_AIC_FFSR (AT91_AIC + 0x148) /* Fast Forcing Status Register [SAM9 only] */
52
53#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_dbgu.h b/arch/arm/mach-at91/include/mach/at91_dbgu.h
new file mode 100644
index 000000000000..6dcaa7716871
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_dbgu.h
@@ -0,0 +1,66 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_dbgu.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Debug Unit (DBGU) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_DBGU_H
17#define AT91_DBGU_H
18
19#ifdef AT91_DBGU
20#define AT91_DBGU_CR (AT91_DBGU + 0x00) /* Control Register */
21#define AT91_DBGU_MR (AT91_DBGU + 0x04) /* Mode Register */
22#define AT91_DBGU_IER (AT91_DBGU + 0x08) /* Interrupt Enable Register */
23#define AT91_DBGU_TXRDY (1 << 1) /* Transmitter Ready */
24#define AT91_DBGU_TXEMPTY (1 << 9) /* Transmitter Empty */
25#define AT91_DBGU_IDR (AT91_DBGU + 0x0c) /* Interrupt Disable Register */
26#define AT91_DBGU_IMR (AT91_DBGU + 0x10) /* Interrupt Mask Register */
27#define AT91_DBGU_SR (AT91_DBGU + 0x14) /* Status Register */
28#define AT91_DBGU_RHR (AT91_DBGU + 0x18) /* Receiver Holding Register */
29#define AT91_DBGU_THR (AT91_DBGU + 0x1c) /* Transmitter Holding Register */
30#define AT91_DBGU_BRGR (AT91_DBGU + 0x20) /* Baud Rate Generator Register */
31
32#define AT91_DBGU_CIDR (AT91_DBGU + 0x40) /* Chip ID Register */
33#define AT91_DBGU_EXID (AT91_DBGU + 0x44) /* Chip ID Extension Register */
34#define AT91_DBGU_FNR (AT91_DBGU + 0x48) /* Force NTRST Register [SAM9 only] */
35#define AT91_DBGU_FNTRST (1 << 0) /* Force NTRST */
36
37#endif /* AT91_DBGU */
38
39/*
40 * Some AT91 parts that don't have full DEBUG units still support the ID
41 * and extensions register.
42 */
43#define AT91_CIDR_VERSION (0x1f << 0) /* Version of the Device */
44#define AT91_CIDR_EPROC (7 << 5) /* Embedded Processor */
45#define AT91_CIDR_NVPSIZ (0xf << 8) /* Nonvolatile Program Memory Size */
46#define AT91_CIDR_NVPSIZ2 (0xf << 12) /* Second Nonvolatile Program Memory Size */
47#define AT91_CIDR_SRAMSIZ (0xf << 16) /* Internal SRAM Size */
48#define AT91_CIDR_SRAMSIZ_1K (1 << 16)
49#define AT91_CIDR_SRAMSIZ_2K (2 << 16)
50#define AT91_CIDR_SRAMSIZ_112K (4 << 16)
51#define AT91_CIDR_SRAMSIZ_4K (5 << 16)
52#define AT91_CIDR_SRAMSIZ_80K (6 << 16)
53#define AT91_CIDR_SRAMSIZ_160K (7 << 16)
54#define AT91_CIDR_SRAMSIZ_8K (8 << 16)
55#define AT91_CIDR_SRAMSIZ_16K (9 << 16)
56#define AT91_CIDR_SRAMSIZ_32K (10 << 16)
57#define AT91_CIDR_SRAMSIZ_64K (11 << 16)
58#define AT91_CIDR_SRAMSIZ_128K (12 << 16)
59#define AT91_CIDR_SRAMSIZ_256K (13 << 16)
60#define AT91_CIDR_SRAMSIZ_96K (14 << 16)
61#define AT91_CIDR_SRAMSIZ_512K (15 << 16)
62#define AT91_CIDR_ARCH (0xff << 20) /* Architecture Identifier */
63#define AT91_CIDR_NVPTYP (7 << 28) /* Nonvolatile Program Memory Type */
64#define AT91_CIDR_EXT (1 << 31) /* Extension Flag */
65
66#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_mci.h b/arch/arm/mach-at91/include/mach/at91_mci.h
new file mode 100644
index 000000000000..550d503a1bca
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_mci.h
@@ -0,0 +1,113 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_mci.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * MultiMedia Card Interface (MCI) registers.
8 * Based on AT91RM9200 datasheet revision F.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_MCI_H
17#define AT91_MCI_H
18
19#define AT91_MCI_CR 0x00 /* Control Register */
20#define AT91_MCI_MCIEN (1 << 0) /* Multi-Media Interface Enable */
21#define AT91_MCI_MCIDIS (1 << 1) /* Multi-Media Interface Disable */
22#define AT91_MCI_PWSEN (1 << 2) /* Power Save Mode Enable */
23#define AT91_MCI_PWSDIS (1 << 3) /* Power Save Mode Disable */
24#define AT91_MCI_SWRST (1 << 7) /* Software Reset */
25
26#define AT91_MCI_MR 0x04 /* Mode Register */
27#define AT91_MCI_CLKDIV (0xff << 0) /* Clock Divider */
28#define AT91_MCI_PWSDIV (7 << 8) /* Power Saving Divider */
29#define AT91_MCI_RDPROOF (1 << 11) /* Read Proof Enable [SAM926[03] only] */
30#define AT91_MCI_WRPROOF (1 << 12) /* Write Proof Enable [SAM926[03] only] */
31#define AT91_MCI_PDCFBYTE (1 << 13) /* PDC Force Byte Transfer [SAM926[03] only] */
32#define AT91_MCI_PDCPADV (1 << 14) /* PDC Padding Value */
33#define AT91_MCI_PDCMODE (1 << 15) /* PDC-orientated Mode */
34#define AT91_MCI_BLKLEN (0xfff << 18) /* Data Block Length */
35
36#define AT91_MCI_DTOR 0x08 /* Data Timeout Register */
37#define AT91_MCI_DTOCYC (0xf << 0) /* Data Timeout Cycle Number */
38#define AT91_MCI_DTOMUL (7 << 4) /* Data Timeout Multiplier */
39#define AT91_MCI_DTOMUL_1 (0 << 4)
40#define AT91_MCI_DTOMUL_16 (1 << 4)
41#define AT91_MCI_DTOMUL_128 (2 << 4)
42#define AT91_MCI_DTOMUL_256 (3 << 4)
43#define AT91_MCI_DTOMUL_1K (4 << 4)
44#define AT91_MCI_DTOMUL_4K (5 << 4)
45#define AT91_MCI_DTOMUL_64K (6 << 4)
46#define AT91_MCI_DTOMUL_1M (7 << 4)
47
48#define AT91_MCI_SDCR 0x0c /* SD Card Register */
49#define AT91_MCI_SDCSEL (3 << 0) /* SD Card Selector */
50#define AT91_MCI_SDCBUS (1 << 7) /* 1-bit or 4-bit bus */
51
52#define AT91_MCI_ARGR 0x10 /* Argument Register */
53
54#define AT91_MCI_CMDR 0x14 /* Command Register */
55#define AT91_MCI_CMDNB (0x3f << 0) /* Command Number */
56#define AT91_MCI_RSPTYP (3 << 6) /* Response Type */
57#define AT91_MCI_RSPTYP_NONE (0 << 6)
58#define AT91_MCI_RSPTYP_48 (1 << 6)
59#define AT91_MCI_RSPTYP_136 (2 << 6)
60#define AT91_MCI_SPCMD (7 << 8) /* Special Command */
61#define AT91_MCI_SPCMD_NONE (0 << 8)
62#define AT91_MCI_SPCMD_INIT (1 << 8)
63#define AT91_MCI_SPCMD_SYNC (2 << 8)
64#define AT91_MCI_SPCMD_ICMD (4 << 8)
65#define AT91_MCI_SPCMD_IRESP (5 << 8)
66#define AT91_MCI_OPDCMD (1 << 11) /* Open Drain Command */
67#define AT91_MCI_MAXLAT (1 << 12) /* Max Latency for Command to Response */
68#define AT91_MCI_TRCMD (3 << 16) /* Transfer Command */
69#define AT91_MCI_TRCMD_NONE (0 << 16)
70#define AT91_MCI_TRCMD_START (1 << 16)
71#define AT91_MCI_TRCMD_STOP (2 << 16)
72#define AT91_MCI_TRDIR (1 << 18) /* Transfer Direction */
73#define AT91_MCI_TRTYP (3 << 19) /* Transfer Type */
74#define AT91_MCI_TRTYP_BLOCK (0 << 19)
75#define AT91_MCI_TRTYP_MULTIPLE (1 << 19)
76#define AT91_MCI_TRTYP_STREAM (2 << 19)
77
78#define AT91_MCI_BLKR 0x18 /* Block Register */
79#define AT91_MCI_BLKR_BCNT(n) ((0xffff & (n)) << 0) /* Block count */
80#define AT91_MCI_BLKR_BLKLEN(n) ((0xffff & (n)) << 16) /* Block lenght */
81
82#define AT91_MCI_RSPR(n) (0x20 + ((n) * 4)) /* Response Registers 0-3 */
83#define AT91_MCR_RDR 0x30 /* Receive Data Register */
84#define AT91_MCR_TDR 0x34 /* Transmit Data Register */
85
86#define AT91_MCI_SR 0x40 /* Status Register */
87#define AT91_MCI_CMDRDY (1 << 0) /* Command Ready */
88#define AT91_MCI_RXRDY (1 << 1) /* Receiver Ready */
89#define AT91_MCI_TXRDY (1 << 2) /* Transmit Ready */
90#define AT91_MCI_BLKE (1 << 3) /* Data Block Ended */
91#define AT91_MCI_DTIP (1 << 4) /* Data Transfer in Progress */
92#define AT91_MCI_NOTBUSY (1 << 5) /* Data Not Busy */
93#define AT91_MCI_ENDRX (1 << 6) /* End of RX Buffer */
94#define AT91_MCI_ENDTX (1 << 7) /* End fo TX Buffer */
95#define AT91_MCI_SDIOIRQA (1 << 8) /* SDIO Interrupt for Slot A */
96#define AT91_MCI_SDIOIRQB (1 << 9) /* SDIO Interrupt for Slot B */
97#define AT91_MCI_RXBUFF (1 << 14) /* RX Buffer Full */
98#define AT91_MCI_TXBUFE (1 << 15) /* TX Buffer Empty */
99#define AT91_MCI_RINDE (1 << 16) /* Response Index Error */
100#define AT91_MCI_RDIRE (1 << 17) /* Response Direction Error */
101#define AT91_MCI_RCRCE (1 << 18) /* Response CRC Error */
102#define AT91_MCI_RENDE (1 << 19) /* Response End Bit Error */
103#define AT91_MCI_RTOE (1 << 20) /* Reponse Time-out Error */
104#define AT91_MCI_DCRCE (1 << 21) /* Data CRC Error */
105#define AT91_MCI_DTOE (1 << 22) /* Data Time-out Error */
106#define AT91_MCI_OVRE (1 << 30) /* Overrun */
107#define AT91_MCI_UNRE (1 << 31) /* Underrun */
108
109#define AT91_MCI_IER 0x44 /* Interrupt Enable Register */
110#define AT91_MCI_IDR 0x48 /* Interrupt Disable Register */
111#define AT91_MCI_IMR 0x4c /* Interrupt Mask Register */
112
113#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_pio.h b/arch/arm/mach-at91/include/mach/at91_pio.h
new file mode 100644
index 000000000000..c6a31bf8a5c6
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_pio.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_pio.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Parallel I/O Controller (PIO) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_PIO_H
17#define AT91_PIO_H
18
19#define PIO_PER 0x00 /* Enable Register */
20#define PIO_PDR 0x04 /* Disable Register */
21#define PIO_PSR 0x08 /* Status Register */
22#define PIO_OER 0x10 /* Output Enable Register */
23#define PIO_ODR 0x14 /* Output Disable Register */
24#define PIO_OSR 0x18 /* Output Status Register */
25#define PIO_IFER 0x20 /* Glitch Input Filter Enable */
26#define PIO_IFDR 0x24 /* Glitch Input Filter Disable */
27#define PIO_IFSR 0x28 /* Glitch Input Filter Status */
28#define PIO_SODR 0x30 /* Set Output Data Register */
29#define PIO_CODR 0x34 /* Clear Output Data Register */
30#define PIO_ODSR 0x38 /* Output Data Status Register */
31#define PIO_PDSR 0x3c /* Pin Data Status Register */
32#define PIO_IER 0x40 /* Interrupt Enable Register */
33#define PIO_IDR 0x44 /* Interrupt Disable Register */
34#define PIO_IMR 0x48 /* Interrupt Mask Register */
35#define PIO_ISR 0x4c /* Interrupt Status Register */
36#define PIO_MDER 0x50 /* Multi-driver Enable Register */
37#define PIO_MDDR 0x54 /* Multi-driver Disable Register */
38#define PIO_MDSR 0x58 /* Multi-driver Status Register */
39#define PIO_PUDR 0x60 /* Pull-up Disable Register */
40#define PIO_PUER 0x64 /* Pull-up Enable Register */
41#define PIO_PUSR 0x68 /* Pull-up Status Register */
42#define PIO_ASR 0x70 /* Peripheral A Select Register */
43#define PIO_BSR 0x74 /* Peripheral B Select Register */
44#define PIO_ABSR 0x78 /* AB Status Register */
45#define PIO_OWER 0xa0 /* Output Write Enable Register */
46#define PIO_OWDR 0xa4 /* Output Write Disable Register */
47#define PIO_OWSR 0xa8 /* Output Write Status Register */
48
49#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_pit.h b/arch/arm/mach-at91/include/mach/at91_pit.h
new file mode 100644
index 000000000000..0448ac36eadb
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_pit.h
@@ -0,0 +1,29 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_pit.h
3 *
4 * Periodic Interval Timer (PIT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_PIT_H
14#define AT91_PIT_H
15
16#define AT91_PIT_MR (AT91_PIT + 0x00) /* Mode Register */
17#define AT91_PIT_PITIEN (1 << 25) /* Timer Interrupt Enable */
18#define AT91_PIT_PITEN (1 << 24) /* Timer Enabled */
19#define AT91_PIT_PIV (0xfffff) /* Periodic Interval Value */
20
21#define AT91_PIT_SR (AT91_PIT + 0x04) /* Status Register */
22#define AT91_PIT_PITS (1 << 0) /* Timer Status */
23
24#define AT91_PIT_PIVR (AT91_PIT + 0x08) /* Periodic Interval Value Register */
25#define AT91_PIT_PIIR (AT91_PIT + 0x0c) /* Periodic Interval Image Register */
26#define AT91_PIT_PICNT (0xfff << 20) /* Interval Counter */
27#define AT91_PIT_CPIV (0xfffff) /* Inverval Value */
28
29#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
new file mode 100644
index 000000000000..2e3f2894b704
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -0,0 +1,111 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_pmc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Power Management Controller (PMC) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_PMC_H
17#define AT91_PMC_H
18
19#define AT91_PMC_SCER (AT91_PMC + 0x00) /* System Clock Enable Register */
20#define AT91_PMC_SCDR (AT91_PMC + 0x04) /* System Clock Disable Register */
21
22#define AT91_PMC_SCSR (AT91_PMC + 0x08) /* System Clock Status Register */
23#define AT91_PMC_PCK (1 << 0) /* Processor Clock */
24#define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */
25#define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */
26#define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */
27#define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */
28#define AT91CAP9_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91CAP9 only] */
29#define AT91SAM926x_PMC_UDP (1 << 7) /* USB Devcice Port Clock [AT91SAM926x only] */
30#define AT91_PMC_PCK0 (1 << 8) /* Programmable Clock 0 */
31#define AT91_PMC_PCK1 (1 << 9) /* Programmable Clock 1 */
32#define AT91_PMC_PCK2 (1 << 10) /* Programmable Clock 2 */
33#define AT91_PMC_PCK3 (1 << 11) /* Programmable Clock 3 */
34#define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */
35#define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */
36
37#define AT91_PMC_PCER (AT91_PMC + 0x10) /* Peripheral Clock Enable Register */
38#define AT91_PMC_PCDR (AT91_PMC + 0x14) /* Peripheral Clock Disable Register */
39#define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */
40
41#define AT91_CKGR_UCKR (AT91_PMC + 0x1C) /* UTMI Clock Register [SAM9RL, CAP9] */
42#define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */
43#define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */
44#define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */
45#define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI PLL Start-up Time */
46
47#define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register [not on SAM9RL] */
48#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
49#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass [SAM9x, CAP9] */
50#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */
51
52#define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */
53#define AT91_PMC_MAINF (0xffff << 0) /* Main Clock Frequency */
54#define AT91_PMC_MAINRDY (1 << 16) /* Main Clock Ready */
55
56#define AT91_CKGR_PLLAR (AT91_PMC + 0x28) /* PLL A Register */
57#define AT91_CKGR_PLLBR (AT91_PMC + 0x2c) /* PLL B Register */
58#define AT91_PMC_DIV (0xff << 0) /* Divider */
59#define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */
60#define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */
61#define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */
62#define AT91_PMC_USBDIV (3 << 28) /* USB Divisor (PLLB only) */
63#define AT91_PMC_USBDIV_1 (0 << 28)
64#define AT91_PMC_USBDIV_2 (1 << 28)
65#define AT91_PMC_USBDIV_4 (2 << 28)
66#define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */
67
68#define AT91_PMC_MCKR (AT91_PMC + 0x30) /* Master Clock Register */
69#define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */
70#define AT91_PMC_CSS_SLOW (0 << 0)
71#define AT91_PMC_CSS_MAIN (1 << 0)
72#define AT91_PMC_CSS_PLLA (2 << 0)
73#define AT91_PMC_CSS_PLLB (3 << 0)
74#define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */
75#define AT91_PMC_PRES_1 (0 << 2)
76#define AT91_PMC_PRES_2 (1 << 2)
77#define AT91_PMC_PRES_4 (2 << 2)
78#define AT91_PMC_PRES_8 (3 << 2)
79#define AT91_PMC_PRES_16 (4 << 2)
80#define AT91_PMC_PRES_32 (5 << 2)
81#define AT91_PMC_PRES_64 (6 << 2)
82#define AT91_PMC_MDIV (3 << 8) /* Master Clock Division */
83#define AT91RM9200_PMC_MDIV_1 (0 << 8) /* [AT91RM9200 only] */
84#define AT91RM9200_PMC_MDIV_2 (1 << 8)
85#define AT91RM9200_PMC_MDIV_3 (2 << 8)
86#define AT91RM9200_PMC_MDIV_4 (3 << 8)
87#define AT91SAM9_PMC_MDIV_1 (0 << 8) /* [SAM9,CAP9 only] */
88#define AT91SAM9_PMC_MDIV_2 (1 << 8)
89#define AT91SAM9_PMC_MDIV_4 (2 << 8)
90#define AT91SAM9_PMC_MDIV_6 (3 << 8)
91#define AT91_PMC_PDIV (1 << 12) /* Processor Clock Division [some SAM9 only] */
92#define AT91_PMC_PDIV_1 (0 << 12)
93#define AT91_PMC_PDIV_2 (1 << 12)
94
95#define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-3 Registers */
96
97#define AT91_PMC_IER (AT91_PMC + 0x60) /* Interrupt Enable Register */
98#define AT91_PMC_IDR (AT91_PMC + 0x64) /* Interrupt Disable Register */
99#define AT91_PMC_SR (AT91_PMC + 0x68) /* Status Register */
100#define AT91_PMC_MOSCS (1 << 0) /* MOSCS Flag */
101#define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */
102#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
103#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
104#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [AT91CAP9 only] */
105#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
106#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
107#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
108#define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */
109#define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */
110
111#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_rstc.h b/arch/arm/mach-at91/include/mach/at91_rstc.h
new file mode 100644
index 000000000000..7cd1b39aaa43
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_rstc.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_rstc.h
3 *
4 * Reset Controller (RSTC) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_RSTC_H
14#define AT91_RSTC_H
15
16#define AT91_RSTC_CR (AT91_RSTC + 0x00) /* Reset Controller Control Register */
17#define AT91_RSTC_PROCRST (1 << 0) /* Processor Reset */
18#define AT91_RSTC_PERRST (1 << 2) /* Peripheral Reset */
19#define AT91_RSTC_EXTRST (1 << 3) /* External Reset */
20#define AT91_RSTC_KEY (0xa5 << 24) /* KEY Password */
21
22#define AT91_RSTC_SR (AT91_RSTC + 0x04) /* Reset Controller Status Register */
23#define AT91_RSTC_URSTS (1 << 0) /* User Reset Status */
24#define AT91_RSTC_RSTTYP (7 << 8) /* Reset Type */
25#define AT91_RSTC_RSTTYP_GENERAL (0 << 8)
26#define AT91_RSTC_RSTTYP_WAKEUP (1 << 8)
27#define AT91_RSTC_RSTTYP_WATCHDOG (2 << 8)
28#define AT91_RSTC_RSTTYP_SOFTWARE (3 << 8)
29#define AT91_RSTC_RSTTYP_USER (4 << 8)
30#define AT91_RSTC_NRSTL (1 << 16) /* NRST Pin Level */
31#define AT91_RSTC_SRCMP (1 << 17) /* Software Reset Command in Progress */
32
33#define AT91_RSTC_MR (AT91_RSTC + 0x08) /* Reset Controller Mode Register */
34#define AT91_RSTC_URSTEN (1 << 0) /* User Reset Enable */
35#define AT91_RSTC_URSTIEN (1 << 4) /* User Reset Interrupt Enable */
36#define AT91_RSTC_ERSTL (0xf << 8) /* External Reset Length */
37
38#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_rtc.h b/arch/arm/mach-at91/include/mach/at91_rtc.h
new file mode 100644
index 000000000000..e56f4701a3e5
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_rtc.h
@@ -0,0 +1,75 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_rtc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Real Time Clock (RTC) - System peripheral registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_RTC_H
17#define AT91_RTC_H
18
19#define AT91_RTC_CR (AT91_RTC + 0x00) /* Control Register */
20#define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */
21#define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */
22#define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */
23#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8)
24#define AT91_RTC_TIMEVSEL_HOUR (1 << 8)
25#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8)
26#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8)
27#define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */
28#define AT91_RTC_CALEVSEL_WEEK (0 << 16)
29#define AT91_RTC_CALEVSEL_MONTH (1 << 16)
30#define AT91_RTC_CALEVSEL_YEAR (2 << 16)
31
32#define AT91_RTC_MR (AT91_RTC + 0x04) /* Mode Register */
33#define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */
34
35#define AT91_RTC_TIMR (AT91_RTC + 0x08) /* Time Register */
36#define AT91_RTC_SEC (0x7f << 0) /* Current Second */
37#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */
38#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */
39#define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */
40
41#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */
42#define AT91_RTC_CENT (0x7f << 0) /* Current Century */
43#define AT91_RTC_YEAR (0xff << 8) /* Current Year */
44#define AT91_RTC_MONTH (0x1f << 16) /* Current Month */
45#define AT91_RTC_DAY (7 << 21) /* Current Day */
46#define AT91_RTC_DATE (0x3f << 24) /* Current Date */
47
48#define AT91_RTC_TIMALR (AT91_RTC + 0x10) /* Time Alarm Register */
49#define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */
50#define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */
51#define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */
52
53#define AT91_RTC_CALALR (AT91_RTC + 0x14) /* Calendar Alarm Register */
54#define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */
55#define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */
56
57#define AT91_RTC_SR (AT91_RTC + 0x18) /* Status Register */
58#define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */
59#define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */
60#define AT91_RTC_SECEV (1 << 2) /* Second Event */
61#define AT91_RTC_TIMEV (1 << 3) /* Time Event */
62#define AT91_RTC_CALEV (1 << 4) /* Calendar Event */
63
64#define AT91_RTC_SCCR (AT91_RTC + 0x1c) /* Status Clear Command Register */
65#define AT91_RTC_IER (AT91_RTC + 0x20) /* Interrupt Enable Register */
66#define AT91_RTC_IDR (AT91_RTC + 0x24) /* Interrupt Disable Register */
67#define AT91_RTC_IMR (AT91_RTC + 0x28) /* Interrupt Mask Register */
68
69#define AT91_RTC_VER (AT91_RTC + 0x2c) /* Valid Entry Register */
70#define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
71#define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */
72#define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */
73#define AT91_RTC_NVCALALR (1 << 3) /* Non valid Calendar Alarm */
74
75#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_rtt.h b/arch/arm/mach-at91/include/mach/at91_rtt.h
new file mode 100644
index 000000000000..71782e5d2159
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_rtt.h
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_rtt.h
3 *
4 * Real-time Timer (RTT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_RTT_H
14#define AT91_RTT_H
15
16#define AT91_RTT_MR 0x00 /* Real-time Mode Register */
17#define AT91_RTT_RTPRES (0xffff << 0) /* Real-time Timer Prescaler Value */
18#define AT91_RTT_ALMIEN (1 << 16) /* Alarm Interrupt Enable */
19#define AT91_RTT_RTTINCIEN (1 << 17) /* Real Time Timer Increment Interrupt Enable */
20#define AT91_RTT_RTTRST (1 << 18) /* Real Time Timer Restart */
21
22#define AT91_RTT_AR 0x04 /* Real-time Alarm Register */
23#define AT91_RTT_ALMV (0xffffffff) /* Alarm Value */
24
25#define AT91_RTT_VR 0x08 /* Real-time Value Register */
26#define AT91_RTT_CRTV (0xffffffff) /* Current Real-time Value */
27
28#define AT91_RTT_SR 0x0c /* Real-time Status Register */
29#define AT91_RTT_ALMS (1 << 0) /* Real-time Alarm Status */
30#define AT91_RTT_RTTINC (1 << 1) /* Real-time Timer Increment */
31
32#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_shdwc.h b/arch/arm/mach-at91/include/mach/at91_shdwc.h
new file mode 100644
index 000000000000..60be5ae624f1
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_shdwc.h
@@ -0,0 +1,35 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_shdwc.h
3 *
4 * Shutdown Controller (SHDWC) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_SHDWC_H
14#define AT91_SHDWC_H
15
16#define AT91_SHDW_CR (AT91_SHDWC + 0x00) /* Shut Down Control Register */
17#define AT91_SHDW_SHDW (1 << 0) /* Shut Down command */
18#define AT91_SHDW_KEY (0xa5 << 24) /* KEY Password */
19
20#define AT91_SHDW_MR (AT91_SHDWC + 0x04) /* Shut Down Mode Register */
21#define AT91_SHDW_WKMODE0 (3 << 0) /* Wake-up 0 Mode Selection */
22#define AT91_SHDW_WKMODE0_NONE 0
23#define AT91_SHDW_WKMODE0_HIGH 1
24#define AT91_SHDW_WKMODE0_LOW 2
25#define AT91_SHDW_WKMODE0_ANYLEVEL 3
26#define AT91_SHDW_CPTWK0 (0xf << 4) /* Counter On Wake Up 0 */
27#define AT91_SHDW_CPTWK0_(x) ((x) << 4)
28#define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */
29
30#define AT91_SHDW_SR (AT91_SHDWC + 0x08) /* Shut Down Status Register */
31#define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */
32#define AT91_SHDW_RTTWK (1 << 16) /* Real-time Timer Wake-up */
33#define AT91_SHDW_RTCWK (1 << 17) /* Real-time Clock Wake-up [SAM9RL] */
34
35#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_spi.h b/arch/arm/mach-at91/include/mach/at91_spi.h
new file mode 100644
index 000000000000..2f6ba0c5636e
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_spi.h
@@ -0,0 +1,81 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_spi.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Serial Peripheral Interface (SPI) registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_SPI_H
17#define AT91_SPI_H
18
19#define AT91_SPI_CR 0x00 /* Control Register */
20#define AT91_SPI_SPIEN (1 << 0) /* SPI Enable */
21#define AT91_SPI_SPIDIS (1 << 1) /* SPI Disable */
22#define AT91_SPI_SWRST (1 << 7) /* SPI Software Reset */
23#define AT91_SPI_LASTXFER (1 << 24) /* Last Transfer [SAM9261 only] */
24
25#define AT91_SPI_MR 0x04 /* Mode Register */
26#define AT91_SPI_MSTR (1 << 0) /* Master/Slave Mode */
27#define AT91_SPI_PS (1 << 1) /* Peripheral Select */
28#define AT91_SPI_PS_FIXED (0 << 1)
29#define AT91_SPI_PS_VARIABLE (1 << 1)
30#define AT91_SPI_PCSDEC (1 << 2) /* Chip Select Decode */
31#define AT91_SPI_DIV32 (1 << 3) /* Clock Selection [AT91RM9200 only] */
32#define AT91_SPI_MODFDIS (1 << 4) /* Mode Fault Detection */
33#define AT91_SPI_LLB (1 << 7) /* Local Loopback Enable */
34#define AT91_SPI_PCS (0xf << 16) /* Peripheral Chip Select */
35#define AT91_SPI_DLYBCS (0xff << 24) /* Delay Between Chip Selects */
36
37#define AT91_SPI_RDR 0x08 /* Receive Data Register */
38#define AT91_SPI_RD (0xffff << 0) /* Receive Data */
39#define AT91_SPI_PCS (0xf << 16) /* Peripheral Chip Select */
40
41#define AT91_SPI_TDR 0x0c /* Transmit Data Register */
42#define AT91_SPI_TD (0xffff << 0) /* Transmit Data */
43#define AT91_SPI_PCS (0xf << 16) /* Peripheral Chip Select */
44#define AT91_SPI_LASTXFER (1 << 24) /* Last Transfer [SAM9261 only] */
45
46#define AT91_SPI_SR 0x10 /* Status Register */
47#define AT91_SPI_RDRF (1 << 0) /* Receive Data Register Full */
48#define AT91_SPI_TDRE (1 << 1) /* Transmit Data Register Full */
49#define AT91_SPI_MODF (1 << 2) /* Mode Fault Error */
50#define AT91_SPI_OVRES (1 << 3) /* Overrun Error Status */
51#define AT91_SPI_ENDRX (1 << 4) /* End of RX buffer */
52#define AT91_SPI_ENDTX (1 << 5) /* End of TX buffer */
53#define AT91_SPI_RXBUFF (1 << 6) /* RX Buffer Full */
54#define AT91_SPI_TXBUFE (1 << 7) /* TX Buffer Empty */
55#define AT91_SPI_NSSR (1 << 8) /* NSS Rising [SAM9261 only] */
56#define AT91_SPI_TXEMPTY (1 << 9) /* Transmission Register Empty [SAM9261 only] */
57#define AT91_SPI_SPIENS (1 << 16) /* SPI Enable Status */
58
59#define AT91_SPI_IER 0x14 /* Interrupt Enable Register */
60#define AT91_SPI_IDR 0x18 /* Interrupt Disable Register */
61#define AT91_SPI_IMR 0x1c /* Interrupt Mask Register */
62
63#define AT91_SPI_CSR(n) (0x30 + ((n) * 4)) /* Chip Select Registers 0-3 */
64#define AT91_SPI_CPOL (1 << 0) /* Clock Polarity */
65#define AT91_SPI_NCPHA (1 << 1) /* Clock Phase */
66#define AT91_SPI_CSAAT (1 << 3) /* Chip Select Active After Transfer [SAM9261 only] */
67#define AT91_SPI_BITS (0xf << 4) /* Bits Per Transfer */
68#define AT91_SPI_BITS_8 (0 << 4)
69#define AT91_SPI_BITS_9 (1 << 4)
70#define AT91_SPI_BITS_10 (2 << 4)
71#define AT91_SPI_BITS_11 (3 << 4)
72#define AT91_SPI_BITS_12 (4 << 4)
73#define AT91_SPI_BITS_13 (5 << 4)
74#define AT91_SPI_BITS_14 (6 << 4)
75#define AT91_SPI_BITS_15 (7 << 4)
76#define AT91_SPI_BITS_16 (8 << 4)
77#define AT91_SPI_SCBR (0xff << 8) /* Serial Clock Baud Rate */
78#define AT91_SPI_DLYBS (0xff << 16) /* Delay before SPCK */
79#define AT91_SPI_DLYBCT (0xff << 24) /* Delay between Consecutive Transfers */
80
81#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_ssc.h b/arch/arm/mach-at91/include/mach/at91_ssc.h
new file mode 100644
index 000000000000..a81114c11c74
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_ssc.h
@@ -0,0 +1,106 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_ssc.h
3 *
4 * Copyright (C) SAN People
5 *
6 * Serial Synchronous Controller (SSC) registers.
7 * Based on AT91RM9200 datasheet revision E.
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#ifndef AT91_SSC_H
16#define AT91_SSC_H
17
18#define AT91_SSC_CR 0x00 /* Control Register */
19#define AT91_SSC_RXEN (1 << 0) /* Receive Enable */
20#define AT91_SSC_RXDIS (1 << 1) /* Receive Disable */
21#define AT91_SSC_TXEN (1 << 8) /* Transmit Enable */
22#define AT91_SSC_TXDIS (1 << 9) /* Transmit Disable */
23#define AT91_SSC_SWRST (1 << 15) /* Software Reset */
24
25#define AT91_SSC_CMR 0x04 /* Clock Mode Register */
26#define AT91_SSC_CMR_DIV (0xfff << 0) /* Clock Divider */
27
28#define AT91_SSC_RCMR 0x10 /* Receive Clock Mode Register */
29#define AT91_SSC_CKS (3 << 0) /* Clock Selection */
30#define AT91_SSC_CKS_DIV (0 << 0)
31#define AT91_SSC_CKS_CLOCK (1 << 0)
32#define AT91_SSC_CKS_PIN (2 << 0)
33#define AT91_SSC_CKO (7 << 2) /* Clock Output Mode Selection */
34#define AT91_SSC_CKO_NONE (0 << 2)
35#define AT91_SSC_CKO_CONTINUOUS (1 << 2)
36#define AT91_SSC_CKI (1 << 5) /* Clock Inversion */
37#define AT91_SSC_CKI_FALLING (0 << 5)
38#define AT91_SSC_CK_RISING (1 << 5)
39#define AT91_SSC_CKG (1 << 6) /* Receive Clock Gating Selection [AT91SAM9261 only] */
40#define AT91_SSC_CKG_NONE (0 << 6)
41#define AT91_SSC_CKG_RFLOW (1 << 6)
42#define AT91_SSC_CKG_RFHIGH (2 << 6)
43#define AT91_SSC_START (0xf << 8) /* Start Selection */
44#define AT91_SSC_START_CONTINUOUS (0 << 8)
45#define AT91_SSC_START_TX_RX (1 << 8)
46#define AT91_SSC_START_LOW_RF (2 << 8)
47#define AT91_SSC_START_HIGH_RF (3 << 8)
48#define AT91_SSC_START_FALLING_RF (4 << 8)
49#define AT91_SSC_START_RISING_RF (5 << 8)
50#define AT91_SSC_START_LEVEL_RF (6 << 8)
51#define AT91_SSC_START_EDGE_RF (7 << 8)
52#define AT91_SSC_STOP (1 << 12) /* Receive Stop Selection [AT91SAM9261 only] */
53#define AT91_SSC_STTDLY (0xff << 16) /* Start Delay */
54#define AT91_SSC_PERIOD (0xff << 24) /* Period Divider Selection */
55
56#define AT91_SSC_RFMR 0x14 /* Receive Frame Mode Register */
57#define AT91_SSC_DATALEN (0x1f << 0) /* Data Length */
58#define AT91_SSC_LOOP (1 << 5) /* Loop Mode */
59#define AT91_SSC_MSBF (1 << 7) /* Most Significant Bit First */
60#define AT91_SSC_DATNB (0xf << 8) /* Data Number per Frame */
61#define AT91_SSC_FSLEN (0xf << 16) /* Frame Sync Length */
62#define AT91_SSC_FSOS (7 << 20) /* Frame Sync Output Selection */
63#define AT91_SSC_FSOS_NONE (0 << 20)
64#define AT91_SSC_FSOS_NEGATIVE (1 << 20)
65#define AT91_SSC_FSOS_POSITIVE (2 << 20)
66#define AT91_SSC_FSOS_LOW (3 << 20)
67#define AT91_SSC_FSOS_HIGH (4 << 20)
68#define AT91_SSC_FSOS_TOGGLE (5 << 20)
69#define AT91_SSC_FSEDGE (1 << 24) /* Frame Sync Edge Detection */
70#define AT91_SSC_FSEDGE_POSITIVE (0 << 24)
71#define AT91_SSC_FSEDGE_NEGATIVE (1 << 24)
72
73#define AT91_SSC_TCMR 0x18 /* Transmit Clock Mode Register */
74#define AT91_SSC_TFMR 0x1c /* Transmit Fram Mode Register */
75#define AT91_SSC_DATDEF (1 << 5) /* Data Default Value */
76#define AT91_SSC_FSDEN (1 << 23) /* Frame Sync Data Enable */
77
78#define AT91_SSC_RHR 0x20 /* Receive Holding Register */
79#define AT91_SSC_THR 0x24 /* Transmit Holding Register */
80#define AT91_SSC_RSHR 0x30 /* Receive Sync Holding Register */
81#define AT91_SSC_TSHR 0x34 /* Transmit Sync Holding Register */
82
83#define AT91_SSC_RC0R 0x38 /* Receive Compare 0 Register [AT91SAM9261 only] */
84#define AT91_SSC_RC1R 0x3c /* Receive Compare 1 Register [AT91SAM9261 only] */
85
86#define AT91_SSC_SR 0x40 /* Status Register */
87#define AT91_SSC_TXRDY (1 << 0) /* Transmit Ready */
88#define AT91_SSC_TXEMPTY (1 << 1) /* Transmit Empty */
89#define AT91_SSC_ENDTX (1 << 2) /* End of Transmission */
90#define AT91_SSC_TXBUFE (1 << 3) /* Transmit Buffer Empty */
91#define AT91_SSC_RXRDY (1 << 4) /* Receive Ready */
92#define AT91_SSC_OVRUN (1 << 5) /* Receive Overrun */
93#define AT91_SSC_ENDRX (1 << 6) /* End of Reception */
94#define AT91_SSC_RXBUFF (1 << 7) /* Receive Buffer Full */
95#define AT91_SSC_CP0 (1 << 8) /* Compare 0 [AT91SAM9261 only] */
96#define AT91_SSC_CP1 (1 << 9) /* Compare 1 [AT91SAM9261 only] */
97#define AT91_SSC_TXSYN (1 << 10) /* Transmit Sync */
98#define AT91_SSC_RXSYN (1 << 11) /* Receive Sync */
99#define AT91_SSC_TXENA (1 << 16) /* Transmit Enable */
100#define AT91_SSC_RXENA (1 << 17) /* Receive Enable */
101
102#define AT91_SSC_IER 0x44 /* Interrupt Enable Register */
103#define AT91_SSC_IDR 0x48 /* Interrupt Disable Register */
104#define AT91_SSC_IMR 0x4c /* Interrupt Mask Register */
105
106#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_st.h b/arch/arm/mach-at91/include/mach/at91_st.h
new file mode 100644
index 000000000000..8847173e4101
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_st.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_st.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * System Timer (ST) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_ST_H
17#define AT91_ST_H
18
19#define AT91_ST_CR (AT91_ST + 0x00) /* Control Register */
20#define AT91_ST_WDRST (1 << 0) /* Watchdog Timer Restart */
21
22#define AT91_ST_PIMR (AT91_ST + 0x04) /* Period Interval Mode Register */
23#define AT91_ST_PIV (0xffff << 0) /* Period Interval Value */
24
25#define AT91_ST_WDMR (AT91_ST + 0x08) /* Watchdog Mode Register */
26#define AT91_ST_WDV (0xffff << 0) /* Watchdog Counter Value */
27#define AT91_ST_RSTEN (1 << 16) /* Reset Enable */
28#define AT91_ST_EXTEN (1 << 17) /* External Signal Assertion Enable */
29
30#define AT91_ST_RTMR (AT91_ST + 0x0c) /* Real-time Mode Register */
31#define AT91_ST_RTPRES (0xffff << 0) /* Real-time Prescalar Value */
32
33#define AT91_ST_SR (AT91_ST + 0x10) /* Status Register */
34#define AT91_ST_PITS (1 << 0) /* Period Interval Timer Status */
35#define AT91_ST_WDOVF (1 << 1) /* Watchdog Overflow */
36#define AT91_ST_RTTINC (1 << 2) /* Real-time Timer Increment */
37#define AT91_ST_ALMS (1 << 3) /* Alarm Status */
38
39#define AT91_ST_IER (AT91_ST + 0x14) /* Interrupt Enable Register */
40#define AT91_ST_IDR (AT91_ST + 0x18) /* Interrupt Disable Register */
41#define AT91_ST_IMR (AT91_ST + 0x1c) /* Interrupt Mask Register */
42
43#define AT91_ST_RTAR (AT91_ST + 0x20) /* Real-time Alarm Register */
44#define AT91_ST_ALMV (0xfffff << 0) /* Alarm Value */
45
46#define AT91_ST_CRTR (AT91_ST + 0x24) /* Current Real-time Register */
47#define AT91_ST_CRTV (0xfffff << 0) /* Current Real-Time Value */
48
49#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_tc.h b/arch/arm/mach-at91/include/mach/at91_tc.h
new file mode 100644
index 000000000000..46a317fd7164
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_tc.h
@@ -0,0 +1,146 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_tc.h
3 *
4 * Copyright (C) SAN People
5 *
6 * Timer/Counter Unit (TC) registers.
7 * Based on AT91RM9200 datasheet revision E.
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#ifndef AT91_TC_H
16#define AT91_TC_H
17
18#define AT91_TC_BCR 0xc0 /* TC Block Control Register */
19#define AT91_TC_SYNC (1 << 0) /* Synchro Command */
20
21#define AT91_TC_BMR 0xc4 /* TC Block Mode Register */
22#define AT91_TC_TC0XC0S (3 << 0) /* External Clock Signal 0 Selection */
23#define AT91_TC_TC0XC0S_TCLK0 (0 << 0)
24#define AT91_TC_TC0XC0S_NONE (1 << 0)
25#define AT91_TC_TC0XC0S_TIOA1 (2 << 0)
26#define AT91_TC_TC0XC0S_TIOA2 (3 << 0)
27#define AT91_TC_TC1XC1S (3 << 2) /* External Clock Signal 1 Selection */
28#define AT91_TC_TC1XC1S_TCLK1 (0 << 2)
29#define AT91_TC_TC1XC1S_NONE (1 << 2)
30#define AT91_TC_TC1XC1S_TIOA0 (2 << 2)
31#define AT91_TC_TC1XC1S_TIOA2 (3 << 2)
32#define AT91_TC_TC2XC2S (3 << 4) /* External Clock Signal 2 Selection */
33#define AT91_TC_TC2XC2S_TCLK2 (0 << 4)
34#define AT91_TC_TC2XC2S_NONE (1 << 4)
35#define AT91_TC_TC2XC2S_TIOA0 (2 << 4)
36#define AT91_TC_TC2XC2S_TIOA1 (3 << 4)
37
38
39#define AT91_TC_CCR 0x00 /* Channel Control Register */
40#define AT91_TC_CLKEN (1 << 0) /* Counter Clock Enable Command */
41#define AT91_TC_CLKDIS (1 << 1) /* Counter CLock Disable Command */
42#define AT91_TC_SWTRG (1 << 2) /* Software Trigger Command */
43
44#define AT91_TC_CMR 0x04 /* Channel Mode Register */
45#define AT91_TC_TCCLKS (7 << 0) /* Capture/Waveform Mode: Clock Selection */
46#define AT91_TC_TIMER_CLOCK1 (0 << 0)
47#define AT91_TC_TIMER_CLOCK2 (1 << 0)
48#define AT91_TC_TIMER_CLOCK3 (2 << 0)
49#define AT91_TC_TIMER_CLOCK4 (3 << 0)
50#define AT91_TC_TIMER_CLOCK5 (4 << 0)
51#define AT91_TC_XC0 (5 << 0)
52#define AT91_TC_XC1 (6 << 0)
53#define AT91_TC_XC2 (7 << 0)
54#define AT91_TC_CLKI (1 << 3) /* Capture/Waveform Mode: Clock Invert */
55#define AT91_TC_BURST (3 << 4) /* Capture/Waveform Mode: Burst Signal Selection */
56#define AT91_TC_LDBSTOP (1 << 6) /* Capture Mode: Counter Clock Stopped with TB Loading */
57#define AT91_TC_LDBDIS (1 << 7) /* Capture Mode: Counter Clock Disable with RB Loading */
58#define AT91_TC_ETRGEDG (3 << 8) /* Capture Mode: External Trigger Edge Selection */
59#define AT91_TC_ABETRG (1 << 10) /* Capture Mode: TIOA or TIOB External Trigger Selection */
60#define AT91_TC_CPCTRG (1 << 14) /* Capture Mode: RC Compare Trigger Enable */
61#define AT91_TC_WAVE (1 << 15) /* Capture/Waveform mode */
62#define AT91_TC_LDRA (3 << 16) /* Capture Mode: RA Loading Selection */
63#define AT91_TC_LDRB (3 << 18) /* Capture Mode: RB Loading Selection */
64
65#define AT91_TC_CPCSTOP (1 << 6) /* Waveform Mode: Counter Clock Stopped with RC Compare */
66#define AT91_TC_CPCDIS (1 << 7) /* Waveform Mode: Counter Clock Disable with RC Compare */
67#define AT91_TC_EEVTEDG (3 << 8) /* Waveform Mode: External Event Edge Selection */
68#define AT91_TC_EEVTEDG_NONE (0 << 8)
69#define AT91_TC_EEVTEDG_RISING (1 << 8)
70#define AT91_TC_EEVTEDG_FALLING (2 << 8)
71#define AT91_TC_EEVTEDG_BOTH (3 << 8)
72#define AT91_TC_EEVT (3 << 10) /* Waveform Mode: External Event Selection */
73#define AT91_TC_EEVT_TIOB (0 << 10)
74#define AT91_TC_EEVT_XC0 (1 << 10)
75#define AT91_TC_EEVT_XC1 (2 << 10)
76#define AT91_TC_EEVT_XC2 (3 << 10)
77#define AT91_TC_ENETRG (1 << 12) /* Waveform Mode: External Event Trigger Enable */
78#define AT91_TC_WAVESEL (3 << 13) /* Waveform Mode: Waveform Selection */
79#define AT91_TC_WAVESEL_UP (0 << 13)
80#define AT91_TC_WAVESEL_UP_AUTO (2 << 13)
81#define AT91_TC_WAVESEL_UPDOWN (1 << 13)
82#define AT91_TC_WAVESEL_UPDOWN_AUTO (3 << 13)
83#define AT91_TC_ACPA (3 << 16) /* Waveform Mode: RA Compare Effect on TIOA */
84#define AT91_TC_ACPA_NONE (0 << 16)
85#define AT91_TC_ACPA_SET (1 << 16)
86#define AT91_TC_ACPA_CLEAR (2 << 16)
87#define AT91_TC_ACPA_TOGGLE (3 << 16)
88#define AT91_TC_ACPC (3 << 18) /* Waveform Mode: RC Compre Effect on TIOA */
89#define AT91_TC_ACPC_NONE (0 << 18)
90#define AT91_TC_ACPC_SET (1 << 18)
91#define AT91_TC_ACPC_CLEAR (2 << 18)
92#define AT91_TC_ACPC_TOGGLE (3 << 18)
93#define AT91_TC_AEEVT (3 << 20) /* Waveform Mode: External Event Effect on TIOA */
94#define AT91_TC_AEEVT_NONE (0 << 20)
95#define AT91_TC_AEEVT_SET (1 << 20)
96#define AT91_TC_AEEVT_CLEAR (2 << 20)
97#define AT91_TC_AEEVT_TOGGLE (3 << 20)
98#define AT91_TC_ASWTRG (3 << 22) /* Waveform Mode: Software Trigger Effect on TIOA */
99#define AT91_TC_ASWTRG_NONE (0 << 22)
100#define AT91_TC_ASWTRG_SET (1 << 22)
101#define AT91_TC_ASWTRG_CLEAR (2 << 22)
102#define AT91_TC_ASWTRG_TOGGLE (3 << 22)
103#define AT91_TC_BCPB (3 << 24) /* Waveform Mode: RB Compare Effect on TIOB */
104#define AT91_TC_BCPB_NONE (0 << 24)
105#define AT91_TC_BCPB_SET (1 << 24)
106#define AT91_TC_BCPB_CLEAR (2 << 24)
107#define AT91_TC_BCPB_TOGGLE (3 << 24)
108#define AT91_TC_BCPC (3 << 26) /* Waveform Mode: RC Compare Effect on TIOB */
109#define AT91_TC_BCPC_NONE (0 << 26)
110#define AT91_TC_BCPC_SET (1 << 26)
111#define AT91_TC_BCPC_CLEAR (2 << 26)
112#define AT91_TC_BCPC_TOGGLE (3 << 26)
113#define AT91_TC_BEEVT (3 << 28) /* Waveform Mode: External Event Effect on TIOB */
114#define AT91_TC_BEEVT_NONE (0 << 28)
115#define AT91_TC_BEEVT_SET (1 << 28)
116#define AT91_TC_BEEVT_CLEAR (2 << 28)
117#define AT91_TC_BEEVT_TOGGLE (3 << 28)
118#define AT91_TC_BSWTRG (3 << 30) /* Waveform Mode: Software Trigger Effect on TIOB */
119#define AT91_TC_BSWTRG_NONE (0 << 30)
120#define AT91_TC_BSWTRG_SET (1 << 30)
121#define AT91_TC_BSWTRG_CLEAR (2 << 30)
122#define AT91_TC_BSWTRG_TOGGLE (3 << 30)
123
124#define AT91_TC_CV 0x10 /* Counter Value */
125#define AT91_TC_RA 0x14 /* Register A */
126#define AT91_TC_RB 0x18 /* Register B */
127#define AT91_TC_RC 0x1c /* Register C */
128
129#define AT91_TC_SR 0x20 /* Status Register */
130#define AT91_TC_COVFS (1 << 0) /* Counter Overflow Status */
131#define AT91_TC_LOVRS (1 << 1) /* Load Overrun Status */
132#define AT91_TC_CPAS (1 << 2) /* RA Compare Status */
133#define AT91_TC_CPBS (1 << 3) /* RB Compare Status */
134#define AT91_TC_CPCS (1 << 4) /* RC Compare Status */
135#define AT91_TC_LDRAS (1 << 5) /* RA Loading Status */
136#define AT91_TC_LDRBS (1 << 6) /* RB Loading Status */
137#define AT91_TC_ETRGS (1 << 7) /* External Trigger Status */
138#define AT91_TC_CLKSTA (1 << 16) /* Clock Enabling Status */
139#define AT91_TC_MTIOA (1 << 17) /* TIOA Mirror */
140#define AT91_TC_MTIOB (1 << 18) /* TIOB Mirror */
141
142#define AT91_TC_IER 0x24 /* Interrupt Enable Register */
143#define AT91_TC_IDR 0x28 /* Interrupt Disable Register */
144#define AT91_TC_IMR 0x2c /* Interrupt Mask Register */
145
146#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_twi.h b/arch/arm/mach-at91/include/mach/at91_twi.h
new file mode 100644
index 000000000000..bb2880f6ba37
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_twi.h
@@ -0,0 +1,68 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_twi.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Two-wire Interface (TWI) registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_TWI_H
17#define AT91_TWI_H
18
19#define AT91_TWI_CR 0x00 /* Control Register */
20#define AT91_TWI_START (1 << 0) /* Send a Start Condition */
21#define AT91_TWI_STOP (1 << 1) /* Send a Stop Condition */
22#define AT91_TWI_MSEN (1 << 2) /* Master Transfer Enable */
23#define AT91_TWI_MSDIS (1 << 3) /* Master Transfer Disable */
24#define AT91_TWI_SVEN (1 << 4) /* Slave Transfer Enable [SAM9260 only] */
25#define AT91_TWI_SVDIS (1 << 5) /* Slave Transfer Disable [SAM9260 only] */
26#define AT91_TWI_SWRST (1 << 7) /* Software Reset */
27
28#define AT91_TWI_MMR 0x04 /* Master Mode Register */
29#define AT91_TWI_IADRSZ (3 << 8) /* Internal Device Address Size */
30#define AT91_TWI_IADRSZ_NO (0 << 8)
31#define AT91_TWI_IADRSZ_1 (1 << 8)
32#define AT91_TWI_IADRSZ_2 (2 << 8)
33#define AT91_TWI_IADRSZ_3 (3 << 8)
34#define AT91_TWI_MREAD (1 << 12) /* Master Read Direction */
35#define AT91_TWI_DADR (0x7f << 16) /* Device Address */
36
37#define AT91_TWI_SMR 0x08 /* Slave Mode Register [SAM9260 only] */
38#define AT91_TWI_SADR (0x7f << 16) /* Slave Address */
39
40#define AT91_TWI_IADR 0x0c /* Internal Address Register */
41
42#define AT91_TWI_CWGR 0x10 /* Clock Waveform Generator Register */
43#define AT91_TWI_CLDIV (0xff << 0) /* Clock Low Divisor */
44#define AT91_TWI_CHDIV (0xff << 8) /* Clock High Divisor */
45#define AT91_TWI_CKDIV (7 << 16) /* Clock Divider */
46
47#define AT91_TWI_SR 0x20 /* Status Register */
48#define AT91_TWI_TXCOMP (1 << 0) /* Transmission Complete */
49#define AT91_TWI_RXRDY (1 << 1) /* Receive Holding Register Ready */
50#define AT91_TWI_TXRDY (1 << 2) /* Transmit Holding Register Ready */
51#define AT91_TWI_SVREAD (1 << 3) /* Slave Read [SAM9260 only] */
52#define AT91_TWI_SVACC (1 << 4) /* Slave Access [SAM9260 only] */
53#define AT91_TWI_GACC (1 << 5) /* General Call Access [SAM9260 only] */
54#define AT91_TWI_OVRE (1 << 6) /* Overrun Error [AT91RM9200 only] */
55#define AT91_TWI_UNRE (1 << 7) /* Underrun Error [AT91RM9200 only] */
56#define AT91_TWI_NACK (1 << 8) /* Not Acknowledged */
57#define AT91_TWI_ARBLST (1 << 9) /* Arbitration Lost [SAM9260 only] */
58#define AT91_TWI_SCLWS (1 << 10) /* Clock Wait State [SAM9260 only] */
59#define AT91_TWI_EOSACC (1 << 11) /* End of Slave Address [SAM9260 only] */
60
61#define AT91_TWI_IER 0x24 /* Interrupt Enable Register */
62#define AT91_TWI_IDR 0x28 /* Interrupt Disable Register */
63#define AT91_TWI_IMR 0x2c /* Interrupt Mask Register */
64#define AT91_TWI_RHR 0x30 /* Receive Holding Register */
65#define AT91_TWI_THR 0x34 /* Transmit Holding Register */
66
67#endif
68
diff --git a/arch/arm/mach-at91/include/mach/at91_wdt.h b/arch/arm/mach-at91/include/mach/at91_wdt.h
new file mode 100644
index 000000000000..973b4526a98e
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91_wdt.h
@@ -0,0 +1,34 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_wdt.h
3 *
4 * Watchdog Timer (WDT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_WDT_H
14#define AT91_WDT_H
15
16#define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */
17#define AT91_WDT_WDRSTT (1 << 0) /* Restart */
18#define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */
19
20#define AT91_WDT_MR (AT91_WDT + 0x04) /* Watchdog Mode Register */
21#define AT91_WDT_WDV (0xfff << 0) /* Counter Value */
22#define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */
23#define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */
24#define AT91_WDT_WDRPROC (1 << 14) /* Timer Restart */
25#define AT91_WDT_WDDIS (1 << 15) /* Watchdog Disable */
26#define AT91_WDT_WDD (0xfff << 16) /* Delta Value */
27#define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */
28#define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */
29
30#define AT91_WDT_SR (AT91_WDT + 0x08) /* Watchdog Status Register */
31#define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */
32#define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */
33
34#endif
diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h
new file mode 100644
index 000000000000..4a4b64135a92
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91cap9.h
@@ -0,0 +1,126 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91cap9.h
3 *
4 * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com>
5 * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com>
6 * Copyright (C) 2007 Atmel Corporation.
7 *
8 * Common definitions.
9 * Based on AT91CAP9 datasheet revision B (Preliminary).
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
17#ifndef AT91CAP9_H
18#define AT91CAP9_H
19
20/*
21 * Peripheral identifiers/interrupts.
22 */
23#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
24#define AT91_ID_SYS 1 /* System Peripherals */
25#define AT91CAP9_ID_PIOABCD 2 /* Parallel IO Controller A, B, C and D */
26#define AT91CAP9_ID_MPB0 3 /* MP Block Peripheral 0 */
27#define AT91CAP9_ID_MPB1 4 /* MP Block Peripheral 1 */
28#define AT91CAP9_ID_MPB2 5 /* MP Block Peripheral 2 */
29#define AT91CAP9_ID_MPB3 6 /* MP Block Peripheral 3 */
30#define AT91CAP9_ID_MPB4 7 /* MP Block Peripheral 4 */
31#define AT91CAP9_ID_US0 8 /* USART 0 */
32#define AT91CAP9_ID_US1 9 /* USART 1 */
33#define AT91CAP9_ID_US2 10 /* USART 2 */
34#define AT91CAP9_ID_MCI0 11 /* Multimedia Card Interface 0 */
35#define AT91CAP9_ID_MCI1 12 /* Multimedia Card Interface 1 */
36#define AT91CAP9_ID_CAN 13 /* CAN */
37#define AT91CAP9_ID_TWI 14 /* Two-Wire Interface */
38#define AT91CAP9_ID_SPI0 15 /* Serial Peripheral Interface 0 */
39#define AT91CAP9_ID_SPI1 16 /* Serial Peripheral Interface 0 */
40#define AT91CAP9_ID_SSC0 17 /* Serial Synchronous Controller 0 */
41#define AT91CAP9_ID_SSC1 18 /* Serial Synchronous Controller 1 */
42#define AT91CAP9_ID_AC97C 19 /* AC97 Controller */
43#define AT91CAP9_ID_TCB 20 /* Timer Counter 0, 1 and 2 */
44#define AT91CAP9_ID_PWMC 21 /* Pulse Width Modulation Controller */
45#define AT91CAP9_ID_EMAC 22 /* Ethernet */
46#define AT91CAP9_ID_AESTDES 23 /* Advanced Encryption Standard, Triple DES */
47#define AT91CAP9_ID_ADC 24 /* Analog-to-Digital Converter */
48#define AT91CAP9_ID_ISI 25 /* Image Sensor Interface */
49#define AT91CAP9_ID_LCDC 26 /* LCD Controller */
50#define AT91CAP9_ID_DMA 27 /* DMA Controller */
51#define AT91CAP9_ID_UDPHS 28 /* USB High Speed Device Port */
52#define AT91CAP9_ID_UHP 29 /* USB Host Port */
53#define AT91CAP9_ID_IRQ0 30 /* Advanced Interrupt Controller (IRQ0) */
54#define AT91CAP9_ID_IRQ1 31 /* Advanced Interrupt Controller (IRQ1) */
55
56/*
57 * User Peripheral physical base addresses.
58 */
59#define AT91CAP9_BASE_UDPHS 0xfff78000
60#define AT91CAP9_BASE_TCB0 0xfff7c000
61#define AT91CAP9_BASE_TC0 0xfff7c000
62#define AT91CAP9_BASE_TC1 0xfff7c040
63#define AT91CAP9_BASE_TC2 0xfff7c080
64#define AT91CAP9_BASE_MCI0 0xfff80000
65#define AT91CAP9_BASE_MCI1 0xfff84000
66#define AT91CAP9_BASE_TWI 0xfff88000
67#define AT91CAP9_BASE_US0 0xfff8c000
68#define AT91CAP9_BASE_US1 0xfff90000
69#define AT91CAP9_BASE_US2 0xfff94000
70#define AT91CAP9_BASE_SSC0 0xfff98000
71#define AT91CAP9_BASE_SSC1 0xfff9c000
72#define AT91CAP9_BASE_AC97C 0xfffa0000
73#define AT91CAP9_BASE_SPI0 0xfffa4000
74#define AT91CAP9_BASE_SPI1 0xfffa8000
75#define AT91CAP9_BASE_CAN 0xfffac000
76#define AT91CAP9_BASE_PWMC 0xfffb8000
77#define AT91CAP9_BASE_EMAC 0xfffbc000
78#define AT91CAP9_BASE_ADC 0xfffc0000
79#define AT91CAP9_BASE_ISI 0xfffc4000
80#define AT91_BASE_SYS 0xffffe200
81
82/*
83 * System Peripherals (offset from AT91_BASE_SYS)
84 */
85#define AT91_ECC (0xffffe200 - AT91_BASE_SYS)
86#define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS)
87#define AT91_DDRSDRC (0xffffe600 - AT91_BASE_SYS)
88#define AT91_SMC (0xffffe800 - AT91_BASE_SYS)
89#define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS)
90#define AT91_CCFG (0xffffeb10 - AT91_BASE_SYS)
91#define AT91_DMA (0xffffec00 - AT91_BASE_SYS)
92#define AT91_DBGU (0xffffee00 - AT91_BASE_SYS)
93#define AT91_AIC (0xfffff000 - AT91_BASE_SYS)
94#define AT91_PIOA (0xfffff200 - AT91_BASE_SYS)
95#define AT91_PIOB (0xfffff400 - AT91_BASE_SYS)
96#define AT91_PIOC (0xfffff600 - AT91_BASE_SYS)
97#define AT91_PIOD (0xfffff800 - AT91_BASE_SYS)
98#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
99#define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS)
100#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS)
101#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS)
102#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS)
103#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
104#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS)
105
106#define AT91_USART0 AT91CAP9_BASE_US0
107#define AT91_USART1 AT91CAP9_BASE_US1
108#define AT91_USART2 AT91CAP9_BASE_US2
109
110
111/*
112 * Internal Memory.
113 */
114#define AT91CAP9_SRAM_BASE 0x00100000 /* Internal SRAM base address */
115#define AT91CAP9_SRAM_SIZE (32 * SZ_1K) /* Internal SRAM size (32Kb) */
116
117#define AT91CAP9_ROM_BASE 0x00400000 /* Internal ROM base address */
118#define AT91CAP9_ROM_SIZE (32 * SZ_1K) /* Internal ROM size (32Kb) */
119
120#define AT91CAP9_LCDC_BASE 0x00500000 /* LCD Controller */
121#define AT91CAP9_UDPHS_FIFO 0x00600000 /* USB High Speed Device Port */
122#define AT91CAP9_UHP_BASE 0x00700000 /* USB Host controller */
123
124#define CONFIG_DRAM_BASE AT91_CHIPSELECT_6
125
126#endif
diff --git a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
new file mode 100644
index 000000000000..bca878f3bd87
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
@@ -0,0 +1,100 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
3 *
4 * DDR/SDR Controller (DDRSDRC) - System peripherals registers.
5 * Based on AT91CAP9 datasheet revision B.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91CAP9_DDRSDR_H
14#define AT91CAP9_DDRSDR_H
15
16#define AT91_DDRSDRC_MR (AT91_DDRSDRC + 0x00) /* Mode Register */
17#define AT91_DDRSDRC_MODE (0xf << 0) /* Command Mode */
18#define AT91_DDRSDRC_MODE_NORMAL 0
19#define AT91_DDRSDRC_MODE_NOP 1
20#define AT91_DDRSDRC_MODE_PRECHARGE 2
21#define AT91_DDRSDRC_MODE_LMR 3
22#define AT91_DDRSDRC_MODE_REFRESH 4
23#define AT91_DDRSDRC_MODE_EXT_LMR 5
24#define AT91_DDRSDRC_MODE_DEEP 6
25
26#define AT91_DDRSDRC_RTR (AT91_DDRSDRC + 0x04) /* Refresh Timer Register */
27#define AT91_DDRSDRC_COUNT (0xfff << 0) /* Refresh Timer Counter */
28
29#define AT91_DDRSDRC_CR (AT91_DDRSDRC + 0x08) /* Configuration Register */
30#define AT91_DDRSDRC_NC (3 << 0) /* Number of Column Bits */
31#define AT91_DDRSDRC_NC_SDR8 (0 << 0)
32#define AT91_DDRSDRC_NC_SDR9 (1 << 0)
33#define AT91_DDRSDRC_NC_SDR10 (2 << 0)
34#define AT91_DDRSDRC_NC_SDR11 (3 << 0)
35#define AT91_DDRSDRC_NC_DDR9 (0 << 0)
36#define AT91_DDRSDRC_NC_DDR10 (1 << 0)
37#define AT91_DDRSDRC_NC_DDR11 (2 << 0)
38#define AT91_DDRSDRC_NC_DDR12 (3 << 0)
39#define AT91_DDRSDRC_NR (3 << 2) /* Number of Row Bits */
40#define AT91_DDRSDRC_NR_11 (0 << 2)
41#define AT91_DDRSDRC_NR_12 (1 << 2)
42#define AT91_DDRSDRC_NR_13 (2 << 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_DLL (1 << 7) /* Reset DLL */
48#define AT91_DDRSDRC_DICDS (1 << 8) /* Output impedance control */
49
50#define AT91_DDRSDRC_T0PR (AT91_DDRSDRC + 0x0C) /* Timing 0 Register */
51#define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */
52#define AT91_DDRSDRC_TRCD (0xf << 4) /* Row to Column delay */
53#define AT91_DDRSDRC_TWR (0xf << 8) /* Write recovery delay */
54#define AT91_DDRSDRC_TRC (0xf << 12) /* Row cycle delay */
55#define AT91_DDRSDRC_TRP (0xf << 16) /* Row precharge delay */
56#define AT91_DDRSDRC_TRRD (0xf << 20) /* Active BankA to BankB */
57#define AT91_DDRSDRC_TWTR (1 << 24) /* Internal Write to Read delay */
58#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */
59
60#define AT91_DDRSDRC_T1PR (AT91_DDRSDRC + 0x10) /* Timing 1 Register */
61#define AT91_DDRSDRC_TRFC (0x1f << 0) /* Row Cycle Delay */
62#define AT91_DDRSDRC_TXSNR (0xff << 8) /* Exit self-refresh to non-read */
63#define AT91_DDRSDRC_TXSRD (0xff << 16) /* Exit self-refresh to read */
64#define AT91_DDRSDRC_TXP (0xf << 24) /* Exit power-down delay */
65
66#define AT91_DDRSDRC_LPR (AT91_DDRSDRC + 0x18) /* Low Power Register */
67#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */
68#define AT91_DDRSDRC_LPCB_DISABLE 0
69#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1
70#define AT91_DDRSDRC_LPCB_POWER_DOWN 2
71#define AT91_DDRSDRC_LPCB_DEEP_POWER_DOWN 3
72#define AT91_DDRSDRC_CLKFR (1 << 2) /* Clock Frozen */
73#define AT91_DDRSDRC_PASR (7 << 4) /* Partial Array Self Refresh */
74#define AT91_DDRSDRC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
75#define AT91_DDRSDRC_DS (3 << 10) /* Drive Strength */
76#define AT91_DDRSDRC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
77#define AT91_DDRSDRC_TIMEOUT_0_CLK_CYCLES (0 << 12)
78#define AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES (1 << 12)
79#define AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES (2 << 12)
80
81#define AT91_DDRSDRC_MDR (AT91_DDRSDRC + 0x1C) /* Memory Device Register */
82#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */
83#define AT91_DDRSDRC_MD_SDR 0
84#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1
85#define AT91_DDRSDRC_MD_DDR 2
86#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3
87
88#define AT91_DDRSDRC_DLLR (AT91_DDRSDRC + 0x20) /* DLL Information Register */
89#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */
90#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */
91#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */
92#define AT91_DDRSDRC_SDCOVF (1 << 3) /* Slave Delay Correction Overflow */
93#define AT91_DDRSDRC_SDCUDF (1 << 4) /* Slave Delay Correction Underflow */
94#define AT91_DDRSDRC_SDERF (1 << 5) /* Slave Delay Correction error */
95#define AT91_DDRSDRC_MDVAL (0xff << 8) /* Master Delay value */
96#define AT91_DDRSDRC_SDVAL (0xff << 16) /* Slave Delay value */
97#define AT91_DDRSDRC_SDCVAL (0xff << 24) /* Slave Delay Correction value */
98
99
100#endif
diff --git a/arch/arm/mach-at91/include/mach/at91cap9_matrix.h b/arch/arm/mach-at91/include/mach/at91cap9_matrix.h
new file mode 100644
index 000000000000..4b9d4aff4b4f
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91cap9_matrix.h
@@ -0,0 +1,137 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91cap9_matrix.h
3 *
4 * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com>
5 * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com>
6 * Copyright (C) 2006 Atmel Corporation.
7 *
8 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
9 * Based on AT91CAP9 datasheet revision B (Preliminary).
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
17#ifndef AT91CAP9_MATRIX_H
18#define AT91CAP9_MATRIX_H
19
20#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */
21#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */
22#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */
23#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */
24#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */
25#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */
26#define AT91_MATRIX_MCFG6 (AT91_MATRIX + 0x18) /* Master Configuration Register 6 */
27#define AT91_MATRIX_MCFG7 (AT91_MATRIX + 0x1C) /* Master Configuration Register 7 */
28#define AT91_MATRIX_MCFG8 (AT91_MATRIX + 0x20) /* Master Configuration Register 8 */
29#define AT91_MATRIX_MCFG9 (AT91_MATRIX + 0x24) /* Master Configuration Register 9 */
30#define AT91_MATRIX_MCFG10 (AT91_MATRIX + 0x28) /* Master Configuration Register 10 */
31#define AT91_MATRIX_MCFG11 (AT91_MATRIX + 0x2C) /* Master Configuration Register 11 */
32#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
33#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
34#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
35#define AT91_MATRIX_ULBT_FOUR (2 << 0)
36#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
37#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
38
39#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */
40#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */
41#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */
42#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */
43#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */
44#define AT91_MATRIX_SCFG5 (AT91_MATRIX + 0x54) /* Slave Configuration Register 5 */
45#define AT91_MATRIX_SCFG6 (AT91_MATRIX + 0x58) /* Slave Configuration Register 6 */
46#define AT91_MATRIX_SCFG7 (AT91_MATRIX + 0x5C) /* Slave Configuration Register 7 */
47#define AT91_MATRIX_SCFG8 (AT91_MATRIX + 0x60) /* Slave Configuration Register 8 */
48#define AT91_MATRIX_SCFG9 (AT91_MATRIX + 0x64) /* Slave Configuration Register 9 */
49#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
50#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
51#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
52#define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16)
53#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
54#define AT91_MATRIX_FIXED_DEFMSTR (0xf << 18) /* Fixed Index of Default Master */
55#define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */
56#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
57#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
58
59#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */
60#define AT91_MATRIX_PRBS0 (AT91_MATRIX + 0x84) /* Priority Register B for Slave 0 */
61#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */
62#define AT91_MATRIX_PRBS1 (AT91_MATRIX + 0x8C) /* Priority Register B for Slave 1 */
63#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */
64#define AT91_MATRIX_PRBS2 (AT91_MATRIX + 0x94) /* Priority Register B for Slave 2 */
65#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */
66#define AT91_MATRIX_PRBS3 (AT91_MATRIX + 0x9C) /* Priority Register B for Slave 3 */
67#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */
68#define AT91_MATRIX_PRBS4 (AT91_MATRIX + 0xA4) /* Priority Register B for Slave 4 */
69#define AT91_MATRIX_PRAS5 (AT91_MATRIX + 0xA8) /* Priority Register A for Slave 5 */
70#define AT91_MATRIX_PRBS5 (AT91_MATRIX + 0xAC) /* Priority Register B for Slave 5 */
71#define AT91_MATRIX_PRAS6 (AT91_MATRIX + 0xB0) /* Priority Register A for Slave 6 */
72#define AT91_MATRIX_PRBS6 (AT91_MATRIX + 0xB4) /* Priority Register B for Slave 6 */
73#define AT91_MATRIX_PRAS7 (AT91_MATRIX + 0xB8) /* Priority Register A for Slave 7 */
74#define AT91_MATRIX_PRBS7 (AT91_MATRIX + 0xBC) /* Priority Register B for Slave 7 */
75#define AT91_MATRIX_PRAS8 (AT91_MATRIX + 0xC0) /* Priority Register A for Slave 8 */
76#define AT91_MATRIX_PRBS8 (AT91_MATRIX + 0xC4) /* Priority Register B for Slave 8 */
77#define AT91_MATRIX_PRAS9 (AT91_MATRIX + 0xC8) /* Priority Register A for Slave 9 */
78#define AT91_MATRIX_PRBS9 (AT91_MATRIX + 0xCC) /* Priority Register B for Slave 9 */
79#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
80#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
81#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
82#define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */
83#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */
84#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */
85#define AT91_MATRIX_M6PR (3 << 24) /* Master 6 Priority */
86#define AT91_MATRIX_M7PR (3 << 28) /* Master 7 Priority */
87#define AT91_MATRIX_M8PR (3 << 0) /* Master 8 Priority (in Register B) */
88#define AT91_MATRIX_M9PR (3 << 4) /* Master 9 Priority (in Register B) */
89#define AT91_MATRIX_M10PR (3 << 8) /* Master 10 Priority (in Register B) */
90#define AT91_MATRIX_M11PR (3 << 12) /* Master 11 Priority (in Register B) */
91
92#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */
93#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
94#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
95#define AT91_MATRIX_RCB2 (1 << 2)
96#define AT91_MATRIX_RCB3 (1 << 3)
97#define AT91_MATRIX_RCB4 (1 << 4)
98#define AT91_MATRIX_RCB5 (1 << 5)
99#define AT91_MATRIX_RCB6 (1 << 6)
100#define AT91_MATRIX_RCB7 (1 << 7)
101#define AT91_MATRIX_RCB8 (1 << 8)
102#define AT91_MATRIX_RCB9 (1 << 9)
103#define AT91_MATRIX_RCB10 (1 << 10)
104#define AT91_MATRIX_RCB11 (1 << 11)
105
106#define AT91_MPBS0_SFR (AT91_MATRIX + 0x114) /* MPBlock Slave 0 Special Function Register */
107#define AT91_MPBS1_SFR (AT91_MATRIX + 0x11C) /* MPBlock Slave 1 Special Function Register */
108
109#define AT91_MATRIX_UDPHS (AT91_MATRIX + 0x118) /* USBHS Special Function Register [AT91CAP9 only] */
110#define AT91_MATRIX_SELECT_UDPHS (0 << 31) /* select High Speed UDP */
111#define AT91_MATRIX_SELECT_UDP (1 << 31) /* select standard UDP */
112#define AT91_MATRIX_UDPHS_BYPASS_LOCK (1 << 30) /* bypass lock bit */
113
114#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x120) /* EBI Chip Select Assignment Register */
115#define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
116#define AT91_MATRIX_EBI_CS1A_SMC (0 << 1)
117#define AT91_MATRIX_EBI_CS1A_BCRAMC (1 << 1)
118#define AT91_MATRIX_EBI_CS3A (1 << 3) /* Chip Select 3 Assignment */
119#define AT91_MATRIX_EBI_CS3A_SMC (0 << 3)
120#define AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA (1 << 3)
121#define AT91_MATRIX_EBI_CS4A (1 << 4) /* Chip Select 4 Assignment */
122#define AT91_MATRIX_EBI_CS4A_SMC (0 << 4)
123#define AT91_MATRIX_EBI_CS4A_SMC_CF1 (1 << 4)
124#define AT91_MATRIX_EBI_CS5A (1 << 5) /* Chip Select 5 Assignment */
125#define AT91_MATRIX_EBI_CS5A_SMC (0 << 5)
126#define AT91_MATRIX_EBI_CS5A_SMC_CF2 (1 << 5)
127#define AT91_MATRIX_EBI_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
128#define AT91_MATRIX_EBI_DQSPDC (1 << 9) /* Data Qualifier Strobe Pull-Down Configuration */
129#define AT91_MATRIX_EBI_VDDIOMSEL (1 << 16) /* Memory voltage selection */
130#define AT91_MATRIX_EBI_VDDIOMSEL_1_8V (0 << 16)
131#define AT91_MATRIX_EBI_VDDIOMSEL_3_3V (1 << 16)
132
133#define AT91_MPBS2_SFR (AT91_MATRIX + 0x12C) /* MPBlock Slave 2 Special Function Register */
134#define AT91_MPBS3_SFR (AT91_MATRIX + 0x130) /* MPBlock Slave 3 Special Function Register */
135#define AT91_APB_SFR (AT91_MATRIX + 0x134) /* APB Bridge Special Function Register */
136
137#endif
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h b/arch/arm/mach-at91/include/mach/at91rm9200.h
new file mode 100644
index 000000000000..78983155a074
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91rm9200.h
@@ -0,0 +1,115 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91rm9200.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Common definitions.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_H
17#define AT91RM9200_H
18
19/*
20 * Peripheral identifiers/interrupts.
21 */
22#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
23#define AT91_ID_SYS 1 /* System Peripheral */
24#define AT91RM9200_ID_PIOA 2 /* Parallel IO Controller A */
25#define AT91RM9200_ID_PIOB 3 /* Parallel IO Controller B */
26#define AT91RM9200_ID_PIOC 4 /* Parallel IO Controller C */
27#define AT91RM9200_ID_PIOD 5 /* Parallel IO Controller D */
28#define AT91RM9200_ID_US0 6 /* USART 0 */
29#define AT91RM9200_ID_US1 7 /* USART 1 */
30#define AT91RM9200_ID_US2 8 /* USART 2 */
31#define AT91RM9200_ID_US3 9 /* USART 3 */
32#define AT91RM9200_ID_MCI 10 /* Multimedia Card Interface */
33#define AT91RM9200_ID_UDP 11 /* USB Device Port */
34#define AT91RM9200_ID_TWI 12 /* Two-Wire Interface */
35#define AT91RM9200_ID_SPI 13 /* Serial Peripheral Interface */
36#define AT91RM9200_ID_SSC0 14 /* Serial Synchronous Controller 0 */
37#define AT91RM9200_ID_SSC1 15 /* Serial Synchronous Controller 1 */
38#define AT91RM9200_ID_SSC2 16 /* Serial Synchronous Controller 2 */
39#define AT91RM9200_ID_TC0 17 /* Timer Counter 0 */
40#define AT91RM9200_ID_TC1 18 /* Timer Counter 1 */
41#define AT91RM9200_ID_TC2 19 /* Timer Counter 2 */
42#define AT91RM9200_ID_TC3 20 /* Timer Counter 3 */
43#define AT91RM9200_ID_TC4 21 /* Timer Counter 4 */
44#define AT91RM9200_ID_TC5 22 /* Timer Counter 5 */
45#define AT91RM9200_ID_UHP 23 /* USB Host port */
46#define AT91RM9200_ID_EMAC 24 /* Ethernet MAC */
47#define AT91RM9200_ID_IRQ0 25 /* Advanced Interrupt Controller (IRQ0) */
48#define AT91RM9200_ID_IRQ1 26 /* Advanced Interrupt Controller (IRQ1) */
49#define AT91RM9200_ID_IRQ2 27 /* Advanced Interrupt Controller (IRQ2) */
50#define AT91RM9200_ID_IRQ3 28 /* Advanced Interrupt Controller (IRQ3) */
51#define AT91RM9200_ID_IRQ4 29 /* Advanced Interrupt Controller (IRQ4) */
52#define AT91RM9200_ID_IRQ5 30 /* Advanced Interrupt Controller (IRQ5) */
53#define AT91RM9200_ID_IRQ6 31 /* Advanced Interrupt Controller (IRQ6) */
54
55
56/*
57 * Peripheral physical base addresses.
58 */
59#define AT91RM9200_BASE_TCB0 0xfffa0000
60#define AT91RM9200_BASE_TC0 0xfffa0000
61#define AT91RM9200_BASE_TC1 0xfffa0040
62#define AT91RM9200_BASE_TC2 0xfffa0080
63#define AT91RM9200_BASE_TCB1 0xfffa4000
64#define AT91RM9200_BASE_TC3 0xfffa4000
65#define AT91RM9200_BASE_TC4 0xfffa4040
66#define AT91RM9200_BASE_TC5 0xfffa4080
67#define AT91RM9200_BASE_UDP 0xfffb0000
68#define AT91RM9200_BASE_MCI 0xfffb4000
69#define AT91RM9200_BASE_TWI 0xfffb8000
70#define AT91RM9200_BASE_EMAC 0xfffbc000
71#define AT91RM9200_BASE_US0 0xfffc0000
72#define AT91RM9200_BASE_US1 0xfffc4000
73#define AT91RM9200_BASE_US2 0xfffc8000
74#define AT91RM9200_BASE_US3 0xfffcc000
75#define AT91RM9200_BASE_SSC0 0xfffd0000
76#define AT91RM9200_BASE_SSC1 0xfffd4000
77#define AT91RM9200_BASE_SSC2 0xfffd8000
78#define AT91RM9200_BASE_SPI 0xfffe0000
79#define AT91_BASE_SYS 0xfffff000
80
81
82/*
83 * System Peripherals (offset from AT91_BASE_SYS)
84 */
85#define AT91_AIC (0xfffff000 - AT91_BASE_SYS) /* Advanced Interrupt Controller */
86#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) /* Debug Unit */
87#define AT91_PIOA (0xfffff400 - AT91_BASE_SYS) /* PIO Controller A */
88#define AT91_PIOB (0xfffff600 - AT91_BASE_SYS) /* PIO Controller B */
89#define AT91_PIOC (0xfffff800 - AT91_BASE_SYS) /* PIO Controller C */
90#define AT91_PIOD (0xfffffa00 - AT91_BASE_SYS) /* PIO Controller D */
91#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) /* Power Management Controller */
92#define AT91_ST (0xfffffd00 - AT91_BASE_SYS) /* System Timer */
93#define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) /* Real-Time Clock */
94#define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */
95
96#define AT91_USART0 AT91RM9200_BASE_US0
97#define AT91_USART1 AT91RM9200_BASE_US1
98#define AT91_USART2 AT91RM9200_BASE_US2
99#define AT91_USART3 AT91RM9200_BASE_US3
100
101#define AT91_MATRIX 0 /* not supported */
102
103/*
104 * Internal Memory.
105 */
106#define AT91RM9200_ROM_BASE 0x00100000 /* Internal ROM base address */
107#define AT91RM9200_ROM_SIZE SZ_128K /* Internal ROM size (128Kb) */
108
109#define AT91RM9200_SRAM_BASE 0x00200000 /* Internal SRAM base address */
110#define AT91RM9200_SRAM_SIZE SZ_16K /* Internal SRAM size (16Kb) */
111
112#define AT91RM9200_UHP_BASE 0x00300000 /* USB Host controller */
113
114
115#endif
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200_emac.h b/arch/arm/mach-at91/include/mach/at91rm9200_emac.h
new file mode 100644
index 000000000000..b8260cd8041c
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91rm9200_emac.h
@@ -0,0 +1,138 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91rm9200_emac.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Ethernet MAC registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_EMAC_H
17#define AT91RM9200_EMAC_H
18
19#define AT91_EMAC_CTL 0x00 /* Control Register */
20#define AT91_EMAC_LB (1 << 0) /* Loopback */
21#define AT91_EMAC_LBL (1 << 1) /* Loopback Local */
22#define AT91_EMAC_RE (1 << 2) /* Receive Enable */
23#define AT91_EMAC_TE (1 << 3) /* Transmit Enable */
24#define AT91_EMAC_MPE (1 << 4) /* Management Port Enable */
25#define AT91_EMAC_CSR (1 << 5) /* Clear Statistics Registers */
26#define AT91_EMAC_INCSTAT (1 << 6) /* Increment Statistics Registers */
27#define AT91_EMAC_WES (1 << 7) /* Write Enable for Statistics Registers */
28#define AT91_EMAC_BP (1 << 8) /* Back Pressure */
29
30#define AT91_EMAC_CFG 0x04 /* Configuration Register */
31#define AT91_EMAC_SPD (1 << 0) /* Speed */
32#define AT91_EMAC_FD (1 << 1) /* Full Duplex */
33#define AT91_EMAC_BR (1 << 2) /* Bit Rate */
34#define AT91_EMAC_CAF (1 << 4) /* Copy All Frames */
35#define AT91_EMAC_NBC (1 << 5) /* No Broadcast */
36#define AT91_EMAC_MTI (1 << 6) /* Multicast Hash Enable */
37#define AT91_EMAC_UNI (1 << 7) /* Unicast Hash Enable */
38#define AT91_EMAC_BIG (1 << 8) /* Receive 1522 Bytes */
39#define AT91_EMAC_EAE (1 << 9) /* External Address Match Enable */
40#define AT91_EMAC_CLK (3 << 10) /* MDC Clock Divisor */
41#define AT91_EMAC_CLK_DIV8 (0 << 10)
42#define AT91_EMAC_CLK_DIV16 (1 << 10)
43#define AT91_EMAC_CLK_DIV32 (2 << 10)
44#define AT91_EMAC_CLK_DIV64 (3 << 10)
45#define AT91_EMAC_RTY (1 << 12) /* Retry Test */
46#define AT91_EMAC_RMII (1 << 13) /* Reduce MII (RMII) */
47
48#define AT91_EMAC_SR 0x08 /* Status Register */
49#define AT91_EMAC_SR_LINK (1 << 0) /* Link */
50#define AT91_EMAC_SR_MDIO (1 << 1) /* MDIO pin */
51#define AT91_EMAC_SR_IDLE (1 << 2) /* PHY idle */
52
53#define AT91_EMAC_TAR 0x0c /* Transmit Address Register */
54
55#define AT91_EMAC_TCR 0x10 /* Transmit Control Register */
56#define AT91_EMAC_LEN (0x7ff << 0) /* Transmit Frame Length */
57#define AT91_EMAC_NCRC (1 << 15) /* No CRC */
58
59#define AT91_EMAC_TSR 0x14 /* Transmit Status Register */
60#define AT91_EMAC_TSR_OVR (1 << 0) /* Transmit Buffer Overrun */
61#define AT91_EMAC_TSR_COL (1 << 1) /* Collision Occurred */
62#define AT91_EMAC_TSR_RLE (1 << 2) /* Retry Limit Exceeded */
63#define AT91_EMAC_TSR_IDLE (1 << 3) /* Transmitter Idle */
64#define AT91_EMAC_TSR_BNQ (1 << 4) /* Transmit Buffer not Queued */
65#define AT91_EMAC_TSR_COMP (1 << 5) /* Transmit Complete */
66#define AT91_EMAC_TSR_UND (1 << 6) /* Transmit Underrun */
67
68#define AT91_EMAC_RBQP 0x18 /* Receive Buffer Queue Pointer */
69
70#define AT91_EMAC_RSR 0x20 /* Receive Status Register */
71#define AT91_EMAC_RSR_BNA (1 << 0) /* Buffer Not Available */
72#define AT91_EMAC_RSR_REC (1 << 1) /* Frame Received */
73#define AT91_EMAC_RSR_OVR (1 << 2) /* RX Overrun */
74
75#define AT91_EMAC_ISR 0x24 /* Interrupt Status Register */
76#define AT91_EMAC_DONE (1 << 0) /* Management Done */
77#define AT91_EMAC_RCOM (1 << 1) /* Receive Complete */
78#define AT91_EMAC_RBNA (1 << 2) /* Receive Buffer Not Available */
79#define AT91_EMAC_TOVR (1 << 3) /* Transmit Buffer Overrun */
80#define AT91_EMAC_TUND (1 << 4) /* Transmit Buffer Underrun */
81#define AT91_EMAC_RTRY (1 << 5) /* Retry Limit */
82#define AT91_EMAC_TBRE (1 << 6) /* Transmit Buffer Register Empty */
83#define AT91_EMAC_TCOM (1 << 7) /* Transmit Complete */
84#define AT91_EMAC_TIDLE (1 << 8) /* Transmit Idle */
85#define AT91_EMAC_LINK (1 << 9) /* Link */
86#define AT91_EMAC_ROVR (1 << 10) /* RX Overrun */
87#define AT91_EMAC_ABT (1 << 11) /* Abort */
88
89#define AT91_EMAC_IER 0x28 /* Interrupt Enable Register */
90#define AT91_EMAC_IDR 0x2c /* Interrupt Disable Register */
91#define AT91_EMAC_IMR 0x30 /* Interrupt Mask Register */
92
93#define AT91_EMAC_MAN 0x34 /* PHY Maintenance Register */
94#define AT91_EMAC_DATA (0xffff << 0) /* MDIO Data */
95#define AT91_EMAC_REGA (0x1f << 18) /* MDIO Register */
96#define AT91_EMAC_PHYA (0x1f << 23) /* MDIO PHY Address */
97#define AT91_EMAC_RW (3 << 28) /* Read/Write operation */
98#define AT91_EMAC_RW_W (1 << 28)
99#define AT91_EMAC_RW_R (2 << 28)
100#define AT91_EMAC_MAN_802_3 0x40020000 /* IEEE 802.3 value */
101
102/*
103 * Statistics Registers.
104 */
105#define AT91_EMAC_FRA 0x40 /* Frames Transmitted OK */
106#define AT91_EMAC_SCOL 0x44 /* Single Collision Frame */
107#define AT91_EMAC_MCOL 0x48 /* Multiple Collision Frame */
108#define AT91_EMAC_OK 0x4c /* Frames Received OK */
109#define AT91_EMAC_SEQE 0x50 /* Frame Check Sequence Error */
110#define AT91_EMAC_ALE 0x54 /* Alignmemt Error */
111#define AT91_EMAC_DTE 0x58 /* Deffered Transmission Frame */
112#define AT91_EMAC_LCOL 0x5c /* Late Collision */
113#define AT91_EMAC_ECOL 0x60 /* Excessive Collision */
114#define AT91_EMAC_TUE 0x64 /* Transmit Underrun Error */
115#define AT91_EMAC_CSE 0x68 /* Carrier Sense Error */
116#define AT91_EMAC_DRFC 0x6c /* Discard RX Frame */
117#define AT91_EMAC_ROV 0x70 /* Receive Overrun */
118#define AT91_EMAC_CDE 0x74 /* Code Error */
119#define AT91_EMAC_ELR 0x78 /* Excessive Length Error */
120#define AT91_EMAC_RJB 0x7c /* Receive Jabber */
121#define AT91_EMAC_USF 0x80 /* Undersize Frame */
122#define AT91_EMAC_SQEE 0x84 /* SQE Test Error */
123
124/*
125 * Address Registers.
126 */
127#define AT91_EMAC_HSL 0x90 /* Hash Address Low [31:0] */
128#define AT91_EMAC_HSH 0x94 /* Hash Address High [63:32] */
129#define AT91_EMAC_SA1L 0x98 /* Specific Address 1 Low, bytes 0-3 */
130#define AT91_EMAC_SA1H 0x9c /* Specific Address 1 High, bytes 4-5 */
131#define AT91_EMAC_SA2L 0xa0 /* Specific Address 2 Low, bytes 0-3 */
132#define AT91_EMAC_SA2H 0xa4 /* Specific Address 2 High, bytes 4-5 */
133#define AT91_EMAC_SA3L 0xa8 /* Specific Address 3 Low, bytes 0-3 */
134#define AT91_EMAC_SA3H 0xac /* Specific Address 3 High, bytes 4-5 */
135#define AT91_EMAC_SA4L 0xb0 /* Specific Address 4 Low, bytes 0-3 */
136#define AT91_EMAC_SA4H 0xb4 /* Specific Address 4 High, bytes 4-5 */
137
138#endif
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200_mc.h b/arch/arm/mach-at91/include/mach/at91rm9200_mc.h
new file mode 100644
index 000000000000..d34e4ed89349
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91rm9200_mc.h
@@ -0,0 +1,160 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91rm9200_mc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Memory Controllers (MC, EBI, SMC, SDRAMC, BFC) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_MC_H
17#define AT91RM9200_MC_H
18
19/* Memory Controller */
20#define AT91_MC_RCR (AT91_MC + 0x00) /* MC Remap Control Register */
21#define AT91_MC_RCB (1 << 0) /* Remap Command Bit */
22
23#define AT91_MC_ASR (AT91_MC + 0x04) /* MC Abort Status Register */
24#define AT91_MC_UNADD (1 << 0) /* Undefined Address Abort Status */
25#define AT91_MC_MISADD (1 << 1) /* Misaligned Address Abort Status */
26#define AT91_MC_ABTSZ (3 << 8) /* Abort Size Status */
27#define AT91_MC_ABTSZ_BYTE (0 << 8)
28#define AT91_MC_ABTSZ_HALFWORD (1 << 8)
29#define AT91_MC_ABTSZ_WORD (2 << 8)
30#define AT91_MC_ABTTYP (3 << 10) /* Abort Type Status */
31#define AT91_MC_ABTTYP_DATAREAD (0 << 10)
32#define AT91_MC_ABTTYP_DATAWRITE (1 << 10)
33#define AT91_MC_ABTTYP_FETCH (2 << 10)
34#define AT91_MC_MST0 (1 << 16) /* ARM920T Abort Source */
35#define AT91_MC_MST1 (1 << 17) /* PDC Abort Source */
36#define AT91_MC_MST2 (1 << 18) /* UHP Abort Source */
37#define AT91_MC_MST3 (1 << 19) /* EMAC Abort Source */
38#define AT91_MC_SVMST0 (1 << 24) /* Saved ARM920T Abort Source */
39#define AT91_MC_SVMST1 (1 << 25) /* Saved PDC Abort Source */
40#define AT91_MC_SVMST2 (1 << 26) /* Saved UHP Abort Source */
41#define AT91_MC_SVMST3 (1 << 27) /* Saved EMAC Abort Source */
42
43#define AT91_MC_AASR (AT91_MC + 0x08) /* MC Abort Address Status Register */
44
45#define AT91_MC_MPR (AT91_MC + 0x0c) /* MC Master Priority Register */
46#define AT91_MPR_MSTP0 (7 << 0) /* ARM920T Priority */
47#define AT91_MPR_MSTP1 (7 << 4) /* PDC Priority */
48#define AT91_MPR_MSTP2 (7 << 8) /* UHP Priority */
49#define AT91_MPR_MSTP3 (7 << 12) /* EMAC Priority */
50
51/* External Bus Interface (EBI) registers */
52#define AT91_EBI_CSA (AT91_MC + 0x60) /* Chip Select Assignment Register */
53#define AT91_EBI_CS0A (1 << 0) /* Chip Select 0 Assignment */
54#define AT91_EBI_CS0A_SMC (0 << 0)
55#define AT91_EBI_CS0A_BFC (1 << 0)
56#define AT91_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
57#define AT91_EBI_CS1A_SMC (0 << 1)
58#define AT91_EBI_CS1A_SDRAMC (1 << 1)
59#define AT91_EBI_CS3A (1 << 3) /* Chip Select 2 Assignment */
60#define AT91_EBI_CS3A_SMC (0 << 3)
61#define AT91_EBI_CS3A_SMC_SMARTMEDIA (1 << 3)
62#define AT91_EBI_CS4A (1 << 4) /* Chip Select 3 Assignment */
63#define AT91_EBI_CS4A_SMC (0 << 4)
64#define AT91_EBI_CS4A_SMC_COMPACTFLASH (1 << 4)
65#define AT91_EBI_CFGR (AT91_MC + 0x64) /* Configuration Register */
66#define AT91_EBI_DBPUC (1 << 0) /* Data Bus Pull-Up Configuration */
67
68/* Static Memory Controller (SMC) registers */
69#define AT91_SMC_CSR(n) (AT91_MC + 0x70 + ((n) * 4))/* SMC Chip Select Register */
70#define AT91_SMC_NWS (0x7f << 0) /* Number of Wait States */
71#define AT91_SMC_NWS_(x) ((x) << 0)
72#define AT91_SMC_WSEN (1 << 7) /* Wait State Enable */
73#define AT91_SMC_TDF (0xf << 8) /* Data Float Time */
74#define AT91_SMC_TDF_(x) ((x) << 8)
75#define AT91_SMC_BAT (1 << 12) /* Byte Access Type */
76#define AT91_SMC_DBW (3 << 13) /* Data Bus Width */
77#define AT91_SMC_DBW_16 (1 << 13)
78#define AT91_SMC_DBW_8 (2 << 13)
79#define AT91_SMC_DPR (1 << 15) /* Data Read Protocol */
80#define AT91_SMC_ACSS (3 << 16) /* Address to Chip Select Setup */
81#define AT91_SMC_ACSS_STD (0 << 16)
82#define AT91_SMC_ACSS_1 (1 << 16)
83#define AT91_SMC_ACSS_2 (2 << 16)
84#define AT91_SMC_ACSS_3 (3 << 16)
85#define AT91_SMC_RWSETUP (7 << 24) /* Read & Write Signal Time Setup */
86#define AT91_SMC_RWSETUP_(x) ((x) << 24)
87#define AT91_SMC_RWHOLD (7 << 28) /* Read & Write Signal Hold Time */
88#define AT91_SMC_RWHOLD_(x) ((x) << 28)
89
90/* SDRAM Controller registers */
91#define AT91_SDRAMC_MR (AT91_MC + 0x90) /* Mode Register */
92#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
93#define AT91_SDRAMC_MODE_NORMAL (0 << 0)
94#define AT91_SDRAMC_MODE_NOP (1 << 0)
95#define AT91_SDRAMC_MODE_PRECHARGE (2 << 0)
96#define AT91_SDRAMC_MODE_LMR (3 << 0)
97#define AT91_SDRAMC_MODE_REFRESH (4 << 0)
98#define AT91_SDRAMC_DBW (1 << 4) /* Data Bus Width */
99#define AT91_SDRAMC_DBW_32 (0 << 4)
100#define AT91_SDRAMC_DBW_16 (1 << 4)
101
102#define AT91_SDRAMC_TR (AT91_MC + 0x94) /* Refresh Timer Register */
103#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Count */
104
105#define AT91_SDRAMC_CR (AT91_MC + 0x98) /* Configuration Register */
106#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
107#define AT91_SDRAMC_NC_8 (0 << 0)
108#define AT91_SDRAMC_NC_9 (1 << 0)
109#define AT91_SDRAMC_NC_10 (2 << 0)
110#define AT91_SDRAMC_NC_11 (3 << 0)
111#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
112#define AT91_SDRAMC_NR_11 (0 << 2)
113#define AT91_SDRAMC_NR_12 (1 << 2)
114#define AT91_SDRAMC_NR_13 (2 << 2)
115#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
116#define AT91_SDRAMC_NB_2 (0 << 4)
117#define AT91_SDRAMC_NB_4 (1 << 4)
118#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
119#define AT91_SDRAMC_CAS_2 (2 << 5)
120#define AT91_SDRAMC_TWR (0xf << 7) /* Write Recovery Delay */
121#define AT91_SDRAMC_TRC (0xf << 11) /* Row Cycle Delay */
122#define AT91_SDRAMC_TRP (0xf << 15) /* Row Precharge Delay */
123#define AT91_SDRAMC_TRCD (0xf << 19) /* Row to Column Delay */
124#define AT91_SDRAMC_TRAS (0xf << 23) /* Active to Precharge Delay */
125#define AT91_SDRAMC_TXSR (0xf << 27) /* Exit Self Refresh to Active Delay */
126
127#define AT91_SDRAMC_SRR (AT91_MC + 0x9c) /* Self Refresh Register */
128#define AT91_SDRAMC_LPR (AT91_MC + 0xa0) /* Low Power Register */
129#define AT91_SDRAMC_IER (AT91_MC + 0xa4) /* Interrupt Enable Register */
130#define AT91_SDRAMC_IDR (AT91_MC + 0xa8) /* Interrupt Disable Register */
131#define AT91_SDRAMC_IMR (AT91_MC + 0xac) /* Interrupt Mask Register */
132#define AT91_SDRAMC_ISR (AT91_MC + 0xb0) /* Interrupt Status Register */
133
134/* Burst Flash Controller register */
135#define AT91_BFC_MR (AT91_MC + 0xc0) /* Mode Register */
136#define AT91_BFC_BFCOM (3 << 0) /* Burst Flash Controller Operating Mode */
137#define AT91_BFC_BFCOM_DISABLED (0 << 0)
138#define AT91_BFC_BFCOM_ASYNC (1 << 0)
139#define AT91_BFC_BFCOM_BURST (2 << 0)
140#define AT91_BFC_BFCC (3 << 2) /* Burst Flash Controller Clock */
141#define AT91_BFC_BFCC_MCK (1 << 2)
142#define AT91_BFC_BFCC_DIV2 (2 << 2)
143#define AT91_BFC_BFCC_DIV4 (3 << 2)
144#define AT91_BFC_AVL (0xf << 4) /* Address Valid Latency */
145#define AT91_BFC_PAGES (7 << 8) /* Page Size */
146#define AT91_BFC_PAGES_NO_PAGE (0 << 8)
147#define AT91_BFC_PAGES_16 (1 << 8)
148#define AT91_BFC_PAGES_32 (2 << 8)
149#define AT91_BFC_PAGES_64 (3 << 8)
150#define AT91_BFC_PAGES_128 (4 << 8)
151#define AT91_BFC_PAGES_256 (5 << 8)
152#define AT91_BFC_PAGES_512 (6 << 8)
153#define AT91_BFC_PAGES_1024 (7 << 8)
154#define AT91_BFC_OEL (3 << 12) /* Output Enable Latency */
155#define AT91_BFC_BAAEN (1 << 16) /* Burst Address Advance Enable */
156#define AT91_BFC_BFOEH (1 << 17) /* Burst Flash Output Enable Handling */
157#define AT91_BFC_MUXEN (1 << 18) /* Multiplexed Bus Enable */
158#define AT91_BFC_RDYEN (1 << 19) /* Ready Enable Mode */
159
160#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h
new file mode 100644
index 000000000000..43c396b9b4cb
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9260.h
@@ -0,0 +1,138 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9260.h
3 *
4 * (C) 2006 Andrew Victor
5 *
6 * Common definitions.
7 * Based on AT91SAM9260 datasheet revision A (Preliminary).
8 *
9 * Includes also definitions for AT91SAM9XE and AT91SAM9G families
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
17#ifndef AT91SAM9260_H
18#define AT91SAM9260_H
19
20/*
21 * Peripheral identifiers/interrupts.
22 */
23#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
24#define AT91_ID_SYS 1 /* System Peripherals */
25#define AT91SAM9260_ID_PIOA 2 /* Parallel IO Controller A */
26#define AT91SAM9260_ID_PIOB 3 /* Parallel IO Controller B */
27#define AT91SAM9260_ID_PIOC 4 /* Parallel IO Controller C */
28#define AT91SAM9260_ID_ADC 5 /* Analog-to-Digital Converter */
29#define AT91SAM9260_ID_US0 6 /* USART 0 */
30#define AT91SAM9260_ID_US1 7 /* USART 1 */
31#define AT91SAM9260_ID_US2 8 /* USART 2 */
32#define AT91SAM9260_ID_MCI 9 /* Multimedia Card Interface */
33#define AT91SAM9260_ID_UDP 10 /* USB Device Port */
34#define AT91SAM9260_ID_TWI 11 /* Two-Wire Interface */
35#define AT91SAM9260_ID_SPI0 12 /* Serial Peripheral Interface 0 */
36#define AT91SAM9260_ID_SPI1 13 /* Serial Peripheral Interface 1 */
37#define AT91SAM9260_ID_SSC 14 /* Serial Synchronous Controller */
38#define AT91SAM9260_ID_TC0 17 /* Timer Counter 0 */
39#define AT91SAM9260_ID_TC1 18 /* Timer Counter 1 */
40#define AT91SAM9260_ID_TC2 19 /* Timer Counter 2 */
41#define AT91SAM9260_ID_UHP 20 /* USB Host port */
42#define AT91SAM9260_ID_EMAC 21 /* Ethernet */
43#define AT91SAM9260_ID_ISI 22 /* Image Sensor Interface */
44#define AT91SAM9260_ID_US3 23 /* USART 3 */
45#define AT91SAM9260_ID_US4 24 /* USART 4 */
46#define AT91SAM9260_ID_US5 25 /* USART 5 */
47#define AT91SAM9260_ID_TC3 26 /* Timer Counter 3 */
48#define AT91SAM9260_ID_TC4 27 /* Timer Counter 4 */
49#define AT91SAM9260_ID_TC5 28 /* Timer Counter 5 */
50#define AT91SAM9260_ID_IRQ0 29 /* Advanced Interrupt Controller (IRQ0) */
51#define AT91SAM9260_ID_IRQ1 30 /* Advanced Interrupt Controller (IRQ1) */
52#define AT91SAM9260_ID_IRQ2 31 /* Advanced Interrupt Controller (IRQ2) */
53
54
55/*
56 * User Peripheral physical base addresses.
57 */
58#define AT91SAM9260_BASE_TCB0 0xfffa0000
59#define AT91SAM9260_BASE_TC0 0xfffa0000
60#define AT91SAM9260_BASE_TC1 0xfffa0040
61#define AT91SAM9260_BASE_TC2 0xfffa0080
62#define AT91SAM9260_BASE_UDP 0xfffa4000
63#define AT91SAM9260_BASE_MCI 0xfffa8000
64#define AT91SAM9260_BASE_TWI 0xfffac000
65#define AT91SAM9260_BASE_US0 0xfffb0000
66#define AT91SAM9260_BASE_US1 0xfffb4000
67#define AT91SAM9260_BASE_US2 0xfffb8000
68#define AT91SAM9260_BASE_SSC 0xfffbc000
69#define AT91SAM9260_BASE_ISI 0xfffc0000
70#define AT91SAM9260_BASE_EMAC 0xfffc4000
71#define AT91SAM9260_BASE_SPI0 0xfffc8000
72#define AT91SAM9260_BASE_SPI1 0xfffcc000
73#define AT91SAM9260_BASE_US3 0xfffd0000
74#define AT91SAM9260_BASE_US4 0xfffd4000
75#define AT91SAM9260_BASE_US5 0xfffd8000
76#define AT91SAM9260_BASE_TCB1 0xfffdc000
77#define AT91SAM9260_BASE_TC3 0xfffdc000
78#define AT91SAM9260_BASE_TC4 0xfffdc040
79#define AT91SAM9260_BASE_TC5 0xfffdc080
80#define AT91SAM9260_BASE_ADC 0xfffe0000
81#define AT91_BASE_SYS 0xffffe800
82
83/*
84 * System Peripherals (offset from AT91_BASE_SYS)
85 */
86#define AT91_ECC (0xffffe800 - AT91_BASE_SYS)
87#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS)
88#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
89#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
90#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS)
91#define AT91_AIC (0xfffff000 - AT91_BASE_SYS)
92#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS)
93#define AT91_PIOA (0xfffff400 - AT91_BASE_SYS)
94#define AT91_PIOB (0xfffff600 - AT91_BASE_SYS)
95#define AT91_PIOC (0xfffff800 - AT91_BASE_SYS)
96#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
97#define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS)
98#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS)
99#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS)
100#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS)
101#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
102#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS)
103
104#define AT91_USART0 AT91SAM9260_BASE_US0
105#define AT91_USART1 AT91SAM9260_BASE_US1
106#define AT91_USART2 AT91SAM9260_BASE_US2
107#define AT91_USART3 AT91SAM9260_BASE_US3
108#define AT91_USART4 AT91SAM9260_BASE_US4
109#define AT91_USART5 AT91SAM9260_BASE_US5
110
111
112/*
113 * Internal Memory.
114 */
115#define AT91SAM9260_ROM_BASE 0x00100000 /* Internal ROM base address */
116#define AT91SAM9260_ROM_SIZE SZ_32K /* Internal ROM size (32Kb) */
117
118#define AT91SAM9260_SRAM0_BASE 0x00200000 /* Internal SRAM 0 base address */
119#define AT91SAM9260_SRAM0_SIZE SZ_4K /* Internal SRAM 0 size (4Kb) */
120#define AT91SAM9260_SRAM1_BASE 0x00300000 /* Internal SRAM 1 base address */
121#define AT91SAM9260_SRAM1_SIZE SZ_4K /* Internal SRAM 1 size (4Kb) */
122
123#define AT91SAM9260_UHP_BASE 0x00500000 /* USB Host controller */
124
125#define AT91SAM9XE_FLASH_BASE 0x00200000 /* Internal FLASH base address */
126#define AT91SAM9XE_SRAM_BASE 0x00300000 /* Internal SRAM base address */
127
128#define AT91SAM9G20_ROM_BASE 0x00100000 /* Internal ROM base address */
129#define AT91SAM9G20_ROM_SIZE SZ_32K /* Internal ROM size (32Kb) */
130
131#define AT91SAM9G20_SRAM0_BASE 0x00200000 /* Internal SRAM 0 base address */
132#define AT91SAM9G20_SRAM0_SIZE SZ_16K /* Internal SRAM 0 size (16Kb) */
133#define AT91SAM9G20_SRAM1_BASE 0x00300000 /* Internal SRAM 1 base address */
134#define AT91SAM9G20_SRAM1_SIZE SZ_16K /* Internal SRAM 1 size (16Kb) */
135
136#define AT91SAM9G20_UHP_BASE 0x00500000 /* USB Host controller */
137
138#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
new file mode 100644
index 000000000000..f027de5df956
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
@@ -0,0 +1,78 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
3 *
4 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
5 * Based on AT91SAM9260 datasheet revision B.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91SAM9260_MATRIX_H
14#define AT91SAM9260_MATRIX_H
15
16#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */
17#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */
18#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */
19#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */
20#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */
21#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */
22#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
23#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
24#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
25#define AT91_MATRIX_ULBT_FOUR (2 << 0)
26#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
27#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
28
29#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */
30#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */
31#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */
32#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */
33#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */
34#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
35#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
36#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
37#define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16)
38#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
39#define AT91_MATRIX_FIXED_DEFMSTR (7 << 18) /* Fixed Index of Default Master */
40#define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */
41#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
42#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
43
44#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */
45#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */
46#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */
47#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */
48#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */
49#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
50#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
51#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
52#define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */
53#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */
54#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */
55
56#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */
57#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
58#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
59
60#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x11C) /* EBI Chip Select Assignment Register */
61#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
62#define AT91_MATRIX_CS1A_SMC (0 << 1)
63#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
64#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */
65#define AT91_MATRIX_CS3A_SMC (0 << 3)
66#define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3)
67#define AT91_MATRIX_CS4A (1 << 4) /* Chip Select 4 Assignment */
68#define AT91_MATRIX_CS4A_SMC (0 << 4)
69#define AT91_MATRIX_CS4A_SMC_CF1 (1 << 4)
70#define AT91_MATRIX_CS5A (1 << 5) /* Chip Select 5 Assignment */
71#define AT91_MATRIX_CS5A_SMC (0 << 5)
72#define AT91_MATRIX_CS5A_SMC_CF2 (1 << 5)
73#define AT91_MATRIX_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
74#define AT91_MATRIX_VDDIOMSEL (1 << 16) /* Memory voltage selection */
75#define AT91_MATRIX_VDDIOMSEL_1_8V (0 << 16)
76#define AT91_MATRIX_VDDIOMSEL_3_3V (1 << 16)
77
78#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h
new file mode 100644
index 000000000000..3a348ca20773
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9261.h
@@ -0,0 +1,105 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9261.h
3 *
4 * Copyright (C) SAN People
5 *
6 * Common definitions.
7 * Based on AT91SAM9261 datasheet revision E. (Preliminary)
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#ifndef AT91SAM9261_H
16#define AT91SAM9261_H
17
18/*
19 * Peripheral identifiers/interrupts.
20 */
21#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
22#define AT91_ID_SYS 1 /* System Peripherals */
23#define AT91SAM9261_ID_PIOA 2 /* Parallel IO Controller A */
24#define AT91SAM9261_ID_PIOB 3 /* Parallel IO Controller B */
25#define AT91SAM9261_ID_PIOC 4 /* Parallel IO Controller C */
26#define AT91SAM9261_ID_US0 6 /* USART 0 */
27#define AT91SAM9261_ID_US1 7 /* USART 1 */
28#define AT91SAM9261_ID_US2 8 /* USART 2 */
29#define AT91SAM9261_ID_MCI 9 /* Multimedia Card Interface */
30#define AT91SAM9261_ID_UDP 10 /* USB Device Port */
31#define AT91SAM9261_ID_TWI 11 /* Two-Wire Interface */
32#define AT91SAM9261_ID_SPI0 12 /* Serial Peripheral Interface 0 */
33#define AT91SAM9261_ID_SPI1 13 /* Serial Peripheral Interface 1 */
34#define AT91SAM9261_ID_SSC0 14 /* Serial Synchronous Controller 0 */
35#define AT91SAM9261_ID_SSC1 15 /* Serial Synchronous Controller 1 */
36#define AT91SAM9261_ID_SSC2 16 /* Serial Synchronous Controller 2 */
37#define AT91SAM9261_ID_TC0 17 /* Timer Counter 0 */
38#define AT91SAM9261_ID_TC1 18 /* Timer Counter 1 */
39#define AT91SAM9261_ID_TC2 19 /* Timer Counter 2 */
40#define AT91SAM9261_ID_UHP 20 /* USB Host port */
41#define AT91SAM9261_ID_LCDC 21 /* LDC Controller */
42#define AT91SAM9261_ID_IRQ0 29 /* Advanced Interrupt Controller (IRQ0) */
43#define AT91SAM9261_ID_IRQ1 30 /* Advanced Interrupt Controller (IRQ1) */
44#define AT91SAM9261_ID_IRQ2 31 /* Advanced Interrupt Controller (IRQ2) */
45
46
47/*
48 * User Peripheral physical base addresses.
49 */
50#define AT91SAM9261_BASE_TCB0 0xfffa0000
51#define AT91SAM9261_BASE_TC0 0xfffa0000
52#define AT91SAM9261_BASE_TC1 0xfffa0040
53#define AT91SAM9261_BASE_TC2 0xfffa0080
54#define AT91SAM9261_BASE_UDP 0xfffa4000
55#define AT91SAM9261_BASE_MCI 0xfffa8000
56#define AT91SAM9261_BASE_TWI 0xfffac000
57#define AT91SAM9261_BASE_US0 0xfffb0000
58#define AT91SAM9261_BASE_US1 0xfffb4000
59#define AT91SAM9261_BASE_US2 0xfffb8000
60#define AT91SAM9261_BASE_SSC0 0xfffbc000
61#define AT91SAM9261_BASE_SSC1 0xfffc0000
62#define AT91SAM9261_BASE_SSC2 0xfffc4000
63#define AT91SAM9261_BASE_SPI0 0xfffc8000
64#define AT91SAM9261_BASE_SPI1 0xfffcc000
65#define AT91_BASE_SYS 0xffffea00
66
67
68/*
69 * System Peripherals (offset from AT91_BASE_SYS)
70 */
71#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS)
72#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
73#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
74#define AT91_AIC (0xfffff000 - AT91_BASE_SYS)
75#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS)
76#define AT91_PIOA (0xfffff400 - AT91_BASE_SYS)
77#define AT91_PIOB (0xfffff600 - AT91_BASE_SYS)
78#define AT91_PIOC (0xfffff800 - AT91_BASE_SYS)
79#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
80#define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS)
81#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS)
82#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS)
83#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS)
84#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
85#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS)
86
87#define AT91_USART0 AT91SAM9261_BASE_US0
88#define AT91_USART1 AT91SAM9261_BASE_US1
89#define AT91_USART2 AT91SAM9261_BASE_US2
90
91
92/*
93 * Internal Memory.
94 */
95#define AT91SAM9261_SRAM_BASE 0x00300000 /* Internal SRAM base address */
96#define AT91SAM9261_SRAM_SIZE 0x00028000 /* Internal SRAM size (160Kb) */
97
98#define AT91SAM9261_ROM_BASE 0x00400000 /* Internal ROM base address */
99#define AT91SAM9261_ROM_SIZE SZ_32K /* Internal ROM size (32Kb) */
100
101#define AT91SAM9261_UHP_BASE 0x00500000 /* USB Host controller */
102#define AT91SAM9261_LCDC_BASE 0x00600000 /* LDC controller */
103
104
105#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
new file mode 100644
index 000000000000..db62b1f18300
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
@@ -0,0 +1,62 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
3 *
4 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91SAM9261_MATRIX_H
14#define AT91SAM9261_MATRIX_H
15
16#define AT91_MATRIX_MCFG (AT91_MATRIX + 0x00) /* Master Configuration Register */
17#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
18#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
19
20#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x04) /* Slave Configuration Register 0 */
21#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x08) /* Slave Configuration Register 1 */
22#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x0C) /* Slave Configuration Register 2 */
23#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x10) /* Slave Configuration Register 3 */
24#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x14) /* Slave Configuration Register 4 */
25#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
26#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
27#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
28#define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16)
29#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
30#define AT91_MATRIX_FIXED_DEFMSTR (7 << 18) /* Fixed Index of Default Master */
31
32#define AT91_MATRIX_TCR (AT91_MATRIX + 0x24) /* TCM Configuration Register */
33#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */
34#define AT91_MATRIX_ITCM_0 (0 << 0)
35#define AT91_MATRIX_ITCM_16 (5 << 0)
36#define AT91_MATRIX_ITCM_32 (6 << 0)
37#define AT91_MATRIX_ITCM_64 (7 << 0)
38#define AT91_MATRIX_DTCM_SIZE (0xf << 4) /* Size of DTCM enabled memory block */
39#define AT91_MATRIX_DTCM_0 (0 << 4)
40#define AT91_MATRIX_DTCM_16 (5 << 4)
41#define AT91_MATRIX_DTCM_32 (6 << 4)
42#define AT91_MATRIX_DTCM_64 (7 << 4)
43
44#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x30) /* EBI Chip Select Assignment Register */
45#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
46#define AT91_MATRIX_CS1A_SMC (0 << 1)
47#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
48#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */
49#define AT91_MATRIX_CS3A_SMC (0 << 3)
50#define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3)
51#define AT91_MATRIX_CS4A (1 << 4) /* Chip Select 4 Assignment */
52#define AT91_MATRIX_CS4A_SMC (0 << 4)
53#define AT91_MATRIX_CS4A_SMC_CF1 (1 << 4)
54#define AT91_MATRIX_CS5A (1 << 5) /* Chip Select 5 Assignment */
55#define AT91_MATRIX_CS5A_SMC (0 << 5)
56#define AT91_MATRIX_CS5A_SMC_CF2 (1 << 5)
57#define AT91_MATRIX_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
58
59#define AT91_MATRIX_USBPUCR (AT91_MATRIX + 0x34) /* USB Pad Pull-Up Control Register */
60#define AT91_MATRIX_USBPUCR_PUON (1 << 30) /* USB Device PAD Pull-up Enable */
61
62#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h
new file mode 100644
index 000000000000..2091f1e42d43
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9263.h
@@ -0,0 +1,127 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9263.h
3 *
4 * (C) 2007 Atmel Corporation.
5 *
6 * Common definitions.
7 * Based on AT91SAM9263 datasheet revision B (Preliminary).
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#ifndef AT91SAM9263_H
16#define AT91SAM9263_H
17
18/*
19 * Peripheral identifiers/interrupts.
20 */
21#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
22#define AT91_ID_SYS 1 /* System Peripherals */
23#define AT91SAM9263_ID_PIOA 2 /* Parallel IO Controller A */
24#define AT91SAM9263_ID_PIOB 3 /* Parallel IO Controller B */
25#define AT91SAM9263_ID_PIOCDE 4 /* Parallel IO Controller C, D and E */
26#define AT91SAM9263_ID_US0 7 /* USART 0 */
27#define AT91SAM9263_ID_US1 8 /* USART 1 */
28#define AT91SAM9263_ID_US2 9 /* USART 2 */
29#define AT91SAM9263_ID_MCI0 10 /* Multimedia Card Interface 0 */
30#define AT91SAM9263_ID_MCI1 11 /* Multimedia Card Interface 1 */
31#define AT91SAM9263_ID_CAN 12 /* CAN */
32#define AT91SAM9263_ID_TWI 13 /* Two-Wire Interface */
33#define AT91SAM9263_ID_SPI0 14 /* Serial Peripheral Interface 0 */
34#define AT91SAM9263_ID_SPI1 15 /* Serial Peripheral Interface 1 */
35#define AT91SAM9263_ID_SSC0 16 /* Serial Synchronous Controller 0 */
36#define AT91SAM9263_ID_SSC1 17 /* Serial Synchronous Controller 1 */
37#define AT91SAM9263_ID_AC97C 18 /* AC97 Controller */
38#define AT91SAM9263_ID_TCB 19 /* Timer Counter 0, 1 and 2 */
39#define AT91SAM9263_ID_PWMC 20 /* Pulse Width Modulation Controller */
40#define AT91SAM9263_ID_EMAC 21 /* Ethernet */
41#define AT91SAM9263_ID_2DGE 23 /* 2D Graphic Engine */
42#define AT91SAM9263_ID_UDP 24 /* USB Device Port */
43#define AT91SAM9263_ID_ISI 25 /* Image Sensor Interface */
44#define AT91SAM9263_ID_LCDC 26 /* LCD Controller */
45#define AT91SAM9263_ID_DMA 27 /* DMA Controller */
46#define AT91SAM9263_ID_UHP 29 /* USB Host port */
47#define AT91SAM9263_ID_IRQ0 30 /* Advanced Interrupt Controller (IRQ0) */
48#define AT91SAM9263_ID_IRQ1 31 /* Advanced Interrupt Controller (IRQ1) */
49
50
51/*
52 * User Peripheral physical base addresses.
53 */
54#define AT91SAM9263_BASE_UDP 0xfff78000
55#define AT91SAM9263_BASE_TCB0 0xfff7c000
56#define AT91SAM9263_BASE_TC0 0xfff7c000
57#define AT91SAM9263_BASE_TC1 0xfff7c040
58#define AT91SAM9263_BASE_TC2 0xfff7c080
59#define AT91SAM9263_BASE_MCI0 0xfff80000
60#define AT91SAM9263_BASE_MCI1 0xfff84000
61#define AT91SAM9263_BASE_TWI 0xfff88000
62#define AT91SAM9263_BASE_US0 0xfff8c000
63#define AT91SAM9263_BASE_US1 0xfff90000
64#define AT91SAM9263_BASE_US2 0xfff94000
65#define AT91SAM9263_BASE_SSC0 0xfff98000
66#define AT91SAM9263_BASE_SSC1 0xfff9c000
67#define AT91SAM9263_BASE_AC97C 0xfffa0000
68#define AT91SAM9263_BASE_SPI0 0xfffa4000
69#define AT91SAM9263_BASE_SPI1 0xfffa8000
70#define AT91SAM9263_BASE_CAN 0xfffac000
71#define AT91SAM9263_BASE_PWMC 0xfffb8000
72#define AT91SAM9263_BASE_EMAC 0xfffbc000
73#define AT91SAM9263_BASE_ISI 0xfffc4000
74#define AT91SAM9263_BASE_2DGE 0xfffc8000
75#define AT91_BASE_SYS 0xffffe000
76
77/*
78 * System Peripherals (offset from AT91_BASE_SYS)
79 */
80#define AT91_ECC0 (0xffffe000 - AT91_BASE_SYS)
81#define AT91_SDRAMC0 (0xffffe200 - AT91_BASE_SYS)
82#define AT91_SMC0 (0xffffe400 - AT91_BASE_SYS)
83#define AT91_ECC1 (0xffffe600 - AT91_BASE_SYS)
84#define AT91_SDRAMC1 (0xffffe800 - AT91_BASE_SYS)
85#define AT91_SMC1 (0xffffea00 - AT91_BASE_SYS)
86#define AT91_MATRIX (0xffffec00 - AT91_BASE_SYS)
87#define AT91_CCFG (0xffffed10 - AT91_BASE_SYS)
88#define AT91_DBGU (0xffffee00 - AT91_BASE_SYS)
89#define AT91_AIC (0xfffff000 - AT91_BASE_SYS)
90#define AT91_PIOA (0xfffff200 - AT91_BASE_SYS)
91#define AT91_PIOB (0xfffff400 - AT91_BASE_SYS)
92#define AT91_PIOC (0xfffff600 - AT91_BASE_SYS)
93#define AT91_PIOD (0xfffff800 - AT91_BASE_SYS)
94#define AT91_PIOE (0xfffffa00 - AT91_BASE_SYS)
95#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
96#define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS)
97#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS)
98#define AT91_RTT0 (0xfffffd20 - AT91_BASE_SYS)
99#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS)
100#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
101#define AT91_RTT1 (0xfffffd50 - AT91_BASE_SYS)
102#define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS)
103
104#define AT91_USART0 AT91SAM9263_BASE_US0
105#define AT91_USART1 AT91SAM9263_BASE_US1
106#define AT91_USART2 AT91SAM9263_BASE_US2
107
108#define AT91_SMC AT91_SMC0
109
110/*
111 * Internal Memory.
112 */
113#define AT91SAM9263_SRAM0_BASE 0x00300000 /* Internal SRAM 0 base address */
114#define AT91SAM9263_SRAM0_SIZE (80 * SZ_1K) /* Internal SRAM 0 size (80Kb) */
115
116#define AT91SAM9263_ROM_BASE 0x00400000 /* Internal ROM base address */
117#define AT91SAM9263_ROM_SIZE SZ_128K /* Internal ROM size (128Kb) */
118
119#define AT91SAM9263_SRAM1_BASE 0x00500000 /* Internal SRAM 1 base address */
120#define AT91SAM9263_SRAM1_SIZE SZ_16K /* Internal SRAM 1 size (16Kb) */
121
122#define AT91SAM9263_LCDC_BASE 0x00700000 /* LCD Controller */
123#define AT91SAM9263_DMAC_BASE 0x00800000 /* DMA Controller */
124#define AT91SAM9263_UHP_BASE 0x00a00000 /* USB Host controller */
125
126
127#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9263_matrix.h
new file mode 100644
index 000000000000..9b3efd3eb2f3
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9263_matrix.h
@@ -0,0 +1,129 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9263_matrix.h
3 *
4 * Copyright (C) 2006 Atmel Corporation.
5 *
6 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
7 * Based on AT91SAM9263 datasheet revision B (Preliminary).
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#ifndef AT91SAM9263_MATRIX_H
16#define AT91SAM9263_MATRIX_H
17
18#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */
19#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */
20#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */
21#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */
22#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */
23#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */
24#define AT91_MATRIX_MCFG6 (AT91_MATRIX + 0x18) /* Master Configuration Register 6 */
25#define AT91_MATRIX_MCFG7 (AT91_MATRIX + 0x1C) /* Master Configuration Register 7 */
26#define AT91_MATRIX_MCFG8 (AT91_MATRIX + 0x20) /* Master Configuration Register 8 */
27#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
28#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
29#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
30#define AT91_MATRIX_ULBT_FOUR (2 << 0)
31#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
32#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
33
34#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */
35#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */
36#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */
37#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */
38#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */
39#define AT91_MATRIX_SCFG5 (AT91_MATRIX + 0x54) /* Slave Configuration Register 5 */
40#define AT91_MATRIX_SCFG6 (AT91_MATRIX + 0x58) /* Slave Configuration Register 6 */
41#define AT91_MATRIX_SCFG7 (AT91_MATRIX + 0x5C) /* Slave Configuration Register 7 */
42#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
43#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
44#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
45#define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16)
46#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
47#define AT91_MATRIX_FIXED_DEFMSTR (0xf << 18) /* Fixed Index of Default Master */
48#define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */
49#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
50#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
51
52#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */
53#define AT91_MATRIX_PRBS0 (AT91_MATRIX + 0x84) /* Priority Register B for Slave 0 */
54#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */
55#define AT91_MATRIX_PRBS1 (AT91_MATRIX + 0x8C) /* Priority Register B for Slave 1 */
56#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */
57#define AT91_MATRIX_PRBS2 (AT91_MATRIX + 0x94) /* Priority Register B for Slave 2 */
58#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */
59#define AT91_MATRIX_PRBS3 (AT91_MATRIX + 0x9C) /* Priority Register B for Slave 3 */
60#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */
61#define AT91_MATRIX_PRBS4 (AT91_MATRIX + 0xA4) /* Priority Register B for Slave 4 */
62#define AT91_MATRIX_PRAS5 (AT91_MATRIX + 0xA8) /* Priority Register A for Slave 5 */
63#define AT91_MATRIX_PRBS5 (AT91_MATRIX + 0xAC) /* Priority Register B for Slave 5 */
64#define AT91_MATRIX_PRAS6 (AT91_MATRIX + 0xB0) /* Priority Register A for Slave 6 */
65#define AT91_MATRIX_PRBS6 (AT91_MATRIX + 0xB4) /* Priority Register B for Slave 6 */
66#define AT91_MATRIX_PRAS7 (AT91_MATRIX + 0xB8) /* Priority Register A for Slave 7 */
67#define AT91_MATRIX_PRBS7 (AT91_MATRIX + 0xBC) /* Priority Register B for Slave 7 */
68#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
69#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
70#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
71#define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */
72#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */
73#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */
74#define AT91_MATRIX_M6PR (3 << 24) /* Master 6 Priority */
75#define AT91_MATRIX_M7PR (3 << 28) /* Master 7 Priority */
76#define AT91_MATRIX_M8PR (3 << 0) /* Master 8 Priority (in Register B) */
77
78#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */
79#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
80#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
81#define AT91_MATRIX_RCB2 (1 << 2)
82#define AT91_MATRIX_RCB3 (1 << 3)
83#define AT91_MATRIX_RCB4 (1 << 4)
84#define AT91_MATRIX_RCB5 (1 << 5)
85#define AT91_MATRIX_RCB6 (1 << 6)
86#define AT91_MATRIX_RCB7 (1 << 7)
87#define AT91_MATRIX_RCB8 (1 << 8)
88
89#define AT91_MATRIX_TCMR (AT91_MATRIX + 0x114) /* TCM Configuration Register */
90#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */
91#define AT91_MATRIX_ITCM_0 (0 << 0)
92#define AT91_MATRIX_ITCM_16 (5 << 0)
93#define AT91_MATRIX_ITCM_32 (6 << 0)
94#define AT91_MATRIX_DTCM_SIZE (0xf << 4) /* Size of DTCM enabled memory block */
95#define AT91_MATRIX_DTCM_0 (0 << 4)
96#define AT91_MATRIX_DTCM_16 (5 << 4)
97#define AT91_MATRIX_DTCM_32 (6 << 4)
98
99#define AT91_MATRIX_EBI0CSA (AT91_MATRIX + 0x120) /* EBI0 Chip Select Assignment Register */
100#define AT91_MATRIX_EBI0_CS1A (1 << 1) /* Chip Select 1 Assignment */
101#define AT91_MATRIX_EBI0_CS1A_SMC (0 << 1)
102#define AT91_MATRIX_EBI0_CS1A_SDRAMC (1 << 1)
103#define AT91_MATRIX_EBI0_CS3A (1 << 3) /* Chip Select 3 Assignment */
104#define AT91_MATRIX_EBI0_CS3A_SMC (0 << 3)
105#define AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA (1 << 3)
106#define AT91_MATRIX_EBI0_CS4A (1 << 4) /* Chip Select 4 Assignment */
107#define AT91_MATRIX_EBI0_CS4A_SMC (0 << 4)
108#define AT91_MATRIX_EBI0_CS4A_SMC_CF1 (1 << 4)
109#define AT91_MATRIX_EBI0_CS5A (1 << 5) /* Chip Select 5 Assignment */
110#define AT91_MATRIX_EBI0_CS5A_SMC (0 << 5)
111#define AT91_MATRIX_EBI0_CS5A_SMC_CF2 (1 << 5)
112#define AT91_MATRIX_EBI0_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
113#define AT91_MATRIX_EBI0_VDDIOMSEL (1 << 16) /* Memory voltage selection */
114#define AT91_MATRIX_EBI0_VDDIOMSEL_1_8V (0 << 16)
115#define AT91_MATRIX_EBI0_VDDIOMSEL_3_3V (1 << 16)
116
117#define AT91_MATRIX_EBI1CSA (AT91_MATRIX + 0x124) /* EBI1 Chip Select Assignment Register */
118#define AT91_MATRIX_EBI1_CS1A (1 << 1) /* Chip Select 1 Assignment */
119#define AT91_MATRIX_EBI1_CS1A_SMC (0 << 1)
120#define AT91_MATRIX_EBI1_CS1A_SDRAMC (1 << 1)
121#define AT91_MATRIX_EBI1_CS2A (1 << 3) /* Chip Select 3 Assignment */
122#define AT91_MATRIX_EBI1_CS2A_SMC (0 << 3)
123#define AT91_MATRIX_EBI1_CS2A_SMC_SMARTMEDIA (1 << 3)
124#define AT91_MATRIX_EBI1_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
125#define AT91_MATRIX_EBI1_VDDIOMSEL (1 << 16) /* Memory voltage selection */
126#define AT91_MATRIX_EBI1_VDDIOMSEL_1_8V (0 << 16)
127#define AT91_MATRIX_EBI1_VDDIOMSEL_3_3V (1 << 16)
128
129#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
new file mode 100644
index 000000000000..1921181c63ca
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
@@ -0,0 +1,83 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
3 *
4 * SDRAM Controllers (SDRAMC) - System peripherals registers.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91SAM9_SDRAMC_H
14#define AT91SAM9_SDRAMC_H
15
16/* SDRAM Controller (SDRAMC) registers */
17#define AT91_SDRAMC_MR (AT91_SDRAMC + 0x00) /* SDRAM Controller Mode Register */
18#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
19#define AT91_SDRAMC_MODE_NORMAL 0
20#define AT91_SDRAMC_MODE_NOP 1
21#define AT91_SDRAMC_MODE_PRECHARGE 2
22#define AT91_SDRAMC_MODE_LMR 3
23#define AT91_SDRAMC_MODE_REFRESH 4
24#define AT91_SDRAMC_MODE_EXT_LMR 5
25#define AT91_SDRAMC_MODE_DEEP 6
26
27#define AT91_SDRAMC_TR (AT91_SDRAMC + 0x04) /* SDRAM Controller Refresh Timer Register */
28#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Counter */
29
30#define AT91_SDRAMC_CR (AT91_SDRAMC + 0x08) /* SDRAM Controller Configuration Register */
31#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
32#define AT91_SDRAMC_NC_8 (0 << 0)
33#define AT91_SDRAMC_NC_9 (1 << 0)
34#define AT91_SDRAMC_NC_10 (2 << 0)
35#define AT91_SDRAMC_NC_11 (3 << 0)
36#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
37#define AT91_SDRAMC_NR_11 (0 << 2)
38#define AT91_SDRAMC_NR_12 (1 << 2)
39#define AT91_SDRAMC_NR_13 (2 << 2)
40#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
41#define AT91_SDRAMC_NB_2 (0 << 4)
42#define AT91_SDRAMC_NB_4 (1 << 4)
43#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
44#define AT91_SDRAMC_CAS_1 (1 << 5)
45#define AT91_SDRAMC_CAS_2 (2 << 5)
46#define AT91_SDRAMC_CAS_3 (3 << 5)
47#define AT91_SDRAMC_DBW (1 << 7) /* Data Bus Width */
48#define AT91_SDRAMC_DBW_32 (0 << 7)
49#define AT91_SDRAMC_DBW_16 (1 << 7)
50#define AT91_SDRAMC_TWR (0xf << 8) /* Write Recovery Delay */
51#define AT91_SDRAMC_TRC (0xf << 12) /* Row Cycle Delay */
52#define AT91_SDRAMC_TRP (0xf << 16) /* Row Precharge Delay */
53#define AT91_SDRAMC_TRCD (0xf << 20) /* Row to Column Delay */
54#define AT91_SDRAMC_TRAS (0xf << 24) /* Active to Precharge Delay */
55#define AT91_SDRAMC_TXSR (0xf << 28) /* Exit Self Refresh to Active Delay */
56
57#define AT91_SDRAMC_LPR (AT91_SDRAMC + 0x10) /* SDRAM Controller Low Power Register */
58#define AT91_SDRAMC_LPCB (3 << 0) /* Low-power Configurations */
59#define AT91_SDRAMC_LPCB_DISABLE 0
60#define AT91_SDRAMC_LPCB_SELF_REFRESH 1
61#define AT91_SDRAMC_LPCB_POWER_DOWN 2
62#define AT91_SDRAMC_LPCB_DEEP_POWER_DOWN 3
63#define AT91_SDRAMC_PASR (7 << 4) /* Partial Array Self Refresh */
64#define AT91_SDRAMC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
65#define AT91_SDRAMC_DS (3 << 10) /* Drive Strength */
66#define AT91_SDRAMC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
67#define AT91_SDRAMC_TIMEOUT_0_CLK_CYCLES (0 << 12)
68#define AT91_SDRAMC_TIMEOUT_64_CLK_CYCLES (1 << 12)
69#define AT91_SDRAMC_TIMEOUT_128_CLK_CYCLES (2 << 12)
70
71#define AT91_SDRAMC_IER (AT91_SDRAMC + 0x14) /* SDRAM Controller Interrupt Enable Register */
72#define AT91_SDRAMC_IDR (AT91_SDRAMC + 0x18) /* SDRAM Controller Interrupt Disable Register */
73#define AT91_SDRAMC_IMR (AT91_SDRAMC + 0x1C) /* SDRAM Controller Interrupt Mask Register */
74#define AT91_SDRAMC_ISR (AT91_SDRAMC + 0x20) /* SDRAM Controller Interrupt Status Register */
75#define AT91_SDRAMC_RES (1 << 0) /* Refresh Error Status */
76
77#define AT91_SDRAMC_MDR (AT91_SDRAMC + 0x24) /* SDRAM Memory Device Register */
78#define AT91_SDRAMC_MD (3 << 0) /* Memory Device Type */
79#define AT91_SDRAMC_MD_SDRAM 0
80#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1
81
82
83#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_smc.h b/arch/arm/mach-at91/include/mach/at91sam9_smc.h
new file mode 100644
index 000000000000..ec6ad1338b5a
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9_smc.h
@@ -0,0 +1,73 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9_smc.h
3 *
4 * Static Memory Controllers (SMC) - System peripherals registers.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91SAM9_SMC_H
14#define AT91SAM9_SMC_H
15
16#define AT91_SMC_SETUP(n) (AT91_SMC + 0x00 + ((n)*0x10)) /* Setup Register for CS n */
17#define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */
18#define AT91_SMC_NWESETUP_(x) ((x) << 0)
19#define AT91_SMC_NCS_WRSETUP (0x3f << 8) /* NCS Setup Length in Write Access */
20#define AT91_SMC_NCS_WRSETUP_(x) ((x) << 8)
21#define AT91_SMC_NRDSETUP (0x3f << 16) /* NRD Setup Length */
22#define AT91_SMC_NRDSETUP_(x) ((x) << 16)
23#define AT91_SMC_NCS_RDSETUP (0x3f << 24) /* NCS Setup Length in Read Access */
24#define AT91_SMC_NCS_RDSETUP_(x) ((x) << 24)
25
26#define AT91_SMC_PULSE(n) (AT91_SMC + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */
27#define AT91_SMC_NWEPULSE (0x7f << 0) /* NWE Pulse Length */
28#define AT91_SMC_NWEPULSE_(x) ((x) << 0)
29#define AT91_SMC_NCS_WRPULSE (0x7f << 8) /* NCS Pulse Length in Write Access */
30#define AT91_SMC_NCS_WRPULSE_(x)((x) << 8)
31#define AT91_SMC_NRDPULSE (0x7f << 16) /* NRD Pulse Length */
32#define AT91_SMC_NRDPULSE_(x) ((x) << 16)
33#define AT91_SMC_NCS_RDPULSE (0x7f << 24) /* NCS Pulse Length in Read Access */
34#define AT91_SMC_NCS_RDPULSE_(x)((x) << 24)
35
36#define AT91_SMC_CYCLE(n) (AT91_SMC + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */
37#define AT91_SMC_NWECYCLE (0x1ff << 0 ) /* Total Write Cycle Length */
38#define AT91_SMC_NWECYCLE_(x) ((x) << 0)
39#define AT91_SMC_NRDCYCLE (0x1ff << 16) /* Total Read Cycle Length */
40#define AT91_SMC_NRDCYCLE_(x) ((x) << 16)
41
42#define AT91_SMC_MODE(n) (AT91_SMC + 0x0c + ((n)*0x10)) /* Mode Register for CS n */
43#define AT91_SMC_READMODE (1 << 0) /* Read Mode */
44#define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */
45#define AT91_SMC_EXNWMODE (3 << 4) /* NWAIT Mode */
46#define AT91_SMC_EXNWMODE_DISABLE (0 << 4)
47#define AT91_SMC_EXNWMODE_FROZEN (2 << 4)
48#define AT91_SMC_EXNWMODE_READY (3 << 4)
49#define AT91_SMC_BAT (1 << 8) /* Byte Access Type */
50#define AT91_SMC_BAT_SELECT (0 << 8)
51#define AT91_SMC_BAT_WRITE (1 << 8)
52#define AT91_SMC_DBW (3 << 12) /* Data Bus Width */
53#define AT91_SMC_DBW_8 (0 << 12)
54#define AT91_SMC_DBW_16 (1 << 12)
55#define AT91_SMC_DBW_32 (2 << 12)
56#define AT91_SMC_TDF (0xf << 16) /* Data Float Time. */
57#define AT91_SMC_TDF_(x) ((x) << 16)
58#define AT91_SMC_TDFMODE (1 << 20) /* TDF Optimization - Enabled */
59#define AT91_SMC_PMEN (1 << 24) /* Page Mode Enabled */
60#define AT91_SMC_PS (3 << 28) /* Page Size */
61#define AT91_SMC_PS_4 (0 << 28)
62#define AT91_SMC_PS_8 (1 << 28)
63#define AT91_SMC_PS_16 (2 << 28)
64#define AT91_SMC_PS_32 (3 << 28)
65
66#if defined(AT91_SMC1) /* The AT91SAM9263 has 2 Static Memory contollers */
67#define AT91_SMC1_SETUP(n) (AT91_SMC1 + 0x00 + ((n)*0x10)) /* Setup Register for CS n */
68#define AT91_SMC1_PULSE(n) (AT91_SMC1 + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */
69#define AT91_SMC1_CYCLE(n) (AT91_SMC1 + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */
70#define AT91_SMC1_MODE(n) (AT91_SMC1 + 0x0c + ((n)*0x10)) /* Mode Register for CS n */
71#endif
72
73#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h
new file mode 100644
index 000000000000..fc2de6c09c86
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h
@@ -0,0 +1,115 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9260.h
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 *
6 * Common definitions.
7 * Based on AT91SAM9RL datasheet revision A. (Preliminary)
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#ifndef AT91SAM9RL_H
15#define AT91SAM9RL_H
16
17/*
18 * Peripheral identifiers/interrupts.
19 */
20#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
21#define AT91_ID_SYS 1 /* System Controller */
22#define AT91SAM9RL_ID_PIOA 2 /* Parallel IO Controller A */
23#define AT91SAM9RL_ID_PIOB 3 /* Parallel IO Controller B */
24#define AT91SAM9RL_ID_PIOC 4 /* Parallel IO Controller C */
25#define AT91SAM9RL_ID_PIOD 5 /* Parallel IO Controller D */
26#define AT91SAM9RL_ID_US0 6 /* USART 0 */
27#define AT91SAM9RL_ID_US1 7 /* USART 1 */
28#define AT91SAM9RL_ID_US2 8 /* USART 2 */
29#define AT91SAM9RL_ID_US3 9 /* USART 3 */
30#define AT91SAM9RL_ID_MCI 10 /* Multimedia Card Interface */
31#define AT91SAM9RL_ID_TWI0 11 /* TWI 0 */
32#define AT91SAM9RL_ID_TWI1 12 /* TWI 1 */
33#define AT91SAM9RL_ID_SPI 13 /* Serial Peripheral Interface */
34#define AT91SAM9RL_ID_SSC0 14 /* Serial Synchronous Controller 0 */
35#define AT91SAM9RL_ID_SSC1 15 /* Serial Synchronous Controller 1 */
36#define AT91SAM9RL_ID_TC0 16 /* Timer Counter 0 */
37#define AT91SAM9RL_ID_TC1 17 /* Timer Counter 1 */
38#define AT91SAM9RL_ID_TC2 18 /* Timer Counter 2 */
39#define AT91SAM9RL_ID_PWMC 19 /* Pulse Width Modulation Controller */
40#define AT91SAM9RL_ID_TSC 20 /* Touch Screen Controller */
41#define AT91SAM9RL_ID_DMA 21 /* DMA Controller */
42#define AT91SAM9RL_ID_UDPHS 22 /* USB Device HS */
43#define AT91SAM9RL_ID_LCDC 23 /* LCD Controller */
44#define AT91SAM9RL_ID_AC97C 24 /* AC97 Controller */
45#define AT91SAM9RL_ID_IRQ0 31 /* Advanced Interrupt Controller (IRQ0) */
46
47
48/*
49 * User Peripheral physical base addresses.
50 */
51#define AT91SAM9RL_BASE_TCB0 0xfffa0000
52#define AT91SAM9RL_BASE_TC0 0xfffa0000
53#define AT91SAM9RL_BASE_TC1 0xfffa0040
54#define AT91SAM9RL_BASE_TC2 0xfffa0080
55#define AT91SAM9RL_BASE_MCI 0xfffa4000
56#define AT91SAM9RL_BASE_TWI0 0xfffa8000
57#define AT91SAM9RL_BASE_TWI1 0xfffac000
58#define AT91SAM9RL_BASE_US0 0xfffb0000
59#define AT91SAM9RL_BASE_US1 0xfffb4000
60#define AT91SAM9RL_BASE_US2 0xfffb8000
61#define AT91SAM9RL_BASE_US3 0xfffbc000
62#define AT91SAM9RL_BASE_SSC0 0xfffc0000
63#define AT91SAM9RL_BASE_SSC1 0xfffc4000
64#define AT91SAM9RL_BASE_PWMC 0xfffc8000
65#define AT91SAM9RL_BASE_SPI 0xfffcc000
66#define AT91SAM9RL_BASE_TSC 0xfffd0000
67#define AT91SAM9RL_BASE_UDPHS 0xfffd4000
68#define AT91SAM9RL_BASE_AC97C 0xfffd8000
69#define AT91_BASE_SYS 0xffffc000
70
71
72/*
73 * System Peripherals (offset from AT91_BASE_SYS)
74 */
75#define AT91_DMA (0xffffe600 - AT91_BASE_SYS)
76#define AT91_ECC (0xffffe800 - AT91_BASE_SYS)
77#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS)
78#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
79#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
80#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS)
81#define AT91_AIC (0xfffff000 - AT91_BASE_SYS)
82#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS)
83#define AT91_PIOA (0xfffff400 - AT91_BASE_SYS)
84#define AT91_PIOB (0xfffff600 - AT91_BASE_SYS)
85#define AT91_PIOC (0xfffff800 - AT91_BASE_SYS)
86#define AT91_PIOD (0xfffffa00 - AT91_BASE_SYS)
87#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
88#define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS)
89#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS)
90#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS)
91#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS)
92#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
93#define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS)
94#define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS)
95#define AT91_RTC (0xfffffe00 - AT91_BASE_SYS)
96
97#define AT91_USART0 AT91SAM9RL_BASE_US0
98#define AT91_USART1 AT91SAM9RL_BASE_US1
99#define AT91_USART2 AT91SAM9RL_BASE_US2
100#define AT91_USART3 AT91SAM9RL_BASE_US3
101
102
103/*
104 * Internal Memory.
105 */
106#define AT91SAM9RL_SRAM_BASE 0x00300000 /* Internal SRAM base address */
107#define AT91SAM9RL_SRAM_SIZE SZ_16K /* Internal SRAM size (16Kb) */
108
109#define AT91SAM9RL_ROM_BASE 0x00400000 /* Internal ROM base address */
110#define AT91SAM9RL_ROM_SIZE (2 * SZ_16K) /* Internal ROM size (32Kb) */
111
112#define AT91SAM9RL_LCDC_BASE 0x00500000 /* LCD Controller */
113#define AT91SAM9RL_UDPHS_FIFO 0x00600000 /* USB Device HS controller */
114
115#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h
new file mode 100644
index 000000000000..5f9149071fe5
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h
@@ -0,0 +1,96 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 *
6 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
7 * Based on AT91SAM9RL datasheet revision A. (Preliminary)
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#ifndef AT91SAM9RL_MATRIX_H
15#define AT91SAM9RL_MATRIX_H
16
17#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */
18#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */
19#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */
20#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */
21#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */
22#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */
23#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
24#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
25#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
26#define AT91_MATRIX_ULBT_FOUR (2 << 0)
27#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
28#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
29
30#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */
31#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */
32#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */
33#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */
34#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */
35#define AT91_MATRIX_SCFG5 (AT91_MATRIX + 0x54) /* Slave Configuration Register 5 */
36#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
37#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
38#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
39#define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16)
40#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
41#define AT91_MATRIX_FIXED_DEFMSTR (0xf << 18) /* Fixed Index of Default Master */
42#define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */
43#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
44#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
45
46#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */
47#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */
48#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */
49#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */
50#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */
51#define AT91_MATRIX_PRAS5 (AT91_MATRIX + 0xA8) /* Priority Register A for Slave 5 */
52#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
53#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
54#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
55#define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */
56#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */
57#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */
58
59#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */
60#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
61#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
62#define AT91_MATRIX_RCB2 (1 << 2)
63#define AT91_MATRIX_RCB3 (1 << 3)
64#define AT91_MATRIX_RCB4 (1 << 4)
65#define AT91_MATRIX_RCB5 (1 << 5)
66
67#define AT91_MATRIX_TCMR (AT91_MATRIX + 0x114) /* TCM Configuration Register */
68#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */
69#define AT91_MATRIX_ITCM_0 (0 << 0)
70#define AT91_MATRIX_ITCM_16 (5 << 0)
71#define AT91_MATRIX_ITCM_32 (6 << 0)
72#define AT91_MATRIX_DTCM_SIZE (0xf << 4) /* Size of DTCM enabled memory block */
73#define AT91_MATRIX_DTCM_0 (0 << 4)
74#define AT91_MATRIX_DTCM_16 (5 << 4)
75#define AT91_MATRIX_DTCM_32 (6 << 4)
76
77#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x120) /* EBI0 Chip Select Assignment Register */
78#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
79#define AT91_MATRIX_CS1A_SMC (0 << 1)
80#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
81#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */
82#define AT91_MATRIX_CS3A_SMC (0 << 3)
83#define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3)
84#define AT91_MATRIX_CS4A (1 << 4) /* Chip Select 4 Assignment */
85#define AT91_MATRIX_CS4A_SMC (0 << 4)
86#define AT91_MATRIX_CS4A_SMC_CF1 (1 << 4)
87#define AT91_MATRIX_CS5A (1 << 5) /* Chip Select 5 Assignment */
88#define AT91_MATRIX_CS5A_SMC (0 << 5)
89#define AT91_MATRIX_CS5A_SMC_CF2 (1 << 5)
90#define AT91_MATRIX_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
91#define AT91_MATRIX_VDDIOMSEL (1 << 16) /* Memory voltage selection */
92#define AT91_MATRIX_VDDIOMSEL_1_8V (0 << 16)
93#define AT91_MATRIX_VDDIOMSEL_3_3V (1 << 16)
94
95
96#endif
diff --git a/arch/arm/mach-at91/include/mach/at91x40.h b/arch/arm/mach-at91/include/mach/at91x40.h
new file mode 100644
index 000000000000..d34cdb8abdca
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91x40.h
@@ -0,0 +1,55 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91x40.h
3 *
4 * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.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
12#ifndef AT91X40_H
13#define AT91X40_H
14
15/*
16 * IRQ list.
17 */
18#define AT91_ID_FIQ 0 /* FIQ */
19#define AT91_ID_SYS 1 /* System Peripheral */
20#define AT91X40_ID_USART0 2 /* USART port 0 */
21#define AT91X40_ID_USART1 3 /* USART port 1 */
22#define AT91X40_ID_TC0 4 /* Timer/Counter 0 */
23#define AT91X40_ID_TC1 5 /* Timer/Counter 1*/
24#define AT91X40_ID_TC2 6 /* Timer/Counter 2*/
25#define AT91X40_ID_WD 7 /* Watchdog? */
26#define AT91X40_ID_PIOA 8 /* Parallel IO Controller A */
27
28#define AT91X40_ID_IRQ0 16 /* External IRQ 0 */
29#define AT91X40_ID_IRQ1 17 /* External IRQ 1 */
30#define AT91X40_ID_IRQ2 18 /* External IRQ 2 */
31
32/*
33 * System Peripherals (offset from AT91_BASE_SYS)
34 */
35#define AT91_BASE_SYS 0xffc00000
36
37#define AT91_EBI (0xffe00000 - AT91_BASE_SYS) /* External Bus Interface */
38#define AT91_SF (0xfff00000 - AT91_BASE_SYS) /* Special Function */
39#define AT91_USART1 (0xfffcc000 - AT91_BASE_SYS) /* USART 1 */
40#define AT91_USART0 (0xfffd0000 - AT91_BASE_SYS) /* USART 0 */
41#define AT91_TC (0xfffe0000 - AT91_BASE_SYS) /* Timer Counter */
42#define AT91_PIOA (0xffff0000 - AT91_BASE_SYS) /* PIO Controller A */
43#define AT91_PS (0xffff4000 - AT91_BASE_SYS) /* Power Save */
44#define AT91_WD (0xffff8000 - AT91_BASE_SYS) /* Watchdog Timer */
45#define AT91_AIC (0xfffff000 - AT91_BASE_SYS) /* Advanced Interrupt Controller */
46
47/*
48 * The AT91x40 series doesn't have a debug unit like the other AT91 parts.
49 * But it does have a chip identify register and extension ID, so define at
50 * least these here.
51 */
52#define AT91_DBGU_CIDR (AT91_SF + 0) /* CIDR in PS segment */
53#define AT91_DBGU_EXID (AT91_SF + 4) /* EXID in PS segment */
54
55#endif /* AT91X40_H */
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
new file mode 100644
index 000000000000..acd60f2a0724
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -0,0 +1,172 @@
1/*
2 * arch/arm/mach-at91/include/mach/board.h
3 *
4 * Copyright (C) 2005 HP Labs
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
21/*
22 * These are data structures found in platform_device.dev.platform_data,
23 * and describing board-specific data needed by drivers. For example,
24 * which pin is used for a given GPIO role.
25 *
26 * In 2.6, drivers should strongly avoid board-specific knowledge so
27 * that supporting new boards normally won't require driver patches.
28 * Most board-specific knowledge should be in arch/.../board-*.c files.
29 */
30
31#ifndef __ASM_ARCH_BOARD_H
32#define __ASM_ARCH_BOARD_H
33
34#include <linux/mtd/partitions.h>
35#include <linux/device.h>
36#include <linux/i2c.h>
37#include <linux/leds.h>
38#include <linux/spi/spi.h>
39#include <linux/usb/atmel_usba_udc.h>
40
41 /* USB Device */
42struct at91_udc_data {
43 u8 vbus_pin; /* high == host powering us */
44 u8 pullup_pin; /* active == D+ pulled up */
45 u8 pullup_active_low; /* true == pullup_pin is active low */
46};
47extern void __init at91_add_device_udc(struct at91_udc_data *data);
48
49 /* USB High Speed Device */
50extern void __init at91_add_device_usba(struct usba_platform_data *data);
51
52 /* Compact Flash */
53struct at91_cf_data {
54 u8 irq_pin; /* I/O IRQ */
55 u8 det_pin; /* Card detect */
56 u8 vcc_pin; /* power switching */
57 u8 rst_pin; /* card reset */
58 u8 chipselect; /* EBI Chip Select number */
59};
60extern void __init at91_add_device_cf(struct at91_cf_data *data);
61
62 /* MMC / SD */
63struct at91_mmc_data {
64 u8 det_pin; /* card detect IRQ */
65 unsigned slot_b:1; /* uses Slot B */
66 unsigned wire4:1; /* (SD) supports DAT0..DAT3 */
67 u8 wp_pin; /* (SD) writeprotect detect */
68 u8 vcc_pin; /* power switching (high == on) */
69};
70extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data);
71
72 /* Ethernet (EMAC & MACB) */
73struct at91_eth_data {
74 u32 phy_mask;
75 u8 phy_irq_pin; /* PHY IRQ */
76 u8 is_rmii; /* using RMII interface? */
77};
78extern void __init at91_add_device_eth(struct at91_eth_data *data);
79
80#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9G20) || defined(CONFIG_ARCH_AT91CAP9)
81#define eth_platform_data at91_eth_data
82#endif
83
84 /* USB Host */
85struct at91_usbh_data {
86 u8 ports; /* number of ports on root hub */
87 u8 vbus_pin[]; /* port power-control pin */
88};
89extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
90
91 /* NAND / SmartMedia */
92struct atmel_nand_data {
93 u8 enable_pin; /* chip enable */
94 u8 det_pin; /* card detect */
95 u8 rdy_pin; /* ready/busy */
96 u8 ale; /* address line number connected to ALE */
97 u8 cle; /* address line number connected to CLE */
98 u8 bus_width_16; /* buswidth is 16 bit */
99 struct mtd_partition* (*partition_info)(int, int*);
100};
101extern void __init at91_add_device_nand(struct atmel_nand_data *data);
102
103 /* I2C*/
104extern void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices);
105
106 /* SPI */
107extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices);
108
109 /* Serial */
110#define ATMEL_UART_CTS 0x01
111#define ATMEL_UART_RTS 0x02
112#define ATMEL_UART_DSR 0x04
113#define ATMEL_UART_DTR 0x08
114#define ATMEL_UART_DCD 0x10
115#define ATMEL_UART_RI 0x20
116
117extern void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins);
118extern void __init at91_set_serial_console(unsigned portnr);
119
120struct at91_uart_config {
121 unsigned short console_tty; /* tty number of serial console */
122 unsigned short nr_tty; /* number of serial tty's */
123 short tty_map[]; /* map UART to tty number */
124};
125extern struct platform_device *atmel_default_console_device;
126extern void __init __deprecated at91_init_serial(struct at91_uart_config *config);
127
128struct atmel_uart_data {
129 short use_dma_tx; /* use transmit DMA? */
130 short use_dma_rx; /* use receive DMA? */
131 void __iomem *regs; /* virtual base address, if any */
132};
133extern void __init at91_add_device_serial(void);
134
135/*
136 * SSC -- accessed through ssc_request(id). Drivers don't bind to SSC
137 * platform devices. Their SSC ID is part of their configuration data,
138 * along with information about which SSC signals they should use.
139 */
140#define ATMEL_SSC_TK 0x01
141#define ATMEL_SSC_TF 0x02
142#define ATMEL_SSC_TD 0x04
143#define ATMEL_SSC_TX (ATMEL_SSC_TK | ATMEL_SSC_TF | ATMEL_SSC_TD)
144
145#define ATMEL_SSC_RK 0x10
146#define ATMEL_SSC_RF 0x20
147#define ATMEL_SSC_RD 0x40
148#define ATMEL_SSC_RX (ATMEL_SSC_RK | ATMEL_SSC_RF | ATMEL_SSC_RD)
149
150extern void __init at91_add_device_ssc(unsigned id, unsigned pins);
151
152 /* LCD Controller */
153struct atmel_lcdfb_info;
154extern void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data);
155
156 /* AC97 */
157struct atmel_ac97_data {
158 u8 reset_pin; /* reset */
159};
160extern void __init at91_add_device_ac97(struct atmel_ac97_data *data);
161
162 /* ISI */
163extern void __init at91_add_device_isi(void);
164
165 /* LEDs */
166extern void __init at91_init_leds(u8 cpu_led, u8 timer_led);
167extern void __init at91_gpio_leds(struct gpio_led *leds, int nr);
168
169/* FIXME: this needs a better location, but gets stuff building again */
170extern int at91_suspend_entering_slow_clock(void);
171
172#endif
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
new file mode 100644
index 000000000000..dbfd9f73f80b
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -0,0 +1,103 @@
1/*
2 * arch/arm/mach-at91/include/mach/cpu.h
3 *
4 * Copyright (C) 2006 SAN People
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 */
12
13#ifndef __ASM_ARCH_CPU_H
14#define __ASM_ARCH_CPU_H
15
16#include <mach/hardware.h>
17#include <mach/at91_dbgu.h>
18
19
20#define ARCH_ID_AT91RM9200 0x09290780
21#define ARCH_ID_AT91SAM9260 0x019803a0
22#define ARCH_ID_AT91SAM9261 0x019703a0
23#define ARCH_ID_AT91SAM9263 0x019607a0
24#define ARCH_ID_AT91SAM9G20 0x019905a0
25#define ARCH_ID_AT91SAM9RL64 0x019b03a0
26#define ARCH_ID_AT91CAP9 0x039A03A0
27
28#define ARCH_ID_AT91SAM9XE128 0x329973a0
29#define ARCH_ID_AT91SAM9XE256 0x329a93a0
30#define ARCH_ID_AT91SAM9XE512 0x329aa3a0
31
32#define ARCH_ID_AT91M40800 0x14080044
33#define ARCH_ID_AT91R40807 0x44080746
34#define ARCH_ID_AT91M40807 0x14080745
35#define ARCH_ID_AT91R40008 0x44000840
36
37static inline unsigned long at91_cpu_identify(void)
38{
39 return (at91_sys_read(AT91_DBGU_CIDR) & ~AT91_CIDR_VERSION);
40}
41
42
43#define ARCH_FAMILY_AT91X92 0x09200000
44#define ARCH_FAMILY_AT91SAM9 0x01900000
45#define ARCH_FAMILY_AT91SAM9XE 0x02900000
46
47static inline unsigned long at91_arch_identify(void)
48{
49 return (at91_sys_read(AT91_DBGU_CIDR) & AT91_CIDR_ARCH);
50}
51
52
53#ifdef CONFIG_ARCH_AT91RM9200
54#define cpu_is_at91rm9200() (at91_cpu_identify() == ARCH_ID_AT91RM9200)
55#else
56#define cpu_is_at91rm9200() (0)
57#endif
58
59#ifdef CONFIG_ARCH_AT91SAM9260
60#define cpu_is_at91sam9xe() (at91_arch_identify() == ARCH_FAMILY_AT91SAM9XE)
61#define cpu_is_at91sam9260() ((at91_cpu_identify() == ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe())
62#else
63#define cpu_is_at91sam9xe() (0)
64#define cpu_is_at91sam9260() (0)
65#endif
66
67#ifdef CONFIG_ARCH_AT91SAM9G20
68#define cpu_is_at91sam9g20() (at91_cpu_identify() == ARCH_ID_AT91SAM9G20)
69#else
70#define cpu_is_at91sam9g20() (0)
71#endif
72
73#ifdef CONFIG_ARCH_AT91SAM9261
74#define cpu_is_at91sam9261() (at91_cpu_identify() == ARCH_ID_AT91SAM9261)
75#else
76#define cpu_is_at91sam9261() (0)
77#endif
78
79#ifdef CONFIG_ARCH_AT91SAM9263
80#define cpu_is_at91sam9263() (at91_cpu_identify() == ARCH_ID_AT91SAM9263)
81#else
82#define cpu_is_at91sam9263() (0)
83#endif
84
85#ifdef CONFIG_ARCH_AT91SAM9RL
86#define cpu_is_at91sam9rl() (at91_cpu_identify() == ARCH_ID_AT91SAM9RL64)
87#else
88#define cpu_is_at91sam9rl() (0)
89#endif
90
91#ifdef CONFIG_ARCH_AT91CAP9
92#define cpu_is_at91cap9() (at91_cpu_identify() == ARCH_ID_AT91CAP9)
93#else
94#define cpu_is_at91cap9() (0)
95#endif
96
97/*
98 * Since this is ARM, we will never run on any AVR32 CPU. But these
99 * definitions may reduce clutter in common drivers.
100 */
101#define cpu_is_at32ap7000() (0)
102
103#endif
diff --git a/arch/arm/mach-at91/include/mach/debug-macro.S b/arch/arm/mach-at91/include/mach/debug-macro.S
new file mode 100644
index 000000000000..29052ba66ada
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/debug-macro.S
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-at91/include/mach/debug-macro.S
3 *
4 * Copyright (C) 2003-2005 SAN People
5 *
6 * Debugging macro include header
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#include <mach/hardware.h>
15#include <mach/at91_dbgu.h>
16
17 .macro addruart,rx
18 mrc p15, 0, \rx, c1, c0
19 tst \rx, #1 @ MMU enabled?
20 ldreq \rx, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address)
21 ldrne \rx, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address)
22 .endm
23
24 .macro senduart,rd,rx
25 strb \rd, [\rx, #(AT91_DBGU_THR - AT91_DBGU)] @ Write to Transmitter Holding Register
26 .endm
27
28 .macro waituart,rd,rx
291001: ldr \rd, [\rx, #(AT91_DBGU_SR - AT91_DBGU)] @ Read Status Register
30 tst \rd, #AT91_DBGU_TXRDY @ DBGU_TXRDY = 1 when ready to transmit
31 beq 1001b
32 .endm
33
34 .macro busyuart,rd,rx
351001: ldr \rd, [\rx, #(AT91_DBGU_SR - AT91_DBGU)] @ Read Status Register
36 tst \rd, #AT91_DBGU_TXEMPTY @ DBGU_TXEMPTY = 1 when transmission complete
37 beq 1001b
38 .endm
39
diff --git a/arch/arm/mach-at91/include/mach/dma.h b/arch/arm/mach-at91/include/mach/dma.h
new file mode 100644
index 000000000000..e4f90c177616
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/dma.h
@@ -0,0 +1,19 @@
1/*
2 * arch/arm/mach-at91/include/mach/dma.h
3 *
4 * Copyright (C) 2003 SAN People
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 */
diff --git a/arch/arm/mach-at91/include/mach/entry-macro.S b/arch/arm/mach-at91/include/mach/entry-macro.S
new file mode 100644
index 000000000000..7ab68f972227
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/entry-macro.S
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-at91/include/mach/entry-macro.S
3 *
4 * Copyright (C) 2003-2005 SAN People
5 *
6 * Low-level IRQ helper macros for AT91RM9200 platforms
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <mach/hardware.h>
14#include <mach/at91_aic.h>
15
16 .macro disable_fiq
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =(AT91_VA_BASE_SYS + AT91_AIC) @ base virtual address of AIC peripheral
21 .endm
22
23 .macro arch_ret_to_user, tmp1, tmp2
24 .endm
25
26 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
27 ldr \irqnr, [\base, #(AT91_AIC_IVR - AT91_AIC)] @ read IRQ vector register: de-asserts nIRQ to processor (and clears interrupt)
28 ldr \irqstat, [\base, #(AT91_AIC_ISR - AT91_AIC)] @ read interrupt source number
29 teq \irqstat, #0 @ ISR is 0 when no current interrupt, or spurious interrupt
30 streq \tmp, [\base, #(AT91_AIC_EOICR - AT91_AIC)] @ not going to be handled further, then ACK it now.
31 .endm
32
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
new file mode 100644
index 000000000000..76d76e2fa69e
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -0,0 +1,252 @@
1/*
2 * arch/arm/mach-at91/include/mach/gpio.h
3 *
4 * Copyright (C) 2005 HP Labs
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 */
12
13#ifndef __ASM_ARCH_AT91RM9200_GPIO_H
14#define __ASM_ARCH_AT91RM9200_GPIO_H
15
16#include <asm/irq.h>
17
18#define PIN_BASE NR_AIC_IRQS
19
20#define MAX_GPIO_BANKS 5
21
22/* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */
23
24#define AT91_PIN_PA0 (PIN_BASE + 0x00 + 0)
25#define AT91_PIN_PA1 (PIN_BASE + 0x00 + 1)
26#define AT91_PIN_PA2 (PIN_BASE + 0x00 + 2)
27#define AT91_PIN_PA3 (PIN_BASE + 0x00 + 3)
28#define AT91_PIN_PA4 (PIN_BASE + 0x00 + 4)
29#define AT91_PIN_PA5 (PIN_BASE + 0x00 + 5)
30#define AT91_PIN_PA6 (PIN_BASE + 0x00 + 6)
31#define AT91_PIN_PA7 (PIN_BASE + 0x00 + 7)
32#define AT91_PIN_PA8 (PIN_BASE + 0x00 + 8)
33#define AT91_PIN_PA9 (PIN_BASE + 0x00 + 9)
34#define AT91_PIN_PA10 (PIN_BASE + 0x00 + 10)
35#define AT91_PIN_PA11 (PIN_BASE + 0x00 + 11)
36#define AT91_PIN_PA12 (PIN_BASE + 0x00 + 12)
37#define AT91_PIN_PA13 (PIN_BASE + 0x00 + 13)
38#define AT91_PIN_PA14 (PIN_BASE + 0x00 + 14)
39#define AT91_PIN_PA15 (PIN_BASE + 0x00 + 15)
40#define AT91_PIN_PA16 (PIN_BASE + 0x00 + 16)
41#define AT91_PIN_PA17 (PIN_BASE + 0x00 + 17)
42#define AT91_PIN_PA18 (PIN_BASE + 0x00 + 18)
43#define AT91_PIN_PA19 (PIN_BASE + 0x00 + 19)
44#define AT91_PIN_PA20 (PIN_BASE + 0x00 + 20)
45#define AT91_PIN_PA21 (PIN_BASE + 0x00 + 21)
46#define AT91_PIN_PA22 (PIN_BASE + 0x00 + 22)
47#define AT91_PIN_PA23 (PIN_BASE + 0x00 + 23)
48#define AT91_PIN_PA24 (PIN_BASE + 0x00 + 24)
49#define AT91_PIN_PA25 (PIN_BASE + 0x00 + 25)
50#define AT91_PIN_PA26 (PIN_BASE + 0x00 + 26)
51#define AT91_PIN_PA27 (PIN_BASE + 0x00 + 27)
52#define AT91_PIN_PA28 (PIN_BASE + 0x00 + 28)
53#define AT91_PIN_PA29 (PIN_BASE + 0x00 + 29)
54#define AT91_PIN_PA30 (PIN_BASE + 0x00 + 30)
55#define AT91_PIN_PA31 (PIN_BASE + 0x00 + 31)
56
57#define AT91_PIN_PB0 (PIN_BASE + 0x20 + 0)
58#define AT91_PIN_PB1 (PIN_BASE + 0x20 + 1)
59#define AT91_PIN_PB2 (PIN_BASE + 0x20 + 2)
60#define AT91_PIN_PB3 (PIN_BASE + 0x20 + 3)
61#define AT91_PIN_PB4 (PIN_BASE + 0x20 + 4)
62#define AT91_PIN_PB5 (PIN_BASE + 0x20 + 5)
63#define AT91_PIN_PB6 (PIN_BASE + 0x20 + 6)
64#define AT91_PIN_PB7 (PIN_BASE + 0x20 + 7)
65#define AT91_PIN_PB8 (PIN_BASE + 0x20 + 8)
66#define AT91_PIN_PB9 (PIN_BASE + 0x20 + 9)
67#define AT91_PIN_PB10 (PIN_BASE + 0x20 + 10)
68#define AT91_PIN_PB11 (PIN_BASE + 0x20 + 11)
69#define AT91_PIN_PB12 (PIN_BASE + 0x20 + 12)
70#define AT91_PIN_PB13 (PIN_BASE + 0x20 + 13)
71#define AT91_PIN_PB14 (PIN_BASE + 0x20 + 14)
72#define AT91_PIN_PB15 (PIN_BASE + 0x20 + 15)
73#define AT91_PIN_PB16 (PIN_BASE + 0x20 + 16)
74#define AT91_PIN_PB17 (PIN_BASE + 0x20 + 17)
75#define AT91_PIN_PB18 (PIN_BASE + 0x20 + 18)
76#define AT91_PIN_PB19 (PIN_BASE + 0x20 + 19)
77#define AT91_PIN_PB20 (PIN_BASE + 0x20 + 20)
78#define AT91_PIN_PB21 (PIN_BASE + 0x20 + 21)
79#define AT91_PIN_PB22 (PIN_BASE + 0x20 + 22)
80#define AT91_PIN_PB23 (PIN_BASE + 0x20 + 23)
81#define AT91_PIN_PB24 (PIN_BASE + 0x20 + 24)
82#define AT91_PIN_PB25 (PIN_BASE + 0x20 + 25)
83#define AT91_PIN_PB26 (PIN_BASE + 0x20 + 26)
84#define AT91_PIN_PB27 (PIN_BASE + 0x20 + 27)
85#define AT91_PIN_PB28 (PIN_BASE + 0x20 + 28)
86#define AT91_PIN_PB29 (PIN_BASE + 0x20 + 29)
87#define AT91_PIN_PB30 (PIN_BASE + 0x20 + 30)
88#define AT91_PIN_PB31 (PIN_BASE + 0x20 + 31)
89
90#define AT91_PIN_PC0 (PIN_BASE + 0x40 + 0)
91#define AT91_PIN_PC1 (PIN_BASE + 0x40 + 1)
92#define AT91_PIN_PC2 (PIN_BASE + 0x40 + 2)
93#define AT91_PIN_PC3 (PIN_BASE + 0x40 + 3)
94#define AT91_PIN_PC4 (PIN_BASE + 0x40 + 4)
95#define AT91_PIN_PC5 (PIN_BASE + 0x40 + 5)
96#define AT91_PIN_PC6 (PIN_BASE + 0x40 + 6)
97#define AT91_PIN_PC7 (PIN_BASE + 0x40 + 7)
98#define AT91_PIN_PC8 (PIN_BASE + 0x40 + 8)
99#define AT91_PIN_PC9 (PIN_BASE + 0x40 + 9)
100#define AT91_PIN_PC10 (PIN_BASE + 0x40 + 10)
101#define AT91_PIN_PC11 (PIN_BASE + 0x40 + 11)
102#define AT91_PIN_PC12 (PIN_BASE + 0x40 + 12)
103#define AT91_PIN_PC13 (PIN_BASE + 0x40 + 13)
104#define AT91_PIN_PC14 (PIN_BASE + 0x40 + 14)
105#define AT91_PIN_PC15 (PIN_BASE + 0x40 + 15)
106#define AT91_PIN_PC16 (PIN_BASE + 0x40 + 16)
107#define AT91_PIN_PC17 (PIN_BASE + 0x40 + 17)
108#define AT91_PIN_PC18 (PIN_BASE + 0x40 + 18)
109#define AT91_PIN_PC19 (PIN_BASE + 0x40 + 19)
110#define AT91_PIN_PC20 (PIN_BASE + 0x40 + 20)
111#define AT91_PIN_PC21 (PIN_BASE + 0x40 + 21)
112#define AT91_PIN_PC22 (PIN_BASE + 0x40 + 22)
113#define AT91_PIN_PC23 (PIN_BASE + 0x40 + 23)
114#define AT91_PIN_PC24 (PIN_BASE + 0x40 + 24)
115#define AT91_PIN_PC25 (PIN_BASE + 0x40 + 25)
116#define AT91_PIN_PC26 (PIN_BASE + 0x40 + 26)
117#define AT91_PIN_PC27 (PIN_BASE + 0x40 + 27)
118#define AT91_PIN_PC28 (PIN_BASE + 0x40 + 28)
119#define AT91_PIN_PC29 (PIN_BASE + 0x40 + 29)
120#define AT91_PIN_PC30 (PIN_BASE + 0x40 + 30)
121#define AT91_PIN_PC31 (PIN_BASE + 0x40 + 31)
122
123#define AT91_PIN_PD0 (PIN_BASE + 0x60 + 0)
124#define AT91_PIN_PD1 (PIN_BASE + 0x60 + 1)
125#define AT91_PIN_PD2 (PIN_BASE + 0x60 + 2)
126#define AT91_PIN_PD3 (PIN_BASE + 0x60 + 3)
127#define AT91_PIN_PD4 (PIN_BASE + 0x60 + 4)
128#define AT91_PIN_PD5 (PIN_BASE + 0x60 + 5)
129#define AT91_PIN_PD6 (PIN_BASE + 0x60 + 6)
130#define AT91_PIN_PD7 (PIN_BASE + 0x60 + 7)
131#define AT91_PIN_PD8 (PIN_BASE + 0x60 + 8)
132#define AT91_PIN_PD9 (PIN_BASE + 0x60 + 9)
133#define AT91_PIN_PD10 (PIN_BASE + 0x60 + 10)
134#define AT91_PIN_PD11 (PIN_BASE + 0x60 + 11)
135#define AT91_PIN_PD12 (PIN_BASE + 0x60 + 12)
136#define AT91_PIN_PD13 (PIN_BASE + 0x60 + 13)
137#define AT91_PIN_PD14 (PIN_BASE + 0x60 + 14)
138#define AT91_PIN_PD15 (PIN_BASE + 0x60 + 15)
139#define AT91_PIN_PD16 (PIN_BASE + 0x60 + 16)
140#define AT91_PIN_PD17 (PIN_BASE + 0x60 + 17)
141#define AT91_PIN_PD18 (PIN_BASE + 0x60 + 18)
142#define AT91_PIN_PD19 (PIN_BASE + 0x60 + 19)
143#define AT91_PIN_PD20 (PIN_BASE + 0x60 + 20)
144#define AT91_PIN_PD21 (PIN_BASE + 0x60 + 21)
145#define AT91_PIN_PD22 (PIN_BASE + 0x60 + 22)
146#define AT91_PIN_PD23 (PIN_BASE + 0x60 + 23)
147#define AT91_PIN_PD24 (PIN_BASE + 0x60 + 24)
148#define AT91_PIN_PD25 (PIN_BASE + 0x60 + 25)
149#define AT91_PIN_PD26 (PIN_BASE + 0x60 + 26)
150#define AT91_PIN_PD27 (PIN_BASE + 0x60 + 27)
151#define AT91_PIN_PD28 (PIN_BASE + 0x60 + 28)
152#define AT91_PIN_PD29 (PIN_BASE + 0x60 + 29)
153#define AT91_PIN_PD30 (PIN_BASE + 0x60 + 30)
154#define AT91_PIN_PD31 (PIN_BASE + 0x60 + 31)
155
156#define AT91_PIN_PE0 (PIN_BASE + 0x80 + 0)
157#define AT91_PIN_PE1 (PIN_BASE + 0x80 + 1)
158#define AT91_PIN_PE2 (PIN_BASE + 0x80 + 2)
159#define AT91_PIN_PE3 (PIN_BASE + 0x80 + 3)
160#define AT91_PIN_PE4 (PIN_BASE + 0x80 + 4)
161#define AT91_PIN_PE5 (PIN_BASE + 0x80 + 5)
162#define AT91_PIN_PE6 (PIN_BASE + 0x80 + 6)
163#define AT91_PIN_PE7 (PIN_BASE + 0x80 + 7)
164#define AT91_PIN_PE8 (PIN_BASE + 0x80 + 8)
165#define AT91_PIN_PE9 (PIN_BASE + 0x80 + 9)
166#define AT91_PIN_PE10 (PIN_BASE + 0x80 + 10)
167#define AT91_PIN_PE11 (PIN_BASE + 0x80 + 11)
168#define AT91_PIN_PE12 (PIN_BASE + 0x80 + 12)
169#define AT91_PIN_PE13 (PIN_BASE + 0x80 + 13)
170#define AT91_PIN_PE14 (PIN_BASE + 0x80 + 14)
171#define AT91_PIN_PE15 (PIN_BASE + 0x80 + 15)
172#define AT91_PIN_PE16 (PIN_BASE + 0x80 + 16)
173#define AT91_PIN_PE17 (PIN_BASE + 0x80 + 17)
174#define AT91_PIN_PE18 (PIN_BASE + 0x80 + 18)
175#define AT91_PIN_PE19 (PIN_BASE + 0x80 + 19)
176#define AT91_PIN_PE20 (PIN_BASE + 0x80 + 20)
177#define AT91_PIN_PE21 (PIN_BASE + 0x80 + 21)
178#define AT91_PIN_PE22 (PIN_BASE + 0x80 + 22)
179#define AT91_PIN_PE23 (PIN_BASE + 0x80 + 23)
180#define AT91_PIN_PE24 (PIN_BASE + 0x80 + 24)
181#define AT91_PIN_PE25 (PIN_BASE + 0x80 + 25)
182#define AT91_PIN_PE26 (PIN_BASE + 0x80 + 26)
183#define AT91_PIN_PE27 (PIN_BASE + 0x80 + 27)
184#define AT91_PIN_PE28 (PIN_BASE + 0x80 + 28)
185#define AT91_PIN_PE29 (PIN_BASE + 0x80 + 29)
186#define AT91_PIN_PE30 (PIN_BASE + 0x80 + 30)
187#define AT91_PIN_PE31 (PIN_BASE + 0x80 + 31)
188
189#ifndef __ASSEMBLY__
190/* setup setup routines, called from board init or driver probe() */
191extern int __init_or_module at91_set_GPIO_periph(unsigned pin, int use_pullup);
192extern int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup);
193extern int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup);
194extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup);
195extern int __init_or_module at91_set_gpio_output(unsigned pin, int value);
196extern int __init_or_module at91_set_deglitch(unsigned pin, int is_on);
197extern int __init_or_module at91_set_multi_drive(unsigned pin, int is_on);
198
199/* callable at any time */
200extern int at91_set_gpio_value(unsigned pin, int value);
201extern int at91_get_gpio_value(unsigned pin);
202
203/* callable only from core power-management code */
204extern void at91_gpio_suspend(void);
205extern void at91_gpio_resume(void);
206
207/*-------------------------------------------------------------------------*/
208
209/* wrappers for "new style" GPIO calls. the old AT91-specfic ones should
210 * eventually be removed (along with this errno.h inclusion), and the
211 * gpio request/free calls should probably be implemented.
212 */
213
214#include <asm/errno.h>
215
216static inline int gpio_request(unsigned gpio, const char *label)
217{
218 return 0;
219}
220
221static inline void gpio_free(unsigned gpio)
222{
223}
224
225extern int gpio_direction_input(unsigned gpio);
226extern int gpio_direction_output(unsigned gpio, int value);
227
228static inline int gpio_get_value(unsigned gpio)
229{
230 return at91_get_gpio_value(gpio);
231}
232
233static inline void gpio_set_value(unsigned gpio, int value)
234{
235 at91_set_gpio_value(gpio, value);
236}
237
238#include <asm-generic/gpio.h> /* cansleep wrappers */
239
240static inline int gpio_to_irq(unsigned gpio)
241{
242 return gpio;
243}
244
245static inline int irq_to_gpio(unsigned irq)
246{
247 return irq;
248}
249
250#endif /* __ASSEMBLY__ */
251
252#endif
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
new file mode 100644
index 000000000000..da0b681c652c
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/hardware.h
@@ -0,0 +1,92 @@
1/*
2 * arch/arm/mach-at91/include/mach/hardware.h
3 *
4 * Copyright (C) 2003 SAN People
5 * Copyright (C) 2003 ATMEL
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 */
13
14#ifndef __ASM_ARCH_HARDWARE_H
15#define __ASM_ARCH_HARDWARE_H
16
17#include <asm/sizes.h>
18
19#if defined(CONFIG_ARCH_AT91RM9200)
20#include <mach/at91rm9200.h>
21#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
22#include <mach/at91sam9260.h>
23#elif defined(CONFIG_ARCH_AT91SAM9261)
24#include <mach/at91sam9261.h>
25#elif defined(CONFIG_ARCH_AT91SAM9263)
26#include <mach/at91sam9263.h>
27#elif defined(CONFIG_ARCH_AT91SAM9RL)
28#include <mach/at91sam9rl.h>
29#elif defined(CONFIG_ARCH_AT91CAP9)
30#include <mach/at91cap9.h>
31#elif defined(CONFIG_ARCH_AT91X40)
32#include <mach/at91x40.h>
33#else
34#error "Unsupported AT91 processor"
35#endif
36
37
38#ifdef CONFIG_MMU
39/*
40 * Remap the peripherals from address 0xFFF78000 .. 0xFFFFFFFF
41 * to 0xFEF78000 .. 0xFF000000. (544Kb)
42 */
43#define AT91_IO_PHYS_BASE 0xFFF78000
44#define AT91_IO_VIRT_BASE (0xFF000000 - AT91_IO_SIZE)
45#else
46/*
47 * Identity mapping for the non MMU case.
48 */
49#define AT91_IO_PHYS_BASE AT91_BASE_SYS
50#define AT91_IO_VIRT_BASE AT91_IO_PHYS_BASE
51#endif
52
53#define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1)
54
55 /* Convert a physical IO address to virtual IO address */
56#define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE)
57
58/*
59 * Virtual to Physical Address mapping for IO devices.
60 */
61#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS)
62#define AT91_VA_BASE_EMAC AT91_IO_P2V(AT91RM9200_BASE_EMAC)
63
64 /* Internal SRAM is mapped below the IO devices */
65#define AT91_SRAM_MAX SZ_1M
66#define AT91_VIRT_BASE (AT91_IO_VIRT_BASE - AT91_SRAM_MAX)
67
68/* Serial ports */
69#define ATMEL_MAX_UART 7 /* 6 USART3's and one DBGU port (SAM9260) */
70
71/* External Memory Map */
72#define AT91_CHIPSELECT_0 0x10000000
73#define AT91_CHIPSELECT_1 0x20000000
74#define AT91_CHIPSELECT_2 0x30000000
75#define AT91_CHIPSELECT_3 0x40000000
76#define AT91_CHIPSELECT_4 0x50000000
77#define AT91_CHIPSELECT_5 0x60000000
78#define AT91_CHIPSELECT_6 0x70000000
79#define AT91_CHIPSELECT_7 0x80000000
80
81/* SDRAM */
82#ifdef CONFIG_DRAM_BASE
83#define AT91_SDRAM_BASE CONFIG_DRAM_BASE
84#else
85#define AT91_SDRAM_BASE AT91_CHIPSELECT_1
86#endif
87
88/* Clocks */
89#define AT91_SLOW_CLOCK 32768 /* slow clock */
90
91
92#endif
diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h
new file mode 100644
index 000000000000..1611bd03f528
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/io.h
@@ -0,0 +1,48 @@
1/*
2 * arch/arm/mach-at91/include/mach/io.h
3 *
4 * Copyright (C) 2003 SAN People
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
21#ifndef __ASM_ARCH_IO_H
22#define __ASM_ARCH_IO_H
23
24#define IO_SPACE_LIMIT 0xFFFFFFFF
25
26#define __io(a) ((void __iomem *)(a))
27#define __mem_pci(a) (a)
28
29
30#ifndef __ASSEMBLY__
31
32static inline unsigned int at91_sys_read(unsigned int reg_offset)
33{
34 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
35
36 return __raw_readl(addr + reg_offset);
37}
38
39static inline void at91_sys_write(unsigned int reg_offset, unsigned long value)
40{
41 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
42
43 __raw_writel(value, addr + reg_offset);
44}
45
46#endif
47
48#endif
diff --git a/arch/arm/mach-at91/include/mach/irqs.h b/arch/arm/mach-at91/include/mach/irqs.h
new file mode 100644
index 000000000000..bda29ccbcd94
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/irqs.h
@@ -0,0 +1,48 @@
1/*
2 * arch/arm/mach-at91/include/mach/irqs.h
3 *
4 * Copyright (C) 2004 SAN People
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
21#ifndef __ASM_ARCH_IRQS_H
22#define __ASM_ARCH_IRQS_H
23
24#include <asm/io.h>
25#include <mach/at91_aic.h>
26
27#define NR_AIC_IRQS 32
28
29
30/*
31 * Acknowledge interrupt with AIC after interrupt has been handled.
32 * (by kernel/irq.c)
33 */
34#define irq_finish(irq) do { at91_sys_write(AT91_AIC_EOICR, 0); } while (0)
35
36
37/*
38 * IRQ interrupt symbols are the AT91xxx_ID_* symbols
39 * for IRQs handled directly through the AIC, or else the AT91_PIN_*
40 * symbols in gpio.h for ones handled indirectly as GPIOs.
41 * We make provision for 5 banks of GPIO.
42 */
43#define NR_IRQS (NR_AIC_IRQS + (5 * 32))
44
45/* FIQ is AIC source 0. */
46#define FIQ_START AT91_ID_FIQ
47
48#endif
diff --git a/arch/arm/mach-at91/include/mach/memory.h b/arch/arm/mach-at91/include/mach/memory.h
new file mode 100644
index 000000000000..9dd1b8c79b08
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/memory.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-at91/include/mach/memory.h
3 *
4 * Copyright (C) 2004 SAN People
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
21#ifndef __ASM_ARCH_MEMORY_H
22#define __ASM_ARCH_MEMORY_H
23
24#include <mach/hardware.h>
25
26#define PHYS_OFFSET (AT91_SDRAM_BASE)
27
28
29/*
30 * Virtual view <-> DMA view memory address translations
31 * virt_to_bus: Used to translate the virtual address to an
32 * address suitable to be passed to set_dma_addr
33 * bus_to_virt: Used to convert an address for DMA operations
34 * to an address that the kernel can use.
35 */
36#define __virt_to_bus(x) __virt_to_phys(x)
37#define __bus_to_virt(x) __phys_to_virt(x)
38
39#endif
diff --git a/arch/arm/mach-at91/include/mach/system.h b/arch/arm/mach-at91/include/mach/system.h
new file mode 100644
index 000000000000..e712658d966c
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/system.h
@@ -0,0 +1,53 @@
1/*
2 * arch/arm/mach-at91/include/mach/system.h
3 *
4 * Copyright (C) 2003 SAN People
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
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24#include <mach/hardware.h>
25#include <mach/at91_st.h>
26#include <mach/at91_dbgu.h>
27
28static inline void arch_idle(void)
29{
30 /*
31 * Disable the processor clock. The processor will be automatically
32 * re-enabled by an interrupt or by a reset.
33 */
34// at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK);
35
36 /*
37 * Set the processor (CP15) into 'Wait for Interrupt' mode.
38 * Unlike disabling the processor clock via the PMC (above)
39 * this allows the processor to be woken via JTAG.
40 */
41 cpu_do_idle();
42}
43
44void (*at91_arch_reset)(void);
45
46static inline void arch_reset(char mode)
47{
48 /* call the CPU-specific reset function */
49 if (at91_arch_reset)
50 (at91_arch_reset)();
51}
52
53#endif
diff --git a/arch/arm/mach-at91/include/mach/timex.h b/arch/arm/mach-at91/include/mach/timex.h
new file mode 100644
index 000000000000..d84c9948becf
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/timex.h
@@ -0,0 +1,77 @@
1/*
2 * arch/arm/mach-at91/include/mach/timex.h
3 *
4 * Copyright (C) 2003 SAN People
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
21#ifndef __ASM_ARCH_TIMEX_H
22#define __ASM_ARCH_TIMEX_H
23
24#include <mach/hardware.h>
25
26#if defined(CONFIG_ARCH_AT91RM9200)
27
28#define CLOCK_TICK_RATE (AT91_SLOW_CLOCK)
29
30#elif defined(CONFIG_ARCH_AT91SAM9260)
31
32#if defined(CONFIG_MACH_USB_A9260) || defined(CONFIG_MACH_QIL_A9260)
33#define AT91SAM9_MASTER_CLOCK 90000000
34#else
35#define AT91SAM9_MASTER_CLOCK 99300000
36#endif
37
38#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
39
40#elif defined(CONFIG_ARCH_AT91SAM9261)
41
42#define AT91SAM9_MASTER_CLOCK 99300000
43#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
44
45#elif defined(CONFIG_ARCH_AT91SAM9263)
46
47#if defined(CONFIG_MACH_USB_A9263)
48#define AT91SAM9_MASTER_CLOCK 90000000
49#else
50#define AT91SAM9_MASTER_CLOCK 99959500
51#endif
52
53#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
54
55#elif defined(CONFIG_ARCH_AT91SAM9RL)
56
57#define AT91SAM9_MASTER_CLOCK 100000000
58#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
59
60#elif defined(CONFIG_ARCH_AT91SAM9G20)
61
62#define AT91SAM9_MASTER_CLOCK 132096000
63#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
64
65#elif defined(CONFIG_ARCH_AT91CAP9)
66
67#define AT91CAP9_MASTER_CLOCK 100000000
68#define CLOCK_TICK_RATE (AT91CAP9_MASTER_CLOCK/16)
69
70#elif defined(CONFIG_ARCH_AT91X40)
71
72#define AT91X40_MASTER_CLOCK 40000000
73#define CLOCK_TICK_RATE (AT91X40_MASTER_CLOCK)
74
75#endif
76
77#endif
diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h
new file mode 100644
index 000000000000..0410d548e9b1
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/uncompress.h
@@ -0,0 +1,76 @@
1/*
2 * arch/arm/mach-at91/include/mach/uncompress.h
3 *
4 * Copyright (C) 2003 SAN People
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
21#ifndef __ASM_ARCH_UNCOMPRESS_H
22#define __ASM_ARCH_UNCOMPRESS_H
23
24#include <asm/io.h>
25#include <linux/atmel_serial.h>
26
27#if defined(CONFIG_AT91_EARLY_DBGU)
28#define UART_OFFSET (AT91_DBGU + AT91_BASE_SYS)
29#elif defined(CONFIG_AT91_EARLY_USART0)
30#define UART_OFFSET AT91_USART0
31#elif defined(CONFIG_AT91_EARLY_USART1)
32#define UART_OFFSET AT91_USART1
33#elif defined(CONFIG_AT91_EARLY_USART2)
34#define UART_OFFSET AT91_USART2
35#elif defined(CONFIG_AT91_EARLY_USART3)
36#define UART_OFFSET AT91_USART3
37#elif defined(CONFIG_AT91_EARLY_USART4)
38#define UART_OFFSET AT91_USART4
39#elif defined(CONFIG_AT91_EARLY_USART5)
40#define UART_OFFSET AT91_USART5
41#endif
42
43/*
44 * The following code assumes the serial port has already been
45 * initialized by the bootloader. If you didn't setup a port in
46 * your bootloader then nothing will appear (which might be desired).
47 *
48 * This does not append a newline
49 */
50static void putc(int c)
51{
52#ifdef UART_OFFSET
53 void __iomem *sys = (void __iomem *) UART_OFFSET; /* physical address */
54
55 while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXRDY))
56 barrier();
57 __raw_writel(c, sys + ATMEL_US_THR);
58#endif
59}
60
61static inline void flush(void)
62{
63#ifdef UART_OFFSET
64 void __iomem *sys = (void __iomem *) UART_OFFSET; /* physical address */
65
66 /* wait for transmission to complete */
67 while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXEMPTY))
68 barrier();
69#endif
70}
71
72#define arch_decomp_setup()
73
74#define arch_decomp_wdog()
75
76#endif
diff --git a/arch/arm/mach-at91/include/mach/vmalloc.h b/arch/arm/mach-at91/include/mach/vmalloc.h
new file mode 100644
index 000000000000..8eb459f3f5b7
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/vmalloc.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-at91/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2003 SAN People
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
21#ifndef __ASM_ARCH_VMALLOC_H
22#define __ASM_ARCH_VMALLOC_H
23
24#define VMALLOC_END (AT91_VIRT_BASE & PGDIR_MASK)
25
26#endif
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c
index ca87587b2b4b..da3494a53423 100644
--- a/arch/arm/mach-at91/irq.c
+++ b/arch/arm/mach-at91/irq.c
@@ -25,9 +25,8 @@
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/types.h> 26#include <linux/types.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/mach-types.h>
31#include <asm/setup.h> 30#include <asm/setup.h>
32 31
33#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
index 9cdcda500fe8..fec03c59ff94 100644
--- a/arch/arm/mach-at91/leds.c
+++ b/arch/arm/mach-at91/leds.c
@@ -13,9 +13,8 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/init.h> 14#include <linux/init.h>
15 15
16#include <asm/mach-types.h> 16#include <mach/board.h>
17#include <asm/arch/board.h> 17#include <mach/gpio.h>
18#include <asm/arch/gpio.h>
19 18
20 19
21/* ------------------------------------------------------------------------- */ 20/* ------------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 8ab4feb1ec5b..ec2fe4ca1e27 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -23,16 +23,15 @@
23#include <asm/atomic.h> 23#include <asm/atomic.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26#include <asm/mach-types.h>
27 26
28#include <asm/arch/at91_pmc.h> 27#include <mach/at91_pmc.h>
29#include <asm/arch/gpio.h> 28#include <mach/gpio.h>
30#include <asm/arch/cpu.h> 29#include <mach/cpu.h>
31 30
32#include "generic.h" 31#include "generic.h"
33 32
34#ifdef CONFIG_ARCH_AT91RM9200 33#ifdef CONFIG_ARCH_AT91RM9200
35#include <asm/arch/at91rm9200_mc.h> 34#include <mach/at91rm9200_mc.h>
36 35
37/* 36/*
38 * The AT91RM9200 goes into self-refresh mode with this command, and will 37 * The AT91RM9200 goes into self-refresh mode with this command, and will
@@ -42,7 +41,7 @@
42#define sdram_selfrefresh_disable() do {} while (0) 41#define sdram_selfrefresh_disable() do {} while (0)
43 42
44#elif defined(CONFIG_ARCH_AT91CAP9) 43#elif defined(CONFIG_ARCH_AT91CAP9)
45#include <asm/arch/at91cap9_ddrsdr.h> 44#include <mach/at91cap9_ddrsdr.h>
46 45
47static u32 saved_lpr; 46static u32 saved_lpr;
48 47
@@ -59,7 +58,7 @@ static inline void sdram_selfrefresh_enable(void)
59#define sdram_selfrefresh_disable() at91_sys_write(AT91_DDRSDRC_LPR, saved_lpr) 58#define sdram_selfrefresh_disable() at91_sys_write(AT91_DDRSDRC_LPR, saved_lpr)
60 59
61#else 60#else
62#include <asm/arch/at91sam9_sdramc.h> 61#include <mach/at91sam9_sdramc.h>
63 62
64#ifdef CONFIG_ARCH_AT91SAM9263 63#ifdef CONFIG_ARCH_AT91SAM9263
65/* 64/*
@@ -92,8 +91,8 @@ static inline void sdram_selfrefresh_enable(void)
92 */ 91 */
93#if defined(AT91_SHDWC) 92#if defined(AT91_SHDWC)
94 93
95#include <asm/arch/at91_rstc.h> 94#include <mach/at91_rstc.h>
96#include <asm/arch/at91_shdwc.h> 95#include <mach/at91_shdwc.h>
97 96
98static void __init show_reset_status(void) 97static void __init show_reset_status(void)
99{ 98{
diff --git a/arch/arm/mach-clps711x/autcpu12.c b/arch/arm/mach-clps711x/autcpu12.c
index c13ca6c56baa..474616dcd7a6 100644
--- a/arch/arm/mach-clps711x/autcpu12.c
+++ b/arch/arm/mach-clps711x/autcpu12.c
@@ -23,7 +23,7 @@
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/sizes.h> 27#include <asm/sizes.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/setup.h> 29#include <asm/setup.h>
@@ -33,7 +33,7 @@
33#include <asm/page.h> 33#include <asm/page.h>
34 34
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36#include <asm/arch/autcpu12.h> 36#include <mach/autcpu12.h>
37 37
38#include "common.h" 38#include "common.h"
39 39
diff --git a/arch/arm/mach-clps711x/cdb89712.c b/arch/arm/mach-clps711x/cdb89712.c
index 831df007f6c7..aa02aa5a01f4 100644
--- a/arch/arm/mach-clps711x/cdb89712.c
+++ b/arch/arm/mach-clps711x/cdb89712.c
@@ -23,7 +23,7 @@
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/pgtable.h> 28#include <asm/pgtable.h>
29#include <asm/page.h> 29#include <asm/page.h>
diff --git a/arch/arm/mach-clps711x/ceiva.c b/arch/arm/mach-clps711x/ceiva.c
index e2b2c5ac8a83..8ada20184978 100644
--- a/arch/arm/mach-clps711x/ceiva.c
+++ b/arch/arm/mach-clps711x/ceiva.c
@@ -27,7 +27,7 @@
27 27
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29 29
30#include <asm/hardware.h> 30#include <mach/hardware.h>
31#include <asm/page.h> 31#include <asm/page.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/sizes.h> 33#include <asm/sizes.h>
diff --git a/arch/arm/mach-clps711x/edb7211-mm.c b/arch/arm/mach-clps711x/edb7211-mm.c
index 0d52e0851251..c58e32ec4c5d 100644
--- a/arch/arm/mach-clps711x/edb7211-mm.c
+++ b/arch/arm/mach-clps711x/edb7211-mm.c
@@ -22,7 +22,7 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/init.h> 23#include <linux/init.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/page.h> 26#include <asm/page.h>
27#include <asm/pgtable.h> 27#include <asm/pgtable.h>
28#include <asm/sizes.h> 28#include <asm/sizes.h>
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
index 3792ab4f0996..7122b3d21043 100644
--- a/arch/arm/mach-clps711x/fortunet.c
+++ b/arch/arm/mach-clps711x/fortunet.c
@@ -23,7 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/initrd.h> 24#include <linux/initrd.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/setup.h> 28#include <asm/setup.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
diff --git a/arch/arm/mach-clps711x/include/mach/autcpu12.h b/arch/arm/mach-clps711x/include/mach/autcpu12.h
new file mode 100644
index 000000000000..1588a365f610
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/autcpu12.h
@@ -0,0 +1,78 @@
1/*
2 * AUTCPU12 specific defines
3 *
4 * (c) 2001 Thomas Gleixner, autronix automation <gleixner@autronix.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARCH_AUTCPU12_H
21#define __ASM_ARCH_AUTCPU12_H
22
23/*
24 * The CS8900A ethernet chip has its I/O registers wired to chip select 2
25 * (nCS2). This is the mapping for it.
26 */
27#define AUTCPU12_PHYS_CS8900A CS2_PHYS_BASE /* physical */
28#define AUTCPU12_VIRT_CS8900A (0xfe000000) /* virtual */
29
30/*
31 * The flash bank is wired to chip select 0
32 */
33#define AUTCPU12_PHYS_FLASH CS0_PHYS_BASE /* physical */
34
35/* offset for device specific information structure */
36#define AUTCPU12_LCDINFO_OFFS (0x00010000)
37/*
38* Videomemory is the internal SRAM (CS 6)
39*/
40#define AUTCPU12_PHYS_VIDEO CS6_PHYS_BASE
41#define AUTCPU12_VIRT_VIDEO (0xfd000000)
42
43/*
44* All special IO's are tied to CS1
45*/
46#define AUTCPU12_PHYS_CHAR_LCD CS1_PHYS_BASE +0x00000000 /* physical */
47
48#define AUTCPU12_PHYS_NVRAM CS1_PHYS_BASE +0x02000000 /* physical */
49
50#define AUTCPU12_PHYS_CSAUX1 CS1_PHYS_BASE +0x04000000 /* physical */
51
52#define AUTCPU12_PHYS_SMC CS1_PHYS_BASE +0x06000000 /* physical */
53
54#define AUTCPU12_PHYS_CAN CS1_PHYS_BASE +0x08000000 /* physical */
55
56#define AUTCPU12_PHYS_TOUCH CS1_PHYS_BASE +0x0A000000 /* physical */
57
58#define AUTCPU12_PHYS_IO CS1_PHYS_BASE +0x0C000000 /* physical */
59
60#define AUTCPU12_PHYS_LPT CS1_PHYS_BASE +0x0E000000 /* physical */
61
62/*
63* defines for smartmedia card access
64*/
65#define AUTCPU12_SMC_RDY (1<<2)
66#define AUTCPU12_SMC_ALE (1<<3)
67#define AUTCPU12_SMC_CLE (1<<4)
68#define AUTCPU12_SMC_PORT_OFFSET PBDR
69#define AUTCPU12_SMC_SELECT_OFFSET 0x10
70/*
71* defines for lcd contrast
72*/
73#define AUTCPU12_DPOT_PORT_OFFSET PEDR
74#define AUTCPU12_DPOT_CS (1<<0)
75#define AUTCPU12_DPOT_CLK (1<<1)
76#define AUTCPU12_DPOT_UD (1<<2)
77
78#endif
diff --git a/arch/arm/mach-clps711x/include/mach/debug-macro.S b/arch/arm/mach-clps711x/include/mach/debug-macro.S
new file mode 100644
index 000000000000..64baf9f87408
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/debug-macro.S
@@ -0,0 +1,46 @@
1/* arch/arm/mach-clps711x/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#include <asm/hardware/clps7111.h>
15
16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0
18 tst \rx, #1 @ MMU enabled?
19 moveq \rx, #CLPS7111_PHYS_BASE
20 movne \rx, #CLPS7111_VIRT_BASE
21#ifndef CONFIG_DEBUG_CLPS711X_UART2
22 add \rx, \rx, #0x0000 @ UART1
23#else
24 add \rx, \rx, #0x1000 @ UART2
25#endif
26 .endm
27
28 .macro senduart,rd,rx
29 str \rd, [\rx, #0x0480] @ UARTDR
30 .endm
31
32 .macro waituart,rd,rx
331001: ldr \rd, [\rx, #0x0140] @ SYSFLGx
34 tst \rd, #1 << 11 @ UBUSYx
35 bne 1001b
36 .endm
37
38 .macro busyuart,rd,rx
39 tst \rx, #0x1000 @ UART2 does not have CTS here
40 bne 1002f
411001: ldr \rd, [\rx, #0x0140] @ SYSFLGx
42 tst \rd, #1 << 8 @ CTS
43 bne 1001b
441002:
45 .endm
46
diff --git a/arch/arm/mach-clps711x/include/mach/dma.h b/arch/arm/mach-clps711x/include/mach/dma.h
new file mode 100644
index 000000000000..0d620e869536
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/dma.h
@@ -0,0 +1,19 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/dma.h
3 *
4 * Copyright (C) 1997,1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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 */
diff --git a/arch/arm/mach-clps711x/include/mach/entry-macro.S b/arch/arm/mach-clps711x/include/mach/entry-macro.S
new file mode 100644
index 000000000000..90fa2f70489f
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/entry-macro.S
@@ -0,0 +1,58 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for CLPS711X-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#include <asm/hardware/clps7111.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro get_irqnr_preamble, base, tmp
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
22#if (INTSR2 - INTSR1) != (INTMR2 - INTMR1)
23#error INTSR stride != INTMR stride
24#endif
25
26 .macro get_irqnr_and_base, irqnr, stat, base, mask
27 mov \base, #CLPS7111_BASE
28 ldr \stat, [\base, #INTSR1]
29 ldr \mask, [\base, #INTMR1]
30 mov \irqnr, #4
31 mov \mask, \mask, lsl #16
32 and \stat, \stat, \mask, lsr #16
33 movs \stat, \stat, lsr #4
34 bne 1001f
35
36 add \base, \base, #INTSR2 - INTSR1
37 ldr \stat, [\base, #INTSR1]
38 ldr \mask, [\base, #INTMR1]
39 mov \irqnr, #16
40 mov \mask, \mask, lsl #16
41 and \stat, \stat, \mask, lsr #16
42
431001: tst \stat, #255
44 addeq \irqnr, \irqnr, #8
45 moveq \stat, \stat, lsr #8
46 tst \stat, #15
47 addeq \irqnr, \irqnr, #4
48 moveq \stat, \stat, lsr #4
49 tst \stat, #3
50 addeq \irqnr, \irqnr, #2
51 moveq \stat, \stat, lsr #2
52 tst \stat, #1
53 addeq \irqnr, \irqnr, #1
54 moveq \stat, \stat, lsr #1
55 tst \stat, #1 @ bit 0 should be set
56 .endm
57
58
diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h
new file mode 100644
index 000000000000..4c3e101b96c9
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/hardware.h
@@ -0,0 +1,237 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/hardware.h
3 *
4 * This file contains the hardware definitions of the Prospector P720T.
5 *
6 * Copyright (C) 2000 Deep Blue Solutions Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef __ASM_ARCH_HARDWARE_H
23#define __ASM_ARCH_HARDWARE_H
24
25
26#define CLPS7111_VIRT_BASE 0xff000000
27#define CLPS7111_BASE CLPS7111_VIRT_BASE
28
29/*
30 * The physical addresses that the external chip select signals map to is
31 * dependent on the setting of the nMEDCHG signal on EP7211 and EP7212
32 * processors. CONFIG_EP72XX_BOOT_ROM is only available if these
33 * processors are in use.
34 */
35#ifndef CONFIG_EP72XX_ROM_BOOT
36#define CS0_PHYS_BASE (0x00000000)
37#define CS1_PHYS_BASE (0x10000000)
38#define CS2_PHYS_BASE (0x20000000)
39#define CS3_PHYS_BASE (0x30000000)
40#define CS4_PHYS_BASE (0x40000000)
41#define CS5_PHYS_BASE (0x50000000)
42#define CS6_PHYS_BASE (0x60000000)
43#define CS7_PHYS_BASE (0x70000000)
44#else
45#define CS0_PHYS_BASE (0x70000000)
46#define CS1_PHYS_BASE (0x60000000)
47#define CS2_PHYS_BASE (0x50000000)
48#define CS3_PHYS_BASE (0x40000000)
49#define CS4_PHYS_BASE (0x30000000)
50#define CS5_PHYS_BASE (0x20000000)
51#define CS6_PHYS_BASE (0x10000000)
52#define CS7_PHYS_BASE (0x00000000)
53#endif
54
55#if defined (CONFIG_ARCH_EP7211)
56
57#define EP7211_VIRT_BASE CLPS7111_VIRT_BASE
58#define EP7211_BASE CLPS7111_VIRT_BASE
59#include <asm/hardware/ep7211.h>
60
61#elif defined (CONFIG_ARCH_EP7212)
62
63#define EP7212_VIRT_BASE CLPS7111_VIRT_BASE
64#define EP7212_BASE CLPS7111_VIRT_BASE
65#include <asm/hardware/ep7212.h>
66
67#endif
68
69#define SYSPLD_VIRT_BASE 0xfe000000
70#define SYSPLD_BASE SYSPLD_VIRT_BASE
71
72#ifndef __ASSEMBLER__
73
74#define PCIO_BASE IO_BASE
75
76#endif
77
78
79#if defined (CONFIG_ARCH_AUTCPU12)
80
81#define CS89712_VIRT_BASE CLPS7111_VIRT_BASE
82#define CS89712_BASE CLPS7111_VIRT_BASE
83
84#include <asm/hardware/clps7111.h>
85#include <asm/hardware/ep7212.h>
86#include <asm/hardware/cs89712.h>
87
88#endif
89
90
91#if defined (CONFIG_ARCH_CDB89712)
92
93#include <asm/hardware/clps7111.h>
94#include <asm/hardware/ep7212.h>
95#include <asm/hardware/cs89712.h>
96
97/* dynamic ioremap() areas */
98#define FLASH_START 0x00000000
99#define FLASH_SIZE 0x800000
100#define FLASH_WIDTH 4
101
102#define SRAM_START 0x60000000
103#define SRAM_SIZE 0xc000
104#define SRAM_WIDTH 4
105
106#define BOOTROM_START 0x70000000
107#define BOOTROM_SIZE 0x80
108#define BOOTROM_WIDTH 4
109
110
111/* static cdb89712_map_io() areas */
112#define REGISTER_START 0x80000000
113#define REGISTER_SIZE 0x4000
114#define REGISTER_BASE 0xff000000
115
116#define ETHER_START 0x20000000
117#define ETHER_SIZE 0x1000
118#define ETHER_BASE 0xfe000000
119
120#endif
121
122
123#if defined (CONFIG_ARCH_EDB7211)
124
125/*
126 * The extra 8 lines of the keyboard matrix are wired to chip select 3 (nCS3)
127 * and repeat across it. This is the mapping for it.
128 *
129 * In jumpered boot mode, nCS3 is mapped to 0x4000000, not 0x3000000. This
130 * was cause for much consternation and headscratching. This should probably
131 * be made a compile/run time kernel option.
132 */
133#define EP7211_PHYS_EXTKBD CS3_PHYS_BASE /* physical */
134
135#define EP7211_VIRT_EXTKBD (0xfd000000) /* virtual */
136
137
138/*
139 * The CS8900A ethernet chip has its I/O registers wired to chip select 2
140 * (nCS2). This is the mapping for it.
141 *
142 * In jumpered boot mode, nCS2 is mapped to 0x5000000, not 0x2000000. This
143 * was cause for much consternation and headscratching. This should probably
144 * be made a compile/run time kernel option.
145 */
146#define EP7211_PHYS_CS8900A CS2_PHYS_BASE /* physical */
147
148#define EP7211_VIRT_CS8900A (0xfc000000) /* virtual */
149
150
151/*
152 * The two flash banks are wired to chip selects 0 and 1. This is the mapping
153 * for them.
154 *
155 * nCS0 and nCS1 are at 0x70000000 and 0x60000000, respectively, when running
156 * in jumpered boot mode.
157 */
158#define EP7211_PHYS_FLASH1 CS0_PHYS_BASE /* physical */
159#define EP7211_PHYS_FLASH2 CS1_PHYS_BASE /* physical */
160
161#define EP7211_VIRT_FLASH1 (0xfa000000) /* virtual */
162#define EP7211_VIRT_FLASH2 (0xfb000000) /* virtual */
163
164#endif /* CONFIG_ARCH_EDB7211 */
165
166
167/*
168 * Relevant bits in port D, which controls power to the various parts of
169 * the LCD on the EDB7211.
170 */
171#define EDB_PD1_LCD_DC_DC_EN (1<<1)
172#define EDB_PD2_LCDEN (1<<2)
173#define EDB_PD3_LCDBL (1<<3)
174
175
176#if defined (CONFIG_ARCH_CEIVA)
177
178#define CEIVA_VIRT_BASE CLPS7111_VIRT_BASE
179#define CEIVA_BASE CLPS7111_VIRT_BASE
180
181#include <asm/hardware/clps7111.h>
182#include <asm/hardware/ep7212.h>
183
184
185/*
186 * The two flash banks are wired to chip selects 0 and 1. This is the mapping
187 * for them.
188 *
189 * nCS0 and nCS1 are at 0x70000000 and 0x60000000, respectively, when running
190 * in jumpered boot mode.
191 */
192#define CEIVA_PHYS_FLASH1 CS0_PHYS_BASE /* physical */
193#define CEIVA_PHYS_FLASH2 CS1_PHYS_BASE /* physical */
194
195#define CEIVA_VIRT_FLASH1 (0xfa000000) /* virtual */
196#define CEIVA_VIRT_FLASH2 (0xfb000000) /* virtual */
197
198#define CEIVA_FLASH_SIZE 0x100000
199#define CEIVA_FLASH_WIDTH 2
200
201#define SRAM_START 0x60000000
202#define SRAM_SIZE 0xc000
203#define SRAM_WIDTH 4
204
205#define BOOTROM_START 0x70000000
206#define BOOTROM_SIZE 0x80
207#define BOOTROM_WIDTH 4
208
209/*
210 * SED1355 LCD controller
211 */
212#define CEIVA_PHYS_SED1355 CS2_PHYS_BASE
213#define CEIVA_VIRT_SED1355 (0xfc000000)
214
215/*
216 * Relevant bits in port D, which controls power to the various parts of
217 * the LCD on the Ceiva Photo Max, and reset to the LCD controller.
218 */
219
220// Reset line to SED1355 (must be high to operate)
221#define CEIVA_PD1_LCDRST (1<<1)
222// LCD panel enable (set to one, to enable LCD)
223#define CEIVA_PD4_LCDEN (1<<4)
224// Backlight (set to one, to turn on backlight
225#define CEIVA_PD5_LCDBL (1<<5)
226
227/*
228 * Relevant bits in port B, which report the status of the buttons.
229 */
230
231// White button
232#define CEIVA_PB4_WHT_BTN (1<<4)
233// Black button
234#define CEIVA_PB0_BLK_BTN (1<<0)
235#endif // #if defined (CONFIG_ARCH_CEIVA)
236
237#endif
diff --git a/arch/arm/mach-clps711x/include/mach/io.h b/arch/arm/mach-clps711x/include/mach/io.h
new file mode 100644
index 000000000000..4c8440087679
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/io.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/io.h
3 *
4 * Copyright (C) 1999 ARM Limited
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#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#include <mach/hardware.h>
24
25#define IO_SPACE_LIMIT 0xffffffff
26
27#define __io(a) ((void __iomem *)(a))
28#define __mem_pci(a) (a)
29
30/*
31 * We don't support ins[lb]/outs[lb]. Make them fault.
32 */
33#define __raw_readsb(p,d,l) do { *(int *)0 = 0; } while (0)
34#define __raw_readsl(p,d,l) do { *(int *)0 = 0; } while (0)
35#define __raw_writesb(p,d,l) do { *(int *)0 = 0; } while (0)
36#define __raw_writesl(p,d,l) do { *(int *)0 = 0; } while (0)
37
38#endif
diff --git a/arch/arm/mach-clps711x/include/mach/irqs.h b/arch/arm/mach-clps711x/include/mach/irqs.h
new file mode 100644
index 000000000000..30b7e97285a4
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/irqs.h
@@ -0,0 +1,53 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/irqs.h
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd.
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
21/*
22 * Interrupts from INTSR1
23 */
24#define IRQ_CSINT 4
25#define IRQ_EINT1 5
26#define IRQ_EINT2 6
27#define IRQ_EINT3 7
28#define IRQ_TC1OI 8
29#define IRQ_TC2OI 9
30#define IRQ_RTCMI 10
31#define IRQ_TINT 11
32#define IRQ_UTXINT1 12
33#define IRQ_URXINT1 13
34#define IRQ_UMSINT 14
35#define IRQ_SSEOTI 15
36
37#define INT1_IRQS (0x0000fff0)
38#define INT1_ACK_IRQS (0x00004f10)
39
40/*
41 * Interrupts from INTSR2
42 */
43#define IRQ_KBDINT (16+0) /* bit 0 */
44#define IRQ_SS2RX (16+1) /* bit 1 */
45#define IRQ_SS2TX (16+2) /* bit 2 */
46#define IRQ_UTXINT2 (16+12) /* bit 12 */
47#define IRQ_URXINT2 (16+13) /* bit 13 */
48
49#define INT2_IRQS (0x30070000)
50#define INT2_ACK_IRQS (0x00010000)
51
52#define NR_IRQS 30
53
diff --git a/arch/arm/mach-clps711x/include/mach/memory.h b/arch/arm/mach-clps711x/include/mach/memory.h
new file mode 100644
index 000000000000..71c2fa70c8e8
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/memory.h
@@ -0,0 +1,94 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/memory.h
3 *
4 * Copyright (C) 1999 ARM Limited
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#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H
22
23
24/*
25 * Physical DRAM offset.
26 */
27#define PHYS_OFFSET UL(0xc0000000)
28
29/*
30 * Virtual view <-> DMA view memory address translations
31 * virt_to_bus: Used to translate the virtual address to an
32 * address suitable to be passed to set_dma_addr
33 * bus_to_virt: Used to convert an address for DMA operations
34 * to an address that the kernel can use.
35 */
36
37#if defined(CONFIG_ARCH_CDB89712)
38
39#define __virt_to_bus(x) (x)
40#define __bus_to_virt(x) (x)
41
42#elif defined (CONFIG_ARCH_AUTCPU12)
43
44#define __virt_to_bus(x) (x)
45#define __bus_to_virt(x) (x)
46
47#else
48
49#define __virt_to_bus(x) ((x) - PAGE_OFFSET)
50#define __bus_to_virt(x) ((x) + PAGE_OFFSET)
51
52#endif
53
54
55/*
56 * Like the SA1100, the EDB7211 has a large gap between physical RAM
57 * banks. In 2.2, the Psion (CL-PS7110) port added custom support for
58 * discontiguous physical memory. In 2.4, we can use the standard
59 * Linux NUMA support.
60 *
61 * This is not necessary for EP7211 implementations with only one used
62 * memory bank. For those systems, simply undefine CONFIG_DISCONTIGMEM.
63 */
64
65/*
66 * The PS7211 allows up to 256MB max per DRAM bank, but the EDB7211
67 * uses only one of the two banks (bank #1). However, even within
68 * bank #1, memory is discontiguous.
69 *
70 * The EDB7211 has two 8MB DRAM areas with 8MB of empty space between
71 * them, so we use 24 for the node max shift to get 16MB node sizes.
72 */
73
74/*
75 * Because of the wide memory address space between physical RAM banks on the
76 * SA1100, it's much more convenient to use Linux's NUMA support to implement
77 * our memory map representation. Assuming all memory nodes have equal access
78 * characteristics, we then have generic discontiguous memory support.
79 *
80 * Of course, all this isn't mandatory for SA1100 implementations with only
81 * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM.
82 *
83 * The nodes are matched with the physical memory bank addresses which are
84 * incidentally the same as virtual addresses.
85 *
86 * node 0: 0xc0000000 - 0xc7ffffff
87 * node 1: 0xc8000000 - 0xcfffffff
88 * node 2: 0xd0000000 - 0xd7ffffff
89 * node 3: 0xd8000000 - 0xdfffffff
90 */
91#define NODE_MEM_SIZE_BITS 24
92
93#endif
94
diff --git a/arch/arm/mach-clps711x/include/mach/syspld.h b/arch/arm/mach-clps711x/include/mach/syspld.h
new file mode 100644
index 000000000000..f7f4c1201898
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/syspld.h
@@ -0,0 +1,121 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/syspld.h
3 *
4 * System Control PLD register definitions.
5 *
6 * Copyright (C) 2000 Deep Blue Solutions Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef __ASM_ARCH_SYSPLD_H
23#define __ASM_ARCH_SYSPLD_H
24
25#define SYSPLD_PHYS_BASE (0x10000000)
26
27#ifndef __ASSEMBLY__
28#include <asm/types.h>
29
30#define SYSPLD_REG(type,off) (*(volatile type *)(SYSPLD_BASE + off))
31#else
32#define SYSPLD_REG(type,off) (off)
33#endif
34
35#define PLD_INT SYSPLD_REG(u32, 0x000000)
36#define PLD_INT_PENIRQ (1 << 5)
37#define PLD_INT_UCB_IRQ (1 << 1)
38#define PLD_INT_KBD_ATN (1 << 0) /* EINT1 */
39
40#define PLD_PWR SYSPLD_REG(u32, 0x000004)
41#define PLD_PWR_EXT (1 << 5)
42#define PLD_PWR_MODE (1 << 4) /* 1 = PWM, 0 = PFM */
43#define PLD_S4_ON (1 << 3) /* LCD bias voltage enable */
44#define PLD_S3_ON (1 << 2) /* LCD backlight enable */
45#define PLD_S2_ON (1 << 1) /* LCD 3V3 supply enable */
46#define PLD_S1_ON (1 << 0) /* LCD 3V supply enable */
47
48#define PLD_KBD SYSPLD_REG(u32, 0x000008)
49#define PLD_KBD_WAKE (1 << 1)
50#define PLD_KBD_EN (1 << 0)
51
52#define PLD_SPI SYSPLD_REG(u32, 0x00000c)
53#define PLD_SPI_EN (1 << 0)
54
55#define PLD_IO SYSPLD_REG(u32, 0x000010)
56#define PLD_IO_BOOTSEL (1 << 6) /* boot sel switch */
57#define PLD_IO_USER (1 << 5) /* user defined switch */
58#define PLD_IO_LED3 (1 << 4)
59#define PLD_IO_LED2 (1 << 3)
60#define PLD_IO_LED1 (1 << 2)
61#define PLD_IO_LED0 (1 << 1)
62#define PLD_IO_LEDEN (1 << 0)
63
64#define PLD_IRDA SYSPLD_REG(u32, 0x000014)
65#define PLD_IRDA_EN (1 << 0)
66
67#define PLD_COM2 SYSPLD_REG(u32, 0x000018)
68#define PLD_COM2_EN (1 << 0)
69
70#define PLD_COM1 SYSPLD_REG(u32, 0x00001c)
71#define PLD_COM1_EN (1 << 0)
72
73#define PLD_AUD SYSPLD_REG(u32, 0x000020)
74#define PLD_AUD_DIV1 (1 << 6)
75#define PLD_AUD_DIV0 (1 << 5)
76#define PLD_AUD_CLK_SEL1 (1 << 4)
77#define PLD_AUD_CLK_SEL0 (1 << 3)
78#define PLD_AUD_MIC_PWR (1 << 2)
79#define PLD_AUD_MIC_GAIN (1 << 1)
80#define PLD_AUD_CODEC_EN (1 << 0)
81
82#define PLD_CF SYSPLD_REG(u32, 0x000024)
83#define PLD_CF2_SLEEP (1 << 5)
84#define PLD_CF1_SLEEP (1 << 4)
85#define PLD_CF2_nPDREQ (1 << 3)
86#define PLD_CF1_nPDREQ (1 << 2)
87#define PLD_CF2_nIRQ (1 << 1)
88#define PLD_CF1_nIRQ (1 << 0)
89
90#define PLD_SDC SYSPLD_REG(u32, 0x000028)
91#define PLD_SDC_INT_EN (1 << 2)
92#define PLD_SDC_WP (1 << 1)
93#define PLD_SDC_CD (1 << 0)
94
95#define PLD_FPGA SYSPLD_REG(u32, 0x00002c)
96
97#define PLD_CODEC SYSPLD_REG(u32, 0x400000)
98#define PLD_CODEC_IRQ3 (1 << 4)
99#define PLD_CODEC_IRQ2 (1 << 3)
100#define PLD_CODEC_IRQ1 (1 << 2)
101#define PLD_CODEC_EN (1 << 0)
102
103#define PLD_BRITE SYSPLD_REG(u32, 0x400004)
104#define PLD_BRITE_UP (1 << 1)
105#define PLD_BRITE_DN (1 << 0)
106
107#define PLD_LCDEN SYSPLD_REG(u32, 0x400008)
108#define PLD_LCDEN_EN (1 << 0)
109
110#define PLD_ID SYSPLD_REG(u32, 0x40000c)
111
112#define PLD_TCH SYSPLD_REG(u32, 0x400010)
113#define PLD_TCH_PENIRQ (1 << 1)
114#define PLD_TCH_EN (1 << 0)
115
116#define PLD_GPIO SYSPLD_REG(u32, 0x400014)
117#define PLD_GPIO2 (1 << 2)
118#define PLD_GPIO1 (1 << 1)
119#define PLD_GPIO0 (1 << 0)
120
121#endif
diff --git a/arch/arm/mach-clps711x/include/mach/system.h b/arch/arm/mach-clps711x/include/mach/system.h
new file mode 100644
index 000000000000..a8eade40317f
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/system.h
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/system.h
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd
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#ifndef __ASM_ARCH_SYSTEM_H
21#define __ASM_ARCH_SYSTEM_H
22
23#include <mach/hardware.h>
24#include <asm/hardware/clps7111.h>
25#include <asm/io.h>
26
27static inline void arch_idle(void)
28{
29 clps_writel(1, HALT);
30 __asm__ __volatile__(
31 "mov r0, r0\n\
32 mov r0, r0");
33}
34
35static inline void arch_reset(char mode)
36{
37 cpu_reset(0);
38}
39
40#endif
diff --git a/arch/arm/mach-clps711x/include/mach/time.h b/arch/arm/mach-clps711x/include/mach/time.h
new file mode 100644
index 000000000000..8fe283ccd1f3
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/time.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/time.h
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd.
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#include <asm/leds.h>
21#include <asm/hardware/clps7111.h>
22
23extern void clps711x_setup_timer(void);
24
25/*
26 * IRQ handler for the timer
27 */
28static irqreturn_t
29p720t_timer_interrupt(int irq, void *dev_id)
30{
31 struct pt_regs *regs = get_irq_regs();
32 do_leds();
33 do_timer(1);
34#ifndef CONFIG_SMP
35 update_process_times(user_mode(regs));
36#endif
37 do_profile(regs);
38 return IRQ_HANDLED;
39}
40
41/*
42 * Set up timer interrupt, and return the current time in seconds.
43 */
44void __init time_init(void)
45{
46 clps711x_setup_timer();
47 timer_irq.handler = p720t_timer_interrupt;
48 setup_irq(IRQ_TC2OI, &timer_irq);
49}
diff --git a/arch/arm/mach-clps711x/include/mach/timex.h b/arch/arm/mach-clps711x/include/mach/timex.h
new file mode 100644
index 000000000000..ac8823ccff93
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/timex.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/timex.h
3 *
4 * Prospector 720T architecture timex specifications
5 *
6 * Copyright (C) 2000 Deep Blue Solutions Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#define CLOCK_TICK_RATE 512000
diff --git a/arch/arm/mach-clps711x/include/mach/uncompress.h b/arch/arm/mach-clps711x/include/mach/uncompress.h
new file mode 100644
index 000000000000..7164310dea7c
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/uncompress.h
@@ -0,0 +1,59 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/uncompress.h
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd
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#include <mach/io.h>
21#include <mach/hardware.h>
22#include <asm/hardware/clps7111.h>
23
24#undef CLPS7111_BASE
25#define CLPS7111_BASE CLPS7111_PHYS_BASE
26
27#define __raw_readl(p) (*(unsigned long *)(p))
28#define __raw_writel(v,p) (*(unsigned long *)(p) = (v))
29
30#ifdef CONFIG_DEBUG_CLPS711X_UART2
31#define SYSFLGx SYSFLG2
32#define UARTDRx UARTDR2
33#else
34#define SYSFLGx SYSFLG1
35#define UARTDRx UARTDR1
36#endif
37
38/*
39 * This does not append a newline
40 */
41static inline void putc(int c)
42{
43 while (clps_readl(SYSFLGx) & SYSFLG_UTXFF)
44 barrier();
45 clps_writel(c, UARTDRx);
46}
47
48static inline void flush(void)
49{
50 while (clps_readl(SYSFLGx) & SYSFLG_UBUSY)
51 barrier();
52}
53
54/*
55 * nothing to do
56 */
57#define arch_decomp_setup()
58
59#define arch_decomp_wdog()
diff --git a/arch/arm/mach-clps711x/include/mach/vmalloc.h b/arch/arm/mach-clps711x/include/mach/vmalloc.h
new file mode 100644
index 000000000000..ea6cc7beff28
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/vmalloc.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd.
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#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
diff --git a/arch/arm/mach-clps711x/irq.c b/arch/arm/mach-clps711x/irq.c
index ca102960f528..38623cfcac5a 100644
--- a/arch/arm/mach-clps711x/irq.c
+++ b/arch/arm/mach-clps711x/irq.c
@@ -21,7 +21,7 @@
21#include <linux/list.h> 21#include <linux/list.h>
22 22
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27 27
diff --git a/arch/arm/mach-clps711x/mm.c b/arch/arm/mach-clps711x/mm.c
index a00f77ef8df8..a7b4591205a3 100644
--- a/arch/arm/mach-clps711x/mm.c
+++ b/arch/arm/mach-clps711x/mm.c
@@ -25,7 +25,7 @@
25#include <linux/bootmem.h> 25#include <linux/bootmem.h>
26 26
27#include <asm/sizes.h> 27#include <asm/sizes.h>
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/page.h> 30#include <asm/page.h>
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
diff --git a/arch/arm/mach-clps711x/p720t-leds.c b/arch/arm/mach-clps711x/p720t-leds.c
index 4915b3524963..262c3c361453 100644
--- a/arch/arm/mach-clps711x/p720t-leds.c
+++ b/arch/arm/mach-clps711x/p720t-leds.c
@@ -22,7 +22,7 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/init.h> 23#include <linux/init.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/leds.h> 27#include <asm/leds.h>
28#include <asm/system.h> 28#include <asm/system.h>
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c
index c8ecd2480c27..f51f97d4f212 100644
--- a/arch/arm/mach-clps711x/p720t.c
+++ b/arch/arm/mach-clps711x/p720t.c
@@ -23,7 +23,7 @@
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/pgtable.h> 28#include <asm/pgtable.h>
29#include <asm/page.h> 29#include <asm/page.h>
@@ -32,7 +32,7 @@
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <asm/arch/syspld.h> 35#include <mach/syspld.h>
36 36
37#include "common.h" 37#include "common.h"
38 38
diff --git a/arch/arm/mach-clps711x/time.c b/arch/arm/mach-clps711x/time.c
index e5dc33f1f95c..ef1fcd17189e 100644
--- a/arch/arm/mach-clps711x/time.c
+++ b/arch/arm/mach-clps711x/time.c
@@ -22,7 +22,7 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/leds.h> 27#include <asm/leds.h>
28#include <asm/io.h> 28#include <asm/io.h>
diff --git a/arch/arm/mach-clps7500/core.c b/arch/arm/mach-clps7500/core.c
index 2ac63671ea5f..cc1b82179e83 100644
--- a/arch/arm/mach-clps7500/core.c
+++ b/arch/arm/mach-clps7500/core.c
@@ -21,7 +21,7 @@
21#include <asm/mach/irq.h> 21#include <asm/mach/irq.h>
22#include <asm/mach/time.h> 22#include <asm/mach/time.h>
23 23
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/hardware/iomd.h> 25#include <asm/hardware/iomd.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
diff --git a/arch/arm/mach-clps7500/include/mach/acornfb.h b/arch/arm/mach-clps7500/include/mach/acornfb.h
new file mode 100644
index 000000000000..aea6330c9745
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/acornfb.h
@@ -0,0 +1,33 @@
1#define acornfb_valid_pixrate(var) (var->pixclock >= 39325 && var->pixclock <= 40119)
2
3static inline void
4acornfb_vidc20_find_rates(struct vidc_timing *vidc,
5 struct fb_var_screeninfo *var)
6{
7 u_int bandwidth;
8
9 vidc->control |= VIDC20_CTRL_PIX_CK;
10
11 /* Calculate bandwidth */
12 bandwidth = var->pixclock * 8 / var->bits_per_pixel;
13
14 /* Encode bandwidth as VIDC20 setting */
15 if (bandwidth > 16667*2)
16 vidc->control |= VIDC20_CTRL_FIFO_16;
17 else if (bandwidth > 13333*2)
18 vidc->control |= VIDC20_CTRL_FIFO_20;
19 else if (bandwidth > 11111*2)
20 vidc->control |= VIDC20_CTRL_FIFO_24;
21 else
22 vidc->control |= VIDC20_CTRL_FIFO_28;
23
24 vidc->pll_ctl = 0x2020;
25}
26
27#ifdef CONFIG_CHRONTEL_7003
28#define acornfb_default_control() VIDC20_CTRL_PIX_HCLK
29#else
30#define acornfb_default_control() VIDC20_CTRL_PIX_VCLK
31#endif
32
33#define acornfb_default_econtrol() VIDC20_ECTL_DAC | VIDC20_ECTL_REG(3) | VIDC20_ECTL_ECK
diff --git a/arch/arm/mach-clps7500/include/mach/debug-macro.S b/arch/arm/mach-clps7500/include/mach/debug-macro.S
new file mode 100644
index 000000000000..af4104e7e84a
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/debug-macro.S
@@ -0,0 +1,21 @@
1/* arch/arm/mach-clps7500/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 .macro addruart,rx
15 mov \rx, #0xe0000000
16 orr \rx, \rx, #0x00010000
17 orr \rx, \rx, #0x00000be0
18 .endm
19
20#define UART_SHIFT 2
21#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-clps7500/include/mach/dma.h b/arch/arm/mach-clps7500/include/mach/dma.h
new file mode 100644
index 000000000000..63fcde505498
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/dma.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/dma.h
3 *
4 * Copyright (C) 1999 Nexus Electronics Ltd.
5 */
6
7#ifndef __ASM_ARCH_DMA_H
8#define __ASM_ARCH_DMA_H
9
10/* DMA is not yet implemented! It should be the same as acorn, copy over.. */
11
12/*
13 * This is the maximum DMA address that can be DMAd to.
14 * There should not be more than (0xd0000000 - 0xc0000000)
15 * bytes of RAM.
16 */
17#define MAX_DMA_ADDRESS 0xd0000000
18
19#define DMA_S0 0
20
21#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-clps7500/include/mach/entry-macro.S b/arch/arm/mach-clps7500/include/mach/entry-macro.S
new file mode 100644
index 000000000000..4e7e54144093
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/entry-macro.S
@@ -0,0 +1,16 @@
1#include <mach/hardware.h>
2#include <asm/hardware/entry-macro-iomd.S>
3
4 .equ ioc_base_high, IOC_BASE & 0xff000000
5 .equ ioc_base_low, IOC_BASE & 0x00ff0000
6
7 .macro get_irqnr_preamble, base, tmp
8 mov \base, #ioc_base_high @ point at IOC
9 .if ioc_base_low
10 orr \base, \base, #ioc_base_low
11 .endif
12 .endm
13
14 .macro arch_ret_to_user, tmp1, tmp2
15 .endm
16
diff --git a/arch/arm/mach-clps7500/include/mach/hardware.h b/arch/arm/mach-clps7500/include/mach/hardware.h
new file mode 100644
index 000000000000..d66578a3371c
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/hardware.h
@@ -0,0 +1,67 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/hardware.h
3 *
4 * Copyright (C) 1996-1999 Russell King.
5 * Copyright (C) 1999 Nexus Electronics Ltd.
6 *
7 * This file contains the hardware definitions of the
8 * CL7500 evaluation board.
9 */
10#ifndef __ASM_ARCH_HARDWARE_H
11#define __ASM_ARCH_HARDWARE_H
12
13#include <mach/memory.h>
14#include <asm/hardware/iomd.h>
15
16#ifdef __ASSEMBLY__
17#define IOMEM(x) x
18#else
19#define IOMEM(x) ((void __iomem *)(x))
20#endif
21
22/*
23 * What hardware must be present
24 */
25#define HAS_IOMD
26#define HAS_VIDC20
27
28/* Hardware addresses of major areas.
29 * *_START is the physical address
30 * *_SIZE is the size of the region
31 * *_BASE is the virtual address
32 */
33
34#define IO_START 0x03000000 /* I/O */
35#define IO_SIZE 0x01000000
36#define IO_BASE IOMEM(0xe0000000)
37
38#define ISA_START 0x0c000000 /* ISA */
39#define ISA_SIZE 0x00010000
40#define ISA_BASE 0xe1000000
41
42#define FLASH_START 0x01000000 /* XXX */
43#define FLASH_SIZE 0x01000000
44#define FLASH_BASE 0xe2000000
45
46#define LED_START 0x0302B000
47#define LED_SIZE 0x00001000
48#define LED_BASE 0xe3000000
49#define LED_ADDRESS (LED_BASE + 0xa00)
50
51/* Let's define SCREEN_START for CL7500, even though it's a lie. */
52#define SCREEN_START 0x02000000 /* VRAM */
53#define SCREEN_END 0xdfc00000
54#define SCREEN_BASE 0xdf800000
55
56#define VIDC_BASE (void __iomem *)0xe0400000
57#define IOMD_BASE IOMEM(0xe0200000)
58#define IOC_BASE IOMEM(0xe0200000)
59#define FLOPPYDMA_BASE IOMEM(0xe002a000)
60#define PCIO_BASE IOMEM(0xe0010000)
61
62#define vidc_writel(val) __raw_writel(val, VIDC_BASE)
63
64/* in/out bias for the ISA slot region */
65#define ISASLOT_IO 0x80400000
66
67#endif
diff --git a/arch/arm/mach-clps7500/include/mach/io.h b/arch/arm/mach-clps7500/include/mach/io.h
new file mode 100644
index 000000000000..2ff2860889ed
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/io.h
@@ -0,0 +1,255 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/io.h
3 * from arch/arm/mach-rpc/include/mach/io.h
4 *
5 * Copyright (C) 1997 Russell King
6 *
7 * Modifications:
8 * 06-Dec-1997 RMK Created.
9 */
10#ifndef __ASM_ARM_ARCH_IO_H
11#define __ASM_ARM_ARCH_IO_H
12
13#include <mach/hardware.h>
14
15#define IO_SPACE_LIMIT 0xffffffff
16
17/*
18 * GCC is totally crap at loading/storing data. We try to persuade it
19 * to do the right thing by using these whereever possible instead of
20 * the above.
21 */
22#define __arch_base_getb(b,o) \
23 ({ \
24 unsigned int v, r = (b); \
25 __asm__ __volatile__( \
26 "ldrb %0, [%1, %2]" \
27 : "=r" (v) \
28 : "r" (r), "Ir" (o)); \
29 v; \
30 })
31
32#define __arch_base_getl(b,o) \
33 ({ \
34 unsigned int v, r = (b); \
35 __asm__ __volatile__( \
36 "ldr %0, [%1, %2]" \
37 : "=r" (v) \
38 : "r" (r), "Ir" (o)); \
39 v; \
40 })
41
42#define __arch_base_putb(v,b,o) \
43 ({ \
44 unsigned int r = (b); \
45 __asm__ __volatile__( \
46 "strb %0, [%1, %2]" \
47 : \
48 : "r" (v), "r" (r), "Ir" (o)); \
49 })
50
51#define __arch_base_putl(v,b,o) \
52 ({ \
53 unsigned int r = (b); \
54 __asm__ __volatile__( \
55 "str %0, [%1, %2]" \
56 : \
57 : "r" (v), "r" (r), "Ir" (o)); \
58 })
59
60/*
61 * We use two different types of addressing - PC style addresses, and ARM
62 * addresses. PC style accesses the PC hardware with the normal PC IO
63 * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+
64 * and are translated to the start of IO. Note that all addresses are
65 * shifted left!
66 */
67#define __PORT_PCIO(x) (!((x) & 0x80000000))
68
69/*
70 * Dynamic IO functions - let the compiler
71 * optimize the expressions
72 */
73static inline void __outb (unsigned int value, unsigned int port)
74{
75 unsigned long temp;
76 __asm__ __volatile__(
77 "tst %2, #0x80000000\n\t"
78 "mov %0, %4\n\t"
79 "addeq %0, %0, %3\n\t"
80 "strb %1, [%0, %2, lsl #2] @ outb"
81 : "=&r" (temp)
82 : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
83 : "cc");
84}
85
86static inline void __outw (unsigned int value, unsigned int port)
87{
88 unsigned long temp;
89 __asm__ __volatile__(
90 "tst %2, #0x80000000\n\t"
91 "mov %0, %4\n\t"
92 "addeq %0, %0, %3\n\t"
93 "str %1, [%0, %2, lsl #2] @ outw"
94 : "=&r" (temp)
95 : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
96 : "cc");
97}
98
99static inline void __outl (unsigned int value, unsigned int port)
100{
101 unsigned long temp;
102 __asm__ __volatile__(
103 "tst %2, #0x80000000\n\t"
104 "mov %0, %4\n\t"
105 "addeq %0, %0, %3\n\t"
106 "str %1, [%0, %2, lsl #2] @ outl"
107 : "=&r" (temp)
108 : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
109 : "cc");
110}
111
112#define DECLARE_DYN_IN(sz,fnsuffix,instr) \
113static inline unsigned sz __in##fnsuffix (unsigned int port) \
114{ \
115 unsigned long temp, value; \
116 __asm__ __volatile__( \
117 "tst %2, #0x80000000\n\t" \
118 "mov %0, %4\n\t" \
119 "addeq %0, %0, %3\n\t" \
120 "ldr" instr " %1, [%0, %2, lsl #2] @ in" #fnsuffix \
121 : "=&r" (temp), "=r" (value) \
122 : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \
123 : "cc"); \
124 return (unsigned sz)value; \
125}
126
127static inline unsigned int __ioaddr (unsigned int port) \
128{ \
129 if (__PORT_PCIO(port)) \
130 return (unsigned int)(PCIO_BASE + (port << 2)); \
131 else \
132 return (unsigned int)(IO_BASE + (port << 2)); \
133}
134
135#define DECLARE_IO(sz,fnsuffix,instr) \
136 DECLARE_DYN_IN(sz,fnsuffix,instr)
137
138DECLARE_IO(char,b,"b")
139DECLARE_IO(short,w,"")
140DECLARE_IO(int,l,"")
141
142#undef DECLARE_IO
143#undef DECLARE_DYN_IN
144
145/*
146 * Constant address IO functions
147 *
148 * These have to be macros for the 'J' constraint to work -
149 * +/-4096 immediate operand.
150 */
151#define __outbc(value,port) \
152({ \
153 if (__PORT_PCIO((port))) \
154 __asm__ __volatile__( \
155 "strb %0, [%1, %2] @ outbc" \
156 : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
157 else \
158 __asm__ __volatile__( \
159 "strb %0, [%1, %2] @ outbc" \
160 : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \
161})
162
163#define __inbc(port) \
164({ \
165 unsigned char result; \
166 if (__PORT_PCIO((port))) \
167 __asm__ __volatile__( \
168 "ldrb %0, [%1, %2] @ inbc" \
169 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
170 else \
171 __asm__ __volatile__( \
172 "ldrb %0, [%1, %2] @ inbc" \
173 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
174 result; \
175})
176
177#define __outwc(value,port) \
178({ \
179 unsigned long v = value; \
180 if (__PORT_PCIO((port))) \
181 __asm__ __volatile__( \
182 "str %0, [%1, %2] @ outwc" \
183 : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
184 else \
185 __asm__ __volatile__( \
186 "str %0, [%1, %2] @ outwc" \
187 : : "r" (v|v<<16), "r" (IO_BASE), "r" ((port) << 2)); \
188})
189
190#define __inwc(port) \
191({ \
192 unsigned short result; \
193 if (__PORT_PCIO((port))) \
194 __asm__ __volatile__( \
195 "ldr %0, [%1, %2] @ inwc" \
196 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
197 else \
198 __asm__ __volatile__( \
199 "ldr %0, [%1, %2] @ inwc" \
200 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
201 result & 0xffff; \
202})
203
204#define __outlc(value,port) \
205({ \
206 unsigned long v = value; \
207 if (__PORT_PCIO((port))) \
208 __asm__ __volatile__( \
209 "str %0, [%1, %2] @ outlc" \
210 : : "r" (v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
211 else \
212 __asm__ __volatile__( \
213 "str %0, [%1, %2] @ outlc" \
214 : : "r" (v), "r" (IO_BASE), "r" ((port) << 2)); \
215})
216
217#define __inlc(port) \
218({ \
219 unsigned long result; \
220 if (__PORT_PCIO((port))) \
221 __asm__ __volatile__( \
222 "ldr %0, [%1, %2] @ inlc" \
223 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
224 else \
225 __asm__ __volatile__( \
226 "ldr %0, [%1, %2] @ inlc" \
227 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
228 result; \
229})
230
231#define __ioaddrc(port) \
232 (__PORT_PCIO((port)) ? PCIO_BASE + ((port) << 2) : IO_BASE + ((port) << 2))
233
234#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p))
235#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p))
236#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p))
237#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
238#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
239#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
240#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p))
241/* the following macro is deprecated */
242#define ioaddr(port) __ioaddr((port))
243
244#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l)
245#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l)
246
247#define outsb(p,d,l) __raw_writesb(__ioaddr(p),d,l)
248#define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l)
249
250/*
251 * 1:1 mapping for ioremapped regions.
252 */
253#define __mem_pci(x) (x)
254
255#endif
diff --git a/arch/arm/mach-clps7500/include/mach/irq.h b/arch/arm/mach-clps7500/include/mach/irq.h
new file mode 100644
index 000000000000..e8da3c58df76
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/irq.h
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/irq.h
3 *
4 * Copyright (C) 1996 Russell King
5 * Copyright (C) 1999, 2001 Nexus Electronics Ltd.
6 *
7 * Changelog:
8 * 10-10-1996 RMK Brought up to date with arch-sa110eval
9 * 22-08-1998 RMK Restructured IRQ routines
10 * 11-08-1999 PJB Created ARM7500 version, derived from RiscPC code
11 */
12
13#include <asm/hardware/iomd.h>
14#include <asm/io.h>
15
16static inline int fixup_irq(unsigned int irq)
17{
18 if (irq == IRQ_ISA) {
19 int isabits = *((volatile unsigned int *)0xe002b700);
20 if (isabits == 0) {
21 printk("Spurious ISA IRQ!\n");
22 return irq;
23 }
24 irq = IRQ_ISA_BASE;
25 while (!(isabits & 1)) {
26 irq++;
27 isabits >>= 1;
28 }
29 }
30
31 return irq;
32}
diff --git a/arch/arm/mach-clps7500/include/mach/irqs.h b/arch/arm/mach-clps7500/include/mach/irqs.h
new file mode 100644
index 000000000000..bee66b487f59
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/irqs.h
@@ -0,0 +1,66 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/irqs.h
3 *
4 * Copyright (C) 1999 Nexus Electronics Ltd
5 */
6
7#define IRQ_INT2 0
8#define IRQ_INT1 2
9#define IRQ_VSYNCPULSE 3
10#define IRQ_POWERON 4
11#define IRQ_TIMER0 5
12#define IRQ_TIMER1 6
13#define IRQ_FORCE 7
14#define IRQ_INT8 8
15#define IRQ_ISA 9
16#define IRQ_INT6 10
17#define IRQ_INT5 11
18#define IRQ_INT4 12
19#define IRQ_INT3 13
20#define IRQ_KEYBOARDTX 14
21#define IRQ_KEYBOARDRX 15
22
23#define IRQ_DMA0 16
24#define IRQ_DMA1 17
25#define IRQ_DMA2 18
26#define IRQ_DMA3 19
27#define IRQ_DMAS0 20
28#define IRQ_DMAS1 21
29
30#define IRQ_IOP0 24
31#define IRQ_IOP1 25
32#define IRQ_IOP2 26
33#define IRQ_IOP3 27
34#define IRQ_IOP4 28
35#define IRQ_IOP5 29
36#define IRQ_IOP6 30
37#define IRQ_IOP7 31
38
39#define IRQ_MOUSERX 40
40#define IRQ_MOUSETX 41
41#define IRQ_ADC 42
42#define IRQ_EVENT1 43
43#define IRQ_EVENT2 44
44
45#define IRQ_ISA_BASE 48
46#define IRQ_ISA_3 48
47#define IRQ_ISA_4 49
48#define IRQ_ISA_5 50
49#define IRQ_ISA_7 51
50#define IRQ_ISA_9 52
51#define IRQ_ISA_10 53
52#define IRQ_ISA_11 54
53#define IRQ_ISA_14 55
54
55#define FIQ_INT9 0
56#define FIQ_INT5 1
57#define FIQ_INT6 4
58#define FIQ_INT8 6
59#define FIQ_FORCE 7
60
61/*
62 * This is the offset of the FIQ "IRQ" numbers
63 */
64#define FIQ_START 64
65
66#define IRQ_TIMER IRQ_TIMER0
diff --git a/arch/arm/mach-clps7500/include/mach/memory.h b/arch/arm/mach-clps7500/include/mach/memory.h
new file mode 100644
index 000000000000..3326aa99d3ec
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/memory.h
@@ -0,0 +1,35 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/memory.h
3 *
4 * Copyright (c) 1996,1997,1998 Russell King.
5 *
6 * Changelog:
7 * 20-Oct-1996 RMK Created
8 * 31-Dec-1997 RMK Fixed definitions to reduce warnings
9 * 11-Jan-1998 RMK Uninlined to reduce hits on cache
10 * 08-Feb-1998 RMK Added __virt_to_bus and __bus_to_virt
11 * 21-Mar-1999 RMK Renamed to memory.h
12 * RMK Added TASK_SIZE and PAGE_OFFSET
13 */
14#ifndef __ASM_ARCH_MEMORY_H
15#define __ASM_ARCH_MEMORY_H
16
17/*
18 * Physical DRAM offset.
19 */
20#define PHYS_OFFSET UL(0x10000000)
21
22/*
23 * These are exactly the same on the RiscPC as the
24 * physical memory view.
25 */
26#define __virt_to_bus(x) __virt_to_phys(x)
27#define __bus_to_virt(x) __phys_to_virt(x)
28
29/*
30 * Cache flushing area - ROM
31 */
32#define FLUSH_BASE_PHYS 0x00000000
33#define FLUSH_BASE 0xdf000000
34
35#endif
diff --git a/arch/arm/mach-clps7500/include/mach/system.h b/arch/arm/mach-clps7500/include/mach/system.h
new file mode 100644
index 000000000000..624fc2830ae0
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/system.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/system.h
3 *
4 * Copyright (c) 1999 Nexus Electronics Ltd.
5 */
6#ifndef __ASM_ARCH_SYSTEM_H
7#define __ASM_ARCH_SYSTEM_H
8
9#include <asm/hardware/iomd.h>
10#include <asm/io.h>
11
12static inline void arch_idle(void)
13{
14 iomd_writeb(0, IOMD_SUSMODE);
15}
16
17#define arch_reset(mode) \
18 do { \
19 iomd_writeb(0, IOMD_ROMCR0); \
20 cpu_reset(0); \
21 } while (0)
22
23#endif
diff --git a/arch/arm/mach-clps7500/include/mach/timex.h b/arch/arm/mach-clps7500/include/mach/timex.h
new file mode 100644
index 000000000000..dfaa9b425757
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/timex.h
@@ -0,0 +1,13 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/timex.h
3 *
4 * CL7500 architecture timex specifications
5 *
6 * Copyright (C) 1999 Nexus Electronics Ltd
7 */
8
9/*
10 * On the ARM7500, the clock ticks at 2MHz.
11 */
12#define CLOCK_TICK_RATE 2000000
13
diff --git a/arch/arm/mach-clps7500/include/mach/uncompress.h b/arch/arm/mach-clps7500/include/mach/uncompress.h
new file mode 100644
index 000000000000..d7d0af4b49fc
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/uncompress.h
@@ -0,0 +1,35 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/uncompress.h
3 *
4 * Copyright (C) 1999, 2000 Nexus Electronics Ltd.
5 */
6#define BASE 0x03010000
7#define SERBASE (BASE + (0x2f8 << 2))
8
9static inline void putc(char c)
10{
11 while (!(*((volatile unsigned int *)(SERBASE + 0x14)) & 0x20))
12 barrier();
13
14 *((volatile unsigned int *)(SERBASE)) = c;
15}
16
17static inline void flush(void)
18{
19}
20
21static __inline__ void arch_decomp_setup(void)
22{
23 int baud = 3686400 / (9600 * 32);
24
25 *((volatile unsigned int *)(SERBASE + 0xC)) = 0x80;
26 *((volatile unsigned int *)(SERBASE + 0x0)) = baud & 0xff;
27 *((volatile unsigned int *)(SERBASE + 0x4)) = (baud & 0xff00) >> 8;
28 *((volatile unsigned int *)(SERBASE + 0xC)) = 3; /* 8 bits */
29 *((volatile unsigned int *)(SERBASE + 0x10)) = 3; /* DTR, RTS */
30}
31
32/*
33 * nothing to do
34 */
35#define arch_decomp_wdog()
diff --git a/arch/arm/mach-clps7500/include/mach/vmalloc.h b/arch/arm/mach-clps7500/include/mach/vmalloc.h
new file mode 100644
index 000000000000..8fc5406d1b6d
--- /dev/null
+++ b/arch/arm/mach-clps7500/include/mach/vmalloc.h
@@ -0,0 +1,4 @@
1/*
2 * arch/arm/mach-clps7500/include/mach/vmalloc.h
3 */
4#define VMALLOC_END (PAGE_OFFSET + 0x1c000000)
diff --git a/arch/arm/mach-davinci/board-evm.c b/arch/arm/mach-davinci/board-evm.c
index 9e4024c4965f..134355787814 100644
--- a/arch/arm/mach-davinci/board-evm.c
+++ b/arch/arm/mach-davinci/board-evm.c
@@ -20,13 +20,13 @@
20#include <asm/setup.h> 20#include <asm/setup.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24 24
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/mach/flash.h> 27#include <asm/mach/flash.h>
28 28
29#include <asm/arch/common.h> 29#include <mach/common.h>
30 30
31/* other misc. init functions */ 31/* other misc. init functions */
32void __init davinci_psc_init(void); 32void __init davinci_psc_init(void);
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index c6b94f60e0b2..d46c69b55aaa 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -17,10 +17,10 @@
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/io.h> 21#include <asm/io.h>
22 22
23#include <asm/arch/psc.h> 23#include <mach/psc.h>
24#include "clock.h" 24#include "clock.h"
25 25
26/* PLL/Reset register offsets */ 26/* PLL/Reset register offsets */
diff --git a/arch/arm/mach-davinci/gpio.c b/arch/arm/mach-davinci/gpio.c
index 9c67886e7189..c9cb4f09b18f 100644
--- a/arch/arm/mach-davinci/gpio.c
+++ b/arch/arm/mach-davinci/gpio.c
@@ -20,9 +20,9 @@
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22 22
23#include <asm/arch/irqs.h> 23#include <mach/irqs.h>
24#include <asm/arch/hardware.h> 24#include <mach/hardware.h>
25#include <asm/arch/gpio.h> 25#include <mach/gpio.h>
26 26
27#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
28 28
diff --git a/arch/arm/mach-davinci/include/mach/clock.h b/arch/arm/mach-davinci/include/mach/clock.h
new file mode 100644
index 000000000000..38bdd49bc181
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/clock.h
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-davinci/include/mach/clock.h
3 *
4 * Clock control driver for DaVinci - header file
5 *
6 * Authors: Vladimir Barinov <source@mvista.com>
7 *
8 * 2007 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13#ifndef __ASM_ARCH_DAVINCI_CLOCK_H
14#define __ASM_ARCH_DAVINCI_CLOCK_H
15
16struct clk;
17
18extern int clk_register(struct clk *clk);
19extern void clk_unregister(struct clk *clk);
20extern int davinci_clk_init(void);
21
22#endif
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
new file mode 100644
index 000000000000..a97dfbb15e57
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -0,0 +1,19 @@
1/*
2 * Header for code common to all DaVinci machines.
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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 __ARCH_ARM_MACH_DAVINCI_COMMON_H
13#define __ARCH_ARM_MACH_DAVINCI_COMMON_H
14
15struct sys_timer;
16
17extern struct sys_timer davinci_timer;
18
19#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S b/arch/arm/mach-davinci/include/mach/debug-macro.S
new file mode 100644
index 000000000000..e6c0f0d5d062
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
@@ -0,0 +1,21 @@
1/*
2 * Debugging macro for DaVinci
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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 .macro addruart, rx
13 mrc p15, 0, \rx, c1, c0
14 tst \rx, #1 @ MMU enabled?
15 moveq \rx, #0x01000000 @ physical base address
16 movne \rx, #0xfe000000 @ virtual base
17 orr \rx, \rx, #0x00c20000 @ UART 0
18 .endm
19
20#define UART_SHIFT 2
21#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-davinci/include/mach/dma.h b/arch/arm/mach-davinci/include/mach/dma.h
new file mode 100644
index 000000000000..8e2f2d0ba667
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/dma.h
@@ -0,0 +1,16 @@
1/*
2 * DaVinci DMA definitions
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#define MAX_DMA_ADDRESS 0xffffffff
15
16#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-davinci/include/mach/entry-macro.S b/arch/arm/mach-davinci/include/mach/entry-macro.S
new file mode 100644
index 000000000000..039b84f933b3
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/entry-macro.S
@@ -0,0 +1,32 @@
1/*
2 * Low-level IRQ helper macros for TI DaVinci-based platforms
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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#include <mach/io.h>
12#include <mach/irqs.h>
13
14 .macro disable_fiq
15 .endm
16
17 .macro get_irqnr_preamble, base, tmp
18 ldr \base, =IO_ADDRESS(DAVINCI_ARM_INTC_BASE)
19 .endm
20
21 .macro arch_ret_to_user, tmp1, tmp2
22 .endm
23
24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
25 ldr \tmp, [\base, #0x14]
26 mov \tmp, \tmp, lsr #2
27 sub \irqnr, \tmp, #1
28 cmp \tmp, #0
29 .endm
30
31 .macro irq_prio_table
32 .endm
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
new file mode 100644
index 000000000000..ec151ccf1e8f
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/gpio.h
@@ -0,0 +1,159 @@
1/*
2 * TI DaVinci GPIO Support
3 *
4 * Copyright (c) 2006 David Brownell
5 * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef __DAVINCI_GPIO_H
14#define __DAVINCI_GPIO_H
15
16#include <linux/io.h>
17#include <mach/hardware.h>
18
19/*
20 * basic gpio routines
21 *
22 * board-specific init should be done by arch/.../.../board-XXX.c (maybe
23 * initializing banks together) rather than boot loaders; kexec() won't
24 * go through boot loaders.
25 *
26 * the gpio clock will be turned on when gpios are used, and you may also
27 * need to pay attention to PINMUX0 and PINMUX1 to be sure those pins are
28 * used as gpios, not with other peripherals.
29 *
30 * GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation, and maybe
31 * for later updates, code should write GPIO(N) or:
32 * - GPIOV18(N) for 1.8V pins, N in 0..53; same as GPIO(0)..GPIO(53)
33 * - GPIOV33(N) for 3.3V pins, N in 0..17; same as GPIO(54)..GPIO(70)
34 *
35 * For GPIO IRQs use gpio_to_irq(GPIO(N)) or gpio_to_irq(GPIOV33(N)) etc
36 * for now, that's != GPIO(N)
37 */
38#define GPIO(X) (X) /* 0 <= X <= 70 */
39#define GPIOV18(X) (X) /* 1.8V i/o; 0 <= X <= 53 */
40#define GPIOV33(X) ((X)+54) /* 3.3V i/o; 0 <= X <= 17 */
41
42struct gpio_controller {
43 u32 dir;
44 u32 out_data;
45 u32 set_data;
46 u32 clr_data;
47 u32 in_data;
48 u32 set_rising;
49 u32 clr_rising;
50 u32 set_falling;
51 u32 clr_falling;
52 u32 intstat;
53};
54
55/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
56 * with constant parameters; or in outlined code they execute at runtime.
57 *
58 * You'd access the controller directly when reading or writing more than
59 * one gpio value at a time, and to support wired logic where the value
60 * being driven by the cpu need not match the value read back.
61 *
62 * These are NOT part of the cross-platform GPIO interface
63 */
64static inline struct gpio_controller *__iomem
65__gpio_to_controller(unsigned gpio)
66{
67 void *__iomem ptr;
68
69 if (gpio < 32)
70 ptr = (void *__iomem)IO_ADDRESS(DAVINCI_GPIO_BASE + 0x10);
71 else if (gpio < 64)
72 ptr = (void *__iomem)IO_ADDRESS(DAVINCI_GPIO_BASE + 0x38);
73 else if (gpio < DAVINCI_N_GPIO)
74 ptr = (void *__iomem)IO_ADDRESS(DAVINCI_GPIO_BASE + 0x60);
75 else
76 ptr = NULL;
77 return ptr;
78}
79
80static inline u32 __gpio_mask(unsigned gpio)
81{
82 return 1 << (gpio % 32);
83}
84
85/* The get/set/clear functions will inline when called with constant
86 * parameters, for low-overhead bitbanging. Illegal constant parameters
87 * cause link-time errors.
88 *
89 * Otherwise, calls with variable parameters use outlined functions.
90 */
91extern int __error_inval_gpio(void);
92
93extern void __gpio_set(unsigned gpio, int value);
94extern int __gpio_get(unsigned gpio);
95
96static inline void gpio_set_value(unsigned gpio, int value)
97{
98 if (__builtin_constant_p(value)) {
99 struct gpio_controller *__iomem g;
100 u32 mask;
101
102 if (gpio >= DAVINCI_N_GPIO)
103 __error_inval_gpio();
104
105 g = __gpio_to_controller(gpio);
106 mask = __gpio_mask(gpio);
107 if (value)
108 __raw_writel(mask, &g->set_data);
109 else
110 __raw_writel(mask, &g->clr_data);
111 return;
112 }
113
114 __gpio_set(gpio, value);
115}
116
117/* Returns zero or nonzero; works for gpios configured as inputs OR
118 * as outputs.
119 *
120 * NOTE: changes in reported values are synchronized to the GPIO clock.
121 * This is most easily seen after calling gpio_set_value() and then immediatly
122 * gpio_get_value(), where the gpio_get_value() would return the old value
123 * until the GPIO clock ticks and the new value gets latched.
124 */
125
126static inline int gpio_get_value(unsigned gpio)
127{
128 struct gpio_controller *__iomem g;
129
130 if (!__builtin_constant_p(gpio))
131 return __gpio_get(gpio);
132
133 if (gpio >= DAVINCI_N_GPIO)
134 return __error_inval_gpio();
135
136 g = __gpio_to_controller(gpio);
137 return !!(__gpio_mask(gpio) & __raw_readl(&g->in_data));
138}
139
140/* powerup default direction is IN */
141extern int gpio_direction_input(unsigned gpio);
142extern int gpio_direction_output(unsigned gpio, int value);
143
144#include <asm-generic/gpio.h> /* cansleep wrappers */
145
146extern int gpio_request(unsigned gpio, const char *tag);
147extern void gpio_free(unsigned gpio);
148
149static inline int gpio_to_irq(unsigned gpio)
150{
151 return DAVINCI_N_AINTC_IRQ + gpio;
152}
153
154static inline int irq_to_gpio(unsigned irq)
155{
156 return irq - DAVINCI_N_AINTC_IRQ;
157}
158
159#endif /* __DAVINCI_GPIO_H */
diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h
new file mode 100644
index 000000000000..a2e8969afaca
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/hardware.h
@@ -0,0 +1,52 @@
1/*
2 * Common hardware definitions
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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#ifndef __ASM_ARCH_HARDWARE_H
12#define __ASM_ARCH_HARDWARE_H
13
14/*
15 * Base register addresses
16 */
17#define DAVINCI_DMA_3PCC_BASE (0x01C00000)
18#define DAVINCI_DMA_3PTC0_BASE (0x01C10000)
19#define DAVINCI_DMA_3PTC1_BASE (0x01C10400)
20#define DAVINCI_I2C_BASE (0x01C21000)
21#define DAVINCI_PWM0_BASE (0x01C22000)
22#define DAVINCI_PWM1_BASE (0x01C22400)
23#define DAVINCI_PWM2_BASE (0x01C22800)
24#define DAVINCI_SYSTEM_MODULE_BASE (0x01C40000)
25#define DAVINCI_PLL_CNTRL0_BASE (0x01C40800)
26#define DAVINCI_PLL_CNTRL1_BASE (0x01C40C00)
27#define DAVINCI_PWR_SLEEP_CNTRL_BASE (0x01C41000)
28#define DAVINCI_SYSTEM_DFT_BASE (0x01C42000)
29#define DAVINCI_IEEE1394_BASE (0x01C60000)
30#define DAVINCI_USB_OTG_BASE (0x01C64000)
31#define DAVINCI_CFC_ATA_BASE (0x01C66000)
32#define DAVINCI_SPI_BASE (0x01C66800)
33#define DAVINCI_GPIO_BASE (0x01C67000)
34#define DAVINCI_UHPI_BASE (0x01C67800)
35#define DAVINCI_VPSS_REGS_BASE (0x01C70000)
36#define DAVINCI_EMAC_CNTRL_REGS_BASE (0x01C80000)
37#define DAVINCI_EMAC_WRAPPER_CNTRL_REGS_BASE (0x01C81000)
38#define DAVINCI_EMAC_WRAPPER_RAM_BASE (0x01C82000)
39#define DAVINCI_MDIO_CNTRL_REGS_BASE (0x01C84000)
40#define DAVINCI_IMCOP_BASE (0x01CC0000)
41#define DAVINCI_ASYNC_EMIF_CNTRL_BASE (0x01E00000)
42#define DAVINCI_VLYNQ_BASE (0x01E01000)
43#define DAVINCI_MCBSP_BASE (0x01E02000)
44#define DAVINCI_MMC_SD_BASE (0x01E10000)
45#define DAVINCI_MS_BASE (0x01E20000)
46#define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE (0x02000000)
47#define DAVINCI_ASYNC_EMIF_DATA_CE1_BASE (0x04000000)
48#define DAVINCI_ASYNC_EMIF_DATA_CE2_BASE (0x06000000)
49#define DAVINCI_ASYNC_EMIF_DATA_CE3_BASE (0x08000000)
50#define DAVINCI_VLYNQ_REMOTE_BASE (0x0C000000)
51
52#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-davinci/include/mach/i2c.h b/arch/arm/mach-davinci/include/mach/i2c.h
new file mode 100644
index 000000000000..e2f54168abd1
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/i2c.h
@@ -0,0 +1,21 @@
1/*
2 * DaVinci I2C controller platfrom_device info
3 *
4 * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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
15/* All frequencies are expressed in kHz */
16struct davinci_i2c_platform_data {
17 unsigned int bus_freq; /* standard bus frequency */
18 unsigned int bus_delay; /* transaction delay */
19};
20
21#endif /* __ASM_ARCH_I2C_H */
diff --git a/arch/arm/mach-davinci/include/mach/io.h b/arch/arm/mach-davinci/include/mach/io.h
new file mode 100644
index 000000000000..e7accb910864
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/io.h
@@ -0,0 +1,79 @@
1/*
2 * DaVinci IO address definitions
3 *
4 * Copied from include/asm/arm/arch-omap/io.h
5 *
6 * 2007 (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#ifndef __ASM_ARCH_IO_H
12#define __ASM_ARCH_IO_H
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16/*
17 * ----------------------------------------------------------------------------
18 * I/O mapping
19 * ----------------------------------------------------------------------------
20 */
21#define IO_PHYS 0x01c00000
22#define IO_OFFSET 0xfd000000 /* Virtual IO = 0xfec00000 */
23#define IO_SIZE 0x00400000
24#define IO_VIRT (IO_PHYS + IO_OFFSET)
25#define io_p2v(pa) ((pa) + IO_OFFSET)
26#define io_v2p(va) ((va) - IO_OFFSET)
27#define IO_ADDRESS(x) io_p2v(x)
28
29/*
30 * We don't actually have real ISA nor PCI buses, but there is so many
31 * drivers out there that might just work if we fake them...
32 */
33#define PCIO_BASE 0
34#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
35#define __mem_pci(a) (a)
36#define __mem_isa(a) (a)
37
38#ifndef __ASSEMBLER__
39
40/*
41 * Functions to access the DaVinci IO region
42 *
43 * NOTE: - Use davinci_read/write[bwl] for physical register addresses
44 * - Use __raw_read/write[bwl]() for virtual register addresses
45 * - Use IO_ADDRESS(phys_addr) to convert registers to virtual addresses
46 * - DO NOT use hardcoded virtual addresses to allow changing the
47 * IO address space again if needed
48 */
49#define davinci_readb(a) (*(volatile unsigned char *)IO_ADDRESS(a))
50#define davinci_readw(a) (*(volatile unsigned short *)IO_ADDRESS(a))
51#define davinci_readl(a) (*(volatile unsigned int *)IO_ADDRESS(a))
52
53#define davinci_writeb(v,a) (*(volatile unsigned char *)IO_ADDRESS(a) = (v))
54#define davinci_writew(v,a) (*(volatile unsigned short *)IO_ADDRESS(a) = (v))
55#define davinci_writel(v,a) (*(volatile unsigned int *)IO_ADDRESS(a) = (v))
56
57/* 16 bit uses LDRH/STRH, base +/- offset_8 */
58typedef struct { volatile u16 offset[256]; } __regbase16;
59#define __REGV16(vaddr) ((__regbase16 *)((vaddr)&~0xff)) \
60 ->offset[((vaddr)&0xff)>>1]
61#define __REG16(paddr) __REGV16(io_p2v(paddr))
62
63/* 8/32 bit uses LDR/STR, base +/- offset_12 */
64typedef struct { volatile u8 offset[4096]; } __regbase8;
65#define __REGV8(vaddr) ((__regbase8 *)((vaddr)&~4095)) \
66 ->offset[((vaddr)&4095)>>0]
67#define __REG8(paddr) __REGV8(io_p2v(paddr))
68
69typedef struct { volatile u32 offset[4096]; } __regbase32;
70#define __REGV32(vaddr) ((__regbase32 *)((vaddr)&~4095)) \
71 ->offset[((vaddr)&4095)>>2]
72
73#define __REG(paddr) __REGV32(io_p2v(paddr))
74#else
75
76#define __REG(x) (*((volatile unsigned long *)io_p2v(x)))
77
78#endif /* __ASSEMBLER__ */
79#endif /* __ASM_ARCH_IO_H */
diff --git a/arch/arm/mach-davinci/include/mach/irqs.h b/arch/arm/mach-davinci/include/mach/irqs.h
new file mode 100644
index 000000000000..f4c5ca6da9f4
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/irqs.h
@@ -0,0 +1,105 @@
1/*
2 * DaVinci interrupt controller definitions
3 *
4 * Copyright (C) 2006 Texas Instruments.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 */
27#ifndef __ASM_ARCH_IRQS_H
28#define __ASM_ARCH_IRQS_H
29
30/* Base address */
31#define DAVINCI_ARM_INTC_BASE 0x01C48000
32
33/* Interrupt lines */
34#define IRQ_VDINT0 0
35#define IRQ_VDINT1 1
36#define IRQ_VDINT2 2
37#define IRQ_HISTINT 3
38#define IRQ_H3AINT 4
39#define IRQ_PRVUINT 5
40#define IRQ_RSZINT 6
41#define IRQ_VFOCINT 7
42#define IRQ_VENCINT 8
43#define IRQ_ASQINT 9
44#define IRQ_IMXINT 10
45#define IRQ_VLCDINT 11
46#define IRQ_USBINT 12
47#define IRQ_EMACINT 13
48
49#define IRQ_CCINT0 16
50#define IRQ_CCERRINT 17
51#define IRQ_TCERRINT0 18
52#define IRQ_TCERRINT 19
53#define IRQ_PSCIN 20
54
55#define IRQ_IDE 22
56#define IRQ_HPIINT 23
57#define IRQ_MBXINT 24
58#define IRQ_MBRINT 25
59#define IRQ_MMCINT 26
60#define IRQ_SDIOINT 27
61#define IRQ_MSINT 28
62#define IRQ_DDRINT 29
63#define IRQ_AEMIFINT 30
64#define IRQ_VLQINT 31
65#define IRQ_TINT0_TINT12 32
66#define IRQ_TINT0_TINT34 33
67#define IRQ_TINT1_TINT12 34
68#define IRQ_TINT1_TINT34 35
69#define IRQ_PWMINT0 36
70#define IRQ_PWMINT1 37
71#define IRQ_PWMINT2 38
72#define IRQ_I2C 39
73#define IRQ_UARTINT0 40
74#define IRQ_UARTINT1 41
75#define IRQ_UARTINT2 42
76#define IRQ_SPINT0 43
77#define IRQ_SPINT1 44
78
79#define IRQ_DSP2ARM0 46
80#define IRQ_DSP2ARM1 47
81#define IRQ_GPIO0 48
82#define IRQ_GPIO1 49
83#define IRQ_GPIO2 50
84#define IRQ_GPIO3 51
85#define IRQ_GPIO4 52
86#define IRQ_GPIO5 53
87#define IRQ_GPIO6 54
88#define IRQ_GPIO7 55
89#define IRQ_GPIOBNK0 56
90#define IRQ_GPIOBNK1 57
91#define IRQ_GPIOBNK2 58
92#define IRQ_GPIOBNK3 59
93#define IRQ_GPIOBNK4 60
94#define IRQ_COMMTX 61
95#define IRQ_COMMRX 62
96#define IRQ_EMUINT 63
97
98#define DAVINCI_N_AINTC_IRQ 64
99#define DAVINCI_N_GPIO 71
100
101#define NR_IRQS (DAVINCI_N_AINTC_IRQ + DAVINCI_N_GPIO)
102
103#define ARCH_TIMER_IRQ IRQ_TINT1_TINT34
104
105#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-davinci/include/mach/memory.h b/arch/arm/mach-davinci/include/mach/memory.h
new file mode 100644
index 000000000000..dd1625c23cf4
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/memory.h
@@ -0,0 +1,64 @@
1/*
2 * DaVinci memory space definitions
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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#ifndef __ASM_ARCH_MEMORY_H
12#define __ASM_ARCH_MEMORY_H
13
14/**************************************************************************
15 * Included Files
16 **************************************************************************/
17#include <asm/page.h>
18#include <asm/sizes.h>
19
20/**************************************************************************
21 * Definitions
22 **************************************************************************/
23#define DAVINCI_DDR_BASE 0x80000000
24#define DAVINCI_IRAM_BASE 0x00008000 /* ARM Internal RAM */
25
26#define PHYS_OFFSET DAVINCI_DDR_BASE
27
28/*
29 * Increase size of DMA-consistent memory region
30 */
31#define CONSISTENT_DMA_SIZE (14<<20)
32
33#ifndef __ASSEMBLY__
34/*
35 * Restrict DMA-able region to workaround silicon bug. The bug
36 * restricts buffers available for DMA to video hardware to be
37 * below 128M
38 */
39static inline void
40__arch_adjust_zones(int node, unsigned long *size, unsigned long *holes)
41{
42 unsigned int sz = (128<<20) >> PAGE_SHIFT;
43
44 if (node != 0)
45 sz = 0;
46
47 size[1] = size[0] - sz;
48 size[0] = sz;
49}
50
51#define arch_adjust_zones(node, zone_size, holes) \
52 if ((meminfo.bank[0].size >> 20) > 128) __arch_adjust_zones(node, zone_size, holes)
53
54#define ISA_DMA_THRESHOLD (PHYS_OFFSET + (128<<20) - 1)
55
56#endif
57
58/*
59 * Bus address is physical address
60 */
61#define __virt_to_bus(x) __virt_to_phys(x)
62#define __bus_to_virt(x) __phys_to_virt(x)
63
64#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
new file mode 100644
index 000000000000..c24b6782804d
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -0,0 +1,55 @@
1/*
2 * DaVinci pin multiplexing defines
3 *
4 * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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#ifndef __ASM_ARCH_MUX_H
12#define __ASM_ARCH_MUX_H
13
14#define DAVINCI_MUX_AEAW0 0
15#define DAVINCI_MUX_AEAW1 1
16#define DAVINCI_MUX_AEAW2 2
17#define DAVINCI_MUX_AEAW3 3
18#define DAVINCI_MUX_AEAW4 4
19#define DAVINCI_MUX_AECS4 10
20#define DAVINCI_MUX_AECS5 11
21#define DAVINCI_MUX_VLYNQWD0 12
22#define DAVINCI_MUX_VLYNQWD1 13
23#define DAVINCI_MUX_VLSCREN 14
24#define DAVINCI_MUX_VLYNQEN 15
25#define DAVINCI_MUX_HDIREN 16
26#define DAVINCI_MUX_ATAEN 17
27#define DAVINCI_MUX_RGB666 22
28#define DAVINCI_MUX_RGB888 23
29#define DAVINCI_MUX_LOEEN 24
30#define DAVINCI_MUX_LFLDEN 25
31#define DAVINCI_MUX_CWEN 26
32#define DAVINCI_MUX_CFLDEN 27
33#define DAVINCI_MUX_HPIEN 29
34#define DAVINCI_MUX_1394EN 30
35#define DAVINCI_MUX_EMACEN 31
36
37#define DAVINCI_MUX_LEVEL2 32
38#define DAVINCI_MUX_UART0 (DAVINCI_MUX_LEVEL2 + 0)
39#define DAVINCI_MUX_UART1 (DAVINCI_MUX_LEVEL2 + 1)
40#define DAVINCI_MUX_UART2 (DAVINCI_MUX_LEVEL2 + 2)
41#define DAVINCI_MUX_U2FLO (DAVINCI_MUX_LEVEL2 + 3)
42#define DAVINCI_MUX_PWM0 (DAVINCI_MUX_LEVEL2 + 4)
43#define DAVINCI_MUX_PWM1 (DAVINCI_MUX_LEVEL2 + 5)
44#define DAVINCI_MUX_PWM2 (DAVINCI_MUX_LEVEL2 + 6)
45#define DAVINCI_MUX_I2C (DAVINCI_MUX_LEVEL2 + 7)
46#define DAVINCI_MUX_SPI (DAVINCI_MUX_LEVEL2 + 8)
47#define DAVINCI_MUX_MSTK (DAVINCI_MUX_LEVEL2 + 9)
48#define DAVINCI_MUX_ASP (DAVINCI_MUX_LEVEL2 + 10)
49#define DAVINCI_MUX_CLK0 (DAVINCI_MUX_LEVEL2 + 16)
50#define DAVINCI_MUX_CLK1 (DAVINCI_MUX_LEVEL2 + 17)
51#define DAVINCI_MUX_TIMIN (DAVINCI_MUX_LEVEL2 + 18)
52
53extern void davinci_mux_peripheral(unsigned int mux, unsigned int enable);
54
55#endif /* __ASM_ARCH_MUX_H */
diff --git a/arch/arm/mach-davinci/include/mach/psc.h b/arch/arm/mach-davinci/include/mach/psc.h
new file mode 100644
index 000000000000..4977aa071e1e
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/psc.h
@@ -0,0 +1,76 @@
1/*
2 * DaVinci Power & Sleep Controller (PSC) defines
3 *
4 * Copyright (C) 2006 Texas Instruments.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 */
27#ifndef __ASM_ARCH_PSC_H
28#define __ASM_ARCH_PSC_H
29
30/* Power and Sleep Controller (PSC) Domains */
31#define DAVINCI_GPSC_ARMDOMAIN 0
32#define DAVINCI_GPSC_DSPDOMAIN 1
33
34#define DAVINCI_LPSC_VPSSMSTR 0
35#define DAVINCI_LPSC_VPSSSLV 1
36#define DAVINCI_LPSC_TPCC 2
37#define DAVINCI_LPSC_TPTC0 3
38#define DAVINCI_LPSC_TPTC1 4
39#define DAVINCI_LPSC_EMAC 5
40#define DAVINCI_LPSC_EMAC_WRAPPER 6
41#define DAVINCI_LPSC_MDIO 7
42#define DAVINCI_LPSC_IEEE1394 8
43#define DAVINCI_LPSC_USB 9
44#define DAVINCI_LPSC_ATA 10
45#define DAVINCI_LPSC_VLYNQ 11
46#define DAVINCI_LPSC_UHPI 12
47#define DAVINCI_LPSC_DDR_EMIF 13
48#define DAVINCI_LPSC_AEMIF 14
49#define DAVINCI_LPSC_MMC_SD 15
50#define DAVINCI_LPSC_MEMSTICK 16
51#define DAVINCI_LPSC_McBSP 17
52#define DAVINCI_LPSC_I2C 18
53#define DAVINCI_LPSC_UART0 19
54#define DAVINCI_LPSC_UART1 20
55#define DAVINCI_LPSC_UART2 21
56#define DAVINCI_LPSC_SPI 22
57#define DAVINCI_LPSC_PWM0 23
58#define DAVINCI_LPSC_PWM1 24
59#define DAVINCI_LPSC_PWM2 25
60#define DAVINCI_LPSC_GPIO 26
61#define DAVINCI_LPSC_TIMER0 27
62#define DAVINCI_LPSC_TIMER1 28
63#define DAVINCI_LPSC_TIMER2 29
64#define DAVINCI_LPSC_SYSTEM_SUBSYS 30
65#define DAVINCI_LPSC_ARM 31
66#define DAVINCI_LPSC_SCR2 32
67#define DAVINCI_LPSC_SCR3 33
68#define DAVINCI_LPSC_SCR4 34
69#define DAVINCI_LPSC_CROSSBAR 35
70#define DAVINCI_LPSC_CFG27 36
71#define DAVINCI_LPSC_CFG3 37
72#define DAVINCI_LPSC_CFG5 38
73#define DAVINCI_LPSC_GEM 39
74#define DAVINCI_LPSC_IMCOP 40
75
76#endif /* __ASM_ARCH_PSC_H */
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h
new file mode 100644
index 000000000000..fb8cb229bfd2
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -0,0 +1,20 @@
1/*
2 * DaVinci serial device definitions
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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#ifndef __ASM_ARCH_SERIAL_H
12#define __ASM_ARCH_SERIAL_H
13
14#include <mach/io.h>
15
16#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000)
17#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400)
18#define DAVINCI_UART2_BASE (IO_PHYS + 0x20800)
19
20#endif /* __ASM_ARCH_SERIAL_H */
diff --git a/arch/arm/mach-davinci/include/mach/system.h b/arch/arm/mach-davinci/include/mach/system.h
new file mode 100644
index 000000000000..84ff77aeb738
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/system.h
@@ -0,0 +1,29 @@
1/*
2 * DaVinci system defines
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H
13
14#include <asm/io.h>
15#include <mach/hardware.h>
16
17extern void davinci_watchdog_reset(void);
18
19static void arch_idle(void)
20{
21 cpu_do_idle();
22}
23
24static void arch_reset(char mode)
25{
26 davinci_watchdog_reset();
27}
28
29#endif /* __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-davinci/include/mach/timex.h b/arch/arm/mach-davinci/include/mach/timex.h
new file mode 100644
index 000000000000..52827567841d
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/timex.h
@@ -0,0 +1,17 @@
1/*
2 * DaVinci timer defines
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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#ifndef __ASM_ARCH_TIMEX_H
12#define __ASM_ARCH_TIMEX_H
13
14/* The source frequency for the timers is the 27MHz clock */
15#define CLOCK_TICK_RATE 27000000
16
17#endif /* __ASM_ARCH_TIMEX_H__ */
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h
new file mode 100644
index 000000000000..8c165def37b6
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
@@ -0,0 +1,35 @@
1/*
2 * Serial port stubs for kernel decompress status messages
3 *
4 * Author: Anant Gole
5 * (C) Copyright (C) 2006, Texas Instruments, Inc
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#include <linux/types.h>
13#include <linux/serial_reg.h>
14#include <mach/serial.h>
15
16/* PORT_16C550A, in polled non-fifo mode */
17
18static void putc(char c)
19{
20 volatile u32 *uart = (volatile void *) DAVINCI_UART0_BASE;
21
22 while (!(uart[UART_LSR] & UART_LSR_THRE))
23 barrier();
24 uart[UART_TX] = c;
25}
26
27static inline void flush(void)
28{
29 volatile u32 *uart = (volatile void *) DAVINCI_UART0_BASE;
30 while (!(uart[UART_LSR] & UART_LSR_THRE))
31 barrier();
32}
33
34#define arch_decomp_setup()
35#define arch_decomp_wdog()
diff --git a/arch/arm/mach-davinci/include/mach/vmalloc.h b/arch/arm/mach-davinci/include/mach/vmalloc.h
new file mode 100644
index 000000000000..b98bd9e92fd6
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/vmalloc.h
@@ -0,0 +1,15 @@
1/*
2 * DaVinci vmalloc definitions
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (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#include <asm/memory.h>
12#include <mach/io.h>
13
14/* Allow vmalloc range until the IO virtual range minus a 2M "hole" */
15#define VMALLOC_END (IO_VIRT - (2<<20))
diff --git a/arch/arm/mach-davinci/io.c b/arch/arm/mach-davinci/io.c
index 47787ff84a6a..5bb66b61c1a3 100644
--- a/arch/arm/mach-davinci/io.c
+++ b/arch/arm/mach-davinci/io.c
@@ -17,7 +17,7 @@
17#include <asm/memory.h> 17#include <asm/memory.h>
18 18
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20#include <asm/arch/clock.h> 20#include <mach/clock.h>
21 21
22extern void davinci_check_revision(void); 22extern void davinci_check_revision(void);
23 23
diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c
index 1333d84d2e45..12ca9f29f847 100644
--- a/arch/arm/mach-davinci/irq.c
+++ b/arch/arm/mach-davinci/irq.c
@@ -23,7 +23,7 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
diff --git a/arch/arm/mach-davinci/mux.c b/arch/arm/mach-davinci/mux.c
index 92d26bd305b7..8ff9d8aca60b 100644
--- a/arch/arm/mach-davinci/mux.c
+++ b/arch/arm/mach-davinci/mux.c
@@ -11,9 +11,9 @@
11#include <linux/io.h> 11#include <linux/io.h>
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13 13
14#include <asm/hardware.h> 14#include <mach/hardware.h>
15 15
16#include <asm/arch/mux.h> 16#include <mach/mux.h>
17 17
18/* System control register offsets */ 18/* System control register offsets */
19#define PINMUX0 0x00 19#define PINMUX0 0x00
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index 1334416559ad..720c48b9ee04 100644
--- a/arch/arm/mach-davinci/psc.c
+++ b/arch/arm/mach-davinci/psc.c
@@ -23,9 +23,9 @@
23#include <linux/init.h> 23#include <linux/init.h>
24 24
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/arch/psc.h> 27#include <mach/psc.h>
28#include <asm/arch/mux.h> 28#include <mach/mux.h>
29 29
30/* PSC register offsets */ 30/* PSC register offsets */
31#define EPCPR 0x070 31#define EPCPR 0x070
diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c
index 8368c93c788d..caf101e2cc62 100644
--- a/arch/arm/mach-davinci/serial.c
+++ b/arch/arm/mach-davinci/serial.c
@@ -29,9 +29,9 @@
29 29
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/arch/serial.h> 33#include <mach/serial.h>
34#include <asm/arch/irqs.h> 34#include <mach/irqs.h>
35 35
36#define UART_DAVINCI_PWREMU 0x0c 36#define UART_DAVINCI_PWREMU 0x0c
37 37
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index e96a3dcdc1a7..206e80d41717 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -17,13 +17,13 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18 18
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/system.h> 21#include <asm/system.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <asm/errno.h> 25#include <asm/errno.h>
26#include <asm/arch/io.h> 26#include <mach/io.h>
27 27
28static struct clock_event_device clockevent_davinci; 28static struct clock_event_device clockevent_davinci;
29 29
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 7710e14b5268..65cc7c271917 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -15,7 +15,7 @@
15#include <linux/serial_8250.h> 15#include <linux/serial_8250.h>
16#include <linux/init.h> 16#include <linux/init.h>
17 17
18#include <asm/hardware.h> 18#include <mach/hardware.h>
19#include <asm/irq.h> 19#include <asm/irq.h>
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/setup.h> 21#include <asm/setup.h>
diff --git a/arch/arm/mach-ebsa110/include/mach/debug-macro.S b/arch/arm/mach-ebsa110/include/mach/debug-macro.S
new file mode 100644
index 000000000000..1dde8227f3a2
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/debug-macro.S
@@ -0,0 +1,21 @@
1/* arch/arm/mach-ebsa110/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 .macro addruart,rx
15 mov \rx, #0xf0000000
16 orr \rx, \rx, #0x00000be0
17 .endm
18
19#define UART_SHIFT 2
20#define FLOW_CONTROL
21#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-ebsa110/include/mach/dma.h b/arch/arm/mach-ebsa110/include/mach/dma.h
new file mode 100644
index 000000000000..780a04c8bbe9
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/dma.h
@@ -0,0 +1,11 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/dma.h
3 *
4 * Copyright (C) 1997,1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * EBSA110 DMA definitions
11 */
diff --git a/arch/arm/mach-ebsa110/include/mach/entry-macro.S b/arch/arm/mach-ebsa110/include/mach/entry-macro.S
new file mode 100644
index 000000000000..cc3e5992f6b3
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/entry-macro.S
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for ebsa110 platform.
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
12
13#define IRQ_STAT 0xff000000 /* read */
14
15 .macro disable_fiq
16 .endm
17
18 .macro get_irqnr_preamble, base, tmp
19 mov \base, #IRQ_STAT
20 .endm
21
22 .macro arch_ret_to_user, tmp1, tmp2
23 .endm
24
25 .macro get_irqnr_and_base, irqnr, stat, base, tmp
26 ldrb \stat, [\base] @ get interrupts
27 mov \irqnr, #0
28 tst \stat, #15
29 addeq \irqnr, \irqnr, #4
30 moveq \stat, \stat, lsr #4
31 tst \stat, #3
32 addeq \irqnr, \irqnr, #2
33 moveq \stat, \stat, lsr #2
34 tst \stat, #1
35 addeq \irqnr, \irqnr, #1
36 moveq \stat, \stat, lsr #1
37 tst \stat, #1 @ bit 0 should be set
38 .endm
39
diff --git a/arch/arm/mach-ebsa110/include/mach/hardware.h b/arch/arm/mach-ebsa110/include/mach/hardware.h
new file mode 100644
index 000000000000..4b2fb7743909
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/hardware.h
@@ -0,0 +1,63 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/hardware.h
3 *
4 * Copyright (C) 1996-2000 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This file contains the hardware definitions of the EBSA-110.
11 */
12#ifndef __ASM_ARCH_HARDWARE_H
13#define __ASM_ARCH_HARDWARE_H
14
15/*
16 * The EBSA110 has a weird "ISA IO" region:
17 *
18 * Region 0 (addr = 0xf0000000 + io << 2)
19 * --------------------------------------------------------
20 * Physical region IO region
21 * f0000fe0 - f0000ffc 3f8 - 3ff ttyS0
22 * f0000e60 - f0000e64 398 - 399
23 * f0000de0 - f0000dfc 378 - 37f lp0
24 * f0000be0 - f0000bfc 2f8 - 2ff ttyS1
25 *
26 * Region 1 (addr = 0xf0000000 + (io & ~1) << 1 + (io & 1))
27 * --------------------------------------------------------
28 * Physical region IO region
29 * f00014f1 a79 pnp write data
30 * f00007c0 - f00007c1 3e0 - 3e1 pcmcia
31 * f00004f1 279 pnp address
32 * f0000440 - f000046c 220 - 236 eth0
33 * f0000405 203 pnp read data
34 */
35
36#define ISAMEM_PHYS 0xe0000000
37#define ISAMEM_SIZE 0x10000000
38
39#define ISAIO_PHYS 0xf0000000
40#define ISAIO_SIZE PGDIR_SIZE
41
42#define TRICK0_PHYS 0xf2000000
43#define TRICK1_PHYS 0xf2400000
44#define TRICK2_PHYS 0xf2800000
45#define TRICK3_PHYS 0xf2c00000
46#define TRICK4_PHYS 0xf3000000
47#define TRICK5_PHYS 0xf3400000
48#define TRICK6_PHYS 0xf3800000
49#define TRICK7_PHYS 0xf3c00000
50
51#define ISAMEM_BASE 0xe0000000
52#define ISAIO_BASE 0xf0000000
53
54#define PIT_BASE 0xfc000000
55#define SOFT_BASE 0xfd000000
56
57/*
58 * RAM definitions
59 */
60#define UNCACHEABLE_ADDR 0xff000000 /* IRQ_STAT */
61
62#endif
63
diff --git a/arch/arm/mach-ebsa110/include/mach/io.h b/arch/arm/mach-ebsa110/include/mach/io.h
new file mode 100644
index 000000000000..f68daa632af0
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/io.h
@@ -0,0 +1,92 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/io.h
3 *
4 * Copyright (C) 1997,1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Modifications:
11 * 06-Dec-1997 RMK Created.
12 */
13#ifndef __ASM_ARM_ARCH_IO_H
14#define __ASM_ARM_ARCH_IO_H
15
16#define IO_SPACE_LIMIT 0xffff
17
18u8 __inb8(unsigned int port);
19void __outb8(u8 val, unsigned int port);
20
21u8 __inb16(unsigned int port);
22void __outb16(u8 val, unsigned int port);
23
24u16 __inw(unsigned int port);
25void __outw(u16 val, unsigned int port);
26
27u32 __inl(unsigned int port);
28void __outl(u32 val, unsigned int port);
29
30u8 __readb(const volatile void __iomem *addr);
31u16 __readw(const volatile void __iomem *addr);
32u32 __readl(const volatile void __iomem *addr);
33
34void __writeb(u8 val, void __iomem *addr);
35void __writew(u16 val, void __iomem *addr);
36void __writel(u32 val, void __iomem *addr);
37
38/*
39 * Argh, someone forgot the IOCS16 line. We therefore have to handle
40 * the byte stearing by selecting the correct byte IO functions here.
41 */
42#ifdef ISA_SIXTEEN_BIT_PERIPHERAL
43#define inb(p) __inb16(p)
44#define outb(v,p) __outb16(v,p)
45#else
46#define inb(p) __inb8(p)
47#define outb(v,p) __outb8(v,p)
48#endif
49
50#define inw(p) __inw(p)
51#define outw(v,p) __outw(v,p)
52
53#define inl(p) __inl(p)
54#define outl(v,p) __outl(v,p)
55
56#define readb(b) __readb(b)
57#define readw(b) __readw(b)
58#define readl(b) __readl(b)
59#define readb_relaxed(addr) readb(addr)
60#define readw_relaxed(addr) readw(addr)
61#define readl_relaxed(addr) readl(addr)
62
63#define writeb(v,b) __writeb(v,b)
64#define writew(v,b) __writew(v,b)
65#define writel(v,b) __writel(v,b)
66
67static inline void __iomem *__arch_ioremap(unsigned long cookie, size_t size,
68 unsigned int flags)
69{
70 return (void __iomem *)cookie;
71}
72
73#define __arch_ioremap __arch_ioremap
74#define __arch_iounmap(cookie) do { } while (0)
75
76extern void insb(unsigned int port, void *buf, int sz);
77extern void insw(unsigned int port, void *buf, int sz);
78extern void insl(unsigned int port, void *buf, int sz);
79
80extern void outsb(unsigned int port, const void *buf, int sz);
81extern void outsw(unsigned int port, const void *buf, int sz);
82extern void outsl(unsigned int port, const void *buf, int sz);
83
84/* can't support writesb atm */
85extern void writesw(void __iomem *addr, const void *data, int wordlen);
86extern void writesl(void __iomem *addr, const void *data, int longlen);
87
88/* can't support readsb atm */
89extern void readsw(const void __iomem *addr, void *data, int wordlen);
90extern void readsl(const void __iomem *addr, void *data, int longlen);
91
92#endif
diff --git a/arch/arm/mach-ebsa110/include/mach/irqs.h b/arch/arm/mach-ebsa110/include/mach/irqs.h
new file mode 100644
index 000000000000..a8f3771bc060
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/irqs.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/irqs.h
3 *
4 * Copyright (C) 1996 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#define NR_IRQS 8
12
13#define IRQ_EBSA110_PRINTER 0
14#define IRQ_EBSA110_COM1 1
15#define IRQ_EBSA110_COM2 2
16#define IRQ_EBSA110_ETHERNET 3
17#define IRQ_EBSA110_TIMER0 4
18#define IRQ_EBSA110_TIMER1 5
19#define IRQ_EBSA110_PCMCIA 6
20#define IRQ_EBSA110_IMMEDIATE 7
diff --git a/arch/arm/mach-ebsa110/include/mach/memory.h b/arch/arm/mach-ebsa110/include/mach/memory.h
new file mode 100644
index 000000000000..eea4b75b657b
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/memory.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/memory.h
3 *
4 * Copyright (C) 1996-1999 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Changelog:
11 * 20-Oct-1996 RMK Created
12 * 31-Dec-1997 RMK Fixed definitions to reduce warnings
13 * 21-Mar-1999 RMK Renamed to memory.h
14 * RMK Moved TASK_SIZE and PAGE_OFFSET here
15 */
16#ifndef __ASM_ARCH_MEMORY_H
17#define __ASM_ARCH_MEMORY_H
18
19/*
20 * Physical DRAM offset.
21 */
22#define PHYS_OFFSET UL(0x00000000)
23
24/*
25 * We keep this 1:1 so that we don't interfere
26 * with the PCMCIA memory regions
27 */
28#define __virt_to_bus(x) (x)
29#define __bus_to_virt(x) (x)
30
31/*
32 * Cache flushing area - SRAM
33 */
34#define FLUSH_BASE_PHYS 0x40000000
35#define FLUSH_BASE 0xdf000000
36
37#endif
diff --git a/arch/arm/mach-ebsa110/include/mach/system.h b/arch/arm/mach-ebsa110/include/mach/system.h
new file mode 100644
index 000000000000..350a028997ef
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/system.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/system.h
3 *
4 * Copyright (C) 1996-2000 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARCH_SYSTEM_H
11#define __ASM_ARCH_SYSTEM_H
12
13/*
14 * EBSA110 idling methodology:
15 *
16 * We can not execute the "wait for interrupt" instruction since that
17 * will stop our MCLK signal (which provides the clock for the glue
18 * logic, and therefore the timer interrupt).
19 *
20 * Instead, we spin, polling the IRQ_STAT register for the occurrence
21 * of any interrupt with core clock down to the memory clock.
22 */
23static inline void arch_idle(void)
24{
25 const char *irq_stat = (char *)0xff000000;
26
27 /* disable clock switching */
28 asm volatile ("mcr p15, 0, ip, c15, c2, 2" : : : "cc");
29
30 /* wait for an interrupt to occur */
31 while (!*irq_stat);
32
33 /* enable clock switching */
34 asm volatile ("mcr p15, 0, ip, c15, c1, 2" : : : "cc");
35}
36
37#define arch_reset(mode) cpu_reset(0x80000000)
38
39#endif
diff --git a/arch/arm/mach-ebsa110/include/mach/timex.h b/arch/arm/mach-ebsa110/include/mach/timex.h
new file mode 100644
index 000000000000..4fb43b22a102
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/timex.h
@@ -0,0 +1,19 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/timex.h
3 *
4 * Copyright (C) 1997, 1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * EBSA110 architecture timex specifications
11 */
12
13/*
14 * On the EBSA, the clock ticks at weird rates.
15 * This is therefore not used to calculate the
16 * divisor.
17 */
18#define CLOCK_TICK_RATE 47894000
19
diff --git a/arch/arm/mach-ebsa110/include/mach/uncompress.h b/arch/arm/mach-ebsa110/include/mach/uncompress.h
new file mode 100644
index 000000000000..32041509fbf8
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/uncompress.h
@@ -0,0 +1,45 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/uncompress.h
3 *
4 * Copyright (C) 1996,1997,1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/serial_reg.h>
12
13#define SERIAL_BASE ((unsigned char *)0xf0000be0)
14
15/*
16 * This does not append a newline
17 */
18static inline void putc(int c)
19{
20 unsigned char v, *base = SERIAL_BASE;
21
22 do {
23 v = base[UART_LSR << 2];
24 barrier();
25 } while (!(v & UART_LSR_THRE));
26
27 base[UART_TX << 2] = c;
28}
29
30static inline void flush(void)
31{
32 unsigned char v, *base = SERIAL_BASE;
33
34 do {
35 v = base[UART_LSR << 2];
36 barrier();
37 } while ((v & (UART_LSR_TEMT|UART_LSR_THRE)) !=
38 (UART_LSR_TEMT|UART_LSR_THRE));
39}
40
41/*
42 * nothing to do
43 */
44#define arch_decomp_setup()
45#define arch_decomp_wdog()
diff --git a/arch/arm/mach-ebsa110/include/mach/vmalloc.h b/arch/arm/mach-ebsa110/include/mach/vmalloc.h
new file mode 100644
index 000000000000..9b44c19e95ec
--- /dev/null
+++ b/arch/arm/mach-ebsa110/include/mach/vmalloc.h
@@ -0,0 +1,10 @@
1/*
2 * arch/arm/mach-ebsa110/include/mach/vmalloc.h
3 *
4 * Copyright (C) 1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#define VMALLOC_END (PAGE_OFFSET + 0x1f000000)
diff --git a/arch/arm/mach-ebsa110/io.c b/arch/arm/mach-ebsa110/io.c
index 6b2380e153ef..53748f5462e9 100644
--- a/arch/arm/mach-ebsa110/io.c
+++ b/arch/arm/mach-ebsa110/io.c
@@ -24,7 +24,7 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/types.h> 25#include <linux/types.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/page.h> 29#include <asm/page.h>
30 30
diff --git a/arch/arm/mach-ebsa110/leds.c b/arch/arm/mach-ebsa110/leds.c
index 3bc8c5e708e6..6a6ea57c2a4e 100644
--- a/arch/arm/mach-ebsa110/leds.c
+++ b/arch/arm/mach-ebsa110/leds.c
@@ -15,7 +15,7 @@
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/init.h> 16#include <linux/init.h>
17 17
18#include <asm/hardware.h> 18#include <mach/hardware.h>
19#include <asm/leds.h> 19#include <asm/leds.h>
20#include <asm/system.h> 20#include <asm/system.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
diff --git a/arch/arm/mach-ep93xx/adssphere.c b/arch/arm/mach-ep93xx/adssphere.c
index ac5d5818eb7b..aa1fb352fb8f 100644
--- a/arch/arm/mach-ep93xx/adssphere.c
+++ b/arch/arm/mach-ep93xx/adssphere.c
@@ -19,7 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25 25
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index f62c35500bb7..6062e47f2043 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -16,7 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <asm/div64.h> 18#include <asm/div64.h>
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20#include <asm/io.h> 20#include <asm/io.h>
21 21
22struct clk { 22struct clk {
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 5fed57608507..f99f43669392 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -36,7 +36,7 @@
36#include <asm/types.h> 36#include <asm/types.h>
37#include <asm/setup.h> 37#include <asm/setup.h>
38#include <asm/memory.h> 38#include <asm/memory.h>
39#include <asm/hardware.h> 39#include <mach/hardware.h>
40#include <asm/irq.h> 40#include <asm/irq.h>
41#include <asm/system.h> 41#include <asm/system.h>
42#include <asm/tlbflush.h> 42#include <asm/tlbflush.h>
@@ -46,7 +46,7 @@
46#include <asm/mach/map.h> 46#include <asm/mach/map.h>
47#include <asm/mach/time.h> 47#include <asm/mach/time.h>
48#include <asm/mach/irq.h> 48#include <asm/mach/irq.h>
49#include <asm/arch/gpio.h> 49#include <mach/gpio.h>
50 50
51#include <asm/hardware/vic.h> 51#include <asm/hardware/vic.h>
52 52
diff --git a/arch/arm/mach-ep93xx/edb9302.c b/arch/arm/mach-ep93xx/edb9302.c
index 0315615b74da..97550c0ad7b0 100644
--- a/arch/arm/mach-ep93xx/edb9302.c
+++ b/arch/arm/mach-ep93xx/edb9302.c
@@ -19,7 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25 25
diff --git a/arch/arm/mach-ep93xx/edb9302a.c b/arch/arm/mach-ep93xx/edb9302a.c
index 62e064bab1d2..99b01d44bf1c 100644
--- a/arch/arm/mach-ep93xx/edb9302a.c
+++ b/arch/arm/mach-ep93xx/edb9302a.c
@@ -19,7 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25 25
diff --git a/arch/arm/mach-ep93xx/edb9307.c b/arch/arm/mach-ep93xx/edb9307.c
index d6a5698da91f..9fb72d01a36c 100644
--- a/arch/arm/mach-ep93xx/edb9307.c
+++ b/arch/arm/mach-ep93xx/edb9307.c
@@ -19,7 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25 25
diff --git a/arch/arm/mach-ep93xx/edb9312.c b/arch/arm/mach-ep93xx/edb9312.c
index e310e4d72990..87267a574f5e 100644
--- a/arch/arm/mach-ep93xx/edb9312.c
+++ b/arch/arm/mach-ep93xx/edb9312.c
@@ -20,7 +20,7 @@
20#include <linux/mtd/physmap.h> 20#include <linux/mtd/physmap.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26 26
diff --git a/arch/arm/mach-ep93xx/edb9315.c b/arch/arm/mach-ep93xx/edb9315.c
index 249ca9e57bc6..7e373950be4d 100644
--- a/arch/arm/mach-ep93xx/edb9315.c
+++ b/arch/arm/mach-ep93xx/edb9315.c
@@ -19,7 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25 25
diff --git a/arch/arm/mach-ep93xx/edb9315a.c b/arch/arm/mach-ep93xx/edb9315a.c
index 7ca0e6170a41..08a7c9bfb689 100644
--- a/arch/arm/mach-ep93xx/edb9315a.c
+++ b/arch/arm/mach-ep93xx/edb9315a.c
@@ -19,7 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25 25
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c
index 694590a451c1..9b41ec1f089e 100644
--- a/arch/arm/mach-ep93xx/gesbc9312.c
+++ b/arch/arm/mach-ep93xx/gesbc9312.c
@@ -19,7 +19,7 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25 25
diff --git a/arch/arm/mach-ep93xx/gpio.c b/arch/arm/mach-ep93xx/gpio.c
index dc2e4c00d989..0f3fb87ca4be 100644
--- a/arch/arm/mach-ep93xx/gpio.c
+++ b/arch/arm/mach-ep93xx/gpio.c
@@ -17,7 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19 19
20#include <asm/arch/ep93xx-regs.h> 20#include <mach/ep93xx-regs.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/gpio.h> 22#include <asm/gpio.h>
23 23
diff --git a/arch/arm/mach-ep93xx/include/mach/debug-macro.S b/arch/arm/mach-ep93xx/include/mach/debug-macro.S
new file mode 100644
index 000000000000..802858bc8095
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/debug-macro.S
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/debug-macro.S
3 * Debugging macro include header
4 *
5 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
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 (at
10 * your option) any later version.
11 */
12#include <mach/ep93xx-regs.h>
13
14 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17 ldreq \rx, =EP93XX_APB_PHYS_BASE @ Physical base
18 ldrne \rx, =EP93XX_APB_VIRT_BASE @ virtual base
19 orr \rx, \rx, #0x000c0000
20 .endm
21
22#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-ep93xx/include/mach/dma.h b/arch/arm/mach-ep93xx/include/mach/dma.h
new file mode 100644
index 000000000000..d0fa9656e92f
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/dma.h
@@ -0,0 +1,3 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/dma.h
3 */
diff --git a/arch/arm/mach-ep93xx/include/mach/entry-macro.S b/arch/arm/mach-ep93xx/include/mach/entry-macro.S
new file mode 100644
index 000000000000..96b85e2c2c0b
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/entry-macro.S
@@ -0,0 +1,59 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/entry-macro.S
3 * IRQ demultiplexing for EP93xx
4 *
5 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
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 (at
10 * your option) any later version.
11 */
12#include <mach/ep93xx-regs.h>
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 ldr \base, =(EP93XX_AHB_VIRT_BASE)
25 orr \base, \base, #0x000b0000
26 mov \irqnr, #0
27 ldr \irqstat, [\base] @ lower 32 interrupts
28 cmp \irqstat, #0
29 bne 1001f
30
31 eor \base, \base, #0x00070000
32 ldr \irqstat, [\base] @ upper 32 interrupts
33 cmp \irqstat, #0
34 beq 1002f
35 mov \irqnr, #0x20
36
371001:
38 movs \tmp, \irqstat, lsl #16
39 movne \irqstat, \tmp
40 addeq \irqnr, \irqnr, #16
41
42 movs \tmp, \irqstat, lsl #8
43 movne \irqstat, \tmp
44 addeq \irqnr, \irqnr, #8
45
46 movs \tmp, \irqstat, lsl #4
47 movne \irqstat, \tmp
48 addeq \irqnr, \irqnr, #4
49
50 movs \tmp, \irqstat, lsl #2
51 movne \irqstat, \tmp
52 addeq \irqnr, \irqnr, #2
53
54 movs \tmp, \irqstat, lsl #1
55 addeq \irqnr, \irqnr, #1
56 orrs \base, \base, #1
57
581002:
59 .endm
diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
new file mode 100644
index 000000000000..9f4458c8e070
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
@@ -0,0 +1,133 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
3 */
4
5#ifndef __ASM_ARCH_EP93XX_REGS_H
6#define __ASM_ARCH_EP93XX_REGS_H
7
8/*
9 * EP93xx linux memory map:
10 *
11 * virt phys size
12 * fe800000 5M per-platform mappings
13 * fed00000 80800000 2M APB
14 * fef00000 80000000 1M AHB
15 */
16
17#define EP93XX_AHB_PHYS_BASE 0x80000000
18#define EP93XX_AHB_VIRT_BASE 0xfef00000
19#define EP93XX_AHB_SIZE 0x00100000
20
21#define EP93XX_APB_PHYS_BASE 0x80800000
22#define EP93XX_APB_VIRT_BASE 0xfed00000
23#define EP93XX_APB_SIZE 0x00200000
24
25
26/* AHB peripherals */
27#define EP93XX_DMA_BASE (EP93XX_AHB_VIRT_BASE + 0x00000000)
28
29#define EP93XX_ETHERNET_BASE (EP93XX_AHB_VIRT_BASE + 0x00010000)
30#define EP93XX_ETHERNET_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00010000)
31
32#define EP93XX_USB_BASE (EP93XX_AHB_VIRT_BASE + 0x00020000)
33#define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000)
34
35#define EP93XX_RASTER_BASE (EP93XX_AHB_VIRT_BASE + 0x00030000)
36
37#define EP93XX_GRAPHICS_ACCEL_BASE (EP93XX_AHB_VIRT_BASE + 0x00040000)
38
39#define EP93XX_SDRAM_CONTROLLER_BASE (EP93XX_AHB_VIRT_BASE + 0x00060000)
40
41#define EP93XX_PCMCIA_CONTROLLER_BASE (EP93XX_AHB_VIRT_BASE + 0x00080000)
42
43#define EP93XX_BOOT_ROM_BASE (EP93XX_AHB_VIRT_BASE + 0x00090000)
44
45#define EP93XX_IDE_BASE (EP93XX_AHB_VIRT_BASE + 0x000a0000)
46
47#define EP93XX_VIC1_BASE (EP93XX_AHB_VIRT_BASE + 0x000b0000)
48
49#define EP93XX_VIC2_BASE (EP93XX_AHB_VIRT_BASE + 0x000c0000)
50
51
52/* APB peripherals */
53#define EP93XX_TIMER_BASE (EP93XX_APB_VIRT_BASE + 0x00010000)
54#define EP93XX_TIMER_REG(x) (EP93XX_TIMER_BASE + (x))
55#define EP93XX_TIMER1_LOAD EP93XX_TIMER_REG(0x00)
56#define EP93XX_TIMER1_VALUE EP93XX_TIMER_REG(0x04)
57#define EP93XX_TIMER1_CONTROL EP93XX_TIMER_REG(0x08)
58#define EP93XX_TIMER1_CLEAR EP93XX_TIMER_REG(0x0c)
59#define EP93XX_TIMER2_LOAD EP93XX_TIMER_REG(0x20)
60#define EP93XX_TIMER2_VALUE EP93XX_TIMER_REG(0x24)
61#define EP93XX_TIMER2_CONTROL EP93XX_TIMER_REG(0x28)
62#define EP93XX_TIMER2_CLEAR EP93XX_TIMER_REG(0x2c)
63#define EP93XX_TIMER4_VALUE_LOW EP93XX_TIMER_REG(0x60)
64#define EP93XX_TIMER4_VALUE_HIGH EP93XX_TIMER_REG(0x64)
65#define EP93XX_TIMER3_LOAD EP93XX_TIMER_REG(0x80)
66#define EP93XX_TIMER3_VALUE EP93XX_TIMER_REG(0x84)
67#define EP93XX_TIMER3_CONTROL EP93XX_TIMER_REG(0x88)
68#define EP93XX_TIMER3_CLEAR EP93XX_TIMER_REG(0x8c)
69
70#define EP93XX_I2S_BASE (EP93XX_APB_VIRT_BASE + 0x00020000)
71
72#define EP93XX_SECURITY_BASE (EP93XX_APB_VIRT_BASE + 0x00030000)
73
74#define EP93XX_GPIO_BASE (EP93XX_APB_VIRT_BASE + 0x00040000)
75#define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x))
76#define EP93XX_GPIO_F_INT_TYPE1 EP93XX_GPIO_REG(0x4c)
77#define EP93XX_GPIO_F_INT_TYPE2 EP93XX_GPIO_REG(0x50)
78#define EP93XX_GPIO_F_INT_ACK EP93XX_GPIO_REG(0x54)
79#define EP93XX_GPIO_F_INT_ENABLE EP93XX_GPIO_REG(0x58)
80#define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c)
81#define EP93XX_GPIO_A_INT_TYPE1 EP93XX_GPIO_REG(0x90)
82#define EP93XX_GPIO_A_INT_TYPE2 EP93XX_GPIO_REG(0x94)
83#define EP93XX_GPIO_A_INT_ACK EP93XX_GPIO_REG(0x98)
84#define EP93XX_GPIO_A_INT_ENABLE EP93XX_GPIO_REG(0x9c)
85#define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0)
86#define EP93XX_GPIO_B_INT_TYPE1 EP93XX_GPIO_REG(0xac)
87#define EP93XX_GPIO_B_INT_TYPE2 EP93XX_GPIO_REG(0xb0)
88#define EP93XX_GPIO_B_INT_ACK EP93XX_GPIO_REG(0xb4)
89#define EP93XX_GPIO_B_INT_ENABLE EP93XX_GPIO_REG(0xb8)
90#define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc)
91
92#define EP93XX_AAC_BASE (EP93XX_APB_VIRT_BASE + 0x00080000)
93
94#define EP93XX_SPI_BASE (EP93XX_APB_VIRT_BASE + 0x000a0000)
95
96#define EP93XX_IRDA_BASE (EP93XX_APB_VIRT_BASE + 0x000b0000)
97
98#define EP93XX_UART1_BASE (EP93XX_APB_VIRT_BASE + 0x000c0000)
99#define EP93XX_UART1_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000c0000)
100
101#define EP93XX_UART2_BASE (EP93XX_APB_VIRT_BASE + 0x000d0000)
102#define EP93XX_UART2_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000d0000)
103
104#define EP93XX_UART3_BASE (EP93XX_APB_VIRT_BASE + 0x000e0000)
105#define EP93XX_UART3_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000e0000)
106
107#define EP93XX_KEY_MATRIX_BASE (EP93XX_APB_VIRT_BASE + 0x000f0000)
108
109#define EP93XX_ADC_BASE (EP93XX_APB_VIRT_BASE + 0x00100000)
110#define EP93XX_TOUCHSCREEN_BASE (EP93XX_APB_VIRT_BASE + 0x00100000)
111
112#define EP93XX_PWM_BASE (EP93XX_APB_VIRT_BASE + 0x00110000)
113
114#define EP93XX_RTC_BASE (EP93XX_APB_VIRT_BASE + 0x00120000)
115
116#define EP93XX_SYSCON_BASE (EP93XX_APB_VIRT_BASE + 0x00130000)
117#define EP93XX_SYSCON_REG(x) (EP93XX_SYSCON_BASE + (x))
118#define EP93XX_SYSCON_POWER_STATE EP93XX_SYSCON_REG(0x00)
119#define EP93XX_SYSCON_CLOCK_CONTROL EP93XX_SYSCON_REG(0x04)
120#define EP93XX_SYSCON_CLOCK_UARTBAUD 0x20000000
121#define EP93XX_SYSCON_CLOCK_USH_EN 0x10000000
122#define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08)
123#define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c)
124#define EP93XX_SYSCON_CLOCK_SET1 EP93XX_SYSCON_REG(0x20)
125#define EP93XX_SYSCON_CLOCK_SET2 EP93XX_SYSCON_REG(0x24)
126#define EP93XX_SYSCON_DEVICE_CONFIG EP93XX_SYSCON_REG(0x80)
127#define EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE 0x00800000
128#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0)
129
130#define EP93XX_WATCHDOG_BASE (EP93XX_APB_VIRT_BASE + 0x00140000)
131
132
133#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/gesbc9312.h b/arch/arm/mach-ep93xx/include/mach/gesbc9312.h
new file mode 100644
index 000000000000..21fe2b922aa5
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/gesbc9312.h
@@ -0,0 +1,3 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/gesbc9312.h
3 */
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio.h
new file mode 100644
index 000000000000..f7020414c5df
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/gpio.h
@@ -0,0 +1,128 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/gpio.h
3 */
4
5#ifndef __ASM_ARCH_GPIO_H
6#define __ASM_ARCH_GPIO_H
7
8/* GPIO port A. */
9#define EP93XX_GPIO_LINE_A(x) ((x) + 0)
10#define EP93XX_GPIO_LINE_EGPIO0 EP93XX_GPIO_LINE_A(0)
11#define EP93XX_GPIO_LINE_EGPIO1 EP93XX_GPIO_LINE_A(1)
12#define EP93XX_GPIO_LINE_EGPIO2 EP93XX_GPIO_LINE_A(2)
13#define EP93XX_GPIO_LINE_EGPIO3 EP93XX_GPIO_LINE_A(3)
14#define EP93XX_GPIO_LINE_EGPIO4 EP93XX_GPIO_LINE_A(4)
15#define EP93XX_GPIO_LINE_EGPIO5 EP93XX_GPIO_LINE_A(5)
16#define EP93XX_GPIO_LINE_EGPIO6 EP93XX_GPIO_LINE_A(6)
17#define EP93XX_GPIO_LINE_EGPIO7 EP93XX_GPIO_LINE_A(7)
18
19/* GPIO port B. */
20#define EP93XX_GPIO_LINE_B(x) ((x) + 8)
21#define EP93XX_GPIO_LINE_EGPIO8 EP93XX_GPIO_LINE_B(0)
22#define EP93XX_GPIO_LINE_EGPIO9 EP93XX_GPIO_LINE_B(1)
23#define EP93XX_GPIO_LINE_EGPIO10 EP93XX_GPIO_LINE_B(2)
24#define EP93XX_GPIO_LINE_EGPIO11 EP93XX_GPIO_LINE_B(3)
25#define EP93XX_GPIO_LINE_EGPIO12 EP93XX_GPIO_LINE_B(4)
26#define EP93XX_GPIO_LINE_EGPIO13 EP93XX_GPIO_LINE_B(5)
27#define EP93XX_GPIO_LINE_EGPIO14 EP93XX_GPIO_LINE_B(6)
28#define EP93XX_GPIO_LINE_EGPIO15 EP93XX_GPIO_LINE_B(7)
29
30/* GPIO port C. */
31#define EP93XX_GPIO_LINE_C(x) ((x) + 40)
32#define EP93XX_GPIO_LINE_ROW0 EP93XX_GPIO_LINE_C(0)
33#define EP93XX_GPIO_LINE_ROW1 EP93XX_GPIO_LINE_C(1)
34#define EP93XX_GPIO_LINE_ROW2 EP93XX_GPIO_LINE_C(2)
35#define EP93XX_GPIO_LINE_ROW3 EP93XX_GPIO_LINE_C(3)
36#define EP93XX_GPIO_LINE_ROW4 EP93XX_GPIO_LINE_C(4)
37#define EP93XX_GPIO_LINE_ROW5 EP93XX_GPIO_LINE_C(5)
38#define EP93XX_GPIO_LINE_ROW6 EP93XX_GPIO_LINE_C(6)
39#define EP93XX_GPIO_LINE_ROW7 EP93XX_GPIO_LINE_C(7)
40
41/* GPIO port D. */
42#define EP93XX_GPIO_LINE_D(x) ((x) + 24)
43#define EP93XX_GPIO_LINE_COL0 EP93XX_GPIO_LINE_D(0)
44#define EP93XX_GPIO_LINE_COL1 EP93XX_GPIO_LINE_D(1)
45#define EP93XX_GPIO_LINE_COL2 EP93XX_GPIO_LINE_D(2)
46#define EP93XX_GPIO_LINE_COL3 EP93XX_GPIO_LINE_D(3)
47#define EP93XX_GPIO_LINE_COL4 EP93XX_GPIO_LINE_D(4)
48#define EP93XX_GPIO_LINE_COL5 EP93XX_GPIO_LINE_D(5)
49#define EP93XX_GPIO_LINE_COL6 EP93XX_GPIO_LINE_D(6)
50#define EP93XX_GPIO_LINE_COL7 EP93XX_GPIO_LINE_D(7)
51
52/* GPIO port E. */
53#define EP93XX_GPIO_LINE_E(x) ((x) + 32)
54#define EP93XX_GPIO_LINE_GRLED EP93XX_GPIO_LINE_E(0)
55#define EP93XX_GPIO_LINE_RDLED EP93XX_GPIO_LINE_E(1)
56#define EP93XX_GPIO_LINE_DIORn EP93XX_GPIO_LINE_E(2)
57#define EP93XX_GPIO_LINE_IDECS1n EP93XX_GPIO_LINE_E(3)
58#define EP93XX_GPIO_LINE_IDECS2n EP93XX_GPIO_LINE_E(4)
59#define EP93XX_GPIO_LINE_IDEDA0 EP93XX_GPIO_LINE_E(5)
60#define EP93XX_GPIO_LINE_IDEDA1 EP93XX_GPIO_LINE_E(6)
61#define EP93XX_GPIO_LINE_IDEDA2 EP93XX_GPIO_LINE_E(7)
62
63/* GPIO port F. */
64#define EP93XX_GPIO_LINE_F(x) ((x) + 16)
65#define EP93XX_GPIO_LINE_WP EP93XX_GPIO_LINE_F(0)
66#define EP93XX_GPIO_LINE_MCCD1 EP93XX_GPIO_LINE_F(1)
67#define EP93XX_GPIO_LINE_MCCD2 EP93XX_GPIO_LINE_F(2)
68#define EP93XX_GPIO_LINE_MCBVD1 EP93XX_GPIO_LINE_F(3)
69#define EP93XX_GPIO_LINE_MCBVD2 EP93XX_GPIO_LINE_F(4)
70#define EP93XX_GPIO_LINE_VS1 EP93XX_GPIO_LINE_F(5)
71#define EP93XX_GPIO_LINE_READY EP93XX_GPIO_LINE_F(6)
72#define EP93XX_GPIO_LINE_VS2 EP93XX_GPIO_LINE_F(7)
73
74/* GPIO port G. */
75#define EP93XX_GPIO_LINE_G(x) ((x) + 48)
76#define EP93XX_GPIO_LINE_EECLK EP93XX_GPIO_LINE_G(0)
77#define EP93XX_GPIO_LINE_EEDAT EP93XX_GPIO_LINE_G(1)
78#define EP93XX_GPIO_LINE_SLA0 EP93XX_GPIO_LINE_G(2)
79#define EP93XX_GPIO_LINE_SLA1 EP93XX_GPIO_LINE_G(3)
80#define EP93XX_GPIO_LINE_DD12 EP93XX_GPIO_LINE_G(4)
81#define EP93XX_GPIO_LINE_DD13 EP93XX_GPIO_LINE_G(5)
82#define EP93XX_GPIO_LINE_DD14 EP93XX_GPIO_LINE_G(6)
83#define EP93XX_GPIO_LINE_DD15 EP93XX_GPIO_LINE_G(7)
84
85/* GPIO port H. */
86#define EP93XX_GPIO_LINE_H(x) ((x) + 56)
87#define EP93XX_GPIO_LINE_DD0 EP93XX_GPIO_LINE_H(0)
88#define EP93XX_GPIO_LINE_DD1 EP93XX_GPIO_LINE_H(1)
89#define EP93XX_GPIO_LINE_DD2 EP93XX_GPIO_LINE_H(2)
90#define EP93XX_GPIO_LINE_DD3 EP93XX_GPIO_LINE_H(3)
91#define EP93XX_GPIO_LINE_DD4 EP93XX_GPIO_LINE_H(4)
92#define EP93XX_GPIO_LINE_DD5 EP93XX_GPIO_LINE_H(5)
93#define EP93XX_GPIO_LINE_DD6 EP93XX_GPIO_LINE_H(6)
94#define EP93XX_GPIO_LINE_DD7 EP93XX_GPIO_LINE_H(7)
95
96/* maximum value for gpio line identifiers */
97#define EP93XX_GPIO_LINE_MAX EP93XX_GPIO_LINE_H(7)
98
99/* maximum value for irq capable line identifiers */
100#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
101
102/* new generic GPIO API - see Documentation/gpio.txt */
103
104#include <asm-generic/gpio.h>
105
106#define gpio_get_value __gpio_get_value
107#define gpio_set_value __gpio_set_value
108#define gpio_cansleep __gpio_cansleep
109
110/*
111 * Map GPIO A0..A7 (0..7) to irq 64..71,
112 * B0..B7 (7..15) to irq 72..79, and
113 * F0..F7 (16..24) to irq 80..87.
114 */
115static inline int gpio_to_irq(unsigned gpio)
116{
117 if (gpio <= EP93XX_GPIO_LINE_MAX_IRQ)
118 return 64 + gpio;
119
120 return -EINVAL;
121}
122
123static inline int irq_to_gpio(unsigned irq)
124{
125 return irq - gpio_to_irq(0);
126}
127
128#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/hardware.h b/arch/arm/mach-ep93xx/include/mach/hardware.h
new file mode 100644
index 000000000000..529807d182bf
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/hardware.h
@@ -0,0 +1,16 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/hardware.h
3 */
4#ifndef __ASM_ARCH_HARDWARE_H
5#define __ASM_ARCH_HARDWARE_H
6
7#include "ep93xx-regs.h"
8
9#define pcibios_assign_all_busses() 0
10
11#include "platform.h"
12
13#include "gesbc9312.h"
14#include "ts72xx.h"
15
16#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/io.h b/arch/arm/mach-ep93xx/include/mach/io.h
new file mode 100644
index 000000000000..1ab9a90ad339
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/io.h
@@ -0,0 +1,8 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/io.h
3 */
4
5#define IO_SPACE_LIMIT 0xffffffff
6
7#define __io(p) ((void __iomem *)(p))
8#define __mem_pci(p) (p)
diff --git a/arch/arm/mach-ep93xx/include/mach/irqs.h b/arch/arm/mach-ep93xx/include/mach/irqs.h
new file mode 100644
index 000000000000..ff98390bbf0f
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/irqs.h
@@ -0,0 +1,78 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/irqs.h
3 */
4
5#ifndef __ASM_ARCH_IRQS_H
6#define __ASM_ARCH_IRQS_H
7
8#define IRQ_EP93XX_COMMRX 2
9#define IRQ_EP93XX_COMMTX 3
10#define IRQ_EP93XX_TIMER1 4
11#define IRQ_EP93XX_TIMER2 5
12#define IRQ_EP93XX_AACINTR 6
13#define IRQ_EP93XX_DMAM2P0 7
14#define IRQ_EP93XX_DMAM2P1 8
15#define IRQ_EP93XX_DMAM2P2 9
16#define IRQ_EP93XX_DMAM2P3 10
17#define IRQ_EP93XX_DMAM2P4 11
18#define IRQ_EP93XX_DMAM2P5 12
19#define IRQ_EP93XX_DMAM2P6 13
20#define IRQ_EP93XX_DMAM2P7 14
21#define IRQ_EP93XX_DMAM2P8 15
22#define IRQ_EP93XX_DMAM2P9 16
23#define IRQ_EP93XX_DMAM2M0 17
24#define IRQ_EP93XX_DMAM2M1 18
25#define IRQ_EP93XX_GPIO0MUX 19
26#define IRQ_EP93XX_GPIO1MUX 20
27#define IRQ_EP93XX_GPIO2MUX 21
28#define IRQ_EP93XX_GPIO3MUX 22
29#define IRQ_EP93XX_UART1RX 23
30#define IRQ_EP93XX_UART1TX 24
31#define IRQ_EP93XX_UART2RX 25
32#define IRQ_EP93XX_UART2TX 26
33#define IRQ_EP93XX_UART3RX 27
34#define IRQ_EP93XX_UART3TX 28
35#define IRQ_EP93XX_KEY 29
36#define IRQ_EP93XX_TOUCH 30
37#define EP93XX_VIC1_VALID_IRQ_MASK 0x7ffffffc
38
39#define IRQ_EP93XX_EXT0 32
40#define IRQ_EP93XX_EXT1 33
41#define IRQ_EP93XX_EXT2 34
42#define IRQ_EP93XX_64HZ 35
43#define IRQ_EP93XX_WATCHDOG 36
44#define IRQ_EP93XX_RTC 37
45#define IRQ_EP93XX_IRDA 38
46#define IRQ_EP93XX_ETHERNET 39
47#define IRQ_EP93XX_EXT3 40
48#define IRQ_EP93XX_PROG 41
49#define IRQ_EP93XX_1HZ 42
50#define IRQ_EP93XX_VSYNC 43
51#define IRQ_EP93XX_VIDEO_FIFO 44
52#define IRQ_EP93XX_SSP1RX 45
53#define IRQ_EP93XX_SSP1TX 46
54#define IRQ_EP93XX_GPIO4MUX 47
55#define IRQ_EP93XX_GPIO5MUX 48
56#define IRQ_EP93XX_GPIO6MUX 49
57#define IRQ_EP93XX_GPIO7MUX 50
58#define IRQ_EP93XX_TIMER3 51
59#define IRQ_EP93XX_UART1 52
60#define IRQ_EP93XX_SSP 53
61#define IRQ_EP93XX_UART2 54
62#define IRQ_EP93XX_UART3 55
63#define IRQ_EP93XX_USB 56
64#define IRQ_EP93XX_ETHERNET_PME 57
65#define IRQ_EP93XX_DSP 58
66#define IRQ_EP93XX_GPIO_AB 59
67#define IRQ_EP93XX_SAI 60
68#define EP93XX_VIC2_VALID_IRQ_MASK 0x1fffffff
69
70#define NR_EP93XX_IRQS (64 + 24)
71
72#define EP93XX_BOARD_IRQ(x) (NR_EP93XX_IRQS + (x))
73#define EP93XX_BOARD_IRQS 32
74
75#define NR_IRQS (NR_EP93XX_IRQS + EP93XX_BOARD_IRQS)
76
77
78#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/memory.h b/arch/arm/mach-ep93xx/include/mach/memory.h
new file mode 100644
index 000000000000..f1b633590752
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/memory.h
@@ -0,0 +1,14 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/memory.h
3 */
4
5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H
7
8#define PHYS_OFFSET UL(0x00000000)
9
10#define __bus_to_virt(x) __phys_to_virt(x)
11#define __virt_to_bus(x) __virt_to_phys(x)
12
13
14#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
new file mode 100644
index 000000000000..b5c182473f5d
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/platform.h
3 */
4
5#ifndef __ASSEMBLY__
6
7void ep93xx_map_io(void);
8void ep93xx_init_irq(void);
9void ep93xx_init_time(unsigned long);
10void ep93xx_init_devices(void);
11extern struct sys_timer ep93xx_timer;
12
13struct ep93xx_eth_data
14{
15 unsigned char dev_addr[6];
16 unsigned char phy_id;
17};
18
19
20#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/system.h b/arch/arm/mach-ep93xx/include/mach/system.h
new file mode 100644
index 000000000000..67789d0f329e
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/system.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/system.h
3 */
4
5#include <mach/hardware.h>
6
7static inline void arch_idle(void)
8{
9 cpu_do_idle();
10}
11
12static inline void arch_reset(char mode)
13{
14 u32 devicecfg;
15
16 local_irq_disable();
17
18 devicecfg = __raw_readl(EP93XX_SYSCON_DEVICE_CONFIG);
19 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK);
20 __raw_writel(devicecfg | 0x80000000, EP93XX_SYSCON_DEVICE_CONFIG);
21 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK);
22 __raw_writel(devicecfg & ~0x80000000, EP93XX_SYSCON_DEVICE_CONFIG);
23
24 while (1)
25 ;
26}
diff --git a/arch/arm/mach-ep93xx/include/mach/timex.h b/arch/arm/mach-ep93xx/include/mach/timex.h
new file mode 100644
index 000000000000..6b3503b01fa6
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/timex.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/timex.h
3 */
4
5#define CLOCK_TICK_RATE 983040
diff --git a/arch/arm/mach-ep93xx/include/mach/ts72xx.h b/arch/arm/mach-ep93xx/include/mach/ts72xx.h
new file mode 100644
index 000000000000..30b318aa1a1f
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/ts72xx.h
@@ -0,0 +1,101 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/ts72xx.h
3 */
4
5/*
6 * TS72xx memory map:
7 *
8 * virt phys size
9 * febff000 22000000 4K model number register
10 * febfe000 22400000 4K options register
11 * febfd000 22800000 4K options register #2
12 * febfc000 [67]0000000 4K NAND data register
13 * febfb000 [67]0400000 4K NAND control register
14 * febfa000 [67]0800000 4K NAND busy register
15 * febf9000 10800000 4K TS-5620 RTC index register
16 * febf8000 11700000 4K TS-5620 RTC data register
17 */
18
19#define TS72XX_MODEL_PHYS_BASE 0x22000000
20#define TS72XX_MODEL_VIRT_BASE 0xfebff000
21#define TS72XX_MODEL_SIZE 0x00001000
22
23#define TS72XX_MODEL_TS7200 0x00
24#define TS72XX_MODEL_TS7250 0x01
25#define TS72XX_MODEL_TS7260 0x02
26
27
28#define TS72XX_OPTIONS_PHYS_BASE 0x22400000
29#define TS72XX_OPTIONS_VIRT_BASE 0xfebfe000
30#define TS72XX_OPTIONS_SIZE 0x00001000
31
32#define TS72XX_OPTIONS_COM2_RS485 0x02
33#define TS72XX_OPTIONS_MAX197 0x01
34
35
36#define TS72XX_OPTIONS2_PHYS_BASE 0x22800000
37#define TS72XX_OPTIONS2_VIRT_BASE 0xfebfd000
38#define TS72XX_OPTIONS2_SIZE 0x00001000
39
40#define TS72XX_OPTIONS2_TS9420 0x04
41#define TS72XX_OPTIONS2_TS9420_BOOT 0x02
42
43
44#define TS72XX_NOR_PHYS_BASE 0x60000000
45#define TS72XX_NOR2_PHYS_BASE 0x62000000
46
47#define TS72XX_NAND1_DATA_PHYS_BASE 0x60000000
48#define TS72XX_NAND2_DATA_PHYS_BASE 0x70000000
49#define TS72XX_NAND_DATA_VIRT_BASE 0xfebfc000
50#define TS72XX_NAND_DATA_SIZE 0x00001000
51
52#define TS72XX_NAND1_CONTROL_PHYS_BASE 0x60400000
53#define TS72XX_NAND2_CONTROL_PHYS_BASE 0x70400000
54#define TS72XX_NAND_CONTROL_VIRT_BASE 0xfebfb000
55#define TS72XX_NAND_CONTROL_SIZE 0x00001000
56
57#define TS72XX_NAND1_BUSY_PHYS_BASE 0x60800000
58#define TS72XX_NAND2_BUSY_PHYS_BASE 0x70800000
59#define TS72XX_NAND_BUSY_VIRT_BASE 0xfebfa000
60#define TS72XX_NAND_BUSY_SIZE 0x00001000
61
62
63#define TS72XX_RTC_INDEX_VIRT_BASE 0xfebf9000
64#define TS72XX_RTC_INDEX_PHYS_BASE 0x10800000
65#define TS72XX_RTC_INDEX_SIZE 0x00001000
66
67#define TS72XX_RTC_DATA_VIRT_BASE 0xfebf8000
68#define TS72XX_RTC_DATA_PHYS_BASE 0x11700000
69#define TS72XX_RTC_DATA_SIZE 0x00001000
70
71
72#ifndef __ASSEMBLY__
73#include <asm/io.h>
74
75static inline int board_is_ts7200(void)
76{
77 return __raw_readb(TS72XX_MODEL_VIRT_BASE) == TS72XX_MODEL_TS7200;
78}
79
80static inline int board_is_ts7250(void)
81{
82 return __raw_readb(TS72XX_MODEL_VIRT_BASE) == TS72XX_MODEL_TS7250;
83}
84
85static inline int board_is_ts7260(void)
86{
87 return __raw_readb(TS72XX_MODEL_VIRT_BASE) == TS72XX_MODEL_TS7260;
88}
89
90static inline int is_max197_installed(void)
91{
92 return !!(__raw_readb(TS72XX_OPTIONS_VIRT_BASE) &
93 TS72XX_OPTIONS_MAX197);
94}
95
96static inline int is_ts9420_installed(void)
97{
98 return !!(__raw_readb(TS72XX_OPTIONS2_VIRT_BASE) &
99 TS72XX_OPTIONS2_TS9420);
100}
101#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/mach-ep93xx/include/mach/uncompress.h
new file mode 100644
index 000000000000..1fd2f17de325
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/uncompress.h
@@ -0,0 +1,85 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/uncompress.h
3 *
4 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
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 (at
9 * your option) any later version.
10 */
11
12#include <mach/ep93xx-regs.h>
13
14static unsigned char __raw_readb(unsigned int ptr)
15{
16 return *((volatile unsigned char *)ptr);
17}
18
19static unsigned int __raw_readl(unsigned int ptr)
20{
21 return *((volatile unsigned int *)ptr);
22}
23
24static void __raw_writeb(unsigned char value, unsigned int ptr)
25{
26 *((volatile unsigned char *)ptr) = value;
27}
28
29static void __raw_writel(unsigned int value, unsigned int ptr)
30{
31 *((volatile unsigned int *)ptr) = value;
32}
33
34
35#define PHYS_UART1_DATA 0x808c0000
36#define PHYS_UART1_FLAG 0x808c0018
37#define UART1_FLAG_TXFF 0x20
38
39static inline void putc(int c)
40{
41 int i;
42
43 for (i = 0; i < 1000; i++) {
44 /* Transmit fifo not full? */
45 if (!(__raw_readb(PHYS_UART1_FLAG) & UART1_FLAG_TXFF))
46 break;
47 }
48
49 __raw_writeb(c, PHYS_UART1_DATA);
50}
51
52static inline void flush(void)
53{
54}
55
56
57/*
58 * Some bootloaders don't turn off DMA from the ethernet MAC before
59 * jumping to linux, which means that we might end up with bits of RX
60 * status and packet data scribbled over the uncompressed kernel image.
61 * Work around this by resetting the ethernet MAC before we uncompress.
62 */
63#define PHYS_ETH_SELF_CTL 0x80010020
64#define ETH_SELF_CTL_RESET 0x00000001
65
66static void ethernet_reset(void)
67{
68 unsigned int v;
69
70 /* Reset the ethernet MAC. */
71 v = __raw_readl(PHYS_ETH_SELF_CTL);
72 __raw_writel(v | ETH_SELF_CTL_RESET, PHYS_ETH_SELF_CTL);
73
74 /* Wait for reset to finish. */
75 while (__raw_readl(PHYS_ETH_SELF_CTL) & ETH_SELF_CTL_RESET)
76 ;
77}
78
79
80static void arch_decomp_setup(void)
81{
82 ethernet_reset();
83}
84
85#define arch_decomp_wdog()
diff --git a/arch/arm/mach-ep93xx/include/mach/vmalloc.h b/arch/arm/mach-ep93xx/include/mach/vmalloc.h
new file mode 100644
index 000000000000..aed21cd3fe2d
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe800000
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c
index f28c1294cae1..de047a5c8112 100644
--- a/arch/arm/mach-ep93xx/micro9.c
+++ b/arch/arm/mach-ep93xx/micro9.c
@@ -20,7 +20,7 @@
20#include <linux/mtd/physmap.h> 20#include <linux/mtd/physmap.h>
21 21
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24 24
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 3a4bf90ba832..c3cbff126d0c 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -20,7 +20,7 @@
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/m48t86.h> 21#include <linux/m48t86.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
diff --git a/arch/arm/mach-footbridge/ebsa285-leds.c b/arch/arm/mach-footbridge/ebsa285-leds.c
index 09c1fbc51876..4e10090cd87f 100644
--- a/arch/arm/mach-footbridge/ebsa285-leds.c
+++ b/arch/arm/mach-footbridge/ebsa285-leds.c
@@ -21,7 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23 23
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/leds.h> 25#include <asm/leds.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/system.h> 27#include <asm/system.h>
diff --git a/arch/arm/mach-footbridge/include/mach/debug-macro.S b/arch/arm/mach-footbridge/include/mach/debug-macro.S
new file mode 100644
index 000000000000..4329b8123570
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/debug-macro.S
@@ -0,0 +1,57 @@
1/* arch/arm/mach-footbridge/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#include <asm/hardware/dec21285.h>
15
16#ifndef CONFIG_DEBUG_DC21285_PORT
17 /* For NetWinder debugging */
18 .macro addruart,rx
19 mrc p15, 0, \rx, c1, c0
20 tst \rx, #1 @ MMU enabled?
21 moveq \rx, #0x7c000000 @ physical
22 movne \rx, #0xff000000 @ virtual
23 orr \rx, \rx, #0x000003f8
24 .endm
25
26#define UART_SHIFT 0
27#define FLOW_CONTROL
28#include <asm/hardware/debug-8250.S>
29
30#else
31 /* For EBSA285 debugging */
32 .equ dc21285_high, ARMCSR_BASE & 0xff000000
33 .equ dc21285_low, ARMCSR_BASE & 0x00ffffff
34
35 .macro addruart,rx
36 mrc p15, 0, \rx, c1, c0
37 tst \rx, #1 @ MMU enabled?
38 moveq \rx, #0x42000000
39 movne \rx, #dc21285_high
40 .if dc21285_low
41 orrne \rx, \rx, #dc21285_low
42 .endif
43 .endm
44
45 .macro senduart,rd,rx
46 str \rd, [\rx, #0x160] @ UARTDR
47 .endm
48
49 .macro busyuart,rd,rx
501001: ldr \rd, [\rx, #0x178] @ UARTFLG
51 tst \rd, #1 << 3
52 bne 1001b
53 .endm
54
55 .macro waituart,rd,rx
56 .endm
57#endif
diff --git a/arch/arm/mach-footbridge/include/mach/dma.h b/arch/arm/mach-footbridge/include/mach/dma.h
new file mode 100644
index 000000000000..62afd213effb
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/dma.h
@@ -0,0 +1,25 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/dma.h
3 *
4 * Architecture DMA routines
5 *
6 * Copyright (C) 1998,1999 Russell King
7 * Copyright (C) 1998,1999 Philip Blundell
8 */
9#ifndef __ASM_ARCH_DMA_H
10#define __ASM_ARCH_DMA_H
11
12/*
13 * The 21285 has two internal DMA channels; we call these 8 and 9.
14 * On CATS hardware we have an additional eight ISA dma channels
15 * numbered 0..7.
16 */
17#define _ISA_DMA(x) (0+(x))
18#define _DC21285_DMA(x) (8+(x))
19
20#define MAX_DMA_CHANNELS 10
21
22#define DMA_FLOPPY _ISA_DMA(2)
23#define DMA_ISA_CASCADE _ISA_DMA(4)
24
25#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-footbridge/include/mach/entry-macro.S b/arch/arm/mach-footbridge/include/mach/entry-macro.S
new file mode 100644
index 000000000000..d3847be0c667
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/entry-macro.S
@@ -0,0 +1,113 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for footbridge-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#include <mach/irqs.h>
12#include <asm/hardware/dec21285.h>
13
14 .equ dc21285_high, ARMCSR_BASE & 0xff000000
15 .equ dc21285_low, ARMCSR_BASE & 0x00ffffff
16
17 .macro disable_fiq
18 .endm
19
20 .macro get_irqnr_preamble, base, tmp
21 mov \base, #dc21285_high
22 .if dc21285_low
23 orr \base, \base, #dc21285_low
24 .endif
25 .endm
26
27 .macro arch_ret_to_user, tmp1, tmp2
28 .endm
29
30 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
31 ldr \irqstat, [\base, #0x180] @ get interrupts
32
33 mov \irqnr, #IRQ_SDRAMPARITY
34 tst \irqstat, #IRQ_MASK_SDRAMPARITY
35 bne 1001f
36
37 tst \irqstat, #IRQ_MASK_UART_RX
38 movne \irqnr, #IRQ_CONRX
39 bne 1001f
40
41 tst \irqstat, #IRQ_MASK_DMA1
42 movne \irqnr, #IRQ_DMA1
43 bne 1001f
44
45 tst \irqstat, #IRQ_MASK_DMA2
46 movne \irqnr, #IRQ_DMA2
47 bne 1001f
48
49 tst \irqstat, #IRQ_MASK_IN0
50 movne \irqnr, #IRQ_IN0
51 bne 1001f
52
53 tst \irqstat, #IRQ_MASK_IN1
54 movne \irqnr, #IRQ_IN1
55 bne 1001f
56
57 tst \irqstat, #IRQ_MASK_IN2
58 movne \irqnr, #IRQ_IN2
59 bne 1001f
60
61 tst \irqstat, #IRQ_MASK_IN3
62 movne \irqnr, #IRQ_IN3
63 bne 1001f
64
65 tst \irqstat, #IRQ_MASK_PCI
66 movne \irqnr, #IRQ_PCI
67 bne 1001f
68
69 tst \irqstat, #IRQ_MASK_DOORBELLHOST
70 movne \irqnr, #IRQ_DOORBELLHOST
71 bne 1001f
72
73 tst \irqstat, #IRQ_MASK_I2OINPOST
74 movne \irqnr, #IRQ_I2OINPOST
75 bne 1001f
76
77 tst \irqstat, #IRQ_MASK_TIMER1
78 movne \irqnr, #IRQ_TIMER1
79 bne 1001f
80
81 tst \irqstat, #IRQ_MASK_TIMER2
82 movne \irqnr, #IRQ_TIMER2
83 bne 1001f
84
85 tst \irqstat, #IRQ_MASK_TIMER3
86 movne \irqnr, #IRQ_TIMER3
87 bne 1001f
88
89 tst \irqstat, #IRQ_MASK_UART_TX
90 movne \irqnr, #IRQ_CONTX
91 bne 1001f
92
93 tst \irqstat, #IRQ_MASK_PCI_ABORT
94 movne \irqnr, #IRQ_PCI_ABORT
95 bne 1001f
96
97 tst \irqstat, #IRQ_MASK_PCI_SERR
98 movne \irqnr, #IRQ_PCI_SERR
99 bne 1001f
100
101 tst \irqstat, #IRQ_MASK_DISCARD_TIMER
102 movne \irqnr, #IRQ_DISCARD_TIMER
103 bne 1001f
104
105 tst \irqstat, #IRQ_MASK_PCI_DPERR
106 movne \irqnr, #IRQ_PCI_DPERR
107 bne 1001f
108
109 tst \irqstat, #IRQ_MASK_PCI_PERR
110 movne \irqnr, #IRQ_PCI_PERR
1111001:
112 .endm
113
diff --git a/arch/arm/mach-footbridge/include/mach/hardware.h b/arch/arm/mach-footbridge/include/mach/hardware.h
new file mode 100644
index 000000000000..ffaea90486f9
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/hardware.h
@@ -0,0 +1,105 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/hardware.h
3 *
4 * Copyright (C) 1998-1999 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This file contains the hardware definitions of the EBSA-285.
11 */
12#ifndef __ASM_ARCH_HARDWARE_H
13#define __ASM_ARCH_HARDWARE_H
14
15#include <mach/memory.h>
16
17/* Virtual Physical Size
18 * 0xff800000 0x40000000 1MB X-Bus
19 * 0xff000000 0x7c000000 1MB PCI I/O space
20 * 0xfe000000 0x42000000 1MB CSR
21 * 0xfd000000 0x78000000 1MB Outbound write flush (not supported)
22 * 0xfc000000 0x79000000 1MB PCI IACK/special space
23 * 0xfb000000 0x7a000000 16MB PCI Config type 1
24 * 0xfa000000 0x7b000000 16MB PCI Config type 0
25 * 0xf9000000 0x50000000 1MB Cache flush
26 * 0xf0000000 0x80000000 16MB ISA memory
27 */
28#define XBUS_SIZE 0x00100000
29#define XBUS_BASE 0xff800000
30
31#define PCIO_SIZE 0x00100000
32#define PCIO_BASE 0xff000000
33
34#define ARMCSR_SIZE 0x00100000
35#define ARMCSR_BASE 0xfe000000
36
37#define WFLUSH_SIZE 0x00100000
38#define WFLUSH_BASE 0xfd000000
39
40#define PCIIACK_SIZE 0x00100000
41#define PCIIACK_BASE 0xfc000000
42
43#define PCICFG1_SIZE 0x01000000
44#define PCICFG1_BASE 0xfb000000
45
46#define PCICFG0_SIZE 0x01000000
47#define PCICFG0_BASE 0xfa000000
48
49#define PCIMEM_SIZE 0x01000000
50#define PCIMEM_BASE 0xf0000000
51
52#define XBUS_LEDS ((volatile unsigned char *)(XBUS_BASE + 0x12000))
53#define XBUS_LED_AMBER (1 << 0)
54#define XBUS_LED_GREEN (1 << 1)
55#define XBUS_LED_RED (1 << 2)
56#define XBUS_LED_TOGGLE (1 << 8)
57
58#define XBUS_SWITCH ((volatile unsigned char *)(XBUS_BASE + 0x12000))
59#define XBUS_SWITCH_SWITCH ((*XBUS_SWITCH) & 15)
60#define XBUS_SWITCH_J17_13 ((*XBUS_SWITCH) & (1 << 4))
61#define XBUS_SWITCH_J17_11 ((*XBUS_SWITCH) & (1 << 5))
62#define XBUS_SWITCH_J17_9 ((*XBUS_SWITCH) & (1 << 6))
63
64#define UNCACHEABLE_ADDR (ARMCSR_BASE + 0x108)
65
66
67/* PIC irq control */
68#define PIC_LO 0x20
69#define PIC_MASK_LO 0x21
70#define PIC_HI 0xA0
71#define PIC_MASK_HI 0xA1
72
73/* GPIO pins */
74#define GPIO_CCLK 0x800
75#define GPIO_DSCLK 0x400
76#define GPIO_E2CLK 0x200
77#define GPIO_IOLOAD 0x100
78#define GPIO_RED_LED 0x080
79#define GPIO_WDTIMER 0x040
80#define GPIO_DATA 0x020
81#define GPIO_IOCLK 0x010
82#define GPIO_DONE 0x008
83#define GPIO_FAN 0x004
84#define GPIO_GREEN_LED 0x002
85#define GPIO_RESET 0x001
86
87/* CPLD pins */
88#define CPLD_DS_ENABLE 8
89#define CPLD_7111_DISABLE 4
90#define CPLD_UNMUTE 2
91#define CPLD_FLASH_WR_ENABLE 1
92
93#ifndef __ASSEMBLY__
94extern void gpio_modify_op(int mask, int set);
95extern void gpio_modify_io(int mask, int in);
96extern int gpio_read(void);
97extern void cpld_modify(int mask, int set);
98#endif
99
100#define pcibios_assign_all_busses() 1
101
102#define PCIBIOS_MIN_IO 0x1000
103#define PCIBIOS_MIN_MEM 0x81000000
104
105#endif
diff --git a/arch/arm/mach-footbridge/include/mach/io.h b/arch/arm/mach-footbridge/include/mach/io.h
new file mode 100644
index 000000000000..a7b066239996
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/io.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/io.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Modifications:
11 * 06-12-1997 RMK Created.
12 * 07-04-1999 RMK Major cleanup
13 */
14#ifndef __ASM_ARM_ARCH_IO_H
15#define __ASM_ARM_ARCH_IO_H
16
17#include <mach/hardware.h>
18
19#define IO_SPACE_LIMIT 0xffff
20
21/*
22 * Translation of various region addresses to virtual addresses
23 */
24#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
25#if 1
26#define __mem_pci(a) (a)
27#else
28
29static inline void __iomem *___mem_pci(void __iomem *p)
30{
31 unsigned long a = (unsigned long)p;
32 BUG_ON(a <= 0xc0000000 || a >= 0xe0000000);
33 return p;
34}
35
36#define __mem_pci(a) ___mem_pci(a)
37#endif
38
39#endif
diff --git a/arch/arm/mach-footbridge/include/mach/irqs.h b/arch/arm/mach-footbridge/include/mach/irqs.h
new file mode 100644
index 000000000000..400551e43e4e
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/irqs.h
@@ -0,0 +1,98 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/irqs.h
3 *
4 * Copyright (C) 1998 Russell King
5 * Copyright (C) 1998 Phil Blundell
6 *
7 * Changelog:
8 * 20-Jan-1998 RMK Started merge of EBSA286, CATS and NetWinder
9 * 01-Feb-1999 PJB ISA IRQs start at 0 not 16
10 */
11#include <asm/mach-types.h>
12
13#define NR_IRQS 36
14#define NR_DC21285_IRQS 16
15
16#define _ISA_IRQ(x) (0 + (x))
17#define _ISA_INR(x) ((x) - 0)
18#define _DC21285_IRQ(x) (16 + (x))
19#define _DC21285_INR(x) ((x) - 16)
20
21/*
22 * This is a list of all interrupts that the 21285
23 * can generate and we handle.
24 */
25#define IRQ_CONRX _DC21285_IRQ(0)
26#define IRQ_CONTX _DC21285_IRQ(1)
27#define IRQ_TIMER1 _DC21285_IRQ(2)
28#define IRQ_TIMER2 _DC21285_IRQ(3)
29#define IRQ_TIMER3 _DC21285_IRQ(4)
30#define IRQ_IN0 _DC21285_IRQ(5)
31#define IRQ_IN1 _DC21285_IRQ(6)
32#define IRQ_IN2 _DC21285_IRQ(7)
33#define IRQ_IN3 _DC21285_IRQ(8)
34#define IRQ_DOORBELLHOST _DC21285_IRQ(9)
35#define IRQ_DMA1 _DC21285_IRQ(10)
36#define IRQ_DMA2 _DC21285_IRQ(11)
37#define IRQ_PCI _DC21285_IRQ(12)
38#define IRQ_SDRAMPARITY _DC21285_IRQ(13)
39#define IRQ_I2OINPOST _DC21285_IRQ(14)
40#define IRQ_PCI_ABORT _DC21285_IRQ(15)
41#define IRQ_PCI_SERR _DC21285_IRQ(16)
42#define IRQ_DISCARD_TIMER _DC21285_IRQ(17)
43#define IRQ_PCI_DPERR _DC21285_IRQ(18)
44#define IRQ_PCI_PERR _DC21285_IRQ(19)
45
46#define IRQ_ISA_TIMER _ISA_IRQ(0)
47#define IRQ_ISA_KEYBOARD _ISA_IRQ(1)
48#define IRQ_ISA_CASCADE _ISA_IRQ(2)
49#define IRQ_ISA_UART2 _ISA_IRQ(3)
50#define IRQ_ISA_UART _ISA_IRQ(4)
51#define IRQ_ISA_FLOPPY _ISA_IRQ(6)
52#define IRQ_ISA_PRINTER _ISA_IRQ(7)
53#define IRQ_ISA_RTC_ALARM _ISA_IRQ(8)
54#define IRQ_ISA_2 _ISA_IRQ(9)
55#define IRQ_ISA_PS2MOUSE _ISA_IRQ(12)
56#define IRQ_ISA_HARDDISK1 _ISA_IRQ(14)
57#define IRQ_ISA_HARDDISK2 _ISA_IRQ(15)
58
59#define IRQ_MASK_UART_RX (1 << 2)
60#define IRQ_MASK_UART_TX (1 << 3)
61#define IRQ_MASK_TIMER1 (1 << 4)
62#define IRQ_MASK_TIMER2 (1 << 5)
63#define IRQ_MASK_TIMER3 (1 << 6)
64#define IRQ_MASK_IN0 (1 << 8)
65#define IRQ_MASK_IN1 (1 << 9)
66#define IRQ_MASK_IN2 (1 << 10)
67#define IRQ_MASK_IN3 (1 << 11)
68#define IRQ_MASK_DOORBELLHOST (1 << 15)
69#define IRQ_MASK_DMA1 (1 << 16)
70#define IRQ_MASK_DMA2 (1 << 17)
71#define IRQ_MASK_PCI (1 << 18)
72#define IRQ_MASK_SDRAMPARITY (1 << 24)
73#define IRQ_MASK_I2OINPOST (1 << 25)
74#define IRQ_MASK_PCI_ABORT ((1 << 29) | (1 << 30))
75#define IRQ_MASK_PCI_SERR (1 << 23)
76#define IRQ_MASK_DISCARD_TIMER (1 << 27)
77#define IRQ_MASK_PCI_DPERR (1 << 28)
78#define IRQ_MASK_PCI_PERR (1 << 31)
79
80/*
81 * Netwinder interrupt allocations
82 */
83#define IRQ_NETWINDER_ETHER10 IRQ_IN0
84#define IRQ_NETWINDER_ETHER100 IRQ_IN1
85#define IRQ_NETWINDER_VIDCOMP IRQ_IN2
86#define IRQ_NETWINDER_PS2MOUSE _ISA_IRQ(5)
87#define IRQ_NETWINDER_IR _ISA_IRQ(6)
88#define IRQ_NETWINDER_BUTTON _ISA_IRQ(10)
89#define IRQ_NETWINDER_VGA _ISA_IRQ(11)
90#define IRQ_NETWINDER_SOUND _ISA_IRQ(12)
91
92#undef RTC_IRQ
93#define RTC_IRQ IRQ_ISA_RTC_ALARM
94#define I8042_KBD_IRQ IRQ_ISA_KEYBOARD
95#define I8042_AUX_IRQ (machine_is_netwinder() ? IRQ_NETWINDER_PS2MOUSE : IRQ_ISA_PS2MOUSE)
96#define IRQ_FLOPPYDISK IRQ_ISA_FLOPPY
97
98#define irq_canonicalize(_i) (((_i) == IRQ_ISA_CASCADE) ? IRQ_ISA_2 : _i)
diff --git a/arch/arm/mach-footbridge/include/mach/memory.h b/arch/arm/mach-footbridge/include/mach/memory.h
new file mode 100644
index 000000000000..e9cae99dd1f9
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/memory.h
@@ -0,0 +1,67 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/memory.h
3 *
4 * Copyright (C) 1996-1999 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Changelog:
11 * 20-Oct-1996 RMK Created
12 * 31-Dec-1997 RMK Fixed definitions to reduce warnings.
13 * 17-May-1998 DAG Added __virt_to_bus and __bus_to_virt functions.
14 * 21-Nov-1998 RMK Changed __virt_to_bus and __bus_to_virt to macros.
15 * 21-Mar-1999 RMK Added PAGE_OFFSET for co285 architecture.
16 * Renamed to memory.h
17 * Moved PAGE_OFFSET and TASK_SIZE here
18 */
19#ifndef __ASM_ARCH_MEMORY_H
20#define __ASM_ARCH_MEMORY_H
21
22
23#if defined(CONFIG_FOOTBRIDGE_ADDIN)
24/*
25 * If we may be using add-in footbridge mode, then we must
26 * use the out-of-line translation that makes use of the
27 * PCI BAR
28 */
29#ifndef __ASSEMBLY__
30extern unsigned long __virt_to_bus(unsigned long);
31extern unsigned long __bus_to_virt(unsigned long);
32#endif
33
34#elif defined(CONFIG_FOOTBRIDGE_HOST)
35
36#define __virt_to_bus(x) ((x) - 0xe0000000)
37#define __bus_to_virt(x) ((x) + 0xe0000000)
38
39#else
40
41#error "Undefined footbridge mode"
42
43#endif
44
45/* Task size and page offset at 3GB */
46#define TASK_SIZE UL(0xbf000000)
47#define PAGE_OFFSET UL(0xc0000000)
48
49/*
50 * Cache flushing area.
51 */
52#define FLUSH_BASE 0xf9000000
53
54/*
55 * Physical DRAM offset.
56 */
57#define PHYS_OFFSET UL(0x00000000)
58
59/*
60 * This decides where the kernel will search for a free chunk of vm
61 * space during mmap's.
62 */
63#define TASK_UNMAPPED_BASE ((TASK_SIZE + 0x01000000) / 3)
64
65#define FLUSH_BASE_PHYS 0x50000000
66
67#endif
diff --git a/arch/arm/mach-footbridge/include/mach/system.h b/arch/arm/mach-footbridge/include/mach/system.h
new file mode 100644
index 000000000000..01c9f407f498
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/system.h
@@ -0,0 +1,69 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/system.h
3 *
4 * Copyright (C) 1996-1999 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <asm/hardware/dec21285.h>
11#include <asm/io.h>
12#include <mach/hardware.h>
13#include <asm/leds.h>
14#include <asm/mach-types.h>
15
16static inline void arch_idle(void)
17{
18 cpu_do_idle();
19}
20
21static inline void arch_reset(char mode)
22{
23 if (mode == 's') {
24 /*
25 * Jump into the ROM
26 */
27 cpu_reset(0x41000000);
28 } else {
29 if (machine_is_netwinder()) {
30 /* open up the SuperIO chip
31 */
32 outb(0x87, 0x370);
33 outb(0x87, 0x370);
34
35 /* aux function group 1 (logical device 7)
36 */
37 outb(0x07, 0x370);
38 outb(0x07, 0x371);
39
40 /* set GP16 for WD-TIMER output
41 */
42 outb(0xe6, 0x370);
43 outb(0x00, 0x371);
44
45 /* set a RED LED and toggle WD_TIMER for rebooting
46 */
47 outb(0xc4, 0x338);
48 } else {
49 /*
50 * Force the watchdog to do a CPU reset.
51 *
52 * After making sure that the watchdog is disabled
53 * (so we can change the timer registers) we first
54 * enable the timer to autoreload itself. Next, the
55 * timer interval is set really short and any
56 * current interrupt request is cleared (so we can
57 * see an edge transition). Finally, TIMER4 is
58 * enabled as the watchdog.
59 */
60 *CSR_SA110_CNTL &= ~(1 << 13);
61 *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE |
62 TIMER_CNTL_AUTORELOAD |
63 TIMER_CNTL_DIV16;
64 *CSR_TIMER4_LOAD = 0x2;
65 *CSR_TIMER4_CLR = 0;
66 *CSR_SA110_CNTL |= (1 << 13);
67 }
68 }
69}
diff --git a/arch/arm/mach-footbridge/include/mach/timex.h b/arch/arm/mach-footbridge/include/mach/timex.h
new file mode 100644
index 000000000000..d0fea9d6d4ab
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/timex.h
@@ -0,0 +1,18 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/timex.h
3 *
4 * Copyright (C) 1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * EBSA285 architecture timex specifications
11 */
12
13/*
14 * We assume a constant here; this satisfies the maths in linux/timex.h
15 * and linux/time.h. CLOCK_TICK_RATE is actually system dependent, but
16 * this must be a constant.
17 */
18#define CLOCK_TICK_RATE (50000000/16)
diff --git a/arch/arm/mach-footbridge/include/mach/uncompress.h b/arch/arm/mach-footbridge/include/mach/uncompress.h
new file mode 100644
index 000000000000..5dfa44287346
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/uncompress.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/uncompress.h
3 *
4 * Copyright (C) 1996-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <asm/mach-types.h>
11
12/*
13 * Note! This could cause problems on the NetWinder
14 */
15#define DC21285_BASE ((volatile unsigned int *)0x42000160)
16#define SER0_BASE ((volatile unsigned char *)0x7c0003f8)
17
18static inline void putc(char c)
19{
20 if (machine_is_netwinder()) {
21 while ((SER0_BASE[5] & 0x60) != 0x60)
22 barrier();
23 SER0_BASE[0] = c;
24 } else {
25 while (DC21285_BASE[6] & 8);
26 DC21285_BASE[0] = c;
27 }
28}
29
30static inline void flush(void)
31{
32}
33
34/*
35 * nothing to do
36 */
37#define arch_decomp_setup()
38#define arch_decomp_wdog()
diff --git a/arch/arm/mach-footbridge/include/mach/vmalloc.h b/arch/arm/mach-footbridge/include/mach/vmalloc.h
new file mode 100644
index 000000000000..d0958d860a3c
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/vmalloc.h
@@ -0,0 +1,10 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/vmalloc.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9
10#define VMALLOC_END (PAGE_OFFSET + 0x30000000)
diff --git a/arch/arm/mach-footbridge/isa-irq.c b/arch/arm/mach-footbridge/isa-irq.c
index 79443ffc8916..7132e522c366 100644
--- a/arch/arm/mach-footbridge/isa-irq.c
+++ b/arch/arm/mach-footbridge/isa-irq.c
@@ -21,7 +21,7 @@
21 21
22#include <asm/mach/irq.h> 22#include <asm/mach/irq.h>
23 23
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/hardware/dec21285.h> 25#include <asm/hardware/dec21285.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/io.h> 27#include <asm/io.h>
diff --git a/arch/arm/mach-footbridge/netwinder-leds.c b/arch/arm/mach-footbridge/netwinder-leds.c
index 8e9cac5a213b..d91a4f4a32dc 100644
--- a/arch/arm/mach-footbridge/netwinder-leds.c
+++ b/arch/arm/mach-footbridge/netwinder-leds.c
@@ -21,7 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23 23
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/leds.h> 25#include <asm/leds.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/system.h> 27#include <asm/system.h>
diff --git a/arch/arm/mach-footbridge/time.c b/arch/arm/mach-footbridge/time.c
index d5cfcda385d6..fd9a7c11d62d 100644
--- a/arch/arm/mach-footbridge/time.c
+++ b/arch/arm/mach-footbridge/time.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/arch-ebsa285/time.h 2 * arch/arm/mach-footbridge/include/mach/time.h
3 * 3 *
4 * Copyright (C) 1998 Russell King. 4 * Copyright (C) 1998 Russell King.
5 * Copyright (C) 1998 Phil Blundell 5 * Copyright (C) 1998 Phil Blundell
@@ -23,7 +23,7 @@
23#include <linux/mc146818rtc.h> 23#include <linux/mc146818rtc.h>
24#include <linux/bcd.h> 24#include <linux/bcd.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/io.h> 27#include <asm/io.h>
28 28
29#include <asm/mach/time.h> 29#include <asm/mach/time.h>
diff --git a/arch/arm/mach-h720x/common.c b/arch/arm/mach-h720x/common.c
index 45144ad2bed9..b5f9741ae13c 100644
--- a/arch/arm/mach-h720x/common.c
+++ b/arch/arm/mach-h720x/common.c
@@ -23,11 +23,11 @@
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/dma.h> 24#include <asm/dma.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30#include <asm/arch/irqs.h> 30#include <mach/irqs.h>
31 31
32#include <asm/mach/dma.h> 32#include <asm/mach/dma.h>
33 33
diff --git a/arch/arm/mach-h720x/cpu-h7201.c b/arch/arm/mach-h720x/cpu-h7201.c
index c2a431f482f0..24df2a349a98 100644
--- a/arch/arm/mach-h720x/cpu-h7201.c
+++ b/arch/arm/mach-h720x/cpu-h7201.c
@@ -17,9 +17,9 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <asm/types.h> 19#include <asm/types.h>
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/arch/irqs.h> 22#include <mach/irqs.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include "common.h" 25#include "common.h"
diff --git a/arch/arm/mach-h720x/cpu-h7202.c b/arch/arm/mach-h720x/cpu-h7202.c
index c627fa124eb3..53e1f62f2e79 100644
--- a/arch/arm/mach-h720x/cpu-h7202.c
+++ b/arch/arm/mach-h720x/cpu-h7202.c
@@ -17,9 +17,9 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <asm/types.h> 19#include <asm/types.h>
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/arch/irqs.h> 22#include <mach/irqs.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <linux/device.h> 25#include <linux/device.h>
diff --git a/arch/arm/mach-h720x/h7201-eval.c b/arch/arm/mach-h720x/h7201-eval.c
index 407cd4c0aa8a..78be457dc324 100644
--- a/arch/arm/mach-h720x/h7201-eval.c
+++ b/arch/arm/mach-h720x/h7201-eval.c
@@ -25,7 +25,7 @@
25#include <asm/page.h> 25#include <asm/page.h>
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include "common.h" 29#include "common.h"
30 30
31MACHINE_START(H7201, "Hynix GMS30C7201") 31MACHINE_START(H7201, "Hynix GMS30C7201")
diff --git a/arch/arm/mach-h720x/h7202-eval.c b/arch/arm/mach-h720x/h7202-eval.c
index bf2acdce62e5..56161d55cf47 100644
--- a/arch/arm/mach-h720x/h7202-eval.c
+++ b/arch/arm/mach-h720x/h7202-eval.c
@@ -25,7 +25,7 @@
25#include <asm/page.h> 25#include <asm/page.h>
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include "common.h" 29#include "common.h"
30 30
31static struct resource cirrus_resources[] = { 31static struct resource cirrus_resources[] = {
diff --git a/arch/arm/mach-h720x/include/mach/boards.h b/arch/arm/mach-h720x/include/mach/boards.h
new file mode 100644
index 000000000000..079b279e1242
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/boards.h
@@ -0,0 +1,53 @@
1/*
2 * arch/arm/mach-h720x/include/mach/boards.h
3 *
4 * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de>
5 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 *
7 * This file contains the board specific defines for various devices
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_HARDWARE_INCMACH_H
15#error Do not include this file directly. Include asm/hardware.h instead !
16#endif
17
18/* Hynix H7202 developer board specific device defines */
19#ifdef CONFIG_ARCH_H7202
20
21/* FLASH */
22#define FLASH_VIRT 0xd0000000
23#define FLASH_PHYS 0x00000000
24#define FLASH_SIZE 0x02000000
25
26/* onboard LAN controller */
27# define ETH0_PHYS 0x08000000
28
29/* Touch screen defines */
30/* GPIO Port */
31#define PEN_GPIO GPIO_B_VIRT
32/* Bitmask for pen down interrupt */
33#define PEN_INT_BIT (1<<7)
34/* Bitmask for pen up interrupt */
35#define PEN_ENA_BIT (1<<6)
36/* pen up interrupt */
37#define IRQ_PEN IRQ_MUX_GPIOB(7)
38
39#endif
40
41/* Hynix H7201 developer board specific device defines */
42#if defined (CONFIG_ARCH_H7201)
43/* ROM DISK SPACE */
44#define ROM_DISK_BASE 0xc1800000
45#define ROM_DISK_START 0x41800000
46#define ROM_DISK_SIZE 0x00700000
47
48/* SRAM DISK SPACE */
49#define SRAM_DISK_BASE 0xf1000000
50#define SRAM_DISK_START 0x04000000
51#define SRAM_DISK_SIZE 0x00400000
52#endif
53
diff --git a/arch/arm/mach-h720x/include/mach/debug-macro.S b/arch/arm/mach-h720x/include/mach/debug-macro.S
new file mode 100644
index 000000000000..6294a1344dda
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/debug-macro.S
@@ -0,0 +1,40 @@
1/* arch/arm/mach-h720x/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
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, #0x00020000 @ UART1
23 .endm
24
25 .macro senduart,rd,rx
26 str \rd, [\rx, #0x0] @ UARTDR
27
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-h720x/include/mach/dma.h b/arch/arm/mach-h720x/include/mach/dma.h
new file mode 100644
index 000000000000..0a9d86ee84fe
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/dma.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-h720x/include/mach/dma.h
3 *
4 * Architecture DMA routes
5 *
6 * Copyright (C) 1997.1998 Russell King
7 */
8#ifndef __ASM_ARCH_DMA_H
9#define __ASM_ARCH_DMA_H
10
11/*
12 * This is the maximum DMA address that can be DMAd to.
13 * There should not be more than (0xd0000000 - 0xc0000000)
14 * bytes of RAM.
15 */
16#define MAX_DMA_ADDRESS 0xd0000000
17
18#if defined (CONFIG_CPU_H7201)
19#define MAX_DMA_CHANNELS 3
20#elif defined (CONFIG_CPU_H7202)
21#define MAX_DMA_CHANNELS 4
22#else
23#error processor definition missmatch
24#endif
25
26#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-h720x/include/mach/entry-macro.S b/arch/arm/mach-h720x/include/mach/entry-macro.S
new file mode 100644
index 000000000000..6d3b917c4a18
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/entry-macro.S
@@ -0,0 +1,66 @@
1/*
2 * arch/arm/mach-h720x/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Hynix HMS720x 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
11 .macro disable_fiq
12 .endm
13
14 .macro get_irqnr_preamble, base, tmp
15 .endm
16
17 .macro arch_ret_to_user, tmp1, tmp2
18 .endm
19
20 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
21#if defined (CONFIG_CPU_H7201) || defined (CONFIG_CPU_H7202)
22 @ we could use the id register on H7202, but this is not
23 @ properly updated when we come back from asm_do_irq
24 @ without a previous return from interrupt
25 @ (see loops below in irq_svc, irq_usr)
26 @ We see unmasked pending ints only, as the masked pending ints
27 @ are not visible here
28
29 mov \base, #0xf0000000 @ base register
30 orr \base, \base, #0x24000 @ irqbase
31 ldr \irqstat, [\base, #0x04] @ get interrupt status
32#if defined (CONFIG_CPU_H7201)
33 ldr \tmp, =0x001fffff
34#else
35 mvn \tmp, #0xc0000000
36#endif
37 and \irqstat, \irqstat, \tmp @ mask out unused ints
38 mov \irqnr, #0
39
40 mov \tmp, #0xff00
41 orr \tmp, \tmp, #0xff
42 tst \irqstat, \tmp
43 addeq \irqnr, \irqnr, #16
44 moveq \irqstat, \irqstat, lsr #16
45 tst \irqstat, #255
46 addeq \irqnr, \irqnr, #8
47 moveq \irqstat, \irqstat, lsr #8
48 tst \irqstat, #15
49 addeq \irqnr, \irqnr, #4
50 moveq \irqstat, \irqstat, lsr #4
51 tst \irqstat, #3
52 addeq \irqnr, \irqnr, #2
53 moveq \irqstat, \irqstat, lsr #2
54 tst \irqstat, #1
55 addeq \irqnr, \irqnr, #1
56 moveq \irqstat, \irqstat, lsr #1
57 tst \irqstat, #1 @ bit 0 should be set
58 .endm
59
60 .macro irq_prio_table
61 .endm
62
63#else
64#error hynix processor selection missmatch
65#endif
66
diff --git a/arch/arm/mach-h720x/include/mach/h7201-regs.h b/arch/arm/mach-h720x/include/mach/h7201-regs.h
new file mode 100644
index 000000000000..611b4947ccfc
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/h7201-regs.h
@@ -0,0 +1,67 @@
1/*
2 * arch/arm/mach-h720x/include/mach/h7201-regs.h
3 *
4 * Copyright (C) 2000 Jungjun Kim, Hynix Semiconductor Inc.
5 * (C) 2003 Thomas Gleixner <tglx@linutronix.de>
6 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
7 * (C) 2004 Sascha Hauer <s.hauer@pengutronix.de>
8 *
9 * This file contains the hardware definitions of the h720x processors
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 * Do not add implementations specific defines here. This files contains
16 * only defines of the onchip peripherals. Add those defines to boards.h,
17 * which is included by this file.
18 */
19
20#define SERIAL2_VIRT (IO_VIRT + 0x50100)
21#define SERIAL3_VIRT (IO_VIRT + 0x50200)
22
23/*
24 * PCMCIA
25 */
26#define PCMCIA0_ATT_BASE 0xe5000000
27#define PCMCIA0_ATT_SIZE 0x00200000
28#define PCMCIA0_ATT_START 0x20000000
29#define PCMCIA0_MEM_BASE 0xe5200000
30#define PCMCIA0_MEM_SIZE 0x00200000
31#define PCMCIA0_MEM_START 0x24000000
32#define PCMCIA0_IO_BASE 0xe5400000
33#define PCMCIA0_IO_SIZE 0x00200000
34#define PCMCIA0_IO_START 0x28000000
35
36#define PCMCIA1_ATT_BASE 0xe5600000
37#define PCMCIA1_ATT_SIZE 0x00200000
38#define PCMCIA1_ATT_START 0x30000000
39#define PCMCIA1_MEM_BASE 0xe5800000
40#define PCMCIA1_MEM_SIZE 0x00200000
41#define PCMCIA1_MEM_START 0x34000000
42#define PCMCIA1_IO_BASE 0xe5a00000
43#define PCMCIA1_IO_SIZE 0x00200000
44#define PCMCIA1_IO_START 0x38000000
45
46#define PRIME3C_BASE 0xf0050000
47#define PRIME3C_SIZE 0x00001000
48#define PRIME3C_START 0x10000000
49
50/* VGA Controller */
51#define VGA_RAMBASE 0x50
52#define VGA_TIMING0 0x60
53#define VGA_TIMING1 0x64
54#define VGA_TIMING2 0x68
55#define VGA_TIMING3 0x6c
56
57#define LCD_CTRL_VGA_ENABLE 0x00000100
58#define LCD_CTRL_VGA_BPP_MASK 0x00000600
59#define LCD_CTRL_VGA_4BPP 0x00000000
60#define LCD_CTRL_VGA_8BPP 0x00000200
61#define LCD_CTRL_VGA_16BPP 0x00000300
62#define LCD_CTRL_SHARE_DMA 0x00000800
63#define LCD_CTRL_VDE 0x00100000
64#define LCD_CTRL_LPE 0x00400000 /* LCD Power enable */
65#define LCD_CTRL_BLE 0x00800000 /* LCD backlight enable */
66
67#define VGA_PALETTE_BASE (IO_VIRT + 0x10800)
diff --git a/arch/arm/mach-h720x/include/mach/h7202-regs.h b/arch/arm/mach-h720x/include/mach/h7202-regs.h
new file mode 100644
index 000000000000..17c12eb34995
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/h7202-regs.h
@@ -0,0 +1,155 @@
1/*
2 * arch/arm/mach-h720x/include/mach/h7202-regs.h
3 *
4 * Copyright (C) 2000 Jungjun Kim, Hynix Semiconductor Inc.
5 * (C) 2003 Thomas Gleixner <tglx@linutronix.de>
6 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
7 * (C) 2004 Sascha Hauer <s.hauer@pengutronix.de>
8 *
9 * This file contains the hardware definitions of the h720x processors
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 * Do not add implementations specific defines here. This files contains
16 * only defines of the onchip peripherals. Add those defines to boards.h,
17 * which is included by this file.
18 */
19
20#define SERIAL2_OFS 0x2d000
21#define SERIAL2_BASE (IO_PHYS + SERIAL2_OFS)
22#define SERIAL2_VIRT (IO_VIRT + SERIAL2_OFS)
23#define SERIAL3_OFS 0x2e000
24#define SERIAL3_BASE (IO_PHYS + SERIAL3_OFS)
25#define SERIAL3_VIRT (IO_VIRT + SERIAL3_OFS)
26
27/* Matrix Keyboard Controller */
28#define KBD_VIRT (IO_VIRT + 0x22000)
29#define KBD_KBCR 0x00
30#define KBD_KBSC 0x04
31#define KBD_KBTR 0x08
32#define KBD_KBVR0 0x0C
33#define KBD_KBVR1 0x10
34#define KBD_KBSR 0x18
35
36#define KBD_KBCR_SCANENABLE (1 << 7)
37#define KBD_KBCR_NPOWERDOWN (1 << 2)
38#define KBD_KBCR_CLKSEL_MASK (3)
39#define KBD_KBCR_CLKSEL_PCLK2 0x0
40#define KBD_KBCR_CLKSEL_PCLK128 0x1
41#define KBD_KBCR_CLKSEL_PCLK256 0x2
42#define KBD_KBCR_CLKSEL_PCLK512 0x3
43
44#define KBD_KBSR_INTR (1 << 0)
45#define KBD_KBSR_WAKEUP (1 << 1)
46
47/* USB device controller */
48
49#define USBD_BASE (IO_VIRT + 0x12000)
50#define USBD_LENGTH 0x3C
51
52#define USBD_GCTRL 0x00
53#define USBD_EPCTRL 0x04
54#define USBD_INTMASK 0x08
55#define USBD_INTSTAT 0x0C
56#define USBD_PWR 0x10
57#define USBD_DMARXTX 0x14
58#define USBD_DEVID 0x18
59#define USBD_DEVCLASS 0x1C
60#define USBD_INTCLASS 0x20
61#define USBD_SETUP0 0x24
62#define USBD_SETUP1 0x28
63#define USBD_ENDP0RD 0x2C
64#define USBD_ENDP0WT 0x30
65#define USBD_ENDP1RD 0x34
66#define USBD_ENDP2WT 0x38
67
68/* PS/2 port */
69#define PSDATA 0x00
70#define PSSTAT 0x04
71#define PSSTAT_TXEMPTY (1<<0)
72#define PSSTAT_TXBUSY (1<<1)
73#define PSSTAT_RXFULL (1<<2)
74#define PSSTAT_RXBUSY (1<<3)
75#define PSSTAT_CLKIN (1<<4)
76#define PSSTAT_DATAIN (1<<5)
77#define PSSTAT_PARITY (1<<6)
78
79#define PSCONF 0x08
80#define PSCONF_ENABLE (1<<0)
81#define PSCONF_TXINTEN (1<<2)
82#define PSCONF_RXINTEN (1<<3)
83#define PSCONF_FORCECLKLOW (1<<4)
84#define PSCONF_FORCEDATLOW (1<<5)
85#define PSCONF_LCE (1<<6)
86
87#define PSINTR 0x0C
88#define PSINTR_TXINT (1<<0)
89#define PSINTR_RXINT (1<<1)
90#define PSINTR_PAR (1<<2)
91#define PSINTR_RXTO (1<<3)
92#define PSINTR_TXTO (1<<4)
93
94#define PSTDLO 0x10 /* clk low before start transmission */
95#define PSTPRI 0x14 /* PRI clock */
96#define PSTXMT 0x18 /* maximum transmission time */
97#define PSTREC 0x20 /* maximum receive time */
98#define PSPWDN 0x3c
99
100/* ADC converter */
101#define ADC_BASE (IO_VIRT + 0x29000)
102#define ADC_CR 0x00
103#define ADC_TSCTRL 0x04
104#define ADC_BT_CTRL 0x08
105#define ADC_MC_CTRL 0x0C
106#define ADC_STATUS 0x10
107
108/* ADC control register bits */
109#define ADC_CR_PW_CTRL 0x80
110#define ADC_CR_DIRECTC 0x04
111#define ADC_CR_CONTIME_NO 0x00
112#define ADC_CR_CONTIME_2 0x04
113#define ADC_CR_CONTIME_4 0x08
114#define ADC_CR_CONTIME_ADE 0x0c
115#define ADC_CR_LONGCALTIME 0x01
116
117/* ADC touch panel register bits */
118#define ADC_TSCTRL_ENABLE 0x80
119#define ADC_TSCTRL_INTR 0x40
120#define ADC_TSCTRL_SWBYPSS 0x20
121#define ADC_TSCTRL_SWINVT 0x10
122#define ADC_TSCTRL_S400 0x03
123#define ADC_TSCTRL_S200 0x02
124#define ADC_TSCTRL_S100 0x01
125#define ADC_TSCTRL_S50 0x00
126
127/* ADC Interrupt Status Register bits */
128#define ADC_STATUS_TS_BIT 0x80
129#define ADC_STATUS_MBT_BIT 0x40
130#define ADC_STATUS_BBT_BIT 0x20
131#define ADC_STATUS_MIC_BIT 0x10
132
133/* Touch data registers */
134#define ADC_TS_X0X1 0x30
135#define ADC_TS_X2X3 0x34
136#define ADC_TS_Y0Y1 0x38
137#define ADC_TS_Y2Y3 0x3c
138#define ADC_TS_X4X5 0x40
139#define ADC_TS_X6X7 0x44
140#define ADC_TS_Y4Y5 0x48
141#define ADC_TS_Y6Y7 0x50
142
143/* battery data */
144#define ADC_MB_DATA 0x54
145#define ADC_BB_DATA 0x58
146
147/* Sound data register */
148#define ADC_SD_DAT0 0x60
149#define ADC_SD_DAT1 0x64
150#define ADC_SD_DAT2 0x68
151#define ADC_SD_DAT3 0x6c
152#define ADC_SD_DAT4 0x70
153#define ADC_SD_DAT5 0x74
154#define ADC_SD_DAT6 0x78
155#define ADC_SD_DAT7 0x7c
diff --git a/arch/arm/mach-h720x/include/mach/hardware.h b/arch/arm/mach-h720x/include/mach/hardware.h
new file mode 100644
index 000000000000..6c19156e2a42
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/hardware.h
@@ -0,0 +1,192 @@
1/*
2 * arch/arm/mach-h720x/include/mach/hardware.h
3 *
4 * Copyright (C) 2000 Jungjun Kim, Hynix Semiconductor Inc.
5 * (C) 2003 Thomas Gleixner <tglx@linutronix.de>
6 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
7 *
8 * This file contains the hardware definitions of the h720x processors
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * Do not add implementations specific defines here. This files contains
15 * only defines of the onchip peripherals. Add those defines to boards.h,
16 * which is included by this file.
17 */
18
19#ifndef __ASM_ARCH_HARDWARE_H
20#define __ASM_ARCH_HARDWARE_H
21
22#define IOCLK (3686400L)
23
24/* Onchip peripherals */
25
26#define IO_VIRT 0xf0000000 /* IO peripherals */
27#define IO_PHYS 0x80000000
28#define IO_SIZE 0x00050000
29
30#ifdef CONFIG_CPU_H7202
31#include "h7202-regs.h"
32#elif defined CONFIG_CPU_H7201
33#include "h7201-regs.h"
34#else
35#error machine definition mismatch
36#endif
37
38/* Macro to access the CPU IO */
39#define CPU_IO(x) (*(volatile u32*)(x))
40
41/* Macro to access general purpose regs (base, offset) */
42#define CPU_REG(x,y) CPU_IO(x+y)
43
44/* Macro to access irq related regs */
45#define IRQ_REG(x) CPU_REG(IRQC_VIRT,x)
46
47/* CPU registers */
48/* general purpose I/O */
49#define GPIO_VIRT(x) (IO_VIRT + 0x23000 + ((x)<<5))
50#define GPIO_A_VIRT (GPIO_VIRT(0))
51#define GPIO_B_VIRT (GPIO_VIRT(1))
52#define GPIO_C_VIRT (GPIO_VIRT(2))
53#define GPIO_D_VIRT (GPIO_VIRT(3))
54#define GPIO_E_VIRT (GPIO_VIRT(4))
55#define GPIO_AMULSEL (GPIO_VIRT(0) + 0xA4)
56
57#define AMULSEL_USIN2 (1<<5)
58#define AMULSEL_USOUT2 (1<<6)
59#define AMULSEL_USIN3 (1<<13)
60#define AMULSEL_USOUT3 (1<<14)
61#define AMULSEL_IRDIN (1<<15)
62#define AMULSEL_IRDOUT (1<<7)
63
64/* Register offsets general purpose I/O */
65#define GPIO_DATA 0x00
66#define GPIO_DIR 0x04
67#define GPIO_MASK 0x08
68#define GPIO_STAT 0x0C
69#define GPIO_EDGE 0x10
70#define GPIO_CLR 0x14
71#define GPIO_POL 0x18
72#define GPIO_EN 0x1C
73
74/*interrupt controller */
75#define IRQC_VIRT (IO_VIRT + 0x24000)
76/* register offset interrupt controller */
77#define IRQC_IER 0x00
78#define IRQC_ISR 0x04
79
80/* timer unit */
81#define TIMER_VIRT (IO_VIRT + 0x25000)
82/* Register offsets timer unit */
83#define TM0_PERIOD 0x00
84#define TM0_COUNT 0x08
85#define TM0_CTRL 0x10
86#define TM1_PERIOD 0x20
87#define TM1_COUNT 0x28
88#define TM1_CTRL 0x30
89#define TM2_PERIOD 0x40
90#define TM2_COUNT 0x48
91#define TM2_CTRL 0x50
92#define TIMER_TOPCTRL 0x60
93#define TIMER_TOPSTAT 0x64
94#define T64_COUNTL 0x80
95#define T64_COUNTH 0x84
96#define T64_CTRL 0x88
97#define T64_BASEL 0x94
98#define T64_BASEH 0x98
99/* Bitmaks timer unit TOPSTAT reg */
100#define TSTAT_T0INT 0x1
101#define TSTAT_T1INT 0x2
102#define TSTAT_T2INT 0x4
103#define TSTAT_T3INT 0x8
104/* Bit description of TMx_CTRL register */
105#define TM_START 0x1
106#define TM_REPEAT 0x2
107#define TM_RESET 0x4
108/* Bit description of TIMER_CTRL register */
109#define ENABLE_TM0_INTR 0x1
110#define ENABLE_TM1_INTR 0x2
111#define ENABLE_TM2_INTR 0x4
112#define TIMER_ENABLE_BIT 0x8
113#define ENABLE_TIMER64 0x10
114#define ENABLE_TIMER64_INT 0x20
115
116/* PMU & PLL */
117#define PMU_BASE (IO_VIRT + 0x1000)
118#define PMU_MODE 0x00
119#define PMU_STAT 0x20
120#define PMU_PLL_CTRL 0x28
121
122/* PMU Mode bits */
123#define PMU_MODE_SLOW 0x00
124#define PMU_MODE_RUN 0x01
125#define PMU_MODE_IDLE 0x02
126#define PMU_MODE_SLEEP 0x03
127#define PMU_MODE_INIT 0x04
128#define PMU_MODE_DEEPSLEEP 0x07
129#define PMU_MODE_WAKEUP 0x08
130
131/* PMU ... */
132#define PLL_2_EN 0x8000
133#define PLL_1_EN 0x4000
134#define PLL_3_MUTE 0x0080
135
136/* Control bits for PMU/ PLL */
137#define PMU_WARMRESET 0x00010000
138#define PLL_CTRL_MASK23 0x000080ff
139
140/* LCD Controller */
141#define LCD_BASE (IO_VIRT + 0x10000)
142#define LCD_CTRL 0x00
143#define LCD_STATUS 0x04
144#define LCD_STATUS_M 0x08
145#define LCD_INTERRUPT 0x0C
146#define LCD_DBAR 0x10
147#define LCD_DCAR 0x14
148#define LCD_TIMING0 0x20
149#define LCD_TIMING1 0x24
150#define LCD_TIMING2 0x28
151#define LCD_TEST 0x40
152
153/* LCD Control Bits */
154#define LCD_CTRL_LCD_ENABLE 0x00000001
155/* Bits per pixel */
156#define LCD_CTRL_LCD_BPP_MASK 0x00000006
157#define LCD_CTRL_LCD_4BPP 0x00000000
158#define LCD_CTRL_LCD_8BPP 0x00000002
159#define LCD_CTRL_LCD_16BPP 0x00000004
160#define LCD_CTRL_LCD_BW 0x00000008
161#define LCD_CTRL_LCD_TFT 0x00000010
162#define LCD_CTRL_BGR 0x00001000
163#define LCD_CTRL_LCD_VCOMP 0x00080000
164#define LCD_CTRL_LCD_MONO8 0x00200000
165#define LCD_CTRL_LCD_PWR 0x00400000
166#define LCD_CTRL_LCD_BLE 0x00800000
167#define LCD_CTRL_LDBUSEN 0x01000000
168
169/* Palette */
170#define LCD_PALETTE_BASE (IO_VIRT + 0x10400)
171
172/* Serial ports */
173#define SERIAL0_OFS 0x20000
174#define SERIAL0_VIRT (IO_VIRT + SERIAL0_OFS)
175#define SERIAL0_BASE (IO_PHYS + SERIAL0_OFS)
176
177#define SERIAL1_OFS 0x21000
178#define SERIAL1_VIRT (IO_VIRT + SERIAL1_OFS)
179#define SERIAL1_BASE (IO_PHYS + SERIAL1_OFS)
180
181#define SERIAL_ENABLE 0x30
182#define SERIAL_ENABLE_EN (1<<0)
183
184/* General defines to pacify gcc */
185#define PCIO_BASE (0) /* for inb, outb and friends */
186#define PCIO_VIRT PCIO_BASE
187
188#define __ASM_ARCH_HARDWARE_INCMACH_H
189#include "boards.h"
190#undef __ASM_ARCH_HARDWARE_INCMACH_H
191
192#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-h720x/include/mach/io.h b/arch/arm/mach-h720x/include/mach/io.h
new file mode 100644
index 000000000000..1dab74ce88c6
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/io.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-h720x/include/mach/io.h
3 *
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 *
6 * Changelog:
7 *
8 * 09-19-2001 JJKIM
9 * Created from arch/arm/mach-l7200/include/mach/io.h
10 *
11 * 03-27-2003 Robert Schwebel <r.schwebel@pengutronix.de>:
12 * re-unified header files for h720x
13 */
14#ifndef __ASM_ARM_ARCH_IO_H
15#define __ASM_ARM_ARCH_IO_H
16
17#include <mach/hardware.h>
18
19#define IO_SPACE_LIMIT 0xffffffff
20
21#define __io(a) ((void __iomem *)(a))
22#define __mem_pci(a) (a)
23
24#endif
diff --git a/arch/arm/mach-h720x/include/mach/irqs.h b/arch/arm/mach-h720x/include/mach/irqs.h
new file mode 100644
index 000000000000..430a92b492f1
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/irqs.h
@@ -0,0 +1,116 @@
1/*
2 * arch/arm/mach-h720x/include/mach/irqs.h
3 *
4 * Copyright (C) 2000 Jungjun Kim
5 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 * (C) 2003 Thomas Gleixner <tglx@linutronix.de>
7 *
8 */
9
10#ifndef __ASM_ARCH_IRQS_H
11#define __ASM_ARCH_IRQS_H
12
13#if defined (CONFIG_CPU_H7201)
14
15#define IRQ_PMU 0 /* 0x000001 */
16#define IRQ_DMA 1 /* 0x000002 */
17#define IRQ_LCD 2 /* 0x000004 */
18#define IRQ_VGA 3 /* 0x000008 */
19#define IRQ_PCMCIA1 4 /* 0x000010 */
20#define IRQ_PCMCIA2 5 /* 0x000020 */
21#define IRQ_AFE 6 /* 0x000040 */
22#define IRQ_AIC 7 /* 0x000080 */
23#define IRQ_KEYBOARD 8 /* 0x000100 */
24#define IRQ_TIMER0 9 /* 0x000200 */
25#define IRQ_RTC 10 /* 0x000400 */
26#define IRQ_SOUND 11 /* 0x000800 */
27#define IRQ_USB 12 /* 0x001000 */
28#define IRQ_IrDA 13 /* 0x002000 */
29#define IRQ_UART0 14 /* 0x004000 */
30#define IRQ_UART1 15 /* 0x008000 */
31#define IRQ_SPI 16 /* 0x010000 */
32#define IRQ_GPIOA 17 /* 0x020000 */
33#define IRQ_GPIOB 18 /* 0x040000 */
34#define IRQ_GPIOC 19 /* 0x080000 */
35#define IRQ_GPIOD 20 /* 0x100000 */
36#define IRQ_CommRX 21 /* 0x200000 */
37#define IRQ_CommTX 22 /* 0x400000 */
38#define IRQ_Soft 23 /* 0x800000 */
39
40#define NR_GLBL_IRQS 24
41
42#define IRQ_CHAINED_GPIOA(x) (NR_GLBL_IRQS + x)
43#define IRQ_CHAINED_GPIOB(x) (IRQ_CHAINED_GPIOA(32) + x)
44#define IRQ_CHAINED_GPIOC(x) (IRQ_CHAINED_GPIOB(32) + x)
45#define IRQ_CHAINED_GPIOD(x) (IRQ_CHAINED_GPIOC(32) + x)
46#define NR_IRQS IRQ_CHAINED_GPIOD(32)
47
48/* Enable mask for multiplexed interrupts */
49#define IRQ_ENA_MUX (1<<IRQ_GPIOA) | (1<<IRQ_GPIOB) \
50 | (1<<IRQ_GPIOC) | (1<<IRQ_GPIOD)
51
52
53#elif defined (CONFIG_CPU_H7202)
54
55#define IRQ_PMU 0 /* 0x00000001 */
56#define IRQ_DMA 1 /* 0x00000002 */
57#define IRQ_LCD 2 /* 0x00000004 */
58#define IRQ_SOUND 3 /* 0x00000008 */
59#define IRQ_I2S 4 /* 0x00000010 */
60#define IRQ_USB 5 /* 0x00000020 */
61#define IRQ_MMC 6 /* 0x00000040 */
62#define IRQ_RTC 7 /* 0x00000080 */
63#define IRQ_UART0 8 /* 0x00000100 */
64#define IRQ_UART1 9 /* 0x00000200 */
65#define IRQ_UART2 10 /* 0x00000400 */
66#define IRQ_UART3 11 /* 0x00000800 */
67#define IRQ_KBD 12 /* 0x00001000 */
68#define IRQ_PS2 13 /* 0x00002000 */
69#define IRQ_AIC 14 /* 0x00004000 */
70#define IRQ_TIMER0 15 /* 0x00008000 */
71#define IRQ_TIMERX 16 /* 0x00010000 */
72#define IRQ_WDT 17 /* 0x00020000 */
73#define IRQ_CAN0 18 /* 0x00040000 */
74#define IRQ_CAN1 19 /* 0x00080000 */
75#define IRQ_EXT0 20 /* 0x00100000 */
76#define IRQ_EXT1 21 /* 0x00200000 */
77#define IRQ_GPIOA 22 /* 0x00400000 */
78#define IRQ_GPIOB 23 /* 0x00800000 */
79#define IRQ_GPIOC 24 /* 0x01000000 */
80#define IRQ_GPIOD 25 /* 0x02000000 */
81#define IRQ_GPIOE 26 /* 0x04000000 */
82#define IRQ_COMMRX 27 /* 0x08000000 */
83#define IRQ_COMMTX 28 /* 0x10000000 */
84#define IRQ_SMC 29 /* 0x20000000 */
85#define IRQ_Soft 30 /* 0x40000000 */
86#define IRQ_RESERVED1 31 /* 0x80000000 */
87#define NR_GLBL_IRQS 32
88
89#define NR_TIMERX_IRQS 3
90
91#define IRQ_CHAINED_GPIOA(x) (NR_GLBL_IRQS + x)
92#define IRQ_CHAINED_GPIOB(x) (IRQ_CHAINED_GPIOA(32) + x)
93#define IRQ_CHAINED_GPIOC(x) (IRQ_CHAINED_GPIOB(32) + x)
94#define IRQ_CHAINED_GPIOD(x) (IRQ_CHAINED_GPIOC(32) + x)
95#define IRQ_CHAINED_GPIOE(x) (IRQ_CHAINED_GPIOD(32) + x)
96#define IRQ_CHAINED_TIMERX(x) (IRQ_CHAINED_GPIOE(32) + x)
97#define IRQ_TIMER1 (IRQ_CHAINED_TIMERX(0))
98#define IRQ_TIMER2 (IRQ_CHAINED_TIMERX(1))
99#define IRQ_TIMER64B (IRQ_CHAINED_TIMERX(2))
100
101#define NR_IRQS (IRQ_CHAINED_TIMERX(NR_TIMERX_IRQS))
102
103/* Enable mask for multiplexed interrupts */
104#define IRQ_ENA_MUX (1<<IRQ_TIMERX) | (1<<IRQ_GPIOA) | (1<<IRQ_GPIOB) | \
105 (1<<IRQ_GPIOC) | (1<<IRQ_GPIOD) | (1<<IRQ_GPIOE) | \
106 (1<<IRQ_TIMERX)
107
108#else
109#error cpu definition mismatch
110#endif
111
112/* decode irq number to register number */
113#define IRQ_TO_REGNO(irq) ((irq - NR_GLBL_IRQS) >> 5)
114#define IRQ_TO_BIT(irq) (1 << ((irq - NR_GLBL_IRQS) % 32))
115
116#endif
diff --git a/arch/arm/mach-h720x/include/mach/memory.h b/arch/arm/mach-h720x/include/mach/memory.h
new file mode 100644
index 000000000000..cb26f49cc4e1
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/memory.h
@@ -0,0 +1,29 @@
1/*
2 * arch/arm/mach-h720x/include/mach/memory.h
3 *
4 * Copyright (c) 2000 Jungjun Kim
5 *
6 */
7#ifndef __ASM_ARCH_MEMORY_H
8#define __ASM_ARCH_MEMORY_H
9
10/*
11 * Page offset:
12 * ( 0xc0000000UL )
13 */
14#define PHYS_OFFSET UL(0x40000000)
15
16/*
17 * Virtual view <-> DMA view memory address translations
18 * virt_to_bus: Used to translate the virtual address to an
19 * address suitable to be passed to set_dma_addr
20 * bus_to_virt: Used to convert an address for DMA operations
21 * to an address that the kernel can use.
22 *
23 * There is something to do here later !, Mar 2000, Jungjun Kim
24 */
25
26#define __virt_to_bus(x) __virt_to_phys(x)
27#define __bus_to_virt(x) __phys_to_virt(x)
28
29#endif
diff --git a/arch/arm/mach-h720x/include/mach/system.h b/arch/arm/mach-h720x/include/mach/system.h
new file mode 100644
index 000000000000..e4a7c760d52a
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/system.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/mach-h720x/include/mach/system.h
3 *
4 * Copyright (C) 2001-2002 Jungjun Kim, Hynix Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 * arch/arm/mach-h720x/include/mach/system.h
10 *
11 */
12
13#ifndef __ASM_ARCH_SYSTEM_H
14#define __ASM_ARCH_SYSTEM_H
15#include <mach/hardware.h>
16
17static void arch_idle(void)
18{
19 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_IDLE;
20 nop();
21 nop();
22 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_RUN;
23 nop();
24 nop();
25}
26
27
28static __inline__ void arch_reset(char mode)
29{
30 CPU_REG (PMU_BASE, PMU_STAT) |= PMU_WARMRESET;
31}
32
33#endif
diff --git a/arch/arm/mach-h720x/include/mach/timex.h b/arch/arm/mach-h720x/include/mach/timex.h
new file mode 100644
index 000000000000..3f2f447ff36b
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/timex.h
@@ -0,0 +1,15 @@
1/*
2 * arch/arm/mach-h720x/include/mach/timex.h
3 * Copyright (C) 2000 Jungjun Kim, Hynix Semiconductor Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __ASM_ARCH_TIMEX
11#define __ASM_ARCH_TIMEX
12
13#define CLOCK_TICK_RATE 3686400
14
15#endif
diff --git a/arch/arm/mach-h720x/include/mach/uncompress.h b/arch/arm/mach-h720x/include/mach/uncompress.h
new file mode 100644
index 000000000000..d6623234f61e
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/uncompress.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-h720x/include/mach/uncompress.h
3 *
4 * Copyright (C) 2001-2002 Jungjun Kim
5 */
6
7#ifndef __ASM_ARCH_UNCOMPRESS_H
8#define __ASM_ARCH_UNCOMPRESS_H
9
10#include <mach/hardware.h>
11
12#define LSR 0x14
13#define TEMPTY 0x40
14
15static inline void putc(int c)
16{
17 volatile unsigned char *p = (volatile unsigned char *)(IO_PHYS+0x20000);
18
19 /* wait until transmit buffer is empty */
20 while((p[LSR] & TEMPTY) == 0x0)
21 barrier();
22
23 /* write next character */
24 *p = c;
25}
26
27static inline void flush(void)
28{
29}
30
31/*
32 * nothing to do
33 */
34#define arch_decomp_setup()
35#define arch_decomp_wdog()
36
37#endif
diff --git a/arch/arm/mach-h720x/include/mach/vmalloc.h b/arch/arm/mach-h720x/include/mach/vmalloc.h
new file mode 100644
index 000000000000..ff1460d6841b
--- /dev/null
+++ b/arch/arm/mach-h720x/include/mach/vmalloc.h
@@ -0,0 +1,10 @@
1/*
2 * arch/arm/mach-h720x/include/mach/vmalloc.h
3 */
4
5#ifndef __ARCH_ARM_VMALLOC_H
6#define __ARCH_ARM_VMALLOC_H
7
8#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
9
10#endif
diff --git a/arch/arm/mach-imx/clock.c b/arch/arm/mach-imx/clock.c
index 6a90fe5578df..4b4230db3765 100644
--- a/arch/arm/mach-imx/clock.c
+++ b/arch/arm/mach-imx/clock.c
@@ -23,7 +23,7 @@
23#include <linux/err.h> 23#include <linux/err.h>
24 24
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/arch/imx-regs.h> 26#include <mach/imx-regs.h>
27 27
28/* 28/*
29 * Very simple approach: We can't disable clocks, so we do 29 * Very simple approach: We can't disable clocks, so we do
@@ -172,24 +172,29 @@ found:
172 172
173 return clk; 173 return clk;
174} 174}
175EXPORT_SYMBOL(clk_get);
175 176
176void clk_put(struct clk *clk) 177void clk_put(struct clk *clk)
177{ 178{
178} 179}
180EXPORT_SYMBOL(clk_put);
179 181
180int clk_enable(struct clk *clk) 182int clk_enable(struct clk *clk)
181{ 183{
182 return 0; 184 return 0;
183} 185}
186EXPORT_SYMBOL(clk_enable);
184 187
185void clk_disable(struct clk *clk) 188void clk_disable(struct clk *clk)
186{ 189{
187} 190}
191EXPORT_SYMBOL(clk_disable);
188 192
189unsigned long clk_get_rate(struct clk *clk) 193unsigned long clk_get_rate(struct clk *clk)
190{ 194{
191 return clk->get_rate(); 195 return clk->get_rate();
192} 196}
197EXPORT_SYMBOL(clk_get_rate);
193 198
194int imx_clocks_init(void) 199int imx_clocks_init(void)
195{ 200{
diff --git a/arch/arm/mach-imx/cpufreq.c b/arch/arm/mach-imx/cpufreq.c
index be0809b33e08..434b4ca0af67 100644
--- a/arch/arm/mach-imx/cpufreq.c
+++ b/arch/arm/mach-imx/cpufreq.c
@@ -36,7 +36,7 @@
36#include <linux/err.h> 36#include <linux/err.h>
37#include <asm/system.h> 37#include <asm/system.h>
38 38
39#include <asm/hardware.h> 39#include <mach/hardware.h>
40 40
41#include "generic.h" 41#include "generic.h"
42 42
diff --git a/arch/arm/mach-imx/dma.c b/arch/arm/mach-imx/dma.c
index ee1c6f06ff64..c10810c936b3 100644
--- a/arch/arm/mach-imx/dma.c
+++ b/arch/arm/mach-imx/dma.c
@@ -30,9 +30,9 @@
30 30
31#include <asm/system.h> 31#include <asm/system.h>
32#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/hardware.h> 33#include <mach/hardware.h>
34#include <asm/dma.h> 34#include <asm/dma.h>
35#include <asm/arch/imx-dma.h> 35#include <mach/imx-dma.h>
36 36
37struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS]; 37struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS];
38 38
diff --git a/arch/arm/mach-imx/generic.c b/arch/arm/mach-imx/generic.c
index 98ddd8a6d05f..fa72174dd95c 100644
--- a/arch/arm/mach-imx/generic.c
+++ b/arch/arm/mach-imx/generic.c
@@ -29,13 +29,13 @@
29#include <linux/string.h> 29#include <linux/string.h>
30 30
31#include <asm/errno.h> 31#include <asm/errno.h>
32#include <asm/arch/imxfb.h> 32#include <mach/imxfb.h>
33#include <asm/hardware.h> 33#include <mach/hardware.h>
34#include <asm/arch/imx-regs.h> 34#include <mach/imx-regs.h>
35 35
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37#include <asm/arch/mmc.h> 37#include <mach/mmc.h>
38#include <asm/arch/gpio.h> 38#include <mach/gpio.h>
39 39
40unsigned long imx_gpio_alloc_map[(GPIO_PORT_MAX + 1) * 32 / BITS_PER_LONG]; 40unsigned long imx_gpio_alloc_map[(GPIO_PORT_MAX + 1) * 32 / BITS_PER_LONG];
41 41
@@ -251,7 +251,6 @@ void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info)
251{ 251{
252 memcpy(&imx_fb_info,hard_imx_fb_info,sizeof(struct imxfb_mach_info)); 252 memcpy(&imx_fb_info,hard_imx_fb_info,sizeof(struct imxfb_mach_info));
253} 253}
254EXPORT_SYMBOL(set_imx_fb_info);
255 254
256static struct resource imxfb_resources[] = { 255static struct resource imxfb_resources[] = {
257 [0] = { 256 [0] = {
diff --git a/arch/arm/mach-imx/include/mach/debug-macro.S b/arch/arm/mach-imx/include/mach/debug-macro.S
new file mode 100644
index 000000000000..87802bbfe633
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/debug-macro.S
@@ -0,0 +1,34 @@
1/* arch/arm/mach-imx/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 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17 moveq \rx, #0x00000000 @ physical
18 movne \rx, #0xe0000000 @ virtual
19 orreq \rx, \rx, #0x00200000 @ physical
20 orr \rx, \rx, #0x00006000 @ UART1 offset
21 .endm
22
23 .macro senduart,rd,rx
24 str \rd, [\rx, #0x40] @ TXDATA
25 .endm
26
27 .macro waituart,rd,rx
28 .endm
29
30 .macro busyuart,rd,rx
311002: ldr \rd, [\rx, #0x98] @ SR2
32 tst \rd, #1 << 3 @ TXDC
33 beq 1002b @ wait until transmit done
34 .endm
diff --git a/arch/arm/mach-imx/include/mach/dma.h b/arch/arm/mach-imx/include/mach/dma.h
new file mode 100644
index 000000000000..621ff2c730f2
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/dma.h
@@ -0,0 +1,56 @@
1/*
2 * linux/include/asm-arm/imxads/dma.h
3 *
4 * Copyright (C) 1997,1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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
21#ifndef __ASM_ARCH_DMA_H
22#define __ASM_ARCH_DMA_H
23
24typedef enum {
25 DMA_PRIO_HIGH = 0,
26 DMA_PRIO_MEDIUM = 1,
27 DMA_PRIO_LOW = 2
28} imx_dma_prio;
29
30#define DMA_REQ_UART3_T 2
31#define DMA_REQ_UART3_R 3
32#define DMA_REQ_SSI2_T 4
33#define DMA_REQ_SSI2_R 5
34#define DMA_REQ_CSI_STAT 6
35#define DMA_REQ_CSI_R 7
36#define DMA_REQ_MSHC 8
37#define DMA_REQ_DSPA_DCT_DOUT 9
38#define DMA_REQ_DSPA_DCT_DIN 10
39#define DMA_REQ_DSPA_MAC 11
40#define DMA_REQ_EXT 12
41#define DMA_REQ_SDHC 13
42#define DMA_REQ_SPI1_R 14
43#define DMA_REQ_SPI1_T 15
44#define DMA_REQ_SSI_T 16
45#define DMA_REQ_SSI_R 17
46#define DMA_REQ_ASP_DAC 18
47#define DMA_REQ_ASP_ADC 19
48#define DMA_REQ_USP_EP(x) (20+(x))
49#define DMA_REQ_SPI2_R 26
50#define DMA_REQ_SPI2_T 27
51#define DMA_REQ_UART2_T 28
52#define DMA_REQ_UART2_R 29
53#define DMA_REQ_UART1_T 30
54#define DMA_REQ_UART1_R 31
55
56#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-imx/include/mach/entry-macro.S b/arch/arm/mach-imx/include/mach/entry-macro.S
new file mode 100644
index 000000000000..e4db679f7766
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/entry-macro.S
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-imx/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for iMX-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 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_preamble, base, tmp
16 .endm
17
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
21#define AITC_NIVECSR 0x40
22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
23 ldr \base, =IO_ADDRESS(IMX_AITC_BASE)
24 @ Load offset & priority of the highest priority
25 @ interrupt pending.
26 ldr \irqstat, [\base, #AITC_NIVECSR]
27 @ Shift off the priority leaving the offset or
28 @ "interrupt number", use arithmetic shift to
29 @ transform illegal source (0xffff) as -1
30 mov \irqnr, \irqstat, asr #16
31 adds \tmp, \irqnr, #1
32 .endm
diff --git a/arch/arm/mach-imx/include/mach/gpio.h b/arch/arm/mach-imx/include/mach/gpio.h
new file mode 100644
index 000000000000..6e3d795f2264
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/gpio.h
@@ -0,0 +1,102 @@
1#ifndef _IMX_GPIO_H
2
3#include <mach/imx-regs.h>
4
5#define IMX_GPIO_ALLOC_MODE_NORMAL 0
6#define IMX_GPIO_ALLOC_MODE_NO_ALLOC 1
7#define IMX_GPIO_ALLOC_MODE_TRY_ALLOC 2
8#define IMX_GPIO_ALLOC_MODE_ALLOC_ONLY 4
9#define IMX_GPIO_ALLOC_MODE_RELEASE 8
10
11extern int imx_gpio_request(unsigned gpio, const char *label);
12
13extern void imx_gpio_free(unsigned gpio);
14
15extern int imx_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
16 int alloc_mode, const char *label);
17
18extern int imx_gpio_direction_input(unsigned gpio);
19
20extern int imx_gpio_direction_output(unsigned gpio, int value);
21
22extern void __imx_gpio_set_value(unsigned gpio, int value);
23
24static inline int imx_gpio_get_value(unsigned gpio)
25{
26 return SSR(gpio >> GPIO_PORT_SHIFT) & (1 << (gpio & GPIO_PIN_MASK));
27}
28
29static inline void imx_gpio_set_value_inline(unsigned gpio, int value)
30{
31 unsigned long flags;
32
33 raw_local_irq_save(flags);
34 if(value)
35 DR(gpio >> GPIO_PORT_SHIFT) |= (1 << (gpio & GPIO_PIN_MASK));
36 else
37 DR(gpio >> GPIO_PORT_SHIFT) &= ~(1 << (gpio & GPIO_PIN_MASK));
38 raw_local_irq_restore(flags);
39}
40
41static inline void imx_gpio_set_value(unsigned gpio, int value)
42{
43 if(__builtin_constant_p(gpio))
44 imx_gpio_set_value_inline(gpio, value);
45 else
46 __imx_gpio_set_value(gpio, value);
47}
48
49extern int imx_gpio_to_irq(unsigned gpio);
50
51extern int imx_irq_to_gpio(unsigned irq);
52
53/*-------------------------------------------------------------------------*/
54
55/* Wrappers for "new style" GPIO calls. These calls i.MX specific versions
56 * to allow future extension of GPIO logic.
57 */
58
59static inline int gpio_request(unsigned gpio, const char *label)
60{
61 return imx_gpio_request(gpio, label);
62}
63
64static inline void gpio_free(unsigned gpio)
65{
66 imx_gpio_free(gpio);
67}
68
69static inline int gpio_direction_input(unsigned gpio)
70{
71 return imx_gpio_direction_input(gpio);
72}
73
74static inline int gpio_direction_output(unsigned gpio, int value)
75{
76 return imx_gpio_direction_output(gpio, value);
77}
78
79static inline int gpio_get_value(unsigned gpio)
80{
81 return imx_gpio_get_value(gpio);
82}
83
84static inline void gpio_set_value(unsigned gpio, int value)
85{
86 imx_gpio_set_value(gpio, value);
87}
88
89#include <asm-generic/gpio.h> /* cansleep wrappers */
90
91static inline int gpio_to_irq(unsigned gpio)
92{
93 return imx_gpio_to_irq(gpio);
94}
95
96static inline int irq_to_gpio(unsigned irq)
97{
98 return imx_irq_to_gpio(irq);
99}
100
101
102#endif
diff --git a/arch/arm/mach-imx/include/mach/hardware.h b/arch/arm/mach-imx/include/mach/hardware.h
new file mode 100644
index 000000000000..c73e9e724c75
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/hardware.h
@@ -0,0 +1,91 @@
1/*
2 * arch/arm/mach-imx/include/mach/hardware.h
3 *
4 * Copyright (C) 1999 ARM Limited.
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#ifndef __ASM_ARCH_HARDWARE_H
21#define __ASM_ARCH_HARDWARE_H
22
23#include <asm/sizes.h>
24#include "imx-regs.h"
25
26#ifndef __ASSEMBLY__
27# define __REG(x) (*((volatile u32 *)IO_ADDRESS(x)))
28
29# define __REG2(x,y) (*(volatile u32 *)((u32)&__REG(x) + (y)))
30#endif
31
32/*
33 * Memory map
34 */
35
36#define IMX_IO_PHYS 0x00200000
37#define IMX_IO_SIZE 0x00100000
38#define IMX_IO_BASE 0xe0000000
39
40#define IMX_CS0_PHYS 0x10000000
41#define IMX_CS0_SIZE 0x02000000
42#define IMX_CS0_VIRT 0xe8000000
43
44#define IMX_CS1_PHYS 0x12000000
45#define IMX_CS1_SIZE 0x01000000
46#define IMX_CS1_VIRT 0xea000000
47
48#define IMX_CS2_PHYS 0x13000000
49#define IMX_CS2_SIZE 0x01000000
50#define IMX_CS2_VIRT 0xeb000000
51
52#define IMX_CS3_PHYS 0x14000000
53#define IMX_CS3_SIZE 0x01000000
54#define IMX_CS3_VIRT 0xec000000
55
56#define IMX_CS4_PHYS 0x15000000
57#define IMX_CS4_SIZE 0x01000000
58#define IMX_CS4_VIRT 0xed000000
59
60#define IMX_CS5_PHYS 0x16000000
61#define IMX_CS5_SIZE 0x01000000
62#define IMX_CS5_VIRT 0xee000000
63
64#define IMX_FB_VIRT 0xF1000000
65#define IMX_FB_SIZE (256*1024)
66
67/* macro to get at IO space when running virtually */
68#define IO_ADDRESS(x) ((x) | IMX_IO_BASE)
69
70#ifndef __ASSEMBLY__
71/*
72 * Handy routine to set GPIO functions
73 */
74extern void imx_gpio_mode( int gpio_mode );
75
76#endif
77
78#define MAXIRQNUM 62
79#define MAXFIQNUM 62
80#define MAXSWINUM 62
81
82/*
83 * Use SDRAM for memory
84 */
85#define MEM_SIZE 0x01000000
86
87#ifdef CONFIG_ARCH_MX1ADS
88#include "mx1ads.h"
89#endif
90
91#endif
diff --git a/arch/arm/mach-imx/include/mach/imx-dma.h b/arch/arm/mach-imx/include/mach/imx-dma.h
new file mode 100644
index 000000000000..44d89c35539a
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/imx-dma.h
@@ -0,0 +1,94 @@
1/*
2 * linux/include/asm-arm/imxads/dma.h
3 *
4 * Copyright (C) 1997,1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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
21#include <asm/dma.h>
22
23#ifndef __ASM_ARCH_IMX_DMA_H
24#define __ASM_ARCH_IMX_DMA_H
25
26#define IMX_DMA_CHANNELS 11
27
28/*
29 * struct imx_dma_channel - i.MX specific DMA extension
30 * @name: name specified by DMA client
31 * @irq_handler: client callback for end of transfer
32 * @err_handler: client callback for error condition
33 * @data: clients context data for callbacks
34 * @dma_mode: direction of the transfer %DMA_MODE_READ or %DMA_MODE_WRITE
35 * @sg: pointer to the actual read/written chunk for scatter-gather emulation
36 * @sgbc: counter of processed bytes in the actual read/written chunk
37 * @resbytes: total residual number of bytes to transfer
38 * (it can be lower or same as sum of SG mapped chunk sizes)
39 * @sgcount: number of chunks to be read/written
40 *
41 * Structure is used for IMX DMA processing. It would be probably good
42 * @struct dma_struct in the future for external interfacing and use
43 * @struct imx_dma_channel only as extension to it.
44 */
45
46struct imx_dma_channel {
47 const char *name;
48 void (*irq_handler) (int, void *);
49 void (*err_handler) (int, void *, int errcode);
50 void *data;
51 dmamode_t dma_mode;
52 struct scatterlist *sg;
53 unsigned int sgbc;
54 unsigned int sgcount;
55 unsigned int resbytes;
56 int dma_num;
57};
58
59extern struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS];
60
61#define IMX_DMA_ERR_BURST 1
62#define IMX_DMA_ERR_REQUEST 2
63#define IMX_DMA_ERR_TRANSFER 4
64#define IMX_DMA_ERR_BUFFER 8
65
66/* The type to distinguish channel numbers parameter from ordinal int type */
67typedef int imx_dmach_t;
68
69int
70imx_dma_setup_single(imx_dmach_t dma_ch, dma_addr_t dma_address,
71 unsigned int dma_length, unsigned int dev_addr, dmamode_t dmamode);
72
73int
74imx_dma_setup_sg(imx_dmach_t dma_ch,
75 struct scatterlist *sg, unsigned int sgcount, unsigned int dma_length,
76 unsigned int dev_addr, dmamode_t dmamode);
77
78int
79imx_dma_setup_handlers(imx_dmach_t dma_ch,
80 void (*irq_handler) (int, void *),
81 void (*err_handler) (int, void *, int), void *data);
82
83void imx_dma_enable(imx_dmach_t dma_ch);
84
85void imx_dma_disable(imx_dmach_t dma_ch);
86
87int imx_dma_request(imx_dmach_t dma_ch, const char *name);
88
89void imx_dma_free(imx_dmach_t dma_ch);
90
91imx_dmach_t imx_dma_request_by_prio(const char *name, imx_dma_prio prio);
92
93
94#endif /* _ASM_ARCH_IMX_DMA_H */
diff --git a/arch/arm/mach-imx/include/mach/imx-regs.h b/arch/arm/mach-imx/include/mach/imx-regs.h
new file mode 100644
index 000000000000..fb9de2733879
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/imx-regs.h
@@ -0,0 +1,482 @@
1#ifndef _IMX_REGS_H
2#define _IMX_REGS_H
3/* ------------------------------------------------------------------------
4 * Motorola IMX system registers
5 * ------------------------------------------------------------------------
6 *
7 */
8
9/*
10 * Register BASEs, based on OFFSETs
11 *
12 */
13#define IMX_AIPI1_BASE (0x00000 + IMX_IO_BASE)
14#define IMX_WDT_BASE (0x01000 + IMX_IO_BASE)
15#define IMX_TIM1_BASE (0x02000 + IMX_IO_BASE)
16#define IMX_TIM2_BASE (0x03000 + IMX_IO_BASE)
17#define IMX_RTC_BASE (0x04000 + IMX_IO_BASE)
18#define IMX_LCDC_BASE (0x05000 + IMX_IO_BASE)
19#define IMX_UART1_BASE (0x06000 + IMX_IO_BASE)
20#define IMX_UART2_BASE (0x07000 + IMX_IO_BASE)
21#define IMX_PWM_BASE (0x08000 + IMX_IO_BASE)
22#define IMX_DMAC_BASE (0x09000 + IMX_IO_BASE)
23#define IMX_AIPI2_BASE (0x10000 + IMX_IO_BASE)
24#define IMX_SIM_BASE (0x11000 + IMX_IO_BASE)
25#define IMX_USBD_BASE (0x12000 + IMX_IO_BASE)
26#define IMX_SPI1_BASE (0x13000 + IMX_IO_BASE)
27#define IMX_MMC_BASE (0x14000 + IMX_IO_BASE)
28#define IMX_ASP_BASE (0x15000 + IMX_IO_BASE)
29#define IMX_BTA_BASE (0x16000 + IMX_IO_BASE)
30#define IMX_I2C_BASE (0x17000 + IMX_IO_BASE)
31#define IMX_SSI_BASE (0x18000 + IMX_IO_BASE)
32#define IMX_SPI2_BASE (0x19000 + IMX_IO_BASE)
33#define IMX_MSHC_BASE (0x1A000 + IMX_IO_BASE)
34#define IMX_PLL_BASE (0x1B000 + IMX_IO_BASE)
35#define IMX_GPIO_BASE (0x1C000 + IMX_IO_BASE)
36#define IMX_EIM_BASE (0x20000 + IMX_IO_BASE)
37#define IMX_SDRAMC_BASE (0x21000 + IMX_IO_BASE)
38#define IMX_MMA_BASE (0x22000 + IMX_IO_BASE)
39#define IMX_AITC_BASE (0x23000 + IMX_IO_BASE)
40#define IMX_CSI_BASE (0x24000 + IMX_IO_BASE)
41
42/* PLL registers */
43#define CSCR __REG(IMX_PLL_BASE) /* Clock Source Control Register */
44#define CSCR_SPLL_RESTART (1<<22)
45#define CSCR_MPLL_RESTART (1<<21)
46#define CSCR_SYSTEM_SEL (1<<16)
47#define CSCR_BCLK_DIV (0xf<<10)
48#define CSCR_MPU_PRESC (1<<15)
49#define CSCR_SPEN (1<<1)
50#define CSCR_MPEN (1<<0)
51
52#define MPCTL0 __REG(IMX_PLL_BASE + 0x4) /* MCU PLL Control Register 0 */
53#define MPCTL1 __REG(IMX_PLL_BASE + 0x8) /* MCU PLL and System Clock Register 1 */
54#define SPCTL0 __REG(IMX_PLL_BASE + 0xc) /* System PLL Control Register 0 */
55#define SPCTL1 __REG(IMX_PLL_BASE + 0x10) /* System PLL Control Register 1 */
56#define PCDR __REG(IMX_PLL_BASE + 0x20) /* Peripheral Clock Divider Register */
57
58/*
59 * GPIO Module and I/O Multiplexer
60 * x = 0..3 for reg_A, reg_B, reg_C, reg_D
61 */
62#define DDIR(x) __REG2(IMX_GPIO_BASE + 0x00, ((x) & 3) << 8)
63#define OCR1(x) __REG2(IMX_GPIO_BASE + 0x04, ((x) & 3) << 8)
64#define OCR2(x) __REG2(IMX_GPIO_BASE + 0x08, ((x) & 3) << 8)
65#define ICONFA1(x) __REG2(IMX_GPIO_BASE + 0x0c, ((x) & 3) << 8)
66#define ICONFA2(x) __REG2(IMX_GPIO_BASE + 0x10, ((x) & 3) << 8)
67#define ICONFB1(x) __REG2(IMX_GPIO_BASE + 0x14, ((x) & 3) << 8)
68#define ICONFB2(x) __REG2(IMX_GPIO_BASE + 0x18, ((x) & 3) << 8)
69#define DR(x) __REG2(IMX_GPIO_BASE + 0x1c, ((x) & 3) << 8)
70#define GIUS(x) __REG2(IMX_GPIO_BASE + 0x20, ((x) & 3) << 8)
71#define SSR(x) __REG2(IMX_GPIO_BASE + 0x24, ((x) & 3) << 8)
72#define ICR1(x) __REG2(IMX_GPIO_BASE + 0x28, ((x) & 3) << 8)
73#define ICR2(x) __REG2(IMX_GPIO_BASE + 0x2c, ((x) & 3) << 8)
74#define IMR(x) __REG2(IMX_GPIO_BASE + 0x30, ((x) & 3) << 8)
75#define ISR(x) __REG2(IMX_GPIO_BASE + 0x34, ((x) & 3) << 8)
76#define GPR(x) __REG2(IMX_GPIO_BASE + 0x38, ((x) & 3) << 8)
77#define SWR(x) __REG2(IMX_GPIO_BASE + 0x3c, ((x) & 3) << 8)
78#define PUEN(x) __REG2(IMX_GPIO_BASE + 0x40, ((x) & 3) << 8)
79
80#define GPIO_PORT_MAX 3
81
82#define GPIO_PIN_MASK 0x1f
83#define GPIO_PORT_MASK (0x3 << 5)
84
85#define GPIO_PORT_SHIFT 5
86#define GPIO_PORTA (0<<5)
87#define GPIO_PORTB (1<<5)
88#define GPIO_PORTC (2<<5)
89#define GPIO_PORTD (3<<5)
90
91#define GPIO_OUT (1<<7)
92#define GPIO_IN (0<<7)
93#define GPIO_PUEN (1<<8)
94
95#define GPIO_PF (0<<9)
96#define GPIO_AF (1<<9)
97
98#define GPIO_OCR_SHIFT 10
99#define GPIO_OCR_MASK (3<<10)
100#define GPIO_AIN (0<<10)
101#define GPIO_BIN (1<<10)
102#define GPIO_CIN (2<<10)
103#define GPIO_DR (3<<10)
104
105#define GPIO_AOUT_SHIFT 12
106#define GPIO_AOUT_MASK (3<<12)
107#define GPIO_AOUT (0<<12)
108#define GPIO_AOUT_ISR (1<<12)
109#define GPIO_AOUT_0 (2<<12)
110#define GPIO_AOUT_1 (3<<12)
111
112#define GPIO_BOUT_SHIFT 14
113#define GPIO_BOUT_MASK (3<<14)
114#define GPIO_BOUT (0<<14)
115#define GPIO_BOUT_ISR (1<<14)
116#define GPIO_BOUT_0 (2<<14)
117#define GPIO_BOUT_1 (3<<14)
118
119#define GPIO_GIUS (1<<16)
120
121/* assignements for GPIO alternate/primary functions */
122
123/* FIXME: This list is not completed. The correct directions are
124 * missing on some (many) pins
125 */
126#define PA0_AIN_SPI2_CLK ( GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 0 )
127#define PA0_AF_ETMTRACESYNC ( GPIO_PORTA | GPIO_AF | 0 )
128#define PA1_AOUT_SPI2_RXD ( GPIO_GIUS | GPIO_PORTA | GPIO_IN | 1 )
129#define PA1_PF_TIN ( GPIO_PORTA | GPIO_PF | 1 )
130#define PA2_PF_PWM0 ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 2 )
131#define PA3_PF_CSI_MCLK ( GPIO_PORTA | GPIO_PF | 3 )
132#define PA4_PF_CSI_D0 ( GPIO_PORTA | GPIO_PF | 4 )
133#define PA5_PF_CSI_D1 ( GPIO_PORTA | GPIO_PF | 5 )
134#define PA6_PF_CSI_D2 ( GPIO_PORTA | GPIO_PF | 6 )
135#define PA7_PF_CSI_D3 ( GPIO_PORTA | GPIO_PF | 7 )
136#define PA8_PF_CSI_D4 ( GPIO_PORTA | GPIO_PF | 8 )
137#define PA9_PF_CSI_D5 ( GPIO_PORTA | GPIO_PF | 9 )
138#define PA10_PF_CSI_D6 ( GPIO_PORTA | GPIO_PF | 10 )
139#define PA11_PF_CSI_D7 ( GPIO_PORTA | GPIO_PF | 11 )
140#define PA12_PF_CSI_VSYNC ( GPIO_PORTA | GPIO_PF | 12 )
141#define PA13_PF_CSI_HSYNC ( GPIO_PORTA | GPIO_PF | 13 )
142#define PA14_PF_CSI_PIXCLK ( GPIO_PORTA | GPIO_PF | 14 )
143#define PA15_PF_I2C_SDA ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 15 )
144#define PA16_PF_I2C_SCL ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 16 )
145#define PA17_AF_ETMTRACEPKT4 ( GPIO_PORTA | GPIO_AF | 17 )
146#define PA17_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 17 )
147#define PA18_AF_ETMTRACEPKT5 ( GPIO_PORTA | GPIO_AF | 18 )
148#define PA19_AF_ETMTRACEPKT6 ( GPIO_PORTA | GPIO_AF | 19 )
149#define PA20_AF_ETMTRACEPKT7 ( GPIO_PORTA | GPIO_AF | 20 )
150#define PA21_PF_A0 ( GPIO_PORTA | GPIO_PF | 21 )
151#define PA22_PF_CS4 ( GPIO_PORTA | GPIO_PF | 22 )
152#define PA23_PF_CS5 ( GPIO_PORTA | GPIO_PF | 23 )
153#define PA24_PF_A16 ( GPIO_PORTA | GPIO_PF | 24 )
154#define PA24_AF_ETMTRACEPKT0 ( GPIO_PORTA | GPIO_AF | 24 )
155#define PA25_PF_A17 ( GPIO_PORTA | GPIO_PF | 25 )
156#define PA25_AF_ETMTRACEPKT1 ( GPIO_PORTA | GPIO_AF | 25 )
157#define PA26_PF_A18 ( GPIO_PORTA | GPIO_PF | 26 )
158#define PA26_AF_ETMTRACEPKT2 ( GPIO_PORTA | GPIO_AF | 26 )
159#define PA27_PF_A19 ( GPIO_PORTA | GPIO_PF | 27 )
160#define PA27_AF_ETMTRACEPKT3 ( GPIO_PORTA | GPIO_AF | 27 )
161#define PA28_PF_A20 ( GPIO_PORTA | GPIO_PF | 28 )
162#define PA28_AF_ETMPIPESTAT0 ( GPIO_PORTA | GPIO_AF | 28 )
163#define PA29_PF_A21 ( GPIO_PORTA | GPIO_PF | 29 )
164#define PA29_AF_ETMPIPESTAT1 ( GPIO_PORTA | GPIO_AF | 29 )
165#define PA30_PF_A22 ( GPIO_PORTA | GPIO_PF | 30 )
166#define PA30_AF_ETMPIPESTAT2 ( GPIO_PORTA | GPIO_AF | 30 )
167#define PA31_PF_A23 ( GPIO_PORTA | GPIO_PF | 31 )
168#define PA31_AF_ETMTRACECLK ( GPIO_PORTA | GPIO_AF | 31 )
169#define PB8_PF_SD_DAT0 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 8 )
170#define PB8_AF_MS_PIO ( GPIO_PORTB | GPIO_AF | 8 )
171#define PB9_PF_SD_DAT1 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 9 )
172#define PB9_AF_MS_PI1 ( GPIO_PORTB | GPIO_AF | 9 )
173#define PB10_PF_SD_DAT2 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 10 )
174#define PB10_AF_MS_SCLKI ( GPIO_PORTB | GPIO_AF | 10 )
175#define PB11_PF_SD_DAT3 ( GPIO_PORTB | GPIO_PF | 11 )
176#define PB11_AF_MS_SDIO ( GPIO_PORTB | GPIO_AF | 11 )
177#define PB12_PF_SD_CLK ( GPIO_PORTB | GPIO_PF | 12 )
178#define PB12_AF_MS_SCLK0 ( GPIO_PORTB | GPIO_AF | 12 )
179#define PB13_PF_SD_CMD ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 13 )
180#define PB13_AF_MS_BS ( GPIO_PORTB | GPIO_AF | 13 )
181#define PB14_AF_SSI_RXFS ( GPIO_PORTB | GPIO_AF | 14 )
182#define PB15_AF_SSI_RXCLK ( GPIO_PORTB | GPIO_AF | 15 )
183#define PB16_AF_SSI_RXDAT ( GPIO_PORTB | GPIO_IN | GPIO_AF | 16 )
184#define PB17_AF_SSI_TXDAT ( GPIO_PORTB | GPIO_OUT | GPIO_AF | 17 )
185#define PB18_AF_SSI_TXFS ( GPIO_PORTB | GPIO_AF | 18 )
186#define PB19_AF_SSI_TXCLK ( GPIO_PORTB | GPIO_AF | 19 )
187#define PB20_PF_USBD_AFE ( GPIO_PORTB | GPIO_PF | 20 )
188#define PB21_PF_USBD_OE ( GPIO_PORTB | GPIO_PF | 21 )
189#define PB22_PFUSBD_RCV ( GPIO_PORTB | GPIO_PF | 22 )
190#define PB23_PF_USBD_SUSPND ( GPIO_PORTB | GPIO_PF | 23 )
191#define PB24_PF_USBD_VP ( GPIO_PORTB | GPIO_PF | 24 )
192#define PB25_PF_USBD_VM ( GPIO_PORTB | GPIO_PF | 25 )
193#define PB26_PF_USBD_VPO ( GPIO_PORTB | GPIO_PF | 26 )
194#define PB27_PF_USBD_VMO ( GPIO_PORTB | GPIO_PF | 27 )
195#define PB28_PF_UART2_CTS ( GPIO_PORTB | GPIO_OUT | GPIO_PF | 28 )
196#define PB29_PF_UART2_RTS ( GPIO_PORTB | GPIO_IN | GPIO_PF | 29 )
197#define PB30_PF_UART2_TXD ( GPIO_PORTB | GPIO_OUT | GPIO_PF | 30 )
198#define PB31_PF_UART2_RXD ( GPIO_PORTB | GPIO_IN | GPIO_PF | 31 )
199#define PC3_PF_SSI_RXFS ( GPIO_PORTC | GPIO_PF | 3 )
200#define PC4_PF_SSI_RXCLK ( GPIO_PORTC | GPIO_PF | 4 )
201#define PC5_PF_SSI_RXDAT ( GPIO_PORTC | GPIO_IN | GPIO_PF | 5 )
202#define PC6_PF_SSI_TXDAT ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 6 )
203#define PC7_PF_SSI_TXFS ( GPIO_PORTC | GPIO_PF | 7 )
204#define PC8_PF_SSI_TXCLK ( GPIO_PORTC | GPIO_PF | 8 )
205#define PC9_PF_UART1_CTS ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 9 )
206#define PC10_PF_UART1_RTS ( GPIO_PORTC | GPIO_IN | GPIO_PF | 10 )
207#define PC11_PF_UART1_TXD ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 11 )
208#define PC12_PF_UART1_RXD ( GPIO_PORTC | GPIO_IN | GPIO_PF | 12 )
209#define PC13_PF_SPI1_SPI_RDY ( GPIO_PORTC | GPIO_PF | 13 )
210#define PC14_PF_SPI1_SCLK ( GPIO_PORTC | GPIO_PF | 14 )
211#define PC15_PF_SPI1_SS ( GPIO_PORTC | GPIO_PF | 15 )
212#define PC16_PF_SPI1_MISO ( GPIO_PORTC | GPIO_PF | 16 )
213#define PC17_PF_SPI1_MOSI ( GPIO_PORTC | GPIO_PF | 17 )
214#define PC24_BIN_UART3_RI ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 24 )
215#define PC25_BIN_UART3_DSR ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 25 )
216#define PC26_AOUT_UART3_DTR ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 26 )
217#define PC27_BIN_UART3_DCD ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 27 )
218#define PC28_BIN_UART3_CTS ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 28 )
219#define PC29_AOUT_UART3_RTS ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 29 )
220#define PC30_BIN_UART3_TX ( GPIO_GIUS | GPIO_PORTC | GPIO_BIN | 30 )
221#define PC31_AOUT_UART3_RX ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 31)
222#define PD6_PF_LSCLK ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 6 )
223#define PD7_PF_REV ( GPIO_PORTD | GPIO_PF | 7 )
224#define PD7_AF_UART2_DTR ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | GPIO_AF | 7 )
225#define PD7_AIN_SPI2_SCLK ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 7 )
226#define PD8_PF_CLS ( GPIO_PORTD | GPIO_PF | 8 )
227#define PD8_AF_UART2_DCD ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 8 )
228#define PD8_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 8 )
229#define PD9_PF_PS ( GPIO_PORTD | GPIO_PF | 9 )
230#define PD9_AF_UART2_RI ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 9 )
231#define PD9_AOUT_SPI2_RXD ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | 9 )
232#define PD10_PF_SPL_SPR ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 10 )
233#define PD10_AF_UART2_DSR ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 10 )
234#define PD10_AIN_SPI2_TXD ( GPIO_GIUS | GPIO_PORTD | GPIO_OUT | 10 )
235#define PD11_PF_CONTRAST ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 11 )
236#define PD12_PF_ACD_OE ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 12 )
237#define PD13_PF_LP_HSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 13 )
238#define PD14_PF_FLM_VSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 14 )
239#define PD15_PF_LD0 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 15 )
240#define PD16_PF_LD1 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 16 )
241#define PD17_PF_LD2 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 17 )
242#define PD18_PF_LD3 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 18 )
243#define PD19_PF_LD4 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 19 )
244#define PD20_PF_LD5 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 20 )
245#define PD21_PF_LD6 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 21 )
246#define PD22_PF_LD7 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 22 )
247#define PD23_PF_LD8 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 23 )
248#define PD24_PF_LD9 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 24 )
249#define PD25_PF_LD10 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 25 )
250#define PD26_PF_LD11 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 26 )
251#define PD27_PF_LD12 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 27 )
252#define PD28_PF_LD13 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 28 )
253#define PD29_PF_LD14 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 29 )
254#define PD30_PF_LD15 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 30 )
255#define PD31_PF_TMR2OUT ( GPIO_PORTD | GPIO_PF | 31 )
256#define PD31_BIN_SPI2_TXD ( GPIO_GIUS | GPIO_PORTD | GPIO_BIN | 31 )
257
258/*
259 * PWM controller
260 */
261#define PWMC __REG(IMX_PWM_BASE + 0x00) /* PWM Control Register */
262#define PWMS __REG(IMX_PWM_BASE + 0x04) /* PWM Sample Register */
263#define PWMP __REG(IMX_PWM_BASE + 0x08) /* PWM Period Register */
264#define PWMCNT __REG(IMX_PWM_BASE + 0x0C) /* PWM Counter Register */
265
266#define PWMC_HCTR (0x01<<18) /* Halfword FIFO Data Swapping */
267#define PWMC_BCTR (0x01<<17) /* Byte FIFO Data Swapping */
268#define PWMC_SWR (0x01<<16) /* Software Reset */
269#define PWMC_CLKSRC (0x01<<15) /* Clock Source */
270#define PWMC_PRESCALER(x) (((x-1) & 0x7F) << 8) /* PRESCALER */
271#define PWMC_IRQ (0x01<< 7) /* Interrupt Request */
272#define PWMC_IRQEN (0x01<< 6) /* Interrupt Request Enable */
273#define PWMC_FIFOAV (0x01<< 5) /* FIFO Available */
274#define PWMC_EN (0x01<< 4) /* Enables/Disables the PWM */
275#define PWMC_REPEAT(x) (((x) & 0x03) << 2) /* Sample Repeats */
276#define PWMC_CLKSEL(x) (((x) & 0x03) << 0) /* Clock Selection */
277
278#define PWMS_SAMPLE(x) ((x) & 0xFFFF) /* Contains a two-sample word */
279#define PWMP_PERIOD(x) ((x) & 0xFFFF) /* Represents the PWM's period */
280#define PWMC_COUNTER(x) ((x) & 0xFFFF) /* Represents the current count value */
281
282/*
283 * DMA Controller
284 */
285#define DCR __REG(IMX_DMAC_BASE +0x00) /* DMA Control Register */
286#define DISR __REG(IMX_DMAC_BASE +0x04) /* DMA Interrupt status Register */
287#define DIMR __REG(IMX_DMAC_BASE +0x08) /* DMA Interrupt mask Register */
288#define DBTOSR __REG(IMX_DMAC_BASE +0x0c) /* DMA Burst timeout status Register */
289#define DRTOSR __REG(IMX_DMAC_BASE +0x10) /* DMA Request timeout Register */
290#define DSESR __REG(IMX_DMAC_BASE +0x14) /* DMA Transfer Error Status Register */
291#define DBOSR __REG(IMX_DMAC_BASE +0x18) /* DMA Buffer overflow status Register */
292#define DBTOCR __REG(IMX_DMAC_BASE +0x1c) /* DMA Burst timeout control Register */
293#define WSRA __REG(IMX_DMAC_BASE +0x40) /* W-Size Register A */
294#define XSRA __REG(IMX_DMAC_BASE +0x44) /* X-Size Register A */
295#define YSRA __REG(IMX_DMAC_BASE +0x48) /* Y-Size Register A */
296#define WSRB __REG(IMX_DMAC_BASE +0x4c) /* W-Size Register B */
297#define XSRB __REG(IMX_DMAC_BASE +0x50) /* X-Size Register B */
298#define YSRB __REG(IMX_DMAC_BASE +0x54) /* Y-Size Register B */
299#define SAR(x) __REG2( IMX_DMAC_BASE + 0x80, (x) << 6) /* Source Address Registers */
300#define DAR(x) __REG2( IMX_DMAC_BASE + 0x84, (x) << 6) /* Destination Address Registers */
301#define CNTR(x) __REG2( IMX_DMAC_BASE + 0x88, (x) << 6) /* Count Registers */
302#define CCR(x) __REG2( IMX_DMAC_BASE + 0x8c, (x) << 6) /* Control Registers */
303#define RSSR(x) __REG2( IMX_DMAC_BASE + 0x90, (x) << 6) /* Request source select Registers */
304#define BLR(x) __REG2( IMX_DMAC_BASE + 0x94, (x) << 6) /* Burst length Registers */
305#define RTOR(x) __REG2( IMX_DMAC_BASE + 0x98, (x) << 6) /* Request timeout Registers */
306#define BUCR(x) __REG2( IMX_DMAC_BASE + 0x98, (x) << 6) /* Bus Utilization Registers */
307
308#define DCR_DRST (1<<1)
309#define DCR_DEN (1<<0)
310#define DBTOCR_EN (1<<15)
311#define DBTOCR_CNT(x) ((x) & 0x7fff )
312#define CNTR_CNT(x) ((x) & 0xffffff )
313#define CCR_DMOD_LINEAR ( 0x0 << 12 )
314#define CCR_DMOD_2D ( 0x1 << 12 )
315#define CCR_DMOD_FIFO ( 0x2 << 12 )
316#define CCR_DMOD_EOBFIFO ( 0x3 << 12 )
317#define CCR_SMOD_LINEAR ( 0x0 << 10 )
318#define CCR_SMOD_2D ( 0x1 << 10 )
319#define CCR_SMOD_FIFO ( 0x2 << 10 )
320#define CCR_SMOD_EOBFIFO ( 0x3 << 10 )
321#define CCR_MDIR_DEC (1<<9)
322#define CCR_MSEL_B (1<<8)
323#define CCR_DSIZ_32 ( 0x0 << 6 )
324#define CCR_DSIZ_8 ( 0x1 << 6 )
325#define CCR_DSIZ_16 ( 0x2 << 6 )
326#define CCR_SSIZ_32 ( 0x0 << 4 )
327#define CCR_SSIZ_8 ( 0x1 << 4 )
328#define CCR_SSIZ_16 ( 0x2 << 4 )
329#define CCR_REN (1<<3)
330#define CCR_RPT (1<<2)
331#define CCR_FRC (1<<1)
332#define CCR_CEN (1<<0)
333#define RTOR_EN (1<<15)
334#define RTOR_CLK (1<<14)
335#define RTOR_PSC (1<<13)
336
337/*
338 * Interrupt controller
339 */
340
341#define IMX_INTCNTL __REG(IMX_AITC_BASE+0x00)
342#define INTCNTL_FIAD (1<<19)
343#define INTCNTL_NIAD (1<<20)
344
345#define IMX_NIMASK __REG(IMX_AITC_BASE+0x04)
346#define IMX_INTENNUM __REG(IMX_AITC_BASE+0x08)
347#define IMX_INTDISNUM __REG(IMX_AITC_BASE+0x0c)
348#define IMX_INTENABLEH __REG(IMX_AITC_BASE+0x10)
349#define IMX_INTENABLEL __REG(IMX_AITC_BASE+0x14)
350
351/*
352 * General purpose timers
353 */
354#define IMX_TCTL(x) __REG( 0x00 + (x))
355#define TCTL_SWR (1<<15)
356#define TCTL_FRR (1<<8)
357#define TCTL_CAP_RIS (1<<6)
358#define TCTL_CAP_FAL (2<<6)
359#define TCTL_CAP_RIS_FAL (3<<6)
360#define TCTL_OM (1<<5)
361#define TCTL_IRQEN (1<<4)
362#define TCTL_CLK_PCLK1 (1<<1)
363#define TCTL_CLK_PCLK1_16 (2<<1)
364#define TCTL_CLK_TIN (3<<1)
365#define TCTL_CLK_32 (4<<1)
366#define TCTL_TEN (1<<0)
367
368#define IMX_TPRER(x) __REG( 0x04 + (x))
369#define IMX_TCMP(x) __REG( 0x08 + (x))
370#define IMX_TCR(x) __REG( 0x0C + (x))
371#define IMX_TCN(x) __REG( 0x10 + (x))
372#define IMX_TSTAT(x) __REG( 0x14 + (x))
373#define TSTAT_CAPT (1<<1)
374#define TSTAT_COMP (1<<0)
375
376/*
377 * LCD Controller
378 */
379
380#define LCDC_SSA __REG(IMX_LCDC_BASE+0x00)
381
382#define LCDC_SIZE __REG(IMX_LCDC_BASE+0x04)
383#define SIZE_XMAX(x) ((((x) >> 4) & 0x3f) << 20)
384#define SIZE_YMAX(y) ( (y) & 0x1ff )
385
386#define LCDC_VPW __REG(IMX_LCDC_BASE+0x08)
387#define VPW_VPW(x) ( (x) & 0x3ff )
388
389#define LCDC_CPOS __REG(IMX_LCDC_BASE+0x0C)
390#define CPOS_CC1 (1<<31)
391#define CPOS_CC0 (1<<30)
392#define CPOS_OP (1<<28)
393#define CPOS_CXP(x) (((x) & 3ff) << 16)
394#define CPOS_CYP(y) ((y) & 0x1ff)
395
396#define LCDC_LCWHB __REG(IMX_LCDC_BASE+0x10)
397#define LCWHB_BK_EN (1<<31)
398#define LCWHB_CW(w) (((w) & 0x1f) << 24)
399#define LCWHB_CH(h) (((h) & 0x1f) << 16)
400#define LCWHB_BD(x) ((x) & 0xff)
401
402#define LCDC_LCHCC __REG(IMX_LCDC_BASE+0x14)
403#define LCHCC_CUR_COL_R(r) (((r) & 0x1f) << 11)
404#define LCHCC_CUR_COL_G(g) (((g) & 0x3f) << 5)
405#define LCHCC_CUR_COL_B(b) ((b) & 0x1f)
406
407#define LCDC_PCR __REG(IMX_LCDC_BASE+0x18)
408#define PCR_TFT (1<<31)
409#define PCR_COLOR (1<<30)
410#define PCR_PBSIZ_1 (0<<28)
411#define PCR_PBSIZ_2 (1<<28)
412#define PCR_PBSIZ_4 (2<<28)
413#define PCR_PBSIZ_8 (3<<28)
414#define PCR_BPIX_1 (0<<25)
415#define PCR_BPIX_2 (1<<25)
416#define PCR_BPIX_4 (2<<25)
417#define PCR_BPIX_8 (3<<25)
418#define PCR_BPIX_12 (4<<25)
419#define PCR_BPIX_16 (4<<25)
420#define PCR_PIXPOL (1<<24)
421#define PCR_FLMPOL (1<<23)
422#define PCR_LPPOL (1<<22)
423#define PCR_CLKPOL (1<<21)
424#define PCR_OEPOL (1<<20)
425#define PCR_SCLKIDLE (1<<19)
426#define PCR_END_SEL (1<<18)
427#define PCR_END_BYTE_SWAP (1<<17)
428#define PCR_REV_VS (1<<16)
429#define PCR_ACD_SEL (1<<15)
430#define PCR_ACD(x) (((x) & 0x7f) << 8)
431#define PCR_SCLK_SEL (1<<7)
432#define PCR_SHARP (1<<6)
433#define PCR_PCD(x) ((x) & 0x3f)
434
435#define LCDC_HCR __REG(IMX_LCDC_BASE+0x1C)
436#define HCR_H_WIDTH(x) (((x) & 0x3f) << 26)
437#define HCR_H_WAIT_1(x) (((x) & 0xff) << 8)
438#define HCR_H_WAIT_2(x) ((x) & 0xff)
439
440#define LCDC_VCR __REG(IMX_LCDC_BASE+0x20)
441#define VCR_V_WIDTH(x) (((x) & 0x3f) << 26)
442#define VCR_V_WAIT_1(x) (((x) & 0xff) << 8)
443#define VCR_V_WAIT_2(x) ((x) & 0xff)
444
445#define LCDC_POS __REG(IMX_LCDC_BASE+0x24)
446#define POS_POS(x) ((x) & 1f)
447
448#define LCDC_LSCR1 __REG(IMX_LCDC_BASE+0x28)
449#define LSCR1_PS_RISE_DELAY(x) (((x) & 0x7f) << 26)
450#define LSCR1_CLS_RISE_DELAY(x) (((x) & 0x3f) << 16)
451#define LSCR1_REV_TOGGLE_DELAY(x) (((x) & 0xf) << 8)
452#define LSCR1_GRAY2(x) (((x) & 0xf) << 4)
453#define LSCR1_GRAY1(x) (((x) & 0xf))
454
455#define LCDC_PWMR __REG(IMX_LCDC_BASE+0x2C)
456#define PWMR_CLS(x) (((x) & 0x1ff) << 16)
457#define PWMR_LDMSK (1<<15)
458#define PWMR_SCR1 (1<<10)
459#define PWMR_SCR0 (1<<9)
460#define PWMR_CC_EN (1<<8)
461#define PWMR_PW(x) ((x) & 0xff)
462
463#define LCDC_DMACR __REG(IMX_LCDC_BASE+0x30)
464#define DMACR_BURST (1<<31)
465#define DMACR_HM(x) (((x) & 0xf) << 16)
466#define DMACR_TM(x) ((x) &0xf)
467
468#define LCDC_RMCR __REG(IMX_LCDC_BASE+0x34)
469#define RMCR_LCDC_EN (1<<1)
470#define RMCR_SELF_REF (1<<0)
471
472#define LCDC_LCDICR __REG(IMX_LCDC_BASE+0x38)
473#define LCDICR_INT_SYN (1<<2)
474#define LCDICR_INT_CON (1)
475
476#define LCDC_LCDISR __REG(IMX_LCDC_BASE+0x40)
477#define LCDISR_UDR_ERR (1<<3)
478#define LCDISR_ERR_RES (1<<2)
479#define LCDISR_EOF (1<<1)
480#define LCDISR_BOF (1<<0)
481
482#endif // _IMX_REGS_H
diff --git a/arch/arm/mach-imx/include/mach/imx-uart.h b/arch/arm/mach-imx/include/mach/imx-uart.h
new file mode 100644
index 000000000000..d54eb1d48026
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/imx-uart.h
@@ -0,0 +1,12 @@
1#ifndef ASMARM_ARCH_UART_H
2#define ASMARM_ARCH_UART_H
3
4#define IMXUART_HAVE_RTSCTS (1<<0)
5
6struct imxuart_platform_data {
7 int (*init)(struct platform_device *pdev);
8 void (*exit)(struct platform_device *pdev);
9 unsigned int flags;
10};
11
12#endif
diff --git a/arch/arm/mach-imx/include/mach/imxfb.h b/arch/arm/mach-imx/include/mach/imxfb.h
new file mode 100644
index 000000000000..3ed9ec8b9f00
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/imxfb.h
@@ -0,0 +1,37 @@
1/*
2 * This structure describes the machine which we are running on.
3 */
4struct imxfb_mach_info {
5 u_long pixclock;
6
7 u_short xres;
8 u_short yres;
9
10 u_int nonstd;
11 u_char bpp;
12 u_char hsync_len;
13 u_char left_margin;
14 u_char right_margin;
15
16 u_char vsync_len;
17 u_char upper_margin;
18 u_char lower_margin;
19 u_char sync;
20
21 u_int cmap_greyscale:1,
22 cmap_inverse:1,
23 cmap_static:1,
24 unused:29;
25
26 u_int pcr;
27 u_int pwmr;
28 u_int lscr1;
29 u_int dmacr;
30
31 u_char * fixed_screen_cpu;
32 dma_addr_t fixed_screen_dma;
33
34 void (*lcd_power)(int);
35 void (*backlight_power)(int);
36};
37void set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info);
diff --git a/arch/arm/mach-imx/include/mach/io.h b/arch/arm/mach-imx/include/mach/io.h
new file mode 100644
index 000000000000..c50c5fa6fb81
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/io.h
@@ -0,0 +1,30 @@
1/*
2 * arch/arm/mach-imxads/include/mach/io.h
3 *
4 * Copyright (C) 1999 ARM Limited
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#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#include <mach/hardware.h>
24
25#define IO_SPACE_LIMIT 0xffffffff
26
27#define __io(a) ((void __iomem *)(a))
28#define __mem_pci(a) (a)
29
30#endif
diff --git a/arch/arm/mach-imx/include/mach/irqs.h b/arch/arm/mach-imx/include/mach/irqs.h
new file mode 100644
index 000000000000..eb8d5bd05d56
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/irqs.h
@@ -0,0 +1,116 @@
1/*
2 * arch/arm/mach-imxads/include/mach/irqs.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __ARM_IRQS_H__
23#define __ARM_IRQS_H__
24
25/* Use the imx definitions */
26#include <mach/hardware.h>
27
28/*
29 * IMX Interrupt numbers
30 *
31 */
32#define INT_SOFTINT 0
33#define CSI_INT 6
34#define DSPA_MAC_INT 7
35#define DSPA_INT 8
36#define COMP_INT 9
37#define MSHC_XINT 10
38#define GPIO_INT_PORTA 11
39#define GPIO_INT_PORTB 12
40#define GPIO_INT_PORTC 13
41#define LCDC_INT 14
42#define SIM_INT 15
43#define SIM_DATA_INT 16
44#define RTC_INT 17
45#define RTC_SAMINT 18
46#define UART2_MINT_PFERR 19
47#define UART2_MINT_RTS 20
48#define UART2_MINT_DTR 21
49#define UART2_MINT_UARTC 22
50#define UART2_MINT_TX 23
51#define UART2_MINT_RX 24
52#define UART1_MINT_PFERR 25
53#define UART1_MINT_RTS 26
54#define UART1_MINT_DTR 27
55#define UART1_MINT_UARTC 28
56#define UART1_MINT_TX 29
57#define UART1_MINT_RX 30
58#define VOICE_DAC_INT 31
59#define VOICE_ADC_INT 32
60#define PEN_DATA_INT 33
61#define PWM_INT 34
62#define SDHC_INT 35
63#define I2C_INT 39
64#define CSPI_INT 41
65#define SSI_TX_INT 42
66#define SSI_TX_ERR_INT 43
67#define SSI_RX_INT 44
68#define SSI_RX_ERR_INT 45
69#define TOUCH_INT 46
70#define USBD_INT0 47
71#define USBD_INT1 48
72#define USBD_INT2 49
73#define USBD_INT3 50
74#define USBD_INT4 51
75#define USBD_INT5 52
76#define USBD_INT6 53
77#define BTSYS_INT 55
78#define BTTIM_INT 56
79#define BTWUI_INT 57
80#define TIM2_INT 58
81#define TIM1_INT 59
82#define DMA_ERR 60
83#define DMA_INT 61
84#define GPIO_INT_PORTD 62
85
86#define IMX_IRQS (64)
87
88/* note: the IMX has four gpio ports (A-D), but only
89 * the following pins are connected to the outside
90 * world:
91 *
92 * PORT A: bits 0-31
93 * PORT B: bits 8-31
94 * PORT C: bits 3-17
95 * PORT D: bits 6-31
96 *
97 * We map these interrupts straight on. As a result we have
98 * several holes in the interrupt mapping. We do this for two
99 * reasons:
100 * - mapping the interrupts without holes would get
101 * far more complicated
102 * - Motorola could well decide to bring some processor
103 * with more pins connected
104 */
105
106#define IRQ_GPIOA(x) (IMX_IRQS + x)
107#define IRQ_GPIOB(x) (IRQ_GPIOA(32) + x)
108#define IRQ_GPIOC(x) (IRQ_GPIOB(32) + x)
109#define IRQ_GPIOD(x) (IRQ_GPIOC(32) + x)
110
111/* decode irq number to use with IMR(x), ISR(x) and friends */
112#define IRQ_TO_REG(irq) ((irq - IMX_IRQS) >> 5)
113
114#define NR_IRQS (IRQ_GPIOD(32) + 1)
115#define IRQ_GPIO(x)
116#endif
diff --git a/arch/arm/mach-imx/include/mach/memory.h b/arch/arm/mach-imx/include/mach/memory.h
new file mode 100644
index 000000000000..5c453063c0ed
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/memory.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/mach-imx/include/mach/memory.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2002 Shane Nay (shane@minirl.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 * 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#ifndef __ASM_ARCH_MMU_H
22#define __ASM_ARCH_MMU_H
23
24#define PHYS_OFFSET UL(0x08000000)
25
26/*
27 * Virtual view <-> DMA view memory address translations
28 * virt_to_bus: Used to translate the virtual address to an
29 * address suitable to be passed to set_dma_addr
30 * bus_to_virt: Used to convert an address for DMA operations
31 * to an address that the kernel can use.
32 */
33#define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET)
34#define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET)
35
36#endif
diff --git a/arch/arm/mach-imx/include/mach/mmc.h b/arch/arm/mach-imx/include/mach/mmc.h
new file mode 100644
index 000000000000..4712f354dcca
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/mmc.h
@@ -0,0 +1,15 @@
1#ifndef ASMARM_ARCH_MMC_H
2#define ASMARM_ARCH_MMC_H
3
4#include <linux/mmc/host.h>
5
6struct device;
7
8struct imxmmc_platform_data {
9 int (*card_present)(struct device *);
10 int (*get_ro)(struct device *);
11};
12
13extern void imx_set_mmc_info(struct imxmmc_platform_data *info);
14
15#endif
diff --git a/arch/arm/mach-imx/include/mach/mx1ads.h b/arch/arm/mach-imx/include/mach/mx1ads.h
new file mode 100644
index 000000000000..def05d510eb3
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/mx1ads.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/mach-imx/include/mach/mx1ads.h
3 *
4 * Copyright (C) 2004 Robert Schwebel, Pengutronix
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 */
21
22#ifndef __ASM_ARCH_MX1ADS_H
23#define __ASM_ARCH_MX1ADS_H
24
25/* ------------------------------------------------------------------------ */
26/* Memory Map for the M9328MX1ADS (MX1ADS) Board */
27/* ------------------------------------------------------------------------ */
28
29#define MX1ADS_FLASH_PHYS 0x10000000
30#define MX1ADS_FLASH_SIZE (16*1024*1024)
31
32#define IMX_FB_PHYS (0x0C000000 - 0x40000)
33
34#define CLK32 32000
35
36#endif /* __ASM_ARCH_MX1ADS_H */
diff --git a/arch/arm/mach-imx/include/mach/spi_imx.h b/arch/arm/mach-imx/include/mach/spi_imx.h
new file mode 100644
index 000000000000..4186430feecf
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/spi_imx.h
@@ -0,0 +1,72 @@
1/*
2 * arch/arm/mach-imx/include/mach/spi_imx.h
3 *
4 * Copyright (C) 2006 SWAPP
5 * Andrea Paterniani <a.paterniani@swapp-eng.it>
6 *
7 * Initial version inspired by:
8 * linux-2.6.17-rc3-mm1/arch/arm/mach-pxa/include/mach/pxa2xx_spi.h
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#ifndef SPI_IMX_H_
26#define SPI_IMX_H_
27
28
29/*-------------------------------------------------------------------------*/
30/**
31 * struct spi_imx_master - device.platform_data for SPI controller devices.
32 * @num_chipselect: chipselects are used to distinguish individual
33 * SPI slaves, and are numbered from zero to num_chipselects - 1.
34 * each slave has a chipselect signal, but it's common that not
35 * every chipselect is connected to a slave.
36 * @enable_dma: if true enables DMA driven transfers.
37*/
38struct spi_imx_master {
39 u8 num_chipselect;
40 u8 enable_dma:1;
41};
42/*-------------------------------------------------------------------------*/
43
44
45/*-------------------------------------------------------------------------*/
46/**
47 * struct spi_imx_chip - spi_board_info.controller_data for SPI
48 * slave devices, copied to spi_device.controller_data.
49 * @enable_loopback : used for test purpouse to internally connect RX and TX
50 * sections.
51 * @enable_dma : enables dma transfer (provided that controller driver has
52 * dma enabled too).
53 * @ins_ss_pulse : enable /SS pulse insertion between SPI burst.
54 * @bclk_wait : number of bclk waits between each bits_per_word SPI burst.
55 * @cs_control : function pointer to board-specific function to assert/deassert
56 * I/O port to control HW generation of devices chip-select.
57*/
58struct spi_imx_chip {
59 u8 enable_loopback:1;
60 u8 enable_dma:1;
61 u8 ins_ss_pulse:1;
62 u16 bclk_wait:15;
63 void (*cs_control)(u32 control);
64};
65
66/* Chip-select state */
67#define SPI_CS_ASSERT (1 << 0)
68#define SPI_CS_DEASSERT (1 << 1)
69/*-------------------------------------------------------------------------*/
70
71
72#endif /* SPI_IMX_H_*/
diff --git a/arch/arm/mach-imx/include/mach/system.h b/arch/arm/mach-imx/include/mach/system.h
new file mode 100644
index 000000000000..adee7e51bab2
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/system.h
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-imxads/include/mach/system.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24static void
25arch_idle(void)
26{
27 /*
28 * This should do all the clock switching
29 * and wait for interrupt tricks
30 */
31 cpu_do_idle();
32}
33
34static inline void
35arch_reset(char mode)
36{
37 cpu_reset(0);
38}
39
40#endif
diff --git a/arch/arm/mach-imx/include/mach/timex.h b/arch/arm/mach-imx/include/mach/timex.h
new file mode 100644
index 000000000000..e22ba789546c
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/timex.h
@@ -0,0 +1,26 @@
1/*
2 * linux/include/asm-arm/imx/timex.h
3 *
4 * Copyright (C) 1999 ARM Limited
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
21#ifndef __ASM_ARCH_TIMEX_H
22#define __ASM_ARCH_TIMEX_H
23
24#define CLOCK_TICK_RATE (16000000)
25
26#endif
diff --git a/arch/arm/mach-imx/include/mach/uncompress.h b/arch/arm/mach-imx/include/mach/uncompress.h
new file mode 100644
index 000000000000..70523e67a8f6
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/uncompress.h
@@ -0,0 +1,71 @@
1/*
2 * arch/arm/mach-imxads/include/mach/uncompress.h
3 *
4 *
5 *
6 * Copyright (C) 1999 ARM Limited
7 * Copyright (C) Shane Nay (shane@minirl.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#define UART(x) (*(volatile unsigned long *)(serial_port + (x)))
25
26#define UART1_BASE 0x206000
27#define UART2_BASE 0x207000
28#define USR2 0x98
29#define USR2_TXFE (1<<14)
30#define TXR 0x40
31#define UCR1 0x80
32#define UCR1_UARTEN 1
33
34/*
35 * The following code assumes the serial port has already been
36 * initialized by the bootloader. We search for the first enabled
37 * port in the most probable order. If you didn't setup a port in
38 * your bootloader then nothing will appear (which might be desired).
39 *
40 * This does not append a newline
41 */
42static void putc(int c)
43{
44 unsigned long serial_port;
45
46 do {
47 serial_port = UART1_BASE;
48 if ( UART(UCR1) & UCR1_UARTEN )
49 break;
50 serial_port = UART2_BASE;
51 if ( UART(UCR1) & UCR1_UARTEN )
52 break;
53 return;
54 } while(0);
55
56 while (!(UART(USR2) & USR2_TXFE))
57 barrier();
58
59 UART(TXR) = c;
60}
61
62static inline void flush(void)
63{
64}
65
66/*
67 * nothing to do
68 */
69#define arch_decomp_setup()
70
71#define arch_decomp_wdog()
diff --git a/arch/arm/mach-imx/include/mach/vmalloc.h b/arch/arm/mach-imx/include/mach/vmalloc.h
new file mode 100644
index 000000000000..7d7cb0bde3e8
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/vmalloc.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-imx/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2000 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
diff --git a/arch/arm/mach-imx/irq.c b/arch/arm/mach-imx/irq.c
index e1b1f028b930..798f221eb3b7 100644
--- a/arch/arm/mach-imx/irq.c
+++ b/arch/arm/mach-imx/irq.c
@@ -27,7 +27,7 @@
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/timer.h> 28#include <linux/timer.h>
29 29
30#include <asm/hardware.h> 30#include <mach/hardware.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/io.h> 32#include <asm/io.h>
33 33
diff --git a/arch/arm/mach-imx/leds-mx1ads.c b/arch/arm/mach-imx/leds-mx1ads.c
index 79236404aec2..af81621f689b 100644
--- a/arch/arm/mach-imx/leds-mx1ads.c
+++ b/arch/arm/mach-imx/leds-mx1ads.c
@@ -13,7 +13,7 @@
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/leds.h> 19#include <asm/leds.h>
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c
index 9635d5812bcd..87fa1ff43b0b 100644
--- a/arch/arm/mach-imx/mx1ads.c
+++ b/arch/arm/mach-imx/mx1ads.c
@@ -16,7 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22#include <asm/page.h> 22#include <asm/page.h>
@@ -25,8 +25,8 @@
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26 26
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/arch/mmc.h> 28#include <mach/mmc.h>
29#include <asm/arch/imx-uart.h> 29#include <mach/imx-uart.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include "generic.h" 31#include "generic.h"
32 32
@@ -125,7 +125,7 @@ static struct platform_device *devices[] __initdata = {
125 &imx_uart2_device, 125 &imx_uart2_device,
126}; 126};
127 127
128#ifdef CONFIG_MMC_IMX 128#if defined(CONFIG_MMC_IMX) || defined(CONFIG_MMC_IMX_MODULE)
129static int mx1ads_mmc_card_present(struct device *dev) 129static int mx1ads_mmc_card_present(struct device *dev)
130{ 130{
131 /* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */ 131 /* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */
@@ -143,7 +143,7 @@ mx1ads_init(void)
143#ifdef CONFIG_LEDS 143#ifdef CONFIG_LEDS
144 imx_gpio_mode(GPIO_PORTA | GPIO_OUT | 2); 144 imx_gpio_mode(GPIO_PORTA | GPIO_OUT | 2);
145#endif 145#endif
146#ifdef CONFIG_MMC_IMX 146#if defined(CONFIG_MMC_IMX) || defined(CONFIG_MMC_IMX_MODULE)
147 /* SD/MMC card detect */ 147 /* SD/MMC card detect */
148 imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20); 148 imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20);
149 imx_set_mmc_info(&mx1ads_mmc_info); 149 imx_set_mmc_info(&mx1ads_mmc_info);
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index 5a41e96e8586..08be3875c59e 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -19,7 +19,7 @@
19#include <linux/clockchips.h> 19#include <linux/clockchips.h>
20#include <linux/clk.h> 20#include <linux/clk.h>
21 21
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/leds.h> 24#include <asm/leds.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 7fbbc17f8e8b..8bacf6d4d097 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -20,11 +20,11 @@
20#include <linux/amba/bus.h> 20#include <linux/amba/bus.h>
21#include <linux/amba/serial.h> 21#include <linux/amba/serial.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/irq.h> 24#include <asm/irq.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/hardware/arm_timer.h> 26#include <asm/hardware/arm_timer.h>
27#include <asm/arch/cm.h> 27#include <mach/cm.h>
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/leds.h> 29#include <asm/leds.h>
30#include <asm/mach/time.h> 30#include <asm/mach/time.h>
diff --git a/arch/arm/mach-integrator/cpu.c b/arch/arm/mach-integrator/cpu.c
index 71c58bff304c..ce5ea7c26675 100644
--- a/arch/arm/mach-integrator/cpu.c
+++ b/arch/arm/mach-integrator/cpu.c
@@ -20,7 +20,7 @@
20#include <linux/smp.h> 20#include <linux/smp.h>
21#include <linux/init.h> 21#include <linux/init.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <asm/hardware/icst525.h> 26#include <asm/hardware/icst525.h>
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 5a1588cf8242..0a7b3267c8d8 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -23,8 +23,8 @@
23 23
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/hardware/icst525.h> 25#include <asm/hardware/icst525.h>
26#include <asm/arch/lm.h> 26#include <mach/lm.h>
27#include <asm/arch/impd1.h> 27#include <mach/impd1.h>
28#include <asm/sizes.h> 28#include <asm/sizes.h>
29 29
30#include "clock.h" 30#include "clock.h"
diff --git a/arch/arm/mach-integrator/include/mach/bits.h b/arch/arm/mach-integrator/include/mach/bits.h
new file mode 100644
index 000000000000..09b024e0496a
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/bits.h
@@ -0,0 +1,61 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */
16/* DO NOT EDIT!! - this file automatically generated
17 * from .s file by awk -f s2h.awk
18 */
19/* Bit field definitions
20 * Copyright (C) ARM Limited 1998. All rights reserved.
21 */
22
23#ifndef __bits_h
24#define __bits_h 1
25
26#define BIT0 0x00000001
27#define BIT1 0x00000002
28#define BIT2 0x00000004
29#define BIT3 0x00000008
30#define BIT4 0x00000010
31#define BIT5 0x00000020
32#define BIT6 0x00000040
33#define BIT7 0x00000080
34#define BIT8 0x00000100
35#define BIT9 0x00000200
36#define BIT10 0x00000400
37#define BIT11 0x00000800
38#define BIT12 0x00001000
39#define BIT13 0x00002000
40#define BIT14 0x00004000
41#define BIT15 0x00008000
42#define BIT16 0x00010000
43#define BIT17 0x00020000
44#define BIT18 0x00040000
45#define BIT19 0x00080000
46#define BIT20 0x00100000
47#define BIT21 0x00200000
48#define BIT22 0x00400000
49#define BIT23 0x00800000
50#define BIT24 0x01000000
51#define BIT25 0x02000000
52#define BIT26 0x04000000
53#define BIT27 0x08000000
54#define BIT28 0x10000000
55#define BIT29 0x20000000
56#define BIT30 0x40000000
57#define BIT31 0x80000000
58
59#endif
60
61/* END */
diff --git a/arch/arm/mach-integrator/include/mach/cm.h b/arch/arm/mach-integrator/include/mach/cm.h
new file mode 100644
index 000000000000..1ab353e23595
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/cm.h
@@ -0,0 +1,36 @@
1/*
2 * update the core module control register.
3 */
4void cm_control(u32, u32);
5
6#define CM_CTRL_LED (1 << 0)
7#define CM_CTRL_nMBDET (1 << 1)
8#define CM_CTRL_REMAP (1 << 2)
9#define CM_CTRL_RESET (1 << 3)
10
11/*
12 * Integrator/AP,PP2 specific
13 */
14#define CM_CTRL_HIGHVECTORS (1 << 4)
15#define CM_CTRL_BIGENDIAN (1 << 5)
16#define CM_CTRL_FASTBUS (1 << 6)
17#define CM_CTRL_SYNC (1 << 7)
18
19/*
20 * ARM926/946/966 Integrator/CP specific
21 */
22#define CM_CTRL_LCDBIASEN (1 << 8)
23#define CM_CTRL_LCDBIASUP (1 << 9)
24#define CM_CTRL_LCDBIASDN (1 << 10)
25#define CM_CTRL_LCDMUXSEL_MASK (7 << 11)
26#define CM_CTRL_LCDMUXSEL_GENLCD (1 << 11)
27#define CM_CTRL_LCDMUXSEL_VGA_16BPP (2 << 11)
28#define CM_CTRL_LCDMUXSEL_SHARPLCD (3 << 11)
29#define CM_CTRL_LCDMUXSEL_VGA_8421BPP (4 << 11)
30#define CM_CTRL_LCDEN0 (1 << 14)
31#define CM_CTRL_LCDEN1 (1 << 15)
32#define CM_CTRL_STATIC1 (1 << 16)
33#define CM_CTRL_STATIC2 (1 << 17)
34#define CM_CTRL_STATIC (1 << 18)
35#define CM_CTRL_n24BITEN (1 << 19)
36#define CM_CTRL_EBIWP (1 << 20)
diff --git a/arch/arm/mach-integrator/include/mach/debug-macro.S b/arch/arm/mach-integrator/include/mach/debug-macro.S
new file mode 100644
index 000000000000..d347d659ea30
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/debug-macro.S
@@ -0,0 +1,22 @@
1/* arch/arm/mach-integrator/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 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17 moveq \rx, #0x16000000 @ physical base address
18 movne \rx, #0xf0000000 @ virtual base
19 addne \rx, \rx, #0x16000000 >> 4
20 .endm
21
22#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-integrator/include/mach/dma.h b/arch/arm/mach-integrator/include/mach/dma.h
new file mode 100644
index 000000000000..fbebe85a2db7
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/dma.h
@@ -0,0 +1,19 @@
1/*
2 * arch/arm/mach-integrator/include/mach/dma.h
3 *
4 * Copyright (C) 1997,1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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 */
diff --git a/arch/arm/mach-integrator/include/mach/entry-macro.S b/arch/arm/mach-integrator/include/mach/entry-macro.S
new file mode 100644
index 000000000000..7649c57acb53
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/entry-macro.S
@@ -0,0 +1,44 @@
1/*
2 * arch/arm/mach-integrator/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Integrator 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#include <mach/irqs.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro get_irqnr_preamble, base, tmp
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
23/* FIXME: should not be using soo many LDRs here */
24 ldr \base, =IO_ADDRESS(INTEGRATOR_IC_BASE)
25 mov \irqnr, #IRQ_PIC_START
26 ldr \irqstat, [\base, #IRQ_STATUS] @ get masked status
27 ldr \base, =IO_ADDRESS(INTEGRATOR_HDR_BASE)
28 teq \irqstat, #0
29 ldreq \irqstat, [\base, #(INTEGRATOR_HDR_IC_OFFSET+IRQ_STATUS)]
30 moveq \irqnr, #IRQ_CIC_START
31
321001: tst \irqstat, #15
33 bne 1002f
34 add \irqnr, \irqnr, #4
35 movs \irqstat, \irqstat, lsr #4
36 bne 1001b
371002: tst \irqstat, #1
38 bne 1003f
39 add \irqnr, \irqnr, #1
40 movs \irqstat, \irqstat, lsr #1
41 bne 1002b
421003: /* EQ will be set if no irqs pending */
43 .endm
44
diff --git a/arch/arm/mach-integrator/include/mach/hardware.h b/arch/arm/mach-integrator/include/mach/hardware.h
new file mode 100644
index 000000000000..1251319ef9ae
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/hardware.h
@@ -0,0 +1,48 @@
1/*
2 * arch/arm/mach-integrator/include/mach/hardware.h
3 *
4 * This file contains the hardware definitions of the Integrator.
5 *
6 * Copyright (C) 1999 ARM Limited.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef __ASM_ARCH_HARDWARE_H
23#define __ASM_ARCH_HARDWARE_H
24
25#include <asm/sizes.h>
26#include <mach/platform.h>
27
28/*
29 * Where in virtual memory the IO devices (timers, system controllers
30 * and so on)
31 */
32#define IO_BASE 0xF0000000 // VA of IO
33#define IO_SIZE 0x0B000000 // How much?
34#define IO_START INTEGRATOR_HDR_BASE // PA of IO
35
36#define PCIO_BASE PCI_IO_VADDR
37#define PCIMEM_BASE PCI_MEMORY_VADDR
38
39/* macro to get at IO space when running virtually */
40#define IO_ADDRESS(x) (((x) >> 4) + IO_BASE)
41
42#define pcibios_assign_all_busses() 1
43
44#define PCIBIOS_MIN_IO 0x6000
45#define PCIBIOS_MIN_MEM 0x00100000
46
47#endif
48
diff --git a/arch/arm/mach-integrator/include/mach/impd1.h b/arch/arm/mach-integrator/include/mach/impd1.h
new file mode 100644
index 000000000000..d75de4b14237
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/impd1.h
@@ -0,0 +1,18 @@
1#define IMPD1_OSC1 0x00
2#define IMPD1_OSC2 0x04
3#define IMPD1_LOCK 0x08
4#define IMPD1_LEDS 0x0c
5#define IMPD1_INT 0x10
6#define IMPD1_SW 0x14
7#define IMPD1_CTRL 0x18
8
9#define IMPD1_CTRL_DISP_LCD (0 << 0)
10#define IMPD1_CTRL_DISP_VGA (1 << 0)
11#define IMPD1_CTRL_DISP_LCD1 (2 << 0)
12#define IMPD1_CTRL_DISP_ENABLE (1 << 2)
13#define IMPD1_CTRL_DISP_MASK (7 << 0)
14
15struct device;
16
17void impd1_tweak_control(struct device *dev, u32 mask, u32 val);
18
diff --git a/arch/arm/mach-integrator/include/mach/io.h b/arch/arm/mach-integrator/include/mach/io.h
new file mode 100644
index 000000000000..f21bb5493dd9
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/io.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/mach-integrator/include/mach/io.h
3 *
4 * Copyright (C) 1999 ARM Limited
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#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define IO_SPACE_LIMIT 0xffff
24
25/*
26 * WARNING: this has to mirror definitions in platform.h
27 */
28#define PCI_MEMORY_VADDR 0xe8000000
29#define PCI_CONFIG_VADDR 0xec000000
30#define PCI_V3_VADDR 0xed000000
31#define PCI_IO_VADDR 0xee000000
32
33#define __io(a) ((void __iomem *)(PCI_IO_VADDR + (a)))
34#define __mem_pci(a) (a)
35
36#endif
diff --git a/arch/arm/mach-integrator/include/mach/irqs.h b/arch/arm/mach-integrator/include/mach/irqs.h
new file mode 100644
index 000000000000..1fbe6d190222
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/irqs.h
@@ -0,0 +1,82 @@
1/*
2 * arch/arm/mach-integrator/include/mach/irqs.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22/*
23 * Interrupt numbers
24 */
25#define IRQ_PIC_START 0
26#define IRQ_SOFTINT 0
27#define IRQ_UARTINT0 1
28#define IRQ_UARTINT1 2
29#define IRQ_KMIINT0 3
30#define IRQ_KMIINT1 4
31#define IRQ_TIMERINT0 5
32#define IRQ_TIMERINT1 6
33#define IRQ_TIMERINT2 7
34#define IRQ_RTCINT 8
35#define IRQ_AP_EXPINT0 9
36#define IRQ_AP_EXPINT1 10
37#define IRQ_AP_EXPINT2 11
38#define IRQ_AP_EXPINT3 12
39#define IRQ_AP_PCIINT0 13
40#define IRQ_AP_PCIINT1 14
41#define IRQ_AP_PCIINT2 15
42#define IRQ_AP_PCIINT3 16
43#define IRQ_AP_V3INT 17
44#define IRQ_AP_CPINT0 18
45#define IRQ_AP_CPINT1 19
46#define IRQ_AP_LBUSTIMEOUT 20
47#define IRQ_AP_APCINT 21
48#define IRQ_CP_CLCDCINT 22
49#define IRQ_CP_MMCIINT0 23
50#define IRQ_CP_MMCIINT1 24
51#define IRQ_CP_AACIINT 25
52#define IRQ_CP_CPPLDINT 26
53#define IRQ_CP_ETHINT 27
54#define IRQ_CP_TSPENINT 28
55#define IRQ_PIC_END 31
56
57#define IRQ_CIC_START 32
58#define IRQ_CM_SOFTINT 32
59#define IRQ_CM_COMMRX 33
60#define IRQ_CM_COMMTX 34
61#define IRQ_CIC_END 34
62
63/*
64 * IntegratorCP only
65 */
66#define IRQ_SIC_START 35
67#define IRQ_SIC_CP_SOFTINT 35
68#define IRQ_SIC_CP_RI0 36
69#define IRQ_SIC_CP_RI1 37
70#define IRQ_SIC_CP_CARDIN 38
71#define IRQ_SIC_CP_LMINT0 39
72#define IRQ_SIC_CP_LMINT1 40
73#define IRQ_SIC_CP_LMINT2 41
74#define IRQ_SIC_CP_LMINT3 42
75#define IRQ_SIC_CP_LMINT4 43
76#define IRQ_SIC_CP_LMINT5 44
77#define IRQ_SIC_CP_LMINT6 45
78#define IRQ_SIC_CP_LMINT7 46
79#define IRQ_SIC_END 46
80
81#define NR_IRQS 47
82
diff --git a/arch/arm/mach-integrator/include/mach/lm.h b/arch/arm/mach-integrator/include/mach/lm.h
new file mode 100644
index 000000000000..28186b6f2c09
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/lm.h
@@ -0,0 +1,23 @@
1
2struct lm_device {
3 struct device dev;
4 struct resource resource;
5 unsigned int irq;
6 unsigned int id;
7};
8
9struct lm_driver {
10 struct device_driver drv;
11 int (*probe)(struct lm_device *);
12 void (*remove)(struct lm_device *);
13 int (*suspend)(struct lm_device *, pm_message_t);
14 int (*resume)(struct lm_device *);
15};
16
17int lm_driver_register(struct lm_driver *drv);
18void lm_driver_unregister(struct lm_driver *drv);
19
20int lm_device_register(struct lm_device *dev);
21
22#define lm_get_drvdata(lm) dev_get_drvdata(&(lm)->dev)
23#define lm_set_drvdata(lm,d) dev_set_drvdata(&(lm)->dev, d)
diff --git a/arch/arm/mach-integrator/include/mach/memory.h b/arch/arm/mach-integrator/include/mach/memory.h
new file mode 100644
index 000000000000..be7e63c21d25
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/memory.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-integrator/include/mach/memory.h
3 *
4 * Copyright (C) 1999 ARM Limited
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#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H
22
23/*
24 * Physical DRAM offset.
25 */
26#define PHYS_OFFSET UL(0x00000000)
27#define BUS_OFFSET UL(0x80000000)
28
29/*
30 * Virtual view <-> DMA view memory address translations
31 * virt_to_bus: Used to translate the virtual address to an
32 * address suitable to be passed to set_dma_addr
33 * bus_to_virt: Used to convert an address for DMA operations
34 * to an address that the kernel can use.
35 */
36#define __virt_to_bus(x) (x - PAGE_OFFSET + BUS_OFFSET)
37#define __bus_to_virt(x) (x - BUS_OFFSET + PAGE_OFFSET)
38
39#endif
diff --git a/arch/arm/mach-integrator/include/mach/platform.h b/arch/arm/mach-integrator/include/mach/platform.h
new file mode 100644
index 000000000000..83c4c1ceb411
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/platform.h
@@ -0,0 +1,469 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */
16/* DO NOT EDIT!! - this file automatically generated
17 * from .s file by awk -f s2h.awk
18 */
19/**************************************************************************
20 * * Copyright © ARM Limited 1998. All rights reserved.
21 * ***********************************************************************/
22/* ************************************************************************
23 *
24 * Integrator address map
25 *
26 * NOTE: This is a multi-hosted header file for use with uHAL and
27 * supported debuggers.
28 *
29 * $Id: platform.s,v 1.32 2000/02/18 10:51:39 asims Exp $
30 *
31 * ***********************************************************************/
32
33#ifndef __address_h
34#define __address_h 1
35
36/* ========================================================================
37 * Integrator definitions
38 * ========================================================================
39 * ------------------------------------------------------------------------
40 * Memory definitions
41 * ------------------------------------------------------------------------
42 * Integrator memory map
43 *
44 */
45#define INTEGRATOR_BOOT_ROM_LO 0x00000000
46#define INTEGRATOR_BOOT_ROM_HI 0x20000000
47#define INTEGRATOR_BOOT_ROM_BASE INTEGRATOR_BOOT_ROM_HI /* Normal position */
48#define INTEGRATOR_BOOT_ROM_SIZE SZ_512K
49
50/*
51 * New Core Modules have different amounts of SSRAM, the amount of SSRAM
52 * fitted can be found in HDR_STAT.
53 *
54 * The symbol INTEGRATOR_SSRAM_SIZE is kept, however this now refers to
55 * the minimum amount of SSRAM fitted on any core module.
56 *
57 * New Core Modules also alias the SSRAM.
58 *
59 */
60#define INTEGRATOR_SSRAM_BASE 0x00000000
61#define INTEGRATOR_SSRAM_ALIAS_BASE 0x10800000
62#define INTEGRATOR_SSRAM_SIZE SZ_256K
63
64#define INTEGRATOR_FLASH_BASE 0x24000000
65#define INTEGRATOR_FLASH_SIZE SZ_32M
66
67#define INTEGRATOR_MBRD_SSRAM_BASE 0x28000000
68#define INTEGRATOR_MBRD_SSRAM_SIZE SZ_512K
69
70/*
71 * SDRAM is a SIMM therefore the size is not known.
72 *
73 */
74#define INTEGRATOR_SDRAM_BASE 0x00040000
75
76#define INTEGRATOR_SDRAM_ALIAS_BASE 0x80000000
77#define INTEGRATOR_HDR0_SDRAM_BASE 0x80000000
78#define INTEGRATOR_HDR1_SDRAM_BASE 0x90000000
79#define INTEGRATOR_HDR2_SDRAM_BASE 0xA0000000
80#define INTEGRATOR_HDR3_SDRAM_BASE 0xB0000000
81
82/*
83 * Logic expansion modules
84 *
85 */
86#define INTEGRATOR_LOGIC_MODULES_BASE 0xC0000000
87#define INTEGRATOR_LOGIC_MODULE0_BASE 0xC0000000
88#define INTEGRATOR_LOGIC_MODULE1_BASE 0xD0000000
89#define INTEGRATOR_LOGIC_MODULE2_BASE 0xE0000000
90#define INTEGRATOR_LOGIC_MODULE3_BASE 0xF0000000
91
92/* ------------------------------------------------------------------------
93 * Integrator header card registers
94 * ------------------------------------------------------------------------
95 *
96 */
97#define INTEGRATOR_HDR_ID_OFFSET 0x00
98#define INTEGRATOR_HDR_PROC_OFFSET 0x04
99#define INTEGRATOR_HDR_OSC_OFFSET 0x08
100#define INTEGRATOR_HDR_CTRL_OFFSET 0x0C
101#define INTEGRATOR_HDR_STAT_OFFSET 0x10
102#define INTEGRATOR_HDR_LOCK_OFFSET 0x14
103#define INTEGRATOR_HDR_SDRAM_OFFSET 0x20
104#define INTEGRATOR_HDR_INIT_OFFSET 0x24 /* CM9x6 */
105#define INTEGRATOR_HDR_IC_OFFSET 0x40
106#define INTEGRATOR_HDR_SPDBASE_OFFSET 0x100
107#define INTEGRATOR_HDR_SPDTOP_OFFSET 0x200
108
109#define INTEGRATOR_HDR_BASE 0x10000000
110#define INTEGRATOR_HDR_ID (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_ID_OFFSET)
111#define INTEGRATOR_HDR_PROC (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_PROC_OFFSET)
112#define INTEGRATOR_HDR_OSC (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_OSC_OFFSET)
113#define INTEGRATOR_HDR_CTRL (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_CTRL_OFFSET)
114#define INTEGRATOR_HDR_STAT (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_STAT_OFFSET)
115#define INTEGRATOR_HDR_LOCK (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_LOCK_OFFSET)
116#define INTEGRATOR_HDR_SDRAM (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_SDRAM_OFFSET)
117#define INTEGRATOR_HDR_INIT (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_INIT_OFFSET)
118#define INTEGRATOR_HDR_IC (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_IC_OFFSET)
119#define INTEGRATOR_HDR_SPDBASE (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_SPDBASE_OFFSET)
120#define INTEGRATOR_HDR_SPDTOP (INTEGRATOR_HDR_BASE + INTEGRATOR_HDR_SPDTOP_OFFSET)
121
122#define INTEGRATOR_HDR_CTRL_LED 0x01
123#define INTEGRATOR_HDR_CTRL_MBRD_DETECH 0x02
124#define INTEGRATOR_HDR_CTRL_REMAP 0x04
125#define INTEGRATOR_HDR_CTRL_RESET 0x08
126#define INTEGRATOR_HDR_CTRL_HIGHVECTORS 0x10
127#define INTEGRATOR_HDR_CTRL_BIG_ENDIAN 0x20
128#define INTEGRATOR_HDR_CTRL_FASTBUS 0x40
129#define INTEGRATOR_HDR_CTRL_SYNC 0x80
130
131#define INTEGRATOR_HDR_OSC_CORE_10MHz 0x102
132#define INTEGRATOR_HDR_OSC_CORE_15MHz 0x107
133#define INTEGRATOR_HDR_OSC_CORE_20MHz 0x10C
134#define INTEGRATOR_HDR_OSC_CORE_25MHz 0x111
135#define INTEGRATOR_HDR_OSC_CORE_30MHz 0x116
136#define INTEGRATOR_HDR_OSC_CORE_35MHz 0x11B
137#define INTEGRATOR_HDR_OSC_CORE_40MHz 0x120
138#define INTEGRATOR_HDR_OSC_CORE_45MHz 0x125
139#define INTEGRATOR_HDR_OSC_CORE_50MHz 0x12A
140#define INTEGRATOR_HDR_OSC_CORE_55MHz 0x12F
141#define INTEGRATOR_HDR_OSC_CORE_60MHz 0x134
142#define INTEGRATOR_HDR_OSC_CORE_65MHz 0x139
143#define INTEGRATOR_HDR_OSC_CORE_70MHz 0x13E
144#define INTEGRATOR_HDR_OSC_CORE_75MHz 0x143
145#define INTEGRATOR_HDR_OSC_CORE_80MHz 0x148
146#define INTEGRATOR_HDR_OSC_CORE_85MHz 0x14D
147#define INTEGRATOR_HDR_OSC_CORE_90MHz 0x152
148#define INTEGRATOR_HDR_OSC_CORE_95MHz 0x157
149#define INTEGRATOR_HDR_OSC_CORE_100MHz 0x15C
150#define INTEGRATOR_HDR_OSC_CORE_105MHz 0x161
151#define INTEGRATOR_HDR_OSC_CORE_110MHz 0x166
152#define INTEGRATOR_HDR_OSC_CORE_115MHz 0x16B
153#define INTEGRATOR_HDR_OSC_CORE_120MHz 0x170
154#define INTEGRATOR_HDR_OSC_CORE_125MHz 0x175
155#define INTEGRATOR_HDR_OSC_CORE_130MHz 0x17A
156#define INTEGRATOR_HDR_OSC_CORE_135MHz 0x17F
157#define INTEGRATOR_HDR_OSC_CORE_140MHz 0x184
158#define INTEGRATOR_HDR_OSC_CORE_145MHz 0x189
159#define INTEGRATOR_HDR_OSC_CORE_150MHz 0x18E
160#define INTEGRATOR_HDR_OSC_CORE_155MHz 0x193
161#define INTEGRATOR_HDR_OSC_CORE_160MHz 0x198
162#define INTEGRATOR_HDR_OSC_CORE_MASK 0x7FF
163
164#define INTEGRATOR_HDR_OSC_MEM_10MHz 0x10C000
165#define INTEGRATOR_HDR_OSC_MEM_15MHz 0x116000
166#define INTEGRATOR_HDR_OSC_MEM_20MHz 0x120000
167#define INTEGRATOR_HDR_OSC_MEM_25MHz 0x12A000
168#define INTEGRATOR_HDR_OSC_MEM_30MHz 0x134000
169#define INTEGRATOR_HDR_OSC_MEM_33MHz 0x13A000
170#define INTEGRATOR_HDR_OSC_MEM_40MHz 0x148000
171#define INTEGRATOR_HDR_OSC_MEM_50MHz 0x15C000
172#define INTEGRATOR_HDR_OSC_MEM_60MHz 0x170000
173#define INTEGRATOR_HDR_OSC_MEM_66MHz 0x17C000
174#define INTEGRATOR_HDR_OSC_MEM_MASK 0x7FF000
175
176#define INTEGRATOR_HDR_OSC_BUS_MODE_CM7x0 0x0
177#define INTEGRATOR_HDR_OSC_BUS_MODE_CM9x0 0x0800000
178#define INTEGRATOR_HDR_OSC_BUS_MODE_CM9x6 0x1000000
179#define INTEGRATOR_HDR_OSC_BUS_MODE_CM10x00 0x1800000
180#define INTEGRATOR_HDR_OSC_BUS_MODE_MASK 0x1800000
181
182#define INTEGRATOR_HDR_SDRAM_SPD_OK (1 << 5)
183
184
185/* ------------------------------------------------------------------------
186 * Integrator system registers
187 * ------------------------------------------------------------------------
188 *
189 */
190
191/*
192 * System Controller
193 *
194 */
195#define INTEGRATOR_SC_ID_OFFSET 0x00
196#define INTEGRATOR_SC_OSC_OFFSET 0x04
197#define INTEGRATOR_SC_CTRLS_OFFSET 0x08
198#define INTEGRATOR_SC_CTRLC_OFFSET 0x0C
199#define INTEGRATOR_SC_DEC_OFFSET 0x10
200#define INTEGRATOR_SC_ARB_OFFSET 0x14
201#define INTEGRATOR_SC_PCIENABLE_OFFSET 0x18
202#define INTEGRATOR_SC_LOCK_OFFSET 0x1C
203
204#define INTEGRATOR_SC_BASE 0x11000000
205#define INTEGRATOR_SC_ID (INTEGRATOR_SC_BASE + INTEGRATOR_SC_ID_OFFSET)
206#define INTEGRATOR_SC_OSC (INTEGRATOR_SC_BASE + INTEGRATOR_SC_OSC_OFFSET)
207#define INTEGRATOR_SC_CTRLS (INTEGRATOR_SC_BASE + INTEGRATOR_SC_CTRLS_OFFSET)
208#define INTEGRATOR_SC_CTRLC (INTEGRATOR_SC_BASE + INTEGRATOR_SC_CTRLC_OFFSET)
209#define INTEGRATOR_SC_DEC (INTEGRATOR_SC_BASE + INTEGRATOR_SC_DEC_OFFSET)
210#define INTEGRATOR_SC_ARB (INTEGRATOR_SC_BASE + INTEGRATOR_SC_ARB_OFFSET)
211#define INTEGRATOR_SC_PCIENABLE (INTEGRATOR_SC_BASE + INTEGRATOR_SC_PCIENABLE_OFFSET)
212#define INTEGRATOR_SC_LOCK (INTEGRATOR_SC_BASE + INTEGRATOR_SC_LOCK_OFFSET)
213
214#define INTEGRATOR_SC_OSC_SYS_10MHz 0x20
215#define INTEGRATOR_SC_OSC_SYS_15MHz 0x34
216#define INTEGRATOR_SC_OSC_SYS_20MHz 0x48
217#define INTEGRATOR_SC_OSC_SYS_25MHz 0x5C
218#define INTEGRATOR_SC_OSC_SYS_33MHz 0x7C
219#define INTEGRATOR_SC_OSC_SYS_MASK 0xFF
220
221#define INTEGRATOR_SC_OSC_PCI_25MHz 0x100
222#define INTEGRATOR_SC_OSC_PCI_33MHz 0x0
223#define INTEGRATOR_SC_OSC_PCI_MASK 0x100
224
225#define INTEGRATOR_SC_CTRL_SOFTRST (1 << 0)
226#define INTEGRATOR_SC_CTRL_nFLVPPEN (1 << 1)
227#define INTEGRATOR_SC_CTRL_nFLWP (1 << 2)
228#define INTEGRATOR_SC_CTRL_URTS0 (1 << 4)
229#define INTEGRATOR_SC_CTRL_UDTR0 (1 << 5)
230#define INTEGRATOR_SC_CTRL_URTS1 (1 << 6)
231#define INTEGRATOR_SC_CTRL_UDTR1 (1 << 7)
232
233/*
234 * External Bus Interface
235 *
236 */
237#define INTEGRATOR_EBI_BASE 0x12000000
238
239#define INTEGRATOR_EBI_CSR0_OFFSET 0x00
240#define INTEGRATOR_EBI_CSR1_OFFSET 0x04
241#define INTEGRATOR_EBI_CSR2_OFFSET 0x08
242#define INTEGRATOR_EBI_CSR3_OFFSET 0x0C
243#define INTEGRATOR_EBI_LOCK_OFFSET 0x20
244
245#define INTEGRATOR_EBI_CSR0 (INTEGRATOR_EBI_BASE + INTEGRATOR_EBI_CSR0_OFFSET)
246#define INTEGRATOR_EBI_CSR1 (INTEGRATOR_EBI_BASE + INTEGRATOR_EBI_CSR1_OFFSET)
247#define INTEGRATOR_EBI_CSR2 (INTEGRATOR_EBI_BASE + INTEGRATOR_EBI_CSR2_OFFSET)
248#define INTEGRATOR_EBI_CSR3 (INTEGRATOR_EBI_BASE + INTEGRATOR_EBI_CSR3_OFFSET)
249#define INTEGRATOR_EBI_LOCK (INTEGRATOR_EBI_BASE + INTEGRATOR_EBI_LOCK_OFFSET)
250
251#define INTEGRATOR_EBI_8_BIT 0x00
252#define INTEGRATOR_EBI_16_BIT 0x01
253#define INTEGRATOR_EBI_32_BIT 0x02
254#define INTEGRATOR_EBI_WRITE_ENABLE 0x04
255#define INTEGRATOR_EBI_SYNC 0x08
256#define INTEGRATOR_EBI_WS_2 0x00
257#define INTEGRATOR_EBI_WS_3 0x10
258#define INTEGRATOR_EBI_WS_4 0x20
259#define INTEGRATOR_EBI_WS_5 0x30
260#define INTEGRATOR_EBI_WS_6 0x40
261#define INTEGRATOR_EBI_WS_7 0x50
262#define INTEGRATOR_EBI_WS_8 0x60
263#define INTEGRATOR_EBI_WS_9 0x70
264#define INTEGRATOR_EBI_WS_10 0x80
265#define INTEGRATOR_EBI_WS_11 0x90
266#define INTEGRATOR_EBI_WS_12 0xA0
267#define INTEGRATOR_EBI_WS_13 0xB0
268#define INTEGRATOR_EBI_WS_14 0xC0
269#define INTEGRATOR_EBI_WS_15 0xD0
270#define INTEGRATOR_EBI_WS_16 0xE0
271#define INTEGRATOR_EBI_WS_17 0xF0
272
273
274#define INTEGRATOR_CT_BASE 0x13000000 /* Counter/Timers */
275#define INTEGRATOR_IC_BASE 0x14000000 /* Interrupt Controller */
276#define INTEGRATOR_RTC_BASE 0x15000000 /* Real Time Clock */
277#define INTEGRATOR_UART0_BASE 0x16000000 /* UART 0 */
278#define INTEGRATOR_UART1_BASE 0x17000000 /* UART 1 */
279#define INTEGRATOR_KBD_BASE 0x18000000 /* Keyboard */
280#define INTEGRATOR_MOUSE_BASE 0x19000000 /* Mouse */
281
282/*
283 * LED's & Switches
284 *
285 */
286#define INTEGRATOR_DBG_ALPHA_OFFSET 0x00
287#define INTEGRATOR_DBG_LEDS_OFFSET 0x04
288#define INTEGRATOR_DBG_SWITCH_OFFSET 0x08
289
290#define INTEGRATOR_DBG_BASE 0x1A000000
291#define INTEGRATOR_DBG_ALPHA (INTEGRATOR_DBG_BASE + INTEGRATOR_DBG_ALPHA_OFFSET)
292#define INTEGRATOR_DBG_LEDS (INTEGRATOR_DBG_BASE + INTEGRATOR_DBG_LEDS_OFFSET)
293#define INTEGRATOR_DBG_SWITCH (INTEGRATOR_DBG_BASE + INTEGRATOR_DBG_SWITCH_OFFSET)
294
295
296#if defined(CONFIG_ARCH_INTEGRATOR_AP)
297#define INTEGRATOR_GPIO_BASE 0x1B000000 /* GPIO */
298#elif defined(CONFIG_ARCH_INTEGRATOR_CP)
299#define INTEGRATOR_GPIO_BASE 0xC9000000 /* GPIO */
300#endif
301
302/* ------------------------------------------------------------------------
303 * KMI keyboard/mouse definitions
304 * ------------------------------------------------------------------------
305 */
306/* PS2 Keyboard interface */
307#define KMI0_BASE INTEGRATOR_KBD_BASE
308
309/* PS2 Mouse interface */
310#define KMI1_BASE INTEGRATOR_MOUSE_BASE
311
312/* KMI definitions are now in include/asm-arm/hardware/amba_kmi.h -- rmk */
313
314/* ------------------------------------------------------------------------
315 * Where in the memory map does PCI live?
316 * ------------------------------------------------------------------------
317 * This represents a fairly liberal usage of address space. Even though
318 * the V3 only has two windows (therefore we need to map stuff on the fly),
319 * we maintain the same addresses, even if they're not mapped.
320 *
321 */
322#define PHYS_PCI_MEM_BASE 0x40000000 /* 512M to xxx */
323/* unused 256M from A0000000-AFFFFFFF might be used for I2O ???
324 */
325#define PHYS_PCI_IO_BASE 0x60000000 /* 16M to xxx */
326/* unused (128-16)M from B1000000-B7FFFFFF
327 */
328#define PHYS_PCI_CONFIG_BASE 0x61000000 /* 16M to xxx */
329/* unused ((128-16)M - 64K) from XXX
330 */
331#define PHYS_PCI_V3_BASE 0x62000000
332
333#define PCI_DRAMSIZE INTEGRATOR_SSRAM_SIZE
334
335/* 'export' these to UHAL */
336#define UHAL_PCI_IO PCI_IO_BASE
337#define UHAL_PCI_MEM PCI_MEM_BASE
338#define UHAL_PCI_ALLOC_IO_BASE 0x00004000
339#define UHAL_PCI_ALLOC_MEM_BASE PCI_MEM_BASE
340#define UHAL_PCI_MAX_SLOT 20
341
342/* ========================================================================
343 * Start of uHAL definitions
344 * ========================================================================
345 */
346
347/* ------------------------------------------------------------------------
348 * Integrator Interrupt Controllers
349 * ------------------------------------------------------------------------
350 *
351 * Offsets from interrupt controller base
352 *
353 * System Controller interrupt controller base is
354 *
355 * INTEGRATOR_IC_BASE + (header_number << 6)
356 *
357 * Core Module interrupt controller base is
358 *
359 * INTEGRATOR_HDR_IC
360 *
361 */
362#define IRQ_STATUS 0
363#define IRQ_RAW_STATUS 0x04
364#define IRQ_ENABLE 0x08
365#define IRQ_ENABLE_SET 0x08
366#define IRQ_ENABLE_CLEAR 0x0C
367
368#define INT_SOFT_SET 0x10
369#define INT_SOFT_CLEAR 0x14
370
371#define FIQ_STATUS 0x20
372#define FIQ_RAW_STATUS 0x24
373#define FIQ_ENABLE 0x28
374#define FIQ_ENABLE_SET 0x28
375#define FIQ_ENABLE_CLEAR 0x2C
376
377
378/* ------------------------------------------------------------------------
379 * Interrupts
380 * ------------------------------------------------------------------------
381 *
382 *
383 * Each Core Module has two interrupts controllers, one on the core module
384 * itself and one in the system controller on the motherboard. The
385 * READ_INT macro in target.s reads both interrupt controllers and returns
386 * a 32 bit bitmask, bits 0 to 23 are interrupts from the system controller
387 * and bits 24 to 31 are from the core module.
388 *
389 * The following definitions relate to the bitmask returned by READ_INT.
390 *
391 */
392
393/* ------------------------------------------------------------------------
394 * LED's - The header LED is not accessible via the uHAL API
395 * ------------------------------------------------------------------------
396 *
397 */
398#define GREEN_LED 0x01
399#define YELLOW_LED 0x02
400#define RED_LED 0x04
401#define GREEN_LED_2 0x08
402#define ALL_LEDS 0x0F
403
404#define LED_BANK INTEGRATOR_DBG_LEDS
405
406/*
407 * Memory definitions - run uHAL out of SSRAM.
408 *
409 */
410#define uHAL_MEMORY_SIZE INTEGRATOR_SSRAM_SIZE
411
412/*
413 * Application Flash
414 *
415 */
416#define FLASH_BASE INTEGRATOR_FLASH_BASE
417#define FLASH_SIZE INTEGRATOR_FLASH_SIZE
418#define FLASH_END (FLASH_BASE + FLASH_SIZE - 1)
419#define FLASH_BLOCK_SIZE SZ_128K
420
421/*
422 * Boot Flash
423 *
424 */
425#define EPROM_BASE INTEGRATOR_BOOT_ROM_HI
426#define EPROM_SIZE INTEGRATOR_BOOT_ROM_SIZE
427#define EPROM_END (EPROM_BASE + EPROM_SIZE - 1)
428
429/*
430 * Clean base - dummy
431 *
432 */
433#define CLEAN_BASE EPROM_BASE
434
435/*
436 * Timer definitions
437 *
438 * Only use timer 1 & 2
439 * (both run at 24MHz and will need the clock divider set to 16).
440 *
441 * Timer 0 runs at bus frequency and therefore could vary and currently
442 * uHAL can't handle that.
443 *
444 */
445
446#define INTEGRATOR_TIMER0_BASE INTEGRATOR_CT_BASE
447#define INTEGRATOR_TIMER1_BASE (INTEGRATOR_CT_BASE + 0x100)
448#define INTEGRATOR_TIMER2_BASE (INTEGRATOR_CT_BASE + 0x200)
449
450#define MAX_TIMER 2
451#define MAX_PERIOD 699050
452#define TICKS_PER_uSEC 24
453
454/*
455 * These are useconds NOT ticks.
456 *
457 */
458#define mSEC_1 1000
459#define mSEC_5 (mSEC_1 * 5)
460#define mSEC_10 (mSEC_1 * 10)
461#define mSEC_25 (mSEC_1 * 25)
462#define SEC_1 (mSEC_1 * 1000)
463
464#define INTEGRATOR_CSR_BASE 0x10000000
465#define INTEGRATOR_CSR_SIZE 0x10000000
466
467#endif
468
469/* END */
diff --git a/arch/arm/mach-integrator/include/mach/system.h b/arch/arm/mach-integrator/include/mach/system.h
new file mode 100644
index 000000000000..c485345c8c77
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/system.h
@@ -0,0 +1,44 @@
1/*
2 * arch/arm/mach-integrator/include/mach/system.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24#include <mach/cm.h>
25
26static inline void arch_idle(void)
27{
28 /*
29 * This should do all the clock switching
30 * and wait for interrupt tricks
31 */
32 cpu_do_idle();
33}
34
35static inline void arch_reset(char mode)
36{
37 /*
38 * To reset, we hit the on-board reset register
39 * in the system FPGA
40 */
41 cm_control(CM_CTRL_RESET, CM_CTRL_RESET);
42}
43
44#endif
diff --git a/arch/arm/mach-integrator/include/mach/timex.h b/arch/arm/mach-integrator/include/mach/timex.h
new file mode 100644
index 000000000000..1dcb42028c82
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/timex.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-integrator/include/mach/timex.h
3 *
4 * Integrator architecture timex specifications
5 *
6 * Copyright (C) 1999 ARM Limited
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23/*
24 * ??
25 */
26#define CLOCK_TICK_RATE (50000000 / 16)
diff --git a/arch/arm/mach-integrator/include/mach/uncompress.h b/arch/arm/mach-integrator/include/mach/uncompress.h
new file mode 100644
index 000000000000..30452f00a164
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/uncompress.h
@@ -0,0 +1,50 @@
1/*
2 * arch/arm/mach-integrator/include/mach/uncompress.h
3 *
4 * Copyright (C) 1999 ARM Limited
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
21#define AMBA_UART_DR (*(volatile unsigned char *)0x16000000)
22#define AMBA_UART_LCRH (*(volatile unsigned char *)0x16000008)
23#define AMBA_UART_LCRM (*(volatile unsigned char *)0x1600000c)
24#define AMBA_UART_LCRL (*(volatile unsigned char *)0x16000010)
25#define AMBA_UART_CR (*(volatile unsigned char *)0x16000014)
26#define AMBA_UART_FR (*(volatile unsigned char *)0x16000018)
27
28/*
29 * This does not append a newline
30 */
31static void putc(int c)
32{
33 while (AMBA_UART_FR & (1 << 5))
34 barrier();
35
36 AMBA_UART_DR = c;
37}
38
39static inline void flush(void)
40{
41 while (AMBA_UART_FR & (1 << 3))
42 barrier();
43}
44
45/*
46 * nothing to do
47 */
48#define arch_decomp_setup()
49
50#define arch_decomp_wdog()
diff --git a/arch/arm/mach-integrator/include/mach/vmalloc.h b/arch/arm/mach-integrator/include/mach/vmalloc.h
new file mode 100644
index 000000000000..e87ab0b37bdd
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/vmalloc.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-integrator/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2000 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index df37e93c6fc9..6e472b5f8f26 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -28,14 +28,14 @@
28#include <linux/amba/bus.h> 28#include <linux/amba/bus.h>
29#include <linux/amba/kmi.h> 29#include <linux/amba/kmi.h>
30 30
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/setup.h> 34#include <asm/setup.h>
35#include <asm/param.h> /* HZ */ 35#include <asm/param.h> /* HZ */
36#include <asm/mach-types.h> 36#include <asm/mach-types.h>
37 37
38#include <asm/arch/lm.h> 38#include <mach/lm.h>
39 39
40#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
41#include <asm/mach/flash.h> 41#include <asm/mach/flash.h>
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 913f64b22405..6b99e9c258bd 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -20,15 +20,15 @@
20#include <linux/amba/kmi.h> 20#include <linux/amba/kmi.h>
21#include <linux/amba/clcd.h> 21#include <linux/amba/clcd.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/setup.h> 26#include <asm/setup.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/hardware/icst525.h> 28#include <asm/hardware/icst525.h>
29 29
30#include <asm/arch/cm.h> 30#include <mach/cm.h>
31#include <asm/arch/lm.h> 31#include <mach/lm.h>
32 32
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/flash.h> 34#include <asm/mach/flash.h>
diff --git a/arch/arm/mach-integrator/leds.c b/arch/arm/mach-integrator/leds.c
index f1436e683b49..7bc6881434ec 100644
--- a/arch/arm/mach-integrator/leds.c
+++ b/arch/arm/mach-integrator/leds.c
@@ -25,12 +25,12 @@
25#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/leds.h> 30#include <asm/leds.h>
31#include <asm/system.h> 31#include <asm/system.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/arch/cm.h> 33#include <mach/cm.h>
34 34
35static int saved_leds; 35static int saved_leds;
36 36
diff --git a/arch/arm/mach-integrator/lm.c b/arch/arm/mach-integrator/lm.c
index f939c5091405..f52c7af31eaa 100644
--- a/arch/arm/mach-integrator/lm.c
+++ b/arch/arm/mach-integrator/lm.c
@@ -12,7 +12,7 @@
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14 14
15#include <asm/arch/lm.h> 15#include <mach/lm.h>
16 16
17#define to_lm_device(d) container_of(d, struct lm_device, dev) 17#define to_lm_device(d) container_of(d, struct lm_device, dev)
18#define to_lm_driver(d) container_of(d, struct lm_driver, drv) 18#define to_lm_driver(d) container_of(d, struct lm_driver, drv)
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index c07f497000ca..9f2b1ea8fb20 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -28,7 +28,7 @@
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29#include <linux/init.h> 29#include <linux/init.h>
30 30
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/system.h> 34#include <asm/system.h>
diff --git a/arch/arm/mach-iop13xx/include/mach/adma.h b/arch/arm/mach-iop13xx/include/mach/adma.h
new file mode 100644
index 000000000000..60019c8e6465
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/adma.h
@@ -0,0 +1,537 @@
1/*
2 * Copyright(c) 2006, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 */
18#ifndef _ADMA_H
19#define _ADMA_H
20#include <linux/types.h>
21#include <linux/io.h>
22#include <mach/hardware.h>
23#include <asm/hardware/iop_adma.h>
24
25#define ADMA_ACCR(chan) (chan->mmr_base + 0x0)
26#define ADMA_ACSR(chan) (chan->mmr_base + 0x4)
27#define ADMA_ADAR(chan) (chan->mmr_base + 0x8)
28#define ADMA_IIPCR(chan) (chan->mmr_base + 0x18)
29#define ADMA_IIPAR(chan) (chan->mmr_base + 0x1c)
30#define ADMA_IIPUAR(chan) (chan->mmr_base + 0x20)
31#define ADMA_ANDAR(chan) (chan->mmr_base + 0x24)
32#define ADMA_ADCR(chan) (chan->mmr_base + 0x28)
33#define ADMA_CARMD(chan) (chan->mmr_base + 0x2c)
34#define ADMA_ABCR(chan) (chan->mmr_base + 0x30)
35#define ADMA_DLADR(chan) (chan->mmr_base + 0x34)
36#define ADMA_DUADR(chan) (chan->mmr_base + 0x38)
37#define ADMA_SLAR(src, chan) (chan->mmr_base + (0x3c + (src << 3)))
38#define ADMA_SUAR(src, chan) (chan->mmr_base + (0x40 + (src << 3)))
39
40struct iop13xx_adma_src {
41 u32 src_addr;
42 union {
43 u32 upper_src_addr;
44 struct {
45 unsigned int pq_upper_src_addr:24;
46 unsigned int pq_dmlt:8;
47 };
48 };
49};
50
51struct iop13xx_adma_desc_ctrl {
52 unsigned int int_en:1;
53 unsigned int xfer_dir:2;
54 unsigned int src_select:4;
55 unsigned int zero_result:1;
56 unsigned int block_fill_en:1;
57 unsigned int crc_gen_en:1;
58 unsigned int crc_xfer_dis:1;
59 unsigned int crc_seed_fetch_dis:1;
60 unsigned int status_write_back_en:1;
61 unsigned int endian_swap_en:1;
62 unsigned int reserved0:2;
63 unsigned int pq_update_xfer_en:1;
64 unsigned int dual_xor_en:1;
65 unsigned int pq_xfer_en:1;
66 unsigned int p_xfer_dis:1;
67 unsigned int reserved1:10;
68 unsigned int relax_order_en:1;
69 unsigned int no_snoop_en:1;
70};
71
72struct iop13xx_adma_byte_count {
73 unsigned int byte_count:24;
74 unsigned int host_if:3;
75 unsigned int reserved:2;
76 unsigned int zero_result_err_q:1;
77 unsigned int zero_result_err:1;
78 unsigned int tx_complete:1;
79};
80
81struct iop13xx_adma_desc_hw {
82 u32 next_desc;
83 union {
84 u32 desc_ctrl;
85 struct iop13xx_adma_desc_ctrl desc_ctrl_field;
86 };
87 union {
88 u32 crc_addr;
89 u32 block_fill_data;
90 u32 q_dest_addr;
91 };
92 union {
93 u32 byte_count;
94 struct iop13xx_adma_byte_count byte_count_field;
95 };
96 union {
97 u32 dest_addr;
98 u32 p_dest_addr;
99 };
100 union {
101 u32 upper_dest_addr;
102 u32 pq_upper_dest_addr;
103 };
104 struct iop13xx_adma_src src[1];
105};
106
107struct iop13xx_adma_desc_dual_xor {
108 u32 next_desc;
109 u32 desc_ctrl;
110 u32 reserved;
111 u32 byte_count;
112 u32 h_dest_addr;
113 u32 h_upper_dest_addr;
114 u32 src0_addr;
115 u32 upper_src0_addr;
116 u32 src1_addr;
117 u32 upper_src1_addr;
118 u32 h_src_addr;
119 u32 h_upper_src_addr;
120 u32 d_src_addr;
121 u32 d_upper_src_addr;
122 u32 d_dest_addr;
123 u32 d_upper_dest_addr;
124};
125
126struct iop13xx_adma_desc_pq_update {
127 u32 next_desc;
128 u32 desc_ctrl;
129 u32 reserved;
130 u32 byte_count;
131 u32 p_dest_addr;
132 u32 p_upper_dest_addr;
133 u32 src0_addr;
134 u32 upper_src0_addr;
135 u32 src1_addr;
136 u32 upper_src1_addr;
137 u32 p_src_addr;
138 u32 p_upper_src_addr;
139 u32 q_src_addr;
140 struct {
141 unsigned int q_upper_src_addr:24;
142 unsigned int q_dmlt:8;
143 };
144 u32 q_dest_addr;
145 u32 q_upper_dest_addr;
146};
147
148static inline int iop_adma_get_max_xor(void)
149{
150 return 16;
151}
152
153static inline u32 iop_chan_get_current_descriptor(struct iop_adma_chan *chan)
154{
155 return __raw_readl(ADMA_ADAR(chan));
156}
157
158static inline void iop_chan_set_next_descriptor(struct iop_adma_chan *chan,
159 u32 next_desc_addr)
160{
161 __raw_writel(next_desc_addr, ADMA_ANDAR(chan));
162}
163
164#define ADMA_STATUS_BUSY (1 << 13)
165
166static inline char iop_chan_is_busy(struct iop_adma_chan *chan)
167{
168 if (__raw_readl(ADMA_ACSR(chan)) &
169 ADMA_STATUS_BUSY)
170 return 1;
171 else
172 return 0;
173}
174
175static inline int
176iop_chan_get_desc_align(struct iop_adma_chan *chan, int num_slots)
177{
178 return 1;
179}
180#define iop_desc_is_aligned(x, y) 1
181
182static inline int
183iop_chan_memcpy_slot_count(size_t len, int *slots_per_op)
184{
185 *slots_per_op = 1;
186 return 1;
187}
188
189#define iop_chan_interrupt_slot_count(s, c) iop_chan_memcpy_slot_count(0, s)
190
191static inline int
192iop_chan_memset_slot_count(size_t len, int *slots_per_op)
193{
194 *slots_per_op = 1;
195 return 1;
196}
197
198static inline int
199iop_chan_xor_slot_count(size_t len, int src_cnt, int *slots_per_op)
200{
201 static const char slot_count_table[] = { 1, 2, 2, 2,
202 2, 3, 3, 3,
203 3, 4, 4, 4,
204 4, 5, 5, 5,
205 };
206 *slots_per_op = slot_count_table[src_cnt - 1];
207 return *slots_per_op;
208}
209
210#define ADMA_MAX_BYTE_COUNT (16 * 1024 * 1024)
211#define IOP_ADMA_MAX_BYTE_COUNT ADMA_MAX_BYTE_COUNT
212#define IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT ADMA_MAX_BYTE_COUNT
213#define IOP_ADMA_XOR_MAX_BYTE_COUNT ADMA_MAX_BYTE_COUNT
214#define iop_chan_zero_sum_slot_count(l, s, o) iop_chan_xor_slot_count(l, s, o)
215
216static inline u32 iop_desc_get_dest_addr(struct iop_adma_desc_slot *desc,
217 struct iop_adma_chan *chan)
218{
219 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
220 return hw_desc->dest_addr;
221}
222
223static inline u32 iop_desc_get_byte_count(struct iop_adma_desc_slot *desc,
224 struct iop_adma_chan *chan)
225{
226 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
227 return hw_desc->byte_count_field.byte_count;
228}
229
230static inline u32 iop_desc_get_src_addr(struct iop_adma_desc_slot *desc,
231 struct iop_adma_chan *chan,
232 int src_idx)
233{
234 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
235 return hw_desc->src[src_idx].src_addr;
236}
237
238static inline u32 iop_desc_get_src_count(struct iop_adma_desc_slot *desc,
239 struct iop_adma_chan *chan)
240{
241 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
242 return hw_desc->desc_ctrl_field.src_select + 1;
243}
244
245static inline void
246iop_desc_init_memcpy(struct iop_adma_desc_slot *desc, unsigned long flags)
247{
248 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
249 union {
250 u32 value;
251 struct iop13xx_adma_desc_ctrl field;
252 } u_desc_ctrl;
253
254 u_desc_ctrl.value = 0;
255 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */
256 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
257 hw_desc->desc_ctrl = u_desc_ctrl.value;
258 hw_desc->crc_addr = 0;
259}
260
261static inline void
262iop_desc_init_memset(struct iop_adma_desc_slot *desc, unsigned long flags)
263{
264 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
265 union {
266 u32 value;
267 struct iop13xx_adma_desc_ctrl field;
268 } u_desc_ctrl;
269
270 u_desc_ctrl.value = 0;
271 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */
272 u_desc_ctrl.field.block_fill_en = 1;
273 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
274 hw_desc->desc_ctrl = u_desc_ctrl.value;
275 hw_desc->crc_addr = 0;
276}
277
278/* to do: support buffers larger than ADMA_MAX_BYTE_COUNT */
279static inline void
280iop_desc_init_xor(struct iop_adma_desc_slot *desc, int src_cnt,
281 unsigned long flags)
282{
283 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
284 union {
285 u32 value;
286 struct iop13xx_adma_desc_ctrl field;
287 } u_desc_ctrl;
288
289 u_desc_ctrl.value = 0;
290 u_desc_ctrl.field.src_select = src_cnt - 1;
291 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */
292 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
293 hw_desc->desc_ctrl = u_desc_ctrl.value;
294 hw_desc->crc_addr = 0;
295
296}
297#define iop_desc_init_null_xor(d, s, i) iop_desc_init_xor(d, s, i)
298
299/* to do: support buffers larger than ADMA_MAX_BYTE_COUNT */
300static inline int
301iop_desc_init_zero_sum(struct iop_adma_desc_slot *desc, int src_cnt,
302 unsigned long flags)
303{
304 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
305 union {
306 u32 value;
307 struct iop13xx_adma_desc_ctrl field;
308 } u_desc_ctrl;
309
310 u_desc_ctrl.value = 0;
311 u_desc_ctrl.field.src_select = src_cnt - 1;
312 u_desc_ctrl.field.xfer_dir = 3; /* local to internal bus */
313 u_desc_ctrl.field.zero_result = 1;
314 u_desc_ctrl.field.status_write_back_en = 1;
315 u_desc_ctrl.field.int_en = flags & DMA_PREP_INTERRUPT;
316 hw_desc->desc_ctrl = u_desc_ctrl.value;
317 hw_desc->crc_addr = 0;
318
319 return 1;
320}
321
322static inline void iop_desc_set_byte_count(struct iop_adma_desc_slot *desc,
323 struct iop_adma_chan *chan,
324 u32 byte_count)
325{
326 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
327 hw_desc->byte_count = byte_count;
328}
329
330static inline void
331iop_desc_set_zero_sum_byte_count(struct iop_adma_desc_slot *desc, u32 len)
332{
333 int slots_per_op = desc->slots_per_op;
334 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc, *iter;
335 int i = 0;
336
337 if (len <= IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT) {
338 hw_desc->byte_count = len;
339 } else {
340 do {
341 iter = iop_hw_desc_slot_idx(hw_desc, i);
342 iter->byte_count = IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT;
343 len -= IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT;
344 i += slots_per_op;
345 } while (len > IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT);
346
347 if (len) {
348 iter = iop_hw_desc_slot_idx(hw_desc, i);
349 iter->byte_count = len;
350 }
351 }
352}
353
354
355static inline void iop_desc_set_dest_addr(struct iop_adma_desc_slot *desc,
356 struct iop_adma_chan *chan,
357 dma_addr_t addr)
358{
359 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
360 hw_desc->dest_addr = addr;
361 hw_desc->upper_dest_addr = 0;
362}
363
364static inline void iop_desc_set_memcpy_src_addr(struct iop_adma_desc_slot *desc,
365 dma_addr_t addr)
366{
367 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
368 hw_desc->src[0].src_addr = addr;
369 hw_desc->src[0].upper_src_addr = 0;
370}
371
372static inline void iop_desc_set_xor_src_addr(struct iop_adma_desc_slot *desc,
373 int src_idx, dma_addr_t addr)
374{
375 int slot_cnt = desc->slot_cnt, slots_per_op = desc->slots_per_op;
376 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc, *iter;
377 int i = 0;
378
379 do {
380 iter = iop_hw_desc_slot_idx(hw_desc, i);
381 iter->src[src_idx].src_addr = addr;
382 iter->src[src_idx].upper_src_addr = 0;
383 slot_cnt -= slots_per_op;
384 if (slot_cnt) {
385 i += slots_per_op;
386 addr += IOP_ADMA_XOR_MAX_BYTE_COUNT;
387 }
388 } while (slot_cnt);
389}
390
391static inline void
392iop_desc_init_interrupt(struct iop_adma_desc_slot *desc,
393 struct iop_adma_chan *chan)
394{
395 iop_desc_init_memcpy(desc, 1);
396 iop_desc_set_byte_count(desc, chan, 0);
397 iop_desc_set_dest_addr(desc, chan, 0);
398 iop_desc_set_memcpy_src_addr(desc, 0);
399}
400
401#define iop_desc_set_zero_sum_src_addr iop_desc_set_xor_src_addr
402
403static inline void iop_desc_set_next_desc(struct iop_adma_desc_slot *desc,
404 u32 next_desc_addr)
405{
406 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
407 BUG_ON(hw_desc->next_desc);
408 hw_desc->next_desc = next_desc_addr;
409}
410
411static inline u32 iop_desc_get_next_desc(struct iop_adma_desc_slot *desc)
412{
413 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
414 return hw_desc->next_desc;
415}
416
417static inline void iop_desc_clear_next_desc(struct iop_adma_desc_slot *desc)
418{
419 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
420 hw_desc->next_desc = 0;
421}
422
423static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc,
424 u32 val)
425{
426 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
427 hw_desc->block_fill_data = val;
428}
429
430static inline int iop_desc_get_zero_result(struct iop_adma_desc_slot *desc)
431{
432 struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
433 struct iop13xx_adma_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field;
434 struct iop13xx_adma_byte_count byte_count = hw_desc->byte_count_field;
435
436 BUG_ON(!(byte_count.tx_complete && desc_ctrl.zero_result));
437
438 if (desc_ctrl.pq_xfer_en)
439 return byte_count.zero_result_err_q;
440 else
441 return byte_count.zero_result_err;
442}
443
444static inline void iop_chan_append(struct iop_adma_chan *chan)
445{
446 u32 adma_accr;
447
448 adma_accr = __raw_readl(ADMA_ACCR(chan));
449 adma_accr |= 0x2;
450 __raw_writel(adma_accr, ADMA_ACCR(chan));
451}
452
453static inline u32 iop_chan_get_status(struct iop_adma_chan *chan)
454{
455 return __raw_readl(ADMA_ACSR(chan));
456}
457
458static inline void iop_chan_disable(struct iop_adma_chan *chan)
459{
460 u32 adma_chan_ctrl = __raw_readl(ADMA_ACCR(chan));
461 adma_chan_ctrl &= ~0x1;
462 __raw_writel(adma_chan_ctrl, ADMA_ACCR(chan));
463}
464
465static inline void iop_chan_enable(struct iop_adma_chan *chan)
466{
467 u32 adma_chan_ctrl;
468
469 adma_chan_ctrl = __raw_readl(ADMA_ACCR(chan));
470 adma_chan_ctrl |= 0x1;
471 __raw_writel(adma_chan_ctrl, ADMA_ACCR(chan));
472}
473
474static inline void iop_adma_device_clear_eot_status(struct iop_adma_chan *chan)
475{
476 u32 status = __raw_readl(ADMA_ACSR(chan));
477 status &= (1 << 12);
478 __raw_writel(status, ADMA_ACSR(chan));
479}
480
481static inline void iop_adma_device_clear_eoc_status(struct iop_adma_chan *chan)
482{
483 u32 status = __raw_readl(ADMA_ACSR(chan));
484 status &= (1 << 11);
485 __raw_writel(status, ADMA_ACSR(chan));
486}
487
488static inline void iop_adma_device_clear_err_status(struct iop_adma_chan *chan)
489{
490 u32 status = __raw_readl(ADMA_ACSR(chan));
491 status &= (1 << 9) | (1 << 5) | (1 << 4) | (1 << 3);
492 __raw_writel(status, ADMA_ACSR(chan));
493}
494
495static inline int
496iop_is_err_int_parity(unsigned long status, struct iop_adma_chan *chan)
497{
498 return test_bit(9, &status);
499}
500
501static inline int
502iop_is_err_mcu_abort(unsigned long status, struct iop_adma_chan *chan)
503{
504 return test_bit(5, &status);
505}
506
507static inline int
508iop_is_err_int_tabort(unsigned long status, struct iop_adma_chan *chan)
509{
510 return test_bit(4, &status);
511}
512
513static inline int
514iop_is_err_int_mabort(unsigned long status, struct iop_adma_chan *chan)
515{
516 return test_bit(3, &status);
517}
518
519static inline int
520iop_is_err_pci_tabort(unsigned long status, struct iop_adma_chan *chan)
521{
522 return 0;
523}
524
525static inline int
526iop_is_err_pci_mabort(unsigned long status, struct iop_adma_chan *chan)
527{
528 return 0;
529}
530
531static inline int
532iop_is_err_split_tx(unsigned long status, struct iop_adma_chan *chan)
533{
534 return 0;
535}
536
537#endif /* _ADMA_H */
diff --git a/arch/arm/mach-iop13xx/include/mach/debug-macro.S b/arch/arm/mach-iop13xx/include/mach/debug-macro.S
new file mode 100644
index 000000000000..9037d2e8557c
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/debug-macro.S
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-iop13xx/include/mach/debug-macro.S
3 *
4 * Debugging macro include header
5 *
6 * Copyright (C) 1994-1999 Russell King
7 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14 .macro addruart, rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ mmu enabled?
17 moveq \rx, #0xff000000 @ physical
18 orreq \rx, \rx, #0x00d80000
19 movne \rx, #0xfe000000 @ virtual
20 orrne \rx, \rx, #0x00e80000
21 orr \rx, \rx, #0x00002300
22 orr \rx, \rx, #0x00000040
23 .endm
24
25#define UART_SHIFT 2
26#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-iop13xx/include/mach/dma.h b/arch/arm/mach-iop13xx/include/mach/dma.h
new file mode 100644
index 000000000000..d79846fbb394
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/dma.h
@@ -0,0 +1,3 @@
1#ifndef _IOP13XX_DMA_H
2#define _IOP13XX_DMA_H
3#endif
diff --git a/arch/arm/mach-iop13xx/include/mach/entry-macro.S b/arch/arm/mach-iop13xx/include/mach/entry-macro.S
new file mode 100644
index 000000000000..a624a7870c64
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/entry-macro.S
@@ -0,0 +1,45 @@
1/*
2 * iop13xx low level irq macros
3 * Copyright (c) 2005-2006, Intel Corporation.
4 *
5 * 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 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 */
19 .macro disable_fiq
20 .endm
21
22 .macro get_irqnr_preamble, base, tmp
23 mrc p15, 0, \tmp, c15, c1, 0
24 orr \tmp, \tmp, #(1 << 6)
25 mcr p15, 0, \tmp, c15, c1, 0 @ Enable cp6 access
26 .endm
27
28 /*
29 * Note: a 1-cycle window exists where iintvec will return the value
30 * of iintbase, so we explicitly check for "bad zeros"
31 */
32 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
33 mrc p6, 0, \irqnr, c3, c2, 0 @ Read IINTVEC
34 cmp \irqnr, #0
35 mrceq p6, 0, \irqnr, c3, c2, 0 @ Re-read on potentially bad zero
36 adds \irqstat, \irqnr, #1 @ Check for 0xffffffff
37 movne \irqnr, \irqnr, lsr #2 @ Convert to irqnr
38 .endm
39
40 .macro arch_ret_to_user, tmp1, tmp2
41 mrc p15, 0, \tmp1, c15, c1, 0
42 ands \tmp2, \tmp1, #(1 << 6)
43 bicne \tmp1, \tmp1, #(1 << 6)
44 mcrne p15, 0, \tmp1, c15, c1, 0 @ Disable cp6 access
45 .endm
diff --git a/arch/arm/mach-iop13xx/include/mach/hardware.h b/arch/arm/mach-iop13xx/include/mach/hardware.h
new file mode 100644
index 000000000000..8e1d56289846
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/hardware.h
@@ -0,0 +1,28 @@
1#ifndef __ASM_ARCH_HARDWARE_H
2#define __ASM_ARCH_HARDWARE_H
3#include <asm/types.h>
4
5#define pcibios_assign_all_busses() 1
6
7#ifndef __ASSEMBLY__
8extern unsigned long iop13xx_pcibios_min_io;
9extern unsigned long iop13xx_pcibios_min_mem;
10extern u16 iop13xx_dev_id(void);
11extern void iop13xx_set_atu_mmr_bases(void);
12#endif
13
14#define PCIBIOS_MIN_IO (iop13xx_pcibios_min_io)
15#define PCIBIOS_MIN_MEM (iop13xx_pcibios_min_mem)
16
17/*
18 * Generic chipset bits
19 *
20 */
21#include "iop13xx.h"
22
23/*
24 * Board specific bits
25 */
26#include "iq81340.h"
27
28#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-iop13xx/include/mach/io.h b/arch/arm/mach-iop13xx/include/mach/io.h
new file mode 100644
index 000000000000..a6e0f9e6ddcf
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/io.h
@@ -0,0 +1,41 @@
1/*
2 * iop13xx custom ioremap implementation
3 * Copyright (c) 2005-2006, Intel Corporation.
4 *
5 * 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 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 */
19#ifndef __ASM_ARM_ARCH_IO_H
20#define __ASM_ARM_ARCH_IO_H
21
22#define IO_SPACE_LIMIT 0xffffffff
23
24#define __io(a) __iop13xx_io(a)
25#define __mem_pci(a) (a)
26#define __mem_isa(a) (a)
27
28extern void __iomem * __iop13xx_io(unsigned long io_addr);
29extern void __iomem *__iop13xx_ioremap(unsigned long cookie, size_t size,
30 unsigned int mtype);
31extern void __iop13xx_iounmap(void __iomem *addr);
32
33extern u32 iop13xx_atue_mem_base;
34extern u32 iop13xx_atux_mem_base;
35extern size_t iop13xx_atue_mem_size;
36extern size_t iop13xx_atux_mem_size;
37
38#define __arch_ioremap(a, s, f) __iop13xx_ioremap(a, s, f)
39#define __arch_iounmap(a) __iop13xx_iounmap(a)
40
41#endif
diff --git a/arch/arm/mach-iop13xx/include/mach/iop13xx.h b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
new file mode 100644
index 000000000000..52b7fab7ef60
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
@@ -0,0 +1,526 @@
1#ifndef _IOP13XX_HW_H_
2#define _IOP13XX_HW_H_
3
4#ifndef __ASSEMBLY__
5/* The ATU offsets can change based on the strapping */
6extern u32 iop13xx_atux_pmmr_offset;
7extern u32 iop13xx_atue_pmmr_offset;
8void iop13xx_init_irq(void);
9void iop13xx_map_io(void);
10void iop13xx_platform_init(void);
11void iop13xx_add_tpmi_devices(void);
12void iop13xx_init_irq(void);
13
14/* CPUID CP6 R0 Page 0 */
15static inline int iop13xx_cpu_id(void)
16{
17 int id;
18 asm volatile("mrc p6, 0, %0, c0, c0, 0":"=r" (id));
19 return id;
20}
21
22/* WDTCR CP6 R7 Page 9 */
23static inline u32 read_wdtcr(void)
24{
25 u32 val;
26 asm volatile("mrc p6, 0, %0, c7, c9, 0":"=r" (val));
27 return val;
28}
29static inline void write_wdtcr(u32 val)
30{
31 asm volatile("mcr p6, 0, %0, c7, c9, 0"::"r" (val));
32}
33
34/* WDTSR CP6 R8 Page 9 */
35static inline u32 read_wdtsr(void)
36{
37 u32 val;
38 asm volatile("mrc p6, 0, %0, c8, c9, 0":"=r" (val));
39 return val;
40}
41static inline void write_wdtsr(u32 val)
42{
43 asm volatile("mcr p6, 0, %0, c8, c9, 0"::"r" (val));
44}
45
46/* RCSR - Reset Cause Status Register */
47static inline u32 read_rcsr(void)
48{
49 u32 val;
50 asm volatile("mrc p6, 0, %0, c0, c1, 0":"=r" (val));
51 return val;
52}
53
54extern unsigned long get_iop_tick_rate(void);
55#endif
56
57/*
58 * IOP13XX I/O and Mem space regions for PCI autoconfiguration
59 */
60#define IOP13XX_MAX_RAM_SIZE 0x80000000UL /* 2GB */
61#define IOP13XX_PCI_OFFSET IOP13XX_MAX_RAM_SIZE
62
63/* PCI MAP
64 * bus range cpu phys cpu virt note
65 * 0x0000.0000 + 2GB (n/a) (n/a) inbound, 1:1 mapping with Physical RAM
66 * 0x8000.0000 + 928M 0x1.8000.0000 (ioremap) PCIX outbound memory window
67 * 0x8000.0000 + 928M 0x2.8000.0000 (ioremap) PCIE outbound memory window
68 *
69 * IO MAP
70 * 0x1000 + 64K 0x0.fffb.1000 0xfec6.1000 PCIX outbound i/o window
71 * 0x1000 + 64K 0x0.fffd.1000 0xfed7.1000 PCIE outbound i/o window
72 */
73#define IOP13XX_PCIX_IO_WINDOW_SIZE 0x10000UL
74#define IOP13XX_PCIX_LOWER_IO_PA 0xfffb0000UL
75#define IOP13XX_PCIX_LOWER_IO_VA 0xfec60000UL
76#define IOP13XX_PCIX_LOWER_IO_BA 0x0UL /* OIOTVR */
77#define IOP13XX_PCIX_IO_BUS_OFFSET 0x1000UL
78#define IOP13XX_PCIX_UPPER_IO_PA (IOP13XX_PCIX_LOWER_IO_PA +\
79 IOP13XX_PCIX_IO_WINDOW_SIZE - 1)
80#define IOP13XX_PCIX_UPPER_IO_VA (IOP13XX_PCIX_LOWER_IO_VA +\
81 IOP13XX_PCIX_IO_WINDOW_SIZE - 1)
82#define IOP13XX_PCIX_IO_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\
83 (IOP13XX_PCIX_LOWER_IO_PA\
84 - IOP13XX_PCIX_LOWER_IO_VA))
85
86#define IOP13XX_PCIX_MEM_PHYS_OFFSET 0x100000000ULL
87#define IOP13XX_PCIX_MEM_WINDOW_SIZE 0x3a000000UL
88#define IOP13XX_PCIX_LOWER_MEM_BA (PHYS_OFFSET + IOP13XX_PCI_OFFSET)
89#define IOP13XX_PCIX_LOWER_MEM_PA (IOP13XX_PCIX_MEM_PHYS_OFFSET +\
90 IOP13XX_PCIX_LOWER_MEM_BA)
91#define IOP13XX_PCIX_UPPER_MEM_PA (IOP13XX_PCIX_LOWER_MEM_PA +\
92 IOP13XX_PCIX_MEM_WINDOW_SIZE - 1)
93#define IOP13XX_PCIX_UPPER_MEM_BA (IOP13XX_PCIX_LOWER_MEM_BA +\
94 IOP13XX_PCIX_MEM_WINDOW_SIZE - 1)
95
96#define IOP13XX_PCIX_MEM_COOKIE 0x80000000UL
97#define IOP13XX_PCIX_LOWER_MEM_RA IOP13XX_PCIX_MEM_COOKIE
98#define IOP13XX_PCIX_UPPER_MEM_RA (IOP13XX_PCIX_LOWER_MEM_RA +\
99 IOP13XX_PCIX_MEM_WINDOW_SIZE - 1)
100#define IOP13XX_PCIX_MEM_OFFSET (IOP13XX_PCIX_MEM_COOKIE -\
101 IOP13XX_PCIX_LOWER_MEM_BA)
102
103/* PCI-E ranges */
104#define IOP13XX_PCIE_IO_WINDOW_SIZE 0x10000UL
105#define IOP13XX_PCIE_LOWER_IO_PA 0xfffd0000UL
106#define IOP13XX_PCIE_LOWER_IO_VA 0xfed70000UL
107#define IOP13XX_PCIE_LOWER_IO_BA 0x0UL /* OIOTVR */
108#define IOP13XX_PCIE_IO_BUS_OFFSET 0x1000UL
109#define IOP13XX_PCIE_UPPER_IO_PA (IOP13XX_PCIE_LOWER_IO_PA +\
110 IOP13XX_PCIE_IO_WINDOW_SIZE - 1)
111#define IOP13XX_PCIE_UPPER_IO_VA (IOP13XX_PCIE_LOWER_IO_VA +\
112 IOP13XX_PCIE_IO_WINDOW_SIZE - 1)
113#define IOP13XX_PCIE_UPPER_IO_BA (IOP13XX_PCIE_LOWER_IO_BA +\
114 IOP13XX_PCIE_IO_WINDOW_SIZE - 1)
115#define IOP13XX_PCIE_IO_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\
116 (IOP13XX_PCIE_LOWER_IO_PA\
117 - IOP13XX_PCIE_LOWER_IO_VA))
118
119#define IOP13XX_PCIE_MEM_PHYS_OFFSET 0x200000000ULL
120#define IOP13XX_PCIE_MEM_WINDOW_SIZE 0x3a000000UL
121#define IOP13XX_PCIE_LOWER_MEM_BA (PHYS_OFFSET + IOP13XX_PCI_OFFSET)
122#define IOP13XX_PCIE_LOWER_MEM_PA (IOP13XX_PCIE_MEM_PHYS_OFFSET +\
123 IOP13XX_PCIE_LOWER_MEM_BA)
124#define IOP13XX_PCIE_UPPER_MEM_PA (IOP13XX_PCIE_LOWER_MEM_PA +\
125 IOP13XX_PCIE_MEM_WINDOW_SIZE - 1)
126#define IOP13XX_PCIE_UPPER_MEM_BA (IOP13XX_PCIE_LOWER_MEM_BA +\
127 IOP13XX_PCIE_MEM_WINDOW_SIZE - 1)
128
129/* All 0xc000.0000 - 0xfdff.ffff addresses belong to PCIe */
130#define IOP13XX_PCIE_MEM_COOKIE 0xc0000000UL
131#define IOP13XX_PCIE_LOWER_MEM_RA IOP13XX_PCIE_MEM_COOKIE
132#define IOP13XX_PCIE_UPPER_MEM_RA (IOP13XX_PCIE_LOWER_MEM_RA +\
133 IOP13XX_PCIE_MEM_WINDOW_SIZE - 1)
134#define IOP13XX_PCIE_MEM_OFFSET (IOP13XX_PCIE_MEM_COOKIE -\
135 IOP13XX_PCIE_LOWER_MEM_BA)
136
137/* PBI Ranges */
138#define IOP13XX_PBI_LOWER_MEM_PA 0xf0000000UL
139#define IOP13XX_PBI_MEM_WINDOW_SIZE 0x04000000UL
140#define IOP13XX_PBI_MEM_COOKIE 0xfa000000UL
141#define IOP13XX_PBI_LOWER_MEM_RA IOP13XX_PBI_MEM_COOKIE
142#define IOP13XX_PBI_UPPER_MEM_RA (IOP13XX_PBI_LOWER_MEM_RA +\
143 IOP13XX_PBI_MEM_WINDOW_SIZE - 1)
144
145/*
146 * IOP13XX chipset registers
147 */
148#define IOP13XX_PMMR_PHYS_MEM_BASE 0xffd80000UL /* PMMR phys. address */
149#define IOP13XX_PMMR_VIRT_MEM_BASE 0xfee80000UL /* PMMR phys. address */
150#define IOP13XX_PMMR_MEM_WINDOW_SIZE 0x80000
151#define IOP13XX_PMMR_UPPER_MEM_VA (IOP13XX_PMMR_VIRT_MEM_BASE +\
152 IOP13XX_PMMR_MEM_WINDOW_SIZE - 1)
153#define IOP13XX_PMMR_UPPER_MEM_PA (IOP13XX_PMMR_PHYS_MEM_BASE +\
154 IOP13XX_PMMR_MEM_WINDOW_SIZE - 1)
155#define IOP13XX_PMMR_VIRT_TO_PHYS(addr) (u32) ((u32) addr +\
156 (IOP13XX_PMMR_PHYS_MEM_BASE\
157 - IOP13XX_PMMR_VIRT_MEM_BASE))
158#define IOP13XX_PMMR_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\
159 (IOP13XX_PMMR_PHYS_MEM_BASE\
160 - IOP13XX_PMMR_VIRT_MEM_BASE))
161#define IOP13XX_REG_ADDR32(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
162#define IOP13XX_REG_ADDR16(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
163#define IOP13XX_REG_ADDR8(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
164#define IOP13XX_REG_ADDR32_PHYS(reg) (IOP13XX_PMMR_PHYS_MEM_BASE + (reg))
165#define IOP13XX_REG_ADDR16_PHYS(reg) (IOP13XX_PMMR_PHYS_MEM_BASE + (reg))
166#define IOP13XX_REG_ADDR8_PHYS(reg) (IOP13XX_PMMR_PHYS_MEM_BASE + (reg))
167#define IOP13XX_PMMR_SIZE 0x00080000
168
169/*=================== Defines for Platform Devices =====================*/
170#define IOP13XX_UART0_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002300)
171#define IOP13XX_UART1_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002340)
172#define IOP13XX_UART0_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002300)
173#define IOP13XX_UART1_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002340)
174
175#define IOP13XX_I2C0_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002500)
176#define IOP13XX_I2C1_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002520)
177#define IOP13XX_I2C2_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002540)
178#define IOP13XX_I2C0_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002500)
179#define IOP13XX_I2C1_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002520)
180#define IOP13XX_I2C2_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002540)
181
182/* ATU selection flags */
183/* IOP13XX_INIT_ATU_DEFAULT = Rely on CONFIG_IOP13XX_ATU* */
184#define IOP13XX_INIT_ATU_DEFAULT (0)
185#define IOP13XX_INIT_ATU_ATUX (1 << 0)
186#define IOP13XX_INIT_ATU_ATUE (1 << 1)
187#define IOP13XX_INIT_ATU_NONE (1 << 2)
188
189/* UART selection flags */
190/* IOP13XX_INIT_UART_DEFAULT = Rely on CONFIG_IOP13XX_UART* */
191#define IOP13XX_INIT_UART_DEFAULT (0)
192#define IOP13XX_INIT_UART_0 (1 << 0)
193#define IOP13XX_INIT_UART_1 (1 << 1)
194
195/* I2C selection flags */
196/* IOP13XX_INIT_I2C_DEFAULT = Rely on CONFIG_IOP13XX_I2C* */
197#define IOP13XX_INIT_I2C_DEFAULT (0)
198#define IOP13XX_INIT_I2C_0 (1 << 0)
199#define IOP13XX_INIT_I2C_1 (1 << 1)
200#define IOP13XX_INIT_I2C_2 (1 << 2)
201
202/* ADMA selection flags */
203/* INIT_ADMA_DEFAULT = Rely on CONFIG_IOP13XX_ADMA* */
204#define IOP13XX_INIT_ADMA_DEFAULT (0)
205#define IOP13XX_INIT_ADMA_0 (1 << 0)
206#define IOP13XX_INIT_ADMA_1 (1 << 1)
207#define IOP13XX_INIT_ADMA_2 (1 << 2)
208
209/* Platform devices */
210#define IQ81340_NUM_UART 2
211#define IQ81340_NUM_I2C 3
212#define IQ81340_NUM_PHYS_MAP_FLASH 1
213#define IQ81340_NUM_ADMA 3
214#define IQ81340_MAX_PLAT_DEVICES (IQ81340_NUM_UART + \
215 IQ81340_NUM_I2C + \
216 IQ81340_NUM_PHYS_MAP_FLASH + \
217 IQ81340_NUM_ADMA)
218
219/*========================== PMMR offsets for key registers ============*/
220#define IOP13XX_ATU0_PMMR_OFFSET 0x00048000
221#define IOP13XX_ATU1_PMMR_OFFSET 0x0004c000
222#define IOP13XX_ATU2_PMMR_OFFSET 0x0004d000
223#define IOP13XX_ADMA0_PMMR_OFFSET 0x00000000
224#define IOP13XX_ADMA1_PMMR_OFFSET 0x00000200
225#define IOP13XX_ADMA2_PMMR_OFFSET 0x00000400
226#define IOP13XX_PBI_PMMR_OFFSET 0x00001580
227#define IOP13XX_MU_PMMR_OFFSET 0x00004000
228#define IOP13XX_ESSR0_PMMR_OFFSET 0x00002188
229#define IOP13XX_ESSR0 IOP13XX_REG_ADDR32(0x00002188)
230
231#define IOP13XX_ESSR0_IFACE_MASK 0x00004000 /* Interface PCI-X / PCI-E */
232#define IOP13XX_CONTROLLER_ONLY (1 << 14)
233#define IOP13XX_INTERFACE_SEL_PCIX (1 << 15)
234
235#define IOP13XX_PMON_PMMR_OFFSET 0x0001A000
236#define IOP13XX_PMON_BASE (IOP13XX_PMMR_VIRT_MEM_BASE +\
237 IOP13XX_PMON_PMMR_OFFSET)
238#define IOP13XX_PMON_PHYSBASE (IOP13XX_PMMR_PHYS_MEM_BASE +\
239 IOP13XX_PMON_PMMR_OFFSET)
240
241#define IOP13XX_PMON_CMD0 (IOP13XX_PMON_BASE + 0x0)
242#define IOP13XX_PMON_EVR0 (IOP13XX_PMON_BASE + 0x4)
243#define IOP13XX_PMON_STS0 (IOP13XX_PMON_BASE + 0x8)
244#define IOP13XX_PMON_DATA0 (IOP13XX_PMON_BASE + 0xC)
245
246#define IOP13XX_PMON_CMD3 (IOP13XX_PMON_BASE + 0x30)
247#define IOP13XX_PMON_EVR3 (IOP13XX_PMON_BASE + 0x34)
248#define IOP13XX_PMON_STS3 (IOP13XX_PMON_BASE + 0x38)
249#define IOP13XX_PMON_DATA3 (IOP13XX_PMON_BASE + 0x3C)
250
251#define IOP13XX_PMON_CMD7 (IOP13XX_PMON_BASE + 0x70)
252#define IOP13XX_PMON_EVR7 (IOP13XX_PMON_BASE + 0x74)
253#define IOP13XX_PMON_STS7 (IOP13XX_PMON_BASE + 0x78)
254#define IOP13XX_PMON_DATA7 (IOP13XX_PMON_BASE + 0x7C)
255
256#define IOP13XX_PMONEN (IOP13XX_PMMR_VIRT_MEM_BASE + 0x4E040)
257#define IOP13XX_PMONSTAT (IOP13XX_PMMR_VIRT_MEM_BASE + 0x4E044)
258
259/*================================ATU===================================*/
260#define IOP13XX_ATUX_OFFSET(ofs) IOP13XX_REG_ADDR32(\
261 iop13xx_atux_pmmr_offset + (ofs))
262
263#define IOP13XX_ATUX_DID IOP13XX_REG_ADDR16(\
264 iop13xx_atux_pmmr_offset + 0x2)
265
266#define IOP13XX_ATUX_ATUCMD IOP13XX_REG_ADDR16(\
267 iop13xx_atux_pmmr_offset + 0x4)
268#define IOP13XX_ATUX_ATUSR IOP13XX_REG_ADDR16(\
269 iop13xx_atux_pmmr_offset + 0x6)
270
271#define IOP13XX_ATUX_IABAR0 IOP13XX_ATUX_OFFSET(0x10)
272#define IOP13XX_ATUX_IAUBAR0 IOP13XX_ATUX_OFFSET(0x14)
273#define IOP13XX_ATUX_IABAR1 IOP13XX_ATUX_OFFSET(0x18)
274#define IOP13XX_ATUX_IAUBAR1 IOP13XX_ATUX_OFFSET(0x1c)
275#define IOP13XX_ATUX_IABAR2 IOP13XX_ATUX_OFFSET(0x20)
276#define IOP13XX_ATUX_IAUBAR2 IOP13XX_ATUX_OFFSET(0x24)
277#define IOP13XX_ATUX_IALR0 IOP13XX_ATUX_OFFSET(0x40)
278#define IOP13XX_ATUX_IATVR0 IOP13XX_ATUX_OFFSET(0x44)
279#define IOP13XX_ATUX_IAUTVR0 IOP13XX_ATUX_OFFSET(0x48)
280#define IOP13XX_ATUX_IALR1 IOP13XX_ATUX_OFFSET(0x4c)
281#define IOP13XX_ATUX_IATVR1 IOP13XX_ATUX_OFFSET(0x50)
282#define IOP13XX_ATUX_IAUTVR1 IOP13XX_ATUX_OFFSET(0x54)
283#define IOP13XX_ATUX_IALR2 IOP13XX_ATUX_OFFSET(0x58)
284#define IOP13XX_ATUX_IATVR2 IOP13XX_ATUX_OFFSET(0x5c)
285#define IOP13XX_ATUX_IAUTVR2 IOP13XX_ATUX_OFFSET(0x60)
286#define IOP13XX_ATUX_ATUCR IOP13XX_ATUX_OFFSET(0x70)
287#define IOP13XX_ATUX_PCSR IOP13XX_ATUX_OFFSET(0x74)
288#define IOP13XX_ATUX_ATUISR IOP13XX_ATUX_OFFSET(0x78)
289#define IOP13XX_ATUX_PCIXSR IOP13XX_ATUX_OFFSET(0xD4)
290#define IOP13XX_ATUX_IABAR3 IOP13XX_ATUX_OFFSET(0x200)
291#define IOP13XX_ATUX_IAUBAR3 IOP13XX_ATUX_OFFSET(0x204)
292#define IOP13XX_ATUX_IALR3 IOP13XX_ATUX_OFFSET(0x208)
293#define IOP13XX_ATUX_IATVR3 IOP13XX_ATUX_OFFSET(0x20c)
294#define IOP13XX_ATUX_IAUTVR3 IOP13XX_ATUX_OFFSET(0x210)
295
296#define IOP13XX_ATUX_OIOBAR IOP13XX_ATUX_OFFSET(0x300)
297#define IOP13XX_ATUX_OIOWTVR IOP13XX_ATUX_OFFSET(0x304)
298#define IOP13XX_ATUX_OUMBAR0 IOP13XX_ATUX_OFFSET(0x308)
299#define IOP13XX_ATUX_OUMWTVR0 IOP13XX_ATUX_OFFSET(0x30c)
300#define IOP13XX_ATUX_OUMBAR1 IOP13XX_ATUX_OFFSET(0x310)
301#define IOP13XX_ATUX_OUMWTVR1 IOP13XX_ATUX_OFFSET(0x314)
302#define IOP13XX_ATUX_OUMBAR2 IOP13XX_ATUX_OFFSET(0x318)
303#define IOP13XX_ATUX_OUMWTVR2 IOP13XX_ATUX_OFFSET(0x31c)
304#define IOP13XX_ATUX_OUMBAR3 IOP13XX_ATUX_OFFSET(0x320)
305#define IOP13XX_ATUX_OUMWTVR3 IOP13XX_ATUX_OFFSET(0x324)
306#define IOP13XX_ATUX_OUDMABAR IOP13XX_ATUX_OFFSET(0x328)
307#define IOP13XX_ATUX_OUMSIBAR IOP13XX_ATUX_OFFSET(0x32c)
308#define IOP13XX_ATUX_OCCAR IOP13XX_ATUX_OFFSET(0x330)
309#define IOP13XX_ATUX_OCCDR IOP13XX_ATUX_OFFSET(0x334)
310
311#define IOP13XX_ATUX_ATUCR_OUT_EN (1 << 1)
312#define IOP13XX_ATUX_PCSR_CENTRAL_RES (1 << 25)
313#define IOP13XX_ATUX_PCSR_P_RSTOUT (1 << 21)
314#define IOP13XX_ATUX_PCSR_OUT_Q_BUSY (1 << 15)
315#define IOP13XX_ATUX_PCSR_IN_Q_BUSY (1 << 14)
316#define IOP13XX_ATUX_PCSR_FREQ_OFFSET (16)
317
318#define IOP13XX_ATUX_STAT_PCI_IFACE_ERR (1 << 18)
319#define IOP13XX_ATUX_STAT_VPD_ADDR (1 << 17)
320#define IOP13XX_ATUX_STAT_INT_PAR_ERR (1 << 16)
321#define IOP13XX_ATUX_STAT_CFG_WRITE (1 << 15)
322#define IOP13XX_ATUX_STAT_ERR_COR (1 << 14)
323#define IOP13XX_ATUX_STAT_TX_SCEM (1 << 13)
324#define IOP13XX_ATUX_STAT_REC_SCEM (1 << 12)
325#define IOP13XX_ATUX_STAT_POWER_TRAN (1 << 11)
326#define IOP13XX_ATUX_STAT_TX_SERR (1 << 10)
327#define IOP13XX_ATUX_STAT_DET_PAR_ERR (1 << 9 )
328#define IOP13XX_ATUX_STAT_BIST (1 << 8 )
329#define IOP13XX_ATUX_STAT_INT_REC_MABORT (1 << 7 )
330#define IOP13XX_ATUX_STAT_REC_SERR (1 << 4 )
331#define IOP13XX_ATUX_STAT_EXT_REC_MABORT (1 << 3 )
332#define IOP13XX_ATUX_STAT_EXT_REC_TABORT (1 << 2 )
333#define IOP13XX_ATUX_STAT_EXT_SIG_TABORT (1 << 1 )
334#define IOP13XX_ATUX_STAT_MASTER_DATA_PAR (1 << 0 )
335
336#define IOP13XX_ATUX_PCIXSR_BUS_NUM (8)
337#define IOP13XX_ATUX_PCIXSR_DEV_NUM (3)
338#define IOP13XX_ATUX_PCIXSR_FUNC_NUM (0)
339
340#define IOP13XX_ATUX_IALR_DISABLE 0x00000001
341#define IOP13XX_ATUX_OUMBAR_ENABLE 0x80000000
342
343#define IOP13XX_ATUE_OFFSET(ofs) IOP13XX_REG_ADDR32(\
344 iop13xx_atue_pmmr_offset + (ofs))
345
346#define IOP13XX_ATUE_DID IOP13XX_REG_ADDR16(\
347 iop13xx_atue_pmmr_offset + 0x2)
348#define IOP13XX_ATUE_ATUCMD IOP13XX_REG_ADDR16(\
349 iop13xx_atue_pmmr_offset + 0x4)
350#define IOP13XX_ATUE_ATUSR IOP13XX_REG_ADDR16(\
351 iop13xx_atue_pmmr_offset + 0x6)
352
353#define IOP13XX_ATUE_IABAR0 IOP13XX_ATUE_OFFSET(0x10)
354#define IOP13XX_ATUE_IAUBAR0 IOP13XX_ATUE_OFFSET(0x14)
355#define IOP13XX_ATUE_IABAR1 IOP13XX_ATUE_OFFSET(0x18)
356#define IOP13XX_ATUE_IAUBAR1 IOP13XX_ATUE_OFFSET(0x1c)
357#define IOP13XX_ATUE_IABAR2 IOP13XX_ATUE_OFFSET(0x20)
358#define IOP13XX_ATUE_IAUBAR2 IOP13XX_ATUE_OFFSET(0x24)
359#define IOP13XX_ATUE_IALR0 IOP13XX_ATUE_OFFSET(0x40)
360#define IOP13XX_ATUE_IATVR0 IOP13XX_ATUE_OFFSET(0x44)
361#define IOP13XX_ATUE_IAUTVR0 IOP13XX_ATUE_OFFSET(0x48)
362#define IOP13XX_ATUE_IALR1 IOP13XX_ATUE_OFFSET(0x4c)
363#define IOP13XX_ATUE_IATVR1 IOP13XX_ATUE_OFFSET(0x50)
364#define IOP13XX_ATUE_IAUTVR1 IOP13XX_ATUE_OFFSET(0x54)
365#define IOP13XX_ATUE_IALR2 IOP13XX_ATUE_OFFSET(0x58)
366#define IOP13XX_ATUE_IATVR2 IOP13XX_ATUE_OFFSET(0x5c)
367#define IOP13XX_ATUE_IAUTVR2 IOP13XX_ATUE_OFFSET(0x60)
368#define IOP13XX_ATUE_PE_LSTS IOP13XX_REG_ADDR16(\
369 iop13xx_atue_pmmr_offset + 0xe2)
370#define IOP13XX_ATUE_OIOWTVR IOP13XX_ATUE_OFFSET(0x304)
371#define IOP13XX_ATUE_OUMBAR0 IOP13XX_ATUE_OFFSET(0x308)
372#define IOP13XX_ATUE_OUMWTVR0 IOP13XX_ATUE_OFFSET(0x30c)
373#define IOP13XX_ATUE_OUMBAR1 IOP13XX_ATUE_OFFSET(0x310)
374#define IOP13XX_ATUE_OUMWTVR1 IOP13XX_ATUE_OFFSET(0x314)
375#define IOP13XX_ATUE_OUMBAR2 IOP13XX_ATUE_OFFSET(0x318)
376#define IOP13XX_ATUE_OUMWTVR2 IOP13XX_ATUE_OFFSET(0x31c)
377#define IOP13XX_ATUE_OUMBAR3 IOP13XX_ATUE_OFFSET(0x320)
378#define IOP13XX_ATUE_OUMWTVR3 IOP13XX_ATUE_OFFSET(0x324)
379
380#define IOP13XX_ATUE_ATUCR IOP13XX_ATUE_OFFSET(0x70)
381#define IOP13XX_ATUE_PCSR IOP13XX_ATUE_OFFSET(0x74)
382#define IOP13XX_ATUE_ATUISR IOP13XX_ATUE_OFFSET(0x78)
383#define IOP13XX_ATUE_OIOBAR IOP13XX_ATUE_OFFSET(0x300)
384#define IOP13XX_ATUE_OCCAR IOP13XX_ATUE_OFFSET(0x32c)
385#define IOP13XX_ATUE_OCCDR IOP13XX_ATUE_OFFSET(0x330)
386
387#define IOP13XX_ATUE_PIE_STS IOP13XX_ATUE_OFFSET(0x384)
388#define IOP13XX_ATUE_PIE_MSK IOP13XX_ATUE_OFFSET(0x388)
389
390#define IOP13XX_ATUE_ATUCR_IVM (1 << 6)
391#define IOP13XX_ATUE_ATUCR_OUT_EN (1 << 1)
392#define IOP13XX_ATUE_OCCAR_BUS_NUM (24)
393#define IOP13XX_ATUE_OCCAR_DEV_NUM (19)
394#define IOP13XX_ATUE_OCCAR_FUNC_NUM (16)
395#define IOP13XX_ATUE_OCCAR_EXT_REG (8)
396#define IOP13XX_ATUE_OCCAR_REG (2)
397
398#define IOP13XX_ATUE_PCSR_BUS_NUM (24)
399#define IOP13XX_ATUE_PCSR_DEV_NUM (19)
400#define IOP13XX_ATUE_PCSR_FUNC_NUM (16)
401#define IOP13XX_ATUE_PCSR_OUT_Q_BUSY (1 << 15)
402#define IOP13XX_ATUE_PCSR_IN_Q_BUSY (1 << 14)
403#define IOP13XX_ATUE_PCSR_END_POINT (1 << 13)
404#define IOP13XX_ATUE_PCSR_LLRB_BUSY (1 << 12)
405
406#define IOP13XX_ATUE_PCSR_BUS_NUM_MASK (0xff)
407#define IOP13XX_ATUE_PCSR_DEV_NUM_MASK (0x1f)
408#define IOP13XX_ATUE_PCSR_FUNC_NUM_MASK (0x7)
409
410#define IOP13XX_ATUE_PCSR_CORE_RESET (8)
411#define IOP13XX_ATUE_PCSR_FUNC_NUM (16)
412
413#define IOP13XX_ATUE_LSTS_TRAINING (1 << 11)
414#define IOP13XX_ATUE_STAT_SLOT_PWR_MSG (1 << 28)
415#define IOP13XX_ATUE_STAT_PME (1 << 27)
416#define IOP13XX_ATUE_STAT_HOT_PLUG_MSG (1 << 26)
417#define IOP13XX_ATUE_STAT_IVM (1 << 25)
418#define IOP13XX_ATUE_STAT_BIST (1 << 24)
419#define IOP13XX_ATUE_STAT_CFG_WRITE (1 << 18)
420#define IOP13XX_ATUE_STAT_VPD_ADDR (1 << 17)
421#define IOP13XX_ATUE_STAT_POWER_TRAN (1 << 16)
422#define IOP13XX_ATUE_STAT_HALT_ON_ERROR (1 << 13)
423#define IOP13XX_ATUE_STAT_ROOT_SYS_ERR (1 << 12)
424#define IOP13XX_ATUE_STAT_ROOT_ERR_MSG (1 << 11)
425#define IOP13XX_ATUE_STAT_PCI_IFACE_ERR (1 << 10)
426#define IOP13XX_ATUE_STAT_ERR_COR (1 << 9 )
427#define IOP13XX_ATUE_STAT_ERR_UNCOR (1 << 8 )
428#define IOP13XX_ATUE_STAT_CRS (1 << 7 )
429#define IOP13XX_ATUE_STAT_LNK_DWN (1 << 6 )
430#define IOP13XX_ATUE_STAT_INT_REC_MABORT (1 << 5 )
431#define IOP13XX_ATUE_STAT_DET_PAR_ERR (1 << 4 )
432#define IOP13XX_ATUE_STAT_EXT_REC_MABORT (1 << 3 )
433#define IOP13XX_ATUE_STAT_SIG_TABORT (1 << 2 )
434#define IOP13XX_ATUE_STAT_EXT_REC_TABORT (1 << 1 )
435#define IOP13XX_ATUE_STAT_MASTER_DATA_PAR (1 << 0 )
436
437#define IOP13XX_ATUE_ESTAT_REC_UNSUPPORTED_COMP_REQ (1 << 31)
438#define IOP13XX_ATUE_ESTAT_REC_COMPLETER_ABORT (1 << 30)
439#define IOP13XX_ATUE_ESTAT_TX_POISONED_TLP (1 << 29)
440#define IOP13XX_ATUE_ESTAT_TX_PAR_ERR (1 << 28)
441#define IOP13XX_ATUE_ESTAT_REC_UNSUPPORTED_REQ (1 << 20)
442#define IOP13XX_ATUE_ESTAT_REC_ECRC_ERR (1 << 19)
443#define IOP13XX_ATUE_ESTAT_REC_MALFORMED_TLP (1 << 18)
444#define IOP13XX_ATUE_ESTAT_TX_RECEIVER_OVERFLOW (1 << 17)
445#define IOP13XX_ATUE_ESTAT_REC_UNEXPECTED_COMP (1 << 16)
446#define IOP13XX_ATUE_ESTAT_INT_COMP_ABORT (1 << 15)
447#define IOP13XX_ATUE_ESTAT_COMP_TIMEOUT (1 << 14)
448#define IOP13XX_ATUE_ESTAT_FLOW_CONTROL_ERR (1 << 13)
449#define IOP13XX_ATUE_ESTAT_REC_POISONED_TLP (1 << 12)
450#define IOP13XX_ATUE_ESTAT_DATA_LNK_ERR (1 << 4 )
451#define IOP13XX_ATUE_ESTAT_TRAINING_ERR (1 << 0 )
452
453#define IOP13XX_ATUE_IALR_DISABLE (0x00000001)
454#define IOP13XX_ATUE_OUMBAR_ENABLE (0x80000000)
455#define IOP13XX_ATU_OUMBAR_FUNC_NUM (28)
456#define IOP13XX_ATU_OUMBAR_FUNC_NUM_MASK (0x7)
457/*=======================================================================*/
458
459/*============================MESSAGING UNIT=============================*/
460#define IOP13XX_MU_OFFSET(ofs) IOP13XX_REG_ADDR32(IOP13XX_MU_PMMR_OFFSET +\
461 (ofs))
462
463#define IOP13XX_MU_IMR0 IOP13XX_MU_OFFSET(0x10)
464#define IOP13XX_MU_IMR1 IOP13XX_MU_OFFSET(0x14)
465#define IOP13XX_MU_OMR0 IOP13XX_MU_OFFSET(0x18)
466#define IOP13XX_MU_OMR1 IOP13XX_MU_OFFSET(0x1C)
467#define IOP13XX_MU_IDR IOP13XX_MU_OFFSET(0x20)
468#define IOP13XX_MU_IISR IOP13XX_MU_OFFSET(0x24)
469#define IOP13XX_MU_IIMR IOP13XX_MU_OFFSET(0x28)
470#define IOP13XX_MU_ODR IOP13XX_MU_OFFSET(0x2C)
471#define IOP13XX_MU_OISR IOP13XX_MU_OFFSET(0x30)
472#define IOP13XX_MU_OIMR IOP13XX_MU_OFFSET(0x34)
473#define IOP13XX_MU_IRCSR IOP13XX_MU_OFFSET(0x38)
474#define IOP13XX_MU_ORCSR IOP13XX_MU_OFFSET(0x3C)
475#define IOP13XX_MU_MIMR IOP13XX_MU_OFFSET(0x48)
476#define IOP13XX_MU_MUCR IOP13XX_MU_OFFSET(0x50)
477#define IOP13XX_MU_QBAR IOP13XX_MU_OFFSET(0x54)
478#define IOP13XX_MU_MUBAR IOP13XX_MU_OFFSET(0x84)
479
480#define IOP13XX_MU_WINDOW_SIZE (8 * 1024)
481#define IOP13XX_MU_BASE_PHYS (0xff000000)
482#define IOP13XX_MU_BASE_PCI (0xff000000)
483#define IOP13XX_MU_MIMR_PCI (IOP13XX_MU_BASE_PCI + 0x48)
484#define IOP13XX_MU_MIMR_CORE_SELECT (15)
485/*=======================================================================*/
486
487/*==============================ADMA UNITS===============================*/
488#define IOP13XX_ADMA_PHYS_BASE(chan) IOP13XX_REG_ADDR32_PHYS((chan << 9))
489#define IOP13XX_ADMA_UPPER_PA(chan) (IOP13XX_ADMA_PHYS_BASE(chan) + 0xc0)
490
491/*==============================XSI BRIDGE===============================*/
492#define IOP13XX_XBG_BECSR IOP13XX_REG_ADDR32(0x178c)
493#define IOP13XX_XBG_BERAR IOP13XX_REG_ADDR32(0x1790)
494#define IOP13XX_XBG_BERUAR IOP13XX_REG_ADDR32(0x1794)
495#define is_atue_occdr_error(x) ((__raw_readl(IOP13XX_XBG_BERAR) == \
496 IOP13XX_PMMR_VIRT_TO_PHYS(\
497 IOP13XX_ATUE_OCCDR))\
498 && (__raw_readl(IOP13XX_XBG_BECSR) & 1))
499#define is_atux_occdr_error(x) ((__raw_readl(IOP13XX_XBG_BERAR) == \
500 IOP13XX_PMMR_VIRT_TO_PHYS(\
501 IOP13XX_ATUX_OCCDR))\
502 && (__raw_readl(IOP13XX_XBG_BECSR) & 1))
503/*=======================================================================*/
504
505#define IOP13XX_PBI_OFFSET(ofs) IOP13XX_REG_ADDR32(IOP13XX_PBI_PMMR_OFFSET +\
506 (ofs))
507
508#define IOP13XX_PBI_CR IOP13XX_PBI_OFFSET(0x0)
509#define IOP13XX_PBI_SR IOP13XX_PBI_OFFSET(0x4)
510#define IOP13XX_PBI_BAR0 IOP13XX_PBI_OFFSET(0x8)
511#define IOP13XX_PBI_LR0 IOP13XX_PBI_OFFSET(0xc)
512#define IOP13XX_PBI_BAR1 IOP13XX_PBI_OFFSET(0x10)
513#define IOP13XX_PBI_LR1 IOP13XX_PBI_OFFSET(0x14)
514
515#define IOP13XX_PROCESSOR_FREQ IOP13XX_REG_ADDR32(0x2180)
516
517/* Watchdog timer definitions */
518#define IOP_WDTCR_EN_ARM 0x1e1e1e1e
519#define IOP_WDTCR_EN 0xe1e1e1e1
520#define IOP_WDTCR_DIS_ARM 0x1f1f1f1f
521#define IOP_WDTCR_DIS 0xf1f1f1f1
522#define IOP_RCSR_WDT (1 << 5) /* reset caused by watchdog timer */
523#define IOP13XX_WDTSR_WRITE_EN (1 << 31) /* used to speed up reset requests */
524#define IOP13XX_WDTCR_IB_RESET (1 << 0)
525
526#endif /* _IOP13XX_HW_H_ */
diff --git a/arch/arm/mach-iop13xx/include/mach/iq81340.h b/arch/arm/mach-iop13xx/include/mach/iq81340.h
new file mode 100644
index 000000000000..ba2cf931e9ce
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/iq81340.h
@@ -0,0 +1,28 @@
1#ifndef _IQ81340_H_
2#define _IQ81340_H_
3
4#define IQ81340_PCE_BAR0 IOP13XX_PBI_LOWER_MEM_RA
5#define IQ81340_PCE_BAR1 (IQ81340_PCE_BAR0 + 0x02000000)
6
7#define IQ81340_FLASHBASE IQ81340_PCE_BAR0 /* Flash */
8
9#define IQ81340_PCE_BAR1_OFFSET(a) (IQ81340_PCE_BAR1 + (a))
10
11#define IQ81340_PRD_CODE IQ81340_PCE_BAR1_OFFSET(0)
12#define IQ81340_BRD_STEP IQ81340_PCE_BAR1_OFFSET(0x10000)
13#define IQ81340_CPLD_REV IQ81340_PCE_BAR1_OFFSET(0x20000)
14#define IQ81340_LED IQ81340_PCE_BAR1_OFFSET(0x30000)
15#define IQ81340_LHEX IQ81340_PCE_BAR1_OFFSET(0x40000)
16#define IQ81340_RHEX IQ81340_PCE_BAR1_OFFSET(0x50000)
17#define IQ81340_BUZZER IQ81340_PCE_BAR1_OFFSET(0x60000)
18#define IQ81340_32K_NVRAM IQ81340_PCE_BAR1_OFFSET(0x70000)
19#define IQ81340_256K_NVRAM IQ81340_PCE_BAR1_OFFSET(0x80000)
20#define IQ81340_ROTARY_SW IQ81340_PCE_BAR1_OFFSET(0xd0000)
21#define IQ81340_BATT_STAT IQ81340_PCE_BAR1_OFFSET(0xf0000)
22#define IQ81340_CMP_FLSH IQ81340_PCE_BAR1_OFFSET(0x1000000) /* 16MB */
23
24#define PBI_CF_IDE_BASE (IQ81340_CMP_FLSH)
25#define PBI_CF_BAR_ADDR (IOP13XX_PBI_BAR1)
26
27
28#endif /* _IQ81340_H_ */
diff --git a/arch/arm/mach-iop13xx/include/mach/irqs.h b/arch/arm/mach-iop13xx/include/mach/irqs.h
new file mode 100644
index 000000000000..054e7acb5bfa
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/irqs.h
@@ -0,0 +1,196 @@
1#ifndef _IOP13XX_IRQS_H_
2#define _IOP13XX_IRQS_H_
3
4#ifndef __ASSEMBLER__
5#include <linux/types.h>
6
7/* INTPND0 CP6 R0 Page 3
8 */
9static inline u32 read_intpnd_0(void)
10{
11 u32 val;
12 asm volatile("mrc p6, 0, %0, c0, c3, 0":"=r" (val));
13 return val;
14}
15
16/* INTPND1 CP6 R1 Page 3
17 */
18static inline u32 read_intpnd_1(void)
19{
20 u32 val;
21 asm volatile("mrc p6, 0, %0, c1, c3, 0":"=r" (val));
22 return val;
23}
24
25/* INTPND2 CP6 R2 Page 3
26 */
27static inline u32 read_intpnd_2(void)
28{
29 u32 val;
30 asm volatile("mrc p6, 0, %0, c2, c3, 0":"=r" (val));
31 return val;
32}
33
34/* INTPND3 CP6 R3 Page 3
35 */
36static inline u32 read_intpnd_3(void)
37{
38 u32 val;
39 asm volatile("mrc p6, 0, %0, c3, c3, 0":"=r" (val));
40 return val;
41}
42#endif
43
44#define INTBASE 0
45#define INTSIZE_4 1
46
47/*
48 * iop34x chipset interrupts
49 */
50#define IOP13XX_IRQ(x) (IOP13XX_IRQ_OFS + (x))
51
52/*
53 * On IRQ or FIQ register
54 */
55#define IRQ_IOP13XX_ADMA0_EOT (0)
56#define IRQ_IOP13XX_ADMA0_EOC (1)
57#define IRQ_IOP13XX_ADMA1_EOT (2)
58#define IRQ_IOP13XX_ADMA1_EOC (3)
59#define IRQ_IOP13XX_ADMA2_EOT (4)
60#define IRQ_IOP13XX_ADMA2_EOC (5)
61#define IRQ_IOP134_WATCHDOG (6)
62#define IRQ_IOP13XX_RSVD_7 (7)
63#define IRQ_IOP13XX_TIMER0 (8)
64#define IRQ_IOP13XX_TIMER1 (9)
65#define IRQ_IOP13XX_I2C_0 (10)
66#define IRQ_IOP13XX_I2C_1 (11)
67#define IRQ_IOP13XX_MSG (12)
68#define IRQ_IOP13XX_MSGIBQ (13)
69#define IRQ_IOP13XX_ATU_IM (14)
70#define IRQ_IOP13XX_ATU_BIST (15)
71#define IRQ_IOP13XX_PPMU (16)
72#define IRQ_IOP13XX_COREPMU (17)
73#define IRQ_IOP13XX_CORECACHE (18)
74#define IRQ_IOP13XX_RSVD_19 (19)
75#define IRQ_IOP13XX_RSVD_20 (20)
76#define IRQ_IOP13XX_RSVD_21 (21)
77#define IRQ_IOP13XX_RSVD_22 (22)
78#define IRQ_IOP13XX_RSVD_23 (23)
79#define IRQ_IOP13XX_XINT0 (24)
80#define IRQ_IOP13XX_XINT1 (25)
81#define IRQ_IOP13XX_XINT2 (26)
82#define IRQ_IOP13XX_XINT3 (27)
83#define IRQ_IOP13XX_XINT4 (28)
84#define IRQ_IOP13XX_XINT5 (29)
85#define IRQ_IOP13XX_XINT6 (30)
86#define IRQ_IOP13XX_XINT7 (31)
87 /* IINTSRC1 bit */
88#define IRQ_IOP13XX_XINT8 (32) /* 0 */
89#define IRQ_IOP13XX_XINT9 (33) /* 1 */
90#define IRQ_IOP13XX_XINT10 (34) /* 2 */
91#define IRQ_IOP13XX_XINT11 (35) /* 3 */
92#define IRQ_IOP13XX_XINT12 (36) /* 4 */
93#define IRQ_IOP13XX_XINT13 (37) /* 5 */
94#define IRQ_IOP13XX_XINT14 (38) /* 6 */
95#define IRQ_IOP13XX_XINT15 (39) /* 7 */
96#define IRQ_IOP13XX_RSVD_40 (40) /* 8 */
97#define IRQ_IOP13XX_RSVD_41 (41) /* 9 */
98#define IRQ_IOP13XX_RSVD_42 (42) /* 10 */
99#define IRQ_IOP13XX_RSVD_43 (43) /* 11 */
100#define IRQ_IOP13XX_RSVD_44 (44) /* 12 */
101#define IRQ_IOP13XX_RSVD_45 (45) /* 13 */
102#define IRQ_IOP13XX_RSVD_46 (46) /* 14 */
103#define IRQ_IOP13XX_RSVD_47 (47) /* 15 */
104#define IRQ_IOP13XX_RSVD_48 (48) /* 16 */
105#define IRQ_IOP13XX_RSVD_49 (49) /* 17 */
106#define IRQ_IOP13XX_RSVD_50 (50) /* 18 */
107#define IRQ_IOP13XX_UART0 (51) /* 19 */
108#define IRQ_IOP13XX_UART1 (52) /* 20 */
109#define IRQ_IOP13XX_PBIE (53) /* 21 */
110#define IRQ_IOP13XX_ATU_CRW (54) /* 22 */
111#define IRQ_IOP13XX_ATU_ERR (55) /* 23 */
112#define IRQ_IOP13XX_MCU_ERR (56) /* 24 */
113#define IRQ_IOP13XX_ADMA0_ERR (57) /* 25 */
114#define IRQ_IOP13XX_ADMA1_ERR (58) /* 26 */
115#define IRQ_IOP13XX_ADMA2_ERR (59) /* 27 */
116#define IRQ_IOP13XX_RSVD_60 (60) /* 28 */
117#define IRQ_IOP13XX_RSVD_61 (61) /* 29 */
118#define IRQ_IOP13XX_MSG_ERR (62) /* 30 */
119#define IRQ_IOP13XX_RSVD_63 (63) /* 31 */
120 /* IINTSRC2 bit */
121#define IRQ_IOP13XX_INTERPROC (64) /* 0 */
122#define IRQ_IOP13XX_RSVD_65 (65) /* 1 */
123#define IRQ_IOP13XX_RSVD_66 (66) /* 2 */
124#define IRQ_IOP13XX_RSVD_67 (67) /* 3 */
125#define IRQ_IOP13XX_RSVD_68 (68) /* 4 */
126#define IRQ_IOP13XX_RSVD_69 (69) /* 5 */
127#define IRQ_IOP13XX_RSVD_70 (70) /* 6 */
128#define IRQ_IOP13XX_RSVD_71 (71) /* 7 */
129#define IRQ_IOP13XX_RSVD_72 (72) /* 8 */
130#define IRQ_IOP13XX_RSVD_73 (73) /* 9 */
131#define IRQ_IOP13XX_RSVD_74 (74) /* 10 */
132#define IRQ_IOP13XX_RSVD_75 (75) /* 11 */
133#define IRQ_IOP13XX_RSVD_76 (76) /* 12 */
134#define IRQ_IOP13XX_RSVD_77 (77) /* 13 */
135#define IRQ_IOP13XX_RSVD_78 (78) /* 14 */
136#define IRQ_IOP13XX_RSVD_79 (79) /* 15 */
137#define IRQ_IOP13XX_RSVD_80 (80) /* 16 */
138#define IRQ_IOP13XX_RSVD_81 (81) /* 17 */
139#define IRQ_IOP13XX_RSVD_82 (82) /* 18 */
140#define IRQ_IOP13XX_RSVD_83 (83) /* 19 */
141#define IRQ_IOP13XX_RSVD_84 (84) /* 20 */
142#define IRQ_IOP13XX_RSVD_85 (85) /* 21 */
143#define IRQ_IOP13XX_RSVD_86 (86) /* 22 */
144#define IRQ_IOP13XX_RSVD_87 (87) /* 23 */
145#define IRQ_IOP13XX_RSVD_88 (88) /* 24 */
146#define IRQ_IOP13XX_RSVD_89 (89) /* 25 */
147#define IRQ_IOP13XX_RSVD_90 (90) /* 26 */
148#define IRQ_IOP13XX_RSVD_91 (91) /* 27 */
149#define IRQ_IOP13XX_RSVD_92 (92) /* 28 */
150#define IRQ_IOP13XX_RSVD_93 (93) /* 29 */
151#define IRQ_IOP13XX_SIB_ERR (94) /* 30 */
152#define IRQ_IOP13XX_SRAM_ERR (95) /* 31 */
153 /* IINTSRC3 bit */
154#define IRQ_IOP13XX_I2C_2 (96) /* 0 */
155#define IRQ_IOP13XX_ATUE_BIST (97) /* 1 */
156#define IRQ_IOP13XX_ATUE_CRW (98) /* 2 */
157#define IRQ_IOP13XX_ATUE_ERR (99) /* 3 */
158#define IRQ_IOP13XX_IMU (100) /* 4 */
159#define IRQ_IOP13XX_RSVD_101 (101) /* 5 */
160#define IRQ_IOP13XX_RSVD_102 (102) /* 6 */
161#define IRQ_IOP13XX_TPMI0_OUT (103) /* 7 */
162#define IRQ_IOP13XX_TPMI1_OUT (104) /* 8 */
163#define IRQ_IOP13XX_TPMI2_OUT (105) /* 9 */
164#define IRQ_IOP13XX_TPMI3_OUT (106) /* 10 */
165#define IRQ_IOP13XX_ATUE_IMA (107) /* 11 */
166#define IRQ_IOP13XX_ATUE_IMB (108) /* 12 */
167#define IRQ_IOP13XX_ATUE_IMC (109) /* 13 */
168#define IRQ_IOP13XX_ATUE_IMD (110) /* 14 */
169#define IRQ_IOP13XX_MU_MSI_TB (111) /* 15 */
170#define IRQ_IOP13XX_RSVD_112 (112) /* 16 */
171#define IRQ_IOP13XX_INBD_MSI (113) /* 17 */
172#define IRQ_IOP13XX_RSVD_114 (114) /* 18 */
173#define IRQ_IOP13XX_RSVD_115 (115) /* 19 */
174#define IRQ_IOP13XX_RSVD_116 (116) /* 20 */
175#define IRQ_IOP13XX_RSVD_117 (117) /* 21 */
176#define IRQ_IOP13XX_RSVD_118 (118) /* 22 */
177#define IRQ_IOP13XX_RSVD_119 (119) /* 23 */
178#define IRQ_IOP13XX_RSVD_120 (120) /* 24 */
179#define IRQ_IOP13XX_RSVD_121 (121) /* 25 */
180#define IRQ_IOP13XX_RSVD_122 (122) /* 26 */
181#define IRQ_IOP13XX_RSVD_123 (123) /* 27 */
182#define IRQ_IOP13XX_RSVD_124 (124) /* 28 */
183#define IRQ_IOP13XX_RSVD_125 (125) /* 29 */
184#define IRQ_IOP13XX_RSVD_126 (126) /* 30 */
185#define IRQ_IOP13XX_HPI (127) /* 31 */
186
187#ifdef CONFIG_PCI_MSI
188#define IRQ_IOP13XX_MSI_0 (IRQ_IOP13XX_HPI + 1)
189#define NR_IOP13XX_IRQS (IRQ_IOP13XX_MSI_0 + 128)
190#else
191#define NR_IOP13XX_IRQS (IRQ_IOP13XX_HPI + 1)
192#endif
193
194#define NR_IRQS NR_IOP13XX_IRQS
195
196#endif /* _IOP13XX_IRQ_H_ */
diff --git a/arch/arm/mach-iop13xx/include/mach/memory.h b/arch/arm/mach-iop13xx/include/mach/memory.h
new file mode 100644
index 000000000000..e8b59d8f1bb9
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/memory.h
@@ -0,0 +1,64 @@
1#ifndef __ASM_ARCH_MEMORY_H
2#define __ASM_ARCH_MEMORY_H
3
4#include <mach/hardware.h>
5
6/*
7 * Physical DRAM offset.
8 */
9#define PHYS_OFFSET UL(0x00000000)
10#define TASK_SIZE UL(0x3f000000)
11#define PAGE_OFFSET UL(0x40000000)
12#define TASK_UNMAPPED_BASE ((TASK_SIZE + 0x01000000) / 3)
13
14#ifndef __ASSEMBLY__
15
16#if defined(CONFIG_ARCH_IOP13XX)
17#define IOP13XX_PMMR_V_START (IOP13XX_PMMR_VIRT_MEM_BASE)
18#define IOP13XX_PMMR_V_END (IOP13XX_PMMR_VIRT_MEM_BASE + IOP13XX_PMMR_SIZE)
19#define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE)
20#define IOP13XX_PMMR_P_END (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE)
21
22/*
23 * Virtual view <-> PCI DMA view memory address translations
24 * virt_to_bus: Used to translate the virtual address to an
25 * address suitable to be passed to set_dma_addr
26 * bus_to_virt: Used to convert an address for DMA operations
27 * to an address that the kernel can use.
28 */
29
30/* RAM has 1:1 mapping on the PCIe/x Busses */
31#define __virt_to_bus(x) (__virt_to_phys(x))
32#define __bus_to_virt(x) (__phys_to_virt(x))
33
34#define virt_to_lbus(x) \
35(( ((void*)(x) >= (void*)IOP13XX_PMMR_V_START) && \
36((void*)(x) < (void*)IOP13XX_PMMR_V_END) ) ? \
37((x) - IOP13XX_PMMR_VIRT_MEM_BASE + IOP13XX_PMMR_PHYS_MEM_BASE) : \
38((x) - PAGE_OFFSET + PHYS_OFFSET))
39
40#define lbus_to_virt(x) \
41(( ((x) >= IOP13XX_PMMR_P_START) && ((x) < IOP13XX_PMMR_P_END) ) ? \
42((x) - IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_VIRT_MEM_BASE ) : \
43((x) - PHYS_OFFSET + PAGE_OFFSET))
44
45/* Device is an lbus device if it is on the platform bus of the IOP13XX */
46#define is_lbus_device(dev) (dev &&\
47 (strncmp(dev->bus->name, "platform", 8) == 0))
48
49#define __arch_page_to_dma(dev, page) \
50({is_lbus_device(dev) ? (dma_addr_t)virt_to_lbus(page_address(page)) : \
51(dma_addr_t)__virt_to_bus(page_address(page));})
52
53#define __arch_dma_to_virt(dev, addr) \
54({is_lbus_device(dev) ? lbus_to_virt(addr) : __bus_to_virt(addr);})
55
56#define __arch_virt_to_dma(dev, addr) \
57({is_lbus_device(dev) ? virt_to_lbus(addr) : __virt_to_bus(addr);})
58
59#endif /* CONFIG_ARCH_IOP13XX */
60#endif /* !ASSEMBLY */
61
62#define PFN_TO_NID(addr) (0)
63
64#endif
diff --git a/arch/arm/mach-iop13xx/include/mach/msi.h b/arch/arm/mach-iop13xx/include/mach/msi.h
new file mode 100644
index 000000000000..b80c5ae17e99
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/msi.h
@@ -0,0 +1,11 @@
1#ifndef _IOP13XX_MSI_H_
2#define _IOP13XX_MSI_H_
3#ifdef CONFIG_PCI_MSI
4void iop13xx_msi_init(void);
5#else
6static inline void iop13xx_msi_init(void)
7{
8 return;
9}
10#endif
11#endif
diff --git a/arch/arm/mach-iop13xx/include/mach/pci.h b/arch/arm/mach-iop13xx/include/mach/pci.h
new file mode 100644
index 000000000000..17b5515af8b1
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/pci.h
@@ -0,0 +1,57 @@
1#ifndef _IOP13XX_PCI_H_
2#define _IOP13XX_PCI_H_
3#include <mach/irqs.h>
4#include <asm/io.h>
5
6struct pci_sys_data;
7struct hw_pci;
8int iop13xx_pci_setup(int nr, struct pci_sys_data *sys);
9struct pci_bus *iop13xx_scan_bus(int nr, struct pci_sys_data *);
10void iop13xx_atu_select(struct hw_pci *plat_pci);
11void iop13xx_pci_init(void);
12void iop13xx_map_pci_memory(void);
13
14#define IOP_PCI_STATUS_ERROR (PCI_STATUS_PARITY | \
15 PCI_STATUS_SIG_TARGET_ABORT | \
16 PCI_STATUS_REC_TARGET_ABORT | \
17 PCI_STATUS_REC_TARGET_ABORT | \
18 PCI_STATUS_REC_MASTER_ABORT | \
19 PCI_STATUS_SIG_SYSTEM_ERROR | \
20 PCI_STATUS_DETECTED_PARITY)
21
22#define IOP13XX_ATUE_ATUISR_ERROR (IOP13XX_ATUE_STAT_HALT_ON_ERROR | \
23 IOP13XX_ATUE_STAT_ROOT_SYS_ERR | \
24 IOP13XX_ATUE_STAT_PCI_IFACE_ERR | \
25 IOP13XX_ATUE_STAT_ERR_COR | \
26 IOP13XX_ATUE_STAT_ERR_UNCOR | \
27 IOP13XX_ATUE_STAT_CRS | \
28 IOP13XX_ATUE_STAT_DET_PAR_ERR | \
29 IOP13XX_ATUE_STAT_EXT_REC_MABORT | \
30 IOP13XX_ATUE_STAT_SIG_TABORT | \
31 IOP13XX_ATUE_STAT_EXT_REC_TABORT | \
32 IOP13XX_ATUE_STAT_MASTER_DATA_PAR)
33
34#define IOP13XX_ATUX_ATUISR_ERROR (IOP13XX_ATUX_STAT_TX_SCEM | \
35 IOP13XX_ATUX_STAT_REC_SCEM | \
36 IOP13XX_ATUX_STAT_TX_SERR | \
37 IOP13XX_ATUX_STAT_DET_PAR_ERR | \
38 IOP13XX_ATUX_STAT_INT_REC_MABORT | \
39 IOP13XX_ATUX_STAT_REC_SERR | \
40 IOP13XX_ATUX_STAT_EXT_REC_MABORT | \
41 IOP13XX_ATUX_STAT_EXT_REC_TABORT | \
42 IOP13XX_ATUX_STAT_EXT_SIG_TABORT | \
43 IOP13XX_ATUX_STAT_MASTER_DATA_PAR)
44
45/* PCI interrupts
46 */
47#define ATUX_INTA IRQ_IOP13XX_XINT0
48#define ATUX_INTB IRQ_IOP13XX_XINT1
49#define ATUX_INTC IRQ_IOP13XX_XINT2
50#define ATUX_INTD IRQ_IOP13XX_XINT3
51
52#define ATUE_INTA IRQ_IOP13XX_ATUE_IMA
53#define ATUE_INTB IRQ_IOP13XX_ATUE_IMB
54#define ATUE_INTC IRQ_IOP13XX_ATUE_IMC
55#define ATUE_INTD IRQ_IOP13XX_ATUE_IMD
56
57#endif /* _IOP13XX_PCI_H_ */
diff --git a/arch/arm/mach-iop13xx/include/mach/system.h b/arch/arm/mach-iop13xx/include/mach/system.h
new file mode 100644
index 000000000000..c7127f416e1f
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/system.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-iop13xx/include/mach/system.h
3 *
4 * Copyright (C) 2004 Intel Corp.
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#include <mach/iop13xx.h>
11static inline void arch_idle(void)
12{
13 cpu_do_idle();
14}
15
16static inline void arch_reset(char mode)
17{
18 /*
19 * Reset the internal bus (warning both cores are reset)
20 */
21 write_wdtcr(IOP_WDTCR_EN_ARM);
22 write_wdtcr(IOP_WDTCR_EN);
23 write_wdtsr(IOP13XX_WDTSR_WRITE_EN | IOP13XX_WDTCR_IB_RESET);
24 write_wdtcr(0x1000);
25
26 for(;;);
27}
diff --git a/arch/arm/mach-iop13xx/include/mach/time.h b/arch/arm/mach-iop13xx/include/mach/time.h
new file mode 100644
index 000000000000..49213d9d7cad
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/time.h
@@ -0,0 +1,107 @@
1#ifndef _IOP13XX_TIME_H_
2#define _IOP13XX_TIME_H_
3#define IRQ_IOP_TIMER0 IRQ_IOP13XX_TIMER0
4
5#define IOP_TMR_EN 0x02
6#define IOP_TMR_RELOAD 0x04
7#define IOP_TMR_PRIVILEGED 0x08
8#define IOP_TMR_RATIO_1_1 0x00
9
10#define IOP13XX_XSI_FREQ_RATIO_MASK (3 << 19)
11#define IOP13XX_XSI_FREQ_RATIO_2 (0 << 19)
12#define IOP13XX_XSI_FREQ_RATIO_3 (1 << 19)
13#define IOP13XX_XSI_FREQ_RATIO_4 (2 << 19)
14#define IOP13XX_CORE_FREQ_MASK (7 << 16)
15#define IOP13XX_CORE_FREQ_600 (0 << 16)
16#define IOP13XX_CORE_FREQ_667 (1 << 16)
17#define IOP13XX_CORE_FREQ_800 (2 << 16)
18#define IOP13XX_CORE_FREQ_933 (3 << 16)
19#define IOP13XX_CORE_FREQ_1000 (4 << 16)
20#define IOP13XX_CORE_FREQ_1200 (5 << 16)
21
22void iop_init_time(unsigned long tickrate);
23unsigned long iop_gettimeoffset(void);
24
25static inline unsigned long iop13xx_core_freq(void)
26{
27 unsigned long freq = __raw_readl(IOP13XX_PROCESSOR_FREQ);
28 freq &= IOP13XX_CORE_FREQ_MASK;
29 switch (freq) {
30 case IOP13XX_CORE_FREQ_600:
31 return 600000000;
32 case IOP13XX_CORE_FREQ_667:
33 return 667000000;
34 case IOP13XX_CORE_FREQ_800:
35 return 800000000;
36 case IOP13XX_CORE_FREQ_933:
37 return 933000000;
38 case IOP13XX_CORE_FREQ_1000:
39 return 1000000000;
40 case IOP13XX_CORE_FREQ_1200:
41 return 1200000000;
42 default:
43 printk("%s: warning unknown frequency, defaulting to 800Mhz\n",
44 __FUNCTION__);
45 }
46
47 return 800000000;
48}
49
50static inline unsigned long iop13xx_xsi_bus_ratio(void)
51{
52 unsigned long ratio = __raw_readl(IOP13XX_PROCESSOR_FREQ);
53 ratio &= IOP13XX_XSI_FREQ_RATIO_MASK;
54 switch (ratio) {
55 case IOP13XX_XSI_FREQ_RATIO_2:
56 return 2;
57 case IOP13XX_XSI_FREQ_RATIO_3:
58 return 3;
59 case IOP13XX_XSI_FREQ_RATIO_4:
60 return 4;
61 default:
62 printk("%s: warning unknown ratio, defaulting to 2\n",
63 __FUNCTION__);
64 }
65
66 return 2;
67}
68
69static inline void write_tmr0(u32 val)
70{
71 asm volatile("mcr p6, 0, %0, c0, c9, 0" : : "r" (val));
72}
73
74static inline void write_tmr1(u32 val)
75{
76 asm volatile("mcr p6, 0, %0, c1, c9, 0" : : "r" (val));
77}
78
79static inline u32 read_tcr0(void)
80{
81 u32 val;
82 asm volatile("mrc p6, 0, %0, c2, c9, 0" : "=r" (val));
83 return val;
84}
85
86static inline u32 read_tcr1(void)
87{
88 u32 val;
89 asm volatile("mrc p6, 0, %0, c3, c9, 0" : "=r" (val));
90 return val;
91}
92
93static inline void write_trr0(u32 val)
94{
95 asm volatile("mcr p6, 0, %0, c4, c9, 0" : : "r" (val));
96}
97
98static inline void write_trr1(u32 val)
99{
100 asm volatile("mcr p6, 0, %0, c5, c9, 0" : : "r" (val));
101}
102
103static inline void write_tisr(u32 val)
104{
105 asm volatile("mcr p6, 0, %0, c6, c9, 0" : : "r" (val));
106}
107#endif
diff --git a/arch/arm/mach-iop13xx/include/mach/timex.h b/arch/arm/mach-iop13xx/include/mach/timex.h
new file mode 100644
index 000000000000..5b1f1c8a8270
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/timex.h
@@ -0,0 +1,3 @@
1#include <mach/hardware.h>
2
3#define CLOCK_TICK_RATE (100 * HZ)
diff --git a/arch/arm/mach-iop13xx/include/mach/uncompress.h b/arch/arm/mach-iop13xx/include/mach/uncompress.h
new file mode 100644
index 000000000000..fa4f80522fad
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/uncompress.h
@@ -0,0 +1,23 @@
1#include <asm/types.h>
2#include <linux/serial_reg.h>
3#include <mach/hardware.h>
4
5#define UART_BASE ((volatile u32 *)IOP13XX_UART1_PHYS)
6#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
7
8static inline void putc(char c)
9{
10 while ((UART_BASE[UART_LSR] & TX_DONE) != TX_DONE)
11 barrier();
12 UART_BASE[UART_TX] = c;
13}
14
15static inline void flush(void)
16{
17}
18
19/*
20 * nothing to do
21 */
22#define arch_decomp_setup()
23#define arch_decomp_wdog()
diff --git a/arch/arm/mach-iop13xx/include/mach/vmalloc.h b/arch/arm/mach-iop13xx/include/mach/vmalloc.h
new file mode 100644
index 000000000000..c53456740345
--- /dev/null
+++ b/arch/arm/mach-iop13xx/include/mach/vmalloc.h
@@ -0,0 +1,4 @@
1#ifndef _VMALLOC_H_
2#define _VMALLOC_H_
3#define VMALLOC_END 0xfa000000UL
4#endif
diff --git a/arch/arm/mach-iop13xx/io.c b/arch/arm/mach-iop13xx/io.c
index 5b22fdeca52c..26cfa318142c 100644
--- a/arch/arm/mach-iop13xx/io.c
+++ b/arch/arm/mach-iop13xx/io.c
@@ -18,7 +18,7 @@
18 */ 18 */
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24void * __iomem __iop13xx_io(unsigned long io_addr) 24void * __iomem __iop13xx_io(unsigned long io_addr)
diff --git a/arch/arm/mach-iop13xx/iq81340mc.c b/arch/arm/mach-iop13xx/iq81340mc.c
index 77b24cd1d88d..5051c03d437c 100644
--- a/arch/arm/mach-iop13xx/iq81340mc.c
+++ b/arch/arm/mach-iop13xx/iq81340mc.c
@@ -18,14 +18,14 @@
18 */ 18 */
19#include <linux/pci.h> 19#include <linux/pci.h>
20 20
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/mach/pci.h> 23#include <asm/mach/pci.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/arch/pci.h> 26#include <mach/pci.h>
27#include <asm/mach/time.h> 27#include <asm/mach/time.h>
28#include <asm/arch/time.h> 28#include <mach/time.h>
29 29
30extern int init_atu; /* Flag to select which ATU(s) to initialize / disable */ 30extern int init_atu; /* Flag to select which ATU(s) to initialize / disable */
31 31
diff --git a/arch/arm/mach-iop13xx/iq81340sc.c b/arch/arm/mach-iop13xx/iq81340sc.c
index e8522b3b8163..bc443073a8e3 100644
--- a/arch/arm/mach-iop13xx/iq81340sc.c
+++ b/arch/arm/mach-iop13xx/iq81340sc.c
@@ -18,14 +18,14 @@
18 */ 18 */
19#include <linux/pci.h> 19#include <linux/pci.h>
20 20
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/mach/pci.h> 23#include <asm/mach/pci.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/arch/pci.h> 26#include <mach/pci.h>
27#include <asm/mach/time.h> 27#include <asm/mach/time.h>
28#include <asm/arch/time.h> 28#include <mach/time.h>
29 29
30extern int init_atu; 30extern int init_atu;
31 31
diff --git a/arch/arm/mach-iop13xx/irq.c b/arch/arm/mach-iop13xx/irq.c
index 69f07b25b3c9..0d099ca87bdf 100644
--- a/arch/arm/mach-iop13xx/irq.c
+++ b/arch/arm/mach-iop13xx/irq.c
@@ -23,10 +23,9 @@
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
24#include <asm/mach/irq.h> 24#include <asm/mach/irq.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/mach-types.h> 27#include <mach/irqs.h>
28#include <asm/arch/irqs.h> 28#include <mach/msi.h>
29#include <asm/arch/msi.h>
30 29
31/* INTCTL0 CP6 R0 Page 4 30/* INTCTL0 CP6 R0 Page 4
32 */ 31 */
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index 7825c1aaa27b..673b0db22034 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -21,11 +21,11 @@
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/jiffies.h> 22#include <linux/jiffies.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/sizes.h> 25#include <asm/sizes.h>
26#include <asm/signal.h> 26#include <asm/signal.h>
27#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
28#include <asm/arch/pci.h> 28#include <mach/pci.h>
29 29
30#define IOP13XX_PCI_DEBUG 0 30#define IOP13XX_PCI_DEBUG 0
31#define PRINTK(x...) ((void)(IOP13XX_PCI_DEBUG && printk(x))) 31#define PRINTK(x...) ((void)(IOP13XX_PCI_DEBUG && printk(x)))
diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c
index 246f6d478720..b17ccc8cb471 100644
--- a/arch/arm/mach-iop13xx/setup.c
+++ b/arch/arm/mach-iop13xx/setup.c
@@ -22,7 +22,7 @@
22#include <linux/mtd/physmap.h> 22#include <linux/mtd/physmap.h>
23#endif 23#endif
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/hardware/iop_adma.h> 28#include <asm/hardware/iop_adma.h>
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c
index 4877597c8758..3ad4696ade42 100644
--- a/arch/arm/mach-iop32x/em7210.c
+++ b/arch/arm/mach-iop32x/em7210.c
@@ -23,7 +23,7 @@
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/irq.h> 28#include <linux/irq.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
@@ -31,7 +31,7 @@
31#include <asm/mach/pci.h> 31#include <asm/mach/pci.h>
32#include <asm/mach/time.h> 32#include <asm/mach/time.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/arch/time.h> 34#include <mach/time.h>
35 35
36static void __init em7210_timer_init(void) 36static void __init em7210_timer_init(void)
37{ 37{
diff --git a/arch/arm/mach-iop32x/glantank.c b/arch/arm/mach-iop32x/glantank.c
index d4fca75ce542..45d61276d233 100644
--- a/arch/arm/mach-iop32x/glantank.c
+++ b/arch/arm/mach-iop32x/glantank.c
@@ -25,7 +25,7 @@
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
@@ -34,7 +34,7 @@
34#include <asm/mach/time.h> 34#include <asm/mach/time.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36#include <asm/page.h> 36#include <asm/page.h>
37#include <asm/arch/time.h> 37#include <mach/time.h>
38 38
39/* 39/*
40 * GLAN Tank timer tick configuration. 40 * GLAN Tank timer tick configuration.
diff --git a/arch/arm/mach-iop32x/include/mach/adma.h b/arch/arm/mach-iop32x/include/mach/adma.h
new file mode 100644
index 000000000000..5ed92037dd10
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/adma.h
@@ -0,0 +1,5 @@
1#ifndef IOP32X_ADMA_H
2#define IOP32X_ADMA_H
3#include <asm/hardware/iop3xx-adma.h>
4#endif
5
diff --git a/arch/arm/mach-iop32x/include/mach/debug-macro.S b/arch/arm/mach-iop32x/include/mach/debug-macro.S
new file mode 100644
index 000000000000..58b01664ffba
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/debug-macro.S
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/debug-macro.S
3 *
4 * Debugging macro include header
5 *
6 * Copyright (C) 1994-1999 Russell King
7 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14 .macro addruart, rx
15 mov \rx, #0xfe000000 @ physical as well as virtual
16 orr \rx, \rx, #0x00800000 @ location of the UART
17 .endm
18
19#define UART_SHIFT 0
20#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-iop32x/include/mach/dma.h b/arch/arm/mach-iop32x/include/mach/dma.h
new file mode 100644
index 000000000000..f8bd817f205d
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/dma.h
@@ -0,0 +1,9 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/dma.h
3 *
4 * Copyright (C) 2004 Intel Corp.
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 */
diff --git a/arch/arm/mach-iop32x/include/mach/entry-macro.S b/arch/arm/mach-iop32x/include/mach/entry-macro.S
new file mode 100644
index 000000000000..b02fb56bafcc
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/entry-macro.S
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for IOP32x-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/iop32x.h>
11
12 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_preamble, base, tmp
16 mrc p15, 0, \tmp, c15, c1, 0
17 orr \tmp, \tmp, #(1 << 6)
18 mcr p15, 0, \tmp, c15, c1, 0 @ Enable cp6 access
19 mrc p15, 0, \tmp, c15, c1, 0
20 mov \tmp, \tmp
21 sub pc, pc, #4 @ cp_wait
22 .endm
23
24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
25 mrc p6, 0, \irqstat, c8, c0, 0 @ Read IINTSRC
26 cmp \irqstat, #0
27 clzne \irqnr, \irqstat
28 rsbne \irqnr, \irqnr, #31
29 .endm
30
31 .macro arch_ret_to_user, tmp1, tmp2
32 mrc p15, 0, \tmp1, c15, c1, 0
33 ands \tmp2, \tmp1, #(1 << 6)
34 bicne \tmp1, \tmp1, #(1 << 6)
35 mcrne p15, 0, \tmp1, c15, c1, 0 @ Disable cp6 access
36 .endm
diff --git a/arch/arm/mach-iop32x/include/mach/glantank.h b/arch/arm/mach-iop32x/include/mach/glantank.h
new file mode 100644
index 000000000000..958eb91c0913
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/glantank.h
@@ -0,0 +1,13 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/glantank.h
3 *
4 * IO-Data GLAN Tank board registers
5 */
6
7#ifndef __GLANTANK_H
8#define __GLANTANK_H
9
10#define GLANTANK_UART 0xfe800000 /* UART */
11
12
13#endif
diff --git a/arch/arm/mach-iop32x/include/mach/gpio.h b/arch/arm/mach-iop32x/include/mach/gpio.h
new file mode 100644
index 000000000000..708f4ec9db1d
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/gpio.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_ARCH_IOP32X_GPIO_H
2#define __ASM_ARCH_IOP32X_GPIO_H
3
4#include <asm/hardware/iop3xx-gpio.h>
5
6#endif
diff --git a/arch/arm/mach-iop32x/include/mach/hardware.h b/arch/arm/mach-iop32x/include/mach/hardware.h
new file mode 100644
index 000000000000..d559c4e6095a
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/hardware.h
@@ -0,0 +1,44 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/hardware.h
3 */
4
5#ifndef __HARDWARE_H
6#define __HARDWARE_H
7
8#include <asm/types.h>
9
10/*
11 * Note about PCI IO space mappings
12 *
13 * To make IO space accesses efficient, we store virtual addresses in
14 * the IO resources.
15 *
16 * The PCI IO space is located at virtual 0xfe000000 from physical
17 * 0x90000000. The PCI BARs must be programmed with physical addresses,
18 * but when we read them, we convert them to virtual addresses. See
19 * arch/arm/plat-iop/pci.c.
20 */
21#define pcibios_assign_all_busses() 1
22#define PCIBIOS_MIN_IO 0x00000000
23#define PCIBIOS_MIN_MEM 0x00000000
24
25#ifndef __ASSEMBLY__
26void iop32x_init_irq(void);
27#endif
28
29
30/*
31 * Generic chipset bits
32 */
33#include "iop32x.h"
34
35/*
36 * Board specific bits
37 */
38#include "glantank.h"
39#include "iq80321.h"
40#include "iq31244.h"
41#include "n2100.h"
42
43
44#endif
diff --git a/arch/arm/mach-iop32x/include/mach/io.h b/arch/arm/mach-iop32x/include/mach/io.h
new file mode 100644
index 000000000000..ce54705ba3d4
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/io.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/io.h
3 *
4 * Copyright (C) 2001 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __IO_H
12#define __IO_H
13
14#include <mach/hardware.h>
15
16extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size,
17 unsigned int mtype);
18extern void __iop3xx_iounmap(void __iomem *addr);
19
20#define IO_SPACE_LIMIT 0xffffffff
21#define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
22#define __mem_pci(a) (a)
23
24#define __arch_ioremap(a, s, f) __iop3xx_ioremap(a, s, f)
25#define __arch_iounmap(a) __iop3xx_iounmap(a)
26
27#endif
diff --git a/arch/arm/mach-iop32x/include/mach/iop32x.h b/arch/arm/mach-iop32x/include/mach/iop32x.h
new file mode 100644
index 000000000000..abd9eb49f103
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/iop32x.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/iop32x.h
3 *
4 * Intel IOP32X Chip definitions
5 *
6 * Author: Rory Bolt <rorybolt@pacbell.net>
7 * Copyright (C) 2002 Rory Bolt
8 * Copyright (C) 2004 Intel Corp.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __IOP32X_H
16#define __IOP32X_H
17
18/*
19 * Peripherals that are shared between the iop32x and iop33x but
20 * located at different addresses.
21 */
22#define IOP3XX_GPIO_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07c4 + (reg))
23#define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07e0 + (reg))
24
25#include <asm/hardware/iop3xx.h>
26
27/* ATU Parameters
28 * set up a 1:1 bus to physical ram relationship
29 * w/ physical ram on top of pci in the memory map
30 */
31#define IOP32X_MAX_RAM_SIZE 0x40000000UL
32#define IOP3XX_MAX_RAM_SIZE IOP32X_MAX_RAM_SIZE
33#define IOP3XX_PCI_LOWER_MEM_BA 0x80000000
34#define IOP32X_PCI_MEM_WINDOW_SIZE 0x04000000
35#define IOP3XX_PCI_MEM_WINDOW_SIZE IOP32X_PCI_MEM_WINDOW_SIZE
36
37#endif
diff --git a/arch/arm/mach-iop32x/include/mach/iq31244.h b/arch/arm/mach-iop32x/include/mach/iq31244.h
new file mode 100644
index 000000000000..6b6b369e781c
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/iq31244.h
@@ -0,0 +1,17 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/iq31244.h
3 *
4 * Intel IQ31244 evaluation board registers
5 */
6
7#ifndef __IQ31244_H
8#define __IQ31244_H
9
10#define IQ31244_UART 0xfe800000 /* UART #1 */
11#define IQ31244_7SEG_1 0xfe840000 /* 7-Segment MSB */
12#define IQ31244_7SEG_0 0xfe850000 /* 7-Segment LSB (WO) */
13#define IQ31244_ROTARY_SW 0xfe8d0000 /* Rotary Switch */
14#define IQ31244_BATT_STAT 0xfe8f0000 /* Battery Status */
15
16
17#endif
diff --git a/arch/arm/mach-iop32x/include/mach/iq80321.h b/arch/arm/mach-iop32x/include/mach/iq80321.h
new file mode 100644
index 000000000000..498819b737e7
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/iq80321.h
@@ -0,0 +1,17 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/iq80321.h
3 *
4 * Intel IQ80321 evaluation board registers
5 */
6
7#ifndef __IQ80321_H
8#define __IQ80321_H
9
10#define IQ80321_UART 0xfe800000 /* UART #1 */
11#define IQ80321_7SEG_1 0xfe840000 /* 7-Segment MSB */
12#define IQ80321_7SEG_0 0xfe850000 /* 7-Segment LSB (WO) */
13#define IQ80321_ROTARY_SW 0xfe8d0000 /* Rotary Switch */
14#define IQ80321_BATT_STAT 0xfe8f0000 /* Battery Status */
15
16
17#endif
diff --git a/arch/arm/mach-iop32x/include/mach/irqs.h b/arch/arm/mach-iop32x/include/mach/irqs.h
new file mode 100644
index 000000000000..33573e09914c
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/irqs.h
@@ -0,0 +1,50 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/irqs.h
3 *
4 * Author: Rory Bolt <rorybolt@pacbell.net>
5 * Copyright: (C) 2002 Rory Bolt
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 __IRQS_H
13#define __IRQS_H
14
15/*
16 * IOP80321 chipset interrupts
17 */
18#define IRQ_IOP32X_DMA0_EOT 0
19#define IRQ_IOP32X_DMA0_EOC 1
20#define IRQ_IOP32X_DMA1_EOT 2
21#define IRQ_IOP32X_DMA1_EOC 3
22#define IRQ_IOP32X_AA_EOT 6
23#define IRQ_IOP32X_AA_EOC 7
24#define IRQ_IOP32X_CORE_PMON 8
25#define IRQ_IOP32X_TIMER0 9
26#define IRQ_IOP32X_TIMER1 10
27#define IRQ_IOP32X_I2C_0 11
28#define IRQ_IOP32X_I2C_1 12
29#define IRQ_IOP32X_MESSAGING 13
30#define IRQ_IOP32X_ATU_BIST 14
31#define IRQ_IOP32X_PERFMON 15
32#define IRQ_IOP32X_CORE_PMU 16
33#define IRQ_IOP32X_BIU_ERR 17
34#define IRQ_IOP32X_ATU_ERR 18
35#define IRQ_IOP32X_MCU_ERR 19
36#define IRQ_IOP32X_DMA0_ERR 20
37#define IRQ_IOP32X_DMA1_ERR 21
38#define IRQ_IOP32X_AA_ERR 23
39#define IRQ_IOP32X_MSG_ERR 24
40#define IRQ_IOP32X_SSP 25
41#define IRQ_IOP32X_XINT0 27
42#define IRQ_IOP32X_XINT1 28
43#define IRQ_IOP32X_XINT2 29
44#define IRQ_IOP32X_XINT3 30
45#define IRQ_IOP32X_HPI 31
46
47#define NR_IRQS 32
48
49
50#endif
diff --git a/arch/arm/mach-iop32x/include/mach/memory.h b/arch/arm/mach-iop32x/include/mach/memory.h
new file mode 100644
index 000000000000..42cd4bf3148c
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/memory.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/memory.h
3 */
4
5#ifndef __MEMORY_H
6#define __MEMORY_H
7
8#include <mach/hardware.h>
9
10/*
11 * Physical DRAM offset.
12 */
13#define PHYS_OFFSET UL(0xa0000000)
14
15/*
16 * Virtual view <-> PCI DMA view memory address translations
17 * virt_to_bus: Used to translate the virtual address to an
18 * address suitable to be passed to set_dma_addr
19 * bus_to_virt: Used to convert an address for DMA operations
20 * to an address that the kernel can use.
21 */
22#define __virt_to_bus(x) (__virt_to_phys(x))
23#define __bus_to_virt(x) (__phys_to_virt(x))
24
25
26#endif
diff --git a/arch/arm/mach-iop32x/include/mach/n2100.h b/arch/arm/mach-iop32x/include/mach/n2100.h
new file mode 100644
index 000000000000..40b8a532b064
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/n2100.h
@@ -0,0 +1,19 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/n2100.h
3 *
4 * Thecus N2100 board registers
5 */
6
7#ifndef __N2100_H
8#define __N2100_H
9
10#define N2100_UART 0xfe800000 /* UART */
11
12#define N2100_COPY_BUTTON IOP3XX_GPIO_LINE(0)
13#define N2100_PCA9532_RESET IOP3XX_GPIO_LINE(2)
14#define N2100_RESET_BUTTON IOP3XX_GPIO_LINE(3)
15#define N2100_HARDWARE_RESET IOP3XX_GPIO_LINE(4)
16#define N2100_POWER_BUTTON IOP3XX_GPIO_LINE(5)
17
18
19#endif
diff --git a/arch/arm/mach-iop32x/include/mach/system.h b/arch/arm/mach-iop32x/include/mach/system.h
new file mode 100644
index 000000000000..20f923e54f46
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/system.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/system.h
3 *
4 * Copyright (C) 2001 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <asm/mach-types.h>
12
13static inline void arch_idle(void)
14{
15 cpu_do_idle();
16}
17
18static inline void arch_reset(char mode)
19{
20 local_irq_disable();
21
22 if (machine_is_n2100()) {
23 gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW);
24 gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT);
25 while (1)
26 ;
27 }
28
29 *IOP3XX_PCSR = 0x30;
30
31 /* Jump into ROM at address 0 */
32 cpu_reset(0);
33}
diff --git a/arch/arm/mach-iop32x/include/mach/time.h b/arch/arm/mach-iop32x/include/mach/time.h
new file mode 100644
index 000000000000..0f28c9949623
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/time.h
@@ -0,0 +1,4 @@
1#ifndef _IOP32X_TIME_H_
2#define _IOP32X_TIME_H_
3#define IRQ_IOP_TIMER0 IRQ_IOP32X_TIMER0
4#endif
diff --git a/arch/arm/mach-iop32x/include/mach/timex.h b/arch/arm/mach-iop32x/include/mach/timex.h
new file mode 100644
index 000000000000..a541afced3cb
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/timex.h
@@ -0,0 +1,9 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/timex.h
3 *
4 * IOP32x architecture timex specifications
5 */
6
7#include <mach/hardware.h>
8
9#define CLOCK_TICK_RATE (100 * HZ)
diff --git a/arch/arm/mach-iop32x/include/mach/uncompress.h b/arch/arm/mach-iop32x/include/mach/uncompress.h
new file mode 100644
index 000000000000..b247551b6f5a
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/uncompress.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/uncompress.h
3 */
4
5#include <asm/types.h>
6#include <asm/mach-types.h>
7#include <linux/serial_reg.h>
8#include <mach/hardware.h>
9
10static volatile u8 *uart_base;
11
12#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
13
14static inline void putc(char c)
15{
16 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
17 barrier();
18 uart_base[UART_TX] = c;
19}
20
21static inline void flush(void)
22{
23}
24
25static __inline__ void __arch_decomp_setup(unsigned long arch_id)
26{
27 if (machine_is_iq80321())
28 uart_base = (volatile u8 *)IQ80321_UART;
29 else if (machine_is_iq31244() || machine_is_em7210())
30 uart_base = (volatile u8 *)IQ31244_UART;
31 else
32 uart_base = (volatile u8 *)0xfe800000;
33}
34
35/*
36 * nothing to do
37 */
38#define arch_decomp_setup() __arch_decomp_setup(arch_id)
39#define arch_decomp_wdog()
diff --git a/arch/arm/mach-iop32x/include/mach/vmalloc.h b/arch/arm/mach-iop32x/include/mach/vmalloc.h
new file mode 100644
index 000000000000..85ceb09d85f0
--- /dev/null
+++ b/arch/arm/mach-iop32x/include/mach/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-iop32x/include/mach/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe000000
diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c
index 4a89823bcebb..082818aaa205 100644
--- a/arch/arm/mach-iop32x/iq31244.c
+++ b/arch/arm/mach-iop32x/iq31244.c
@@ -26,7 +26,7 @@
26#include <linux/serial_8250.h> 26#include <linux/serial_8250.h>
27#include <linux/mtd/physmap.h> 27#include <linux/mtd/physmap.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
@@ -36,7 +36,7 @@
36#include <asm/mach-types.h> 36#include <asm/mach-types.h>
37#include <asm/page.h> 37#include <asm/page.h>
38#include <asm/pgtable.h> 38#include <asm/pgtable.h>
39#include <asm/arch/time.h> 39#include <mach/time.h>
40 40
41/* 41/*
42 * Until March of 2007 iq31244 platforms and ep80219 platforms shared the 42 * Until March of 2007 iq31244 platforms and ep80219 platforms shared the
diff --git a/arch/arm/mach-iop32x/iq80321.c b/arch/arm/mach-iop32x/iq80321.c
index 1da3c911edd3..d735539808b4 100644
--- a/arch/arm/mach-iop32x/iq80321.c
+++ b/arch/arm/mach-iop32x/iq80321.c
@@ -23,7 +23,7 @@
23#include <linux/serial_8250.h> 23#include <linux/serial_8250.h>
24#include <linux/mtd/physmap.h> 24#include <linux/mtd/physmap.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
@@ -33,7 +33,7 @@
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/page.h> 34#include <asm/page.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
36#include <asm/arch/time.h> 36#include <mach/time.h>
37 37
38/* 38/*
39 * IQ80321 timer tick configuration. 39 * IQ80321 timer tick configuration.
diff --git a/arch/arm/mach-iop32x/irq.c b/arch/arm/mach-iop32x/irq.c
index 55cf0162e8c1..ba59b2d17db1 100644
--- a/arch/arm/mach-iop32x/irq.c
+++ b/arch/arm/mach-iop32x/irq.c
@@ -16,7 +16,7 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <asm/mach/irq.h> 17#include <asm/mach/irq.h>
18#include <asm/irq.h> 18#include <asm/irq.h>
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21 21
22static u32 iop32x_mask; 22static u32 iop32x_mask;
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c
index 28f164ea4726..3173f9c5835d 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -30,7 +30,7 @@
30#include <linux/i2c.h> 30#include <linux/i2c.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/reboot.h> 32#include <linux/reboot.h>
33#include <asm/hardware.h> 33#include <mach/hardware.h>
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
@@ -40,7 +40,7 @@
40#include <asm/mach-types.h> 40#include <asm/mach-types.h>
41#include <asm/page.h> 41#include <asm/page.h>
42#include <asm/pgtable.h> 42#include <asm/pgtable.h>
43#include <asm/arch/time.h> 43#include <mach/time.h>
44 44
45/* 45/*
46 * N2100 timer tick configuration. 46 * N2100 timer tick configuration.
diff --git a/arch/arm/mach-iop33x/include/mach/adma.h b/arch/arm/mach-iop33x/include/mach/adma.h
new file mode 100644
index 000000000000..4b92f795f90e
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/adma.h
@@ -0,0 +1,5 @@
1#ifndef IOP33X_ADMA_H
2#define IOP33X_ADMA_H
3#include <asm/hardware/iop3xx-adma.h>
4#endif
5
diff --git a/arch/arm/mach-iop33x/include/mach/debug-macro.S b/arch/arm/mach-iop33x/include/mach/debug-macro.S
new file mode 100644
index 000000000000..a60c9ef05cc3
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/debug-macro.S
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/debug-macro.S
3 *
4 * Debugging macro include header
5 *
6 * Copyright (C) 1994-1999 Russell King
7 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14 .macro addruart, rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ mmu enabled?
17 moveq \rx, #0xff000000 @ physical
18 movne \rx, #0xfe000000 @ virtual
19 orr \rx, \rx, #0x00ff0000
20 orr \rx, \rx, #0x0000f700
21 .endm
22
23#define UART_SHIFT 2
24#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-iop33x/include/mach/dma.h b/arch/arm/mach-iop33x/include/mach/dma.h
new file mode 100644
index 000000000000..d8b42232931d
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/dma.h
@@ -0,0 +1,9 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/dma.h
3 *
4 * Copyright (C) 2004 Intel Corp.
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 */
diff --git a/arch/arm/mach-iop33x/include/mach/entry-macro.S b/arch/arm/mach-iop33x/include/mach/entry-macro.S
new file mode 100644
index 000000000000..4e1f7282b354
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/entry-macro.S
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for IOP33x-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/iop33x.h>
11
12 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_preamble, base, tmp
16 mrc p15, 0, \tmp, c15, c1, 0
17 orr \tmp, \tmp, #(1 << 6)
18 mcr p15, 0, \tmp, c15, c1, 0 @ Enable cp6 access
19 mrc p15, 0, \tmp, c15, c1, 0
20 mov \tmp, \tmp
21 sub pc, pc, #4 @ cp_wait
22 .endm
23
24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
25 mrc p6, 0, \irqstat, c14, c0, 0 @ Read IINTVEC
26 cmp \irqstat, #0
27 mrceq p6, 0, \irqstat, c14, c0, 0 @ erratum 63 workaround
28 adds \irqnr, \irqstat, #1
29 movne \irqnr, \irqstat, lsr #2
30 .endm
31
32 .macro arch_ret_to_user, tmp1, tmp2
33 mrc p15, 0, \tmp1, c15, c1, 0
34 ands \tmp2, \tmp1, #(1 << 6)
35 bicne \tmp1, \tmp1, #(1 << 6)
36 mcrne p15, 0, \tmp1, c15, c1, 0 @ Disable cp6 access
37 .endm
diff --git a/arch/arm/mach-iop33x/include/mach/gpio.h b/arch/arm/mach-iop33x/include/mach/gpio.h
new file mode 100644
index 000000000000..ddd55bba9bb9
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/gpio.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_ARCH_IOP33X_GPIO_H
2#define __ASM_ARCH_IOP33X_GPIO_H
3
4#include <asm/hardware/iop3xx-gpio.h>
5
6#endif
diff --git a/arch/arm/mach-iop33x/include/mach/hardware.h b/arch/arm/mach-iop33x/include/mach/hardware.h
new file mode 100644
index 000000000000..8c10e430655e
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/hardware.h
@@ -0,0 +1,46 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/hardware.h
3 */
4
5#ifndef __HARDWARE_H
6#define __HARDWARE_H
7
8#include <asm/types.h>
9
10/*
11 * Note about PCI IO space mappings
12 *
13 * To make IO space accesses efficient, we store virtual addresses in
14 * the IO resources.
15 *
16 * The PCI IO space is located at virtual 0xfe000000 from physical
17 * 0x90000000. The PCI BARs must be programmed with physical addresses,
18 * but when we read them, we convert them to virtual addresses. See
19 * arch/arm/mach-iop3xx/iop3xx-pci.c
20 */
21#define pcibios_assign_all_busses() 1
22#define PCIBIOS_MIN_IO 0x00000000
23#define PCIBIOS_MIN_MEM 0x00000000
24
25#ifndef __ASSEMBLY__
26void iop33x_init_irq(void);
27
28extern struct platform_device iop33x_uart0_device;
29extern struct platform_device iop33x_uart1_device;
30#endif
31
32
33/*
34 * Generic chipset bits
35 *
36 */
37#include "iop33x.h"
38
39/*
40 * Board specific bits
41 */
42#include "iq80331.h"
43#include "iq80332.h"
44
45
46#endif
diff --git a/arch/arm/mach-iop33x/include/mach/io.h b/arch/arm/mach-iop33x/include/mach/io.h
new file mode 100644
index 000000000000..158874631217
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/io.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/io.h
3 *
4 * Copyright (C) 2001 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __IO_H
12#define __IO_H
13
14#include <mach/hardware.h>
15
16extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size,
17 unsigned int mtype);
18extern void __iop3xx_iounmap(void __iomem *addr);
19
20#define IO_SPACE_LIMIT 0xffffffff
21#define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
22#define __mem_pci(a) (a)
23
24#define __arch_ioremap(a, s, f) __iop3xx_ioremap(a, s, f)
25#define __arch_iounmap(a) __iop3xx_iounmap(a)
26
27#endif
diff --git a/arch/arm/mach-iop33x/include/mach/iop33x.h b/arch/arm/mach-iop33x/include/mach/iop33x.h
new file mode 100644
index 000000000000..24567316ec88
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/iop33x.h
@@ -0,0 +1,43 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/iop33x.h
3 *
4 * Intel IOP33X Chip definitions
5 *
6 * Author: Dave Jiang (dave.jiang@intel.com)
7 * Copyright (C) 2003, 2004 Intel Corp.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __IOP33X_H
15#define __IOP33X_H
16
17/*
18 * Peripherals that are shared between the iop32x and iop33x but
19 * located at different addresses.
20 */
21#define IOP3XX_GPIO_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x1780 + (reg))
22#define IOP3XX_TIMER_REG(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + 0x07d0 + (reg))
23
24#include <asm/hardware/iop3xx.h>
25
26/* UARTs */
27#define IOP33X_UART0_PHYS (IOP3XX_PERIPHERAL_PHYS_BASE + 0x1700)
28#define IOP33X_UART0_VIRT (IOP3XX_PERIPHERAL_VIRT_BASE + 0x1700)
29#define IOP33X_UART1_PHYS (IOP3XX_PERIPHERAL_PHYS_BASE + 0x1740)
30#define IOP33X_UART1_VIRT (IOP3XX_PERIPHERAL_VIRT_BASE + 0x1740)
31
32/* ATU Parameters
33 * set up a 1:1 bus to physical ram relationship
34 * w/ pci on top of physical ram in memory map
35 */
36#define IOP33X_MAX_RAM_SIZE 0x80000000UL
37#define IOP3XX_MAX_RAM_SIZE IOP33X_MAX_RAM_SIZE
38#define IOP3XX_PCI_LOWER_MEM_BA (PHYS_OFFSET + IOP33X_MAX_RAM_SIZE)
39#define IOP33X_PCI_MEM_WINDOW_SIZE 0x08000000
40#define IOP3XX_PCI_MEM_WINDOW_SIZE IOP33X_PCI_MEM_WINDOW_SIZE
41
42
43#endif
diff --git a/arch/arm/mach-iop33x/include/mach/iq80331.h b/arch/arm/mach-iop33x/include/mach/iq80331.h
new file mode 100644
index 000000000000..fe406b0127f7
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/iq80331.h
@@ -0,0 +1,16 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/iq80331.h
3 *
4 * Intel IQ80331 evaluation board registers
5 */
6
7#ifndef __IQ80331_H
8#define __IQ80331_H
9
10#define IQ80331_7SEG_1 0xce840000 /* 7-Segment MSB */
11#define IQ80331_7SEG_0 0xce850000 /* 7-Segment LSB (WO) */
12#define IQ80331_ROTARY_SW 0xce8d0000 /* Rotary Switch */
13#define IQ80331_BATT_STAT 0xce8f0000 /* Battery Status */
14
15
16#endif
diff --git a/arch/arm/mach-iop33x/include/mach/iq80332.h b/arch/arm/mach-iop33x/include/mach/iq80332.h
new file mode 100644
index 000000000000..8325d71f2ed5
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/iq80332.h
@@ -0,0 +1,16 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/iq80332.h
3 *
4 * Intel IQ80332 evaluation board registers
5 */
6
7#ifndef __IQ80332_H
8#define __IQ80332_H
9
10#define IQ80332_7SEG_1 0xce840000 /* 7-Segment MSB */
11#define IQ80332_7SEG_0 0xce850000 /* 7-Segment LSB (WO) */
12#define IQ80332_ROTARY_SW 0xce8d0000 /* Rotary Switch */
13#define IQ80332_BATT_STAT 0xce8f0000 /* Battery Status */
14
15
16#endif
diff --git a/arch/arm/mach-iop33x/include/mach/irqs.h b/arch/arm/mach-iop33x/include/mach/irqs.h
new file mode 100644
index 000000000000..707628a600ac
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/irqs.h
@@ -0,0 +1,60 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/irqs.h
3 *
4 * Author: Dave Jiang (dave.jiang@intel.com)
5 * Copyright: (C) 2003 Intel Corp.
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 __IRQS_H
13#define __IRQS_H
14
15/*
16 * IOP80331 chipset interrupts
17 */
18#define IRQ_IOP33X_DMA0_EOT 0
19#define IRQ_IOP33X_DMA0_EOC 1
20#define IRQ_IOP33X_DMA1_EOT 2
21#define IRQ_IOP33X_DMA1_EOC 3
22#define IRQ_IOP33X_AA_EOT 6
23#define IRQ_IOP33X_AA_EOC 7
24#define IRQ_IOP33X_TIMER0 8
25#define IRQ_IOP33X_TIMER1 9
26#define IRQ_IOP33X_I2C_0 10
27#define IRQ_IOP33X_I2C_1 11
28#define IRQ_IOP33X_MSG 12
29#define IRQ_IOP33X_MSGIBQ 13
30#define IRQ_IOP33X_ATU_BIST 14
31#define IRQ_IOP33X_PERFMON 15
32#define IRQ_IOP33X_CORE_PMU 16
33#define IRQ_IOP33X_XINT0 24
34#define IRQ_IOP33X_XINT1 25
35#define IRQ_IOP33X_XINT2 26
36#define IRQ_IOP33X_XINT3 27
37#define IRQ_IOP33X_XINT8 32
38#define IRQ_IOP33X_XINT9 33
39#define IRQ_IOP33X_XINT10 34
40#define IRQ_IOP33X_XINT11 35
41#define IRQ_IOP33X_XINT12 36
42#define IRQ_IOP33X_XINT13 37
43#define IRQ_IOP33X_XINT14 38
44#define IRQ_IOP33X_XINT15 39
45#define IRQ_IOP33X_UART0 51
46#define IRQ_IOP33X_UART1 52
47#define IRQ_IOP33X_PBIE 53
48#define IRQ_IOP33X_ATU_CRW 54
49#define IRQ_IOP33X_ATU_ERR 55
50#define IRQ_IOP33X_MCU_ERR 56
51#define IRQ_IOP33X_DMA0_ERR 57
52#define IRQ_IOP33X_DMA1_ERR 58
53#define IRQ_IOP33X_AA_ERR 60
54#define IRQ_IOP33X_MSG_ERR 62
55#define IRQ_IOP33X_HPI 63
56
57#define NR_IRQS 64
58
59
60#endif
diff --git a/arch/arm/mach-iop33x/include/mach/memory.h b/arch/arm/mach-iop33x/include/mach/memory.h
new file mode 100644
index 000000000000..2cef0bbb354f
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/memory.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/memory.h
3 */
4
5#ifndef __MEMORY_H
6#define __MEMORY_H
7
8#include <mach/hardware.h>
9
10/*
11 * Physical DRAM offset.
12 */
13#define PHYS_OFFSET UL(0x00000000)
14
15/*
16 * Virtual view <-> PCI DMA view memory address translations
17 * virt_to_bus: Used to translate the virtual address to an
18 * address suitable to be passed to set_dma_addr
19 * bus_to_virt: Used to convert an address for DMA operations
20 * to an address that the kernel can use.
21 */
22#define __virt_to_bus(x) (__virt_to_phys(x))
23#define __bus_to_virt(x) (__phys_to_virt(x))
24
25
26#endif
diff --git a/arch/arm/mach-iop33x/include/mach/system.h b/arch/arm/mach-iop33x/include/mach/system.h
new file mode 100644
index 000000000000..7bf3bfb49446
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/system.h
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/system.h
3 *
4 * Copyright (C) 2001 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11static inline void arch_idle(void)
12{
13 cpu_do_idle();
14}
15
16static inline void arch_reset(char mode)
17{
18 *IOP3XX_PCSR = 0x30;
19
20 /* Jump into ROM at address 0 */
21 cpu_reset(0);
22}
diff --git a/arch/arm/mach-iop33x/include/mach/time.h b/arch/arm/mach-iop33x/include/mach/time.h
new file mode 100644
index 000000000000..4ac4d7664f85
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/time.h
@@ -0,0 +1,4 @@
1#ifndef _IOP33X_TIME_H_
2#define _IOP33X_TIME_H_
3#define IRQ_IOP_TIMER0 IRQ_IOP33X_TIMER0
4#endif
diff --git a/arch/arm/mach-iop33x/include/mach/timex.h b/arch/arm/mach-iop33x/include/mach/timex.h
new file mode 100644
index 000000000000..c75760844d49
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/timex.h
@@ -0,0 +1,9 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/timex.h
3 *
4 * IOP3xx architecture timex specifications
5 */
6
7#include <mach/hardware.h>
8
9#define CLOCK_TICK_RATE (100 * HZ)
diff --git a/arch/arm/mach-iop33x/include/mach/uncompress.h b/arch/arm/mach-iop33x/include/mach/uncompress.h
new file mode 100644
index 000000000000..b42423f63302
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/uncompress.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/uncompress.h
3 */
4
5#include <asm/types.h>
6#include <asm/mach-types.h>
7#include <linux/serial_reg.h>
8#include <mach/hardware.h>
9
10static volatile u32 *uart_base;
11
12#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
13
14static inline void putc(char c)
15{
16 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
17 barrier();
18 uart_base[UART_TX] = c;
19}
20
21static inline void flush(void)
22{
23}
24
25static __inline__ void __arch_decomp_setup(unsigned long arch_id)
26{
27 if (machine_is_iq80331() || machine_is_iq80332())
28 uart_base = (volatile u32 *)IOP33X_UART0_PHYS;
29 else
30 uart_base = (volatile u32 *)0xfe800000;
31}
32
33/*
34 * nothing to do
35 */
36#define arch_decomp_setup() __arch_decomp_setup(arch_id)
37#define arch_decomp_wdog()
diff --git a/arch/arm/mach-iop33x/include/mach/vmalloc.h b/arch/arm/mach-iop33x/include/mach/vmalloc.h
new file mode 100644
index 000000000000..f9f99dea9bc4
--- /dev/null
+++ b/arch/arm/mach-iop33x/include/mach/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-iop33x/include/mach/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe000000
diff --git a/arch/arm/mach-iop33x/iq80331.c b/arch/arm/mach-iop33x/iq80331.c
index de39fd778579..c7d99f9fafed 100644
--- a/arch/arm/mach-iop33x/iq80331.c
+++ b/arch/arm/mach-iop33x/iq80331.c
@@ -22,7 +22,7 @@
22#include <linux/serial_8250.h> 22#include <linux/serial_8250.h>
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
@@ -32,7 +32,7 @@
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/pgtable.h> 34#include <asm/pgtable.h>
35#include <asm/arch/time.h> 35#include <mach/time.h>
36 36
37/* 37/*
38 * IQ80331 timer tick configuration. 38 * IQ80331 timer tick configuration.
diff --git a/arch/arm/mach-iop33x/iq80332.c b/arch/arm/mach-iop33x/iq80332.c
index 4904fd78445f..af616c5f4fb2 100644
--- a/arch/arm/mach-iop33x/iq80332.c
+++ b/arch/arm/mach-iop33x/iq80332.c
@@ -22,7 +22,7 @@
22#include <linux/serial_8250.h> 22#include <linux/serial_8250.h>
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
@@ -32,7 +32,7 @@
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/pgtable.h> 34#include <asm/pgtable.h>
35#include <asm/arch/time.h> 35#include <mach/time.h>
36 36
37/* 37/*
38 * IQ80332 timer tick configuration. 38 * IQ80332 timer tick configuration.
diff --git a/arch/arm/mach-iop33x/irq.c b/arch/arm/mach-iop33x/irq.c
index f09dd054b9c0..abb4ea2ed4fd 100644
--- a/arch/arm/mach-iop33x/irq.c
+++ b/arch/arm/mach-iop33x/irq.c
@@ -16,7 +16,7 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <asm/mach/irq.h> 17#include <asm/mach/irq.h>
18#include <asm/irq.h> 18#include <asm/irq.h>
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21 21
22static u32 iop33x_mask0; 22static u32 iop33x_mask0;
diff --git a/arch/arm/mach-iop33x/uart.c b/arch/arm/mach-iop33x/uart.c
index ac297cd0276c..8c21870fa808 100644
--- a/arch/arm/mach-iop33x/uart.c
+++ b/arch/arm/mach-iop33x/uart.c
@@ -24,9 +24,8 @@
24#include <asm/setup.h> 24#include <asm/setup.h>
25#include <asm/system.h> 25#include <asm/system.h>
26#include <asm/memory.h> 26#include <asm/memory.h>
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/hardware/iop3xx.h> 28#include <asm/hardware/iop3xx.h>
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
31 30
32#define IOP33X_UART_XTAL 33334000 31#define IOP33X_UART_XTAL 33334000
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index daf28074134b..a6a4f93085fd 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -29,7 +29,7 @@
29#include <asm/types.h> 29#include <asm/types.h>
30#include <asm/setup.h> 30#include <asm/setup.h>
31#include <asm/memory.h> 31#include <asm/memory.h>
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/tlbflush.h> 35#include <asm/tlbflush.h>
@@ -39,7 +39,7 @@
39#include <asm/mach/time.h> 39#include <asm/mach/time.h>
40#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
41 41
42#include <asm/arch/gpio.h> 42#include <mach/gpio.h>
43 43
44static DEFINE_SPINLOCK(ixp2000_slowport_lock); 44static DEFINE_SPINLOCK(ixp2000_slowport_lock);
45static unsigned long ixp2000_slowport_irq_flags; 45static unsigned long ixp2000_slowport_irq_flags;
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c
index 9c49435d42c3..c62ed655c1a7 100644
--- a/arch/arm/mach-ixp2000/enp2611.c
+++ b/arch/arm/mach-ixp2000/enp2611.c
@@ -38,7 +38,7 @@
38#include <asm/pgtable.h> 38#include <asm/pgtable.h>
39#include <asm/page.h> 39#include <asm/page.h>
40#include <asm/system.h> 40#include <asm/system.h>
41#include <asm/hardware.h> 41#include <mach/hardware.h>
42#include <asm/mach-types.h> 42#include <asm/mach-types.h>
43 43
44#include <asm/mach/pci.h> 44#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-ixp2000/include/mach/debug-macro.S b/arch/arm/mach-ixp2000/include/mach/debug-macro.S
new file mode 100644
index 000000000000..904ff56d2246
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/debug-macro.S
@@ -0,0 +1,27 @@
1/* arch/arm/mach-ixp2000/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 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17 moveq \rx, #0xc0000000 @ Physical base
18 movne \rx, #0xfe000000 @ virtual base
19 orrne \rx, \rx, #0x00f00000
20 orr \rx, \rx, #0x00030000
21#ifdef __ARMEB__
22 orr \rx, \rx, #0x00000003
23#endif
24 .endm
25
26#define UART_SHIFT 2
27#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-ixp2000/include/mach/dma.h b/arch/arm/mach-ixp2000/include/mach/dma.h
new file mode 100644
index 000000000000..26063d60f622
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/dma.h
@@ -0,0 +1,9 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/dma.h
3 *
4 * Copyright (C) 2002 Intel Corp.
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 */
diff --git a/arch/arm/mach-ixp2000/include/mach/enp2611.h b/arch/arm/mach-ixp2000/include/mach/enp2611.h
new file mode 100644
index 000000000000..9ce3690061d5
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/enp2611.h
@@ -0,0 +1,46 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/enp2611.h
3 *
4 * Register and other defines for Radisys ENP-2611
5 *
6 * Created 2004 by Lennert Buytenhek from the ixdp2x01 code. The
7 * original version carries the following notices:
8 *
9 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
10 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
11 *
12 * Copyright (C) 2002 Intel Corp.
13 * Copyright (C) 2003-2004 MontaVista Software, Inc.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 */
20
21#ifndef __ENP2611_H
22#define __ENP2611_H
23
24#define ENP2611_CALEB_PHYS_BASE 0xc5000000
25#define ENP2611_CALEB_VIRT_BASE 0xfe000000
26#define ENP2611_CALEB_SIZE 0x00100000
27
28#define ENP2611_PM3386_0_PHYS_BASE 0xc6000000
29#define ENP2611_PM3386_0_VIRT_BASE 0xfe100000
30#define ENP2611_PM3386_0_SIZE 0x00100000
31
32#define ENP2611_PM3386_1_PHYS_BASE 0xc6400000
33#define ENP2611_PM3386_1_VIRT_BASE 0xfe200000
34#define ENP2611_PM3386_1_SIZE 0x00100000
35
36#define ENP2611_GPIO_SCL 7
37#define ENP2611_GPIO_SDA 6
38
39#define IRQ_ENP2611_THERMAL IRQ_IXP2000_GPIO4
40#define IRQ_ENP2611_OPTION_BOARD IRQ_IXP2000_GPIO3
41#define IRQ_ENP2611_CALEB IRQ_IXP2000_GPIO2
42#define IRQ_ENP2611_PM3386_1 IRQ_IXP2000_GPIO1
43#define IRQ_ENP2611_PM3386_0 IRQ_IXP2000_GPIO0
44
45
46#endif
diff --git a/arch/arm/mach-ixp2000/include/mach/entry-macro.S b/arch/arm/mach-ixp2000/include/mach/entry-macro.S
new file mode 100644
index 000000000000..5850ffc8c751
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/entry-macro.S
@@ -0,0 +1,60 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for IXP2000-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/irqs.h>
11
12 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_preamble, base, tmp
16 .endm
17
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
22
23 mov \irqnr, #0x0 @clear out irqnr as default
24 mov \base, #0xfe000000
25 orr \base, \base, #0x00e00000
26 orr \base, \base, #0x08
27 ldr \irqstat, [\base] @ get interrupts
28
29 cmp \irqstat, #0
30 beq 1001f
31
32 clz \irqnr, \irqstat
33 mov \base, #31
34 subs \irqnr, \base, \irqnr
35
36 /*
37 * We handle PCIA and PCIB here so we don't have an
38 * extra layer of code just to check these two bits.
39 */
40 cmp \irqnr, #IRQ_IXP2000_PCI
41 bne 1001f
42
43 mov \base, #0xfe000000
44 orr \base, \base, #0x00c00000
45 orr \base, \base, #0x00000100
46 orr \base, \base, #0x00000058
47 ldr \irqstat, [\base]
48
49 mov \tmp, #(1<<26)
50 tst \irqstat, \tmp
51 movne \irqnr, #IRQ_IXP2000_PCIA
52 bne 1001f
53
54 mov \tmp, #(1<<27)
55 tst \irqstat, \tmp
56 movne \irqnr, #IRQ_IXP2000_PCIB
57
581001:
59 .endm
60
diff --git a/arch/arm/mach-ixp2000/include/mach/gpio.h b/arch/arm/mach-ixp2000/include/mach/gpio.h
new file mode 100644
index 000000000000..4a88d2c33dac
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/gpio.h
@@ -0,0 +1,48 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/gpio.h
3 *
4 * Copyright (C) 2002 Intel Corporation.
5 *
6 * This program is free software, you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11/*
12 * IXP2000 GPIO in/out, edge/level detection for IRQs:
13 * IRQs are generated on Falling-edge, Rising-Edge, Level-low, Level-High
14 * or both Falling-edge and Rising-edge.
15 * This must be called *before* the corresponding IRQ is registerd.
16 * Use this instead of directly setting the GPIO registers.
17 * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb)
18 */
19#ifndef __ASM_ARCH_GPIO_H
20#define __ASM_ARCH_GPIO_H
21
22#ifndef __ASSEMBLY__
23
24#define GPIO_IN 0
25#define GPIO_OUT 1
26
27#define IXP2000_GPIO_LOW 0
28#define IXP2000_GPIO_HIGH 1
29
30extern void gpio_line_config(int line, int direction);
31
32static inline int gpio_line_get(int line)
33{
34 return (((*IXP2000_GPIO_PLR) >> line) & 1);
35}
36
37static inline void gpio_line_set(int line, int value)
38{
39 if (value == IXP2000_GPIO_HIGH) {
40 ixp2000_reg_write(IXP2000_GPIO_POSR, 1 << line);
41 } else if (value == IXP2000_GPIO_LOW) {
42 ixp2000_reg_write(IXP2000_GPIO_POCR, 1 << line);
43 }
44}
45
46#endif /* !__ASSEMBLY__ */
47
48#endif /* ASM_ARCH_IXP2000_GPIO_H_ */
diff --git a/arch/arm/mach-ixp2000/include/mach/hardware.h b/arch/arm/mach-ixp2000/include/mach/hardware.h
new file mode 100644
index 000000000000..f033de4e7493
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/hardware.h
@@ -0,0 +1,44 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/hardware.h
3 *
4 * Hardware definitions for IXP2400/2800 based systems
5 *
6 * Original Author: Naeem M Afzal <naeem.m.afzal@intel.com>
7 *
8 * Maintainer: Deepak Saxena <dsaxena@mvista.com>
9 *
10 * Copyright (C) 2001-2002 Intel Corp.
11 * Copyright (C) 2003-2004 MontaVista Software, Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18
19#ifndef __ASM_ARCH_HARDWARE_H__
20#define __ASM_ARCH_HARDWARE_H__
21
22/*
23 * This needs to be platform-specific?
24 */
25#define PCIBIOS_MIN_IO 0x00000000
26#define PCIBIOS_MIN_MEM 0x00000000
27
28#include "ixp2000-regs.h" /* Chipset Registers */
29
30#define pcibios_assign_all_busses() 0
31
32/*
33 * Platform helper functions
34 */
35#include "platform.h"
36
37/*
38 * Platform-specific bits
39 */
40#include "enp2611.h" /* ENP-2611 */
41#include "ixdp2x00.h" /* IXDP2400/2800 */
42#include "ixdp2x01.h" /* IXDP2401/2801 */
43
44#endif /* _ASM_ARCH_HARDWARE_H__ */
diff --git a/arch/arm/mach-ixp2000/include/mach/io.h b/arch/arm/mach-ixp2000/include/mach/io.h
new file mode 100644
index 000000000000..859e584914d9
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/io.h
@@ -0,0 +1,134 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/io.h
3 *
4 * Original Author: Naeem M Afzal <naeem.m.afzal@intel.com>
5 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
6 *
7 * Copyright (C) 2002 Intel Corp.
8 * Copyrgiht (C) 2003-2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_ARM_ARCH_IO_H
16#define __ASM_ARM_ARCH_IO_H
17
18#include <mach/hardware.h>
19
20#define IO_SPACE_LIMIT 0xffffffff
21#define __mem_pci(a) (a)
22
23/*
24 * The A? revisions of the IXP2000s assert byte lanes for PCI I/O
25 * transactions the other way round (MEM transactions don't have this
26 * issue), so if we want to support those models, we need to override
27 * the standard I/O functions.
28 *
29 * B0 and later have a bit that can be set to 1 to get the proper
30 * behavior for I/O transactions, which then allows us to use the
31 * standard I/O functions. This is what we do if the user does not
32 * explicitly ask for support for pre-B0.
33 */
34#ifdef CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO
35#define ___io(p) ((void __iomem *)((p)+IXP2000_PCI_IO_VIRT_BASE))
36
37#define alignb(addr) (void __iomem *)((unsigned long)(addr) ^ 3)
38#define alignw(addr) (void __iomem *)((unsigned long)(addr) ^ 2)
39
40#define outb(v,p) __raw_writeb((v),alignb(___io(p)))
41#define outw(v,p) __raw_writew((v),alignw(___io(p)))
42#define outl(v,p) __raw_writel((v),___io(p))
43
44#define inb(p) ({ unsigned int __v = __raw_readb(alignb(___io(p))); __v; })
45#define inw(p) \
46 ({ unsigned int __v = (__raw_readw(alignw(___io(p)))); __v; })
47#define inl(p) \
48 ({ unsigned int __v = (__raw_readl(___io(p))); __v; })
49
50#define outsb(p,d,l) __raw_writesb(alignb(___io(p)),d,l)
51#define outsw(p,d,l) __raw_writesw(alignw(___io(p)),d,l)
52#define outsl(p,d,l) __raw_writesl(___io(p),d,l)
53
54#define insb(p,d,l) __raw_readsb(alignb(___io(p)),d,l)
55#define insw(p,d,l) __raw_readsw(alignw(___io(p)),d,l)
56#define insl(p,d,l) __raw_readsl(___io(p),d,l)
57
58#define __is_io_address(p) ((((unsigned long)(p)) & ~(IXP2000_PCI_IO_SIZE - 1)) == IXP2000_PCI_IO_VIRT_BASE)
59
60#define ioread8(p) \
61 ({ \
62 unsigned int __v; \
63 \
64 if (__is_io_address(p)) { \
65 __v = __raw_readb(alignb(p)); \
66 } else { \
67 __v = __raw_readb(p); \
68 } \
69 \
70 __v; \
71 }) \
72
73#define ioread16(p) \
74 ({ \
75 unsigned int __v; \
76 \
77 if (__is_io_address(p)) { \
78 __v = __raw_readw(alignw(p)); \
79 } else { \
80 __v = le16_to_cpu(__raw_readw(p)); \
81 } \
82 \
83 __v; \
84 })
85
86#define ioread32(p) \
87 ({ \
88 unsigned int __v; \
89 \
90 if (__is_io_address(p)) { \
91 __v = __raw_readl(p); \
92 } else { \
93 __v = le32_to_cpu(__raw_readl(p)); \
94 } \
95 \
96 __v; \
97 })
98
99#define iowrite8(v,p) \
100 ({ \
101 if (__is_io_address(p)) { \
102 __raw_writeb((v), alignb(p)); \
103 } else { \
104 __raw_writeb((v), p); \
105 } \
106 })
107
108#define iowrite16(v,p) \
109 ({ \
110 if (__is_io_address(p)) { \
111 __raw_writew((v), alignw(p)); \
112 } else { \
113 __raw_writew(cpu_to_le16(v), p); \
114 } \
115 })
116
117#define iowrite32(v,p) \
118 ({ \
119 if (__is_io_address(p)) { \
120 __raw_writel((v), p); \
121 } else { \
122 __raw_writel(cpu_to_le32(v), p); \
123 } \
124 })
125
126#define ioport_map(port, nr) ___io(port)
127
128#define ioport_unmap(addr)
129#else
130#define __io(p) ((void __iomem *)((p)+IXP2000_PCI_IO_VIRT_BASE))
131#endif
132
133
134#endif
diff --git a/arch/arm/mach-ixp2000/include/mach/irqs.h b/arch/arm/mach-ixp2000/include/mach/irqs.h
new file mode 100644
index 000000000000..bee96bcafdca
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/irqs.h
@@ -0,0 +1,207 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/irqs.h
3 *
4 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
5 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
6 *
7 * Copyright (C) 2002 Intel Corp.
8 * Copyright (C) 2003-2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef _IRQS_H
16#define _IRQS_H
17
18/*
19 * Do NOT add #ifdef MACHINE_FOO in here.
20 * Simpy add your machine IRQs here and increase NR_IRQS if needed to
21 * hold your machine's IRQ table.
22 */
23
24/*
25 * Some interrupt numbers go unused b/c the IRQ mask/ummask/status
26 * register has those bit reserved. We just mark those interrupts
27 * as invalid and this allows us to do mask/unmask with a single
28 * shift operation instead of having to map the IRQ number to
29 * a HW IRQ number.
30 */
31#define IRQ_IXP2000_SOFT_INT 0 /* soft interrupt */
32#define IRQ_IXP2000_ERRSUM 1 /* OR of all bits in ErrorStatus reg*/
33#define IRQ_IXP2000_UART 2
34#define IRQ_IXP2000_GPIO 3
35#define IRQ_IXP2000_TIMER1 4
36#define IRQ_IXP2000_TIMER2 5
37#define IRQ_IXP2000_TIMER3 6
38#define IRQ_IXP2000_TIMER4 7
39#define IRQ_IXP2000_PMU 8
40#define IRQ_IXP2000_SPF 9 /* Slow port framer IRQ */
41#define IRQ_IXP2000_DMA1 10
42#define IRQ_IXP2000_DMA2 11
43#define IRQ_IXP2000_DMA3 12
44#define IRQ_IXP2000_PCI_DOORBELL 13
45#define IRQ_IXP2000_ME_ATTN 14
46#define IRQ_IXP2000_PCI 15 /* PCI INTA or INTB */
47#define IRQ_IXP2000_THDA0 16 /* thread 0-31A */
48#define IRQ_IXP2000_THDA1 17 /* thread 32-63A, IXP2800 only */
49#define IRQ_IXP2000_THDA2 18 /* thread 64-95A */
50#define IRQ_IXP2000_THDA3 19 /* thread 96-127A, IXP2800 only */
51#define IRQ_IXP2000_THDB0 24 /* thread 0-31B */
52#define IRQ_IXP2000_THDB1 25 /* thread 32-63B, IXP2800 only */
53#define IRQ_IXP2000_THDB2 26 /* thread 64-95B */
54#define IRQ_IXP2000_THDB3 27 /* thread 96-127B, IXP2800 only */
55
56/* define generic GPIOs */
57#define IRQ_IXP2000_GPIO0 32
58#define IRQ_IXP2000_GPIO1 33
59#define IRQ_IXP2000_GPIO2 34
60#define IRQ_IXP2000_GPIO3 35
61#define IRQ_IXP2000_GPIO4 36
62#define IRQ_IXP2000_GPIO5 37
63#define IRQ_IXP2000_GPIO6 38
64#define IRQ_IXP2000_GPIO7 39
65
66/* split off the 2 PCI sources */
67#define IRQ_IXP2000_PCIA 40
68#define IRQ_IXP2000_PCIB 41
69
70/* Int sources from IRQ_ERROR_STATUS */
71#define IRQ_IXP2000_DRAM0_MIN_ERR 42
72#define IRQ_IXP2000_DRAM0_MAJ_ERR 43
73#define IRQ_IXP2000_DRAM1_MIN_ERR 44
74#define IRQ_IXP2000_DRAM1_MAJ_ERR 45
75#define IRQ_IXP2000_DRAM2_MIN_ERR 46
76#define IRQ_IXP2000_DRAM2_MAJ_ERR 47
77/* 48-57 reserved */
78#define IRQ_IXP2000_SRAM0_ERR 58
79#define IRQ_IXP2000_SRAM1_ERR 59
80#define IRQ_IXP2000_SRAM2_ERR 60
81#define IRQ_IXP2000_SRAM3_ERR 61
82/* 62-65 reserved */
83#define IRQ_IXP2000_MEDIA_ERR 66
84#define IRQ_IXP2000_PCI_ERR 67
85#define IRQ_IXP2000_SP_INT 68
86
87#define NR_IXP2000_IRQS 69
88
89#define IXP2000_BOARD_IRQ(x) (NR_IXP2000_IRQS + (x))
90
91#define IXP2000_BOARD_IRQ_MASK(irq) (1 << (irq - NR_IXP2000_IRQS))
92
93#define IXP2000_ERR_IRQ_MASK(irq) ( 1 << (irq - IRQ_IXP2000_DRAM0_MIN_ERR))
94#define IXP2000_VALID_ERR_IRQ_MASK (\
95 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM0_MIN_ERR) | \
96 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM0_MAJ_ERR) | \
97 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM1_MIN_ERR) | \
98 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM1_MAJ_ERR) | \
99 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM2_MIN_ERR) | \
100 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM2_MAJ_ERR) | \
101 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM0_ERR) | \
102 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM1_ERR) | \
103 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM2_ERR) | \
104 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM3_ERR) | \
105 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_MEDIA_ERR) | \
106 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_PCI_ERR) | \
107 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SP_INT) )
108
109/*
110 * This allows for all the on-chip sources plus up to 32 CPLD based
111 * IRQs. Should be more than enough.
112 */
113#define IXP2000_BOARD_IRQS 32
114#define NR_IRQS (NR_IXP2000_IRQS + IXP2000_BOARD_IRQS)
115
116
117/*
118 * IXDP2400 specific IRQs
119 */
120#define IRQ_IXDP2400_INGRESS_NPU IXP2000_BOARD_IRQ(0)
121#define IRQ_IXDP2400_ENET IXP2000_BOARD_IRQ(1)
122#define IRQ_IXDP2400_MEDIA_PCI IXP2000_BOARD_IRQ(2)
123#define IRQ_IXDP2400_MEDIA_SP IXP2000_BOARD_IRQ(3)
124#define IRQ_IXDP2400_SF_PCI IXP2000_BOARD_IRQ(4)
125#define IRQ_IXDP2400_SF_SP IXP2000_BOARD_IRQ(5)
126#define IRQ_IXDP2400_PMC IXP2000_BOARD_IRQ(6)
127#define IRQ_IXDP2400_TVM IXP2000_BOARD_IRQ(7)
128
129#define NR_IXDP2400_IRQS ((IRQ_IXDP2400_TVM)+1)
130#define IXDP2400_NR_IRQS NR_IXDP2400_IRQS - NR_IXP2000_IRQS
131
132/* IXDP2800 specific IRQs */
133#define IRQ_IXDP2800_EGRESS_ENET IXP2000_BOARD_IRQ(0)
134#define IRQ_IXDP2800_INGRESS_NPU IXP2000_BOARD_IRQ(1)
135#define IRQ_IXDP2800_PMC IXP2000_BOARD_IRQ(2)
136#define IRQ_IXDP2800_FABRIC_PCI IXP2000_BOARD_IRQ(3)
137#define IRQ_IXDP2800_FABRIC IXP2000_BOARD_IRQ(4)
138#define IRQ_IXDP2800_MEDIA IXP2000_BOARD_IRQ(5)
139
140#define NR_IXDP2800_IRQS ((IRQ_IXDP2800_MEDIA)+1)
141#define IXDP2800_NR_IRQS NR_IXDP2800_IRQS - NR_IXP2000_IRQS
142
143/*
144 * IRQs on both IXDP2x01 boards
145 */
146#define IRQ_IXDP2X01_SPCI_DB_0 IXP2000_BOARD_IRQ(2)
147#define IRQ_IXDP2X01_SPCI_DB_1 IXP2000_BOARD_IRQ(3)
148#define IRQ_IXDP2X01_SPCI_PMC_INTA IXP2000_BOARD_IRQ(4)
149#define IRQ_IXDP2X01_SPCI_PMC_INTB IXP2000_BOARD_IRQ(5)
150#define IRQ_IXDP2X01_SPCI_PMC_INTC IXP2000_BOARD_IRQ(6)
151#define IRQ_IXDP2X01_SPCI_PMC_INTD IXP2000_BOARD_IRQ(7)
152#define IRQ_IXDP2X01_SPCI_FIC_INT IXP2000_BOARD_IRQ(8)
153#define IRQ_IXDP2X01_IPMI_FROM IXP2000_BOARD_IRQ(16)
154#define IRQ_IXDP2X01_125US IXP2000_BOARD_IRQ(17)
155#define IRQ_IXDP2X01_DB_0_ADD IXP2000_BOARD_IRQ(18)
156#define IRQ_IXDP2X01_DB_1_ADD IXP2000_BOARD_IRQ(19)
157#define IRQ_IXDP2X01_UART1 IXP2000_BOARD_IRQ(21)
158#define IRQ_IXDP2X01_UART2 IXP2000_BOARD_IRQ(22)
159#define IRQ_IXDP2X01_FIC_ADD_INT IXP2000_BOARD_IRQ(24)
160#define IRQ_IXDP2X01_CS8900 IXP2000_BOARD_IRQ(25)
161#define IRQ_IXDP2X01_BBSRAM IXP2000_BOARD_IRQ(26)
162
163#define IXDP2X01_VALID_IRQ_MASK ( \
164 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_DB_0) | \
165 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_DB_1) | \
166 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_PMC_INTA) | \
167 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_PMC_INTB) | \
168 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_PMC_INTC) | \
169 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_PMC_INTD) | \
170 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_FIC_INT) | \
171 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_IPMI_FROM) | \
172 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_125US) | \
173 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_DB_0_ADD) | \
174 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_DB_1_ADD) | \
175 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_UART1) | \
176 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_UART2) | \
177 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_FIC_ADD_INT) | \
178 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_CS8900) | \
179 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_BBSRAM) )
180
181/*
182 * IXDP2401 specific IRQs
183 */
184#define IRQ_IXDP2401_INTA_82546 IXP2000_BOARD_IRQ(0)
185#define IRQ_IXDP2401_INTB_82546 IXP2000_BOARD_IRQ(1)
186
187#define IXDP2401_VALID_IRQ_MASK ( \
188 IXDP2X01_VALID_IRQ_MASK | \
189 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2401_INTA_82546) |\
190 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2401_INTB_82546))
191
192/*
193 * IXDP2801-specific IRQs
194 */
195#define IRQ_IXDP2801_RIV IXP2000_BOARD_IRQ(0)
196#define IRQ_IXDP2801_CNFG_MEDIA IXP2000_BOARD_IRQ(27)
197#define IRQ_IXDP2801_CLOCK_REF IXP2000_BOARD_IRQ(28)
198
199#define IXDP2801_VALID_IRQ_MASK ( \
200 IXDP2X01_VALID_IRQ_MASK | \
201 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2801_RIV) |\
202 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2801_CNFG_MEDIA) |\
203 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2801_CLOCK_REF))
204
205#define NR_IXDP2X01_IRQS ((IRQ_IXDP2801_CLOCK_REF) + 1)
206
207#endif /*_IRQS_H*/
diff --git a/arch/arm/mach-ixp2000/include/mach/ixdp2x00.h b/arch/arm/mach-ixp2000/include/mach/ixdp2x00.h
new file mode 100644
index 000000000000..5df8479d9481
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/ixdp2x00.h
@@ -0,0 +1,92 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/ixdp2x00.h
3 *
4 * Register and other defines for IXDP2[48]00 platforms
5 *
6 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
7 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
8 *
9 * Copyright (C) 2002 Intel Corp.
10 * Copyright (C) 2003-2004 MontaVista Software, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#ifndef _IXDP2X00_H_
18#define _IXDP2X00_H_
19
20/*
21 * On board CPLD memory map
22 */
23#define IXDP2X00_PHYS_CPLD_BASE 0xc7000000
24#define IXDP2X00_VIRT_CPLD_BASE 0xfe000000
25#define IXDP2X00_CPLD_SIZE 0x00100000
26
27
28#define IXDP2X00_CPLD_REG(x) \
29 (volatile unsigned long *)(IXDP2X00_VIRT_CPLD_BASE | x)
30
31/*
32 * IXDP2400 CPLD registers
33 */
34#define IXDP2400_CPLD_SYSLED IXDP2X00_CPLD_REG(0x0)
35#define IXDP2400_CPLD_DISP_DATA IXDP2X00_CPLD_REG(0x4)
36#define IXDP2400_CPLD_CLOCK_SPEED IXDP2X00_CPLD_REG(0x8)
37#define IXDP2400_CPLD_INT_STAT IXDP2X00_CPLD_REG(0xc)
38#define IXDP2400_CPLD_REV IXDP2X00_CPLD_REG(0x10)
39#define IXDP2400_CPLD_SYS_CLK_M IXDP2X00_CPLD_REG(0x14)
40#define IXDP2400_CPLD_SYS_CLK_N IXDP2X00_CPLD_REG(0x18)
41#define IXDP2400_CPLD_INT_MASK IXDP2X00_CPLD_REG(0x48)
42
43/*
44 * IXDP2800 CPLD registers
45 */
46#define IXDP2800_CPLD_INT_STAT IXDP2X00_CPLD_REG(0x0)
47#define IXDP2800_CPLD_INT_MASK IXDP2X00_CPLD_REG(0x140)
48
49
50#define IXDP2X00_GPIO_I2C_ENABLE 0x02
51#define IXDP2X00_GPIO_SCL 0x07
52#define IXDP2X00_GPIO_SDA 0x06
53
54/*
55 * PCI devfns for on-board devices. We need these to be able to
56 * properly translate IRQs and for device removal.
57 */
58#define IXDP2400_SLAVE_ENET_DEVFN 0x18 /* Bus 1 */
59#define IXDP2400_MASTER_ENET_DEVFN 0x20 /* Bus 1 */
60#define IXDP2400_MEDIA_DEVFN 0x28 /* Bus 1 */
61#define IXDP2400_SWITCH_FABRIC_DEVFN 0x30 /* Bus 1 */
62
63#define IXDP2800_SLAVE_ENET_DEVFN 0x20 /* Bus 1 */
64#define IXDP2800_MASTER_ENET_DEVFN 0x18 /* Bus 1 */
65#define IXDP2800_SWITCH_FABRIC_DEVFN 0x30 /* Bus 1 */
66
67#define IXDP2X00_P2P_DEVFN 0x20 /* Bus 0 */
68#define IXDP2X00_21555_DEVFN 0x30 /* Bus 0 */
69#define IXDP2X00_SLAVE_NPU_DEVFN 0x28 /* Bus 1 */
70#define IXDP2X00_PMC_DEVFN 0x38 /* Bus 1 */
71#define IXDP2X00_MASTER_NPU_DEVFN 0x38 /* Bus 1 */
72
73#ifndef __ASSEMBLY__
74/*
75 * The master NPU is always PCI master.
76 */
77static inline unsigned int ixdp2x00_master_npu(void)
78{
79 return !!ixp2000_is_pcimaster();
80}
81
82/*
83 * Helper functions used by ixdp2400 and ixdp2800 specific code
84 */
85void ixdp2x00_init_irq(volatile unsigned long*, volatile unsigned long *, unsigned long);
86void ixdp2x00_slave_pci_postinit(void);
87void ixdp2x00_init_machine(void);
88void ixdp2x00_map_io(void);
89
90#endif
91
92#endif /*_IXDP2X00_H_ */
diff --git a/arch/arm/mach-ixp2000/include/mach/ixdp2x01.h b/arch/arm/mach-ixp2000/include/mach/ixdp2x01.h
new file mode 100644
index 000000000000..4c1f04083e54
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/ixdp2x01.h
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/ixdp2x01.h
3 *
4 * Platform definitions for IXDP2X01 && IXDP2801 systems
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista Software, Inc.
9 *
10 * Based on original code Copyright (c) 2002-2003 Intel Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#ifndef __IXDP2X01_H__
18#define __IXDP2X01_H__
19
20#define IXDP2X01_PHYS_CPLD_BASE 0xc6024000
21#define IXDP2X01_VIRT_CPLD_BASE 0xfe000000
22#define IXDP2X01_CPLD_REGION_SIZE 0x00100000
23
24#define IXDP2X01_CPLD_VIRT_REG(reg) (volatile unsigned long*)(IXDP2X01_VIRT_CPLD_BASE | reg)
25#define IXDP2X01_CPLD_PHYS_REG(reg) (IXDP2X01_PHYS_CPLD_BASE | reg)
26
27#define IXDP2X01_UART1_VIRT_BASE IXDP2X01_CPLD_VIRT_REG(0x40)
28#define IXDP2X01_UART1_PHYS_BASE IXDP2X01_CPLD_PHYS_REG(0x40)
29
30#define IXDP2X01_UART2_VIRT_BASE IXDP2X01_CPLD_VIRT_REG(0x60)
31#define IXDP2X01_UART2_PHYS_BASE IXDP2X01_CPLD_PHYS_REG(0x60)
32
33#define IXDP2X01_CS8900_VIRT_BASE IXDP2X01_CPLD_VIRT_REG(0x80)
34#define IXDP2X01_CS8900_VIRT_END (IXDP2X01_CS8900_VIRT_BASE + 16)
35
36#define IXDP2X01_CPLD_RESET_REG IXDP2X01_CPLD_VIRT_REG(0x00)
37#define IXDP2X01_INT_MASK_SET_REG IXDP2X01_CPLD_VIRT_REG(0x08)
38#define IXDP2X01_INT_STAT_REG IXDP2X01_CPLD_VIRT_REG(0x0C)
39#define IXDP2X01_INT_RAW_REG IXDP2X01_CPLD_VIRT_REG(0x10)
40#define IXDP2X01_INT_MASK_CLR_REG IXDP2X01_INT_RAW_REG
41#define IXDP2X01_INT_SIM_REG IXDP2X01_CPLD_VIRT_REG(0x14)
42
43#define IXDP2X01_CPLD_FLASH_REG IXDP2X01_CPLD_VIRT_REG(0x20)
44
45#define IXDP2X01_CPLD_FLASH_INTERN 0x8000
46#define IXDP2X01_CPLD_FLASH_BANK_MASK 0xF
47#define IXDP2X01_FLASH_WINDOW_BITS 25
48#define IXDP2X01_FLASH_WINDOW_SIZE (1 << IXDP2X01_FLASH_WINDOW_BITS)
49#define IXDP2X01_FLASH_WINDOW_MASK (IXDP2X01_FLASH_WINDOW_SIZE - 1)
50
51#define IXDP2X01_UART_CLK 1843200
52
53#define IXDP2X01_GPIO_I2C_ENABLE 0x02
54#define IXDP2X01_GPIO_SCL 0x07
55#define IXDP2X01_GPIO_SDA 0x06
56
57#endif /* __IXDP2x01_H__ */
diff --git a/arch/arm/mach-ixp2000/include/mach/ixp2000-regs.h b/arch/arm/mach-ixp2000/include/mach/ixp2000-regs.h
new file mode 100644
index 000000000000..19d80379a3e3
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/ixp2000-regs.h
@@ -0,0 +1,457 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/ixp2000-regs.h
3 *
4 * Chipset register definitions for IXP2400/2800 based systems.
5 *
6 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
7 *
8 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
9 *
10 * Copyright (C) 2002 Intel Corp.
11 * Copyright (C) 2003-2004 MontaVista Software, Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18#ifndef _IXP2000_REGS_H_
19#define _IXP2000_REGS_H_
20
21/*
22 * IXP2000 linux memory map:
23 *
24 * virt phys size
25 * fb000000 db000000 16M PCI CFG1
26 * fc000000 da000000 16M PCI CFG0
27 * fd000000 d8000000 16M PCI I/O
28 * fe[0-7]00000 8M per-platform mappings
29 * fe900000 80000000 1M SRAM #0 (first MB)
30 * fea00000 cb400000 1M SCRATCH ring get/put
31 * feb00000 c8000000 1M MSF
32 * fec00000 df000000 1M PCI CSRs
33 * fed00000 de000000 1M PCI CREG
34 * fee00000 d6000000 1M INTCTL
35 * fef00000 c0000000 1M CAP
36 */
37
38/*
39 * Static I/O regions.
40 *
41 * Most of the registers are clumped in 4K regions spread throughout
42 * the 0xc0000000 -> 0xc0100000 address range, but we just map in
43 * the whole range using a single 1 MB section instead of small
44 * 4K pages. This has two advantages for us:
45 *
46 * 1) We use only one TLB entry for large number of on-chip I/O devices.
47 *
48 * 2) We can easily set the Section attributes to XCB=101 on the IXP2400
49 * as required per erratum #66. We accomplish this by using a
50 * new MT_IXP2000_DEVICE memory type with the bits set as required.
51 *
52 * CAP stands for CSR Access Proxy.
53 *
54 * If you change the virtual address of this mapping, please propagate
55 * the change to arch/arm/kernel/debug.S, which hardcodes the virtual
56 * address of the UART located in this region.
57 */
58
59#define IXP2000_CAP_PHYS_BASE 0xc0000000
60#define IXP2000_CAP_VIRT_BASE 0xfef00000
61#define IXP2000_CAP_SIZE 0x00100000
62
63/*
64 * Addresses for specific on-chip peripherals.
65 */
66#define IXP2000_SLOWPORT_CSR_VIRT_BASE 0xfef80000
67#define IXP2000_GLOBAL_REG_VIRT_BASE 0xfef04000
68#define IXP2000_UART_PHYS_BASE 0xc0030000
69#define IXP2000_UART_VIRT_BASE 0xfef30000
70#define IXP2000_TIMER_VIRT_BASE 0xfef20000
71#define IXP2000_UENGINE_CSR_VIRT_BASE 0xfef18000
72#define IXP2000_GPIO_VIRT_BASE 0xfef10000
73
74/*
75 * Devices outside of the 0xc0000000 -> 0xc0100000 range. The virtual
76 * addresses of the INTCTL and PCI_CSR mappings are hardcoded in
77 * entry-macro.S, so if you ever change these please propagate
78 * the change.
79 */
80#define IXP2000_INTCTL_PHYS_BASE 0xd6000000
81#define IXP2000_INTCTL_VIRT_BASE 0xfee00000
82#define IXP2000_INTCTL_SIZE 0x00100000
83
84#define IXP2000_PCI_CREG_PHYS_BASE 0xde000000
85#define IXP2000_PCI_CREG_VIRT_BASE 0xfed00000
86#define IXP2000_PCI_CREG_SIZE 0x00100000
87
88#define IXP2000_PCI_CSR_PHYS_BASE 0xdf000000
89#define IXP2000_PCI_CSR_VIRT_BASE 0xfec00000
90#define IXP2000_PCI_CSR_SIZE 0x00100000
91
92#define IXP2000_MSF_PHYS_BASE 0xc8000000
93#define IXP2000_MSF_VIRT_BASE 0xfeb00000
94#define IXP2000_MSF_SIZE 0x00100000
95
96#define IXP2000_SCRATCH_RING_PHYS_BASE 0xcb400000
97#define IXP2000_SCRATCH_RING_VIRT_BASE 0xfea00000
98#define IXP2000_SCRATCH_RING_SIZE 0x00100000
99
100#define IXP2000_SRAM0_PHYS_BASE 0x80000000
101#define IXP2000_SRAM0_VIRT_BASE 0xfe900000
102#define IXP2000_SRAM0_SIZE 0x00100000
103
104#define IXP2000_PCI_IO_PHYS_BASE 0xd8000000
105#define IXP2000_PCI_IO_VIRT_BASE 0xfd000000
106#define IXP2000_PCI_IO_SIZE 0x01000000
107
108#define IXP2000_PCI_CFG0_PHYS_BASE 0xda000000
109#define IXP2000_PCI_CFG0_VIRT_BASE 0xfc000000
110#define IXP2000_PCI_CFG0_SIZE 0x01000000
111
112#define IXP2000_PCI_CFG1_PHYS_BASE 0xdb000000
113#define IXP2000_PCI_CFG1_VIRT_BASE 0xfb000000
114#define IXP2000_PCI_CFG1_SIZE 0x01000000
115
116/*
117 * Timers
118 */
119#define IXP2000_TIMER_REG(x) ((volatile unsigned long*)(IXP2000_TIMER_VIRT_BASE | (x)))
120/* Timer control */
121#define IXP2000_T1_CTL IXP2000_TIMER_REG(0x00)
122#define IXP2000_T2_CTL IXP2000_TIMER_REG(0x04)
123#define IXP2000_T3_CTL IXP2000_TIMER_REG(0x08)
124#define IXP2000_T4_CTL IXP2000_TIMER_REG(0x0c)
125/* Store initial value */
126#define IXP2000_T1_CLD IXP2000_TIMER_REG(0x10)
127#define IXP2000_T2_CLD IXP2000_TIMER_REG(0x14)
128#define IXP2000_T3_CLD IXP2000_TIMER_REG(0x18)
129#define IXP2000_T4_CLD IXP2000_TIMER_REG(0x1c)
130/* Read current value */
131#define IXP2000_T1_CSR IXP2000_TIMER_REG(0x20)
132#define IXP2000_T2_CSR IXP2000_TIMER_REG(0x24)
133#define IXP2000_T3_CSR IXP2000_TIMER_REG(0x28)
134#define IXP2000_T4_CSR IXP2000_TIMER_REG(0x2c)
135/* Clear associated timer interrupt */
136#define IXP2000_T1_CLR IXP2000_TIMER_REG(0x30)
137#define IXP2000_T2_CLR IXP2000_TIMER_REG(0x34)
138#define IXP2000_T3_CLR IXP2000_TIMER_REG(0x38)
139#define IXP2000_T4_CLR IXP2000_TIMER_REG(0x3c)
140/* Timer watchdog enable for T4 */
141#define IXP2000_TWDE IXP2000_TIMER_REG(0x40)
142
143#define WDT_ENABLE 0x00000001
144#define TIMER_DIVIDER_256 0x00000008
145#define TIMER_ENABLE 0x00000080
146#define IRQ_MASK_TIMER1 (1 << 4)
147
148/*
149 * Interrupt controller registers
150 */
151#define IXP2000_INTCTL_REG(x) (volatile unsigned long*)(IXP2000_INTCTL_VIRT_BASE | (x))
152#define IXP2000_IRQ_STATUS IXP2000_INTCTL_REG(0x08)
153#define IXP2000_IRQ_ENABLE IXP2000_INTCTL_REG(0x10)
154#define IXP2000_IRQ_ENABLE_SET IXP2000_INTCTL_REG(0x10)
155#define IXP2000_IRQ_ENABLE_CLR IXP2000_INTCTL_REG(0x18)
156#define IXP2000_FIQ_ENABLE_CLR IXP2000_INTCTL_REG(0x14)
157#define IXP2000_IRQ_ERR_STATUS IXP2000_INTCTL_REG(0x24)
158#define IXP2000_IRQ_ERR_ENABLE_SET IXP2000_INTCTL_REG(0x2c)
159#define IXP2000_FIQ_ERR_ENABLE_CLR IXP2000_INTCTL_REG(0x30)
160#define IXP2000_IRQ_ERR_ENABLE_CLR IXP2000_INTCTL_REG(0x34)
161#define IXP2000_IRQ_THD_RAW_STATUS_A_0 IXP2000_INTCTL_REG(0x60)
162#define IXP2000_IRQ_THD_RAW_STATUS_A_1 IXP2000_INTCTL_REG(0x64)
163#define IXP2000_IRQ_THD_RAW_STATUS_A_2 IXP2000_INTCTL_REG(0x68)
164#define IXP2000_IRQ_THD_RAW_STATUS_A_3 IXP2000_INTCTL_REG(0x6c)
165#define IXP2000_IRQ_THD_RAW_STATUS_B_0 IXP2000_INTCTL_REG(0x80)
166#define IXP2000_IRQ_THD_RAW_STATUS_B_1 IXP2000_INTCTL_REG(0x84)
167#define IXP2000_IRQ_THD_RAW_STATUS_B_2 IXP2000_INTCTL_REG(0x88)
168#define IXP2000_IRQ_THD_RAW_STATUS_B_3 IXP2000_INTCTL_REG(0x8c)
169#define IXP2000_IRQ_THD_STATUS_A_0 IXP2000_INTCTL_REG(0xe0)
170#define IXP2000_IRQ_THD_STATUS_A_1 IXP2000_INTCTL_REG(0xe4)
171#define IXP2000_IRQ_THD_STATUS_A_2 IXP2000_INTCTL_REG(0xe8)
172#define IXP2000_IRQ_THD_STATUS_A_3 IXP2000_INTCTL_REG(0xec)
173#define IXP2000_IRQ_THD_STATUS_B_0 IXP2000_INTCTL_REG(0x100)
174#define IXP2000_IRQ_THD_STATUS_B_1 IXP2000_INTCTL_REG(0x104)
175#define IXP2000_IRQ_THD_STATUS_B_2 IXP2000_INTCTL_REG(0x108)
176#define IXP2000_IRQ_THD_STATUS_B_3 IXP2000_INTCTL_REG(0x10c)
177#define IXP2000_IRQ_THD_ENABLE_SET_A_0 IXP2000_INTCTL_REG(0x160)
178#define IXP2000_IRQ_THD_ENABLE_SET_A_1 IXP2000_INTCTL_REG(0x164)
179#define IXP2000_IRQ_THD_ENABLE_SET_A_2 IXP2000_INTCTL_REG(0x168)
180#define IXP2000_IRQ_THD_ENABLE_SET_A_3 IXP2000_INTCTL_REG(0x16c)
181#define IXP2000_IRQ_THD_ENABLE_SET_B_0 IXP2000_INTCTL_REG(0x180)
182#define IXP2000_IRQ_THD_ENABLE_SET_B_1 IXP2000_INTCTL_REG(0x184)
183#define IXP2000_IRQ_THD_ENABLE_SET_B_2 IXP2000_INTCTL_REG(0x188)
184#define IXP2000_IRQ_THD_ENABLE_SET_B_3 IXP2000_INTCTL_REG(0x18c)
185#define IXP2000_IRQ_THD_ENABLE_CLEAR_A_0 IXP2000_INTCTL_REG(0x1e0)
186#define IXP2000_IRQ_THD_ENABLE_CLEAR_A_1 IXP2000_INTCTL_REG(0x1e4)
187#define IXP2000_IRQ_THD_ENABLE_CLEAR_A_2 IXP2000_INTCTL_REG(0x1e8)
188#define IXP2000_IRQ_THD_ENABLE_CLEAR_A_3 IXP2000_INTCTL_REG(0x1ec)
189#define IXP2000_IRQ_THD_ENABLE_CLEAR_B_0 IXP2000_INTCTL_REG(0x200)
190#define IXP2000_IRQ_THD_ENABLE_CLEAR_B_1 IXP2000_INTCTL_REG(0x204)
191#define IXP2000_IRQ_THD_ENABLE_CLEAR_B_2 IXP2000_INTCTL_REG(0x208)
192#define IXP2000_IRQ_THD_ENABLE_CLEAR_B_3 IXP2000_INTCTL_REG(0x20c)
193
194/*
195 * Mask of valid IRQs in the 32-bit IRQ register. We use
196 * this to mark certain IRQs as being invalid.
197 */
198#define IXP2000_VALID_IRQ_MASK 0x0f0fffff
199
200/*
201 * PCI config register access from core
202 */
203#define IXP2000_PCI_CREG(x) (volatile unsigned long*)(IXP2000_PCI_CREG_VIRT_BASE | (x))
204#define IXP2000_PCI_CMDSTAT IXP2000_PCI_CREG(0x04)
205#define IXP2000_PCI_CSR_BAR IXP2000_PCI_CREG(0x10)
206#define IXP2000_PCI_SRAM_BAR IXP2000_PCI_CREG(0x14)
207#define IXP2000_PCI_SDRAM_BAR IXP2000_PCI_CREG(0x18)
208
209/*
210 * PCI CSRs
211 */
212#define IXP2000_PCI_CSR(x) (volatile unsigned long*)(IXP2000_PCI_CSR_VIRT_BASE | (x))
213
214/*
215 * PCI outbound interrupts
216 */
217#define IXP2000_PCI_OUT_INT_STATUS IXP2000_PCI_CSR(0x30)
218#define IXP2000_PCI_OUT_INT_MASK IXP2000_PCI_CSR(0x34)
219/*
220 * PCI communications
221 */
222#define IXP2000_PCI_MAILBOX0 IXP2000_PCI_CSR(0x50)
223#define IXP2000_PCI_MAILBOX1 IXP2000_PCI_CSR(0x54)
224#define IXP2000_PCI_MAILBOX2 IXP2000_PCI_CSR(0x58)
225#define IXP2000_PCI_MAILBOX3 IXP2000_PCI_CSR(0x5C)
226#define IXP2000_XSCALE_DOORBELL IXP2000_PCI_CSR(0x60)
227#define IXP2000_XSCALE_DOORBELL_SETUP IXP2000_PCI_CSR(0x64)
228#define IXP2000_PCI_DOORBELL IXP2000_PCI_CSR(0x70)
229#define IXP2000_PCI_DOORBELL_SETUP IXP2000_PCI_CSR(0x74)
230
231/*
232 * DMA engines
233 */
234#define IXP2000_PCI_CH1_BYTE_CNT IXP2000_PCI_CSR(0x80)
235#define IXP2000_PCI_CH1_ADDR IXP2000_PCI_CSR(0x84)
236#define IXP2000_PCI_CH1_DRAM_ADDR IXP2000_PCI_CSR(0x88)
237#define IXP2000_PCI_CH1_DESC_PTR IXP2000_PCI_CSR(0x8C)
238#define IXP2000_PCI_CH1_CNTRL IXP2000_PCI_CSR(0x90)
239#define IXP2000_PCI_CH1_ME_PARAM IXP2000_PCI_CSR(0x94)
240#define IXP2000_PCI_CH2_BYTE_CNT IXP2000_PCI_CSR(0xA0)
241#define IXP2000_PCI_CH2_ADDR IXP2000_PCI_CSR(0xA4)
242#define IXP2000_PCI_CH2_DRAM_ADDR IXP2000_PCI_CSR(0xA8)
243#define IXP2000_PCI_CH2_DESC_PTR IXP2000_PCI_CSR(0xAC)
244#define IXP2000_PCI_CH2_CNTRL IXP2000_PCI_CSR(0xB0)
245#define IXP2000_PCI_CH2_ME_PARAM IXP2000_PCI_CSR(0xB4)
246#define IXP2000_PCI_CH3_BYTE_CNT IXP2000_PCI_CSR(0xC0)
247#define IXP2000_PCI_CH3_ADDR IXP2000_PCI_CSR(0xC4)
248#define IXP2000_PCI_CH3_DRAM_ADDR IXP2000_PCI_CSR(0xC8)
249#define IXP2000_PCI_CH3_DESC_PTR IXP2000_PCI_CSR(0xCC)
250#define IXP2000_PCI_CH3_CNTRL IXP2000_PCI_CSR(0xD0)
251#define IXP2000_PCI_CH3_ME_PARAM IXP2000_PCI_CSR(0xD4)
252#define IXP2000_DMA_INF_MODE IXP2000_PCI_CSR(0xE0)
253/*
254 * Size masks for BARs
255 */
256#define IXP2000_PCI_SRAM_BASE_ADDR_MASK IXP2000_PCI_CSR(0xFC)
257#define IXP2000_PCI_DRAM_BASE_ADDR_MASK IXP2000_PCI_CSR(0x100)
258/*
259 * Control and uEngine related
260 */
261#define IXP2000_PCI_CONTROL IXP2000_PCI_CSR(0x13C)
262#define IXP2000_PCI_ADDR_EXT IXP2000_PCI_CSR(0x140)
263#define IXP2000_PCI_ME_PUSH_STATUS IXP2000_PCI_CSR(0x148)
264#define IXP2000_PCI_ME_PUSH_EN IXP2000_PCI_CSR(0x14C)
265#define IXP2000_PCI_ERR_STATUS IXP2000_PCI_CSR(0x150)
266#define IXP2000_PCI_ERR_ENABLE IXP2000_PCI_CSR(0x154)
267/*
268 * Inbound PCI interrupt control
269 */
270#define IXP2000_PCI_XSCALE_INT_STATUS IXP2000_PCI_CSR(0x158)
271#define IXP2000_PCI_XSCALE_INT_ENABLE IXP2000_PCI_CSR(0x15C)
272
273#define IXP2000_PCICNTL_PNR (1<<17) /* PCI not Reset bit of PCI_CONTROL */
274#define IXP2000_PCICNTL_PCF (1<<28) /* PCI Central function bit */
275#define IXP2000_XSCALE_INT (1<<1) /* Interrupt from XScale to PCI */
276
277/* These are from the IRQ register in the PCI ISR register */
278#define PCI_CONTROL_BE_DEO (1 << 22) /* Big Endian Data Enable Out */
279#define PCI_CONTROL_BE_DEI (1 << 21) /* Big Endian Data Enable In */
280#define PCI_CONTROL_BE_BEO (1 << 20) /* Big Endian Byte Enable Out */
281#define PCI_CONTROL_BE_BEI (1 << 19) /* Big Endian Byte Enable In */
282#define PCI_CONTROL_IEE (1 << 17) /* I/O cycle Endian swap Enable */
283
284#define IXP2000_PCI_RST_REL (1 << 2)
285#define CFG_RST_DIR (*IXP2000_PCI_CONTROL & IXP2000_PCICNTL_PCF)
286#define CFG_PCI_BOOT_HOST (1 << 2)
287#define CFG_BOOT_PROM (1 << 1)
288
289/*
290 * SlowPort CSRs
291 *
292 * The slowport is used to access things like flash, SONET framer control
293 * ports, slave microprocessors, CPLDs, and others of chip memory mapped
294 * peripherals.
295 */
296#define SLOWPORT_CSR(x) (volatile unsigned long*)(IXP2000_SLOWPORT_CSR_VIRT_BASE | (x))
297
298#define IXP2000_SLOWPORT_CCR SLOWPORT_CSR(0x00)
299#define IXP2000_SLOWPORT_WTC1 SLOWPORT_CSR(0x04)
300#define IXP2000_SLOWPORT_WTC2 SLOWPORT_CSR(0x08)
301#define IXP2000_SLOWPORT_RTC1 SLOWPORT_CSR(0x0c)
302#define IXP2000_SLOWPORT_RTC2 SLOWPORT_CSR(0x10)
303#define IXP2000_SLOWPORT_FSR SLOWPORT_CSR(0x14)
304#define IXP2000_SLOWPORT_PCR SLOWPORT_CSR(0x18)
305#define IXP2000_SLOWPORT_ADC SLOWPORT_CSR(0x1C)
306#define IXP2000_SLOWPORT_FAC SLOWPORT_CSR(0x20)
307#define IXP2000_SLOWPORT_FRM SLOWPORT_CSR(0x24)
308#define IXP2000_SLOWPORT_FIN SLOWPORT_CSR(0x28)
309
310/*
311 * CCR values.
312 * The CCR configures the clock division for the slowport interface.
313 */
314#define SLOWPORT_CCR_DIV_1 0x00
315#define SLOWPORT_CCR_DIV_2 0x01
316#define SLOWPORT_CCR_DIV_4 0x02
317#define SLOWPORT_CCR_DIV_6 0x03
318#define SLOWPORT_CCR_DIV_8 0x04
319#define SLOWPORT_CCR_DIV_10 0x05
320#define SLOWPORT_CCR_DIV_12 0x06
321#define SLOWPORT_CCR_DIV_14 0x07
322#define SLOWPORT_CCR_DIV_16 0x08
323#define SLOWPORT_CCR_DIV_18 0x09
324#define SLOWPORT_CCR_DIV_20 0x0a
325#define SLOWPORT_CCR_DIV_22 0x0b
326#define SLOWPORT_CCR_DIV_24 0x0c
327#define SLOWPORT_CCR_DIV_26 0x0d
328#define SLOWPORT_CCR_DIV_28 0x0e
329#define SLOWPORT_CCR_DIV_30 0x0f
330
331/*
332 * PCR values. PCR configure the mode of the interface.
333 */
334#define SLOWPORT_MODE_FLASH 0x00
335#define SLOWPORT_MODE_LUCENT 0x01
336#define SLOWPORT_MODE_PMC_SIERRA 0x02
337#define SLOWPORT_MODE_INTEL_UP 0x03
338#define SLOWPORT_MODE_MOTOROLA_UP 0x04
339
340/*
341 * ADC values. Defines data and address bus widths.
342 */
343#define SLOWPORT_ADDR_WIDTH_8 0x00
344#define SLOWPORT_ADDR_WIDTH_16 0x01
345#define SLOWPORT_ADDR_WIDTH_24 0x02
346#define SLOWPORT_ADDR_WIDTH_32 0x03
347#define SLOWPORT_DATA_WIDTH_8 0x00
348#define SLOWPORT_DATA_WIDTH_16 0x10
349#define SLOWPORT_DATA_WIDTH_24 0x20
350#define SLOWPORT_DATA_WIDTH_32 0x30
351
352/*
353 * Masks and shifts for various fields in the WTC and RTC registers.
354 */
355#define SLOWPORT_WRTC_MASK_HD 0x0003
356#define SLOWPORT_WRTC_MASK_PW 0x003c
357#define SLOWPORT_WRTC_MASK_SU 0x03c0
358
359#define SLOWPORT_WRTC_SHIFT_HD 0x00
360#define SLOWPORT_WRTC_SHIFT_SU 0x02
361#define SLOWPORT_WRTC_SHFIT_PW 0x06
362
363
364/*
365 * GPIO registers & GPIO interface.
366 */
367#define IXP2000_GPIO_REG(x) ((volatile unsigned long*)(IXP2000_GPIO_VIRT_BASE+(x)))
368#define IXP2000_GPIO_PLR IXP2000_GPIO_REG(0x00)
369#define IXP2000_GPIO_PDPR IXP2000_GPIO_REG(0x04)
370#define IXP2000_GPIO_PDSR IXP2000_GPIO_REG(0x08)
371#define IXP2000_GPIO_PDCR IXP2000_GPIO_REG(0x0c)
372#define IXP2000_GPIO_POPR IXP2000_GPIO_REG(0x10)
373#define IXP2000_GPIO_POSR IXP2000_GPIO_REG(0x14)
374#define IXP2000_GPIO_POCR IXP2000_GPIO_REG(0x18)
375#define IXP2000_GPIO_REDR IXP2000_GPIO_REG(0x1c)
376#define IXP2000_GPIO_FEDR IXP2000_GPIO_REG(0x20)
377#define IXP2000_GPIO_EDSR IXP2000_GPIO_REG(0x24)
378#define IXP2000_GPIO_LSHR IXP2000_GPIO_REG(0x28)
379#define IXP2000_GPIO_LSLR IXP2000_GPIO_REG(0x2c)
380#define IXP2000_GPIO_LDSR IXP2000_GPIO_REG(0x30)
381#define IXP2000_GPIO_INER IXP2000_GPIO_REG(0x34)
382#define IXP2000_GPIO_INSR IXP2000_GPIO_REG(0x38)
383#define IXP2000_GPIO_INCR IXP2000_GPIO_REG(0x3c)
384#define IXP2000_GPIO_INST IXP2000_GPIO_REG(0x40)
385
386/*
387 * "Global" registers...whatever that's supposed to mean.
388 */
389#define GLOBAL_REG_BASE (IXP2000_GLOBAL_REG_VIRT_BASE + 0x0a00)
390#define GLOBAL_REG(x) (volatile unsigned long*)(GLOBAL_REG_BASE | (x))
391
392#define IXP2000_MAJ_PROD_TYPE_MASK 0x001F0000
393#define IXP2000_MAJ_PROD_TYPE_IXP2000 0x00000000
394#define IXP2000_MIN_PROD_TYPE_MASK 0x0000FF00
395#define IXP2000_MIN_PROD_TYPE_IXP2400 0x00000200
396#define IXP2000_MIN_PROD_TYPE_IXP2850 0x00000100
397#define IXP2000_MIN_PROD_TYPE_IXP2800 0x00000000
398#define IXP2000_MAJ_REV_MASK 0x000000F0
399#define IXP2000_MIN_REV_MASK 0x0000000F
400#define IXP2000_PROD_ID_MASK 0xFFFFFFFF
401
402#define IXP2000_PRODUCT_ID GLOBAL_REG(0x00)
403#define IXP2000_MISC_CONTROL GLOBAL_REG(0x04)
404#define IXP2000_MSF_CLK_CNTRL GLOBAL_REG(0x08)
405#define IXP2000_RESET0 GLOBAL_REG(0x0c)
406#define IXP2000_RESET1 GLOBAL_REG(0x10)
407#define IXP2000_CCR GLOBAL_REG(0x14)
408#define IXP2000_STRAP_OPTIONS GLOBAL_REG(0x18)
409
410#define RSTALL (1 << 16)
411#define WDT_RESET_ENABLE 0x01000000
412
413
414/*
415 * MSF registers. The IXP2400 and IXP2800 have somewhat different MSF
416 * units, but the registers that differ between the two don't overlap,
417 * so we can have one register list for both.
418 */
419#define IXP2000_MSF_REG(x) ((volatile unsigned long*)(IXP2000_MSF_VIRT_BASE + (x)))
420#define IXP2000_MSF_RX_CONTROL IXP2000_MSF_REG(0x0000)
421#define IXP2000_MSF_TX_CONTROL IXP2000_MSF_REG(0x0004)
422#define IXP2000_MSF_INTERRUPT_STATUS IXP2000_MSF_REG(0x0008)
423#define IXP2000_MSF_INTERRUPT_ENABLE IXP2000_MSF_REG(0x000c)
424#define IXP2000_MSF_CSIX_TYPE_MAP IXP2000_MSF_REG(0x0010)
425#define IXP2000_MSF_FC_EGRESS_STATUS IXP2000_MSF_REG(0x0014)
426#define IXP2000_MSF_FC_INGRESS_STATUS IXP2000_MSF_REG(0x0018)
427#define IXP2000_MSF_HWM_CONTROL IXP2000_MSF_REG(0x0024)
428#define IXP2000_MSF_FC_STATUS_OVERRIDE IXP2000_MSF_REG(0x0028)
429#define IXP2000_MSF_CLOCK_CONTROL IXP2000_MSF_REG(0x002c)
430#define IXP2000_MSF_RX_PORT_MAP IXP2000_MSF_REG(0x0040)
431#define IXP2000_MSF_RBUF_ELEMENT_DONE IXP2000_MSF_REG(0x0044)
432#define IXP2000_MSF_RX_MPHY_POLL_LIMIT IXP2000_MSF_REG(0x0048)
433#define IXP2000_MSF_RX_CALENDAR_LENGTH IXP2000_MSF_REG(0x0048)
434#define IXP2000_MSF_RX_THREAD_FREELIST_TIMEOUT_0 IXP2000_MSF_REG(0x0050)
435#define IXP2000_MSF_RX_THREAD_FREELIST_TIMEOUT_1 IXP2000_MSF_REG(0x0054)
436#define IXP2000_MSF_RX_THREAD_FREELIST_TIMEOUT_2 IXP2000_MSF_REG(0x0058)
437#define IXP2000_MSF_TX_SEQUENCE_0 IXP2000_MSF_REG(0x0060)
438#define IXP2000_MSF_TX_SEQUENCE_1 IXP2000_MSF_REG(0x0064)
439#define IXP2000_MSF_TX_SEQUENCE_2 IXP2000_MSF_REG(0x0068)
440#define IXP2000_MSF_TX_MPHY_POLL_LIMIT IXP2000_MSF_REG(0x0070)
441#define IXP2000_MSF_TX_CALENDAR_LENGTH IXP2000_MSF_REG(0x0070)
442#define IXP2000_MSF_RX_UP_CONTROL_0 IXP2000_MSF_REG(0x0080)
443#define IXP2000_MSF_RX_UP_CONTROL_1 IXP2000_MSF_REG(0x0084)
444#define IXP2000_MSF_RX_UP_CONTROL_2 IXP2000_MSF_REG(0x0088)
445#define IXP2000_MSF_RX_UP_CONTROL_3 IXP2000_MSF_REG(0x008c)
446#define IXP2000_MSF_TX_UP_CONTROL_0 IXP2000_MSF_REG(0x0090)
447#define IXP2000_MSF_TX_UP_CONTROL_1 IXP2000_MSF_REG(0x0094)
448#define IXP2000_MSF_TX_UP_CONTROL_2 IXP2000_MSF_REG(0x0098)
449#define IXP2000_MSF_TX_UP_CONTROL_3 IXP2000_MSF_REG(0x009c)
450#define IXP2000_MSF_TRAIN_DATA IXP2000_MSF_REG(0x00a0)
451#define IXP2000_MSF_TRAIN_CALENDAR IXP2000_MSF_REG(0x00a4)
452#define IXP2000_MSF_TRAIN_FLOW_CONTROL IXP2000_MSF_REG(0x00a8)
453#define IXP2000_MSF_TX_CALENDAR_0 IXP2000_MSF_REG(0x1000)
454#define IXP2000_MSF_RX_PORT_CALENDAR_STATUS IXP2000_MSF_REG(0x1400)
455
456
457#endif /* _IXP2000_H_ */
diff --git a/arch/arm/mach-ixp2000/include/mach/memory.h b/arch/arm/mach-ixp2000/include/mach/memory.h
new file mode 100644
index 000000000000..241529a7c52d
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/memory.h
@@ -0,0 +1,34 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/memory.h
3 *
4 * Copyright (c) 2002 Intel Corp.
5 * Copyright (c) 2003-2004 MontaVista Software, Inc.
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 __ASM_ARCH_MEMORY_H
14#define __ASM_ARCH_MEMORY_H
15
16#define PHYS_OFFSET UL(0x00000000)
17
18/*
19 * Virtual view <-> DMA view memory address translations
20 * virt_to_bus: Used to translate the virtual address to an
21 * address suitable to be passed to set_dma_addr
22 * bus_to_virt: Used to convert an address for DMA operations
23 * to an address that the kernel can use.
24 */
25#include <mach/ixp2000-regs.h>
26
27#define __virt_to_bus(v) \
28 (((__virt_to_phys(v) - 0x0) + (*IXP2000_PCI_SDRAM_BAR & 0xfffffff0)))
29
30#define __bus_to_virt(b) \
31 __phys_to_virt((((b - (*IXP2000_PCI_SDRAM_BAR & 0xfffffff0)) + 0x0)))
32
33#endif
34
diff --git a/arch/arm/mach-ixp2000/include/mach/platform.h b/arch/arm/mach-ixp2000/include/mach/platform.h
new file mode 100644
index 000000000000..42182c79ed90
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/platform.h
@@ -0,0 +1,152 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/platform.h
3 *
4 * Various bits of code used by platform-level code.
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15
16#ifndef __ASSEMBLY__
17
18static inline unsigned long ixp2000_reg_read(volatile void *reg)
19{
20 return *((volatile unsigned long *)reg);
21}
22
23static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)
24{
25 *((volatile unsigned long *)reg) = val;
26}
27
28/*
29 * On the IXP2400, we can't use XCB=000 due to chip bugs. We use
30 * XCB=101 instead, but that makes all I/O accesses bufferable. This
31 * is not a problem in general, but we do have to be slightly more
32 * careful because I/O writes are no longer automatically flushed out
33 * of the write buffer.
34 *
35 * In cases where we want to make sure that a write has been flushed
36 * out of the write buffer before we proceed, for example when masking
37 * a device interrupt before re-enabling IRQs in CPSR, we can use this
38 * function, ixp2000_reg_wrb, which performs a write, a readback, and
39 * issues a dummy instruction dependent on the value of the readback
40 * (mov rX, rX) to make sure that the readback has completed before we
41 * continue.
42 */
43static inline void ixp2000_reg_wrb(volatile void *reg, unsigned long val)
44{
45 unsigned long dummy;
46
47 *((volatile unsigned long *)reg) = val;
48
49 dummy = *((volatile unsigned long *)reg);
50 __asm__ __volatile__("mov %0, %0" : "+r" (dummy));
51}
52
53/*
54 * Boards may multiplex different devices on the 2nd channel of
55 * the slowport interface that each need different configuration
56 * settings. For example, the IXDP2400 uses channel 2 on the interface
57 * to access the CPLD, the switch fabric card, and the media card. Each
58 * one needs a different mode so drivers must save/restore the mode
59 * before and after each operation.
60 *
61 * acquire_slowport(&your_config);
62 * ...
63 * do slowport operations
64 * ...
65 * release_slowport();
66 *
67 * Note that while you have the slowport, you are holding a spinlock,
68 * so your code should be written as if you explicitly acquired a lock.
69 *
70 * The configuration only affects device 2 on the slowport, so the
71 * MTD map driver does not acquire/release the slowport.
72 */
73struct slowport_cfg {
74 unsigned long CCR; /* Clock divide */
75 unsigned long WTC; /* Write Timing Control */
76 unsigned long RTC; /* Read Timing Control */
77 unsigned long PCR; /* Protocol Control Register */
78 unsigned long ADC; /* Address/Data Width Control */
79};
80
81
82void ixp2000_acquire_slowport(struct slowport_cfg *, struct slowport_cfg *);
83void ixp2000_release_slowport(struct slowport_cfg *);
84
85/*
86 * IXP2400 A0/A1 and IXP2800 A0/A1/A2 have broken slowport that requires
87 * tweaking of addresses in the MTD driver.
88 */
89static inline unsigned ixp2000_has_broken_slowport(void)
90{
91 unsigned long id = *IXP2000_PRODUCT_ID;
92 unsigned long id_prod = id & (IXP2000_MAJ_PROD_TYPE_MASK |
93 IXP2000_MIN_PROD_TYPE_MASK);
94 return (((id_prod ==
95 /* fixed in IXP2400-B0 */
96 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
97 IXP2000_MIN_PROD_TYPE_IXP2400)) &&
98 ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
99 ((id_prod ==
100 /* fixed in IXP2800-B0 */
101 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
102 IXP2000_MIN_PROD_TYPE_IXP2800)) &&
103 ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
104 ((id_prod ==
105 /* fixed in IXP2850-B0 */
106 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
107 IXP2000_MIN_PROD_TYPE_IXP2850)) &&
108 ((id & IXP2000_MAJ_REV_MASK) == 0)));
109}
110
111static inline unsigned int ixp2000_has_flash(void)
112{
113 return ((*IXP2000_STRAP_OPTIONS) & (CFG_BOOT_PROM));
114}
115
116static inline unsigned int ixp2000_is_pcimaster(void)
117{
118 return ((*IXP2000_STRAP_OPTIONS) & (CFG_PCI_BOOT_HOST));
119}
120
121void ixp2000_map_io(void);
122void ixp2000_uart_init(void);
123void ixp2000_init_irq(void);
124void ixp2000_init_time(unsigned long);
125unsigned long ixp2000_gettimeoffset(void);
126
127struct pci_sys_data;
128
129u32 *ixp2000_pci_config_addr(unsigned int bus, unsigned int devfn, int where);
130void ixp2000_pci_preinit(void);
131int ixp2000_pci_setup(int, struct pci_sys_data*);
132struct pci_bus* ixp2000_pci_scan_bus(int, struct pci_sys_data*);
133int ixp2000_pci_read_config(struct pci_bus*, unsigned int, int, int, u32 *);
134int ixp2000_pci_write_config(struct pci_bus*, unsigned int, int, int, u32);
135
136/*
137 * Several of the IXP2000 systems have banked flash so we need to extend the
138 * flash_platform_data structure with some private pointers
139 */
140struct ixp2000_flash_data {
141 struct flash_platform_data *platform_data;
142 int nr_banks;
143 unsigned long (*bank_setup)(unsigned long);
144};
145
146struct ixp2000_i2c_pins {
147 unsigned long sda_pin;
148 unsigned long scl_pin;
149};
150
151
152#endif /* !__ASSEMBLY__ */
diff --git a/arch/arm/mach-ixp2000/include/mach/system.h b/arch/arm/mach-ixp2000/include/mach/system.h
new file mode 100644
index 000000000000..2e9c68f95a24
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/system.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/system.h
3 *
4 * Copyright (C) 2002 Intel Corp.
5 * Copyricht (C) 2003-2005 MontaVista Software, Inc.
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#include <mach/hardware.h>
13#include <asm/mach-types.h>
14
15static inline void arch_idle(void)
16{
17 cpu_do_idle();
18}
19
20static inline void arch_reset(char mode)
21{
22 local_irq_disable();
23
24 /*
25 * Reset flash banking register so that we are pointing at
26 * RedBoot bank.
27 */
28 if (machine_is_ixdp2401()) {
29 ixp2000_reg_write(IXDP2X01_CPLD_FLASH_REG,
30 ((0 >> IXDP2X01_FLASH_WINDOW_BITS)
31 | IXDP2X01_CPLD_FLASH_INTERN));
32 ixp2000_reg_wrb(IXDP2X01_CPLD_RESET_REG, 0xffffffff);
33 }
34
35 /*
36 * On IXDP2801 we need to write this magic sequence to the CPLD
37 * to cause a complete reset of the CPU and all external devices
38 * and move the flash bank register back to 0.
39 */
40 if (machine_is_ixdp2801() || machine_is_ixdp28x5()) {
41 unsigned long reset_reg = *IXDP2X01_CPLD_RESET_REG;
42
43 reset_reg = 0x55AA0000 | (reset_reg & 0x0000FFFF);
44 ixp2000_reg_write(IXDP2X01_CPLD_RESET_REG, reset_reg);
45 ixp2000_reg_wrb(IXDP2X01_CPLD_RESET_REG, 0x80000000);
46 }
47
48 ixp2000_reg_wrb(IXP2000_RESET0, RSTALL);
49}
diff --git a/arch/arm/mach-ixp2000/include/mach/timex.h b/arch/arm/mach-ixp2000/include/mach/timex.h
new file mode 100644
index 000000000000..835e659f93d4
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/timex.h
@@ -0,0 +1,13 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/timex.h
3 *
4 * IXP2000 architecture timex specifications
5 */
6
7
8/*
9 * Default clock is 50MHz APB, but platform code can override this
10 */
11#define CLOCK_TICK_RATE 50000000
12
13
diff --git a/arch/arm/mach-ixp2000/include/mach/uncompress.h b/arch/arm/mach-ixp2000/include/mach/uncompress.h
new file mode 100644
index 000000000000..ce363087df78
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/uncompress.h
@@ -0,0 +1,47 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/uncompress.h
3 *
4 *
5 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
6 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2002 Intel Corp.
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
17#include <linux/serial_reg.h>
18
19#define UART_BASE 0xc0030000
20
21#define PHYS(x) ((volatile unsigned long *)(UART_BASE + x))
22
23#define UARTDR PHYS(0x00) /* Transmit reg dlab=0 */
24#define UARTDLL PHYS(0x00) /* Divisor Latch reg dlab=1*/
25#define UARTDLM PHYS(0x04) /* Divisor Latch reg dlab=1*/
26#define UARTIER PHYS(0x04) /* Interrupt enable reg */
27#define UARTFCR PHYS(0x08) /* FIFO control reg dlab =0*/
28#define UARTLCR PHYS(0x0c) /* Control reg */
29#define UARTSR PHYS(0x14) /* Status reg */
30
31
32static inline void putc(int c)
33{
34 int j = 0x1000;
35
36 while (--j && !(*UARTSR & UART_LSR_THRE))
37 barrier();
38
39 *UARTDR = c;
40}
41
42static inline void flush(void)
43{
44}
45
46#define arch_decomp_setup()
47#define arch_decomp_wdog()
diff --git a/arch/arm/mach-ixp2000/include/mach/vmalloc.h b/arch/arm/mach-ixp2000/include/mach/vmalloc.h
new file mode 100644
index 000000000000..d195e35aed3b
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/vmalloc.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/vmalloc.h
3 *
4 * Author: Naeem Afzal <naeem.m.afzal@intel.com>
5 *
6 * Copyright 2002 Intel Corp.
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 * Just any arbitrary offset to the start of the vmalloc VM area: the
14 * current 8MB value just means that there will be a 8MB "hole" after the
15 * physical memory until the kernel virtual memory starts. That means that
16 * any out-of-bounds memory accesses will hopefully be caught.
17 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
18 * area for the same reason. ;)
19 */
20#define VMALLOC_END 0xfb000000
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
index ce7c15c73004..c673b9ef9f69 100644
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ b/arch/arm/mach-ixp2000/ixdp2400.c
@@ -31,7 +31,7 @@
31#include <asm/pgtable.h> 31#include <asm/pgtable.h>
32#include <asm/page.h> 32#include <asm/page.h>
33#include <asm/system.h> 33#include <asm/system.h>
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36 36
37#include <asm/mach/pci.h> 37#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c
index 14f09b80ab77..6715b50829a6 100644
--- a/arch/arm/mach-ixp2000/ixdp2800.c
+++ b/arch/arm/mach-ixp2000/ixdp2800.c
@@ -31,7 +31,7 @@
31#include <asm/pgtable.h> 31#include <asm/pgtable.h>
32#include <asm/page.h> 32#include <asm/page.h>
33#include <asm/system.h> 33#include <asm/system.h>
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36 36
37#include <asm/mach/pci.h> 37#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c
index 73c651e83d92..5a781fd9757a 100644
--- a/arch/arm/mach-ixp2000/ixdp2x00.c
+++ b/arch/arm/mach-ixp2000/ixdp2x00.c
@@ -31,7 +31,7 @@
31#include <asm/pgtable.h> 31#include <asm/pgtable.h>
32#include <asm/page.h> 32#include <asm/page.h>
33#include <asm/system.h> 33#include <asm/system.h>
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36 36
37#include <asm/mach/pci.h> 37#include <asm/mach/pci.h>
@@ -41,7 +41,7 @@
41#include <asm/mach/flash.h> 41#include <asm/mach/flash.h>
42#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
43 43
44#include <asm/arch/gpio.h> 44#include <mach/gpio.h>
45 45
46 46
47/************************************************************************* 47/*************************************************************************
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c
index d3d730d2fc2b..78a2341dee2c 100644
--- a/arch/arm/mach-ixp2000/ixdp2x01.c
+++ b/arch/arm/mach-ixp2000/ixdp2x01.c
@@ -36,7 +36,7 @@
36#include <asm/pgtable.h> 36#include <asm/pgtable.h>
37#include <asm/page.h> 37#include <asm/page.h>
38#include <asm/system.h> 38#include <asm/system.h>
39#include <asm/hardware.h> 39#include <mach/hardware.h>
40#include <asm/mach-types.h> 40#include <asm/mach-types.h>
41 41
42#include <asm/mach/pci.h> 42#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-ixp2000/pci.c b/arch/arm/mach-ixp2000/pci.c
index 03f4cf7f9dec..03d916fbe531 100644
--- a/arch/arm/mach-ixp2000/pci.c
+++ b/arch/arm/mach-ixp2000/pci.c
@@ -28,7 +28,7 @@
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32 32
33#include <asm/mach/pci.h> 33#include <asm/mach/pci.h>
34 34
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
index df16a4eac490..68b4ac5b2481 100644
--- a/arch/arm/mach-ixp23xx/core.c
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -32,8 +32,7 @@
32#include <asm/types.h> 32#include <asm/types.h>
33#include <asm/setup.h> 33#include <asm/setup.h>
34#include <asm/memory.h> 34#include <asm/memory.h>
35#include <asm/hardware.h> 35#include <mach/hardware.h>
36#include <asm/mach-types.h>
37#include <asm/irq.h> 36#include <asm/irq.h>
38#include <asm/system.h> 37#include <asm/system.h>
39#include <asm/tlbflush.h> 38#include <asm/tlbflush.h>
diff --git a/arch/arm/mach-ixp23xx/espresso.c b/arch/arm/mach-ixp23xx/espresso.c
index d3a779a7a35f..1c06bfc5a7ef 100644
--- a/arch/arm/mach-ixp23xx/espresso.c
+++ b/arch/arm/mach-ixp23xx/espresso.c
@@ -29,7 +29,7 @@
29#include <asm/types.h> 29#include <asm/types.h>
30#include <asm/setup.h> 30#include <asm/setup.h>
31#include <asm/memory.h> 31#include <asm/memory.h>
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/system.h> 35#include <asm/system.h>
diff --git a/arch/arm/mach-ixp23xx/include/mach/debug-macro.S b/arch/arm/mach-ixp23xx/include/mach/debug-macro.S
new file mode 100644
index 000000000000..905db3188724
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/debug-macro.S
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/debug-macro.S
3 *
4 * Debugging macro include header
5 *
6 * Copyright (C) 1994-1999 Russell King
7 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <mach/ixp23xx.h>
14
15 .macro addruart,rx
16 mrc p15, 0, \rx, c1, c0
17 tst \rx, #1 @ mmu enabled?
18 ldreq \rx, =IXP23XX_PERIPHERAL_PHYS @ physical
19 ldrne \rx, =IXP23XX_PERIPHERAL_VIRT @ virtual
20#ifdef __ARMEB__
21 orr \rx, \rx, #0x00000003
22#endif
23 .endm
24
25#define UART_SHIFT 2
26#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-ixp23xx/include/mach/dma.h b/arch/arm/mach-ixp23xx/include/mach/dma.h
new file mode 100644
index 000000000000..8886544b93f7
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/dma.h
@@ -0,0 +1,3 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/dma.h
3 */
diff --git a/arch/arm/mach-ixp23xx/include/mach/entry-macro.S b/arch/arm/mach-ixp23xx/include/mach/entry-macro.S
new file mode 100644
index 000000000000..3f5338a7bbdd
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/entry-macro.S
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/entry-macro.S
3 */
4
5 .macro disable_fiq
6 .endm
7
8 .macro get_irqnr_preamble, base, tmp
9 .endm
10
11 .macro arch_ret_to_user, tmp1, tmp2
12 .endm
13
14 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
15 ldr \irqnr, =(IXP23XX_INTC_VIRT + IXP23XX_INTR_IRQ_ENC_ST_OFFSET)
16 ldr \irqnr, [\irqnr] @ get interrupt number
17 cmp \irqnr, #0x0 @ spurious interrupt ?
18 movne \irqnr, \irqnr, lsr #2 @ skip unwanted low order bits
19 subne \irqnr, \irqnr, #1 @ convert to 0 based
20
21#if 0
22 cmp \irqnr, #IRQ_IXP23XX_PCI_INT_RPH
23 bne 1001f
24 mov \irqnr, #IRQ_IXP23XX_INTA
25
26 ldr \irqnr, =0xf5000030
27
28 mov \tmp, #(1<<26)
29 tst \irqnr, \tmp
30 movne \irqnr, #IRQ_IXP23XX_INTB
31
32 mov \tmp, #(1<<27)
33 tst \irqnr, \tmp
34 movne \irqnr, #IRQ_IXP23XX_INTA
351001:
36#endif
37 .endm
diff --git a/arch/arm/mach-ixp23xx/include/mach/hardware.h b/arch/arm/mach-ixp23xx/include/mach/hardware.h
new file mode 100644
index 000000000000..c3192009a886
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/hardware.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/hardware.h
3 *
4 * Copyright (C) 2002-2004 Intel Corporation.
5 * Copyricht (C) 2005 MontaVista Software, Inc.
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 * Hardware definitions for IXP23XX based systems
12 */
13
14#ifndef __ASM_ARCH_HARDWARE_H
15#define __ASM_ARCH_HARDWARE_H
16
17/* PCI IO info */
18#define PCIO_BASE IXP23XX_PCI_IO_VIRT
19#define PCIBIOS_MIN_IO 0x00000000
20#define PCIBIOS_MIN_MEM 0xe0000000
21
22#include "ixp23xx.h"
23
24#define pcibios_assign_all_busses() 0
25
26/*
27 * Platform helper functions
28 */
29#include "platform.h"
30
31/*
32 * Platform-specific headers
33 */
34#include "ixdp2351.h"
35
36
37#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/io.h b/arch/arm/mach-ixp23xx/include/mach/io.h
new file mode 100644
index 000000000000..305ea1808c71
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/io.h
@@ -0,0 +1,54 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/io.h
3 *
4 * Original Author: Naeem M Afzal <naeem.m.afzal@intel.com>
5 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
6 *
7 * Copyright (C) 2003-2005 Intel Corp.
8 * Copyright (C) 2005 MontaVista Software, Inc
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_ARCH_IO_H
16#define __ASM_ARCH_IO_H
17
18#define IO_SPACE_LIMIT 0xffffffff
19
20#define __io(p) ((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT))
21#define __mem_pci(a) (a)
22
23#include <linux/kernel.h> /* For BUG */
24
25static inline void __iomem *
26ixp23xx_ioremap(unsigned long addr, unsigned long size, unsigned int mtype)
27{
28 if (addr >= IXP23XX_PCI_MEM_START &&
29 addr <= IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE) {
30 if (addr + size > IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE)
31 return NULL;
32
33 return (void __iomem *)
34 ((addr - IXP23XX_PCI_MEM_START) + IXP23XX_PCI_MEM_VIRT);
35 }
36
37 return __arm_ioremap(addr, size, mtype);
38}
39
40static inline void
41ixp23xx_iounmap(void __iomem *addr)
42{
43 if ((((u32)addr) >= IXP23XX_PCI_MEM_VIRT) &&
44 (((u32)addr) < IXP23XX_PCI_MEM_VIRT + IXP23XX_PCI_MEM_SIZE))
45 return;
46
47 __iounmap(addr);
48}
49
50#define __arch_ioremap(a,s,f) ixp23xx_ioremap(a,s,f)
51#define __arch_iounmap(a) ixp23xx_iounmap(a)
52
53
54#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/irqs.h b/arch/arm/mach-ixp23xx/include/mach/irqs.h
new file mode 100644
index 000000000000..3af33a04b8a2
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/irqs.h
@@ -0,0 +1,223 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/irqs.h
3 *
4 * IRQ definitions for IXP23XX based systems
5 *
6 * Author: Naeem Afzal <naeem.m.afzal@intel.com>
7 *
8 * Copyright (C) 2003-2004 Intel Corporation.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_ARCH_IRQS_H
16#define __ASM_ARCH_IRQS_H
17
18#define NR_IXP23XX_IRQS IRQ_IXP23XX_INTB+1
19#define IRQ_IXP23XX_EXTIRQS NR_IXP23XX_IRQS
20
21
22#define IRQ_IXP23XX_DBG0 0 /* Debug/Execution/MBox */
23#define IRQ_IXP23XX_DBG1 1 /* Debug/Execution/MBox */
24#define IRQ_IXP23XX_NPE_TRG 2 /* npe_trigger */
25#define IRQ_IXP23XX_TIMER1 3 /* Timer[0] */
26#define IRQ_IXP23XX_TIMER2 4 /* Timer[1] */
27#define IRQ_IXP23XX_TIMESTAMP 5 /* Timer[2], Time-stamp */
28#define IRQ_IXP23XX_WDOG 6 /* Time[3], Watchdog Timer */
29#define IRQ_IXP23XX_PCI_DBELL 7 /* PCI Doorbell */
30#define IRQ_IXP23XX_PCI_DMA1 8 /* PCI DMA Channel 1 */
31#define IRQ_IXP23XX_PCI_DMA2 9 /* PCI DMA Channel 2 */
32#define IRQ_IXP23XX_PCI_DMA3 10 /* PCI DMA Channel 3 */
33#define IRQ_IXP23XX_PCI_INT_RPH 11 /* pcxg_pci_int_rph */
34#define IRQ_IXP23XX_CPP_PMU 12 /* xpxg_pm_int_rpl */
35#define IRQ_IXP23XX_SWINT0 13 /* S/W Interrupt0 */
36#define IRQ_IXP23XX_SWINT1 14 /* S/W Interrupt1 */
37#define IRQ_IXP23XX_UART2 15 /* UART1 Interrupt */
38#define IRQ_IXP23XX_UART1 16 /* UART0 Interrupt */
39#define IRQ_IXP23XX_XSI_PMU_ROLLOVER 17 /* AHB Performance M. Unit counter rollover */
40#define IRQ_IXP23XX_XSI_AHB_PM0 18 /* intr_pm_o */
41#define IRQ_IXP23XX_XSI_AHB_ECE0 19 /* intr_ece_o */
42#define IRQ_IXP23XX_XSI_AHB_GASKET 20 /* gas_intr_o */
43#define IRQ_IXP23XX_XSI_CPP 21 /* xsi2cpp_int */
44#define IRQ_IXP23XX_CPP_XSI 22 /* cpp2xsi_int */
45#define IRQ_IXP23XX_ME_ATTN0 23 /* ME_ATTN */
46#define IRQ_IXP23XX_ME_ATTN1 24 /* ME_ATTN */
47#define IRQ_IXP23XX_ME_ATTN2 25 /* ME_ATTN */
48#define IRQ_IXP23XX_ME_ATTN3 26 /* ME_ATTN */
49#define IRQ_IXP23XX_PCI_ERR_RPH 27 /* PCXG_PCI_ERR_RPH */
50#define IRQ_IXP23XX_D0XG_ECC_CORR 28 /* D0XG_DRAM_ECC_CORR */
51#define IRQ_IXP23XX_D0XG_ECC_UNCORR 29 /* D0XG_DRAM_ECC_UNCORR */
52#define IRQ_IXP23XX_SRAM_ERR1 30 /* SRAM1_ERR */
53#define IRQ_IXP23XX_SRAM_ERR0 31 /* SRAM0_ERR */
54#define IRQ_IXP23XX_MEDIA_ERR 32 /* MEDIA_ERR */
55#define IRQ_IXP23XX_STH_DRAM_ECC_MAJ 33 /* STH_DRAM0_ECC_MAJ */
56#define IRQ_IXP23XX_GPIO6 34 /* GPIO0 interrupts */
57#define IRQ_IXP23XX_GPIO7 35 /* GPIO1 interrupts */
58#define IRQ_IXP23XX_GPIO8 36 /* GPIO2 interrupts */
59#define IRQ_IXP23XX_GPIO9 37 /* GPIO3 interrupts */
60#define IRQ_IXP23XX_GPIO10 38 /* GPIO4 interrupts */
61#define IRQ_IXP23XX_GPIO11 39 /* GPIO5 interrupts */
62#define IRQ_IXP23XX_GPIO12 40 /* GPIO6 interrupts */
63#define IRQ_IXP23XX_GPIO13 41 /* GPIO7 interrupts */
64#define IRQ_IXP23XX_GPIO14 42 /* GPIO8 interrupts */
65#define IRQ_IXP23XX_GPIO15 43 /* GPIO9 interrupts */
66#define IRQ_IXP23XX_SHAC_RING0 44 /* SHAC Ring Full */
67#define IRQ_IXP23XX_SHAC_RING1 45 /* SHAC Ring Full */
68#define IRQ_IXP23XX_SHAC_RING2 46 /* SHAC Ring Full */
69#define IRQ_IXP23XX_SHAC_RING3 47 /* SHAC Ring Full */
70#define IRQ_IXP23XX_SHAC_RING4 48 /* SHAC Ring Full */
71#define IRQ_IXP23XX_SHAC_RING5 49 /* SHAC Ring Full */
72#define IRQ_IXP23XX_SHAC_RING6 50 /* SHAC RING Full */
73#define IRQ_IXP23XX_SHAC_RING7 51 /* SHAC Ring Full */
74#define IRQ_IXP23XX_SHAC_RING8 52 /* SHAC Ring Full */
75#define IRQ_IXP23XX_SHAC_RING9 53 /* SHAC Ring Full */
76#define IRQ_IXP23XX_SHAC_RING10 54 /* SHAC Ring Full */
77#define IRQ_IXP23XX_SHAC_RING11 55 /* SHAC Ring Full */
78#define IRQ_IXP23XX_ME_THREAD_A0_ME0 56 /* ME_THREAD_A */
79#define IRQ_IXP23XX_ME_THREAD_A1_ME0 57 /* ME_THREAD_A */
80#define IRQ_IXP23XX_ME_THREAD_A2_ME0 58 /* ME_THREAD_A */
81#define IRQ_IXP23XX_ME_THREAD_A3_ME0 59 /* ME_THREAD_A */
82#define IRQ_IXP23XX_ME_THREAD_A4_ME0 60 /* ME_THREAD_A */
83#define IRQ_IXP23XX_ME_THREAD_A5_ME0 61 /* ME_THREAD_A */
84#define IRQ_IXP23XX_ME_THREAD_A6_ME0 62 /* ME_THREAD_A */
85#define IRQ_IXP23XX_ME_THREAD_A7_ME0 63 /* ME_THREAD_A */
86#define IRQ_IXP23XX_ME_THREAD_A8_ME1 64 /* ME_THREAD_A */
87#define IRQ_IXP23XX_ME_THREAD_A9_ME1 65 /* ME_THREAD_A */
88#define IRQ_IXP23XX_ME_THREAD_A10_ME1 66 /* ME_THREAD_A */
89#define IRQ_IXP23XX_ME_THREAD_A11_ME1 67 /* ME_THREAD_A */
90#define IRQ_IXP23XX_ME_THREAD_A12_ME1 68 /* ME_THREAD_A */
91#define IRQ_IXP23XX_ME_THREAD_A13_ME1 69 /* ME_THREAD_A */
92#define IRQ_IXP23XX_ME_THREAD_A14_ME1 70 /* ME_THREAD_A */
93#define IRQ_IXP23XX_ME_THREAD_A15_ME1 71 /* ME_THREAD_A */
94#define IRQ_IXP23XX_ME_THREAD_A16_ME2 72 /* ME_THREAD_A */
95#define IRQ_IXP23XX_ME_THREAD_A17_ME2 73 /* ME_THREAD_A */
96#define IRQ_IXP23XX_ME_THREAD_A18_ME2 74 /* ME_THREAD_A */
97#define IRQ_IXP23XX_ME_THREAD_A19_ME2 75 /* ME_THREAD_A */
98#define IRQ_IXP23XX_ME_THREAD_A20_ME2 76 /* ME_THREAD_A */
99#define IRQ_IXP23XX_ME_THREAD_A21_ME2 77 /* ME_THREAD_A */
100#define IRQ_IXP23XX_ME_THREAD_A22_ME2 78 /* ME_THREAD_A */
101#define IRQ_IXP23XX_ME_THREAD_A23_ME2 79 /* ME_THREAD_A */
102#define IRQ_IXP23XX_ME_THREAD_A24_ME3 80 /* ME_THREAD_A */
103#define IRQ_IXP23XX_ME_THREAD_A25_ME3 81 /* ME_THREAD_A */
104#define IRQ_IXP23XX_ME_THREAD_A26_ME3 82 /* ME_THREAD_A */
105#define IRQ_IXP23XX_ME_THREAD_A27_ME3 83 /* ME_THREAD_A */
106#define IRQ_IXP23XX_ME_THREAD_A28_ME3 84 /* ME_THREAD_A */
107#define IRQ_IXP23XX_ME_THREAD_A29_ME3 85 /* ME_THREAD_A */
108#define IRQ_IXP23XX_ME_THREAD_A30_ME3 86 /* ME_THREAD_A */
109#define IRQ_IXP23XX_ME_THREAD_A31_ME3 87 /* ME_THREAD_A */
110#define IRQ_IXP23XX_ME_THREAD_B0_ME0 88 /* ME_THREAD_B */
111#define IRQ_IXP23XX_ME_THREAD_B1_ME0 89 /* ME_THREAD_B */
112#define IRQ_IXP23XX_ME_THREAD_B2_ME0 90 /* ME_THREAD_B */
113#define IRQ_IXP23XX_ME_THREAD_B3_ME0 91 /* ME_THREAD_B */
114#define IRQ_IXP23XX_ME_THREAD_B4_ME0 92 /* ME_THREAD_B */
115#define IRQ_IXP23XX_ME_THREAD_B5_ME0 93 /* ME_THREAD_B */
116#define IRQ_IXP23XX_ME_THREAD_B6_ME0 94 /* ME_THREAD_B */
117#define IRQ_IXP23XX_ME_THREAD_B7_ME0 95 /* ME_THREAD_B */
118#define IRQ_IXP23XX_ME_THREAD_B8_ME1 96 /* ME_THREAD_B */
119#define IRQ_IXP23XX_ME_THREAD_B9_ME1 97 /* ME_THREAD_B */
120#define IRQ_IXP23XX_ME_THREAD_B10_ME1 98 /* ME_THREAD_B */
121#define IRQ_IXP23XX_ME_THREAD_B11_ME1 99 /* ME_THREAD_B */
122#define IRQ_IXP23XX_ME_THREAD_B12_ME1 100 /* ME_THREAD_B */
123#define IRQ_IXP23XX_ME_THREAD_B13_ME1 101 /* ME_THREAD_B */
124#define IRQ_IXP23XX_ME_THREAD_B14_ME1 102 /* ME_THREAD_B */
125#define IRQ_IXP23XX_ME_THREAD_B15_ME1 103 /* ME_THREAD_B */
126#define IRQ_IXP23XX_ME_THREAD_B16_ME2 104 /* ME_THREAD_B */
127#define IRQ_IXP23XX_ME_THREAD_B17_ME2 105 /* ME_THREAD_B */
128#define IRQ_IXP23XX_ME_THREAD_B18_ME2 106 /* ME_THREAD_B */
129#define IRQ_IXP23XX_ME_THREAD_B19_ME2 107 /* ME_THREAD_B */
130#define IRQ_IXP23XX_ME_THREAD_B20_ME2 108 /* ME_THREAD_B */
131#define IRQ_IXP23XX_ME_THREAD_B21_ME2 109 /* ME_THREAD_B */
132#define IRQ_IXP23XX_ME_THREAD_B22_ME2 110 /* ME_THREAD_B */
133#define IRQ_IXP23XX_ME_THREAD_B23_ME2 111 /* ME_THREAD_B */
134#define IRQ_IXP23XX_ME_THREAD_B24_ME3 112 /* ME_THREAD_B */
135#define IRQ_IXP23XX_ME_THREAD_B25_ME3 113 /* ME_THREAD_B */
136#define IRQ_IXP23XX_ME_THREAD_B26_ME3 114 /* ME_THREAD_B */
137#define IRQ_IXP23XX_ME_THREAD_B27_ME3 115 /* ME_THREAD_B */
138#define IRQ_IXP23XX_ME_THREAD_B28_ME3 116 /* ME_THREAD_B */
139#define IRQ_IXP23XX_ME_THREAD_B29_ME3 117 /* ME_THREAD_B */
140#define IRQ_IXP23XX_ME_THREAD_B30_ME3 118 /* ME_THREAD_B */
141#define IRQ_IXP23XX_ME_THREAD_B31_ME3 119 /* ME_THREAD_B */
142
143#define NUM_IXP23XX_RAW_IRQS 120
144
145#define IRQ_IXP23XX_INTA 120 /* Indirect pcxg_pci_int_rph */
146#define IRQ_IXP23XX_INTB 121 /* Indirect pcxg_pci_int_rph */
147
148#define NR_IXP23XX_IRQ (IRQ_IXP23XX_INTB + 1)
149
150/*
151 * We default to 32 per-board IRQs. Increase this number if you need
152 * more, but keep it realistic.
153 */
154#define NR_IXP23XX_MACH_IRQS 32
155
156#define NR_IRQS (NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS)
157
158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq))
159
160
161/*
162 * IXDP2351-specific interrupts
163 */
164
165/*
166 * External PCI interrupts signaled through INTB
167 *
168 */
169#define IXDP2351_INTB_IRQ_BASE 0
170#define IRQ_IXDP2351_INTA_82546 IXP23XX_MACH_IRQ(0)
171#define IRQ_IXDP2351_INTB_82546 IXP23XX_MACH_IRQ(1)
172#define IRQ_IXDP2351_SPCI_DB_0 IXP23XX_MACH_IRQ(2)
173#define IRQ_IXDP2351_SPCI_DB_1 IXP23XX_MACH_IRQ(3)
174#define IRQ_IXDP2351_SPCI_PMC_INTA IXP23XX_MACH_IRQ(4)
175#define IRQ_IXDP2351_SPCI_PMC_INTB IXP23XX_MACH_IRQ(5)
176#define IRQ_IXDP2351_SPCI_PMC_INTC IXP23XX_MACH_IRQ(6)
177#define IRQ_IXDP2351_SPCI_PMC_INTD IXP23XX_MACH_IRQ(7)
178#define IRQ_IXDP2351_SPCI_FIC IXP23XX_MACH_IRQ(8)
179
180#define IXDP2351_INTB_IRQ_BIT(irq) (irq - IXP23XX_MACH_IRQ(0))
181#define IXDP2351_INTB_IRQ_MASK(irq) (1 << IXDP2351_INTB_IRQ_BIT(irq))
182#define IXDP2351_INTB_IRQ_VALID 0x01FF
183#define IXDP2351_INTB_IRQ_NUM 16
184
185/*
186 * Other external interrupts signaled through INTA
187 */
188#define IXDP2351_INTA_IRQ_BASE 16
189#define IRQ_IXDP2351_IPMI_FROM IXP23XX_MACH_IRQ(16)
190#define IRQ_IXDP2351_125US IXP23XX_MACH_IRQ(17)
191#define IRQ_IXDP2351_DB_0_ADD IXP23XX_MACH_IRQ(18)
192#define IRQ_IXDP2351_DB_1_ADD IXP23XX_MACH_IRQ(19)
193#define IRQ_IXDP2351_DEBUG1 IXP23XX_MACH_IRQ(20)
194#define IRQ_IXDP2351_ADD_UART IXP23XX_MACH_IRQ(21)
195#define IRQ_IXDP2351_FIC_ADD IXP23XX_MACH_IRQ(24)
196#define IRQ_IXDP2351_CS8900 IXP23XX_MACH_IRQ(25)
197#define IRQ_IXDP2351_BBSRAM IXP23XX_MACH_IRQ(26)
198#define IRQ_IXDP2351_CONFIG_MEDIA IXP23XX_MACH_IRQ(27)
199#define IRQ_IXDP2351_CLOCK_REF IXP23XX_MACH_IRQ(28)
200#define IRQ_IXDP2351_A10_NP IXP23XX_MACH_IRQ(29)
201#define IRQ_IXDP2351_A11_NP IXP23XX_MACH_IRQ(30)
202#define IRQ_IXDP2351_DEBUG_NP IXP23XX_MACH_IRQ(31)
203
204#define IXDP2351_INTA_IRQ_BIT(irq) (irq - IXP23XX_MACH_IRQ(16))
205#define IXDP2351_INTA_IRQ_MASK(irq) (1 << IXDP2351_INTA_IRQ_BIT(irq))
206#define IXDP2351_INTA_IRQ_VALID 0xFF3F
207#define IXDP2351_INTA_IRQ_NUM 16
208
209
210/*
211 * ADI RoadRunner IRQs
212 */
213#define IRQ_ROADRUNNER_PCI_INTA IRQ_IXP23XX_INTA
214#define IRQ_ROADRUNNER_PCI_INTB IRQ_IXP23XX_INTB
215#define IRQ_ROADRUNNER_PCI_INTC IRQ_IXP23XX_GPIO11
216#define IRQ_ROADRUNNER_PCI_INTD IRQ_IXP23XX_GPIO12
217
218/*
219 * Put new board definitions here
220 */
221
222
223#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/ixdp2351.h b/arch/arm/mach-ixp23xx/include/mach/ixdp2351.h
new file mode 100644
index 000000000000..663951027de5
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/ixdp2351.h
@@ -0,0 +1,89 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/ixdp2351.h
3 *
4 * Register and other defines for IXDP2351
5 *
6 * Copyright (c) 2002-2004 Intel Corp.
7 * Copytight (c) 2005 MontaVista Software, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#ifndef __ASM_ARCH_IXDP2351_H
16#define __ASM_ARCH_IXDP2351_H
17
18/*
19 * NP module memory map
20 */
21#define IXDP2351_NP_PHYS_BASE (IXP23XX_EXP_BUS_CS4_BASE)
22#define IXDP2351_NP_PHYS_SIZE 0x00100000
23#define IXDP2351_NP_VIRT_BASE 0xeff00000
24
25#define IXDP2351_VIRT_CS8900_BASE (IXDP2351_NP_VIRT_BASE)
26#define IXDP2351_VIRT_CS8900_END (IXDP2351_VIRT_CS8900_BASE + 16)
27
28#define IXDP2351_VIRT_NP_CPLD_BASE (IXP23XX_EXP_BUS_CS4_BASE_VIRT + 0x00010000)
29
30#define IXDP2351_NP_CPLD_REG(reg) ((volatile u16 *)(IXDP2351_VIRT_NP_CPLD_BASE + reg))
31
32#define IXDP2351_NP_CPLD_RESET1_REG IXDP2351_NP_CPLD_REG(0x00)
33#define IXDP2351_NP_CPLD_LED_REG IXDP2351_NP_CPLD_REG(0x02)
34#define IXDP2351_NP_CPLD_VERSION_REG IXDP2351_NP_CPLD_REG(0x04)
35
36/*
37 * Base board module memory map
38 */
39
40#define IXDP2351_BB_BASE_PHYS (IXP23XX_EXP_BUS_CS5_BASE)
41#define IXDP2351_BB_SIZE 0x01000000
42#define IXDP2351_BB_BASE_VIRT (0xee000000)
43
44#define IXDP2351_BB_AREA_BASE(offset) (IXDP2351_BB_BASE_VIRT + offset)
45
46#define IXDP2351_VIRT_NVRAM_BASE IXDP2351_BB_AREA_BASE(0x0)
47#define IXDP2351_NVRAM_SIZE (0x20000)
48
49#define IXDP2351_VIRT_MB_IXF1104_BASE IXDP2351_BB_AREA_BASE(0x00020000)
50#define IXDP2351_VIRT_ADD_UART_BASE IXDP2351_BB_AREA_BASE(0x000240C0)
51#define IXDP2351_VIRT_FIC_BASE IXDP2351_BB_AREA_BASE(0x00200000)
52#define IXDP2351_VIRT_DB0_BASE IXDP2351_BB_AREA_BASE(0x00400000)
53#define IXDP2351_VIRT_DB1_BASE IXDP2351_BB_AREA_BASE(0x00600000)
54#define IXDP2351_VIRT_CPLD_BASE IXDP2351_BB_AREA_BASE(0x00024000)
55
56/*
57 * On board CPLD registers
58 */
59#define IXDP2351_CPLD_BB_REG(reg) ((volatile u16 *)(IXDP2351_VIRT_CPLD_BASE + reg))
60
61#define IXDP2351_CPLD_RESET0_REG IXDP2351_CPLD_BB_REG(0x00)
62#define IXDP2351_CPLD_RESET1_REG IXDP2351_CPLD_BB_REG(0x04)
63
64#define IXDP2351_CPLD_RESET1_MAGIC 0x55AA
65#define IXDP2351_CPLD_RESET1_ENABLE 0x8000
66
67#define IXDP2351_CPLD_FPGA_CONFIG_REG IXDP2351_CPLD_BB_REG(0x08)
68#define IXDP2351_CPLD_INTB_MASK_SET_REG IXDP2351_CPLD_BB_REG(0x10)
69#define IXDP2351_CPLD_INTA_MASK_SET_REG IXDP2351_CPLD_BB_REG(0x14)
70#define IXDP2351_CPLD_INTB_STAT_REG IXDP2351_CPLD_BB_REG(0x18)
71#define IXDP2351_CPLD_INTA_STAT_REG IXDP2351_CPLD_BB_REG(0x1C)
72#define IXDP2351_CPLD_INTB_RAW_REG IXDP2351_CPLD_BB_REG(0x20) /* read */
73#define IXDP2351_CPLD_INTA_RAW_REG IXDP2351_CPLD_BB_REG(0x24) /* read */
74#define IXDP2351_CPLD_INTB_MASK_CLR_REG IXDP2351_CPLD_INTB_RAW_REG /* write */
75#define IXDP2351_CPLD_INTA_MASK_CLR_REG IXDP2351_CPLD_INTA_RAW_REG /* write */
76#define IXDP2351_CPLD_INTB_SIM_REG IXDP2351_CPLD_BB_REG(0x28)
77#define IXDP2351_CPLD_INTA_SIM_REG IXDP2351_CPLD_BB_REG(0x2C)
78 /* Interrupt bits are defined in irqs.h */
79#define IXDP2351_CPLD_BB_GBE0_REG IXDP2351_CPLD_BB_REG(0x30)
80#define IXDP2351_CPLD_BB_GBE1_REG IXDP2351_CPLD_BB_REG(0x34)
81
82/* #define IXDP2351_CPLD_BB_MISC_REG IXDP2351_CPLD_REG(0x1C) */
83/* #define IXDP2351_CPLD_BB_MISC_REV_MASK 0xFF */
84/* #define IXDP2351_CPLD_BB_GDXCS0_REG IXDP2351_CPLD_REG(0x24) */
85/* #define IXDP2351_CPLD_BB_GDXCS1_REG IXDP2351_CPLD_REG(0x28) */
86/* #define IXDP2351_CPLD_BB_CLOCK_REG IXDP2351_CPLD_REG(0x04) */
87
88
89#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/ixp23xx.h b/arch/arm/mach-ixp23xx/include/mach/ixp23xx.h
new file mode 100644
index 000000000000..6d02481b1d6d
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/ixp23xx.h
@@ -0,0 +1,298 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/ixp23xx.h
3 *
4 * Register definitions for IXP23XX
5 *
6 * Copyright (C) 2003-2005 Intel Corporation.
7 * Copyright (C) 2005 MontaVista Software, Inc.
8 *
9 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
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#ifndef __ASM_ARCH_IXP23XX_H
17#define __ASM_ARCH_IXP23XX_H
18
19/*
20 * IXP2300 linux memory map:
21 *
22 * virt phys size
23 * fffd0000 a0000000 64K XSI2CPP_CSR
24 * fffc0000 c4000000 4K EXP_CFG
25 * fff00000 c8000000 64K PERIPHERAL
26 * fe000000 1c0000000 16M CAP_CSR
27 * fd000000 1c8000000 16M MSF_CSR
28 * fb000000 16M ---
29 * fa000000 1d8000000 32M PCI_IO
30 * f8000000 1da000000 32M PCI_CFG
31 * f6000000 1de000000 32M PCI_CREG
32 * f4000000 32M ---
33 * f0000000 1e0000000 64M PCI_MEM
34 * e[c-f]000000 per-platform mappings
35 */
36
37
38/****************************************************************************
39 * Static mappings.
40 ****************************************************************************/
41#define IXP23XX_XSI2CPP_CSR_PHYS 0xa0000000
42#define IXP23XX_XSI2CPP_CSR_VIRT 0xfffd0000
43#define IXP23XX_XSI2CPP_CSR_SIZE 0x00010000
44
45#define IXP23XX_EXP_CFG_PHYS 0xc4000000
46#define IXP23XX_EXP_CFG_VIRT 0xfffc0000
47#define IXP23XX_EXP_CFG_SIZE 0x00001000
48
49#define IXP23XX_PERIPHERAL_PHYS 0xc8000000
50#define IXP23XX_PERIPHERAL_VIRT 0xfff00000
51#define IXP23XX_PERIPHERAL_SIZE 0x00010000
52
53#define IXP23XX_CAP_CSR_PHYS 0x1c0000000ULL
54#define IXP23XX_CAP_CSR_VIRT 0xfe000000
55#define IXP23XX_CAP_CSR_SIZE 0x01000000
56
57#define IXP23XX_MSF_CSR_PHYS 0x1c8000000ULL
58#define IXP23XX_MSF_CSR_VIRT 0xfd000000
59#define IXP23XX_MSF_CSR_SIZE 0x01000000
60
61#define IXP23XX_PCI_IO_PHYS 0x1d8000000ULL
62#define IXP23XX_PCI_IO_VIRT 0xfa000000
63#define IXP23XX_PCI_IO_SIZE 0x02000000
64
65#define IXP23XX_PCI_CFG_PHYS 0x1da000000ULL
66#define IXP23XX_PCI_CFG_VIRT 0xf8000000
67#define IXP23XX_PCI_CFG_SIZE 0x02000000
68#define IXP23XX_PCI_CFG0_VIRT IXP23XX_PCI_CFG_VIRT
69#define IXP23XX_PCI_CFG1_VIRT (IXP23XX_PCI_CFG_VIRT + 0x01000000)
70
71#define IXP23XX_PCI_CREG_PHYS 0x1de000000ULL
72#define IXP23XX_PCI_CREG_VIRT 0xf6000000
73#define IXP23XX_PCI_CREG_SIZE 0x02000000
74#define IXP23XX_PCI_CSR_VIRT (IXP23XX_PCI_CREG_VIRT + 0x01000000)
75
76#define IXP23XX_PCI_MEM_START 0xe0000000
77#define IXP23XX_PCI_MEM_PHYS 0x1e0000000ULL
78#define IXP23XX_PCI_MEM_VIRT 0xf0000000
79#define IXP23XX_PCI_MEM_SIZE 0x04000000
80
81
82/****************************************************************************
83 * XSI2CPP CSRs.
84 ****************************************************************************/
85#define IXP23XX_XSI2CPP_REG(x) ((volatile unsigned long *)(IXP23XX_XSI2CPP_CSR_VIRT + (x)))
86#define IXP23XX_CPP2XSI_CURR_XFER_REG3 IXP23XX_XSI2CPP_REG(0xf8)
87#define IXP23XX_CPP2XSI_ADDR_31 (1 << 19)
88#define IXP23XX_CPP2XSI_PSH_OFF (1 << 20)
89#define IXP23XX_CPP2XSI_COH_OFF (1 << 21)
90
91
92/****************************************************************************
93 * Expansion Bus Config.
94 ****************************************************************************/
95#define IXP23XX_EXP_CFG_REG(x) ((volatile unsigned long *)(IXP23XX_EXP_CFG_VIRT + (x)))
96#define IXP23XX_EXP_CS0 IXP23XX_EXP_CFG_REG(0x00)
97#define IXP23XX_EXP_CS1 IXP23XX_EXP_CFG_REG(0x04)
98#define IXP23XX_EXP_CS2 IXP23XX_EXP_CFG_REG(0x08)
99#define IXP23XX_EXP_CS3 IXP23XX_EXP_CFG_REG(0x0c)
100#define IXP23XX_EXP_CS4 IXP23XX_EXP_CFG_REG(0x10)
101#define IXP23XX_EXP_CS5 IXP23XX_EXP_CFG_REG(0x14)
102#define IXP23XX_EXP_CS6 IXP23XX_EXP_CFG_REG(0x18)
103#define IXP23XX_EXP_CS7 IXP23XX_EXP_CFG_REG(0x1c)
104#define IXP23XX_FLASH_WRITABLE (0x2)
105#define IXP23XX_FLASH_BUS8 (0x1)
106
107#define IXP23XX_EXP_CFG0 IXP23XX_EXP_CFG_REG(0x20)
108#define IXP23XX_EXP_CFG1 IXP23XX_EXP_CFG_REG(0x24)
109#define IXP23XX_EXP_CFG0_MEM_MAP (1 << 31)
110#define IXP23XX_EXP_CFG0_XSCALE_SPEED_SEL (3 << 22)
111#define IXP23XX_EXP_CFG0_XSCALE_SPEED_EN (1 << 21)
112#define IXP23XX_EXP_CFG0_CPP_SPEED_SEL (3 << 19)
113#define IXP23XX_EXP_CFG0_CPP_SPEED_EN (1 << 18)
114#define IXP23XX_EXP_CFG0_PCI_SWIN (3 << 16)
115#define IXP23XX_EXP_CFG0_PCI_DWIN (3 << 14)
116#define IXP23XX_EXP_CFG0_PCI33_MODE (1 << 13)
117#define IXP23XX_EXP_CFG0_QDR_SPEED_SEL (1 << 12)
118#define IXP23XX_EXP_CFG0_CPP_DIV_SEL (1 << 5)
119#define IXP23XX_EXP_CFG0_XSI_NOT_PRES (1 << 4)
120#define IXP23XX_EXP_CFG0_PROM_BOOT (1 << 3)
121#define IXP23XX_EXP_CFG0_PCI_ARB (1 << 2)
122#define IXP23XX_EXP_CFG0_PCI_HOST (1 << 1)
123#define IXP23XX_EXP_CFG0_FLASH_WIDTH (1 << 0)
124
125#define IXP23XX_EXP_UNIT_FUSE IXP23XX_EXP_CFG_REG(0x28)
126#define IXP23XX_EXP_MSF_MUX IXP23XX_EXP_CFG_REG(0x30)
127#define IXP23XX_EXP_CFG_FUSE IXP23XX_EXP_CFG_REG(0x34)
128
129#define IXP23XX_EXP_BUS_PHYS 0x90000000
130#define IXP23XX_EXP_BUS_WINDOW_SIZE 0x01000000
131
132#define IXP23XX_EXP_BUS_CS0_BASE (IXP23XX_EXP_BUS_PHYS + 0x00000000)
133#define IXP23XX_EXP_BUS_CS1_BASE (IXP23XX_EXP_BUS_PHYS + 0x01000000)
134#define IXP23XX_EXP_BUS_CS2_BASE (IXP23XX_EXP_BUS_PHYS + 0x02000000)
135#define IXP23XX_EXP_BUS_CS3_BASE (IXP23XX_EXP_BUS_PHYS + 0x03000000)
136#define IXP23XX_EXP_BUS_CS4_BASE (IXP23XX_EXP_BUS_PHYS + 0x04000000)
137#define IXP23XX_EXP_BUS_CS5_BASE (IXP23XX_EXP_BUS_PHYS + 0x05000000)
138#define IXP23XX_EXP_BUS_CS6_BASE (IXP23XX_EXP_BUS_PHYS + 0x06000000)
139#define IXP23XX_EXP_BUS_CS7_BASE (IXP23XX_EXP_BUS_PHYS + 0x07000000)
140
141
142/****************************************************************************
143 * Peripherals.
144 ****************************************************************************/
145#define IXP23XX_UART1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x0000)
146#define IXP23XX_UART2_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x1000)
147#define IXP23XX_PMU_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x2000)
148#define IXP23XX_INTC_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x3000)
149#define IXP23XX_GPIO_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x4000)
150#define IXP23XX_TIMER_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x5000)
151#define IXP23XX_NPE0_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x6000)
152#define IXP23XX_DSR_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x7000)
153#define IXP23XX_NPE1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x8000)
154#define IXP23XX_ETH0_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x9000)
155#define IXP23XX_ETH1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xA000)
156#define IXP23XX_GIG0_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xB000)
157#define IXP23XX_GIG1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xC000)
158#define IXP23XX_DDRS_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xD000)
159
160#define IXP23XX_UART1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x0000)
161#define IXP23XX_UART2_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x1000)
162#define IXP23XX_PMU_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x2000)
163#define IXP23XX_INTC_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x3000)
164#define IXP23XX_GPIO_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x4000)
165#define IXP23XX_TIMER_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x5000)
166#define IXP23XX_NPE0_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x6000)
167#define IXP23XX_DSR_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x7000)
168#define IXP23XX_NPE1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x8000)
169#define IXP23XX_ETH0_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x9000)
170#define IXP23XX_ETH1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xA000)
171#define IXP23XX_GIG0_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xB000)
172#define IXP23XX_GIG1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xC000)
173#define IXP23XX_DDRS_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xD000)
174
175
176/****************************************************************************
177 * Interrupt controller.
178 ****************************************************************************/
179#define IXP23XX_INTC_REG(x) ((volatile unsigned long *)(IXP23XX_INTC_VIRT + (x)))
180#define IXP23XX_INTR_ST1 IXP23XX_INTC_REG(0x00)
181#define IXP23XX_INTR_ST2 IXP23XX_INTC_REG(0x04)
182#define IXP23XX_INTR_ST3 IXP23XX_INTC_REG(0x08)
183#define IXP23XX_INTR_ST4 IXP23XX_INTC_REG(0x0c)
184#define IXP23XX_INTR_EN1 IXP23XX_INTC_REG(0x10)
185#define IXP23XX_INTR_EN2 IXP23XX_INTC_REG(0x14)
186#define IXP23XX_INTR_EN3 IXP23XX_INTC_REG(0x18)
187#define IXP23XX_INTR_EN4 IXP23XX_INTC_REG(0x1c)
188#define IXP23XX_INTR_SEL1 IXP23XX_INTC_REG(0x20)
189#define IXP23XX_INTR_SEL2 IXP23XX_INTC_REG(0x24)
190#define IXP23XX_INTR_SEL3 IXP23XX_INTC_REG(0x28)
191#define IXP23XX_INTR_SEL4 IXP23XX_INTC_REG(0x2c)
192#define IXP23XX_INTR_IRQ_ST1 IXP23XX_INTC_REG(0x30)
193#define IXP23XX_INTR_IRQ_ST2 IXP23XX_INTC_REG(0x34)
194#define IXP23XX_INTR_IRQ_ST3 IXP23XX_INTC_REG(0x38)
195#define IXP23XX_INTR_IRQ_ST4 IXP23XX_INTC_REG(0x3c)
196#define IXP23XX_INTR_IRQ_ENC_ST_OFFSET 0x54
197
198
199/****************************************************************************
200 * GPIO.
201 ****************************************************************************/
202#define IXP23XX_GPIO_REG(x) ((volatile unsigned long *)(IXP23XX_GPIO_VIRT + (x)))
203#define IXP23XX_GPIO_GPOUTR IXP23XX_GPIO_REG(0x00)
204#define IXP23XX_GPIO_GPOER IXP23XX_GPIO_REG(0x04)
205#define IXP23XX_GPIO_GPINR IXP23XX_GPIO_REG(0x08)
206#define IXP23XX_GPIO_GPISR IXP23XX_GPIO_REG(0x0c)
207#define IXP23XX_GPIO_GPIT1R IXP23XX_GPIO_REG(0x10)
208#define IXP23XX_GPIO_GPIT2R IXP23XX_GPIO_REG(0x14)
209#define IXP23XX_GPIO_GPCLKR IXP23XX_GPIO_REG(0x18)
210#define IXP23XX_GPIO_GPDBSELR IXP23XX_GPIO_REG(0x1c)
211
212#define IXP23XX_GPIO_STYLE_MASK 0x7
213#define IXP23XX_GPIO_STYLE_ACTIVE_HIGH 0x0
214#define IXP23XX_GPIO_STYLE_ACTIVE_LOW 0x1
215#define IXP23XX_GPIO_STYLE_RISING_EDGE 0x2
216#define IXP23XX_GPIO_STYLE_FALLING_EDGE 0x3
217#define IXP23XX_GPIO_STYLE_TRANSITIONAL 0x4
218
219#define IXP23XX_GPIO_STYLE_SIZE 3
220
221
222/****************************************************************************
223 * Timer.
224 ****************************************************************************/
225#define IXP23XX_TIMER_REG(x) ((volatile unsigned long *)(IXP23XX_TIMER_VIRT + (x)))
226#define IXP23XX_TIMER_CONT IXP23XX_TIMER_REG(0x00)
227#define IXP23XX_TIMER1_TIMESTAMP IXP23XX_TIMER_REG(0x04)
228#define IXP23XX_TIMER1_RELOAD IXP23XX_TIMER_REG(0x08)
229#define IXP23XX_TIMER2_TIMESTAMP IXP23XX_TIMER_REG(0x0c)
230#define IXP23XX_TIMER2_RELOAD IXP23XX_TIMER_REG(0x10)
231#define IXP23XX_TIMER_WDOG IXP23XX_TIMER_REG(0x14)
232#define IXP23XX_TIMER_WDOG_EN IXP23XX_TIMER_REG(0x18)
233#define IXP23XX_TIMER_WDOG_KEY IXP23XX_TIMER_REG(0x1c)
234#define IXP23XX_TIMER_WDOG_KEY_MAGIC 0x482e
235#define IXP23XX_TIMER_STATUS IXP23XX_TIMER_REG(0x20)
236#define IXP23XX_TIMER_SOFT_RESET IXP23XX_TIMER_REG(0x24)
237#define IXP23XX_TIMER_SOFT_RESET_EN IXP23XX_TIMER_REG(0x28)
238
239#define IXP23XX_TIMER_ENABLE (1 << 0)
240#define IXP23XX_TIMER_ONE_SHOT (1 << 1)
241/* Low order bits of reload value ignored */
242#define IXP23XX_TIMER_RELOAD_MASK (0x3)
243#define IXP23XX_TIMER_DISABLED (0x0)
244#define IXP23XX_TIMER1_INT_PEND (1 << 0)
245#define IXP23XX_TIMER2_INT_PEND (1 << 1)
246#define IXP23XX_TIMER_STATUS_TS_PEND (1 << 2)
247#define IXP23XX_TIMER_STATUS_WDOG_PEND (1 << 3)
248#define IXP23XX_TIMER_STATUS_WARM_RESET (1 << 4)
249
250
251/****************************************************************************
252 * CAP CSRs.
253 ****************************************************************************/
254#define IXP23XX_GLOBAL_REG(x) ((volatile unsigned long *)(IXP23XX_CAP_CSR_VIRT + 0x4a00 + (x)))
255#define IXP23XX_PRODUCT_ID IXP23XX_GLOBAL_REG(0x00)
256#define IXP23XX_MISC_CONTROL IXP23XX_GLOBAL_REG(0x04)
257#define IXP23XX_MSF_CLK_CNTRL IXP23XX_GLOBAL_REG(0x08)
258#define IXP23XX_RESET0 IXP23XX_GLOBAL_REG(0x0c)
259#define IXP23XX_RESET1 IXP23XX_GLOBAL_REG(0x10)
260#define IXP23XX_STRAP_OPTIONS IXP23XX_GLOBAL_REG(0x18)
261
262#define IXP23XX_ENABLE_WATCHDOG (1 << 24)
263#define IXP23XX_SHPC_INIT_COMP (1 << 21)
264#define IXP23XX_RST_ALL (1 << 16)
265#define IXP23XX_RESET_PCI (1 << 2)
266#define IXP23XX_PCI_UNIT_RESET (1 << 1)
267#define IXP23XX_XSCALE_RESET (1 << 0)
268
269#define IXP23XX_UENGINE_CSR_VIRT_BASE (IXP23XX_CAP_CSR_VIRT + 0x18000)
270
271
272/****************************************************************************
273 * PCI CSRs.
274 ****************************************************************************/
275#define IXP23XX_PCI_CREG(x) ((volatile unsigned long *)(IXP23XX_PCI_CREG_VIRT + (x)))
276#define IXP23XX_PCI_CMDSTAT IXP23XX_PCI_CREG(0x04)
277#define IXP23XX_PCI_SRAM_BAR IXP23XX_PCI_CREG(0x14)
278#define IXP23XX_PCI_SDRAM_BAR IXP23XX_PCI_CREG(0x18)
279
280
281#define IXP23XX_PCI_CSR(x) ((volatile unsigned long *)(IXP23XX_PCI_CREG_VIRT + 0x01000000 + (x)))
282#define IXP23XX_PCI_OUT_INT_STATUS IXP23XX_PCI_CSR(0x0030)
283#define IXP23XX_PCI_OUT_INT_MASK IXP23XX_PCI_CSR(0x0034)
284#define IXP23XX_PCI_SRAM_BASE_ADDR_MASK IXP23XX_PCI_CSR(0x00fc)
285#define IXP23XX_PCI_DRAM_BASE_ADDR_MASK IXP23XX_PCI_CSR(0x0100)
286#define IXP23XX_PCI_CONTROL IXP23XX_PCI_CSR(0x013c)
287#define IXP23XX_PCI_ADDR_EXT IXP23XX_PCI_CSR(0x0140)
288#define IXP23XX_PCI_ME_PUSH_STATUS IXP23XX_PCI_CSR(0x0148)
289#define IXP23XX_PCI_ME_PUSH_EN IXP23XX_PCI_CSR(0x014c)
290#define IXP23XX_PCI_ERR_STATUS IXP23XX_PCI_CSR(0x0150)
291#define IXP23XX_PCI_ERROR_STATUS IXP23XX_PCI_CSR(0x0150)
292#define IXP23XX_PCI_ERR_ENABLE IXP23XX_PCI_CSR(0x0154)
293#define IXP23XX_PCI_XSCALE_INT_STATUS IXP23XX_PCI_CSR(0x0158)
294#define IXP23XX_PCI_XSCALE_INT_ENABLE IXP23XX_PCI_CSR(0x015c)
295#define IXP23XX_PCI_CPP_ADDR_BITS IXP23XX_PCI_CSR(0x0160)
296
297
298#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/memory.h b/arch/arm/mach-ixp23xx/include/mach/memory.h
new file mode 100644
index 000000000000..9d40115f7ebe
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/memory.h
@@ -0,0 +1,48 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/memory.h
3 *
4 * Copyright (c) 2003-2004 Intel Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef __ASM_ARCH_MEMORY_H
13#define __ASM_ARCH_MEMORY_H
14
15#include <mach/hardware.h>
16
17/*
18 * Physical DRAM offset.
19 */
20#define PHYS_OFFSET (0x00000000)
21
22
23/*
24 * Virtual view <-> DMA view memory address translations
25 * virt_to_bus: Used to translate the virtual address to an
26 * address suitable to be passed to set_dma_addr
27 * bus_to_virt: Used to convert an address for DMA operations
28 * to an address that the kernel can use.
29 */
30#ifndef __ASSEMBLY__
31
32#define __virt_to_bus(v) \
33 ({ unsigned int ret; \
34 ret = ((__virt_to_phys(v) - 0x00000000) + \
35 (*((volatile int *)IXP23XX_PCI_SDRAM_BAR) & 0xfffffff0)); \
36 ret; })
37
38#define __bus_to_virt(b) \
39 ({ unsigned int data; \
40 data = *((volatile int *)IXP23XX_PCI_SDRAM_BAR); \
41 __phys_to_virt((((b - (data & 0xfffffff0)) + 0x00000000))); })
42
43#define arch_is_coherent() 1
44
45#endif
46
47
48#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/platform.h b/arch/arm/mach-ixp23xx/include/mach/platform.h
new file mode 100644
index 000000000000..db9d9416e5e4
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/platform.h
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/platform.h
3 *
4 * Various bits of code used by platform-level code.
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#ifndef __ASSEMBLY__
16
17static inline unsigned long ixp2000_reg_read(volatile void *reg)
18{
19 return *((volatile unsigned long *)reg);
20}
21
22static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)
23{
24 *((volatile unsigned long *)reg) = val;
25}
26
27static inline void ixp2000_reg_wrb(volatile void *reg, unsigned long val)
28{
29 *((volatile unsigned long *)reg) = val;
30}
31
32struct pci_sys_data;
33
34void ixp23xx_map_io(void);
35void ixp23xx_init_irq(void);
36void ixp23xx_sys_init(void);
37int ixp23xx_pci_setup(int, struct pci_sys_data *);
38void ixp23xx_pci_preinit(void);
39struct pci_bus *ixp23xx_pci_scan_bus(int, struct pci_sys_data*);
40void ixp23xx_pci_slave_init(void);
41
42extern struct sys_timer ixp23xx_timer;
43
44#define IXP23XX_UART_XTAL 14745600
45
46#ifndef __ASSEMBLY__
47/*
48 * Is system memory on the XSI or CPP bus?
49 */
50static inline unsigned ixp23xx_cpp_boot(void)
51{
52 return (*IXP23XX_EXP_CFG0 & IXP23XX_EXP_CFG0_XSI_NOT_PRES);
53}
54#endif
55
56
57#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/system.h b/arch/arm/mach-ixp23xx/include/mach/system.h
new file mode 100644
index 000000000000..d57c3fc10f1f
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/system.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/system.h
3 *
4 * Copyright (C) 2003 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <mach/hardware.h>
12#include <asm/mach-types.h>
13
14static inline void arch_idle(void)
15{
16#if 0
17 if (!hlt_counter)
18 cpu_do_idle();
19#endif
20}
21
22static inline void arch_reset(char mode)
23{
24 /* First try machine specific support */
25 if (machine_is_ixdp2351()) {
26 *IXDP2351_CPLD_RESET1_REG = IXDP2351_CPLD_RESET1_MAGIC;
27 (void) *IXDP2351_CPLD_RESET1_REG;
28 *IXDP2351_CPLD_RESET1_REG = IXDP2351_CPLD_RESET1_ENABLE;
29 }
30
31 /* Use on-chip reset capability */
32 *IXP23XX_RESET0 |= IXP23XX_RST_ALL;
33}
diff --git a/arch/arm/mach-ixp23xx/include/mach/time.h b/arch/arm/mach-ixp23xx/include/mach/time.h
new file mode 100644
index 000000000000..b61dafc884ac
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/time.h
@@ -0,0 +1,3 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/time.h
3 */
diff --git a/arch/arm/mach-ixp23xx/include/mach/timex.h b/arch/arm/mach-ixp23xx/include/mach/timex.h
new file mode 100644
index 000000000000..e341e9cf9c37
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/timex.h
@@ -0,0 +1,7 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/timex.h
3 *
4 * XScale architecture timex specifications
5 */
6
7#define CLOCK_TICK_RATE 75000000
diff --git a/arch/arm/mach-ixp23xx/include/mach/uncompress.h b/arch/arm/mach-ixp23xx/include/mach/uncompress.h
new file mode 100644
index 000000000000..8b4c358d2c04
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/uncompress.h
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/uncompress.h
3 *
4 * Copyright (C) 2002-2004 Intel Corporation.
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_UNCOMPRESS_H
12#define __ASM_ARCH_UNCOMPRESS_H
13
14#include <mach/ixp23xx.h>
15#include <linux/serial_reg.h>
16
17#define UART_BASE ((volatile u32 *)IXP23XX_UART1_PHYS)
18
19static inline void putc(char c)
20{
21 int j;
22
23 for (j = 0; j < 0x1000; j++) {
24 if (UART_BASE[UART_LSR] & UART_LSR_THRE)
25 break;
26 barrier();
27 }
28
29 UART_BASE[UART_TX] = c;
30}
31
32static inline void flush(void)
33{
34}
35
36#define arch_decomp_setup()
37#define arch_decomp_wdog()
38
39
40#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/vmalloc.h b/arch/arm/mach-ixp23xx/include/mach/vmalloc.h
new file mode 100644
index 000000000000..dd519f678d10
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/include/mach/vmalloc.h
@@ -0,0 +1,10 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/vmalloc.h
3 *
4 * Copyright (c) 2005 MontaVista Software, Inc.
5 *
6 * NPU mappings end at 0xf0000000 and we allocate 64MB for board
7 * specific static I/O.
8 */
9
10#define VMALLOC_END (0xec000000)
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c
index 5c5d4d66dee8..b6e0bfa44df9 100644
--- a/arch/arm/mach-ixp23xx/ixdp2351.c
+++ b/arch/arm/mach-ixp23xx/ixdp2351.c
@@ -34,7 +34,7 @@
34#include <asm/types.h> 34#include <asm/types.h>
35#include <asm/setup.h> 35#include <asm/setup.h>
36#include <asm/memory.h> 36#include <asm/memory.h>
37#include <asm/hardware.h> 37#include <mach/hardware.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/system.h> 39#include <asm/system.h>
40#include <asm/tlbflush.h> 40#include <asm/tlbflush.h>
diff --git a/arch/arm/mach-ixp23xx/pci.c b/arch/arm/mach-ixp23xx/pci.c
index 227f808dc0ec..701d60aa0efd 100644
--- a/arch/arm/mach-ixp23xx/pci.c
+++ b/arch/arm/mach-ixp23xx/pci.c
@@ -31,8 +31,7 @@
31#include <asm/sizes.h> 31#include <asm/sizes.h>
32#include <asm/system.h> 32#include <asm/system.h>
33#include <asm/mach/pci.h> 33#include <asm/mach/pci.h>
34#include <asm/mach-types.h> 34#include <mach/hardware.h>
35#include <asm/hardware.h>
36 35
37extern int (*external_fault) (unsigned long, struct pt_regs *); 36extern int (*external_fault) (unsigned long, struct pt_regs *);
38 37
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c
index 896ff9f840d9..6d38d769761c 100644
--- a/arch/arm/mach-ixp23xx/roadrunner.c
+++ b/arch/arm/mach-ixp23xx/roadrunner.c
@@ -33,7 +33,7 @@
33#include <asm/types.h> 33#include <asm/types.h>
34#include <asm/setup.h> 34#include <asm/setup.h>
35#include <asm/memory.h> 35#include <asm/memory.h>
36#include <asm/hardware.h> 36#include <mach/hardware.h>
37#include <asm/mach-types.h> 37#include <asm/mach-types.h>
38#include <asm/irq.h> 38#include <asm/irq.h>
39#include <asm/system.h> 39#include <asm/system.h>
diff --git a/arch/arm/mach-ixp4xx/avila-pci.c b/arch/arm/mach-ixp4xx/avila-pci.c
index c6e044befccb..08d65dcdb5fe 100644
--- a/arch/arm/mach-ixp4xx/avila-pci.c
+++ b/arch/arm/mach-ixp4xx/avila-pci.c
@@ -25,7 +25,7 @@
25 25
26#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30 30
31void __init avila_pci_preinit(void) 31void __init avila_pci_preinit(void)
diff --git a/arch/arm/mach-ixp4xx/avila-setup.c b/arch/arm/mach-ixp4xx/avila-setup.c
index e38f45fa58ae..797995ce18b9 100644
--- a/arch/arm/mach-ixp4xx/avila-setup.c
+++ b/arch/arm/mach-ixp4xx/avila-setup.c
@@ -23,7 +23,7 @@
23#include <asm/types.h> 23#include <asm/types.h>
24#include <asm/setup.h> 24#include <asm/setup.h>
25#include <asm/memory.h> 25#include <asm/memory.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 64be341109b3..192538a04575 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -32,7 +32,7 @@
32#include <asm/sizes.h> 32#include <asm/sizes.h>
33#include <asm/system.h> 33#include <asm/system.h>
34#include <asm/mach/pci.h> 34#include <asm/mach/pci.h>
35#include <asm/hardware.h> 35#include <mach/hardware.h>
36 36
37 37
38/* 38/*
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 3947c506b4f3..58bd2842a6f1 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -29,8 +29,8 @@
29#include <linux/clocksource.h> 29#include <linux/clocksource.h>
30#include <linux/clockchips.h> 30#include <linux/clockchips.h>
31 31
32#include <asm/arch/udc.h> 32#include <mach/udc.h>
33#include <asm/hardware.h> 33#include <mach/hardware.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/pgtable.h> 36#include <asm/pgtable.h>
diff --git a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c
index be4f4a208b90..efddf01ed17b 100644
--- a/arch/arm/mach-ixp4xx/coyote-pci.c
+++ b/arch/arm/mach-ixp4xx/coyote-pci.c
@@ -20,7 +20,7 @@
20#include <linux/irq.h> 20#include <linux/irq.h>
21 21
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/irq.h> 24#include <asm/irq.h>
25 25
26#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index 13f8a7ac3ba9..aab1954e2747 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -19,7 +19,7 @@
19#include <asm/types.h> 19#include <asm/types.h>
20#include <asm/setup.h> 20#include <asm/setup.h>
21#include <asm/memory.h> 21#include <asm/memory.h>
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-ixp4xx/gateway7001-pci.c b/arch/arm/mach-ixp4xx/gateway7001-pci.c
index afd1dc14e597..7e93a0975c4d 100644
--- a/arch/arm/mach-ixp4xx/gateway7001-pci.c
+++ b/arch/arm/mach-ixp4xx/gateway7001-pci.c
@@ -23,7 +23,7 @@
23#include <linux/irq.h> 23#include <linux/irq.h>
24 24
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27 27
28#include <asm/mach/pci.h> 28#include <asm/mach/pci.h>
29 29
diff --git a/arch/arm/mach-ixp4xx/gateway7001-setup.c b/arch/arm/mach-ixp4xx/gateway7001-setup.c
index 37876832e141..59b73a0ddfa9 100644
--- a/arch/arm/mach-ixp4xx/gateway7001-setup.c
+++ b/arch/arm/mach-ixp4xx/gateway7001-setup.c
@@ -22,7 +22,7 @@
22#include <asm/types.h> 22#include <asm/types.h>
23#include <asm/setup.h> 23#include <asm/setup.h>
24#include <asm/memory.h> 24#include <asm/memory.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-pci.c b/arch/arm/mach-ixp4xx/gtwx5715-pci.c
index 20960704183b..7b8a2c323840 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-pci.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-pci.c
@@ -28,8 +28,8 @@
28#include <linux/irq.h> 28#include <linux/irq.h>
29 29
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/arch/gtwx5715.h> 32#include <mach/gtwx5715.h>
33#include <asm/mach/pci.h> 33#include <asm/mach/pci.h>
34 34
35/* 35/*
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index dc6725bda3c4..25c21d6665ec 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -32,12 +32,12 @@
32#include <asm/types.h> 32#include <asm/types.h>
33#include <asm/setup.h> 33#include <asm/setup.h>
34#include <asm/memory.h> 34#include <asm/memory.h>
35#include <asm/hardware.h> 35#include <mach/hardware.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/mach-types.h> 37#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
39#include <asm/mach/flash.h> 39#include <asm/mach/flash.h>
40#include <asm/arch/gtwx5715.h> 40#include <mach/gtwx5715.h>
41 41
42/* 42/*
43 * Xscale UART registers are 32 bits wide with only the least 43 * Xscale UART registers are 32 bits wide with only the least
diff --git a/arch/arm/mach-ixp4xx/include/mach/avila.h b/arch/arm/mach-ixp4xx/include/mach/avila.h
new file mode 100644
index 000000000000..1640cb61972b
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/avila.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/avila.h
3 *
4 * Gateworks Avila platform specific definitions
5 *
6 * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
7 *
8 * Based on ixdp425.h
9 * Author: Deepak Saxena <dsaxena@plexity.net>
10 *
11 * Copyright 2004 (c) MontaVista, Software, Inc.
12 *
13 * This file is licensed under the terms of the GNU General Public
14 * License version 2. This program is licensed "as is" without any
15 * warranty of any kind, whether express or implied.
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <mach/hardware.h>"
20#endif
21
22#define AVILA_SDA_PIN 7
23#define AVILA_SCL_PIN 6
24
25/*
26 * AVILA PCI IRQs
27 */
28#define AVILA_PCI_MAX_DEV 4
29#define LOFT_PCI_MAX_DEV 6
30#define AVILA_PCI_IRQ_LINES 4
31
32
33/* PCI controller GPIO to IRQ pin mappings */
34#define AVILA_PCI_INTA_PIN 11
35#define AVILA_PCI_INTB_PIN 10
36#define AVILA_PCI_INTC_PIN 9
37#define AVILA_PCI_INTD_PIN 8
38
39
diff --git a/arch/arm/mach-ixp4xx/include/mach/coyote.h b/arch/arm/mach-ixp4xx/include/mach/coyote.h
new file mode 100644
index 000000000000..717ac6d16f55
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/coyote.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/coyote.h
3 *
4 * ADI Engineering platform specific definitions
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista, Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#ifndef __ASM_ARCH_HARDWARE_H__
16#error "Do not include this directly, instead #include <mach/hardware.h>"
17#endif
18
19/* PCI controller GPIO to IRQ pin mappings */
20#define COYOTE_PCI_SLOT0_PIN 6
21#define COYOTE_PCI_SLOT1_PIN 11
22
23#define COYOTE_PCI_SLOT0_DEVID 14
24#define COYOTE_PCI_SLOT1_DEVID 15
25
26#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_BASE(3)
27#define COYOTE_IDE_BASE_VIRT 0xFFFE1000
28#define COYOTE_IDE_REGION_SIZE 0x1000
29
30#define COYOTE_IDE_DATA_PORT 0xFFFE10E0
31#define COYOTE_IDE_CTRL_PORT 0xFFFE10FC
32#define COYOTE_IDE_ERROR_PORT 0xFFFE10E2
33
diff --git a/arch/arm/mach-ixp4xx/include/mach/cpu.h b/arch/arm/mach-ixp4xx/include/mach/cpu.h
new file mode 100644
index 000000000000..ff8aa2393bf9
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/cpu.h
@@ -0,0 +1,46 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/cpu.h
3 *
4 * IXP4XX cpu type detection
5 *
6 * Copyright (C) 2007 MontaVista Software, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#ifndef __ASM_ARCH_CPU_H__
15#define __ASM_ARCH_CPU_H__
16
17extern unsigned int processor_id;
18/* Processor id value in CP15 Register 0 */
19#define IXP425_PROCESSOR_ID_VALUE 0x690541c0
20#define IXP435_PROCESSOR_ID_VALUE 0x69054040
21#define IXP465_PROCESSOR_ID_VALUE 0x69054200
22#define IXP4XX_PROCESSOR_ID_MASK 0xfffffff0
23
24#define cpu_is_ixp42x() ((processor_id & IXP4XX_PROCESSOR_ID_MASK) == \
25 IXP425_PROCESSOR_ID_VALUE)
26#define cpu_is_ixp43x() ((processor_id & IXP4XX_PROCESSOR_ID_MASK) == \
27 IXP435_PROCESSOR_ID_VALUE)
28#define cpu_is_ixp46x() ((processor_id & IXP4XX_PROCESSOR_ID_MASK) == \
29 IXP465_PROCESSOR_ID_VALUE)
30
31static inline u32 ixp4xx_read_feature_bits(void)
32{
33 unsigned int val = ~*IXP4XX_EXP_CFG2;
34 val &= ~IXP4XX_FEATURE_RESERVED;
35 if (!cpu_is_ixp46x())
36 val &= ~IXP4XX_FEATURE_IXP46X_ONLY;
37
38 return val;
39}
40
41static inline void ixp4xx_write_feature_bits(u32 value)
42{
43 *IXP4XX_EXP_CFG2 = ~value;
44}
45
46#endif /* _ASM_ARCH_CPU_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
new file mode 100644
index 000000000000..7c6a6912acde
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
@@ -0,0 +1,24 @@
1/* arch/arm/mach-ixp4xx/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 .macro addruart,rx
14 mrc p15, 0, \rx, c1, c0
15 tst \rx, #1 @ MMU enabled?
16 moveq \rx, #0xc8000000
17 movne \rx, #0xff000000
18 orrne \rx, \rx, #0x00b00000
19 add \rx,\rx,#3 @ Uart regs are at off set of 3 if
20 @ byte writes used - Big Endian.
21 .endm
22
23#define UART_SHIFT 2
24#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-ixp4xx/include/mach/dma.h b/arch/arm/mach-ixp4xx/include/mach/dma.h
new file mode 100644
index 000000000000..00c5070c0201
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/dma.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/dma.h
3 *
4 * Copyright (C) 2001-2004 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#include <linux/device.h>
15#include <asm/page.h>
16#include <asm/sizes.h>
17#include <mach/hardware.h>
18
19#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M)
20
21#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/dsmg600.h b/arch/arm/mach-ixp4xx/include/mach/dsmg600.h
new file mode 100644
index 000000000000..dc087a34a268
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/dsmg600.h
@@ -0,0 +1,52 @@
1/*
2 * DSM-G600 platform specific definitions
3 *
4 * Copyright (C) 2006 Tower Technologies
5 * Author: Alessandro Zummo <a.zummo@towertech.it>
6 *
7 * based on ixdp425.h:
8 * Copyright 2004 (C) MontaVista, Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#ifndef __ASM_ARCH_HARDWARE_H__
16#error "Do not include this directly, instead #include <mach/hardware.h>"
17#endif
18
19#define DSMG600_SDA_PIN 5
20#define DSMG600_SCL_PIN 4
21
22/*
23 * DSMG600 PCI IRQs
24 */
25#define DSMG600_PCI_MAX_DEV 4
26#define DSMG600_PCI_IRQ_LINES 3
27
28
29/* PCI controller GPIO to IRQ pin mappings */
30#define DSMG600_PCI_INTA_PIN 11
31#define DSMG600_PCI_INTB_PIN 10
32#define DSMG600_PCI_INTC_PIN 9
33#define DSMG600_PCI_INTD_PIN 8
34#define DSMG600_PCI_INTE_PIN 7
35#define DSMG600_PCI_INTF_PIN 6
36
37/* DSM-G600 Timer Setting */
38#define DSMG600_FREQ 66000000
39
40/* Buttons */
41
42#define DSMG600_PB_GPIO 15 /* power button */
43#define DSMG600_RB_GPIO 3 /* reset button */
44
45/* Power control */
46
47#define DSMG600_PO_GPIO 2 /* power off */
48
49/* LEDs */
50
51#define DSMG600_LED_PWR_GPIO 0
52#define DSMG600_LED_WLAN_GPIO 14
diff --git a/arch/arm/mach-ixp4xx/include/mach/entry-macro.S b/arch/arm/mach-ixp4xx/include/mach/entry-macro.S
new file mode 100644
index 000000000000..f2e14e94ed15
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/entry-macro.S
@@ -0,0 +1,47 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for IXP4xx-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 .macro disable_fiq
13 .endm
14
15 .macro get_irqnr_preamble, base, tmp
16 .endm
17
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
22 ldr \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET)
23 ldr \irqstat, [\irqstat] @ get interrupts
24 cmp \irqstat, #0
25 beq 1001f @ upper IRQ?
26 clz \irqnr, \irqstat
27 mov \base, #31
28 sub \irqnr, \base, \irqnr
29 b 1002f @ lower IRQ being
30 @ handled
31
321001:
33 /*
34 * IXP465/IXP435 has an upper IRQ status register
35 */
36#if defined(CONFIG_CPU_IXP46X) || defined(CONFIG_CPU_IXP43X)
37 ldr \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP2_OFFSET)
38 ldr \irqstat, [\irqstat] @ get upper interrupts
39 mov \irqnr, #63
40 clz \irqstat, \irqstat
41 cmp \irqstat, #32
42 subne \irqnr, \irqnr, \irqstat
43#endif
441002:
45 .endm
46
47
diff --git a/arch/arm/mach-ixp4xx/include/mach/fsg.h b/arch/arm/mach-ixp4xx/include/mach/fsg.h
new file mode 100644
index 000000000000..1f02b7e22a13
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/fsg.h
@@ -0,0 +1,50 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/fsg.h
3 *
4 * Freecom FSG-3 platform specific definitions
5 *
6 * Author: Rod Whitby <rod@whitby.id.au>
7 * Author: Tomasz Chmielewski <mangoo@wpkg.org>
8 * Maintainers: http://www.nslu2-linux.org
9 *
10 * Based on coyote.h by
11 * Copyright 2004 (c) MontaVista, Software, Inc.
12 *
13 * This file is licensed under the terms of the GNU General Public
14 * License version 2. This program is licensed "as is" without any
15 * warranty of any kind, whether express or implied.
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <mach/hardware.h>"
20#endif
21
22#define FSG_SDA_PIN 12
23#define FSG_SCL_PIN 13
24
25/*
26 * FSG PCI IRQs
27 */
28#define FSG_PCI_MAX_DEV 3
29#define FSG_PCI_IRQ_LINES 3
30
31
32/* PCI controller GPIO to IRQ pin mappings */
33#define FSG_PCI_INTA_PIN 6
34#define FSG_PCI_INTB_PIN 7
35#define FSG_PCI_INTC_PIN 5
36
37/* Buttons */
38
39#define FSG_SB_GPIO 4 /* sync button */
40#define FSG_RB_GPIO 9 /* reset button */
41#define FSG_UB_GPIO 10 /* usb button */
42
43/* LEDs */
44
45#define FSG_LED_WLAN_BIT 0
46#define FSG_LED_WAN_BIT 1
47#define FSG_LED_SATA_BIT 2
48#define FSG_LED_USB_BIT 4
49#define FSG_LED_RING_BIT 5
50#define FSG_LED_SYNC_BIT 7
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h
new file mode 100644
index 000000000000..9fbde177920f
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h
@@ -0,0 +1,73 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/gpio.h
3 *
4 * IXP4XX GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Milan Svoboda <msvoboda@ra.rockwell.com>
7 * Based on PXA implementation by Philipp Zabel <philipp.zabel@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 * 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#ifndef __ASM_ARCH_IXP4XX_GPIO_H
26#define __ASM_ARCH_IXP4XX_GPIO_H
27
28#include <mach/hardware.h>
29
30static inline int gpio_request(unsigned gpio, const char *label)
31{
32 return 0;
33}
34
35static inline void gpio_free(unsigned gpio)
36{
37 return;
38}
39
40static inline int gpio_direction_input(unsigned gpio)
41{
42 gpio_line_config(gpio, IXP4XX_GPIO_IN);
43 return 0;
44}
45
46static inline int gpio_direction_output(unsigned gpio, int level)
47{
48 gpio_line_set(gpio, level);
49 gpio_line_config(gpio, IXP4XX_GPIO_OUT);
50 return 0;
51}
52
53static inline int gpio_get_value(unsigned gpio)
54{
55 int value;
56
57 gpio_line_get(gpio, &value);
58
59 return value;
60}
61
62static inline void gpio_set_value(unsigned gpio, int value)
63{
64 gpio_line_set(gpio, value);
65}
66
67#include <asm-generic/gpio.h> /* cansleep wrappers */
68
69extern int gpio_to_irq(int gpio);
70extern int irq_to_gpio(int gpio);
71
72#endif
73
diff --git a/arch/arm/mach-ixp4xx/include/mach/gtwx5715.h b/arch/arm/mach-ixp4xx/include/mach/gtwx5715.h
new file mode 100644
index 000000000000..5d5e201cac7e
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/gtwx5715.h
@@ -0,0 +1,116 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/gtwx5715.h
3 *
4 * Gemtek GTWX5715 Gateway (Linksys WRV54G)
5 *
6 * Copyright 2004 (c) George T. Joseph
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23#ifndef __ASM_ARCH_HARDWARE_H__
24#error "Do not include this directly, instead #include <mach/hardware.h>"
25#endif
26#include "irqs.h"
27
28#define GTWX5715_GPIO0 0
29#define GTWX5715_GPIO1 1
30#define GTWX5715_GPIO2 2
31#define GTWX5715_GPIO3 3
32#define GTWX5715_GPIO4 4
33#define GTWX5715_GPIO5 5
34#define GTWX5715_GPIO6 6
35#define GTWX5715_GPIO7 7
36#define GTWX5715_GPIO8 8
37#define GTWX5715_GPIO9 9
38#define GTWX5715_GPIO10 10
39#define GTWX5715_GPIO11 11
40#define GTWX5715_GPIO12 12
41#define GTWX5715_GPIO13 13
42#define GTWX5715_GPIO14 14
43
44#define GTWX5715_GPIO0_IRQ IRQ_IXP4XX_GPIO0
45#define GTWX5715_GPIO1_IRQ IRQ_IXP4XX_GPIO1
46#define GTWX5715_GPIO2_IRQ IRQ_IXP4XX_GPIO2
47#define GTWX5715_GPIO3_IRQ IRQ_IXP4XX_GPIO3
48#define GTWX5715_GPIO4_IRQ IRQ_IXP4XX_GPIO4
49#define GTWX5715_GPIO5_IRQ IRQ_IXP4XX_GPIO5
50#define GTWX5715_GPIO6_IRQ IRQ_IXP4XX_GPIO6
51#define GTWX5715_GPIO7_IRQ IRQ_IXP4XX_GPIO7
52#define GTWX5715_GPIO8_IRQ IRQ_IXP4XX_GPIO8
53#define GTWX5715_GPIO9_IRQ IRQ_IXP4XX_GPIO9
54#define GTWX5715_GPIO10_IRQ IRQ_IXP4XX_GPIO10
55#define GTWX5715_GPIO11_IRQ IRQ_IXP4XX_GPIO11
56#define GTWX5715_GPIO12_IRQ IRQ_IXP4XX_GPIO12
57#define GTWX5715_GPIO13_IRQ IRQ_IXP4XX_SW_INT1
58#define GTWX5715_GPIO14_IRQ IRQ_IXP4XX_SW_INT2
59
60/* PCI controller GPIO to IRQ pin mappings
61
62 INTA INTB
63SLOT 0 10 11
64SLOT 1 11 10
65
66*/
67
68#define GTWX5715_PCI_SLOT0_DEVID 0
69#define GTWX5715_PCI_SLOT0_INTA_GPIO GTWX5715_GPIO10
70#define GTWX5715_PCI_SLOT0_INTB_GPIO GTWX5715_GPIO11
71#define GTWX5715_PCI_SLOT0_INTA_IRQ GTWX5715_GPIO10_IRQ
72#define GTWX5715_PCI_SLOT0_INTB_IRQ GTWX5715_GPIO11_IRQ
73
74#define GTWX5715_PCI_SLOT1_DEVID 1
75#define GTWX5715_PCI_SLOT1_INTA_GPIO GTWX5715_GPIO11
76#define GTWX5715_PCI_SLOT1_INTB_GPIO GTWX5715_GPIO10
77#define GTWX5715_PCI_SLOT1_INTA_IRQ GTWX5715_GPIO11_IRQ
78#define GTWX5715_PCI_SLOT1_INTB_IRQ GTWX5715_GPIO10_IRQ
79
80#define GTWX5715_PCI_SLOT_COUNT 2
81#define GTWX5715_PCI_INT_PIN_COUNT 2
82
83/*
84 * GPIO 5,6,7 and12 are hard wired to the Kendin KS8995M Switch
85 * and operate as an SPI type interface. The details of the interface
86 * are available on Kendin/Micrel's web site.
87 */
88
89#define GTWX5715_KSSPI_SELECT GTWX5715_GPIO5
90#define GTWX5715_KSSPI_TXD GTWX5715_GPIO6
91#define GTWX5715_KSSPI_CLOCK GTWX5715_GPIO7
92#define GTWX5715_KSSPI_RXD GTWX5715_GPIO12
93
94/*
95 * The "reset" button is wired to GPIO 3.
96 * The GPIO is brought "low" when the button is pushed.
97 */
98
99#define GTWX5715_BUTTON_GPIO GTWX5715_GPIO3
100#define GTWX5715_BUTTON_IRQ GTWX5715_GPIO3_IRQ
101
102/*
103 * Board Label Front Label
104 * LED1 Power
105 * LED2 Wireless-G
106 * LED3 not populated but could be
107 * LED4 Internet
108 * LED5 - LED8 Controlled by KS8995M Switch
109 * LED9 DMZ
110 */
111
112#define GTWX5715_LED1_GPIO GTWX5715_GPIO2
113#define GTWX5715_LED2_GPIO GTWX5715_GPIO9
114#define GTWX5715_LED3_GPIO GTWX5715_GPIO8
115#define GTWX5715_LED4_GPIO GTWX5715_GPIO1
116#define GTWX5715_LED9_GPIO GTWX5715_GPIO4
diff --git a/arch/arm/mach-ixp4xx/include/mach/hardware.h b/arch/arm/mach-ixp4xx/include/mach/hardware.h
new file mode 100644
index 000000000000..f58a43a23966
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/hardware.h
@@ -0,0 +1,50 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/hardware.h
3 *
4 * Copyright (C) 2002 Intel Corporation.
5 * Copyright (C) 2003-2004 MontaVista Software, Inc.
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
13/*
14 * Hardware definitions for IXP4xx based systems
15 */
16
17#ifndef __ASM_ARCH_HARDWARE_H__
18#define __ASM_ARCH_HARDWARE_H__
19
20#define PCIBIOS_MIN_IO 0x00001000
21#define PCIBIOS_MIN_MEM (cpu_is_ixp43x() ? 0x40000000 : 0x48000000)
22
23/*
24 * We override the standard dma-mask routines for bouncing.
25 */
26#define HAVE_ARCH_PCI_SET_DMA_MASK
27
28#define pcibios_assign_all_busses() 1
29
30/* Register locations and bits */
31#include "ixp4xx-regs.h"
32
33#ifndef __ASSEMBLER__
34#include <mach/cpu.h>
35#endif
36
37/* Platform helper functions and definitions */
38#include "platform.h"
39
40/* Platform specific details */
41#include "ixdp425.h"
42#include "avila.h"
43#include "coyote.h"
44#include "prpmc1100.h"
45#include "nslu2.h"
46#include "nas100d.h"
47#include "dsmg600.h"
48#include "fsg.h"
49
50#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
new file mode 100644
index 000000000000..319948e31bec
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -0,0 +1,569 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/io.h
3 *
4 * Author: Deepak Saxena <dsaxena@plexity.net>
5 *
6 * Copyright (C) 2002-2005 MontaVista Software, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ASM_ARM_ARCH_IO_H
14#define __ASM_ARM_ARCH_IO_H
15
16#include <linux/bitops.h>
17
18#include <mach/hardware.h>
19
20#define IO_SPACE_LIMIT 0xffff0000
21
22extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data);
23extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
24
25
26/*
27 * IXP4xx provides two methods of accessing PCI memory space:
28 *
29 * 1) A direct mapped window from 0x48000000 to 0x4bffffff (64MB).
30 * To access PCI via this space, we simply ioremap() the BAR
31 * into the kernel and we can use the standard read[bwl]/write[bwl]
32 * macros. This is the preffered method due to speed but it
33 * limits the system to just 64MB of PCI memory. This can be
34 * problamatic if using video cards and other memory-heavy
35 * targets.
36 *
37 * 2) If > 64MB of memory space is required, the IXP4xx can be configured
38 * to use indirect registers to access PCI (as we do below for I/O
39 * transactions). This allows for up to 128MB (0x48000000 to 0x4fffffff)
40 * of memory on the bus. The disadvantage of this is that every
41 * PCI access requires three local register accesses plus a spinlock,
42 * but in some cases the performance hit is acceptable. In addition,
43 * you cannot mmap() PCI devices in this case.
44 *
45 */
46#ifndef CONFIG_IXP4XX_INDIRECT_PCI
47
48#define __mem_pci(a) (a)
49
50#else
51
52#include <linux/mm.h>
53
54/*
55 * In the case of using indirect PCI, we simply return the actual PCI
56 * address and our read/write implementation use that to drive the
57 * access registers. If something outside of PCI is ioremap'd, we
58 * fallback to the default.
59 */
60static inline void __iomem *
61__ixp4xx_ioremap(unsigned long addr, size_t size, unsigned int mtype)
62{
63 if((addr < PCIBIOS_MIN_MEM) || (addr > 0x4fffffff))
64 return __arm_ioremap(addr, size, mtype);
65
66 return (void __iomem *)addr;
67}
68
69static inline void
70__ixp4xx_iounmap(void __iomem *addr)
71{
72 if ((__force u32)addr >= VMALLOC_START)
73 __iounmap(addr);
74}
75
76#define __arch_ioremap(a, s, f) __ixp4xx_ioremap(a, s, f)
77#define __arch_iounmap(a) __ixp4xx_iounmap(a)
78
79#define writeb(v, p) __ixp4xx_writeb(v, p)
80#define writew(v, p) __ixp4xx_writew(v, p)
81#define writel(v, p) __ixp4xx_writel(v, p)
82
83#define writesb(p, v, l) __ixp4xx_writesb(p, v, l)
84#define writesw(p, v, l) __ixp4xx_writesw(p, v, l)
85#define writesl(p, v, l) __ixp4xx_writesl(p, v, l)
86
87#define readb(p) __ixp4xx_readb(p)
88#define readw(p) __ixp4xx_readw(p)
89#define readl(p) __ixp4xx_readl(p)
90
91#define readsb(p, v, l) __ixp4xx_readsb(p, v, l)
92#define readsw(p, v, l) __ixp4xx_readsw(p, v, l)
93#define readsl(p, v, l) __ixp4xx_readsl(p, v, l)
94
95static inline void
96__ixp4xx_writeb(u8 value, volatile void __iomem *p)
97{
98 u32 addr = (u32)p;
99 u32 n, byte_enables, data;
100
101 if (addr >= VMALLOC_START) {
102 __raw_writeb(value, addr);
103 return;
104 }
105
106 n = addr % 4;
107 byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
108 data = value << (8*n);
109 ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data);
110}
111
112static inline void
113__ixp4xx_writesb(volatile void __iomem *bus_addr, const u8 *vaddr, int count)
114{
115 while (count--)
116 writeb(*vaddr++, bus_addr);
117}
118
119static inline void
120__ixp4xx_writew(u16 value, volatile void __iomem *p)
121{
122 u32 addr = (u32)p;
123 u32 n, byte_enables, data;
124
125 if (addr >= VMALLOC_START) {
126 __raw_writew(value, addr);
127 return;
128 }
129
130 n = addr % 4;
131 byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
132 data = value << (8*n);
133 ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data);
134}
135
136static inline void
137__ixp4xx_writesw(volatile void __iomem *bus_addr, const u16 *vaddr, int count)
138{
139 while (count--)
140 writew(*vaddr++, bus_addr);
141}
142
143static inline void
144__ixp4xx_writel(u32 value, volatile void __iomem *p)
145{
146 u32 addr = (__force u32)p;
147 if (addr >= VMALLOC_START) {
148 __raw_writel(value, p);
149 return;
150 }
151
152 ixp4xx_pci_write(addr, NP_CMD_MEMWRITE, value);
153}
154
155static inline void
156__ixp4xx_writesl(volatile void __iomem *bus_addr, const u32 *vaddr, int count)
157{
158 while (count--)
159 writel(*vaddr++, bus_addr);
160}
161
162static inline unsigned char
163__ixp4xx_readb(const volatile void __iomem *p)
164{
165 u32 addr = (u32)p;
166 u32 n, byte_enables, data;
167
168 if (addr >= VMALLOC_START)
169 return __raw_readb(addr);
170
171 n = addr % 4;
172 byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
173 if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_MEMREAD, &data))
174 return 0xff;
175
176 return data >> (8*n);
177}
178
179static inline void
180__ixp4xx_readsb(const volatile void __iomem *bus_addr, u8 *vaddr, u32 count)
181{
182 while (count--)
183 *vaddr++ = readb(bus_addr);
184}
185
186static inline unsigned short
187__ixp4xx_readw(const volatile void __iomem *p)
188{
189 u32 addr = (u32)p;
190 u32 n, byte_enables, data;
191
192 if (addr >= VMALLOC_START)
193 return __raw_readw(addr);
194
195 n = addr % 4;
196 byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
197 if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_MEMREAD, &data))
198 return 0xffff;
199
200 return data>>(8*n);
201}
202
203static inline void
204__ixp4xx_readsw(const volatile void __iomem *bus_addr, u16 *vaddr, u32 count)
205{
206 while (count--)
207 *vaddr++ = readw(bus_addr);
208}
209
210static inline unsigned long
211__ixp4xx_readl(const volatile void __iomem *p)
212{
213 u32 addr = (__force u32)p;
214 u32 data;
215
216 if (addr >= VMALLOC_START)
217 return __raw_readl(p);
218
219 if (ixp4xx_pci_read(addr, NP_CMD_MEMREAD, &data))
220 return 0xffffffff;
221
222 return data;
223}
224
225static inline void
226__ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
227{
228 while (count--)
229 *vaddr++ = readl(bus_addr);
230}
231
232
233/*
234 * We can use the built-in functions b/c they end up calling writeb/readb
235 */
236#define memset_io(c,v,l) _memset_io((c),(v),(l))
237#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l))
238#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l))
239
240#endif
241
242#ifndef CONFIG_PCI
243
244#define __io(v) v
245
246#else
247
248/*
249 * IXP4xx does not have a transparent cpu -> PCI I/O translation
250 * window. Instead, it has a set of registers that must be tweaked
251 * with the proper byte lanes, command types, and address for the
252 * transaction. This means that we need to override the default
253 * I/O functions.
254 */
255#define outb(p, v) __ixp4xx_outb(p, v)
256#define outw(p, v) __ixp4xx_outw(p, v)
257#define outl(p, v) __ixp4xx_outl(p, v)
258
259#define outsb(p, v, l) __ixp4xx_outsb(p, v, l)
260#define outsw(p, v, l) __ixp4xx_outsw(p, v, l)
261#define outsl(p, v, l) __ixp4xx_outsl(p, v, l)
262
263#define inb(p) __ixp4xx_inb(p)
264#define inw(p) __ixp4xx_inw(p)
265#define inl(p) __ixp4xx_inl(p)
266
267#define insb(p, v, l) __ixp4xx_insb(p, v, l)
268#define insw(p, v, l) __ixp4xx_insw(p, v, l)
269#define insl(p, v, l) __ixp4xx_insl(p, v, l)
270
271
272static inline void
273__ixp4xx_outb(u8 value, u32 addr)
274{
275 u32 n, byte_enables, data;
276 n = addr % 4;
277 byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
278 data = value << (8*n);
279 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
280}
281
282static inline void
283__ixp4xx_outsb(u32 io_addr, const u8 *vaddr, u32 count)
284{
285 while (count--)
286 outb(*vaddr++, io_addr);
287}
288
289static inline void
290__ixp4xx_outw(u16 value, u32 addr)
291{
292 u32 n, byte_enables, data;
293 n = addr % 4;
294 byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
295 data = value << (8*n);
296 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
297}
298
299static inline void
300__ixp4xx_outsw(u32 io_addr, const u16 *vaddr, u32 count)
301{
302 while (count--)
303 outw(cpu_to_le16(*vaddr++), io_addr);
304}
305
306static inline void
307__ixp4xx_outl(u32 value, u32 addr)
308{
309 ixp4xx_pci_write(addr, NP_CMD_IOWRITE, value);
310}
311
312static inline void
313__ixp4xx_outsl(u32 io_addr, const u32 *vaddr, u32 count)
314{
315 while (count--)
316 outl(*vaddr++, io_addr);
317}
318
319static inline u8
320__ixp4xx_inb(u32 addr)
321{
322 u32 n, byte_enables, data;
323 n = addr % 4;
324 byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
325 if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_IOREAD, &data))
326 return 0xff;
327
328 return data >> (8*n);
329}
330
331static inline void
332__ixp4xx_insb(u32 io_addr, u8 *vaddr, u32 count)
333{
334 while (count--)
335 *vaddr++ = inb(io_addr);
336}
337
338static inline u16
339__ixp4xx_inw(u32 addr)
340{
341 u32 n, byte_enables, data;
342 n = addr % 4;
343 byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
344 if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_IOREAD, &data))
345 return 0xffff;
346
347 return data>>(8*n);
348}
349
350static inline void
351__ixp4xx_insw(u32 io_addr, u16 *vaddr, u32 count)
352{
353 while (count--)
354 *vaddr++ = le16_to_cpu(inw(io_addr));
355}
356
357static inline u32
358__ixp4xx_inl(u32 addr)
359{
360 u32 data;
361 if (ixp4xx_pci_read(addr, NP_CMD_IOREAD, &data))
362 return 0xffffffff;
363
364 return data;
365}
366
367static inline void
368__ixp4xx_insl(u32 io_addr, u32 *vaddr, u32 count)
369{
370 while (count--)
371 *vaddr++ = inl(io_addr);
372}
373
374#define PIO_OFFSET 0x10000UL
375#define PIO_MASK 0x0ffffUL
376
377#define __is_io_address(p) (((unsigned long)p >= PIO_OFFSET) && \
378 ((unsigned long)p <= (PIO_MASK + PIO_OFFSET)))
379static inline unsigned int
380__ixp4xx_ioread8(const void __iomem *addr)
381{
382 unsigned long port = (unsigned long __force)addr;
383 if (__is_io_address(port))
384 return (unsigned int)__ixp4xx_inb(port & PIO_MASK);
385 else
386#ifndef CONFIG_IXP4XX_INDIRECT_PCI
387 return (unsigned int)__raw_readb(port);
388#else
389 return (unsigned int)__ixp4xx_readb(addr);
390#endif
391}
392
393static inline void
394__ixp4xx_ioread8_rep(const void __iomem *addr, void *vaddr, u32 count)
395{
396 unsigned long port = (unsigned long __force)addr;
397 if (__is_io_address(port))
398 __ixp4xx_insb(port & PIO_MASK, vaddr, count);
399 else
400#ifndef CONFIG_IXP4XX_INDIRECT_PCI
401 __raw_readsb(addr, vaddr, count);
402#else
403 __ixp4xx_readsb(addr, vaddr, count);
404#endif
405}
406
407static inline unsigned int
408__ixp4xx_ioread16(const void __iomem *addr)
409{
410 unsigned long port = (unsigned long __force)addr;
411 if (__is_io_address(port))
412 return (unsigned int)__ixp4xx_inw(port & PIO_MASK);
413 else
414#ifndef CONFIG_IXP4XX_INDIRECT_PCI
415 return le16_to_cpu(__raw_readw((u32)port));
416#else
417 return (unsigned int)__ixp4xx_readw(addr);
418#endif
419}
420
421static inline void
422__ixp4xx_ioread16_rep(const void __iomem *addr, void *vaddr, u32 count)
423{
424 unsigned long port = (unsigned long __force)addr;
425 if (__is_io_address(port))
426 __ixp4xx_insw(port & PIO_MASK, vaddr, count);
427 else
428#ifndef CONFIG_IXP4XX_INDIRECT_PCI
429 __raw_readsw(addr, vaddr, count);
430#else
431 __ixp4xx_readsw(addr, vaddr, count);
432#endif
433}
434
435static inline unsigned int
436__ixp4xx_ioread32(const void __iomem *addr)
437{
438 unsigned long port = (unsigned long __force)addr;
439 if (__is_io_address(port))
440 return (unsigned int)__ixp4xx_inl(port & PIO_MASK);
441 else {
442#ifndef CONFIG_IXP4XX_INDIRECT_PCI
443 return le32_to_cpu((__force __le32)__raw_readl(addr));
444#else
445 return (unsigned int)__ixp4xx_readl(addr);
446#endif
447 }
448}
449
450static inline void
451__ixp4xx_ioread32_rep(const void __iomem *addr, void *vaddr, u32 count)
452{
453 unsigned long port = (unsigned long __force)addr;
454 if (__is_io_address(port))
455 __ixp4xx_insl(port & PIO_MASK, vaddr, count);
456 else
457#ifndef CONFIG_IXP4XX_INDIRECT_PCI
458 __raw_readsl(addr, vaddr, count);
459#else
460 __ixp4xx_readsl(addr, vaddr, count);
461#endif
462}
463
464static inline void
465__ixp4xx_iowrite8(u8 value, void __iomem *addr)
466{
467 unsigned long port = (unsigned long __force)addr;
468 if (__is_io_address(port))
469 __ixp4xx_outb(value, port & PIO_MASK);
470 else
471#ifndef CONFIG_IXP4XX_INDIRECT_PCI
472 __raw_writeb(value, port);
473#else
474 __ixp4xx_writeb(value, addr);
475#endif
476}
477
478static inline void
479__ixp4xx_iowrite8_rep(void __iomem *addr, const void *vaddr, u32 count)
480{
481 unsigned long port = (unsigned long __force)addr;
482 if (__is_io_address(port))
483 __ixp4xx_outsb(port & PIO_MASK, vaddr, count);
484 else
485#ifndef CONFIG_IXP4XX_INDIRECT_PCI
486 __raw_writesb(addr, vaddr, count);
487#else
488 __ixp4xx_writesb(addr, vaddr, count);
489#endif
490}
491
492static inline void
493__ixp4xx_iowrite16(u16 value, void __iomem *addr)
494{
495 unsigned long port = (unsigned long __force)addr;
496 if (__is_io_address(port))
497 __ixp4xx_outw(value, port & PIO_MASK);
498 else
499#ifndef CONFIG_IXP4XX_INDIRECT_PCI
500 __raw_writew(cpu_to_le16(value), addr);
501#else
502 __ixp4xx_writew(value, addr);
503#endif
504}
505
506static inline void
507__ixp4xx_iowrite16_rep(void __iomem *addr, const void *vaddr, u32 count)
508{
509 unsigned long port = (unsigned long __force)addr;
510 if (__is_io_address(port))
511 __ixp4xx_outsw(port & PIO_MASK, vaddr, count);
512 else
513#ifndef CONFIG_IXP4XX_INDIRECT_PCI
514 __raw_writesw(addr, vaddr, count);
515#else
516 __ixp4xx_writesw(addr, vaddr, count);
517#endif
518}
519
520static inline void
521__ixp4xx_iowrite32(u32 value, void __iomem *addr)
522{
523 unsigned long port = (unsigned long __force)addr;
524 if (__is_io_address(port))
525 __ixp4xx_outl(value, port & PIO_MASK);
526 else
527#ifndef CONFIG_IXP4XX_INDIRECT_PCI
528 __raw_writel((u32 __force)cpu_to_le32(value), addr);
529#else
530 __ixp4xx_writel(value, addr);
531#endif
532}
533
534static inline void
535__ixp4xx_iowrite32_rep(void __iomem *addr, const void *vaddr, u32 count)
536{
537 unsigned long port = (unsigned long __force)addr;
538 if (__is_io_address(port))
539 __ixp4xx_outsl(port & PIO_MASK, vaddr, count);
540 else
541#ifndef CONFIG_IXP4XX_INDIRECT_PCI
542 __raw_writesl(addr, vaddr, count);
543#else
544 __ixp4xx_writesl(addr, vaddr, count);
545#endif
546}
547
548#define ioread8(p) __ixp4xx_ioread8(p)
549#define ioread16(p) __ixp4xx_ioread16(p)
550#define ioread32(p) __ixp4xx_ioread32(p)
551
552#define ioread8_rep(p, v, c) __ixp4xx_ioread8_rep(p, v, c)
553#define ioread16_rep(p, v, c) __ixp4xx_ioread16_rep(p, v, c)
554#define ioread32_rep(p, v, c) __ixp4xx_ioread32_rep(p, v, c)
555
556#define iowrite8(v,p) __ixp4xx_iowrite8(v,p)
557#define iowrite16(v,p) __ixp4xx_iowrite16(v,p)
558#define iowrite32(v,p) __ixp4xx_iowrite32(v,p)
559
560#define iowrite8_rep(p, v, c) __ixp4xx_iowrite8_rep(p, v, c)
561#define iowrite16_rep(p, v, c) __ixp4xx_iowrite16_rep(p, v, c)
562#define iowrite32_rep(p, v, c) __ixp4xx_iowrite32_rep(p, v, c)
563
564#define ioport_map(port, nr) ((void __iomem*)(port + PIO_OFFSET))
565#define ioport_unmap(addr)
566#endif // !CONFIG_PCI
567
568#endif // __ASM_ARM_ARCH_IO_H
569
diff --git a/arch/arm/mach-ixp4xx/include/mach/irqs.h b/arch/arm/mach-ixp4xx/include/mach/irqs.h
new file mode 100644
index 000000000000..f4d74de1566a
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/irqs.h
@@ -0,0 +1,138 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/irqs.h
3 *
4 * IRQ definitions for IXP4XX based systems
5 *
6 * Copyright (C) 2002 Intel Corporation.
7 * Copyright (C) 2003 MontaVista Software, 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 version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#ifndef _ARCH_IXP4XX_IRQS_H_
16#define _ARCH_IXP4XX_IRQS_H_
17
18
19#define IRQ_IXP4XX_NPEA 0
20#define IRQ_IXP4XX_NPEB 1
21#define IRQ_IXP4XX_NPEC 2
22#define IRQ_IXP4XX_QM1 3
23#define IRQ_IXP4XX_QM2 4
24#define IRQ_IXP4XX_TIMER1 5
25#define IRQ_IXP4XX_GPIO0 6
26#define IRQ_IXP4XX_GPIO1 7
27#define IRQ_IXP4XX_PCI_INT 8
28#define IRQ_IXP4XX_PCI_DMA1 9
29#define IRQ_IXP4XX_PCI_DMA2 10
30#define IRQ_IXP4XX_TIMER2 11
31#define IRQ_IXP4XX_USB 12
32#define IRQ_IXP4XX_UART2 13
33#define IRQ_IXP4XX_TIMESTAMP 14
34#define IRQ_IXP4XX_UART1 15
35#define IRQ_IXP4XX_WDOG 16
36#define IRQ_IXP4XX_AHB_PMU 17
37#define IRQ_IXP4XX_XSCALE_PMU 18
38#define IRQ_IXP4XX_GPIO2 19
39#define IRQ_IXP4XX_GPIO3 20
40#define IRQ_IXP4XX_GPIO4 21
41#define IRQ_IXP4XX_GPIO5 22
42#define IRQ_IXP4XX_GPIO6 23
43#define IRQ_IXP4XX_GPIO7 24
44#define IRQ_IXP4XX_GPIO8 25
45#define IRQ_IXP4XX_GPIO9 26
46#define IRQ_IXP4XX_GPIO10 27
47#define IRQ_IXP4XX_GPIO11 28
48#define IRQ_IXP4XX_GPIO12 29
49#define IRQ_IXP4XX_SW_INT1 30
50#define IRQ_IXP4XX_SW_INT2 31
51#define IRQ_IXP4XX_USB_HOST 32
52#define IRQ_IXP4XX_I2C 33
53#define IRQ_IXP4XX_SSP 34
54#define IRQ_IXP4XX_TSYNC 35
55#define IRQ_IXP4XX_EAU_DONE 36
56#define IRQ_IXP4XX_SHA_DONE 37
57#define IRQ_IXP4XX_SWCP_PE 58
58#define IRQ_IXP4XX_QM_PE 60
59#define IRQ_IXP4XX_MCU_ECC 61
60#define IRQ_IXP4XX_EXP_PE 62
61
62/*
63 * Only first 32 sources are valid if running on IXP42x systems
64 */
65#if defined(CONFIG_CPU_IXP46X) || defined(CONFIG_CPU_IXP43X)
66#define NR_IRQS 64
67#else
68#define NR_IRQS 32
69#endif
70
71#define XSCALE_PMU_IRQ (IRQ_IXP4XX_XSCALE_PMU)
72
73/*
74 * IXDP425 board IRQs
75 */
76#define IRQ_IXDP425_PCI_INTA IRQ_IXP4XX_GPIO11
77#define IRQ_IXDP425_PCI_INTB IRQ_IXP4XX_GPIO10
78#define IRQ_IXDP425_PCI_INTC IRQ_IXP4XX_GPIO9
79#define IRQ_IXDP425_PCI_INTD IRQ_IXP4XX_GPIO8
80
81/*
82 * Gateworks Avila board IRQs
83 */
84#define IRQ_AVILA_PCI_INTA IRQ_IXP4XX_GPIO11
85#define IRQ_AVILA_PCI_INTB IRQ_IXP4XX_GPIO10
86#define IRQ_AVILA_PCI_INTC IRQ_IXP4XX_GPIO9
87#define IRQ_AVILA_PCI_INTD IRQ_IXP4XX_GPIO8
88
89
90/*
91 * PrPMC1100 Board IRQs
92 */
93#define IRQ_PRPMC1100_PCI_INTA IRQ_IXP4XX_GPIO11
94#define IRQ_PRPMC1100_PCI_INTB IRQ_IXP4XX_GPIO10
95#define IRQ_PRPMC1100_PCI_INTC IRQ_IXP4XX_GPIO9
96#define IRQ_PRPMC1100_PCI_INTD IRQ_IXP4XX_GPIO8
97
98/*
99 * ADI Coyote Board IRQs
100 */
101#define IRQ_COYOTE_PCI_SLOT0 IRQ_IXP4XX_GPIO6
102#define IRQ_COYOTE_PCI_SLOT1 IRQ_IXP4XX_GPIO11
103#define IRQ_COYOTE_IDE IRQ_IXP4XX_GPIO5
104
105/*
106 * NSLU2 board IRQs
107 */
108#define IRQ_NSLU2_PCI_INTA IRQ_IXP4XX_GPIO11
109#define IRQ_NSLU2_PCI_INTB IRQ_IXP4XX_GPIO10
110#define IRQ_NSLU2_PCI_INTC IRQ_IXP4XX_GPIO9
111
112/*
113 * NAS100D board IRQs
114 */
115#define IRQ_NAS100D_PCI_INTA IRQ_IXP4XX_GPIO11
116#define IRQ_NAS100D_PCI_INTB IRQ_IXP4XX_GPIO10
117#define IRQ_NAS100D_PCI_INTC IRQ_IXP4XX_GPIO9
118#define IRQ_NAS100D_PCI_INTD IRQ_IXP4XX_GPIO8
119#define IRQ_NAS100D_PCI_INTE IRQ_IXP4XX_GPIO7
120
121/*
122 * D-Link DSM-G600 RevA board IRQs
123 */
124#define IRQ_DSMG600_PCI_INTA IRQ_IXP4XX_GPIO11
125#define IRQ_DSMG600_PCI_INTB IRQ_IXP4XX_GPIO10
126#define IRQ_DSMG600_PCI_INTC IRQ_IXP4XX_GPIO9
127#define IRQ_DSMG600_PCI_INTD IRQ_IXP4XX_GPIO8
128#define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7
129#define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6
130
131/*
132 * Freecom FSG-3 Board IRQs
133 */
134#define IRQ_FSG_PCI_INTA IRQ_IXP4XX_GPIO6
135#define IRQ_FSG_PCI_INTB IRQ_IXP4XX_GPIO7
136#define IRQ_FSG_PCI_INTC IRQ_IXP4XX_GPIO5
137
138#endif
diff --git a/arch/arm/mach-ixp4xx/include/mach/ixdp425.h b/arch/arm/mach-ixp4xx/include/mach/ixdp425.h
new file mode 100644
index 000000000000..2cafe65ebfee
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/ixdp425.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/ixdp425.h
3 *
4 * IXDP425 platform specific definitions
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista, Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#ifndef __ASM_ARCH_HARDWARE_H__
16#error "Do not include this directly, instead #include <mach/hardware.h>"
17#endif
18
19#define IXDP425_SDA_PIN 7
20#define IXDP425_SCL_PIN 6
21
22/*
23 * IXDP425 PCI IRQs
24 */
25#define IXDP425_PCI_MAX_DEV 4
26#define IXDP425_PCI_IRQ_LINES 4
27
28
29/* PCI controller GPIO to IRQ pin mappings */
30#define IXDP425_PCI_INTA_PIN 11
31#define IXDP425_PCI_INTB_PIN 10
32#define IXDP425_PCI_INTC_PIN 9
33#define IXDP425_PCI_INTD_PIN 8
34
35/* NAND Flash pins */
36#define IXDP425_NAND_NCE_PIN 12
37
38#define IXDP425_NAND_CMD_BYTE 0x01
39#define IXDP425_NAND_ADDR_BYTE 0x02
diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
new file mode 100644
index 000000000000..ad9c888dd850
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
@@ -0,0 +1,638 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
3 *
4 * Register definitions for IXP4xx chipset. This file contains
5 * register location and bit definitions only. Platform specific
6 * definitions and helper function declarations are in platform.h
7 * and machine-name.h.
8 *
9 * Copyright (C) 2002 Intel Corporation.
10 * Copyright (C) 2003-2004 MontaVista Software, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 */
17
18#ifndef _ASM_ARM_IXP4XX_H_
19#define _ASM_ARM_IXP4XX_H_
20
21/*
22 * IXP4xx Linux Memory Map:
23 *
24 * Phy Size Virt Description
25 * =========================================================================
26 *
27 * 0x00000000 0x10000000(max) PAGE_OFFSET System RAM
28 *
29 * 0x48000000 0x04000000 ioremap'd PCI Memory Space
30 *
31 * 0x50000000 0x10000000 ioremap'd EXP BUS
32 *
33 * 0x6000000 0x00004000 ioremap'd QMgr
34 *
35 * 0xC0000000 0x00001000 0xffbff000 PCI CFG
36 *
37 * 0xC4000000 0x00001000 0xffbfe000 EXP CFG
38 *
39 * 0xC8000000 0x00013000 0xffbeb000 On-Chip Peripherals
40 */
41
42/*
43 * Queue Manager
44 */
45#define IXP4XX_QMGR_BASE_PHYS (0x60000000)
46#define IXP4XX_QMGR_REGION_SIZE (0x00004000)
47
48/*
49 * Expansion BUS Configuration registers
50 */
51#define IXP4XX_EXP_CFG_BASE_PHYS (0xC4000000)
52#define IXP4XX_EXP_CFG_BASE_VIRT (0xFFBFE000)
53#define IXP4XX_EXP_CFG_REGION_SIZE (0x00001000)
54
55/*
56 * PCI Config registers
57 */
58#define IXP4XX_PCI_CFG_BASE_PHYS (0xC0000000)
59#define IXP4XX_PCI_CFG_BASE_VIRT (0xFFBFF000)
60#define IXP4XX_PCI_CFG_REGION_SIZE (0x00001000)
61
62/*
63 * Peripheral space
64 */
65#define IXP4XX_PERIPHERAL_BASE_PHYS (0xC8000000)
66#define IXP4XX_PERIPHERAL_BASE_VIRT (0xFFBEB000)
67#define IXP4XX_PERIPHERAL_REGION_SIZE (0x00013000)
68
69/*
70 * Debug UART
71 *
72 * This is basically a remap of UART1 into a region that is section
73 * aligned so that it * can be used with the low-level debug code.
74 */
75#define IXP4XX_DEBUG_UART_BASE_PHYS (0xC8000000)
76#define IXP4XX_DEBUG_UART_BASE_VIRT (0xffb00000)
77#define IXP4XX_DEBUG_UART_REGION_SIZE (0x00001000)
78
79#define IXP4XX_EXP_CS0_OFFSET 0x00
80#define IXP4XX_EXP_CS1_OFFSET 0x04
81#define IXP4XX_EXP_CS2_OFFSET 0x08
82#define IXP4XX_EXP_CS3_OFFSET 0x0C
83#define IXP4XX_EXP_CS4_OFFSET 0x10
84#define IXP4XX_EXP_CS5_OFFSET 0x14
85#define IXP4XX_EXP_CS6_OFFSET 0x18
86#define IXP4XX_EXP_CS7_OFFSET 0x1C
87#define IXP4XX_EXP_CFG0_OFFSET 0x20
88#define IXP4XX_EXP_CFG1_OFFSET 0x24
89#define IXP4XX_EXP_CFG2_OFFSET 0x28
90#define IXP4XX_EXP_CFG3_OFFSET 0x2C
91
92/*
93 * Expansion Bus Controller registers.
94 */
95#define IXP4XX_EXP_REG(x) ((volatile u32 *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))
96
97#define IXP4XX_EXP_CS0 IXP4XX_EXP_REG(IXP4XX_EXP_CS0_OFFSET)
98#define IXP4XX_EXP_CS1 IXP4XX_EXP_REG(IXP4XX_EXP_CS1_OFFSET)
99#define IXP4XX_EXP_CS2 IXP4XX_EXP_REG(IXP4XX_EXP_CS2_OFFSET)
100#define IXP4XX_EXP_CS3 IXP4XX_EXP_REG(IXP4XX_EXP_CS3_OFFSET)
101#define IXP4XX_EXP_CS4 IXP4XX_EXP_REG(IXP4XX_EXP_CS4_OFFSET)
102#define IXP4XX_EXP_CS5 IXP4XX_EXP_REG(IXP4XX_EXP_CS5_OFFSET)
103#define IXP4XX_EXP_CS6 IXP4XX_EXP_REG(IXP4XX_EXP_CS6_OFFSET)
104#define IXP4XX_EXP_CS7 IXP4XX_EXP_REG(IXP4XX_EXP_CS7_OFFSET)
105
106#define IXP4XX_EXP_CFG0 IXP4XX_EXP_REG(IXP4XX_EXP_CFG0_OFFSET)
107#define IXP4XX_EXP_CFG1 IXP4XX_EXP_REG(IXP4XX_EXP_CFG1_OFFSET)
108#define IXP4XX_EXP_CFG2 IXP4XX_EXP_REG(IXP4XX_EXP_CFG2_OFFSET)
109#define IXP4XX_EXP_CFG3 IXP4XX_EXP_REG(IXP4XX_EXP_CFG3_OFFSET)
110
111
112/*
113 * Peripheral Space Register Region Base Addresses
114 */
115#define IXP4XX_UART1_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x0000)
116#define IXP4XX_UART2_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x1000)
117#define IXP4XX_PMU_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x2000)
118#define IXP4XX_INTC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x3000)
119#define IXP4XX_GPIO_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x4000)
120#define IXP4XX_TIMER_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x5000)
121#define IXP4XX_NPEA_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x6000)
122#define IXP4XX_NPEB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x7000)
123#define IXP4XX_NPEC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x8000)
124#define IXP4XX_EthB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x9000)
125#define IXP4XX_EthC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xA000)
126#define IXP4XX_USB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xB000)
127/* ixp46X only */
128#define IXP4XX_EthA_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xC000)
129#define IXP4XX_EthB1_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xD000)
130#define IXP4XX_EthB2_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xE000)
131#define IXP4XX_EthB3_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xF000)
132#define IXP4XX_TIMESYNC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x10000)
133#define IXP4XX_I2C_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x11000)
134#define IXP4XX_SSP_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x12000)
135
136
137#define IXP4XX_UART1_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x0000)
138#define IXP4XX_UART2_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x1000)
139#define IXP4XX_PMU_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x2000)
140#define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000)
141#define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000)
142#define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
143#define IXP4XX_NPEA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x6000)
144#define IXP4XX_NPEB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x7000)
145#define IXP4XX_NPEC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x8000)
146#define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000)
147#define IXP4XX_EthC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000)
148#define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000)
149/* ixp46X only */
150#define IXP4XX_EthA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xC000)
151#define IXP4XX_EthB1_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xD000)
152#define IXP4XX_EthB2_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xE000)
153#define IXP4XX_EthB3_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xF000)
154#define IXP4XX_TIMESYNC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x10000)
155#define IXP4XX_I2C_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x11000)
156#define IXP4XX_SSP_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x12000)
157
158/*
159 * Constants to make it easy to access Interrupt Controller registers
160 */
161#define IXP4XX_ICPR_OFFSET 0x00 /* Interrupt Status */
162#define IXP4XX_ICMR_OFFSET 0x04 /* Interrupt Enable */
163#define IXP4XX_ICLR_OFFSET 0x08 /* Interrupt IRQ/FIQ Select */
164#define IXP4XX_ICIP_OFFSET 0x0C /* IRQ Status */
165#define IXP4XX_ICFP_OFFSET 0x10 /* FIQ Status */
166#define IXP4XX_ICHR_OFFSET 0x14 /* Interrupt Priority */
167#define IXP4XX_ICIH_OFFSET 0x18 /* IRQ Highest Pri Int */
168#define IXP4XX_ICFH_OFFSET 0x1C /* FIQ Highest Pri Int */
169
170/*
171 * IXP465-only
172 */
173#define IXP4XX_ICPR2_OFFSET 0x20 /* Interrupt Status 2 */
174#define IXP4XX_ICMR2_OFFSET 0x24 /* Interrupt Enable 2 */
175#define IXP4XX_ICLR2_OFFSET 0x28 /* Interrupt IRQ/FIQ Select 2 */
176#define IXP4XX_ICIP2_OFFSET 0x2C /* IRQ Status */
177#define IXP4XX_ICFP2_OFFSET 0x30 /* FIQ Status */
178#define IXP4XX_ICEEN_OFFSET 0x34 /* Error High Pri Enable */
179
180
181/*
182 * Interrupt Controller Register Definitions.
183 */
184
185#define IXP4XX_INTC_REG(x) ((volatile u32 *)(IXP4XX_INTC_BASE_VIRT+(x)))
186
187#define IXP4XX_ICPR IXP4XX_INTC_REG(IXP4XX_ICPR_OFFSET)
188#define IXP4XX_ICMR IXP4XX_INTC_REG(IXP4XX_ICMR_OFFSET)
189#define IXP4XX_ICLR IXP4XX_INTC_REG(IXP4XX_ICLR_OFFSET)
190#define IXP4XX_ICIP IXP4XX_INTC_REG(IXP4XX_ICIP_OFFSET)
191#define IXP4XX_ICFP IXP4XX_INTC_REG(IXP4XX_ICFP_OFFSET)
192#define IXP4XX_ICHR IXP4XX_INTC_REG(IXP4XX_ICHR_OFFSET)
193#define IXP4XX_ICIH IXP4XX_INTC_REG(IXP4XX_ICIH_OFFSET)
194#define IXP4XX_ICFH IXP4XX_INTC_REG(IXP4XX_ICFH_OFFSET)
195#define IXP4XX_ICPR2 IXP4XX_INTC_REG(IXP4XX_ICPR2_OFFSET)
196#define IXP4XX_ICMR2 IXP4XX_INTC_REG(IXP4XX_ICMR2_OFFSET)
197#define IXP4XX_ICLR2 IXP4XX_INTC_REG(IXP4XX_ICLR2_OFFSET)
198#define IXP4XX_ICIP2 IXP4XX_INTC_REG(IXP4XX_ICIP2_OFFSET)
199#define IXP4XX_ICFP2 IXP4XX_INTC_REG(IXP4XX_ICFP2_OFFSET)
200#define IXP4XX_ICEEN IXP4XX_INTC_REG(IXP4XX_ICEEN_OFFSET)
201
202/*
203 * Constants to make it easy to access GPIO registers
204 */
205#define IXP4XX_GPIO_GPOUTR_OFFSET 0x00
206#define IXP4XX_GPIO_GPOER_OFFSET 0x04
207#define IXP4XX_GPIO_GPINR_OFFSET 0x08
208#define IXP4XX_GPIO_GPISR_OFFSET 0x0C
209#define IXP4XX_GPIO_GPIT1R_OFFSET 0x10
210#define IXP4XX_GPIO_GPIT2R_OFFSET 0x14
211#define IXP4XX_GPIO_GPCLKR_OFFSET 0x18
212#define IXP4XX_GPIO_GPDBSELR_OFFSET 0x1C
213
214/*
215 * GPIO Register Definitions.
216 * [Only perform 32bit reads/writes]
217 */
218#define IXP4XX_GPIO_REG(x) ((volatile u32 *)(IXP4XX_GPIO_BASE_VIRT+(x)))
219
220#define IXP4XX_GPIO_GPOUTR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOUTR_OFFSET)
221#define IXP4XX_GPIO_GPOER IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOER_OFFSET)
222#define IXP4XX_GPIO_GPINR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPINR_OFFSET)
223#define IXP4XX_GPIO_GPISR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPISR_OFFSET)
224#define IXP4XX_GPIO_GPIT1R IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT1R_OFFSET)
225#define IXP4XX_GPIO_GPIT2R IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT2R_OFFSET)
226#define IXP4XX_GPIO_GPCLKR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPCLKR_OFFSET)
227#define IXP4XX_GPIO_GPDBSELR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPDBSELR_OFFSET)
228
229/*
230 * GPIO register bit definitions
231 */
232
233/* Interrupt styles
234 */
235#define IXP4XX_GPIO_STYLE_ACTIVE_HIGH 0x0
236#define IXP4XX_GPIO_STYLE_ACTIVE_LOW 0x1
237#define IXP4XX_GPIO_STYLE_RISING_EDGE 0x2
238#define IXP4XX_GPIO_STYLE_FALLING_EDGE 0x3
239#define IXP4XX_GPIO_STYLE_TRANSITIONAL 0x4
240
241/*
242 * Mask used to clear interrupt styles
243 */
244#define IXP4XX_GPIO_STYLE_CLEAR 0x7
245#define IXP4XX_GPIO_STYLE_SIZE 3
246
247/*
248 * Constants to make it easy to access Timer Control/Status registers
249 */
250#define IXP4XX_OSTS_OFFSET 0x00 /* Continious TimeStamp */
251#define IXP4XX_OST1_OFFSET 0x04 /* Timer 1 Timestamp */
252#define IXP4XX_OSRT1_OFFSET 0x08 /* Timer 1 Reload */
253#define IXP4XX_OST2_OFFSET 0x0C /* Timer 2 Timestamp */
254#define IXP4XX_OSRT2_OFFSET 0x10 /* Timer 2 Reload */
255#define IXP4XX_OSWT_OFFSET 0x14 /* Watchdog Timer */
256#define IXP4XX_OSWE_OFFSET 0x18 /* Watchdog Enable */
257#define IXP4XX_OSWK_OFFSET 0x1C /* Watchdog Key */
258#define IXP4XX_OSST_OFFSET 0x20 /* Timer Status */
259
260/*
261 * Operating System Timer Register Definitions.
262 */
263
264#define IXP4XX_TIMER_REG(x) ((volatile u32 *)(IXP4XX_TIMER_BASE_VIRT+(x)))
265
266#define IXP4XX_OSTS IXP4XX_TIMER_REG(IXP4XX_OSTS_OFFSET)
267#define IXP4XX_OST1 IXP4XX_TIMER_REG(IXP4XX_OST1_OFFSET)
268#define IXP4XX_OSRT1 IXP4XX_TIMER_REG(IXP4XX_OSRT1_OFFSET)
269#define IXP4XX_OST2 IXP4XX_TIMER_REG(IXP4XX_OST2_OFFSET)
270#define IXP4XX_OSRT2 IXP4XX_TIMER_REG(IXP4XX_OSRT2_OFFSET)
271#define IXP4XX_OSWT IXP4XX_TIMER_REG(IXP4XX_OSWT_OFFSET)
272#define IXP4XX_OSWE IXP4XX_TIMER_REG(IXP4XX_OSWE_OFFSET)
273#define IXP4XX_OSWK IXP4XX_TIMER_REG(IXP4XX_OSWK_OFFSET)
274#define IXP4XX_OSST IXP4XX_TIMER_REG(IXP4XX_OSST_OFFSET)
275
276/*
277 * Timer register values and bit definitions
278 */
279#define IXP4XX_OST_ENABLE 0x00000001
280#define IXP4XX_OST_ONE_SHOT 0x00000002
281/* Low order bits of reload value ignored */
282#define IXP4XX_OST_RELOAD_MASK 0x00000003
283#define IXP4XX_OST_DISABLED 0x00000000
284#define IXP4XX_OSST_TIMER_1_PEND 0x00000001
285#define IXP4XX_OSST_TIMER_2_PEND 0x00000002
286#define IXP4XX_OSST_TIMER_TS_PEND 0x00000004
287#define IXP4XX_OSST_TIMER_WDOG_PEND 0x00000008
288#define IXP4XX_OSST_TIMER_WARM_RESET 0x00000010
289
290#define IXP4XX_WDT_KEY 0x0000482E
291
292#define IXP4XX_WDT_RESET_ENABLE 0x00000001
293#define IXP4XX_WDT_IRQ_ENABLE 0x00000002
294#define IXP4XX_WDT_COUNT_ENABLE 0x00000004
295
296
297/*
298 * Constants to make it easy to access PCI Control/Status registers
299 */
300#define PCI_NP_AD_OFFSET 0x00
301#define PCI_NP_CBE_OFFSET 0x04
302#define PCI_NP_WDATA_OFFSET 0x08
303#define PCI_NP_RDATA_OFFSET 0x0c
304#define PCI_CRP_AD_CBE_OFFSET 0x10
305#define PCI_CRP_WDATA_OFFSET 0x14
306#define PCI_CRP_RDATA_OFFSET 0x18
307#define PCI_CSR_OFFSET 0x1c
308#define PCI_ISR_OFFSET 0x20
309#define PCI_INTEN_OFFSET 0x24
310#define PCI_DMACTRL_OFFSET 0x28
311#define PCI_AHBMEMBASE_OFFSET 0x2c
312#define PCI_AHBIOBASE_OFFSET 0x30
313#define PCI_PCIMEMBASE_OFFSET 0x34
314#define PCI_AHBDOORBELL_OFFSET 0x38
315#define PCI_PCIDOORBELL_OFFSET 0x3C
316#define PCI_ATPDMA0_AHBADDR_OFFSET 0x40
317#define PCI_ATPDMA0_PCIADDR_OFFSET 0x44
318#define PCI_ATPDMA0_LENADDR_OFFSET 0x48
319#define PCI_ATPDMA1_AHBADDR_OFFSET 0x4C
320#define PCI_ATPDMA1_PCIADDR_OFFSET 0x50
321#define PCI_ATPDMA1_LENADDR_OFFSET 0x54
322
323/*
324 * PCI Control/Status Registers
325 */
326#define IXP4XX_PCI_CSR(x) ((volatile u32 *)(IXP4XX_PCI_CFG_BASE_VIRT+(x)))
327
328#define PCI_NP_AD IXP4XX_PCI_CSR(PCI_NP_AD_OFFSET)
329#define PCI_NP_CBE IXP4XX_PCI_CSR(PCI_NP_CBE_OFFSET)
330#define PCI_NP_WDATA IXP4XX_PCI_CSR(PCI_NP_WDATA_OFFSET)
331#define PCI_NP_RDATA IXP4XX_PCI_CSR(PCI_NP_RDATA_OFFSET)
332#define PCI_CRP_AD_CBE IXP4XX_PCI_CSR(PCI_CRP_AD_CBE_OFFSET)
333#define PCI_CRP_WDATA IXP4XX_PCI_CSR(PCI_CRP_WDATA_OFFSET)
334#define PCI_CRP_RDATA IXP4XX_PCI_CSR(PCI_CRP_RDATA_OFFSET)
335#define PCI_CSR IXP4XX_PCI_CSR(PCI_CSR_OFFSET)
336#define PCI_ISR IXP4XX_PCI_CSR(PCI_ISR_OFFSET)
337#define PCI_INTEN IXP4XX_PCI_CSR(PCI_INTEN_OFFSET)
338#define PCI_DMACTRL IXP4XX_PCI_CSR(PCI_DMACTRL_OFFSET)
339#define PCI_AHBMEMBASE IXP4XX_PCI_CSR(PCI_AHBMEMBASE_OFFSET)
340#define PCI_AHBIOBASE IXP4XX_PCI_CSR(PCI_AHBIOBASE_OFFSET)
341#define PCI_PCIMEMBASE IXP4XX_PCI_CSR(PCI_PCIMEMBASE_OFFSET)
342#define PCI_AHBDOORBELL IXP4XX_PCI_CSR(PCI_AHBDOORBELL_OFFSET)
343#define PCI_PCIDOORBELL IXP4XX_PCI_CSR(PCI_PCIDOORBELL_OFFSET)
344#define PCI_ATPDMA0_AHBADDR IXP4XX_PCI_CSR(PCI_ATPDMA0_AHBADDR_OFFSET)
345#define PCI_ATPDMA0_PCIADDR IXP4XX_PCI_CSR(PCI_ATPDMA0_PCIADDR_OFFSET)
346#define PCI_ATPDMA0_LENADDR IXP4XX_PCI_CSR(PCI_ATPDMA0_LENADDR_OFFSET)
347#define PCI_ATPDMA1_AHBADDR IXP4XX_PCI_CSR(PCI_ATPDMA1_AHBADDR_OFFSET)
348#define PCI_ATPDMA1_PCIADDR IXP4XX_PCI_CSR(PCI_ATPDMA1_PCIADDR_OFFSET)
349#define PCI_ATPDMA1_LENADDR IXP4XX_PCI_CSR(PCI_ATPDMA1_LENADDR_OFFSET)
350
351/*
352 * PCI register values and bit definitions
353 */
354
355/* CSR bit definitions */
356#define PCI_CSR_HOST 0x00000001
357#define PCI_CSR_ARBEN 0x00000002
358#define PCI_CSR_ADS 0x00000004
359#define PCI_CSR_PDS 0x00000008
360#define PCI_CSR_ABE 0x00000010
361#define PCI_CSR_DBT 0x00000020
362#define PCI_CSR_ASE 0x00000100
363#define PCI_CSR_IC 0x00008000
364
365/* ISR (Interrupt status) Register bit definitions */
366#define PCI_ISR_PSE 0x00000001
367#define PCI_ISR_PFE 0x00000002
368#define PCI_ISR_PPE 0x00000004
369#define PCI_ISR_AHBE 0x00000008
370#define PCI_ISR_APDC 0x00000010
371#define PCI_ISR_PADC 0x00000020
372#define PCI_ISR_ADB 0x00000040
373#define PCI_ISR_PDB 0x00000080
374
375/* INTEN (Interrupt Enable) Register bit definitions */
376#define PCI_INTEN_PSE 0x00000001
377#define PCI_INTEN_PFE 0x00000002
378#define PCI_INTEN_PPE 0x00000004
379#define PCI_INTEN_AHBE 0x00000008
380#define PCI_INTEN_APDC 0x00000010
381#define PCI_INTEN_PADC 0x00000020
382#define PCI_INTEN_ADB 0x00000040
383#define PCI_INTEN_PDB 0x00000080
384
385/*
386 * Shift value for byte enable on NP cmd/byte enable register
387 */
388#define IXP4XX_PCI_NP_CBE_BESL 4
389
390/*
391 * PCI commands supported by NP access unit
392 */
393#define NP_CMD_IOREAD 0x2
394#define NP_CMD_IOWRITE 0x3
395#define NP_CMD_CONFIGREAD 0xa
396#define NP_CMD_CONFIGWRITE 0xb
397#define NP_CMD_MEMREAD 0x6
398#define NP_CMD_MEMWRITE 0x7
399
400/*
401 * Constants for CRP access into local config space
402 */
403#define CRP_AD_CBE_BESL 20
404#define CRP_AD_CBE_WRITE 0x00010000
405
406
407/*
408 * USB Device Controller
409 *
410 * These are used by the USB gadget driver, so they don't follow the
411 * IXP4XX_ naming convetions.
412 *
413 */
414# define IXP4XX_USB_REG(x) (*((volatile u32 *)(x)))
415
416/* UDC Undocumented - Reserved1 */
417#define UDC_RES1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0004)
418/* UDC Undocumented - Reserved2 */
419#define UDC_RES2 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0008)
420/* UDC Undocumented - Reserved3 */
421#define UDC_RES3 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x000C)
422/* UDC Control Register */
423#define UDCCR IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0000)
424/* UDC Endpoint 0 Control/Status Register */
425#define UDCCS0 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0010)
426/* UDC Endpoint 1 (IN) Control/Status Register */
427#define UDCCS1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0014)
428/* UDC Endpoint 2 (OUT) Control/Status Register */
429#define UDCCS2 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0018)
430/* UDC Endpoint 3 (IN) Control/Status Register */
431#define UDCCS3 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x001C)
432/* UDC Endpoint 4 (OUT) Control/Status Register */
433#define UDCCS4 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0020)
434/* UDC Endpoint 5 (Interrupt) Control/Status Register */
435#define UDCCS5 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0024)
436/* UDC Endpoint 6 (IN) Control/Status Register */
437#define UDCCS6 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0028)
438/* UDC Endpoint 7 (OUT) Control/Status Register */
439#define UDCCS7 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x002C)
440/* UDC Endpoint 8 (IN) Control/Status Register */
441#define UDCCS8 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0030)
442/* UDC Endpoint 9 (OUT) Control/Status Register */
443#define UDCCS9 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0034)
444/* UDC Endpoint 10 (Interrupt) Control/Status Register */
445#define UDCCS10 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0038)
446/* UDC Endpoint 11 (IN) Control/Status Register */
447#define UDCCS11 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x003C)
448/* UDC Endpoint 12 (OUT) Control/Status Register */
449#define UDCCS12 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0040)
450/* UDC Endpoint 13 (IN) Control/Status Register */
451#define UDCCS13 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0044)
452/* UDC Endpoint 14 (OUT) Control/Status Register */
453#define UDCCS14 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0048)
454/* UDC Endpoint 15 (Interrupt) Control/Status Register */
455#define UDCCS15 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x004C)
456/* UDC Frame Number Register High */
457#define UFNRH IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0060)
458/* UDC Frame Number Register Low */
459#define UFNRL IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0064)
460/* UDC Byte Count Reg 2 */
461#define UBCR2 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0068)
462/* UDC Byte Count Reg 4 */
463#define UBCR4 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x006c)
464/* UDC Byte Count Reg 7 */
465#define UBCR7 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0070)
466/* UDC Byte Count Reg 9 */
467#define UBCR9 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0074)
468/* UDC Byte Count Reg 12 */
469#define UBCR12 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0078)
470/* UDC Byte Count Reg 14 */
471#define UBCR14 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x007c)
472/* UDC Endpoint 0 Data Register */
473#define UDDR0 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0080)
474/* UDC Endpoint 1 Data Register */
475#define UDDR1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0100)
476/* UDC Endpoint 2 Data Register */
477#define UDDR2 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0180)
478/* UDC Endpoint 3 Data Register */
479#define UDDR3 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0200)
480/* UDC Endpoint 4 Data Register */
481#define UDDR4 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0400)
482/* UDC Endpoint 5 Data Register */
483#define UDDR5 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00A0)
484/* UDC Endpoint 6 Data Register */
485#define UDDR6 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0600)
486/* UDC Endpoint 7 Data Register */
487#define UDDR7 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0680)
488/* UDC Endpoint 8 Data Register */
489#define UDDR8 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0700)
490/* UDC Endpoint 9 Data Register */
491#define UDDR9 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0900)
492/* UDC Endpoint 10 Data Register */
493#define UDDR10 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00C0)
494/* UDC Endpoint 11 Data Register */
495#define UDDR11 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0B00)
496/* UDC Endpoint 12 Data Register */
497#define UDDR12 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0B80)
498/* UDC Endpoint 13 Data Register */
499#define UDDR13 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0C00)
500/* UDC Endpoint 14 Data Register */
501#define UDDR14 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0E00)
502/* UDC Endpoint 15 Data Register */
503#define UDDR15 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00E0)
504/* UDC Interrupt Control Register 0 */
505#define UICR0 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0050)
506/* UDC Interrupt Control Register 1 */
507#define UICR1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0054)
508/* UDC Status Interrupt Register 0 */
509#define USIR0 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0058)
510/* UDC Status Interrupt Register 1 */
511#define USIR1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x005C)
512
513#define UDCCR_UDE (1 << 0) /* UDC enable */
514#define UDCCR_UDA (1 << 1) /* UDC active */
515#define UDCCR_RSM (1 << 2) /* Device resume */
516#define UDCCR_RESIR (1 << 3) /* Resume interrupt request */
517#define UDCCR_SUSIR (1 << 4) /* Suspend interrupt request */
518#define UDCCR_SRM (1 << 5) /* Suspend/resume interrupt mask */
519#define UDCCR_RSTIR (1 << 6) /* Reset interrupt request */
520#define UDCCR_REM (1 << 7) /* Reset interrupt mask */
521
522#define UDCCS0_OPR (1 << 0) /* OUT packet ready */
523#define UDCCS0_IPR (1 << 1) /* IN packet ready */
524#define UDCCS0_FTF (1 << 2) /* Flush Tx FIFO */
525#define UDCCS0_DRWF (1 << 3) /* Device remote wakeup feature */
526#define UDCCS0_SST (1 << 4) /* Sent stall */
527#define UDCCS0_FST (1 << 5) /* Force stall */
528#define UDCCS0_RNE (1 << 6) /* Receive FIFO no empty */
529#define UDCCS0_SA (1 << 7) /* Setup active */
530
531#define UDCCS_BI_TFS (1 << 0) /* Transmit FIFO service */
532#define UDCCS_BI_TPC (1 << 1) /* Transmit packet complete */
533#define UDCCS_BI_FTF (1 << 2) /* Flush Tx FIFO */
534#define UDCCS_BI_TUR (1 << 3) /* Transmit FIFO underrun */
535#define UDCCS_BI_SST (1 << 4) /* Sent stall */
536#define UDCCS_BI_FST (1 << 5) /* Force stall */
537#define UDCCS_BI_TSP (1 << 7) /* Transmit short packet */
538
539#define UDCCS_BO_RFS (1 << 0) /* Receive FIFO service */
540#define UDCCS_BO_RPC (1 << 1) /* Receive packet complete */
541#define UDCCS_BO_DME (1 << 3) /* DMA enable */
542#define UDCCS_BO_SST (1 << 4) /* Sent stall */
543#define UDCCS_BO_FST (1 << 5) /* Force stall */
544#define UDCCS_BO_RNE (1 << 6) /* Receive FIFO not empty */
545#define UDCCS_BO_RSP (1 << 7) /* Receive short packet */
546
547#define UDCCS_II_TFS (1 << 0) /* Transmit FIFO service */
548#define UDCCS_II_TPC (1 << 1) /* Transmit packet complete */
549#define UDCCS_II_FTF (1 << 2) /* Flush Tx FIFO */
550#define UDCCS_II_TUR (1 << 3) /* Transmit FIFO underrun */
551#define UDCCS_II_TSP (1 << 7) /* Transmit short packet */
552
553#define UDCCS_IO_RFS (1 << 0) /* Receive FIFO service */
554#define UDCCS_IO_RPC (1 << 1) /* Receive packet complete */
555#define UDCCS_IO_ROF (1 << 3) /* Receive overflow */
556#define UDCCS_IO_DME (1 << 3) /* DMA enable */
557#define UDCCS_IO_RNE (1 << 6) /* Receive FIFO not empty */
558#define UDCCS_IO_RSP (1 << 7) /* Receive short packet */
559
560#define UDCCS_INT_TFS (1 << 0) /* Transmit FIFO service */
561#define UDCCS_INT_TPC (1 << 1) /* Transmit packet complete */
562#define UDCCS_INT_FTF (1 << 2) /* Flush Tx FIFO */
563#define UDCCS_INT_TUR (1 << 3) /* Transmit FIFO underrun */
564#define UDCCS_INT_SST (1 << 4) /* Sent stall */
565#define UDCCS_INT_FST (1 << 5) /* Force stall */
566#define UDCCS_INT_TSP (1 << 7) /* Transmit short packet */
567
568#define UICR0_IM0 (1 << 0) /* Interrupt mask ep 0 */
569#define UICR0_IM1 (1 << 1) /* Interrupt mask ep 1 */
570#define UICR0_IM2 (1 << 2) /* Interrupt mask ep 2 */
571#define UICR0_IM3 (1 << 3) /* Interrupt mask ep 3 */
572#define UICR0_IM4 (1 << 4) /* Interrupt mask ep 4 */
573#define UICR0_IM5 (1 << 5) /* Interrupt mask ep 5 */
574#define UICR0_IM6 (1 << 6) /* Interrupt mask ep 6 */
575#define UICR0_IM7 (1 << 7) /* Interrupt mask ep 7 */
576
577#define UICR1_IM8 (1 << 0) /* Interrupt mask ep 8 */
578#define UICR1_IM9 (1 << 1) /* Interrupt mask ep 9 */
579#define UICR1_IM10 (1 << 2) /* Interrupt mask ep 10 */
580#define UICR1_IM11 (1 << 3) /* Interrupt mask ep 11 */
581#define UICR1_IM12 (1 << 4) /* Interrupt mask ep 12 */
582#define UICR1_IM13 (1 << 5) /* Interrupt mask ep 13 */
583#define UICR1_IM14 (1 << 6) /* Interrupt mask ep 14 */
584#define UICR1_IM15 (1 << 7) /* Interrupt mask ep 15 */
585
586#define USIR0_IR0 (1 << 0) /* Interrupt request ep 0 */
587#define USIR0_IR1 (1 << 1) /* Interrupt request ep 1 */
588#define USIR0_IR2 (1 << 2) /* Interrupt request ep 2 */
589#define USIR0_IR3 (1 << 3) /* Interrupt request ep 3 */
590#define USIR0_IR4 (1 << 4) /* Interrupt request ep 4 */
591#define USIR0_IR5 (1 << 5) /* Interrupt request ep 5 */
592#define USIR0_IR6 (1 << 6) /* Interrupt request ep 6 */
593#define USIR0_IR7 (1 << 7) /* Interrupt request ep 7 */
594
595#define USIR1_IR8 (1 << 0) /* Interrupt request ep 8 */
596#define USIR1_IR9 (1 << 1) /* Interrupt request ep 9 */
597#define USIR1_IR10 (1 << 2) /* Interrupt request ep 10 */
598#define USIR1_IR11 (1 << 3) /* Interrupt request ep 11 */
599#define USIR1_IR12 (1 << 4) /* Interrupt request ep 12 */
600#define USIR1_IR13 (1 << 5) /* Interrupt request ep 13 */
601#define USIR1_IR14 (1 << 6) /* Interrupt request ep 14 */
602#define USIR1_IR15 (1 << 7) /* Interrupt request ep 15 */
603
604#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
605
606/* "fuse" bits of IXP_EXP_CFG2 */
607#define IXP4XX_FEATURE_RCOMP (1 << 0)
608#define IXP4XX_FEATURE_USB_DEVICE (1 << 1)
609#define IXP4XX_FEATURE_HASH (1 << 2)
610#define IXP4XX_FEATURE_AES (1 << 3)
611#define IXP4XX_FEATURE_DES (1 << 4)
612#define IXP4XX_FEATURE_HDLC (1 << 5)
613#define IXP4XX_FEATURE_AAL (1 << 6)
614#define IXP4XX_FEATURE_HSS (1 << 7)
615#define IXP4XX_FEATURE_UTOPIA (1 << 8)
616#define IXP4XX_FEATURE_NPEB_ETH0 (1 << 9)
617#define IXP4XX_FEATURE_NPEC_ETH (1 << 10)
618#define IXP4XX_FEATURE_RESET_NPEA (1 << 11)
619#define IXP4XX_FEATURE_RESET_NPEB (1 << 12)
620#define IXP4XX_FEATURE_RESET_NPEC (1 << 13)
621#define IXP4XX_FEATURE_PCI (1 << 14)
622#define IXP4XX_FEATURE_ECC_TIMESYNC (1 << 15)
623#define IXP4XX_FEATURE_UTOPIA_PHY_LIMIT (3 << 16)
624#define IXP4XX_FEATURE_USB_HOST (1 << 18)
625#define IXP4XX_FEATURE_NPEA_ETH (1 << 19)
626#define IXP4XX_FEATURE_NPEB_ETH_1_TO_3 (1 << 20)
627#define IXP4XX_FEATURE_RSA (1 << 21)
628#define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22)
629#define IXP4XX_FEATURE_RESERVED (0xFF << 24)
630
631#define IXP4XX_FEATURE_IXP46X_ONLY (IXP4XX_FEATURE_ECC_TIMESYNC | \
632 IXP4XX_FEATURE_USB_HOST | \
633 IXP4XX_FEATURE_NPEA_ETH | \
634 IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \
635 IXP4XX_FEATURE_RSA | \
636 IXP4XX_FEATURE_XSCALE_MAX_FREQ)
637
638#endif
diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h
new file mode 100644
index 000000000000..c4d2830ac987
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/memory.h
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/memory.h
3 *
4 * Copyright (c) 2001-2004 MontaVista Software, Inc.
5 */
6
7#ifndef __ASM_ARCH_MEMORY_H
8#define __ASM_ARCH_MEMORY_H
9
10#include <asm/sizes.h>
11
12/*
13 * Physical DRAM offset.
14 */
15#define PHYS_OFFSET UL(0x00000000)
16
17#if !defined(__ASSEMBLY__) && defined(CONFIG_PCI)
18
19void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes);
20
21#define arch_adjust_zones(node, size, holes) \
22 ixp4xx_adjust_zones(node, size, holes)
23
24#define ISA_DMA_THRESHOLD (SZ_64M - 1)
25
26#endif
27
28/*
29 * Virtual view <-> DMA view memory address translations
30 * virt_to_bus: Used to translate the virtual address to an
31 * address suitable to be passed to set_dma_addr
32 * bus_to_virt: Used to convert an address for DMA operations
33 * to an address that the kernel can use.
34 *
35 * These are dummies for now.
36 */
37#define __virt_to_bus(x) __virt_to_phys(x)
38#define __bus_to_virt(x) __phys_to_virt(x)
39
40#endif
diff --git a/arch/arm/mach-ixp4xx/include/mach/nas100d.h b/arch/arm/mach-ixp4xx/include/mach/nas100d.h
new file mode 100644
index 000000000000..3771d62a9748
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/nas100d.h
@@ -0,0 +1,52 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/nas100d.h
3 *
4 * NAS100D platform specific definitions
5 *
6 * Copyright (c) 2005 Tower Technologies
7 *
8 * Author: Alessandro Zummo <a.zummo@towertech.it>
9 *
10 * based on ixdp425.h:
11 * Copyright 2004 (c) MontaVista, Software, Inc.
12 *
13 * This file is licensed under the terms of the GNU General Public
14 * License version 2. This program is licensed "as is" without any
15 * warranty of any kind, whether express or implied.
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <mach/hardware.h>"
20#endif
21
22#define NAS100D_SDA_PIN 5
23#define NAS100D_SCL_PIN 6
24
25/*
26 * NAS100D PCI IRQs
27 */
28#define NAS100D_PCI_MAX_DEV 3
29#define NAS100D_PCI_IRQ_LINES 3
30
31
32/* PCI controller GPIO to IRQ pin mappings */
33#define NAS100D_PCI_INTA_PIN 11
34#define NAS100D_PCI_INTB_PIN 10
35#define NAS100D_PCI_INTC_PIN 9
36#define NAS100D_PCI_INTD_PIN 8
37#define NAS100D_PCI_INTE_PIN 7
38
39/* Buttons */
40
41#define NAS100D_PB_GPIO 14 /* power button */
42#define NAS100D_RB_GPIO 4 /* reset button */
43
44/* Power control */
45
46#define NAS100D_PO_GPIO 12 /* power off */
47
48/* LEDs */
49
50#define NAS100D_LED_WLAN_GPIO 0
51#define NAS100D_LED_DISK_GPIO 3
52#define NAS100D_LED_PWR_GPIO 15
diff --git a/arch/arm/mach-ixp4xx/include/mach/npe.h b/arch/arm/mach-ixp4xx/include/mach/npe.h
new file mode 100644
index 000000000000..37d0511689dc
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/npe.h
@@ -0,0 +1,39 @@
1#ifndef __IXP4XX_NPE_H
2#define __IXP4XX_NPE_H
3
4#include <linux/kernel.h>
5
6extern const char *npe_names[];
7
8struct npe_regs {
9 u32 exec_addr, exec_data, exec_status_cmd, exec_count;
10 u32 action_points[4];
11 u32 watchpoint_fifo, watch_count;
12 u32 profile_count;
13 u32 messaging_status, messaging_control;
14 u32 mailbox_status, /*messaging_*/ in_out_fifo;
15};
16
17struct npe {
18 struct resource *mem_res;
19 struct npe_regs __iomem *regs;
20 u32 regs_phys;
21 int id;
22 int valid;
23};
24
25
26static inline const char *npe_name(struct npe *npe)
27{
28 return npe_names[npe->id];
29}
30
31int npe_running(struct npe *npe);
32int npe_send_message(struct npe *npe, const void *msg, const char *what);
33int npe_recv_message(struct npe *npe, void *msg, const char *what);
34int npe_send_recv_message(struct npe *npe, void *msg, const char *what);
35int npe_load_firmware(struct npe *npe, const char *name, struct device *dev);
36struct npe *npe_request(int id);
37void npe_release(struct npe *npe);
38
39#endif /* __IXP4XX_NPE_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/nslu2.h b/arch/arm/mach-ixp4xx/include/mach/nslu2.h
new file mode 100644
index 000000000000..85d00adbfb92
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/nslu2.h
@@ -0,0 +1,55 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/nslu2.h
3 *
4 * NSLU2 platform specific definitions
5 *
6 * Author: Mark Rakes <mrakes AT mac.com>
7 * Maintainers: http://www.nslu2-linux.org
8 *
9 * based on ixdp425.h:
10 * Copyright 2004 (c) MontaVista, Software, Inc.
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#ifndef __ASM_ARCH_HARDWARE_H__
18#error "Do not include this directly, instead #include <mach/hardware.h>"
19#endif
20
21#define NSLU2_SDA_PIN 7
22#define NSLU2_SCL_PIN 6
23
24/*
25 * NSLU2 PCI IRQs
26 */
27#define NSLU2_PCI_MAX_DEV 3
28#define NSLU2_PCI_IRQ_LINES 3
29
30
31/* PCI controller GPIO to IRQ pin mappings */
32#define NSLU2_PCI_INTA_PIN 11
33#define NSLU2_PCI_INTB_PIN 10
34#define NSLU2_PCI_INTC_PIN 9
35#define NSLU2_PCI_INTD_PIN 8
36
37/* NSLU2 Timer */
38#define NSLU2_FREQ 66000000
39
40/* Buttons */
41
42#define NSLU2_PB_GPIO 5 /* power button */
43#define NSLU2_PO_GPIO 8 /* power off */
44#define NSLU2_RB_GPIO 12 /* reset button */
45
46/* Buzzer */
47
48#define NSLU2_GPIO_BUZZ 4
49
50/* LEDs */
51
52#define NSLU2_LED_RED_GPIO 0
53#define NSLU2_LED_GRN_GPIO 1
54#define NSLU2_LED_DISK1_GPIO 3
55#define NSLU2_LED_DISK2_GPIO 2
diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h
new file mode 100644
index 000000000000..e824c02c825a
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
@@ -0,0 +1,173 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/platform.h
3 *
4 * Constants and functions that are useful to IXP4xx platform-specific code
5 * and device drivers.
6 *
7 * Copyright (C) 2004 MontaVista Software, Inc.
8 */
9
10#ifndef __ASM_ARCH_HARDWARE_H__
11#error "Do not include this directly, instead #include <mach/hardware.h>"
12#endif
13
14#ifndef __ASSEMBLY__
15
16#include <asm/types.h>
17
18#ifndef __ARMEB__
19#define REG_OFFSET 0
20#else
21#define REG_OFFSET 3
22#endif
23
24/*
25 * Expansion bus memory regions
26 */
27#define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000)
28
29/*
30 * The expansion bus on the IXP4xx can be configured for either 16 or
31 * 32MB windows and the CS offset for each region changes based on the
32 * current configuration. This means that we cannot simply hardcode
33 * each offset. ixp4xx_sys_init() looks at the expansion bus configuration
34 * as setup by the bootloader to determine our window size.
35 */
36extern unsigned long ixp4xx_exp_bus_size;
37
38#define IXP4XX_EXP_BUS_BASE(region)\
39 (IXP4XX_EXP_BUS_BASE_PHYS + ((region) * ixp4xx_exp_bus_size))
40
41#define IXP4XX_EXP_BUS_END(region)\
42 (IXP4XX_EXP_BUS_BASE(region) + ixp4xx_exp_bus_size - 1)
43
44/* Those macros can be used to adjust timing and configure
45 * other features for each region.
46 */
47
48#define IXP4XX_EXP_BUS_RECOVERY_T(x) (((x) & 0x0f) << 16)
49#define IXP4XX_EXP_BUS_HOLD_T(x) (((x) & 0x03) << 20)
50#define IXP4XX_EXP_BUS_STROBE_T(x) (((x) & 0x0f) << 22)
51#define IXP4XX_EXP_BUS_SETUP_T(x) (((x) & 0x03) << 26)
52#define IXP4XX_EXP_BUS_ADDR_T(x) (((x) & 0x03) << 28)
53#define IXP4XX_EXP_BUS_SIZE(x) (((x) & 0x0f) << 10)
54#define IXP4XX_EXP_BUS_CYCLES(x) (((x) & 0x03) << 14)
55
56#define IXP4XX_EXP_BUS_CS_EN (1L << 31)
57#define IXP4XX_EXP_BUS_BYTE_RD16 (1L << 6)
58#define IXP4XX_EXP_BUS_HRDY_POL (1L << 5)
59#define IXP4XX_EXP_BUS_MUX_EN (1L << 4)
60#define IXP4XX_EXP_BUS_SPLT_EN (1L << 3)
61#define IXP4XX_EXP_BUS_WR_EN (1L << 1)
62#define IXP4XX_EXP_BUS_BYTE_EN (1L << 0)
63
64#define IXP4XX_EXP_BUS_CYCLES_INTEL 0x00
65#define IXP4XX_EXP_BUS_CYCLES_MOTOROLA 0x01
66#define IXP4XX_EXP_BUS_CYCLES_HPI 0x02
67
68#define IXP4XX_FLASH_WRITABLE (0x2)
69#define IXP4XX_FLASH_DEFAULT (0xbcd23c40)
70#define IXP4XX_FLASH_WRITE (0xbcd23c42)
71
72/*
73 * Clock Speed Definitions.
74 */
75#define IXP4XX_PERIPHERAL_BUS_CLOCK (66) /* 66Mhzi APB BUS */
76#define IXP4XX_UART_XTAL 14745600
77
78/*
79 * This structure provide a means for the board setup code
80 * to give information to th pata_ixp4xx driver. It is
81 * passed as platform_data.
82 */
83struct ixp4xx_pata_data {
84 volatile u32 *cs0_cfg;
85 volatile u32 *cs1_cfg;
86 unsigned long cs0_bits;
87 unsigned long cs1_bits;
88 void __iomem *cs0;
89 void __iomem *cs1;
90};
91
92struct sys_timer;
93
94#define IXP4XX_ETH_NPEA 0x00
95#define IXP4XX_ETH_NPEB 0x10
96#define IXP4XX_ETH_NPEC 0x20
97
98/* Information about built-in Ethernet MAC interfaces */
99struct eth_plat_info {
100 u8 phy; /* MII PHY ID, 0 - 31 */
101 u8 rxq; /* configurable, currently 0 - 31 only */
102 u8 txreadyq;
103 u8 hwaddr[6];
104};
105
106/* Information about built-in HSS (synchronous serial) interfaces */
107struct hss_plat_info {
108 int (*set_clock)(int port, unsigned int clock_type);
109 int (*open)(int port, void *pdev,
110 void (*set_carrier_cb)(void *pdev, int carrier));
111 void (*close)(int port, void *pdev);
112 u8 txreadyq;
113};
114
115/*
116 * Frequency of clock used for primary clocksource
117 */
118extern unsigned long ixp4xx_timer_freq;
119
120/*
121 * Functions used by platform-level setup code
122 */
123extern void ixp4xx_map_io(void);
124extern void ixp4xx_init_irq(void);
125extern void ixp4xx_sys_init(void);
126extern void ixp4xx_timer_init(void);
127extern struct sys_timer ixp4xx_timer;
128extern void ixp4xx_pci_preinit(void);
129struct pci_sys_data;
130extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
131extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
132
133/*
134 * GPIO-functions
135 */
136/*
137 * The following converted to the real HW bits the gpio_line_config
138 */
139/* GPIO pin types */
140#define IXP4XX_GPIO_OUT 0x1
141#define IXP4XX_GPIO_IN 0x2
142
143/* GPIO signal types */
144#define IXP4XX_GPIO_LOW 0
145#define IXP4XX_GPIO_HIGH 1
146
147/* GPIO Clocks */
148#define IXP4XX_GPIO_CLK_0 14
149#define IXP4XX_GPIO_CLK_1 15
150
151static inline void gpio_line_config(u8 line, u32 direction)
152{
153 if (direction == IXP4XX_GPIO_IN)
154 *IXP4XX_GPIO_GPOER |= (1 << line);
155 else
156 *IXP4XX_GPIO_GPOER &= ~(1 << line);
157}
158
159static inline void gpio_line_get(u8 line, int *value)
160{
161 *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
162}
163
164static inline void gpio_line_set(u8 line, int value)
165{
166 if (value == IXP4XX_GPIO_HIGH)
167 *IXP4XX_GPIO_GPOUTR |= (1 << line);
168 else if (value == IXP4XX_GPIO_LOW)
169 *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
170}
171
172#endif // __ASSEMBLY__
173
diff --git a/arch/arm/mach-ixp4xx/include/mach/prpmc1100.h b/arch/arm/mach-ixp4xx/include/mach/prpmc1100.h
new file mode 100644
index 000000000000..17274a2e3dec
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/prpmc1100.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/prpmc1100.h
3 *
4 * Motorolla PrPMC1100 platform specific definitions
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista, Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#ifndef __ASM_ARCH_HARDWARE_H__
16#error "Do not include this directly, instead #include <mach/hardware.h>"
17#endif
18
19#define PRPMC1100_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
20#define PRPMC1100_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE
21
22#define PRPMC1100_PCI_MIN_DEVID 10
23#define PRPMC1100_PCI_MAX_DEVID 16
24#define PRPMC1100_PCI_IRQ_LINES 4
25
26
27/* PCI controller GPIO to IRQ pin mappings */
28#define PRPMC1100_PCI_INTA_PIN 11
29#define PRPMC1100_PCI_INTB_PIN 10
30#define PRPMC1100_PCI_INTC_PIN 9
31#define PRPMC1100_PCI_INTD_PIN 8
32
33
diff --git a/arch/arm/mach-ixp4xx/include/mach/qmgr.h b/arch/arm/mach-ixp4xx/include/mach/qmgr.h
new file mode 100644
index 000000000000..1e52b95cede5
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/qmgr.h
@@ -0,0 +1,126 @@
1/*
2 * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License
6 * as published by the Free Software Foundation.
7 */
8
9#ifndef IXP4XX_QMGR_H
10#define IXP4XX_QMGR_H
11
12#include <linux/io.h>
13#include <linux/kernel.h>
14
15#define HALF_QUEUES 32
16#define QUEUES 64 /* only 32 lower queues currently supported */
17#define MAX_QUEUE_LENGTH 4 /* in dwords */
18
19#define QUEUE_STAT1_EMPTY 1 /* queue status bits */
20#define QUEUE_STAT1_NEARLY_EMPTY 2
21#define QUEUE_STAT1_NEARLY_FULL 4
22#define QUEUE_STAT1_FULL 8
23#define QUEUE_STAT2_UNDERFLOW 1
24#define QUEUE_STAT2_OVERFLOW 2
25
26#define QUEUE_WATERMARK_0_ENTRIES 0
27#define QUEUE_WATERMARK_1_ENTRY 1
28#define QUEUE_WATERMARK_2_ENTRIES 2
29#define QUEUE_WATERMARK_4_ENTRIES 3
30#define QUEUE_WATERMARK_8_ENTRIES 4
31#define QUEUE_WATERMARK_16_ENTRIES 5
32#define QUEUE_WATERMARK_32_ENTRIES 6
33#define QUEUE_WATERMARK_64_ENTRIES 7
34
35/* queue interrupt request conditions */
36#define QUEUE_IRQ_SRC_EMPTY 0
37#define QUEUE_IRQ_SRC_NEARLY_EMPTY 1
38#define QUEUE_IRQ_SRC_NEARLY_FULL 2
39#define QUEUE_IRQ_SRC_FULL 3
40#define QUEUE_IRQ_SRC_NOT_EMPTY 4
41#define QUEUE_IRQ_SRC_NOT_NEARLY_EMPTY 5
42#define QUEUE_IRQ_SRC_NOT_NEARLY_FULL 6
43#define QUEUE_IRQ_SRC_NOT_FULL 7
44
45struct qmgr_regs {
46 u32 acc[QUEUES][MAX_QUEUE_LENGTH]; /* 0x000 - 0x3FF */
47 u32 stat1[4]; /* 0x400 - 0x40F */
48 u32 stat2[2]; /* 0x410 - 0x417 */
49 u32 statne_h; /* 0x418 - queue nearly empty */
50 u32 statf_h; /* 0x41C - queue full */
51 u32 irqsrc[4]; /* 0x420 - 0x42F IRC source */
52 u32 irqen[2]; /* 0x430 - 0x437 IRQ enabled */
53 u32 irqstat[2]; /* 0x438 - 0x43F - IRQ access only */
54 u32 reserved[1776];
55 u32 sram[2048]; /* 0x2000 - 0x3FFF - config and buffer */
56};
57
58void qmgr_set_irq(unsigned int queue, int src,
59 void (*handler)(void *pdev), void *pdev);
60void qmgr_enable_irq(unsigned int queue);
61void qmgr_disable_irq(unsigned int queue);
62
63/* request_ and release_queue() must be called from non-IRQ context */
64int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
65 unsigned int nearly_empty_watermark,
66 unsigned int nearly_full_watermark);
67void qmgr_release_queue(unsigned int queue);
68
69
70static inline void qmgr_put_entry(unsigned int queue, u32 val)
71{
72 extern struct qmgr_regs __iomem *qmgr_regs;
73 __raw_writel(val, &qmgr_regs->acc[queue][0]);
74}
75
76static inline u32 qmgr_get_entry(unsigned int queue)
77{
78 extern struct qmgr_regs __iomem *qmgr_regs;
79 return __raw_readl(&qmgr_regs->acc[queue][0]);
80}
81
82static inline int qmgr_get_stat1(unsigned int queue)
83{
84 extern struct qmgr_regs __iomem *qmgr_regs;
85 return (__raw_readl(&qmgr_regs->stat1[queue >> 3])
86 >> ((queue & 7) << 2)) & 0xF;
87}
88
89static inline int qmgr_get_stat2(unsigned int queue)
90{
91 extern struct qmgr_regs __iomem *qmgr_regs;
92 return (__raw_readl(&qmgr_regs->stat2[queue >> 4])
93 >> ((queue & 0xF) << 1)) & 0x3;
94}
95
96static inline int qmgr_stat_empty(unsigned int queue)
97{
98 return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY);
99}
100
101static inline int qmgr_stat_nearly_empty(unsigned int queue)
102{
103 return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY);
104}
105
106static inline int qmgr_stat_nearly_full(unsigned int queue)
107{
108 return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL);
109}
110
111static inline int qmgr_stat_full(unsigned int queue)
112{
113 return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_FULL);
114}
115
116static inline int qmgr_stat_underflow(unsigned int queue)
117{
118 return !!(qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW);
119}
120
121static inline int qmgr_stat_overflow(unsigned int queue)
122{
123 return !!(qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW);
124}
125
126#endif
diff --git a/arch/arm/mach-ixp4xx/include/mach/system.h b/arch/arm/mach-ixp4xx/include/mach/system.h
new file mode 100644
index 000000000000..92a7e8ddf69a
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/system.h
@@ -0,0 +1,42 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/system.h
3 *
4 * Copyright (C) 2002 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include <mach/hardware.h>
13
14static inline void arch_idle(void)
15{
16#if 0
17 if (!hlt_counter)
18 cpu_do_idle(0);
19#endif
20}
21
22
23static inline void arch_reset(char mode)
24{
25 if ( 1 && mode == 's') {
26 /* Jump into ROM at address 0 */
27 cpu_reset(0);
28 } else {
29 /* Use on-chip reset capability */
30
31 /* set the "key" register to enable access to
32 * "timer" and "enable" registers
33 */
34 *IXP4XX_OSWK = IXP4XX_WDT_KEY;
35
36 /* write 0 to the timer register for an immediate reset */
37 *IXP4XX_OSWT = 0;
38
39 *IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE;
40 }
41}
42
diff --git a/arch/arm/mach-ixp4xx/include/mach/timex.h b/arch/arm/mach-ixp4xx/include/mach/timex.h
new file mode 100644
index 000000000000..89ce3ee84698
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/timex.h
@@ -0,0 +1,15 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/timex.h
3 *
4 */
5
6#include <mach/hardware.h>
7
8/*
9 * We use IXP425 General purpose timer for our timer needs, it runs at
10 * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the
11 * timer register ignores the bottom 2 bits of the LATCH value.
12 */
13#define FREQ 66666666
14#define CLOCK_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
15
diff --git a/arch/arm/mach-ixp4xx/include/mach/udc.h b/arch/arm/mach-ixp4xx/include/mach/udc.h
new file mode 100644
index 000000000000..80d6da2eafac
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/udc.h
@@ -0,0 +1,8 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/udc.h
3 *
4 */
5#include <asm/mach/udc_pxa2xx.h>
6
7extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info);
8
diff --git a/arch/arm/mach-ixp4xx/include/mach/uncompress.h b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
new file mode 100644
index 000000000000..2db0078a8cf2
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/uncompress.h
3 *
4 * Copyright (C) 2002 Intel Corporation.
5 * Copyright (C) 2003-2004 MontaVista Software, Inc.
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
13#ifndef _ARCH_UNCOMPRESS_H_
14#define _ARCH_UNCOMPRESS_H_
15
16#include "ixp4xx-regs.h"
17#include <asm/mach-types.h>
18#include <linux/serial_reg.h>
19
20#define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE)
21
22static volatile u32* uart_base;
23
24static inline void putc(int c)
25{
26 /* Check THRE and TEMT bits before we transmit the character.
27 */
28 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
29 barrier();
30
31 *uart_base = c;
32}
33
34static void flush(void)
35{
36}
37
38static __inline__ void __arch_decomp_setup(unsigned long arch_id)
39{
40 /*
41 * Some boards are using UART2 as console
42 */
43 if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
44 machine_is_gateway7001() || machine_is_wg302v2())
45 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
46 else
47 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
48}
49
50/*
51 * arch_id is a variable in decompress_kernel()
52 */
53#define arch_decomp_setup() __arch_decomp_setup(arch_id)
54
55#define arch_decomp_wdog()
56
57#endif
diff --git a/arch/arm/mach-ixp4xx/include/mach/vmalloc.h b/arch/arm/mach-ixp4xx/include/mach/vmalloc.h
new file mode 100644
index 000000000000..7b3580b53adf
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/include/mach/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/vmalloc.h
3 */
4#define VMALLOC_END (0xFF000000)
5
diff --git a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c
index 7d9bb4d23104..64c29aacaac9 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
@@ -22,7 +22,7 @@
22 22
23#include <asm/mach/pci.h> 23#include <asm/mach/pci.h>
24#include <asm/irq.h> 24#include <asm/irq.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27 27
28void __init ixdp425_pci_preinit(void) 28void __init ixdp425_pci_preinit(void)
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 44584afb34a3..9b2d2ec14c80 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -24,7 +24,7 @@
24#include <asm/types.h> 24#include <asm/types.h>
25#include <asm/setup.h> 25#include <asm/setup.h>
26#include <asm/memory.h> 26#include <asm/memory.h>
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-ixp4xx/ixdpg425-pci.c b/arch/arm/mach-ixp4xx/ixdpg425-pci.c
index 37d9f2e8f602..4ed7ac614920 100644
--- a/arch/arm/mach-ixp4xx/ixdpg425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdpg425-pci.c
@@ -19,7 +19,7 @@
19#include <linux/irq.h> 19#include <linux/irq.h>
20 20
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23 23
24#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
25 25
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_npe.c b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
index 63a23fa4aab4..c73a94d0ca2b 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_npe.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
@@ -21,7 +21,7 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <asm/arch/npe.h> 24#include <mach/npe.h>
25 25
26#define DEBUG_MSG 0 26#define DEBUG_MSG 0
27#define DEBUG_FW 0 27#define DEBUG_FW 0
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
index fab94eaecee7..c6cb069a5a83 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
@@ -12,7 +12,7 @@
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <asm/arch/qmgr.h> 15#include <mach/qmgr.h>
16 16
17#define DEBUG 0 17#define DEBUG 0
18 18
diff --git a/arch/arm/mach-ixp4xx/wg302v2-pci.c b/arch/arm/mach-ixp4xx/wg302v2-pci.c
index 0f00feab67f8..9b59ed03b151 100644
--- a/arch/arm/mach-ixp4xx/wg302v2-pci.c
+++ b/arch/arm/mach-ixp4xx/wg302v2-pci.c
@@ -23,7 +23,7 @@
23#include <linux/irq.h> 23#include <linux/irq.h>
24 24
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27 27
28#include <asm/mach/pci.h> 28#include <asm/mach/pci.h>
29 29
diff --git a/arch/arm/mach-ixp4xx/wg302v2-setup.c b/arch/arm/mach-ixp4xx/wg302v2-setup.c
index f7e09ad804e8..7ea782021d1f 100644
--- a/arch/arm/mach-ixp4xx/wg302v2-setup.c
+++ b/arch/arm/mach-ixp4xx/wg302v2-setup.c
@@ -23,7 +23,7 @@
23#include <asm/types.h> 23#include <asm/types.h>
24#include <asm/setup.h> 24#include <asm/setup.h>
25#include <asm/memory.h> 25#include <asm/memory.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c
index a39f0f3c4730..c79f492072f9 100644
--- a/arch/arm/mach-kirkwood/addr-map.c
+++ b/arch/arm/mach-kirkwood/addr-map.c
@@ -12,7 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/hardware.h> 15#include <mach/hardware.h>
16#include "common.h" 16#include "common.h"
17 17
18/* 18/*
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 5938a3b33cdc..0e509b8ad56e 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -19,7 +19,7 @@
19#include <asm/timex.h> 19#include <asm/timex.h>
20#include <asm/mach/map.h> 20#include <asm/mach/map.h>
21#include <asm/mach/time.h> 21#include <asm/mach/time.h>
22#include <asm/arch/kirkwood.h> 22#include <mach/kirkwood.h>
23#include <asm/plat-orion/cache-feroceon-l2.h> 23#include <asm/plat-orion/cache-feroceon-l2.h>
24#include <asm/plat-orion/ehci-orion.h> 24#include <asm/plat-orion/ehci-orion.h>
25#include <asm/plat-orion/orion_nand.h> 25#include <asm/plat-orion/orion_nand.h>
diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
index d5c482c628e3..610fb24d8ae2 100644
--- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
+++ b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
@@ -21,7 +21,7 @@
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h> 23#include <asm/mach/pci.h>
24#include <asm/arch/kirkwood.h> 24#include <mach/kirkwood.h>
25#include "common.h" 25#include "common.h"
26 26
27static struct mv643xx_eth_platform_data db88f6281_ge00_data = { 27static struct mv643xx_eth_platform_data db88f6281_ge00_data = {
diff --git a/arch/arm/mach-kirkwood/include/mach/debug-macro.S b/arch/arm/mach-kirkwood/include/mach/debug-macro.S
new file mode 100644
index 000000000000..c0cc5b5c82ac
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/debug-macro.S
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/debug-macro.S
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7*/
8
9#include <mach/kirkwood.h>
10
11 .macro addruart,rx
12 mrc p15, 0, \rx, c1, c0
13 tst \rx, #1 @ MMU enabled?
14 ldreq \rx, =KIRKWOOD_REGS_PHYS_BASE
15 ldrne \rx, =KIRKWOOD_REGS_VIRT_BASE
16 orr \rx, \rx, #0x00012000
17 .endm
18
19#define UART_SHIFT 2
20#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-kirkwood/include/mach/dma.h b/arch/arm/mach-kirkwood/include/mach/dma.h
new file mode 100644
index 000000000000..40a8c178f10d
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/dma.h
@@ -0,0 +1 @@
/* empty */
diff --git a/arch/arm/mach-kirkwood/include/mach/entry-macro.S b/arch/arm/mach-kirkwood/include/mach/entry-macro.S
new file mode 100644
index 000000000000..83e0cba77b36
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/entry-macro.S
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Marvell Kirkwood 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
11#include <mach/kirkwood.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =IRQ_VIRT_BASE
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24 @ check low interrupts
25 ldr \irqstat, [\base, #IRQ_CAUSE_LOW_OFF]
26 ldr \tmp, [\base, #IRQ_MASK_LOW_OFF]
27 mov \irqnr, #31
28 ands \irqstat, \irqstat, \tmp
29 bne 1001f
30
31 @ if no low interrupts set, check high interrupts
32 ldr \irqstat, [\base, #IRQ_CAUSE_HIGH_OFF]
33 ldr \tmp, [\base, #IRQ_MASK_HIGH_OFF]
34 mov \irqnr, #63
35 ands \irqstat, \irqstat, \tmp
36
37 @ find first active interrupt source
381001: clzne \irqstat, \irqstat
39 subne \irqnr, \irqnr, \irqstat
40 .endm
diff --git a/arch/arm/mach-kirkwood/include/mach/hardware.h b/arch/arm/mach-kirkwood/include/mach/hardware.h
new file mode 100644
index 000000000000..cde85283f7d3
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/hardware.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/hardware.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H
11
12#include "kirkwood.h"
13
14#define pcibios_assign_all_busses() 1
15
16#define PCIBIOS_MIN_IO 0x00001000
17#define PCIBIOS_MIN_MEM 0x01000000
18#define PCIMEM_BASE KIRKWOOD_PCIE_MEM_PHYS_BASE /* mem base for VGA */
19
20
21#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/io.h b/arch/arm/mach-kirkwood/include/mach/io.h
new file mode 100644
index 000000000000..be07be0ef522
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/io.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/io.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_IO_H
10#define __ASM_ARCH_IO_H
11
12#include "kirkwood.h"
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16static inline void __iomem *__io(unsigned long addr)
17{
18 return (void __iomem *)((addr - KIRKWOOD_PCIE_IO_PHYS_BASE)
19 + KIRKWOOD_PCIE_IO_VIRT_BASE);
20}
21
22#define __io(a) __io(a)
23#define __mem_pci(a) (a)
24
25
26#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/irqs.h b/arch/arm/mach-kirkwood/include/mach/irqs.h
new file mode 100644
index 000000000000..6fd05838c72d
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/irqs.h
@@ -0,0 +1,63 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/irqs.h
3 *
4 * IRQ definitions for Marvell Kirkwood SoCs
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 __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H
13
14#include "kirkwood.h" /* need GPIO_MAX */
15
16/*
17 * Low Interrupt Controller
18 */
19#define IRQ_KIRKWOOD_HIGH_SUM 0
20#define IRQ_KIRKWOOD_BRIDGE 1
21#define IRQ_KIRKWOOD_HOST2CPU 2
22#define IRQ_KIRKWOOD_CPU2HOST 3
23#define IRQ_KIRKWOOD_XOR_00 5
24#define IRQ_KIRKWOOD_XOR_01 6
25#define IRQ_KIRKWOOD_XOR_10 7
26#define IRQ_KIRKWOOD_XOR_11 8
27#define IRQ_KIRKWOOD_PCIE 9
28#define IRQ_KIRKWOOD_GE00_SUM 11
29#define IRQ_KIRKWOOD_GE01_SUM 15
30#define IRQ_KIRKWOOD_USB 19
31#define IRQ_KIRKWOOD_SATA 21
32#define IRQ_KIRKWOOD_CRYPTO 22
33#define IRQ_KIRKWOOD_SPI 23
34#define IRQ_KIRKWOOD_I2S 24
35#define IRQ_KIRKWOOD_TS_0 26
36#define IRQ_KIRKWOOD_SDIO 28
37#define IRQ_KIRKWOOD_TWSI 29
38#define IRQ_KIRKWOOD_AVB 30
39#define IRQ_KIRKWOOD_TDMI 31
40
41/*
42 * High Interrupt Controller
43 */
44#define IRQ_KIRKWOOD_UART_0 33
45#define IRQ_KIRKWOOD_UART_1 34
46#define IRQ_KIRKWOOD_GPIO_LOW_0_7 35
47#define IRQ_KIRKWOOD_GPIO_LOW_8_15 36
48#define IRQ_KIRKWOOD_GPIO_LOW_16_23 37
49#define IRQ_KIRKWOOD_GPIO_LOW_24_31 38
50#define IRQ_KIRKWOOD_GPIO_HIGH_0_7 39
51#define IRQ_KIRKWOOD_GPIO_HIGH_8_15 40
52#define IRQ_KIRKWOOD_GPIO_HIGH_16_23 41
53
54/*
55 * KIRKWOOD General Purpose Pins
56 */
57#define IRQ_KIRKWOOD_GPIO_START 64
58#define NR_GPIO_IRQS GPIO_MAX
59
60#define NR_IRQS (IRQ_KIRKWOOD_GPIO_START + NR_GPIO_IRQS)
61
62
63#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
new file mode 100644
index 000000000000..d1336b41f0fb
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -0,0 +1,100 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/kirkwood.h
3 *
4 * Generic definitions for Marvell Kirkwood SoC flavors:
5 * 88F6180, 88F6192 and 88F6281.
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef __ASM_ARCH_KIRKWOOD_H
13#define __ASM_ARCH_KIRKWOOD_H
14
15/*
16 * Marvell Kirkwood address maps.
17 *
18 * phys
19 * e0000000 PCIe Memory space
20 * f1000000 on-chip peripheral registers
21 * f2000000 PCIe I/O space
22 * f3000000 NAND controller address window
23 *
24 * virt phys size
25 * fee00000 f1000000 1M on-chip peripheral registers
26 * fef00000 f2000000 1M PCIe I/O space
27 */
28
29#define KIRKWOOD_NAND_MEM_PHYS_BASE 0xf3000000
30#define KIRKWOOD_NAND_MEM_SIZE SZ_64K /* 1K is sufficient, but 64K
31 * is the minimal window size
32 */
33
34#define KIRKWOOD_PCIE_IO_PHYS_BASE 0xf2000000
35#define KIRKWOOD_PCIE_IO_VIRT_BASE 0xfef00000
36#define KIRKWOOD_PCIE_IO_BUS_BASE 0x00000000
37#define KIRKWOOD_PCIE_IO_SIZE SZ_1M
38
39#define KIRKWOOD_REGS_PHYS_BASE 0xf1000000
40#define KIRKWOOD_REGS_VIRT_BASE 0xfee00000
41#define KIRKWOOD_REGS_SIZE SZ_1M
42
43#define KIRKWOOD_PCIE_MEM_PHYS_BASE 0xe0000000
44#define KIRKWOOD_PCIE_MEM_SIZE SZ_128M
45
46/*
47 * MBUS bridge registers.
48 */
49#define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x20000)
50#define CPU_CONTROL (BRIDGE_VIRT_BASE | 0x0104)
51#define CPU_RESET 0x00000002
52#define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108)
53#define SOFT_RESET_OUT_EN 0x00000004
54#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c)
55#define SOFT_RESET 0x00000001
56#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110)
57#define BRIDGE_MASK (BRIDGE_VIRT_BASE | 0x0114)
58#define BRIDGE_INT_TIMER0 0x0002
59#define BRIDGE_INT_TIMER1 0x0004
60#define BRIDGE_INT_TIMER1_CLR (~0x0004)
61#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200)
62#define IRQ_CAUSE_LOW_OFF 0x0000
63#define IRQ_MASK_LOW_OFF 0x0004
64#define IRQ_CAUSE_HIGH_OFF 0x0010
65#define IRQ_MASK_HIGH_OFF 0x0014
66#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300)
67#define L2_CONFIG_REG (BRIDGE_VIRT_BASE | 0x0128)
68#define L2_WRITETHROUGH 0x00000010
69
70/*
71 * Register Map
72 */
73#define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x00000)
74#define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE | 0x1500)
75
76#define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x10000)
77#define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x10000)
78#define SAMPLE_AT_RESET (DEV_BUS_VIRT_BASE | 0x0030)
79#define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034)
80#define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300)
81#define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600)
82#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000)
83#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000)
84#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100)
85#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2100)
86
87#define PCIE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x40000)
88
89#define USB_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x50000)
90
91#define GE00_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x70000)
92#define GE01_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x74000)
93
94#define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000)
95
96
97#define GPIO_MAX 50
98
99
100#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/memory.h b/arch/arm/mach-kirkwood/include/mach/memory.h
new file mode 100644
index 000000000000..b5fb34bdccd5
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/memory.h
@@ -0,0 +1,14 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/memory.h
3 */
4
5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H
7
8#define PHYS_OFFSET UL(0x00000000)
9
10#define __virt_to_bus(x) __virt_to_phys(x)
11#define __bus_to_virt(x) __phys_to_virt(x)
12
13
14#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/system.h b/arch/arm/mach-kirkwood/include/mach/system.h
new file mode 100644
index 000000000000..8510f6cfdabf
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/system.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/system.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_SYSTEM_H
10#define __ASM_ARCH_SYSTEM_H
11
12#include <mach/hardware.h>
13#include <mach/kirkwood.h>
14
15static inline void arch_idle(void)
16{
17 cpu_do_idle();
18}
19
20static inline void arch_reset(char mode)
21{
22 /*
23 * Enable soft reset to assert RSTOUTn.
24 */
25 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
26
27 /*
28 * Assert soft reset.
29 */
30 writel(SOFT_RESET, SYSTEM_SOFT_RESET);
31
32 while (1)
33 ;
34}
35
36
37#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/timex.h b/arch/arm/mach-kirkwood/include/mach/timex.h
new file mode 100644
index 000000000000..f77ef4a32c5f
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/timex.h
@@ -0,0 +1,11 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/timex.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#define CLOCK_TICK_RATE (100 * HZ)
10
11#define KIRKWOOD_TCLK 166666667
diff --git a/arch/arm/mach-kirkwood/include/mach/uncompress.h b/arch/arm/mach-kirkwood/include/mach/uncompress.h
new file mode 100644
index 000000000000..75d5497df3a8
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/uncompress.h
@@ -0,0 +1,47 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/uncompress.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/serial_reg.h>
10#include <mach/kirkwood.h>
11
12#define SERIAL_BASE ((unsigned char *)UART0_PHYS_BASE)
13
14static void putc(const char c)
15{
16 unsigned char *base = SERIAL_BASE;
17 int i;
18
19 for (i = 0; i < 0x1000; i++) {
20 if (base[UART_LSR << 2] & UART_LSR_THRE)
21 break;
22 barrier();
23 }
24
25 base[UART_TX << 2] = c;
26}
27
28static void flush(void)
29{
30 unsigned char *base = SERIAL_BASE;
31 unsigned char mask;
32 int i;
33
34 mask = UART_LSR_TEMT | UART_LSR_THRE;
35
36 for (i = 0; i < 0x1000; i++) {
37 if ((base[UART_LSR << 2] & mask) == mask)
38 break;
39 barrier();
40 }
41}
42
43/*
44 * nothing to do
45 */
46#define arch_decomp_setup()
47#define arch_decomp_wdog()
diff --git a/arch/arm/mach-kirkwood/include/mach/vmalloc.h b/arch/arm/mach-kirkwood/include/mach/vmalloc.h
new file mode 100644
index 000000000000..8f48260dcdad
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe800000
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
index 6cf642c504d3..182230a5d198 100644
--- a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
+++ b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
@@ -21,7 +21,7 @@
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h> 23#include <asm/mach/pci.h>
24#include <asm/arch/kirkwood.h> 24#include <mach/kirkwood.h>
25#include "common.h" 25#include "common.h"
26 26
27#define RD88F6192_GPIO_USB_VBUS 10 27#define RD88F6192_GPIO_USB_VBUS 10
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c
index b6437f47a77f..d8a43018c7d3 100644
--- a/arch/arm/mach-kirkwood/rd88f6281-setup.c
+++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c
@@ -22,7 +22,7 @@
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
25#include <asm/arch/kirkwood.h> 25#include <mach/kirkwood.h>
26#include <asm/plat-orion/orion_nand.h> 26#include <asm/plat-orion/orion_nand.h>
27#include "common.h" 27#include "common.h"
28 28
diff --git a/arch/arm/mach-ks8695/board-micrel.c b/arch/arm/mach-ks8695/board-micrel.c
index 05ac2bd04020..0468e93b7d3b 100644
--- a/arch/arm/mach-ks8695/board-micrel.c
+++ b/arch/arm/mach-ks8695/board-micrel.c
@@ -18,7 +18,7 @@
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/mach/irq.h> 19#include <asm/mach/irq.h>
20 20
21#include <asm/arch/devices.h> 21#include <mach/devices.h>
22 22
23#include "generic.h" 23#include "generic.h"
24 24
diff --git a/arch/arm/mach-ks8695/cpu.c b/arch/arm/mach-ks8695/cpu.c
index 407d255e42bf..c6c08e800233 100644
--- a/arch/arm/mach-ks8695/cpu.c
+++ b/arch/arm/mach-ks8695/cpu.c
@@ -25,13 +25,13 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/init.h> 26#include <linux/init.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32 32
33#include <asm/arch/regs-sys.h> 33#include <mach/regs-sys.h>
34#include <asm/arch/regs-misc.h> 34#include <mach/regs-misc.h>
35 35
36 36
37static struct __initdata map_desc ks8695_io_desc[] = { 37static struct __initdata map_desc ks8695_io_desc[] = {
diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c
index 3db2ec61d06f..4bd251482c8f 100644
--- a/arch/arm/mach-ks8695/devices.c
+++ b/arch/arm/mach-ks8695/devices.c
@@ -22,9 +22,9 @@
22 22
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
25#include <asm/arch/regs-wan.h> 25#include <mach/regs-wan.h>
26#include <asm/arch/regs-lan.h> 26#include <mach/regs-lan.h>
27#include <asm/arch/regs-hpna.h> 27#include <mach/regs-hpna.h>
28 28
29 29
30/* -------------------------------------------------------------------- 30/* --------------------------------------------------------------------
diff --git a/arch/arm/mach-ks8695/gpio.c b/arch/arm/mach-ks8695/gpio.c
index 5e46191c0af9..3624e65cd89b 100644
--- a/arch/arm/mach-ks8695/gpio.c
+++ b/arch/arm/mach-ks8695/gpio.c
@@ -25,11 +25,11 @@
25#include <linux/module.h> 25#include <linux/module.h>
26 26
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30 30
31#include <asm/arch/regs-gpio.h> 31#include <mach/regs-gpio.h>
32#include <asm/arch/gpio.h> 32#include <mach/gpio.h>
33 33
34/* 34/*
35 * Configure a GPIO line for either GPIO function, or its internal 35 * Configure a GPIO line for either GPIO function, or its internal
diff --git a/arch/arm/mach-ks8695/include/mach/debug-macro.S b/arch/arm/mach-ks8695/include/mach/debug-macro.S
new file mode 100644
index 000000000000..3782c3559497
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/debug-macro.S
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/debug-macro.S
3 *
4 * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5 * Copyright (C) 2006 Simtec Electronics
6 *
7 * KS8695 - Debug macros
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <mach/hardware.h>
15#include <mach/regs-uart.h>
16
17 .macro addruart, rx
18 mrc p15, 0, \rx, c1, c0
19 tst \rx, #1 @ MMU enabled?
20 ldreq \rx, =KS8695_UART_PA @ physical base address
21 ldrne \rx, =KS8695_UART_VA @ virtual base address
22 .endm
23
24 .macro senduart, rd, rx
25 str \rd, [\rx, #KS8695_URTH] @ Write to Transmit Holding Register
26 .endm
27
28 .macro busyuart, rd, rx
291001: ldr \rd, [\rx, #KS8695_URLS] @ Read Line Status Register
30 tst \rd, #URLS_URTE @ Holding & Shift registers empty?
31 beq 1001b
32 .endm
33
34 .macro waituart, rd, rx
351001: ldr \rd, [\rx, #KS8695_URLS] @ Read Line Status Register
36 tst \rd, #URLS_URTHRE @ Holding Register empty?
37 beq 1001b
38 .endm
diff --git a/arch/arm/mach-ks8695/include/mach/devices.h b/arch/arm/mach-ks8695/include/mach/devices.h
new file mode 100644
index 000000000000..2744fecb429c
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/devices.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/devices.h
3 *
4 * Copyright (C) 2006 Andrew Victor
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_DEVICES_H
12#define __ASM_ARCH_DEVICES_H
13
14#include <linux/pci.h>
15
16 /* Ethernet */
17extern void __init ks8695_add_device_wan(void);
18extern void __init ks8695_add_device_lan(void);
19extern void __init ks8695_add_device_hpna(void);
20
21 /* LEDs */
22extern short ks8695_leds_cpu;
23extern short ks8695_leds_timer;
24extern void __init ks8695_init_leds(u8 cpu_led, u8 timer_led);
25
26 /* PCI */
27#define KS8695_MODE_PCI 0
28#define KS8695_MODE_MINIPCI 1
29#define KS8695_MODE_CARDBUS 2
30
31struct ks8695_pci_cfg {
32 short mode;
33 int (*map_irq)(struct pci_dev *, u8, u8);
34};
35extern __init void ks8695_init_pci(struct ks8695_pci_cfg *);
36
37#endif
diff --git a/arch/arm/mach-ks8695/include/mach/dma.h b/arch/arm/mach-ks8695/include/mach/dma.h
new file mode 100644
index 000000000000..561206280089
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/dma.h
@@ -0,0 +1,17 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/dma.h
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 */
diff --git a/arch/arm/mach-ks8695/include/mach/entry-macro.S b/arch/arm/mach-ks8695/include/mach/entry-macro.S
new file mode 100644
index 000000000000..b4fe0c11c6ce
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/entry-macro.S
@@ -0,0 +1,53 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/entry-macro.S
3 *
4 * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5 * Copyright (C) 2006 Simtec Electronics
6 *
7 * Low-level IRQ helper macros for KS8695
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12*/
13
14#include <mach/hardware.h>
15#include <mach/regs-irq.h>
16
17 .macro disable_fiq
18 .endm
19
20 .macro get_irqnr_preamble, base, tmp
21 ldr \base, =KS8695_IRQ_VA @ Base address of interrupt controller
22 .endm
23
24 .macro arch_ret_to_user, tmp1, tmp2
25 .endm
26
27 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
28 ldr \irqstat, [\base, #KS8695_INTMS] @ Mask Status register
29
30 teq \irqstat, #0
31 beq 1001f
32
33 mov \irqnr, #0
34
35 tst \irqstat, #0xff
36 moveq \irqstat, \irqstat, lsr #8
37 addeq \irqnr, \irqnr, #8
38 tsteq \irqstat, #0xff
39 moveq \irqstat, \irqstat, lsr #8
40 addeq \irqnr, \irqnr, #8
41 tsteq \irqstat, #0xff
42 moveq \irqstat, \irqstat, lsr #8
43 addeq \irqnr, \irqnr, #8
44 tst \irqstat, #0x0f
45 moveq \irqstat, \irqstat, lsr #4
46 addeq \irqnr, \irqnr, #4
47 tst \irqstat, #0x03
48 moveq \irqstat, \irqstat, lsr #2
49 addeq \irqnr, \irqnr, #2
50 tst \irqstat, #0x01
51 addeqs \irqnr, \irqnr, #1
521001:
53 .endm
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h
new file mode 100644
index 000000000000..73c84168761c
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/gpio.h
@@ -0,0 +1,79 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/gpio.h
3 *
4 * Copyright (C) 2006 Andrew Victor
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_GPIO_H_
12#define __ASM_ARCH_GPIO_H_
13
14#define KS8695_GPIO_0 0
15#define KS8695_GPIO_1 1
16#define KS8695_GPIO_2 2
17#define KS8695_GPIO_3 3
18#define KS8695_GPIO_4 4
19#define KS8695_GPIO_5 5
20#define KS8695_GPIO_6 6
21#define KS8695_GPIO_7 7
22#define KS8695_GPIO_8 8
23#define KS8695_GPIO_9 9
24#define KS8695_GPIO_10 10
25#define KS8695_GPIO_11 11
26#define KS8695_GPIO_12 12
27#define KS8695_GPIO_13 13
28#define KS8695_GPIO_14 14
29#define KS8695_GPIO_15 15
30
31
32/*
33 * Configure GPIO pin as external interrupt source.
34 */
35int __init_or_module ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
36
37/*
38 * Configure the GPIO line as an input.
39 */
40int __init_or_module gpio_direction_input(unsigned int pin);
41
42/*
43 * Configure the GPIO line as an output, with default state.
44 */
45int __init_or_module gpio_direction_output(unsigned int pin, unsigned int state);
46
47/*
48 * Set the state of an output GPIO line.
49 */
50void gpio_set_value(unsigned int pin, unsigned int state);
51
52/*
53 * Read the state of a GPIO line.
54 */
55int gpio_get_value(unsigned int pin);
56
57/*
58 * Map GPIO line to IRQ number.
59 */
60int gpio_to_irq(unsigned int pin);
61
62/*
63 * Map IRQ number to GPIO line.
64 */
65int irq_to_gpio(unsigned int irq);
66
67
68#include <asm-generic/gpio.h>
69
70static inline int gpio_request(unsigned int pin, const char *label)
71{
72 return 0;
73}
74
75static inline void gpio_free(unsigned int pin)
76{
77}
78
79#endif
diff --git a/arch/arm/mach-ks8695/include/mach/hardware.h b/arch/arm/mach-ks8695/include/mach/hardware.h
new file mode 100644
index 000000000000..1d640d075b7e
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/hardware.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/hardware.h
3 *
4 * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5 * Copyright (C) 2006 Simtec Electronics
6 *
7 * KS8695 - Memory Map definitions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_HARDWARE_H
15#define __ASM_ARCH_HARDWARE_H
16
17#include <asm/sizes.h>
18
19/*
20 * Physical RAM address.
21 */
22#define KS8695_SDRAM_PA 0x00000000
23
24
25/*
26 * We map an entire MiB with the System Configuration Registers in even
27 * though only 64KiB is needed. This makes it easier for use with the
28 * head debug code as the initial MMU setup only deals in L1 sections.
29 */
30#define KS8695_IO_PA 0x03F00000
31#define KS8695_IO_VA 0xF0000000
32#define KS8695_IO_SIZE SZ_1M
33
34#define KS8695_PCIMEM_PA 0x60000000
35#define KS8695_PCIMEM_SIZE SZ_512M
36
37#define KS8695_PCIIO_PA 0x80000000
38#define KS8695_PCIIO_SIZE SZ_64K
39
40
41/*
42 * PCI support
43 */
44#define pcibios_assign_all_busses() 1
45
46#define PCIBIOS_MIN_IO 0
47#define PCIBIOS_MIN_MEM 0
48
49#endif
diff --git a/arch/arm/mach-ks8695/include/mach/io.h b/arch/arm/mach-ks8695/include/mach/io.h
new file mode 100644
index 000000000000..f364f24ffe1e
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/io.h
@@ -0,0 +1,19 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/io.h
3 *
4 * Copyright (C) 2006 Andrew Victor
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 __ASM_ARCH_IO_H
12#define __ASM_ARCH_IO_H
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16#define __io(a) ((void __iomem *)(a))
17#define __mem_pci(a) (a)
18
19#endif
diff --git a/arch/arm/mach-ks8695/include/mach/irqs.h b/arch/arm/mach-ks8695/include/mach/irqs.h
new file mode 100644
index 000000000000..86fc9e6ce404
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/irqs.h
@@ -0,0 +1,54 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/irqs.h
3 *
4 * Copyright (C) 2006 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
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_IRQS_H
13#define __ASM_ARCH_IRQS_H
14
15
16#define NR_IRQS 32
17
18/*
19 * IRQ definitions
20 */
21#define KS8695_IRQ_COMM_RX 0
22#define KS8695_IRQ_COMM_TX 1
23#define KS8695_IRQ_EXTERN0 2
24#define KS8695_IRQ_EXTERN1 3
25#define KS8695_IRQ_EXTERN2 4
26#define KS8695_IRQ_EXTERN3 5
27#define KS8695_IRQ_TIMER0 6
28#define KS8695_IRQ_TIMER1 7
29#define KS8695_IRQ_UART_TX 8
30#define KS8695_IRQ_UART_RX 9
31#define KS8695_IRQ_UART_LINE_STATUS 10
32#define KS8695_IRQ_UART_MODEM_STATUS 11
33#define KS8695_IRQ_LAN_RX_STOP 12
34#define KS8695_IRQ_LAN_TX_STOP 13
35#define KS8695_IRQ_LAN_RX_BUF 14
36#define KS8695_IRQ_LAN_TX_BUF 15
37#define KS8695_IRQ_LAN_RX_STATUS 16
38#define KS8695_IRQ_LAN_TX_STATUS 17
39#define KS8695_IRQ_HPNA_RX_STOP 18
40#define KS8695_IRQ_HPNA_TX_STOP 19
41#define KS8695_IRQ_HPNA_RX_BUF 20
42#define KS8695_IRQ_HPNA_TX_BUF 21
43#define KS8695_IRQ_HPNA_RX_STATUS 22
44#define KS8695_IRQ_HPNA_TX_STATUS 23
45#define KS8695_IRQ_BUS_ERROR 24
46#define KS8695_IRQ_WAN_RX_STOP 25
47#define KS8695_IRQ_WAN_TX_STOP 26
48#define KS8695_IRQ_WAN_RX_BUF 27
49#define KS8695_IRQ_WAN_TX_BUF 28
50#define KS8695_IRQ_WAN_RX_STATUS 29
51#define KS8695_IRQ_WAN_TX_STATUS 30
52#define KS8695_IRQ_WAN_LINK 31
53
54#endif
diff --git a/arch/arm/mach-ks8695/include/mach/memory.h b/arch/arm/mach-ks8695/include/mach/memory.h
new file mode 100644
index 000000000000..dadbe66cb75c
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/memory.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/memory.h
3 *
4 * Copyright (C) 2006 Andrew Victor
5 *
6 * KS8695 Memory definitions
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef __ASM_ARCH_MEMORY_H
14#define __ASM_ARCH_MEMORY_H
15
16#include <mach/hardware.h>
17
18/*
19 * Physical SRAM offset.
20 */
21#define PHYS_OFFSET KS8695_SDRAM_PA
22
23#ifndef __ASSEMBLY__
24
25#ifdef CONFIG_PCI
26
27/* PCI mappings */
28#define __virt_to_bus(x) ((x) - PAGE_OFFSET + KS8695_PCIMEM_PA)
29#define __bus_to_virt(x) ((x) - KS8695_PCIMEM_PA + PAGE_OFFSET)
30
31/* Platform-bus mapping */
32extern struct bus_type platform_bus_type;
33#define is_lbus_device(dev) (dev && dev->bus == &platform_bus_type)
34#define __arch_dma_to_virt(dev, x) ({ is_lbus_device(dev) ? \
35 __phys_to_virt(x) : __bus_to_virt(x); })
36#define __arch_virt_to_dma(dev, x) ({ is_lbus_device(dev) ? \
37 (dma_addr_t)__virt_to_phys(x) : (dma_addr_t)__virt_to_bus(x); })
38#define __arch_page_to_dma(dev, x) __arch_virt_to_dma(dev, page_address(x))
39
40#else
41
42#define __virt_to_bus(x) __virt_to_phys(x)
43#define __bus_to_virt(x) __phys_to_virt(x)
44
45#endif
46
47#endif
48
49#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-gpio.h b/arch/arm/mach-ks8695/include/mach/regs-gpio.h
new file mode 100644
index 000000000000..0df6fe61d1ce
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-gpio.h
@@ -0,0 +1,55 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-gpio.h
3 *
4 * Copyright (C) 2007 Andrew Victor
5 *
6 * KS8695 - GPIO control registers and bit definitions.
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef KS8695_GPIO_H
14#define KS8695_GPIO_H
15
16#define KS8695_GPIO_OFFSET (0xF0000 + 0xE600)
17#define KS8695_GPIO_VA (KS8695_IO_VA + KS8695_GPIO_OFFSET)
18#define KS8695_GPIO_PA (KS8695_IO_PA + KS8695_GPIO_OFFSET)
19
20
21#define KS8695_IOPM (0x00) /* I/O Port Mode Register */
22#define KS8695_IOPC (0x04) /* I/O Port Control Register */
23#define KS8695_IOPD (0x08) /* I/O Port Data Register */
24
25
26/* Port Mode Register */
27#define IOPM_(x) (1 << (x)) /* Mode for GPIO Pin x */
28
29/* Port Control Register */
30#define IOPC_IOTIM1EN (1 << 17) /* GPIO Pin for Timer1 Enable */
31#define IOPC_IOTIM0EN (1 << 16) /* GPIO Pin for Timer0 Enable */
32#define IOPC_IOEINT3EN (1 << 15) /* GPIO Pin for External/Soft Interrupt 3 Enable */
33#define IOPC_IOEINT3TM (7 << 12) /* GPIO Pin for External/Soft Interrupt 3 Trigger Mode */
34#define IOPC_IOEINT3_MODE(x) ((x) << 12)
35#define IOPC_IOEINT2EN (1 << 11) /* GPIO Pin for External/Soft Interrupt 2 Enable */
36#define IOPC_IOEINT2TM (7 << 8) /* GPIO Pin for External/Soft Interrupt 2 Trigger Mode */
37#define IOPC_IOEINT2_MODE(x) ((x) << 8)
38#define IOPC_IOEINT1EN (1 << 7) /* GPIO Pin for External/Soft Interrupt 1 Enable */
39#define IOPC_IOEINT1TM (7 << 4) /* GPIO Pin for External/Soft Interrupt 1 Trigger Mode */
40#define IOPC_IOEINT1_MODE(x) ((x) << 4)
41#define IOPC_IOEINT0EN (1 << 3) /* GPIO Pin for External/Soft Interrupt 0 Enable */
42#define IOPC_IOEINT0TM (7 << 0) /* GPIO Pin for External/Soft Interrupt 0 Trigger Mode */
43#define IOPC_IOEINT0_MODE(x) ((x) << 0)
44
45 /* Trigger Modes */
46#define IOPC_TM_LOW (0) /* Level Detection (Active Low) */
47#define IOPC_TM_HIGH (1) /* Level Detection (Active High) */
48#define IOPC_TM_RISING (2) /* Rising Edge Detection */
49#define IOPC_TM_FALLING (4) /* Falling Edge Detection */
50#define IOPC_TM_EDGE (6) /* Both Edge Detection */
51
52/* Port Data Register */
53#define IOPD_(x) (1 << (x)) /* Signal Level of GPIO Pin x */
54
55#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-hpna.h b/arch/arm/mach-ks8695/include/mach/regs-hpna.h
new file mode 100644
index 000000000000..815ce5c2e3b9
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-hpna.h
@@ -0,0 +1,25 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-wan.h
3 *
4 * Copyright (C) 2006 Andrew Victor
5 *
6 * KS8695 - HPNA Registers and bit definitions.
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef KS8695_HPNA_H
14#define KS8695_HPNA_H
15
16#define KS8695_HPNA_OFFSET (0xF0000 + 0xA000)
17#define KS8695_HPNA_VA (KS8695_IO_VA + KS8695_HPNA_OFFSET)
18#define KS8695_HPNA_PA (KS8695_IO_PA + KS8695_HPNA_OFFSET)
19
20
21/*
22 * HPNA registers
23 */
24
25#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-irq.h b/arch/arm/mach-ks8695/include/mach/regs-irq.h
new file mode 100644
index 000000000000..352b7e8704d5
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-irq.h
@@ -0,0 +1,41 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-irq.h
3 *
4 * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5 * Copyright (C) 2006 Simtec Electronics
6 *
7 * KS8695 - IRQ registers and bit definitions
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef KS8695_IRQ_H
15#define KS8695_IRQ_H
16
17#define KS8695_IRQ_OFFSET (0xF0000 + 0xE200)
18#define KS8695_IRQ_VA (KS8695_IO_VA + KS8695_IRQ_OFFSET)
19#define KS8695_IRQ_PA (KS8695_IO_PA + KS8695_IRQ_OFFSET)
20
21
22/*
23 * Interrupt Controller registers
24 */
25#define KS8695_INTMC (0x00) /* Mode Control Register */
26#define KS8695_INTEN (0x04) /* Interrupt Enable Register */
27#define KS8695_INTST (0x08) /* Interrupt Status Register */
28#define KS8695_INTPW (0x0c) /* Interrupt Priority (WAN MAC) */
29#define KS8695_INTPH (0x10) /* Interrupt Priority (HPNA) [KS8695 only] */
30#define KS8695_INTPL (0x14) /* Interrupt Priority (LAN MAC) */
31#define KS8695_INTPT (0x18) /* Interrupt Priority (Timer) */
32#define KS8695_INTPU (0x1c) /* Interrupt Priority (UART) */
33#define KS8695_INTPE (0x20) /* Interrupt Priority (External Interrupt) */
34#define KS8695_INTPC (0x24) /* Interrupt Priority (Communications Channel) */
35#define KS8695_INTPBE (0x28) /* Interrupt Priority (Bus Error Response) */
36#define KS8695_INTMS (0x2c) /* Interrupt Mask Status Register */
37#define KS8695_INTHPF (0x30) /* Interrupt Pending Highest Priority (FIQ) */
38#define KS8695_INTHPI (0x34) /* Interrupt Pending Highest Priority (IRQ) */
39
40
41#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-lan.h b/arch/arm/mach-ks8695/include/mach/regs-lan.h
new file mode 100644
index 000000000000..9ef409901e76
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-lan.h
@@ -0,0 +1,65 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-lan.h
3 *
4 * Copyright (C) 2006 Andrew Victor
5 *
6 * KS8695 - LAN Registers and bit definitions.
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef KS8695_LAN_H
14#define KS8695_LAN_H
15
16#define KS8695_LAN_OFFSET (0xF0000 + 0x8000)
17#define KS8695_LAN_VA (KS8695_IO_VA + KS8695_LAN_OFFSET)
18#define KS8695_LAN_PA (KS8695_IO_PA + KS8695_LAN_OFFSET)
19
20
21/*
22 * LAN registers
23 */
24#define KS8695_LMDTXC (0x00) /* DMA Transmit Control */
25#define KS8695_LMDRXC (0x04) /* DMA Receive Control */
26#define KS8695_LMDTSC (0x08) /* DMA Transmit Start Command */
27#define KS8695_LMDRSC (0x0c) /* DMA Receive Start Command */
28#define KS8695_LTDLB (0x10) /* Transmit Descriptor List Base Address */
29#define KS8695_LRDLB (0x14) /* Receive Descriptor List Base Address */
30#define KS8695_LMAL (0x18) /* MAC Station Address Low */
31#define KS8695_LMAH (0x1c) /* MAC Station Address High */
32#define KS8695_LMAAL_(n) (0x80 + ((n)*8)) /* MAC Additional Station Address (0..15) Low */
33#define KS8695_LMAAH_(n) (0x84 + ((n)*8)) /* MAC Additional Station Address (0..15) High */
34
35
36/* DMA Transmit Control Register */
37#define LMDTXC_LMTRST (1 << 31) /* Soft Reset */
38#define LMDTXC_LMTBS (0x3f << 24) /* Transmit Burst Size */
39#define LMDTXC_LMTUCG (1 << 18) /* Transmit UDP Checksum Generate */
40#define LMDTXC_LMTTCG (1 << 17) /* Transmit TCP Checksum Generate */
41#define LMDTXC_LMTICG (1 << 16) /* Transmit IP Checksum Generate */
42#define LMDTXC_LMTFCE (1 << 9) /* Transmit Flow Control Enable */
43#define LMDTXC_LMTLB (1 << 8) /* Loopback mode */
44#define LMDTXC_LMTEP (1 << 2) /* Transmit Enable Padding */
45#define LMDTXC_LMTAC (1 << 1) /* Transmit Add CRC */
46#define LMDTXC_LMTE (1 << 0) /* TX Enable */
47
48/* DMA Receive Control Register */
49#define LMDRXC_LMRBS (0x3f << 24) /* Receive Burst Size */
50#define LMDRXC_LMRUCC (1 << 18) /* Receive UDP Checksum check */
51#define LMDRXC_LMRTCG (1 << 17) /* Receive TCP Checksum check */
52#define LMDRXC_LMRICG (1 << 16) /* Receive IP Checksum check */
53#define LMDRXC_LMRFCE (1 << 9) /* Receive Flow Control Enable */
54#define LMDRXC_LMRB (1 << 6) /* Receive Broadcast */
55#define LMDRXC_LMRM (1 << 5) /* Receive Multicast */
56#define LMDRXC_LMRU (1 << 4) /* Receive Unicast */
57#define LMDRXC_LMRERR (1 << 3) /* Receive Error Frame */
58#define LMDRXC_LMRA (1 << 2) /* Receive All */
59#define LMDRXC_LMRE (1 << 1) /* RX Enable */
60
61/* Additional Station Address High */
62#define LMAAH_E (1 << 31) /* Address Enabled */
63
64
65#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-mem.h b/arch/arm/mach-ks8695/include/mach/regs-mem.h
new file mode 100644
index 000000000000..55806bc68ce3
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-mem.h
@@ -0,0 +1,89 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-mem.h
3 *
4 * Copyright (C) 2006 Andrew Victor
5 *
6 * KS8695 - Memory Controller registers and bit definitions
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef KS8695_MEM_H
14#define KS8695_MEM_H
15
16#define KS8695_MEM_OFFSET (0xF0000 + 0x4000)
17#define KS8695_MEM_VA (KS8695_IO_VA + KS8695_MEM_OFFSET)
18#define KS8695_MEM_PA (KS8695_IO_PA + KS8695_MEM_OFFSET)
19
20
21/*
22 * Memory Controller Registers
23 */
24#define KS8695_EXTACON0 (0x00) /* External I/O 0 Access Control */
25#define KS8695_EXTACON1 (0x04) /* External I/O 1 Access Control */
26#define KS8695_EXTACON2 (0x08) /* External I/O 2 Access Control */
27#define KS8695_ROMCON0 (0x10) /* ROM/SRAM/Flash 1 Control Register */
28#define KS8695_ROMCON1 (0x14) /* ROM/SRAM/Flash 2 Control Register */
29#define KS8695_ERGCON (0x20) /* External I/O and ROM/SRAM/Flash General Register */
30#define KS8695_SDCON0 (0x30) /* SDRAM Control Register 0 */
31#define KS8695_SDCON1 (0x34) /* SDRAM Control Register 1 */
32#define KS8695_SDGCON (0x38) /* SDRAM General Control */
33#define KS8695_SDBCON (0x3c) /* SDRAM Buffer Control */
34#define KS8695_REFTIM (0x40) /* SDRAM Refresh Timer */
35
36
37/* External I/O Access Control Registers */
38#define EXTACON_EBNPTR (0x3ff << 22) /* Last Address Pointer */
39#define EXTACON_EBBPTR (0x3ff << 12) /* Base Pointer */
40#define EXTACON_EBTACT (7 << 9) /* Write Enable/Output Enable Active Time */
41#define EXTACON_EBTCOH (7 << 6) /* Chip Select Hold Time */
42#define EXTACON_EBTACS (7 << 3) /* Address Setup Time before ECSN */
43#define EXTACON_EBTCOS (7 << 0) /* Chip Select Time before OEN */
44
45/* ROM/SRAM/Flash Control Register */
46#define ROMCON_RBNPTR (0x3ff << 22) /* Next Pointer */
47#define ROMCON_RBBPTR (0x3ff << 12) /* Base Pointer */
48#define ROMCON_RBTACC (7 << 4) /* Access Cycle Time */
49#define ROMCON_RBTPA (3 << 2) /* Page Address Access Time */
50#define ROMCON_PMC (3 << 0) /* Page Mode Configuration */
51#define PMC_NORMAL (0 << 0)
52#define PMC_4WORD (1 << 0)
53#define PMC_8WORD (2 << 0)
54#define PMC_16WORD (3 << 0)
55
56/* External I/O and ROM/SRAM/Flash General Register */
57#define ERGCON_TMULT (3 << 28) /* Time Multiplier */
58#define ERGCON_DSX2 (3 << 20) /* Data Width (External I/O Bank 2) */
59#define ERGCON_DSX1 (3 << 18) /* Data Width (External I/O Bank 1) */
60#define ERGCON_DSX0 (3 << 16) /* Data Width (External I/O Bank 0) */
61#define ERGCON_DSR1 (3 << 2) /* Data Width (ROM/SRAM/Flash Bank 1) */
62#define ERGCON_DSR0 (3 << 0) /* Data Width (ROM/SRAM/Flash Bank 0) */
63
64/* SDRAM Control Register */
65#define SDCON_DBNPTR (0x3ff << 22) /* Last Address Pointer */
66#define SDCON_DBBPTR (0x3ff << 12) /* Base Pointer */
67#define SDCON_DBCAB (3 << 8) /* Column Address Bits */
68#define SDCON_DBBNUM (1 << 3) /* Number of Banks */
69#define SDCON_DBDBW (3 << 1) /* Data Bus Width */
70
71/* SDRAM General Control Register */
72#define SDGCON_SDTRC (3 << 2) /* RAS to CAS latency */
73#define SDGCON_SDCAS (3 << 0) /* CAS latency */
74
75/* SDRAM Buffer Control Register */
76#define SDBCON_SDESTA (1 << 31) /* SDRAM Engine Status */
77#define SDBCON_RBUFBDIS (1 << 24) /* Read Buffer Burst Enable */
78#define SDBCON_WFIFOEN (1 << 23) /* Write FIFO Enable */
79#define SDBCON_RBUFEN (1 << 22) /* Read Buffer Enable */
80#define SDBCON_FLUSHWFIFO (1 << 21) /* Flush Write FIFO */
81#define SDBCON_RBUFINV (1 << 20) /* Read Buffer Invalidate */
82#define SDBCON_SDINI (3 << 16) /* SDRAM Initialization Control */
83#define SDBCON_SDMODE (0x3fff << 0) /* SDRAM Mode Register Value Program */
84
85/* SDRAM Refresh Timer Register */
86#define REFTIM_REFTIM (0xffff << 0) /* Refresh Timer Value */
87
88
89#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-misc.h b/arch/arm/mach-ks8695/include/mach/regs-misc.h
new file mode 100644
index 000000000000..2740c52494a0
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-misc.h
@@ -0,0 +1,97 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-misc.h
3 *
4 * Copyright (C) 2006 Andrew Victor
5 *
6 * KS8695 - Miscellaneous Registers
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef KS8695_MISC_H
14#define KS8695_MISC_H
15
16#define KS8695_MISC_OFFSET (0xF0000 + 0xEA00)
17#define KS8695_MISC_VA (KS8695_IO_VA + KS8695_MISC_OFFSET)
18#define KS8695_MISC_PA (KS8695_IO_PA + KS8695_MISC_OFFSET)
19
20
21/*
22 * Miscellaneous registers
23 */
24#define KS8695_DID (0x00) /* Device ID */
25#define KS8695_RID (0x04) /* Revision ID */
26#define KS8695_HMC (0x08) /* HPNA Miscellaneous Control [KS8695 only] */
27#define KS8695_WMC (0x0c) /* WAN Miscellaneous Control */
28#define KS8695_WPPM (0x10) /* WAN PHY Power Management */
29#define KS8695_PPS (0x1c) /* PHY PowerSave */
30
31/* Device ID Register */
32#define DID_ID (0xffff << 0) /* Device ID */
33
34/* Revision ID Register */
35#define RID_SUBID (0xf << 4) /* Sub-Device ID */
36#define RID_REVISION (0xf << 0) /* Revision ID */
37
38/* HPNA Miscellaneous Control Register */
39#define HMC_HSS (1 << 1) /* Speed */
40#define HMC_HDS (1 << 0) /* Duplex */
41
42/* WAN Miscellaneous Control Register */
43#define WMC_WANC (1 << 30) /* Auto-negotiation complete */
44#define WMC_WANR (1 << 29) /* Auto-negotiation restart */
45#define WMC_WANAP (1 << 28) /* Advertise Pause */
46#define WMC_WANA100F (1 << 27) /* Advertise 100 FDX */
47#define WMC_WANA100H (1 << 26) /* Advertise 100 HDX */
48#define WMC_WANA10F (1 << 25) /* Advertise 10 FDX */
49#define WMC_WANA10H (1 << 24) /* Advertise 10 HDX */
50#define WMC_WLS (1 << 23) /* Link status */
51#define WMC_WDS (1 << 22) /* Duplex status */
52#define WMC_WSS (1 << 21) /* Speed status */
53#define WMC_WLPP (1 << 20) /* Link Partner Pause */
54#define WMC_WLP100F (1 << 19) /* Link Partner 100 FDX */
55#define WMC_WLP100H (1 << 18) /* Link Partner 100 HDX */
56#define WMC_WLP10F (1 << 17) /* Link Partner 10 FDX */
57#define WMC_WLP10H (1 << 16) /* Link Partner 10 HDX */
58#define WMC_WAND (1 << 15) /* Auto-negotiation disable */
59#define WMC_WANF100 (1 << 14) /* Force 100 */
60#define WMC_WANFF (1 << 13) /* Force FDX */
61#define WMC_WLED1S (7 << 4) /* LED1 Select */
62#define WLED1S_SPEED (0 << 4)
63#define WLED1S_LINK (1 << 4)
64#define WLED1S_DUPLEX (2 << 4)
65#define WLED1S_COLLISION (3 << 4)
66#define WLED1S_ACTIVITY (4 << 4)
67#define WLED1S_FDX_COLLISION (5 << 4)
68#define WLED1S_LINK_ACTIVITY (6 << 4)
69#define WMC_WLED0S (7 << 0) /* LED0 Select */
70#define WLED0S_SPEED (0 << 0)
71#define WLED0S_LINK (1 << 0)
72#define WLED0S_DUPLEX (2 << 0)
73#define WLED0S_COLLISION (3 << 0)
74#define WLED0S_ACTIVITY (4 << 0)
75#define WLED0S_FDX_COLLISION (5 << 0)
76#define WLED0S_LINK_ACTIVITY (6 << 0)
77
78/* WAN PHY Power Management Register */
79#define WPPM_WLPBK (1 << 14) /* Local Loopback */
80#define WPPM_WRLPKB (1 << 13) /* Remove Loopback */
81#define WPPM_WPI (1 << 12) /* PHY isolate */
82#define WPPM_WFL (1 << 10) /* Force link */
83#define WPPM_MDIXS (1 << 9) /* MDIX Status */
84#define WPPM_FEF (1 << 8) /* Far End Fault */
85#define WPPM_AMDIXP (1 << 7) /* Auto MDIX Parameter */
86#define WPPM_TXDIS (1 << 6) /* Disable transmitter */
87#define WPPM_DFEF (1 << 5) /* Disable Far End Fault */
88#define WPPM_PD (1 << 4) /* Power Down */
89#define WPPM_DMDX (1 << 3) /* Disable Auto MDI/MDIX */
90#define WPPM_FMDX (1 << 2) /* Force MDIX */
91#define WPPM_LPBK (1 << 1) /* MAX Loopback */
92
93/* PHY Power Save Register */
94#define PPS_PPSM (1 << 0) /* PHY Power Save Mode */
95
96
97#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-pci.h b/arch/arm/mach-ks8695/include/mach/regs-pci.h
new file mode 100644
index 000000000000..75a9db6edbd9
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-pci.h
@@ -0,0 +1,53 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-pci.h
3 *
4 * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5 * Copyright (C) 2006 Simtec Electronics
6 *
7 * KS8695 - PCI bridge registers and bit definitions.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#define KS8695_PCI_OFFSET (0xF0000 + 0x2000)
15#define KS8695_PCI_VA (KS8695_IO_VA + KS8695_PCI_OFFSET)
16#define KS8695_PCI_PA (KS8695_IO_PA + KS8695_PCI_OFFSET)
17
18
19#define KS8695_CRCFID (0x000) /* Configuration: Identification */
20#define KS8695_CRCFCS (0x004) /* Configuration: Command and Status */
21#define KS8695_CRCFRV (0x008) /* Configuration: Revision */
22#define KS8695_CRCFLT (0x00C) /* Configuration: Latency Timer */
23#define KS8695_CRCBMA (0x010) /* Configuration: Base Memory Address */
24#define KS8695_CRCSID (0x02C) /* Configuration: Subsystem ID */
25#define KS8695_CRCFIT (0x03C) /* Configuration: Interrupt */
26#define KS8695_PBCA (0x100) /* Bridge Configuration Address */
27#define KS8695_PBCD (0x104) /* Bridge Configuration Data */
28#define KS8695_PBM (0x200) /* Bridge Mode */
29#define KS8695_PBCS (0x204) /* Bridge Control and Status */
30#define KS8695_PMBA (0x208) /* Bridge Memory Base Address */
31#define KS8695_PMBAC (0x20C) /* Bridge Memory Base Address Control */
32#define KS8695_PMBAM (0x210) /* Bridge Memory Base Address Mask */
33#define KS8695_PMBAT (0x214) /* Bridge Memory Base Address Translation */
34#define KS8695_PIOBA (0x218) /* Bridge I/O Base Address */
35#define KS8695_PIOBAC (0x21C) /* Bridge I/O Base Address Control */
36#define KS8695_PIOBAM (0x220) /* Bridge I/O Base Address Mask */
37#define KS8695_PIOBAT (0x224) /* Bridge I/O Base Address Translation */
38
39
40/* Configuration: Identification */
41
42/* Configuration: Command and Status */
43
44/* Configuration: Revision */
45
46
47
48#define CFRV_GUEST (1 << 23)
49
50#define PBCA_TYPE1 (1)
51#define PBCA_ENABLE (1 << 31)
52
53
diff --git a/arch/arm/mach-ks8695/include/mach/regs-switch.h b/arch/arm/mach-ks8695/include/mach/regs-switch.h
new file mode 100644
index 000000000000..56d12e8de895
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-switch.h
@@ -0,0 +1,66 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-switch.h
3 *
4 * Copyright (C) 2006 Andrew Victor
5 *
6 * KS8695 - Switch Registers and bit definitions.
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef KS8695_SWITCH_H
14#define KS8695_SWITCH_H
15
16#define KS8695_SWITCH_OFFSET (0xF0000 + 0xe800)
17#define KS8695_SWITCH_VA (KS8695_IO_VA + KS8695_SWITCH_OFFSET)
18#define KS8695_SWITCH_PA (KS8695_IO_PA + KS8695_SWITCH_OFFSET)
19
20
21/*
22 * Switch registers
23 */
24#define KS8695_SEC0 (0x00) /* Switch Engine Control 0 */
25#define KS8695_SEC1 (0x04) /* Switch Engine Control 1 */
26#define KS8695_SEC2 (0x08) /* Switch Engine Control 2 */
27
28#define KS8695_P(x)_C(z) (0xc0 + (((x)-1)*3 + ((z)-1))*4) /* Port Configuration Registers */
29
30#define KS8695_SEP12AN (0x48) /* Port 1 & 2 Auto-Negotiation */
31#define KS8695_SEP34AN (0x4c) /* Port 3 & 4 Auto-Negotiation */
32#define KS8695_SEIAC (0x50) /* Indirect Access Control */
33#define KS8695_SEIADH2 (0x54) /* Indirect Access Data High 2 */
34#define KS8695_SEIADH1 (0x58) /* Indirect Access Data High 1 */
35#define KS8695_SEIADL (0x5c) /* Indirect Access Data Low */
36#define KS8695_SEAFC (0x60) /* Advance Feature Control */
37#define KS8695_SEDSCPH (0x64) /* TOS Priority High */
38#define KS8695_SEDSCPL (0x68) /* TOS Priority Low */
39#define KS8695_SEMAH (0x6c) /* Switch Engine MAC Address High */
40#define KS8695_SEMAL (0x70) /* Switch Engine MAC Address Low */
41#define KS8695_LPPM12 (0x74) /* Port 1 & 2 PHY Power Management */
42#define KS8695_LPPM34 (0x78) /* Port 3 & 4 PHY Power Management */
43
44
45/* Switch Engine Control 0 */
46#define SEC0_LLED1S (7 << 25) /* LED1 Select */
47#define LLED1S_SPEED (0 << 25)
48#define LLED1S_LINK (1 << 25)
49#define LLED1S_DUPLEX (2 << 25)
50#define LLED1S_COLLISION (3 << 25)
51#define LLED1S_ACTIVITY (4 << 25)
52#define LLED1S_FDX_COLLISION (5 << 25)
53#define LLED1S_LINK_ACTIVITY (6 << 25)
54#define SEC0_LLED0S (7 << 22) /* LED0 Select */
55#define LLED0S_SPEED (0 << 22)
56#define LLED0S_LINK (1 << 22)
57#define LLED0S_DUPLEX (2 << 22)
58#define LLED0S_COLLISION (3 << 22)
59#define LLED0S_ACTIVITY (4 << 22)
60#define LLED0S_FDX_COLLISION (5 << 22)
61#define LLED0S_LINK_ACTIVITY (6 << 22)
62#define SEC0_ENABLE (1 << 0) /* Enable Switch */
63
64
65
66#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-sys.h b/arch/arm/mach-ks8695/include/mach/regs-sys.h
new file mode 100644
index 000000000000..57c20be0c129
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-sys.h
@@ -0,0 +1,34 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-sys.h
3 *
4 * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5 * Copyright (C) 2006 Simtec Electronics
6 *
7 * KS8695 - System control registers and bit definitions
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef KS8695_SYS_H
15#define KS8695_SYS_H
16
17#define KS8695_SYS_OFFSET (0xF0000 + 0x0000)
18#define KS8695_SYS_VA (KS8695_IO_VA + KS8695_SYS_OFFSET)
19#define KS8695_SYS_PA (KS8695_IO_PA + KS8695_SYS_OFFSET)
20
21
22#define KS8695_SYSCFG (0x00) /* System Configuration Register */
23#define KS8695_CLKCON (0x04) /* System Clock and Bus Control Register */
24
25
26/* System Configuration Register */
27#define SYSCFG_SPRBP (0x3ff << 16) /* Register Bank Base Pointer */
28
29/* System Clock and Bus Control Register */
30#define CLKCON_SFMODE (1 << 8) /* System Fast Mode for Simulation */
31#define CLKCON_SCDC (7 << 0) /* System Clock Divider Select */
32
33
34#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-timer.h b/arch/arm/mach-ks8695/include/mach/regs-timer.h
new file mode 100644
index 000000000000..e620cda99d2d
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-timer.h
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-timer.h
3 *
4 * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5 * Copyright (C) 2006 Simtec Electronics
6 *
7 * KS8695 - Timer registers and bit definitions.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef KS8695_TIMER_H
15#define KS8695_TIMER_H
16
17#define KS8695_TMR_OFFSET (0xF0000 + 0xE400)
18#define KS8695_TMR_VA (KS8695_IO_VA + KS8695_TMR_OFFSET)
19#define KS8695_TMR_PA (KS8695_IO_PA + KS8695_TMR_OFFSET)
20
21
22/*
23 * Timer registers
24 */
25#define KS8695_TMCON (0x00) /* Timer Control Register */
26#define KS8695_T1TC (0x04) /* Timer 1 Timeout Count Register */
27#define KS8695_T0TC (0x08) /* Timer 0 Timeout Count Register */
28#define KS8695_T1PD (0x0C) /* Timer 1 Pulse Count Register */
29#define KS8695_T0PD (0x10) /* Timer 0 Pulse Count Register */
30
31
32/* Timer Control Register */
33#define TMCON_T1EN (1 << 1) /* Timer 1 Enable */
34#define TMCON_T0EN (1 << 0) /* Timer 0 Enable */
35
36/* Timer0 Timeout Counter Register */
37#define T0TC_WATCHDOG (0xff) /* Enable watchdog mode */
38
39
40#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-uart.h b/arch/arm/mach-ks8695/include/mach/regs-uart.h
new file mode 100644
index 000000000000..8581fbc6245f
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-uart.h
@@ -0,0 +1,92 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-uart.h
3 *
4 * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5 * Copyright (C) 2006 Simtec Electronics
6 *
7 * KS8695 - UART register and bit definitions.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef KS8695_UART_H
15#define KS8695_UART_H
16
17#define KS8695_UART_OFFSET (0xF0000 + 0xE000)
18#define KS8695_UART_VA (KS8695_IO_VA + KS8695_UART_OFFSET)
19#define KS8695_UART_PA (KS8695_IO_PA + KS8695_UART_OFFSET)
20
21
22/*
23 * UART registers
24 */
25#define KS8695_URRB (0x00) /* Receive Buffer Register */
26#define KS8695_URTH (0x04) /* Transmit Holding Register */
27#define KS8695_URFC (0x08) /* FIFO Control Register */
28#define KS8695_URLC (0x0C) /* Line Control Register */
29#define KS8695_URMC (0x10) /* Modem Control Register */
30#define KS8695_URLS (0x14) /* Line Status Register */
31#define KS8695_URMS (0x18) /* Modem Status Register */
32#define KS8695_URBD (0x1C) /* Baud Rate Divisor Register */
33#define KS8695_USR (0x20) /* Status Register */
34
35
36/* FIFO Control Register */
37#define URFC_URFRT (3 << 6) /* Receive FIFO Trigger Level */
38#define URFC_URFRT_1 (0 << 6)
39#define URFC_URFRT_4 (1 << 6)
40#define URFC_URFRT_8 (2 << 6)
41#define URFC_URFRT_14 (3 << 6)
42#define URFC_URTFR (1 << 2) /* Transmit FIFO Reset */
43#define URFC_URRFR (1 << 1) /* Receive FIFO Reset */
44#define URFC_URFE (1 << 0) /* FIFO Enable */
45
46/* Line Control Register */
47#define URLC_URSBC (1 << 6) /* Set Break Condition */
48#define URLC_PARITY (7 << 3) /* Parity */
49#define URPE_NONE (0 << 3)
50#define URPE_ODD (1 << 3)
51#define URPE_EVEN (3 << 3)
52#define URPE_MARK (5 << 3)
53#define URPE_SPACE (7 << 3)
54#define URLC_URSB (1 << 2) /* Stop Bits */
55#define URLC_URCL (3 << 0) /* Character Length */
56#define URCL_5 (0 << 0)
57#define URCL_6 (1 << 0)
58#define URCL_7 (2 << 0)
59#define URCL_8 (3 << 0)
60
61/* Modem Control Register */
62#define URMC_URLB (1 << 4) /* Loop-back mode */
63#define URMC_UROUT2 (1 << 3) /* OUT2 signal */
64#define URMC_UROUT1 (1 << 2) /* OUT1 signal */
65#define URMC_URRTS (1 << 1) /* Request to Send */
66#define URMC_URDTR (1 << 0) /* Data Terminal Ready */
67
68/* Line Status Register */
69#define URLS_URRFE (1 << 7) /* Receive FIFO Error */
70#define URLS_URTE (1 << 6) /* Transmit Empty */
71#define URLS_URTHRE (1 << 5) /* Transmit Holding Register Empty */
72#define URLS_URBI (1 << 4) /* Break Interrupt */
73#define URLS_URFE (1 << 3) /* Framing Error */
74#define URLS_URPE (1 << 2) /* Parity Error */
75#define URLS_URROE (1 << 1) /* Receive Overrun Error */
76#define URLS_URDR (1 << 0) /* Receive Data Ready */
77
78/* Modem Status Register */
79#define URMS_URDCD (1 << 7) /* Data Carrier Detect */
80#define URMS_URRI (1 << 6) /* Ring Indicator */
81#define URMS_URDSR (1 << 5) /* Data Set Ready */
82#define URMS_URCTS (1 << 4) /* Clear to Send */
83#define URMS_URDDCD (1 << 3) /* Delta Data Carrier Detect */
84#define URMS_URTERI (1 << 2) /* Trailing Edge Ring Indicator */
85#define URMS_URDDST (1 << 1) /* Delta Data Set Ready */
86#define URMS_URDCTS (1 << 0) /* Delta Clear to Send */
87
88/* Status Register */
89#define USR_UTI (1 << 0) /* Timeout Indication */
90
91
92#endif
diff --git a/arch/arm/mach-ks8695/include/mach/regs-wan.h b/arch/arm/mach-ks8695/include/mach/regs-wan.h
new file mode 100644
index 000000000000..eb494ec6e956
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/regs-wan.h
@@ -0,0 +1,65 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/regs-wan.h
3 *
4 * Copyright (C) 2006 Andrew Victor
5 *
6 * KS8695 - WAN Registers and bit definitions.
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef KS8695_WAN_H
14#define KS8695_WAN_H
15
16#define KS8695_WAN_OFFSET (0xF0000 + 0x6000)
17#define KS8695_WAN_VA (KS8695_IO_VA + KS8695_WAN_OFFSET)
18#define KS8695_WAN_PA (KS8695_IO_PA + KS8695_WAN_OFFSET)
19
20
21/*
22 * WAN registers
23 */
24#define KS8695_WMDTXC (0x00) /* DMA Transmit Control */
25#define KS8695_WMDRXC (0x04) /* DMA Receive Control */
26#define KS8695_WMDTSC (0x08) /* DMA Transmit Start Command */
27#define KS8695_WMDRSC (0x0c) /* DMA Receive Start Command */
28#define KS8695_WTDLB (0x10) /* Transmit Descriptor List Base Address */
29#define KS8695_WRDLB (0x14) /* Receive Descriptor List Base Address */
30#define KS8695_WMAL (0x18) /* MAC Station Address Low */
31#define KS8695_WMAH (0x1c) /* MAC Station Address High */
32#define KS8695_WMAAL_(n) (0x80 + ((n)*8)) /* MAC Additional Station Address (0..15) Low */
33#define KS8695_WMAAH_(n) (0x84 + ((n)*8)) /* MAC Additional Station Address (0..15) High */
34
35
36/* DMA Transmit Control Register */
37#define WMDTXC_WMTRST (1 << 31) /* Soft Reset */
38#define WMDTXC_WMTBS (0x3f << 24) /* Transmit Burst Size */
39#define WMDTXC_WMTUCG (1 << 18) /* Transmit UDP Checksum Generate */
40#define WMDTXC_WMTTCG (1 << 17) /* Transmit TCP Checksum Generate */
41#define WMDTXC_WMTICG (1 << 16) /* Transmit IP Checksum Generate */
42#define WMDTXC_WMTFCE (1 << 9) /* Transmit Flow Control Enable */
43#define WMDTXC_WMTLB (1 << 8) /* Loopback mode */
44#define WMDTXC_WMTEP (1 << 2) /* Transmit Enable Padding */
45#define WMDTXC_WMTAC (1 << 1) /* Transmit Add CRC */
46#define WMDTXC_WMTE (1 << 0) /* TX Enable */
47
48/* DMA Receive Control Register */
49#define WMDRXC_WMRBS (0x3f << 24) /* Receive Burst Size */
50#define WMDRXC_WMRUCC (1 << 18) /* Receive UDP Checksum check */
51#define WMDRXC_WMRTCG (1 << 17) /* Receive TCP Checksum check */
52#define WMDRXC_WMRICG (1 << 16) /* Receive IP Checksum check */
53#define WMDRXC_WMRFCE (1 << 9) /* Receive Flow Control Enable */
54#define WMDRXC_WMRB (1 << 6) /* Receive Broadcast */
55#define WMDRXC_WMRM (1 << 5) /* Receive Multicast */
56#define WMDRXC_WMRU (1 << 4) /* Receive Unicast */
57#define WMDRXC_WMRERR (1 << 3) /* Receive Error Frame */
58#define WMDRXC_WMRA (1 << 2) /* Receive All */
59#define WMDRXC_WMRE (1 << 0) /* RX Enable */
60
61/* Additional Station Address High */
62#define WMAAH_E (1 << 31) /* Address Enabled */
63
64
65#endif
diff --git a/arch/arm/mach-ks8695/include/mach/system.h b/arch/arm/mach-ks8695/include/mach/system.h
new file mode 100644
index 000000000000..2a6f91869056
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/system.h
@@ -0,0 +1,48 @@
1/*
2 * arch/arm/mach-s3c2410/include/mach/system.h
3 *
4 * Copyright (C) 2006 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * KS8695 - System function defines and includes
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_SYSTEM_H
15#define __ASM_ARCH_SYSTEM_H
16
17#include <asm/io.h>
18#include <mach/regs-timer.h>
19
20static void arch_idle(void)
21{
22 /*
23 * This should do all the clock switching
24 * and wait for interrupt tricks,
25 */
26 cpu_do_idle();
27
28}
29
30static void arch_reset(char mode)
31{
32 unsigned int reg;
33
34 if (mode == 's')
35 cpu_reset(0);
36
37 /* disable timer0 */
38 reg = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
39 __raw_writel(reg & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
40
41 /* enable watchdog mode */
42 __raw_writel((10 << 8) | T0TC_WATCHDOG, KS8695_TMR_VA + KS8695_T0TC);
43
44 /* re-enable timer0 */
45 __raw_writel(reg | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
46}
47
48#endif
diff --git a/arch/arm/mach-ks8695/include/mach/timex.h b/arch/arm/mach-ks8695/include/mach/timex.h
new file mode 100644
index 000000000000..4682e350369b
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/timex.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/timex.h
3 *
4 * Copyright (C) 2006 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * KS8695 - Time Parameters
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_TIMEX_H
15#define __ASM_ARCH_TIMEX_H
16
17/* timers are derived from MCLK, which is 25MHz */
18#define CLOCK_TICK_RATE 25000000
19
20#endif
diff --git a/arch/arm/mach-ks8695/include/mach/uncompress.h b/arch/arm/mach-ks8695/include/mach/uncompress.h
new file mode 100644
index 000000000000..0eee37a69075
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/uncompress.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/uncompress.h
3 *
4 * Copyright (C) 2006 Ben Dooks <ben@simtec.co.uk>
5 * Copyright (C) 2006 Simtec Electronics
6 *
7 * KS8695 - Kernel uncompressor
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_UNCOMPRESS_H
15#define __ASM_ARCH_UNCOMPRESS_H
16
17#include <asm/io.h>
18#include <mach/regs-uart.h>
19
20static void putc(char c)
21{
22 while (!(__raw_readl(KS8695_UART_PA + KS8695_URLS) & URLS_URTHRE))
23 barrier();
24
25 __raw_writel(c, KS8695_UART_PA + KS8695_URTH);
26}
27
28static inline void flush(void)
29{
30 while (!(__raw_readl(KS8695_UART_PA + KS8695_URLS) & URLS_URTE))
31 barrier();
32}
33
34#define arch_decomp_setup()
35#define arch_decomp_wdog()
36
37#endif
diff --git a/arch/arm/mach-ks8695/include/mach/vmalloc.h b/arch/arm/mach-ks8695/include/mach/vmalloc.h
new file mode 100644
index 000000000000..744ac66be3a2
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/vmalloc.h
@@ -0,0 +1,19 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2006 Ben Dooks
5 * Copyright (C) 2006 Simtec Electronics <linux@simtec.co.uk>
6 *
7 * KS8695 vmalloc definition
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_VMALLOC_H
15#define __ASM_ARCH_VMALLOC_H
16
17#define VMALLOC_END (KS8695_IO_VA & PGDIR_MASK)
18
19#endif
diff --git a/arch/arm/mach-ks8695/irq.c b/arch/arm/mach-ks8695/irq.c
index 0b06941a1eed..e5e71f4dbb84 100644
--- a/arch/arm/mach-ks8695/irq.c
+++ b/arch/arm/mach-ks8695/irq.c
@@ -25,14 +25,14 @@
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/sysdev.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/io.h> 30#include <asm/io.h>
31 31
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33 33
34#include <asm/arch/regs-irq.h> 34#include <mach/regs-irq.h>
35#include <asm/arch/regs-gpio.h> 35#include <mach/regs-gpio.h>
36 36
37static void ks8695_irq_mask(unsigned int irqno) 37static void ks8695_irq_mask(unsigned int irqno)
38{ 38{
diff --git a/arch/arm/mach-ks8695/leds.c b/arch/arm/mach-ks8695/leds.c
index d61762ae50d8..184ef74e4bee 100644
--- a/arch/arm/mach-ks8695/leds.c
+++ b/arch/arm/mach-ks8695/leds.c
@@ -12,10 +12,9 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/init.h> 13#include <linux/init.h>
14 14
15#include <asm/mach-types.h>
16#include <asm/leds.h> 15#include <asm/leds.h>
17#include <asm/arch/devices.h> 16#include <mach/devices.h>
18#include <asm/arch/gpio.h> 17#include <mach/gpio.h>
19 18
20 19
21static inline void ks8695_led_on(unsigned int led) 20static inline void ks8695_led_on(unsigned int led)
diff --git a/arch/arm/mach-ks8695/pci.c b/arch/arm/mach-ks8695/pci.c
index 3f4e0330cb1a..1746c67af176 100644
--- a/arch/arm/mach-ks8695/pci.c
+++ b/arch/arm/mach-ks8695/pci.c
@@ -31,10 +31,10 @@
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/signal.h> 32#include <asm/signal.h>
33#include <asm/mach/pci.h> 33#include <asm/mach/pci.h>
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35 35
36#include <asm/arch/devices.h> 36#include <mach/devices.h>
37#include <asm/arch/regs-pci.h> 37#include <mach/regs-pci.h>
38 38
39 39
40static int pci_dbg; 40static int pci_dbg;
diff --git a/arch/arm/mach-ks8695/time.c b/arch/arm/mach-ks8695/time.c
index 02f766b3121d..940888dffc16 100644
--- a/arch/arm/mach-ks8695/time.c
+++ b/arch/arm/mach-ks8695/time.c
@@ -28,8 +28,8 @@
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/mach/time.h> 29#include <asm/mach/time.h>
30 30
31#include <asm/arch/regs-timer.h> 31#include <mach/regs-timer.h>
32#include <asm/arch/regs-irq.h> 32#include <mach/regs-irq.h>
33 33
34#include "generic.h" 34#include "generic.h"
35 35
diff --git a/arch/arm/mach-l7200/core.c b/arch/arm/mach-l7200/core.c
index 561a0fe7095d..50d23246d4f0 100644
--- a/arch/arm/mach-l7200/core.c
+++ b/arch/arm/mach-l7200/core.c
@@ -13,7 +13,7 @@
13#include <asm/types.h> 13#include <asm/types.h>
14#include <asm/irq.h> 14#include <asm/irq.h>
15#include <asm/mach-types.h> 15#include <asm/mach-types.h>
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/page.h> 17#include <asm/page.h>
18 18
19#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-l7200/include/mach/aux_reg.h b/arch/arm/mach-l7200/include/mach/aux_reg.h
new file mode 100644
index 000000000000..4671558cdd51
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/aux_reg.h
@@ -0,0 +1,28 @@
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
new file mode 100644
index 000000000000..34eed2a63e69
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/debug-macro.S
@@ -0,0 +1,40 @@
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
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/dma.h b/arch/arm/mach-l7200/include/mach/dma.h
new file mode 100644
index 000000000000..c7e48bd4590c
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/dma.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/mach-l7200/include/mach/dma.h
3 *
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 *
6 * Changelog:
7 * 08-29-2000 SJH Created
8 */
9#ifndef __ASM_ARCH_DMA_H
10#define __ASM_ARCH_DMA_H
11
12/* DMA is not yet implemented! It should be the same as acorn, copy over.. */
13
14/*
15 * This is the maximum DMA address that can be DMAd to.
16 * There should not be more than (0xd0000000 - 0xc0000000)
17 * bytes of RAM.
18 */
19#define MAX_DMA_ADDRESS 0xd0000000
20
21#define DMA_S0 0
22
23#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-l7200/include/mach/entry-macro.S b/arch/arm/mach-l7200/include/mach/entry-macro.S
new file mode 100644
index 000000000000..1726d91fc1d3
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/entry-macro.S
@@ -0,0 +1,35 @@
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
new file mode 100644
index 000000000000..2b7086a26b81
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/gp_timers.h
@@ -0,0 +1,42 @@
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
new file mode 100644
index 000000000000..c7b0a5d7b8bb
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/gpio.h
@@ -0,0 +1,105 @@
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
new file mode 100644
index 000000000000..c31909cfc254
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/hardware.h
@@ -0,0 +1,57 @@
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
new file mode 100644
index 000000000000..d432ba9e5dff
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/io.h
@@ -0,0 +1,27 @@
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#include <mach/hardware.h>
14
15#define IO_SPACE_LIMIT 0xffffffff
16
17/*
18 * There are not real ISA nor PCI buses, so we fake it.
19 */
20static inline void __iomem *__io(unsigned long addr)
21{
22 return (void __iomem *)addr;
23}
24#define __io(a) __io(a)
25#define __mem_pci(a) (a)
26
27#endif
diff --git a/arch/arm/mach-l7200/include/mach/irqs.h b/arch/arm/mach-l7200/include/mach/irqs.h
new file mode 100644
index 000000000000..7edffd713c5b
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/irqs.h
@@ -0,0 +1,56 @@
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
new file mode 100644
index 000000000000..f338cf3ffd93
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/memory.h
@@ -0,0 +1,29 @@
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#define __virt_to_bus(x) __virt_to_phys(x)
21#define __bus_to_virt(x) __phys_to_virt(x)
22
23/*
24 * Cache flushing area - ROM
25 */
26#define FLUSH_BASE_PHYS 0x40000000
27#define FLUSH_BASE 0xdf000000
28
29#endif
diff --git a/arch/arm/mach-l7200/include/mach/pmpcon.h b/arch/arm/mach-l7200/include/mach/pmpcon.h
new file mode 100644
index 000000000000..3959871e8361
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/pmpcon.h
@@ -0,0 +1,46 @@
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
new file mode 100644
index 000000000000..a2da7aedf208
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/pmu.h
@@ -0,0 +1,125 @@
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
new file mode 100644
index 000000000000..adc05e5f8378
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/serial.h
@@ -0,0 +1,37 @@
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
new file mode 100644
index 000000000000..645f1c5e568d
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/serial_l7200.h
@@ -0,0 +1,101 @@
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
new file mode 100644
index 000000000000..965728712cf3
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/sib.h
@@ -0,0 +1,119 @@
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
new file mode 100644
index 000000000000..2d7722be60ea
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/sys-clock.h
@@ -0,0 +1,67 @@
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_CLCOK_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
new file mode 100644
index 000000000000..5272abee0d0e
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/system.h
@@ -0,0 +1,29 @@
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)
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
new file mode 100644
index 000000000000..061771c2c2bd
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/time.h
@@ -0,0 +1,73 @@
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
new file mode 100644
index 000000000000..ffc96a63b5a2
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/timex.h
@@ -0,0 +1,20 @@
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
new file mode 100644
index 000000000000..591c962bb315
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/uncompress.h
@@ -0,0 +1,39 @@
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
new file mode 100644
index 000000000000..85f0abbf15f1
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/vmalloc.h
@@ -0,0 +1,4 @@
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/arch-kev7a400.c b/arch/arm/mach-lh7a40x/arch-kev7a400.c
index 2ef7d0097b38..551b97261826 100644
--- a/arch/arm/mach-lh7a40x/arch-kev7a400.c
+++ b/arch/arm/mach-lh7a40x/arch-kev7a400.c
@@ -13,7 +13,7 @@
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15 15
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/setup.h> 17#include <asm/setup.h>
18#include <asm/mach-types.h> 18#include <asm/mach-types.h>
19#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
index fe64946f9e18..e373fb8e2699 100644
--- a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
+++ b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
@@ -14,7 +14,7 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16 16
17#include <asm/hardware.h> 17#include <mach/hardware.h>
18#include <asm/setup.h> 18#include <asm/setup.h>
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-lh7a40x/clcd.c b/arch/arm/mach-lh7a40x/clcd.c
index 1992db4c2523..a2a543258fc3 100644
--- a/arch/arm/mach-lh7a40x/clcd.c
+++ b/arch/arm/mach-lh7a40x/clcd.c
@@ -17,14 +17,13 @@
17 17
18//#include <linux/module.h> 18//#include <linux/module.h>
19//#include <linux/time.h> 19//#include <linux/time.h>
20//#include <asm/hardware.h>
21 20
22//#include <asm/mach/time.h> 21//#include <asm/mach/time.h>
23#include <asm/irq.h> 22#include <asm/irq.h>
24#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
25 24
26#include <asm/system.h> 25#include <asm/system.h>
27#include <asm/hardware.h> 26#include <mach/hardware.h>
28#include <linux/amba/bus.h> 27#include <linux/amba/bus.h>
29#include <linux/amba/clcd.h> 28#include <linux/amba/clcd.h>
30 29
diff --git a/arch/arm/mach-lh7a40x/clocks.c b/arch/arm/mach-lh7a40x/clocks.c
index 7530a95c15a6..4fb23ac6b5ac 100644
--- a/arch/arm/mach-lh7a40x/clocks.c
+++ b/arch/arm/mach-lh7a40x/clocks.c
@@ -9,8 +9,8 @@
9 */ 9 */
10 10
11#include <linux/cpufreq.h> 11#include <linux/cpufreq.h>
12#include <asm/hardware.h> 12#include <mach/hardware.h>
13#include <asm/arch/clocks.h> 13#include <mach/clocks.h>
14#include <linux/err.h> 14#include <linux/err.h>
15 15
16struct module; 16struct module;
diff --git a/arch/arm/mach-lh7a40x/include/mach/clocks.h b/arch/arm/mach-lh7a40x/include/mach/clocks.h
new file mode 100644
index 000000000000..fe2e0255c084
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/clocks.h
@@ -0,0 +1,18 @@
1/* arch/arm/mach-lh7a40x/include/mach/clocks.h
2 *
3 * Copyright (C) 2004 Marc Singer
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 * version 2 as published by the Free Software Foundation.
8 *
9 */
10
11#ifndef __ASM_ARCH_CLOCKS_H
12#define __ASM_ARCH_CLOCKS_H
13
14unsigned int fclkfreq_get (void);
15unsigned int hclkfreq_get (void);
16unsigned int pclkfreq_get (void);
17
18#endif /* _ASM_ARCH_CLOCKS_H */
diff --git a/arch/arm/mach-lh7a40x/include/mach/constants.h b/arch/arm/mach-lh7a40x/include/mach/constants.h
new file mode 100644
index 000000000000..55c6edbc2dfd
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/constants.h
@@ -0,0 +1,91 @@
1/* arch/arm/mach-lh7a40x/include/mach/constants.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
4 * Copyright (C) 2004 Logic Product Development
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 */
11
12#ifndef __ASM_ARCH_CONSTANTS_H
13#define __ASM_ARCH_CONSTANTS_H
14
15
16/* Addressing constants */
17
18 /* SoC CPU IO addressing */
19#define IO_PHYS (0x80000000)
20#define IO_VIRT (0xf8000000)
21#define IO_SIZE (0x0000B000)
22
23#ifdef CONFIG_MACH_KEV7A400
24# define CPLD_PHYS (0x20000000)
25# define CPLD_VIRT (0xf2000000)
26# define CPLD_SIZE PAGE_SIZE
27#endif
28
29#if defined (CONFIG_MACH_LPD7A400) || defined (CONFIG_MACH_LPD7A404)
30
31# define IOBARRIER_PHYS 0x10000000 /* Second bank, fastest timing */
32# define IOBARRIER_VIRT 0xf0000000
33# define IOBARRIER_SIZE PAGE_SIZE
34
35# define CF_PHYS 0x60200000
36# define CF_VIRT 0xf6020000
37# define CF_SIZE (8*1024)
38
39 /* The IO mappings for the LPD CPLD are, unfortunately, sparse. */
40# define CPLDX_PHYS(x) (0x70000000 | ((x) << 20))
41# define CPLDX_VIRT(x) (0xf7000000 | ((x) << 16))
42# define CPLD00_PHYS CPLDX_PHYS (0x00) /* Wired LAN */
43# define CPLD00_VIRT CPLDX_VIRT (0x00)
44# define CPLD00_SIZE PAGE_SIZE
45# define CPLD02_PHYS CPLDX_PHYS (0x02)
46# define CPLD02_VIRT CPLDX_VIRT (0x02)
47# define CPLD02_SIZE PAGE_SIZE
48# define CPLD06_PHYS CPLDX_PHYS (0x06)
49# define CPLD06_VIRT CPLDX_VIRT (0x06)
50# define CPLD06_SIZE PAGE_SIZE
51# define CPLD08_PHYS CPLDX_PHYS (0x08)
52# define CPLD08_VIRT CPLDX_VIRT (0x08)
53# define CPLD08_SIZE PAGE_SIZE
54# define CPLD0A_PHYS CPLDX_PHYS (0x0a)
55# define CPLD0A_VIRT CPLDX_VIRT (0x0a)
56# define CPLD0A_SIZE PAGE_SIZE
57# define CPLD0C_PHYS CPLDX_PHYS (0x0c)
58# define CPLD0C_VIRT CPLDX_VIRT (0x0c)
59# define CPLD0C_SIZE PAGE_SIZE
60# define CPLD0E_PHYS CPLDX_PHYS (0x0e)
61# define CPLD0E_VIRT CPLDX_VIRT (0x0e)
62# define CPLD0E_SIZE PAGE_SIZE
63# define CPLD10_PHYS CPLDX_PHYS (0x10)
64# define CPLD10_VIRT CPLDX_VIRT (0x10)
65# define CPLD10_SIZE PAGE_SIZE
66# define CPLD12_PHYS CPLDX_PHYS (0x12)
67# define CPLD12_VIRT CPLDX_VIRT (0x12)
68# define CPLD12_SIZE PAGE_SIZE
69# define CPLD14_PHYS CPLDX_PHYS (0x14)
70# define CPLD14_VIRT CPLDX_VIRT (0x14)
71# define CPLD14_SIZE PAGE_SIZE
72# define CPLD16_PHYS CPLDX_PHYS (0x16)
73# define CPLD16_VIRT CPLDX_VIRT (0x16)
74# define CPLD16_SIZE PAGE_SIZE
75# define CPLD18_PHYS CPLDX_PHYS (0x18)
76# define CPLD18_VIRT CPLDX_VIRT (0x18)
77# define CPLD18_SIZE PAGE_SIZE
78# define CPLD1A_PHYS CPLDX_PHYS (0x1a)
79# define CPLD1A_VIRT CPLDX_VIRT (0x1a)
80# define CPLD1A_SIZE PAGE_SIZE
81#endif
82
83 /* Timing constants */
84
85#define XTAL_IN 14745600 /* 14.7456 MHz crystal */
86#define PLL_CLOCK (XTAL_IN * 21) /* 309 MHz PLL clock */
87#define MAX_HCLK_KHZ 100000 /* HCLK max limit ~100MHz */
88#define HCLK (99993600)
89//#define HCLK (119808000)
90
91#endif /* __ASM_ARCH_CONSTANTS_H */
diff --git a/arch/arm/mach-lh7a40x/include/mach/debug-macro.S b/arch/arm/mach-lh7a40x/include/mach/debug-macro.S
new file mode 100644
index 000000000000..85141ed5383d
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/debug-macro.S
@@ -0,0 +1,39 @@
1/* arch/arm/mach-lh7a40x/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 @ It is not known if this will be appropriate for every 40x
15 @ board.
16
17 .macro addruart,rx
18 mrc p15, 0, \rx, c1, c0
19 tst \rx, #1 @ MMU enabled?
20 mov \rx, #0x00000700 @ offset from base
21 orreq \rx, \rx, #0x80000000 @ physical base
22 orrne \rx, \rx, #0xf8000000 @ virtual base
23 .endm
24
25 .macro senduart,rd,rx
26 strb \rd, [\rx] @ DATA
27 .endm
28
29 .macro busyuart,rd,rx @ spin while busy
301001: ldr \rd, [\rx, #0x10] @ STATUS
31 tst \rd, #1 << 3 @ BUSY (TX FIFO not empty)
32 bne 1001b @ yes, spin
33 .endm
34
35 .macro waituart,rd,rx @ wait for Tx FIFO room
361001: ldrb \rd, [\rx, #0x10] @ STATUS
37 tst \rd, #1 << 5 @ TXFF (TX FIFO full)
38 bne 1001b @ yes, spin
39 .endm
diff --git a/arch/arm/mach-lh7a40x/include/mach/dma.h b/arch/arm/mach-lh7a40x/include/mach/dma.h
new file mode 100644
index 000000000000..baa3f8dbd04b
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/dma.h
@@ -0,0 +1,86 @@
1/* arch/arm/mach-lh7a40x/include/mach/dma.h
2 *
3 * Copyright (C) 2005 Marc Singer
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 * version 2 as published by the Free Software Foundation.
8 *
9 */
10
11typedef enum {
12 DMA_M2M0 = 0,
13 DMA_M2M1 = 1,
14 DMA_M2P0 = 2, /* Tx */
15 DMA_M2P1 = 3, /* Rx */
16 DMA_M2P2 = 4, /* Tx */
17 DMA_M2P3 = 5, /* Rx */
18 DMA_M2P4 = 6, /* Tx - AC97 */
19 DMA_M2P5 = 7, /* Rx - AC97 */
20 DMA_M2P6 = 8, /* Tx */
21 DMA_M2P7 = 9, /* Rx */
22} dma_device_t;
23
24#define DMA_LENGTH_MAX ((64*1024) - 4) /* bytes */
25
26#define DMAC_GCA __REG(DMAC_PHYS + 0x2b80)
27#define DMAC_GIR __REG(DMAC_PHYS + 0x2bc0)
28
29#define DMAC_GIR_MMI1 (1<<11)
30#define DMAC_GIR_MMI0 (1<<10)
31#define DMAC_GIR_MPI8 (1<<9)
32#define DMAC_GIR_MPI9 (1<<8)
33#define DMAC_GIR_MPI6 (1<<7)
34#define DMAC_GIR_MPI7 (1<<6)
35#define DMAC_GIR_MPI4 (1<<5)
36#define DMAC_GIR_MPI5 (1<<4)
37#define DMAC_GIR_MPI2 (1<<3)
38#define DMAC_GIR_MPI3 (1<<2)
39#define DMAC_GIR_MPI0 (1<<1)
40#define DMAC_GIR_MPI1 (1<<0)
41
42#define DMAC_M2P0 0x0000
43#define DMAC_M2P1 0x0040
44#define DMAC_M2P2 0x0080
45#define DMAC_M2P3 0x00c0
46#define DMAC_M2P4 0x0240
47#define DMAC_M2P5 0x0200
48#define DMAC_M2P6 0x02c0
49#define DMAC_M2P7 0x0280
50#define DMAC_M2P8 0x0340
51#define DMAC_M2P9 0x0300
52#define DMAC_M2M0 0x0100
53#define DMAC_M2M1 0x0140
54
55#define DMAC_P_PCONTROL(c) __REG(DMAC_PHYS + (c) + 0x00)
56#define DMAC_P_PINTERRUPT(c) __REG(DMAC_PHYS + (c) + 0x04)
57#define DMAC_P_PPALLOC(c) __REG(DMAC_PHYS + (c) + 0x08)
58#define DMAC_P_PSTATUS(c) __REG(DMAC_PHYS + (c) + 0x0c)
59#define DMAC_P_REMAIN(c) __REG(DMAC_PHYS + (c) + 0x14)
60#define DMAC_P_MAXCNT0(c) __REG(DMAC_PHYS + (c) + 0x20)
61#define DMAC_P_BASE0(c) __REG(DMAC_PHYS + (c) + 0x24)
62#define DMAC_P_CURRENT0(c) __REG(DMAC_PHYS + (c) + 0x28)
63#define DMAC_P_MAXCNT1(c) __REG(DMAC_PHYS + (c) + 0x30)
64#define DMAC_P_BASE1(c) __REG(DMAC_PHYS + (c) + 0x34)
65#define DMAC_P_CURRENT1(c) __REG(DMAC_PHYS + (c) + 0x38)
66
67#define DMAC_PCONTROL_ENABLE (1<<4)
68
69#define DMAC_PORT_USB 0
70#define DMAC_PORT_SDMMC 1
71#define DMAC_PORT_AC97_1 2
72#define DMAC_PORT_AC97_2 3
73#define DMAC_PORT_AC97_3 4
74#define DMAC_PORT_UART1 6
75#define DMAC_PORT_UART2 7
76#define DMAC_PORT_UART3 8
77
78#define DMAC_PSTATUS_CURRSTATE_SHIFT 4
79#define DMAC_PSTATUS_CURRSTATE_MASK 0x3
80
81#define DMAC_PSTATUS_NEXTBUF (1<<6)
82#define DMAC_PSTATUS_STALLRINT (1<<0)
83
84#define DMAC_INT_CHE (1<<3)
85#define DMAC_INT_NFB (1<<1)
86#define DMAC_INT_STALL (1<<0)
diff --git a/arch/arm/mach-lh7a40x/include/mach/entry-macro.S b/arch/arm/mach-lh7a40x/include/mach/entry-macro.S
new file mode 100644
index 000000000000..069bb4cefff7
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/entry-macro.S
@@ -0,0 +1,149 @@
1/*
2 * arch/arm/mach-lh7a40x/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for LH7A40x 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#include <mach/irqs.h>
12
13/* In order to allow there to be support for both of the processor
14 classes at the same time, we make a hack here that isn't very
15 pretty. At startup, the link pointed to with the
16 branch_irq_lh7a400 symbol is replaced with a NOP when the CPU is
17 detected as a lh7a404.
18
19 *** FIXME: we should clean this up so that there is only one
20 implementation for each CPU's design.
21
22*/
23
24#if defined (CONFIG_ARCH_LH7A400) && defined (CONFIG_ARCH_LH7A404)
25
26 .macro disable_fiq
27 .endm
28
29 .macro get_irqnr_preamble, base, tmp
30 .endm
31
32 .macro arch_ret_to_user, tmp1, tmp2
33 .endm
34
35 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
36
37branch_irq_lh7a400: b 1000f
38
39@ Implementation of the LH7A404 get_irqnr_and_base.
40
41 mov \irqnr, #0 @ VIC1 irq base
42 mov \base, #io_p2v(0x80000000) @ APB registers
43 add \base, \base, #0x8000
44 ldr \tmp, [\base, #0x0030] @ VIC1_VECTADDR
45 tst \tmp, #VA_VECTORED @ Direct vectored
46 bne 1002f
47 tst \tmp, #VA_VIC1DEFAULT @ Default vectored VIC1
48 ldrne \irqstat, [\base, #0] @ VIC1_IRQSTATUS
49 bne 1001f
50 add \base, \base, #(0xa000 - 0x8000)
51 ldr \tmp, [\base, #0x0030] @ VIC2_VECTADDR
52 tst \tmp, #VA_VECTORED @ Direct vectored
53 bne 1002f
54 ldr \irqstat, [\base, #0] @ VIC2_IRQSTATUS
55 mov \irqnr, #32 @ VIC2 irq base
56
571001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
58 bcs 1008f @ Bit set; irq found
59 add \irqnr, \irqnr, #1
60 bne 1001b @ Until no bits
61 b 1009f @ Nothing? Hmm.
621002: and \irqnr, \tmp, #0x3f @ Mask for valid bits
631008: movs \irqstat, #1 @ Force !Z
64 str \tmp, [\base, #0x0030] @ Clear vector
65 b 1009f
66
67@ Implementation of the LH7A400 get_irqnr_and_base.
68
691000: mov \irqnr, #0
70 mov \base, #io_p2v(0x80000000) @ APB registers
71 ldr \irqstat, [\base, #0x500] @ PIC INTSR
72
731001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
74 bcs 1008f @ Bit set; irq found
75 add \irqnr, \irqnr, #1
76 bne 1001b @ Until no bits
77 b 1009f @ Nothing? Hmm.
781008: movs \irqstat, #1 @ Force !Z
79
801009:
81 .endm
82
83
84
85#elif defined (CONFIG_ARCH_LH7A400)
86 .macro disable_fiq
87 .endm
88
89 .macro get_irqnr_preamble, base, tmp
90 .endm
91
92 .macro arch_ret_to_user, tmp1, tmp2
93 .endm
94
95 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
96 mov \irqnr, #0
97 mov \base, #io_p2v(0x80000000) @ APB registers
98 ldr \irqstat, [\base, #0x500] @ PIC INTSR
99
1001001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
101 bcs 1008f @ Bit set; irq found
102 add \irqnr, \irqnr, #1
103 bne 1001b @ Until no bits
104 b 1009f @ Nothing? Hmm.
1051008: movs \irqstat, #1 @ Force !Z
1061009:
107 .endm
108
109#elif defined(CONFIG_ARCH_LH7A404)
110
111 .macro disable_fiq
112 .endm
113
114 .macro get_irqnr_preamble, base, tmp
115 .endm
116
117 .macro arch_ret_to_user, tmp1, tmp2
118 .endm
119
120 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
121 mov \irqnr, #0 @ VIC1 irq base
122 mov \base, #io_p2v(0x80000000) @ APB registers
123 add \base, \base, #0x8000
124 ldr \tmp, [\base, #0x0030] @ VIC1_VECTADDR
125 tst \tmp, #VA_VECTORED @ Direct vectored
126 bne 1002f
127 tst \tmp, #VA_VIC1DEFAULT @ Default vectored VIC1
128 ldrne \irqstat, [\base, #0] @ VIC1_IRQSTATUS
129 bne 1001f
130 add \base, \base, #(0xa000 - 0x8000)
131 ldr \tmp, [\base, #0x0030] @ VIC2_VECTADDR
132 tst \tmp, #VA_VECTORED @ Direct vectored
133 bne 1002f
134 ldr \irqstat, [\base, #0] @ VIC2_IRQSTATUS
135 mov \irqnr, #32 @ VIC2 irq base
136
1371001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
138 bcs 1008f @ Bit set; irq found
139 add \irqnr, \irqnr, #1
140 bne 1001b @ Until no bits
141 b 1009f @ Nothing? Hmm.
1421002: and \irqnr, \tmp, #0x3f @ Mask for valid bits
1431008: movs \irqstat, #1 @ Force !Z
144 str \tmp, [\base, #0x0030] @ Clear vector
1451009:
146 .endm
147#endif
148
149
diff --git a/arch/arm/mach-lh7a40x/include/mach/hardware.h b/arch/arm/mach-lh7a40x/include/mach/hardware.h
new file mode 100644
index 000000000000..48e827d2fa56
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/hardware.h
@@ -0,0 +1,62 @@
1/* arch/arm/mach-lh7a40x/include/mach/hardware.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
4 *
5 * [ Substantially cribbed from arch/arm/mach-pxa/include/mach/hardware.h ]
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 * version 2 as published by the Free Software Foundation.
10 *
11 */
12
13#ifndef __ASM_ARCH_HARDWARE_H
14#define __ASM_ARCH_HARDWARE_H
15
16#include <asm/sizes.h> /* Added for the sake of amba-clcd driver */
17
18#define io_p2v(x) (0xf0000000 | (((x) & 0xfff00000) >> 4) | ((x) & 0x0000ffff))
19#define io_v2p(x) ( (((x) & 0x0fff0000) << 4) | ((x) & 0x0000ffff))
20
21#ifdef __ASSEMBLY__
22
23# define __REG(x) io_p2v(x)
24# define __PREG(x) io_v2p(x)
25
26#else
27
28# if 0
29# define __REG(x) (*((volatile u32 *)io_p2v(x)))
30# else
31/*
32 * This __REG() version gives the same results as the one above, except
33 * that we are fooling gcc somehow so it generates far better and smaller
34 * assembly code for access to contigous registers. It's a shame that gcc
35 * doesn't guess this by itself.
36 */
37#include <asm/types.h>
38typedef struct { volatile u32 offset[4096]; } __regbase;
39# define __REGP(x) ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2]
40# define __REG(x) __REGP(io_p2v(x))
41typedef struct { volatile u16 offset[4096]; } __regbase16;
42# define __REGP16(x) ((__regbase16 *)((x)&~4095))->offset[((x)&4095)>>1]
43# define __REG16(x) __REGP16(io_p2v(x))
44typedef struct { volatile u8 offset[4096]; } __regbase8;
45# define __REGP8(x) ((__regbase8 *)((x)&~4095))->offset[(x)&4095]
46# define __REG8(x) __REGP8(io_p2v(x))
47#endif
48
49/* Let's kick gcc's ass again... */
50# define __REG2(x,y) \
51 ( __builtin_constant_p(y) ? (__REG((x) + (y))) \
52 : (*(volatile u32 *)((u32)&__REG(x) + (y))) )
53
54# define __PREG(x) (io_v2p((u32)&(x)))
55
56#endif
57
58#define MASK_AND_SET(v,m,s) (v) = ((v)&~(m))|(s)
59
60#include "registers.h"
61
62#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-lh7a40x/include/mach/io.h b/arch/arm/mach-lh7a40x/include/mach/io.h
new file mode 100644
index 000000000000..031d26f9163c
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/io.h
@@ -0,0 +1,22 @@
1/* arch/arm/mach-lh7a40x/include/mach/io.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
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 * version 2 as published by the Free Software Foundation.
8 *
9 */
10
11#ifndef __ASM_ARCH_IO_H
12#define __ASM_ARCH_IO_H
13
14#include <mach/hardware.h>
15
16#define IO_SPACE_LIMIT 0xffffffff
17
18/* No ISA or PCI bus on this machine. */
19#define __io(a) ((void __iomem *)(a))
20#define __mem_pci(a) (a)
21
22#endif /* __ASM_ARCH_IO_H */
diff --git a/arch/arm/mach-lh7a40x/include/mach/irqs.h b/arch/arm/mach-lh7a40x/include/mach/irqs.h
new file mode 100644
index 000000000000..0f9b83675935
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/irqs.h
@@ -0,0 +1,200 @@
1/* arch/arm/mach-lh7a40x/include/mach/irqs.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
4 * Copyright (C) 2004 Logic Product Development
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 */
11
12/* It is to be seen whether or not we can build a kernel for more than
13 * one board. For the time being, these macros assume that we cannot.
14 * Thus, it is OK to ifdef machine/board specific IRQ assignments.
15 */
16
17
18#ifndef __ASM_ARCH_IRQS_H
19#define __ASM_ARCH_IRQS_H
20
21
22#define FIQ_START 80
23
24#if defined (CONFIG_ARCH_LH7A400)
25
26 /* FIQs */
27
28# define IRQ_GPIO0FIQ 0 /* GPIO External FIQ Interrupt on F0 */
29# define IRQ_BLINT 1 /* Battery Low */
30# define IRQ_WEINT 2 /* Watchdog Timer, WDT overflow */
31# define IRQ_MCINT 3 /* Media Change, MEDCHG pin rising */
32
33 /* IRQs */
34
35# define IRQ_CSINT 4 /* Audio Codec (ACI) */
36# define IRQ_GPIO1INTR 5 /* GPIO External IRQ Interrupt on F1 */
37# define IRQ_GPIO2INTR 6 /* GPIO External IRQ Interrupt on F2 */
38# define IRQ_GPIO3INTR 7 /* GPIO External IRQ Interrupt on F3 */
39# define IRQ_T1UI 8 /* Timer 1 underflow */
40# define IRQ_T2UI 9 /* Timer 2 underflow */
41# define IRQ_RTCMI 10
42# define IRQ_TINTR 11 /* Clock State Controller 64 Hz tick (CSC) */
43# define IRQ_UART1INTR 12
44# define IRQ_UART2INTR 13
45# define IRQ_LCDINTR 14
46# define IRQ_SSIEOT 15 /* Synchronous Serial Interface (SSI) */
47# define IRQ_UART3INTR 16
48# define IRQ_SCIINTR 17 /* Smart Card Interface (SCI) */
49# define IRQ_AACINTR 18 /* Advanced Audio Codec (AAC) */
50# define IRQ_MMCINTR 19 /* Multimedia Card (MMC) */
51# define IRQ_USBINTR 20
52# define IRQ_DMAINTR 21
53# define IRQ_T3UI 22 /* Timer 3 underflow */
54# define IRQ_GPIO4INTR 23 /* GPIO External IRQ Interrupt on F4 */
55# define IRQ_GPIO5INTR 24 /* GPIO External IRQ Interrupt on F5 */
56# define IRQ_GPIO6INTR 25 /* GPIO External IRQ Interrupt on F6 */
57# define IRQ_GPIO7INTR 26 /* GPIO External IRQ Interrupt on F7 */
58# define IRQ_BMIINTR 27 /* Battery Monitor Interface (BMI) */
59
60# define NR_IRQ_CPU 28 /* IRQs directly recognized by CPU */
61
62 /* Given IRQ, return GPIO interrupt number 0-7 */
63# define IRQ_TO_GPIO(i) ((i) \
64 - (((i) > IRQ_GPIO3INTR) ? IRQ_GPIO4INTR - IRQ_GPIO3INTR - 1 : 0)\
65 - (((i) > IRQ_GPIO0INTR) ? IRQ_GPIO1INTR - IRQ_GPIO0INTR - 1 : 0))
66
67#endif
68
69#if defined (CONFIG_ARCH_LH7A404)
70
71# define IRQ_BROWN 0 /* Brownout */
72# define IRQ_WDTINTR 1 /* Watchdog Timer */
73# define IRQ_COMMRX 2 /* ARM Comm Rx for Debug */
74# define IRQ_COMMTX 3 /* ARM Comm Tx for Debug */
75# define IRQ_T1UI 4 /* Timer 1 underflow */
76# define IRQ_T2UI 5 /* Timer 2 underflow */
77# define IRQ_CSINT 6 /* Codec Interrupt (shared by AAC on 404) */
78# define IRQ_DMAM2P0 7 /* -- DMA Memory to Peripheral */
79# define IRQ_DMAM2P1 8
80# define IRQ_DMAM2P2 9
81# define IRQ_DMAM2P3 10
82# define IRQ_DMAM2P4 11
83# define IRQ_DMAM2P5 12
84# define IRQ_DMAM2P6 13
85# define IRQ_DMAM2P7 14
86# define IRQ_DMAM2P8 15
87# define IRQ_DMAM2P9 16
88# define IRQ_DMAM2M0 17 /* -- DMA Memory to Memory */
89# define IRQ_DMAM2M1 18
90# define IRQ_GPIO0INTR 19 /* -- GPIOF Interrupt */
91# define IRQ_GPIO1INTR 20
92# define IRQ_GPIO2INTR 21
93# define IRQ_GPIO3INTR 22
94# define IRQ_SOFT_V1_23 23 /* -- Unassigned */
95# define IRQ_SOFT_V1_24 24
96# define IRQ_SOFT_V1_25 25
97# define IRQ_SOFT_V1_26 26
98# define IRQ_SOFT_V1_27 27
99# define IRQ_SOFT_V1_28 28
100# define IRQ_SOFT_V1_29 29
101# define IRQ_SOFT_V1_30 30
102# define IRQ_SOFT_V1_31 31
103
104# define IRQ_BLINT 32 /* Battery Low */
105# define IRQ_BMIINTR 33 /* Battery Monitor */
106# define IRQ_MCINTR 34 /* Media Change */
107# define IRQ_TINTR 35 /* 64Hz Tick */
108# define IRQ_WEINT 36 /* Watchdog Expired */
109# define IRQ_RTCMI 37 /* Real-time Clock Match */
110# define IRQ_UART1INTR 38 /* UART1 Interrupt (including error) */
111# define IRQ_UART1ERR 39 /* UART1 Error */
112# define IRQ_UART2INTR 40 /* UART2 Interrupt (including error) */
113# define IRQ_UART2ERR 41 /* UART2 Error */
114# define IRQ_UART3INTR 42 /* UART3 Interrupt (including error) */
115# define IRQ_UART3ERR 43 /* UART3 Error */
116# define IRQ_SCIINTR 44 /* Smart Card */
117# define IRQ_TSCINTR 45 /* Touchscreen */
118# define IRQ_KMIINTR 46 /* Keyboard/Mouse (PS/2) */
119# define IRQ_GPIO4INTR 47 /* -- GPIOF Interrupt */
120# define IRQ_GPIO5INTR 48
121# define IRQ_GPIO6INTR 49
122# define IRQ_GPIO7INTR 50
123# define IRQ_T3UI 51 /* Timer 3 underflow */
124# define IRQ_LCDINTR 52 /* LCD Controller */
125# define IRQ_SSPINTR 53 /* Synchronous Serial Port */
126# define IRQ_SDINTR 54 /* Secure Digital Port (MMC) */
127# define IRQ_USBINTR 55 /* USB Device Port */
128# define IRQ_USHINTR 56 /* USB Host Port */
129# define IRQ_SOFT_V2_25 57 /* -- Unassigned */
130# define IRQ_SOFT_V2_26 58
131# define IRQ_SOFT_V2_27 59
132# define IRQ_SOFT_V2_28 60
133# define IRQ_SOFT_V2_29 61
134# define IRQ_SOFT_V2_30 62
135# define IRQ_SOFT_V2_31 63
136
137# define NR_IRQ_CPU 64 /* IRQs directly recognized by CPU */
138
139 /* Given IRQ, return GPIO interrupt number 0-7 */
140# define IRQ_TO_GPIO(i) ((i) \
141 - (((i) > IRQ_GPIO3INTR) ? IRQ_GPIO4INTR - IRQ_GPIO3INTR - 1 : 0)\
142 - IRQ_GPIO0INTR)
143
144 /* Vector Address constants */
145# define VA_VECTORED 0x100 /* Set for vectored interrupt */
146# define VA_VIC1DEFAULT 0x200 /* Set as default VECTADDR for VIC1 */
147# define VA_VIC2DEFAULT 0x400 /* Set as default VECTADDR for VIC2 */
148
149#endif
150
151 /* IRQ aliases */
152
153#if !defined (IRQ_GPIO0INTR)
154# define IRQ_GPIO0INTR IRQ_GPIO0FIQ
155#endif
156#define IRQ_TICK IRQ_TINTR
157#define IRQ_PCC1_RDY IRQ_GPIO6INTR /* PCCard 1 ready */
158#define IRQ_PCC2_RDY IRQ_GPIO7INTR /* PCCard 2 ready */
159#define IRQ_USB IRQ_USBINTR /* USB device */
160
161#ifdef CONFIG_MACH_KEV7A400
162# define IRQ_TS IRQ_GPIOFIQ /* Touchscreen */
163# define IRQ_CPLD IRQ_GPIO1INTR /* CPLD cascade */
164# define IRQ_PCC1_CD IRQ_GPIO_F2 /* PCCard 1 card detect */
165# define IRQ_PCC2_CD IRQ_GPIO_F3 /* PCCard 2 card detect */
166#endif
167
168#if defined (CONFIG_MACH_LPD7A400) || defined (CONFIG_MACH_LPD7A404)
169# define IRQ_CPLD_V28 IRQ_GPIO7INTR /* CPLD cascade through GPIO_PF7 */
170# define IRQ_CPLD_V34 IRQ_GPIO3INTR /* CPLD cascade through GPIO_PF3 */
171#endif
172
173 /* System specific IRQs */
174
175#define IRQ_BOARD_START NR_IRQ_CPU
176
177#ifdef CONFIG_MACH_KEV7A400
178# define IRQ_KEV7A400_CPLD IRQ_BOARD_START
179# define NR_IRQ_BOARD 5
180# define IRQ_KEV7A400_MMC_CD IRQ_KEV7A400_CPLD + 0 /* MMC Card Detect */
181# define IRQ_KEV7A400_RI2 IRQ_KEV7A400_CPLD + 1 /* Ring Indicator 2 */
182# define IRQ_KEV7A400_IDE_CF IRQ_KEV7A400_CPLD + 2 /* Compact Flash (?) */
183# define IRQ_KEV7A400_ETH_INT IRQ_KEV7A400_CPLD + 3 /* Ethernet chip */
184# define IRQ_KEV7A400_INT IRQ_KEV7A400_CPLD + 4
185#endif
186
187#if defined (CONFIG_MACH_LPD7A400) || defined (CONFIG_MACH_LPD7A404)
188# define IRQ_LPD7A40X_CPLD IRQ_BOARD_START
189# define NR_IRQ_BOARD 2
190# define IRQ_LPD7A40X_ETH_INT IRQ_LPD7A40X_CPLD + 0 /* Ethernet chip */
191# define IRQ_LPD7A400_TS IRQ_LPD7A40X_CPLD + 1 /* Touch screen */
192#endif
193
194#if defined (CONFIG_MACH_LPD7A400)
195# define IRQ_TOUCH IRQ_LPD7A400_TS
196#endif
197
198#define NR_IRQS (NR_IRQ_CPU + NR_IRQ_BOARD)
199
200#endif
diff --git a/arch/arm/mach-lh7a40x/include/mach/memory.h b/arch/arm/mach-lh7a40x/include/mach/memory.h
new file mode 100644
index 000000000000..f7107b4c197a
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/memory.h
@@ -0,0 +1,76 @@
1/* arch/arm/mach-lh7a40x/include/mach/memory.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
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 * version 2 as published by the Free Software Foundation.
8 *
9 *
10 * Refer to <file:Documentation/arm/Sharp-LH/SDRAM> for more information.
11 *
12 */
13
14#ifndef __ASM_ARCH_MEMORY_H
15#define __ASM_ARCH_MEMORY_H
16
17/*
18 * Physical DRAM offset.
19 */
20#define PHYS_OFFSET UL(0xc0000000)
21
22/*
23 * Virtual view <-> DMA view memory address translations
24 * virt_to_bus: Used to translate the virtual address to an
25 * address suitable to be passed to set_dma_addr
26 * bus_to_virt: Used to convert an address for DMA operations
27 * to an address that the kernel can use.
28 */
29#define __virt_to_bus(x) __virt_to_phys(x)
30#define __bus_to_virt(x) __phys_to_virt(x)
31
32#ifdef CONFIG_DISCONTIGMEM
33
34/*
35 * Given a kernel address, find the home node of the underlying memory.
36 */
37
38# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
39# define KVADDR_TO_NID(addr) \
40 ( ((((unsigned long) (addr) - PAGE_OFFSET) >> 24) & 1)\
41 | ((((unsigned long) (addr) - PAGE_OFFSET) >> 25) & ~1))
42# else /* 2 banks per node */
43# define KVADDR_TO_NID(addr) \
44 (((unsigned long) (addr) - PAGE_OFFSET) >> 26)
45# endif
46
47/*
48 * Given a page frame number, convert it to a node id.
49 */
50
51# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
52# define PFN_TO_NID(pfn) \
53 (((((pfn) - PHYS_PFN_OFFSET) >> (24 - PAGE_SHIFT)) & 1)\
54 | ((((pfn) - PHYS_PFN_OFFSET) >> (25 - PAGE_SHIFT)) & ~1))
55# else /* 2 banks per node */
56# define PFN_TO_NID(pfn) \
57 (((pfn) - PHYS_PFN_OFFSET) >> (26 - PAGE_SHIFT))
58#endif
59
60/*
61 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
62 * and returns the index corresponding to the appropriate page in the
63 * node's mem_map.
64 */
65
66# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
67# define LOCAL_MAP_NR(addr) \
68 (((unsigned long)(addr) & 0x003fffff) >> PAGE_SHIFT)
69# else /* 2 banks per node */
70# define LOCAL_MAP_NR(addr) \
71 (((unsigned long)(addr) & 0x01ffffff) >> PAGE_SHIFT)
72# endif
73
74#endif
75
76#endif
diff --git a/arch/arm/mach-lh7a40x/include/mach/registers.h b/arch/arm/mach-lh7a40x/include/mach/registers.h
new file mode 100644
index 000000000000..ea44396383a7
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/registers.h
@@ -0,0 +1,224 @@
1/* arch/arm/mach-lh7a40x/include/mach/registers.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
4 * Copyright (C) 2004 Logic Product Development
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 */
11
12#include <mach/constants.h>
13
14#ifndef __ASM_ARCH_REGISTERS_H
15#define __ASM_ARCH_REGISTERS_H
16
17
18 /* Physical register base addresses */
19
20#define AC97C_PHYS (0x80000000) /* AC97 Controller */
21#define MMC_PHYS (0x80000100) /* Multimedia Card Controller */
22#define USB_PHYS (0x80000200) /* USB Client */
23#define SCI_PHYS (0x80000300) /* Secure Card Interface */
24#define CSC_PHYS (0x80000400) /* Clock/State Controller */
25#define INTC_PHYS (0x80000500) /* Interrupt Controller */
26#define UART1_PHYS (0x80000600) /* UART1 Controller */
27#define SIR_PHYS (0x80000600) /* IR Controller, same are UART1 */
28#define UART2_PHYS (0x80000700) /* UART2 Controller */
29#define UART3_PHYS (0x80000800) /* UART3 Controller */
30#define DCDC_PHYS (0x80000900) /* DC to DC Controller */
31#define ACI_PHYS (0x80000a00) /* Audio Codec Interface */
32#define SSP_PHYS (0x80000b00) /* Synchronous ... */
33#define TIMER_PHYS (0x80000c00) /* Timer Controller */
34#define RTC_PHYS (0x80000d00) /* Real-time Clock */
35#define GPIO_PHYS (0x80000e00) /* General Purpose IO */
36#define BMI_PHYS (0x80000f00) /* Battery Monitor Interface */
37#define HRTFTC_PHYS (0x80001000) /* High-res TFT Controller (LH7A400) */
38#define ALI_PHYS (0x80001000) /* Advanced LCD Interface (LH7A404) */
39#define WDT_PHYS (0x80001400) /* Watchdog Timer */
40#define SMC_PHYS (0x80002000) /* Static Memory Controller */
41#define SDRC_PHYS (0x80002400) /* SDRAM Controller */
42#define DMAC_PHYS (0x80002800) /* DMA Controller */
43#define CLCDC_PHYS (0x80003000) /* Color LCD Controller */
44
45 /* Physical registers of the LH7A404 */
46
47#define ADC_PHYS (0x80001300) /* A/D & Touchscreen Controller */
48#define VIC1_PHYS (0x80008000) /* Vectored Interrupt Controller 1 */
49#define USBH_PHYS (0x80009000) /* USB OHCI host controller */
50#define VIC2_PHYS (0x8000a000) /* Vectored Interrupt Controller 2 */
51
52/*#define KBD_PHYS (0x80000e00) */
53/*#define LCDICP_PHYS (0x80001000) */
54
55
56 /* Clock/State Controller register */
57
58#define CSC_PWRSR __REG(CSC_PHYS + 0x00) /* Reset register & ID */
59#define CSC_PWRCNT __REG(CSC_PHYS + 0x04) /* Power control */
60#define CSC_CLKSET __REG(CSC_PHYS + 0x20) /* Clock speed control */
61#define CSC_USBDRESET __REG(CSC_PHYS + 0x4c) /* USB Device resets */
62
63#define CSC_PWRCNT_USBH_EN (1<<28) /* USB Host power enable */
64#define CSC_PWRCNT_DMAC_M2M1_EN (1<<27)
65#define CSC_PWRCNT_DMAC_M2M0_EN (1<<26)
66#define CSC_PWRCNT_DMAC_M2P8_EN (1<<25)
67#define CSC_PWRCNT_DMAC_M2P9_EN (1<<24)
68#define CSC_PWRCNT_DMAC_M2P6_EN (1<<23)
69#define CSC_PWRCNT_DMAC_M2P7_EN (1<<22)
70#define CSC_PWRCNT_DMAC_M2P4_EN (1<<21)
71#define CSC_PWRCNT_DMAC_M2P5_EN (1<<20)
72#define CSC_PWRCNT_DMAC_M2P2_EN (1<<19)
73#define CSC_PWRCNT_DMAC_M2P3_EN (1<<18)
74#define CSC_PWRCNT_DMAC_M2P0_EN (1<<17)
75#define CSC_PWRCNT_DMAC_M2P1_EN (1<<16)
76
77#define CSC_PWRSR_CHIPMAN_SHIFT (24)
78#define CSC_PWRSR_CHIPMAN_MASK (0xff)
79#define CSC_PWRSR_CHIPID_SHIFT (16)
80#define CSC_PWRSR_CHIPID_MASK (0xff)
81
82#define CSC_USBDRESET_APBRESETREG (1<<1)
83#define CSC_USBDRESET_IORESETREG (1<<0)
84
85 /* Interrupt Controller registers */
86
87#define INTC_INTSR __REG(INTC_PHYS + 0x00) /* Status */
88#define INTC_INTRSR __REG(INTC_PHYS + 0x04) /* Raw Status */
89#define INTC_INTENS __REG(INTC_PHYS + 0x08) /* Enable Set */
90#define INTC_INTENC __REG(INTC_PHYS + 0x0c) /* Enable Clear */
91
92
93 /* Vectored Interrupted Controller registers */
94
95#define VIC1_IRQSTATUS __REG(VIC1_PHYS + 0x00)
96#define VIC1_FIQSTATUS __REG(VIC1_PHYS + 0x04)
97#define VIC1_RAWINTR __REG(VIC1_PHYS + 0x08)
98#define VIC1_INTSEL __REG(VIC1_PHYS + 0x0c)
99#define VIC1_INTEN __REG(VIC1_PHYS + 0x10)
100#define VIC1_INTENCLR __REG(VIC1_PHYS + 0x14)
101#define VIC1_SOFTINT __REG(VIC1_PHYS + 0x18)
102#define VIC1_SOFTINTCLR __REG(VIC1_PHYS + 0x1c)
103#define VIC1_PROTECT __REG(VIC1_PHYS + 0x20)
104#define VIC1_VECTADDR __REG(VIC1_PHYS + 0x30)
105#define VIC1_NVADDR __REG(VIC1_PHYS + 0x34)
106#define VIC1_VAD0 __REG(VIC1_PHYS + 0x100)
107#define VIC1_VECTCNTL0 __REG(VIC1_PHYS + 0x200)
108#define VIC2_IRQSTATUS __REG(VIC2_PHYS + 0x00)
109#define VIC2_FIQSTATUS __REG(VIC2_PHYS + 0x04)
110#define VIC2_RAWINTR __REG(VIC2_PHYS + 0x08)
111#define VIC2_INTSEL __REG(VIC2_PHYS + 0x0c)
112#define VIC2_INTEN __REG(VIC2_PHYS + 0x10)
113#define VIC2_INTENCLR __REG(VIC2_PHYS + 0x14)
114#define VIC2_SOFTINT __REG(VIC2_PHYS + 0x18)
115#define VIC2_SOFTINTCLR __REG(VIC2_PHYS + 0x1c)
116#define VIC2_PROTECT __REG(VIC2_PHYS + 0x20)
117#define VIC2_VECTADDR __REG(VIC2_PHYS + 0x30)
118#define VIC2_NVADDR __REG(VIC2_PHYS + 0x34)
119#define VIC2_VAD0 __REG(VIC2_PHYS + 0x100)
120#define VIC2_VECTCNTL0 __REG(VIC2_PHYS + 0x200)
121
122#define VIC_CNTL_ENABLE (0x20)
123
124 /* USB Host registers (Open HCI compatible) */
125
126#define USBH_CMDSTATUS __REG(USBH_PHYS + 0x08)
127
128
129 /* GPIO registers */
130
131#define GPIO_INTTYPE1 __REG(GPIO_PHYS + 0x4c) /* Interrupt Type 1 (Edge) */
132#define GPIO_INTTYPE2 __REG(GPIO_PHYS + 0x50) /* Interrupt Type 2 */
133#define GPIO_GPIOFEOI __REG(GPIO_PHYS + 0x54) /* GPIO End-of-Interrupt */
134#define GPIO_GPIOINTEN __REG(GPIO_PHYS + 0x58) /* GPIO Interrupt Enable */
135#define GPIO_INTSTATUS __REG(GPIO_PHYS + 0x5c) /* GPIO Interrupt Status */
136#define GPIO_PINMUX __REG(GPIO_PHYS + 0x2c)
137#define GPIO_PADD __REG(GPIO_PHYS + 0x10)
138#define GPIO_PAD __REG(GPIO_PHYS + 0x00)
139#define GPIO_PCD __REG(GPIO_PHYS + 0x08)
140#define GPIO_PCDD __REG(GPIO_PHYS + 0x18)
141#define GPIO_PEDD __REG(GPIO_PHYS + 0x24)
142#define GPIO_PED __REG(GPIO_PHYS + 0x20)
143
144
145 /* Static Memory Controller registers */
146
147#define SMC_BCR0 __REG(SMC_PHYS + 0x00) /* Bank 0 Configuration */
148#define SMC_BCR1 __REG(SMC_PHYS + 0x04) /* Bank 1 Configuration */
149#define SMC_BCR2 __REG(SMC_PHYS + 0x08) /* Bank 2 Configuration */
150#define SMC_BCR3 __REG(SMC_PHYS + 0x0C) /* Bank 3 Configuration */
151#define SMC_BCR6 __REG(SMC_PHYS + 0x18) /* Bank 6 Configuration */
152#define SMC_BCR7 __REG(SMC_PHYS + 0x1c) /* Bank 7 Configuration */
153
154
155#ifdef CONFIG_MACH_KEV7A400
156# define CPLD_RD_OPT_DIP_SW __REG16(CPLD_PHYS + 0x00) /* Read Option SW */
157# define CPLD_WR_IO_BRD_CTL __REG16(CPLD_PHYS + 0x00) /* Write Control */
158# define CPLD_RD_PB_KEYS __REG16(CPLD_PHYS + 0x02) /* Read Btn Keys */
159# define CPLD_LATCHED_INTS __REG16(CPLD_PHYS + 0x04) /* Read INTR stat. */
160# define CPLD_CL_INT __REG16(CPLD_PHYS + 0x04) /* Clear INTR stat */
161# define CPLD_BOOT_MMC_STATUS __REG16(CPLD_PHYS + 0x06) /* R/O */
162# define CPLD_RD_KPD_ROW_SENSE __REG16(CPLD_PHYS + 0x08)
163# define CPLD_WR_PB_INT_MASK __REG16(CPLD_PHYS + 0x08)
164# define CPLD_RD_BRD_DISP_SW __REG16(CPLD_PHYS + 0x0a)
165# define CPLD_WR_EXT_INT_MASK __REG16(CPLD_PHYS + 0x0a)
166# define CPLD_LCD_PWR_CNTL __REG16(CPLD_PHYS + 0x0c)
167# define CPLD_SEVEN_SEG __REG16(CPLD_PHYS + 0x0e) /* 7 seg. LED mask */
168
169#endif
170
171#if defined (CONFIG_MACH_LPD7A400) || defined (CONFIG_MACH_LPD7A404)
172
173# define CPLD_CONTROL __REG16(CPLD02_PHYS)
174# define CPLD_SPI_DATA __REG16(CPLD06_PHYS)
175# define CPLD_SPI_CONTROL __REG16(CPLD08_PHYS)
176# define CPLD_SPI_EEPROM __REG16(CPLD0A_PHYS)
177# define CPLD_INTERRUPTS __REG16(CPLD0C_PHYS) /* IRQ mask/status */
178# define CPLD_BOOT_MODE __REG16(CPLD0E_PHYS)
179# define CPLD_FLASH __REG16(CPLD10_PHYS)
180# define CPLD_POWER_MGMT __REG16(CPLD12_PHYS)
181# define CPLD_REVISION __REG16(CPLD14_PHYS)
182# define CPLD_GPIO_EXT __REG16(CPLD16_PHYS)
183# define CPLD_GPIO_DATA __REG16(CPLD18_PHYS)
184# define CPLD_GPIO_DIR __REG16(CPLD1A_PHYS)
185
186#endif
187
188 /* Timer registers */
189
190#define TIMER_LOAD1 __REG(TIMER_PHYS + 0x00) /* Timer 1 initial value */
191#define TIMER_VALUE1 __REG(TIMER_PHYS + 0x04) /* Timer 1 current value */
192#define TIMER_CONTROL1 __REG(TIMER_PHYS + 0x08) /* Timer 1 control word */
193#define TIMER_EOI1 __REG(TIMER_PHYS + 0x0c) /* Timer 1 interrupt clear */
194
195#define TIMER_LOAD2 __REG(TIMER_PHYS + 0x20) /* Timer 2 initial value */
196#define TIMER_VALUE2 __REG(TIMER_PHYS + 0x24) /* Timer 2 current value */
197#define TIMER_CONTROL2 __REG(TIMER_PHYS + 0x28) /* Timer 2 control word */
198#define TIMER_EOI2 __REG(TIMER_PHYS + 0x2c) /* Timer 2 interrupt clear */
199
200#define TIMER_BUZZCON __REG(TIMER_PHYS + 0x40) /* Buzzer configuration */
201
202#define TIMER_LOAD3 __REG(TIMER_PHYS + 0x80) /* Timer 3 initial value */
203#define TIMER_VALUE3 __REG(TIMER_PHYS + 0x84) /* Timer 3 current value */
204#define TIMER_CONTROL3 __REG(TIMER_PHYS + 0x88) /* Timer 3 control word */
205#define TIMER_EOI3 __REG(TIMER_PHYS + 0x8c) /* Timer 3 interrupt clear */
206
207#define TIMER_C_ENABLE (1<<7)
208#define TIMER_C_PERIODIC (1<<6)
209#define TIMER_C_FREERUNNING (0)
210#define TIMER_C_2KHZ (0x00) /* 1.986 kHz */
211#define TIMER_C_508KHZ (0x08)
212
213 /* GPIO registers */
214
215#define GPIO_PFDD __REG(GPIO_PHYS + 0x34) /* PF direction */
216#define GPIO_INTTYPE1 __REG(GPIO_PHYS + 0x4c) /* IRQ edge or lvl */
217#define GPIO_INTTYPE2 __REG(GPIO_PHYS + 0x50) /* IRQ activ hi/lo */
218#define GPIO_GPIOFEOI __REG(GPIO_PHYS + 0x54) /* GPIOF end of IRQ */
219#define GPIO_GPIOFINTEN __REG(GPIO_PHYS + 0x58) /* GPIOF IRQ enable */
220#define GPIO_INTSTATUS __REG(GPIO_PHYS + 0x5c) /* GPIOF IRQ latch */
221#define GPIO_RAWINTSTATUS __REG(GPIO_PHYS + 0x60) /* GPIOF IRQ raw */
222
223
224#endif /* _ASM_ARCH_REGISTERS_H */
diff --git a/arch/arm/mach-lh7a40x/include/mach/ssp.h b/arch/arm/mach-lh7a40x/include/mach/ssp.h
new file mode 100644
index 000000000000..132b1c4d5ce6
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/ssp.h
@@ -0,0 +1,71 @@
1/* ssp.h
2 $Id$
3
4 written by Marc Singer
5 6 Dec 2004
6
7 Copyright (C) 2004 Marc Singer
8
9 -----------
10 DESCRIPTION
11 -----------
12
13 This SSP header is available throughout the kernel, for this
14 machine/architecture, because drivers that use it may be dispersed.
15
16 This file was cloned from the 7952x implementation. It would be
17 better to share them, but we're taking an easier approach for the
18 time being.
19
20*/
21
22#if !defined (__SSP_H__)
23# define __SSP_H__
24
25/* ----- Includes */
26
27/* ----- Types */
28
29struct ssp_driver {
30 int (*init) (void);
31 void (*exit) (void);
32 void (*acquire) (void);
33 void (*release) (void);
34 int (*configure) (int device, int mode, int speed,
35 int frame_size_write, int frame_size_read);
36 void (*chip_select) (int enable);
37 void (*set_callbacks) (void* handle,
38 irqreturn_t (*callback_tx)(void*),
39 irqreturn_t (*callback_rx)(void*));
40 void (*enable) (void);
41 void (*disable) (void);
42// int (*save_state) (void*);
43// void (*restore_state) (void*);
44 int (*read) (void);
45 int (*write) (u16 data);
46 int (*write_read) (u16 data);
47 void (*flush) (void);
48 void (*write_async) (void* pv, size_t cb);
49 size_t (*write_pos) (void);
50};
51
52 /* These modes are only available on the LH79524 */
53#define SSP_MODE_SPI (1)
54#define SSP_MODE_SSI (2)
55#define SSP_MODE_MICROWIRE (3)
56#define SSP_MODE_I2S (4)
57
58 /* CPLD SPI devices */
59#define DEVICE_EEPROM 0 /* Configuration eeprom */
60#define DEVICE_MAC 1 /* MAC eeprom (LPD79524) */
61#define DEVICE_CODEC 2 /* Audio codec */
62#define DEVICE_TOUCH 3 /* Touch screen (LPD79520) */
63
64/* ----- Globals */
65
66/* ----- Prototypes */
67
68//extern struct ssp_driver lh79520_i2s_driver;
69extern struct ssp_driver lh7a400_cpld_ssp_driver;
70
71#endif /* __SSP_H__ */
diff --git a/arch/arm/mach-lh7a40x/include/mach/system.h b/arch/arm/mach-lh7a40x/include/mach/system.h
new file mode 100644
index 000000000000..fa46bb1ef07b
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/system.h
@@ -0,0 +1,19 @@
1/* arch/arm/mach-lh7a40x/include/mach/system.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
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 * version 2 as published by the Free Software Foundation.
8 *
9 */
10
11static inline void arch_idle(void)
12{
13 cpu_do_idle ();
14}
15
16static inline void arch_reset(char mode)
17{
18 cpu_reset (0);
19}
diff --git a/arch/arm/mach-lh7a40x/include/mach/timex.h b/arch/arm/mach-lh7a40x/include/mach/timex.h
new file mode 100644
index 000000000000..08028cef1b3b
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/timex.h
@@ -0,0 +1,17 @@
1/* arch/arm/mach-lh7a40x/include/mach/timex.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
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 * version 2 as published by the Free Software Foundation.
8 *
9 */
10
11#include <mach/constants.h>
12
13#define CLOCK_TICK_RATE (PLL_CLOCK/6/16)
14
15/*
16#define CLOCK_TICK_RATE 3686400
17*/
diff --git a/arch/arm/mach-lh7a40x/include/mach/uncompress.h b/arch/arm/mach-lh7a40x/include/mach/uncompress.h
new file mode 100644
index 000000000000..55b80d479eb4
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/uncompress.h
@@ -0,0 +1,38 @@
1/* arch/arm/mach-lh7a40x/include/mach/uncompress.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
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 * version 2 as published by the Free Software Foundation.
8 *
9 */
10
11#include <mach/registers.h>
12
13#ifndef UART_R_DATA
14# define UART_R_DATA (0x00)
15#endif
16#ifndef UART_R_STATUS
17# define UART_R_STATUS (0x10)
18#endif
19#define nTxRdy (0x20) /* Not TxReady (literally Tx FIFO full) */
20
21 /* Access UART with physical addresses before MMU is setup */
22#define UART_STATUS (*(volatile unsigned long*) (UART2_PHYS + UART_R_STATUS))
23#define UART_DATA (*(volatile unsigned long*) (UART2_PHYS + UART_R_DATA))
24
25static inline void putc(int ch)
26{
27 while (UART_STATUS & nTxRdy)
28 barrier();
29 UART_DATA = ch;
30}
31
32static inline void flush(void)
33{
34}
35
36 /* NULL functions; we don't presently need them */
37#define arch_decomp_setup()
38#define arch_decomp_wdog()
diff --git a/arch/arm/mach-lh7a40x/include/mach/vmalloc.h b/arch/arm/mach-lh7a40x/include/mach/vmalloc.h
new file mode 100644
index 000000000000..3fbd49490bb9
--- /dev/null
+++ b/arch/arm/mach-lh7a40x/include/mach/vmalloc.h
@@ -0,0 +1,10 @@
1/* arch/arm/mach-lh7a40x/include/mach/vmalloc.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
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 * version 2 as published by the Free Software Foundation.
8 *
9 */
10#define VMALLOC_END (0xe8000000)
diff --git a/arch/arm/mach-lh7a40x/irq-lh7a400.c b/arch/arm/mach-lh7a40x/irq-lh7a400.c
index 9472bbebd8ab..1ad3afcf6b3d 100644
--- a/arch/arm/mach-lh7a40x/irq-lh7a400.c
+++ b/arch/arm/mach-lh7a40x/irq-lh7a400.c
@@ -12,10 +12,10 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14 14
15#include <asm/hardware.h> 15#include <mach/hardware.h>
16#include <asm/irq.h> 16#include <asm/irq.h>
17#include <asm/mach/irq.h> 17#include <asm/mach/irq.h>
18#include <asm/arch/irqs.h> 18#include <mach/irqs.h>
19 19
20#include "common.h" 20#include "common.h"
21 21
diff --git a/arch/arm/mach-lh7a40x/irq-lh7a404.c b/arch/arm/mach-lh7a40x/irq-lh7a404.c
index 9b28389035e6..12b045b688c6 100644
--- a/arch/arm/mach-lh7a40x/irq-lh7a404.c
+++ b/arch/arm/mach-lh7a40x/irq-lh7a404.c
@@ -12,10 +12,10 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14 14
15#include <asm/hardware.h> 15#include <mach/hardware.h>
16#include <asm/irq.h> 16#include <asm/irq.h>
17#include <asm/mach/irq.h> 17#include <asm/mach/irq.h>
18#include <asm/arch/irqs.h> 18#include <mach/irqs.h>
19 19
20#include "common.h" 20#include "common.h"
21 21
diff --git a/arch/arm/mach-lh7a40x/irq-lpd7a40x.c b/arch/arm/mach-lh7a40x/irq-lpd7a40x.c
index 66e1ed3961ea..0d5063ebda10 100644
--- a/arch/arm/mach-lh7a40x/irq-lpd7a40x.c
+++ b/arch/arm/mach-lh7a40x/irq-lpd7a40x.c
@@ -13,10 +13,10 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15 15
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/irq.h> 17#include <asm/irq.h>
18#include <asm/mach/irq.h> 18#include <asm/mach/irq.h>
19#include <asm/arch/irqs.h> 19#include <mach/irqs.h>
20 20
21#include "common.h" 21#include "common.h"
22 22
diff --git a/arch/arm/mach-lh7a40x/ssp-cpld.c b/arch/arm/mach-lh7a40x/ssp-cpld.c
index a10830186dac..51fbef9601b9 100644
--- a/arch/arm/mach-lh7a40x/ssp-cpld.c
+++ b/arch/arm/mach-lh7a40x/ssp-cpld.c
@@ -46,9 +46,9 @@
46 46
47#include <asm/io.h> 47#include <asm/io.h>
48#include <asm/irq.h> 48#include <asm/irq.h>
49#include <asm/hardware.h> 49#include <mach/hardware.h>
50 50
51#include <asm/arch/ssp.h> 51#include <mach/ssp.h>
52 52
53//#define TALK 53//#define TALK
54 54
diff --git a/arch/arm/mach-lh7a40x/time.c b/arch/arm/mach-lh7a40x/time.c
index e50e60b33851..7fe9e06cf662 100644
--- a/arch/arm/mach-lh7a40x/time.c
+++ b/arch/arm/mach-lh7a40x/time.c
@@ -14,7 +14,7 @@
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/time.h> 15#include <linux/time.h>
16 16
17#include <asm/hardware.h> 17#include <mach/hardware.h>
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/irq.h> 19#include <asm/irq.h>
20#include <asm/leds.h> 20#include <asm/leds.h>
diff --git a/arch/arm/mach-loki/addr-map.c b/arch/arm/mach-loki/addr-map.c
index ba25e56ade58..70ca56bb6f33 100644
--- a/arch/arm/mach-loki/addr-map.c
+++ b/arch/arm/mach-loki/addr-map.c
@@ -11,7 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <asm/hardware.h> 14#include <mach/hardware.h>
15#include <asm/io.h> 15#include <asm/io.h>
16#include "common.h" 16#include "common.h"
17 17
diff --git a/arch/arm/mach-loki/common.c b/arch/arm/mach-loki/common.c
index 410f50399dd3..e20cdbca1ebe 100644
--- a/arch/arm/mach-loki/common.c
+++ b/arch/arm/mach-loki/common.c
@@ -18,7 +18,7 @@
18#include <asm/timex.h> 18#include <asm/timex.h>
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20#include <asm/mach/time.h> 20#include <asm/mach/time.h>
21#include <asm/arch/loki.h> 21#include <mach/loki.h>
22#include <asm/plat-orion/orion_nand.h> 22#include <asm/plat-orion/orion_nand.h>
23#include <asm/plat-orion/time.h> 23#include <asm/plat-orion/time.h>
24#include "common.h" 24#include "common.h"
diff --git a/arch/arm/mach-loki/include/mach/debug-macro.S b/arch/arm/mach-loki/include/mach/debug-macro.S
new file mode 100644
index 000000000000..a8c20bd2f951
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/debug-macro.S
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-loki/include/mach/debug-macro.S
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7*/
8
9#include <mach/loki.h>
10
11 .macro addruart,rx
12 mrc p15, 0, \rx, c1, c0
13 tst \rx, #1 @ MMU enabled?
14 ldreq \rx, =LOKI_REGS_PHYS_BASE
15 ldrne \rx, =LOKI_REGS_VIRT_BASE
16 orr \rx, \rx, #0x00012000
17 .endm
18
19#define UART_SHIFT 2
20#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-loki/include/mach/dma.h b/arch/arm/mach-loki/include/mach/dma.h
new file mode 100644
index 000000000000..40a8c178f10d
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/dma.h
@@ -0,0 +1 @@
/* empty */
diff --git a/arch/arm/mach-loki/include/mach/entry-macro.S b/arch/arm/mach-loki/include/mach/entry-macro.S
new file mode 100644
index 000000000000..332af38ec13c
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/entry-macro.S
@@ -0,0 +1,30 @@
1/*
2 * arch/arm/mach-loki/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Marvell Loki (88RC8480) 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
11#include <mach/loki.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =IRQ_VIRT_BASE
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24 ldr \irqstat, [\base, #IRQ_CAUSE_OFF]
25 ldr \tmp, [\base, #IRQ_MASK_OFF]
26 mov \irqnr, #0
27 ands \irqstat, \irqstat, \tmp
28 clzne \irqnr, \irqstat
29 rsbne \irqnr, \irqnr, #31
30 .endm
diff --git a/arch/arm/mach-loki/include/mach/hardware.h b/arch/arm/mach-loki/include/mach/hardware.h
new file mode 100644
index 000000000000..d7bfc8f17729
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/hardware.h
@@ -0,0 +1,15 @@
1/*
2 * arch/arm/mach-loki/include/mach/hardware.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H
11
12#include "loki.h"
13
14
15#endif
diff --git a/arch/arm/mach-loki/include/mach/io.h b/arch/arm/mach-loki/include/mach/io.h
new file mode 100644
index 000000000000..a373cd582c84
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/io.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-loki/include/mach/io.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_IO_H
10#define __ASM_ARCH_IO_H
11
12#include "loki.h"
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16static inline void __iomem *__io(unsigned long addr)
17{
18 return (void __iomem *)((addr - LOKI_PCIE0_IO_PHYS_BASE)
19 + LOKI_PCIE0_IO_VIRT_BASE);
20}
21
22#define __io(a) __io(a)
23#define __mem_pci(a) (a)
24
25
26#endif
diff --git a/arch/arm/mach-loki/include/mach/irqs.h b/arch/arm/mach-loki/include/mach/irqs.h
new file mode 100644
index 000000000000..9fbd3326867b
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/irqs.h
@@ -0,0 +1,58 @@
1/*
2 * arch/arm/mach-loki/include/mach/irqs.h
3 *
4 * IRQ definitions for Marvell Loki (88RC8480) SoCs
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 __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H
13
14#include "loki.h" /* need GPIO_MAX */
15
16/*
17 * Interrupt Controller
18 */
19#define IRQ_LOKI_PCIE_A_CPU_DRBL 0
20#define IRQ_LOKI_CPU_PCIE_A_DRBL 1
21#define IRQ_LOKI_PCIE_B_CPU_DRBL 2
22#define IRQ_LOKI_CPU_PCIE_B_DRBL 3
23#define IRQ_LOKI_COM_A_ERR 6
24#define IRQ_LOKI_COM_A_IN 7
25#define IRQ_LOKI_COM_A_OUT 8
26#define IRQ_LOKI_COM_B_ERR 9
27#define IRQ_LOKI_COM_B_IN 10
28#define IRQ_LOKI_COM_B_OUT 11
29#define IRQ_LOKI_DMA_A 12
30#define IRQ_LOKI_DMA_B 13
31#define IRQ_LOKI_SAS_A 14
32#define IRQ_LOKI_SAS_B 15
33#define IRQ_LOKI_DDR 16
34#define IRQ_LOKI_XOR 17
35#define IRQ_LOKI_BRIDGE 18
36#define IRQ_LOKI_PCIE_A_ERR 20
37#define IRQ_LOKI_PCIE_A_INT 21
38#define IRQ_LOKI_PCIE_B_ERR 22
39#define IRQ_LOKI_PCIE_B_INT 23
40#define IRQ_LOKI_GBE_A_INT 24
41#define IRQ_LOKI_GBE_B_INT 25
42#define IRQ_LOKI_DEV_ERR 26
43#define IRQ_LOKI_UART0 27
44#define IRQ_LOKI_UART1 28
45#define IRQ_LOKI_TWSI 29
46#define IRQ_LOKI_GPIO_23_0 30
47#define IRQ_LOKI_GPIO_25_24 31
48
49/*
50 * Loki General Purpose Pins
51 */
52#define IRQ_LOKI_GPIO_START 32
53#define NR_GPIO_IRQS GPIO_MAX
54
55#define NR_IRQS (IRQ_LOKI_GPIO_START + NR_GPIO_IRQS)
56
57
58#endif
diff --git a/arch/arm/mach-loki/include/mach/loki.h b/arch/arm/mach-loki/include/mach/loki.h
new file mode 100644
index 000000000000..c00af6ba5578
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/loki.h
@@ -0,0 +1,97 @@
1/*
2 * arch/arm/mach-loki/include/mach/loki.h
3 *
4 * Generic definitions for Marvell Loki (88RC8480) SoC flavors
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 __ASM_ARCH_LOKI_H
12#define __ASM_ARCH_LOKI_H
13
14/*
15 * Marvell Loki (88RC8480) address maps.
16 *
17 * phys
18 * d0000000 on-chip peripheral registers
19 * e0000000 PCIe 0 Memory space
20 * e8000000 PCIe 1 Memory space
21 * f0000000 PCIe 0 I/O space
22 * f0100000 PCIe 1 I/O space
23 *
24 * virt phys size
25 * fed00000 d0000000 1M on-chip peripheral registers
26 * fee00000 f0000000 64K PCIe 0 I/O space
27 * fef00000 f0100000 64K PCIe 1 I/O space
28 */
29
30#define LOKI_REGS_PHYS_BASE 0xd0000000
31#define LOKI_REGS_VIRT_BASE 0xfed00000
32#define LOKI_REGS_SIZE SZ_1M
33
34#define LOKI_PCIE0_IO_PHYS_BASE 0xf0000000
35#define LOKI_PCIE0_IO_VIRT_BASE 0xfee00000
36#define LOKI_PCIE0_IO_BUS_BASE 0x00000000
37#define LOKI_PCIE0_IO_SIZE SZ_64K
38
39#define LOKI_PCIE1_IO_PHYS_BASE 0xf0100000
40#define LOKI_PCIE1_IO_VIRT_BASE 0xfef00000
41#define LOKI_PCIE1_IO_BUS_BASE 0x00000000
42#define LOKI_PCIE1_IO_SIZE SZ_64K
43
44#define LOKI_PCIE0_MEM_PHYS_BASE 0xe0000000
45#define LOKI_PCIE0_MEM_SIZE SZ_128M
46
47#define LOKI_PCIE1_MEM_PHYS_BASE 0xe8000000
48#define LOKI_PCIE1_MEM_SIZE SZ_128M
49
50/*
51 * Register Map
52 */
53#define DEV_BUS_PHYS_BASE (LOKI_REGS_PHYS_BASE | 0x10000)
54#define DEV_BUS_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0x10000)
55#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000)
56#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000)
57#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100)
58#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2100)
59
60#define BRIDGE_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0x20000)
61#define BRIDGE_REG(x) (BRIDGE_VIRT_BASE | (x))
62#define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108)
63#define SOFT_RESET_OUT_EN 0x00000004
64#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c)
65#define SOFT_RESET 0x00000001
66#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110)
67#define BRIDGE_MASK (BRIDGE_VIRT_BASE | 0x0114)
68#define BRIDGE_INT_TIMER0 0x0002
69#define BRIDGE_INT_TIMER1 0x0004
70#define BRIDGE_INT_TIMER1_CLR 0x0004
71#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200)
72#define IRQ_CAUSE_OFF 0x0000
73#define IRQ_MASK_OFF 0x0004
74#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300)
75
76#define PCIE0_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0x30000)
77
78#define PCIE1_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0x40000)
79
80#define SAS0_PHYS_BASE (LOKI_REGS_PHYS_BASE | 0x80000)
81
82#define SAS1_PHYS_BASE (LOKI_REGS_PHYS_BASE | 0x90000)
83
84#define GE0_PHYS_BASE (LOKI_REGS_PHYS_BASE | 0xa0000)
85#define GE0_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0xa0000)
86
87#define GE1_PHYS_BASE (LOKI_REGS_PHYS_BASE | 0xb0000)
88#define GE1_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0xb0000)
89
90#define DDR_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0xf0000)
91#define DDR_REG(x) (DDR_VIRT_BASE | (x))
92
93
94#define GPIO_MAX 8
95
96
97#endif
diff --git a/arch/arm/mach-loki/include/mach/memory.h b/arch/arm/mach-loki/include/mach/memory.h
new file mode 100644
index 000000000000..a39533ab489d
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/memory.h
@@ -0,0 +1,14 @@
1/*
2 * arch/arm/mach-loki/include/mach/memory.h
3 */
4
5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H
7
8#define PHYS_OFFSET UL(0x00000000)
9
10#define __virt_to_bus(x) __virt_to_phys(x)
11#define __bus_to_virt(x) __phys_to_virt(x)
12
13
14#endif
diff --git a/arch/arm/mach-loki/include/mach/system.h b/arch/arm/mach-loki/include/mach/system.h
new file mode 100644
index 000000000000..8db1147d4ec5
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/system.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-loki/include/mach/system.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_SYSTEM_H
10#define __ASM_ARCH_SYSTEM_H
11
12#include <mach/hardware.h>
13#include <mach/loki.h>
14
15static inline void arch_idle(void)
16{
17 cpu_do_idle();
18}
19
20static inline void arch_reset(char mode)
21{
22 /*
23 * Enable soft reset to assert RSTOUTn.
24 */
25 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
26
27 /*
28 * Assert soft reset.
29 */
30 writel(SOFT_RESET, SYSTEM_SOFT_RESET);
31
32 while (1)
33 ;
34}
35
36
37#endif
diff --git a/arch/arm/mach-loki/include/mach/timex.h b/arch/arm/mach-loki/include/mach/timex.h
new file mode 100644
index 000000000000..9df210915297
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/timex.h
@@ -0,0 +1,11 @@
1/*
2 * arch/arm/mach-loki/include/mach/timex.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#define CLOCK_TICK_RATE (100 * HZ)
10
11#define LOKI_TCLK 180000000
diff --git a/arch/arm/mach-loki/include/mach/uncompress.h b/arch/arm/mach-loki/include/mach/uncompress.h
new file mode 100644
index 000000000000..90b2a7e65da3
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/uncompress.h
@@ -0,0 +1,47 @@
1/*
2 * arch/arm/mach-loki/include/mach/uncompress.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/serial_reg.h>
10#include <mach/loki.h>
11
12#define SERIAL_BASE ((unsigned char *)UART0_PHYS_BASE)
13
14static void putc(const char c)
15{
16 unsigned char *base = SERIAL_BASE;
17 int i;
18
19 for (i = 0; i < 0x1000; i++) {
20 if (base[UART_LSR << 2] & UART_LSR_THRE)
21 break;
22 barrier();
23 }
24
25 base[UART_TX << 2] = c;
26}
27
28static void flush(void)
29{
30 unsigned char *base = SERIAL_BASE;
31 unsigned char mask;
32 int i;
33
34 mask = UART_LSR_TEMT | UART_LSR_THRE;
35
36 for (i = 0; i < 0x1000; i++) {
37 if ((base[UART_LSR << 2] & mask) == mask)
38 break;
39 barrier();
40 }
41}
42
43/*
44 * nothing to do
45 */
46#define arch_decomp_setup()
47#define arch_decomp_wdog()
diff --git a/arch/arm/mach-loki/include/mach/vmalloc.h b/arch/arm/mach-loki/include/mach/vmalloc.h
new file mode 100644
index 000000000000..8dc3bfcbf9f0
--- /dev/null
+++ b/arch/arm/mach-loki/include/mach/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-loki/include/mach/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe800000
diff --git a/arch/arm/mach-loki/lb88rc8480-setup.c b/arch/arm/mach-loki/lb88rc8480-setup.c
index d1b9e6e6253a..2cc9ac9b488f 100644
--- a/arch/arm/mach-loki/lb88rc8480-setup.c
+++ b/arch/arm/mach-loki/lb88rc8480-setup.c
@@ -19,7 +19,7 @@
19#include <linux/mv643xx_eth.h> 19#include <linux/mv643xx_eth.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
22#include <asm/arch/loki.h> 22#include <mach/loki.h>
23#include "common.h" 23#include "common.h"
24 24
25#define LB88RC8480_FLASH_BOOT_CS_BASE 0xf8000000 25#define LB88RC8480_FLASH_BOOT_CS_BASE 0xf8000000
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 86dfb2b5261c..995afc4ade4b 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -19,14 +19,14 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/input.h> 20#include <linux/input.h>
21 21
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach/flash.h> 26#include <asm/mach/flash.h>
27 27
28#include <asm/arch/board.h> 28#include <mach/board.h>
29#include <asm/arch/msm_iomap.h> 29#include <mach/msm_iomap.h>
30 30
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/delay.h> 32#include <asm/delay.h>
diff --git a/arch/arm/mach-msm/common.c b/arch/arm/mach-msm/common.c
index 3f5d3362f887..3a511368a5d8 100644
--- a/arch/arm/mach-msm/common.c
+++ b/arch/arm/mach-msm/common.c
@@ -28,9 +28,9 @@
28#include <linux/mtd/nand.h> 28#include <linux/mtd/nand.h>
29#include <linux/mtd/partitions.h> 29#include <linux/mtd/partitions.h>
30 30
31#include <asm/arch/msm_iomap.h> 31#include <mach/msm_iomap.h>
32 32
33#include <asm/arch/board.h> 33#include <mach/board.h>
34 34
35struct flash_platform_data msm_nand_data = { 35struct flash_platform_data msm_nand_data = {
36 .parts = 0, 36 .parts = 0,
diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c
index 8b0f339b3274..9de08265d974 100644
--- a/arch/arm/mach-msm/dma.c
+++ b/arch/arm/mach-msm/dma.c
@@ -15,7 +15,7 @@
15 15
16#include <asm/io.h> 16#include <asm/io.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <asm/arch/dma.h> 18#include <mach/dma.h>
19 19
20#define MSM_DMOV_CHANNEL_COUNT 16 20#define MSM_DMOV_CHANNEL_COUNT 16
21 21
diff --git a/arch/arm/mach-msm/idle.S b/arch/arm/mach-msm/idle.S
index 2b1cb7f16943..6a94f0527137 100644
--- a/arch/arm/mach-msm/idle.S
+++ b/arch/arm/mach-msm/idle.S
@@ -1,4 +1,4 @@
1/* linux/include/asm-arm/arch-msm/idle.S 1/* arch/arm/mach-msm/include/mach/idle.S
2 * 2 *
3 * Idle processing for MSM7K - work around bugs with SWFI. 3 * Idle processing for MSM7K - work around bugs with SWFI.
4 * 4 *
diff --git a/arch/arm/mach-msm/include/mach/board.h b/arch/arm/mach-msm/include/mach/board.h
new file mode 100644
index 000000000000..a7639493c095
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/board.h
@@ -0,0 +1,37 @@
1/* arch/arm/mach-msm/include/mach/board.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __ASM_ARCH_MSM_BOARD_H
18#define __ASM_ARCH_MSM_BOARD_H
19
20#include <linux/types.h>
21
22/* platform device data structures */
23
24struct msm_mddi_platform_data
25{
26 void (*panel_power)(int on);
27 unsigned has_vsync_irq:1;
28};
29
30/* common init routines for use by arch/arm/mach-msm/board-*.c */
31
32void __init msm_add_devices(void);
33void __init msm_map_common_io(void);
34void __init msm_init_irq(void);
35void __init msm_init_gpio(void);
36
37#endif
diff --git a/arch/arm/mach-msm/include/mach/debug-macro.S b/arch/arm/mach-msm/include/mach/debug-macro.S
new file mode 100644
index 000000000000..528eef4b605c
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/debug-macro.S
@@ -0,0 +1,40 @@
1/* arch/arm/mach-msm7200/include/mach/debug-macro.S
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#include <mach/hardware.h>
18#include <mach/msm_iomap.h>
19
20 .macro addruart,rx
21 @ see if the MMU is enabled and select appropriate base address
22 mrc p15, 0, \rx, c1, c0
23 tst \rx, #1
24 ldreq \rx, =MSM_UART1_PHYS
25 ldrne \rx, =MSM_UART1_BASE
26 .endm
27
28 .macro senduart,rd,rx
29 str \rd, [\rx, #0x0C]
30 .endm
31
32 .macro waituart,rd,rx
33 @ wait for TX_READY
341: ldr \rd, [\rx, #0x08]
35 tst \rd, #0x04
36 beq 1b
37 .endm
38
39 .macro busyuart,rd,rx
40 .endm
diff --git a/arch/arm/mach-msm/include/mach/dma.h b/arch/arm/mach-msm/include/mach/dma.h
new file mode 100644
index 000000000000..ad1c87f86d10
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/dma.h
@@ -0,0 +1,151 @@
1/* arch/arm/mach-msm/include/mach/dma.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef __ASM_ARCH_MSM_DMA_H
17
18#include <linux/list.h>
19#include <mach/msm_iomap.h>
20
21struct msm_dmov_cmd {
22 struct list_head list;
23 unsigned int cmdptr;
24 void (*complete_func)(struct msm_dmov_cmd *cmd, unsigned int result);
25/* void (*user_result_func)(struct msm_dmov_cmd *cmd); */
26};
27
28void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd);
29void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd);
30int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr);
31/* int msm_dmov_exec_cmd_etc(unsigned id, unsigned int cmdptr, int timeout, int interruptible); */
32
33
34
35#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
36#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))
37#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))
38#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))
39
40/* only security domain 3 is available to the ARM11
41 * SD0 -> mARM trusted, SD1 -> mARM nontrusted, SD2 -> aDSP, SD3 -> aARM
42 */
43
44#define DMOV_CMD_PTR(ch) DMOV_SD3(0x000, ch)
45#define DMOV_CMD_LIST (0 << 29) /* does not work */
46#define DMOV_CMD_PTR_LIST (1 << 29) /* works */
47#define DMOV_CMD_INPUT_CFG (2 << 29) /* untested */
48#define DMOV_CMD_OUTPUT_CFG (3 << 29) /* untested */
49#define DMOV_CMD_ADDR(addr) ((addr) >> 3)
50
51#define DMOV_RSLT(ch) DMOV_SD3(0x040, ch)
52#define DMOV_RSLT_VALID (1 << 31) /* 0 == host has empties result fifo */
53#define DMOV_RSLT_ERROR (1 << 3)
54#define DMOV_RSLT_FLUSH (1 << 2)
55#define DMOV_RSLT_DONE (1 << 1) /* top pointer done */
56#define DMOV_RSLT_USER (1 << 0) /* command with FR force result */
57
58#define DMOV_FLUSH0(ch) DMOV_SD3(0x080, ch)
59#define DMOV_FLUSH1(ch) DMOV_SD3(0x0C0, ch)
60#define DMOV_FLUSH2(ch) DMOV_SD3(0x100, ch)
61#define DMOV_FLUSH3(ch) DMOV_SD3(0x140, ch)
62#define DMOV_FLUSH4(ch) DMOV_SD3(0x180, ch)
63#define DMOV_FLUSH5(ch) DMOV_SD3(0x1C0, ch)
64
65#define DMOV_STATUS(ch) DMOV_SD3(0x200, ch)
66#define DMOV_STATUS_RSLT_COUNT(n) (((n) >> 29))
67#define DMOV_STATUS_CMD_COUNT(n) (((n) >> 27) & 3)
68#define DMOV_STATUS_RSLT_VALID (1 << 1)
69#define DMOV_STATUS_CMD_PTR_RDY (1 << 0)
70
71#define DMOV_ISR DMOV_SD3(0x380, 0)
72
73#define DMOV_CONFIG(ch) DMOV_SD3(0x300, ch)
74#define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2)
75#define DMOV_CONFIG_FORCE_FLUSH_RSLT (1 << 1)
76#define DMOV_CONFIG_IRQ_EN (1 << 0)
77
78/* channel assignments */
79
80#define DMOV_NAND_CHAN 7
81#define DMOV_NAND_CRCI_CMD 5
82#define DMOV_NAND_CRCI_DATA 4
83
84#define DMOV_SDC1_CHAN 8
85#define DMOV_SDC1_CRCI 6
86
87#define DMOV_SDC2_CHAN 8
88#define DMOV_SDC2_CRCI 7
89
90#define DMOV_TSIF_CHAN 10
91#define DMOV_TSIF_CRCI 10
92
93#define DMOV_USB_CHAN 11
94
95/* no client rate control ifc (eg, ram) */
96#define DMOV_NONE_CRCI 0
97
98
99/* If the CMD_PTR register has CMD_PTR_LIST selected, the data mover
100 * is going to walk a list of 32bit pointers as described below. Each
101 * pointer points to a *array* of dmov_s, etc structs. The last pointer
102 * in the list is marked with CMD_PTR_LP. The last struct in each array
103 * is marked with CMD_LC (see below).
104 */
105#define CMD_PTR_ADDR(addr) ((addr) >> 3)
106#define CMD_PTR_LP (1 << 31) /* last pointer */
107#define CMD_PTR_PT (3 << 29) /* ? */
108
109/* Single Item Mode */
110typedef struct {
111 unsigned cmd;
112 unsigned src;
113 unsigned dst;
114 unsigned len;
115} dmov_s;
116
117/* Scatter/Gather Mode */
118typedef struct {
119 unsigned cmd;
120 unsigned src_dscr;
121 unsigned dst_dscr;
122 unsigned _reserved;
123} dmov_sg;
124
125/* bits for the cmd field of the above structures */
126
127#define CMD_LC (1 << 31) /* last command */
128#define CMD_FR (1 << 22) /* force result -- does not work? */
129#define CMD_OCU (1 << 21) /* other channel unblock */
130#define CMD_OCB (1 << 20) /* other channel block */
131#define CMD_TCB (1 << 19) /* ? */
132#define CMD_DAH (1 << 18) /* destination address hold -- does not work?*/
133#define CMD_SAH (1 << 17) /* source address hold -- does not work? */
134
135#define CMD_MODE_SINGLE (0 << 0) /* dmov_s structure used */
136#define CMD_MODE_SG (1 << 0) /* untested */
137#define CMD_MODE_IND_SG (2 << 0) /* untested */
138#define CMD_MODE_BOX (3 << 0) /* untested */
139
140#define CMD_DST_SWAP_BYTES (1 << 14) /* exchange each byte n with byte n+1 */
141#define CMD_DST_SWAP_SHORTS (1 << 15) /* exchange each short n with short n+1 */
142#define CMD_DST_SWAP_WORDS (1 << 16) /* exchange each word n with word n+1 */
143
144#define CMD_SRC_SWAP_BYTES (1 << 11) /* exchange each byte n with byte n+1 */
145#define CMD_SRC_SWAP_SHORTS (1 << 12) /* exchange each short n with short n+1 */
146#define CMD_SRC_SWAP_WORDS (1 << 13) /* exchange each word n with word n+1 */
147
148#define CMD_DST_CRCI(n) (((n) & 15) << 7)
149#define CMD_SRC_CRCI(n) (((n) & 15) << 3)
150
151#endif
diff --git a/arch/arm/mach-msm/include/mach/entry-macro.S b/arch/arm/mach-msm/include/mach/entry-macro.S
new file mode 100644
index 000000000000..d2259486bcb1
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/entry-macro.S
@@ -0,0 +1,38 @@
1/* arch/arm/mach-msm7200/include/mach/entry-macro.S
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#include <mach/msm_iomap.h>
18
19 .macro disable_fiq
20 .endm
21
22 .macro get_irqnr_preamble, base, tmp
23 @ enable imprecise aborts
24 cpsie a
25 mov \base, #MSM_VIC_BASE
26 .endm
27
28 .macro arch_ret_to_user, tmp1, tmp2
29 .endm
30
31 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
32 @ 0xD0 has irq# or old irq# if the irq has been handled
33 @ 0xD4 has irq# or -1 if none pending *but* if you just
34 @ read 0xD4 you never get the first irq for some reason
35 ldr \irqnr, [\base, #0xD0]
36 ldr \irqnr, [\base, #0xD4]
37 cmp \irqnr, #0xffffffff
38 .endm
diff --git a/arch/arm/mach-msm/include/mach/hardware.h b/arch/arm/mach-msm/include/mach/hardware.h
new file mode 100644
index 000000000000..2d126091ae41
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/hardware.h
@@ -0,0 +1,18 @@
1/* arch/arm/mach-msm/include/mach/hardware.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef __ASM_ARCH_MSM_HARDWARE_H
17
18#endif
diff --git a/arch/arm/mach-msm/include/mach/io.h b/arch/arm/mach-msm/include/mach/io.h
new file mode 100644
index 000000000000..c6a2feb268b0
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/io.h
@@ -0,0 +1,33 @@
1/* arch/arm/mach-msm/include/mach/io.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef __ASM_ARM_ARCH_IO_H
17#define __ASM_ARM_ARCH_IO_H
18
19#define IO_SPACE_LIMIT 0xffffffff
20
21#define __arch_ioremap __msm_ioremap
22#define __arch_iounmap __iounmap
23
24void __iomem *__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype);
25
26static inline void __iomem *__io(unsigned long addr)
27{
28 return (void __iomem *)addr;
29}
30#define __io(a) __io(a)
31#define __mem_pci(a) (a)
32
33#endif
diff --git a/arch/arm/mach-msm/include/mach/irqs.h b/arch/arm/mach-msm/include/mach/irqs.h
new file mode 100644
index 000000000000..9dd4cf8a2693
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/irqs.h
@@ -0,0 +1,90 @@
1/* arch/arm/mach-msm/include/mach/irqs.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __ASM_ARCH_MSM_IRQS_H
18#define __ASM_ARCH_MSM_IRQS_H
19
20/* MSM ARM11 Interrupt Numbers */
21/* See 80-VE113-1 A, pp219-221 */
22
23#define INT_A9_M2A_0 0
24#define INT_A9_M2A_1 1
25#define INT_A9_M2A_2 2
26#define INT_A9_M2A_3 3
27#define INT_A9_M2A_4 4
28#define INT_A9_M2A_5 5
29#define INT_A9_M2A_6 6
30#define INT_GP_TIMER_EXP 7
31#define INT_DEBUG_TIMER_EXP 8
32#define INT_UART1 9
33#define INT_UART2 10
34#define INT_UART3 11
35#define INT_UART1_RX 12
36#define INT_UART2_RX 13
37#define INT_UART3_RX 14
38#define INT_USB_OTG 15
39#define INT_MDDI_PRI 16
40#define INT_MDDI_EXT 17
41#define INT_MDDI_CLIENT 18
42#define INT_MDP 19
43#define INT_GRAPHICS 20
44#define INT_ADM_AARM 21
45#define INT_ADSP_A11 22
46#define INT_ADSP_A9_A11 23
47#define INT_SDC1_0 24
48#define INT_SDC1_1 25
49#define INT_SDC2_0 26
50#define INT_SDC2_1 27
51#define INT_KEYSENSE 28
52#define INT_TCHSCRN_SSBI 29
53#define INT_TCHSCRN1 30
54#define INT_TCHSCRN2 31
55
56#define INT_GPIO_GROUP1 (32 + 0)
57#define INT_GPIO_GROUP2 (32 + 1)
58#define INT_PWB_I2C (32 + 2)
59#define INT_SOFTRESET (32 + 3)
60#define INT_NAND_WR_ER_DONE (32 + 4)
61#define INT_NAND_OP_DONE (32 + 5)
62#define INT_PBUS_ARM11 (32 + 6)
63#define INT_AXI_MPU_SMI (32 + 7)
64#define INT_AXI_MPU_EBI1 (32 + 8)
65#define INT_AD_HSSD (32 + 9)
66#define INT_ARM11_PMU (32 + 10)
67#define INT_ARM11_DMA (32 + 11)
68#define INT_TSIF_IRQ (32 + 12)
69#define INT_UART1DM_IRQ (32 + 13)
70#define INT_UART1DM_RX (32 + 14)
71#define INT_USB_HS (32 + 15)
72#define INT_SDC3_0 (32 + 16)
73#define INT_SDC3_1 (32 + 17)
74#define INT_SDC4_0 (32 + 18)
75#define INT_SDC4_1 (32 + 19)
76#define INT_UART2DM_RX (32 + 20)
77#define INT_UART2DM_IRQ (32 + 21)
78
79/* 22-31 are reserved */
80
81#define MSM_IRQ_BIT(irq) (1 << ((irq) & 31))
82
83#define NR_MSM_IRQS 64
84#define NR_GPIO_IRQS 122
85#define NR_BOARD_IRQS 64
86#define NR_IRQS (NR_MSM_IRQS + NR_GPIO_IRQS + NR_BOARD_IRQS)
87
88#define MSM_GPIO_TO_INT(n) (NR_MSM_IRQS + (n))
89
90#endif
diff --git a/arch/arm/mach-msm/include/mach/memory.h b/arch/arm/mach-msm/include/mach/memory.h
new file mode 100644
index 000000000000..63fd47f2e62e
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/memory.h
@@ -0,0 +1,27 @@
1/* arch/arm/mach-msm/include/mach/memory.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef __ASM_ARCH_MEMORY_H
17#define __ASM_ARCH_MEMORY_H
18
19/* physical offset of RAM */
20#define PHYS_OFFSET UL(0x10000000)
21
22/* bus address and physical addresses are identical */
23#define __virt_to_bus(x) __virt_to_phys(x)
24#define __bus_to_virt(x) __phys_to_virt(x)
25
26#endif
27
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h
new file mode 100644
index 000000000000..e221f58ceea3
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/msm_iomap.h
@@ -0,0 +1,104 @@
1/* arch/arm/mach-msm/include/mach/msm_iomap.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 *
16 * The MSM peripherals are spread all over across 768MB of physical
17 * space, which makes just having a simple IO_ADDRESS macro to slide
18 * them into the right virtual location rough. Instead, we will
19 * provide a master phys->virt mapping for peripherals here.
20 *
21 */
22
23#ifndef __ASM_ARCH_MSM_IOMAP_H
24#define __ASM_ARCH_MSM_IOMAP_H
25
26#include <asm/sizes.h>
27
28/* Physical base address and size of peripherals.
29 * Ordered by the virtual base addresses they will be mapped at.
30 *
31 * MSM_VIC_BASE must be an value that can be loaded via a "mov"
32 * instruction, otherwise entry-macro.S will not compile.
33 *
34 * If you add or remove entries here, you'll want to edit the
35 * msm_io_desc array in arch/arm/mach-msm/io.c to reflect your
36 * changes.
37 *
38 */
39
40#define MSM_VIC_BASE 0xE0000000
41#define MSM_VIC_PHYS 0xC0000000
42#define MSM_VIC_SIZE SZ_4K
43
44#define MSM_CSR_BASE 0xE0001000
45#define MSM_CSR_PHYS 0xC0100000
46#define MSM_CSR_SIZE SZ_4K
47
48#define MSM_GPT_PHYS MSM_CSR_PHYS
49#define MSM_GPT_BASE MSM_CSR_BASE
50#define MSM_GPT_SIZE SZ_4K
51
52#define MSM_DMOV_BASE 0xE0002000
53#define MSM_DMOV_PHYS 0xA9700000
54#define MSM_DMOV_SIZE SZ_4K
55
56#define MSM_UART1_BASE 0xE0003000
57#define MSM_UART1_PHYS 0xA9A00000
58#define MSM_UART1_SIZE SZ_4K
59
60#define MSM_UART2_BASE 0xE0004000
61#define MSM_UART2_PHYS 0xA9B00000
62#define MSM_UART2_SIZE SZ_4K
63
64#define MSM_UART3_BASE 0xE0005000
65#define MSM_UART3_PHYS 0xA9C00000
66#define MSM_UART3_SIZE SZ_4K
67
68#define MSM_I2C_BASE 0xE0006000
69#define MSM_I2C_PHYS 0xA9900000
70#define MSM_I2C_SIZE SZ_4K
71
72#define MSM_GPIO1_BASE 0xE0007000
73#define MSM_GPIO1_PHYS 0xA9200000
74#define MSM_GPIO1_SIZE SZ_4K
75
76#define MSM_GPIO2_BASE 0xE0008000
77#define MSM_GPIO2_PHYS 0xA9300000
78#define MSM_GPIO2_SIZE SZ_4K
79
80#define MSM_HSUSB_BASE 0xE0009000
81#define MSM_HSUSB_PHYS 0xA0800000
82#define MSM_HSUSB_SIZE SZ_4K
83
84#define MSM_CLK_CTL_BASE 0xE000A000
85#define MSM_CLK_CTL_PHYS 0xA8600000
86#define MSM_CLK_CTL_SIZE SZ_4K
87
88#define MSM_PMDH_BASE 0xE000B000
89#define MSM_PMDH_PHYS 0xAA600000
90#define MSM_PMDH_SIZE SZ_4K
91
92#define MSM_EMDH_BASE 0xE000C000
93#define MSM_EMDH_PHYS 0xAA700000
94#define MSM_EMDH_SIZE SZ_4K
95
96#define MSM_MDP_BASE 0xE0010000
97#define MSM_MDP_PHYS 0xAA200000
98#define MSM_MDP_SIZE 0x000F0000
99
100#define MSM_SHARED_RAM_BASE 0xE0100000
101#define MSM_SHARED_RAM_PHYS 0x01F00000
102#define MSM_SHARED_RAM_SIZE SZ_1M
103
104#endif
diff --git a/arch/arm/mach-msm/include/mach/system.h b/arch/arm/mach-msm/include/mach/system.h
new file mode 100644
index 000000000000..f05ad2e0f235
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/system.h
@@ -0,0 +1,23 @@
1/* arch/arm/mach-msm/include/mach/system.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#include <mach/hardware.h>
17
18void arch_idle(void);
19
20static inline void arch_reset(char mode)
21{
22 for (;;) ; /* depends on IPC w/ other core */
23}
diff --git a/arch/arm/mach-msm/include/mach/timex.h b/arch/arm/mach-msm/include/mach/timex.h
new file mode 100644
index 000000000000..a62e6b215aec
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/timex.h
@@ -0,0 +1,21 @@
1/* arch/arm/mach-msm/include/mach/timex.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef __ASM_ARCH_MSM_TIMEX_H
17#define __ASM_ARCH_MSM_TIMEX_H
18
19#define CLOCK_TICK_RATE 1000000
20
21#endif
diff --git a/arch/arm/mach-msm/include/mach/uncompress.h b/arch/arm/mach-msm/include/mach/uncompress.h
new file mode 100644
index 000000000000..026e8955ace9
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/uncompress.h
@@ -0,0 +1,36 @@
1/* arch/arm/mach-msm/include/mach/uncompress.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef __ASM_ARCH_MSM_UNCOMPRESS_H
17
18#include "hardware.h"
19
20static void putc(int c)
21{
22}
23
24static inline void flush(void)
25{
26}
27
28static inline void arch_decomp_setup(void)
29{
30}
31
32static inline void arch_decomp_wdog(void)
33{
34}
35
36#endif
diff --git a/arch/arm/mach-msm/include/mach/vmalloc.h b/arch/arm/mach-msm/include/mach/vmalloc.h
new file mode 100644
index 000000000000..05f81fd8623c
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/vmalloc.h
@@ -0,0 +1,22 @@
1/* arch/arm/mach-msm/include/mach/vmalloc.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef __ASM_ARCH_MSM_VMALLOC_H
17#define __ASM_ARCH_MSM_VMALLOC_H
18
19#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
20
21#endif
22
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
index c39edb994a88..5976200de99b 100644
--- a/arch/arm/mach-msm/io.c
+++ b/arch/arm/mach-msm/io.c
@@ -19,13 +19,13 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21 21
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/arch/msm_iomap.h> 25#include <mach/msm_iomap.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <asm/arch/board.h> 28#include <mach/board.h>
29 29
30#define MSM_DEVICE(name) { \ 30#define MSM_DEVICE(name) { \
31 .virtual = MSM_##name##_BASE, \ 31 .virtual = MSM_##name##_BASE, \
diff --git a/arch/arm/mach-msm/irq.c b/arch/arm/mach-msm/irq.c
index 24158040b789..66901baf8c8e 100644
--- a/arch/arm/mach-msm/irq.c
+++ b/arch/arm/mach-msm/irq.c
@@ -21,11 +21,11 @@
21#include <linux/timer.h> 21#include <linux/timer.h>
22 22
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25 25
26#include <asm/io.h> 26#include <asm/io.h>
27 27
28#include <asm/arch/msm_iomap.h> 28#include <mach/msm_iomap.h>
29 29
30#define VIC_REG(off) (MSM_VIC_BASE + (off)) 30#define VIC_REG(off) (MSM_VIC_BASE + (off))
31 31
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index bd4732d1ab3e..9f02d7dca985 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -22,7 +22,7 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23 23
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <asm/arch/msm_iomap.h> 25#include <mach/msm_iomap.h>
26 26
27#include <asm/io.h> 27#include <asm/io.h>
28 28
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index d27b83b7bf62..e633f9cb239f 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -17,7 +17,7 @@
17#include <linux/ata_platform.h> 17#include <linux/ata_platform.h>
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/mach/time.h> 19#include <asm/mach/time.h>
20#include <asm/arch/mv78xx0.h> 20#include <mach/mv78xx0.h>
21#include <asm/plat-orion/cache-feroceon-l2.h> 21#include <asm/plat-orion/cache-feroceon-l2.h>
22#include <asm/plat-orion/ehci-orion.h> 22#include <asm/plat-orion/ehci-orion.h>
23#include <asm/plat-orion/orion_nand.h> 23#include <asm/plat-orion/orion_nand.h>
diff --git a/arch/arm/mach-mv78xx0/db78x00-bp-setup.c b/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
index 0c93d19193df..a2d0c9783604 100644
--- a/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
+++ b/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
@@ -13,7 +13,7 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/ata_platform.h> 14#include <linux/ata_platform.h>
15#include <linux/mv643xx_eth.h> 15#include <linux/mv643xx_eth.h>
16#include <asm/arch/mv78xx0.h> 16#include <mach/mv78xx0.h>
17#include <asm/mach-types.h> 17#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19#include "common.h" 19#include "common.h"
diff --git a/arch/arm/mach-mv78xx0/include/mach/debug-macro.S b/arch/arm/mach-mv78xx0/include/mach/debug-macro.S
new file mode 100644
index 000000000000..a06442fbd341
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/debug-macro.S
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/debug-macro.S
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7*/
8
9#include <mach/mv78xx0.h>
10
11 .macro addruart,rx
12 mrc p15, 0, \rx, c1, c0
13 tst \rx, #1 @ MMU enabled?
14 ldreq \rx, =MV78XX0_REGS_PHYS_BASE
15 ldrne \rx, =MV78XX0_REGS_VIRT_BASE
16 orr \rx, \rx, #0x00012000
17 .endm
18
19#define UART_SHIFT 2
20#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-mv78xx0/include/mach/dma.h b/arch/arm/mach-mv78xx0/include/mach/dma.h
new file mode 100644
index 000000000000..40a8c178f10d
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/dma.h
@@ -0,0 +1 @@
/* empty */
diff --git a/arch/arm/mach-mv78xx0/include/mach/entry-macro.S b/arch/arm/mach-mv78xx0/include/mach/entry-macro.S
new file mode 100644
index 000000000000..ed4a46bcd3b0
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/entry-macro.S
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Marvell MV78xx0 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
11#include <mach/mv78xx0.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =IRQ_VIRT_BASE
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24 @ check low interrupts
25 ldr \irqstat, [\base, #IRQ_CAUSE_LOW_OFF]
26 ldr \tmp, [\base, #IRQ_MASK_LOW_OFF]
27 mov \irqnr, #31
28 ands \irqstat, \irqstat, \tmp
29
30 @ if no low interrupts set, check high interrupts
31 ldreq \irqstat, [\base, #IRQ_CAUSE_HIGH_OFF]
32 ldreq \tmp, [\base, #IRQ_MASK_HIGH_OFF]
33 moveq \irqnr, #63
34 andeqs \irqstat, \irqstat, \tmp
35
36 @ find first active interrupt source
37 clzne \irqstat, \irqstat
38 subne \irqnr, \irqnr, \irqstat
39 .endm
diff --git a/arch/arm/mach-mv78xx0/include/mach/hardware.h b/arch/arm/mach-mv78xx0/include/mach/hardware.h
new file mode 100644
index 000000000000..5d887557e123
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/hardware.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/hardware.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H
11
12#include "mv78xx0.h"
13
14#define pcibios_assign_all_busses() 1
15
16#define PCIBIOS_MIN_IO 0x00001000
17#define PCIBIOS_MIN_MEM 0x01000000
18#define PCIMEM_BASE MV78XX0_PCIE_MEM_PHYS_BASE /* mem base for VGA */
19
20
21#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/io.h b/arch/arm/mach-mv78xx0/include/mach/io.h
new file mode 100644
index 000000000000..450e0e1ad092
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/io.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/io.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_IO_H
10#define __ASM_ARCH_IO_H
11
12#include "mv78xx0.h"
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16static inline void __iomem *__io(unsigned long addr)
17{
18 return (void __iomem *)((addr - MV78XX0_PCIE_IO_PHYS_BASE(0))
19 + MV78XX0_PCIE_IO_VIRT_BASE(0));
20}
21
22#define __io(a) __io(a)
23#define __mem_pci(a) (a)
24
25
26#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/irqs.h b/arch/arm/mach-mv78xx0/include/mach/irqs.h
new file mode 100644
index 000000000000..995d7fb8d06f
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/irqs.h
@@ -0,0 +1,91 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/irqs.h
3 *
4 * IRQ definitions for Marvell MV78xx0 SoCs
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 __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H
13
14#include "mv78xx0.h" /* need GPIO_MAX */
15
16/*
17 * MV78xx0 Low Interrupt Controller
18 */
19#define IRQ_MV78XX0_ERR 0
20#define IRQ_MV78XX0_SPI 1
21#define IRQ_MV78XX0_I2C_0 2
22#define IRQ_MV78XX0_I2C_1 3
23#define IRQ_MV78XX0_IDMA_0 4
24#define IRQ_MV78XX0_IDMA_1 5
25#define IRQ_MV78XX0_IDMA_2 6
26#define IRQ_MV78XX0_IDMA_3 7
27#define IRQ_MV78XX0_TIMER_0 8
28#define IRQ_MV78XX0_TIMER_1 9
29#define IRQ_MV78XX0_TIMER_2 10
30#define IRQ_MV78XX0_TIMER_3 11
31#define IRQ_MV78XX0_UART_0 12
32#define IRQ_MV78XX0_UART_1 13
33#define IRQ_MV78XX0_UART_2 14
34#define IRQ_MV78XX0_UART_3 15
35#define IRQ_MV78XX0_USB_0 16
36#define IRQ_MV78XX0_USB_1 17
37#define IRQ_MV78XX0_USB_2 18
38#define IRQ_MV78XX0_CRYPTO 19
39#define IRQ_MV78XX0_SDIO_0 20
40#define IRQ_MV78XX0_SDIO_1 21
41#define IRQ_MV78XX0_XOR_0 22
42#define IRQ_MV78XX0_XOR_1 23
43#define IRQ_MV78XX0_I2S_0 24
44#define IRQ_MV78XX0_I2S_1 25
45#define IRQ_MV78XX0_SATA 26
46#define IRQ_MV78XX0_TDMI 27
47
48/*
49 * MV78xx0 High Interrupt Controller
50 */
51#define IRQ_MV78XX0_PCIE_00 32
52#define IRQ_MV78XX0_PCIE_01 33
53#define IRQ_MV78XX0_PCIE_02 34
54#define IRQ_MV78XX0_PCIE_03 35
55#define IRQ_MV78XX0_PCIE_10 36
56#define IRQ_MV78XX0_PCIE_11 37
57#define IRQ_MV78XX0_PCIE_12 38
58#define IRQ_MV78XX0_PCIE_13 39
59#define IRQ_MV78XX0_GE00_SUM 40
60#define IRQ_MV78XX0_GE00_RX 41
61#define IRQ_MV78XX0_GE00_TX 42
62#define IRQ_MV78XX0_GE00_MISC 43
63#define IRQ_MV78XX0_GE01_SUM 44
64#define IRQ_MV78XX0_GE01_RX 45
65#define IRQ_MV78XX0_GE01_TX 46
66#define IRQ_MV78XX0_GE01_MISC 47
67#define IRQ_MV78XX0_GE10_SUM 48
68#define IRQ_MV78XX0_GE10_RX 49
69#define IRQ_MV78XX0_GE10_TX 50
70#define IRQ_MV78XX0_GE10_MISC 51
71#define IRQ_MV78XX0_GE11_SUM 52
72#define IRQ_MV78XX0_GE11_RX 53
73#define IRQ_MV78XX0_GE11_TX 54
74#define IRQ_MV78XX0_GE11_MISC 55
75#define IRQ_MV78XX0_GPIO_0_7 56
76#define IRQ_MV78XX0_GPIO_8_15 57
77#define IRQ_MV78XX0_GPIO_16_23 58
78#define IRQ_MV78XX0_GPIO_24_31 59
79#define IRQ_MV78XX0_DB_IN 60
80#define IRQ_MV78XX0_DB_OUT 61
81
82/*
83 * MV78XX0 General Purpose Pins
84 */
85#define IRQ_MV78XX0_GPIO_START 64
86#define NR_GPIO_IRQS GPIO_MAX
87
88#define NR_IRQS (IRQ_MV78XX0_GPIO_START + NR_GPIO_IRQS)
89
90
91#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/memory.h b/arch/arm/mach-mv78xx0/include/mach/memory.h
new file mode 100644
index 000000000000..9e47a140ff7a
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/memory.h
@@ -0,0 +1,14 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/memory.h
3 */
4
5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H
7
8#define PHYS_OFFSET UL(0x00000000)
9
10#define __virt_to_bus(x) __virt_to_phys(x)
11#define __bus_to_virt(x) __phys_to_virt(x)
12
13
14#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
new file mode 100644
index 000000000000..ad664178d6e1
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
@@ -0,0 +1,126 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
3 *
4 * Generic definitions for Marvell MV78xx0 SoC flavors:
5 * MV781x0 and MV782x0.
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef __ASM_ARCH_MV78XX0_H
13#define __ASM_ARCH_MV78XX0_H
14
15/*
16 * Marvell MV78xx0 address maps.
17 *
18 * phys
19 * c0000000 PCIe Memory space
20 * f0800000 PCIe #0 I/O space
21 * f0900000 PCIe #1 I/O space
22 * f0a00000 PCIe #2 I/O space
23 * f0b00000 PCIe #3 I/O space
24 * f0c00000 PCIe #4 I/O space
25 * f0d00000 PCIe #5 I/O space
26 * f0e00000 PCIe #6 I/O space
27 * f0f00000 PCIe #7 I/O space
28 * f1000000 on-chip peripheral registers
29 *
30 * virt phys size
31 * fe400000 f102x000 16K core-specific peripheral registers
32 * fe700000 f0800000 1M PCIe #0 I/O space
33 * fe800000 f0900000 1M PCIe #1 I/O space
34 * fe900000 f0a00000 1M PCIe #2 I/O space
35 * fea00000 f0b00000 1M PCIe #3 I/O space
36 * feb00000 f0c00000 1M PCIe #4 I/O space
37 * fec00000 f0d00000 1M PCIe #5 I/O space
38 * fed00000 f0e00000 1M PCIe #6 I/O space
39 * fee00000 f0f00000 1M PCIe #7 I/O space
40 * fef00000 f1000000 1M on-chip peripheral registers
41 */
42#define MV78XX0_CORE0_REGS_PHYS_BASE 0xf1020000
43#define MV78XX0_CORE1_REGS_PHYS_BASE 0xf1024000
44#define MV78XX0_CORE_REGS_VIRT_BASE 0xfe400000
45#define MV78XX0_CORE_REGS_SIZE SZ_16K
46
47#define MV78XX0_PCIE_IO_PHYS_BASE(i) (0xf0800000 + ((i) << 20))
48#define MV78XX0_PCIE_IO_VIRT_BASE(i) (0xfe700000 + ((i) << 20))
49#define MV78XX0_PCIE_IO_SIZE SZ_1M
50
51#define MV78XX0_REGS_PHYS_BASE 0xf1000000
52#define MV78XX0_REGS_VIRT_BASE 0xfef00000
53#define MV78XX0_REGS_SIZE SZ_1M
54
55#define MV78XX0_PCIE_MEM_PHYS_BASE 0xc0000000
56#define MV78XX0_PCIE_MEM_SIZE 0x30000000
57
58/*
59 * Core-specific peripheral registers.
60 */
61#define BRIDGE_VIRT_BASE (MV78XX0_CORE_REGS_VIRT_BASE)
62#define CPU_CONTROL (BRIDGE_VIRT_BASE | 0x0104)
63#define L2_WRITETHROUGH 0x00020000
64#define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108)
65#define SOFT_RESET_OUT_EN 0x00000004
66#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c)
67#define SOFT_RESET 0x00000001
68#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110)
69#define BRIDGE_MASK (BRIDGE_VIRT_BASE | 0x0114)
70#define BRIDGE_INT_TIMER0 0x0002
71#define BRIDGE_INT_TIMER1 0x0004
72#define BRIDGE_INT_TIMER1_CLR (~0x0004)
73#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200)
74#define IRQ_CAUSE_LOW_OFF 0x0004
75#define IRQ_CAUSE_HIGH_OFF 0x0008
76#define IRQ_MASK_LOW_OFF 0x0010
77#define IRQ_MASK_HIGH_OFF 0x0014
78#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300)
79
80/*
81 * Register Map
82 */
83#define DDR_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x00000)
84#define DDR_WINDOW_CPU0_BASE (DDR_VIRT_BASE | 0x1500)
85#define DDR_WINDOW_CPU1_BASE (DDR_VIRT_BASE | 0x1700)
86
87#define DEV_BUS_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x10000)
88#define DEV_BUS_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x10000)
89#define SAMPLE_AT_RESET_LOW (DEV_BUS_VIRT_BASE | 0x0030)
90#define SAMPLE_AT_RESET_HIGH (DEV_BUS_VIRT_BASE | 0x0034)
91#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000)
92#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000)
93#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100)
94#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2100)
95#define UART2_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2200)
96#define UART2_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2200)
97#define UART3_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2300)
98#define UART3_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2300)
99
100#define GE10_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x30000)
101#define GE11_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x34000)
102
103#define PCIE00_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x40000)
104#define PCIE01_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x44000)
105#define PCIE02_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x48000)
106#define PCIE03_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x4c000)
107
108#define USB0_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x50000)
109#define USB1_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x51000)
110#define USB2_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x52000)
111
112#define GE00_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x70000)
113#define GE01_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x74000)
114
115#define PCIE10_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x80000)
116#define PCIE11_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x84000)
117#define PCIE12_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x88000)
118#define PCIE13_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x8c000)
119
120#define SATA_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0xa0000)
121
122
123#define GPIO_MAX 32
124
125
126#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/system.h b/arch/arm/mach-mv78xx0/include/mach/system.h
new file mode 100644
index 000000000000..7d5179408832
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/system.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/system.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_SYSTEM_H
10#define __ASM_ARCH_SYSTEM_H
11
12#include <mach/hardware.h>
13#include <mach/mv78xx0.h>
14
15static inline void arch_idle(void)
16{
17 cpu_do_idle();
18}
19
20static inline void arch_reset(char mode)
21{
22 /*
23 * Enable soft reset to assert RSTOUTn.
24 */
25 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
26
27 /*
28 * Assert soft reset.
29 */
30 writel(SOFT_RESET, SYSTEM_SOFT_RESET);
31
32 while (1)
33 ;
34}
35
36
37#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/timex.h b/arch/arm/mach-mv78xx0/include/mach/timex.h
new file mode 100644
index 000000000000..0e8c443c723a
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/timex.h
@@ -0,0 +1,9 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/timex.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#define CLOCK_TICK_RATE (100 * HZ)
diff --git a/arch/arm/mach-mv78xx0/include/mach/uncompress.h b/arch/arm/mach-mv78xx0/include/mach/uncompress.h
new file mode 100644
index 000000000000..365264298e79
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/uncompress.h
@@ -0,0 +1,47 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/uncompress.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/serial_reg.h>
10#include <mach/mv78xx0.h>
11
12#define SERIAL_BASE ((unsigned char *)UART0_PHYS_BASE)
13
14static void putc(const char c)
15{
16 unsigned char *base = SERIAL_BASE;
17 int i;
18
19 for (i = 0; i < 0x1000; i++) {
20 if (base[UART_LSR << 2] & UART_LSR_THRE)
21 break;
22 barrier();
23 }
24
25 base[UART_TX << 2] = c;
26}
27
28static void flush(void)
29{
30 unsigned char *base = SERIAL_BASE;
31 unsigned char mask;
32 int i;
33
34 mask = UART_LSR_TEMT | UART_LSR_THRE;
35
36 for (i = 0; i < 0x1000; i++) {
37 if ((base[UART_LSR << 2] & mask) == mask)
38 break;
39 barrier();
40 }
41}
42
43/*
44 * nothing to do
45 */
46#define arch_decomp_setup()
47#define arch_decomp_wdog()
diff --git a/arch/arm/mach-mv78xx0/include/mach/vmalloc.h b/arch/arm/mach-mv78xx0/include/mach/vmalloc.h
new file mode 100644
index 000000000000..1c4954386a84
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-mv78xx0/include/mach/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe000000
diff --git a/arch/arm/mach-mv78xx0/irq.c b/arch/arm/mach-mv78xx0/irq.c
index 60f4ee4d4532..3198abf54c90 100644
--- a/arch/arm/mach-mv78xx0/irq.c
+++ b/arch/arm/mach-mv78xx0/irq.c
@@ -11,7 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <asm/arch/mv78xx0.h> 14#include <mach/mv78xx0.h>
15#include <asm/plat-orion/irq.h> 15#include <asm/plat-orion/irq.h>
16#include "common.h" 16#include "common.h"
17 17
diff --git a/arch/arm/mach-mx2/clock_imx27.c b/arch/arm/mach-mx2/clock_imx27.c
index 0a29ef29c73a..c69896d011a1 100644
--- a/arch/arm/mach-mx2/clock_imx27.c
+++ b/arch/arm/mach-mx2/clock_imx27.c
@@ -22,10 +22,9 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24 24
25#include <asm/arch/clock.h> 25#include <mach/clock.h>
26#include <asm/arch/common.h> 26#include <mach/common.h>
27#include <asm/div64.h> 27#include <asm/div64.h>
28#include <asm/mach-types.h>
29 28
30#include "crm_regs.h" 29#include "crm_regs.h"
31 30
diff --git a/arch/arm/mach-mx2/cpu_imx27.c b/arch/arm/mach-mx2/cpu_imx27.c
index d6b5c2e3377f..239308fe6652 100644
--- a/arch/arm/mach-mx2/cpu_imx27.c
+++ b/arch/arm/mach-mx2/cpu_imx27.c
@@ -24,7 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/module.h> 25#include <linux/module.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28 28
29#include "crm_regs.h" 29#include "crm_regs.h"
30 30
diff --git a/arch/arm/mach-mx2/crm_regs.h b/arch/arm/mach-mx2/crm_regs.h
index a40a9b950ce9..94644cd0a0fc 100644
--- a/arch/arm/mach-mx2/crm_regs.h
+++ b/arch/arm/mach-mx2/crm_regs.h
@@ -20,7 +20,7 @@
20#ifndef __ARCH_ARM_MACH_MX2_CRM_REGS_H__ 20#ifndef __ARCH_ARM_MACH_MX2_CRM_REGS_H__
21#define __ARCH_ARM_MACH_MX2_CRM_REGS_H__ 21#define __ARCH_ARM_MACH_MX2_CRM_REGS_H__
22 22
23#include <asm/arch/hardware.h> 23#include <mach/hardware.h>
24 24
25/* Register offsets */ 25/* Register offsets */
26#define CCM_CSCR (IO_ADDRESS(CCM_BASE_ADDR) + 0x0) 26#define CCM_CSCR (IO_ADDRESS(CCM_BASE_ADDR) + 0x0)
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c
index a1f44c3c5315..bd0559d5933e 100644
--- a/arch/arm/mach-mx2/devices.c
+++ b/arch/arm/mach-mx2/devices.c
@@ -32,7 +32,7 @@
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/gpio.h> 33#include <linux/gpio.h>
34 34
35#include <asm/hardware.h> 35#include <mach/hardware.h>
36 36
37/* 37/*
38 * Resource definition for the MXC IrDA 38 * Resource definition for the MXC IrDA
diff --git a/arch/arm/mach-mx2/generic.c b/arch/arm/mach-mx2/generic.c
index 07875cf00de9..dea6521d4d5c 100644
--- a/arch/arm/mach-mx2/generic.c
+++ b/arch/arm/mach-mx2/generic.c
@@ -20,7 +20,7 @@
20 20
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
diff --git a/arch/arm/mach-mx2/mx27ads.c b/arch/arm/mach-mx2/mx27ads.c
index a9ff01fff137..4ce56ef4d8d3 100644
--- a/arch/arm/mach-mx2/mx27ads.c
+++ b/arch/arm/mach-mx2/mx27ads.c
@@ -23,16 +23,16 @@
23#include <linux/mtd/map.h> 23#include <linux/mtd/map.h>
24#include <linux/mtd/partitions.h> 24#include <linux/mtd/partitions.h>
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <asm/arch/common.h> 26#include <mach/common.h>
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30#include <asm/mach/time.h> 30#include <asm/mach/time.h>
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32#include <asm/arch/gpio.h> 32#include <mach/gpio.h>
33#include <asm/arch/imx-uart.h> 33#include <mach/imx-uart.h>
34#include <asm/arch/iomux-mx1-mx2.h> 34#include <mach/iomux-mx1-mx2.h>
35#include <asm/arch/board-mx27ads.h> 35#include <mach/board-mx27ads.h>
36 36
37/* ADS's NOR flash */ 37/* ADS's NOR flash */
38static struct physmap_flash_data mx27ads_flash_data = { 38static struct physmap_flash_data mx27ads_flash_data = {
diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c
index a9a28f58e714..1028f453cfc8 100644
--- a/arch/arm/mach-mx2/pcm038.c
+++ b/arch/arm/mach-mx2/pcm038.c
@@ -21,12 +21,12 @@
21#include <linux/mtd/physmap.h> 21#include <linux/mtd/physmap.h>
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/arch/common.h> 24#include <mach/common.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/arch/iomux-mx1-mx2.h> 26#include <mach/iomux-mx1-mx2.h>
27#include <asm/mach/time.h> 27#include <asm/mach/time.h>
28#include <asm/arch/imx-uart.h> 28#include <mach/imx-uart.h>
29#include <asm/arch/board-pcm038.h> 29#include <mach/board-pcm038.h>
30 30
31/* 31/*
32 * Phytec's phyCORE-i.MX27 comes with 32MiB flash, 32 * Phytec's phyCORE-i.MX27 comes with 32MiB flash,
diff --git a/arch/arm/mach-mx2/pcm970-baseboard.c b/arch/arm/mach-mx2/pcm970-baseboard.c
index 028ac4d33684..a560cd6ad23d 100644
--- a/arch/arm/mach-mx2/pcm970-baseboard.c
+++ b/arch/arm/mach-mx2/pcm970-baseboard.c
@@ -17,8 +17,7 @@
17 */ 17 */
18 18
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
23 22
24/* 23/*
diff --git a/arch/arm/mach-mx2/serial.c b/arch/arm/mach-mx2/serial.c
index 570c02b8e5df..e31fd44f7941 100644
--- a/arch/arm/mach-mx2/serial.c
+++ b/arch/arm/mach-mx2/serial.c
@@ -20,8 +20,8 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/serial.h> 22#include <linux/serial.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/arch/imx-uart.h> 24#include <mach/imx-uart.h>
25 25
26static struct resource uart0[] = { 26static struct resource uart0[] = {
27 { 27 {
diff --git a/arch/arm/mach-mx2/system.c b/arch/arm/mach-mx2/system.c
index 99304645299d..7b8269719d11 100644
--- a/arch/arm/mach-mx2/system.c
+++ b/arch/arm/mach-mx2/system.c
@@ -23,7 +23,7 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <asm/arch/hardware.h> 26#include <mach/hardware.h>
27#include <asm/proc-fns.h> 27#include <asm/proc-fns.h>
28#include <asm/system.h> 28#include <asm/system.h>
29 29
diff --git a/arch/arm/mach-mx3/clock.c b/arch/arm/mach-mx3/clock.c
index 2f3635943e70..9f14a871ee7c 100644
--- a/arch/arm/mach-mx3/clock.c
+++ b/arch/arm/mach-mx3/clock.c
@@ -23,7 +23,7 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <asm/arch/clock.h> 26#include <mach/clock.h>
27#include <asm/div64.h> 27#include <asm/div64.h>
28 28
29#include "crm_regs.h" 29#include "crm_regs.h"
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index 5c0320fce5b6..e08c6a8ac56b 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -21,8 +21,8 @@
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/serial.h> 22#include <linux/serial.h>
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/arch/imx-uart.h> 25#include <mach/imx-uart.h>
26 26
27static struct resource uart0[] = { 27static struct resource uart0[] = {
28 { 28 {
diff --git a/arch/arm/mach-mx3/iomux.c b/arch/arm/mach-mx3/iomux.c
index adc51feefc1d..3dda1fe23cbf 100644
--- a/arch/arm/mach-mx3/iomux.c
+++ b/arch/arm/mach-mx3/iomux.c
@@ -21,9 +21,9 @@
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/arch/gpio.h> 25#include <mach/gpio.h>
26#include <asm/arch/iomux-mx3.h> 26#include <mach/iomux-mx3.h>
27 27
28/* 28/*
29 * IOMUX register (base) addresses 29 * IOMUX register (base) addresses
diff --git a/arch/arm/mach-mx3/mm.c b/arch/arm/mach-mx3/mm.c
index 41dad485ded9..30d842bd4d64 100644
--- a/arch/arm/mach-mx3/mm.c
+++ b/arch/arm/mach-mx3/mm.c
@@ -22,10 +22,10 @@
22 22
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/arch/common.h> 28#include <mach/common.h>
29 29
30/*! 30/*!
31 * @file mm.c 31 * @file mm.c
diff --git a/arch/arm/mach-mx3/mx31ads.c b/arch/arm/mach-mx3/mx31ads.c
index eba3e0cd4283..60fb4e0d5acd 100644
--- a/arch/arm/mach-mx3/mx31ads.c
+++ b/arch/arm/mach-mx3/mx31ads.c
@@ -23,14 +23,14 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/serial_8250.h> 24#include <linux/serial_8250.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/time.h> 29#include <asm/mach/time.h>
30#include <asm/memory.h> 30#include <asm/memory.h>
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32#include <asm/arch/common.h> 32#include <mach/common.h>
33#include <asm/arch/board-mx31ads.h> 33#include <mach/board-mx31ads.h>
34 34
35/*! 35/*!
36 * @file mx31ads.c 36 * @file mx31ads.c
diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c
index 1372c1a1fc3f..d363a6e79f80 100644
--- a/arch/arm/mach-mx3/mx31lite.c
+++ b/arch/arm/mach-mx3/mx31lite.c
@@ -23,15 +23,15 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/memory.h> 24#include <linux/memory.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/time.h> 29#include <asm/mach/time.h>
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31#include <asm/arch/common.h> 31#include <mach/common.h>
32#include <asm/page.h> 32#include <asm/page.h>
33#include <asm/setup.h> 33#include <asm/setup.h>
34#include <asm/arch/board-mx31lite.h> 34#include <mach/board-mx31lite.h>
35 35
36/* 36/*
37 * This file contains the board-specific initialization routines. 37 * This file contains the board-specific initialization routines.
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index a34ae6de266f..0a152ed15a85 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -23,15 +23,15 @@
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/memory.h> 24#include <linux/memory.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/time.h> 29#include <asm/mach/time.h>
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31#include <asm/arch/common.h> 31#include <mach/common.h>
32#include <asm/arch/imx-uart.h> 32#include <mach/imx-uart.h>
33#include <asm/arch/iomux-mx3.h> 33#include <mach/iomux-mx3.h>
34#include <asm/arch/board-pcm037.h> 34#include <mach/board-pcm037.h>
35 35
36static struct physmap_flash_data pcm037_flash_data = { 36static struct physmap_flash_data pcm037_flash_data = {
37 .width = 2, 37 .width = 2,
diff --git a/arch/arm/mach-netx/fb.c b/arch/arm/mach-netx/fb.c
index ef0ab6115c0b..24c79650f9f3 100644
--- a/arch/arm/mach-netx/fb.c
+++ b/arch/arm/mach-netx/fb.c
@@ -23,8 +23,8 @@
23#include <linux/amba/bus.h> 23#include <linux/amba/bus.h>
24#include <linux/amba/clcd.h> 24#include <linux/amba/clcd.h>
25 25
26#include <asm/arch/netx-regs.h> 26#include <mach/netx-regs.h>
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28 28
29struct clk {}; 29struct clk {};
30 30
diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
index 99d4fb19a08a..1b40483ea753 100644
--- a/arch/arm/mach-netx/generic.c
+++ b/arch/arm/mach-netx/generic.c
@@ -22,11 +22,11 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/hardware/vic.h> 27#include <asm/hardware/vic.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/arch/netx-regs.h> 29#include <mach/netx-regs.h>
30#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
31 31
32static struct map_desc netx_io_desc[] __initdata = { 32static struct map_desc netx_io_desc[] __initdata = {
diff --git a/arch/arm/mach-netx/include/mach/debug-macro.S b/arch/arm/mach-netx/include/mach/debug-macro.S
new file mode 100644
index 000000000000..11b9d5b46390
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/debug-macro.S
@@ -0,0 +1,38 @@
1/* arch/arm/mach-netx/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#include "hardware.h"
15
16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0
18 tst \rx, #1 @ MMU enabled?
19 moveq \rx, #0x00100000 @ physical
20 movne \rx, #io_p2v(0x00100000) @ virtual
21 orr \rx, \rx, #0x00000a00
22 .endm
23
24 .macro senduart,rd,rx
25 str \rd, [\rx, #0]
26 .endm
27
28 .macro busyuart,rd,rx
291002: ldr \rd, [\rx, #0x18]
30 tst \rd, #(1 << 3)
31 bne 1002b
32 .endm
33
34 .macro waituart,rd,rx
351001: ldr \rd, [\rx, #0x18]
36 tst \rd, #(1 << 3)
37 bne 1001b
38 .endm
diff --git a/arch/arm/mach-netx/include/mach/dma.h b/arch/arm/mach-netx/include/mach/dma.h
new file mode 100644
index 000000000000..690b3ebc43ac
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/dma.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-netx/include/mach/dma.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#define MAX_DMA_CHANNELS 0
21#define MAX_DMA_ADDRESS ~0
diff --git a/arch/arm/mach-netx/include/mach/entry-macro.S b/arch/arm/mach-netx/include/mach/entry-macro.S
new file mode 100644
index 000000000000..a1952a0feda6
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/entry-macro.S
@@ -0,0 +1,41 @@
1/*
2 * arch/arm/mach-netx/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Hilscher netX based platforms
5 *
6 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
10 * as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <mach/hardware.h>
22
23 .macro disable_fiq
24 .endm
25
26 .macro get_irqnr_preamble, base, tmp
27 .endm
28
29 .macro arch_ret_to_user, tmp1, tmp2
30 .endm
31
32 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
33 mov \base, #io_p2v(0x00100000)
34 add \base, \base, #0x000ff000
35
36 ldr \irqstat, [\base, #0]
37 clz \irqnr, \irqstat
38 rsb \irqnr, \irqnr, #31
39 cmp \irqstat, #0
40 .endm
41
diff --git a/arch/arm/mach-netx/include/mach/eth.h b/arch/arm/mach-netx/include/mach/eth.h
new file mode 100644
index 000000000000..88af1ac28ead
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/eth.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-netx/include/mach/eth.h
3 *
4 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef ASMARM_ARCH_ETH_H
21#define ASMARM_ARCH_ETH_H
22
23struct netxeth_platform_data {
24 unsigned int xcno; /* number of xmac/xpec engine this eth uses */
25};
26
27#endif
diff --git a/arch/arm/mach-netx/include/mach/hardware.h b/arch/arm/mach-netx/include/mach/hardware.h
new file mode 100644
index 000000000000..517a2bd37842
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/hardware.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-netx/include/mach/hardware.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __ASM_ARCH_HARDWARE_H
20#define __ASM_ARCH_HARDWARE_H
21
22#define NETX_IO_PHYS 0x00100000
23#define NETX_IO_VIRT 0xe0000000
24#define NETX_IO_SIZE 0x00100000
25
26#define SRAM_INTERNAL_PHYS_0 0x00000
27#define SRAM_INTERNAL_PHYS_1 0x08000
28#define SRAM_INTERNAL_PHYS_2 0x10000
29#define SRAM_INTERNAL_PHYS_3 0x18000
30#define SRAM_INTERNAL_PHYS(no) ((no) * 0x8000)
31
32#define XPEC_MEM_SIZE 0x4000
33#define XMAC_MEM_SIZE 0x1000
34#define SRAM_MEM_SIZE 0x8000
35
36#define io_p2v(x) ((x) - NETX_IO_PHYS + NETX_IO_VIRT)
37#define io_v2p(x) ((x) - NETX_IO_VIRT + NETX_IO_PHYS)
38
39#endif
diff --git a/arch/arm/mach-netx/include/mach/io.h b/arch/arm/mach-netx/include/mach/io.h
new file mode 100644
index 000000000000..468b92a82585
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/io.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-netx/include/mach/io.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define IO_SPACE_LIMIT 0xffffffff
24
25#define __io(a) ((void __iomem *)(a))
26#define __mem_pci(a) (a)
27
28#endif
diff --git a/arch/arm/mach-netx/include/mach/irqs.h b/arch/arm/mach-netx/include/mach/irqs.h
new file mode 100644
index 000000000000..6ce914d54a30
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/irqs.h
@@ -0,0 +1,70 @@
1/*
2 * arch/arm/mach-netx/include/mach/irqs.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#define NETX_IRQ_VIC_START 0
21#define NETX_IRQ_SOFTINT 0
22#define NETX_IRQ_TIMER0 1
23#define NETX_IRQ_TIMER1 2
24#define NETX_IRQ_TIMER2 3
25#define NETX_IRQ_SYSTIME_NS 4
26#define NETX_IRQ_SYSTIME_S 5
27#define NETX_IRQ_GPIO_15 6
28#define NETX_IRQ_WATCHDOG 7
29#define NETX_IRQ_UART0 8
30#define NETX_IRQ_UART1 9
31#define NETX_IRQ_UART2 10
32#define NETX_IRQ_USB 11
33#define NETX_IRQ_SPI 12
34#define NETX_IRQ_I2C 13
35#define NETX_IRQ_LCD 14
36#define NETX_IRQ_HIF 15
37#define NETX_IRQ_GPIO_0_14 16
38#define NETX_IRQ_XPEC0 17
39#define NETX_IRQ_XPEC1 18
40#define NETX_IRQ_XPEC2 19
41#define NETX_IRQ_XPEC3 20
42#define NETX_IRQ_XPEC(no) (17 + (no))
43#define NETX_IRQ_MSYNC0 21
44#define NETX_IRQ_MSYNC1 22
45#define NETX_IRQ_MSYNC2 23
46#define NETX_IRQ_MSYNC3 24
47#define NETX_IRQ_IRQ_PHY 25
48#define NETX_IRQ_ISO_AREA 26
49/* int 27 is reserved */
50/* int 28 is reserved */
51#define NETX_IRQ_TIMER3 29
52#define NETX_IRQ_TIMER4 30
53/* int 31 is reserved */
54
55#define NETX_IRQS 32
56
57/* for multiplexed irqs on gpio 0..14 */
58#define NETX_IRQ_GPIO(x) (NETX_IRQS + (x))
59#define NETX_IRQ_GPIO_LAST NETX_IRQ_GPIO(14)
60
61/* Host interface interrupts */
62#define NETX_IRQ_HIF_CHAINED(x) (NETX_IRQ_GPIO_LAST + 1 + (x))
63#define NETX_IRQ_HIF_PIO35 NETX_IRQ_HIF_CHAINED(0)
64#define NETX_IRQ_HIF_PIO36 NETX_IRQ_HIF_CHAINED(1)
65#define NETX_IRQ_HIF_PIO40 NETX_IRQ_HIF_CHAINED(2)
66#define NETX_IRQ_HIF_PIO47 NETX_IRQ_HIF_CHAINED(3)
67#define NETX_IRQ_HIF_PIO72 NETX_IRQ_HIF_CHAINED(4)
68#define NETX_IRQ_HIF_LAST NETX_IRQ_HIF_CHAINED(4)
69
70#define NR_IRQS (NETX_IRQ_HIF_LAST + 1)
diff --git a/arch/arm/mach-netx/include/mach/memory.h b/arch/arm/mach-netx/include/mach/memory.h
new file mode 100644
index 000000000000..53745a1378de
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/memory.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/mach-netx/include/mach/memory.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H
22
23#define PHYS_OFFSET UL(0x80000000)
24
25/*
26 * Virtual view <-> DMA view memory address translations
27 * virt_to_bus: Used to translate the virtual address to an
28 * address suitable to be passed to set_dma_addr
29 * bus_to_virt: Used to convert an address for DMA operations
30 * to an address that the kernel can use.
31 */
32#define __virt_to_bus(x) __virt_to_phys(x)
33#define __bus_to_virt(x) __phys_to_virt(x)
34
35#endif
36
diff --git a/arch/arm/mach-netx/include/mach/netx-regs.h b/arch/arm/mach-netx/include/mach/netx-regs.h
new file mode 100644
index 000000000000..5104a00d40f4
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/netx-regs.h
@@ -0,0 +1,410 @@
1/*
2 * arch/arm/mach-netx/include/mach/netx-regs.h
3 *
4 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __ASM_ARCH_NETX_REGS_H
21#define __ASM_ARCH_NETX_REGS_H
22
23/* offsets relative to the beginning of the io space */
24#define NETX_OFS_SYSTEM 0x00000
25#define NETX_OFS_MEMCR 0x00100
26#define NETX_OFS_DPMAS 0x03000
27#define NETX_OFS_GPIO 0x00800
28#define NETX_OFS_PIO 0x00900
29#define NETX_OFS_UART0 0x00a00
30#define NETX_OFS_UART1 0x00a40
31#define NETX_OFS_UART2 0x00a80
32#define NETX_OF_MIIMU 0x00b00
33#define NETX_OFS_SPI 0x00c00
34#define NETX_OFS_I2C 0x00d00
35#define NETX_OFS_SYSTIME 0x01100
36#define NETX_OFS_RTC 0x01200
37#define NETX_OFS_EXTBUS 0x03600
38#define NETX_OFS_LCD 0x04000
39#define NETX_OFS_USB 0x20000
40#define NETX_OFS_XMAC0 0x60000
41#define NETX_OFS_XMAC1 0x61000
42#define NETX_OFS_XMAC2 0x62000
43#define NETX_OFS_XMAC3 0x63000
44#define NETX_OFS_XMAC(no) (0x60000 + (no) * 0x1000)
45#define NETX_OFS_PFIFO 0x64000
46#define NETX_OFS_XPEC0 0x70000
47#define NETX_OFS_XPEC1 0x74000
48#define NETX_OFS_XPEC2 0x78000
49#define NETX_OFS_XPEC3 0x7c000
50#define NETX_OFS_XPEC(no) (0x70000 + (no) * 0x4000)
51#define NETX_OFS_VIC 0xff000
52
53/* physical addresses */
54#define NETX_PA_SYSTEM (NETX_IO_PHYS + NETX_OFS_SYSTEM)
55#define NETX_PA_MEMCR (NETX_IO_PHYS + NETX_OFS_MEMCR)
56#define NETX_PA_DPMAS (NETX_IO_PHYS + NETX_OFS_DPMAS)
57#define NETX_PA_GPIO (NETX_IO_PHYS + NETX_OFS_GPIO)
58#define NETX_PA_PIO (NETX_IO_PHYS + NETX_OFS_PIO)
59#define NETX_PA_UART0 (NETX_IO_PHYS + NETX_OFS_UART0)
60#define NETX_PA_UART1 (NETX_IO_PHYS + NETX_OFS_UART1)
61#define NETX_PA_UART2 (NETX_IO_PHYS + NETX_OFS_UART2)
62#define NETX_PA_MIIMU (NETX_IO_PHYS + NETX_OF_MIIMU)
63#define NETX_PA_SPI (NETX_IO_PHYS + NETX_OFS_SPI)
64#define NETX_PA_I2C (NETX_IO_PHYS + NETX_OFS_I2C)
65#define NETX_PA_SYSTIME (NETX_IO_PHYS + NETX_OFS_SYSTIME)
66#define NETX_PA_RTC (NETX_IO_PHYS + NETX_OFS_RTC)
67#define NETX_PA_EXTBUS (NETX_IO_PHYS + NETX_OFS_EXTBUS)
68#define NETX_PA_LCD (NETX_IO_PHYS + NETX_OFS_LCD)
69#define NETX_PA_USB (NETX_IO_PHYS + NETX_OFS_USB)
70#define NETX_PA_XMAC0 (NETX_IO_PHYS + NETX_OFS_XMAC0)
71#define NETX_PA_XMAC1 (NETX_IO_PHYS + NETX_OFS_XMAC1)
72#define NETX_PA_XMAC2 (NETX_IO_PHYS + NETX_OFS_XMAC2)
73#define NETX_PA_XMAC3 (NETX_IO_PHYS + NETX_OFS_XMAC3)
74#define NETX_PA_XMAC(no) (NETX_IO_PHYS + NETX_OFS_XMAC(no))
75#define NETX_PA_PFIFO (NETX_IO_PHYS + NETX_OFS_PFIFO)
76#define NETX_PA_XPEC0 (NETX_IO_PHYS + NETX_OFS_XPEC0)
77#define NETX_PA_XPEC1 (NETX_IO_PHYS + NETX_OFS_XPEC1)
78#define NETX_PA_XPEC2 (NETX_IO_PHYS + NETX_OFS_XPEC2)
79#define NETX_PA_XPEC3 (NETX_IO_PHYS + NETX_OFS_XPEC3)
80#define NETX_PA_XPEC(no) (NETX_IO_PHYS + NETX_OFS_XPEC(no))
81#define NETX_PA_VIC (NETX_IO_PHYS + NETX_OFS_VIC)
82
83/* virual addresses */
84#define NETX_VA_SYSTEM (NETX_IO_VIRT + NETX_OFS_SYSTEM)
85#define NETX_VA_MEMCR (NETX_IO_VIRT + NETX_OFS_MEMCR)
86#define NETX_VA_DPMAS (NETX_IO_VIRT + NETX_OFS_DPMAS)
87#define NETX_VA_GPIO (NETX_IO_VIRT + NETX_OFS_GPIO)
88#define NETX_VA_PIO (NETX_IO_VIRT + NETX_OFS_PIO)
89#define NETX_VA_UART0 (NETX_IO_VIRT + NETX_OFS_UART0)
90#define NETX_VA_UART1 (NETX_IO_VIRT + NETX_OFS_UART1)
91#define NETX_VA_UART2 (NETX_IO_VIRT + NETX_OFS_UART2)
92#define NETX_VA_MIIMU (NETX_IO_VIRT + NETX_OF_MIIMU)
93#define NETX_VA_SPI (NETX_IO_VIRT + NETX_OFS_SPI)
94#define NETX_VA_I2C (NETX_IO_VIRT + NETX_OFS_I2C)
95#define NETX_VA_SYSTIME (NETX_IO_VIRT + NETX_OFS_SYSTIME)
96#define NETX_VA_RTC (NETX_IO_VIRT + NETX_OFS_RTC)
97#define NETX_VA_EXTBUS (NETX_IO_VIRT + NETX_OFS_EXTBUS)
98#define NETX_VA_LCD (NETX_IO_VIRT + NETX_OFS_LCD)
99#define NETX_VA_USB (NETX_IO_VIRT + NETX_OFS_USB)
100#define NETX_VA_XMAC0 (NETX_IO_VIRT + NETX_OFS_XMAC0)
101#define NETX_VA_XMAC1 (NETX_IO_VIRT + NETX_OFS_XMAC1)
102#define NETX_VA_XMAC2 (NETX_IO_VIRT + NETX_OFS_XMAC2)
103#define NETX_VA_XMAC3 (NETX_IO_VIRT + NETX_OFS_XMAC3)
104#define NETX_VA_XMAC(no) (NETX_IO_VIRT + NETX_OFS_XMAC(no))
105#define NETX_VA_PFIFO (NETX_IO_VIRT + NETX_OFS_PFIFO)
106#define NETX_VA_XPEC0 (NETX_IO_VIRT + NETX_OFS_XPEC0)
107#define NETX_VA_XPEC1 (NETX_IO_VIRT + NETX_OFS_XPEC1)
108#define NETX_VA_XPEC2 (NETX_IO_VIRT + NETX_OFS_XPEC2)
109#define NETX_VA_XPEC3 (NETX_IO_VIRT + NETX_OFS_XPEC3)
110#define NETX_VA_XPEC(no) (NETX_IO_VIRT + NETX_OFS_XPEC(no))
111#define NETX_VA_VIC (NETX_IO_VIRT + NETX_OFS_VIC)
112
113/*********************************
114 * System functions *
115 *********************************/
116
117/* Registers */
118#define NETX_SYSTEM_REG(ofs) __io(NETX_VA_SYSTEM + (ofs))
119#define NETX_SYSTEM_BOO_SR NETX_SYSTEM_REG(0x00)
120#define NETX_SYSTEM_IOC_CR NETX_SYSTEM_REG(0x04)
121#define NETX_SYSTEM_IOC_MR NETX_SYSTEM_REG(0x08)
122
123/* FIXME: Docs are not consistent */
124/* #define NETX_SYSTEM_RES_CR NETX_SYSTEM_REG(0x08) */
125#define NETX_SYSTEM_RES_CR NETX_SYSTEM_REG(0x0c)
126
127#define NETX_SYSTEM_PHY_CONTROL NETX_SYSTEM_REG(0x10)
128#define NETX_SYSTEM_REV NETX_SYSTEM_REG(0x34)
129#define NETX_SYSTEM_IOC_ACCESS_KEY NETX_SYSTEM_REG(0x70)
130#define NETX_SYSTEM_WDG_TR NETX_SYSTEM_REG(0x200)
131#define NETX_SYSTEM_WDG_CTR NETX_SYSTEM_REG(0x204)
132#define NETX_SYSTEM_WDG_IRQ_TIMEOUT NETX_SYSTEM_REG(0x208)
133#define NETX_SYSTEM_WDG_RES_TIMEOUT NETX_SYSTEM_REG(0x20c)
134
135/* Bits */
136#define NETX_SYSTEM_RES_CR_RSTIN (1<<0)
137#define NETX_SYSTEM_RES_CR_WDG_RES (1<<1)
138#define NETX_SYSTEM_RES_CR_HOST_RES (1<<2)
139#define NETX_SYSTEM_RES_CR_FIRMW_RES (1<<3)
140#define NETX_SYSTEM_RES_CR_XPEC0_RES (1<<4)
141#define NETX_SYSTEM_RES_CR_XPEC1_RES (1<<5)
142#define NETX_SYSTEM_RES_CR_XPEC2_RES (1<<6)
143#define NETX_SYSTEM_RES_CR_XPEC3_RES (1<<7)
144#define NETX_SYSTEM_RES_CR_DIS_XPEC0_RES (1<<16)
145#define NETX_SYSTEM_RES_CR_DIS_XPEC1_RES (1<<17)
146#define NETX_SYSTEM_RES_CR_DIS_XPEC2_RES (1<<18)
147#define NETX_SYSTEM_RES_CR_DIS_XPEC3_RES (1<<19)
148#define NETX_SYSTEM_RES_CR_FIRMW_FLG0 (1<<20)
149#define NETX_SYSTEM_RES_CR_FIRMW_FLG1 (1<<21)
150#define NETX_SYSTEM_RES_CR_FIRMW_FLG2 (1<<22)
151#define NETX_SYSTEM_RES_CR_FIRMW_FLG3 (1<<23)
152#define NETX_SYSTEM_RES_CR_FIRMW_RES_EN (1<<24)
153#define NETX_SYSTEM_RES_CR_RSTOUT (1<<25)
154#define NETX_SYSTEM_RES_CR_EN_RSTOUT (1<<26)
155
156#define PHY_CONTROL_RESET (1<<31)
157#define PHY_CONTROL_SIM_BYP (1<<30)
158#define PHY_CONTROL_CLK_XLATIN (1<<29)
159#define PHY_CONTROL_PHY1_EN (1<<21)
160#define PHY_CONTROL_PHY1_NP_MSG_CODE
161#define PHY_CONTROL_PHY1_AUTOMDIX (1<<17)
162#define PHY_CONTROL_PHY1_FIXMODE (1<<16)
163#define PHY_CONTROL_PHY1_MODE(mode) (((mode) & 0x7) << 13)
164#define PHY_CONTROL_PHY0_EN (1<<12)
165#define PHY_CONTROL_PHY0_NP_MSG_CODE
166#define PHY_CONTROL_PHY0_AUTOMDIX (1<<8)
167#define PHY_CONTROL_PHY0_FIXMODE (1<<7)
168#define PHY_CONTROL_PHY0_MODE(mode) (((mode) & 0x7) << 4)
169#define PHY_CONTROL_PHY_ADDRESS(adr) ((adr) & 0xf)
170
171#define PHY_MODE_10BASE_T_HALF 0
172#define PHY_MODE_10BASE_T_FULL 1
173#define PHY_MODE_100BASE_TX_FX_FULL 2
174#define PHY_MODE_100BASE_TX_FX_HALF 3
175#define PHY_MODE_100BASE_TX_HALF 4
176#define PHY_MODE_REPEATER 5
177#define PHY_MODE_POWER_DOWN 6
178#define PHY_MODE_ALL 7
179
180/* Bits */
181#define VECT_CNTL_ENABLE (1 << 5)
182
183/*******************************
184 * GPIO and timer module *
185 *******************************/
186
187/* Registers */
188#define NETX_GPIO_REG(ofs) __io(NETX_VA_GPIO + (ofs))
189#define NETX_GPIO_CFG(gpio) NETX_GPIO_REG(0x0 + ((gpio)<<2))
190#define NETX_GPIO_THRESHOLD_CAPTURE(gpio) NETX_GPIO_REG(0x40 + ((gpio)<<2))
191#define NETX_GPIO_COUNTER_CTRL(counter) NETX_GPIO_REG(0x80 + ((counter)<<2))
192#define NETX_GPIO_COUNTER_MAX(counter) NETX_GPIO_REG(0x94 + ((counter)<<2))
193#define NETX_GPIO_COUNTER_CURRENT(counter) NETX_GPIO_REG(0xa8 + ((counter)<<2))
194#define NETX_GPIO_IRQ_ENABLE NETX_GPIO_REG(0xbc)
195#define NETX_GPIO_IRQ_DISABLE NETX_GPIO_REG(0xc0)
196#define NETX_GPIO_SYSTIME_NS_CMP NETX_GPIO_REG(0xc4)
197#define NETX_GPIO_LINE NETX_GPIO_REG(0xc8)
198#define NETX_GPIO_IRQ NETX_GPIO_REG(0xd0)
199
200/* Bits */
201#define NETX_GPIO_CFG_IOCFG_GP_INPUT (0x0)
202#define NETX_GPIO_CFG_IOCFG_GP_OUTPUT (0x1)
203#define NETX_GPIO_CFG_IOCFG_GP_UART (0x2)
204#define NETX_GPIO_CFG_INV (1<<2)
205#define NETX_GPIO_CFG_MODE_INPUT_READ (0<<3)
206#define NETX_GPIO_CFG_MODE_INPUT_CAPTURE_CONT_RISING (1<<3)
207#define NETX_GPIO_CFG_MODE_INPUT_CAPTURE_ONCE_RISING (2<<3)
208#define NETX_GPIO_CFG_MODE_INPUT_CAPTURE_HIGH_LEVEL (3<<3)
209#define NETX_GPIO_CFG_COUNT_REF_COUNTER0 (0<<5)
210#define NETX_GPIO_CFG_COUNT_REF_COUNTER1 (1<<5)
211#define NETX_GPIO_CFG_COUNT_REF_COUNTER2 (2<<5)
212#define NETX_GPIO_CFG_COUNT_REF_COUNTER3 (3<<5)
213#define NETX_GPIO_CFG_COUNT_REF_COUNTER4 (4<<5)
214#define NETX_GPIO_CFG_COUNT_REF_SYSTIME (7<<5)
215
216#define NETX_GPIO_COUNTER_CTRL_RUN (1<<0)
217#define NETX_GPIO_COUNTER_CTRL_SYM (1<<1)
218#define NETX_GPIO_COUNTER_CTRL_ONCE (1<<2)
219#define NETX_GPIO_COUNTER_CTRL_IRQ_EN (1<<3)
220#define NETX_GPIO_COUNTER_CTRL_CNT_EVENT (1<<4)
221#define NETX_GPIO_COUNTER_CTRL_RST_EN (1<<5)
222#define NETX_GPIO_COUNTER_CTRL_SEL_EVENT (1<<6)
223#define NETX_GPIO_COUNTER_CTRL_GPIO_REF /* FIXME */
224
225#define GPIO_BIT(gpio) (1<<(gpio))
226#define COUNTER_BIT(counter) ((1<<16)<<(counter))
227
228/*******************************
229 * PIO *
230 *******************************/
231
232/* Registers */
233#define NETX_PIO_REG(ofs) __io(NETX_VA_PIO + (ofs))
234#define NETX_PIO_INPIO NETX_PIO_REG(0x0)
235#define NETX_PIO_OUTPIO NETX_PIO_REG(0x4)
236#define NETX_PIO_OEPIO NETX_PIO_REG(0x8)
237
238/*******************************
239 * MII Unit *
240 *******************************/
241
242/* Registers */
243#define NETX_MIIMU __io(NETX_VA_MIIMU)
244
245/* Bits */
246#define MIIMU_SNRDY (1<<0)
247#define MIIMU_PREAMBLE (1<<1)
248#define MIIMU_OPMODE_WRITE (1<<2)
249#define MIIMU_MDC_PERIOD (1<<3)
250#define MIIMU_PHY_NRES (1<<4)
251#define MIIMU_RTA (1<<5)
252#define MIIMU_REGADDR(adr) (((adr) & 0x1f) << 6)
253#define MIIMU_PHYADDR(adr) (((adr) & 0x1f) << 11)
254#define MIIMU_DATA(data) (((data) & 0xffff) << 16)
255
256/*******************************
257 * xmac / xpec *
258 *******************************/
259
260/* XPEC register offsets relative to NETX_VA_XPEC(no) */
261#define NETX_XPEC_R0_OFS 0x00
262#define NETX_XPEC_R1_OFS 0x04
263#define NETX_XPEC_R2_OFS 0x08
264#define NETX_XPEC_R3_OFS 0x0c
265#define NETX_XPEC_R4_OFS 0x10
266#define NETX_XPEC_R5_OFS 0x14
267#define NETX_XPEC_R6_OFS 0x18
268#define NETX_XPEC_R7_OFS 0x1c
269#define NETX_XPEC_RANGE01_OFS 0x20
270#define NETX_XPEC_RANGE23_OFS 0x24
271#define NETX_XPEC_RANGE45_OFS 0x28
272#define NETX_XPEC_RANGE67_OFS 0x2c
273#define NETX_XPEC_PC_OFS 0x48
274#define NETX_XPEC_TIMER_OFS(timer) (0x30 + ((timer)<<2))
275#define NETX_XPEC_IRQ_OFS 0x8c
276#define NETX_XPEC_SYSTIME_NS_OFS 0x90
277#define NETX_XPEC_FIFO_DATA_OFS 0x94
278#define NETX_XPEC_SYSTIME_S_OFS 0x98
279#define NETX_XPEC_ADC_OFS 0x9c
280#define NETX_XPEC_URX_COUNT_OFS 0x40
281#define NETX_XPEC_UTX_COUNT_OFS 0x44
282#define NETX_XPEC_PC_OFS 0x48
283#define NETX_XPEC_ZERO_OFS 0x4c
284#define NETX_XPEC_STATCFG_OFS 0x50
285#define NETX_XPEC_EC_MASKA_OFS 0x54
286#define NETX_XPEC_EC_MASKB_OFS 0x58
287#define NETX_XPEC_EC_MASK0_OFS 0x5c
288#define NETX_XPEC_EC_MASK8_OFS 0x7c
289#define NETX_XPEC_EC_MASK9_OFS 0x80
290#define NETX_XPEC_XPU_HOLD_PC_OFS 0x100
291#define NETX_XPEC_RAM_START_OFS 0x2000
292
293/* Bits */
294#define XPU_HOLD_PC (1<<0)
295
296/* XMAC register offsets relative to NETX_VA_XMAC(no) */
297#define NETX_XMAC_RPU_PROGRAM_START_OFS 0x000
298#define NETX_XMAC_RPU_PROGRAM_END_OFS 0x3ff
299#define NETX_XMAC_TPU_PROGRAM_START_OFS 0x400
300#define NETX_XMAC_TPU_PROGRAM_END_OFS 0x7ff
301#define NETX_XMAC_RPU_HOLD_PC_OFS 0xa00
302#define NETX_XMAC_TPU_HOLD_PC_OFS 0xa04
303#define NETX_XMAC_STATUS_SHARED0_OFS 0x840
304#define NETX_XMAC_CONFIG_SHARED0_OFS 0x844
305#define NETX_XMAC_STATUS_SHARED1_OFS 0x848
306#define NETX_XMAC_CONFIG_SHARED1_OFS 0x84c
307#define NETX_XMAC_STATUS_SHARED2_OFS 0x850
308#define NETX_XMAC_CONFIG_SHARED2_OFS 0x854
309#define NETX_XMAC_STATUS_SHARED3_OFS 0x858
310#define NETX_XMAC_CONFIG_SHARED3_OFS 0x85c
311
312#define RPU_HOLD_PC (1<<15)
313#define TPU_HOLD_PC (1<<15)
314
315/*******************************
316 * Pointer FIFO *
317 *******************************/
318
319/* Registers */
320#define NETX_PFIFO_REG(ofs) __io(NETX_VA_PFIFO + (ofs))
321#define NETX_PFIFO_BASE(pfifo) NETX_PFIFO_REG(0x00 + ((pfifo)<<2))
322#define NETX_PFIFO_BORDER_BASE(pfifo) NETX_PFIFO_REG(0x80 + ((pfifo)<<2))
323#define NETX_PFIFO_RESET NETX_PFIFO_REG(0x100)
324#define NETX_PFIFO_FULL NETX_PFIFO_REG(0x104)
325#define NETX_PFIFO_EMPTY NETX_PFIFO_REG(0x108)
326#define NETX_PFIFO_OVEFLOW NETX_PFIFO_REG(0x10c)
327#define NETX_PFIFO_UNDERRUN NETX_PFIFO_REG(0x110)
328#define NETX_PFIFO_FILL_LEVEL(pfifo) NETX_PFIFO_REG(0x180 + ((pfifo)<<2))
329#define NETX_PFIFO_XPEC_ISR(xpec) NETX_PFIFO_REG(0x400 + ((xpec) << 2))
330
331/*******************************
332 * Dual Port Memory *
333 *******************************/
334
335/* Registers */
336#define NETX_DPMAS_REG(ofs) __io(NETX_VA_DPMAS + (ofs))
337#define NETX_DPMAS_SYS_STAT NETX_DPMAS_REG(0x4d8)
338#define NETX_DPMAS_INT_STAT NETX_DPMAS_REG(0x4e0)
339#define NETX_DPMAS_INT_EN NETX_DPMAS_REG(0x4f0)
340#define NETX_DPMAS_IF_CONF0 NETX_DPMAS_REG(0x608)
341#define NETX_DPMAS_IF_CONF1 NETX_DPMAS_REG(0x60c)
342#define NETX_DPMAS_EXT_CONFIG(cs) NETX_DPMAS_REG(0x610 + 4 * (cs))
343#define NETX_DPMAS_IO_MODE0 NETX_DPMAS_REG(0x620) /* I/O 32..63 */
344#define NETX_DPMAS_DRV_EN0 NETX_DPMAS_REG(0x624)
345#define NETX_DPMAS_DATA0 NETX_DPMAS_REG(0x628)
346#define NETX_DPMAS_IO_MODE1 NETX_DPMAS_REG(0x630) /* I/O 64..84 */
347#define NETX_DPMAS_DRV_EN1 NETX_DPMAS_REG(0x634)
348#define NETX_DPMAS_DATA1 NETX_DPMAS_REG(0x638)
349
350/* Bits */
351#define NETX_DPMAS_INT_EN_GLB_EN (1<<31)
352#define NETX_DPMAS_INT_EN_MEM_LCK (1<<30)
353#define NETX_DPMAS_INT_EN_WDG (1<<29)
354#define NETX_DPMAS_INT_EN_PIO72 (1<<28)
355#define NETX_DPMAS_INT_EN_PIO47 (1<<27)
356#define NETX_DPMAS_INT_EN_PIO40 (1<<26)
357#define NETX_DPMAS_INT_EN_PIO36 (1<<25)
358#define NETX_DPMAS_INT_EN_PIO35 (1<<24)
359
360#define NETX_DPMAS_IF_CONF0_HIF_DISABLED (0<<28)
361#define NETX_DPMAS_IF_CONF0_HIF_EXT_BUS (1<<28)
362#define NETX_DPMAS_IF_CONF0_HIF_UP_8BIT (2<<28)
363#define NETX_DPMAS_IF_CONF0_HIF_UP_16BIT (3<<28)
364#define NETX_DPMAS_IF_CONF0_HIF_IO (4<<28)
365#define NETX_DPMAS_IF_CONF0_WAIT_DRV_PP (1<<14)
366#define NETX_DPMAS_IF_CONF0_WAIT_DRV_OD (2<<14)
367#define NETX_DPMAS_IF_CONF0_WAIT_DRV_TRI (3<<14)
368
369#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO35 (1<<26)
370#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO36 (1<<27)
371#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO40 (1<<28)
372#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO47 (1<<29)
373#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO72 (1<<30)
374
375#define NETX_EXT_CONFIG_TALEWIDTH(x) (((x) & 0x7) << 29)
376#define NETX_EXT_CONFIG_TADRHOLD(x) (((x) & 0x7) << 26)
377#define NETX_EXT_CONFIG_TCSON(x) (((x) & 0x7) << 23)
378#define NETX_EXT_CONFIG_TRDON(x) (((x) & 0x7) << 20)
379#define NETX_EXT_CONFIG_TWRON(x) (((x) & 0x7) << 17)
380#define NETX_EXT_CONFIG_TWROFF(x) (((x) & 0x1f) << 12)
381#define NETX_EXT_CONFIG_TRDWRCYC(x) (((x) & 0x1f) << 7)
382#define NETX_EXT_CONFIG_WAIT_POL (1<<6)
383#define NETX_EXT_CONFIG_WAIT_EN (1<<5)
384#define NETX_EXT_CONFIG_NRD_MODE (1<<4)
385#define NETX_EXT_CONFIG_DS_MODE (1<<3)
386#define NETX_EXT_CONFIG_NWR_MODE (1<<2)
387#define NETX_EXT_CONFIG_16BIT (1<<1)
388#define NETX_EXT_CONFIG_CS_ENABLE (1<<0)
389
390#define NETX_DPMAS_IO_MODE0_WRL (1<<13)
391#define NETX_DPMAS_IO_MODE0_WAIT (1<<14)
392#define NETX_DPMAS_IO_MODE0_READY (1<<15)
393#define NETX_DPMAS_IO_MODE0_CS0 (1<<19)
394#define NETX_DPMAS_IO_MODE0_EXTRD (1<<20)
395
396#define NETX_DPMAS_IO_MODE1_CS2 (1<<15)
397#define NETX_DPMAS_IO_MODE1_CS1 (1<<16)
398#define NETX_DPMAS_IO_MODE1_SAMPLE_NPOR (0<<30)
399#define NETX_DPMAS_IO_MODE1_SAMPLE_100MHZ (1<<30)
400#define NETX_DPMAS_IO_MODE1_SAMPLE_NPIO36 (2<<30)
401#define NETX_DPMAS_IO_MODE1_SAMPLE_PIO36 (3<<30)
402
403/*******************************
404 * I2C *
405 *******************************/
406#define NETX_I2C_REG(ofs) __io(NETX_VA_I2C, (ofs))
407#define NETX_I2C_CTRL NETX_I2C_REG(0x0)
408#define NETX_I2C_DATA NETX_I2C_REG(0x4)
409
410#endif /* __ASM_ARCH_NETX_REGS_H */
diff --git a/arch/arm/mach-netx/include/mach/param.h b/arch/arm/mach-netx/include/mach/param.h
new file mode 100644
index 000000000000..a771459206aa
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/param.h
@@ -0,0 +1,18 @@
1/*
2 * arch/arm/mach-netx/include/mach/param.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
diff --git a/arch/arm/mach-netx/include/mach/pfifo.h b/arch/arm/mach-netx/include/mach/pfifo.h
new file mode 100644
index 000000000000..42c59068f8d8
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/pfifo.h
@@ -0,0 +1,54 @@
1/*
2 * arch/arm/mach-netx/include/mach/pfifo.h
3 *
4 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20
21#ifndef ASM_ARCH_PFIFO_H
22#define ASM_ARCH_PFIFO_H
23
24static inline int pfifo_push(int no, unsigned int pointer)
25{
26 writel(pointer, NETX_PFIFO_BASE(no));
27 return 0;
28}
29
30static inline unsigned int pfifo_pop(int no)
31{
32 return readl(NETX_PFIFO_BASE(no));
33}
34
35static inline int pfifo_fill_level(int no)
36{
37
38 return readl(NETX_PFIFO_FILL_LEVEL(no));
39}
40
41static inline int pfifo_full(int no)
42{
43 return readl(NETX_PFIFO_FULL) & (1<<no) ? 1 : 0;
44}
45
46static inline int pfifo_empty(int no)
47{
48 return readl(NETX_PFIFO_EMPTY) & (1<<no) ? 1 : 0;
49}
50
51int pfifo_request(unsigned int pfifo_mask);
52void pfifo_free(unsigned int pfifo_mask);
53
54#endif /* ASM_ARCH_PFIFO_H */
diff --git a/arch/arm/mach-netx/include/mach/system.h b/arch/arm/mach-netx/include/mach/system.h
new file mode 100644
index 000000000000..27d8ef8e8e29
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/system.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-netx/include/mach/system.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __ASM_ARCH_SYSTEM_H
20#define __ASM_ARCH_SYSTEM_H
21
22#include <asm/io.h>
23#include <mach/hardware.h>
24#include "netx-regs.h"
25
26static inline void arch_idle(void)
27{
28 cpu_do_idle();
29}
30
31static inline void arch_reset(char mode)
32{
33 writel(NETX_SYSTEM_RES_CR_FIRMW_RES_EN | NETX_SYSTEM_RES_CR_FIRMW_RES,
34 NETX_SYSTEM_RES_CR);
35}
36
37#endif
38
diff --git a/arch/arm/mach-netx/include/mach/timex.h b/arch/arm/mach-netx/include/mach/timex.h
new file mode 100644
index 000000000000..1120dd0ba393
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/timex.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-netx/include/mach/timex.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#define CLOCK_TICK_RATE 100000000
diff --git a/arch/arm/mach-netx/include/mach/uncompress.h b/arch/arm/mach-netx/include/mach/uncompress.h
new file mode 100644
index 000000000000..84f91284f612
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/uncompress.h
@@ -0,0 +1,76 @@
1/*
2 * arch/arm/mach-netx/include/mach/uncompress.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20/*
21 * The following code assumes the serial port has already been
22 * initialized by the bootloader. We search for the first enabled
23 * port in the most probable order. If you didn't setup a port in
24 * your bootloader then nothing will appear (which might be desired).
25 *
26 * This does not append a newline
27 */
28
29#define REG(x) (*(volatile unsigned long *)(x))
30
31#define UART1_BASE 0x100a00
32#define UART2_BASE 0x100a80
33
34#define UART_DR 0x0
35
36#define UART_CR 0x14
37#define CR_UART_EN (1<<0)
38
39#define UART_FR 0x18
40#define FR_BUSY (1<<3)
41#define FR_TXFF (1<<5)
42
43static void putc(char c)
44{
45 unsigned long base;
46
47 if (REG(UART1_BASE + UART_CR) & CR_UART_EN)
48 base = UART1_BASE;
49 else if (REG(UART2_BASE + UART_CR) & CR_UART_EN)
50 base = UART2_BASE;
51 else
52 return;
53
54 while (REG(base + UART_FR) & FR_TXFF);
55 REG(base + UART_DR) = c;
56}
57
58static inline void flush(void)
59{
60 unsigned long base;
61
62 if (REG(UART1_BASE + UART_CR) & CR_UART_EN)
63 base = UART1_BASE;
64 else if (REG(UART2_BASE + UART_CR) & CR_UART_EN)
65 base = UART2_BASE;
66 else
67 return;
68
69 while (REG(base + UART_FR) & FR_BUSY);
70}
71
72/*
73 * nothing to do
74 */
75#define arch_decomp_setup()
76#define arch_decomp_wdog()
diff --git a/arch/arm/mach-netx/include/mach/vmalloc.h b/arch/arm/mach-netx/include/mach/vmalloc.h
new file mode 100644
index 000000000000..25d5cc676e0f
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/vmalloc.h
@@ -0,0 +1,19 @@
1/*
2 * arch/arm/mach-netx/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
diff --git a/arch/arm/mach-netx/include/mach/xc.h b/arch/arm/mach-netx/include/mach/xc.h
new file mode 100644
index 000000000000..0c0011d4fc2d
--- /dev/null
+++ b/arch/arm/mach-netx/include/mach/xc.h
@@ -0,0 +1,42 @@
1/*
2 * arch/arm/mach-netx/include/mach/xc.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __ASM_ARCH_XC_H
21#define __ASM_ARCH_XC_H
22
23struct xc {
24 int no;
25 unsigned int type;
26 unsigned int version;
27 void __iomem *xpec_base;
28 void __iomem *xmac_base;
29 void __iomem *sram_base;
30 int irq;
31 struct device *dev;
32};
33
34int xc_reset(struct xc *x);
35int xc_stop(struct xc* x);
36int xc_start(struct xc *x);
37int xc_running(struct xc *x);
38int xc_request_firmware(struct xc* x);
39struct xc* request_xc(int xcno, struct device *dev);
40void free_xc(struct xc *x);
41
42#endif /* __ASM_ARCH_XC_H */
diff --git a/arch/arm/mach-netx/nxdb500.c b/arch/arm/mach-netx/nxdb500.c
index e4a133d62846..c9b174bc8ccf 100644
--- a/arch/arm/mach-netx/nxdb500.c
+++ b/arch/arm/mach-netx/nxdb500.c
@@ -25,11 +25,11 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/clcd.h> 26#include <linux/amba/clcd.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/arch/netx-regs.h> 31#include <mach/netx-regs.h>
32#include <asm/arch/eth.h> 32#include <mach/eth.h>
33 33
34#include "generic.h" 34#include "generic.h"
35#include "fb.h" 35#include "fb.h"
diff --git a/arch/arm/mach-netx/nxdkn.c b/arch/arm/mach-netx/nxdkn.c
index 7e26c42d1ac7..15b54c62d60f 100644
--- a/arch/arm/mach-netx/nxdkn.c
+++ b/arch/arm/mach-netx/nxdkn.c
@@ -25,11 +25,11 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/clcd.h> 26#include <linux/amba/clcd.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/arch/netx-regs.h> 31#include <mach/netx-regs.h>
32#include <asm/arch/eth.h> 32#include <mach/eth.h>
33 33
34#include "generic.h" 34#include "generic.h"
35 35
diff --git a/arch/arm/mach-netx/nxeb500hmi.c b/arch/arm/mach-netx/nxeb500hmi.c
index 53e10a9849f9..1061c01ff679 100644
--- a/arch/arm/mach-netx/nxeb500hmi.c
+++ b/arch/arm/mach-netx/nxeb500hmi.c
@@ -25,11 +25,11 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/clcd.h> 26#include <linux/amba/clcd.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/arch/netx-regs.h> 31#include <mach/netx-regs.h>
32#include <asm/arch/eth.h> 32#include <mach/eth.h>
33 33
34#include "generic.h" 34#include "generic.h"
35#include "fb.h" 35#include "fb.h"
diff --git a/arch/arm/mach-netx/pfifo.c b/arch/arm/mach-netx/pfifo.c
index 44dea61a9de4..19ae0a72bea3 100644
--- a/arch/arm/mach-netx/pfifo.c
+++ b/arch/arm/mach-netx/pfifo.c
@@ -22,9 +22,9 @@
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23 23
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/arch/netx-regs.h> 26#include <mach/netx-regs.h>
27#include <asm/arch/pfifo.h> 27#include <mach/pfifo.h>
28 28
29static DEFINE_MUTEX(pfifo_lock); 29static DEFINE_MUTEX(pfifo_lock);
30 30
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
index ea07b54afa59..ac8e5bfed691 100644
--- a/arch/arm/mach-netx/time.c
+++ b/arch/arm/mach-netx/time.c
@@ -22,10 +22,10 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/clocksource.h> 23#include <linux/clocksource.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/mach/time.h> 27#include <asm/mach/time.h>
28#include <asm/arch/netx-regs.h> 28#include <mach/netx-regs.h>
29 29
30/* 30/*
31 * IRQ handler for the timer 31 * IRQ handler for the timer
diff --git a/arch/arm/mach-netx/xc.c b/arch/arm/mach-netx/xc.c
index ca9c5b61283a..04c34e82fe6d 100644
--- a/arch/arm/mach-netx/xc.c
+++ b/arch/arm/mach-netx/xc.c
@@ -23,10 +23,10 @@
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24 24
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/arch/netx-regs.h> 27#include <mach/netx-regs.h>
28 28
29#include <asm/arch/xc.h> 29#include <mach/xc.h>
30 30
31static DEFINE_MUTEX(xc_lock); 31static DEFINE_MUTEX(xc_lock);
32 32
diff --git a/arch/arm/mach-ns9xxx/board-a9m9750dev.c b/arch/arm/mach-ns9xxx/board-a9m9750dev.c
index a494b71c0195..a22a608a7aba 100644
--- a/arch/arm/mach-ns9xxx/board-a9m9750dev.c
+++ b/arch/arm/mach-ns9xxx/board-a9m9750dev.c
@@ -13,12 +13,12 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14#include <asm/gpio.h> 14#include <asm/gpio.h>
15 15
16#include <asm/arch-ns9xxx/board.h> 16#include <mach/board.h>
17#include <asm/arch-ns9xxx/processor-ns9360.h> 17#include <mach/processor-ns9360.h>
18#include <asm/arch-ns9xxx/regs-sys-ns9360.h> 18#include <mach/regs-sys-ns9360.h>
19#include <asm/arch-ns9xxx/regs-mem.h> 19#include <mach/regs-mem.h>
20#include <asm/arch-ns9xxx/regs-bbu.h> 20#include <mach/regs-bbu.h>
21#include <asm/arch-ns9xxx/regs-board-a9m9750dev.h> 21#include <mach/regs-board-a9m9750dev.h>
22 22
23#include "board-a9m9750dev.h" 23#include "board-a9m9750dev.h"
24 24
diff --git a/arch/arm/mach-ns9xxx/gpio-ns9360.c b/arch/arm/mach-ns9xxx/gpio-ns9360.c
index cabfb879dda9..377330c1b250 100644
--- a/arch/arm/mach-ns9xxx/gpio-ns9360.c
+++ b/arch/arm/mach-ns9xxx/gpio-ns9360.c
@@ -14,8 +14,8 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h> 15#include <linux/module.h>
16 16
17#include <asm/arch-ns9xxx/regs-bbu.h> 17#include <mach/regs-bbu.h>
18#include <asm/arch-ns9xxx/processor-ns9360.h> 18#include <mach/processor-ns9360.h>
19 19
20#include "gpio-ns9360.h" 20#include "gpio-ns9360.h"
21 21
diff --git a/arch/arm/mach-ns9xxx/gpio.c b/arch/arm/mach-ns9xxx/gpio.c
index b3c963b0c8f5..804c30075960 100644
--- a/arch/arm/mach-ns9xxx/gpio.c
+++ b/arch/arm/mach-ns9xxx/gpio.c
@@ -13,9 +13,9 @@
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/module.h> 14#include <linux/module.h>
15 15
16#include <asm/arch-ns9xxx/gpio.h> 16#include <mach/gpio.h>
17#include <asm/arch-ns9xxx/processor.h> 17#include <mach/processor.h>
18#include <asm/arch-ns9xxx/processor-ns9360.h> 18#include <mach/processor-ns9360.h>
19#include <asm/bug.h> 19#include <asm/bug.h>
20#include <asm/types.h> 20#include <asm/types.h>
21#include <asm/bitops.h> 21#include <asm/bitops.h>
diff --git a/arch/arm/mach-ns9xxx/include/mach/board.h b/arch/arm/mach-ns9xxx/include/mach/board.h
new file mode 100644
index 000000000000..f7e9196eb9ab
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/board.h
@@ -0,0 +1,42 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/board.h
3 *
4 * Copyright (C) 2006,2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_BOARD_H
12#define __ASM_ARCH_BOARD_H
13
14#include <asm/mach-types.h>
15
16#define board_is_a9m9750dev() (0 \
17 || machine_is_cc9p9360dev() \
18 || machine_is_cc9p9750dev() \
19 )
20
21#define board_is_a9mvali() (0 \
22 || machine_is_cc9p9360val() \
23 || machine_is_cc9p9750val() \
24 )
25
26#define board_is_jscc9p9210() (0 \
27 || machine_is_cc9p9210js() \
28 )
29
30#define board_is_jscc9p9215() (0 \
31 || machine_is_cc9p9215js() \
32 )
33
34#define board_is_jscc9p9360() (0 \
35 || machine_is_cc9p9360js() \
36 )
37
38#define board_is_uncbas() (0 \
39 || machine_is_cc7ucamry() \
40 )
41
42#endif /* ifndef __ASM_ARCH_BOARD_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/debug-macro.S b/arch/arm/mach-ns9xxx/include/mach/debug-macro.S
new file mode 100644
index 000000000000..c9530fba00aa
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/debug-macro.S
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/debug-macro.S
3 * Copyright (C) 2006 by Digi International Inc.
4 * All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10#include <mach/hardware.h>
11
12#include <mach/regs-board-a9m9750dev.h>
13
14 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1
17 ldreq \rx, =NS9XXX_CSxSTAT_PHYS(0)
18 ldrne \rx, =io_p2v(NS9XXX_CSxSTAT_PHYS(0))
19 .endm
20
21#define UART_SHIFT 2
22#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-ns9xxx/include/mach/dma.h b/arch/arm/mach-ns9xxx/include/mach/dma.h
new file mode 100644
index 000000000000..3f50d8c9e5c7
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/dma.h
@@ -0,0 +1,14 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/dma.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#endif /* ifndef __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/entry-macro.S b/arch/arm/mach-ns9xxx/include/mach/entry-macro.S
new file mode 100644
index 000000000000..71ca0319b547
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/entry-macro.S
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/entry-macro.S
3 *
4 * Copyright (C) 2006,2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#include <mach/hardware.h>
12#include <mach/regs-sys-common.h>
13
14 .macro get_irqnr_preamble, base, tmp
15 ldr \base, =SYS_ISRADDR
16 .endm
17
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
22 ldr \irqstat, [\base, #(SYS_ISA - SYS_ISRADDR)]
23 cmp \irqstat, #0
24 ldrne \irqnr, [\base]
25 .endm
26
27 .macro disable_fiq
28 .endm
diff --git a/arch/arm/mach-ns9xxx/include/mach/gpio.h b/arch/arm/mach-ns9xxx/include/mach/gpio.h
new file mode 100644
index 000000000000..5eb349032579
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/gpio.h
@@ -0,0 +1,47 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/gpio.h
3 *
4 * Copyright (C) 2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10*/
11#ifndef __ASM_ARCH_GPIO_H
12#define __ASM_ARCH_GPIO_H
13
14#include <asm/errno.h>
15
16int gpio_request(unsigned gpio, const char *label);
17
18void gpio_free(unsigned gpio);
19
20int ns9xxx_gpio_configure(unsigned gpio, int inv, int func);
21
22int gpio_direction_input(unsigned gpio);
23
24int gpio_direction_output(unsigned gpio, int value);
25
26int gpio_get_value(unsigned gpio);
27
28void gpio_set_value(unsigned gpio, int value);
29
30/*
31 * ns9xxx can use gpio pins to trigger an irq, but it's not generic
32 * enough to be supported by the gpio_to_irq/irq_to_gpio interface
33 */
34static inline int gpio_to_irq(unsigned gpio)
35{
36 return -EINVAL;
37}
38
39static inline int irq_to_gpio(unsigned irq)
40{
41 return -EINVAL;
42}
43
44/* get the cansleep() stubs */
45#include <asm-generic/gpio.h>
46
47#endif /* ifndef __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/hardware.h b/arch/arm/mach-ns9xxx/include/mach/hardware.h
new file mode 100644
index 000000000000..6dbb2030f563
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/hardware.h
@@ -0,0 +1,79 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/hardware.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_HARDWARE_H
12#define __ASM_ARCH_HARDWARE_H
13
14#include <asm/memory.h>
15
16/*
17 * NetSilicon NS9xxx internal mapping:
18 *
19 * physical <--> virtual
20 * 0x90000000 - 0x906fffff <--> 0xf9000000 - 0xf96fffff
21 * 0xa0100000 - 0xa0afffff <--> 0xfa100000 - 0xfaafffff
22 */
23#define io_p2v(x) (0xf0000000 \
24 + (((x) & 0xf0000000) >> 4) \
25 + ((x) & 0x00ffffff))
26
27#define io_v2p(x) ((((x) & 0x0f000000) << 4) \
28 + ((x) & 0x00ffffff))
29
30#define __REGSHIFT(mask) ((mask) & (-(mask)))
31
32#define __REGBIT(bit) ((u32)1 << (bit))
33#define __REGBITS(hbit, lbit) ((((u32)1 << ((hbit) - (lbit) + 1)) - 1) << (lbit))
34#define __REGVAL(mask, value) (((value) * __REGSHIFT(mask)) & (mask))
35
36#ifndef __ASSEMBLY__
37
38# define __REG(x) ((void __iomem __force *)io_p2v((x)))
39# define __REG2(x, y) ((void __iomem __force *)(io_p2v((x)) + 4 * (y)))
40
41# define __REGSET(var, field, value) \
42 ((var) = (((var) & ~((field) & ~(value))) | (value)))
43
44# define REGSET(var, reg, field, value) \
45 __REGSET(var, reg ## _ ## field, reg ## _ ## field ## _ ## value)
46
47# define REGSET_IDX(var, reg, field, idx, value) \
48 __REGSET(var, reg ## _ ## field((idx)), reg ## _ ## field ## _ ## value((idx)))
49
50# define REGSETIM(var, reg, field, value) \
51 __REGSET(var, reg ## _ ## field, __REGVAL(reg ## _ ## field, (value)))
52
53# define REGSETIM_IDX(var, reg, field, idx, value) \
54 __REGSET(var, reg ## _ ## field((idx)), __REGVAL(reg ## _ ## field((idx)), (value)))
55
56# define __REGGET(var, field) \
57 (((var) & (field)))
58
59# define REGGET(var, reg, field) \
60 __REGGET(var, reg ## _ ## field)
61
62# define REGGET_IDX(var, reg, field, idx) \
63 __REGGET(var, reg ## _ ## field((idx)))
64
65# define REGGETIM(var, reg, field) \
66 __REGGET(var, reg ## _ ## field) / __REGSHIFT(reg ## _ ## field)
67
68# define REGGETIM_IDX(var, reg, field, idx) \
69 __REGGET(var, reg ## _ ## field((idx))) / \
70 __REGSHIFT(reg ## _ ## field((idx)))
71
72#else
73
74# define __REG(x) io_p2v(x)
75# define __REG2(x, y) io_p2v((x) + 4 * (y))
76
77#endif
78
79#endif /* ifndef __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/io.h b/arch/arm/mach-ns9xxx/include/mach/io.h
new file mode 100644
index 000000000000..027bf649645a
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/io.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/io.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_IO_H
12#define __ASM_ARCH_IO_H
13
14#define IO_SPACE_LIMIT 0xffffffff /* XXX */
15
16#define __io(a) ((void __iomem *)(a))
17#define __mem_pci(a) (a)
18#define __mem_isa(a) (IO_BASE + (a))
19
20#endif /* ifndef __ASM_ARCH_IO_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/irqs.h b/arch/arm/mach-ns9xxx/include/mach/irqs.h
new file mode 100644
index 000000000000..13483949e210
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/irqs.h
@@ -0,0 +1,86 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/irqs.h
3 *
4 * Copyright (C) 2006,2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H
13
14/* NetSilicon 9360 */
15#define IRQ_NS9XXX_WATCHDOG 0
16#define IRQ_NS9XXX_AHBBUSERR 1
17#define IRQ_NS9360_BBUSAGG 2
18/* irq 3 is reserved for NS9360 */
19#define IRQ_NS9XXX_ETHRX 4
20#define IRQ_NS9XXX_ETHTX 5
21#define IRQ_NS9XXX_ETHPHY 6
22#define IRQ_NS9360_LCD 7
23#define IRQ_NS9360_SERBRX 8
24#define IRQ_NS9360_SERBTX 9
25#define IRQ_NS9360_SERARX 10
26#define IRQ_NS9360_SERATX 11
27#define IRQ_NS9360_SERCRX 12
28#define IRQ_NS9360_SERCTX 13
29#define IRQ_NS9360_I2C 14
30#define IRQ_NS9360_BBUSDMA 15
31#define IRQ_NS9360_TIMER0 16
32#define IRQ_NS9360_TIMER1 17
33#define IRQ_NS9360_TIMER2 18
34#define IRQ_NS9360_TIMER3 19
35#define IRQ_NS9360_TIMER4 20
36#define IRQ_NS9360_TIMER5 21
37#define IRQ_NS9360_TIMER6 22
38#define IRQ_NS9360_TIMER7 23
39#define IRQ_NS9360_RTC 24
40#define IRQ_NS9360_USBHOST 25
41#define IRQ_NS9360_USBDEVICE 26
42#define IRQ_NS9360_IEEE1284 27
43#define IRQ_NS9XXX_EXT0 28
44#define IRQ_NS9XXX_EXT1 29
45#define IRQ_NS9XXX_EXT2 30
46#define IRQ_NS9XXX_EXT3 31
47
48#define BBUS_IRQ(irq) (32 + irq)
49
50#define IRQ_BBUS_DMA BBUS_IRQ(0)
51#define IRQ_BBUS_SERBRX BBUS_IRQ(2)
52#define IRQ_BBUS_SERBTX BBUS_IRQ(3)
53#define IRQ_BBUS_SERARX BBUS_IRQ(4)
54#define IRQ_BBUS_SERATX BBUS_IRQ(5)
55#define IRQ_BBUS_SERCRX BBUS_IRQ(6)
56#define IRQ_BBUS_SERCTX BBUS_IRQ(7)
57#define IRQ_BBUS_SERDRX BBUS_IRQ(8)
58#define IRQ_BBUS_SERDTX BBUS_IRQ(9)
59#define IRQ_BBUS_I2C BBUS_IRQ(10)
60#define IRQ_BBUS_1284 BBUS_IRQ(11)
61#define IRQ_BBUS_UTIL BBUS_IRQ(12)
62#define IRQ_BBUS_RTC BBUS_IRQ(13)
63#define IRQ_BBUS_USBHST BBUS_IRQ(14)
64#define IRQ_BBUS_USBDEV BBUS_IRQ(15)
65#define IRQ_BBUS_AHBDMA1 BBUS_IRQ(24)
66#define IRQ_BBUS_AHBDMA2 BBUS_IRQ(25)
67
68/*
69 * these Interrupts are specific for the a9m9750dev board.
70 * They are generated by an FPGA that interrupts the CPU on
71 * IRQ_NS9360_EXT2
72 */
73#define FPGA_IRQ(irq) (64 + irq)
74
75#define IRQ_FPGA_UARTA FPGA_IRQ(0)
76#define IRQ_FPGA_UARTB FPGA_IRQ(1)
77#define IRQ_FPGA_UARTC FPGA_IRQ(2)
78#define IRQ_FPGA_UARTD FPGA_IRQ(3)
79#define IRQ_FPGA_TOUCH FPGA_IRQ(4)
80#define IRQ_FPGA_CF FPGA_IRQ(5)
81#define IRQ_FPGA_CAN0 FPGA_IRQ(6)
82#define IRQ_FPGA_CAN1 FPGA_IRQ(7)
83
84#define NR_IRQS 72
85
86#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/memory.h b/arch/arm/mach-ns9xxx/include/mach/memory.h
new file mode 100644
index 000000000000..649ee6235b94
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/memory.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/memory.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10*/
11#ifndef __ASM_ARCH_MEMORY_H
12#define __ASM_ARCH_MEMORY_H
13
14/* x in [0..3] */
15#define NS9XXX_CSxSTAT_PHYS(x) UL(((x) + 4) << 28)
16
17#define NS9XXX_CS0STAT_LENGTH UL(0x1000)
18#define NS9XXX_CS1STAT_LENGTH UL(0x1000)
19#define NS9XXX_CS2STAT_LENGTH UL(0x1000)
20#define NS9XXX_CS3STAT_LENGTH UL(0x1000)
21
22#define PHYS_OFFSET UL(0x00000000)
23
24#define __virt_to_bus(x) __virt_to_phys(x)
25#define __bus_to_virt(x) __phys_to_virt(x)
26
27#endif
diff --git a/arch/arm/mach-ns9xxx/include/mach/module.h b/arch/arm/mach-ns9xxx/include/mach/module.h
new file mode 100644
index 000000000000..f851a6b7da6c
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/module.h
@@ -0,0 +1,60 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/module.h
3 *
4 * Copyright (C) 2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_MODULE_H
12#define __ASM_ARCH_MODULE_H
13
14#include <asm/mach-types.h>
15
16#define module_is_cc7ucamry() (0 \
17 || machine_is_cc7ucamry() \
18 )
19
20#define module_is_cc9c() (0 \
21 || machine_is_cc9c() \
22 )
23
24#define module_is_cc9p9210() (0 \
25 || machine_is_cc9p9210() \
26 || machine_is_cc9p9210js() \
27 )
28
29#define module_is_cc9p9215() (0 \
30 || machine_is_cc9p9215() \
31 || machine_is_cc9p9215js() \
32 )
33
34#define module_is_cc9p9360() (0 \
35 || machine_is_a9m9360() \
36 || machine_is_cc9p9360dev() \
37 || machine_is_cc9p9360js() \
38 || machine_is_cc9p9360val() \
39 )
40
41#define module_is_cc9p9750() (0 \
42 || machine_is_a9m9750() \
43 || machine_is_cc9p9750dev() \
44 || machine_is_cc9p9750js() \
45 || machine_is_cc9p9750val() \
46 )
47
48#define module_is_ccw9c() (0 \
49 || machine_is_ccw9c() \
50 )
51
52#define module_is_inc20otter() (0 \
53 || machine_is_inc20otter() \
54 )
55
56#define module_is_otter() (0 \
57 || machine_is_otter() \
58 )
59
60#endif /* ifndef __ASM_ARCH_MODULE_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/processor-ns9360.h b/arch/arm/mach-ns9xxx/include/mach/processor-ns9360.h
new file mode 100644
index 000000000000..f41deda5129e
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/processor-ns9360.h
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/processor-ns9360.h
3 *
4 * Copyright (C) 2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_PROCESSORNS9360_H
12#define __ASM_ARCH_PROCESSORNS9360_H
13
14#include <linux/init.h>
15
16void ns9360_reset(char mode);
17
18unsigned long ns9360_systemclock(void) __attribute__((const));
19
20static inline unsigned long ns9360_cpuclock(void) __attribute__((const));
21static inline unsigned long ns9360_cpuclock(void)
22{
23 return ns9360_systemclock() / 2;
24}
25
26void __init ns9360_map_io(void);
27
28extern struct sys_timer ns9360_timer;
29
30int ns9360_gpio_configure(unsigned gpio, int inv, int func);
31
32#endif /* ifndef __ASM_ARCH_PROCESSORNS9360_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/processor.h b/arch/arm/mach-ns9xxx/include/mach/processor.h
new file mode 100644
index 000000000000..9f77f746a386
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/processor.h
@@ -0,0 +1,42 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/processor.h
3 *
4 * Copyright (C) 2006,2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_PROCESSOR_H
12#define __ASM_ARCH_PROCESSOR_H
13
14#include <mach/module.h>
15
16#define processor_is_ns9210() (0 \
17 || module_is_cc7ucamry() \
18 || module_is_cc9p9210() \
19 || module_is_inc20otter() \
20 || module_is_otter() \
21 )
22
23#define processor_is_ns9215() (0 \
24 || module_is_cc9p9215() \
25 )
26
27#define processor_is_ns9360() (0 \
28 || module_is_cc9p9360() \
29 || module_is_cc9c() \
30 || module_is_ccw9c() \
31 )
32
33#define processor_is_ns9750() (0 \
34 || module_is_cc9p9750() \
35 )
36
37#define processor_is_ns921x() (0 \
38 || processor_is_ns9210() \
39 || processor_is_ns9215() \
40 )
41
42#endif /* ifndef __ASM_ARCH_PROCESSOR_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/regs-bbu.h b/arch/arm/mach-ns9xxx/include/mach/regs-bbu.h
new file mode 100644
index 000000000000..af227c058fb9
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/regs-bbu.h
@@ -0,0 +1,45 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/regs-bbu.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_REGSBBU_H
12#define __ASM_ARCH_REGSBBU_H
13
14#include <mach/hardware.h>
15
16/* BBus Utility */
17
18/* GPIO Configuration Registers block 1 */
19/* NOTE: the HRM starts counting at 1 for the GPIO registers, here the start is
20 * at 0 for each block. That is, BBU_GCONFb1(0) is GPIO Configuration Register
21 * #1, BBU_GCONFb2(0) is GPIO Configuration Register #8. */
22#define BBU_GCONFb1(x) __REG2(0x90600010, (x))
23#define BBU_GCONFb2(x) __REG2(0x90600100, (x))
24
25#define BBU_GCONFx_DIR(m) __REGBIT(3 + (((m) & 7) << 2))
26#define BBU_GCONFx_DIR_INPUT(m) __REGVAL(BBU_GCONFx_DIR(m), 0)
27#define BBU_GCONFx_DIR_OUTPUT(m) __REGVAL(BBU_GCONFx_DIR(m), 1)
28#define BBU_GCONFx_INV(m) __REGBIT(2 + (((m) & 7) << 2))
29#define BBU_GCONFx_INV_NO(m) __REGVAL(BBU_GCONFx_INV(m), 0)
30#define BBU_GCONFx_INV_YES(m) __REGVAL(BBU_GCONFx_INV(m), 1)
31#define BBU_GCONFx_FUNC(m) __REGBITS(1 + (((m) & 7) << 2), ((m) & 7) << 2)
32#define BBU_GCONFx_FUNC_0(m) __REGVAL(BBU_GCONFx_FUNC(m), 0)
33#define BBU_GCONFx_FUNC_1(m) __REGVAL(BBU_GCONFx_FUNC(m), 1)
34#define BBU_GCONFx_FUNC_2(m) __REGVAL(BBU_GCONFx_FUNC(m), 2)
35#define BBU_GCONFx_FUNC_3(m) __REGVAL(BBU_GCONFx_FUNC(m), 3)
36
37#define BBU_GCTRL1 __REG(0x90600030)
38#define BBU_GCTRL2 __REG(0x90600034)
39#define BBU_GCTRL3 __REG(0x90600120)
40
41#define BBU_GSTAT1 __REG(0x90600040)
42#define BBU_GSTAT2 __REG(0x90600044)
43#define BBU_GSTAT3 __REG(0x90600130)
44
45#endif /* ifndef __ASM_ARCH_REGSBBU_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/regs-board-a9m9750dev.h b/arch/arm/mach-ns9xxx/include/mach/regs-board-a9m9750dev.h
new file mode 100644
index 000000000000..cd1593693f56
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/regs-board-a9m9750dev.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/regs-board-a9m9750dev.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_REGSBOARDA9M9750_H
12#define __ASM_ARCH_REGSBOARDA9M9750_H
13
14#include <mach/hardware.h>
15
16#define FPGA_UARTA_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0))
17#define FPGA_UARTB_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0) + 0x08)
18#define FPGA_UARTC_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0) + 0x10)
19#define FPGA_UARTD_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0) + 0x18)
20
21#define FPGA_IER __REG(NS9XXX_CSxSTAT_PHYS(0) + 0x50)
22#define FPGA_ISR __REG(NS9XXX_CSxSTAT_PHYS(0) + 0x60)
23
24#endif /* ifndef __ASM_ARCH_REGSBOARDA9M9750_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/regs-mem.h b/arch/arm/mach-ns9xxx/include/mach/regs-mem.h
new file mode 100644
index 000000000000..f1625bf8cdce
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/regs-mem.h
@@ -0,0 +1,135 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/regs-mem.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_REGSMEM_H
12#define __ASM_ARCH_REGSMEM_H
13
14#include <mach/hardware.h>
15
16/* Memory Module */
17
18/* Control register */
19#define MEM_CTRL __REG(0xa0700000)
20
21/* Status register */
22#define MEM_STAT __REG(0xa0700004)
23
24/* Configuration register */
25#define MEM_CONF __REG(0xa0700008)
26
27/* Dynamic Memory Control register */
28#define MEM_DMCTRL __REG(0xa0700020)
29
30/* Dynamic Memory Refresh Timer */
31#define MEM_DMRT __REG(0xa0700024)
32
33/* Dynamic Memory Read Configuration register */
34#define MEM_DMRC __REG(0xa0700028)
35
36/* Dynamic Memory Precharge Command Period (tRP) */
37#define MEM_DMPCP __REG(0xa0700030)
38
39/* Dynamic Memory Active to Precharge Command Period (tRAS) */
40#define MEM_DMAPCP __REG(0xa0700034)
41
42/* Dynamic Memory Self-Refresh Exit Time (tSREX) */
43#define MEM_DMSRET __REG(0xa0700038)
44
45/* Dynamic Memory Last Data Out to Active Time (tAPR) */
46#define MEM_DMLDOAT __REG(0xa070003c)
47
48/* Dynamic Memory Data-in to Active Command Time (tDAL or TAPW) */
49#define MEM_DMDIACT __REG(0xa0700040)
50
51/* Dynamic Memory Write Recovery Time (tWR, tDPL, tRWL, tRDL) */
52#define MEM_DMWRT __REG(0xa0700044)
53
54/* Dynamic Memory Active to Active Command Period (tRC) */
55#define MEM_DMAACP __REG(0xa0700048)
56
57/* Dynamic Memory Auto Refresh Period, and Auto Refresh to Active Command Period (tRFC) */
58#define MEM_DMARP __REG(0xa070004c)
59
60/* Dynamic Memory Exit Self-Refresh to Active Command (tXSR) */
61#define MEM_DMESRAC __REG(0xa0700050)
62
63/* Dynamic Memory Active Bank A to Active B Time (tRRD) */
64#define MEM_DMABAABT __REG(0xa0700054)
65
66/* Dynamic Memory Load Mode register to Active Command Time (tMRD) */
67#define MEM_DMLMACT __REG(0xa0700058)
68
69/* Static Memory Extended Wait */
70#define MEM_SMEW __REG(0xa0700080)
71
72/* Dynamic Memory Configuration Register x */
73#define MEM_DMCONF(x) __REG2(0xa0700100, (x) << 3)
74
75/* Dynamic Memory RAS and CAS Delay x */
76#define MEM_DMRCD(x) __REG2(0xa0700104, (x) << 3)
77
78/* Static Memory Configuration Register x */
79#define MEM_SMC(x) __REG2(0xa0700200, (x) << 3)
80
81/* Static Memory Configuration Register x: Write protect */
82#define MEM_SMC_PSMC __REGBIT(20)
83#define MEM_SMC_PSMC_OFF __REGVAL(MEM_SMC_PSMC, 0)
84#define MEM_SMC_PSMC_ON __REGVAL(MEM_SMC_PSMC, 1)
85
86/* Static Memory Configuration Register x: Buffer enable */
87#define MEM_SMC_BSMC __REGBIT(19)
88#define MEM_SMC_BSMC_OFF __REGVAL(MEM_SMC_BSMC, 0)
89#define MEM_SMC_BSMC_ON __REGVAL(MEM_SMC_BSMC, 1)
90
91/* Static Memory Configuration Register x: Extended Wait */
92#define MEM_SMC_EW __REGBIT(8)
93#define MEM_SMC_EW_OFF __REGVAL(MEM_SMC_EW, 0)
94#define MEM_SMC_EW_ON __REGVAL(MEM_SMC_EW, 1)
95
96/* Static Memory Configuration Register x: Byte lane state */
97#define MEM_SMC_PB __REGBIT(7)
98#define MEM_SMC_PB_0 __REGVAL(MEM_SMC_PB, 0)
99#define MEM_SMC_PB_1 __REGVAL(MEM_SMC_PB, 1)
100
101/* Static Memory Configuration Register x: Chip select polarity */
102#define MEM_SMC_PC __REGBIT(6)
103#define MEM_SMC_PC_AL __REGVAL(MEM_SMC_PC, 0)
104#define MEM_SMC_PC_AH __REGVAL(MEM_SMC_PC, 1)
105
106/* static memory configuration register x: page mode*/
107#define MEM_SMC_PM __REGBIT(3)
108#define MEM_SMC_PM_DIS __REGVAL(MEM_SMC_PM, 0)
109#define MEM_SMC_PM_ASYNC __REGVAL(MEM_SMC_PM, 1)
110
111/* static memory configuration register x: Memory width */
112#define MEM_SMC_MW __REGBITS(1, 0)
113#define MEM_SMC_MW_8 __REGVAL(MEM_SMC_MW, 0)
114#define MEM_SMC_MW_16 __REGVAL(MEM_SMC_MW, 1)
115#define MEM_SMC_MW_32 __REGVAL(MEM_SMC_MW, 2)
116
117/* Static Memory Write Enable Delay x */
118#define MEM_SMWED(x) __REG2(0xa0700204, (x) << 3)
119
120/* Static Memory Output Enable Delay x */
121#define MEM_SMOED(x) __REG2(0xa0700208, (x) << 3)
122
123/* Static Memory Read Delay x */
124#define MEM_SMRD(x) __REG2(0xa070020c, (x) << 3)
125
126/* Static Memory Page Mode Read Delay 0 */
127#define MEM_SMPMRD(x) __REG2(0xa0700210, (x) << 3)
128
129/* Static Memory Write Delay */
130#define MEM_SMWD(x) __REG2(0xa0700214, (x) << 3)
131
132/* Static Memory Turn Round Delay x */
133#define MEM_SWT(x) __REG2(0xa0700218, (x) << 3)
134
135#endif /* ifndef __ASM_ARCH_REGSMEM_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/regs-sys-common.h b/arch/arm/mach-ns9xxx/include/mach/regs-sys-common.h
new file mode 100644
index 000000000000..14f91dfd5736
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/regs-sys-common.h
@@ -0,0 +1,31 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/regs-sys-common.h
3 *
4 * Copyright (C) 2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11
12#ifndef __ASM_ARCH_REGSSYSCOMMON_H
13#define __ASM_ARCH_REGSSYSCOMMON_H
14#include <mach/hardware.h>
15
16/* Interrupt Vector Address Register Level x */
17#define SYS_IVA(x) __REG2(0xa09000c4, (x))
18
19/* Interrupt Configuration registers */
20#define SYS_IC(x) __REG2(0xa0900144, (x))
21
22/* ISRADDR */
23#define SYS_ISRADDR __REG(0xa0900164)
24
25/* Interrupt Status Active */
26#define SYS_ISA __REG(0xa0900168)
27
28/* Interrupt Status Raw */
29#define SYS_ISR __REG(0xa090016c)
30
31#endif /* ifndef __ASM_ARCH_REGSSYSCOMMON_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/regs-sys-ns9360.h b/arch/arm/mach-ns9xxx/include/mach/regs-sys-ns9360.h
new file mode 100644
index 000000000000..8ff254d9901c
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/regs-sys-ns9360.h
@@ -0,0 +1,148 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/regs-sys-ns9360.h
3 *
4 * Copyright (C) 2006,2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_REGSSYSNS9360_H
12#define __ASM_ARCH_REGSSYSNS9360_H
13
14#include <mach/hardware.h>
15
16/* System Control Module */
17
18/* AHB Arbiter Gen Configuration */
19#define SYS_AHBAGENCONF __REG(0xa0900000)
20
21/* BRC */
22#define SYS_BRC(x) __REG2(0xa0900004, (x))
23
24/* Timer x Reload Count register */
25#define SYS_TRC(x) __REG2(0xa0900044, (x))
26
27/* Timer x Read register */
28#define SYS_TR(x) __REG2(0xa0900084, (x))
29
30/* Timer Interrupt Status register */
31#define SYS_TIS __REG(0xa0900170)
32
33/* PLL Configuration register */
34#define SYS_PLL __REG(0xa0900188)
35
36/* PLL FS status */
37#define SYS_PLL_FS __REGBITS(24, 23)
38
39/* PLL ND status */
40#define SYS_PLL_ND __REGBITS(20, 16)
41
42/* PLL Configuration register: PLL SW change */
43#define SYS_PLL_SWC __REGBIT(15)
44#define SYS_PLL_SWC_NO __REGVAL(SYS_PLL_SWC, 0)
45#define SYS_PLL_SWC_YES __REGVAL(SYS_PLL_SWC, 1)
46
47/* Timer x Control register */
48#define SYS_TC(x) __REG2(0xa0900190, (x))
49
50/* Timer x Control register: Timer enable */
51#define SYS_TCx_TEN __REGBIT(15)
52#define SYS_TCx_TEN_DIS __REGVAL(SYS_TCx_TEN, 0)
53#define SYS_TCx_TEN_EN __REGVAL(SYS_TCx_TEN, 1)
54
55/* Timer x Control register: CPU debug mode */
56#define SYS_TCx_TDBG __REGBIT(10)
57#define SYS_TCx_TDBG_CONT __REGVAL(SYS_TCx_TDBG, 0)
58#define SYS_TCx_TDBG_STOP __REGVAL(SYS_TCx_TDBG, 1)
59
60/* Timer x Control register: Interrupt clear */
61#define SYS_TCx_INTC __REGBIT(9)
62#define SYS_TCx_INTC_UNSET __REGVAL(SYS_TCx_INTC, 0)
63#define SYS_TCx_INTC_SET __REGVAL(SYS_TCx_INTC, 1)
64
65/* Timer x Control register: Timer clock select */
66#define SYS_TCx_TLCS __REGBITS(8, 6)
67#define SYS_TCx_TLCS_CPU __REGVAL(SYS_TCx_TLCS, 0) /* CPU clock */
68#define SYS_TCx_TLCS_DIV2 __REGVAL(SYS_TCx_TLCS, 1) /* CPU clock / 2 */
69#define SYS_TCx_TLCS_DIV4 __REGVAL(SYS_TCx_TLCS, 2) /* CPU clock / 4 */
70#define SYS_TCx_TLCS_DIV8 __REGVAL(SYS_TCx_TLCS, 3) /* CPU clock / 8 */
71#define SYS_TCx_TLCS_DIV16 __REGVAL(SYS_TCx_TLCS, 4) /* CPU clock / 16 */
72#define SYS_TCx_TLCS_DIV32 __REGVAL(SYS_TCx_TLCS, 5) /* CPU clock / 32 */
73#define SYS_TCx_TLCS_DIV64 __REGVAL(SYS_TCx_TLCS, 6) /* CPU clock / 64 */
74#define SYS_TCx_TLCS_EXT __REGVAL(SYS_TCx_TLCS, 7)
75
76/* Timer x Control register: Timer mode */
77#define SYS_TCx_TM __REGBITS(5, 4)
78#define SYS_TCx_TM_IEE __REGVAL(SYS_TCx_TM, 0) /* Internal timer or external event */
79#define SYS_TCx_TM_ELL __REGVAL(SYS_TCx_TM, 1) /* External low-level, gated timer */
80#define SYS_TCx_TM_EHL __REGVAL(SYS_TCx_TM, 2) /* External high-level, gated timer */
81#define SYS_TCx_TM_CONCAT __REGVAL(SYS_TCx_TM, 3) /* Concatenate the lower timer. */
82
83/* Timer x Control register: Interrupt select */
84#define SYS_TCx_INTS __REGBIT(3)
85#define SYS_TCx_INTS_DIS __REGVAL(SYS_TCx_INTS, 0)
86#define SYS_TCx_INTS_EN __REGVAL(SYS_TCx_INTS, 1)
87
88/* Timer x Control register: Up/down select */
89#define SYS_TCx_UDS __REGBIT(2)
90#define SYS_TCx_UDS_UP __REGVAL(SYS_TCx_UDS, 0)
91#define SYS_TCx_UDS_DOWN __REGVAL(SYS_TCx_UDS, 1)
92
93/* Timer x Control register: 32- or 16-bit timer */
94#define SYS_TCx_TSZ __REGBIT(1)
95#define SYS_TCx_TSZ_16 __REGVAL(SYS_TCx_TSZ, 0)
96#define SYS_TCx_TSZ_32 __REGVAL(SYS_TCx_TSZ, 1)
97
98/* Timer x Control register: Reload enable */
99#define SYS_TCx_REN __REGBIT(0)
100#define SYS_TCx_REN_DIS __REGVAL(SYS_TCx_REN, 0)
101#define SYS_TCx_REN_EN __REGVAL(SYS_TCx_REN, 1)
102
103/* System Memory Chip Select x Dynamic Memory Base */
104#define SYS_SMCSDMB(x) __REG2(0xa09001d0, (x) << 1)
105
106/* System Memory Chip Select x Dynamic Memory Mask */
107#define SYS_SMCSDMM(x) __REG2(0xa09001d4, (x) << 1)
108
109/* System Memory Chip Select x Static Memory Base */
110#define SYS_SMCSSMB(x) __REG2(0xa09001f0, (x) << 1)
111
112/* System Memory Chip Select x Static Memory Base: Chip select x base */
113#define SYS_SMCSSMB_CSxB __REGBITS(31, 12)
114
115/* System Memory Chip Select x Static Memory Mask */
116#define SYS_SMCSSMM(x) __REG2(0xa09001f4, (x) << 1)
117
118/* System Memory Chip Select x Static Memory Mask: Chip select x mask */
119#define SYS_SMCSSMM_CSxM __REGBITS(31, 12)
120
121/* System Memory Chip Select x Static Memory Mask: Chip select x enable */
122#define SYS_SMCSSMM_CSEx __REGBIT(0)
123#define SYS_SMCSSMM_CSEx_DIS __REGVAL(SYS_SMCSSMM_CSEx, 0)
124#define SYS_SMCSSMM_CSEx_EN __REGVAL(SYS_SMCSSMM_CSEx, 1)
125
126/* General purpose, user-defined ID register */
127#define SYS_GENID __REG(0xa0900210)
128
129/* External Interrupt x Control register */
130#define SYS_EIC(x) __REG2(0xa0900214, (x))
131
132/* External Interrupt x Control register: Status */
133#define SYS_EIC_STS __REGBIT(3)
134
135/* External Interrupt x Control register: Clear */
136#define SYS_EIC_CLR __REGBIT(2)
137
138/* External Interrupt x Control register: Polarity */
139#define SYS_EIC_PLTY __REGBIT(1)
140#define SYS_EIC_PLTY_AH __REGVAL(SYS_EIC_PLTY, 0)
141#define SYS_EIC_PLTY_AL __REGVAL(SYS_EIC_PLTY, 1)
142
143/* External Interrupt x Control register: Level edge */
144#define SYS_EIC_LVEDG __REGBIT(0)
145#define SYS_EIC_LVEDG_LEVEL __REGVAL(SYS_EIC_LVEDG, 0)
146#define SYS_EIC_LVEDG_EDGE __REGVAL(SYS_EIC_LVEDG, 1)
147
148#endif /* ifndef __ASM_ARCH_REGSSYSNS9360_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/system.h b/arch/arm/mach-ns9xxx/include/mach/system.h
new file mode 100644
index 000000000000..e2068c57415f
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/system.h
@@ -0,0 +1,35 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/system.h
3 *
4 * Copyright (C) 2006,2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H
13
14#include <asm/proc-fns.h>
15#include <mach/processor.h>
16#include <mach/processor-ns9360.h>
17
18static inline void arch_idle(void)
19{
20 cpu_do_idle();
21}
22
23static inline void arch_reset(char mode)
24{
25#ifdef CONFIG_PROCESSOR_NS9360
26 if (processor_is_ns9360())
27 ns9360_reset(mode);
28 else
29#endif
30 BUG();
31
32 BUG();
33}
34
35#endif /* ifndef __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/timex.h b/arch/arm/mach-ns9xxx/include/mach/timex.h
new file mode 100644
index 000000000000..734a8d8bd578
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/timex.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/timex.h
3 *
4 * Copyright (C) 2005-2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_TIMEX_H
12#define __ASM_ARCH_TIMEX_H
13
14/*
15 * value for CLOCK_TICK_RATE stolen from arch/arm/mach-s3c2410/include/mach/timex.h.
16 * See there for an explanation.
17 */
18#define CLOCK_TICK_RATE 12000000
19
20#endif /* ifndef __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/uncompress.h b/arch/arm/mach-ns9xxx/include/mach/uncompress.h
new file mode 100644
index 000000000000..5dbc3c5167c8
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/uncompress.h
@@ -0,0 +1,164 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/uncompress.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_UNCOMPRESS_H
12#define __ASM_ARCH_UNCOMPRESS_H
13
14#include <asm/io.h>
15
16#define __REG(x) ((void __iomem __force *)(x))
17
18static void putc_dummy(char c, void __iomem *base)
19{
20 /* nothing */
21}
22
23static void putc_ns9360(char c, void __iomem *base)
24{
25 static int t = 0x10000;
26 do {
27 if (t)
28 --t;
29
30 if (__raw_readl(base + 8) & (1 << 3)) {
31 __raw_writeb(c, base + 16);
32 t = 0x10000;
33 break;
34 }
35 } while (t);
36}
37
38static void putc_a9m9750dev(char c, void __iomem *base)
39{
40 static int t = 0x10000;
41 do {
42 if (t)
43 --t;
44
45 if (__raw_readb(base + 5) & (1 << 5)) {
46 __raw_writeb(c, base);
47 t = 0x10000;
48 break;
49 }
50 } while (t);
51
52}
53
54static void putc_ns921x(char c, void __iomem *base)
55{
56 static int t = 0x10000;
57 do {
58 if (t)
59 --t;
60
61 if (!(__raw_readl(base) & (1 << 11))) {
62 __raw_writeb(c, base + 0x0028);
63 t = 0x10000;
64 break;
65 }
66 } while (t);
67}
68
69#define MSCS __REG(0xA0900184)
70
71#define NS9360_UARTA __REG(0x90200040)
72#define NS9360_UARTB __REG(0x90200000)
73#define NS9360_UARTC __REG(0x90300000)
74#define NS9360_UARTD __REG(0x90300040)
75
76#define NS9360_UART_ENABLED(base) \
77 (__raw_readl(NS9360_UARTA) & (1 << 31))
78
79#define A9M9750DEV_UARTA __REG(0x40000000)
80
81#define NS921XSYS_CLOCK __REG(0xa090017c)
82#define NS921X_UARTA __REG(0x90010000)
83#define NS921X_UARTB __REG(0x90018000)
84#define NS921X_UARTC __REG(0x90020000)
85#define NS921X_UARTD __REG(0x90028000)
86
87#define NS921X_UART_ENABLED(base) \
88 (__raw_readl((base) + 0x1000) & (1 << 29))
89
90static void autodetect(void (**putc)(char, void __iomem *), void __iomem **base)
91{
92 if (((__raw_readl(MSCS) >> 16) & 0xfe) == 0x00) {
93 /* ns9360 or ns9750 */
94 if (NS9360_UART_ENABLED(NS9360_UARTA)) {
95 *putc = putc_ns9360;
96 *base = NS9360_UARTA;
97 return;
98 } else if (NS9360_UART_ENABLED(NS9360_UARTB)) {
99 *putc = putc_ns9360;
100 *base = NS9360_UARTB;
101 return;
102 } else if (NS9360_UART_ENABLED(NS9360_UARTC)) {
103 *putc = putc_ns9360;
104 *base = NS9360_UARTC;
105 return;
106 } else if (NS9360_UART_ENABLED(NS9360_UARTD)) {
107 *putc = putc_ns9360;
108 *base = NS9360_UARTD;
109 return;
110 } else if (__raw_readl(__REG(0xa09001f4)) == 0xfffff001) {
111 *putc = putc_a9m9750dev;
112 *base = A9M9750DEV_UARTA;
113 return;
114 }
115 } else if (((__raw_readl(MSCS) >> 16) & 0xfe) == 0x02) {
116 /* ns921x */
117 u32 clock = __raw_readl(NS921XSYS_CLOCK);
118
119 if ((clock & (1 << 1)) &&
120 NS921X_UART_ENABLED(NS921X_UARTA)) {
121 *putc = putc_ns921x;
122 *base = NS921X_UARTA;
123 return;
124 } else if ((clock & (1 << 2)) &&
125 NS921X_UART_ENABLED(NS921X_UARTB)) {
126 *putc = putc_ns921x;
127 *base = NS921X_UARTB;
128 return;
129 } else if ((clock & (1 << 3)) &&
130 NS921X_UART_ENABLED(NS921X_UARTC)) {
131 *putc = putc_ns921x;
132 *base = NS921X_UARTC;
133 return;
134 } else if ((clock & (1 << 4)) &&
135 NS921X_UART_ENABLED(NS921X_UARTD)) {
136 *putc = putc_ns921x;
137 *base = NS921X_UARTD;
138 return;
139 }
140 }
141
142 *putc = putc_dummy;
143}
144
145void (*myputc)(char, void __iomem *);
146void __iomem *base;
147
148static void putc(char c)
149{
150 myputc(c, base);
151}
152
153static void arch_decomp_setup(void)
154{
155 autodetect(&myputc, &base);
156}
157#define arch_decomp_wdog()
158
159static void flush(void)
160{
161 /* nothing */
162}
163
164#endif /* ifndef __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-ns9xxx/include/mach/vmalloc.h b/arch/arm/mach-ns9xxx/include/mach/vmalloc.h
new file mode 100644
index 000000000000..fe964d3bcc47
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/include/mach/vmalloc.h
@@ -0,0 +1,16 @@
1/*
2 * arch/arm/mach-ns9xxx/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_VMALLOC_H
12#define __ASM_ARCH_VMALLOC_H
13
14#define VMALLOC_END (0xf0000000)
15
16#endif /* ifndef __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c
index ca85d24cf39f..38260d5f849b 100644
--- a/arch/arm/mach-ns9xxx/irq.c
+++ b/arch/arm/mach-ns9xxx/irq.c
@@ -12,10 +12,9 @@
12#include <linux/kernel_stat.h> 12#include <linux/kernel_stat.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/mach/irq.h> 14#include <asm/mach/irq.h>
15#include <asm/mach-types.h> 15#include <mach/regs-sys-common.h>
16#include <asm/arch-ns9xxx/regs-sys-common.h> 16#include <mach/irqs.h>
17#include <asm/arch-ns9xxx/irqs.h> 17#include <mach/board.h>
18#include <asm/arch-ns9xxx/board.h>
19 18
20#include "generic.h" 19#include "generic.h"
21 20
diff --git a/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c b/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c
index 9623fff6b3bc..2858417d8d8a 100644
--- a/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c
+++ b/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c
@@ -11,7 +11,7 @@
11#include <asm/mach/arch.h> 11#include <asm/mach/arch.h>
12#include <asm/mach-types.h> 12#include <asm/mach-types.h>
13 13
14#include <asm/arch-ns9xxx/processor-ns9360.h> 14#include <mach/processor-ns9360.h>
15 15
16#include "board-a9m9750dev.h" 16#include "board-a9m9750dev.h"
17#include "generic.h" 17#include "generic.h"
diff --git a/arch/arm/mach-ns9xxx/mach-cc9p9360js.c b/arch/arm/mach-ns9xxx/mach-cc9p9360js.c
index fcc815bdd291..729f68da4293 100644
--- a/arch/arm/mach-ns9xxx/mach-cc9p9360js.c
+++ b/arch/arm/mach-ns9xxx/mach-cc9p9360js.c
@@ -11,7 +11,7 @@
11#include <asm/mach/arch.h> 11#include <asm/mach/arch.h>
12#include <asm/mach-types.h> 12#include <asm/mach-types.h>
13 13
14#include <asm/arch-ns9xxx/processor-ns9360.h> 14#include <mach/processor-ns9360.h>
15 15
16#include "board-jscc9p9360.h" 16#include "board-jscc9p9360.h"
17#include "generic.h" 17#include "generic.h"
diff --git a/arch/arm/mach-ns9xxx/plat-serial8250.c b/arch/arm/mach-ns9xxx/plat-serial8250.c
index 5aa5d9baf8c8..795b15e8982a 100644
--- a/arch/arm/mach-ns9xxx/plat-serial8250.c
+++ b/arch/arm/mach-ns9xxx/plat-serial8250.c
@@ -11,8 +11,8 @@
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <linux/serial_8250.h> 12#include <linux/serial_8250.h>
13 13
14#include <asm/arch-ns9xxx/regs-board-a9m9750dev.h> 14#include <mach/regs-board-a9m9750dev.h>
15#include <asm/arch-ns9xxx/board.h> 15#include <mach/board.h>
16 16
17#define DRIVER_NAME "serial8250" 17#define DRIVER_NAME "serial8250"
18 18
diff --git a/arch/arm/mach-ns9xxx/processor-ns9360.c b/arch/arm/mach-ns9xxx/processor-ns9360.c
index 2bee0b7fccbb..abee8338735d 100644
--- a/arch/arm/mach-ns9xxx/processor-ns9360.c
+++ b/arch/arm/mach-ns9xxx/processor-ns9360.c
@@ -14,8 +14,8 @@
14 14
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17#include <asm/arch-ns9xxx/processor-ns9360.h> 17#include <mach/processor-ns9360.h>
18#include <asm/arch-ns9xxx/regs-sys-ns9360.h> 18#include <mach/regs-sys-ns9360.h>
19 19
20void ns9360_reset(char mode) 20void ns9360_reset(char mode)
21{ 21{
diff --git a/arch/arm/mach-ns9xxx/time-ns9360.c b/arch/arm/mach-ns9xxx/time-ns9360.c
index 4d573c9793ed..a63424d083d9 100644
--- a/arch/arm/mach-ns9xxx/time-ns9360.c
+++ b/arch/arm/mach-ns9xxx/time-ns9360.c
@@ -15,10 +15,10 @@
15#include <linux/clocksource.h> 15#include <linux/clocksource.h>
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17 17
18#include <asm/arch-ns9xxx/processor-ns9360.h> 18#include <mach/processor-ns9360.h>
19#include <asm/arch-ns9xxx/regs-sys-ns9360.h> 19#include <mach/regs-sys-ns9360.h>
20#include <asm/arch-ns9xxx/irqs.h> 20#include <mach/irqs.h>
21#include <asm/arch/system.h> 21#include <mach/system.h>
22#include "generic.h" 22#include "generic.h"
23 23
24#define TIMER_CLOCKSOURCE 0 24#define TIMER_CLOCKSOURCE 0
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 8b102ad59c14..2e618391cc51 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -17,18 +17,18 @@
17#include <linux/input.h> 17#include <linux/input.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24 24
25#include <asm/arch/board-ams-delta.h> 25#include <mach/board-ams-delta.h>
26#include <asm/arch/gpio.h> 26#include <mach/gpio.h>
27#include <asm/arch/keypad.h> 27#include <mach/keypad.h>
28#include <asm/arch/mux.h> 28#include <mach/mux.h>
29#include <asm/arch/usb.h> 29#include <mach/usb.h>
30#include <asm/arch/board.h> 30#include <mach/board.h>
31#include <asm/arch/common.h> 31#include <mach/common.h>
32 32
33static u8 ams_delta_latch1_reg; 33static u8 ams_delta_latch1_reg;
34static u16 ams_delta_latch2_reg; 34static u16 ams_delta_latch2_reg;
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 1bdb66638e29..db789461fca4 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -20,21 +20,21 @@
20#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
21#include <linux/input.h> 21#include <linux/input.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/flash.h> 26#include <asm/mach/flash.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28 28
29#include <asm/arch/tc.h> 29#include <mach/tc.h>
30#include <asm/arch/gpio.h> 30#include <mach/gpio.h>
31#include <asm/arch/mux.h> 31#include <mach/mux.h>
32#include <asm/arch/fpga.h> 32#include <mach/fpga.h>
33#include <asm/arch/nand.h> 33#include <mach/nand.h>
34#include <asm/arch/keypad.h> 34#include <mach/keypad.h>
35#include <asm/arch/common.h> 35#include <mach/common.h>
36#include <asm/arch/board.h> 36#include <mach/board.h>
37#include <asm/arch/board-fsample.h> 37#include <mach/board-fsample.h>
38 38
39static int fsample_keymap[] = { 39static int fsample_keymap[] = {
40 KEY(0,0,KEY_UP), 40 KEY(0,0,KEY_UP),
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index c711bf23f7b4..7d2670205373 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -17,16 +17,16 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24 24
25#include <asm/arch/gpio.h> 25#include <mach/gpio.h>
26#include <asm/arch/mux.h> 26#include <mach/mux.h>
27#include <asm/arch/usb.h> 27#include <mach/usb.h>
28#include <asm/arch/board.h> 28#include <mach/board.h>
29#include <asm/arch/common.h> 29#include <mach/common.h>
30 30
31static void __init omap_generic_init_irq(void) 31static void __init omap_generic_init_irq(void)
32{ 32{
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
index 6fdc78406b21..ab9ee5820c48 100644
--- a/arch/arm/mach-omap1/board-h2-mmc.c
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -12,8 +12,8 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <asm/arch/mmc.h> 15#include <mach/mmc.h>
16#include <asm/arch/gpio.h> 16#include <mach/gpio.h>
17 17
18#ifdef CONFIG_MMC_OMAP 18#ifdef CONFIG_MMC_OMAP
19static int slot_cover_open; 19static int slot_cover_open;
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 4b444fdaafea..3b65914b9141 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -29,7 +29,7 @@
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/i2c/tps65010.h> 30#include <linux/i2c/tps65010.h>
31 31
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/gpio.h> 33#include <asm/gpio.h>
34 34
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
@@ -37,16 +37,16 @@
37#include <asm/mach/flash.h> 37#include <asm/mach/flash.h>
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
39 39
40#include <asm/arch/gpio-switch.h> 40#include <mach/gpio-switch.h>
41#include <asm/arch/mux.h> 41#include <mach/mux.h>
42#include <asm/arch/tc.h> 42#include <mach/tc.h>
43#include <asm/arch/nand.h> 43#include <mach/nand.h>
44#include <asm/arch/irda.h> 44#include <mach/irda.h>
45#include <asm/arch/usb.h> 45#include <mach/usb.h>
46#include <asm/arch/keypad.h> 46#include <mach/keypad.h>
47#include <asm/arch/common.h> 47#include <mach/common.h>
48#include <asm/arch/mcbsp.h> 48#include <mach/mcbsp.h>
49#include <asm/arch/omap-alsa.h> 49#include <mach/omap-alsa.h>
50 50
51static int h2_keymap[] = { 51static int h2_keymap[] = {
52 KEY(0, 0, KEY_LEFT), 52 KEY(0, 0, KEY_LEFT),
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
index 66ecc437928f..36085819098c 100644
--- a/arch/arm/mach-omap1/board-h3-mmc.c
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -12,8 +12,8 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <asm/arch/mmc.h> 15#include <mach/mmc.h>
16#include <asm/arch/gpio.h> 16#include <mach/gpio.h>
17 17
18#ifdef CONFIG_MMC_OMAP 18#ifdef CONFIG_MMC_OMAP
19static int slot_cover_open; 19static int slot_cover_open;
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 7fbaa8d648cd..2ced6d9984d2 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -31,7 +31,7 @@
31 31
32#include <asm/setup.h> 32#include <asm/setup.h>
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35#include <asm/gpio.h> 35#include <asm/gpio.h>
36 36
37#include <asm/mach-types.h> 37#include <asm/mach-types.h>
@@ -39,18 +39,18 @@
39#include <asm/mach/flash.h> 39#include <asm/mach/flash.h>
40#include <asm/mach/map.h> 40#include <asm/mach/map.h>
41 41
42#include <asm/arch/gpioexpander.h> 42#include <mach/gpioexpander.h>
43#include <asm/arch/irqs.h> 43#include <mach/irqs.h>
44#include <asm/arch/mux.h> 44#include <mach/mux.h>
45#include <asm/arch/tc.h> 45#include <mach/tc.h>
46#include <asm/arch/nand.h> 46#include <mach/nand.h>
47#include <asm/arch/irda.h> 47#include <mach/irda.h>
48#include <asm/arch/usb.h> 48#include <mach/usb.h>
49#include <asm/arch/keypad.h> 49#include <mach/keypad.h>
50#include <asm/arch/dma.h> 50#include <mach/dma.h>
51#include <asm/arch/common.h> 51#include <mach/common.h>
52#include <asm/arch/mcbsp.h> 52#include <mach/mcbsp.h>
53#include <asm/arch/omap-alsa.h> 53#include <mach/omap-alsa.h>
54 54
55#define H3_TS_GPIO 48 55#define H3_TS_GPIO 48
56 56
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 4b8ae3ee0d05..cbc11be5cd2a 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -24,21 +24,21 @@
24#include <linux/mtd/partitions.h> 24#include <linux/mtd/partitions.h>
25#include <linux/input.h> 25#include <linux/input.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30#include <asm/mach/flash.h> 30#include <asm/mach/flash.h>
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32 32
33#include <asm/arch/mux.h> 33#include <mach/mux.h>
34#include <asm/arch/fpga.h> 34#include <mach/fpga.h>
35#include <asm/arch/gpio.h> 35#include <mach/gpio.h>
36#include <asm/arch/tc.h> 36#include <mach/tc.h>
37#include <asm/arch/usb.h> 37#include <mach/usb.h>
38#include <asm/arch/keypad.h> 38#include <mach/keypad.h>
39#include <asm/arch/common.h> 39#include <mach/common.h>
40#include <asm/arch/mcbsp.h> 40#include <mach/mcbsp.h>
41#include <asm/arch/omap-alsa.h> 41#include <mach/omap-alsa.h>
42 42
43static int innovator_keymap[] = { 43static int innovator_keymap[] = {
44 KEY(0, 0, KEY_F1), 44 KEY(0, 0, KEY_F1),
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 3f39e0e79c9f..38d9783ac6d6 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -20,21 +20,21 @@
20#include <linux/workqueue.h> 20#include <linux/workqueue.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <asm/arch/gpio.h> 28#include <mach/gpio.h>
29#include <asm/arch/mux.h> 29#include <mach/mux.h>
30#include <asm/arch/usb.h> 30#include <mach/usb.h>
31#include <asm/arch/board.h> 31#include <mach/board.h>
32#include <asm/arch/keypad.h> 32#include <mach/keypad.h>
33#include <asm/arch/common.h> 33#include <mach/common.h>
34#include <asm/arch/dsp_common.h> 34#include <mach/dsp_common.h>
35#include <asm/arch/aic23.h> 35#include <mach/aic23.h>
36#include <asm/arch/omapfb.h> 36#include <mach/omapfb.h>
37#include <asm/arch/lcd_mipid.h> 37#include <mach/lcd_mipid.h>
38 38
39#define ADS7846_PENDOWN_GPIO 15 39#define ADS7846_PENDOWN_GPIO 15
40 40
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 41f94f6fc15c..3e766e49f7cc 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -39,7 +39,7 @@
39 39
40#include <linux/i2c/tps65010.h> 40#include <linux/i2c/tps65010.h>
41 41
42#include <asm/hardware.h> 42#include <mach/hardware.h>
43#include <asm/gpio.h> 43#include <asm/gpio.h>
44 44
45#include <asm/mach-types.h> 45#include <asm/mach-types.h>
@@ -47,12 +47,12 @@
47#include <asm/mach/map.h> 47#include <asm/mach/map.h>
48#include <asm/mach/flash.h> 48#include <asm/mach/flash.h>
49 49
50#include <asm/arch/usb.h> 50#include <mach/usb.h>
51#include <asm/arch/mux.h> 51#include <mach/mux.h>
52#include <asm/arch/tc.h> 52#include <mach/tc.h>
53#include <asm/arch/common.h> 53#include <mach/common.h>
54#include <asm/arch/mcbsp.h> 54#include <mach/mcbsp.h>
55#include <asm/arch/omap-alsa.h> 55#include <mach/omap-alsa.h>
56 56
57static struct mtd_partition osk_partitions[] = { 57static struct mtd_partition osk_partitions[] = {
58 /* bootloader (U-Boot, etc) in first sector */ 58 /* bootloader (U-Boot, etc) in first sector */
@@ -340,7 +340,7 @@ static struct omap_board_config_kernel osk_config[] __initdata = {
340#include <linux/spi/spi.h> 340#include <linux/spi/spi.h>
341#include <linux/spi/ads7846.h> 341#include <linux/spi/ads7846.h>
342 342
343#include <asm/arch/keypad.h> 343#include <mach/keypad.h>
344 344
345static const int osk_keymap[] = { 345static const int osk_keymap[] = {
346 /* KEY(col, row, code) */ 346 /* KEY(col, row, code) */
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index a4d20127a60e..b58043644a6f 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -27,23 +27,23 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/apm-emulation.h> 28#include <linux/apm-emulation.h>
29 29
30#include <asm/hardware.h> 30#include <mach/hardware.h>
31#include <asm/mach-types.h> 31#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34#include <asm/mach/flash.h> 34#include <asm/mach/flash.h>
35 35
36#include <asm/arch/gpio.h> 36#include <mach/gpio.h>
37#include <asm/arch/mux.h> 37#include <mach/mux.h>
38#include <asm/arch/usb.h> 38#include <mach/usb.h>
39#include <asm/arch/tc.h> 39#include <mach/tc.h>
40#include <asm/arch/dma.h> 40#include <mach/dma.h>
41#include <asm/arch/board.h> 41#include <mach/board.h>
42#include <asm/arch/irda.h> 42#include <mach/irda.h>
43#include <asm/arch/keypad.h> 43#include <mach/keypad.h>
44#include <asm/arch/common.h> 44#include <mach/common.h>
45#include <asm/arch/mcbsp.h> 45#include <mach/mcbsp.h>
46#include <asm/arch/omap-alsa.h> 46#include <mach/omap-alsa.h>
47 47
48static void __init omap_palmte_init_irq(void) 48static void __init omap_palmte_init_irq(void)
49{ 49{
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 2a033689f9f4..40f9860a09df 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -23,24 +23,24 @@
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <linux/leds.h> 24#include <linux/leds.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30#include <asm/mach/flash.h> 30#include <asm/mach/flash.h>
31 31
32#include <asm/arch/led.h> 32#include <mach/led.h>
33#include <asm/arch/mcbsp.h> 33#include <mach/mcbsp.h>
34#include <asm/arch/gpio.h> 34#include <mach/gpio.h>
35#include <asm/arch/mux.h> 35#include <mach/mux.h>
36#include <asm/arch/usb.h> 36#include <mach/usb.h>
37#include <asm/arch/dma.h> 37#include <mach/dma.h>
38#include <asm/arch/tc.h> 38#include <mach/tc.h>
39#include <asm/arch/board.h> 39#include <mach/board.h>
40#include <asm/arch/irda.h> 40#include <mach/irda.h>
41#include <asm/arch/keypad.h> 41#include <mach/keypad.h>
42#include <asm/arch/common.h> 42#include <mach/common.h>
43#include <asm/arch/omap-alsa.h> 43#include <mach/omap-alsa.h>
44 44
45#include <linux/spi/spi.h> 45#include <linux/spi/spi.h>
46#include <linux/spi/ads7846.h> 46#include <linux/spi/ads7846.h>
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 34389b63b0ec..e719294250b1 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -26,23 +26,23 @@
26#include <linux/mtd/mtd.h> 26#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h> 27#include <linux/mtd/partitions.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33#include <asm/mach/flash.h> 33#include <asm/mach/flash.h>
34 34
35#include <asm/arch/mcbsp.h> 35#include <mach/mcbsp.h>
36#include <asm/arch/gpio.h> 36#include <mach/gpio.h>
37#include <asm/arch/mux.h> 37#include <mach/mux.h>
38#include <asm/arch/usb.h> 38#include <mach/usb.h>
39#include <asm/arch/dma.h> 39#include <mach/dma.h>
40#include <asm/arch/tc.h> 40#include <mach/tc.h>
41#include <asm/arch/board.h> 41#include <mach/board.h>
42#include <asm/arch/irda.h> 42#include <mach/irda.h>
43#include <asm/arch/keypad.h> 43#include <mach/keypad.h>
44#include <asm/arch/common.h> 44#include <mach/common.h>
45#include <asm/arch/omap-alsa.h> 45#include <mach/omap-alsa.h>
46 46
47#include <linux/spi/spi.h> 47#include <linux/spi/spi.h>
48#include <linux/spi/ads7846.h> 48#include <linux/spi/ads7846.h>
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 94bc0745ab2c..b715917bfdaf 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -20,20 +20,20 @@
20#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
21#include <linux/input.h> 21#include <linux/input.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/flash.h> 26#include <asm/mach/flash.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28 28
29#include <asm/arch/tc.h> 29#include <mach/tc.h>
30#include <asm/arch/gpio.h> 30#include <mach/gpio.h>
31#include <asm/arch/mux.h> 31#include <mach/mux.h>
32#include <asm/arch/fpga.h> 32#include <mach/fpga.h>
33#include <asm/arch/nand.h> 33#include <mach/nand.h>
34#include <asm/arch/keypad.h> 34#include <mach/keypad.h>
35#include <asm/arch/common.h> 35#include <mach/common.h>
36#include <asm/arch/board.h> 36#include <mach/board.h>
37 37
38static int p2_keymap[] = { 38static int p2_keymap[] = {
39 KEY(0,0,KEY_UP), 39 KEY(0,0,KEY_UP),
diff --git a/arch/arm/mach-omap1/board-sx1-mmc.c b/arch/arm/mach-omap1/board-sx1-mmc.c
index 8c93d47719e8..0be4ebaa2842 100644
--- a/arch/arm/mach-omap1/board-sx1-mmc.c
+++ b/arch/arm/mach-omap1/board-sx1-mmc.c
@@ -12,9 +12,9 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <asm/arch/hardware.h> 15#include <mach/hardware.h>
16#include <asm/arch/mmc.h> 16#include <mach/mmc.h>
17#include <asm/arch/gpio.h> 17#include <mach/gpio.h>
18 18
19#ifdef CONFIG_MMC_OMAP 19#ifdef CONFIG_MMC_OMAP
20static int slot_cover_open; 20static int slot_cover_open;
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index e473fa6d4a5f..130bcc6fd082 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -26,22 +26,22 @@
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/errno.h> 27#include <linux/errno.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/flash.h> 32#include <asm/mach/flash.h>
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34 34
35#include <asm/arch/gpio.h> 35#include <mach/gpio.h>
36#include <asm/arch/mux.h> 36#include <mach/mux.h>
37#include <asm/arch/irda.h> 37#include <mach/irda.h>
38#include <asm/arch/usb.h> 38#include <mach/usb.h>
39#include <asm/arch/tc.h> 39#include <mach/tc.h>
40#include <asm/arch/board.h> 40#include <mach/board.h>
41#include <asm/arch/common.h> 41#include <mach/common.h>
42#include <asm/arch/mcbsp.h> 42#include <mach/mcbsp.h>
43#include <asm/arch/omap-alsa.h> 43#include <mach/omap-alsa.h>
44#include <asm/arch/keypad.h> 44#include <mach/keypad.h>
45 45
46/* Write to I2C device */ 46/* Write to I2C device */
47int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value) 47int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 8948d45a2769..213b48787102 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -22,17 +22,17 @@
22#include <linux/serial_8250.h> 22#include <linux/serial_8250.h>
23#include <linux/serial_reg.h> 23#include <linux/serial_reg.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/flash.h> 28#include <asm/mach/flash.h>
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30 30
31#include <asm/arch/common.h> 31#include <mach/common.h>
32#include <asm/arch/gpio.h> 32#include <mach/gpio.h>
33#include <asm/arch/mux.h> 33#include <mach/mux.h>
34#include <asm/arch/tc.h> 34#include <mach/tc.h>
35#include <asm/arch/usb.h> 35#include <mach/usb.h>
36 36
37static struct plat_serial8250_port voiceblue_ports[] = { 37static struct plat_serial8250_port voiceblue_ports[] = {
38 { 38 {
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 4ea2933f887d..5965cf09f8c4 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -21,10 +21,10 @@
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23 23
24#include <asm/arch/cpu.h> 24#include <mach/cpu.h>
25#include <asm/arch/usb.h> 25#include <mach/usb.h>
26#include <asm/arch/clock.h> 26#include <mach/clock.h>
27#include <asm/arch/sram.h> 27#include <mach/sram.h>
28 28
29#include "clock.h" 29#include "clock.h"
30 30
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index da8a3ac47e13..ab708d4c597e 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -14,15 +14,14 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16
17#include <asm/hardware.h> 17#include <mach/hardware.h>
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/mach-types.h>
20#include <asm/mach/map.h> 19#include <asm/mach/map.h>
21 20
22#include <asm/arch/tc.h> 21#include <mach/tc.h>
23#include <asm/arch/board.h> 22#include <mach/board.h>
24#include <asm/arch/mux.h> 23#include <mach/mux.h>
25#include <asm/arch/gpio.h> 24#include <mach/gpio.h>
26 25
27/*-------------------------------------------------------------------------*/ 26/*-------------------------------------------------------------------------*/
28 27
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index d963125ed755..4449d86095f6 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -22,13 +22,13 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/errno.h> 23#include <linux/errno.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <asm/arch/fpga.h> 30#include <mach/fpga.h>
31#include <asm/arch/gpio.h> 31#include <mach/gpio.h>
32 32
33static void fpga_mask_irq(unsigned int irq) 33static void fpga_mask_irq(unsigned int irq)
34{ 34{
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 81c4e738506c..2b9750b200ce 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -15,8 +15,8 @@
15#include <asm/tlb.h> 15#include <asm/tlb.h>
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/arch/mux.h> 18#include <mach/mux.h>
19#include <asm/arch/tc.h> 19#include <mach/tc.h>
20 20
21extern int omap1_clk_init(void); 21extern int omap1_clk_init(void);
22extern void omap_check_revision(void); 22extern void omap_check_revision(void);
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index 1da9d59a0347..0ec6c1ec4250 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -41,11 +41,11 @@
41#include <linux/sched.h> 41#include <linux/sched.h>
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43 43
44#include <asm/hardware.h> 44#include <mach/hardware.h>
45#include <asm/irq.h> 45#include <asm/irq.h>
46#include <asm/mach/irq.h> 46#include <asm/mach/irq.h>
47#include <asm/arch/gpio.h> 47#include <mach/gpio.h>
48#include <asm/arch/cpu.h> 48#include <mach/cpu.h>
49 49
50#include <asm/io.h> 50#include <asm/io.h>
51 51
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c
index 8976fbb21f7c..610f51f18741 100644
--- a/arch/arm/mach-omap1/leds-h2p2-debug.c
+++ b/arch/arm/mach-omap1/leds-h2p2-debug.c
@@ -14,13 +14,13 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15 15
16#include <asm/io.h> 16#include <asm/io.h>
17#include <asm/hardware.h> 17#include <mach/hardware.h>
18#include <asm/leds.h> 18#include <asm/leds.h>
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21 21
22#include <asm/arch/fpga.h> 22#include <mach/fpga.h>
23#include <asm/arch/gpio.h> 23#include <mach/gpio.h>
24 24
25#include "leds.h" 25#include "leds.h"
26 26
diff --git a/arch/arm/mach-omap1/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c
index e7835d6f53a0..9b99c2894623 100644
--- a/arch/arm/mach-omap1/leds-innovator.c
+++ b/arch/arm/mach-omap1/leds-innovator.c
@@ -3,7 +3,7 @@
3 */ 3 */
4#include <linux/init.h> 4#include <linux/init.h>
5 5
6#include <asm/hardware.h> 6#include <mach/hardware.h>
7#include <asm/leds.h> 7#include <asm/leds.h>
8#include <asm/system.h> 8#include <asm/system.h>
9 9
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c
index 754383dde807..98e789622dfd 100644
--- a/arch/arm/mach-omap1/leds-osk.c
+++ b/arch/arm/mach-omap1/leds-osk.c
@@ -5,11 +5,11 @@
5 */ 5 */
6#include <linux/init.h> 6#include <linux/init.h>
7 7
8#include <asm/hardware.h> 8#include <mach/hardware.h>
9#include <asm/leds.h> 9#include <asm/leds.h>
10#include <asm/system.h> 10#include <asm/system.h>
11 11
12#include <asm/arch/gpio.h> 12#include <mach/gpio.h>
13 13
14#include "leds.h" 14#include "leds.h"
15 15
diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c
index 3f9dcac4fd41..6cdad93c4a00 100644
--- a/arch/arm/mach-omap1/leds.c
+++ b/arch/arm/mach-omap1/leds.c
@@ -9,8 +9,8 @@
9#include <asm/leds.h> 9#include <asm/leds.h>
10#include <asm/mach-types.h> 10#include <asm/mach-types.h>
11 11
12#include <asm/arch/gpio.h> 12#include <mach/gpio.h>
13#include <asm/arch/mux.h> 13#include <mach/mux.h>
14 14
15#include "leds.h" 15#include "leds.h"
16 16
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index bad1e7152d8e..af44eab1ed24 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -13,8 +13,8 @@
13#include <linux/resource.h> 13#include <linux/resource.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <asm/arch/mailbox.h> 16#include <mach/mailbox.h>
17#include <asm/arch/irqs.h> 17#include <mach/irqs.h>
18#include <asm/io.h> 18#include <asm/io.h>
19 19
20#define MAILBOX_ARM2DSP1 0x00 20#define MAILBOX_ARM2DSP1 0x00
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index 2d2c2522b048..826010d5d014 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -17,11 +17,11 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <asm/arch/dma.h> 20#include <mach/dma.h>
21#include <asm/arch/mux.h> 21#include <mach/mux.h>
22#include <asm/arch/cpu.h> 22#include <mach/cpu.h>
23#include <asm/arch/mcbsp.h> 23#include <mach/mcbsp.h>
24#include <asm/arch/dsp_common.h> 24#include <mach/dsp_common.h>
25 25
26#define DPS_RSTCT2_PER_EN (1 << 0) 26#define DPS_RSTCT2_PER_EN (1 << 0)
27#define DSP_RSTCT2_WD_PER_EN (1 << 1) 27#define DSP_RSTCT2_WD_PER_EN (1 << 1)
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c
index e207bf7cb853..898516e362e7 100644
--- a/arch/arm/mach-omap1/mux.c
+++ b/arch/arm/mach-omap1/mux.c
@@ -28,7 +28,7 @@
28#include <asm/io.h> 28#include <asm/io.h>
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30 30
31#include <asm/arch/mux.h> 31#include <mach/mux.h>
32 32
33#ifdef CONFIG_OMAP_MUX 33#ifdef CONFIG_OMAP_MUX
34 34
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 742f79e73bd7..63c4ea18b1ca 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -47,17 +47,16 @@
47#include <asm/atomic.h> 47#include <asm/atomic.h>
48#include <asm/mach/time.h> 48#include <asm/mach/time.h>
49#include <asm/mach/irq.h> 49#include <asm/mach/irq.h>
50#include <asm/mach-types.h> 50
51 51#include <mach/cpu.h>
52#include <asm/arch/cpu.h> 52#include <mach/irqs.h>
53#include <asm/arch/irqs.h> 53#include <mach/clock.h>
54#include <asm/arch/clock.h> 54#include <mach/sram.h>
55#include <asm/arch/sram.h> 55#include <mach/tc.h>
56#include <asm/arch/tc.h> 56#include <mach/pm.h>
57#include <asm/arch/pm.h> 57#include <mach/mux.h>
58#include <asm/arch/mux.h> 58#include <mach/dma.h>
59#include <asm/arch/dma.h> 59#include <mach/dmtimer.h>
60#include <asm/arch/dmtimer.h>
61 60
62static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE]; 61static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE];
63static unsigned short dsp_sleep_save[DSP_SLEEP_SAVE_SIZE]; 62static unsigned short dsp_sleep_save[DSP_SLEEP_SAVE_SIZE];
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 10a4fe88b2fd..0e25a996bb4c 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -22,12 +22,12 @@
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24 24
25#include <asm/arch/board.h> 25#include <mach/board.h>
26#include <asm/arch/mux.h> 26#include <mach/mux.h>
27#include <asm/arch/gpio.h> 27#include <mach/gpio.h>
28#include <asm/arch/fpga.h> 28#include <mach/fpga.h>
29#ifdef CONFIG_PM 29#ifdef CONFIG_PM
30#include <asm/arch/pm.h> 30#include <mach/pm.h>
31#endif 31#endif
32 32
33static struct clk * uart1_ck; 33static struct clk * uart1_ck;
diff --git a/arch/arm/mach-omap1/sleep.S b/arch/arm/mach-omap1/sleep.S
index 68f5b39030b6..f3eac932092d 100644
--- a/arch/arm/mach-omap1/sleep.S
+++ b/arch/arm/mach-omap1/sleep.S
@@ -34,8 +34,8 @@
34 34
35#include <linux/linkage.h> 35#include <linux/linkage.h>
36#include <asm/assembler.h> 36#include <asm/assembler.h>
37#include <asm/arch/io.h> 37#include <mach/io.h>
38#include <asm/arch/pm.h> 38#include <mach/pm.h>
39 39
40 .text 40 .text
41 41
diff --git a/arch/arm/mach-omap1/sram.S b/arch/arm/mach-omap1/sram.S
index 126d252062d7..261cdc48228b 100644
--- a/arch/arm/mach-omap1/sram.S
+++ b/arch/arm/mach-omap1/sram.S
@@ -10,8 +10,8 @@
10 10
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <asm/assembler.h> 12#include <asm/assembler.h>
13#include <asm/arch/io.h> 13#include <mach/io.h>
14#include <asm/hardware.h> 14#include <mach/hardware.h>
15 15
16 .text 16 .text
17 17
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 5d2b270935a2..e54708595ecf 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -45,7 +45,7 @@
45#include <linux/clockchips.h> 45#include <linux/clockchips.h>
46 46
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/hardware.h> 48#include <mach/hardware.h>
49#include <asm/io.h> 49#include <asm/io.h>
50#include <asm/leds.h> 50#include <asm/leds.h>
51#include <asm/irq.h> 51#include <asm/irq.h>
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
index fbbdb806c95a..e67760189d14 100644
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -46,13 +46,13 @@
46#include <linux/clockchips.h> 46#include <linux/clockchips.h>
47 47
48#include <asm/system.h> 48#include <asm/system.h>
49#include <asm/hardware.h> 49#include <mach/hardware.h>
50#include <asm/io.h> 50#include <asm/io.h>
51#include <asm/leds.h> 51#include <asm/leds.h>
52#include <asm/irq.h> 52#include <asm/irq.h>
53#include <asm/mach/irq.h> 53#include <asm/mach/irq.h>
54#include <asm/mach/time.h> 54#include <asm/mach/time.h>
55#include <asm/arch/dmtimer.h> 55#include <mach/dmtimer.h>
56 56
57struct sys_timer omap_timer; 57struct sys_timer omap_timer;
58 58
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 1682eb77c46d..d4d6385cad7c 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -22,17 +22,17 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30 30
31#include <asm/arch/gpio.h> 31#include <mach/gpio.h>
32#include <asm/arch/mux.h> 32#include <mach/mux.h>
33#include <asm/arch/board.h> 33#include <mach/board.h>
34#include <asm/arch/common.h> 34#include <mach/common.h>
35#include <asm/arch/gpmc.h> 35#include <mach/gpmc.h>
36 36
37#include <asm/io.h> 37#include <asm/io.h>
38 38
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 870b34972d3b..989ad152d7f8 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -29,19 +29,19 @@
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/clk.h> 30#include <linux/clk.h>
31 31
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
35#include <asm/mach/flash.h> 35#include <asm/mach/flash.h>
36 36
37#include <asm/arch/gpio.h> 37#include <mach/gpio.h>
38#include <asm/arch/led.h> 38#include <mach/led.h>
39#include <asm/arch/mux.h> 39#include <mach/mux.h>
40#include <asm/arch/usb.h> 40#include <mach/usb.h>
41#include <asm/arch/board.h> 41#include <mach/board.h>
42#include <asm/arch/common.h> 42#include <mach/common.h>
43#include <asm/arch/gpmc.h> 43#include <mach/gpmc.h>
44#include <asm/arch/control.h> 44#include <mach/control.h>
45 45
46/* LED & Switch macros */ 46/* LED & Switch macros */
47#define LED0_GPIO13 13 47#define LED0_GPIO13 13
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index df8be081e159..9ba097868e72 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -20,16 +20,16 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/device.h> 21#include <linux/device.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <asm/arch/gpio.h> 28#include <mach/gpio.h>
29#include <asm/arch/mux.h> 29#include <mach/mux.h>
30#include <asm/arch/usb.h> 30#include <mach/usb.h>
31#include <asm/arch/board.h> 31#include <mach/board.h>
32#include <asm/arch/common.h> 32#include <mach/common.h>
33 33
34static void __init omap_generic_init_irq(void) 34static void __init omap_generic_init_irq(void)
35{ 35{
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 0d28f6897c8e..9e2624ca70a2 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -22,24 +22,24 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30 30
31#include <asm/arch/control.h> 31#include <mach/control.h>
32#include <asm/arch/gpio.h> 32#include <mach/gpio.h>
33#include <asm/arch/gpioexpander.h> 33#include <mach/gpioexpander.h>
34#include <asm/arch/mux.h> 34#include <mach/mux.h>
35#include <asm/arch/usb.h> 35#include <mach/usb.h>
36#include <asm/arch/irda.h> 36#include <mach/irda.h>
37#include <asm/arch/board.h> 37#include <mach/board.h>
38#include <asm/arch/common.h> 38#include <mach/common.h>
39#include <asm/arch/keypad.h> 39#include <mach/keypad.h>
40#include <asm/arch/menelaus.h> 40#include <mach/menelaus.h>
41#include <asm/arch/dma.h> 41#include <mach/dma.h>
42#include <asm/arch/gpmc.h> 42#include <mach/gpmc.h>
43 43
44#include <asm/io.h> 44#include <asm/io.h>
45 45
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 15675bce8012..1d891e4a6933 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -25,9 +25,9 @@
25 25
26#include <asm/io.h> 26#include <asm/io.h>
27 27
28#include <asm/arch/clock.h> 28#include <mach/clock.h>
29#include <asm/arch/sram.h> 29#include <mach/sram.h>
30#include <asm/arch/cpu.h> 30#include <mach/cpu.h>
31#include <asm/div64.h> 31#include <asm/div64.h>
32 32
33#include "memory.h" 33#include "memory.h"
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 3cd37cb57c5a..626e5fa93b6a 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -16,7 +16,7 @@
16#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H 16#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H
17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H 17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H
18 18
19#include <asm/arch/clock.h> 19#include <mach/clock.h>
20 20
21/* The maximum error between a target DPLL rate and the rounded rate in Hz */ 21/* The maximum error between a target DPLL rate and the rounded rate in Hz */
22#define DEFAULT_DPLL_RATE_TOLERANCE 50000 22#define DEFAULT_DPLL_RATE_TOLERANCE 50000
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index aa567876651d..295e671e9cfd 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -28,8 +28,8 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/cpufreq.h> 29#include <linux/cpufreq.h>
30 30
31#include <asm/arch/clock.h> 31#include <mach/clock.h>
32#include <asm/arch/sram.h> 32#include <mach/sram.h>
33#include <asm/div64.h> 33#include <asm/div64.h>
34#include <asm/bitops.h> 34#include <asm/bitops.h>
35 35
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 4263099b1ad3..3ff74952f835 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -26,8 +26,8 @@
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/limits.h> 27#include <linux/limits.h>
28 28
29#include <asm/arch/clock.h> 29#include <mach/clock.h>
30#include <asm/arch/sram.h> 30#include <mach/sram.h>
31#include <asm/div64.h> 31#include <asm/div64.h>
32#include <asm/bitops.h> 32#include <asm/bitops.h>
33 33
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index 05757eb032bc..ec664457a11a 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -19,7 +19,7 @@
19#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H 19#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H
20#define __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H 20#define __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H
21 21
22#include <asm/arch/control.h> 22#include <mach/control.h>
23 23
24#include "clock.h" 24#include "clock.h"
25#include "cm.h" 25#include "cm.h"
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 51f70300996f..5f3aad977842 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -15,8 +15,8 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include <asm/arch/common.h> 18#include <mach/common.h>
19#include <asm/arch/control.h> 19#include <mach/control.h>
20 20
21static void __iomem *omap2_ctrl_base; 21static void __iomem *omap2_ctrl_base;
22 22
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index b603bc5f8e5b..7a7f02559075 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -14,15 +14,15 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16
17#include <asm/hardware.h> 17#include <mach/hardware.h>
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20#include <asm/mach/map.h> 20#include <asm/mach/map.h>
21 21
22#include <asm/arch/tc.h> 22#include <mach/tc.h>
23#include <asm/arch/board.h> 23#include <mach/board.h>
24#include <asm/arch/mux.h> 24#include <mach/mux.h>
25#include <asm/arch/gpio.h> 25#include <mach/gpio.h>
26 26
27#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) 27#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
28 28
@@ -142,7 +142,7 @@ static inline void omap_init_sti(void) {}
142 142
143#if defined(CONFIG_SPI_OMAP24XX) 143#if defined(CONFIG_SPI_OMAP24XX)
144 144
145#include <asm/arch/mcspi.h> 145#include <mach/mcspi.h>
146 146
147#define OMAP2_MCSPI1_BASE 0x48098000 147#define OMAP2_MCSPI1_BASE 0x48098000
148#define OMAP2_MCSPI2_BASE 0x4809a000 148#define OMAP2_MCSPI2_BASE 0x4809a000
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index dbf68dc50ae2..f51d69bc457d 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -18,7 +18,7 @@
18 18
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include <asm/arch/gpmc.h> 21#include <mach/gpmc.h>
22 22
23#undef DEBUG 23#undef DEBUG
24 24
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index dff4b16cead6..a5d4526ac4d6 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -17,8 +17,8 @@
17 17
18#include <asm/io.h> 18#include <asm/io.h>
19 19
20#include <asm/arch/control.h> 20#include <mach/control.h>
21#include <asm/arch/cpu.h> 21#include <mach/cpu.h>
22 22
23#if defined(CONFIG_ARCH_OMAP2420) 23#if defined(CONFIG_ARCH_OMAP2420)
24#define TAP_BASE io_p2v(0x48014000) 24#define TAP_BASE io_p2v(0x48014000)
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 69c8174f3aac..987351f07d7b 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -21,8 +21,8 @@
21 21
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23 23
24#include <asm/arch/mux.h> 24#include <mach/mux.h>
25#include <asm/arch/omapfb.h> 25#include <mach/omapfb.h>
26 26
27extern void omap_sram_init(void); 27extern void omap_sram_init(void);
28extern int omap2_clk_init(void); 28extern int omap2_clk_init(void);
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index f064f725e724..9ef15b31d8fc 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -13,7 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/mach/irq.h> 17#include <asm/mach/irq.h>
18#include <asm/irq.h> 18#include <asm/irq.h>
19#include <asm/io.h> 19#include <asm/io.h>
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 4799561c5a9e..a480b96948e4 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -14,8 +14,8 @@
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <asm/arch/mailbox.h> 17#include <mach/mailbox.h>
18#include <asm/arch/irqs.h> 18#include <mach/irqs.h>
19#include <asm/io.h> 19#include <asm/io.h>
20 20
21#define MAILBOX_REVISION 0x00 21#define MAILBOX_REVISION 0x00
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 17cf199d1130..27eb6e3ca926 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -17,10 +17,10 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <asm/arch/dma.h> 20#include <mach/dma.h>
21#include <asm/arch/mux.h> 21#include <mach/mux.h>
22#include <asm/arch/cpu.h> 22#include <mach/cpu.h>
23#include <asm/arch/mcbsp.h> 23#include <mach/mcbsp.h>
24 24
25struct mcbsp_internal_clk { 25struct mcbsp_internal_clk {
26 struct clk clk; 26 struct clk clk;
diff --git a/arch/arm/mach-omap2/memory.c b/arch/arm/mach-omap2/memory.c
index 73cadb2c75cf..6b49cc9cbdcb 100644
--- a/arch/arm/mach-omap2/memory.c
+++ b/arch/arm/mach-omap2/memory.c
@@ -24,9 +24,9 @@
24 24
25#include <asm/io.h> 25#include <asm/io.h>
26 26
27#include <asm/arch/common.h> 27#include <mach/common.h>
28#include <asm/arch/clock.h> 28#include <mach/clock.h>
29#include <asm/arch/sram.h> 29#include <mach/sram.h>
30 30
31#include "prm.h" 31#include "prm.h"
32 32
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 8f98b20f30a1..443d07fef7f3 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -29,8 +29,8 @@
29#include <asm/io.h> 29#include <asm/io.h>
30#include <linux/spinlock.h> 30#include <linux/spinlock.h>
31 31
32#include <asm/arch/control.h> 32#include <mach/control.h>
33#include <asm/arch/mux.h> 33#include <mach/mux.h>
34 34
35#ifdef CONFIG_OMAP_MUX 35#ifdef CONFIG_OMAP_MUX
36 36
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index d6c9de82ca0c..8671e1079ab5 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -30,12 +30,11 @@
30#include <asm/atomic.h> 30#include <asm/atomic.h>
31#include <asm/mach/time.h> 31#include <asm/mach/time.h>
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33#include <asm/mach-types.h>
34 33
35#include <asm/arch/irqs.h> 34#include <mach/irqs.h>
36#include <asm/arch/clock.h> 35#include <mach/clock.h>
37#include <asm/arch/sram.h> 36#include <mach/sram.h>
38#include <asm/arch/pm.h> 37#include <mach/pm.h>
39 38
40static struct clk *vclk; 39static struct clk *vclk;
41static void (*omap2_sram_idle)(void); 40static void (*omap2_sram_idle)(void);
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index fd92a80f38f2..f945156d5585 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -18,8 +18,8 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include <asm/arch/common.h> 21#include <mach/common.h>
22#include <asm/arch/prcm.h> 22#include <mach/prcm.h>
23 23
24#include "clock.h" 24#include "clock.h"
25#include "prm.h" 25#include "prm.h"
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index 1b1fe4f6e030..1a8bbd094066 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -15,7 +15,7 @@
15 */ 15 */
16#undef DEBUG 16#undef DEBUG
17 17
18#include <asm/arch/sdrc.h> 18#include <mach/sdrc.h>
19 19
20#ifndef __ASSEMBLER__ 20#ifndef __ASSEMBLER__
21extern void __iomem *omap2_sdrc_base; 21extern void __iomem *omap2_sdrc_base;
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index e9c367fc9f61..adc8a26a8fb0 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -20,8 +20,8 @@
20 20
21#include <asm/io.h> 21#include <asm/io.h>
22 22
23#include <asm/arch/common.h> 23#include <mach/common.h>
24#include <asm/arch/board.h> 24#include <mach/board.h>
25 25
26static struct clk * uart1_ick = NULL; 26static struct clk * uart1_ick = NULL;
27static struct clk * uart1_fck = NULL; 27static struct clk * uart1_fck = NULL;
diff --git a/arch/arm/mach-omap2/sleep.S b/arch/arm/mach-omap2/sleep.S
index 46ccb9b8b583..87a706fd5f82 100644
--- a/arch/arm/mach-omap2/sleep.S
+++ b/arch/arm/mach-omap2/sleep.S
@@ -23,8 +23,8 @@
23 23
24#include <linux/linkage.h> 24#include <linux/linkage.h>
25#include <asm/assembler.h> 25#include <asm/assembler.h>
26#include <asm/arch/io.h> 26#include <mach/io.h>
27#include <asm/arch/pm.h> 27#include <mach/pm.h>
28 28
29#include "sdrc.h" 29#include "sdrc.h"
30 30
diff --git a/arch/arm/mach-omap2/sram242x.S b/arch/arm/mach-omap2/sram242x.S
index 4c274510f3e9..af4bd3490227 100644
--- a/arch/arm/mach-omap2/sram242x.S
+++ b/arch/arm/mach-omap2/sram242x.S
@@ -24,8 +24,8 @@
24 */ 24 */
25#include <linux/linkage.h> 25#include <linux/linkage.h>
26#include <asm/assembler.h> 26#include <asm/assembler.h>
27#include <asm/arch/io.h> 27#include <mach/io.h>
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29 29
30#include "prm.h" 30#include "prm.h"
31#include "cm.h" 31#include "cm.h"
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S
index a3fa48dc08cd..84363e269e8c 100644
--- a/arch/arm/mach-omap2/sram243x.S
+++ b/arch/arm/mach-omap2/sram243x.S
@@ -24,8 +24,8 @@
24 */ 24 */
25#include <linux/linkage.h> 25#include <linux/linkage.h>
26#include <asm/assembler.h> 26#include <asm/assembler.h>
27#include <asm/arch/io.h> 27#include <mach/io.h>
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29 29
30#include "prm.h" 30#include "prm.h"
31#include "cm.h" 31#include "cm.h"
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 557603f99313..589393bedade 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -34,7 +34,7 @@
34#include <linux/clockchips.h> 34#include <linux/clockchips.h>
35 35
36#include <asm/mach/time.h> 36#include <asm/mach/time.h>
37#include <asm/arch/dmtimer.h> 37#include <mach/dmtimer.h>
38 38
39static struct omap_dm_timer *gptimer; 39static struct omap_dm_timer *gptimer;
40static struct clock_event_device clockevent_gpt; 40static struct clock_event_device clockevent_gpt;
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 80bb42eb5082..1607c941d95f 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -15,9 +15,9 @@
15 15
16#include <linux/usb/musb.h> 16#include <linux/usb/musb.h>
17 17
18#include <asm/arch/gpmc.h> 18#include <mach/gpmc.h>
19#include <asm/arch/gpio.h> 19#include <mach/gpio.h>
20#include <asm/arch/mux.h> 20#include <mach/mux.h>
21 21
22 22
23static u8 async_cs, sync_cs; 23static u8 async_cs, sync_cs;
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
index 6f0dbda6c44c..bea37972120a 100644
--- a/arch/arm/mach-orion5x/addr-map.c
+++ b/arch/arm/mach-orion5x/addr-map.c
@@ -13,7 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/mbus.h> 15#include <linux/mbus.h>
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include "common.h" 18#include "common.h"
19 19
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index faf4e3211918..168eeacaa4c0 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -24,8 +24,8 @@
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach/time.h> 26#include <asm/mach/time.h>
27#include <asm/arch/hardware.h> 27#include <mach/hardware.h>
28#include <asm/arch/orion5x.h> 28#include <mach/orion5x.h>
29#include <asm/plat-orion/ehci-orion.h> 29#include <asm/plat-orion/ehci-orion.h>
30#include <asm/plat-orion/orion_nand.h> 30#include <asm/plat-orion/orion_nand.h>
31#include <asm/plat-orion/time.h> 31#include <asm/plat-orion/time.h>
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index 40a0bee4fbb3..48ce6d0e0020 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -24,7 +24,7 @@
24#include <asm/gpio.h> 24#include <asm/gpio.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
27#include <asm/arch/orion5x.h> 27#include <mach/orion5x.h>
28#include <asm/plat-orion/orion_nand.h> 28#include <asm/plat-orion/orion_nand.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h" 30#include "mpp.h"
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 3791ca6f001a..1a1d84b80a65 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -25,7 +25,7 @@
25#include <asm/gpio.h> 25#include <asm/gpio.h>
26#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
27#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
28#include <asm/arch/orion5x.h> 28#include <mach/orion5x.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h" 30#include "mpp.h"
31 31
diff --git a/arch/arm/mach-orion5x/gpio.c b/arch/arm/mach-orion5x/gpio.c
index d09797990f41..cd8a16f67d2b 100644
--- a/arch/arm/mach-orion5x/gpio.c
+++ b/arch/arm/mach-orion5x/gpio.c
@@ -17,7 +17,7 @@
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18#include <asm/gpio.h> 18#include <asm/gpio.h>
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/arch/orion5x.h> 20#include <mach/orion5x.h>
21#include "common.h" 21#include "common.h"
22 22
23static DEFINE_SPINLOCK(gpio_lock); 23static DEFINE_SPINLOCK(gpio_lock);
diff --git a/arch/arm/mach-orion5x/include/mach/debug-macro.S b/arch/arm/mach-orion5x/include/mach/debug-macro.S
new file mode 100644
index 000000000000..c7f808bfe272
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/debug-macro.S
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/debug-macro.S
3 *
4 * Debugging macro include header
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <mach/orion5x.h>
12
13 .macro addruart,rx
14 mrc p15, 0, \rx, c1, c0
15 tst \rx, #1 @ MMU enabled?
16 ldreq \rx, =ORION5X_REGS_PHYS_BASE
17 ldrne \rx, =ORION5X_REGS_VIRT_BASE
18 orr \rx, \rx, #0x00012000
19 .endm
20
21#define UART_SHIFT 2
22#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-orion5x/include/mach/dma.h b/arch/arm/mach-orion5x/include/mach/dma.h
new file mode 100644
index 000000000000..40a8c178f10d
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/dma.h
@@ -0,0 +1 @@
/* empty */
diff --git a/arch/arm/mach-orion5x/include/mach/entry-macro.S b/arch/arm/mach-orion5x/include/mach/entry-macro.S
new file mode 100644
index 000000000000..4351937035cd
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/entry-macro.S
@@ -0,0 +1,31 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Orion 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
11#include <mach/orion5x.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =MAIN_IRQ_CAUSE
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24 ldr \irqstat, [\base, #0] @ main cause
25 ldr \tmp, [\base, #(MAIN_IRQ_MASK - MAIN_IRQ_CAUSE)] @ main mask
26 mov \irqnr, #0 @ default irqnr
27 @ find cause bits that are unmasked
28 ands \irqstat, \irqstat, \tmp @ clear Z flag if any
29 clzne \irqnr, \irqstat @ calc irqnr
30 rsbne \irqnr, \irqnr, #31
31 .endm
diff --git a/arch/arm/mach-orion5x/include/mach/gpio.h b/arch/arm/mach-orion5x/include/mach/gpio.h
new file mode 100644
index 000000000000..65dc136a86f7
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/gpio.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/gpio.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9extern int gpio_request(unsigned pin, const char *label);
10extern void gpio_free(unsigned pin);
11extern int gpio_direction_input(unsigned pin);
12extern int gpio_direction_output(unsigned pin, int value);
13extern int gpio_get_value(unsigned pin);
14extern void gpio_set_value(unsigned pin, int value);
15extern void orion5x_gpio_set_blink(unsigned pin, int blink);
16extern void gpio_display(void); /* debug */
17
18static inline int gpio_to_irq(int pin)
19{
20 return pin + IRQ_ORION5X_GPIO_START;
21}
22
23static inline int irq_to_gpio(int irq)
24{
25 return irq - IRQ_ORION5X_GPIO_START;
26}
27
28#include <asm-generic/gpio.h> /* cansleep wrappers */
diff --git a/arch/arm/mach-orion5x/include/mach/hardware.h b/arch/arm/mach-orion5x/include/mach/hardware.h
new file mode 100644
index 000000000000..e51aaf4bf2b5
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/hardware.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/hardware.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H
11
12#include "orion5x.h"
13
14#define pcibios_assign_all_busses() 1
15
16#define PCIBIOS_MIN_IO 0x00001000
17#define PCIBIOS_MIN_MEM 0x01000000
18#define PCIMEM_BASE ORION5X_PCIE_MEM_PHYS_BASE
19
20
21#endif
diff --git a/arch/arm/mach-orion5x/include/mach/io.h b/arch/arm/mach-orion5x/include/mach/io.h
new file mode 100644
index 000000000000..f24b2513f7f3
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/io.h
@@ -0,0 +1,63 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/io.h
3 *
4 * Tzachi Perelstein <tzachi@marvell.com>
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 __ASM_ARCH_IO_H
12#define __ASM_ARCH_IO_H
13
14#include "orion5x.h"
15
16#define IO_SPACE_LIMIT 0xffffffff
17
18static inline void __iomem *
19__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype)
20{
21 void __iomem *retval;
22 unsigned long offs = paddr - ORION5X_REGS_PHYS_BASE;
23 if (mtype == MT_DEVICE && size && offs < ORION5X_REGS_SIZE &&
24 size <= ORION5X_REGS_SIZE && offs + size <= ORION5X_REGS_SIZE) {
25 retval = (void __iomem *)ORION5X_REGS_VIRT_BASE + offs;
26 } else {
27 retval = __arm_ioremap(paddr, size, mtype);
28 }
29
30 return retval;
31}
32
33static inline void
34__arch_iounmap(void __iomem *addr)
35{
36 if (addr < (void __iomem *)ORION5X_REGS_VIRT_BASE ||
37 addr >= (void __iomem *)(ORION5X_REGS_VIRT_BASE + ORION5X_REGS_SIZE))
38 __iounmap(addr);
39}
40
41static inline void __iomem *__io(unsigned long addr)
42{
43 return (void __iomem *)addr;
44}
45
46#define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m)
47#define __arch_iounmap(a) __arch_iounmap(a)
48#define __io(a) __io(a)
49#define __mem_pci(a) (a)
50
51
52/*****************************************************************************
53 * Helpers to access Orion registers
54 ****************************************************************************/
55/*
56 * These are not preempt-safe. Locks, if needed, must be taken
57 * care of by the caller.
58 */
59#define orion5x_setbits(r, mask) writel(readl(r) | (mask), (r))
60#define orion5x_clrbits(r, mask) writel(readl(r) & ~(mask), (r))
61
62
63#endif
diff --git a/arch/arm/mach-orion5x/include/mach/irqs.h b/arch/arm/mach-orion5x/include/mach/irqs.h
new file mode 100644
index 000000000000..d5b0fbf6b965
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/irqs.h
@@ -0,0 +1,62 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/irqs.h
3 *
4 * IRQ definitions for Orion SoC
5 *
6 * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef __ASM_ARCH_IRQS_H
14#define __ASM_ARCH_IRQS_H
15
16#include "orion5x.h" /* need GPIO_MAX */
17
18/*
19 * Orion Main Interrupt Controller
20 */
21#define IRQ_ORION5X_BRIDGE 0
22#define IRQ_ORION5X_DOORBELL_H2C 1
23#define IRQ_ORION5X_DOORBELL_C2H 2
24#define IRQ_ORION5X_UART0 3
25#define IRQ_ORION5X_UART1 4
26#define IRQ_ORION5X_I2C 5
27#define IRQ_ORION5X_GPIO_0_7 6
28#define IRQ_ORION5X_GPIO_8_15 7
29#define IRQ_ORION5X_GPIO_16_23 8
30#define IRQ_ORION5X_GPIO_24_31 9
31#define IRQ_ORION5X_PCIE0_ERR 10
32#define IRQ_ORION5X_PCIE0_INT 11
33#define IRQ_ORION5X_USB1_CTRL 12
34#define IRQ_ORION5X_DEV_BUS_ERR 14
35#define IRQ_ORION5X_PCI_ERR 15
36#define IRQ_ORION5X_USB_BR_ERR 16
37#define IRQ_ORION5X_USB0_CTRL 17
38#define IRQ_ORION5X_ETH_RX 18
39#define IRQ_ORION5X_ETH_TX 19
40#define IRQ_ORION5X_ETH_MISC 20
41#define IRQ_ORION5X_ETH_SUM 21
42#define IRQ_ORION5X_ETH_ERR 22
43#define IRQ_ORION5X_IDMA_ERR 23
44#define IRQ_ORION5X_IDMA_0 24
45#define IRQ_ORION5X_IDMA_1 25
46#define IRQ_ORION5X_IDMA_2 26
47#define IRQ_ORION5X_IDMA_3 27
48#define IRQ_ORION5X_CESA 28
49#define IRQ_ORION5X_SATA 29
50#define IRQ_ORION5X_XOR0 30
51#define IRQ_ORION5X_XOR1 31
52
53/*
54 * Orion General Purpose Pins
55 */
56#define IRQ_ORION5X_GPIO_START 32
57#define NR_GPIO_IRQS GPIO_MAX
58
59#define NR_IRQS (IRQ_ORION5X_GPIO_START + NR_GPIO_IRQS)
60
61
62#endif
diff --git a/arch/arm/mach-orion5x/include/mach/memory.h b/arch/arm/mach-orion5x/include/mach/memory.h
new file mode 100644
index 000000000000..54dd76b013f2
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/memory.h
@@ -0,0 +1,16 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/memory.h
3 *
4 * Marvell Orion memory definitions
5 */
6
7#ifndef __ASM_ARCH_MEMORY_H
8#define __ASM_ARCH_MEMORY_H
9
10#define PHYS_OFFSET UL(0x00000000)
11
12#define __virt_to_bus(x) __virt_to_phys(x)
13#define __bus_to_virt(x) __phys_to_virt(x)
14
15
16#endif
diff --git a/arch/arm/mach-orion5x/include/mach/orion5x.h b/arch/arm/mach-orion5x/include/mach/orion5x.h
new file mode 100644
index 000000000000..f52a7d65bec2
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/orion5x.h
@@ -0,0 +1,162 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/orion5x.h
3 *
4 * Generic definitions of Orion SoC flavors:
5 * Orion-1, Orion-VoIP, Orion-NAS, and Orion-2.
6 *
7 * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __ASM_ARCH_ORION5X_H
15#define __ASM_ARCH_ORION5X_H
16
17/*****************************************************************************
18 * Orion Address Maps
19 *
20 * phys
21 * e0000000 PCIe MEM space
22 * e8000000 PCI MEM space
23 * f0000000 PCIe WA space (Orion-1/Orion-NAS only)
24 * f1000000 on-chip peripheral registers
25 * f2000000 PCIe I/O space
26 * f2100000 PCI I/O space
27 * f4000000 device bus mappings (boot)
28 * fa000000 device bus mappings (cs0)
29 * fa800000 device bus mappings (cs2)
30 * fc000000 device bus mappings (cs0/cs1)
31 *
32 * virt phys size
33 * fdd00000 f1000000 1M on-chip peripheral registers
34 * fde00000 f2000000 1M PCIe I/O space
35 * fdf00000 f2100000 1M PCI I/O space
36 * fe000000 f0000000 16M PCIe WA space (Orion-1/Orion-NAS only)
37 ****************************************************************************/
38#define ORION5X_REGS_PHYS_BASE 0xf1000000
39#define ORION5X_REGS_VIRT_BASE 0xfdd00000
40#define ORION5X_REGS_SIZE SZ_1M
41
42#define ORION5X_PCIE_IO_PHYS_BASE 0xf2000000
43#define ORION5X_PCIE_IO_VIRT_BASE 0xfde00000
44#define ORION5X_PCIE_IO_BUS_BASE 0x00000000
45#define ORION5X_PCIE_IO_SIZE SZ_1M
46
47#define ORION5X_PCI_IO_PHYS_BASE 0xf2100000
48#define ORION5X_PCI_IO_VIRT_BASE 0xfdf00000
49#define ORION5X_PCI_IO_BUS_BASE 0x00100000
50#define ORION5X_PCI_IO_SIZE SZ_1M
51
52/* Relevant only for Orion-1/Orion-NAS */
53#define ORION5X_PCIE_WA_PHYS_BASE 0xf0000000
54#define ORION5X_PCIE_WA_VIRT_BASE 0xfe000000
55#define ORION5X_PCIE_WA_SIZE SZ_16M
56
57#define ORION5X_PCIE_MEM_PHYS_BASE 0xe0000000
58#define ORION5X_PCIE_MEM_SIZE SZ_128M
59
60#define ORION5X_PCI_MEM_PHYS_BASE 0xe8000000
61#define ORION5X_PCI_MEM_SIZE SZ_128M
62
63/*******************************************************************************
64 * Supported Devices & Revisions
65 ******************************************************************************/
66/* Orion-1 (88F5181) and Orion-VoIP (88F5181L) */
67#define MV88F5181_DEV_ID 0x5181
68#define MV88F5181_REV_B1 3
69#define MV88F5181L_REV_A0 8
70#define MV88F5181L_REV_A1 9
71/* Orion-NAS (88F5182) */
72#define MV88F5182_DEV_ID 0x5182
73#define MV88F5182_REV_A2 2
74/* Orion-2 (88F5281) */
75#define MV88F5281_DEV_ID 0x5281
76#define MV88F5281_REV_D1 5
77#define MV88F5281_REV_D2 6
78
79/*******************************************************************************
80 * Orion Registers Map
81 ******************************************************************************/
82#define ORION5X_DDR_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x00000)
83#define ORION5X_DDR_REG(x) (ORION5X_DDR_VIRT_BASE | (x))
84
85#define ORION5X_DEV_BUS_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x10000)
86#define ORION5X_DEV_BUS_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x10000)
87#define ORION5X_DEV_BUS_REG(x) (ORION5X_DEV_BUS_VIRT_BASE | (x))
88#define I2C_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE | 0x1000)
89#define UART0_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE | 0x2000)
90#define UART0_VIRT_BASE (ORION5X_DEV_BUS_VIRT_BASE | 0x2000)
91#define UART1_PHYS_BASE (ORION5X_DEV_BUS_PHYS_BASE | 0x2100)
92#define UART1_VIRT_BASE (ORION5X_DEV_BUS_VIRT_BASE | 0x2100)
93
94#define ORION5X_BRIDGE_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x20000)
95#define ORION5X_BRIDGE_REG(x) (ORION5X_BRIDGE_VIRT_BASE | (x))
96#define TIMER_VIRT_BASE (ORION5X_BRIDGE_VIRT_BASE | 0x300)
97
98#define ORION5X_PCI_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x30000)
99#define ORION5X_PCI_REG(x) (ORION5X_PCI_VIRT_BASE | (x))
100
101#define ORION5X_PCIE_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x40000)
102#define ORION5X_PCIE_REG(x) (ORION5X_PCIE_VIRT_BASE | (x))
103
104#define ORION5X_USB0_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x50000)
105#define ORION5X_USB0_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x50000)
106#define ORION5X_USB0_REG(x) (ORION5X_USB0_VIRT_BASE | (x))
107
108#define ORION5X_ETH_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x70000)
109#define ORION5X_ETH_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x70000)
110#define ORION5X_ETH_REG(x) (ORION5X_ETH_VIRT_BASE | (x))
111
112#define ORION5X_SATA_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x80000)
113#define ORION5X_SATA_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x80000)
114#define ORION5X_SATA_REG(x) (ORION5X_SATA_VIRT_BASE | (x))
115
116#define ORION5X_USB1_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0xa0000)
117#define ORION5X_USB1_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0xa0000)
118#define ORION5X_USB1_REG(x) (ORION5X_USB1_VIRT_BASE | (x))
119
120/*******************************************************************************
121 * Device Bus Registers
122 ******************************************************************************/
123#define MPP_0_7_CTRL ORION5X_DEV_BUS_REG(0x000)
124#define MPP_8_15_CTRL ORION5X_DEV_BUS_REG(0x004)
125#define MPP_16_19_CTRL ORION5X_DEV_BUS_REG(0x050)
126#define MPP_DEV_CTRL ORION5X_DEV_BUS_REG(0x008)
127#define MPP_RESET_SAMPLE ORION5X_DEV_BUS_REG(0x010)
128#define GPIO_OUT ORION5X_DEV_BUS_REG(0x100)
129#define GPIO_IO_CONF ORION5X_DEV_BUS_REG(0x104)
130#define GPIO_BLINK_EN ORION5X_DEV_BUS_REG(0x108)
131#define GPIO_IN_POL ORION5X_DEV_BUS_REG(0x10c)
132#define GPIO_DATA_IN ORION5X_DEV_BUS_REG(0x110)
133#define GPIO_EDGE_CAUSE ORION5X_DEV_BUS_REG(0x114)
134#define GPIO_EDGE_MASK ORION5X_DEV_BUS_REG(0x118)
135#define GPIO_LEVEL_MASK ORION5X_DEV_BUS_REG(0x11c)
136#define DEV_BANK_0_PARAM ORION5X_DEV_BUS_REG(0x45c)
137#define DEV_BANK_1_PARAM ORION5X_DEV_BUS_REG(0x460)
138#define DEV_BANK_2_PARAM ORION5X_DEV_BUS_REG(0x464)
139#define DEV_BANK_BOOT_PARAM ORION5X_DEV_BUS_REG(0x46c)
140#define DEV_BUS_CTRL ORION5X_DEV_BUS_REG(0x4c0)
141#define DEV_BUS_INT_CAUSE ORION5X_DEV_BUS_REG(0x4d0)
142#define DEV_BUS_INT_MASK ORION5X_DEV_BUS_REG(0x4d4)
143#define GPIO_MAX 32
144
145/***************************************************************************
146 * Orion CPU Bridge Registers
147 **************************************************************************/
148#define CPU_CONF ORION5X_BRIDGE_REG(0x100)
149#define CPU_CTRL ORION5X_BRIDGE_REG(0x104)
150#define CPU_RESET_MASK ORION5X_BRIDGE_REG(0x108)
151#define CPU_SOFT_RESET ORION5X_BRIDGE_REG(0x10c)
152#define POWER_MNG_CTRL_REG ORION5X_BRIDGE_REG(0x11C)
153#define BRIDGE_CAUSE ORION5X_BRIDGE_REG(0x110)
154#define BRIDGE_MASK ORION5X_BRIDGE_REG(0x114)
155#define BRIDGE_INT_TIMER0 0x0002
156#define BRIDGE_INT_TIMER1 0x0004
157#define BRIDGE_INT_TIMER1_CLR (~0x0004)
158#define MAIN_IRQ_CAUSE ORION5X_BRIDGE_REG(0x200)
159#define MAIN_IRQ_MASK ORION5X_BRIDGE_REG(0x204)
160
161
162#endif
diff --git a/arch/arm/mach-orion5x/include/mach/system.h b/arch/arm/mach-orion5x/include/mach/system.h
new file mode 100644
index 000000000000..08e430757890
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/system.h
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/system.h
3 *
4 * Tzachi Perelstein <tzachi@marvell.com>
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 __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H
13
14#include <mach/hardware.h>
15#include <mach/orion5x.h>
16
17static inline void arch_idle(void)
18{
19 cpu_do_idle();
20}
21
22static inline void arch_reset(char mode)
23{
24 /*
25 * Enable and issue soft reset
26 */
27 orion5x_setbits(CPU_RESET_MASK, (1 << 2));
28 orion5x_setbits(CPU_SOFT_RESET, 1);
29}
30
31
32#endif
diff --git a/arch/arm/mach-orion5x/include/mach/timex.h b/arch/arm/mach-orion5x/include/mach/timex.h
new file mode 100644
index 000000000000..e82e44db7629
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/timex.h
@@ -0,0 +1,13 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/timex.h
3 *
4 * Tzachi Perelstein <tzachi@marvell.com>
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#define CLOCK_TICK_RATE (100 * HZ)
12
13#define ORION5X_TCLK 166666667
diff --git a/arch/arm/mach-orion5x/include/mach/uncompress.h b/arch/arm/mach-orion5x/include/mach/uncompress.h
new file mode 100644
index 000000000000..4322dba468a4
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/uncompress.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/uncompress.h
3 *
4 * Tzachi Perelstein <tzachi@marvell.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/serial_reg.h>
12#include <mach/orion5x.h>
13
14#define SERIAL_BASE ((unsigned char *)UART0_PHYS_BASE)
15
16static void putc(const char c)
17{
18 unsigned char *base = SERIAL_BASE;
19 int i;
20
21 for (i = 0; i < 0x1000; i++) {
22 if (base[UART_LSR << 2] & UART_LSR_THRE)
23 break;
24 barrier();
25 }
26
27 base[UART_TX << 2] = c;
28}
29
30static void flush(void)
31{
32 unsigned char *base = SERIAL_BASE;
33 unsigned char mask;
34 int i;
35
36 mask = UART_LSR_TEMT | UART_LSR_THRE;
37
38 for (i = 0; i < 0x1000; i++) {
39 if ((base[UART_LSR << 2] & mask) == mask)
40 break;
41 barrier();
42 }
43}
44
45/*
46 * nothing to do
47 */
48#define arch_decomp_setup()
49#define arch_decomp_wdog()
diff --git a/arch/arm/mach-orion5x/include/mach/vmalloc.h b/arch/arm/mach-orion5x/include/mach/vmalloc.h
new file mode 100644
index 000000000000..7147a297e97f
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfd800000
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index 9ae3f6dc7839..cc2a017fd2a9 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -15,7 +15,7 @@
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <asm/gpio.h> 16#include <asm/gpio.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/arch/orion5x.h> 18#include <mach/orion5x.h>
19#include <asm/plat-orion/irq.h> 19#include <asm/plat-orion/irq.h>
20#include "common.h" 20#include "common.h"
21 21
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index 84feac4a1fe2..0caaaac74bc1 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -24,7 +24,7 @@
24#include <asm/gpio.h> 24#include <asm/gpio.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
27#include <asm/arch/orion5x.h> 27#include <mach/orion5x.h>
28#include <asm/plat-orion/orion_nand.h> 28#include <asm/plat-orion/orion_nand.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h" 30#include "mpp.h"
diff --git a/arch/arm/mach-orion5x/mpp.c b/arch/arm/mach-orion5x/mpp.c
index a48cadb01590..c04ab0e16ea1 100644
--- a/arch/arm/mach-orion5x/mpp.c
+++ b/arch/arm/mach-orion5x/mpp.c
@@ -11,7 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <asm/hardware.h> 14#include <mach/hardware.h>
15#include <asm/io.h> 15#include <asm/io.h>
16#include "common.h" 16#include "common.h"
17#include "mpp.h" 17#include "mpp.h"
diff --git a/arch/arm/mach-orion5x/mss2-setup.c b/arch/arm/mach-orion5x/mss2-setup.c
index 7ce9e407d9d1..4403cc963d66 100644
--- a/arch/arm/mach-orion5x/mss2-setup.c
+++ b/arch/arm/mach-orion5x/mss2-setup.c
@@ -25,7 +25,7 @@
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
27#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
28#include <asm/arch/orion5x.h> 28#include <mach/orion5x.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h" 30#include "mpp.h"
31 31
diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c
index 55f3b0fdef8b..67b2c0df615f 100644
--- a/arch/arm/mach-orion5x/mv2120-setup.c
+++ b/arch/arm/mach-orion5x/mv2120-setup.c
@@ -22,7 +22,7 @@
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/gpio.h> 23#include <asm/gpio.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/arch/orion5x.h> 25#include <mach/orion5x.h>
26#include "common.h" 26#include "common.h"
27#include "mpp.h" 27#include "mpp.h"
28 28
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
index 73e9242da7ad..e72fe1e065e8 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -21,7 +21,7 @@
21#include <asm/leds.h> 21#include <asm/leds.h>
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h> 23#include <asm/mach/pci.h>
24#include <asm/arch/orion5x.h> 24#include <mach/orion5x.h>
25#include "common.h" 25#include "common.h"
26#include "mpp.h" 26#include "mpp.h"
27 27
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
index ac482019abbf..a1fe3257320d 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -22,7 +22,7 @@
22#include <asm/leds.h> 22#include <asm/leds.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
25#include <asm/arch/orion5x.h> 25#include <mach/orion5x.h>
26#include "common.h" 26#include "common.h"
27#include "mpp.h" 27#include "mpp.h"
28 28
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 2a46d27209c1..8771cb76f0dc 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -24,7 +24,7 @@
24#include <asm/leds.h> 24#include <asm/leds.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
27#include <asm/arch/orion5x.h> 27#include <mach/orion5x.h>
28#include "common.h" 28#include "common.h"
29#include "mpp.h" 29#include "mpp.h"
30 30
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index f270ada2def9..809132de31d2 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -26,7 +26,7 @@
26#include <asm/gpio.h> 26#include <asm/gpio.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/pci.h> 28#include <asm/mach/pci.h>
29#include <asm/arch/orion5x.h> 29#include <mach/orion5x.h>
30#include "common.h" 30#include "common.h"
31#include "mpp.h" 31#include "mpp.h"
32#include "tsx09-common.h" 32#include "tsx09-common.h"
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
index 32f0ff073b7e..6053e76ac967 100644
--- a/arch/arm/mach-orion5x/ts409-setup.c
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -24,7 +24,7 @@
24#include <asm/gpio.h> 24#include <asm/gpio.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
27#include <asm/arch/orion5x.h> 27#include <mach/orion5x.h>
28#include "common.h" 28#include "common.h"
29#include "mpp.h" 29#include "mpp.h"
30#include "tsx09-common.h" 30#include "tsx09-common.h"
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
index 77e9f351f07a..014916a28fdc 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -18,7 +18,7 @@
18#include <asm/mach-types.h> 18#include <asm/mach-types.h>
19#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
20#include <asm/mach/map.h> 20#include <asm/mach/map.h>
21#include <asm/arch/orion5x.h> 21#include <mach/orion5x.h>
22#include "common.h" 22#include "common.h"
23#include "mpp.h" 23#include "mpp.h"
24 24
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c
index 25568c2a3d29..b6bc43e07eed 100644
--- a/arch/arm/mach-orion5x/wnr854t-setup.c
+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
@@ -19,7 +19,7 @@
19#include <asm/gpio.h> 19#include <asm/gpio.h>
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach/pci.h> 21#include <asm/mach/pci.h>
22#include <asm/arch/orion5x.h> 22#include <mach/orion5x.h>
23#include "common.h" 23#include "common.h"
24#include "mpp.h" 24#include "mpp.h"
25 25
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index 9b8ee8c48bf0..b10da17b3fbd 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -19,7 +19,7 @@
19#include <asm/gpio.h> 19#include <asm/gpio.h>
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach/pci.h> 21#include <asm/mach/pci.h>
22#include <asm/arch/orion5x.h> 22#include <mach/orion5x.h>
23#include "common.h" 23#include "common.h"
24#include "mpp.h" 24#include "mpp.h"
25 25
diff --git a/arch/arm/mach-pnx4008/clock.c b/arch/arm/mach-pnx4008/clock.c
index a5268c3ac5a7..24d036a24a72 100644
--- a/arch/arm/mach-pnx4008/clock.c
+++ b/arch/arm/mach-pnx4008/clock.c
@@ -21,10 +21,10 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23 23
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/io.h> 25#include <asm/io.h>
26 26
27#include <asm/arch/clock.h> 27#include <mach/clock.h>
28#include "clock.h" 28#include "clock.h"
29 29
30/*forward declaration*/ 30/*forward declaration*/
diff --git a/arch/arm/mach-pnx4008/core.c b/arch/arm/mach-pnx4008/core.c
index 429c796938be..3ba46ede9bbd 100644
--- a/arch/arm/mach-pnx4008/core.c
+++ b/arch/arm/mach-pnx4008/core.c
@@ -26,7 +26,7 @@
26#include <linux/device.h> 26#include <linux/device.h>
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -38,9 +38,9 @@
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
39#include <asm/mach/time.h> 39#include <asm/mach/time.h>
40 40
41#include <asm/arch/irq.h> 41#include <mach/irq.h>
42#include <asm/arch/clock.h> 42#include <mach/clock.h>
43#include <asm/arch/dma.h> 43#include <mach/dma.h>
44 44
45struct resource spipnx_0_resources[] = { 45struct resource spipnx_0_resources[] = {
46 { 46 {
diff --git a/arch/arm/mach-pnx4008/dma.c b/arch/arm/mach-pnx4008/dma.c
index fe152e82590b..833c56be7344 100644
--- a/arch/arm/mach-pnx4008/dma.c
+++ b/arch/arm/mach-pnx4008/dma.c
@@ -23,12 +23,12 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24 24
25#include <asm/system.h> 25#include <asm/system.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/dma.h> 27#include <asm/dma.h>
28#include <asm/dma-mapping.h> 28#include <asm/dma-mapping.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/mach/dma.h> 30#include <asm/mach/dma.h>
31#include <asm/arch/clock.h> 31#include <mach/clock.h>
32 32
33static struct dma_channel { 33static struct dma_channel {
34 char *name; 34 char *name;
diff --git a/arch/arm/mach-pnx4008/gpio.c b/arch/arm/mach-pnx4008/gpio.c
index ef179cab80e2..fb51f7279e95 100644
--- a/arch/arm/mach-pnx4008/gpio.c
+++ b/arch/arm/mach-pnx4008/gpio.c
@@ -18,8 +18,8 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/arch/platform.h> 21#include <mach/platform.h>
22#include <asm/arch/gpio.h> 22#include <mach/gpio.h>
23 23
24/* register definitions */ 24/* register definitions */
25#define PIO_VA_BASE IO_ADDRESS(PNX4008_PIO_BASE) 25#define PIO_VA_BASE IO_ADDRESS(PNX4008_PIO_BASE)
diff --git a/arch/arm/mach-pnx4008/i2c.c b/arch/arm/mach-pnx4008/i2c.c
index 6f308827c4fe..87c093286ff9 100644
--- a/arch/arm/mach-pnx4008/i2c.c
+++ b/arch/arm/mach-pnx4008/i2c.c
@@ -14,8 +14,8 @@
14#include <linux/i2c-pnx.h> 14#include <linux/i2c-pnx.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <asm/arch/platform.h> 17#include <mach/platform.h>
18#include <asm/arch/i2c.h> 18#include <mach/i2c.h>
19 19
20static int set_clock_run(struct platform_device *pdev) 20static int set_clock_run(struct platform_device *pdev)
21{ 21{
diff --git a/arch/arm/mach-pnx4008/include/mach/clock.h b/arch/arm/mach-pnx4008/include/mach/clock.h
new file mode 100644
index 000000000000..8d2a5ef52c90
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/clock.h
@@ -0,0 +1,62 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/clock.h
3 *
4 * Clock control driver for PNX4008 - header file
5 *
6 * Authors: Vitaly Wool, Dmitry Chigirev <source@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13#ifndef __PNX4008_CLOCK_H__
14#define __PNX4008_CLOCK_H__
15
16struct module;
17struct clk;
18
19#define PWRMAN_VA_BASE IO_ADDRESS(PNX4008_PWRMAN_BASE)
20#define HCLKDIVCTRL_REG (PWRMAN_VA_BASE + 0x40)
21#define PWRCTRL_REG (PWRMAN_VA_BASE + 0x44)
22#define PLLCTRL_REG (PWRMAN_VA_BASE + 0x48)
23#define OSC13CTRL_REG (PWRMAN_VA_BASE + 0x4c)
24#define SYSCLKCTRL_REG (PWRMAN_VA_BASE + 0x50)
25#define HCLKPLLCTRL_REG (PWRMAN_VA_BASE + 0x58)
26#define USBCTRL_REG (PWRMAN_VA_BASE + 0x64)
27#define SDRAMCLKCTRL_REG (PWRMAN_VA_BASE + 0x68)
28#define MSCTRL_REG (PWRMAN_VA_BASE + 0x80)
29#define BTCLKCTRL (PWRMAN_VA_BASE + 0x84)
30#define DUMCLKCTRL_REG (PWRMAN_VA_BASE + 0x90)
31#define I2CCLKCTRL_REG (PWRMAN_VA_BASE + 0xac)
32#define KEYCLKCTRL_REG (PWRMAN_VA_BASE + 0xb0)
33#define TSCLKCTRL_REG (PWRMAN_VA_BASE + 0xb4)
34#define PWMCLKCTRL_REG (PWRMAN_VA_BASE + 0xb8)
35#define TIMCLKCTRL_REG (PWRMAN_VA_BASE + 0xbc)
36#define SPICTRL_REG (PWRMAN_VA_BASE + 0xc4)
37#define FLASHCLKCTRL_REG (PWRMAN_VA_BASE + 0xc8)
38#define UART3CLK_REG (PWRMAN_VA_BASE + 0xd0)
39#define UARTCLKCTRL_REG (PWRMAN_VA_BASE + 0xe4)
40#define DMACLKCTRL_REG (PWRMAN_VA_BASE + 0xe8)
41#define AUTOCLK_CTRL (PWRMAN_VA_BASE + 0xec)
42#define JPEGCLKCTRL_REG (PWRMAN_VA_BASE + 0xfc)
43
44#define AUDIOCONFIG_VA_BASE IO_ADDRESS(PNX4008_AUDIOCONFIG_BASE)
45#define DSPPLLCTRL_REG (AUDIOCONFIG_VA_BASE + 0x60)
46#define DSPCLKCTRL_REG (AUDIOCONFIG_VA_BASE + 0x64)
47#define AUDIOCLKCTRL_REG (AUDIOCONFIG_VA_BASE + 0x68)
48#define AUDIOPLLCTRL_REG (AUDIOCONFIG_VA_BASE + 0x6C)
49
50#define USB_OTG_CLKCTRL_REG IO_ADDRESS(PNX4008_USB_CONFIG_BASE + 0xff4)
51
52#define VFP9CLKCTRL_REG IO_ADDRESS(PNX4008_DEBUG_BASE)
53
54#define CLK_RATE_13MHZ 13000
55#define CLK_RATE_1MHZ 1000
56#define CLK_RATE_208MHZ 208000
57#define CLK_RATE_48MHZ 48000
58#define CLK_RATE_32KHZ 32
59
60#define PNX4008_UART_CLK CLK_RATE_13MHZ * 1000 /* in MHz */
61
62#endif
diff --git a/arch/arm/mach-pnx4008/include/mach/debug-macro.S b/arch/arm/mach-pnx4008/include/mach/debug-macro.S
new file mode 100644
index 000000000000..6d1407f319f8
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/debug-macro.S
@@ -0,0 +1,23 @@
1/* arch/arm/mach-pnx4008/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 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17 mov \rx, #0x00090000
18 addeq \rx, \rx, #0x40000000
19 addne \rx, \rx, #0xf4000000
20 .endm
21
22#define UART_SHIFT 2
23#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-pnx4008/include/mach/dma.h b/arch/arm/mach-pnx4008/include/mach/dma.h
new file mode 100644
index 000000000000..5442d04fc575
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/dma.h
@@ -0,0 +1,162 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/dma.h
3 *
4 * PNX4008 DMA header file
5 *
6 * Author: Vitaly Wool
7 * Copyright: MontaVista Software Inc. (c) 2005
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_DMA_H
15#define __ASM_ARCH_DMA_H
16
17#include "platform.h"
18
19#define MAX_DMA_ADDRESS 0xffffffff
20
21#define MAX_DMA_CHANNELS 8
22
23#define DMAC_BASE IO_ADDRESS(PNX4008_DMA_CONFIG_BASE)
24#define DMAC_INT_STAT (DMAC_BASE + 0x0000)
25#define DMAC_INT_TC_STAT (DMAC_BASE + 0x0004)
26#define DMAC_INT_TC_CLEAR (DMAC_BASE + 0x0008)
27#define DMAC_INT_ERR_STAT (DMAC_BASE + 0x000c)
28#define DMAC_INT_ERR_CLEAR (DMAC_BASE + 0x0010)
29#define DMAC_SOFT_SREQ (DMAC_BASE + 0x0024)
30#define DMAC_CONFIG (DMAC_BASE + 0x0030)
31#define DMAC_Cx_SRC_ADDR(c) (DMAC_BASE + 0x0100 + (c) * 0x20)
32#define DMAC_Cx_DEST_ADDR(c) (DMAC_BASE + 0x0104 + (c) * 0x20)
33#define DMAC_Cx_LLI(c) (DMAC_BASE + 0x0108 + (c) * 0x20)
34#define DMAC_Cx_CONTROL(c) (DMAC_BASE + 0x010c + (c) * 0x20)
35#define DMAC_Cx_CONFIG(c) (DMAC_BASE + 0x0110 + (c) * 0x20)
36
37enum {
38 WIDTH_BYTE = 0,
39 WIDTH_HWORD,
40 WIDTH_WORD
41};
42
43enum {
44 FC_MEM2MEM_DMA,
45 FC_MEM2PER_DMA,
46 FC_PER2MEM_DMA,
47 FC_PER2PER_DMA,
48 FC_PER2PER_DPER,
49 FC_MEM2PER_PER,
50 FC_PER2MEM_PER,
51 FC_PER2PER_SPER
52};
53
54enum {
55 DMA_INT_UNKNOWN = 0,
56 DMA_ERR_INT = 1,
57 DMA_TC_INT = 2,
58};
59
60enum {
61 DMA_BUFFER_ALLOCATED = 1,
62 DMA_HAS_LL = 2,
63};
64
65enum {
66 PER_CAM_DMA_1 = 0,
67 PER_NDF_FLASH = 1,
68 PER_MBX_SLAVE_FIFO = 2,
69 PER_SPI2_REC_XMIT = 3,
70 PER_MS_SD_RX_XMIT = 4,
71 PER_HS_UART_1_XMIT = 5,
72 PER_HS_UART_1_RX = 6,
73 PER_HS_UART_2_XMIT = 7,
74 PER_HS_UART_2_RX = 8,
75 PER_HS_UART_7_XMIT = 9,
76 PER_HS_UART_7_RX = 10,
77 PER_SPI1_REC_XMIT = 11,
78 PER_MLC_NDF_SREC = 12,
79 PER_CAM_DMA_2 = 13,
80 PER_PRNG_INFIFO = 14,
81 PER_PRNG_OUTFIFO = 15,
82};
83
84struct pnx4008_dma_ch_ctrl {
85 int tc_mask;
86 int cacheable;
87 int bufferable;
88 int priv_mode;
89 int di;
90 int si;
91 int dest_ahb1;
92 int src_ahb1;
93 int dwidth;
94 int swidth;
95 int dbsize;
96 int sbsize;
97 int tr_size;
98};
99
100struct pnx4008_dma_ch_config {
101 int halt;
102 int active;
103 int lock;
104 int itc;
105 int ie;
106 int flow_cntrl;
107 int dest_per;
108 int src_per;
109};
110
111struct pnx4008_dma_ll {
112 unsigned long src_addr;
113 unsigned long dest_addr;
114 u32 next_dma;
115 unsigned long ch_ctrl;
116 struct pnx4008_dma_ll *next;
117 int flags;
118 void *alloc_data;
119 int (*free) (void *);
120};
121
122struct pnx4008_dma_config {
123 int is_ll;
124 unsigned long src_addr;
125 unsigned long dest_addr;
126 unsigned long ch_ctrl;
127 unsigned long ch_cfg;
128 struct pnx4008_dma_ll *ll;
129 u32 ll_dma;
130 int flags;
131 void *alloc_data;
132 int (*free) (void *);
133};
134
135extern struct pnx4008_dma_ll *pnx4008_alloc_ll_entry(dma_addr_t *);
136extern void pnx4008_free_ll_entry(struct pnx4008_dma_ll *, dma_addr_t);
137extern void pnx4008_free_ll(u32 ll_dma, struct pnx4008_dma_ll *);
138
139extern int pnx4008_request_channel(char *, int,
140 void (*)(int, int, void *),
141 void *);
142extern void pnx4008_free_channel(int);
143extern int pnx4008_config_dma(int, int, int);
144extern int pnx4008_dma_pack_control(const struct pnx4008_dma_ch_ctrl *,
145 unsigned long *);
146extern int pnx4008_dma_parse_control(unsigned long,
147 struct pnx4008_dma_ch_ctrl *);
148extern int pnx4008_dma_pack_config(const struct pnx4008_dma_ch_config *,
149 unsigned long *);
150extern int pnx4008_dma_parse_config(unsigned long,
151 struct pnx4008_dma_ch_config *);
152extern int pnx4008_config_channel(int, struct pnx4008_dma_config *);
153extern int pnx4008_channel_get_config(int, struct pnx4008_dma_config *);
154extern int pnx4008_dma_ch_enable(int);
155extern int pnx4008_dma_ch_disable(int);
156extern int pnx4008_dma_ch_enabled(int);
157extern void pnx4008_dma_split_head_entry(struct pnx4008_dma_config *,
158 struct pnx4008_dma_ch_ctrl *);
159extern void pnx4008_dma_split_ll_entry(struct pnx4008_dma_ll *,
160 struct pnx4008_dma_ch_ctrl *);
161
162#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-pnx4008/include/mach/entry-macro.S b/arch/arm/mach-pnx4008/include/mach/entry-macro.S
new file mode 100644
index 000000000000..8003037578ed
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/entry-macro.S
@@ -0,0 +1,127 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for PNX4008-based platforms
5 *
6 * 2005-2006 (c) MontaVista Software, Inc.
7 * Author: Vitaly Wool <vwool@ru.mvista.com>
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include "platform.h"
14
15#define IO_BASE 0xF0000000
16#define IO_ADDRESS(x) (((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) | IO_BASE)
17
18#define INTRC_MASK 0x00
19#define INTRC_RAW_STAT 0x04
20#define INTRC_STAT 0x08
21#define INTRC_POLAR 0x0C
22#define INTRC_ACT_TYPE 0x10
23#define INTRC_TYPE 0x14
24
25#define SIC1_BASE_INT 32
26#define SIC2_BASE_INT 64
27
28 .macro disable_fiq
29 .endm
30
31 .macro get_irqnr_preamble, base, tmp
32 .endm
33
34 .macro arch_ret_to_user, tmp1, tmp2
35 .endm
36
37 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
38/* decode the MIC interrupt numbers */
39 ldr \base, =IO_ADDRESS(PNX4008_INTCTRLMIC_BASE)
40 ldr \irqstat, [\base, #INTRC_STAT]
41
42 cmp \irqstat,#1<<16
43 movhs \irqnr,#16
44 movlo \irqnr,#0
45 movhs \irqstat,\irqstat,lsr#16
46 cmp \irqstat,#1<<8
47 addhs \irqnr,\irqnr,#8
48 movhs \irqstat,\irqstat,lsr#8
49 cmp \irqstat,#1<<4
50 addhs \irqnr,\irqnr,#4
51 movhs \irqstat,\irqstat,lsr#4
52 cmp \irqstat,#1<<2
53 addhs \irqnr,\irqnr,#2
54 movhs \irqstat,\irqstat,lsr#2
55 cmp \irqstat,#1<<1
56 addhs \irqnr,\irqnr,#1
57
58/* was there an interrupt ? if not then drop out with EQ status */
59 teq \irqstat,#0
60 beq 1003f
61
62/* and now check for extended IRQ reasons */
63 cmp \irqnr,#1
64 bls 1003f
65 cmp \irqnr,#30
66 blo 1002f
67
68/* IRQ 31,30 : High priority cascade IRQ handle */
69/* read the correct SIC */
70/* decoding status after compare : eq is 30 (SIC1) , ne is 31 (SIC2) */
71/* set the base IRQ number */
72 ldreq \base, =IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
73 moveq \irqnr,#SIC1_BASE_INT
74 ldrne \base, =IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
75 movne \irqnr,#SIC2_BASE_INT
76 ldr \irqstat, [\base, #INTRC_STAT]
77 ldr \tmp, [\base, #INTRC_TYPE]
78/* and with inverted mask : low priority interrupts */
79 and \irqstat,\irqstat,\tmp
80 b 1004f
81
821003:
83/* IRQ 1,0 : Low priority cascade IRQ handle */
84/* read the correct SIC */
85/* decoding status after compare : eq is 1 (SIC2) , ne is 0 (SIC1)*/
86/* read the correct SIC */
87/* set the base IRQ number */
88 ldrne \base, =IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
89 movne \irqnr,#SIC1_BASE_INT
90 ldreq \base, =IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
91 moveq \irqnr,#SIC2_BASE_INT
92 ldr \irqstat, [\base, #INTRC_STAT]
93 ldr \tmp, [\base, #INTRC_TYPE]
94/* and with inverted mask : low priority interrupts */
95 bic \irqstat,\irqstat,\tmp
96
971004:
98
99 cmp \irqstat,#1<<16
100 addhs \irqnr,\irqnr,#16
101 movhs \irqstat,\irqstat,lsr#16
102 cmp \irqstat,#1<<8
103 addhs \irqnr,\irqnr,#8
104 movhs \irqstat,\irqstat,lsr#8
105 cmp \irqstat,#1<<4
106 addhs \irqnr,\irqnr,#4
107 movhs \irqstat,\irqstat,lsr#4
108 cmp \irqstat,#1<<2
109 addhs \irqnr,\irqnr,#2
110 movhs \irqstat,\irqstat,lsr#2
111 cmp \irqstat,#1<<1
112 addhs \irqnr,\irqnr,#1
113
114
115/* is irqstat not zero */
116
1171002:
118/* we assert that irqstat is not equal to zero and return ne status if true*/
119 teq \irqstat,#0
1201003:
121 .endm
122
123
124 .macro irq_prio_table
125 .endm
126
127
diff --git a/arch/arm/mach-pnx4008/include/mach/gpio.h b/arch/arm/mach-pnx4008/include/mach/gpio.h
new file mode 100644
index 000000000000..9591467eb9ec
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/gpio.h
@@ -0,0 +1,241 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/gpio.h
3 *
4 * PNX4008 GPIO driver - header file
5 *
6 * Author: Dmitry Chigirev <source@mvista.com>
7 *
8 * Based on reference code by Iwo Mergler and Z.Tabaaloute from Philips:
9 * Copyright (c) 2005 Koninklijke Philips Electronics N.V.
10 *
11 * 2005 (c) MontaVista Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16
17#ifndef _PNX4008_GPIO_H_
18#define _PNX4008_GPIO_H_
19
20
21/* Block numbers */
22#define GPIO_IN (0)
23#define GPIO_OUT (0x100)
24#define GPIO_BID (0x200)
25#define GPIO_RAM (0x300)
26#define GPIO_MUX (0x400)
27
28#define GPIO_TYPE_MASK(K) ((K) & 0x700)
29
30/* INPUT GPIOs */
31/* GPI */
32#define GPI_00 (GPIO_IN | 0)
33#define GPI_01 (GPIO_IN | 1)
34#define GPI_02 (GPIO_IN | 2)
35#define GPI_03 (GPIO_IN | 3)
36#define GPI_04 (GPIO_IN | 4)
37#define GPI_05 (GPIO_IN | 5)
38#define GPI_06 (GPIO_IN | 6)
39#define GPI_07 (GPIO_IN | 7)
40#define GPI_08 (GPIO_IN | 8)
41#define GPI_09 (GPIO_IN | 9)
42#define U1_RX (GPIO_IN | 15)
43#define U2_HTCS (GPIO_IN | 16)
44#define U2_RX (GPIO_IN | 17)
45#define U3_RX (GPIO_IN | 18)
46#define U4_RX (GPIO_IN | 19)
47#define U5_RX (GPIO_IN | 20)
48#define U6_IRRX (GPIO_IN | 21)
49#define U7_HCTS (GPIO_IN | 22)
50#define U7_RX (GPIO_IN | 23)
51/* MISC IN */
52#define SPI1_DATIN (GPIO_IN | 25)
53#define DISP_SYNC (GPIO_IN | 26)
54#define SPI2_DATIN (GPIO_IN | 27)
55#define GPI_11 (GPIO_IN | 28)
56
57#define GPIO_IN_MASK 0x1eff83ff
58
59/* OUTPUT GPIOs */
60/* GPO */
61#define GPO_00 (GPIO_OUT | 0)
62#define GPO_01 (GPIO_OUT | 1)
63#define GPO_02 (GPIO_OUT | 2)
64#define GPO_03 (GPIO_OUT | 3)
65#define GPO_04 (GPIO_OUT | 4)
66#define GPO_05 (GPIO_OUT | 5)
67#define GPO_06 (GPIO_OUT | 6)
68#define GPO_07 (GPIO_OUT | 7)
69#define GPO_08 (GPIO_OUT | 8)
70#define GPO_09 (GPIO_OUT | 9)
71#define GPO_10 (GPIO_OUT | 10)
72#define GPO_11 (GPIO_OUT | 11)
73#define GPO_12 (GPIO_OUT | 12)
74#define GPO_13 (GPIO_OUT | 13)
75#define GPO_14 (GPIO_OUT | 14)
76#define GPO_15 (GPIO_OUT | 15)
77#define GPO_16 (GPIO_OUT | 16)
78#define GPO_17 (GPIO_OUT | 17)
79#define GPO_18 (GPIO_OUT | 18)
80#define GPO_19 (GPIO_OUT | 19)
81#define GPO_20 (GPIO_OUT | 20)
82#define GPO_21 (GPIO_OUT | 21)
83#define GPO_22 (GPIO_OUT | 22)
84#define GPO_23 (GPIO_OUT | 23)
85
86#define GPIO_OUT_MASK 0xffffff
87
88/* BIDIRECTIONAL GPIOs */
89/* RAM pins */
90#define RAM_D19 (GPIO_RAM | 0)
91#define RAM_D20 (GPIO_RAM | 1)
92#define RAM_D21 (GPIO_RAM | 2)
93#define RAM_D22 (GPIO_RAM | 3)
94#define RAM_D23 (GPIO_RAM | 4)
95#define RAM_D24 (GPIO_RAM | 5)
96#define RAM_D25 (GPIO_RAM | 6)
97#define RAM_D26 (GPIO_RAM | 7)
98#define RAM_D27 (GPIO_RAM | 8)
99#define RAM_D28 (GPIO_RAM | 9)
100#define RAM_D29 (GPIO_RAM | 10)
101#define RAM_D30 (GPIO_RAM | 11)
102#define RAM_D31 (GPIO_RAM | 12)
103
104#define GPIO_RAM_MASK 0x1fff
105
106/* I/O pins */
107#define GPIO_00 (GPIO_BID | 25)
108#define GPIO_01 (GPIO_BID | 26)
109#define GPIO_02 (GPIO_BID | 27)
110#define GPIO_03 (GPIO_BID | 28)
111#define GPIO_04 (GPIO_BID | 29)
112#define GPIO_05 (GPIO_BID | 30)
113
114#define GPIO_BID_MASK 0x7e000000
115
116/* Non-GPIO multiplexed PIOs. For multiplexing with GPIO, please use GPIO macros */
117#define GPIO_SDRAM_SEL (GPIO_MUX | 3)
118
119#define GPIO_MUX_MASK 0x8
120
121/* Extraction/assembly macros */
122#define GPIO_BIT_MASK(K) ((K) & 0x1F)
123#define GPIO_BIT(K) (1 << GPIO_BIT_MASK(K))
124#define GPIO_ISMUX(K) ((GPIO_TYPE_MASK(K) == GPIO_MUX) && (GPIO_BIT(K) & GPIO_MUX_MASK))
125#define GPIO_ISRAM(K) ((GPIO_TYPE_MASK(K) == GPIO_RAM) && (GPIO_BIT(K) & GPIO_RAM_MASK))
126#define GPIO_ISBID(K) ((GPIO_TYPE_MASK(K) == GPIO_BID) && (GPIO_BIT(K) & GPIO_BID_MASK))
127#define GPIO_ISOUT(K) ((GPIO_TYPE_MASK(K) == GPIO_OUT) && (GPIO_BIT(K) & GPIO_OUT_MASK))
128#define GPIO_ISIN(K) ((GPIO_TYPE_MASK(K) == GPIO_IN) && (GPIO_BIT(K) & GPIO_IN_MASK))
129
130/* Start Enable Pin Interrupts - table 58 page 66 */
131
132#define SE_PIN_BASE_INT 32
133
134#define SE_U7_RX_INT 63
135#define SE_U7_HCTS_INT 62
136#define SE_BT_CLKREQ_INT 61
137#define SE_U6_IRRX_INT 60
138/*59 unused*/
139#define SE_U5_RX_INT 58
140#define SE_GPI_11_INT 57
141#define SE_U3_RX_INT 56
142#define SE_U2_HCTS_INT 55
143#define SE_U2_RX_INT 54
144#define SE_U1_RX_INT 53
145#define SE_DISP_SYNC_INT 52
146/*51 unused*/
147#define SE_SDIO_INT_N 50
148#define SE_MSDIO_START_INT 49
149#define SE_GPI_06_INT 48
150#define SE_GPI_05_INT 47
151#define SE_GPI_04_INT 46
152#define SE_GPI_03_INT 45
153#define SE_GPI_02_INT 44
154#define SE_GPI_01_INT 43
155#define SE_GPI_00_INT 42
156#define SE_SYSCLKEN_PIN_INT 41
157#define SE_SPI1_DATAIN_INT 40
158#define SE_GPI_07_INT 39
159#define SE_SPI2_DATAIN_INT 38
160#define SE_GPI_10_INT 37
161#define SE_GPI_09_INT 36
162#define SE_GPI_08_INT 35
163/*34-32 unused*/
164
165/* Start Enable Internal Interrupts - table 57 page 65 */
166
167#define SE_INT_BASE_INT 0
168
169#define SE_TS_IRQ 31
170#define SE_TS_P_INT 30
171#define SE_TS_AUX_INT 29
172/*27-28 unused*/
173#define SE_USB_AHB_NEED_CLK_INT 26
174#define SE_MSTIMER_INT 25
175#define SE_RTC_INT 24
176#define SE_USB_NEED_CLK_INT 23
177#define SE_USB_INT 22
178#define SE_USB_I2C_INT 21
179#define SE_USB_OTG_TIMER_INT 20
180#define SE_USB_OTG_ATX_INT_N 19
181/*18 unused*/
182#define SE_DSP_GPIO4_INT 17
183#define SE_KEY_IRQ 16
184#define SE_DSP_SLAVEPORT_INT 15
185#define SE_DSP_GPIO1_INT 14
186#define SE_DSP_GPIO0_INT 13
187#define SE_DSP_AHB_INT 12
188/*11-6 unused*/
189#define SE_GPIO_05_INT 5
190#define SE_GPIO_04_INT 4
191#define SE_GPIO_03_INT 3
192#define SE_GPIO_02_INT 2
193#define SE_GPIO_01_INT 1
194#define SE_GPIO_00_INT 0
195
196#define START_INT_REG_BIT(irq) (1<<((irq)&0x1F))
197
198#define START_INT_ER_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x20 + (((irq)&(0x1<<5))>>1)))
199#define START_INT_RSR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x24 + (((irq)&(0x1<<5))>>1)))
200#define START_INT_SR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x28 + (((irq)&(0x1<<5))>>1)))
201#define START_INT_APR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x2C + (((irq)&(0x1<<5))>>1)))
202
203extern int pnx4008_gpio_register_pin(unsigned short pin);
204extern int pnx4008_gpio_unregister_pin(unsigned short pin);
205extern unsigned long pnx4008_gpio_read_pin(unsigned short pin);
206extern int pnx4008_gpio_write_pin(unsigned short pin, int output);
207extern int pnx4008_gpio_set_pin_direction(unsigned short pin, int output);
208extern int pnx4008_gpio_read_pin_direction(unsigned short pin);
209extern int pnx4008_gpio_set_pin_mux(unsigned short pin, int output);
210extern int pnx4008_gpio_read_pin_mux(unsigned short pin);
211
212static inline void start_int_umask(u8 irq)
213{
214 __raw_writel(__raw_readl(START_INT_ER_REG(irq)) |
215 START_INT_REG_BIT(irq), START_INT_ER_REG(irq));
216}
217
218static inline void start_int_mask(u8 irq)
219{
220 __raw_writel(__raw_readl(START_INT_ER_REG(irq)) &
221 ~START_INT_REG_BIT(irq), START_INT_ER_REG(irq));
222}
223
224static inline void start_int_ack(u8 irq)
225{
226 __raw_writel(START_INT_REG_BIT(irq), START_INT_RSR_REG(irq));
227}
228
229static inline void start_int_set_falling_edge(u8 irq)
230{
231 __raw_writel(__raw_readl(START_INT_APR_REG(irq)) &
232 ~START_INT_REG_BIT(irq), START_INT_APR_REG(irq));
233}
234
235static inline void start_int_set_rising_edge(u8 irq)
236{
237 __raw_writel(__raw_readl(START_INT_APR_REG(irq)) |
238 START_INT_REG_BIT(irq), START_INT_APR_REG(irq));
239}
240
241#endif /* _PNX4008_GPIO_H_ */
diff --git a/arch/arm/mach-pnx4008/include/mach/hardware.h b/arch/arm/mach-pnx4008/include/mach/hardware.h
new file mode 100644
index 000000000000..7b98b828d368
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/hardware.h
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-pnx4008/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 * 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#ifndef __ASM_ARCH_HARDWARE_H
21#define __ASM_ARCH_HARDWARE_H
22
23#include <asm/sizes.h>
24#include <mach/platform.h>
25
26/* Start of virtual addresses for IO devices */
27#define IO_BASE 0xF0000000
28
29/* This macro relies on fact that for all HW i/o addresses bits 20-23 are 0 */
30#define IO_ADDRESS(x) (((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) | IO_BASE)
31
32#endif
diff --git a/arch/arm/mach-pnx4008/include/mach/i2c.h b/arch/arm/mach-pnx4008/include/mach/i2c.h
new file mode 100644
index 000000000000..92e8d65006f7
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/i2c.h
@@ -0,0 +1,67 @@
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
15#include <linux/pm.h>
16#include <linux/platform_device.h>
17
18enum {
19 mstatus_tdi = 0x00000001,
20 mstatus_afi = 0x00000002,
21 mstatus_nai = 0x00000004,
22 mstatus_drmi = 0x00000008,
23 mstatus_active = 0x00000020,
24 mstatus_scl = 0x00000040,
25 mstatus_sda = 0x00000080,
26 mstatus_rff = 0x00000100,
27 mstatus_rfe = 0x00000200,
28 mstatus_tff = 0x00000400,
29 mstatus_tfe = 0x00000800,
30};
31
32enum {
33 mcntrl_tdie = 0x00000001,
34 mcntrl_afie = 0x00000002,
35 mcntrl_naie = 0x00000004,
36 mcntrl_drmie = 0x00000008,
37 mcntrl_daie = 0x00000020,
38 mcntrl_rffie = 0x00000040,
39 mcntrl_tffie = 0x00000080,
40 mcntrl_reset = 0x00000100,
41 mcntrl_cdbmode = 0x00000400,
42};
43
44enum {
45 rw_bit = 1 << 0,
46 start_bit = 1 << 8,
47 stop_bit = 1 << 9,
48};
49
50#define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */
51#define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */
52#define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */
53#define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */
54#define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */
55#define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */
56#define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */
57#define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */
58#define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */
59#define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */
60#define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */
61#define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */
62#define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */
63
64#define HCLK_MHZ 13
65#define I2C_CHIP_NAME "PNX4008-I2C"
66
67#endif /* __ASM_ARCH_I2C_H___ */
diff --git a/arch/arm/mach-pnx4008/include/mach/io.h b/arch/arm/mach-pnx4008/include/mach/io.h
new file mode 100644
index 000000000000..c6206f25839d
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/io.h
@@ -0,0 +1,21 @@
1
2/*
3 * arch/arm/mach-pnx4008/include/mach/io.h
4 *
5 * Author: Dmitry Chigirev <chigirev@ru.mvista.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#ifndef __ASM_ARM_ARCH_IO_H
14#define __ASM_ARM_ARCH_IO_H
15
16#define IO_SPACE_LIMIT 0xffffffff
17
18#define __io(a) ((void __iomem *)(a))
19#define __mem_pci(a) (a)
20
21#endif
diff --git a/arch/arm/mach-pnx4008/include/mach/irq.h b/arch/arm/mach-pnx4008/include/mach/irq.h
new file mode 100644
index 000000000000..2a690ca33870
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/irq.h
@@ -0,0 +1,42 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/irq.h
3 *
4 * PNX4008 IRQ controller driver - header file
5 * this one is used in entry-arnv.S as well so it cannot contain C code
6 *
7 * Copyright (c) 2005 Philips Semiconductors
8 * Copyright (c) 2005 MontaVista Software, 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#ifndef __PNX4008_IRQ_H__
16#define __PNX4008_IRQ_H__
17
18#define MIC_VA_BASE IO_ADDRESS(PNX4008_INTCTRLMIC_BASE)
19#define SIC1_VA_BASE IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
20#define SIC2_VA_BASE IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
21
22/* Manual: Chapter 20, page 195 */
23
24#define INTC_BIT(irq) (1<< ((irq) & 0x1F))
25
26#define INTC_ER(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0x0 + (((irq)&(0x3<<5))<<9)))
27#define INTC_RSR(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0x4 + (((irq)&(0x3<<5))<<9)))
28#define INTC_SR(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0x8 + (((irq)&(0x3<<5))<<9)))
29#define INTC_APR(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0xC + (((irq)&(0x3<<5))<<9)))
30#define INTC_ATR(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0x10 + (((irq)&(0x3<<5))<<9)))
31#define INTC_ITR(irq) IO_ADDRESS((PNX4008_INTCTRLMIC_BASE + 0x14 + (((irq)&(0x3<<5))<<9)))
32
33#define START_INT_REG_BIT(irq) (1<<((irq)&0x1F))
34
35#define START_INT_ER_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x20 + (((irq)&(0x1<<5))>>1)))
36#define START_INT_RSR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x24 + (((irq)&(0x1<<5))>>1)))
37#define START_INT_SR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x28 + (((irq)&(0x1<<5))>>1)))
38#define START_INT_APR_REG(irq) IO_ADDRESS((PNX4008_PWRMAN_BASE + 0x2C + (((irq)&(0x1<<5))>>1)))
39
40extern void __init pnx4008_init_irq(void);
41
42#endif /* __PNX4008_IRQ_H__ */
diff --git a/arch/arm/mach-pnx4008/include/mach/irqs.h b/arch/arm/mach-pnx4008/include/mach/irqs.h
new file mode 100644
index 000000000000..f6b33cf23ae2
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/irqs.h
@@ -0,0 +1,215 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/irqs.h
3 *
4 * PNX4008 IRQ controller driver - header file
5 *
6 * Author: Dmitry Chigirev <source@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13#ifndef __PNX4008_IRQS_h__
14#define __PNX4008_IRQS_h__
15
16#define NR_IRQS 96
17
18/*Manual: table 259, page 199*/
19
20/*SUB2 Interrupt Routing (SIC2)*/
21
22#define SIC2_BASE_INT 64
23
24#define CLK_SWITCH_ARM_INT 95 /*manual: Clkswitch ARM */
25#define CLK_SWITCH_DSP_INT 94 /*manual: ClkSwitch DSP */
26#define CLK_SWITCH_AUD_INT 93 /*manual: Clkswitch AUD */
27#define GPI_06_INT 92
28#define GPI_05_INT 91
29#define GPI_04_INT 90
30#define GPI_03_INT 89
31#define GPI_02_INT 88
32#define GPI_01_INT 87
33#define GPI_00_INT 86
34#define BT_CLKREQ_INT 85
35#define SPI1_DATIN_INT 84
36#define U5_RX_INT 83
37#define SDIO_INT_N 82
38#define CAM_HS_INT 81
39#define CAM_VS_INT 80
40#define GPI_07_INT 79
41#define DISP_SYNC_INT 78
42#define DSP_INT8 77
43#define U7_HCTS_INT 76
44#define GPI_10_INT 75
45#define GPI_09_INT 74
46#define GPI_08_INT 73
47#define DSP_INT7 72
48#define U2_HCTS_INT 71
49#define SPI2_DATIN_INT 70
50#define GPIO_05_INT 69
51#define GPIO_04_INT 68
52#define GPIO_03_INT 67
53#define GPIO_02_INT 66
54#define GPIO_01_INT 65
55#define GPIO_00_INT 64
56
57/*Manual: table 258, page 198*/
58
59/*SUB1 Interrupt Routing (SIC1)*/
60
61#define SIC1_BASE_INT 32
62
63#define USB_I2C_INT 63
64#define USB_DEV_HP_INT 62
65#define USB_DEV_LP_INT 61
66#define USB_DEV_DMA_INT 60
67#define USB_HOST_INT 59
68#define USB_OTG_ATX_INT_N 58
69#define USB_OTG_TIMER_INT 57
70#define SW_INT 56
71#define SPI1_INT 55
72#define KEY_IRQ 54
73#define DSP_M_INT 53
74#define RTC_INT 52
75#define I2C_1_INT 51
76#define I2C_2_INT 50
77#define PLL1_LOCK_INT 49
78#define PLL2_LOCK_INT 48
79#define PLL3_LOCK_INT 47
80#define PLL4_LOCK_INT 46
81#define PLL5_LOCK_INT 45
82#define SPI2_INT 44
83#define DSP_INT1 43
84#define DSP_INT2 42
85#define DSP_TDM_INT2 41
86#define TS_AUX_INT 40
87#define TS_IRQ 39
88#define TS_P_INT 38
89#define UOUT1_TO_PAD_INT 37
90#define GPI_11_INT 36
91#define DSP_INT4 35
92#define JTAG_COMM_RX_INT 34
93#define JTAG_COMM_TX_INT 33
94#define DSP_INT3 32
95
96/*Manual: table 257, page 197*/
97
98/*MAIN Interrupt Routing*/
99
100#define MAIN_BASE_INT 0
101
102#define SUB2_FIQ_N 31 /*active low */
103#define SUB1_FIQ_N 30 /*active low */
104#define JPEG_INT 29
105#define DMA_INT 28
106#define MSTIMER_INT 27
107#define IIR1_INT 26
108#define IIR2_INT 25
109#define IIR7_INT 24
110#define DSP_TDM_INT0 23
111#define DSP_TDM_INT1 22
112#define DSP_P_INT 21
113#define DSP_INT0 20
114#define DUM_INT 19
115#define UOUT0_TO_PAD_INT 18
116#define MP4_ENC_INT 17
117#define MP4_DEC_INT 16
118#define SD0_INT 15
119#define MBX_INT 14
120#define SD1_INT 13
121#define MS_INT_N 12
122#define FLASH_INT 11 /*NAND*/
123#define IIR6_INT 10
124#define IIR5_INT 9
125#define IIR4_INT 8
126#define IIR3_INT 7
127#define WATCH_INT 6
128#define HSTIMER_INT 5
129#define ARCH_TIMER_IRQ HSTIMER_INT
130#define CAM_INT 4
131#define PRNG_INT 3
132#define CRYPTO_INT 2
133#define SUB2_IRQ_N 1 /*active low */
134#define SUB1_IRQ_N 0 /*active low */
135
136#define PNX4008_IRQ_TYPES \
137{ /*IRQ #'s: */ \
138IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH, /* 0, 1, 2, 3 */ \
139IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 4, 5, 6, 7 */ \
140IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 8, 9,10,11 */ \
141IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 12,13,14,15 */ \
142IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 16,17,18,19 */ \
143IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 20,21,22,23 */ \
144IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 24,25,26,27 */ \
145IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_LOW, /* 28,29,30,31 */ \
146IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 32,33,34,35 */ \
147IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_EDGE_FALLING, IRQ_TYPE_LEVEL_HIGH, /* 36,37,38,39 */ \
148IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 40,41,42,43 */ \
149IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 44,45,46,47 */ \
150IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_LOW, /* 48,49,50,51 */ \
151IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 52,53,54,55 */ \
152IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH, /* 56,57,58,59 */ \
153IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 60,61,62,63 */ \
154IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 64,65,66,67 */ \
155IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 68,69,70,71 */ \
156IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 72,73,74,75 */ \
157IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 76,77,78,79 */ \
158IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 80,81,82,83 */ \
159IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 84,85,86,87 */ \
160IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 88,89,90,91 */ \
161IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_HIGH, /* 92,93,94,95 */ \
162}
163
164/* Start Enable Pin Interrupts - table 58 page 66 */
165
166#define SE_PIN_BASE_INT 32
167
168#define SE_U7_RX_INT 63
169#define SE_U7_HCTS_INT 62
170#define SE_BT_CLKREQ_INT 61
171#define SE_U6_IRRX_INT 60
172/*59 unused*/
173#define SE_U5_RX_INT 58
174#define SE_GPI_11_INT 57
175#define SE_U3_RX_INT 56
176#define SE_U2_HCTS_INT 55
177#define SE_U2_RX_INT 54
178#define SE_U1_RX_INT 53
179#define SE_DISP_SYNC_INT 52
180/*51 unused*/
181#define SE_SDIO_INT_N 50
182#define SE_MSDIO_START_INT 49
183#define SE_GPI_06_INT 48
184#define SE_GPI_05_INT 47
185#define SE_GPI_04_INT 46
186#define SE_GPI_03_INT 45
187#define SE_GPI_02_INT 44
188#define SE_GPI_01_INT 43
189#define SE_GPI_00_INT 42
190#define SE_SYSCLKEN_PIN_INT 41
191#define SE_SPI1_DATAIN_INT 40
192#define SE_GPI_07_INT 39
193#define SE_SPI2_DATAIN_INT 38
194#define SE_GPI_10_INT 37
195#define SE_GPI_09_INT 36
196#define SE_GPI_08_INT 35
197/*34-32 unused*/
198
199/* Start Enable Internal Interrupts - table 57 page 65 */
200
201#define SE_INT_BASE_INT 0
202
203#define SE_TS_IRQ 31
204#define SE_TS_P_INT 30
205#define SE_TS_AUX_INT 29
206/*27-28 unused*/
207#define SE_USB_AHB_NEED_CLK_INT 26
208#define SE_MSTIMER_INT 25
209#define SE_RTC_INT 24
210#define SE_USB_NEED_CLK_INT 23
211#define SE_USB_INT 22
212#define SE_USB_I2C_INT 21
213#define SE_USB_OTG_TIMER_INT 20
214
215#endif /* __PNX4008_IRQS_h__ */
diff --git a/arch/arm/mach-pnx4008/include/mach/memory.h b/arch/arm/mach-pnx4008/include/mach/memory.h
new file mode 100644
index 000000000000..5789a2d16f5a
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/memory.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/memory.h
3 *
4 * Copyright (c) 2005 Philips Semiconductors
5 * Copyright (c) 2005 MontaVista Software, Inc.
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 __ASM_ARCH_MEMORY_H
14#define __ASM_ARCH_MEMORY_H
15
16/*
17 * Physical DRAM offset.
18 */
19#define PHYS_OFFSET (0x80000000)
20
21#define __virt_to_bus(x) ((x) - PAGE_OFFSET + PHYS_OFFSET)
22#define __bus_to_virt(x) ((x) + PAGE_OFFSET - PHYS_OFFSET)
23
24#endif
diff --git a/arch/arm/mach-pnx4008/include/mach/param.h b/arch/arm/mach-pnx4008/include/mach/param.h
new file mode 100644
index 000000000000..6ea02f2176b7
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/param.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/param.h
3 *
4 * Copyright (C) 1999 ARM Limited
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
21#define HZ 100
diff --git a/arch/arm/mach-pnx4008/include/mach/platform.h b/arch/arm/mach-pnx4008/include/mach/platform.h
new file mode 100644
index 000000000000..368c2c10a308
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/platform.h
@@ -0,0 +1,69 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/platform.h
3 *
4 * PNX4008 Base addresses - header file
5 *
6 * Author: Dmitry Chigirev <source@mvista.com>
7 *
8 * Based on reference code received from Philips:
9 * Copyright (C) 2003 Philips Semiconductors
10 *
11 * 2005 (c) MontaVista Software, Inc. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16
17
18#ifndef __ASM_ARCH_PLATFORM_H__
19#define __ASM_ARCH_PLATFORM_H__
20
21#define PNX4008_IRAM_BASE 0x08000000
22#define PNX4008_IRAM_SIZE 0x00010000
23#define PNX4008_YUV_SLAVE_BASE 0x10000000
24#define PNX4008_DUM_SLAVE_BASE 0x18000000
25#define PNX4008_NDF_FLASH_BASE 0x20020000
26#define PNX4008_SPI1_BASE 0x20088000
27#define PNX4008_SPI2_BASE 0x20090000
28#define PNX4008_SD_CONFIG_BASE 0x20098000
29#define PNX4008_FLASH_DATA 0x200B0000
30#define PNX4008_MLC_FLASH_BASE 0x200B8000
31#define PNX4008_JPEG_CONFIG_BASE 0x300A0000
32#define PNX4008_DMA_CONFIG_BASE 0x31000000
33#define PNX4008_USB_CONFIG_BASE 0x31020000
34#define PNX4008_SDRAM_CFG_BASE 0x31080000
35#define PNX4008_AHB2FAB_BASE 0x40000000
36#define PNX4008_PWRMAN_BASE 0x40004000
37#define PNX4008_INTCTRLMIC_BASE 0x40008000
38#define PNX4008_INTCTRLSIC1_BASE 0x4000C000
39#define PNX4008_INTCTRLSIC2_BASE 0x40010000
40#define PNX4008_HSUART1_BASE 0x40014000
41#define PNX4008_HSUART2_BASE 0x40018000
42#define PNX4008_HSUART7_BASE 0x4001C000
43#define PNX4008_RTC_BASE 0x40024000
44#define PNX4008_PIO_BASE 0x40028000
45#define PNX4008_MSTIMER_BASE 0x40034000
46#define PNX4008_HSTIMER_BASE 0x40038000
47#define PNX4008_WDOG_BASE 0x4003C000
48#define PNX4008_DEBUG_BASE 0x40040000
49#define PNX4008_TOUCH1_BASE 0x40048000
50#define PNX4008_KEYSCAN_BASE 0x40050000
51#define PNX4008_UARTCTRL_BASE 0x40054000
52#define PNX4008_PWM_BASE 0x4005C000
53#define PNX4008_UART3_BASE 0x40080000
54#define PNX4008_UART4_BASE 0x40088000
55#define PNX4008_UART5_BASE 0x40090000
56#define PNX4008_UART6_BASE 0x40098000
57#define PNX4008_I2C1_BASE 0x400A0000
58#define PNX4008_I2C2_BASE 0x400A8000
59#define PNX4008_MAGICGATE_BASE 0x400B0000
60#define PNX4008_DUMCONF_BASE 0x400B8000
61#define PNX4008_DUM_MAINCFG_BASE 0x400BC000
62#define PNX4008_DSP_BASE 0x400C0000
63#define PNX4008_PROFCOUNTER_BASE 0x400C8000
64#define PNX4008_CRYPTO_BASE 0x400D0000
65#define PNX4008_CAMIFCONF_BASE 0x400D8000
66#define PNX4008_YUV2RGB_BASE 0x400E0000
67#define PNX4008_AUDIOCONFIG_BASE 0x400E8000
68
69#endif
diff --git a/arch/arm/mach-pnx4008/include/mach/pm.h b/arch/arm/mach-pnx4008/include/mach/pm.h
new file mode 100644
index 000000000000..2fa685bff858
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/pm.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/pm.h
3 *
4 * PNX4008 Power Management Routiness - header file
5 *
6 * Authors: Vitaly Wool, Dmitry Chigirev <source@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __ASM_ARCH_PNX4008_PM_H
15#define __ASM_ARCH_PNX4008_PM_H
16
17#ifndef __ASSEMBLER__
18#include "irq.h"
19#include "irqs.h"
20#include "clock.h"
21
22extern void pnx4008_pm_idle(void);
23extern void pnx4008_pm_suspend(void);
24extern unsigned int pnx4008_cpu_suspend_sz;
25extern void pnx4008_cpu_suspend(void);
26extern unsigned int pnx4008_cpu_standby_sz;
27extern void pnx4008_cpu_standby(void);
28
29extern int pnx4008_startup_pll(struct clk *);
30extern int pnx4008_shutdown_pll(struct clk *);
31
32#endif /* ASSEMBLER */
33#endif /* __ASM_ARCH_PNX4008_PM_H */
diff --git a/arch/arm/mach-pnx4008/include/mach/system.h b/arch/arm/mach-pnx4008/include/mach/system.h
new file mode 100644
index 000000000000..8985a4622b8c
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/system.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/system.h
3 *
4 * Copyright (C) 2003 Philips Semiconductors
5 * Copyright (C) 2005 MontaVista Software, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24#include <mach/hardware.h>
25#include <asm/io.h>
26#include <mach/platform.h>
27
28static void arch_idle(void)
29{
30 cpu_do_idle();
31}
32
33static inline void arch_reset(char mode)
34{
35 cpu_reset(0);
36}
37
38#endif
diff --git a/arch/arm/mach-pnx4008/include/mach/timex.h b/arch/arm/mach-pnx4008/include/mach/timex.h
new file mode 100644
index 000000000000..956fbd8e977c
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/timex.h
@@ -0,0 +1,73 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/timex.h
3 *
4 * PNX4008 timers header file
5 *
6 * Author: Dmitry Chigirev <source@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __PNX4008_TIMEX_H
15#define __PNX4008_TIMEX_H
16
17#include <mach/hardware.h>
18#include <asm/io.h>
19
20#define CLOCK_TICK_RATE 1000000
21
22#define TICKS2USECS(x) (x)
23
24/* MilliSecond Timer - Chapter 21 Page 202 */
25
26#define MSTIM_INT IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x0))
27#define MSTIM_CTRL IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x4))
28#define MSTIM_COUNTER IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x8))
29#define MSTIM_MCTRL IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x14))
30#define MSTIM_MATCH0 IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x18))
31#define MSTIM_MATCH1 IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x1c))
32
33/* High Speed Timer - Chpater 22, Page 205 */
34
35#define HSTIM_INT IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x0))
36#define HSTIM_CTRL IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x4))
37#define HSTIM_COUNTER IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x8))
38#define HSTIM_PMATCH IO_ADDRESS((PNX4008_HSTIMER_BASE + 0xC))
39#define HSTIM_PCOUNT IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x10))
40#define HSTIM_MCTRL IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x14))
41#define HSTIM_MATCH0 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x18))
42#define HSTIM_MATCH1 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x1c))
43#define HSTIM_MATCH2 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x20))
44#define HSTIM_CCR IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x28))
45#define HSTIM_CR0 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x2C))
46#define HSTIM_CR1 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x30))
47
48/* IMPORTANT: both timers are UPCOUNTING */
49
50/* xSTIM_MCTRL bit definitions */
51#define MR0_INT 1
52#define RESET_COUNT0 (1<<1)
53#define STOP_COUNT0 (1<<2)
54#define MR1_INT (1<<3)
55#define RESET_COUNT1 (1<<4)
56#define STOP_COUNT1 (1<<5)
57#define MR2_INT (1<<6)
58#define RESET_COUNT2 (1<<7)
59#define STOP_COUNT2 (1<<8)
60
61/* xSTIM_CTRL bit definitions */
62#define COUNT_ENAB 1
63#define RESET_COUNT (1<<1)
64#define DEBUG_EN (1<<2)
65
66/* xSTIM_INT bit definitions */
67#define MATCH0_INT 1
68#define MATCH1_INT (1<<1)
69#define MATCH2_INT (1<<2)
70#define RTC_TICK0 (1<<4)
71#define RTC_TICK1 (1<<5)
72
73#endif
diff --git a/arch/arm/mach-pnx4008/include/mach/uncompress.h b/arch/arm/mach-pnx4008/include/mach/uncompress.h
new file mode 100644
index 000000000000..bb4751ee2539
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/uncompress.h
@@ -0,0 +1,46 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/uncompress.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2006 MontaVista Software, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#define UART5_BASE 0x40090000
23
24#define UART5_DR (*(volatile unsigned char *) (UART5_BASE))
25#define UART5_FR (*(volatile unsigned char *) (UART5_BASE + 18))
26
27static __inline__ void putc(char c)
28{
29 while (UART5_FR & (1 << 5))
30 barrier();
31
32 UART5_DR = c;
33}
34
35/*
36 * This does not append a newline
37 */
38static inline void flush(void)
39{
40}
41
42/*
43 * nothing to do
44 */
45#define arch_decomp_setup()
46#define arch_decomp_wdog()
diff --git a/arch/arm/mach-pnx4008/include/mach/vmalloc.h b/arch/arm/mach-pnx4008/include/mach/vmalloc.h
new file mode 100644
index 000000000000..2ad398378aed
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/vmalloc.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/vmalloc.h
3 *
4 * Author: Vitaly Wool <source@mvista.com>
5 *
6 * 2006 (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/*
13 * Just any arbitrary offset to the start of the vmalloc VM area: the
14 * current 8MB value just means that there will be a 8MB "hole" after the
15 * physical memory until the kernel virtual memory starts. That means that
16 * any out-of-bounds memory accesses will hopefully be caught.
17 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
18 * area for the same reason. ;)
19 */
20#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
diff --git a/arch/arm/mach-pnx4008/irq.c b/arch/arm/mach-pnx4008/irq.c
index 5ed67e1947a8..5c4f55af5d4b 100644
--- a/arch/arm/mach-pnx4008/irq.c
+++ b/arch/arm/mach-pnx4008/irq.c
@@ -23,17 +23,16 @@
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/setup.h> 28#include <asm/setup.h>
29#include <asm/mach-types.h>
30#include <asm/pgtable.h> 29#include <asm/pgtable.h>
31#include <asm/page.h> 30#include <asm/page.h>
32#include <asm/system.h> 31#include <asm/system.h>
33#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
34#include <asm/mach/irq.h> 33#include <asm/mach/irq.h>
35#include <asm/mach/map.h> 34#include <asm/mach/map.h>
36#include <asm/arch/irq.h> 35#include <mach/irq.h>
37 36
38static u8 pnx4008_irq_type[NR_IRQS] = PNX4008_IRQ_TYPES; 37static u8 pnx4008_irq_type[NR_IRQS] = PNX4008_IRQ_TYPES;
39 38
diff --git a/arch/arm/mach-pnx4008/pm.c b/arch/arm/mach-pnx4008/pm.c
index 40116d254349..f970906d8848 100644
--- a/arch/arm/mach-pnx4008/pm.c
+++ b/arch/arm/mach-pnx4008/pm.c
@@ -20,10 +20,9 @@
20#include <linux/clk.h> 20#include <linux/clk.h>
21 21
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/mach-types.h>
24#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
25#include <asm/arch/pm.h> 24#include <mach/pm.h>
26#include <asm/arch/clock.h> 25#include <mach/clock.h>
27 26
28#define SRAM_VA IO_ADDRESS(PNX4008_IRAM_BASE) 27#define SRAM_VA IO_ADDRESS(PNX4008_IRAM_BASE)
29 28
diff --git a/arch/arm/mach-pnx4008/serial.c b/arch/arm/mach-pnx4008/serial.c
index 95a1b3f964a2..9be84bbb30e8 100644
--- a/arch/arm/mach-pnx4008/serial.c
+++ b/arch/arm/mach-pnx4008/serial.c
@@ -15,14 +15,14 @@
15 15
16#include <asm/io.h> 16#include <asm/io.h>
17 17
18#include <asm/arch/platform.h> 18#include <mach/platform.h>
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20 20
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/serial_reg.h> 22#include <linux/serial_reg.h>
23#include <asm/arch/gpio.h> 23#include <mach/gpio.h>
24 24
25#include <asm/arch/clock.h> 25#include <mach/clock.h>
26 26
27#define UART_3 0 27#define UART_3 0
28#define UART_4 1 28#define UART_4 1
diff --git a/arch/arm/mach-pnx4008/sleep.S b/arch/arm/mach-pnx4008/sleep.S
index fea1e17a3650..f4eed495d295 100644
--- a/arch/arm/mach-pnx4008/sleep.S
+++ b/arch/arm/mach-pnx4008/sleep.S
@@ -13,7 +13,7 @@
13 13
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <asm/assembler.h> 15#include <asm/assembler.h>
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17 17
18#define PWRMAN_VA_BASE IO_ADDRESS(PNX4008_PWRMAN_BASE) 18#define PWRMAN_VA_BASE IO_ADDRESS(PNX4008_PWRMAN_BASE)
19#define PWR_CTRL_REG_OFFS 0x44 19#define PWR_CTRL_REG_OFFS 0x44
diff --git a/arch/arm/mach-pnx4008/time.c b/arch/arm/mach-pnx4008/time.c
index 6d4ca8fc0cb4..180975244f96 100644
--- a/arch/arm/mach-pnx4008/time.c
+++ b/arch/arm/mach-pnx4008/time.c
@@ -24,7 +24,7 @@
24#include <linux/irq.h> 24#include <linux/irq.h>
25 25
26#include <asm/system.h> 26#include <asm/system.h>
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/leds.h> 29#include <asm/leds.h>
30#include <asm/mach/time.h> 30#include <asm/mach/time.h>
diff --git a/arch/arm/mach-pxa/akita-ioexp.c b/arch/arm/mach-pxa/akita-ioexp.c
index 254892ac30cd..5c67b188a3ba 100644
--- a/arch/arm/mach-pxa/akita-ioexp.c
+++ b/arch/arm/mach-pxa/akita-ioexp.c
@@ -19,7 +19,7 @@
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/workqueue.h> 21#include <linux/workqueue.h>
22#include <asm/arch/akita.h> 22#include <mach/akita.h>
23 23
24/* MAX7310 Regiser Map */ 24/* MAX7310 Regiser Map */
25#define MAX7310_INPUT 0x00 25#define MAX7310_INPUT 0x00
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index 630063ffa6fc..c01eea88f787 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -12,9 +12,9 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14 14
15#include <asm/arch/pxa2xx-regs.h> 15#include <mach/pxa2xx-regs.h>
16#include <asm/arch/pxa2xx-gpio.h> 16#include <mach/pxa2xx-gpio.h>
17#include <asm/hardware.h> 17#include <mach/hardware.h>
18 18
19#include "devices.h" 19#include "devices.h"
20#include "generic.h" 20#include "generic.h"
diff --git a/arch/arm/mach-pxa/cm-x270-pci.c b/arch/arm/mach-pxa/cm-x270-pci.c
index 31f5bd411ced..2d5bcea1e520 100644
--- a/arch/arm/mach-pxa/cm-x270-pci.c
+++ b/arch/arm/mach-pxa/cm-x270-pci.c
@@ -22,7 +22,7 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23 23
24#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
25#include <asm/arch/pxa-regs.h> 25#include <mach/pxa-regs.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27 27
28#include <asm/hardware/it8152.h> 28#include <asm/hardware/it8152.h>
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index 402e807eae54..af003a269534 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -23,14 +23,14 @@
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25 25
26#include <asm/arch/pxa2xx-regs.h> 26#include <mach/pxa2xx-regs.h>
27#include <asm/arch/mfp-pxa27x.h> 27#include <mach/mfp-pxa27x.h>
28#include <asm/arch/pxa-regs.h> 28#include <mach/pxa-regs.h>
29#include <asm/arch/audio.h> 29#include <mach/audio.h>
30#include <asm/arch/pxafb.h> 30#include <mach/pxafb.h>
31#include <asm/arch/ohci.h> 31#include <mach/ohci.h>
32#include <asm/arch/mmc.h> 32#include <mach/mmc.h>
33#include <asm/arch/bitfield.h> 33#include <mach/bitfield.h>
34 34
35#include <asm/hardware/it8152.h> 35#include <asm/hardware/it8152.h>
36 36
diff --git a/arch/arm/mach-pxa/colibri.c b/arch/arm/mach-pxa/colibri.c
index 574839d7c132..abce13c846c5 100644
--- a/arch/arm/mach-pxa/colibri.c
+++ b/arch/arm/mach-pxa/colibri.c
@@ -21,16 +21,16 @@
21#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
22#include <linux/mtd/physmap.h> 22#include <linux/mtd/physmap.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/sizes.h> 26#include <asm/sizes.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30#include <asm/mach/flash.h> 30#include <asm/mach/flash.h>
31#include <asm/arch/pxa-regs.h> 31#include <mach/pxa-regs.h>
32#include <asm/arch/pxa2xx-gpio.h> 32#include <mach/pxa2xx-gpio.h>
33#include <asm/arch/colibri.h> 33#include <mach/colibri.h>
34 34
35#include "generic.h" 35#include "generic.h"
36#include "devices.h" 36#include "devices.h"
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index e58504edb140..123a950db466 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -26,7 +26,7 @@
26#include <asm/setup.h> 26#include <asm/setup.h>
27#include <asm/memory.h> 27#include <asm/memory.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/system.h> 32#include <asm/system.h>
@@ -35,14 +35,14 @@
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
37 37
38#include <asm/arch/pxa-regs.h> 38#include <mach/pxa-regs.h>
39#include <asm/arch/pxa2xx-regs.h> 39#include <mach/pxa2xx-regs.h>
40#include <asm/arch/pxa2xx-gpio.h> 40#include <mach/pxa2xx-gpio.h>
41#include <asm/arch/irda.h> 41#include <mach/irda.h>
42#include <asm/arch/mmc.h> 42#include <mach/mmc.h>
43#include <asm/arch/udc.h> 43#include <mach/udc.h>
44#include <asm/arch/corgi.h> 44#include <mach/corgi.h>
45#include <asm/arch/sharpsl.h> 45#include <mach/sharpsl.h>
46 46
47#include <asm/mach/sharpsl_param.h> 47#include <asm/mach/sharpsl_param.h>
48#include <asm/hardware/scoop.h> 48#include <asm/hardware/scoop.h>
diff --git a/arch/arm/mach-pxa/corgi_lcd.c b/arch/arm/mach-pxa/corgi_lcd.c
index 9328df37afd1..311baf149b07 100644
--- a/arch/arm/mach-pxa/corgi_lcd.c
+++ b/arch/arm/mach-pxa/corgi_lcd.c
@@ -20,12 +20,12 @@
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <asm/arch/akita.h> 23#include <mach/akita.h>
24#include <asm/arch/corgi.h> 24#include <mach/corgi.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/arch/pxa-regs.h> 26#include <mach/pxa-regs.h>
27#include <asm/arch/sharpsl.h> 27#include <mach/sharpsl.h>
28#include <asm/arch/spitz.h> 28#include <mach/spitz.h>
29#include <asm/hardware/scoop.h> 29#include <asm/hardware/scoop.h>
30#include <asm/mach/sharpsl_param.h> 30#include <asm/mach/sharpsl_param.h>
31#include "generic.h" 31#include "generic.h"
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index e91c0f26c412..35bbfccd2df3 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -20,14 +20,14 @@
20 20
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/hardware/scoop.h> 24#include <asm/hardware/scoop.h>
25 25
26#include <asm/arch/sharpsl.h> 26#include <mach/sharpsl.h>
27#include <asm/arch/corgi.h> 27#include <mach/corgi.h>
28#include <asm/arch/pxa-regs.h> 28#include <mach/pxa-regs.h>
29#include <asm/arch/pxa2xx-regs.h> 29#include <mach/pxa2xx-regs.h>
30#include <asm/arch/pxa2xx-gpio.h> 30#include <mach/pxa2xx-gpio.h>
31#include "sharpsl.h" 31#include "sharpsl.h"
32 32
33#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ 33#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */
diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c
index eccc45d21f75..8e2f2215c4ba 100644
--- a/arch/arm/mach-pxa/corgi_ssp.c
+++ b/arch/arm/mach-pxa/corgi_ssp.c
@@ -16,13 +16,13 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21 21
22#include <asm/arch/ssp.h> 22#include <mach/ssp.h>
23#include <asm/arch/pxa-regs.h> 23#include <mach/pxa-regs.h>
24#include <asm/arch/pxa2xx-gpio.h> 24#include <mach/pxa2xx-gpio.h>
25#include <asm/arch/regs-ssp.h> 25#include <mach/regs-ssp.h>
26#include "sharpsl.h" 26#include "sharpsl.h"
27 27
28static DEFINE_SPINLOCK(corgi_ssp_lock); 28static DEFINE_SPINLOCK(corgi_ssp_lock);
diff --git a/arch/arm/mach-pxa/cpu-pxa.c b/arch/arm/mach-pxa/cpu-pxa.c
index fb9ba1ab2826..6f5569bac131 100644
--- a/arch/arm/mach-pxa/cpu-pxa.c
+++ b/arch/arm/mach-pxa/cpu-pxa.c
@@ -37,9 +37,9 @@
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/cpufreq.h> 38#include <linux/cpufreq.h>
39 39
40#include <asm/hardware.h> 40#include <mach/hardware.h>
41#include <asm/arch/pxa-regs.h> 41#include <mach/pxa-regs.h>
42#include <asm/arch/pxa2xx-regs.h> 42#include <mach/pxa2xx-regs.h>
43 43
44#ifdef DEBUG 44#ifdef DEBUG
45static unsigned int freq_debug; 45static unsigned int freq_debug;
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 84489dc51d81..35736fc08634 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -4,19 +4,19 @@
4#include <linux/platform_device.h> 4#include <linux/platform_device.h>
5#include <linux/dma-mapping.h> 5#include <linux/dma-mapping.h>
6 6
7#include <asm/arch/gpio.h> 7#include <mach/gpio.h>
8#include <asm/arch/udc.h> 8#include <mach/udc.h>
9#include <asm/arch/pxafb.h> 9#include <mach/pxafb.h>
10#include <asm/arch/mmc.h> 10#include <mach/mmc.h>
11#include <asm/arch/irda.h> 11#include <mach/irda.h>
12#include <asm/arch/i2c.h> 12#include <mach/i2c.h>
13#include <asm/arch/mfp-pxa27x.h> 13#include <mach/mfp-pxa27x.h>
14#include <asm/arch/ohci.h> 14#include <mach/ohci.h>
15#include <asm/arch/pxa27x_keypad.h> 15#include <mach/pxa27x_keypad.h>
16#include <asm/arch/pxa2xx_spi.h> 16#include <mach/pxa2xx_spi.h>
17#include <asm/arch/camera.h> 17#include <mach/camera.h>
18#include <asm/arch/audio.h> 18#include <mach/audio.h>
19#include <asm/arch/pxa3xx_nand.h> 19#include <mach/pxa3xx_nand.h>
20 20
21#include "devices.h" 21#include "devices.h"
22#include "generic.h" 22#include "generic.h"
diff --git a/arch/arm/mach-pxa/dma.c b/arch/arm/mach-pxa/dma.c
index 3215316d7b06..c0be17e0ab82 100644
--- a/arch/arm/mach-pxa/dma.c
+++ b/arch/arm/mach-pxa/dma.c
@@ -20,10 +20,10 @@
20 20
21#include <asm/system.h> 21#include <asm/system.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/dma.h> 24#include <asm/dma.h>
25 25
26#include <asm/arch/pxa-regs.h> 26#include <mach/pxa-regs.h>
27 27
28struct dma_channel { 28struct dma_channel {
29 char *name; 29 char *name;
diff --git a/arch/arm/mach-pxa/e400_lcd.c b/arch/arm/mach-pxa/e400_lcd.c
index 16c023630626..263884165f57 100644
--- a/arch/arm/mach-pxa/e400_lcd.c
+++ b/arch/arm/mach-pxa/e400_lcd.c
@@ -14,8 +14,8 @@
14#include <linux/module.h> 14#include <linux/module.h>
15 15
16#include <asm/mach-types.h> 16#include <asm/mach-types.h>
17#include <asm/arch/pxa-regs.h> 17#include <mach/pxa-regs.h>
18#include <asm/arch/pxafb.h> 18#include <mach/pxafb.h>
19 19
20static struct pxafb_mode_info e400_pxafb_mode_info = { 20static struct pxafb_mode_info e400_pxafb_mode_info = {
21 .pixclock = 140703, 21 .pixclock = 140703,
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index e5cc6ca63c75..7a0a681a5847 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -23,14 +23,14 @@
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25 25
26#include <asm/arch/mfp-pxa27x.h> 26#include <mach/mfp-pxa27x.h>
27#include <asm/arch/pxa-regs.h> 27#include <mach/pxa-regs.h>
28#include <asm/arch/pxa27x-udc.h> 28#include <mach/pxa27x-udc.h>
29#include <asm/arch/audio.h> 29#include <mach/audio.h>
30#include <asm/arch/pxafb.h> 30#include <mach/pxafb.h>
31#include <asm/arch/ohci.h> 31#include <mach/ohci.h>
32#include <asm/arch/mmc.h> 32#include <mach/mmc.h>
33#include <asm/arch/pxa27x_keypad.h> 33#include <mach/pxa27x_keypad.h>
34 34
35#include "generic.h" 35#include "generic.h"
36 36
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index c29b7b21c11b..03942450885b 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -14,7 +14,7 @@
14 14
15#include <asm/setup.h> 15#include <asm/setup.h>
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/arch/hardware.h> 17#include <mach/hardware.h>
18#include <asm/mach-types.h> 18#include <asm/mach-types.h>
19 19
20#include "generic.h" 20#include "generic.h"
diff --git a/arch/arm/mach-pxa/eseries_udc.c b/arch/arm/mach-pxa/eseries_udc.c
index 362847a10998..d622c04c0d44 100644
--- a/arch/arm/mach-pxa/eseries_udc.c
+++ b/arch/arm/mach-pxa/eseries_udc.c
@@ -14,10 +14,10 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/device.h> 15#include <linux/device.h>
16 16
17#include <asm/arch/udc.h> 17#include <mach/udc.h>
18#include <asm/arch/eseries-gpio.h> 18#include <mach/eseries-gpio.h>
19#include <asm/arch/hardware.h> 19#include <mach/hardware.h>
20#include <asm/arch/pxa-regs.h> 20#include <mach/pxa-regs.h>
21#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index 0143eed65398..cc3d850cc0b6 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -18,13 +18,13 @@
18#include <linux/pwm_backlight.h> 18#include <linux/pwm_backlight.h>
19 19
20#include <asm/setup.h> 20#include <asm/setup.h>
21#include <asm/arch/pxafb.h> 21#include <mach/pxafb.h>
22#include <asm/arch/ohci.h> 22#include <mach/ohci.h>
23#include <asm/arch/i2c.h> 23#include <mach/i2c.h>
24 24
25#include <asm/arch/mfp-pxa27x.h> 25#include <mach/mfp-pxa27x.h>
26#include <asm/arch/pxa-regs.h> 26#include <mach/pxa-regs.h>
27#include <asm/arch/pxa2xx-regs.h> 27#include <mach/pxa2xx-regs.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30 30
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 36638926c5ce..ceaed0076366 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -20,13 +20,13 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/pgtable.h> 25#include <asm/pgtable.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <asm/arch/pxa-regs.h> 28#include <mach/pxa-regs.h>
29#include <asm/arch/reset.h> 29#include <mach/reset.h>
30 30
31#include "generic.h" 31#include "generic.h"
32 32
diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c
index 7d3e16970be0..07acc1b23857 100644
--- a/arch/arm/mach-pxa/gpio.c
+++ b/arch/arm/mach-pxa/gpio.c
@@ -18,10 +18,10 @@
18#include <linux/sysdev.h> 18#include <linux/sysdev.h>
19 19
20#include <asm/gpio.h> 20#include <asm/gpio.h>
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/arch/pxa-regs.h> 23#include <mach/pxa-regs.h>
24#include <asm/arch/pxa2xx-gpio.h> 24#include <mach/pxa2xx-gpio.h>
25 25
26#include "generic.h" 26#include "generic.h"
27 27
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index bdf239754037..c0092472fa58 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -26,7 +26,7 @@
26#include <asm/setup.h> 26#include <asm/setup.h>
27#include <asm/memory.h> 27#include <asm/memory.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/sizes.h> 31#include <asm/sizes.h>
32 32
@@ -34,13 +34,13 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36#include <asm/mach/flash.h> 36#include <asm/mach/flash.h>
37#include <asm/arch/mmc.h> 37#include <mach/mmc.h>
38#include <asm/arch/udc.h> 38#include <mach/udc.h>
39#include <asm/arch/gumstix.h> 39#include <mach/gumstix.h>
40 40
41#include <asm/arch/pxa-regs.h> 41#include <mach/pxa-regs.h>
42#include <asm/arch/pxa2xx-regs.h> 42#include <mach/pxa2xx-regs.h>
43#include <asm/arch/pxa2xx-gpio.h> 43#include <mach/pxa2xx-gpio.h>
44 44
45#include "generic.h" 45#include "generic.h"
46 46
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
index 2637633f9166..5aa0270d5605 100644
--- a/arch/arm/mach-pxa/idp.c
+++ b/arch/arm/mach-pxa/idp.c
@@ -25,18 +25,18 @@
25#include <asm/setup.h> 25#include <asm/setup.h>
26#include <asm/memory.h> 26#include <asm/memory.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30 30
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include <asm/arch/pxa-regs.h> 34#include <mach/pxa-regs.h>
35#include <asm/arch/pxa2xx-gpio.h> 35#include <mach/pxa2xx-gpio.h>
36#include <asm/arch/idp.h> 36#include <mach/idp.h>
37#include <asm/arch/pxafb.h> 37#include <mach/pxafb.h>
38#include <asm/arch/bitfield.h> 38#include <mach/bitfield.h>
39#include <asm/arch/mmc.h> 39#include <mach/mmc.h>
40 40
41#include "generic.h" 41#include "generic.h"
42#include "devices.h" 42#include "devices.h"
diff --git a/arch/arm/mach-pxa/include/mach/akita.h b/arch/arm/mach-pxa/include/mach/akita.h
new file mode 100644
index 000000000000..5d8cc1d9cb10
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/akita.h
@@ -0,0 +1,32 @@
1/*
2 * Hardware specific definitions for SL-C1000 (Akita)
3 *
4 * Copyright (c) 2005 Richard Purdie
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12/* Akita IO Expander GPIOs */
13
14#define AKITA_IOEXP_RESERVED_7 (1 << 7)
15#define AKITA_IOEXP_IR_ON (1 << 6)
16#define AKITA_IOEXP_AKIN_PULLUP (1 << 5)
17#define AKITA_IOEXP_BACKLIGHT_CONT (1 << 4)
18#define AKITA_IOEXP_BACKLIGHT_ON (1 << 3)
19#define AKITA_IOEXP_MIC_BIAS (1 << 2)
20#define AKITA_IOEXP_RESERVED_1 (1 << 1)
21#define AKITA_IOEXP_RESERVED_0 (1 << 0)
22
23/* Direction Bitfield 0=output 1=input */
24#define AKITA_IOEXP_IO_DIR 0
25/* Default Values */
26#define AKITA_IOEXP_IO_OUT (AKITA_IOEXP_IR_ON | AKITA_IOEXP_AKIN_PULLUP)
27
28extern struct platform_device akitaioexp_device;
29
30void akita_set_ioexp(struct device *dev, unsigned char bitmask);
31void akita_reset_ioexp(struct device *dev, unsigned char bitmask);
32
diff --git a/arch/arm/mach-pxa/include/mach/audio.h b/arch/arm/mach-pxa/include/mach/audio.h
new file mode 100644
index 000000000000..f82f96dd1053
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/audio.h
@@ -0,0 +1,17 @@
1#ifndef __ASM_ARCH_AUDIO_H__
2#define __ASM_ARCH_AUDIO_H__
3
4#include <sound/core.h>
5#include <sound/pcm.h>
6
7typedef struct {
8 int (*startup)(struct snd_pcm_substream *, void *);
9 void (*shutdown)(struct snd_pcm_substream *, void *);
10 void (*suspend)(void *);
11 void (*resume)(void *);
12 void *priv;
13} pxa2xx_audio_ops_t;
14
15extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops);
16
17#endif
diff --git a/arch/arm/mach-pxa/include/mach/bitfield.h b/arch/arm/mach-pxa/include/mach/bitfield.h
new file mode 100644
index 000000000000..f1f0e3387d9c
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/bitfield.h
@@ -0,0 +1,113 @@
1/*
2 * FILE bitfield.h
3 *
4 * Version 1.1
5 * Author Copyright (c) Marc A. Viredaz, 1998
6 * DEC Western Research Laboratory, Palo Alto, CA
7 * Date April 1998 (April 1997)
8 * System Advanced RISC Machine (ARM)
9 * Language C or ARM Assembly
10 * Purpose Definition of macros to operate on bit fields.
11 */
12
13
14
15#ifndef __BITFIELD_H
16#define __BITFIELD_H
17
18#ifndef __ASSEMBLY__
19#define UData(Data) ((unsigned long) (Data))
20#else
21#define UData(Data) (Data)
22#endif
23
24
25/*
26 * MACRO: Fld
27 *
28 * Purpose
29 * The macro "Fld" encodes a bit field, given its size and its shift value
30 * with respect to bit 0.
31 *
32 * Note
33 * A more intuitive way to encode bit fields would have been to use their
34 * mask. However, extracting size and shift value information from a bit
35 * field's mask is cumbersome and might break the assembler (255-character
36 * line-size limit).
37 *
38 * Input
39 * Size Size of the bit field, in number of bits.
40 * Shft Shift value of the bit field with respect to bit 0.
41 *
42 * Output
43 * Fld Encoded bit field.
44 */
45
46#define Fld(Size, Shft) (((Size) << 16) + (Shft))
47
48
49/*
50 * MACROS: FSize, FShft, FMsk, FAlnMsk, F1stBit
51 *
52 * Purpose
53 * The macros "FSize", "FShft", "FMsk", "FAlnMsk", and "F1stBit" return
54 * the size, shift value, mask, aligned mask, and first bit of a
55 * bit field.
56 *
57 * Input
58 * Field Encoded bit field (using the macro "Fld").
59 *
60 * Output
61 * FSize Size of the bit field, in number of bits.
62 * FShft Shift value of the bit field with respect to bit 0.
63 * FMsk Mask for the bit field.
64 * FAlnMsk Mask for the bit field, aligned on bit 0.
65 * F1stBit First bit of the bit field.
66 */
67
68#define FSize(Field) ((Field) >> 16)
69#define FShft(Field) ((Field) & 0x0000FFFF)
70#define FMsk(Field) (((UData (1) << FSize (Field)) - 1) << FShft (Field))
71#define FAlnMsk(Field) ((UData (1) << FSize (Field)) - 1)
72#define F1stBit(Field) (UData (1) << FShft (Field))
73
74
75/*
76 * MACRO: FInsrt
77 *
78 * Purpose
79 * The macro "FInsrt" inserts a value into a bit field by shifting the
80 * former appropriately.
81 *
82 * Input
83 * Value Bit-field value.
84 * Field Encoded bit field (using the macro "Fld").
85 *
86 * Output
87 * FInsrt Bit-field value positioned appropriately.
88 */
89
90#define FInsrt(Value, Field) \
91 (UData (Value) << FShft (Field))
92
93
94/*
95 * MACRO: FExtr
96 *
97 * Purpose
98 * The macro "FExtr" extracts the value of a bit field by masking and
99 * shifting it appropriately.
100 *
101 * Input
102 * Data Data containing the bit-field to be extracted.
103 * Field Encoded bit field (using the macro "Fld").
104 *
105 * Output
106 * FExtr Bit-field value.
107 */
108
109#define FExtr(Data, Field) \
110 ((UData (Data) >> FShft (Field)) & FAlnMsk (Field))
111
112
113#endif /* __BITFIELD_H */
diff --git a/arch/arm/mach-pxa/include/mach/camera.h b/arch/arm/mach-pxa/include/mach/camera.h
new file mode 100644
index 000000000000..39516ced8b1f
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/camera.h
@@ -0,0 +1,48 @@
1/*
2 camera.h - PXA camera driver header file
3
4 Copyright (C) 2003, Intel Corporation
5 Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.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 as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#ifndef __ASM_ARCH_CAMERA_H_
23#define __ASM_ARCH_CAMERA_H_
24
25#define PXA_CAMERA_MASTER 1
26#define PXA_CAMERA_DATAWIDTH_4 2
27#define PXA_CAMERA_DATAWIDTH_5 4
28#define PXA_CAMERA_DATAWIDTH_8 8
29#define PXA_CAMERA_DATAWIDTH_9 0x10
30#define PXA_CAMERA_DATAWIDTH_10 0x20
31#define PXA_CAMERA_PCLK_EN 0x40
32#define PXA_CAMERA_MCLK_EN 0x80
33#define PXA_CAMERA_PCP 0x100
34#define PXA_CAMERA_HSP 0x200
35#define PXA_CAMERA_VSP 0x400
36
37struct pxacamera_platform_data {
38 int (*init)(struct device *);
39 int (*power)(struct device *, int);
40 int (*reset)(struct device *, int);
41
42 unsigned long flags;
43 unsigned long mclk_10khz;
44};
45
46extern void pxa_set_camera_info(struct pxacamera_platform_data *);
47
48#endif /* __ASM_ARCH_CAMERA_H_ */
diff --git a/arch/arm/mach-pxa/include/mach/colibri.h b/arch/arm/mach-pxa/include/mach/colibri.h
new file mode 100644
index 000000000000..2ae373fb5675
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/colibri.h
@@ -0,0 +1,19 @@
1#ifndef _COLIBRI_H_
2#define _COLIBRI_H_
3
4/* physical memory regions */
5#define COLIBRI_FLASH_PHYS (PXA_CS0_PHYS) /* Flash region */
6#define COLIBRI_ETH_PHYS (PXA_CS2_PHYS) /* Ethernet DM9000 region */
7#define COLIBRI_SDRAM_BASE 0xa0000000 /* SDRAM region */
8
9/* virtual memory regions */
10#define COLIBRI_DISK_VIRT 0xF0000000 /* Disk On Chip region */
11
12/* size of flash */
13#define COLIBRI_FLASH_SIZE 0x02000000 /* Flash size 32 MB */
14
15/* Ethernet Controller Davicom DM9000 */
16#define GPIO_DM9000 114
17#define COLIBRI_ETH_IRQ IRQ_GPIO(GPIO_DM9000)
18
19#endif /* _COLIBRI_H_ */
diff --git a/arch/arm/mach-pxa/include/mach/corgi.h b/arch/arm/mach-pxa/include/mach/corgi.h
new file mode 100644
index 000000000000..bf856503baf6
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/corgi.h
@@ -0,0 +1,109 @@
1/*
2 * Hardware specific definitions for SL-C7xx series of PDAs
3 *
4 * Copyright (c) 2004-2005 Richard Purdie
5 *
6 * Based on Sharp's 2.4 kernel patches
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13#ifndef __ASM_ARCH_CORGI_H
14#define __ASM_ARCH_CORGI_H 1
15
16
17/*
18 * Corgi (Non Standard) GPIO Definitions
19 */
20#define CORGI_GPIO_KEY_INT (0) /* Keyboard Interrupt */
21#define CORGI_GPIO_AC_IN (1) /* Charger Detection */
22#define CORGI_GPIO_WAKEUP (3) /* System wakeup notification? */
23#define CORGI_GPIO_AK_INT (4) /* Headphone Jack Control Interrupt */
24#define CORGI_GPIO_TP_INT (5) /* Touch Panel Interrupt */
25#define CORGI_GPIO_nSD_WP (7) /* SD Write Protect? */
26#define CORGI_GPIO_nSD_DETECT (9) /* MMC/SD Card Detect */
27#define CORGI_GPIO_nSD_INT (10) /* SD Interrupt for SDIO? */
28#define CORGI_GPIO_MAIN_BAT_LOW (11) /* Main Battery Low Notification */
29#define CORGI_GPIO_BAT_COVER (11) /* Battery Cover Detect */
30#define CORGI_GPIO_LED_ORANGE (13) /* Orange LED Control */
31#define CORGI_GPIO_CF_CD (14) /* Compact Flash Card Detect */
32#define CORGI_GPIO_CHRG_FULL (16) /* Charging Complete Notification */
33#define CORGI_GPIO_CF_IRQ (17) /* Compact Flash Interrupt */
34#define CORGI_GPIO_LCDCON_CS (19) /* LCD Control Chip Select */
35#define CORGI_GPIO_MAX1111_CS (20) /* MAX1111 Chip Select */
36#define CORGI_GPIO_ADC_TEMP_ON (21) /* Select battery voltage or temperature */
37#define CORGI_GPIO_IR_ON (22) /* Enable IR Transciever */
38#define CORGI_GPIO_ADS7846_CS (24) /* ADS7846 Chip Select */
39#define CORGI_GPIO_SD_PWR (33) /* MMC/SD Power */
40#define CORGI_GPIO_CHRG_ON (38) /* Enable battery Charging */
41#define CORGI_GPIO_DISCHARGE_ON (42) /* Enable battery Discharge */
42#define CORGI_GPIO_CHRG_UKN (43) /* Unknown Charging (Bypass Control?) */
43#define CORGI_GPIO_HSYNC (44) /* LCD HSync Pulse */
44#define CORGI_GPIO_USB_PULLUP (45) /* USB show presence to host */
45
46
47/*
48 * Corgi Keyboard Definitions
49 */
50#define CORGI_KEY_STROBE_NUM (12)
51#define CORGI_KEY_SENSE_NUM (8)
52#define CORGI_GPIO_ALL_STROBE_BIT (0x00003ffc)
53#define CORGI_GPIO_HIGH_SENSE_BIT (0xfc000000)
54#define CORGI_GPIO_HIGH_SENSE_RSHIFT (26)
55#define CORGI_GPIO_LOW_SENSE_BIT (0x00000003)
56#define CORGI_GPIO_LOW_SENSE_LSHIFT (6)
57#define CORGI_GPIO_STROBE_BIT(a) GPIO_bit(66+(a))
58#define CORGI_GPIO_SENSE_BIT(a) GPIO_bit(58+(a))
59#define CORGI_GAFR_ALL_STROBE_BIT (0x0ffffff0)
60#define CORGI_GAFR_HIGH_SENSE_BIT (0xfff00000)
61#define CORGI_GAFR_LOW_SENSE_BIT (0x0000000f)
62#define CORGI_GPIO_KEY_SENSE(a) (58+(a))
63#define CORGI_GPIO_KEY_STROBE(a) (66+(a))
64
65
66/*
67 * Corgi Interrupts
68 */
69#define CORGI_IRQ_GPIO_KEY_INT IRQ_GPIO(0)
70#define CORGI_IRQ_GPIO_AC_IN IRQ_GPIO(1)
71#define CORGI_IRQ_GPIO_WAKEUP IRQ_GPIO(3)
72#define CORGI_IRQ_GPIO_AK_INT IRQ_GPIO(4)
73#define CORGI_IRQ_GPIO_TP_INT IRQ_GPIO(5)
74#define CORGI_IRQ_GPIO_nSD_DETECT IRQ_GPIO(9)
75#define CORGI_IRQ_GPIO_nSD_INT IRQ_GPIO(10)
76#define CORGI_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(11)
77#define CORGI_IRQ_GPIO_CF_CD IRQ_GPIO(14)
78#define CORGI_IRQ_GPIO_CHRG_FULL IRQ_GPIO(16) /* Battery fully charged */
79#define CORGI_IRQ_GPIO_CF_IRQ IRQ_GPIO(17)
80#define CORGI_IRQ_GPIO_KEY_SENSE(a) IRQ_GPIO(58+(a)) /* Keyboard Sense lines */
81
82
83/*
84 * Corgi SCOOP GPIOs and Config
85 */
86#define CORGI_SCP_LED_GREEN SCOOP_GPCR_PA11
87#define CORGI_SCP_SWA SCOOP_GPCR_PA12 /* Hinge Switch A */
88#define CORGI_SCP_SWB SCOOP_GPCR_PA13 /* Hinge Switch B */
89#define CORGI_SCP_MUTE_L SCOOP_GPCR_PA14
90#define CORGI_SCP_MUTE_R SCOOP_GPCR_PA15
91#define CORGI_SCP_AKIN_PULLUP SCOOP_GPCR_PA16
92#define CORGI_SCP_APM_ON SCOOP_GPCR_PA17
93#define CORGI_SCP_BACKLIGHT_CONT SCOOP_GPCR_PA18
94#define CORGI_SCP_MIC_BIAS SCOOP_GPCR_PA19
95
96#define CORGI_SCOOP_IO_DIR ( CORGI_SCP_LED_GREEN | CORGI_SCP_MUTE_L | CORGI_SCP_MUTE_R | \
97 CORGI_SCP_AKIN_PULLUP | CORGI_SCP_APM_ON | CORGI_SCP_BACKLIGHT_CONT | \
98 CORGI_SCP_MIC_BIAS )
99#define CORGI_SCOOP_IO_OUT ( CORGI_SCP_MUTE_L | CORGI_SCP_MUTE_R )
100
101
102/*
103 * Shared data structures
104 */
105extern struct platform_device corgiscoop_device;
106extern struct platform_device corgissp_device;
107
108#endif /* __ASM_ARCH_CORGI_H */
109
diff --git a/arch/arm/mach-pxa/include/mach/debug-macro.S b/arch/arm/mach-pxa/include/mach/debug-macro.S
new file mode 100644
index 000000000000..55d6a175ab19
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/debug-macro.S
@@ -0,0 +1,25 @@
1/* arch/arm/mach-pxa/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#include "hardware.h"
15
16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0
18 tst \rx, #1 @ MMU enabled?
19 moveq \rx, #0x40000000 @ physical
20 movne \rx, #io_p2v(0x40000000) @ virtual
21 orr \rx, \rx, #0x00100000
22 .endm
23
24#define UART_SHIFT 2
25#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-pxa/include/mach/dma.h b/arch/arm/mach-pxa/include/mach/dma.h
new file mode 100644
index 000000000000..955bfe606067
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/dma.h
@@ -0,0 +1,50 @@
1/*
2 * arch/arm/mach-pxa/include/mach/dma.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __ASM_ARCH_DMA_H
13#define __ASM_ARCH_DMA_H
14
15/*
16 * Descriptor structure for PXA's DMA engine
17 * Note: this structure must always be aligned to a 16-byte boundary.
18 */
19
20typedef struct pxa_dma_desc {
21 volatile u32 ddadr; /* Points to the next descriptor + flags */
22 volatile u32 dsadr; /* DSADR value for the current transfer */
23 volatile u32 dtadr; /* DTADR value for the current transfer */
24 volatile u32 dcmd; /* DCMD value for the current transfer */
25} pxa_dma_desc;
26
27typedef enum {
28 DMA_PRIO_HIGH = 0,
29 DMA_PRIO_MEDIUM = 1,
30 DMA_PRIO_LOW = 2
31} pxa_dma_prio;
32
33#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
34#define HAVE_ARCH_PCI_SET_DMA_MASK 1
35#endif
36
37/*
38 * DMA registration
39 */
40
41int __init pxa_init_dma(int num_ch);
42
43int pxa_request_dma (char *name,
44 pxa_dma_prio prio,
45 void (*irq_handler)(int, void *),
46 void *data);
47
48void pxa_free_dma (int dma_ch);
49
50#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-pxa/include/mach/entry-macro.S b/arch/arm/mach-pxa/include/mach/entry-macro.S
new file mode 100644
index 000000000000..de16c12d5232
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/entry-macro.S
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/mach-pxa/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for PXA-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#include <mach/irqs.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro get_irqnr_preamble, base, tmp
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
23 mrc p15, 0, \tmp, c0, c0, 0 @ CPUID
24 mov \tmp, \tmp, lsr #13
25 and \tmp, \tmp, #0x7 @ Core G
26 cmp \tmp, #1
27 bhi 1004f
28
29 mov \base, #io_p2v(0x40000000) @ IIR Ctl = 0x40d00000
30 add \base, \base, #0x00d00000
31 ldr \irqstat, [\base, #0] @ ICIP
32 ldr \irqnr, [\base, #4] @ ICMR
33 b 1002f
34
351004:
36 mrc p6, 0, \irqstat, c6, c0, 0 @ ICIP2
37 mrc p6, 0, \irqnr, c7, c0, 0 @ ICMR2
38 ands \irqnr, \irqstat, \irqnr
39 beq 1003f
40 rsb \irqstat, \irqnr, #0
41 and \irqstat, \irqstat, \irqnr
42 clz \irqnr, \irqstat
43 rsb \irqnr, \irqnr, #31
44 add \irqnr, \irqnr, #32
45 b 1001f
461003:
47 mrc p6, 0, \irqstat, c0, c0, 0 @ ICIP
48 mrc p6, 0, \irqnr, c1, c0, 0 @ ICMR
491002:
50 ands \irqnr, \irqstat, \irqnr
51 beq 1001f
52 rsb \irqstat, \irqnr, #0
53 and \irqstat, \irqstat, \irqnr
54 clz \irqnr, \irqstat
55 rsb \irqnr, \irqnr, #31
561001:
57 .endm
diff --git a/arch/arm/mach-pxa/include/mach/eseries-gpio.h b/arch/arm/mach-pxa/include/mach/eseries-gpio.h
new file mode 100644
index 000000000000..4c90b1310270
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/eseries-gpio.h
@@ -0,0 +1,50 @@
1/*
2 * eseries-gpio.h
3 *
4 * Copyright (C) Ian Molton <spyro@f2s.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12/* e-series power button */
13#define GPIO_ESERIES_POWERBTN 0
14
15/* UDC GPIO definitions */
16#define GPIO_E7XX_USB_DISC 13
17#define GPIO_E7XX_USB_PULLUP 3
18
19#define GPIO_E800_USB_DISC 4
20#define GPIO_E800_USB_PULLUP 84
21
22/* e740 PCMCIA GPIO definitions */
23/* Note: PWR1 seems to be inverted */
24#define GPIO_E740_PCMCIA_CD0 8
25#define GPIO_E740_PCMCIA_CD1 44
26#define GPIO_E740_PCMCIA_RDY0 11
27#define GPIO_E740_PCMCIA_RDY1 6
28#define GPIO_E740_PCMCIA_RST0 27
29#define GPIO_E740_PCMCIA_RST1 24
30#define GPIO_E740_PCMCIA_PWR0 20
31#define GPIO_E740_PCMCIA_PWR1 23
32
33/* e750 PCMCIA GPIO definitions */
34#define GPIO_E750_PCMCIA_CD0 8
35#define GPIO_E750_PCMCIA_RDY0 12
36#define GPIO_E750_PCMCIA_RST0 27
37#define GPIO_E750_PCMCIA_PWR0 20
38
39/* e800 PCMCIA GPIO definitions */
40#define GPIO_E800_PCMCIA_RST0 69
41#define GPIO_E800_PCMCIA_RST1 72
42#define GPIO_E800_PCMCIA_PWR0 20
43#define GPIO_E800_PCMCIA_PWR1 73
44
45/* e7xx IrDA power control */
46#define GPIO_E7XX_IR_ON 38
47
48/* ASIC related GPIOs */
49#define GPIO_ESERIES_TMIO_IRQ 5
50#define GPIO_E800_ANGELX_IRQ 8
diff --git a/arch/arm/mach-pxa/include/mach/eseries-irq.h b/arch/arm/mach-pxa/include/mach/eseries-irq.h
new file mode 100644
index 000000000000..f2a93d5e31d3
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/eseries-irq.h
@@ -0,0 +1,27 @@
1/*
2 * eseries-irq.h
3 *
4 * Copyright (C) Ian Molton <spyro@f2s.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#define ANGELX_IRQ_BASE (IRQ_BOARD_START+8)
13#define IRQ_ANGELX(n) (ANGELX_IRQ_BASE + (n))
14
15#define ANGELX_RDY0_IRQ IRQ_ANGELX(0)
16#define ANGELX_ST0_IRQ IRQ_ANGELX(1)
17#define ANGELX_CD0_IRQ IRQ_ANGELX(2)
18#define ANGELX_RDY1_IRQ IRQ_ANGELX(3)
19#define ANGELX_ST1_IRQ IRQ_ANGELX(4)
20#define ANGELX_CD1_IRQ IRQ_ANGELX(5)
21
22#define TMIO_IRQ_BASE (IRQ_BOARD_START+0)
23#define IRQ_TMIO(n) (TMIO_IRQ_BASE + (n))
24
25#define TMIO_SD_IRQ IRQ_TMIO(1)
26#define TMIO_USB_IRQ IRQ_TMIO(2)
27
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
new file mode 100644
index 000000000000..2c538d8c362d
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/gpio.h
@@ -0,0 +1,65 @@
1/*
2 * arch/arm/mach-pxa/include/mach/gpio.h
3 *
4 * PXA GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __ASM_ARCH_PXA_GPIO_H
25#define __ASM_ARCH_PXA_GPIO_H
26
27#include <mach/pxa-regs.h>
28#include <asm/irq.h>
29#include <mach/hardware.h>
30
31#include <asm-generic/gpio.h>
32
33
34/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
35 * Those cases currently cause holes in the GPIO number space.
36 */
37#define NR_BUILTIN_GPIO 128
38
39static inline int gpio_get_value(unsigned gpio)
40{
41 if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO))
42 return GPLR(gpio) & GPIO_bit(gpio);
43 else
44 return __gpio_get_value(gpio);
45}
46
47static inline void gpio_set_value(unsigned gpio, int value)
48{
49 if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) {
50 if (value)
51 GPSR(gpio) = GPIO_bit(gpio);
52 else
53 GPCR(gpio) = GPIO_bit(gpio);
54 } else {
55 __gpio_set_value(gpio, value);
56 }
57}
58
59#define gpio_cansleep __gpio_cansleep
60
61#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
62#define irq_to_gpio(irq) IRQ_TO_GPIO(irq)
63
64
65#endif
diff --git a/arch/arm/mach-pxa/include/mach/gumstix.h b/arch/arm/mach-pxa/include/mach/gumstix.h
new file mode 100644
index 000000000000..42ee1956750e
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/gumstix.h
@@ -0,0 +1,96 @@
1/*
2 * arch/arm/mach-pxa/include/mach/gumstix.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9
10/* BTRESET - Reset line to Bluetooth module, active low signal. */
11#define GPIO_GUMSTIX_BTRESET 7
12#define GPIO_GUMSTIX_BTRESET_MD (GPIO_GUMSTIX_BTRESET | GPIO_OUT)
13
14
15/*
16GPIOn - Input from MAX823 (or equiv), normalizing USB +5V into a clean
17interrupt signal for determining cable presence. On the original gumstix,
18this is GPIO81, and GPIO83 needs to be defined as well. On the gumstix F,
19this moves to GPIO17 and GPIO37. */
20
21/* GPIOx - Connects to USB D+ and used as a pull-up after GPIOn
22has detected a cable insertion; driven low otherwise. */
23
24#ifdef CONFIG_ARCH_GUMSTIX_ORIG
25
26#define GPIO_GUMSTIX_USB_GPIOn 81
27#define GPIO_GUMSTIX_USB_GPIOx 83
28
29#else
30
31#define GPIO_GUMSTIX_USB_GPIOn 35
32#define GPIO_GUMSTIX_USB_GPIOx 41
33
34#endif
35
36/* usb state change */
37#define GUMSTIX_USB_INTR_IRQ IRQ_GPIO(GPIO_GUMSTIX_USB_GPIOn)
38
39#define GPIO_GUMSTIX_USB_GPIOn_MD (GPIO_GUMSTIX_USB_GPIOn | GPIO_IN)
40#define GPIO_GUMSTIX_USB_GPIOx_CON_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_OUT)
41#define GPIO_GUMSTIX_USB_GPIOx_DIS_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_IN)
42
43/*
44 * SD/MMC definitions
45 */
46#define GUMSTIX_GPIO_nSD_WP 22 /* SD Write Protect */
47#define GUMSTIX_GPIO_nSD_DETECT 11 /* MMC/SD Card Detect */
48#define GUMSTIX_IRQ_GPIO_nSD_DETECT IRQ_GPIO(GUMSTIX_GPIO_nSD_DETECT)
49
50/*
51 * SMC Ethernet definitions
52 * ETH_RST provides a hardware reset line to the ethernet chip
53 * ETH is the IRQ line in from the ethernet chip to the PXA
54 */
55#define GPIO_GUMSTIX_ETH0_RST 80
56#define GPIO_GUMSTIX_ETH0_RST_MD (GPIO_GUMSTIX_ETH0_RST | GPIO_OUT)
57#define GPIO_GUMSTIX_ETH1_RST 52
58#define GPIO_GUMSTIX_ETH1_RST_MD (GPIO_GUMSTIX_ETH1_RST | GPIO_OUT)
59
60#define GPIO_GUMSTIX_ETH0 36
61#define GPIO_GUMSTIX_ETH0_MD (GPIO_GUMSTIX_ETH0 | GPIO_IN)
62#define GUMSTIX_ETH0_IRQ IRQ_GPIO(GPIO_GUMSTIX_ETH0)
63#define GPIO_GUMSTIX_ETH1 27
64#define GPIO_GUMSTIX_ETH1_MD (GPIO_GUMSTIX_ETH1 | GPIO_IN)
65#define GUMSTIX_ETH1_IRQ IRQ_GPIO(GPIO_GUMSTIX_ETH1)
66
67
68/* CF reset line */
69#define GPIO8_RESET 8
70
71/* CF slot 0 */
72#define GPIO4_nBVD1 4
73#define GPIO4_nSTSCHG GPIO4_nBVD1
74#define GPIO11_nCD 11
75#define GPIO26_PRDY_nBSY 26
76#define GUMSTIX_S0_nSTSCHG_IRQ IRQ_GPIO(GPIO4_nSTSCHG)
77#define GUMSTIX_S0_nCD_IRQ IRQ_GPIO(GPIO11_nCD)
78#define GUMSTIX_S0_PRDY_nBSY_IRQ IRQ_GPIO(GPIO26_PRDY_nBSY)
79
80/* CF slot 1 */
81#define GPIO18_nBVD1 18
82#define GPIO18_nSTSCHG GPIO18_nBVD1
83#define GPIO36_nCD 36
84#define GPIO27_PRDY_nBSY 27
85#define GUMSTIX_S1_nSTSCHG_IRQ IRQ_GPIO(GPIO18_nSTSCHG)
86#define GUMSTIX_S1_nCD_IRQ IRQ_GPIO(GPIO36_nCD)
87#define GUMSTIX_S1_PRDY_nBSY_IRQ IRQ_GPIO(GPIO27_PRDY_nBSY)
88
89/* CF GPIO line modes */
90#define GPIO4_nSTSCHG_MD (GPIO4_nSTSCHG | GPIO_IN)
91#define GPIO8_RESET_MD (GPIO8_RESET | GPIO_OUT)
92#define GPIO11_nCD_MD (GPIO11_nCD | GPIO_IN)
93#define GPIO18_nSTSCHG_MD (GPIO18_nSTSCHG | GPIO_IN)
94#define GPIO26_PRDY_nBSY_MD (GPIO26_PRDY_nBSY | GPIO_IN)
95#define GPIO27_PRDY_nBSY_MD (GPIO27_PRDY_nBSY | GPIO_IN)
96#define GPIO36_nCD_MD (GPIO36_nCD | GPIO_IN)
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
new file mode 100644
index 000000000000..e89df4d0d239
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/hardware.h
@@ -0,0 +1,235 @@
1/*
2 * arch/arm/mach-pxa/include/mach/hardware.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ASM_ARCH_HARDWARE_H
14#define __ASM_ARCH_HARDWARE_H
15
16/*
17 * We requires absolute addresses.
18 */
19#define PCIO_BASE 0
20
21/*
22 * Workarounds for at least 2 errata so far require this.
23 * The mapping is set in mach-pxa/generic.c.
24 */
25#define UNCACHED_PHYS_0 0xff000000
26#define UNCACHED_ADDR UNCACHED_PHYS_0
27
28/*
29 * Intel PXA2xx internal register mapping:
30 *
31 * 0x40000000 - 0x41ffffff <--> 0xf2000000 - 0xf3ffffff
32 * 0x44000000 - 0x45ffffff <--> 0xf4000000 - 0xf5ffffff
33 * 0x48000000 - 0x49ffffff <--> 0xf6000000 - 0xf7ffffff
34 * 0x4c000000 - 0x4dffffff <--> 0xf8000000 - 0xf9ffffff
35 * 0x50000000 - 0x51ffffff <--> 0xfa000000 - 0xfbffffff
36 * 0x54000000 - 0x55ffffff <--> 0xfc000000 - 0xfdffffff
37 * 0x58000000 - 0x59ffffff <--> 0xfe000000 - 0xffffffff
38 *
39 * Note that not all PXA2xx chips implement all those addresses, and the
40 * kernel only maps the minimum needed range of this mapping.
41 */
42#define io_p2v(x) (0xf2000000 + ((x) & 0x01ffffff) + (((x) & 0x1c000000) >> 1))
43#define io_v2p(x) (0x3c000000 + ((x) & 0x01ffffff) + (((x) & 0x0e000000) << 1))
44
45#ifndef __ASSEMBLY__
46
47# define __REG(x) (*((volatile u32 *)io_p2v(x)))
48
49/* With indexed regs we don't want to feed the index through io_p2v()
50 especially if it is a variable, otherwise horrible code will result. */
51# define __REG2(x,y) \
52 (*(volatile u32 *)((u32)&__REG(x) + (y)))
53
54# define __PREG(x) (io_v2p((u32)&(x)))
55
56#else
57
58# define __REG(x) io_p2v(x)
59# define __PREG(x) io_v2p(x)
60
61#endif
62
63#ifndef __ASSEMBLY__
64
65#ifdef CONFIG_PXA25x
66#define __cpu_is_pxa21x(id) \
67 ({ \
68 unsigned int _id = (id) >> 4 & 0xf3f; \
69 _id == 0x212; \
70 })
71
72#define __cpu_is_pxa255(id) \
73 ({ \
74 unsigned int _id = (id) >> 4 & 0xfff; \
75 _id == 0x2d0; \
76 })
77
78#define __cpu_is_pxa25x(id) \
79 ({ \
80 unsigned int _id = (id) >> 4 & 0xfff; \
81 _id == 0x2d0 || _id == 0x290; \
82 })
83#else
84#define __cpu_is_pxa21x(id) (0)
85#define __cpu_is_pxa255(id) (0)
86#define __cpu_is_pxa25x(id) (0)
87#endif
88
89#ifdef CONFIG_PXA27x
90#define __cpu_is_pxa27x(id) \
91 ({ \
92 unsigned int _id = (id) >> 4 & 0xfff; \
93 _id == 0x411; \
94 })
95#else
96#define __cpu_is_pxa27x(id) (0)
97#endif
98
99#ifdef CONFIG_CPU_PXA300
100#define __cpu_is_pxa300(id) \
101 ({ \
102 unsigned int _id = (id) >> 4 & 0xfff; \
103 _id == 0x688; \
104 })
105#else
106#define __cpu_is_pxa300(id) (0)
107#endif
108
109#ifdef CONFIG_CPU_PXA310
110#define __cpu_is_pxa310(id) \
111 ({ \
112 unsigned int _id = (id) >> 4 & 0xfff; \
113 _id == 0x689; \
114 })
115#else
116#define __cpu_is_pxa310(id) (0)
117#endif
118
119#ifdef CONFIG_CPU_PXA320
120#define __cpu_is_pxa320(id) \
121 ({ \
122 unsigned int _id = (id) >> 4 & 0xfff; \
123 _id == 0x603 || _id == 0x682; \
124 })
125#else
126#define __cpu_is_pxa320(id) (0)
127#endif
128
129#ifdef CONFIG_CPU_PXA930
130#define __cpu_is_pxa930(id) \
131 ({ \
132 unsigned int _id = (id) >> 4 & 0xfff; \
133 _id == 0x683; \
134 })
135#else
136#define __cpu_is_pxa930(id) (0)
137#endif
138
139#define cpu_is_pxa21x() \
140 ({ \
141 __cpu_is_pxa21x(read_cpuid_id()); \
142 })
143
144#define cpu_is_pxa255() \
145 ({ \
146 __cpu_is_pxa255(read_cpuid_id()); \
147 })
148
149#define cpu_is_pxa25x() \
150 ({ \
151 __cpu_is_pxa25x(read_cpuid_id()); \
152 })
153
154#define cpu_is_pxa27x() \
155 ({ \
156 __cpu_is_pxa27x(read_cpuid_id()); \
157 })
158
159#define cpu_is_pxa300() \
160 ({ \
161 __cpu_is_pxa300(read_cpuid_id()); \
162 })
163
164#define cpu_is_pxa310() \
165 ({ \
166 __cpu_is_pxa310(read_cpuid_id()); \
167 })
168
169#define cpu_is_pxa320() \
170 ({ \
171 __cpu_is_pxa320(read_cpuid_id()); \
172 })
173
174#define cpu_is_pxa930() \
175 ({ \
176 unsigned int id = read_cpuid(CPUID_ID); \
177 __cpu_is_pxa930(id); \
178 })
179
180/*
181 * CPUID Core Generation Bit
182 * <= 0x2 for pxa21x/pxa25x/pxa26x/pxa27x
183 * == 0x3 for pxa300/pxa310/pxa320
184 */
185#define __cpu_is_pxa2xx(id) \
186 ({ \
187 unsigned int _id = (id) >> 13 & 0x7; \
188 _id <= 0x2; \
189 })
190
191#define __cpu_is_pxa3xx(id) \
192 ({ \
193 unsigned int _id = (id) >> 13 & 0x7; \
194 _id == 0x3; \
195 })
196
197#define cpu_is_pxa2xx() \
198 ({ \
199 __cpu_is_pxa2xx(read_cpuid_id()); \
200 })
201
202#define cpu_is_pxa3xx() \
203 ({ \
204 __cpu_is_pxa3xx(read_cpuid_id()); \
205 })
206
207/*
208 * Handy routine to set GPIO alternate functions
209 */
210extern int pxa_gpio_mode( int gpio_mode );
211
212/*
213 * Return GPIO level, nonzero means high, zero is low
214 */
215extern int pxa_gpio_get_value(unsigned gpio);
216
217/*
218 * Set output GPIO level
219 */
220extern void pxa_gpio_set_value(unsigned gpio, int value);
221
222/*
223 * return current memory and LCD clock frequency in units of 10kHz
224 */
225extern unsigned int get_memclk_frequency_10khz(void);
226
227#endif
228
229#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
230#define PCIBIOS_MIN_IO 0
231#define PCIBIOS_MIN_MEM 0
232#define pcibios_assign_all_busses() 1
233#endif
234
235#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-pxa/include/mach/i2c.h b/arch/arm/mach-pxa/include/mach/i2c.h
new file mode 100644
index 000000000000..80596b013443
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/i2c.h
@@ -0,0 +1,77 @@
1/*
2 * i2c_pxa.h
3 *
4 * Copyright (C) 2002 Intrinsyc Software Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11#ifndef _I2C_PXA_H_
12#define _I2C_PXA_H_
13
14#if 0
15#define DEF_TIMEOUT 3
16#else
17/* need a longer timeout if we're dealing with the fact we may well be
18 * looking at a multi-master environment
19*/
20#define DEF_TIMEOUT 32
21#endif
22
23#define BUS_ERROR (-EREMOTEIO)
24#define XFER_NAKED (-ECONNREFUSED)
25#define I2C_RETRY (-2000) /* an error has occurred retry transmit */
26
27/* ICR initialize bit values
28*
29* 15. FM 0 (100 Khz operation)
30* 14. UR 0 (No unit reset)
31* 13. SADIE 0 (Disables the unit from interrupting on slave addresses
32* matching its slave address)
33* 12. ALDIE 0 (Disables the unit from interrupt when it loses arbitration
34* in master mode)
35* 11. SSDIE 0 (Disables interrupts from a slave stop detected, in slave mode)
36* 10. BEIE 1 (Enable interrupts from detected bus errors, no ACK sent)
37* 9. IRFIE 1 (Enable interrupts from full buffer received)
38* 8. ITEIE 1 (Enables the I2C unit to interrupt when transmit buffer empty)
39* 7. GCD 1 (Disables i2c unit response to general call messages as a slave)
40* 6. IUE 0 (Disable unit until we change settings)
41* 5. SCLE 1 (Enables the i2c clock output for master mode (drives SCL)
42* 4. MA 0 (Only send stop with the ICR stop bit)
43* 3. TB 0 (We are not transmitting a byte initially)
44* 2. ACKNAK 0 (Send an ACK after the unit receives a byte)
45* 1. STOP 0 (Do not send a STOP)
46* 0. START 0 (Do not send a START)
47*
48*/
49#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE)
50
51/* I2C status register init values
52 *
53 * 10. BED 1 (Clear bus error detected)
54 * 9. SAD 1 (Clear slave address detected)
55 * 7. IRF 1 (Clear IDBR Receive Full)
56 * 6. ITE 1 (Clear IDBR Transmit Empty)
57 * 5. ALD 1 (Clear Arbitration Loss Detected)
58 * 4. SSD 1 (Clear Slave Stop Detected)
59 */
60#define I2C_ISR_INIT 0x7FF /* status register init */
61
62struct i2c_slave_client;
63
64struct i2c_pxa_platform_data {
65 unsigned int slave_addr;
66 struct i2c_slave_client *slave;
67 unsigned int class;
68 int use_pio;
69};
70
71extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
72
73#ifdef CONFIG_PXA27x
74extern void pxa_set_i2c_power_info(struct i2c_pxa_platform_data *info);
75#endif
76
77#endif
diff --git a/arch/arm/mach-pxa/include/mach/idp.h b/arch/arm/mach-pxa/include/mach/idp.h
new file mode 100644
index 000000000000..5eff96fcc944
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/idp.h
@@ -0,0 +1,199 @@
1/*
2 * arch/arm/mach-pxa/include/mach/idp.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Copyright (c) 2001 Cliff Brake, Accelent Systems Inc.
9 *
10 * 2001-09-13: Cliff Brake <cbrake@accelent.com>
11 * Initial code
12 *
13 * 2005-02-15: Cliff Brake <cliff.brake@gmail.com>
14 * <http://www.vibren.com> <http://bec-systems.com>
15 * Changes for 2.6 kernel.
16 */
17
18
19/*
20 * Note: this file must be safe to include in assembly files
21 *
22 * Support for the Vibren PXA255 IDP requires rev04 or later
23 * IDP hardware.
24 */
25
26
27#define IDP_FLASH_PHYS (PXA_CS0_PHYS)
28#define IDP_ALT_FLASH_PHYS (PXA_CS1_PHYS)
29#define IDP_MEDIAQ_PHYS (PXA_CS3_PHYS)
30#define IDP_IDE_PHYS (PXA_CS5_PHYS + 0x03000000)
31#define IDP_ETH_PHYS (PXA_CS5_PHYS + 0x03400000)
32#define IDP_COREVOLT_PHYS (PXA_CS5_PHYS + 0x03800000)
33#define IDP_CPLD_PHYS (PXA_CS5_PHYS + 0x03C00000)
34
35
36/*
37 * virtual memory map
38 */
39
40#define IDP_COREVOLT_VIRT (0xf0000000)
41#define IDP_COREVOLT_SIZE (1*1024*1024)
42
43#define IDP_CPLD_VIRT (IDP_COREVOLT_VIRT + IDP_COREVOLT_SIZE)
44#define IDP_CPLD_SIZE (1*1024*1024)
45
46#if (IDP_CPLD_VIRT + IDP_CPLD_SIZE) > 0xfc000000
47#error Your custom IO space is getting a bit large !!
48#endif
49
50#define CPLD_P2V(x) ((x) - IDP_CPLD_PHYS + IDP_CPLD_VIRT)
51#define CPLD_V2P(x) ((x) - IDP_CPLD_VIRT + IDP_CPLD_PHYS)
52
53#ifndef __ASSEMBLY__
54# define __CPLD_REG(x) (*((volatile unsigned long *)CPLD_P2V(x)))
55#else
56# define __CPLD_REG(x) CPLD_P2V(x)
57#endif
58
59/* board level registers in the CPLD: (offsets from CPLD_VIRT) */
60
61#define _IDP_CPLD_REV (IDP_CPLD_PHYS + 0x00)
62#define _IDP_CPLD_PERIPH_PWR (IDP_CPLD_PHYS + 0x04)
63#define _IDP_CPLD_LED_CONTROL (IDP_CPLD_PHYS + 0x08)
64#define _IDP_CPLD_KB_COL_HIGH (IDP_CPLD_PHYS + 0x0C)
65#define _IDP_CPLD_KB_COL_LOW (IDP_CPLD_PHYS + 0x10)
66#define _IDP_CPLD_PCCARD_EN (IDP_CPLD_PHYS + 0x14)
67#define _IDP_CPLD_GPIOH_DIR (IDP_CPLD_PHYS + 0x18)
68#define _IDP_CPLD_GPIOH_VALUE (IDP_CPLD_PHYS + 0x1C)
69#define _IDP_CPLD_GPIOL_DIR (IDP_CPLD_PHYS + 0x20)
70#define _IDP_CPLD_GPIOL_VALUE (IDP_CPLD_PHYS + 0x24)
71#define _IDP_CPLD_PCCARD_PWR (IDP_CPLD_PHYS + 0x28)
72#define _IDP_CPLD_MISC_CTRL (IDP_CPLD_PHYS + 0x2C)
73#define _IDP_CPLD_LCD (IDP_CPLD_PHYS + 0x30)
74#define _IDP_CPLD_FLASH_WE (IDP_CPLD_PHYS + 0x34)
75
76#define _IDP_CPLD_KB_ROW (IDP_CPLD_PHYS + 0x50)
77#define _IDP_CPLD_PCCARD0_STATUS (IDP_CPLD_PHYS + 0x54)
78#define _IDP_CPLD_PCCARD1_STATUS (IDP_CPLD_PHYS + 0x58)
79#define _IDP_CPLD_MISC_STATUS (IDP_CPLD_PHYS + 0x5C)
80
81/* FPGA register virtual addresses */
82
83#define IDP_CPLD_REV __CPLD_REG(_IDP_CPLD_REV)
84#define IDP_CPLD_PERIPH_PWR __CPLD_REG(_IDP_CPLD_PERIPH_PWR)
85#define IDP_CPLD_LED_CONTROL __CPLD_REG(_IDP_CPLD_LED_CONTROL)
86#define IDP_CPLD_KB_COL_HIGH __CPLD_REG(_IDP_CPLD_KB_COL_HIGH)
87#define IDP_CPLD_KB_COL_LOW __CPLD_REG(_IDP_CPLD_KB_COL_LOW)
88#define IDP_CPLD_PCCARD_EN __CPLD_REG(_IDP_CPLD_PCCARD_EN)
89#define IDP_CPLD_GPIOH_DIR __CPLD_REG(_IDP_CPLD_GPIOH_DIR)
90#define IDP_CPLD_GPIOH_VALUE __CPLD_REG(_IDP_CPLD_GPIOH_VALUE)
91#define IDP_CPLD_GPIOL_DIR __CPLD_REG(_IDP_CPLD_GPIOL_DIR)
92#define IDP_CPLD_GPIOL_VALUE __CPLD_REG(_IDP_CPLD_GPIOL_VALUE)
93#define IDP_CPLD_PCCARD_PWR __CPLD_REG(_IDP_CPLD_PCCARD_PWR)
94#define IDP_CPLD_MISC_CTRL __CPLD_REG(_IDP_CPLD_MISC_CTRL)
95#define IDP_CPLD_LCD __CPLD_REG(_IDP_CPLD_LCD)
96#define IDP_CPLD_FLASH_WE __CPLD_REG(_IDP_CPLD_FLASH_WE)
97
98#define IDP_CPLD_KB_ROW __CPLD_REG(_IDP_CPLD_KB_ROW)
99#define IDP_CPLD_PCCARD0_STATUS __CPLD_REG(_IDP_CPLD_PCCARD0_STATUS)
100#define IDP_CPLD_PCCARD1_STATUS __CPLD_REG(_IDP_CPLD_PCCARD1_STATUS)
101#define IDP_CPLD_MISC_STATUS __CPLD_REG(_IDP_CPLD_MISC_STATUS)
102
103
104/*
105 * Bit masks for various registers
106 */
107
108// IDP_CPLD_PCCARD_PWR
109#define PCC0_PWR0 (1 << 0)
110#define PCC0_PWR1 (1 << 1)
111#define PCC0_PWR2 (1 << 2)
112#define PCC0_PWR3 (1 << 3)
113#define PCC1_PWR0 (1 << 4)
114#define PCC1_PWR1 (1 << 5)
115#define PCC1_PWR2 (1 << 6)
116#define PCC1_PWR3 (1 << 7)
117
118// IDP_CPLD_PCCARD_EN
119#define PCC0_RESET (1 << 6)
120#define PCC1_RESET (1 << 7)
121#define PCC0_ENABLE (1 << 0)
122#define PCC1_ENABLE (1 << 1)
123
124// IDP_CPLD_PCCARDx_STATUS
125#define _PCC_WRPROT (1 << 7) // 7-4 read as low true
126#define _PCC_RESET (1 << 6)
127#define _PCC_IRQ (1 << 5)
128#define _PCC_INPACK (1 << 4)
129#define PCC_BVD2 (1 << 3)
130#define PCC_BVD1 (1 << 2)
131#define PCC_VS2 (1 << 1)
132#define PCC_VS1 (1 << 0)
133
134#define PCC_DETECT(x) (GPLR(7 + (x)) & GPIO_bit(7 + (x)))
135
136/* A listing of interrupts used by external hardware devices */
137
138#define TOUCH_PANEL_IRQ IRQ_GPIO(5)
139#define IDE_IRQ IRQ_GPIO(21)
140
141#define TOUCH_PANEL_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
142
143#define ETHERNET_IRQ IRQ_GPIO(4)
144#define ETHERNET_IRQ_EDGE IRQ_TYPE_EDGE_RISING
145
146#define IDE_IRQ_EDGE IRQ_TYPE_EDGE_RISING
147
148#define PCMCIA_S0_CD_VALID IRQ_GPIO(7)
149#define PCMCIA_S0_CD_VALID_EDGE IRQ_TYPE_EDGE_BOTH
150
151#define PCMCIA_S1_CD_VALID IRQ_GPIO(8)
152#define PCMCIA_S1_CD_VALID_EDGE IRQ_TYPE_EDGE_BOTH
153
154#define PCMCIA_S0_RDYINT IRQ_GPIO(19)
155#define PCMCIA_S1_RDYINT IRQ_GPIO(22)
156
157
158/*
159 * Macros for LED Driver
160 */
161
162/* leds 0 = ON */
163#define IDP_HB_LED (1<<5)
164#define IDP_BUSY_LED (1<<6)
165
166#define IDP_LEDS_MASK (IDP_HB_LED | IDP_BUSY_LED)
167
168/*
169 * macros for MTD driver
170 */
171
172#define FLASH_WRITE_PROTECT_DISABLE() ((IDP_CPLD_FLASH_WE) &= ~(0x1))
173#define FLASH_WRITE_PROTECT_ENABLE() ((IDP_CPLD_FLASH_WE) |= (0x1))
174
175/*
176 * macros for matrix keyboard driver
177 */
178
179#define KEYBD_MATRIX_NUMBER_INPUTS 7
180#define KEYBD_MATRIX_NUMBER_OUTPUTS 14
181
182#define KEYBD_MATRIX_INVERT_OUTPUT_LOGIC FALSE
183#define KEYBD_MATRIX_INVERT_INPUT_LOGIC FALSE
184
185#define KEYBD_MATRIX_SETTLING_TIME_US 100
186#define KEYBD_MATRIX_KEYSTATE_DEBOUNCE_CONSTANT 2
187
188#define KEYBD_MATRIX_SET_OUTPUTS(outputs) \
189{\
190 IDP_CPLD_KB_COL_LOW = outputs;\
191 IDP_CPLD_KB_COL_HIGH = outputs >> 7;\
192}
193
194#define KEYBD_MATRIX_GET_INPUTS(inputs) \
195{\
196 inputs = (IDP_CPLD_KB_ROW & 0x7f);\
197}
198
199
diff --git a/arch/arm/mach-pxa/include/mach/io.h b/arch/arm/mach-pxa/include/mach/io.h
new file mode 100644
index 000000000000..600fd4f76603
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/io.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-pxa/include/mach/io.h
3 *
4 * Copied from asm/arch/sa1100/io.h
5 */
6#ifndef __ASM_ARM_ARCH_IO_H
7#define __ASM_ARM_ARCH_IO_H
8
9#include <mach/hardware.h>
10
11#define IO_SPACE_LIMIT 0xffffffff
12
13/*
14 * We don't actually have real ISA nor PCI buses, but there is so many
15 * drivers out there that might just work if we fake them...
16 */
17#define __io(a) ((void __iomem *)(a))
18#define __mem_pci(a) (a)
19
20#endif
diff --git a/arch/arm/mach-pxa/include/mach/irda.h b/arch/arm/mach-pxa/include/mach/irda.h
new file mode 100644
index 000000000000..0a50c3c763df
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/irda.h
@@ -0,0 +1,23 @@
1#ifndef ASMARM_ARCH_IRDA_H
2#define ASMARM_ARCH_IRDA_H
3
4/* board specific transceiver capabilities */
5
6#define IR_OFF 1
7#define IR_SIRMODE 2
8#define IR_FIRMODE 4
9
10struct pxaficp_platform_data {
11 int transceiver_cap;
12 void (*transceiver_mode)(struct device *dev, int mode);
13 int (*startup)(struct device *dev);
14 void (*shutdown)(struct device *dev);
15};
16
17extern void pxa_set_ficp_info(struct pxaficp_platform_data *info);
18
19#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
20void pxa2xx_transceiver_mode(struct device *dev, int mode);
21#endif
22
23#endif
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
new file mode 100644
index 000000000000..32772bc6925c
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -0,0 +1,264 @@
1/*
2 * arch/arm/mach-pxa/include/mach/irqs.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13
14#define PXA_IRQ(x) (x)
15
16#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
17#define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */
18#define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */
19#define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */
20#define IRQ_USBH1 PXA_IRQ(3) /* USB Host interrupt 2 (non-OHCI) */
21#define IRQ_KEYPAD PXA_IRQ(4) /* Key pad controller */
22#define IRQ_MEMSTK PXA_IRQ(5) /* Memory Stick interrupt */
23#define IRQ_PWRI2C PXA_IRQ(6) /* Power I2C interrupt */
24#endif
25
26#define IRQ_HWUART PXA_IRQ(7) /* HWUART Transmit/Receive/Error (PXA26x) */
27#define IRQ_OST_4_11 PXA_IRQ(7) /* OS timer 4-11 matches (PXA27x) */
28#define IRQ_GPIO0 PXA_IRQ(8) /* GPIO0 Edge Detect */
29#define IRQ_GPIO1 PXA_IRQ(9) /* GPIO1 Edge Detect */
30#define IRQ_GPIO_2_x PXA_IRQ(10) /* GPIO[2-x] Edge Detect */
31#define IRQ_USB PXA_IRQ(11) /* USB Service */
32#define IRQ_PMU PXA_IRQ(12) /* Performance Monitoring Unit */
33#define IRQ_I2S PXA_IRQ(13) /* I2S Interrupt */
34#define IRQ_AC97 PXA_IRQ(14) /* AC97 Interrupt */
35#define IRQ_ASSP PXA_IRQ(15) /* Audio SSP Service Request (PXA25x) */
36#define IRQ_USIM PXA_IRQ(15) /* Smart Card interface interrupt (PXA27x) */
37#define IRQ_NSSP PXA_IRQ(16) /* Network SSP Service Request (PXA25x) */
38#define IRQ_SSP2 PXA_IRQ(16) /* SSP2 interrupt (PXA27x) */
39#define IRQ_LCD PXA_IRQ(17) /* LCD Controller Service Request */
40#define IRQ_I2C PXA_IRQ(18) /* I2C Service Request */
41#define IRQ_ICP PXA_IRQ(19) /* ICP Transmit/Receive/Error */
42#define IRQ_STUART PXA_IRQ(20) /* STUART Transmit/Receive/Error */
43#define IRQ_BTUART PXA_IRQ(21) /* BTUART Transmit/Receive/Error */
44#define IRQ_FFUART PXA_IRQ(22) /* FFUART Transmit/Receive/Error*/
45#define IRQ_MMC PXA_IRQ(23) /* MMC Status/Error Detection */
46#define IRQ_SSP PXA_IRQ(24) /* SSP Service Request */
47#define IRQ_DMA PXA_IRQ(25) /* DMA Channel Service Request */
48#define IRQ_OST0 PXA_IRQ(26) /* OS Timer match 0 */
49#define IRQ_OST1 PXA_IRQ(27) /* OS Timer match 1 */
50#define IRQ_OST2 PXA_IRQ(28) /* OS Timer match 2 */
51#define IRQ_OST3 PXA_IRQ(29) /* OS Timer match 3 */
52#define IRQ_RTC1Hz PXA_IRQ(30) /* RTC HZ Clock Tick */
53#define IRQ_RTCAlrm PXA_IRQ(31) /* RTC Alarm */
54
55#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
56#define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */
57#define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */
58#endif
59
60#ifdef CONFIG_PXA3xx
61#define IRQ_SSP4 PXA_IRQ(13) /* SSP4 service request */
62#define IRQ_CIR PXA_IRQ(34) /* Consumer IR */
63#define IRQ_TSI PXA_IRQ(36) /* Touch Screen Interface (PXA320) */
64#define IRQ_USIM2 PXA_IRQ(38) /* USIM2 Controller */
65#define IRQ_GRPHICS PXA_IRQ(39) /* Graphics Controller */
66#define IRQ_MMC2 PXA_IRQ(41) /* MMC2 Controller */
67#define IRQ_1WIRE PXA_IRQ(44) /* 1-Wire Controller */
68#define IRQ_NAND PXA_IRQ(45) /* NAND Controller */
69#define IRQ_USB2 PXA_IRQ(46) /* USB 2.0 Device Controller */
70#define IRQ_WAKEUP0 PXA_IRQ(49) /* EXT_WAKEUP0 */
71#define IRQ_WAKEUP1 PXA_IRQ(50) /* EXT_WAKEUP1 */
72#define IRQ_DMEMC PXA_IRQ(51) /* Dynamic Memory Controller */
73#define IRQ_MMC3 PXA_IRQ(55) /* MMC3 Controller (PXA310) */
74#endif
75
76#define PXA_GPIO_IRQ_BASE (64)
77#define PXA_GPIO_IRQ_NUM (128)
78
79#define GPIO_2_x_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x))
80#define IRQ_GPIO(x) (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x))
81
82#define IRQ_TO_GPIO_2_x(i) ((i) - PXA_GPIO_IRQ_BASE)
83#define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i))
84
85/*
86 * The next 16 interrupts are for board specific purposes. Since
87 * the kernel can only run on one machine at a time, we can re-use
88 * these. If you need more, increase IRQ_BOARD_END, but keep it
89 * within sensible limits.
90 */
91#define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_GPIO_IRQ_NUM)
92#define IRQ_BOARD_END (IRQ_BOARD_START + 16)
93
94#define IRQ_SA1111_START (IRQ_BOARD_END)
95#define IRQ_GPAIN0 (IRQ_BOARD_END + 0)
96#define IRQ_GPAIN1 (IRQ_BOARD_END + 1)
97#define IRQ_GPAIN2 (IRQ_BOARD_END + 2)
98#define IRQ_GPAIN3 (IRQ_BOARD_END + 3)
99#define IRQ_GPBIN0 (IRQ_BOARD_END + 4)
100#define IRQ_GPBIN1 (IRQ_BOARD_END + 5)
101#define IRQ_GPBIN2 (IRQ_BOARD_END + 6)
102#define IRQ_GPBIN3 (IRQ_BOARD_END + 7)
103#define IRQ_GPBIN4 (IRQ_BOARD_END + 8)
104#define IRQ_GPBIN5 (IRQ_BOARD_END + 9)
105#define IRQ_GPCIN0 (IRQ_BOARD_END + 10)
106#define IRQ_GPCIN1 (IRQ_BOARD_END + 11)
107#define IRQ_GPCIN2 (IRQ_BOARD_END + 12)
108#define IRQ_GPCIN3 (IRQ_BOARD_END + 13)
109#define IRQ_GPCIN4 (IRQ_BOARD_END + 14)
110#define IRQ_GPCIN5 (IRQ_BOARD_END + 15)
111#define IRQ_GPCIN6 (IRQ_BOARD_END + 16)
112#define IRQ_GPCIN7 (IRQ_BOARD_END + 17)
113#define IRQ_MSTXINT (IRQ_BOARD_END + 18)
114#define IRQ_MSRXINT (IRQ_BOARD_END + 19)
115#define IRQ_MSSTOPERRINT (IRQ_BOARD_END + 20)
116#define IRQ_TPTXINT (IRQ_BOARD_END + 21)
117#define IRQ_TPRXINT (IRQ_BOARD_END + 22)
118#define IRQ_TPSTOPERRINT (IRQ_BOARD_END + 23)
119#define SSPXMTINT (IRQ_BOARD_END + 24)
120#define SSPRCVINT (IRQ_BOARD_END + 25)
121#define SSPROR (IRQ_BOARD_END + 26)
122#define AUDXMTDMADONEA (IRQ_BOARD_END + 32)
123#define AUDRCVDMADONEA (IRQ_BOARD_END + 33)
124#define AUDXMTDMADONEB (IRQ_BOARD_END + 34)
125#define AUDRCVDMADONEB (IRQ_BOARD_END + 35)
126#define AUDTFSR (IRQ_BOARD_END + 36)
127#define AUDRFSR (IRQ_BOARD_END + 37)
128#define AUDTUR (IRQ_BOARD_END + 38)
129#define AUDROR (IRQ_BOARD_END + 39)
130#define AUDDTS (IRQ_BOARD_END + 40)
131#define AUDRDD (IRQ_BOARD_END + 41)
132#define AUDSTO (IRQ_BOARD_END + 42)
133#define IRQ_USBPWR (IRQ_BOARD_END + 43)
134#define IRQ_HCIM (IRQ_BOARD_END + 44)
135#define IRQ_HCIBUFFACC (IRQ_BOARD_END + 45)
136#define IRQ_HCIRMTWKP (IRQ_BOARD_END + 46)
137#define IRQ_NHCIMFCIR (IRQ_BOARD_END + 47)
138#define IRQ_USB_PORT_RESUME (IRQ_BOARD_END + 48)
139#define IRQ_S0_READY_NINT (IRQ_BOARD_END + 49)
140#define IRQ_S1_READY_NINT (IRQ_BOARD_END + 50)
141#define IRQ_S0_CD_VALID (IRQ_BOARD_END + 51)
142#define IRQ_S1_CD_VALID (IRQ_BOARD_END + 52)
143#define IRQ_S0_BVD1_STSCHG (IRQ_BOARD_END + 53)
144#define IRQ_S1_BVD1_STSCHG (IRQ_BOARD_END + 54)
145
146#define IRQ_LOCOMO_START (IRQ_BOARD_END)
147#define IRQ_LOCOMO_KEY (IRQ_BOARD_END + 0)
148#define IRQ_LOCOMO_GPIO0 (IRQ_BOARD_END + 1)
149#define IRQ_LOCOMO_GPIO1 (IRQ_BOARD_END + 2)
150#define IRQ_LOCOMO_GPIO2 (IRQ_BOARD_END + 3)
151#define IRQ_LOCOMO_GPIO3 (IRQ_BOARD_END + 4)
152#define IRQ_LOCOMO_GPIO4 (IRQ_BOARD_END + 5)
153#define IRQ_LOCOMO_GPIO5 (IRQ_BOARD_END + 6)
154#define IRQ_LOCOMO_GPIO6 (IRQ_BOARD_END + 7)
155#define IRQ_LOCOMO_GPIO7 (IRQ_BOARD_END + 8)
156#define IRQ_LOCOMO_GPIO8 (IRQ_BOARD_END + 9)
157#define IRQ_LOCOMO_GPIO9 (IRQ_BOARD_END + 10)
158#define IRQ_LOCOMO_GPIO10 (IRQ_BOARD_END + 11)
159#define IRQ_LOCOMO_GPIO11 (IRQ_BOARD_END + 12)
160#define IRQ_LOCOMO_GPIO12 (IRQ_BOARD_END + 13)
161#define IRQ_LOCOMO_GPIO13 (IRQ_BOARD_END + 14)
162#define IRQ_LOCOMO_GPIO14 (IRQ_BOARD_END + 15)
163#define IRQ_LOCOMO_GPIO15 (IRQ_BOARD_END + 16)
164#define IRQ_LOCOMO_LT (IRQ_BOARD_END + 17)
165#define IRQ_LOCOMO_SPI_RFR (IRQ_BOARD_END + 18)
166#define IRQ_LOCOMO_SPI_RFW (IRQ_BOARD_END + 19)
167#define IRQ_LOCOMO_SPI_OVRN (IRQ_BOARD_END + 20)
168#define IRQ_LOCOMO_SPI_TEND (IRQ_BOARD_END + 21)
169
170/*
171 * Figure out the MAX IRQ number.
172 *
173 * If we have an SA1111, the max IRQ is S1_BVD1_STSCHG+1.
174 * If we have an LoCoMo, the max IRQ is IRQ_LOCOMO_SPI_TEND+1
175 * Otherwise, we have the standard IRQs only.
176 */
177#ifdef CONFIG_SA1111
178#define NR_IRQS (IRQ_S1_BVD1_STSCHG + 1)
179#elif defined(CONFIG_SHARP_LOCOMO)
180#define NR_IRQS (IRQ_LOCOMO_SPI_TEND + 1)
181#elif defined(CONFIG_ARCH_LUBBOCK) || \
182 defined(CONFIG_MACH_LOGICPD_PXA270) || \
183 defined(CONFIG_MACH_TOSA) || \
184 defined(CONFIG_MACH_MAINSTONE) || \
185 defined(CONFIG_MACH_PCM027) || \
186 defined(CONFIG_MACH_MAGICIAN)
187#define NR_IRQS (IRQ_BOARD_END)
188#elif defined(CONFIG_MACH_ZYLONITE)
189#define NR_IRQS (IRQ_BOARD_START + 32)
190#else
191#define NR_IRQS (IRQ_BOARD_START)
192#endif
193
194/*
195 * Board specific IRQs. Define them here.
196 * Do not surround them with ifdefs.
197 */
198#define LUBBOCK_IRQ(x) (IRQ_BOARD_START + (x))
199#define LUBBOCK_SD_IRQ LUBBOCK_IRQ(0)
200#define LUBBOCK_SA1111_IRQ LUBBOCK_IRQ(1)
201#define LUBBOCK_USB_IRQ LUBBOCK_IRQ(2) /* usb connect */
202#define LUBBOCK_ETH_IRQ LUBBOCK_IRQ(3)
203#define LUBBOCK_UCB1400_IRQ LUBBOCK_IRQ(4)
204#define LUBBOCK_BB_IRQ LUBBOCK_IRQ(5)
205#define LUBBOCK_USB_DISC_IRQ LUBBOCK_IRQ(6) /* usb disconnect */
206#define LUBBOCK_LAST_IRQ LUBBOCK_IRQ(6)
207
208#define LPD270_IRQ(x) (IRQ_BOARD_START + (x))
209#define LPD270_USBC_IRQ LPD270_IRQ(2)
210#define LPD270_ETHERNET_IRQ LPD270_IRQ(3)
211#define LPD270_AC97_IRQ LPD270_IRQ(4)
212
213#define MAINSTONE_IRQ(x) (IRQ_BOARD_START + (x))
214#define MAINSTONE_MMC_IRQ MAINSTONE_IRQ(0)
215#define MAINSTONE_USIM_IRQ MAINSTONE_IRQ(1)
216#define MAINSTONE_USBC_IRQ MAINSTONE_IRQ(2)
217#define MAINSTONE_ETHERNET_IRQ MAINSTONE_IRQ(3)
218#define MAINSTONE_AC97_IRQ MAINSTONE_IRQ(4)
219#define MAINSTONE_PEN_IRQ MAINSTONE_IRQ(5)
220#define MAINSTONE_MSINS_IRQ MAINSTONE_IRQ(6)
221#define MAINSTONE_EXBRD_IRQ MAINSTONE_IRQ(7)
222#define MAINSTONE_S0_CD_IRQ MAINSTONE_IRQ(9)
223#define MAINSTONE_S0_STSCHG_IRQ MAINSTONE_IRQ(10)
224#define MAINSTONE_S0_IRQ MAINSTONE_IRQ(11)
225#define MAINSTONE_S1_CD_IRQ MAINSTONE_IRQ(13)
226#define MAINSTONE_S1_STSCHG_IRQ MAINSTONE_IRQ(14)
227#define MAINSTONE_S1_IRQ MAINSTONE_IRQ(15)
228
229/* LoCoMo Interrupts (CONFIG_SHARP_LOCOMO) */
230#define IRQ_LOCOMO_KEY_BASE (IRQ_BOARD_START + 0)
231#define IRQ_LOCOMO_GPIO_BASE (IRQ_BOARD_START + 1)
232#define IRQ_LOCOMO_LT_BASE (IRQ_BOARD_START + 2)
233#define IRQ_LOCOMO_SPI_BASE (IRQ_BOARD_START + 3)
234
235/* phyCORE-PXA270 (PCM027) Interrupts */
236#define PCM027_IRQ(x) (IRQ_BOARD_START + (x))
237#define PCM027_BTDET_IRQ PCM027_IRQ(0)
238#define PCM027_FF_RI_IRQ PCM027_IRQ(1)
239#define PCM027_MMCDET_IRQ PCM027_IRQ(2)
240#define PCM027_PM_5V_IRQ PCM027_IRQ(3)
241
242/* ITE8152 irqs */
243/* add IT8152 IRQs beyond BOARD_END */
244#ifdef CONFIG_PCI_HOST_ITE8152
245#define IT8152_IRQ(x) (IRQ_BOARD_END + (x))
246
247/* IRQ-sources in 3 groups - local devices, LPC (serial), and external PCI */
248#define IT8152_LD_IRQ_COUNT 9
249#define IT8152_LP_IRQ_COUNT 16
250#define IT8152_PD_IRQ_COUNT 15
251
252/* Priorities: */
253#define IT8152_PD_IRQ(i) IT8152_IRQ(i)
254#define IT8152_LP_IRQ(i) (IT8152_IRQ(i) + IT8152_PD_IRQ_COUNT)
255#define IT8152_LD_IRQ(i) (IT8152_IRQ(i) + IT8152_PD_IRQ_COUNT + IT8152_LP_IRQ_COUNT)
256
257#define IT8152_LAST_IRQ IT8152_LD_IRQ(IT8152_LD_IRQ_COUNT - 1)
258
259#if NR_IRQS < (IT8152_LAST_IRQ+1)
260#undef NR_IRQS
261#define NR_IRQS (IT8152_LAST_IRQ+1)
262#endif
263
264#endif /* CONFIG_PCI_HOST_ITE8152 */
diff --git a/arch/arm/mach-pxa/include/mach/littleton.h b/arch/arm/mach-pxa/include/mach/littleton.h
new file mode 100644
index 000000000000..79d209b826f4
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/littleton.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_ARCH_ZYLONITE_H
2#define __ASM_ARCH_ZYLONITE_H
3
4#define LITTLETON_ETH_PHYS 0x30000000
5
6#endif /* __ASM_ARCH_ZYLONITE_H */
diff --git a/arch/arm/mach-pxa/include/mach/lpd270.h b/arch/arm/mach-pxa/include/mach/lpd270.h
new file mode 100644
index 000000000000..f89fb715266b
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/lpd270.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-pxa/include/mach/lpd270.h
3 *
4 * Author: Lennert Buytenhek
5 * Created: Feb 10, 2006
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_LPD270_H
13#define __ASM_ARCH_LPD270_H
14
15#define LPD270_CPLD_PHYS PXA_CS2_PHYS
16#define LPD270_CPLD_VIRT 0xf0000000
17#define LPD270_CPLD_SIZE 0x00100000
18
19#define LPD270_ETH_PHYS (PXA_CS2_PHYS + 0x01000000)
20
21/* CPLD registers */
22#define LPD270_CPLD_REG(x) ((unsigned long)(LPD270_CPLD_VIRT + (x)))
23#define LPD270_CONTROL LPD270_CPLD_REG(0x00)
24#define LPD270_PERIPHERAL0 LPD270_CPLD_REG(0x04)
25#define LPD270_PERIPHERAL1 LPD270_CPLD_REG(0x08)
26#define LPD270_CPLD_REVISION LPD270_CPLD_REG(0x14)
27#define LPD270_EEPROM_SPI_ITF LPD270_CPLD_REG(0x20)
28#define LPD270_MODE_PINS LPD270_CPLD_REG(0x24)
29#define LPD270_EGPIO LPD270_CPLD_REG(0x30)
30#define LPD270_INT_MASK LPD270_CPLD_REG(0x40)
31#define LPD270_INT_STATUS LPD270_CPLD_REG(0x50)
32
33#define LPD270_INT_AC97 (1 << 4) /* AC'97 CODEC IRQ */
34#define LPD270_INT_ETHERNET (1 << 3) /* Ethernet controller IRQ */
35#define LPD270_INT_USBC (1 << 2) /* USB client cable detection IRQ */
36
37
38#endif
diff --git a/arch/arm/mach-pxa/include/mach/lubbock.h b/arch/arm/mach-pxa/include/mach/lubbock.h
new file mode 100644
index 000000000000..4cb24154a5a8
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/lubbock.h
@@ -0,0 +1,40 @@
1/*
2 * arch/arm/mach-pxa/include/mach/lubbock.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#define LUBBOCK_ETH_PHYS PXA_CS3_PHYS
14
15#define LUBBOCK_FPGA_PHYS PXA_CS2_PHYS
16#define LUBBOCK_FPGA_VIRT (0xf0000000)
17#define LUB_P2V(x) ((x) - LUBBOCK_FPGA_PHYS + LUBBOCK_FPGA_VIRT)
18#define LUB_V2P(x) ((x) - LUBBOCK_FPGA_VIRT + LUBBOCK_FPGA_PHYS)
19
20#ifndef __ASSEMBLY__
21# define __LUB_REG(x) (*((volatile unsigned long *)LUB_P2V(x)))
22#else
23# define __LUB_REG(x) LUB_P2V(x)
24#endif
25
26/* FPGA register virtual addresses */
27#define LUB_WHOAMI __LUB_REG(LUBBOCK_FPGA_PHYS + 0x000)
28#define LUB_HEXLED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x010)
29#define LUB_DISC_BLNK_LED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x040)
30#define LUB_CONF_SWITCHES __LUB_REG(LUBBOCK_FPGA_PHYS + 0x050)
31#define LUB_USER_SWITCHES __LUB_REG(LUBBOCK_FPGA_PHYS + 0x060)
32#define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080)
33#define LUB_MISC_RD __LUB_REG(LUBBOCK_FPGA_PHYS + 0x090)
34#define LUB_IRQ_MASK_EN __LUB_REG(LUBBOCK_FPGA_PHYS + 0x0c0)
35#define LUB_IRQ_SET_CLR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x0d0)
36#define LUB_GP __LUB_REG(LUBBOCK_FPGA_PHYS + 0x100)
37
38#ifndef __ASSEMBLY__
39extern void lubbock_set_misc_wr(unsigned int mask, unsigned int set);
40#endif
diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
new file mode 100644
index 000000000000..38d68d99f585
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -0,0 +1,117 @@
1/*
2 * GPIO and IRQ definitions for HTC Magician PDA phones
3 *
4 * Copyright (c) 2007 Philipp Zabel
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#ifndef _MAGICIAN_H_
13#define _MAGICIAN_H_
14
15#include <mach/irqs.h>
16
17/*
18 * PXA GPIOs
19 */
20
21#define GPIO0_MAGICIAN_KEY_POWER 0
22#define GPIO9_MAGICIAN_UNKNOWN 9
23#define GPIO10_MAGICIAN_GSM_IRQ 10
24#define GPIO11_MAGICIAN_GSM_OUT1 11
25#define GPIO13_MAGICIAN_CPLD_IRQ 13
26#define GPIO18_MAGICIAN_UNKNOWN 18
27#define GPIO22_MAGICIAN_VIBRA_EN 22
28#define GPIO26_MAGICIAN_GSM_POWER 26
29#define GPIO27_MAGICIAN_USBC_PUEN 27
30#define GPIO30_MAGICIAN_nCHARGE_EN 30
31#define GPIO37_MAGICIAN_KEY_HANGUP 37
32#define GPIO38_MAGICIAN_KEY_CONTACTS 38
33#define GPIO40_MAGICIAN_GSM_OUT2 40
34#define GPIO48_MAGICIAN_UNKNOWN 48
35#define GPIO56_MAGICIAN_UNKNOWN 56
36#define GPIO57_MAGICIAN_CAM_RESET 57
37#define GPIO75_MAGICIAN_SAMSUNG_POWER 75
38#define GPIO83_MAGICIAN_nIR_EN 83
39#define GPIO86_MAGICIAN_GSM_RESET 86
40#define GPIO87_MAGICIAN_GSM_SELECT 87
41#define GPIO90_MAGICIAN_KEY_CALENDAR 90
42#define GPIO91_MAGICIAN_KEY_CAMERA 91
43#define GPIO93_MAGICIAN_KEY_UP 93
44#define GPIO94_MAGICIAN_KEY_DOWN 94
45#define GPIO95_MAGICIAN_KEY_LEFT 95
46#define GPIO96_MAGICIAN_KEY_RIGHT 96
47#define GPIO97_MAGICIAN_KEY_ENTER 97
48#define GPIO98_MAGICIAN_KEY_RECORD 98
49#define GPIO99_MAGICIAN_HEADPHONE_IN 99
50#define GPIO100_MAGICIAN_KEY_VOL_UP 100
51#define GPIO101_MAGICIAN_KEY_VOL_DOWN 101
52#define GPIO102_MAGICIAN_KEY_PHONE 102
53#define GPIO103_MAGICIAN_LED_KP 103
54#define GPIO104_MAGICIAN_LCD_POWER_1 104
55#define GPIO105_MAGICIAN_LCD_POWER_2 105
56#define GPIO106_MAGICIAN_LCD_POWER_3 106
57#define GPIO107_MAGICIAN_DS1WM_IRQ 107
58#define GPIO108_MAGICIAN_GSM_READY 108
59#define GPIO114_MAGICIAN_UNKNOWN 114
60#define GPIO115_MAGICIAN_nPEN_IRQ 115
61#define GPIO116_MAGICIAN_nCAM_EN 116
62#define GPIO119_MAGICIAN_UNKNOWN 119
63#define GPIO120_MAGICIAN_UNKNOWN 120
64
65/*
66 * CPLD IRQs
67 */
68
69#define IRQ_MAGICIAN_SD (IRQ_BOARD_START + 0)
70#define IRQ_MAGICIAN_EP (IRQ_BOARD_START + 1)
71#define IRQ_MAGICIAN_BT (IRQ_BOARD_START + 2)
72#define IRQ_MAGICIAN_AC (IRQ_BOARD_START + 3)
73
74/*
75 * CPLD EGPIOs
76 */
77
78#define MAGICIAN_EGPIO_BASE 0x80 /* GPIO_BOARD_START */
79#define MAGICIAN_EGPIO(reg,bit) \
80 (MAGICIAN_EGPIO_BASE + 8*reg + bit)
81
82/* output */
83
84#define EGPIO_MAGICIAN_TOPPOLY_POWER MAGICIAN_EGPIO(0, 2)
85#define EGPIO_MAGICIAN_LED_POWER MAGICIAN_EGPIO(0, 5)
86#define EGPIO_MAGICIAN_GSM_RESET MAGICIAN_EGPIO(0, 6)
87#define EGPIO_MAGICIAN_LCD_POWER MAGICIAN_EGPIO(0, 7)
88#define EGPIO_MAGICIAN_SPK_POWER MAGICIAN_EGPIO(1, 0)
89#define EGPIO_MAGICIAN_EP_POWER MAGICIAN_EGPIO(1, 1)
90#define EGPIO_MAGICIAN_IN_SEL0 MAGICIAN_EGPIO(1, 2)
91#define EGPIO_MAGICIAN_IN_SEL1 MAGICIAN_EGPIO(1, 3)
92#define EGPIO_MAGICIAN_MIC_POWER MAGICIAN_EGPIO(1, 4)
93#define EGPIO_MAGICIAN_CODEC_RESET MAGICIAN_EGPIO(1, 5)
94#define EGPIO_MAGICIAN_CODEC_POWER MAGICIAN_EGPIO(1, 6)
95#define EGPIO_MAGICIAN_BL_POWER MAGICIAN_EGPIO(1, 7)
96#define EGPIO_MAGICIAN_SD_POWER MAGICIAN_EGPIO(2, 0)
97#define EGPIO_MAGICIAN_CARKIT_MIC MAGICIAN_EGPIO(2, 1)
98#define EGPIO_MAGICIAN_UNKNOWN_WAVEDEV_DLL MAGICIAN_EGPIO(2, 2)
99#define EGPIO_MAGICIAN_FLASH_VPP MAGICIAN_EGPIO(2, 3)
100#define EGPIO_MAGICIAN_BL_POWER2 MAGICIAN_EGPIO(2, 4)
101#define EGPIO_MAGICIAN_CHARGE_EN MAGICIAN_EGPIO(2, 5)
102#define EGPIO_MAGICIAN_GSM_POWER MAGICIAN_EGPIO(2, 7)
103
104/* input */
105
106#define EGPIO_MAGICIAN_CABLE_STATE_AC MAGICIAN_EGPIO(4, 0)
107#define EGPIO_MAGICIAN_CABLE_STATE_USB MAGICIAN_EGPIO(4, 1)
108
109#define EGPIO_MAGICIAN_BOARD_ID0 MAGICIAN_EGPIO(5, 0)
110#define EGPIO_MAGICIAN_BOARD_ID1 MAGICIAN_EGPIO(5, 1)
111#define EGPIO_MAGICIAN_BOARD_ID2 MAGICIAN_EGPIO(5, 2)
112#define EGPIO_MAGICIAN_LCD_SELECT MAGICIAN_EGPIO(5, 3)
113#define EGPIO_MAGICIAN_nSD_READONLY MAGICIAN_EGPIO(5, 4)
114
115#define EGPIO_MAGICIAN_EP_INSERT MAGICIAN_EGPIO(6, 1)
116
117#endif /* _MAGICIAN_H_ */
diff --git a/arch/arm/mach-pxa/include/mach/mainstone.h b/arch/arm/mach-pxa/include/mach/mainstone.h
new file mode 100644
index 000000000000..3461c4302ff4
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mainstone.h
@@ -0,0 +1,120 @@
1/*
2 * arch/arm/mach-pxa/include/mach/mainstone.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Nov 14, 2002
6 * Copyright: MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef ASM_ARCH_MAINSTONE_H
14#define ASM_ARCH_MAINSTONE_H
15
16#define MST_ETH_PHYS PXA_CS4_PHYS
17
18#define MST_FPGA_PHYS PXA_CS2_PHYS
19#define MST_FPGA_VIRT (0xf0000000)
20#define MST_P2V(x) ((x) - MST_FPGA_PHYS + MST_FPGA_VIRT)
21#define MST_V2P(x) ((x) - MST_FPGA_VIRT + MST_FPGA_PHYS)
22
23#ifndef __ASSEMBLY__
24# define __MST_REG(x) (*((volatile unsigned long *)MST_P2V(x)))
25#else
26# define __MST_REG(x) MST_P2V(x)
27#endif
28
29/* board level registers in the FPGA */
30
31#define MST_LEDDAT1 __MST_REG(0x08000010)
32#define MST_LEDDAT2 __MST_REG(0x08000014)
33#define MST_LEDCTRL __MST_REG(0x08000040)
34#define MST_GPSWR __MST_REG(0x08000060)
35#define MST_MSCWR1 __MST_REG(0x08000080)
36#define MST_MSCWR2 __MST_REG(0x08000084)
37#define MST_MSCWR3 __MST_REG(0x08000088)
38#define MST_MSCRD __MST_REG(0x08000090)
39#define MST_INTMSKENA __MST_REG(0x080000c0)
40#define MST_INTSETCLR __MST_REG(0x080000d0)
41#define MST_PCMCIA0 __MST_REG(0x080000e0)
42#define MST_PCMCIA1 __MST_REG(0x080000e4)
43
44#define MST_MSCWR1_CAMERA_ON (1 << 15) /* Camera interface power control */
45#define MST_MSCWR1_CAMERA_SEL (1 << 14) /* Camera interface mux control */
46#define MST_MSCWR1_LCD_CTL (1 << 13) /* General-purpose LCD control */
47#define MST_MSCWR1_MS_ON (1 << 12) /* Memory Stick power control */
48#define MST_MSCWR1_MMC_ON (1 << 11) /* MultiMediaCard* power control */
49#define MST_MSCWR1_MS_SEL (1 << 10) /* SD/MS multiplexer control */
50#define MST_MSCWR1_BB_SEL (1 << 9) /* PCMCIA/Baseband multiplexer */
51#define MST_MSCWR1_BT_ON (1 << 8) /* Bluetooth UART transceiver */
52#define MST_MSCWR1_BTDTR (1 << 7) /* Bluetooth UART DTR */
53
54#define MST_MSCWR1_IRDA_MASK (3 << 5) /* IrDA transceiver mode */
55#define MST_MSCWR1_IRDA_FULL (0 << 5) /* full distance power */
56#define MST_MSCWR1_IRDA_OFF (1 << 5) /* shutdown */
57#define MST_MSCWR1_IRDA_MED (2 << 5) /* 2/3 distance power */
58#define MST_MSCWR1_IRDA_LOW (3 << 5) /* 1/3 distance power */
59
60#define MST_MSCWR1_IRDA_FIR (1 << 4) /* IrDA transceiver SIR/FIR */
61#define MST_MSCWR1_GREENLED (1 << 3) /* LED D1 control */
62#define MST_MSCWR1_PDC_CTL (1 << 2) /* reserved */
63#define MST_MSCWR1_MTR_ON (1 << 1) /* Silent alert motor */
64#define MST_MSCWR1_SYSRESET (1 << 0) /* System reset */
65
66#define MST_MSCWR2_USB_OTG_RST (1 << 6) /* USB On The Go reset */
67#define MST_MSCWR2_USB_OTG_SEL (1 << 5) /* USB On The Go control */
68#define MST_MSCWR2_nUSBC_SC (1 << 4) /* USB client soft connect control */
69#define MST_MSCWR2_I2S_SPKROFF (1 << 3) /* I2S CODEC amplifier control */
70#define MST_MSCWR2_AC97_SPKROFF (1 << 2) /* AC97 CODEC amplifier control */
71#define MST_MSCWR2_RADIO_PWR (1 << 1) /* Radio module power control */
72#define MST_MSCWR2_RADIO_WAKE (1 << 0) /* Radio module wake-up signal */
73
74#define MST_MSCWR3_GPIO_RESET_EN (1 << 2) /* Enable GPIO Reset */
75#define MST_MSCWR3_GPIO_RESET (1 << 1) /* Initiate a GPIO Reset */
76#define MST_MSCWR3_COMMS_SW_RESET (1 << 0) /* Communications Processor Reset Control */
77
78#define MST_MSCRD_nPENIRQ (1 << 9) /* ADI7873* nPENIRQ signal */
79#define MST_MSCRD_nMEMSTK_CD (1 << 8) /* Memory Stick detection signal */
80#define MST_MSCRD_nMMC_CD (1 << 7) /* SD/MMC card detection signal */
81#define MST_MSCRD_nUSIM_CD (1 << 6) /* USIM card detection signal */
82#define MST_MSCRD_USB_CBL (1 << 5) /* USB client cable status */
83#define MST_MSCRD_TS_BUSY (1 << 4) /* ADI7873 busy */
84#define MST_MSCRD_BTDSR (1 << 3) /* Bluetooth UART DSR */
85#define MST_MSCRD_BTRI (1 << 2) /* Bluetooth UART Ring Indicator */
86#define MST_MSCRD_BTDCD (1 << 1) /* Bluetooth UART DCD */
87#define MST_MSCRD_nMMC_WP (1 << 0) /* SD/MMC write-protect status */
88
89#define MST_INT_S1_IRQ (1 << 15) /* PCMCIA socket 1 IRQ */
90#define MST_INT_S1_STSCHG (1 << 14) /* PCMCIA socket 1 status changed */
91#define MST_INT_S1_CD (1 << 13) /* PCMCIA socket 1 card detection */
92#define MST_INT_S0_IRQ (1 << 11) /* PCMCIA socket 0 IRQ */
93#define MST_INT_S0_STSCHG (1 << 10) /* PCMCIA socket 0 status changed */
94#define MST_INT_S0_CD (1 << 9) /* PCMCIA socket 0 card detection */
95#define MST_INT_nEXBRD_INT (1 << 7) /* Expansion board IRQ */
96#define MST_INT_MSINS (1 << 6) /* Memory Stick* detection */
97#define MST_INT_PENIRQ (1 << 5) /* ADI7873* touch-screen IRQ */
98#define MST_INT_AC97 (1 << 4) /* AC'97 CODEC IRQ */
99#define MST_INT_ETHERNET (1 << 3) /* Ethernet controller IRQ */
100#define MST_INT_USBC (1 << 2) /* USB client cable detection IRQ */
101#define MST_INT_USIM (1 << 1) /* USIM card detection IRQ */
102#define MST_INT_MMC (1 << 0) /* MMC/SD card detection IRQ */
103
104#define MST_PCMCIA_nIRQ (1 << 10) /* IRQ / ready signal */
105#define MST_PCMCIA_nSPKR_BVD2 (1 << 9) /* VDD sense / digital speaker */
106#define MST_PCMCIA_nSTSCHG_BVD1 (1 << 8) /* VDD sense / card status changed */
107#define MST_PCMCIA_nVS2 (1 << 7) /* VSS voltage sense */
108#define MST_PCMCIA_nVS1 (1 << 6) /* VSS voltage sense */
109#define MST_PCMCIA_nCD (1 << 5) /* Card detection signal */
110#define MST_PCMCIA_RESET (1 << 4) /* Card reset signal */
111#define MST_PCMCIA_PWR_MASK (0x000f) /* MAX1602 power-supply controls */
112
113#define MST_PCMCIA_PWR_VPP_0 0x0 /* voltage VPP = 0V */
114#define MST_PCMCIA_PWR_VPP_120 0x2 /* voltage VPP = 12V*/
115#define MST_PCMCIA_PWR_VPP_VCC 0x1 /* voltage VPP = VCC */
116#define MST_PCMCIA_PWR_VCC_0 0x0 /* voltage VCC = 0V */
117#define MST_PCMCIA_PWR_VCC_33 0x8 /* voltage VCC = 3.3V */
118#define MST_PCMCIA_PWR_VCC_50 0x4 /* voltage VCC = 5.0V */
119
120#endif
diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h
new file mode 100644
index 000000000000..552eb7fa6579
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/memory.h
@@ -0,0 +1,52 @@
1/*
2 * arch/arm/mach-pxa/include/mach/memory.h
3 *
4 * Author: Nicolas Pitre
5 * Copyright: (C) 2001 MontaVista Software Inc.
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_MEMORY_H
13#define __ASM_ARCH_MEMORY_H
14
15/*
16 * Physical DRAM offset.
17 */
18#define PHYS_OFFSET UL(0xa0000000)
19
20/*
21 * Virtual view <-> DMA view memory address translations
22 * virt_to_bus: Used to translate the virtual address to an
23 * address suitable to be passed to set_dma_addr
24 * bus_to_virt: Used to convert an address for DMA operations
25 * to an address that the kernel can use.
26 */
27#define __virt_to_bus(x) __virt_to_phys(x)
28#define __bus_to_virt(x) __phys_to_virt(x)
29
30/*
31 * The nodes are matched with the physical SDRAM banks as follows:
32 *
33 * node 0: 0xa0000000-0xa3ffffff --> 0xc0000000-0xc3ffffff
34 * node 1: 0xa4000000-0xa7ffffff --> 0xc4000000-0xc7ffffff
35 * node 2: 0xa8000000-0xabffffff --> 0xc8000000-0xcbffffff
36 * node 3: 0xac000000-0xafffffff --> 0xcc000000-0xcfffffff
37 *
38 * This needs a node mem size of 26 bits.
39 */
40#define NODE_MEM_SIZE_BITS 26
41
42#if !defined(__ASSEMBLY__) && defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
43void cmx270_pci_adjust_zones(int node, unsigned long *size,
44 unsigned long *holes);
45
46#define arch_adjust_zones(node, size, holes) \
47 cmx270_pci_adjust_zones(node, size, holes)
48
49#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_64M - 1)
50#endif
51
52#endif
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h
new file mode 100644
index 000000000000..6c8e72238bfd
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h
@@ -0,0 +1,161 @@
1#ifndef __ASM_ARCH_MFP_PXA25X_H
2#define __ASM_ARCH_MFP_PXA25X_H
3
4#include <mach/mfp.h>
5#include <mach/mfp-pxa2xx.h>
6
7/* GPIO */
8#define GPIO2_GPIO MFP_CFG_IN(GPIO2, AF0)
9#define GPIO3_GPIO MFP_CFG_IN(GPIO3, AF0)
10#define GPIO4_GPIO MFP_CFG_IN(GPIO4, AF0)
11#define GPIO5_GPIO MFP_CFG_IN(GPIO5, AF0)
12#define GPIO6_GPIO MFP_CFG_IN(GPIO6, AF0)
13#define GPIO7_GPIO MFP_CFG_IN(GPIO7, AF0)
14#define GPIO8_GPIO MFP_CFG_IN(GPIO8, AF0)
15
16#define GPIO1_RST MFP_CFG_IN(GPIO1, AF1)
17
18/* Crystal and Clock Signals */
19#define GPIO10_RTCCLK MFP_CFG_OUT(GPIO10, AF1, DRIVE_LOW)
20#define GPIO70_RTC_CLK MFP_CFG_OUT(GPIO70, AF1, DRIVE_LOW)
21#define GPIO7_48MHz MFP_CFG_OUT(GPIO7, AF1, DRIVE_LOW)
22#define GPIO11_3_6MHz MFP_CFG_OUT(GPIO11, AF1, DRIVE_LOW)
23#define GPIO71_3_6MHz MFP_CFG_OUT(GPIO71, AF1, DRIVE_LOW)
24#define GPIO12_32KHz MFP_CFG_OUT(GPIO12, AF1, DRIVE_LOW)
25#define GPIO72_32kHz MFP_CFG_OUT(GPIO72, AF1, DRIVE_LOW)
26
27/* SDRAM and Static Memory I/O Signals */
28#define GPIO15_nCS_1 MFP_CFG_OUT(GPIO15, AF2, DRIVE_HIGH)
29#define GPIO78_nCS_2 MFP_CFG_OUT(GPIO78, AF2, DRIVE_HIGH)
30#define GPIO79_nCS_3 MFP_CFG_OUT(GPIO79, AF2, DRIVE_HIGH)
31#define GPIO80_nCS_4 MFP_CFG_OUT(GPIO80, AF2, DRIVE_HIGH)
32#define GPIO33_nCS_5 MFP_CFG_OUT(GPIO33, AF2, DRIVE_HIGH)
33
34/* Miscellaneous I/O and DMA Signals */
35#define GPIO18_RDY MFP_CFG_IN(GPIO18, AF1)
36#define GPIO20_DREQ_0 MFP_CFG_IN(GPIO20, AF1)
37#define GPIO19_DREQ_1 MFP_CFG_IN(GPIO19, AF1)
38
39/* Alternate Bus Master Mode I/O Signals */
40#define GPIO13_MBGNT MFP_CFG_OUT(GPIO13, AF2, DRIVE_LOW)
41#define GPIO73_MBGNT MFP_CFG_OUT(GPIO73, AF1, DRIVE_LOW)
42#define GPIO14_MBREQ MFP_CFG_IN(GPIO14, AF1)
43#define GPIO66_MBREQ MFP_CFG_IN(GPIO66, AF1)
44
45/* PC CARD */
46#define GPIO52_nPCE_1 MFP_CFG_OUT(GPIO52, AF2, DRIVE_HIGH)
47#define GPIO53_nPCE_2 MFP_CFG_OUT(GPIO53, AF2, DRIVE_HIGH)
48#define GPIO55_nPREG MFP_CFG_OUT(GPIO55, AF2, DRIVE_HIGH)
49#define GPIO50_nPIOR MFP_CFG_OUT(GPIO50, AF2, DRIVE_HIGH)
50#define GPIO51_nPIOW MFP_CFG_OUT(GPIO51, AF2, DRIVE_HIGH)
51#define GPIO49_nPWE MFP_CFG_OUT(GPIO49, AF2, DRIVE_HIGH)
52#define GPIO48_nPOE MFP_CFG_OUT(GPIO48, AF2, DRIVE_HIGH)
53#define GPIO57_nIOIS16 MFP_CFG_IN(GPIO57, AF1)
54#define GPIO56_nPWAIT MFP_CFG_IN(GPIO56, AF1)
55#define GPIO54_nPSKTSEL MFP_CFG_OUT(GPIO54, AF2, DRIVE_HIGH)
56
57/* FFUART */
58#define GPIO34_FFUART_RXD MFP_CFG_IN(GPIO34, AF1)
59#define GPIO35_FFUART_CTS MFP_CFG_IN(GPIO35, AF1)
60#define GPIO36_FFUART_DCD MFP_CFG_IN(GPIO36, AF1)
61#define GPIO37_FFUART_DSR MFP_CFG_IN(GPIO37, AF1)
62#define GPIO38_FFUART_RI MFP_CFG_IN(GPIO38, AF1)
63#define GPIO39_FFUART_TXD MFP_CFG_OUT(GPIO39, AF2, DRIVE_HIGH)
64#define GPIO40_FFUART_DTR MFP_CFG_OUT(GPIO40, AF2, DRIVE_HIGH)
65#define GPIO41_FFUART_RTS MFP_CFG_OUT(GPIO41, AF2, DRIVE_HIGH)
66
67/* BTUART */
68#define GPIO42_BTUART_RXD MFP_CFG_IN(GPIO42, AF1)
69#define GPIO43_BTUART_TXD MFP_CFG_OUT(GPIO43, AF2, DRIVE_HIGH)
70#define GPIO44_BTUART_CTS MFP_CFG_IN(GPIO44, AF1)
71#define GPIO45_BTUART_RTS MFP_CFG_OUT(GPIO45, AF2, DRIVE_HIGH)
72
73/* STUART */
74#define GPIO46_STUART_RXD MFP_CFG_IN(GPIO46, AF2)
75#define GPIO47_STUART_TXD MFP_CFG_OUT(GPIO47, AF1, DRIVE_HIGH)
76
77/* HWUART */
78#define GPIO42_HWUART_RXD MFP_CFG_IN(GPIO42, AF3)
79#define GPIO43_HWUART_TXD MFP_CFG_OUT(GPIO43, AF3, DRIVE_HIGH)
80#define GPIO44_HWUART_CTS MFP_CFG_IN(GPIO44, AF3)
81#define GPIO45_HWUART_RTS MFP_CFG_OUT(GPIO45, AF3, DRIVE_HIGH)
82#define GPIO48_HWUART_TXD MFP_CFG_OUT(GPIO48, AF1, DRIVE_HIGH)
83#define GPIO49_HWUART_RXD MFP_CFG_IN(GPIO49, AF1)
84#define GPIO50_HWUART_CTS MFP_CFG_IN(GPIO50, AF1)
85#define GPIO51_HWUART_RTS MFP_CFG_OUT(GPIO51, AF1, DRIVE_HIGH)
86
87/* FICP */
88#define GPIO46_FICP_RXD MFP_CFG_IN(GPIO46, AF1)
89#define GPIO47_FICP_TXD MFP_CFG_OUT(GPIO47, AF2, DRIVE_HIGH)
90
91/* PWM 0/1 */
92#define GPIO16_PWM0_OUT MFP_CFG_OUT(GPIO16, AF2, DRIVE_LOW)
93#define GPIO17_PWM1_OUT MFP_CFG_OUT(GPIO17, AF2, DRIVE_LOW)
94
95/* AC97 */
96#define GPIO28_AC97_BITCLK MFP_CFG_IN(GPIO28, AF1)
97#define GPIO29_AC97_SDATA_IN_0 MFP_CFG_IN(GPIO29, AF1)
98#define GPIO30_AC97_SDATA_OUT MFP_CFG_OUT(GPIO30, AF2, DRIVE_LOW)
99#define GPIO31_AC97_SYNC MFP_CFG_OUT(GPIO31, AF2, DRIVE_LOW)
100#define GPIO32_AC97_SDATA_IN_1 MFP_CFG_IN(GPIO32, AF1)
101
102/* I2S */
103#define GPIO28_I2S_BITCLK_IN MFP_CFG_IN(GPIO28, AF2)
104#define GPIO28_I2S_BITCLK_OUT MFP_CFG_OUT(GPIO28, AF1, DRIVE_LOW)
105#define GPIO29_I2S_SDATA_IN MFP_CFG_IN(GPIO29, AF2)
106#define GPIO30_I2S_SDATA_OUT MFP_CFG_OUT(GPIO30, AF1, DRIVE_LOW)
107#define GPIO31_I2S_SYNC MFP_CFG_OUT(GPIO31, AF1, DRIVE_LOW)
108#define GPIO32_I2S_SYSCLK MFP_CFG_OUT(GPIO32, AF1, DRIVE_LOW)
109
110/* SSP 1 */
111#define GPIO23_SSP1_SCLK MFP_CFG_OUT(GPIO23, AF2, DRIVE_LOW)
112#define GPIO24_SSP1_SFRM MFP_CFG_OUT(GPIO24, AF2, DRIVE_LOW)
113#define GPIO25_SSP1_TXD MFP_CFG_OUT(GPIO25, AF2, DRIVE_LOW)
114#define GPIO26_SSP1_RXD MFP_CFG_IN(GPIO26, AF1)
115#define GPIO27_SSP1_EXTCLK MFP_CFG_IN(GPIO27, AF1)
116
117/* SSP 2 - NSSP */
118#define GPIO81_SSP2_CLK_OUT MFP_CFG_OUT(GPIO81, AF1, DRIVE_LOW)
119#define GPIO81_SSP2_CLK_IN MFP_CFG_IN(GPIO81, AF1)
120#define GPIO82_SSP2_FRM_OUT MFP_CFG_OUT(GPIO82, AF1, DRIVE_LOW)
121#define GPIO82_SSP2_FRM_IN MFP_CFG_IN(GPIO82, AF1)
122#define GPIO83_SSP2_TXD MFP_CFG_OUT(GPIO83, AF1, DRIVE_LOW)
123#define GPIO83_SSP2_RXD MFP_CFG_IN(GPIO83, AF2)
124#define GPIO84_SSP2_TXD MFP_CFG_OUT(GPIO84, AF1, DRIVE_LOW)
125#define GPIO84_SSP2_RXD MFP_CFG_IN(GPIO84, AF2)
126
127/* MMC */
128#define GPIO6_MMC_CLK MFP_CFG_OUT(GPIO6, AF1, DRIVE_LOW)
129#define GPIO8_MMC_CS0 MFP_CFG_OUT(GPIO8, AF1, DRIVE_LOW)
130#define GPIO9_MMC_CS1 MFP_CFG_OUT(GPIO9, AF1, DRIVE_LOW)
131#define GPIO34_MMC_CS0 MFP_CFG_OUT(GPIO34, AF2, DRIVE_LOW)
132#define GPIO39_MMC_CS1 MFP_CFG_OUT(GPIO39, AF1, DRIVE_LOW)
133#define GPIO53_MMC_CLK MFP_CFG_OUT(GPIO53, AF1, DRIVE_LOW)
134#define GPIO54_MMC_CLK MFP_CFG_OUT(GPIO54, AF1, DRIVE_LOW)
135#define GPIO69_MMC_CLK MFP_CFG_OUT(GPIO69, AF1, DRIVE_LOW)
136#define GPIO67_MMC_CS0 MFP_CFG_OUT(GPIO67, AF1, DRIVE_LOW)
137#define GPIO68_MMC_CS1 MFP_CFG_OUT(GPIO68, AF1, DRIVE_LOW)
138
139/* LCD */
140#define GPIO58_LCD_LDD_0 MFP_CFG_OUT(GPIO58, AF2, DRIVE_LOW)
141#define GPIO59_LCD_LDD_1 MFP_CFG_OUT(GPIO59, AF2, DRIVE_LOW)
142#define GPIO60_LCD_LDD_2 MFP_CFG_OUT(GPIO60, AF2, DRIVE_LOW)
143#define GPIO61_LCD_LDD_3 MFP_CFG_OUT(GPIO61, AF2, DRIVE_LOW)
144#define GPIO62_LCD_LDD_4 MFP_CFG_OUT(GPIO62, AF2, DRIVE_LOW)
145#define GPIO63_LCD_LDD_5 MFP_CFG_OUT(GPIO63, AF2, DRIVE_LOW)
146#define GPIO64_LCD_LDD_6 MFP_CFG_OUT(GPIO64, AF2, DRIVE_LOW)
147#define GPIO65_LCD_LDD_7 MFP_CFG_OUT(GPIO65, AF2, DRIVE_LOW)
148#define GPIO66_LCD_LDD_8 MFP_CFG_OUT(GPIO66, AF2, DRIVE_LOW)
149#define GPIO67_LCD_LDD_9 MFP_CFG_OUT(GPIO67, AF2, DRIVE_LOW)
150#define GPIO68_LCD_LDD_10 MFP_CFG_OUT(GPIO68, AF2, DRIVE_LOW)
151#define GPIO69_LCD_LDD_11 MFP_CFG_OUT(GPIO69, AF2, DRIVE_LOW)
152#define GPIO70_LCD_LDD_12 MFP_CFG_OUT(GPIO70, AF2, DRIVE_LOW)
153#define GPIO71_LCD_LDD_13 MFP_CFG_OUT(GPIO71, AF2, DRIVE_LOW)
154#define GPIO72_LCD_LDD_14 MFP_CFG_OUT(GPIO72, AF2, DRIVE_LOW)
155#define GPIO73_LCD_LDD_15 MFP_CFG_OUT(GPIO73, AF2, DRIVE_LOW)
156#define GPIO74_LCD_FCLK MFP_CFG_OUT(GPIO74, AF2, DRIVE_LOW)
157#define GPIO75_LCD_LCLK MFP_CFG_OUT(GPIO75, AF2, DRIVE_LOW)
158#define GPIO76_LCD_PCLK MFP_CFG_OUT(GPIO76, AF2, DRIVE_LOW)
159#define GPIO77_LCD_ACBIAS MFP_CFG_OUT(GPIO77, AF2, DRIVE_LOW)
160
161#endif /* __ASM_ARCH_MFP_PXA25X_H */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
new file mode 100644
index 000000000000..122bdbd53182
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
@@ -0,0 +1,433 @@
1#ifndef __ASM_ARCH_MFP_PXA27X_H
2#define __ASM_ARCH_MFP_PXA27X_H
3
4/*
5 * NOTE: for those special-function bidirectional GPIOs, as described
6 * in the "PXA27x Developer's Manual" Section 24.4.2.1, only its input
7 * alternative is preserved, the direction is actually selected by the
8 * specific controller, and this should work in most cases.
9 */
10
11#include <mach/mfp.h>
12#include <mach/mfp-pxa2xx.h>
13
14/* GPIO */
15#define GPIO85_GPIO MFP_CFG_IN(GPIO85, AF0)
16#define GPIO86_GPIO MFP_CFG_IN(GPIO86, AF0)
17#define GPIO87_GPIO MFP_CFG_IN(GPIO87, AF0)
18#define GPIO88_GPIO MFP_CFG_IN(GPIO88, AF0)
19#define GPIO89_GPIO MFP_CFG_IN(GPIO89, AF0)
20#define GPIO90_GPIO MFP_CFG_IN(GPIO90, AF0)
21#define GPIO91_GPIO MFP_CFG_IN(GPIO91, AF0)
22#define GPIO92_GPIO MFP_CFG_IN(GPIO92, AF0)
23#define GPIO93_GPIO MFP_CFG_IN(GPIO93, AF0)
24#define GPIO94_GPIO MFP_CFG_IN(GPIO94, AF0)
25#define GPIO95_GPIO MFP_CFG_IN(GPIO95, AF0)
26#define GPIO96_GPIO MFP_CFG_IN(GPIO96, AF0)
27#define GPIO97_GPIO MFP_CFG_IN(GPIO97, AF0)
28#define GPIO98_GPIO MFP_CFG_IN(GPIO98, AF0)
29#define GPIO99_GPIO MFP_CFG_IN(GPIO99, AF0)
30#define GPIO100_GPIO MFP_CFG_IN(GPIO100, AF0)
31#define GPIO101_GPIO MFP_CFG_IN(GPIO101, AF0)
32#define GPIO102_GPIO MFP_CFG_IN(GPIO102, AF0)
33#define GPIO103_GPIO MFP_CFG_IN(GPIO103, AF0)
34#define GPIO104_GPIO MFP_CFG_IN(GPIO104, AF0)
35#define GPIO105_GPIO MFP_CFG_IN(GPIO105, AF0)
36#define GPIO106_GPIO MFP_CFG_IN(GPIO106, AF0)
37#define GPIO107_GPIO MFP_CFG_IN(GPIO107, AF0)
38#define GPIO108_GPIO MFP_CFG_IN(GPIO108, AF0)
39#define GPIO109_GPIO MFP_CFG_IN(GPIO109, AF0)
40#define GPIO110_GPIO MFP_CFG_IN(GPIO110, AF0)
41#define GPIO111_GPIO MFP_CFG_IN(GPIO111, AF0)
42#define GPIO112_GPIO MFP_CFG_IN(GPIO112, AF0)
43#define GPIO113_GPIO MFP_CFG_IN(GPIO113, AF0)
44#define GPIO114_GPIO MFP_CFG_IN(GPIO114, AF0)
45#define GPIO115_GPIO MFP_CFG_IN(GPIO115, AF0)
46#define GPIO116_GPIO MFP_CFG_IN(GPIO116, AF0)
47#define GPIO117_GPIO MFP_CFG_IN(GPIO117, AF0)
48#define GPIO118_GPIO MFP_CFG_IN(GPIO118, AF0)
49#define GPIO119_GPIO MFP_CFG_IN(GPIO119, AF0)
50#define GPIO120_GPIO MFP_CFG_IN(GPIO120, AF0)
51
52/* Crystal and Clock Signals */
53#define GPIO9_HZ_CLK MFP_CFG_OUT(GPIO9, AF1, DRIVE_LOW)
54#define GPIO10_HZ_CLK MFP_CFG_OUT(GPIO10, AF1, DRIVE_LOW)
55#define GPIO11_48_MHz MFP_CFG_OUT(GPIO11, AF3, DRIVE_LOW)
56#define GPIO12_48_MHz MFP_CFG_OUT(GPIO12, AF3, DRIVE_LOW)
57#define GPIO13_CLK_EXT MFP_CFG_IN(GPIO13, AF1)
58
59/* OS Timer Signals */
60#define GPIO11_EXT_SYNC_0 MFP_CFG_IN(GPIO11, AF1)
61#define GPIO12_EXT_SYNC_1 MFP_CFG_IN(GPIO12, AF1)
62#define GPIO9_CHOUT_0 MFP_CFG_OUT(GPIO9, AF3, DRIVE_LOW)
63#define GPIO10_CHOUT_1 MFP_CFG_OUT(GPIO10, AF3, DRIVE_LOW)
64#define GPIO11_CHOUT_0 MFP_CFG_OUT(GPIO11, AF1, DRIVE_LOW)
65#define GPIO12_CHOUT_1 MFP_CFG_OUT(GPIO12, AF1, DRIVE_LOW)
66
67/* SDRAM and Static Memory I/O Signals */
68#define GPIO20_nSDCS_2 MFP_CFG_OUT(GPIO20, AF1, DRIVE_HIGH)
69#define GPIO21_nSDCS_3 MFP_CFG_OUT(GPIO21, AF1, DRIVE_HIGH)
70#define GPIO15_nCS_1 MFP_CFG_OUT(GPIO15, AF2, DRIVE_HIGH)
71#define GPIO78_nCS_2 MFP_CFG_OUT(GPIO78, AF2, DRIVE_HIGH)
72#define GPIO79_nCS_3 MFP_CFG_OUT(GPIO79, AF2, DRIVE_HIGH)
73#define GPIO80_nCS_4 MFP_CFG_OUT(GPIO80, AF2, DRIVE_HIGH)
74#define GPIO33_nCS_5 MFP_CFG_OUT(GPIO33, AF2, DRIVE_HIGH)
75
76/* Miscellaneous I/O and DMA Signals */
77#define GPIO21_DVAL_0 MFP_CFG_OUT(GPIO21, AF2, DRIVE_HIGH)
78#define GPIO116_DVAL_0 MFP_CFG_OUT(GPIO116, AF1, DRIVE_HIGH)
79#define GPIO33_DVAL_1 MFP_CFG_OUT(GPIO33, AF1, DRIVE_HIGH)
80#define GPIO96_DVAL_1 MFP_CFG_OUT(GPIO96, AF2, DRIVE_HIGH)
81#define GPIO18_RDY MFP_CFG_IN(GPIO18, AF1)
82#define GPIO20_DREQ_0 MFP_CFG_IN(GPIO20, AF1)
83#define GPIO115_DREQ_0 MFP_CFG_IN(GPIO115, AF1)
84#define GPIO80_DREQ_1 MFP_CFG_IN(GPIO80, AF1)
85#define GPIO97_DREQ_1 MFP_CFG_IN(GPIO97, AF2)
86#define GPIO85_DREQ_2 MFP_CFG_IN(GPIO85, AF2)
87#define GPIO100_DREQ_2 MFP_CFG_IN(GPIO100, AF2)
88
89/* Alternate Bus Master Mode I/O Signals */
90#define GPIO20_MBREQ MFP_CFG_IN(GPIO20, AF2)
91#define GPIO80_MBREQ MFP_CFG_IN(GPIO80, AF2)
92#define GPIO96_MBREQ MFP_CFG_IN(GPIO96, AF2)
93#define GPIO115_MBREQ MFP_CFG_IN(GPIO115, AF3)
94#define GPIO21_MBGNT MFP_CFG_OUT(GPIO21, AF3, DRIVE_LOW)
95#define GPIO33_MBGNT MFP_CFG_OUT(GPIO33, AF3, DRIVE_LOW)
96#define GPIO97_MBGNT MFP_CFG_OUT(GPIO97, AF2, DRIVE_LOW)
97#define GPIO116_MBGNT MFP_CFG_OUT(GPIO116, AF3, DRIVE_LOW)
98
99/* PC CARD */
100#define GPIO15_nPCE_1 MFP_CFG_OUT(GPIO15, AF1, DRIVE_HIGH)
101#define GPIO85_nPCE_1 MFP_CFG_OUT(GPIO85, AF1, DRIVE_HIGH)
102#define GPIO86_nPCE_1 MFP_CFG_OUT(GPIO86, AF1, DRIVE_HIGH)
103#define GPIO102_nPCE_1 MFP_CFG_OUT(GPIO102, AF1, DRIVE_HIGH)
104#define GPIO54_nPCE_2 MFP_CFG_OUT(GPIO54, AF2, DRIVE_HIGH)
105#define GPIO78_nPCE_2 MFP_CFG_OUT(GPIO78, AF1, DRIVE_HIGH)
106#define GPIO87_nPCE_2 MFP_CFG_IN(GPIO87, AF1)
107#define GPIO55_nPREG MFP_CFG_OUT(GPIO55, AF2, DRIVE_HIGH)
108#define GPIO50_nPIOR MFP_CFG_OUT(GPIO50, AF2, DRIVE_HIGH)
109#define GPIO51_nPIOW MFP_CFG_OUT(GPIO51, AF2, DRIVE_HIGH)
110#define GPIO49_nPWE MFP_CFG_OUT(GPIO49, AF2, DRIVE_HIGH)
111#define GPIO48_nPOE MFP_CFG_OUT(GPIO48, AF2, DRIVE_HIGH)
112#define GPIO57_nIOIS16 MFP_CFG_IN(GPIO57, AF1)
113#define GPIO56_nPWAIT MFP_CFG_IN(GPIO56, AF1)
114#define GPIO79_PSKTSEL MFP_CFG_OUT(GPIO79, AF1, DRIVE_HIGH)
115#define GPIO104_PSKTSEL MFP_CFG_OUT(GPIO104, AF1, DRIVE_HIGH)
116
117/* I2C */
118#define GPIO117_I2C_SCL MFP_CFG_IN(GPIO117, AF1)
119#define GPIO118_I2C_SDA MFP_CFG_IN(GPIO118, AF1)
120
121/* FFUART */
122#define GPIO9_FFUART_CTS MFP_CFG_IN(GPIO9, AF3)
123#define GPIO26_FFUART_CTS MFP_CFG_IN(GPIO26, AF3)
124#define GPIO35_FFUART_CTS MFP_CFG_IN(GPIO35, AF1)
125#define GPIO100_FFUART_CTS MFP_CFG_IN(GPIO100, AF3)
126#define GPIO10_FFUART_DCD MFP_CFG_IN(GPIO10, AF1)
127#define GPIO36_FFUART_DCD MFP_CFG_IN(GPIO36, AF1)
128#define GPIO33_FFUART_DSR MFP_CFG_IN(GPIO33, AF2)
129#define GPIO37_FFUART_DSR MFP_CFG_IN(GPIO37, AF1)
130#define GPIO38_FFUART_RI MFP_CFG_IN(GPIO38, AF1)
131#define GPIO89_FFUART_RI MFP_CFG_IN(GPIO89, AF3)
132#define GPIO19_FFUART_RXD MFP_CFG_IN(GPIO19, AF3)
133#define GPIO33_FFUART_RXD MFP_CFG_IN(GPIO33, AF1)
134#define GPIO34_FFUART_RXD MFP_CFG_IN(GPIO34, AF1)
135#define GPIO41_FFUART_RXD MFP_CFG_IN(GPIO41, AF1)
136#define GPIO53_FFUART_RXD MFP_CFG_IN(GPIO53, AF1)
137#define GPIO85_FFUART_RXD MFP_CFG_IN(GPIO85, AF1)
138#define GPIO96_FFUART_RXD MFP_CFG_IN(GPIO96, AF3)
139#define GPIO102_FFUART_RXD MFP_CFG_IN(GPIO102, AF3)
140#define GPIO16_FFUART_TXD MFP_CFG_OUT(GPIO16, AF3, DRIVE_HIGH)
141#define GPIO37_FFUART_TXD MFP_CFG_OUT(GPIO37, AF3, DRIVE_HIGH)
142#define GPIO39_FFUART_TXD MFP_CFG_OUT(GPIO39, AF2, DRIVE_HIGH)
143#define GPIO83_FFUART_TXD MFP_CFG_OUT(GPIO83, AF2, DRIVE_HIGH)
144#define GPIO99_FFUART_TXD MFP_CFG_OUT(GPIO99, AF3, DRIVE_HIGH)
145#define GPIO27_FFUART_RTS MFP_CFG_OUT(GPIO27, AF3, DRIVE_HIGH)
146#define GPIO41_FFUART_RTS MFP_CFG_OUT(GPIO41, AF2, DRIVE_HIGH)
147#define GPIO83_FFUART_RTS MFP_CFG_OUT(GPIO83, AF3, DRIVE_HIGH)
148#define GPIO98_FFUART_RTS MFP_CFG_OUT(GPIO98, AF3, DRIVE_HIGH)
149#define GPIO40_FFUART_DTR MFP_CFG_OUT(GPIO40, AF2, DRIVE_HIGH)
150#define GPIO82_FFUART_DTR MFP_CFG_OUT(GPIO82, AF3, DRIVE_HIGH)
151
152/* BTUART */
153#define GPIO44_BTUART_CTS MFP_CFG_IN(GPIO44, AF1)
154#define GPIO42_BTUART_RXD MFP_CFG_IN(GPIO42, AF1)
155#define GPIO45_BTUART_RTS MFP_CFG_OUT(GPIO45, AF2, DRIVE_HIGH)
156#define GPIO43_BTUART_TXD MFP_CFG_OUT(GPIO43, AF2, DRIVE_HIGH)
157
158/* STUART */
159#define GPIO46_STUART_RXD MFP_CFG_IN(GPIO46, AF2)
160#define GPIO47_STUART_TXD MFP_CFG_OUT(GPIO47, AF1, DRIVE_HIGH)
161
162/* FICP */
163#define GPIO42_FICP_RXD MFP_CFG_IN(GPIO42, AF2)
164#define GPIO46_FICP_RXD MFP_CFG_IN(GPIO46, AF1)
165#define GPIO43_FICP_TXD MFP_CFG_OUT(GPIO43, AF1, DRIVE_HIGH)
166#define GPIO47_FICP_TXD MFP_CFG_OUT(GPIO47, AF2, DRIVE_HIGH)
167
168/* PWM 0/1/2/3 */
169#define GPIO11_PWM2_OUT MFP_CFG_OUT(GPIO11, AF2, DRIVE_LOW)
170#define GPIO12_PWM3_OUT MFP_CFG_OUT(GPIO12, AF2, DRIVE_LOW)
171#define GPIO16_PWM0_OUT MFP_CFG_OUT(GPIO16, AF2, DRIVE_LOW)
172#define GPIO17_PWM1_OUT MFP_CFG_OUT(GPIO17, AF2, DRIVE_LOW)
173#define GPIO38_PWM1_OUT MFP_CFG_OUT(GPIO38, AF3, DRIVE_LOW)
174#define GPIO46_PWM2_OUT MFP_CFG_OUT(GPIO46, AF2, DRIVE_LOW)
175#define GPIO47_PWM3_OUT MFP_CFG_OUT(GPIO47, AF3, DRIVE_LOW)
176#define GPIO79_PWM2_OUT MFP_CFG_OUT(GPIO79, AF3, DRIVE_LOW)
177#define GPIO80_PWM3_OUT MFP_CFG_OUT(GPIO80, AF3, DRIVE_LOW)
178#define GPIO115_PWM1_OUT MFP_CFG_OUT(GPIO115, AF3, DRIVE_LOW)
179
180/* AC97 */
181#define GPIO31_AC97_SYNC MFP_CFG_OUT(GPIO31, AF2, DRIVE_LOW)
182#define GPIO94_AC97_SYNC MFP_CFG_OUT(GPIO94, AF1, DRIVE_LOW)
183#define GPIO30_AC97_SDATA_OUT MFP_CFG_OUT(GPIO30, AF2, DRIVE_LOW)
184#define GPIO93_AC97_SDATA_OUT MFP_CFG_OUT(GPIO93, AF1, DRIVE_LOW)
185#define GPIO45_AC97_SYSCLK MFP_CFG_OUT(GPIO45, AF1, DRIVE_LOW)
186#define GPIO89_AC97_SYSCLK MFP_CFG_OUT(GPIO89, AF1, DRIVE_LOW)
187#define GPIO98_AC97_SYSCLK MFP_CFG_OUT(GPIO98, AF1, DRIVE_LOW)
188#define GPIO95_AC97_nRESET MFP_CFG_OUT(GPIO95, AF1, DRIVE_LOW)
189#define GPIO113_AC97_nRESET MFP_CFG_OUT(GPIO113, AF2, DRIVE_LOW)
190#define GPIO28_AC97_BITCLK MFP_CFG_IN(GPIO28, AF1)
191#define GPIO29_AC97_SDATA_IN_0 MFP_CFG_IN(GPIO29, AF1)
192#define GPIO116_AC97_SDATA_IN_0 MFP_CFG_IN(GPIO116, AF2)
193#define GPIO99_AC97_SDATA_IN_1 MFP_CFG_IN(GPIO99, AF2)
194
195/* I2S */
196#define GPIO28_I2S_BITCLK_IN MFP_CFG_IN(GPIO28, AF2)
197#define GPIO28_I2S_BITCLK_OUT MFP_CFG_OUT(GPIO28, AF1, DRIVE_LOW)
198#define GPIO29_I2S_SDATA_IN MFP_CFG_IN(GPIO29, AF2)
199#define GPIO30_I2S_SDATA_OUT MFP_CFG_OUT(GPIO30, AF1, DRIVE_LOW)
200#define GPIO31_I2S_SYNC MFP_CFG_OUT(GPIO31, AF1, DRIVE_LOW)
201#define GPIO113_I2S_SYSCLK MFP_CFG_OUT(GPIO113, AF1, DRIVE_LOW)
202
203/* SSP 1 */
204#define GPIO23_SSP1_SCLK MFP_CFG_OUT(GPIO23, AF2, DRIVE_LOW)
205#define GPIO29_SSP1_SCLK MFP_CFG_IN(GPIO29, AF3)
206#define GPIO27_SSP1_SYSCLK MFP_CFG_OUT(GPIO27, AF1, DRIVE_LOW)
207#define GPIO53_SSP1_SYSCLK MFP_CFG_OUT(GPIO53, AF3, DRIVE_LOW)
208#define GPIO24_SSP1_SFRM MFP_CFG_IN(GPIO24, AF2)
209#define GPIO28_SSP1_SFRM MFP_CFG_IN(GPIO28, AF3)
210#define GPIO25_SSP1_TXD MFP_CFG_OUT(GPIO25, AF2, DRIVE_LOW)
211#define GPIO57_SSP1_TXD MFP_CFG_OUT(GPIO57, AF3, DRIVE_LOW)
212#define GPIO26_SSP1_RXD MFP_CFG_IN(GPIO26, AF1)
213#define GPIO27_SSP1_SCLKEN MFP_CFG_IN(GPIO27, AF2)
214
215/* SSP 2 */
216#define GPIO19_SSP2_SCLK MFP_CFG_IN(GPIO19, AF1)
217#define GPIO22_SSP2_SCLK MFP_CFG_IN(GPIO22, AF3)
218#define GPIO29_SSP2_SCLK MFP_CFG_OUT(GPIO29, AF3, DRIVE_LOW)
219#define GPIO36_SSP2_SCLK MFP_CFG_IN(GPIO36, AF2)
220#define GPIO50_SSP2_SCLK MFP_CFG_IN(GPIO50, AF3)
221#define GPIO22_SSP2_SYSCLK MFP_CFG_OUT(GPIO22, AF2, DRIVE_LOW)
222#define GPIO14_SSP2_SFRM MFP_CFG_IN(GPIO14, AF2)
223#define GPIO37_SSP2_SFRM MFP_CFG_IN(GPIO37, AF2)
224#define GPIO87_SSP2_SFRM MFP_CFG_OUT(GPIO87, AF3, DRIVE_LOW)
225#define GPIO88_SSP2_SFRM MFP_CFG_IN(GPIO88, AF3)
226#define GPIO13_SSP2_TXD MFP_CFG_OUT(GPIO13, AF1, DRIVE_LOW)
227#define GPIO38_SSP2_TXD MFP_CFG_OUT(GPIO38, AF2, DRIVE_LOW)
228#define GPIO87_SSP2_TXD MFP_CFG_OUT(GPIO87, AF1, DRIVE_LOW)
229#define GPIO89_SSP2_TXD MFP_CFG_OUT(GPIO89, AF3, DRIVE_LOW)
230#define GPIO11_SSP2_RXD MFP_CFG_IN(GPIO11, AF2)
231#define GPIO29_SSP2_RXD MFP_CFG_OUT(GPIO29, AF1, DRIVE_LOW)
232#define GPIO40_SSP2_RXD MFP_CFG_IN(GPIO40, AF1)
233#define GPIO86_SSP2_RXD MFP_CFG_IN(GPIO86, AF1)
234#define GPIO88_SSP2_RXD MFP_CFG_IN(GPIO88, AF2)
235#define GPIO22_SSP2_EXTCLK MFP_CFG_IN(GPIO22, AF1)
236#define GPIO27_SSP2_EXTCLK MFP_CFG_IN(GPIO27, AF1)
237#define GPIO22_SSP2_SCLKEN MFP_CFG_IN(GPIO22, AF2)
238#define GPIO23_SSP2_SCLKEN MFP_CFG_IN(GPIO23, AF2)
239
240/* SSP 3 */
241#define GPIO34_SSP3_SCLK MFP_CFG_IN(GPIO34, AF3)
242#define GPIO40_SSP3_SCLK MFP_CFG_OUT(GPIO40, AF3, DRIVE_LOW)
243#define GPIO52_SSP3_SCLK MFP_CFG_IN(GPIO52, AF2)
244#define GPIO84_SSP3_SCLK MFP_CFG_IN(GPIO84, AF1)
245#define GPIO45_SSP3_SYSCLK MFP_CFG_OUT(GPIO45, AF3, DRIVE_LOW)
246#define GPIO35_SSP3_SFRM MFP_CFG_IN(GPIO35, AF3)
247#define GPIO39_SSP3_SFRM MFP_CFG_IN(GPIO39, AF3)
248#define GPIO83_SSP3_SFRM MFP_CFG_IN(GPIO83, AF1)
249#define GPIO35_SSP3_TXD MFP_CFG_OUT(GPIO35, AF3, DRIVE_LOW)
250#define GPIO38_SSP3_TXD MFP_CFG_OUT(GPIO38, AF1, DRIVE_LOW)
251#define GPIO81_SSP3_TXD MFP_CFG_OUT(GPIO81, AF1, DRIVE_LOW)
252#define GPIO41_SSP3_RXD MFP_CFG_IN(GPIO41, AF3)
253#define GPIO82_SSP3_RXD MFP_CFG_IN(GPIO82, AF1)
254#define GPIO89_SSP3_RXD MFP_CFG_IN(GPIO89, AF1)
255
256/* MMC */
257#define GPIO32_MMC_CLK MFP_CFG_OUT(GPIO32, AF2, DRIVE_LOW)
258#define GPIO92_MMC_DAT_0 MFP_CFG_IN(GPIO92, AF1)
259#define GPIO109_MMC_DAT_1 MFP_CFG_IN(GPIO109, AF1)
260#define GPIO110_MMC_DAT_2 MFP_CFG_IN(GPIO110, AF1)
261#define GPIO111_MMC_DAT_3 MFP_CFG_IN(GPIO111, AF1)
262#define GPIO112_MMC_CMD MFP_CFG_IN(GPIO112, AF1)
263
264/* LCD */
265#define GPIO58_LCD_LDD_0 MFP_CFG_OUT(GPIO58, AF2, DRIVE_LOW)
266#define GPIO59_LCD_LDD_1 MFP_CFG_OUT(GPIO59, AF2, DRIVE_LOW)
267#define GPIO60_LCD_LDD_2 MFP_CFG_OUT(GPIO60, AF2, DRIVE_LOW)
268#define GPIO61_LCD_LDD_3 MFP_CFG_OUT(GPIO61, AF2, DRIVE_LOW)
269#define GPIO62_LCD_LDD_4 MFP_CFG_OUT(GPIO62, AF2, DRIVE_LOW)
270#define GPIO63_LCD_LDD_5 MFP_CFG_OUT(GPIO63, AF2, DRIVE_LOW)
271#define GPIO64_LCD_LDD_6 MFP_CFG_OUT(GPIO64, AF2, DRIVE_LOW)
272#define GPIO65_LCD_LDD_7 MFP_CFG_OUT(GPIO65, AF2, DRIVE_LOW)
273#define GPIO66_LCD_LDD_8 MFP_CFG_OUT(GPIO66, AF2, DRIVE_LOW)
274#define GPIO67_LCD_LDD_9 MFP_CFG_OUT(GPIO67, AF2, DRIVE_LOW)
275#define GPIO68_LCD_LDD_10 MFP_CFG_OUT(GPIO68, AF2, DRIVE_LOW)
276#define GPIO69_LCD_LDD_11 MFP_CFG_OUT(GPIO69, AF2, DRIVE_LOW)
277#define GPIO70_LCD_LDD_12 MFP_CFG_OUT(GPIO70, AF2, DRIVE_LOW)
278#define GPIO71_LCD_LDD_13 MFP_CFG_OUT(GPIO71, AF2, DRIVE_LOW)
279#define GPIO72_LCD_LDD_14 MFP_CFG_OUT(GPIO72, AF2, DRIVE_LOW)
280#define GPIO73_LCD_LDD_15 MFP_CFG_OUT(GPIO73, AF2, DRIVE_LOW)
281#define GPIO86_LCD_LDD_16 MFP_CFG_OUT(GPIO86, AF2, DRIVE_LOW)
282#define GPIO87_LCD_LDD_17 MFP_CFG_OUT(GPIO87, AF2, DRIVE_LOW)
283#define GPIO74_LCD_FCLK MFP_CFG_OUT(GPIO74, AF2, DRIVE_LOW)
284#define GPIO75_LCD_LCLK MFP_CFG_OUT(GPIO75, AF2, DRIVE_LOW)
285#define GPIO76_LCD_PCLK MFP_CFG_OUT(GPIO76, AF2, DRIVE_LOW)
286#define GPIO77_LCD_BIAS MFP_CFG_OUT(GPIO77, AF2, DRIVE_LOW)
287#define GPIO14_LCD_VSYNC MFP_CFG_IN(GPIO14, AF1)
288#define GPIO19_LCD_CS MFP_CFG_OUT(GPIO19, AF2, DRIVE_LOW)
289
290/* Keypad */
291#define GPIO93_KP_DKIN_0 MFP_CFG_IN(GPIO93, AF1)
292#define GPIO94_KP_DKIN_1 MFP_CFG_IN(GPIO94, AF1)
293#define GPIO95_KP_DKIN_2 MFP_CFG_IN(GPIO95, AF1)
294#define GPIO96_KP_DKIN_3 MFP_CFG_IN(GPIO96, AF1)
295#define GPIO97_KP_DKIN_4 MFP_CFG_IN(GPIO97, AF1)
296#define GPIO98_KP_DKIN_5 MFP_CFG_IN(GPIO98, AF1)
297#define GPIO99_KP_DKIN_6 MFP_CFG_IN(GPIO99, AF1)
298#define GPIO13_KP_KDIN_7 MFP_CFG_IN(GPIO13, AF2)
299#define GPIO100_KP_MKIN_0 MFP_CFG_IN(GPIO100, AF1)
300#define GPIO101_KP_MKIN_1 MFP_CFG_IN(GPIO101, AF1)
301#define GPIO102_KP_MKIN_2 MFP_CFG_IN(GPIO102, AF1)
302#define GPIO34_KP_MKIN_3 MFP_CFG_IN(GPIO34, AF2)
303#define GPIO37_KP_MKIN_3 MFP_CFG_IN(GPIO37, AF3)
304#define GPIO97_KP_MKIN_3 MFP_CFG_IN(GPIO97, AF3)
305#define GPIO98_KP_MKIN_4 MFP_CFG_IN(GPIO98, AF3)
306#define GPIO38_KP_MKIN_4 MFP_CFG_IN(GPIO38, AF2)
307#define GPIO39_KP_MKIN_4 MFP_CFG_IN(GPIO39, AF1)
308#define GPIO16_KP_MKIN_5 MFP_CFG_IN(GPIO16, AF1)
309#define GPIO90_KP_MKIN_5 MFP_CFG_IN(GPIO90, AF1)
310#define GPIO99_KP_MKIN_5 MFP_CFG_IN(GPIO99, AF3)
311#define GPIO17_KP_MKIN_6 MFP_CFG_IN(GPIO17, AF1)
312#define GPIO91_KP_MKIN_6 MFP_CFG_IN(GPIO91, AF1)
313#define GPIO95_KP_MKIN_6 MFP_CFG_IN(GPIO95, AF3)
314#define GPIO13_KP_MKIN_7 MFP_CFG_IN(GPIO13, AF3)
315#define GPIO36_KP_MKIN_7 MFP_CFG_IN(GPIO36, AF3)
316#define GPIO103_KP_MKOUT_0 MFP_CFG_OUT(GPIO103, AF2, DRIVE_HIGH)
317#define GPIO104_KP_MKOUT_1 MFP_CFG_OUT(GPIO104, AF2, DRIVE_HIGH)
318#define GPIO105_KP_MKOUT_2 MFP_CFG_OUT(GPIO105, AF2, DRIVE_HIGH)
319#define GPIO106_KP_MKOUT_3 MFP_CFG_OUT(GPIO106, AF2, DRIVE_HIGH)
320#define GPIO107_KP_MKOUT_4 MFP_CFG_OUT(GPIO107, AF2, DRIVE_HIGH)
321#define GPIO108_KP_MKOUT_5 MFP_CFG_OUT(GPIO108, AF2, DRIVE_HIGH)
322#define GPIO35_KP_MKOUT_6 MFP_CFG_OUT(GPIO35, AF2, DRIVE_HIGH)
323#define GPIO22_KP_MKOUT_7 MFP_CFG_OUT(GPIO22, AF1, DRIVE_HIGH)
324#define GPIO40_KP_MKOUT_6 MFP_CFG_OUT(GPIO40, AF1, DRIVE_HIGH)
325#define GPIO41_KP_MKOUT_7 MFP_CFG_OUT(GPIO41, AF1, DRIVE_HIGH)
326#define GPIO96_KP_MKOUT_6 MFP_CFG_OUT(GPIO96, AF3, DRIVE_HIGH)
327
328/* USB P3 */
329#define GPIO10_USB_P3_5 MFP_CFG_IN(GPIO10, AF3)
330#define GPIO11_USB_P3_1 MFP_CFG_IN(GPIO11, AF3)
331#define GPIO30_USB_P3_2 MFP_CFG_OUT(GPIO30, AF3, DRIVE_LOW)
332#define GPIO31_USB_P3_6 MFP_CFG_OUT(GPIO31, AF3, DRIVE_LOW)
333#define GPIO56_USB_P3_4 MFP_CFG_OUT(GPIO56, AF1, DRIVE_LOW)
334#define GPIO86_USB_P3_5 MFP_CFG_IN(GPIO86, AF3)
335#define GPIO87_USB_P3_1 MFP_CFG_IN(GPIO87, AF3)
336#define GPIO90_USB_P3_5 MFP_CFG_IN(GPIO90, AF2)
337#define GPIO91_USB_P3_1 MFP_CFG_IN(GPIO91, AF2)
338#define GPIO113_USB_P3_3 MFP_CFG_IN(GPIO113, AF3)
339
340/* USB P2 */
341#define GPIO34_USB_P2_2 MFP_CFG_OUT(GPIO34, AF1, DRIVE_LOW)
342#define GPIO35_USB_P2_1 MFP_CFG_IN(GPIO35, AF2)
343#define GPIO36_USB_P2_4 MFP_CFG_OUT(GPIO36, AF1, DRIVE_LOW)
344#define GPIO37_USB_P2_8 MFP_CFG_OUT(GPIO37, AF1, DRIVE_LOW)
345#define GPIO38_USB_P2_3 MFP_CFG_IN(GPIO38, AF3)
346#define GPIO39_USB_P2_6 MFP_CFG_OUT(GPIO39, AF1, DRIVE_LOW)
347#define GPIO40_USB_P2_5 MFP_CFG_IN(GPIO40, AF3)
348#define GPIO41_USB_P2_7 MFP_CFG_IN(GPIO41, AF2)
349#define GPIO53_USB_P2_3 MFP_CFG_IN(GPIO53, AF2)
350
351/* USB Host Port 1/2 */
352#define GPIO88_USBH1_PWR MFP_CFG_IN(GPIO88, AF1)
353#define GPIO89_USBH1_PEN MFP_CFG_OUT(GPIO89, AF2, DRIVE_LOW)
354#define GPIO119_USBH2_PWR MFP_CFG_IN(GPIO119, AF1)
355#define GPIO120_USBH2_PEN MFP_CFG_OUT(GPIO120, AF2, DRIVE_LOW)
356
357/* QCI - default to Master Mode: CIF_FV/CIF_LV Direction In */
358#define GPIO115_CIF_DD_3 MFP_CFG_IN(GPIO115, AF2)
359#define GPIO116_CIF_DD_2 MFP_CFG_IN(GPIO116, AF1)
360#define GPIO12_CIF_DD_7 MFP_CFG_IN(GPIO12, AF2)
361#define GPIO17_CIF_DD_6 MFP_CFG_IN(GPIO17, AF2)
362#define GPIO23_CIF_MCLK MFP_CFG_OUT(GPIO23, AF1, DRIVE_LOW)
363#define GPIO24_CIF_FV MFP_CFG_IN(GPIO24, AF1)
364#define GPIO25_CIF_LV MFP_CFG_IN(GPIO25, AF1)
365#define GPIO26_CIF_PCLK MFP_CFG_IN(GPIO26, AF2)
366#define GPIO27_CIF_DD_0 MFP_CFG_IN(GPIO27, AF3)
367#define GPIO42_CIF_MCLK MFP_CFG_OUT(GPIO42, AF3, DRIVE_LOW)
368#define GPIO43_CIF_FV MFP_CFG_IN(GPIO43, AF3)
369#define GPIO44_CIF_LV MFP_CFG_IN(GPIO44, AF3)
370#define GPIO45_CIF_PCLK MFP_CFG_IN(GPIO45, AF3)
371#define GPIO47_CIF_DD_0 MFP_CFG_IN(GPIO47, AF1)
372#define GPIO48_CIF_DD_5 MFP_CFG_IN(GPIO48, AF1)
373#define GPIO50_CIF_DD_3 MFP_CFG_IN(GPIO50, AF1)
374#define GPIO51_CIF_DD_2 MFP_CFG_IN(GPIO51, AF1)
375#define GPIO52_CIF_DD_4 MFP_CFG_IN(GPIO52, AF1)
376#define GPIO53_CIF_MCLK MFP_CFG_OUT(GPIO53, AF2, DRIVE_LOW)
377#define GPIO54_CIF_PCLK MFP_CFG_IN(GPIO54, AF3)
378#define GPIO55_CIF_DD_1 MFP_CFG_IN(GPIO55, AF1)
379#define GPIO81_CIF_DD_0 MFP_CFG_IN(GPIO81, AF2)
380#define GPIO82_CIF_DD_5 MFP_CFG_IN(GPIO82, AF3)
381#define GPIO83_CIF_DD_4 MFP_CFG_IN(GPIO83, AF3)
382#define GPIO84_CIF_FV MFP_CFG_IN(GPIO84, AF3)
383#define GPIO85_CIF_LV MFP_CFG_IN(GPIO85, AF3)
384#define GPIO90_CIF_DD_4 MFP_CFG_IN(GPIO90, AF3)
385#define GPIO91_CIF_DD_5 MFP_CFG_IN(GPIO91, AF3)
386#define GPIO93_CIF_DD_6 MFP_CFG_IN(GPIO93, AF2)
387#define GPIO94_CIF_DD_5 MFP_CFG_IN(GPIO94, AF2)
388#define GPIO95_CIF_DD_4 MFP_CFG_IN(GPIO95, AF2)
389#define GPIO98_CIF_DD_0 MFP_CFG_IN(GPIO98, AF2)
390#define GPIO103_CIF_DD_3 MFP_CFG_IN(GPIO103, AF1)
391#define GPIO104_CIF_DD_2 MFP_CFG_IN(GPIO104, AF1)
392#define GPIO105_CIF_DD_1 MFP_CFG_IN(GPIO105, AF1)
393#define GPIO106_CIF_DD_9 MFP_CFG_IN(GPIO106, AF1)
394#define GPIO107_CIF_DD_8 MFP_CFG_IN(GPIO107, AF1)
395#define GPIO108_CIF_DD_7 MFP_CFG_IN(GPIO108, AF1)
396#define GPIO114_CIF_DD_1 MFP_CFG_IN(GPIO114, AF1)
397
398/* Universal Subscriber ID Interface */
399#define GPIO114_UVS0 MFP_CFG_OUT(GPIO114, AF2, DRIVE_LOW)
400#define GPIO115_nUVS1 MFP_CFG_OUT(GPIO115, AF2, DRIVE_LOW)
401#define GPIO116_nUVS2 MFP_CFG_OUT(GPIO116, AF2, DRIVE_LOW)
402#define GPIO14_UCLK MFP_CFG_OUT(GPIO14, AF3, DRIVE_LOW)
403#define GPIO91_UCLK MFP_CFG_OUT(GPIO91, AF2, DRIVE_LOW)
404#define GPIO19_nURST MFP_CFG_OUT(GPIO19, AF3, DRIVE_LOW)
405#define GPIO90_nURST MFP_CFG_OUT(GPIO90, AF2, DRIVE_LOW)
406#define GPIO116_UDET MFP_CFG_IN(GPIO116, AF3)
407#define GPIO114_UEN MFP_CFG_OUT(GPIO114, AF1, DRIVE_LOW)
408#define GPIO115_UEN MFP_CFG_OUT(GPIO115, AF1, DRIVE_LOW)
409
410/* Mobile Scalable Link (MSL) Interface */
411#define GPIO81_BB_OB_DAT_0 MFP_CFG_OUT(GPIO81, AF2, DRIVE_LOW)
412#define GPIO48_BB_OB_DAT_1 MFP_CFG_OUT(GPIO48, AF1, DRIVE_LOW)
413#define GPIO50_BB_OB_DAT_2 MFP_CFG_OUT(GPIO50, AF1, DRIVE_LOW)
414#define GPIO51_BB_OB_DAT_3 MFP_CFG_OUT(GPIO51, AF1, DRIVE_LOW)
415#define GPIO52_BB_OB_CLK MFP_CFG_OUT(GPIO52, AF1, DRIVE_LOW)
416#define GPIO53_BB_OB_STB MFP_CFG_OUT(GPIO53, AF1, DRIVE_LOW)
417#define GPIO54_BB_OB_WAIT MFP_CFG_IN(GPIO54, AF2)
418#define GPIO82_BB_IB_DAT_0 MFP_CFG_IN(GPIO82, AF2)
419#define GPIO55_BB_IB_DAT_1 MFP_CFG_IN(GPIO55, AF2)
420#define GPIO56_BB_IB_DAT_2 MFP_CFG_IN(GPIO56, AF2)
421#define GPIO57_BB_IB_DAT_3 MFP_CFG_IN(GPIO57, AF2)
422#define GPIO83_BB_IB_CLK MFP_CFG_IN(GPIO83, AF2)
423#define GPIO84_BB_IB_STB MFP_CFG_IN(GPIO84, AF2)
424#define GPIO85_BB_IB_WAIT MFP_CFG_OUT(GPIO85, AF2, DRIVE_LOW)
425
426/* Memory Stick Host Controller */
427#define GPIO92_MSBS MFP_CFG_OUT(GPIO92, AF2, DRIVE_LOW)
428#define GPIO109_MSSDIO MFP_CFG_IN(GPIO109, AF2)
429#define GPIO112_nMSINS MFP_CFG_IN(GPIO112, AF2)
430#define GPIO32_MSSCLK MFP_CFG_OUT(GPIO32, AF1, DRIVE_LOW)
431
432extern int keypad_set_wake(unsigned int on);
433#endif /* __ASM_ARCH_MFP_PXA27X_H */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h b/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h
new file mode 100644
index 000000000000..3e9211591e20
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h
@@ -0,0 +1,133 @@
1#ifndef __ASM_ARCH_MFP_PXA2XX_H
2#define __ASM_ARCH_MFP_PXA2XX_H
3
4#include <mach/mfp.h>
5
6/*
7 * the following MFP_xxx bit definitions in mfp.h are re-used for pxa2xx:
8 *
9 * MFP_PIN(x)
10 * MFP_AFx
11 * MFP_LPM_DRIVE_{LOW, HIGH}
12 * MFP_LPM_EDGE_x
13 *
14 * other MFP_x bit definitions will be ignored
15 *
16 * and adds the below two bits specifically for pxa2xx:
17 *
18 * bit 23 - Input/Output (PXA2xx specific)
19 * bit 24 - Wakeup Enable(PXA2xx specific)
20 */
21
22#define MFP_DIR_IN (0x0 << 23)
23#define MFP_DIR_OUT (0x1 << 23)
24#define MFP_DIR_MASK (0x1 << 23)
25#define MFP_DIR(x) (((x) >> 23) & 0x1)
26
27#define MFP_LPM_CAN_WAKEUP (0x1 << 24)
28#define WAKEUP_ON_EDGE_RISE (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_RISE)
29#define WAKEUP_ON_EDGE_FALL (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_FALL)
30#define WAKEUP_ON_EDGE_BOTH (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_BOTH)
31
32/* specifically for enabling wakeup on keypad GPIOs */
33#define WAKEUP_ON_LEVEL_HIGH (MFP_LPM_CAN_WAKEUP)
34
35#define MFP_CFG_IN(pin, af) \
36 ((MFP_CFG_DEFAULT & ~(MFP_AF_MASK | MFP_DIR_MASK)) |\
37 (MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DIR_IN))
38
39/* NOTE: pins configured as output _must_ provide a low power state,
40 * and this state should help to minimize the power dissipation.
41 */
42#define MFP_CFG_OUT(pin, af, state) \
43 ((MFP_CFG_DEFAULT & ~(MFP_AF_MASK | MFP_DIR_MASK | MFP_LPM_STATE_MASK)) |\
44 (MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DIR_OUT | MFP_LPM_##state))
45
46/* Common configurations for pxa25x and pxa27x
47 *
48 * Note: pins configured as GPIO are always initialized to input
49 * so not to cause any side effect
50 */
51#define GPIO0_GPIO MFP_CFG_IN(GPIO0, AF0)
52#define GPIO1_GPIO MFP_CFG_IN(GPIO1, AF0)
53#define GPIO9_GPIO MFP_CFG_IN(GPIO9, AF0)
54#define GPIO10_GPIO MFP_CFG_IN(GPIO10, AF0)
55#define GPIO11_GPIO MFP_CFG_IN(GPIO11, AF0)
56#define GPIO12_GPIO MFP_CFG_IN(GPIO12, AF0)
57#define GPIO13_GPIO MFP_CFG_IN(GPIO13, AF0)
58#define GPIO14_GPIO MFP_CFG_IN(GPIO14, AF0)
59#define GPIO15_GPIO MFP_CFG_IN(GPIO15, AF0)
60#define GPIO16_GPIO MFP_CFG_IN(GPIO16, AF0)
61#define GPIO17_GPIO MFP_CFG_IN(GPIO17, AF0)
62#define GPIO18_GPIO MFP_CFG_IN(GPIO18, AF0)
63#define GPIO19_GPIO MFP_CFG_IN(GPIO19, AF0)
64#define GPIO20_GPIO MFP_CFG_IN(GPIO20, AF0)
65#define GPIO21_GPIO MFP_CFG_IN(GPIO21, AF0)
66#define GPIO22_GPIO MFP_CFG_IN(GPIO22, AF0)
67#define GPIO23_GPIO MFP_CFG_IN(GPIO23, AF0)
68#define GPIO24_GPIO MFP_CFG_IN(GPIO24, AF0)
69#define GPIO25_GPIO MFP_CFG_IN(GPIO25, AF0)
70#define GPIO26_GPIO MFP_CFG_IN(GPIO26, AF0)
71#define GPIO27_GPIO MFP_CFG_IN(GPIO27, AF0)
72#define GPIO28_GPIO MFP_CFG_IN(GPIO28, AF0)
73#define GPIO29_GPIO MFP_CFG_IN(GPIO29, AF0)
74#define GPIO30_GPIO MFP_CFG_IN(GPIO30, AF0)
75#define GPIO31_GPIO MFP_CFG_IN(GPIO31, AF0)
76#define GPIO32_GPIO MFP_CFG_IN(GPIO32, AF0)
77#define GPIO33_GPIO MFP_CFG_IN(GPIO33, AF0)
78#define GPIO34_GPIO MFP_CFG_IN(GPIO34, AF0)
79#define GPIO35_GPIO MFP_CFG_IN(GPIO35, AF0)
80#define GPIO36_GPIO MFP_CFG_IN(GPIO36, AF0)
81#define GPIO37_GPIO MFP_CFG_IN(GPIO37, AF0)
82#define GPIO38_GPIO MFP_CFG_IN(GPIO38, AF0)
83#define GPIO39_GPIO MFP_CFG_IN(GPIO39, AF0)
84#define GPIO40_GPIO MFP_CFG_IN(GPIO40, AF0)
85#define GPIO41_GPIO MFP_CFG_IN(GPIO41, AF0)
86#define GPIO42_GPIO MFP_CFG_IN(GPIO42, AF0)
87#define GPIO43_GPIO MFP_CFG_IN(GPIO43, AF0)
88#define GPIO44_GPIO MFP_CFG_IN(GPIO44, AF0)
89#define GPIO45_GPIO MFP_CFG_IN(GPIO45, AF0)
90#define GPIO46_GPIO MFP_CFG_IN(GPIO46, AF0)
91#define GPIO47_GPIO MFP_CFG_IN(GPIO47, AF0)
92#define GPIO48_GPIO MFP_CFG_IN(GPIO48, AF0)
93#define GPIO49_GPIO MFP_CFG_IN(GPIO49, AF0)
94#define GPIO50_GPIO MFP_CFG_IN(GPIO50, AF0)
95#define GPIO51_GPIO MFP_CFG_IN(GPIO51, AF0)
96#define GPIO52_GPIO MFP_CFG_IN(GPIO52, AF0)
97#define GPIO53_GPIO MFP_CFG_IN(GPIO53, AF0)
98#define GPIO54_GPIO MFP_CFG_IN(GPIO54, AF0)
99#define GPIO55_GPIO MFP_CFG_IN(GPIO55, AF0)
100#define GPIO56_GPIO MFP_CFG_IN(GPIO56, AF0)
101#define GPIO57_GPIO MFP_CFG_IN(GPIO57, AF0)
102#define GPIO58_GPIO MFP_CFG_IN(GPIO58, AF0)
103#define GPIO59_GPIO MFP_CFG_IN(GPIO59, AF0)
104#define GPIO60_GPIO MFP_CFG_IN(GPIO60, AF0)
105#define GPIO61_GPIO MFP_CFG_IN(GPIO61, AF0)
106#define GPIO62_GPIO MFP_CFG_IN(GPIO62, AF0)
107#define GPIO63_GPIO MFP_CFG_IN(GPIO63, AF0)
108#define GPIO64_GPIO MFP_CFG_IN(GPIO64, AF0)
109#define GPIO65_GPIO MFP_CFG_IN(GPIO65, AF0)
110#define GPIO66_GPIO MFP_CFG_IN(GPIO66, AF0)
111#define GPIO67_GPIO MFP_CFG_IN(GPIO67, AF0)
112#define GPIO68_GPIO MFP_CFG_IN(GPIO68, AF0)
113#define GPIO69_GPIO MFP_CFG_IN(GPIO69, AF0)
114#define GPIO70_GPIO MFP_CFG_IN(GPIO70, AF0)
115#define GPIO71_GPIO MFP_CFG_IN(GPIO71, AF0)
116#define GPIO72_GPIO MFP_CFG_IN(GPIO72, AF0)
117#define GPIO73_GPIO MFP_CFG_IN(GPIO73, AF0)
118#define GPIO74_GPIO MFP_CFG_IN(GPIO74, AF0)
119#define GPIO75_GPIO MFP_CFG_IN(GPIO75, AF0)
120#define GPIO76_GPIO MFP_CFG_IN(GPIO76, AF0)
121#define GPIO77_GPIO MFP_CFG_IN(GPIO77, AF0)
122#define GPIO78_GPIO MFP_CFG_IN(GPIO78, AF0)
123#define GPIO79_GPIO MFP_CFG_IN(GPIO79, AF0)
124#define GPIO80_GPIO MFP_CFG_IN(GPIO80, AF0)
125#define GPIO81_GPIO MFP_CFG_IN(GPIO81, AF0)
126#define GPIO82_GPIO MFP_CFG_IN(GPIO82, AF0)
127#define GPIO83_GPIO MFP_CFG_IN(GPIO83, AF0)
128#define GPIO84_GPIO MFP_CFG_IN(GPIO84, AF0)
129
130extern void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num);
131extern void pxa2xx_mfp_set_lpm(int mfp, unsigned long lpm);
132extern int gpio_set_wake(unsigned int gpio, unsigned int on);
133#endif /* __ASM_ARCH_MFP_PXA2XX_H */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa300.h b/arch/arm/mach-pxa/include/mach/mfp-pxa300.h
new file mode 100644
index 000000000000..bc1fb33a6e70
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa300.h
@@ -0,0 +1,575 @@
1/*
2 * arch/arm/mach-pxa/include/mach/mfp-pxa300.h
3 *
4 * PXA300/PXA310 specific MFP configuration definitions
5 *
6 * Copyright (C) 2007 Marvell International Ltd.
7 * 2007-08-21: eric miao <eric.miao@marvell.com>
8 * initial version
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_ARCH_MFP_PXA300_H
16#define __ASM_ARCH_MFP_PXA300_H
17
18#include <mach/mfp.h>
19#include <mach/mfp-pxa3xx.h>
20
21/* GPIO */
22#define GPIO46_GPIO MFP_CFG(GPIO46, AF1)
23#define GPIO49_GPIO MFP_CFG(GPIO49, AF3)
24#define GPIO50_GPIO MFP_CFG(GPIO50, AF2)
25#define GPIO51_GPIO MFP_CFG(GPIO51, AF3)
26#define GPIO52_GPIO MFP_CFG(GPIO52, AF3)
27#define GPIO56_GPIO MFP_CFG(GPIO56, AF0)
28#define GPIO58_GPIO MFP_CFG(GPIO58, AF0)
29#define GPIO59_GPIO MFP_CFG(GPIO59, AF0)
30#define GPIO60_GPIO MFP_CFG(GPIO60, AF0)
31#define GPIO61_GPIO MFP_CFG(GPIO61, AF0)
32#define GPIO62_GPIO MFP_CFG(GPIO62, AF0)
33
34#ifdef CONFIG_CPU_PXA310
35#define GPIO7_2_GPIO MFP_CFG(GPIO7_2, AF0)
36#define GPIO8_2_GPIO MFP_CFG(GPIO8_2, AF0)
37#define GPIO9_2_GPIO MFP_CFG(GPIO9_2, AF0)
38#define GPIO10_2_GPIO MFP_CFG(GPIO10_2, AF0)
39#define GPIO11_2_GPIO MFP_CFG(GPIO11_2, AF0)
40#define GPIO12_2_GPIO MFP_CFG(GPIO12_2, AF0)
41#endif
42
43/* Chip Select */
44#define GPIO2_nCS3 MFP_CFG(GPIO2, AF1)
45
46/* AC97 */
47#define GPIO23_AC97_nACRESET MFP_CFG(GPIO23, AF1)
48#define GPIO24_AC97_SYSCLK MFP_CFG(GPIO24, AF1)
49#define GPIO29_AC97_BITCLK MFP_CFG(GPIO29, AF1)
50#define GPIO25_AC97_SDATA_IN_0 MFP_CFG(GPIO25, AF1)
51#define GPIO26_AC97_SDATA_IN_1 MFP_CFG(GPIO26, AF1)
52#define GPIO17_AC97_SDATA_IN_2 MFP_CFG(GPIO17, AF3)
53#define GPIO21_AC97_SDATA_IN_2 MFP_CFG(GPIO21, AF2)
54#define GPIO18_AC97_SDATA_IN_3 MFP_CFG(GPIO18, AF3)
55#define GPIO22_AC97_SDATA_IN_3 MFP_CFG(GPIO22, AF2)
56#define GPIO27_AC97_SDATA_OUT MFP_CFG(GPIO27, AF1)
57#define GPIO28_AC97_SYNC MFP_CFG(GPIO28, AF1)
58
59/* I2C */
60#define GPIO21_I2C_SCL MFP_CFG_LPM(GPIO21, AF1, PULL_HIGH)
61#define GPIO22_I2C_SDA MFP_CFG_LPM(GPIO22, AF1, PULL_HIGH)
62
63/* QCI */
64#define GPIO39_CI_DD_0 MFP_CFG_DRV(GPIO39, AF1, DS04X)
65#define GPIO40_CI_DD_1 MFP_CFG_DRV(GPIO40, AF1, DS04X)
66#define GPIO41_CI_DD_2 MFP_CFG_DRV(GPIO41, AF1, DS04X)
67#define GPIO42_CI_DD_3 MFP_CFG_DRV(GPIO42, AF1, DS04X)
68#define GPIO43_CI_DD_4 MFP_CFG_DRV(GPIO43, AF1, DS04X)
69#define GPIO44_CI_DD_5 MFP_CFG_DRV(GPIO44, AF1, DS04X)
70#define GPIO45_CI_DD_6 MFP_CFG_DRV(GPIO45, AF1, DS04X)
71#define GPIO46_CI_DD_7 MFP_CFG_DRV(GPIO46, AF0, DS04X)
72#define GPIO47_CI_DD_8 MFP_CFG_DRV(GPIO47, AF1, DS04X)
73#define GPIO48_CI_DD_9 MFP_CFG_DRV(GPIO48, AF1, DS04X)
74#define GPIO52_CI_HSYNC MFP_CFG_DRV(GPIO52, AF0, DS04X)
75#define GPIO51_CI_VSYNC MFP_CFG_DRV(GPIO51, AF0, DS04X)
76#define GPIO49_CI_MCLK MFP_CFG_DRV(GPIO49, AF0, DS04X)
77#define GPIO50_CI_PCLK MFP_CFG_DRV(GPIO50, AF0, DS04X)
78
79/* KEYPAD */
80#define GPIO3_KP_DKIN_6 MFP_CFG_LPM(GPIO3, AF2, FLOAT)
81#define GPIO4_KP_DKIN_7 MFP_CFG_LPM(GPIO4, AF2, FLOAT)
82#define GPIO16_KP_DKIN_6 MFP_CFG_LPM(GPIO16, AF6, FLOAT)
83#define GPIO83_KP_DKIN_2 MFP_CFG_LPM(GPIO83, AF5, FLOAT)
84#define GPIO84_KP_DKIN_1 MFP_CFG_LPM(GPIO84, AF5, FLOAT)
85#define GPIO85_KP_DKIN_0 MFP_CFG_LPM(GPIO85, AF3, FLOAT)
86#define GPIO86_KP_DKIN_1 MFP_CFG_LPM(GPIO86, AF3, FLOAT)
87#define GPIO87_KP_DKIN_2 MFP_CFG_LPM(GPIO87, AF3, FLOAT)
88#define GPIO88_KP_DKIN_3 MFP_CFG_LPM(GPIO88, AF3, FLOAT)
89#define GPIO89_KP_DKIN_3 MFP_CFG_LPM(GPIO89, AF3, FLOAT)
90#define GPIO107_KP_DKIN_0 MFP_CFG_LPM(GPIO107, AF2, FLOAT)
91#define GPIO108_KP_DKIN_1 MFP_CFG_LPM(GPIO108, AF2, FLOAT)
92#define GPIO109_KP_DKIN_2 MFP_CFG_LPM(GPIO109, AF2, FLOAT)
93#define GPIO110_KP_DKIN_3 MFP_CFG_LPM(GPIO110, AF2, FLOAT)
94#define GPIO111_KP_DKIN_4 MFP_CFG_LPM(GPIO111, AF2, FLOAT)
95#define GPIO112_KP_DKIN_5 MFP_CFG_LPM(GPIO112, AF2, FLOAT)
96#define GPIO113_KP_DKIN_6 MFP_CFG_LPM(GPIO113, AF2, FLOAT)
97#define GPIO114_KP_DKIN_7 MFP_CFG_LPM(GPIO114, AF2, FLOAT)
98#define GPIO115_KP_DKIN_0 MFP_CFG_LPM(GPIO115, AF2, FLOAT)
99#define GPIO116_KP_DKIN_1 MFP_CFG_LPM(GPIO116, AF2, FLOAT)
100#define GPIO117_KP_DKIN_2 MFP_CFG_LPM(GPIO117, AF2, FLOAT)
101#define GPIO118_KP_DKIN_3 MFP_CFG_LPM(GPIO118, AF2, FLOAT)
102#define GPIO119_KP_DKIN_4 MFP_CFG_LPM(GPIO119, AF2, FLOAT)
103#define GPIO120_KP_DKIN_5 MFP_CFG_LPM(GPIO120, AF2, FLOAT)
104#define GPIO121_KP_DKIN_6 MFP_CFG_LPM(GPIO121, AF2, FLOAT)
105#define GPIO122_KP_DKIN_5 MFP_CFG_LPM(GPIO122, AF2, FLOAT)
106#define GPIO123_KP_DKIN_4 MFP_CFG_LPM(GPIO123, AF2, FLOAT)
107#define GPIO124_KP_DKIN_3 MFP_CFG_LPM(GPIO124, AF2, FLOAT)
108#define GPIO127_KP_DKIN_0 MFP_CFG_LPM(GPIO127, AF5, FLOAT)
109#define GPIO0_2_KP_DKIN_0 MFP_CFG_LPM(GPIO0_2, AF2, FLOAT)
110#define GPIO1_2_KP_DKIN_1 MFP_CFG_LPM(GPIO1_2, AF2, FLOAT)
111#define GPIO2_2_KP_DKIN_6 MFP_CFG_LPM(GPIO2_2, AF2, FLOAT)
112#define GPIO3_2_KP_DKIN_7 MFP_CFG_LPM(GPIO3_2, AF2, FLOAT)
113#define GPIO4_2_KP_DKIN_1 MFP_CFG_LPM(GPIO4_2, AF2, FLOAT)
114#define GPIO5_2_KP_DKIN_0 MFP_CFG_LPM(GPIO5_2, AF2, FLOAT)
115
116#define GPIO5_KP_MKIN_0 MFP_CFG_LPM(GPIO5, AF2, FLOAT)
117#define GPIO6_KP_MKIN_1 MFP_CFG_LPM(GPIO6, AF2, FLOAT)
118#define GPIO9_KP_MKIN_6 MFP_CFG_LPM(GPIO9, AF3, FLOAT)
119#define GPIO10_KP_MKIN_7 MFP_CFG_LPM(GPIO10, AF3, FLOAT)
120#define GPIO70_KP_MKIN_6 MFP_CFG_LPM(GPIO70, AF3, FLOAT)
121#define GPIO71_KP_MKIN_7 MFP_CFG_LPM(GPIO71, AF3, FLOAT)
122#define GPIO100_KP_MKIN_6 MFP_CFG_LPM(GPIO100, AF7, FLOAT)
123#define GPIO101_KP_MKIN_7 MFP_CFG_LPM(GPIO101, AF7, FLOAT)
124#define GPIO112_KP_MKIN_6 MFP_CFG_LPM(GPIO112, AF4, FLOAT)
125#define GPIO113_KP_MKIN_7 MFP_CFG_LPM(GPIO113, AF4, FLOAT)
126#define GPIO115_KP_MKIN_0 MFP_CFG_LPM(GPIO115, AF1, FLOAT)
127#define GPIO116_KP_MKIN_1 MFP_CFG_LPM(GPIO116, AF1, FLOAT)
128#define GPIO117_KP_MKIN_2 MFP_CFG_LPM(GPIO117, AF1, FLOAT)
129#define GPIO118_KP_MKIN_3 MFP_CFG_LPM(GPIO118, AF1, FLOAT)
130#define GPIO119_KP_MKIN_4 MFP_CFG_LPM(GPIO119, AF1, FLOAT)
131#define GPIO120_KP_MKIN_5 MFP_CFG_LPM(GPIO120, AF1, FLOAT)
132#define GPIO125_KP_MKIN_2 MFP_CFG_LPM(GPIO125, AF2, FLOAT)
133#define GPIO2_2_KP_MKIN_6 MFP_CFG_LPM(GPIO2_2, AF1, FLOAT)
134#define GPIO3_2_KP_MKIN_7 MFP_CFG_LPM(GPIO3_2, AF1, FLOAT)
135
136#define GPIO7_KP_MKOUT_5 MFP_CFG_LPM(GPIO7, AF1, DRIVE_HIGH)
137#define GPIO11_KP_MKOUT_5 MFP_CFG_LPM(GPIO11, AF3, DRIVE_HIGH)
138#define GPIO12_KP_MKOUT_6 MFP_CFG_LPM(GPIO12, AF3, DRIVE_HIGH)
139#define GPIO13_KP_MKOUT_7 MFP_CFG_LPM(GPIO13, AF3, DRIVE_HIGH)
140#define GPIO19_KP_MKOUT_4 MFP_CFG_LPM(GPIO19, AF3, DRIVE_HIGH)
141#define GPIO20_KP_MKOUT_5 MFP_CFG_LPM(GPIO20, AF3, DRIVE_HIGH)
142#define GPIO38_KP_MKOUT_5 MFP_CFG_LPM(GPIO38, AF5, DRIVE_HIGH)
143#define GPIO53_KP_MKOUT_6 MFP_CFG_LPM(GPIO53, AF5, DRIVE_HIGH)
144#define GPIO78_KP_MKOUT_7 MFP_CFG_LPM(GPIO78, AF5, DRIVE_HIGH)
145#define GPIO85_KP_MKOUT_0 MFP_CFG_LPM(GPIO85, AF2, DRIVE_HIGH)
146#define GPIO86_KP_MKOUT_1 MFP_CFG_LPM(GPIO86, AF2, DRIVE_HIGH)
147#define GPIO87_KP_MKOUT_2 MFP_CFG_LPM(GPIO87, AF2, DRIVE_HIGH)
148#define GPIO88_KP_MKOUT_3 MFP_CFG_LPM(GPIO88, AF2, DRIVE_HIGH)
149#define GPIO104_KP_MKOUT_6 MFP_CFG_LPM(GPIO104, AF5, DRIVE_HIGH)
150#define GPIO105_KP_MKOUT_7 MFP_CFG_LPM(GPIO105, AF5, DRIVE_HIGH)
151#define GPIO121_KP_MKOUT_0 MFP_CFG_LPM(GPIO121, AF1, DRIVE_HIGH)
152#define GPIO122_KP_MKOUT_1 MFP_CFG_LPM(GPIO122, AF1, DRIVE_HIGH)
153#define GPIO123_KP_MKOUT_2 MFP_CFG_LPM(GPIO123, AF1, DRIVE_HIGH)
154#define GPIO124_KP_MKOUT_3 MFP_CFG_LPM(GPIO124, AF1, DRIVE_HIGH)
155#define GPIO125_KP_MKOUT_4 MFP_CFG_LPM(GPIO125, AF1, DRIVE_HIGH)
156#define GPIO126_KP_MKOUT_7 MFP_CFG_LPM(GPIO126, AF4, DRIVE_HIGH)
157#define GPIO5_2_KP_MKOUT_6 MFP_CFG_LPM(GPIO5_2, AF1, DRIVE_HIGH)
158#define GPIO4_2_KP_MKOUT_5 MFP_CFG_LPM(GPIO4_2, AF1, DRIVE_HIGH)
159#define GPIO6_2_KP_MKOUT_7 MFP_CFG_LPM(GPIO6_2, AF1, DRIVE_HIGH)
160
161/* LCD */
162#define GPIO54_LCD_LDD_0 MFP_CFG_DRV(GPIO54, AF1, DS01X)
163#define GPIO55_LCD_LDD_1 MFP_CFG_DRV(GPIO55, AF1, DS01X)
164#define GPIO56_LCD_LDD_2 MFP_CFG_DRV(GPIO56, AF1, DS01X)
165#define GPIO57_LCD_LDD_3 MFP_CFG_DRV(GPIO57, AF1, DS01X)
166#define GPIO58_LCD_LDD_4 MFP_CFG_DRV(GPIO58, AF1, DS01X)
167#define GPIO59_LCD_LDD_5 MFP_CFG_DRV(GPIO59, AF1, DS01X)
168#define GPIO60_LCD_LDD_6 MFP_CFG_DRV(GPIO60, AF1, DS01X)
169#define GPIO61_LCD_LDD_7 MFP_CFG_DRV(GPIO61, AF1, DS01X)
170#define GPIO62_LCD_LDD_8 MFP_CFG_DRV(GPIO62, AF1, DS01X)
171#define GPIO63_LCD_LDD_9 MFP_CFG_DRV(GPIO63, AF1, DS01X)
172#define GPIO64_LCD_LDD_10 MFP_CFG_DRV(GPIO64, AF1, DS01X)
173#define GPIO65_LCD_LDD_11 MFP_CFG_DRV(GPIO65, AF1, DS01X)
174#define GPIO66_LCD_LDD_12 MFP_CFG_DRV(GPIO66, AF1, DS01X)
175#define GPIO67_LCD_LDD_13 MFP_CFG_DRV(GPIO67, AF1, DS01X)
176#define GPIO68_LCD_LDD_14 MFP_CFG_DRV(GPIO68, AF1, DS01X)
177#define GPIO69_LCD_LDD_15 MFP_CFG_DRV(GPIO69, AF1, DS01X)
178#define GPIO70_LCD_LDD_16 MFP_CFG_DRV(GPIO70, AF1, DS01X)
179#define GPIO71_LCD_LDD_17 MFP_CFG_DRV(GPIO71, AF1, DS01X)
180#define GPIO62_LCD_CS_N MFP_CFG_DRV(GPIO62, AF2, DS01X)
181#define GPIO72_LCD_FCLK MFP_CFG_DRV(GPIO72, AF1, DS01X)
182#define GPIO73_LCD_LCLK MFP_CFG_DRV(GPIO73, AF1, DS01X)
183#define GPIO74_LCD_PCLK MFP_CFG_DRV(GPIO74, AF1, DS02X)
184#define GPIO75_LCD_BIAS MFP_CFG_DRV(GPIO75, AF1, DS01X)
185#define GPIO76_LCD_VSYNC MFP_CFG_DRV(GPIO76, AF2, DS01X)
186
187#define GPIO15_LCD_CS_N MFP_CFG_DRV(GPIO15, AF2, DS01X)
188#define GPIO127_LCD_CS_N MFP_CFG_DRV(GPIO127, AF1, DS01X)
189#define GPIO63_LCD_VSYNC MFP_CFG_DRV(GPIO63, AF2, DS01X)
190
191/* Mini-LCD */
192#define GPIO72_MLCD_FCLK MFP_CFG_DRV(GPIO72, AF7, DS08X)
193#define GPIO73_MLCD_LCLK MFP_CFG_DRV(GPIO73, AF7, DS08X)
194#define GPIO54_MLCD_LDD_0 MFP_CFG_DRV(GPIO54, AF7, DS08X)
195#define GPIO55_MLCD_LDD_1 MFP_CFG_DRV(GPIO55, AF7, DS08X)
196#define GPIO56_MLCD_LDD_2 MFP_CFG_DRV(GPIO56, AF7, DS08X)
197#define GPIO57_MLCD_LDD_3 MFP_CFG_DRV(GPIO57, AF7, DS08X)
198#define GPIO58_MLCD_LDD_4 MFP_CFG_DRV(GPIO58, AF7, DS08X)
199#define GPIO59_MLCD_LDD_5 MFP_CFG_DRV(GPIO59, AF7, DS08X)
200#define GPIO60_MLCD_LDD_6 MFP_CFG_DRV(GPIO60, AF7, DS08X)
201#define GPIO61_MLCD_LDD_7 MFP_CFG_DRV(GPIO61, AF7, DS08X)
202#define GPIO62_MLCD_LDD_8 MFP_CFG_DRV(GPIO62, AF7, DS08X)
203#define GPIO63_MLCD_LDD_9 MFP_CFG_DRV(GPIO63, AF7, DS08X)
204#define GPIO64_MLCD_LDD_10 MFP_CFG_DRV(GPIO64, AF7, DS08X)
205#define GPIO65_MLCD_LDD_11 MFP_CFG_DRV(GPIO65, AF7, DS08X)
206#define GPIO66_MLCD_LDD_12 MFP_CFG_DRV(GPIO66, AF7, DS08X)
207#define GPIO67_MLCD_LDD_13 MFP_CFG_DRV(GPIO67, AF7, DS08X)
208#define GPIO68_MLCD_LDD_14 MFP_CFG_DRV(GPIO68, AF7, DS08X)
209#define GPIO69_MLCD_LDD_15 MFP_CFG_DRV(GPIO69, AF7, DS08X)
210#define GPIO74_MLCD_PCLK MFP_CFG_DRV(GPIO74, AF7, DS08X)
211#define GPIO75_MLCD_BIAS MFP_CFG_DRV(GPIO75, AF2, DS08X)
212
213/* MMC1 */
214#define GPIO7_MMC1_CLK MFP_CFG_LPM(GPIO7, AF4, DRIVE_HIGH)
215#define GPIO8_MMC1_CMD MFP_CFG_LPM(GPIO8, AF4, DRIVE_HIGH)
216#define GPIO14_MMC1_CMD MFP_CFG_LPM(GPIO14, AF5, DRIVE_HIGH)
217#define GPIO15_MMC1_CMD MFP_CFG_LPM(GPIO15, AF5, DRIVE_HIGH)
218#define GPIO3_MMC1_DAT0 MFP_CFG_LPM(GPIO3, AF4, DRIVE_HIGH)
219#define GPIO4_MMC1_DAT1 MFP_CFG_LPM(GPIO4, AF4, DRIVE_HIGH)
220#define GPIO5_MMC1_DAT2 MFP_CFG_LPM(GPIO5, AF4, DRIVE_HIGH)
221#define GPIO6_MMC1_DAT3 MFP_CFG_LPM(GPIO6, AF4, DRIVE_HIGH)
222
223/* MMC2 */
224#define GPIO9_MMC2_DAT0 MFP_CFG_LPM(GPIO9, AF4, PULL_HIGH)
225#define GPIO10_MMC2_DAT1 MFP_CFG_LPM(GPIO10, AF4, PULL_HIGH)
226#define GPIO11_MMC2_DAT2 MFP_CFG_LPM(GPIO11, AF4, PULL_HIGH)
227#define GPIO12_MMC2_DAT3 MFP_CFG_LPM(GPIO12, AF4, PULL_HIGH)
228#define GPIO13_MMC2_CLK MFP_CFG_LPM(GPIO13, AF4, PULL_HIGH)
229#define GPIO14_MMC2_CMD MFP_CFG_LPM(GPIO14, AF4, PULL_HIGH)
230#define GPIO77_MMC2_DAT0 MFP_CFG_LPM(GPIO77, AF4, PULL_HIGH)
231#define GPIO78_MMC2_DAT1 MFP_CFG_LPM(GPIO78, AF4, PULL_HIGH)
232#define GPIO79_MMC2_DAT2 MFP_CFG_LPM(GPIO79, AF4, PULL_HIGH)
233#define GPIO80_MMC2_DAT3 MFP_CFG_LPM(GPIO80, AF4, PULL_HIGH)
234#define GPIO81_MMC2_CLK MFP_CFG_LPM(GPIO81, AF4, PULL_HIGH)
235#define GPIO82_MMC2_CMD MFP_CFG_LPM(GPIO82, AF4, PULL_HIGH)
236
237/* SSP1 */
238#define GPIO89_SSP1_EXTCLK MFP_CFG(GPIO89, AF1)
239#define GPIO90_SSP1_SYSCLK MFP_CFG(GPIO90, AF1)
240#define GPIO15_SSP1_SCLK MFP_CFG(GPIO15, AF6)
241#define GPIO16_SSP1_FRM MFP_CFG(GPIO16, AF2)
242#define GPIO33_SSP1_SCLK MFP_CFG(GPIO33, AF5)
243#define GPIO34_SSP1_FRM MFP_CFG(GPIO34, AF5)
244#define GPIO85_SSP1_SCLK MFP_CFG(GPIO85, AF1)
245#define GPIO86_SSP1_FRM MFP_CFG(GPIO86, AF1)
246#define GPIO18_SSP1_TXD MFP_CFG(GPIO18, AF7)
247#define GPIO18_SSP1_RXD MFP_CFG(GPIO18, AF2)
248#define GPIO20_SSP1_TXD MFP_CFG(GPIO20, AF2)
249#define GPIO20_SSP1_RXD MFP_CFG(GPIO20, AF7)
250#define GPIO35_SSP1_TXD MFP_CFG(GPIO35, AF5)
251#define GPIO35_SSP1_RXD MFP_CFG(GPIO35, AF4)
252#define GPIO36_SSP1_TXD MFP_CFG(GPIO36, AF5)
253#define GPIO36_SSP1_RXD MFP_CFG(GPIO36, AF6)
254#define GPIO87_SSP1_TXD MFP_CFG(GPIO87, AF1)
255#define GPIO87_SSP1_RXD MFP_CFG(GPIO87, AF6)
256#define GPIO88_SSP1_TXD MFP_CFG(GPIO88, AF6)
257#define GPIO88_SSP1_RXD MFP_CFG(GPIO88, AF1)
258
259/* SSP2 */
260#define GPIO29_SSP2_EXTCLK MFP_CFG(GPIO29, AF2)
261#define GPIO23_SSP2_SCLK MFP_CFG(GPIO23, AF2)
262#define GPIO17_SSP2_FRM MFP_CFG(GPIO17, AF2)
263#define GPIO25_SSP2_SCLK MFP_CFG(GPIO25, AF2)
264#define GPIO26_SSP2_FRM MFP_CFG(GPIO26, AF2)
265#define GPIO33_SSP2_SCLK MFP_CFG(GPIO33, AF6)
266#define GPIO34_SSP2_FRM MFP_CFG(GPIO34, AF6)
267#define GPIO64_SSP2_SCLK MFP_CFG(GPIO64, AF2)
268#define GPIO65_SSP2_FRM MFP_CFG(GPIO65, AF2)
269#define GPIO19_SSP2_TXD MFP_CFG(GPIO19, AF2)
270#define GPIO19_SSP2_RXD MFP_CFG(GPIO19, AF7)
271#define GPIO24_SSP2_TXD MFP_CFG(GPIO24, AF5)
272#define GPIO24_SSP2_RXD MFP_CFG(GPIO24, AF4)
273#define GPIO27_SSP2_TXD MFP_CFG(GPIO27, AF2)
274#define GPIO27_SSP2_RXD MFP_CFG(GPIO27, AF5)
275#define GPIO28_SSP2_TXD MFP_CFG(GPIO28, AF5)
276#define GPIO28_SSP2_RXD MFP_CFG(GPIO28, AF2)
277#define GPIO35_SSP2_TXD MFP_CFG(GPIO35, AF7)
278#define GPIO35_SSP2_RXD MFP_CFG(GPIO35, AF6)
279#define GPIO66_SSP2_TXD MFP_CFG(GPIO66, AF4)
280#define GPIO66_SSP2_RXD MFP_CFG(GPIO66, AF2)
281#define GPIO67_SSP2_TXD MFP_CFG(GPIO67, AF2)
282#define GPIO67_SSP2_RXD MFP_CFG(GPIO67, AF4)
283#define GPIO36_SSP2_TXD MFP_CFG(GPIO36, AF7)
284
285/* SSP3 */
286#define GPIO69_SSP3_FRM MFP_CFG_X(GPIO69, AF2, DS08X, DRIVE_LOW)
287#define GPIO68_SSP3_SCLK MFP_CFG_X(GPIO68, AF2, DS08X, FLOAT)
288#define GPIO92_SSP3_FRM MFP_CFG_X(GPIO92, AF1, DS08X, DRIVE_LOW)
289#define GPIO91_SSP3_SCLK MFP_CFG_X(GPIO91, AF1, DS08X, FLOAT)
290#define GPIO70_SSP3_TXD MFP_CFG_X(GPIO70, AF2, DS08X, DRIVE_LOW)
291#define GPIO70_SSP3_RXD MFP_CFG_X(GPIO70, AF5, DS08X, FLOAT)
292#define GPIO71_SSP3_TXD MFP_CFG_X(GPIO71, AF5, DS08X, DRIVE_LOW)
293#define GPIO71_SSP3_RXD MFP_CFG_X(GPIO71, AF2, DS08X, FLOAT)
294#define GPIO93_SSP3_TXD MFP_CFG_X(GPIO93, AF1, DS08X, DRIVE_LOW)
295#define GPIO93_SSP3_RXD MFP_CFG_X(GPIO93, AF5, DS08X, FLOAT)
296#define GPIO94_SSP3_TXD MFP_CFG_X(GPIO94, AF5, DS08X, DRIVE_LOW)
297#define GPIO94_SSP3_RXD MFP_CFG_X(GPIO94, AF1, DS08X, FLOAT)
298
299/* SSP4 */
300#define GPIO95_SSP4_SCLK MFP_CFG_LPM(GPIO95, AF1, PULL_HIGH)
301#define GPIO96_SSP4_FRM MFP_CFG_LPM(GPIO96, AF1, PULL_HIGH)
302#define GPIO97_SSP4_TXD MFP_CFG_LPM(GPIO97, AF1, PULL_HIGH)
303#define GPIO97_SSP4_RXD MFP_CFG_LPM(GPIO97, AF5, PULL_HIGH)
304#define GPIO98_SSP4_TXD MFP_CFG_LPM(GPIO98, AF5, PULL_HIGH)
305#define GPIO98_SSP4_RXD MFP_CFG_LPM(GPIO98, AF1, PULL_HIGH)
306
307/* UART1 */
308#define GPIO32_UART1_CTS MFP_CFG_LPM(GPIO32, AF2, FLOAT)
309#define GPIO37_UART1_CTS MFP_CFG_LPM(GPIO37, AF4, FLOAT)
310#define GPIO79_UART1_CTS MFP_CFG_LPM(GPIO79, AF1, FLOAT)
311#define GPIO84_UART1_CTS MFP_CFG_LPM(GPIO84, AF3, FLOAT)
312#define GPIO101_UART1_CTS MFP_CFG_LPM(GPIO101, AF1, FLOAT)
313#define GPIO106_UART1_CTS MFP_CFG_LPM(GPIO106, AF6, FLOAT)
314
315#define GPIO32_UART1_RTS MFP_CFG_LPM(GPIO32, AF4, FLOAT)
316#define GPIO37_UART1_RTS MFP_CFG_LPM(GPIO37, AF2, FLOAT)
317#define GPIO79_UART1_RTS MFP_CFG_LPM(GPIO79, AF3, FLOAT)
318#define GPIO84_UART1_RTS MFP_CFG_LPM(GPIO84, AF1, FLOAT)
319#define GPIO101_UART1_RTS MFP_CFG_LPM(GPIO101, AF6, FLOAT)
320#define GPIO106_UART1_RTS MFP_CFG_LPM(GPIO106, AF1, FLOAT)
321
322#define GPIO34_UART1_DSR MFP_CFG_LPM(GPIO34, AF2, FLOAT)
323#define GPIO36_UART1_DSR MFP_CFG_LPM(GPIO36, AF4, FLOAT)
324#define GPIO81_UART1_DSR MFP_CFG_LPM(GPIO81, AF1, FLOAT)
325#define GPIO83_UART1_DSR MFP_CFG_LPM(GPIO83, AF3, FLOAT)
326#define GPIO103_UART1_DSR MFP_CFG_LPM(GPIO103, AF1, FLOAT)
327#define GPIO105_UART1_DSR MFP_CFG_LPM(GPIO105, AF6, FLOAT)
328
329#define GPIO34_UART1_DTR MFP_CFG_LPM(GPIO34, AF4, FLOAT)
330#define GPIO36_UART1_DTR MFP_CFG_LPM(GPIO36, AF2, FLOAT)
331#define GPIO81_UART1_DTR MFP_CFG_LPM(GPIO81, AF3, FLOAT)
332#define GPIO83_UART1_DTR MFP_CFG_LPM(GPIO83, AF1, FLOAT)
333#define GPIO103_UART1_DTR MFP_CFG_LPM(GPIO103, AF6, FLOAT)
334#define GPIO105_UART1_DTR MFP_CFG_LPM(GPIO105, AF1, FLOAT)
335
336#define GPIO35_UART1_RI MFP_CFG_LPM(GPIO35, AF2, FLOAT)
337#define GPIO82_UART1_RI MFP_CFG_LPM(GPIO82, AF1, FLOAT)
338#define GPIO104_UART1_RI MFP_CFG_LPM(GPIO104, AF1, FLOAT)
339
340#define GPIO33_UART1_DCD MFP_CFG_LPM(GPIO33, AF2, FLOAT)
341#define GPIO80_UART1_DCD MFP_CFG_LPM(GPIO80, AF1, FLOAT)
342#define GPIO102_UART1_DCD MFP_CFG_LPM(GPIO102, AF1, FLOAT)
343
344#define GPIO30_UART1_RXD MFP_CFG_LPM(GPIO30, AF2, FLOAT)
345#define GPIO31_UART1_RXD MFP_CFG_LPM(GPIO31, AF4, FLOAT)
346#define GPIO77_UART1_RXD MFP_CFG_LPM(GPIO77, AF1, FLOAT)
347#define GPIO78_UART1_RXD MFP_CFG_LPM(GPIO78, AF3, FLOAT)
348#define GPIO99_UART1_RXD MFP_CFG_LPM(GPIO99, AF1, FLOAT)
349#define GPIO100_UART1_RXD MFP_CFG_LPM(GPIO100, AF6, FLOAT)
350#define GPIO102_UART1_RXD MFP_CFG_LPM(GPIO102, AF6, FLOAT)
351#define GPIO104_UART1_RXD MFP_CFG_LPM(GPIO104, AF4, FLOAT)
352
353#define GPIO30_UART1_TXD MFP_CFG_LPM(GPIO30, AF4, FLOAT)
354#define GPIO31_UART1_TXD MFP_CFG_LPM(GPIO31, AF2, FLOAT)
355#define GPIO77_UART1_TXD MFP_CFG_LPM(GPIO77, AF3, FLOAT)
356#define GPIO78_UART1_TXD MFP_CFG_LPM(GPIO78, AF1, FLOAT)
357#define GPIO99_UART1_TXD MFP_CFG_LPM(GPIO99, AF6, FLOAT)
358#define GPIO100_UART1_TXD MFP_CFG_LPM(GPIO100, AF1, FLOAT)
359#define GPIO102_UART1_TXD MFP_CFG_LPM(GPIO102, AF4, FLOAT)
360
361/* UART2 */
362#define GPIO15_UART2_CTS MFP_CFG_LPM(GPIO15, AF3, FLOAT)
363#define GPIO16_UART2_CTS MFP_CFG_LPM(GPIO16, AF5, FLOAT)
364#define GPIO111_UART2_CTS MFP_CFG_LPM(GPIO111, AF3, FLOAT)
365#define GPIO114_UART2_CTS MFP_CFG_LPM(GPIO114, AF1, FLOAT)
366
367#define GPIO15_UART2_RTS MFP_CFG_LPM(GPIO15, AF4, FLOAT)
368#define GPIO16_UART2_RTS MFP_CFG_LPM(GPIO16, AF4, FLOAT)
369#define GPIO114_UART2_RTS MFP_CFG_LPM(GPIO114, AF3, FLOAT)
370#define GPIO111_UART2_RTS MFP_CFG_LPM(GPIO111, AF1, FLOAT)
371
372#define GPIO18_UART2_RXD MFP_CFG_LPM(GPIO18, AF5, FLOAT)
373#define GPIO19_UART2_RXD MFP_CFG_LPM(GPIO19, AF4, FLOAT)
374#define GPIO112_UART2_RXD MFP_CFG_LPM(GPIO112, AF1, FLOAT)
375#define GPIO113_UART2_RXD MFP_CFG_LPM(GPIO113, AF3, FLOAT)
376
377#define GPIO18_UART2_TXD MFP_CFG_LPM(GPIO18, AF4, FLOAT)
378#define GPIO19_UART2_TXD MFP_CFG_LPM(GPIO19, AF5, FLOAT)
379#define GPIO112_UART2_TXD MFP_CFG_LPM(GPIO112, AF3, FLOAT)
380#define GPIO113_UART2_TXD MFP_CFG_LPM(GPIO113, AF1, FLOAT)
381
382/* UART3 */
383#define GPIO91_UART3_CTS MFP_CFG_LPM(GPIO91, AF2, FLOAT)
384#define GPIO92_UART3_CTS MFP_CFG_LPM(GPIO92, AF4, FLOAT)
385#define GPIO107_UART3_CTS MFP_CFG_LPM(GPIO107, AF1, FLOAT)
386#define GPIO108_UART3_CTS MFP_CFG_LPM(GPIO108, AF3, FLOAT)
387
388#define GPIO91_UART3_RTS MFP_CFG_LPM(GPIO91, AF4, FLOAT)
389#define GPIO92_UART3_RTS MFP_CFG_LPM(GPIO92, AF2, FLOAT)
390#define GPIO107_UART3_RTS MFP_CFG_LPM(GPIO107, AF3, FLOAT)
391#define GPIO108_UART3_RTS MFP_CFG_LPM(GPIO108, AF1, FLOAT)
392
393#define GPIO7_UART3_RXD MFP_CFG_LPM(GPIO7, AF2, FLOAT)
394#define GPIO8_UART3_RXD MFP_CFG_LPM(GPIO8, AF6, FLOAT)
395#define GPIO93_UART3_RXD MFP_CFG_LPM(GPIO93, AF4, FLOAT)
396#define GPIO94_UART3_RXD MFP_CFG_LPM(GPIO94, AF2, FLOAT)
397#define GPIO109_UART3_RXD MFP_CFG_LPM(GPIO109, AF3, FLOAT)
398#define GPIO110_UART3_RXD MFP_CFG_LPM(GPIO110, AF1, FLOAT)
399
400#define GPIO7_UART3_TXD MFP_CFG_LPM(GPIO7, AF6, FLOAT)
401#define GPIO8_UART3_TXD MFP_CFG_LPM(GPIO8, AF2, FLOAT)
402#define GPIO93_UART3_TXD MFP_CFG_LPM(GPIO93, AF2, FLOAT)
403#define GPIO94_UART3_TXD MFP_CFG_LPM(GPIO94, AF4, FLOAT)
404#define GPIO109_UART3_TXD MFP_CFG_LPM(GPIO109, AF1, FLOAT)
405#define GPIO110_UART3_TXD MFP_CFG_LPM(GPIO110, AF3, FLOAT)
406
407/* USB Host */
408#define GPIO0_2_USBH_PEN MFP_CFG(GPIO0_2, AF1)
409#define GPIO1_2_USBH_PWR MFP_CFG(GPIO1_2, AF1)
410
411/* USB P3 */
412#define GPIO77_USB_P3_1 MFP_CFG(GPIO77, AF2)
413#define GPIO78_USB_P3_2 MFP_CFG(GPIO78, AF2)
414#define GPIO79_USB_P3_3 MFP_CFG(GPIO79, AF2)
415#define GPIO80_USB_P3_4 MFP_CFG(GPIO80, AF2)
416#define GPIO81_USB_P3_5 MFP_CFG(GPIO81, AF2)
417#define GPIO82_USB_P3_6 MFP_CFG(GPIO82, AF2)
418
419/* PWM */
420#define GPIO17_PWM0_OUT MFP_CFG(GPIO17, AF1)
421#define GPIO18_PWM1_OUT MFP_CFG(GPIO18, AF1)
422#define GPIO19_PWM2_OUT MFP_CFG(GPIO19, AF1)
423#define GPIO20_PWM3_OUT MFP_CFG(GPIO20, AF1)
424
425/* CIR */
426#define GPIO8_CIR_OUT MFP_CFG(GPIO8, AF5)
427#define GPIO16_CIR_OUT MFP_CFG(GPIO16, AF3)
428
429#define GPIO20_OW_DQ_IN MFP_CFG(GPIO20, AF5)
430#define GPIO126_OW_DQ MFP_CFG(GPIO126, AF2)
431
432#define GPIO0_DF_RDY MFP_CFG(GPIO0, AF1)
433#define GPIO7_CLK_BYPASS_XSC MFP_CFG(GPIO7, AF7)
434#define GPIO17_EXT_SYNC_MVT_0 MFP_CFG(GPIO17, AF6)
435#define GPIO18_EXT_SYNC_MVT_1 MFP_CFG(GPIO18, AF6)
436#define GPIO19_OST_CHOUT_MVT_0 MFP_CFG(GPIO19, AF6)
437#define GPIO20_OST_CHOUT_MVT_1 MFP_CFG(GPIO20, AF6)
438#define GPIO49_48M_CLK MFP_CFG(GPIO49, AF2)
439#define GPIO126_EXT_CLK MFP_CFG(GPIO126, AF3)
440#define GPIO127_CLK_BYPASS_GB MFP_CFG(GPIO127, AF7)
441#define GPIO71_EXT_MATCH_MVT MFP_CFG(GPIO71, AF6)
442
443#define GPIO3_uIO_IN MFP_CFG(GPIO3, AF1)
444
445#define GPIO4_uSIM_CARD_STATE MFP_CFG(GPIO4, AF1)
446#define GPIO5_uSIM_uCLK MFP_CFG(GPIO5, AF1)
447#define GPIO6_uSIM_uRST MFP_CFG(GPIO6, AF1)
448#define GPIO16_uSIM_UVS_0 MFP_CFG(GPIO16, AF1)
449
450#define GPIO9_SCIO MFP_CFG(GPIO9, AF1)
451#define GPIO20_RTC_MVT MFP_CFG(GPIO20, AF4)
452#define GPIO126_RTC_MVT MFP_CFG(GPIO126, AF1)
453
454/*
455 * PXA300 specific MFP configurations
456 */
457#ifdef CONFIG_CPU_PXA300
458#define GPIO99_USB_P2_2 MFP_CFG(GPIO99, AF2)
459#define GPIO99_USB_P2_5 MFP_CFG(GPIO99, AF3)
460#define GPIO99_USB_P2_6 MFP_CFG(GPIO99, AF4)
461#define GPIO100_USB_P2_2 MFP_CFG(GPIO100, AF4)
462#define GPIO100_USB_P2_5 MFP_CFG(GPIO100, AF5)
463#define GPIO101_USB_P2_1 MFP_CFG(GPIO101, AF2)
464#define GPIO102_USB_P2_4 MFP_CFG(GPIO102, AF2)
465#define GPIO104_USB_P2_3 MFP_CFG(GPIO104, AF2)
466#define GPIO105_USB_P2_5 MFP_CFG(GPIO105, AF2)
467#define GPIO100_USB_P2_6 MFP_CFG(GPIO100, AF2)
468#define GPIO106_USB_P2_7 MFP_CFG(GPIO106, AF2)
469#define GPIO103_USB_P2_8 MFP_CFG(GPIO103, AF2)
470
471/* U2D UTMI */
472#define GPIO38_UTM_CLK MFP_CFG(GPIO38, AF1)
473#define GPIO26_U2D_RXERROR MFP_CFG(GPIO26, AF3)
474#define GPIO50_U2D_RXERROR MFP_CFG(GPIO50, AF1)
475#define GPIO89_U2D_RXERROR MFP_CFG(GPIO89, AF5)
476#define GPIO24_UTM_RXVALID MFP_CFG(GPIO24, AF3)
477#define GPIO48_UTM_RXVALID MFP_CFG(GPIO48, AF2)
478#define GPIO87_UTM_RXVALID MFP_CFG(GPIO87, AF5)
479#define GPIO25_UTM_RXACTIVE MFP_CFG(GPIO25, AF3)
480#define GPIO47_UTM_RXACTIVE MFP_CFG(GPIO47, AF2)
481#define GPIO49_UTM_RXACTIVE MFP_CFG(GPIO49, AF1)
482#define GPIO88_UTM_RXACTIVE MFP_CFG(GPIO88, AF5)
483#define GPIO53_UTM_TXREADY MFP_CFG(GPIO53, AF1)
484#define GPIO67_UTM_LINESTATE_0 MFP_CFG(GPIO67, AF3)
485#define GPIO92_UTM_LINESTATE_0 MFP_CFG(GPIO92, AF3)
486#define GPIO104_UTM_LINESTATE_0 MFP_CFG(GPIO104, AF3)
487#define GPIO109_UTM_LINESTATE_0 MFP_CFG(GPIO109, AF4)
488#define GPIO68_UTM_LINESTATE_1 MFP_CFG(GPIO68, AF3)
489#define GPIO93_UTM_LINESTATE_1 MFP_CFG(GPIO93, AF3)
490#define GPIO105_UTM_LINESTATE_1 MFP_CFG(GPIO105, AF3)
491#define GPIO27_U2D_OPMODE_0 MFP_CFG(GPIO27, AF4)
492#define GPIO51_U2D_OPMODE_0 MFP_CFG(GPIO51, AF2)
493#define GPIO90_U2D_OPMODE_0 MFP_CFG(GPIO90, AF7)
494#define GPIO28_U2D_OPMODE_1 MFP_CFG(GPIO28, AF4)
495#define GPIO52_U2D_OPMODE_1 MFP_CFG(GPIO52, AF2)
496#define GPIO106_U2D_OPMODE_1 MFP_CFG(GPIO106, AF3)
497#define GPIO110_U2D_OPMODE_1 MFP_CFG(GPIO110, AF5)
498#define GPIO76_U2D_RESET MFP_CFG(GPIO76, AF1)
499#define GPIO95_U2D_RESET MFP_CFG(GPIO95, AF2)
500#define GPIO100_U2D_RESET MFP_CFG(GPIO100, AF3)
501#define GPIO66_U2D_SUSPEND MFP_CFG(GPIO66, AF3)
502#define GPIO98_U2D_SUSPEND MFP_CFG(GPIO98, AF2)
503#define GPIO103_U2D_SUSPEND MFP_CFG(GPIO103, AF3)
504#define GPIO65_U2D_TERM_SEL MFP_CFG(GPIO65, AF5)
505#define GPIO97_U2D_TERM_SEL MFP_CFG(GPIO97, AF3)
506#define GPIO102_U2D_TERM_SEL MFP_CFG(GPIO102, AF5)
507#define GPIO29_U2D_TXVALID MFP_CFG(GPIO29, AF3)
508#define GPIO52_U2D_TXVALID MFP_CFG(GPIO52, AF4)
509#define GPIO69_U2D_TXVALID MFP_CFG(GPIO69, AF3)
510#define GPIO85_U2D_TXVALID MFP_CFG(GPIO85, AF7)
511#define GPIO64_U2D_XCVR_SEL MFP_CFG(GPIO64, AF5)
512#define GPIO96_U2D_XCVR_SEL MFP_CFG(GPIO96, AF3)
513#define GPIO101_U2D_XCVR_SEL MFP_CFG(GPIO101, AF5)
514#define GPIO30_UTM_PHYDATA_0 MFP_CFG(GPIO30, AF3)
515#define GPIO31_UTM_PHYDATA_1 MFP_CFG(GPIO31, AF3)
516#define GPIO32_UTM_PHYDATA_2 MFP_CFG(GPIO32, AF3)
517#define GPIO33_UTM_PHYDATA_3 MFP_CFG(GPIO33, AF3)
518#define GPIO34_UTM_PHYDATA_4 MFP_CFG(GPIO34, AF3)
519#define GPIO35_UTM_PHYDATA_5 MFP_CFG(GPIO35, AF3)
520#define GPIO36_UTM_PHYDATA_6 MFP_CFG(GPIO36, AF3)
521#define GPIO37_UTM_PHYDATA_7 MFP_CFG(GPIO37, AF3)
522#define GPIO39_UTM_PHYDATA_0 MFP_CFG(GPIO39, AF3)
523#define GPIO40_UTM_PHYDATA_1 MFP_CFG(GPIO40, AF3)
524#define GPIO41_UTM_PHYDATA_2 MFP_CFG(GPIO41, AF3)
525#define GPIO42_UTM_PHYDATA_3 MFP_CFG(GPIO42, AF3)
526#define GPIO43_UTM_PHYDATA_4 MFP_CFG(GPIO43, AF3)
527#define GPIO44_UTM_PHYDATA_5 MFP_CFG(GPIO44, AF3)
528#define GPIO45_UTM_PHYDATA_6 MFP_CFG(GPIO45, AF3)
529#define GPIO46_UTM_PHYDATA_7 MFP_CFG(GPIO46, AF3)
530#endif /* CONFIG_CPU_PXA300 */
531
532/*
533 * PXA310 specific MFP configurations
534 */
535#ifdef CONFIG_CPU_PXA310
536/* USB P2 */
537#define GPIO36_USB_P2_1 MFP_CFG(GPIO36, AF1)
538#define GPIO30_USB_P2_2 MFP_CFG(GPIO30, AF1)
539#define GPIO35_USB_P2_3 MFP_CFG(GPIO35, AF1)
540#define GPIO32_USB_P2_4 MFP_CFG(GPIO32, AF1)
541#define GPIO34_USB_P2_5 MFP_CFG(GPIO34, AF1)
542#define GPIO31_USB_P2_6 MFP_CFG(GPIO31, AF1)
543
544/* MMC1 */
545#define GPIO24_MMC1_CMD MFP_CFG(GPIO24, AF3)
546#define GPIO29_MMC1_DAT0 MFP_CFG(GPIO29, AF3)
547
548/* MMC3 */
549#define GPIO103_MMC3_CLK MFP_CFG(GPIO103, AF2)
550#define GPIO105_MMC3_CMD MFP_CFG(GPIO105, AF2)
551#define GPIO11_2_MMC3_CLK MFP_CFG(GPIO11_2, AF1)
552#define GPIO12_2_MMC3_CMD MFP_CFG(GPIO12_2, AF1)
553#define GPIO7_2_MMC3_DAT0 MFP_CFG(GPIO7_2, AF1)
554#define GPIO8_2_MMC3_DAT1 MFP_CFG(GPIO8_2, AF1)
555#define GPIO9_2_MMC3_DAT2 MFP_CFG(GPIO9_2, AF1)
556#define GPIO10_2_MMC3_DAT3 MFP_CFG(GPIO10_2, AF1)
557
558/* ULPI */
559#define GPIO38_ULPI_CLK MFP_CFG(GPIO38, AF1)
560#define GPIO30_ULPI_DATA_OUT_0 MFP_CFG(GPIO30, AF3)
561#define GPIO31_ULPI_DATA_OUT_1 MFP_CFG(GPIO31, AF3)
562#define GPIO32_ULPI_DATA_OUT_2 MFP_CFG(GPIO32, AF3)
563#define GPIO33_ULPI_DATA_OUT_3 MFP_CFG(GPIO33, AF3)
564#define GPIO34_ULPI_DATA_OUT_4 MFP_CFG(GPIO34, AF3)
565#define GPIO35_ULPI_DATA_OUT_5 MFP_CFG(GPIO35, AF3)
566#define GPIO36_ULPI_DATA_OUT_6 MFP_CFG(GPIO36, AF3)
567#define GPIO37_ULPI_DATA_OUT_7 MFP_CFG(GPIO37, AF3)
568#define GPIO33_ULPI_OTG_INTR MFP_CFG(GPIO33, AF1)
569
570#define ULPI_DIR MFP_CFG_DRV(ULPI_DIR, MFP_AF0, MFP_DS01X)
571#define ULPI_NXT MFP_CFG_DRV(ULPI_NXT, MFP_AF0, MFP_DS01X)
572#define ULPI_STP MFP_CFG_DRV(ULPI_STP, MFP_AF0, MFP_DS01X)
573#endif /* CONFIG_CPU_PXA310 */
574
575#endif /* __ASM_ARCH_MFP_PXA300_H */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa320.h b/arch/arm/mach-pxa/include/mach/mfp-pxa320.h
new file mode 100644
index 000000000000..74990510cf34
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa320.h
@@ -0,0 +1,447 @@
1/*
2 * arch/arm/mach-pxa/include/mach/mfp-pxa320.h
3 *
4 * PXA320 specific MFP configuration definitions
5 *
6 * Copyright (C) 2007 Marvell International Ltd.
7 * 2007-08-21: eric miao <eric.miao@marvell.com>
8 * initial version
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_ARCH_MFP_PXA320_H
16#define __ASM_ARCH_MFP_PXA320_H
17
18#include <mach/mfp.h>
19#include <mach/mfp-pxa3xx.h>
20
21/* GPIO */
22#define GPIO46_GPIO MFP_CFG(GPIO46, AF0)
23#define GPIO49_GPIO MFP_CFG(GPIO49, AF0)
24#define GPIO50_GPIO MFP_CFG(GPIO50, AF0)
25#define GPIO51_GPIO MFP_CFG(GPIO51, AF0)
26#define GPIO52_GPIO MFP_CFG(GPIO52, AF0)
27
28#define GPIO7_2_GPIO MFP_CFG(GPIO7_2, AF0)
29#define GPIO8_2_GPIO MFP_CFG(GPIO8_2, AF0)
30#define GPIO9_2_GPIO MFP_CFG(GPIO9_2, AF0)
31#define GPIO10_2_GPIO MFP_CFG(GPIO10_2, AF0)
32#define GPIO11_2_GPIO MFP_CFG(GPIO11_2, AF0)
33#define GPIO12_2_GPIO MFP_CFG(GPIO12_2, AF0)
34#define GPIO13_2_GPIO MFP_CFG(GPIO13_2, AF0)
35#define GPIO14_2_GPIO MFP_CFG(GPIO14_2, AF0)
36#define GPIO15_2_GPIO MFP_CFG(GPIO15_2, AF0)
37#define GPIO16_2_GPIO MFP_CFG(GPIO16_2, AF0)
38#define GPIO17_2_GPIO MFP_CFG(GPIO17_2, AF0)
39
40/* Chip Select */
41#define GPIO4_nCS3 MFP_CFG(GPIO4, AF1)
42
43/* AC97 */
44#define GPIO34_AC97_SYSCLK MFP_CFG(GPIO34, AF1)
45#define GPIO39_AC97_BITCLK MFP_CFG(GPIO39, AF1)
46#define GPIO40_AC97_nACRESET MFP_CFG(GPIO40, AF1)
47#define GPIO35_AC97_SDATA_IN_0 MFP_CFG(GPIO35, AF1)
48#define GPIO36_AC97_SDATA_IN_1 MFP_CFG(GPIO36, AF1)
49#define GPIO32_AC97_SDATA_IN_2 MFP_CFG(GPIO32, AF2)
50#define GPIO33_AC97_SDATA_IN_3 MFP_CFG(GPIO33, AF2)
51#define GPIO11_AC97_SDATA_IN_2 MFP_CFG(GPIO11, AF3)
52#define GPIO12_AC97_SDATA_IN_3 MFP_CFG(GPIO12, AF3)
53#define GPIO37_AC97_SDATA_OUT MFP_CFG(GPIO37, AF1)
54#define GPIO38_AC97_SYNC MFP_CFG(GPIO38, AF1)
55
56/* I2C */
57#define GPIO32_I2C_SCL MFP_CFG_LPM(GPIO32, AF1, PULL_HIGH)
58#define GPIO33_I2C_SDA MFP_CFG_LPM(GPIO33, AF1, PULL_HIGH)
59
60/* QCI */
61#define GPIO49_CI_DD_0 MFP_CFG_DRV(GPIO49, AF1, DS04X)
62#define GPIO50_CI_DD_1 MFP_CFG_DRV(GPIO50, AF1, DS04X)
63#define GPIO51_CI_DD_2 MFP_CFG_DRV(GPIO51, AF1, DS04X)
64#define GPIO52_CI_DD_3 MFP_CFG_DRV(GPIO52, AF1, DS04X)
65#define GPIO53_CI_DD_4 MFP_CFG_DRV(GPIO53, AF1, DS04X)
66#define GPIO54_CI_DD_5 MFP_CFG_DRV(GPIO54, AF1, DS04X)
67#define GPIO55_CI_DD_6 MFP_CFG_DRV(GPIO55, AF1, DS04X)
68#define GPIO56_CI_DD_7 MFP_CFG_DRV(GPIO56, AF0, DS04X)
69#define GPIO57_CI_DD_8 MFP_CFG_DRV(GPIO57, AF1, DS04X)
70#define GPIO58_CI_DD_9 MFP_CFG_DRV(GPIO58, AF1, DS04X)
71#define GPIO59_CI_MCLK MFP_CFG_DRV(GPIO59, AF0, DS04X)
72#define GPIO60_CI_PCLK MFP_CFG_DRV(GPIO60, AF0, DS04X)
73#define GPIO61_CI_HSYNC MFP_CFG_DRV(GPIO61, AF0, DS04X)
74#define GPIO62_CI_VSYNC MFP_CFG_DRV(GPIO62, AF0, DS04X)
75
76#define GPIO31_CIR_OUT MFP_CFG(GPIO31, AF5)
77
78#define GPIO0_2_CLK_EXT MFP_CFG(GPIO0_2, AF3)
79#define GPIO0_DRQ MFP_CFG(GPIO0, AF2)
80#define GPIO11_EXT_SYNC0 MFP_CFG(GPIO11, AF5)
81#define GPIO12_EXT_SYNC1 MFP_CFG(GPIO12, AF6)
82#define GPIO0_2_HZ_CLK MFP_CFG(GPIO0_2, AF1)
83#define GPIO14_HZ_CLK MFP_CFG(GPIO14, AF4)
84#define GPIO30_ICP_RXD MFP_CFG(GPIO30, AF1)
85#define GPIO31_ICP_TXD MFP_CFG(GPIO31, AF1)
86
87#define GPIO83_KP_DKIN_0 MFP_CFG_LPM(GPIO83, AF3, FLOAT)
88#define GPIO84_KP_DKIN_1 MFP_CFG_LPM(GPIO84, AF3, FLOAT)
89#define GPIO85_KP_DKIN_2 MFP_CFG_LPM(GPIO85, AF3, FLOAT)
90#define GPIO86_KP_DKIN_3 MFP_CFG_LPM(GPIO86, AF3, FLOAT)
91
92#define GPIO105_KP_DKIN_0 MFP_CFG_LPM(GPIO105, AF2, FLOAT)
93#define GPIO106_KP_DKIN_1 MFP_CFG_LPM(GPIO106, AF2, FLOAT)
94#define GPIO107_KP_DKIN_2 MFP_CFG_LPM(GPIO107, AF2, FLOAT)
95#define GPIO108_KP_DKIN_3 MFP_CFG_LPM(GPIO108, AF2, FLOAT)
96#define GPIO109_KP_DKIN_4 MFP_CFG_LPM(GPIO109, AF2, FLOAT)
97#define GPIO110_KP_DKIN_5 MFP_CFG_LPM(GPIO110, AF2, FLOAT)
98#define GPIO111_KP_DKIN_6 MFP_CFG_LPM(GPIO111, AF2, FLOAT)
99#define GPIO112_KP_DKIN_7 MFP_CFG_LPM(GPIO112, AF2, FLOAT)
100
101#define GPIO113_KP_DKIN_0 MFP_CFG_LPM(GPIO113, AF2, FLOAT)
102#define GPIO114_KP_DKIN_1 MFP_CFG_LPM(GPIO114, AF2, FLOAT)
103#define GPIO115_KP_DKIN_2 MFP_CFG_LPM(GPIO115, AF2, FLOAT)
104#define GPIO116_KP_DKIN_3 MFP_CFG_LPM(GPIO116, AF2, FLOAT)
105#define GPIO117_KP_DKIN_4 MFP_CFG_LPM(GPIO117, AF2, FLOAT)
106#define GPIO118_KP_DKIN_5 MFP_CFG_LPM(GPIO118, AF2, FLOAT)
107#define GPIO119_KP_DKIN_6 MFP_CFG_LPM(GPIO119, AF2, FLOAT)
108#define GPIO120_KP_DKIN_7 MFP_CFG_LPM(GPIO120, AF2, FLOAT)
109
110#define GPIO127_KP_DKIN_0 MFP_CFG_LPM(GPIO127, AF2, FLOAT)
111#define GPIO126_KP_DKIN_1 MFP_CFG_LPM(GPIO126, AF2, FLOAT)
112
113#define GPIO2_2_KP_DKIN_0 MFP_CFG_LPM(GPIO2_2, AF2, FLOAT)
114#define GPIO3_2_KP_DKIN_1 MFP_CFG_LPM(GPIO3_2, AF2, FLOAT)
115#define GPIO125_KP_DKIN_2 MFP_CFG_LPM(GPIO125, AF2, FLOAT)
116#define GPIO124_KP_DKIN_3 MFP_CFG_LPM(GPIO124, AF2, FLOAT)
117#define GPIO123_KP_DKIN_4 MFP_CFG_LPM(GPIO123, AF2, FLOAT)
118#define GPIO122_KP_DKIN_5 MFP_CFG_LPM(GPIO122, AF2, FLOAT)
119#define GPIO121_KP_DKIN_6 MFP_CFG_LPM(GPIO121, AF2, FLOAT)
120#define GPIO4_2_KP_DKIN_7 MFP_CFG_LPM(GPIO4_2, AF2, FLOAT)
121
122#define GPIO113_KP_MKIN_0 MFP_CFG_LPM(GPIO113, AF1, FLOAT)
123#define GPIO114_KP_MKIN_1 MFP_CFG_LPM(GPIO114, AF1, FLOAT)
124#define GPIO115_KP_MKIN_2 MFP_CFG_LPM(GPIO115, AF1, FLOAT)
125#define GPIO116_KP_MKIN_3 MFP_CFG_LPM(GPIO116, AF1, FLOAT)
126#define GPIO117_KP_MKIN_4 MFP_CFG_LPM(GPIO117, AF1, FLOAT)
127#define GPIO118_KP_MKIN_5 MFP_CFG_LPM(GPIO118, AF1, FLOAT)
128#define GPIO119_KP_MKIN_6 MFP_CFG_LPM(GPIO119, AF1, FLOAT)
129#define GPIO120_KP_MKIN_7 MFP_CFG_LPM(GPIO120, AF1, FLOAT)
130
131#define GPIO83_KP_MKOUT_0 MFP_CFG_LPM(GPIO83, AF2, DRIVE_HIGH)
132#define GPIO84_KP_MKOUT_1 MFP_CFG_LPM(GPIO84, AF2, DRIVE_HIGH)
133#define GPIO85_KP_MKOUT_2 MFP_CFG_LPM(GPIO85, AF2, DRIVE_HIGH)
134#define GPIO86_KP_MKOUT_3 MFP_CFG_LPM(GPIO86, AF2, DRIVE_HIGH)
135#define GPIO13_KP_MKOUT_4 MFP_CFG_LPM(GPIO13, AF3, DRIVE_HIGH)
136#define GPIO14_KP_MKOUT_5 MFP_CFG_LPM(GPIO14, AF3, DRIVE_HIGH)
137
138#define GPIO121_KP_MKOUT_0 MFP_CFG_LPM(GPIO121, AF1, DRIVE_HIGH)
139#define GPIO122_KP_MKOUT_1 MFP_CFG_LPM(GPIO122, AF1, DRIVE_HIGH)
140#define GPIO123_KP_MKOUT_2 MFP_CFG_LPM(GPIO123, AF1, DRIVE_HIGH)
141#define GPIO124_KP_MKOUT_3 MFP_CFG_LPM(GPIO124, AF1, DRIVE_HIGH)
142#define GPIO125_KP_MKOUT_4 MFP_CFG_LPM(GPIO125, AF1, DRIVE_HIGH)
143#define GPIO126_KP_MKOUT_5 MFP_CFG_LPM(GPIO126, AF1, DRIVE_HIGH)
144#define GPIO127_KP_MKOUT_6 MFP_CFG_LPM(GPIO127, AF1, DRIVE_HIGH)
145#define GPIO5_2_KP_MKOUT_7 MFP_CFG_LPM(GPIO5_2, AF1, DRIVE_HIGH)
146
147/* LCD */
148#define GPIO6_2_LCD_LDD_0 MFP_CFG_DRV(GPIO6_2, AF1, DS01X)
149#define GPIO7_2_LCD_LDD_1 MFP_CFG_DRV(GPIO7_2, AF1, DS01X)
150#define GPIO8_2_LCD_LDD_2 MFP_CFG_DRV(GPIO8_2, AF1, DS01X)
151#define GPIO9_2_LCD_LDD_3 MFP_CFG_DRV(GPIO9_2, AF1, DS01X)
152#define GPIO10_2_LCD_LDD_4 MFP_CFG_DRV(GPIO10_2, AF1, DS01X)
153#define GPIO11_2_LCD_LDD_5 MFP_CFG_DRV(GPIO11_2, AF1, DS01X)
154#define GPIO12_2_LCD_LDD_6 MFP_CFG_DRV(GPIO12_2, AF1, DS01X)
155#define GPIO13_2_LCD_LDD_7 MFP_CFG_DRV(GPIO13_2, AF1, DS01X)
156#define GPIO63_LCD_LDD_8 MFP_CFG_DRV(GPIO63, AF1, DS01X)
157#define GPIO64_LCD_LDD_9 MFP_CFG_DRV(GPIO64, AF1, DS01X)
158#define GPIO65_LCD_LDD_10 MFP_CFG_DRV(GPIO65, AF1, DS01X)
159#define GPIO66_LCD_LDD_11 MFP_CFG_DRV(GPIO66, AF1, DS01X)
160#define GPIO67_LCD_LDD_12 MFP_CFG_DRV(GPIO67, AF1, DS01X)
161#define GPIO68_LCD_LDD_13 MFP_CFG_DRV(GPIO68, AF1, DS01X)
162#define GPIO69_LCD_LDD_14 MFP_CFG_DRV(GPIO69, AF1, DS01X)
163#define GPIO70_LCD_LDD_15 MFP_CFG_DRV(GPIO70, AF1, DS01X)
164#define GPIO71_LCD_LDD_16 MFP_CFG_DRV(GPIO71, AF1, DS01X)
165#define GPIO72_LCD_LDD_17 MFP_CFG_DRV(GPIO72, AF1, DS01X)
166#define GPIO73_LCD_CS_N MFP_CFG_DRV(GPIO73, AF2, DS01X)
167#define GPIO74_LCD_VSYNC MFP_CFG_DRV(GPIO74, AF2, DS01X)
168#define GPIO14_2_LCD_FCLK MFP_CFG_DRV(GPIO14_2, AF1, DS01X)
169#define GPIO15_2_LCD_LCLK MFP_CFG_DRV(GPIO15_2, AF1, DS01X)
170#define GPIO16_2_LCD_PCLK MFP_CFG_DRV(GPIO16_2, AF1, DS01X)
171#define GPIO17_2_LCD_BIAS MFP_CFG_DRV(GPIO17_2, AF1, DS01X)
172#define GPIO64_LCD_VSYNC MFP_CFG_DRV(GPIO64, AF2, DS01X)
173#define GPIO63_LCD_CS_N MFP_CFG_DRV(GPIO63, AF2, DS01X)
174
175#define GPIO6_2_MLCD_DD_0 MFP_CFG_DRV(GPIO6_2, AF7, DS08X)
176#define GPIO7_2_MLCD_DD_1 MFP_CFG_DRV(GPIO7_2, AF7, DS08X)
177#define GPIO8_2_MLCD_DD_2 MFP_CFG_DRV(GPIO8_2, AF7, DS08X)
178#define GPIO9_2_MLCD_DD_3 MFP_CFG_DRV(GPIO9_2, AF7, DS08X)
179#define GPIO10_2_MLCD_DD_4 MFP_CFG_DRV(GPIO10_2, AF7, DS08X)
180#define GPIO11_2_MLCD_DD_5 MFP_CFG_DRV(GPIO11_2, AF7, DS08X)
181#define GPIO12_2_MLCD_DD_6 MFP_CFG_DRV(GPIO12_2, AF7, DS08X)
182#define GPIO13_2_MLCD_DD_7 MFP_CFG_DRV(GPIO13_2, AF7, DS08X)
183#define GPIO63_MLCD_DD_8 MFP_CFG_DRV(GPIO63, AF7, DS08X)
184#define GPIO64_MLCD_DD_9 MFP_CFG_DRV(GPIO64, AF7, DS08X)
185#define GPIO65_MLCD_DD_10 MFP_CFG_DRV(GPIO65, AF7, DS08X)
186#define GPIO66_MLCD_DD_11 MFP_CFG_DRV(GPIO66, AF7, DS08X)
187#define GPIO67_MLCD_DD_12 MFP_CFG_DRV(GPIO67, AF7, DS08X)
188#define GPIO68_MLCD_DD_13 MFP_CFG_DRV(GPIO68, AF7, DS08X)
189#define GPIO69_MLCD_DD_14 MFP_CFG_DRV(GPIO69, AF7, DS08X)
190#define GPIO70_MLCD_DD_15 MFP_CFG_DRV(GPIO70, AF7, DS08X)
191#define GPIO71_MLCD_DD_16 MFP_CFG_DRV(GPIO71, AF7, DS08X)
192#define GPIO72_MLCD_DD_17 MFP_CFG_DRV(GPIO72, AF7, DS08X)
193#define GPIO73_MLCD_CS MFP_CFG_DRV(GPIO73, AF7, DS08X)
194#define GPIO74_MLCD_VSYNC MFP_CFG_DRV(GPIO74, AF7, DS08X)
195#define GPIO14_2_MLCD_FCLK MFP_CFG_DRV(GPIO14_2, AF7, DS08X)
196#define GPIO15_2_MLCD_LCLK MFP_CFG_DRV(GPIO15_2, AF7, DS08X)
197#define GPIO16_2_MLCD_PCLK MFP_CFG_DRV(GPIO16_2, AF7, DS08X)
198#define GPIO17_2_MLCD_BIAS MFP_CFG_DRV(GPIO17_2, AF7, DS08X)
199
200/* MMC1 */
201#define GPIO9_MMC1_CMD MFP_CFG_LPM(GPIO9, AF4, DRIVE_HIGH)
202#define GPIO22_MMC1_CLK MFP_CFG_LPM(GPIO22, AF4, DRIVE_HIGH)
203#define GPIO23_MMC1_CMD MFP_CFG_LPM(GPIO23, AF4, DRIVE_HIGH)
204#define GPIO30_MMC1_CLK MFP_CFG_LPM(GPIO30, AF4, DRIVE_HIGH)
205#define GPIO31_MMC1_CMD MFP_CFG_LPM(GPIO31, AF4, DRIVE_HIGH)
206#define GPIO5_MMC1_DAT0 MFP_CFG_LPM(GPIO5, AF4, DRIVE_HIGH)
207#define GPIO6_MMC1_DAT1 MFP_CFG_LPM(GPIO6, AF4, DRIVE_HIGH)
208#define GPIO7_MMC1_DAT2 MFP_CFG_LPM(GPIO7, AF4, DRIVE_HIGH)
209#define GPIO8_MMC1_DAT3 MFP_CFG_LPM(GPIO8, AF4, DRIVE_HIGH)
210#define GPIO18_MMC1_DAT0 MFP_CFG_LPM(GPIO18, AF4, DRIVE_HIGH)
211#define GPIO19_MMC1_DAT1 MFP_CFG_LPM(GPIO19, AF4, DRIVE_HIGH)
212#define GPIO20_MMC1_DAT2 MFP_CFG_LPM(GPIO20, AF4, DRIVE_HIGH)
213#define GPIO21_MMC1_DAT3 MFP_CFG_LPM(GPIO21, AF4, DRIVE_HIGH)
214
215#define GPIO28_MMC2_CLK MFP_CFG_LPM(GPIO28, AF4, PULL_HIGH)
216#define GPIO29_MMC2_CMD MFP_CFG_LPM(GPIO29, AF4, PULL_HIGH)
217#define GPIO30_MMC2_CLK MFP_CFG_LPM(GPIO30, AF3, PULL_HIGH)
218#define GPIO31_MMC2_CMD MFP_CFG_LPM(GPIO31, AF3, PULL_HIGH)
219#define GPIO79_MMC2_CLK MFP_CFG_LPM(GPIO79, AF4, PULL_HIGH)
220#define GPIO80_MMC2_CMD MFP_CFG_LPM(GPIO80, AF4, PULL_HIGH)
221
222#define GPIO5_MMC2_DAT0 MFP_CFG_LPM(GPIO5, AF2, PULL_HIGH)
223#define GPIO6_MMC2_DAT1 MFP_CFG_LPM(GPIO6, AF2, PULL_HIGH)
224#define GPIO7_MMC2_DAT2 MFP_CFG_LPM(GPIO7, AF2, PULL_HIGH)
225#define GPIO8_MMC2_DAT3 MFP_CFG_LPM(GPIO8, AF2, PULL_HIGH)
226#define GPIO24_MMC2_DAT0 MFP_CFG_LPM(GPIO24, AF4, PULL_HIGH)
227#define GPIO75_MMC2_DAT0 MFP_CFG_LPM(GPIO75, AF4, PULL_HIGH)
228#define GPIO25_MMC2_DAT1 MFP_CFG_LPM(GPIO25, AF4, PULL_HIGH)
229#define GPIO76_MMC2_DAT1 MFP_CFG_LPM(GPIO76, AF4, PULL_HIGH)
230#define GPIO26_MMC2_DAT2 MFP_CFG_LPM(GPIO26, AF4, PULL_HIGH)
231#define GPIO77_MMC2_DAT2 MFP_CFG_LPM(GPIO77, AF4, PULL_HIGH)
232#define GPIO27_MMC2_DAT3 MFP_CFG_LPM(GPIO27, AF4, PULL_HIGH)
233#define GPIO78_MMC2_DAT3 MFP_CFG_LPM(GPIO78, AF4, PULL_HIGH)
234
235/* 1-Wire */
236#define GPIO14_ONE_WIRE MFP_CFG_LPM(GPIO14, AF5, FLOAT)
237#define GPIO0_2_ONE_WIRE MFP_CFG_LPM(GPIO0_2, AF2, FLOAT)
238
239/* SSP1 */
240#define GPIO87_SSP1_EXTCLK MFP_CFG(GPIO87, AF1)
241#define GPIO88_SSP1_SYSCLK MFP_CFG(GPIO88, AF1)
242#define GPIO83_SSP1_SCLK MFP_CFG(GPIO83, AF1)
243#define GPIO84_SSP1_SFRM MFP_CFG(GPIO84, AF1)
244#define GPIO85_SSP1_RXD MFP_CFG(GPIO85, AF6)
245#define GPIO85_SSP1_TXD MFP_CFG(GPIO85, AF1)
246#define GPIO86_SSP1_RXD MFP_CFG(GPIO86, AF1)
247#define GPIO86_SSP1_TXD MFP_CFG(GPIO86, AF6)
248
249/* SSP2 */
250#define GPIO39_SSP2_EXTCLK MFP_CFG(GPIO39, AF2)
251#define GPIO40_SSP2_SYSCLK MFP_CFG(GPIO40, AF2)
252#define GPIO12_SSP2_SCLK MFP_CFG(GPIO12, AF2)
253#define GPIO35_SSP2_SCLK MFP_CFG(GPIO35, AF2)
254#define GPIO36_SSP2_SFRM MFP_CFG(GPIO36, AF2)
255#define GPIO37_SSP2_RXD MFP_CFG(GPIO37, AF5)
256#define GPIO37_SSP2_TXD MFP_CFG(GPIO37, AF2)
257#define GPIO38_SSP2_RXD MFP_CFG(GPIO38, AF2)
258#define GPIO38_SSP2_TXD MFP_CFG(GPIO38, AF5)
259
260#define GPIO69_SSP3_SCLK MFP_CFG(GPIO69, AF2, DS08X, FLOAT)
261#define GPIO70_SSP3_FRM MFP_CFG(GPIO70, AF2, DS08X, DRIVE_LOW)
262#define GPIO89_SSP3_SCLK MFP_CFG(GPIO89, AF1, DS08X, FLOAT)
263#define GPIO90_SSP3_FRM MFP_CFG(GPIO90, AF1, DS08X, DRIVE_LOW)
264#define GPIO71_SSP3_RXD MFP_CFG_X(GPIO71, AF5, DS08X, FLOAT)
265#define GPIO71_SSP3_TXD MFP_CFG_X(GPIO71, AF2, DS08X, DRIVE_LOW)
266#define GPIO72_SSP3_RXD MFP_CFG_X(GPIO72, AF2, DS08X, FLOAT)
267#define GPIO72_SSP3_TXD MFP_CFG_X(GPIO72, AF5, DS08X, DRIVE_LOW)
268#define GPIO91_SSP3_RXD MFP_CFG_X(GPIO91, AF5, DS08X, FLOAT)
269#define GPIO91_SSP3_TXD MFP_CFG_X(GPIO91, AF1, DS08X, DRIVE_LOW)
270#define GPIO92_SSP3_RXD MFP_CFG_X(GPIO92, AF1, DS08X, FLOAT)
271#define GPIO92_SSP3_TXD MFP_CFG_X(GPIO92, AF5, DS08X, DRIVE_LOW)
272
273#define GPIO93_SSP4_SCLK MFP_CFG_LPM(GPIO93, AF1, PULL_HIGH)
274#define GPIO94_SSP4_FRM MFP_CFG_LPM(GPIO94, AF1, PULL_HIGH)
275#define GPIO94_SSP4_RXD MFP_CFG_LPM(GPIO94, AF5, PULL_HIGH)
276#define GPIO95_SSP4_RXD MFP_CFG_LPM(GPIO95, AF5, PULL_HIGH)
277#define GPIO95_SSP4_TXD MFP_CFG_LPM(GPIO95, AF1, PULL_HIGH)
278#define GPIO96_SSP4_RXD MFP_CFG_LPM(GPIO96, AF1, PULL_HIGH)
279#define GPIO96_SSP4_TXD MFP_CFG_LPM(GPIO96, AF5, PULL_HIGH)
280
281/* UART1 */
282#define GPIO41_UART1_RXD MFP_CFG_LPM(GPIO41, AF2, FLOAT)
283#define GPIO41_UART1_TXD MFP_CFG_LPM(GPIO41, AF4, FLOAT)
284#define GPIO42_UART1_RXD MFP_CFG_LPM(GPIO42, AF4, FLOAT)
285#define GPIO42_UART1_TXD MFP_CFG_LPM(GPIO42, AF2, FLOAT)
286#define GPIO97_UART1_RXD MFP_CFG_LPM(GPIO97, AF1, FLOAT)
287#define GPIO97_UART1_TXD MFP_CFG_LPM(GPIO97, AF6, FLOAT)
288#define GPIO98_UART1_RXD MFP_CFG_LPM(GPIO98, AF6, FLOAT)
289#define GPIO98_UART1_TXD MFP_CFG_LPM(GPIO98, AF1, FLOAT)
290#define GPIO43_UART1_CTS MFP_CFG_LPM(GPIO43, AF2, FLOAT)
291#define GPIO43_UART1_RTS MFP_CFG_LPM(GPIO43, AF4, FLOAT)
292#define GPIO48_UART1_CTS MFP_CFG_LPM(GPIO48, AF4, FLOAT)
293#define GPIO48_UART1_RTS MFP_CFG_LPM(GPIO48, AF2, FLOAT)
294#define GPIO99_UART1_CTS MFP_CFG_LPM(GPIO99, AF1, FLOAT)
295#define GPIO99_UART1_RTS MFP_CFG_LPM(GPIO99, AF6, FLOAT)
296#define GPIO104_UART1_CTS MFP_CFG_LPM(GPIO104, AF6, FLOAT)
297#define GPIO104_UART1_RTS MFP_CFG_LPM(GPIO104, AF1, FLOAT)
298#define GPIO45_UART1_DTR MFP_CFG_LPM(GPIO45, AF4, FLOAT)
299#define GPIO45_UART1_DSR MFP_CFG_LPM(GPIO45, AF2, FLOAT)
300#define GPIO47_UART1_DTR MFP_CFG_LPM(GPIO47, AF2, FLOAT)
301#define GPIO47_UART1_DSR MFP_CFG_LPM(GPIO47, AF4, FLOAT)
302#define GPIO101_UART1_DTR MFP_CFG_LPM(GPIO101, AF6, FLOAT)
303#define GPIO101_UART1_DSR MFP_CFG_LPM(GPIO101, AF1, FLOAT)
304#define GPIO103_UART1_DTR MFP_CFG_LPM(GPIO103, AF1, FLOAT)
305#define GPIO103_UART1_DSR MFP_CFG_LPM(GPIO103, AF6, FLOAT)
306#define GPIO44_UART1_DCD MFP_CFG_LPM(GPIO44, AF2, FLOAT)
307#define GPIO100_UART1_DCD MFP_CFG_LPM(GPIO100, AF1, FLOAT)
308#define GPIO46_UART1_RI MFP_CFG_LPM(GPIO46, AF2, FLOAT)
309#define GPIO102_UART1_RI MFP_CFG_LPM(GPIO102, AF1, FLOAT)
310
311/* UART2 */
312#define GPIO109_UART2_CTS MFP_CFG_LPM(GPIO109, AF3, FLOAT)
313#define GPIO109_UART2_RTS MFP_CFG_LPM(GPIO109, AF1, FLOAT)
314#define GPIO112_UART2_CTS MFP_CFG_LPM(GPIO112, AF1, FLOAT)
315#define GPIO112_UART2_RTS MFP_CFG_LPM(GPIO112, AF3, FLOAT)
316#define GPIO110_UART2_RXD MFP_CFG_LPM(GPIO110, AF1, FLOAT)
317#define GPIO110_UART2_TXD MFP_CFG_LPM(GPIO110, AF3, FLOAT)
318#define GPIO111_UART2_RXD MFP_CFG_LPM(GPIO111, AF3, FLOAT)
319#define GPIO111_UART2_TXD MFP_CFG_LPM(GPIO111, AF1, FLOAT)
320
321/* UART3 */
322#define GPIO89_UART3_CTS MFP_CFG_LPM(GPIO89, AF2, FLOAT)
323#define GPIO89_UART3_RTS MFP_CFG_LPM(GPIO89, AF4, FLOAT)
324#define GPIO90_UART3_CTS MFP_CFG_LPM(GPIO90, AF4, FLOAT)
325#define GPIO90_UART3_RTS MFP_CFG_LPM(GPIO90, AF2, FLOAT)
326#define GPIO105_UART3_CTS MFP_CFG_LPM(GPIO105, AF1, FLOAT)
327#define GPIO105_UART3_RTS MFP_CFG_LPM(GPIO105, AF3, FLOAT)
328#define GPIO106_UART3_CTS MFP_CFG_LPM(GPIO106, AF3, FLOAT)
329#define GPIO106_UART3_RTS MFP_CFG_LPM(GPIO106, AF1, FLOAT)
330#define GPIO30_UART3_RXD MFP_CFG_LPM(GPIO30, AF2, FLOAT)
331#define GPIO30_UART3_TXD MFP_CFG_LPM(GPIO30, AF6, FLOAT)
332#define GPIO31_UART3_RXD MFP_CFG_LPM(GPIO31, AF6, FLOAT)
333#define GPIO31_UART3_TXD MFP_CFG_LPM(GPIO31, AF2, FLOAT)
334#define GPIO91_UART3_RXD MFP_CFG_LPM(GPIO91, AF4, FLOAT)
335#define GPIO91_UART3_TXD MFP_CFG_LPM(GPIO91, AF2, FLOAT)
336#define GPIO92_UART3_RXD MFP_CFG_LPM(GPIO92, AF2, FLOAT)
337#define GPIO92_UART3_TXD MFP_CFG_LPM(GPIO92, AF4, FLOAT)
338#define GPIO107_UART3_RXD MFP_CFG_LPM(GPIO107, AF3, FLOAT)
339#define GPIO107_UART3_TXD MFP_CFG_LPM(GPIO107, AF1, FLOAT)
340#define GPIO108_UART3_RXD MFP_CFG_LPM(GPIO108, AF1, FLOAT)
341#define GPIO108_UART3_TXD MFP_CFG_LPM(GPIO108, AF3, FLOAT)
342
343
344/* USB 2.0 UTMI */
345#define GPIO10_UTM_CLK MFP_CFG(GPIO10, AF1)
346#define GPIO36_U2D_RXERROR MFP_CFG(GPIO36, AF3)
347#define GPIO60_U2D_RXERROR MFP_CFG(GPIO60, AF1)
348#define GPIO87_U2D_RXERROR MFP_CFG(GPIO87, AF5)
349#define GPIO34_UTM_RXVALID MFP_CFG(GPIO34, AF3)
350#define GPIO58_UTM_RXVALID MFP_CFG(GPIO58, AF2)
351#define GPIO85_UTM_RXVALID MFP_CFG(GPIO85, AF5)
352#define GPIO35_UTM_RXACTIVE MFP_CFG(GPIO35, AF3)
353#define GPIO59_UTM_RXACTIVE MFP_CFG(GPIO59, AF1)
354#define GPIO86_UTM_RXACTIVE MFP_CFG(GPIO86, AF5)
355#define GPIO73_UTM_TXREADY MFP_CFG(GPIO73, AF1)
356#define GPIO68_UTM_LINESTATE_0 MFP_CFG(GPIO68, AF3)
357#define GPIO90_UTM_LINESTATE_0 MFP_CFG(GPIO90, AF3)
358#define GPIO102_UTM_LINESTATE_0 MFP_CFG(GPIO102, AF3)
359#define GPIO107_UTM_LINESTATE_0 MFP_CFG(GPIO107, AF4)
360#define GPIO69_UTM_LINESTATE_1 MFP_CFG(GPIO69, AF3)
361#define GPIO91_UTM_LINESTATE_1 MFP_CFG(GPIO91, AF3)
362#define GPIO103_UTM_LINESTATE_1 MFP_CFG(GPIO103, AF3)
363
364#define GPIO41_U2D_PHYDATA_0 MFP_CFG(GPIO41, AF3)
365#define GPIO42_U2D_PHYDATA_1 MFP_CFG(GPIO42, AF3)
366#define GPIO43_U2D_PHYDATA_2 MFP_CFG(GPIO43, AF3)
367#define GPIO44_U2D_PHYDATA_3 MFP_CFG(GPIO44, AF3)
368#define GPIO45_U2D_PHYDATA_4 MFP_CFG(GPIO45, AF3)
369#define GPIO46_U2D_PHYDATA_5 MFP_CFG(GPIO46, AF3)
370#define GPIO47_U2D_PHYDATA_6 MFP_CFG(GPIO47, AF3)
371#define GPIO48_U2D_PHYDATA_7 MFP_CFG(GPIO48, AF3)
372
373#define GPIO49_U2D_PHYDATA_0 MFP_CFG(GPIO49, AF3)
374#define GPIO50_U2D_PHYDATA_1 MFP_CFG(GPIO50, AF3)
375#define GPIO51_U2D_PHYDATA_2 MFP_CFG(GPIO51, AF3)
376#define GPIO52_U2D_PHYDATA_3 MFP_CFG(GPIO52, AF3)
377#define GPIO53_U2D_PHYDATA_4 MFP_CFG(GPIO53, AF3)
378#define GPIO54_U2D_PHYDATA_5 MFP_CFG(GPIO54, AF3)
379#define GPIO55_U2D_PHYDATA_6 MFP_CFG(GPIO55, AF3)
380#define GPIO56_U2D_PHYDATA_7 MFP_CFG(GPIO56, AF3)
381
382#define GPIO37_U2D_OPMODE0 MFP_CFG(GPIO37, AF4)
383#define GPIO61_U2D_OPMODE0 MFP_CFG(GPIO61, AF2)
384#define GPIO88_U2D_OPMODE0 MFP_CFG(GPIO88, AF7)
385
386#define GPIO38_U2D_OPMODE1 MFP_CFG(GPIO38, AF4)
387#define GPIO62_U2D_OPMODE1 MFP_CFG(GPIO62, AF2)
388#define GPIO104_U2D_OPMODE1 MFP_CFG(GPIO104, AF4)
389#define GPIO108_U2D_OPMODE1 MFP_CFG(GPIO108, AF5)
390
391#define GPIO74_U2D_RESET MFP_CFG(GPIO74, AF1)
392#define GPIO93_U2D_RESET MFP_CFG(GPIO93, AF2)
393#define GPIO98_U2D_RESET MFP_CFG(GPIO98, AF3)
394
395#define GPIO67_U2D_SUSPEND MFP_CFG(GPIO67, AF3)
396#define GPIO96_U2D_SUSPEND MFP_CFG(GPIO96, AF2)
397#define GPIO101_U2D_SUSPEND MFP_CFG(GPIO101, AF3)
398
399#define GPIO66_U2D_TERM_SEL MFP_CFG(GPIO66, AF5)
400#define GPIO95_U2D_TERM_SEL MFP_CFG(GPIO95, AF3)
401#define GPIO97_U2D_TERM_SEL MFP_CFG(GPIO97, AF7)
402#define GPIO100_U2D_TERM_SEL MFP_CFG(GPIO100, AF5)
403
404#define GPIO39_U2D_TXVALID MFP_CFG(GPIO39, AF4)
405#define GPIO70_U2D_TXVALID MFP_CFG(GPIO70, AF5)
406#define GPIO83_U2D_TXVALID MFP_CFG(GPIO83, AF7)
407
408#define GPIO65_U2D_XCVR_SEL MFP_CFG(GPIO65, AF5)
409#define GPIO94_U2D_XCVR_SEL MFP_CFG(GPIO94, AF3)
410#define GPIO99_U2D_XCVR_SEL MFP_CFG(GPIO99, AF5)
411
412/* USB Host 1.1 */
413#define GPIO2_2_USBH_PEN MFP_CFG(GPIO2_2, AF1)
414#define GPIO3_2_USBH_PWR MFP_CFG(GPIO3_2, AF1)
415
416/* USB P2 */
417#define GPIO97_USB_P2_2 MFP_CFG(GPIO97, AF2)
418#define GPIO97_USB_P2_6 MFP_CFG(GPIO97, AF4)
419#define GPIO98_USB_P2_2 MFP_CFG(GPIO98, AF4)
420#define GPIO98_USB_P2_6 MFP_CFG(GPIO98, AF2)
421#define GPIO99_USB_P2_1 MFP_CFG(GPIO99, AF2)
422#define GPIO100_USB_P2_4 MFP_CFG(GPIO100, AF2)
423#define GPIO101_USB_P2_8 MFP_CFG(GPIO101, AF2)
424#define GPIO102_USB_P2_3 MFP_CFG(GPIO102, AF2)
425#define GPIO103_USB_P2_5 MFP_CFG(GPIO103, AF2)
426#define GPIO104_USB_P2_7 MFP_CFG(GPIO104, AF2)
427
428/* USB P3 */
429#define GPIO75_USB_P3_1 MFP_CFG(GPIO75, AF2)
430#define GPIO76_USB_P3_2 MFP_CFG(GPIO76, AF2)
431#define GPIO77_USB_P3_3 MFP_CFG(GPIO77, AF2)
432#define GPIO78_USB_P3_4 MFP_CFG(GPIO78, AF2)
433#define GPIO79_USB_P3_5 MFP_CFG(GPIO79, AF2)
434#define GPIO80_USB_P3_6 MFP_CFG(GPIO80, AF2)
435
436#define GPIO13_CHOUT0 MFP_CFG(GPIO13, AF6)
437#define GPIO14_CHOUT1 MFP_CFG(GPIO14, AF6)
438
439#define GPIO2_RDY MFP_CFG(GPIO2, AF1)
440#define GPIO5_NPIOR MFP_CFG(GPIO5, AF3)
441
442#define GPIO11_PWM0_OUT MFP_CFG(GPIO11, AF1)
443#define GPIO12_PWM1_OUT MFP_CFG(GPIO12, AF1)
444#define GPIO13_PWM2_OUT MFP_CFG(GPIO13, AF1)
445#define GPIO14_PWM3_OUT MFP_CFG(GPIO14, AF1)
446
447#endif /* __ASM_ARCH_MFP_PXA320_H */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h b/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h
new file mode 100644
index 000000000000..1f6b35c015d0
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h
@@ -0,0 +1,252 @@
1#ifndef __ASM_ARCH_MFP_PXA3XX_H
2#define __ASM_ARCH_MFP_PXA3XX_H
3
4#define MFPR_BASE (0x40e10000)
5#define MFPR_SIZE (PAGE_SIZE)
6
7/* MFPR register bit definitions */
8#define MFPR_PULL_SEL (0x1 << 15)
9#define MFPR_PULLUP_EN (0x1 << 14)
10#define MFPR_PULLDOWN_EN (0x1 << 13)
11#define MFPR_SLEEP_SEL (0x1 << 9)
12#define MFPR_SLEEP_OE_N (0x1 << 7)
13#define MFPR_EDGE_CLEAR (0x1 << 6)
14#define MFPR_EDGE_FALL_EN (0x1 << 5)
15#define MFPR_EDGE_RISE_EN (0x1 << 4)
16
17#define MFPR_SLEEP_DATA(x) ((x) << 8)
18#define MFPR_DRIVE(x) (((x) & 0x7) << 10)
19#define MFPR_AF_SEL(x) (((x) & 0x7) << 0)
20
21#define MFPR_EDGE_NONE (0)
22#define MFPR_EDGE_RISE (MFPR_EDGE_RISE_EN)
23#define MFPR_EDGE_FALL (MFPR_EDGE_FALL_EN)
24#define MFPR_EDGE_BOTH (MFPR_EDGE_RISE | MFPR_EDGE_FALL)
25
26/*
27 * Table that determines the low power modes outputs, with actual settings
28 * used in parentheses for don't-care values. Except for the float output,
29 * the configured driven and pulled levels match, so if there is a need for
30 * non-LPM pulled output, the same configuration could probably be used.
31 *
32 * Output value sleep_oe_n sleep_data pullup_en pulldown_en pull_sel
33 * (bit 7) (bit 8) (bit 14) (bit 13) (bit 15)
34 *
35 * Input 0 X(0) X(0) X(0) 0
36 * Drive 0 0 0 0 X(1) 0
37 * Drive 1 0 1 X(1) 0 0
38 * Pull hi (1) 1 X(1) 1 0 0
39 * Pull lo (0) 1 X(0) 0 1 0
40 * Z (float) 1 X(0) 0 0 0
41 */
42#define MFPR_LPM_INPUT (0)
43#define MFPR_LPM_DRIVE_LOW (MFPR_SLEEP_DATA(0) | MFPR_PULLDOWN_EN)
44#define MFPR_LPM_DRIVE_HIGH (MFPR_SLEEP_DATA(1) | MFPR_PULLUP_EN)
45#define MFPR_LPM_PULL_LOW (MFPR_LPM_DRIVE_LOW | MFPR_SLEEP_OE_N)
46#define MFPR_LPM_PULL_HIGH (MFPR_LPM_DRIVE_HIGH | MFPR_SLEEP_OE_N)
47#define MFPR_LPM_FLOAT (MFPR_SLEEP_OE_N)
48#define MFPR_LPM_MASK (0xe080)
49
50/*
51 * The pullup and pulldown state of the MFP pin at run mode is by default
52 * determined by the selected alternate function. In case that some buggy
53 * devices need to override this default behavior, the definitions below
54 * indicates the setting of corresponding MFPR bits
55 *
56 * Definition pull_sel pullup_en pulldown_en
57 * MFPR_PULL_NONE 0 0 0
58 * MFPR_PULL_LOW 1 0 1
59 * MFPR_PULL_HIGH 1 1 0
60 * MFPR_PULL_BOTH 1 1 1
61 */
62#define MFPR_PULL_NONE (0)
63#define MFPR_PULL_LOW (MFPR_PULL_SEL | MFPR_PULLDOWN_EN)
64#define MFPR_PULL_BOTH (MFPR_PULL_LOW | MFPR_PULLUP_EN)
65#define MFPR_PULL_HIGH (MFPR_PULL_SEL | MFPR_PULLUP_EN)
66
67/* PXA3xx common MFP configurations - processor specific ones defined
68 * in mfp-pxa300.h and mfp-pxa320.h
69 */
70#define GPIO0_GPIO MFP_CFG(GPIO0, AF0)
71#define GPIO1_GPIO MFP_CFG(GPIO1, AF0)
72#define GPIO2_GPIO MFP_CFG(GPIO2, AF0)
73#define GPIO3_GPIO MFP_CFG(GPIO3, AF0)
74#define GPIO4_GPIO MFP_CFG(GPIO4, AF0)
75#define GPIO5_GPIO MFP_CFG(GPIO5, AF0)
76#define GPIO6_GPIO MFP_CFG(GPIO6, AF0)
77#define GPIO7_GPIO MFP_CFG(GPIO7, AF0)
78#define GPIO8_GPIO MFP_CFG(GPIO8, AF0)
79#define GPIO9_GPIO MFP_CFG(GPIO9, AF0)
80#define GPIO10_GPIO MFP_CFG(GPIO10, AF0)
81#define GPIO11_GPIO MFP_CFG(GPIO11, AF0)
82#define GPIO12_GPIO MFP_CFG(GPIO12, AF0)
83#define GPIO13_GPIO MFP_CFG(GPIO13, AF0)
84#define GPIO14_GPIO MFP_CFG(GPIO14, AF0)
85#define GPIO15_GPIO MFP_CFG(GPIO15, AF0)
86#define GPIO16_GPIO MFP_CFG(GPIO16, AF0)
87#define GPIO17_GPIO MFP_CFG(GPIO17, AF0)
88#define GPIO18_GPIO MFP_CFG(GPIO18, AF0)
89#define GPIO19_GPIO MFP_CFG(GPIO19, AF0)
90#define GPIO20_GPIO MFP_CFG(GPIO20, AF0)
91#define GPIO21_GPIO MFP_CFG(GPIO21, AF0)
92#define GPIO22_GPIO MFP_CFG(GPIO22, AF0)
93#define GPIO23_GPIO MFP_CFG(GPIO23, AF0)
94#define GPIO24_GPIO MFP_CFG(GPIO24, AF0)
95#define GPIO25_GPIO MFP_CFG(GPIO25, AF0)
96#define GPIO26_GPIO MFP_CFG(GPIO26, AF0)
97#define GPIO27_GPIO MFP_CFG(GPIO27, AF0)
98#define GPIO28_GPIO MFP_CFG(GPIO28, AF0)
99#define GPIO29_GPIO MFP_CFG(GPIO29, AF0)
100#define GPIO30_GPIO MFP_CFG(GPIO30, AF0)
101#define GPIO31_GPIO MFP_CFG(GPIO31, AF0)
102#define GPIO32_GPIO MFP_CFG(GPIO32, AF0)
103#define GPIO33_GPIO MFP_CFG(GPIO33, AF0)
104#define GPIO34_GPIO MFP_CFG(GPIO34, AF0)
105#define GPIO35_GPIO MFP_CFG(GPIO35, AF0)
106#define GPIO36_GPIO MFP_CFG(GPIO36, AF0)
107#define GPIO37_GPIO MFP_CFG(GPIO37, AF0)
108#define GPIO38_GPIO MFP_CFG(GPIO38, AF0)
109#define GPIO39_GPIO MFP_CFG(GPIO39, AF0)
110#define GPIO40_GPIO MFP_CFG(GPIO40, AF0)
111#define GPIO41_GPIO MFP_CFG(GPIO41, AF0)
112#define GPIO42_GPIO MFP_CFG(GPIO42, AF0)
113#define GPIO43_GPIO MFP_CFG(GPIO43, AF0)
114#define GPIO44_GPIO MFP_CFG(GPIO44, AF0)
115#define GPIO45_GPIO MFP_CFG(GPIO45, AF0)
116
117#define GPIO47_GPIO MFP_CFG(GPIO47, AF0)
118#define GPIO48_GPIO MFP_CFG(GPIO48, AF0)
119
120#define GPIO53_GPIO MFP_CFG(GPIO53, AF0)
121#define GPIO54_GPIO MFP_CFG(GPIO54, AF0)
122#define GPIO55_GPIO MFP_CFG(GPIO55, AF0)
123
124#define GPIO57_GPIO MFP_CFG(GPIO57, AF0)
125
126#define GPIO63_GPIO MFP_CFG(GPIO63, AF0)
127#define GPIO64_GPIO MFP_CFG(GPIO64, AF0)
128#define GPIO65_GPIO MFP_CFG(GPIO65, AF0)
129#define GPIO66_GPIO MFP_CFG(GPIO66, AF0)
130#define GPIO67_GPIO MFP_CFG(GPIO67, AF0)
131#define GPIO68_GPIO MFP_CFG(GPIO68, AF0)
132#define GPIO69_GPIO MFP_CFG(GPIO69, AF0)
133#define GPIO70_GPIO MFP_CFG(GPIO70, AF0)
134#define GPIO71_GPIO MFP_CFG(GPIO71, AF0)
135#define GPIO72_GPIO MFP_CFG(GPIO72, AF0)
136#define GPIO73_GPIO MFP_CFG(GPIO73, AF0)
137#define GPIO74_GPIO MFP_CFG(GPIO74, AF0)
138#define GPIO75_GPIO MFP_CFG(GPIO75, AF0)
139#define GPIO76_GPIO MFP_CFG(GPIO76, AF0)
140#define GPIO77_GPIO MFP_CFG(GPIO77, AF0)
141#define GPIO78_GPIO MFP_CFG(GPIO78, AF0)
142#define GPIO79_GPIO MFP_CFG(GPIO79, AF0)
143#define GPIO80_GPIO MFP_CFG(GPIO80, AF0)
144#define GPIO81_GPIO MFP_CFG(GPIO81, AF0)
145#define GPIO82_GPIO MFP_CFG(GPIO82, AF0)
146#define GPIO83_GPIO MFP_CFG(GPIO83, AF0)
147#define GPIO84_GPIO MFP_CFG(GPIO84, AF0)
148#define GPIO85_GPIO MFP_CFG(GPIO85, AF0)
149#define GPIO86_GPIO MFP_CFG(GPIO86, AF0)
150#define GPIO87_GPIO MFP_CFG(GPIO87, AF0)
151#define GPIO88_GPIO MFP_CFG(GPIO88, AF0)
152#define GPIO89_GPIO MFP_CFG(GPIO89, AF0)
153#define GPIO90_GPIO MFP_CFG(GPIO90, AF0)
154#define GPIO91_GPIO MFP_CFG(GPIO91, AF0)
155#define GPIO92_GPIO MFP_CFG(GPIO92, AF0)
156#define GPIO93_GPIO MFP_CFG(GPIO93, AF0)
157#define GPIO94_GPIO MFP_CFG(GPIO94, AF0)
158#define GPIO95_GPIO MFP_CFG(GPIO95, AF0)
159#define GPIO96_GPIO MFP_CFG(GPIO96, AF0)
160#define GPIO97_GPIO MFP_CFG(GPIO97, AF0)
161#define GPIO98_GPIO MFP_CFG(GPIO98, AF0)
162#define GPIO99_GPIO MFP_CFG(GPIO99, AF0)
163#define GPIO100_GPIO MFP_CFG(GPIO100, AF0)
164#define GPIO101_GPIO MFP_CFG(GPIO101, AF0)
165#define GPIO102_GPIO MFP_CFG(GPIO102, AF0)
166#define GPIO103_GPIO MFP_CFG(GPIO103, AF0)
167#define GPIO104_GPIO MFP_CFG(GPIO104, AF0)
168#define GPIO105_GPIO MFP_CFG(GPIO105, AF0)
169#define GPIO106_GPIO MFP_CFG(GPIO106, AF0)
170#define GPIO107_GPIO MFP_CFG(GPIO107, AF0)
171#define GPIO108_GPIO MFP_CFG(GPIO108, AF0)
172#define GPIO109_GPIO MFP_CFG(GPIO109, AF0)
173#define GPIO110_GPIO MFP_CFG(GPIO110, AF0)
174#define GPIO111_GPIO MFP_CFG(GPIO111, AF0)
175#define GPIO112_GPIO MFP_CFG(GPIO112, AF0)
176#define GPIO113_GPIO MFP_CFG(GPIO113, AF0)
177#define GPIO114_GPIO MFP_CFG(GPIO114, AF0)
178#define GPIO115_GPIO MFP_CFG(GPIO115, AF0)
179#define GPIO116_GPIO MFP_CFG(GPIO116, AF0)
180#define GPIO117_GPIO MFP_CFG(GPIO117, AF0)
181#define GPIO118_GPIO MFP_CFG(GPIO118, AF0)
182#define GPIO119_GPIO MFP_CFG(GPIO119, AF0)
183#define GPIO120_GPIO MFP_CFG(GPIO120, AF0)
184#define GPIO121_GPIO MFP_CFG(GPIO121, AF0)
185#define GPIO122_GPIO MFP_CFG(GPIO122, AF0)
186#define GPIO123_GPIO MFP_CFG(GPIO123, AF0)
187#define GPIO124_GPIO MFP_CFG(GPIO124, AF0)
188#define GPIO125_GPIO MFP_CFG(GPIO125, AF0)
189#define GPIO126_GPIO MFP_CFG(GPIO126, AF0)
190#define GPIO127_GPIO MFP_CFG(GPIO127, AF0)
191
192#define GPIO0_2_GPIO MFP_CFG(GPIO0_2, AF0)
193#define GPIO1_2_GPIO MFP_CFG(GPIO1_2, AF0)
194#define GPIO2_2_GPIO MFP_CFG(GPIO2_2, AF0)
195#define GPIO3_2_GPIO MFP_CFG(GPIO3_2, AF0)
196#define GPIO4_2_GPIO MFP_CFG(GPIO4_2, AF0)
197#define GPIO5_2_GPIO MFP_CFG(GPIO5_2, AF0)
198#define GPIO6_2_GPIO MFP_CFG(GPIO6_2, AF0)
199
200/*
201 * each MFP pin will have a MFPR register, since the offset of the
202 * register varies between processors, the processor specific code
203 * should initialize the pin offsets by pxa3xx_mfp_init_addr()
204 *
205 * pxa3xx_mfp_init_addr - accepts a table of "pxa3xx_mfp_addr_map"
206 * structure, which represents a range of MFP pins from "start" to
207 * "end", with the offset begining at "offset", to define a single
208 * pin, let "end" = -1
209 *
210 * use
211 *
212 * MFP_ADDR_X() to define a range of pins
213 * MFP_ADDR() to define a single pin
214 * MFP_ADDR_END to signal the end of pin offset definitions
215 */
216struct pxa3xx_mfp_addr_map {
217 unsigned int start;
218 unsigned int end;
219 unsigned long offset;
220};
221
222#define MFP_ADDR_X(start, end, offset) \
223 { MFP_PIN_##start, MFP_PIN_##end, offset }
224
225#define MFP_ADDR(pin, offset) \
226 { MFP_PIN_##pin, -1, offset }
227
228#define MFP_ADDR_END { MFP_PIN_INVALID, 0 }
229
230/*
231 * pxa3xx_mfp_read()/pxa3xx_mfp_write() - for direct read/write access
232 * to the MFPR register
233 */
234unsigned long pxa3xx_mfp_read(int mfp);
235void pxa3xx_mfp_write(int mfp, unsigned long mfpr_val);
236
237/*
238 * pxa3xx_mfp_config - configure the MFPR registers
239 *
240 * used by board specific initialization code
241 */
242void pxa3xx_mfp_config(unsigned long *mfp_cfgs, int num);
243
244/*
245 * pxa3xx_mfp_init_addr() - initialize the mapping between mfp pin
246 * index and MFPR register offset
247 *
248 * used by processor specific code
249 */
250void __init pxa3xx_mfp_init_addr(struct pxa3xx_mfp_addr_map *);
251void __init pxa3xx_init_mfp(void);
252#endif /* __ASM_ARCH_MFP_PXA3XX_H */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa930.h b/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
new file mode 100644
index 000000000000..fabd9b4df827
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
@@ -0,0 +1,491 @@
1/*
2 * arch/arm/mach-pxa/include/mach/mfp-pxa930.h
3 *
4 * PXA930 specific MFP configuration definitions
5 *
6 * Copyright (C) 2007-2008 Marvell International Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ASM_ARCH_MFP_PXA9xx_H
14#define __ASM_ARCH_MFP_PXA9xx_H
15
16#include <mach/mfp.h>
17#include <mach/mfp-pxa3xx.h>
18
19/* GPIO */
20#define GPIO46_GPIO MFP_CFG(GPIO46, AF0)
21#define GPIO49_GPIO MFP_CFG(GPIO49, AF0)
22#define GPIO50_GPIO MFP_CFG(GPIO50, AF0)
23#define GPIO51_GPIO MFP_CFG(GPIO51, AF0)
24#define GPIO52_GPIO MFP_CFG(GPIO52, AF0)
25#define GPIO56_GPIO MFP_CFG(GPIO56, AF0)
26#define GPIO58_GPIO MFP_CFG(GPIO58, AF0)
27#define GPIO59_GPIO MFP_CFG(GPIO59, AF0)
28#define GPIO60_GPIO MFP_CFG(GPIO60, AF0)
29#define GPIO61_GPIO MFP_CFG(GPIO61, AF0)
30#define GPIO62_GPIO MFP_CFG(GPIO62, AF0)
31
32#define GSIM_UCLK_GPIO_79 MFP_CFG(GSIM_UCLK, AF0)
33#define GSIM_UIO_GPIO_80 MFP_CFG(GSIM_UIO, AF0)
34#define GSIM_nURST_GPIO_81 MFP_CFG(GSIM_nURST, AF0)
35#define GSIM_UDET_GPIO_82 MFP_CFG(GSIM_UDET, AF0)
36
37#define DF_IO15_GPIO_28 MFP_CFG(DF_IO15, AF0)
38#define DF_IO14_GPIO_29 MFP_CFG(DF_IO14, AF0)
39#define DF_IO13_GPIO_30 MFP_CFG(DF_IO13, AF0)
40#define DF_IO12_GPIO_31 MFP_CFG(DF_IO12, AF0)
41#define DF_IO11_GPIO_32 MFP_CFG(DF_IO11, AF0)
42#define DF_IO10_GPIO_33 MFP_CFG(DF_IO10, AF0)
43#define DF_IO9_GPIO_34 MFP_CFG(DF_IO9, AF0)
44#define DF_IO8_GPIO_35 MFP_CFG(DF_IO8, AF0)
45#define DF_IO7_GPIO_36 MFP_CFG(DF_IO7, AF0)
46#define DF_IO6_GPIO_37 MFP_CFG(DF_IO6, AF0)
47#define DF_IO5_GPIO_38 MFP_CFG(DF_IO5, AF0)
48#define DF_IO4_GPIO_39 MFP_CFG(DF_IO4, AF0)
49#define DF_IO3_GPIO_40 MFP_CFG(DF_IO3, AF0)
50#define DF_IO2_GPIO_41 MFP_CFG(DF_IO2, AF0)
51#define DF_IO1_GPIO_42 MFP_CFG(DF_IO1, AF0)
52#define DF_IO0_GPIO_43 MFP_CFG(DF_IO0, AF0)
53#define DF_nCS0_GPIO_44 MFP_CFG(DF_nCS0, AF0)
54#define DF_nCS1_GPIO_45 MFP_CFG(DF_nCS1, AF0)
55#define DF_nWE_GPIO_46 MFP_CFG(DF_nWE, AF0)
56#define DF_nRE_nOE_GPIO_47 MFP_CFG(DF_nRE_nOE, AF0)
57#define DF_CLE_nOE_GPIO_48 MFP_CFG(DF_CLE_nOE, AF0)
58#define DF_nADV1_ALE_GPIO_49 MFP_CFG(DF_nADV1_ALE, AF0)
59#define DF_nADV2_ALE_GPIO_50 MFP_CFG(DF_nADV2_ALE, AF0)
60#define DF_INT_RnB_GPIO_51 MFP_CFG(DF_INT_RnB, AF0)
61#define DF_SCLK_E_GPIO_52 MFP_CFG(DF_SCLK_E, AF0)
62
63#define DF_ADDR0_GPIO_53 MFP_CFG(DF_ADDR0, AF0)
64#define DF_ADDR1_GPIO_54 MFP_CFG(DF_ADDR1, AF0)
65#define DF_ADDR2_GPIO_55 MFP_CFG(DF_ADDR2, AF0)
66#define DF_ADDR3_GPIO_56 MFP_CFG(DF_ADDR3, AF0)
67#define nXCVREN_GPIO_57 MFP_CFG(nXCVREN, AF0)
68#define nLUA_GPIO_58 MFP_CFG(nLUA, AF0)
69#define nLLA_GPIO_59 MFP_CFG(nLLA, AF0)
70#define nBE0_GPIO_60 MFP_CFG(nBE0, AF0)
71#define nBE1_GPIO_61 MFP_CFG(nBE1, AF0)
72#define RDY_GPIO_62 MFP_CFG(RDY, AF0)
73
74/* Chip Select */
75#define DF_nCS0_nCS2 MFP_CFG_LPM(DF_nCS0, AF3, PULL_HIGH)
76#define DF_nCS1_nCS3 MFP_CFG_LPM(DF_nCS1, AF3, PULL_HIGH)
77
78/* AC97 */
79#define GPIO83_BAC97_SYSCLK MFP_CFG(GPIO83, AF3)
80#define GPIO84_BAC97_SDATA_IN0 MFP_CFG(GPIO84, AF3)
81#define GPIO85_BAC97_BITCLK MFP_CFG(GPIO85, AF3)
82#define GPIO86_BAC97_nRESET MFP_CFG(GPIO86, AF3)
83#define GPIO87_BAC97_SYNC MFP_CFG(GPIO87, AF3)
84#define GPIO88_BAC97_SDATA_OUT MFP_CFG(GPIO88, AF3)
85
86/* I2C */
87#define GPIO39_CI2C_SCL MFP_CFG_LPM(GPIO39, AF3, PULL_HIGH)
88#define GPIO40_CI2C_SDA MFP_CFG_LPM(GPIO40, AF3, PULL_HIGH)
89
90#define GPIO51_CI2C_SCL MFP_CFG_LPM(GPIO51, AF3, PULL_HIGH)
91#define GPIO52_CI2C_SDA MFP_CFG_LPM(GPIO52, AF3, PULL_HIGH)
92
93#define GPIO63_CI2C_SCL MFP_CFG_LPM(GPIO63, AF4, PULL_HIGH)
94#define GPIO64_CI2C_SDA MFP_CFG_LPM(GPIO64, AF4, PULL_HIGH)
95
96#define GPIO77_CI2C_SCL MFP_CFG_LPM(GPIO77, AF2, PULL_HIGH)
97#define GPIO78_CI2C_SDA MFP_CFG_LPM(GPIO78, AF2, PULL_HIGH)
98
99#define GPIO89_CI2C_SCL MFP_CFG_LPM(GPIO89, AF1, PULL_HIGH)
100#define GPIO90_CI2C_SDA MFP_CFG_LPM(GPIO90, AF1, PULL_HIGH)
101
102#define GPIO95_CI2C_SCL MFP_CFG_LPM(GPIO95, AF1, PULL_HIGH)
103#define GPIO96_CI2C_SDA MFP_CFG_LPM(GPIO96, AF1, PULL_HIGH)
104
105#define GPIO97_CI2C_SCL MFP_CFG_LPM(GPIO97, AF3, PULL_HIGH)
106#define GPIO98_CI2C_SDA MFP_CFG_LPM(GPIO98, AF3, PULL_HIGH)
107
108/* QCI */
109#define GPIO63_CI_DD_9 MFP_CFG_LPM(GPIO63, AF1, PULL_LOW)
110#define GPIO64_CI_DD_8 MFP_CFG_LPM(GPIO64, AF1, PULL_LOW)
111#define GPIO65_CI_DD_7 MFP_CFG_LPM(GPIO65, AF1, PULL_LOW)
112#define GPIO66_CI_DD_6 MFP_CFG_LPM(GPIO66, AF1, PULL_LOW)
113#define GPIO67_CI_DD_5 MFP_CFG_LPM(GPIO67, AF1, PULL_LOW)
114#define GPIO68_CI_DD_4 MFP_CFG_LPM(GPIO68, AF1, PULL_LOW)
115#define GPIO69_CI_DD_3 MFP_CFG_LPM(GPIO69, AF1, PULL_LOW)
116#define GPIO70_CI_DD_2 MFP_CFG_LPM(GPIO70, AF1, PULL_LOW)
117#define GPIO71_CI_DD_1 MFP_CFG_LPM(GPIO71, AF1, PULL_LOW)
118#define GPIO72_CI_DD_0 MFP_CFG_LPM(GPIO72, AF1, PULL_LOW)
119#define GPIO73_CI_HSYNC MFP_CFG_LPM(GPIO73, AF1, PULL_LOW)
120#define GPIO74_CI_VSYNC MFP_CFG_LPM(GPIO74, AF1, PULL_LOW)
121#define GPIO75_CI_MCLK MFP_CFG_LPM(GPIO75, AF1, PULL_LOW)
122#define GPIO76_CI_PCLK MFP_CFG_LPM(GPIO76, AF1, PULL_LOW)
123
124/* KEYPAD */
125#define GPIO4_KP_DKIN_4 MFP_CFG_LPM(GPIO4, AF3, FLOAT)
126#define GPIO5_KP_DKIN_5 MFP_CFG_LPM(GPIO5, AF3, FLOAT)
127#define GPIO6_KP_DKIN_6 MFP_CFG_LPM(GPIO6, AF3, FLOAT)
128#define GPIO7_KP_DKIN_7 MFP_CFG_LPM(GPIO7, AF3, FLOAT)
129#define GPIO8_KP_DKIN_4 MFP_CFG_LPM(GPIO8, AF3, FLOAT)
130#define GPIO9_KP_DKIN_5 MFP_CFG_LPM(GPIO9, AF3, FLOAT)
131#define GPIO10_KP_DKIN_6 MFP_CFG_LPM(GPIO10, AF3, FLOAT)
132#define GPIO11_KP_DKIN_7 MFP_CFG_LPM(GPIO11, AF3, FLOAT)
133
134#define GPIO12_KP_DKIN_0 MFP_CFG_LPM(GPIO12, AF2, FLOAT)
135#define GPIO13_KP_DKIN_1 MFP_CFG_LPM(GPIO13, AF2, FLOAT)
136#define GPIO14_KP_DKIN_2 MFP_CFG_LPM(GPIO14, AF2, FLOAT)
137#define GPIO15_KP_DKIN_3 MFP_CFG_LPM(GPIO15, AF2, FLOAT)
138
139#define GPIO41_KP_DKIN_0 MFP_CFG_LPM(GPIO41, AF2, FLOAT)
140#define GPIO42_KP_DKIN_1 MFP_CFG_LPM(GPIO42, AF2, FLOAT)
141#define GPIO43_KP_DKIN_2 MFP_CFG_LPM(GPIO43, AF2, FLOAT)
142#define GPIO44_KP_DKIN_3 MFP_CFG_LPM(GPIO44, AF2, FLOAT)
143#define GPIO41_KP_DKIN_4 MFP_CFG_LPM(GPIO41, AF4, FLOAT)
144#define GPIO42_KP_DKIN_5 MFP_CFG_LPM(GPIO42, AF4, FLOAT)
145
146#define GPIO0_KP_MKIN_0 MFP_CFG_LPM(GPIO0, AF1, FLOAT)
147#define GPIO2_KP_MKIN_1 MFP_CFG_LPM(GPIO2, AF1, FLOAT)
148#define GPIO4_KP_MKIN_2 MFP_CFG_LPM(GPIO4, AF1, FLOAT)
149#define GPIO6_KP_MKIN_3 MFP_CFG_LPM(GPIO6, AF1, FLOAT)
150#define GPIO8_KP_MKIN_4 MFP_CFG_LPM(GPIO8, AF1, FLOAT)
151#define GPIO10_KP_MKIN_5 MFP_CFG_LPM(GPIO10, AF1, FLOAT)
152#define GPIO12_KP_MKIN_6 MFP_CFG_LPM(GPIO12, AF1, FLOAT)
153#define GPIO14_KP_MKIN_7 MFP_CFG(GPIO14, AF1)
154#define GPIO35_KP_MKIN_5 MFP_CFG(GPIO35, AF4)
155
156#define GPIO1_KP_MKOUT_0 MFP_CFG_LPM(GPIO1, AF1, DRIVE_HIGH)
157#define GPIO3_KP_MKOUT_1 MFP_CFG_LPM(GPIO3, AF1, DRIVE_HIGH)
158#define GPIO5_KP_MKOUT_2 MFP_CFG_LPM(GPIO5, AF1, DRIVE_HIGH)
159#define GPIO7_KP_MKOUT_3 MFP_CFG_LPM(GPIO7, AF1, DRIVE_HIGH)
160#define GPIO9_KP_MKOUT_4 MFP_CFG_LPM(GPIO9, AF1, DRIVE_HIGH)
161#define GPIO11_KP_MKOUT_5 MFP_CFG_LPM(GPIO11, AF1, DRIVE_HIGH)
162#define GPIO13_KP_MKOUT_6 MFP_CFG_LPM(GPIO13, AF1, DRIVE_HIGH)
163#define GPIO15_KP_MKOUT_7 MFP_CFG_LPM(GPIO15, AF1, DRIVE_HIGH)
164#define GPIO36_KP_MKOUT_5 MFP_CFG_LPM(GPIO36, AF4, DRIVE_HIGH)
165
166/* LCD */
167#define GPIO17_LCD_FCLK_RD MFP_CFG(GPIO17, AF1)
168#define GPIO18_LCD_LCLK_A0 MFP_CFG(GPIO18, AF1)
169#define GPIO19_LCD_PCLK_WR MFP_CFG(GPIO19, AF1)
170#define GPIO20_LCD_BIAS MFP_CFG(GPIO20, AF1)
171#define GPIO21_LCD_CS MFP_CFG(GPIO21, AF1)
172#define GPIO22_LCD_CS2 MFP_CFG(GPIO22, AF2)
173#define GPIO22_LCD_VSYNC MFP_CFG(GPIO22, AF1)
174#define GPIO23_LCD_DD0 MFP_CFG(GPIO23, AF1)
175#define GPIO24_LCD_DD1 MFP_CFG(GPIO24, AF1)
176#define GPIO25_LCD_DD2 MFP_CFG(GPIO25, AF1)
177#define GPIO26_LCD_DD3 MFP_CFG(GPIO26, AF1)
178#define GPIO27_LCD_DD4 MFP_CFG(GPIO27, AF1)
179#define GPIO28_LCD_DD5 MFP_CFG(GPIO28, AF1)
180#define GPIO29_LCD_DD6 MFP_CFG(GPIO29, AF1)
181#define GPIO30_LCD_DD7 MFP_CFG(GPIO30, AF1)
182#define GPIO31_LCD_DD8 MFP_CFG(GPIO31, AF1)
183#define GPIO32_LCD_DD9 MFP_CFG(GPIO32, AF1)
184#define GPIO33_LCD_DD10 MFP_CFG(GPIO33, AF1)
185#define GPIO34_LCD_DD11 MFP_CFG(GPIO34, AF1)
186#define GPIO35_LCD_DD12 MFP_CFG(GPIO35, AF1)
187#define GPIO36_LCD_DD13 MFP_CFG(GPIO36, AF1)
188#define GPIO37_LCD_DD14 MFP_CFG(GPIO37, AF1)
189#define GPIO38_LCD_DD15 MFP_CFG(GPIO38, AF1)
190#define GPIO39_LCD_DD16 MFP_CFG(GPIO39, AF1)
191#define GPIO40_LCD_DD17 MFP_CFG(GPIO40, AF1)
192#define GPIO41_LCD_CS2 MFP_CFG(GPIO41, AF3)
193#define GPIO42_LCD_VSYNC2 MFP_CFG(GPIO42, AF3)
194#define GPIO44_LCD_DD7 MFP_CFG(GPIO44, AF1)
195
196/* Mini-LCD */
197#define GPIO17_MLCD_FCLK MFP_CFG(GPIO17, AF3)
198#define GPIO18_MLCD_LCLK MFP_CFG(GPIO18, AF3)
199#define GPIO19_MLCD_PCLK MFP_CFG(GPIO19, AF3)
200#define GPIO20_MLCD_BIAS MFP_CFG(GPIO20, AF3)
201#define GPIO23_MLCD_DD0 MFP_CFG(GPIO23, AF3)
202#define GPIO24_MLCD_DD1 MFP_CFG(GPIO24, AF3)
203#define GPIO25_MLCD_DD2 MFP_CFG(GPIO25, AF3)
204#define GPIO26_MLCD_DD3 MFP_CFG(GPIO26, AF3)
205#define GPIO27_MLCD_DD4 MFP_CFG(GPIO27, AF3)
206#define GPIO28_MLCD_DD5 MFP_CFG(GPIO28, AF3)
207#define GPIO29_MLCD_DD6 MFP_CFG(GPIO29, AF3)
208#define GPIO30_MLCD_DD7 MFP_CFG(GPIO30, AF3)
209#define GPIO31_MLCD_DD8 MFP_CFG(GPIO31, AF3)
210#define GPIO32_MLCD_DD9 MFP_CFG(GPIO32, AF3)
211#define GPIO33_MLCD_DD10 MFP_CFG(GPIO33, AF3)
212#define GPIO34_MLCD_DD11 MFP_CFG(GPIO34, AF3)
213#define GPIO35_MLCD_DD12 MFP_CFG(GPIO35, AF3)
214#define GPIO36_MLCD_DD13 MFP_CFG(GPIO36, AF3)
215#define GPIO37_MLCD_DD14 MFP_CFG(GPIO37, AF3)
216#define GPIO38_MLCD_DD15 MFP_CFG(GPIO38, AF3)
217#define GPIO44_MLCD_DD7 MFP_CFG(GPIO44, AF5)
218
219/* MMC1 */
220#define GPIO10_MMC1_DAT3 MFP_CFG(GPIO10, AF4)
221#define GPIO11_MMC1_DAT2 MFP_CFG(GPIO11, AF4)
222#define GPIO12_MMC1_DAT1 MFP_CFG(GPIO12, AF4)
223#define GPIO13_MMC1_DAT0 MFP_CFG(GPIO13, AF4)
224#define GPIO14_MMC1_CMD MFP_CFG(GPIO14, AF4)
225#define GPIO15_MMC1_CLK MFP_CFG(GPIO15, AF4)
226#define GPIO55_MMC1_CMD MFP_CFG(GPIO55, AF3)
227#define GPIO56_MMC1_CLK MFP_CFG(GPIO56, AF3)
228#define GPIO57_MMC1_DAT0 MFP_CFG(GPIO57, AF3)
229#define GPIO58_MMC1_DAT1 MFP_CFG(GPIO58, AF3)
230#define GPIO59_MMC1_DAT2 MFP_CFG(GPIO59, AF3)
231#define GPIO60_MMC1_DAT3 MFP_CFG(GPIO60, AF3)
232
233#define DF_ADDR0_MMC1_CLK MFP_CFG(DF_ADDR0, AF2)
234#define DF_ADDR1_MMC1_CMD MFP_CFG(DF_ADDR1, AF2)
235#define DF_ADDR2_MMC1_DAT0 MFP_CFG(DF_ADDR2, AF2)
236#define DF_ADDR3_MMC1_DAT1 MFP_CFG(DF_ADDR3, AF3)
237#define nXCVREN_MMC1_DAT2 MFP_CFG(nXCVREN, AF2)
238
239/* MMC2 */
240#define GPIO31_MMC2_CMD MFP_CFG(GPIO31, AF7)
241#define GPIO32_MMC2_CLK MFP_CFG(GPIO32, AF7)
242#define GPIO33_MMC2_DAT0 MFP_CFG(GPIO33, AF7)
243#define GPIO34_MMC2_DAT1 MFP_CFG(GPIO34, AF7)
244#define GPIO35_MMC2_DAT2 MFP_CFG(GPIO35, AF7)
245#define GPIO36_MMC2_DAT3 MFP_CFG(GPIO36, AF7)
246
247#define GPIO101_MMC2_DAT3 MFP_CFG(GPIO101, AF1)
248#define GPIO102_MMC2_DAT2 MFP_CFG(GPIO102, AF1)
249#define GPIO103_MMC2_DAT1 MFP_CFG(GPIO103, AF1)
250#define GPIO104_MMC2_DAT0 MFP_CFG(GPIO104, AF1)
251#define GPIO105_MMC2_CMD MFP_CFG(GPIO105, AF1)
252#define GPIO106_MMC2_CLK MFP_CFG(GPIO106, AF1)
253
254#define DF_IO10_MMC2_DAT3 MFP_CFG(DF_IO10, AF3)
255#define DF_IO11_MMC2_DAT2 MFP_CFG(DF_IO11, AF3)
256#define DF_IO12_MMC2_DAT1 MFP_CFG(DF_IO12, AF3)
257#define DF_IO13_MMC2_DAT0 MFP_CFG(DF_IO13, AF3)
258#define DF_IO14_MMC2_CLK MFP_CFG(DF_IO14, AF3)
259#define DF_IO15_MMC2_CMD MFP_CFG(DF_IO15, AF3)
260
261/* BSSP1 */
262#define GPIO12_BSSP1_CLK MFP_CFG(GPIO12, AF3)
263#define GPIO13_BSSP1_FRM MFP_CFG(GPIO13, AF3)
264#define GPIO14_BSSP1_RXD MFP_CFG(GPIO14, AF3)
265#define GPIO15_BSSP1_TXD MFP_CFG(GPIO15, AF3)
266#define GPIO97_BSSP1_CLK MFP_CFG(GPIO97, AF5)
267#define GPIO98_BSSP1_FRM MFP_CFG(GPIO98, AF5)
268
269/* BSSP2 */
270#define GPIO84_BSSP2_SDATA_IN MFP_CFG(GPIO84, AF1)
271#define GPIO85_BSSP2_BITCLK MFP_CFG(GPIO85, AF1)
272#define GPIO86_BSSP2_SYSCLK MFP_CFG(GPIO86, AF1)
273#define GPIO87_BSSP2_SYNC MFP_CFG(GPIO87, AF1)
274#define GPIO88_BSSP2_DATA_OUT MFP_CFG(GPIO88, AF1)
275#define GPIO86_BSSP2_SDATA_IN MFP_CFG(GPIO86, AF4)
276
277/* BSSP3 */
278#define GPIO79_BSSP3_CLK MFP_CFG(GPIO79, AF1)
279#define GPIO80_BSSP3_FRM MFP_CFG(GPIO80, AF1)
280#define GPIO81_BSSP3_TXD MFP_CFG(GPIO81, AF1)
281#define GPIO82_BSSP3_RXD MFP_CFG(GPIO82, AF1)
282#define GPIO83_BSSP3_SYSCLK MFP_CFG(GPIO83, AF1)
283
284/* BSSP4 */
285#define GPIO43_BSSP4_CLK MFP_CFG(GPIO43, AF4)
286#define GPIO44_BSSP4_FRM MFP_CFG(GPIO44, AF4)
287#define GPIO45_BSSP4_TXD MFP_CFG(GPIO45, AF4)
288#define GPIO46_BSSP4_RXD MFP_CFG(GPIO46, AF4)
289
290#define GPIO51_BSSP4_CLK MFP_CFG(GPIO51, AF4)
291#define GPIO52_BSSP4_FRM MFP_CFG(GPIO52, AF4)
292#define GPIO53_BSSP4_TXD MFP_CFG(GPIO53, AF4)
293#define GPIO54_BSSP4_RXD MFP_CFG(GPIO54, AF4)
294
295/* GSSP1 */
296#define GPIO79_GSSP1_CLK MFP_CFG(GPIO79, AF2)
297#define GPIO80_GSSP1_FRM MFP_CFG(GPIO80, AF2)
298#define GPIO81_GSSP1_TXD MFP_CFG(GPIO81, AF2)
299#define GPIO82_GSSP1_RXD MFP_CFG(GPIO82, AF2)
300#define GPIO83_GSSP1_SYSCLK MFP_CFG(GPIO83, AF2)
301
302#define GPIO93_GSSP1_CLK MFP_CFG(GPIO93, AF4)
303#define GPIO94_GSSP1_FRM MFP_CFG(GPIO94, AF4)
304#define GPIO95_GSSP1_TXD MFP_CFG(GPIO95, AF4)
305#define GPIO96_GSSP1_RXD MFP_CFG(GPIO96, AF4)
306
307/* GSSP2 */
308#define GPIO47_GSSP2_CLK MFP_CFG(GPIO47, AF4)
309#define GPIO48_GSSP2_FRM MFP_CFG(GPIO48, AF4)
310#define GPIO49_GSSP2_RXD MFP_CFG(GPIO49, AF4)
311#define GPIO50_GSSP2_TXD MFP_CFG(GPIO50, AF4)
312
313#define GPIO69_GSSP2_CLK MFP_CFG(GPIO69, AF4)
314#define GPIO70_GSSP2_FRM MFP_CFG(GPIO70, AF4)
315#define GPIO71_GSSP2_RXD MFP_CFG(GPIO71, AF4)
316#define GPIO72_GSSP2_TXD MFP_CFG(GPIO72, AF4)
317
318#define GPIO84_GSSP2_RXD MFP_CFG(GPIO84, AF2)
319#define GPIO85_GSSP2_CLK MFP_CFG(GPIO85, AF2)
320#define GPIO86_GSSP2_SYSCLK MFP_CFG(GPIO86, AF2)
321#define GPIO87_GSSP2_FRM MFP_CFG(GPIO87, AF2)
322#define GPIO88_GSSP2_TXD MFP_CFG(GPIO88, AF2)
323#define GPIO86_GSSP2_RXD MFP_CFG(GPIO86, AF5)
324
325#define GPIO103_GSSP2_CLK MFP_CFG(GPIO103, AF2)
326#define GPIO104_GSSP2_FRM MFP_CFG(GPIO104, AF2)
327#define GPIO105_GSSP2_RXD MFP_CFG(GPIO105, AF2)
328#define GPIO106_GSSP2_TXD MFP_CFG(GPIO106, AF2)
329
330/* UART1 - FFUART */
331#define GPIO47_UART1_DSR_N MFP_CFG(GPIO47, AF1)
332#define GPIO48_UART1_DTR_N MFP_CFG(GPIO48, AF1)
333#define GPIO49_UART1_RI MFP_CFG(GPIO49, AF1)
334#define GPIO50_UART1_DCD MFP_CFG(GPIO50, AF1)
335#define GPIO51_UART1_CTS MFP_CFG(GPIO51, AF1)
336#define GPIO52_UART1_RTS MFP_CFG(GPIO52, AF1)
337#define GPIO53_UART1_RXD MFP_CFG(GPIO53, AF1)
338#define GPIO54_UART1_TXD MFP_CFG(GPIO54, AF1)
339
340#define GPIO63_UART1_TXD MFP_CFG(GPIO63, AF2)
341#define GPIO64_UART1_RXD MFP_CFG(GPIO64, AF2)
342#define GPIO65_UART1_DSR MFP_CFG(GPIO65, AF2)
343#define GPIO66_UART1_DTR MFP_CFG(GPIO66, AF2)
344#define GPIO67_UART1_RI MFP_CFG(GPIO67, AF2)
345#define GPIO68_UART1_DCD MFP_CFG(GPIO68, AF2)
346#define GPIO69_UART1_CTS MFP_CFG(GPIO69, AF2)
347#define GPIO70_UART1_RTS MFP_CFG(GPIO70, AF2)
348
349/* UART2 - BTUART */
350#define GPIO91_UART2_RXD MFP_CFG(GPIO91, AF1)
351#define GPIO92_UART2_TXD MFP_CFG(GPIO92, AF1)
352#define GPIO93_UART2_CTS MFP_CFG(GPIO93, AF1)
353#define GPIO94_UART2_RTS MFP_CFG(GPIO94, AF1)
354
355/* UART3 - STUART */
356#define GPIO43_UART3_RTS MFP_CFG(GPIO43, AF3)
357#define GPIO44_UART3_CTS MFP_CFG(GPIO44, AF3)
358#define GPIO45_UART3_RXD MFP_CFG(GPIO45, AF3)
359#define GPIO46_UART3_TXD MFP_CFG(GPIO46, AF3)
360
361#define GPIO75_UART3_RTS MFP_CFG(GPIO75, AF5)
362#define GPIO76_UART3_CTS MFP_CFG(GPIO76, AF5)
363#define GPIO77_UART3_TXD MFP_CFG(GPIO77, AF5)
364#define GPIO78_UART3_RXD MFP_CFG(GPIO78, AF5)
365
366/* DFI */
367#define DF_IO0_DF_IO0 MFP_CFG(DF_IO0, AF2)
368#define DF_IO1_DF_IO1 MFP_CFG(DF_IO1, AF2)
369#define DF_IO2_DF_IO2 MFP_CFG(DF_IO2, AF2)
370#define DF_IO3_DF_IO3 MFP_CFG(DF_IO3, AF2)
371#define DF_IO4_DF_IO4 MFP_CFG(DF_IO4, AF2)
372#define DF_IO5_DF_IO5 MFP_CFG(DF_IO5, AF2)
373#define DF_IO6_DF_IO6 MFP_CFG(DF_IO6, AF2)
374#define DF_IO7_DF_IO7 MFP_CFG(DF_IO7, AF2)
375#define DF_IO8_DF_IO8 MFP_CFG(DF_IO8, AF2)
376#define DF_IO9_DF_IO9 MFP_CFG(DF_IO9, AF2)
377#define DF_IO10_DF_IO10 MFP_CFG(DF_IO10, AF2)
378#define DF_IO11_DF_IO11 MFP_CFG(DF_IO11, AF2)
379#define DF_IO12_DF_IO12 MFP_CFG(DF_IO12, AF2)
380#define DF_IO13_DF_IO13 MFP_CFG(DF_IO13, AF2)
381#define DF_IO14_DF_IO14 MFP_CFG(DF_IO14, AF2)
382#define DF_IO15_DF_IO15 MFP_CFG(DF_IO15, AF2)
383#define DF_nADV1_ALE_DF_nADV1 MFP_CFG(DF_nADV1_ALE, AF2)
384#define DF_nADV2_ALE_DF_nADV2 MFP_CFG(DF_nADV2_ALE, AF2)
385#define DF_nCS0_DF_nCS0 MFP_CFG(DF_nCS0, AF2)
386#define DF_nCS1_DF_nCS1 MFP_CFG(DF_nCS1, AF2)
387#define DF_nRE_nOE_DF_nOE MFP_CFG(DF_nRE_nOE, AF2)
388#define DF_nWE_DF_nWE MFP_CFG(DF_nWE, AF2)
389
390/* DFI - NAND */
391#define DF_CLE_nOE_ND_CLE MFP_CFG_LPM(DF_CLE_nOE, AF1, PULL_HIGH)
392#define DF_INT_RnB_ND_INT_RnB MFP_CFG_LPM(DF_INT_RnB, AF1, PULL_LOW)
393#define DF_IO0_ND_IO0 MFP_CFG_LPM(DF_IO0, AF1, PULL_LOW)
394#define DF_IO1_ND_IO1 MFP_CFG_LPM(DF_IO1, AF1, PULL_LOW)
395#define DF_IO2_ND_IO2 MFP_CFG_LPM(DF_IO2, AF1, PULL_LOW)
396#define DF_IO3_ND_IO3 MFP_CFG_LPM(DF_IO3, AF1, PULL_LOW)
397#define DF_IO4_ND_IO4 MFP_CFG_LPM(DF_IO4, AF1, PULL_LOW)
398#define DF_IO5_ND_IO5 MFP_CFG_LPM(DF_IO5, AF1, PULL_LOW)
399#define DF_IO6_ND_IO6 MFP_CFG_LPM(DF_IO6, AF1, PULL_LOW)
400#define DF_IO7_ND_IO7 MFP_CFG_LPM(DF_IO7, AF1, PULL_LOW)
401#define DF_IO8_ND_IO8 MFP_CFG_LPM(DF_IO8, AF1, PULL_LOW)
402#define DF_IO9_ND_IO9 MFP_CFG_LPM(DF_IO9, AF1, PULL_LOW)
403#define DF_IO10_ND_IO10 MFP_CFG_LPM(DF_IO10, AF1, PULL_LOW)
404#define DF_IO11_ND_IO11 MFP_CFG_LPM(DF_IO11, AF1, PULL_LOW)
405#define DF_IO12_ND_IO12 MFP_CFG_LPM(DF_IO12, AF1, PULL_LOW)
406#define DF_IO13_ND_IO13 MFP_CFG_LPM(DF_IO13, AF1, PULL_LOW)
407#define DF_IO14_ND_IO14 MFP_CFG_LPM(DF_IO14, AF1, PULL_LOW)
408#define DF_IO15_ND_IO15 MFP_CFG_LPM(DF_IO15, AF1, PULL_LOW)
409#define DF_nADV1_ALE_ND_ALE MFP_CFG_LPM(DF_nADV1_ALE, AF1, PULL_HIGH)
410#define DF_nADV2_ALE_ND_ALE MFP_CFG_LPM(DF_nADV2_ALE, AF1, PULL_HIGH)
411#define DF_nADV2_ALE_nCS3 MFP_CFG_LPM(DF_nADV2_ALE, AF3, PULL_HIGH)
412#define DF_nCS0_ND_nCS0 MFP_CFG_LPM(DF_nCS0, AF1, PULL_HIGH)
413#define DF_nCS1_ND_nCS1 MFP_CFG_LPM(DF_nCS1, AF1, PULL_HIGH)
414#define DF_nRE_nOE_ND_nRE MFP_CFG_LPM(DF_nRE_nOE, AF1, PULL_HIGH)
415#define DF_nWE_ND_nWE MFP_CFG_LPM(DF_nWE, AF1, PULL_HIGH)
416
417/* PWM */
418#define GPIO41_PWM0 MFP_CFG_LPM(GPIO41, AF1, PULL_LOW)
419#define GPIO42_PWM1 MFP_CFG_LPM(GPIO42, AF1, PULL_LOW)
420#define GPIO43_PWM3 MFP_CFG_LPM(GPIO43, AF1, PULL_LOW)
421#define GPIO20_PWM0 MFP_CFG_LPM(GPIO20, AF2, PULL_LOW)
422#define GPIO21_PWM2 MFP_CFG_LPM(GPIO21, AF3, PULL_LOW)
423#define GPIO22_PWM3 MFP_CFG_LPM(GPIO22, AF3, PULL_LOW)
424
425/* CIR */
426#define GPIO46_CIR_OUT MFP_CFG(GPIO46, AF1)
427#define GPIO77_CIR_OUT MFP_CFG(GPIO77, AF3)
428
429/* USB P2 */
430#define GPIO0_USB_P2_7 MFP_CFG(GPIO0, AF3)
431#define GPIO15_USB_P2_7 MFP_CFG(GPIO15, AF5)
432#define GPIO16_USB_P2_7 MFP_CFG(GPIO16, AF2)
433#define GPIO48_USB_P2_7 MFP_CFG(GPIO48, AF7)
434#define GPIO49_USB_P2_7 MFP_CFG(GPIO49, AF6)
435#define DF_IO9_USB_P2_7 MFP_CFG(DF_IO9, AF3)
436
437#define GPIO48_USB_P2_8 MFP_CFG(GPIO48, AF2)
438#define GPIO50_USB_P2_7 MFP_CFG_X(GPIO50, AF2, DS02X, FLOAT)
439#define GPIO51_USB_P2_5 MFP_CFG(GPIO51, AF2)
440#define GPIO47_USB_P2_4 MFP_CFG(GPIO47, AF2)
441#define GPIO53_USB_P2_3 MFP_CFG(GPIO53, AF2)
442#define GPIO54_USB_P2_6 MFP_CFG(GPIO54, AF2)
443#define GPIO49_USB_P2_2 MFP_CFG(GPIO49, AF2)
444#define GPIO52_USB_P2_1 MFP_CFG(GPIO52, AF2)
445
446#define GPIO63_USB_P2_8 MFP_CFG(GPIO63, AF3)
447#define GPIO64_USB_P2_7 MFP_CFG(GPIO64, AF3)
448#define GPIO65_USB_P2_6 MFP_CFG(GPIO65, AF3)
449#define GPIO66_USG_P2_5 MFP_CFG(GPIO66, AF3)
450#define GPIO67_USB_P2_4 MFP_CFG(GPIO67, AF3)
451#define GPIO68_USB_P2_3 MFP_CFG(GPIO68, AF3)
452#define GPIO69_USB_P2_2 MFP_CFG(GPIO69, AF3)
453#define GPIO70_USB_P2_1 MFP_CFG(GPIO70, AF3)
454
455/* ULPI */
456#define GPIO31_USB_ULPI_D0 MFP_CFG(GPIO31, AF4)
457#define GPIO30_USB_ULPI_D1 MFP_CFG(GPIO30, AF7)
458#define GPIO33_USB_ULPI_D2 MFP_CFG(GPIO33, AF5)
459#define GPIO34_USB_ULPI_D3 MFP_CFG(GPIO34, AF5)
460#define GPIO35_USB_ULPI_D4 MFP_CFG(GPIO35, AF5)
461#define GPIO36_USB_ULPI_D5 MFP_CFG(GPIO36, AF5)
462#define GPIO41_USB_ULPI_D6 MFP_CFG(GPIO41, AF5)
463#define GPIO42_USB_ULPI_D7 MFP_CFG(GPIO42, AF5)
464#define GPIO37_USB_ULPI_DIR MFP_CFG(GPIO37, AF4)
465#define GPIO38_USB_ULPI_CLK MFP_CFG(GPIO38, AF4)
466#define GPIO39_USB_ULPI_STP MFP_CFG(GPIO39, AF4)
467#define GPIO40_USB_ULPI_NXT MFP_CFG(GPIO40, AF4)
468
469#define GPIO3_CLK26MOUTDMD MFP_CFG(GPIO3, AF3)
470#define GPIO40_CLK26MOUTDMD MFP_CFG(GPIO40, AF7)
471#define GPIO94_CLK26MOUTDMD MFP_CFG(GPIO94, AF5)
472#define GPIO104_CLK26MOUTDMD MFP_CFG(GPIO104, AF4)
473#define DF_ADDR1_CLK26MOUTDMD MFP_CFG(DF_ADDR2, AF3)
474#define DF_ADDR3_CLK26MOUTDMD MFP_CFG(DF_ADDR3, AF3)
475
476#define GPIO14_CLK26MOUT MFP_CFG(GPIO14, AF5)
477#define GPIO38_CLK26MOUT MFP_CFG(GPIO38, AF7)
478#define GPIO92_CLK26MOUT MFP_CFG(GPIO92, AF5)
479#define GPIO105_CLK26MOUT MFP_CFG(GPIO105, AF4)
480
481#define GPIO2_CLK13MOUTDMD MFP_CFG(GPIO2, AF3)
482#define GPIO39_CLK13MOUTDMD MFP_CFG(GPIO39, AF7)
483#define GPIO50_CLK13MOUTDMD MFP_CFG(GPIO50, AF3)
484#define GPIO93_CLK13MOUTDMD MFP_CFG(GPIO93, AF5)
485#define GPIO103_CLK13MOUTDMD MFP_CFG(GPIO103, AF4)
486#define DF_ADDR2_CLK13MOUTDMD MFP_CFG(DF_ADDR2, AF3)
487
488/* 1 wire */
489#define GPIO95_OW_DQ_IN MFP_CFG(GPIO95, AF5)
490
491#endif /* __ASM_ARCH_MFP_PXA9xx_H */
diff --git a/arch/arm/mach-pxa/include/mach/mfp.h b/arch/arm/mach-pxa/include/mach/mfp.h
new file mode 100644
index 000000000000..8769567b389b
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mfp.h
@@ -0,0 +1,319 @@
1/*
2 * arch/arm/mach-pxa/include/mach/mfp.h
3 *
4 * Multi-Function Pin Definitions
5 *
6 * Copyright (C) 2007 Marvell International Ltd.
7 *
8 * 2007-8-21: eric miao <eric.miao@marvell.com>
9 * initial version
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#ifndef __ASM_ARCH_MFP_H
17#define __ASM_ARCH_MFP_H
18
19#define mfp_to_gpio(m) ((m) % 128)
20
21/* list of all the configurable MFP pins */
22enum {
23 MFP_PIN_INVALID = -1,
24
25 MFP_PIN_GPIO0 = 0,
26 MFP_PIN_GPIO1,
27 MFP_PIN_GPIO2,
28 MFP_PIN_GPIO3,
29 MFP_PIN_GPIO4,
30 MFP_PIN_GPIO5,
31 MFP_PIN_GPIO6,
32 MFP_PIN_GPIO7,
33 MFP_PIN_GPIO8,
34 MFP_PIN_GPIO9,
35 MFP_PIN_GPIO10,
36 MFP_PIN_GPIO11,
37 MFP_PIN_GPIO12,
38 MFP_PIN_GPIO13,
39 MFP_PIN_GPIO14,
40 MFP_PIN_GPIO15,
41 MFP_PIN_GPIO16,
42 MFP_PIN_GPIO17,
43 MFP_PIN_GPIO18,
44 MFP_PIN_GPIO19,
45 MFP_PIN_GPIO20,
46 MFP_PIN_GPIO21,
47 MFP_PIN_GPIO22,
48 MFP_PIN_GPIO23,
49 MFP_PIN_GPIO24,
50 MFP_PIN_GPIO25,
51 MFP_PIN_GPIO26,
52 MFP_PIN_GPIO27,
53 MFP_PIN_GPIO28,
54 MFP_PIN_GPIO29,
55 MFP_PIN_GPIO30,
56 MFP_PIN_GPIO31,
57 MFP_PIN_GPIO32,
58 MFP_PIN_GPIO33,
59 MFP_PIN_GPIO34,
60 MFP_PIN_GPIO35,
61 MFP_PIN_GPIO36,
62 MFP_PIN_GPIO37,
63 MFP_PIN_GPIO38,
64 MFP_PIN_GPIO39,
65 MFP_PIN_GPIO40,
66 MFP_PIN_GPIO41,
67 MFP_PIN_GPIO42,
68 MFP_PIN_GPIO43,
69 MFP_PIN_GPIO44,
70 MFP_PIN_GPIO45,
71 MFP_PIN_GPIO46,
72 MFP_PIN_GPIO47,
73 MFP_PIN_GPIO48,
74 MFP_PIN_GPIO49,
75 MFP_PIN_GPIO50,
76 MFP_PIN_GPIO51,
77 MFP_PIN_GPIO52,
78 MFP_PIN_GPIO53,
79 MFP_PIN_GPIO54,
80 MFP_PIN_GPIO55,
81 MFP_PIN_GPIO56,
82 MFP_PIN_GPIO57,
83 MFP_PIN_GPIO58,
84 MFP_PIN_GPIO59,
85 MFP_PIN_GPIO60,
86 MFP_PIN_GPIO61,
87 MFP_PIN_GPIO62,
88 MFP_PIN_GPIO63,
89 MFP_PIN_GPIO64,
90 MFP_PIN_GPIO65,
91 MFP_PIN_GPIO66,
92 MFP_PIN_GPIO67,
93 MFP_PIN_GPIO68,
94 MFP_PIN_GPIO69,
95 MFP_PIN_GPIO70,
96 MFP_PIN_GPIO71,
97 MFP_PIN_GPIO72,
98 MFP_PIN_GPIO73,
99 MFP_PIN_GPIO74,
100 MFP_PIN_GPIO75,
101 MFP_PIN_GPIO76,
102 MFP_PIN_GPIO77,
103 MFP_PIN_GPIO78,
104 MFP_PIN_GPIO79,
105 MFP_PIN_GPIO80,
106 MFP_PIN_GPIO81,
107 MFP_PIN_GPIO82,
108 MFP_PIN_GPIO83,
109 MFP_PIN_GPIO84,
110 MFP_PIN_GPIO85,
111 MFP_PIN_GPIO86,
112 MFP_PIN_GPIO87,
113 MFP_PIN_GPIO88,
114 MFP_PIN_GPIO89,
115 MFP_PIN_GPIO90,
116 MFP_PIN_GPIO91,
117 MFP_PIN_GPIO92,
118 MFP_PIN_GPIO93,
119 MFP_PIN_GPIO94,
120 MFP_PIN_GPIO95,
121 MFP_PIN_GPIO96,
122 MFP_PIN_GPIO97,
123 MFP_PIN_GPIO98,
124 MFP_PIN_GPIO99,
125 MFP_PIN_GPIO100,
126 MFP_PIN_GPIO101,
127 MFP_PIN_GPIO102,
128 MFP_PIN_GPIO103,
129 MFP_PIN_GPIO104,
130 MFP_PIN_GPIO105,
131 MFP_PIN_GPIO106,
132 MFP_PIN_GPIO107,
133 MFP_PIN_GPIO108,
134 MFP_PIN_GPIO109,
135 MFP_PIN_GPIO110,
136 MFP_PIN_GPIO111,
137 MFP_PIN_GPIO112,
138 MFP_PIN_GPIO113,
139 MFP_PIN_GPIO114,
140 MFP_PIN_GPIO115,
141 MFP_PIN_GPIO116,
142 MFP_PIN_GPIO117,
143 MFP_PIN_GPIO118,
144 MFP_PIN_GPIO119,
145 MFP_PIN_GPIO120,
146 MFP_PIN_GPIO121,
147 MFP_PIN_GPIO122,
148 MFP_PIN_GPIO123,
149 MFP_PIN_GPIO124,
150 MFP_PIN_GPIO125,
151 MFP_PIN_GPIO126,
152 MFP_PIN_GPIO127,
153 MFP_PIN_GPIO0_2,
154 MFP_PIN_GPIO1_2,
155 MFP_PIN_GPIO2_2,
156 MFP_PIN_GPIO3_2,
157 MFP_PIN_GPIO4_2,
158 MFP_PIN_GPIO5_2,
159 MFP_PIN_GPIO6_2,
160 MFP_PIN_GPIO7_2,
161 MFP_PIN_GPIO8_2,
162 MFP_PIN_GPIO9_2,
163 MFP_PIN_GPIO10_2,
164 MFP_PIN_GPIO11_2,
165 MFP_PIN_GPIO12_2,
166 MFP_PIN_GPIO13_2,
167 MFP_PIN_GPIO14_2,
168 MFP_PIN_GPIO15_2,
169 MFP_PIN_GPIO16_2,
170 MFP_PIN_GPIO17_2,
171
172 MFP_PIN_ULPI_STP,
173 MFP_PIN_ULPI_NXT,
174 MFP_PIN_ULPI_DIR,
175
176 MFP_PIN_nXCVREN,
177 MFP_PIN_DF_CLE_nOE,
178 MFP_PIN_DF_nADV1_ALE,
179 MFP_PIN_DF_SCLK_E,
180 MFP_PIN_DF_SCLK_S,
181 MFP_PIN_nBE0,
182 MFP_PIN_nBE1,
183 MFP_PIN_DF_nADV2_ALE,
184 MFP_PIN_DF_INT_RnB,
185 MFP_PIN_DF_nCS0,
186 MFP_PIN_DF_nCS1,
187 MFP_PIN_nLUA,
188 MFP_PIN_nLLA,
189 MFP_PIN_DF_nWE,
190 MFP_PIN_DF_ALE_nWE,
191 MFP_PIN_DF_nRE_nOE,
192 MFP_PIN_DF_ADDR0,
193 MFP_PIN_DF_ADDR1,
194 MFP_PIN_DF_ADDR2,
195 MFP_PIN_DF_ADDR3,
196 MFP_PIN_DF_IO0,
197 MFP_PIN_DF_IO1,
198 MFP_PIN_DF_IO2,
199 MFP_PIN_DF_IO3,
200 MFP_PIN_DF_IO4,
201 MFP_PIN_DF_IO5,
202 MFP_PIN_DF_IO6,
203 MFP_PIN_DF_IO7,
204 MFP_PIN_DF_IO8,
205 MFP_PIN_DF_IO9,
206 MFP_PIN_DF_IO10,
207 MFP_PIN_DF_IO11,
208 MFP_PIN_DF_IO12,
209 MFP_PIN_DF_IO13,
210 MFP_PIN_DF_IO14,
211 MFP_PIN_DF_IO15,
212
213 /* additional pins on PXA930 */
214 MFP_PIN_GSIM_UIO,
215 MFP_PIN_GSIM_UCLK,
216 MFP_PIN_GSIM_UDET,
217 MFP_PIN_GSIM_nURST,
218 MFP_PIN_PMIC_INT,
219 MFP_PIN_RDY,
220
221 MFP_PIN_MAX,
222};
223
224/*
225 * a possible MFP configuration is represented by a 32-bit integer
226 *
227 * bit 0.. 9 - MFP Pin Number (1024 Pins Maximum)
228 * bit 10..12 - Alternate Function Selection
229 * bit 13..15 - Drive Strength
230 * bit 16..18 - Low Power Mode State
231 * bit 19..20 - Low Power Mode Edge Detection
232 * bit 21..22 - Run Mode Pull State
233 *
234 * to facilitate the definition, the following macros are provided
235 *
236 * MFP_CFG_DEFAULT - default MFP configuration value, with
237 * alternate function = 0,
238 * drive strength = fast 3mA (MFP_DS03X)
239 * low power mode = default
240 * edge detection = none
241 *
242 * MFP_CFG - default MFPR value with alternate function
243 * MFP_CFG_DRV - default MFPR value with alternate function and
244 * pin drive strength
245 * MFP_CFG_LPM - default MFPR value with alternate function and
246 * low power mode
247 * MFP_CFG_X - default MFPR value with alternate function,
248 * pin drive strength and low power mode
249 */
250
251typedef unsigned long mfp_cfg_t;
252
253#define MFP_PIN(x) ((x) & 0x3ff)
254
255#define MFP_AF0 (0x0 << 10)
256#define MFP_AF1 (0x1 << 10)
257#define MFP_AF2 (0x2 << 10)
258#define MFP_AF3 (0x3 << 10)
259#define MFP_AF4 (0x4 << 10)
260#define MFP_AF5 (0x5 << 10)
261#define MFP_AF6 (0x6 << 10)
262#define MFP_AF7 (0x7 << 10)
263#define MFP_AF_MASK (0x7 << 10)
264#define MFP_AF(x) (((x) >> 10) & 0x7)
265
266#define MFP_DS01X (0x0 << 13)
267#define MFP_DS02X (0x1 << 13)
268#define MFP_DS03X (0x2 << 13)
269#define MFP_DS04X (0x3 << 13)
270#define MFP_DS06X (0x4 << 13)
271#define MFP_DS08X (0x5 << 13)
272#define MFP_DS10X (0x6 << 13)
273#define MFP_DS13X (0x7 << 13)
274#define MFP_DS_MASK (0x7 << 13)
275#define MFP_DS(x) (((x) >> 13) & 0x7)
276
277#define MFP_LPM_INPUT (0x0 << 16)
278#define MFP_LPM_DRIVE_LOW (0x1 << 16)
279#define MFP_LPM_DRIVE_HIGH (0x2 << 16)
280#define MFP_LPM_PULL_LOW (0x3 << 16)
281#define MFP_LPM_PULL_HIGH (0x4 << 16)
282#define MFP_LPM_FLOAT (0x5 << 16)
283#define MFP_LPM_STATE_MASK (0x7 << 16)
284#define MFP_LPM_STATE(x) (((x) >> 16) & 0x7)
285
286#define MFP_LPM_EDGE_NONE (0x0 << 19)
287#define MFP_LPM_EDGE_RISE (0x1 << 19)
288#define MFP_LPM_EDGE_FALL (0x2 << 19)
289#define MFP_LPM_EDGE_BOTH (0x3 << 19)
290#define MFP_LPM_EDGE_MASK (0x3 << 19)
291#define MFP_LPM_EDGE(x) (((x) >> 19) & 0x3)
292
293#define MFP_PULL_NONE (0x0 << 21)
294#define MFP_PULL_LOW (0x1 << 21)
295#define MFP_PULL_HIGH (0x2 << 21)
296#define MFP_PULL_BOTH (0x3 << 21)
297#define MFP_PULL_MASK (0x3 << 21)
298#define MFP_PULL(x) (((x) >> 21) & 0x3)
299
300#define MFP_CFG_DEFAULT (MFP_AF0 | MFP_DS03X | MFP_LPM_INPUT |\
301 MFP_LPM_EDGE_NONE | MFP_PULL_NONE)
302
303#define MFP_CFG(pin, af) \
304 ((MFP_CFG_DEFAULT & ~MFP_AF_MASK) |\
305 (MFP_PIN(MFP_PIN_##pin) | MFP_##af))
306
307#define MFP_CFG_DRV(pin, af, drv) \
308 ((MFP_CFG_DEFAULT & ~(MFP_AF_MASK | MFP_DS_MASK)) |\
309 (MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_##drv))
310
311#define MFP_CFG_LPM(pin, af, lpm) \
312 ((MFP_CFG_DEFAULT & ~(MFP_AF_MASK | MFP_LPM_STATE_MASK)) |\
313 (MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_LPM_##lpm))
314
315#define MFP_CFG_X(pin, af, drv, lpm) \
316 ((MFP_CFG_DEFAULT & ~(MFP_AF_MASK | MFP_DS_MASK | MFP_LPM_STATE_MASK)) |\
317 (MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_##drv | MFP_LPM_##lpm))
318
319#endif /* __ASM_ARCH_MFP_H */
diff --git a/arch/arm/mach-pxa/include/mach/mmc.h b/arch/arm/mach-pxa/include/mach/mmc.h
new file mode 100644
index 000000000000..6d1304c9270f
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mmc.h
@@ -0,0 +1,23 @@
1#ifndef ASMARM_ARCH_MMC_H
2#define ASMARM_ARCH_MMC_H
3
4#include <linux/mmc/host.h>
5#include <linux/interrupt.h>
6
7struct device;
8struct mmc_host;
9
10struct pxamci_platform_data {
11 unsigned int ocr_mask; /* available voltages */
12 unsigned long detect_delay; /* delay in jiffies before detecting cards after interrupt */
13 int (*init)(struct device *, irq_handler_t , void *);
14 int (*get_ro)(struct device *);
15 void (*setpower)(struct device *, unsigned int);
16 void (*exit)(struct device *, void *);
17};
18
19extern void pxa_set_mci_info(struct pxamci_platform_data *info);
20extern void pxa3xx_set_mci2_info(struct pxamci_platform_data *info);
21extern void pxa3xx_set_mci3_info(struct pxamci_platform_data *info);
22
23#endif
diff --git a/arch/arm/mach-pxa/include/mach/mtd-xip.h b/arch/arm/mach-pxa/include/mach/mtd-xip.h
new file mode 100644
index 000000000000..351f32f13ce4
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/mtd-xip.h
@@ -0,0 +1,37 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Nicolas Pitre
7 * Created: Nov 2, 2004
8 * Copyright: (C) 2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
15 */
16
17#ifndef __ARCH_PXA_MTD_XIP_H__
18#define __ARCH_PXA_MTD_XIP_H__
19
20#include <mach/pxa-regs.h>
21
22#define xip_irqpending() (ICIP & ICMR)
23
24/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
25#define xip_currtime() (OSCR)
26#define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4)
27
28/*
29 * xip_cpu_idle() is used when waiting for a delay equal or larger than
30 * the system timer tick period. This should put the CPU into idle mode
31 * to save power and to be woken up only when some interrupts are pending.
32 * As above, this should not rely upon standard kernel code.
33 */
34
35#define xip_cpu_idle() asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
36
37#endif /* __ARCH_PXA_MTD_XIP_H__ */
diff --git a/arch/arm/mach-pxa/include/mach/ohci.h b/arch/arm/mach-pxa/include/mach/ohci.h
new file mode 100644
index 000000000000..e848a47128cd
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/ohci.h
@@ -0,0 +1,20 @@
1#ifndef ASMARM_ARCH_OHCI_H
2#define ASMARM_ARCH_OHCI_H
3
4struct device;
5
6struct pxaohci_platform_data {
7 int (*init)(struct device *);
8 void (*exit)(struct device *);
9
10 int port_mode;
11#define PMM_NPS_MODE 1
12#define PMM_GLOBAL_MODE 2
13#define PMM_PERPORT_MODE 3
14
15 int power_budget;
16};
17
18extern void pxa_set_ohci_info(struct pxaohci_platform_data *info);
19
20#endif
diff --git a/arch/arm/mach-pxa/include/mach/palmtx.h b/arch/arm/mach-pxa/include/mach/palmtx.h
new file mode 100644
index 000000000000..1e8bccbda510
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/palmtx.h
@@ -0,0 +1,106 @@
1/*
2 * GPIOs and interrupts for Palm T|X Handheld Computer
3 *
4 * Based on palmld-gpio.h by Alex Osborne
5 *
6 * Authors: Marek Vasut <marek.vasut@gmail.com>
7 * Cristiano P. <cristianop@users.sourceforge.net>
8 * Jan Herman <2hp@seznam.cz>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 */
15
16#ifndef _INCLUDE_PALMTX_H_
17#define _INCLUDE_PALMTX_H_
18
19/** HERE ARE GPIOs **/
20
21/* GPIOs */
22#define GPIO_NR_PALMTX_GPIO_RESET 1
23
24#define GPIO_NR_PALMTX_POWER_DETECT 12 /* 90 */
25#define GPIO_NR_PALMTX_HOTSYNC_BUTTON_N 10
26#define GPIO_NR_PALMTX_EARPHONE_DETECT 107
27
28/* SD/MMC */
29#define GPIO_NR_PALMTX_SD_DETECT_N 14
30#define GPIO_NR_PALMTX_SD_POWER 114 /* probably */
31#define GPIO_NR_PALMTX_SD_READONLY 115 /* probably */
32
33/* TOUCHSCREEN */
34#define GPIO_NR_PALMTX_WM9712_IRQ 27
35
36/* IRDA - disable GPIO connected to SD pin of tranceiver (TFBS4710?) ? */
37#define GPIO_NR_PALMTX_IR_DISABLE 40
38
39/* USB */
40#define GPIO_NR_PALMTX_USB_DETECT_N 13
41#define GPIO_NR_PALMTX_USB_POWER 95
42#define GPIO_NR_PALMTX_USB_PULLUP 93
43
44/* LCD/BACKLIGHT */
45#define GPIO_NR_PALMTX_BL_POWER 84
46#define GPIO_NR_PALMTX_LCD_POWER 96
47
48/* LCD BORDER */
49#define GPIO_NR_PALMTX_BORDER_SWITCH 98
50#define GPIO_NR_PALMTX_BORDER_SELECT 22
51
52/* BLUETOOTH */
53#define GPIO_NR_PALMTX_BT_POWER 17
54#define GPIO_NR_PALMTX_BT_RESET 83
55
56/* PCMCIA (WiFi) */
57#define GPIO_NR_PALMTX_PCMCIA_POWER1 94
58#define GPIO_NR_PALMTX_PCMCIA_POWER2 108
59#define GPIO_NR_PALMTX_PCMCIA_RESET 79
60#define GPIO_NR_PALMTX_PCMCIA_READY 116
61
62/* NAND Flash ... this GPIO may be incorrect! */
63#define GPIO_NR_PALMTX_NAND_BUFFER_DIR 79
64
65/* INTERRUPTS */
66#define IRQ_GPIO_PALMTX_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMTX_SD_DETECT_N)
67#define IRQ_GPIO_PALMTX_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMTX_WM9712_IRQ)
68#define IRQ_GPIO_PALMTX_USB_DETECT IRQ_GPIO(GPIO_NR_PALMTX_USB_DETECT)
69#define IRQ_GPIO_PALMTX_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMTX_GPIO_RESET)
70
71/** HERE ARE INIT VALUES **/
72
73/* Various addresses */
74#define PALMTX_PCMCIA_PHYS 0x28000000
75#define PALMTX_PCMCIA_VIRT 0xf0000000
76#define PALMTX_PCMCIA_SIZE 0x100000
77
78#define PALMTX_PHYS_RAM_START 0xa0000000
79#define PALMTX_PHYS_IO_START 0x40000000
80
81#define PALMTX_PHYS_FLASH_START PXA_CS0_PHYS /* ChipSelect 0 */
82#define PALMTX_PHYS_NAND_START PXA_CS1_PHYS /* ChipSelect 1 */
83
84/* TOUCHSCREEN */
85#define AC97_LINK_FRAME 21
86
87
88/* BATTERY */
89#define PALMTX_BAT_MAX_VOLTAGE 4000 /* 4.00v current voltage */
90#define PALMTX_BAT_MIN_VOLTAGE 3550 /* 3.55v critical voltage */
91#define PALMTX_BAT_MAX_CURRENT 0 /* unknokn */
92#define PALMTX_BAT_MIN_CURRENT 0 /* unknown */
93#define PALMTX_BAT_MAX_CHARGE 1 /* unknown */
94#define PALMTX_BAT_MIN_CHARGE 1 /* unknown */
95#define PALMTX_MAX_LIFE_MINS 360 /* on-life in minutes */
96
97#define PALMTX_BAT_MEASURE_DELAY (HZ * 1)
98
99/* BACKLIGHT */
100#define PALMTX_MAX_INTENSITY 0xFE
101#define PALMTX_DEFAULT_INTENSITY 0x7E
102#define PALMTX_LIMIT_MASK 0x7F
103#define PALMTX_PRESCALER 0x3F
104#define PALMTX_PERIOD_NS 3500
105
106#endif
diff --git a/arch/arm/mach-pxa/include/mach/pcm027.h b/arch/arm/mach-pxa/include/mach/pcm027.h
new file mode 100644
index 000000000000..4dcd2e8baa61
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pcm027.h
@@ -0,0 +1,75 @@
1/*
2 * arch/arm/mach-pxa/include/mach/pcm027.h
3 *
4 * (c) 2003 Phytec Messtechnik GmbH <armlinux@phytec.de>
5 * (c) 2007 Juergen Beisert <j.beisert@pengutronix.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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22/*
23 * Definitions of CPU card resources only
24 */
25
26/* I2C RTC */
27#define PCM027_RTC_IRQ_GPIO 0
28#define PCM027_RTC_IRQ IRQ_GPIO(PCM027_RTC_IRQ_GPIO)
29#define PCM027_RTC_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
30#define ADR_PCM027_RTC 0x51 /* I2C address */
31
32/* I2C EEPROM */
33#define ADR_PCM027_EEPROM 0x54 /* I2C address */
34
35/* Ethernet chip (SMSC91C111) */
36#define PCM027_ETH_IRQ_GPIO 52
37#define PCM027_ETH_IRQ IRQ_GPIO(PCM027_ETH_IRQ_GPIO)
38#define PCM027_ETH_IRQ_EDGE IRQ_TYPE_EDGE_RISING
39#define PCM027_ETH_PHYS PXA_CS5_PHYS
40#define PCM027_ETH_SIZE (1*1024*1024)
41
42/* CAN controller SJA1000 (unsupported yet) */
43#define PCM027_CAN_IRQ_GPIO 114
44#define PCM027_CAN_IRQ IRQ_GPIO(PCM027_CAN_IRQ_GPIO)
45#define PCM027_CAN_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
46#define PCM027_CAN_PHYS 0x22000000
47#define PCM027_CAN_SIZE 0x100
48
49/* SPI GPIO expander (unsupported yet) */
50#define PCM027_EGPIO_IRQ_GPIO 27
51#define PCM027_EGPIO_IRQ IRQ_GPIO(PCM027_EGPIO_IRQ_GPIO)
52#define PCM027_EGPIO_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
53#define PCM027_EGPIO_CS 24
54/*
55 * TODO: Switch this pin from dedicated usage to GPIO if
56 * more than the MAX7301 device is connected to this SPI bus
57 */
58#define PCM027_EGPIO_CS_MODE GPIO24_SFRM_MD
59
60/* Flash memory */
61#define PCM027_FLASH_PHYS 0x00000000
62#define PCM027_FLASH_SIZE 0x02000000
63
64/* onboard LEDs connected to GPIO */
65#define PCM027_LED_CPU 90
66#define PCM027_LED_HEARD_BEAT 91
67
68/*
69 * This CPU module needs a baseboard to work. After basic initializing
70 * its own devices, it calls baseboard's init function.
71 * TODO: Add your own basebaord init function and call it from
72 * inside pcm027_init(). This example here is for the developmen board.
73 * Refer pcm990-baseboard.c
74 */
75extern void pcm990_baseboard_init(void);
diff --git a/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
new file mode 100644
index 000000000000..8a4383b776d7
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
@@ -0,0 +1,275 @@
1/*
2 * arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
3 *
4 * (c) 2003 Phytec Messtechnik GmbH <armlinux@phytec.de>
5 * (c) 2007 Juergen Beisert <j.beisert@pengutronix.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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <mach/pcm027.h>
23
24/*
25 * definitions relevant only when the PCM-990
26 * development base board is in use
27 */
28
29/* CPLD's interrupt controller is connected to PCM-027 GPIO 9 */
30#define PCM990_CTRL_INT_IRQ_GPIO 9
31#define PCM990_CTRL_INT_IRQ IRQ_GPIO(PCM990_CTRL_INT_IRQ_GPIO)
32#define PCM990_CTRL_INT_IRQ_EDGE IRQ_TYPE_EDGE_RISING
33#define PCM990_CTRL_PHYS PXA_CS1_PHYS /* 16-Bit */
34#define PCM990_CTRL_BASE 0xea000000
35#define PCM990_CTRL_SIZE (1*1024*1024)
36
37#define PCM990_CTRL_PWR_IRQ_GPIO 14
38#define PCM990_CTRL_PWR_IRQ IRQ_GPIO(PCM990_CTRL_PWR_IRQ_GPIO)
39#define PCM990_CTRL_PWR_IRQ_EDGE IRQ_TYPE_EDGE_RISING
40
41/* visible CPLD (U7) registers */
42#define PCM990_CTRL_REG0 0x0000 /* RESET REGISTER */
43#define PCM990_CTRL_SYSRES 0x0001 /* System RESET REGISTER */
44#define PCM990_CTRL_RESOUT 0x0002 /* RESETOUT Enable REGISTER */
45#define PCM990_CTRL_RESGPIO 0x0004 /* RESETGPIO Enable REGISTER */
46
47#define PCM990_CTRL_REG1 0x0002 /* Power REGISTER */
48#define PCM990_CTRL_5VOFF 0x0001 /* Disable 5V Regulators */
49#define PCM990_CTRL_CANPWR 0x0004 /* Enable CANPWR ADUM */
50#define PCM990_CTRL_PM_5V 0x0008 /* Read 5V OK */
51
52#define PCM990_CTRL_REG2 0x0004 /* LED REGISTER */
53#define PCM990_CTRL_LEDPWR 0x0001 /* POWER LED enable */
54#define PCM990_CTRL_LEDBAS 0x0002 /* BASIS LED enable */
55#define PCM990_CTRL_LEDUSR 0x0004 /* USER LED enable */
56
57#define PCM990_CTRL_REG3 0x0006 /* LCD CTRL REGISTER 3 */
58#define PCM990_CTRL_LCDPWR 0x0001 /* RW LCD Power on */
59#define PCM990_CTRL_LCDON 0x0002 /* RW LCD Latch on */
60#define PCM990_CTRL_LCDPOS1 0x0004 /* RW POS 1 */
61#define PCM990_CTRL_LCDPOS2 0x0008 /* RW POS 2 */
62
63#define PCM990_CTRL_REG4 0x0008 /* MMC1 CTRL REGISTER 4 */
64#define PCM990_CTRL_MMC1PWR 0x0001 /* RW MMC1 Power on */
65
66#define PCM990_CTRL_REG5 0x000A /* MMC2 CTRL REGISTER 5 */
67#define PCM990_CTRL_MMC2PWR 0x0001 /* RW MMC2 Power on */
68#define PCM990_CTRL_MMC2LED 0x0002 /* RW MMC2 LED */
69#define PCM990_CTRL_MMC2DE 0x0004 /* R MMC2 Card detect */
70#define PCM990_CTRL_MMC2WP 0x0008 /* R MMC2 Card write protect */
71
72#define PCM990_CTRL_REG6 0x000C /* Interrupt Clear REGISTER */
73#define PCM990_CTRL_INTC0 0x0001 /* Clear Reg BT Detect */
74#define PCM990_CTRL_INTC1 0x0002 /* Clear Reg FR RI */
75#define PCM990_CTRL_INTC2 0x0004 /* Clear Reg MMC1 Detect */
76#define PCM990_CTRL_INTC3 0x0008 /* Clear Reg PM_5V off */
77
78#define PCM990_CTRL_REG7 0x000E /* Interrupt Enable REGISTER */
79#define PCM990_CTRL_ENAINT0 0x0001 /* Enable Int BT Detect */
80#define PCM990_CTRL_ENAINT1 0x0002 /* Enable Int FR RI */
81#define PCM990_CTRL_ENAINT2 0x0004 /* Enable Int MMC1 Detect */
82#define PCM990_CTRL_ENAINT3 0x0008 /* Enable Int PM_5V off */
83
84#define PCM990_CTRL_REG8 0x0014 /* Uart REGISTER */
85#define PCM990_CTRL_FFSD 0x0001 /* BT Uart Enable */
86#define PCM990_CTRL_BTSD 0x0002 /* FF Uart Enable */
87#define PCM990_CTRL_FFRI 0x0004 /* FF Uart RI detect */
88#define PCM990_CTRL_BTRX 0x0008 /* BT Uart Rx detect */
89
90#define PCM990_CTRL_REG9 0x0010 /* AC97 Flash REGISTER */
91#define PCM990_CTRL_FLWP 0x0001 /* pC Flash Write Protect */
92#define PCM990_CTRL_FLDIS 0x0002 /* pC Flash Disable */
93#define PCM990_CTRL_AC97ENA 0x0004 /* Enable AC97 Expansion */
94
95#define PCM990_CTRL_REG10 0x0012 /* GPS-REGISTER */
96#define PCM990_CTRL_GPSPWR 0x0004 /* GPS-Modul Power on */
97#define PCM990_CTRL_GPSENA 0x0008 /* GPS-Modul Enable */
98
99#define PCM990_CTRL_REG11 0x0014 /* Accu REGISTER */
100#define PCM990_CTRL_ACENA 0x0001 /* Charge Enable */
101#define PCM990_CTRL_ACSEL 0x0002 /* Charge Akku -> DC Enable */
102#define PCM990_CTRL_ACPRES 0x0004 /* DC Present */
103#define PCM990_CTRL_ACALARM 0x0008 /* Error Akku */
104
105#define PCM990_CTRL_P2V(x) ((x) - PCM990_CTRL_PHYS + PCM990_CTRL_BASE)
106#define PCM990_CTRL_V2P(x) ((x) - PCM990_CTRL_BASE + PCM990_CTRL_PHYS)
107
108#ifndef __ASSEMBLY__
109# define __PCM990_CTRL_REG(x) \
110 (*((volatile unsigned char *)PCM990_CTRL_P2V(x)))
111#else
112# define __PCM990_CTRL_REG(x) PCM990_CTRL_P2V(x)
113#endif
114
115#define PCM990_INTMSKENA __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG7)
116#define PCM990_INTSETCLR __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG6)
117#define PCM990_CTRL0 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG0)
118#define PCM990_CTRL1 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG1)
119#define PCM990_CTRL2 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG2)
120#define PCM990_CTRL3 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3)
121#define PCM990_CTRL4 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG4)
122#define PCM990_CTRL5 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG5)
123#define PCM990_CTRL6 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG6)
124#define PCM990_CTRL7 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG7)
125#define PCM990_CTRL8 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG8)
126#define PCM990_CTRL9 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG9)
127#define PCM990_CTRL10 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG10)
128#define PCM990_CTRL11 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG11)
129
130
131/*
132 * IDE
133 */
134#define PCM990_IDE_IRQ_GPIO 13
135#define PCM990_IDE_IRQ IRQ_GPIO(PCM990_IDE_IRQ_GPIO)
136#define PCM990_IDE_IRQ_EDGE IRQ_TYPE_EDGE_RISING
137#define PCM990_IDE_PLD_PHYS 0x20000000 /* 16 bit wide */
138#define PCM990_IDE_PLD_BASE 0xee000000
139#define PCM990_IDE_PLD_SIZE (1*1024*1024)
140
141/* visible CPLD (U6) registers */
142#define PCM990_IDE_PLD_REG0 0x1000 /* OFFSET IDE REGISTER 0 */
143#define PCM990_IDE_PM5V 0x0004 /* R System VCC_5V */
144#define PCM990_IDE_STBY 0x0008 /* R System StandBy */
145
146#define PCM990_IDE_PLD_REG1 0x1002 /* OFFSET IDE REGISTER 1 */
147#define PCM990_IDE_IDEMODE 0x0001 /* R TrueIDE Mode */
148#define PCM990_IDE_DMAENA 0x0004 /* RW DMA Enable */
149#define PCM990_IDE_DMA1_0 0x0008 /* RW 1=DREQ1 0=DREQ0 */
150
151#define PCM990_IDE_PLD_REG2 0x1004 /* OFFSET IDE REGISTER 2 */
152#define PCM990_IDE_RESENA 0x0001 /* RW IDE Reset Bit enable */
153#define PCM990_IDE_RES 0x0002 /* RW IDE Reset Bit */
154#define PCM990_IDE_RDY 0x0008 /* RDY */
155
156#define PCM990_IDE_PLD_REG3 0x1006 /* OFFSET IDE REGISTER 3 */
157#define PCM990_IDE_IDEOE 0x0001 /* RW Latch on Databus */
158#define PCM990_IDE_IDEON 0x0002 /* RW Latch on Control Address */
159#define PCM990_IDE_IDEIN 0x0004 /* RW Latch on Interrupt usw. */
160
161#define PCM990_IDE_PLD_REG4 0x1008 /* OFFSET IDE REGISTER 4 */
162#define PCM990_IDE_PWRENA 0x0001 /* RW IDE Power enable */
163#define PCM990_IDE_5V 0x0002 /* R IDE Power 5V */
164#define PCM990_IDE_PWG 0x0008 /* R IDE Power is on */
165
166#define PCM990_IDE_PLD_P2V(x) ((x) - PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_BASE)
167#define PCM990_IDE_PLD_V2P(x) ((x) - PCM990_IDE_PLD_BASE + PCM990_IDE_PLD_PHYS)
168
169#ifndef __ASSEMBLY__
170# define __PCM990_IDE_PLD_REG(x) \
171 (*((volatile unsigned char *)PCM990_IDE_PLD_P2V(x)))
172#else
173# define __PCM990_IDE_PLD_REG(x) PCM990_IDE_PLD_P2V(x)
174#endif
175
176#define PCM990_IDE0 \
177 __PCM990_IDE_PLD_REG(PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_REG0)
178#define PCM990_IDE1 \
179 __PCM990_IDE_PLD_REG(PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_REG1)
180#define PCM990_IDE2 \
181 __PCM990_IDE_PLD_REG(PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_REG2)
182#define PCM990_IDE3 \
183 __PCM990_IDE_PLD_REG(PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_REG3)
184#define PCM990_IDE4 \
185 __PCM990_IDE_PLD_REG(PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_REG4)
186
187/*
188 * Compact Flash
189 */
190#define PCM990_CF_IRQ_GPIO 11
191#define PCM990_CF_IRQ IRQ_GPIO(PCM990_CF_IRQ_GPIO)
192#define PCM990_CF_IRQ_EDGE IRQ_TYPE_EDGE_RISING
193
194#define PCM990_CF_CD_GPIO 12
195#define PCM990_CF_CD IRQ_GPIO(PCM990_CF_CD_GPIO)
196#define PCM990_CF_CD_EDGE IRQ_TYPE_EDGE_RISING
197
198#define PCM990_CF_PLD_PHYS 0x30000000 /* 16 bit wide */
199#define PCM990_CF_PLD_BASE 0xef000000
200#define PCM990_CF_PLD_SIZE (1*1024*1024)
201#define PCM990_CF_PLD_P2V(x) ((x) - PCM990_CF_PLD_PHYS + PCM990_CF_PLD_BASE)
202#define PCM990_CF_PLD_V2P(x) ((x) - PCM990_CF_PLD_BASE + PCM990_CF_PLD_PHYS)
203
204/* visible CPLD (U6) registers */
205#define PCM990_CF_PLD_REG0 0x1000 /* OFFSET CF REGISTER 0 */
206#define PCM990_CF_REG0_LED 0x0001 /* RW LED on */
207#define PCM990_CF_REG0_BLK 0x0002 /* RW LED flash when access */
208#define PCM990_CF_REG0_PM5V 0x0004 /* R System VCC_5V enable */
209#define PCM990_CF_REG0_STBY 0x0008 /* R System StandBy */
210
211#define PCM990_CF_PLD_REG1 0x1002 /* OFFSET CF REGISTER 1 */
212#define PCM990_CF_REG1_IDEMODE 0x0001 /* RW CF card run as TrueIDE */
213#define PCM990_CF_REG1_CF0 0x0002 /* RW CF card at ADDR 0x28000000 */
214
215#define PCM990_CF_PLD_REG2 0x1004 /* OFFSET CF REGISTER 2 */
216#define PCM990_CF_REG2_RES 0x0002 /* RW CF RESET BIT */
217#define PCM990_CF_REG2_RDYENA 0x0004 /* RW Enable CF_RDY */
218#define PCM990_CF_REG2_RDY 0x0008 /* R CF_RDY auf PWAIT */
219
220#define PCM990_CF_PLD_REG3 0x1006 /* OFFSET CF REGISTER 3 */
221#define PCM990_CF_REG3_CFOE 0x0001 /* RW Latch on Databus */
222#define PCM990_CF_REG3_CFON 0x0002 /* RW Latch on Control Address */
223#define PCM990_CF_REG3_CFIN 0x0004 /* RW Latch on Interrupt usw. */
224#define PCM990_CF_REG3_CFCD 0x0008 /* RW Latch on CD1/2 VS1/2 usw */
225
226#define PCM990_CF_PLD_REG4 0x1008 /* OFFSET CF REGISTER 4 */
227#define PCM990_CF_REG4_PWRENA 0x0001 /* RW CF Power on (CD1/2 = "00") */
228#define PCM990_CF_REG4_5_3V 0x0002 /* RW 1 = 5V CF_VCC 0 = 3 V CF_VCC */
229#define PCM990_CF_REG4_3B 0x0004 /* RW 3.0V Backup from VCC (5_3V=0) */
230#define PCM990_CF_REG4_PWG 0x0008 /* R CF-Power is on */
231
232#define PCM990_CF_PLD_REG5 0x100A /* OFFSET CF REGISTER 5 */
233#define PCM990_CF_REG5_BVD1 0x0001 /* R CF /BVD1 */
234#define PCM990_CF_REG5_BVD2 0x0002 /* R CF /BVD2 */
235#define PCM990_CF_REG5_VS1 0x0004 /* R CF /VS1 */
236#define PCM990_CF_REG5_VS2 0x0008 /* R CF /VS2 */
237
238#define PCM990_CF_PLD_REG6 0x100C /* OFFSET CF REGISTER 6 */
239#define PCM990_CF_REG6_CD1 0x0001 /* R CF Card_Detect1 */
240#define PCM990_CF_REG6_CD2 0x0002 /* R CF Card_Detect2 */
241
242#ifndef __ASSEMBLY__
243# define __PCM990_CF_PLD_REG(x) \
244 (*((volatile unsigned char *)PCM990_CF_PLD_P2V(x)))
245#else
246# define __PCM990_CF_PLD_REG(x) PCM990_CF_PLD_P2V(x)
247#endif
248
249#define PCM990_CF0 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG0)
250#define PCM990_CF1 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG1)
251#define PCM990_CF2 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG2)
252#define PCM990_CF3 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG3)
253#define PCM990_CF4 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG4)
254#define PCM990_CF5 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG5)
255#define PCM990_CF6 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG6)
256
257/*
258 * Wolfson AC97 Touch
259 */
260#define PCM990_AC97_IRQ_GPIO 10
261#define PCM990_AC97_IRQ IRQ_GPIO(PCM990_AC97_IRQ_GPIO)
262#define PCM990_AC97_IRQ_EDGE IRQ_TYPE_EDGE_RISING
263
264/*
265 * MMC phyCORE
266 */
267#define PCM990_MMC0_IRQ_GPIO 9
268#define PCM990_MMC0_IRQ IRQ_GPIO(PCM990_MMC0_IRQ_GPIO)
269#define PCM990_MMC0_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
270
271/*
272 * USB phyCore
273 */
274#define PCM990_USB_OVERCURRENT (88 | GPIO_ALT_FN_1_IN)
275#define PCM990_USB_PWR_EN (89 | GPIO_ALT_FN_2_OUT)
diff --git a/arch/arm/mach-pxa/include/mach/pm.h b/arch/arm/mach-pxa/include/mach/pm.h
new file mode 100644
index 000000000000..261e5bc958db
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pm.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (c) 2005 Richard Purdie
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#include <linux/suspend.h>
11
12struct pxa_cpu_pm_fns {
13 int save_count;
14 void (*save)(unsigned long *);
15 void (*restore)(unsigned long *);
16 int (*valid)(suspend_state_t state);
17 void (*enter)(suspend_state_t state);
18};
19
20extern struct pxa_cpu_pm_fns *pxa_cpu_pm_fns;
21
22/* sleep.S */
23extern void pxa25x_cpu_suspend(unsigned int);
24extern void pxa27x_cpu_suspend(unsigned int);
25extern void pxa_cpu_resume(void);
26
27extern int pxa_pm_enter(suspend_state_t state);
diff --git a/arch/arm/mach-pxa/include/mach/poodle.h b/arch/arm/mach-pxa/include/mach/poodle.h
new file mode 100644
index 000000000000..8956afe8195e
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/poodle.h
@@ -0,0 +1,75 @@
1/*
2 * arch/arm/mach-pxa/include/mach/poodle.h
3 *
4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information.
6 *
7 * Based on:
8 * arch/arm/mach-sa1100/include/mach/collie.h
9 *
10 * ChangeLog:
11 * 04-06-2001 Lineo Japan, Inc.
12 * 04-16-2001 SHARP Corporation
13 * Update to 2.6 John Lenz
14 */
15#ifndef __ASM_ARCH_POODLE_H
16#define __ASM_ARCH_POODLE_H 1
17
18/*
19 * GPIOs
20 */
21/* PXA GPIOs */
22#define POODLE_GPIO_ON_KEY (0)
23#define POODLE_GPIO_AC_IN (1)
24#define POODLE_GPIO_CO 16
25#define POODLE_GPIO_TP_INT (5)
26#define POODLE_GPIO_WAKEUP (11) /* change battery */
27#define POODLE_GPIO_GA_INT (10)
28#define POODLE_GPIO_IR_ON (22)
29#define POODLE_GPIO_HP_IN (4)
30#define POODLE_GPIO_CF_IRQ (17)
31#define POODLE_GPIO_CF_CD (14)
32#define POODLE_GPIO_CF_STSCHG (14)
33#define POODLE_GPIO_SD_PWR (33)
34#define POODLE_GPIO_SD_PWR1 (3)
35#define POODLE_GPIO_nSD_CLK (6)
36#define POODLE_GPIO_nSD_WP (7)
37#define POODLE_GPIO_nSD_INT (8)
38#define POODLE_GPIO_nSD_DETECT (9)
39#define POODLE_GPIO_MAIN_BAT_LOW (13)
40#define POODLE_GPIO_BAT_COVER (13)
41#define POODLE_GPIO_USB_PULLUP (20)
42#define POODLE_GPIO_ADC_TEMP_ON (21)
43#define POODLE_GPIO_BYPASS_ON (36)
44#define POODLE_GPIO_CHRG_ON (38)
45#define POODLE_GPIO_CHRG_FULL (16)
46#define POODLE_GPIO_DISCHARGE_ON (42) /* Enable battery discharge */
47
48/* PXA GPIOs */
49#define POODLE_IRQ_GPIO_ON_KEY IRQ_GPIO(0)
50#define POODLE_IRQ_GPIO_AC_IN IRQ_GPIO(1)
51#define POODLE_IRQ_GPIO_HP_IN IRQ_GPIO(4)
52#define POODLE_IRQ_GPIO_CO IRQ_GPIO(16)
53#define POODLE_IRQ_GPIO_TP_INT IRQ_GPIO(5)
54#define POODLE_IRQ_GPIO_WAKEUP IRQ_GPIO(11)
55#define POODLE_IRQ_GPIO_GA_INT IRQ_GPIO(10)
56#define POODLE_IRQ_GPIO_CF_IRQ IRQ_GPIO(17)
57#define POODLE_IRQ_GPIO_CF_CD IRQ_GPIO(14)
58#define POODLE_IRQ_GPIO_nSD_INT IRQ_GPIO(8)
59#define POODLE_IRQ_GPIO_nSD_DETECT IRQ_GPIO(9)
60#define POODLE_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(13)
61
62/* SCOOP GPIOs */
63#define POODLE_SCOOP_CHARGE_ON SCOOP_GPCR_PA11
64#define POODLE_SCOOP_CP401 SCOOP_GPCR_PA13
65#define POODLE_SCOOP_VPEN SCOOP_GPCR_PA18
66#define POODLE_SCOOP_L_PCLK SCOOP_GPCR_PA20
67#define POODLE_SCOOP_L_LCLK SCOOP_GPCR_PA21
68#define POODLE_SCOOP_HS_OUT SCOOP_GPCR_PA22
69
70#define POODLE_SCOOP_IO_DIR ( POODLE_SCOOP_VPEN | POODLE_SCOOP_HS_OUT )
71#define POODLE_SCOOP_IO_OUT ( 0 )
72
73extern struct platform_device poodle_locomo_device;
74
75#endif /* __ASM_ARCH_POODLE_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa-regs.h b/arch/arm/mach-pxa/include/mach/pxa-regs.h
new file mode 100644
index 000000000000..12288ca3cbb2
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa-regs.h
@@ -0,0 +1,1070 @@
1/*
2 * arch/arm/mach-pxa/include/mach/pxa-regs.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __PXA_REGS_H
14#define __PXA_REGS_H
15
16
17/*
18 * PXA Chip selects
19 */
20
21#define PXA_CS0_PHYS 0x00000000
22#define PXA_CS1_PHYS 0x04000000
23#define PXA_CS2_PHYS 0x08000000
24#define PXA_CS3_PHYS 0x0C000000
25#define PXA_CS4_PHYS 0x10000000
26#define PXA_CS5_PHYS 0x14000000
27
28
29/*
30 * Personal Computer Memory Card International Association (PCMCIA) sockets
31 */
32
33#define PCMCIAPrtSp 0x04000000 /* PCMCIA Partition Space [byte] */
34#define PCMCIASp (4*PCMCIAPrtSp) /* PCMCIA Space [byte] */
35#define PCMCIAIOSp PCMCIAPrtSp /* PCMCIA I/O Space [byte] */
36#define PCMCIAAttrSp PCMCIAPrtSp /* PCMCIA Attribute Space [byte] */
37#define PCMCIAMemSp PCMCIAPrtSp /* PCMCIA Memory Space [byte] */
38
39#define PCMCIA0Sp PCMCIASp /* PCMCIA 0 Space [byte] */
40#define PCMCIA0IOSp PCMCIAIOSp /* PCMCIA 0 I/O Space [byte] */
41#define PCMCIA0AttrSp PCMCIAAttrSp /* PCMCIA 0 Attribute Space [byte] */
42#define PCMCIA0MemSp PCMCIAMemSp /* PCMCIA 0 Memory Space [byte] */
43
44#define PCMCIA1Sp PCMCIASp /* PCMCIA 1 Space [byte] */
45#define PCMCIA1IOSp PCMCIAIOSp /* PCMCIA 1 I/O Space [byte] */
46#define PCMCIA1AttrSp PCMCIAAttrSp /* PCMCIA 1 Attribute Space [byte] */
47#define PCMCIA1MemSp PCMCIAMemSp /* PCMCIA 1 Memory Space [byte] */
48
49#define _PCMCIA(Nb) /* PCMCIA [0..1] */ \
50 (0x20000000 + (Nb)*PCMCIASp)
51#define _PCMCIAIO(Nb) _PCMCIA (Nb) /* PCMCIA I/O [0..1] */
52#define _PCMCIAAttr(Nb) /* PCMCIA Attribute [0..1] */ \
53 (_PCMCIA (Nb) + 2*PCMCIAPrtSp)
54#define _PCMCIAMem(Nb) /* PCMCIA Memory [0..1] */ \
55 (_PCMCIA (Nb) + 3*PCMCIAPrtSp)
56
57#define _PCMCIA0 _PCMCIA (0) /* PCMCIA 0 */
58#define _PCMCIA0IO _PCMCIAIO (0) /* PCMCIA 0 I/O */
59#define _PCMCIA0Attr _PCMCIAAttr (0) /* PCMCIA 0 Attribute */
60#define _PCMCIA0Mem _PCMCIAMem (0) /* PCMCIA 0 Memory */
61
62#define _PCMCIA1 _PCMCIA (1) /* PCMCIA 1 */
63#define _PCMCIA1IO _PCMCIAIO (1) /* PCMCIA 1 I/O */
64#define _PCMCIA1Attr _PCMCIAAttr (1) /* PCMCIA 1 Attribute */
65#define _PCMCIA1Mem _PCMCIAMem (1) /* PCMCIA 1 Memory */
66
67
68
69/*
70 * DMA Controller
71 */
72
73#define DCSR0 __REG(0x40000000) /* DMA Control / Status Register for Channel 0 */
74#define DCSR1 __REG(0x40000004) /* DMA Control / Status Register for Channel 1 */
75#define DCSR2 __REG(0x40000008) /* DMA Control / Status Register for Channel 2 */
76#define DCSR3 __REG(0x4000000c) /* DMA Control / Status Register for Channel 3 */
77#define DCSR4 __REG(0x40000010) /* DMA Control / Status Register for Channel 4 */
78#define DCSR5 __REG(0x40000014) /* DMA Control / Status Register for Channel 5 */
79#define DCSR6 __REG(0x40000018) /* DMA Control / Status Register for Channel 6 */
80#define DCSR7 __REG(0x4000001c) /* DMA Control / Status Register for Channel 7 */
81#define DCSR8 __REG(0x40000020) /* DMA Control / Status Register for Channel 8 */
82#define DCSR9 __REG(0x40000024) /* DMA Control / Status Register for Channel 9 */
83#define DCSR10 __REG(0x40000028) /* DMA Control / Status Register for Channel 10 */
84#define DCSR11 __REG(0x4000002c) /* DMA Control / Status Register for Channel 11 */
85#define DCSR12 __REG(0x40000030) /* DMA Control / Status Register for Channel 12 */
86#define DCSR13 __REG(0x40000034) /* DMA Control / Status Register for Channel 13 */
87#define DCSR14 __REG(0x40000038) /* DMA Control / Status Register for Channel 14 */
88#define DCSR15 __REG(0x4000003c) /* DMA Control / Status Register for Channel 15 */
89
90#define DCSR(x) __REG2(0x40000000, (x) << 2)
91
92#define DCSR_RUN (1 << 31) /* Run Bit (read / write) */
93#define DCSR_NODESC (1 << 30) /* No-Descriptor Fetch (read / write) */
94#define DCSR_STOPIRQEN (1 << 29) /* Stop Interrupt Enable (read / write) */
95#ifdef CONFIG_PXA27x
96#define DCSR_EORIRQEN (1 << 28) /* End of Receive Interrupt Enable (R/W) */
97#define DCSR_EORJMPEN (1 << 27) /* Jump to next descriptor on EOR */
98#define DCSR_EORSTOPEN (1 << 26) /* STOP on an EOR */
99#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */
100#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */
101#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */
102#define DCSR_EORINTR (1 << 9) /* The end of Receive */
103#endif
104#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */
105#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */
106#define DCSR_ENDINTR (1 << 2) /* End Interrupt (read / write) */
107#define DCSR_STARTINTR (1 << 1) /* Start Interrupt (read / write) */
108#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt (read / write) */
109
110#define DALGN __REG(0x400000a0) /* DMA Alignment Register */
111#define DINT __REG(0x400000f0) /* DMA Interrupt Register */
112
113#define DRCMR(n) (*(((n) < 64) ? \
114 &__REG2(0x40000100, ((n) & 0x3f) << 2) : \
115 &__REG2(0x40001100, ((n) & 0x3f) << 2)))
116
117#define DRCMR0 __REG(0x40000100) /* Request to Channel Map Register for DREQ 0 */
118#define DRCMR1 __REG(0x40000104) /* Request to Channel Map Register for DREQ 1 */
119#define DRCMR2 __REG(0x40000108) /* Request to Channel Map Register for I2S receive Request */
120#define DRCMR3 __REG(0x4000010c) /* Request to Channel Map Register for I2S transmit Request */
121#define DRCMR4 __REG(0x40000110) /* Request to Channel Map Register for BTUART receive Request */
122#define DRCMR5 __REG(0x40000114) /* Request to Channel Map Register for BTUART transmit Request. */
123#define DRCMR6 __REG(0x40000118) /* Request to Channel Map Register for FFUART receive Request */
124#define DRCMR7 __REG(0x4000011c) /* Request to Channel Map Register for FFUART transmit Request */
125#define DRCMR8 __REG(0x40000120) /* Request to Channel Map Register for AC97 microphone Request */
126#define DRCMR9 __REG(0x40000124) /* Request to Channel Map Register for AC97 modem receive Request */
127#define DRCMR10 __REG(0x40000128) /* Request to Channel Map Register for AC97 modem transmit Request */
128#define DRCMR11 __REG(0x4000012c) /* Request to Channel Map Register for AC97 audio receive Request */
129#define DRCMR12 __REG(0x40000130) /* Request to Channel Map Register for AC97 audio transmit Request */
130#define DRCMR13 __REG(0x40000134) /* Request to Channel Map Register for SSP receive Request */
131#define DRCMR14 __REG(0x40000138) /* Request to Channel Map Register for SSP transmit Request */
132#define DRCMR15 __REG(0x4000013c) /* Request to Channel Map Register for SSP2 receive Request */
133#define DRCMR16 __REG(0x40000140) /* Request to Channel Map Register for SSP2 transmit Request */
134#define DRCMR17 __REG(0x40000144) /* Request to Channel Map Register for ICP receive Request */
135#define DRCMR18 __REG(0x40000148) /* Request to Channel Map Register for ICP transmit Request */
136#define DRCMR19 __REG(0x4000014c) /* Request to Channel Map Register for STUART receive Request */
137#define DRCMR20 __REG(0x40000150) /* Request to Channel Map Register for STUART transmit Request */
138#define DRCMR21 __REG(0x40000154) /* Request to Channel Map Register for MMC receive Request */
139#define DRCMR22 __REG(0x40000158) /* Request to Channel Map Register for MMC transmit Request */
140#define DRCMR23 __REG(0x4000015c) /* Reserved */
141#define DRCMR24 __REG(0x40000160) /* Reserved */
142#define DRCMR25 __REG(0x40000164) /* Request to Channel Map Register for USB endpoint 1 Request */
143#define DRCMR26 __REG(0x40000168) /* Request to Channel Map Register for USB endpoint 2 Request */
144#define DRCMR27 __REG(0x4000016C) /* Request to Channel Map Register for USB endpoint 3 Request */
145#define DRCMR28 __REG(0x40000170) /* Request to Channel Map Register for USB endpoint 4 Request */
146#define DRCMR29 __REG(0x40000174) /* Reserved */
147#define DRCMR30 __REG(0x40000178) /* Request to Channel Map Register for USB endpoint 6 Request */
148#define DRCMR31 __REG(0x4000017C) /* Request to Channel Map Register for USB endpoint 7 Request */
149#define DRCMR32 __REG(0x40000180) /* Request to Channel Map Register for USB endpoint 8 Request */
150#define DRCMR33 __REG(0x40000184) /* Request to Channel Map Register for USB endpoint 9 Request */
151#define DRCMR34 __REG(0x40000188) /* Reserved */
152#define DRCMR35 __REG(0x4000018C) /* Request to Channel Map Register for USB endpoint 11 Request */
153#define DRCMR36 __REG(0x40000190) /* Request to Channel Map Register for USB endpoint 12 Request */
154#define DRCMR37 __REG(0x40000194) /* Request to Channel Map Register for USB endpoint 13 Request */
155#define DRCMR38 __REG(0x40000198) /* Request to Channel Map Register for USB endpoint 14 Request */
156#define DRCMR39 __REG(0x4000019C) /* Reserved */
157#define DRCMR66 __REG(0x40001108) /* Request to Channel Map Register for SSP3 receive Request */
158#define DRCMR67 __REG(0x4000110C) /* Request to Channel Map Register for SSP3 transmit Request */
159#define DRCMR68 __REG(0x40001110) /* Request to Channel Map Register for Camera FIFO 0 Request */
160#define DRCMR69 __REG(0x40001114) /* Request to Channel Map Register for Camera FIFO 1 Request */
161#define DRCMR70 __REG(0x40001118) /* Request to Channel Map Register for Camera FIFO 2 Request */
162
163#define DRCMRRXSADR DRCMR2
164#define DRCMRTXSADR DRCMR3
165#define DRCMRRXBTRBR DRCMR4
166#define DRCMRTXBTTHR DRCMR5
167#define DRCMRRXFFRBR DRCMR6
168#define DRCMRTXFFTHR DRCMR7
169#define DRCMRRXMCDR DRCMR8
170#define DRCMRRXMODR DRCMR9
171#define DRCMRTXMODR DRCMR10
172#define DRCMRRXPCDR DRCMR11
173#define DRCMRTXPCDR DRCMR12
174#define DRCMRRXSSDR DRCMR13
175#define DRCMRTXSSDR DRCMR14
176#define DRCMRRXSS2DR DRCMR15
177#define DRCMRTXSS2DR DRCMR16
178#define DRCMRRXICDR DRCMR17
179#define DRCMRTXICDR DRCMR18
180#define DRCMRRXSTRBR DRCMR19
181#define DRCMRTXSTTHR DRCMR20
182#define DRCMRRXMMC DRCMR21
183#define DRCMRTXMMC DRCMR22
184#define DRCMRRXSS3DR DRCMR66
185#define DRCMRTXSS3DR DRCMR67
186#define DRCMRUDC(x) DRCMR((x) + 24)
187
188#define DRCMR_MAPVLD (1 << 7) /* Map Valid (read / write) */
189#define DRCMR_CHLNUM 0x1f /* mask for Channel Number (read / write) */
190
191#define DDADR0 __REG(0x40000200) /* DMA Descriptor Address Register Channel 0 */
192#define DSADR0 __REG(0x40000204) /* DMA Source Address Register Channel 0 */
193#define DTADR0 __REG(0x40000208) /* DMA Target Address Register Channel 0 */
194#define DCMD0 __REG(0x4000020c) /* DMA Command Address Register Channel 0 */
195#define DDADR1 __REG(0x40000210) /* DMA Descriptor Address Register Channel 1 */
196#define DSADR1 __REG(0x40000214) /* DMA Source Address Register Channel 1 */
197#define DTADR1 __REG(0x40000218) /* DMA Target Address Register Channel 1 */
198#define DCMD1 __REG(0x4000021c) /* DMA Command Address Register Channel 1 */
199#define DDADR2 __REG(0x40000220) /* DMA Descriptor Address Register Channel 2 */
200#define DSADR2 __REG(0x40000224) /* DMA Source Address Register Channel 2 */
201#define DTADR2 __REG(0x40000228) /* DMA Target Address Register Channel 2 */
202#define DCMD2 __REG(0x4000022c) /* DMA Command Address Register Channel 2 */
203#define DDADR3 __REG(0x40000230) /* DMA Descriptor Address Register Channel 3 */
204#define DSADR3 __REG(0x40000234) /* DMA Source Address Register Channel 3 */
205#define DTADR3 __REG(0x40000238) /* DMA Target Address Register Channel 3 */
206#define DCMD3 __REG(0x4000023c) /* DMA Command Address Register Channel 3 */
207#define DDADR4 __REG(0x40000240) /* DMA Descriptor Address Register Channel 4 */
208#define DSADR4 __REG(0x40000244) /* DMA Source Address Register Channel 4 */
209#define DTADR4 __REG(0x40000248) /* DMA Target Address Register Channel 4 */
210#define DCMD4 __REG(0x4000024c) /* DMA Command Address Register Channel 4 */
211#define DDADR5 __REG(0x40000250) /* DMA Descriptor Address Register Channel 5 */
212#define DSADR5 __REG(0x40000254) /* DMA Source Address Register Channel 5 */
213#define DTADR5 __REG(0x40000258) /* DMA Target Address Register Channel 5 */
214#define DCMD5 __REG(0x4000025c) /* DMA Command Address Register Channel 5 */
215#define DDADR6 __REG(0x40000260) /* DMA Descriptor Address Register Channel 6 */
216#define DSADR6 __REG(0x40000264) /* DMA Source Address Register Channel 6 */
217#define DTADR6 __REG(0x40000268) /* DMA Target Address Register Channel 6 */
218#define DCMD6 __REG(0x4000026c) /* DMA Command Address Register Channel 6 */
219#define DDADR7 __REG(0x40000270) /* DMA Descriptor Address Register Channel 7 */
220#define DSADR7 __REG(0x40000274) /* DMA Source Address Register Channel 7 */
221#define DTADR7 __REG(0x40000278) /* DMA Target Address Register Channel 7 */
222#define DCMD7 __REG(0x4000027c) /* DMA Command Address Register Channel 7 */
223#define DDADR8 __REG(0x40000280) /* DMA Descriptor Address Register Channel 8 */
224#define DSADR8 __REG(0x40000284) /* DMA Source Address Register Channel 8 */
225#define DTADR8 __REG(0x40000288) /* DMA Target Address Register Channel 8 */
226#define DCMD8 __REG(0x4000028c) /* DMA Command Address Register Channel 8 */
227#define DDADR9 __REG(0x40000290) /* DMA Descriptor Address Register Channel 9 */
228#define DSADR9 __REG(0x40000294) /* DMA Source Address Register Channel 9 */
229#define DTADR9 __REG(0x40000298) /* DMA Target Address Register Channel 9 */
230#define DCMD9 __REG(0x4000029c) /* DMA Command Address Register Channel 9 */
231#define DDADR10 __REG(0x400002a0) /* DMA Descriptor Address Register Channel 10 */
232#define DSADR10 __REG(0x400002a4) /* DMA Source Address Register Channel 10 */
233#define DTADR10 __REG(0x400002a8) /* DMA Target Address Register Channel 10 */
234#define DCMD10 __REG(0x400002ac) /* DMA Command Address Register Channel 10 */
235#define DDADR11 __REG(0x400002b0) /* DMA Descriptor Address Register Channel 11 */
236#define DSADR11 __REG(0x400002b4) /* DMA Source Address Register Channel 11 */
237#define DTADR11 __REG(0x400002b8) /* DMA Target Address Register Channel 11 */
238#define DCMD11 __REG(0x400002bc) /* DMA Command Address Register Channel 11 */
239#define DDADR12 __REG(0x400002c0) /* DMA Descriptor Address Register Channel 12 */
240#define DSADR12 __REG(0x400002c4) /* DMA Source Address Register Channel 12 */
241#define DTADR12 __REG(0x400002c8) /* DMA Target Address Register Channel 12 */
242#define DCMD12 __REG(0x400002cc) /* DMA Command Address Register Channel 12 */
243#define DDADR13 __REG(0x400002d0) /* DMA Descriptor Address Register Channel 13 */
244#define DSADR13 __REG(0x400002d4) /* DMA Source Address Register Channel 13 */
245#define DTADR13 __REG(0x400002d8) /* DMA Target Address Register Channel 13 */
246#define DCMD13 __REG(0x400002dc) /* DMA Command Address Register Channel 13 */
247#define DDADR14 __REG(0x400002e0) /* DMA Descriptor Address Register Channel 14 */
248#define DSADR14 __REG(0x400002e4) /* DMA Source Address Register Channel 14 */
249#define DTADR14 __REG(0x400002e8) /* DMA Target Address Register Channel 14 */
250#define DCMD14 __REG(0x400002ec) /* DMA Command Address Register Channel 14 */
251#define DDADR15 __REG(0x400002f0) /* DMA Descriptor Address Register Channel 15 */
252#define DSADR15 __REG(0x400002f4) /* DMA Source Address Register Channel 15 */
253#define DTADR15 __REG(0x400002f8) /* DMA Target Address Register Channel 15 */
254#define DCMD15 __REG(0x400002fc) /* DMA Command Address Register Channel 15 */
255
256#define DDADR(x) __REG2(0x40000200, (x) << 4)
257#define DSADR(x) __REG2(0x40000204, (x) << 4)
258#define DTADR(x) __REG2(0x40000208, (x) << 4)
259#define DCMD(x) __REG2(0x4000020c, (x) << 4)
260
261#define DDADR_DESCADDR 0xfffffff0 /* Address of next descriptor (mask) */
262#define DDADR_STOP (1 << 0) /* Stop (read / write) */
263
264#define DCMD_INCSRCADDR (1 << 31) /* Source Address Increment Setting. */
265#define DCMD_INCTRGADDR (1 << 30) /* Target Address Increment Setting. */
266#define DCMD_FLOWSRC (1 << 29) /* Flow Control by the source. */
267#define DCMD_FLOWTRG (1 << 28) /* Flow Control by the target. */
268#define DCMD_STARTIRQEN (1 << 22) /* Start Interrupt Enable */
269#define DCMD_ENDIRQEN (1 << 21) /* End Interrupt Enable */
270#define DCMD_ENDIAN (1 << 18) /* Device Endian-ness. */
271#define DCMD_BURST8 (1 << 16) /* 8 byte burst */
272#define DCMD_BURST16 (2 << 16) /* 16 byte burst */
273#define DCMD_BURST32 (3 << 16) /* 32 byte burst */
274#define DCMD_WIDTH1 (1 << 14) /* 1 byte width */
275#define DCMD_WIDTH2 (2 << 14) /* 2 byte width (HalfWord) */
276#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */
277#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
278
279
280/*
281 * UARTs
282 */
283
284/* Full Function UART (FFUART) */
285#define FFUART FFRBR
286#define FFRBR __REG(0x40100000) /* Receive Buffer Register (read only) */
287#define FFTHR __REG(0x40100000) /* Transmit Holding Register (write only) */
288#define FFIER __REG(0x40100004) /* Interrupt Enable Register (read/write) */
289#define FFIIR __REG(0x40100008) /* Interrupt ID Register (read only) */
290#define FFFCR __REG(0x40100008) /* FIFO Control Register (write only) */
291#define FFLCR __REG(0x4010000C) /* Line Control Register (read/write) */
292#define FFMCR __REG(0x40100010) /* Modem Control Register (read/write) */
293#define FFLSR __REG(0x40100014) /* Line Status Register (read only) */
294#define FFMSR __REG(0x40100018) /* Modem Status Register (read only) */
295#define FFSPR __REG(0x4010001C) /* Scratch Pad Register (read/write) */
296#define FFISR __REG(0x40100020) /* Infrared Selection Register (read/write) */
297#define FFDLL __REG(0x40100000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
298#define FFDLH __REG(0x40100004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
299
300/* Bluetooth UART (BTUART) */
301#define BTUART BTRBR
302#define BTRBR __REG(0x40200000) /* Receive Buffer Register (read only) */
303#define BTTHR __REG(0x40200000) /* Transmit Holding Register (write only) */
304#define BTIER __REG(0x40200004) /* Interrupt Enable Register (read/write) */
305#define BTIIR __REG(0x40200008) /* Interrupt ID Register (read only) */
306#define BTFCR __REG(0x40200008) /* FIFO Control Register (write only) */
307#define BTLCR __REG(0x4020000C) /* Line Control Register (read/write) */
308#define BTMCR __REG(0x40200010) /* Modem Control Register (read/write) */
309#define BTLSR __REG(0x40200014) /* Line Status Register (read only) */
310#define BTMSR __REG(0x40200018) /* Modem Status Register (read only) */
311#define BTSPR __REG(0x4020001C) /* Scratch Pad Register (read/write) */
312#define BTISR __REG(0x40200020) /* Infrared Selection Register (read/write) */
313#define BTDLL __REG(0x40200000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
314#define BTDLH __REG(0x40200004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
315
316/* Standard UART (STUART) */
317#define STUART STRBR
318#define STRBR __REG(0x40700000) /* Receive Buffer Register (read only) */
319#define STTHR __REG(0x40700000) /* Transmit Holding Register (write only) */
320#define STIER __REG(0x40700004) /* Interrupt Enable Register (read/write) */
321#define STIIR __REG(0x40700008) /* Interrupt ID Register (read only) */
322#define STFCR __REG(0x40700008) /* FIFO Control Register (write only) */
323#define STLCR __REG(0x4070000C) /* Line Control Register (read/write) */
324#define STMCR __REG(0x40700010) /* Modem Control Register (read/write) */
325#define STLSR __REG(0x40700014) /* Line Status Register (read only) */
326#define STMSR __REG(0x40700018) /* Reserved */
327#define STSPR __REG(0x4070001C) /* Scratch Pad Register (read/write) */
328#define STISR __REG(0x40700020) /* Infrared Selection Register (read/write) */
329#define STDLL __REG(0x40700000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
330#define STDLH __REG(0x40700004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
331
332/* Hardware UART (HWUART) */
333#define HWUART HWRBR
334#define HWRBR __REG(0x41600000) /* Receive Buffer Register (read only) */
335#define HWTHR __REG(0x41600000) /* Transmit Holding Register (write only) */
336#define HWIER __REG(0x41600004) /* Interrupt Enable Register (read/write) */
337#define HWIIR __REG(0x41600008) /* Interrupt ID Register (read only) */
338#define HWFCR __REG(0x41600008) /* FIFO Control Register (write only) */
339#define HWLCR __REG(0x4160000C) /* Line Control Register (read/write) */
340#define HWMCR __REG(0x41600010) /* Modem Control Register (read/write) */
341#define HWLSR __REG(0x41600014) /* Line Status Register (read only) */
342#define HWMSR __REG(0x41600018) /* Modem Status Register (read only) */
343#define HWSPR __REG(0x4160001C) /* Scratch Pad Register (read/write) */
344#define HWISR __REG(0x41600020) /* Infrared Selection Register (read/write) */
345#define HWFOR __REG(0x41600024) /* Receive FIFO Occupancy Register (read only) */
346#define HWABR __REG(0x41600028) /* Auto-Baud Control Register (read/write) */
347#define HWACR __REG(0x4160002C) /* Auto-Baud Count Register (read only) */
348#define HWDLL __REG(0x41600000) /* Divisor Latch Low Register (DLAB = 1) (read/write) */
349#define HWDLH __REG(0x41600004) /* Divisor Latch High Register (DLAB = 1) (read/write) */
350
351#define IER_DMAE (1 << 7) /* DMA Requests Enable */
352#define IER_UUE (1 << 6) /* UART Unit Enable */
353#define IER_NRZE (1 << 5) /* NRZ coding Enable */
354#define IER_RTIOE (1 << 4) /* Receiver Time Out Interrupt Enable */
355#define IER_MIE (1 << 3) /* Modem Interrupt Enable */
356#define IER_RLSE (1 << 2) /* Receiver Line Status Interrupt Enable */
357#define IER_TIE (1 << 1) /* Transmit Data request Interrupt Enable */
358#define IER_RAVIE (1 << 0) /* Receiver Data Available Interrupt Enable */
359
360#define IIR_FIFOES1 (1 << 7) /* FIFO Mode Enable Status */
361#define IIR_FIFOES0 (1 << 6) /* FIFO Mode Enable Status */
362#define IIR_TOD (1 << 3) /* Time Out Detected */
363#define IIR_IID2 (1 << 2) /* Interrupt Source Encoded */
364#define IIR_IID1 (1 << 1) /* Interrupt Source Encoded */
365#define IIR_IP (1 << 0) /* Interrupt Pending (active low) */
366
367#define FCR_ITL2 (1 << 7) /* Interrupt Trigger Level */
368#define FCR_ITL1 (1 << 6) /* Interrupt Trigger Level */
369#define FCR_RESETTF (1 << 2) /* Reset Transmitter FIFO */
370#define FCR_RESETRF (1 << 1) /* Reset Receiver FIFO */
371#define FCR_TRFIFOE (1 << 0) /* Transmit and Receive FIFO Enable */
372#define FCR_ITL_1 (0)
373#define FCR_ITL_8 (FCR_ITL1)
374#define FCR_ITL_16 (FCR_ITL2)
375#define FCR_ITL_32 (FCR_ITL2|FCR_ITL1)
376
377#define LCR_DLAB (1 << 7) /* Divisor Latch Access Bit */
378#define LCR_SB (1 << 6) /* Set Break */
379#define LCR_STKYP (1 << 5) /* Sticky Parity */
380#define LCR_EPS (1 << 4) /* Even Parity Select */
381#define LCR_PEN (1 << 3) /* Parity Enable */
382#define LCR_STB (1 << 2) /* Stop Bit */
383#define LCR_WLS1 (1 << 1) /* Word Length Select */
384#define LCR_WLS0 (1 << 0) /* Word Length Select */
385
386#define LSR_FIFOE (1 << 7) /* FIFO Error Status */
387#define LSR_TEMT (1 << 6) /* Transmitter Empty */
388#define LSR_TDRQ (1 << 5) /* Transmit Data Request */
389#define LSR_BI (1 << 4) /* Break Interrupt */
390#define LSR_FE (1 << 3) /* Framing Error */
391#define LSR_PE (1 << 2) /* Parity Error */
392#define LSR_OE (1 << 1) /* Overrun Error */
393#define LSR_DR (1 << 0) /* Data Ready */
394
395#define MCR_LOOP (1 << 4)
396#define MCR_OUT2 (1 << 3) /* force MSR_DCD in loopback mode */
397#define MCR_OUT1 (1 << 2) /* force MSR_RI in loopback mode */
398#define MCR_RTS (1 << 1) /* Request to Send */
399#define MCR_DTR (1 << 0) /* Data Terminal Ready */
400
401#define MSR_DCD (1 << 7) /* Data Carrier Detect */
402#define MSR_RI (1 << 6) /* Ring Indicator */
403#define MSR_DSR (1 << 5) /* Data Set Ready */
404#define MSR_CTS (1 << 4) /* Clear To Send */
405#define MSR_DDCD (1 << 3) /* Delta Data Carrier Detect */
406#define MSR_TERI (1 << 2) /* Trailing Edge Ring Indicator */
407#define MSR_DDSR (1 << 1) /* Delta Data Set Ready */
408#define MSR_DCTS (1 << 0) /* Delta Clear To Send */
409
410/*
411 * IrSR (Infrared Selection Register)
412 */
413#define STISR_RXPL (1 << 4) /* Receive Data Polarity */
414#define STISR_TXPL (1 << 3) /* Transmit Data Polarity */
415#define STISR_XMODE (1 << 2) /* Transmit Pulse Width Select */
416#define STISR_RCVEIR (1 << 1) /* Receiver SIR Enable */
417#define STISR_XMITIR (1 << 0) /* Transmitter SIR Enable */
418
419
420/*
421 * I2C registers
422 */
423
424#define IBMR __REG(0x40301680) /* I2C Bus Monitor Register - IBMR */
425#define IDBR __REG(0x40301688) /* I2C Data Buffer Register - IDBR */
426#define ICR __REG(0x40301690) /* I2C Control Register - ICR */
427#define ISR __REG(0x40301698) /* I2C Status Register - ISR */
428#define ISAR __REG(0x403016A0) /* I2C Slave Address Register - ISAR */
429
430#define PWRIBMR __REG(0x40f00180) /* Power I2C Bus Monitor Register-IBMR */
431#define PWRIDBR __REG(0x40f00188) /* Power I2C Data Buffer Register-IDBR */
432#define PWRICR __REG(0x40f00190) /* Power I2C Control Register - ICR */
433#define PWRISR __REG(0x40f00198) /* Power I2C Status Register - ISR */
434#define PWRISAR __REG(0x40f001A0) /*Power I2C Slave Address Register-ISAR */
435
436#define ICR_START (1 << 0) /* start bit */
437#define ICR_STOP (1 << 1) /* stop bit */
438#define ICR_ACKNAK (1 << 2) /* send ACK(0) or NAK(1) */
439#define ICR_TB (1 << 3) /* transfer byte bit */
440#define ICR_MA (1 << 4) /* master abort */
441#define ICR_SCLE (1 << 5) /* master clock enable */
442#define ICR_IUE (1 << 6) /* unit enable */
443#define ICR_GCD (1 << 7) /* general call disable */
444#define ICR_ITEIE (1 << 8) /* enable tx interrupts */
445#define ICR_IRFIE (1 << 9) /* enable rx interrupts */
446#define ICR_BEIE (1 << 10) /* enable bus error ints */
447#define ICR_SSDIE (1 << 11) /* slave STOP detected int enable */
448#define ICR_ALDIE (1 << 12) /* enable arbitration interrupt */
449#define ICR_SADIE (1 << 13) /* slave address detected int enable */
450#define ICR_UR (1 << 14) /* unit reset */
451
452#define ISR_RWM (1 << 0) /* read/write mode */
453#define ISR_ACKNAK (1 << 1) /* ack/nak status */
454#define ISR_UB (1 << 2) /* unit busy */
455#define ISR_IBB (1 << 3) /* bus busy */
456#define ISR_SSD (1 << 4) /* slave stop detected */
457#define ISR_ALD (1 << 5) /* arbitration loss detected */
458#define ISR_ITE (1 << 6) /* tx buffer empty */
459#define ISR_IRF (1 << 7) /* rx buffer full */
460#define ISR_GCAD (1 << 8) /* general call address detected */
461#define ISR_SAD (1 << 9) /* slave address detected */
462#define ISR_BED (1 << 10) /* bus error no ACK/NAK */
463
464
465/*
466 * Serial Audio Controller
467 */
468
469#define SACR0 __REG(0x40400000) /* Global Control Register */
470#define SACR1 __REG(0x40400004) /* Serial Audio I 2 S/MSB-Justified Control Register */
471#define SASR0 __REG(0x4040000C) /* Serial Audio I 2 S/MSB-Justified Interface and FIFO Status Register */
472#define SAIMR __REG(0x40400014) /* Serial Audio Interrupt Mask Register */
473#define SAICR __REG(0x40400018) /* Serial Audio Interrupt Clear Register */
474#define SADIV __REG(0x40400060) /* Audio Clock Divider Register. */
475#define SADR __REG(0x40400080) /* Serial Audio Data Register (TX and RX FIFO access Register). */
476
477#define SACR0_RFTH(x) ((x) << 12) /* Rx FIFO Interrupt or DMA Trigger Threshold */
478#define SACR0_TFTH(x) ((x) << 8) /* Tx FIFO Interrupt or DMA Trigger Threshold */
479#define SACR0_STRF (1 << 5) /* FIFO Select for EFWR Special Function */
480#define SACR0_EFWR (1 << 4) /* Enable EFWR Function */
481#define SACR0_RST (1 << 3) /* FIFO, i2s Register Reset */
482#define SACR0_BCKD (1 << 2) /* Bit Clock Direction */
483#define SACR0_ENB (1 << 0) /* Enable I2S Link */
484#define SACR1_ENLBF (1 << 5) /* Enable Loopback */
485#define SACR1_DRPL (1 << 4) /* Disable Replaying Function */
486#define SACR1_DREC (1 << 3) /* Disable Recording Function */
487#define SACR1_AMSL (1 << 0) /* Specify Alternate Mode */
488
489#define SASR0_I2SOFF (1 << 7) /* Controller Status */
490#define SASR0_ROR (1 << 6) /* Rx FIFO Overrun */
491#define SASR0_TUR (1 << 5) /* Tx FIFO Underrun */
492#define SASR0_RFS (1 << 4) /* Rx FIFO Service Request */
493#define SASR0_TFS (1 << 3) /* Tx FIFO Service Request */
494#define SASR0_BSY (1 << 2) /* I2S Busy */
495#define SASR0_RNE (1 << 1) /* Rx FIFO Not Empty */
496#define SASR0_TNF (1 << 0) /* Tx FIFO Not Empty */
497
498#define SAICR_ROR (1 << 6) /* Clear Rx FIFO Overrun Interrupt */
499#define SAICR_TUR (1 << 5) /* Clear Tx FIFO Underrun Interrupt */
500
501#define SAIMR_ROR (1 << 6) /* Enable Rx FIFO Overrun Condition Interrupt */
502#define SAIMR_TUR (1 << 5) /* Enable Tx FIFO Underrun Condition Interrupt */
503#define SAIMR_RFS (1 << 4) /* Enable Rx FIFO Service Interrupt */
504#define SAIMR_TFS (1 << 3) /* Enable Tx FIFO Service Interrupt */
505
506/*
507 * AC97 Controller registers
508 */
509
510#define POCR __REG(0x40500000) /* PCM Out Control Register */
511#define POCR_FEIE (1 << 3) /* FIFO Error Interrupt Enable */
512#define POCR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
513
514#define PICR __REG(0x40500004) /* PCM In Control Register */
515#define PICR_FEIE (1 << 3) /* FIFO Error Interrupt Enable */
516#define PICR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
517
518#define MCCR __REG(0x40500008) /* Mic In Control Register */
519#define MCCR_FEIE (1 << 3) /* FIFO Error Interrupt Enable */
520#define MCCR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
521
522#define GCR __REG(0x4050000C) /* Global Control Register */
523#ifdef CONFIG_PXA3xx
524#define GCR_CLKBPB (1 << 31) /* Internal clock enable */
525#endif
526#define GCR_nDMAEN (1 << 24) /* non DMA Enable */
527#define GCR_CDONE_IE (1 << 19) /* Command Done Interrupt Enable */
528#define GCR_SDONE_IE (1 << 18) /* Status Done Interrupt Enable */
529#define GCR_SECRDY_IEN (1 << 9) /* Secondary Ready Interrupt Enable */
530#define GCR_PRIRDY_IEN (1 << 8) /* Primary Ready Interrupt Enable */
531#define GCR_SECRES_IEN (1 << 5) /* Secondary Resume Interrupt Enable */
532#define GCR_PRIRES_IEN (1 << 4) /* Primary Resume Interrupt Enable */
533#define GCR_ACLINK_OFF (1 << 3) /* AC-link Shut Off */
534#define GCR_WARM_RST (1 << 2) /* AC97 Warm Reset */
535#define GCR_COLD_RST (1 << 1) /* AC'97 Cold Reset (0 = active) */
536#define GCR_GIE (1 << 0) /* Codec GPI Interrupt Enable */
537
538#define POSR __REG(0x40500010) /* PCM Out Status Register */
539#define POSR_FIFOE (1 << 4) /* FIFO error */
540#define POSR_FSR (1 << 2) /* FIFO Service Request */
541
542#define PISR __REG(0x40500014) /* PCM In Status Register */
543#define PISR_FIFOE (1 << 4) /* FIFO error */
544#define PISR_EOC (1 << 3) /* DMA End-of-Chain (exclusive clear) */
545#define PISR_FSR (1 << 2) /* FIFO Service Request */
546
547#define MCSR __REG(0x40500018) /* Mic In Status Register */
548#define MCSR_FIFOE (1 << 4) /* FIFO error */
549#define MCSR_EOC (1 << 3) /* DMA End-of-Chain (exclusive clear) */
550#define MCSR_FSR (1 << 2) /* FIFO Service Request */
551
552#define GSR __REG(0x4050001C) /* Global Status Register */
553#define GSR_CDONE (1 << 19) /* Command Done */
554#define GSR_SDONE (1 << 18) /* Status Done */
555#define GSR_RDCS (1 << 15) /* Read Completion Status */
556#define GSR_BIT3SLT12 (1 << 14) /* Bit 3 of slot 12 */
557#define GSR_BIT2SLT12 (1 << 13) /* Bit 2 of slot 12 */
558#define GSR_BIT1SLT12 (1 << 12) /* Bit 1 of slot 12 */
559#define GSR_SECRES (1 << 11) /* Secondary Resume Interrupt */
560#define GSR_PRIRES (1 << 10) /* Primary Resume Interrupt */
561#define GSR_SCR (1 << 9) /* Secondary Codec Ready */
562#define GSR_PCR (1 << 8) /* Primary Codec Ready */
563#define GSR_MCINT (1 << 7) /* Mic In Interrupt */
564#define GSR_POINT (1 << 6) /* PCM Out Interrupt */
565#define GSR_PIINT (1 << 5) /* PCM In Interrupt */
566#define GSR_ACOFFD (1 << 3) /* AC-link Shut Off Done */
567#define GSR_MOINT (1 << 2) /* Modem Out Interrupt */
568#define GSR_MIINT (1 << 1) /* Modem In Interrupt */
569#define GSR_GSCI (1 << 0) /* Codec GPI Status Change Interrupt */
570
571#define CAR __REG(0x40500020) /* CODEC Access Register */
572#define CAR_CAIP (1 << 0) /* Codec Access In Progress */
573
574#define PCDR __REG(0x40500040) /* PCM FIFO Data Register */
575#define MCDR __REG(0x40500060) /* Mic-in FIFO Data Register */
576
577#define MOCR __REG(0x40500100) /* Modem Out Control Register */
578#define MOCR_FEIE (1 << 3) /* FIFO Error */
579#define MOCR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
580
581#define MICR __REG(0x40500108) /* Modem In Control Register */
582#define MICR_FEIE (1 << 3) /* FIFO Error */
583#define MICR_FSRIE (1 << 1) /* FIFO Service Request Interrupt Enable */
584
585#define MOSR __REG(0x40500110) /* Modem Out Status Register */
586#define MOSR_FIFOE (1 << 4) /* FIFO error */
587#define MOSR_FSR (1 << 2) /* FIFO Service Request */
588
589#define MISR __REG(0x40500118) /* Modem In Status Register */
590#define MISR_FIFOE (1 << 4) /* FIFO error */
591#define MISR_EOC (1 << 3) /* DMA End-of-Chain (exclusive clear) */
592#define MISR_FSR (1 << 2) /* FIFO Service Request */
593
594#define MODR __REG(0x40500140) /* Modem FIFO Data Register */
595
596#define PAC_REG_BASE __REG(0x40500200) /* Primary Audio Codec */
597#define SAC_REG_BASE __REG(0x40500300) /* Secondary Audio Codec */
598#define PMC_REG_BASE __REG(0x40500400) /* Primary Modem Codec */
599#define SMC_REG_BASE __REG(0x40500500) /* Secondary Modem Codec */
600
601
602/*
603 * Fast Infrared Communication Port
604 */
605
606#define FICP __REG(0x40800000) /* Start of FICP area */
607#define ICCR0 __REG(0x40800000) /* ICP Control Register 0 */
608#define ICCR1 __REG(0x40800004) /* ICP Control Register 1 */
609#define ICCR2 __REG(0x40800008) /* ICP Control Register 2 */
610#define ICDR __REG(0x4080000c) /* ICP Data Register */
611#define ICSR0 __REG(0x40800014) /* ICP Status Register 0 */
612#define ICSR1 __REG(0x40800018) /* ICP Status Register 1 */
613
614#define ICCR0_AME (1 << 7) /* Address match enable */
615#define ICCR0_TIE (1 << 6) /* Transmit FIFO interrupt enable */
616#define ICCR0_RIE (1 << 5) /* Recieve FIFO interrupt enable */
617#define ICCR0_RXE (1 << 4) /* Receive enable */
618#define ICCR0_TXE (1 << 3) /* Transmit enable */
619#define ICCR0_TUS (1 << 2) /* Transmit FIFO underrun select */
620#define ICCR0_LBM (1 << 1) /* Loopback mode */
621#define ICCR0_ITR (1 << 0) /* IrDA transmission */
622
623#define ICCR2_RXP (1 << 3) /* Receive Pin Polarity select */
624#define ICCR2_TXP (1 << 2) /* Transmit Pin Polarity select */
625#define ICCR2_TRIG (3 << 0) /* Receive FIFO Trigger threshold */
626#define ICCR2_TRIG_8 (0 << 0) /* >= 8 bytes */
627#define ICCR2_TRIG_16 (1 << 0) /* >= 16 bytes */
628#define ICCR2_TRIG_32 (2 << 0) /* >= 32 bytes */
629
630#ifdef CONFIG_PXA27x
631#define ICSR0_EOC (1 << 6) /* DMA End of Descriptor Chain */
632#endif
633#define ICSR0_FRE (1 << 5) /* Framing error */
634#define ICSR0_RFS (1 << 4) /* Receive FIFO service request */
635#define ICSR0_TFS (1 << 3) /* Transnit FIFO service request */
636#define ICSR0_RAB (1 << 2) /* Receiver abort */
637#define ICSR0_TUR (1 << 1) /* Trunsmit FIFO underun */
638#define ICSR0_EIF (1 << 0) /* End/Error in FIFO */
639
640#define ICSR1_ROR (1 << 6) /* Receiver FIFO underrun */
641#define ICSR1_CRE (1 << 5) /* CRC error */
642#define ICSR1_EOF (1 << 4) /* End of frame */
643#define ICSR1_TNF (1 << 3) /* Transmit FIFO not full */
644#define ICSR1_RNE (1 << 2) /* Receive FIFO not empty */
645#define ICSR1_TBY (1 << 1) /* Tramsmiter busy flag */
646#define ICSR1_RSY (1 << 0) /* Recevier synchronized flag */
647
648
649/*
650 * Real Time Clock
651 */
652
653#define RCNR __REG(0x40900000) /* RTC Count Register */
654#define RTAR __REG(0x40900004) /* RTC Alarm Register */
655#define RTSR __REG(0x40900008) /* RTC Status Register */
656#define RTTR __REG(0x4090000C) /* RTC Timer Trim Register */
657#define PIAR __REG(0x40900038) /* Periodic Interrupt Alarm Register */
658
659#define RTSR_PICE (1 << 15) /* Periodic interrupt count enable */
660#define RTSR_PIALE (1 << 14) /* Periodic interrupt Alarm enable */
661#define RTSR_HZE (1 << 3) /* HZ interrupt enable */
662#define RTSR_ALE (1 << 2) /* RTC alarm interrupt enable */
663#define RTSR_HZ (1 << 1) /* HZ rising-edge detected */
664#define RTSR_AL (1 << 0) /* RTC alarm detected */
665
666
667/*
668 * OS Timer & Match Registers
669 */
670
671#define OSMR0 __REG(0x40A00000) /* */
672#define OSMR1 __REG(0x40A00004) /* */
673#define OSMR2 __REG(0x40A00008) /* */
674#define OSMR3 __REG(0x40A0000C) /* */
675#define OSMR4 __REG(0x40A00080) /* */
676#define OSCR __REG(0x40A00010) /* OS Timer Counter Register */
677#define OSCR4 __REG(0x40A00040) /* OS Timer Counter Register */
678#define OMCR4 __REG(0x40A000C0) /* */
679#define OSSR __REG(0x40A00014) /* OS Timer Status Register */
680#define OWER __REG(0x40A00018) /* OS Timer Watchdog Enable Register */
681#define OIER __REG(0x40A0001C) /* OS Timer Interrupt Enable Register */
682
683#define OSSR_M3 (1 << 3) /* Match status channel 3 */
684#define OSSR_M2 (1 << 2) /* Match status channel 2 */
685#define OSSR_M1 (1 << 1) /* Match status channel 1 */
686#define OSSR_M0 (1 << 0) /* Match status channel 0 */
687
688#define OWER_WME (1 << 0) /* Watchdog Match Enable */
689
690#define OIER_E3 (1 << 3) /* Interrupt enable channel 3 */
691#define OIER_E2 (1 << 2) /* Interrupt enable channel 2 */
692#define OIER_E1 (1 << 1) /* Interrupt enable channel 1 */
693#define OIER_E0 (1 << 0) /* Interrupt enable channel 0 */
694
695
696/*
697 * Pulse Width Modulator
698 */
699
700#define PWM_CTRL0 __REG(0x40B00000) /* PWM 0 Control Register */
701#define PWM_PWDUTY0 __REG(0x40B00004) /* PWM 0 Duty Cycle Register */
702#define PWM_PERVAL0 __REG(0x40B00008) /* PWM 0 Period Control Register */
703
704#define PWM_CTRL1 __REG(0x40C00000) /* PWM 1Control Register */
705#define PWM_PWDUTY1 __REG(0x40C00004) /* PWM 1 Duty Cycle Register */
706#define PWM_PERVAL1 __REG(0x40C00008) /* PWM 1 Period Control Register */
707
708
709/*
710 * Interrupt Controller
711 */
712
713#define ICIP __REG(0x40D00000) /* Interrupt Controller IRQ Pending Register */
714#define ICMR __REG(0x40D00004) /* Interrupt Controller Mask Register */
715#define ICLR __REG(0x40D00008) /* Interrupt Controller Level Register */
716#define ICFP __REG(0x40D0000C) /* Interrupt Controller FIQ Pending Register */
717#define ICPR __REG(0x40D00010) /* Interrupt Controller Pending Register */
718#define ICCR __REG(0x40D00014) /* Interrupt Controller Control Register */
719
720#define ICIP2 __REG(0x40D0009C) /* Interrupt Controller IRQ Pending Register 2 */
721#define ICMR2 __REG(0x40D000A0) /* Interrupt Controller Mask Register 2 */
722#define ICLR2 __REG(0x40D000A4) /* Interrupt Controller Level Register 2 */
723#define ICFP2 __REG(0x40D000A8) /* Interrupt Controller FIQ Pending Register 2 */
724#define ICPR2 __REG(0x40D000AC) /* Interrupt Controller Pending Register 2 */
725
726/*
727 * General Purpose I/O
728 */
729
730#define GPIO0_BASE ((void __iomem *)io_p2v(0x40E00000))
731#define GPIO1_BASE ((void __iomem *)io_p2v(0x40E00004))
732#define GPIO2_BASE ((void __iomem *)io_p2v(0x40E00008))
733#define GPIO3_BASE ((void __iomem *)io_p2v(0x40E00100))
734
735#define GPLR_OFFSET 0x00
736#define GPDR_OFFSET 0x0C
737#define GPSR_OFFSET 0x18
738#define GPCR_OFFSET 0x24
739#define GRER_OFFSET 0x30
740#define GFER_OFFSET 0x3C
741#define GEDR_OFFSET 0x48
742
743#define GPLR0 __REG(0x40E00000) /* GPIO Pin-Level Register GPIO<31:0> */
744#define GPLR1 __REG(0x40E00004) /* GPIO Pin-Level Register GPIO<63:32> */
745#define GPLR2 __REG(0x40E00008) /* GPIO Pin-Level Register GPIO<80:64> */
746
747#define GPDR0 __REG(0x40E0000C) /* GPIO Pin Direction Register GPIO<31:0> */
748#define GPDR1 __REG(0x40E00010) /* GPIO Pin Direction Register GPIO<63:32> */
749#define GPDR2 __REG(0x40E00014) /* GPIO Pin Direction Register GPIO<80:64> */
750
751#define GPSR0 __REG(0x40E00018) /* GPIO Pin Output Set Register GPIO<31:0> */
752#define GPSR1 __REG(0x40E0001C) /* GPIO Pin Output Set Register GPIO<63:32> */
753#define GPSR2 __REG(0x40E00020) /* GPIO Pin Output Set Register GPIO<80:64> */
754
755#define GPCR0 __REG(0x40E00024) /* GPIO Pin Output Clear Register GPIO<31:0> */
756#define GPCR1 __REG(0x40E00028) /* GPIO Pin Output Clear Register GPIO <63:32> */
757#define GPCR2 __REG(0x40E0002C) /* GPIO Pin Output Clear Register GPIO <80:64> */
758
759#define GRER0 __REG(0x40E00030) /* GPIO Rising-Edge Detect Register GPIO<31:0> */
760#define GRER1 __REG(0x40E00034) /* GPIO Rising-Edge Detect Register GPIO<63:32> */
761#define GRER2 __REG(0x40E00038) /* GPIO Rising-Edge Detect Register GPIO<80:64> */
762
763#define GFER0 __REG(0x40E0003C) /* GPIO Falling-Edge Detect Register GPIO<31:0> */
764#define GFER1 __REG(0x40E00040) /* GPIO Falling-Edge Detect Register GPIO<63:32> */
765#define GFER2 __REG(0x40E00044) /* GPIO Falling-Edge Detect Register GPIO<80:64> */
766
767#define GEDR0 __REG(0x40E00048) /* GPIO Edge Detect Status Register GPIO<31:0> */
768#define GEDR1 __REG(0x40E0004C) /* GPIO Edge Detect Status Register GPIO<63:32> */
769#define GEDR2 __REG(0x40E00050) /* GPIO Edge Detect Status Register GPIO<80:64> */
770
771#define GAFR0_L __REG(0x40E00054) /* GPIO Alternate Function Select Register GPIO<15:0> */
772#define GAFR0_U __REG(0x40E00058) /* GPIO Alternate Function Select Register GPIO<31:16> */
773#define GAFR1_L __REG(0x40E0005C) /* GPIO Alternate Function Select Register GPIO<47:32> */
774#define GAFR1_U __REG(0x40E00060) /* GPIO Alternate Function Select Register GPIO<63:48> */
775#define GAFR2_L __REG(0x40E00064) /* GPIO Alternate Function Select Register GPIO<79:64> */
776#define GAFR2_U __REG(0x40E00068) /* GPIO Alternate Function Select Register GPIO<95-80> */
777#define GAFR3_L __REG(0x40E0006C) /* GPIO Alternate Function Select Register GPIO<111:96> */
778#define GAFR3_U __REG(0x40E00070) /* GPIO Alternate Function Select Register GPIO<127:112> */
779
780#define GPLR3 __REG(0x40E00100) /* GPIO Pin-Level Register GPIO<127:96> */
781#define GPDR3 __REG(0x40E0010C) /* GPIO Pin Direction Register GPIO<127:96> */
782#define GPSR3 __REG(0x40E00118) /* GPIO Pin Output Set Register GPIO<127:96> */
783#define GPCR3 __REG(0x40E00124) /* GPIO Pin Output Clear Register GPIO<127:96> */
784#define GRER3 __REG(0x40E00130) /* GPIO Rising-Edge Detect Register GPIO<127:96> */
785#define GFER3 __REG(0x40E0013C) /* GPIO Falling-Edge Detect Register GPIO<127:96> */
786#define GEDR3 __REG(0x40E00148) /* GPIO Edge Detect Status Register GPIO<127:96> */
787
788/* More handy macros. The argument is a literal GPIO number. */
789
790#define GPIO_bit(x) (1 << ((x) & 0x1f))
791
792#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
793
794/* Interrupt Controller */
795
796#define _GPLR(x) __REG2(0x40E00000, ((x) & 0x60) >> 3)
797#define _GPDR(x) __REG2(0x40E0000C, ((x) & 0x60) >> 3)
798#define _GPSR(x) __REG2(0x40E00018, ((x) & 0x60) >> 3)
799#define _GPCR(x) __REG2(0x40E00024, ((x) & 0x60) >> 3)
800#define _GRER(x) __REG2(0x40E00030, ((x) & 0x60) >> 3)
801#define _GFER(x) __REG2(0x40E0003C, ((x) & 0x60) >> 3)
802#define _GEDR(x) __REG2(0x40E00048, ((x) & 0x60) >> 3)
803#define _GAFR(x) __REG2(0x40E00054, ((x) & 0x70) >> 2)
804
805#define GPLR(x) (*((((x) & 0x7f) < 96) ? &_GPLR(x) : &GPLR3))
806#define GPDR(x) (*((((x) & 0x7f) < 96) ? &_GPDR(x) : &GPDR3))
807#define GPSR(x) (*((((x) & 0x7f) < 96) ? &_GPSR(x) : &GPSR3))
808#define GPCR(x) (*((((x) & 0x7f) < 96) ? &_GPCR(x) : &GPCR3))
809#define GRER(x) (*((((x) & 0x7f) < 96) ? &_GRER(x) : &GRER3))
810#define GFER(x) (*((((x) & 0x7f) < 96) ? &_GFER(x) : &GFER3))
811#define GEDR(x) (*((((x) & 0x7f) < 96) ? &_GEDR(x) : &GEDR3))
812#define GAFR(x) (*((((x) & 0x7f) < 96) ? &_GAFR(x) : \
813 ((((x) & 0x7f) < 112) ? &GAFR3_L : &GAFR3_U)))
814#else
815
816#define GPLR(x) __REG2(0x40E00000, ((x) & 0x60) >> 3)
817#define GPDR(x) __REG2(0x40E0000C, ((x) & 0x60) >> 3)
818#define GPSR(x) __REG2(0x40E00018, ((x) & 0x60) >> 3)
819#define GPCR(x) __REG2(0x40E00024, ((x) & 0x60) >> 3)
820#define GRER(x) __REG2(0x40E00030, ((x) & 0x60) >> 3)
821#define GFER(x) __REG2(0x40E0003C, ((x) & 0x60) >> 3)
822#define GEDR(x) __REG2(0x40E00048, ((x) & 0x60) >> 3)
823#define GAFR(x) __REG2(0x40E00054, ((x) & 0x70) >> 2)
824
825#endif
826
827/*
828 * Power Manager - see pxa2xx-regs.h
829 */
830
831/*
832 * SSP Serial Port Registers - see arch/arm/mach-pxa/include/mach/regs-ssp.h
833 */
834
835/*
836 * MultiMediaCard (MMC) controller - see drivers/mmc/host/pxamci.h
837 */
838
839/*
840 * Core Clock - see arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
841 */
842
843#ifdef CONFIG_PXA27x
844
845/* Camera Interface */
846#define CICR0 __REG(0x50000000)
847#define CICR1 __REG(0x50000004)
848#define CICR2 __REG(0x50000008)
849#define CICR3 __REG(0x5000000C)
850#define CICR4 __REG(0x50000010)
851#define CISR __REG(0x50000014)
852#define CIFR __REG(0x50000018)
853#define CITOR __REG(0x5000001C)
854#define CIBR0 __REG(0x50000028)
855#define CIBR1 __REG(0x50000030)
856#define CIBR2 __REG(0x50000038)
857
858#define CICR0_DMAEN (1 << 31) /* DMA request enable */
859#define CICR0_PAR_EN (1 << 30) /* Parity enable */
860#define CICR0_SL_CAP_EN (1 << 29) /* Capture enable for slave mode */
861#define CICR0_ENB (1 << 28) /* Camera interface enable */
862#define CICR0_DIS (1 << 27) /* Camera interface disable */
863#define CICR0_SIM (0x7 << 24) /* Sensor interface mode mask */
864#define CICR0_TOM (1 << 9) /* Time-out mask */
865#define CICR0_RDAVM (1 << 8) /* Receive-data-available mask */
866#define CICR0_FEM (1 << 7) /* FIFO-empty mask */
867#define CICR0_EOLM (1 << 6) /* End-of-line mask */
868#define CICR0_PERRM (1 << 5) /* Parity-error mask */
869#define CICR0_QDM (1 << 4) /* Quick-disable mask */
870#define CICR0_CDM (1 << 3) /* Disable-done mask */
871#define CICR0_SOFM (1 << 2) /* Start-of-frame mask */
872#define CICR0_EOFM (1 << 1) /* End-of-frame mask */
873#define CICR0_FOM (1 << 0) /* FIFO-overrun mask */
874
875#define CICR1_TBIT (1 << 31) /* Transparency bit */
876#define CICR1_RGBT_CONV (0x3 << 29) /* RGBT conversion mask */
877#define CICR1_PPL (0x7ff << 15) /* Pixels per line mask */
878#define CICR1_RGB_CONV (0x7 << 12) /* RGB conversion mask */
879#define CICR1_RGB_F (1 << 11) /* RGB format */
880#define CICR1_YCBCR_F (1 << 10) /* YCbCr format */
881#define CICR1_RGB_BPP (0x7 << 7) /* RGB bis per pixel mask */
882#define CICR1_RAW_BPP (0x3 << 5) /* Raw bis per pixel mask */
883#define CICR1_COLOR_SP (0x3 << 3) /* Color space mask */
884#define CICR1_DW (0x7 << 0) /* Data width mask */
885
886#define CICR2_BLW (0xff << 24) /* Beginning-of-line pixel clock
887 wait count mask */
888#define CICR2_ELW (0xff << 16) /* End-of-line pixel clock
889 wait count mask */
890#define CICR2_HSW (0x3f << 10) /* Horizontal sync pulse width mask */
891#define CICR2_BFPW (0x3f << 3) /* Beginning-of-frame pixel clock
892 wait count mask */
893#define CICR2_FSW (0x7 << 0) /* Frame stabilization
894 wait count mask */
895
896#define CICR3_BFW (0xff << 24) /* Beginning-of-frame line clock
897 wait count mask */
898#define CICR3_EFW (0xff << 16) /* End-of-frame line clock
899 wait count mask */
900#define CICR3_VSW (0x3f << 10) /* Vertical sync pulse width mask */
901#define CICR3_BFPW (0x3f << 3) /* Beginning-of-frame pixel clock
902 wait count mask */
903#define CICR3_LPF (0x7ff << 0) /* Lines per frame mask */
904
905#define CICR4_MCLK_DLY (0x3 << 24) /* MCLK Data Capture Delay mask */
906#define CICR4_PCLK_EN (1 << 23) /* Pixel clock enable */
907#define CICR4_PCP (1 << 22) /* Pixel clock polarity */
908#define CICR4_HSP (1 << 21) /* Horizontal sync polarity */
909#define CICR4_VSP (1 << 20) /* Vertical sync polarity */
910#define CICR4_MCLK_EN (1 << 19) /* MCLK enable */
911#define CICR4_FR_RATE (0x7 << 8) /* Frame rate mask */
912#define CICR4_DIV (0xff << 0) /* Clock divisor mask */
913
914#define CISR_FTO (1 << 15) /* FIFO time-out */
915#define CISR_RDAV_2 (1 << 14) /* Channel 2 receive data available */
916#define CISR_RDAV_1 (1 << 13) /* Channel 1 receive data available */
917#define CISR_RDAV_0 (1 << 12) /* Channel 0 receive data available */
918#define CISR_FEMPTY_2 (1 << 11) /* Channel 2 FIFO empty */
919#define CISR_FEMPTY_1 (1 << 10) /* Channel 1 FIFO empty */
920#define CISR_FEMPTY_0 (1 << 9) /* Channel 0 FIFO empty */
921#define CISR_EOL (1 << 8) /* End of line */
922#define CISR_PAR_ERR (1 << 7) /* Parity error */
923#define CISR_CQD (1 << 6) /* Camera interface quick disable */
924#define CISR_CDD (1 << 5) /* Camera interface disable done */
925#define CISR_SOF (1 << 4) /* Start of frame */
926#define CISR_EOF (1 << 3) /* End of frame */
927#define CISR_IFO_2 (1 << 2) /* FIFO overrun for Channel 2 */
928#define CISR_IFO_1 (1 << 1) /* FIFO overrun for Channel 1 */
929#define CISR_IFO_0 (1 << 0) /* FIFO overrun for Channel 0 */
930
931#define CIFR_FLVL2 (0x7f << 23) /* FIFO 2 level mask */
932#define CIFR_FLVL1 (0x7f << 16) /* FIFO 1 level mask */
933#define CIFR_FLVL0 (0xff << 8) /* FIFO 0 level mask */
934#define CIFR_THL_0 (0x3 << 4) /* Threshold Level for Channel 0 FIFO */
935#define CIFR_RESET_F (1 << 3) /* Reset input FIFOs */
936#define CIFR_FEN2 (1 << 2) /* FIFO enable for channel 2 */
937#define CIFR_FEN1 (1 << 1) /* FIFO enable for channel 1 */
938#define CIFR_FEN0 (1 << 0) /* FIFO enable for channel 0 */
939
940#define SRAM_SIZE 0x40000 /* 4x64K */
941
942#define SRAM_MEM_PHYS 0x5C000000
943
944#define IMPMCR __REG(0x58000000) /* IM Power Management Control Reg */
945#define IMPMSR __REG(0x58000008) /* IM Power Management Status Reg */
946
947#define IMPMCR_PC3 (0x3 << 22) /* Bank 3 Power Control */
948#define IMPMCR_PC3_RUN_MODE (0x0 << 22) /* Run mode */
949#define IMPMCR_PC3_STANDBY_MODE (0x1 << 22) /* Standby mode */
950#define IMPMCR_PC3_AUTO_MODE (0x3 << 22) /* Automatically controlled */
951
952#define IMPMCR_PC2 (0x3 << 20) /* Bank 2 Power Control */
953#define IMPMCR_PC2_RUN_MODE (0x0 << 20) /* Run mode */
954#define IMPMCR_PC2_STANDBY_MODE (0x1 << 20) /* Standby mode */
955#define IMPMCR_PC2_AUTO_MODE (0x3 << 20) /* Automatically controlled */
956
957#define IMPMCR_PC1 (0x3 << 18) /* Bank 1 Power Control */
958#define IMPMCR_PC1_RUN_MODE (0x0 << 18) /* Run mode */
959#define IMPMCR_PC1_STANDBY_MODE (0x1 << 18) /* Standby mode */
960#define IMPMCR_PC1_AUTO_MODE (0x3 << 18) /* Automatically controlled */
961
962#define IMPMCR_PC0 (0x3 << 16) /* Bank 0 Power Control */
963#define IMPMCR_PC0_RUN_MODE (0x0 << 16) /* Run mode */
964#define IMPMCR_PC0_STANDBY_MODE (0x1 << 16) /* Standby mode */
965#define IMPMCR_PC0_AUTO_MODE (0x3 << 16) /* Automatically controlled */
966
967#define IMPMCR_AW3 (1 << 11) /* Bank 3 Automatic Wake-up enable */
968#define IMPMCR_AW2 (1 << 10) /* Bank 2 Automatic Wake-up enable */
969#define IMPMCR_AW1 (1 << 9) /* Bank 1 Automatic Wake-up enable */
970#define IMPMCR_AW0 (1 << 8) /* Bank 0 Automatic Wake-up enable */
971
972#define IMPMCR_DST (0xFF << 0) /* Delay Standby Time, ms */
973
974#define IMPMSR_PS3 (0x3 << 6) /* Bank 3 Power Status: */
975#define IMPMSR_PS3_RUN_MODE (0x0 << 6) /* Run mode */
976#define IMPMSR_PS3_STANDBY_MODE (0x1 << 6) /* Standby mode */
977
978#define IMPMSR_PS2 (0x3 << 4) /* Bank 2 Power Status: */
979#define IMPMSR_PS2_RUN_MODE (0x0 << 4) /* Run mode */
980#define IMPMSR_PS2_STANDBY_MODE (0x1 << 4) /* Standby mode */
981
982#define IMPMSR_PS1 (0x3 << 2) /* Bank 1 Power Status: */
983#define IMPMSR_PS1_RUN_MODE (0x0 << 2) /* Run mode */
984#define IMPMSR_PS1_STANDBY_MODE (0x1 << 2) /* Standby mode */
985
986#define IMPMSR_PS0 (0x3 << 0) /* Bank 0 Power Status: */
987#define IMPMSR_PS0_RUN_MODE (0x0 << 0) /* Run mode */
988#define IMPMSR_PS0_STANDBY_MODE (0x1 << 0) /* Standby mode */
989
990#endif
991
992#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
993/*
994 * UHC: USB Host Controller (OHCI-like) register definitions
995 */
996#define UHC_BASE_PHYS (0x4C000000)
997#define UHCREV __REG(0x4C000000) /* UHC HCI Spec Revision */
998#define UHCHCON __REG(0x4C000004) /* UHC Host Control Register */
999#define UHCCOMS __REG(0x4C000008) /* UHC Command Status Register */
1000#define UHCINTS __REG(0x4C00000C) /* UHC Interrupt Status Register */
1001#define UHCINTE __REG(0x4C000010) /* UHC Interrupt Enable */
1002#define UHCINTD __REG(0x4C000014) /* UHC Interrupt Disable */
1003#define UHCHCCA __REG(0x4C000018) /* UHC Host Controller Comm. Area */
1004#define UHCPCED __REG(0x4C00001C) /* UHC Period Current Endpt Descr */
1005#define UHCCHED __REG(0x4C000020) /* UHC Control Head Endpt Descr */
1006#define UHCCCED __REG(0x4C000024) /* UHC Control Current Endpt Descr */
1007#define UHCBHED __REG(0x4C000028) /* UHC Bulk Head Endpt Descr */
1008#define UHCBCED __REG(0x4C00002C) /* UHC Bulk Current Endpt Descr */
1009#define UHCDHEAD __REG(0x4C000030) /* UHC Done Head */
1010#define UHCFMI __REG(0x4C000034) /* UHC Frame Interval */
1011#define UHCFMR __REG(0x4C000038) /* UHC Frame Remaining */
1012#define UHCFMN __REG(0x4C00003C) /* UHC Frame Number */
1013#define UHCPERS __REG(0x4C000040) /* UHC Periodic Start */
1014#define UHCLS __REG(0x4C000044) /* UHC Low Speed Threshold */
1015
1016#define UHCRHDA __REG(0x4C000048) /* UHC Root Hub Descriptor A */
1017#define UHCRHDA_NOCP (1 << 12) /* No over current protection */
1018
1019#define UHCRHDB __REG(0x4C00004C) /* UHC Root Hub Descriptor B */
1020#define UHCRHS __REG(0x4C000050) /* UHC Root Hub Status */
1021#define UHCRHPS1 __REG(0x4C000054) /* UHC Root Hub Port 1 Status */
1022#define UHCRHPS2 __REG(0x4C000058) /* UHC Root Hub Port 2 Status */
1023#define UHCRHPS3 __REG(0x4C00005C) /* UHC Root Hub Port 3 Status */
1024
1025#define UHCSTAT __REG(0x4C000060) /* UHC Status Register */
1026#define UHCSTAT_UPS3 (1 << 16) /* USB Power Sense Port3 */
1027#define UHCSTAT_SBMAI (1 << 15) /* System Bus Master Abort Interrupt*/
1028#define UHCSTAT_SBTAI (1 << 14) /* System Bus Target Abort Interrupt*/
1029#define UHCSTAT_UPRI (1 << 13) /* USB Port Resume Interrupt */
1030#define UHCSTAT_UPS2 (1 << 12) /* USB Power Sense Port 2 */
1031#define UHCSTAT_UPS1 (1 << 11) /* USB Power Sense Port 1 */
1032#define UHCSTAT_HTA (1 << 10) /* HCI Target Abort */
1033#define UHCSTAT_HBA (1 << 8) /* HCI Buffer Active */
1034#define UHCSTAT_RWUE (1 << 7) /* HCI Remote Wake Up Event */
1035
1036#define UHCHR __REG(0x4C000064) /* UHC Reset Register */
1037#define UHCHR_SSEP3 (1 << 11) /* Sleep Standby Enable for Port3 */
1038#define UHCHR_SSEP2 (1 << 10) /* Sleep Standby Enable for Port2 */
1039#define UHCHR_SSEP1 (1 << 9) /* Sleep Standby Enable for Port1 */
1040#define UHCHR_PCPL (1 << 7) /* Power control polarity low */
1041#define UHCHR_PSPL (1 << 6) /* Power sense polarity low */
1042#define UHCHR_SSE (1 << 5) /* Sleep Standby Enable */
1043#define UHCHR_UIT (1 << 4) /* USB Interrupt Test */
1044#define UHCHR_SSDC (1 << 3) /* Simulation Scale Down Clock */
1045#define UHCHR_CGR (1 << 2) /* Clock Generation Reset */
1046#define UHCHR_FHR (1 << 1) /* Force Host Controller Reset */
1047#define UHCHR_FSBIR (1 << 0) /* Force System Bus Iface Reset */
1048
1049#define UHCHIE __REG(0x4C000068) /* UHC Interrupt Enable Register*/
1050#define UHCHIE_UPS3IE (1 << 14) /* Power Sense Port3 IntEn */
1051#define UHCHIE_UPRIE (1 << 13) /* Port Resume IntEn */
1052#define UHCHIE_UPS2IE (1 << 12) /* Power Sense Port2 IntEn */
1053#define UHCHIE_UPS1IE (1 << 11) /* Power Sense Port1 IntEn */
1054#define UHCHIE_TAIE (1 << 10) /* HCI Interface Transfer Abort
1055 Interrupt Enable*/
1056#define UHCHIE_HBAIE (1 << 8) /* HCI Buffer Active IntEn */
1057#define UHCHIE_RWIE (1 << 7) /* Remote Wake-up IntEn */
1058
1059#define UHCHIT __REG(0x4C00006C) /* UHC Interrupt Test register */
1060
1061#endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
1062
1063/* PWRMODE register M field values */
1064
1065#define PWRMODE_IDLE 0x1
1066#define PWRMODE_STANDBY 0x2
1067#define PWRMODE_SLEEP 0x3
1068#define PWRMODE_DEEPSLEEP 0x7
1069
1070#endif
diff --git a/arch/arm/mach-pxa/include/mach/pxa25x-udc.h b/arch/arm/mach-pxa/include/mach/pxa25x-udc.h
new file mode 100644
index 000000000000..1b80a4805a60
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa25x-udc.h
@@ -0,0 +1,163 @@
1#ifndef _ASM_ARCH_PXA25X_UDC_H
2#define _ASM_ARCH_PXA25X_UDC_H
3
4#ifdef _ASM_ARCH_PXA27X_UDC_H
5#error "You can't include both PXA25x and PXA27x UDC support"
6#endif
7
8#define UDC_RES1 __REG(0x40600004) /* UDC Undocumented - Reserved1 */
9#define UDC_RES2 __REG(0x40600008) /* UDC Undocumented - Reserved2 */
10#define UDC_RES3 __REG(0x4060000C) /* UDC Undocumented - Reserved3 */
11
12#define UDCCR __REG(0x40600000) /* UDC Control Register */
13#define UDCCR_UDE (1 << 0) /* UDC enable */
14#define UDCCR_UDA (1 << 1) /* UDC active */
15#define UDCCR_RSM (1 << 2) /* Device resume */
16#define UDCCR_RESIR (1 << 3) /* Resume interrupt request */
17#define UDCCR_SUSIR (1 << 4) /* Suspend interrupt request */
18#define UDCCR_SRM (1 << 5) /* Suspend/resume interrupt mask */
19#define UDCCR_RSTIR (1 << 6) /* Reset interrupt request */
20#define UDCCR_REM (1 << 7) /* Reset interrupt mask */
21
22#define UDCCS0 __REG(0x40600010) /* UDC Endpoint 0 Control/Status Register */
23#define UDCCS0_OPR (1 << 0) /* OUT packet ready */
24#define UDCCS0_IPR (1 << 1) /* IN packet ready */
25#define UDCCS0_FTF (1 << 2) /* Flush Tx FIFO */
26#define UDCCS0_DRWF (1 << 3) /* Device remote wakeup feature */
27#define UDCCS0_SST (1 << 4) /* Sent stall */
28#define UDCCS0_FST (1 << 5) /* Force stall */
29#define UDCCS0_RNE (1 << 6) /* Receive FIFO no empty */
30#define UDCCS0_SA (1 << 7) /* Setup active */
31
32/* Bulk IN - Endpoint 1,6,11 */
33#define UDCCS1 __REG(0x40600014) /* UDC Endpoint 1 (IN) Control/Status Register */
34#define UDCCS6 __REG(0x40600028) /* UDC Endpoint 6 (IN) Control/Status Register */
35#define UDCCS11 __REG(0x4060003C) /* UDC Endpoint 11 (IN) Control/Status Register */
36
37#define UDCCS_BI_TFS (1 << 0) /* Transmit FIFO service */
38#define UDCCS_BI_TPC (1 << 1) /* Transmit packet complete */
39#define UDCCS_BI_FTF (1 << 2) /* Flush Tx FIFO */
40#define UDCCS_BI_TUR (1 << 3) /* Transmit FIFO underrun */
41#define UDCCS_BI_SST (1 << 4) /* Sent stall */
42#define UDCCS_BI_FST (1 << 5) /* Force stall */
43#define UDCCS_BI_TSP (1 << 7) /* Transmit short packet */
44
45/* Bulk OUT - Endpoint 2,7,12 */
46#define UDCCS2 __REG(0x40600018) /* UDC Endpoint 2 (OUT) Control/Status Register */
47#define UDCCS7 __REG(0x4060002C) /* UDC Endpoint 7 (OUT) Control/Status Register */
48#define UDCCS12 __REG(0x40600040) /* UDC Endpoint 12 (OUT) Control/Status Register */
49
50#define UDCCS_BO_RFS (1 << 0) /* Receive FIFO service */
51#define UDCCS_BO_RPC (1 << 1) /* Receive packet complete */
52#define UDCCS_BO_DME (1 << 3) /* DMA enable */
53#define UDCCS_BO_SST (1 << 4) /* Sent stall */
54#define UDCCS_BO_FST (1 << 5) /* Force stall */
55#define UDCCS_BO_RNE (1 << 6) /* Receive FIFO not empty */
56#define UDCCS_BO_RSP (1 << 7) /* Receive short packet */
57
58/* Isochronous IN - Endpoint 3,8,13 */
59#define UDCCS3 __REG(0x4060001C) /* UDC Endpoint 3 (IN) Control/Status Register */
60#define UDCCS8 __REG(0x40600030) /* UDC Endpoint 8 (IN) Control/Status Register */
61#define UDCCS13 __REG(0x40600044) /* UDC Endpoint 13 (IN) Control/Status Register */
62
63#define UDCCS_II_TFS (1 << 0) /* Transmit FIFO service */
64#define UDCCS_II_TPC (1 << 1) /* Transmit packet complete */
65#define UDCCS_II_FTF (1 << 2) /* Flush Tx FIFO */
66#define UDCCS_II_TUR (1 << 3) /* Transmit FIFO underrun */
67#define UDCCS_II_TSP (1 << 7) /* Transmit short packet */
68
69/* Isochronous OUT - Endpoint 4,9,14 */
70#define UDCCS4 __REG(0x40600020) /* UDC Endpoint 4 (OUT) Control/Status Register */
71#define UDCCS9 __REG(0x40600034) /* UDC Endpoint 9 (OUT) Control/Status Register */
72#define UDCCS14 __REG(0x40600048) /* UDC Endpoint 14 (OUT) Control/Status Register */
73
74#define UDCCS_IO_RFS (1 << 0) /* Receive FIFO service */
75#define UDCCS_IO_RPC (1 << 1) /* Receive packet complete */
76#define UDCCS_IO_ROF (1 << 2) /* Receive overflow */
77#define UDCCS_IO_DME (1 << 3) /* DMA enable */
78#define UDCCS_IO_RNE (1 << 6) /* Receive FIFO not empty */
79#define UDCCS_IO_RSP (1 << 7) /* Receive short packet */
80
81/* Interrupt IN - Endpoint 5,10,15 */
82#define UDCCS5 __REG(0x40600024) /* UDC Endpoint 5 (Interrupt) Control/Status Register */
83#define UDCCS10 __REG(0x40600038) /* UDC Endpoint 10 (Interrupt) Control/Status Register */
84#define UDCCS15 __REG(0x4060004C) /* UDC Endpoint 15 (Interrupt) Control/Status Register */
85
86#define UDCCS_INT_TFS (1 << 0) /* Transmit FIFO service */
87#define UDCCS_INT_TPC (1 << 1) /* Transmit packet complete */
88#define UDCCS_INT_FTF (1 << 2) /* Flush Tx FIFO */
89#define UDCCS_INT_TUR (1 << 3) /* Transmit FIFO underrun */
90#define UDCCS_INT_SST (1 << 4) /* Sent stall */
91#define UDCCS_INT_FST (1 << 5) /* Force stall */
92#define UDCCS_INT_TSP (1 << 7) /* Transmit short packet */
93
94#define UFNRH __REG(0x40600060) /* UDC Frame Number Register High */
95#define UFNRL __REG(0x40600064) /* UDC Frame Number Register Low */
96#define UBCR2 __REG(0x40600068) /* UDC Byte Count Reg 2 */
97#define UBCR4 __REG(0x4060006c) /* UDC Byte Count Reg 4 */
98#define UBCR7 __REG(0x40600070) /* UDC Byte Count Reg 7 */
99#define UBCR9 __REG(0x40600074) /* UDC Byte Count Reg 9 */
100#define UBCR12 __REG(0x40600078) /* UDC Byte Count Reg 12 */
101#define UBCR14 __REG(0x4060007c) /* UDC Byte Count Reg 14 */
102#define UDDR0 __REG(0x40600080) /* UDC Endpoint 0 Data Register */
103#define UDDR1 __REG(0x40600100) /* UDC Endpoint 1 Data Register */
104#define UDDR2 __REG(0x40600180) /* UDC Endpoint 2 Data Register */
105#define UDDR3 __REG(0x40600200) /* UDC Endpoint 3 Data Register */
106#define UDDR4 __REG(0x40600400) /* UDC Endpoint 4 Data Register */
107#define UDDR5 __REG(0x406000A0) /* UDC Endpoint 5 Data Register */
108#define UDDR6 __REG(0x40600600) /* UDC Endpoint 6 Data Register */
109#define UDDR7 __REG(0x40600680) /* UDC Endpoint 7 Data Register */
110#define UDDR8 __REG(0x40600700) /* UDC Endpoint 8 Data Register */
111#define UDDR9 __REG(0x40600900) /* UDC Endpoint 9 Data Register */
112#define UDDR10 __REG(0x406000C0) /* UDC Endpoint 10 Data Register */
113#define UDDR11 __REG(0x40600B00) /* UDC Endpoint 11 Data Register */
114#define UDDR12 __REG(0x40600B80) /* UDC Endpoint 12 Data Register */
115#define UDDR13 __REG(0x40600C00) /* UDC Endpoint 13 Data Register */
116#define UDDR14 __REG(0x40600E00) /* UDC Endpoint 14 Data Register */
117#define UDDR15 __REG(0x406000E0) /* UDC Endpoint 15 Data Register */
118
119#define UICR0 __REG(0x40600050) /* UDC Interrupt Control Register 0 */
120
121#define UICR0_IM0 (1 << 0) /* Interrupt mask ep 0 */
122#define UICR0_IM1 (1 << 1) /* Interrupt mask ep 1 */
123#define UICR0_IM2 (1 << 2) /* Interrupt mask ep 2 */
124#define UICR0_IM3 (1 << 3) /* Interrupt mask ep 3 */
125#define UICR0_IM4 (1 << 4) /* Interrupt mask ep 4 */
126#define UICR0_IM5 (1 << 5) /* Interrupt mask ep 5 */
127#define UICR0_IM6 (1 << 6) /* Interrupt mask ep 6 */
128#define UICR0_IM7 (1 << 7) /* Interrupt mask ep 7 */
129
130#define UICR1 __REG(0x40600054) /* UDC Interrupt Control Register 1 */
131
132#define UICR1_IM8 (1 << 0) /* Interrupt mask ep 8 */
133#define UICR1_IM9 (1 << 1) /* Interrupt mask ep 9 */
134#define UICR1_IM10 (1 << 2) /* Interrupt mask ep 10 */
135#define UICR1_IM11 (1 << 3) /* Interrupt mask ep 11 */
136#define UICR1_IM12 (1 << 4) /* Interrupt mask ep 12 */
137#define UICR1_IM13 (1 << 5) /* Interrupt mask ep 13 */
138#define UICR1_IM14 (1 << 6) /* Interrupt mask ep 14 */
139#define UICR1_IM15 (1 << 7) /* Interrupt mask ep 15 */
140
141#define USIR0 __REG(0x40600058) /* UDC Status Interrupt Register 0 */
142
143#define USIR0_IR0 (1 << 0) /* Interrupt request ep 0 */
144#define USIR0_IR1 (1 << 1) /* Interrupt request ep 1 */
145#define USIR0_IR2 (1 << 2) /* Interrupt request ep 2 */
146#define USIR0_IR3 (1 << 3) /* Interrupt request ep 3 */
147#define USIR0_IR4 (1 << 4) /* Interrupt request ep 4 */
148#define USIR0_IR5 (1 << 5) /* Interrupt request ep 5 */
149#define USIR0_IR6 (1 << 6) /* Interrupt request ep 6 */
150#define USIR0_IR7 (1 << 7) /* Interrupt request ep 7 */
151
152#define USIR1 __REG(0x4060005C) /* UDC Status Interrupt Register 1 */
153
154#define USIR1_IR8 (1 << 0) /* Interrupt request ep 8 */
155#define USIR1_IR9 (1 << 1) /* Interrupt request ep 9 */
156#define USIR1_IR10 (1 << 2) /* Interrupt request ep 10 */
157#define USIR1_IR11 (1 << 3) /* Interrupt request ep 11 */
158#define USIR1_IR12 (1 << 4) /* Interrupt request ep 12 */
159#define USIR1_IR13 (1 << 5) /* Interrupt request ep 13 */
160#define USIR1_IR14 (1 << 6) /* Interrupt request ep 14 */
161#define USIR1_IR15 (1 << 7) /* Interrupt request ep 15 */
162
163#endif
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x-udc.h b/arch/arm/mach-pxa/include/mach/pxa27x-udc.h
new file mode 100644
index 000000000000..ab1443f8bd89
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa27x-udc.h
@@ -0,0 +1,257 @@
1#ifndef _ASM_ARCH_PXA27X_UDC_H
2#define _ASM_ARCH_PXA27X_UDC_H
3
4#ifdef _ASM_ARCH_PXA25X_UDC_H
5#error You cannot include both PXA25x and PXA27x UDC support
6#endif
7
8#define UDCCR __REG(0x40600000) /* UDC Control Register */
9#define UDCCR_OEN (1 << 31) /* On-the-Go Enable */
10#define UDCCR_AALTHNP (1 << 30) /* A-device Alternate Host Negotiation
11 Protocol Port Support */
12#define UDCCR_AHNP (1 << 29) /* A-device Host Negotiation Protocol
13 Support */
14#define UDCCR_BHNP (1 << 28) /* B-device Host Negotiation Protocol
15 Enable */
16#define UDCCR_DWRE (1 << 16) /* Device Remote Wake-up Enable */
17#define UDCCR_ACN (0x03 << 11) /* Active UDC configuration Number */
18#define UDCCR_ACN_S 11
19#define UDCCR_AIN (0x07 << 8) /* Active UDC interface Number */
20#define UDCCR_AIN_S 8
21#define UDCCR_AAISN (0x07 << 5) /* Active UDC Alternate Interface
22 Setting Number */
23#define UDCCR_AAISN_S 5
24#define UDCCR_SMAC (1 << 4) /* Switch Endpoint Memory to Active
25 Configuration */
26#define UDCCR_EMCE (1 << 3) /* Endpoint Memory Configuration
27 Error */
28#define UDCCR_UDR (1 << 2) /* UDC Resume */
29#define UDCCR_UDA (1 << 1) /* UDC Active */
30#define UDCCR_UDE (1 << 0) /* UDC Enable */
31
32#define UDCICR0 __REG(0x40600004) /* UDC Interrupt Control Register0 */
33#define UDCICR1 __REG(0x40600008) /* UDC Interrupt Control Register1 */
34#define UDCICR_FIFOERR (1 << 1) /* FIFO Error interrupt for EP */
35#define UDCICR_PKTCOMPL (1 << 0) /* Packet Complete interrupt for EP */
36
37#define UDC_INT_FIFOERROR (0x2)
38#define UDC_INT_PACKETCMP (0x1)
39
40#define UDCICR_INT(n,intr) (((intr) & 0x03) << (((n) & 0x0F) * 2))
41#define UDCICR1_IECC (1 << 31) /* IntEn - Configuration Change */
42#define UDCICR1_IESOF (1 << 30) /* IntEn - Start of Frame */
43#define UDCICR1_IERU (1 << 29) /* IntEn - Resume */
44#define UDCICR1_IESU (1 << 28) /* IntEn - Suspend */
45#define UDCICR1_IERS (1 << 27) /* IntEn - Reset */
46
47#define UDCISR0 __REG(0x4060000C) /* UDC Interrupt Status Register 0 */
48#define UDCISR1 __REG(0x40600010) /* UDC Interrupt Status Register 1 */
49#define UDCISR_INT(n,intr) (((intr) & 0x03) << (((n) & 0x0F) * 2))
50#define UDCISR1_IRCC (1 << 31) /* IntReq - Configuration Change */
51#define UDCISR1_IRSOF (1 << 30) /* IntReq - Start of Frame */
52#define UDCISR1_IRRU (1 << 29) /* IntReq - Resume */
53#define UDCISR1_IRSU (1 << 28) /* IntReq - Suspend */
54#define UDCISR1_IRRS (1 << 27) /* IntReq - Reset */
55
56#define UDCFNR __REG(0x40600014) /* UDC Frame Number Register */
57#define UDCOTGICR __REG(0x40600018) /* UDC On-The-Go interrupt control */
58#define UDCOTGICR_IESF (1 << 24) /* OTG SET_FEATURE command recvd */
59#define UDCOTGICR_IEXR (1 << 17) /* Extra Transciever Interrupt
60 Rising Edge Interrupt Enable */
61#define UDCOTGICR_IEXF (1 << 16) /* Extra Transciever Interrupt
62 Falling Edge Interrupt Enable */
63#define UDCOTGICR_IEVV40R (1 << 9) /* OTG Vbus Valid 4.0V Rising Edge
64 Interrupt Enable */
65#define UDCOTGICR_IEVV40F (1 << 8) /* OTG Vbus Valid 4.0V Falling Edge
66 Interrupt Enable */
67#define UDCOTGICR_IEVV44R (1 << 7) /* OTG Vbus Valid 4.4V Rising Edge
68 Interrupt Enable */
69#define UDCOTGICR_IEVV44F (1 << 6) /* OTG Vbus Valid 4.4V Falling Edge
70 Interrupt Enable */
71#define UDCOTGICR_IESVR (1 << 5) /* OTG Session Valid Rising Edge
72 Interrupt Enable */
73#define UDCOTGICR_IESVF (1 << 4) /* OTG Session Valid Falling Edge
74 Interrupt Enable */
75#define UDCOTGICR_IESDR (1 << 3) /* OTG A-Device SRP Detect Rising
76 Edge Interrupt Enable */
77#define UDCOTGICR_IESDF (1 << 2) /* OTG A-Device SRP Detect Falling
78 Edge Interrupt Enable */
79#define UDCOTGICR_IEIDR (1 << 1) /* OTG ID Change Rising Edge
80 Interrupt Enable */
81#define UDCOTGICR_IEIDF (1 << 0) /* OTG ID Change Falling Edge
82 Interrupt Enable */
83
84#define UP2OCR __REG(0x40600020) /* USB Port 2 Output Control register */
85#define UP3OCR __REG(0x40600024) /* USB Port 2 Output Control register */
86
87#define UP2OCR_CPVEN (1 << 0) /* Charge Pump Vbus Enable */
88#define UP2OCR_CPVPE (1 << 1) /* Charge Pump Vbus Pulse Enable */
89#define UP2OCR_DPPDE (1 << 2) /* Host Port 2 Transceiver D+ Pull Down Enable */
90#define UP2OCR_DMPDE (1 << 3) /* Host Port 2 Transceiver D- Pull Down Enable */
91#define UP2OCR_DPPUE (1 << 4) /* Host Port 2 Transceiver D+ Pull Up Enable */
92#define UP2OCR_DMPUE (1 << 5) /* Host Port 2 Transceiver D- Pull Up Enable */
93#define UP2OCR_DPPUBE (1 << 6) /* Host Port 2 Transceiver D+ Pull Up Bypass Enable */
94#define UP2OCR_DMPUBE (1 << 7) /* Host Port 2 Transceiver D- Pull Up Bypass Enable */
95#define UP2OCR_EXSP (1 << 8) /* External Transceiver Speed Control */
96#define UP2OCR_EXSUS (1 << 9) /* External Transceiver Speed Enable */
97#define UP2OCR_IDON (1 << 10) /* OTG ID Read Enable */
98#define UP2OCR_HXS (1 << 16) /* Host Port 2 Transceiver Output Select */
99#define UP2OCR_HXOE (1 << 17) /* Host Port 2 Transceiver Output Enable */
100#define UP2OCR_SEOS(x) ((x & 7) << 24) /* Single-Ended Output Select */
101
102#define UDCCSN(x) __REG2(0x40600100, (x) << 2)
103#define UDCCSR0 __REG(0x40600100) /* UDC Control/Status register - Endpoint 0 */
104#define UDCCSR0_SA (1 << 7) /* Setup Active */
105#define UDCCSR0_RNE (1 << 6) /* Receive FIFO Not Empty */
106#define UDCCSR0_FST (1 << 5) /* Force Stall */
107#define UDCCSR0_SST (1 << 4) /* Sent Stall */
108#define UDCCSR0_DME (1 << 3) /* DMA Enable */
109#define UDCCSR0_FTF (1 << 2) /* Flush Transmit FIFO */
110#define UDCCSR0_IPR (1 << 1) /* IN Packet Ready */
111#define UDCCSR0_OPC (1 << 0) /* OUT Packet Complete */
112
113#define UDCCSRA __REG(0x40600104) /* UDC Control/Status register - Endpoint A */
114#define UDCCSRB __REG(0x40600108) /* UDC Control/Status register - Endpoint B */
115#define UDCCSRC __REG(0x4060010C) /* UDC Control/Status register - Endpoint C */
116#define UDCCSRD __REG(0x40600110) /* UDC Control/Status register - Endpoint D */
117#define UDCCSRE __REG(0x40600114) /* UDC Control/Status register - Endpoint E */
118#define UDCCSRF __REG(0x40600118) /* UDC Control/Status register - Endpoint F */
119#define UDCCSRG __REG(0x4060011C) /* UDC Control/Status register - Endpoint G */
120#define UDCCSRH __REG(0x40600120) /* UDC Control/Status register - Endpoint H */
121#define UDCCSRI __REG(0x40600124) /* UDC Control/Status register - Endpoint I */
122#define UDCCSRJ __REG(0x40600128) /* UDC Control/Status register - Endpoint J */
123#define UDCCSRK __REG(0x4060012C) /* UDC Control/Status register - Endpoint K */
124#define UDCCSRL __REG(0x40600130) /* UDC Control/Status register - Endpoint L */
125#define UDCCSRM __REG(0x40600134) /* UDC Control/Status register - Endpoint M */
126#define UDCCSRN __REG(0x40600138) /* UDC Control/Status register - Endpoint N */
127#define UDCCSRP __REG(0x4060013C) /* UDC Control/Status register - Endpoint P */
128#define UDCCSRQ __REG(0x40600140) /* UDC Control/Status register - Endpoint Q */
129#define UDCCSRR __REG(0x40600144) /* UDC Control/Status register - Endpoint R */
130#define UDCCSRS __REG(0x40600148) /* UDC Control/Status register - Endpoint S */
131#define UDCCSRT __REG(0x4060014C) /* UDC Control/Status register - Endpoint T */
132#define UDCCSRU __REG(0x40600150) /* UDC Control/Status register - Endpoint U */
133#define UDCCSRV __REG(0x40600154) /* UDC Control/Status register - Endpoint V */
134#define UDCCSRW __REG(0x40600158) /* UDC Control/Status register - Endpoint W */
135#define UDCCSRX __REG(0x4060015C) /* UDC Control/Status register - Endpoint X */
136
137#define UDCCSR_DPE (1 << 9) /* Data Packet Error */
138#define UDCCSR_FEF (1 << 8) /* Flush Endpoint FIFO */
139#define UDCCSR_SP (1 << 7) /* Short Packet Control/Status */
140#define UDCCSR_BNE (1 << 6) /* Buffer Not Empty (IN endpoints) */
141#define UDCCSR_BNF (1 << 6) /* Buffer Not Full (OUT endpoints) */
142#define UDCCSR_FST (1 << 5) /* Force STALL */
143#define UDCCSR_SST (1 << 4) /* Sent STALL */
144#define UDCCSR_DME (1 << 3) /* DMA Enable */
145#define UDCCSR_TRN (1 << 2) /* Tx/Rx NAK */
146#define UDCCSR_PC (1 << 1) /* Packet Complete */
147#define UDCCSR_FS (1 << 0) /* FIFO needs service */
148
149#define UDCBCN(x) __REG2(0x40600200, (x)<<2)
150#define UDCBCR0 __REG(0x40600200) /* Byte Count Register - EP0 */
151#define UDCBCRA __REG(0x40600204) /* Byte Count Register - EPA */
152#define UDCBCRB __REG(0x40600208) /* Byte Count Register - EPB */
153#define UDCBCRC __REG(0x4060020C) /* Byte Count Register - EPC */
154#define UDCBCRD __REG(0x40600210) /* Byte Count Register - EPD */
155#define UDCBCRE __REG(0x40600214) /* Byte Count Register - EPE */
156#define UDCBCRF __REG(0x40600218) /* Byte Count Register - EPF */
157#define UDCBCRG __REG(0x4060021C) /* Byte Count Register - EPG */
158#define UDCBCRH __REG(0x40600220) /* Byte Count Register - EPH */
159#define UDCBCRI __REG(0x40600224) /* Byte Count Register - EPI */
160#define UDCBCRJ __REG(0x40600228) /* Byte Count Register - EPJ */
161#define UDCBCRK __REG(0x4060022C) /* Byte Count Register - EPK */
162#define UDCBCRL __REG(0x40600230) /* Byte Count Register - EPL */
163#define UDCBCRM __REG(0x40600234) /* Byte Count Register - EPM */
164#define UDCBCRN __REG(0x40600238) /* Byte Count Register - EPN */
165#define UDCBCRP __REG(0x4060023C) /* Byte Count Register - EPP */
166#define UDCBCRQ __REG(0x40600240) /* Byte Count Register - EPQ */
167#define UDCBCRR __REG(0x40600244) /* Byte Count Register - EPR */
168#define UDCBCRS __REG(0x40600248) /* Byte Count Register - EPS */
169#define UDCBCRT __REG(0x4060024C) /* Byte Count Register - EPT */
170#define UDCBCRU __REG(0x40600250) /* Byte Count Register - EPU */
171#define UDCBCRV __REG(0x40600254) /* Byte Count Register - EPV */
172#define UDCBCRW __REG(0x40600258) /* Byte Count Register - EPW */
173#define UDCBCRX __REG(0x4060025C) /* Byte Count Register - EPX */
174
175#define UDCDN(x) __REG2(0x40600300, (x)<<2)
176#define PHYS_UDCDN(x) (0x40600300 + ((x)<<2))
177#define PUDCDN(x) (volatile u32 *)(io_p2v(PHYS_UDCDN((x))))
178#define UDCDR0 __REG(0x40600300) /* Data Register - EP0 */
179#define UDCDRA __REG(0x40600304) /* Data Register - EPA */
180#define UDCDRB __REG(0x40600308) /* Data Register - EPB */
181#define UDCDRC __REG(0x4060030C) /* Data Register - EPC */
182#define UDCDRD __REG(0x40600310) /* Data Register - EPD */
183#define UDCDRE __REG(0x40600314) /* Data Register - EPE */
184#define UDCDRF __REG(0x40600318) /* Data Register - EPF */
185#define UDCDRG __REG(0x4060031C) /* Data Register - EPG */
186#define UDCDRH __REG(0x40600320) /* Data Register - EPH */
187#define UDCDRI __REG(0x40600324) /* Data Register - EPI */
188#define UDCDRJ __REG(0x40600328) /* Data Register - EPJ */
189#define UDCDRK __REG(0x4060032C) /* Data Register - EPK */
190#define UDCDRL __REG(0x40600330) /* Data Register - EPL */
191#define UDCDRM __REG(0x40600334) /* Data Register - EPM */
192#define UDCDRN __REG(0x40600338) /* Data Register - EPN */
193#define UDCDRP __REG(0x4060033C) /* Data Register - EPP */
194#define UDCDRQ __REG(0x40600340) /* Data Register - EPQ */
195#define UDCDRR __REG(0x40600344) /* Data Register - EPR */
196#define UDCDRS __REG(0x40600348) /* Data Register - EPS */
197#define UDCDRT __REG(0x4060034C) /* Data Register - EPT */
198#define UDCDRU __REG(0x40600350) /* Data Register - EPU */
199#define UDCDRV __REG(0x40600354) /* Data Register - EPV */
200#define UDCDRW __REG(0x40600358) /* Data Register - EPW */
201#define UDCDRX __REG(0x4060035C) /* Data Register - EPX */
202
203#define UDCCN(x) __REG2(0x40600400, (x)<<2)
204#define UDCCRA __REG(0x40600404) /* Configuration register EPA */
205#define UDCCRB __REG(0x40600408) /* Configuration register EPB */
206#define UDCCRC __REG(0x4060040C) /* Configuration register EPC */
207#define UDCCRD __REG(0x40600410) /* Configuration register EPD */
208#define UDCCRE __REG(0x40600414) /* Configuration register EPE */
209#define UDCCRF __REG(0x40600418) /* Configuration register EPF */
210#define UDCCRG __REG(0x4060041C) /* Configuration register EPG */
211#define UDCCRH __REG(0x40600420) /* Configuration register EPH */
212#define UDCCRI __REG(0x40600424) /* Configuration register EPI */
213#define UDCCRJ __REG(0x40600428) /* Configuration register EPJ */
214#define UDCCRK __REG(0x4060042C) /* Configuration register EPK */
215#define UDCCRL __REG(0x40600430) /* Configuration register EPL */
216#define UDCCRM __REG(0x40600434) /* Configuration register EPM */
217#define UDCCRN __REG(0x40600438) /* Configuration register EPN */
218#define UDCCRP __REG(0x4060043C) /* Configuration register EPP */
219#define UDCCRQ __REG(0x40600440) /* Configuration register EPQ */
220#define UDCCRR __REG(0x40600444) /* Configuration register EPR */
221#define UDCCRS __REG(0x40600448) /* Configuration register EPS */
222#define UDCCRT __REG(0x4060044C) /* Configuration register EPT */
223#define UDCCRU __REG(0x40600450) /* Configuration register EPU */
224#define UDCCRV __REG(0x40600454) /* Configuration register EPV */
225#define UDCCRW __REG(0x40600458) /* Configuration register EPW */
226#define UDCCRX __REG(0x4060045C) /* Configuration register EPX */
227
228#define UDCCONR_CN (0x03 << 25) /* Configuration Number */
229#define UDCCONR_CN_S (25)
230#define UDCCONR_IN (0x07 << 22) /* Interface Number */
231#define UDCCONR_IN_S (22)
232#define UDCCONR_AISN (0x07 << 19) /* Alternate Interface Number */
233#define UDCCONR_AISN_S (19)
234#define UDCCONR_EN (0x0f << 15) /* Endpoint Number */
235#define UDCCONR_EN_S (15)
236#define UDCCONR_ET (0x03 << 13) /* Endpoint Type: */
237#define UDCCONR_ET_S (13)
238#define UDCCONR_ET_INT (0x03 << 13) /* Interrupt */
239#define UDCCONR_ET_BULK (0x02 << 13) /* Bulk */
240#define UDCCONR_ET_ISO (0x01 << 13) /* Isochronous */
241#define UDCCONR_ET_NU (0x00 << 13) /* Not used */
242#define UDCCONR_ED (1 << 12) /* Endpoint Direction */
243#define UDCCONR_MPS (0x3ff << 2) /* Maximum Packet Size */
244#define UDCCONR_MPS_S (2)
245#define UDCCONR_DE (1 << 1) /* Double Buffering Enable */
246#define UDCCONR_EE (1 << 0) /* Endpoint Enable */
247
248
249#define UDC_INT_FIFOERROR (0x2)
250#define UDC_INT_PACKETCMP (0x1)
251
252#define UDC_FNR_MASK (0x7ff)
253
254#define UDCCSR_WR_MASK (UDCCSR_DME|UDCCSR_FST)
255#define UDC_BCR_MASK (0x3ff)
256
257#endif
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h b/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
new file mode 100644
index 000000000000..d5a48a96dea7
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
@@ -0,0 +1,58 @@
1#ifndef __ASM_ARCH_PXA27x_KEYPAD_H
2#define __ASM_ARCH_PXA27x_KEYPAD_H
3
4#include <linux/input.h>
5
6#define MAX_MATRIX_KEY_ROWS (8)
7#define MAX_MATRIX_KEY_COLS (8)
8
9/* pxa3xx keypad platform specific parameters
10 *
11 * NOTE:
12 * 1. direct_key_num indicates the number of keys in the direct keypad
13 * _plus_ the number of rotary-encoder sensor inputs, this can be
14 * left as 0 if only rotary encoders are enabled, the driver will
15 * automatically calculate this
16 *
17 * 2. direct_key_map is the key code map for the direct keys, if rotary
18 * encoder(s) are enabled, direct key 0/1(2/3) will be ignored
19 *
20 * 3. rotary can be either interpreted as a relative input event (e.g.
21 * REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT)
22 *
23 * 4. matrix key and direct key will use the same debounce_interval by
24 * default, which should be sufficient in most cases
25 */
26struct pxa27x_keypad_platform_data {
27
28 /* code map for the matrix keys */
29 unsigned int matrix_key_rows;
30 unsigned int matrix_key_cols;
31 unsigned int *matrix_key_map;
32 int matrix_key_map_size;
33
34 /* direct keys */
35 int direct_key_num;
36 unsigned int direct_key_map[8];
37
38 /* rotary encoders 0 */
39 int enable_rotary0;
40 int rotary0_rel_code;
41 int rotary0_up_key;
42 int rotary0_down_key;
43
44 /* rotary encoders 1 */
45 int enable_rotary1;
46 int rotary1_rel_code;
47 int rotary1_up_key;
48 int rotary1_down_key;
49
50 /* key debounce interval */
51 unsigned int debounce_interval;
52};
53
54#define KEY(row, col, val) (((row) << 28) | ((col) << 24) | (val))
55
56extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);
57
58#endif /* __ASM_ARCH_PXA27x_KEYPAD_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h b/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h
new file mode 100644
index 000000000000..6ef1dd09970b
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h
@@ -0,0 +1,368 @@
1#ifndef __ASM_ARCH_PXA2XX_GPIO_H
2#define __ASM_ARCH_PXA2XX_GPIO_H
3
4#warning Please use mfp-pxa2[57]x.h instead of pxa2xx-gpio.h
5
6/* GPIO alternate function assignments */
7
8#define GPIO1_RST 1 /* reset */
9#define GPIO6_MMCCLK 6 /* MMC Clock */
10#define GPIO7_48MHz 7 /* 48 MHz clock output */
11#define GPIO8_MMCCS0 8 /* MMC Chip Select 0 */
12#define GPIO9_MMCCS1 9 /* MMC Chip Select 1 */
13#define GPIO10_RTCCLK 10 /* real time clock (1 Hz) */
14#define GPIO11_3_6MHz 11 /* 3.6 MHz oscillator out */
15#define GPIO12_32KHz 12 /* 32 kHz out */
16#define GPIO12_CIF_DD_7 12 /* Camera data pin 7 */
17#define GPIO13_MBGNT 13 /* memory controller grant */
18#define GPIO14_MBREQ 14 /* alternate bus master request */
19#define GPIO15_nCS_1 15 /* chip select 1 */
20#define GPIO16_PWM0 16 /* PWM0 output */
21#define GPIO17_PWM1 17 /* PWM1 output */
22#define GPIO17_CIF_DD_6 17 /* Camera data pin 6 */
23#define GPIO18_RDY 18 /* Ext. Bus Ready */
24#define GPIO19_DREQ1 19 /* External DMA Request */
25#define GPIO20_DREQ0 20 /* External DMA Request */
26#define GPIO23_SCLK 23 /* SSP clock */
27#define GPIO23_CIF_MCLK 23 /* Camera Master Clock */
28#define GPIO24_SFRM 24 /* SSP Frame */
29#define GPIO24_CIF_FV 24 /* Camera frame start signal */
30#define GPIO25_STXD 25 /* SSP transmit */
31#define GPIO25_CIF_LV 25 /* Camera line start signal */
32#define GPIO26_SRXD 26 /* SSP receive */
33#define GPIO26_CIF_PCLK 26 /* Camera Pixel Clock */
34#define GPIO27_SEXTCLK 27 /* SSP ext_clk */
35#define GPIO27_CIF_DD_0 27 /* Camera data pin 0 */
36#define GPIO28_BITCLK 28 /* AC97/I2S bit_clk */
37#define GPIO29_SDATA_IN 29 /* AC97 Sdata_in0 / I2S Sdata_in */
38#define GPIO30_SDATA_OUT 30 /* AC97/I2S Sdata_out */
39#define GPIO31_SYNC 31 /* AC97/I2S sync */
40#define GPIO32_SDATA_IN1 32 /* AC97 Sdata_in1 */
41#define GPIO32_SYSCLK 32 /* I2S System Clock */
42#define GPIO32_MMCCLK 32 /* MMC Clock (PXA270) */
43#define GPIO33_nCS_5 33 /* chip select 5 */
44#define GPIO34_FFRXD 34 /* FFUART receive */
45#define GPIO34_MMCCS0 34 /* MMC Chip Select 0 */
46#define GPIO35_FFCTS 35 /* FFUART Clear to send */
47#define GPIO36_FFDCD 36 /* FFUART Data carrier detect */
48#define GPIO37_FFDSR 37 /* FFUART data set ready */
49#define GPIO38_FFRI 38 /* FFUART Ring Indicator */
50#define GPIO39_MMCCS1 39 /* MMC Chip Select 1 */
51#define GPIO39_FFTXD 39 /* FFUART transmit data */
52#define GPIO40_FFDTR 40 /* FFUART data terminal Ready */
53#define GPIO41_FFRTS 41 /* FFUART request to send */
54#define GPIO42_BTRXD 42 /* BTUART receive data */
55#define GPIO42_HWRXD 42 /* HWUART receive data */
56#define GPIO42_CIF_MCLK 42 /* Camera Master Clock */
57#define GPIO43_BTTXD 43 /* BTUART transmit data */
58#define GPIO43_HWTXD 43 /* HWUART transmit data */
59#define GPIO43_CIF_FV 43 /* Camera frame start signal */
60#define GPIO44_BTCTS 44 /* BTUART clear to send */
61#define GPIO44_HWCTS 44 /* HWUART clear to send */
62#define GPIO44_CIF_LV 44 /* Camera line start signal */
63#define GPIO45_BTRTS 45 /* BTUART request to send */
64#define GPIO45_HWRTS 45 /* HWUART request to send */
65#define GPIO45_AC97_SYSCLK 45 /* AC97 System Clock */
66#define GPIO45_CIF_PCLK 45 /* Camera Pixel Clock */
67#define GPIO46_ICPRXD 46 /* ICP receive data */
68#define GPIO46_STRXD 46 /* STD_UART receive data */
69#define GPIO47_ICPTXD 47 /* ICP transmit data */
70#define GPIO47_STTXD 47 /* STD_UART transmit data */
71#define GPIO47_CIF_DD_0 47 /* Camera data pin 0 */
72#define GPIO48_nPOE 48 /* Output Enable for Card Space */
73#define GPIO48_CIF_DD_5 48 /* Camera data pin 5 */
74#define GPIO49_nPWE 49 /* Write Enable for Card Space */
75#define GPIO50_nPIOR 50 /* I/O Read for Card Space */
76#define GPIO50_CIF_DD_3 50 /* Camera data pin 3 */
77#define GPIO51_nPIOW 51 /* I/O Write for Card Space */
78#define GPIO51_CIF_DD_2 51 /* Camera data pin 2 */
79#define GPIO52_nPCE_1 52 /* Card Enable for Card Space */
80#define GPIO52_CIF_DD_4 52 /* Camera data pin 4 */
81#define GPIO53_nPCE_2 53 /* Card Enable for Card Space */
82#define GPIO53_MMCCLK 53 /* MMC Clock */
83#define GPIO53_CIF_MCLK 53 /* Camera Master Clock */
84#define GPIO54_MMCCLK 54 /* MMC Clock */
85#define GPIO54_pSKTSEL 54 /* Socket Select for Card Space */
86#define GPIO54_nPCE_2 54 /* Card Enable for Card Space (PXA27x) */
87#define GPIO54_CIF_PCLK 54 /* Camera Pixel Clock */
88#define GPIO55_nPREG 55 /* Card Address bit 26 */
89#define GPIO55_CIF_DD_1 55 /* Camera data pin 1 */
90#define GPIO56_nPWAIT 56 /* Wait signal for Card Space */
91#define GPIO57_nIOIS16 57 /* Bus Width select for I/O Card Space */
92#define GPIO58_LDD_0 58 /* LCD data pin 0 */
93#define GPIO59_LDD_1 59 /* LCD data pin 1 */
94#define GPIO60_LDD_2 60 /* LCD data pin 2 */
95#define GPIO61_LDD_3 61 /* LCD data pin 3 */
96#define GPIO62_LDD_4 62 /* LCD data pin 4 */
97#define GPIO63_LDD_5 63 /* LCD data pin 5 */
98#define GPIO64_LDD_6 64 /* LCD data pin 6 */
99#define GPIO65_LDD_7 65 /* LCD data pin 7 */
100#define GPIO66_LDD_8 66 /* LCD data pin 8 */
101#define GPIO66_MBREQ 66 /* alternate bus master req */
102#define GPIO67_LDD_9 67 /* LCD data pin 9 */
103#define GPIO67_MMCCS0 67 /* MMC Chip Select 0 */
104#define GPIO68_LDD_10 68 /* LCD data pin 10 */
105#define GPIO68_MMCCS1 68 /* MMC Chip Select 1 */
106#define GPIO69_LDD_11 69 /* LCD data pin 11 */
107#define GPIO69_MMCCLK 69 /* MMC_CLK */
108#define GPIO70_LDD_12 70 /* LCD data pin 12 */
109#define GPIO70_RTCCLK 70 /* Real Time clock (1 Hz) */
110#define GPIO71_LDD_13 71 /* LCD data pin 13 */
111#define GPIO71_3_6MHz 71 /* 3.6 MHz Oscillator clock */
112#define GPIO72_LDD_14 72 /* LCD data pin 14 */
113#define GPIO72_32kHz 72 /* 32 kHz clock */
114#define GPIO73_LDD_15 73 /* LCD data pin 15 */
115#define GPIO73_MBGNT 73 /* Memory controller grant */
116#define GPIO74_LCD_FCLK 74 /* LCD Frame clock */
117#define GPIO75_LCD_LCLK 75 /* LCD line clock */
118#define GPIO76_LCD_PCLK 76 /* LCD Pixel clock */
119#define GPIO77_LCD_ACBIAS 77 /* LCD AC Bias */
120#define GPIO78_nCS_2 78 /* chip select 2 */
121#define GPIO79_nCS_3 79 /* chip select 3 */
122#define GPIO80_nCS_4 80 /* chip select 4 */
123#define GPIO81_NSCLK 81 /* NSSP clock */
124#define GPIO81_CIF_DD_0 81 /* Camera data pin 0 */
125#define GPIO82_NSFRM 82 /* NSSP Frame */
126#define GPIO82_CIF_DD_5 82 /* Camera data pin 5 */
127#define GPIO83_NSTXD 83 /* NSSP transmit */
128#define GPIO83_CIF_DD_4 83 /* Camera data pin 4 */
129#define GPIO84_NSRXD 84 /* NSSP receive */
130#define GPIO84_CIF_FV 84 /* Camera frame start signal */
131#define GPIO85_nPCE_1 85 /* Card Enable for Card Space (PXA27x) */
132#define GPIO85_CIF_LV 85 /* Camera line start signal */
133#define GPIO90_CIF_DD_4 90 /* Camera data pin 4 */
134#define GPIO91_CIF_DD_5 91 /* Camera data pin 5 */
135#define GPIO92_MMCDAT0 92 /* MMC DAT0 (PXA27x) */
136#define GPIO93_CIF_DD_6 93 /* Camera data pin 6 */
137#define GPIO94_CIF_DD_5 94 /* Camera data pin 5 */
138#define GPIO95_CIF_DD_4 95 /* Camera data pin 4 */
139#define GPIO96_FFRXD 96 /* FFUART recieve */
140#define GPIO98_FFRTS 98 /* FFUART request to send */
141#define GPIO98_CIF_DD_0 98 /* Camera data pin 0 */
142#define GPIO99_FFTXD 99 /* FFUART transmit data */
143#define GPIO100_FFCTS 100 /* FFUART Clear to send */
144#define GPIO102_nPCE_1 102 /* PCMCIA (PXA27x) */
145#define GPIO103_CIF_DD_3 103 /* Camera data pin 3 */
146#define GPIO104_CIF_DD_2 104 /* Camera data pin 2 */
147#define GPIO105_CIF_DD_1 105 /* Camera data pin 1 */
148#define GPIO106_CIF_DD_9 106 /* Camera data pin 9 */
149#define GPIO107_CIF_DD_8 107 /* Camera data pin 8 */
150#define GPIO108_CIF_DD_7 108 /* Camera data pin 7 */
151#define GPIO109_MMCDAT1 109 /* MMC DAT1 (PXA27x) */
152#define GPIO110_MMCDAT2 110 /* MMC DAT2 (PXA27x) */
153#define GPIO110_MMCCS0 110 /* MMC Chip Select 0 (PXA27x) */
154#define GPIO111_MMCDAT3 111 /* MMC DAT3 (PXA27x) */
155#define GPIO111_MMCCS1 111 /* MMC Chip Select 1 (PXA27x) */
156#define GPIO112_MMCCMD 112 /* MMC CMD (PXA27x) */
157#define GPIO113_I2S_SYSCLK 113 /* I2S System Clock (PXA27x) */
158#define GPIO113_AC97_RESET_N 113 /* AC97 NRESET on (PXA27x) */
159#define GPIO114_CIF_DD_1 114 /* Camera data pin 1 */
160#define GPIO115_CIF_DD_3 115 /* Camera data pin 3 */
161#define GPIO116_CIF_DD_2 116 /* Camera data pin 2 */
162
163/* GPIO alternate function mode & direction */
164
165#define GPIO_IN 0x000
166#define GPIO_OUT 0x080
167#define GPIO_ALT_FN_1_IN 0x100
168#define GPIO_ALT_FN_1_OUT 0x180
169#define GPIO_ALT_FN_2_IN 0x200
170#define GPIO_ALT_FN_2_OUT 0x280
171#define GPIO_ALT_FN_3_IN 0x300
172#define GPIO_ALT_FN_3_OUT 0x380
173#define GPIO_MD_MASK_NR 0x07f
174#define GPIO_MD_MASK_DIR 0x080
175#define GPIO_MD_MASK_FN 0x300
176#define GPIO_DFLT_LOW 0x400
177#define GPIO_DFLT_HIGH 0x800
178
179#define GPIO1_RTS_MD ( 1 | GPIO_ALT_FN_1_IN)
180#define GPIO6_MMCCLK_MD ( 6 | GPIO_ALT_FN_1_OUT)
181#define GPIO7_48MHz_MD ( 7 | GPIO_ALT_FN_1_OUT)
182#define GPIO8_MMCCS0_MD ( 8 | GPIO_ALT_FN_1_OUT)
183#define GPIO9_MMCCS1_MD ( 9 | GPIO_ALT_FN_1_OUT)
184#define GPIO10_RTCCLK_MD (10 | GPIO_ALT_FN_1_OUT)
185#define GPIO11_3_6MHz_MD (11 | GPIO_ALT_FN_1_OUT)
186#define GPIO12_32KHz_MD (12 | GPIO_ALT_FN_1_OUT)
187#define GPIO12_CIF_DD_7_MD (12 | GPIO_ALT_FN_2_IN)
188#define GPIO13_MBGNT_MD (13 | GPIO_ALT_FN_2_OUT)
189#define GPIO14_MBREQ_MD (14 | GPIO_ALT_FN_1_IN)
190#define GPIO15_nCS_1_MD (15 | GPIO_ALT_FN_2_OUT)
191#define GPIO16_PWM0_MD (16 | GPIO_ALT_FN_2_OUT)
192#define GPIO17_PWM1_MD (17 | GPIO_ALT_FN_2_OUT)
193#define GPIO17_CIF_DD_6_MD (17 | GPIO_ALT_FN_2_IN)
194#define GPIO18_RDY_MD (18 | GPIO_ALT_FN_1_IN)
195#define GPIO19_DREQ1_MD (19 | GPIO_ALT_FN_1_IN)
196#define GPIO20_DREQ0_MD (20 | GPIO_ALT_FN_1_IN)
197#define GPIO23_CIF_MCLK_MD (23 | GPIO_ALT_FN_1_OUT)
198#define GPIO23_SCLK_MD (23 | GPIO_ALT_FN_2_OUT)
199#define GPIO24_CIF_FV_MD (24 | GPIO_ALT_FN_1_OUT)
200#define GPIO24_SFRM_MD (24 | GPIO_ALT_FN_2_OUT)
201#define GPIO25_CIF_LV_MD (25 | GPIO_ALT_FN_1_OUT)
202#define GPIO25_STXD_MD (25 | GPIO_ALT_FN_2_OUT)
203#define GPIO26_SRXD_MD (26 | GPIO_ALT_FN_1_IN)
204#define GPIO26_CIF_PCLK_MD (26 | GPIO_ALT_FN_2_IN)
205#define GPIO27_SEXTCLK_MD (27 | GPIO_ALT_FN_1_IN)
206#define GPIO27_CIF_DD_0_MD (27 | GPIO_ALT_FN_3_IN)
207#define GPIO28_BITCLK_AC97_MD (28 | GPIO_ALT_FN_1_IN)
208#define GPIO28_BITCLK_IN_I2S_MD (28 | GPIO_ALT_FN_2_IN)
209#define GPIO28_BITCLK_OUT_I2S_MD (28 | GPIO_ALT_FN_1_OUT)
210#define GPIO29_SDATA_IN_AC97_MD (29 | GPIO_ALT_FN_1_IN)
211#define GPIO29_SDATA_IN_I2S_MD (29 | GPIO_ALT_FN_2_IN)
212#define GPIO30_SDATA_OUT_AC97_MD (30 | GPIO_ALT_FN_2_OUT)
213#define GPIO30_SDATA_OUT_I2S_MD (30 | GPIO_ALT_FN_1_OUT)
214#define GPIO31_SYNC_I2S_MD (31 | GPIO_ALT_FN_1_OUT)
215#define GPIO31_SYNC_AC97_MD (31 | GPIO_ALT_FN_2_OUT)
216#define GPIO32_SDATA_IN1_AC97_MD (32 | GPIO_ALT_FN_1_IN)
217#define GPIO32_SYSCLK_I2S_MD (32 | GPIO_ALT_FN_1_OUT)
218#define GPIO32_MMCCLK_MD (32 | GPIO_ALT_FN_2_OUT)
219#define GPIO33_nCS_5_MD (33 | GPIO_ALT_FN_2_OUT)
220#define GPIO34_FFRXD_MD (34 | GPIO_ALT_FN_1_IN)
221#define GPIO34_MMCCS0_MD (34 | GPIO_ALT_FN_2_OUT)
222#define GPIO35_FFCTS_MD (35 | GPIO_ALT_FN_1_IN)
223#define GPIO35_KP_MKOUT6_MD (35 | GPIO_ALT_FN_2_OUT)
224#define GPIO36_FFDCD_MD (36 | GPIO_ALT_FN_1_IN)
225#define GPIO37_FFDSR_MD (37 | GPIO_ALT_FN_1_IN)
226#define GPIO38_FFRI_MD (38 | GPIO_ALT_FN_1_IN)
227#define GPIO39_MMCCS1_MD (39 | GPIO_ALT_FN_1_OUT)
228#define GPIO39_FFTXD_MD (39 | GPIO_ALT_FN_2_OUT)
229#define GPIO40_FFDTR_MD (40 | GPIO_ALT_FN_2_OUT)
230#define GPIO41_FFRTS_MD (41 | GPIO_ALT_FN_2_OUT)
231#define GPIO41_KP_MKOUT7_MD (41 | GPIO_ALT_FN_1_OUT)
232#define GPIO42_BTRXD_MD (42 | GPIO_ALT_FN_1_IN)
233#define GPIO42_HWRXD_MD (42 | GPIO_ALT_FN_3_IN)
234#define GPIO42_CIF_MCLK_MD (42 | GPIO_ALT_FN_3_OUT)
235#define GPIO43_BTTXD_MD (43 | GPIO_ALT_FN_2_OUT)
236#define GPIO43_HWTXD_MD (43 | GPIO_ALT_FN_3_OUT)
237#define GPIO43_CIF_FV_MD (43 | GPIO_ALT_FN_3_OUT)
238#define GPIO44_BTCTS_MD (44 | GPIO_ALT_FN_1_IN)
239#define GPIO44_HWCTS_MD (44 | GPIO_ALT_FN_3_IN)
240#define GPIO44_CIF_LV_MD (44 | GPIO_ALT_FN_3_OUT)
241#define GPIO45_CIF_PCLK_MD (45 | GPIO_ALT_FN_3_IN)
242#define GPIO45_BTRTS_MD (45 | GPIO_ALT_FN_2_OUT)
243#define GPIO45_HWRTS_MD (45 | GPIO_ALT_FN_3_OUT)
244#define GPIO45_SYSCLK_AC97_MD (45 | GPIO_ALT_FN_1_OUT)
245#define GPIO46_ICPRXD_MD (46 | GPIO_ALT_FN_1_IN)
246#define GPIO46_STRXD_MD (46 | GPIO_ALT_FN_2_IN)
247#define GPIO47_CIF_DD_0_MD (47 | GPIO_ALT_FN_1_IN)
248#define GPIO47_ICPTXD_MD (47 | GPIO_ALT_FN_2_OUT)
249#define GPIO47_STTXD_MD (47 | GPIO_ALT_FN_1_OUT)
250#define GPIO48_CIF_DD_5_MD (48 | GPIO_ALT_FN_1_IN)
251#define GPIO48_nPOE_MD (48 | GPIO_ALT_FN_2_OUT)
252#define GPIO48_HWTXD_MD (48 | GPIO_ALT_FN_1_OUT)
253#define GPIO48_nPOE_MD (48 | GPIO_ALT_FN_2_OUT)
254#define GPIO49_HWRXD_MD (49 | GPIO_ALT_FN_1_IN)
255#define GPIO49_nPWE_MD (49 | GPIO_ALT_FN_2_OUT)
256#define GPIO50_CIF_DD_3_MD (50 | GPIO_ALT_FN_1_IN)
257#define GPIO50_nPIOR_MD (50 | GPIO_ALT_FN_2_OUT)
258#define GPIO50_HWCTS_MD (50 | GPIO_ALT_FN_1_IN)
259#define GPIO50_CIF_DD_3_MD (50 | GPIO_ALT_FN_1_IN)
260#define GPIO51_CIF_DD_2_MD (51 | GPIO_ALT_FN_1_IN)
261#define GPIO51_nPIOW_MD (51 | GPIO_ALT_FN_2_OUT)
262#define GPIO51_HWRTS_MD (51 | GPIO_ALT_FN_1_OUT)
263#define GPIO51_CIF_DD_2_MD (51 | GPIO_ALT_FN_1_IN)
264#define GPIO52_nPCE_1_MD (52 | GPIO_ALT_FN_2_OUT)
265#define GPIO52_CIF_DD_4_MD (52 | GPIO_ALT_FN_1_IN)
266#define GPIO53_nPCE_2_MD (53 | GPIO_ALT_FN_2_OUT)
267#define GPIO53_MMCCLK_MD (53 | GPIO_ALT_FN_1_OUT)
268#define GPIO53_CIF_MCLK_MD (53 | GPIO_ALT_FN_2_OUT)
269#define GPIO54_MMCCLK_MD (54 | GPIO_ALT_FN_1_OUT)
270#define GPIO54_nPCE_2_MD (54 | GPIO_ALT_FN_2_OUT)
271#define GPIO54_pSKTSEL_MD (54 | GPIO_ALT_FN_2_OUT)
272#define GPIO54_CIF_PCLK_MD (54 | GPIO_ALT_FN_3_IN)
273#define GPIO55_nPREG_MD (55 | GPIO_ALT_FN_2_OUT)
274#define GPIO55_CIF_DD_1_MD (55 | GPIO_ALT_FN_1_IN)
275#define GPIO56_nPWAIT_MD (56 | GPIO_ALT_FN_1_IN)
276#define GPIO57_nIOIS16_MD (57 | GPIO_ALT_FN_1_IN)
277#define GPIO58_LDD_0_MD (58 | GPIO_ALT_FN_2_OUT)
278#define GPIO59_LDD_1_MD (59 | GPIO_ALT_FN_2_OUT)
279#define GPIO60_LDD_2_MD (60 | GPIO_ALT_FN_2_OUT)
280#define GPIO61_LDD_3_MD (61 | GPIO_ALT_FN_2_OUT)
281#define GPIO62_LDD_4_MD (62 | GPIO_ALT_FN_2_OUT)
282#define GPIO63_LDD_5_MD (63 | GPIO_ALT_FN_2_OUT)
283#define GPIO64_LDD_6_MD (64 | GPIO_ALT_FN_2_OUT)
284#define GPIO65_LDD_7_MD (65 | GPIO_ALT_FN_2_OUT)
285#define GPIO66_LDD_8_MD (66 | GPIO_ALT_FN_2_OUT)
286#define GPIO66_MBREQ_MD (66 | GPIO_ALT_FN_1_IN)
287#define GPIO67_LDD_9_MD (67 | GPIO_ALT_FN_2_OUT)
288#define GPIO67_MMCCS0_MD (67 | GPIO_ALT_FN_1_OUT)
289#define GPIO68_LDD_10_MD (68 | GPIO_ALT_FN_2_OUT)
290#define GPIO68_MMCCS1_MD (68 | GPIO_ALT_FN_1_OUT)
291#define GPIO69_LDD_11_MD (69 | GPIO_ALT_FN_2_OUT)
292#define GPIO69_MMCCLK_MD (69 | GPIO_ALT_FN_1_OUT)
293#define GPIO70_LDD_12_MD (70 | GPIO_ALT_FN_2_OUT)
294#define GPIO70_RTCCLK_MD (70 | GPIO_ALT_FN_1_OUT)
295#define GPIO71_LDD_13_MD (71 | GPIO_ALT_FN_2_OUT)
296#define GPIO71_3_6MHz_MD (71 | GPIO_ALT_FN_1_OUT)
297#define GPIO72_LDD_14_MD (72 | GPIO_ALT_FN_2_OUT)
298#define GPIO72_32kHz_MD (72 | GPIO_ALT_FN_1_OUT)
299#define GPIO73_LDD_15_MD (73 | GPIO_ALT_FN_2_OUT)
300#define GPIO73_MBGNT_MD (73 | GPIO_ALT_FN_1_OUT)
301#define GPIO74_LCD_FCLK_MD (74 | GPIO_ALT_FN_2_OUT)
302#define GPIO75_LCD_LCLK_MD (75 | GPIO_ALT_FN_2_OUT)
303#define GPIO76_LCD_PCLK_MD (76 | GPIO_ALT_FN_2_OUT)
304#define GPIO77_LCD_ACBIAS_MD (77 | GPIO_ALT_FN_2_OUT)
305#define GPIO78_nCS_2_MD (78 | GPIO_ALT_FN_2_OUT)
306#define GPIO78_nPCE_2_MD (78 | GPIO_ALT_FN_1_OUT)
307#define GPIO79_nCS_3_MD (79 | GPIO_ALT_FN_2_OUT)
308#define GPIO79_pSKTSEL_MD (79 | GPIO_ALT_FN_1_OUT)
309#define GPIO80_nCS_4_MD (80 | GPIO_ALT_FN_2_OUT)
310#define GPIO81_NSSP_CLK_OUT (81 | GPIO_ALT_FN_1_OUT)
311#define GPIO81_NSSP_CLK_IN (81 | GPIO_ALT_FN_1_IN)
312#define GPIO81_CIF_DD_0_MD (81 | GPIO_ALT_FN_2_IN)
313#define GPIO82_NSSP_FRM_OUT (82 | GPIO_ALT_FN_1_OUT)
314#define GPIO82_NSSP_FRM_IN (82 | GPIO_ALT_FN_1_IN)
315#define GPIO82_CIF_DD_5_MD (82 | GPIO_ALT_FN_3_IN)
316#define GPIO83_NSSP_TX (83 | GPIO_ALT_FN_1_OUT)
317#define GPIO83_NSSP_RX (83 | GPIO_ALT_FN_2_IN)
318#define GPIO83_CIF_DD_4_MD (83 | GPIO_ALT_FN_3_IN)
319#define GPIO84_NSSP_TX (84 | GPIO_ALT_FN_1_OUT)
320#define GPIO84_NSSP_RX (84 | GPIO_ALT_FN_2_IN)
321#define GPIO84_CIF_FV_MD (84 | GPIO_ALT_FN_3_IN)
322#define GPIO85_nPCE_1_MD (85 | GPIO_ALT_FN_1_OUT)
323#define GPIO85_CIF_LV_MD (85 | GPIO_ALT_FN_3_IN)
324#define GPIO86_nPCE_1_MD (86 | GPIO_ALT_FN_1_OUT)
325#define GPIO88_USBH1_PWR_MD (88 | GPIO_ALT_FN_1_IN)
326#define GPIO89_USBH1_PEN_MD (89 | GPIO_ALT_FN_2_OUT)
327#define GPIO90_CIF_DD_4_MD (90 | GPIO_ALT_FN_3_IN)
328#define GPIO91_CIF_DD_5_MD (91 | GPIO_ALT_FN_3_IN)
329#define GPIO92_MMCDAT0_MD (92 | GPIO_ALT_FN_1_OUT)
330#define GPIO93_CIF_DD_6_MD (93 | GPIO_ALT_FN_2_IN)
331#define GPIO94_CIF_DD_5_MD (94 | GPIO_ALT_FN_2_IN)
332#define GPIO95_CIF_DD_4_MD (95 | GPIO_ALT_FN_2_IN)
333#define GPIO95_KP_MKIN6_MD (95 | GPIO_ALT_FN_3_IN)
334#define GPIO96_KP_DKIN3_MD (96 | GPIO_ALT_FN_1_IN)
335#define GPIO96_FFRXD_MD (96 | GPIO_ALT_FN_3_IN)
336#define GPIO97_KP_MKIN3_MD (97 | GPIO_ALT_FN_3_IN)
337#define GPIO98_CIF_DD_0_MD (98 | GPIO_ALT_FN_2_IN)
338#define GPIO98_FFRTS_MD (98 | GPIO_ALT_FN_3_OUT)
339#define GPIO99_FFTXD_MD (99 | GPIO_ALT_FN_3_OUT)
340#define GPIO100_KP_MKIN0_MD (100 | GPIO_ALT_FN_1_IN)
341#define GPIO101_KP_MKIN1_MD (101 | GPIO_ALT_FN_1_IN)
342#define GPIO102_nPCE_1_MD (102 | GPIO_ALT_FN_1_OUT)
343#define GPIO102_KP_MKIN2_MD (102 | GPIO_ALT_FN_1_IN)
344#define GPIO103_CIF_DD_3_MD (103 | GPIO_ALT_FN_1_IN)
345#define GPIO103_KP_MKOUT0_MD (103 | GPIO_ALT_FN_2_OUT)
346#define GPIO104_CIF_DD_2_MD (104 | GPIO_ALT_FN_1_IN)
347#define GPIO104_pSKTSEL_MD (104 | GPIO_ALT_FN_1_OUT)
348#define GPIO104_KP_MKOUT1_MD (104 | GPIO_ALT_FN_2_OUT)
349#define GPIO105_CIF_DD_1_MD (105 | GPIO_ALT_FN_1_IN)
350#define GPIO105_KP_MKOUT2_MD (105 | GPIO_ALT_FN_2_OUT)
351#define GPIO106_CIF_DD_9_MD (106 | GPIO_ALT_FN_1_IN)
352#define GPIO106_KP_MKOUT3_MD (106 | GPIO_ALT_FN_2_OUT)
353#define GPIO107_CIF_DD_8_MD (107 | GPIO_ALT_FN_1_IN)
354#define GPIO107_KP_MKOUT4_MD (107 | GPIO_ALT_FN_2_OUT)
355#define GPIO108_CIF_DD_7_MD (108 | GPIO_ALT_FN_1_IN)
356#define GPIO108_KP_MKOUT5_MD (108 | GPIO_ALT_FN_2_OUT)
357#define GPIO109_MMCDAT1_MD (109 | GPIO_ALT_FN_1_OUT)
358#define GPIO110_MMCDAT2_MD (110 | GPIO_ALT_FN_1_OUT)
359#define GPIO110_MMCCS0_MD (110 | GPIO_ALT_FN_1_OUT)
360#define GPIO111_MMCDAT3_MD (111 | GPIO_ALT_FN_1_OUT)
361#define GPIO110_MMCCS1_MD (111 | GPIO_ALT_FN_1_OUT)
362#define GPIO112_MMCCMD_MD (112 | GPIO_ALT_FN_1_OUT)
363#define GPIO113_I2S_SYSCLK_MD (113 | GPIO_ALT_FN_1_OUT)
364#define GPIO113_AC97_RESET_N_MD (113 | GPIO_ALT_FN_2_OUT)
365#define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_IN)
366#define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN)
367
368#endif /* __ASM_ARCH_PXA2XX_GPIO_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h b/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
new file mode 100644
index 000000000000..806ecfea44bf
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
@@ -0,0 +1,246 @@
1/*
2 * arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
3 *
4 * Taken from pxa-regs.h by Russell King
5 *
6 * Author: Nicolas Pitre
7 * Copyright: MontaVista Software 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 version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __PXA2XX_REGS_H
15#define __PXA2XX_REGS_H
16
17/*
18 * Memory controller
19 */
20
21#define MDCNFG __REG(0x48000000) /* SDRAM Configuration Register 0 */
22#define MDREFR __REG(0x48000004) /* SDRAM Refresh Control Register */
23#define MSC0 __REG(0x48000008) /* Static Memory Control Register 0 */
24#define MSC1 __REG(0x4800000C) /* Static Memory Control Register 1 */
25#define MSC2 __REG(0x48000010) /* Static Memory Control Register 2 */
26#define MECR __REG(0x48000014) /* Expansion Memory (PCMCIA/Compact Flash) Bus Configuration */
27#define SXLCR __REG(0x48000018) /* LCR value to be written to SDRAM-Timing Synchronous Flash */
28#define SXCNFG __REG(0x4800001C) /* Synchronous Static Memory Control Register */
29#define SXMRS __REG(0x48000024) /* MRS value to be written to Synchronous Flash or SMROM */
30#define MCMEM0 __REG(0x48000028) /* Card interface Common Memory Space Socket 0 Timing */
31#define MCMEM1 __REG(0x4800002C) /* Card interface Common Memory Space Socket 1 Timing */
32#define MCATT0 __REG(0x48000030) /* Card interface Attribute Space Socket 0 Timing Configuration */
33#define MCATT1 __REG(0x48000034) /* Card interface Attribute Space Socket 1 Timing Configuration */
34#define MCIO0 __REG(0x48000038) /* Card interface I/O Space Socket 0 Timing Configuration */
35#define MCIO1 __REG(0x4800003C) /* Card interface I/O Space Socket 1 Timing Configuration */
36#define MDMRS __REG(0x48000040) /* MRS value to be written to SDRAM */
37#define BOOT_DEF __REG(0x48000044) /* Read-Only Boot-Time Register. Contains BOOT_SEL and PKG_SEL */
38
39/*
40 * More handy macros for PCMCIA
41 *
42 * Arg is socket number
43 */
44#define MCMEM(s) __REG2(0x48000028, (s)<<2 ) /* Card interface Common Memory Space Socket s Timing */
45#define MCATT(s) __REG2(0x48000030, (s)<<2 ) /* Card interface Attribute Space Socket s Timing Configuration */
46#define MCIO(s) __REG2(0x48000038, (s)<<2 ) /* Card interface I/O Space Socket s Timing Configuration */
47
48/* MECR register defines */
49#define MECR_NOS (1 << 0) /* Number Of Sockets: 0 -> 1 sock, 1 -> 2 sock */
50#define MECR_CIT (1 << 1) /* Card Is There: 0 -> no card, 1 -> card inserted */
51
52#define MDREFR_K0DB4 (1 << 29) /* SDCLK0 Divide by 4 Control/Status */
53#define MDREFR_K2FREE (1 << 25) /* SDRAM Free-Running Control */
54#define MDREFR_K1FREE (1 << 24) /* SDRAM Free-Running Control */
55#define MDREFR_K0FREE (1 << 23) /* SDRAM Free-Running Control */
56#define MDREFR_SLFRSH (1 << 22) /* SDRAM Self-Refresh Control/Status */
57#define MDREFR_APD (1 << 20) /* SDRAM/SSRAM Auto-Power-Down Enable */
58#define MDREFR_K2DB2 (1 << 19) /* SDCLK2 Divide by 2 Control/Status */
59#define MDREFR_K2RUN (1 << 18) /* SDCLK2 Run Control/Status */
60#define MDREFR_K1DB2 (1 << 17) /* SDCLK1 Divide by 2 Control/Status */
61#define MDREFR_K1RUN (1 << 16) /* SDCLK1 Run Control/Status */
62#define MDREFR_E1PIN (1 << 15) /* SDCKE1 Level Control/Status */
63#define MDREFR_K0DB2 (1 << 14) /* SDCLK0 Divide by 2 Control/Status */
64#define MDREFR_K0RUN (1 << 13) /* SDCLK0 Run Control/Status */
65#define MDREFR_E0PIN (1 << 12) /* SDCKE0 Level Control/Status */
66
67
68#ifdef CONFIG_PXA27x
69
70#define ARB_CNTRL __REG(0x48000048) /* Arbiter Control Register */
71
72#define ARB_DMA_SLV_PARK (1<<31) /* Be parked with DMA slave when idle */
73#define ARB_CI_PARK (1<<30) /* Be parked with Camera Interface when idle */
74#define ARB_EX_MEM_PARK (1<<29) /* Be parked with external MEMC when idle */
75#define ARB_INT_MEM_PARK (1<<28) /* Be parked with internal MEMC when idle */
76#define ARB_USB_PARK (1<<27) /* Be parked with USB when idle */
77#define ARB_LCD_PARK (1<<26) /* Be parked with LCD when idle */
78#define ARB_DMA_PARK (1<<25) /* Be parked with DMA when idle */
79#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */
80#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */
81
82#endif
83
84
85/*
86 * Power Manager
87 */
88
89#define PMCR __REG(0x40F00000) /* Power Manager Control Register */
90#define PSSR __REG(0x40F00004) /* Power Manager Sleep Status Register */
91#define PSPR __REG(0x40F00008) /* Power Manager Scratch Pad Register */
92#define PWER __REG(0x40F0000C) /* Power Manager Wake-up Enable Register */
93#define PRER __REG(0x40F00010) /* Power Manager GPIO Rising-Edge Detect Enable Register */
94#define PFER __REG(0x40F00014) /* Power Manager GPIO Falling-Edge Detect Enable Register */
95#define PEDR __REG(0x40F00018) /* Power Manager GPIO Edge Detect Status Register */
96#define PCFR __REG(0x40F0001C) /* Power Manager General Configuration Register */
97#define PGSR0 __REG(0x40F00020) /* Power Manager GPIO Sleep State Register for GP[31-0] */
98#define PGSR1 __REG(0x40F00024) /* Power Manager GPIO Sleep State Register for GP[63-32] */
99#define PGSR2 __REG(0x40F00028) /* Power Manager GPIO Sleep State Register for GP[84-64] */
100#define PGSR3 __REG(0x40F0002C) /* Power Manager GPIO Sleep State Register for GP[118-96] */
101#define RCSR __REG(0x40F00030) /* Reset Controller Status Register */
102
103#define PSLR __REG(0x40F00034) /* Power Manager Sleep Config Register */
104#define PSTR __REG(0x40F00038) /* Power Manager Standby Config Register */
105#define PSNR __REG(0x40F0003C) /* Power Manager Sense Config Register */
106#define PVCR __REG(0x40F00040) /* Power Manager VoltageControl Register */
107#define PKWR __REG(0x40F00050) /* Power Manager KB Wake-up Enable Reg */
108#define PKSR __REG(0x40F00054) /* Power Manager KB Level-Detect Register */
109#define PCMD(x) __REG2(0x40F00080, (x)<<2)
110#define PCMD0 __REG(0x40F00080 + 0 * 4)
111#define PCMD1 __REG(0x40F00080 + 1 * 4)
112#define PCMD2 __REG(0x40F00080 + 2 * 4)
113#define PCMD3 __REG(0x40F00080 + 3 * 4)
114#define PCMD4 __REG(0x40F00080 + 4 * 4)
115#define PCMD5 __REG(0x40F00080 + 5 * 4)
116#define PCMD6 __REG(0x40F00080 + 6 * 4)
117#define PCMD7 __REG(0x40F00080 + 7 * 4)
118#define PCMD8 __REG(0x40F00080 + 8 * 4)
119#define PCMD9 __REG(0x40F00080 + 9 * 4)
120#define PCMD10 __REG(0x40F00080 + 10 * 4)
121#define PCMD11 __REG(0x40F00080 + 11 * 4)
122#define PCMD12 __REG(0x40F00080 + 12 * 4)
123#define PCMD13 __REG(0x40F00080 + 13 * 4)
124#define PCMD14 __REG(0x40F00080 + 14 * 4)
125#define PCMD15 __REG(0x40F00080 + 15 * 4)
126#define PCMD16 __REG(0x40F00080 + 16 * 4)
127#define PCMD17 __REG(0x40F00080 + 17 * 4)
128#define PCMD18 __REG(0x40F00080 + 18 * 4)
129#define PCMD19 __REG(0x40F00080 + 19 * 4)
130#define PCMD20 __REG(0x40F00080 + 20 * 4)
131#define PCMD21 __REG(0x40F00080 + 21 * 4)
132#define PCMD22 __REG(0x40F00080 + 22 * 4)
133#define PCMD23 __REG(0x40F00080 + 23 * 4)
134#define PCMD24 __REG(0x40F00080 + 24 * 4)
135#define PCMD25 __REG(0x40F00080 + 25 * 4)
136#define PCMD26 __REG(0x40F00080 + 26 * 4)
137#define PCMD27 __REG(0x40F00080 + 27 * 4)
138#define PCMD28 __REG(0x40F00080 + 28 * 4)
139#define PCMD29 __REG(0x40F00080 + 29 * 4)
140#define PCMD30 __REG(0x40F00080 + 30 * 4)
141#define PCMD31 __REG(0x40F00080 + 31 * 4)
142
143#define PCMD_MBC (1<<12)
144#define PCMD_DCE (1<<11)
145#define PCMD_LC (1<<10)
146/* FIXME: PCMD_SQC need be checked. */
147#define PCMD_SQC (3<<8) /* currently only bit 8 is changeable,
148 bit 9 should be 0 all day. */
149#define PVCR_VCSA (0x1<<14)
150#define PVCR_CommandDelay (0xf80)
151#define PCFR_PI2C_EN (0x1 << 6)
152
153#define PSSR_OTGPH (1 << 6) /* OTG Peripheral control Hold */
154#define PSSR_RDH (1 << 5) /* Read Disable Hold */
155#define PSSR_PH (1 << 4) /* Peripheral Control Hold */
156#define PSSR_STS (1 << 3) /* Standby Mode Status */
157#define PSSR_VFS (1 << 2) /* VDD Fault Status */
158#define PSSR_BFS (1 << 1) /* Battery Fault Status */
159#define PSSR_SSS (1 << 0) /* Software Sleep Status */
160
161#define PSLR_SL_ROD (1 << 20) /* Sleep-Mode/Depp-Sleep Mode nRESET_OUT Disable */
162
163#define PCFR_RO (1 << 15) /* RDH Override */
164#define PCFR_PO (1 << 14) /* PH Override */
165#define PCFR_GPROD (1 << 12) /* GPIO nRESET_OUT Disable */
166#define PCFR_L1_EN (1 << 11) /* Sleep Mode L1 converter Enable */
167#define PCFR_FVC (1 << 10) /* Frequency/Voltage Change */
168#define PCFR_DC_EN (1 << 7) /* Sleep/deep-sleep DC-DC Converter Enable */
169#define PCFR_PI2CEN (1 << 6) /* Enable PI2C controller */
170#define PCFR_GPR_EN (1 << 4) /* nRESET_GPIO Pin Enable */
171#define PCFR_DS (1 << 3) /* Deep Sleep Mode */
172#define PCFR_FS (1 << 2) /* Float Static Chip Selects */
173#define PCFR_FP (1 << 1) /* Float PCMCIA controls */
174#define PCFR_OPDE (1 << 0) /* 3.6864 MHz oscillator power-down enable */
175
176#define RCSR_GPR (1 << 3) /* GPIO Reset */
177#define RCSR_SMR (1 << 2) /* Sleep Mode */
178#define RCSR_WDR (1 << 1) /* Watchdog Reset */
179#define RCSR_HWR (1 << 0) /* Hardware Reset */
180
181#define PWER_GPIO(Nb) (1 << Nb) /* GPIO [0..15] wake-up enable */
182#define PWER_GPIO0 PWER_GPIO (0) /* GPIO [0] wake-up enable */
183#define PWER_GPIO1 PWER_GPIO (1) /* GPIO [1] wake-up enable */
184#define PWER_GPIO2 PWER_GPIO (2) /* GPIO [2] wake-up enable */
185#define PWER_GPIO3 PWER_GPIO (3) /* GPIO [3] wake-up enable */
186#define PWER_GPIO4 PWER_GPIO (4) /* GPIO [4] wake-up enable */
187#define PWER_GPIO5 PWER_GPIO (5) /* GPIO [5] wake-up enable */
188#define PWER_GPIO6 PWER_GPIO (6) /* GPIO [6] wake-up enable */
189#define PWER_GPIO7 PWER_GPIO (7) /* GPIO [7] wake-up enable */
190#define PWER_GPIO8 PWER_GPIO (8) /* GPIO [8] wake-up enable */
191#define PWER_GPIO9 PWER_GPIO (9) /* GPIO [9] wake-up enable */
192#define PWER_GPIO10 PWER_GPIO (10) /* GPIO [10] wake-up enable */
193#define PWER_GPIO11 PWER_GPIO (11) /* GPIO [11] wake-up enable */
194#define PWER_GPIO12 PWER_GPIO (12) /* GPIO [12] wake-up enable */
195#define PWER_GPIO13 PWER_GPIO (13) /* GPIO [13] wake-up enable */
196#define PWER_GPIO14 PWER_GPIO (14) /* GPIO [14] wake-up enable */
197#define PWER_GPIO15 PWER_GPIO (15) /* GPIO [15] wake-up enable */
198#define PWER_RTC 0x80000000 /* RTC alarm wake-up enable */
199
200/*
201 * PXA2xx specific Core clock definitions
202 */
203#define CCCR __REG(0x41300000) /* Core Clock Configuration Register */
204#define CCSR __REG(0x4130000C) /* Core Clock Status Register */
205#define CKEN __REG(0x41300004) /* Clock Enable Register */
206#define OSCC __REG(0x41300008) /* Oscillator Configuration Register */
207
208#define CCCR_N_MASK 0x0380 /* Run Mode Frequency to Turbo Mode Frequency Multiplier */
209#define CCCR_M_MASK 0x0060 /* Memory Frequency to Run Mode Frequency Multiplier */
210#define CCCR_L_MASK 0x001f /* Crystal Frequency to Memory Frequency Multiplier */
211
212#define CKEN_AC97CONF (31) /* AC97 Controller Configuration */
213#define CKEN_CAMERA (24) /* Camera Interface Clock Enable */
214#define CKEN_SSP1 (23) /* SSP1 Unit Clock Enable */
215#define CKEN_MEMC (22) /* Memory Controller Clock Enable */
216#define CKEN_MEMSTK (21) /* Memory Stick Host Controller */
217#define CKEN_IM (20) /* Internal Memory Clock Enable */
218#define CKEN_KEYPAD (19) /* Keypad Interface Clock Enable */
219#define CKEN_USIM (18) /* USIM Unit Clock Enable */
220#define CKEN_MSL (17) /* MSL Unit Clock Enable */
221#define CKEN_LCD (16) /* LCD Unit Clock Enable */
222#define CKEN_PWRI2C (15) /* PWR I2C Unit Clock Enable */
223#define CKEN_I2C (14) /* I2C Unit Clock Enable */
224#define CKEN_FICP (13) /* FICP Unit Clock Enable */
225#define CKEN_MMC (12) /* MMC Unit Clock Enable */
226#define CKEN_USB (11) /* USB Unit Clock Enable */
227#define CKEN_ASSP (10) /* ASSP (SSP3) Clock Enable */
228#define CKEN_USBHOST (10) /* USB Host Unit Clock Enable */
229#define CKEN_OSTIMER (9) /* OS Timer Unit Clock Enable */
230#define CKEN_NSSP (9) /* NSSP (SSP2) Clock Enable */
231#define CKEN_I2S (8) /* I2S Unit Clock Enable */
232#define CKEN_BTUART (7) /* BTUART Unit Clock Enable */
233#define CKEN_FFUART (6) /* FFUART Unit Clock Enable */
234#define CKEN_STUART (5) /* STUART Unit Clock Enable */
235#define CKEN_HWUART (4) /* HWUART Unit Clock Enable */
236#define CKEN_SSP3 (4) /* SSP3 Unit Clock Enable */
237#define CKEN_SSP (3) /* SSP Unit Clock Enable */
238#define CKEN_SSP2 (3) /* SSP2 Unit Clock Enable */
239#define CKEN_AC97 (2) /* AC97 Unit Clock Enable */
240#define CKEN_PWM1 (1) /* PWM1 Clock Enable */
241#define CKEN_PWM0 (0) /* PWM0 Clock Enable */
242
243#define OSCC_OON (1 << 1) /* 32.768kHz OON (write-once only bit) */
244#define OSCC_OOK (1 << 0) /* 32.768kHz OOK (read-only bit) */
245
246#endif
diff --git a/arch/arm/mach-pxa/include/mach/pxa2xx_spi.h b/arch/arm/mach-pxa/include/mach/pxa2xx_spi.h
new file mode 100644
index 000000000000..2206cb61a9f9
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa2xx_spi.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs
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., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef PXA2XX_SPI_H_
20#define PXA2XX_SPI_H_
21
22#define PXA2XX_CS_ASSERT (0x01)
23#define PXA2XX_CS_DEASSERT (0x02)
24
25/* device.platform_data for SSP controller devices */
26struct pxa2xx_spi_master {
27 u32 clock_enable;
28 u16 num_chipselect;
29 u8 enable_dma;
30};
31
32/* spi_board_info.controller_data for SPI slave devices,
33 * copied to spi_device.platform_data ... mostly for dma tuning
34 */
35struct pxa2xx_spi_chip {
36 u8 tx_threshold;
37 u8 rx_threshold;
38 u8 dma_burst_size;
39 u32 timeout;
40 u8 enable_loopback;
41 void (*cs_control)(u32 command);
42};
43
44extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info);
45
46#endif /*PXA2XX_SPI_H_*/
diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h b/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h
new file mode 100644
index 000000000000..39eb68319e28
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h
@@ -0,0 +1,183 @@
1/*
2 * arch/arm/mach-pxa/include/mach/pxa3xx-regs.h
3 *
4 * PXA3xx specific register definitions
5 *
6 * Copyright (C) 2007 Marvell International Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ASM_ARCH_PXA3XX_REGS_H
14#define __ASM_ARCH_PXA3XX_REGS_H
15
16/*
17 * Oscillator Configuration Register (OSCC)
18 */
19#define OSCC __REG(0x41350000) /* Oscillator Configuration Register */
20
21#define OSCC_PEN (1 << 11) /* 13MHz POUT */
22
23
24/*
25 * Service Power Management Unit (MPMU)
26 */
27#define PMCR __REG(0x40F50000) /* Power Manager Control Register */
28#define PSR __REG(0x40F50004) /* Power Manager S2 Status Register */
29#define PSPR __REG(0x40F50008) /* Power Manager Scratch Pad Register */
30#define PCFR __REG(0x40F5000C) /* Power Manager General Configuration Register */
31#define PWER __REG(0x40F50010) /* Power Manager Wake-up Enable Register */
32#define PWSR __REG(0x40F50014) /* Power Manager Wake-up Status Register */
33#define PECR __REG(0x40F50018) /* Power Manager EXT_WAKEUP[1:0] Control Register */
34#define DCDCSR __REG(0x40F50080) /* DC-DC Controller Status Register */
35#define PVCR __REG(0x40F50100) /* Power Manager Voltage Change Control Register */
36#define PCMD(x) __REG(0x40F50110 + ((x) << 2))
37
38/*
39 * Slave Power Managment Unit
40 */
41#define ASCR __REG(0x40f40000) /* Application Subsystem Power Status/Configuration */
42#define ARSR __REG(0x40f40004) /* Application Subsystem Reset Status */
43#define AD3ER __REG(0x40f40008) /* Application Subsystem Wake-Up from D3 Enable */
44#define AD3SR __REG(0x40f4000c) /* Application Subsystem Wake-Up from D3 Status */
45#define AD2D0ER __REG(0x40f40010) /* Application Subsystem Wake-Up from D2 to D0 Enable */
46#define AD2D0SR __REG(0x40f40014) /* Application Subsystem Wake-Up from D2 to D0 Status */
47#define AD2D1ER __REG(0x40f40018) /* Application Subsystem Wake-Up from D2 to D1 Enable */
48#define AD2D1SR __REG(0x40f4001c) /* Application Subsystem Wake-Up from D2 to D1 Status */
49#define AD1D0ER __REG(0x40f40020) /* Application Subsystem Wake-Up from D1 to D0 Enable */
50#define AD1D0SR __REG(0x40f40024) /* Application Subsystem Wake-Up from D1 to D0 Status */
51#define AGENP __REG(0x40f4002c) /* Application Subsystem General Purpose */
52#define AD3R __REG(0x40f40030) /* Application Subsystem D3 Configuration */
53#define AD2R __REG(0x40f40034) /* Application Subsystem D2 Configuration */
54#define AD1R __REG(0x40f40038) /* Application Subsystem D1 Configuration */
55
56/*
57 * Application Subsystem Configuration bits.
58 */
59#define ASCR_RDH (1 << 31)
60#define ASCR_D1S (1 << 2)
61#define ASCR_D2S (1 << 1)
62#define ASCR_D3S (1 << 0)
63
64/*
65 * Application Reset Status bits.
66 */
67#define ARSR_GPR (1 << 3)
68#define ARSR_LPMR (1 << 2)
69#define ARSR_WDT (1 << 1)
70#define ARSR_HWR (1 << 0)
71
72/*
73 * Application Subsystem Wake-Up bits.
74 */
75#define ADXER_WRTC (1 << 31) /* RTC */
76#define ADXER_WOST (1 << 30) /* OS Timer */
77#define ADXER_WTSI (1 << 29) /* Touchscreen */
78#define ADXER_WUSBH (1 << 28) /* USB host */
79#define ADXER_WUSB2 (1 << 26) /* USB client 2.0 */
80#define ADXER_WMSL0 (1 << 24) /* MSL port 0*/
81#define ADXER_WDMUX3 (1 << 23) /* USB EDMUX3 */
82#define ADXER_WDMUX2 (1 << 22) /* USB EDMUX2 */
83#define ADXER_WKP (1 << 21) /* Keypad */
84#define ADXER_WUSIM1 (1 << 20) /* USIM Port 1 */
85#define ADXER_WUSIM0 (1 << 19) /* USIM Port 0 */
86#define ADXER_WOTG (1 << 16) /* USBOTG input */
87#define ADXER_MFP_WFLASH (1 << 15) /* MFP: Data flash busy */
88#define ADXER_MFP_GEN12 (1 << 14) /* MFP: MMC3/GPIO/OST inputs */
89#define ADXER_MFP_WMMC2 (1 << 13) /* MFP: MMC2 */
90#define ADXER_MFP_WMMC1 (1 << 12) /* MFP: MMC1 */
91#define ADXER_MFP_WI2C (1 << 11) /* MFP: I2C */
92#define ADXER_MFP_WSSP4 (1 << 10) /* MFP: SSP4 */
93#define ADXER_MFP_WSSP3 (1 << 9) /* MFP: SSP3 */
94#define ADXER_MFP_WMAXTRIX (1 << 8) /* MFP: matrix keypad */
95#define ADXER_MFP_WUART3 (1 << 7) /* MFP: UART3 */
96#define ADXER_MFP_WUART2 (1 << 6) /* MFP: UART2 */
97#define ADXER_MFP_WUART1 (1 << 5) /* MFP: UART1 */
98#define ADXER_MFP_WSSP2 (1 << 4) /* MFP: SSP2 */
99#define ADXER_MFP_WSSP1 (1 << 3) /* MFP: SSP1 */
100#define ADXER_MFP_WAC97 (1 << 2) /* MFP: AC97 */
101#define ADXER_WEXTWAKE1 (1 << 1) /* External Wake 1 */
102#define ADXER_WEXTWAKE0 (1 << 0) /* External Wake 0 */
103
104/*
105 * AD3R/AD2R/AD1R bits. R2-R5 are only defined for PXA320.
106 */
107#define ADXR_L2 (1 << 8)
108#define ADXR_R5 (1 << 5)
109#define ADXR_R4 (1 << 4)
110#define ADXR_R3 (1 << 3)
111#define ADXR_R2 (1 << 2)
112#define ADXR_R1 (1 << 1)
113#define ADXR_R0 (1 << 0)
114
115/*
116 * Values for PWRMODE CP15 register
117 */
118#define PXA3xx_PM_S3D4C4 0x07 /* aka deep sleep */
119#define PXA3xx_PM_S2D3C4 0x06 /* aka sleep */
120#define PXA3xx_PM_S0D2C2 0x03 /* aka standby */
121#define PXA3xx_PM_S0D1C2 0x02 /* aka LCD refresh */
122#define PXA3xx_PM_S0D0C1 0x01
123
124/*
125 * Application Subsystem Clock
126 */
127#define ACCR __REG(0x41340000) /* Application Subsystem Clock Configuration Register */
128#define ACSR __REG(0x41340004) /* Application Subsystem Clock Status Register */
129#define AICSR __REG(0x41340008) /* Application Subsystem Interrupt Control/Status Register */
130#define CKENA __REG(0x4134000C) /* A Clock Enable Register */
131#define CKENB __REG(0x41340010) /* B Clock Enable Register */
132#define AC97_DIV __REG(0x41340014) /* AC97 clock divisor value register */
133
134/*
135 * Clock Enable Bit
136 */
137#define CKEN_LCD 1 /* < LCD Clock Enable */
138#define CKEN_USBH 2 /* < USB host clock enable */
139#define CKEN_CAMERA 3 /* < Camera interface clock enable */
140#define CKEN_NAND 4 /* < NAND Flash Controller Clock Enable */
141#define CKEN_USB2 6 /* < USB 2.0 client clock enable. */
142#define CKEN_DMC 8 /* < Dynamic Memory Controller clock enable */
143#define CKEN_SMC 9 /* < Static Memory Controller clock enable */
144#define CKEN_ISC 10 /* < Internal SRAM Controller clock enable */
145#define CKEN_BOOT 11 /* < Boot rom clock enable */
146#define CKEN_MMC1 12 /* < MMC1 Clock enable */
147#define CKEN_MMC2 13 /* < MMC2 clock enable */
148#define CKEN_KEYPAD 14 /* < Keypand Controller Clock Enable */
149#define CKEN_CIR 15 /* < Consumer IR Clock Enable */
150#define CKEN_USIM0 17 /* < USIM[0] Clock Enable */
151#define CKEN_USIM1 18 /* < USIM[1] Clock Enable */
152#define CKEN_TPM 19 /* < TPM clock enable */
153#define CKEN_UDC 20 /* < UDC clock enable */
154#define CKEN_BTUART 21 /* < BTUART clock enable */
155#define CKEN_FFUART 22 /* < FFUART clock enable */
156#define CKEN_STUART 23 /* < STUART clock enable */
157#define CKEN_AC97 24 /* < AC97 clock enable */
158#define CKEN_TOUCH 25 /* < Touch screen Interface Clock Enable */
159#define CKEN_SSP1 26 /* < SSP1 clock enable */
160#define CKEN_SSP2 27 /* < SSP2 clock enable */
161#define CKEN_SSP3 28 /* < SSP3 clock enable */
162#define CKEN_SSP4 29 /* < SSP4 clock enable */
163#define CKEN_MSL0 30 /* < MSL0 clock enable */
164#define CKEN_PWM0 32 /* < PWM[0] clock enable */
165#define CKEN_PWM1 33 /* < PWM[1] clock enable */
166#define CKEN_I2C 36 /* < I2C clock enable */
167#define CKEN_INTC 38 /* < Interrupt controller clock enable */
168#define CKEN_GPIO 39 /* < GPIO clock enable */
169#define CKEN_1WIRE 40 /* < 1-wire clock enable */
170#define CKEN_HSIO2 41 /* < HSIO2 clock enable */
171#define CKEN_MINI_IM 48 /* < Mini-IM */
172#define CKEN_MINI_LCD 49 /* < Mini LCD */
173
174#if defined(CONFIG_CPU_PXA310)
175#define CKEN_MMC3 5 /* < MMC3 Clock Enable */
176#define CKEN_MVED 43 /* < MVED clock enable */
177#endif
178
179/* Note: GCU clock enable bit differs on PXA300/PXA310 and PXA320 */
180#define PXA300_CKEN_GRAPHICS 42 /* Graphics controller clock enable */
181#define PXA320_CKEN_GRAPHICS 7 /* Graphics controller clock enable */
182
183#endif /* __ASM_ARCH_PXA3XX_REGS_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx_nand.h b/arch/arm/mach-pxa/include/mach/pxa3xx_nand.h
new file mode 100644
index 000000000000..eb4b190b6657
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa3xx_nand.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_ARCH_PXA3XX_NAND_H
2#define __ASM_ARCH_PXA3XX_NAND_H
3
4#include <linux/mtd/mtd.h>
5#include <linux/mtd/partitions.h>
6
7struct pxa3xx_nand_platform_data {
8
9 /* the data flash bus is shared between the Static Memory
10 * Controller and the Data Flash Controller, the arbiter
11 * controls the ownership of the bus
12 */
13 int enable_arbiter;
14
15 struct mtd_partition *parts;
16 unsigned int nr_parts;
17};
18
19extern void pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info);
20#endif /* __ASM_ARCH_PXA3XX_NAND_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxafb.h b/arch/arm/mach-pxa/include/mach/pxafb.h
new file mode 100644
index 000000000000..65447549616f
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxafb.h
@@ -0,0 +1,151 @@
1/*
2 * arch/arm/mach-pxa/include/mach/pxafb.h
3 *
4 * Support for the xscale frame buffer.
5 *
6 * Author: Jean-Frederic Clere
7 * Created: Sep 22, 2003
8 * Copyright: jfclere@sinix.net
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/fb.h>
16#include <mach/regs-lcd.h>
17
18/*
19 * Supported LCD connections
20 *
21 * bits 0 - 3: for LCD panel type:
22 *
23 * STN - for passive matrix
24 * DSTN - for dual scan passive matrix
25 * TFT - for active matrix
26 *
27 * bits 4 - 9 : for bus width
28 * bits 10-17 : for AC Bias Pin Frequency
29 * bit 18 : for output enable polarity
30 * bit 19 : for pixel clock edge
31 */
32#define LCD_CONN_TYPE(_x) ((_x) & 0x0f)
33#define LCD_CONN_WIDTH(_x) (((_x) >> 4) & 0x1f)
34
35#define LCD_TYPE_UNKNOWN 0
36#define LCD_TYPE_MONO_STN 1
37#define LCD_TYPE_MONO_DSTN 2
38#define LCD_TYPE_COLOR_STN 3
39#define LCD_TYPE_COLOR_DSTN 4
40#define LCD_TYPE_COLOR_TFT 5
41#define LCD_TYPE_SMART_PANEL 6
42#define LCD_TYPE_MAX 7
43
44#define LCD_MONO_STN_4BPP ((4 << 4) | LCD_TYPE_MONO_STN)
45#define LCD_MONO_STN_8BPP ((8 << 4) | LCD_TYPE_MONO_STN)
46#define LCD_MONO_DSTN_8BPP ((8 << 4) | LCD_TYPE_MONO_DSTN)
47#define LCD_COLOR_STN_8BPP ((8 << 4) | LCD_TYPE_COLOR_STN)
48#define LCD_COLOR_DSTN_16BPP ((16 << 4) | LCD_TYPE_COLOR_DSTN)
49#define LCD_COLOR_TFT_16BPP ((16 << 4) | LCD_TYPE_COLOR_TFT)
50#define LCD_COLOR_TFT_18BPP ((18 << 4) | LCD_TYPE_COLOR_TFT)
51#define LCD_SMART_PANEL_8BPP ((8 << 4) | LCD_TYPE_SMART_PANEL)
52#define LCD_SMART_PANEL_16BPP ((16 << 4) | LCD_TYPE_SMART_PANEL)
53#define LCD_SMART_PANEL_18BPP ((18 << 4) | LCD_TYPE_SMART_PANEL)
54
55#define LCD_AC_BIAS_FREQ(x) (((x) & 0xff) << 10)
56#define LCD_BIAS_ACTIVE_HIGH (0 << 17)
57#define LCD_BIAS_ACTIVE_LOW (1 << 17)
58#define LCD_PCLK_EDGE_RISE (0 << 18)
59#define LCD_PCLK_EDGE_FALL (1 << 18)
60
61/*
62 * This structure describes the machine which we are running on.
63 * It is set in linux/arch/arm/mach-pxa/machine_name.c and used in the probe routine
64 * of linux/drivers/video/pxafb.c
65 */
66struct pxafb_mode_info {
67 u_long pixclock;
68
69 u_short xres;
70 u_short yres;
71
72 u_char bpp;
73 u_int cmap_greyscale:1,
74 depth:8,
75 unused:23;
76
77 /* Parallel Mode Timing */
78 u_char hsync_len;
79 u_char left_margin;
80 u_char right_margin;
81
82 u_char vsync_len;
83 u_char upper_margin;
84 u_char lower_margin;
85 u_char sync;
86
87 /* Smart Panel Mode Timing - see PXA27x DM 7.4.15.0.3 for details
88 * Note:
89 * 1. all parameters in nanosecond (ns)
90 * 2. a0cs{rd,wr}_set_hld are controlled by the same register bits
91 * in pxa27x and pxa3xx, initialize them to the same value or
92 * the larger one will be used
93 * 3. same to {rd,wr}_pulse_width
94 */
95 unsigned a0csrd_set_hld; /* A0 and CS Setup/Hold Time before/after L_FCLK_RD */
96 unsigned a0cswr_set_hld; /* A0 and CS Setup/Hold Time before/after L_PCLK_WR */
97 unsigned wr_pulse_width; /* L_PCLK_WR pulse width */
98 unsigned rd_pulse_width; /* L_FCLK_RD pulse width */
99 unsigned cmd_inh_time; /* Command Inhibit time between two writes */
100 unsigned op_hold_time; /* Output Hold time from L_FCLK_RD negation */
101};
102
103struct pxafb_mach_info {
104 struct pxafb_mode_info *modes;
105 unsigned int num_modes;
106
107 unsigned int lcd_conn;
108
109 u_int fixed_modes:1,
110 cmap_inverse:1,
111 cmap_static:1,
112 unused:29;
113
114 /* The following should be defined in LCCR0
115 * LCCR0_Act or LCCR0_Pas Active or Passive
116 * LCCR0_Sngl or LCCR0_Dual Single/Dual panel
117 * LCCR0_Mono or LCCR0_Color Mono/Color
118 * LCCR0_4PixMono or LCCR0_8PixMono (in mono single mode)
119 * LCCR0_DMADel(Tcpu) (optional) DMA request delay
120 *
121 * The following should not be defined in LCCR0:
122 * LCCR0_OUM, LCCR0_BM, LCCR0_QDM, LCCR0_DIS, LCCR0_EFM
123 * LCCR0_IUM, LCCR0_SFM, LCCR0_LDM, LCCR0_ENB
124 */
125 u_int lccr0;
126 /* The following should be defined in LCCR3
127 * LCCR3_OutEnH or LCCR3_OutEnL Output enable polarity
128 * LCCR3_PixRsEdg or LCCR3_PixFlEdg Pixel clock edge type
129 * LCCR3_Acb(X) AB Bias pin frequency
130 * LCCR3_DPC (optional) Double Pixel Clock mode (untested)
131 *
132 * The following should not be defined in LCCR3
133 * LCCR3_HSP, LCCR3_VSP, LCCR0_Pcd(x), LCCR3_Bpp
134 */
135 u_int lccr3;
136 /* The following should be defined in LCCR4
137 * LCCR4_PAL_FOR_0 or LCCR4_PAL_FOR_1 or LCCR4_PAL_FOR_2
138 *
139 * All other bits in LCCR4 should be left alone.
140 */
141 u_int lccr4;
142 void (*pxafb_backlight_power)(int);
143 void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);
144 void (*smart_update)(struct fb_info *);
145};
146void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
147void set_pxa_fb_parent(struct device *parent_dev);
148unsigned long pxafb_get_hsync_time(struct device *dev);
149
150extern int pxafb_smart_queue(struct fb_info *info, uint16_t *cmds, int);
151extern int pxafb_smart_flush(struct fb_info *info);
diff --git a/arch/arm/mach-pxa/include/mach/regs-lcd.h b/arch/arm/mach-pxa/include/mach/regs-lcd.h
new file mode 100644
index 000000000000..c689c4ea769c
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/regs-lcd.h
@@ -0,0 +1,180 @@
1#ifndef __ASM_ARCH_REGS_LCD_H
2#define __ASM_ARCH_REGS_LCD_H
3
4#include <mach/bitfield.h>
5
6/*
7 * LCD Controller Registers and Bits Definitions
8 */
9#define LCCR0 (0x000) /* LCD Controller Control Register 0 */
10#define LCCR1 (0x004) /* LCD Controller Control Register 1 */
11#define LCCR2 (0x008) /* LCD Controller Control Register 2 */
12#define LCCR3 (0x00C) /* LCD Controller Control Register 3 */
13#define LCCR4 (0x010) /* LCD Controller Control Register 4 */
14#define LCCR5 (0x014) /* LCD Controller Control Register 5 */
15#define DFBR0 (0x020) /* DMA Channel 0 Frame Branch Register */
16#define DFBR1 (0x024) /* DMA Channel 1 Frame Branch Register */
17#define LCSR (0x038) /* LCD Controller Status Register */
18#define LIIDR (0x03C) /* LCD Controller Interrupt ID Register */
19#define TMEDRGBR (0x040) /* TMED RGB Seed Register */
20#define TMEDCR (0x044) /* TMED Control Register */
21
22#define CMDCR (0x100) /* Command Control Register */
23#define PRSR (0x104) /* Panel Read Status Register */
24
25#define LCCR3_1BPP (0 << 24)
26#define LCCR3_2BPP (1 << 24)
27#define LCCR3_4BPP (2 << 24)
28#define LCCR3_8BPP (3 << 24)
29#define LCCR3_16BPP (4 << 24)
30#define LCCR3_18BPP (5 << 24)
31#define LCCR3_18BPP_P (6 << 24)
32#define LCCR3_19BPP (7 << 24)
33#define LCCR3_19BPP_P (1 << 29)
34#define LCCR3_24BPP ((1 << 29) | (1 << 24))
35#define LCCR3_25BPP ((1 << 29) | (2 << 24))
36
37#define LCCR3_PDFOR_0 (0 << 30)
38#define LCCR3_PDFOR_1 (1 << 30)
39#define LCCR3_PDFOR_2 (2 << 30)
40#define LCCR3_PDFOR_3 (3 << 30)
41
42#define LCCR4_PAL_FOR_0 (0 << 15)
43#define LCCR4_PAL_FOR_1 (1 << 15)
44#define LCCR4_PAL_FOR_2 (2 << 15)
45#define LCCR4_PAL_FOR_MASK (3 << 15)
46
47#define FDADR0 (0x200) /* DMA Channel 0 Frame Descriptor Address Register */
48#define FSADR0 (0x204) /* DMA Channel 0 Frame Source Address Register */
49#define FIDR0 (0x208) /* DMA Channel 0 Frame ID Register */
50#define LDCMD0 (0x20C) /* DMA Channel 0 Command Register */
51#define FDADR1 (0x210) /* DMA Channel 1 Frame Descriptor Address Register */
52#define FSADR1 (0x214) /* DMA Channel 1 Frame Source Address Register */
53#define FIDR1 (0x218) /* DMA Channel 1 Frame ID Register */
54#define LDCMD1 (0x21C) /* DMA Channel 1 Command Register */
55#define FDADR6 (0x260) /* DMA Channel 6 Frame Descriptor Address Register */
56#define FSADR6 (0x264) /* DMA Channel 6 Frame Source Address Register */
57#define FIDR6 (0x268) /* DMA Channel 6 Frame ID Register */
58
59#define LCCR0_ENB (1 << 0) /* LCD Controller enable */
60#define LCCR0_CMS (1 << 1) /* Color/Monochrome Display Select */
61#define LCCR0_Color (LCCR0_CMS*0) /* Color display */
62#define LCCR0_Mono (LCCR0_CMS*1) /* Monochrome display */
63#define LCCR0_SDS (1 << 2) /* Single/Dual Panel Display Select */
64#define LCCR0_Sngl (LCCR0_SDS*0) /* Single panel display */
65#define LCCR0_Dual (LCCR0_SDS*1) /* Dual panel display */
66
67#define LCCR0_LDM (1 << 3) /* LCD Disable Done Mask */
68#define LCCR0_SFM (1 << 4) /* Start of frame mask */
69#define LCCR0_IUM (1 << 5) /* Input FIFO underrun mask */
70#define LCCR0_EFM (1 << 6) /* End of Frame mask */
71#define LCCR0_PAS (1 << 7) /* Passive/Active display Select */
72#define LCCR0_Pas (LCCR0_PAS*0) /* Passive display (STN) */
73#define LCCR0_Act (LCCR0_PAS*1) /* Active display (TFT) */
74#define LCCR0_DPD (1 << 9) /* Double Pixel Data (monochrome) */
75#define LCCR0_4PixMono (LCCR0_DPD*0) /* 4-Pixel/clock Monochrome display */
76#define LCCR0_8PixMono (LCCR0_DPD*1) /* 8-Pixel/clock Monochrome display */
77#define LCCR0_DIS (1 << 10) /* LCD Disable */
78#define LCCR0_QDM (1 << 11) /* LCD Quick Disable mask */
79#define LCCR0_PDD (0xff << 12) /* Palette DMA request delay */
80#define LCCR0_PDD_S 12
81#define LCCR0_BM (1 << 20) /* Branch mask */
82#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */
83#define LCCR0_LCDT (1 << 22) /* LCD panel type */
84#define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */
85#define LCCR0_CMDIM (1 << 24) /* Command interrupt mask */
86#define LCCR0_OUC (1 << 25) /* Overlay Underlay control bit */
87#define LCCR0_LDDALT (1 << 26) /* LDD alternate mapping control */
88
89#define LCCR1_PPL Fld (10, 0) /* Pixels Per Line - 1 */
90#define LCCR1_DisWdth(Pixel) (((Pixel) - 1) << FShft (LCCR1_PPL))
91
92#define LCCR1_HSW Fld (6, 10) /* Horizontal Synchronization */
93#define LCCR1_HorSnchWdth(Tpix) (((Tpix) - 1) << FShft (LCCR1_HSW))
94
95#define LCCR1_ELW Fld (8, 16) /* End-of-Line pixel clock Wait - 1 */
96#define LCCR1_EndLnDel(Tpix) (((Tpix) - 1) << FShft (LCCR1_ELW))
97
98#define LCCR1_BLW Fld (8, 24) /* Beginning-of-Line pixel clock */
99#define LCCR1_BegLnDel(Tpix) (((Tpix) - 1) << FShft (LCCR1_BLW))
100
101#define LCCR2_LPP Fld (10, 0) /* Line Per Panel - 1 */
102#define LCCR2_DisHght(Line) (((Line) - 1) << FShft (LCCR2_LPP))
103
104#define LCCR2_VSW Fld (6, 10) /* Vertical Synchronization pulse - 1 */
105#define LCCR2_VrtSnchWdth(Tln) (((Tln) - 1) << FShft (LCCR2_VSW))
106
107#define LCCR2_EFW Fld (8, 16) /* End-of-Frame line clock Wait */
108#define LCCR2_EndFrmDel(Tln) ((Tln) << FShft (LCCR2_EFW))
109
110#define LCCR2_BFW Fld (8, 24) /* Beginning-of-Frame line clock */
111#define LCCR2_BegFrmDel(Tln) ((Tln) << FShft (LCCR2_BFW))
112
113#define LCCR3_API (0xf << 16) /* AC Bias pin trasitions per interrupt */
114#define LCCR3_API_S 16
115#define LCCR3_VSP (1 << 20) /* vertical sync polarity */
116#define LCCR3_HSP (1 << 21) /* horizontal sync polarity */
117#define LCCR3_PCP (1 << 22) /* Pixel Clock Polarity (L_PCLK) */
118#define LCCR3_PixRsEdg (LCCR3_PCP*0) /* Pixel clock Rising-Edge */
119#define LCCR3_PixFlEdg (LCCR3_PCP*1) /* Pixel clock Falling-Edge */
120
121#define LCCR3_OEP (1 << 23) /* Output Enable Polarity */
122#define LCCR3_OutEnH (LCCR3_OEP*0) /* Output Enable active High */
123#define LCCR3_OutEnL (LCCR3_OEP*1) /* Output Enable active Low */
124
125#define LCCR3_DPC (1 << 27) /* double pixel clock mode */
126#define LCCR3_PCD Fld (8, 0) /* Pixel Clock Divisor */
127#define LCCR3_PixClkDiv(Div) (((Div) << FShft (LCCR3_PCD)))
128
129#define LCCR3_BPP Fld (3, 24) /* Bit Per Pixel */
130#define LCCR3_Bpp(Bpp) (((Bpp) << FShft (LCCR3_BPP)))
131
132#define LCCR3_ACB Fld (8, 8) /* AC Bias */
133#define LCCR3_Acb(Acb) (((Acb) << FShft (LCCR3_ACB)))
134
135#define LCCR3_HorSnchH (LCCR3_HSP*0) /* HSP Active High */
136#define LCCR3_HorSnchL (LCCR3_HSP*1) /* HSP Active Low */
137
138#define LCCR3_VrtSnchH (LCCR3_VSP*0) /* VSP Active High */
139#define LCCR3_VrtSnchL (LCCR3_VSP*1) /* VSP Active Low */
140
141#define LCCR5_IUM(x) (1 << ((x) + 23)) /* input underrun mask */
142#define LCCR5_BSM(x) (1 << ((x) + 15)) /* branch mask */
143#define LCCR5_EOFM(x) (1 << ((x) + 7)) /* end of frame mask */
144#define LCCR5_SOFM(x) (1 << ((x) + 0)) /* start of frame mask */
145
146#define LCSR_LDD (1 << 0) /* LCD Disable Done */
147#define LCSR_SOF (1 << 1) /* Start of frame */
148#define LCSR_BER (1 << 2) /* Bus error */
149#define LCSR_ABC (1 << 3) /* AC Bias count */
150#define LCSR_IUL (1 << 4) /* input FIFO underrun Lower panel */
151#define LCSR_IUU (1 << 5) /* input FIFO underrun Upper panel */
152#define LCSR_OU (1 << 6) /* output FIFO underrun */
153#define LCSR_QD (1 << 7) /* quick disable */
154#define LCSR_EOF (1 << 8) /* end of frame */
155#define LCSR_BS (1 << 9) /* branch status */
156#define LCSR_SINT (1 << 10) /* subsequent interrupt */
157#define LCSR_RD_ST (1 << 11) /* read status */
158#define LCSR_CMD_INT (1 << 12) /* command interrupt */
159
160#define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */
161
162/* smartpanel related */
163#define PRSR_DATA(x) ((x) & 0xff) /* Panel Data */
164#define PRSR_A0 (1 << 8) /* Read Data Source */
165#define PRSR_ST_OK (1 << 9) /* Status OK */
166#define PRSR_CON_NT (1 << 10) /* Continue to Next Command */
167
168#define SMART_CMD_A0 (0x1 << 8)
169#define SMART_CMD_READ_STATUS_REG (0x0 << 9)
170#define SMART_CMD_READ_FRAME_BUFFER ((0x0 << 9) | SMART_CMD_A0)
171#define SMART_CMD_WRITE_COMMAND (0x1 << 9)
172#define SMART_CMD_WRITE_DATA ((0x1 << 9) | SMART_CMD_A0)
173#define SMART_CMD_WRITE_FRAME ((0x2 << 9) | SMART_CMD_A0)
174#define SMART_CMD_WAIT_FOR_VSYNC (0x3 << 9)
175#define SMART_CMD_NOOP (0x4 << 9)
176#define SMART_CMD_INTERRUPT (0x5 << 9)
177
178#define SMART_CMD(x) (SMART_CMD_WRITE_COMMAND | ((x) & 0xff))
179#define SMART_DAT(x) (SMART_CMD_WRITE_DATA | ((x) & 0xff))
180#endif /* __ASM_ARCH_REGS_LCD_H */
diff --git a/arch/arm/mach-pxa/include/mach/regs-ssp.h b/arch/arm/mach-pxa/include/mach/regs-ssp.h
new file mode 100644
index 000000000000..3c04cde2cf1f
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/regs-ssp.h
@@ -0,0 +1,127 @@
1#ifndef __ASM_ARCH_REGS_SSP_H
2#define __ASM_ARCH_REGS_SSP_H
3
4/*
5 * SSP Serial Port Registers
6 * PXA250, PXA255, PXA26x and PXA27x SSP controllers are all slightly different.
7 * PXA255, PXA26x and PXA27x have extra ports, registers and bits.
8 */
9
10#define SSCR0 (0x00) /* SSP Control Register 0 */
11#define SSCR1 (0x04) /* SSP Control Register 1 */
12#define SSSR (0x08) /* SSP Status Register */
13#define SSITR (0x0C) /* SSP Interrupt Test Register */
14#define SSDR (0x10) /* SSP Data Write/Data Read Register */
15
16#define SSTO (0x28) /* SSP Time Out Register */
17#define SSPSP (0x2C) /* SSP Programmable Serial Protocol */
18#define SSTSA (0x30) /* SSP Tx Timeslot Active */
19#define SSRSA (0x34) /* SSP Rx Timeslot Active */
20#define SSTSS (0x38) /* SSP Timeslot Status */
21#define SSACD (0x3C) /* SSP Audio Clock Divider */
22
23#if defined(CONFIG_PXA3xx)
24#define SSACDD (0x40) /* SSP Audio Clock Dither Divider */
25#endif
26
27/* Common PXA2xx bits first */
28#define SSCR0_DSS (0x0000000f) /* Data Size Select (mask) */
29#define SSCR0_DataSize(x) ((x) - 1) /* Data Size Select [4..16] */
30#define SSCR0_FRF (0x00000030) /* FRame Format (mask) */
31#define SSCR0_Motorola (0x0 << 4) /* Motorola's Serial Peripheral Interface (SPI) */
32#define SSCR0_TI (0x1 << 4) /* Texas Instruments' Synchronous Serial Protocol (SSP) */
33#define SSCR0_National (0x2 << 4) /* National Microwire */
34#define SSCR0_ECS (1 << 6) /* External clock select */
35#define SSCR0_SSE (1 << 7) /* Synchronous Serial Port Enable */
36
37#if defined(CONFIG_PXA25x)
38#define SSCR0_SCR (0x0000ff00) /* Serial Clock Rate (mask) */
39#define SSCR0_SerClkDiv(x) ((((x) - 2)/2) << 8) /* Divisor [2..512] */
40
41#elif defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
42#define SSCR0_SCR (0x000fff00) /* Serial Clock Rate (mask) */
43#define SSCR0_SerClkDiv(x) (((x) - 1) << 8) /* Divisor [1..4096] */
44#define SSCR0_EDSS (1 << 20) /* Extended data size select */
45#define SSCR0_NCS (1 << 21) /* Network clock select */
46#define SSCR0_RIM (1 << 22) /* Receive FIFO overrrun interrupt mask */
47#define SSCR0_TUM (1 << 23) /* Transmit FIFO underrun interrupt mask */
48#define SSCR0_FRDC (0x07000000) /* Frame rate divider control (mask) */
49#define SSCR0_SlotsPerFrm(x) (((x) - 1) << 24) /* Time slots per frame [1..8] */
50#define SSCR0_ADC (1 << 30) /* Audio clock select */
51#define SSCR0_MOD (1 << 31) /* Mode (normal or network) */
52#endif
53
54#if defined(CONFIG_PXA3xx)
55#define SSCR0_FPCKE (1 << 29) /* FIFO packing enable */
56#endif
57
58#define SSCR1_RIE (1 << 0) /* Receive FIFO Interrupt Enable */
59#define SSCR1_TIE (1 << 1) /* Transmit FIFO Interrupt Enable */
60#define SSCR1_LBM (1 << 2) /* Loop-Back Mode */
61#define SSCR1_SPO (1 << 3) /* Motorola SPI SSPSCLK polarity setting */
62#define SSCR1_SPH (1 << 4) /* Motorola SPI SSPSCLK phase setting */
63#define SSCR1_MWDS (1 << 5) /* Microwire Transmit Data Size */
64#define SSCR1_TFT (0x000003c0) /* Transmit FIFO Threshold (mask) */
65#define SSCR1_TxTresh(x) (((x) - 1) << 6) /* level [1..16] */
66#define SSCR1_RFT (0x00003c00) /* Receive FIFO Threshold (mask) */
67#define SSCR1_RxTresh(x) (((x) - 1) << 10) /* level [1..16] */
68
69#define SSSR_TNF (1 << 2) /* Transmit FIFO Not Full */
70#define SSSR_RNE (1 << 3) /* Receive FIFO Not Empty */
71#define SSSR_BSY (1 << 4) /* SSP Busy */
72#define SSSR_TFS (1 << 5) /* Transmit FIFO Service Request */
73#define SSSR_RFS (1 << 6) /* Receive FIFO Service Request */
74#define SSSR_ROR (1 << 7) /* Receive FIFO Overrun */
75
76#define SSCR0_TIM (1 << 23) /* Transmit FIFO Under Run Interrupt Mask */
77#define SSCR0_RIM (1 << 22) /* Receive FIFO Over Run interrupt Mask */
78#define SSCR0_NCS (1 << 21) /* Network Clock Select */
79#define SSCR0_EDSS (1 << 20) /* Extended Data Size Select */
80
81/* extra bits in PXA255, PXA26x and PXA27x SSP ports */
82#define SSCR0_TISSP (1 << 4) /* TI Sync Serial Protocol */
83#define SSCR0_PSP (3 << 4) /* PSP - Programmable Serial Protocol */
84#define SSCR1_TTELP (1 << 31) /* TXD Tristate Enable Last Phase */
85#define SSCR1_TTE (1 << 30) /* TXD Tristate Enable */
86#define SSCR1_EBCEI (1 << 29) /* Enable Bit Count Error interrupt */
87#define SSCR1_SCFR (1 << 28) /* Slave Clock free Running */
88#define SSCR1_ECRA (1 << 27) /* Enable Clock Request A */
89#define SSCR1_ECRB (1 << 26) /* Enable Clock request B */
90#define SSCR1_SCLKDIR (1 << 25) /* Serial Bit Rate Clock Direction */
91#define SSCR1_SFRMDIR (1 << 24) /* Frame Direction */
92#define SSCR1_RWOT (1 << 23) /* Receive Without Transmit */
93#define SSCR1_TRAIL (1 << 22) /* Trailing Byte */
94#define SSCR1_TSRE (1 << 21) /* Transmit Service Request Enable */
95#define SSCR1_RSRE (1 << 20) /* Receive Service Request Enable */
96#define SSCR1_TINTE (1 << 19) /* Receiver Time-out Interrupt enable */
97#define SSCR1_PINTE (1 << 18) /* Peripheral Trailing Byte Interupt Enable */
98#define SSCR1_IFS (1 << 16) /* Invert Frame Signal */
99#define SSCR1_STRF (1 << 15) /* Select FIFO or EFWR */
100#define SSCR1_EFWR (1 << 14) /* Enable FIFO Write/Read */
101
102#define SSSR_BCE (1 << 23) /* Bit Count Error */
103#define SSSR_CSS (1 << 22) /* Clock Synchronisation Status */
104#define SSSR_TUR (1 << 21) /* Transmit FIFO Under Run */
105#define SSSR_EOC (1 << 20) /* End Of Chain */
106#define SSSR_TINT (1 << 19) /* Receiver Time-out Interrupt */
107#define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */
108
109#define SSPSP_FSRT (1 << 25) /* Frame Sync Relative Timing */
110#define SSPSP_DMYSTOP(x) ((x) << 23) /* Dummy Stop */
111#define SSPSP_SFRMWDTH(x) ((x) << 16) /* Serial Frame Width */
112#define SSPSP_SFRMDLY(x) ((x) << 9) /* Serial Frame Delay */
113#define SSPSP_DMYSTRT(x) ((x) << 7) /* Dummy Start */
114#define SSPSP_STRTDLY(x) ((x) << 4) /* Start Delay */
115#define SSPSP_ETDS (1 << 3) /* End of Transfer data State */
116#define SSPSP_SFRMP (1 << 2) /* Serial Frame Polarity */
117#define SSPSP_SCMODE(x) ((x) << 0) /* Serial Bit Rate Clock Mode */
118
119#define SSACD_SCDB (1 << 3) /* SSPSYSCLK Divider Bypass */
120#define SSACD_ACPS(x) ((x) << 4) /* Audio clock PLL select */
121#define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */
122#if defined(CONFIG_PXA3xx)
123#define SSACD_SCDX8 (1 << 7) /* SYSCLK division ratio select */
124#endif
125
126
127#endif /* __ASM_ARCH_REGS_SSP_H */
diff --git a/arch/arm/mach-pxa/include/mach/reset.h b/arch/arm/mach-pxa/include/mach/reset.h
new file mode 100644
index 000000000000..9489a48871a8
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/reset.h
@@ -0,0 +1,18 @@
1#ifndef __ASM_ARCH_RESET_H
2#define __ASM_ARCH_RESET_H
3
4#define RESET_STATUS_HARDWARE (1 << 0) /* Hardware Reset */
5#define RESET_STATUS_WATCHDOG (1 << 1) /* Watchdog Reset */
6#define RESET_STATUS_LOWPOWER (1 << 2) /* Low Power/Sleep Exit */
7#define RESET_STATUS_GPIO (1 << 3) /* GPIO Reset */
8#define RESET_STATUS_ALL (0xf)
9
10extern unsigned int reset_status;
11extern void clear_reset_status(unsigned int mask);
12
13/*
14 * register GPIO as reset generator
15 */
16extern int init_gpio_reset(int gpio);
17
18#endif /* __ASM_ARCH_RESET_H */
diff --git a/arch/arm/mach-pxa/include/mach/sharpsl.h b/arch/arm/mach-pxa/include/mach/sharpsl.h
new file mode 100644
index 000000000000..3b1d4a72d4d1
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/sharpsl.h
@@ -0,0 +1,34 @@
1/*
2 * SharpSL SSP Driver
3 */
4
5unsigned long corgi_ssp_ads7846_putget(unsigned long);
6unsigned long corgi_ssp_ads7846_get(void);
7void corgi_ssp_ads7846_put(unsigned long data);
8void corgi_ssp_ads7846_lock(void);
9void corgi_ssp_ads7846_unlock(void);
10void corgi_ssp_lcdtg_send (unsigned char adrs, unsigned char data);
11void corgi_ssp_blduty_set(int duty);
12int corgi_ssp_max1111_get(unsigned long data);
13
14/*
15 * SharpSL Touchscreen Driver
16 */
17
18struct corgits_machinfo {
19 unsigned long (*get_hsync_invperiod)(void);
20 void (*put_hsync)(void);
21 void (*wait_hsync)(void);
22};
23
24
25/*
26 * SharpSL Backlight
27 */
28extern void corgibl_limit_intensity(int limit);
29
30
31/*
32 * SharpSL Battery/PM Driver
33 */
34extern void sharpsl_battery_kick(void);
diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h
new file mode 100644
index 000000000000..bd14365f7ed5
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/spitz.h
@@ -0,0 +1,158 @@
1/*
2 * Hardware specific definitions for SL-Cx000 series of PDAs
3 *
4 * Copyright (c) 2005 Alexander Wykes
5 * Copyright (c) 2005 Richard Purdie
6 *
7 * Based on Sharp's 2.4 kernel patches
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14#ifndef __ASM_ARCH_SPITZ_H
15#define __ASM_ARCH_SPITZ_H 1
16#endif
17
18#include <linux/fb.h>
19
20/* Spitz/Akita GPIOs */
21
22#define SPITZ_GPIO_KEY_INT (0) /* Key Interrupt */
23#define SPITZ_GPIO_RESET (1)
24#define SPITZ_GPIO_nSD_DETECT (9)
25#define SPITZ_GPIO_TP_INT (11) /* Touch Panel interrupt */
26#define SPITZ_GPIO_AK_INT (13) /* Remote Control */
27#define SPITZ_GPIO_ADS7846_CS (14)
28#define SPITZ_GPIO_SYNC (16)
29#define SPITZ_GPIO_MAX1111_CS (20)
30#define SPITZ_GPIO_FATAL_BAT (21)
31#define SPITZ_GPIO_HSYNC (22)
32#define SPITZ_GPIO_nSD_CLK (32)
33#define SPITZ_GPIO_USB_DEVICE (35)
34#define SPITZ_GPIO_USB_HOST (37)
35#define SPITZ_GPIO_USB_CONNECT (41)
36#define SPITZ_GPIO_LCDCON_CS (53)
37#define SPITZ_GPIO_nPCE (54)
38#define SPITZ_GPIO_nSD_WP (81)
39#define SPITZ_GPIO_ON_RESET (89)
40#define SPITZ_GPIO_BAT_COVER (90)
41#define SPITZ_GPIO_CF_CD (94)
42#define SPITZ_GPIO_ON_KEY (95)
43#define SPITZ_GPIO_SWA (97)
44#define SPITZ_GPIO_SWB (96)
45#define SPITZ_GPIO_CHRG_FULL (101)
46#define SPITZ_GPIO_CO (101)
47#define SPITZ_GPIO_CF_IRQ (105)
48#define SPITZ_GPIO_AC_IN (115)
49#define SPITZ_GPIO_HP_IN (116)
50
51/* Spitz Only GPIOs */
52
53#define SPITZ_GPIO_CF2_IRQ (106) /* CF slot1 Ready */
54#define SPITZ_GPIO_CF2_CD (93)
55
56
57/* Spitz/Akita Keyboard Definitions */
58
59#define SPITZ_KEY_STROBE_NUM (11)
60#define SPITZ_KEY_SENSE_NUM (7)
61#define SPITZ_GPIO_G0_STROBE_BIT 0x0f800000
62#define SPITZ_GPIO_G1_STROBE_BIT 0x00100000
63#define SPITZ_GPIO_G2_STROBE_BIT 0x01000000
64#define SPITZ_GPIO_G3_STROBE_BIT 0x00041880
65#define SPITZ_GPIO_G0_SENSE_BIT 0x00021000
66#define SPITZ_GPIO_G1_SENSE_BIT 0x000000d4
67#define SPITZ_GPIO_G2_SENSE_BIT 0x08000000
68#define SPITZ_GPIO_G3_SENSE_BIT 0x00000000
69
70#define SPITZ_GPIO_KEY_STROBE0 88
71#define SPITZ_GPIO_KEY_STROBE1 23
72#define SPITZ_GPIO_KEY_STROBE2 24
73#define SPITZ_GPIO_KEY_STROBE3 25
74#define SPITZ_GPIO_KEY_STROBE4 26
75#define SPITZ_GPIO_KEY_STROBE5 27
76#define SPITZ_GPIO_KEY_STROBE6 52
77#define SPITZ_GPIO_KEY_STROBE7 103
78#define SPITZ_GPIO_KEY_STROBE8 107
79#define SPITZ_GPIO_KEY_STROBE9 108
80#define SPITZ_GPIO_KEY_STROBE10 114
81
82#define SPITZ_GPIO_KEY_SENSE0 12
83#define SPITZ_GPIO_KEY_SENSE1 17
84#define SPITZ_GPIO_KEY_SENSE2 91
85#define SPITZ_GPIO_KEY_SENSE3 34
86#define SPITZ_GPIO_KEY_SENSE4 36
87#define SPITZ_GPIO_KEY_SENSE5 38
88#define SPITZ_GPIO_KEY_SENSE6 39
89
90
91/* Spitz Scoop Device (No. 1) GPIOs */
92/* Suspend States in comments */
93#define SPITZ_SCP_LED_GREEN SCOOP_GPCR_PA11 /* Keep */
94#define SPITZ_SCP_JK_B SCOOP_GPCR_PA12 /* Keep */
95#define SPITZ_SCP_CHRG_ON SCOOP_GPCR_PA13 /* Keep */
96#define SPITZ_SCP_MUTE_L SCOOP_GPCR_PA14 /* Low */
97#define SPITZ_SCP_MUTE_R SCOOP_GPCR_PA15 /* Low */
98#define SPITZ_SCP_CF_POWER SCOOP_GPCR_PA16 /* Keep */
99#define SPITZ_SCP_LED_ORANGE SCOOP_GPCR_PA17 /* Keep */
100#define SPITZ_SCP_JK_A SCOOP_GPCR_PA18 /* Low */
101#define SPITZ_SCP_ADC_TEMP_ON SCOOP_GPCR_PA19 /* Low */
102
103#define SPITZ_SCP_IO_DIR (SPITZ_SCP_LED_GREEN | SPITZ_SCP_JK_B | SPITZ_SCP_CHRG_ON | \
104 SPITZ_SCP_MUTE_L | SPITZ_SCP_MUTE_R | SPITZ_SCP_LED_ORANGE | \
105 SPITZ_SCP_CF_POWER | SPITZ_SCP_JK_A | SPITZ_SCP_ADC_TEMP_ON)
106#define SPITZ_SCP_IO_OUT (SPITZ_SCP_CHRG_ON | SPITZ_SCP_MUTE_L | SPITZ_SCP_MUTE_R)
107#define SPITZ_SCP_SUS_CLR (SPITZ_SCP_MUTE_L | SPITZ_SCP_MUTE_R | SPITZ_SCP_JK_A | SPITZ_SCP_ADC_TEMP_ON)
108#define SPITZ_SCP_SUS_SET 0
109
110/* Spitz Scoop Device (No. 2) GPIOs */
111/* Suspend States in comments */
112#define SPITZ_SCP2_IR_ON SCOOP_GPCR_PA11 /* High */
113#define SPITZ_SCP2_AKIN_PULLUP SCOOP_GPCR_PA12 /* Keep */
114#define SPITZ_SCP2_RESERVED_1 SCOOP_GPCR_PA13 /* High */
115#define SPITZ_SCP2_RESERVED_2 SCOOP_GPCR_PA14 /* Low */
116#define SPITZ_SCP2_RESERVED_3 SCOOP_GPCR_PA15 /* Low */
117#define SPITZ_SCP2_RESERVED_4 SCOOP_GPCR_PA16 /* Low */
118#define SPITZ_SCP2_BACKLIGHT_CONT SCOOP_GPCR_PA17 /* Low */
119#define SPITZ_SCP2_BACKLIGHT_ON SCOOP_GPCR_PA18 /* Low */
120#define SPITZ_SCP2_MIC_BIAS SCOOP_GPCR_PA19 /* Low */
121
122#define SPITZ_SCP2_IO_DIR (SPITZ_SCP2_IR_ON | SPITZ_SCP2_AKIN_PULLUP | SPITZ_SCP2_RESERVED_1 | \
123 SPITZ_SCP2_RESERVED_2 | SPITZ_SCP2_RESERVED_3 | SPITZ_SCP2_RESERVED_4 | \
124 SPITZ_SCP2_BACKLIGHT_CONT | SPITZ_SCP2_BACKLIGHT_ON | SPITZ_SCP2_MIC_BIAS)
125
126#define SPITZ_SCP2_IO_OUT (SPITZ_SCP2_IR_ON | SPITZ_SCP2_AKIN_PULLUP | SPITZ_SCP2_RESERVED_1)
127#define SPITZ_SCP2_SUS_CLR (SPITZ_SCP2_RESERVED_2 | SPITZ_SCP2_RESERVED_3 | SPITZ_SCP2_RESERVED_4 | \
128 SPITZ_SCP2_BACKLIGHT_CONT | SPITZ_SCP2_BACKLIGHT_ON | SPITZ_SCP2_MIC_BIAS)
129#define SPITZ_SCP2_SUS_SET (SPITZ_SCP2_IR_ON | SPITZ_SCP2_RESERVED_1)
130
131
132/* Spitz IRQ Definitions */
133
134#define SPITZ_IRQ_GPIO_KEY_INT IRQ_GPIO(SPITZ_GPIO_KEY_INT)
135#define SPITZ_IRQ_GPIO_AC_IN IRQ_GPIO(SPITZ_GPIO_AC_IN)
136#define SPITZ_IRQ_GPIO_AK_INT IRQ_GPIO(SPITZ_GPIO_AK_INT)
137#define SPITZ_IRQ_GPIO_HP_IN IRQ_GPIO(SPITZ_GPIO_HP_IN)
138#define SPITZ_IRQ_GPIO_TP_INT IRQ_GPIO(SPITZ_GPIO_TP_INT)
139#define SPITZ_IRQ_GPIO_SYNC IRQ_GPIO(SPITZ_GPIO_SYNC)
140#define SPITZ_IRQ_GPIO_ON_KEY IRQ_GPIO(SPITZ_GPIO_ON_KEY)
141#define SPITZ_IRQ_GPIO_SWA IRQ_GPIO(SPITZ_GPIO_SWA)
142#define SPITZ_IRQ_GPIO_SWB IRQ_GPIO(SPITZ_GPIO_SWB)
143#define SPITZ_IRQ_GPIO_BAT_COVER IRQ_GPIO(SPITZ_GPIO_BAT_COVER)
144#define SPITZ_IRQ_GPIO_FATAL_BAT IRQ_GPIO(SPITZ_GPIO_FATAL_BAT)
145#define SPITZ_IRQ_GPIO_CO IRQ_GPIO(SPITZ_GPIO_CO)
146#define SPITZ_IRQ_GPIO_CF_IRQ IRQ_GPIO(SPITZ_GPIO_CF_IRQ)
147#define SPITZ_IRQ_GPIO_CF_CD IRQ_GPIO(SPITZ_GPIO_CF_CD)
148#define SPITZ_IRQ_GPIO_CF2_IRQ IRQ_GPIO(SPITZ_GPIO_CF2_IRQ)
149#define SPITZ_IRQ_GPIO_nSD_INT IRQ_GPIO(SPITZ_GPIO_nSD_INT)
150#define SPITZ_IRQ_GPIO_nSD_DETECT IRQ_GPIO(SPITZ_GPIO_nSD_DETECT)
151
152/*
153 * Shared data structures
154 */
155extern struct platform_device spitzscoop_device;
156extern struct platform_device spitzscoop2_device;
157extern struct platform_device spitzssp_device;
158extern struct sharpsl_charger_machinfo spitz_pm_machinfo;
diff --git a/arch/arm/mach-pxa/include/mach/ssp.h b/arch/arm/mach-pxa/include/mach/ssp.h
new file mode 100644
index 000000000000..a012882c9ee6
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/ssp.h
@@ -0,0 +1,83 @@
1/*
2 * ssp.h
3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This driver supports the following PXA CPU/SSP ports:-
11 *
12 * PXA250 SSP
13 * PXA255 SSP, NSSP
14 * PXA26x SSP, NSSP, ASSP
15 * PXA27x SSP1, SSP2, SSP3
16 * PXA3xx SSP1, SSP2, SSP3, SSP4
17 */
18
19#ifndef __ASM_ARCH_SSP_H
20#define __ASM_ARCH_SSP_H
21
22#include <linux/list.h>
23
24enum pxa_ssp_type {
25 SSP_UNDEFINED = 0,
26 PXA25x_SSP, /* pxa 210, 250, 255, 26x */
27 PXA25x_NSSP, /* pxa 255, 26x (including ASSP) */
28 PXA27x_SSP,
29};
30
31struct ssp_device {
32 struct platform_device *pdev;
33 struct list_head node;
34
35 struct clk *clk;
36 void __iomem *mmio_base;
37 unsigned long phys_base;
38
39 const char *label;
40 int port_id;
41 int type;
42 int use_count;
43 int irq;
44 int drcmr_rx;
45 int drcmr_tx;
46};
47
48/*
49 * SSP initialisation flags
50 */
51#define SSP_NO_IRQ 0x1 /* don't register an irq handler in SSP driver */
52
53struct ssp_state {
54 u32 cr0;
55 u32 cr1;
56 u32 to;
57 u32 psp;
58};
59
60struct ssp_dev {
61 struct ssp_device *ssp;
62 u32 port;
63 u32 mode;
64 u32 flags;
65 u32 psp_flags;
66 u32 speed;
67 int irq;
68};
69
70int ssp_write_word(struct ssp_dev *dev, u32 data);
71int ssp_read_word(struct ssp_dev *dev, u32 *data);
72int ssp_flush(struct ssp_dev *dev);
73void ssp_enable(struct ssp_dev *dev);
74void ssp_disable(struct ssp_dev *dev);
75void ssp_save_state(struct ssp_dev *dev, struct ssp_state *ssp);
76void ssp_restore_state(struct ssp_dev *dev, struct ssp_state *ssp);
77int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags);
78int ssp_config(struct ssp_dev *dev, u32 mode, u32 flags, u32 psp_flags, u32 speed);
79void ssp_exit(struct ssp_dev *dev);
80
81struct ssp_device *ssp_request(int port, const char *label);
82void ssp_free(struct ssp_device *);
83#endif /* __ASM_ARCH_SSP_H */
diff --git a/arch/arm/mach-pxa/include/mach/system.h b/arch/arm/mach-pxa/include/mach/system.h
new file mode 100644
index 000000000000..0f381e692999
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/system.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-pxa/include/mach/system.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <asm/proc-fns.h>
14#include "hardware.h"
15#include "pxa2xx-regs.h"
16#include "pxa-regs.h"
17
18static inline void arch_idle(void)
19{
20 cpu_do_idle();
21}
22
23
24void arch_reset(char mode);
diff --git a/arch/arm/mach-pxa/include/mach/timex.h b/arch/arm/mach-pxa/include/mach/timex.h
new file mode 100644
index 000000000000..b05fc6683c47
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/timex.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-pxa/include/mach/timex.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13
14#if defined(CONFIG_PXA25x)
15/* PXA250/210 timer base */
16#define CLOCK_TICK_RATE 3686400
17#elif defined(CONFIG_PXA27x)
18/* PXA27x timer base */
19#ifdef CONFIG_MACH_MAINSTONE
20#define CLOCK_TICK_RATE 3249600
21#else
22#define CLOCK_TICK_RATE 3250000
23#endif
24#else
25#define CLOCK_TICK_RATE 3250000
26#endif
diff --git a/arch/arm/mach-pxa/include/mach/tosa.h b/arch/arm/mach-pxa/include/mach/tosa.h
new file mode 100644
index 000000000000..a72803f0461b
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/tosa.h
@@ -0,0 +1,198 @@
1/*
2 * Hardware specific definitions for Sharp SL-C6000x series of PDAs
3 *
4 * Copyright (c) 2005 Dirk Opfer
5 *
6 * Based on Sharp's 2.4 kernel patches
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13#ifndef _ASM_ARCH_TOSA_H_
14#define _ASM_ARCH_TOSA_H_ 1
15
16/* TOSA Chip selects */
17#define TOSA_LCDC_PHYS PXA_CS4_PHYS
18/* Internel Scoop */
19#define TOSA_CF_PHYS (PXA_CS2_PHYS + 0x00800000)
20/* Jacket Scoop */
21#define TOSA_SCOOP_PHYS (PXA_CS5_PHYS + 0x00800000)
22
23/*
24 * SCOOP2 internal GPIOs
25 */
26#define TOSA_SCOOP_GPIO_BASE NR_BUILTIN_GPIO
27#define TOSA_SCOOP_PXA_VCORE1 SCOOP_GPCR_PA11
28#define TOSA_GPIO_TC6393XB_REST_IN (TOSA_SCOOP_GPIO_BASE + 1)
29#define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2)
30#define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3)
31#define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4)
32#define TOSA_SCOOP_AUD_PWR_ON SCOOP_GPCR_PA16
33#define TOSA_GPIO_BT_RESET (TOSA_SCOOP_GPIO_BASE + 6)
34#define TOSA_GPIO_BT_PWR_EN (TOSA_SCOOP_GPIO_BASE + 7)
35#define TOSA_SCOOP_AC_IN_OL SCOOP_GPCR_PA19
36
37/* GPIO Direction 1 : output mode / 0:input mode */
38#define TOSA_SCOOP_IO_DIR (TOSA_SCOOP_PXA_VCORE1 | \
39 TOSA_SCOOP_AUD_PWR_ON)
40
41/*
42 * SCOOP2 jacket GPIOs
43 */
44#define TOSA_SCOOP_JC_GPIO_BASE (NR_BUILTIN_GPIO + 12)
45#define TOSA_GPIO_BT_LED (TOSA_SCOOP_JC_GPIO_BASE + 0)
46#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1)
47#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2)
48#define TOSA_GPIO_USB_PULLUP (TOSA_SCOOP_JC_GPIO_BASE + 3)
49#define TOSA_GPIO_TC6393XB_SUSPEND (TOSA_SCOOP_JC_GPIO_BASE + 4)
50#define TOSA_GPIO_TC6393XB_L3V_ON (TOSA_SCOOP_JC_GPIO_BASE + 5)
51#define TOSA_SCOOP_JC_WLAN_DETECT SCOOP_GPCR_PA17
52#define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7)
53#define TOSA_SCOOP_JC_CARD_LIMIT_SEL SCOOP_GPCR_PA19
54
55/* GPIO Direction 1 : output mode / 0:input mode */
56#define TOSA_SCOOP_JC_IO_DIR (TOSA_SCOOP_JC_CARD_LIMIT_SEL)
57
58/*
59 * TC6393XB GPIOs
60 */
61#define TOSA_TC6393XB_GPIO_BASE (NR_BUILTIN_GPIO + 2 * 12)
62#define TOSA_TC6393XB_GPIO(i) (TOSA_TC6393XB_GPIO_BASE + (i))
63#define TOSA_TC6393XB_GPIO_BIT(gpio) (1 << (gpio - TOSA_TC6393XB_GPIO_BASE))
64
65#define TOSA_GPIO_TG_ON (TOSA_TC6393XB_GPIO_BASE + 0)
66#define TOSA_GPIO_L_MUTE (TOSA_TC6393XB_GPIO_BASE + 1)
67#define TOSA_GPIO_BL_C20MA (TOSA_TC6393XB_GPIO_BASE + 3)
68#define TOSA_GPIO_CARD_VCC_ON (TOSA_TC6393XB_GPIO_BASE + 4)
69#define TOSA_GPIO_CHARGE_OFF (TOSA_TC6393XB_GPIO_BASE + 6)
70#define TOSA_GPIO_CHARGE_OFF_JC (TOSA_TC6393XB_GPIO_BASE + 7)
71#define TOSA_GPIO_BAT0_V_ON (TOSA_TC6393XB_GPIO_BASE + 9)
72#define TOSA_GPIO_BAT1_V_ON (TOSA_TC6393XB_GPIO_BASE + 10)
73#define TOSA_GPIO_BU_CHRG_ON (TOSA_TC6393XB_GPIO_BASE + 11)
74#define TOSA_GPIO_BAT_SW_ON (TOSA_TC6393XB_GPIO_BASE + 12)
75#define TOSA_GPIO_BAT0_TH_ON (TOSA_TC6393XB_GPIO_BASE + 14)
76#define TOSA_GPIO_BAT1_TH_ON (TOSA_TC6393XB_GPIO_BASE + 15)
77
78/*
79 * Timing Generator
80 */
81#define TG_PNLCTL 0x00
82#define TG_TPOSCTL 0x01
83#define TG_DUTYCTL 0x02
84#define TG_GPOSR 0x03
85#define TG_GPODR1 0x04
86#define TG_GPODR2 0x05
87#define TG_PINICTL 0x06
88#define TG_HPOSCTL 0x07
89
90/*
91 * PXA GPIOs
92 */
93#define TOSA_GPIO_POWERON (0)
94#define TOSA_GPIO_RESET (1)
95#define TOSA_GPIO_AC_IN (2)
96#define TOSA_GPIO_RECORD_BTN (3)
97#define TOSA_GPIO_SYNC (4) /* Cradle SYNC Button */
98#define TOSA_GPIO_USB_IN (5)
99#define TOSA_GPIO_JACKET_DETECT (7)
100#define TOSA_GPIO_nSD_DETECT (9)
101#define TOSA_GPIO_nSD_INT (10)
102#define TOSA_GPIO_TC6393XB_CLK (11)
103#define TOSA_GPIO_BAT1_CRG (12)
104#define TOSA_GPIO_CF_CD (13)
105#define TOSA_GPIO_BAT0_CRG (14)
106#define TOSA_GPIO_TC6393XB_INT (15)
107#define TOSA_GPIO_BAT0_LOW (17)
108#define TOSA_GPIO_TC6393XB_RDY (18)
109#define TOSA_GPIO_ON_RESET (19)
110#define TOSA_GPIO_EAR_IN (20)
111#define TOSA_GPIO_CF_IRQ (21) /* CF slot0 Ready */
112#define TOSA_GPIO_ON_KEY (22)
113#define TOSA_GPIO_VGA_LINE (27)
114#define TOSA_GPIO_TP_INT (32) /* Touch Panel pen down interrupt */
115#define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */
116#define TOSA_GPIO_BAT_LOCKED (38) /* Battery locked */
117#define TOSA_GPIO_IRDA_TX (47)
118#define TOSA_GPIO_TG_SPI_SCLK (81)
119#define TOSA_GPIO_TG_SPI_CS (82)
120#define TOSA_GPIO_TG_SPI_MOSI (83)
121#define TOSA_GPIO_BAT1_LOW (84)
122
123#define TOSA_GPIO_HP_IN GPIO_EAR_IN
124
125#define TOSA_GPIO_MAIN_BAT_LOW GPIO_BAT0_LOW
126
127#define TOSA_KEY_STROBE_NUM (11)
128#define TOSA_KEY_SENSE_NUM (7)
129
130#define TOSA_GPIO_HIGH_STROBE_BIT (0xfc000000)
131#define TOSA_GPIO_LOW_STROBE_BIT (0x0000001f)
132#define TOSA_GPIO_ALL_SENSE_BIT (0x00000fe0)
133#define TOSA_GPIO_ALL_SENSE_RSHIFT (5)
134#define TOSA_GPIO_STROBE_BIT(a) GPIO_bit(58+(a))
135#define TOSA_GPIO_SENSE_BIT(a) GPIO_bit(69+(a))
136#define TOSA_GAFR_HIGH_STROBE_BIT (0xfff00000)
137#define TOSA_GAFR_LOW_STROBE_BIT (0x000003ff)
138#define TOSA_GAFR_ALL_SENSE_BIT (0x00fffc00)
139#define TOSA_GPIO_KEY_SENSE(a) (69+(a))
140#define TOSA_GPIO_KEY_STROBE(a) (58+(a))
141
142/*
143 * Interrupts
144 */
145#define TOSA_IRQ_GPIO_WAKEUP IRQ_GPIO(TOSA_GPIO_WAKEUP)
146#define TOSA_IRQ_GPIO_AC_IN IRQ_GPIO(TOSA_GPIO_AC_IN)
147#define TOSA_IRQ_GPIO_RECORD_BTN IRQ_GPIO(TOSA_GPIO_RECORD_BTN)
148#define TOSA_IRQ_GPIO_SYNC IRQ_GPIO(TOSA_GPIO_SYNC)
149#define TOSA_IRQ_GPIO_USB_IN IRQ_GPIO(TOSA_GPIO_USB_IN)
150#define TOSA_IRQ_GPIO_JACKET_DETECT IRQ_GPIO(TOSA_GPIO_JACKET_DETECT)
151#define TOSA_IRQ_GPIO_nSD_INT IRQ_GPIO(TOSA_GPIO_nSD_INT)
152#define TOSA_IRQ_GPIO_nSD_DETECT IRQ_GPIO(TOSA_GPIO_nSD_DETECT)
153#define TOSA_IRQ_GPIO_BAT1_CRG IRQ_GPIO(TOSA_GPIO_BAT1_CRG)
154#define TOSA_IRQ_GPIO_CF_CD IRQ_GPIO(TOSA_GPIO_CF_CD)
155#define TOSA_IRQ_GPIO_BAT0_CRG IRQ_GPIO(TOSA_GPIO_BAT0_CRG)
156#define TOSA_IRQ_GPIO_TC6393XB_INT IRQ_GPIO(TOSA_GPIO_TC6393XB_INT)
157#define TOSA_IRQ_GPIO_BAT0_LOW IRQ_GPIO(TOSA_GPIO_BAT0_LOW)
158#define TOSA_IRQ_GPIO_EAR_IN IRQ_GPIO(TOSA_GPIO_EAR_IN)
159#define TOSA_IRQ_GPIO_CF_IRQ IRQ_GPIO(TOSA_GPIO_CF_IRQ)
160#define TOSA_IRQ_GPIO_ON_KEY IRQ_GPIO(TOSA_GPIO_ON_KEY)
161#define TOSA_IRQ_GPIO_VGA_LINE IRQ_GPIO(TOSA_GPIO_VGA_LINE)
162#define TOSA_IRQ_GPIO_TP_INT IRQ_GPIO(TOSA_GPIO_TP_INT)
163#define TOSA_IRQ_GPIO_JC_CF_IRQ IRQ_GPIO(TOSA_GPIO_JC_CF_IRQ)
164#define TOSA_IRQ_GPIO_BAT_LOCKED IRQ_GPIO(TOSA_GPIO_BAT_LOCKED)
165#define TOSA_IRQ_GPIO_BAT1_LOW IRQ_GPIO(TOSA_GPIO_BAT1_LOW)
166#define TOSA_IRQ_GPIO_KEY_SENSE(a) IRQ_GPIO(69+(a))
167
168#define TOSA_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(TOSA_GPIO_MAIN_BAT_LOW)
169
170#define TOSA_KEY_SYNC KEY_102ND /* ??? */
171
172#ifndef CONFIG_KEYBOARD_TOSA_USE_EXT_KEYCODES
173#define TOSA_KEY_RECORD KEY_YEN
174#define TOSA_KEY_ADDRESSBOOK KEY_KATAKANA
175#define TOSA_KEY_CANCEL KEY_ESC
176#define TOSA_KEY_CENTER KEY_HIRAGANA
177#define TOSA_KEY_OK KEY_HENKAN
178#define TOSA_KEY_CALENDAR KEY_KATAKANAHIRAGANA
179#define TOSA_KEY_HOMEPAGE KEY_HANGEUL
180#define TOSA_KEY_LIGHT KEY_MUHENKAN
181#define TOSA_KEY_MENU KEY_HANJA
182#define TOSA_KEY_FN KEY_RIGHTALT
183#define TOSA_KEY_MAIL KEY_ZENKAKUHANKAKU
184#else
185#define TOSA_KEY_RECORD KEY_RECORD
186#define TOSA_KEY_ADDRESSBOOK KEY_ADDRESSBOOK
187#define TOSA_KEY_CANCEL KEY_CANCEL
188#define TOSA_KEY_CENTER KEY_SELECT /* ??? */
189#define TOSA_KEY_OK KEY_OK
190#define TOSA_KEY_CALENDAR KEY_CALENDAR
191#define TOSA_KEY_HOMEPAGE KEY_HOMEPAGE
192#define TOSA_KEY_LIGHT KEY_KBDILLUMTOGGLE
193#define TOSA_KEY_MENU KEY_MENU
194#define TOSA_KEY_FN KEY_FN
195#define TOSA_KEY_MAIL KEY_MAIL
196#endif
197
198#endif /* _ASM_ARCH_TOSA_H_ */
diff --git a/arch/arm/mach-pxa/include/mach/tosa_bt.h b/arch/arm/mach-pxa/include/mach/tosa_bt.h
new file mode 100644
index 000000000000..efc3c3d3b75d
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/tosa_bt.h
@@ -0,0 +1,22 @@
1/*
2 * Tosa bluetooth built-in chip control.
3 *
4 * Later it may be shared with some other platforms.
5 *
6 * Copyright (c) 2008 Dmitry Baryshkov
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13#ifndef TOSA_BT_H
14#define TOSA_BT_H
15
16struct tosa_bt_data {
17 int gpio_pwr;
18 int gpio_reset;
19};
20
21#endif
22
diff --git a/arch/arm/mach-pxa/include/mach/trizeps4.h b/arch/arm/mach-pxa/include/mach/trizeps4.h
new file mode 100644
index 000000000000..641d0ec110bb
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/trizeps4.h
@@ -0,0 +1,106 @@
1/************************************************************************
2 * Include file for TRIZEPS4 SoM and ConXS eval-board
3 * Copyright (c) Jürgen Schindele
4 * 2006
5 ************************************************************************/
6
7/*
8 * Includes/Defines
9 */
10#ifndef _TRIPEPS4_H_
11#define _TRIPEPS4_H_
12
13/* physical memory regions */
14#define TRIZEPS4_FLASH_PHYS (PXA_CS0_PHYS) /* Flash region */
15#define TRIZEPS4_DISK_PHYS (PXA_CS1_PHYS) /* Disk On Chip region */
16#define TRIZEPS4_ETH_PHYS (PXA_CS2_PHYS) /* Ethernet DM9000 region */
17#define TRIZEPS4_PIC_PHYS (PXA_CS3_PHYS) /* Logic chip on ConXS-Board */
18#define TRIZEPS4_SDRAM_BASE 0xa0000000 /* SDRAM region */
19
20#define TRIZEPS4_CFSR_PHYS (PXA_CS3_PHYS) /* Logic chip on ConXS-Board CSFR register */
21#define TRIZEPS4_BOCR_PHYS (PXA_CS3_PHYS+0x02000000) /* Logic chip on ConXS-Board BOCR register */
22#define TRIZEPS4_IRCR_PHYS (PXA_CS3_PHYS+0x02400000) /* Logic chip on ConXS-Board IRCR register*/
23#define TRIZEPS4_UPSR_PHYS (PXA_CS3_PHYS+0x02800000) /* Logic chip on ConXS-Board UPSR register*/
24#define TRIZEPS4_DICR_PHYS (PXA_CS3_PHYS+0x03800000) /* Logic chip on ConXS-Board DICR register*/
25
26/* virtual memory regions */
27#define TRIZEPS4_DISK_VIRT 0xF0000000 /* Disk On Chip region */
28
29#define TRIZEPS4_PIC_VIRT 0xF0100000 /* not used */
30#define TRIZEPS4_CFSR_VIRT 0xF0100000
31#define TRIZEPS4_BOCR_VIRT 0xF0200000
32#define TRIZEPS4_DICR_VIRT 0xF0300000
33#define TRIZEPS4_IRCR_VIRT 0xF0400000
34#define TRIZEPS4_UPSR_VIRT 0xF0500000
35
36/* size of flash */
37#define TRIZEPS4_FLASH_SIZE 0x02000000 /* Flash size 32 MB */
38
39/* Ethernet Controller Davicom DM9000 */
40#define GPIO_DM9000 101
41#define TRIZEPS4_ETH_IRQ IRQ_GPIO(GPIO_DM9000)
42
43/* UCB1400 audio / TS-controller */
44#define GPIO_UCB1400 1
45#define TRIZEPS4_UCB1400_IRQ IRQ_GPIO(GPIO_UCB1400)
46
47/* PCMCIA socket Compact Flash */
48#define GPIO_PCD 11 /* PCMCIA Card Detect */
49#define TRIZEPS4_CD_IRQ IRQ_GPIO(GPIO_PCD)
50#define GPIO_PRDY 13 /* READY / nINT */
51#define TRIZEPS4_READY_NINT IRQ_GPIO(GPIO_PRDY)
52
53/* MMC socket */
54#define GPIO_MMC_DET 12
55#define TRIZEPS4_MMC_IRQ IRQ_GPIO(GPIO_MMC_DET)
56
57/* LEDS using tx2 / rx2 */
58#define GPIO_SYS_BUSY_LED 46
59#define GPIO_HEARTBEAT_LED 47
60
61/* Off-module PIC on ConXS board */
62#define GPIO_PIC 0
63#define TRIZEPS4_PIC_IRQ IRQ_GPIO(GPIO_PIC)
64
65#define CFSR_P2V(x) ((x) - TRIZEPS4_CFSR_PHYS + TRIZEPS4_CFSR_VIRT)
66#define CFSR_V2P(x) ((x) - TRIZEPS4_CFSR_VIRT + TRIZEPS4_CFSR_PHYS)
67
68#define BCR_P2V(x) ((x) - TRIZEPS4_BOCR_PHYS + TRIZEPS4_BOCR_VIRT)
69#define BCR_V2P(x) ((x) - TRIZEPS4_BOCR_VIRT + TRIZEPS4_BOCR_PHYS)
70
71#define DCR_P2V(x) ((x) - TRIZEPS4_DICR_PHYS + TRIZEPS4_DICR_VIRT)
72#define DCR_V2P(x) ((x) - TRIZEPS4_DICR_VIRT + TRIZEPS4_DICR_PHYS)
73
74#ifndef __ASSEMBLY__
75#define ConXS_CFSR (*((volatile unsigned short *)CFSR_P2V(0x0C000000)))
76#define ConXS_BCR (*((volatile unsigned short *)BCR_P2V(0x0E000000)))
77#define ConXS_DCR (*((volatile unsigned short *)DCR_P2V(0x0F800000)))
78#else
79#define ConXS_CFSR CFSR_P2V(0x0C000000)
80#define ConXS_BCR BCR_P2V(0x0E000000)
81#define ConXS_DCR DCR_P2V(0x0F800000)
82#endif
83
84#define ConXS_CFSR_BVD_MASK 0x0003
85#define ConXS_CFSR_BVD1 (1 << 0)
86#define ConXS_CFSR_BVD2 (1 << 1)
87#define ConXS_CFSR_VS_MASK 0x000C
88#define ConXS_CFSR_VS1 (1 << 2)
89#define ConXS_CFSR_VS2 (1 << 3)
90#define ConXS_CFSR_VS_5V (0x3 << 2)
91#define ConXS_CFSR_VS_3V3 0x0
92
93#define ConXS_BCR_S0_POW_EN0 (1 << 0)
94#define ConXS_BCR_S0_POW_EN1 (1 << 1)
95#define ConXS_BCR_L_DISP (1 << 4)
96#define ConXS_BCR_CF_BUF_EN (1 << 5)
97#define ConXS_BCR_CF_RESET (1 << 7)
98#define ConXS_BCR_S0_VCC_3V3 0x1
99#define ConXS_BCR_S0_VCC_5V0 0x2
100#define ConXS_BCR_S0_VPP_12V 0x4
101#define ConXS_BCR_S0_VPP_3V3 0x8
102
103#define ConXS_IRCR_MODE (1 << 0)
104#define ConXS_IRCR_SD (1 << 1)
105
106#endif /* _TRIPEPS4_H_ */
diff --git a/arch/arm/mach-pxa/include/mach/udc.h b/arch/arm/mach-pxa/include/mach/udc.h
new file mode 100644
index 000000000000..2f82332e81a0
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/udc.h
@@ -0,0 +1,8 @@
1/*
2 * arch/arm/mach-pxa/include/mach/udc.h
3 *
4 */
5#include <asm/mach/udc_pxa2xx.h>
6
7extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
8
diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
new file mode 100644
index 000000000000..21e3e890af98
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/uncompress.h
@@ -0,0 +1,45 @@
1/*
2 * arch/arm/mach-pxa/include/mach/uncompress.h
3 *
4 * Author: Nicolas Pitre
5 * Copyright: (C) 2001 MontaVista Software Inc.
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#include <linux/serial_reg.h>
13#include <mach/pxa-regs.h>
14#include <asm/mach-types.h>
15
16#define __REG(x) ((volatile unsigned long *)x)
17
18static volatile unsigned long *UART = FFUART;
19
20static inline void putc(char c)
21{
22 if (!(UART[UART_IER] & IER_UUE))
23 return;
24 while (!(UART[UART_LSR] & LSR_TDRQ))
25 barrier();
26 UART[UART_TX] = c;
27}
28
29/*
30 * This does not append a newline
31 */
32static inline void flush(void)
33{
34}
35
36static inline void arch_decomp_setup(void)
37{
38 if (machine_is_littleton())
39 UART = STUART;
40}
41
42/*
43 * nothing to do
44 */
45#define arch_decomp_wdog()
diff --git a/arch/arm/mach-pxa/include/mach/vmalloc.h b/arch/arm/mach-pxa/include/mach/vmalloc.h
new file mode 100644
index 000000000000..e90c5eeb81dd
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/vmalloc.h
@@ -0,0 +1,11 @@
1/*
2 * arch/arm/mach-pxa/include/mach/vmalloc.h
3 *
4 * Author: Nicolas Pitre
5 * Copyright: (C) 2001 MontaVista Software Inc.
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#define VMALLOC_END (0xe8000000)
diff --git a/arch/arm/mach-pxa/include/mach/zylonite.h b/arch/arm/mach-pxa/include/mach/zylonite.h
new file mode 100644
index 000000000000..0d35ca04731e
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/zylonite.h
@@ -0,0 +1,47 @@
1#ifndef __ASM_ARCH_ZYLONITE_H
2#define __ASM_ARCH_ZYLONITE_H
3
4#define ZYLONITE_ETH_PHYS 0x14000000
5
6#define EXT_GPIO(x) (128 + (x))
7
8/* the following variables are processor specific and initialized
9 * by the corresponding zylonite_pxa3xx_init()
10 */
11struct platform_mmc_slot {
12 int gpio_cd;
13 int gpio_wp;
14};
15
16extern struct platform_mmc_slot zylonite_mmc_slot[];
17
18extern int gpio_eth_irq;
19extern int gpio_debug_led1;
20extern int gpio_debug_led2;
21
22extern int wm9713_irq;
23
24extern int lcd_id;
25extern int lcd_orientation;
26
27#ifdef CONFIG_CPU_PXA300
28extern void zylonite_pxa300_init(void);
29#else
30static inline void zylonite_pxa300_init(void)
31{
32 if (cpu_is_pxa300() || cpu_is_pxa310())
33 panic("%s: PXA300/PXA310 not supported\n", __FUNCTION__);
34}
35#endif
36
37#ifdef CONFIG_CPU_PXA320
38extern void zylonite_pxa320_init(void);
39#else
40static inline void zylonite_pxa320_init(void)
41{
42 if (cpu_is_pxa320())
43 panic("%s: PXA320 not supported\n", __FUNCTION__);
44}
45#endif
46
47#endif /* __ASM_ARCH_ZYLONITE_H */
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index fbff557bb225..5e95c5372fec 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -17,10 +17,10 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/sysdev.h> 18#include <linux/sysdev.h>
19 19
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/mach/irq.h> 22#include <asm/mach/irq.h>
23#include <asm/arch/pxa-regs.h> 23#include <mach/pxa-regs.h>
24 24
25#include "generic.h" 25#include "generic.h"
26 26
diff --git a/arch/arm/mach-pxa/leds-idp.c b/arch/arm/mach-pxa/leds-idp.c
index 38aa9270540e..18b20d469410 100644
--- a/arch/arm/mach-pxa/leds-idp.c
+++ b/arch/arm/mach-pxa/leds-idp.c
@@ -14,12 +14,12 @@
14 14
15#include <linux/init.h> 15#include <linux/init.h>
16 16
17#include <asm/hardware.h> 17#include <mach/hardware.h>
18#include <asm/leds.h> 18#include <asm/leds.h>
19#include <asm/system.h> 19#include <asm/system.h>
20 20
21#include <asm/arch/pxa-regs.h> 21#include <mach/pxa-regs.h>
22#include <asm/arch/idp.h> 22#include <mach/idp.h>
23 23
24#include "leds.h" 24#include "leds.h"
25 25
diff --git a/arch/arm/mach-pxa/leds-lubbock.c b/arch/arm/mach-pxa/leds-lubbock.c
index afbc6698e27c..1a258029c33c 100644
--- a/arch/arm/mach-pxa/leds-lubbock.c
+++ b/arch/arm/mach-pxa/leds-lubbock.c
@@ -13,11 +13,11 @@
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15 15
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/leds.h> 17#include <asm/leds.h>
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/arch/pxa-regs.h> 19#include <mach/pxa-regs.h>
20#include <asm/arch/lubbock.h> 20#include <mach/lubbock.h>
21 21
22#include "leds.h" 22#include "leds.h"
23 23
diff --git a/arch/arm/mach-pxa/leds-mainstone.c b/arch/arm/mach-pxa/leds-mainstone.c
index 065293eb0d82..95e06b849634 100644
--- a/arch/arm/mach-pxa/leds-mainstone.c
+++ b/arch/arm/mach-pxa/leds-mainstone.c
@@ -12,12 +12,12 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14 14
15#include <asm/hardware.h> 15#include <mach/hardware.h>
16#include <asm/leds.h> 16#include <asm/leds.h>
17#include <asm/system.h> 17#include <asm/system.h>
18 18
19#include <asm/arch/pxa-regs.h> 19#include <mach/pxa-regs.h>
20#include <asm/arch/mainstone.h> 20#include <mach/mainstone.h>
21 21
22#include "leds.h" 22#include "leds.h"
23 23
diff --git a/arch/arm/mach-pxa/leds-trizeps4.c b/arch/arm/mach-pxa/leds-trizeps4.c
index 21880daabafe..3bc29007df3a 100644
--- a/arch/arm/mach-pxa/leds-trizeps4.c
+++ b/arch/arm/mach-pxa/leds-trizeps4.c
@@ -12,14 +12,14 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14 14
15#include <asm/hardware.h> 15#include <mach/hardware.h>
16#include <asm/system.h> 16#include <asm/system.h>
17#include <asm/types.h> 17#include <asm/types.h>
18#include <asm/leds.h> 18#include <asm/leds.h>
19 19
20#include <asm/arch/pxa-regs.h> 20#include <mach/pxa-regs.h>
21#include <asm/arch/pxa2xx-gpio.h> 21#include <mach/pxa2xx-gpio.h>
22#include <asm/arch/trizeps4.h> 22#include <mach/trizeps4.h>
23 23
24#include "leds.h" 24#include "leds.h"
25 25
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index dd759d03a9fd..58f3402a0375 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -26,21 +26,21 @@
26#include <asm/setup.h> 26#include <asm/setup.h>
27#include <asm/memory.h> 27#include <asm/memory.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31 31
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
35 35
36#include <asm/arch/pxa-regs.h> 36#include <mach/pxa-regs.h>
37#include <asm/arch/mfp-pxa300.h> 37#include <mach/mfp-pxa300.h>
38#include <asm/arch/gpio.h> 38#include <mach/gpio.h>
39#include <asm/arch/pxafb.h> 39#include <mach/pxafb.h>
40#include <asm/arch/ssp.h> 40#include <mach/ssp.h>
41#include <asm/arch/pxa27x_keypad.h> 41#include <mach/pxa27x_keypad.h>
42#include <asm/arch/pxa3xx_nand.h> 42#include <mach/pxa3xx_nand.h>
43#include <asm/arch/littleton.h> 43#include <mach/littleton.h>
44 44
45#include "generic.h" 45#include "generic.h"
46 46
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index 8d1ab54e7b20..b7038948d1d4 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -29,7 +29,7 @@
29#include <asm/setup.h> 29#include <asm/setup.h>
30#include <asm/memory.h> 30#include <asm/memory.h>
31#include <asm/mach-types.h> 31#include <asm/mach-types.h>
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/sizes.h> 34#include <asm/sizes.h>
35 35
@@ -38,15 +38,15 @@
38#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
39#include <asm/mach/flash.h> 39#include <asm/mach/flash.h>
40 40
41#include <asm/arch/pxa-regs.h> 41#include <mach/pxa-regs.h>
42#include <asm/arch/pxa2xx-regs.h> 42#include <mach/pxa2xx-regs.h>
43#include <asm/arch/pxa2xx-gpio.h> 43#include <mach/pxa2xx-gpio.h>
44#include <asm/arch/lpd270.h> 44#include <mach/lpd270.h>
45#include <asm/arch/audio.h> 45#include <mach/audio.h>
46#include <asm/arch/pxafb.h> 46#include <mach/pxafb.h>
47#include <asm/arch/mmc.h> 47#include <mach/mmc.h>
48#include <asm/arch/irda.h> 48#include <mach/irda.h>
49#include <asm/arch/ohci.h> 49#include <mach/ohci.h>
50 50
51#include "generic.h" 51#include "generic.h"
52#include "devices.h" 52#include "devices.h"
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index af7375bb46a4..bb9e09208b9f 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -25,12 +25,12 @@
25 25
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/spi/ads7846.h> 27#include <linux/spi/ads7846.h>
28#include <asm/arch/pxa2xx_spi.h> 28#include <mach/pxa2xx_spi.h>
29 29
30#include <asm/setup.h> 30#include <asm/setup.h>
31#include <asm/memory.h> 31#include <asm/memory.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/hardware.h> 33#include <mach/hardware.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/sizes.h> 35#include <asm/sizes.h>
36 36
@@ -41,15 +41,15 @@
41 41
42#include <asm/hardware/sa1111.h> 42#include <asm/hardware/sa1111.h>
43 43
44#include <asm/arch/pxa-regs.h> 44#include <mach/pxa-regs.h>
45#include <asm/arch/pxa2xx-regs.h> 45#include <mach/pxa2xx-regs.h>
46#include <asm/arch/mfp-pxa25x.h> 46#include <mach/mfp-pxa25x.h>
47#include <asm/arch/audio.h> 47#include <mach/audio.h>
48#include <asm/arch/lubbock.h> 48#include <mach/lubbock.h>
49#include <asm/arch/udc.h> 49#include <mach/udc.h>
50#include <asm/arch/irda.h> 50#include <mach/irda.h>
51#include <asm/arch/pxafb.h> 51#include <mach/pxafb.h>
52#include <asm/arch/mmc.h> 52#include <mach/mmc.h>
53 53
54#include "generic.h" 54#include "generic.h"
55#include "devices.h" 55#include "devices.h"
@@ -224,7 +224,7 @@ static struct platform_device sa1111_device = {
224 * for the temperature sensors. 224 * for the temperature sensors.
225 */ 225 */
226static struct pxa2xx_spi_master pxa_ssp_master_info = { 226static struct pxa2xx_spi_master pxa_ssp_master_info = {
227 .num_chipselect = 0, 227 .num_chipselect = 1,
228}; 228};
229 229
230static int lubbock_ads7846_pendown_state(void) 230static int lubbock_ads7846_pendown_state(void)
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index c9d274f0048f..143f28adaf95 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -26,18 +26,18 @@
26#include <linux/pda_power.h> 26#include <linux/pda_power.h>
27#include <linux/pwm_backlight.h> 27#include <linux/pwm_backlight.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/arch/magician.h> 32#include <mach/magician.h>
33#include <asm/arch/mfp-pxa27x.h> 33#include <mach/mfp-pxa27x.h>
34#include <asm/arch/pxa-regs.h> 34#include <mach/pxa-regs.h>
35#include <asm/arch/pxa2xx-regs.h> 35#include <mach/pxa2xx-regs.h>
36#include <asm/arch/pxafb.h> 36#include <mach/pxafb.h>
37#include <asm/arch/i2c.h> 37#include <mach/i2c.h>
38#include <asm/arch/mmc.h> 38#include <mach/mmc.h>
39#include <asm/arch/irda.h> 39#include <mach/irda.h>
40#include <asm/arch/ohci.h> 40#include <mach/ohci.h>
41 41
42#include "devices.h" 42#include "devices.h"
43#include "generic.h" 43#include "generic.h"
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index c8e38b5ff1c4..d44af761564d 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -32,7 +32,7 @@
32#include <asm/setup.h> 32#include <asm/setup.h>
33#include <asm/memory.h> 33#include <asm/memory.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/hardware.h> 35#include <mach/hardware.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/sizes.h> 37#include <asm/sizes.h>
38 38
@@ -41,17 +41,17 @@
41#include <asm/mach/irq.h> 41#include <asm/mach/irq.h>
42#include <asm/mach/flash.h> 42#include <asm/mach/flash.h>
43 43
44#include <asm/arch/pxa-regs.h> 44#include <mach/pxa-regs.h>
45#include <asm/arch/pxa2xx-regs.h> 45#include <mach/pxa2xx-regs.h>
46#include <asm/arch/mfp-pxa27x.h> 46#include <mach/mfp-pxa27x.h>
47#include <asm/arch/mainstone.h> 47#include <mach/mainstone.h>
48#include <asm/arch/audio.h> 48#include <mach/audio.h>
49#include <asm/arch/pxafb.h> 49#include <mach/pxafb.h>
50#include <asm/arch/i2c.h> 50#include <mach/i2c.h>
51#include <asm/arch/mmc.h> 51#include <mach/mmc.h>
52#include <asm/arch/irda.h> 52#include <mach/irda.h>
53#include <asm/arch/ohci.h> 53#include <mach/ohci.h>
54#include <asm/arch/pxa27x_keypad.h> 54#include <mach/pxa27x_keypad.h>
55 55
56#include "generic.h" 56#include "generic.h"
57#include "devices.h" 57#include "devices.h"
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index fd4545eab803..925575f10acf 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -18,10 +18,10 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20 20
21#include <asm/arch/hardware.h> 21#include <mach/hardware.h>
22#include <asm/arch/pxa-regs.h> 22#include <mach/pxa-regs.h>
23#include <asm/arch/pxa2xx-regs.h> 23#include <mach/pxa2xx-regs.h>
24#include <asm/arch/mfp-pxa2xx.h> 24#include <mach/mfp-pxa2xx.h>
25 25
26#include "generic.h" 26#include "generic.h"
27 27
diff --git a/arch/arm/mach-pxa/mfp-pxa3xx.c b/arch/arm/mach-pxa/mfp-pxa3xx.c
index 3a5b0fcbaf1f..eb197a6e8e94 100644
--- a/arch/arm/mach-pxa/mfp-pxa3xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa3xx.c
@@ -19,10 +19,10 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/sysdev.h> 20#include <linux/sysdev.h>
21 21
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/arch/mfp.h> 23#include <mach/mfp.h>
24#include <asm/arch/mfp-pxa3xx.h> 24#include <mach/mfp-pxa3xx.h>
25#include <asm/arch/pxa3xx-regs.h> 25#include <mach/pxa3xx-regs.h>
26 26
27/* mfp_spin_lock is used to ensure that MFP register configuration 27/* mfp_spin_lock is used to ensure that MFP register configuration
28 * (most likely a read-modify-write operation) is atomic, and that 28 * (most likely a read-modify-write operation) is atomic, and that
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index 408657a24f8c..fe924a23debe 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -30,15 +30,15 @@
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32 32
33#include <asm/arch/audio.h> 33#include <mach/audio.h>
34#include <asm/arch/palmtx.h> 34#include <mach/palmtx.h>
35#include <asm/arch/mmc.h> 35#include <mach/mmc.h>
36#include <asm/arch/pxafb.h> 36#include <mach/pxafb.h>
37#include <asm/arch/pxa-regs.h> 37#include <mach/pxa-regs.h>
38#include <asm/arch/mfp-pxa27x.h> 38#include <mach/mfp-pxa27x.h>
39#include <asm/arch/irda.h> 39#include <mach/irda.h>
40#include <asm/arch/pxa27x_keypad.h> 40#include <mach/pxa27x_keypad.h>
41#include <asm/arch/udc.h> 41#include <mach/udc.h>
42 42
43#include "generic.h" 43#include "generic.h"
44#include "devices.h" 44#include "devices.h"
diff --git a/arch/arm/mach-pxa/pcm027.c b/arch/arm/mach-pxa/pcm027.c
index 377f3be8ce57..730b9f6ede1d 100644
--- a/arch/arm/mach-pxa/pcm027.c
+++ b/arch/arm/mach-pxa/pcm027.c
@@ -29,12 +29,12 @@
29 29
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/arch/hardware.h> 32#include <mach/hardware.h>
33#include <asm/arch/pxa-regs.h> 33#include <mach/pxa-regs.h>
34#include <asm/arch/pxa2xx-gpio.h> 34#include <mach/pxa2xx-gpio.h>
35#include <asm/arch/pxa2xx-regs.h> 35#include <mach/pxa2xx-regs.h>
36#include <asm/arch/pxa2xx_spi.h> 36#include <mach/pxa2xx_spi.h>
37#include <asm/arch/pcm027.h> 37#include <mach/pcm027.h>
38#include "generic.h" 38#include "generic.h"
39 39
40/* 40/*
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 30023b00e476..420c9b3813f6 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -22,23 +22,22 @@
22 22
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/ide.h>
26#include <linux/i2c.h> 25#include <linux/i2c.h>
27#include <linux/pwm_backlight.h> 26#include <linux/pwm_backlight.h>
28 27
29#include <media/soc_camera.h> 28#include <media/soc_camera.h>
30 29
31#include <asm/gpio.h> 30#include <asm/gpio.h>
32#include <asm/arch/i2c.h> 31#include <mach/i2c.h>
33#include <asm/arch/camera.h> 32#include <mach/camera.h>
34#include <asm/mach/map.h> 33#include <asm/mach/map.h>
35#include <asm/arch/pxa-regs.h> 34#include <mach/pxa-regs.h>
36#include <asm/arch/audio.h> 35#include <mach/audio.h>
37#include <asm/arch/mmc.h> 36#include <mach/mmc.h>
38#include <asm/arch/ohci.h> 37#include <mach/ohci.h>
39#include <asm/arch/pcm990_baseboard.h> 38#include <mach/pcm990_baseboard.h>
40#include <asm/arch/pxafb.h> 39#include <mach/pxafb.h>
41#include <asm/arch/mfp-pxa27x.h> 40#include <mach/mfp-pxa27x.h>
42 41
43#include "devices.h" 42#include "devices.h"
44#include "generic.h" 43#include "generic.h"
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index 7d4debbdcca3..1b539e675579 100644
--- a/arch/arm/mach-pxa/pm.c
+++ b/arch/arm/mach-pxa/pm.c
@@ -16,12 +16,12 @@
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/time.h> 17#include <linux/time.h>
18 18
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20#include <asm/memory.h> 20#include <asm/memory.h>
21#include <asm/system.h> 21#include <asm/system.h>
22#include <asm/arch/pm.h> 22#include <mach/pm.h>
23#include <asm/arch/pxa-regs.h> 23#include <mach/pxa-regs.h>
24#include <asm/arch/lubbock.h> 24#include <mach/lubbock.h>
25#include <asm/mach/time.h> 25#include <asm/mach/time.h>
26 26
27struct pxa_cpu_pm_fns *pxa_cpu_pm_fns; 27struct pxa_cpu_pm_fns *pxa_cpu_pm_fns;
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 39612cfa0b4d..055ec63d768c 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -21,7 +21,7 @@
21#include <linux/pm.h> 21#include <linux/pm.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23 23
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/setup.h> 27#include <asm/setup.h>
@@ -31,16 +31,16 @@
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33 33
34#include <asm/arch/pxa-regs.h> 34#include <mach/pxa-regs.h>
35#include <asm/arch/pxa2xx-regs.h> 35#include <mach/pxa2xx-regs.h>
36#include <asm/arch/pxa2xx-gpio.h> 36#include <mach/pxa2xx-gpio.h>
37#include <asm/arch/mmc.h> 37#include <mach/mmc.h>
38#include <asm/arch/udc.h> 38#include <mach/udc.h>
39#include <asm/arch/irda.h> 39#include <mach/irda.h>
40#include <asm/arch/poodle.h> 40#include <mach/poodle.h>
41#include <asm/arch/pxafb.h> 41#include <mach/pxafb.h>
42#include <asm/arch/sharpsl.h> 42#include <mach/sharpsl.h>
43#include <asm/arch/ssp.h> 43#include <mach/ssp.h>
44 44
45#include <asm/hardware/scoop.h> 45#include <asm/hardware/scoop.h>
46#include <asm/hardware/locomo.h> 46#include <asm/hardware/locomo.h>
diff --git a/arch/arm/mach-pxa/pwm.c b/arch/arm/mach-pxa/pwm.c
index ce28cd9fed16..316cd986da5c 100644
--- a/arch/arm/mach-pxa/pwm.c
+++ b/arch/arm/mach-pxa/pwm.c
@@ -20,7 +20,7 @@
20#include <linux/pwm.h> 20#include <linux/pwm.h>
21 21
22#include <asm/div64.h> 22#include <asm/div64.h>
23#include <asm/arch/pxa-regs.h> 23#include <mach/pxa-regs.h>
24 24
25/* PWM registers and bits definitions */ 25/* PWM registers and bits definitions */
26#define PWMCR (0x00) 26#define PWMCR (0x00)
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 49a7a296ff31..9e5d8a8c6424 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -23,14 +23,14 @@
23#include <linux/suspend.h> 23#include <linux/suspend.h>
24#include <linux/sysdev.h> 24#include <linux/sysdev.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/arch/irqs.h> 27#include <mach/irqs.h>
28#include <asm/arch/pxa-regs.h> 28#include <mach/pxa-regs.h>
29#include <asm/arch/pxa2xx-regs.h> 29#include <mach/pxa2xx-regs.h>
30#include <asm/arch/mfp-pxa25x.h> 30#include <mach/mfp-pxa25x.h>
31#include <asm/arch/reset.h> 31#include <mach/reset.h>
32#include <asm/arch/pm.h> 32#include <mach/pm.h>
33#include <asm/arch/dma.h> 33#include <mach/dma.h>
34 34
35#include "generic.h" 35#include "generic.h"
36#include "devices.h" 36#include "devices.h"
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index a8c12347a5a9..f9f6a9c31f4b 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -18,17 +18,17 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20 20
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/arch/irqs.h> 23#include <mach/irqs.h>
24#include <asm/arch/pxa-regs.h> 24#include <mach/pxa-regs.h>
25#include <asm/arch/pxa2xx-regs.h> 25#include <mach/pxa2xx-regs.h>
26#include <asm/arch/mfp-pxa27x.h> 26#include <mach/mfp-pxa27x.h>
27#include <asm/arch/reset.h> 27#include <mach/reset.h>
28#include <asm/arch/ohci.h> 28#include <mach/ohci.h>
29#include <asm/arch/pm.h> 29#include <mach/pm.h>
30#include <asm/arch/dma.h> 30#include <mach/dma.h>
31#include <asm/arch/i2c.h> 31#include <mach/i2c.h>
32 32
33#include "generic.h" 33#include "generic.h"
34#include "devices.h" 34#include "devices.h"
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c
index d93d3e6a6e27..73d04d81c75a 100644
--- a/arch/arm/mach-pxa/pxa2xx.c
+++ b/arch/arm/mach-pxa/pxa2xx.c
@@ -14,12 +14,12 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/device.h> 15#include <linux/device.h>
16 16
17#include <asm/hardware.h> 17#include <mach/hardware.h>
18#include <asm/arch/pxa2xx-regs.h> 18#include <mach/pxa2xx-regs.h>
19#include <asm/arch/mfp-pxa2xx.h> 19#include <mach/mfp-pxa2xx.h>
20#include <asm/arch/mfp-pxa25x.h> 20#include <mach/mfp-pxa25x.h>
21#include <asm/arch/reset.h> 21#include <mach/reset.h>
22#include <asm/arch/irda.h> 22#include <mach/irda.h>
23 23
24void pxa2xx_clear_reset_status(unsigned int mask) 24void pxa2xx_clear_reset_status(unsigned int mask)
25{ 25{
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
index da92e9733886..494fc1f032db 100644
--- a/arch/arm/mach-pxa/pxa300.c
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -17,9 +17,9 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/arch/pxa3xx-regs.h> 21#include <mach/pxa3xx-regs.h>
22#include <asm/arch/mfp-pxa300.h> 22#include <mach/mfp-pxa300.h>
23 23
24#include "generic.h" 24#include "generic.h"
25#include "devices.h" 25#include "devices.h"
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index c557c23a1efe..016eb18f01a3 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -17,10 +17,10 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/arch/mfp.h> 21#include <mach/mfp.h>
22#include <asm/arch/pxa3xx-regs.h> 22#include <mach/pxa3xx-regs.h>
23#include <asm/arch/mfp-pxa320.h> 23#include <mach/mfp-pxa320.h>
24 24
25#include "generic.h" 25#include "generic.h"
26#include "devices.h" 26#include "devices.h"
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 3d36c790f5ce..03cbc38103ed 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -22,13 +22,13 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/sysdev.h> 23#include <linux/sysdev.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/arch/pxa3xx-regs.h> 26#include <mach/pxa3xx-regs.h>
27#include <asm/arch/reset.h> 27#include <mach/reset.h>
28#include <asm/arch/ohci.h> 28#include <mach/ohci.h>
29#include <asm/arch/pm.h> 29#include <mach/pm.h>
30#include <asm/arch/dma.h> 30#include <mach/dma.h>
31#include <asm/arch/ssp.h> 31#include <mach/ssp.h>
32 32
33#include "generic.h" 33#include "generic.h"
34#include "devices.h" 34#include "devices.h"
diff --git a/arch/arm/mach-pxa/pxa930.c b/arch/arm/mach-pxa/pxa930.c
index 9503897d049c..13e6bfdfff60 100644
--- a/arch/arm/mach-pxa/pxa930.c
+++ b/arch/arm/mach-pxa/pxa930.c
@@ -16,8 +16,8 @@
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18 18
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20#include <asm/arch/mfp-pxa930.h> 20#include <mach/mfp-pxa930.h>
21 21
22static struct pxa3xx_mfp_addr_map pxa930_mfp_addr_map[] __initdata = { 22static struct pxa3xx_mfp_addr_map pxa930_mfp_addr_map[] __initdata = {
23 23
diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c
index 56f60d923a9d..9996c612c3d6 100644
--- a/arch/arm/mach-pxa/reset.c
+++ b/arch/arm/mach-pxa/reset.c
@@ -10,8 +10,8 @@
10#include <asm/io.h> 10#include <asm/io.h>
11#include <asm/proc-fns.h> 11#include <asm/proc-fns.h>
12 12
13#include <asm/arch/pxa-regs.h> 13#include <mach/pxa-regs.h>
14#include <asm/arch/reset.h> 14#include <mach/reset.h>
15 15
16unsigned int reset_status; 16unsigned int reset_status;
17EXPORT_SYMBOL(reset_status); 17EXPORT_SYMBOL(reset_status);
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
index d02bc6f8bb93..e7ea91ce7f02 100644
--- a/arch/arm/mach-pxa/saar.c
+++ b/arch/arm/mach-pxa/saar.c
@@ -21,9 +21,9 @@
21 21
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/arch/pxa3xx-regs.h> 25#include <mach/pxa3xx-regs.h>
26#include <asm/arch/mfp-pxa930.h> 26#include <mach/mfp-pxa930.h>
27 27
28#include "devices.h" 28#include "devices.h"
29#include "generic.h" 29#include "generic.h"
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 23e9b9283301..e804ae09370c 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -22,12 +22,12 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/apm-emulation.h> 23#include <linux/apm-emulation.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/arch/pm.h> 27#include <mach/pm.h>
28#include <asm/arch/pxa-regs.h> 28#include <mach/pxa-regs.h>
29#include <asm/arch/pxa2xx-gpio.h> 29#include <mach/pxa2xx-gpio.h>
30#include <asm/arch/sharpsl.h> 30#include <mach/sharpsl.h>
31#include "sharpsl.h" 31#include "sharpsl.h"
32 32
33struct battery_thresh spitz_battery_levels_acin[] = { 33struct battery_thresh spitz_battery_levels_acin[] = {
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index 784716eb7fc5..a62c8375eb53 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -13,10 +13,10 @@
13 13
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <asm/assembler.h> 15#include <asm/assembler.h>
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17 17
18#include <asm/arch/pxa-regs.h> 18#include <mach/pxa-regs.h>
19#include <asm/arch/pxa2xx-regs.h> 19#include <mach/pxa2xx-regs.h>
20 20
21#define MDREFR_KDIV 0x200a4000 // all banks 21#define MDREFR_KDIV 0x200a4000 // all banks
22#define CCCR_SLEEP 0x00000107 // L=7 2N=2 A=0 PPDIS=0 CPDIS=0 22#define CCCR_SLEEP 0x00000107 // L=7 2N=2 A=0 PPDIS=0 CPDIS=0
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 207fe3e6a3d2..cd39005c98ff 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -26,7 +26,7 @@
26#include <asm/setup.h> 26#include <asm/setup.h>
27#include <asm/memory.h> 27#include <asm/memory.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/system.h> 32#include <asm/system.h>
@@ -35,19 +35,19 @@
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
37 37
38#include <asm/arch/pxa-regs.h> 38#include <mach/pxa-regs.h>
39#include <asm/arch/pxa2xx-regs.h> 39#include <mach/pxa2xx-regs.h>
40#include <asm/arch/pxa2xx-gpio.h> 40#include <mach/pxa2xx-gpio.h>
41#include <asm/arch/pxa27x-udc.h> 41#include <mach/pxa27x-udc.h>
42#include <asm/arch/reset.h> 42#include <mach/reset.h>
43#include <asm/arch/irda.h> 43#include <mach/irda.h>
44#include <asm/arch/mmc.h> 44#include <mach/mmc.h>
45#include <asm/arch/ohci.h> 45#include <mach/ohci.h>
46#include <asm/arch/udc.h> 46#include <mach/udc.h>
47#include <asm/arch/pxafb.h> 47#include <mach/pxafb.h>
48#include <asm/arch/akita.h> 48#include <mach/akita.h>
49#include <asm/arch/spitz.h> 49#include <mach/spitz.h>
50#include <asm/arch/sharpsl.h> 50#include <mach/sharpsl.h>
51 51
52#include <asm/mach/sharpsl_param.h> 52#include <asm/mach/sharpsl_param.h>
53#include <asm/hardware/scoop.h> 53#include <asm/hardware/scoop.h>
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 360354084ae4..8a40505dfd28 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -20,14 +20,14 @@
20 20
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/hardware/scoop.h> 24#include <asm/hardware/scoop.h>
25 25
26#include <asm/arch/sharpsl.h> 26#include <mach/sharpsl.h>
27#include <asm/arch/spitz.h> 27#include <mach/spitz.h>
28#include <asm/arch/pxa-regs.h> 28#include <mach/pxa-regs.h>
29#include <asm/arch/pxa2xx-regs.h> 29#include <mach/pxa2xx-regs.h>
30#include <asm/arch/pxa2xx-gpio.h> 30#include <mach/pxa2xx-gpio.h>
31#include "sharpsl.h" 31#include "sharpsl.h"
32 32
33#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ 33#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 89f38683787e..9bd93c5f28b2 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -31,10 +31,10 @@
31 31
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35#include <asm/arch/ssp.h> 35#include <mach/ssp.h>
36#include <asm/arch/pxa-regs.h> 36#include <mach/pxa-regs.h>
37#include <asm/arch/regs-ssp.h> 37#include <mach/regs-ssp.h>
38 38
39#define TIMEOUT 100000 39#define TIMEOUT 100000
40 40
diff --git a/arch/arm/mach-pxa/standby.S b/arch/arm/mach-pxa/standby.S
index 40bb70eff3fe..f3821cfda72f 100644
--- a/arch/arm/mach-pxa/standby.S
+++ b/arch/arm/mach-pxa/standby.S
@@ -11,10 +11,10 @@
11 11
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/assembler.h> 13#include <asm/assembler.h>
14#include <asm/hardware.h> 14#include <mach/hardware.h>
15 15
16#include <asm/arch/pxa-regs.h> 16#include <mach/pxa-regs.h>
17#include <asm/arch/pxa2xx-regs.h> 17#include <mach/pxa2xx-regs.h>
18 18
19 .text 19 .text
20 20
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
index ac283507e423..589d32b4fc46 100644
--- a/arch/arm/mach-pxa/tavorevb.c
+++ b/arch/arm/mach-pxa/tavorevb.c
@@ -21,9 +21,9 @@
21 21
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/arch/pxa3xx-regs.h> 25#include <mach/pxa3xx-regs.h>
26#include <asm/arch/mfp-pxa930.h> 26#include <mach/mfp-pxa930.h>
27 27
28#include "devices.h" 28#include "devices.h"
29#include "generic.h" 29#include "generic.h"
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index 7b7c0179795b..67e18509d7bf 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -22,7 +22,7 @@
22#include <asm/cnt32_to_63.h> 22#include <asm/cnt32_to_63.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <asm/arch/pxa-regs.h> 25#include <mach/pxa-regs.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27 27
28/* 28/*
diff --git a/arch/arm/mach-pxa/tosa-bt.c b/arch/arm/mach-pxa/tosa-bt.c
index 7d8505466e54..fb0294bd4310 100644
--- a/arch/arm/mach-pxa/tosa-bt.c
+++ b/arch/arm/mach-pxa/tosa-bt.c
@@ -16,7 +16,7 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/rfkill.h> 17#include <linux/rfkill.h>
18 18
19#include <asm/arch/tosa_bt.h> 19#include <mach/tosa_bt.h>
20 20
21static void tosa_bt_on(struct tosa_bt_data *data) 21static void tosa_bt_on(struct tosa_bt_data *data)
22{ 22{
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 4bd7d4f006e2..5dab30eafddc 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -34,17 +34,17 @@
34 34
35#include <asm/setup.h> 35#include <asm/setup.h>
36#include <asm/mach-types.h> 36#include <asm/mach-types.h>
37#include <asm/arch/pxa2xx-regs.h> 37#include <mach/pxa2xx-regs.h>
38#include <asm/arch/mfp-pxa25x.h> 38#include <mach/mfp-pxa25x.h>
39#include <asm/arch/reset.h> 39#include <mach/reset.h>
40#include <asm/arch/irda.h> 40#include <mach/irda.h>
41#include <asm/arch/i2c.h> 41#include <mach/i2c.h>
42#include <asm/arch/mmc.h> 42#include <mach/mmc.h>
43#include <asm/arch/udc.h> 43#include <mach/udc.h>
44#include <asm/arch/tosa_bt.h> 44#include <mach/tosa_bt.h>
45 45
46#include <asm/mach/arch.h> 46#include <asm/mach/arch.h>
47#include <asm/arch/tosa.h> 47#include <mach/tosa.h>
48 48
49#include <asm/hardware/scoop.h> 49#include <asm/hardware/scoop.h>
50#include <asm/mach/sharpsl_param.h> 50#include <asm/mach/sharpsl_param.h>
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index 12811b7aea07..3ed757e6bcc8 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -31,7 +31,7 @@
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/memory.h> 32#include <asm/memory.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <asm/sizes.h> 36#include <asm/sizes.h>
37 37
@@ -40,15 +40,15 @@
40#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
41#include <asm/mach/flash.h> 41#include <asm/mach/flash.h>
42 42
43#include <asm/arch/pxa-regs.h> 43#include <mach/pxa-regs.h>
44#include <asm/arch/pxa2xx-regs.h> 44#include <mach/pxa2xx-regs.h>
45#include <asm/arch/pxa2xx-gpio.h> 45#include <mach/pxa2xx-gpio.h>
46#include <asm/arch/trizeps4.h> 46#include <mach/trizeps4.h>
47#include <asm/arch/audio.h> 47#include <mach/audio.h>
48#include <asm/arch/pxafb.h> 48#include <mach/pxafb.h>
49#include <asm/arch/mmc.h> 49#include <mach/mmc.h>
50#include <asm/arch/irda.h> 50#include <mach/irda.h>
51#include <asm/arch/ohci.h> 51#include <mach/ohci.h>
52 52
53#include "generic.h" 53#include "generic.h"
54#include "devices.h" 54#include "devices.h"
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 8fca6d890b7d..0cb65b5772fe 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -23,14 +23,14 @@
23 23
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/arch/audio.h> 27#include <mach/audio.h>
28#include <asm/arch/gpio.h> 28#include <mach/gpio.h>
29#include <asm/arch/pxafb.h> 29#include <mach/pxafb.h>
30#include <asm/arch/zylonite.h> 30#include <mach/zylonite.h>
31#include <asm/arch/mmc.h> 31#include <mach/mmc.h>
32#include <asm/arch/pxa27x_keypad.h> 32#include <mach/pxa27x_keypad.h>
33#include <asm/arch/pxa3xx_nand.h> 33#include <mach/pxa3xx_nand.h>
34 34
35#include "devices.h" 35#include "devices.h"
36#include "generic.h" 36#include "generic.h"
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
index b28d46e081d3..095f5c648236 100644
--- a/arch/arm/mach-pxa/zylonite_pxa300.c
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -20,9 +20,9 @@
20#include <linux/i2c/pca953x.h> 20#include <linux/i2c/pca953x.h>
21 21
22#include <asm/gpio.h> 22#include <asm/gpio.h>
23#include <asm/arch/mfp-pxa300.h> 23#include <mach/mfp-pxa300.h>
24#include <asm/arch/i2c.h> 24#include <mach/i2c.h>
25#include <asm/arch/zylonite.h> 25#include <mach/zylonite.h>
26 26
27#include "generic.h" 27#include "generic.h"
28 28
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
index 2b7fba7a2921..9879d7da2df5 100644
--- a/arch/arm/mach-pxa/zylonite_pxa320.c
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c
@@ -17,9 +17,9 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19 19
20#include <asm/arch/gpio.h> 20#include <mach/gpio.h>
21#include <asm/arch/mfp-pxa320.h> 21#include <mach/mfp-pxa320.h>
22#include <asm/arch/zylonite.h> 22#include <mach/zylonite.h>
23 23
24#include "generic.h" 24#include "generic.h"
25 25
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 131990d196f5..4f9c84ab781c 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -29,7 +29,7 @@
29#include <linux/clockchips.h> 29#include <linux/clockchips.h>
30 30
31#include <asm/system.h> 31#include <asm/system.h>
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/leds.h> 35#include <asm/leds.h>
diff --git a/arch/arm/mach-realview/include/mach/board-eb.h b/arch/arm/mach-realview/include/mach/board-eb.h
new file mode 100644
index 000000000000..8d699fd324d0
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/board-eb.h
@@ -0,0 +1,191 @@
1/*
2 * arch/arm/mach-realview/include/mach/board-eb.h
3 *
4 * Copyright (C) 2007 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA.
19 */
20
21#ifndef __ASM_ARCH_BOARD_EB_H
22#define __ASM_ARCH_BOARD_EB_H
23
24#include <mach/platform.h>
25
26/*
27 * RealView EB + ARM11MPCore peripheral addresses
28 */
29#define REALVIEW_EB_UART0_BASE 0x10009000 /* UART 0 */
30#define REALVIEW_EB_UART1_BASE 0x1000A000 /* UART 1 */
31#define REALVIEW_EB_UART2_BASE 0x1000B000 /* UART 2 */
32#define REALVIEW_EB_UART3_BASE 0x1000C000 /* UART 3 */
33#define REALVIEW_EB_SSP_BASE 0x1000D000 /* Synchronous Serial Port */
34#define REALVIEW_EB_WATCHDOG_BASE 0x10010000 /* watchdog interface */
35#define REALVIEW_EB_TIMER0_1_BASE 0x10011000 /* Timer 0 and 1 */
36#define REALVIEW_EB_TIMER2_3_BASE 0x10012000 /* Timer 2 and 3 */
37#define REALVIEW_EB_GPIO0_BASE 0x10013000 /* GPIO port 0 */
38#define REALVIEW_EB_RTC_BASE 0x10017000 /* Real Time Clock */
39#define REALVIEW_EB_CLCD_BASE 0x10020000 /* CLCD */
40#define REALVIEW_EB_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */
41#define REALVIEW_EB_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */
42#define REALVIEW_EB_SMC_BASE 0x10080000 /* Static memory controller */
43
44#define REALVIEW_EB_FLASH_BASE 0x40000000
45#define REALVIEW_EB_FLASH_SIZE SZ_64M
46#define REALVIEW_EB_ETH_BASE 0x4E000000 /* Ethernet */
47#define REALVIEW_EB_USB_BASE 0x4F000000 /* USB */
48
49#ifdef CONFIG_REALVIEW_EB_ARM11MP_REVB
50#define REALVIEW_EB11MP_SCU_BASE 0x10100000 /* SCU registers */
51#define REALVIEW_EB11MP_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */
52#define REALVIEW_EB11MP_TWD_BASE 0x10100700
53#define REALVIEW_EB11MP_TWD_SIZE 0x00000100
54#define REALVIEW_EB11MP_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */
55#define REALVIEW_EB11MP_L220_BASE 0x10102000 /* L220 registers */
56#define REALVIEW_EB11MP_SYS_PLD_CTRL1 0xD8 /* Register offset for MPCore sysctl */
57#else
58#define REALVIEW_EB11MP_SCU_BASE 0x1F000000 /* SCU registers */
59#define REALVIEW_EB11MP_GIC_CPU_BASE 0x1F000100 /* Generic interrupt controller CPU interface */
60#define REALVIEW_EB11MP_TWD_BASE 0x1F000700
61#define REALVIEW_EB11MP_TWD_SIZE 0x00000100
62#define REALVIEW_EB11MP_GIC_DIST_BASE 0x1F001000 /* Generic interrupt controller distributor */
63#define REALVIEW_EB11MP_L220_BASE 0x1F002000 /* L220 registers */
64#define REALVIEW_EB11MP_SYS_PLD_CTRL1 0x74 /* Register offset for MPCore sysctl */
65#endif
66
67#define IRQ_EB_GIC_START 32
68
69/*
70 * RealView EB interrupt sources
71 */
72#define IRQ_EB_WDOG (IRQ_EB_GIC_START + 0) /* Watchdog timer */
73#define IRQ_EB_SOFT (IRQ_EB_GIC_START + 1) /* Software interrupt */
74#define IRQ_EB_COMMRx (IRQ_EB_GIC_START + 2) /* Debug Comm Rx interrupt */
75#define IRQ_EB_COMMTx (IRQ_EB_GIC_START + 3) /* Debug Comm Tx interrupt */
76#define IRQ_EB_TIMER0_1 (IRQ_EB_GIC_START + 4) /* Timer 0 and 1 */
77#define IRQ_EB_TIMER2_3 (IRQ_EB_GIC_START + 5) /* Timer 2 and 3 */
78#define IRQ_EB_GPIO0 (IRQ_EB_GIC_START + 6) /* GPIO 0 */
79#define IRQ_EB_GPIO1 (IRQ_EB_GIC_START + 7) /* GPIO 1 */
80#define IRQ_EB_GPIO2 (IRQ_EB_GIC_START + 8) /* GPIO 2 */
81 /* 9 reserved */
82#define IRQ_EB_RTC (IRQ_EB_GIC_START + 10) /* Real Time Clock */
83#define IRQ_EB_SSP (IRQ_EB_GIC_START + 11) /* Synchronous Serial Port */
84#define IRQ_EB_UART0 (IRQ_EB_GIC_START + 12) /* UART 0 on development chip */
85#define IRQ_EB_UART1 (IRQ_EB_GIC_START + 13) /* UART 1 on development chip */
86#define IRQ_EB_UART2 (IRQ_EB_GIC_START + 14) /* UART 2 on development chip */
87#define IRQ_EB_UART3 (IRQ_EB_GIC_START + 15) /* UART 3 on development chip */
88#define IRQ_EB_SCI (IRQ_EB_GIC_START + 16) /* Smart Card Interface */
89#define IRQ_EB_MMCI0A (IRQ_EB_GIC_START + 17) /* Multimedia Card 0A */
90#define IRQ_EB_MMCI0B (IRQ_EB_GIC_START + 18) /* Multimedia Card 0B */
91#define IRQ_EB_AACI (IRQ_EB_GIC_START + 19) /* Audio Codec */
92#define IRQ_EB_KMI0 (IRQ_EB_GIC_START + 20) /* Keyboard/Mouse port 0 */
93#define IRQ_EB_KMI1 (IRQ_EB_GIC_START + 21) /* Keyboard/Mouse port 1 */
94#define IRQ_EB_CHARLCD (IRQ_EB_GIC_START + 22) /* Character LCD */
95#define IRQ_EB_CLCD (IRQ_EB_GIC_START + 23) /* CLCD controller */
96#define IRQ_EB_DMA (IRQ_EB_GIC_START + 24) /* DMA controller */
97#define IRQ_EB_PWRFAIL (IRQ_EB_GIC_START + 25) /* Power failure */
98#define IRQ_EB_PISMO (IRQ_EB_GIC_START + 26) /* PISMO interface */
99#define IRQ_EB_DoC (IRQ_EB_GIC_START + 27) /* Disk on Chip memory controller */
100#define IRQ_EB_ETH (IRQ_EB_GIC_START + 28) /* Ethernet controller */
101#define IRQ_EB_USB (IRQ_EB_GIC_START + 29) /* USB controller */
102#define IRQ_EB_TSPEN (IRQ_EB_GIC_START + 30) /* Touchscreen pen */
103#define IRQ_EB_TSKPAD (IRQ_EB_GIC_START + 31) /* Touchscreen keypad */
104
105/*
106 * RealView EB + ARM11MPCore interrupt sources (primary GIC on the core tile)
107 */
108#define IRQ_EB11MP_AACI (IRQ_EB_GIC_START + 0)
109#define IRQ_EB11MP_TIMER0_1 (IRQ_EB_GIC_START + 1)
110#define IRQ_EB11MP_TIMER2_3 (IRQ_EB_GIC_START + 2)
111#define IRQ_EB11MP_USB (IRQ_EB_GIC_START + 3)
112#define IRQ_EB11MP_UART0 (IRQ_EB_GIC_START + 4)
113#define IRQ_EB11MP_UART1 (IRQ_EB_GIC_START + 5)
114#define IRQ_EB11MP_RTC (IRQ_EB_GIC_START + 6)
115#define IRQ_EB11MP_KMI0 (IRQ_EB_GIC_START + 7)
116#define IRQ_EB11MP_KMI1 (IRQ_EB_GIC_START + 8)
117#define IRQ_EB11MP_ETH (IRQ_EB_GIC_START + 9)
118#define IRQ_EB11MP_EB_IRQ1 (IRQ_EB_GIC_START + 10) /* main GIC */
119#define IRQ_EB11MP_EB_IRQ2 (IRQ_EB_GIC_START + 11) /* tile GIC */
120#define IRQ_EB11MP_EB_FIQ1 (IRQ_EB_GIC_START + 12) /* main GIC */
121#define IRQ_EB11MP_EB_FIQ2 (IRQ_EB_GIC_START + 13) /* tile GIC */
122#define IRQ_EB11MP_MMCI0A (IRQ_EB_GIC_START + 14)
123#define IRQ_EB11MP_MMCI0B (IRQ_EB_GIC_START + 15)
124
125#define IRQ_EB11MP_PMU_CPU0 (IRQ_EB_GIC_START + 17)
126#define IRQ_EB11MP_PMU_CPU1 (IRQ_EB_GIC_START + 18)
127#define IRQ_EB11MP_PMU_CPU2 (IRQ_EB_GIC_START + 19)
128#define IRQ_EB11MP_PMU_CPU3 (IRQ_EB_GIC_START + 20)
129#define IRQ_EB11MP_PMU_SCU0 (IRQ_EB_GIC_START + 21)
130#define IRQ_EB11MP_PMU_SCU1 (IRQ_EB_GIC_START + 22)
131#define IRQ_EB11MP_PMU_SCU2 (IRQ_EB_GIC_START + 23)
132#define IRQ_EB11MP_PMU_SCU3 (IRQ_EB_GIC_START + 24)
133#define IRQ_EB11MP_PMU_SCU4 (IRQ_EB_GIC_START + 25)
134#define IRQ_EB11MP_PMU_SCU5 (IRQ_EB_GIC_START + 26)
135#define IRQ_EB11MP_PMU_SCU6 (IRQ_EB_GIC_START + 27)
136#define IRQ_EB11MP_PMU_SCU7 (IRQ_EB_GIC_START + 28)
137
138#define IRQ_EB11MP_L220_EVENT (IRQ_EB_GIC_START + 29)
139#define IRQ_EB11MP_L220_SLAVE (IRQ_EB_GIC_START + 30)
140#define IRQ_EB11MP_L220_DECODE (IRQ_EB_GIC_START + 31)
141
142#define IRQ_EB11MP_UART2 -1
143#define IRQ_EB11MP_UART3 -1
144#define IRQ_EB11MP_CLCD -1
145#define IRQ_EB11MP_DMA -1
146#define IRQ_EB11MP_WDOG -1
147#define IRQ_EB11MP_GPIO0 -1
148#define IRQ_EB11MP_GPIO1 -1
149#define IRQ_EB11MP_GPIO2 -1
150#define IRQ_EB11MP_SCI -1
151#define IRQ_EB11MP_SSP -1
152
153#define NR_GIC_EB11MP 2
154
155/*
156 * Only define NR_IRQS if less than NR_IRQS_EB
157 */
158#define NR_IRQS_EB (IRQ_EB_GIC_START + 96)
159
160#if defined(CONFIG_MACH_REALVIEW_EB) \
161 && (!defined(NR_IRQS) || (NR_IRQS < NR_IRQS_EB))
162#undef NR_IRQS
163#define NR_IRQS NR_IRQS_EB
164#endif
165
166#if defined(CONFIG_REALVIEW_EB_ARM11MP) \
167 && (!defined(MAX_GIC_NR) || (MAX_GIC_NR < NR_GIC_EB11MP))
168#undef MAX_GIC_NR
169#define MAX_GIC_NR NR_GIC_EB11MP
170#endif
171
172/*
173 * Core tile identification (REALVIEW_SYS_PROCID)
174 */
175#define REALVIEW_EB_PROC_MASK 0xFF000000
176#define REALVIEW_EB_PROC_ARM7TDMI 0x00000000
177#define REALVIEW_EB_PROC_ARM9 0x02000000
178#define REALVIEW_EB_PROC_ARM11 0x04000000
179#define REALVIEW_EB_PROC_ARM11MP 0x06000000
180
181#define check_eb_proc(proc_type) \
182 ((readl(__io_address(REALVIEW_SYS_PROCID)) & REALVIEW_EB_PROC_MASK) \
183 == proc_type)
184
185#ifdef CONFIG_REALVIEW_EB_ARM11MP
186#define core_tile_eb11mp() check_eb_proc(REALVIEW_EB_PROC_ARM11MP)
187#else
188#define core_tile_eb11mp() 0
189#endif
190
191#endif /* __ASM_ARCH_BOARD_EB_H */
diff --git a/arch/arm/mach-realview/include/mach/board-pb1176.h b/arch/arm/mach-realview/include/mach/board-pb1176.h
new file mode 100644
index 000000000000..858eea7b1adc
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/board-pb1176.h
@@ -0,0 +1,152 @@
1/*
2 * arch/arm/mach-realview/include/mach/board-pb1176.h
3 *
4 * Copyright (C) 2008 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA.
19 */
20
21#ifndef __ASM_ARCH_BOARD_PB1176_H
22#define __ASM_ARCH_BOARD_PB1176_H
23
24#include <mach/platform.h>
25
26/*
27 * Peripheral addresses
28 */
29#define REALVIEW_PB1176_SCTL_BASE 0x10100000 /* System controller */
30#define REALVIEW_PB1176_SMC_BASE 0x10111000 /* SMC */
31#define REALVIEW_PB1176_DMC_BASE 0x10109000 /* DMC configuration */
32#define REALVIEW_PB1176_SDRAM67_BASE 0x70000000 /* SDRAM banks 6 and 7 */
33#define REALVIEW_PB1176_FLASH_BASE 0x30000000
34#define REALVIEW_PB1176_FLASH_SIZE SZ_64M
35
36#define REALVIEW_PB1176_TIMER0_1_BASE 0x10104000 /* Timer 0 and 1 */
37#define REALVIEW_PB1176_TIMER2_3_BASE 0x10105000 /* Timer 2 and 3 */
38#define REALVIEW_PB1176_TIMER4_5_BASE 0x10106000 /* Timer 4 and 5 */
39#define REALVIEW_PB1176_WATCHDOG_BASE 0x10107000 /* watchdog interface */
40#define REALVIEW_PB1176_RTC_BASE 0x10108000 /* Real Time Clock */
41#define REALVIEW_PB1176_GPIO0_BASE 0x1010A000 /* GPIO port 0 */
42#define REALVIEW_PB1176_SSP_BASE 0x1010B000 /* Synchronous Serial Port */
43#define REALVIEW_PB1176_UART0_BASE 0x1010C000 /* UART 0 */
44#define REALVIEW_PB1176_UART1_BASE 0x1010D000 /* UART 1 */
45#define REALVIEW_PB1176_UART2_BASE 0x1010E000 /* UART 2 */
46#define REALVIEW_PB1176_UART3_BASE 0x1010F000 /* UART 3 */
47#define REALVIEW_PB1176_CLCD_BASE 0x10112000 /* CLCD */
48#define REALVIEW_PB1176_ETH_BASE 0x3A000000 /* Ethernet */
49#define REALVIEW_PB1176_USB_BASE 0x3B000000 /* USB */
50
51/*
52 * PCI regions
53 */
54#define REALVIEW_PB1176_PCI_BASE 0x60000000 /* PCI self config */
55#define REALVIEW_PB1176_PCI_CFG_BASE 0x61000000 /* PCI config */
56#define REALVIEW_PB1176_PCI_IO_BASE0 0x62000000 /* PCI IO region */
57#define REALVIEW_PB1176_PCI_MEM_BASE0 0x63000000 /* Memory region 1 */
58#define REALVIEW_PB1176_PCI_MEM_BASE1 0x64000000 /* Memory region 2 */
59#define REALVIEW_PB1176_PCI_MEM_BASE2 0x68000000 /* Memory region 3 */
60
61#define REALVIEW_PB1176_PCI_BASE_SIZE 0x01000000 /* 16MB */
62#define REALVIEW_PB1176_PCI_CFG_BASE_SIZE 0x01000000 /* 16MB */
63#define REALVIEW_PB1176_PCI_IO_BASE0_SIZE 0x01000000 /* 16MB */
64#define REALVIEW_PB1176_PCI_MEM_BASE0_SIZE 0x01000000 /* 16MB */
65#define REALVIEW_PB1176_PCI_MEM_BASE1_SIZE 0x04000000 /* 64MB */
66#define REALVIEW_PB1176_PCI_MEM_BASE2_SIZE 0x08000000 /* 128MB */
67
68#define REALVIEW_DC1176_GIC_CPU_BASE 0x10120000 /* GIC CPU interface, on devchip */
69#define REALVIEW_DC1176_GIC_DIST_BASE 0x10121000 /* GIC distributor, on devchip */
70#define REALVIEW_PB1176_GIC_CPU_BASE 0x10040000 /* GIC CPU interface, on FPGA */
71#define REALVIEW_PB1176_GIC_DIST_BASE 0x10041000 /* GIC distributor, on FPGA */
72#define REALVIEW_PB1176_L220_BASE 0x10110000 /* L220 registers */
73
74/*
75 * Irqs
76 */
77#define IRQ_DC1176_GIC_START 32
78#define IRQ_PB1176_GIC_START 64
79
80/*
81 * ARM1176 DevChip interrupt sources (primary GIC)
82 */
83#define IRQ_DC1176_WATCHDOG (IRQ_DC1176_GIC_START + 0) /* Watchdog timer */
84#define IRQ_DC1176_SOFTINT (IRQ_DC1176_GIC_START + 1) /* Software interrupt */
85#define IRQ_DC1176_COMMRx (IRQ_DC1176_GIC_START + 2) /* Debug Comm Rx interrupt */
86#define IRQ_DC1176_COMMTx (IRQ_DC1176_GIC_START + 3) /* Debug Comm Tx interrupt */
87#define IRQ_DC1176_TIMER0 (IRQ_DC1176_GIC_START + 8) /* Timer 0 */
88#define IRQ_DC1176_TIMER1 (IRQ_DC1176_GIC_START + 9) /* Timer 1 */
89#define IRQ_DC1176_TIMER2 (IRQ_DC1176_GIC_START + 10) /* Timer 2 */
90#define IRQ_DC1176_APC (IRQ_DC1176_GIC_START + 11)
91#define IRQ_DC1176_IEC (IRQ_DC1176_GIC_START + 12)
92#define IRQ_DC1176_L2CC (IRQ_DC1176_GIC_START + 13)
93#define IRQ_DC1176_RTC (IRQ_DC1176_GIC_START + 14)
94#define IRQ_DC1176_CLCD (IRQ_DC1176_GIC_START + 15) /* CLCD controller */
95#define IRQ_DC1176_UART0 (IRQ_DC1176_GIC_START + 18) /* UART 0 on development chip */
96#define IRQ_DC1176_UART1 (IRQ_DC1176_GIC_START + 19) /* UART 1 on development chip */
97#define IRQ_DC1176_UART2 (IRQ_DC1176_GIC_START + 20) /* UART 2 on development chip */
98#define IRQ_DC1176_UART3 (IRQ_DC1176_GIC_START + 21) /* UART 3 on development chip */
99
100#define IRQ_DC1176_PB_IRQ2 (IRQ_DC1176_GIC_START + 30) /* tile GIC */
101#define IRQ_DC1176_PB_IRQ1 (IRQ_DC1176_GIC_START + 31) /* main GIC */
102
103/*
104 * RealView PB1176 interrupt sources (secondary GIC)
105 */
106#define IRQ_PB1176_MMCI0A (IRQ_PB1176_GIC_START + 1) /* Multimedia Card 0A */
107#define IRQ_PB1176_MMCI0B (IRQ_PB1176_GIC_START + 2) /* Multimedia Card 0A */
108#define IRQ_PB1176_KMI0 (IRQ_PB1176_GIC_START + 3) /* Keyboard/Mouse port 0 */
109#define IRQ_PB1176_KMI1 (IRQ_PB1176_GIC_START + 4) /* Keyboard/Mouse port 1 */
110#define IRQ_PB1176_SCI (IRQ_PB1176_GIC_START + 5)
111#define IRQ_PB1176_UART4 (IRQ_PB1176_GIC_START + 6) /* UART 4 on baseboard */
112#define IRQ_PB1176_CHARLCD (IRQ_PB1176_GIC_START + 7) /* Character LCD */
113#define IRQ_PB1176_GPIO1 (IRQ_PB1176_GIC_START + 8)
114#define IRQ_PB1176_GPIO2 (IRQ_PB1176_GIC_START + 9)
115#define IRQ_PB1176_ETH (IRQ_PB1176_GIC_START + 10) /* Ethernet controller */
116#define IRQ_PB1176_USB (IRQ_PB1176_GIC_START + 11) /* USB controller */
117
118#define IRQ_PB1176_PISMO (IRQ_PB1176_GIC_START + 16)
119
120#define IRQ_PB1176_AACI (IRQ_PB1176_GIC_START + 19) /* Audio Codec */
121
122#define IRQ_PB1176_TIMER0_1 (IRQ_PB1176_GIC_START + 22)
123#define IRQ_PB1176_TIMER2_3 (IRQ_PB1176_GIC_START + 23)
124#define IRQ_PB1176_DMAC (IRQ_PB1176_GIC_START + 24) /* DMA controller */
125#define IRQ_PB1176_RTC (IRQ_PB1176_GIC_START + 25) /* Real Time Clock */
126
127#define IRQ_PB1176_GPIO0 -1
128#define IRQ_PB1176_SSP -1
129#define IRQ_PB1176_SCTL -1
130
131#define NR_GIC_PB1176 2
132
133/*
134 * Only define NR_IRQS if less than NR_IRQS_PB1176
135 */
136#define NR_IRQS_PB1176 (IRQ_DC1176_GIC_START + 96)
137
138#if defined(CONFIG_MACH_REALVIEW_PB1176)
139
140#if !defined(NR_IRQS) || (NR_IRQS < NR_IRQS_PB1176)
141#undef NR_IRQS
142#define NR_IRQS NR_IRQS_PB1176
143#endif
144
145#if !defined(MAX_GIC_NR) || (MAX_GIC_NR < NR_GIC_PB1176)
146#undef MAX_GIC_NR
147#define MAX_GIC_NR NR_GIC_PB1176
148#endif
149
150#endif /* CONFIG_MACH_REALVIEW_PB1176 */
151
152#endif /* __ASM_ARCH_BOARD_PB1176_H */
diff --git a/arch/arm/mach-realview/include/mach/board-pb11mp.h b/arch/arm/mach-realview/include/mach/board-pb11mp.h
new file mode 100644
index 000000000000..ecd80e58631e
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/board-pb11mp.h
@@ -0,0 +1,186 @@
1/*
2 * arch/arm/mach-realview/include/mach/board-pb11mp.h
3 *
4 * Copyright (C) 2008 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA.
19 */
20
21#ifndef __ASM_ARCH_BOARD_PB11MP_H
22#define __ASM_ARCH_BOARD_PB11MP_H
23
24#include <mach/platform.h>
25
26/*
27 * Peripheral addresses
28 */
29#define REALVIEW_PB11MP_UART0_BASE 0x10009000 /* UART 0 */
30#define REALVIEW_PB11MP_UART1_BASE 0x1000A000 /* UART 1 */
31#define REALVIEW_PB11MP_UART2_BASE 0x1000B000 /* UART 2 */
32#define REALVIEW_PB11MP_UART3_BASE 0x1000C000 /* UART 3 */
33#define REALVIEW_PB11MP_SSP_BASE 0x1000D000 /* Synchronous Serial Port */
34#define REALVIEW_PB11MP_WATCHDOG0_BASE 0x1000F000 /* Watchdog 0 */
35#define REALVIEW_PB11MP_WATCHDOG_BASE 0x10010000 /* watchdog interface */
36#define REALVIEW_PB11MP_TIMER0_1_BASE 0x10011000 /* Timer 0 and 1 */
37#define REALVIEW_PB11MP_TIMER2_3_BASE 0x10012000 /* Timer 2 and 3 */
38#define REALVIEW_PB11MP_GPIO0_BASE 0x10013000 /* GPIO port 0 */
39#define REALVIEW_PB11MP_RTC_BASE 0x10017000 /* Real Time Clock */
40#define REALVIEW_PB11MP_TIMER4_5_BASE 0x10018000 /* Timer 4/5 */
41#define REALVIEW_PB11MP_TIMER6_7_BASE 0x10019000 /* Timer 6/7 */
42#define REALVIEW_PB11MP_SCTL_BASE 0x1001A000 /* System Controller */
43#define REALVIEW_PB11MP_CLCD_BASE 0x10020000 /* CLCD */
44#define REALVIEW_PB11MP_ONB_SRAM_BASE 0x10060000 /* On-board SRAM */
45#define REALVIEW_PB11MP_DMC_BASE 0x100E0000 /* DMC configuration */
46#define REALVIEW_PB11MP_SMC_BASE 0x100E1000 /* SMC configuration */
47#define REALVIEW_PB11MP_CAN_BASE 0x100E2000 /* CAN bus */
48#define REALVIEW_PB11MP_CF_BASE 0x18000000 /* Compact flash */
49#define REALVIEW_PB11MP_CF_MEM_BASE 0x18003000 /* SMC for Compact flash */
50#define REALVIEW_PB11MP_GIC_CPU_BASE 0x1E000000 /* Generic interrupt controller CPU interface */
51#define REALVIEW_PB11MP_FLASH0_BASE 0x40000000
52#define REALVIEW_PB11MP_FLASH0_SIZE SZ_64M
53#define REALVIEW_PB11MP_FLASH1_BASE 0x44000000
54#define REALVIEW_PB11MP_FLASH1_SIZE SZ_64M
55#define REALVIEW_PB11MP_ETH_BASE 0x4E000000 /* Ethernet */
56#define REALVIEW_PB11MP_USB_BASE 0x4F000000 /* USB */
57#define REALVIEW_PB11MP_GIC_DIST_BASE 0x1E001000 /* Generic interrupt controller distributor */
58#define REALVIEW_PB11MP_LT_BASE 0xC0000000 /* Logic Tile expansion */
59#define REALVIEW_PB11MP_SDRAM6_BASE 0x70000000 /* SDRAM bank 6 256MB */
60#define REALVIEW_PB11MP_SDRAM7_BASE 0x80000000 /* SDRAM bank 7 256MB */
61
62#define REALVIEW_PB11MP_SYS_PLD_CTRL1 0x74
63
64/*
65 * PB11MPCore PCI regions
66 */
67#define REALVIEW_PB11MP_PCI_BASE 0x90040000 /* PCI-X Unit base */
68#define REALVIEW_PB11MP_PCI_IO_BASE 0x90050000 /* IO Region on AHB */
69#define REALVIEW_PB11MP_PCI_MEM_BASE 0xA0000000 /* MEM Region on AHB */
70
71#define REALVIEW_PB11MP_PCI_BASE_SIZE 0x10000 /* 16 Kb */
72#define REALVIEW_PB11MP_PCI_IO_SIZE 0x1000 /* 4 Kb */
73#define REALVIEW_PB11MP_PCI_MEM_SIZE 0x20000000 /* 512 MB */
74
75/*
76 * Testchip peripheral and fpga gic regions
77 */
78#define REALVIEW_TC11MP_SCU_BASE 0x1F000000 /* IRQ, Test chip */
79#define REALVIEW_TC11MP_GIC_CPU_BASE 0x1F000100 /* Test chip interrupt controller CPU interface */
80#define REALVIEW_TC11MP_TWD_BASE 0x1F000700
81#define REALVIEW_TC11MP_TWD_SIZE 0x00000100
82#define REALVIEW_TC11MP_GIC_DIST_BASE 0x1F001000 /* Test chip interrupt controller distributor */
83#define REALVIEW_TC11MP_L220_BASE 0x1F002000 /* L220 registers */
84
85/*
86 * Irqs
87 */
88#define IRQ_TC11MP_GIC_START 32
89#define IRQ_PB11MP_GIC_START 64
90
91/*
92 * ARM11MPCore test chip interrupt sources (primary GIC on the test chip)
93 */
94#define IRQ_TC11MP_AACI (IRQ_TC11MP_GIC_START + 0)
95#define IRQ_TC11MP_TIMER0_1 (IRQ_TC11MP_GIC_START + 1)
96#define IRQ_TC11MP_TIMER2_3 (IRQ_TC11MP_GIC_START + 2)
97#define IRQ_TC11MP_USB (IRQ_TC11MP_GIC_START + 3)
98#define IRQ_TC11MP_UART0 (IRQ_TC11MP_GIC_START + 4)
99#define IRQ_TC11MP_UART1 (IRQ_TC11MP_GIC_START + 5)
100#define IRQ_TC11MP_RTC (IRQ_TC11MP_GIC_START + 6)
101#define IRQ_TC11MP_KMI0 (IRQ_TC11MP_GIC_START + 7)
102#define IRQ_TC11MP_KMI1 (IRQ_TC11MP_GIC_START + 8)
103#define IRQ_TC11MP_ETH (IRQ_TC11MP_GIC_START + 9)
104#define IRQ_TC11MP_PB_IRQ1 (IRQ_TC11MP_GIC_START + 10) /* main GIC */
105#define IRQ_TC11MP_PB_IRQ2 (IRQ_TC11MP_GIC_START + 11) /* tile GIC */
106#define IRQ_TC11MP_PB_FIQ1 (IRQ_TC11MP_GIC_START + 12) /* main GIC */
107#define IRQ_TC11MP_PB_FIQ2 (IRQ_TC11MP_GIC_START + 13) /* tile GIC */
108#define IRQ_TC11MP_MMCI0A (IRQ_TC11MP_GIC_START + 14)
109#define IRQ_TC11MP_MMCI0B (IRQ_TC11MP_GIC_START + 15)
110
111#define IRQ_TC11MP_PMU_CPU0 (IRQ_TC11MP_GIC_START + 17)
112#define IRQ_TC11MP_PMU_CPU1 (IRQ_TC11MP_GIC_START + 18)
113#define IRQ_TC11MP_PMU_CPU2 (IRQ_TC11MP_GIC_START + 19)
114#define IRQ_TC11MP_PMU_CPU3 (IRQ_TC11MP_GIC_START + 20)
115#define IRQ_TC11MP_PMU_SCU0 (IRQ_TC11MP_GIC_START + 21)
116#define IRQ_TC11MP_PMU_SCU1 (IRQ_TC11MP_GIC_START + 22)
117#define IRQ_TC11MP_PMU_SCU2 (IRQ_TC11MP_GIC_START + 23)
118#define IRQ_TC11MP_PMU_SCU3 (IRQ_TC11MP_GIC_START + 24)
119#define IRQ_TC11MP_PMU_SCU4 (IRQ_TC11MP_GIC_START + 25)
120#define IRQ_TC11MP_PMU_SCU5 (IRQ_TC11MP_GIC_START + 26)
121#define IRQ_TC11MP_PMU_SCU6 (IRQ_TC11MP_GIC_START + 27)
122#define IRQ_TC11MP_PMU_SCU7 (IRQ_TC11MP_GIC_START + 28)
123
124#define IRQ_TC11MP_L220_EVENT (IRQ_TC11MP_GIC_START + 29)
125#define IRQ_TC11MP_L220_SLAVE (IRQ_TC11MP_GIC_START + 30)
126#define IRQ_TC11MP_L220_DECODE (IRQ_TC11MP_GIC_START + 31)
127
128/*
129 * RealView PB11MPCore GIC interrupt sources (secondary GIC on the board)
130 */
131#define IRQ_PB11MP_WATCHDOG (IRQ_PB11MP_GIC_START + 0) /* Watchdog timer */
132#define IRQ_PB11MP_SOFT (IRQ_PB11MP_GIC_START + 1) /* Software interrupt */
133#define IRQ_PB11MP_COMMRx (IRQ_PB11MP_GIC_START + 2) /* Debug Comm Rx interrupt */
134#define IRQ_PB11MP_COMMTx (IRQ_PB11MP_GIC_START + 3) /* Debug Comm Tx interrupt */
135#define IRQ_PB11MP_GPIO0 (IRQ_PB11MP_GIC_START + 6) /* GPIO 0 */
136#define IRQ_PB11MP_GPIO1 (IRQ_PB11MP_GIC_START + 7) /* GPIO 1 */
137#define IRQ_PB11MP_GPIO2 (IRQ_PB11MP_GIC_START + 8) /* GPIO 2 */
138 /* 9 reserved */
139#define IRQ_PB11MP_RTC_GIC1 (IRQ_PB11MP_GIC_START + 10) /* Real Time Clock */
140#define IRQ_PB11MP_SSP (IRQ_PB11MP_GIC_START + 11) /* Synchronous Serial Port */
141#define IRQ_PB11MP_UART0_GIC1 (IRQ_PB11MP_GIC_START + 12) /* UART 0 on development chip */
142#define IRQ_PB11MP_UART1_GIC1 (IRQ_PB11MP_GIC_START + 13) /* UART 1 on development chip */
143#define IRQ_PB11MP_UART2 (IRQ_PB11MP_GIC_START + 14) /* UART 2 on development chip */
144#define IRQ_PB11MP_UART3 (IRQ_PB11MP_GIC_START + 15) /* UART 3 on development chip */
145#define IRQ_PB11MP_SCI (IRQ_PB11MP_GIC_START + 16) /* Smart Card Interface */
146#define IRQ_PB11MP_MMCI0A_GIC1 (IRQ_PB11MP_GIC_START + 17) /* Multimedia Card 0A */
147#define IRQ_PB11MP_MMCI0B_GIC1 (IRQ_PB11MP_GIC_START + 18) /* Multimedia Card 0B */
148#define IRQ_PB11MP_AACI_GIC1 (IRQ_PB11MP_GIC_START + 19) /* Audio Codec */
149#define IRQ_PB11MP_KMI0_GIC1 (IRQ_PB11MP_GIC_START + 20) /* Keyboard/Mouse port 0 */
150#define IRQ_PB11MP_KMI1_GIC1 (IRQ_PB11MP_GIC_START + 21) /* Keyboard/Mouse port 1 */
151#define IRQ_PB11MP_CHARLCD (IRQ_PB11MP_GIC_START + 22) /* Character LCD */
152#define IRQ_PB11MP_CLCD (IRQ_PB11MP_GIC_START + 23) /* CLCD controller */
153#define IRQ_PB11MP_DMAC (IRQ_PB11MP_GIC_START + 24) /* DMA controller */
154#define IRQ_PB11MP_PWRFAIL (IRQ_PB11MP_GIC_START + 25) /* Power failure */
155#define IRQ_PB11MP_PISMO (IRQ_PB11MP_GIC_START + 26) /* PISMO interface */
156#define IRQ_PB11MP_DoC (IRQ_PB11MP_GIC_START + 27) /* Disk on Chip memory controller */
157#define IRQ_PB11MP_ETH_GIC1 (IRQ_PB11MP_GIC_START + 28) /* Ethernet controller */
158#define IRQ_PB11MP_USB_GIC1 (IRQ_PB11MP_GIC_START + 29) /* USB controller */
159#define IRQ_PB11MP_TSPEN (IRQ_PB11MP_GIC_START + 30) /* Touchscreen pen */
160#define IRQ_PB11MP_TSKPAD (IRQ_PB11MP_GIC_START + 31) /* Touchscreen keypad */
161
162#define IRQ_PB11MP_SMC -1
163#define IRQ_PB11MP_SCTL -1
164
165#define NR_GIC_PB11MP 2
166
167/*
168 * Only define NR_IRQS if less than NR_IRQS_PB11MP
169 */
170#define NR_IRQS_PB11MP (IRQ_TC11MP_GIC_START + 96)
171
172#if defined(CONFIG_MACH_REALVIEW_PB11MP)
173
174#if !defined(NR_IRQS) || (NR_IRQS < NR_IRQS_PB11MP)
175#undef NR_IRQS
176#define NR_IRQS NR_IRQS_PB11MP
177#endif
178
179#if !defined(MAX_GIC_NR) || (MAX_GIC_NR < NR_GIC_PB11MP)
180#undef MAX_GIC_NR
181#define MAX_GIC_NR NR_GIC_PB11MP
182#endif
183
184#endif /* CONFIG_MACH_REALVIEW_PB11MP */
185
186#endif /* __ASM_ARCH_BOARD_PB11MP_H */
diff --git a/arch/arm/mach-realview/include/mach/debug-macro.S b/arch/arm/mach-realview/include/mach/debug-macro.S
new file mode 100644
index 000000000000..7196bcadff0c
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/debug-macro.S
@@ -0,0 +1,22 @@
1/* arch/arm/mach-realview/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 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17 moveq \rx, #0x10000000
18 movne \rx, #0xf0000000 @ virtual base
19 orr \rx, \rx, #0x00009000
20 .endm
21
22#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-realview/include/mach/dma.h b/arch/arm/mach-realview/include/mach/dma.h
new file mode 100644
index 000000000000..f1a5a1a10952
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/dma.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-realview/include/mach/dma.h
3 *
4 * Copyright (C) 2003 ARM Limited.
5 * Copyright (C) 1997,1998 Russell King
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
diff --git a/arch/arm/mach-realview/include/mach/entry-macro.S b/arch/arm/mach-realview/include/mach/entry-macro.S
new file mode 100644
index 000000000000..340a5c276946
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/entry-macro.S
@@ -0,0 +1,81 @@
1/*
2 * arch/arm/mach-realview/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for RealView 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#include <asm/hardware/gic.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro get_irqnr_preamble, base, tmp
17 ldr \base, =gic_cpu_base_addr
18 ldr \base, [\base]
19 .endm
20
21 .macro arch_ret_to_user, tmp1, tmp2
22 .endm
23
24 /*
25 * The interrupt numbering scheme is defined in the
26 * interrupt controller spec. To wit:
27 *
28 * Interrupts 0-15 are IPI
29 * 16-28 are reserved
30 * 29-31 are local. We allow 30 to be used for the watchdog.
31 * 32-1020 are global
32 * 1021-1022 are reserved
33 * 1023 is "spurious" (no interrupt)
34 *
35 * For now, we ignore all local interrupts so only return an interrupt if it's
36 * between 30 and 1020. The test_for_ipi routine below will pick up on IPIs.
37 *
38 * A simple read from the controller will tell us the number of the highest
39 * priority enabled interrupt. We then just need to check whether it is in the
40 * valid range for an IRQ (30-1020 inclusive).
41 */
42
43 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
44
45 ldr \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 = src CPU, 9-0 = int # */
46
47 ldr \tmp, =1021
48
49 bic \irqnr, \irqstat, #0x1c00
50
51 cmp \irqnr, #29
52 cmpcc \irqnr, \irqnr
53 cmpne \irqnr, \tmp
54 cmpcs \irqnr, \irqnr
55
56 .endm
57
58 /* We assume that irqstat (the raw value of the IRQ acknowledge
59 * register) is preserved from the macro above.
60 * If there is an IPI, we immediately signal end of interrupt on the
61 * controller, since this requires the original irqstat value which
62 * we won't easily be able to recreate later.
63 */
64
65 .macro test_for_ipi, irqnr, irqstat, base, tmp
66 bic \irqnr, \irqstat, #0x1c00
67 cmp \irqnr, #16
68 strcc \irqstat, [\base, #GIC_CPU_EOI]
69 cmpcs \irqnr, \irqnr
70 .endm
71
72 /* As above, this assumes that irqstat and base are preserved.. */
73
74 .macro test_for_ltirq, irqnr, irqstat, base, tmp
75 bic \irqnr, \irqstat, #0x1c00
76 mov \tmp, #0
77 cmp \irqnr, #29
78 moveq \tmp, #1
79 streq \irqstat, [\base, #GIC_CPU_EOI]
80 cmp \tmp, #0
81 .endm
diff --git a/arch/arm/mach-realview/include/mach/hardware.h b/arch/arm/mach-realview/include/mach/hardware.h
new file mode 100644
index 000000000000..79a93b3dfca9
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/hardware.h
@@ -0,0 +1,31 @@
1/*
2 * arch/arm/mach-realview/include/mach/hardware.h
3 *
4 * This file contains the hardware definitions of the RealView boards.
5 *
6 * Copyright (C) 2003 ARM Limited.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef __ASM_ARCH_HARDWARE_H
23#define __ASM_ARCH_HARDWARE_H
24
25#include <asm/sizes.h>
26
27/* macro to get at IO space when running virtually */
28#define IO_ADDRESS(x) (((x) & 0x0fffffff) + 0xf0000000)
29#define __io_address(n) __io(IO_ADDRESS(n))
30
31#endif
diff --git a/arch/arm/mach-realview/include/mach/io.h b/arch/arm/mach-realview/include/mach/io.h
new file mode 100644
index 000000000000..aa069424d310
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/io.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/mach-realview/include/mach/io.h
3 *
4 * Copyright (C) 2003 ARM Limited
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#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define IO_SPACE_LIMIT 0xffffffff
24
25static inline void __iomem *__io(unsigned long addr)
26{
27 return (void __iomem *)addr;
28}
29
30#define __io(a) __io(a)
31#define __mem_pci(a) (a)
32
33#endif
diff --git a/arch/arm/mach-realview/include/mach/irqs.h b/arch/arm/mach-realview/include/mach/irqs.h
new file mode 100644
index 000000000000..02a918529db3
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/irqs.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-realview/include/mach/irqs.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __ASM_ARCH_IRQS_H
23#define __ASM_ARCH_IRQS_H
24
25#include <mach/board-eb.h>
26#include <mach/board-pb11mp.h>
27#include <mach/board-pb1176.h>
28
29#define IRQ_LOCALTIMER 29
30#define IRQ_LOCALWDOG 30
31
32#define IRQ_GIC_START 32
33
34#ifndef NR_IRQS
35#error "NR_IRQS not defined by the board-specific files"
36#endif
37
38#endif
diff --git a/arch/arm/mach-realview/include/mach/memory.h b/arch/arm/mach-realview/include/mach/memory.h
new file mode 100644
index 000000000000..0e673483a141
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/memory.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-realview/include/mach/memory.h
3 *
4 * Copyright (C) 2003 ARM Limited
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#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H
22
23/*
24 * Physical DRAM offset.
25 */
26#define PHYS_OFFSET UL(0x00000000)
27
28/*
29 * Virtual view <-> DMA view memory address translations
30 * virt_to_bus: Used to translate the virtual address to an
31 * address suitable to be passed to set_dma_addr
32 * bus_to_virt: Used to convert an address for DMA operations
33 * to an address that the kernel can use.
34 */
35#define __virt_to_bus(x) ((x) - PAGE_OFFSET)
36#define __bus_to_virt(x) ((x) + PAGE_OFFSET)
37
38#endif
diff --git a/arch/arm/mach-realview/include/mach/platform.h b/arch/arm/mach-realview/include/mach/platform.h
new file mode 100644
index 000000000000..4034b54950c2
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/platform.h
@@ -0,0 +1,293 @@
1/*
2 * arch/arm/mach-realview/include/mach/platform.h
3 *
4 * Copyright (c) ARM Limited 2003. All rights reserved.
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
21#ifndef __ASM_ARCH_PLATFORM_H
22#define __ASM_ARCH_PLATFORM_H
23
24/*
25 * Memory definitions
26 */
27#define REALVIEW_BOOT_ROM_LO 0x30000000 /* DoC Base (64Mb)...*/
28#define REALVIEW_BOOT_ROM_HI 0x30000000
29#define REALVIEW_BOOT_ROM_BASE REALVIEW_BOOT_ROM_HI /* Normal position */
30#define REALVIEW_BOOT_ROM_SIZE SZ_64M
31
32#define REALVIEW_SSRAM_BASE /* REALVIEW_SSMC_BASE ? */
33#define REALVIEW_SSRAM_SIZE SZ_2M
34
35/*
36 * SDRAM
37 */
38#define REALVIEW_SDRAM_BASE 0x00000000
39
40/*
41 * Logic expansion modules
42 *
43 */
44
45
46/* ------------------------------------------------------------------------
47 * RealView Registers
48 * ------------------------------------------------------------------------
49 *
50 */
51#define REALVIEW_SYS_ID_OFFSET 0x00
52#define REALVIEW_SYS_SW_OFFSET 0x04
53#define REALVIEW_SYS_LED_OFFSET 0x08
54#define REALVIEW_SYS_OSC0_OFFSET 0x0C
55
56#define REALVIEW_SYS_OSC1_OFFSET 0x10
57#define REALVIEW_SYS_OSC2_OFFSET 0x14
58#define REALVIEW_SYS_OSC3_OFFSET 0x18
59#define REALVIEW_SYS_OSC4_OFFSET 0x1C /* OSC1 for RealView/AB */
60
61#define REALVIEW_SYS_LOCK_OFFSET 0x20
62#define REALVIEW_SYS_100HZ_OFFSET 0x24
63#define REALVIEW_SYS_CFGDATA1_OFFSET 0x28
64#define REALVIEW_SYS_CFGDATA2_OFFSET 0x2C
65#define REALVIEW_SYS_FLAGS_OFFSET 0x30
66#define REALVIEW_SYS_FLAGSSET_OFFSET 0x30
67#define REALVIEW_SYS_FLAGSCLR_OFFSET 0x34
68#define REALVIEW_SYS_NVFLAGS_OFFSET 0x38
69#define REALVIEW_SYS_NVFLAGSSET_OFFSET 0x38
70#define REALVIEW_SYS_NVFLAGSCLR_OFFSET 0x3C
71#define REALVIEW_SYS_RESETCTL_OFFSET 0x40
72#define REALVIEW_SYS_PCICTL_OFFSET 0x44
73#define REALVIEW_SYS_MCI_OFFSET 0x48
74#define REALVIEW_SYS_FLASH_OFFSET 0x4C
75#define REALVIEW_SYS_CLCD_OFFSET 0x50
76#define REALVIEW_SYS_CLCDSER_OFFSET 0x54
77#define REALVIEW_SYS_BOOTCS_OFFSET 0x58
78#define REALVIEW_SYS_24MHz_OFFSET 0x5C
79#define REALVIEW_SYS_MISC_OFFSET 0x60
80#define REALVIEW_SYS_IOSEL_OFFSET 0x70
81#define REALVIEW_SYS_PROCID_OFFSET 0x84
82#define REALVIEW_SYS_TEST_OSC0_OFFSET 0xC0
83#define REALVIEW_SYS_TEST_OSC1_OFFSET 0xC4
84#define REALVIEW_SYS_TEST_OSC2_OFFSET 0xC8
85#define REALVIEW_SYS_TEST_OSC3_OFFSET 0xCC
86#define REALVIEW_SYS_TEST_OSC4_OFFSET 0xD0
87
88#define REALVIEW_SYS_BASE 0x10000000
89#define REALVIEW_SYS_ID (REALVIEW_SYS_BASE + REALVIEW_SYS_ID_OFFSET)
90#define REALVIEW_SYS_SW (REALVIEW_SYS_BASE + REALVIEW_SYS_SW_OFFSET)
91#define REALVIEW_SYS_LED (REALVIEW_SYS_BASE + REALVIEW_SYS_LED_OFFSET)
92#define REALVIEW_SYS_OSC0 (REALVIEW_SYS_BASE + REALVIEW_SYS_OSC0_OFFSET)
93#define REALVIEW_SYS_OSC1 (REALVIEW_SYS_BASE + REALVIEW_SYS_OSC1_OFFSET)
94
95#define REALVIEW_SYS_LOCK (REALVIEW_SYS_BASE + REALVIEW_SYS_LOCK_OFFSET)
96#define REALVIEW_SYS_100HZ (REALVIEW_SYS_BASE + REALVIEW_SYS_100HZ_OFFSET)
97#define REALVIEW_SYS_CFGDATA1 (REALVIEW_SYS_BASE + REALVIEW_SYS_CFGDATA1_OFFSET)
98#define REALVIEW_SYS_CFGDATA2 (REALVIEW_SYS_BASE + REALVIEW_SYS_CFGDATA2_OFFSET)
99#define REALVIEW_SYS_FLAGS (REALVIEW_SYS_BASE + REALVIEW_SYS_FLAGS_OFFSET)
100#define REALVIEW_SYS_FLAGSSET (REALVIEW_SYS_BASE + REALVIEW_SYS_FLAGSSET_OFFSET)
101#define REALVIEW_SYS_FLAGSCLR (REALVIEW_SYS_BASE + REALVIEW_SYS_FLAGSCLR_OFFSET)
102#define REALVIEW_SYS_NVFLAGS (REALVIEW_SYS_BASE + REALVIEW_SYS_NVFLAGS_OFFSET)
103#define REALVIEW_SYS_NVFLAGSSET (REALVIEW_SYS_BASE + REALVIEW_SYS_NVFLAGSSET_OFFSET)
104#define REALVIEW_SYS_NVFLAGSCLR (REALVIEW_SYS_BASE + REALVIEW_SYS_NVFLAGSCLR_OFFSET)
105#define REALVIEW_SYS_RESETCTL (REALVIEW_SYS_BASE + REALVIEW_SYS_RESETCTL_OFFSET)
106#define REALVIEW_SYS_PCICTL (REALVIEW_SYS_BASE + REALVIEW_SYS_PCICTL_OFFSET)
107#define REALVIEW_SYS_MCI (REALVIEW_SYS_BASE + REALVIEW_SYS_MCI_OFFSET)
108#define REALVIEW_SYS_FLASH (REALVIEW_SYS_BASE + REALVIEW_SYS_FLASH_OFFSET)
109#define REALVIEW_SYS_CLCD (REALVIEW_SYS_BASE + REALVIEW_SYS_CLCD_OFFSET)
110#define REALVIEW_SYS_CLCDSER (REALVIEW_SYS_BASE + REALVIEW_SYS_CLCDSER_OFFSET)
111#define REALVIEW_SYS_BOOTCS (REALVIEW_SYS_BASE + REALVIEW_SYS_BOOTCS_OFFSET)
112#define REALVIEW_SYS_24MHz (REALVIEW_SYS_BASE + REALVIEW_SYS_24MHz_OFFSET)
113#define REALVIEW_SYS_MISC (REALVIEW_SYS_BASE + REALVIEW_SYS_MISC_OFFSET)
114#define REALVIEW_SYS_IOSEL (REALVIEW_SYS_BASE + REALVIEW_SYS_IOSEL_OFFSET)
115#define REALVIEW_SYS_PROCID (REALVIEW_SYS_BASE + REALVIEW_SYS_PROCID_OFFSET)
116#define REALVIEW_SYS_TEST_OSC0 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC0_OFFSET)
117#define REALVIEW_SYS_TEST_OSC1 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC1_OFFSET)
118#define REALVIEW_SYS_TEST_OSC2 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC2_OFFSET)
119#define REALVIEW_SYS_TEST_OSC3 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC3_OFFSET)
120#define REALVIEW_SYS_TEST_OSC4 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC4_OFFSET)
121
122/*
123 * Values for REALVIEW_SYS_RESET_CTRL
124 */
125#define REALVIEW_SYS_CTRL_RESET_CONFIGCLR 0x01
126#define REALVIEW_SYS_CTRL_RESET_CONFIGINIT 0x02
127#define REALVIEW_SYS_CTRL_RESET_DLLRESET 0x03
128#define REALVIEW_SYS_CTRL_RESET_PLLRESET 0x04
129#define REALVIEW_SYS_CTRL_RESET_POR 0x05
130#define REALVIEW_SYS_CTRL_RESET_DoC 0x06
131
132#define REALVIEW_SYS_CTRL_LED (1 << 0)
133
134
135/* ------------------------------------------------------------------------
136 * RealView control registers
137 * ------------------------------------------------------------------------
138 */
139
140/*
141 * REALVIEW_IDFIELD
142 *
143 * 31:24 = manufacturer (0x41 = ARM)
144 * 23:16 = architecture (0x08 = AHB system bus, ASB processor bus)
145 * 15:12 = FPGA (0x3 = XVC600 or XVC600E)
146 * 11:4 = build value
147 * 3:0 = revision number (0x1 = rev B (AHB))
148 */
149
150/*
151 * REALVIEW_SYS_LOCK
152 * control access to SYS_OSCx, SYS_CFGDATAx, SYS_RESETCTL,
153 * SYS_CLD, SYS_BOOTCS
154 */
155#define REALVIEW_SYS_LOCK_LOCKED (1 << 16)
156#define REALVIEW_SYS_LOCKVAL_MASK 0xFFFF /* write 0xA05F to enable write access */
157
158/*
159 * REALVIEW_SYS_FLASH
160 */
161#define REALVIEW_FLASHPROG_FLVPPEN (1 << 0) /* Enable writing to flash */
162
163/*
164 * REALVIEW_INTREG
165 * - used to acknowledge and control MMCI and UART interrupts
166 */
167#define REALVIEW_INTREG_WPROT 0x00 /* MMC protection status (no interrupt generated) */
168#define REALVIEW_INTREG_RI0 0x01 /* Ring indicator UART0 is asserted, */
169#define REALVIEW_INTREG_CARDIN 0x08 /* MMCI card in detect */
170 /* write 1 to acknowledge and clear */
171#define REALVIEW_INTREG_RI1 0x02 /* Ring indicator UART1 is asserted, */
172#define REALVIEW_INTREG_CARDINSERT 0x03 /* Signal insertion of MMC card */
173
174/*
175 * RealView common peripheral addresses
176 */
177#define REALVIEW_SCTL_BASE 0x10001000 /* System controller */
178#define REALVIEW_I2C_BASE 0x10002000 /* I2C control */
179#define REALVIEW_AACI_BASE 0x10004000 /* Audio */
180#define REALVIEW_MMCI0_BASE 0x10005000 /* MMC interface */
181#define REALVIEW_KMI0_BASE 0x10006000 /* KMI interface */
182#define REALVIEW_KMI1_BASE 0x10007000 /* KMI 2nd interface */
183#define REALVIEW_CHAR_LCD_BASE 0x10008000 /* Character LCD */
184#define REALVIEW_SCI_BASE 0x1000E000 /* Smart card controller */
185#define REALVIEW_GPIO1_BASE 0x10014000 /* GPIO port 1 */
186#define REALVIEW_GPIO2_BASE 0x10015000 /* GPIO port 2 */
187#define REALVIEW_DMC_BASE 0x10018000 /* DMC configuration */
188#define REALVIEW_DMAC_BASE 0x10030000 /* DMA controller */
189
190/* PCI space */
191#define REALVIEW_PCI_BASE 0x41000000 /* PCI Interface */
192#define REALVIEW_PCI_CFG_BASE 0x42000000
193#define REALVIEW_PCI_MEM_BASE0 0x44000000
194#define REALVIEW_PCI_MEM_BASE1 0x50000000
195#define REALVIEW_PCI_MEM_BASE2 0x60000000
196/* Sizes of above maps */
197#define REALVIEW_PCI_BASE_SIZE 0x01000000
198#define REALVIEW_PCI_CFG_BASE_SIZE 0x02000000
199#define REALVIEW_PCI_MEM_BASE0_SIZE 0x0c000000 /* 32Mb */
200#define REALVIEW_PCI_MEM_BASE1_SIZE 0x10000000 /* 256Mb */
201#define REALVIEW_PCI_MEM_BASE2_SIZE 0x10000000 /* 256Mb */
202
203#define REALVIEW_SDRAM67_BASE 0x70000000 /* SDRAM banks 6 and 7 */
204#define REALVIEW_LT_BASE 0x80000000 /* Logic Tile expansion */
205
206/*
207 * Disk on Chip
208 */
209#define REALVIEW_DOC_BASE 0x2C000000
210#define REALVIEW_DOC_SIZE (16 << 20)
211#define REALVIEW_DOC_PAGE_SIZE 512
212#define REALVIEW_DOC_TOTAL_PAGES (DOC_SIZE / PAGE_SIZE)
213
214#define ERASE_UNIT_PAGES 32
215#define START_PAGE 0x80
216
217/*
218 * LED settings, bits [7:0]
219 */
220#define REALVIEW_SYS_LED0 (1 << 0)
221#define REALVIEW_SYS_LED1 (1 << 1)
222#define REALVIEW_SYS_LED2 (1 << 2)
223#define REALVIEW_SYS_LED3 (1 << 3)
224#define REALVIEW_SYS_LED4 (1 << 4)
225#define REALVIEW_SYS_LED5 (1 << 5)
226#define REALVIEW_SYS_LED6 (1 << 6)
227#define REALVIEW_SYS_LED7 (1 << 7)
228
229#define ALL_LEDS 0xFF
230
231#define LED_BANK REALVIEW_SYS_LED
232
233/*
234 * Control registers
235 */
236#define REALVIEW_IDFIELD_OFFSET 0x0 /* RealView build information */
237#define REALVIEW_FLASHPROG_OFFSET 0x4 /* Flash devices */
238#define REALVIEW_INTREG_OFFSET 0x8 /* Interrupt control */
239#define REALVIEW_DECODE_OFFSET 0xC /* Fitted logic modules */
240
241/*
242 * Application Flash
243 *
244 */
245#define FLASH_BASE REALVIEW_FLASH_BASE
246#define FLASH_SIZE REALVIEW_FLASH_SIZE
247#define FLASH_END (FLASH_BASE + FLASH_SIZE - 1)
248#define FLASH_BLOCK_SIZE SZ_128K
249
250/*
251 * Boot Flash
252 *
253 */
254#define EPROM_BASE REALVIEW_BOOT_ROM_HI
255#define EPROM_SIZE REALVIEW_BOOT_ROM_SIZE
256#define EPROM_END (EPROM_BASE + EPROM_SIZE - 1)
257
258/*
259 * Clean base - dummy
260 *
261 */
262#define CLEAN_BASE EPROM_BASE
263
264/*
265 * System controller bit assignment
266 */
267#define REALVIEW_REFCLK 0
268#define REALVIEW_TIMCLK 1
269
270#define REALVIEW_TIMER1_EnSel 15
271#define REALVIEW_TIMER2_EnSel 17
272#define REALVIEW_TIMER3_EnSel 19
273#define REALVIEW_TIMER4_EnSel 21
274
275
276#define MAX_TIMER 2
277#define MAX_PERIOD 699050
278#define TICKS_PER_uSEC 1
279
280/*
281 * These are useconds NOT ticks.
282 *
283 */
284#define mSEC_1 1000
285#define mSEC_5 (mSEC_1 * 5)
286#define mSEC_10 (mSEC_1 * 10)
287#define mSEC_25 (mSEC_1 * 25)
288#define SEC_1 (mSEC_1 * 1000)
289
290#define REALVIEW_CSR_BASE 0x10000000
291#define REALVIEW_CSR_SIZE 0x10000000
292
293#endif /* __ASM_ARCH_PLATFORM_H */
diff --git a/arch/arm/mach-realview/include/mach/scu.h b/arch/arm/mach-realview/include/mach/scu.h
new file mode 100644
index 000000000000..d55802d645af
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/scu.h
@@ -0,0 +1,13 @@
1#ifndef __ASMARM_ARCH_SCU_H
2#define __ASMARM_ARCH_SCU_H
3
4/*
5 * SCU registers
6 */
7#define SCU_CTRL 0x00
8#define SCU_CONFIG 0x04
9#define SCU_CPU_STATUS 0x08
10#define SCU_INVALIDATE 0x0c
11#define SCU_FPGA_REVISION 0x10
12
13#endif
diff --git a/arch/arm/mach-realview/include/mach/smp.h b/arch/arm/mach-realview/include/mach/smp.h
new file mode 100644
index 000000000000..515819efd046
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/smp.h
@@ -0,0 +1,30 @@
1#ifndef ASMARM_ARCH_SMP_H
2#define ASMARM_ARCH_SMP_H
3
4
5#include <asm/hardware/gic.h>
6
7#define hard_smp_processor_id() \
8 ({ \
9 unsigned int cpunum; \
10 __asm__("mrc p15, 0, %0, c0, c0, 5" \
11 : "=r" (cpunum)); \
12 cpunum &= 0x0F; \
13 })
14
15/*
16 * We use IRQ1 as the IPI
17 */
18static inline void smp_cross_call(cpumask_t callmap)
19{
20 gic_raise_softirq(callmap, 1);
21}
22
23/*
24 * Do nothing on MPcore.
25 */
26static inline void smp_cross_call_done(cpumask_t callmap)
27{
28}
29
30#endif
diff --git a/arch/arm/mach-realview/include/mach/system.h b/arch/arm/mach-realview/include/mach/system.h
new file mode 100644
index 000000000000..4d3c8f3f8053
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/system.h
@@ -0,0 +1,51 @@
1/*
2 * arch/arm/mach-realview/include/mach/system.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24#include <mach/hardware.h>
25#include <asm/io.h>
26#include <mach/platform.h>
27
28static inline void arch_idle(void)
29{
30 /*
31 * This should do all the clock switching
32 * and wait for interrupt tricks
33 */
34 cpu_do_idle();
35}
36
37static inline void arch_reset(char mode)
38{
39 void __iomem *hdr_ctrl = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_RESETCTL_OFFSET;
40 unsigned int val;
41
42 /*
43 * To reset, we hit the on-board reset register
44 * in the system FPGA
45 */
46 val = __raw_readl(hdr_ctrl);
47 val |= REALVIEW_SYS_CTRL_RESET_CONFIGCLR;
48 __raw_writel(val, hdr_ctrl);
49}
50
51#endif
diff --git a/arch/arm/mach-realview/include/mach/timex.h b/arch/arm/mach-realview/include/mach/timex.h
new file mode 100644
index 000000000000..4eeb069373c2
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/timex.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/mach-realview/include/mach/timex.h
3 *
4 * RealView architecture timex specifications
5 *
6 * Copyright (C) 2003 ARM Limited
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#define CLOCK_TICK_RATE (50000000 / 16)
diff --git a/arch/arm/mach-realview/include/mach/uncompress.h b/arch/arm/mach-realview/include/mach/uncompress.h
new file mode 100644
index 000000000000..79f50f218e77
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/uncompress.h
@@ -0,0 +1,72 @@
1/*
2 * arch/arm/mach-realview/include/mach/uncompress.h
3 *
4 * Copyright (C) 2003 ARM Limited
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#include <mach/hardware.h>
21#include <asm/mach-types.h>
22
23#include <mach/board-eb.h>
24#include <mach/board-pb11mp.h>
25#include <mach/board-pb1176.h>
26
27#define AMBA_UART_DR(base) (*(volatile unsigned char *)((base) + 0x00))
28#define AMBA_UART_LCRH(base) (*(volatile unsigned char *)((base) + 0x2c))
29#define AMBA_UART_CR(base) (*(volatile unsigned char *)((base) + 0x30))
30#define AMBA_UART_FR(base) (*(volatile unsigned char *)((base) + 0x18))
31
32/*
33 * Return the UART base address
34 */
35static inline unsigned long get_uart_base(void)
36{
37 if (machine_is_realview_eb())
38 return REALVIEW_EB_UART0_BASE;
39 else if (machine_is_realview_pb11mp())
40 return REALVIEW_PB11MP_UART0_BASE;
41 else if (machine_is_realview_pb1176())
42 return REALVIEW_PB1176_UART0_BASE;
43 else
44 return 0;
45}
46
47/*
48 * This does not append a newline
49 */
50static inline void putc(int c)
51{
52 unsigned long base = get_uart_base();
53
54 while (AMBA_UART_FR(base) & (1 << 5))
55 barrier();
56
57 AMBA_UART_DR(base) = c;
58}
59
60static inline void flush(void)
61{
62 unsigned long base = get_uart_base();
63
64 while (AMBA_UART_FR(base) & (1 << 3))
65 barrier();
66}
67
68/*
69 * nothing to do
70 */
71#define arch_decomp_setup()
72#define arch_decomp_wdog()
diff --git a/arch/arm/mach-realview/include/mach/vmalloc.h b/arch/arm/mach-realview/include/mach/vmalloc.h
new file mode 100644
index 000000000000..48cbcc873db2
--- /dev/null
+++ b/arch/arm/mach-realview/include/mach/vmalloc.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-realview/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Russell King.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#define VMALLOC_END (PAGE_OFFSET + 0x18000000)
diff --git a/arch/arm/mach-realview/localtimer.c b/arch/arm/mach-realview/localtimer.c
index 50604360479f..82fa1f26e026 100644
--- a/arch/arm/mach-realview/localtimer.c
+++ b/arch/arm/mach-realview/localtimer.c
@@ -20,7 +20,7 @@
20 20
21#include <asm/hardware/arm_twd.h> 21#include <asm/hardware/arm_twd.h>
22#include <asm/hardware/gic.h> 22#include <asm/hardware/gic.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26 26
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 8e813ed57519..1907d22f4fed 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -15,13 +15,13 @@
15#include <linux/smp.h> 15#include <linux/smp.h>
16 16
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18#include <asm/hardware.h> 18#include <mach/hardware.h>
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21 21
22#include <asm/arch/board-eb.h> 22#include <mach/board-eb.h>
23#include <asm/arch/board-pb11mp.h> 23#include <mach/board-pb11mp.h>
24#include <asm/arch/scu.h> 24#include <mach/scu.h>
25 25
26extern void realview_secondary_startup(void); 26extern void realview_secondary_startup(void);
27 27
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 5782d83fd886..19a9968fc5b9 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -24,7 +24,7 @@
24#include <linux/sysdev.h> 24#include <linux/sysdev.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/leds.h> 30#include <asm/leds.h>
@@ -38,8 +38,8 @@
38#include <asm/mach/mmc.h> 38#include <asm/mach/mmc.h>
39#include <asm/mach/time.h> 39#include <asm/mach/time.h>
40 40
41#include <asm/arch/board-eb.h> 41#include <mach/board-eb.h>
42#include <asm/arch/irqs.h> 42#include <mach/irqs.h>
43 43
44#include "core.h" 44#include "core.h"
45#include "clock.h" 45#include "clock.h"
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index cf7f576a5860..0986cbd15943 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -24,7 +24,7 @@
24#include <linux/sysdev.h> 24#include <linux/sysdev.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/leds.h> 30#include <asm/leds.h>
@@ -39,8 +39,8 @@
39#include <asm/mach/mmc.h> 39#include <asm/mach/mmc.h>
40#include <asm/mach/time.h> 40#include <asm/mach/time.h>
41 41
42#include <asm/arch/board-pb1176.h> 42#include <mach/board-pb1176.h>
43#include <asm/arch/irqs.h> 43#include <mach/irqs.h>
44 44
45#include "core.h" 45#include "core.h"
46#include "clock.h" 46#include "clock.h"
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index f7ce1c5a178a..f4e7135e3eb5 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -24,7 +24,7 @@
24#include <linux/sysdev.h> 24#include <linux/sysdev.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/leds.h> 30#include <asm/leds.h>
@@ -39,8 +39,8 @@
39#include <asm/mach/mmc.h> 39#include <asm/mach/mmc.h>
40#include <asm/mach/time.h> 40#include <asm/mach/time.h>
41 41
42#include <asm/arch/board-pb11mp.h> 42#include <mach/board-pb11mp.h>
43#include <asm/arch/irqs.h> 43#include <mach/irqs.h>
44 44
45#include "core.h" 45#include "core.h"
46#include "clock.h" 46#include "clock.h"
diff --git a/arch/arm/mach-rpc/dma.c b/arch/arm/mach-rpc/dma.c
index 596379a4cf82..4b19fe484190 100644
--- a/arch/arm/mach-rpc/dma.c
+++ b/arch/arm/mach-rpc/dma.c
@@ -20,7 +20,7 @@
20#include <asm/fiq.h> 20#include <asm/fiq.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25 25
26#include <asm/mach/dma.h> 26#include <asm/mach/dma.h>
diff --git a/arch/arm/mach-rpc/include/mach/acornfb.h b/arch/arm/mach-rpc/include/mach/acornfb.h
new file mode 100644
index 000000000000..395d76288ffe
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/acornfb.h
@@ -0,0 +1,140 @@
1/*
2 * arch/arm/mach-rpc/include/mach/acornfb.h
3 *
4 * Copyright (C) 1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * AcornFB architecture specific code
11 */
12
13#define acornfb_bandwidth(var) ((var)->pixclock * 8 / (var)->bits_per_pixel)
14
15static inline int
16acornfb_valid_pixrate(struct fb_var_screeninfo *var)
17{
18 u_long limit;
19
20 if (!var->pixclock)
21 return 0;
22
23 /*
24 * Limits below are taken from RISC OS bandwidthlimit file
25 */
26 if (current_par.using_vram) {
27 if (current_par.vram_half_sam == 2048)
28 limit = 6578;
29 else
30 limit = 13157;
31 } else {
32 limit = 26315;
33 }
34
35 return acornfb_bandwidth(var) >= limit;
36}
37
38/*
39 * Try to find the best PLL parameters for the pixel clock.
40 * This algorithm seems to give best predictable results,
41 * and produces the same values as detailed in the VIDC20
42 * data sheet.
43 */
44static inline u_int
45acornfb_vidc20_find_pll(u_int pixclk)
46{
47 u_int r, best_r = 2, best_v = 2;
48 int best_d = 0x7fffffff;
49
50 for (r = 2; r <= 32; r++) {
51 u_int rr, v, p;
52 int d;
53
54 rr = 41667 * r;
55
56 v = (rr + pixclk / 2) / pixclk;
57
58 if (v > 32 || v < 2)
59 continue;
60
61 p = (rr + v / 2) / v;
62
63 d = pixclk - p;
64
65 if (d < 0)
66 d = -d;
67
68 if (d < best_d) {
69 best_d = d;
70 best_v = v - 1;
71 best_r = r - 1;
72 }
73
74 if (d == 0)
75 break;
76 }
77
78 return best_v << 8 | best_r;
79}
80
81static inline void
82acornfb_vidc20_find_rates(struct vidc_timing *vidc,
83 struct fb_var_screeninfo *var)
84{
85 u_int div;
86
87 /* Select pixel-clock divisor to keep PLL in range */
88 div = var->pixclock / 9090; /*9921*/
89
90 /* Limit divisor */
91 if (div == 0)
92 div = 1;
93 if (div > 8)
94 div = 8;
95
96 /* Encode divisor to VIDC20 setting */
97 switch (div) {
98 case 1: vidc->control |= VIDC20_CTRL_PIX_CK; break;
99 case 2: vidc->control |= VIDC20_CTRL_PIX_CK2; break;
100 case 3: vidc->control |= VIDC20_CTRL_PIX_CK3; break;
101 case 4: vidc->control |= VIDC20_CTRL_PIX_CK4; break;
102 case 5: vidc->control |= VIDC20_CTRL_PIX_CK5; break;
103 case 6: vidc->control |= VIDC20_CTRL_PIX_CK6; break;
104 case 7: vidc->control |= VIDC20_CTRL_PIX_CK7; break;
105 case 8: vidc->control |= VIDC20_CTRL_PIX_CK8; break;
106 }
107
108 /*
109 * With VRAM, the FIFO can be set to the highest possible setting
110 * because there are no latency considerations for other memory
111 * accesses. However, in 64 bit bus mode the FIFO preload value
112 * must not be set to VIDC20_CTRL_FIFO_28 because this will let
113 * the FIFO overflow. See VIDC20 manual page 33 (6.0 Setting the
114 * FIFO preload value).
115 */
116 if (current_par.using_vram) {
117 if (current_par.vram_half_sam == 2048)
118 vidc->control |= VIDC20_CTRL_FIFO_24;
119 else
120 vidc->control |= VIDC20_CTRL_FIFO_28;
121 } else {
122 unsigned long bandwidth = acornfb_bandwidth(var);
123
124 /* Encode bandwidth as VIDC20 setting */
125 if (bandwidth > 33334) /* < 30.0MB/s */
126 vidc->control |= VIDC20_CTRL_FIFO_16;
127 else if (bandwidth > 26666) /* < 37.5MB/s */
128 vidc->control |= VIDC20_CTRL_FIFO_20;
129 else if (bandwidth > 22222) /* < 45.0MB/s */
130 vidc->control |= VIDC20_CTRL_FIFO_24;
131 else /* > 45.0MB/s */
132 vidc->control |= VIDC20_CTRL_FIFO_28;
133 }
134
135 /* Find the PLL values */
136 vidc->pll_ctl = acornfb_vidc20_find_pll(var->pixclock / div);
137}
138
139#define acornfb_default_control() (VIDC20_CTRL_PIX_VCLK)
140#define acornfb_default_econtrol() (VIDC20_ECTL_DAC | VIDC20_ECTL_REG(3))
diff --git a/arch/arm/mach-rpc/include/mach/debug-macro.S b/arch/arm/mach-rpc/include/mach/debug-macro.S
new file mode 100644
index 000000000000..b2a939ffdcde
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/debug-macro.S
@@ -0,0 +1,25 @@
1/* arch/arm/mach-rpc/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 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17 moveq \rx, #0x03000000
18 movne \rx, #0xe0000000
19 orr \rx, \rx, #0x00010000
20 orr \rx, \rx, #0x00000fe0
21 .endm
22
23#define UART_SHIFT 2
24#define FLOW_CONTROL
25#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-rpc/include/mach/dma.h b/arch/arm/mach-rpc/include/mach/dma.h
new file mode 100644
index 000000000000..360b56f8f29f
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/dma.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/mach-rpc/include/mach/dma.h
3 *
4 * Copyright (C) 1997 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARCH_DMA_H
11#define __ASM_ARCH_DMA_H
12
13/*
14 * This is the maximum DMA address that can be DMAd to.
15 * There should not be more than (0xd0000000 - 0xc0000000)
16 * bytes of RAM.
17 */
18#define MAX_DMA_ADDRESS 0xd0000000
19#define MAX_DMA_CHANNELS 8
20
21#define DMA_0 0
22#define DMA_1 1
23#define DMA_2 2
24#define DMA_3 3
25#define DMA_S0 4
26#define DMA_S1 5
27#define DMA_VIRTUAL_FLOPPY 6
28#define DMA_VIRTUAL_SOUND 7
29
30#define DMA_FLOPPY DMA_VIRTUAL_FLOPPY
31
32#endif /* _ASM_ARCH_DMA_H */
33
diff --git a/arch/arm/mach-rpc/include/mach/entry-macro.S b/arch/arm/mach-rpc/include/mach/entry-macro.S
new file mode 100644
index 000000000000..4e7e54144093
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/entry-macro.S
@@ -0,0 +1,16 @@
1#include <mach/hardware.h>
2#include <asm/hardware/entry-macro-iomd.S>
3
4 .equ ioc_base_high, IOC_BASE & 0xff000000
5 .equ ioc_base_low, IOC_BASE & 0x00ff0000
6
7 .macro get_irqnr_preamble, base, tmp
8 mov \base, #ioc_base_high @ point at IOC
9 .if ioc_base_low
10 orr \base, \base, #ioc_base_low
11 .endif
12 .endm
13
14 .macro arch_ret_to_user, tmp1, tmp2
15 .endm
16
diff --git a/arch/arm/mach-rpc/include/mach/hardware.h b/arch/arm/mach-rpc/include/mach/hardware.h
new file mode 100644
index 000000000000..dde6b3c0e299
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/hardware.h
@@ -0,0 +1,83 @@
1/*
2 * arch/arm/mach-rpc/include/mach/hardware.h
3 *
4 * Copyright (C) 1996-1999 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This file contains the hardware definitions of the RiscPC series machines.
11 */
12#ifndef __ASM_ARCH_HARDWARE_H
13#define __ASM_ARCH_HARDWARE_H
14
15#include <mach/memory.h>
16
17#ifndef __ASSEMBLY__
18#define IOMEM(x) ((void __iomem *)(unsigned long)(x))
19#else
20#define IOMEM(x) x
21#endif /* __ASSEMBLY__ */
22
23/*
24 * What hardware must be present
25 */
26#define HAS_IOMD
27#define HAS_VIDC20
28
29/* Hardware addresses of major areas.
30 * *_START is the physical address
31 * *_SIZE is the size of the region
32 * *_BASE is the virtual address
33 */
34#define RAM_SIZE 0x10000000
35#define RAM_START 0x10000000
36
37#define EASI_SIZE 0x08000000 /* EASI I/O */
38#define EASI_START 0x08000000
39#define EASI_BASE 0xe5000000
40
41#define IO_START 0x03000000 /* I/O */
42#define IO_SIZE 0x01000000
43#define IO_BASE IOMEM(0xe0000000)
44
45#define SCREEN_START 0x02000000 /* VRAM */
46#define SCREEN_END 0xdfc00000
47#define SCREEN_BASE 0xdf800000
48
49#define UNCACHEABLE_ADDR 0xdf010000
50
51/*
52 * IO Addresses
53 */
54#define VIDC_BASE IOMEM(0xe0400000)
55#define EXPMASK_BASE 0xe0360000
56#define IOMD_BASE IOMEM(0xe0200000)
57#define IOC_BASE IOMEM(0xe0200000)
58#define PCIO_BASE IOMEM(0xe0010000)
59#define FLOPPYDMA_BASE IOMEM(0xe002a000)
60
61#define vidc_writel(val) __raw_writel(val, VIDC_BASE)
62
63#define IO_EC_EASI_BASE 0x81400000
64#define IO_EC_IOC4_BASE 0x8009c000
65#define IO_EC_IOC_BASE 0x80090000
66#define IO_EC_MEMC8_BASE 0x8000ac00
67#define IO_EC_MEMC_BASE 0x80000000
68
69#define NETSLOT_BASE 0x0302b000
70#define NETSLOT_SIZE 0x00001000
71
72#define PODSLOT_IOC0_BASE 0x03240000
73#define PODSLOT_IOC4_BASE 0x03270000
74#define PODSLOT_IOC_SIZE (1 << 14)
75#define PODSLOT_MEMC_BASE 0x03000000
76#define PODSLOT_MEMC_SIZE (1 << 14)
77#define PODSLOT_EASI_BASE 0x08000000
78#define PODSLOT_EASI_SIZE (1 << 24)
79
80#define EXPMASK_STATUS (EXPMASK_BASE + 0x00)
81#define EXPMASK_ENABLE (EXPMASK_BASE + 0x04)
82
83#endif
diff --git a/arch/arm/mach-rpc/include/mach/io.h b/arch/arm/mach-rpc/include/mach/io.h
new file mode 100644
index 000000000000..9f0553b7ec28
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/io.h
@@ -0,0 +1,258 @@
1/*
2 * arch/arm/mach-rpc/include/mach/io.h
3 *
4 * Copyright (C) 1997 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Modifications:
11 * 06-Dec-1997 RMK Created.
12 */
13#ifndef __ASM_ARM_ARCH_IO_H
14#define __ASM_ARM_ARCH_IO_H
15
16#include <mach/hardware.h>
17
18#define IO_SPACE_LIMIT 0xffffffff
19
20/*
21 * GCC is totally crap at loading/storing data. We try to persuade it
22 * to do the right thing by using these whereever possible instead of
23 * the above.
24 */
25#define __arch_base_getb(b,o) \
26 ({ \
27 unsigned int __v, __r = (b); \
28 __asm__ __volatile__( \
29 "ldrb %0, [%1, %2]" \
30 : "=r" (__v) \
31 : "r" (__r), "Ir" (o)); \
32 __v; \
33 })
34
35#define __arch_base_getl(b,o) \
36 ({ \
37 unsigned int __v, __r = (b); \
38 __asm__ __volatile__( \
39 "ldr %0, [%1, %2]" \
40 : "=r" (__v) \
41 : "r" (__r), "Ir" (o)); \
42 __v; \
43 })
44
45#define __arch_base_putb(v,b,o) \
46 ({ \
47 unsigned int __r = (b); \
48 __asm__ __volatile__( \
49 "strb %0, [%1, %2]" \
50 : \
51 : "r" (v), "r" (__r), "Ir" (o));\
52 })
53
54#define __arch_base_putl(v,b,o) \
55 ({ \
56 unsigned int __r = (b); \
57 __asm__ __volatile__( \
58 "str %0, [%1, %2]" \
59 : \
60 : "r" (v), "r" (__r), "Ir" (o));\
61 })
62
63/*
64 * We use two different types of addressing - PC style addresses, and ARM
65 * addresses. PC style accesses the PC hardware with the normal PC IO
66 * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+
67 * and are translated to the start of IO. Note that all addresses are
68 * shifted left!
69 */
70#define __PORT_PCIO(x) (!((x) & 0x80000000))
71
72/*
73 * Dynamic IO functions.
74 */
75static inline void __outb (unsigned int value, unsigned int port)
76{
77 unsigned long temp;
78 __asm__ __volatile__(
79 "tst %2, #0x80000000\n\t"
80 "mov %0, %4\n\t"
81 "addeq %0, %0, %3\n\t"
82 "strb %1, [%0, %2, lsl #2] @ outb"
83 : "=&r" (temp)
84 : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
85 : "cc");
86}
87
88static inline void __outw (unsigned int value, unsigned int port)
89{
90 unsigned long temp;
91 __asm__ __volatile__(
92 "tst %2, #0x80000000\n\t"
93 "mov %0, %4\n\t"
94 "addeq %0, %0, %3\n\t"
95 "str %1, [%0, %2, lsl #2] @ outw"
96 : "=&r" (temp)
97 : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
98 : "cc");
99}
100
101static inline void __outl (unsigned int value, unsigned int port)
102{
103 unsigned long temp;
104 __asm__ __volatile__(
105 "tst %2, #0x80000000\n\t"
106 "mov %0, %4\n\t"
107 "addeq %0, %0, %3\n\t"
108 "str %1, [%0, %2, lsl #2] @ outl"
109 : "=&r" (temp)
110 : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
111 : "cc");
112}
113
114#define DECLARE_DYN_IN(sz,fnsuffix,instr) \
115static inline unsigned sz __in##fnsuffix (unsigned int port) \
116{ \
117 unsigned long temp, value; \
118 __asm__ __volatile__( \
119 "tst %2, #0x80000000\n\t" \
120 "mov %0, %4\n\t" \
121 "addeq %0, %0, %3\n\t" \
122 "ldr" instr " %1, [%0, %2, lsl #2] @ in" #fnsuffix \
123 : "=&r" (temp), "=r" (value) \
124 : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \
125 : "cc"); \
126 return (unsigned sz)value; \
127}
128
129static inline void __iomem *__deprecated __ioaddr(unsigned int port)
130{
131 void __iomem *ret;
132 if (__PORT_PCIO(port))
133 ret = PCIO_BASE;
134 else
135 ret = IO_BASE;
136 return ret + (port << 2);
137}
138
139#define DECLARE_IO(sz,fnsuffix,instr) \
140 DECLARE_DYN_IN(sz,fnsuffix,instr)
141
142DECLARE_IO(char,b,"b")
143DECLARE_IO(short,w,"")
144DECLARE_IO(int,l,"")
145
146#undef DECLARE_IO
147#undef DECLARE_DYN_IN
148
149/*
150 * Constant address IO functions
151 *
152 * These have to be macros for the 'J' constraint to work -
153 * +/-4096 immediate operand.
154 */
155#define __outbc(value,port) \
156({ \
157 if (__PORT_PCIO((port))) \
158 __asm__ __volatile__( \
159 "strb %0, [%1, %2] @ outbc" \
160 : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
161 else \
162 __asm__ __volatile__( \
163 "strb %0, [%1, %2] @ outbc" \
164 : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \
165})
166
167#define __inbc(port) \
168({ \
169 unsigned char result; \
170 if (__PORT_PCIO((port))) \
171 __asm__ __volatile__( \
172 "ldrb %0, [%1, %2] @ inbc" \
173 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
174 else \
175 __asm__ __volatile__( \
176 "ldrb %0, [%1, %2] @ inbc" \
177 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
178 result; \
179})
180
181#define __outwc(value,port) \
182({ \
183 unsigned long __v = value; \
184 if (__PORT_PCIO((port))) \
185 __asm__ __volatile__( \
186 "str %0, [%1, %2] @ outwc" \
187 : : "r" (__v|__v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
188 else \
189 __asm__ __volatile__( \
190 "str %0, [%1, %2] @ outwc" \
191 : : "r" (__v|__v<<16), "r" (IO_BASE), "r" ((port) << 2)); \
192})
193
194#define __inwc(port) \
195({ \
196 unsigned short result; \
197 if (__PORT_PCIO((port))) \
198 __asm__ __volatile__( \
199 "ldr %0, [%1, %2] @ inwc" \
200 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
201 else \
202 __asm__ __volatile__( \
203 "ldr %0, [%1, %2] @ inwc" \
204 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
205 result & 0xffff; \
206})
207
208#define __outlc(value,port) \
209({ \
210 unsigned long __v = value; \
211 if (__PORT_PCIO((port))) \
212 __asm__ __volatile__( \
213 "str %0, [%1, %2] @ outlc" \
214 : : "r" (__v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
215 else \
216 __asm__ __volatile__( \
217 "str %0, [%1, %2] @ outlc" \
218 : : "r" (__v), "r" (IO_BASE), "r" ((port) << 2)); \
219})
220
221#define __inlc(port) \
222({ \
223 unsigned long result; \
224 if (__PORT_PCIO((port))) \
225 __asm__ __volatile__( \
226 "ldr %0, [%1, %2] @ inlc" \
227 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
228 else \
229 __asm__ __volatile__( \
230 "ldr %0, [%1, %2] @ inlc" \
231 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
232 result; \
233})
234
235#define __ioaddrc(port) __ioaddr(port)
236
237#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p))
238#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p))
239#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p))
240#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
241#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
242#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
243#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p))
244/* the following macro is deprecated */
245#define ioaddr(port) ((unsigned long)__ioaddr((port)))
246
247#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l)
248#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l)
249
250#define outsb(p,d,l) __raw_writesb(__ioaddr(p),d,l)
251#define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l)
252
253/*
254 * 1:1 mapping for ioremapped regions.
255 */
256#define __mem_pci(x) (x)
257
258#endif
diff --git a/arch/arm/mach-rpc/include/mach/irqs.h b/arch/arm/mach-rpc/include/mach/irqs.h
new file mode 100644
index 000000000000..4ce6ca97f669
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/irqs.h
@@ -0,0 +1,46 @@
1/*
2 * arch/arm/mach-rpc/include/mach/irqs.h
3 *
4 * Copyright (C) 1996 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#define IRQ_PRINTER 0
12#define IRQ_BATLOW 1
13#define IRQ_FLOPPYINDEX 2
14#define IRQ_VSYNCPULSE 3
15#define IRQ_POWERON 4
16#define IRQ_TIMER0 5
17#define IRQ_TIMER1 6
18#define IRQ_IMMEDIATE 7
19#define IRQ_EXPCARDFIQ 8
20#define IRQ_HARDDISK 9
21#define IRQ_SERIALPORT 10
22#define IRQ_FLOPPYDISK 12
23#define IRQ_EXPANSIONCARD 13
24#define IRQ_KEYBOARDTX 14
25#define IRQ_KEYBOARDRX 15
26
27#define IRQ_DMA0 16
28#define IRQ_DMA1 17
29#define IRQ_DMA2 18
30#define IRQ_DMA3 19
31#define IRQ_DMAS0 20
32#define IRQ_DMAS1 21
33
34#define FIQ_FLOPPYDATA 0
35#define FIQ_ECONET 2
36#define FIQ_SERIALPORT 4
37#define FIQ_EXPANSIONCARD 6
38#define FIQ_FORCE 7
39
40/*
41 * This is the offset of the FIQ "IRQ" numbers
42 */
43#define FIQ_START 64
44
45#define IRQ_TIMER IRQ_TIMER0
46
diff --git a/arch/arm/mach-rpc/include/mach/memory.h b/arch/arm/mach-rpc/include/mach/memory.h
new file mode 100644
index 000000000000..05425d558ee7
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/memory.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-rpc/include/mach/memory.h
3 *
4 * Copyright (C) 1996,1997,1998 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Changelog:
11 * 20-Oct-1996 RMK Created
12 * 31-Dec-1997 RMK Fixed definitions to reduce warnings
13 * 11-Jan-1998 RMK Uninlined to reduce hits on cache
14 * 08-Feb-1998 RMK Added __virt_to_bus and __bus_to_virt
15 * 21-Mar-1999 RMK Renamed to memory.h
16 * RMK Added TASK_SIZE and PAGE_OFFSET
17 */
18#ifndef __ASM_ARCH_MEMORY_H
19#define __ASM_ARCH_MEMORY_H
20
21/*
22 * Physical DRAM offset.
23 */
24#define PHYS_OFFSET UL(0x10000000)
25
26/*
27 * These are exactly the same on the RiscPC as the
28 * physical memory view.
29 */
30#define __virt_to_bus(x) __virt_to_phys(x)
31#define __bus_to_virt(x) __phys_to_virt(x)
32
33/*
34 * Cache flushing area - ROM
35 */
36#define FLUSH_BASE_PHYS 0x00000000
37#define FLUSH_BASE 0xdf000000
38
39#endif
diff --git a/arch/arm/mach-rpc/include/mach/system.h b/arch/arm/mach-rpc/include/mach/system.h
new file mode 100644
index 000000000000..54d6e3f2d319
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/system.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-rpc/include/mach/system.h
3 *
4 * Copyright (C) 1996-1999 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <mach/hardware.h>
11#include <asm/hardware/iomd.h>
12#include <asm/io.h>
13
14static inline void arch_idle(void)
15{
16 cpu_do_idle();
17}
18
19static inline void arch_reset(char mode)
20{
21 iomd_writeb(0, IOMD_ROMCR0);
22
23 /*
24 * Jump into the ROM
25 */
26 cpu_reset(0);
27}
diff --git a/arch/arm/mach-rpc/include/mach/timex.h b/arch/arm/mach-rpc/include/mach/timex.h
new file mode 100644
index 000000000000..dd75e7387bbe
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/timex.h
@@ -0,0 +1,17 @@
1/*
2 * arch/arm/mach-rpc/include/mach/timex.h
3 *
4 * Copyright (C) 1997, 1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * RiscPC architecture timex specifications
11 */
12
13/*
14 * On the RiscPC, the clock ticks at 2MHz.
15 */
16#define CLOCK_TICK_RATE 2000000
17
diff --git a/arch/arm/mach-rpc/include/mach/uncompress.h b/arch/arm/mach-rpc/include/mach/uncompress.h
new file mode 100644
index 000000000000..baa9c866d7bf
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/uncompress.h
@@ -0,0 +1,198 @@
1/*
2 * arch/arm/mach-rpc/include/mach/uncompress.h
3 *
4 * Copyright (C) 1996 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#define VIDMEM ((char *)SCREEN_START)
11
12#include <mach/hardware.h>
13#include <asm/io.h>
14#include <asm/setup.h>
15#include <asm/page.h>
16
17int video_size_row;
18unsigned char bytes_per_char_h;
19extern unsigned long con_charconvtable[256];
20
21struct param_struct {
22 unsigned long page_size;
23 unsigned long nr_pages;
24 unsigned long ramdisk_size;
25 unsigned long mountrootrdonly;
26 unsigned long rootdev;
27 unsigned long video_num_cols;
28 unsigned long video_num_rows;
29 unsigned long video_x;
30 unsigned long video_y;
31 unsigned long memc_control_reg;
32 unsigned char sounddefault;
33 unsigned char adfsdrives;
34 unsigned char bytes_per_char_h;
35 unsigned char bytes_per_char_v;
36 unsigned long unused[256/4-11];
37};
38
39static const unsigned long palette_4[16] = {
40 0x00000000,
41 0x000000cc,
42 0x0000cc00, /* Green */
43 0x0000cccc, /* Yellow */
44 0x00cc0000, /* Blue */
45 0x00cc00cc, /* Magenta */
46 0x00cccc00, /* Cyan */
47 0x00cccccc, /* White */
48 0x00000000,
49 0x000000ff,
50 0x0000ff00,
51 0x0000ffff,
52 0x00ff0000,
53 0x00ff00ff,
54 0x00ffff00,
55 0x00ffffff
56};
57
58#define palette_setpixel(p) *(unsigned long *)(IO_START+0x00400000) = 0x10000000|((p) & 255)
59#define palette_write(v) *(unsigned long *)(IO_START+0x00400000) = 0x00000000|((v) & 0x00ffffff)
60
61/*
62 * params_phys is a linker defined symbol - see
63 * arch/arm/boot/compressed/Makefile
64 */
65extern __attribute__((pure)) struct param_struct *params(void);
66#define params (params())
67
68#ifndef STANDALONE_DEBUG
69static unsigned long video_num_cols;
70static unsigned long video_num_rows;
71static unsigned long video_x;
72static unsigned long video_y;
73static unsigned char bytes_per_char_v;
74static int white;
75
76/*
77 * This does not append a newline
78 */
79static void putc(int c)
80{
81 extern void ll_write_char(char *, char c, char white);
82 int x,y;
83 char *ptr;
84
85 x = video_x;
86 y = video_y;
87
88 if (c == '\n') {
89 if (++y >= video_num_rows)
90 y--;
91 } else if (c == '\r') {
92 x = 0;
93 } else {
94 ptr = VIDMEM + ((y*video_num_cols*bytes_per_char_v+x)*bytes_per_char_h);
95 ll_write_char(ptr, c, white);
96 if (++x >= video_num_cols) {
97 x = 0;
98 if ( ++y >= video_num_rows ) {
99 y--;
100 }
101 }
102 }
103
104 video_x = x;
105 video_y = y;
106}
107
108static inline void flush(void)
109{
110}
111
112static void error(char *x);
113
114/*
115 * Setup for decompression
116 */
117static void arch_decomp_setup(void)
118{
119 int i;
120 struct tag *t = (struct tag *)params;
121 unsigned int nr_pages = 0, page_size = PAGE_SIZE;
122
123 if (t->hdr.tag == ATAG_CORE)
124 {
125 for (; t->hdr.size; t = tag_next(t))
126 {
127 if (t->hdr.tag == ATAG_VIDEOTEXT)
128 {
129 video_num_rows = t->u.videotext.video_lines;
130 video_num_cols = t->u.videotext.video_cols;
131 bytes_per_char_h = t->u.videotext.video_points;
132 bytes_per_char_v = t->u.videotext.video_points;
133 video_x = t->u.videotext.x;
134 video_y = t->u.videotext.y;
135 }
136
137 if (t->hdr.tag == ATAG_MEM)
138 {
139 page_size = PAGE_SIZE;
140 nr_pages += (t->u.mem.size / PAGE_SIZE);
141 }
142 }
143 }
144 else
145 {
146 nr_pages = params->nr_pages;
147 page_size = params->page_size;
148 video_num_rows = params->video_num_rows;
149 video_num_cols = params->video_num_cols;
150 video_x = params->video_x;
151 video_y = params->video_y;
152 bytes_per_char_h = params->bytes_per_char_h;
153 bytes_per_char_v = params->bytes_per_char_v;
154 }
155
156 video_size_row = video_num_cols * bytes_per_char_h;
157
158 if (bytes_per_char_h == 4)
159 for (i = 0; i < 256; i++)
160 con_charconvtable[i] =
161 (i & 128 ? 1 << 0 : 0) |
162 (i & 64 ? 1 << 4 : 0) |
163 (i & 32 ? 1 << 8 : 0) |
164 (i & 16 ? 1 << 12 : 0) |
165 (i & 8 ? 1 << 16 : 0) |
166 (i & 4 ? 1 << 20 : 0) |
167 (i & 2 ? 1 << 24 : 0) |
168 (i & 1 ? 1 << 28 : 0);
169 else
170 for (i = 0; i < 16; i++)
171 con_charconvtable[i] =
172 (i & 8 ? 1 << 0 : 0) |
173 (i & 4 ? 1 << 8 : 0) |
174 (i & 2 ? 1 << 16 : 0) |
175 (i & 1 ? 1 << 24 : 0);
176
177
178 palette_setpixel(0);
179 if (bytes_per_char_h == 1) {
180 palette_write (0);
181 palette_write (0x00ffffff);
182 for (i = 2; i < 256; i++)
183 palette_write (0);
184 white = 1;
185 } else {
186 for (i = 0; i < 256; i++)
187 palette_write (i < 16 ? palette_4[i] : 0);
188 white = 7;
189 }
190
191 if (nr_pages * page_size < 4096*1024) error("<4M of mem\n");
192}
193#endif
194
195/*
196 * nothing to do
197 */
198#define arch_decomp_wdog()
diff --git a/arch/arm/mach-rpc/include/mach/vmalloc.h b/arch/arm/mach-rpc/include/mach/vmalloc.h
new file mode 100644
index 000000000000..9a96fd69e705
--- /dev/null
+++ b/arch/arm/mach-rpc/include/mach/vmalloc.h
@@ -0,0 +1,10 @@
1/*
2 * arch/arm/mach-rpc/include/mach/vmalloc.h
3 *
4 * Copyright (C) 1997 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#define VMALLOC_END (PAGE_OFFSET + 0x1c000000)
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index eca558c6bf5d..ce8470fea887 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -22,7 +22,7 @@
22#include <asm/elf.h> 22#include <asm/elf.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/page.h> 26#include <asm/page.h>
27#include <asm/domain.h> 27#include <asm/domain.h>
28#include <asm/setup.h> 28#include <asm/setup.h>
diff --git a/arch/arm/mach-s3c2400/gpio.c b/arch/arm/mach-s3c2400/gpio.c
index 758e160410e9..148d0ddef3e8 100644
--- a/arch/arm/mach-s3c2400/gpio.c
+++ b/arch/arm/mach-s3c2400/gpio.c
@@ -25,11 +25,11 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/io.h> 30#include <asm/io.h>
31 31
32#include <asm/arch/regs-gpio.h> 32#include <mach/regs-gpio.h>
33 33
34int s3c2400_gpio_getirq(unsigned int pin) 34int s3c2400_gpio_getirq(unsigned int pin)
35{ 35{
diff --git a/arch/arm/mach-s3c2400/include/mach/map.h b/arch/arm/mach-s3c2400/include/mach/map.h
new file mode 100644
index 000000000000..1535540edc82
--- /dev/null
+++ b/arch/arm/mach-s3c2400/include/mach/map.h
@@ -0,0 +1,66 @@
1/* arch/arm/mach-s3c2400/include/mach/map.h
2 *
3 * Copyright 2003,2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Copyright 2003, Lucas Correia Villa Real
8 *
9 * S3C2400 - Memory map definitions
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#define S3C2400_PA_MEMCTRL (0x14000000)
17#define S3C2400_PA_USBHOST (0x14200000)
18#define S3C2400_PA_IRQ (0x14400000)
19#define S3C2400_PA_DMA (0x14600000)
20#define S3C2400_PA_CLKPWR (0x14800000)
21#define S3C2400_PA_LCD (0x14A00000)
22#define S3C2400_PA_UART (0x15000000)
23#define S3C2400_PA_TIMER (0x15100000)
24#define S3C2400_PA_USBDEV (0x15200140)
25#define S3C2400_PA_WATCHDOG (0x15300000)
26#define S3C2400_PA_IIC (0x15400000)
27#define S3C2400_PA_IIS (0x15508000)
28#define S3C2400_PA_GPIO (0x15600000)
29#define S3C2400_PA_RTC (0x15700040)
30#define S3C2400_PA_ADC (0x15800000)
31#define S3C2400_PA_SPI (0x15900000)
32
33#define S3C2400_PA_MMC (0x15A00000)
34#define S3C2400_SZ_MMC SZ_1M
35
36/* physical addresses of all the chip-select areas */
37
38#define S3C2400_CS0 (0x00000000)
39#define S3C2400_CS1 (0x02000000)
40#define S3C2400_CS2 (0x04000000)
41#define S3C2400_CS3 (0x06000000)
42#define S3C2400_CS4 (0x08000000)
43#define S3C2400_CS5 (0x0A000000)
44#define S3C2400_CS6 (0x0C000000)
45#define S3C2400_CS7 (0x0E000000)
46
47#define S3C2400_SDRAM_PA (S3C2400_CS6)
48
49/* Use a single interface for common resources between S3C24XX cpus */
50
51#define S3C24XX_PA_IRQ S3C2400_PA_IRQ
52#define S3C24XX_PA_MEMCTRL S3C2400_PA_MEMCTRL
53#define S3C24XX_PA_USBHOST S3C2400_PA_USBHOST
54#define S3C24XX_PA_DMA S3C2400_PA_DMA
55#define S3C24XX_PA_CLKPWR S3C2400_PA_CLKPWR
56#define S3C24XX_PA_LCD S3C2400_PA_LCD
57#define S3C24XX_PA_UART S3C2400_PA_UART
58#define S3C24XX_PA_TIMER S3C2400_PA_TIMER
59#define S3C24XX_PA_USBDEV S3C2400_PA_USBDEV
60#define S3C24XX_PA_WATCHDOG S3C2400_PA_WATCHDOG
61#define S3C24XX_PA_IIC S3C2400_PA_IIC
62#define S3C24XX_PA_IIS S3C2400_PA_IIS
63#define S3C24XX_PA_GPIO S3C2400_PA_GPIO
64#define S3C24XX_PA_RTC S3C2400_PA_RTC
65#define S3C24XX_PA_ADC S3C2400_PA_ADC
66#define S3C24XX_PA_SPI S3C2400_PA_SPI
diff --git a/arch/arm/mach-s3c2400/include/mach/memory.h b/arch/arm/mach-s3c2400/include/mach/memory.h
new file mode 100644
index 000000000000..8f4878e4f591
--- /dev/null
+++ b/arch/arm/mach-s3c2400/include/mach/memory.h
@@ -0,0 +1,23 @@
1/* arch/arm/mach-s3c2400/include/mach/memory.h
2 * from arch/arm/mach-rpc/include/mach/memory.h
3 *
4 * Copyright 2007 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * Copyright (C) 1996,1997,1998 Russell King.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_MEMORY_H
16#define __ASM_ARCH_MEMORY_H
17
18#define PHYS_OFFSET UL(0x0C000000)
19
20#define __virt_to_bus(x) __virt_to_phys(x)
21#define __bus_to_virt(x) __phys_to_virt(x)
22
23#endif
diff --git a/arch/arm/mach-s3c2410/bast-ide.c b/arch/arm/mach-s3c2410/bast-ide.c
index df95fe37cdc8..298ececfa366 100644
--- a/arch/arm/mach-s3c2410/bast-ide.c
+++ b/arch/arm/mach-s3c2410/bast-ide.c
@@ -24,9 +24,9 @@
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26 26
27#include <asm/arch/map.h> 27#include <mach/map.h>
28#include <asm/arch/bast-map.h> 28#include <mach/bast-map.h>
29#include <asm/arch/bast-irq.h> 29#include <mach/bast-irq.h>
30 30
31/* IDE ports */ 31/* IDE ports */
32 32
diff --git a/arch/arm/mach-s3c2410/bast-irq.c b/arch/arm/mach-s3c2410/bast-irq.c
index 76a7cb15f3be..c66021b5fa4d 100644
--- a/arch/arm/mach-s3c2410/bast-irq.c
+++ b/arch/arm/mach-s3c2410/bast-irq.c
@@ -28,15 +28,15 @@
28 28
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30 30
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/io.h> 33#include <asm/io.h>
34 34
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36 36
37#include <asm/arch/regs-irq.h> 37#include <mach/regs-irq.h>
38#include <asm/arch/bast-map.h> 38#include <mach/bast-map.h>
39#include <asm/arch/bast-irq.h> 39#include <mach/bast-irq.h>
40 40
41#include <asm/plat-s3c24xx/irq.h> 41#include <asm/plat-s3c24xx/irq.h>
42 42
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c
index 2bfaa6102025..1322851d1acb 100644
--- a/arch/arm/mach-s3c2410/clock.c
+++ b/arch/arm/mach-s3c2410/clock.c
@@ -34,12 +34,12 @@
34 34
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36 36
37#include <asm/hardware.h> 37#include <mach/hardware.h>
38#include <asm/io.h> 38#include <asm/io.h>
39 39
40#include <asm/plat-s3c/regs-serial.h> 40#include <asm/plat-s3c/regs-serial.h>
41#include <asm/arch/regs-clock.h> 41#include <mach/regs-clock.h>
42#include <asm/arch/regs-gpio.h> 42#include <mach/regs-gpio.h>
43 43
44#include <asm/plat-s3c24xx/s3c2410.h> 44#include <asm/plat-s3c24xx/s3c2410.h>
45#include <asm/plat-s3c24xx/clock.h> 45#include <asm/plat-s3c24xx/clock.h>
diff --git a/arch/arm/mach-s3c2410/dma.c b/arch/arm/mach-s3c2410/dma.c
index 8f12e855ef5f..8730797749e3 100644
--- a/arch/arm/mach-s3c2410/dma.c
+++ b/arch/arm/mach-s3c2410/dma.c
@@ -18,17 +18,17 @@
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19 19
20#include <asm/dma.h> 20#include <asm/dma.h>
21#include <asm/arch/dma.h> 21#include <mach/dma.h>
22 22
23#include <asm/plat-s3c24xx/cpu.h> 23#include <asm/plat-s3c24xx/cpu.h>
24#include <asm/plat-s3c24xx/dma.h> 24#include <asm/plat-s3c24xx/dma.h>
25 25
26#include <asm/plat-s3c/regs-serial.h> 26#include <asm/plat-s3c/regs-serial.h>
27#include <asm/arch/regs-gpio.h> 27#include <mach/regs-gpio.h>
28#include <asm/plat-s3c/regs-ac97.h> 28#include <asm/plat-s3c/regs-ac97.h>
29#include <asm/arch/regs-mem.h> 29#include <mach/regs-mem.h>
30#include <asm/arch/regs-lcd.h> 30#include <mach/regs-lcd.h>
31#include <asm/arch/regs-sdi.h> 31#include <mach/regs-sdi.h>
32#include <asm/plat-s3c24xx/regs-iis.h> 32#include <asm/plat-s3c24xx/regs-iis.h>
33#include <asm/plat-s3c24xx/regs-spi.h> 33#include <asm/plat-s3c24xx/regs-spi.h>
34 34
diff --git a/arch/arm/mach-s3c2410/gpio.c b/arch/arm/mach-s3c2410/gpio.c
index 01e795d1146e..c6eefb1d590c 100644
--- a/arch/arm/mach-s3c2410/gpio.c
+++ b/arch/arm/mach-s3c2410/gpio.c
@@ -26,11 +26,11 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/ioport.h> 27#include <linux/ioport.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/io.h> 31#include <asm/io.h>
32 32
33#include <asm/arch/regs-gpio.h> 33#include <mach/regs-gpio.h>
34 34
35int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on, 35int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
36 unsigned int config) 36 unsigned int config)
diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 3c48886521e7..5a6bc56f186b 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -16,9 +16,9 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/ctype.h> 17#include <linux/ctype.h>
18#include <linux/leds.h> 18#include <linux/leds.h>
19#include <asm/arch/regs-gpio.h> 19#include <mach/regs-gpio.h>
20#include <asm/hardware.h> 20#include <mach/hardware.h>
21#include <asm/arch/h1940-latch.h> 21#include <mach/h1940-latch.h>
22 22
23#define DRV_NAME "h1940-bt" 23#define DRV_NAME "h1940-bt"
24 24
diff --git a/arch/arm/mach-s3c2410/include/mach/anubis-cpld.h b/arch/arm/mach-s3c2410/include/mach/anubis-cpld.h
new file mode 100644
index 000000000000..1b614d5a81f3
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/anubis-cpld.h
@@ -0,0 +1,25 @@
1/* arch/arm/mach-s3c2410/include/mach/anubis-cpld.h
2 *
3 * Copyright (c) 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * ANUBIS - CPLD control constants
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_ANUBISCPLD_H
15#define __ASM_ARCH_ANUBISCPLD_H
16
17/* CTRL2 - NAND WP control, IDE Reset assert/check */
18
19#define ANUBIS_CTRL1_NANDSEL (0x3)
20
21/* IDREG - revision */
22
23#define ANUBIS_IDREG_REVMASK (0x7)
24
25#endif /* __ASM_ARCH_ANUBISCPLD_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/anubis-irq.h b/arch/arm/mach-s3c2410/include/mach/anubis-irq.h
new file mode 100644
index 000000000000..a2a328134e34
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/anubis-irq.h
@@ -0,0 +1,21 @@
1/* arch/arm/mach-s3c2410/include/mach/anubis-irq.h
2 *
3 * Copyright (c) 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * ANUBIS - IRQ Number definitions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_ANUBISIRQ_H
15#define __ASM_ARCH_ANUBISIRQ_H
16
17#define IRQ_IDE0 IRQ_EINT2
18#define IRQ_IDE1 IRQ_EINT3
19#define IRQ_ASIX IRQ_EINT1
20
21#endif /* __ASM_ARCH_ANUBISIRQ_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/anubis-map.h b/arch/arm/mach-s3c2410/include/mach/anubis-map.h
new file mode 100644
index 000000000000..c9deb3a5b2c3
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/anubis-map.h
@@ -0,0 +1,38 @@
1/* arch/arm/mach-s3c2410/include/mach/anubis-map.h
2 *
3 * Copyright (c) 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * ANUBIS - Memory map definitions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14/* needs arch/map.h including with this */
15
16#ifndef __ASM_ARCH_ANUBISMAP_H
17#define __ASM_ARCH_ANUBISMAP_H
18
19/* start peripherals off after the S3C2410 */
20
21#define ANUBIS_IOADDR(x) (S3C2410_ADDR((x) + 0x01800000))
22
23#define ANUBIS_PA_CPLD (S3C2410_CS1 | (1<<26))
24
25/* we put the CPLD registers next, to get them out of the way */
26
27#define ANUBIS_VA_CTRL1 ANUBIS_IOADDR(0x00000000) /* 0x01800000 */
28#define ANUBIS_PA_CTRL1 (ANUBIS_PA_CPLD)
29
30#define ANUBIS_VA_IDREG ANUBIS_IOADDR(0x00300000) /* 0x01B00000 */
31#define ANUBIS_PA_IDREG (ANUBIS_PA_CPLD + (3<<23))
32
33#define ANUBIS_IDEPRI ANUBIS_IOADDR(0x01000000)
34#define ANUBIS_IDEPRIAUX ANUBIS_IOADDR(0x01100000)
35#define ANUBIS_IDESEC ANUBIS_IOADDR(0x01200000)
36#define ANUBIS_IDESECAUX ANUBIS_IOADDR(0x01300000)
37
38#endif /* __ASM_ARCH_ANUBISMAP_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/audio.h b/arch/arm/mach-s3c2410/include/mach/audio.h
new file mode 100644
index 000000000000..de0e8da48bc3
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/audio.h
@@ -0,0 +1,45 @@
1/* arch/arm/mach-s3c2410/include/mach/audio.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/SWLINUX/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX - Audio platfrom_device info
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_AUDIO_H
15#define __ASM_ARCH_AUDIO_H __FILE__
16
17/* struct s3c24xx_iis_ops
18 *
19 * called from the s3c24xx audio core to deal with the architecture
20 * or the codec's setup and control.
21 *
22 * the pointer to itself is passed through in case the caller wants to
23 * embed this in an larger structure for easy reference to it's context.
24*/
25
26struct s3c24xx_iis_ops {
27 struct module *owner;
28
29 int (*startup)(struct s3c24xx_iis_ops *me);
30 void (*shutdown)(struct s3c24xx_iis_ops *me);
31 int (*suspend)(struct s3c24xx_iis_ops *me);
32 int (*resume)(struct s3c24xx_iis_ops *me);
33
34 int (*open)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm);
35 int (*close)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm);
36 int (*prepare)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm, struct snd_pcm_runtime *rt);
37};
38
39struct s3c24xx_platdata_iis {
40 const char *codec_clk;
41 struct s3c24xx_iis_ops *ops;
42 int (*match_dev)(struct device *dev);
43};
44
45#endif /* __ASM_ARCH_AUDIO_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-cpld.h b/arch/arm/mach-s3c2410/include/mach/bast-cpld.h
new file mode 100644
index 000000000000..20493b048360
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/bast-cpld.h
@@ -0,0 +1,53 @@
1/* arch/arm/mach-s3c2410/include/mach/bast-cpld.h
2 *
3 * Copyright (c) 2003,2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * BAST - CPLD control constants
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_BASTCPLD_H
14#define __ASM_ARCH_BASTCPLD_H
15
16/* CTRL1 - Audio LR routing */
17
18#define BAST_CPLD_CTRL1_LRCOFF (0x00)
19#define BAST_CPLD_CTRL1_LRCADC (0x01)
20#define BAST_CPLD_CTRL1_LRCDAC (0x02)
21#define BAST_CPLD_CTRL1_LRCARM (0x03)
22#define BAST_CPLD_CTRL1_LRMASK (0x03)
23
24/* CTRL2 - NAND WP control, IDE Reset assert/check */
25
26#define BAST_CPLD_CTRL2_WNAND (0x04)
27#define BAST_CPLD_CTLR2_IDERST (0x08)
28
29/* CTRL3 - rom write control, CPLD identity */
30
31#define BAST_CPLD_CTRL3_IDMASK (0x0e)
32#define BAST_CPLD_CTRL3_ROMWEN (0x01)
33
34/* CTRL4 - 8bit LCD interface control/status */
35
36#define BAST_CPLD_CTRL4_LLAT (0x01)
37#define BAST_CPLD_CTRL4_LCDRW (0x02)
38#define BAST_CPLD_CTRL4_LCDCMD (0x04)
39#define BAST_CPLD_CTRL4_LCDE2 (0x01)
40
41/* CTRL5 - DMA routing */
42
43#define BAST_CPLD_DMA0_PRIIDE (0<<0)
44#define BAST_CPLD_DMA0_SECIDE (1<<0)
45#define BAST_CPLD_DMA0_ISA15 (2<<0)
46#define BAST_CPLD_DMA0_ISA36 (3<<0)
47
48#define BAST_CPLD_DMA1_PRIIDE (0<<2)
49#define BAST_CPLD_DMA1_SECIDE (1<<2)
50#define BAST_CPLD_DMA1_ISA15 (2<<2)
51#define BAST_CPLD_DMA1_ISA36 (3<<2)
52
53#endif /* __ASM_ARCH_BASTCPLD_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-irq.h b/arch/arm/mach-s3c2410/include/mach/bast-irq.h
new file mode 100644
index 000000000000..501c202b53cf
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/bast-irq.h
@@ -0,0 +1,29 @@
1/* arch/arm/mach-s3c2410/include/mach/bast-irq.h
2 *
3 * Copyright (c) 2003,2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Machine BAST - IRQ Number definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_BASTIRQ_H
14#define __ASM_ARCH_BASTIRQ_H
15
16/* irq numbers to onboard peripherals */
17
18#define IRQ_USBOC IRQ_EINT18
19#define IRQ_IDE0 IRQ_EINT16
20#define IRQ_IDE1 IRQ_EINT17
21#define IRQ_PCSERIAL1 IRQ_EINT15
22#define IRQ_PCSERIAL2 IRQ_EINT14
23#define IRQ_PCPARALLEL IRQ_EINT13
24#define IRQ_ASIX IRQ_EINT11
25#define IRQ_DM9000 IRQ_EINT10
26#define IRQ_ISA IRQ_EINT9
27#define IRQ_SMALERT IRQ_EINT8
28
29#endif /* __ASM_ARCH_BASTIRQ_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-map.h b/arch/arm/mach-s3c2410/include/mach/bast-map.h
new file mode 100644
index 000000000000..c2c5baf07345
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/bast-map.h
@@ -0,0 +1,146 @@
1/* arch/arm/mach-s3c2410/include/mach/bast-map.h
2 *
3 * Copyright (c) 2003,2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Machine BAST - Memory map definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13/* needs arch/map.h including with this */
14
15/* ok, we've used up to 0x13000000, now we need to find space for the
16 * peripherals that live in the nGCS[x] areas, which are quite numerous
17 * in their space. We also have the board's CPLD to find register space
18 * for.
19 */
20
21#ifndef __ASM_ARCH_BASTMAP_H
22#define __ASM_ARCH_BASTMAP_H
23
24#define BAST_IOADDR(x) (S3C2410_ADDR((x) + 0x01300000))
25
26/* we put the CPLD registers next, to get them out of the way */
27
28#define BAST_VA_CTRL1 BAST_IOADDR(0x00000000) /* 0x01300000 */
29#define BAST_PA_CTRL1 (S3C2410_CS5 | 0x7800000)
30
31#define BAST_VA_CTRL2 BAST_IOADDR(0x00100000) /* 0x01400000 */
32#define BAST_PA_CTRL2 (S3C2410_CS1 | 0x6000000)
33
34#define BAST_VA_CTRL3 BAST_IOADDR(0x00200000) /* 0x01500000 */
35#define BAST_PA_CTRL3 (S3C2410_CS1 | 0x6800000)
36
37#define BAST_VA_CTRL4 BAST_IOADDR(0x00300000) /* 0x01600000 */
38#define BAST_PA_CTRL4 (S3C2410_CS1 | 0x7000000)
39
40/* next, we have the PC104 ISA interrupt registers */
41
42#define BAST_PA_PC104_IRQREQ (S3C2410_CS5 | 0x6000000) /* 0x01700000 */
43#define BAST_VA_PC104_IRQREQ BAST_IOADDR(0x00400000)
44
45#define BAST_PA_PC104_IRQRAW (S3C2410_CS5 | 0x6800000) /* 0x01800000 */
46#define BAST_VA_PC104_IRQRAW BAST_IOADDR(0x00500000)
47
48#define BAST_PA_PC104_IRQMASK (S3C2410_CS5 | 0x7000000) /* 0x01900000 */
49#define BAST_VA_PC104_IRQMASK BAST_IOADDR(0x00600000)
50
51#define BAST_PA_LCD_RCMD1 (0x8800000)
52#define BAST_VA_LCD_RCMD1 BAST_IOADDR(0x00700000)
53
54#define BAST_PA_LCD_WCMD1 (0x8000000)
55#define BAST_VA_LCD_WCMD1 BAST_IOADDR(0x00800000)
56
57#define BAST_PA_LCD_RDATA1 (0x9800000)
58#define BAST_VA_LCD_RDATA1 BAST_IOADDR(0x00900000)
59
60#define BAST_PA_LCD_WDATA1 (0x9000000)
61#define BAST_VA_LCD_WDATA1 BAST_IOADDR(0x00A00000)
62
63#define BAST_PA_LCD_RCMD2 (0xA800000)
64#define BAST_VA_LCD_RCMD2 BAST_IOADDR(0x00B00000)
65
66#define BAST_PA_LCD_WCMD2 (0xA000000)
67#define BAST_VA_LCD_WCMD2 BAST_IOADDR(0x00C00000)
68
69#define BAST_PA_LCD_RDATA2 (0xB800000)
70#define BAST_VA_LCD_RDATA2 BAST_IOADDR(0x00D00000)
71
72#define BAST_PA_LCD_WDATA2 (0xB000000)
73#define BAST_VA_LCD_WDATA2 BAST_IOADDR(0x00E00000)
74
75
76/* 0xE0000000 contains the IO space that is split by speed and
77 * wether the access is for 8 or 16bit IO... this ensures that
78 * the correct access is made
79 *
80 * 0x10000000 of space, partitioned as so:
81 *
82 * 0x00000000 to 0x04000000 8bit, slow
83 * 0x04000000 to 0x08000000 16bit, slow
84 * 0x08000000 to 0x0C000000 16bit, net
85 * 0x0C000000 to 0x10000000 16bit, fast
86 *
87 * each of these spaces has the following in:
88 *
89 * 0x00000000 to 0x01000000 16MB ISA IO space
90 * 0x01000000 to 0x02000000 16MB ISA memory space
91 * 0x02000000 to 0x02100000 1MB IDE primary channel
92 * 0x02100000 to 0x02200000 1MB IDE primary channel aux
93 * 0x02200000 to 0x02400000 1MB IDE secondary channel
94 * 0x02300000 to 0x02400000 1MB IDE secondary channel aux
95 * 0x02400000 to 0x02500000 1MB ASIX ethernet controller
96 * 0x02500000 to 0x02600000 1MB Davicom DM9000 ethernet controller
97 * 0x02600000 to 0x02700000 1MB PC SuperIO controller
98 *
99 * the phyiscal layout of the zones are:
100 * nGCS2 - 8bit, slow
101 * nGCS3 - 16bit, slow
102 * nGCS4 - 16bit, net
103 * nGCS5 - 16bit, fast
104 */
105
106#define BAST_VA_MULTISPACE (0xE0000000)
107
108#define BAST_VA_ISAIO (BAST_VA_MULTISPACE + 0x00000000)
109#define BAST_VA_ISAMEM (BAST_VA_MULTISPACE + 0x01000000)
110#define BAST_VA_IDEPRI (BAST_VA_MULTISPACE + 0x02000000)
111#define BAST_VA_IDEPRIAUX (BAST_VA_MULTISPACE + 0x02100000)
112#define BAST_VA_IDESEC (BAST_VA_MULTISPACE + 0x02200000)
113#define BAST_VA_IDESECAUX (BAST_VA_MULTISPACE + 0x02300000)
114#define BAST_VA_ASIXNET (BAST_VA_MULTISPACE + 0x02400000)
115#define BAST_VA_DM9000 (BAST_VA_MULTISPACE + 0x02500000)
116#define BAST_VA_SUPERIO (BAST_VA_MULTISPACE + 0x02600000)
117
118#define BAST_VA_MULTISPACE (0xE0000000)
119
120#define BAST_VAM_CS2 (0x00000000)
121#define BAST_VAM_CS3 (0x04000000)
122#define BAST_VAM_CS4 (0x08000000)
123#define BAST_VAM_CS5 (0x0C000000)
124
125/* physical offset addresses for the peripherals */
126
127#define BAST_PA_ISAIO (0x00000000)
128#define BAST_PA_ASIXNET (0x01000000)
129#define BAST_PA_SUPERIO (0x01800000)
130#define BAST_PA_IDEPRI (0x02000000)
131#define BAST_PA_IDEPRIAUX (0x02800000)
132#define BAST_PA_IDESEC (0x03000000)
133#define BAST_PA_IDESECAUX (0x03800000)
134#define BAST_PA_ISAMEM (0x04000000)
135#define BAST_PA_DM9000 (0x05000000)
136
137/* some configurations for the peripherals */
138
139#define BAST_PCSIO (BAST_VA_SUPERIO + BAST_VAM_CS2)
140/* */
141
142#define BAST_ASIXNET_CS BAST_VAM_CS5
143#define BAST_IDE_CS BAST_VAM_CS5
144#define BAST_DM9000_CS BAST_VAM_CS4
145
146#endif /* __ASM_ARCH_BASTMAP_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/bast-pmu.h b/arch/arm/mach-s3c2410/include/mach/bast-pmu.h
new file mode 100644
index 000000000000..61684cb8ce59
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/bast-pmu.h
@@ -0,0 +1,40 @@
1/* arch/arm/mach-s3c2410/include/mach/bast-pmu.h
2 *
3 * Copyright (c) 2003,2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * Vincent Sanders <vince@simtec.co.uk>
6 *
7 * Machine BAST - Power Management chip
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_BASTPMU_H
15#define __ASM_ARCH_BASTPMU_H "08_OCT_2004"
16
17#define BASTPMU_REG_IDENT (0x00)
18#define BASTPMU_REG_VERSION (0x01)
19#define BASTPMU_REG_DDCCTRL (0x02)
20#define BASTPMU_REG_POWER (0x03)
21#define BASTPMU_REG_RESET (0x04)
22#define BASTPMU_REG_GWO (0x05)
23#define BASTPMU_REG_WOL (0x06)
24#define BASTPMU_REG_WOR (0x07)
25#define BASTPMU_REG_UID (0x09)
26
27#define BASTPMU_EEPROM (0xC0)
28
29#define BASTPMU_EEP_UID (BASTPMU_EEPROM + 0)
30#define BASTPMU_EEP_WOL (BASTPMU_EEPROM + 8)
31#define BASTPMU_EEP_WOR (BASTPMU_EEPROM + 9)
32
33#define BASTPMU_IDENT_0 0x53
34#define BASTPMU_IDENT_1 0x42
35#define BASTPMU_IDENT_2 0x50
36#define BASTPMU_IDENT_3 0x4d
37
38#define BASTPMU_RESET_GUARD (0x55)
39
40#endif /* __ASM_ARCH_BASTPMU_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/debug-macro.S b/arch/arm/mach-s3c2410/include/mach/debug-macro.S
new file mode 100644
index 000000000000..682df23087ab
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/debug-macro.S
@@ -0,0 +1,102 @@
1/* arch/arm/mach-s3c2410/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Copyright (C) 2005 Simtec Electronics
7 *
8 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <mach/map.h>
16#include <mach/regs-gpio.h>
17#include <asm/plat-s3c/regs-serial.h>
18
19#define S3C2410_UART1_OFF (0x4000)
20#define SHIFT_2440TXF (14-9)
21
22 .macro addruart, rx
23 mrc p15, 0, \rx, c1, c0
24 tst \rx, #1
25 ldreq \rx, = S3C24XX_PA_UART
26 ldrne \rx, = S3C24XX_VA_UART
27#if CONFIG_DEBUG_S3C_UART != 0
28 add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
29#endif
30 .endm
31
32 .macro fifo_full_s3c24xx rd, rx
33 @ check for arm920 vs arm926. currently assume all arm926
34 @ devices have an 64 byte FIFO identical to the s3c2440
35 mrc p15, 0, \rd, c0, c0
36 and \rd, \rd, #0xff0
37 teq \rd, #0x260
38 beq 1004f
39 mrc p15, 0, \rd, c1, c0
40 tst \rd, #1
41 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
42 addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
43 bic \rd, \rd, #0xff000
44 ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
45 and \rd, \rd, #0x00ff0000
46 teq \rd, #0x00440000 @ is it 2440?
471004:
48 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
49 moveq \rd, \rd, lsr #SHIFT_2440TXF
50 tst \rd, #S3C2410_UFSTAT_TXFULL
51 .endm
52
53 .macro fifo_full_s3c2410 rd, rx
54 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
55 tst \rd, #S3C2410_UFSTAT_TXFULL
56 .endm
57
58/* fifo level reading */
59
60 .macro fifo_level_s3c24xx rd, rx
61 @ check for arm920 vs arm926. currently assume all arm926
62 @ devices have an 64 byte FIFO identical to the s3c2440
63 mrc p15, 0, \rd, c0, c0
64 and \rd, \rd, #0xff0
65 teq \rd, #0x260
66 beq 10000f
67 mrc p15, 0, \rd, c1, c0
68 tst \rd, #1
69 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
70 addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
71 bic \rd, \rd, #0xff000
72 ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
73 and \rd, \rd, #0x00ff0000
74 teq \rd, #0x00440000 @ is it 2440?
75
7610000:
77 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
78 andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
79 andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
80 .endm
81
82 .macro fifo_level_s3c2410 rd, rx
83 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
84 and \rd, \rd, #S3C2410_UFSTAT_TXMASK
85 .endm
86
87/* Select the correct implementation depending on the configuration. The
88 * S3C2440 will get selected by default, as these are the most widely
89 * used variants of these
90*/
91
92#if defined(CONFIG_CPU_LLSERIAL_S3C2410_ONLY)
93#define fifo_full fifo_full_s3c2410
94#define fifo_level fifo_level_s3c2410
95#elif !defined(CONFIG_CPU_LLSERIAL_S3C2440_ONLY)
96#define fifo_full fifo_full_s3c24xx
97#define fifo_level fifo_level_s3c24xx
98#endif
99
100/* include the reset of the code which will do the work */
101
102#include <asm/plat-s3c/debug-macro.S>
diff --git a/arch/arm/mach-s3c2410/include/mach/dma.h b/arch/arm/mach-s3c2410/include/mach/dma.h
new file mode 100644
index 000000000000..891b53cd69b8
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/dma.h
@@ -0,0 +1,453 @@
1/* arch/arm/mach-s3c2410/include/mach/dma.h
2 *
3 * Copyright (C) 2003,2004,2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Samsung S3C241XX DMA support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_DMA_H
14#define __ASM_ARCH_DMA_H __FILE__
15
16#include <linux/sysdev.h>
17#include <mach/hardware.h>
18
19/*
20 * This is the maximum DMA address(physical address) that can be DMAd to.
21 *
22 */
23#define MAX_DMA_ADDRESS 0x40000000
24#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */
25
26/* We use `virtual` dma channels to hide the fact we have only a limited
27 * number of DMA channels, and not of all of them (dependant on the device)
28 * can be attached to any DMA source. We therefore let the DMA core handle
29 * the allocation of hardware channels to clients.
30*/
31
32enum dma_ch {
33 DMACH_XD0,
34 DMACH_XD1,
35 DMACH_SDI,
36 DMACH_SPI0,
37 DMACH_SPI1,
38 DMACH_UART0,
39 DMACH_UART1,
40 DMACH_UART2,
41 DMACH_TIMER,
42 DMACH_I2S_IN,
43 DMACH_I2S_OUT,
44 DMACH_PCM_IN,
45 DMACH_PCM_OUT,
46 DMACH_MIC_IN,
47 DMACH_USB_EP1,
48 DMACH_USB_EP2,
49 DMACH_USB_EP3,
50 DMACH_USB_EP4,
51 DMACH_UART0_SRC2, /* s3c2412 second uart sources */
52 DMACH_UART1_SRC2,
53 DMACH_UART2_SRC2,
54 DMACH_UART3, /* s3c2443 has extra uart */
55 DMACH_UART3_SRC2,
56 DMACH_MAX, /* the end entry */
57};
58
59#define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */
60
61/* we have 4 dma channels */
62#ifndef CONFIG_CPU_S3C2443
63#define S3C2410_DMA_CHANNELS (4)
64#else
65#define S3C2410_DMA_CHANNELS (6)
66#endif
67
68/* types */
69
70enum s3c2410_dma_state {
71 S3C2410_DMA_IDLE,
72 S3C2410_DMA_RUNNING,
73 S3C2410_DMA_PAUSED
74};
75
76
77/* enum s3c2410_dma_loadst
78 *
79 * This represents the state of the DMA engine, wrt to the loaded / running
80 * transfers. Since we don't have any way of knowing exactly the state of
81 * the DMA transfers, we need to know the state to make decisions on wether
82 * we can
83 *
84 * S3C2410_DMA_NONE
85 *
86 * There are no buffers loaded (the channel should be inactive)
87 *
88 * S3C2410_DMA_1LOADED
89 *
90 * There is one buffer loaded, however it has not been confirmed to be
91 * loaded by the DMA engine. This may be because the channel is not
92 * yet running, or the DMA driver decided that it was too costly to
93 * sit and wait for it to happen.
94 *
95 * S3C2410_DMA_1RUNNING
96 *
97 * The buffer has been confirmed running, and not finisged
98 *
99 * S3C2410_DMA_1LOADED_1RUNNING
100 *
101 * There is a buffer waiting to be loaded by the DMA engine, and one
102 * currently running.
103*/
104
105enum s3c2410_dma_loadst {
106 S3C2410_DMALOAD_NONE,
107 S3C2410_DMALOAD_1LOADED,
108 S3C2410_DMALOAD_1RUNNING,
109 S3C2410_DMALOAD_1LOADED_1RUNNING,
110};
111
112enum s3c2410_dma_buffresult {
113 S3C2410_RES_OK,
114 S3C2410_RES_ERR,
115 S3C2410_RES_ABORT
116};
117
118enum s3c2410_dmasrc {
119 S3C2410_DMASRC_HW, /* source is memory */
120 S3C2410_DMASRC_MEM /* source is hardware */
121};
122
123/* enum s3c2410_chan_op
124 *
125 * operation codes passed to the DMA code by the user, and also used
126 * to inform the current channel owner of any changes to the system state
127*/
128
129enum s3c2410_chan_op {
130 S3C2410_DMAOP_START,
131 S3C2410_DMAOP_STOP,
132 S3C2410_DMAOP_PAUSE,
133 S3C2410_DMAOP_RESUME,
134 S3C2410_DMAOP_FLUSH,
135 S3C2410_DMAOP_TIMEOUT, /* internal signal to handler */
136 S3C2410_DMAOP_STARTED, /* indicate channel started */
137};
138
139/* flags */
140
141#define S3C2410_DMAF_SLOW (1<<0) /* slow, so don't worry about
142 * waiting for reloads */
143#define S3C2410_DMAF_AUTOSTART (1<<1) /* auto-start if buffer queued */
144
145/* dma buffer */
146
147struct s3c2410_dma_client {
148 char *name;
149};
150
151/* s3c2410_dma_buf_s
152 *
153 * internally used buffer structure to describe a queued or running
154 * buffer.
155*/
156
157struct s3c2410_dma_buf;
158struct s3c2410_dma_buf {
159 struct s3c2410_dma_buf *next;
160 int magic; /* magic */
161 int size; /* buffer size in bytes */
162 dma_addr_t data; /* start of DMA data */
163 dma_addr_t ptr; /* where the DMA got to [1] */
164 void *id; /* client's id */
165};
166
167/* [1] is this updated for both recv/send modes? */
168
169struct s3c2410_dma_chan;
170
171/* s3c2410_dma_cbfn_t
172 *
173 * buffer callback routine type
174*/
175
176typedef void (*s3c2410_dma_cbfn_t)(struct s3c2410_dma_chan *,
177 void *buf, int size,
178 enum s3c2410_dma_buffresult result);
179
180typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,
181 enum s3c2410_chan_op );
182
183struct s3c2410_dma_stats {
184 unsigned long loads;
185 unsigned long timeout_longest;
186 unsigned long timeout_shortest;
187 unsigned long timeout_avg;
188 unsigned long timeout_failed;
189};
190
191struct s3c2410_dma_map;
192
193/* struct s3c2410_dma_chan
194 *
195 * full state information for each DMA channel
196*/
197
198struct s3c2410_dma_chan {
199 /* channel state flags and information */
200 unsigned char number; /* number of this dma channel */
201 unsigned char in_use; /* channel allocated */
202 unsigned char irq_claimed; /* irq claimed for channel */
203 unsigned char irq_enabled; /* irq enabled for channel */
204 unsigned char xfer_unit; /* size of an transfer */
205
206 /* channel state */
207
208 enum s3c2410_dma_state state;
209 enum s3c2410_dma_loadst load_state;
210 struct s3c2410_dma_client *client;
211
212 /* channel configuration */
213 enum s3c2410_dmasrc source;
214 unsigned long dev_addr;
215 unsigned long load_timeout;
216 unsigned int flags; /* channel flags */
217 unsigned int hw_cfg; /* last hw config */
218
219 struct s3c24xx_dma_map *map; /* channel hw maps */
220
221 /* channel's hardware position and configuration */
222 void __iomem *regs; /* channels registers */
223 void __iomem *addr_reg; /* data address register */
224 unsigned int irq; /* channel irq */
225 unsigned long dcon; /* default value of DCON */
226
227 /* driver handles */
228 s3c2410_dma_cbfn_t callback_fn; /* buffer done callback */
229 s3c2410_dma_opfn_t op_fn; /* channel op callback */
230
231 /* stats gathering */
232 struct s3c2410_dma_stats *stats;
233 struct s3c2410_dma_stats stats_store;
234
235 /* buffer list and information */
236 struct s3c2410_dma_buf *curr; /* current dma buffer */
237 struct s3c2410_dma_buf *next; /* next buffer to load */
238 struct s3c2410_dma_buf *end; /* end of queue */
239
240 /* system device */
241 struct sys_device dev;
242};
243
244/* the currently allocated channel information */
245extern struct s3c2410_dma_chan s3c2410_chans[];
246
247/* note, we don't really use dma_device_t at the moment */
248typedef unsigned long dma_device_t;
249
250/* functions --------------------------------------------------------------- */
251
252/* s3c2410_dma_request
253 *
254 * request a dma channel exclusivley
255*/
256
257extern int s3c2410_dma_request(dmach_t channel,
258 struct s3c2410_dma_client *, void *dev);
259
260
261/* s3c2410_dma_ctrl
262 *
263 * change the state of the dma channel
264*/
265
266extern int s3c2410_dma_ctrl(dmach_t channel, enum s3c2410_chan_op op);
267
268/* s3c2410_dma_setflags
269 *
270 * set the channel's flags to a given state
271*/
272
273extern int s3c2410_dma_setflags(dmach_t channel,
274 unsigned int flags);
275
276/* s3c2410_dma_free
277 *
278 * free the dma channel (will also abort any outstanding operations)
279*/
280
281extern int s3c2410_dma_free(dmach_t channel, struct s3c2410_dma_client *);
282
283/* s3c2410_dma_enqueue
284 *
285 * place the given buffer onto the queue of operations for the channel.
286 * The buffer must be allocated from dma coherent memory, or the Dcache/WB
287 * drained before the buffer is given to the DMA system.
288*/
289
290extern int s3c2410_dma_enqueue(dmach_t channel, void *id,
291 dma_addr_t data, int size);
292
293/* s3c2410_dma_config
294 *
295 * configure the dma channel
296*/
297
298extern int s3c2410_dma_config(dmach_t channel, int xferunit, int dcon);
299
300/* s3c2410_dma_devconfig
301 *
302 * configure the device we're talking to
303*/
304
305extern int s3c2410_dma_devconfig(int channel, enum s3c2410_dmasrc source,
306 int hwcfg, unsigned long devaddr);
307
308/* s3c2410_dma_getposition
309 *
310 * get the position that the dma transfer is currently at
311*/
312
313extern int s3c2410_dma_getposition(dmach_t channel,
314 dma_addr_t *src, dma_addr_t *dest);
315
316extern int s3c2410_dma_set_opfn(dmach_t, s3c2410_dma_opfn_t rtn);
317extern int s3c2410_dma_set_buffdone_fn(dmach_t, s3c2410_dma_cbfn_t rtn);
318
319/* DMA Register definitions */
320
321#define S3C2410_DMA_DISRC (0x00)
322#define S3C2410_DMA_DISRCC (0x04)
323#define S3C2410_DMA_DIDST (0x08)
324#define S3C2410_DMA_DIDSTC (0x0C)
325#define S3C2410_DMA_DCON (0x10)
326#define S3C2410_DMA_DSTAT (0x14)
327#define S3C2410_DMA_DCSRC (0x18)
328#define S3C2410_DMA_DCDST (0x1C)
329#define S3C2410_DMA_DMASKTRIG (0x20)
330#define S3C2412_DMA_DMAREQSEL (0x24)
331#define S3C2443_DMA_DMAREQSEL (0x24)
332
333#define S3C2410_DISRCC_INC (1<<0)
334#define S3C2410_DISRCC_APB (1<<1)
335
336#define S3C2410_DMASKTRIG_STOP (1<<2)
337#define S3C2410_DMASKTRIG_ON (1<<1)
338#define S3C2410_DMASKTRIG_SWTRIG (1<<0)
339
340#define S3C2410_DCON_DEMAND (0<<31)
341#define S3C2410_DCON_HANDSHAKE (1<<31)
342#define S3C2410_DCON_SYNC_PCLK (0<<30)
343#define S3C2410_DCON_SYNC_HCLK (1<<30)
344
345#define S3C2410_DCON_INTREQ (1<<29)
346
347#define S3C2410_DCON_CH0_XDREQ0 (0<<24)
348#define S3C2410_DCON_CH0_UART0 (1<<24)
349#define S3C2410_DCON_CH0_SDI (2<<24)
350#define S3C2410_DCON_CH0_TIMER (3<<24)
351#define S3C2410_DCON_CH0_USBEP1 (4<<24)
352
353#define S3C2410_DCON_CH1_XDREQ1 (0<<24)
354#define S3C2410_DCON_CH1_UART1 (1<<24)
355#define S3C2410_DCON_CH1_I2SSDI (2<<24)
356#define S3C2410_DCON_CH1_SPI (3<<24)
357#define S3C2410_DCON_CH1_USBEP2 (4<<24)
358
359#define S3C2410_DCON_CH2_I2SSDO (0<<24)
360#define S3C2410_DCON_CH2_I2SSDI (1<<24)
361#define S3C2410_DCON_CH2_SDI (2<<24)
362#define S3C2410_DCON_CH2_TIMER (3<<24)
363#define S3C2410_DCON_CH2_USBEP3 (4<<24)
364
365#define S3C2410_DCON_CH3_UART2 (0<<24)
366#define S3C2410_DCON_CH3_SDI (1<<24)
367#define S3C2410_DCON_CH3_SPI (2<<24)
368#define S3C2410_DCON_CH3_TIMER (3<<24)
369#define S3C2410_DCON_CH3_USBEP4 (4<<24)
370
371#define S3C2410_DCON_SRCSHIFT (24)
372#define S3C2410_DCON_SRCMASK (7<<24)
373
374#define S3C2410_DCON_BYTE (0<<20)
375#define S3C2410_DCON_HALFWORD (1<<20)
376#define S3C2410_DCON_WORD (2<<20)
377
378#define S3C2410_DCON_AUTORELOAD (0<<22)
379#define S3C2410_DCON_NORELOAD (1<<22)
380#define S3C2410_DCON_HWTRIG (1<<23)
381
382#ifdef CONFIG_CPU_S3C2440
383#define S3C2440_DIDSTC_CHKINT (1<<2)
384
385#define S3C2440_DCON_CH0_I2SSDO (5<<24)
386#define S3C2440_DCON_CH0_PCMIN (6<<24)
387
388#define S3C2440_DCON_CH1_PCMOUT (5<<24)
389#define S3C2440_DCON_CH1_SDI (6<<24)
390
391#define S3C2440_DCON_CH2_PCMIN (5<<24)
392#define S3C2440_DCON_CH2_MICIN (6<<24)
393
394#define S3C2440_DCON_CH3_MICIN (5<<24)
395#define S3C2440_DCON_CH3_PCMOUT (6<<24)
396#endif
397
398#ifdef CONFIG_CPU_S3C2412
399
400#define S3C2412_DMAREQSEL_SRC(x) ((x)<<1)
401
402#define S3C2412_DMAREQSEL_HW (1)
403
404#define S3C2412_DMAREQSEL_SPI0TX S3C2412_DMAREQSEL_SRC(0)
405#define S3C2412_DMAREQSEL_SPI0RX S3C2412_DMAREQSEL_SRC(1)
406#define S3C2412_DMAREQSEL_SPI1TX S3C2412_DMAREQSEL_SRC(2)
407#define S3C2412_DMAREQSEL_SPI1RX S3C2412_DMAREQSEL_SRC(3)
408#define S3C2412_DMAREQSEL_I2STX S3C2412_DMAREQSEL_SRC(4)
409#define S3C2412_DMAREQSEL_I2SRX S3C2412_DMAREQSEL_SRC(5)
410#define S3C2412_DMAREQSEL_TIMER S3C2412_DMAREQSEL_SRC(9)
411#define S3C2412_DMAREQSEL_SDI S3C2412_DMAREQSEL_SRC(10)
412#define S3C2412_DMAREQSEL_USBEP1 S3C2412_DMAREQSEL_SRC(13)
413#define S3C2412_DMAREQSEL_USBEP2 S3C2412_DMAREQSEL_SRC(14)
414#define S3C2412_DMAREQSEL_USBEP3 S3C2412_DMAREQSEL_SRC(15)
415#define S3C2412_DMAREQSEL_USBEP4 S3C2412_DMAREQSEL_SRC(16)
416#define S3C2412_DMAREQSEL_XDREQ0 S3C2412_DMAREQSEL_SRC(17)
417#define S3C2412_DMAREQSEL_XDREQ1 S3C2412_DMAREQSEL_SRC(18)
418#define S3C2412_DMAREQSEL_UART0_0 S3C2412_DMAREQSEL_SRC(19)
419#define S3C2412_DMAREQSEL_UART0_1 S3C2412_DMAREQSEL_SRC(20)
420#define S3C2412_DMAREQSEL_UART1_0 S3C2412_DMAREQSEL_SRC(21)
421#define S3C2412_DMAREQSEL_UART1_1 S3C2412_DMAREQSEL_SRC(22)
422#define S3C2412_DMAREQSEL_UART2_0 S3C2412_DMAREQSEL_SRC(23)
423#define S3C2412_DMAREQSEL_UART2_1 S3C2412_DMAREQSEL_SRC(24)
424
425#endif
426
427#define S3C2443_DMAREQSEL_SRC(x) ((x)<<1)
428
429#define S3C2443_DMAREQSEL_HW (1)
430
431#define S3C2443_DMAREQSEL_SPI0TX S3C2443_DMAREQSEL_SRC(0)
432#define S3C2443_DMAREQSEL_SPI0RX S3C2443_DMAREQSEL_SRC(1)
433#define S3C2443_DMAREQSEL_SPI1TX S3C2443_DMAREQSEL_SRC(2)
434#define S3C2443_DMAREQSEL_SPI1RX S3C2443_DMAREQSEL_SRC(3)
435#define S3C2443_DMAREQSEL_I2STX S3C2443_DMAREQSEL_SRC(4)
436#define S3C2443_DMAREQSEL_I2SRX S3C2443_DMAREQSEL_SRC(5)
437#define S3C2443_DMAREQSEL_TIMER S3C2443_DMAREQSEL_SRC(9)
438#define S3C2443_DMAREQSEL_SDI S3C2443_DMAREQSEL_SRC(10)
439#define S3C2443_DMAREQSEL_XDREQ0 S3C2443_DMAREQSEL_SRC(17)
440#define S3C2443_DMAREQSEL_XDREQ1 S3C2443_DMAREQSEL_SRC(18)
441#define S3C2443_DMAREQSEL_UART0_0 S3C2443_DMAREQSEL_SRC(19)
442#define S3C2443_DMAREQSEL_UART0_1 S3C2443_DMAREQSEL_SRC(20)
443#define S3C2443_DMAREQSEL_UART1_0 S3C2443_DMAREQSEL_SRC(21)
444#define S3C2443_DMAREQSEL_UART1_1 S3C2443_DMAREQSEL_SRC(22)
445#define S3C2443_DMAREQSEL_UART2_0 S3C2443_DMAREQSEL_SRC(23)
446#define S3C2443_DMAREQSEL_UART2_1 S3C2443_DMAREQSEL_SRC(24)
447#define S3C2443_DMAREQSEL_UART3_0 S3C2443_DMAREQSEL_SRC(25)
448#define S3C2443_DMAREQSEL_UART3_1 S3C2443_DMAREQSEL_SRC(26)
449#define S3C2443_DMAREQSEL_PCMOUT S3C2443_DMAREQSEL_SRC(27)
450#define S3C2443_DMAREQSEL_PCMIN S3C2443_DMAREQSEL_SRC(28)
451#define S3C2443_DMAREQSEL_MICIN S3C2443_DMAREQSEL_SRC(29)
452
453#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/entry-macro.S b/arch/arm/mach-s3c2410/include/mach/entry-macro.S
new file mode 100644
index 000000000000..473b3cd37d9b
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/entry-macro.S
@@ -0,0 +1,78 @@
1/*
2 * arch/arm/mach-s3c2410/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for S3C2410-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
11/* We have a problem that the INTOFFSET register does not always
12 * show one interrupt. Occasionally we get two interrupts through
13 * the prioritiser, and this causes the INTOFFSET register to show
14 * what looks like the logical-or of the two interrupt numbers.
15 *
16 * Thanks to Klaus, Shannon, et al for helping to debug this problem
17*/
18
19#define INTPND (0x10)
20#define INTOFFSET (0x14)
21
22#include <mach/hardware.h>
23#include <asm/irq.h>
24
25 .macro get_irqnr_preamble, base, tmp
26 .endm
27
28 .macro arch_ret_to_user, tmp1, tmp2
29 .endm
30
31 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
32
33 mov \base, #S3C24XX_VA_IRQ
34
35 @@ try the interrupt offset register, since it is there
36
37 ldr \irqstat, [ \base, #INTPND ]
38 teq \irqstat, #0
39 beq 1002f
40 ldr \irqnr, [ \base, #INTOFFSET ]
41 mov \tmp, #1
42 tst \irqstat, \tmp, lsl \irqnr
43 bne 1001f
44
45 @@ the number specified is not a valid irq, so try
46 @@ and work it out for ourselves
47
48 mov \irqnr, #0 @@ start here
49
50 @@ work out which irq (if any) we got
51
52 movs \tmp, \irqstat, lsl#16
53 addeq \irqnr, \irqnr, #16
54 moveq \irqstat, \irqstat, lsr#16
55 tst \irqstat, #0xff
56 addeq \irqnr, \irqnr, #8
57 moveq \irqstat, \irqstat, lsr#8
58 tst \irqstat, #0xf
59 addeq \irqnr, \irqnr, #4
60 moveq \irqstat, \irqstat, lsr#4
61 tst \irqstat, #0x3
62 addeq \irqnr, \irqnr, #2
63 moveq \irqstat, \irqstat, lsr#2
64 tst \irqstat, #0x1
65 addeq \irqnr, \irqnr, #1
66
67 @@ we have the value
681001:
69 adds \irqnr, \irqnr, #IRQ_EINT0
701002:
71 @@ exit here, Z flag unset if IRQ
72
73 .endm
74
75 /* currently don't need an disable_fiq macro */
76
77 .macro disable_fiq
78 .endm
diff --git a/arch/arm/mach-s3c2410/include/mach/fb.h b/arch/arm/mach-s3c2410/include/mach/fb.h
new file mode 100644
index 000000000000..eee0654eb8fb
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/fb.h
@@ -0,0 +1,74 @@
1/* arch/arm/mach-s3c2410/include/mach/fb.h
2 *
3 * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org>
4 *
5 * Inspired by pxafb.h
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_ARM_FB_H
13#define __ASM_ARM_FB_H
14
15#include <mach/regs-lcd.h>
16
17struct s3c2410fb_hw {
18 unsigned long lcdcon1;
19 unsigned long lcdcon2;
20 unsigned long lcdcon3;
21 unsigned long lcdcon4;
22 unsigned long lcdcon5;
23};
24
25/* LCD description */
26struct s3c2410fb_display {
27 /* LCD type */
28 unsigned type;
29
30 /* Screen size */
31 unsigned short width;
32 unsigned short height;
33
34 /* Screen info */
35 unsigned short xres;
36 unsigned short yres;
37 unsigned short bpp;
38
39 unsigned pixclock; /* pixclock in picoseconds */
40 unsigned short left_margin; /* value in pixels (TFT) or HCLKs (STN) */
41 unsigned short right_margin; /* value in pixels (TFT) or HCLKs (STN) */
42 unsigned short hsync_len; /* value in pixels (TFT) or HCLKs (STN) */
43 unsigned short upper_margin; /* value in lines (TFT) or 0 (STN) */
44 unsigned short lower_margin; /* value in lines (TFT) or 0 (STN) */
45 unsigned short vsync_len; /* value in lines (TFT) or 0 (STN) */
46
47 /* lcd configuration registers */
48 unsigned long lcdcon5;
49};
50
51struct s3c2410fb_mach_info {
52
53 struct s3c2410fb_display *displays; /* attached diplays info */
54 unsigned num_displays; /* number of defined displays */
55 unsigned default_display;
56
57 /* GPIOs */
58
59 unsigned long gpcup;
60 unsigned long gpcup_mask;
61 unsigned long gpccon;
62 unsigned long gpccon_mask;
63 unsigned long gpdup;
64 unsigned long gpdup_mask;
65 unsigned long gpdcon;
66 unsigned long gpdcon_mask;
67
68 /* lpc3600 control register */
69 unsigned long lpcsel;
70};
71
72extern void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *);
73
74#endif /* __ASM_ARM_FB_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h b/arch/arm/mach-s3c2410/include/mach/gpio.h
new file mode 100644
index 000000000000..3b52b86498a6
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/gpio.h
@@ -0,0 +1,18 @@
1/* arch/arm/mach-s3c2410/include/mach/gpio.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2410 - GPIO lib support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#define gpio_get_value __gpio_get_value
15#define gpio_set_value __gpio_set_value
16#define gpio_cansleep __gpio_cansleep
17
18#include <asm-generic/gpio.h>
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
new file mode 100644
index 000000000000..d8a832729a8a
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -0,0 +1,64 @@
1/* arch/arm/mach-s3c2410/include/mach/h1940-latch.h
2 *
3 * Copyright (c) 2005 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * iPAQ H1940 series - latch definitions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_H1940_LATCH_H
15#define __ASM_ARCH_H1940_LATCH_H
16
17
18#ifndef __ASSEMBLY__
19#define H1940_LATCH ((void __force __iomem *)0xF8000000)
20#else
21#define H1940_LATCH 0xF8000000
22#endif
23
24#define H1940_PA_LATCH (S3C2410_CS2)
25
26/* SD layer latch */
27
28#define H1940_LATCH_SDQ1 (1<<16)
29#define H1940_LATCH_LCD_P1 (1<<17)
30#define H1940_LATCH_LCD_P2 (1<<18)
31#define H1940_LATCH_LCD_P3 (1<<19)
32#define H1940_LATCH_MAX1698_nSHUTDOWN (1<<20) /* LCD backlight */
33#define H1940_LATCH_LED_RED (1<<21)
34#define H1940_LATCH_SDQ7 (1<<22)
35#define H1940_LATCH_USB_DP (1<<23)
36
37/* CPU layer latch */
38
39#define H1940_LATCH_UDA_POWER (1<<24)
40#define H1940_LATCH_AUDIO_POWER (1<<25)
41#define H1940_LATCH_SM803_ENABLE (1<<26)
42#define H1940_LATCH_LCD_P4 (1<<27)
43#define H1940_LATCH_CPUQ5 (1<<28) /* untraced */
44#define H1940_LATCH_BLUETOOTH_POWER (1<<29) /* active high */
45#define H1940_LATCH_LED_GREEN (1<<30)
46#define H1940_LATCH_LED_FLASH (1<<31)
47
48/* default settings */
49
50#define H1940_LATCH_DEFAULT \
51 H1940_LATCH_LCD_P4 | \
52 H1940_LATCH_SM803_ENABLE | \
53 H1940_LATCH_SDQ1 | \
54 H1940_LATCH_LCD_P1 | \
55 H1940_LATCH_LCD_P2 | \
56 H1940_LATCH_LCD_P3 | \
57 H1940_LATCH_MAX1698_nSHUTDOWN | \
58 H1940_LATCH_CPUQ5
59
60/* control functions */
61
62extern void h1940_latch_control(unsigned int clear, unsigned int set);
63
64#endif /* __ASM_ARCH_H1940_LATCH_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940.h b/arch/arm/mach-s3c2410/include/mach/h1940.h
new file mode 100644
index 000000000000..4559784129c0
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/h1940.h
@@ -0,0 +1,21 @@
1/* arch/arm/mach-s3c2410/include/mach/h1940.h
2 *
3 * Copyright 2006 Ben Dooks <ben-linux@fluff.org>
4 *
5 * H1940 definitions
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_H1940_H
13#define __ASM_ARCH_H1940_H
14
15#define H1940_SUSPEND_CHECKSUM (0x30003ff8)
16#define H1940_SUSPEND_RESUMEAT (0x30081000)
17#define H1940_SUSPEND_CHECK (0x30080000)
18
19extern void h1940_pm_return(void);
20
21#endif /* __ASM_ARCH_H1940_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/hardware.h b/arch/arm/mach-s3c2410/include/mach/hardware.h
new file mode 100644
index 000000000000..74d5a1a4024c
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/hardware.h
@@ -0,0 +1,137 @@
1/* arch/arm/mach-s3c2410/include/mach/hardware.h
2 *
3 * Copyright (c) 2003 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - hardware
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_HARDWARE_H
14#define __ASM_ARCH_HARDWARE_H
15
16#ifndef __ASSEMBLY__
17
18/* external functions for GPIO support
19 *
20 * These allow various different clients to access the same GPIO
21 * registers without conflicting. If your driver only owns the entire
22 * GPIO register, then it is safe to ioremap/__raw_{read|write} to it.
23*/
24
25/* s3c2410_gpio_cfgpin
26 *
27 * set the configuration of the given pin to the value passed.
28 *
29 * eg:
30 * s3c2410_gpio_cfgpin(S3C2410_GPA0, S3C2410_GPA0_ADDR0);
31 * s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2410_GPE8_SDDAT1);
32*/
33
34extern void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function);
35
36extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);
37
38/* s3c2410_gpio_getirq
39 *
40 * turn the given pin number into the corresponding IRQ number
41 *
42 * returns:
43 * < 0 = no interrupt for this pin
44 * >=0 = interrupt number for the pin
45*/
46
47extern int s3c2410_gpio_getirq(unsigned int pin);
48
49/* s3c2410_gpio_irq2pin
50 *
51 * turn the given irq number into the corresponding GPIO number
52 *
53 * returns:
54 * < 0 = no pin
55 * >=0 = gpio pin number
56*/
57
58extern int s3c2410_gpio_irq2pin(unsigned int irq);
59
60#ifdef CONFIG_CPU_S3C2400
61
62extern int s3c2400_gpio_getirq(unsigned int pin);
63
64#endif /* CONFIG_CPU_S3C2400 */
65
66/* s3c2410_gpio_irqfilter
67 *
68 * set the irq filtering on the given pin
69 *
70 * on = 0 => disable filtering
71 * 1 => enable filtering
72 *
73 * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with
74 * width of filter (0 through 63)
75 *
76 *
77*/
78
79extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
80 unsigned int config);
81
82/* s3c2410_gpio_pullup
83 *
84 * configure the pull-up control on the given pin
85 *
86 * to = 1 => disable the pull-up
87 * 0 => enable the pull-up
88 *
89 * eg;
90 *
91 * s3c2410_gpio_pullup(S3C2410_GPB0, 0);
92 * s3c2410_gpio_pullup(S3C2410_GPE8, 0);
93*/
94
95extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);
96
97/* s3c2410_gpio_getpull
98 *
99 * Read the state of the pull-up on a given pin
100 *
101 * return:
102 * < 0 => error code
103 * 0 => enabled
104 * 1 => disabled
105*/
106
107extern int s3c2410_gpio_getpull(unsigned int pin);
108
109extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);
110
111extern unsigned int s3c2410_gpio_getpin(unsigned int pin);
112
113extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg);
114
115#ifdef CONFIG_CPU_S3C2440
116
117extern int s3c2440_set_dsc(unsigned int pin, unsigned int value);
118
119#endif /* CONFIG_CPU_S3C2440 */
120
121#ifdef CONFIG_CPU_S3C2412
122
123extern int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state);
124
125#endif /* CONFIG_CPU_S3C2412 */
126
127#endif /* __ASSEMBLY__ */
128
129#include <asm/sizes.h>
130#include <mach/map.h>
131
132/* machine specific hardware definitions should go after this */
133
134/* currently here until moved into config (todo) */
135#define CONFIG_NO_MULTIWORD_IO
136
137#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/idle.h b/arch/arm/mach-s3c2410/include/mach/idle.h
new file mode 100644
index 000000000000..e9ddd706b16e
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/idle.h
@@ -0,0 +1,24 @@
1/* arch/arm/mach-s3c2410/include/mach/idle.h
2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 CPU Idle controls
11*/
12
13#ifndef __ASM_ARCH_IDLE_H
14#define __ASM_ARCH_IDLE_H __FILE__
15
16/* This allows the over-ride of the default idle code, in case there
17 * is any other things to be done over idle (like DVS)
18*/
19
20extern void (*s3c24xx_idle)(void);
21
22extern void s3c24xx_default_idle(void);
23
24#endif /* __ASM_ARCH_IDLE_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/io.h b/arch/arm/mach-s3c2410/include/mach/io.h
new file mode 100644
index 000000000000..9813dbf2ae4f
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/io.h
@@ -0,0 +1,218 @@
1/*
2 * arch/arm/mach-s3c2410/include/mach/io.h
3 * from arch/arm/mach-rpc/include/mach/io.h
4 *
5 * Copyright (C) 1997 Russell King
6 * (C) 2003 Simtec Electronics
7*/
8
9#ifndef __ASM_ARM_ARCH_IO_H
10#define __ASM_ARM_ARCH_IO_H
11
12#include <mach/hardware.h>
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16/*
17 * We use two different types of addressing - PC style addresses, and ARM
18 * addresses. PC style accesses the PC hardware with the normal PC IO
19 * addresses, eg 0x3f8 for serial#1. ARM addresses are above A28
20 * and are translated to the start of IO. Note that all addresses are
21 * not shifted left!
22 */
23
24#define __PORT_PCIO(x) ((x) < (1<<28))
25
26#define PCIO_BASE (S3C24XX_VA_ISA_WORD)
27#define PCIO_BASE_b (S3C24XX_VA_ISA_BYTE)
28#define PCIO_BASE_w (S3C24XX_VA_ISA_WORD)
29#define PCIO_BASE_l (S3C24XX_VA_ISA_WORD)
30/*
31 * Dynamic IO functions - let the compiler
32 * optimize the expressions
33 */
34
35#define DECLARE_DYN_OUT(sz,fnsuffix,instr) \
36static inline void __out##fnsuffix (unsigned int val, unsigned int port) \
37{ \
38 unsigned long temp; \
39 __asm__ __volatile__( \
40 "cmp %2, #(1<<28)\n\t" \
41 "mov %0, %2\n\t" \
42 "addcc %0, %0, %3\n\t" \
43 "str" instr " %1, [%0, #0 ] @ out" #fnsuffix \
44 : "=&r" (temp) \
45 : "r" (val), "r" (port), "Ir" (PCIO_BASE_##fnsuffix) \
46 : "cc"); \
47}
48
49
50#define DECLARE_DYN_IN(sz,fnsuffix,instr) \
51static inline unsigned sz __in##fnsuffix (unsigned int port) \
52{ \
53 unsigned long temp, value; \
54 __asm__ __volatile__( \
55 "cmp %2, #(1<<28)\n\t" \
56 "mov %0, %2\n\t" \
57 "addcc %0, %0, %3\n\t" \
58 "ldr" instr " %1, [%0, #0 ] @ in" #fnsuffix \
59 : "=&r" (temp), "=r" (value) \
60 : "r" (port), "Ir" (PCIO_BASE_##fnsuffix) \
61 : "cc"); \
62 return (unsigned sz)value; \
63}
64
65static inline void __iomem *__ioaddr (unsigned long port)
66{
67 return __PORT_PCIO(port) ? (PCIO_BASE + port) : (void __iomem *)port;
68}
69
70#define DECLARE_IO(sz,fnsuffix,instr) \
71 DECLARE_DYN_IN(sz,fnsuffix,instr) \
72 DECLARE_DYN_OUT(sz,fnsuffix,instr)
73
74DECLARE_IO(char,b,"b")
75DECLARE_IO(short,w,"h")
76DECLARE_IO(int,l,"")
77
78#undef DECLARE_IO
79#undef DECLARE_DYN_IN
80
81/*
82 * Constant address IO functions
83 *
84 * These have to be macros for the 'J' constraint to work -
85 * +/-4096 immediate operand.
86 */
87#define __outbc(value,port) \
88({ \
89 if (__PORT_PCIO((port))) \
90 __asm__ __volatile__( \
91 "strb %0, [%1, %2] @ outbc" \
92 : : "r" (value), "r" (PCIO_BASE), "Jr" ((port))); \
93 else \
94 __asm__ __volatile__( \
95 "strb %0, [%1, #0] @ outbc" \
96 : : "r" (value), "r" ((port))); \
97})
98
99#define __inbc(port) \
100({ \
101 unsigned char result; \
102 if (__PORT_PCIO((port))) \
103 __asm__ __volatile__( \
104 "ldrb %0, [%1, %2] @ inbc" \
105 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port))); \
106 else \
107 __asm__ __volatile__( \
108 "ldrb %0, [%1, #0] @ inbc" \
109 : "=r" (result) : "r" ((port))); \
110 result; \
111})
112
113#define __outwc(value,port) \
114({ \
115 unsigned long v = value; \
116 if (__PORT_PCIO((port))) { \
117 if ((port) < 256 && (port) > -256) \
118 __asm__ __volatile__( \
119 "strh %0, [%1, %2] @ outwc" \
120 : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \
121 else if ((port) > 0) \
122 __asm__ __volatile__( \
123 "strh %0, [%1, %2] @ outwc" \
124 : : "r" (v), \
125 "r" (PCIO_BASE + ((port) & ~0xff)), \
126 "Jr" (((port) & 0xff))); \
127 else \
128 __asm__ __volatile__( \
129 "strh %0, [%1, #0] @ outwc" \
130 : : "r" (v), \
131 "r" (PCIO_BASE + (port))); \
132 } else \
133 __asm__ __volatile__( \
134 "strh %0, [%1, #0] @ outwc" \
135 : : "r" (v), "r" ((port))); \
136})
137
138#define __inwc(port) \
139({ \
140 unsigned short result; \
141 if (__PORT_PCIO((port))) { \
142 if ((port) < 256 && (port) > -256 ) \
143 __asm__ __volatile__( \
144 "ldrh %0, [%1, %2] @ inwc" \
145 : "=r" (result) \
146 : "r" (PCIO_BASE), \
147 "Jr" ((port))); \
148 else if ((port) > 0) \
149 __asm__ __volatile__( \
150 "ldrh %0, [%1, %2] @ inwc" \
151 : "=r" (result) \
152 : "r" (PCIO_BASE + ((port) & ~0xff)), \
153 "Jr" (((port) & 0xff))); \
154 else \
155 __asm__ __volatile__( \
156 "ldrh %0, [%1, #0] @ inwc" \
157 : "=r" (result) \
158 : "r" (PCIO_BASE + ((port)))); \
159 } else \
160 __asm__ __volatile__( \
161 "ldrh %0, [%1, #0] @ inwc" \
162 : "=r" (result) : "r" ((port))); \
163 result; \
164})
165
166#define __outlc(value,port) \
167({ \
168 unsigned long v = value; \
169 if (__PORT_PCIO((port))) \
170 __asm__ __volatile__( \
171 "str %0, [%1, %2] @ outlc" \
172 : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \
173 else \
174 __asm__ __volatile__( \
175 "str %0, [%1, #0] @ outlc" \
176 : : "r" (v), "r" ((port))); \
177})
178
179#define __inlc(port) \
180({ \
181 unsigned long result; \
182 if (__PORT_PCIO((port))) \
183 __asm__ __volatile__( \
184 "ldr %0, [%1, %2] @ inlc" \
185 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port))); \
186 else \
187 __asm__ __volatile__( \
188 "ldr %0, [%1, #0] @ inlc" \
189 : "=r" (result) : "r" ((port))); \
190 result; \
191})
192
193#define __ioaddrc(port) ((__PORT_PCIO(port) ? PCIO_BASE + (port) : (void __iomem *)(port)))
194
195#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p))
196#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p))
197#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p))
198#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
199#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
200#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
201#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p))
202/* the following macro is deprecated */
203#define ioaddr(port) __ioaddr((port))
204
205#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l)
206#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l)
207#define insl(p,d,l) __raw_readsl(__ioaddr(p),d,l)
208
209#define outsb(p,d,l) __raw_writesb(__ioaddr(p),d,l)
210#define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l)
211#define outsl(p,d,l) __raw_writesl(__ioaddr(p),d,l)
212
213/*
214 * 1:1 mapping for ioremapped regions.
215 */
216#define __mem_pci(x) (x)
217
218#endif
diff --git a/arch/arm/mach-s3c2410/include/mach/irqs.h b/arch/arm/mach-s3c2410/include/mach/irqs.h
new file mode 100644
index 000000000000..950c71bf1489
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/irqs.h
@@ -0,0 +1,166 @@
1/* arch/arm/mach-s3c2410/include/mach/irqs.h
2 *
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11
12#ifndef __ASM_ARCH_IRQS_H
13#define __ASM_ARCH_IRQS_H __FILE__
14
15#ifndef __ASM_ARM_IRQ_H
16#error "Do not include this directly, instead #include <asm/irq.h>"
17#endif
18
19/* we keep the first set of CPU IRQs out of the range of
20 * the ISA space, so that the PC104 has them to itself
21 * and we don't end up having to do horrible things to the
22 * standard ISA drivers....
23 */
24
25#define S3C2410_CPUIRQ_OFFSET (16)
26
27#define S3C2410_IRQ(x) ((x) + S3C2410_CPUIRQ_OFFSET)
28
29/* main cpu interrupts */
30#define IRQ_EINT0 S3C2410_IRQ(0) /* 16 */
31#define IRQ_EINT1 S3C2410_IRQ(1)
32#define IRQ_EINT2 S3C2410_IRQ(2)
33#define IRQ_EINT3 S3C2410_IRQ(3)
34#define IRQ_EINT4t7 S3C2410_IRQ(4) /* 20 */
35#define IRQ_EINT8t23 S3C2410_IRQ(5)
36#define IRQ_RESERVED6 S3C2410_IRQ(6) /* for s3c2410 */
37#define IRQ_CAM S3C2410_IRQ(6) /* for s3c2440,s3c2443 */
38#define IRQ_BATT_FLT S3C2410_IRQ(7)
39#define IRQ_TICK S3C2410_IRQ(8) /* 24 */
40#define IRQ_WDT S3C2410_IRQ(9) /* WDT/AC97 for s3c2443 */
41#define IRQ_TIMER0 S3C2410_IRQ(10)
42#define IRQ_TIMER1 S3C2410_IRQ(11)
43#define IRQ_TIMER2 S3C2410_IRQ(12)
44#define IRQ_TIMER3 S3C2410_IRQ(13)
45#define IRQ_TIMER4 S3C2410_IRQ(14)
46#define IRQ_UART2 S3C2410_IRQ(15)
47#define IRQ_LCD S3C2410_IRQ(16) /* 32 */
48#define IRQ_DMA0 S3C2410_IRQ(17) /* IRQ_DMA for s3c2443 */
49#define IRQ_DMA1 S3C2410_IRQ(18)
50#define IRQ_DMA2 S3C2410_IRQ(19)
51#define IRQ_DMA3 S3C2410_IRQ(20)
52#define IRQ_SDI S3C2410_IRQ(21)
53#define IRQ_SPI0 S3C2410_IRQ(22)
54#define IRQ_UART1 S3C2410_IRQ(23)
55#define IRQ_RESERVED24 S3C2410_IRQ(24) /* 40 */
56#define IRQ_NFCON S3C2410_IRQ(24) /* for s3c2440 */
57#define IRQ_USBD S3C2410_IRQ(25)
58#define IRQ_USBH S3C2410_IRQ(26)
59#define IRQ_IIC S3C2410_IRQ(27)
60#define IRQ_UART0 S3C2410_IRQ(28) /* 44 */
61#define IRQ_SPI1 S3C2410_IRQ(29)
62#define IRQ_RTC S3C2410_IRQ(30)
63#define IRQ_ADCPARENT S3C2410_IRQ(31)
64
65/* interrupts generated from the external interrupts sources */
66#define IRQ_EINT4 S3C2410_IRQ(32) /* 48 */
67#define IRQ_EINT5 S3C2410_IRQ(33)
68#define IRQ_EINT6 S3C2410_IRQ(34)
69#define IRQ_EINT7 S3C2410_IRQ(35)
70#define IRQ_EINT8 S3C2410_IRQ(36)
71#define IRQ_EINT9 S3C2410_IRQ(37)
72#define IRQ_EINT10 S3C2410_IRQ(38)
73#define IRQ_EINT11 S3C2410_IRQ(39)
74#define IRQ_EINT12 S3C2410_IRQ(40)
75#define IRQ_EINT13 S3C2410_IRQ(41)
76#define IRQ_EINT14 S3C2410_IRQ(42)
77#define IRQ_EINT15 S3C2410_IRQ(43)
78#define IRQ_EINT16 S3C2410_IRQ(44)
79#define IRQ_EINT17 S3C2410_IRQ(45)
80#define IRQ_EINT18 S3C2410_IRQ(46)
81#define IRQ_EINT19 S3C2410_IRQ(47)
82#define IRQ_EINT20 S3C2410_IRQ(48) /* 64 */
83#define IRQ_EINT21 S3C2410_IRQ(49)
84#define IRQ_EINT22 S3C2410_IRQ(50)
85#define IRQ_EINT23 S3C2410_IRQ(51)
86
87
88#define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x)))
89
90#define IRQ_LCD_FIFO S3C2410_IRQ(52)
91#define IRQ_LCD_FRAME S3C2410_IRQ(53)
92
93/* IRQs for the interal UARTs, and ADC
94 * these need to be ordered in number of appearance in the
95 * SUBSRC mask register
96*/
97
98#define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+54)
99
100#define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 70 */
101#define IRQ_S3CUART_TX0 S3C2410_IRQSUB(1)
102#define IRQ_S3CUART_ERR0 S3C2410_IRQSUB(2)
103
104#define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 73 */
105#define IRQ_S3CUART_TX1 S3C2410_IRQSUB(4)
106#define IRQ_S3CUART_ERR1 S3C2410_IRQSUB(5)
107
108#define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 76 */
109#define IRQ_S3CUART_TX2 S3C2410_IRQSUB(7)
110#define IRQ_S3CUART_ERR2 S3C2410_IRQSUB(8)
111
112#define IRQ_TC S3C2410_IRQSUB(9)
113#define IRQ_ADC S3C2410_IRQSUB(10)
114
115/* extra irqs for s3c2412 */
116
117#define IRQ_S3C2412_CFSDI S3C2410_IRQ(21)
118
119#define IRQ_S3C2412_SDI S3C2410_IRQSUB(13)
120#define IRQ_S3C2412_CF S3C2410_IRQSUB(14)
121
122/* extra irqs for s3c2440 */
123
124#define IRQ_S3C2440_CAM_C S3C2410_IRQSUB(11) /* S3C2443 too */
125#define IRQ_S3C2440_CAM_P S3C2410_IRQSUB(12) /* S3C2443 too */
126#define IRQ_S3C2440_WDT S3C2410_IRQSUB(13)
127#define IRQ_S3C2440_AC97 S3C2410_IRQSUB(14)
128
129/* irqs for s3c2443 */
130
131#define IRQ_S3C2443_DMA S3C2410_IRQ(17) /* IRQ_DMA1 */
132#define IRQ_S3C2443_UART3 S3C2410_IRQ(18) /* IRQ_DMA2 */
133#define IRQ_S3C2443_CFCON S3C2410_IRQ(19) /* IRQ_DMA3 */
134#define IRQ_S3C2443_HSMMC S3C2410_IRQ(20) /* IRQ_SDI */
135#define IRQ_S3C2443_NAND S3C2410_IRQ(24) /* reserved */
136
137#define IRQ_S3C2443_LCD1 S3C2410_IRQSUB(14)
138#define IRQ_S3C2443_LCD2 S3C2410_IRQSUB(15)
139#define IRQ_S3C2443_LCD3 S3C2410_IRQSUB(16)
140#define IRQ_S3C2443_LCD4 S3C2410_IRQSUB(17)
141
142#define IRQ_S3C2443_DMA0 S3C2410_IRQSUB(18)
143#define IRQ_S3C2443_DMA1 S3C2410_IRQSUB(19)
144#define IRQ_S3C2443_DMA2 S3C2410_IRQSUB(20)
145#define IRQ_S3C2443_DMA3 S3C2410_IRQSUB(21)
146#define IRQ_S3C2443_DMA4 S3C2410_IRQSUB(22)
147#define IRQ_S3C2443_DMA5 S3C2410_IRQSUB(23)
148
149/* UART3 */
150#define IRQ_S3C2443_RX3 S3C2410_IRQSUB(24)
151#define IRQ_S3C2443_TX3 S3C2410_IRQSUB(25)
152#define IRQ_S3C2443_ERR3 S3C2410_IRQSUB(26)
153
154#define IRQ_S3C2443_WDT S3C2410_IRQSUB(27)
155#define IRQ_S3C2443_AC97 S3C2410_IRQSUB(28)
156
157#ifdef CONFIG_CPU_S3C2443
158#define NR_IRQS (IRQ_S3C2443_AC97+1)
159#else
160#define NR_IRQS (IRQ_S3C2440_AC97+1)
161#endif
162
163/* Our FIQs are routable from IRQ_EINT0 to IRQ_ADCPARENT */
164#define FIQ_START IRQ_EINT0
165
166#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/leds-gpio.h b/arch/arm/mach-s3c2410/include/mach/leds-gpio.h
new file mode 100644
index 000000000000..d8a7672519b6
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/leds-gpio.h
@@ -0,0 +1,28 @@
1/* arch/arm/mach-s3c2410/include/mach/leds-gpio.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX - LEDs GPIO connector
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_LEDSGPIO_H
15#define __ASM_ARCH_LEDSGPIO_H "leds-gpio.h"
16
17#define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */
18#define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */
19
20struct s3c24xx_led_platdata {
21 unsigned int gpio;
22 unsigned int flags;
23
24 char *name;
25 char *def_trigger;
26};
27
28#endif /* __ASM_ARCH_LEDSGPIO_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/map.h b/arch/arm/mach-s3c2410/include/mach/map.h
new file mode 100644
index 000000000000..64bf7e94a5bf
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/map.h
@@ -0,0 +1,178 @@
1/* arch/arm/mach-s3c2410/include/mach/map.h
2 *
3 * Copyright (c) 2003 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - Memory map definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_MAP_H
14#define __ASM_ARCH_MAP_H
15
16#include <asm/plat-s3c/map.h>
17
18#define S3C2410_ADDR(x) S3C_ADDR(x)
19
20/* interrupt controller is the first thing we put in, to make
21 * the assembly code for the irq detection easier
22 */
23#define S3C24XX_VA_IRQ S3C_VA_IRQ
24#define S3C2410_PA_IRQ (0x4A000000)
25#define S3C24XX_SZ_IRQ SZ_1M
26
27/* memory controller registers */
28#define S3C24XX_VA_MEMCTRL S3C_VA_MEM
29#define S3C2410_PA_MEMCTRL (0x48000000)
30#define S3C24XX_SZ_MEMCTRL SZ_1M
31
32/* USB host controller */
33#define S3C2410_PA_USBHOST (0x49000000)
34#define S3C24XX_SZ_USBHOST SZ_1M
35
36/* DMA controller */
37#define S3C2410_PA_DMA (0x4B000000)
38#define S3C24XX_SZ_DMA SZ_1M
39
40/* Clock and Power management */
41#define S3C24XX_VA_CLKPWR S3C_VA_SYS
42#define S3C2410_PA_CLKPWR (0x4C000000)
43#define S3C24XX_SZ_CLKPWR SZ_1M
44
45/* LCD controller */
46#define S3C2410_PA_LCD (0x4D000000)
47#define S3C24XX_SZ_LCD SZ_1M
48
49/* NAND flash controller */
50#define S3C2410_PA_NAND (0x4E000000)
51#define S3C24XX_SZ_NAND SZ_1M
52
53/* UARTs */
54#define S3C24XX_VA_UART S3C_VA_UART
55#define S3C2410_PA_UART (0x50000000)
56#define S3C24XX_SZ_UART SZ_1M
57
58/* Timers */
59#define S3C24XX_VA_TIMER S3C_VA_TIMER
60#define S3C2410_PA_TIMER (0x51000000)
61#define S3C24XX_SZ_TIMER SZ_1M
62
63/* USB Device port */
64#define S3C2410_PA_USBDEV (0x52000000)
65#define S3C24XX_SZ_USBDEV SZ_1M
66
67/* Watchdog */
68#define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG
69#define S3C2410_PA_WATCHDOG (0x53000000)
70#define S3C24XX_SZ_WATCHDOG SZ_1M
71
72/* IIC hardware controller */
73#define S3C2410_PA_IIC (0x54000000)
74#define S3C24XX_SZ_IIC SZ_1M
75
76/* IIS controller */
77#define S3C2410_PA_IIS (0x55000000)
78#define S3C24XX_SZ_IIS SZ_1M
79
80/* GPIO ports */
81
82/* the calculation for the VA of this must ensure that
83 * it is the same distance apart from the UART in the
84 * phsyical address space, as the initial mapping for the IO
85 * is done as a 1:1 maping. This puts it (currently) at
86 * 0xFA800000, which is not in the way of any current mapping
87 * by the base system.
88*/
89
90#define S3C2410_PA_GPIO (0x56000000)
91#define S3C24XX_VA_GPIO ((S3C2410_PA_GPIO - S3C24XX_PA_UART) + S3C24XX_VA_UART)
92#define S3C24XX_SZ_GPIO SZ_1M
93
94/* RTC */
95#define S3C2410_PA_RTC (0x57000000)
96#define S3C24XX_SZ_RTC SZ_1M
97
98/* ADC */
99#define S3C2410_PA_ADC (0x58000000)
100#define S3C24XX_SZ_ADC SZ_1M
101
102/* SPI */
103#define S3C2410_PA_SPI (0x59000000)
104#define S3C24XX_SZ_SPI SZ_1M
105
106/* SDI */
107#define S3C2410_PA_SDI (0x5A000000)
108#define S3C24XX_SZ_SDI SZ_1M
109
110/* CAMIF */
111#define S3C2440_PA_CAMIF (0x4F000000)
112#define S3C2440_SZ_CAMIF SZ_1M
113
114/* AC97 */
115
116#define S3C2440_PA_AC97 (0x5B000000)
117#define S3C2440_SZ_AC97 SZ_1M
118
119/* S3C2443 High-speed SD/MMC */
120#define S3C2443_PA_HSMMC (0x4A800000)
121#define S3C2443_SZ_HSMMC (256)
122
123/* ISA style IO, for each machine to sort out mappings for, if it
124 * implements it. We reserve two 16M regions for ISA.
125 */
126
127#define S3C24XX_VA_ISA_WORD S3C2410_ADDR(0x02000000)
128#define S3C24XX_VA_ISA_BYTE S3C2410_ADDR(0x03000000)
129
130/* physical addresses of all the chip-select areas */
131
132#define S3C2410_CS0 (0x00000000)
133#define S3C2410_CS1 (0x08000000)
134#define S3C2410_CS2 (0x10000000)
135#define S3C2410_CS3 (0x18000000)
136#define S3C2410_CS4 (0x20000000)
137#define S3C2410_CS5 (0x28000000)
138#define S3C2410_CS6 (0x30000000)
139#define S3C2410_CS7 (0x38000000)
140
141#define S3C2410_SDRAM_PA (S3C2410_CS6)
142
143/* Use a single interface for common resources between S3C24XX cpus */
144
145#define S3C24XX_PA_IRQ S3C2410_PA_IRQ
146#define S3C24XX_PA_MEMCTRL S3C2410_PA_MEMCTRL
147#define S3C24XX_PA_USBHOST S3C2410_PA_USBHOST
148#define S3C24XX_PA_DMA S3C2410_PA_DMA
149#define S3C24XX_PA_CLKPWR S3C2410_PA_CLKPWR
150#define S3C24XX_PA_LCD S3C2410_PA_LCD
151#define S3C24XX_PA_UART S3C2410_PA_UART
152#define S3C24XX_PA_TIMER S3C2410_PA_TIMER
153#define S3C24XX_PA_USBDEV S3C2410_PA_USBDEV
154#define S3C24XX_PA_WATCHDOG S3C2410_PA_WATCHDOG
155#define S3C24XX_PA_IIC S3C2410_PA_IIC
156#define S3C24XX_PA_IIS S3C2410_PA_IIS
157#define S3C24XX_PA_GPIO S3C2410_PA_GPIO
158#define S3C24XX_PA_RTC S3C2410_PA_RTC
159#define S3C24XX_PA_ADC S3C2410_PA_ADC
160#define S3C24XX_PA_SPI S3C2410_PA_SPI
161
162/* deal with the registers that move under the 2412/2413 */
163
164#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
165#ifndef __ASSEMBLY__
166extern void __iomem *s3c24xx_va_gpio2;
167#endif
168#ifdef CONFIG_CPU_S3C2412_ONLY
169#define S3C24XX_VA_GPIO2 (S3C24XX_VA_GPIO + 0x10)
170#else
171#define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2
172#endif
173#else
174#define s3c24xx_va_gpio2 S3C24XX_VA_GPIO
175#define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
176#endif
177
178#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/memory.h b/arch/arm/mach-s3c2410/include/mach/memory.h
new file mode 100644
index 000000000000..93782628a786
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/memory.h
@@ -0,0 +1,19 @@
1/* arch/arm/mach-s3c2410/include/mach/memory.h
2 * from arch/arm/mach-rpc/include/mach/memory.h
3 *
4 * Copyright (C) 1996,1997,1998 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef __ASM_ARCH_MEMORY_H
12#define __ASM_ARCH_MEMORY_H
13
14#define PHYS_OFFSET UL(0x30000000)
15
16#define __virt_to_bus(x) __virt_to_phys(x)
17#define __bus_to_virt(x) __phys_to_virt(x)
18
19#endif
diff --git a/arch/arm/mach-s3c2410/include/mach/osiris-cpld.h b/arch/arm/mach-s3c2410/include/mach/osiris-cpld.h
new file mode 100644
index 000000000000..e9e36b0abbac
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/osiris-cpld.h
@@ -0,0 +1,30 @@
1/* arch/arm/mach-s3c2410/include/mach/osiris-cpld.h
2 *
3 * Copyright 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * OSIRIS - CPLD control constants
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_OSIRISCPLD_H
15#define __ASM_ARCH_OSIRISCPLD_H
16
17/* CTRL0 - NAND WP control */
18
19#define OSIRIS_CTRL0_NANDSEL (0x3)
20#define OSIRIS_CTRL0_BOOT_INT (1<<3)
21#define OSIRIS_CTRL0_PCMCIA (1<<4)
22#define OSIRIS_CTRL0_FIX8 (1<<5)
23#define OSIRIS_CTRL0_PCMCIA_nWAIT (1<<6)
24#define OSIRIS_CTRL0_PCMCIA_nIOIS16 (1<<7)
25
26#define OSIRIS_CTRL1_FIX8 (1<<0)
27
28#define OSIRIS_ID_REVMASK (0x7)
29
30#endif /* __ASM_ARCH_OSIRISCPLD_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/osiris-map.h b/arch/arm/mach-s3c2410/include/mach/osiris-map.h
new file mode 100644
index 000000000000..639eff523d4e
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/osiris-map.h
@@ -0,0 +1,42 @@
1/* arch/arm/mach-s3c2410/include/mach/osiris-map.h
2 *
3 * (c) 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * OSIRIS - Memory map definitions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14/* needs arch/map.h including with this */
15
16#ifndef __ASM_ARCH_OSIRISMAP_H
17#define __ASM_ARCH_OSIRISMAP_H
18
19/* start peripherals off after the S3C2410 */
20
21#define OSIRIS_IOADDR(x) (S3C2410_ADDR((x) + 0x04000000))
22
23#define OSIRIS_PA_CPLD (S3C2410_CS1 | (1<<26))
24
25/* we put the CPLD registers next, to get them out of the way */
26
27#define OSIRIS_VA_CTRL0 OSIRIS_IOADDR(0x00000000)
28#define OSIRIS_PA_CTRL0 (OSIRIS_PA_CPLD)
29
30#define OSIRIS_VA_CTRL1 OSIRIS_IOADDR(0x00100000)
31#define OSIRIS_PA_CTRL1 (OSIRIS_PA_CPLD + (1<<23))
32
33#define OSIRIS_VA_CTRL2 OSIRIS_IOADDR(0x00200000)
34#define OSIRIS_PA_CTRL2 (OSIRIS_PA_CPLD + (2<<23))
35
36#define OSIRIS_VA_CTRL3 OSIRIS_IOADDR(0x00300000)
37#define OSIRIS_PA_CTRL3 (OSIRIS_PA_CPLD + (2<<23))
38
39#define OSIRIS_VA_IDREG OSIRIS_IOADDR(0x00700000)
40#define OSIRIS_PA_IDREG (OSIRIS_PA_CPLD + (7<<23))
41
42#endif /* __ASM_ARCH_OSIRISMAP_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/otom-map.h b/arch/arm/mach-s3c2410/include/mach/otom-map.h
new file mode 100644
index 000000000000..f9277a52c145
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/otom-map.h
@@ -0,0 +1,30 @@
1/* arch/arm/mach-s3c2410/include/mach/otom-map.h
2 *
3 * (c) 2005 Guillaume GOURAT / NexVision
4 * guillaume.gourat@nexvision.fr
5 *
6 * NexVision OTOM board memory map definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13/* needs arch/map.h including with this */
14
15/* ok, we've used up to 0x01300000, now we need to find space for the
16 * peripherals that live in the nGCS[x] areas, which are quite numerous
17 * in their space.
18 */
19
20#ifndef __ASM_ARCH_OTOMMAP_H
21#define __ASM_ARCH_OTOMMAP_H
22
23#define OTOM_PA_CS8900A_BASE (S3C2410_CS3 + 0x01000000) /* nGCS3 +0x01000000 */
24#define OTOM_VA_CS8900A_BASE S3C2410_ADDR(0x04000000) /* 0xF4000000 */
25
26/* physical offset addresses for the peripherals */
27
28#define OTOM_PA_FLASH0_BASE (S3C2410_CS0) /* Bank 0 */
29
30#endif /* __ASM_ARCH_OTOMMAP_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-clock.h b/arch/arm/mach-s3c2410/include/mach/regs-clock.h
new file mode 100644
index 000000000000..d583688458a4
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-clock.h
@@ -0,0 +1,197 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-clock.h
2 *
3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/
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 * S3C2410 clock register definitions
11*/
12
13#ifndef __ASM_ARM_REGS_CLOCK
14#define __ASM_ARM_REGS_CLOCK "$Id: clock.h,v 1.4 2003/04/30 14:50:51 ben Exp $"
15
16#define S3C2410_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR)
17
18#define S3C2410_PLLVAL(_m,_p,_s) ((_m) << 12 | ((_p) << 4) | ((_s)))
19
20#define S3C2410_LOCKTIME S3C2410_CLKREG(0x00)
21#define S3C2410_MPLLCON S3C2410_CLKREG(0x04)
22#define S3C2410_UPLLCON S3C2410_CLKREG(0x08)
23#define S3C2410_CLKCON S3C2410_CLKREG(0x0C)
24#define S3C2410_CLKSLOW S3C2410_CLKREG(0x10)
25#define S3C2410_CLKDIVN S3C2410_CLKREG(0x14)
26
27#define S3C2410_CLKCON_IDLE (1<<2)
28#define S3C2410_CLKCON_POWER (1<<3)
29#define S3C2410_CLKCON_NAND (1<<4)
30#define S3C2410_CLKCON_LCDC (1<<5)
31#define S3C2410_CLKCON_USBH (1<<6)
32#define S3C2410_CLKCON_USBD (1<<7)
33#define S3C2410_CLKCON_PWMT (1<<8)
34#define S3C2410_CLKCON_SDI (1<<9)
35#define S3C2410_CLKCON_UART0 (1<<10)
36#define S3C2410_CLKCON_UART1 (1<<11)
37#define S3C2410_CLKCON_UART2 (1<<12)
38#define S3C2410_CLKCON_GPIO (1<<13)
39#define S3C2410_CLKCON_RTC (1<<14)
40#define S3C2410_CLKCON_ADC (1<<15)
41#define S3C2410_CLKCON_IIC (1<<16)
42#define S3C2410_CLKCON_IIS (1<<17)
43#define S3C2410_CLKCON_SPI (1<<18)
44
45#define S3C2410_PLLCON_MDIVSHIFT 12
46#define S3C2410_PLLCON_PDIVSHIFT 4
47#define S3C2410_PLLCON_SDIVSHIFT 0
48#define S3C2410_PLLCON_MDIVMASK ((1<<(1+(19-12)))-1)
49#define S3C2410_PLLCON_PDIVMASK ((1<<5)-1)
50#define S3C2410_PLLCON_SDIVMASK 3
51
52/* DCLKCON register addresses in gpio.h */
53
54#define S3C2410_DCLKCON_DCLK0EN (1<<0)
55#define S3C2410_DCLKCON_DCLK0_PCLK (0<<1)
56#define S3C2410_DCLKCON_DCLK0_UCLK (1<<1)
57#define S3C2410_DCLKCON_DCLK0_DIV(x) (((x) - 1 )<<4)
58#define S3C2410_DCLKCON_DCLK0_CMP(x) (((x) - 1 )<<8)
59#define S3C2410_DCLKCON_DCLK0_DIV_MASK ((0xf)<<4)
60#define S3C2410_DCLKCON_DCLK0_CMP_MASK ((0xf)<<8)
61
62#define S3C2410_DCLKCON_DCLK1EN (1<<16)
63#define S3C2410_DCLKCON_DCLK1_PCLK (0<<17)
64#define S3C2410_DCLKCON_DCLK1_UCLK (1<<17)
65#define S3C2410_DCLKCON_DCLK1_DIV(x) (((x) - 1) <<20)
66#define S3C2410_DCLKCON_DCLK1_CMP(x) (((x) - 1) <<24)
67#define S3C2410_DCLKCON_DCLK1_DIV_MASK ((0xf) <<20)
68#define S3C2410_DCLKCON_DCLK1_CMP_MASK ((0xf) <<24)
69
70#define S3C2410_CLKDIVN_PDIVN (1<<0)
71#define S3C2410_CLKDIVN_HDIVN (1<<1)
72
73#define S3C2410_CLKSLOW_UCLK_OFF (1<<7)
74#define S3C2410_CLKSLOW_MPLL_OFF (1<<5)
75#define S3C2410_CLKSLOW_SLOW (1<<4)
76#define S3C2410_CLKSLOW_SLOWVAL(x) (x)
77#define S3C2410_CLKSLOW_GET_SLOWVAL(x) ((x) & 7)
78
79#ifndef __ASSEMBLY__
80
81#include <asm/div64.h>
82
83static inline unsigned int
84s3c2410_get_pll(unsigned int pllval, unsigned int baseclk)
85{
86 unsigned int mdiv, pdiv, sdiv;
87 uint64_t fvco;
88
89 mdiv = pllval >> S3C2410_PLLCON_MDIVSHIFT;
90 pdiv = pllval >> S3C2410_PLLCON_PDIVSHIFT;
91 sdiv = pllval >> S3C2410_PLLCON_SDIVSHIFT;
92
93 mdiv &= S3C2410_PLLCON_MDIVMASK;
94 pdiv &= S3C2410_PLLCON_PDIVMASK;
95 sdiv &= S3C2410_PLLCON_SDIVMASK;
96
97 fvco = (uint64_t)baseclk * (mdiv + 8);
98 do_div(fvco, (pdiv + 2) << sdiv);
99
100 return (unsigned int)fvco;
101}
102
103#endif /* __ASSEMBLY__ */
104
105#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
106
107/* extra registers */
108#define S3C2440_CAMDIVN S3C2410_CLKREG(0x18)
109
110#define S3C2440_CLKCON_CAMERA (1<<19)
111#define S3C2440_CLKCON_AC97 (1<<20)
112
113#define S3C2440_CLKDIVN_PDIVN (1<<0)
114#define S3C2440_CLKDIVN_HDIVN_MASK (3<<1)
115#define S3C2440_CLKDIVN_HDIVN_1 (0<<1)
116#define S3C2440_CLKDIVN_HDIVN_2 (1<<1)
117#define S3C2440_CLKDIVN_HDIVN_4_8 (2<<1)
118#define S3C2440_CLKDIVN_HDIVN_3_6 (3<<1)
119#define S3C2440_CLKDIVN_UCLK (1<<3)
120
121#define S3C2440_CAMDIVN_CAMCLK_MASK (0xf<<0)
122#define S3C2440_CAMDIVN_CAMCLK_SEL (1<<4)
123#define S3C2440_CAMDIVN_HCLK3_HALF (1<<8)
124#define S3C2440_CAMDIVN_HCLK4_HALF (1<<9)
125#define S3C2440_CAMDIVN_DVSEN (1<<12)
126
127#define S3C2442_CAMDIVN_CAMCLK_DIV3 (1<<5)
128
129#endif /* CONFIG_CPU_S3C2440 or CONFIG_CPU_S3C2442 */
130
131#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
132
133#define S3C2412_OSCSET S3C2410_CLKREG(0x18)
134#define S3C2412_CLKSRC S3C2410_CLKREG(0x1C)
135
136#define S3C2412_PLLCON_OFF (1<<20)
137
138#define S3C2412_CLKDIVN_PDIVN (1<<2)
139#define S3C2412_CLKDIVN_HDIVN_MASK (3<<0)
140#define S3C2412_CLKDIVN_ARMDIVN (1<<3)
141#define S3C2412_CLKDIVN_DVSEN (1<<4)
142#define S3C2412_CLKDIVN_HALFHCLK (1<<5)
143#define S3C2412_CLKDIVN_USB48DIV (1<<6)
144#define S3C2412_CLKDIVN_UARTDIV_MASK (15<<8)
145#define S3C2412_CLKDIVN_UARTDIV_SHIFT (8)
146#define S3C2412_CLKDIVN_I2SDIV_MASK (15<<12)
147#define S3C2412_CLKDIVN_I2SDIV_SHIFT (12)
148#define S3C2412_CLKDIVN_CAMDIV_MASK (15<<16)
149#define S3C2412_CLKDIVN_CAMDIV_SHIFT (16)
150
151#define S3C2412_CLKCON_WDT (1<<28)
152#define S3C2412_CLKCON_SPI (1<<27)
153#define S3C2412_CLKCON_IIS (1<<26)
154#define S3C2412_CLKCON_IIC (1<<25)
155#define S3C2412_CLKCON_ADC (1<<24)
156#define S3C2412_CLKCON_RTC (1<<23)
157#define S3C2412_CLKCON_GPIO (1<<22)
158#define S3C2412_CLKCON_UART2 (1<<21)
159#define S3C2412_CLKCON_UART1 (1<<20)
160#define S3C2412_CLKCON_UART0 (1<<19)
161#define S3C2412_CLKCON_SDI (1<<18)
162#define S3C2412_CLKCON_PWMT (1<<17)
163#define S3C2412_CLKCON_USBD (1<<16)
164#define S3C2412_CLKCON_CAMCLK (1<<15)
165#define S3C2412_CLKCON_UARTCLK (1<<14)
166/* missing 13 */
167#define S3C2412_CLKCON_USB_HOST48 (1<<12)
168#define S3C2412_CLKCON_USB_DEV48 (1<<11)
169#define S3C2412_CLKCON_HCLKdiv2 (1<<10)
170#define S3C2412_CLKCON_HCLKx2 (1<<9)
171#define S3C2412_CLKCON_SDRAM (1<<8)
172/* missing 7 */
173#define S3C2412_CLKCON_USBH S3C2410_CLKCON_USBH
174#define S3C2412_CLKCON_LCDC S3C2410_CLKCON_LCDC
175#define S3C2412_CLKCON_NAND S3C2410_CLKCON_NAND
176#define S3C2412_CLKCON_DMA3 (1<<3)
177#define S3C2412_CLKCON_DMA2 (1<<2)
178#define S3C2412_CLKCON_DMA1 (1<<1)
179#define S3C2412_CLKCON_DMA0 (1<<0)
180
181/* clock sourec controls */
182
183#define S3C2412_CLKSRC_EXTCLKDIV_MASK (7 << 0)
184#define S3C2412_CLKSRC_EXTCLKDIV_SHIFT (0)
185#define S3C2412_CLKSRC_MDIVCLK_EXTCLKDIV (1<<3)
186#define S3C2412_CLKSRC_MSYSCLK_MPLL (1<<4)
187#define S3C2412_CLKSRC_USYSCLK_UPLL (1<<5)
188#define S3C2412_CLKSRC_UARTCLK_MPLL (1<<8)
189#define S3C2412_CLKSRC_I2SCLK_MPLL (1<<9)
190#define S3C2412_CLKSRC_USBCLK_HCLK (1<<10)
191#define S3C2412_CLKSRC_CAMCLK_HCLK (1<<11)
192#define S3C2412_CLKSRC_UREFCLK_EXTCLK (1<<12)
193#define S3C2412_CLKSRC_EREFCLK_EXTCLK (1<<14)
194
195#endif /* CONFIG_CPU_S3C2412 | CONFIG_CPU_S3C2413 */
196
197#endif /* __ASM_ARM_REGS_CLOCK */
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-dsc.h b/arch/arm/mach-s3c2410/include/mach/regs-dsc.h
new file mode 100644
index 000000000000..3c3853cd3cf7
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-dsc.h
@@ -0,0 +1,184 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-dsc.h
2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2440/S3C2412 Signal Drive Strength Control
11*/
12
13
14#ifndef __ASM_ARCH_REGS_DSC_H
15#define __ASM_ARCH_REGS_DSC_H "2440-dsc"
16
17#if defined(CONFIG_CPU_S3C2412)
18#define S3C2412_DSC0 S3C2410_GPIOREG(0xdc)
19#define S3C2412_DSC1 S3C2410_GPIOREG(0xe0)
20#endif
21
22#if defined(CONFIG_CPU_S3C244X)
23
24#define S3C2440_DSC0 S3C2410_GPIOREG(0xc4)
25#define S3C2440_DSC1 S3C2410_GPIOREG(0xc8)
26
27#define S3C2440_SELECT_DSC0 (0)
28#define S3C2440_SELECT_DSC1 (1<<31)
29
30#define S3C2440_DSC_GETSHIFT(x) ((x) & 31)
31
32#define S3C2440_DSC0_DISABLE (1<<31)
33
34#define S3C2440_DSC0_ADDR (S3C2440_SELECT_DSC0 | 8)
35#define S3C2440_DSC0_ADDR_12mA (0<<8)
36#define S3C2440_DSC0_ADDR_10mA (1<<8)
37#define S3C2440_DSC0_ADDR_8mA (2<<8)
38#define S3C2440_DSC0_ADDR_6mA (3<<8)
39#define S3C2440_DSC0_ADDR_MASK (3<<8)
40
41/* D24..D31 */
42#define S3C2440_DSC0_DATA3 (S3C2440_SELECT_DSC0 | 6)
43#define S3C2440_DSC0_DATA3_12mA (0<<6)
44#define S3C2440_DSC0_DATA3_10mA (1<<6)
45#define S3C2440_DSC0_DATA3_8mA (2<<6)
46#define S3C2440_DSC0_DATA3_6mA (3<<6)
47#define S3C2440_DSC0_DATA3_MASK (3<<6)
48
49/* D16..D23 */
50#define S3C2440_DSC0_DATA2 (S3C2440_SELECT_DSC0 | 4)
51#define S3C2440_DSC0_DATA2_12mA (0<<4)
52#define S3C2440_DSC0_DATA2_10mA (1<<4)
53#define S3C2440_DSC0_DATA2_8mA (2<<4)
54#define S3C2440_DSC0_DATA2_6mA (3<<4)
55#define S3C2440_DSC0_DATA2_MASK (3<<4)
56
57/* D8..D15 */
58#define S3C2440_DSC0_DATA1 (S3C2440_SELECT_DSC0 | 2)
59#define S3C2440_DSC0_DATA1_12mA (0<<2)
60#define S3C2440_DSC0_DATA1_10mA (1<<2)
61#define S3C2440_DSC0_DATA1_8mA (2<<2)
62#define S3C2440_DSC0_DATA1_6mA (3<<2)
63#define S3C2440_DSC0_DATA1_MASK (3<<2)
64
65/* D0..D7 */
66#define S3C2440_DSC0_DATA0 (S3C2440_SELECT_DSC0 | 0)
67#define S3C2440_DSC0_DATA0_12mA (0<<0)
68#define S3C2440_DSC0_DATA0_10mA (1<<0)
69#define S3C2440_DSC0_DATA0_8mA (2<<0)
70#define S3C2440_DSC0_DATA0_6mA (3<<0)
71#define S3C2440_DSC0_DATA0_MASK (3<<0)
72
73#define S3C2440_DSC1_SCK1 (S3C2440_SELECT_DSC1 | 28)
74#define S3C2440_DSC1_SCK1_12mA (0<<28)
75#define S3C2440_DSC1_SCK1_10mA (1<<28)
76#define S3C2440_DSC1_SCK1_8mA (2<<28)
77#define S3C2440_DSC1_SCK1_6mA (3<<28)
78#define S3C2440_DSC1_SCK1_MASK (3<<28)
79
80#define S3C2440_DSC1_SCK0 (S3C2440_SELECT_DSC1 | 26)
81#define S3C2440_DSC1_SCK0_12mA (0<<26)
82#define S3C2440_DSC1_SCK0_10mA (1<<26)
83#define S3C2440_DSC1_SCK0_8mA (2<<26)
84#define S3C2440_DSC1_SCK0_6mA (3<<26)
85#define S3C2440_DSC1_SCK0_MASK (3<<26)
86
87#define S3C2440_DSC1_SCKE (S3C2440_SELECT_DSC1 | 24)
88#define S3C2440_DSC1_SCKE_10mA (0<<24)
89#define S3C2440_DSC1_SCKE_8mA (1<<24)
90#define S3C2440_DSC1_SCKE_6mA (2<<24)
91#define S3C2440_DSC1_SCKE_4mA (3<<24)
92#define S3C2440_DSC1_SCKE_MASK (3<<24)
93
94/* SDRAM nRAS/nCAS */
95#define S3C2440_DSC1_SDR (S3C2440_SELECT_DSC1 | 22)
96#define S3C2440_DSC1_SDR_10mA (0<<22)
97#define S3C2440_DSC1_SDR_8mA (1<<22)
98#define S3C2440_DSC1_SDR_6mA (2<<22)
99#define S3C2440_DSC1_SDR_4mA (3<<22)
100#define S3C2440_DSC1_SDR_MASK (3<<22)
101
102/* NAND Flash Controller */
103#define S3C2440_DSC1_NFC (S3C2440_SELECT_DSC1 | 20)
104#define S3C2440_DSC1_NFC_10mA (0<<20)
105#define S3C2440_DSC1_NFC_8mA (1<<20)
106#define S3C2440_DSC1_NFC_6mA (2<<20)
107#define S3C2440_DSC1_NFC_4mA (3<<20)
108#define S3C2440_DSC1_NFC_MASK (3<<20)
109
110/* nBE[0..3] */
111#define S3C2440_DSC1_nBE (S3C2440_SELECT_DSC1 | 18)
112#define S3C2440_DSC1_nBE_10mA (0<<18)
113#define S3C2440_DSC1_nBE_8mA (1<<18)
114#define S3C2440_DSC1_nBE_6mA (2<<18)
115#define S3C2440_DSC1_nBE_4mA (3<<18)
116#define S3C2440_DSC1_nBE_MASK (3<<18)
117
118#define S3C2440_DSC1_WOE (S3C2440_SELECT_DSC1 | 16)
119#define S3C2440_DSC1_WOE_10mA (0<<16)
120#define S3C2440_DSC1_WOE_8mA (1<<16)
121#define S3C2440_DSC1_WOE_6mA (2<<16)
122#define S3C2440_DSC1_WOE_4mA (3<<16)
123#define S3C2440_DSC1_WOE_MASK (3<<16)
124
125#define S3C2440_DSC1_CS7 (S3C2440_SELECT_DSC1 | 14)
126#define S3C2440_DSC1_CS7_10mA (0<<14)
127#define S3C2440_DSC1_CS7_8mA (1<<14)
128#define S3C2440_DSC1_CS7_6mA (2<<14)
129#define S3C2440_DSC1_CS7_4mA (3<<14)
130#define S3C2440_DSC1_CS7_MASK (3<<14)
131
132#define S3C2440_DSC1_CS6 (S3C2440_SELECT_DSC1 | 12)
133#define S3C2440_DSC1_CS6_10mA (0<<12)
134#define S3C2440_DSC1_CS6_8mA (1<<12)
135#define S3C2440_DSC1_CS6_6mA (2<<12)
136#define S3C2440_DSC1_CS6_4mA (3<<12)
137#define S3C2440_DSC1_CS6_MASK (3<<12)
138
139#define S3C2440_DSC1_CS5 (S3C2440_SELECT_DSC1 | 10)
140#define S3C2440_DSC1_CS5_10mA (0<<10)
141#define S3C2440_DSC1_CS5_8mA (1<<10)
142#define S3C2440_DSC1_CS5_6mA (2<<10)
143#define S3C2440_DSC1_CS5_4mA (3<<10)
144#define S3C2440_DSC1_CS5_MASK (3<<10)
145
146#define S3C2440_DSC1_CS4 (S3C2440_SELECT_DSC1 | 8)
147#define S3C2440_DSC1_CS4_10mA (0<<8)
148#define S3C2440_DSC1_CS4_8mA (1<<8)
149#define S3C2440_DSC1_CS4_6mA (2<<8)
150#define S3C2440_DSC1_CS4_4mA (3<<8)
151#define S3C2440_DSC1_CS4_MASK (3<<8)
152
153#define S3C2440_DSC1_CS3 (S3C2440_SELECT_DSC1 | 6)
154#define S3C2440_DSC1_CS3_10mA (0<<6)
155#define S3C2440_DSC1_CS3_8mA (1<<6)
156#define S3C2440_DSC1_CS3_6mA (2<<6)
157#define S3C2440_DSC1_CS3_4mA (3<<6)
158#define S3C2440_DSC1_CS3_MASK (3<<6)
159
160#define S3C2440_DSC1_CS2 (S3C2440_SELECT_DSC1 | 4)
161#define S3C2440_DSC1_CS2_10mA (0<<4)
162#define S3C2440_DSC1_CS2_8mA (1<<4)
163#define S3C2440_DSC1_CS2_6mA (2<<4)
164#define S3C2440_DSC1_CS2_4mA (3<<4)
165#define S3C2440_DSC1_CS2_MASK (3<<4)
166
167#define S3C2440_DSC1_CS1 (S3C2440_SELECT_DSC1 | 2)
168#define S3C2440_DSC1_CS1_10mA (0<<2)
169#define S3C2440_DSC1_CS1_8mA (1<<2)
170#define S3C2440_DSC1_CS1_6mA (2<<2)
171#define S3C2440_DSC1_CS1_4mA (3<<2)
172#define S3C2440_DSC1_CS1_MASK (3<<2)
173
174#define S3C2440_DSC1_CS0 (S3C2440_SELECT_DSC1 | 0)
175#define S3C2440_DSC1_CS0_10mA (0<<0)
176#define S3C2440_DSC1_CS0_8mA (1<<0)
177#define S3C2440_DSC1_CS0_6mA (2<<0)
178#define S3C2440_DSC1_CS0_4mA (3<<0)
179#define S3C2440_DSC1_CS0_MASK (3<<0)
180
181#endif /* CONFIG_CPU_S3C2440 */
182
183#endif /* __ASM_ARCH_REGS_DSC_H */
184
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
new file mode 100644
index 000000000000..30bec027f5fa
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
@@ -0,0 +1,1163 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-gpio.h
2 *
3 * Copyright (c) 2003,2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 GPIO register definitions
11*/
12
13
14#ifndef __ASM_ARCH_REGS_GPIO_H
15#define __ASM_ARCH_REGS_GPIO_H "$Id: gpio.h,v 1.5 2003/05/19 12:51:08 ben Exp $"
16
17#define S3C2410_GPIONO(bank,offset) ((bank) + (offset))
18
19#define S3C2410_GPIO_BANKA (32*0)
20#define S3C2410_GPIO_BANKB (32*1)
21#define S3C2410_GPIO_BANKC (32*2)
22#define S3C2410_GPIO_BANKD (32*3)
23#define S3C2410_GPIO_BANKE (32*4)
24#define S3C2410_GPIO_BANKF (32*5)
25#define S3C2410_GPIO_BANKG (32*6)
26#define S3C2410_GPIO_BANKH (32*7)
27
28#ifdef CONFIG_CPU_S3C2400
29#define S3C24XX_GPIO_BASE(x) S3C2400_GPIO_BASE(x)
30#define S3C24XX_MISCCR S3C2400_MISCCR
31#else
32#define S3C24XX_GPIO_BASE(x) S3C2410_GPIO_BASE(x)
33#define S3C24XX_MISCCR S3C24XX_GPIOREG2(0x80)
34#endif /* CONFIG_CPU_S3C2400 */
35
36
37/* S3C2400 doesn't have a 1:1 mapping to S3C2410 gpio base pins */
38
39#define S3C2400_BANKNUM(pin) (((pin) & ~31) / 32)
40#define S3C2400_BASEA2B(pin) ((((pin) & ~31) >> 2))
41#define S3C2400_BASEC2H(pin) ((S3C2400_BANKNUM(pin) * 10) + \
42 (2 * (S3C2400_BANKNUM(pin)-2)))
43
44#define S3C2400_GPIO_BASE(pin) (pin < S3C2410_GPIO_BANKC ? \
45 S3C2400_BASEA2B(pin)+S3C24XX_VA_GPIO : \
46 S3C2400_BASEC2H(pin)+S3C24XX_VA_GPIO)
47
48
49#define S3C2410_GPIO_BASE(pin) ((((pin) & ~31) >> 1) + S3C24XX_VA_GPIO)
50#define S3C2410_GPIO_OFFSET(pin) ((pin) & 31)
51
52/* general configuration options */
53
54#define S3C2410_GPIO_LEAVE (0xFFFFFFFF)
55#define S3C2410_GPIO_INPUT (0xFFFFFFF0) /* not available on A */
56#define S3C2410_GPIO_OUTPUT (0xFFFFFFF1)
57#define S3C2410_GPIO_IRQ (0xFFFFFFF2) /* not available for all */
58#define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* bank A => addr/cs/nand */
59#define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */
60
61/* register address for the GPIO registers.
62 * S3C24XX_GPIOREG2 is for the second set of registers in the
63 * GPIO which move between s3c2410 and s3c2412 type systems */
64
65#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO)
66#define S3C24XX_GPIOREG2(x) ((x) + S3C24XX_VA_GPIO2)
67
68
69/* configure GPIO ports A..G */
70
71/* port A - S3C2410: 22bits, zero in bit X makes pin X output
72 * S3C2400: 18bits, zero in bit X makes pin X output
73 * 1 makes port special function, this is default
74*/
75#define S3C2410_GPACON S3C2410_GPIOREG(0x00)
76#define S3C2410_GPADAT S3C2410_GPIOREG(0x04)
77
78#define S3C2400_GPACON S3C2410_GPIOREG(0x00)
79#define S3C2400_GPADAT S3C2410_GPIOREG(0x04)
80
81#define S3C2410_GPA0 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 0)
82#define S3C2410_GPA0_OUT (0<<0)
83#define S3C2410_GPA0_ADDR0 (1<<0)
84
85#define S3C2410_GPA1 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 1)
86#define S3C2410_GPA1_OUT (0<<1)
87#define S3C2410_GPA1_ADDR16 (1<<1)
88
89#define S3C2410_GPA2 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 2)
90#define S3C2410_GPA2_OUT (0<<2)
91#define S3C2410_GPA2_ADDR17 (1<<2)
92
93#define S3C2410_GPA3 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 3)
94#define S3C2410_GPA3_OUT (0<<3)
95#define S3C2410_GPA3_ADDR18 (1<<3)
96
97#define S3C2410_GPA4 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 4)
98#define S3C2410_GPA4_OUT (0<<4)
99#define S3C2410_GPA4_ADDR19 (1<<4)
100
101#define S3C2410_GPA5 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 5)
102#define S3C2410_GPA5_OUT (0<<5)
103#define S3C2410_GPA5_ADDR20 (1<<5)
104
105#define S3C2410_GPA6 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 6)
106#define S3C2410_GPA6_OUT (0<<6)
107#define S3C2410_GPA6_ADDR21 (1<<6)
108
109#define S3C2410_GPA7 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 7)
110#define S3C2410_GPA7_OUT (0<<7)
111#define S3C2410_GPA7_ADDR22 (1<<7)
112
113#define S3C2410_GPA8 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 8)
114#define S3C2410_GPA8_OUT (0<<8)
115#define S3C2410_GPA8_ADDR23 (1<<8)
116
117#define S3C2410_GPA9 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 9)
118#define S3C2410_GPA9_OUT (0<<9)
119#define S3C2410_GPA9_ADDR24 (1<<9)
120
121#define S3C2410_GPA10 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 10)
122#define S3C2410_GPA10_OUT (0<<10)
123#define S3C2410_GPA10_ADDR25 (1<<10)
124#define S3C2400_GPA10_SCKE (1<<10)
125
126#define S3C2410_GPA11 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 11)
127#define S3C2410_GPA11_OUT (0<<11)
128#define S3C2410_GPA11_ADDR26 (1<<11)
129#define S3C2400_GPA11_nCAS0 (1<<11)
130
131#define S3C2410_GPA12 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 12)
132#define S3C2410_GPA12_OUT (0<<12)
133#define S3C2410_GPA12_nGCS1 (1<<12)
134#define S3C2400_GPA12_nCAS1 (1<<12)
135
136#define S3C2410_GPA13 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 13)
137#define S3C2410_GPA13_OUT (0<<13)
138#define S3C2410_GPA13_nGCS2 (1<<13)
139#define S3C2400_GPA13_nGCS1 (1<<13)
140
141#define S3C2410_GPA14 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 14)
142#define S3C2410_GPA14_OUT (0<<14)
143#define S3C2410_GPA14_nGCS3 (1<<14)
144#define S3C2400_GPA14_nGCS2 (1<<14)
145
146#define S3C2410_GPA15 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 15)
147#define S3C2410_GPA15_OUT (0<<15)
148#define S3C2410_GPA15_nGCS4 (1<<15)
149#define S3C2400_GPA15_nGCS3 (1<<15)
150
151#define S3C2410_GPA16 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 16)
152#define S3C2410_GPA16_OUT (0<<16)
153#define S3C2410_GPA16_nGCS5 (1<<16)
154#define S3C2400_GPA16_nGCS4 (1<<16)
155
156#define S3C2410_GPA17 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 17)
157#define S3C2410_GPA17_OUT (0<<17)
158#define S3C2410_GPA17_CLE (1<<17)
159#define S3C2400_GPA17_nGCS5 (1<<17)
160
161#define S3C2410_GPA18 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 18)
162#define S3C2410_GPA18_OUT (0<<18)
163#define S3C2410_GPA18_ALE (1<<18)
164
165#define S3C2410_GPA19 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 19)
166#define S3C2410_GPA19_OUT (0<<19)
167#define S3C2410_GPA19_nFWE (1<<19)
168
169#define S3C2410_GPA20 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 20)
170#define S3C2410_GPA20_OUT (0<<20)
171#define S3C2410_GPA20_nFRE (1<<20)
172
173#define S3C2410_GPA21 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 21)
174#define S3C2410_GPA21_OUT (0<<21)
175#define S3C2410_GPA21_nRSTOUT (1<<21)
176
177#define S3C2410_GPA22 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 22)
178#define S3C2410_GPA22_OUT (0<<22)
179#define S3C2410_GPA22_nFCE (1<<22)
180
181/* 0x08 and 0x0c are reserved on S3C2410 */
182
183/* S3C2410:
184 * GPB is 10 IO pins, each configured by 2 bits each in GPBCON.
185 * 00 = input, 01 = output, 10=special function, 11=reserved
186
187 * S3C2400:
188 * GPB is 16 IO pins, each configured by 2 bits each in GPBCON.
189 * 00 = input, 01 = output, 10=data, 11=special function
190
191 * bit 0,1 = pin 0, 2,3= pin 1...
192 *
193 * CPBUP = pull up resistor control, 1=disabled, 0=enabled
194*/
195
196#define S3C2410_GPBCON S3C2410_GPIOREG(0x10)
197#define S3C2410_GPBDAT S3C2410_GPIOREG(0x14)
198#define S3C2410_GPBUP S3C2410_GPIOREG(0x18)
199
200#define S3C2400_GPBCON S3C2410_GPIOREG(0x08)
201#define S3C2400_GPBDAT S3C2410_GPIOREG(0x0C)
202#define S3C2400_GPBUP S3C2410_GPIOREG(0x10)
203
204/* no i/o pin in port b can have value 3 (unless it is a s3c2443) ! */
205
206#define S3C2410_GPB0 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 0)
207#define S3C2410_GPB0_INP (0x00 << 0)
208#define S3C2410_GPB0_OUTP (0x01 << 0)
209#define S3C2410_GPB0_TOUT0 (0x02 << 0)
210#define S3C2400_GPB0_DATA16 (0x02 << 0)
211
212#define S3C2410_GPB1 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 1)
213#define S3C2410_GPB1_INP (0x00 << 2)
214#define S3C2410_GPB1_OUTP (0x01 << 2)
215#define S3C2410_GPB1_TOUT1 (0x02 << 2)
216#define S3C2400_GPB1_DATA17 (0x02 << 2)
217
218#define S3C2410_GPB2 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 2)
219#define S3C2410_GPB2_INP (0x00 << 4)
220#define S3C2410_GPB2_OUTP (0x01 << 4)
221#define S3C2410_GPB2_TOUT2 (0x02 << 4)
222#define S3C2400_GPB2_DATA18 (0x02 << 4)
223#define S3C2400_GPB2_TCLK1 (0x03 << 4)
224
225#define S3C2410_GPB3 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 3)
226#define S3C2410_GPB3_INP (0x00 << 6)
227#define S3C2410_GPB3_OUTP (0x01 << 6)
228#define S3C2410_GPB3_TOUT3 (0x02 << 6)
229#define S3C2400_GPB3_DATA19 (0x02 << 6)
230#define S3C2400_GPB3_TXD1 (0x03 << 6)
231
232#define S3C2410_GPB4 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 4)
233#define S3C2410_GPB4_INP (0x00 << 8)
234#define S3C2410_GPB4_OUTP (0x01 << 8)
235#define S3C2410_GPB4_TCLK0 (0x02 << 8)
236#define S3C2400_GPB4_DATA20 (0x02 << 8)
237#define S3C2410_GPB4_MASK (0x03 << 8)
238#define S3C2400_GPB4_RXD1 (0x03 << 8)
239#define S3C2400_GPB4_MASK (0x03 << 8)
240
241#define S3C2410_GPB5 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 5)
242#define S3C2410_GPB5_INP (0x00 << 10)
243#define S3C2410_GPB5_OUTP (0x01 << 10)
244#define S3C2410_GPB5_nXBACK (0x02 << 10)
245#define S3C2443_GPB5_XBACK (0x03 << 10)
246#define S3C2400_GPB5_DATA21 (0x02 << 10)
247#define S3C2400_GPB5_nCTS1 (0x03 << 10)
248
249#define S3C2410_GPB6 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 6)
250#define S3C2410_GPB6_INP (0x00 << 12)
251#define S3C2410_GPB6_OUTP (0x01 << 12)
252#define S3C2410_GPB6_nXBREQ (0x02 << 12)
253#define S3C2443_GPB6_XBREQ (0x03 << 12)
254#define S3C2400_GPB6_DATA22 (0x02 << 12)
255#define S3C2400_GPB6_nRTS1 (0x03 << 12)
256
257#define S3C2410_GPB7 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 7)
258#define S3C2410_GPB7_INP (0x00 << 14)
259#define S3C2410_GPB7_OUTP (0x01 << 14)
260#define S3C2410_GPB7_nXDACK1 (0x02 << 14)
261#define S3C2443_GPB7_XDACK1 (0x03 << 14)
262#define S3C2400_GPB7_DATA23 (0x02 << 14)
263
264#define S3C2410_GPB8 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 8)
265#define S3C2410_GPB8_INP (0x00 << 16)
266#define S3C2410_GPB8_OUTP (0x01 << 16)
267#define S3C2410_GPB8_nXDREQ1 (0x02 << 16)
268#define S3C2400_GPB8_DATA24 (0x02 << 16)
269
270#define S3C2410_GPB9 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 9)
271#define S3C2410_GPB9_INP (0x00 << 18)
272#define S3C2410_GPB9_OUTP (0x01 << 18)
273#define S3C2410_GPB9_nXDACK0 (0x02 << 18)
274#define S3C2443_GPB9_XDACK0 (0x03 << 18)
275#define S3C2400_GPB9_DATA25 (0x02 << 18)
276#define S3C2400_GPB9_I2SSDI (0x03 << 18)
277
278#define S3C2410_GPB10 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 10)
279#define S3C2410_GPB10_INP (0x00 << 20)
280#define S3C2410_GPB10_OUTP (0x01 << 20)
281#define S3C2410_GPB10_nXDRE0 (0x02 << 20)
282#define S3C2443_GPB10_XDREQ0 (0x03 << 20)
283#define S3C2400_GPB10_DATA26 (0x02 << 20)
284#define S3C2400_GPB10_nSS (0x03 << 20)
285
286#define S3C2400_GPB11 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 11)
287#define S3C2400_GPB11_INP (0x00 << 22)
288#define S3C2400_GPB11_OUTP (0x01 << 22)
289#define S3C2400_GPB11_DATA27 (0x02 << 22)
290
291#define S3C2400_GPB12 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 12)
292#define S3C2400_GPB12_INP (0x00 << 24)
293#define S3C2400_GPB12_OUTP (0x01 << 24)
294#define S3C2400_GPB12_DATA28 (0x02 << 24)
295
296#define S3C2400_GPB13 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 13)
297#define S3C2400_GPB13_INP (0x00 << 26)
298#define S3C2400_GPB13_OUTP (0x01 << 26)
299#define S3C2400_GPB13_DATA29 (0x02 << 26)
300
301#define S3C2400_GPB14 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 14)
302#define S3C2400_GPB14_INP (0x00 << 28)
303#define S3C2400_GPB14_OUTP (0x01 << 28)
304#define S3C2400_GPB14_DATA30 (0x02 << 28)
305
306#define S3C2400_GPB15 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 15)
307#define S3C2400_GPB15_INP (0x00 << 30)
308#define S3C2400_GPB15_OUTP (0x01 << 30)
309#define S3C2400_GPB15_DATA31 (0x02 << 30)
310
311#define S3C2410_GPB_PUPDIS(x) (1<<(x))
312
313/* Port C consits of 16 GPIO/Special function
314 *
315 * almost identical setup to port b, but the special functions are mostly
316 * to do with the video system's sync/etc.
317*/
318
319#define S3C2410_GPCCON S3C2410_GPIOREG(0x20)
320#define S3C2410_GPCDAT S3C2410_GPIOREG(0x24)
321#define S3C2410_GPCUP S3C2410_GPIOREG(0x28)
322
323#define S3C2400_GPCCON S3C2410_GPIOREG(0x14)
324#define S3C2400_GPCDAT S3C2410_GPIOREG(0x18)
325#define S3C2400_GPCUP S3C2410_GPIOREG(0x1C)
326
327#define S3C2410_GPC0 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 0)
328#define S3C2410_GPC0_INP (0x00 << 0)
329#define S3C2410_GPC0_OUTP (0x01 << 0)
330#define S3C2410_GPC0_LEND (0x02 << 0)
331#define S3C2400_GPC0_VD0 (0x02 << 0)
332
333#define S3C2410_GPC1 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 1)
334#define S3C2410_GPC1_INP (0x00 << 2)
335#define S3C2410_GPC1_OUTP (0x01 << 2)
336#define S3C2410_GPC1_VCLK (0x02 << 2)
337#define S3C2400_GPC1_VD1 (0x02 << 2)
338
339#define S3C2410_GPC2 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 2)
340#define S3C2410_GPC2_INP (0x00 << 4)
341#define S3C2410_GPC2_OUTP (0x01 << 4)
342#define S3C2410_GPC2_VLINE (0x02 << 4)
343#define S3C2400_GPC2_VD2 (0x02 << 4)
344
345#define S3C2410_GPC3 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 3)
346#define S3C2410_GPC3_INP (0x00 << 6)
347#define S3C2410_GPC3_OUTP (0x01 << 6)
348#define S3C2410_GPC3_VFRAME (0x02 << 6)
349#define S3C2400_GPC3_VD3 (0x02 << 6)
350
351#define S3C2410_GPC4 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 4)
352#define S3C2410_GPC4_INP (0x00 << 8)
353#define S3C2410_GPC4_OUTP (0x01 << 8)
354#define S3C2410_GPC4_VM (0x02 << 8)
355#define S3C2400_GPC4_VD4 (0x02 << 8)
356
357#define S3C2410_GPC5 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 5)
358#define S3C2410_GPC5_INP (0x00 << 10)
359#define S3C2410_GPC5_OUTP (0x01 << 10)
360#define S3C2410_GPC5_LCDVF0 (0x02 << 10)
361#define S3C2400_GPC5_VD5 (0x02 << 10)
362
363#define S3C2410_GPC6 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 6)
364#define S3C2410_GPC6_INP (0x00 << 12)
365#define S3C2410_GPC6_OUTP (0x01 << 12)
366#define S3C2410_GPC6_LCDVF1 (0x02 << 12)
367#define S3C2400_GPC6_VD6 (0x02 << 12)
368
369#define S3C2410_GPC7 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 7)
370#define S3C2410_GPC7_INP (0x00 << 14)
371#define S3C2410_GPC7_OUTP (0x01 << 14)
372#define S3C2410_GPC7_LCDVF2 (0x02 << 14)
373#define S3C2400_GPC7_VD7 (0x02 << 14)
374
375#define S3C2410_GPC8 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 8)
376#define S3C2410_GPC8_INP (0x00 << 16)
377#define S3C2410_GPC8_OUTP (0x01 << 16)
378#define S3C2410_GPC8_VD0 (0x02 << 16)
379#define S3C2400_GPC8_VD8 (0x02 << 16)
380
381#define S3C2410_GPC9 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 9)
382#define S3C2410_GPC9_INP (0x00 << 18)
383#define S3C2410_GPC9_OUTP (0x01 << 18)
384#define S3C2410_GPC9_VD1 (0x02 << 18)
385#define S3C2400_GPC9_VD9 (0x02 << 18)
386
387#define S3C2410_GPC10 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 10)
388#define S3C2410_GPC10_INP (0x00 << 20)
389#define S3C2410_GPC10_OUTP (0x01 << 20)
390#define S3C2410_GPC10_VD2 (0x02 << 20)
391#define S3C2400_GPC10_VD10 (0x02 << 20)
392
393#define S3C2410_GPC11 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 11)
394#define S3C2410_GPC11_INP (0x00 << 22)
395#define S3C2410_GPC11_OUTP (0x01 << 22)
396#define S3C2410_GPC11_VD3 (0x02 << 22)
397#define S3C2400_GPC11_VD11 (0x02 << 22)
398
399#define S3C2410_GPC12 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 12)
400#define S3C2410_GPC12_INP (0x00 << 24)
401#define S3C2410_GPC12_OUTP (0x01 << 24)
402#define S3C2410_GPC12_VD4 (0x02 << 24)
403#define S3C2400_GPC12_VD12 (0x02 << 24)
404
405#define S3C2410_GPC13 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 13)
406#define S3C2410_GPC13_INP (0x00 << 26)
407#define S3C2410_GPC13_OUTP (0x01 << 26)
408#define S3C2410_GPC13_VD5 (0x02 << 26)
409#define S3C2400_GPC13_VD13 (0x02 << 26)
410
411#define S3C2410_GPC14 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 14)
412#define S3C2410_GPC14_INP (0x00 << 28)
413#define S3C2410_GPC14_OUTP (0x01 << 28)
414#define S3C2410_GPC14_VD6 (0x02 << 28)
415#define S3C2400_GPC14_VD14 (0x02 << 28)
416
417#define S3C2410_GPC15 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 15)
418#define S3C2410_GPC15_INP (0x00 << 30)
419#define S3C2410_GPC15_OUTP (0x01 << 30)
420#define S3C2410_GPC15_VD7 (0x02 << 30)
421#define S3C2400_GPC15_VD15 (0x02 << 30)
422
423#define S3C2410_GPC_PUPDIS(x) (1<<(x))
424
425/*
426 * S3C2410: Port D consists of 16 GPIO/Special function
427 *
428 * almost identical setup to port b, but the special functions are mostly
429 * to do with the video system's data.
430 *
431 * S3C2400: Port D consists of 11 GPIO/Special function
432 *
433 * almost identical setup to port c
434*/
435
436#define S3C2410_GPDCON S3C2410_GPIOREG(0x30)
437#define S3C2410_GPDDAT S3C2410_GPIOREG(0x34)
438#define S3C2410_GPDUP S3C2410_GPIOREG(0x38)
439
440#define S3C2400_GPDCON S3C2410_GPIOREG(0x20)
441#define S3C2400_GPDDAT S3C2410_GPIOREG(0x24)
442#define S3C2400_GPDUP S3C2410_GPIOREG(0x28)
443
444#define S3C2410_GPD0 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 0)
445#define S3C2410_GPD0_INP (0x00 << 0)
446#define S3C2410_GPD0_OUTP (0x01 << 0)
447#define S3C2410_GPD0_VD8 (0x02 << 0)
448#define S3C2400_GPD0_VFRAME (0x02 << 0)
449#define S3C2442_GPD0_nSPICS1 (0x03 << 0)
450
451#define S3C2410_GPD1 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 1)
452#define S3C2410_GPD1_INP (0x00 << 2)
453#define S3C2410_GPD1_OUTP (0x01 << 2)
454#define S3C2410_GPD1_VD9 (0x02 << 2)
455#define S3C2400_GPD1_VM (0x02 << 2)
456#define S3C2442_GPD1_SPICLK1 (0x03 << 2)
457
458#define S3C2410_GPD2 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 2)
459#define S3C2410_GPD2_INP (0x00 << 4)
460#define S3C2410_GPD2_OUTP (0x01 << 4)
461#define S3C2410_GPD2_VD10 (0x02 << 4)
462#define S3C2400_GPD2_VLINE (0x02 << 4)
463
464#define S3C2410_GPD3 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 3)
465#define S3C2410_GPD3_INP (0x00 << 6)
466#define S3C2410_GPD3_OUTP (0x01 << 6)
467#define S3C2410_GPD3_VD11 (0x02 << 6)
468#define S3C2400_GPD3_VCLK (0x02 << 6)
469
470#define S3C2410_GPD4 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 4)
471#define S3C2410_GPD4_INP (0x00 << 8)
472#define S3C2410_GPD4_OUTP (0x01 << 8)
473#define S3C2410_GPD4_VD12 (0x02 << 8)
474#define S3C2400_GPD4_LEND (0x02 << 8)
475
476#define S3C2410_GPD5 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 5)
477#define S3C2410_GPD5_INP (0x00 << 10)
478#define S3C2410_GPD5_OUTP (0x01 << 10)
479#define S3C2410_GPD5_VD13 (0x02 << 10)
480#define S3C2400_GPD5_TOUT0 (0x02 << 10)
481
482#define S3C2410_GPD6 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 6)
483#define S3C2410_GPD6_INP (0x00 << 12)
484#define S3C2410_GPD6_OUTP (0x01 << 12)
485#define S3C2410_GPD6_VD14 (0x02 << 12)
486#define S3C2400_GPD6_TOUT1 (0x02 << 12)
487
488#define S3C2410_GPD7 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 7)
489#define S3C2410_GPD7_INP (0x00 << 14)
490#define S3C2410_GPD7_OUTP (0x01 << 14)
491#define S3C2410_GPD7_VD15 (0x02 << 14)
492#define S3C2400_GPD7_TOUT2 (0x02 << 14)
493
494#define S3C2410_GPD8 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 8)
495#define S3C2410_GPD8_INP (0x00 << 16)
496#define S3C2410_GPD8_OUTP (0x01 << 16)
497#define S3C2410_GPD8_VD16 (0x02 << 16)
498#define S3C2400_GPD8_TOUT3 (0x02 << 16)
499
500#define S3C2410_GPD9 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 9)
501#define S3C2410_GPD9_INP (0x00 << 18)
502#define S3C2410_GPD9_OUTP (0x01 << 18)
503#define S3C2410_GPD9_VD17 (0x02 << 18)
504#define S3C2400_GPD9_TCLK0 (0x02 << 18)
505#define S3C2410_GPD9_MASK (0x03 << 18)
506
507#define S3C2410_GPD10 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 10)
508#define S3C2410_GPD10_INP (0x00 << 20)
509#define S3C2410_GPD10_OUTP (0x01 << 20)
510#define S3C2410_GPD10_VD18 (0x02 << 20)
511#define S3C2400_GPD10_nWAIT (0x02 << 20)
512
513#define S3C2410_GPD11 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 11)
514#define S3C2410_GPD11_INP (0x00 << 22)
515#define S3C2410_GPD11_OUTP (0x01 << 22)
516#define S3C2410_GPD11_VD19 (0x02 << 22)
517
518#define S3C2410_GPD12 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 12)
519#define S3C2410_GPD12_INP (0x00 << 24)
520#define S3C2410_GPD12_OUTP (0x01 << 24)
521#define S3C2410_GPD12_VD20 (0x02 << 24)
522
523#define S3C2410_GPD13 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 13)
524#define S3C2410_GPD13_INP (0x00 << 26)
525#define S3C2410_GPD13_OUTP (0x01 << 26)
526#define S3C2410_GPD13_VD21 (0x02 << 26)
527
528#define S3C2410_GPD14 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 14)
529#define S3C2410_GPD14_INP (0x00 << 28)
530#define S3C2410_GPD14_OUTP (0x01 << 28)
531#define S3C2410_GPD14_VD22 (0x02 << 28)
532#define S3C2410_GPD14_nSS1 (0x03 << 28)
533
534#define S3C2410_GPD15 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 15)
535#define S3C2410_GPD15_INP (0x00 << 30)
536#define S3C2410_GPD15_OUTP (0x01 << 30)
537#define S3C2410_GPD15_VD23 (0x02 << 30)
538#define S3C2410_GPD15_nSS0 (0x03 << 30)
539
540#define S3C2410_GPD_PUPDIS(x) (1<<(x))
541
542/* S3C2410:
543 * Port E consists of 16 GPIO/Special function
544 *
545 * again, the same as port B, but dealing with I2S, SDI, and
546 * more miscellaneous functions
547 *
548 * S3C2400:
549 * Port E consists of 12 GPIO/Special function
550 *
551 * GPIO / interrupt inputs
552*/
553
554#define S3C2410_GPECON S3C2410_GPIOREG(0x40)
555#define S3C2410_GPEDAT S3C2410_GPIOREG(0x44)
556#define S3C2410_GPEUP S3C2410_GPIOREG(0x48)
557
558#define S3C2400_GPECON S3C2410_GPIOREG(0x2C)
559#define S3C2400_GPEDAT S3C2410_GPIOREG(0x30)
560#define S3C2400_GPEUP S3C2410_GPIOREG(0x34)
561
562#define S3C2410_GPE0 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 0)
563#define S3C2410_GPE0_INP (0x00 << 0)
564#define S3C2410_GPE0_OUTP (0x01 << 0)
565#define S3C2410_GPE0_I2SLRCK (0x02 << 0)
566#define S3C2443_GPE0_AC_nRESET (0x03 << 0)
567#define S3C2400_GPE0_EINT0 (0x02 << 0)
568#define S3C2410_GPE0_MASK (0x03 << 0)
569
570#define S3C2410_GPE1 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 1)
571#define S3C2410_GPE1_INP (0x00 << 2)
572#define S3C2410_GPE1_OUTP (0x01 << 2)
573#define S3C2410_GPE1_I2SSCLK (0x02 << 2)
574#define S3C2443_GPE1_AC_SYNC (0x03 << 2)
575#define S3C2400_GPE1_EINT1 (0x02 << 2)
576#define S3C2400_GPE1_nSS (0x03 << 2)
577#define S3C2410_GPE1_MASK (0x03 << 2)
578
579#define S3C2410_GPE2 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 2)
580#define S3C2410_GPE2_INP (0x00 << 4)
581#define S3C2410_GPE2_OUTP (0x01 << 4)
582#define S3C2410_GPE2_CDCLK (0x02 << 4)
583#define S3C2443_GPE2_AC_BITCLK (0x03 << 4)
584#define S3C2400_GPE2_EINT2 (0x02 << 4)
585#define S3C2400_GPE2_I2SSDI (0x03 << 4)
586
587#define S3C2410_GPE3 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 3)
588#define S3C2410_GPE3_INP (0x00 << 6)
589#define S3C2410_GPE3_OUTP (0x01 << 6)
590#define S3C2410_GPE3_I2SSDI (0x02 << 6)
591#define S3C2443_GPE3_AC_SDI (0x03 << 6)
592#define S3C2400_GPE3_EINT3 (0x02 << 6)
593#define S3C2400_GPE3_nCTS1 (0x03 << 6)
594#define S3C2410_GPE3_nSS0 (0x03 << 6)
595#define S3C2410_GPE3_MASK (0x03 << 6)
596
597#define S3C2410_GPE4 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 4)
598#define S3C2410_GPE4_INP (0x00 << 8)
599#define S3C2410_GPE4_OUTP (0x01 << 8)
600#define S3C2410_GPE4_I2SSDO (0x02 << 8)
601#define S3C2443_GPE4_AC_SDO (0x03 << 8)
602#define S3C2400_GPE4_EINT4 (0x02 << 8)
603#define S3C2400_GPE4_nRTS1 (0x03 << 8)
604#define S3C2410_GPE4_I2SSDI (0x03 << 8)
605#define S3C2410_GPE4_MASK (0x03 << 8)
606
607#define S3C2410_GPE5 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 5)
608#define S3C2410_GPE5_INP (0x00 << 10)
609#define S3C2410_GPE5_OUTP (0x01 << 10)
610#define S3C2410_GPE5_SDCLK (0x02 << 10)
611#define S3C2443_GPE5_SD1_CLK (0x02 << 10)
612#define S3C2400_GPE5_EINT5 (0x02 << 10)
613#define S3C2400_GPE5_TCLK1 (0x03 << 10)
614
615#define S3C2410_GPE6 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 6)
616#define S3C2410_GPE6_INP (0x00 << 12)
617#define S3C2410_GPE6_OUTP (0x01 << 12)
618#define S3C2410_GPE6_SDCMD (0x02 << 12)
619#define S3C2443_GPE6_SD1_CMD (0x02 << 12)
620#define S3C2443_GPE6_AC_BITCLK (0x03 << 12)
621#define S3C2400_GPE6_EINT6 (0x02 << 12)
622
623#define S3C2410_GPE7 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 7)
624#define S3C2410_GPE7_INP (0x00 << 14)
625#define S3C2410_GPE7_OUTP (0x01 << 14)
626#define S3C2410_GPE7_SDDAT0 (0x02 << 14)
627#define S3C2443_GPE5_SD1_DAT0 (0x02 << 14)
628#define S3C2443_GPE7_AC_SDI (0x03 << 14)
629#define S3C2400_GPE7_EINT7 (0x02 << 14)
630
631#define S3C2410_GPE8 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 8)
632#define S3C2410_GPE8_INP (0x00 << 16)
633#define S3C2410_GPE8_OUTP (0x01 << 16)
634#define S3C2410_GPE8_SDDAT1 (0x02 << 16)
635#define S3C2443_GPE8_SD1_DAT1 (0x02 << 16)
636#define S3C2443_GPE8_AC_SDO (0x03 << 16)
637#define S3C2400_GPE8_nXDACK0 (0x02 << 16)
638
639#define S3C2410_GPE9 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 9)
640#define S3C2410_GPE9_INP (0x00 << 18)
641#define S3C2410_GPE9_OUTP (0x01 << 18)
642#define S3C2410_GPE9_SDDAT2 (0x02 << 18)
643#define S3C2443_GPE9_SD1_DAT2 (0x02 << 18)
644#define S3C2443_GPE9_AC_SYNC (0x03 << 18)
645#define S3C2400_GPE9_nXDACK1 (0x02 << 18)
646#define S3C2400_GPE9_nXBACK (0x03 << 18)
647
648#define S3C2410_GPE10 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 10)
649#define S3C2410_GPE10_INP (0x00 << 20)
650#define S3C2410_GPE10_OUTP (0x01 << 20)
651#define S3C2410_GPE10_SDDAT3 (0x02 << 20)
652#define S3C2443_GPE10_SD1_DAT3 (0x02 << 20)
653#define S3C2443_GPE10_AC_nRESET (0x03 << 20)
654#define S3C2400_GPE10_nXDREQ0 (0x02 << 20)
655
656#define S3C2410_GPE11 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 11)
657#define S3C2410_GPE11_INP (0x00 << 22)
658#define S3C2410_GPE11_OUTP (0x01 << 22)
659#define S3C2410_GPE11_SPIMISO0 (0x02 << 22)
660#define S3C2400_GPE11_nXDREQ1 (0x02 << 22)
661#define S3C2400_GPE11_nXBREQ (0x03 << 22)
662
663#define S3C2410_GPE12 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 12)
664#define S3C2410_GPE12_INP (0x00 << 24)
665#define S3C2410_GPE12_OUTP (0x01 << 24)
666#define S3C2410_GPE12_SPIMOSI0 (0x02 << 24)
667
668#define S3C2410_GPE13 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 13)
669#define S3C2410_GPE13_INP (0x00 << 26)
670#define S3C2410_GPE13_OUTP (0x01 << 26)
671#define S3C2410_GPE13_SPICLK0 (0x02 << 26)
672
673#define S3C2410_GPE14 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 14)
674#define S3C2410_GPE14_INP (0x00 << 28)
675#define S3C2410_GPE14_OUTP (0x01 << 28)
676#define S3C2410_GPE14_IICSCL (0x02 << 28)
677#define S3C2410_GPE14_MASK (0x03 << 28)
678
679#define S3C2410_GPE15 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 15)
680#define S3C2410_GPE15_INP (0x00 << 30)
681#define S3C2410_GPE15_OUTP (0x01 << 30)
682#define S3C2410_GPE15_IICSDA (0x02 << 30)
683#define S3C2410_GPE15_MASK (0x03 << 30)
684
685#define S3C2440_GPE0_ACSYNC (0x03 << 0)
686#define S3C2440_GPE1_ACBITCLK (0x03 << 2)
687#define S3C2440_GPE2_ACRESET (0x03 << 4)
688#define S3C2440_GPE3_ACIN (0x03 << 6)
689#define S3C2440_GPE4_ACOUT (0x03 << 8)
690
691#define S3C2410_GPE_PUPDIS(x) (1<<(x))
692
693/* S3C2410:
694 * Port F consists of 8 GPIO/Special function
695 *
696 * GPIO / interrupt inputs
697 *
698 * GPFCON has 2 bits for each of the input pins on port F
699 * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 undefined
700 *
701 * pull up works like all other ports.
702 *
703 * S3C2400:
704 * Port F consists of 7 GPIO/Special function
705 *
706 * GPIO/serial/misc pins
707*/
708
709#define S3C2410_GPFCON S3C2410_GPIOREG(0x50)
710#define S3C2410_GPFDAT S3C2410_GPIOREG(0x54)
711#define S3C2410_GPFUP S3C2410_GPIOREG(0x58)
712
713#define S3C2400_GPFCON S3C2410_GPIOREG(0x38)
714#define S3C2400_GPFDAT S3C2410_GPIOREG(0x3C)
715#define S3C2400_GPFUP S3C2410_GPIOREG(0x40)
716
717#define S3C2410_GPF0 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 0)
718#define S3C2410_GPF0_INP (0x00 << 0)
719#define S3C2410_GPF0_OUTP (0x01 << 0)
720#define S3C2410_GPF0_EINT0 (0x02 << 0)
721#define S3C2400_GPF0_RXD0 (0x02 << 0)
722
723#define S3C2410_GPF1 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 1)
724#define S3C2410_GPF1_INP (0x00 << 2)
725#define S3C2410_GPF1_OUTP (0x01 << 2)
726#define S3C2410_GPF1_EINT1 (0x02 << 2)
727#define S3C2400_GPF1_RXD1 (0x02 << 2)
728#define S3C2400_GPF1_IICSDA (0x03 << 2)
729
730#define S3C2410_GPF2 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 2)
731#define S3C2410_GPF2_INP (0x00 << 4)
732#define S3C2410_GPF2_OUTP (0x01 << 4)
733#define S3C2410_GPF2_EINT2 (0x02 << 4)
734#define S3C2400_GPF2_TXD0 (0x02 << 4)
735
736#define S3C2410_GPF3 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 3)
737#define S3C2410_GPF3_INP (0x00 << 6)
738#define S3C2410_GPF3_OUTP (0x01 << 6)
739#define S3C2410_GPF3_EINT3 (0x02 << 6)
740#define S3C2400_GPF3_TXD1 (0x02 << 6)
741#define S3C2400_GPF3_IICSCL (0x03 << 6)
742
743#define S3C2410_GPF4 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 4)
744#define S3C2410_GPF4_INP (0x00 << 8)
745#define S3C2410_GPF4_OUTP (0x01 << 8)
746#define S3C2410_GPF4_EINT4 (0x02 << 8)
747#define S3C2400_GPF4_nRTS0 (0x02 << 8)
748#define S3C2400_GPF4_nXBACK (0x03 << 8)
749
750#define S3C2410_GPF5 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 5)
751#define S3C2410_GPF5_INP (0x00 << 10)
752#define S3C2410_GPF5_OUTP (0x01 << 10)
753#define S3C2410_GPF5_EINT5 (0x02 << 10)
754#define S3C2400_GPF5_nCTS0 (0x02 << 10)
755#define S3C2400_GPF5_nXBREQ (0x03 << 10)
756
757#define S3C2410_GPF6 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 6)
758#define S3C2410_GPF6_INP (0x00 << 12)
759#define S3C2410_GPF6_OUTP (0x01 << 12)
760#define S3C2410_GPF6_EINT6 (0x02 << 12)
761#define S3C2400_GPF6_CLKOUT (0x02 << 12)
762
763#define S3C2410_GPF7 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 7)
764#define S3C2410_GPF7_INP (0x00 << 14)
765#define S3C2410_GPF7_OUTP (0x01 << 14)
766#define S3C2410_GPF7_EINT7 (0x02 << 14)
767
768#define S3C2410_GPF_PUPDIS(x) (1<<(x))
769
770/* S3C2410:
771 * Port G consists of 8 GPIO/IRQ/Special function
772 *
773 * GPGCON has 2 bits for each of the input pins on port F
774 * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func
775 *
776 * pull up works like all other ports.
777 *
778 * S3C2400:
779 * Port G consists of 10 GPIO/Special function
780*/
781
782#define S3C2410_GPGCON S3C2410_GPIOREG(0x60)
783#define S3C2410_GPGDAT S3C2410_GPIOREG(0x64)
784#define S3C2410_GPGUP S3C2410_GPIOREG(0x68)
785
786#define S3C2400_GPGCON S3C2410_GPIOREG(0x44)
787#define S3C2400_GPGDAT S3C2410_GPIOREG(0x48)
788#define S3C2400_GPGUP S3C2410_GPIOREG(0x4C)
789
790#define S3C2410_GPG0 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 0)
791#define S3C2410_GPG0_INP (0x00 << 0)
792#define S3C2410_GPG0_OUTP (0x01 << 0)
793#define S3C2410_GPG0_EINT8 (0x02 << 0)
794#define S3C2400_GPG0_I2SLRCK (0x02 << 0)
795
796#define S3C2410_GPG1 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 1)
797#define S3C2410_GPG1_INP (0x00 << 2)
798#define S3C2410_GPG1_OUTP (0x01 << 2)
799#define S3C2410_GPG1_EINT9 (0x02 << 2)
800#define S3C2400_GPG1_I2SSCLK (0x02 << 2)
801
802#define S3C2410_GPG2 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 2)
803#define S3C2410_GPG2_INP (0x00 << 4)
804#define S3C2410_GPG2_OUTP (0x01 << 4)
805#define S3C2410_GPG2_EINT10 (0x02 << 4)
806#define S3C2410_GPG2_nSS0 (0x03 << 4)
807#define S3C2400_GPG2_CDCLK (0x02 << 4)
808
809#define S3C2410_GPG3 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 3)
810#define S3C2410_GPG3_INP (0x00 << 6)
811#define S3C2410_GPG3_OUTP (0x01 << 6)
812#define S3C2410_GPG3_EINT11 (0x02 << 6)
813#define S3C2410_GPG3_nSS1 (0x03 << 6)
814#define S3C2400_GPG3_I2SSDO (0x02 << 6)
815#define S3C2400_GPG3_I2SSDI (0x03 << 6)
816
817#define S3C2410_GPG4 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 4)
818#define S3C2410_GPG4_INP (0x00 << 8)
819#define S3C2410_GPG4_OUTP (0x01 << 8)
820#define S3C2410_GPG4_EINT12 (0x02 << 8)
821#define S3C2400_GPG4_MMCCLK (0x02 << 8)
822#define S3C2400_GPG4_I2SSDI (0x03 << 8)
823#define S3C2410_GPG4_LCDPWREN (0x03 << 8)
824#define S3C2443_GPG4_LCDPWRDN (0x03 << 8)
825
826#define S3C2410_GPG5 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 5)
827#define S3C2410_GPG5_INP (0x00 << 10)
828#define S3C2410_GPG5_OUTP (0x01 << 10)
829#define S3C2410_GPG5_EINT13 (0x02 << 10)
830#define S3C2400_GPG5_MMCCMD (0x02 << 10)
831#define S3C2400_GPG5_IICSDA (0x03 << 10)
832#define S3C2410_GPG5_SPIMISO1 (0x03 << 10) /* not s3c2443 */
833
834#define S3C2410_GPG6 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 6)
835#define S3C2410_GPG6_INP (0x00 << 12)
836#define S3C2410_GPG6_OUTP (0x01 << 12)
837#define S3C2410_GPG6_EINT14 (0x02 << 12)
838#define S3C2400_GPG6_MMCDAT (0x02 << 12)
839#define S3C2400_GPG6_IICSCL (0x03 << 12)
840#define S3C2410_GPG6_SPIMOSI1 (0x03 << 12)
841
842#define S3C2410_GPG7 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 7)
843#define S3C2410_GPG7_INP (0x00 << 14)
844#define S3C2410_GPG7_OUTP (0x01 << 14)
845#define S3C2410_GPG7_EINT15 (0x02 << 14)
846#define S3C2410_GPG7_SPICLK1 (0x03 << 14)
847#define S3C2400_GPG7_SPIMISO (0x02 << 14)
848#define S3C2400_GPG7_IICSDA (0x03 << 14)
849
850#define S3C2410_GPG8 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 8)
851#define S3C2410_GPG8_INP (0x00 << 16)
852#define S3C2410_GPG8_OUTP (0x01 << 16)
853#define S3C2410_GPG8_EINT16 (0x02 << 16)
854#define S3C2400_GPG8_SPIMOSI (0x02 << 16)
855#define S3C2400_GPG8_IICSCL (0x03 << 16)
856
857#define S3C2410_GPG9 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 9)
858#define S3C2410_GPG9_INP (0x00 << 18)
859#define S3C2410_GPG9_OUTP (0x01 << 18)
860#define S3C2410_GPG9_EINT17 (0x02 << 18)
861#define S3C2400_GPG9_SPICLK (0x02 << 18)
862#define S3C2400_GPG9_MMCCLK (0x03 << 18)
863
864#define S3C2410_GPG10 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 10)
865#define S3C2410_GPG10_INP (0x00 << 20)
866#define S3C2410_GPG10_OUTP (0x01 << 20)
867#define S3C2410_GPG10_EINT18 (0x02 << 20)
868
869#define S3C2410_GPG11 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 11)
870#define S3C2410_GPG11_INP (0x00 << 22)
871#define S3C2410_GPG11_OUTP (0x01 << 22)
872#define S3C2410_GPG11_EINT19 (0x02 << 22)
873#define S3C2410_GPG11_TCLK1 (0x03 << 22)
874#define S3C2443_GPG11_CF_nIREQ (0x03 << 22)
875
876#define S3C2410_GPG12 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 12)
877#define S3C2410_GPG12_INP (0x00 << 24)
878#define S3C2410_GPG12_OUTP (0x01 << 24)
879#define S3C2410_GPG12_EINT20 (0x02 << 24)
880#define S3C2410_GPG12_XMON (0x03 << 24)
881#define S3C2442_GPG12_nSPICS0 (0x03 << 24)
882#define S3C2443_GPG12_nINPACK (0x03 << 24)
883
884#define S3C2410_GPG13 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 13)
885#define S3C2410_GPG13_INP (0x00 << 26)
886#define S3C2410_GPG13_OUTP (0x01 << 26)
887#define S3C2410_GPG13_EINT21 (0x02 << 26)
888#define S3C2410_GPG13_nXPON (0x03 << 26)
889#define S3C2443_GPG13_CF_nREG (0x03 << 26)
890
891#define S3C2410_GPG14 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 14)
892#define S3C2410_GPG14_INP (0x00 << 28)
893#define S3C2410_GPG14_OUTP (0x01 << 28)
894#define S3C2410_GPG14_EINT22 (0x02 << 28)
895#define S3C2410_GPG14_YMON (0x03 << 28)
896#define S3C2443_GPG14_CF_RESET (0x03 << 28)
897
898#define S3C2410_GPG15 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 15)
899#define S3C2410_GPG15_INP (0x00 << 30)
900#define S3C2410_GPG15_OUTP (0x01 << 30)
901#define S3C2410_GPG15_EINT23 (0x02 << 30)
902#define S3C2410_GPG15_nYPON (0x03 << 30)
903#define S3C2443_GPG15_CF_PWR (0x03 << 30)
904
905#define S3C2410_GPG_PUPDIS(x) (1<<(x))
906
907/* Port H consists of11 GPIO/serial/Misc pins
908 *
909 * GPGCON has 2 bits for each of the input pins on port F
910 * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func
911 *
912 * pull up works like all other ports.
913*/
914
915#define S3C2410_GPHCON S3C2410_GPIOREG(0x70)
916#define S3C2410_GPHDAT S3C2410_GPIOREG(0x74)
917#define S3C2410_GPHUP S3C2410_GPIOREG(0x78)
918
919#define S3C2410_GPH0 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 0)
920#define S3C2410_GPH0_INP (0x00 << 0)
921#define S3C2410_GPH0_OUTP (0x01 << 0)
922#define S3C2410_GPH0_nCTS0 (0x02 << 0)
923
924#define S3C2410_GPH1 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 1)
925#define S3C2410_GPH1_INP (0x00 << 2)
926#define S3C2410_GPH1_OUTP (0x01 << 2)
927#define S3C2410_GPH1_nRTS0 (0x02 << 2)
928
929#define S3C2410_GPH2 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 2)
930#define S3C2410_GPH2_INP (0x00 << 4)
931#define S3C2410_GPH2_OUTP (0x01 << 4)
932#define S3C2410_GPH2_TXD0 (0x02 << 4)
933
934#define S3C2410_GPH3 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 3)
935#define S3C2410_GPH3_INP (0x00 << 6)
936#define S3C2410_GPH3_OUTP (0x01 << 6)
937#define S3C2410_GPH3_RXD0 (0x02 << 6)
938
939#define S3C2410_GPH4 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 4)
940#define S3C2410_GPH4_INP (0x00 << 8)
941#define S3C2410_GPH4_OUTP (0x01 << 8)
942#define S3C2410_GPH4_TXD1 (0x02 << 8)
943
944#define S3C2410_GPH5 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 5)
945#define S3C2410_GPH5_INP (0x00 << 10)
946#define S3C2410_GPH5_OUTP (0x01 << 10)
947#define S3C2410_GPH5_RXD1 (0x02 << 10)
948
949#define S3C2410_GPH6 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 6)
950#define S3C2410_GPH6_INP (0x00 << 12)
951#define S3C2410_GPH6_OUTP (0x01 << 12)
952#define S3C2410_GPH6_TXD2 (0x02 << 12)
953#define S3C2410_GPH6_nRTS1 (0x03 << 12)
954
955#define S3C2410_GPH7 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 7)
956#define S3C2410_GPH7_INP (0x00 << 14)
957#define S3C2410_GPH7_OUTP (0x01 << 14)
958#define S3C2410_GPH7_RXD2 (0x02 << 14)
959#define S3C2410_GPH7_nCTS1 (0x03 << 14)
960
961#define S3C2410_GPH8 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 8)
962#define S3C2410_GPH8_INP (0x00 << 16)
963#define S3C2410_GPH8_OUTP (0x01 << 16)
964#define S3C2410_GPH8_UCLK (0x02 << 16)
965
966#define S3C2410_GPH9 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 9)
967#define S3C2410_GPH9_INP (0x00 << 18)
968#define S3C2410_GPH9_OUTP (0x01 << 18)
969#define S3C2410_GPH9_CLKOUT0 (0x02 << 18)
970#define S3C2442_GPH9_nSPICS0 (0x03 << 18)
971
972#define S3C2410_GPH10 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 10)
973#define S3C2410_GPH10_INP (0x00 << 20)
974#define S3C2410_GPH10_OUTP (0x01 << 20)
975#define S3C2410_GPH10_CLKOUT1 (0x02 << 20)
976
977/* The S3C2412 and S3C2413 move the GPJ register set to after
978 * GPH, which means all registers after 0x80 are now offset by 0x10
979 * for the 2412/2413 from the 2410/2440/2442
980*/
981
982/* miscellaneous control */
983#define S3C2400_MISCCR S3C2410_GPIOREG(0x54)
984#define S3C2410_MISCCR S3C2410_GPIOREG(0x80)
985#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84)
986
987#define S3C24XX_DCLKCON S3C24XX_GPIOREG2(0x84)
988
989/* see clock.h for dclk definitions */
990
991/* pullup control on databus */
992#define S3C2410_MISCCR_SPUCR_HEN (0<<0)
993#define S3C2410_MISCCR_SPUCR_HDIS (1<<0)
994#define S3C2410_MISCCR_SPUCR_LEN (0<<1)
995#define S3C2410_MISCCR_SPUCR_LDIS (1<<1)
996
997#define S3C2400_MISCCR_SPUCR_LEN (0<<0)
998#define S3C2400_MISCCR_SPUCR_LDIS (1<<0)
999#define S3C2400_MISCCR_SPUCR_HEN (0<<1)
1000#define S3C2400_MISCCR_SPUCR_HDIS (1<<1)
1001
1002#define S3C2400_MISCCR_HZ_STOPEN (0<<2)
1003#define S3C2400_MISCCR_HZ_STOPPREV (1<<2)
1004
1005#define S3C2410_MISCCR_USBDEV (0<<3)
1006#define S3C2410_MISCCR_USBHOST (1<<3)
1007
1008#define S3C2410_MISCCR_CLK0_MPLL (0<<4)
1009#define S3C2410_MISCCR_CLK0_UPLL (1<<4)
1010#define S3C2410_MISCCR_CLK0_FCLK (2<<4)
1011#define S3C2410_MISCCR_CLK0_HCLK (3<<4)
1012#define S3C2410_MISCCR_CLK0_PCLK (4<<4)
1013#define S3C2410_MISCCR_CLK0_DCLK0 (5<<4)
1014#define S3C2410_MISCCR_CLK0_MASK (7<<4)
1015
1016#define S3C2412_MISCCR_CLK0_RTC (2<<4)
1017
1018#define S3C2410_MISCCR_CLK1_MPLL (0<<8)
1019#define S3C2410_MISCCR_CLK1_UPLL (1<<8)
1020#define S3C2410_MISCCR_CLK1_FCLK (2<<8)
1021#define S3C2410_MISCCR_CLK1_HCLK (3<<8)
1022#define S3C2410_MISCCR_CLK1_PCLK (4<<8)
1023#define S3C2410_MISCCR_CLK1_DCLK1 (5<<8)
1024#define S3C2410_MISCCR_CLK1_MASK (7<<8)
1025
1026#define S3C2412_MISCCR_CLK1_CLKsrc (0<<8)
1027
1028#define S3C2410_MISCCR_USBSUSPND0 (1<<12)
1029#define S3C2410_MISCCR_USBSUSPND1 (1<<13)
1030
1031#define S3C2410_MISCCR_nRSTCON (1<<16)
1032
1033#define S3C2410_MISCCR_nEN_SCLK0 (1<<17)
1034#define S3C2410_MISCCR_nEN_SCLK1 (1<<18)
1035#define S3C2410_MISCCR_nEN_SCLKE (1<<19) /* not 2412 */
1036#define S3C2410_MISCCR_SDSLEEP (7<<17)
1037
1038/* external interrupt control... */
1039/* S3C2410_EXTINT0 -> irq sense control for EINT0..EINT7
1040 * S3C2410_EXTINT1 -> irq sense control for EINT8..EINT15
1041 * S3C2410_EXTINT2 -> irq sense control for EINT16..EINT23
1042 *
1043 * note S3C2410_EXTINT2 has filtering options for EINT16..EINT23
1044 *
1045 * Samsung datasheet p9-25
1046*/
1047#define S3C2400_EXTINT0 S3C2410_GPIOREG(0x58)
1048#define S3C2410_EXTINT0 S3C2410_GPIOREG(0x88)
1049#define S3C2410_EXTINT1 S3C2410_GPIOREG(0x8C)
1050#define S3C2410_EXTINT2 S3C2410_GPIOREG(0x90)
1051
1052#define S3C24XX_EXTINT0 S3C24XX_GPIOREG2(0x88)
1053#define S3C24XX_EXTINT1 S3C24XX_GPIOREG2(0x8C)
1054#define S3C24XX_EXTINT2 S3C24XX_GPIOREG2(0x90)
1055
1056/* values for S3C2410_EXTINT0/1/2 */
1057#define S3C2410_EXTINT_LOWLEV (0x00)
1058#define S3C2410_EXTINT_HILEV (0x01)
1059#define S3C2410_EXTINT_FALLEDGE (0x02)
1060#define S3C2410_EXTINT_RISEEDGE (0x04)
1061#define S3C2410_EXTINT_BOTHEDGE (0x06)
1062
1063/* interrupt filtering conrrol for EINT16..EINT23 */
1064#define S3C2410_EINFLT0 S3C2410_GPIOREG(0x94)
1065#define S3C2410_EINFLT1 S3C2410_GPIOREG(0x98)
1066#define S3C2410_EINFLT2 S3C2410_GPIOREG(0x9C)
1067#define S3C2410_EINFLT3 S3C2410_GPIOREG(0xA0)
1068
1069#define S3C24XX_EINFLT0 S3C24XX_GPIOREG2(0x94)
1070#define S3C24XX_EINFLT1 S3C24XX_GPIOREG2(0x98)
1071#define S3C24XX_EINFLT2 S3C24XX_GPIOREG2(0x9C)
1072#define S3C24XX_EINFLT3 S3C24XX_GPIOREG2(0xA0)
1073
1074/* values for interrupt filtering */
1075#define S3C2410_EINTFLT_PCLK (0x00)
1076#define S3C2410_EINTFLT_EXTCLK (1<<7)
1077#define S3C2410_EINTFLT_WIDTHMSK(x) ((x) & 0x3f)
1078
1079/* removed EINTxxxx defs from here, not meant for this */
1080
1081/* GSTATUS have miscellaneous information in them
1082 *
1083 * These move between s3c2410 and s3c2412 style systems.
1084 */
1085
1086#define S3C2410_GSTATUS0 S3C2410_GPIOREG(0x0AC)
1087#define S3C2410_GSTATUS1 S3C2410_GPIOREG(0x0B0)
1088#define S3C2410_GSTATUS2 S3C2410_GPIOREG(0x0B4)
1089#define S3C2410_GSTATUS3 S3C2410_GPIOREG(0x0B8)
1090#define S3C2410_GSTATUS4 S3C2410_GPIOREG(0x0BC)
1091
1092#define S3C2412_GSTATUS0 S3C2410_GPIOREG(0x0BC)
1093#define S3C2412_GSTATUS1 S3C2410_GPIOREG(0x0C0)
1094#define S3C2412_GSTATUS2 S3C2410_GPIOREG(0x0C4)
1095#define S3C2412_GSTATUS3 S3C2410_GPIOREG(0x0C8)
1096#define S3C2412_GSTATUS4 S3C2410_GPIOREG(0x0CC)
1097
1098#define S3C24XX_GSTATUS0 S3C24XX_GPIOREG2(0x0AC)
1099#define S3C24XX_GSTATUS1 S3C24XX_GPIOREG2(0x0B0)
1100#define S3C24XX_GSTATUS2 S3C24XX_GPIOREG2(0x0B4)
1101#define S3C24XX_GSTATUS3 S3C24XX_GPIOREG2(0x0B8)
1102#define S3C24XX_GSTATUS4 S3C24XX_GPIOREG2(0x0BC)
1103
1104#define S3C2410_GSTATUS0_nWAIT (1<<3)
1105#define S3C2410_GSTATUS0_NCON (1<<2)
1106#define S3C2410_GSTATUS0_RnB (1<<1)
1107#define S3C2410_GSTATUS0_nBATTFLT (1<<0)
1108
1109#define S3C2410_GSTATUS1_IDMASK (0xffff0000)
1110#define S3C2410_GSTATUS1_2410 (0x32410000)
1111#define S3C2410_GSTATUS1_2412 (0x32412001)
1112#define S3C2410_GSTATUS1_2440 (0x32440000)
1113#define S3C2410_GSTATUS1_2442 (0x32440aaa)
1114
1115#define S3C2410_GSTATUS2_WTRESET (1<<2)
1116#define S3C2410_GSTATUS2_OFFRESET (1<<1)
1117#define S3C2410_GSTATUS2_PONRESET (1<<0)
1118
1119/* open drain control register */
1120#define S3C2400_OPENCR S3C2410_GPIOREG(0x50)
1121
1122#define S3C2400_OPENCR_OPC_RXD1DIS (0<<0)
1123#define S3C2400_OPENCR_OPC_RXD1EN (1<<0)
1124#define S3C2400_OPENCR_OPC_TXD1DIS (0<<1)
1125#define S3C2400_OPENCR_OPC_TXD1EN (1<<1)
1126#define S3C2400_OPENCR_OPC_CMDDIS (0<<2)
1127#define S3C2400_OPENCR_OPC_CMDEN (1<<2)
1128#define S3C2400_OPENCR_OPC_DATDIS (0<<3)
1129#define S3C2400_OPENCR_OPC_DATEN (1<<3)
1130#define S3C2400_OPENCR_OPC_MISODIS (0<<4)
1131#define S3C2400_OPENCR_OPC_MISOEN (1<<4)
1132#define S3C2400_OPENCR_OPC_MOSIDIS (0<<5)
1133#define S3C2400_OPENCR_OPC_MOSIEN (1<<5)
1134
1135/* 2412/2413 sleep configuration registers */
1136
1137#define S3C2412_GPBSLPCON S3C2410_GPIOREG(0x1C)
1138#define S3C2412_GPCSLPCON S3C2410_GPIOREG(0x2C)
1139#define S3C2412_GPDSLPCON S3C2410_GPIOREG(0x3C)
1140#define S3C2412_GPFSLPCON S3C2410_GPIOREG(0x5C)
1141#define S3C2412_GPGSLPCON S3C2410_GPIOREG(0x6C)
1142#define S3C2412_GPHSLPCON S3C2410_GPIOREG(0x7C)
1143
1144/* definitions for each pin bit */
1145#define S3C2412_GPIO_SLPCON_LOW ( 0x00 )
1146#define S3C2412_GPIO_SLPCON_HIGH ( 0x01 )
1147#define S3C2412_GPIO_SLPCON_IN ( 0x02 )
1148#define S3C2412_GPIO_SLPCON_PULL ( 0x03 )
1149
1150#define S3C2412_SLPCON_LOW(x) ( 0x00 << ((x) * 2))
1151#define S3C2412_SLPCON_HIGH(x) ( 0x01 << ((x) * 2))
1152#define S3C2412_SLPCON_IN(x) ( 0x02 << ((x) * 2))
1153#define S3C2412_SLPCON_PULL(x) ( 0x03 << ((x) * 2))
1154#define S3C2412_SLPCON_EINT(x) ( 0x02 << ((x) * 2)) /* only IRQ pins */
1155#define S3C2412_SLPCON_MASK(x) ( 0x03 << ((x) * 2))
1156
1157#define S3C2412_SLPCON_ALL_LOW (0x0)
1158#define S3C2412_SLPCON_ALL_HIGH (0x11111111 | 0x44444444)
1159#define S3C2412_SLPCON_ALL_IN (0x22222222 | 0x88888888)
1160#define S3C2412_SLPCON_ALL_PULL (0x33333333)
1161
1162#endif /* __ASM_ARCH_REGS_GPIO_H */
1163
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpioj.h b/arch/arm/mach-s3c2410/include/mach/regs-gpioj.h
new file mode 100644
index 000000000000..1202ca5e99f6
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-gpioj.h
@@ -0,0 +1,106 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-gpioj.h
2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2440 GPIO J register definitions
11*/
12
13
14#ifndef __ASM_ARCH_REGS_GPIOJ_H
15#define __ASM_ARCH_REGS_GPIOJ_H "gpioj"
16
17/* Port J consists of 13 GPIO/Camera pins
18 *
19 * GPJCON has 2 bits for each of the input pins on port F
20 * 00 = 0 input, 1 output, 2 Camera
21 *
22 * pull up works like all other ports.
23*/
24
25#define S3C2440_GPIO_BANKJ (416)
26
27#define S3C2440_GPJCON S3C2410_GPIOREG(0xd0)
28#define S3C2440_GPJDAT S3C2410_GPIOREG(0xd4)
29#define S3C2440_GPJUP S3C2410_GPIOREG(0xd8)
30
31#define S3C2413_GPJCON S3C2410_GPIOREG(0x80)
32#define S3C2413_GPJDAT S3C2410_GPIOREG(0x84)
33#define S3C2413_GPJUP S3C2410_GPIOREG(0x88)
34#define S3C2413_GPJSLPCON S3C2410_GPIOREG(0x8C)
35
36#define S3C2440_GPJ0 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 0)
37#define S3C2440_GPJ0_INP (0x00 << 0)
38#define S3C2440_GPJ0_OUTP (0x01 << 0)
39#define S3C2440_GPJ0_CAMDATA0 (0x02 << 0)
40
41#define S3C2440_GPJ1 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 1)
42#define S3C2440_GPJ1_INP (0x00 << 2)
43#define S3C2440_GPJ1_OUTP (0x01 << 2)
44#define S3C2440_GPJ1_CAMDATA1 (0x02 << 2)
45
46#define S3C2440_GPJ2 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 2)
47#define S3C2440_GPJ2_INP (0x00 << 4)
48#define S3C2440_GPJ2_OUTP (0x01 << 4)
49#define S3C2440_GPJ2_CAMDATA2 (0x02 << 4)
50
51#define S3C2440_GPJ3 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 3)
52#define S3C2440_GPJ3_INP (0x00 << 6)
53#define S3C2440_GPJ3_OUTP (0x01 << 6)
54#define S3C2440_GPJ3_CAMDATA3 (0x02 << 6)
55
56#define S3C2440_GPJ4 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 4)
57#define S3C2440_GPJ4_INP (0x00 << 8)
58#define S3C2440_GPJ4_OUTP (0x01 << 8)
59#define S3C2440_GPJ4_CAMDATA4 (0x02 << 8)
60
61#define S3C2440_GPJ5 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 5)
62#define S3C2440_GPJ5_INP (0x00 << 10)
63#define S3C2440_GPJ5_OUTP (0x01 << 10)
64#define S3C2440_GPJ5_CAMDATA5 (0x02 << 10)
65
66#define S3C2440_GPJ6 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 6)
67#define S3C2440_GPJ6_INP (0x00 << 12)
68#define S3C2440_GPJ6_OUTP (0x01 << 12)
69#define S3C2440_GPJ6_CAMDATA6 (0x02 << 12)
70
71#define S3C2440_GPJ7 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 7)
72#define S3C2440_GPJ7_INP (0x00 << 14)
73#define S3C2440_GPJ7_OUTP (0x01 << 14)
74#define S3C2440_GPJ7_CAMDATA7 (0x02 << 14)
75
76#define S3C2440_GPJ8 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 8)
77#define S3C2440_GPJ8_INP (0x00 << 16)
78#define S3C2440_GPJ8_OUTP (0x01 << 16)
79#define S3C2440_GPJ8_CAMPCLK (0x02 << 16)
80
81#define S3C2440_GPJ9 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 9)
82#define S3C2440_GPJ9_INP (0x00 << 18)
83#define S3C2440_GPJ9_OUTP (0x01 << 18)
84#define S3C2440_GPJ9_CAMVSYNC (0x02 << 18)
85
86#define S3C2440_GPJ10 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 10)
87#define S3C2440_GPJ10_INP (0x00 << 20)
88#define S3C2440_GPJ10_OUTP (0x01 << 20)
89#define S3C2440_GPJ10_CAMHREF (0x02 << 20)
90
91#define S3C2440_GPJ11 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 11)
92#define S3C2440_GPJ11_INP (0x00 << 22)
93#define S3C2440_GPJ11_OUTP (0x01 << 22)
94#define S3C2440_GPJ11_CAMCLKOUT (0x02 << 22)
95
96#define S3C2440_GPJ12 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 12)
97#define S3C2440_GPJ12_INP (0x00 << 24)
98#define S3C2440_GPJ12_OUTP (0x01 << 24)
99#define S3C2440_GPJ12_CAMRESET (0x02 << 24)
100
101#define S3C2443_GPJ13 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 13)
102#define S3C2443_GPJ14 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 14)
103#define S3C2443_GPJ15 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 15)
104
105#endif /* __ASM_ARCH_REGS_GPIOJ_H */
106
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-irq.h b/arch/arm/mach-s3c2410/include/mach/regs-irq.h
new file mode 100644
index 000000000000..b057c06d167a
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-irq.h
@@ -0,0 +1,43 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-irq.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11
12#ifndef ___ASM_ARCH_REGS_IRQ_H
13#define ___ASM_ARCH_REGS_IRQ_H "$Id: irq.h,v 1.3 2003/03/25 21:29:06 ben Exp $"
14
15/* interrupt controller */
16
17#define S3C2410_IRQREG(x) ((x) + S3C24XX_VA_IRQ)
18#define S3C2410_EINTREG(x) ((x) + S3C24XX_VA_GPIO)
19#define S3C24XX_EINTREG(x) ((x) + S3C24XX_VA_GPIO2)
20
21#define S3C2410_SRCPND S3C2410_IRQREG(0x000)
22#define S3C2410_INTMOD S3C2410_IRQREG(0x004)
23#define S3C2410_INTMSK S3C2410_IRQREG(0x008)
24#define S3C2410_PRIORITY S3C2410_IRQREG(0x00C)
25#define S3C2410_INTPND S3C2410_IRQREG(0x010)
26#define S3C2410_INTOFFSET S3C2410_IRQREG(0x014)
27#define S3C2410_SUBSRCPND S3C2410_IRQREG(0x018)
28#define S3C2410_INTSUBMSK S3C2410_IRQREG(0x01C)
29
30/* mask: 0=enable, 1=disable
31 * 1 bit EINT, 4=EINT4, 23=EINT23
32 * EINT0,1,2,3 are not handled here.
33*/
34
35#define S3C2410_EINTMASK S3C2410_EINTREG(0x0A4)
36#define S3C2410_EINTPEND S3C2410_EINTREG(0X0A8)
37#define S3C2412_EINTMASK S3C2410_EINTREG(0x0B4)
38#define S3C2412_EINTPEND S3C2410_EINTREG(0X0B8)
39
40#define S3C24XX_EINTMASK S3C24XX_EINTREG(0x0A4)
41#define S3C24XX_EINTPEND S3C24XX_EINTREG(0X0A8)
42
43#endif /* ___ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-lcd.h b/arch/arm/mach-s3c2410/include/mach/regs-lcd.h
new file mode 100644
index 000000000000..893b8742f954
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-lcd.h
@@ -0,0 +1,162 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-lcd.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11
12#ifndef ___ASM_ARCH_REGS_LCD_H
13#define ___ASM_ARCH_REGS_LCD_H "$Id: lcd.h,v 1.3 2003/06/26 13:25:06 ben Exp $"
14
15#define S3C2410_LCDREG(x) (x)
16
17/* LCD control registers */
18#define S3C2410_LCDCON1 S3C2410_LCDREG(0x00)
19#define S3C2410_LCDCON2 S3C2410_LCDREG(0x04)
20#define S3C2410_LCDCON3 S3C2410_LCDREG(0x08)
21#define S3C2410_LCDCON4 S3C2410_LCDREG(0x0C)
22#define S3C2410_LCDCON5 S3C2410_LCDREG(0x10)
23
24#define S3C2410_LCDCON1_CLKVAL(x) ((x) << 8)
25#define S3C2410_LCDCON1_MMODE (1<<7)
26#define S3C2410_LCDCON1_DSCAN4 (0<<5)
27#define S3C2410_LCDCON1_STN4 (1<<5)
28#define S3C2410_LCDCON1_STN8 (2<<5)
29#define S3C2410_LCDCON1_TFT (3<<5)
30
31#define S3C2410_LCDCON1_STN1BPP (0<<1)
32#define S3C2410_LCDCON1_STN2GREY (1<<1)
33#define S3C2410_LCDCON1_STN4GREY (2<<1)
34#define S3C2410_LCDCON1_STN8BPP (3<<1)
35#define S3C2410_LCDCON1_STN12BPP (4<<1)
36
37#define S3C2410_LCDCON1_TFT1BPP (8<<1)
38#define S3C2410_LCDCON1_TFT2BPP (9<<1)
39#define S3C2410_LCDCON1_TFT4BPP (10<<1)
40#define S3C2410_LCDCON1_TFT8BPP (11<<1)
41#define S3C2410_LCDCON1_TFT16BPP (12<<1)
42#define S3C2410_LCDCON1_TFT24BPP (13<<1)
43
44#define S3C2410_LCDCON1_ENVID (1)
45
46#define S3C2410_LCDCON1_MODEMASK 0x1E
47
48#define S3C2410_LCDCON2_VBPD(x) ((x) << 24)
49#define S3C2410_LCDCON2_LINEVAL(x) ((x) << 14)
50#define S3C2410_LCDCON2_VFPD(x) ((x) << 6)
51#define S3C2410_LCDCON2_VSPW(x) ((x) << 0)
52
53#define S3C2410_LCDCON2_GET_VBPD(x) ( ((x) >> 24) & 0xFF)
54#define S3C2410_LCDCON2_GET_VFPD(x) ( ((x) >> 6) & 0xFF)
55#define S3C2410_LCDCON2_GET_VSPW(x) ( ((x) >> 0) & 0x3F)
56
57#define S3C2410_LCDCON3_HBPD(x) ((x) << 19)
58#define S3C2410_LCDCON3_WDLY(x) ((x) << 19)
59#define S3C2410_LCDCON3_HOZVAL(x) ((x) << 8)
60#define S3C2410_LCDCON3_HFPD(x) ((x) << 0)
61#define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0)
62
63#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F)
64#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >> 0) & 0xFF)
65
66/* LDCCON4 changes for STN mode on the S3C2412 */
67
68#define S3C2410_LCDCON4_MVAL(x) ((x) << 8)
69#define S3C2410_LCDCON4_HSPW(x) ((x) << 0)
70#define S3C2410_LCDCON4_WLH(x) ((x) << 0)
71
72#define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >> 0) & 0xFF)
73
74#define S3C2410_LCDCON5_BPP24BL (1<<12)
75#define S3C2410_LCDCON5_FRM565 (1<<11)
76#define S3C2410_LCDCON5_INVVCLK (1<<10)
77#define S3C2410_LCDCON5_INVVLINE (1<<9)
78#define S3C2410_LCDCON5_INVVFRAME (1<<8)
79#define S3C2410_LCDCON5_INVVD (1<<7)
80#define S3C2410_LCDCON5_INVVDEN (1<<6)
81#define S3C2410_LCDCON5_INVPWREN (1<<5)
82#define S3C2410_LCDCON5_INVLEND (1<<4)
83#define S3C2410_LCDCON5_PWREN (1<<3)
84#define S3C2410_LCDCON5_ENLEND (1<<2)
85#define S3C2410_LCDCON5_BSWP (1<<1)
86#define S3C2410_LCDCON5_HWSWP (1<<0)
87
88/* framebuffer start addressed */
89#define S3C2410_LCDSADDR1 S3C2410_LCDREG(0x14)
90#define S3C2410_LCDSADDR2 S3C2410_LCDREG(0x18)
91#define S3C2410_LCDSADDR3 S3C2410_LCDREG(0x1C)
92
93#define S3C2410_LCDBANK(x) ((x) << 21)
94#define S3C2410_LCDBASEU(x) (x)
95
96#define S3C2410_OFFSIZE(x) ((x) << 11)
97#define S3C2410_PAGEWIDTH(x) (x)
98
99/* colour lookup and miscellaneous controls */
100
101#define S3C2410_REDLUT S3C2410_LCDREG(0x20)
102#define S3C2410_GREENLUT S3C2410_LCDREG(0x24)
103#define S3C2410_BLUELUT S3C2410_LCDREG(0x28)
104
105#define S3C2410_DITHMODE S3C2410_LCDREG(0x4C)
106#define S3C2410_TPAL S3C2410_LCDREG(0x50)
107
108#define S3C2410_TPAL_EN (1<<24)
109
110/* interrupt info */
111#define S3C2410_LCDINTPND S3C2410_LCDREG(0x54)
112#define S3C2410_LCDSRCPND S3C2410_LCDREG(0x58)
113#define S3C2410_LCDINTMSK S3C2410_LCDREG(0x5C)
114#define S3C2410_LCDINT_FIWSEL (1<<2)
115#define S3C2410_LCDINT_FRSYNC (1<<1)
116#define S3C2410_LCDINT_FICNT (1<<0)
117
118/* s3c2442 extra stn registers */
119
120#define S3C2442_REDLUT S3C2410_LCDREG(0x20)
121#define S3C2442_GREENLUT S3C2410_LCDREG(0x24)
122#define S3C2442_BLUELUT S3C2410_LCDREG(0x28)
123#define S3C2442_DITHMODE S3C2410_LCDREG(0x20)
124
125#define S3C2410_LPCSEL S3C2410_LCDREG(0x60)
126
127#define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4))
128
129/* S3C2412 registers */
130
131#define S3C2412_TPAL S3C2410_LCDREG(0x20)
132
133#define S3C2412_LCDINTPND S3C2410_LCDREG(0x24)
134#define S3C2412_LCDSRCPND S3C2410_LCDREG(0x28)
135#define S3C2412_LCDINTMSK S3C2410_LCDREG(0x2C)
136
137#define S3C2412_TCONSEL S3C2410_LCDREG(0x30)
138
139#define S3C2412_LCDCON6 S3C2410_LCDREG(0x34)
140#define S3C2412_LCDCON7 S3C2410_LCDREG(0x38)
141#define S3C2412_LCDCON8 S3C2410_LCDREG(0x3C)
142#define S3C2412_LCDCON9 S3C2410_LCDREG(0x40)
143
144#define S3C2412_REDLUT(x) S3C2410_LCDREG(0x44 + ((x)*4))
145#define S3C2412_GREENLUT(x) S3C2410_LCDREG(0x60 + ((x)*4))
146#define S3C2412_BLUELUT(x) S3C2410_LCDREG(0x98 + ((x)*4))
147
148#define S3C2412_FRCPAT(x) S3C2410_LCDREG(0xB4 + ((x)*4))
149
150/* general registers */
151
152/* base of the LCD registers, where INTPND, INTSRC and then INTMSK
153 * are available. */
154
155#define S3C2410_LCDINTBASE S3C2410_LCDREG(0x54)
156#define S3C2412_LCDINTBASE S3C2410_LCDREG(0x24)
157
158#define S3C24XX_LCDINTPND (0x00)
159#define S3C24XX_LCDSRCPND (0x04)
160#define S3C24XX_LCDINTMSK (0x08)
161
162#endif /* ___ASM_ARCH_REGS_LCD_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-mem.h b/arch/arm/mach-s3c2410/include/mach/regs-mem.h
new file mode 100644
index 000000000000..f9926abd5cde
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-mem.h
@@ -0,0 +1,220 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-mem.h
2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 Memory Control register definitions
11*/
12
13#ifndef __ASM_ARM_MEMREGS_H
14#define __ASM_ARM_MEMREGS_H "$Id: regs.h,v 1.8 2003/05/01 15:55:41 ben Exp $"
15
16#ifndef S3C2410_MEMREG
17#define S3C2410_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x))
18#endif
19
20/* bus width, and wait state control */
21#define S3C2410_BWSCON S3C2410_MEMREG(0x0000)
22
23/* bank zero config - note, pinstrapped from OM pins! */
24#define S3C2410_BWSCON_DW0_16 (1<<1)
25#define S3C2410_BWSCON_DW0_32 (2<<1)
26
27/* bank one configs */
28#define S3C2410_BWSCON_DW1_8 (0<<4)
29#define S3C2410_BWSCON_DW1_16 (1<<4)
30#define S3C2410_BWSCON_DW1_32 (2<<4)
31#define S3C2410_BWSCON_WS1 (1<<6)
32#define S3C2410_BWSCON_ST1 (1<<7)
33
34/* bank 2 configurations */
35#define S3C2410_BWSCON_DW2_8 (0<<8)
36#define S3C2410_BWSCON_DW2_16 (1<<8)
37#define S3C2410_BWSCON_DW2_32 (2<<8)
38#define S3C2410_BWSCON_WS2 (1<<10)
39#define S3C2410_BWSCON_ST2 (1<<11)
40
41/* bank 3 configurations */
42#define S3C2410_BWSCON_DW3_8 (0<<12)
43#define S3C2410_BWSCON_DW3_16 (1<<12)
44#define S3C2410_BWSCON_DW3_32 (2<<12)
45#define S3C2410_BWSCON_WS3 (1<<14)
46#define S3C2410_BWSCON_ST3 (1<<15)
47
48/* bank 4 configurations */
49#define S3C2410_BWSCON_DW4_8 (0<<16)
50#define S3C2410_BWSCON_DW4_16 (1<<16)
51#define S3C2410_BWSCON_DW4_32 (2<<16)
52#define S3C2410_BWSCON_WS4 (1<<18)
53#define S3C2410_BWSCON_ST4 (1<<19)
54
55/* bank 5 configurations */
56#define S3C2410_BWSCON_DW5_8 (0<<20)
57#define S3C2410_BWSCON_DW5_16 (1<<20)
58#define S3C2410_BWSCON_DW5_32 (2<<20)
59#define S3C2410_BWSCON_WS5 (1<<22)
60#define S3C2410_BWSCON_ST5 (1<<23)
61
62/* bank 6 configurations */
63#define S3C2410_BWSCON_DW6_8 (0<<24)
64#define S3C2410_BWSCON_DW6_16 (1<<24)
65#define S3C2410_BWSCON_DW6_32 (2<<24)
66#define S3C2410_BWSCON_WS6 (1<<26)
67#define S3C2410_BWSCON_ST6 (1<<27)
68
69/* bank 7 configurations */
70#define S3C2410_BWSCON_DW7_8 (0<<28)
71#define S3C2410_BWSCON_DW7_16 (1<<28)
72#define S3C2410_BWSCON_DW7_32 (2<<28)
73#define S3C2410_BWSCON_WS7 (1<<30)
74#define S3C2410_BWSCON_ST7 (1<<31)
75
76/* memory set (rom, ram) */
77#define S3C2410_BANKCON0 S3C2410_MEMREG(0x0004)
78#define S3C2410_BANKCON1 S3C2410_MEMREG(0x0008)
79#define S3C2410_BANKCON2 S3C2410_MEMREG(0x000C)
80#define S3C2410_BANKCON3 S3C2410_MEMREG(0x0010)
81#define S3C2410_BANKCON4 S3C2410_MEMREG(0x0014)
82#define S3C2410_BANKCON5 S3C2410_MEMREG(0x0018)
83#define S3C2410_BANKCON6 S3C2410_MEMREG(0x001C)
84#define S3C2410_BANKCON7 S3C2410_MEMREG(0x0020)
85
86/* bank configuration registers */
87
88#define S3C2410_BANKCON_PMCnorm (0x00)
89#define S3C2410_BANKCON_PMC4 (0x01)
90#define S3C2410_BANKCON_PMC8 (0x02)
91#define S3C2410_BANKCON_PMC16 (0x03)
92
93/* bank configurations for banks 0..7, note banks
94 * 6 and 7 have differnt configurations depending on
95 * the memory type bits */
96
97#define S3C2410_BANKCON_Tacp2 (0x0 << 2)
98#define S3C2410_BANKCON_Tacp3 (0x1 << 2)
99#define S3C2410_BANKCON_Tacp4 (0x2 << 2)
100#define S3C2410_BANKCON_Tacp6 (0x3 << 2)
101#define S3C2410_BANKCON_Tacp_SHIFT (2)
102
103#define S3C2410_BANKCON_Tcah0 (0x0 << 4)
104#define S3C2410_BANKCON_Tcah1 (0x1 << 4)
105#define S3C2410_BANKCON_Tcah2 (0x2 << 4)
106#define S3C2410_BANKCON_Tcah4 (0x3 << 4)
107#define S3C2410_BANKCON_Tcah_SHIFT (4)
108
109#define S3C2410_BANKCON_Tcoh0 (0x0 << 6)
110#define S3C2410_BANKCON_Tcoh1 (0x1 << 6)
111#define S3C2410_BANKCON_Tcoh2 (0x2 << 6)
112#define S3C2410_BANKCON_Tcoh4 (0x3 << 6)
113#define S3C2410_BANKCON_Tcoh_SHIFT (6)
114
115#define S3C2410_BANKCON_Tacc1 (0x0 << 8)
116#define S3C2410_BANKCON_Tacc2 (0x1 << 8)
117#define S3C2410_BANKCON_Tacc3 (0x2 << 8)
118#define S3C2410_BANKCON_Tacc4 (0x3 << 8)
119#define S3C2410_BANKCON_Tacc6 (0x4 << 8)
120#define S3C2410_BANKCON_Tacc8 (0x5 << 8)
121#define S3C2410_BANKCON_Tacc10 (0x6 << 8)
122#define S3C2410_BANKCON_Tacc14 (0x7 << 8)
123#define S3C2410_BANKCON_Tacc_SHIFT (8)
124
125#define S3C2410_BANKCON_Tcos0 (0x0 << 11)
126#define S3C2410_BANKCON_Tcos1 (0x1 << 11)
127#define S3C2410_BANKCON_Tcos2 (0x2 << 11)
128#define S3C2410_BANKCON_Tcos4 (0x3 << 11)
129#define S3C2410_BANKCON_Tcos_SHIFT (11)
130
131#define S3C2410_BANKCON_Tacs0 (0x0 << 13)
132#define S3C2410_BANKCON_Tacs1 (0x1 << 13)
133#define S3C2410_BANKCON_Tacs2 (0x2 << 13)
134#define S3C2410_BANKCON_Tacs4 (0x3 << 13)
135#define S3C2410_BANKCON_Tacs_SHIFT (13)
136
137#define S3C2410_BANKCON_SRAM (0x0 << 15)
138#define S3C2400_BANKCON_EDODRAM (0x2 << 15)
139#define S3C2410_BANKCON_SDRAM (0x3 << 15)
140
141/* next bits only for EDO DRAM in 6,7 */
142#define S3C2400_BANKCON_EDO_Trcd1 (0x00 << 4)
143#define S3C2400_BANKCON_EDO_Trcd2 (0x01 << 4)
144#define S3C2400_BANKCON_EDO_Trcd3 (0x02 << 4)
145#define S3C2400_BANKCON_EDO_Trcd4 (0x03 << 4)
146
147/* CAS pulse width */
148#define S3C2400_BANKCON_EDO_PULSE1 (0x00 << 3)
149#define S3C2400_BANKCON_EDO_PULSE2 (0x01 << 3)
150
151/* CAS pre-charge */
152#define S3C2400_BANKCON_EDO_TCP1 (0x00 << 2)
153#define S3C2400_BANKCON_EDO_TCP2 (0x01 << 2)
154
155/* control column address select */
156#define S3C2400_BANKCON_EDO_SCANb8 (0x00 << 0)
157#define S3C2400_BANKCON_EDO_SCANb9 (0x01 << 0)
158#define S3C2400_BANKCON_EDO_SCANb10 (0x02 << 0)
159#define S3C2400_BANKCON_EDO_SCANb11 (0x03 << 0)
160
161/* next bits only for SDRAM in 6,7 */
162#define S3C2410_BANKCON_Trcd2 (0x00 << 2)
163#define S3C2410_BANKCON_Trcd3 (0x01 << 2)
164#define S3C2410_BANKCON_Trcd4 (0x02 << 2)
165
166/* control column address select */
167#define S3C2410_BANKCON_SCANb8 (0x00 << 0)
168#define S3C2410_BANKCON_SCANb9 (0x01 << 0)
169#define S3C2410_BANKCON_SCANb10 (0x02 << 0)
170
171#define S3C2410_REFRESH S3C2410_MEMREG(0x0024)
172#define S3C2410_BANKSIZE S3C2410_MEMREG(0x0028)
173#define S3C2410_MRSRB6 S3C2410_MEMREG(0x002C)
174#define S3C2410_MRSRB7 S3C2410_MEMREG(0x0030)
175
176/* refresh control */
177
178#define S3C2410_REFRESH_REFEN (1<<23)
179#define S3C2410_REFRESH_SELF (1<<22)
180#define S3C2410_REFRESH_REFCOUNTER ((1<<11)-1)
181
182#define S3C2410_REFRESH_TRP_MASK (3<<20)
183#define S3C2410_REFRESH_TRP_2clk (0<<20)
184#define S3C2410_REFRESH_TRP_3clk (1<<20)
185#define S3C2410_REFRESH_TRP_4clk (2<<20)
186
187#define S3C2400_REFRESH_DRAM_TRP_MASK (3<<20)
188#define S3C2400_REFRESH_DRAM_TRP_1_5clk (0<<20)
189#define S3C2400_REFRESH_DRAM_TRP_2_5clk (1<<20)
190#define S3C2400_REFRESH_DRAM_TRP_3_5clk (2<<20)
191#define S3C2400_REFRESH_DRAM_TRP_4_5clk (3<<20)
192
193#define S3C2410_REFRESH_TSRC_MASK (3<<18)
194#define S3C2410_REFRESH_TSRC_4clk (0<<18)
195#define S3C2410_REFRESH_TSRC_5clk (1<<18)
196#define S3C2410_REFRESH_TSRC_6clk (2<<18)
197#define S3C2410_REFRESH_TSRC_7clk (3<<18)
198
199
200/* mode select register(s) */
201
202#define S3C2410_MRSRB_CL1 (0x00 << 4)
203#define S3C2410_MRSRB_CL2 (0x02 << 4)
204#define S3C2410_MRSRB_CL3 (0x03 << 4)
205
206/* bank size register */
207#define S3C2410_BANKSIZE_128M (0x2 << 0)
208#define S3C2410_BANKSIZE_64M (0x1 << 0)
209#define S3C2410_BANKSIZE_32M (0x0 << 0)
210#define S3C2410_BANKSIZE_16M (0x7 << 0)
211#define S3C2410_BANKSIZE_8M (0x6 << 0)
212#define S3C2410_BANKSIZE_4M (0x5 << 0)
213#define S3C2410_BANKSIZE_2M (0x4 << 0)
214#define S3C2410_BANKSIZE_MASK (0x7 << 0)
215#define S3C2400_BANKSIZE_MASK (0x4 << 0)
216#define S3C2410_BANKSIZE_SCLK_EN (1<<4)
217#define S3C2410_BANKSIZE_SCKE_EN (1<<5)
218#define S3C2410_BANKSIZE_BURST (1<<7)
219
220#endif /* __ASM_ARM_MEMREGS_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-power.h b/arch/arm/mach-s3c2410/include/mach/regs-power.h
new file mode 100644
index 000000000000..2d36353f57d7
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-power.h
@@ -0,0 +1,40 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-power.h
2 *
3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/
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 * S3C24XX power control register definitions
11*/
12
13#ifndef __ASM_ARM_REGS_PWR
14#define __ASM_ARM_REGS_PWR __FILE__
15
16#define S3C24XX_PWRREG(x) ((x) + S3C24XX_VA_CLKPWR)
17
18#define S3C2412_PWRMODECON S3C24XX_PWRREG(0x20)
19#define S3C2412_PWRCFG S3C24XX_PWRREG(0x24)
20
21#define S3C2412_INFORM0 S3C24XX_PWRREG(0x70)
22#define S3C2412_INFORM1 S3C24XX_PWRREG(0x74)
23#define S3C2412_INFORM2 S3C24XX_PWRREG(0x78)
24#define S3C2412_INFORM3 S3C24XX_PWRREG(0x7C)
25
26#define S3C2412_PWRCFG_BATF_IRQ (1<<0)
27#define S3C2412_PWRCFG_BATF_IGNORE (2<<0)
28#define S3C2412_PWRCFG_BATF_SLEEP (3<<0)
29#define S3C2412_PWRCFG_BATF_MASK (3<<0)
30
31#define S3C2412_PWRCFG_STANDBYWFI_IGNORE (0<<6)
32#define S3C2412_PWRCFG_STANDBYWFI_IDLE (1<<6)
33#define S3C2412_PWRCFG_STANDBYWFI_STOP (2<<6)
34#define S3C2412_PWRCFG_STANDBYWFI_SLEEP (3<<6)
35#define S3C2412_PWRCFG_STANDBYWFI_MASK (3<<6)
36
37#define S3C2412_PWRCFG_RTC_MASKIRQ (1<<8)
38#define S3C2412_PWRCFG_NAND_NORST (1<<9)
39
40#endif /* __ASM_ARM_REGS_PWR */
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h b/arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h
new file mode 100644
index 000000000000..a4bf27123170
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h
@@ -0,0 +1,29 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-s3c2412-mem.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
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 * S3C2412 memory register definitions
12*/
13
14#ifndef __ASM_ARM_REGS_S3C2412_MEM
15#define __ASM_ARM_REGS_S3C2412_MEM
16
17#ifndef S3C2412_MEMREG
18#define S3C2412_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x))
19#endif
20
21#define S3C2412_BANKCFG S3C2412_MEMREG(0x00)
22#define S3C2412_BANKCON1 S3C2412_MEMREG(0x04)
23#define S3C2412_BANKCON2 S3C2412_MEMREG(0x08)
24#define S3C2412_BANKCON3 S3C2412_MEMREG(0x0C)
25
26#define S3C2412_REFRESH S3C2412_MEMREG(0x10)
27#define S3C2412_TIMEOUT S3C2412_MEMREG(0x14)
28
29#endif /* __ASM_ARM_REGS_S3C2412_MEM */
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2412.h b/arch/arm/mach-s3c2410/include/mach/regs-s3c2412.h
new file mode 100644
index 000000000000..aa69dc79bc38
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-s3c2412.h
@@ -0,0 +1,23 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-s3c2412.h
2 *
3 * Copyright 2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
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 * S3C2412 specific register definitions
12*/
13
14#ifndef __ASM_ARCH_REGS_S3C2412_H
15#define __ASM_ARCH_REGS_S3C2412_H "s3c2412"
16
17#define S3C2412_SWRST (S3C24XX_VA_CLKPWR + 0x30)
18#define S3C2412_SWRST_RESET (0x533C2412)
19
20/* see regs-power.h for the other registers in the power block. */
21
22#endif /* __ASM_ARCH_REGS_S3C2412_H */
23
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
new file mode 100644
index 000000000000..7dd458363a51
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
@@ -0,0 +1,195 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
2 *
3 * Copyright (c) 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
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 * S3C2443 clock register definitions
12*/
13
14#ifndef __ASM_ARM_REGS_S3C2443_CLOCK
15#define __ASM_ARM_REGS_S3C2443_CLOCK
16
17#define S3C2443_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR)
18
19#define S3C2443_PLLCON_MDIVSHIFT 16
20#define S3C2443_PLLCON_PDIVSHIFT 8
21#define S3C2443_PLLCON_SDIVSHIFT 0
22#define S3C2443_PLLCON_MDIVMASK ((1<<(1+(23-16)))-1)
23#define S3C2443_PLLCON_PDIVMASK ((1<<(1+(9-8)))-1)
24#define S3C2443_PLLCON_SDIVMASK (3)
25
26#define S3C2443_MPLLCON S3C2443_CLKREG(0x10)
27#define S3C2443_EPLLCON S3C2443_CLKREG(0x18)
28#define S3C2443_CLKSRC S3C2443_CLKREG(0x20)
29#define S3C2443_CLKDIV0 S3C2443_CLKREG(0x24)
30#define S3C2443_CLKDIV1 S3C2443_CLKREG(0x28)
31#define S3C2443_HCLKCON S3C2443_CLKREG(0x30)
32#define S3C2443_PCLKCON S3C2443_CLKREG(0x34)
33#define S3C2443_SCLKCON S3C2443_CLKREG(0x38)
34#define S3C2443_PWRMODE S3C2443_CLKREG(0x40)
35#define S3C2443_SWRST S3C2443_CLKREG(0x44)
36#define S3C2443_BUSPRI0 S3C2443_CLKREG(0x50)
37#define S3C2443_SYSID S3C2443_CLKREG(0x5C)
38#define S3C2443_PWRCFG S3C2443_CLKREG(0x60)
39#define S3C2443_RSTCON S3C2443_CLKREG(0x64)
40
41#define S3C2443_SWRST_RESET (0x533c2443)
42
43#define S3C2443_PLLCON_OFF (1<<24)
44
45#define S3C2443_CLKSRC_I2S_EXT (1<<14)
46#define S3C2443_CLKSRC_I2S_EPLLDIV (0<<14)
47#define S3C2443_CLKSRC_I2S_EPLLREF (2<<14)
48#define S3C2443_CLKSRC_I2S_EPLLREF3 (3<<14)
49#define S3C2443_CLKSRC_I2S_MASK (3<<14)
50
51#define S3C2443_CLKSRC_EPLLREF_XTAL (2<<8)
52#define S3C2443_CLKSRC_EPLLREF_EXTCLK (3<<8)
53#define S3C2443_CLKSRC_EPLLREF_MPLLREF (0<<8)
54#define S3C2443_CLKSRC_EPLLREF_MPLLREF2 (1<<8)
55#define S3C2443_CLKSRC_EPLLREF_MASK (3<<8)
56
57#define S3C2443_CLKSRC_ESYSCLK_EPLL (1<<6)
58#define S3C2443_CLKSRC_MSYSCLK_MPLL (1<<4)
59#define S3C2443_CLKSRC_EXTCLK_DIV (1<<3)
60
61#define S3C2443_CLKDIV0_DVS (1<<13)
62#define S3C2443_CLKDIV0_HALF_HCLK (1<<3)
63#define S3C2443_CLKDIV0_HALF_PCLK (1<<2)
64
65#define S3C2443_CLKDIV0_HCLKDIV_MASK (3<<0)
66
67#define S3C2443_CLKDIV0_EXTDIV_MASK (3<<6)
68#define S3C2443_CLKDIV0_EXTDIV_SHIFT (6)
69
70#define S3C2443_CLKDIV0_PREDIV_MASK (3<<4)
71#define S3C2443_CLKDIV0_PREDIV_SHIFT (4)
72
73#define S3C2443_CLKDIV0_ARMDIV_MASK (15<<9)
74#define S3C2443_CLKDIV0_ARMDIV_SHIFT (9)
75#define S3C2443_CLKDIV0_ARMDIV_1 (0<<9)
76#define S3C2443_CLKDIV0_ARMDIV_2 (8<<9)
77#define S3C2443_CLKDIV0_ARMDIV_3 (2<<9)
78#define S3C2443_CLKDIV0_ARMDIV_4 (9<<9)
79#define S3C2443_CLKDIV0_ARMDIV_6 (10<<9)
80#define S3C2443_CLKDIV0_ARMDIV_8 (11<<9)
81#define S3C2443_CLKDIV0_ARMDIV_12 (13<<9)
82#define S3C2443_CLKDIV0_ARMDIV_16 (15<<9)
83
84/* S3C2443_CLKDIV1 */
85
86#define S3C2443_CLKDIV1_CAMDIV_MASK (15<<26)
87#define S3C2443_CLKDIV1_CAMDIV_SHIFT (26)
88
89#define S3C2443_CLKDIV1_HSSPIDIV_MASK (3<<24)
90#define S3C2443_CLKDIV1_HSSPIDIV_SHIFT (24)
91
92#define S3C2443_CLKDIV1_DISPDIV_MASK (0xff<<16)
93#define S3C2443_CLKDIV1_DISPDIV_SHIFT (16)
94
95#define S3C2443_CLKDIV1_I2SDIV_MASK (15<<12)
96#define S3C2443_CLKDIV1_I2SDIV_SHIFT (12)
97
98#define S3C2443_CLKDIV1_UARTDIV_MASK (15<<8)
99#define S3C2443_CLKDIV1_UARTDIV_SHIFT (8)
100
101#define S3C2443_CLKDIV1_HSMMCDIV_MASK (3<<6)
102#define S3C2443_CLKDIV1_HSMMCDIV_SHIFT (6)
103
104#define S3C2443_CLKDIV1_USBHOSTDIV_MASK (3<<4)
105#define S3C2443_CLKDIV1_USBHOSTDIV_SHIFT (4)
106
107#define S3C2443_CLKCON_NAND
108
109#define S3C2443_HCLKCON_DMA0 (1<<0)
110#define S3C2443_HCLKCON_DMA1 (1<<1)
111#define S3C2443_HCLKCON_DMA2 (1<<2)
112#define S3C2443_HCLKCON_DMA3 (1<<3)
113#define S3C2443_HCLKCON_DMA4 (1<<4)
114#define S3C2443_HCLKCON_DMA5 (1<<5)
115#define S3C2443_HCLKCON_CAMIF (1<<8)
116#define S3C2443_HCLKCON_DISP (1<<9)
117#define S3C2443_HCLKCON_LCDC (1<<10)
118#define S3C2443_HCLKCON_USBH (1<<11)
119#define S3C2443_HCLKCON_USBD (1<<12)
120#define S3C2443_HCLKCON_HSMMC (1<<16)
121#define S3C2443_HCLKCON_CFC (1<<17)
122#define S3C2443_HCLKCON_SSMC (1<<18)
123#define S3C2443_HCLKCON_DRAMC (1<<19)
124
125#define S3C2443_PCLKCON_UART0 (1<<0)
126#define S3C2443_PCLKCON_UART1 (1<<1)
127#define S3C2443_PCLKCON_UART2 (1<<2)
128#define S3C2443_PCLKCON_UART3 (1<<3)
129#define S3C2443_PCLKCON_IIC (1<<4)
130#define S3C2443_PCLKCON_SDI (1<<5)
131#define S3C2443_PCLKCON_ADC (1<<7)
132#define S3C2443_PCLKCON_AC97 (1<<8)
133#define S3C2443_PCLKCON_IIS (1<<9)
134#define S3C2443_PCLKCON_PWMT (1<<10)
135#define S3C2443_PCLKCON_WDT (1<<11)
136#define S3C2443_PCLKCON_RTC (1<<12)
137#define S3C2443_PCLKCON_GPIO (1<<13)
138#define S3C2443_PCLKCON_SPI0 (1<<14)
139#define S3C2443_PCLKCON_SPI1 (1<<15)
140
141#define S3C2443_SCLKCON_DDRCLK (1<<16)
142#define S3C2443_SCLKCON_SSMCCLK (1<<15)
143#define S3C2443_SCLKCON_HSSPICLK (1<<14)
144#define S3C2443_SCLKCON_HSMMCCLK_EXT (1<<13)
145#define S3C2443_SCLKCON_HSMMCCLK_EPLL (1<<12)
146#define S3C2443_SCLKCON_CAMCLK (1<<11)
147#define S3C2443_SCLKCON_DISPCLK (1<<10)
148#define S3C2443_SCLKCON_I2SCLK (1<<9)
149#define S3C2443_SCLKCON_UARTCLK (1<<8)
150#define S3C2443_SCLKCON_USBHOST (1<<1)
151
152#include <asm/div64.h>
153
154static inline unsigned int
155s3c2443_get_mpll(unsigned int pllval, unsigned int baseclk)
156{
157 unsigned int mdiv, pdiv, sdiv;
158 uint64_t fvco;
159
160 mdiv = pllval >> S3C2443_PLLCON_MDIVSHIFT;
161 pdiv = pllval >> S3C2443_PLLCON_PDIVSHIFT;
162 sdiv = pllval >> S3C2443_PLLCON_SDIVSHIFT;
163
164 mdiv &= S3C2443_PLLCON_MDIVMASK;
165 pdiv &= S3C2443_PLLCON_PDIVMASK;
166 sdiv &= S3C2443_PLLCON_SDIVMASK;
167
168 fvco = (uint64_t)baseclk * (2 * (mdiv + 8));
169 do_div(fvco, pdiv << sdiv);
170
171 return (unsigned int)fvco;
172}
173
174static inline unsigned int
175s3c2443_get_epll(unsigned int pllval, unsigned int baseclk)
176{
177 unsigned int mdiv, pdiv, sdiv;
178 uint64_t fvco;
179
180 mdiv = pllval >> S3C2443_PLLCON_MDIVSHIFT;
181 pdiv = pllval >> S3C2443_PLLCON_PDIVSHIFT;
182 sdiv = pllval >> S3C2443_PLLCON_SDIVSHIFT;
183
184 mdiv &= S3C2443_PLLCON_MDIVMASK;
185 pdiv &= S3C2443_PLLCON_PDIVMASK;
186 sdiv &= S3C2443_PLLCON_SDIVMASK;
187
188 fvco = (uint64_t)baseclk * (mdiv + 8);
189 do_div(fvco, (pdiv + 2) << sdiv);
190
191 return (unsigned int)fvco;
192}
193
194#endif /* __ASM_ARM_REGS_S3C2443_CLOCK */
195
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-sdi.h b/arch/arm/mach-s3c2410/include/mach/regs-sdi.h
new file mode 100644
index 000000000000..cbf2d8884e30
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/regs-sdi.h
@@ -0,0 +1,127 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-sdi.h
2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 MMC/SDIO register definitions
11*/
12
13#ifndef __ASM_ARM_REGS_SDI
14#define __ASM_ARM_REGS_SDI "regs-sdi.h"
15
16#define S3C2410_SDICON (0x00)
17#define S3C2410_SDIPRE (0x04)
18#define S3C2410_SDICMDARG (0x08)
19#define S3C2410_SDICMDCON (0x0C)
20#define S3C2410_SDICMDSTAT (0x10)
21#define S3C2410_SDIRSP0 (0x14)
22#define S3C2410_SDIRSP1 (0x18)
23#define S3C2410_SDIRSP2 (0x1C)
24#define S3C2410_SDIRSP3 (0x20)
25#define S3C2410_SDITIMER (0x24)
26#define S3C2410_SDIBSIZE (0x28)
27#define S3C2410_SDIDCON (0x2C)
28#define S3C2410_SDIDCNT (0x30)
29#define S3C2410_SDIDSTA (0x34)
30#define S3C2410_SDIFSTA (0x38)
31
32#define S3C2410_SDIDATA (0x3C)
33#define S3C2410_SDIIMSK (0x40)
34
35#define S3C2440_SDIDATA (0x40)
36#define S3C2440_SDIIMSK (0x3C)
37
38#define S3C2440_SDICON_SDRESET (1<<8)
39#define S3C2440_SDICON_MMCCLOCK (1<<5)
40#define S3C2410_SDICON_BYTEORDER (1<<4)
41#define S3C2410_SDICON_SDIOIRQ (1<<3)
42#define S3C2410_SDICON_RWAITEN (1<<2)
43#define S3C2410_SDICON_FIFORESET (1<<1)
44#define S3C2410_SDICON_CLOCKTYPE (1<<0)
45
46#define S3C2410_SDICMDCON_ABORT (1<<12)
47#define S3C2410_SDICMDCON_WITHDATA (1<<11)
48#define S3C2410_SDICMDCON_LONGRSP (1<<10)
49#define S3C2410_SDICMDCON_WAITRSP (1<<9)
50#define S3C2410_SDICMDCON_CMDSTART (1<<8)
51#define S3C2410_SDICMDCON_SENDERHOST (1<<6)
52#define S3C2410_SDICMDCON_INDEX (0x3f)
53
54#define S3C2410_SDICMDSTAT_CRCFAIL (1<<12)
55#define S3C2410_SDICMDSTAT_CMDSENT (1<<11)
56#define S3C2410_SDICMDSTAT_CMDTIMEOUT (1<<10)
57#define S3C2410_SDICMDSTAT_RSPFIN (1<<9)
58#define S3C2410_SDICMDSTAT_XFERING (1<<8)
59#define S3C2410_SDICMDSTAT_INDEX (0xff)
60
61#define S3C2440_SDIDCON_DS_BYTE (0<<22)
62#define S3C2440_SDIDCON_DS_HALFWORD (1<<22)
63#define S3C2440_SDIDCON_DS_WORD (2<<22)
64#define S3C2410_SDIDCON_IRQPERIOD (1<<21)
65#define S3C2410_SDIDCON_TXAFTERRESP (1<<20)
66#define S3C2410_SDIDCON_RXAFTERCMD (1<<19)
67#define S3C2410_SDIDCON_BUSYAFTERCMD (1<<18)
68#define S3C2410_SDIDCON_BLOCKMODE (1<<17)
69#define S3C2410_SDIDCON_WIDEBUS (1<<16)
70#define S3C2410_SDIDCON_DMAEN (1<<15)
71#define S3C2410_SDIDCON_STOP (1<<14)
72#define S3C2440_SDIDCON_DATSTART (1<<14)
73#define S3C2410_SDIDCON_DATMODE (3<<12)
74#define S3C2410_SDIDCON_BLKNUM (0x7ff)
75
76/* constants for S3C2410_SDIDCON_DATMODE */
77#define S3C2410_SDIDCON_XFER_READY (0<<12)
78#define S3C2410_SDIDCON_XFER_CHKSTART (1<<12)
79#define S3C2410_SDIDCON_XFER_RXSTART (2<<12)
80#define S3C2410_SDIDCON_XFER_TXSTART (3<<12)
81
82#define S3C2410_SDIDCON_BLKNUM_MASK (0xFFF)
83#define S3C2410_SDIDCNT_BLKNUM_SHIFT (12)
84
85#define S3C2410_SDIDSTA_RDYWAITREQ (1<<10)
86#define S3C2410_SDIDSTA_SDIOIRQDETECT (1<<9)
87#define S3C2410_SDIDSTA_FIFOFAIL (1<<8) /* reserved on 2440 */
88#define S3C2410_SDIDSTA_CRCFAIL (1<<7)
89#define S3C2410_SDIDSTA_RXCRCFAIL (1<<6)
90#define S3C2410_SDIDSTA_DATATIMEOUT (1<<5)
91#define S3C2410_SDIDSTA_XFERFINISH (1<<4)
92#define S3C2410_SDIDSTA_BUSYFINISH (1<<3)
93#define S3C2410_SDIDSTA_SBITERR (1<<2) /* reserved on 2410a/2440 */
94#define S3C2410_SDIDSTA_TXDATAON (1<<1)
95#define S3C2410_SDIDSTA_RXDATAON (1<<0)
96
97#define S3C2440_SDIFSTA_FIFORESET (1<<16)
98#define S3C2440_SDIFSTA_FIFOFAIL (3<<14) /* 3 is correct (2 bits) */
99#define S3C2410_SDIFSTA_TFDET (1<<13)
100#define S3C2410_SDIFSTA_RFDET (1<<12)
101#define S3C2410_SDIFSTA_TFHALF (1<<11)
102#define S3C2410_SDIFSTA_TFEMPTY (1<<10)
103#define S3C2410_SDIFSTA_RFLAST (1<<9)
104#define S3C2410_SDIFSTA_RFFULL (1<<8)
105#define S3C2410_SDIFSTA_RFHALF (1<<7)
106#define S3C2410_SDIFSTA_COUNTMASK (0x7f)
107
108#define S3C2410_SDIIMSK_RESPONSECRC (1<<17)
109#define S3C2410_SDIIMSK_CMDSENT (1<<16)
110#define S3C2410_SDIIMSK_CMDTIMEOUT (1<<15)
111#define S3C2410_SDIIMSK_RESPONSEND (1<<14)
112#define S3C2410_SDIIMSK_READWAIT (1<<13)
113#define S3C2410_SDIIMSK_SDIOIRQ (1<<12)
114#define S3C2410_SDIIMSK_FIFOFAIL (1<<11)
115#define S3C2410_SDIIMSK_CRCSTATUS (1<<10)
116#define S3C2410_SDIIMSK_DATACRC (1<<9)
117#define S3C2410_SDIIMSK_DATATIMEOUT (1<<8)
118#define S3C2410_SDIIMSK_DATAFINISH (1<<7)
119#define S3C2410_SDIIMSK_BUSYFINISH (1<<6)
120#define S3C2410_SDIIMSK_SBITERR (1<<5) /* reserved 2440/2410a */
121#define S3C2410_SDIIMSK_TXFIFOHALF (1<<4)
122#define S3C2410_SDIIMSK_TXFIFOEMPTY (1<<3)
123#define S3C2410_SDIIMSK_RXFIFOLAST (1<<2)
124#define S3C2410_SDIIMSK_RXFIFOFULL (1<<1)
125#define S3C2410_SDIIMSK_RXFIFOHALF (1<<0)
126
127#endif /* __ASM_ARM_REGS_SDI */
diff --git a/arch/arm/mach-s3c2410/include/mach/reset.h b/arch/arm/mach-s3c2410/include/mach/reset.h
new file mode 100644
index 000000000000..f8c9387b049d
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/reset.h
@@ -0,0 +1,22 @@
1/* arch/arm/mach-s3c2410/include/mach/reset.h
2 *
3 * Copyright (c) 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
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 * S3C2410 CPU reset controls
12*/
13
14#ifndef __ASM_ARCH_RESET_H
15#define __ASM_ARCH_RESET_H __FILE__
16
17/* This allows the over-ride of the default reset code
18*/
19
20extern void (*s3c24xx_reset_hook)(void);
21
22#endif /* __ASM_ARCH_RESET_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/spi-gpio.h b/arch/arm/mach-s3c2410/include/mach/spi-gpio.h
new file mode 100644
index 000000000000..3fe8be9ca110
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/spi-gpio.h
@@ -0,0 +1,27 @@
1/* arch/arm/mach-s3c2410/include/mach/spi-gpio.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - SPI Controller platfrom_device info
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_SPIGPIO_H
14#define __ASM_ARCH_SPIGPIO_H __FILE__
15
16struct s3c2410_spigpio_info {
17 unsigned long pin_clk;
18 unsigned long pin_mosi;
19 unsigned long pin_miso;
20
21 int bus_num;
22
23 void (*chip_select)(struct s3c2410_spigpio_info *spi, int cs);
24};
25
26
27#endif /* __ASM_ARCH_SPIGPIO_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/spi.h b/arch/arm/mach-s3c2410/include/mach/spi.h
new file mode 100644
index 000000000000..921b13b4f0a0
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/spi.h
@@ -0,0 +1,25 @@
1/* arch/arm/mach-s3c2410/include/mach/spi.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - SPI Controller platform_device info
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_SPI_H
14#define __ASM_ARCH_SPI_H __FILE__
15
16struct s3c2410_spi_info {
17 unsigned long pin_cs; /* simple gpio cs */
18 unsigned int num_cs; /* total chipselects */
19 int bus_num; /* bus number to use. */
20
21 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
22};
23
24
25#endif /* __ASM_ARCH_SPI_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/system-reset.h b/arch/arm/mach-s3c2410/include/mach/system-reset.h
new file mode 100644
index 000000000000..ec2defebf0d5
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/system-reset.h
@@ -0,0 +1,64 @@
1/* arch/arm/mach-s3c2410/include/mach/system-reset.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - System define for arch_reset() function
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <mach/hardware.h>
14#include <asm/io.h>
15
16#include <asm/plat-s3c/regs-watchdog.h>
17#include <mach/regs-clock.h>
18
19#include <linux/clk.h>
20#include <linux/err.h>
21
22extern void (*s3c24xx_reset_hook)(void);
23
24static void
25arch_reset(char mode)
26{
27 struct clk *wdtclk;
28
29 if (mode == 's') {
30 cpu_reset(0);
31 }
32
33 if (s3c24xx_reset_hook)
34 s3c24xx_reset_hook();
35
36 printk("arch_reset: attempting watchdog reset\n");
37
38 __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */
39
40 wdtclk = clk_get(NULL, "watchdog");
41 if (!IS_ERR(wdtclk)) {
42 clk_enable(wdtclk);
43 } else
44 printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);
45
46 /* put initial values into count and data */
47 __raw_writel(0x80, S3C2410_WTCNT);
48 __raw_writel(0x80, S3C2410_WTDAT);
49
50 /* set the watchdog to go and reset... */
51 __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN |
52 S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON);
53
54 /* wait for reset to assert... */
55 mdelay(500);
56
57 printk(KERN_ERR "Watchdog reset failed to assert reset\n");
58
59 /* delay to allow the serial port to show the message */
60 mdelay(50);
61
62 /* we'll take a jump through zero as a poor second */
63 cpu_reset(0);
64}
diff --git a/arch/arm/mach-s3c2410/include/mach/system.h b/arch/arm/mach-s3c2410/include/mach/system.h
new file mode 100644
index 000000000000..e9f676bc0116
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/system.h
@@ -0,0 +1,58 @@
1/* arch/arm/mach-s3c2410/include/mach/system.h
2 *
3 * Copyright (c) 2003 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - System function defines and includes
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <mach/hardware.h>
14#include <asm/io.h>
15
16#include <mach/map.h>
17#include <mach/idle.h>
18#include <mach/reset.h>
19
20#include <mach/regs-clock.h>
21
22void (*s3c24xx_idle)(void);
23void (*s3c24xx_reset_hook)(void);
24
25void s3c24xx_default_idle(void)
26{
27 unsigned long tmp;
28 int i;
29
30 /* idle the system by using the idle mode which will wait for an
31 * interrupt to happen before restarting the system.
32 */
33
34 /* Warning: going into idle state upsets jtag scanning */
35
36 __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
37 S3C2410_CLKCON);
38
39 /* the samsung port seems to do a loop and then unset idle.. */
40 for (i = 0; i < 50; i++) {
41 tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
42 }
43
44 /* this bit is not cleared on re-start... */
45
46 __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
47 S3C2410_CLKCON);
48}
49
50static void arch_idle(void)
51{
52 if (s3c24xx_idle != NULL)
53 (s3c24xx_idle)();
54 else
55 s3c24xx_default_idle();
56}
57
58#include <mach/system-reset.h>
diff --git a/arch/arm/mach-s3c2410/include/mach/timex.h b/arch/arm/mach-s3c2410/include/mach/timex.h
new file mode 100644
index 000000000000..2a425ed0a7e0
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/timex.h
@@ -0,0 +1,26 @@
1/* arch/arm/mach-s3c2410/include/mach/timex.h
2 *
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - time parameters
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_TIMEX_H
14#define __ASM_ARCH_TIMEX_H
15
16/* CLOCK_TICK_RATE needs to be evaluatable by the cpp, so making it
17 * a variable is useless. It seems as long as we make our timers an
18 * exact multiple of HZ, any value that makes a 1->1 correspondence
19 * for the time conversion functions to/from jiffies is acceptable.
20*/
21
22
23#define CLOCK_TICK_RATE 12000000
24
25
26#endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/uncompress.h b/arch/arm/mach-s3c2410/include/mach/uncompress.h
new file mode 100644
index 000000000000..708e47459ffc
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/uncompress.h
@@ -0,0 +1,52 @@
1/* arch/arm/mach-s3c2410/include/mach/uncompress.h
2 *
3 * Copyright (c) 2003, 2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2410 - uncompress code
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_UNCOMPRESS_H
15#define __ASM_ARCH_UNCOMPRESS_H
16
17#include <mach/regs-gpio.h>
18#include <mach/map.h>
19
20/* working in physical space... */
21#undef S3C2410_GPIOREG
22#define S3C2410_GPIOREG(x) ((S3C24XX_PA_GPIO + (x)))
23
24#include <asm/plat-s3c/uncompress.h>
25
26static inline int is_arm926(void)
27{
28 unsigned int cpuid;
29
30 asm volatile ("mrc p15, 0, %0, c1, c0, 0" : "=r" (cpuid));
31
32 return ((cpuid & 0xff0) == 0x260);
33}
34
35static void arch_detect_cpu(void)
36{
37 unsigned int cpuid;
38
39 cpuid = *((volatile unsigned int *)S3C2410_GSTATUS1);
40 cpuid &= S3C2410_GSTATUS1_IDMASK;
41
42 if (is_arm926() || cpuid == S3C2410_GSTATUS1_2440 ||
43 cpuid == S3C2410_GSTATUS1_2442) {
44 fifo_mask = S3C2440_UFSTAT_TXMASK;
45 fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT;
46 } else {
47 fifo_mask = S3C2410_UFSTAT_TXMASK;
48 fifo_max = 15 << S3C2410_UFSTAT_TXSHIFT;
49 }
50}
51
52#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/usb-control.h b/arch/arm/mach-s3c2410/include/mach/usb-control.h
new file mode 100644
index 000000000000..cd91d1591f31
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/usb-control.h
@@ -0,0 +1,41 @@
1/* arch/arm/mach-s3c2410/include/mach/usb-control.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - usb port information
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_USBCONTROL_H
14#define __ASM_ARCH_USBCONTROL_H "arch/arm/mach-s3c2410/include/mach/usb-control.h"
15
16#define S3C_HCDFLG_USED (1)
17
18struct s3c2410_hcd_port {
19 unsigned char flags;
20 unsigned char power;
21 unsigned char oc_status;
22 unsigned char oc_changed;
23};
24
25struct s3c2410_hcd_info {
26 struct usb_hcd *hcd;
27 struct s3c2410_hcd_port port[2];
28
29 void (*power_control)(int port, int to);
30 void (*enable_oc)(struct s3c2410_hcd_info *, int on);
31 void (*report_oc)(struct s3c2410_hcd_info *, int ports);
32};
33
34static void inline s3c2410_usb_report_oc(struct s3c2410_hcd_info *info, int ports)
35{
36 if (info->report_oc != NULL) {
37 (info->report_oc)(info, ports);
38 }
39}
40
41#endif /*__ASM_ARCH_USBCONTROL_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/vmalloc.h b/arch/arm/mach-s3c2410/include/mach/vmalloc.h
new file mode 100644
index 000000000000..315b0078a34d
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/vmalloc.h
@@ -0,0 +1,20 @@
1/* arch/arm/mach-s3c2410/include/mach/vmalloc.h
2 *
3 * from arch/arm/mach-iop3xx/include/mach/vmalloc.h
4 *
5 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
6 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 vmalloc definition
13*/
14
15#ifndef __ASM_ARCH_VMALLOC_H
16#define __ASM_ARCH_VMALLOC_H
17
18#define VMALLOC_END (0xE0000000)
19
20#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/vr1000-cpld.h b/arch/arm/mach-s3c2410/include/mach/vr1000-cpld.h
new file mode 100644
index 000000000000..e4119913d7c5
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/vr1000-cpld.h
@@ -0,0 +1,18 @@
1/* arch/arm/mach-s3c2410/include/mach/vr1000-cpld.h
2 *
3 * Copyright (c) 2003 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * VR1000 - CPLD control constants
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_VR1000CPLD_H
14#define __ASM_ARCH_VR1000CPLD_H
15
16#define VR1000_CPLD_CTRL2_RAMWEN (0x04) /* SRAM Write Enable */
17
18#endif /* __ASM_ARCH_VR1000CPLD_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/vr1000-irq.h b/arch/arm/mach-s3c2410/include/mach/vr1000-irq.h
new file mode 100644
index 000000000000..f53f85b4ad8b
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/vr1000-irq.h
@@ -0,0 +1,26 @@
1/* arch/arm/mach-s3c2410/include/mach/vr1000-irq.h
2 *
3 * Copyright (c) 2003,2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Machine VR1000 - IRQ Number definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_VR1000IRQ_H
14#define __ASM_ARCH_VR1000IRQ_H
15
16/* irq numbers to onboard peripherals */
17
18#define IRQ_USBOC IRQ_EINT19
19#define IRQ_IDE0 IRQ_EINT16
20#define IRQ_IDE1 IRQ_EINT17
21#define IRQ_VR1000_SERIAL IRQ_EINT12
22#define IRQ_VR1000_DM9000A IRQ_EINT10
23#define IRQ_VR1000_DM9000N IRQ_EINT9
24#define IRQ_SMALERT IRQ_EINT8
25
26#endif /* __ASM_ARCH_VR1000IRQ_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/vr1000-map.h b/arch/arm/mach-s3c2410/include/mach/vr1000-map.h
new file mode 100644
index 000000000000..99612fcc4eb2
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/vr1000-map.h
@@ -0,0 +1,110 @@
1/* arch/arm/mach-s3c2410/include/mach/vr1000-map.h
2 *
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Machine VR1000 - Memory map definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13/* needs arch/map.h including with this */
14
15/* ok, we've used up to 0x13000000, now we need to find space for the
16 * peripherals that live in the nGCS[x] areas, which are quite numerous
17 * in their space. We also have the board's CPLD to find register space
18 * for.
19 */
20
21#ifndef __ASM_ARCH_VR1000MAP_H
22#define __ASM_ARCH_VR1000MAP_H
23
24#include <mach/bast-map.h>
25
26#define VR1000_IOADDR(x) BAST_IOADDR(x)
27
28/* we put the CPLD registers next, to get them out of the way */
29
30#define VR1000_VA_CTRL1 VR1000_IOADDR(0x00000000) /* 0x01300000 */
31#define VR1000_PA_CTRL1 (S3C2410_CS5 | 0x7800000)
32
33#define VR1000_VA_CTRL2 VR1000_IOADDR(0x00100000) /* 0x01400000 */
34#define VR1000_PA_CTRL2 (S3C2410_CS1 | 0x6000000)
35
36#define VR1000_VA_CTRL3 VR1000_IOADDR(0x00200000) /* 0x01500000 */
37#define VR1000_PA_CTRL3 (S3C2410_CS1 | 0x6800000)
38
39#define VR1000_VA_CTRL4 VR1000_IOADDR(0x00300000) /* 0x01600000 */
40#define VR1000_PA_CTRL4 (S3C2410_CS1 | 0x7000000)
41
42/* next, we have the PC104 ISA interrupt registers */
43
44#define VR1000_PA_PC104_IRQREQ (S3C2410_CS5 | 0x6000000) /* 0x01700000 */
45#define VR1000_VA_PC104_IRQREQ VR1000_IOADDR(0x00400000)
46
47#define VR1000_PA_PC104_IRQRAW (S3C2410_CS5 | 0x6800000) /* 0x01800000 */
48#define VR1000_VA_PC104_IRQRAW VR1000_IOADDR(0x00500000)
49
50#define VR1000_PA_PC104_IRQMASK (S3C2410_CS5 | 0x7000000) /* 0x01900000 */
51#define VR1000_VA_PC104_IRQMASK VR1000_IOADDR(0x00600000)
52
53/* 0xE0000000 contains the IO space that is split by speed and
54 * wether the access is for 8 or 16bit IO... this ensures that
55 * the correct access is made
56 *
57 * 0x10000000 of space, partitioned as so:
58 *
59 * 0x00000000 to 0x04000000 8bit, slow
60 * 0x04000000 to 0x08000000 16bit, slow
61 * 0x08000000 to 0x0C000000 16bit, net
62 * 0x0C000000 to 0x10000000 16bit, fast
63 *
64 * each of these spaces has the following in:
65 *
66 * 0x02000000 to 0x02100000 1MB IDE primary channel
67 * 0x02100000 to 0x02200000 1MB IDE primary channel aux
68 * 0x02200000 to 0x02400000 1MB IDE secondary channel
69 * 0x02300000 to 0x02400000 1MB IDE secondary channel aux
70 * 0x02500000 to 0x02600000 1MB Davicom DM9000 ethernet controllers
71 * 0x02600000 to 0x02700000 1MB
72 *
73 * the phyiscal layout of the zones are:
74 * nGCS2 - 8bit, slow
75 * nGCS3 - 16bit, slow
76 * nGCS4 - 16bit, net
77 * nGCS5 - 16bit, fast
78 */
79
80#define VR1000_VA_MULTISPACE (0xE0000000)
81
82#define VR1000_VA_ISAIO (VR1000_VA_MULTISPACE + 0x00000000)
83#define VR1000_VA_ISAMEM (VR1000_VA_MULTISPACE + 0x01000000)
84#define VR1000_VA_IDEPRI (VR1000_VA_MULTISPACE + 0x02000000)
85#define VR1000_VA_IDEPRIAUX (VR1000_VA_MULTISPACE + 0x02100000)
86#define VR1000_VA_IDESEC (VR1000_VA_MULTISPACE + 0x02200000)
87#define VR1000_VA_IDESECAUX (VR1000_VA_MULTISPACE + 0x02300000)
88#define VR1000_VA_ASIXNET (VR1000_VA_MULTISPACE + 0x02400000)
89#define VR1000_VA_DM9000 (VR1000_VA_MULTISPACE + 0x02500000)
90#define VR1000_VA_SUPERIO (VR1000_VA_MULTISPACE + 0x02600000)
91
92/* physical offset addresses for the peripherals */
93
94#define VR1000_PA_IDEPRI (0x02000000)
95#define VR1000_PA_IDEPRIAUX (0x02800000)
96#define VR1000_PA_IDESEC (0x03000000)
97#define VR1000_PA_IDESECAUX (0x03800000)
98#define VR1000_PA_DM9000 (0x05000000)
99
100#define VR1000_PA_SERIAL (0x11800000)
101#define VR1000_VA_SERIAL (VR1000_IOADDR(0x00700000))
102
103/* VR1000 ram is in CS1, with A26..A24 = 2_101 */
104#define VR1000_PA_SRAM (S3C2410_CS1 | 0x05000000)
105
106/* some configurations for the peripherals */
107
108#define VR1000_DM9000_CS VR1000_VAM_CS4
109
110#endif /* __ASM_ARCH_VR1000MAP_H */
diff --git a/arch/arm/mach-s3c2410/mach-amlm5900.c b/arch/arm/mach-s3c2410/mach-amlm5900.c
index a67a0685664d..f0de3c23ce78 100644
--- a/arch/arm/mach-s3c2410/mach-amlm5900.c
+++ b/arch/arm/mach-s3c2410/mach-amlm5900.c
@@ -42,15 +42,15 @@
42#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
43#include <asm/mach/flash.h> 43#include <asm/mach/flash.h>
44 44
45#include <asm/hardware.h> 45#include <mach/hardware.h>
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/irq.h> 47#include <asm/irq.h>
48#include <asm/mach-types.h> 48#include <asm/mach-types.h>
49#include <asm/arch/fb.h> 49#include <mach/fb.h>
50 50
51#include <asm/plat-s3c/regs-serial.h> 51#include <asm/plat-s3c/regs-serial.h>
52#include <asm/arch/regs-lcd.h> 52#include <mach/regs-lcd.h>
53#include <asm/arch/regs-gpio.h> 53#include <mach/regs-gpio.h>
54 54
55#include <asm/plat-s3c24xx/devs.h> 55#include <asm/plat-s3c24xx/devs.h>
56#include <asm/plat-s3c24xx/cpu.h> 56#include <asm/plat-s3c24xx/cpu.h>
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 965f27129707..fb1e78e28e50 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -29,24 +29,24 @@
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
31 31
32#include <asm/arch/bast-map.h> 32#include <mach/bast-map.h>
33#include <asm/arch/bast-irq.h> 33#include <mach/bast-irq.h>
34#include <asm/arch/bast-cpld.h> 34#include <mach/bast-cpld.h>
35 35
36#include <asm/hardware.h> 36#include <mach/hardware.h>
37#include <asm/io.h> 37#include <asm/io.h>
38#include <asm/irq.h> 38#include <asm/irq.h>
39#include <asm/mach-types.h> 39#include <asm/mach-types.h>
40 40
41//#include <asm/debug-ll.h> 41//#include <asm/debug-ll.h>
42#include <asm/plat-s3c/regs-serial.h> 42#include <asm/plat-s3c/regs-serial.h>
43#include <asm/arch/regs-gpio.h> 43#include <mach/regs-gpio.h>
44#include <asm/arch/regs-mem.h> 44#include <mach/regs-mem.h>
45#include <asm/arch/regs-lcd.h> 45#include <mach/regs-lcd.h>
46 46
47#include <asm/plat-s3c/nand.h> 47#include <asm/plat-s3c/nand.h>
48#include <asm/plat-s3c/iic.h> 48#include <asm/plat-s3c/iic.h>
49#include <asm/arch/fb.h> 49#include <mach/fb.h>
50 50
51#include <linux/mtd/mtd.h> 51#include <linux/mtd/mtd.h>
52#include <linux/mtd/nand.h> 52#include <linux/mtd/nand.h>
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 7c1145e87c12..e35933a46d10 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -25,19 +25,19 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/mach-types.h> 31#include <asm/mach-types.h>
32 32
33#include <asm/plat-s3c/regs-serial.h> 33#include <asm/plat-s3c/regs-serial.h>
34#include <asm/arch/regs-lcd.h> 34#include <mach/regs-lcd.h>
35#include <asm/arch/regs-gpio.h> 35#include <mach/regs-gpio.h>
36#include <asm/arch/regs-clock.h> 36#include <mach/regs-clock.h>
37 37
38#include <asm/arch/h1940.h> 38#include <mach/h1940.h>
39#include <asm/arch/h1940-latch.h> 39#include <mach/h1940-latch.h>
40#include <asm/arch/fb.h> 40#include <mach/fb.h>
41#include <asm/plat-s3c24xx/udc.h> 41#include <asm/plat-s3c24xx/udc.h>
42 42
43#include <asm/plat-s3c24xx/clock.h> 43#include <asm/plat-s3c24xx/clock.h>
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c
index 43c2e915c5bf..80fe2ed0775c 100644
--- a/arch/arm/mach-s3c2410/mach-n30.c
+++ b/arch/arm/mach-s3c2410/mach-n30.c
@@ -26,15 +26,15 @@
26#include <linux/serial_core.h> 26#include <linux/serial_core.h>
27#include <linux/timer.h> 27#include <linux/timer.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33 33
34#include <asm/arch/fb.h> 34#include <mach/fb.h>
35#include <asm/arch/leds-gpio.h> 35#include <mach/leds-gpio.h>
36#include <asm/arch/regs-gpio.h> 36#include <mach/regs-gpio.h>
37#include <asm/arch/regs-lcd.h> 37#include <mach/regs-lcd.h>
38 38
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-s3c2410/mach-otom.c b/arch/arm/mach-s3c2410/mach-otom.c
index 717af40e4477..606ee15911b6 100644
--- a/arch/arm/mach-s3c2410/mach-otom.c
+++ b/arch/arm/mach-s3c2410/mach-otom.c
@@ -22,15 +22,15 @@
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24 24
25#include <asm/arch/otom-map.h> 25#include <mach/otom-map.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31 31
32#include <asm/plat-s3c/regs-serial.h> 32#include <asm/plat-s3c/regs-serial.h>
33#include <asm/arch/regs-gpio.h> 33#include <mach/regs-gpio.h>
34 34
35#include <asm/plat-s3c24xx/s3c2410.h> 35#include <asm/plat-s3c24xx/s3c2410.h>
36#include <asm/plat-s3c24xx/clock.h> 36#include <asm/plat-s3c24xx/clock.h>
diff --git a/arch/arm/mach-s3c2410/mach-qt2410.c b/arch/arm/mach-s3c2410/mach-qt2410.c
index a1caf4b0adac..7d34844debde 100644
--- a/arch/arm/mach-s3c2410/mach-qt2410.c
+++ b/arch/arm/mach-s3c2410/mach-qt2410.c
@@ -42,19 +42,19 @@
42#include <asm/mach/map.h> 42#include <asm/mach/map.h>
43#include <asm/mach/irq.h> 43#include <asm/mach/irq.h>
44 44
45#include <asm/hardware.h> 45#include <mach/hardware.h>
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/irq.h> 47#include <asm/irq.h>
48#include <asm/mach-types.h> 48#include <asm/mach-types.h>
49 49
50#include <asm/arch/regs-gpio.h> 50#include <mach/regs-gpio.h>
51#include <asm/arch/leds-gpio.h> 51#include <mach/leds-gpio.h>
52#include <asm/plat-s3c/regs-serial.h> 52#include <asm/plat-s3c/regs-serial.h>
53#include <asm/arch/fb.h> 53#include <mach/fb.h>
54#include <asm/plat-s3c/nand.h> 54#include <asm/plat-s3c/nand.h>
55#include <asm/plat-s3c24xx/udc.h> 55#include <asm/plat-s3c24xx/udc.h>
56#include <asm/arch/spi.h> 56#include <mach/spi.h>
57#include <asm/arch/spi-gpio.h> 57#include <mach/spi-gpio.h>
58 58
59#include <asm/plat-s3c24xx/common-smdk.h> 59#include <asm/plat-s3c24xx/common-smdk.h>
60#include <asm/plat-s3c24xx/devs.h> 60#include <asm/plat-s3c24xx/devs.h>
diff --git a/arch/arm/mach-s3c2410/mach-smdk2410.c b/arch/arm/mach-s3c2410/mach-smdk2410.c
index 226550504c85..c9040080727e 100644
--- a/arch/arm/mach-s3c2410/mach-smdk2410.c
+++ b/arch/arm/mach-s3c2410/mach-smdk2410.c
@@ -42,7 +42,7 @@
42#include <asm/mach/map.h> 42#include <asm/mach/map.h>
43#include <asm/mach/irq.h> 43#include <asm/mach/irq.h>
44 44
45#include <asm/hardware.h> 45#include <mach/hardware.h>
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/irq.h> 47#include <asm/irq.h>
48#include <asm/mach-types.h> 48#include <asm/mach-types.h>
diff --git a/arch/arm/mach-s3c2410/mach-tct_hammer.c b/arch/arm/mach-s3c2410/mach-tct_hammer.c
index d90d445ccfb4..ec87306a8c24 100644
--- a/arch/arm/mach-s3c2410/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c2410/mach-tct_hammer.c
@@ -39,7 +39,7 @@
39#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41 41
42#include <asm/hardware.h> 42#include <mach/hardware.h>
43#include <asm/io.h> 43#include <asm/io.h>
44#include <asm/irq.h> 44#include <asm/irq.h>
45#include <asm/mach-types.h> 45#include <asm/mach-types.h>
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index 9a0965ac5e11..12cbca68f57d 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -30,19 +30,19 @@
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31#include <asm/mach/irq.h> 31#include <asm/mach/irq.h>
32 32
33#include <asm/arch/bast-map.h> 33#include <mach/bast-map.h>
34#include <asm/arch/vr1000-map.h> 34#include <mach/vr1000-map.h>
35#include <asm/arch/vr1000-irq.h> 35#include <mach/vr1000-irq.h>
36#include <asm/arch/vr1000-cpld.h> 36#include <mach/vr1000-cpld.h>
37 37
38#include <asm/hardware.h> 38#include <mach/hardware.h>
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/irq.h> 40#include <asm/irq.h>
41#include <asm/mach-types.h> 41#include <asm/mach-types.h>
42 42
43#include <asm/plat-s3c/regs-serial.h> 43#include <asm/plat-s3c/regs-serial.h>
44#include <asm/arch/regs-gpio.h> 44#include <mach/regs-gpio.h>
45#include <asm/arch/leds-gpio.h> 45#include <mach/leds-gpio.h>
46 46
47#include <asm/plat-s3c24xx/clock.h> 47#include <asm/plat-s3c24xx/clock.h>
48#include <asm/plat-s3c24xx/devs.h> 48#include <asm/plat-s3c24xx/devs.h>
diff --git a/arch/arm/mach-s3c2410/nor-simtec.c b/arch/arm/mach-s3c2410/nor-simtec.c
index f44e21b9c3ba..b2ae237042a5 100644
--- a/arch/arm/mach-s3c2410/nor-simtec.c
+++ b/arch/arm/mach-s3c2410/nor-simtec.c
@@ -26,9 +26,9 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
28 28
29#include <asm/arch/map.h> 29#include <mach/map.h>
30#include <asm/arch/bast-map.h> 30#include <mach/bast-map.h>
31#include <asm/arch/bast-cpld.h> 31#include <mach/bast-cpld.h>
32 32
33 33
34static void simtec_nor_vpp(struct map_info *map, int vpp) 34static void simtec_nor_vpp(struct map_info *map, int vpp)
diff --git a/arch/arm/mach-s3c2410/pm-h1940.S b/arch/arm/mach-s3c2410/pm-h1940.S
index 7d66de7ff7db..c93bf2db9f4d 100644
--- a/arch/arm/mach-s3c2410/pm-h1940.S
+++ b/arch/arm/mach-s3c2410/pm-h1940.S
@@ -20,10 +20,10 @@
20 20
21#include <linux/linkage.h> 21#include <linux/linkage.h>
22#include <asm/assembler.h> 22#include <asm/assembler.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/arch/map.h> 24#include <mach/map.h>
25 25
26#include <asm/arch/regs-gpio.h> 26#include <mach/regs-gpio.h>
27 27
28 .text 28 .text
29 .global h1940_pm_return 29 .global h1940_pm_return
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c
index 3b3a7db4e0dd..ba43ff9e8164 100644
--- a/arch/arm/mach-s3c2410/pm.c
+++ b/arch/arm/mach-s3c2410/pm.c
@@ -26,13 +26,13 @@
26#include <linux/time.h> 26#include <linux/time.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/io.h> 30#include <asm/io.h>
31 31
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33 33
34#include <asm/arch/regs-gpio.h> 34#include <mach/regs-gpio.h>
35#include <asm/arch/h1940.h> 35#include <mach/h1940.h>
36 36
37#include <asm/plat-s3c24xx/cpu.h> 37#include <asm/plat-s3c24xx/cpu.h>
38#include <asm/plat-s3c24xx/pm.h> 38#include <asm/plat-s3c24xx/pm.h>
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index 0e7991940f81..5d977f9c88ac 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -24,11 +24,11 @@
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30 30
31#include <asm/arch/regs-clock.h> 31#include <mach/regs-clock.h>
32#include <asm/plat-s3c/regs-serial.h> 32#include <asm/plat-s3c/regs-serial.h>
33 33
34#include <asm/plat-s3c24xx/s3c2410.h> 34#include <asm/plat-s3c24xx/s3c2410.h>
diff --git a/arch/arm/mach-s3c2410/sleep.S b/arch/arm/mach-s3c2410/sleep.S
index 8a9c5a2bb252..be37f221a177 100644
--- a/arch/arm/mach-s3c2410/sleep.S
+++ b/arch/arm/mach-s3c2410/sleep.S
@@ -26,12 +26,12 @@
26 26
27#include <linux/linkage.h> 27#include <linux/linkage.h>
28#include <asm/assembler.h> 28#include <asm/assembler.h>
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/arch/map.h> 30#include <mach/map.h>
31 31
32#include <asm/arch/regs-gpio.h> 32#include <mach/regs-gpio.h>
33#include <asm/arch/regs-clock.h> 33#include <mach/regs-clock.h>
34#include <asm/arch/regs-mem.h> 34#include <mach/regs-mem.h>
35#include <asm/plat-s3c/regs-serial.h> 35#include <asm/plat-s3c/regs-serial.h>
36 36
37 /* s3c2410_cpu_suspend 37 /* s3c2410_cpu_suspend
diff --git a/arch/arm/mach-s3c2410/usb-simtec.c b/arch/arm/mach-s3c2410/usb-simtec.c
index 6aec86a5da56..4dacf8a1750d 100644
--- a/arch/arm/mach-s3c2410/usb-simtec.c
+++ b/arch/arm/mach-s3c2410/usb-simtec.c
@@ -26,12 +26,12 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
28 28
29#include <asm/arch/bast-map.h> 29#include <mach/bast-map.h>
30#include <asm/arch/bast-irq.h> 30#include <mach/bast-irq.h>
31#include <asm/arch/usb-control.h> 31#include <mach/usb-control.h>
32#include <asm/arch/regs-gpio.h> 32#include <mach/regs-gpio.h>
33 33
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37 37
diff --git a/arch/arm/mach-s3c2412/clock.c b/arch/arm/mach-s3c2412/clock.c
index 1157b5a16263..af4b2ce516f9 100644
--- a/arch/arm/mach-s3c2412/clock.c
+++ b/arch/arm/mach-s3c2412/clock.c
@@ -34,12 +34,12 @@
34 34
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36 36
37#include <asm/hardware.h> 37#include <mach/hardware.h>
38#include <asm/io.h> 38#include <asm/io.h>
39 39
40#include <asm/plat-s3c/regs-serial.h> 40#include <asm/plat-s3c/regs-serial.h>
41#include <asm/arch/regs-clock.h> 41#include <mach/regs-clock.h>
42#include <asm/arch/regs-gpio.h> 42#include <mach/regs-gpio.h>
43 43
44#include <asm/plat-s3c24xx/s3c2412.h> 44#include <asm/plat-s3c24xx/s3c2412.h>
45#include <asm/plat-s3c24xx/clock.h> 45#include <asm/plat-s3c24xx/clock.h>
diff --git a/arch/arm/mach-s3c2412/dma.c b/arch/arm/mach-s3c2412/dma.c
index 1dd864993566..22fc04a3b533 100644
--- a/arch/arm/mach-s3c2412/dma.c
+++ b/arch/arm/mach-s3c2412/dma.c
@@ -18,18 +18,18 @@
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19 19
20#include <asm/dma.h> 20#include <asm/dma.h>
21#include <asm/arch/dma.h> 21#include <mach/dma.h>
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24#include <asm/plat-s3c24xx/dma.h> 24#include <asm/plat-s3c24xx/dma.h>
25#include <asm/plat-s3c24xx/cpu.h> 25#include <asm/plat-s3c24xx/cpu.h>
26 26
27#include <asm/plat-s3c/regs-serial.h> 27#include <asm/plat-s3c/regs-serial.h>
28#include <asm/arch/regs-gpio.h> 28#include <mach/regs-gpio.h>
29#include <asm/plat-s3c/regs-ac97.h> 29#include <asm/plat-s3c/regs-ac97.h>
30#include <asm/arch/regs-mem.h> 30#include <mach/regs-mem.h>
31#include <asm/arch/regs-lcd.h> 31#include <mach/regs-lcd.h>
32#include <asm/arch/regs-sdi.h> 32#include <mach/regs-sdi.h>
33#include <asm/plat-s3c24xx/regs-s3c2412-iis.h> 33#include <asm/plat-s3c24xx/regs-s3c2412-iis.h>
34#include <asm/plat-s3c24xx/regs-iis.h> 34#include <asm/plat-s3c24xx/regs-iis.h>
35#include <asm/plat-s3c24xx/regs-spi.h> 35#include <asm/plat-s3c24xx/regs-spi.h>
diff --git a/arch/arm/mach-s3c2412/gpio.c b/arch/arm/mach-s3c2412/gpio.c
index 8e55c3a2eab8..f7afece7fc38 100644
--- a/arch/arm/mach-s3c2412/gpio.c
+++ b/arch/arm/mach-s3c2412/gpio.c
@@ -20,9 +20,9 @@
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach/map.h> 21#include <asm/mach/map.h>
22 22
23#include <asm/arch/regs-gpio.h> 23#include <mach/regs-gpio.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26 26
27int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state) 27int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state)
28{ 28{
diff --git a/arch/arm/mach-s3c2412/irq.c b/arch/arm/mach-s3c2412/irq.c
index cc1917bf952a..ac62b79044f4 100644
--- a/arch/arm/mach-s3c2412/irq.c
+++ b/arch/arm/mach-s3c2412/irq.c
@@ -25,15 +25,15 @@
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/sysdev.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/io.h> 30#include <asm/io.h>
31 31
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33 33
34#include <asm/arch/regs-irq.h> 34#include <mach/regs-irq.h>
35#include <asm/arch/regs-gpio.h> 35#include <mach/regs-gpio.h>
36#include <asm/arch/regs-power.h> 36#include <mach/regs-power.h>
37 37
38#include <asm/plat-s3c24xx/cpu.h> 38#include <asm/plat-s3c24xx/cpu.h>
39#include <asm/plat-s3c24xx/irq.h> 39#include <asm/plat-s3c24xx/irq.h>
diff --git a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c2412/mach-jive.c
index 7f5924713485..30f613a79bfe 100644
--- a/arch/arm/mach-s3c2412/mach-jive.c
+++ b/arch/arm/mach-s3c2412/mach-jive.c
@@ -37,12 +37,12 @@
37#include <asm/plat-s3c/nand.h> 37#include <asm/plat-s3c/nand.h>
38#include <asm/plat-s3c/iic.h> 38#include <asm/plat-s3c/iic.h>
39 39
40#include <asm/arch/regs-power.h> 40#include <mach/regs-power.h>
41#include <asm/arch/regs-gpio.h> 41#include <mach/regs-gpio.h>
42#include <asm/arch/regs-mem.h> 42#include <mach/regs-mem.h>
43#include <asm/arch/regs-lcd.h> 43#include <mach/regs-lcd.h>
44#include <asm/arch/spi-gpio.h> 44#include <mach/spi-gpio.h>
45#include <asm/arch/fb.h> 45#include <mach/fb.h>
46 46
47#include <asm/mach-types.h> 47#include <asm/mach-types.h>
48 48
diff --git a/arch/arm/mach-s3c2412/mach-smdk2413.c b/arch/arm/mach-s3c2412/mach-smdk2413.c
index b126a530daa6..80affb1ee4cd 100644
--- a/arch/arm/mach-s3c2412/mach-smdk2413.c
+++ b/arch/arm/mach-s3c2412/mach-smdk2413.c
@@ -24,7 +24,7 @@
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/hardware/iomd.h> 28#include <asm/hardware/iomd.h>
29#include <asm/setup.h> 29#include <asm/setup.h>
30#include <asm/io.h> 30#include <asm/io.h>
@@ -33,12 +33,12 @@
33 33
34//#include <asm/debug-ll.h> 34//#include <asm/debug-ll.h>
35#include <asm/plat-s3c/regs-serial.h> 35#include <asm/plat-s3c/regs-serial.h>
36#include <asm/arch/regs-gpio.h> 36#include <mach/regs-gpio.h>
37#include <asm/arch/regs-lcd.h> 37#include <mach/regs-lcd.h>
38 38
39#include <asm/arch/idle.h> 39#include <mach/idle.h>
40#include <asm/plat-s3c24xx/udc.h> 40#include <asm/plat-s3c24xx/udc.h>
41#include <asm/arch/fb.h> 41#include <mach/fb.h>
42 42
43#include <asm/plat-s3c24xx/s3c2410.h> 43#include <asm/plat-s3c24xx/s3c2410.h>
44#include <asm/plat-s3c24xx/s3c2412.h> 44#include <asm/plat-s3c24xx/s3c2412.h>
diff --git a/arch/arm/mach-s3c2412/mach-vstms.c b/arch/arm/mach-s3c2412/mach-vstms.c
index 32982547cd63..7a08b3789915 100644
--- a/arch/arm/mach-s3c2412/mach-vstms.c
+++ b/arch/arm/mach-s3c2412/mach-vstms.c
@@ -27,18 +27,18 @@
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <asm/hardware.h> 30#include <mach/hardware.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35 35
36#include <asm/plat-s3c/regs-serial.h> 36#include <asm/plat-s3c/regs-serial.h>
37#include <asm/arch/regs-gpio.h> 37#include <mach/regs-gpio.h>
38#include <asm/arch/regs-lcd.h> 38#include <mach/regs-lcd.h>
39 39
40#include <asm/arch/idle.h> 40#include <mach/idle.h>
41#include <asm/arch/fb.h> 41#include <mach/fb.h>
42 42
43#include <asm/plat-s3c/nand.h> 43#include <asm/plat-s3c/nand.h>
44 44
diff --git a/arch/arm/mach-s3c2412/pm.c b/arch/arm/mach-s3c2412/pm.c
index d4ffb2d98076..737523a4e037 100644
--- a/arch/arm/mach-s3c2412/pm.c
+++ b/arch/arm/mach-s3c2412/pm.c
@@ -19,14 +19,14 @@
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21 21
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/irq.h> 24#include <asm/irq.h>
25 25
26#include <asm/arch/regs-power.h> 26#include <mach/regs-power.h>
27#include <asm/arch/regs-gpioj.h> 27#include <mach/regs-gpioj.h>
28#include <asm/arch/regs-gpio.h> 28#include <mach/regs-gpio.h>
29#include <asm/arch/regs-dsc.h> 29#include <mach/regs-dsc.h>
30 30
31#include <asm/plat-s3c24xx/cpu.h> 31#include <asm/plat-s3c24xx/cpu.h>
32#include <asm/plat-s3c24xx/pm.h> 32#include <asm/plat-s3c24xx/pm.h>
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index 98a0de924c22..d278010b9f60 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -25,22 +25,22 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/proc-fns.h> 29#include <asm/proc-fns.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32 32
33#include <asm/arch/reset.h> 33#include <mach/reset.h>
34#include <asm/arch/idle.h> 34#include <mach/idle.h>
35 35
36#include <asm/arch/regs-clock.h> 36#include <mach/regs-clock.h>
37#include <asm/plat-s3c/regs-serial.h> 37#include <asm/plat-s3c/regs-serial.h>
38#include <asm/arch/regs-power.h> 38#include <mach/regs-power.h>
39#include <asm/arch/regs-gpio.h> 39#include <mach/regs-gpio.h>
40#include <asm/arch/regs-gpioj.h> 40#include <mach/regs-gpioj.h>
41#include <asm/arch/regs-dsc.h> 41#include <mach/regs-dsc.h>
42#include <asm/plat-s3c24xx/regs-spi.h> 42#include <asm/plat-s3c24xx/regs-spi.h>
43#include <asm/arch/regs-s3c2412.h> 43#include <mach/regs-s3c2412.h>
44 44
45#include <asm/plat-s3c24xx/s3c2412.h> 45#include <asm/plat-s3c24xx/s3c2412.h>
46#include <asm/plat-s3c24xx/cpu.h> 46#include <asm/plat-s3c24xx/cpu.h>
diff --git a/arch/arm/mach-s3c2412/sleep.S b/arch/arm/mach-s3c2412/sleep.S
index db32cac4199a..c82418ed714d 100644
--- a/arch/arm/mach-s3c2412/sleep.S
+++ b/arch/arm/mach-s3c2412/sleep.S
@@ -22,10 +22,10 @@
22 22
23#include <linux/linkage.h> 23#include <linux/linkage.h>
24#include <asm/assembler.h> 24#include <asm/assembler.h>
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/arch/map.h> 26#include <mach/map.h>
27 27
28#include <asm/arch/regs-irq.h> 28#include <mach/regs-irq.h>
29 29
30 .text 30 .text
31 31
diff --git a/arch/arm/mach-s3c2440/clock.c b/arch/arm/mach-s3c2440/clock.c
index 184d804934c9..95567e6daea1 100644
--- a/arch/arm/mach-s3c2440/clock.c
+++ b/arch/arm/mach-s3c2440/clock.c
@@ -34,12 +34,12 @@
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/clk.h> 35#include <linux/clk.h>
36 36
37#include <asm/hardware.h> 37#include <mach/hardware.h>
38#include <asm/atomic.h> 38#include <asm/atomic.h>
39#include <asm/irq.h> 39#include <asm/irq.h>
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#include <asm/arch/regs-clock.h> 42#include <mach/regs-clock.h>
43 43
44#include <asm/plat-s3c24xx/clock.h> 44#include <asm/plat-s3c24xx/clock.h>
45#include <asm/plat-s3c24xx/cpu.h> 45#include <asm/plat-s3c24xx/cpu.h>
diff --git a/arch/arm/mach-s3c2440/dma.c b/arch/arm/mach-s3c2440/dma.c
index 0b1260827ac6..cdd4e6e79ac0 100644
--- a/arch/arm/mach-s3c2440/dma.c
+++ b/arch/arm/mach-s3c2440/dma.c
@@ -18,17 +18,17 @@
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19 19
20#include <asm/dma.h> 20#include <asm/dma.h>
21#include <asm/arch/dma.h> 21#include <mach/dma.h>
22 22
23#include <asm/plat-s3c24xx/dma.h> 23#include <asm/plat-s3c24xx/dma.h>
24#include <asm/plat-s3c24xx/cpu.h> 24#include <asm/plat-s3c24xx/cpu.h>
25 25
26#include <asm/plat-s3c/regs-serial.h> 26#include <asm/plat-s3c/regs-serial.h>
27#include <asm/arch/regs-gpio.h> 27#include <mach/regs-gpio.h>
28#include <asm/plat-s3c/regs-ac97.h> 28#include <asm/plat-s3c/regs-ac97.h>
29#include <asm/arch/regs-mem.h> 29#include <mach/regs-mem.h>
30#include <asm/arch/regs-lcd.h> 30#include <mach/regs-lcd.h>
31#include <asm/arch/regs-sdi.h> 31#include <mach/regs-sdi.h>
32#include <asm/plat-s3c24xx/regs-iis.h> 32#include <asm/plat-s3c24xx/regs-iis.h>
33#include <asm/plat-s3c24xx/regs-spi.h> 33#include <asm/plat-s3c24xx/regs-spi.h>
34 34
diff --git a/arch/arm/mach-s3c2440/dsc.c b/arch/arm/mach-s3c2440/dsc.c
index 2995ff5681bb..c0c67438d0a4 100644
--- a/arch/arm/mach-s3c2440/dsc.c
+++ b/arch/arm/mach-s3c2440/dsc.c
@@ -20,12 +20,12 @@
20#include <asm/mach/map.h> 20#include <asm/mach/map.h>
21#include <asm/mach/irq.h> 21#include <asm/mach/irq.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26 26
27#include <asm/arch/regs-gpio.h> 27#include <mach/regs-gpio.h>
28#include <asm/arch/regs-dsc.h> 28#include <mach/regs-dsc.h>
29 29
30#include <asm/plat-s3c24xx/cpu.h> 30#include <asm/plat-s3c24xx/cpu.h>
31#include <asm/plat-s3c24xx/s3c2440.h> 31#include <asm/plat-s3c24xx/s3c2440.h>
diff --git a/arch/arm/mach-s3c2440/irq.c b/arch/arm/mach-s3c2440/irq.c
index a87608bc1a03..276b823f4e27 100644
--- a/arch/arm/mach-s3c2440/irq.c
+++ b/arch/arm/mach-s3c2440/irq.c
@@ -25,14 +25,14 @@
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/sysdev.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/io.h> 30#include <asm/io.h>
31 31
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33 33
34#include <asm/arch/regs-irq.h> 34#include <mach/regs-irq.h>
35#include <asm/arch/regs-gpio.h> 35#include <mach/regs-gpio.h>
36 36
37#include <asm/plat-s3c24xx/cpu.h> 37#include <asm/plat-s3c24xx/cpu.h>
38#include <asm/plat-s3c24xx/pm.h> 38#include <asm/plat-s3c24xx/pm.h>
diff --git a/arch/arm/mach-s3c2440/mach-anubis.c b/arch/arm/mach-s3c2440/mach-anubis.c
index 09af8b23500b..265c77dec9d7 100644
--- a/arch/arm/mach-s3c2440/mach-anubis.c
+++ b/arch/arm/mach-s3c2440/mach-anubis.c
@@ -27,19 +27,19 @@
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <asm/arch/anubis-map.h> 30#include <mach/anubis-map.h>
31#include <asm/arch/anubis-irq.h> 31#include <mach/anubis-irq.h>
32#include <asm/arch/anubis-cpld.h> 32#include <mach/anubis-cpld.h>
33 33
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/mach-types.h> 37#include <asm/mach-types.h>
38 38
39#include <asm/plat-s3c/regs-serial.h> 39#include <asm/plat-s3c/regs-serial.h>
40#include <asm/arch/regs-gpio.h> 40#include <mach/regs-gpio.h>
41#include <asm/arch/regs-mem.h> 41#include <mach/regs-mem.h>
42#include <asm/arch/regs-lcd.h> 42#include <mach/regs-lcd.h>
43#include <asm/plat-s3c/nand.h> 43#include <asm/plat-s3c/nand.h>
44 44
45#include <linux/mtd/mtd.h> 45#include <linux/mtd/mtd.h>
diff --git a/arch/arm/mach-s3c2440/mach-at2440evb.c b/arch/arm/mach-s3c2440/mach-at2440evb.c
index f5e3c7f27639..f0f0cc6afcf4 100644
--- a/arch/arm/mach-s3c2440/mach-at2440evb.c
+++ b/arch/arm/mach-s3c2440/mach-at2440evb.c
@@ -27,14 +27,14 @@
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <asm/hardware.h> 30#include <mach/hardware.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33 33
34#include <asm/plat-s3c/regs-serial.h> 34#include <asm/plat-s3c/regs-serial.h>
35#include <asm/arch/regs-gpio.h> 35#include <mach/regs-gpio.h>
36#include <asm/arch/regs-mem.h> 36#include <mach/regs-mem.h>
37#include <asm/arch/regs-lcd.h> 37#include <mach/regs-lcd.h>
38#include <asm/plat-s3c/nand.h> 38#include <asm/plat-s3c/nand.h>
39 39
40#include <linux/mtd/mtd.h> 40#include <linux/mtd/mtd.h>
diff --git a/arch/arm/mach-s3c2440/mach-nexcoder.c b/arch/arm/mach-s3c2440/mach-nexcoder.c
index afe0d7b7e389..1a5e7027b41b 100644
--- a/arch/arm/mach-s3c2440/mach-nexcoder.c
+++ b/arch/arm/mach-s3c2440/mach-nexcoder.c
@@ -29,13 +29,13 @@
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30 30
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36 36
37//#include <asm/debug-ll.h> 37//#include <asm/debug-ll.h>
38#include <asm/arch/regs-gpio.h> 38#include <mach/regs-gpio.h>
39#include <asm/plat-s3c/regs-serial.h> 39#include <asm/plat-s3c/regs-serial.h>
40 40
41#include <asm/plat-s3c24xx/s3c2410.h> 41#include <asm/plat-s3c24xx/s3c2410.h>
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index af996b0e91e8..d2ee0cd148c6 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -25,18 +25,18 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
27 27
28#include <asm/arch/osiris-map.h> 28#include <mach/osiris-map.h>
29#include <asm/arch/osiris-cpld.h> 29#include <mach/osiris-cpld.h>
30 30
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35 35
36#include <asm/plat-s3c/regs-serial.h> 36#include <asm/plat-s3c/regs-serial.h>
37#include <asm/arch/regs-gpio.h> 37#include <mach/regs-gpio.h>
38#include <asm/arch/regs-mem.h> 38#include <mach/regs-mem.h>
39#include <asm/arch/regs-lcd.h> 39#include <mach/regs-lcd.h>
40#include <asm/plat-s3c/nand.h> 40#include <asm/plat-s3c/nand.h>
41 41
42#include <linux/mtd/mtd.h> 42#include <linux/mtd/mtd.h>
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c
index bac40c4878a5..e0b07e6a0a18 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c2440/mach-rx3715.c
@@ -33,18 +33,18 @@
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
35 35
36#include <asm/hardware.h> 36#include <mach/hardware.h>
37#include <asm/io.h> 37#include <asm/io.h>
38#include <asm/irq.h> 38#include <asm/irq.h>
39#include <asm/mach-types.h> 39#include <asm/mach-types.h>
40 40
41#include <asm/plat-s3c/regs-serial.h> 41#include <asm/plat-s3c/regs-serial.h>
42#include <asm/arch/regs-gpio.h> 42#include <mach/regs-gpio.h>
43#include <asm/arch/regs-lcd.h> 43#include <mach/regs-lcd.h>
44 44
45#include <asm/arch/h1940.h> 45#include <mach/h1940.h>
46#include <asm/plat-s3c/nand.h> 46#include <asm/plat-s3c/nand.h>
47#include <asm/arch/fb.h> 47#include <mach/fb.h>
48 48
49#include <asm/plat-s3c24xx/clock.h> 49#include <asm/plat-s3c24xx/clock.h>
50#include <asm/plat-s3c24xx/devs.h> 50#include <asm/plat-s3c24xx/devs.h>
diff --git a/arch/arm/mach-s3c2440/mach-smdk2440.c b/arch/arm/mach-s3c2440/mach-smdk2440.c
index 4552828bf800..327c8f371984 100644
--- a/arch/arm/mach-s3c2440/mach-smdk2440.c
+++ b/arch/arm/mach-s3c2440/mach-smdk2440.c
@@ -26,17 +26,17 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33 33
34#include <asm/plat-s3c/regs-serial.h> 34#include <asm/plat-s3c/regs-serial.h>
35#include <asm/arch/regs-gpio.h> 35#include <mach/regs-gpio.h>
36#include <asm/arch/regs-lcd.h> 36#include <mach/regs-lcd.h>
37 37
38#include <asm/arch/idle.h> 38#include <mach/idle.h>
39#include <asm/arch/fb.h> 39#include <mach/fb.h>
40 40
41#include <asm/plat-s3c24xx/s3c2410.h> 41#include <asm/plat-s3c24xx/s3c2410.h>
42#include <asm/plat-s3c24xx/s3c2440.h> 42#include <asm/plat-s3c24xx/s3c2440.h>
diff --git a/arch/arm/mach-s3c2440/s3c2440.c b/arch/arm/mach-s3c2440/s3c2440.c
index 90e1da61fbc3..d6b9a92d284e 100644
--- a/arch/arm/mach-s3c2440/s3c2440.c
+++ b/arch/arm/mach-s3c2440/s3c2440.c
@@ -25,7 +25,7 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31 31
diff --git a/arch/arm/mach-s3c2442/clock.c b/arch/arm/mach-s3c2442/clock.c
index 2d030d439fe9..569b5c3d334a 100644
--- a/arch/arm/mach-s3c2442/clock.c
+++ b/arch/arm/mach-s3c2442/clock.c
@@ -34,12 +34,12 @@
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/clk.h> 35#include <linux/clk.h>
36 36
37#include <asm/hardware.h> 37#include <mach/hardware.h>
38#include <asm/atomic.h> 38#include <asm/atomic.h>
39#include <asm/irq.h> 39#include <asm/irq.h>
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#include <asm/arch/regs-clock.h> 42#include <mach/regs-clock.h>
43 43
44#include <asm/plat-s3c24xx/clock.h> 44#include <asm/plat-s3c24xx/clock.h>
45#include <asm/plat-s3c24xx/cpu.h> 45#include <asm/plat-s3c24xx/cpu.h>
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index 17f064fabdaf..6a8d7cced4a2 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -34,10 +34,10 @@
34 34
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36 36
37#include <asm/hardware.h> 37#include <mach/hardware.h>
38#include <asm/io.h> 38#include <asm/io.h>
39 39
40#include <asm/arch/regs-s3c2443-clock.h> 40#include <mach/regs-s3c2443-clock.h>
41 41
42#include <asm/plat-s3c24xx/s3c2443.h> 42#include <asm/plat-s3c24xx/s3c2443.h>
43#include <asm/plat-s3c24xx/clock.h> 43#include <asm/plat-s3c24xx/clock.h>
diff --git a/arch/arm/mach-s3c2443/dma.c b/arch/arm/mach-s3c2443/dma.c
index f6c006d4297b..c1ff03aebfda 100644
--- a/arch/arm/mach-s3c2443/dma.c
+++ b/arch/arm/mach-s3c2443/dma.c
@@ -18,18 +18,18 @@
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19 19
20#include <asm/dma.h> 20#include <asm/dma.h>
21#include <asm/arch/dma.h> 21#include <mach/dma.h>
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24#include <asm/plat-s3c24xx/dma.h> 24#include <asm/plat-s3c24xx/dma.h>
25#include <asm/plat-s3c24xx/cpu.h> 25#include <asm/plat-s3c24xx/cpu.h>
26 26
27#include <asm/plat-s3c/regs-serial.h> 27#include <asm/plat-s3c/regs-serial.h>
28#include <asm/arch/regs-gpio.h> 28#include <mach/regs-gpio.h>
29#include <asm/plat-s3c/regs-ac97.h> 29#include <asm/plat-s3c/regs-ac97.h>
30#include <asm/arch/regs-mem.h> 30#include <mach/regs-mem.h>
31#include <asm/arch/regs-lcd.h> 31#include <mach/regs-lcd.h>
32#include <asm/arch/regs-sdi.h> 32#include <mach/regs-sdi.h>
33#include <asm/plat-s3c24xx/regs-iis.h> 33#include <asm/plat-s3c24xx/regs-iis.h>
34#include <asm/plat-s3c24xx/regs-spi.h> 34#include <asm/plat-s3c24xx/regs-spi.h>
35 35
diff --git a/arch/arm/mach-s3c2443/irq.c b/arch/arm/mach-s3c2443/irq.c
index f9ad498a6fc0..9674de7223fd 100644
--- a/arch/arm/mach-s3c2443/irq.c
+++ b/arch/arm/mach-s3c2443/irq.c
@@ -25,14 +25,14 @@
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/sysdev.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/io.h> 30#include <asm/io.h>
31 31
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33 33
34#include <asm/arch/regs-irq.h> 34#include <mach/regs-irq.h>
35#include <asm/arch/regs-gpio.h> 35#include <mach/regs-gpio.h>
36 36
37#include <asm/plat-s3c24xx/cpu.h> 37#include <asm/plat-s3c24xx/cpu.h>
38#include <asm/plat-s3c24xx/pm.h> 38#include <asm/plat-s3c24xx/pm.h>
diff --git a/arch/arm/mach-s3c2443/mach-smdk2443.c b/arch/arm/mach-s3c2443/mach-smdk2443.c
index 8cd93130ef36..e3c0d587bd10 100644
--- a/arch/arm/mach-s3c2443/mach-smdk2443.c
+++ b/arch/arm/mach-s3c2443/mach-smdk2443.c
@@ -26,17 +26,17 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33 33
34#include <asm/plat-s3c/regs-serial.h> 34#include <asm/plat-s3c/regs-serial.h>
35#include <asm/arch/regs-gpio.h> 35#include <mach/regs-gpio.h>
36#include <asm/arch/regs-lcd.h> 36#include <mach/regs-lcd.h>
37 37
38#include <asm/arch/idle.h> 38#include <mach/idle.h>
39#include <asm/arch/fb.h> 39#include <mach/fb.h>
40 40
41#include <asm/plat-s3c24xx/s3c2410.h> 41#include <asm/plat-s3c24xx/s3c2410.h>
42#include <asm/plat-s3c24xx/s3c2440.h> 42#include <asm/plat-s3c24xx/s3c2440.h>
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index 9ce490560af9..37793f924b5e 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -25,12 +25,12 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31 31
32#include <asm/arch/regs-s3c2443-clock.h> 32#include <mach/regs-s3c2443-clock.h>
33#include <asm/arch/reset.h> 33#include <mach/reset.h>
34 34
35#include <asm/plat-s3c24xx/s3c2443.h> 35#include <asm/plat-s3c24xx/s3c2443.h>
36#include <asm/plat-s3c24xx/devs.h> 36#include <asm/plat-s3c24xx/devs.h>
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index be06d668a3c9..55e64477a876 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -20,7 +20,7 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/setup.h> 26#include <asm/setup.h>
@@ -34,8 +34,8 @@
34#include <asm/mach/irda.h> 34#include <asm/mach/irda.h>
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36#include <asm/mach/serial_sa1100.h> 36#include <asm/mach/serial_sa1100.h>
37#include <asm/arch/assabet.h> 37#include <mach/assabet.h>
38#include <asm/arch/mcp.h> 38#include <mach/mcp.h>
39 39
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index 842d9e6dc5ff..3efefbdd2527 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -23,10 +23,10 @@
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <linux/errno.h> 24#include <linux/errno.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/setup.h> 28#include <asm/setup.h>
29#include <asm/arch/irqs.h> 29#include <mach/irqs.h>
30 30
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/flash.h> 32#include <asm/mach/flash.h>
@@ -34,7 +34,7 @@
34#include <asm/hardware/sa1111.h> 34#include <asm/hardware/sa1111.h>
35#include <asm/mach/serial_sa1100.h> 35#include <asm/mach/serial_sa1100.h>
36 36
37#include <asm/arch/badge4.h> 37#include <mach/badge4.h>
38 38
39#include "generic.h" 39#include "generic.h"
40 40
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c
index 56d3ee01baae..fd3ad9cfc912 100644
--- a/arch/arm/mach-sa1100/cerf.c
+++ b/arch/arm/mach-sa1100/cerf.c
@@ -19,7 +19,7 @@
19#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20 20
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/setup.h> 23#include <asm/setup.h>
24 24
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
@@ -28,8 +28,8 @@
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <asm/mach/serial_sa1100.h> 29#include <asm/mach/serial_sa1100.h>
30 30
31#include <asm/arch/cerf.h> 31#include <mach/cerf.h>
32#include <asm/arch/mcp.h> 32#include <mach/mcp.h>
33#include "generic.h" 33#include "generic.h"
34 34
35static struct resource cerfuart2_resources[] = { 35static struct resource cerfuart2_resources[] = {
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index b5809c51d13f..43c30f84abf2 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -11,7 +11,7 @@
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/mutex.h> 12#include <linux/mutex.h>
13 13
14#include <asm/hardware.h> 14#include <mach/hardware.h>
15 15
16/* 16/*
17 * Very simple clock implementation - we only have one clock to 17 * Very simple clock implementation - we only have one clock to
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 2f772a3965c4..fe289997cfaf 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -26,11 +26,11 @@
26#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
27#include <linux/timer.h> 27#include <linux/timer.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/setup.h> 32#include <asm/setup.h>
33#include <asm/arch/collie.h> 33#include <mach/collie.h>
34 34
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
36#include <asm/mach/flash.h> 36#include <asm/mach/flash.h>
@@ -40,7 +40,7 @@
40#include <asm/hardware/scoop.h> 40#include <asm/hardware/scoop.h>
41#include <asm/mach/sharpsl_param.h> 41#include <asm/mach/sharpsl_param.h>
42#include <asm/hardware/locomo.h> 42#include <asm/hardware/locomo.h>
43#include <asm/arch/mcp.h> 43#include <mach/mcp.h>
44 44
45#include "generic.h" 45#include "generic.h"
46 46
diff --git a/arch/arm/mach-sa1100/collie_pm.c b/arch/arm/mach-sa1100/collie_pm.c
index 94620be7bfac..b1161fc80602 100644
--- a/arch/arm/mach-sa1100/collie_pm.c
+++ b/arch/arm/mach-sa1100/collie_pm.c
@@ -24,11 +24,10 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25 25
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/mach-types.h> 27#include <mach/hardware.h>
28#include <asm/hardware.h>
29#include <asm/hardware/scoop.h> 28#include <asm/hardware/scoop.h>
30#include <asm/dma.h> 29#include <asm/dma.h>
31#include <asm/arch/collie.h> 30#include <mach/collie.h>
32#include <asm/mach/sharpsl_param.h> 31#include <asm/mach/sharpsl_param.h>
33#include <asm/hardware/sharpsl_pm.h> 32#include <asm/hardware/sharpsl_pm.h>
34 33
diff --git a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c
index 343368aa82de..da3a898a6d66 100644
--- a/arch/arm/mach-sa1100/cpu-sa1100.c
+++ b/arch/arm/mach-sa1100/cpu-sa1100.c
@@ -88,7 +88,7 @@
88#include <linux/init.h> 88#include <linux/init.h>
89#include <linux/cpufreq.h> 89#include <linux/cpufreq.h>
90 90
91#include <asm/hardware.h> 91#include <mach/hardware.h>
92 92
93#include "generic.h" 93#include "generic.h"
94 94
diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c
index 36b47ff5af11..39d38c801736 100644
--- a/arch/arm/mach-sa1100/cpu-sa1110.c
+++ b/arch/arm/mach-sa1100/cpu-sa1110.c
@@ -26,7 +26,7 @@
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/init.h> 27#include <linux/init.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/system.h> 32#include <asm/system.h>
diff --git a/arch/arm/mach-sa1100/dma.c b/arch/arm/mach-sa1100/dma.c
index e5080286060e..f990a3e85846 100644
--- a/arch/arm/mach-sa1100/dma.c
+++ b/arch/arm/mach-sa1100/dma.c
@@ -18,7 +18,7 @@
18 18
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/dma.h> 22#include <asm/dma.h>
23 23
24 24
@@ -76,7 +76,7 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
76 * address of the hardware registers for that channel as the channel 76 * address of the hardware registers for that channel as the channel
77 * identifier. This identifier is written to the location pointed by 77 * identifier. This identifier is written to the location pointed by
78 * @dma_regs. The list of possible values for @device are listed into 78 * @dma_regs. The list of possible values for @device are listed into
79 * linux/include/asm-arm/arch-sa1100/dma.h as a dma_device_t enum. 79 * arch/arm/mach-sa1100/include/mach/dma.h as a dma_device_t enum.
80 * 80 *
81 * Note that reading from a port and writing to the same port are 81 * Note that reading from a port and writing to the same port are
82 * actually considered as two different streams requiring separate 82 * actually considered as two different streams requiring separate
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 3b6fc090c8ef..1362994c78aa 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -21,7 +21,7 @@
21 21
22#include <asm/div64.h> 22#include <asm/div64.h>
23#include <asm/cnt32_to_63.h> 23#include <asm/cnt32_to_63.h>
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/system.h> 25#include <asm/system.h>
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
diff --git a/arch/arm/mach-sa1100/gpio.c b/arch/arm/mach-sa1100/gpio.c
index 372f1f4f54a1..0d3829a8c2c1 100644
--- a/arch/arm/mach-sa1100/gpio.c
+++ b/arch/arm/mach-sa1100/gpio.c
@@ -12,7 +12,7 @@
12#include <linux/module.h> 12#include <linux/module.h>
13 13
14#include <asm/gpio.h> 14#include <asm/gpio.h>
15#include <asm/hardware.h> 15#include <mach/hardware.h>
16#include "generic.h" 16#include "generic.h"
17 17
18static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset) 18static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset)
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index b34ff42bbd75..af25a78d705d 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -30,7 +30,7 @@
30#include <linux/serial_core.h> 30#include <linux/serial_core.h>
31 31
32#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/hardware.h> 33#include <mach/hardware.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/setup.h> 35#include <asm/setup.h>
36 36
@@ -41,14 +41,14 @@
41#include <asm/mach/map.h> 41#include <asm/mach/map.h>
42#include <asm/mach/serial_sa1100.h> 42#include <asm/mach/serial_sa1100.h>
43 43
44#include <asm/arch/h3600.h> 44#include <mach/h3600.h>
45 45
46#if defined (CONFIG_SA1100_H3600) || defined (CONFIG_SA1100_H3100) 46#if defined (CONFIG_SA1100_H3600) || defined (CONFIG_SA1100_H3100)
47#include <asm/arch/h3600_gpio.h> 47#include <mach/h3600_gpio.h>
48#endif 48#endif
49 49
50#ifdef CONFIG_SA1100_H3800 50#ifdef CONFIG_SA1100_H3800
51#include <asm/arch/h3600_asic.h> 51#include <mach/h3600_asic.h>
52#endif 52#endif
53 53
54#include "generic.h" 54#include "generic.h"
@@ -681,7 +681,7 @@ static struct ipaq_model_ops h3800_model_ops __initdata = {
681 681
682#define MAX_ASIC_ISR_LOOPS 20 682#define MAX_ASIC_ISR_LOOPS 20
683 683
684/* The order of these is important - see #include <asm/arch/irqs.h> */ 684/* The order of these is important - see #include <mach/irqs.h> */
685static u32 kpio_irq_mask[] = { 685static u32 kpio_irq_mask[] = {
686 KPIO_KEY_ALL, 686 KPIO_KEY_ALL,
687 KPIO_SPI_INT, 687 KPIO_SPI_INT,
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index 046b213efd5b..e7056c0b562c 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -22,7 +22,7 @@
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/setup.h> 27#include <asm/setup.h>
28#include <asm/page.h> 28#include <asm/page.h>
diff --git a/arch/arm/mach-sa1100/include/mach/SA-1100.h b/arch/arm/mach-sa1100/include/mach/SA-1100.h
new file mode 100644
index 000000000000..62aaf04a3906
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/SA-1100.h
@@ -0,0 +1,2072 @@
1/*
2 * FILE SA-1100.h
3 *
4 * Version 1.2
5 * Author Copyright (c) Marc A. Viredaz, 1998
6 * DEC Western Research Laboratory, Palo Alto, CA
7 * Date January 1998 (April 1997)
8 * System StrongARM SA-1100
9 * Language C or ARM Assembly
10 * Purpose Definition of constants related to the StrongARM
11 * SA-1100 microprocessor (Advanced RISC Machine (ARM)
12 * architecture version 4). This file is based on the
13 * StrongARM SA-1100 data sheet version 2.2.
14 *
15 */
16
17
18/* Be sure that virtual mapping is defined right */
19#ifndef __ASM_ARCH_HARDWARE_H
20#error You must include hardware.h not SA-1100.h
21#endif
22
23#include "bitfield.h"
24
25/*
26 * SA1100 CS line to physical address
27 */
28
29#define SA1100_CS0_PHYS 0x00000000
30#define SA1100_CS1_PHYS 0x08000000
31#define SA1100_CS2_PHYS 0x10000000
32#define SA1100_CS3_PHYS 0x18000000
33#define SA1100_CS4_PHYS 0x40000000
34#define SA1100_CS5_PHYS 0x48000000
35
36/*
37 * Personal Computer Memory Card International Association (PCMCIA) sockets
38 */
39
40#define PCMCIAPrtSp 0x04000000 /* PCMCIA Partition Space [byte] */
41#define PCMCIASp (4*PCMCIAPrtSp) /* PCMCIA Space [byte] */
42#define PCMCIAIOSp PCMCIAPrtSp /* PCMCIA I/O Space [byte] */
43#define PCMCIAAttrSp PCMCIAPrtSp /* PCMCIA Attribute Space [byte] */
44#define PCMCIAMemSp PCMCIAPrtSp /* PCMCIA Memory Space [byte] */
45
46#define PCMCIA0Sp PCMCIASp /* PCMCIA 0 Space [byte] */
47#define PCMCIA0IOSp PCMCIAIOSp /* PCMCIA 0 I/O Space [byte] */
48#define PCMCIA0AttrSp PCMCIAAttrSp /* PCMCIA 0 Attribute Space [byte] */
49#define PCMCIA0MemSp PCMCIAMemSp /* PCMCIA 0 Memory Space [byte] */
50
51#define PCMCIA1Sp PCMCIASp /* PCMCIA 1 Space [byte] */
52#define PCMCIA1IOSp PCMCIAIOSp /* PCMCIA 1 I/O Space [byte] */
53#define PCMCIA1AttrSp PCMCIAAttrSp /* PCMCIA 1 Attribute Space [byte] */
54#define PCMCIA1MemSp PCMCIAMemSp /* PCMCIA 1 Memory Space [byte] */
55
56#define _PCMCIA(Nb) /* PCMCIA [0..1] */ \
57 (0x20000000 + (Nb)*PCMCIASp)
58#define _PCMCIAIO(Nb) _PCMCIA (Nb) /* PCMCIA I/O [0..1] */
59#define _PCMCIAAttr(Nb) /* PCMCIA Attribute [0..1] */ \
60 (_PCMCIA (Nb) + 2*PCMCIAPrtSp)
61#define _PCMCIAMem(Nb) /* PCMCIA Memory [0..1] */ \
62 (_PCMCIA (Nb) + 3*PCMCIAPrtSp)
63
64#define _PCMCIA0 _PCMCIA (0) /* PCMCIA 0 */
65#define _PCMCIA0IO _PCMCIAIO (0) /* PCMCIA 0 I/O */
66#define _PCMCIA0Attr _PCMCIAAttr (0) /* PCMCIA 0 Attribute */
67#define _PCMCIA0Mem _PCMCIAMem (0) /* PCMCIA 0 Memory */
68
69#define _PCMCIA1 _PCMCIA (1) /* PCMCIA 1 */
70#define _PCMCIA1IO _PCMCIAIO (1) /* PCMCIA 1 I/O */
71#define _PCMCIA1Attr _PCMCIAAttr (1) /* PCMCIA 1 Attribute */
72#define _PCMCIA1Mem _PCMCIAMem (1) /* PCMCIA 1 Memory */
73
74
75/*
76 * Universal Serial Bus (USB) Device Controller (UDC) control registers
77 *
78 * Registers
79 * Ser0UDCCR Serial port 0 Universal Serial Bus (USB) Device
80 * Controller (UDC) Control Register (read/write).
81 * Ser0UDCAR Serial port 0 Universal Serial Bus (USB) Device
82 * Controller (UDC) Address Register (read/write).
83 * Ser0UDCOMP Serial port 0 Universal Serial Bus (USB) Device
84 * Controller (UDC) Output Maximum Packet size register
85 * (read/write).
86 * Ser0UDCIMP Serial port 0 Universal Serial Bus (USB) Device
87 * Controller (UDC) Input Maximum Packet size register
88 * (read/write).
89 * Ser0UDCCS0 Serial port 0 Universal Serial Bus (USB) Device
90 * Controller (UDC) Control/Status register end-point 0
91 * (read/write).
92 * Ser0UDCCS1 Serial port 0 Universal Serial Bus (USB) Device
93 * Controller (UDC) Control/Status register end-point 1
94 * (output, read/write).
95 * Ser0UDCCS2 Serial port 0 Universal Serial Bus (USB) Device
96 * Controller (UDC) Control/Status register end-point 2
97 * (input, read/write).
98 * Ser0UDCD0 Serial port 0 Universal Serial Bus (USB) Device
99 * Controller (UDC) Data register end-point 0
100 * (read/write).
101 * Ser0UDCWC Serial port 0 Universal Serial Bus (USB) Device
102 * Controller (UDC) Write Count register end-point 0
103 * (read).
104 * Ser0UDCDR Serial port 0 Universal Serial Bus (USB) Device
105 * Controller (UDC) Data Register (read/write).
106 * Ser0UDCSR Serial port 0 Universal Serial Bus (USB) Device
107 * Controller (UDC) Status Register (read/write).
108 */
109
110#define Ser0UDCCR __REG(0x80000000) /* Ser. port 0 UDC Control Reg. */
111#define Ser0UDCAR __REG(0x80000004) /* Ser. port 0 UDC Address Reg. */
112#define Ser0UDCOMP __REG(0x80000008) /* Ser. port 0 UDC Output Maximum Packet size reg. */
113#define Ser0UDCIMP __REG(0x8000000C) /* Ser. port 0 UDC Input Maximum Packet size reg. */
114#define Ser0UDCCS0 __REG(0x80000010) /* Ser. port 0 UDC Control/Status reg. end-point 0 */
115#define Ser0UDCCS1 __REG(0x80000014) /* Ser. port 0 UDC Control/Status reg. end-point 1 (output) */
116#define Ser0UDCCS2 __REG(0x80000018) /* Ser. port 0 UDC Control/Status reg. end-point 2 (input) */
117#define Ser0UDCD0 __REG(0x8000001C) /* Ser. port 0 UDC Data reg. end-point 0 */
118#define Ser0UDCWC __REG(0x80000020) /* Ser. port 0 UDC Write Count reg. end-point 0 */
119#define Ser0UDCDR __REG(0x80000028) /* Ser. port 0 UDC Data Reg. */
120#define Ser0UDCSR __REG(0x80000030) /* Ser. port 0 UDC Status Reg. */
121
122#define UDCCR_UDD 0x00000001 /* UDC Disable */
123#define UDCCR_UDA 0x00000002 /* UDC Active (read) */
124#define UDCCR_RESIM 0x00000004 /* Resume Interrupt Mask, per errata */
125#define UDCCR_EIM 0x00000008 /* End-point 0 Interrupt Mask */
126 /* (disable) */
127#define UDCCR_RIM 0x00000010 /* Receive Interrupt Mask */
128 /* (disable) */
129#define UDCCR_TIM 0x00000020 /* Transmit Interrupt Mask */
130 /* (disable) */
131#define UDCCR_SRM 0x00000040 /* Suspend/Resume interrupt Mask */
132 /* (disable) */
133#define UDCCR_SUSIM UDCCR_SRM /* Per errata, SRM just masks suspend */
134#define UDCCR_REM 0x00000080 /* REset interrupt Mask (disable) */
135
136#define UDCAR_ADD Fld (7, 0) /* function ADDress */
137
138#define UDCOMP_OUTMAXP Fld (8, 0) /* OUTput MAXimum Packet size - 1 */
139 /* [byte] */
140#define UDCOMP_OutMaxPkt(Size) /* Output Maximum Packet size */ \
141 /* [1..256 byte] */ \
142 (((Size) - 1) << FShft (UDCOMP_OUTMAXP))
143
144#define UDCIMP_INMAXP Fld (8, 0) /* INput MAXimum Packet size - 1 */
145 /* [byte] */
146#define UDCIMP_InMaxPkt(Size) /* Input Maximum Packet size */ \
147 /* [1..256 byte] */ \
148 (((Size) - 1) << FShft (UDCIMP_INMAXP))
149
150#define UDCCS0_OPR 0x00000001 /* Output Packet Ready (read) */
151#define UDCCS0_IPR 0x00000002 /* Input Packet Ready */
152#define UDCCS0_SST 0x00000004 /* Sent STall */
153#define UDCCS0_FST 0x00000008 /* Force STall */
154#define UDCCS0_DE 0x00000010 /* Data End */
155#define UDCCS0_SE 0x00000020 /* Setup End (read) */
156#define UDCCS0_SO 0x00000040 /* Serviced Output packet ready */
157 /* (write) */
158#define UDCCS0_SSE 0x00000080 /* Serviced Setup End (write) */
159
160#define UDCCS1_RFS 0x00000001 /* Receive FIFO 12-bytes or more */
161 /* Service request (read) */
162#define UDCCS1_RPC 0x00000002 /* Receive Packet Complete */
163#define UDCCS1_RPE 0x00000004 /* Receive Packet Error (read) */
164#define UDCCS1_SST 0x00000008 /* Sent STall */
165#define UDCCS1_FST 0x00000010 /* Force STall */
166#define UDCCS1_RNE 0x00000020 /* Receive FIFO Not Empty (read) */
167
168#define UDCCS2_TFS 0x00000001 /* Transmit FIFO 8-bytes or less */
169 /* Service request (read) */
170#define UDCCS2_TPC 0x00000002 /* Transmit Packet Complete */
171#define UDCCS2_TPE 0x00000004 /* Transmit Packet Error (read) */
172#define UDCCS2_TUR 0x00000008 /* Transmit FIFO Under-Run */
173#define UDCCS2_SST 0x00000010 /* Sent STall */
174#define UDCCS2_FST 0x00000020 /* Force STall */
175
176#define UDCD0_DATA Fld (8, 0) /* receive/transmit DATA FIFOs */
177
178#define UDCWC_WC Fld (4, 0) /* Write Count */
179
180#define UDCDR_DATA Fld (8, 0) /* receive/transmit DATA FIFOs */
181
182#define UDCSR_EIR 0x00000001 /* End-point 0 Interrupt Request */
183#define UDCSR_RIR 0x00000002 /* Receive Interrupt Request */
184#define UDCSR_TIR 0x00000004 /* Transmit Interrupt Request */
185#define UDCSR_SUSIR 0x00000008 /* SUSpend Interrupt Request */
186#define UDCSR_RESIR 0x00000010 /* RESume Interrupt Request */
187#define UDCSR_RSTIR 0x00000020 /* ReSeT Interrupt Request */
188
189
190/*
191 * Universal Asynchronous Receiver/Transmitter (UART) control registers
192 *
193 * Registers
194 * Ser1UTCR0 Serial port 1 Universal Asynchronous
195 * Receiver/Transmitter (UART) Control Register 0
196 * (read/write).
197 * Ser1UTCR1 Serial port 1 Universal Asynchronous
198 * Receiver/Transmitter (UART) Control Register 1
199 * (read/write).
200 * Ser1UTCR2 Serial port 1 Universal Asynchronous
201 * Receiver/Transmitter (UART) Control Register 2
202 * (read/write).
203 * Ser1UTCR3 Serial port 1 Universal Asynchronous
204 * Receiver/Transmitter (UART) Control Register 3
205 * (read/write).
206 * Ser1UTDR Serial port 1 Universal Asynchronous
207 * Receiver/Transmitter (UART) Data Register
208 * (read/write).
209 * Ser1UTSR0 Serial port 1 Universal Asynchronous
210 * Receiver/Transmitter (UART) Status Register 0
211 * (read/write).
212 * Ser1UTSR1 Serial port 1 Universal Asynchronous
213 * Receiver/Transmitter (UART) Status Register 1 (read).
214 *
215 * Ser2UTCR0 Serial port 2 Universal Asynchronous
216 * Receiver/Transmitter (UART) Control Register 0
217 * (read/write).
218 * Ser2UTCR1 Serial port 2 Universal Asynchronous
219 * Receiver/Transmitter (UART) Control Register 1
220 * (read/write).
221 * Ser2UTCR2 Serial port 2 Universal Asynchronous
222 * Receiver/Transmitter (UART) Control Register 2
223 * (read/write).
224 * Ser2UTCR3 Serial port 2 Universal Asynchronous
225 * Receiver/Transmitter (UART) Control Register 3
226 * (read/write).
227 * Ser2UTCR4 Serial port 2 Universal Asynchronous
228 * Receiver/Transmitter (UART) Control Register 4
229 * (read/write).
230 * Ser2UTDR Serial port 2 Universal Asynchronous
231 * Receiver/Transmitter (UART) Data Register
232 * (read/write).
233 * Ser2UTSR0 Serial port 2 Universal Asynchronous
234 * Receiver/Transmitter (UART) Status Register 0
235 * (read/write).
236 * Ser2UTSR1 Serial port 2 Universal Asynchronous
237 * Receiver/Transmitter (UART) Status Register 1 (read).
238 *
239 * Ser3UTCR0 Serial port 3 Universal Asynchronous
240 * Receiver/Transmitter (UART) Control Register 0
241 * (read/write).
242 * Ser3UTCR1 Serial port 3 Universal Asynchronous
243 * Receiver/Transmitter (UART) Control Register 1
244 * (read/write).
245 * Ser3UTCR2 Serial port 3 Universal Asynchronous
246 * Receiver/Transmitter (UART) Control Register 2
247 * (read/write).
248 * Ser3UTCR3 Serial port 3 Universal Asynchronous
249 * Receiver/Transmitter (UART) Control Register 3
250 * (read/write).
251 * Ser3UTDR Serial port 3 Universal Asynchronous
252 * Receiver/Transmitter (UART) Data Register
253 * (read/write).
254 * Ser3UTSR0 Serial port 3 Universal Asynchronous
255 * Receiver/Transmitter (UART) Status Register 0
256 * (read/write).
257 * Ser3UTSR1 Serial port 3 Universal Asynchronous
258 * Receiver/Transmitter (UART) Status Register 1 (read).
259 *
260 * Clocks
261 * fxtl, Txtl Frequency, period of the system crystal (3.6864 MHz
262 * or 3.5795 MHz).
263 * fua, Tua Frequency, period of the UART communication.
264 */
265
266#define _UTCR0(Nb) __REG(0x80010000 + ((Nb) - 1)*0x00020000) /* UART Control Reg. 0 [1..3] */
267#define _UTCR1(Nb) __REG(0x80010004 + ((Nb) - 1)*0x00020000) /* UART Control Reg. 1 [1..3] */
268#define _UTCR2(Nb) __REG(0x80010008 + ((Nb) - 1)*0x00020000) /* UART Control Reg. 2 [1..3] */
269#define _UTCR3(Nb) __REG(0x8001000C + ((Nb) - 1)*0x00020000) /* UART Control Reg. 3 [1..3] */
270#define _UTCR4(Nb) __REG(0x80010010 + ((Nb) - 1)*0x00020000) /* UART Control Reg. 4 [2] */
271#define _UTDR(Nb) __REG(0x80010014 + ((Nb) - 1)*0x00020000) /* UART Data Reg. [1..3] */
272#define _UTSR0(Nb) __REG(0x8001001C + ((Nb) - 1)*0x00020000) /* UART Status Reg. 0 [1..3] */
273#define _UTSR1(Nb) __REG(0x80010020 + ((Nb) - 1)*0x00020000) /* UART Status Reg. 1 [1..3] */
274
275#define Ser1UTCR0 _UTCR0 (1) /* Ser. port 1 UART Control Reg. 0 */
276#define Ser1UTCR1 _UTCR1 (1) /* Ser. port 1 UART Control Reg. 1 */
277#define Ser1UTCR2 _UTCR2 (1) /* Ser. port 1 UART Control Reg. 2 */
278#define Ser1UTCR3 _UTCR3 (1) /* Ser. port 1 UART Control Reg. 3 */
279#define Ser1UTDR _UTDR (1) /* Ser. port 1 UART Data Reg. */
280#define Ser1UTSR0 _UTSR0 (1) /* Ser. port 1 UART Status Reg. 0 */
281#define Ser1UTSR1 _UTSR1 (1) /* Ser. port 1 UART Status Reg. 1 */
282
283#define Ser2UTCR0 _UTCR0 (2) /* Ser. port 2 UART Control Reg. 0 */
284#define Ser2UTCR1 _UTCR1 (2) /* Ser. port 2 UART Control Reg. 1 */
285#define Ser2UTCR2 _UTCR2 (2) /* Ser. port 2 UART Control Reg. 2 */
286#define Ser2UTCR3 _UTCR3 (2) /* Ser. port 2 UART Control Reg. 3 */
287#define Ser2UTCR4 _UTCR4 (2) /* Ser. port 2 UART Control Reg. 4 */
288#define Ser2UTDR _UTDR (2) /* Ser. port 2 UART Data Reg. */
289#define Ser2UTSR0 _UTSR0 (2) /* Ser. port 2 UART Status Reg. 0 */
290#define Ser2UTSR1 _UTSR1 (2) /* Ser. port 2 UART Status Reg. 1 */
291
292#define Ser3UTCR0 _UTCR0 (3) /* Ser. port 3 UART Control Reg. 0 */
293#define Ser3UTCR1 _UTCR1 (3) /* Ser. port 3 UART Control Reg. 1 */
294#define Ser3UTCR2 _UTCR2 (3) /* Ser. port 3 UART Control Reg. 2 */
295#define Ser3UTCR3 _UTCR3 (3) /* Ser. port 3 UART Control Reg. 3 */
296#define Ser3UTDR _UTDR (3) /* Ser. port 3 UART Data Reg. */
297#define Ser3UTSR0 _UTSR0 (3) /* Ser. port 3 UART Status Reg. 0 */
298#define Ser3UTSR1 _UTSR1 (3) /* Ser. port 3 UART Status Reg. 1 */
299
300/* Those are still used in some places */
301#define _Ser1UTCR0 __PREG(Ser1UTCR0)
302#define _Ser2UTCR0 __PREG(Ser2UTCR0)
303#define _Ser3UTCR0 __PREG(Ser3UTCR0)
304
305/* Register offsets */
306#define UTCR0 0x00
307#define UTCR1 0x04
308#define UTCR2 0x08
309#define UTCR3 0x0c
310#define UTDR 0x14
311#define UTSR0 0x1c
312#define UTSR1 0x20
313
314#define UTCR0_PE 0x00000001 /* Parity Enable */
315#define UTCR0_OES 0x00000002 /* Odd/Even parity Select */
316#define UTCR0_OddPar (UTCR0_OES*0) /* Odd Parity */
317#define UTCR0_EvenPar (UTCR0_OES*1) /* Even Parity */
318#define UTCR0_SBS 0x00000004 /* Stop Bit Select */
319#define UTCR0_1StpBit (UTCR0_SBS*0) /* 1 Stop Bit per frame */
320#define UTCR0_2StpBit (UTCR0_SBS*1) /* 2 Stop Bits per frame */
321#define UTCR0_DSS 0x00000008 /* Data Size Select */
322#define UTCR0_7BitData (UTCR0_DSS*0) /* 7-Bit Data */
323#define UTCR0_8BitData (UTCR0_DSS*1) /* 8-Bit Data */
324#define UTCR0_SCE 0x00000010 /* Sample Clock Enable */
325 /* (ser. port 1: GPIO [18], */
326 /* ser. port 3: GPIO [20]) */
327#define UTCR0_RCE 0x00000020 /* Receive Clock Edge select */
328#define UTCR0_RcRsEdg (UTCR0_RCE*0) /* Receive clock Rising-Edge */
329#define UTCR0_RcFlEdg (UTCR0_RCE*1) /* Receive clock Falling-Edge */
330#define UTCR0_TCE 0x00000040 /* Transmit Clock Edge select */
331#define UTCR0_TrRsEdg (UTCR0_TCE*0) /* Transmit clock Rising-Edge */
332#define UTCR0_TrFlEdg (UTCR0_TCE*1) /* Transmit clock Falling-Edge */
333#define UTCR0_Ser2IrDA /* Ser. port 2 IrDA settings */ \
334 (UTCR0_1StpBit + UTCR0_8BitData)
335
336#define UTCR1_BRD Fld (4, 0) /* Baud Rate Divisor/16 - 1 [11:8] */
337#define UTCR2_BRD Fld (8, 0) /* Baud Rate Divisor/16 - 1 [7:0] */
338 /* fua = fxtl/(16*(BRD[11:0] + 1)) */
339 /* Tua = 16*(BRD [11:0] + 1)*Txtl */
340#define UTCR1_BdRtDiv(Div) /* Baud Rate Divisor [16..65536] */ \
341 (((Div) - 16)/16 >> FSize (UTCR2_BRD) << \
342 FShft (UTCR1_BRD))
343#define UTCR2_BdRtDiv(Div) /* Baud Rate Divisor [16..65536] */ \
344 (((Div) - 16)/16 & FAlnMsk (UTCR2_BRD) << \
345 FShft (UTCR2_BRD))
346 /* fua = fxtl/(16*Floor (Div/16)) */
347 /* Tua = 16*Floor (Div/16)*Txtl */
348#define UTCR1_CeilBdRtDiv(Div) /* Ceil. of BdRtDiv [16..65536] */ \
349 (((Div) - 1)/16 >> FSize (UTCR2_BRD) << \
350 FShft (UTCR1_BRD))
351#define UTCR2_CeilBdRtDiv(Div) /* Ceil. of BdRtDiv [16..65536] */ \
352 (((Div) - 1)/16 & FAlnMsk (UTCR2_BRD) << \
353 FShft (UTCR2_BRD))
354 /* fua = fxtl/(16*Ceil (Div/16)) */
355 /* Tua = 16*Ceil (Div/16)*Txtl */
356
357#define UTCR3_RXE 0x00000001 /* Receive Enable */
358#define UTCR3_TXE 0x00000002 /* Transmit Enable */
359#define UTCR3_BRK 0x00000004 /* BReaK mode */
360#define UTCR3_RIE 0x00000008 /* Receive FIFO 1/3-to-2/3-full or */
361 /* more Interrupt Enable */
362#define UTCR3_TIE 0x00000010 /* Transmit FIFO 1/2-full or less */
363 /* Interrupt Enable */
364#define UTCR3_LBM 0x00000020 /* Look-Back Mode */
365#define UTCR3_Ser2IrDA /* Ser. port 2 IrDA settings (RIE, */ \
366 /* TIE, LBM can be set or cleared) */ \
367 (UTCR3_RXE + UTCR3_TXE)
368
369#define UTCR4_HSE 0x00000001 /* Hewlett-Packard Serial InfraRed */
370 /* (HP-SIR) modulation Enable */
371#define UTCR4_NRZ (UTCR4_HSE*0) /* Non-Return to Zero modulation */
372#define UTCR4_HPSIR (UTCR4_HSE*1) /* HP-SIR modulation */
373#define UTCR4_LPM 0x00000002 /* Low-Power Mode */
374#define UTCR4_Z3_16Bit (UTCR4_LPM*0) /* Zero pulse = 3/16 Bit time */
375#define UTCR4_Z1_6us (UTCR4_LPM*1) /* Zero pulse = 1.6 us */
376
377#define UTDR_DATA Fld (8, 0) /* receive/transmit DATA FIFOs */
378#if 0 /* Hidden receive FIFO bits */
379#define UTDR_PRE 0x00000100 /* receive PaRity Error (read) */
380#define UTDR_FRE 0x00000200 /* receive FRaming Error (read) */
381#define UTDR_ROR 0x00000400 /* Receive FIFO Over-Run (read) */
382#endif /* 0 */
383
384#define UTSR0_TFS 0x00000001 /* Transmit FIFO 1/2-full or less */
385 /* Service request (read) */
386#define UTSR0_RFS 0x00000002 /* Receive FIFO 1/3-to-2/3-full or */
387 /* more Service request (read) */
388#define UTSR0_RID 0x00000004 /* Receiver IDle */
389#define UTSR0_RBB 0x00000008 /* Receive Beginning of Break */
390#define UTSR0_REB 0x00000010 /* Receive End of Break */
391#define UTSR0_EIF 0x00000020 /* Error In FIFO (read) */
392
393#define UTSR1_TBY 0x00000001 /* Transmitter BusY (read) */
394#define UTSR1_RNE 0x00000002 /* Receive FIFO Not Empty (read) */
395#define UTSR1_TNF 0x00000004 /* Transmit FIFO Not Full (read) */
396#define UTSR1_PRE 0x00000008 /* receive PaRity Error (read) */
397#define UTSR1_FRE 0x00000010 /* receive FRaming Error (read) */
398#define UTSR1_ROR 0x00000020 /* Receive FIFO Over-Run (read) */
399
400
401/*
402 * Synchronous Data Link Controller (SDLC) control registers
403 *
404 * Registers
405 * Ser1SDCR0 Serial port 1 Synchronous Data Link Controller (SDLC)
406 * Control Register 0 (read/write).
407 * Ser1SDCR1 Serial port 1 Synchronous Data Link Controller (SDLC)
408 * Control Register 1 (read/write).
409 * Ser1SDCR2 Serial port 1 Synchronous Data Link Controller (SDLC)
410 * Control Register 2 (read/write).
411 * Ser1SDCR3 Serial port 1 Synchronous Data Link Controller (SDLC)
412 * Control Register 3 (read/write).
413 * Ser1SDCR4 Serial port 1 Synchronous Data Link Controller (SDLC)
414 * Control Register 4 (read/write).
415 * Ser1SDDR Serial port 1 Synchronous Data Link Controller (SDLC)
416 * Data Register (read/write).
417 * Ser1SDSR0 Serial port 1 Synchronous Data Link Controller (SDLC)
418 * Status Register 0 (read/write).
419 * Ser1SDSR1 Serial port 1 Synchronous Data Link Controller (SDLC)
420 * Status Register 1 (read/write).
421 *
422 * Clocks
423 * fxtl, Txtl Frequency, period of the system crystal (3.6864 MHz
424 * or 3.5795 MHz).
425 * fsd, Tsd Frequency, period of the SDLC communication.
426 */
427
428#define Ser1SDCR0 __REG(0x80020060) /* Ser. port 1 SDLC Control Reg. 0 */
429#define Ser1SDCR1 __REG(0x80020064) /* Ser. port 1 SDLC Control Reg. 1 */
430#define Ser1SDCR2 __REG(0x80020068) /* Ser. port 1 SDLC Control Reg. 2 */
431#define Ser1SDCR3 __REG(0x8002006C) /* Ser. port 1 SDLC Control Reg. 3 */
432#define Ser1SDCR4 __REG(0x80020070) /* Ser. port 1 SDLC Control Reg. 4 */
433#define Ser1SDDR __REG(0x80020078) /* Ser. port 1 SDLC Data Reg. */
434#define Ser1SDSR0 __REG(0x80020080) /* Ser. port 1 SDLC Status Reg. 0 */
435#define Ser1SDSR1 __REG(0x80020084) /* Ser. port 1 SDLC Status Reg. 1 */
436
437#define SDCR0_SUS 0x00000001 /* SDLC/UART Select */
438#define SDCR0_SDLC (SDCR0_SUS*0) /* SDLC mode (TXD1 & RXD1) */
439#define SDCR0_UART (SDCR0_SUS*1) /* UART mode (TXD1 & RXD1) */
440#define SDCR0_SDF 0x00000002 /* Single/Double start Flag select */
441#define SDCR0_SglFlg (SDCR0_SDF*0) /* Single start Flag */
442#define SDCR0_DblFlg (SDCR0_SDF*1) /* Double start Flag */
443#define SDCR0_LBM 0x00000004 /* Look-Back Mode */
444#define SDCR0_BMS 0x00000008 /* Bit Modulation Select */
445#define SDCR0_FM0 (SDCR0_BMS*0) /* Freq. Modulation zero (0) */
446#define SDCR0_NRZ (SDCR0_BMS*1) /* Non-Return to Zero modulation */
447#define SDCR0_SCE 0x00000010 /* Sample Clock Enable (GPIO [16]) */
448#define SDCR0_SCD 0x00000020 /* Sample Clock Direction select */
449 /* (GPIO [16]) */
450#define SDCR0_SClkIn (SDCR0_SCD*0) /* Sample Clock Input */
451#define SDCR0_SClkOut (SDCR0_SCD*1) /* Sample Clock Output */
452#define SDCR0_RCE 0x00000040 /* Receive Clock Edge select */
453#define SDCR0_RcRsEdg (SDCR0_RCE*0) /* Receive clock Rising-Edge */
454#define SDCR0_RcFlEdg (SDCR0_RCE*1) /* Receive clock Falling-Edge */
455#define SDCR0_TCE 0x00000080 /* Transmit Clock Edge select */
456#define SDCR0_TrRsEdg (SDCR0_TCE*0) /* Transmit clock Rising-Edge */
457#define SDCR0_TrFlEdg (SDCR0_TCE*1) /* Transmit clock Falling-Edge */
458
459#define SDCR1_AAF 0x00000001 /* Abort After Frame enable */
460 /* (GPIO [17]) */
461#define SDCR1_TXE 0x00000002 /* Transmit Enable */
462#define SDCR1_RXE 0x00000004 /* Receive Enable */
463#define SDCR1_RIE 0x00000008 /* Receive FIFO 1/3-to-2/3-full or */
464 /* more Interrupt Enable */
465#define SDCR1_TIE 0x00000010 /* Transmit FIFO 1/2-full or less */
466 /* Interrupt Enable */
467#define SDCR1_AME 0x00000020 /* Address Match Enable */
468#define SDCR1_TUS 0x00000040 /* Transmit FIFO Under-run Select */
469#define SDCR1_EFrmURn (SDCR1_TUS*0) /* End Frame on Under-Run */
470#define SDCR1_AbortURn (SDCR1_TUS*1) /* Abort on Under-Run */
471#define SDCR1_RAE 0x00000080 /* Receive Abort interrupt Enable */
472
473#define SDCR2_AMV Fld (8, 0) /* Address Match Value */
474
475#define SDCR3_BRD Fld (4, 0) /* Baud Rate Divisor/16 - 1 [11:8] */
476#define SDCR4_BRD Fld (8, 0) /* Baud Rate Divisor/16 - 1 [7:0] */
477 /* fsd = fxtl/(16*(BRD[11:0] + 1)) */
478 /* Tsd = 16*(BRD[11:0] + 1)*Txtl */
479#define SDCR3_BdRtDiv(Div) /* Baud Rate Divisor [16..65536] */ \
480 (((Div) - 16)/16 >> FSize (SDCR4_BRD) << \
481 FShft (SDCR3_BRD))
482#define SDCR4_BdRtDiv(Div) /* Baud Rate Divisor [16..65536] */ \
483 (((Div) - 16)/16 & FAlnMsk (SDCR4_BRD) << \
484 FShft (SDCR4_BRD))
485 /* fsd = fxtl/(16*Floor (Div/16)) */
486 /* Tsd = 16*Floor (Div/16)*Txtl */
487#define SDCR3_CeilBdRtDiv(Div) /* Ceil. of BdRtDiv [16..65536] */ \
488 (((Div) - 1)/16 >> FSize (SDCR4_BRD) << \
489 FShft (SDCR3_BRD))
490#define SDCR4_CeilBdRtDiv(Div) /* Ceil. of BdRtDiv [16..65536] */ \
491 (((Div) - 1)/16 & FAlnMsk (SDCR4_BRD) << \
492 FShft (SDCR4_BRD))
493 /* fsd = fxtl/(16*Ceil (Div/16)) */
494 /* Tsd = 16*Ceil (Div/16)*Txtl */
495
496#define SDDR_DATA Fld (8, 0) /* receive/transmit DATA FIFOs */
497#if 0 /* Hidden receive FIFO bits */
498#define SDDR_EOF 0x00000100 /* receive End-Of-Frame (read) */
499#define SDDR_CRE 0x00000200 /* receive CRC Error (read) */
500#define SDDR_ROR 0x00000400 /* Receive FIFO Over-Run (read) */
501#endif /* 0 */
502
503#define SDSR0_EIF 0x00000001 /* Error In FIFO (read) */
504#define SDSR0_TUR 0x00000002 /* Transmit FIFO Under-Run */
505#define SDSR0_RAB 0x00000004 /* Receive ABort */
506#define SDSR0_TFS 0x00000008 /* Transmit FIFO 1/2-full or less */
507 /* Service request (read) */
508#define SDSR0_RFS 0x00000010 /* Receive FIFO 1/3-to-2/3-full or */
509 /* more Service request (read) */
510
511#define SDSR1_RSY 0x00000001 /* Receiver SYnchronized (read) */
512#define SDSR1_TBY 0x00000002 /* Transmitter BusY (read) */
513#define SDSR1_RNE 0x00000004 /* Receive FIFO Not Empty (read) */
514#define SDSR1_TNF 0x00000008 /* Transmit FIFO Not Full (read) */
515#define SDSR1_RTD 0x00000010 /* Receive Transition Detected */
516#define SDSR1_EOF 0x00000020 /* receive End-Of-Frame (read) */
517#define SDSR1_CRE 0x00000040 /* receive CRC Error (read) */
518#define SDSR1_ROR 0x00000080 /* Receive FIFO Over-Run (read) */
519
520
521/*
522 * High-Speed Serial to Parallel controller (HSSP) control registers
523 *
524 * Registers
525 * Ser2HSCR0 Serial port 2 High-Speed Serial to Parallel
526 * controller (HSSP) Control Register 0 (read/write).
527 * Ser2HSCR1 Serial port 2 High-Speed Serial to Parallel
528 * controller (HSSP) Control Register 1 (read/write).
529 * Ser2HSDR Serial port 2 High-Speed Serial to Parallel
530 * controller (HSSP) Data Register (read/write).
531 * Ser2HSSR0 Serial port 2 High-Speed Serial to Parallel
532 * controller (HSSP) Status Register 0 (read/write).
533 * Ser2HSSR1 Serial port 2 High-Speed Serial to Parallel
534 * controller (HSSP) Status Register 1 (read).
535 * Ser2HSCR2 Serial port 2 High-Speed Serial to Parallel
536 * controller (HSSP) Control Register 2 (read/write).
537 * [The HSCR2 register is only implemented in
538 * versions 2.0 (rev. = 8) and higher of the StrongARM
539 * SA-1100.]
540 */
541
542#define Ser2HSCR0 __REG(0x80040060) /* Ser. port 2 HSSP Control Reg. 0 */
543#define Ser2HSCR1 __REG(0x80040064) /* Ser. port 2 HSSP Control Reg. 1 */
544#define Ser2HSDR __REG(0x8004006C) /* Ser. port 2 HSSP Data Reg. */
545#define Ser2HSSR0 __REG(0x80040074) /* Ser. port 2 HSSP Status Reg. 0 */
546#define Ser2HSSR1 __REG(0x80040078) /* Ser. port 2 HSSP Status Reg. 1 */
547#define Ser2HSCR2 __REG(0x90060028) /* Ser. port 2 HSSP Control Reg. 2 */
548
549#define HSCR0_ITR 0x00000001 /* IrDA Transmission Rate */
550#define HSCR0_UART (HSCR0_ITR*0) /* UART mode (115.2 kb/s if IrDA) */
551#define HSCR0_HSSP (HSCR0_ITR*1) /* HSSP mode (4 Mb/s) */
552#define HSCR0_LBM 0x00000002 /* Look-Back Mode */
553#define HSCR0_TUS 0x00000004 /* Transmit FIFO Under-run Select */
554#define HSCR0_EFrmURn (HSCR0_TUS*0) /* End Frame on Under-Run */
555#define HSCR0_AbortURn (HSCR0_TUS*1) /* Abort on Under-Run */
556#define HSCR0_TXE 0x00000008 /* Transmit Enable */
557#define HSCR0_RXE 0x00000010 /* Receive Enable */
558#define HSCR0_RIE 0x00000020 /* Receive FIFO 2/5-to-3/5-full or */
559 /* more Interrupt Enable */
560#define HSCR0_TIE 0x00000040 /* Transmit FIFO 1/2-full or less */
561 /* Interrupt Enable */
562#define HSCR0_AME 0x00000080 /* Address Match Enable */
563
564#define HSCR1_AMV Fld (8, 0) /* Address Match Value */
565
566#define HSDR_DATA Fld (8, 0) /* receive/transmit DATA FIFOs */
567#if 0 /* Hidden receive FIFO bits */
568#define HSDR_EOF 0x00000100 /* receive End-Of-Frame (read) */
569#define HSDR_CRE 0x00000200 /* receive CRC Error (read) */
570#define HSDR_ROR 0x00000400 /* Receive FIFO Over-Run (read) */
571#endif /* 0 */
572
573#define HSSR0_EIF 0x00000001 /* Error In FIFO (read) */
574#define HSSR0_TUR 0x00000002 /* Transmit FIFO Under-Run */
575#define HSSR0_RAB 0x00000004 /* Receive ABort */
576#define HSSR0_TFS 0x00000008 /* Transmit FIFO 1/2-full or less */
577 /* Service request (read) */
578#define HSSR0_RFS 0x00000010 /* Receive FIFO 2/5-to-3/5-full or */
579 /* more Service request (read) */
580#define HSSR0_FRE 0x00000020 /* receive FRaming Error */
581
582#define HSSR1_RSY 0x00000001 /* Receiver SYnchronized (read) */
583#define HSSR1_TBY 0x00000002 /* Transmitter BusY (read) */
584#define HSSR1_RNE 0x00000004 /* Receive FIFO Not Empty (read) */
585#define HSSR1_TNF 0x00000008 /* Transmit FIFO Not Full (read) */
586#define HSSR1_EOF 0x00000010 /* receive End-Of-Frame (read) */
587#define HSSR1_CRE 0x00000020 /* receive CRC Error (read) */
588#define HSSR1_ROR 0x00000040 /* Receive FIFO Over-Run (read) */
589
590#define HSCR2_TXP 0x00040000 /* Transmit data Polarity (TXD_2) */
591#define HSCR2_TrDataL (HSCR2_TXP*0) /* Transmit Data active Low */
592 /* (inverted) */
593#define HSCR2_TrDataH (HSCR2_TXP*1) /* Transmit Data active High */
594 /* (non-inverted) */
595#define HSCR2_RXP 0x00080000 /* Receive data Polarity (RXD_2) */
596#define HSCR2_RcDataL (HSCR2_RXP*0) /* Receive Data active Low */
597 /* (inverted) */
598#define HSCR2_RcDataH (HSCR2_RXP*1) /* Receive Data active High */
599 /* (non-inverted) */
600
601
602/*
603 * Multi-media Communications Port (MCP) control registers
604 *
605 * Registers
606 * Ser4MCCR0 Serial port 4 Multi-media Communications Port (MCP)
607 * Control Register 0 (read/write).
608 * Ser4MCDR0 Serial port 4 Multi-media Communications Port (MCP)
609 * Data Register 0 (audio, read/write).
610 * Ser4MCDR1 Serial port 4 Multi-media Communications Port (MCP)
611 * Data Register 1 (telecom, read/write).
612 * Ser4MCDR2 Serial port 4 Multi-media Communications Port (MCP)
613 * Data Register 2 (CODEC registers, read/write).
614 * Ser4MCSR Serial port 4 Multi-media Communications Port (MCP)
615 * Status Register (read/write).
616 * Ser4MCCR1 Serial port 4 Multi-media Communications Port (MCP)
617 * Control Register 1 (read/write).
618 * [The MCCR1 register is only implemented in
619 * versions 2.0 (rev. = 8) and higher of the StrongARM
620 * SA-1100.]
621 *
622 * Clocks
623 * fmc, Tmc Frequency, period of the MCP communication (10 MHz,
624 * 12 MHz, or GPIO [21]).
625 * faud, Taud Frequency, period of the audio sampling.
626 * ftcm, Ttcm Frequency, period of the telecom sampling.
627 */
628
629#define Ser4MCCR0 __REG(0x80060000) /* Ser. port 4 MCP Control Reg. 0 */
630#define Ser4MCDR0 __REG(0x80060008) /* Ser. port 4 MCP Data Reg. 0 (audio) */
631#define Ser4MCDR1 __REG(0x8006000C) /* Ser. port 4 MCP Data Reg. 1 (telecom) */
632#define Ser4MCDR2 __REG(0x80060010) /* Ser. port 4 MCP Data Reg. 2 (CODEC reg.) */
633#define Ser4MCSR __REG(0x80060018) /* Ser. port 4 MCP Status Reg. */
634#define Ser4MCCR1 __REG(0x90060030) /* Ser. port 4 MCP Control Reg. 1 */
635
636#define MCCR0_ASD Fld (7, 0) /* Audio Sampling rate Divisor/32 */
637 /* [6..127] */
638 /* faud = fmc/(32*ASD) */
639 /* Taud = 32*ASD*Tmc */
640#define MCCR0_AudSmpDiv(Div) /* Audio Sampling rate Divisor */ \
641 /* [192..4064] */ \
642 ((Div)/32 << FShft (MCCR0_ASD))
643 /* faud = fmc/(32*Floor (Div/32)) */
644 /* Taud = 32*Floor (Div/32)*Tmc */
645#define MCCR0_CeilAudSmpDiv(Div) /* Ceil. of AudSmpDiv [192..4064] */ \
646 (((Div) + 31)/32 << FShft (MCCR0_ASD))
647 /* faud = fmc/(32*Ceil (Div/32)) */
648 /* Taud = 32*Ceil (Div/32)*Tmc */
649#define MCCR0_TSD Fld (7, 8) /* Telecom Sampling rate */
650 /* Divisor/32 [16..127] */
651 /* ftcm = fmc/(32*TSD) */
652 /* Ttcm = 32*TSD*Tmc */
653#define MCCR0_TcmSmpDiv(Div) /* Telecom Sampling rate Divisor */ \
654 /* [512..4064] */ \
655 ((Div)/32 << FShft (MCCR0_TSD))
656 /* ftcm = fmc/(32*Floor (Div/32)) */
657 /* Ttcm = 32*Floor (Div/32)*Tmc */
658#define MCCR0_CeilTcmSmpDiv(Div) /* Ceil. of TcmSmpDiv [512..4064] */ \
659 (((Div) + 31)/32 << FShft (MCCR0_TSD))
660 /* ftcm = fmc/(32*Ceil (Div/32)) */
661 /* Ttcm = 32*Ceil (Div/32)*Tmc */
662#define MCCR0_MCE 0x00010000 /* MCP Enable */
663#define MCCR0_ECS 0x00020000 /* External Clock Select */
664#define MCCR0_IntClk (MCCR0_ECS*0) /* Internal Clock (10 or 12 MHz) */
665#define MCCR0_ExtClk (MCCR0_ECS*1) /* External Clock (GPIO [21]) */
666#define MCCR0_ADM 0x00040000 /* A/D (audio/telecom) data */
667 /* sampling/storing Mode */
668#define MCCR0_VldBit (MCCR0_ADM*0) /* Valid Bit storing mode */
669#define MCCR0_SmpCnt (MCCR0_ADM*1) /* Sampling Counter storing mode */
670#define MCCR0_TTE 0x00080000 /* Telecom Transmit FIFO 1/2-full */
671 /* or less interrupt Enable */
672#define MCCR0_TRE 0x00100000 /* Telecom Receive FIFO 1/2-full */
673 /* or more interrupt Enable */
674#define MCCR0_ATE 0x00200000 /* Audio Transmit FIFO 1/2-full */
675 /* or less interrupt Enable */
676#define MCCR0_ARE 0x00400000 /* Audio Receive FIFO 1/2-full or */
677 /* more interrupt Enable */
678#define MCCR0_LBM 0x00800000 /* Look-Back Mode */
679#define MCCR0_ECP Fld (2, 24) /* External Clock Prescaler - 1 */
680#define MCCR0_ExtClkDiv(Div) /* External Clock Divisor [1..4] */ \
681 (((Div) - 1) << FShft (MCCR0_ECP))
682
683#define MCDR0_DATA Fld (12, 4) /* receive/transmit audio DATA */
684 /* FIFOs */
685
686#define MCDR1_DATA Fld (14, 2) /* receive/transmit telecom DATA */
687 /* FIFOs */
688
689 /* receive/transmit CODEC reg. */
690 /* FIFOs: */
691#define MCDR2_DATA Fld (16, 0) /* reg. DATA */
692#define MCDR2_RW 0x00010000 /* reg. Read/Write (transmit) */
693#define MCDR2_Rd (MCDR2_RW*0) /* reg. Read */
694#define MCDR2_Wr (MCDR2_RW*1) /* reg. Write */
695#define MCDR2_ADD Fld (4, 17) /* reg. ADDress */
696
697#define MCSR_ATS 0x00000001 /* Audio Transmit FIFO 1/2-full */
698 /* or less Service request (read) */
699#define MCSR_ARS 0x00000002 /* Audio Receive FIFO 1/2-full or */
700 /* more Service request (read) */
701#define MCSR_TTS 0x00000004 /* Telecom Transmit FIFO 1/2-full */
702 /* or less Service request (read) */
703#define MCSR_TRS 0x00000008 /* Telecom Receive FIFO 1/2-full */
704 /* or more Service request (read) */
705#define MCSR_ATU 0x00000010 /* Audio Transmit FIFO Under-run */
706#define MCSR_ARO 0x00000020 /* Audio Receive FIFO Over-run */
707#define MCSR_TTU 0x00000040 /* Telecom Transmit FIFO Under-run */
708#define MCSR_TRO 0x00000080 /* Telecom Receive FIFO Over-run */
709#define MCSR_ANF 0x00000100 /* Audio transmit FIFO Not Full */
710 /* (read) */
711#define MCSR_ANE 0x00000200 /* Audio receive FIFO Not Empty */
712 /* (read) */
713#define MCSR_TNF 0x00000400 /* Telecom transmit FIFO Not Full */
714 /* (read) */
715#define MCSR_TNE 0x00000800 /* Telecom receive FIFO Not Empty */
716 /* (read) */
717#define MCSR_CWC 0x00001000 /* CODEC register Write Completed */
718 /* (read) */
719#define MCSR_CRC 0x00002000 /* CODEC register Read Completed */
720 /* (read) */
721#define MCSR_ACE 0x00004000 /* Audio CODEC Enabled (read) */
722#define MCSR_TCE 0x00008000 /* Telecom CODEC Enabled (read) */
723
724#define MCCR1_CFS 0x00100000 /* Clock Freq. Select */
725#define MCCR1_F12MHz (MCCR1_CFS*0) /* Freq. (fmc) = ~ 12 MHz */
726 /* (11.981 MHz) */
727#define MCCR1_F10MHz (MCCR1_CFS*1) /* Freq. (fmc) = ~ 10 MHz */
728 /* (9.585 MHz) */
729
730
731/*
732 * Synchronous Serial Port (SSP) control registers
733 *
734 * Registers
735 * Ser4SSCR0 Serial port 4 Synchronous Serial Port (SSP) Control
736 * Register 0 (read/write).
737 * Ser4SSCR1 Serial port 4 Synchronous Serial Port (SSP) Control
738 * Register 1 (read/write).
739 * [Bits SPO and SP are only implemented in versions 2.0
740 * (rev. = 8) and higher of the StrongARM SA-1100.]
741 * Ser4SSDR Serial port 4 Synchronous Serial Port (SSP) Data
742 * Register (read/write).
743 * Ser4SSSR Serial port 4 Synchronous Serial Port (SSP) Status
744 * Register (read/write).
745 *
746 * Clocks
747 * fxtl, Txtl Frequency, period of the system crystal (3.6864 MHz
748 * or 3.5795 MHz).
749 * fss, Tss Frequency, period of the SSP communication.
750 */
751
752#define Ser4SSCR0 __REG(0x80070060) /* Ser. port 4 SSP Control Reg. 0 */
753#define Ser4SSCR1 __REG(0x80070064) /* Ser. port 4 SSP Control Reg. 1 */
754#define Ser4SSDR __REG(0x8007006C) /* Ser. port 4 SSP Data Reg. */
755#define Ser4SSSR __REG(0x80070074) /* Ser. port 4 SSP Status Reg. */
756
757#define SSCR0_DSS Fld (4, 0) /* Data Size - 1 Select [3..15] */
758#define SSCR0_DataSize(Size) /* Data Size Select [4..16] */ \
759 (((Size) - 1) << FShft (SSCR0_DSS))
760#define SSCR0_FRF Fld (2, 4) /* FRame Format */
761#define SSCR0_Motorola /* Motorola Serial Peripheral */ \
762 /* Interface (SPI) format */ \
763 (0 << FShft (SSCR0_FRF))
764#define SSCR0_TI /* Texas Instruments Synchronous */ \
765 /* Serial format */ \
766 (1 << FShft (SSCR0_FRF))
767#define SSCR0_National /* National Microwire format */ \
768 (2 << FShft (SSCR0_FRF))
769#define SSCR0_SSE 0x00000080 /* SSP Enable */
770#define SSCR0_SCR Fld (8, 8) /* Serial Clock Rate divisor/2 - 1 */
771 /* fss = fxtl/(2*(SCR + 1)) */
772 /* Tss = 2*(SCR + 1)*Txtl */
773#define SSCR0_SerClkDiv(Div) /* Serial Clock Divisor [2..512] */ \
774 (((Div) - 2)/2 << FShft (SSCR0_SCR))
775 /* fss = fxtl/(2*Floor (Div/2)) */
776 /* Tss = 2*Floor (Div/2)*Txtl */
777#define SSCR0_CeilSerClkDiv(Div) /* Ceil. of SerClkDiv [2..512] */ \
778 (((Div) - 1)/2 << FShft (SSCR0_SCR))
779 /* fss = fxtl/(2*Ceil (Div/2)) */
780 /* Tss = 2*Ceil (Div/2)*Txtl */
781
782#define SSCR1_RIE 0x00000001 /* Receive FIFO 1/2-full or more */
783 /* Interrupt Enable */
784#define SSCR1_TIE 0x00000002 /* Transmit FIFO 1/2-full or less */
785 /* Interrupt Enable */
786#define SSCR1_LBM 0x00000004 /* Look-Back Mode */
787#define SSCR1_SPO 0x00000008 /* Sample clock (SCLK) POlarity */
788#define SSCR1_SClkIactL (SSCR1_SPO*0) /* Sample Clock Inactive Low */
789#define SSCR1_SClkIactH (SSCR1_SPO*1) /* Sample Clock Inactive High */
790#define SSCR1_SP 0x00000010 /* Sample clock (SCLK) Phase */
791#define SSCR1_SClk1P (SSCR1_SP*0) /* Sample Clock active 1 Period */
792 /* after frame (SFRM, 1st edge) */
793#define SSCR1_SClk1_2P (SSCR1_SP*1) /* Sample Clock active 1/2 Period */
794 /* after frame (SFRM, 1st edge) */
795#define SSCR1_ECS 0x00000020 /* External Clock Select */
796#define SSCR1_IntClk (SSCR1_ECS*0) /* Internal Clock */
797#define SSCR1_ExtClk (SSCR1_ECS*1) /* External Clock (GPIO [19]) */
798
799#define SSDR_DATA Fld (16, 0) /* receive/transmit DATA FIFOs */
800
801#define SSSR_TNF 0x00000002 /* Transmit FIFO Not Full (read) */
802#define SSSR_RNE 0x00000004 /* Receive FIFO Not Empty (read) */
803#define SSSR_BSY 0x00000008 /* SSP BuSY (read) */
804#define SSSR_TFS 0x00000010 /* Transmit FIFO 1/2-full or less */
805 /* Service request (read) */
806#define SSSR_RFS 0x00000020 /* Receive FIFO 1/2-full or more */
807 /* Service request (read) */
808#define SSSR_ROR 0x00000040 /* Receive FIFO Over-Run */
809
810
811/*
812 * Operating System (OS) timer control registers
813 *
814 * Registers
815 * OSMR0 Operating System (OS) timer Match Register 0
816 * (read/write).
817 * OSMR1 Operating System (OS) timer Match Register 1
818 * (read/write).
819 * OSMR2 Operating System (OS) timer Match Register 2
820 * (read/write).
821 * OSMR3 Operating System (OS) timer Match Register 3
822 * (read/write).
823 * OSCR Operating System (OS) timer Counter Register
824 * (read/write).
825 * OSSR Operating System (OS) timer Status Register
826 * (read/write).
827 * OWER Operating System (OS) timer Watch-dog Enable Register
828 * (read/write).
829 * OIER Operating System (OS) timer Interrupt Enable Register
830 * (read/write).
831 */
832
833#define OSMR0 __REG(0x90000000) /* OS timer Match Reg. 0 */
834#define OSMR1 __REG(0x90000004) /* OS timer Match Reg. 1 */
835#define OSMR2 __REG(0x90000008) /* OS timer Match Reg. 2 */
836#define OSMR3 __REG(0x9000000c) /* OS timer Match Reg. 3 */
837#define OSCR __REG(0x90000010) /* OS timer Counter Reg. */
838#define OSSR __REG(0x90000014 ) /* OS timer Status Reg. */
839#define OWER __REG(0x90000018 ) /* OS timer Watch-dog Enable Reg. */
840#define OIER __REG(0x9000001C ) /* OS timer Interrupt Enable Reg. */
841
842#define OSSR_M(Nb) /* Match detected [0..3] */ \
843 (0x00000001 << (Nb))
844#define OSSR_M0 OSSR_M (0) /* Match detected 0 */
845#define OSSR_M1 OSSR_M (1) /* Match detected 1 */
846#define OSSR_M2 OSSR_M (2) /* Match detected 2 */
847#define OSSR_M3 OSSR_M (3) /* Match detected 3 */
848
849#define OWER_WME 0x00000001 /* Watch-dog Match Enable */
850 /* (set only) */
851
852#define OIER_E(Nb) /* match interrupt Enable [0..3] */ \
853 (0x00000001 << (Nb))
854#define OIER_E0 OIER_E (0) /* match interrupt Enable 0 */
855#define OIER_E1 OIER_E (1) /* match interrupt Enable 1 */
856#define OIER_E2 OIER_E (2) /* match interrupt Enable 2 */
857#define OIER_E3 OIER_E (3) /* match interrupt Enable 3 */
858
859
860/*
861 * Real-Time Clock (RTC) control registers
862 *
863 * Registers
864 * RTAR Real-Time Clock (RTC) Alarm Register (read/write).
865 * RCNR Real-Time Clock (RTC) CouNt Register (read/write).
866 * RTTR Real-Time Clock (RTC) Trim Register (read/write).
867 * RTSR Real-Time Clock (RTC) Status Register (read/write).
868 *
869 * Clocks
870 * frtx, Trtx Frequency, period of the real-time clock crystal
871 * (32.768 kHz nominal).
872 * frtc, Trtc Frequency, period of the real-time clock counter
873 * (1 Hz nominal).
874 */
875
876#define RTAR __REG(0x90010000) /* RTC Alarm Reg. */
877#define RCNR __REG(0x90010004) /* RTC CouNt Reg. */
878#define RTTR __REG(0x90010008) /* RTC Trim Reg. */
879#define RTSR __REG(0x90010010) /* RTC Status Reg. */
880
881#define RTTR_C Fld (16, 0) /* clock divider Count - 1 */
882#define RTTR_D Fld (10, 16) /* trim Delete count */
883 /* frtc = (1023*(C + 1) - D)*frtx/ */
884 /* (1023*(C + 1)^2) */
885 /* Trtc = (1023*(C + 1)^2)*Trtx/ */
886 /* (1023*(C + 1) - D) */
887
888#define RTSR_AL 0x00000001 /* ALarm detected */
889#define RTSR_HZ 0x00000002 /* 1 Hz clock detected */
890#define RTSR_ALE 0x00000004 /* ALarm interrupt Enable */
891#define RTSR_HZE 0x00000008 /* 1 Hz clock interrupt Enable */
892
893
894/*
895 * Power Manager (PM) control registers
896 *
897 * Registers
898 * PMCR Power Manager (PM) Control Register (read/write).
899 * PSSR Power Manager (PM) Sleep Status Register (read/write).
900 * PSPR Power Manager (PM) Scratch-Pad Register (read/write).
901 * PWER Power Manager (PM) Wake-up Enable Register
902 * (read/write).
903 * PCFR Power Manager (PM) general ConFiguration Register
904 * (read/write).
905 * PPCR Power Manager (PM) Phase-Locked Loop (PLL)
906 * Configuration Register (read/write).
907 * PGSR Power Manager (PM) General-Purpose Input/Output (GPIO)
908 * Sleep state Register (read/write, see GPIO pins).
909 * POSR Power Manager (PM) Oscillator Status Register (read).
910 *
911 * Clocks
912 * fxtl, Txtl Frequency, period of the system crystal (3.6864 MHz
913 * or 3.5795 MHz).
914 * fcpu, Tcpu Frequency, period of the CPU core clock (CCLK).
915 */
916
917#define PMCR __REG(0x90020000) /* PM Control Reg. */
918#define PSSR __REG(0x90020004) /* PM Sleep Status Reg. */
919#define PSPR __REG(0x90020008) /* PM Scratch-Pad Reg. */
920#define PWER __REG(0x9002000C) /* PM Wake-up Enable Reg. */
921#define PCFR __REG(0x90020010) /* PM general ConFiguration Reg. */
922#define PPCR __REG(0x90020014) /* PM PLL Configuration Reg. */
923#define PGSR __REG(0x90020018) /* PM GPIO Sleep state Reg. */
924#define POSR __REG(0x9002001C) /* PM Oscillator Status Reg. */
925
926#define PMCR_SF 0x00000001 /* Sleep Force (set only) */
927
928#define PSSR_SS 0x00000001 /* Software Sleep */
929#define PSSR_BFS 0x00000002 /* Battery Fault Status */
930 /* (BATT_FAULT) */
931#define PSSR_VFS 0x00000004 /* Vdd Fault Status (VDD_FAULT) */
932#define PSSR_DH 0x00000008 /* DRAM control Hold */
933#define PSSR_PH 0x00000010 /* Peripheral control Hold */
934
935#define PWER_GPIO(Nb) GPIO_GPIO (Nb) /* GPIO [0..27] wake-up enable */
936#define PWER_GPIO0 PWER_GPIO (0) /* GPIO [0] wake-up enable */
937#define PWER_GPIO1 PWER_GPIO (1) /* GPIO [1] wake-up enable */
938#define PWER_GPIO2 PWER_GPIO (2) /* GPIO [2] wake-up enable */
939#define PWER_GPIO3 PWER_GPIO (3) /* GPIO [3] wake-up enable */
940#define PWER_GPIO4 PWER_GPIO (4) /* GPIO [4] wake-up enable */
941#define PWER_GPIO5 PWER_GPIO (5) /* GPIO [5] wake-up enable */
942#define PWER_GPIO6 PWER_GPIO (6) /* GPIO [6] wake-up enable */
943#define PWER_GPIO7 PWER_GPIO (7) /* GPIO [7] wake-up enable */
944#define PWER_GPIO8 PWER_GPIO (8) /* GPIO [8] wake-up enable */
945#define PWER_GPIO9 PWER_GPIO (9) /* GPIO [9] wake-up enable */
946#define PWER_GPIO10 PWER_GPIO (10) /* GPIO [10] wake-up enable */
947#define PWER_GPIO11 PWER_GPIO (11) /* GPIO [11] wake-up enable */
948#define PWER_GPIO12 PWER_GPIO (12) /* GPIO [12] wake-up enable */
949#define PWER_GPIO13 PWER_GPIO (13) /* GPIO [13] wake-up enable */
950#define PWER_GPIO14 PWER_GPIO (14) /* GPIO [14] wake-up enable */
951#define PWER_GPIO15 PWER_GPIO (15) /* GPIO [15] wake-up enable */
952#define PWER_GPIO16 PWER_GPIO (16) /* GPIO [16] wake-up enable */
953#define PWER_GPIO17 PWER_GPIO (17) /* GPIO [17] wake-up enable */
954#define PWER_GPIO18 PWER_GPIO (18) /* GPIO [18] wake-up enable */
955#define PWER_GPIO19 PWER_GPIO (19) /* GPIO [19] wake-up enable */
956#define PWER_GPIO20 PWER_GPIO (20) /* GPIO [20] wake-up enable */
957#define PWER_GPIO21 PWER_GPIO (21) /* GPIO [21] wake-up enable */
958#define PWER_GPIO22 PWER_GPIO (22) /* GPIO [22] wake-up enable */
959#define PWER_GPIO23 PWER_GPIO (23) /* GPIO [23] wake-up enable */
960#define PWER_GPIO24 PWER_GPIO (24) /* GPIO [24] wake-up enable */
961#define PWER_GPIO25 PWER_GPIO (25) /* GPIO [25] wake-up enable */
962#define PWER_GPIO26 PWER_GPIO (26) /* GPIO [26] wake-up enable */
963#define PWER_GPIO27 PWER_GPIO (27) /* GPIO [27] wake-up enable */
964#define PWER_RTC 0x80000000 /* RTC alarm wake-up enable */
965
966#define PCFR_OPDE 0x00000001 /* Oscillator Power-Down Enable */
967#define PCFR_ClkRun (PCFR_OPDE*0) /* Clock Running in sleep mode */
968#define PCFR_ClkStp (PCFR_OPDE*1) /* Clock Stopped in sleep mode */
969#define PCFR_FP 0x00000002 /* Float PCMCIA pins */
970#define PCFR_PCMCIANeg (PCFR_FP*0) /* PCMCIA pins Negated (1) */
971#define PCFR_PCMCIAFlt (PCFR_FP*1) /* PCMCIA pins Floating */
972#define PCFR_FS 0x00000004 /* Float Static memory pins */
973#define PCFR_StMemNeg (PCFR_FS*0) /* Static Memory pins Negated (1) */
974#define PCFR_StMemFlt (PCFR_FS*1) /* Static Memory pins Floating */
975#define PCFR_FO 0x00000008 /* Force RTC oscillator */
976 /* (32.768 kHz) enable On */
977
978#define PPCR_CCF Fld (5, 0) /* CPU core Clock (CCLK) Freq. */
979#define PPCR_Fx16 /* Freq. x 16 (fcpu = 16*fxtl) */ \
980 (0x00 << FShft (PPCR_CCF))
981#define PPCR_Fx20 /* Freq. x 20 (fcpu = 20*fxtl) */ \
982 (0x01 << FShft (PPCR_CCF))
983#define PPCR_Fx24 /* Freq. x 24 (fcpu = 24*fxtl) */ \
984 (0x02 << FShft (PPCR_CCF))
985#define PPCR_Fx28 /* Freq. x 28 (fcpu = 28*fxtl) */ \
986 (0x03 << FShft (PPCR_CCF))
987#define PPCR_Fx32 /* Freq. x 32 (fcpu = 32*fxtl) */ \
988 (0x04 << FShft (PPCR_CCF))
989#define PPCR_Fx36 /* Freq. x 36 (fcpu = 36*fxtl) */ \
990 (0x05 << FShft (PPCR_CCF))
991#define PPCR_Fx40 /* Freq. x 40 (fcpu = 40*fxtl) */ \
992 (0x06 << FShft (PPCR_CCF))
993#define PPCR_Fx44 /* Freq. x 44 (fcpu = 44*fxtl) */ \
994 (0x07 << FShft (PPCR_CCF))
995#define PPCR_Fx48 /* Freq. x 48 (fcpu = 48*fxtl) */ \
996 (0x08 << FShft (PPCR_CCF))
997#define PPCR_Fx52 /* Freq. x 52 (fcpu = 52*fxtl) */ \
998 (0x09 << FShft (PPCR_CCF))
999#define PPCR_Fx56 /* Freq. x 56 (fcpu = 56*fxtl) */ \
1000 (0x0A << FShft (PPCR_CCF))
1001#define PPCR_Fx60 /* Freq. x 60 (fcpu = 60*fxtl) */ \
1002 (0x0B << FShft (PPCR_CCF))
1003#define PPCR_Fx64 /* Freq. x 64 (fcpu = 64*fxtl) */ \
1004 (0x0C << FShft (PPCR_CCF))
1005#define PPCR_Fx68 /* Freq. x 68 (fcpu = 68*fxtl) */ \
1006 (0x0D << FShft (PPCR_CCF))
1007#define PPCR_Fx72 /* Freq. x 72 (fcpu = 72*fxtl) */ \
1008 (0x0E << FShft (PPCR_CCF))
1009#define PPCR_Fx76 /* Freq. x 76 (fcpu = 76*fxtl) */ \
1010 (0x0F << FShft (PPCR_CCF))
1011 /* 3.6864 MHz crystal (fxtl): */
1012#define PPCR_F59_0MHz PPCR_Fx16 /* Freq. (fcpu) = 59.0 MHz */
1013#define PPCR_F73_7MHz PPCR_Fx20 /* Freq. (fcpu) = 73.7 MHz */
1014#define PPCR_F88_5MHz PPCR_Fx24 /* Freq. (fcpu) = 88.5 MHz */
1015#define PPCR_F103_2MHz PPCR_Fx28 /* Freq. (fcpu) = 103.2 MHz */
1016#define PPCR_F118_0MHz PPCR_Fx32 /* Freq. (fcpu) = 118.0 MHz */
1017#define PPCR_F132_7MHz PPCR_Fx36 /* Freq. (fcpu) = 132.7 MHz */
1018#define PPCR_F147_5MHz PPCR_Fx40 /* Freq. (fcpu) = 147.5 MHz */
1019#define PPCR_F162_2MHz PPCR_Fx44 /* Freq. (fcpu) = 162.2 MHz */
1020#define PPCR_F176_9MHz PPCR_Fx48 /* Freq. (fcpu) = 176.9 MHz */
1021#define PPCR_F191_7MHz PPCR_Fx52 /* Freq. (fcpu) = 191.7 MHz */
1022#define PPCR_F206_4MHz PPCR_Fx56 /* Freq. (fcpu) = 206.4 MHz */
1023#define PPCR_F221_2MHz PPCR_Fx60 /* Freq. (fcpu) = 221.2 MHz */
1024#define PPCR_F239_6MHz PPCR_Fx64 /* Freq. (fcpu) = 239.6 MHz */
1025#define PPCR_F250_7MHz PPCR_Fx68 /* Freq. (fcpu) = 250.7 MHz */
1026#define PPCR_F265_4MHz PPCR_Fx72 /* Freq. (fcpu) = 265.4 MHz */
1027#define PPCR_F280_2MHz PPCR_Fx76 /* Freq. (fcpu) = 280.2 MHz */
1028 /* 3.5795 MHz crystal (fxtl): */
1029#define PPCR_F57_3MHz PPCR_Fx16 /* Freq. (fcpu) = 57.3 MHz */
1030#define PPCR_F71_6MHz PPCR_Fx20 /* Freq. (fcpu) = 71.6 MHz */
1031#define PPCR_F85_9MHz PPCR_Fx24 /* Freq. (fcpu) = 85.9 MHz */
1032#define PPCR_F100_2MHz PPCR_Fx28 /* Freq. (fcpu) = 100.2 MHz */
1033#define PPCR_F114_5MHz PPCR_Fx32 /* Freq. (fcpu) = 114.5 MHz */
1034#define PPCR_F128_9MHz PPCR_Fx36 /* Freq. (fcpu) = 128.9 MHz */
1035#define PPCR_F143_2MHz PPCR_Fx40 /* Freq. (fcpu) = 143.2 MHz */
1036#define PPCR_F157_5MHz PPCR_Fx44 /* Freq. (fcpu) = 157.5 MHz */
1037#define PPCR_F171_8MHz PPCR_Fx48 /* Freq. (fcpu) = 171.8 MHz */
1038#define PPCR_F186_1MHz PPCR_Fx52 /* Freq. (fcpu) = 186.1 MHz */
1039#define PPCR_F200_5MHz PPCR_Fx56 /* Freq. (fcpu) = 200.5 MHz */
1040#define PPCR_F214_8MHz PPCR_Fx60 /* Freq. (fcpu) = 214.8 MHz */
1041#define PPCR_F229_1MHz PPCR_Fx64 /* Freq. (fcpu) = 229.1 MHz */
1042#define PPCR_F243_4MHz PPCR_Fx68 /* Freq. (fcpu) = 243.4 MHz */
1043#define PPCR_F257_7MHz PPCR_Fx72 /* Freq. (fcpu) = 257.7 MHz */
1044#define PPCR_F272_0MHz PPCR_Fx76 /* Freq. (fcpu) = 272.0 MHz */
1045
1046#define POSR_OOK 0x00000001 /* RTC Oscillator (32.768 kHz) OK */
1047
1048
1049/*
1050 * Reset Controller (RC) control registers
1051 *
1052 * Registers
1053 * RSRR Reset Controller (RC) Software Reset Register
1054 * (read/write).
1055 * RCSR Reset Controller (RC) Status Register (read/write).
1056 */
1057
1058#define RSRR __REG(0x90030000) /* RC Software Reset Reg. */
1059#define RCSR __REG(0x90030004) /* RC Status Reg. */
1060
1061#define RSRR_SWR 0x00000001 /* SoftWare Reset (set only) */
1062
1063#define RCSR_HWR 0x00000001 /* HardWare Reset */
1064#define RCSR_SWR 0x00000002 /* SoftWare Reset */
1065#define RCSR_WDR 0x00000004 /* Watch-Dog Reset */
1066#define RCSR_SMR 0x00000008 /* Sleep-Mode Reset */
1067
1068
1069/*
1070 * Test unit control registers
1071 *
1072 * Registers
1073 * TUCR Test Unit Control Register (read/write).
1074 */
1075
1076#define TUCR __REG(0x90030008) /* Test Unit Control Reg. */
1077
1078#define TUCR_TIC 0x00000040 /* TIC mode */
1079#define TUCR_TTST 0x00000080 /* Trim TeST mode */
1080#define TUCR_RCRC 0x00000100 /* Richard's Cyclic Redundancy */
1081 /* Check */
1082#define TUCR_PMD 0x00000200 /* Power Management Disable */
1083#define TUCR_MR 0x00000400 /* Memory Request mode */
1084#define TUCR_NoMB (TUCR_MR*0) /* No Memory Bus request & grant */
1085#define TUCR_MBGPIO (TUCR_MR*1) /* Memory Bus request (MBREQ) & */
1086 /* grant (MBGNT) on GPIO [22:21] */
1087#define TUCR_CTB Fld (3, 20) /* Clock Test Bits */
1088#define TUCR_FDC 0x00800000 /* RTC Force Delete Count */
1089#define TUCR_FMC 0x01000000 /* Force Michelle's Control mode */
1090#define TUCR_TMC 0x02000000 /* RTC Trimmer Multiplexer Control */
1091#define TUCR_DPS 0x04000000 /* Disallow Pad Sleep */
1092#define TUCR_TSEL Fld (3, 29) /* clock Test SELect on GPIO [27] */
1093#define TUCR_32_768kHz /* 32.768 kHz osc. on GPIO [27] */ \
1094 (0 << FShft (TUCR_TSEL))
1095#define TUCR_3_6864MHz /* 3.6864 MHz osc. on GPIO [27] */ \
1096 (1 << FShft (TUCR_TSEL))
1097#define TUCR_VDD /* VDD ring osc./16 on GPIO [27] */ \
1098 (2 << FShft (TUCR_TSEL))
1099#define TUCR_96MHzPLL /* 96 MHz PLL/4 on GPIO [27] */ \
1100 (3 << FShft (TUCR_TSEL))
1101#define TUCR_Clock /* internal (fcpu/2) & 32.768 kHz */ \
1102 /* Clocks on GPIO [26:27] */ \
1103 (4 << FShft (TUCR_TSEL))
1104#define TUCR_3_6864MHzA /* 3.6864 MHz osc. on GPIO [27] */ \
1105 /* (Alternative) */ \
1106 (5 << FShft (TUCR_TSEL))
1107#define TUCR_MainPLL /* Main PLL/16 on GPIO [27] */ \
1108 (6 << FShft (TUCR_TSEL))
1109#define TUCR_VDDL /* VDDL ring osc./4 on GPIO [27] */ \
1110 (7 << FShft (TUCR_TSEL))
1111
1112
1113/*
1114 * General-Purpose Input/Output (GPIO) control registers
1115 *
1116 * Registers
1117 * GPLR General-Purpose Input/Output (GPIO) Pin Level
1118 * Register (read).
1119 * GPDR General-Purpose Input/Output (GPIO) Pin Direction
1120 * Register (read/write).
1121 * GPSR General-Purpose Input/Output (GPIO) Pin output Set
1122 * Register (write).
1123 * GPCR General-Purpose Input/Output (GPIO) Pin output Clear
1124 * Register (write).
1125 * GRER General-Purpose Input/Output (GPIO) Rising-Edge
1126 * detect Register (read/write).
1127 * GFER General-Purpose Input/Output (GPIO) Falling-Edge
1128 * detect Register (read/write).
1129 * GEDR General-Purpose Input/Output (GPIO) Edge Detect
1130 * status Register (read/write).
1131 * GAFR General-Purpose Input/Output (GPIO) Alternate
1132 * Function Register (read/write).
1133 *
1134 * Clock
1135 * fcpu, Tcpu Frequency, period of the CPU core clock (CCLK).
1136 */
1137
1138#define GPLR __REG(0x90040000) /* GPIO Pin Level Reg. */
1139#define GPDR __REG(0x90040004) /* GPIO Pin Direction Reg. */
1140#define GPSR __REG(0x90040008) /* GPIO Pin output Set Reg. */
1141#define GPCR __REG(0x9004000C) /* GPIO Pin output Clear Reg. */
1142#define GRER __REG(0x90040010) /* GPIO Rising-Edge detect Reg. */
1143#define GFER __REG(0x90040014) /* GPIO Falling-Edge detect Reg. */
1144#define GEDR __REG(0x90040018) /* GPIO Edge Detect status Reg. */
1145#define GAFR __REG(0x9004001C) /* GPIO Alternate Function Reg. */
1146
1147#define GPIO_MIN (0)
1148#define GPIO_MAX (27)
1149
1150#define GPIO_GPIO(Nb) /* GPIO [0..27] */ \
1151 (0x00000001 << (Nb))
1152#define GPIO_GPIO0 GPIO_GPIO (0) /* GPIO [0] */
1153#define GPIO_GPIO1 GPIO_GPIO (1) /* GPIO [1] */
1154#define GPIO_GPIO2 GPIO_GPIO (2) /* GPIO [2] */
1155#define GPIO_GPIO3 GPIO_GPIO (3) /* GPIO [3] */
1156#define GPIO_GPIO4 GPIO_GPIO (4) /* GPIO [4] */
1157#define GPIO_GPIO5 GPIO_GPIO (5) /* GPIO [5] */
1158#define GPIO_GPIO6 GPIO_GPIO (6) /* GPIO [6] */
1159#define GPIO_GPIO7 GPIO_GPIO (7) /* GPIO [7] */
1160#define GPIO_GPIO8 GPIO_GPIO (8) /* GPIO [8] */
1161#define GPIO_GPIO9 GPIO_GPIO (9) /* GPIO [9] */
1162#define GPIO_GPIO10 GPIO_GPIO (10) /* GPIO [10] */
1163#define GPIO_GPIO11 GPIO_GPIO (11) /* GPIO [11] */
1164#define GPIO_GPIO12 GPIO_GPIO (12) /* GPIO [12] */
1165#define GPIO_GPIO13 GPIO_GPIO (13) /* GPIO [13] */
1166#define GPIO_GPIO14 GPIO_GPIO (14) /* GPIO [14] */
1167#define GPIO_GPIO15 GPIO_GPIO (15) /* GPIO [15] */
1168#define GPIO_GPIO16 GPIO_GPIO (16) /* GPIO [16] */
1169#define GPIO_GPIO17 GPIO_GPIO (17) /* GPIO [17] */
1170#define GPIO_GPIO18 GPIO_GPIO (18) /* GPIO [18] */
1171#define GPIO_GPIO19 GPIO_GPIO (19) /* GPIO [19] */
1172#define GPIO_GPIO20 GPIO_GPIO (20) /* GPIO [20] */
1173#define GPIO_GPIO21 GPIO_GPIO (21) /* GPIO [21] */
1174#define GPIO_GPIO22 GPIO_GPIO (22) /* GPIO [22] */
1175#define GPIO_GPIO23 GPIO_GPIO (23) /* GPIO [23] */
1176#define GPIO_GPIO24 GPIO_GPIO (24) /* GPIO [24] */
1177#define GPIO_GPIO25 GPIO_GPIO (25) /* GPIO [25] */
1178#define GPIO_GPIO26 GPIO_GPIO (26) /* GPIO [26] */
1179#define GPIO_GPIO27 GPIO_GPIO (27) /* GPIO [27] */
1180
1181#define GPIO_LDD(Nb) /* LCD Data [8..15] (O) */ \
1182 GPIO_GPIO ((Nb) - 6)
1183#define GPIO_LDD8 GPIO_LDD (8) /* LCD Data [8] (O) */
1184#define GPIO_LDD9 GPIO_LDD (9) /* LCD Data [9] (O) */
1185#define GPIO_LDD10 GPIO_LDD (10) /* LCD Data [10] (O) */
1186#define GPIO_LDD11 GPIO_LDD (11) /* LCD Data [11] (O) */
1187#define GPIO_LDD12 GPIO_LDD (12) /* LCD Data [12] (O) */
1188#define GPIO_LDD13 GPIO_LDD (13) /* LCD Data [13] (O) */
1189#define GPIO_LDD14 GPIO_LDD (14) /* LCD Data [14] (O) */
1190#define GPIO_LDD15 GPIO_LDD (15) /* LCD Data [15] (O) */
1191 /* ser. port 4: */
1192#define GPIO_SSP_TXD GPIO_GPIO (10) /* SSP Transmit Data (O) */
1193#define GPIO_SSP_RXD GPIO_GPIO (11) /* SSP Receive Data (I) */
1194#define GPIO_SSP_SCLK GPIO_GPIO (12) /* SSP Sample CLocK (O) */
1195#define GPIO_SSP_SFRM GPIO_GPIO (13) /* SSP Sample FRaMe (O) */
1196 /* ser. port 1: */
1197#define GPIO_UART_TXD GPIO_GPIO (14) /* UART Transmit Data (O) */
1198#define GPIO_UART_RXD GPIO_GPIO (15) /* UART Receive Data (I) */
1199#define GPIO_SDLC_SCLK GPIO_GPIO (16) /* SDLC Sample CLocK (I/O) */
1200#define GPIO_SDLC_AAF GPIO_GPIO (17) /* SDLC Abort After Frame (O) */
1201#define GPIO_UART_SCLK1 GPIO_GPIO (18) /* UART Sample CLocK 1 (I) */
1202 /* ser. port 4: */
1203#define GPIO_SSP_CLK GPIO_GPIO (19) /* SSP external CLocK (I) */
1204 /* ser. port 3: */
1205#define GPIO_UART_SCLK3 GPIO_GPIO (20) /* UART Sample CLocK 3 (I) */
1206 /* ser. port 4: */
1207#define GPIO_MCP_CLK GPIO_GPIO (21) /* MCP CLocK (I) */
1208 /* test controller: */
1209#define GPIO_TIC_ACK GPIO_GPIO (21) /* TIC ACKnowledge (O) */
1210#define GPIO_MBGNT GPIO_GPIO (21) /* Memory Bus GraNT (O) */
1211#define GPIO_TREQA GPIO_GPIO (22) /* TIC REQuest A (I) */
1212#define GPIO_MBREQ GPIO_GPIO (22) /* Memory Bus REQuest (I) */
1213#define GPIO_TREQB GPIO_GPIO (23) /* TIC REQuest B (I) */
1214#define GPIO_1Hz GPIO_GPIO (25) /* 1 Hz clock (O) */
1215#define GPIO_RCLK GPIO_GPIO (26) /* internal (R) CLocK (O, fcpu/2) */
1216#define GPIO_32_768kHz GPIO_GPIO (27) /* 32.768 kHz clock (O, RTC) */
1217
1218#define GPDR_In 0 /* Input */
1219#define GPDR_Out 1 /* Output */
1220
1221
1222/*
1223 * Interrupt Controller (IC) control registers
1224 *
1225 * Registers
1226 * ICIP Interrupt Controller (IC) Interrupt ReQuest (IRQ)
1227 * Pending register (read).
1228 * ICMR Interrupt Controller (IC) Mask Register (read/write).
1229 * ICLR Interrupt Controller (IC) Level Register (read/write).
1230 * ICCR Interrupt Controller (IC) Control Register
1231 * (read/write).
1232 * [The ICCR register is only implemented in versions 2.0
1233 * (rev. = 8) and higher of the StrongARM SA-1100.]
1234 * ICFP Interrupt Controller (IC) Fast Interrupt reQuest
1235 * (FIQ) Pending register (read).
1236 * ICPR Interrupt Controller (IC) Pending Register (read).
1237 * [The ICPR register is active low (inverted) in
1238 * versions 1.0 (rev. = 1) and 1.1 (rev. = 2) of the
1239 * StrongARM SA-1100, it is active high (non-inverted) in
1240 * versions 2.0 (rev. = 8) and higher.]
1241 */
1242
1243#define ICIP __REG(0x90050000) /* IC IRQ Pending reg. */
1244#define ICMR __REG(0x90050004) /* IC Mask Reg. */
1245#define ICLR __REG(0x90050008) /* IC Level Reg. */
1246#define ICCR __REG(0x9005000C) /* IC Control Reg. */
1247#define ICFP __REG(0x90050010) /* IC FIQ Pending reg. */
1248#define ICPR __REG(0x90050020) /* IC Pending Reg. */
1249
1250#define IC_GPIO(Nb) /* GPIO [0..10] */ \
1251 (0x00000001 << (Nb))
1252#define IC_GPIO0 IC_GPIO (0) /* GPIO [0] */
1253#define IC_GPIO1 IC_GPIO (1) /* GPIO [1] */
1254#define IC_GPIO2 IC_GPIO (2) /* GPIO [2] */
1255#define IC_GPIO3 IC_GPIO (3) /* GPIO [3] */
1256#define IC_GPIO4 IC_GPIO (4) /* GPIO [4] */
1257#define IC_GPIO5 IC_GPIO (5) /* GPIO [5] */
1258#define IC_GPIO6 IC_GPIO (6) /* GPIO [6] */
1259#define IC_GPIO7 IC_GPIO (7) /* GPIO [7] */
1260#define IC_GPIO8 IC_GPIO (8) /* GPIO [8] */
1261#define IC_GPIO9 IC_GPIO (9) /* GPIO [9] */
1262#define IC_GPIO10 IC_GPIO (10) /* GPIO [10] */
1263#define IC_GPIO11_27 0x00000800 /* GPIO [11:27] (ORed) */
1264#define IC_LCD 0x00001000 /* LCD controller */
1265#define IC_Ser0UDC 0x00002000 /* Ser. port 0 UDC */
1266#define IC_Ser1SDLC 0x00004000 /* Ser. port 1 SDLC */
1267#define IC_Ser1UART 0x00008000 /* Ser. port 1 UART */
1268#define IC_Ser2ICP 0x00010000 /* Ser. port 2 ICP */
1269#define IC_Ser3UART 0x00020000 /* Ser. port 3 UART */
1270#define IC_Ser4MCP 0x00040000 /* Ser. port 4 MCP */
1271#define IC_Ser4SSP 0x00080000 /* Ser. port 4 SSP */
1272#define IC_DMA(Nb) /* DMA controller channel [0..5] */ \
1273 (0x00100000 << (Nb))
1274#define IC_DMA0 IC_DMA (0) /* DMA controller channel 0 */
1275#define IC_DMA1 IC_DMA (1) /* DMA controller channel 1 */
1276#define IC_DMA2 IC_DMA (2) /* DMA controller channel 2 */
1277#define IC_DMA3 IC_DMA (3) /* DMA controller channel 3 */
1278#define IC_DMA4 IC_DMA (4) /* DMA controller channel 4 */
1279#define IC_DMA5 IC_DMA (5) /* DMA controller channel 5 */
1280#define IC_OST(Nb) /* OS Timer match [0..3] */ \
1281 (0x04000000 << (Nb))
1282#define IC_OST0 IC_OST (0) /* OS Timer match 0 */
1283#define IC_OST1 IC_OST (1) /* OS Timer match 1 */
1284#define IC_OST2 IC_OST (2) /* OS Timer match 2 */
1285#define IC_OST3 IC_OST (3) /* OS Timer match 3 */
1286#define IC_RTC1Hz 0x40000000 /* RTC 1 Hz clock */
1287#define IC_RTCAlrm 0x80000000 /* RTC Alarm */
1288
1289#define ICLR_IRQ 0 /* Interrupt ReQuest */
1290#define ICLR_FIQ 1 /* Fast Interrupt reQuest */
1291
1292#define ICCR_DIM 0x00000001 /* Disable Idle-mode interrupt */
1293 /* Mask */
1294#define ICCR_IdleAllInt (ICCR_DIM*0) /* Idle-mode All Interrupt enable */
1295 /* (ICMR ignored) */
1296#define ICCR_IdleMskInt (ICCR_DIM*1) /* Idle-mode non-Masked Interrupt */
1297 /* enable (ICMR used) */
1298
1299
1300/*
1301 * Peripheral Pin Controller (PPC) control registers
1302 *
1303 * Registers
1304 * PPDR Peripheral Pin Controller (PPC) Pin Direction
1305 * Register (read/write).
1306 * PPSR Peripheral Pin Controller (PPC) Pin State Register
1307 * (read/write).
1308 * PPAR Peripheral Pin Controller (PPC) Pin Assignment
1309 * Register (read/write).
1310 * PSDR Peripheral Pin Controller (PPC) Sleep-mode pin
1311 * Direction Register (read/write).
1312 * PPFR Peripheral Pin Controller (PPC) Pin Flag Register
1313 * (read).
1314 */
1315
1316#define PPDR __REG(0x90060000) /* PPC Pin Direction Reg. */
1317#define PPSR __REG(0x90060004) /* PPC Pin State Reg. */
1318#define PPAR __REG(0x90060008) /* PPC Pin Assignment Reg. */
1319#define PSDR __REG(0x9006000C) /* PPC Sleep-mode pin Direction Reg. */
1320#define PPFR __REG(0x90060010) /* PPC Pin Flag Reg. */
1321
1322#define PPC_LDD(Nb) /* LCD Data [0..7] */ \
1323 (0x00000001 << (Nb))
1324#define PPC_LDD0 PPC_LDD (0) /* LCD Data [0] */
1325#define PPC_LDD1 PPC_LDD (1) /* LCD Data [1] */
1326#define PPC_LDD2 PPC_LDD (2) /* LCD Data [2] */
1327#define PPC_LDD3 PPC_LDD (3) /* LCD Data [3] */
1328#define PPC_LDD4 PPC_LDD (4) /* LCD Data [4] */
1329#define PPC_LDD5 PPC_LDD (5) /* LCD Data [5] */
1330#define PPC_LDD6 PPC_LDD (6) /* LCD Data [6] */
1331#define PPC_LDD7 PPC_LDD (7) /* LCD Data [7] */
1332#define PPC_L_PCLK 0x00000100 /* LCD Pixel CLocK */
1333#define PPC_L_LCLK 0x00000200 /* LCD Line CLocK */
1334#define PPC_L_FCLK 0x00000400 /* LCD Frame CLocK */
1335#define PPC_L_BIAS 0x00000800 /* LCD AC BIAS */
1336 /* ser. port 1: */
1337#define PPC_TXD1 0x00001000 /* SDLC/UART Transmit Data 1 */
1338#define PPC_RXD1 0x00002000 /* SDLC/UART Receive Data 1 */
1339 /* ser. port 2: */
1340#define PPC_TXD2 0x00004000 /* IPC Transmit Data 2 */
1341#define PPC_RXD2 0x00008000 /* IPC Receive Data 2 */
1342 /* ser. port 3: */
1343#define PPC_TXD3 0x00010000 /* UART Transmit Data 3 */
1344#define PPC_RXD3 0x00020000 /* UART Receive Data 3 */
1345 /* ser. port 4: */
1346#define PPC_TXD4 0x00040000 /* MCP/SSP Transmit Data 4 */
1347#define PPC_RXD4 0x00080000 /* MCP/SSP Receive Data 4 */
1348#define PPC_SCLK 0x00100000 /* MCP/SSP Sample CLocK */
1349#define PPC_SFRM 0x00200000 /* MCP/SSP Sample FRaMe */
1350
1351#define PPDR_In 0 /* Input */
1352#define PPDR_Out 1 /* Output */
1353
1354 /* ser. port 1: */
1355#define PPAR_UPR 0x00001000 /* UART Pin Reassignment */
1356#define PPAR_UARTTR (PPAR_UPR*0) /* UART on TXD_1 & RXD_1 */
1357#define PPAR_UARTGPIO (PPAR_UPR*1) /* UART on GPIO [14:15] */
1358 /* ser. port 4: */
1359#define PPAR_SPR 0x00040000 /* SSP Pin Reassignment */
1360#define PPAR_SSPTRSS (PPAR_SPR*0) /* SSP on TXD_C, RXD_C, SCLK_C, */
1361 /* & SFRM_C */
1362#define PPAR_SSPGPIO (PPAR_SPR*1) /* SSP on GPIO [10:13] */
1363
1364#define PSDR_OutL 0 /* Output Low in sleep mode */
1365#define PSDR_Flt 1 /* Floating (input) in sleep mode */
1366
1367#define PPFR_LCD 0x00000001 /* LCD controller */
1368#define PPFR_SP1TX 0x00001000 /* Ser. Port 1 SDLC/UART Transmit */
1369#define PPFR_SP1RX 0x00002000 /* Ser. Port 1 SDLC/UART Receive */
1370#define PPFR_SP2TX 0x00004000 /* Ser. Port 2 ICP Transmit */
1371#define PPFR_SP2RX 0x00008000 /* Ser. Port 2 ICP Receive */
1372#define PPFR_SP3TX 0x00010000 /* Ser. Port 3 UART Transmit */
1373#define PPFR_SP3RX 0x00020000 /* Ser. Port 3 UART Receive */
1374#define PPFR_SP4 0x00040000 /* Ser. Port 4 MCP/SSP */
1375#define PPFR_PerEn 0 /* Peripheral Enabled */
1376#define PPFR_PPCEn 1 /* PPC Enabled */
1377
1378
1379/*
1380 * Dynamic Random-Access Memory (DRAM) control registers
1381 *
1382 * Registers
1383 * MDCNFG Memory system: Dynamic Random-Access Memory (DRAM)
1384 * CoNFiGuration register (read/write).
1385 * MDCAS0 Memory system: Dynamic Random-Access Memory (DRAM)
1386 * Column Address Strobe (CAS) shift register 0
1387 * (read/write).
1388 * MDCAS1 Memory system: Dynamic Random-Access Memory (DRAM)
1389 * Column Address Strobe (CAS) shift register 1
1390 * (read/write).
1391 * MDCAS2 Memory system: Dynamic Random-Access Memory (DRAM)
1392 * Column Address Strobe (CAS) shift register 2
1393 * (read/write).
1394 *
1395 * Clocks
1396 * fcpu, Tcpu Frequency, period of the CPU core clock (CCLK).
1397 * fmem, Tmem Frequency, period of the memory clock (fmem = fcpu/2).
1398 * fcas, Tcas Frequency, period of the DRAM CAS shift registers.
1399 */
1400
1401#define MDCNFG __REG(0xA0000000) /* DRAM CoNFiGuration reg. */
1402#define MDCAS0 __REG(0xA0000004) /* DRAM CAS shift reg. 0 */
1403#define MDCAS1 __REG(0xA0000008) /* DRAM CAS shift reg. 1 */
1404#define MDCAS2 __REG(0xA000000c) /* DRAM CAS shift reg. 2 */
1405
1406/* SA1100 MDCNFG values */
1407#define MDCNFG_DE(Nb) /* DRAM Enable bank [0..3] */ \
1408 (0x00000001 << (Nb))
1409#define MDCNFG_DE0 MDCNFG_DE (0) /* DRAM Enable bank 0 */
1410#define MDCNFG_DE1 MDCNFG_DE (1) /* DRAM Enable bank 1 */
1411#define MDCNFG_DE2 MDCNFG_DE (2) /* DRAM Enable bank 2 */
1412#define MDCNFG_DE3 MDCNFG_DE (3) /* DRAM Enable bank 3 */
1413#define MDCNFG_DRAC Fld (2, 4) /* DRAM Row Address Count - 9 */
1414#define MDCNFG_RowAdd(Add) /* Row Address count [9..12] */ \
1415 (((Add) - 9) << FShft (MDCNFG_DRAC))
1416#define MDCNFG_CDB2 0x00000040 /* shift reg. Clock Divide By 2 */
1417 /* (fcas = fcpu/2) */
1418#define MDCNFG_TRP Fld (4, 7) /* Time RAS Pre-charge - 1 [Tmem] */
1419#define MDCNFG_PrChrg(Tcpu) /* Pre-Charge time [2..32 Tcpu] */ \
1420 (((Tcpu) - 2)/2 << FShft (MDCNFG_TRP))
1421#define MDCNFG_CeilPrChrg(Tcpu) /* Ceil. of PrChrg [2..32 Tcpu] */ \
1422 (((Tcpu) - 1)/2 << FShft (MDCNFG_TRP))
1423#define MDCNFG_TRASR Fld (4, 11) /* Time RAS Refresh - 1 [Tmem] */
1424#define MDCNFG_Ref(Tcpu) /* Refresh time [2..32 Tcpu] */ \
1425 (((Tcpu) - 2)/2 << FShft (MDCNFG_TRASR))
1426#define MDCNFG_CeilRef(Tcpu) /* Ceil. of Ref [2..32 Tcpu] */ \
1427 (((Tcpu) - 1)/2 << FShft (MDCNFG_TRASR))
1428#define MDCNFG_TDL Fld (2, 15) /* Time Data Latch [Tcpu] */
1429#define MDCNFG_DataLtch(Tcpu) /* Data Latch delay [0..3 Tcpu] */ \
1430 ((Tcpu) << FShft (MDCNFG_TDL))
1431#define MDCNFG_DRI Fld (15, 17) /* min. DRAM Refresh Interval/4 */
1432 /* [Tmem] */
1433#define MDCNFG_RefInt(Tcpu) /* min. Refresh Interval */ \
1434 /* [0..262136 Tcpu] */ \
1435 ((Tcpu)/8 << FShft (MDCNFG_DRI))
1436
1437/* SA1110 MDCNFG values */
1438#define MDCNFG_SA1110_DE0 0x00000001 /* DRAM Enable bank 0 */
1439#define MDCNFG_SA1110_DE1 0x00000002 /* DRAM Enable bank 1 */
1440#define MDCNFG_SA1110_DTIM0 0x00000004 /* DRAM timing type 0/1 */
1441#define MDCNFG_SA1110_DWID0 0x00000008 /* DRAM bus width 0/1 */
1442#define MDCNFG_SA1110_DRAC0 Fld(3, 4) /* DRAM row addr bit count */
1443 /* bank 0/1 */
1444#define MDCNFG_SA1110_CDB20 0x00000080 /* Mem Clock divide by 2 0/1 */
1445#define MDCNFG_SA1110_TRP0 Fld(3, 8) /* RAS precharge 0/1 */
1446#define MDCNFG_SA1110_TDL0 Fld(2, 12) /* Data input latch after CAS*/
1447 /* deassertion 0/1 */
1448#define MDCNFG_SA1110_TWR0 Fld(2, 14) /* SDRAM write recovery 0/1 */
1449#define MDCNFG_SA1110_DE2 0x00010000 /* DRAM Enable bank 0 */
1450#define MDCNFG_SA1110_DE3 0x00020000 /* DRAM Enable bank 1 */
1451#define MDCNFG_SA1110_DTIM2 0x00040000 /* DRAM timing type 0/1 */
1452#define MDCNFG_SA1110_DWID2 0x00080000 /* DRAM bus width 0/1 */
1453#define MDCNFG_SA1110_DRAC2 Fld(3, 20) /* DRAM row addr bit count */
1454 /* bank 0/1 */
1455#define MDCNFG_SA1110_CDB22 0x00800000 /* Mem Clock divide by 2 0/1 */
1456#define MDCNFG_SA1110_TRP2 Fld(3, 24) /* RAS precharge 0/1 */
1457#define MDCNFG_SA1110_TDL2 Fld(2, 28) /* Data input latch after CAS*/
1458 /* deassertion 0/1 */
1459#define MDCNFG_SA1110_TWR2 Fld(2, 30) /* SDRAM write recovery 0/1 */
1460
1461
1462/*
1463 * Static memory control registers
1464 *
1465 * Registers
1466 * MSC0 Memory system: Static memory Control register 0
1467 * (read/write).
1468 * MSC1 Memory system: Static memory Control register 1
1469 * (read/write).
1470 *
1471 * Clocks
1472 * fcpu, Tcpu Frequency, period of the CPU core clock (CCLK).
1473 * fmem, Tmem Frequency, period of the memory clock (fmem = fcpu/2).
1474 */
1475
1476#define MSC0 __REG(0xa0000010) /* Static memory Control reg. 0 */
1477#define MSC1 __REG(0xa0000014) /* Static memory Control reg. 1 */
1478#define MSC2 __REG(0xa000002c) /* Static memory Control reg. 2, not contiguous */
1479
1480#define MSC_Bnk(Nb) /* static memory Bank [0..3] */ \
1481 Fld (16, ((Nb) Modulo 2)*16)
1482#define MSC0_Bnk0 MSC_Bnk (0) /* static memory Bank 0 */
1483#define MSC0_Bnk1 MSC_Bnk (1) /* static memory Bank 1 */
1484#define MSC1_Bnk2 MSC_Bnk (2) /* static memory Bank 2 */
1485#define MSC1_Bnk3 MSC_Bnk (3) /* static memory Bank 3 */
1486
1487#define MSC_RT Fld (2, 0) /* ROM/static memory Type */
1488#define MSC_NonBrst /* Non-Burst static memory */ \
1489 (0 << FShft (MSC_RT))
1490#define MSC_SRAM /* 32-bit byte-writable SRAM */ \
1491 (1 << FShft (MSC_RT))
1492#define MSC_Brst4 /* Burst-of-4 static memory */ \
1493 (2 << FShft (MSC_RT))
1494#define MSC_Brst8 /* Burst-of-8 static memory */ \
1495 (3 << FShft (MSC_RT))
1496#define MSC_RBW 0x0004 /* ROM/static memory Bus Width */
1497#define MSC_32BitStMem (MSC_RBW*0) /* 32-Bit Static Memory */
1498#define MSC_16BitStMem (MSC_RBW*1) /* 16-Bit Static Memory */
1499#define MSC_RDF Fld (5, 3) /* ROM/static memory read Delay */
1500 /* First access - 1(.5) [Tmem] */
1501#define MSC_1stRdAcc(Tcpu) /* 1st Read Access time (burst */ \
1502 /* static memory) [3..65 Tcpu] */ \
1503 ((((Tcpu) - 3)/2) << FShft (MSC_RDF))
1504#define MSC_Ceil1stRdAcc(Tcpu) /* Ceil. of 1stRdAcc [3..65 Tcpu] */ \
1505 ((((Tcpu) - 2)/2) << FShft (MSC_RDF))
1506#define MSC_RdAcc(Tcpu) /* Read Access time (non-burst */ \
1507 /* static memory) [2..64 Tcpu] */ \
1508 ((((Tcpu) - 2)/2) << FShft (MSC_RDF))
1509#define MSC_CeilRdAcc(Tcpu) /* Ceil. of RdAcc [2..64 Tcpu] */ \
1510 ((((Tcpu) - 1)/2) << FShft (MSC_RDF))
1511#define MSC_RDN Fld (5, 8) /* ROM/static memory read Delay */
1512 /* Next access - 1 [Tmem] */
1513#define MSC_NxtRdAcc(Tcpu) /* Next Read Access time (burst */ \
1514 /* static memory) [2..64 Tcpu] */ \
1515 ((((Tcpu) - 2)/2) << FShft (MSC_RDN))
1516#define MSC_CeilNxtRdAcc(Tcpu) /* Ceil. of NxtRdAcc [2..64 Tcpu] */ \
1517 ((((Tcpu) - 1)/2) << FShft (MSC_RDN))
1518#define MSC_WrAcc(Tcpu) /* Write Access time (non-burst */ \
1519 /* static memory) [2..64 Tcpu] */ \
1520 ((((Tcpu) - 2)/2) << FShft (MSC_RDN))
1521#define MSC_CeilWrAcc(Tcpu) /* Ceil. of WrAcc [2..64 Tcpu] */ \
1522 ((((Tcpu) - 1)/2) << FShft (MSC_RDN))
1523#define MSC_RRR Fld (3, 13) /* ROM/static memory RecoveRy */
1524 /* time/2 [Tmem] */
1525#define MSC_Rec(Tcpu) /* Recovery time [0..28 Tcpu] */ \
1526 (((Tcpu)/4) << FShft (MSC_RRR))
1527#define MSC_CeilRec(Tcpu) /* Ceil. of Rec [0..28 Tcpu] */ \
1528 ((((Tcpu) + 3)/4) << FShft (MSC_RRR))
1529
1530
1531/*
1532 * Personal Computer Memory Card International Association (PCMCIA) control
1533 * register
1534 *
1535 * Register
1536 * MECR Memory system: Expansion memory bus (PCMCIA)
1537 * Configuration Register (read/write).
1538 *
1539 * Clocks
1540 * fcpu, Tcpu Frequency, period of the CPU core clock (CCLK).
1541 * fmem, Tmem Frequency, period of the memory clock (fmem = fcpu/2).
1542 * fbclk, Tbclk Frequency, period of the PCMCIA clock (BCLK).
1543 */
1544
1545 /* Memory system: */
1546#define MECR __REG(0xA0000018) /* Expansion memory bus (PCMCIA) Configuration Reg. */
1547
1548#define MECR_PCMCIA(Nb) /* PCMCIA [0..1] */ \
1549 Fld (15, (Nb)*16)
1550#define MECR_PCMCIA0 MECR_PCMCIA (0) /* PCMCIA 0 */
1551#define MECR_PCMCIA1 MECR_PCMCIA (1) /* PCMCIA 1 */
1552
1553#define MECR_BSIO Fld (5, 0) /* BCLK Select I/O - 1 [Tmem] */
1554#define MECR_IOClk(Tcpu) /* I/O Clock [2..64 Tcpu] */ \
1555 ((((Tcpu) - 2)/2) << FShft (MECR_BSIO))
1556#define MECR_CeilIOClk(Tcpu) /* Ceil. of IOClk [2..64 Tcpu] */ \
1557 ((((Tcpu) - 1)/2) << FShft (MECR_BSIO))
1558#define MECR_BSA Fld (5, 5) /* BCLK Select Attribute - 1 */
1559 /* [Tmem] */
1560#define MECR_AttrClk(Tcpu) /* Attribute Clock [2..64 Tcpu] */ \
1561 ((((Tcpu) - 2)/2) << FShft (MECR_BSA))
1562#define MECR_CeilAttrClk(Tcpu) /* Ceil. of AttrClk [2..64 Tcpu] */ \
1563 ((((Tcpu) - 1)/2) << FShft (MECR_BSA))
1564#define MECR_BSM Fld (5, 10) /* BCLK Select Memory - 1 [Tmem] */
1565#define MECR_MemClk(Tcpu) /* Memory Clock [2..64 Tcpu] */ \
1566 ((((Tcpu) - 2)/2) << FShft (MECR_BSM))
1567#define MECR_CeilMemClk(Tcpu) /* Ceil. of MemClk [2..64 Tcpu] */ \
1568 ((((Tcpu) - 1)/2) << FShft (MECR_BSM))
1569
1570/*
1571 * On SA1110 only
1572 */
1573
1574#define MDREFR __REG(0xA000001C)
1575
1576#define MDREFR_TRASR Fld (4, 0)
1577#define MDREFR_DRI Fld (12, 4)
1578#define MDREFR_E0PIN (1 << 16)
1579#define MDREFR_K0RUN (1 << 17)
1580#define MDREFR_K0DB2 (1 << 18)
1581#define MDREFR_E1PIN (1 << 20)
1582#define MDREFR_K1RUN (1 << 21)
1583#define MDREFR_K1DB2 (1 << 22)
1584#define MDREFR_K2RUN (1 << 25)
1585#define MDREFR_K2DB2 (1 << 26)
1586#define MDREFR_EAPD (1 << 28)
1587#define MDREFR_KAPD (1 << 29)
1588#define MDREFR_SLFRSH (1 << 31)
1589
1590
1591/*
1592 * Direct Memory Access (DMA) control registers
1593 *
1594 * Registers
1595 * DDAR0 Direct Memory Access (DMA) Device Address Register
1596 * channel 0 (read/write).
1597 * DCSR0 Direct Memory Access (DMA) Control and Status
1598 * Register channel 0 (read/write).
1599 * DBSA0 Direct Memory Access (DMA) Buffer Start address
1600 * register A channel 0 (read/write).
1601 * DBTA0 Direct Memory Access (DMA) Buffer Transfer count
1602 * register A channel 0 (read/write).
1603 * DBSB0 Direct Memory Access (DMA) Buffer Start address
1604 * register B channel 0 (read/write).
1605 * DBTB0 Direct Memory Access (DMA) Buffer Transfer count
1606 * register B channel 0 (read/write).
1607 *
1608 * DDAR1 Direct Memory Access (DMA) Device Address Register
1609 * channel 1 (read/write).
1610 * DCSR1 Direct Memory Access (DMA) Control and Status
1611 * Register channel 1 (read/write).
1612 * DBSA1 Direct Memory Access (DMA) Buffer Start address
1613 * register A channel 1 (read/write).
1614 * DBTA1 Direct Memory Access (DMA) Buffer Transfer count
1615 * register A channel 1 (read/write).
1616 * DBSB1 Direct Memory Access (DMA) Buffer Start address
1617 * register B channel 1 (read/write).
1618 * DBTB1 Direct Memory Access (DMA) Buffer Transfer count
1619 * register B channel 1 (read/write).
1620 *
1621 * DDAR2 Direct Memory Access (DMA) Device Address Register
1622 * channel 2 (read/write).
1623 * DCSR2 Direct Memory Access (DMA) Control and Status
1624 * Register channel 2 (read/write).
1625 * DBSA2 Direct Memory Access (DMA) Buffer Start address
1626 * register A channel 2 (read/write).
1627 * DBTA2 Direct Memory Access (DMA) Buffer Transfer count
1628 * register A channel 2 (read/write).
1629 * DBSB2 Direct Memory Access (DMA) Buffer Start address
1630 * register B channel 2 (read/write).
1631 * DBTB2 Direct Memory Access (DMA) Buffer Transfer count
1632 * register B channel 2 (read/write).
1633 *
1634 * DDAR3 Direct Memory Access (DMA) Device Address Register
1635 * channel 3 (read/write).
1636 * DCSR3 Direct Memory Access (DMA) Control and Status
1637 * Register channel 3 (read/write).
1638 * DBSA3 Direct Memory Access (DMA) Buffer Start address
1639 * register A channel 3 (read/write).
1640 * DBTA3 Direct Memory Access (DMA) Buffer Transfer count
1641 * register A channel 3 (read/write).
1642 * DBSB3 Direct Memory Access (DMA) Buffer Start address
1643 * register B channel 3 (read/write).
1644 * DBTB3 Direct Memory Access (DMA) Buffer Transfer count
1645 * register B channel 3 (read/write).
1646 *
1647 * DDAR4 Direct Memory Access (DMA) Device Address Register
1648 * channel 4 (read/write).
1649 * DCSR4 Direct Memory Access (DMA) Control and Status
1650 * Register channel 4 (read/write).
1651 * DBSA4 Direct Memory Access (DMA) Buffer Start address
1652 * register A channel 4 (read/write).
1653 * DBTA4 Direct Memory Access (DMA) Buffer Transfer count
1654 * register A channel 4 (read/write).
1655 * DBSB4 Direct Memory Access (DMA) Buffer Start address
1656 * register B channel 4 (read/write).
1657 * DBTB4 Direct Memory Access (DMA) Buffer Transfer count
1658 * register B channel 4 (read/write).
1659 *
1660 * DDAR5 Direct Memory Access (DMA) Device Address Register
1661 * channel 5 (read/write).
1662 * DCSR5 Direct Memory Access (DMA) Control and Status
1663 * Register channel 5 (read/write).
1664 * DBSA5 Direct Memory Access (DMA) Buffer Start address
1665 * register A channel 5 (read/write).
1666 * DBTA5 Direct Memory Access (DMA) Buffer Transfer count
1667 * register A channel 5 (read/write).
1668 * DBSB5 Direct Memory Access (DMA) Buffer Start address
1669 * register B channel 5 (read/write).
1670 * DBTB5 Direct Memory Access (DMA) Buffer Transfer count
1671 * register B channel 5 (read/write).
1672 */
1673
1674#define DMASp 0x00000020 /* DMA control reg. Space [byte] */
1675
1676#define DDAR(Nb) __REG(0xB0000000 + (Nb)*DMASp) /* DMA Device Address Reg. channel [0..5] */
1677#define SetDCSR(Nb) __REG(0xB0000004 + (Nb)*DMASp) /* Set DMA Control & Status Reg. channel [0..5] (write) */
1678#define ClrDCSR(Nb) __REG(0xB0000008 + (Nb)*DMASp) /* Clear DMA Control & Status Reg. channel [0..5] (write) */
1679#define RdDCSR(Nb) __REG(0xB000000C + (Nb)*DMASp) /* Read DMA Control & Status Reg. channel [0..5] (read) */
1680#define DBSA(Nb) __REG(0xB0000010 + (Nb)*DMASp) /* DMA Buffer Start address reg. A channel [0..5] */
1681#define DBTA(Nb) __REG(0xB0000014 + (Nb)*DMASp) /* DMA Buffer Transfer count reg. A channel [0..5] */
1682#define DBSB(Nb) __REG(0xB0000018 + (Nb)*DMASp) /* DMA Buffer Start address reg. B channel [0..5] */
1683#define DBTB(Nb) __REG(0xB000001C + (Nb)*DMASp) /* DMA Buffer Transfer count reg. B channel [0..5] */
1684
1685#define DDAR_RW 0x00000001 /* device data Read/Write */
1686#define DDAR_DevWr (DDAR_RW*0) /* Device data Write */
1687 /* (memory -> device) */
1688#define DDAR_DevRd (DDAR_RW*1) /* Device data Read */
1689 /* (device -> memory) */
1690#define DDAR_E 0x00000002 /* big/little Endian device */
1691#define DDAR_LtlEnd (DDAR_E*0) /* Little Endian device */
1692#define DDAR_BigEnd (DDAR_E*1) /* Big Endian device */
1693#define DDAR_BS 0x00000004 /* device Burst Size */
1694#define DDAR_Brst4 (DDAR_BS*0) /* Burst-of-4 device */
1695#define DDAR_Brst8 (DDAR_BS*1) /* Burst-of-8 device */
1696#define DDAR_DW 0x00000008 /* device Data Width */
1697#define DDAR_8BitDev (DDAR_DW*0) /* 8-Bit Device */
1698#define DDAR_16BitDev (DDAR_DW*1) /* 16-Bit Device */
1699#define DDAR_DS Fld (4, 4) /* Device Select */
1700#define DDAR_Ser0UDCTr /* Ser. port 0 UDC Transmit */ \
1701 (0x0 << FShft (DDAR_DS))
1702#define DDAR_Ser0UDCRc /* Ser. port 0 UDC Receive */ \
1703 (0x1 << FShft (DDAR_DS))
1704#define DDAR_Ser1SDLCTr /* Ser. port 1 SDLC Transmit */ \
1705 (0x2 << FShft (DDAR_DS))
1706#define DDAR_Ser1SDLCRc /* Ser. port 1 SDLC Receive */ \
1707 (0x3 << FShft (DDAR_DS))
1708#define DDAR_Ser1UARTTr /* Ser. port 1 UART Transmit */ \
1709 (0x4 << FShft (DDAR_DS))
1710#define DDAR_Ser1UARTRc /* Ser. port 1 UART Receive */ \
1711 (0x5 << FShft (DDAR_DS))
1712#define DDAR_Ser2ICPTr /* Ser. port 2 ICP Transmit */ \
1713 (0x6 << FShft (DDAR_DS))
1714#define DDAR_Ser2ICPRc /* Ser. port 2 ICP Receive */ \
1715 (0x7 << FShft (DDAR_DS))
1716#define DDAR_Ser3UARTTr /* Ser. port 3 UART Transmit */ \
1717 (0x8 << FShft (DDAR_DS))
1718#define DDAR_Ser3UARTRc /* Ser. port 3 UART Receive */ \
1719 (0x9 << FShft (DDAR_DS))
1720#define DDAR_Ser4MCP0Tr /* Ser. port 4 MCP 0 Transmit */ \
1721 /* (audio) */ \
1722 (0xA << FShft (DDAR_DS))
1723#define DDAR_Ser4MCP0Rc /* Ser. port 4 MCP 0 Receive */ \
1724 /* (audio) */ \
1725 (0xB << FShft (DDAR_DS))
1726#define DDAR_Ser4MCP1Tr /* Ser. port 4 MCP 1 Transmit */ \
1727 /* (telecom) */ \
1728 (0xC << FShft (DDAR_DS))
1729#define DDAR_Ser4MCP1Rc /* Ser. port 4 MCP 1 Receive */ \
1730 /* (telecom) */ \
1731 (0xD << FShft (DDAR_DS))
1732#define DDAR_Ser4SSPTr /* Ser. port 4 SSP Transmit */ \
1733 (0xE << FShft (DDAR_DS))
1734#define DDAR_Ser4SSPRc /* Ser. port 4 SSP Receive */ \
1735 (0xF << FShft (DDAR_DS))
1736#define DDAR_DA Fld (24, 8) /* Device Address */
1737#define DDAR_DevAdd(Add) /* Device Address */ \
1738 (((Add) & 0xF0000000) | \
1739 (((Add) & 0X003FFFFC) << (FShft (DDAR_DA) - 2)))
1740#define DDAR_Ser0UDCWr /* Ser. port 0 UDC Write */ \
1741 (DDAR_DevWr + DDAR_Brst8 + DDAR_8BitDev + \
1742 DDAR_Ser0UDCTr + DDAR_DevAdd (__PREG(Ser0UDCDR)))
1743#define DDAR_Ser0UDCRd /* Ser. port 0 UDC Read */ \
1744 (DDAR_DevRd + DDAR_Brst8 + DDAR_8BitDev + \
1745 DDAR_Ser0UDCRc + DDAR_DevAdd (__PREG(Ser0UDCDR)))
1746#define DDAR_Ser1UARTWr /* Ser. port 1 UART Write */ \
1747 (DDAR_DevWr + DDAR_Brst4 + DDAR_8BitDev + \
1748 DDAR_Ser1UARTTr + DDAR_DevAdd (__PREG(Ser1UTDR)))
1749#define DDAR_Ser1UARTRd /* Ser. port 1 UART Read */ \
1750 (DDAR_DevRd + DDAR_Brst4 + DDAR_8BitDev + \
1751 DDAR_Ser1UARTRc + DDAR_DevAdd (__PREG(Ser1UTDR)))
1752#define DDAR_Ser1SDLCWr /* Ser. port 1 SDLC Write */ \
1753 (DDAR_DevWr + DDAR_Brst4 + DDAR_8BitDev + \
1754 DDAR_Ser1SDLCTr + DDAR_DevAdd (__PREG(Ser1SDDR)))
1755#define DDAR_Ser1SDLCRd /* Ser. port 1 SDLC Read */ \
1756 (DDAR_DevRd + DDAR_Brst4 + DDAR_8BitDev + \
1757 DDAR_Ser1SDLCRc + DDAR_DevAdd (__PREG(Ser1SDDR)))
1758#define DDAR_Ser2UARTWr /* Ser. port 2 UART Write */ \
1759 (DDAR_DevWr + DDAR_Brst4 + DDAR_8BitDev + \
1760 DDAR_Ser2ICPTr + DDAR_DevAdd (__PREG(Ser2UTDR)))
1761#define DDAR_Ser2UARTRd /* Ser. port 2 UART Read */ \
1762 (DDAR_DevRd + DDAR_Brst4 + DDAR_8BitDev + \
1763 DDAR_Ser2ICPRc + DDAR_DevAdd (__PREG(Ser2UTDR)))
1764#define DDAR_Ser2HSSPWr /* Ser. port 2 HSSP Write */ \
1765 (DDAR_DevWr + DDAR_Brst8 + DDAR_8BitDev + \
1766 DDAR_Ser2ICPTr + DDAR_DevAdd (__PREG(Ser2HSDR)))
1767#define DDAR_Ser2HSSPRd /* Ser. port 2 HSSP Read */ \
1768 (DDAR_DevRd + DDAR_Brst8 + DDAR_8BitDev + \
1769 DDAR_Ser2ICPRc + DDAR_DevAdd (__PREG(Ser2HSDR)))
1770#define DDAR_Ser3UARTWr /* Ser. port 3 UART Write */ \
1771 (DDAR_DevWr + DDAR_Brst4 + DDAR_8BitDev + \
1772 DDAR_Ser3UARTTr + DDAR_DevAdd (__PREG(Ser3UTDR)))
1773#define DDAR_Ser3UARTRd /* Ser. port 3 UART Read */ \
1774 (DDAR_DevRd + DDAR_Brst4 + DDAR_8BitDev + \
1775 DDAR_Ser3UARTRc + DDAR_DevAdd (__PREG(Ser3UTDR)))
1776#define DDAR_Ser4MCP0Wr /* Ser. port 4 MCP 0 Write (audio) */ \
1777 (DDAR_DevWr + DDAR_Brst4 + DDAR_16BitDev + \
1778 DDAR_Ser4MCP0Tr + DDAR_DevAdd (__PREG(Ser4MCDR0)))
1779#define DDAR_Ser4MCP0Rd /* Ser. port 4 MCP 0 Read (audio) */ \
1780 (DDAR_DevRd + DDAR_Brst4 + DDAR_16BitDev + \
1781 DDAR_Ser4MCP0Rc + DDAR_DevAdd (__PREG(Ser4MCDR0)))
1782#define DDAR_Ser4MCP1Wr /* Ser. port 4 MCP 1 Write */ \
1783 /* (telecom) */ \
1784 (DDAR_DevWr + DDAR_Brst4 + DDAR_16BitDev + \
1785 DDAR_Ser4MCP1Tr + DDAR_DevAdd (__PREG(Ser4MCDR1)))
1786#define DDAR_Ser4MCP1Rd /* Ser. port 4 MCP 1 Read */ \
1787 /* (telecom) */ \
1788 (DDAR_DevRd + DDAR_Brst4 + DDAR_16BitDev + \
1789 DDAR_Ser4MCP1Rc + DDAR_DevAdd (__PREG(Ser4MCDR1)))
1790#define DDAR_Ser4SSPWr /* Ser. port 4 SSP Write (16 bits) */ \
1791 (DDAR_DevWr + DDAR_Brst4 + DDAR_16BitDev + \
1792 DDAR_Ser4SSPTr + DDAR_DevAdd (__PREG(Ser4SSDR)))
1793#define DDAR_Ser4SSPRd /* Ser. port 4 SSP Read (16 bits) */ \
1794 (DDAR_DevRd + DDAR_Brst4 + DDAR_16BitDev + \
1795 DDAR_Ser4SSPRc + DDAR_DevAdd (__PREG(Ser4SSDR)))
1796
1797#define DCSR_RUN 0x00000001 /* DMA RUNing */
1798#define DCSR_IE 0x00000002 /* DMA Interrupt Enable */
1799#define DCSR_ERROR 0x00000004 /* DMA ERROR */
1800#define DCSR_DONEA 0x00000008 /* DONE DMA transfer buffer A */
1801#define DCSR_STRTA 0x00000010 /* STaRTed DMA transfer buffer A */
1802#define DCSR_DONEB 0x00000020 /* DONE DMA transfer buffer B */
1803#define DCSR_STRTB 0x00000040 /* STaRTed DMA transfer buffer B */
1804#define DCSR_BIU 0x00000080 /* DMA Buffer In Use */
1805#define DCSR_BufA (DCSR_BIU*0) /* DMA Buffer A in use */
1806#define DCSR_BufB (DCSR_BIU*1) /* DMA Buffer B in use */
1807
1808#define DBT_TC Fld (13, 0) /* Transfer Count */
1809#define DBTA_TCA DBT_TC /* Transfer Count buffer A */
1810#define DBTB_TCB DBT_TC /* Transfer Count buffer B */
1811
1812
1813/*
1814 * Liquid Crystal Display (LCD) control registers
1815 *
1816 * Registers
1817 * LCCR0 Liquid Crystal Display (LCD) Control Register 0
1818 * (read/write).
1819 * [Bits LDM, BAM, and ERM are only implemented in
1820 * versions 2.0 (rev. = 8) and higher of the StrongARM
1821 * SA-1100.]
1822 * LCSR Liquid Crystal Display (LCD) Status Register
1823 * (read/write).
1824 * [Bit LDD can be only read in versions 1.0 (rev. = 1)
1825 * and 1.1 (rev. = 2) of the StrongARM SA-1100, it can be
1826 * read and written (cleared) in versions 2.0 (rev. = 8)
1827 * and higher.]
1828 * DBAR1 Liquid Crystal Display (LCD) Direct Memory Access
1829 * (DMA) Base Address Register channel 1 (read/write).
1830 * DCAR1 Liquid Crystal Display (LCD) Direct Memory Access
1831 * (DMA) Current Address Register channel 1 (read).
1832 * DBAR2 Liquid Crystal Display (LCD) Direct Memory Access
1833 * (DMA) Base Address Register channel 2 (read/write).
1834 * DCAR2 Liquid Crystal Display (LCD) Direct Memory Access
1835 * (DMA) Current Address Register channel 2 (read).
1836 * LCCR1 Liquid Crystal Display (LCD) Control Register 1
1837 * (read/write).
1838 * [The LCCR1 register can be only written in
1839 * versions 1.0 (rev. = 1) and 1.1 (rev. = 2) of the
1840 * StrongARM SA-1100, it can be written and read in
1841 * versions 2.0 (rev. = 8) and higher.]
1842 * LCCR2 Liquid Crystal Display (LCD) Control Register 2
1843 * (read/write).
1844 * [The LCCR1 register can be only written in
1845 * versions 1.0 (rev. = 1) and 1.1 (rev. = 2) of the
1846 * StrongARM SA-1100, it can be written and read in
1847 * versions 2.0 (rev. = 8) and higher.]
1848 * LCCR3 Liquid Crystal Display (LCD) Control Register 3
1849 * (read/write).
1850 * [The LCCR1 register can be only written in
1851 * versions 1.0 (rev. = 1) and 1.1 (rev. = 2) of the
1852 * StrongARM SA-1100, it can be written and read in
1853 * versions 2.0 (rev. = 8) and higher. Bit PCP is only
1854 * implemented in versions 2.0 (rev. = 8) and higher of
1855 * the StrongARM SA-1100.]
1856 *
1857 * Clocks
1858 * fcpu, Tcpu Frequency, period of the CPU core clock (CCLK).
1859 * fmem, Tmem Frequency, period of the memory clock (fmem = fcpu/2).
1860 * fpix, Tpix Frequency, period of the pixel clock.
1861 * fln, Tln Frequency, period of the line clock.
1862 * fac, Tac Frequency, period of the AC bias clock.
1863 */
1864
1865#define LCD_PEntrySp 2 /* LCD Palette Entry Space [byte] */
1866#define LCD_4BitPSp /* LCD 4-Bit pixel Palette Space */ \
1867 /* [byte] */ \
1868 (16*LCD_PEntrySp)
1869#define LCD_8BitPSp /* LCD 8-Bit pixel Palette Space */ \
1870 /* [byte] */ \
1871 (256*LCD_PEntrySp)
1872#define LCD_12_16BitPSp /* LCD 12/16-Bit pixel */ \
1873 /* dummy-Palette Space [byte] */ \
1874 (16*LCD_PEntrySp)
1875
1876#define LCD_PGrey Fld (4, 0) /* LCD Palette entry Grey value */
1877#define LCD_PBlue Fld (4, 0) /* LCD Palette entry Blue value */
1878#define LCD_PGreen Fld (4, 4) /* LCD Palette entry Green value */
1879#define LCD_PRed Fld (4, 8) /* LCD Palette entry Red value */
1880#define LCD_PBS Fld (2, 12) /* LCD Pixel Bit Size */
1881#define LCD_4Bit /* LCD 4-Bit pixel mode */ \
1882 (0 << FShft (LCD_PBS))
1883#define LCD_8Bit /* LCD 8-Bit pixel mode */ \
1884 (1 << FShft (LCD_PBS))
1885#define LCD_12_16Bit /* LCD 12/16-Bit pixel mode */ \
1886 (2 << FShft (LCD_PBS))
1887
1888#define LCD_Int0_0 0x0 /* LCD Intensity = 0.0% = 0 */
1889#define LCD_Int11_1 0x1 /* LCD Intensity = 11.1% = 1/9 */
1890#define LCD_Int20_0 0x2 /* LCD Intensity = 20.0% = 1/5 */
1891#define LCD_Int26_7 0x3 /* LCD Intensity = 26.7% = 4/15 */
1892#define LCD_Int33_3 0x4 /* LCD Intensity = 33.3% = 3/9 */
1893#define LCD_Int40_0 0x5 /* LCD Intensity = 40.0% = 2/5 */
1894#define LCD_Int44_4 0x6 /* LCD Intensity = 44.4% = 4/9 */
1895#define LCD_Int50_0 0x7 /* LCD Intensity = 50.0% = 1/2 */
1896#define LCD_Int55_6 0x8 /* LCD Intensity = 55.6% = 5/9 */
1897#define LCD_Int60_0 0x9 /* LCD Intensity = 60.0% = 3/5 */
1898#define LCD_Int66_7 0xA /* LCD Intensity = 66.7% = 6/9 */
1899#define LCD_Int73_3 0xB /* LCD Intensity = 73.3% = 11/15 */
1900#define LCD_Int80_0 0xC /* LCD Intensity = 80.0% = 4/5 */
1901#define LCD_Int88_9 0xD /* LCD Intensity = 88.9% = 8/9 */
1902#define LCD_Int100_0 0xE /* LCD Intensity = 100.0% = 1 */
1903#define LCD_Int100_0A 0xF /* LCD Intensity = 100.0% = 1 */
1904 /* (Alternative) */
1905
1906#define LCCR0 __REG(0xB0100000) /* LCD Control Reg. 0 */
1907#define LCSR __REG(0xB0100004) /* LCD Status Reg. */
1908#define DBAR1 __REG(0xB0100010) /* LCD DMA Base Address Reg. channel 1 */
1909#define DCAR1 __REG(0xB0100014) /* LCD DMA Current Address Reg. channel 1 */
1910#define DBAR2 __REG(0xB0100018) /* LCD DMA Base Address Reg. channel 2 */
1911#define DCAR2 __REG(0xB010001C) /* LCD DMA Current Address Reg. channel 2 */
1912#define LCCR1 __REG(0xB0100020) /* LCD Control Reg. 1 */
1913#define LCCR2 __REG(0xB0100024) /* LCD Control Reg. 2 */
1914#define LCCR3 __REG(0xB0100028) /* LCD Control Reg. 3 */
1915
1916#define LCCR0_LEN 0x00000001 /* LCD ENable */
1917#define LCCR0_CMS 0x00000002 /* Color/Monochrome display Select */
1918#define LCCR0_Color (LCCR0_CMS*0) /* Color display */
1919#define LCCR0_Mono (LCCR0_CMS*1) /* Monochrome display */
1920#define LCCR0_SDS 0x00000004 /* Single/Dual panel display */
1921 /* Select */
1922#define LCCR0_Sngl (LCCR0_SDS*0) /* Single panel display */
1923#define LCCR0_Dual (LCCR0_SDS*1) /* Dual panel display */
1924#define LCCR0_LDM 0x00000008 /* LCD Disable done (LDD) */
1925 /* interrupt Mask (disable) */
1926#define LCCR0_BAM 0x00000010 /* Base Address update (BAU) */
1927 /* interrupt Mask (disable) */
1928#define LCCR0_ERM 0x00000020 /* LCD ERror (BER, IOL, IUL, IOU, */
1929 /* IUU, OOL, OUL, OOU, and OUU) */
1930 /* interrupt Mask (disable) */
1931#define LCCR0_PAS 0x00000080 /* Passive/Active display Select */
1932#define LCCR0_Pas (LCCR0_PAS*0) /* Passive display (STN) */
1933#define LCCR0_Act (LCCR0_PAS*1) /* Active display (TFT) */
1934#define LCCR0_BLE 0x00000100 /* Big/Little Endian select */
1935#define LCCR0_LtlEnd (LCCR0_BLE*0) /* Little Endian frame buffer */
1936#define LCCR0_BigEnd (LCCR0_BLE*1) /* Big Endian frame buffer */
1937#define LCCR0_DPD 0x00000200 /* Double Pixel Data (monochrome */
1938 /* display mode) */
1939#define LCCR0_4PixMono (LCCR0_DPD*0) /* 4-Pixel/clock Monochrome */
1940 /* display */
1941#define LCCR0_8PixMono (LCCR0_DPD*1) /* 8-Pixel/clock Monochrome */
1942 /* display */
1943#define LCCR0_PDD Fld (8, 12) /* Palette DMA request Delay */
1944 /* [Tmem] */
1945#define LCCR0_DMADel(Tcpu) /* palette DMA request Delay */ \
1946 /* [0..510 Tcpu] */ \
1947 ((Tcpu)/2 << FShft (LCCR0_PDD))
1948
1949#define LCSR_LDD 0x00000001 /* LCD Disable Done */
1950#define LCSR_BAU 0x00000002 /* Base Address Update (read) */
1951#define LCSR_BER 0x00000004 /* Bus ERror */
1952#define LCSR_ABC 0x00000008 /* AC Bias clock Count */
1953#define LCSR_IOL 0x00000010 /* Input FIFO Over-run Lower */
1954 /* panel */
1955#define LCSR_IUL 0x00000020 /* Input FIFO Under-run Lower */
1956 /* panel */
1957#define LCSR_IOU 0x00000040 /* Input FIFO Over-run Upper */
1958 /* panel */
1959#define LCSR_IUU 0x00000080 /* Input FIFO Under-run Upper */
1960 /* panel */
1961#define LCSR_OOL 0x00000100 /* Output FIFO Over-run Lower */
1962 /* panel */
1963#define LCSR_OUL 0x00000200 /* Output FIFO Under-run Lower */
1964 /* panel */
1965#define LCSR_OOU 0x00000400 /* Output FIFO Over-run Upper */
1966 /* panel */
1967#define LCSR_OUU 0x00000800 /* Output FIFO Under-run Upper */
1968 /* panel */
1969
1970#define LCCR1_PPL Fld (6, 4) /* Pixels Per Line/16 - 1 */
1971#define LCCR1_DisWdth(Pixel) /* Display Width [16..1024 pix.] */ \
1972 (((Pixel) - 16)/16 << FShft (LCCR1_PPL))
1973#define LCCR1_HSW Fld (6, 10) /* Horizontal Synchronization */
1974 /* pulse Width - 1 [Tpix] (L_LCLK) */
1975#define LCCR1_HorSnchWdth(Tpix) /* Horizontal Synchronization */ \
1976 /* pulse Width [1..64 Tpix] */ \
1977 (((Tpix) - 1) << FShft (LCCR1_HSW))
1978#define LCCR1_ELW Fld (8, 16) /* End-of-Line pixel clock Wait */
1979 /* count - 1 [Tpix] */
1980#define LCCR1_EndLnDel(Tpix) /* End-of-Line Delay */ \
1981 /* [1..256 Tpix] */ \
1982 (((Tpix) - 1) << FShft (LCCR1_ELW))
1983#define LCCR1_BLW Fld (8, 24) /* Beginning-of-Line pixel clock */
1984 /* Wait count - 1 [Tpix] */
1985#define LCCR1_BegLnDel(Tpix) /* Beginning-of-Line Delay */ \
1986 /* [1..256 Tpix] */ \
1987 (((Tpix) - 1) << FShft (LCCR1_BLW))
1988
1989#define LCCR2_LPP Fld (10, 0) /* Line Per Panel - 1 */
1990#define LCCR2_DisHght(Line) /* Display Height [1..1024 lines] */ \
1991 (((Line) - 1) << FShft (LCCR2_LPP))
1992#define LCCR2_VSW Fld (6, 10) /* Vertical Synchronization pulse */
1993 /* Width - 1 [Tln] (L_FCLK) */
1994#define LCCR2_VrtSnchWdth(Tln) /* Vertical Synchronization pulse */ \
1995 /* Width [1..64 Tln] */ \
1996 (((Tln) - 1) << FShft (LCCR2_VSW))
1997#define LCCR2_EFW Fld (8, 16) /* End-of-Frame line clock Wait */
1998 /* count [Tln] */
1999#define LCCR2_EndFrmDel(Tln) /* End-of-Frame Delay */ \
2000 /* [0..255 Tln] */ \
2001 ((Tln) << FShft (LCCR2_EFW))
2002#define LCCR2_BFW Fld (8, 24) /* Beginning-of-Frame line clock */
2003 /* Wait count [Tln] */
2004#define LCCR2_BegFrmDel(Tln) /* Beginning-of-Frame Delay */ \
2005 /* [0..255 Tln] */ \
2006 ((Tln) << FShft (LCCR2_BFW))
2007
2008#define LCCR3_PCD Fld (8, 0) /* Pixel Clock Divisor/2 - 2 */
2009 /* [1..255] (L_PCLK) */
2010 /* fpix = fcpu/(2*(PCD + 2)) */
2011 /* Tpix = 2*(PCD + 2)*Tcpu */
2012#define LCCR3_PixClkDiv(Div) /* Pixel Clock Divisor [6..514] */ \
2013 (((Div) - 4)/2 << FShft (LCCR3_PCD))
2014 /* fpix = fcpu/(2*Floor (Div/2)) */
2015 /* Tpix = 2*Floor (Div/2)*Tcpu */
2016#define LCCR3_CeilPixClkDiv(Div) /* Ceil. of PixClkDiv [6..514] */ \
2017 (((Div) - 3)/2 << FShft (LCCR3_PCD))
2018 /* fpix = fcpu/(2*Ceil (Div/2)) */
2019 /* Tpix = 2*Ceil (Div/2)*Tcpu */
2020#define LCCR3_ACB Fld (8, 8) /* AC Bias clock half period - 1 */
2021 /* [Tln] (L_BIAS) */
2022#define LCCR3_ACBsDiv(Div) /* AC Bias clock Divisor [2..512] */ \
2023 (((Div) - 2)/2 << FShft (LCCR3_ACB))
2024 /* fac = fln/(2*Floor (Div/2)) */
2025 /* Tac = 2*Floor (Div/2)*Tln */
2026#define LCCR3_CeilACBsDiv(Div) /* Ceil. of ACBsDiv [2..512] */ \
2027 (((Div) - 1)/2 << FShft (LCCR3_ACB))
2028 /* fac = fln/(2*Ceil (Div/2)) */
2029 /* Tac = 2*Ceil (Div/2)*Tln */
2030#define LCCR3_API Fld (4, 16) /* AC bias Pin transitions per */
2031 /* Interrupt */
2032#define LCCR3_ACBsCntOff /* AC Bias clock transition Count */ \
2033 /* Off */ \
2034 (0 << FShft (LCCR3_API))
2035#define LCCR3_ACBsCnt(Trans) /* AC Bias clock transition Count */ \
2036 /* [1..15] */ \
2037 ((Trans) << FShft (LCCR3_API))
2038#define LCCR3_VSP 0x00100000 /* Vertical Synchronization pulse */
2039 /* Polarity (L_FCLK) */
2040#define LCCR3_VrtSnchH (LCCR3_VSP*0) /* Vertical Synchronization pulse */
2041 /* active High */
2042#define LCCR3_VrtSnchL (LCCR3_VSP*1) /* Vertical Synchronization pulse */
2043 /* active Low */
2044#define LCCR3_HSP 0x00200000 /* Horizontal Synchronization */
2045 /* pulse Polarity (L_LCLK) */
2046#define LCCR3_HorSnchH (LCCR3_HSP*0) /* Horizontal Synchronization */
2047 /* pulse active High */
2048#define LCCR3_HorSnchL (LCCR3_HSP*1) /* Horizontal Synchronization */
2049 /* pulse active Low */
2050#define LCCR3_PCP 0x00400000 /* Pixel Clock Polarity (L_PCLK) */
2051#define LCCR3_PixRsEdg (LCCR3_PCP*0) /* Pixel clock Rising-Edge */
2052#define LCCR3_PixFlEdg (LCCR3_PCP*1) /* Pixel clock Falling-Edge */
2053#define LCCR3_OEP 0x00800000 /* Output Enable Polarity (L_BIAS, */
2054 /* active display mode) */
2055#define LCCR3_OutEnH (LCCR3_OEP*0) /* Output Enable active High */
2056#define LCCR3_OutEnL (LCCR3_OEP*1) /* Output Enable active Low */
2057
2058#ifndef __ASSEMBLY__
2059extern unsigned int processor_id;
2060#endif
2061
2062#define CPU_REVISION (processor_id & 15)
2063#define CPU_SA1110_A0 (0)
2064#define CPU_SA1110_B0 (4)
2065#define CPU_SA1110_B1 (5)
2066#define CPU_SA1110_B2 (6)
2067#define CPU_SA1110_B4 (8)
2068
2069#define CPU_SA1100_ID (0x4401a110)
2070#define CPU_SA1100_MASK (0xfffffff0)
2071#define CPU_SA1110_ID (0x6901b110)
2072#define CPU_SA1110_MASK (0xfffffff0)
diff --git a/arch/arm/mach-sa1100/include/mach/SA-1101.h b/arch/arm/mach-sa1100/include/mach/SA-1101.h
new file mode 100644
index 000000000000..5d2ad7db991c
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/SA-1101.h
@@ -0,0 +1,925 @@
1/*
2 * SA-1101.h
3 *
4 * Copyright (c) Peter Danielsson 1999
5 *
6 * Definition of constants related to the sa1101
7 * support chip for the sa1100
8 *
9 */
10
11
12/* Be sure that virtual mapping is defined right */
13#ifndef __ASM_ARCH_HARDWARE_H
14#error You must include hardware.h not SA-1101.h
15#endif
16
17#ifndef SA1101_BASE
18#error You must define SA-1101 physical base address
19#endif
20
21#ifndef LANGUAGE
22# ifdef __ASSEMBLY__
23# define LANGUAGE Assembly
24# else
25# define LANGUAGE C
26# endif
27#endif
28
29/*
30 * We have mapped the sa1101 depending on the value of SA1101_BASE.
31 * It then appears from 0xf4000000.
32 */
33
34#define SA1101_p2v( x ) ((x) - SA1101_BASE + 0xf4000000)
35#define SA1101_v2p( x ) ((x) - 0xf4000000 + SA1101_BASE)
36
37#ifndef SA1101_p2v
38#define SA1101_p2v(PhAdd) (PhAdd)
39#endif
40
41#include <mach/bitfield.h>
42
43#define C 0
44#define Assembly 1
45
46
47/*
48 * Memory map
49 */
50
51#define __SHMEM_CONTROL0 0x00000000
52#define __SYSTEM_CONTROL1 0x00000400
53#define __ARBITER 0x00020000
54#define __SYSTEM_CONTROL2 0x00040000
55#define __SYSTEM_CONTROL3 0x00060000
56#define __PARALLEL_PORT 0x00080000
57#define __VIDMEM_CONTROL 0x00100000
58#define __UPDATE_FIFO 0x00120000
59#define __SHMEM_CONTROL1 0x00140000
60#define __INTERRUPT_CONTROL 0x00160000
61#define __USB_CONTROL 0x00180000
62#define __TRACK_INTERFACE 0x001a0000
63#define __MOUSE_INTERFACE 0x001b0000
64#define __KEYPAD_INTERFACE 0x001c0000
65#define __PCMCIA_INTERFACE 0x001e0000
66#define __VGA_CONTROL 0x00200000
67#define __GPIO_INTERFACE 0x00300000
68
69/*
70 * Macro that calculates real address for registers in the SA-1101
71 */
72
73#define _SA1101( x ) ((x) + SA1101_BASE)
74
75/*
76 * Interface and shared memory controller registers
77 *
78 * Registers
79 * SKCR SA-1101 control register (read/write)
80 * SMCR Shared Memory Controller Register
81 * SNPR Snoop Register
82 */
83
84#define _SKCR _SA1101( 0x00000000 ) /* SA-1101 Control Reg. */
85#define _SMCR _SA1101( 0x00140000 ) /* Shared Mem. Control Reg. */
86#define _SNPR _SA1101( 0x00140400 ) /* Snoop Reg. */
87
88#if LANGUAGE == C
89#define SKCR (*((volatile Word *) SA1101_p2v (_SKCR)))
90#define SMCR (*((volatile Word *) SA1101_p2v (_SMCR)))
91#define SNPR (*((volatile Word *) SA1101_p2v (_SNPR)))
92
93#define SKCR_PLLEn 0x0001 /* Enable On-Chip PLL */
94#define SKCR_BCLKEn 0x0002 /* Enables BCLK */
95#define SKCR_Sleep 0x0004 /* Sleep Mode */
96#define SKCR_IRefEn 0x0008 /* DAC Iref input enable */
97#define SKCR_VCOON 0x0010 /* VCO bias */
98#define SKCR_ScanTestEn 0x0020 /* Enables scan test */
99#define SKCR_ClockTestEn 0x0040 /* Enables clock test */
100
101#define SMCR_DCAC Fld(2,0) /* Number of column address bits */
102#define SMCR_DRAC Fld(2,2) /* Number of row address bits */
103#define SMCR_ArbiterBias 0x0008 /* favor video or USB */
104#define SMCR_TopVidMem Fld(4,5) /* Top 4 bits of vidmem addr. */
105
106#define SMCR_ColAdrBits( x ) /* col. addr bits 8..11 */ \
107 (( (x) - 8 ) << FShft (SMCR_DCAC))
108#define SMCR_RowAdrBits( x ) /* row addr bits 9..12 */\
109 (( (x) - 9 ) << FShft (SMCR_DRAC))
110
111#define SNPR_VFBstart Fld(12,0) /* Video frame buffer addr */
112#define SNPR_VFBsize Fld(11,12) /* Video frame buffer size */
113#define SNPR_WholeBank (1 << 23) /* Whole bank bit */
114#define SNPR_BankSelect Fld(2,27) /* Bank select */
115#define SNPR_SnoopEn (1 << 31) /* Enable snoop operation */
116
117#define SNPR_Set_VFBsize( x ) /* set frame buffer size (in kb) */ \
118 ( (x) << FShft (SNPR_VFBsize))
119#define SNPR_Select_Bank(x) /* select bank 0 or 1 */ \
120 (( (x) + 1 ) << FShft (SNPR_BankSelect ))
121
122#endif /* LANGUAGE == C */
123
124/*
125 * Video Memory Controller
126 *
127 * Registers
128 * VMCCR Configuration register
129 * VMCAR VMC address register
130 * VMCDR VMC data register
131 *
132 */
133
134#define _VMCCR _SA1101( 0x00100000 ) /* Configuration register */
135#define _VMCAR _SA1101( 0x00101000 ) /* VMC address register */
136#define _VMCDR _SA1101( 0x00101400 ) /* VMC data register */
137
138#if LANGUAGE == C
139#define VMCCR (*((volatile Word *) SA1101_p2v (_VMCCR)))
140#define VMCAR (*((volatile Word *) SA1101_p2v (_VMCAR)))
141#define VMCDR (*((volatile Word *) SA1101_p2v (_VMCDR)))
142
143#define VMCCR_RefreshEn 0x0000 /* Enable memory refresh */
144#define VMCCR_Config 0x0001 /* DRAM size */
145#define VMCCR_RefPeriod Fld(2,3) /* Refresh period */
146#define VMCCR_StaleDataWait Fld(4,5) /* Stale FIFO data timeout counter */
147#define VMCCR_SleepState (1<<9) /* State of interface pins in sleep*/
148#define VMCCR_RefTest (1<<10) /* refresh test */
149#define VMCCR_RefLow Fld(6,11) /* refresh low counter */
150#define VMCCR_RefHigh Fld(7,17) /* refresh high counter */
151#define VMCCR_SDTCTest Fld(7,24) /* stale data timeout counter */
152#define VMCCR_ForceSelfRef (1<<31) /* Force self refresh */
153
154#endif LANGUAGE == C
155
156
157/* Update FIFO
158 *
159 * Registers
160 * UFCR Update FIFO Control Register
161 * UFSR Update FIFO Status Register
162 * UFLVLR update FIFO level register
163 * UFDR update FIFO data register
164 */
165
166#define _UFCR _SA1101(0x00120000) /* Update FIFO Control Reg. */
167#define _UFSR _SA1101(0x00120400) /* Update FIFO Status Reg. */
168#define _UFLVLR _SA1101(0x00120800) /* Update FIFO level reg. */
169#define _UFDR _SA1101(0x00120c00) /* Update FIFO data reg. */
170
171#if LANGUAGE == C
172
173#define UFCR (*((volatile Word *) SA1101_p2v (_UFCR)))
174#define UFSR (*((volatile Word *) SA1101_p2v (_UFSR)))
175#define UFLVLR (*((volatile Word *) SA1101_p2v (_UFLVLR)))
176#define UFDR (*((volatile Word *) SA1101_p2v (_UFDR)))
177
178
179#define UFCR_FifoThreshhold Fld(7,0) /* Level for FifoGTn flag */
180
181#define UFSR_FifoGTnFlag 0x01 /* FifoGTn flag */#define UFSR_FifoEmpty 0x80 /* FIFO is empty */
182
183#endif /* LANGUAGE == C */
184
185/* System Controller
186 *
187 * Registers
188 * SKPCR Power Control Register
189 * SKCDR Clock Divider Register
190 * DACDR1 DAC1 Data register
191 * DACDR2 DAC2 Data register
192 */
193
194#define _SKPCR _SA1101(0x00000400)
195#define _SKCDR _SA1101(0x00040000)
196#define _DACDR1 _SA1101(0x00060000)
197#define _DACDR2 _SA1101(0x00060400)
198
199#if LANGUAGE == C
200#define SKPCR (*((volatile Word *) SA1101_p2v (_SKPCR)))
201#define SKCDR (*((volatile Word *) SA1101_p2v (_SKCDR)))
202#define DACDR1 (*((volatile Word *) SA1101_p2v (_DACDR1)))
203#define DACDR2 (*((volatile Word *) SA1101_p2v (_DACDR2)))
204
205#define SKPCR_UCLKEn 0x01 /* USB Enable */
206#define SKPCR_PCLKEn 0x02 /* PS/2 Enable */
207#define SKPCR_ICLKEn 0x04 /* Interrupt Controller Enable */
208#define SKPCR_VCLKEn 0x08 /* Video Controller Enable */
209#define SKPCR_PICLKEn 0x10 /* parallel port Enable */
210#define SKPCR_DCLKEn 0x20 /* DACs Enable */
211#define SKPCR_nKPADEn 0x40 /* Multiplexer */
212
213#define SKCDR_PLLMul Fld(7,0) /* PLL Multiplier */
214#define SKCDR_VCLKEn Fld(2,7) /* Video controller clock divider */
215#define SKDCR_BCLKEn (1<<9) /* BCLK Divider */
216#define SKDCR_UTESTCLKEn (1<<10) /* Route USB clock during test mode */
217#define SKDCR_DivRValue Fld(6,11) /* Input clock divider for PLL */
218#define SKDCR_DivNValue Fld(5,17) /* Output clock divider for PLL */
219#define SKDCR_PLLRSH Fld(3,22) /* PLL bandwidth control */
220#define SKDCR_ChargePump (1<<25) /* Charge pump control */
221#define SKDCR_ClkTestMode (1<<26) /* Clock output test mode */
222#define SKDCR_ClkTestEn (1<<27) /* Test clock generator */
223#define SKDCR_ClkJitterCntl Fld(3,28) /* video clock jitter compensation */
224
225#define DACDR_DACCount Fld(8,0) /* Count value */
226#define DACDR1_DACCount DACDR_DACCount
227#define DACDR2_DACCount DACDR_DACCount
228
229#endif /* LANGUAGE == C */
230
231/*
232 * Parallel Port Interface
233 *
234 * Registers
235 * IEEE_Config IEEE mode selection and programmable attributes
236 * IEEE_Control Controls the states of IEEE port control outputs
237 * IEEE_Data Forward transfer data register
238 * IEEE_Addr Forward transfer address register
239 * IEEE_Status Port IO signal status register
240 * IEEE_IntStatus Port interrupts status register
241 * IEEE_FifoLevels Rx and Tx FIFO interrupt generation levels
242 * IEEE_InitTime Forward timeout counter initial value
243 * IEEE_TimerStatus Forward timeout counter current value
244 * IEEE_FifoReset Reset forward transfer FIFO
245 * IEEE_ReloadValue Counter reload value
246 * IEEE_TestControl Control testmode
247 * IEEE_TestDataIn Test data register
248 * IEEE_TestDataInEn Enable test data
249 * IEEE_TestCtrlIn Test control signals
250 * IEEE_TestCtrlInEn Enable test control signals
251 * IEEE_TestDataStat Current data bus value
252 *
253 */
254
255/*
256 * The control registers are defined as offsets from a base address
257 */
258
259#define _IEEE( x ) _SA1101( (x) + __PARALLEL_PORT )
260
261#define _IEEE_Config _IEEE( 0x0000 )
262#define _IEEE_Control _IEEE( 0x0400 )
263#define _IEEE_Data _IEEE( 0x4000 )
264#define _IEEE_Addr _IEEE( 0x0800 )
265#define _IEEE_Status _IEEE( 0x0c00 )
266#define _IEEE_IntStatus _IEEE( 0x1000 )
267#define _IEEE_FifoLevels _IEEE( 0x1400 )
268#define _IEEE_InitTime _IEEE( 0x1800 )
269#define _IEEE_TimerStatus _IEEE( 0x1c00 )
270#define _IEEE_FifoReset _IEEE( 0x2000 )
271#define _IEEE_ReloadValue _IEEE( 0x3c00 )
272#define _IEEE_TestControl _IEEE( 0x2400 )
273#define _IEEE_TestDataIn _IEEE( 0x2800 )
274#define _IEEE_TestDataInEn _IEEE( 0x2c00 )
275#define _IEEE_TestCtrlIn _IEEE( 0x3000 )
276#define _IEEE_TestCtrlInEn _IEEE( 0x3400 )
277#define _IEEE_TestDataStat _IEEE( 0x3800 )
278
279
280#if LANGUAGE == C
281#define IEEE_Config (*((volatile Word *) SA1101_p2v (_IEEE_Config)))
282#define IEEE_Control (*((volatile Word *) SA1101_p2v (_IEEE_Control)))
283#define IEEE_Data (*((volatile Word *) SA1101_p2v (_IEEE_Data)))
284#define IEEE_Addr (*((volatile Word *) SA1101_p2v (_IEEE_Addr)))
285#define IEEE_Status (*((volatile Word *) SA1101_p2v (_IEEE_Status)))
286#define IEEE_IntStatus (*((volatile Word *) SA1101_p2v (_IEEE_IntStatus)))
287#define IEEE_FifoLevels (*((volatile Word *) SA1101_p2v (_IEEE_FifoLevels)))
288#define IEEE_InitTime (*((volatile Word *) SA1101_p2v (_IEEE_InitTime)))
289#define IEEE_TimerStatus (*((volatile Word *) SA1101_p2v (_IEEE_TimerStatus)))
290#define IEEE_FifoReset (*((volatile Word *) SA1101_p2v (_IEEE_FifoReset)))
291#define IEEE_ReloadValue (*((volatile Word *) SA1101_p2v (_IEEE_ReloadValue)))
292#define IEEE_TestControl (*((volatile Word *) SA1101_p2v (_IEEE_TestControl)))
293#define IEEE_TestDataIn (*((volatile Word *) SA1101_p2v (_IEEE_TestDataIn)))
294#define IEEE_TestDataInEn (*((volatile Word *) SA1101_p2v (_IEEE_TestDataInEn)))
295#define IEEE_TestCtrlIn (*((volatile Word *) SA1101_p2v (_IEEE_TestCtrlIn)))
296#define IEEE_TestCtrlInEn (*((volatile Word *) SA1101_p2v (_IEEE_TestCtrlInEn)))
297#define IEEE_TestDataStat (*((volatile Word *) SA1101_p2v (_IEEE_TestDataStat)))
298
299
300#define IEEE_Config_M Fld(3,0) /* Mode select */
301#define IEEE_Config_D 0x04 /* FIFO access enable */
302#define IEEE_Config_B 0x08 /* 9-bit word enable */
303#define IEEE_Config_T 0x10 /* Data transfer enable */
304#define IEEE_Config_A 0x20 /* Data transfer direction */
305#define IEEE_Config_E 0x40 /* Timer enable */
306#define IEEE_Control_A 0x08 /* AutoFd output */
307#define IEEE_Control_E 0x04 /* Selectin output */
308#define IEEE_Control_T 0x02 /* Strobe output */
309#define IEEE_Control_I 0x01 /* Port init output */
310#define IEEE_Data_C (1<<31) /* Byte count */
311#define IEEE_Data_Db Fld(9,16) /* Data byte 2 */
312#define IEEE_Data_Da Fld(9,0) /* Data byte 1 */
313#define IEEE_Addr_A Fld(8,0) /* forward address transfer byte */
314#define IEEE_Status_A 0x0100 /* nAutoFd port output status */
315#define IEEE_Status_E 0x0080 /* nSelectIn port output status */
316#define IEEE_Status_T 0x0040 /* nStrobe port output status */
317#define IEEE_Status_I 0x0020 /* nInit port output status */
318#define IEEE_Status_B 0x0010 /* Busy port inout status */
319#define IEEE_Status_S 0x0008 /* Select port input status */
320#define IEEE_Status_K 0x0004 /* nAck port input status */
321#define IEEE_Status_F 0x0002 /* nFault port input status */
322#define IEEE_Status_R 0x0001 /* pError port input status */
323
324#define IEEE_IntStatus_IntReqDat 0x0100
325#define IEEE_IntStatus_IntReqEmp 0x0080
326#define IEEE_IntStatus_IntReqInt 0x0040
327#define IEEE_IntStatus_IntReqRav 0x0020
328#define IEEE_IntStatus_IntReqTim 0x0010
329#define IEEE_IntStatus_RevAddrComp 0x0008
330#define IEEE_IntStatus_RevDataComp 0x0004
331#define IEEE_IntStatus_FwdAddrComp 0x0002
332#define IEEE_IntStatus_FwdDataComp 0x0001
333#define IEEE_FifoLevels_RevFifoLevel 2
334#define IEEE_FifoLevels_FwdFifoLevel 1
335#define IEEE_InitTime_TimValInit Fld(22,0)
336#define IEEE_TimerStatus_TimValStat Fld(22,0)
337#define IEEE_ReloadValue_Reload Fld(4,0)
338
339#define IEEE_TestControl_RegClk 0x04
340#define IEEE_TestControl_ClockSelect Fld(2,1)
341#define IEEE_TestControl_TimerTestModeEn 0x01
342#define IEEE_TestCtrlIn_PError 0x10
343#define IEEE_TestCtrlIn_nFault 0x08
344#define IEEE_TestCtrlIn_nAck 0x04
345#define IEEE_TestCtrlIn_PSel 0x02
346#define IEEE_TestCtrlIn_Busy 0x01
347
348#endif /* LANGUAGE == C */
349
350/*
351 * VGA Controller
352 *
353 * Registers
354 * VideoControl Video Control Register
355 * VgaTiming0 VGA Timing Register 0
356 * VgaTiming1 VGA Timing Register 1
357 * VgaTiming2 VGA Timing Register 2
358 * VgaTiming3 VGA Timing Register 3
359 * VgaBorder VGA Border Color Register
360 * VgaDBAR VGADMA Base Address Register
361 * VgaDCAR VGADMA Channel Current Address Register
362 * VgaStatus VGA Status Register
363 * VgaInterruptMask VGA Interrupt Mask Register
364 * VgaPalette VGA Palette Registers
365 * DacControl DAC Control Register
366 * VgaTest VGA Controller Test Register
367 */
368
369#define _VGA( x ) _SA1101( ( x ) + __VGA_CONTROL )
370
371#define _VideoControl _VGA( 0x0000 )
372#define _VgaTiming0 _VGA( 0x0400 )
373#define _VgaTiming1 _VGA( 0x0800 )
374#define _VgaTiming2 _VGA( 0x0c00 )
375#define _VgaTiming3 _VGA( 0x1000 )
376#define _VgaBorder _VGA( 0x1400 )
377#define _VgaDBAR _VGA( 0x1800 )
378#define _VgaDCAR _VGA( 0x1c00 )
379#define _VgaStatus _VGA( 0x2000 )
380#define _VgaInterruptMask _VGA( 0x2400 )
381#define _VgaPalette _VGA( 0x40000 )
382#define _DacControl _VGA( 0x3000 )
383#define _VgaTest _VGA( 0x2c00 )
384
385#if (LANGUAGE == C)
386#define VideoControl (*((volatile Word *) SA1101_p2v (_VideoControl)))
387#define VgaTiming0 (*((volatile Word *) SA1101_p2v (_VgaTiming0)))
388#define VgaTiming1 (*((volatile Word *) SA1101_p2v (_VgaTiming1)))
389#define VgaTiming2 (*((volatile Word *) SA1101_p2v (_VgaTiming2)))
390#define VgaTiming3 (*((volatile Word *) SA1101_p2v (_VgaTiming3)))
391#define VgaBorder (*((volatile Word *) SA1101_p2v (_VgaBorder)))
392#define VgaDBAR (*((volatile Word *) SA1101_p2v (_VgaDBAR)))
393#define VgaDCAR (*((volatile Word *) SA1101_p2v (_VgaDCAR)))
394#define VgaStatus (*((volatile Word *) SA1101_p2v (_VgaStatus)))
395#define VgaInterruptMask (*((volatile Word *) SA1101_p2v (_VgaInterruptMask)))
396#define VgaPalette (*((volatile Word *) SA1101_p2v (_VgaPalette)))
397#define DacControl (*((volatile Word *) SA1101_p2v (_DacControl)))
398#define VgaTest (*((volatile Word *) SA1101_p2v (_VgaTest)))
399
400#define VideoControl_VgaEn 0x00000000
401#define VideoControl_BGR 0x00000001
402#define VideoControl_VCompVal Fld(2,2)
403#define VideoControl_VgaReq Fld(4,4)
404#define VideoControl_VBurstL Fld(4,8)
405#define VideoControl_VMode (1<<12)
406#define VideoControl_PalRead (1<<13)
407
408#define VgaTiming0_PPL Fld(6,2)
409#define VgaTiming0_HSW Fld(8,8)
410#define VgaTiming0_HFP Fld(8,16)
411#define VgaTiming0_HBP Fld(8,24)
412
413#define VgaTiming1_LPS Fld(10,0)
414#define VgaTiming1_VSW Fld(6,10)
415#define VgaTiming1_VFP Fld(8,16)
416#define VgaTiming1_VBP Fld(8,24)
417
418#define VgaTiming2_IVS 0x01
419#define VgaTiming2_IHS 0x02
420#define VgaTiming2_CVS 0x04
421#define VgaTiming2_CHS 0x08
422
423#define VgaTiming3_HBS Fld(8,0)
424#define VgaTiming3_HBE Fld(8,8)
425#define VgaTiming3_VBS Fld(8,16)
426#define VgaTiming3_VBE Fld(8,24)
427
428#define VgaBorder_BCOL Fld(24,0)
429
430#define VgaStatus_VFUF 0x01
431#define VgaStatus_VNext 0x02
432#define VgaStatus_VComp 0x04
433
434#define VgaInterruptMask_VFUFMask 0x00
435#define VgaInterruptMask_VNextMask 0x01
436#define VgaInterruptMask_VCompMask 0x02
437
438#define VgaPalette_R Fld(8,0)
439#define VgaPalette_G Fld(8,8)
440#define VgaPalette_B Fld(8,16)
441
442#define DacControl_DACON 0x0001
443#define DacControl_COMPON 0x0002
444#define DacControl_PEDON 0x0004
445#define DacControl_RTrim Fld(5,4)
446#define DacControl_GTrim Fld(5,9)
447#define DacControl_BTrim Fld(5,14)
448
449#define VgaTest_TDAC 0x00
450#define VgaTest_Datatest Fld(4,1)
451#define VgaTest_DACTESTDAC 0x10
452#define VgaTest_DACTESTOUT Fld(3,5)
453
454#endif /* LANGUAGE == C */
455
456/*
457 * USB Host Interface Controller
458 *
459 * Registers
460 * Revision
461 * Control
462 * CommandStatus
463 * InterruptStatus
464 * InterruptEnable
465 * HCCA
466 * PeriodCurrentED
467 * ControlHeadED
468 * BulkHeadED
469 * BulkCurrentED
470 * DoneHead
471 * FmInterval
472 * FmRemaining
473 * FmNumber
474 * PeriodicStart
475 * LSThreshold
476 * RhDescriptorA
477 * RhDescriptorB
478 * RhStatus
479 * RhPortStatus
480 * USBStatus
481 * USBReset
482 * USTAR
483 * USWER
484 * USRFR
485 * USNFR
486 * USTCSR
487 * USSR
488 *
489 */
490
491#define _USB( x ) _SA1101( ( x ) + __USB_CONTROL )
492
493
494#define _Revision _USB( 0x0000 )
495#define _Control _USB( 0x0888 )
496#define _CommandStatus _USB( 0x0c00 )
497#define _InterruptStatus _USB( 0x1000 )
498#define _InterruptEnable _USB( 0x1400 )
499#define _HCCA _USB( 0x1800 )
500#define _PeriodCurrentED _USB( 0x1c00 )
501#define _ControlHeadED _USB( 0x2000 )
502#define _BulkHeadED _USB( 0x2800 )
503#define _BulkCurrentED _USB( 0x2c00 )
504#define _DoneHead _USB( 0x3000 )
505#define _FmInterval _USB( 0x3400 )
506#define _FmRemaining _USB( 0x3800 )
507#define _FmNumber _USB( 0x3c00 )
508#define _PeriodicStart _USB( 0x4000 )
509#define _LSThreshold _USB( 0x4400 )
510#define _RhDescriptorA _USB( 0x4800 )
511#define _RhDescriptorB _USB( 0x4c00 )
512#define _RhStatus _USB( 0x5000 )
513#define _RhPortStatus _USB( 0x5400 )
514#define _USBStatus _USB( 0x11800 )
515#define _USBReset _USB( 0x11c00 )
516
517#define _USTAR _USB( 0x10400 )
518#define _USWER _USB( 0x10800 )
519#define _USRFR _USB( 0x10c00 )
520#define _USNFR _USB( 0x11000 )
521#define _USTCSR _USB( 0x11400 )
522#define _USSR _USB( 0x11800 )
523
524
525#if (LANGUAGE == C)
526
527#define Revision (*((volatile Word *) SA1101_p2v (_Revision)))
528#define Control (*((volatile Word *) SA1101_p2v (_Control)))
529#define CommandStatus (*((volatile Word *) SA1101_p2v (_CommandStatus)))
530#define InterruptStatus (*((volatile Word *) SA1101_p2v (_InterruptStatus)))
531#define InterruptEnable (*((volatile Word *) SA1101_p2v (_InterruptEnable)))
532#define HCCA (*((volatile Word *) SA1101_p2v (_HCCA)))
533#define PeriodCurrentED (*((volatile Word *) SA1101_p2v (_PeriodCurrentED)))
534#define ControlHeadED (*((volatile Word *) SA1101_p2v (_ControlHeadED)))
535#define BulkHeadED (*((volatile Word *) SA1101_p2v (_BulkHeadED)))
536#define BulkCurrentED (*((volatile Word *) SA1101_p2v (_BulkCurrentED)))
537#define DoneHead (*((volatile Word *) SA1101_p2v (_DoneHead)))
538#define FmInterval (*((volatile Word *) SA1101_p2v (_FmInterval)))
539#define FmRemaining (*((volatile Word *) SA1101_p2v (_FmRemaining)))
540#define FmNumber (*((volatile Word *) SA1101_p2v (_FmNumber)))
541#define PeriodicStart (*((volatile Word *) SA1101_p2v (_PeriodicStart)))
542#define LSThreshold (*((volatile Word *) SA1101_p2v (_LSThreshold)))
543#define RhDescriptorA (*((volatile Word *) SA1101_p2v (_RhDescriptorA)))
544#define RhDescriptorB (*((volatile Word *) SA1101_p2v (_RhDescriptorB)))
545#define RhStatus (*((volatile Word *) SA1101_p2v (_RhStatus)))
546#define RhPortStatus (*((volatile Word *) SA1101_p2v (_RhPortStatus)))
547#define USBStatus (*((volatile Word *) SA1101_p2v (_USBStatus)))
548#define USBReset (*((volatile Word *) SA1101_p2v (_USBReset)))
549#define USTAR (*((volatile Word *) SA1101_p2v (_USTAR)))
550#define USWER (*((volatile Word *) SA1101_p2v (_USWER)))
551#define USRFR (*((volatile Word *) SA1101_p2v (_USRFR)))
552#define USNFR (*((volatile Word *) SA1101_p2v (_USNFR)))
553#define USTCSR (*((volatile Word *) SA1101_p2v (_USTCSR)))
554#define USSR (*((volatile Word *) SA1101_p2v (_USSR)))
555
556
557#define USBStatus_IrqHciRmtWkp (1<<7)
558#define USBStatus_IrqHciBuffAcc (1<<8)
559#define USBStatus_nIrqHciM (1<<9)
560#define USBStatus_nHciMFClr (1<<10)
561
562#define USBReset_ForceIfReset 0x01
563#define USBReset_ForceHcReset 0x02
564#define USBReset_ClkGenReset 0x04
565
566#define USTCR_RdBstCntrl Fld(3,0)
567#define USTCR_ByteEnable Fld(4,3)
568#define USTCR_WriteEn (1<<7)
569#define USTCR_FifoCir (1<<8)
570#define USTCR_TestXferSel (1<<9)
571#define USTCR_FifoCirAtEnd (1<<10)
572#define USTCR_nSimScaleDownClk (1<<11)
573
574#define USSR_nAppMDEmpty 0x01
575#define USSR_nAppMDFirst 0x02
576#define USSR_nAppMDLast 0x04
577#define USSR_nAppMDFull 0x08
578#define USSR_nAppMAFull 0x10
579#define USSR_XferReq 0x20
580#define USSR_XferEnd 0x40
581
582#endif /* LANGUAGE == C */
583
584
585/*
586 * Interrupt Controller
587 *
588 * Registers
589 * INTTEST0 Test register 0
590 * INTTEST1 Test register 1
591 * INTENABLE0 Interrupt Enable register 0
592 * INTENABLE1 Interrupt Enable register 1
593 * INTPOL0 Interrupt Polarity selection 0
594 * INTPOL1 Interrupt Polarity selection 1
595 * INTTSTSEL Interrupt source selection
596 * INTSTATCLR0 Interrupt Status 0
597 * INTSTATCLR1 Interrupt Status 1
598 * INTSET0 Interrupt Set 0
599 * INTSET1 Interrupt Set 1
600 */
601
602#define _INT( x ) _SA1101( ( x ) + __INTERRUPT_CONTROL)
603
604#define _INTTEST0 _INT( 0x1000 )
605#define _INTTEST1 _INT( 0x1400 )
606#define _INTENABLE0 _INT( 0x2000 )
607#define _INTENABLE1 _INT( 0x2400 )
608#define _INTPOL0 _INT( 0x3000 )
609#define _INTPOL1 _INT( 0x3400 )
610#define _INTTSTSEL _INT( 0x5000 )
611#define _INTSTATCLR0 _INT( 0x6000 )
612#define _INTSTATCLR1 _INT( 0x6400 )
613#define _INTSET0 _INT( 0x7000 )
614#define _INTSET1 _INT( 0x7400 )
615
616#if ( LANGUAGE == C )
617#define INTTEST0 (*((volatile Word *) SA1101_p2v (_INTTEST0)))
618#define INTTEST1 (*((volatile Word *) SA1101_p2v (_INTTEST1)))
619#define INTENABLE0 (*((volatile Word *) SA1101_p2v (_INTENABLE0)))
620#define INTENABLE1 (*((volatile Word *) SA1101_p2v (_INTENABLE1)))
621#define INTPOL0 (*((volatile Word *) SA1101_p2v (_INTPOL0)))
622#define INTPOL1 (*((volatile Word *) SA1101_p2v (_INTPOL1)))
623#define INTTSTSEL (*((volatile Word *) SA1101_p2v (_INTTSTSEL)))
624#define INTSTATCLR0 (*((volatile Word *) SA1101_p2v (_INTSTATCLR0)))
625#define INTSTATCLR1 (*((volatile Word *) SA1101_p2v (_INTSTATCLR1)))
626#define INTSET0 (*((volatile Word *) SA1101_p2v (_INTSET0)))
627#define INTSET1 (*((volatile Word *) SA1101_p2v (_INTSET1)))
628
629#endif /* LANGUAGE == C */
630
631/*
632 * PS/2 Trackpad and Mouse Interfaces
633 *
634 * Registers (prefix kbd applies to trackpad interface, mse to mouse)
635 * KBDCR Control Register
636 * KBDSTAT Status Register
637 * KBDDATA Transmit/Receive Data register
638 * KBDCLKDIV Clock Division Register
639 * KBDPRECNT Clock Precount Register
640 * KBDTEST1 Test register 1
641 * KBDTEST2 Test register 2
642 * KBDTEST3 Test register 3
643 * KBDTEST4 Test register 4
644 * MSECR
645 * MSESTAT
646 * MSEDATA
647 * MSECLKDIV
648 * MSEPRECNT
649 * MSETEST1
650 * MSETEST2
651 * MSETEST3
652 * MSETEST4
653 *
654 */
655
656#define _KBD( x ) _SA1101( ( x ) + __TRACK_INTERFACE )
657#define _MSE( x ) _SA1101( ( x ) + __MOUSE_INTERFACE )
658
659#define _KBDCR _KBD( 0x0000 )
660#define _KBDSTAT _KBD( 0x0400 )
661#define _KBDDATA _KBD( 0x0800 )
662#define _KBDCLKDIV _KBD( 0x0c00 )
663#define _KBDPRECNT _KBD( 0x1000 )
664#define _KBDTEST1 _KBD( 0x2000 )
665#define _KBDTEST2 _KBD( 0x2400 )
666#define _KBDTEST3 _KBD( 0x2800 )
667#define _KBDTEST4 _KBD( 0x2c00 )
668#define _MSECR _MSE( 0x0000 )
669#define _MSESTAT _MSE( 0x0400 )
670#define _MSEDATA _MSE( 0x0800 )
671#define _MSECLKDIV _MSE( 0x0c00 )
672#define _MSEPRECNT _MSE( 0x1000 )
673#define _MSETEST1 _MSE( 0x2000 )
674#define _MSETEST2 _MSE( 0x2400 )
675#define _MSETEST3 _MSE( 0x2800 )
676#define _MSETEST4 _MSE( 0x2c00 )
677
678#if ( LANGUAGE == C )
679
680#define KBDCR (*((volatile Word *) SA1101_p2v (_KBDCR)))
681#define KBDSTAT (*((volatile Word *) SA1101_p2v (_KBDSTAT)))
682#define KBDDATA (*((volatile Word *) SA1101_p2v (_KBDDATA)))
683#define KBDCLKDIV (*((volatile Word *) SA1101_p2v (_KBDCLKDIV)))
684#define KBDPRECNT (*((volatile Word *) SA1101_p2v (_KBDPRECNT)))
685#define KBDTEST1 (*((volatile Word *) SA1101_p2v (_KBDTEST1)))
686#define KBDTEST2 (*((volatile Word *) SA1101_p2v (_KBDTEST2)))
687#define KBDTEST3 (*((volatile Word *) SA1101_p2v (_KBDTEST3)))
688#define KBDTEST4 (*((volatile Word *) SA1101_p2v (_KBDTEST4)))
689#define MSECR (*((volatile Word *) SA1101_p2v (_MSECR)))
690#define MSESTAT (*((volatile Word *) SA1101_p2v (_MSESTAT)))
691#define MSEDATA (*((volatile Word *) SA1101_p2v (_MSEDATA)))
692#define MSECLKDIV (*((volatile Word *) SA1101_p2v (_MSECLKDIV)))
693#define MSEPRECNT (*((volatile Word *) SA1101_p2v (_MSEPRECNT)))
694#define MSETEST1 (*((volatile Word *) SA1101_p2v (_MSETEST1)))
695#define MSETEST2 (*((volatile Word *) SA1101_p2v (_MSETEST2)))
696#define MSETEST3 (*((volatile Word *) SA1101_p2v (_MSETEST3)))
697#define MSETEST4 (*((volatile Word *) SA1101_p2v (_MSETEST4)))
698
699
700#define KBDCR_ENA 0x08
701#define KBDCR_FKD 0x02
702#define KBDCR_FKC 0x01
703
704#define KBDSTAT_TXE 0x80
705#define KBDSTAT_TXB 0x40
706#define KBDSTAT_RXF 0x20
707#define KBDSTAT_RXB 0x10
708#define KBDSTAT_ENA 0x08
709#define KBDSTAT_RXP 0x04
710#define KBDSTAT_KBD 0x02
711#define KBDSTAT_KBC 0x01
712
713#define KBDCLKDIV_DivVal Fld(4,0)
714
715#define MSECR_ENA 0x08
716#define MSECR_FKD 0x02
717#define MSECR_FKC 0x01
718
719#define MSESTAT_TXE 0x80
720#define MSESTAT_TXB 0x40
721#define MSESTAT_RXF 0x20
722#define MSESTAT_RXB 0x10
723#define MSESTAT_ENA 0x08
724#define MSESTAT_RXP 0x04
725#define MSESTAT_MSD 0x02
726#define MSESTAT_MSC 0x01
727
728#define MSECLKDIV_DivVal Fld(4,0)
729
730#define KBDTEST1_CD 0x80
731#define KBDTEST1_RC1 0x40
732#define KBDTEST1_MC 0x20
733#define KBDTEST1_C Fld(2,3)
734#define KBDTEST1_T2 0x40
735#define KBDTEST1_T1 0x20
736#define KBDTEST1_T0 0x10
737#define KBDTEST2_TICBnRES 0x08
738#define KBDTEST2_RKC 0x04
739#define KBDTEST2_RKD 0x02
740#define KBDTEST2_SEL 0x01
741#define KBDTEST3_ms_16 0x80
742#define KBDTEST3_us_64 0x40
743#define KBDTEST3_us_16 0x20
744#define KBDTEST3_DIV8 0x10
745#define KBDTEST3_DIn 0x08
746#define KBDTEST3_CIn 0x04
747#define KBDTEST3_KD 0x02
748#define KBDTEST3_KC 0x01
749#define KBDTEST4_BC12 0x80
750#define KBDTEST4_BC11 0x40
751#define KBDTEST4_TRES 0x20
752#define KBDTEST4_CLKOE 0x10
753#define KBDTEST4_CRES 0x08
754#define KBDTEST4_RXB 0x04
755#define KBDTEST4_TXB 0x02
756#define KBDTEST4_SRX 0x01
757
758#define MSETEST1_CD 0x80
759#define MSETEST1_RC1 0x40
760#define MSETEST1_MC 0x20
761#define MSETEST1_C Fld(2,3)
762#define MSETEST1_T2 0x40
763#define MSETEST1_T1 0x20
764#define MSETEST1_T0 0x10
765#define MSETEST2_TICBnRES 0x08
766#define MSETEST2_RKC 0x04
767#define MSETEST2_RKD 0x02
768#define MSETEST2_SEL 0x01
769#define MSETEST3_ms_16 0x80
770#define MSETEST3_us_64 0x40
771#define MSETEST3_us_16 0x20
772#define MSETEST3_DIV8 0x10
773#define MSETEST3_DIn 0x08
774#define MSETEST3_CIn 0x04
775#define MSETEST3_KD 0x02
776#define MSETEST3_KC 0x01
777#define MSETEST4_BC12 0x80
778#define MSETEST4_BC11 0x40
779#define MSETEST4_TRES 0x20
780#define MSETEST4_CLKOE 0x10
781#define MSETEST4_CRES 0x08
782#define MSETEST4_RXB 0x04
783#define MSETEST4_TXB 0x02
784#define MSETEST4_SRX 0x01
785
786#endif /* LANGUAGE == C */
787
788
789/*
790 * General-Purpose I/O Interface
791 *
792 * Registers
793 * PADWR Port A Data Write Register
794 * PBDWR Port B Data Write Register
795 * PADRR Port A Data Read Register
796 * PBDRR Port B Data Read Register
797 * PADDR Port A Data Direction Register
798 * PBDDR Port B Data Direction Register
799 * PASSR Port A Sleep State Register
800 * PBSSR Port B Sleep State Register
801 *
802 */
803
804#define _PIO( x ) _SA1101( ( x ) + __GPIO_INTERFACE )
805
806#define _PADWR _PIO( 0x0000 )
807#define _PBDWR _PIO( 0x0400 )
808#define _PADRR _PIO( 0x0000 )
809#define _PBDRR _PIO( 0x0400 )
810#define _PADDR _PIO( 0x0800 )
811#define _PBDDR _PIO( 0x0c00 )
812#define _PASSR _PIO( 0x1000 )
813#define _PBSSR _PIO( 0x1400 )
814
815
816#if ( LANGUAGE == C )
817
818
819#define PADWR (*((volatile Word *) SA1101_p2v (_PADWR)))
820#define PBDWR (*((volatile Word *) SA1101_p2v (_PBDWR)))
821#define PADRR (*((volatile Word *) SA1101_p2v (_PADRR)))
822#define PBDRR (*((volatile Word *) SA1101_p2v (_PBDRR)))
823#define PADDR (*((volatile Word *) SA1101_p2v (_PADDR)))
824#define PBDDR (*((volatile Word *) SA1101_p2v (_PBDDR)))
825#define PASSR (*((volatile Word *) SA1101_p2v (_PASSR)))
826#define PBSSR (*((volatile Word *) SA1101_p2v (_PBSSR)))
827
828#endif
829
830
831
832/*
833 * Keypad Interface
834 *
835 * Registers
836 * PXDWR
837 * PXDRR
838 * PYDWR
839 * PYDRR
840 *
841 */
842
843#define _KEYPAD( x ) _SA1101( ( x ) + __KEYPAD_INTERFACE )
844
845#define _PXDWR _KEYPAD( 0x0000 )
846#define _PXDRR _KEYPAD( 0x0000 )
847#define _PYDWR _KEYPAD( 0x0400 )
848#define _PYDRR _KEYPAD( 0x0400 )
849
850#if ( LANGUAGE == C )
851
852
853#define PXDWR (*((volatile Word *) SA1101_p2v (_PXDWR)))
854#define PXDRR (*((volatile Word *) SA1101_p2v (_PXDRR)))
855#define PYDWR (*((volatile Word *) SA1101_p2v (_PYDWR)))
856#define PYDRR (*((volatile Word *) SA1101_p2v (_PYDRR)))
857
858#endif
859
860
861
862/*
863 * PCMCIA Interface
864 *
865 * Registers
866 * PCSR Status Register
867 * PCCR Control Register
868 * PCSSR Sleep State Register
869 *
870 */
871
872#define _CARD( x ) _SA1101( ( x ) + __PCMCIA_INTERFACE )
873
874#define _PCSR _CARD( 0x0000 )
875#define _PCCR _CARD( 0x0400 )
876#define _PCSSR _CARD( 0x0800 )
877
878#if ( LANGUAGE == C )
879#define PCSR (*((volatile Word *) SA1101_p2v (_PCSR)))
880#define PCCR (*((volatile Word *) SA1101_p2v (_PCCR)))
881#define PCSSR (*((volatile Word *) SA1101_p2v (_PCSSR)))
882
883#define PCSR_S0_ready 0x0001
884#define PCSR_S1_ready 0x0002
885#define PCSR_S0_detected 0x0004
886#define PCSR_S1_detected 0x0008
887#define PCSR_S0_VS1 0x0010
888#define PCSR_S0_VS2 0x0020
889#define PCSR_S1_VS1 0x0040
890#define PCSR_S1_VS2 0x0080
891#define PCSR_S0_WP 0x0100
892#define PCSR_S1_WP 0x0200
893#define PCSR_S0_BVD1_nSTSCHG 0x0400
894#define PCSR_S0_BVD2_nSPKR 0x0800
895#define PCSR_S1_BVD1_nSTSCHG 0x1000
896#define PCSR_S1_BVD2_nSPKR 0x2000
897
898#define PCCR_S0_VPP0 0x0001
899#define PCCR_S0_VPP1 0x0002
900#define PCCR_S0_VCC0 0x0004
901#define PCCR_S0_VCC1 0x0008
902#define PCCR_S1_VPP0 0x0010
903#define PCCR_S1_VPP1 0x0020
904#define PCCR_S1_VCC0 0x0040
905#define PCCR_S1_VCC1 0x0080
906#define PCCR_S0_reset 0x0100
907#define PCCR_S1_reset 0x0200
908#define PCCR_S0_float 0x0400
909#define PCCR_S1_float 0x0800
910
911#define PCSSR_S0_VCC0 0x0001
912#define PCSSR_S0_VCC1 0x0002
913#define PCSSR_S0_VPP0 0x0004
914#define PCSSR_S0_VPP1 0x0008
915#define PCSSR_S0_control 0x0010
916#define PCSSR_S1_VCC0 0x0020
917#define PCSSR_S1_VCC1 0x0040
918#define PCSSR_S1_VPP0 0x0080
919#define PCSSR_S1_VPP1 0x0100
920#define PCSSR_S1_control 0x0200
921
922#endif
923
924#undef C
925#undef Assembly
diff --git a/arch/arm/mach-sa1100/include/mach/SA-1111.h b/arch/arm/mach-sa1100/include/mach/SA-1111.h
new file mode 100644
index 000000000000..c38f60915cb6
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/SA-1111.h
@@ -0,0 +1,5 @@
1/*
2 * Moved to new location
3 */
4#warning using old SA-1111.h - update to <asm/hardware/sa1111.h>
5#include <asm/hardware/sa1111.h>
diff --git a/arch/arm/mach-sa1100/include/mach/assabet.h b/arch/arm/mach-sa1100/include/mach/assabet.h
new file mode 100644
index 000000000000..3959b20d5d1c
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/assabet.h
@@ -0,0 +1,105 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/assabet.h
3 *
4 * Created 2000/06/05 by Nicolas Pitre <nico@cam.org>
5 *
6 * This file contains the hardware specific definitions for Assabet
7 * Only include this file from SA1100-specific files.
8 *
9 * 2000/05/23 John Dorsey <john+@cs.cmu.edu>
10 * Definitions for Neponset added.
11 */
12#ifndef __ASM_ARCH_ASSABET_H
13#define __ASM_ARCH_ASSABET_H
14
15
16/* System Configuration Register flags */
17
18#define ASSABET_SCR_SDRAM_LOW (1<<2) /* SDRAM size (low bit) */
19#define ASSABET_SCR_SDRAM_HIGH (1<<3) /* SDRAM size (high bit) */
20#define ASSABET_SCR_FLASH_LOW (1<<4) /* Flash size (low bit) */
21#define ASSABET_SCR_FLASH_HIGH (1<<5) /* Flash size (high bit) */
22#define ASSABET_SCR_GFX (1<<8) /* Graphics Accelerator (0 = present) */
23#define ASSABET_SCR_SA1111 (1<<9) /* Neponset (0 = present) */
24
25#define ASSABET_SCR_INIT -1
26
27extern unsigned long SCR_value;
28
29#ifdef CONFIG_ASSABET_NEPONSET
30#define machine_has_neponset() ((SCR_value & ASSABET_SCR_SA1111) == 0)
31#else
32#define machine_has_neponset() (0)
33#endif
34
35/* Board Control Register */
36
37#define ASSABET_BCR_BASE 0xf1000000
38#define ASSABET_BCR (*(volatile unsigned int *)(ASSABET_BCR_BASE))
39
40#define ASSABET_BCR_CF_PWR (1<<0) /* Compact Flash Power (1 = 3.3v, 0 = off) */
41#define ASSABET_BCR_CF_RST (1<<1) /* Compact Flash Reset (1 = power up reset) */
42#define ASSABET_BCR_GFX_RST (1<<1) /* Graphics Accelerator Reset (0 = hold reset) */
43#define ASSABET_BCR_CODEC_RST (1<<2) /* 0 = Holds UCB1300, ADI7171, and UDA1341 in reset */
44#define ASSABET_BCR_IRDA_FSEL (1<<3) /* IRDA Frequency select (0 = SIR, 1 = MIR/ FIR) */
45#define ASSABET_BCR_IRDA_MD0 (1<<4) /* Range/Power select */
46#define ASSABET_BCR_IRDA_MD1 (1<<5) /* Range/Power select */
47#define ASSABET_BCR_STEREO_LB (1<<6) /* Stereo Loopback */
48#define ASSABET_BCR_CF_BUS_OFF (1<<7) /* Compact Flash bus (0 = on, 1 = off (float)) */
49#define ASSABET_BCR_AUDIO_ON (1<<8) /* Audio power on */
50#define ASSABET_BCR_LIGHT_ON (1<<9) /* Backlight */
51#define ASSABET_BCR_LCD_12RGB (1<<10) /* 0 = 16RGB, 1 = 12RGB */
52#define ASSABET_BCR_LCD_ON (1<<11) /* LCD power on */
53#define ASSABET_BCR_RS232EN (1<<12) /* RS232 transceiver enable */
54#define ASSABET_BCR_LED_RED (1<<13) /* D9 (0 = on, 1 = off) */
55#define ASSABET_BCR_LED_GREEN (1<<14) /* D8 (0 = on, 1 = off) */
56#define ASSABET_BCR_VIB_ON (1<<15) /* Vibration motor (quiet alert) */
57#define ASSABET_BCR_COM_DTR (1<<16) /* COMport Data Terminal Ready */
58#define ASSABET_BCR_COM_RTS (1<<17) /* COMport Request To Send */
59#define ASSABET_BCR_RAD_WU (1<<18) /* Radio wake up interrupt */
60#define ASSABET_BCR_SMB_EN (1<<19) /* System management bus enable */
61#define ASSABET_BCR_TV_IR_DEC (1<<20) /* TV IR Decode Enable (not implemented) */
62#define ASSABET_BCR_QMUTE (1<<21) /* Quick Mute */
63#define ASSABET_BCR_RAD_ON (1<<22) /* Radio Power On */
64#define ASSABET_BCR_SPK_OFF (1<<23) /* 1 = Speaker amplifier power off */
65
66#ifdef CONFIG_SA1100_ASSABET
67extern void ASSABET_BCR_frob(unsigned int mask, unsigned int set);
68#else
69#define ASSABET_BCR_frob(x,y) do { } while (0)
70#endif
71
72#define ASSABET_BCR_set(x) ASSABET_BCR_frob((x), (x))
73#define ASSABET_BCR_clear(x) ASSABET_BCR_frob((x), 0)
74
75#define ASSABET_BSR_BASE 0xf1000000
76#define ASSABET_BSR (*(volatile unsigned int*)(ASSABET_BSR_BASE))
77
78#define ASSABET_BSR_RS232_VALID (1 << 24)
79#define ASSABET_BSR_COM_DCD (1 << 25)
80#define ASSABET_BSR_COM_CTS (1 << 26)
81#define ASSABET_BSR_COM_DSR (1 << 27)
82#define ASSABET_BSR_RAD_CTS (1 << 28)
83#define ASSABET_BSR_RAD_DSR (1 << 29)
84#define ASSABET_BSR_RAD_DCD (1 << 30)
85#define ASSABET_BSR_RAD_RI (1 << 31)
86
87
88/* GPIOs for which the generic definition doesn't say much */
89#define ASSABET_GPIO_RADIO_IRQ GPIO_GPIO (14) /* Radio interrupt request */
90#define ASSABET_GPIO_PS_MODE_SYNC GPIO_GPIO (16) /* Power supply mode/sync */
91#define ASSABET_GPIO_STEREO_64FS_CLK GPIO_GPIO (19) /* SSP UDA1341 clock input */
92#define ASSABET_GPIO_CF_IRQ GPIO_GPIO (21) /* CF IRQ */
93#define ASSABET_GPIO_CF_CD GPIO_GPIO (22) /* CF CD */
94#define ASSABET_GPIO_CF_BVD2 GPIO_GPIO (24) /* CF BVD */
95#define ASSABET_GPIO_GFX_IRQ GPIO_GPIO (24) /* Graphics IRQ */
96#define ASSABET_GPIO_CF_BVD1 GPIO_GPIO (25) /* CF BVD */
97#define ASSABET_GPIO_BATT_LOW GPIO_GPIO (26) /* Low battery */
98#define ASSABET_GPIO_RCLK GPIO_GPIO (26) /* CCLK/2 */
99
100#define ASSABET_IRQ_GPIO_CF_IRQ IRQ_GPIO21
101#define ASSABET_IRQ_GPIO_CF_CD IRQ_GPIO22
102#define ASSABET_IRQ_GPIO_CF_BVD2 IRQ_GPIO24
103#define ASSABET_IRQ_GPIO_CF_BVD1 IRQ_GPIO25
104
105#endif
diff --git a/arch/arm/mach-sa1100/include/mach/badge4.h b/arch/arm/mach-sa1100/include/mach/badge4.h
new file mode 100644
index 000000000000..44d2e1bfc04b
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/badge4.h
@@ -0,0 +1,75 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/badge4.h
3 *
4 * Tim Connors <connors@hpl.hp.com>
5 * Christopher Hoover <ch@hpl.hp.com>
6 *
7 * Copyright (C) 2002 Hewlett-Packard Company
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#ifndef __ASM_ARCH_HARDWARE_H
16#error "include <mach/hardware.h> instead"
17#endif
18
19#define BADGE4_SA1111_BASE (0x48000000)
20
21/* GPIOs on the BadgePAD 4 */
22#define BADGE4_GPIO_INT_1111 GPIO_GPIO0 /* SA-1111 IRQ */
23
24#define BADGE4_GPIO_INT_VID GPIO_GPIO1 /* Video expansion */
25#define BADGE4_GPIO_LGP2 GPIO_GPIO2 /* GPIO_LDD8 */
26#define BADGE4_GPIO_LGP3 GPIO_GPIO3 /* GPIO_LDD9 */
27#define BADGE4_GPIO_LGP4 GPIO_GPIO4 /* GPIO_LDD10 */
28#define BADGE4_GPIO_LGP5 GPIO_GPIO5 /* GPIO_LDD11 */
29#define BADGE4_GPIO_LGP6 GPIO_GPIO6 /* GPIO_LDD12 */
30#define BADGE4_GPIO_LGP7 GPIO_GPIO7 /* GPIO_LDD13 */
31#define BADGE4_GPIO_LGP8 GPIO_GPIO8 /* GPIO_LDD14 */
32#define BADGE4_GPIO_LGP9 GPIO_GPIO9 /* GPIO_LDD15 */
33#define BADGE4_GPIO_GPA_VID GPIO_GPIO10 /* Video expansion */
34#define BADGE4_GPIO_GPB_VID GPIO_GPIO11 /* Video expansion */
35#define BADGE4_GPIO_GPC_VID GPIO_GPIO12 /* Video expansion */
36
37#define BADGE4_GPIO_UART_HS1 GPIO_GPIO13
38#define BADGE4_GPIO_UART_HS2 GPIO_GPIO14
39
40#define BADGE4_GPIO_MUXSEL0 GPIO_GPIO15
41#define BADGE4_GPIO_TESTPT_J7 GPIO_GPIO16
42
43#define BADGE4_GPIO_SDSDA GPIO_GPIO17 /* SDRAM SPD Data */
44#define BADGE4_GPIO_SDSCL GPIO_GPIO18 /* SDRAM SPD Clock */
45#define BADGE4_GPIO_SDTYP0 GPIO_GPIO19 /* SDRAM Type Control */
46#define BADGE4_GPIO_SDTYP1 GPIO_GPIO20 /* SDRAM Type Control */
47
48#define BADGE4_GPIO_BGNT_1111 GPIO_GPIO21 /* GPIO_MBGNT */
49#define BADGE4_GPIO_BREQ_1111 GPIO_GPIO22 /* GPIO_TREQA */
50
51#define BADGE4_GPIO_TESTPT_J6 GPIO_GPIO23
52
53#define BADGE4_GPIO_PCMEN5V GPIO_GPIO24 /* 5V power */
54
55#define BADGE4_GPIO_SA1111_NRST GPIO_GPIO25 /* SA-1111 nRESET */
56
57#define BADGE4_GPIO_TESTPT_J5 GPIO_GPIO26
58
59#define BADGE4_GPIO_CLK_1111 GPIO_GPIO27 /* GPIO_32_768kHz */
60
61/* Interrupts on the BadgePAD 4 */
62#define BADGE4_IRQ_GPIO_SA1111 IRQ_GPIO0 /* SA-1111 interrupt */
63
64
65/* PCM5ENV Usage tracking */
66
67#define BADGE4_5V_PCMCIA_SOCK0 (1<<0)
68#define BADGE4_5V_PCMCIA_SOCK1 (1<<1)
69#define BADGE4_5V_PCMCIA_SOCK(n) (1<<(n))
70#define BADGE4_5V_USB (1<<2)
71#define BADGE4_5V_INITIALLY (1<<3)
72
73#ifndef __ASSEMBLY__
74extern void badge4_set_5V(unsigned subsystem, int on);
75#endif
diff --git a/arch/arm/mach-sa1100/include/mach/bitfield.h b/arch/arm/mach-sa1100/include/mach/bitfield.h
new file mode 100644
index 000000000000..f1f0e3387d9c
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/bitfield.h
@@ -0,0 +1,113 @@
1/*
2 * FILE bitfield.h
3 *
4 * Version 1.1
5 * Author Copyright (c) Marc A. Viredaz, 1998
6 * DEC Western Research Laboratory, Palo Alto, CA
7 * Date April 1998 (April 1997)
8 * System Advanced RISC Machine (ARM)
9 * Language C or ARM Assembly
10 * Purpose Definition of macros to operate on bit fields.
11 */
12
13
14
15#ifndef __BITFIELD_H
16#define __BITFIELD_H
17
18#ifndef __ASSEMBLY__
19#define UData(Data) ((unsigned long) (Data))
20#else
21#define UData(Data) (Data)
22#endif
23
24
25/*
26 * MACRO: Fld
27 *
28 * Purpose
29 * The macro "Fld" encodes a bit field, given its size and its shift value
30 * with respect to bit 0.
31 *
32 * Note
33 * A more intuitive way to encode bit fields would have been to use their
34 * mask. However, extracting size and shift value information from a bit
35 * field's mask is cumbersome and might break the assembler (255-character
36 * line-size limit).
37 *
38 * Input
39 * Size Size of the bit field, in number of bits.
40 * Shft Shift value of the bit field with respect to bit 0.
41 *
42 * Output
43 * Fld Encoded bit field.
44 */
45
46#define Fld(Size, Shft) (((Size) << 16) + (Shft))
47
48
49/*
50 * MACROS: FSize, FShft, FMsk, FAlnMsk, F1stBit
51 *
52 * Purpose
53 * The macros "FSize", "FShft", "FMsk", "FAlnMsk", and "F1stBit" return
54 * the size, shift value, mask, aligned mask, and first bit of a
55 * bit field.
56 *
57 * Input
58 * Field Encoded bit field (using the macro "Fld").
59 *
60 * Output
61 * FSize Size of the bit field, in number of bits.
62 * FShft Shift value of the bit field with respect to bit 0.
63 * FMsk Mask for the bit field.
64 * FAlnMsk Mask for the bit field, aligned on bit 0.
65 * F1stBit First bit of the bit field.
66 */
67
68#define FSize(Field) ((Field) >> 16)
69#define FShft(Field) ((Field) & 0x0000FFFF)
70#define FMsk(Field) (((UData (1) << FSize (Field)) - 1) << FShft (Field))
71#define FAlnMsk(Field) ((UData (1) << FSize (Field)) - 1)
72#define F1stBit(Field) (UData (1) << FShft (Field))
73
74
75/*
76 * MACRO: FInsrt
77 *
78 * Purpose
79 * The macro "FInsrt" inserts a value into a bit field by shifting the
80 * former appropriately.
81 *
82 * Input
83 * Value Bit-field value.
84 * Field Encoded bit field (using the macro "Fld").
85 *
86 * Output
87 * FInsrt Bit-field value positioned appropriately.
88 */
89
90#define FInsrt(Value, Field) \
91 (UData (Value) << FShft (Field))
92
93
94/*
95 * MACRO: FExtr
96 *
97 * Purpose
98 * The macro "FExtr" extracts the value of a bit field by masking and
99 * shifting it appropriately.
100 *
101 * Input
102 * Data Data containing the bit-field to be extracted.
103 * Field Encoded bit field (using the macro "Fld").
104 *
105 * Output
106 * FExtr Bit-field value.
107 */
108
109#define FExtr(Data, Field) \
110 ((UData (Data) >> FShft (Field)) & FAlnMsk (Field))
111
112
113#endif /* __BITFIELD_H */
diff --git a/arch/arm/mach-sa1100/include/mach/cerf.h b/arch/arm/mach-sa1100/include/mach/cerf.h
new file mode 100644
index 000000000000..c3ac3d0f9465
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/cerf.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/cerf.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Apr-2003 : Removed some old PDA crud [FB]
9 */
10#ifndef _INCLUDE_CERF_H_
11#define _INCLUDE_CERF_H_
12
13
14#define CERF_ETH_IO 0xf0000000
15#define CERF_ETH_IRQ IRQ_GPIO26
16
17#define CERF_GPIO_CF_BVD2 GPIO_GPIO (19)
18#define CERF_GPIO_CF_BVD1 GPIO_GPIO (20)
19#define CERF_GPIO_CF_RESET GPIO_GPIO (21)
20#define CERF_GPIO_CF_IRQ GPIO_GPIO (22)
21#define CERF_GPIO_CF_CD GPIO_GPIO (23)
22
23#define CERF_IRQ_GPIO_CF_BVD2 IRQ_GPIO19
24#define CERF_IRQ_GPIO_CF_BVD1 IRQ_GPIO20
25#define CERF_IRQ_GPIO_CF_IRQ IRQ_GPIO22
26#define CERF_IRQ_GPIO_CF_CD IRQ_GPIO23
27
28#endif // _INCLUDE_CERF_H_
diff --git a/arch/arm/mach-sa1100/include/mach/collie.h b/arch/arm/mach-sa1100/include/mach/collie.h
new file mode 100644
index 000000000000..69e962416e3f
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/collie.h
@@ -0,0 +1,88 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/collie.h
3 *
4 * This file contains the hardware specific definitions for Assabet
5 * Only include this file from SA1100-specific files.
6 *
7 * ChangeLog:
8 * 04-06-2001 Lineo Japan, Inc.
9 * 04-16-2001 SHARP Corporation
10 * 07-07-2002 Chris Larson <clarson@digi.com>
11 *
12 */
13#ifndef __ASM_ARCH_COLLIE_H
14#define __ASM_ARCH_COLLIE_H
15
16
17#define COLLIE_SCP_CHARGE_ON SCOOP_GPCR_PA11
18#define COLLIE_SCP_DIAG_BOOT1 SCOOP_GPCR_PA12
19#define COLLIE_SCP_DIAG_BOOT2 SCOOP_GPCR_PA13
20#define COLLIE_SCP_MUTE_L SCOOP_GPCR_PA14
21#define COLLIE_SCP_MUTE_R SCOOP_GPCR_PA15
22#define COLLIE_SCP_5VON SCOOP_GPCR_PA16
23#define COLLIE_SCP_AMP_ON SCOOP_GPCR_PA17
24#define COLLIE_SCP_VPEN SCOOP_GPCR_PA18
25#define COLLIE_SCP_LB_VOL_CHG SCOOP_GPCR_PA19
26
27#define COLLIE_SCOOP_IO_DIR ( COLLIE_SCP_CHARGE_ON | COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | \
28 COLLIE_SCP_5VON | COLLIE_SCP_AMP_ON | COLLIE_SCP_VPEN | \
29 COLLIE_SCP_LB_VOL_CHG )
30#define COLLIE_SCOOP_IO_OUT ( COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | COLLIE_SCP_VPEN | \
31 COLLIE_SCP_CHARGE_ON )
32
33/* GPIOs for which the generic definition doesn't say much */
34
35#define COLLIE_GPIO_ON_KEY GPIO_GPIO (0)
36#define COLLIE_GPIO_AC_IN GPIO_GPIO (1)
37#define COLLIE_GPIO_SDIO_INT GPIO_GPIO (11)
38#define COLLIE_GPIO_CF_IRQ GPIO_GPIO (14)
39#define COLLIE_GPIO_nREMOCON_INT GPIO_GPIO (15)
40#define COLLIE_GPIO_UCB1x00_RESET GPIO_GPIO (16)
41#define COLLIE_GPIO_nMIC_ON GPIO_GPIO (17)
42#define COLLIE_GPIO_nREMOCON_ON GPIO_GPIO (18)
43#define COLLIE_GPIO_CO GPIO_GPIO (20)
44#define COLLIE_GPIO_MCP_CLK GPIO_GPIO (21)
45#define COLLIE_GPIO_CF_CD GPIO_GPIO (22)
46#define COLLIE_GPIO_UCB1x00_IRQ GPIO_GPIO (23)
47#define COLLIE_GPIO_WAKEUP GPIO_GPIO (24)
48#define COLLIE_GPIO_GA_INT GPIO_GPIO (25)
49#define COLLIE_GPIO_MAIN_BAT_LOW GPIO_GPIO (26)
50
51/* Interrupts */
52
53#define COLLIE_IRQ_GPIO_ON_KEY IRQ_GPIO0
54#define COLLIE_IRQ_GPIO_AC_IN IRQ_GPIO1
55#define COLLIE_IRQ_GPIO_SDIO_IRQ IRQ_GPIO11
56#define COLLIE_IRQ_GPIO_CF_IRQ IRQ_GPIO14
57#define COLLIE_IRQ_GPIO_nREMOCON_INT IRQ_GPIO15
58#define COLLIE_IRQ_GPIO_CO IRQ_GPIO20
59#define COLLIE_IRQ_GPIO_CF_CD IRQ_GPIO22
60#define COLLIE_IRQ_GPIO_UCB1x00_IRQ IRQ_GPIO23
61#define COLLIE_IRQ_GPIO_WAKEUP IRQ_GPIO24
62#define COLLIE_IRQ_GPIO_GA_INT IRQ_GPIO25
63#define COLLIE_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO26
64
65#define COLLIE_LCM_IRQ_GPIO_RTS IRQ_LOCOMO_GPIO0
66#define COLLIE_LCM_IRQ_GPIO_CTS IRQ_LOCOMO_GPIO1
67#define COLLIE_LCM_IRQ_GPIO_DSR IRQ_LOCOMO_GPIO2
68#define COLLIE_LCM_IRQ_GPIO_DTR IRQ_LOCOMO_GPIO3
69#define COLLIE_LCM_IRQ_GPIO_nSD_DETECT IRQ_LOCOMO_GPIO13
70#define COLLIE_LCM_IRQ_GPIO_nSD_WP IRQ_LOCOMO_GPIO14
71
72/* GPIO's on the TC35143AF (Toshiba Analog Frontend) */
73#define COLLIE_TC35143_GPIO_VERSION0 UCB_IO_0 /* GPIO0=Version */
74#define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1 /* GPIO1=TBL_CHK */
75#define COLLIE_TC35143_GPIO_VPEN_ON UCB_IO_2 /* GPIO2=VPNE_ON */
76#define COLLIE_TC35143_GPIO_IR_ON UCB_IO_3 /* GPIO3=IR_ON */
77#define COLLIE_TC35143_GPIO_AMP_ON UCB_IO_4 /* GPIO4=AMP_ON */
78#define COLLIE_TC35143_GPIO_VERSION1 UCB_IO_5 /* GPIO5=Version */
79#define COLLIE_TC35143_GPIO_FS8KLPF UCB_IO_5 /* GPIO5=fs 8k LPF */
80#define COLLIE_TC35143_GPIO_BUZZER_BIAS UCB_IO_6 /* GPIO6=BUZZER BIAS */
81#define COLLIE_TC35143_GPIO_MBAT_ON UCB_IO_7 /* GPIO7=MBAT_ON */
82#define COLLIE_TC35143_GPIO_BBAT_ON UCB_IO_8 /* GPIO8=BBAT_ON */
83#define COLLIE_TC35143_GPIO_TMP_ON UCB_IO_9 /* GPIO9=TMP_ON */
84#define COLLIE_TC35143_GPIO_IN ( UCB_IO_0 | UCB_IO_2 | UCB_IO_5 )
85#define COLLIE_TC35143_GPIO_OUT ( UCB_IO_1 | UCB_IO_3 | UCB_IO_4 | UCB_IO_6 | \
86 UCB_IO_7 | UCB_IO_8 | UCB_IO_9 )
87
88#endif
diff --git a/arch/arm/mach-sa1100/include/mach/debug-macro.S b/arch/arm/mach-sa1100/include/mach/debug-macro.S
new file mode 100644
index 000000000000..1f0634d92702
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/debug-macro.S
@@ -0,0 +1,58 @@
1/* arch/arm/mach-sa1100/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#include <mach/hardware.h>
14
15 .macro addruart,rx
16 mrc p15, 0, \rx, c1, c0
17 tst \rx, #1 @ MMU enabled?
18 moveq \rx, #0x80000000 @ physical base address
19 movne \rx, #0xf8000000 @ virtual address
20
21 @ We probe for the active serial port here, coherently with
22 @ the comment in arch/arm/mach-sa1100/include/mach/uncompress.h.
23 @ We assume r1 can be clobbered.
24
25 @ see if Ser3 is active
26 add \rx, \rx, #0x00050000
27 ldr r1, [\rx, #UTCR3]
28 tst r1, #UTCR3_TXE
29
30 @ if Ser3 is inactive, then try Ser1
31 addeq \rx, \rx, #(0x00010000 - 0x00050000)
32 ldreq r1, [\rx, #UTCR3]
33 tsteq r1, #UTCR3_TXE
34
35 @ if Ser1 is inactive, then try Ser2
36 addeq \rx, \rx, #(0x00030000 - 0x00010000)
37 ldreq r1, [\rx, #UTCR3]
38 tsteq r1, #UTCR3_TXE
39
40 @ if all ports are inactive, then there is nothing we can do
41 moveq pc, lr
42 .endm
43
44 .macro senduart,rd,rx
45 str \rd, [\rx, #UTDR]
46 .endm
47
48 .macro waituart,rd,rx
491001: ldr \rd, [\rx, #UTSR1]
50 tst \rd, #UTSR1_TNF
51 beq 1001b
52 .endm
53
54 .macro busyuart,rd,rx
551001: ldr \rd, [\rx, #UTSR1]
56 tst \rd, #UTSR1_TBY
57 bne 1001b
58 .endm
diff --git a/arch/arm/mach-sa1100/include/mach/dma.h b/arch/arm/mach-sa1100/include/mach/dma.h
new file mode 100644
index 000000000000..dda1b351310d
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/dma.h
@@ -0,0 +1,117 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/dma.h
3 *
4 * Generic SA1100 DMA support
5 *
6 * Copyright (C) 2000 Nicolas Pitre
7 *
8 */
9
10#ifndef __ASM_ARCH_DMA_H
11#define __ASM_ARCH_DMA_H
12
13#include "hardware.h"
14
15
16/*
17 * The SA1100 has six internal DMA channels.
18 */
19#define SA1100_DMA_CHANNELS 6
20
21/*
22 * Maximum physical DMA buffer size
23 */
24#define MAX_DMA_SIZE 0x1fff
25#define CUT_DMA_SIZE 0x1000
26
27/*
28 * All possible SA1100 devices a DMA channel can be attached to.
29 */
30typedef enum {
31 DMA_Ser0UDCWr = DDAR_Ser0UDCWr, /* Ser. port 0 UDC Write */
32 DMA_Ser0UDCRd = DDAR_Ser0UDCRd, /* Ser. port 0 UDC Read */
33 DMA_Ser1UARTWr = DDAR_Ser1UARTWr, /* Ser. port 1 UART Write */
34 DMA_Ser1UARTRd = DDAR_Ser1UARTRd, /* Ser. port 1 UART Read */
35 DMA_Ser1SDLCWr = DDAR_Ser1SDLCWr, /* Ser. port 1 SDLC Write */
36 DMA_Ser1SDLCRd = DDAR_Ser1SDLCRd, /* Ser. port 1 SDLC Read */
37 DMA_Ser2UARTWr = DDAR_Ser2UARTWr, /* Ser. port 2 UART Write */
38 DMA_Ser2UARTRd = DDAR_Ser2UARTRd, /* Ser. port 2 UART Read */
39 DMA_Ser2HSSPWr = DDAR_Ser2HSSPWr, /* Ser. port 2 HSSP Write */
40 DMA_Ser2HSSPRd = DDAR_Ser2HSSPRd, /* Ser. port 2 HSSP Read */
41 DMA_Ser3UARTWr = DDAR_Ser3UARTWr, /* Ser. port 3 UART Write */
42 DMA_Ser3UARTRd = DDAR_Ser3UARTRd, /* Ser. port 3 UART Read */
43 DMA_Ser4MCP0Wr = DDAR_Ser4MCP0Wr, /* Ser. port 4 MCP 0 Write (audio) */
44 DMA_Ser4MCP0Rd = DDAR_Ser4MCP0Rd, /* Ser. port 4 MCP 0 Read (audio) */
45 DMA_Ser4MCP1Wr = DDAR_Ser4MCP1Wr, /* Ser. port 4 MCP 1 Write */
46 DMA_Ser4MCP1Rd = DDAR_Ser4MCP1Rd, /* Ser. port 4 MCP 1 Read */
47 DMA_Ser4SSPWr = DDAR_Ser4SSPWr, /* Ser. port 4 SSP Write (16 bits) */
48 DMA_Ser4SSPRd = DDAR_Ser4SSPRd /* Ser. port 4 SSP Read (16 bits) */
49} dma_device_t;
50
51typedef struct {
52 volatile u_long DDAR;
53 volatile u_long SetDCSR;
54 volatile u_long ClrDCSR;
55 volatile u_long RdDCSR;
56 volatile dma_addr_t DBSA;
57 volatile u_long DBTA;
58 volatile dma_addr_t DBSB;
59 volatile u_long DBTB;
60} dma_regs_t;
61
62typedef void (*dma_callback_t)(void *data);
63
64/*
65 * DMA function prototypes
66 */
67
68extern int sa1100_request_dma( dma_device_t device, const char *device_id,
69 dma_callback_t callback, void *data,
70 dma_regs_t **regs );
71extern void sa1100_free_dma( dma_regs_t *regs );
72extern int sa1100_start_dma( dma_regs_t *regs, dma_addr_t dma_ptr, u_int size );
73extern dma_addr_t sa1100_get_dma_pos(dma_regs_t *regs);
74extern void sa1100_reset_dma(dma_regs_t *regs);
75
76/**
77 * sa1100_stop_dma - stop DMA in progress
78 * @regs: identifier for the channel to use
79 *
80 * This stops DMA without clearing buffer pointers. Unlike
81 * sa1100_clear_dma() this allows subsequent use of sa1100_resume_dma()
82 * or sa1100_get_dma_pos().
83 *
84 * The @regs identifier is provided by a successful call to
85 * sa1100_request_dma().
86 **/
87
88#define sa1100_stop_dma(regs) ((regs)->ClrDCSR = DCSR_IE|DCSR_RUN)
89
90/**
91 * sa1100_resume_dma - resume DMA on a stopped channel
92 * @regs: identifier for the channel to use
93 *
94 * This resumes DMA on a channel previously stopped with
95 * sa1100_stop_dma().
96 *
97 * The @regs identifier is provided by a successful call to
98 * sa1100_request_dma().
99 **/
100
101#define sa1100_resume_dma(regs) ((regs)->SetDCSR = DCSR_IE|DCSR_RUN)
102
103/**
104 * sa1100_clear_dma - clear DMA pointers
105 * @regs: identifier for the channel to use
106 *
107 * This clear any DMA state so the DMA engine is ready to restart
108 * with new buffers through sa1100_start_dma(). Any buffers in flight
109 * are discarded.
110 *
111 * The @regs identifier is provided by a successful call to
112 * sa1100_request_dma().
113 **/
114
115#define sa1100_clear_dma(regs) ((regs)->ClrDCSR = DCSR_IE|DCSR_RUN|DCSR_STRTA|DCSR_STRTB)
116
117#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-sa1100/include/mach/entry-macro.S b/arch/arm/mach-sa1100/include/mach/entry-macro.S
new file mode 100644
index 000000000000..6aa13c46c5d3
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/entry-macro.S
@@ -0,0 +1,47 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for SA1100-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
11 .macro disable_fiq
12 .endm
13
14 .macro get_irqnr_preamble, base, tmp
15 mov \base, #0xfa000000 @ ICIP = 0xfa050000
16 add \base, \base, #0x00050000
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
23 ldr \irqstat, [\base] @ get irqs
24 ldr \irqnr, [\base, #4] @ ICMR = 0xfa050004
25 ands \irqstat, \irqstat, \irqnr
26 mov \irqnr, #0
27 beq 1001f
28 tst \irqstat, #0xff
29 moveq \irqstat, \irqstat, lsr #8
30 addeq \irqnr, \irqnr, #8
31 tsteq \irqstat, #0xff
32 moveq \irqstat, \irqstat, lsr #8
33 addeq \irqnr, \irqnr, #8
34 tsteq \irqstat, #0xff
35 moveq \irqstat, \irqstat, lsr #8
36 addeq \irqnr, \irqnr, #8
37 tst \irqstat, #0x0f
38 moveq \irqstat, \irqstat, lsr #4
39 addeq \irqnr, \irqnr, #4
40 tst \irqstat, #0x03
41 moveq \irqstat, \irqstat, lsr #2
42 addeq \irqnr, \irqnr, #2
43 tst \irqstat, #0x01
44 addeqs \irqnr, \irqnr, #1
451001:
46 .endm
47
diff --git a/arch/arm/mach-sa1100/include/mach/gpio.h b/arch/arm/mach-sa1100/include/mach/gpio.h
new file mode 100644
index 000000000000..582a0c92da53
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/gpio.h
@@ -0,0 +1,68 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/gpio.h
3 *
4 * SA1100 GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __ASM_ARCH_SA1100_GPIO_H
25#define __ASM_ARCH_SA1100_GPIO_H
26
27#include <mach/hardware.h>
28#include <asm/irq.h>
29#include <asm-generic/gpio.h>
30
31static inline int gpio_get_value(unsigned gpio)
32{
33 if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
34 return GPLR & GPIO_GPIO(gpio);
35 else
36 return __gpio_get_value(gpio);
37}
38
39static inline void gpio_set_value(unsigned gpio, int value)
40{
41 if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
42 if (value)
43 GPSR = GPIO_GPIO(gpio);
44 else
45 GPCR = GPIO_GPIO(gpio);
46 else
47 __gpio_set_value(gpio, value);
48}
49
50#define gpio_cansleep __gpio_cansleep
51
52static inline unsigned gpio_to_irq(unsigned gpio)
53{
54 if (gpio < 11)
55 return IRQ_GPIO0 + gpio;
56 else
57 return IRQ_GPIO11 - 11 + gpio;
58}
59
60static inline unsigned irq_to_gpio(unsigned irq)
61{
62 if (irq < IRQ_GPIO11_27)
63 return irq - IRQ_GPIO0;
64 else
65 return irq - IRQ_GPIO11 + 11;
66}
67
68#endif
diff --git a/arch/arm/mach-sa1100/include/mach/h3600.h b/arch/arm/mach-sa1100/include/mach/h3600.h
new file mode 100644
index 000000000000..3ca0ecf095e6
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/h3600.h
@@ -0,0 +1,169 @@
1/*
2 *
3 * Definitions for H3600 Handheld Computer
4 *
5 * Copyright 2000 Compaq Computer Corporation.
6 *
7 * Use consistent with the GNU GPL is permitted,
8 * provided that this copyright notice is
9 * preserved in its entirety in all copies and derived works.
10 *
11 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
12 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
13 * FITNESS FOR ANY PARTICULAR PURPOSE.
14 *
15 * Author: Jamey Hicks.
16 *
17 * History:
18 *
19 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
20 *
21 */
22
23#ifndef _INCLUDE_H3600_H_
24#define _INCLUDE_H3600_H_
25
26typedef int __bitwise pm_request_t;
27
28#define PM_SUSPEND ((__force pm_request_t) 1) /* enter D1-D3 */
29#define PM_RESUME ((__force pm_request_t) 2) /* enter D0 */
30
31/* generalized support for H3xxx series Compaq Pocket PC's */
32#define machine_is_h3xxx() (machine_is_h3100() || machine_is_h3600() || machine_is_h3800())
33
34/* Physical memory regions corresponding to chip selects */
35#define H3600_EGPIO_PHYS (SA1100_CS5_PHYS + 0x01000000)
36#define H3600_BANK_2_PHYS SA1100_CS2_PHYS
37#define H3600_BANK_4_PHYS SA1100_CS4_PHYS
38
39/* Virtual memory regions corresponding to chip selects 2 & 4 (used on sleeves) */
40#define H3600_EGPIO_VIRT 0xf0000000
41#define H3600_BANK_2_VIRT 0xf1000000
42#define H3600_BANK_4_VIRT 0xf3800000
43
44/*
45 Machine-independent GPIO definitions
46 --- these are common across all current iPAQ platforms
47*/
48
49#define GPIO_H3600_NPOWER_BUTTON GPIO_GPIO (0) /* Also known as the "off button" */
50
51#define GPIO_H3600_PCMCIA_CD1 GPIO_GPIO (10)
52#define GPIO_H3600_PCMCIA_IRQ1 GPIO_GPIO (11)
53
54/* UDA1341 L3 Interface */
55#define GPIO_H3600_L3_DATA GPIO_GPIO (14)
56#define GPIO_H3600_L3_MODE GPIO_GPIO (15)
57#define GPIO_H3600_L3_CLOCK GPIO_GPIO (16)
58
59#define GPIO_H3600_PCMCIA_CD0 GPIO_GPIO (17)
60#define GPIO_H3600_SYS_CLK GPIO_GPIO (19)
61#define GPIO_H3600_PCMCIA_IRQ0 GPIO_GPIO (21)
62
63#define GPIO_H3600_COM_DCD GPIO_GPIO (23)
64#define GPIO_H3600_OPT_IRQ GPIO_GPIO (24)
65#define GPIO_H3600_COM_CTS GPIO_GPIO (25)
66#define GPIO_H3600_COM_RTS GPIO_GPIO (26)
67
68#define IRQ_GPIO_H3600_NPOWER_BUTTON IRQ_GPIO0
69#define IRQ_GPIO_H3600_PCMCIA_CD1 IRQ_GPIO10
70#define IRQ_GPIO_H3600_PCMCIA_IRQ1 IRQ_GPIO11
71#define IRQ_GPIO_H3600_PCMCIA_CD0 IRQ_GPIO17
72#define IRQ_GPIO_H3600_PCMCIA_IRQ0 IRQ_GPIO21
73#define IRQ_GPIO_H3600_COM_DCD IRQ_GPIO23
74#define IRQ_GPIO_H3600_OPT_IRQ IRQ_GPIO24
75#define IRQ_GPIO_H3600_COM_CTS IRQ_GPIO25
76
77
78#ifndef __ASSEMBLY__
79
80enum ipaq_egpio_type {
81 IPAQ_EGPIO_LCD_POWER, /* Power to the LCD panel */
82 IPAQ_EGPIO_CODEC_NRESET, /* Clear to reset the audio codec (remember to return high) */
83 IPAQ_EGPIO_AUDIO_ON, /* Audio power */
84 IPAQ_EGPIO_QMUTE, /* Audio muting */
85 IPAQ_EGPIO_OPT_NVRAM_ON, /* Non-volatile RAM on extension sleeves (SPI interface) */
86 IPAQ_EGPIO_OPT_ON, /* Power to extension sleeves */
87 IPAQ_EGPIO_CARD_RESET, /* Reset PCMCIA cards on extension sleeve (???) */
88 IPAQ_EGPIO_OPT_RESET, /* Reset option pack (???) */
89 IPAQ_EGPIO_IR_ON, /* IR sensor/emitter power */
90 IPAQ_EGPIO_IR_FSEL, /* IR speed selection 1->fast, 0->slow */
91 IPAQ_EGPIO_RS232_ON, /* Maxim RS232 chip power */
92 IPAQ_EGPIO_VPP_ON, /* Turn on power to flash programming */
93 IPAQ_EGPIO_LCD_ENABLE, /* Enable/disable LCD controller */
94};
95
96struct ipaq_model_ops {
97 const char *generic_name;
98 void (*control)(enum ipaq_egpio_type, int);
99 unsigned long (*read)(void);
100 void (*blank_callback)(int blank);
101 int (*pm_callback)(int req); /* Primary model callback */
102 int (*pm_callback_aux)(int req); /* Secondary callback (used by HAL modules) */
103};
104
105extern struct ipaq_model_ops ipaq_model_ops;
106
107static __inline__ const char * h3600_generic_name(void)
108{
109 return ipaq_model_ops.generic_name;
110}
111
112static __inline__ void assign_h3600_egpio(enum ipaq_egpio_type x, int level)
113{
114 if (ipaq_model_ops.control)
115 ipaq_model_ops.control(x,level);
116}
117
118static __inline__ void clr_h3600_egpio(enum ipaq_egpio_type x)
119{
120 if (ipaq_model_ops.control)
121 ipaq_model_ops.control(x,0);
122}
123
124static __inline__ void set_h3600_egpio(enum ipaq_egpio_type x)
125{
126 if (ipaq_model_ops.control)
127 ipaq_model_ops.control(x,1);
128}
129
130static __inline__ unsigned long read_h3600_egpio(void)
131{
132 if (ipaq_model_ops.read)
133 return ipaq_model_ops.read();
134 return 0;
135}
136
137static __inline__ int h3600_register_blank_callback(void (*f)(int))
138{
139 ipaq_model_ops.blank_callback = f;
140 return 0;
141}
142
143static __inline__ void h3600_unregister_blank_callback(void (*f)(int))
144{
145 ipaq_model_ops.blank_callback = NULL;
146}
147
148
149static __inline__ int h3600_register_pm_callback(int (*f)(int))
150{
151 ipaq_model_ops.pm_callback_aux = f;
152 return 0;
153}
154
155static __inline__ void h3600_unregister_pm_callback(int (*f)(int))
156{
157 ipaq_model_ops.pm_callback_aux = NULL;
158}
159
160static __inline__ int h3600_power_management(int req)
161{
162 if (ipaq_model_ops.pm_callback)
163 return ipaq_model_ops.pm_callback(req);
164 return 0;
165}
166
167#endif /* ASSEMBLY */
168
169#endif /* _INCLUDE_H3600_H_ */
diff --git a/arch/arm/mach-sa1100/include/mach/h3600_gpio.h b/arch/arm/mach-sa1100/include/mach/h3600_gpio.h
new file mode 100644
index 000000000000..62b0b7879685
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/h3600_gpio.h
@@ -0,0 +1,540 @@
1/*
2 *
3 * Definitions for H3600 Handheld Computer
4 *
5 * Copyright 2000 Compaq Computer Corporation.
6 *
7 * Use consistent with the GNU GPL is permitted,
8 * provided that this copyright notice is
9 * preserved in its entirety in all copies and derived works.
10 *
11 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
12 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
13 * FITNESS FOR ANY PARTICULAR PURPOSE.
14 *
15 * Author: Jamey Hicks.
16 *
17 * History:
18 *
19 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
20 *
21 */
22
23#ifndef _INCLUDE_H3600_GPIO_H_
24#define _INCLUDE_H3600_GPIO_H_
25
26/*
27 * GPIO lines that are common across ALL iPAQ models are in "h3600.h"
28 * This file contains machine-specific definitions
29 */
30
31#define GPIO_H3600_SUSPEND GPIO_GPIO (0)
32/* GPIO[2:9] used by LCD on H3600/3800, used as GPIO on H3100 */
33#define GPIO_H3100_BT_ON GPIO_GPIO (2)
34#define GPIO_H3100_GPIO3 GPIO_GPIO (3)
35#define GPIO_H3100_QMUTE GPIO_GPIO (4)
36#define GPIO_H3100_LCD_3V_ON GPIO_GPIO (5)
37#define GPIO_H3100_AUD_ON GPIO_GPIO (6)
38#define GPIO_H3100_AUD_PWR_ON GPIO_GPIO (7)
39#define GPIO_H3100_IR_ON GPIO_GPIO (8)
40#define GPIO_H3100_IR_FSEL GPIO_GPIO (9)
41
42/* for H3600, audio sample rate clock generator */
43#define GPIO_H3600_CLK_SET0 GPIO_GPIO (12)
44#define GPIO_H3600_CLK_SET1 GPIO_GPIO (13)
45
46#define GPIO_H3600_ACTION_BUTTON GPIO_GPIO (18)
47#define GPIO_H3600_SOFT_RESET GPIO_GPIO (20) /* Also known as BATT_FAULT */
48#define GPIO_H3600_OPT_LOCK GPIO_GPIO (22)
49#define GPIO_H3600_OPT_DET GPIO_GPIO (27)
50
51/* H3800 specific pins */
52#define GPIO_H3800_AC_IN GPIO_GPIO (12)
53#define GPIO_H3800_COM_DSR GPIO_GPIO (13)
54#define GPIO_H3800_MMC_INT GPIO_GPIO (18)
55#define GPIO_H3800_NOPT_IND GPIO_GPIO (20) /* Almost exactly the same as GPIO_H3600_OPT_DET */
56#define GPIO_H3800_OPT_BAT_FAULT GPIO_GPIO (22)
57#define GPIO_H3800_CLK_OUT GPIO_GPIO (27)
58
59/****************************************************/
60
61#define IRQ_GPIO_H3600_ACTION_BUTTON IRQ_GPIO18
62#define IRQ_GPIO_H3600_OPT_DET IRQ_GPIO27
63
64#define IRQ_GPIO_H3800_MMC_INT IRQ_GPIO18
65#define IRQ_GPIO_H3800_NOPT_IND IRQ_GPIO20 /* almost same as OPT_DET */
66
67/* H3100 / 3600 EGPIO pins */
68#define EGPIO_H3600_VPP_ON (1 << 0)
69#define EGPIO_H3600_CARD_RESET (1 << 1) /* reset the attached pcmcia/compactflash card. active high. */
70#define EGPIO_H3600_OPT_RESET (1 << 2) /* reset the attached option pack. active high. */
71#define EGPIO_H3600_CODEC_NRESET (1 << 3) /* reset the onboard UDA1341. active low. */
72#define EGPIO_H3600_OPT_NVRAM_ON (1 << 4) /* apply power to optionpack nvram, active high. */
73#define EGPIO_H3600_OPT_ON (1 << 5) /* full power to option pack. active high. */
74#define EGPIO_H3600_LCD_ON (1 << 6) /* enable 3.3V to LCD. active high. */
75#define EGPIO_H3600_RS232_ON (1 << 7) /* UART3 transceiver force on. Active high. */
76
77/* H3600 only EGPIO pins */
78#define EGPIO_H3600_LCD_PCI (1 << 8) /* LCD control IC enable. active high. */
79#define EGPIO_H3600_IR_ON (1 << 9) /* apply power to IR module. active high. */
80#define EGPIO_H3600_AUD_AMP_ON (1 << 10) /* apply power to audio power amp. active high. */
81#define EGPIO_H3600_AUD_PWR_ON (1 << 11) /* apply power to reset of audio circuit. active high. */
82#define EGPIO_H3600_QMUTE (1 << 12) /* mute control for onboard UDA1341. active high. */
83#define EGPIO_H3600_IR_FSEL (1 << 13) /* IR speed select: 1->fast, 0->slow */
84#define EGPIO_H3600_LCD_5V_ON (1 << 14) /* enable 5V to LCD. active high. */
85#define EGPIO_H3600_LVDD_ON (1 << 15) /* enable 9V and -6.5V to LCD. */
86
87/********************* H3800, ASIC #2 ********************/
88
89#define _H3800_ASIC2_Base (H3600_EGPIO_VIRT)
90#define H3800_ASIC2_OFFSET(s,x,y) \
91 (*((volatile s *) (_H3800_ASIC2_Base + _H3800_ASIC2_ ## x ## _Base + _H3800_ASIC2_ ## x ## _ ## y)))
92#define H3800_ASIC2_NOFFSET(s,x,n,y) \
93 (*((volatile s *) (_H3800_ASIC2_Base + _H3800_ASIC2_ ## x ## _ ## n ## _Base + _H3800_ASIC2_ ## x ## _ ## y)))
94
95#define _H3800_ASIC2_GPIO_Base 0x0000
96#define _H3800_ASIC2_GPIO_Direction 0x0000 /* R/W, 16 bits 1:input, 0:output */
97#define _H3800_ASIC2_GPIO_InterruptType 0x0004 /* R/W, 12 bits 1:edge, 0:level */
98#define _H3800_ASIC2_GPIO_InterruptEdgeType 0x0008 /* R/W, 12 bits 1:rising, 0:falling */
99#define _H3800_ASIC2_GPIO_InterruptLevelType 0x000C /* R/W, 12 bits 1:high, 0:low */
100#define _H3800_ASIC2_GPIO_InterruptClear 0x0010 /* W, 12 bits */
101#define _H3800_ASIC2_GPIO_InterruptFlag 0x0010 /* R, 12 bits - reads int status */
102#define _H3800_ASIC2_GPIO_Data 0x0014 /* R/W, 16 bits */
103#define _H3800_ASIC2_GPIO_BattFaultOut 0x0018 /* R/W, 16 bit - sets level on batt fault */
104#define _H3800_ASIC2_GPIO_InterruptEnable 0x001c /* R/W, 12 bits 1:enable interrupt */
105#define _H3800_ASIC2_GPIO_Alternate 0x003c /* R/W, 12+1 bits - set alternate functions */
106
107#define H3800_ASIC2_GPIO_Direction H3800_ASIC2_OFFSET( u16, GPIO, Direction )
108#define H3800_ASIC2_GPIO_InterruptType H3800_ASIC2_OFFSET( u16, GPIO, InterruptType )
109#define H3800_ASIC2_GPIO_InterruptEdgeType H3800_ASIC2_OFFSET( u16, GPIO, InterruptEdgeType )
110#define H3800_ASIC2_GPIO_InterruptLevelType H3800_ASIC2_OFFSET( u16, GPIO, InterruptLevelType )
111#define H3800_ASIC2_GPIO_InterruptClear H3800_ASIC2_OFFSET( u16, GPIO, InterruptClear )
112#define H3800_ASIC2_GPIO_InterruptFlag H3800_ASIC2_OFFSET( u16, GPIO, InterruptFlag )
113#define H3800_ASIC2_GPIO_Data H3800_ASIC2_OFFSET( u16, GPIO, Data )
114#define H3800_ASIC2_GPIO_BattFaultOut H3800_ASIC2_OFFSET( u16, GPIO, BattFaultOut )
115#define H3800_ASIC2_GPIO_InterruptEnable H3800_ASIC2_OFFSET( u16, GPIO, InterruptEnable )
116#define H3800_ASIC2_GPIO_Alternate H3800_ASIC2_OFFSET( u16, GPIO, Alternate )
117
118#define GPIO_H3800_ASIC2_IN_Y1_N (1 << 0) /* Output: Touchscreen Y1 */
119#define GPIO_H3800_ASIC2_IN_X0 (1 << 1) /* Output: Touchscreen X0 */
120#define GPIO_H3800_ASIC2_IN_Y0 (1 << 2) /* Output: Touchscreen Y0 */
121#define GPIO_H3800_ASIC2_IN_X1_N (1 << 3) /* Output: Touchscreen X1 */
122#define GPIO_H3800_ASIC2_BT_RST (1 << 4) /* Output: Bluetooth reset */
123#define GPIO_H3800_ASIC2_PEN_IRQ (1 << 5) /* Input : Pen down */
124#define GPIO_H3800_ASIC2_SD_DETECT (1 << 6) /* Input : SD detect */
125#define GPIO_H3800_ASIC2_EAR_IN_N (1 << 7) /* Input : Audio jack plug inserted */
126#define GPIO_H3800_ASIC2_OPT_PCM_RESET (1 << 8) /* Output: */
127#define GPIO_H3800_ASIC2_OPT_RESET (1 << 9) /* Output: */
128#define GPIO_H3800_ASIC2_USB_DETECT_N (1 << 10) /* Input : */
129#define GPIO_H3800_ASIC2_SD_CON_SLT (1 << 11) /* Input : */
130
131#define _H3800_ASIC2_KPIO_Base 0x0200
132#define _H3800_ASIC2_KPIO_Direction 0x0000 /* R/W, 12 bits 1:input, 0:output */
133#define _H3800_ASIC2_KPIO_InterruptType 0x0004 /* R/W, 12 bits 1:edge, 0:level */
134#define _H3800_ASIC2_KPIO_InterruptEdgeType 0x0008 /* R/W, 12 bits 1:rising, 0:falling */
135#define _H3800_ASIC2_KPIO_InterruptLevelType 0x000C /* R/W, 12 bits 1:high, 0:low */
136#define _H3800_ASIC2_KPIO_InterruptClear 0x0010 /* W, 20 bits - 8 special */
137#define _H3800_ASIC2_KPIO_InterruptFlag 0x0010 /* R, 20 bits - 8 special - reads int status */
138#define _H3800_ASIC2_KPIO_Data 0x0014 /* R/W, 16 bits */
139#define _H3800_ASIC2_KPIO_BattFaultOut 0x0018 /* R/W, 16 bit - sets level on batt fault */
140#define _H3800_ASIC2_KPIO_InterruptEnable 0x001c /* R/W, 20 bits - 8 special */
141#define _H3800_ASIC2_KPIO_Alternate 0x003c /* R/W, 6 bits */
142
143#define H3800_ASIC2_KPIO_Direction H3800_ASIC2_OFFSET( u16, KPIO, Direction )
144#define H3800_ASIC2_KPIO_InterruptType H3800_ASIC2_OFFSET( u16, KPIO, InterruptType )
145#define H3800_ASIC2_KPIO_InterruptEdgeType H3800_ASIC2_OFFSET( u16, KPIO, InterruptEdgeType )
146#define H3800_ASIC2_KPIO_InterruptLevelType H3800_ASIC2_OFFSET( u16, KPIO, InterruptLevelType )
147#define H3800_ASIC2_KPIO_InterruptClear H3800_ASIC2_OFFSET( u32, KPIO, InterruptClear )
148#define H3800_ASIC2_KPIO_InterruptFlag H3800_ASIC2_OFFSET( u32, KPIO, InterruptFlag )
149#define H3800_ASIC2_KPIO_Data H3800_ASIC2_OFFSET( u16, KPIO, Data )
150#define H3800_ASIC2_KPIO_BattFaultOut H3800_ASIC2_OFFSET( u16, KPIO, BattFaultOut )
151#define H3800_ASIC2_KPIO_InterruptEnable H3800_ASIC2_OFFSET( u32, KPIO, InterruptEnable )
152#define H3800_ASIC2_KPIO_Alternate H3800_ASIC2_OFFSET( u16, KPIO, Alternate )
153
154#define H3800_ASIC2_KPIO_SPI_INT ( 1 << 16 )
155#define H3800_ASIC2_KPIO_OWM_INT ( 1 << 17 )
156#define H3800_ASIC2_KPIO_ADC_INT ( 1 << 18 )
157#define H3800_ASIC2_KPIO_UART_0_INT ( 1 << 19 )
158#define H3800_ASIC2_KPIO_UART_1_INT ( 1 << 20 )
159#define H3800_ASIC2_KPIO_TIMER_0_INT ( 1 << 21 )
160#define H3800_ASIC2_KPIO_TIMER_1_INT ( 1 << 22 )
161#define H3800_ASIC2_KPIO_TIMER_2_INT ( 1 << 23 )
162
163#define KPIO_H3800_ASIC2_RECORD_BTN_N (1 << 0) /* Record button */
164#define KPIO_H3800_ASIC2_KEY_5W1_N (1 << 1) /* Keypad */
165#define KPIO_H3800_ASIC2_KEY_5W2_N (1 << 2) /* */
166#define KPIO_H3800_ASIC2_KEY_5W3_N (1 << 3) /* */
167#define KPIO_H3800_ASIC2_KEY_5W4_N (1 << 4) /* */
168#define KPIO_H3800_ASIC2_KEY_5W5_N (1 << 5) /* */
169#define KPIO_H3800_ASIC2_KEY_LEFT_N (1 << 6) /* */
170#define KPIO_H3800_ASIC2_KEY_RIGHT_N (1 << 7) /* */
171#define KPIO_H3800_ASIC2_KEY_AP1_N (1 << 8) /* Old "Calendar" */
172#define KPIO_H3800_ASIC2_KEY_AP2_N (1 << 9) /* Old "Schedule" */
173#define KPIO_H3800_ASIC2_KEY_AP3_N (1 << 10) /* Old "Q" */
174#define KPIO_H3800_ASIC2_KEY_AP4_N (1 << 11) /* Old "Undo" */
175
176/* Alternate KPIO functions (set by default) */
177#define KPIO_ALT_H3800_ASIC2_KEY_5W1_N (1 << 1) /* Action key */
178#define KPIO_ALT_H3800_ASIC2_KEY_5W2_N (1 << 2) /* J1 of keypad input */
179#define KPIO_ALT_H3800_ASIC2_KEY_5W3_N (1 << 3) /* J2 of keypad input */
180#define KPIO_ALT_H3800_ASIC2_KEY_5W4_N (1 << 4) /* J3 of keypad input */
181#define KPIO_ALT_H3800_ASIC2_KEY_5W5_N (1 << 5) /* J4 of keypad input */
182
183#define _H3800_ASIC2_SPI_Base 0x0400
184#define _H3800_ASIC2_SPI_Control 0x0000 /* R/W 8 bits */
185#define _H3800_ASIC2_SPI_Data 0x0004 /* R/W 8 bits */
186#define _H3800_ASIC2_SPI_ChipSelectDisabled 0x0008 /* W 8 bits */
187
188#define H3800_ASIC2_SPI_Control H3800_ASIC2_OFFSET( u8, SPI, Control )
189#define H3800_ASIC2_SPI_Data H3800_ASIC2_OFFSET( u8, SPI, Data )
190#define H3800_ASIC2_SPI_ChipSelectDisabled H3800_ASIC2_OFFSET( u8, SPI, ChipSelectDisabled )
191
192#define _H3800_ASIC2_PWM_0_Base 0x0600
193#define _H3800_ASIC2_PWM_1_Base 0x0700
194#define _H3800_ASIC2_PWM_TimeBase 0x0000 /* R/W 6 bits */
195#define _H3800_ASIC2_PWM_PeriodTime 0x0004 /* R/W 12 bits */
196#define _H3800_ASIC2_PWM_DutyTime 0x0008 /* R/W 12 bits */
197
198#define H3800_ASIC2_PWM_0_TimeBase H3800_ASIC2_NOFFSET( u8, PWM, 0, TimeBase )
199#define H3800_ASIC2_PWM_0_PeriodTime H3800_ASIC2_NOFFSET( u16, PWM, 0, PeriodTime )
200#define H3800_ASIC2_PWM_0_DutyTime H3800_ASIC2_NOFFSET( u16, PWM, 0, DutyTime )
201
202#define H3800_ASIC2_PWM_1_TimeBase H3800_ASIC2_NOFFSET( u8, PWM, 1, TimeBase )
203#define H3800_ASIC2_PWM_1_PeriodTime H3800_ASIC2_NOFFSET( u16, PWM, 1, PeriodTime )
204#define H3800_ASIC2_PWM_1_DutyTime H3800_ASIC2_NOFFSET( u16, PWM, 1, DutyTime )
205
206#define H3800_ASIC2_PWM_TIMEBASE_MASK 0xf /* Low 4 bits sets time base, max = 8 */
207#define H3800_ASIC2_PWM_TIMEBASE_ENABLE ( 1 << 4 ) /* Enable clock */
208#define H3800_ASIC2_PWM_TIMEBASE_CLEAR ( 1 << 5 ) /* Clear the PWM */
209
210#define _H3800_ASIC2_LED_0_Base 0x0800
211#define _H3800_ASIC2_LED_1_Base 0x0880
212#define _H3800_ASIC2_LED_2_Base 0x0900
213#define _H3800_ASIC2_LED_TimeBase 0x0000 /* R/W 7 bits */
214#define _H3800_ASIC2_LED_PeriodTime 0x0004 /* R/W 12 bits */
215#define _H3800_ASIC2_LED_DutyTime 0x0008 /* R/W 12 bits */
216#define _H3800_ASIC2_LED_AutoStopCount 0x000c /* R/W 16 bits */
217
218#define H3800_ASIC2_LED_0_TimeBase H3800_ASIC2_NOFFSET( u8, LED, 0, TimeBase )
219#define H3800_ASIC2_LED_0_PeriodTime H3800_ASIC2_NOFFSET( u16, LED, 0, PeriodTime )
220#define H3800_ASIC2_LED_0_DutyTime H3800_ASIC2_NOFFSET( u16, LED, 0, DutyTime )
221#define H3800_ASIC2_LED_0_AutoStopClock H3800_ASIC2_NOFFSET( u16, LED, 0, AutoStopClock )
222
223#define H3800_ASIC2_LED_1_TimeBase H3800_ASIC2_NOFFSET( u8, LED, 1, TimeBase )
224#define H3800_ASIC2_LED_1_PeriodTime H3800_ASIC2_NOFFSET( u16, LED, 1, PeriodTime )
225#define H3800_ASIC2_LED_1_DutyTime H3800_ASIC2_NOFFSET( u16, LED, 1, DutyTime )
226#define H3800_ASIC2_LED_1_AutoStopClock H3800_ASIC2_NOFFSET( u16, LED, 1, AutoStopClock )
227
228#define H3800_ASIC2_LED_2_TimeBase H3800_ASIC2_NOFFSET( u8, LED, 2, TimeBase )
229#define H3800_ASIC2_LED_2_PeriodTime H3800_ASIC2_NOFFSET( u16, LED, 2, PeriodTime )
230#define H3800_ASIC2_LED_2_DutyTime H3800_ASIC2_NOFFSET( u16, LED, 2, DutyTime )
231#define H3800_ASIC2_LED_2_AutoStopClock H3800_ASIC2_NOFFSET( u16, LED, 2, AutoStopClock )
232
233#define H3800_ASIC2_LED_TIMEBASE_MASK 0x0f /* Low 4 bits sets time base, max = 13 */
234#define H3800_ASIC2_LED_TIMEBASE_BLINK ( 1 << 4 ) /* Enable blinking */
235#define H3800_ASIC2_LED_TIMEBASE_AUTOSTOP ( 1 << 5 )
236#define H3800_ASIC2_LED_TIMEBASE_ALWAYS ( 1 << 6 ) /* Enable blink always */
237
238#define _H3800_ASIC2_UART_0_Base 0x0A00
239#define _H3800_ASIC2_UART_1_Base 0x0C00
240#define _H3800_ASIC2_UART_Receive 0x0000 /* R 8 bits */
241#define _H3800_ASIC2_UART_Transmit 0x0000 /* W 8 bits */
242#define _H3800_ASIC2_UART_IntEnable 0x0004 /* R/W 8 bits */
243#define _H3800_ASIC2_UART_IntVerify 0x0008 /* R/W 8 bits */
244#define _H3800_ASIC2_UART_FIFOControl 0x000c /* R/W 8 bits */
245#define _H3800_ASIC2_UART_LineControl 0x0010 /* R/W 8 bits */
246#define _H3800_ASIC2_UART_ModemStatus 0x0014 /* R/W 8 bits */
247#define _H3800_ASIC2_UART_LineStatus 0x0018 /* R/W 8 bits */
248#define _H3800_ASIC2_UART_ScratchPad 0x001c /* R/W 8 bits */
249#define _H3800_ASIC2_UART_DivisorLatchL 0x0020 /* R/W 8 bits */
250#define _H3800_ASIC2_UART_DivisorLatchH 0x0024 /* R/W 8 bits */
251
252#define H3800_ASIC2_UART_0_Receive H3800_ASIC2_NOFFSET( u8, UART, 0, Receive )
253#define H3800_ASIC2_UART_0_Transmit H3800_ASIC2_NOFFSET( u8, UART, 0, Transmit )
254#define H3800_ASIC2_UART_0_IntEnable H3800_ASIC2_NOFFSET( u8, UART, 0, IntEnable )
255#define H3800_ASIC2_UART_0_IntVerify H3800_ASIC2_NOFFSET( u8, UART, 0, IntVerify )
256#define H3800_ASIC2_UART_0_FIFOControl H3800_ASIC2_NOFFSET( u8, UART, 0, FIFOControl )
257#define H3800_ASIC2_UART_0_LineControl H3800_ASIC2_NOFFSET( u8, UART, 0, LineControl )
258#define H3800_ASIC2_UART_0_ModemStatus H3800_ASIC2_NOFFSET( u8, UART, 0, ModemStatus )
259#define H3800_ASIC2_UART_0_LineStatus H3800_ASIC2_NOFFSET( u8, UART, 0, LineStatus )
260#define H3800_ASIC2_UART_0_ScratchPad H3800_ASIC2_NOFFSET( u8, UART, 0, ScratchPad )
261#define H3800_ASIC2_UART_0_DivisorLatchL H3800_ASIC2_NOFFSET( u8, UART, 0, DivisorLatchL )
262#define H3800_ASIC2_UART_0_DivisorLatchH H3800_ASIC2_NOFFSET( u8, UART, 0, DivisorLatchH )
263
264#define H3800_ASIC2_UART_1_Receive H3800_ASIC2_NOFFSET( u8, UART, 1, Receive )
265#define H3800_ASIC2_UART_1_Transmit H3800_ASIC2_NOFFSET( u8, UART, 1, Transmit )
266#define H3800_ASIC2_UART_1_IntEnable H3800_ASIC2_NOFFSET( u8, UART, 1, IntEnable )
267#define H3800_ASIC2_UART_1_IntVerify H3800_ASIC2_NOFFSET( u8, UART, 1, IntVerify )
268#define H3800_ASIC2_UART_1_FIFOControl H3800_ASIC2_NOFFSET( u8, UART, 1, FIFOControl )
269#define H3800_ASIC2_UART_1_LineControl H3800_ASIC2_NOFFSET( u8, UART, 1, LineControl )
270#define H3800_ASIC2_UART_1_ModemStatus H3800_ASIC2_NOFFSET( u8, UART, 1, ModemStatus )
271#define H3800_ASIC2_UART_1_LineStatus H3800_ASIC2_NOFFSET( u8, UART, 1, LineStatus )
272#define H3800_ASIC2_UART_1_ScratchPad H3800_ASIC2_NOFFSET( u8, UART, 1, ScratchPad )
273#define H3800_ASIC2_UART_1_DivisorLatchL H3800_ASIC2_NOFFSET( u8, UART, 1, DivisorLatchL )
274#define H3800_ASIC2_UART_1_DivisorLatchH H3800_ASIC2_NOFFSET( u8, UART, 1, DivisorLatchH )
275
276#define _H3800_ASIC2_TIMER_Base 0x0E00
277#define _H3800_ASIC2_TIMER_Command 0x0000 /* R/W 8 bits */
278
279#define H3800_ASIC2_TIMER_Command H3800_ASIC2_OFFSET( u8, Timer, Command )
280
281#define H3800_ASIC2_TIMER_GAT_0 ( 1 << 0 ) /* Gate enable, counter 0 */
282#define H3800_ASIC2_TIMER_GAT_1 ( 1 << 1 ) /* Gate enable, counter 1 */
283#define H3800_ASIC2_TIMER_GAT_2 ( 1 << 2 ) /* Gate enable, counter 2 */
284#define H3800_ASIC2_TIMER_CLK_0 ( 1 << 3 ) /* Clock enable, counter 0 */
285#define H3800_ASIC2_TIMER_CLK_1 ( 1 << 4 ) /* Clock enable, counter 1 */
286#define H3800_ASIC2_TIMER_CLK_2 ( 1 << 5 ) /* Clock enable, counter 2 */
287#define H3800_ASIC2_TIMER_MODE_0 ( 1 << 6 ) /* Mode 0 enable, counter 0 */
288#define H3800_ASIC2_TIMER_MODE_1 ( 1 << 7 ) /* Mode 0 enable, counter 1 */
289
290#define _H3800_ASIC2_CLOCK_Base 0x1000
291#define _H3800_ASIC2_CLOCK_Enable 0x0000 /* R/W 18 bits */
292
293#define H3800_ASIC2_CLOCK_Enable H3800_ASIC2_OFFSET( u32, CLOCK, Enable )
294
295#define H3800_ASIC2_CLOCK_AUDIO_1 0x0001 /* Enable 4.1 MHz clock for 8Khz and 4khz sample rate */
296#define H3800_ASIC2_CLOCK_AUDIO_2 0x0002 /* Enable 12.3 MHz clock for 48Khz and 32khz sample rate */
297#define H3800_ASIC2_CLOCK_AUDIO_3 0x0004 /* Enable 5.6 MHz clock for 11 kHZ sample rate */
298#define H3800_ASIC2_CLOCK_AUDIO_4 0x0008 /* Enable 11.289 MHz clock for 44 and 22 kHz sample rate */
299#define H3800_ASIC2_CLOCK_ADC ( 1 << 4 ) /* 1.024 MHz clock to ADC */
300#define H3800_ASIC2_CLOCK_SPI ( 1 << 5 ) /* 4.096 MHz clock to SPI */
301#define H3800_ASIC2_CLOCK_OWM ( 1 << 6 ) /* 4.096 MHz clock to OWM */
302#define H3800_ASIC2_CLOCK_PWM ( 1 << 7 ) /* 2.048 MHz clock to PWM */
303#define H3800_ASIC2_CLOCK_UART_1 ( 1 << 8 ) /* 24.576 MHz clock to UART1 (turn off bit 16) */
304#define H3800_ASIC2_CLOCK_UART_0 ( 1 << 9 ) /* 24.576 MHz clock to UART0 (turn off bit 17) */
305#define H3800_ASIC2_CLOCK_SD_1 ( 1 << 10 ) /* 16.934 MHz to SD */
306#define H3800_ASIC2_CLOCK_SD_2 ( 2 << 10 ) /* 24.576 MHz to SD */
307#define H3800_ASIC2_CLOCK_SD_3 ( 3 << 10 ) /* 33.869 MHz to SD */
308#define H3800_ASIC2_CLOCK_SD_4 ( 4 << 10 ) /* 49.152 MHz to SD */
309#define H3800_ASIC2_CLOCK_EX0 ( 1 << 13 ) /* Enable 32.768 kHz crystal */
310#define H3800_ASIC2_CLOCK_EX1 ( 1 << 14 ) /* Enable 24.576 MHz crystal */
311#define H3800_ASIC2_CLOCK_EX2 ( 1 << 15 ) /* Enable 33.869 MHz crystal */
312#define H3800_ASIC2_CLOCK_SLOW_UART_1 ( 1 << 16 ) /* Enable 3.686 MHz to UART1 (turn off bit 8) */
313#define H3800_ASIC2_CLOCK_SLOW_UART_0 ( 1 << 17 ) /* Enable 3.686 MHz to UART0 (turn off bit 9) */
314
315#define _H3800_ASIC2_ADC_Base 0x1200
316#define _H3800_ASIC2_ADC_Multiplexer 0x0000 /* R/W 4 bits - low 3 bits set channel */
317#define _H3800_ASIC2_ADC_ControlStatus 0x0004 /* R/W 8 bits */
318#define _H3800_ASIC2_ADC_Data 0x0008 /* R 10 bits */
319
320#define H3800_ASIC2_ADC_Multiplexer H3800_ASIC2_OFFSET( u8, ADC, Multiplexer )
321#define H3800_ASIC2_ADC_ControlStatus H3800_ASIC2_OFFSET( u8, ADC, ControlStatus )
322#define H3800_ASIC2_ADC_Data H3800_ASIC2_OFFSET( u16, ADC, Data )
323
324#define H3600_ASIC2_ADC_MUX_CHANNEL_MASK 0x07 /* Low 3 bits sets channel. max = 4 */
325#define H3600_ASIC2_ADC_MUX_CLKEN ( 1 << 3 ) /* Enable clock */
326
327#define H3600_ASIC2_ADC_CSR_ADPS_MASK 0x0f /* Low 4 bits sets prescale, max = 8 */
328#define H3600_ASIC2_ADC_CSR_FREE_RUN ( 1 << 4 )
329#define H3600_ASIC2_ADC_CSR_INT_ENABLE ( 1 << 5 )
330#define H3600_ASIC2_ADC_CSR_START ( 1 << 6 ) /* Set to start conversion. Goes to 0 when done */
331#define H3600_ASIC2_ADC_CSR_ENABLE ( 1 << 7 ) /* 1:power up ADC, 0:power down */
332
333
334#define _H3800_ASIC2_INTR_Base 0x1600
335#define _H3800_ASIC2_INTR_MaskAndFlag 0x0000 /* R/(W) 8bits */
336#define _H3800_ASIC2_INTR_ClockPrescale 0x0004 /* R/(W) 5bits */
337#define _H3800_ASIC2_INTR_TimerSet 0x0008 /* R/(W) 8bits */
338
339#define H3800_ASIC2_INTR_MaskAndFlag H3800_ASIC2_OFFSET( u8, INTR, MaskAndFlag )
340#define H3800_ASIC2_INTR_ClockPrescale H3800_ASIC2_OFFSET( u8, INTR, ClockPrescale )
341#define H3800_ASIC2_INTR_TimerSet H3800_ASIC2_OFFSET( u8, INTR, TimerSet )
342
343#define H3800_ASIC2_INTR_GLOBAL_MASK ( 1 << 0 ) /* Global interrupt mask */
344#define H3800_ASIC2_INTR_POWER_ON_RESET ( 1 << 1 ) /* 01: Power on reset (bits 1 & 2 ) */
345#define H3800_ASIC2_INTR_EXTERNAL_RESET ( 2 << 1 ) /* 10: External reset (bits 1 & 2 ) */
346#define H3800_ASIC2_INTR_MASK_UART_0 ( 1 << 4 )
347#define H3800_ASIC2_INTR_MASK_UART_1 ( 1 << 5 )
348#define H3800_ASIC2_INTR_MASK_TIMER ( 1 << 6 )
349#define H3800_ASIC2_INTR_MASK_OWM ( 1 << 7 )
350
351#define H3800_ASIC2_INTR_CLOCK_PRESCALE 0x0f /* 4 bits, max 14 */
352#define H3800_ASIC2_INTR_SET ( 1 << 4 ) /* Time base enable */
353
354
355#define _H3800_ASIC2_OWM_Base 0x1800
356#define _H3800_ASIC2_OWM_Command 0x0000 /* R/W 4 bits command register */
357#define _H3800_ASIC2_OWM_Data 0x0004 /* R/W 8 bits, transmit / receive buffer */
358#define _H3800_ASIC2_OWM_Interrupt 0x0008 /* R/W Command register */
359#define _H3800_ASIC2_OWM_InterruptEnable 0x000c /* R/W Command register */
360#define _H3800_ASIC2_OWM_ClockDivisor 0x0010 /* R/W 5 bits of divisor and pre-scale */
361
362#define H3800_ASIC2_OWM_Command H3800_ASIC2_OFFSET( u8, OWM, Command )
363#define H3800_ASIC2_OWM_Data H3800_ASIC2_OFFSET( u8, OWM, Data )
364#define H3800_ASIC2_OWM_Interrupt H3800_ASIC2_OFFSET( u8, OWM, Interrupt )
365#define H3800_ASIC2_OWM_InterruptEnable H3800_ASIC2_OFFSET( u8, OWM, InterruptEnable )
366#define H3800_ASIC2_OWM_ClockDivisor H3800_ASIC2_OFFSET( u8, OWM, ClockDivisor )
367
368#define H3800_ASIC2_OWM_CMD_ONE_WIRE_RESET ( 1 << 0 ) /* Set to force reset on 1-wire bus */
369#define H3800_ASIC2_OWM_CMD_SRA ( 1 << 1 ) /* Set to switch to Search ROM accelerator mode */
370#define H3800_ASIC2_OWM_CMD_DQ_OUTPUT ( 1 << 2 ) /* Write only - forces bus low */
371#define H3800_ASIC2_OWM_CMD_DQ_INPUT ( 1 << 3 ) /* Read only - reflects state of bus */
372
373#define H3800_ASIC2_OWM_INT_PD ( 1 << 0 ) /* Presence detect */
374#define H3800_ASIC2_OWM_INT_PDR ( 1 << 1 ) /* Presence detect result */
375#define H3800_ASIC2_OWM_INT_TBE ( 1 << 2 ) /* Transmit buffer empty */
376#define H3800_ASIC2_OWM_INT_TEMT ( 1 << 3 ) /* Transmit shift register empty */
377#define H3800_ASIC2_OWM_INT_RBF ( 1 << 4 ) /* Receive buffer full */
378
379#define H3800_ASIC2_OWM_INTEN_EPD ( 1 << 0 ) /* Enable receive buffer full interrupt */
380#define H3800_ASIC2_OWM_INTEN_IAS ( 1 << 1 ) /* Enable transmit shift register empty interrupt */
381#define H3800_ASIC2_OWM_INTEN_ETBE ( 1 << 2 ) /* Enable transmit buffer empty interrupt */
382#define H3800_ASIC2_OWM_INTEN_ETMT ( 1 << 3 ) /* INTR active state */
383#define H3800_ASIC2_OWM_INTEN_ERBF ( 1 << 4 ) /* Enable presence detect interrupt */
384
385#define _H3800_ASIC2_FlashCtl_Base 0x1A00
386
387/****************************************************/
388/* H3800, ASIC #1
389 * This ASIC is accesed through ASIC #2, and
390 * mapped into the 1c00 - 1f00 region
391 */
392
393#define H3800_ASIC1_OFFSET(s,x,y) \
394 (*((volatile s *) (_H3800_ASIC2_Base + _H3800_ASIC1_ ## x ## _Base + (_H3800_ASIC1_ ## x ## _ ## y << 1))))
395
396#define _H3800_ASIC1_MMC_Base 0x1c00
397
398#define _H3800_ASIC1_MMC_StartStopClock 0x00 /* R/W 8bit */
399#define _H3800_ASIC1_MMC_Status 0x02 /* R See below, default 0x0040 */
400#define _H3800_ASIC1_MMC_ClockRate 0x04 /* R/W 8bit, low 3 bits are clock divisor */
401#define _H3800_ASIC1_MMC_SPIRegister 0x08 /* R/W 8bit, see below */
402#define _H3800_ASIC1_MMC_CmdDataCont 0x0a /* R/W 8bit, write to start MMC adapter */
403#define _H3800_ASIC1_MMC_ResponseTimeout 0x0c /* R/W 8bit, clocks before response timeout */
404#define _H3800_ASIC1_MMC_ReadTimeout 0x0e /* R/W 16bit, clocks before received data timeout */
405#define _H3800_ASIC1_MMC_BlockLength 0x10 /* R/W 10bit */
406#define _H3800_ASIC1_MMC_NumOfBlocks 0x12 /* R/W 16bit, in block mode, number of blocks */
407#define _H3800_ASIC1_MMC_InterruptMask 0x1a /* R/W 8bit */
408#define _H3800_ASIC1_MMC_CommandNumber 0x1c /* R/W 6 bits */
409#define _H3800_ASIC1_MMC_ArgumentH 0x1e /* R/W 16 bits */
410#define _H3800_ASIC1_MMC_ArgumentL 0x20 /* R/W 16 bits */
411#define _H3800_ASIC1_MMC_ResFifo 0x22 /* R 8 x 16 bits - contains response FIFO */
412#define _H3800_ASIC1_MMC_BufferPartFull 0x28 /* R/W 8 bits */
413
414#define H3800_ASIC1_MMC_StartStopClock H3800_ASIC1_OFFSET( u8, MMC, StartStopClock )
415#define H3800_ASIC1_MMC_Status H3800_ASIC1_OFFSET( u16, MMC, Status )
416#define H3800_ASIC1_MMC_ClockRate H3800_ASIC1_OFFSET( u8, MMC, ClockRate )
417#define H3800_ASIC1_MMC_SPIRegister H3800_ASIC1_OFFSET( u8, MMC, SPIRegister )
418#define H3800_ASIC1_MMC_CmdDataCont H3800_ASIC1_OFFSET( u8, MMC, CmdDataCont )
419#define H3800_ASIC1_MMC_ResponseTimeout H3800_ASIC1_OFFSET( u8, MMC, ResponseTimeout )
420#define H3800_ASIC1_MMC_ReadTimeout H3800_ASIC1_OFFSET( u16, MMC, ReadTimeout )
421#define H3800_ASIC1_MMC_BlockLength H3800_ASIC1_OFFSET( u16, MMC, BlockLength )
422#define H3800_ASIC1_MMC_NumOfBlocks H3800_ASIC1_OFFSET( u16, MMC, NumOfBlocks )
423#define H3800_ASIC1_MMC_InterruptMask H3800_ASIC1_OFFSET( u8, MMC, InterruptMask )
424#define H3800_ASIC1_MMC_CommandNumber H3800_ASIC1_OFFSET( u8, MMC, CommandNumber )
425#define H3800_ASIC1_MMC_ArgumentH H3800_ASIC1_OFFSET( u16, MMC, ArgumentH )
426#define H3800_ASIC1_MMC_ArgumentL H3800_ASIC1_OFFSET( u16, MMC, ArgumentL )
427#define H3800_ASIC1_MMC_ResFifo H3800_ASIC1_OFFSET( u16, MMC, ResFifo )
428#define H3800_ASIC1_MMC_BufferPartFull H3800_ASIC1_OFFSET( u8, MMC, BufferPartFull )
429
430#define H3800_ASIC1_MMC_STOP_CLOCK (1 << 0) /* Write to "StartStopClock" register */
431#define H3800_ASIC1_MMC_START_CLOCK (1 << 1)
432
433#define H3800_ASIC1_MMC_STATUS_READ_TIMEOUT (1 << 0)
434#define H3800_ASIC1_MMC_STATUS_RESPONSE_TIMEOUT (1 << 1)
435#define H3800_ASIC1_MMC_STATUS_CRC_WRITE_ERROR (1 << 2)
436#define H3800_ASIC1_MMC_STATUS_CRC_READ_ERROR (1 << 3)
437#define H3800_ASIC1_MMC_STATUS_SPI_READ_ERROR (1 << 4) /* SPI data token error received */
438#define H3800_ASIC1_MMC_STATUS_CRC_RESPONSE_ERROR (1 << 5)
439#define H3800_ASIC1_MMC_STATUS_FIFO_EMPTY (1 << 6)
440#define H3800_ASIC1_MMC_STATUS_FIFO_FULL (1 << 7)
441#define H3800_ASIC1_MMC_STATUS_CLOCK_ENABLE (1 << 8) /* MultiMediaCard clock stopped */
442#define H3800_ASIC1_MMC_STATUS_DATA_TRANSFER_DONE (1 << 11) /* Write operation, indicates transfer finished */
443#define H3800_ASIC1_MMC_STATUS_END_PROGRAM (1 << 12) /* End write and read operations */
444#define H3800_ASIC1_MMC_STATUS_END_COMMAND_RESPONSE (1 << 13) /* End command response */
445
446#define H3800_ASIC1_MMC_SPI_REG_SPI_ENABLE (1 << 0) /* Enables SPI mode */
447#define H3800_ASIC1_MMC_SPI_REG_CRC_ON (1 << 1) /* 1:turn on CRC */
448#define H3800_ASIC1_MMC_SPI_REG_SPI_CS_ENABLE (1 << 2) /* 1:turn on SPI CS */
449#define H3800_ASIC1_MMC_SPI_REG_CS_ADDRESS_MASK 0x38 /* Bits 3,4,5 are the SPI CS relative address */
450
451#define H3800_ASIC1_MMC_CMD_DATA_CONT_FORMAT_NO_RESPONSE 0x00
452#define H3800_ASIC1_MMC_CMD_DATA_CONT_FORMAT_R1 0x01
453#define H3800_ASIC1_MMC_CMD_DATA_CONT_FORMAT_R2 0x02
454#define H3800_ASIC1_MMC_CMD_DATA_CONT_FORMAT_R3 0x03
455#define H3800_ASIC1_MMC_CMD_DATA_CONT_DATA_ENABLE (1 << 2) /* This command contains a data transfer */
456#define H3800_ASIC1_MMC_CMD_DATA_CONT_WRITE (1 << 3) /* This data transfer is a write */
457#define H3800_ASIC1_MMC_CMD_DATA_CONT_STREAM_MODE (1 << 4) /* This data transfer is in stream mode */
458#define H3800_ASIC1_MMC_CMD_DATA_CONT_BUSY_BIT (1 << 5) /* Busy signal expected after current cmd */
459#define H3800_ASIC1_MMC_CMD_DATA_CONT_INITIALIZE (1 << 6) /* Enables the 80 bits for initializing card */
460
461#define H3800_ASIC1_MMC_INT_MASK_DATA_TRANSFER_DONE (1 << 0)
462#define H3800_ASIC1_MMC_INT_MASK_PROGRAM_DONE (1 << 1)
463#define H3800_ASIC1_MMC_INT_MASK_END_COMMAND_RESPONSE (1 << 2)
464#define H3800_ASIC1_MMC_INT_MASK_BUFFER_READY (1 << 3)
465
466#define H3800_ASIC1_MMC_BUFFER_PART_FULL (1 << 0)
467
468/********* GPIO **********/
469
470#define _H3800_ASIC1_GPIO_Base 0x1e00
471
472#define _H3800_ASIC1_GPIO_Mask 0x30 /* R/W 0:don't mask, 1:mask interrupt */
473#define _H3800_ASIC1_GPIO_Direction 0x32 /* R/W 0:input, 1:output */
474#define _H3800_ASIC1_GPIO_Out 0x34 /* R/W 0:output low, 1:output high */
475#define _H3800_ASIC1_GPIO_TriggerType 0x36 /* R/W 0:level, 1:edge */
476#define _H3800_ASIC1_GPIO_EdgeTrigger 0x38 /* R/W 0:falling, 1:rising */
477#define _H3800_ASIC1_GPIO_LevelTrigger 0x3A /* R/W 0:low, 1:high level detect */
478#define _H3800_ASIC1_GPIO_LevelStatus 0x3C /* R/W 0:none, 1:detect */
479#define _H3800_ASIC1_GPIO_EdgeStatus 0x3E /* R/W 0:none, 1:detect */
480#define _H3800_ASIC1_GPIO_State 0x40 /* R See masks below (default 0) */
481#define _H3800_ASIC1_GPIO_Reset 0x42 /* R/W See masks below (default 0x04) */
482#define _H3800_ASIC1_GPIO_SleepMask 0x44 /* R/W 0:don't mask, 1:mask trigger in sleep mode */
483#define _H3800_ASIC1_GPIO_SleepDir 0x46 /* R/W direction 0:input, 1:output in sleep mode */
484#define _H3800_ASIC1_GPIO_SleepOut 0x48 /* R/W level 0:low, 1:high in sleep mode */
485#define _H3800_ASIC1_GPIO_Status 0x4A /* R Pin status */
486#define _H3800_ASIC1_GPIO_BattFaultDir 0x4C /* R/W direction 0:input, 1:output in batt_fault */
487#define _H3800_ASIC1_GPIO_BattFaultOut 0x4E /* R/W level 0:low, 1:high in batt_fault */
488
489#define H3800_ASIC1_GPIO_Mask H3800_ASIC1_OFFSET( u16, GPIO, Mask )
490#define H3800_ASIC1_GPIO_Direction H3800_ASIC1_OFFSET( u16, GPIO, Direction )
491#define H3800_ASIC1_GPIO_Out H3800_ASIC1_OFFSET( u16, GPIO, Out )
492#define H3800_ASIC1_GPIO_TriggerType H3800_ASIC1_OFFSET( u16, GPIO, TriggerType )
493#define H3800_ASIC1_GPIO_EdgeTrigger H3800_ASIC1_OFFSET( u16, GPIO, EdgeTrigger )
494#define H3800_ASIC1_GPIO_LevelTrigger H3800_ASIC1_OFFSET( u16, GPIO, LevelTrigger )
495#define H3800_ASIC1_GPIO_LevelStatus H3800_ASIC1_OFFSET( u16, GPIO, LevelStatus )
496#define H3800_ASIC1_GPIO_EdgeStatus H3800_ASIC1_OFFSET( u16, GPIO, EdgeStatus )
497#define H3800_ASIC1_GPIO_State H3800_ASIC1_OFFSET( u8, GPIO, State )
498#define H3800_ASIC1_GPIO_Reset H3800_ASIC1_OFFSET( u8, GPIO, Reset )
499#define H3800_ASIC1_GPIO_SleepMask H3800_ASIC1_OFFSET( u16, GPIO, SleepMask )
500#define H3800_ASIC1_GPIO_SleepDir H3800_ASIC1_OFFSET( u16, GPIO, SleepDir )
501#define H3800_ASIC1_GPIO_SleepOut H3800_ASIC1_OFFSET( u16, GPIO, SleepOut )
502#define H3800_ASIC1_GPIO_Status H3800_ASIC1_OFFSET( u16, GPIO, Status )
503#define H3800_ASIC1_GPIO_BattFaultDir H3800_ASIC1_OFFSET( u16, GPIO, BattFaultDir )
504#define H3800_ASIC1_GPIO_BattFaultOut H3800_ASIC1_OFFSET( u16, GPIO, BattFaultOut )
505
506#define H3800_ASIC1_GPIO_STATE_MASK (1 << 0)
507#define H3800_ASIC1_GPIO_STATE_DIRECTION (1 << 1)
508#define H3800_ASIC1_GPIO_STATE_OUT (1 << 2)
509#define H3800_ASIC1_GPIO_STATE_TRIGGER_TYPE (1 << 3)
510#define H3800_ASIC1_GPIO_STATE_EDGE_TRIGGER (1 << 4)
511#define H3800_ASIC1_GPIO_STATE_LEVEL_TRIGGER (1 << 5)
512
513#define H3800_ASIC1_GPIO_RESET_SOFTWARE (1 << 0)
514#define H3800_ASIC1_GPIO_RESET_AUTO_SLEEP (1 << 1)
515#define H3800_ASIC1_GPIO_RESET_FIRST_PWR_ON (1 << 2)
516
517/* These are all outputs */
518#define GPIO_H3800_ASIC1_IR_ON_N (1 << 0) /* Apply power to the IR Module */
519#define GPIO_H3800_ASIC1_SD_PWR_ON (1 << 1) /* Secure Digital power on */
520#define GPIO_H3800_ASIC1_RS232_ON (1 << 2) /* Turn on power to the RS232 chip ? */
521#define GPIO_H3800_ASIC1_PULSE_GEN (1 << 3) /* Goes to speaker / earphone */
522#define GPIO_H3800_ASIC1_CH_TIMER (1 << 4) /* */
523#define GPIO_H3800_ASIC1_LCD_5V_ON (1 << 5) /* Enables LCD_5V */
524#define GPIO_H3800_ASIC1_LCD_ON (1 << 6) /* Enables LCD_3V */
525#define GPIO_H3800_ASIC1_LCD_PCI (1 << 7) /* Connects to PDWN on LCD controller */
526#define GPIO_H3800_ASIC1_VGH_ON (1 << 8) /* Drives VGH on the LCD (+9??) */
527#define GPIO_H3800_ASIC1_VGL_ON (1 << 9) /* Drivers VGL on the LCD (-6??) */
528#define GPIO_H3800_ASIC1_FL_PWR_ON (1 << 10) /* Frontlight power on */
529#define GPIO_H3800_ASIC1_BT_PWR_ON (1 << 11) /* Bluetooth power on */
530#define GPIO_H3800_ASIC1_SPK_ON (1 << 12) /* */
531#define GPIO_H3800_ASIC1_EAR_ON_N (1 << 13) /* */
532#define GPIO_H3800_ASIC1_AUD_PWR_ON (1 << 14) /* */
533
534/* Write enable for the flash */
535
536#define _H3800_ASIC1_FlashWP_Base 0x1F00
537#define _H3800_ASIC1_FlashWP_VPP_ON 0x00 /* R 1: write, 0: protect */
538#define H3800_ASIC1_FlashWP_VPP_ON H3800_ASIC1_OFFSET( u8, FlashWP, VPP_ON )
539
540#endif /* _INCLUDE_H3600_GPIO_H_ */
diff --git a/arch/arm/mach-sa1100/include/mach/hardware.h b/arch/arm/mach-sa1100/include/mach/hardware.h
new file mode 100644
index 000000000000..5976435f42c2
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/hardware.h
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/hardware.h
3 *
4 * Copyright (C) 1998 Nicolas Pitre <nico@cam.org>
5 *
6 * This file contains the hardware definitions for SA1100 architecture
7 *
8 * 2000/05/23 John Dorsey <john+@cs.cmu.edu>
9 * Definitions for SA1111 added.
10 */
11
12#ifndef __ASM_ARCH_HARDWARE_H
13#define __ASM_ARCH_HARDWARE_H
14
15
16#define UNCACHEABLE_ADDR 0xfa050000
17
18
19/*
20 * SA1100 internal I/O mappings
21 *
22 * We have the following mapping:
23 * phys virt
24 * 80000000 f8000000
25 * 90000000 fa000000
26 * a0000000 fc000000
27 * b0000000 fe000000
28 */
29
30#define VIO_BASE 0xf8000000 /* virtual start of IO space */
31#define VIO_SHIFT 3 /* x = IO space shrink power */
32#define PIO_START 0x80000000 /* physical start of IO space */
33
34#define io_p2v( x ) \
35 ( (((x)&0x00ffffff) | (((x)&0x30000000)>>VIO_SHIFT)) + VIO_BASE )
36#define io_v2p( x ) \
37 ( (((x)&0x00ffffff) | (((x)&(0x30000000>>VIO_SHIFT))<<VIO_SHIFT)) + PIO_START )
38
39#ifndef __ASSEMBLY__
40
41# define __REG(x) (*((volatile unsigned long *)io_p2v(x)))
42# define __PREG(x) (io_v2p((unsigned long)&(x)))
43
44#else
45
46# define __REG(x) io_p2v(x)
47# define __PREG(x) io_v2p(x)
48
49#endif
50
51#include "SA-1100.h"
52
53#ifdef CONFIG_SA1101
54#include "SA-1101.h"
55#endif
56
57#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-sa1100/include/mach/ide.h b/arch/arm/mach-sa1100/include/mach/ide.h
new file mode 100644
index 000000000000..4c99c8f5e617
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/ide.h
@@ -0,0 +1,75 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/ide.h
3 *
4 * Copyright (c) 1998 Hugo Fiennes & Nicolas Pitre
5 *
6 * 18-aug-2000: Cleanup by Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
7 * Get rid of the special ide_init_hwif_ports() functions
8 * and make a generalised function that can be used by all
9 * architectures.
10 */
11
12#include <asm/irq.h>
13#include <mach/hardware.h>
14#include <asm/mach-types.h>
15
16#error "This code is broken and needs update to match with current ide support"
17
18
19/*
20 * Set up a hw structure for a specified data port, control port and IRQ.
21 * This should follow whatever the default interface uses.
22 */
23static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
24 unsigned long ctrl_port, int *irq)
25{
26 unsigned long reg = data_port;
27 int i;
28 int regincr = 1;
29
30 /* The Empeg board has the first two address lines unused */
31 if (machine_is_empeg())
32 regincr = 1 << 2;
33
34 /* The LART doesn't use A0 for IDE */
35 if (machine_is_lart())
36 regincr = 1 << 1;
37
38 memset(hw, 0, sizeof(*hw));
39
40 for (i = 0; i <= 7; i++) {
41 hw->io_ports_array[i] = reg;
42 reg += regincr;
43 }
44
45 hw->io_ports.ctl_addr = ctrl_port;
46
47 if (irq)
48 *irq = 0;
49}
50
51/*
52 * This registers the standard ports for this architecture with the IDE
53 * driver.
54 */
55static __inline__ void
56ide_init_default_hwifs(void)
57{
58 if (machine_is_lart()) {
59#ifdef CONFIG_SA1100_LART
60 hw_regs_t hw;
61
62 /* Enable GPIO as interrupt line */
63 GPDR &= ~LART_GPIO_IDE;
64 set_irq_type(LART_IRQ_IDE, IRQ_TYPE_EDGE_RISING);
65
66 /* set PCMCIA interface timing */
67 MECR = 0x00060006;
68
69 /* init the interface */
70 ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x0000, PCMCIA_IO_0_BASE + 0x1000, NULL);
71 hw.irq = LART_IRQ_IDE;
72 ide_register_hw(&hw);
73#endif
74 }
75}
diff --git a/arch/arm/mach-sa1100/include/mach/io.h b/arch/arm/mach-sa1100/include/mach/io.h
new file mode 100644
index 000000000000..0c070a6149bc
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/io.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/io.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 *
6 * Modifications:
7 * 06-12-1997 RMK Created.
8 * 07-04-1999 RMK Major cleanup
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 * We don't actually have real ISA nor PCI buses, but there is so many
17 * drivers out there that might just work if we fake them...
18 */
19static inline void __iomem *__io(unsigned long addr)
20{
21 return (void __iomem *)addr;
22}
23#define __io(a) __io(a)
24#define __mem_pci(a) (a)
25
26#endif
diff --git a/arch/arm/mach-sa1100/include/mach/irqs.h b/arch/arm/mach-sa1100/include/mach/irqs.h
new file mode 100644
index 000000000000..0cb36609b3ac
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/irqs.h
@@ -0,0 +1,197 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/irqs.h
3 *
4 * Copyright (C) 1996 Russell King
5 * Copyright (C) 1998 Deborah Wallach (updates for SA1100/Brutus).
6 * Copyright (C) 1999 Nicolas Pitre (full GPIO irq isolation)
7 *
8 * 2001/11/14 RMK Cleaned up and standardised a lot of the IRQs.
9 */
10
11#define IRQ_GPIO0 0
12#define IRQ_GPIO1 1
13#define IRQ_GPIO2 2
14#define IRQ_GPIO3 3
15#define IRQ_GPIO4 4
16#define IRQ_GPIO5 5
17#define IRQ_GPIO6 6
18#define IRQ_GPIO7 7
19#define IRQ_GPIO8 8
20#define IRQ_GPIO9 9
21#define IRQ_GPIO10 10
22#define IRQ_GPIO11_27 11
23#define IRQ_LCD 12 /* LCD controller */
24#define IRQ_Ser0UDC 13 /* Ser. port 0 UDC */
25#define IRQ_Ser1SDLC 14 /* Ser. port 1 SDLC */
26#define IRQ_Ser1UART 15 /* Ser. port 1 UART */
27#define IRQ_Ser2ICP 16 /* Ser. port 2 ICP */
28#define IRQ_Ser3UART 17 /* Ser. port 3 UART */
29#define IRQ_Ser4MCP 18 /* Ser. port 4 MCP */
30#define IRQ_Ser4SSP 19 /* Ser. port 4 SSP */
31#define IRQ_DMA0 20 /* DMA controller channel 0 */
32#define IRQ_DMA1 21 /* DMA controller channel 1 */
33#define IRQ_DMA2 22 /* DMA controller channel 2 */
34#define IRQ_DMA3 23 /* DMA controller channel 3 */
35#define IRQ_DMA4 24 /* DMA controller channel 4 */
36#define IRQ_DMA5 25 /* DMA controller channel 5 */
37#define IRQ_OST0 26 /* OS Timer match 0 */
38#define IRQ_OST1 27 /* OS Timer match 1 */
39#define IRQ_OST2 28 /* OS Timer match 2 */
40#define IRQ_OST3 29 /* OS Timer match 3 */
41#define IRQ_RTC1Hz 30 /* RTC 1 Hz clock */
42#define IRQ_RTCAlrm 31 /* RTC Alarm */
43
44#define IRQ_GPIO11 32
45#define IRQ_GPIO12 33
46#define IRQ_GPIO13 34
47#define IRQ_GPIO14 35
48#define IRQ_GPIO15 36
49#define IRQ_GPIO16 37
50#define IRQ_GPIO17 38
51#define IRQ_GPIO18 39
52#define IRQ_GPIO19 40
53#define IRQ_GPIO20 41
54#define IRQ_GPIO21 42
55#define IRQ_GPIO22 43
56#define IRQ_GPIO23 44
57#define IRQ_GPIO24 45
58#define IRQ_GPIO25 46
59#define IRQ_GPIO26 47
60#define IRQ_GPIO27 48
61
62/*
63 * The next 16 interrupts are for board specific purposes. Since
64 * the kernel can only run on one machine at a time, we can re-use
65 * these. If you need more, increase IRQ_BOARD_END, but keep it
66 * within sensible limits. IRQs 49 to 64 are available.
67 */
68#define IRQ_BOARD_START 49
69#define IRQ_BOARD_END 65
70
71#define IRQ_SA1111_START (IRQ_BOARD_END)
72#define IRQ_GPAIN0 (IRQ_BOARD_END + 0)
73#define IRQ_GPAIN1 (IRQ_BOARD_END + 1)
74#define IRQ_GPAIN2 (IRQ_BOARD_END + 2)
75#define IRQ_GPAIN3 (IRQ_BOARD_END + 3)
76#define IRQ_GPBIN0 (IRQ_BOARD_END + 4)
77#define IRQ_GPBIN1 (IRQ_BOARD_END + 5)
78#define IRQ_GPBIN2 (IRQ_BOARD_END + 6)
79#define IRQ_GPBIN3 (IRQ_BOARD_END + 7)
80#define IRQ_GPBIN4 (IRQ_BOARD_END + 8)
81#define IRQ_GPBIN5 (IRQ_BOARD_END + 9)
82#define IRQ_GPCIN0 (IRQ_BOARD_END + 10)
83#define IRQ_GPCIN1 (IRQ_BOARD_END + 11)
84#define IRQ_GPCIN2 (IRQ_BOARD_END + 12)
85#define IRQ_GPCIN3 (IRQ_BOARD_END + 13)
86#define IRQ_GPCIN4 (IRQ_BOARD_END + 14)
87#define IRQ_GPCIN5 (IRQ_BOARD_END + 15)
88#define IRQ_GPCIN6 (IRQ_BOARD_END + 16)
89#define IRQ_GPCIN7 (IRQ_BOARD_END + 17)
90#define IRQ_MSTXINT (IRQ_BOARD_END + 18)
91#define IRQ_MSRXINT (IRQ_BOARD_END + 19)
92#define IRQ_MSSTOPERRINT (IRQ_BOARD_END + 20)
93#define IRQ_TPTXINT (IRQ_BOARD_END + 21)
94#define IRQ_TPRXINT (IRQ_BOARD_END + 22)
95#define IRQ_TPSTOPERRINT (IRQ_BOARD_END + 23)
96#define SSPXMTINT (IRQ_BOARD_END + 24)
97#define SSPRCVINT (IRQ_BOARD_END + 25)
98#define SSPROR (IRQ_BOARD_END + 26)
99#define AUDXMTDMADONEA (IRQ_BOARD_END + 32)
100#define AUDRCVDMADONEA (IRQ_BOARD_END + 33)
101#define AUDXMTDMADONEB (IRQ_BOARD_END + 34)
102#define AUDRCVDMADONEB (IRQ_BOARD_END + 35)
103#define AUDTFSR (IRQ_BOARD_END + 36)
104#define AUDRFSR (IRQ_BOARD_END + 37)
105#define AUDTUR (IRQ_BOARD_END + 38)
106#define AUDROR (IRQ_BOARD_END + 39)
107#define AUDDTS (IRQ_BOARD_END + 40)
108#define AUDRDD (IRQ_BOARD_END + 41)
109#define AUDSTO (IRQ_BOARD_END + 42)
110#define IRQ_USBPWR (IRQ_BOARD_END + 43)
111#define IRQ_HCIM (IRQ_BOARD_END + 44)
112#define IRQ_HCIBUFFACC (IRQ_BOARD_END + 45)
113#define IRQ_HCIRMTWKP (IRQ_BOARD_END + 46)
114#define IRQ_NHCIMFCIR (IRQ_BOARD_END + 47)
115#define IRQ_USB_PORT_RESUME (IRQ_BOARD_END + 48)
116#define IRQ_S0_READY_NINT (IRQ_BOARD_END + 49)
117#define IRQ_S1_READY_NINT (IRQ_BOARD_END + 50)
118#define IRQ_S0_CD_VALID (IRQ_BOARD_END + 51)
119#define IRQ_S1_CD_VALID (IRQ_BOARD_END + 52)
120#define IRQ_S0_BVD1_STSCHG (IRQ_BOARD_END + 53)
121#define IRQ_S1_BVD1_STSCHG (IRQ_BOARD_END + 54)
122
123#define IRQ_LOCOMO_START (IRQ_BOARD_END)
124#define IRQ_LOCOMO_KEY (IRQ_BOARD_END + 0)
125#define IRQ_LOCOMO_GPIO0 (IRQ_BOARD_END + 1)
126#define IRQ_LOCOMO_GPIO1 (IRQ_BOARD_END + 2)
127#define IRQ_LOCOMO_GPIO2 (IRQ_BOARD_END + 3)
128#define IRQ_LOCOMO_GPIO3 (IRQ_BOARD_END + 4)
129#define IRQ_LOCOMO_GPIO4 (IRQ_BOARD_END + 5)
130#define IRQ_LOCOMO_GPIO5 (IRQ_BOARD_END + 6)
131#define IRQ_LOCOMO_GPIO6 (IRQ_BOARD_END + 7)
132#define IRQ_LOCOMO_GPIO7 (IRQ_BOARD_END + 8)
133#define IRQ_LOCOMO_GPIO8 (IRQ_BOARD_END + 9)
134#define IRQ_LOCOMO_GPIO9 (IRQ_BOARD_END + 10)
135#define IRQ_LOCOMO_GPIO10 (IRQ_BOARD_END + 11)
136#define IRQ_LOCOMO_GPIO11 (IRQ_BOARD_END + 12)
137#define IRQ_LOCOMO_GPIO12 (IRQ_BOARD_END + 13)
138#define IRQ_LOCOMO_GPIO13 (IRQ_BOARD_END + 14)
139#define IRQ_LOCOMO_GPIO14 (IRQ_BOARD_END + 15)
140#define IRQ_LOCOMO_GPIO15 (IRQ_BOARD_END + 16)
141#define IRQ_LOCOMO_LT (IRQ_BOARD_END + 17)
142#define IRQ_LOCOMO_SPI_RFR (IRQ_BOARD_END + 18)
143#define IRQ_LOCOMO_SPI_RFW (IRQ_BOARD_END + 19)
144#define IRQ_LOCOMO_SPI_REND (IRQ_BOARD_END + 20)
145#define IRQ_LOCOMO_SPI_TEND (IRQ_BOARD_END + 21)
146
147/*
148 * Figure out the MAX IRQ number.
149 *
150 * If we have an SA1111, the max IRQ is S1_BVD1_STSCHG+1.
151 * If we have an LoCoMo, the max IRQ is IRQ_LOCOMO_SPI_TEND+1
152 * Otherwise, we have the standard IRQs only.
153 */
154#ifdef CONFIG_SA1111
155#define NR_IRQS (IRQ_S1_BVD1_STSCHG + 1)
156#elif defined(CONFIG_SA1100_H3800)
157#define NR_IRQS (IRQ_BOARD_END)
158#elif defined(CONFIG_SHARP_LOCOMO)
159#define NR_IRQS (IRQ_LOCOMO_SPI_TEND + 1)
160#else
161#define NR_IRQS (IRQ_BOARD_START)
162#endif
163
164/*
165 * Board specific IRQs. Define them here.
166 * Do not surround them with ifdefs.
167 */
168#define IRQ_NEPONSET_SMC9196 (IRQ_BOARD_START + 0)
169#define IRQ_NEPONSET_USAR (IRQ_BOARD_START + 1)
170#define IRQ_NEPONSET_SA1111 (IRQ_BOARD_START + 2)
171
172/* LoCoMo Interrupts (CONFIG_SHARP_LOCOMO) */
173#define IRQ_LOCOMO_KEY_BASE (IRQ_BOARD_START + 0)
174#define IRQ_LOCOMO_GPIO_BASE (IRQ_BOARD_START + 1)
175#define IRQ_LOCOMO_LT_BASE (IRQ_BOARD_START + 2)
176#define IRQ_LOCOMO_SPI_BASE (IRQ_BOARD_START + 3)
177
178/* H3800-specific IRQs (CONFIG_SA1100_H3800) */
179#define H3800_KPIO_IRQ_START (IRQ_BOARD_START)
180#define IRQ_H3800_KEY (IRQ_BOARD_START + 0)
181#define IRQ_H3800_SPI (IRQ_BOARD_START + 1)
182#define IRQ_H3800_OWM (IRQ_BOARD_START + 2)
183#define IRQ_H3800_ADC (IRQ_BOARD_START + 3)
184#define IRQ_H3800_UART_0 (IRQ_BOARD_START + 4)
185#define IRQ_H3800_UART_1 (IRQ_BOARD_START + 5)
186#define IRQ_H3800_TIMER_0 (IRQ_BOARD_START + 6)
187#define IRQ_H3800_TIMER_1 (IRQ_BOARD_START + 7)
188#define IRQ_H3800_TIMER_2 (IRQ_BOARD_START + 8)
189#define H3800_KPIO_IRQ_COUNT 9
190
191#define H3800_GPIO_IRQ_START (IRQ_BOARD_START + 9)
192#define IRQ_H3800_PEN (IRQ_BOARD_START + 9)
193#define IRQ_H3800_SD_DETECT (IRQ_BOARD_START + 10)
194#define IRQ_H3800_EAR_IN (IRQ_BOARD_START + 11)
195#define IRQ_H3800_USB_DETECT (IRQ_BOARD_START + 12)
196#define IRQ_H3800_SD_CON_SLT (IRQ_BOARD_START + 13)
197#define H3800_GPIO_IRQ_COUNT 5
diff --git a/arch/arm/mach-sa1100/include/mach/jornada720.h b/arch/arm/mach-sa1100/include/mach/jornada720.h
new file mode 100644
index 000000000000..bc120850d313
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/jornada720.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/jornada720.h
3 *
4 * This file contains SSP/MCU communication definitions for HP Jornada 710/720/728
5 *
6 * Copyright (C) 2007 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
7 * Copyright (C) 2000 John Ankcorn <jca@lcs.mit.edu>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15 /* HP Jornada 7xx microprocessor commands */
16#define GETBATTERYDATA 0xc0
17#define GETSCANKEYCODE 0x90
18#define GETTOUCHSAMPLES 0xa0
19#define GETCONTRAST 0xD0
20#define SETCONTRAST 0xD1
21#define GETBRIGHTNESS 0xD2
22#define SETBRIGHTNESS 0xD3
23#define CONTRASTOFF 0xD8
24#define BRIGHTNESSOFF 0xD9
25#define PWMOFF 0xDF
26#define TXDUMMY 0x11
27#define ERRORCODE 0x00
diff --git a/arch/arm/mach-sa1100/include/mach/lart.h b/arch/arm/mach-sa1100/include/mach/lart.h
new file mode 100644
index 000000000000..8a5482d908db
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/lart.h
@@ -0,0 +1,13 @@
1#ifndef _INCLUDE_LART_H
2#define _INCLUDE_LART_H
3
4#define LART_GPIO_ETH0 GPIO_GPIO0
5#define LART_IRQ_ETH0 IRQ_GPIO0
6
7#define LART_GPIO_IDE GPIO_GPIO1
8#define LART_IRQ_IDE IRQ_GPIO1
9
10#define LART_GPIO_UCB1200 GPIO_GPIO18
11#define LART_IRQ_UCB1200 IRQ_GPIO18
12
13#endif
diff --git a/arch/arm/mach-sa1100/include/mach/mcp.h b/arch/arm/mach-sa1100/include/mach/mcp.h
new file mode 100644
index 000000000000..fb8b09a57ad7
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/mcp.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/mcp.h
3 *
4 * Copyright (C) 2005 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_ARCH_MCP_H
11#define __ASM_ARM_ARCH_MCP_H
12
13#include <linux/types.h>
14
15struct mcp_plat_data {
16 u32 mccr0;
17 u32 mccr1;
18 unsigned int sclk_rate;
19};
20
21#endif
diff --git a/arch/arm/mach-sa1100/include/mach/memory.h b/arch/arm/mach-sa1100/include/mach/memory.h
new file mode 100644
index 000000000000..29f639e2afc6
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/memory.h
@@ -0,0 +1,68 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/memory.h
3 *
4 * Copyright (C) 1999-2000 Nicolas Pitre <nico@cam.org>
5 */
6
7#ifndef __ASM_ARCH_MEMORY_H
8#define __ASM_ARCH_MEMORY_H
9
10#include <asm/sizes.h>
11
12/*
13 * Physical DRAM offset is 0xc0000000 on the SA1100
14 */
15#define PHYS_OFFSET UL(0xc0000000)
16
17#ifndef __ASSEMBLY__
18
19#ifdef CONFIG_SA1111
20void sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes);
21
22#define arch_adjust_zones(node, size, holes) \
23 sa1111_adjust_zones(node, size, holes)
24
25#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1)
26
27#endif
28#endif
29
30/*
31 * Virtual view <-> DMA view memory address translations
32 * virt_to_bus: Used to translate the virtual address to an
33 * address suitable to be passed to set_dma_addr
34 * bus_to_virt: Used to convert an address for DMA operations
35 * to an address that the kernel can use.
36 *
37 * On the SA1100, bus addresses are equivalent to physical addresses.
38 */
39#define __virt_to_bus(x) __virt_to_phys(x)
40#define __bus_to_virt(x) __phys_to_virt(x)
41
42/*
43 * Because of the wide memory address space between physical RAM banks on the
44 * SA1100, it's much convenient to use Linux's NUMA support to implement our
45 * memory map representation. Assuming all memory nodes have equal access
46 * characteristics, we then have generic discontiguous memory support.
47 *
48 * Of course, all this isn't mandatory for SA1100 implementations with only
49 * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM.
50 *
51 * The nodes are matched with the physical memory bank addresses which are
52 * incidentally the same as virtual addresses.
53 *
54 * node 0: 0xc0000000 - 0xc7ffffff
55 * node 1: 0xc8000000 - 0xcfffffff
56 * node 2: 0xd0000000 - 0xd7ffffff
57 * node 3: 0xd8000000 - 0xdfffffff
58 */
59#define NODE_MEM_SIZE_BITS 27
60
61/*
62 * Cache flushing area - SA1100 zero bank
63 */
64#define FLUSH_BASE_PHYS 0xe0000000
65#define FLUSH_BASE 0xf5000000
66#define FLUSH_BASE_MINICACHE 0xf5100000
67
68#endif
diff --git a/arch/arm/mach-sa1100/include/mach/mtd-xip.h b/arch/arm/mach-sa1100/include/mach/mtd-xip.h
new file mode 100644
index 000000000000..80cfdac2b944
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/mtd-xip.h
@@ -0,0 +1,26 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Nicolas Pitre
7 * Created: Nov 2, 2004
8 * Copyright: (C) 2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
15 */
16
17#ifndef __ARCH_SA1100_MTD_XIP_H__
18#define __ARCH_SA1100_MTD_XIP_H__
19
20#define xip_irqpending() (ICIP & ICMR)
21
22/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
23#define xip_currtime() (OSCR)
24#define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4)
25
26#endif /* __ARCH_SA1100_MTD_XIP_H__ */
diff --git a/arch/arm/mach-sa1100/include/mach/neponset.h b/arch/arm/mach-sa1100/include/mach/neponset.h
new file mode 100644
index 000000000000..d3f044f92c00
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/neponset.h
@@ -0,0 +1,74 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/neponset.h
3 *
4 * Created 2000/06/05 by Nicolas Pitre <nico@cam.org>
5 *
6 * This file contains the hardware specific definitions for Assabet
7 * Only include this file from SA1100-specific files.
8 *
9 * 2000/05/23 John Dorsey <john+@cs.cmu.edu>
10 * Definitions for Neponset added.
11 */
12#ifndef __ASM_ARCH_NEPONSET_H
13#define __ASM_ARCH_NEPONSET_H
14
15/*
16 * Neponset definitions:
17 */
18
19#define NEPONSET_CPLD_BASE (0x10000000)
20#define Nep_p2v( x ) ((x) - NEPONSET_CPLD_BASE + 0xf3000000)
21#define Nep_v2p( x ) ((x) - 0xf3000000 + NEPONSET_CPLD_BASE)
22
23#define _IRR 0x10000024 /* Interrupt Reason Register */
24#define _AUD_CTL 0x100000c0 /* Audio controls (RW) */
25#define _MDM_CTL_0 0x100000b0 /* Modem control 0 (RW) */
26#define _MDM_CTL_1 0x100000b4 /* Modem control 1 (RW) */
27#define _NCR_0 0x100000a0 /* Control Register (RW) */
28#define _KP_X_OUT 0x10000090 /* Keypad row write (RW) */
29#define _KP_Y_IN 0x10000080 /* Keypad column read (RO) */
30#define _SWPK 0x10000020 /* Switch pack (RO) */
31#define _WHOAMI 0x10000000 /* System ID Register (RO) */
32
33#define _LEDS 0x10000010 /* LEDs [31:0] (WO) */
34
35#define IRR (*((volatile u_char *) Nep_p2v(_IRR)))
36#define AUD_CTL (*((volatile u_char *) Nep_p2v(_AUD_CTL)))
37#define MDM_CTL_0 (*((volatile u_char *) Nep_p2v(_MDM_CTL_0)))
38#define MDM_CTL_1 (*((volatile u_char *) Nep_p2v(_MDM_CTL_1)))
39#define NCR_0 (*((volatile u_char *) Nep_p2v(_NCR_0)))
40#define KP_X_OUT (*((volatile u_char *) Nep_p2v(_KP_X_OUT)))
41#define KP_Y_IN (*((volatile u_char *) Nep_p2v(_KP_Y_IN)))
42#define SWPK (*((volatile u_char *) Nep_p2v(_SWPK)))
43#define WHOAMI (*((volatile u_char *) Nep_p2v(_WHOAMI)))
44
45#define LEDS (*((volatile Word *) Nep_p2v(_LEDS)))
46
47#define IRR_ETHERNET (1<<0)
48#define IRR_USAR (1<<1)
49#define IRR_SA1111 (1<<2)
50
51#define AUD_SEL_1341 (1<<0)
52#define AUD_MUTE_1341 (1<<1)
53
54#define MDM_CTL0_RTS1 (1 << 0)
55#define MDM_CTL0_DTR1 (1 << 1)
56#define MDM_CTL0_RTS2 (1 << 2)
57#define MDM_CTL0_DTR2 (1 << 3)
58
59#define MDM_CTL1_CTS1 (1 << 0)
60#define MDM_CTL1_DSR1 (1 << 1)
61#define MDM_CTL1_DCD1 (1 << 2)
62#define MDM_CTL1_CTS2 (1 << 3)
63#define MDM_CTL1_DSR2 (1 << 4)
64#define MDM_CTL1_DCD2 (1 << 5)
65
66#define NCR_GP01_OFF (1<<0)
67#define NCR_TP_PWR_EN (1<<1)
68#define NCR_MS_PWR_EN (1<<2)
69#define NCR_ENET_OSC_EN (1<<3)
70#define NCR_SPI_KB_WK_UP (1<<4)
71#define NCR_A0VPP (1<<5)
72#define NCR_A1VPP (1<<6)
73
74#endif
diff --git a/arch/arm/mach-sa1100/include/mach/reset.h b/arch/arm/mach-sa1100/include/mach/reset.h
new file mode 100644
index 000000000000..f61957e6842a
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/reset.h
@@ -0,0 +1,18 @@
1#ifndef __ASM_ARCH_RESET_H
2#define __ASM_ARCH_RESET_H
3
4#include "hardware.h"
5
6#define RESET_STATUS_HARDWARE (1 << 0) /* Hardware Reset */
7#define RESET_STATUS_WATCHDOG (1 << 1) /* Watchdog Reset */
8#define RESET_STATUS_LOWPOWER (1 << 2) /* Exit from Low Power/Sleep */
9#define RESET_STATUS_GPIO (1 << 3) /* GPIO Reset */
10#define RESET_STATUS_ALL (0xf)
11
12extern unsigned int reset_status;
13static inline void clear_reset_status(unsigned int mask)
14{
15 RCSR = mask;
16}
17
18#endif /* __ASM_ARCH_RESET_H */
diff --git a/arch/arm/mach-sa1100/include/mach/shannon.h b/arch/arm/mach-sa1100/include/mach/shannon.h
new file mode 100644
index 000000000000..ec27d6e12140
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/shannon.h
@@ -0,0 +1,43 @@
1#ifndef _INCLUDE_SHANNON_H
2#define _INCLUDE_SHANNON_H
3
4/* taken from comp.os.inferno Tue, 12 Sep 2000 09:21:50 GMT,
5 * written by <forsyth@vitanuova.com> */
6
7#define SHANNON_GPIO_SPI_FLASH GPIO_GPIO (0) /* Output - Driven low, enables SPI to flash */
8#define SHANNON_GPIO_SPI_DSP GPIO_GPIO (1) /* Output - Driven low, enables SPI to DSP */
9/* lcd lower = GPIO 2-9 */
10#define SHANNON_GPIO_SPI_OUTPUT GPIO_GPIO (10) /* Output - SPI output to DSP */
11#define SHANNON_GPIO_SPI_INPUT GPIO_GPIO (11) /* Input - SPI input from DSP */
12#define SHANNON_GPIO_SPI_CLOCK GPIO_GPIO (12) /* Output - Clock for SPI */
13#define SHANNON_GPIO_SPI_FRAME GPIO_GPIO (13) /* Output - Frame marker - not used */
14#define SHANNON_GPIO_SPI_RTS GPIO_GPIO (14) /* Input - SPI Ready to Send */
15#define SHANNON_IRQ_GPIO_SPI_RTS IRQ_GPIO14
16#define SHANNON_GPIO_SPI_CTS GPIO_GPIO (15) /* Output - SPI Clear to Send */
17#define SHANNON_GPIO_IRQ_CODEC GPIO_GPIO (16) /* in, irq from ucb1200 */
18#define SHANNON_IRQ_GPIO_IRQ_CODEC IRQ_GPIO16
19#define SHANNON_GPIO_DSP_RESET GPIO_GPIO (17) /* Output - Drive low to reset the DSP */
20#define SHANNON_GPIO_CODEC_RESET GPIO_GPIO (18) /* Output - Drive low to reset the UCB1x00 */
21#define SHANNON_GPIO_U3_RTS GPIO_GPIO (19) /* ?? */
22#define SHANNON_GPIO_U3_CTS GPIO_GPIO (20) /* ?? */
23#define SHANNON_GPIO_SENSE_12V GPIO_GPIO (21) /* Input, 12v flash unprotect detected */
24#define SHANNON_GPIO_DISP_EN GPIO_GPIO (22) /* out */
25/* XXX GPIO 23 unaccounted for */
26#define SHANNON_GPIO_EJECT_0 GPIO_GPIO (24) /* in */
27#define SHANNON_IRQ_GPIO_EJECT_0 IRQ_GPIO24
28#define SHANNON_GPIO_EJECT_1 GPIO_GPIO (25) /* in */
29#define SHANNON_IRQ_GPIO_EJECT_1 IRQ_GPIO25
30#define SHANNON_GPIO_RDY_0 GPIO_GPIO (26) /* in */
31#define SHANNON_IRQ_GPIO_RDY_0 IRQ_GPIO26
32#define SHANNON_GPIO_RDY_1 GPIO_GPIO (27) /* in */
33#define SHANNON_IRQ_GPIO_RDY_1 IRQ_GPIO27
34
35/* MCP UCB codec GPIO pins... */
36
37#define SHANNON_UCB_GPIO_BACKLIGHT 9
38#define SHANNON_UCB_GPIO_BRIGHT_MASK 7
39#define SHANNON_UCB_GPIO_BRIGHT 6
40#define SHANNON_UCB_GPIO_CONTRAST_MASK 0x3f
41#define SHANNON_UCB_GPIO_CONTRAST 0
42
43#endif
diff --git a/arch/arm/mach-sa1100/include/mach/simpad.h b/arch/arm/mach-sa1100/include/mach/simpad.h
new file mode 100644
index 000000000000..9296c4513ce1
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/simpad.h
@@ -0,0 +1,112 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/simpad.h
3 *
4 * based of assabet.h same as HUW_Webpanel
5 *
6 * This file contains the hardware specific definitions for SIMpad
7 *
8 * 2001/05/14 Juergen Messerer <juergen.messerer@freesurf.ch>
9 */
10
11#ifndef __ASM_ARCH_SIMPAD_H
12#define __ASM_ARCH_SIMPAD_H
13
14
15#define GPIO_UART1_RTS GPIO_GPIO14
16#define GPIO_UART1_DTR GPIO_GPIO7
17#define GPIO_UART1_CTS GPIO_GPIO8
18#define GPIO_UART1_DCD GPIO_GPIO23
19#define GPIO_UART1_DSR GPIO_GPIO6
20
21#define GPIO_UART3_RTS GPIO_GPIO12
22#define GPIO_UART3_DTR GPIO_GPIO16
23#define GPIO_UART3_CTS GPIO_GPIO13
24#define GPIO_UART3_DCD GPIO_GPIO18
25#define GPIO_UART3_DSR GPIO_GPIO17
26
27#define GPIO_POWER_BUTTON GPIO_GPIO0
28#define GPIO_UCB1300_IRQ GPIO_GPIO22 /* UCB GPIO and touchscreen */
29
30#define IRQ_UART1_CTS IRQ_GPIO15
31#define IRQ_UART1_DCD GPIO_GPIO23
32#define IRQ_UART1_DSR GPIO_GPIO6
33#define IRQ_UART3_CTS GPIO_GPIO13
34#define IRQ_UART3_DCD GPIO_GPIO18
35#define IRQ_UART3_DSR GPIO_GPIO17
36
37#define IRQ_GPIO_UCB1300_IRQ IRQ_GPIO22
38#define IRQ_GPIO_POWER_BUTTON IRQ_GPIO0
39
40
41/*--- PCMCIA ---*/
42#define GPIO_CF_CD GPIO_GPIO24
43#define GPIO_CF_IRQ GPIO_GPIO1
44#define IRQ_GPIO_CF_IRQ IRQ_GPIO1
45#define IRQ_GPIO_CF_CD IRQ_GPIO24
46
47/*--- SmartCard ---*/
48#define GPIO_SMART_CARD GPIO_GPIO10
49#define IRQ_GPIO_SMARD_CARD IRQ_GPIO10
50
51// CS3 Latch is write only, a shadow is necessary
52
53#define CS3BUSTYPE unsigned volatile long
54#define CS3_BASE 0xf1000000
55
56#define VCC_5V_EN 0x0001 // For 5V PCMCIA
57#define VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
58#define EN1 0x0004 // This is only for EPROM's
59#define EN0 0x0008 // Both should be enable for 3.3V or 5V
60#define DISPLAY_ON 0x0010
61#define PCMCIA_BUFF_DIS 0x0020
62#define MQ_RESET 0x0040
63#define PCMCIA_RESET 0x0080
64#define DECT_POWER_ON 0x0100
65#define IRDA_SD 0x0200 // Shutdown for powersave
66#define RS232_ON 0x0400
67#define SD_MEDIAQ 0x0800 // Shutdown for powersave
68#define LED2_ON 0x1000
69#define IRDA_MODE 0x2000 // Fast/Slow IrDA mode
70#define ENABLE_5V 0x4000 // Enable 5V circuit
71#define RESET_SIMCARD 0x8000
72
73#define RS232_ENABLE 0x0440
74#define PCMCIAMASK 0x402f
75
76
77struct simpad_battery {
78 unsigned char ac_status; /* line connected yes/no */
79 unsigned char status; /* battery loading yes/no */
80 unsigned char percentage; /* percentage loaded */
81 unsigned short life; /* life till empty */
82};
83
84/* These should match the apm_bios.h definitions */
85#define SIMPAD_AC_STATUS_AC_OFFLINE 0x00
86#define SIMPAD_AC_STATUS_AC_ONLINE 0x01
87#define SIMPAD_AC_STATUS_AC_BACKUP 0x02 /* What does this mean? */
88#define SIMPAD_AC_STATUS_AC_UNKNOWN 0xff
89
90/* These bitfields are rarely "or'd" together */
91#define SIMPAD_BATT_STATUS_HIGH 0x01
92#define SIMPAD_BATT_STATUS_LOW 0x02
93#define SIMPAD_BATT_STATUS_CRITICAL 0x04
94#define SIMPAD_BATT_STATUS_CHARGING 0x08
95#define SIMPAD_BATT_STATUS_CHARGE_MAIN 0x10
96#define SIMPAD_BATT_STATUS_DEAD 0x20 /* Battery will not charge */
97#define SIMPAD_BATT_NOT_INSTALLED 0x20 /* For expansion pack batteries */
98#define SIMPAD_BATT_STATUS_FULL 0x40 /* Battery fully charged (and connected to AC) */
99#define SIMPAD_BATT_STATUS_NOBATT 0x80
100#define SIMPAD_BATT_STATUS_UNKNOWN 0xff
101
102extern int simpad_get_battery(struct simpad_battery* );
103
104#endif // __ASM_ARCH_SIMPAD_H
105
106
107
108
109
110
111
112
diff --git a/arch/arm/mach-sa1100/include/mach/system.h b/arch/arm/mach-sa1100/include/mach/system.h
new file mode 100644
index 000000000000..63755ca5b1b4
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/system.h
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/system.h
3 *
4 * Copyright (c) 1999 Nicolas Pitre <nico@cam.org>
5 */
6#include <mach/hardware.h>
7
8static inline void arch_idle(void)
9{
10 cpu_do_idle();
11}
12
13static inline void arch_reset(char mode)
14{
15 if (mode == 's') {
16 /* Jump into ROM at address 0 */
17 cpu_reset(0);
18 } else {
19 /* Use on-chip reset capability */
20 RSRR = RSRR_SWR;
21 }
22}
diff --git a/arch/arm/mach-sa1100/include/mach/timex.h b/arch/arm/mach-sa1100/include/mach/timex.h
new file mode 100644
index 000000000000..7a5d017b58b3
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/timex.h
@@ -0,0 +1,12 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/timex.h
3 *
4 * SA1100 architecture timex specifications
5 *
6 * Copyright (C) 1998
7 */
8
9/*
10 * SA1100 timer
11 */
12#define CLOCK_TICK_RATE 3686400
diff --git a/arch/arm/mach-sa1100/include/mach/uncompress.h b/arch/arm/mach-sa1100/include/mach/uncompress.h
new file mode 100644
index 000000000000..714160b03d7a
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/uncompress.h
@@ -0,0 +1,50 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/uncompress.h
3 *
4 * (C) 1999 Nicolas Pitre <nico@cam.org>
5 *
6 * Reorganised to be machine independent.
7 */
8
9#include "hardware.h"
10
11/*
12 * The following code assumes the serial port has already been
13 * initialized by the bootloader. We search for the first enabled
14 * port in the most probable order. If you didn't setup a port in
15 * your bootloader then nothing will appear (which might be desired).
16 */
17
18#define UART(x) (*(volatile unsigned long *)(serial_port + (x)))
19
20static void putc(int c)
21{
22 unsigned long serial_port;
23
24 do {
25 serial_port = _Ser3UTCR0;
26 if (UART(UTCR3) & UTCR3_TXE) break;
27 serial_port = _Ser1UTCR0;
28 if (UART(UTCR3) & UTCR3_TXE) break;
29 serial_port = _Ser2UTCR0;
30 if (UART(UTCR3) & UTCR3_TXE) break;
31 return;
32 } while (0);
33
34 /* wait for space in the UART's transmitter */
35 while (!(UART(UTSR1) & UTSR1_TNF))
36 barrier();
37
38 /* send the character out. */
39 UART(UTDR) = c;
40}
41
42static inline void flush(void)
43{
44}
45
46/*
47 * Nothing to do for these
48 */
49#define arch_decomp_setup()
50#define arch_decomp_wdog()
diff --git a/arch/arm/mach-sa1100/include/mach/vmalloc.h b/arch/arm/mach-sa1100/include/mach/vmalloc.h
new file mode 100644
index 000000000000..ec8fdc5a3606
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/vmalloc.h
@@ -0,0 +1,4 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/vmalloc.h
3 */
4#define VMALLOC_END (0xe8000000)
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index c5e438b12ec7..86369a8f0cea 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -16,7 +16,7 @@
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/sysdev.h> 17#include <linux/sysdev.h>
18 18
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20#include <asm/mach/irq.h> 20#include <asm/mach/irq.h>
21 21
22#include "generic.h" 22#include "generic.h"
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index 52ac37d1e23a..81848aa96424 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -23,7 +23,7 @@
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <video/s1d13xxxfb.h> 24#include <video/s1d13xxxfb.h>
25 25
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/hardware/sa1111.h> 27#include <asm/hardware/sa1111.h>
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
diff --git a/arch/arm/mach-sa1100/jornada720_ssp.c b/arch/arm/mach-sa1100/jornada720_ssp.c
index 395c39bed7d8..06ea7abd9170 100644
--- a/arch/arm/mach-sa1100/jornada720_ssp.c
+++ b/arch/arm/mach-sa1100/jornada720_ssp.c
@@ -20,9 +20,9 @@
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22 22
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/hardware/ssp.h> 24#include <asm/hardware/ssp.h>
25#include <asm/arch/jornada720.h> 25#include <mach/jornada720.h>
26 26
27static DEFINE_SPINLOCK(jornada_ssp_lock); 27static DEFINE_SPINLOCK(jornada_ssp_lock);
28static unsigned long jornada_ssp_flags; 28static unsigned long jornada_ssp_flags;
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c
index 07d3a696ae7f..0cd52692d2f7 100644
--- a/arch/arm/mach-sa1100/lart.c
+++ b/arch/arm/mach-sa1100/lart.c
@@ -6,14 +6,14 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/tty.h> 7#include <linux/tty.h>
8 8
9#include <asm/hardware.h> 9#include <mach/hardware.h>
10#include <asm/setup.h> 10#include <asm/setup.h>
11#include <asm/mach-types.h> 11#include <asm/mach-types.h>
12 12
13#include <asm/mach/arch.h> 13#include <asm/mach/arch.h>
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15#include <asm/mach/serial_sa1100.h> 15#include <asm/mach/serial_sa1100.h>
16#include <asm/arch/mcp.h> 16#include <mach/mcp.h>
17 17
18#include "generic.h" 18#include "generic.h"
19 19
diff --git a/arch/arm/mach-sa1100/leds-assabet.c b/arch/arm/mach-sa1100/leds-assabet.c
index ee9788989875..64e9b4b11b54 100644
--- a/arch/arm/mach-sa1100/leds-assabet.c
+++ b/arch/arm/mach-sa1100/leds-assabet.c
@@ -11,10 +11,10 @@
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13 13
14#include <asm/hardware.h> 14#include <mach/hardware.h>
15#include <asm/leds.h> 15#include <asm/leds.h>
16#include <asm/system.h> 16#include <asm/system.h>
17#include <asm/arch/assabet.h> 17#include <mach/assabet.h>
18 18
19#include "leds.h" 19#include "leds.h"
20 20
diff --git a/arch/arm/mach-sa1100/leds-badge4.c b/arch/arm/mach-sa1100/leds-badge4.c
index 280929be972d..cf1e38458b81 100644
--- a/arch/arm/mach-sa1100/leds-badge4.c
+++ b/arch/arm/mach-sa1100/leds-badge4.c
@@ -12,7 +12,7 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14 14
15#include <asm/hardware.h> 15#include <mach/hardware.h>
16#include <asm/leds.h> 16#include <asm/leds.h>
17#include <asm/system.h> 17#include <asm/system.h>
18 18
diff --git a/arch/arm/mach-sa1100/leds-cerf.c b/arch/arm/mach-sa1100/leds-cerf.c
index f38eeddbef10..259b48e0be89 100644
--- a/arch/arm/mach-sa1100/leds-cerf.c
+++ b/arch/arm/mach-sa1100/leds-cerf.c
@@ -5,7 +5,7 @@
5 */ 5 */
6#include <linux/init.h> 6#include <linux/init.h>
7 7
8#include <asm/hardware.h> 8#include <mach/hardware.h>
9#include <asm/leds.h> 9#include <asm/leds.h>
10#include <asm/system.h> 10#include <asm/system.h>
11 11
diff --git a/arch/arm/mach-sa1100/leds-hackkit.c b/arch/arm/mach-sa1100/leds-hackkit.c
index 7e91cc90b5ae..2bce137462e4 100644
--- a/arch/arm/mach-sa1100/leds-hackkit.c
+++ b/arch/arm/mach-sa1100/leds-hackkit.c
@@ -11,7 +11,7 @@
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13 13
14#include <asm/hardware.h> 14#include <mach/hardware.h>
15#include <asm/leds.h> 15#include <asm/leds.h>
16#include <asm/system.h> 16#include <asm/system.h>
17 17
diff --git a/arch/arm/mach-sa1100/leds-lart.c b/arch/arm/mach-sa1100/leds-lart.c
index 2d27d76cfc6b..0505a1fdcdb2 100644
--- a/arch/arm/mach-sa1100/leds-lart.c
+++ b/arch/arm/mach-sa1100/leds-lart.c
@@ -11,7 +11,7 @@
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13 13
14#include <asm/hardware.h> 14#include <mach/hardware.h>
15#include <asm/leds.h> 15#include <asm/leds.h>
16#include <asm/system.h> 16#include <asm/system.h>
17 17
diff --git a/arch/arm/mach-sa1100/leds-simpad.c b/arch/arm/mach-sa1100/leds-simpad.c
index def090a87385..d50f4eeaa12e 100644
--- a/arch/arm/mach-sa1100/leds-simpad.c
+++ b/arch/arm/mach-sa1100/leds-simpad.c
@@ -5,10 +5,10 @@
5 */ 5 */
6#include <linux/init.h> 6#include <linux/init.h>
7 7
8#include <asm/hardware.h> 8#include <mach/hardware.h>
9#include <asm/leds.h> 9#include <asm/leds.h>
10#include <asm/system.h> 10#include <asm/system.h>
11#include <asm/arch/simpad.h> 11#include <mach/simpad.h>
12 12
13#include "leds.h" 13#include "leds.h"
14 14
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 967a48454f6b..4856a6bd2482 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -10,14 +10,14 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/slab.h> 11#include <linux/slab.h>
12 12
13#include <asm/hardware.h> 13#include <mach/hardware.h>
14#include <asm/mach-types.h> 14#include <asm/mach-types.h>
15#include <asm/irq.h> 15#include <asm/irq.h>
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17#include <asm/mach/irq.h> 17#include <asm/mach/irq.h>
18#include <asm/mach/serial_sa1100.h> 18#include <asm/mach/serial_sa1100.h>
19#include <asm/arch/assabet.h> 19#include <mach/assabet.h>
20#include <asm/arch/neponset.h> 20#include <mach/neponset.h>
21#include <asm/hardware/sa1111.h> 21#include <asm/hardware/sa1111.h>
22#include <asm/sizes.h> 22#include <asm/sizes.h>
23 23
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c
index 69a71f11625e..83be1c6c5f80 100644
--- a/arch/arm/mach-sa1100/pleb.c
+++ b/arch/arm/mach-sa1100/pleb.c
@@ -11,7 +11,7 @@
11 11
12#include <linux/mtd/partitions.h> 12#include <linux/mtd/partitions.h>
13 13
14#include <asm/hardware.h> 14#include <mach/hardware.h>
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/setup.h> 16#include <asm/setup.h>
17#include <asm/mach-types.h> 17#include <asm/mach-types.h>
@@ -20,7 +20,7 @@
20#include <asm/mach/map.h> 20#include <asm/mach/map.h>
21#include <asm/mach/flash.h> 21#include <asm/mach/flash.h>
22#include <asm/mach/serial_sa1100.h> 22#include <asm/mach/serial_sa1100.h>
23#include <asm/arch/irqs.h> 23#include <mach/irqs.h>
24 24
25#include "generic.h" 25#include "generic.h"
26 26
diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index 1693d447a224..111cce67ad2f 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -27,7 +27,7 @@
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/time.h> 28#include <linux/time.h>
29 29
30#include <asm/hardware.h> 30#include <mach/hardware.h>
31#include <asm/memory.h> 31#include <asm/memory.h>
32#include <asm/system.h> 32#include <asm/system.h>
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c
index 8acab7b1e4c2..9ccdd09cf69f 100644
--- a/arch/arm/mach-sa1100/shannon.c
+++ b/arch/arm/mach-sa1100/shannon.c
@@ -9,7 +9,7 @@
9#include <linux/mtd/mtd.h> 9#include <linux/mtd/mtd.h>
10#include <linux/mtd/partitions.h> 10#include <linux/mtd/partitions.h>
11 11
12#include <asm/hardware.h> 12#include <mach/hardware.h>
13#include <asm/mach-types.h> 13#include <asm/mach-types.h>
14#include <asm/setup.h> 14#include <asm/setup.h>
15 15
@@ -17,8 +17,8 @@
17#include <asm/mach/flash.h> 17#include <asm/mach/flash.h>
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/mach/serial_sa1100.h> 19#include <asm/mach/serial_sa1100.h>
20#include <asm/arch/mcp.h> 20#include <mach/mcp.h>
21#include <asm/arch/shannon.h> 21#include <mach/shannon.h>
22 22
23#include "generic.h" 23#include "generic.h"
24 24
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index a9ae1b581aa6..8dd635317959 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -14,7 +14,7 @@
14#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
15 15
16#include <asm/irq.h> 16#include <asm/irq.h>
17#include <asm/hardware.h> 17#include <mach/hardware.h>
18#include <asm/setup.h> 18#include <asm/setup.h>
19 19
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
@@ -22,8 +22,8 @@
22#include <asm/mach/flash.h> 22#include <asm/mach/flash.h>
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24#include <asm/mach/serial_sa1100.h> 24#include <asm/mach/serial_sa1100.h>
25#include <asm/arch/mcp.h> 25#include <mach/mcp.h>
26#include <asm/arch/simpad.h> 26#include <mach/simpad.h>
27 27
28#include <linux/serial_core.h> 28#include <linux/serial_core.h>
29#include <linux/ioport.h> 29#include <linux/ioport.h>
diff --git a/arch/arm/mach-sa1100/sleep.S b/arch/arm/mach-sa1100/sleep.S
index 5a84062f92af..171441f96710 100644
--- a/arch/arm/mach-sa1100/sleep.S
+++ b/arch/arm/mach-sa1100/sleep.S
@@ -18,7 +18,7 @@
18 18
19#include <linux/linkage.h> 19#include <linux/linkage.h>
20#include <asm/assembler.h> 20#include <asm/assembler.h>
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22 22
23 23
24 24
diff --git a/arch/arm/mach-sa1100/ssp.c b/arch/arm/mach-sa1100/ssp.c
index 06206ceb312e..641f361c56f4 100644
--- a/arch/arm/mach-sa1100/ssp.c
+++ b/arch/arm/mach-sa1100/ssp.c
@@ -20,7 +20,7 @@
20 20
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/hardware.h> 23#include <mach/hardware.h>
24#include <asm/hardware/ssp.h> 24#include <asm/hardware/ssp.h>
25 25
26#define TIMEOUT 100000 26#define TIMEOUT 100000
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index a9799cb35b74..24c0a4bae850 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -16,7 +16,7 @@
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17 17
18#include <asm/mach/time.h> 18#include <asm/mach/time.h>
19#include <asm/hardware.h> 19#include <mach/hardware.h>
20 20
21#define MIN_OSCR_DELTA 2 21#define MIN_OSCR_DELTA 2
22 22
diff --git a/arch/arm/mach-shark/include/mach/debug-macro.S b/arch/arm/mach-shark/include/mach/debug-macro.S
new file mode 100644
index 000000000000..0836cb78b29a
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/debug-macro.S
@@ -0,0 +1,31 @@
1/* arch/arm/mach-shark/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 .macro addruart,rx
15 mov \rx, #0xe0000000
16 orr \rx, \rx, #0x000003f8
17 .endm
18
19 .macro senduart,rd,rx
20 strb \rd, [\rx]
21 .endm
22
23 .macro busyuart,rd,rx
24 mov \rd, #0
251001: add \rd, \rd, #1
26 teq \rd, #0x10000
27 bne 1001b
28 .endm
29
30 .macro waituart,rd,rx
31 .endm
diff --git a/arch/arm/mach-shark/include/mach/dma.h b/arch/arm/mach-shark/include/mach/dma.h
new file mode 100644
index 000000000000..c0a29bd2a74f
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/dma.h
@@ -0,0 +1,18 @@
1/*
2 * arch/arm/mach-shark/include/mach/dma.h
3 *
4 * by Alexander Schulz
5 */
6#ifndef __ASM_ARCH_DMA_H
7#define __ASM_ARCH_DMA_H
8
9/* Use only the lowest 4MB, nothing else works.
10 * The rest is not DMAable. See dev / .properties
11 * in OpenFirmware.
12 */
13#define MAX_DMA_ADDRESS 0xC0400000
14#define MAX_DMA_CHANNELS 8
15#define DMA_ISA_CASCADE 4
16
17#endif /* _ASM_ARCH_DMA_H */
18
diff --git a/arch/arm/mach-shark/include/mach/entry-macro.S b/arch/arm/mach-shark/include/mach/entry-macro.S
new file mode 100644
index 000000000000..e2853c0a3333
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/entry-macro.S
@@ -0,0 +1,41 @@
1/*
2 * arch/arm/mach-shark/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Shark platform
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 .macro disable_fiq
11 .endm
12
13 .macro get_irqnr_preamble, base, tmp
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
20 mov r4, #0xe0000000
21
22 mov \irqstat, #0x0C
23 strb \irqstat, [r4, #0x20] @outb(0x0C, 0x20) /* Poll command */
24 ldrb \irqnr, [r4, #0x20] @irq = inb(0x20) & 7
25 and \irqstat, \irqnr, #0x80
26 teq \irqstat, #0
27 beq 43f
28 and \irqnr, \irqnr, #7
29 teq \irqnr, #2
30 bne 44f
3143: mov \irqstat, #0x0C
32 strb \irqstat, [r4, #0xa0] @outb(0x0C, 0xA0) /* Poll command */
33 ldrb \irqnr, [r4, #0xa0] @irq = (inb(0xA0) & 7) + 8
34 and \irqstat, \irqnr, #0x80
35 teq \irqstat, #0
36 beq 44f
37 and \irqnr, \irqnr, #7
38 add \irqnr, \irqnr, #8
3944: teq \irqstat, #0
40 .endm
41
diff --git a/arch/arm/mach-shark/include/mach/hardware.h b/arch/arm/mach-shark/include/mach/hardware.h
new file mode 100644
index 000000000000..cb0ee2943c1a
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/hardware.h
@@ -0,0 +1,51 @@
1/*
2 * arch/arm/mach-shark/include/mach/hardware.h
3 *
4 * by Alexander Schulz
5 *
6 * derived from:
7 * arch/arm/mach-ebsa110/include/mach/hardware.h
8 * Copyright (C) 1996-1999 Russell King.
9 */
10#ifndef __ASM_ARCH_HARDWARE_H
11#define __ASM_ARCH_HARDWARE_H
12
13#ifndef __ASSEMBLY__
14
15/*
16 * Mapping areas
17 */
18#define IO_BASE 0xe0000000
19
20#else
21
22#define IO_BASE 0
23
24#endif
25
26#define IO_SIZE 0x08000000
27#define IO_START 0x40000000
28#define ROMCARD_SIZE 0x08000000
29#define ROMCARD_START 0x10000000
30
31#define PCIO_BASE 0xe0000000
32
33
34/* defines for the Framebuffer */
35#define FB_START 0x06000000
36#define FB_SIZE 0x01000000
37
38#define UNCACHEABLE_ADDR 0xdf010000
39
40#define SEQUOIA_LED_GREEN (1<<6)
41#define SEQUOIA_LED_AMBER (1<<5)
42#define SEQUOIA_LED_BACK (1<<7)
43
44#define pcibios_assign_all_busses() 1
45
46#define PCIBIOS_MIN_IO 0x6000
47#define PCIBIOS_MIN_MEM 0x50000000
48#define PCIMEM_BASE 0xe8000000
49
50#endif
51
diff --git a/arch/arm/mach-shark/include/mach/io.h b/arch/arm/mach-shark/include/mach/io.h
new file mode 100644
index 000000000000..92475922c068
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/io.h
@@ -0,0 +1,56 @@
1/*
2 * arch/arm/mach-shark/include/mach/io.h
3 *
4 * by Alexander Schulz
5 *
6 * derived from:
7 * arch/arm/mach-ebsa110/include/mach/io.h
8 * Copyright (C) 1997,1998 Russell King
9 */
10
11#ifndef __ASM_ARM_ARCH_IO_H
12#define __ASM_ARM_ARCH_IO_H
13
14#include <mach/hardware.h>
15
16#define IO_SPACE_LIMIT 0xffffffff
17
18/*
19 * We use two different types of addressing - PC style addresses, and ARM
20 * addresses. PC style accesses the PC hardware with the normal PC IO
21 * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+
22 * and are translated to the start of IO.
23 */
24#define __PORT_PCIO(x) (!((x) & 0x80000000))
25
26#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
27
28
29static inline unsigned int __ioaddr (unsigned int port) \
30{ \
31 if (__PORT_PCIO(port)) \
32 return (unsigned int)(PCIO_BASE + (port)); \
33 else \
34 return (unsigned int)(IO_BASE + (port)); \
35}
36
37#define __mem_pci(addr) (addr)
38
39/*
40 * Translated address IO functions
41 *
42 * IO address has already been translated to a virtual address
43 */
44#define outb_t(v,p) \
45 (*(volatile unsigned char *)(p) = (v))
46
47#define inb_t(p) \
48 (*(volatile unsigned char *)(p))
49
50#define outl_t(v,p) \
51 (*(volatile unsigned long *)(p) = (v))
52
53#define inl_t(p) \
54 (*(volatile unsigned long *)(p))
55
56#endif
diff --git a/arch/arm/mach-shark/include/mach/irqs.h b/arch/arm/mach-shark/include/mach/irqs.h
new file mode 100644
index 000000000000..0586acd7cdd5
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/irqs.h
@@ -0,0 +1,13 @@
1/*
2 * arch/arm/mach-shark/include/mach/irqs.h
3 *
4 * by Alexander Schulz
5 */
6
7#define NR_IRQS 16
8
9#define IRQ_ISA_KEYBOARD 1
10#define RTC_IRQ 8
11#define I8042_KBD_IRQ 1
12#define I8042_AUX_IRQ 12
13#define IRQ_HARDDISK 14
diff --git a/arch/arm/mach-shark/include/mach/memory.h b/arch/arm/mach-shark/include/mach/memory.h
new file mode 100644
index 000000000000..b7874ad9f9f6
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/memory.h
@@ -0,0 +1,48 @@
1/*
2 * arch/arm/mach-shark/include/mach/memory.h
3 *
4 * by Alexander Schulz
5 *
6 * derived from:
7 * arch/arm/mach-ebsa110/include/mach/memory.h
8 * Copyright (c) 1996-1999 Russell King.
9 */
10#ifndef __ASM_ARCH_MEMORY_H
11#define __ASM_ARCH_MEMORY_H
12
13#include <asm/sizes.h>
14
15/*
16 * Physical DRAM offset.
17 */
18#define PHYS_OFFSET UL(0x08000000)
19
20#ifndef __ASSEMBLY__
21
22static inline void __arch_adjust_zones(int node, unsigned long *zone_size, unsigned long *zhole_size)
23{
24 if (node != 0) return;
25 /* Only the first 4 MB (=1024 Pages) are usable for DMA */
26 zone_size[1] = zone_size[0] - 1024;
27 zone_size[0] = 1024;
28 zhole_size[1] = zhole_size[0];
29 zhole_size[0] = 0;
30}
31
32#define arch_adjust_zones(node, size, holes) \
33 __arch_adjust_zones(node, size, holes)
34
35#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_4M - 1)
36
37#endif
38
39#define __virt_to_bus(x) __virt_to_phys(x)
40#define __bus_to_virt(x) __phys_to_virt(x)
41
42/*
43 * Cache flushing area
44 */
45#define FLUSH_BASE_PHYS 0x80000000
46#define FLUSH_BASE 0xdf000000
47
48#endif
diff --git a/arch/arm/mach-shark/include/mach/system.h b/arch/arm/mach-shark/include/mach/system.h
new file mode 100644
index 000000000000..85aceef6f874
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/system.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-shark/include/mach/system.h
3 *
4 * by Alexander Schulz
5 */
6#ifndef __ASM_ARCH_SYSTEM_H
7#define __ASM_ARCH_SYSTEM_H
8
9#include <asm/io.h>
10
11static void arch_reset(char mode)
12{
13 short temp;
14 local_irq_disable();
15 /* Reset the Machine via pc[3] of the sequoia chipset */
16 outw(0x09,0x24);
17 temp=inw(0x26);
18 temp = temp | (1<<3) | (1<<10);
19 outw(0x09,0x24);
20 outw(temp,0x26);
21
22}
23
24static inline void arch_idle(void)
25{
26}
27
28#endif
diff --git a/arch/arm/mach-shark/include/mach/timex.h b/arch/arm/mach-shark/include/mach/timex.h
new file mode 100644
index 000000000000..bb6eeaebed86
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/timex.h
@@ -0,0 +1,7 @@
1/*
2 * arch/arm/mach-shark/include/mach/timex.h
3 *
4 * by Alexander Schulz
5 */
6
7#define CLOCK_TICK_RATE 1193180
diff --git a/arch/arm/mach-shark/include/mach/uncompress.h b/arch/arm/mach-shark/include/mach/uncompress.h
new file mode 100644
index 000000000000..3725e1633418
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/uncompress.h
@@ -0,0 +1,51 @@
1/*
2 * arch/arm/mach-shark/include/mach/uncompress.h
3 * by Alexander Schulz
4 *
5 * derived from:
6 * arch/arm/mach-footbridge/include/mach/uncompress.h
7 * Copyright (C) 1996,1997,1998 Russell King
8 */
9
10#define SERIAL_BASE ((volatile unsigned char *)0x400003f8)
11
12static inline void putc(int c)
13{
14 int t;
15
16 SERIAL_BASE[0] = c;
17 t=0x10000;
18 while (t--);
19}
20
21static inline void flush(void)
22{
23}
24
25#ifdef DEBUG
26static void putn(unsigned long z)
27{
28 int i;
29 char x;
30
31 putc('0');
32 putc('x');
33 for (i=0;i<8;i++) {
34 x='0'+((z>>((7-i)*4))&0xf);
35 if (x>'9') x=x-'0'+'A'-10;
36 putc(x);
37 }
38}
39
40static void putr()
41{
42 putc('\n');
43 putc('\r');
44}
45#endif
46
47/*
48 * nothing to do
49 */
50#define arch_decomp_setup()
51#define arch_decomp_wdog()
diff --git a/arch/arm/mach-shark/include/mach/vmalloc.h b/arch/arm/mach-shark/include/mach/vmalloc.h
new file mode 100644
index 000000000000..f6c6837c5451
--- /dev/null
+++ b/arch/arm/mach-shark/include/mach/vmalloc.h
@@ -0,0 +1,4 @@
1/*
2 * arch/arm/mach-shark/include/mach/vmalloc.h
3 */
4#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
diff --git a/arch/arm/mach-shark/irq.c b/arch/arm/mach-shark/irq.c
index 5b0c6af44ec6..44b0811b400c 100644
--- a/arch/arm/mach-shark/irq.c
+++ b/arch/arm/mach-shark/irq.c
@@ -4,7 +4,7 @@
4 * by Alexander Schulz 4 * by Alexander Schulz
5 * 5 *
6 * derived from linux/arch/ppc/kernel/i8259.c and: 6 * derived from linux/arch/ppc/kernel/i8259.c and:
7 * include/asm-arm/arch-ebsa110/irq.h 7 * arch/arm/mach-ebsa110/include/mach/irq.h
8 * Copyright (C) 1996-1998 Russell King 8 * Copyright (C) 1996-1998 Russell King
9 */ 9 */
10 10
diff --git a/arch/arm/mach-shark/leds.c b/arch/arm/mach-shark/leds.c
index 5386a81f796a..b1896471aa3c 100644
--- a/arch/arm/mach-shark/leds.c
+++ b/arch/arm/mach-shark/leds.c
@@ -21,7 +21,7 @@
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23 23
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/leds.h> 25#include <asm/leds.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/system.h> 27#include <asm/system.h>
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index a7dd09436cbc..d75e795c893e 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -31,7 +31,7 @@
31 31
32#include <asm/cnt32_to_63.h> 32#include <asm/cnt32_to_63.h>
33#include <asm/system.h> 33#include <asm/system.h>
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/leds.h> 37#include <asm/leds.h>
diff --git a/arch/arm/mach-versatile/include/mach/debug-macro.S b/arch/arm/mach-versatile/include/mach/debug-macro.S
new file mode 100644
index 000000000000..b4ac00eacf68
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/debug-macro.S
@@ -0,0 +1,23 @@
1/* arch/arm/mach-versatile/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 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17 moveq \rx, #0x10000000
18 movne \rx, #0xf1000000 @ virtual base
19 orr \rx, \rx, #0x001F0000
20 orr \rx, \rx, #0x00001000
21 .endm
22
23#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-versatile/include/mach/dma.h b/arch/arm/mach-versatile/include/mach/dma.h
new file mode 100644
index 000000000000..0aabf12c8834
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/dma.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-versatile/include/mach/dma.h
3 *
4 * Copyright (C) 2003 ARM Limited.
5 * Copyright (C) 1997,1998 Russell King
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
diff --git a/arch/arm/mach-versatile/include/mach/entry-macro.S b/arch/arm/mach-versatile/include/mach/entry-macro.S
new file mode 100644
index 000000000000..8c8020980585
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/entry-macro.S
@@ -0,0 +1,44 @@
1/*
2 * arch/arm/mach-versatile/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Versatile 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#include <asm/hardware/vic.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro get_irqnr_preamble, base, tmp
17 ldr \base, =IO_ADDRESS(VERSATILE_VIC_BASE)
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 ldr \irqstat, [\base, #VIC_IRQ_STATUS] @ get masked status
25 mov \irqnr, #0
26 teq \irqstat, #0
27 beq 1003f
28
291001: tst \irqstat, #15
30 bne 1002f
31 add \irqnr, \irqnr, #4
32 movs \irqstat, \irqstat, lsr #4
33 bne 1001b
341002: tst \irqstat, #1
35 bne 1003f
36 add \irqnr, \irqnr, #1
37 movs \irqstat, \irqstat, lsr #1
38 bne 1002b
391003: /* EQ will be set if no irqs pending */
40
41@ clz \irqnr, \irqstat
42@1003: /* EQ will be set if we reach MAXIRQNUM */
43 .endm
44
diff --git a/arch/arm/mach-versatile/include/mach/hardware.h b/arch/arm/mach-versatile/include/mach/hardware.h
new file mode 100644
index 000000000000..7aa906c93154
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/hardware.h
@@ -0,0 +1,52 @@
1/*
2 * arch/arm/mach-versatile/include/mach/hardware.h
3 *
4 * This file contains the hardware definitions of the Versatile boards.
5 *
6 * Copyright (C) 2003 ARM Limited.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef __ASM_ARCH_HARDWARE_H
23#define __ASM_ARCH_HARDWARE_H
24
25#include <asm/sizes.h>
26#include <mach/platform.h>
27
28/*
29 * PCI space virtual addresses
30 */
31#define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul
32#define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul
33
34#if 0
35#define VERSATILE_PCI_VIRT_MEM_BASE0 0xf4000000
36#define VERSATILE_PCI_VIRT_MEM_BASE1 0xf5000000
37#define VERSATILE_PCI_VIRT_MEM_BASE2 0xf6000000
38
39#define PCIO_BASE VERSATILE_PCI_VIRT_MEM_BASE0
40#define PCIMEM_BASE VERSATILE_PCI_VIRT_MEM_BASE1
41#endif
42
43/* CIK guesswork */
44#define PCIBIOS_MIN_IO 0x44000000
45#define PCIBIOS_MIN_MEM 0x50000000
46
47#define pcibios_assign_all_busses() 1
48
49/* macro to get at IO space when running virtually */
50#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
51
52#endif
diff --git a/arch/arm/mach-versatile/include/mach/io.h b/arch/arm/mach-versatile/include/mach/io.h
new file mode 100644
index 000000000000..c0b9dd1d0257
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/io.h
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-versatile/include/mach/io.h
3 *
4 * Copyright (C) 2003 ARM Limited
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#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define IO_SPACE_LIMIT 0xffffffff
24
25static inline void __iomem *__io(unsigned long addr)
26{
27 return (void __iomem *)addr;
28}
29#define __io(a) __io(a)
30#define __mem_pci(a) (a)
31
32#endif
diff --git a/arch/arm/mach-versatile/include/mach/irqs.h b/arch/arm/mach-versatile/include/mach/irqs.h
new file mode 100644
index 000000000000..216a1312e62e
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/irqs.h
@@ -0,0 +1,211 @@
1/*
2 * arch/arm/mach-versatile/include/mach/irqs.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <mach/platform.h>
23
24/*
25 * IRQ interrupts definitions are the same as the INT definitions
26 * held within platform.h
27 */
28#define IRQ_VIC_START 0
29#define IRQ_WDOGINT (IRQ_VIC_START + INT_WDOGINT)
30#define IRQ_SOFTINT (IRQ_VIC_START + INT_SOFTINT)
31#define IRQ_COMMRx (IRQ_VIC_START + INT_COMMRx)
32#define IRQ_COMMTx (IRQ_VIC_START + INT_COMMTx)
33#define IRQ_TIMERINT0_1 (IRQ_VIC_START + INT_TIMERINT0_1)
34#define IRQ_TIMERINT2_3 (IRQ_VIC_START + INT_TIMERINT2_3)
35#define IRQ_GPIOINT0 (IRQ_VIC_START + INT_GPIOINT0)
36#define IRQ_GPIOINT1 (IRQ_VIC_START + INT_GPIOINT1)
37#define IRQ_GPIOINT2 (IRQ_VIC_START + INT_GPIOINT2)
38#define IRQ_GPIOINT3 (IRQ_VIC_START + INT_GPIOINT3)
39#define IRQ_RTCINT (IRQ_VIC_START + INT_RTCINT)
40#define IRQ_SSPINT (IRQ_VIC_START + INT_SSPINT)
41#define IRQ_UARTINT0 (IRQ_VIC_START + INT_UARTINT0)
42#define IRQ_UARTINT1 (IRQ_VIC_START + INT_UARTINT1)
43#define IRQ_UARTINT2 (IRQ_VIC_START + INT_UARTINT2)
44#define IRQ_SCIINT (IRQ_VIC_START + INT_SCIINT)
45#define IRQ_CLCDINT (IRQ_VIC_START + INT_CLCDINT)
46#define IRQ_DMAINT (IRQ_VIC_START + INT_DMAINT)
47#define IRQ_PWRFAILINT (IRQ_VIC_START + INT_PWRFAILINT)
48#define IRQ_MBXINT (IRQ_VIC_START + INT_MBXINT)
49#define IRQ_GNDINT (IRQ_VIC_START + INT_GNDINT)
50#define IRQ_VICSOURCE21 (IRQ_VIC_START + INT_VICSOURCE21)
51#define IRQ_VICSOURCE22 (IRQ_VIC_START + INT_VICSOURCE22)
52#define IRQ_VICSOURCE23 (IRQ_VIC_START + INT_VICSOURCE23)
53#define IRQ_VICSOURCE24 (IRQ_VIC_START + INT_VICSOURCE24)
54#define IRQ_VICSOURCE25 (IRQ_VIC_START + INT_VICSOURCE25)
55#define IRQ_VICSOURCE26 (IRQ_VIC_START + INT_VICSOURCE26)
56#define IRQ_VICSOURCE27 (IRQ_VIC_START + INT_VICSOURCE27)
57#define IRQ_VICSOURCE28 (IRQ_VIC_START + INT_VICSOURCE28)
58#define IRQ_VICSOURCE29 (IRQ_VIC_START + INT_VICSOURCE29)
59#define IRQ_VICSOURCE30 (IRQ_VIC_START + INT_VICSOURCE30)
60#define IRQ_VICSOURCE31 (IRQ_VIC_START + INT_VICSOURCE31)
61#define IRQ_VIC_END (IRQ_VIC_START + 31)
62
63#define IRQMASK_WDOGINT INTMASK_WDOGINT
64#define IRQMASK_SOFTINT INTMASK_SOFTINT
65#define IRQMASK_COMMRx INTMASK_COMMRx
66#define IRQMASK_COMMTx INTMASK_COMMTx
67#define IRQMASK_TIMERINT0_1 INTMASK_TIMERINT0_1
68#define IRQMASK_TIMERINT2_3 INTMASK_TIMERINT2_3
69#define IRQMASK_GPIOINT0 INTMASK_GPIOINT0
70#define IRQMASK_GPIOINT1 INTMASK_GPIOINT1
71#define IRQMASK_GPIOINT2 INTMASK_GPIOINT2
72#define IRQMASK_GPIOINT3 INTMASK_GPIOINT3
73#define IRQMASK_RTCINT INTMASK_RTCINT
74#define IRQMASK_SSPINT INTMASK_SSPINT
75#define IRQMASK_UARTINT0 INTMASK_UARTINT0
76#define IRQMASK_UARTINT1 INTMASK_UARTINT1
77#define IRQMASK_UARTINT2 INTMASK_UARTINT2
78#define IRQMASK_SCIINT INTMASK_SCIINT
79#define IRQMASK_CLCDINT INTMASK_CLCDINT
80#define IRQMASK_DMAINT INTMASK_DMAINT
81#define IRQMASK_PWRFAILINT INTMASK_PWRFAILINT
82#define IRQMASK_MBXINT INTMASK_MBXINT
83#define IRQMASK_GNDINT INTMASK_GNDINT
84#define IRQMASK_VICSOURCE21 INTMASK_VICSOURCE21
85#define IRQMASK_VICSOURCE22 INTMASK_VICSOURCE22
86#define IRQMASK_VICSOURCE23 INTMASK_VICSOURCE23
87#define IRQMASK_VICSOURCE24 INTMASK_VICSOURCE24
88#define IRQMASK_VICSOURCE25 INTMASK_VICSOURCE25
89#define IRQMASK_VICSOURCE26 INTMASK_VICSOURCE26
90#define IRQMASK_VICSOURCE27 INTMASK_VICSOURCE27
91#define IRQMASK_VICSOURCE28 INTMASK_VICSOURCE28
92#define IRQMASK_VICSOURCE29 INTMASK_VICSOURCE29
93#define IRQMASK_VICSOURCE30 INTMASK_VICSOURCE30
94#define IRQMASK_VICSOURCE31 INTMASK_VICSOURCE31
95
96/*
97 * FIQ interrupts definitions are the same as the INT definitions.
98 */
99#define FIQ_WDOGINT INT_WDOGINT
100#define FIQ_SOFTINT INT_SOFTINT
101#define FIQ_COMMRx INT_COMMRx
102#define FIQ_COMMTx INT_COMMTx
103#define FIQ_TIMERINT0_1 INT_TIMERINT0_1
104#define FIQ_TIMERINT2_3 INT_TIMERINT2_3
105#define FIQ_GPIOINT0 INT_GPIOINT0
106#define FIQ_GPIOINT1 INT_GPIOINT1
107#define FIQ_GPIOINT2 INT_GPIOINT2
108#define FIQ_GPIOINT3 INT_GPIOINT3
109#define FIQ_RTCINT INT_RTCINT
110#define FIQ_SSPINT INT_SSPINT
111#define FIQ_UARTINT0 INT_UARTINT0
112#define FIQ_UARTINT1 INT_UARTINT1
113#define FIQ_UARTINT2 INT_UARTINT2
114#define FIQ_SCIINT INT_SCIINT
115#define FIQ_CLCDINT INT_CLCDINT
116#define FIQ_DMAINT INT_DMAINT
117#define FIQ_PWRFAILINT INT_PWRFAILINT
118#define FIQ_MBXINT INT_MBXINT
119#define FIQ_GNDINT INT_GNDINT
120#define FIQ_VICSOURCE21 INT_VICSOURCE21
121#define FIQ_VICSOURCE22 INT_VICSOURCE22
122#define FIQ_VICSOURCE23 INT_VICSOURCE23
123#define FIQ_VICSOURCE24 INT_VICSOURCE24
124#define FIQ_VICSOURCE25 INT_VICSOURCE25
125#define FIQ_VICSOURCE26 INT_VICSOURCE26
126#define FIQ_VICSOURCE27 INT_VICSOURCE27
127#define FIQ_VICSOURCE28 INT_VICSOURCE28
128#define FIQ_VICSOURCE29 INT_VICSOURCE29
129#define FIQ_VICSOURCE30 INT_VICSOURCE30
130#define FIQ_VICSOURCE31 INT_VICSOURCE31
131
132
133#define FIQMASK_WDOGINT INTMASK_WDOGINT
134#define FIQMASK_SOFTINT INTMASK_SOFTINT
135#define FIQMASK_COMMRx INTMASK_COMMRx
136#define FIQMASK_COMMTx INTMASK_COMMTx
137#define FIQMASK_TIMERINT0_1 INTMASK_TIMERINT0_1
138#define FIQMASK_TIMERINT2_3 INTMASK_TIMERINT2_3
139#define FIQMASK_GPIOINT0 INTMASK_GPIOINT0
140#define FIQMASK_GPIOINT1 INTMASK_GPIOINT1
141#define FIQMASK_GPIOINT2 INTMASK_GPIOINT2
142#define FIQMASK_GPIOINT3 INTMASK_GPIOINT3
143#define FIQMASK_RTCINT INTMASK_RTCINT
144#define FIQMASK_SSPINT INTMASK_SSPINT
145#define FIQMASK_UARTINT0 INTMASK_UARTINT0
146#define FIQMASK_UARTINT1 INTMASK_UARTINT1
147#define FIQMASK_UARTINT2 INTMASK_UARTINT2
148#define FIQMASK_SCIINT INTMASK_SCIINT
149#define FIQMASK_CLCDINT INTMASK_CLCDINT
150#define FIQMASK_DMAINT INTMASK_DMAINT
151#define FIQMASK_PWRFAILINT INTMASK_PWRFAILINT
152#define FIQMASK_MBXINT INTMASK_MBXINT
153#define FIQMASK_GNDINT INTMASK_GNDINT
154#define FIQMASK_VICSOURCE21 INTMASK_VICSOURCE21
155#define FIQMASK_VICSOURCE22 INTMASK_VICSOURCE22
156#define FIQMASK_VICSOURCE23 INTMASK_VICSOURCE23
157#define FIQMASK_VICSOURCE24 INTMASK_VICSOURCE24
158#define FIQMASK_VICSOURCE25 INTMASK_VICSOURCE25
159#define FIQMASK_VICSOURCE26 INTMASK_VICSOURCE26
160#define FIQMASK_VICSOURCE27 INTMASK_VICSOURCE27
161#define FIQMASK_VICSOURCE28 INTMASK_VICSOURCE28
162#define FIQMASK_VICSOURCE29 INTMASK_VICSOURCE29
163#define FIQMASK_VICSOURCE30 INTMASK_VICSOURCE30
164#define FIQMASK_VICSOURCE31 INTMASK_VICSOURCE31
165
166/*
167 * Secondary interrupt controller
168 */
169#define IRQ_SIC_START 32
170#define IRQ_SIC_MMCI0B (IRQ_SIC_START + SIC_INT_MMCI0B)
171#define IRQ_SIC_MMCI1B (IRQ_SIC_START + SIC_INT_MMCI1B)
172#define IRQ_SIC_KMI0 (IRQ_SIC_START + SIC_INT_KMI0)
173#define IRQ_SIC_KMI1 (IRQ_SIC_START + SIC_INT_KMI1)
174#define IRQ_SIC_SCI3 (IRQ_SIC_START + SIC_INT_SCI3)
175#define IRQ_SIC_UART3 (IRQ_SIC_START + SIC_INT_UART3)
176#define IRQ_SIC_CLCD (IRQ_SIC_START + SIC_INT_CLCD)
177#define IRQ_SIC_TOUCH (IRQ_SIC_START + SIC_INT_TOUCH)
178#define IRQ_SIC_KEYPAD (IRQ_SIC_START + SIC_INT_KEYPAD)
179#define IRQ_SIC_DoC (IRQ_SIC_START + SIC_INT_DoC)
180#define IRQ_SIC_MMCI0A (IRQ_SIC_START + SIC_INT_MMCI0A)
181#define IRQ_SIC_MMCI1A (IRQ_SIC_START + SIC_INT_MMCI1A)
182#define IRQ_SIC_AACI (IRQ_SIC_START + SIC_INT_AACI)
183#define IRQ_SIC_ETH (IRQ_SIC_START + SIC_INT_ETH)
184#define IRQ_SIC_USB (IRQ_SIC_START + SIC_INT_USB)
185#define IRQ_SIC_PCI0 (IRQ_SIC_START + SIC_INT_PCI0)
186#define IRQ_SIC_PCI1 (IRQ_SIC_START + SIC_INT_PCI1)
187#define IRQ_SIC_PCI2 (IRQ_SIC_START + SIC_INT_PCI2)
188#define IRQ_SIC_PCI3 (IRQ_SIC_START + SIC_INT_PCI3)
189#define IRQ_SIC_END 63
190
191#define SIC_IRQMASK_MMCI0B SIC_INTMASK_MMCI0B
192#define SIC_IRQMASK_MMCI1B SIC_INTMASK_MMCI1B
193#define SIC_IRQMASK_KMI0 SIC_INTMASK_KMI0
194#define SIC_IRQMASK_KMI1 SIC_INTMASK_KMI1
195#define SIC_IRQMASK_SCI3 SIC_INTMASK_SCI3
196#define SIC_IRQMASK_UART3 SIC_INTMASK_UART3
197#define SIC_IRQMASK_CLCD SIC_INTMASK_CLCD
198#define SIC_IRQMASK_TOUCH SIC_INTMASK_TOUCH
199#define SIC_IRQMASK_KEYPAD SIC_INTMASK_KEYPAD
200#define SIC_IRQMASK_DoC SIC_INTMASK_DoC
201#define SIC_IRQMASK_MMCI0A SIC_INTMASK_MMCI0A
202#define SIC_IRQMASK_MMCI1A SIC_INTMASK_MMCI1A
203#define SIC_IRQMASK_AACI SIC_INTMASK_AACI
204#define SIC_IRQMASK_ETH SIC_INTMASK_ETH
205#define SIC_IRQMASK_USB SIC_INTMASK_USB
206#define SIC_IRQMASK_PCI0 SIC_INTMASK_PCI0
207#define SIC_IRQMASK_PCI1 SIC_INTMASK_PCI1
208#define SIC_IRQMASK_PCI2 SIC_INTMASK_PCI2
209#define SIC_IRQMASK_PCI3 SIC_INTMASK_PCI3
210
211#define NR_IRQS 64
diff --git a/arch/arm/mach-versatile/include/mach/memory.h b/arch/arm/mach-versatile/include/mach/memory.h
new file mode 100644
index 000000000000..b6315c0602ac
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/memory.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-versatile/include/mach/memory.h
3 *
4 * Copyright (C) 2003 ARM Limited
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#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H
22
23/*
24 * Physical DRAM offset.
25 */
26#define PHYS_OFFSET UL(0x00000000)
27
28/*
29 * Virtual view <-> DMA view memory address translations
30 * virt_to_bus: Used to translate the virtual address to an
31 * address suitable to be passed to set_dma_addr
32 * bus_to_virt: Used to convert an address for DMA operations
33 * to an address that the kernel can use.
34 */
35#define __virt_to_bus(x) ((x) - PAGE_OFFSET)
36#define __bus_to_virt(x) ((x) + PAGE_OFFSET)
37
38#endif
diff --git a/arch/arm/mach-versatile/include/mach/platform.h b/arch/arm/mach-versatile/include/mach/platform.h
new file mode 100644
index 000000000000..27cbe6a3f220
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/platform.h
@@ -0,0 +1,510 @@
1/*
2 * arch/arm/mach-versatile/include/mach/platform.h
3 *
4 * Copyright (c) ARM Limited 2003. All rights reserved.
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
21#ifndef __address_h
22#define __address_h 1
23
24/*
25 * Memory definitions
26 */
27#define VERSATILE_BOOT_ROM_LO 0x30000000 /* DoC Base (64Mb)...*/
28#define VERSATILE_BOOT_ROM_HI 0x30000000
29#define VERSATILE_BOOT_ROM_BASE VERSATILE_BOOT_ROM_HI /* Normal position */
30#define VERSATILE_BOOT_ROM_SIZE SZ_64M
31
32#define VERSATILE_SSRAM_BASE /* VERSATILE_SSMC_BASE ? */
33#define VERSATILE_SSRAM_SIZE SZ_2M
34
35#define VERSATILE_FLASH_BASE 0x34000000
36#define VERSATILE_FLASH_SIZE SZ_64M
37
38/*
39 * SDRAM
40 */
41#define VERSATILE_SDRAM_BASE 0x00000000
42
43/*
44 * Logic expansion modules
45 *
46 */
47
48
49/* ------------------------------------------------------------------------
50 * Versatile Registers
51 * ------------------------------------------------------------------------
52 *
53 */
54#define VERSATILE_SYS_ID_OFFSET 0x00
55#define VERSATILE_SYS_SW_OFFSET 0x04
56#define VERSATILE_SYS_LED_OFFSET 0x08
57#define VERSATILE_SYS_OSC0_OFFSET 0x0C
58
59#if defined(CONFIG_ARCH_VERSATILE_PB)
60#define VERSATILE_SYS_OSC1_OFFSET 0x10
61#define VERSATILE_SYS_OSC2_OFFSET 0x14
62#define VERSATILE_SYS_OSC3_OFFSET 0x18
63#define VERSATILE_SYS_OSC4_OFFSET 0x1C
64#elif defined(CONFIG_MACH_VERSATILE_AB)
65#define VERSATILE_SYS_OSC1_OFFSET 0x1C
66#endif
67
68#define VERSATILE_SYS_OSCCLCD_OFFSET 0x1c
69
70#define VERSATILE_SYS_LOCK_OFFSET 0x20
71#define VERSATILE_SYS_100HZ_OFFSET 0x24
72#define VERSATILE_SYS_CFGDATA1_OFFSET 0x28
73#define VERSATILE_SYS_CFGDATA2_OFFSET 0x2C
74#define VERSATILE_SYS_FLAGS_OFFSET 0x30
75#define VERSATILE_SYS_FLAGSSET_OFFSET 0x30
76#define VERSATILE_SYS_FLAGSCLR_OFFSET 0x34
77#define VERSATILE_SYS_NVFLAGS_OFFSET 0x38
78#define VERSATILE_SYS_NVFLAGSSET_OFFSET 0x38
79#define VERSATILE_SYS_NVFLAGSCLR_OFFSET 0x3C
80#define VERSATILE_SYS_RESETCTL_OFFSET 0x40
81#define VERSATILE_SYS_PCICTL_OFFSET 0x44
82#define VERSATILE_SYS_MCI_OFFSET 0x48
83#define VERSATILE_SYS_FLASH_OFFSET 0x4C
84#define VERSATILE_SYS_CLCD_OFFSET 0x50
85#define VERSATILE_SYS_CLCDSER_OFFSET 0x54
86#define VERSATILE_SYS_BOOTCS_OFFSET 0x58
87#define VERSATILE_SYS_24MHz_OFFSET 0x5C
88#define VERSATILE_SYS_MISC_OFFSET 0x60
89#define VERSATILE_SYS_TEST_OSC0_OFFSET 0x80
90#define VERSATILE_SYS_TEST_OSC1_OFFSET 0x84
91#define VERSATILE_SYS_TEST_OSC2_OFFSET 0x88
92#define VERSATILE_SYS_TEST_OSC3_OFFSET 0x8C
93#define VERSATILE_SYS_TEST_OSC4_OFFSET 0x90
94
95#define VERSATILE_SYS_BASE 0x10000000
96#define VERSATILE_SYS_ID (VERSATILE_SYS_BASE + VERSATILE_SYS_ID_OFFSET)
97#define VERSATILE_SYS_SW (VERSATILE_SYS_BASE + VERSATILE_SYS_SW_OFFSET)
98#define VERSATILE_SYS_LED (VERSATILE_SYS_BASE + VERSATILE_SYS_LED_OFFSET)
99#define VERSATILE_SYS_OSC0 (VERSATILE_SYS_BASE + VERSATILE_SYS_OSC0_OFFSET)
100#define VERSATILE_SYS_OSC1 (VERSATILE_SYS_BASE + VERSATILE_SYS_OSC1_OFFSET)
101
102#if defined(CONFIG_ARCH_VERSATILE_PB)
103#define VERSATILE_SYS_OSC2 (VERSATILE_SYS_BASE + VERSATILE_SYS_OSC2_OFFSET)
104#define VERSATILE_SYS_OSC3 (VERSATILE_SYS_BASE + VERSATILE_SYS_OSC3_OFFSET)
105#define VERSATILE_SYS_OSC4 (VERSATILE_SYS_BASE + VERSATILE_SYS_OSC4_OFFSET)
106#endif
107
108#define VERSATILE_SYS_LOCK (VERSATILE_SYS_BASE + VERSATILE_SYS_LOCK_OFFSET)
109#define VERSATILE_SYS_100HZ (VERSATILE_SYS_BASE + VERSATILE_SYS_100HZ_OFFSET)
110#define VERSATILE_SYS_CFGDATA1 (VERSATILE_SYS_BASE + VERSATILE_SYS_CFGDATA1_OFFSET)
111#define VERSATILE_SYS_CFGDATA2 (VERSATILE_SYS_BASE + VERSATILE_SYS_CFGDATA2_OFFSET)
112#define VERSATILE_SYS_FLAGS (VERSATILE_SYS_BASE + VERSATILE_SYS_FLAGS_OFFSET)
113#define VERSATILE_SYS_FLAGSSET (VERSATILE_SYS_BASE + VERSATILE_SYS_FLAGSSET_OFFSET)
114#define VERSATILE_SYS_FLAGSCLR (VERSATILE_SYS_BASE + VERSATILE_SYS_FLAGSCLR_OFFSET)
115#define VERSATILE_SYS_NVFLAGS (VERSATILE_SYS_BASE + VERSATILE_SYS_NVFLAGS_OFFSET)
116#define VERSATILE_SYS_NVFLAGSSET (VERSATILE_SYS_BASE + VERSATILE_SYS_NVFLAGSSET_OFFSET)
117#define VERSATILE_SYS_NVFLAGSCLR (VERSATILE_SYS_BASE + VERSATILE_SYS_NVFLAGSCLR_OFFSET)
118#define VERSATILE_SYS_RESETCTL (VERSATILE_SYS_BASE + VERSATILE_SYS_RESETCTL_OFFSET)
119#define VERSATILE_SYS_PCICTL (VERSATILE_SYS_BASE + VERSATILE_SYS_PCICTL_OFFSET)
120#define VERSATILE_SYS_MCI (VERSATILE_SYS_BASE + VERSATILE_SYS_MCI_OFFSET)
121#define VERSATILE_SYS_FLASH (VERSATILE_SYS_BASE + VERSATILE_SYS_FLASH_OFFSET)
122#define VERSATILE_SYS_CLCD (VERSATILE_SYS_BASE + VERSATILE_SYS_CLCD_OFFSET)
123#define VERSATILE_SYS_CLCDSER (VERSATILE_SYS_BASE + VERSATILE_SYS_CLCDSER_OFFSET)
124#define VERSATILE_SYS_BOOTCS (VERSATILE_SYS_BASE + VERSATILE_SYS_BOOTCS_OFFSET)
125#define VERSATILE_SYS_24MHz (VERSATILE_SYS_BASE + VERSATILE_SYS_24MHz_OFFSET)
126#define VERSATILE_SYS_MISC (VERSATILE_SYS_BASE + VERSATILE_SYS_MISC_OFFSET)
127#define VERSATILE_SYS_TEST_OSC0 (VERSATILE_SYS_BASE + VERSATILE_SYS_TEST_OSC0_OFFSET)
128#define VERSATILE_SYS_TEST_OSC1 (VERSATILE_SYS_BASE + VERSATILE_SYS_TEST_OSC1_OFFSET)
129#define VERSATILE_SYS_TEST_OSC2 (VERSATILE_SYS_BASE + VERSATILE_SYS_TEST_OSC2_OFFSET)
130#define VERSATILE_SYS_TEST_OSC3 (VERSATILE_SYS_BASE + VERSATILE_SYS_TEST_OSC3_OFFSET)
131#define VERSATILE_SYS_TEST_OSC4 (VERSATILE_SYS_BASE + VERSATILE_SYS_TEST_OSC4_OFFSET)
132
133/*
134 * Values for VERSATILE_SYS_RESET_CTRL
135 */
136#define VERSATILE_SYS_CTRL_RESET_CONFIGCLR 0x01
137#define VERSATILE_SYS_CTRL_RESET_CONFIGINIT 0x02
138#define VERSATILE_SYS_CTRL_RESET_DLLRESET 0x03
139#define VERSATILE_SYS_CTRL_RESET_PLLRESET 0x04
140#define VERSATILE_SYS_CTRL_RESET_POR 0x05
141#define VERSATILE_SYS_CTRL_RESET_DoC 0x06
142
143#define VERSATILE_SYS_CTRL_LED (1 << 0)
144
145
146/* ------------------------------------------------------------------------
147 * Versatile control registers
148 * ------------------------------------------------------------------------
149 */
150
151/*
152 * VERSATILE_IDFIELD
153 *
154 * 31:24 = manufacturer (0x41 = ARM)
155 * 23:16 = architecture (0x08 = AHB system bus, ASB processor bus)
156 * 15:12 = FPGA (0x3 = XVC600 or XVC600E)
157 * 11:4 = build value
158 * 3:0 = revision number (0x1 = rev B (AHB))
159 */
160
161/*
162 * VERSATILE_SYS_LOCK
163 * control access to SYS_OSCx, SYS_CFGDATAx, SYS_RESETCTL,
164 * SYS_CLD, SYS_BOOTCS
165 */
166#define VERSATILE_SYS_LOCK_LOCKED (1 << 16)
167#define VERSATILE_SYS_LOCKVAL_MASK 0xFFFF /* write 0xA05F to enable write access */
168
169/*
170 * VERSATILE_SYS_FLASH
171 */
172#define VERSATILE_FLASHPROG_FLVPPEN (1 << 0) /* Enable writing to flash */
173
174/*
175 * VERSATILE_INTREG
176 * - used to acknowledge and control MMCI and UART interrupts
177 */
178#define VERSATILE_INTREG_WPROT 0x00 /* MMC protection status (no interrupt generated) */
179#define VERSATILE_INTREG_RI0 0x01 /* Ring indicator UART0 is asserted, */
180#define VERSATILE_INTREG_CARDIN 0x08 /* MMCI card in detect */
181 /* write 1 to acknowledge and clear */
182#define VERSATILE_INTREG_RI1 0x02 /* Ring indicator UART1 is asserted, */
183#define VERSATILE_INTREG_CARDINSERT 0x03 /* Signal insertion of MMC card */
184
185/*
186 * VERSATILE peripheral addresses
187 */
188#define VERSATILE_PCI_CORE_BASE 0x10001000 /* PCI core control */
189#define VERSATILE_I2C_BASE 0x10002000 /* I2C control */
190#define VERSATILE_SIC_BASE 0x10003000 /* Secondary interrupt controller */
191#define VERSATILE_AACI_BASE 0x10004000 /* Audio */
192#define VERSATILE_MMCI0_BASE 0x10005000 /* MMC interface */
193#define VERSATILE_KMI0_BASE 0x10006000 /* KMI interface */
194#define VERSATILE_KMI1_BASE 0x10007000 /* KMI 2nd interface */
195#define VERSATILE_CHAR_LCD_BASE 0x10008000 /* Character LCD */
196#define VERSATILE_UART3_BASE 0x10009000 /* UART 3 */
197#define VERSATILE_SCI1_BASE 0x1000A000
198#define VERSATILE_MMCI1_BASE 0x1000B000 /* MMC Interface */
199 /* 0x1000C000 - 0x1000CFFF = reserved */
200#define VERSATILE_ETH_BASE 0x10010000 /* Ethernet */
201#define VERSATILE_USB_BASE 0x10020000 /* USB */
202 /* 0x10030000 - 0x100FFFFF = reserved */
203#define VERSATILE_SMC_BASE 0x10100000 /* SMC */
204#define VERSATILE_MPMC_BASE 0x10110000 /* MPMC */
205#define VERSATILE_CLCD_BASE 0x10120000 /* CLCD */
206#define VERSATILE_DMAC_BASE 0x10130000 /* DMA controller */
207#define VERSATILE_VIC_BASE 0x10140000 /* Vectored interrupt controller */
208#define VERSATILE_PERIPH_BASE 0x10150000 /* off-chip peripherals alias from */
209 /* 0x10000000 - 0x100FFFFF */
210#define VERSATILE_AHBM_BASE 0x101D0000 /* AHB monitor */
211#define VERSATILE_SCTL_BASE 0x101E0000 /* System controller */
212#define VERSATILE_WATCHDOG_BASE 0x101E1000 /* Watchdog */
213#define VERSATILE_TIMER0_1_BASE 0x101E2000 /* Timer 0 and 1 */
214#define VERSATILE_TIMER2_3_BASE 0x101E3000 /* Timer 2 and 3 */
215#define VERSATILE_GPIO0_BASE 0x101E4000 /* GPIO port 0 */
216#define VERSATILE_GPIO1_BASE 0x101E5000 /* GPIO port 1 */
217#define VERSATILE_GPIO2_BASE 0x101E6000 /* GPIO port 2 */
218#define VERSATILE_GPIO3_BASE 0x101E7000 /* GPIO port 3 */
219#define VERSATILE_RTC_BASE 0x101E8000 /* Real Time Clock */
220 /* 0x101E9000 - reserved */
221#define VERSATILE_SCI_BASE 0x101F0000 /* Smart card controller */
222#define VERSATILE_UART0_BASE 0x101F1000 /* Uart 0 */
223#define VERSATILE_UART1_BASE 0x101F2000 /* Uart 1 */
224#define VERSATILE_UART2_BASE 0x101F3000 /* Uart 2 */
225#define VERSATILE_SSP_BASE 0x101F4000 /* Synchronous Serial Port */
226
227#define VERSATILE_SSMC_BASE 0x20000000 /* SSMC */
228#define VERSATILE_IB2_BASE 0x24000000 /* IB2 module */
229#define VERSATILE_MBX_BASE 0x40000000 /* MBX */
230
231/* PCI space */
232#define VERSATILE_PCI_BASE 0x41000000 /* PCI Interface */
233#define VERSATILE_PCI_CFG_BASE 0x42000000
234#define VERSATILE_PCI_MEM_BASE0 0x44000000
235#define VERSATILE_PCI_MEM_BASE1 0x50000000
236#define VERSATILE_PCI_MEM_BASE2 0x60000000
237/* Sizes of above maps */
238#define VERSATILE_PCI_BASE_SIZE 0x01000000
239#define VERSATILE_PCI_CFG_BASE_SIZE 0x02000000
240#define VERSATILE_PCI_MEM_BASE0_SIZE 0x0c000000 /* 32Mb */
241#define VERSATILE_PCI_MEM_BASE1_SIZE 0x10000000 /* 256Mb */
242#define VERSATILE_PCI_MEM_BASE2_SIZE 0x10000000 /* 256Mb */
243
244#define VERSATILE_SDRAM67_BASE 0x70000000 /* SDRAM banks 6 and 7 */
245#define VERSATILE_LT_BASE 0x80000000 /* Logic Tile expansion */
246
247/*
248 * Disk on Chip
249 */
250#define VERSATILE_DOC_BASE 0x2C000000
251#define VERSATILE_DOC_SIZE (16 << 20)
252#define VERSATILE_DOC_PAGE_SIZE 512
253#define VERSATILE_DOC_TOTAL_PAGES (DOC_SIZE / PAGE_SIZE)
254
255#define ERASE_UNIT_PAGES 32
256#define START_PAGE 0x80
257
258/*
259 * LED settings, bits [7:0]
260 */
261#define VERSATILE_SYS_LED0 (1 << 0)
262#define VERSATILE_SYS_LED1 (1 << 1)
263#define VERSATILE_SYS_LED2 (1 << 2)
264#define VERSATILE_SYS_LED3 (1 << 3)
265#define VERSATILE_SYS_LED4 (1 << 4)
266#define VERSATILE_SYS_LED5 (1 << 5)
267#define VERSATILE_SYS_LED6 (1 << 6)
268#define VERSATILE_SYS_LED7 (1 << 7)
269
270#define ALL_LEDS 0xFF
271
272#define LED_BANK VERSATILE_SYS_LED
273
274/*
275 * Control registers
276 */
277#define VERSATILE_IDFIELD_OFFSET 0x0 /* Versatile build information */
278#define VERSATILE_FLASHPROG_OFFSET 0x4 /* Flash devices */
279#define VERSATILE_INTREG_OFFSET 0x8 /* Interrupt control */
280#define VERSATILE_DECODE_OFFSET 0xC /* Fitted logic modules */
281
282
283/* ------------------------------------------------------------------------
284 * Versatile Interrupt Controller - control registers
285 * ------------------------------------------------------------------------
286 *
287 * Offsets from interrupt controller base
288 *
289 * System Controller interrupt controller base is
290 *
291 * VERSATILE_IC_BASE
292 *
293 * Core Module interrupt controller base is
294 *
295 * VERSATILE_SYS_IC
296 *
297 */
298/* VIC definitions in include/asm-arm/hardware/vic.h */
299
300#define SIC_IRQ_STATUS 0
301#define SIC_IRQ_RAW_STATUS 0x04
302#define SIC_IRQ_ENABLE 0x08
303#define SIC_IRQ_ENABLE_SET 0x08
304#define SIC_IRQ_ENABLE_CLEAR 0x0C
305#define SIC_INT_SOFT_SET 0x10
306#define SIC_INT_SOFT_CLEAR 0x14
307#define SIC_INT_PIC_ENABLE 0x20 /* read status of pass through mask */
308#define SIC_INT_PIC_ENABLES 0x20 /* set interrupt pass through bits */
309#define SIC_INT_PIC_ENABLEC 0x24 /* Clear interrupt pass through bits */
310
311/* ------------------------------------------------------------------------
312 * Interrupts - bit assignment (primary)
313 * ------------------------------------------------------------------------
314 */
315
316#define INT_WDOGINT 0 /* Watchdog timer */
317#define INT_SOFTINT 1 /* Software interrupt */
318#define INT_COMMRx 2 /* Debug Comm Rx interrupt */
319#define INT_COMMTx 3 /* Debug Comm Tx interrupt */
320#define INT_TIMERINT0_1 4 /* Timer 0 and 1 */
321#define INT_TIMERINT2_3 5 /* Timer 2 and 3 */
322#define INT_GPIOINT0 6 /* GPIO 0 */
323#define INT_GPIOINT1 7 /* GPIO 1 */
324#define INT_GPIOINT2 8 /* GPIO 2 */
325#define INT_GPIOINT3 9 /* GPIO 3 */
326#define INT_RTCINT 10 /* Real Time Clock */
327#define INT_SSPINT 11 /* Synchronous Serial Port */
328#define INT_UARTINT0 12 /* UART 0 on development chip */
329#define INT_UARTINT1 13 /* UART 1 on development chip */
330#define INT_UARTINT2 14 /* UART 2 on development chip */
331#define INT_SCIINT 15 /* Smart Card Interface */
332#define INT_CLCDINT 16 /* CLCD controller */
333#define INT_DMAINT 17 /* DMA controller */
334#define INT_PWRFAILINT 18 /* Power failure */
335#define INT_MBXINT 19 /* Graphics processor */
336#define INT_GNDINT 20 /* Reserved */
337 /* External interrupt signals from logic tiles or secondary controller */
338#define INT_VICSOURCE21 21 /* Disk on Chip */
339#define INT_VICSOURCE22 22 /* MCI0A */
340#define INT_VICSOURCE23 23 /* MCI1A */
341#define INT_VICSOURCE24 24 /* AACI */
342#define INT_VICSOURCE25 25 /* Ethernet */
343#define INT_VICSOURCE26 26 /* USB */
344#define INT_VICSOURCE27 27 /* PCI 0 */
345#define INT_VICSOURCE28 28 /* PCI 1 */
346#define INT_VICSOURCE29 29 /* PCI 2 */
347#define INT_VICSOURCE30 30 /* PCI 3 */
348#define INT_VICSOURCE31 31 /* SIC source */
349
350/*
351 * Interrupt bit positions
352 *
353 */
354#define INTMASK_WDOGINT (1 << INT_WDOGINT)
355#define INTMASK_SOFTINT (1 << INT_SOFTINT)
356#define INTMASK_COMMRx (1 << INT_COMMRx)
357#define INTMASK_COMMTx (1 << INT_COMMTx)
358#define INTMASK_TIMERINT0_1 (1 << INT_TIMERINT0_1)
359#define INTMASK_TIMERINT2_3 (1 << INT_TIMERINT2_3)
360#define INTMASK_GPIOINT0 (1 << INT_GPIOINT0)
361#define INTMASK_GPIOINT1 (1 << INT_GPIOINT1)
362#define INTMASK_GPIOINT2 (1 << INT_GPIOINT2)
363#define INTMASK_GPIOINT3 (1 << INT_GPIOINT3)
364#define INTMASK_RTCINT (1 << INT_RTCINT)
365#define INTMASK_SSPINT (1 << INT_SSPINT)
366#define INTMASK_UARTINT0 (1 << INT_UARTINT0)
367#define INTMASK_UARTINT1 (1 << INT_UARTINT1)
368#define INTMASK_UARTINT2 (1 << INT_UARTINT2)
369#define INTMASK_SCIINT (1 << INT_SCIINT)
370#define INTMASK_CLCDINT (1 << INT_CLCDINT)
371#define INTMASK_DMAINT (1 << INT_DMAINT)
372#define INTMASK_PWRFAILINT (1 << INT_PWRFAILINT)
373#define INTMASK_MBXINT (1 << INT_MBXINT)
374#define INTMASK_GNDINT (1 << INT_GNDINT)
375#define INTMASK_VICSOURCE21 (1 << INT_VICSOURCE21)
376#define INTMASK_VICSOURCE22 (1 << INT_VICSOURCE22)
377#define INTMASK_VICSOURCE23 (1 << INT_VICSOURCE23)
378#define INTMASK_VICSOURCE24 (1 << INT_VICSOURCE24)
379#define INTMASK_VICSOURCE25 (1 << INT_VICSOURCE25)
380#define INTMASK_VICSOURCE26 (1 << INT_VICSOURCE26)
381#define INTMASK_VICSOURCE27 (1 << INT_VICSOURCE27)
382#define INTMASK_VICSOURCE28 (1 << INT_VICSOURCE28)
383#define INTMASK_VICSOURCE29 (1 << INT_VICSOURCE29)
384#define INTMASK_VICSOURCE30 (1 << INT_VICSOURCE30)
385#define INTMASK_VICSOURCE31 (1 << INT_VICSOURCE31)
386
387
388#define VERSATILE_SC_VALID_INT 0x003FFFFF
389
390#define MAXIRQNUM 31
391#define MAXFIQNUM 31
392#define MAXSWINUM 31
393
394/* ------------------------------------------------------------------------
395 * Interrupts - bit assignment (secondary)
396 * ------------------------------------------------------------------------
397 */
398#define SIC_INT_MMCI0B 1 /* Multimedia Card 0B */
399#define SIC_INT_MMCI1B 2 /* Multimedia Card 1B */
400#define SIC_INT_KMI0 3 /* Keyboard/Mouse port 0 */
401#define SIC_INT_KMI1 4 /* Keyboard/Mouse port 1 */
402#define SIC_INT_SCI3 5 /* Smart Card interface */
403#define SIC_INT_UART3 6 /* UART 3 empty or data available */
404#define SIC_INT_CLCD 7 /* Character LCD */
405#define SIC_INT_TOUCH 8 /* Touchscreen */
406#define SIC_INT_KEYPAD 9 /* Key pressed on display keypad */
407 /* 10:20 - reserved */
408#define SIC_INT_DoC 21 /* Disk on Chip memory controller */
409#define SIC_INT_MMCI0A 22 /* MMC 0A */
410#define SIC_INT_MMCI1A 23 /* MMC 1A */
411#define SIC_INT_AACI 24 /* Audio Codec */
412#define SIC_INT_ETH 25 /* Ethernet controller */
413#define SIC_INT_USB 26 /* USB controller */
414#define SIC_INT_PCI0 27
415#define SIC_INT_PCI1 28
416#define SIC_INT_PCI2 29
417#define SIC_INT_PCI3 30
418
419
420#define SIC_INTMASK_MMCI0B (1 << SIC_INT_MMCI0B)
421#define SIC_INTMASK_MMCI1B (1 << SIC_INT_MMCI1B)
422#define SIC_INTMASK_KMI0 (1 << SIC_INT_KMI0)
423#define SIC_INTMASK_KMI1 (1 << SIC_INT_KMI1)
424#define SIC_INTMASK_SCI3 (1 << SIC_INT_SCI3)
425#define SIC_INTMASK_UART3 (1 << SIC_INT_UART3)
426#define SIC_INTMASK_CLCD (1 << SIC_INT_CLCD)
427#define SIC_INTMASK_TOUCH (1 << SIC_INT_TOUCH)
428#define SIC_INTMASK_KEYPAD (1 << SIC_INT_KEYPAD)
429#define SIC_INTMASK_DoC (1 << SIC_INT_DoC)
430#define SIC_INTMASK_MMCI0A (1 << SIC_INT_MMCI0A)
431#define SIC_INTMASK_MMCI1A (1 << SIC_INT_MMCI1A)
432#define SIC_INTMASK_AACI (1 << SIC_INT_AACI)
433#define SIC_INTMASK_ETH (1 << SIC_INT_ETH)
434#define SIC_INTMASK_USB (1 << SIC_INT_USB)
435#define SIC_INTMASK_PCI0 (1 << SIC_INT_PCI0)
436#define SIC_INTMASK_PCI1 (1 << SIC_INT_PCI1)
437#define SIC_INTMASK_PCI2 (1 << SIC_INT_PCI2)
438#define SIC_INTMASK_PCI3 (1 << SIC_INT_PCI3)
439/*
440 * Application Flash
441 *
442 */
443#define FLASH_BASE VERSATILE_FLASH_BASE
444#define FLASH_SIZE VERSATILE_FLASH_SIZE
445#define FLASH_END (FLASH_BASE + FLASH_SIZE - 1)
446#define FLASH_BLOCK_SIZE SZ_128K
447
448/*
449 * Boot Flash
450 *
451 */
452#define EPROM_BASE VERSATILE_BOOT_ROM_HI
453#define EPROM_SIZE VERSATILE_BOOT_ROM_SIZE
454#define EPROM_END (EPROM_BASE + EPROM_SIZE - 1)
455
456/*
457 * Clean base - dummy
458 *
459 */
460#define CLEAN_BASE EPROM_BASE
461
462/*
463 * System controller bit assignment
464 */
465#define VERSATILE_REFCLK 0
466#define VERSATILE_TIMCLK 1
467
468#define VERSATILE_TIMER1_EnSel 15
469#define VERSATILE_TIMER2_EnSel 17
470#define VERSATILE_TIMER3_EnSel 19
471#define VERSATILE_TIMER4_EnSel 21
472
473
474#define MAX_TIMER 2
475#define MAX_PERIOD 699050
476#define TICKS_PER_uSEC 1
477
478/*
479 * These are useconds NOT ticks.
480 *
481 */
482#define mSEC_1 1000
483#define mSEC_5 (mSEC_1 * 5)
484#define mSEC_10 (mSEC_1 * 10)
485#define mSEC_25 (mSEC_1 * 25)
486#define SEC_1 (mSEC_1 * 1000)
487
488#define VERSATILE_CSR_BASE 0x10000000
489#define VERSATILE_CSR_SIZE 0x10000000
490
491#ifdef CONFIG_MACH_VERSATILE_AB
492/*
493 * IB2 Versatile/AB expansion board definitions
494 */
495#define VERSATILE_IB2_CAMERA_BANK VERSATILE_IB2_BASE
496#define VERSATILE_IB2_KBD_DATAREG (VERSATILE_IB2_BASE + 0x01000000)
497
498/* VICINTSOURCE27 */
499#define VERSATILE_IB2_INT_BASE (VERSATILE_IB2_BASE + 0x02000000)
500#define VERSATILE_IB2_IER (VERSATILE_IB2_INT_BASE + 0)
501#define VERSATILE_IB2_ISR (VERSATILE_IB2_INT_BASE + 4)
502
503#define VERSATILE_IB2_CTL_BASE (VERSATILE_IB2_BASE + 0x03000000)
504#define VERSATILE_IB2_CTRL (VERSATILE_IB2_CTL_BASE + 0)
505#define VERSATILE_IB2_STAT (VERSATILE_IB2_CTL_BASE + 4)
506#endif
507
508#endif
509
510/* END */
diff --git a/arch/arm/mach-versatile/include/mach/system.h b/arch/arm/mach-versatile/include/mach/system.h
new file mode 100644
index 000000000000..91fa559c7cca
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/system.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/mach-versatile/include/mach/system.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24#include <mach/hardware.h>
25#include <asm/io.h>
26#include <mach/platform.h>
27
28static inline void arch_idle(void)
29{
30 /*
31 * This should do all the clock switching
32 * and wait for interrupt tricks
33 */
34 cpu_do_idle();
35}
36
37static inline void arch_reset(char mode)
38{
39 u32 val;
40
41 val = __raw_readl(IO_ADDRESS(VERSATILE_SYS_RESETCTL)) & ~0x7;
42 val |= 0x105;
43
44 __raw_writel(0xa05f, IO_ADDRESS(VERSATILE_SYS_LOCK));
45 __raw_writel(val, IO_ADDRESS(VERSATILE_SYS_RESETCTL));
46 __raw_writel(0, IO_ADDRESS(VERSATILE_SYS_LOCK));
47}
48
49#endif
diff --git a/arch/arm/mach-versatile/include/mach/timex.h b/arch/arm/mach-versatile/include/mach/timex.h
new file mode 100644
index 000000000000..426199b1add5
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/timex.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/mach-versatile/include/mach/timex.h
3 *
4 * Versatile architecture timex specifications
5 *
6 * Copyright (C) 2003 ARM Limited
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#define CLOCK_TICK_RATE (50000000 / 16)
diff --git a/arch/arm/mach-versatile/include/mach/uncompress.h b/arch/arm/mach-versatile/include/mach/uncompress.h
new file mode 100644
index 000000000000..3dd0048afb34
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/uncompress.h
@@ -0,0 +1,46 @@
1/*
2 * arch/arm/mach-versatile/include/mach/uncompress.h
3 *
4 * Copyright (C) 2003 ARM Limited
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#define AMBA_UART_DR (*(volatile unsigned char *)0x101F1000)
21#define AMBA_UART_LCRH (*(volatile unsigned char *)0x101F102C)
22#define AMBA_UART_CR (*(volatile unsigned char *)0x101F1030)
23#define AMBA_UART_FR (*(volatile unsigned char *)0x101F1018)
24
25/*
26 * This does not append a newline
27 */
28static inline void putc(int c)
29{
30 while (AMBA_UART_FR & (1 << 5))
31 barrier();
32
33 AMBA_UART_DR = c;
34}
35
36static inline void flush(void)
37{
38 while (AMBA_UART_FR & (1 << 3))
39 barrier();
40}
41
42/*
43 * nothing to do
44 */
45#define arch_decomp_setup()
46#define arch_decomp_wdog()
diff --git a/arch/arm/mach-versatile/include/mach/vmalloc.h b/arch/arm/mach-versatile/include/mach/vmalloc.h
new file mode 100644
index 000000000000..427e3612db5d
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/vmalloc.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-versatile/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Russell King.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#define VMALLOC_END (PAGE_OFFSET + 0x18000000)
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index ca8290159432..36f23f896503 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -22,7 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/init.h> 23#include <linux/init.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/system.h> 28#include <asm/system.h>
diff --git a/arch/arm/mach-versatile/versatile_ab.c b/arch/arm/mach-versatile/versatile_ab.c
index b257ef78ef45..76375c64413a 100644
--- a/arch/arm/mach-versatile/versatile_ab.c
+++ b/arch/arm/mach-versatile/versatile_ab.c
@@ -24,7 +24,7 @@
24#include <linux/sysdev.h> 24#include <linux/sysdev.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
diff --git a/arch/arm/mach-versatile/versatile_pb.c b/arch/arm/mach-versatile/versatile_pb.c
index be439bb9d450..1725f019fc85 100644
--- a/arch/arm/mach-versatile/versatile_pb.c
+++ b/arch/arm/mach-versatile/versatile_pb.c
@@ -24,7 +24,7 @@
24#include <linux/sysdev.h> 24#include <linux/sysdev.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 3a6c8ec34cd9..ed15f876c725 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -187,7 +187,7 @@ config CPU_ARM926T
187 ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || \ 187 ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || \
188 ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || \ 188 ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || \
189 ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || \ 189 ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || \
190 ARCH_NS9XXX || ARCH_DAVINCI 190 ARCH_NS9XXX || ARCH_DAVINCI || ARCH_MX2
191 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || \ 191 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || \
192 ARCH_OMAP730 || ARCH_OMAP16XX || \ 192 ARCH_OMAP730 || ARCH_OMAP16XX || \
193 ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || \ 193 ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || \
@@ -742,3 +742,11 @@ config CACHE_L2X0
742 select OUTER_CACHE 742 select OUTER_CACHE
743 help 743 help
744 This option enables the L2x0 PrimeCell. 744 This option enables the L2x0 PrimeCell.
745
746config CACHE_XSC3L2
747 bool "Enable the L2 cache on XScale3"
748 depends on CPU_XSC3
749 default y
750 select OUTER_CACHE
751 help
752 This option enables the L2 cache on XScale3.
diff --git a/arch/arm/mm/cache-v3.S b/arch/arm/mm/cache-v3.S
index e1994788cf0e..3b3639eb7ca5 100644
--- a/arch/arm/mm/cache-v3.S
+++ b/arch/arm/mm/cache-v3.S
@@ -9,7 +9,7 @@
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <asm/hardware.h> 12#include <mach/hardware.h>
13#include <asm/page.h> 13#include <asm/page.h>
14#include "proc-macros.S" 14#include "proc-macros.S"
15 15
diff --git a/arch/arm/mm/cache-v4.S b/arch/arm/mm/cache-v4.S
index b2908063ed6a..33926c9fcda6 100644
--- a/arch/arm/mm/cache-v4.S
+++ b/arch/arm/mm/cache-v4.S
@@ -9,7 +9,7 @@
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <asm/hardware.h> 12#include <mach/hardware.h>
13#include <asm/page.h> 13#include <asm/page.h>
14#include "proc-macros.S" 14#include "proc-macros.S"
15 15
diff --git a/arch/arm/mm/cache-v4wt.S b/arch/arm/mm/cache-v4wt.S
index 9bcabd86c6f3..51a9b0b273b6 100644
--- a/arch/arm/mm/cache-v4wt.S
+++ b/arch/arm/mm/cache-v4wt.S
@@ -13,7 +13,7 @@
13 */ 13 */
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/page.h> 17#include <asm/page.h>
18#include "proc-macros.S" 18#include "proc-macros.S"
19 19
diff --git a/arch/arm/mm/cache-xsc3l2.c b/arch/arm/mm/cache-xsc3l2.c
new file mode 100644
index 000000000000..158bd96763d3
--- /dev/null
+++ b/arch/arm/mm/cache-xsc3l2.c
@@ -0,0 +1,182 @@
1/*
2 * arch/arm/mm/cache-xsc3l2.c - XScale3 L2 cache controller support
3 *
4 * Copyright (C) 2007 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#include <linux/init.h>
20#include <linux/spinlock.h>
21
22#include <asm/system.h>
23#include <asm/cacheflush.h>
24#include <asm/io.h>
25
26#define CR_L2 (1 << 26)
27
28#define CACHE_LINE_SIZE 32
29#define CACHE_LINE_SHIFT 5
30#define CACHE_WAY_PER_SET 8
31
32#define CACHE_WAY_SIZE(l2ctype) (8192 << (((l2ctype) >> 8) & 0xf))
33#define CACHE_SET_SIZE(l2ctype) (CACHE_WAY_SIZE(l2ctype) >> CACHE_LINE_SHIFT)
34
35static inline int xsc3_l2_present(void)
36{
37 unsigned long l2ctype;
38
39 __asm__("mrc p15, 1, %0, c0, c0, 1" : "=r" (l2ctype));
40
41 return !!(l2ctype & 0xf8);
42}
43
44static inline void xsc3_l2_clean_mva(unsigned long addr)
45{
46 __asm__("mcr p15, 1, %0, c7, c11, 1" : : "r" (addr));
47}
48
49static inline void xsc3_l2_clean_pa(unsigned long addr)
50{
51 xsc3_l2_clean_mva(__phys_to_virt(addr));
52}
53
54static inline void xsc3_l2_inv_mva(unsigned long addr)
55{
56 __asm__("mcr p15, 1, %0, c7, c7, 1" : : "r" (addr));
57}
58
59static inline void xsc3_l2_inv_pa(unsigned long addr)
60{
61 xsc3_l2_inv_mva(__phys_to_virt(addr));
62}
63
64static inline void xsc3_l2_inv_all(void)
65{
66 unsigned long l2ctype, set_way;
67 int set, way;
68
69 __asm__("mrc p15, 1, %0, c0, c0, 1" : "=r" (l2ctype));
70
71 for (set = 0; set < CACHE_SET_SIZE(l2ctype); set++) {
72 for (way = 0; way < CACHE_WAY_PER_SET; way++) {
73 set_way = (way << 29) | (set << 5);
74 __asm__("mcr p15, 1, %0, c7, c11, 2" : : "r"(set_way));
75 }
76 }
77
78 dsb();
79}
80
81static void xsc3_l2_inv_range(unsigned long start, unsigned long end)
82{
83 if (start == 0 && end == -1ul) {
84 xsc3_l2_inv_all();
85 return;
86 }
87
88 /*
89 * Clean and invalidate partial first cache line.
90 */
91 if (start & (CACHE_LINE_SIZE - 1)) {
92 xsc3_l2_clean_pa(start & ~(CACHE_LINE_SIZE - 1));
93 xsc3_l2_inv_pa(start & ~(CACHE_LINE_SIZE - 1));
94 start = (start | (CACHE_LINE_SIZE - 1)) + 1;
95 }
96
97 /*
98 * Clean and invalidate partial last cache line.
99 */
100 if (end & (CACHE_LINE_SIZE - 1)) {
101 xsc3_l2_clean_pa(end & ~(CACHE_LINE_SIZE - 1));
102 xsc3_l2_inv_pa(end & ~(CACHE_LINE_SIZE - 1));
103 end &= ~(CACHE_LINE_SIZE - 1);
104 }
105
106 /*
107 * Invalidate all full cache lines between 'start' and 'end'.
108 */
109 while (start != end) {
110 xsc3_l2_inv_pa(start);
111 start += CACHE_LINE_SIZE;
112 }
113
114 dsb();
115}
116
117static void xsc3_l2_clean_range(unsigned long start, unsigned long end)
118{
119 start &= ~(CACHE_LINE_SIZE - 1);
120 while (start < end) {
121 xsc3_l2_clean_pa(start);
122 start += CACHE_LINE_SIZE;
123 }
124
125 dsb();
126}
127
128/*
129 * optimize L2 flush all operation by set/way format
130 */
131static inline void xsc3_l2_flush_all(void)
132{
133 unsigned long l2ctype, set_way;
134 int set, way;
135
136 __asm__("mrc p15, 1, %0, c0, c0, 1" : "=r" (l2ctype));
137
138 for (set = 0; set < CACHE_SET_SIZE(l2ctype); set++) {
139 for (way = 0; way < CACHE_WAY_PER_SET; way++) {
140 set_way = (way << 29) | (set << 5);
141 __asm__("mcr p15, 1, %0, c7, c15, 2" : : "r"(set_way));
142 }
143 }
144
145 dsb();
146}
147
148static void xsc3_l2_flush_range(unsigned long start, unsigned long end)
149{
150 if (start == 0 && end == -1ul) {
151 xsc3_l2_flush_all();
152 return;
153 }
154
155 start &= ~(CACHE_LINE_SIZE - 1);
156 while (start < end) {
157 xsc3_l2_clean_pa(start);
158 xsc3_l2_inv_pa(start);
159 start += CACHE_LINE_SIZE;
160 }
161
162 dsb();
163}
164
165static int __init xsc3_l2_init(void)
166{
167 if (!cpu_is_xsc3() || !xsc3_l2_present())
168 return 0;
169
170 if (!(get_cr() & CR_L2)) {
171 pr_info("XScale3 L2 cache enabled.\n");
172 adjust_cr(CR_L2, CR_L2);
173 xsc3_l2_inv_all();
174 }
175
176 outer_cache.inv_range = xsc3_l2_inv_range;
177 outer_cache.clean_range = xsc3_l2_clean_range;
178 outer_cache.flush_range = xsc3_l2_flush_range;
179
180 return 0;
181}
182core_initcall(xsc3_l2_init);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index e6352946dde0..30a69d67d673 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -156,9 +156,9 @@ static int __init check_initrd(struct meminfo *mi)
156 } 156 }
157 157
158 if (initrd_node == -1) { 158 if (initrd_node == -1) {
159 printk(KERN_ERR "initrd (0x%08lx - 0x%08lx) extends beyond " 159 printk(KERN_ERR "INITRD: 0x%08lx+0x%08lx extends beyond "
160 "physical memory - disabling initrd\n", 160 "physical memory - disabling initrd\n",
161 phys_initrd_start, end); 161 phys_initrd_start, phys_initrd_size);
162 phys_initrd_start = phys_initrd_size = 0; 162 phys_initrd_start = phys_initrd_size = 0;
163 } 163 }
164#endif 164#endif
@@ -239,25 +239,33 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
239 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, 239 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT,
240 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); 240 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
241 241
242 /*
243 * Reserve any special node zero regions.
244 */
245 if (node == 0)
246 reserve_node_zero(pgdat);
247
242#ifdef CONFIG_BLK_DEV_INITRD 248#ifdef CONFIG_BLK_DEV_INITRD
243 /* 249 /*
244 * If the initrd is in this node, reserve its memory. 250 * If the initrd is in this node, reserve its memory.
245 */ 251 */
246 if (node == initrd_node) { 252 if (node == initrd_node) {
247 reserve_bootmem_node(pgdat, phys_initrd_start, 253 int res = reserve_bootmem_node(pgdat, phys_initrd_start,
248 phys_initrd_size, BOOTMEM_DEFAULT); 254 phys_initrd_size, BOOTMEM_EXCLUSIVE);
249 initrd_start = __phys_to_virt(phys_initrd_start); 255
250 initrd_end = initrd_start + phys_initrd_size; 256 if (res == 0) {
257 initrd_start = __phys_to_virt(phys_initrd_start);
258 initrd_end = initrd_start + phys_initrd_size;
259 } else {
260 printk(KERN_ERR
261 "INITRD: 0x%08lx+0x%08lx overlaps in-use "
262 "memory region - disabling initrd\n",
263 phys_initrd_start, phys_initrd_size);
264 }
251 } 265 }
252#endif 266#endif
253 267
254 /* 268 /*
255 * Finally, reserve any node zero regions.
256 */
257 if (node == 0)
258 reserve_node_zero(pgdat);
259
260 /*
261 * initialise the zones within this node. 269 * initialise the zones within this node.
262 */ 270 */
263 memset(zone_size, 0, sizeof(zone_size)); 271 memset(zone_size, 0, sizeof(zone_size));
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 303a7ff6bfd2..b81dbf9ffb77 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -259,7 +259,7 @@ remap_area_supersections(unsigned long virt, unsigned long pfn,
259 * caller shouldn't need to know that small detail. 259 * caller shouldn't need to know that small detail.
260 * 260 *
261 * 'flags' are the extra L_PTE_ flags that you want to specify for this 261 * 'flags' are the extra L_PTE_ flags that you want to specify for this
262 * mapping. See include/asm-arm/proc-armv/pgtable.h for more information. 262 * mapping. See <asm/pgtable.h> for more information.
263 */ 263 */
264void __iomem * 264void __iomem *
265__arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size, 265__arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
diff --git a/arch/arm/mm/proc-arm720.S b/arch/arm/mm/proc-arm720.S
index d64f8e6f75ab..eda733d30455 100644
--- a/arch/arm/mm/proc-arm720.S
+++ b/arch/arm/mm/proc-arm720.S
@@ -231,7 +231,7 @@ cpu_arm720_name:
231 .align 231 .align
232 232
233/* 233/*
234 * See linux/include/asm-arm/procinfo.h for a definition of this structure. 234 * See <asm/procinfo.h> for a definition of this structure.
235 */ 235 */
236 236
237 .section ".proc.info.init", #alloc, #execinstr 237 .section ".proc.info.init", #alloc, #execinstr
diff --git a/arch/arm/mm/proc-sa110.S b/arch/arm/mm/proc-sa110.S
index 9818195dbf11..bbe10576c861 100644
--- a/arch/arm/mm/proc-sa110.S
+++ b/arch/arm/mm/proc-sa110.S
@@ -18,7 +18,7 @@
18#include <asm/assembler.h> 18#include <asm/assembler.h>
19#include <asm/asm-offsets.h> 19#include <asm/asm-offsets.h>
20#include <asm/elf.h> 20#include <asm/elf.h>
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/pgtable-hwdef.h> 22#include <asm/pgtable-hwdef.h>
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/ptrace.h> 24#include <asm/ptrace.h>
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S
index c5fe27ad2892..871ba018252e 100644
--- a/arch/arm/mm/proc-sa1100.S
+++ b/arch/arm/mm/proc-sa1100.S
@@ -23,7 +23,7 @@
23#include <asm/assembler.h> 23#include <asm/assembler.h>
24#include <asm/asm-offsets.h> 24#include <asm/asm-offsets.h>
25#include <asm/elf.h> 25#include <asm/elf.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm/pgtable-hwdef.h> 27#include <asm/pgtable-hwdef.h>
28#include <asm/pgtable.h> 28#include <asm/pgtable.h>
29 29
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index 3533741a76f6..7bd9e7197f60 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -28,7 +28,7 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <asm/assembler.h> 29#include <asm/assembler.h>
30#include <asm/elf.h> 30#include <asm/elf.h>
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/pgtable-hwdef.h> 33#include <asm/pgtable-hwdef.h>
34#include <asm/page.h> 34#include <asm/page.h>
@@ -52,11 +52,6 @@
52#define CACHESIZE 32768 52#define CACHESIZE 32768
53 53
54/* 54/*
55 * Run with L2 enabled.
56 */
57#define L2_CACHE_ENABLE 1
58
59/*
60 * This macro is used to wait for a CP15 write and is needed when we 55 * This macro is used to wait for a CP15 write and is needed when we
61 * have to ensure that the last operation to the coprocessor was 56 * have to ensure that the last operation to the coprocessor was
62 * completed before continuing with operation. 57 * completed before continuing with operation.
@@ -265,12 +260,9 @@ ENTRY(xsc3_dma_inv_range)
265 tst r0, #CACHELINESIZE - 1 260 tst r0, #CACHELINESIZE - 1
266 bic r0, r0, #CACHELINESIZE - 1 261 bic r0, r0, #CACHELINESIZE - 1
267 mcrne p15, 0, r0, c7, c10, 1 @ clean L1 D line 262 mcrne p15, 0, r0, c7, c10, 1 @ clean L1 D line
268 mcrne p15, 1, r0, c7, c11, 1 @ clean L2 line
269 tst r1, #CACHELINESIZE - 1 263 tst r1, #CACHELINESIZE - 1
270 mcrne p15, 0, r1, c7, c10, 1 @ clean L1 D line 264 mcrne p15, 0, r1, c7, c10, 1 @ clean L1 D line
271 mcrne p15, 1, r1, c7, c11, 1 @ clean L2 line
2721: mcr p15, 0, r0, c7, c6, 1 @ invalidate L1 D line 2651: mcr p15, 0, r0, c7, c6, 1 @ invalidate L1 D line
273 mcr p15, 1, r0, c7, c7, 1 @ invalidate L2 line
274 add r0, r0, #CACHELINESIZE 266 add r0, r0, #CACHELINESIZE
275 cmp r0, r1 267 cmp r0, r1
276 blo 1b 268 blo 1b
@@ -288,7 +280,6 @@ ENTRY(xsc3_dma_inv_range)
288ENTRY(xsc3_dma_clean_range) 280ENTRY(xsc3_dma_clean_range)
289 bic r0, r0, #CACHELINESIZE - 1 281 bic r0, r0, #CACHELINESIZE - 1
2901: mcr p15, 0, r0, c7, c10, 1 @ clean L1 D line 2821: mcr p15, 0, r0, c7, c10, 1 @ clean L1 D line
291 mcr p15, 1, r0, c7, c11, 1 @ clean L2 line
292 add r0, r0, #CACHELINESIZE 283 add r0, r0, #CACHELINESIZE
293 cmp r0, r1 284 cmp r0, r1
294 blo 1b 285 blo 1b
@@ -306,8 +297,6 @@ ENTRY(xsc3_dma_clean_range)
306ENTRY(xsc3_dma_flush_range) 297ENTRY(xsc3_dma_flush_range)
307 bic r0, r0, #CACHELINESIZE - 1 298 bic r0, r0, #CACHELINESIZE - 1
3081: mcr p15, 0, r0, c7, c14, 1 @ clean/invalidate L1 D line 2991: mcr p15, 0, r0, c7, c14, 1 @ clean/invalidate L1 D line
309 mcr p15, 1, r0, c7, c11, 1 @ clean L2 line
310 mcr p15, 1, r0, c7, c7, 1 @ invalidate L2 line
311 add r0, r0, #CACHELINESIZE 300 add r0, r0, #CACHELINESIZE
312 cmp r0, r1 301 cmp r0, r1
313 blo 1b 302 blo 1b
@@ -347,9 +336,7 @@ ENTRY(cpu_xsc3_switch_mm)
347 mcr p15, 0, ip, c7, c5, 0 @ invalidate L1 I cache and BTB 336 mcr p15, 0, ip, c7, c5, 0 @ invalidate L1 I cache and BTB
348 mcr p15, 0, ip, c7, c10, 4 @ data write barrier 337 mcr p15, 0, ip, c7, c10, 4 @ data write barrier
349 mcr p15, 0, ip, c7, c5, 4 @ prefetch flush 338 mcr p15, 0, ip, c7, c5, 4 @ prefetch flush
350#ifdef L2_CACHE_ENABLE
351 orr r0, r0, #0x18 @ cache the page table in L2 339 orr r0, r0, #0x18 @ cache the page table in L2
352#endif
353 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 340 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
354 mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs 341 mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs
355 cpwait_ret lr, ip 342 cpwait_ret lr, ip
@@ -378,12 +365,10 @@ ENTRY(cpu_xsc3_set_pte_ext)
378 orreq r2, r2, #PTE_EXT_AP_UNO_SRW @ yes -> user n/a, system r/w 365 orreq r2, r2, #PTE_EXT_AP_UNO_SRW @ yes -> user n/a, system r/w
379 @ combined with user -> user r/w 366 @ combined with user -> user r/w
380 367
381#if L2_CACHE_ENABLE
382 @ If it's cacheable, it needs to be in L2 also. 368 @ If it's cacheable, it needs to be in L2 also.
383 eor ip, r1, #L_PTE_CACHEABLE 369 eor ip, r1, #L_PTE_CACHEABLE
384 tst ip, #L_PTE_CACHEABLE 370 tst ip, #L_PTE_CACHEABLE
385 orreq r2, r2, #PTE_EXT_TEX(0x5) 371 orreq r2, r2, #PTE_EXT_TEX(0x5)
386#endif
387 372
388 tst r3, #L_PTE_PRESENT | L_PTE_YOUNG @ present and young? 373 tst r3, #L_PTE_PRESENT | L_PTE_YOUNG @ present and young?
389 movne r2, #0 @ no -> fault 374 movne r2, #0 @ no -> fault
@@ -408,9 +393,7 @@ __xsc3_setup:
408 mcr p15, 0, ip, c7, c10, 4 @ data write barrier 393 mcr p15, 0, ip, c7, c10, 4 @ data write barrier
409 mcr p15, 0, ip, c7, c5, 4 @ prefetch flush 394 mcr p15, 0, ip, c7, c5, 4 @ prefetch flush
410 mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs 395 mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs
411#if L2_CACHE_ENABLE
412 orr r4, r4, #0x18 @ cache the page table in L2 396 orr r4, r4, #0x18 @ cache the page table in L2
413#endif
414 mcr p15, 0, r4, c2, c0, 0 @ load page table pointer 397 mcr p15, 0, r4, c2, c0, 0 @ load page table pointer
415 398
416 mov r0, #0 @ don't allow CP access 399 mov r0, #0 @ don't allow CP access
@@ -418,9 +401,7 @@ __xsc3_setup:
418 401
419 mrc p15, 0, r0, c1, c0, 1 @ get auxiliary control reg 402 mrc p15, 0, r0, c1, c0, 1 @ get auxiliary control reg
420 and r0, r0, #2 @ preserve bit P bit setting 403 and r0, r0, #2 @ preserve bit P bit setting
421#if L2_CACHE_ENABLE
422 orr r0, r0, #(1 << 10) @ enable L2 for LLR cache 404 orr r0, r0, #(1 << 10) @ enable L2 for LLR cache
423#endif
424 mcr p15, 0, r0, c1, c0, 1 @ set auxiliary control reg 405 mcr p15, 0, r0, c1, c0, 1 @ set auxiliary control reg
425 406
426 adr r5, xsc3_crval 407 adr r5, xsc3_crval
@@ -429,9 +410,6 @@ __xsc3_setup:
429 bic r0, r0, r5 @ ..V. ..R. .... ..A. 410 bic r0, r0, r5 @ ..V. ..R. .... ..A.
430 orr r0, r0, r6 @ ..VI Z..S .... .C.M (mmu) 411 orr r0, r0, r6 @ ..VI Z..S .... .C.M (mmu)
431 @ ...I Z..S .... .... (uc) 412 @ ...I Z..S .... .... (uc)
432#if L2_CACHE_ENABLE
433 orr r0, r0, #0x04000000 @ L2 enable
434#endif
435 mov pc, lr 413 mov pc, lr
436 414
437 .size __xsc3_setup, . - __xsc3_setup 415 .size __xsc3_setup, . - __xsc3_setup
diff --git a/arch/arm/nwfpe/fpa11.h b/arch/arm/nwfpe/fpa11.h
index 4a4d02c09112..386cbd13eaf4 100644
--- a/arch/arm/nwfpe/fpa11.h
+++ b/arch/arm/nwfpe/fpa11.h
@@ -69,7 +69,7 @@ typedef union tagFPREG {
69 * This structure is exported to user space. Do not re-order. 69 * This structure is exported to user space. Do not re-order.
70 * Only add new stuff to the end, and do not change the size of 70 * Only add new stuff to the end, and do not change the size of
71 * any element. Elements of this structure are used by user 71 * any element. Elements of this structure are used by user
72 * space, and must match struct user_fp in include/asm-arm/user.h. 72 * space, and must match struct user_fp in <asm/user.h>.
73 * We include the byte offsets below for documentation purposes. 73 * We include the byte offsets below for documentation purposes.
74 * 74 *
75 * The size of this structure and FPREG are checked by fpmodule.c 75 * The size of this structure and FPREG are checked by fpmodule.c
diff --git a/arch/arm/oprofile/op_model_mpcore.c b/arch/arm/oprofile/op_model_mpcore.c
index 4458705021e0..92db6e035c65 100644
--- a/arch/arm/oprofile/op_model_mpcore.c
+++ b/arch/arm/oprofile/op_model_mpcore.c
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41#include <asm/irq.h> 41#include <asm/irq.h>
42#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
43#include <asm/hardware.h> 43#include <mach/hardware.h>
44#include <asm/system.h> 44#include <asm/system.h>
45 45
46#include "op_counter.h" 46#include "op_counter.h"
diff --git a/arch/arm/plat-iop/adma.c b/arch/arm/plat-iop/adma.c
index 53c5e9a52eb1..f72420821619 100644
--- a/arch/arm/plat-iop/adma.c
+++ b/arch/arm/plat-iop/adma.c
@@ -19,7 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <asm/hardware/iop3xx.h> 20#include <asm/hardware/iop3xx.h>
21#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
22#include <asm/arch/adma.h> 22#include <mach/adma.h>
23#include <asm/hardware/iop_adma.h> 23#include <asm/hardware/iop_adma.h>
24 24
25#ifdef CONFIG_ARCH_IOP32X 25#ifdef CONFIG_ARCH_IOP32X
diff --git a/arch/arm/plat-iop/i2c.c b/arch/arm/plat-iop/i2c.c
index e99909bdba71..6dcbcc4ad419 100644
--- a/arch/arm/plat-iop/i2c.c
+++ b/arch/arm/plat-iop/i2c.c
@@ -25,9 +25,8 @@
25#include <asm/setup.h> 25#include <asm/setup.h>
26#include <asm/system.h> 26#include <asm/system.h>
27#include <asm/memory.h> 27#include <asm/memory.h>
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/hardware/iop3xx.h> 29#include <asm/hardware/iop3xx.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
32 31
33#ifdef CONFIG_ARCH_IOP32X 32#ifdef CONFIG_ARCH_IOP32X
diff --git a/arch/arm/plat-iop/io.c b/arch/arm/plat-iop/io.c
index 498675d028d0..39dcfb4bdc71 100644
--- a/arch/arm/plat-iop/io.c
+++ b/arch/arm/plat-iop/io.c
@@ -18,7 +18,7 @@
18 */ 18 */
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24void * __iomem __iop3xx_ioremap(unsigned long cookie, size_t size, 24void * __iomem __iop3xx_ioremap(unsigned long cookie, size_t size,
diff --git a/arch/arm/plat-iop/pci.c b/arch/arm/plat-iop/pci.c
index d9bc15a69e5d..54708bf9cb15 100644
--- a/arch/arm/plat-iop/pci.c
+++ b/arch/arm/plat-iop/pci.c
@@ -21,10 +21,9 @@
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/signal.h> 22#include <asm/signal.h>
23#include <asm/system.h> 23#include <asm/system.h>
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
26#include <asm/hardware/iop3xx.h> 26#include <asm/hardware/iop3xx.h>
27#include <asm/mach-types.h>
28 27
29// #define DEBUG 28// #define DEBUG
30 29
diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
index 6fe481ff4fdf..c53fefb6aac4 100644
--- a/arch/arm/plat-iop/time.c
+++ b/arch/arm/plat-iop/time.c
@@ -18,13 +18,13 @@
18#include <linux/time.h> 18#include <linux/time.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/timex.h> 20#include <linux/timex.h>
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26#include <asm/mach/time.h> 26#include <asm/mach/time.h>
27#include <asm/arch/time.h> 27#include <mach/time.h>
28 28
29static unsigned long ticks_per_jiffy; 29static unsigned long ticks_per_jiffy;
30static unsigned long ticks_per_usec; 30static unsigned long ticks_per_usec;
diff --git a/arch/arm/plat-mxc/clock.c b/arch/arm/plat-mxc/clock.c
index 1aa86fd60d71..2f8627218839 100644
--- a/arch/arm/plat-mxc/clock.c
+++ b/arch/arm/plat-mxc/clock.c
@@ -39,7 +39,7 @@
39#include <linux/string.h> 39#include <linux/string.h>
40#include <linux/version.h> 40#include <linux/version.h>
41 41
42#include <asm/arch/clock.h> 42#include <mach/clock.h>
43 43
44static LIST_HEAD(clocks); 44static LIST_HEAD(clocks);
45static DEFINE_MUTEX(clocks_mutex); 45static DEFINE_MUTEX(clocks_mutex);
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 318b268f938e..733e0acac916 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -23,7 +23,7 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <asm/hardware.h> 26#include <mach/hardware.h>
27#include <asm-generic/bug.h> 27#include <asm-generic/bug.h>
28 28
29static struct mxc_gpio_port *mxc_gpio_ports; 29static struct mxc_gpio_port *mxc_gpio_ports;
diff --git a/arch/arm/plat-mxc/include/mach/board-mx27ads.h b/arch/arm/plat-mxc/include/mach/board-mx27ads.h
new file mode 100644
index 000000000000..61e66dac90ef
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-mx27ads.h
@@ -0,0 +1,354 @@
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_GPIO_BASE + MXC_MAX_GPIO_LINES)
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 * MXC UART EVB board level configurations
30 */
31
32#define MXC_LL_EXTUART_PADDR (CS4_BASE_ADDR + 0x20000)
33#define MXC_LL_EXTUART_VADDR (CS4_BASE_ADDR_VIRT + 0x20000)
34#define MXC_LL_EXTUART_16BIT_BUS
35
36#define MXC_LL_UART_PADDR UART1_BASE_ADDR
37#define MXC_LL_UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR)
38
39/*
40 * @name Memory Size parameters
41 */
42
43/*
44 * Size of SDRAM memory
45 */
46#define SDRAM_MEM_SIZE SZ_128M
47
48/*
49 * PBC Controller parameters
50 */
51
52/*
53 * Base address of PBC controller, CS4
54 */
55#define PBC_BASE_ADDRESS 0xEB000000
56#define PBC_REG_ADDR(offset) (PBC_BASE_ADDRESS + (offset))
57
58/*
59 * PBC Interupt name definitions
60 */
61#define PBC_GPIO1_0 0
62#define PBC_GPIO1_1 1
63#define PBC_GPIO1_2 2
64#define PBC_GPIO1_3 3
65#define PBC_GPIO1_4 4
66#define PBC_GPIO1_5 5
67
68#define PBC_INTR_MAX_NUM 6
69#define PBC_INTR_SHARED_MAX_NUM 8
70
71/* When the PBC address connection is fixed in h/w, defined as 1 */
72#define PBC_ADDR_SH 0
73
74/* Offsets for the PBC Controller register */
75/*
76 * PBC Board version register offset
77 */
78#define PBC_VERSION_REG PBC_REG_ADDR(0x00000 >> PBC_ADDR_SH)
79/*
80 * PBC Board control register 1 set address.
81 */
82#define PBC_BCTRL1_SET_REG PBC_REG_ADDR(0x00008 >> PBC_ADDR_SH)
83/*
84 * PBC Board control register 1 clear address.
85 */
86#define PBC_BCTRL1_CLEAR_REG PBC_REG_ADDR(0x0000C >> PBC_ADDR_SH)
87/*
88 * PBC Board control register 2 set address.
89 */
90#define PBC_BCTRL2_SET_REG PBC_REG_ADDR(0x00010 >> PBC_ADDR_SH)
91/*
92 * PBC Board control register 2 clear address.
93 */
94#define PBC_BCTRL2_CLEAR_REG PBC_REG_ADDR(0x00014 >> PBC_ADDR_SH)
95/*
96 * PBC Board control register 3 set address.
97 */
98#define PBC_BCTRL3_SET_REG PBC_REG_ADDR(0x00018 >> PBC_ADDR_SH)
99/*
100 * PBC Board control register 3 clear address.
101 */
102#define PBC_BCTRL3_CLEAR_REG PBC_REG_ADDR(0x0001C >> PBC_ADDR_SH)
103/*
104 * PBC Board control register 3 set address.
105 */
106#define PBC_BCTRL4_SET_REG PBC_REG_ADDR(0x00020 >> PBC_ADDR_SH)
107/*
108 * PBC Board control register 4 clear address.
109 */
110#define PBC_BCTRL4_CLEAR_REG PBC_REG_ADDR(0x00024 >> PBC_ADDR_SH)
111/*PBC_ADDR_SH
112 * PBC Board status register 1.
113 */
114#define PBC_BSTAT1_REG PBC_REG_ADDR(0x00028 >> PBC_ADDR_SH)
115/*
116 * PBC Board interrupt status register.
117 */
118#define PBC_INTSTATUS_REG PBC_REG_ADDR(0x0002C >> PBC_ADDR_SH)
119/*
120 * PBC Board interrupt current status register.
121 */
122#define PBC_INTCURR_STATUS_REG PBC_REG_ADDR(0x00034 >> PBC_ADDR_SH)
123/*
124 * PBC Interrupt mask register set address.
125 */
126#define PBC_INTMASK_SET_REG PBC_REG_ADDR(0x00038 >> PBC_ADDR_SH)
127/*
128 * PBC Interrupt mask register clear address.
129 */
130#define PBC_INTMASK_CLEAR_REG PBC_REG_ADDR(0x0003C >> PBC_ADDR_SH)
131/*
132 * External UART A.
133 */
134#define PBC_SC16C652_UARTA_REG PBC_REG_ADDR(0x20000 >> PBC_ADDR_SH)
135/*
136 * UART 4 Expanding Signal Status.
137 */
138#define PBC_UART_STATUS_REG PBC_REG_ADDR(0x22000 >> PBC_ADDR_SH)
139/*
140 * UART 4 Expanding Signal Control Set.
141 */
142#define PBC_UCTRL_SET_REG PBC_REG_ADDR(0x24000 >> PBC_ADDR_SH)
143/*
144 * UART 4 Expanding Signal Control Clear.
145 */
146#define PBC_UCTRL_CLR_REG PBC_REG_ADDR(0x26000 >> PBC_ADDR_SH)
147/*
148 * Ethernet Controller IO base address.
149 */
150#define PBC_CS8900A_IOBASE_REG PBC_REG_ADDR(0x40000 >> PBC_ADDR_SH)
151/*
152 * Ethernet Controller Memory base address.
153 */
154#define PBC_CS8900A_MEMBASE_REG PBC_REG_ADDR(0x42000 >> PBC_ADDR_SH)
155/*
156 * Ethernet Controller DMA base address.
157 */
158#define PBC_CS8900A_DMABASE_REG PBC_REG_ADDR(0x44000 >> PBC_ADDR_SH)
159
160/* PBC Board Version Register bit definition */
161#define PBC_VERSION_ADS 0x8000 /* Bit15=1 means version for ads */
162#define PBC_VERSION_EVB_REVB 0x4000 /* BIT14=1 means version for evb revb */
163
164/* PBC Board Control Register 1 bit definitions */
165#define PBC_BCTRL1_ERST 0x0001 /* Ethernet Reset */
166#define PBC_BCTRL1_URST 0x0002 /* Reset External UART controller */
167#define PBC_BCTRL1_FRST 0x0004 /* FEC Reset */
168#define PBC_BCTRL1_ESLEEP 0x0010 /* Enable ethernet Sleep */
169#define PBC_BCTRL1_LCDON 0x0800 /* Enable the LCD */
170
171/* PBC Board Control Register 2 bit definitions */
172#define PBC_BCTRL2_VCC_EN 0x0004 /* Enable VCC */
173#define PBC_BCTRL2_VPP_EN 0x0008 /* Enable Vpp */
174#define PBC_BCTRL2_ATAFEC_EN 0X0010
175#define PBC_BCTRL2_ATAFEC_SEL 0X0020
176#define PBC_BCTRL2_ATA_EN 0X0040
177#define PBC_BCTRL2_IRDA_SD 0X0080
178#define PBC_BCTRL2_IRDA_EN 0X0100
179#define PBC_BCTRL2_CCTL10 0X0200
180#define PBC_BCTRL2_CCTL11 0X0400
181
182/* PBC Board Control Register 3 bit definitions */
183#define PBC_BCTRL3_HSH_EN 0X0020
184#define PBC_BCTRL3_FSH_MOD 0X0040
185#define PBC_BCTRL3_OTG_HS_EN 0X0080
186#define PBC_BCTRL3_OTG_VBUS_EN 0X0100
187#define PBC_BCTRL3_FSH_VBUS_EN 0X0200
188#define PBC_BCTRL3_USB_OTG_ON 0X0800
189#define PBC_BCTRL3_USB_FSH_ON 0X1000
190
191/* PBC Board Control Register 4 bit definitions */
192#define PBC_BCTRL4_REGEN_SEL 0X0001
193#define PBC_BCTRL4_USER_OFF 0X0002
194#define PBC_BCTRL4_VIB_EN 0X0004
195#define PBC_BCTRL4_PWRGT1_EN 0X0008
196#define PBC_BCTRL4_PWRGT2_EN 0X0010
197#define PBC_BCTRL4_STDBY_PRI 0X0020
198
199#ifndef __ASSEMBLY__
200/*
201 * Enumerations for SD cards and memory stick card. This corresponds to
202 * the card EN bits in the IMR: SD1_EN | MS_EN | SD3_EN | SD2_EN.
203 */
204enum mxc_card_no {
205 MXC_CARD_SD2 = 0,
206 MXC_CARD_SD3,
207 MXC_CARD_MS,
208 MXC_CARD_SD1,
209 MXC_CARD_MIN = MXC_CARD_SD2,
210 MXC_CARD_MAX = MXC_CARD_SD1,
211};
212#endif
213
214#define MXC_CPLD_VER_1_50 0x01
215
216/*
217 * PBC BSTAT Register bit definitions
218 */
219#define PBC_BSTAT_PRI_INT 0X0001
220#define PBC_BSTAT_USB_BYP 0X0002
221#define PBC_BSTAT_ATA_IOCS16 0X0004
222#define PBC_BSTAT_ATA_CBLID 0X0008
223#define PBC_BSTAT_ATA_DASP 0X0010
224#define PBC_BSTAT_PWR_RDY 0X0020
225#define PBC_BSTAT_SD3_WP 0X0100
226#define PBC_BSTAT_SD2_WP 0X0200
227#define PBC_BSTAT_SD1_WP 0X0400
228#define PBC_BSTAT_SD3_DET 0X0800
229#define PBC_BSTAT_SD2_DET 0X1000
230#define PBC_BSTAT_SD1_DET 0X2000
231#define PBC_BSTAT_MS_DET 0X4000
232#define PBC_BSTAT_SD3_DET_BIT 11
233#define PBC_BSTAT_SD2_DET_BIT 12
234#define PBC_BSTAT_SD1_DET_BIT 13
235#define PBC_BSTAT_MS_DET_BIT 14
236#define MXC_BSTAT_BIT(n) ((n == MXC_CARD_SD2) ? PBC_BSTAT_SD2_DET : \
237 ((n == MXC_CARD_SD3) ? PBC_BSTAT_SD3_DET : \
238 ((n == MXC_CARD_SD1) ? PBC_BSTAT_SD1_DET : \
239 ((n == MXC_CARD_MS) ? PBC_BSTAT_MS_DET : \
240 0x0))))
241
242/*
243 * PBC UART Control Register bit definitions
244 */
245#define PBC_UCTRL_DCE_DCD 0X0001
246#define PBC_UCTRL_DCE_DSR 0X0002
247#define PBC_UCTRL_DCE_RI 0X0004
248#define PBC_UCTRL_DTE_DTR 0X0100
249
250/*
251 * PBC UART Status Register bit definitions
252 */
253#define PBC_USTAT_DTE_DCD 0X0001
254#define PBC_USTAT_DTE_DSR 0X0002
255#define PBC_USTAT_DTE_RI 0X0004
256#define PBC_USTAT_DCE_DTR 0X0100
257
258/*
259 * PBC Interupt mask register bit definitions
260 */
261#define PBC_INTR_SD3_R_EN_BIT 4
262#define PBC_INTR_SD2_R_EN_BIT 0
263#define PBC_INTR_SD1_R_EN_BIT 6
264#define PBC_INTR_MS_R_EN_BIT 5
265#define PBC_INTR_SD3_EN_BIT 13
266#define PBC_INTR_SD2_EN_BIT 12
267#define PBC_INTR_MS_EN_BIT 14
268#define PBC_INTR_SD1_EN_BIT 15
269
270#define PBC_INTR_SD2_R_EN 0x0001
271#define PBC_INTR_LOW_BAT 0X0002
272#define PBC_INTR_OTG_FSOVER 0X0004
273#define PBC_INTR_FSH_OVER 0X0008
274#define PBC_INTR_SD3_R_EN 0x0010
275#define PBC_INTR_MS_R_EN 0x0020
276#define PBC_INTR_SD1_R_EN 0x0040
277#define PBC_INTR_FEC_INT 0X0080
278#define PBC_INTR_ENET_INT 0X0100
279#define PBC_INTR_OTGFS_INT 0X0200
280#define PBC_INTR_XUART_INT 0X0400
281#define PBC_INTR_CCTL12 0X0800
282#define PBC_INTR_SD2_EN 0x1000
283#define PBC_INTR_SD3_EN 0x2000
284#define PBC_INTR_MS_EN 0x4000
285#define PBC_INTR_SD1_EN 0x8000
286
287
288
289/* For interrupts like xuart, enet etc */
290#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX27_PIN_TIN)
291#define MXC_MAX_EXP_IO_LINES 16
292
293/*
294 * This corresponds to PBC_INTMASK_SET_REG at offset 0x38.
295 *
296 */
297#define EXPIO_INT_LOW_BAT (MXC_EXP_IO_BASE + 1)
298#define EXPIO_INT_OTG_FS_OVR (MXC_EXP_IO_BASE + 2)
299#define EXPIO_INT_FSH_OVR (MXC_EXP_IO_BASE + 3)
300#define EXPIO_INT_RES4 (MXC_EXP_IO_BASE + 4)
301#define EXPIO_INT_RES5 (MXC_EXP_IO_BASE + 5)
302#define EXPIO_INT_RES6 (MXC_EXP_IO_BASE + 6)
303#define EXPIO_INT_FEC (MXC_EXP_IO_BASE + 7)
304#define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8)
305#define EXPIO_INT_OTG_FS_INT (MXC_EXP_IO_BASE + 9)
306#define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10)
307#define EXPIO_INT_CCTL12_INT (MXC_EXP_IO_BASE + 11)
308#define EXPIO_INT_SD2_EN (MXC_EXP_IO_BASE + 12)
309#define EXPIO_INT_SD3_EN (MXC_EXP_IO_BASE + 13)
310#define EXPIO_INT_MS_EN (MXC_EXP_IO_BASE + 14)
311#define EXPIO_INT_SD1_EN (MXC_EXP_IO_BASE + 15)
312
313/*
314 * This is System IRQ used by CS8900A for interrupt generation
315 * taken from platform.h
316 */
317#define CS8900AIRQ EXPIO_INT_ENET_INT
318/* This is I/O Base address used to access registers of CS8900A on MXC ADS */
319#define CS8900A_BASE_ADDRESS (PBC_CS8900A_IOBASE_REG + 0x300)
320
321#define MXC_PMIC_INT_LINE IOMUX_TO_IRQ(MX27_PIN_TOUT)
322
323/*
324* This is used to detect if the CPLD version is for mx27 evb board rev-a
325*/
326#define PBC_CPLD_VERSION_IS_REVA() \
327 ((__raw_readw(PBC_VERSION_REG) & \
328 (PBC_VERSION_ADS | PBC_VERSION_EVB_REVB))\
329 == 0)
330
331/* This is used to active or inactive ata signal in CPLD .
332 * It is dependent with hardware
333 */
334#define PBC_ATA_SIGNAL_ACTIVE() \
335 __raw_writew( \
336 PBC_BCTRL2_ATAFEC_EN|PBC_BCTRL2_ATAFEC_SEL|PBC_BCTRL2_ATA_EN, \
337 PBC_BCTRL2_CLEAR_REG)
338
339#define PBC_ATA_SIGNAL_INACTIVE() \
340 __raw_writew( \
341 PBC_BCTRL2_ATAFEC_EN|PBC_BCTRL2_ATAFEC_SEL|PBC_BCTRL2_ATA_EN, \
342 PBC_BCTRL2_SET_REG)
343
344#define MXC_BD_LED1 (1 << 5)
345#define MXC_BD_LED2 (1 << 6)
346#define MXC_BD_LED_ON(led) \
347 __raw_writew(led, PBC_BCTRL1_SET_REG)
348#define MXC_BD_LED_OFF(led) \
349 __raw_writew(led, PBC_BCTRL1_CLEAR_REG)
350
351/* to determine the correct external crystal reference */
352#define CKIH_27MHZ_BIT_SET (1 << 3)
353
354#endif /* __ASM_ARCH_MXC_BOARD_MX27ADS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
new file mode 100644
index 000000000000..1bc6fb0f9a83
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
@@ -0,0 +1,117 @@
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/* Base address of PBC controller */
15#define PBC_BASE_ADDRESS IO_ADDRESS(CS4_BASE_ADDR)
16/* Offsets for the PBC Controller register */
17
18/* PBC Board status register offset */
19#define PBC_BSTAT 0x000002
20
21/* PBC Board control register 1 set address */
22#define PBC_BCTRL1_SET 0x000004
23
24/* PBC Board control register 1 clear address */
25#define PBC_BCTRL1_CLEAR 0x000006
26
27/* PBC Board control register 2 set address */
28#define PBC_BCTRL2_SET 0x000008
29
30/* PBC Board control register 2 clear address */
31#define PBC_BCTRL2_CLEAR 0x00000A
32
33/* PBC Board control register 3 set address */
34#define PBC_BCTRL3_SET 0x00000C
35
36/* PBC Board control register 3 clear address */
37#define PBC_BCTRL3_CLEAR 0x00000E
38
39/* PBC Board control register 4 set address */
40#define PBC_BCTRL4_SET 0x000010
41
42/* PBC Board control register 4 clear address */
43#define PBC_BCTRL4_CLEAR 0x000012
44
45/* PBC Board status register 1 */
46#define PBC_BSTAT1 0x000014
47
48/* PBC Board interrupt status register */
49#define PBC_INTSTATUS 0x000016
50
51/* PBC Board interrupt current status register */
52#define PBC_INTCURR_STATUS 0x000018
53
54/* PBC Interrupt mask register set address */
55#define PBC_INTMASK_SET 0x00001A
56
57/* PBC Interrupt mask register clear address */
58#define PBC_INTMASK_CLEAR 0x00001C
59
60/* External UART A */
61#define PBC_SC16C652_UARTA 0x010000
62
63/* External UART B */
64#define PBC_SC16C652_UARTB 0x010010
65
66/* Ethernet Controller IO base address */
67#define PBC_CS8900A_IOBASE 0x020000
68
69/* Ethernet Controller Memory base address */
70#define PBC_CS8900A_MEMBASE 0x021000
71
72/* Ethernet Controller DMA base address */
73#define PBC_CS8900A_DMABASE 0x022000
74
75/* External chip select 0 */
76#define PBC_XCS0 0x040000
77
78/* LCD Display enable */
79#define PBC_LCD_EN_B 0x060000
80
81/* Code test debug enable */
82#define PBC_CODE_B 0x070000
83
84/* PSRAM memory select */
85#define PBC_PSRAM_B 0x5000000
86
87#define PBC_INTSTATUS_REG (PBC_INTSTATUS + PBC_BASE_ADDRESS)
88#define PBC_INTCURR_STATUS_REG (PBC_INTCURR_STATUS + PBC_BASE_ADDRESS)
89#define PBC_INTMASK_SET_REG (PBC_INTMASK_SET + PBC_BASE_ADDRESS)
90#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS)
91#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4)
92
93#define EXPIO_INT_LOW_BAT (MXC_EXP_IO_BASE + 0)
94#define EXPIO_INT_PB_IRQ (MXC_EXP_IO_BASE + 1)
95#define EXPIO_INT_OTG_FS_OVR (MXC_EXP_IO_BASE + 2)
96#define EXPIO_INT_FSH_OVR (MXC_EXP_IO_BASE + 3)
97#define EXPIO_INT_RES4 (MXC_EXP_IO_BASE + 4)
98#define EXPIO_INT_RES5 (MXC_EXP_IO_BASE + 5)
99#define EXPIO_INT_RES6 (MXC_EXP_IO_BASE + 6)
100#define EXPIO_INT_RES7 (MXC_EXP_IO_BASE + 7)
101#define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8)
102#define EXPIO_INT_OTG_FS_INT (MXC_EXP_IO_BASE + 9)
103#define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10)
104#define EXPIO_INT_XUART_INTB (MXC_EXP_IO_BASE + 11)
105#define EXPIO_INT_SYNTH_IRQ (MXC_EXP_IO_BASE + 12)
106#define EXPIO_INT_CE_INT1 (MXC_EXP_IO_BASE + 13)
107#define EXPIO_INT_CE_INT2 (MXC_EXP_IO_BASE + 14)
108#define EXPIO_INT_RES15 (MXC_EXP_IO_BASE + 15)
109
110#define MXC_MAX_EXP_IO_LINES 16
111
112/* mandatory for CONFIG_LL_DEBUG */
113
114#define MXC_LL_UART_PADDR UART1_BASE_ADDR
115#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
116
117#endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31lite.h b/arch/arm/plat-mxc/include/mach/board-mx31lite.h
new file mode 100644
index 000000000000..e4e5cf5ad7db
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-mx31lite.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright 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_MX31LITE_H__
12#define __ASM_ARCH_MXC_BOARD_MX31LITE_H__
13
14#define MXC_MAX_EXP_IO_LINES 16
15
16
17/*
18 * Memory Size parameters
19 */
20
21/*
22 * Size of SDRAM memory
23 */
24#define SDRAM_MEM_SIZE SZ_128M
25/*
26 * Size of MBX buffer memory
27 */
28#define MXC_MBX_MEM_SIZE SZ_16M
29/*
30 * Size of memory available to kernel
31 */
32#define MEM_SIZE (SDRAM_MEM_SIZE - MXC_MBX_MEM_SIZE)
33
34#define MXC_LL_UART_PADDR UART1_BASE_ADDR
35#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
36
37#endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */
38
diff --git a/arch/arm/plat-mxc/include/mach/board-pcm037.h b/arch/arm/plat-mxc/include/mach/board-pcm037.h
new file mode 100644
index 000000000000..82232ba3c8fc
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-pcm037.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2008 Sascha Hauer, Pengutronix
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __ASM_ARCH_MXC_BOARD_PCM037_H__
20#define __ASM_ARCH_MXC_BOARD_PCM037_H__
21
22/* mandatory for CONFIG_LL_DEBUG */
23
24#define MXC_LL_UART_PADDR UART1_BASE_ADDR
25#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
26
27#endif /* __ASM_ARCH_MXC_BOARD_PCM037_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-pcm038.h b/arch/arm/plat-mxc/include/mach/board-pcm038.h
new file mode 100644
index 000000000000..750c62afd90f
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-pcm038.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 * MA 02110-1301, USA.
17 */
18
19#ifndef __ASM_ARCH_MXC_BOARD_PCM038_H__
20#define __ASM_ARCH_MXC_BOARD_PCM038_H__
21
22/* mandatory for CONFIG_LL_DEBUG */
23
24#define MXC_LL_UART_PADDR UART1_BASE_ADDR
25#define MXC_LL_UART_VADDR (AIPI_BASE_ADDR_VIRT + 0x0A000)
26
27#ifndef __ASSEMBLY__
28/*
29 * This CPU module needs a baseboard to work. After basic initializing
30 * its own devices, it calls baseboard's init function.
31 * TODO: Add your own baseboard init function and call it from
32 * inside pcm038_init().
33 *
34 * This example here is for the development board. Refer pcm970-baseboard.c
35 */
36
37extern void pcm970_baseboard_init(void);
38
39#endif
40
41#endif /* __ASM_ARCH_MXC_BOARD_PCM038_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/clock.h b/arch/arm/plat-mxc/include/mach/clock.h
new file mode 100644
index 000000000000..24caa2b7c91d
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/clock.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright 2005-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#ifndef __ASM_ARCH_MXC_CLOCK_H__
21#define __ASM_ARCH_MXC_CLOCK_H__
22
23#ifndef __ASSEMBLY__
24#include <linux/list.h>
25
26struct module;
27
28struct clk {
29 struct list_head node;
30 struct module *owner;
31 const char *name;
32 int id;
33 /* Source clock this clk depends on */
34 struct clk *parent;
35 /* Secondary clock to enable/disable with this clock */
36 struct clk *secondary;
37 /* Reference count of clock enable/disable */
38 __s8 usecount;
39 /* Register bit position for clock's enable/disable control. */
40 u8 enable_shift;
41 /* Register address for clock's enable/disable control. */
42 u32 enable_reg;
43 u32 flags;
44 /* get the current clock rate (always a fresh value) */
45 unsigned long (*get_rate) (struct clk *);
46 /* Function ptr to set the clock to a new rate. The rate must match a
47 supported rate returned from round_rate. Leave blank if clock is not
48 programmable */
49 int (*set_rate) (struct clk *, unsigned long);
50 /* Function ptr to round the requested clock rate to the nearest
51 supported rate that is less than or equal to the requested rate. */
52 unsigned long (*round_rate) (struct clk *, unsigned long);
53 /* Function ptr to enable the clock. Leave blank if clock can not
54 be gated. */
55 int (*enable) (struct clk *);
56 /* Function ptr to disable the clock. Leave blank if clock can not
57 be gated. */
58 void (*disable) (struct clk *);
59 /* Function ptr to set the parent clock of the clock. */
60 int (*set_parent) (struct clk *, struct clk *);
61};
62
63int clk_register(struct clk *clk);
64void clk_unregister(struct clk *clk);
65
66#endif /* __ASSEMBLY__ */
67#endif /* __ASM_ARCH_MXC_CLOCK_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
new file mode 100644
index 000000000000..a6d2e24aab15
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright 2004-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_COMMON_H__
12#define __ASM_ARCH_MXC_COMMON_H__
13
14extern void mxc_map_io(void);
15extern void mxc_init_irq(void);
16extern void mxc_timer_init(const char *clk_timer);
17extern int mxc_clocks_init(unsigned long fref);
18extern int mxc_register_gpios(void);
19
20#endif
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
new file mode 100644
index 000000000000..b9907bebba3b
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -0,0 +1,49 @@
1/* arch/arm/mach-imx/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#include <mach/hardware.h>
15
16#ifdef CONFIG_MACH_MX31ADS
17#include <mach/board-mx31ads.h>
18#endif
19#ifdef CONFIG_MACH_PCM037
20#include <mach/board-pcm037.h>
21#endif
22#ifdef CONFIG_MACH_MX31LITE
23#include <mach/board-mx31lite.h>
24#endif
25#ifdef CONFIG_MACH_MX27ADS
26#include <mach/board-mx27ads.h>
27#endif
28#ifdef CONFIG_MACH_PCM038
29#include <mach/board-pcm038.h>
30#endif
31 .macro addruart,rx
32 mrc p15, 0, \rx, c1, c0
33 tst \rx, #1 @ MMU enabled?
34 ldreq \rx, =MXC_LL_UART_PADDR @ physical
35 ldrne \rx, =MXC_LL_UART_VADDR @ virtual
36 .endm
37
38 .macro senduart,rd,rx
39 str \rd, [\rx, #0x40] @ TXDATA
40 .endm
41
42 .macro waituart,rd,rx
43 .endm
44
45 .macro busyuart,rd,rx
461002: ldr \rd, [\rx, #0x98] @ SR2
47 tst \rd, #1 << 3 @ TXDC
48 beq 1002b @ wait until transmit done
49 .endm
diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h
new file mode 100644
index 000000000000..c822d569a05e
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/dma.h
@@ -0,0 +1,14 @@
1/*
2 * Copyright 2004-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_DMA_H__
12#define __ASM_ARCH_MXC_DMA_H__
13
14#endif
diff --git a/arch/arm/plat-mxc/include/mach/entry-macro.S b/arch/arm/plat-mxc/include/mach/entry-macro.S
new file mode 100644
index 000000000000..b542433afb1b
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/entry-macro.S
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 2007 Lennert Buytenhek <buytenh@wantstofly.org>
3 * Copyright 2004-2007 Freescale Semiconductor, Inc. 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 @ this macro disables fast irq (not implemented)
13 .macro disable_fiq
14 .endm
15
16 .macro get_irqnr_preamble, base, tmp
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
22 @ this macro checks which interrupt occured
23 @ and returns its number in irqnr
24 @ and returns if an interrupt occured in irqstat
25 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
26 ldr \base, =AVIC_IO_ADDRESS(AVIC_BASE_ADDR)
27 @ Load offset & priority of the highest priority
28 @ interrupt pending from AVIC_NIVECSR
29 ldr \irqstat, [\base, #0x40]
30 @ Shift to get the decoded IRQ number, using ASR so
31 @ 'no interrupt pending' becomes 0xffffffff
32 mov \irqnr, \irqstat, asr #16
33 @ set zero flag if IRQ + 1 == 0
34 adds \tmp, \irqnr, #1
35 .endm
36
37 @ irq priority table (not used)
38 .macro irq_prio_table
39 .endm
diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
new file mode 100644
index 000000000000..65eedc0d196f
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/gpio.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright 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, MA 02110-1301, USA.
17 */
18
19#ifndef __ASM_ARCH_MXC_GPIO_H__
20#define __ASM_ARCH_MXC_GPIO_H__
21
22#include <mach/hardware.h>
23#include <asm-generic/gpio.h>
24
25/* use gpiolib dispatchers */
26#define gpio_get_value __gpio_get_value
27#define gpio_set_value __gpio_set_value
28#define gpio_cansleep __gpio_cansleep
29
30#define gpio_to_irq(gpio) (MXC_MAX_INT_LINES + (gpio))
31#define irq_to_gpio(irq) ((irq) - MXC_MAX_INT_LINES)
32
33struct mxc_gpio_port {
34 void __iomem *base;
35 int irq;
36 int virtual_irq_start;
37 struct gpio_chip chip;
38};
39
40int mxc_gpio_init(struct mxc_gpio_port*, int);
41
42#endif
diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/plat-mxc/include/mach/hardware.h
new file mode 100644
index 000000000000..3caadeeda701
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/hardware.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright 2004-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#ifndef __ASM_ARCH_MXC_HARDWARE_H__
21#define __ASM_ARCH_MXC_HARDWARE_H__
22
23#include <asm/sizes.h>
24
25#ifdef CONFIG_ARCH_MX3
26# include <mach/mx31.h>
27#endif
28
29#ifdef CONFIG_ARCH_MX2
30# ifdef CONFIG_MACH_MX27
31# include <mach/mx27.h>
32# endif
33#endif
34
35#include <mach/mxc.h>
36
37#endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/iim.h b/arch/arm/plat-mxc/include/mach/iim.h
new file mode 100644
index 000000000000..315bffadafda
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/iim.h
@@ -0,0 +1,77 @@
1/*
2 * Copyright 2004-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#ifndef __ASM_ARCH_MXC_IIM_H__
21#define __ASM_ARCH_MXC_IIM_H__
22
23/* Register offsets */
24#define MXC_IIMSTAT 0x0000
25#define MXC_IIMSTATM 0x0004
26#define MXC_IIMERR 0x0008
27#define MXC_IIMEMASK 0x000C
28#define MXC_IIMFCTL 0x0010
29#define MXC_IIMUA 0x0014
30#define MXC_IIMLA 0x0018
31#define MXC_IIMSDAT 0x001C
32#define MXC_IIMPREV 0x0020
33#define MXC_IIMSREV 0x0024
34#define MXC_IIMPRG_P 0x0028
35#define MXC_IIMSCS0 0x002C
36#define MXC_IIMSCS1 0x0030
37#define MXC_IIMSCS2 0x0034
38#define MXC_IIMSCS3 0x0038
39#define MXC_IIMFBAC0 0x0800
40#define MXC_IIMJAC 0x0804
41#define MXC_IIMHWV1 0x0808
42#define MXC_IIMHWV2 0x080C
43#define MXC_IIMHAB0 0x0810
44#define MXC_IIMHAB1 0x0814
45/* Definitions for i.MX27 TO2 */
46#define MXC_IIMMAC 0x0814
47#define MXC_IIMPREV_FUSE 0x0818
48#define MXC_IIMSREV_FUSE 0x081C
49#define MXC_IIMSJC_CHALL_0 0x0820
50#define MXC_IIMSJC_CHALL_7 0x083C
51#define MXC_IIMFB0UC17 0x0840
52#define MXC_IIMFB0UC255 0x0BFC
53#define MXC_IIMFBAC1 0x0C00
54/* Definitions for i.MX27 TO2 */
55#define MXC_IIMSUID 0x0C04
56#define MXC_IIMKEY0 0x0C04
57#define MXC_IIMKEY20 0x0C54
58#define MXC_IIMSJC_RESP_0 0x0C58
59#define MXC_IIMSJC_RESP_7 0x0C74
60#define MXC_IIMFB1UC30 0x0C78
61#define MXC_IIMFB1UC255 0x0FFC
62
63/* Bit definitions */
64
65#define MXC_IIMHWV1_WLOCK (0x1 << 7)
66#define MXC_IIMHWV1_MCU_ENDIAN (0x1 << 6)
67#define MXC_IIMHWV1_DSP_ENDIAN (0x1 << 5)
68#define MXC_IIMHWV1_BOOT_INT (0x1 << 4)
69#define MXC_IIMHWV1_SCC_DISABLE (0x1 << 3)
70#define MXC_IIMHWV1_HANTRO_DISABLE (0x1 << 2)
71#define MXC_IIMHWV1_MEMSTICK_DIS (0x1 << 1)
72
73#define MXC_IIMHWV2_WLOCK (0x1 << 7)
74#define MXC_IIMHWV2_BP_SDMA (0x1 << 6)
75#define MXC_IIMHWV2_SCM_DCM (0x1 << 5)
76
77#endif /* __ASM_ARCH_MXC_IIM_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/imx-uart.h b/arch/arm/plat-mxc/include/mach/imx-uart.h
new file mode 100644
index 000000000000..83fb72c4048a
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/imx-uart.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 * MA 02110-1301, USA.
17 */
18
19#ifndef ASMARM_ARCH_UART_H
20#define ASMARM_ARCH_UART_H
21
22#define IMXUART_HAVE_RTSCTS (1<<0)
23
24struct imxuart_platform_data {
25 int (*init)(struct platform_device *pdev);
26 int (*exit)(struct platform_device *pdev);
27 unsigned int flags;
28};
29
30int __init imx_init_uart(int uart_no, struct imxuart_platform_data *pdata);
31
32#endif
diff --git a/arch/arm/plat-mxc/include/mach/io.h b/arch/arm/plat-mxc/include/mach/io.h
new file mode 100644
index 000000000000..65b6810124c1
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/io.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright 2004-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_IO_H__
12#define __ASM_ARCH_MXC_IO_H__
13
14/* Allow IO space to be anywhere in the memory */
15#define IO_SPACE_LIMIT 0xffffffff
16
17/* io address mapping macro */
18#define __io(a) ((void __iomem *)(a))
19
20#define __mem_pci(a) (a)
21
22#endif
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h b/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h
new file mode 100644
index 000000000000..076d37b38eb2
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h
@@ -0,0 +1,372 @@
1/*
2 * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 * MA 02110-1301, USA.
17 */
18
19#ifndef _MXC_GPIO_MX1_MX2_H
20#define _MXC_GPIO_MX1_MX2_H
21
22#include <linux/io.h>
23
24#define MXC_GPIO_ALLOC_MODE_NORMAL 0
25#define MXC_GPIO_ALLOC_MODE_NO_ALLOC 1
26#define MXC_GPIO_ALLOC_MODE_TRY_ALLOC 2
27#define MXC_GPIO_ALLOC_MODE_ALLOC_ONLY 4
28#define MXC_GPIO_ALLOC_MODE_RELEASE 8
29
30/*
31 * GPIO Module and I/O Multiplexer
32 * x = 0..3 for reg_A, reg_B, reg_C, reg_D
33 */
34#define VA_GPIO_BASE IO_ADDRESS(GPIO_BASE_ADDR)
35#define MXC_DDIR(x) (0x00 + ((x) << 8))
36#define MXC_OCR1(x) (0x04 + ((x) << 8))
37#define MXC_OCR2(x) (0x08 + ((x) << 8))
38#define MXC_ICONFA1(x) (0x0c + ((x) << 8))
39#define MXC_ICONFA2(x) (0x10 + ((x) << 8))
40#define MXC_ICONFB1(x) (0x14 + ((x) << 8))
41#define MXC_ICONFB2(x) (0x18 + ((x) << 8))
42#define MXC_DR(x) (0x1c + ((x) << 8))
43#define MXC_GIUS(x) (0x20 + ((x) << 8))
44#define MXC_SSR(x) (0x24 + ((x) << 8))
45#define MXC_ICR1(x) (0x28 + ((x) << 8))
46#define MXC_ICR2(x) (0x2c + ((x) << 8))
47#define MXC_IMR(x) (0x30 + ((x) << 8))
48#define MXC_ISR(x) (0x34 + ((x) << 8))
49#define MXC_GPR(x) (0x38 + ((x) << 8))
50#define MXC_SWR(x) (0x3c + ((x) << 8))
51#define MXC_PUEN(x) (0x40 + ((x) << 8))
52
53#ifdef CONFIG_ARCH_MX1
54# define GPIO_PORT_MAX 3
55#endif
56#ifdef CONFIG_ARCH_MX2
57# define GPIO_PORT_MAX 5
58#endif
59
60#ifndef GPIO_PORT_MAX
61# error "GPIO config port count unknown!"
62#endif
63
64#define GPIO_PIN_MASK 0x1f
65
66#define GPIO_PORT_SHIFT 5
67#define GPIO_PORT_MASK (0x7 << GPIO_PORT_SHIFT)
68
69#define GPIO_PORTA (0 << GPIO_PORT_SHIFT)
70#define GPIO_PORTB (1 << GPIO_PORT_SHIFT)
71#define GPIO_PORTC (2 << GPIO_PORT_SHIFT)
72#define GPIO_PORTD (3 << GPIO_PORT_SHIFT)
73#define GPIO_PORTE (4 << GPIO_PORT_SHIFT)
74#define GPIO_PORTF (5 << GPIO_PORT_SHIFT)
75
76#define GPIO_OUT (1 << 8)
77#define GPIO_IN (0 << 8)
78#define GPIO_PUEN (1 << 9)
79
80#define GPIO_PF (1 << 10)
81#define GPIO_AF (1 << 11)
82
83#define GPIO_OCR_SHIFT 12
84#define GPIO_OCR_MASK (3 << GPIO_OCR_SHIFT)
85#define GPIO_AIN (0 << GPIO_OCR_SHIFT)
86#define GPIO_BIN (1 << GPIO_OCR_SHIFT)
87#define GPIO_CIN (2 << GPIO_OCR_SHIFT)
88#define GPIO_GPIO (3 << GPIO_OCR_SHIFT)
89
90#define GPIO_AOUT_SHIFT 14
91#define GPIO_AOUT_MASK (3 << GPIO_AOUT_SHIFT)
92#define GPIO_AOUT (0 << GPIO_AOUT_SHIFT)
93#define GPIO_AOUT_ISR (1 << GPIO_AOUT_SHIFT)
94#define GPIO_AOUT_0 (2 << GPIO_AOUT_SHIFT)
95#define GPIO_AOUT_1 (3 << GPIO_AOUT_SHIFT)
96
97#define GPIO_BOUT_SHIFT 16
98#define GPIO_BOUT_MASK (3 << GPIO_BOUT_SHIFT)
99#define GPIO_BOUT (0 << GPIO_BOUT_SHIFT)
100#define GPIO_BOUT_ISR (1 << GPIO_BOUT_SHIFT)
101#define GPIO_BOUT_0 (2 << GPIO_BOUT_SHIFT)
102#define GPIO_BOUT_1 (3 << GPIO_BOUT_SHIFT)
103
104extern void mxc_gpio_mode(int gpio_mode);
105extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
106 int alloc_mode, const char *label);
107
108/*-------------------------------------------------------------------------*/
109
110/* assignements for GPIO alternate/primary functions */
111
112/* FIXME: This list is not completed. The correct directions are
113 * missing on some (many) pins
114 */
115#ifdef CONFIG_ARCH_MX1
116#define PA0_AIN_SPI2_CLK (GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 0)
117#define PA0_AF_ETMTRACESYNC (GPIO_PORTA | GPIO_AF | 0)
118#define PA1_AOUT_SPI2_RXD (GPIO_GIUS | GPIO_PORTA | GPIO_IN | 1)
119#define PA1_PF_TIN (GPIO_PORTA | GPIO_PF | 1)
120#define PA2_PF_PWM0 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 2)
121#define PA3_PF_CSI_MCLK (GPIO_PORTA | GPIO_PF | 3)
122#define PA4_PF_CSI_D0 (GPIO_PORTA | GPIO_PF | 4)
123#define PA5_PF_CSI_D1 (GPIO_PORTA | GPIO_PF | 5)
124#define PA6_PF_CSI_D2 (GPIO_PORTA | GPIO_PF | 6)
125#define PA7_PF_CSI_D3 (GPIO_PORTA | GPIO_PF | 7)
126#define PA8_PF_CSI_D4 (GPIO_PORTA | GPIO_PF | 8)
127#define PA9_PF_CSI_D5 (GPIO_PORTA | GPIO_PF | 9)
128#define PA10_PF_CSI_D6 (GPIO_PORTA | GPIO_PF | 10)
129#define PA11_PF_CSI_D7 (GPIO_PORTA | GPIO_PF | 11)
130#define PA12_PF_CSI_VSYNC (GPIO_PORTA | GPIO_PF | 12)
131#define PA13_PF_CSI_HSYNC (GPIO_PORTA | GPIO_PF | 13)
132#define PA14_PF_CSI_PIXCLK (GPIO_PORTA | GPIO_PF | 14)
133#define PA15_PF_I2C_SDA (GPIO_PORTA | GPIO_OUT | GPIO_PF | 15)
134#define PA16_PF_I2C_SCL (GPIO_PORTA | GPIO_OUT | GPIO_PF | 16)
135#define PA17_AF_ETMTRACEPKT4 (GPIO_PORTA | GPIO_AF | 17)
136#define PA17_AIN_SPI2_SS (GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 17)
137#define PA18_AF_ETMTRACEPKT5 (GPIO_PORTA | GPIO_AF | 18)
138#define PA19_AF_ETMTRACEPKT6 (GPIO_PORTA | GPIO_AF | 19)
139#define PA20_AF_ETMTRACEPKT7 (GPIO_PORTA | GPIO_AF | 20)
140#define PA21_PF_A0 (GPIO_PORTA | GPIO_PF | 21)
141#define PA22_PF_CS4 (GPIO_PORTA | GPIO_PF | 22)
142#define PA23_PF_CS5 (GPIO_PORTA | GPIO_PF | 23)
143#define PA24_PF_A16 (GPIO_PORTA | GPIO_PF | 24)
144#define PA24_AF_ETMTRACEPKT0 (GPIO_PORTA | GPIO_AF | 24)
145#define PA25_PF_A17 (GPIO_PORTA | GPIO_PF | 25)
146#define PA25_AF_ETMTRACEPKT1 (GPIO_PORTA | GPIO_AF | 25)
147#define PA26_PF_A18 (GPIO_PORTA | GPIO_PF | 26)
148#define PA26_AF_ETMTRACEPKT2 (GPIO_PORTA | GPIO_AF | 26)
149#define PA27_PF_A19 (GPIO_PORTA | GPIO_PF | 27)
150#define PA27_AF_ETMTRACEPKT3 (GPIO_PORTA | GPIO_AF | 27)
151#define PA28_PF_A20 (GPIO_PORTA | GPIO_PF | 28)
152#define PA28_AF_ETMPIPESTAT0 (GPIO_PORTA | GPIO_AF | 28)
153#define PA29_PF_A21 (GPIO_PORTA | GPIO_PF | 29)
154#define PA29_AF_ETMPIPESTAT1 (GPIO_PORTA | GPIO_AF | 29)
155#define PA30_PF_A22 (GPIO_PORTA | GPIO_PF | 30)
156#define PA30_AF_ETMPIPESTAT2 (GPIO_PORTA | GPIO_AF | 30)
157#define PA31_PF_A23 (GPIO_PORTA | GPIO_PF | 31)
158#define PA31_AF_ETMTRACECLK (GPIO_PORTA | GPIO_AF | 31)
159#define PB8_PF_SD_DAT0 (GPIO_PORTB | GPIO_PF | GPIO_PUEN | 8)
160#define PB8_AF_MS_PIO (GPIO_PORTB | GPIO_AF | 8)
161#define PB9_PF_SD_DAT1 (GPIO_PORTB | GPIO_PF | GPIO_PUEN | 9)
162#define PB9_AF_MS_PI1 (GPIO_PORTB | GPIO_AF | 9)
163#define PB10_PF_SD_DAT2 (GPIO_PORTB | GPIO_PF | GPIO_PUEN | 10)
164#define PB10_AF_MS_SCLKI (GPIO_PORTB | GPIO_AF | 10)
165#define PB11_PF_SD_DAT3 (GPIO_PORTB | GPIO_PF | 11)
166#define PB11_AF_MS_SDIO (GPIO_PORTB | GPIO_AF | 11)
167#define PB12_PF_SD_CLK (GPIO_PORTB | GPIO_PF | 12)
168#define PB12_AF_MS_SCLK0 (GPIO_PORTB | GPIO_AF | 12)
169#define PB13_PF_SD_CMD (GPIO_PORTB | GPIO_PF | GPIO_PUEN | 13)
170#define PB13_AF_MS_BS (GPIO_PORTB | GPIO_AF | 13)
171#define PB14_AF_SSI_RXFS (GPIO_PORTB | GPIO_AF | 14)
172#define PB15_AF_SSI_RXCLK (GPIO_PORTB | GPIO_AF | 15)
173#define PB16_AF_SSI_RXDAT (GPIO_PORTB | GPIO_IN | GPIO_AF | 16)
174#define PB17_AF_SSI_TXDAT (GPIO_PORTB | GPIO_OUT | GPIO_AF | 17)
175#define PB18_AF_SSI_TXFS (GPIO_PORTB | GPIO_AF | 18)
176#define PB19_AF_SSI_TXCLK (GPIO_PORTB | GPIO_AF | 19)
177#define PB20_PF_USBD_AFE (GPIO_PORTB | GPIO_PF | 20)
178#define PB21_PF_USBD_OE (GPIO_PORTB | GPIO_PF | 21)
179#define PB22_PFUSBD_RCV (GPIO_PORTB | GPIO_PF | 22)
180#define PB23_PF_USBD_SUSPND (GPIO_PORTB | GPIO_PF | 23)
181#define PB24_PF_USBD_VP (GPIO_PORTB | GPIO_PF | 24)
182#define PB25_PF_USBD_VM (GPIO_PORTB | GPIO_PF | 25)
183#define PB26_PF_USBD_VPO (GPIO_PORTB | GPIO_PF | 26)
184#define PB27_PF_USBD_VMO (GPIO_PORTB | GPIO_PF | 27)
185#define PB28_PF_UART2_CTS (GPIO_PORTB | GPIO_OUT | GPIO_PF | 28)
186#define PB29_PF_UART2_RTS (GPIO_PORTB | GPIO_IN | GPIO_PF | 29)
187#define PB30_PF_UART2_TXD (GPIO_PORTB | GPIO_OUT | GPIO_PF | 30)
188#define PB31_PF_UART2_RXD (GPIO_PORTB | GPIO_IN | GPIO_PF | 31)
189#define PC3_PF_SSI_RXFS (GPIO_PORTC | GPIO_PF | 3)
190#define PC4_PF_SSI_RXCLK (GPIO_PORTC | GPIO_PF | 4)
191#define PC5_PF_SSI_RXDAT (GPIO_PORTC | GPIO_IN | GPIO_PF | 5)
192#define PC6_PF_SSI_TXDAT (GPIO_PORTC | GPIO_OUT | GPIO_PF | 6)
193#define PC7_PF_SSI_TXFS (GPIO_PORTC | GPIO_PF | 7)
194#define PC8_PF_SSI_TXCLK (GPIO_PORTC | GPIO_PF | 8)
195#define PC9_PF_UART1_CTS (GPIO_PORTC | GPIO_OUT | GPIO_PF | 9)
196#define PC10_PF_UART1_RTS (GPIO_PORTC | GPIO_IN | GPIO_PF | 10)
197#define PC11_PF_UART1_TXD (GPIO_PORTC | GPIO_OUT | GPIO_PF | 11)
198#define PC12_PF_UART1_RXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 12)
199#define PC13_PF_SPI1_SPI_RDY (GPIO_PORTC | GPIO_PF | 13)
200#define PC14_PF_SPI1_SCLK (GPIO_PORTC | GPIO_PF | 14)
201#define PC15_PF_SPI1_SS (GPIO_PORTC | GPIO_PF | 15)
202#define PC16_PF_SPI1_MISO (GPIO_PORTC | GPIO_PF | 16)
203#define PC17_PF_SPI1_MOSI (GPIO_PORTC | GPIO_PF | 17)
204#define PC24_BIN_UART3_RI (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 24)
205#define PC25_BIN_UART3_DSR (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 25)
206#define PC26_AOUT_UART3_DTR (GPIO_GIUS | GPIO_PORTC | GPIO_IN | 26)
207#define PC27_BIN_UART3_DCD (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 27)
208#define PC28_BIN_UART3_CTS (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 28)
209#define PC29_AOUT_UART3_RTS (GPIO_GIUS | GPIO_PORTC | GPIO_IN | 29)
210#define PC30_BIN_UART3_TX (GPIO_GIUS | GPIO_PORTC | GPIO_BIN | 30)
211#define PC31_AOUT_UART3_RX (GPIO_GIUS | GPIO_PORTC | GPIO_IN | 31)
212#define PD6_PF_LSCLK (GPIO_PORTD | GPIO_OUT | GPIO_PF | 6)
213#define PD7_PF_REV (GPIO_PORTD | GPIO_PF | 7)
214#define PD7_AF_UART2_DTR (GPIO_GIUS | GPIO_PORTD | GPIO_IN | GPIO_AF | 7)
215#define PD7_AIN_SPI2_SCLK (GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 7)
216#define PD8_PF_CLS (GPIO_PORTD | GPIO_PF | 8)
217#define PD8_AF_UART2_DCD (GPIO_PORTD | GPIO_OUT | GPIO_AF | 8)
218#define PD8_AIN_SPI2_SS (GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 8)
219#define PD9_PF_PS (GPIO_PORTD | GPIO_PF | 9)
220#define PD9_AF_UART2_RI (GPIO_PORTD | GPIO_OUT | GPIO_AF | 9)
221#define PD9_AOUT_SPI2_RXD (GPIO_GIUS | GPIO_PORTD | GPIO_IN | 9)
222#define PD10_PF_SPL_SPR (GPIO_PORTD | GPIO_OUT | GPIO_PF | 10)
223#define PD10_AF_UART2_DSR (GPIO_PORTD | GPIO_OUT | GPIO_AF | 10)
224#define PD10_AIN_SPI2_TXD (GPIO_GIUS | GPIO_PORTD | GPIO_OUT | 10)
225#define PD11_PF_CONTRAST (GPIO_PORTD | GPIO_OUT | GPIO_PF | 11)
226#define PD12_PF_ACD_OE (GPIO_PORTD | GPIO_OUT | GPIO_PF | 12)
227#define PD13_PF_LP_HSYNC (GPIO_PORTD | GPIO_OUT | GPIO_PF | 13)
228#define PD14_PF_FLM_VSYNC (GPIO_PORTD | GPIO_OUT | GPIO_PF | 14)
229#define PD15_PF_LD0 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 15)
230#define PD16_PF_LD1 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 16)
231#define PD17_PF_LD2 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 17)
232#define PD18_PF_LD3 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 18)
233#define PD19_PF_LD4 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 19)
234#define PD20_PF_LD5 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 20)
235#define PD21_PF_LD6 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 21)
236#define PD22_PF_LD7 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 22)
237#define PD23_PF_LD8 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 23)
238#define PD24_PF_LD9 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 24)
239#define PD25_PF_LD10 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 25)
240#define PD26_PF_LD11 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 26)
241#define PD27_PF_LD12 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 27)
242#define PD28_PF_LD13 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 28)
243#define PD29_PF_LD14 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 29)
244#define PD30_PF_LD15 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 30)
245#define PD31_PF_TMR2OUT (GPIO_PORTD | GPIO_PF | 31)
246#define PD31_BIN_SPI2_TXD (GPIO_GIUS | GPIO_PORTD | GPIO_BIN | 31)
247#endif
248
249#ifdef CONFIG_ARCH_MX2
250#define PA5_PF_LSCLK (GPIO_PORTA | GPIO_OUT | GPIO_PF | 5)
251#define PA6_PF_LD0 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 6)
252#define PA7_PF_LD1 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 7)
253#define PA8_PF_LD2 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 8)
254#define PA9_PF_LD3 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 9)
255#define PA10_PF_LD4 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 10)
256#define PA11_PF_LD5 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 11)
257#define PA12_PF_LD6 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 12)
258#define PA13_PF_LD7 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 13)
259#define PA14_PF_LD8 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 14)
260#define PA15_PF_LD9 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 15)
261#define PA16_PF_LD10 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 16)
262#define PA17_PF_LD11 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 17)
263#define PA18_PF_LD12 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 18)
264#define PA19_PF_LD13 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 19)
265#define PA20_PF_LD14 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 20)
266#define PA21_PF_LD15 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 21)
267#define PA22_PF_LD16 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 22)
268#define PA23_PF_LD17 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 23)
269#define PA24_PF_REV (GPIO_PORTA | GPIO_OUT | GPIO_PF | 24)
270#define PA25_PF_CLS (GPIO_PORTA | GPIO_OUT | GPIO_PF | 25)
271#define PA26_PF_PS (GPIO_PORTA | GPIO_OUT | GPIO_PF | 26)
272#define PA27_PF_SPL_SPR (GPIO_PORTA | GPIO_OUT | GPIO_PF | 27)
273#define PA28_PF_HSYNC (GPIO_PORTA | GPIO_OUT | GPIO_PF | 28)
274#define PA29_PF_VSYNC (GPIO_PORTA | GPIO_OUT | GPIO_PF | 29)
275#define PA30_PF_CONTRAST (GPIO_PORTA | GPIO_OUT | GPIO_PF | 30)
276#define PA31_PF_OE_ACD (GPIO_PORTA | GPIO_OUT | GPIO_PF | 31)
277#define PB10_PF_CSI_D0 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 10)
278#define PB10_AF_UART6_TXD (GPIO_PORTB | GPIO_OUT | GPIO_AF | 10)
279#define PB11_PF_CSI_D1 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 11)
280#define PB11_AF_UART6_RXD (GPIO_PORTB | GPIO_IN | GPIO_AF | 11)
281#define PB12_PF_CSI_D2 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 12)
282#define PB12_AF_UART6_CTS (GPIO_PORTB | GPIO_OUT | GPIO_AF | 12)
283#define PB13_PF_CSI_D3 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 13)
284#define PB13_AF_UART6_RTS (GPIO_PORTB | GPIO_IN | GPIO_AF | 13)
285#define PB14_PF_CSI_D4 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 14)
286#define PB15_PF_CSI_MCLK (GPIO_PORTB | GPIO_OUT | GPIO_PF | 15)
287#define PB16_PF_CSI_PIXCLK (GPIO_PORTB | GPIO_OUT | GPIO_PF | 16)
288#define PB17_PF_CSI_D5 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 17)
289#define PB18_PF_CSI_D6 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 18)
290#define PB18_AF_UART5_TXD (GPIO_PORTB | GPIO_OUT | GPIO_AF | 18)
291#define PB19_PF_CSI_D7 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 19)
292#define PB19_AF_UART5_RXD (GPIO_PORTB | GPIO_IN | GPIO_AF | 19)
293#define PB20_PF_CSI_VSYNC (GPIO_PORTB | GPIO_OUT | GPIO_PF | 20)
294#define PB20_AF_UART5_CTS (GPIO_PORTB | GPIO_OUT | GPIO_AF | 20)
295#define PB21_PF_CSI_HSYNC (GPIO_PORTB | GPIO_OUT | GPIO_PF | 21)
296#define PB21_AF_UART5_RTS (GPIO_PORTB | GPIO_IN | GPIO_AF | 21)
297#define PB26_AF_UART4_RTS (GPIO_PORTB | GPIO_IN | GPIO_PF | 26)
298#define PB28_AF_UART4_TXD (GPIO_PORTB | GPIO_OUT | GPIO_AF | 28)
299#define PB29_AF_UART4_CTS (GPIO_PORTB | GPIO_OUT | GPIO_AF | 29)
300#define PB31_AF_UART4_RXD (GPIO_PORTB | GPIO_IN | GPIO_AF | 31)
301#define PC5_PF_I2C2_SDA (GPIO_PORTC | GPIO_IN | GPIO_PF | 5)
302#define PC6_PF_I2C2_SCL (GPIO_PORTC | GPIO_IN | GPIO_PF | 6)
303#define PC16_PF_SSI4_FS (GPIO_PORTC | GPIO_IN | GPIO_PF | 16)
304#define PC17_PF_SSI4_RXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 17)
305#define PC18_PF_SSI4_TXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 18)
306#define PC19_PF_SSI4_CLK (GPIO_PORTC | GPIO_IN | GPIO_PF | 19)
307#define PC20_PF_SSI1_FS (GPIO_PORTC | GPIO_IN | GPIO_PF | 20)
308#define PC21_PF_SSI1_RXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 21)
309#define PC22_PF_SSI1_TXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 22)
310#define PC23_PF_SSI1_CLK (GPIO_PORTC | GPIO_IN | GPIO_PF | 23)
311#define PC24_PF_SSI2_FS (GPIO_PORTC | GPIO_IN | GPIO_PF | 24)
312#define PC25_PF_SSI2_RXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 25)
313#define PC26_PF_SSI2_TXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 26)
314#define PC27_PF_SSI2_CLK (GPIO_PORTC | GPIO_IN | GPIO_PF | 27)
315#define PC28_PF_SSI3_FS (GPIO_PORTC | GPIO_IN | GPIO_PF | 28)
316#define PC29_PF_SSI3_RXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 29)
317#define PC30_PF_SSI3_TXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 30)
318#define PC31_PF_SSI3_CLK (GPIO_PORTC | GPIO_IN | GPIO_PF | 31)
319#define PD0_AIN_FEC_TXD0 (GPIO_PORTD | GPIO_OUT | GPIO_AIN | 0)
320#define PD1_AIN_FEC_TXD1 (GPIO_PORTD | GPIO_OUT | GPIO_AIN | 1)
321#define PD2_AIN_FEC_TXD2 (GPIO_PORTD | GPIO_OUT | GPIO_AIN | 2)
322#define PD3_AIN_FEC_TXD3 (GPIO_PORTD | GPIO_OUT | GPIO_AIN | 3)
323#define PD4_AOUT_FEC_RX_ER (GPIO_PORTD | GPIO_IN | GPIO_AOUT | 4)
324#define PD5_AOUT_FEC_RXD1 (GPIO_PORTD | GPIO_IN | GPIO_AOUT | 5)
325#define PD6_AOUT_FEC_RXD2 (GPIO_PORTD | GPIO_IN | GPIO_AOUT | 6)
326#define PD7_AOUT_FEC_RXD3 (GPIO_PORTD | GPIO_IN | GPIO_AOUT | 7)
327#define PD8_AF_FEC_MDIO (GPIO_PORTD | GPIO_IN | GPIO_AF | 8)
328#define PD9_AIN_FEC_MDC (GPIO_PORTD | GPIO_OUT | GPIO_AIN | 9)
329#define PD10_AOUT_FEC_CRS (GPIO_PORTD | GPIO_IN | GPIO_AOUT | 10)
330#define PD11_AOUT_FEC_TX_CLK (GPIO_PORTD | GPIO_IN | GPIO_AOUT | 11)
331#define PD12_AOUT_FEC_RXD0 (GPIO_PORTD | GPIO_IN | GPIO_AOUT | 12)
332#define PD13_AOUT_FEC_RX_DV (GPIO_PORTD | GPIO_IN | GPIO_AOUT | 13)
333#define PD14_AOUT_FEC_CLR (GPIO_PORTD | GPIO_IN | GPIO_AOUT | 14)
334#define PD15_AOUT_FEC_COL (GPIO_PORTD | GPIO_IN | GPIO_AOUT | 15)
335#define PD16_AIN_FEC_TX_ER (GPIO_PORTD | GPIO_OUT | GPIO_AIN | 16)
336#define PD17_PF_I2C_DATA (GPIO_PORTD | GPIO_OUT | GPIO_PF | 17)
337#define PD18_PF_I2C_CLK (GPIO_PORTD | GPIO_OUT | GPIO_PF | 18)
338#define PD25_PF_CSPI1_RDY (GPIO_PORTD | GPIO_OUT | GPIO_PF | 25)
339#define PD26_PF_CSPI1_SS2 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 26)
340#define PD27_PF_CSPI1_SS1 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 27)
341#define PD28_PF_CSPI1_SS0 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 28)
342#define PD29_PF_CSPI1_SCLK (GPIO_PORTD | GPIO_OUT | GPIO_PF | 29)
343#define PD30_PF_CSPI1_MISO (GPIO_PORTD | GPIO_IN | GPIO_PF | 30)
344#define PD31_PF_CSPI1_MOSI (GPIO_PORTD | GPIO_OUT | GPIO_PF | 31)
345#define PF23_AIN_FEC_TX_EN (GPIO_PORTF | GPIO_OUT | GPIO_AIN | 23)
346#define PE3_PF_UART2_CTS (GPIO_PORTE | GPIO_OUT | GPIO_PF | 3)
347#define PE4_PF_UART2_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 4)
348#define PE6_PF_UART2_TXD (GPIO_PORTE | GPIO_OUT | GPIO_PF | 6)
349#define PE7_PF_UART2_RXD (GPIO_PORTE | GPIO_IN | GPIO_PF | 7)
350#define PE8_PF_UART3_TXD (GPIO_PORTE | GPIO_OUT | GPIO_PF | 8)
351#define PE9_PF_UART3_RXD (GPIO_PORTE | GPIO_IN | GPIO_PF | 9)
352#define PE10_PF_UART3_CTS (GPIO_PORTE | GPIO_OUT | GPIO_PF | 10)
353#define PE11_PF_UART3_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 11)
354#define PE12_PF_UART1_TXD (GPIO_PORTE | GPIO_OUT | GPIO_PF | 12)
355#define PE13_PF_UART1_RXD (GPIO_PORTE | GPIO_IN | GPIO_PF | 13)
356#define PE14_PF_UART1_CTS (GPIO_PORTE | GPIO_OUT | GPIO_PF | 14)
357#define PE15_PF_UART1_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 15)
358#define PE18_AF_CSPI3_MISO (GPIO_PORTE | GPIO_IN | GPIO_AF | 18)
359#define PE21_AF_CSPI3_SS (GPIO_PORTE | GPIO_OUT | GPIO_AF | 21)
360#define PE22_AF_CSPI3_MOSI (GPIO_PORTE | GPIO_OUT | GPIO_AF | 22)
361#define PE23_AF_CSPI3_SCLK (GPIO_PORTE | GPIO_OUT | GPIO_AF | 23)
362#endif
363
364/* decode irq number to use with IMR(x), ISR(x) and friends */
365#define IRQ_TO_REG(irq) ((irq - MXC_MAX_INT_LINES) >> 5)
366
367#define IRQ_GPIOA(x) (MXC_MAX_INT_LINES + x)
368#define IRQ_GPIOB(x) (IRQ_GPIOA(32) + x)
369#define IRQ_GPIOC(x) (IRQ_GPIOB(32) + x)
370#define IRQ_GPIOD(x) (IRQ_GPIOC(32) + x)
371
372#endif /* _MXC_GPIO_MX1_MX2_H */
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx3.h b/arch/arm/plat-mxc/include/mach/iomux-mx3.h
new file mode 100644
index 000000000000..7509e7692f08
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx3.h
@@ -0,0 +1,501 @@
1/*
2 * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2008 by Sascha Hauer <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#ifndef __MACH_MX31_IOMUX_H__
21#define __MACH_MX31_IOMUX_H__
22
23#include <linux/types.h>
24
25/*
26 * various IOMUX output functions
27 */
28
29#define IOMUX_OCONFIG_GPIO (0 << 4) /* used as GPIO */
30#define IOMUX_OCONFIG_FUNC (1 << 4) /* used as function */
31#define IOMUX_OCONFIG_ALT1 (2 << 4) /* used as alternate function 1 */
32#define IOMUX_OCONFIG_ALT2 (3 << 4) /* used as alternate function 2 */
33#define IOMUX_OCONFIG_ALT3 (4 << 4) /* used as alternate function 3 */
34#define IOMUX_OCONFIG_ALT4 (5 << 4) /* used as alternate function 4 */
35#define IOMUX_OCONFIG_ALT5 (6 << 4) /* used as alternate function 5 */
36#define IOMUX_OCONFIG_ALT6 (7 << 4) /* used as alternate function 6 */
37#define IOMUX_ICONFIG_NONE 0 /* not configured for input */
38#define IOMUX_ICONFIG_GPIO 1 /* used as GPIO */
39#define IOMUX_ICONFIG_FUNC 2 /* used as function */
40#define IOMUX_ICONFIG_ALT1 4 /* used as alternate function 1 */
41#define IOMUX_ICONFIG_ALT2 8 /* used as alternate function 2 */
42
43#define IOMUX_CONFIG_GPIO (IOMUX_OCONFIG_GPIO | IOMUX_ICONFIG_GPIO)
44#define IOMUX_CONFIG_FUNC (IOMUX_OCONFIG_FUNC | IOMUX_ICONFIG_FUNC)
45#define IOMUX_CONFIG_ALT1 (IOMUX_OCONFIG_ALT1 | IOMUX_ICONFIG_ALT1)
46#define IOMUX_CONFIG_ALT2 (IOMUX_OCONFIG_ALT2 | IOMUX_ICONFIG_ALT2)
47
48/*
49 * various IOMUX pad functions
50 */
51enum iomux_pad_config {
52 PAD_CTL_NOLOOPBACK = 0x0 << 9,
53 PAD_CTL_LOOPBACK = 0x1 << 9,
54 PAD_CTL_PKE_NONE = 0x0 << 8,
55 PAD_CTL_PKE_ENABLE = 0x1 << 8,
56 PAD_CTL_PUE_KEEPER = 0x0 << 7,
57 PAD_CTL_PUE_PUD = 0x1 << 7,
58 PAD_CTL_100K_PD = 0x0 << 5,
59 PAD_CTL_100K_PU = 0x1 << 5,
60 PAD_CTL_47K_PU = 0x2 << 5,
61 PAD_CTL_22K_PU = 0x3 << 5,
62 PAD_CTL_HYS_CMOS = 0x0 << 4,
63 PAD_CTL_HYS_SCHMITZ = 0x1 << 4,
64 PAD_CTL_ODE_CMOS = 0x0 << 3,
65 PAD_CTL_ODE_OpenDrain = 0x1 << 3,
66 PAD_CTL_DRV_NORMAL = 0x0 << 1,
67 PAD_CTL_DRV_HIGH = 0x1 << 1,
68 PAD_CTL_DRV_MAX = 0x2 << 1,
69 PAD_CTL_SRE_SLOW = 0x0 << 0,
70 PAD_CTL_SRE_FAST = 0x1 << 0
71};
72
73/*
74 * various IOMUX general purpose functions
75 */
76enum iomux_gp_func {
77 MUX_PGP_FIRI = 1 << 0,
78 MUX_DDR_MODE = 1 << 1,
79 MUX_PGP_CSPI_BB = 1 << 2,
80 MUX_PGP_ATA_1 = 1 << 3,
81 MUX_PGP_ATA_2 = 1 << 4,
82 MUX_PGP_ATA_3 = 1 << 5,
83 MUX_PGP_ATA_4 = 1 << 6,
84 MUX_PGP_ATA_5 = 1 << 7,
85 MUX_PGP_ATA_6 = 1 << 8,
86 MUX_PGP_ATA_7 = 1 << 9,
87 MUX_PGP_ATA_8 = 1 << 10,
88 MUX_PGP_UH2 = 1 << 11,
89 MUX_SDCTL_CSD0_SEL = 1 << 12,
90 MUX_SDCTL_CSD1_SEL = 1 << 13,
91 MUX_CSPI1_UART3 = 1 << 14,
92 MUX_EXTDMAREQ2_MBX_SEL = 1 << 15,
93 MUX_TAMPER_DETECT_EN = 1 << 16,
94 MUX_PGP_USB_4WIRE = 1 << 17,
95 MUX_PGB_USB_COMMON = 1 << 18,
96 MUX_SDHC_MEMSTICK1 = 1 << 19,
97 MUX_SDHC_MEMSTICK2 = 1 << 20,
98 MUX_PGP_SPLL_BYP = 1 << 21,
99 MUX_PGP_UPLL_BYP = 1 << 22,
100 MUX_PGP_MSHC1_CLK_SEL = 1 << 23,
101 MUX_PGP_MSHC2_CLK_SEL = 1 << 24,
102 MUX_CSPI3_UART5_SEL = 1 << 25,
103 MUX_PGP_ATA_9 = 1 << 26,
104 MUX_PGP_USB_SUSPEND = 1 << 27,
105 MUX_PGP_USB_OTG_LOOPBACK = 1 << 28,
106 MUX_PGP_USB_HS1_LOOPBACK = 1 << 29,
107 MUX_PGP_USB_HS2_LOOPBACK = 1 << 30,
108 MUX_CLKO_DDR_MODE = 1 << 31,
109};
110
111/*
112 * This function enables/disables the general purpose function for a particular
113 * signal.
114 */
115void iomux_config_gpr(enum iomux_gp_func , bool);
116
117/*
118 * set the mode for a IOMUX pin.
119 */
120int mxc_iomux_mode(unsigned int);
121
122/*
123 * This function enables/disables the general purpose function for a particular
124 * signal.
125 */
126void mxc_iomux_set_gpr(enum iomux_gp_func, bool);
127
128#define IOMUX_PADNUM_MASK 0x1ff
129#define IOMUX_GPIONUM_SHIFT 9
130#define IOMUX_GPIONUM_MASK (0xff << IOMUX_GPIONUM_SHIFT)
131#define IOMUX_MODE_SHIFT 17
132#define IOMUX_MODE_MASK (0xff << IOMUX_MODE_SHIFT)
133
134#define IOMUX_PIN(gpionum, padnum) \
135 (((gpionum << IOMUX_GPIONUM_SHIFT) & IOMUX_GPIONUM_MASK) | \
136 (padnum & IOMUX_PADNUM_MASK))
137
138#define IOMUX_MODE(pin, mode) (pin | mode << IOMUX_MODE_SHIFT)
139
140#define IOMUX_TO_GPIO(iomux_pin) \
141 ((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT)
142#define IOMUX_TO_IRQ(iomux_pin) \
143 (((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT) + \
144 MXC_GPIO_INT_BASE)
145
146/*
147 * This enumeration is constructed based on the Section
148 * "sw_pad_ctl & sw_mux_ctl details" of the MX31 IC Spec. Each enumerated
149 * value is constructed based on the rules described above.
150 */
151
152enum iomux_pins {
153 MX31_PIN_TTM_PAD = IOMUX_PIN(0xff, 0),
154 MX31_PIN_CSPI3_SPI_RDY = IOMUX_PIN(0xff, 1),
155 MX31_PIN_CSPI3_SCLK = IOMUX_PIN(0xff, 2),
156 MX31_PIN_CSPI3_MISO = IOMUX_PIN(0xff, 3),
157 MX31_PIN_CSPI3_MOSI = IOMUX_PIN(0xff, 4),
158 MX31_PIN_CLKSS = IOMUX_PIN(0xff, 5),
159 MX31_PIN_CE_CONTROL = IOMUX_PIN(0xff, 6),
160 MX31_PIN_ATA_RESET_B = IOMUX_PIN(95, 7),
161 MX31_PIN_ATA_DMACK = IOMUX_PIN(94, 8),
162 MX31_PIN_ATA_DIOW = IOMUX_PIN(93, 9),
163 MX31_PIN_ATA_DIOR = IOMUX_PIN(92, 10),
164 MX31_PIN_ATA_CS1 = IOMUX_PIN(91, 11),
165 MX31_PIN_ATA_CS0 = IOMUX_PIN(90, 12),
166 MX31_PIN_SD1_DATA3 = IOMUX_PIN(63, 13),
167 MX31_PIN_SD1_DATA2 = IOMUX_PIN(62, 14),
168 MX31_PIN_SD1_DATA1 = IOMUX_PIN(61, 15),
169 MX31_PIN_SD1_DATA0 = IOMUX_PIN(60, 16),
170 MX31_PIN_SD1_CLK = IOMUX_PIN(59, 17),
171 MX31_PIN_SD1_CMD = IOMUX_PIN(58, 18),
172 MX31_PIN_D3_SPL = IOMUX_PIN(0xff, 19),
173 MX31_PIN_D3_CLS = IOMUX_PIN(0xff, 20),
174 MX31_PIN_D3_REV = IOMUX_PIN(0xff, 21),
175 MX31_PIN_CONTRAST = IOMUX_PIN(0xff, 22),
176 MX31_PIN_VSYNC3 = IOMUX_PIN(0xff, 23),
177 MX31_PIN_READ = IOMUX_PIN(0xff, 24),
178 MX31_PIN_WRITE = IOMUX_PIN(0xff, 25),
179 MX31_PIN_PAR_RS = IOMUX_PIN(0xff, 26),
180 MX31_PIN_SER_RS = IOMUX_PIN(89, 27),
181 MX31_PIN_LCS1 = IOMUX_PIN(88, 28),
182 MX31_PIN_LCS0 = IOMUX_PIN(87, 29),
183 MX31_PIN_SD_D_CLK = IOMUX_PIN(86, 30),
184 MX31_PIN_SD_D_IO = IOMUX_PIN(85, 31),
185 MX31_PIN_SD_D_I = IOMUX_PIN(84, 32),
186 MX31_PIN_DRDY0 = IOMUX_PIN(0xff, 33),
187 MX31_PIN_FPSHIFT = IOMUX_PIN(0xff, 34),
188 MX31_PIN_HSYNC = IOMUX_PIN(0xff, 35),
189 MX31_PIN_VSYNC0 = IOMUX_PIN(0xff, 36),
190 MX31_PIN_LD17 = IOMUX_PIN(0xff, 37),
191 MX31_PIN_LD16 = IOMUX_PIN(0xff, 38),
192 MX31_PIN_LD15 = IOMUX_PIN(0xff, 39),
193 MX31_PIN_LD14 = IOMUX_PIN(0xff, 40),
194 MX31_PIN_LD13 = IOMUX_PIN(0xff, 41),
195 MX31_PIN_LD12 = IOMUX_PIN(0xff, 42),
196 MX31_PIN_LD11 = IOMUX_PIN(0xff, 43),
197 MX31_PIN_LD10 = IOMUX_PIN(0xff, 44),
198 MX31_PIN_LD9 = IOMUX_PIN(0xff, 45),
199 MX31_PIN_LD8 = IOMUX_PIN(0xff, 46),
200 MX31_PIN_LD7 = IOMUX_PIN(0xff, 47),
201 MX31_PIN_LD6 = IOMUX_PIN(0xff, 48),
202 MX31_PIN_LD5 = IOMUX_PIN(0xff, 49),
203 MX31_PIN_LD4 = IOMUX_PIN(0xff, 50),
204 MX31_PIN_LD3 = IOMUX_PIN(0xff, 51),
205 MX31_PIN_LD2 = IOMUX_PIN(0xff, 52),
206 MX31_PIN_LD1 = IOMUX_PIN(0xff, 53),
207 MX31_PIN_LD0 = IOMUX_PIN(0xff, 54),
208 MX31_PIN_USBH2_DATA1 = IOMUX_PIN(0xff, 55),
209 MX31_PIN_USBH2_DATA0 = IOMUX_PIN(0xff, 56),
210 MX31_PIN_USBH2_NXT = IOMUX_PIN(0xff, 57),
211 MX31_PIN_USBH2_STP = IOMUX_PIN(0xff, 58),
212 MX31_PIN_USBH2_DIR = IOMUX_PIN(0xff, 59),
213 MX31_PIN_USBH2_CLK = IOMUX_PIN(0xff, 60),
214 MX31_PIN_USBOTG_DATA7 = IOMUX_PIN(0xff, 61),
215 MX31_PIN_USBOTG_DATA6 = IOMUX_PIN(0xff, 62),
216 MX31_PIN_USBOTG_DATA5 = IOMUX_PIN(0xff, 63),
217 MX31_PIN_USBOTG_DATA4 = IOMUX_PIN(0xff, 64),
218 MX31_PIN_USBOTG_DATA3 = IOMUX_PIN(0xff, 65),
219 MX31_PIN_USBOTG_DATA2 = IOMUX_PIN(0xff, 66),
220 MX31_PIN_USBOTG_DATA1 = IOMUX_PIN(0xff, 67),
221 MX31_PIN_USBOTG_DATA0 = IOMUX_PIN(0xff, 68),
222 MX31_PIN_USBOTG_NXT = IOMUX_PIN(0xff, 69),
223 MX31_PIN_USBOTG_STP = IOMUX_PIN(0xff, 70),
224 MX31_PIN_USBOTG_DIR = IOMUX_PIN(0xff, 71),
225 MX31_PIN_USBOTG_CLK = IOMUX_PIN(0xff, 72),
226 MX31_PIN_USB_BYP = IOMUX_PIN(31, 73),
227 MX31_PIN_USB_OC = IOMUX_PIN(30, 74),
228 MX31_PIN_USB_PWR = IOMUX_PIN(29, 75),
229 MX31_PIN_SJC_MOD = IOMUX_PIN(0xff, 76),
230 MX31_PIN_DE_B = IOMUX_PIN(0xff, 77),
231 MX31_PIN_TRSTB = IOMUX_PIN(0xff, 78),
232 MX31_PIN_TDO = IOMUX_PIN(0xff, 79),
233 MX31_PIN_TDI = IOMUX_PIN(0xff, 80),
234 MX31_PIN_TMS = IOMUX_PIN(0xff, 81),
235 MX31_PIN_TCK = IOMUX_PIN(0xff, 82),
236 MX31_PIN_RTCK = IOMUX_PIN(0xff, 83),
237 MX31_PIN_KEY_COL7 = IOMUX_PIN(57, 84),
238 MX31_PIN_KEY_COL6 = IOMUX_PIN(56, 85),
239 MX31_PIN_KEY_COL5 = IOMUX_PIN(55, 86),
240 MX31_PIN_KEY_COL4 = IOMUX_PIN(54, 87),
241 MX31_PIN_KEY_COL3 = IOMUX_PIN(0xff, 88),
242 MX31_PIN_KEY_COL2 = IOMUX_PIN(0xff, 89),
243 MX31_PIN_KEY_COL1 = IOMUX_PIN(0xff, 90),
244 MX31_PIN_KEY_COL0 = IOMUX_PIN(0xff, 91),
245 MX31_PIN_KEY_ROW7 = IOMUX_PIN(53, 92),
246 MX31_PIN_KEY_ROW6 = IOMUX_PIN(52, 93),
247 MX31_PIN_KEY_ROW5 = IOMUX_PIN(51, 94),
248 MX31_PIN_KEY_ROW4 = IOMUX_PIN(50, 95),
249 MX31_PIN_KEY_ROW3 = IOMUX_PIN(0xff, 96),
250 MX31_PIN_KEY_ROW2 = IOMUX_PIN(0xff, 97),
251 MX31_PIN_KEY_ROW1 = IOMUX_PIN(0xff, 98),
252 MX31_PIN_KEY_ROW0 = IOMUX_PIN(0xff, 99),
253 MX31_PIN_BATT_LINE = IOMUX_PIN(49, 100),
254 MX31_PIN_CTS2 = IOMUX_PIN(0xff, 101),
255 MX31_PIN_RTS2 = IOMUX_PIN(0xff, 102),
256 MX31_PIN_TXD2 = IOMUX_PIN(28, 103),
257 MX31_PIN_RXD2 = IOMUX_PIN(27, 104),
258 MX31_PIN_DTR_DCE2 = IOMUX_PIN(48, 105),
259 MX31_PIN_DCD_DTE1 = IOMUX_PIN(47, 106),
260 MX31_PIN_RI_DTE1 = IOMUX_PIN(46, 107),
261 MX31_PIN_DSR_DTE1 = IOMUX_PIN(45, 108),
262 MX31_PIN_DTR_DTE1 = IOMUX_PIN(44, 109),
263 MX31_PIN_DCD_DCE1 = IOMUX_PIN(43, 110),
264 MX31_PIN_RI_DCE1 = IOMUX_PIN(42, 111),
265 MX31_PIN_DSR_DCE1 = IOMUX_PIN(41, 112),
266 MX31_PIN_DTR_DCE1 = IOMUX_PIN(40, 113),
267 MX31_PIN_CTS1 = IOMUX_PIN(39, 114),
268 MX31_PIN_RTS1 = IOMUX_PIN(38, 115),
269 MX31_PIN_TXD1 = IOMUX_PIN(37, 116),
270 MX31_PIN_RXD1 = IOMUX_PIN(36, 117),
271 MX31_PIN_CSPI2_SPI_RDY = IOMUX_PIN(0xff, 118),
272 MX31_PIN_CSPI2_SCLK = IOMUX_PIN(0xff, 119),
273 MX31_PIN_CSPI2_SS2 = IOMUX_PIN(0xff, 120),
274 MX31_PIN_CSPI2_SS1 = IOMUX_PIN(0xff, 121),
275 MX31_PIN_CSPI2_SS0 = IOMUX_PIN(0xff, 122),
276 MX31_PIN_CSPI2_MISO = IOMUX_PIN(0xff, 123),
277 MX31_PIN_CSPI2_MOSI = IOMUX_PIN(0xff, 124),
278 MX31_PIN_CSPI1_SPI_RDY = IOMUX_PIN(0xff, 125),
279 MX31_PIN_CSPI1_SCLK = IOMUX_PIN(0xff, 126),
280 MX31_PIN_CSPI1_SS2 = IOMUX_PIN(0xff, 127),
281 MX31_PIN_CSPI1_SS1 = IOMUX_PIN(0xff, 128),
282 MX31_PIN_CSPI1_SS0 = IOMUX_PIN(0xff, 129),
283 MX31_PIN_CSPI1_MISO = IOMUX_PIN(0xff, 130),
284 MX31_PIN_CSPI1_MOSI = IOMUX_PIN(0xff, 131),
285 MX31_PIN_SFS6 = IOMUX_PIN(26, 132),
286 MX31_PIN_SCK6 = IOMUX_PIN(25, 133),
287 MX31_PIN_SRXD6 = IOMUX_PIN(24, 134),
288 MX31_PIN_STXD6 = IOMUX_PIN(23, 135),
289 MX31_PIN_SFS5 = IOMUX_PIN(0xff, 136),
290 MX31_PIN_SCK5 = IOMUX_PIN(0xff, 137),
291 MX31_PIN_SRXD5 = IOMUX_PIN(22, 138),
292 MX31_PIN_STXD5 = IOMUX_PIN(21, 139),
293 MX31_PIN_SFS4 = IOMUX_PIN(0xff, 140),
294 MX31_PIN_SCK4 = IOMUX_PIN(0xff, 141),
295 MX31_PIN_SRXD4 = IOMUX_PIN(20, 142),
296 MX31_PIN_STXD4 = IOMUX_PIN(19, 143),
297 MX31_PIN_SFS3 = IOMUX_PIN(0xff, 144),
298 MX31_PIN_SCK3 = IOMUX_PIN(0xff, 145),
299 MX31_PIN_SRXD3 = IOMUX_PIN(18, 146),
300 MX31_PIN_STXD3 = IOMUX_PIN(17, 147),
301 MX31_PIN_I2C_DAT = IOMUX_PIN(0xff, 148),
302 MX31_PIN_I2C_CLK = IOMUX_PIN(0xff, 149),
303 MX31_PIN_CSI_PIXCLK = IOMUX_PIN(83, 150),
304 MX31_PIN_CSI_HSYNC = IOMUX_PIN(82, 151),
305 MX31_PIN_CSI_VSYNC = IOMUX_PIN(81, 152),
306 MX31_PIN_CSI_MCLK = IOMUX_PIN(80, 153),
307 MX31_PIN_CSI_D15 = IOMUX_PIN(79, 154),
308 MX31_PIN_CSI_D14 = IOMUX_PIN(78, 155),
309 MX31_PIN_CSI_D13 = IOMUX_PIN(77, 156),
310 MX31_PIN_CSI_D12 = IOMUX_PIN(76, 157),
311 MX31_PIN_CSI_D11 = IOMUX_PIN(75, 158),
312 MX31_PIN_CSI_D10 = IOMUX_PIN(74, 159),
313 MX31_PIN_CSI_D9 = IOMUX_PIN(73, 160),
314 MX31_PIN_CSI_D8 = IOMUX_PIN(72, 161),
315 MX31_PIN_CSI_D7 = IOMUX_PIN(71, 162),
316 MX31_PIN_CSI_D6 = IOMUX_PIN(70, 163),
317 MX31_PIN_CSI_D5 = IOMUX_PIN(69, 164),
318 MX31_PIN_CSI_D4 = IOMUX_PIN(68, 165),
319 MX31_PIN_M_GRANT = IOMUX_PIN(0xff, 166),
320 MX31_PIN_M_REQUEST = IOMUX_PIN(0xff, 167),
321 MX31_PIN_PC_POE = IOMUX_PIN(0xff, 168),
322 MX31_PIN_PC_RW_B = IOMUX_PIN(0xff, 169),
323 MX31_PIN_IOIS16 = IOMUX_PIN(0xff, 170),
324 MX31_PIN_PC_RST = IOMUX_PIN(0xff, 171),
325 MX31_PIN_PC_BVD2 = IOMUX_PIN(0xff, 172),
326 MX31_PIN_PC_BVD1 = IOMUX_PIN(0xff, 173),
327 MX31_PIN_PC_VS2 = IOMUX_PIN(0xff, 174),
328 MX31_PIN_PC_VS1 = IOMUX_PIN(0xff, 175),
329 MX31_PIN_PC_PWRON = IOMUX_PIN(0xff, 176),
330 MX31_PIN_PC_READY = IOMUX_PIN(0xff, 177),
331 MX31_PIN_PC_WAIT_B = IOMUX_PIN(0xff, 178),
332 MX31_PIN_PC_CD2_B = IOMUX_PIN(0xff, 179),
333 MX31_PIN_PC_CD1_B = IOMUX_PIN(0xff, 180),
334 MX31_PIN_D0 = IOMUX_PIN(0xff, 181),
335 MX31_PIN_D1 = IOMUX_PIN(0xff, 182),
336 MX31_PIN_D2 = IOMUX_PIN(0xff, 183),
337 MX31_PIN_D3 = IOMUX_PIN(0xff, 184),
338 MX31_PIN_D4 = IOMUX_PIN(0xff, 185),
339 MX31_PIN_D5 = IOMUX_PIN(0xff, 186),
340 MX31_PIN_D6 = IOMUX_PIN(0xff, 187),
341 MX31_PIN_D7 = IOMUX_PIN(0xff, 188),
342 MX31_PIN_D8 = IOMUX_PIN(0xff, 189),
343 MX31_PIN_D9 = IOMUX_PIN(0xff, 190),
344 MX31_PIN_D10 = IOMUX_PIN(0xff, 191),
345 MX31_PIN_D11 = IOMUX_PIN(0xff, 192),
346 MX31_PIN_D12 = IOMUX_PIN(0xff, 193),
347 MX31_PIN_D13 = IOMUX_PIN(0xff, 194),
348 MX31_PIN_D14 = IOMUX_PIN(0xff, 195),
349 MX31_PIN_D15 = IOMUX_PIN(0xff, 196),
350 MX31_PIN_NFRB = IOMUX_PIN(16, 197),
351 MX31_PIN_NFCE_B = IOMUX_PIN(15, 198),
352 MX31_PIN_NFWP_B = IOMUX_PIN(14, 199),
353 MX31_PIN_NFCLE = IOMUX_PIN(13, 200),
354 MX31_PIN_NFALE = IOMUX_PIN(12, 201),
355 MX31_PIN_NFRE_B = IOMUX_PIN(11, 202),
356 MX31_PIN_NFWE_B = IOMUX_PIN(10, 203),
357 MX31_PIN_SDQS3 = IOMUX_PIN(0xff, 204),
358 MX31_PIN_SDQS2 = IOMUX_PIN(0xff, 205),
359 MX31_PIN_SDQS1 = IOMUX_PIN(0xff, 206),
360 MX31_PIN_SDQS0 = IOMUX_PIN(0xff, 207),
361 MX31_PIN_SDCLK_B = IOMUX_PIN(0xff, 208),
362 MX31_PIN_SDCLK = IOMUX_PIN(0xff, 209),
363 MX31_PIN_SDCKE1 = IOMUX_PIN(0xff, 210),
364 MX31_PIN_SDCKE0 = IOMUX_PIN(0xff, 211),
365 MX31_PIN_SDWE = IOMUX_PIN(0xff, 212),
366 MX31_PIN_CAS = IOMUX_PIN(0xff, 213),
367 MX31_PIN_RAS = IOMUX_PIN(0xff, 214),
368 MX31_PIN_RW = IOMUX_PIN(0xff, 215),
369 MX31_PIN_BCLK = IOMUX_PIN(0xff, 216),
370 MX31_PIN_LBA = IOMUX_PIN(0xff, 217),
371 MX31_PIN_ECB = IOMUX_PIN(0xff, 218),
372 MX31_PIN_CS5 = IOMUX_PIN(0xff, 219),
373 MX31_PIN_CS4 = IOMUX_PIN(0xff, 220),
374 MX31_PIN_CS3 = IOMUX_PIN(0xff, 221),
375 MX31_PIN_CS2 = IOMUX_PIN(0xff, 222),
376 MX31_PIN_CS1 = IOMUX_PIN(0xff, 223),
377 MX31_PIN_CS0 = IOMUX_PIN(0xff, 224),
378 MX31_PIN_OE = IOMUX_PIN(0xff, 225),
379 MX31_PIN_EB1 = IOMUX_PIN(0xff, 226),
380 MX31_PIN_EB0 = IOMUX_PIN(0xff, 227),
381 MX31_PIN_DQM3 = IOMUX_PIN(0xff, 228),
382 MX31_PIN_DQM2 = IOMUX_PIN(0xff, 229),
383 MX31_PIN_DQM1 = IOMUX_PIN(0xff, 230),
384 MX31_PIN_DQM0 = IOMUX_PIN(0xff, 231),
385 MX31_PIN_SD31 = IOMUX_PIN(0xff, 232),
386 MX31_PIN_SD30 = IOMUX_PIN(0xff, 233),
387 MX31_PIN_SD29 = IOMUX_PIN(0xff, 234),
388 MX31_PIN_SD28 = IOMUX_PIN(0xff, 235),
389 MX31_PIN_SD27 = IOMUX_PIN(0xff, 236),
390 MX31_PIN_SD26 = IOMUX_PIN(0xff, 237),
391 MX31_PIN_SD25 = IOMUX_PIN(0xff, 238),
392 MX31_PIN_SD24 = IOMUX_PIN(0xff, 239),
393 MX31_PIN_SD23 = IOMUX_PIN(0xff, 240),
394 MX31_PIN_SD22 = IOMUX_PIN(0xff, 241),
395 MX31_PIN_SD21 = IOMUX_PIN(0xff, 242),
396 MX31_PIN_SD20 = IOMUX_PIN(0xff, 243),
397 MX31_PIN_SD19 = IOMUX_PIN(0xff, 244),
398 MX31_PIN_SD18 = IOMUX_PIN(0xff, 245),
399 MX31_PIN_SD17 = IOMUX_PIN(0xff, 246),
400 MX31_PIN_SD16 = IOMUX_PIN(0xff, 247),
401 MX31_PIN_SD15 = IOMUX_PIN(0xff, 248),
402 MX31_PIN_SD14 = IOMUX_PIN(0xff, 249),
403 MX31_PIN_SD13 = IOMUX_PIN(0xff, 250),
404 MX31_PIN_SD12 = IOMUX_PIN(0xff, 251),
405 MX31_PIN_SD11 = IOMUX_PIN(0xff, 252),
406 MX31_PIN_SD10 = IOMUX_PIN(0xff, 253),
407 MX31_PIN_SD9 = IOMUX_PIN(0xff, 254),
408 MX31_PIN_SD8 = IOMUX_PIN(0xff, 255),
409 MX31_PIN_SD7 = IOMUX_PIN(0xff, 256),
410 MX31_PIN_SD6 = IOMUX_PIN(0xff, 257),
411 MX31_PIN_SD5 = IOMUX_PIN(0xff, 258),
412 MX31_PIN_SD4 = IOMUX_PIN(0xff, 259),
413 MX31_PIN_SD3 = IOMUX_PIN(0xff, 260),
414 MX31_PIN_SD2 = IOMUX_PIN(0xff, 261),
415 MX31_PIN_SD1 = IOMUX_PIN(0xff, 262),
416 MX31_PIN_SD0 = IOMUX_PIN(0xff, 263),
417 MX31_PIN_SDBA0 = IOMUX_PIN(0xff, 264),
418 MX31_PIN_SDBA1 = IOMUX_PIN(0xff, 265),
419 MX31_PIN_A25 = IOMUX_PIN(0xff, 266),
420 MX31_PIN_A24 = IOMUX_PIN(0xff, 267),
421 MX31_PIN_A23 = IOMUX_PIN(0xff, 268),
422 MX31_PIN_A22 = IOMUX_PIN(0xff, 269),
423 MX31_PIN_A21 = IOMUX_PIN(0xff, 270),
424 MX31_PIN_A20 = IOMUX_PIN(0xff, 271),
425 MX31_PIN_A19 = IOMUX_PIN(0xff, 272),
426 MX31_PIN_A18 = IOMUX_PIN(0xff, 273),
427 MX31_PIN_A17 = IOMUX_PIN(0xff, 274),
428 MX31_PIN_A16 = IOMUX_PIN(0xff, 275),
429 MX31_PIN_A14 = IOMUX_PIN(0xff, 276),
430 MX31_PIN_A15 = IOMUX_PIN(0xff, 277),
431 MX31_PIN_A13 = IOMUX_PIN(0xff, 278),
432 MX31_PIN_A12 = IOMUX_PIN(0xff, 279),
433 MX31_PIN_A11 = IOMUX_PIN(0xff, 280),
434 MX31_PIN_MA10 = IOMUX_PIN(0xff, 281),
435 MX31_PIN_A10 = IOMUX_PIN(0xff, 282),
436 MX31_PIN_A9 = IOMUX_PIN(0xff, 283),
437 MX31_PIN_A8 = IOMUX_PIN(0xff, 284),
438 MX31_PIN_A7 = IOMUX_PIN(0xff, 285),
439 MX31_PIN_A6 = IOMUX_PIN(0xff, 286),
440 MX31_PIN_A5 = IOMUX_PIN(0xff, 287),
441 MX31_PIN_A4 = IOMUX_PIN(0xff, 288),
442 MX31_PIN_A3 = IOMUX_PIN(0xff, 289),
443 MX31_PIN_A2 = IOMUX_PIN(0xff, 290),
444 MX31_PIN_A1 = IOMUX_PIN(0xff, 291),
445 MX31_PIN_A0 = IOMUX_PIN(0xff, 292),
446 MX31_PIN_VPG1 = IOMUX_PIN(0xff, 293),
447 MX31_PIN_VPG0 = IOMUX_PIN(0xff, 294),
448 MX31_PIN_DVFS1 = IOMUX_PIN(0xff, 295),
449 MX31_PIN_DVFS0 = IOMUX_PIN(0xff, 296),
450 MX31_PIN_VSTBY = IOMUX_PIN(0xff, 297),
451 MX31_PIN_POWER_FAIL = IOMUX_PIN(0xff, 298),
452 MX31_PIN_CKIL = IOMUX_PIN(0xff, 299),
453 MX31_PIN_BOOT_MODE4 = IOMUX_PIN(0xff, 300),
454 MX31_PIN_BOOT_MODE3 = IOMUX_PIN(0xff, 301),
455 MX31_PIN_BOOT_MODE2 = IOMUX_PIN(0xff, 302),
456 MX31_PIN_BOOT_MODE1 = IOMUX_PIN(0xff, 303),
457 MX31_PIN_BOOT_MODE0 = IOMUX_PIN(0xff, 304),
458 MX31_PIN_CLKO = IOMUX_PIN(0xff, 305),
459 MX31_PIN_POR_B = IOMUX_PIN(0xff, 306),
460 MX31_PIN_RESET_IN_B = IOMUX_PIN(0xff, 307),
461 MX31_PIN_CKIH = IOMUX_PIN(0xff, 308),
462 MX31_PIN_SIMPD0 = IOMUX_PIN(35, 309),
463 MX31_PIN_SRX0 = IOMUX_PIN(34, 310),
464 MX31_PIN_STX0 = IOMUX_PIN(33, 311),
465 MX31_PIN_SVEN0 = IOMUX_PIN(32, 312),
466 MX31_PIN_SRST0 = IOMUX_PIN(67, 313),
467 MX31_PIN_SCLK0 = IOMUX_PIN(66, 314),
468 MX31_PIN_GPIO3_1 = IOMUX_PIN(65, 315),
469 MX31_PIN_GPIO3_0 = IOMUX_PIN(64, 316),
470 MX31_PIN_GPIO1_6 = IOMUX_PIN( 6, 317),
471 MX31_PIN_GPIO1_5 = IOMUX_PIN( 5, 318),
472 MX31_PIN_GPIO1_4 = IOMUX_PIN( 4, 319),
473 MX31_PIN_GPIO1_3 = IOMUX_PIN( 3, 320),
474 MX31_PIN_GPIO1_2 = IOMUX_PIN( 2, 321),
475 MX31_PIN_GPIO1_1 = IOMUX_PIN( 1, 322),
476 MX31_PIN_GPIO1_0 = IOMUX_PIN( 0, 323),
477 MX31_PIN_PWMO = IOMUX_PIN( 9, 324),
478 MX31_PIN_WATCHDOG_RST = IOMUX_PIN(0xff, 325),
479 MX31_PIN_COMPARE = IOMUX_PIN( 8, 326),
480 MX31_PIN_CAPTURE = IOMUX_PIN( 7, 327),
481};
482
483/*
484 * Convenience values for use with mxc_iomux_mode()
485 *
486 * Format here is MX31_PIN_(pin name)__(function)
487 */
488#define MX31_PIN_CSPI3_MOSI__RXD3 IOMUX_MODE(MX31_PIN_CSPI3_MOSI, IOMUX_CONFIG_ALT1)
489#define MX31_PIN_CSPI3_MISO__TXD3 IOMUX_MODE(MX31_PIN_CSPI3_MISO, IOMUX_CONFIG_ALT1)
490#define MX31_PIN_CTS1__CTS1 IOMUX_MODE(MX31_PIN_CTS1, IOMUX_CONFIG_FUNC)
491#define MX31_PIN_RTS1__RTS1 IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_FUNC)
492#define MX31_PIN_TXD1__TXD1 IOMUX_MODE(MX31_PIN_TXD1, IOMUX_CONFIG_FUNC)
493#define MX31_PIN_RXD1__RXD1 IOMUX_MODE(MX31_PIN_RXD1, IOMUX_CONFIG_FUNC)
494
495/*
496 * This function configures the pad value for a IOMUX pin.
497 */
498void mxc_iomux_set_pad(enum iomux_pins, u32);
499
500#endif
501
diff --git a/arch/arm/plat-mxc/include/mach/irqs.h b/arch/arm/plat-mxc/include/mach/irqs.h
new file mode 100644
index 000000000000..228c4f68ccdf
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/irqs.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright 2004-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_IRQS_H__
12#define __ASM_ARCH_MXC_IRQS_H__
13
14#include <mach/hardware.h>
15
16#endif /* __ASM_ARCH_MXC_IRQS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h
new file mode 100644
index 000000000000..d7a8d3ebed57
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/memory.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright 2004-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_MEMORY_H__
12#define __ASM_ARCH_MXC_MEMORY_H__
13
14#include <mach/hardware.h>
15
16/*
17 * Virtual view <-> DMA view memory address translations
18 * This macro is used to translate the virtual address to an address
19 * suitable to be passed to set_dma_addr()
20 */
21#define __virt_to_bus(a) __virt_to_phys(a)
22
23/*
24 * Used to convert an address for DMA operations to an address that the
25 * kernel can use.
26 */
27#define __bus_to_virt(a) __phys_to_virt(a)
28
29#endif /* __ASM_ARCH_MXC_MEMORY_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/plat-mxc/include/mach/mx27.h
new file mode 100644
index 000000000000..212ecc246626
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mx27.h
@@ -0,0 +1,302 @@
1/*
2 * Copyright 2004-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#ifndef __ASM_ARCH_MXC_MX27_H__
21#define __ASM_ARCH_MXC_MX27_H__
22
23#ifndef __ASM_ARCH_MXC_HARDWARE_H__
24#error "Do not include directly."
25#endif
26
27/* IRAM */
28#define IRAM_BASE_ADDR 0xFFFF4C00 /* internal ram */
29
30/* Register offests */
31#define AIPI_BASE_ADDR 0x10000000
32#define AIPI_BASE_ADDR_VIRT 0xF4000000
33#define AIPI_SIZE SZ_1M
34
35#define DMA_BASE_ADDR (AIPI_BASE_ADDR + 0x01000)
36#define WDOG_BASE_ADDR (AIPI_BASE_ADDR + 0x02000)
37#define GPT1_BASE_ADDR (AIPI_BASE_ADDR + 0x03000)
38#define GPT2_BASE_ADDR (AIPI_BASE_ADDR + 0x04000)
39#define GPT3_BASE_ADDR (AIPI_BASE_ADDR + 0x05000)
40#define PWM_BASE_ADDR (AIPI_BASE_ADDR + 0x06000)
41#define RTC_BASE_ADDR (AIPI_BASE_ADDR + 0x07000)
42#define KPP_BASE_ADDR (AIPI_BASE_ADDR + 0x08000)
43#define OWIRE_BASE_ADDR (AIPI_BASE_ADDR + 0x09000)
44#define UART1_BASE_ADDR (AIPI_BASE_ADDR + 0x0A000)
45#define UART2_BASE_ADDR (AIPI_BASE_ADDR + 0x0B000)
46#define UART3_BASE_ADDR (AIPI_BASE_ADDR + 0x0C000)
47#define UART4_BASE_ADDR (AIPI_BASE_ADDR + 0x0D000)
48#define CSPI1_BASE_ADDR (AIPI_BASE_ADDR + 0x0E000)
49#define CSPI2_BASE_ADDR (AIPI_BASE_ADDR + 0x0F000)
50#define SSI1_BASE_ADDR (AIPI_BASE_ADDR + 0x10000)
51#define SSI2_BASE_ADDR (AIPI_BASE_ADDR + 0x11000)
52#define I2C_BASE_ADDR (AIPI_BASE_ADDR + 0x12000)
53#define SDHC1_BASE_ADDR (AIPI_BASE_ADDR + 0x13000)
54#define SDHC2_BASE_ADDR (AIPI_BASE_ADDR + 0x14000)
55#define GPIO_BASE_ADDR (AIPI_BASE_ADDR + 0x15000)
56#define AUDMUX_BASE_ADDR (AIPI_BASE_ADDR + 0x16000)
57
58#define CSPI3_BASE_ADDR (AIPI_BASE_ADDR + 0x17000)
59#define MSHC_BASE_ADDR (AIPI_BASE_ADDR + 0x18000)
60#define GPT5_BASE_ADDR (AIPI_BASE_ADDR + 0x19000)
61#define GPT4_BASE_ADDR (AIPI_BASE_ADDR + 0x1A000)
62#define UART5_BASE_ADDR (AIPI_BASE_ADDR + 0x1B000)
63#define UART6_BASE_ADDR (AIPI_BASE_ADDR + 0x1C000)
64#define I2C2_BASE_ADDR (AIPI_BASE_ADDR + 0x1D000)
65#define SDHC3_BASE_ADDR (AIPI_BASE_ADDR + 0x1E000)
66#define GPT6_BASE_ADDR (AIPI_BASE_ADDR + 0x1F000)
67
68#define LCDC_BASE_ADDR (AIPI_BASE_ADDR + 0x21000)
69#define SLCDC_BASE_ADDR (AIPI_BASE_ADDR + 0x22000)
70#define VPU_BASE_ADDR (AIPI_BASE_ADDR + 0x23000)
71#define USBOTG_BASE_ADDR (AIPI_BASE_ADDR + 0x24000)
72/* for mx27*/
73#define OTG_BASE_ADDR USBOTG_BASE_ADDR
74#define SAHARA_BASE_ADDR (AIPI_BASE_ADDR + 0x25000)
75#define EMMA_BASE_ADDR (AIPI_BASE_ADDR + 0x26400)
76#define CCM_BASE_ADDR (AIPI_BASE_ADDR + 0x27000)
77#define SYSCTRL_BASE_ADDR (AIPI_BASE_ADDR + 0x27800)
78#define IIM_BASE_ADDR (AIPI_BASE_ADDR + 0x28000)
79
80#define RTIC_BASE_ADDR (AIPI_BASE_ADDR + 0x2A000)
81#define FEC_BASE_ADDR (AIPI_BASE_ADDR + 0x2B000)
82#define SCC_BASE_ADDR (AIPI_BASE_ADDR + 0x2C000)
83#define ETB_BASE_ADDR (AIPI_BASE_ADDR + 0x3B000)
84#define ETB_RAM_BASE_ADDR (AIPI_BASE_ADDR + 0x3C000)
85
86#define JAM_BASE_ADDR (AIPI_BASE_ADDR + 0x3E000)
87#define MAX_BASE_ADDR (AIPI_BASE_ADDR + 0x3F000)
88
89/* ROMP and AVIC */
90#define ROMP_BASE_ADDR 0x10041000
91
92#define AVIC_BASE_ADDR 0x10040000
93
94#define SAHB1_BASE_ADDR 0x80000000
95#define SAHB1_BASE_ADDR_VIRT 0xF4100000
96#define SAHB1_SIZE SZ_1M
97
98#define CSI_BASE_ADDR (SAHB1_BASE_ADDR + 0x0000)
99#define ATA_BASE_ADDR (SAHB1_BASE_ADDR + 0x1000)
100
101/* NAND, SDRAM, WEIM, M3IF, EMI controllers */
102#define X_MEMC_BASE_ADDR 0xD8000000
103#define X_MEMC_BASE_ADDR_VIRT 0xF4200000
104#define X_MEMC_SIZE SZ_1M
105
106#define NFC_BASE_ADDR (X_MEMC_BASE_ADDR)
107#define SDRAMC_BASE_ADDR (X_MEMC_BASE_ADDR + 0x1000)
108#define WEIM_BASE_ADDR (X_MEMC_BASE_ADDR + 0x2000)
109#define M3IF_BASE_ADDR (X_MEMC_BASE_ADDR + 0x3000)
110#define PCMCIA_CTL_BASE_ADDR (X_MEMC_BASE_ADDR + 0x4000)
111
112/* Memory regions and CS */
113#define SDRAM_BASE_ADDR 0xA0000000
114#define CSD1_BASE_ADDR 0xB0000000
115
116#define CS0_BASE_ADDR 0xC0000000
117#define CS1_BASE_ADDR 0xC8000000
118#define CS2_BASE_ADDR 0xD0000000
119#define CS3_BASE_ADDR 0xD2000000
120#define CS4_BASE_ADDR 0xD4000000
121#define CS5_BASE_ADDR 0xD6000000
122#define PCMCIA_MEM_BASE_ADDR 0xDC000000
123
124/*
125 * This macro defines the physical to virtual address mapping for all the
126 * peripheral modules. It is used by passing in the physical address as x
127 * and returning the virtual address. If the physical address is not mapped,
128 * it returns 0xDEADBEEF
129 */
130#define IO_ADDRESS(x) \
131 (((x >= AIPI_BASE_ADDR) && (x < (AIPI_BASE_ADDR + AIPI_SIZE))) ? \
132 AIPI_IO_ADDRESS(x) : \
133 ((x >= SAHB1_BASE_ADDR) && (x < (SAHB1_BASE_ADDR + SAHB1_SIZE))) ? \
134 SAHB1_IO_ADDRESS(x) : \
135 ((x >= X_MEMC_BASE_ADDR) && (x < (X_MEMC_BASE_ADDR + X_MEMC_SIZE))) ? \
136 X_MEMC_IO_ADDRESS(x) : 0xDEADBEEF)
137
138/* define the address mapping macros: in physical address order */
139#define AIPI_IO_ADDRESS(x) \
140 (((x) - AIPI_BASE_ADDR) + AIPI_BASE_ADDR_VIRT)
141
142#define AVIC_IO_ADDRESS(x) AIPI_IO_ADDRESS(x)
143
144#define SAHB1_IO_ADDRESS(x) \
145 (((x) - SAHB1_BASE_ADDR) + SAHB1_BASE_ADDR_VIRT)
146
147#define CS4_IO_ADDRESS(x) \
148 (((x) - CS4_BASE_ADDR) + CS4_BASE_ADDR_VIRT)
149
150#define X_MEMC_IO_ADDRESS(x) \
151 (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
152
153#define PCMCIA_IO_ADDRESS(x) \
154 (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
155
156/* fixed interrput numbers */
157#define MXC_INT_CCM 63
158#define MXC_INT_IIM 62
159#define MXC_INT_LCDC 61
160#define MXC_INT_SLCDC 60
161#define MXC_INT_SAHARA 59
162#define MXC_INT_SCC_SCM 58
163#define MXC_INT_SCC_SMN 57
164#define MXC_INT_USB3 56
165#define MXC_INT_USB2 55
166#define MXC_INT_USB1 54
167#define MXC_INT_VPU 53
168#define MXC_INT_EMMAPP 52
169#define MXC_INT_EMMAPRP 51
170#define MXC_INT_FEC 50
171#define MXC_INT_UART5 49
172#define MXC_INT_UART6 48
173#define MXC_INT_DMACH15 47
174#define MXC_INT_DMACH14 46
175#define MXC_INT_DMACH13 45
176#define MXC_INT_DMACH12 44
177#define MXC_INT_DMACH11 43
178#define MXC_INT_DMACH10 42
179#define MXC_INT_DMACH9 41
180#define MXC_INT_DMACH8 40
181#define MXC_INT_DMACH7 39
182#define MXC_INT_DMACH6 38
183#define MXC_INT_DMACH5 37
184#define MXC_INT_DMACH4 36
185#define MXC_INT_DMACH3 35
186#define MXC_INT_DMACH2 34
187#define MXC_INT_DMACH1 33
188#define MXC_INT_DMACH0 32
189#define MXC_INT_CSI 31
190#define MXC_INT_ATA 30
191#define MXC_INT_NANDFC 29
192#define MXC_INT_PCMCIA 28
193#define MXC_INT_WDOG 27
194#define MXC_INT_GPT1 26
195#define MXC_INT_GPT2 25
196#define MXC_INT_GPT3 24
197#define MXC_INT_GPT INT_GPT1
198#define MXC_INT_PWM 23
199#define MXC_INT_RTC 22
200#define MXC_INT_KPP 21
201#define MXC_INT_UART1 20
202#define MXC_INT_UART2 19
203#define MXC_INT_UART3 18
204#define MXC_INT_UART4 17
205#define MXC_INT_CSPI1 16
206#define MXC_INT_CSPI2 15
207#define MXC_INT_SSI1 14
208#define MXC_INT_SSI2 13
209#define MXC_INT_I2C 12
210#define MXC_INT_SDHC1 11
211#define MXC_INT_SDHC2 10
212#define MXC_INT_SDHC3 9
213#define MXC_INT_GPIO 8
214#define MXC_INT_SDHC 7
215#define MXC_INT_CSPI3 6
216#define MXC_INT_RTIC 5
217#define MXC_INT_GPT4 4
218#define MXC_INT_GPT5 3
219#define MXC_INT_GPT6 2
220#define MXC_INT_I2C2 1
221
222/* fixed DMA request numbers */
223#define DMA_REQ_NFC 37
224#define DMA_REQ_SDHC3 36
225#define DMA_REQ_UART6_RX 35
226#define DMA_REQ_UART6_TX 34
227#define DMA_REQ_UART5_RX 33
228#define DMA_REQ_UART5_TX 32
229#define DMA_REQ_CSI_RX 31
230#define DMA_REQ_CSI_STAT 30
231#define DMA_REQ_ATA_RCV 29
232#define DMA_REQ_ATA_TX 28
233#define DMA_REQ_UART1_TX 27
234#define DMA_REQ_UART1_RX 26
235#define DMA_REQ_UART2_TX 25
236#define DMA_REQ_UART2_RX 24
237#define DMA_REQ_UART3_TX 23
238#define DMA_REQ_UART3_RX 22
239#define DMA_REQ_UART4_TX 21
240#define DMA_REQ_UART4_RX 20
241#define DMA_REQ_CSPI1_TX 19
242#define DMA_REQ_CSPI1_RX 18
243#define DMA_REQ_CSPI2_TX 17
244#define DMA_REQ_CSPI2_RX 16
245#define DMA_REQ_SSI1_TX1 15
246#define DMA_REQ_SSI1_RX1 14
247#define DMA_REQ_SSI1_TX0 13
248#define DMA_REQ_SSI1_RX0 12
249#define DMA_REQ_SSI2_TX1 11
250#define DMA_REQ_SSI2_RX1 10
251#define DMA_REQ_SSI2_TX0 9
252#define DMA_REQ_SSI2_RX0 8
253#define DMA_REQ_SDHC1 7
254#define DMA_REQ_SDHC2 6
255#define DMA_REQ_MSHC 4
256#define DMA_REQ_EXT 3
257#define DMA_REQ_CSPI3_TX 2
258#define DMA_REQ_CSPI3_RX 1
259
260/* silicon revisions specific to i.MX27 */
261#define CHIP_REV_1_0 0x00
262#define CHIP_REV_2_0 0x01
263
264#ifndef __ASSEMBLY__
265extern int mx27_revision(void);
266#endif
267
268/* gpio and gpio based interrupt handling */
269#define GPIO_DR 0x1C
270#define GPIO_GDIR 0x00
271#define GPIO_PSR 0x24
272#define GPIO_ICR1 0x28
273#define GPIO_ICR2 0x2C
274#define GPIO_IMR 0x30
275#define GPIO_ISR 0x34
276#define GPIO_INT_LOW_LEV 0x3
277#define GPIO_INT_HIGH_LEV 0x2
278#define GPIO_INT_RISE_EDGE 0x0
279#define GPIO_INT_FALL_EDGE 0x1
280#define GPIO_INT_NONE 0x4
281
282/* Mandatory defines used globally */
283
284/* this is an i.MX27 CPU */
285#define cpu_is_mx27() (1)
286
287/* this CPU supports up to 192 GPIOs (don't forget the baseboard!) */
288#define ARCH_NR_GPIOS (192 + 16)
289
290/* OS clock tick rate */
291#define CLOCK_TICK_RATE 13300000
292
293/* Start of RAM */
294#define PHYS_OFFSET SDRAM_BASE_ADDR
295
296/* max interrupt lines count */
297#define NR_IRQS 256
298
299/* count of internal interrupt sources */
300#define MXC_MAX_INT_LINES 64
301
302#endif /* __ASM_ARCH_MXC_MX27_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
new file mode 100644
index 000000000000..a7373e4a56cb
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -0,0 +1,384 @@
1/*
2 * Copyright 2004-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_MX31_H__
12#define __ASM_ARCH_MXC_MX31_H__
13
14#ifndef __ASM_ARCH_MXC_HARDWARE_H__
15#error "Do not include directly."
16#endif
17
18/*!
19 * defines the hardware clock tick rate
20 */
21#define CLOCK_TICK_RATE 16625000
22
23/*
24 * MX31 memory map:
25 *
26 * Virt Phys Size What
27 * ---------------------------------------------------------------------------
28 * F8000000 1FFC0000 16K IRAM
29 * F9000000 30000000 256M L2CC
30 * FC000000 43F00000 1M AIPS 1
31 * FC100000 50000000 1M SPBA
32 * FC200000 53F00000 1M AIPS 2
33 * FC500000 60000000 128M ROMPATCH
34 * FC400000 68000000 128M AVIC
35 * 70000000 256M IPU (MAX M2)
36 * 80000000 256M CSD0 SDRAM/DDR
37 * 90000000 256M CSD1 SDRAM/DDR
38 * A0000000 128M CS0 Flash
39 * A8000000 128M CS1 Flash
40 * B0000000 32M CS2
41 * B2000000 32M CS3
42 * F4000000 B4000000 32M CS4
43 * B6000000 32M CS5
44 * FC320000 B8000000 64K NAND, SDRAM, WEIM, M3IF, EMI controllers
45 * C0000000 64M PCMCIA/CF
46 */
47
48#define CS0_BASE_ADDR 0xA0000000
49#define CS1_BASE_ADDR 0xA8000000
50#define CS2_BASE_ADDR 0xB0000000
51#define CS3_BASE_ADDR 0xB2000000
52
53#define CS4_BASE_ADDR 0xB4000000
54#define CS4_BASE_ADDR_VIRT 0xF4000000
55#define CS4_SIZE SZ_32M
56
57#define CS5_BASE_ADDR 0xB6000000
58#define PCMCIA_MEM_BASE_ADDR 0xBC000000
59
60/*
61 * IRAM
62 */
63#define IRAM_BASE_ADDR 0x1FFC0000 /* internal ram */
64#define IRAM_BASE_ADDR_VIRT 0xF8000000
65#define IRAM_SIZE SZ_16K
66
67/*
68 * L2CC
69 */
70#define L2CC_BASE_ADDR 0x30000000
71#define L2CC_BASE_ADDR_VIRT 0xF9000000
72#define L2CC_SIZE SZ_1M
73
74/*
75 * AIPS 1
76 */
77#define AIPS1_BASE_ADDR 0x43F00000
78#define AIPS1_BASE_ADDR_VIRT 0xFC000000
79#define AIPS1_SIZE SZ_1M
80
81#define MAX_BASE_ADDR (AIPS1_BASE_ADDR + 0x00004000)
82#define EVTMON_BASE_ADDR (AIPS1_BASE_ADDR + 0x00008000)
83#define CLKCTL_BASE_ADDR (AIPS1_BASE_ADDR + 0x0000C000)
84#define ETB_SLOT4_BASE_ADDR (AIPS1_BASE_ADDR + 0x00010000)
85#define ETB_SLOT5_BASE_ADDR (AIPS1_BASE_ADDR + 0x00014000)
86#define ECT_CTIO_BASE_ADDR (AIPS1_BASE_ADDR + 0x00018000)
87#define I2C_BASE_ADDR (AIPS1_BASE_ADDR + 0x00080000)
88#define I2C3_BASE_ADDR (AIPS1_BASE_ADDR + 0x00084000)
89#define OTG_BASE_ADDR (AIPS1_BASE_ADDR + 0x00088000)
90#define ATA_BASE_ADDR (AIPS1_BASE_ADDR + 0x0008C000)
91#define UART1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00090000)
92#define UART2_BASE_ADDR (AIPS1_BASE_ADDR + 0x00094000)
93#define I2C2_BASE_ADDR (AIPS1_BASE_ADDR + 0x00098000)
94#define OWIRE_BASE_ADDR (AIPS1_BASE_ADDR + 0x0009C000)
95#define SSI1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A0000)
96#define CSPI1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A4000)
97#define KPP_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A8000)
98#define IOMUXC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000AC000)
99#define UART4_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B0000)
100#define UART5_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B4000)
101#define ECT_IP1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B8000)
102#define ECT_IP2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000BC000)
103
104/*
105 * SPBA global module enabled #0
106 */
107#define SPBA0_BASE_ADDR 0x50000000
108#define SPBA0_BASE_ADDR_VIRT 0xFC100000
109#define SPBA0_SIZE SZ_1M
110
111#define MMC_SDHC1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00004000)
112#define MMC_SDHC2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00008000)
113#define UART3_BASE_ADDR (SPBA0_BASE_ADDR + 0x0000C000)
114#define CSPI2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00010000)
115#define SSI2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00014000)
116#define SIM1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00018000)
117#define IIM_BASE_ADDR (SPBA0_BASE_ADDR + 0x0001C000)
118#define ATA_DMA_BASE_ADDR (SPBA0_BASE_ADDR + 0x00020000)
119#define MSHC1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00024000)
120#define MSHC2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00024000)
121#define SPBA_CTRL_BASE_ADDR (SPBA0_BASE_ADDR + 0x0003C000)
122
123/*
124 * AIPS 2
125 */
126#define AIPS2_BASE_ADDR 0x53F00000
127#define AIPS2_BASE_ADDR_VIRT 0xFC200000
128#define AIPS2_SIZE SZ_1M
129#define CCM_BASE_ADDR (AIPS2_BASE_ADDR + 0x00080000)
130#define CSPI3_BASE_ADDR (AIPS2_BASE_ADDR + 0x00084000)
131#define FIRI_BASE_ADDR (AIPS2_BASE_ADDR + 0x0008C000)
132#define GPT1_BASE_ADDR (AIPS2_BASE_ADDR + 0x00090000)
133#define EPIT1_BASE_ADDR (AIPS2_BASE_ADDR + 0x00094000)
134#define EPIT2_BASE_ADDR (AIPS2_BASE_ADDR + 0x00098000)
135#define GPIO3_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A4000)
136#define SCC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AC000)
137#define SCM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AE000)
138#define SMN_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AF000)
139#define RNGA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B0000)
140#define IPU_CTRL_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C0000)
141#define AUDMUX_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C4000)
142#define MPEG4_ENC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C8000)
143#define GPIO1_BASE_ADDR (AIPS2_BASE_ADDR + 0x000CC000)
144#define GPIO2_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D0000)
145#define SDMA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D4000)
146#define RTC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D8000)
147#define WDOG_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DC000)
148#define PWM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000E0000)
149#define RTIC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000EC000)
150
151/*
152 * ROMP and AVIC
153 */
154#define ROMP_BASE_ADDR 0x60000000
155#define ROMP_BASE_ADDR_VIRT 0xFC500000
156#define ROMP_SIZE SZ_1M
157
158#define AVIC_BASE_ADDR 0x68000000
159#define AVIC_BASE_ADDR_VIRT 0xFC400000
160#define AVIC_SIZE SZ_1M
161
162/*
163 * NAND, SDRAM, WEIM, M3IF, EMI controllers
164 */
165#define X_MEMC_BASE_ADDR 0xB8000000
166#define X_MEMC_BASE_ADDR_VIRT 0xFC320000
167#define X_MEMC_SIZE SZ_64K
168
169#define NFC_BASE_ADDR (X_MEMC_BASE_ADDR + 0x0000)
170#define ESDCTL_BASE_ADDR (X_MEMC_BASE_ADDR + 0x1000)
171#define WEIM_BASE_ADDR (X_MEMC_BASE_ADDR + 0x2000)
172#define M3IF_BASE_ADDR (X_MEMC_BASE_ADDR + 0x3000)
173#define EMI_CTL_BASE_ADDR (X_MEMC_BASE_ADDR + 0x4000)
174#define PCMCIA_CTL_BASE_ADDR EMI_CTL_BASE_ADDR
175
176/*
177 * Memory regions and CS
178 */
179#define IPU_MEM_BASE_ADDR 0x70000000
180#define CSD0_BASE_ADDR 0x80000000
181#define CSD1_BASE_ADDR 0x90000000
182#define CS0_BASE_ADDR 0xA0000000
183#define CS1_BASE_ADDR 0xA8000000
184#define CS2_BASE_ADDR 0xB0000000
185#define CS3_BASE_ADDR 0xB2000000
186
187#define CS4_BASE_ADDR 0xB4000000
188#define CS4_BASE_ADDR_VIRT 0xF4000000
189#define CS4_SIZE SZ_32M
190
191#define CS5_BASE_ADDR 0xB6000000
192#define PCMCIA_MEM_BASE_ADDR 0xBC000000
193
194/*!
195 * This macro defines the physical to virtual address mapping for all the
196 * peripheral modules. It is used by passing in the physical address as x
197 * and returning the virtual address. If the physical address is not mapped,
198 * it returns 0xDEADBEEF
199 */
200#define IO_ADDRESS(x) \
201 (((x >= IRAM_BASE_ADDR) && (x < (IRAM_BASE_ADDR + IRAM_SIZE))) ? IRAM_IO_ADDRESS(x):\
202 ((x >= L2CC_BASE_ADDR) && (x < (L2CC_BASE_ADDR + L2CC_SIZE))) ? L2CC_IO_ADDRESS(x):\
203 ((x >= AIPS1_BASE_ADDR) && (x < (AIPS1_BASE_ADDR + AIPS1_SIZE))) ? AIPS1_IO_ADDRESS(x):\
204 ((x >= SPBA0_BASE_ADDR) && (x < (SPBA0_BASE_ADDR + SPBA0_SIZE))) ? SPBA0_IO_ADDRESS(x):\
205 ((x >= AIPS2_BASE_ADDR) && (x < (AIPS2_BASE_ADDR + AIPS2_SIZE))) ? AIPS2_IO_ADDRESS(x):\
206 ((x >= ROMP_BASE_ADDR) && (x < (ROMP_BASE_ADDR + ROMP_SIZE))) ? ROMP_IO_ADDRESS(x):\
207 ((x >= AVIC_BASE_ADDR) && (x < (AVIC_BASE_ADDR + AVIC_SIZE))) ? AVIC_IO_ADDRESS(x):\
208 ((x >= CS4_BASE_ADDR) && (x < (CS4_BASE_ADDR + CS4_SIZE))) ? CS4_IO_ADDRESS(x):\
209 ((x >= X_MEMC_BASE_ADDR) && (x < (X_MEMC_BASE_ADDR + X_MEMC_SIZE))) ? X_MEMC_IO_ADDRESS(x):\
210 0xDEADBEEF)
211
212/*
213 * define the address mapping macros: in physical address order
214 */
215
216#define IRAM_IO_ADDRESS(x) \
217 (((x) - IRAM_BASE_ADDR) + IRAM_BASE_ADDR_VIRT)
218
219#define L2CC_IO_ADDRESS(x) \
220 (((x) - L2CC_BASE_ADDR) + L2CC_BASE_ADDR_VIRT)
221
222#define AIPS1_IO_ADDRESS(x) \
223 (((x) - AIPS1_BASE_ADDR) + AIPS1_BASE_ADDR_VIRT)
224
225#define SPBA0_IO_ADDRESS(x) \
226 (((x) - SPBA0_BASE_ADDR) + SPBA0_BASE_ADDR_VIRT)
227
228#define AIPS2_IO_ADDRESS(x) \
229 (((x) - AIPS2_BASE_ADDR) + AIPS2_BASE_ADDR_VIRT)
230
231#define ROMP_IO_ADDRESS(x) \
232 (((x) - ROMP_BASE_ADDR) + ROMP_BASE_ADDR_VIRT)
233
234#define AVIC_IO_ADDRESS(x) \
235 (((x) - AVIC_BASE_ADDR) + AVIC_BASE_ADDR_VIRT)
236
237#define CS4_IO_ADDRESS(x) \
238 (((x) - CS4_BASE_ADDR) + CS4_BASE_ADDR_VIRT)
239
240#define X_MEMC_IO_ADDRESS(x) \
241 (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
242
243#define PCMCIA_IO_ADDRESS(x) \
244 (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
245
246/* Start of physical RAM - On many MX31 platforms, this is the first SDRAM bank (CSD0) */
247#define PHYS_OFFSET CSD0_BASE_ADDR
248
249/*
250 * Interrupt numbers
251 */
252#define MXC_INT_PEN_ADS7843 0
253#define MXC_INT_RESV1 1
254#define MXC_INT_CS8900A 2
255#define MXC_INT_I2C3 3
256#define MXC_INT_I2C2 4
257#define MXC_INT_MPEG4_ENCODER 5
258#define MXC_INT_RTIC 6
259#define MXC_INT_FIRI 7
260#define MXC_INT_MMC_SDHC2 8
261#define MXC_INT_MMC_SDHC1 9
262#define MXC_INT_I2C 10
263#define MXC_INT_SSI2 11
264#define MXC_INT_SSI1 12
265#define MXC_INT_CSPI2 13
266#define MXC_INT_CSPI1 14
267#define MXC_INT_ATA 15
268#define MXC_INT_MBX 16
269#define MXC_INT_CSPI3 17
270#define MXC_INT_UART3 18
271#define MXC_INT_IIM 19
272#define MXC_INT_SIM2 20
273#define MXC_INT_SIM1 21
274#define MXC_INT_RNGA 22
275#define MXC_INT_EVTMON 23
276#define MXC_INT_KPP 24
277#define MXC_INT_RTC 25
278#define MXC_INT_PWM 26
279#define MXC_INT_EPIT2 27
280#define MXC_INT_EPIT1 28
281#define MXC_INT_GPT 29
282#define MXC_INT_RESV30 30
283#define MXC_INT_RESV31 31
284#define MXC_INT_UART2 32
285#define MXC_INT_NANDFC 33
286#define MXC_INT_SDMA 34
287#define MXC_INT_USB1 35
288#define MXC_INT_USB2 36
289#define MXC_INT_USB3 37
290#define MXC_INT_USB4 38
291#define MXC_INT_MSHC1 39
292#define MXC_INT_MSHC2 40
293#define MXC_INT_IPU_ERR 41
294#define MXC_INT_IPU_SYN 42
295#define MXC_INT_RESV43 43
296#define MXC_INT_RESV44 44
297#define MXC_INT_UART1 45
298#define MXC_INT_UART4 46
299#define MXC_INT_UART5 47
300#define MXC_INT_ECT 48
301#define MXC_INT_SCC_SCM 49
302#define MXC_INT_SCC_SMN 50
303#define MXC_INT_GPIO2 51
304#define MXC_INT_GPIO1 52
305#define MXC_INT_CCM 53
306#define MXC_INT_PCMCIA 54
307#define MXC_INT_WDOG 55
308#define MXC_INT_GPIO3 56
309#define MXC_INT_RESV57 57
310#define MXC_INT_EXT_POWER 58
311#define MXC_INT_EXT_TEMPER 59
312#define MXC_INT_EXT_SENSOR60 60
313#define MXC_INT_EXT_SENSOR61 61
314#define MXC_INT_EXT_WDOG 62
315#define MXC_INT_EXT_TV 63
316
317#define MXC_MAX_INT_LINES 64
318
319#define MXC_GPIO_INT_BASE MXC_MAX_INT_LINES
320#define MXC_MAX_GPIO_LINES (GPIO_NUM_PIN * GPIO_PORT_NUM)
321#define MXC_MAX_VIRTUAL_INTS 16
322
323#define NR_IRQS (MXC_MAX_INT_LINES + MXC_MAX_GPIO_LINES + MXC_MAX_VIRTUAL_INTS)
324
325/*!
326 * Number of GPIO port as defined in the IC Spec
327 */
328#define GPIO_PORT_NUM 3
329/*!
330 * Number of GPIO pins per port
331 */
332#define GPIO_NUM_PIN 32
333
334#define PROD_SIGNATURE 0x1 /* For MX31 */
335
336/* silicon revisions specific to i.MX31 */
337#define CHIP_REV_1_0 0x10
338#define CHIP_REV_1_1 0x11
339#define CHIP_REV_1_2 0x12
340#define CHIP_REV_1_3 0x13
341#define CHIP_REV_2_0 0x20
342#define CHIP_REV_2_1 0x21
343#define CHIP_REV_2_2 0x22
344#define CHIP_REV_2_3 0x23
345#define CHIP_REV_3_0 0x30
346#define CHIP_REV_3_1 0x31
347#define CHIP_REV_3_2 0x32
348
349#define SYSTEM_REV_MIN CHIP_REV_1_0
350#define SYSTEM_REV_NUM 3
351
352/* gpio and gpio based interrupt handling */
353#define GPIO_DR 0x00
354#define GPIO_GDIR 0x04
355#define GPIO_PSR 0x08
356#define GPIO_ICR1 0x0C
357#define GPIO_ICR2 0x10
358#define GPIO_IMR 0x14
359#define GPIO_ISR 0x18
360#define GPIO_INT_LOW_LEV 0x0
361#define GPIO_INT_HIGH_LEV 0x1
362#define GPIO_INT_RISE_EDGE 0x2
363#define GPIO_INT_FALL_EDGE 0x3
364#define GPIO_INT_NONE 0x4
365
366/* Mandatory defines used globally */
367
368/* this CPU supports up to 96 GPIOs */
369#define ARCH_NR_GPIOS 96
370
371#if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS)
372
373/* this is a i.MX31 CPU */
374#define cpu_is_mx31() (1)
375
376extern unsigned int system_rev;
377
378static inline int mx31_revision(void)
379{
380 return system_rev;
381}
382#endif
383
384#endif /* __ASM_ARCH_MXC_MX31_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mxc.h b/arch/arm/plat-mxc/include/mach/mxc.h
new file mode 100644
index 000000000000..332eda4dbd3b
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mxc.h
@@ -0,0 +1,36 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 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#ifndef __ASM_ARCH_MXC_H__
21#define __ASM_ARCH_MXC_H__
22
23#ifndef __ASM_ARCH_MXC_HARDWARE_H__
24#error "Do not include directly."
25#endif
26
27/* clean up all things that are not used */
28#ifndef CONFIG_ARCH_MX3
29# define cpu_is_mx31() (0)
30#endif
31
32#ifndef CONFIG_MACH_MX27
33# define cpu_is_mx27() (0)
34#endif
35
36#endif /* __ASM_ARCH_MXC_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mxc_timer.h b/arch/arm/plat-mxc/include/mach/mxc_timer.h
new file mode 100644
index 000000000000..130aebfbe168
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mxc_timer.h
@@ -0,0 +1,158 @@
1/*
2 * mxc_timer.h
3 *
4 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
5 *
6 * Platform independent (i.MX1, i.MX2, i.MX3) definition for timer handling.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 * 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., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef __PLAT_MXC_TIMER_H
24#define __PLAT_MXC_TIMER_H
25
26#include <linux/clk.h>
27#include <mach/hardware.h>
28
29#ifdef CONFIG_ARCH_IMX
30#define TIMER_BASE IO_ADDRESS(TIM1_BASE_ADDR)
31#define TIMER_INTERRUPT TIM1_INT
32
33#define TCTL_VAL TCTL_CLK_PCLK1
34#define TCTL_IRQEN (1<<4)
35#define TCTL_FRR (1<<8)
36#define TCTL_CLK_PCLK1 (1<<1)
37#define TCTL_CLK_PCLK1_4 (2<<1)
38#define TCTL_CLK_TIN (3<<1)
39#define TCTL_CLK_32 (4<<1)
40
41#define MXC_TCTL 0x00
42#define MXC_TPRER 0x04
43#define MXC_TCMP 0x08
44#define MXC_TCR 0x0c
45#define MXC_TCN 0x10
46#define MXC_TSTAT 0x14
47#define TSTAT_CAPT (1<<1)
48#define TSTAT_COMP (1<<0)
49
50static inline void gpt_irq_disable(void)
51{
52 unsigned int tmp;
53
54 tmp = __raw_readl(TIMER_BASE + MXC_TCTL);
55 __raw_writel(tmp & ~TCTL_IRQEN, TIMER_BASE + MXC_TCTL);
56}
57
58static inline void gpt_irq_enable(void)
59{
60 __raw_writel(__raw_readl(TIMER_BASE + MXC_TCTL) | TCTL_IRQEN,
61 TIMER_BASE + MXC_TCTL);
62}
63
64static void gpt_irq_acknowledge(void)
65{
66 __raw_writel(0, TIMER_BASE + MXC_TSTAT);
67}
68#endif /* CONFIG_ARCH_IMX */
69
70#ifdef CONFIG_ARCH_MX2
71#define TIMER_BASE IO_ADDRESS(GPT1_BASE_ADDR)
72#define TIMER_INTERRUPT MXC_INT_GPT1
73
74#define MXC_TCTL 0x00
75#define TCTL_VAL TCTL_CLK_PCLK1
76#define TCTL_CLK_PCLK1 (1<<1)
77#define TCTL_CLK_PCLK1_4 (2<<1)
78#define TCTL_IRQEN (1<<4)
79#define TCTL_FRR (1<<8)
80#define MXC_TPRER 0x04
81#define MXC_TCMP 0x08
82#define MXC_TCR 0x0c
83#define MXC_TCN 0x10
84#define MXC_TSTAT 0x14
85#define TSTAT_CAPT (1<<1)
86#define TSTAT_COMP (1<<0)
87
88static inline void gpt_irq_disable(void)
89{
90 unsigned int tmp;
91
92 tmp = __raw_readl(TIMER_BASE + MXC_TCTL);
93 __raw_writel(tmp & ~TCTL_IRQEN, TIMER_BASE + MXC_TCTL);
94}
95
96static inline void gpt_irq_enable(void)
97{
98 __raw_writel(__raw_readl(TIMER_BASE + MXC_TCTL) | TCTL_IRQEN,
99 TIMER_BASE + MXC_TCTL);
100}
101
102static void gpt_irq_acknowledge(void)
103{
104 __raw_writel(TSTAT_CAPT | TSTAT_COMP, TIMER_BASE + MXC_TSTAT);
105}
106#endif /* CONFIG_ARCH_MX2 */
107
108#ifdef CONFIG_ARCH_MX3
109#define TIMER_BASE IO_ADDRESS(GPT1_BASE_ADDR)
110#define TIMER_INTERRUPT MXC_INT_GPT
111
112#define MXC_TCTL 0x00
113#define TCTL_VAL (TCTL_CLK_IPG | TCTL_WAITEN)
114#define TCTL_CLK_IPG (1<<6)
115#define TCTL_FRR (1<<9)
116#define TCTL_WAITEN (1<<3)
117
118#define MXC_TPRER 0x04
119#define MXC_TSTAT 0x08
120#define TSTAT_OF1 (1<<0)
121#define TSTAT_OF2 (1<<1)
122#define TSTAT_OF3 (1<<2)
123#define TSTAT_IF1 (1<<3)
124#define TSTAT_IF2 (1<<4)
125#define TSTAT_ROV (1<<5)
126#define MXC_IR 0x0c
127#define MXC_TCMP 0x10
128#define MXC_TCMP2 0x14
129#define MXC_TCMP3 0x18
130#define MXC_TCR 0x1c
131#define MXC_TCN 0x24
132
133static inline void gpt_irq_disable(void)
134{
135 __raw_writel(0, TIMER_BASE + MXC_IR);
136}
137
138static inline void gpt_irq_enable(void)
139{
140 __raw_writel(1<<0, TIMER_BASE + MXC_IR);
141}
142
143static inline void gpt_irq_acknowledge(void)
144{
145 __raw_writel(TSTAT_OF1, TIMER_BASE + MXC_TSTAT);
146}
147#endif /* CONFIG_ARCH_MX3 */
148
149#define TCTL_SWR (1<<15)
150#define TCTL_CC (1<<10)
151#define TCTL_OM (1<<9)
152#define TCTL_CAP_RIS (1<<6)
153#define TCTL_CAP_FAL (2<<6)
154#define TCTL_CAP_RIS_FAL (3<<6)
155#define TCTL_CAP_ENA (1<<5)
156#define TCTL_TEN (1<<0)
157
158#endif
diff --git a/arch/arm/plat-mxc/include/mach/system.h b/arch/arm/plat-mxc/include/mach/system.h
new file mode 100644
index 000000000000..bbfc37465fc5
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/system.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 1999 ARM Limited
3 * Copyright (C) 2000 Deep Blue Solutions Ltd
4 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
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
21#ifndef __ASM_ARCH_MXC_SYSTEM_H__
22#define __ASM_ARCH_MXC_SYSTEM_H__
23
24static inline void arch_idle(void)
25{
26 cpu_do_idle();
27}
28
29static inline void arch_reset(char mode)
30{
31 cpu_reset(0);
32}
33
34#endif /* __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
new file mode 100644
index 000000000000..0b0af0253e91
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/timex.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 1999 ARM Limited
3 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
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#ifndef __ASM_ARCH_MXC_TIMEX_H__
21#define __ASM_ARCH_MXC_TIMEX_H__
22
23#include <mach/hardware.h> /* for CLOCK_TICK_RATE */
24
25#endif /* __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
new file mode 100644
index 000000000000..de6fe0365982
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/uncompress.h
@@ -0,0 +1,78 @@
1/*
2 * arch/arm/plat-mxc/include/mach/uncompress.h
3 *
4 *
5 *
6 * Copyright (C) 1999 ARM Limited
7 * Copyright (C) Shane Nay (shane@minirl.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#ifndef __ASM_ARCH_MXC_UNCOMPRESS_H__
24#define __ASM_ARCH_MXC_UNCOMPRESS_H__
25
26#define __MXC_BOOT_UNCOMPRESS
27
28#include <mach/hardware.h>
29
30#define UART(x) (*(volatile unsigned long *)(serial_port + (x)))
31
32#define USR2 0x98
33#define USR2_TXFE (1<<14)
34#define TXR 0x40
35#define UCR1 0x80
36#define UCR1_UARTEN 1
37
38/*
39 * The following code assumes the serial port has already been
40 * initialized by the bootloader. We search for the first enabled
41 * port in the most probable order. If you didn't setup a port in
42 * your bootloader then nothing will appear (which might be desired).
43 *
44 * This does not append a newline
45 */
46
47static void putc(int ch)
48{
49 static unsigned long serial_port = 0;
50
51 if (unlikely(serial_port == 0)) {
52 do {
53 serial_port = UART1_BASE_ADDR;
54 if (UART(UCR1) & UCR1_UARTEN)
55 break;
56 serial_port = UART2_BASE_ADDR;
57 if (UART(UCR1) & UCR1_UARTEN)
58 break;
59 return;
60 } while (0);
61 }
62
63 while (!(UART(USR2) & USR2_TXFE))
64 barrier();
65
66 UART(TXR) = ch;
67}
68
69#define flush() do { } while (0)
70
71/*
72 * nothing to do
73 */
74#define arch_decomp_setup()
75
76#define arch_decomp_wdog()
77
78#endif /* __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
new file mode 100644
index 000000000000..62d97623412f
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/vmalloc.h
@@ -0,0 +1,26 @@
1/*
2 * Copyright (C) 2000 Russell King.
3 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
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#ifndef __ASM_ARCH_MXC_VMALLOC_H__
21#define __ASM_ARCH_MXC_VMALLOC_H__
22
23/* vmalloc ending address */
24#define VMALLOC_END 0xF4000000
25
26#endif /* __ASM_ARCH_MXC_VMALLOC_H__ */
diff --git a/arch/arm/plat-mxc/iomux-mx1-mx2.c b/arch/arm/plat-mxc/iomux-mx1-mx2.c
index 1985571eb40c..d97387aa9a42 100644
--- a/arch/arm/plat-mxc/iomux-mx1-mx2.c
+++ b/arch/arm/plat-mxc/iomux-mx1-mx2.c
@@ -30,9 +30,9 @@
30#include <linux/string.h> 30#include <linux/string.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32 32
33#include <asm/hardware.h> 33#include <mach/hardware.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <asm/arch/iomux-mx1-mx2.h> 35#include <mach/iomux-mx1-mx2.h>
36 36
37void mxc_gpio_mode(int gpio_mode) 37void mxc_gpio_mode(int gpio_mode)
38{ 38{
diff --git a/arch/arm/plat-mxc/irq.c b/arch/arm/plat-mxc/irq.c
index 1fbe01da6925..1053b666c676 100644
--- a/arch/arm/plat-mxc/irq.c
+++ b/arch/arm/plat-mxc/irq.c
@@ -19,7 +19,7 @@
19 19
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/arch/common.h> 22#include <mach/common.h>
23 23
24#define AVIC_BASE IO_ADDRESS(AVIC_BASE_ADDR) 24#define AVIC_BASE IO_ADDRESS(AVIC_BASE_ADDR)
25#define AVIC_INTCNTL (AVIC_BASE + 0x00) /* int control reg */ 25#define AVIC_INTCNTL (AVIC_BASE + 0x00) /* int control reg */
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index 3bf86343fdf4..fd28f5194f71 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -26,10 +26,10 @@
26#include <linux/clockchips.h> 26#include <linux/clockchips.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28 28
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/mach/time.h> 30#include <asm/mach/time.h>
31#include <asm/arch/common.h> 31#include <mach/common.h>
32#include <asm/arch/mxc_timer.h> 32#include <mach/mxc_timer.h>
33 33
34static struct clock_event_device clockevent_mxc; 34static struct clock_event_device clockevent_mxc;
35static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED; 35static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index c2e741de0203..23a070599993 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -26,7 +26,7 @@
26 26
27#include <asm/io.h> 27#include <asm/io.h>
28 28
29#include <asm/arch/clock.h> 29#include <mach/clock.h>
30 30
31static LIST_HEAD(clocks); 31static LIST_HEAD(clocks);
32static DEFINE_MUTEX(clocks_mutex); 32static DEFINE_MUTEX(clocks_mutex);
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 8d04929a3c75..f4dff423ae7c 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -19,20 +19,20 @@
19#include <linux/serial_reg.h> 19#include <linux/serial_reg.h>
20#include <linux/clk.h> 20#include <linux/clk.h>
21 21
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/system.h> 23#include <asm/system.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/setup.h> 27#include <asm/setup.h>
28 28
29#include <asm/arch/common.h> 29#include <mach/common.h>
30#include <asm/arch/board.h> 30#include <mach/board.h>
31#include <asm/arch/control.h> 31#include <mach/control.h>
32#include <asm/arch/mux.h> 32#include <mach/mux.h>
33#include <asm/arch/fpga.h> 33#include <mach/fpga.h>
34 34
35#include <asm/arch/clock.h> 35#include <mach/clock.h>
36 36
37#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 37#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
38# include "../mach-omap2/sdrc.h" 38# include "../mach-omap2/sdrc.h"
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
index d719c15daa55..ae1de308aaad 100644
--- a/arch/arm/plat-omap/cpu-omap.c
+++ b/arch/arm/plat-omap/cpu-omap.c
@@ -21,7 +21,7 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23 23
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/system.h> 26#include <asm/system.h>
27 27
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
index f455233af082..5b73bb274452 100644
--- a/arch/arm/plat-omap/debug-devices.c
+++ b/arch/arm/plat-omap/debug-devices.c
@@ -13,11 +13,11 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15 15
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/io.h> 17#include <asm/io.h>
18 18
19#include <asm/arch/board.h> 19#include <mach/board.h>
20#include <asm/arch/gpio.h> 20#include <mach/gpio.h>
21 21
22 22
23/* Many OMAP development platforms reuse the same "debug board"; these 23/* Many OMAP development platforms reuse the same "debug board"; these
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 9128a80d228f..9422dee7de84 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -13,13 +13,13 @@
13#include <linux/leds.h> 13#include <linux/leds.h>
14 14
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/leds.h> 17#include <asm/leds.h>
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20 20
21#include <asm/arch/fpga.h> 21#include <mach/fpga.h>
22#include <asm/arch/gpio.h> 22#include <mach/gpio.h>
23 23
24 24
25/* Many OMAP development platforms reuse the same "debug board"; these 25/* Many OMAP development platforms reuse the same "debug board"; these
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 81002b722da1..187e3d8bfdfe 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -14,17 +14,17 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16
17#include <asm/hardware.h> 17#include <mach/hardware.h>
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20#include <asm/mach/map.h> 20#include <asm/mach/map.h>
21 21
22#include <asm/arch/tc.h> 22#include <mach/tc.h>
23#include <asm/arch/board.h> 23#include <mach/board.h>
24#include <asm/arch/mux.h> 24#include <mach/mux.h>
25#include <asm/arch/gpio.h> 25#include <mach/gpio.h>
26#include <asm/arch/menelaus.h> 26#include <mach/menelaus.h>
27#include <asm/arch/mcbsp.h> 27#include <mach/mcbsp.h>
28 28
29#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) 29#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
30 30
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index fac8e994f588..a63b644ad305 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -28,10 +28,10 @@
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/dma.h> 32#include <asm/dma.h>
33 33
34#include <asm/arch/tc.h> 34#include <mach/tc.h>
35 35
36#undef DEBUG 36#undef DEBUG
37 37
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index f22506af0e67..743a4abcd85d 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -32,10 +32,10 @@
32#include <linux/list.h> 32#include <linux/list.h>
33#include <linux/clk.h> 33#include <linux/clk.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <asm/hardware.h> 35#include <mach/hardware.h>
36#include <asm/arch/dmtimer.h> 36#include <mach/dmtimer.h>
37#include <asm/io.h> 37#include <asm/io.h>
38#include <asm/arch/irqs.h> 38#include <mach/irqs.h>
39 39
40/* register offsets */ 40/* register offsets */
41#define _OMAP_TIMER_ID_OFFSET 0x00 41#define _OMAP_TIMER_ID_OFFSET 0x00
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index 5d107520e6b9..17a92a31e746 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -28,14 +28,13 @@
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/bootmem.h> 29#include <linux/bootmem.h>
30 30
31#include <asm/hardware.h> 31#include <mach/hardware.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/mach-types.h>
34#include <asm/mach/map.h> 33#include <asm/mach/map.h>
35 34
36#include <asm/arch/board.h> 35#include <mach/board.h>
37#include <asm/arch/sram.h> 36#include <mach/sram.h>
38#include <asm/arch/omapfb.h> 37#include <mach/omapfb.h>
39 38
40#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) 39#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
41 40
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 63e094342ef6..3e76ee2bc731 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -18,10 +18,10 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20 20
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/arch/irqs.h> 23#include <mach/irqs.h>
24#include <asm/arch/gpio.h> 24#include <mach/gpio.h>
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26 26
27#include <asm/io.h> 27#include <asm/io.h>
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 7990ab185bb1..0e6d147ab6f8 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -26,8 +26,7 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <asm/mach-types.h> 29#include <mach/mux.h>
30#include <asm/arch/mux.h>
31 30
32#define OMAP_I2C_SIZE 0x3f 31#define OMAP_I2C_SIZE 0x3f
33#define OMAP1_I2C_BASE 0xfffb3800 32#define OMAP1_I2C_BASE 0xfffb3800
diff --git a/arch/arm/plat-omap/include/mach/aic23.h b/arch/arm/plat-omap/include/mach/aic23.h
new file mode 100644
index 000000000000..5ccedac77526
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/aic23.h
@@ -0,0 +1,116 @@
1/*
2 * arch/arm/plat-omap/include/mach/aic23.h
3 *
4 * Hardware definitions for TI TLV320AIC23 audio codec
5 *
6 * Copyright (C) 2002 RidgeRun, Inc.
7 * Author: Steve Johnson
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30#ifndef __ASM_ARCH_AIC23_H
31#define __ASM_ARCH_AIC23_H
32
33// Codec TLV320AIC23
34#define LEFT_LINE_VOLUME_ADDR 0x00
35#define RIGHT_LINE_VOLUME_ADDR 0x01
36#define LEFT_CHANNEL_VOLUME_ADDR 0x02
37#define RIGHT_CHANNEL_VOLUME_ADDR 0x03
38#define ANALOG_AUDIO_CONTROL_ADDR 0x04
39#define DIGITAL_AUDIO_CONTROL_ADDR 0x05
40#define POWER_DOWN_CONTROL_ADDR 0x06
41#define DIGITAL_AUDIO_FORMAT_ADDR 0x07
42#define SAMPLE_RATE_CONTROL_ADDR 0x08
43#define DIGITAL_INTERFACE_ACT_ADDR 0x09
44#define RESET_CONTROL_ADDR 0x0F
45
46// Left (right) line input volume control register
47#define LRS_ENABLED 0x0100
48#define LIM_MUTED 0x0080
49#define LIV_DEFAULT 0x0017
50#define LIV_MAX 0x001f
51#define LIV_MIN 0x0000
52
53// Left (right) channel headphone volume control register
54#define LZC_ON 0x0080
55#define LHV_DEFAULT 0x0079
56#define LHV_MAX 0x007f
57#define LHV_MIN 0x0000
58
59// Analog audio path control register
60#define STA_REG(x) ((x)<<6)
61#define STE_ENABLED 0x0020
62#define DAC_SELECTED 0x0010
63#define BYPASS_ON 0x0008
64#define INSEL_MIC 0x0004
65#define MICM_MUTED 0x0002
66#define MICB_20DB 0x0001
67
68// Digital audio path control register
69#define DACM_MUTE 0x0008
70#define DEEMP_32K 0x0002
71#define DEEMP_44K 0x0004
72#define DEEMP_48K 0x0006
73#define ADCHP_ON 0x0001
74
75// Power control down register
76#define DEVICE_POWER_OFF 0x0080
77#define CLK_OFF 0x0040
78#define OSC_OFF 0x0020
79#define OUT_OFF 0x0010
80#define DAC_OFF 0x0008
81#define ADC_OFF 0x0004
82#define MIC_OFF 0x0002
83#define LINE_OFF 0x0001
84
85// Digital audio interface register
86#define MS_MASTER 0x0040
87#define LRSWAP_ON 0x0020
88#define LRP_ON 0x0010
89#define IWL_16 0x0000
90#define IWL_20 0x0004
91#define IWL_24 0x0008
92#define IWL_32 0x000C
93#define FOR_I2S 0x0002
94#define FOR_DSP 0x0003
95
96// Sample rate control register
97#define CLKOUT_HALF 0x0080
98#define CLKIN_HALF 0x0040
99#define BOSR_384fs 0x0002 // BOSR_272fs when in USB mode
100#define USB_CLK_ON 0x0001
101#define SR_MASK 0xf
102#define CLKOUT_SHIFT 7
103#define CLKIN_SHIFT 6
104#define SR_SHIFT 2
105#define BOSR_SHIFT 1
106
107// Digital interface register
108#define ACT_ON 0x0001
109
110#define TLV320AIC23ID1 (0x1a) // cs low
111#define TLV320AIC23ID2 (0x1b) // cs high
112
113void aic23_power_up(void);
114void aic23_power_down(void);
115
116#endif /* __ASM_ARCH_AIC23_H */
diff --git a/arch/arm/plat-omap/include/mach/blizzard.h b/arch/arm/plat-omap/include/mach/blizzard.h
new file mode 100644
index 000000000000..8d160f171372
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/blizzard.h
@@ -0,0 +1,12 @@
1#ifndef _BLIZZARD_H
2#define _BLIZZARD_H
3
4struct blizzard_platform_data {
5 void (*power_up)(struct device *dev);
6 void (*power_down)(struct device *dev);
7 unsigned long (*get_clock_rate)(struct device *dev);
8
9 unsigned te_connected : 1;
10};
11
12#endif
diff --git a/arch/arm/plat-omap/include/mach/board-2430sdp.h b/arch/arm/plat-omap/include/mach/board-2430sdp.h
new file mode 100644
index 000000000000..cf1dc0223949
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-2430sdp.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-2430sdp.h
3 *
4 * Hardware definitions for TI OMAP2430 SDP board.
5 *
6 * Based on board-h4.h by Dirk Behme <dirk.behme@de.bosch.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29#ifndef __ASM_ARCH_OMAP_2430SDP_H
30#define __ASM_ARCH_OMAP_2430SDP_H
31
32/* Placeholder for 2430SDP specific defines */
33#define OMAP24XX_ETHR_START 0x08000300
34#define OMAP24XX_ETHR_GPIO_IRQ 149
35#define SDP2430_CS0_BASE 0x04000000
36
37#define TWL4030_IRQNUM INT_24XX_SYS_NIRQ
38
39#endif /* __ASM_ARCH_OMAP_2430SDP_H */
diff --git a/arch/arm/plat-omap/include/mach/board-ams-delta.h b/arch/arm/plat-omap/include/mach/board-ams-delta.h
new file mode 100644
index 000000000000..51b102dc906b
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-ams-delta.h
@@ -0,0 +1,76 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-ams-delta.h
3 *
4 * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26#ifndef __ASM_ARCH_OMAP_AMS_DELTA_H
27#define __ASM_ARCH_OMAP_AMS_DELTA_H
28
29#if defined (CONFIG_MACH_AMS_DELTA)
30
31#define AMS_DELTA_LATCH1_PHYS 0x01000000
32#define AMS_DELTA_LATCH1_VIRT 0xEA000000
33#define AMS_DELTA_MODEM_PHYS 0x04000000
34#define AMS_DELTA_MODEM_VIRT 0xEB000000
35#define AMS_DELTA_LATCH2_PHYS 0x08000000
36#define AMS_DELTA_LATCH2_VIRT 0xEC000000
37
38#define AMS_DELTA_LATCH1_LED_CAMERA 0x01
39#define AMS_DELTA_LATCH1_LED_ADVERT 0x02
40#define AMS_DELTA_LATCH1_LED_EMAIL 0x04
41#define AMS_DELTA_LATCH1_LED_HANDSFREE 0x08
42#define AMS_DELTA_LATCH1_LED_VOICEMAIL 0x10
43#define AMS_DELTA_LATCH1_LED_VOICE 0x20
44
45#define AMS_DELTA_LATCH2_LCD_VBLEN 0x0001
46#define AMS_DELTA_LATCH2_LCD_NDISP 0x0002
47#define AMS_DELTA_LATCH2_NAND_NCE 0x0004
48#define AMS_DELTA_LATCH2_NAND_NRE 0x0008
49#define AMS_DELTA_LATCH2_NAND_NWP 0x0010
50#define AMS_DELTA_LATCH2_NAND_NWE 0x0020
51#define AMS_DELTA_LATCH2_NAND_ALE 0x0040
52#define AMS_DELTA_LATCH2_NAND_CLE 0x0080
53#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
54#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
55#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
56#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
57#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000
58#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000
59
60#define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0
61#define AMS_DELTA_GPIO_PIN_KEYBRD_CLK 1
62#define AMS_DELTA_GPIO_PIN_MODEM_IRQ 2
63#define AMS_DELTA_GPIO_PIN_HOOK_SWITCH 4
64#define AMS_DELTA_GPIO_PIN_SCARD_NOFF 6
65#define AMS_DELTA_GPIO_PIN_SCARD_IO 7
66#define AMS_DELTA_GPIO_PIN_CONFIG 11
67#define AMS_DELTA_GPIO_PIN_NAND_RB 12
68
69#ifndef __ASSEMBLY__
70void ams_delta_latch1_write(u8 mask, u8 value);
71void ams_delta_latch2_write(u16 mask, u16 value);
72#endif
73
74#endif /* CONFIG_MACH_AMS_DELTA */
75
76#endif /* __ASM_ARCH_OMAP_AMS_DELTA_H */
diff --git a/arch/arm/plat-omap/include/mach/board-apollon.h b/arch/arm/plat-omap/include/mach/board-apollon.h
new file mode 100644
index 000000000000..d6f2a8e963d5
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-apollon.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-apollon.h
3 *
4 * Hardware definitions for Samsung OMAP24XX Apollon board.
5 *
6 * Initial creation by Kyungmin Park <kyungmin.park@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29#ifndef __ASM_ARCH_OMAP_APOLLON_H
30#define __ASM_ARCH_OMAP_APOLLON_H
31
32extern void apollon_mmc_init(void);
33
34/* Placeholder for APOLLON specific defines */
35#define APOLLON_ETHR_GPIO_IRQ 74
36
37#endif /* __ASM_ARCH_OMAP_APOLLON_H */
38
diff --git a/arch/arm/plat-omap/include/mach/board-fsample.h b/arch/arm/plat-omap/include/mach/board-fsample.h
new file mode 100644
index 000000000000..cb3c5ae12776
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-fsample.h
@@ -0,0 +1,51 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-fsample.h
3 *
4 * Board-specific goodies for TI F-Sample.
5 *
6 * Copyright (C) 2006 Google, Inc.
7 * Author: Brian Swetland <swetland@google.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_OMAP_FSAMPLE_H
15#define __ASM_ARCH_OMAP_FSAMPLE_H
16
17/* fsample is pretty close to p2-sample */
18#include <mach/board-perseus2.h>
19
20#define fsample_cpld_read(reg) __raw_readb(reg)
21#define fsample_cpld_write(val, reg) __raw_writeb(val, reg)
22
23#define FSAMPLE_CPLD_BASE 0xE8100000
24#define FSAMPLE_CPLD_SIZE SZ_4K
25#define FSAMPLE_CPLD_START 0x05080000
26
27#define FSAMPLE_CPLD_REG_A (FSAMPLE_CPLD_BASE + 0x00)
28#define FSAMPLE_CPLD_SWITCH (FSAMPLE_CPLD_BASE + 0x02)
29#define FSAMPLE_CPLD_UART (FSAMPLE_CPLD_BASE + 0x02)
30#define FSAMPLE_CPLD_REG_B (FSAMPLE_CPLD_BASE + 0x04)
31#define FSAMPLE_CPLD_VERSION (FSAMPLE_CPLD_BASE + 0x06)
32#define FSAMPLE_CPLD_SET_CLR (FSAMPLE_CPLD_BASE + 0x06)
33
34#define FSAMPLE_CPLD_BIT_BT_RESET 0
35#define FSAMPLE_CPLD_BIT_LCD_RESET 1
36#define FSAMPLE_CPLD_BIT_CAM_PWDN 2
37#define FSAMPLE_CPLD_BIT_CHARGER_ENABLE 3
38#define FSAMPLE_CPLD_BIT_SD_MMC_EN 4
39#define FSAMPLE_CPLD_BIT_aGPS_PWREN 5
40#define FSAMPLE_CPLD_BIT_BACKLIGHT 6
41#define FSAMPLE_CPLD_BIT_aGPS_EN_RESET 7
42#define FSAMPLE_CPLD_BIT_aGPS_SLEEPx_N 8
43#define FSAMPLE_CPLD_BIT_OTG_RESET 9
44
45#define fsample_cpld_set(bit) \
46 fsample_cpld_write((((bit) & 15) << 4) | 0x0f, FSAMPLE_CPLD_SET_CLR)
47
48#define fsample_cpld_clear(bit) \
49 fsample_cpld_write(0xf0 | ((bit) & 15), FSAMPLE_CPLD_SET_CLR)
50
51#endif
diff --git a/arch/arm/plat-omap/include/mach/board-h2.h b/arch/arm/plat-omap/include/mach/board-h2.h
new file mode 100644
index 000000000000..2a050e9be65f
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-h2.h
@@ -0,0 +1,41 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-h2.h
3 *
4 * Hardware definitions for TI OMAP1610 H2 board.
5 *
6 * Cleanup for Linux-2.6 by Dirk Behme <dirk.behme@de.bosch.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29#ifndef __ASM_ARCH_OMAP_H2_H
30#define __ASM_ARCH_OMAP_H2_H
31
32/* Placeholder for H2 specific defines */
33
34/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
35#define OMAP1610_ETHR_START 0x04000300
36
37extern void h2_mmc_init(void);
38extern void h2_mmc_slot_cover_handler(void *arg, int state);
39
40#endif /* __ASM_ARCH_OMAP_H2_H */
41
diff --git a/arch/arm/plat-omap/include/mach/board-h3.h b/arch/arm/plat-omap/include/mach/board-h3.h
new file mode 100644
index 000000000000..14909dc7858a
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-h3.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-h3.h
3 *
4 * Copyright (C) 2001 RidgeRun, Inc.
5 * Copyright (C) 2004 Texas Instruments, Inc.
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#ifndef __ASM_ARCH_OMAP_H3_H
28#define __ASM_ARCH_OMAP_H3_H
29
30/* In OMAP1710 H3 the Ethernet is directly connected to CS1 */
31#define OMAP1710_ETHR_START 0x04000300
32
33extern void h3_mmc_init(void);
34extern void h3_mmc_slot_cover_handler(void *arg, int state);
35
36#endif /* __ASM_ARCH_OMAP_H3_H */
diff --git a/arch/arm/plat-omap/include/mach/board-h4.h b/arch/arm/plat-omap/include/mach/board-h4.h
new file mode 100644
index 000000000000..1470cd3e519b
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-h4.h
@@ -0,0 +1,35 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-h4.h
3 *
4 * Hardware definitions for TI OMAP1610 H4 board.
5 *
6 * Initial creation by Dirk Behme <dirk.behme@de.bosch.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29#ifndef __ASM_ARCH_OMAP_H4_H
30#define __ASM_ARCH_OMAP_H4_H
31
32/* Placeholder for H4 specific defines */
33#define OMAP24XX_ETHR_GPIO_IRQ 92
34#endif /* __ASM_ARCH_OMAP_H4_H */
35
diff --git a/arch/arm/plat-omap/include/mach/board-innovator.h b/arch/arm/plat-omap/include/mach/board-innovator.h
new file mode 100644
index 000000000000..5ae3e79b9f9c
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-innovator.h
@@ -0,0 +1,52 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-innovator.h
3 *
4 * Copyright (C) 2001 RidgeRun, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26#ifndef __ASM_ARCH_OMAP_INNOVATOR_H
27#define __ASM_ARCH_OMAP_INNOVATOR_H
28
29#if defined (CONFIG_ARCH_OMAP15XX)
30
31#ifndef OMAP_SDRAM_DEVICE
32#define OMAP_SDRAM_DEVICE D256M_1X16_4B
33#endif
34
35#define OMAP1510P1_IMIF_PRI_VALUE 0x00
36#define OMAP1510P1_EMIFS_PRI_VALUE 0x00
37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00
38
39#ifndef __ASSEMBLY__
40void fpga_write(unsigned char val, int reg);
41unsigned char fpga_read(int reg);
42#endif
43
44#endif /* CONFIG_ARCH_OMAP15XX */
45
46#if defined (CONFIG_ARCH_OMAP16XX)
47
48/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
49#define INNOVATOR1610_ETHR_START 0x04000300
50
51#endif /* CONFIG_ARCH_OMAP1610 */
52#endif /* __ASM_ARCH_OMAP_INNOVATOR_H */
diff --git a/arch/arm/plat-omap/include/mach/board-nokia.h b/arch/arm/plat-omap/include/mach/board-nokia.h
new file mode 100644
index 000000000000..2abbe001af8c
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-nokia.h
@@ -0,0 +1,54 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-nokia.h
3 *
4 * Information structures for Nokia-specific board config data
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 */
8
9#ifndef _OMAP_BOARD_NOKIA_H
10#define _OMAP_BOARD_NOKIA_H
11
12#include <linux/types.h>
13
14#define OMAP_TAG_NOKIA_BT 0x4e01
15#define OMAP_TAG_WLAN_CX3110X 0x4e02
16#define OMAP_TAG_CBUS 0x4e03
17#define OMAP_TAG_EM_ASIC_BB5 0x4e04
18
19
20#define BT_CHIP_CSR 1
21#define BT_CHIP_TI 2
22
23#define BT_SYSCLK_12 1
24#define BT_SYSCLK_38_4 2
25
26struct omap_bluetooth_config {
27 u8 chip_type;
28 u8 bt_wakeup_gpio;
29 u8 host_wakeup_gpio;
30 u8 reset_gpio;
31 u8 bt_uart;
32 u8 bd_addr[6];
33 u8 bt_sysclk;
34};
35
36struct omap_wlan_cx3110x_config {
37 u8 chip_type;
38 s16 power_gpio;
39 s16 irq_gpio;
40 s16 spi_cs_gpio;
41};
42
43struct omap_cbus_config {
44 s16 clk_gpio;
45 s16 dat_gpio;
46 s16 sel_gpio;
47};
48
49struct omap_em_asic_bb5_config {
50 s16 retu_irq_gpio;
51 s16 tahvo_irq_gpio;
52};
53
54#endif
diff --git a/arch/arm/plat-omap/include/mach/board-osk.h b/arch/arm/plat-omap/include/mach/board-osk.h
new file mode 100644
index 000000000000..3850cb1f220a
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-osk.h
@@ -0,0 +1,47 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-osk.h
3 *
4 * Hardware definitions for TI OMAP5912 OSK board.
5 *
6 * Written by Dirk Behme <dirk.behme@de.bosch.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29#ifndef __ASM_ARCH_OMAP_OSK_H
30#define __ASM_ARCH_OMAP_OSK_H
31
32/* At OMAP5912 OSK the Ethernet is directly connected to CS1 */
33#define OMAP_OSK_ETHR_START 0x04800300
34
35/* TPS65010 has four GPIOs. nPG and LED2 can be treated like GPIOs with
36 * alternate pin configurations for hardware-controlled blinking.
37 */
38#define OSK_TPS_GPIO_BASE (OMAP_MAX_GPIO_LINES + 16 /* MPUIO */)
39# define OSK_TPS_GPIO_USB_PWR_EN (OSK_TPS_GPIO_BASE + 0)
40# define OSK_TPS_GPIO_LED_D3 (OSK_TPS_GPIO_BASE + 1)
41# define OSK_TPS_GPIO_LAN_RESET (OSK_TPS_GPIO_BASE + 2)
42# define OSK_TPS_GPIO_DSP_PWR_EN (OSK_TPS_GPIO_BASE + 3)
43# define OSK_TPS_GPIO_LED_D9 (OSK_TPS_GPIO_BASE + 4)
44# define OSK_TPS_GPIO_LED_D2 (OSK_TPS_GPIO_BASE + 5)
45
46#endif /* __ASM_ARCH_OMAP_OSK_H */
47
diff --git a/arch/arm/plat-omap/include/mach/board-palmte.h b/arch/arm/plat-omap/include/mach/board-palmte.h
new file mode 100644
index 000000000000..6906cdebbcfb
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-palmte.h
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-palmte.h
3 *
4 * Hardware definitions for the Palm Tungsten E device.
5 *
6 * Maintainters : http://palmtelinux.sf.net
7 * palmtelinux-developpers@lists.sf.net
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __OMAP_BOARD_PALMTE_H
15#define __OMAP_BOARD_PALMTE_H
16
17#define PALMTE_USBDETECT_GPIO 0
18#define PALMTE_USB_OR_DC_GPIO 1
19#define PALMTE_TSC_GPIO 4
20#define PALMTE_PINTDAV_GPIO 6
21#define PALMTE_MMC_WP_GPIO 8
22#define PALMTE_MMC_POWER_GPIO 9
23#define PALMTE_HDQ_GPIO 11
24#define PALMTE_HEADPHONES_GPIO 14
25#define PALMTE_SPEAKER_GPIO 15
26#define PALMTE_DC_GPIO OMAP_MPUIO(2)
27#define PALMTE_MMC_SWITCH_GPIO OMAP_MPUIO(4)
28#define PALMTE_MMC1_GPIO OMAP_MPUIO(6)
29#define PALMTE_MMC2_GPIO OMAP_MPUIO(7)
30#define PALMTE_MMC3_GPIO OMAP_MPUIO(11)
31
32#endif /* __OMAP_BOARD_PALMTE_H */
diff --git a/arch/arm/plat-omap/include/mach/board-palmtt.h b/arch/arm/plat-omap/include/mach/board-palmtt.h
new file mode 100644
index 000000000000..e79f382b5931
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-palmtt.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-palmte.h
3 *
4 * Hardware definitions for the Palm Tungsten|T device.
5 *
6 * Maintainters : Marek Vasut <marek.vasut@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __OMAP_BOARD_PALMTT_H
14#define __OMAP_BOARD_PALMTT_H
15
16#define PALMTT_USBDETECT_GPIO 0
17#define PALMTT_CABLE_GPIO 1
18#define PALMTT_LED_GPIO 3
19#define PALMTT_PENIRQ_GPIO 6
20#define PALMTT_MMC_WP_GPIO 8
21#define PALMTT_HDQ_GPIO 11
22
23#endif /* __OMAP_BOARD_PALMTT_H */
diff --git a/arch/arm/plat-omap/include/mach/board-palmz71.h b/arch/arm/plat-omap/include/mach/board-palmz71.h
new file mode 100644
index 000000000000..b1d7d579b313
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-palmz71.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-palmz71.h
3 *
4 * Hardware definitions for the Palm Zire71 device.
5 *
6 * Maintainters : Marek Vasut <marek.vasut@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __OMAP_BOARD_PALMZ71_H
14#define __OMAP_BOARD_PALMZ71_H
15
16#define PALMZ71_USBDETECT_GPIO 0
17#define PALMZ71_PENIRQ_GPIO 6
18#define PALMZ71_MMC_WP_GPIO 8
19#define PALMZ71_HDQ_GPIO 11
20
21#define PALMZ71_HOTSYNC_GPIO OMAP_MPUIO(1)
22#define PALMZ71_CABLE_GPIO OMAP_MPUIO(2)
23#define PALMZ71_SLIDER_GPIO OMAP_MPUIO(3)
24#define PALMZ71_MMC_IN_GPIO OMAP_MPUIO(4)
25
26#endif /* __OMAP_BOARD_PALMZ71_H */
diff --git a/arch/arm/plat-omap/include/mach/board-perseus2.h b/arch/arm/plat-omap/include/mach/board-perseus2.h
new file mode 100644
index 000000000000..c06c3d717d57
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-perseus2.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/plat-omap/include/mach/board-perseus2.h
3 *
4 * Copyright 2003 by Texas Instruments Incorporated
5 * OMAP730 / Perseus2 support by Jean Pihet
6 *
7 * Copyright (C) 2001 RidgeRun, Inc. (http://www.ridgerun.com)
8 * Author: RidgeRun, 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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30#ifndef __ASM_ARCH_OMAP_PERSEUS2_H
31#define __ASM_ARCH_OMAP_PERSEUS2_H
32
33#include <mach/fpga.h>
34
35#ifndef OMAP_SDRAM_DEVICE
36#define OMAP_SDRAM_DEVICE D256M_1X16_4B
37#endif
38
39#endif
diff --git a/arch/arm/plat-omap/include/mach/board-sx1.h b/arch/arm/plat-omap/include/mach/board-sx1.h
new file mode 100644
index 000000000000..355adbdaae33
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-sx1.h
@@ -0,0 +1,52 @@
1/*
2 * Siemens SX1 board definitions
3 *
4 * Copyright: Vovan888 at gmail com
5 *
6 * This package is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
11 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 */
14
15#ifndef __ASM_ARCH_SX1_I2C_CHIPS_H
16#define __ASM_ARCH_SX1_I2C_CHIPS_H
17
18#define SOFIA_MAX_LIGHT_VAL 0x2B
19
20#define SOFIA_I2C_ADDR 0x32
21/* Sofia reg 3 bits masks */
22#define SOFIA_POWER1_REG 0x03
23
24#define SOFIA_USB_POWER 0x01
25#define SOFIA_MMC_POWER 0x04
26#define SOFIA_BLUETOOTH_POWER 0x08
27#define SOFIA_MMILIGHT_POWER 0x20
28
29#define SOFIA_POWER2_REG 0x04
30#define SOFIA_BACKLIGHT_REG 0x06
31#define SOFIA_KEYLIGHT_REG 0x07
32#define SOFIA_DIMMING_REG 0x09
33
34
35/* Function Prototypes for SX1 devices control on I2C bus */
36
37int sx1_setbacklight(u8 backlight);
38int sx1_getbacklight(u8 *backlight);
39int sx1_setkeylight(u8 keylight);
40int sx1_getkeylight(u8 *keylight);
41
42int sx1_setmmipower(u8 onoff);
43int sx1_setusbpower(u8 onoff);
44int sx1_i2c_read_byte(u8 devaddr, u8 regoffset, u8 *value);
45int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value);
46
47/* MMC prototypes */
48
49extern void sx1_mmc_init(void);
50extern void sx1_mmc_slot_cover_handler(void *arg, int state);
51
52#endif /* __ASM_ARCH_SX1_I2C_CHIPS_H */
diff --git a/arch/arm/plat-omap/include/mach/board-voiceblue.h b/arch/arm/plat-omap/include/mach/board-voiceblue.h
new file mode 100644
index 000000000000..ed6d346ee123
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board-voiceblue.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2004 2N Telekomunikace, Ladislav Michl <michl@2n.cz>
3 *
4 * Hardware definitions for OMAP5910 based VoiceBlue board.
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_VOICEBLUE_H
12#define __ASM_ARCH_VOICEBLUE_H
13
14extern void voiceblue_wdt_enable(void);
15extern void voiceblue_wdt_disable(void);
16extern void voiceblue_wdt_ping(void);
17extern void voiceblue_reset(void);
18
19#endif /* __ASM_ARCH_VOICEBLUE_H */
20
diff --git a/arch/arm/plat-omap/include/mach/board.h b/arch/arm/plat-omap/include/mach/board.h
new file mode 100644
index 000000000000..54445642f35d
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/board.h
@@ -0,0 +1,186 @@
1/*
2 * arch/arm/plat-omap/include/mach/board.h
3 *
4 * Information structures for board-specific data
5 *
6 * Copyright (C) 2004 Nokia Corporation
7 * Written by Juha Yrjölä <juha.yrjola@nokia.com>
8 */
9
10#ifndef _OMAP_BOARD_H
11#define _OMAP_BOARD_H
12
13#include <linux/types.h>
14
15#include <mach/gpio-switch.h>
16
17/* Different peripheral ids */
18#define OMAP_TAG_CLOCK 0x4f01
19#define OMAP_TAG_MMC 0x4f02
20#define OMAP_TAG_SERIAL_CONSOLE 0x4f03
21#define OMAP_TAG_USB 0x4f04
22#define OMAP_TAG_LCD 0x4f05
23#define OMAP_TAG_GPIO_SWITCH 0x4f06
24#define OMAP_TAG_UART 0x4f07
25#define OMAP_TAG_FBMEM 0x4f08
26#define OMAP_TAG_STI_CONSOLE 0x4f09
27#define OMAP_TAG_CAMERA_SENSOR 0x4f0a
28
29#define OMAP_TAG_BOOT_REASON 0x4f80
30#define OMAP_TAG_FLASH_PART 0x4f81
31#define OMAP_TAG_VERSION_STR 0x4f82
32
33struct omap_clock_config {
34 /* 0 for 12 MHz, 1 for 13 MHz and 2 for 19.2 MHz */
35 u8 system_clock_type;
36};
37
38struct omap_mmc_conf {
39 unsigned enabled:1;
40 /* nomux means "standard" muxing is wrong on this board, and that
41 * board-specific code handled it before common init logic.
42 */
43 unsigned nomux:1;
44 /* switch pin can be for card detect (default) or card cover */
45 unsigned cover:1;
46 /* 4 wire signaling is optional, and is only used for SD/SDIO */
47 unsigned wire4:1;
48 s16 power_pin;
49 s16 switch_pin;
50 s16 wp_pin;
51};
52
53struct omap_mmc_config {
54 struct omap_mmc_conf mmc[2];
55};
56
57struct omap_serial_console_config {
58 u8 console_uart;
59 u32 console_speed;
60};
61
62struct omap_sti_console_config {
63 unsigned enable:1;
64 u8 channel;
65};
66
67struct omap_camera_sensor_config {
68 u16 reset_gpio;
69 int (*power_on)(void * data);
70 int (*power_off)(void * data);
71};
72
73struct omap_usb_config {
74 /* Configure drivers according to the connectors on your board:
75 * - "A" connector (rectagular)
76 * ... for host/OHCI use, set "register_host".
77 * - "B" connector (squarish) or "Mini-B"
78 * ... for device/gadget use, set "register_dev".
79 * - "Mini-AB" connector (very similar to Mini-B)
80 * ... for OTG use as device OR host, initialize "otg"
81 */
82 unsigned register_host:1;
83 unsigned register_dev:1;
84 u8 otg; /* port number, 1-based: usb1 == 2 */
85
86 u8 hmc_mode;
87
88 /* implicitly true if otg: host supports remote wakeup? */
89 u8 rwc;
90
91 /* signaling pins used to talk to transceiver on usbN:
92 * 0 == usbN unused
93 * 2 == usb0-only, using internal transceiver
94 * 3 == 3 wire bidirectional
95 * 4 == 4 wire bidirectional
96 * 6 == 6 wire unidirectional (or TLL)
97 */
98 u8 pins[3];
99};
100
101struct omap_lcd_config {
102 char panel_name[16];
103 char ctrl_name[16];
104 s16 nreset_gpio;
105 u8 data_lines;
106};
107
108struct device;
109struct fb_info;
110struct omap_backlight_config {
111 int default_intensity;
112 int (*set_power)(struct device *dev, int state);
113 int (*check_fb)(struct fb_info *fb);
114};
115
116struct omap_fbmem_config {
117 u32 start;
118 u32 size;
119};
120
121struct omap_pwm_led_platform_data {
122 const char *name;
123 int intensity_timer;
124 int blink_timer;
125 void (*set_power)(struct omap_pwm_led_platform_data *self, int on_off);
126};
127
128/* See arch/arm/plat-omap/include/mach/gpio-switch.h for definitions */
129struct omap_gpio_switch_config {
130 char name[12];
131 u16 gpio;
132 int flags:4;
133 int type:4;
134 int key_code:24; /* Linux key code */
135};
136
137struct omap_uart_config {
138 /* Bit field of UARTs present; bit 0 --> UART1 */
139 unsigned int enabled_uarts;
140};
141
142
143struct omap_flash_part_config {
144 char part_table[0];
145};
146
147struct omap_boot_reason_config {
148 char reason_str[12];
149};
150
151struct omap_version_config {
152 char component[12];
153 char version[12];
154};
155
156
157#include <mach/board-nokia.h>
158
159struct omap_board_config_entry {
160 u16 tag;
161 u16 len;
162 u8 data[0];
163};
164
165struct omap_board_config_kernel {
166 u16 tag;
167 const void *data;
168};
169
170extern const void *__omap_get_config(u16 tag, size_t len, int nr);
171
172#define omap_get_config(tag, type) \
173 ((const type *) __omap_get_config((tag), sizeof(type), 0))
174#define omap_get_nr_config(tag, type, nr) \
175 ((const type *) __omap_get_config((tag), sizeof(type), (nr)))
176
177extern const void *omap_get_var_config(u16 tag, size_t *len);
178
179extern struct omap_board_config_kernel *omap_board_config;
180extern int omap_board_config_size;
181
182
183/* for TI reference platforms sharing the same debug card */
184extern int debug_card_init(u32 addr, unsigned gpio);
185
186#endif
diff --git a/arch/arm/plat-omap/include/mach/clock.h b/arch/arm/plat-omap/include/mach/clock.h
new file mode 100644
index 000000000000..92f7c7238fcd
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/clock.h
@@ -0,0 +1,162 @@
1/*
2 * arch/arm/plat-omap/include/mach/clock.h
3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ARCH_ARM_OMAP_CLOCK_H
14#define __ARCH_ARM_OMAP_CLOCK_H
15
16struct module;
17struct clk;
18
19#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
20
21struct clksel_rate {
22 u8 div;
23 u32 val;
24 u8 flags;
25};
26
27struct clksel {
28 struct clk *parent;
29 const struct clksel_rate *rates;
30};
31
32struct dpll_data {
33 void __iomem *mult_div1_reg;
34 u32 mult_mask;
35 u32 div1_mask;
36 u16 last_rounded_m;
37 u8 last_rounded_n;
38 unsigned long last_rounded_rate;
39 unsigned int rate_tolerance;
40 u16 max_multiplier;
41 u8 max_divider;
42 u32 max_tolerance;
43# if defined(CONFIG_ARCH_OMAP3)
44 u8 modes;
45 void __iomem *control_reg;
46 u32 enable_mask;
47 u8 auto_recal_bit;
48 u8 recal_en_bit;
49 u8 recal_st_bit;
50 void __iomem *autoidle_reg;
51 u32 autoidle_mask;
52 void __iomem *idlest_reg;
53 u8 idlest_bit;
54# endif
55};
56
57#endif
58
59struct clk {
60 struct list_head node;
61 struct module *owner;
62 const char *name;
63 int id;
64 struct clk *parent;
65 unsigned long rate;
66 __u32 flags;
67 void __iomem *enable_reg;
68 __u8 enable_bit;
69 __s8 usecount;
70 void (*recalc)(struct clk *);
71 int (*set_rate)(struct clk *, unsigned long);
72 long (*round_rate)(struct clk *, unsigned long);
73 void (*init)(struct clk *);
74 int (*enable)(struct clk *);
75 void (*disable)(struct clk *);
76#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
77 u8 fixed_div;
78 void __iomem *clksel_reg;
79 u32 clksel_mask;
80 const struct clksel *clksel;
81 struct dpll_data *dpll_data;
82#else
83 __u8 rate_offset;
84 __u8 src_offset;
85#endif
86#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
87 struct dentry *dent; /* For visible tree hierarchy */
88#endif
89};
90
91struct cpufreq_frequency_table;
92
93struct clk_functions {
94 int (*clk_enable)(struct clk *clk);
95 void (*clk_disable)(struct clk *clk);
96 long (*clk_round_rate)(struct clk *clk, unsigned long rate);
97 int (*clk_set_rate)(struct clk *clk, unsigned long rate);
98 int (*clk_set_parent)(struct clk *clk, struct clk *parent);
99 struct clk * (*clk_get_parent)(struct clk *clk);
100 void (*clk_allow_idle)(struct clk *clk);
101 void (*clk_deny_idle)(struct clk *clk);
102 void (*clk_disable_unused)(struct clk *clk);
103#ifdef CONFIG_CPU_FREQ
104 void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **);
105#endif
106};
107
108extern unsigned int mpurate;
109
110extern int clk_init(struct clk_functions * custom_clocks);
111extern int clk_register(struct clk *clk);
112extern void clk_unregister(struct clk *clk);
113extern void propagate_rate(struct clk *clk);
114extern void recalculate_root_clocks(void);
115extern void followparent_recalc(struct clk * clk);
116extern void clk_allow_idle(struct clk *clk);
117extern void clk_deny_idle(struct clk *clk);
118extern int clk_get_usecount(struct clk *clk);
119extern void clk_enable_init_clocks(void);
120
121/* Clock flags */
122#define RATE_CKCTL (1 << 0) /* Main fixed ratio clocks */
123#define RATE_FIXED (1 << 1) /* Fixed clock rate */
124#define RATE_PROPAGATES (1 << 2) /* Program children too */
125#define VIRTUAL_CLOCK (1 << 3) /* Composite clock from table */
126#define ALWAYS_ENABLED (1 << 4) /* Clock cannot be disabled */
127#define ENABLE_REG_32BIT (1 << 5) /* Use 32-bit access */
128#define VIRTUAL_IO_ADDRESS (1 << 6) /* Clock in virtual address */
129#define CLOCK_IDLE_CONTROL (1 << 7)
130#define CLOCK_NO_IDLE_PARENT (1 << 8)
131#define DELAYED_APP (1 << 9) /* Delay application of clock */
132#define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */
133#define ENABLE_ON_INIT (1 << 11) /* Enable upon framework init */
134#define INVERT_ENABLE (1 << 12) /* 0 enables, 1 disables */
135/* bits 13-20 are currently free */
136#define CLOCK_IN_OMAP310 (1 << 21)
137#define CLOCK_IN_OMAP730 (1 << 22)
138#define CLOCK_IN_OMAP1510 (1 << 23)
139#define CLOCK_IN_OMAP16XX (1 << 24)
140#define CLOCK_IN_OMAP242X (1 << 25)
141#define CLOCK_IN_OMAP243X (1 << 26)
142#define CLOCK_IN_OMAP343X (1 << 27) /* clocks common to all 343X */
143#define PARENT_CONTROLS_CLOCK (1 << 28)
144#define CLOCK_IN_OMAP3430ES1 (1 << 29) /* 3430ES1 clocks only */
145#define CLOCK_IN_OMAP3430ES2 (1 << 30) /* 3430ES2 clocks only */
146
147/* Clksel_rate flags */
148#define DEFAULT_RATE (1 << 0)
149#define RATE_IN_242X (1 << 1)
150#define RATE_IN_243X (1 << 2)
151#define RATE_IN_343X (1 << 3) /* rates common to all 343X */
152#define RATE_IN_3430ES2 (1 << 4) /* 3430ES2 rates only */
153
154#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
155
156
157/* CM_CLKSEL2_PLL.CORE_CLK_SRC options (24XX) */
158#define CORE_CLK_SRC_32K 0
159#define CORE_CLK_SRC_DPLL 1
160#define CORE_CLK_SRC_DPLL_X2 2
161
162#endif
diff --git a/arch/arm/plat-omap/include/mach/common.h b/arch/arm/plat-omap/include/mach/common.h
new file mode 100644
index 000000000000..06093112b665
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/common.h
@@ -0,0 +1,69 @@
1/*
2 * arch/arm/plat-omap/include/mach/common.h
3 *
4 * Header for code common to all OMAP machines.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
28#define __ARCH_ARM_MACH_OMAP_COMMON_H
29
30#include <linux/i2c.h>
31
32struct sys_timer;
33
34extern void omap_map_common_io(void);
35extern struct sys_timer omap_timer;
36extern void omap_serial_init(void);
37#ifdef CONFIG_I2C_OMAP
38extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
39 struct i2c_board_info const *info,
40 unsigned len);
41#else
42static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
43 struct i2c_board_info const *info,
44 unsigned len)
45{
46 return 0;
47}
48#endif
49
50/* IO bases for various OMAP processors */
51struct omap_globals {
52 void __iomem *tap; /* Control module ID code */
53 void __iomem *sdrc; /* SDRAM Controller */
54 void __iomem *sms; /* SDRAM Memory Scheduler */
55 void __iomem *ctrl; /* System Control Module */
56 void __iomem *prm; /* Power and Reset Management */
57 void __iomem *cm; /* Clock Management */
58};
59
60void omap2_set_globals_242x(void);
61void omap2_set_globals_243x(void);
62void omap2_set_globals_343x(void);
63
64/* These get called from omap2_set_globals_xxxx(), do not call these */
65void omap2_set_globals_memory(struct omap_globals *);
66void omap2_set_globals_control(struct omap_globals *);
67void omap2_set_globals_prcm(struct omap_globals *);
68
69#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
diff --git a/arch/arm/plat-omap/include/mach/control.h b/arch/arm/plat-omap/include/mach/control.h
new file mode 100644
index 000000000000..e3fd62d9a995
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/control.h
@@ -0,0 +1,189 @@
1#ifndef __ASM_ARCH_CONTROL_H
2#define __ASM_ARCH_CONTROL_H
3
4/*
5 * arch/arm/plat-omap/include/mach/control.h
6 *
7 * OMAP2/3 System Control Module definitions
8 *
9 * Copyright (C) 2007 Texas Instruments, Inc.
10 * Copyright (C) 2007 Nokia Corporation
11 *
12 * Written by Paul Walmsley
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation.
17 */
18
19#include <mach/io.h>
20
21#define OMAP242X_CTRL_REGADDR(reg) \
22 (void __iomem *)IO_ADDRESS(OMAP242X_CTRL_BASE + (reg))
23#define OMAP243X_CTRL_REGADDR(reg) \
24 (void __iomem *)IO_ADDRESS(OMAP243X_CTRL_BASE + (reg))
25#define OMAP343X_CTRL_REGADDR(reg) \
26 (void __iomem *)IO_ADDRESS(OMAP343X_CTRL_BASE + (reg))
27
28/*
29 * As elsewhere, the "OMAP2_" prefix indicates that the macro is valid for
30 * OMAP24XX and OMAP34XX.
31 */
32
33/* Control submodule offsets */
34
35#define OMAP2_CONTROL_INTERFACE 0x000
36#define OMAP2_CONTROL_PADCONFS 0x030
37#define OMAP2_CONTROL_GENERAL 0x270
38#define OMAP343X_CONTROL_MEM_WKUP 0x600
39#define OMAP343X_CONTROL_PADCONFS_WKUP 0xa00
40#define OMAP343X_CONTROL_GENERAL_WKUP 0xa60
41
42/* Control register offsets - read/write with omap_ctrl_{read,write}{bwl}() */
43
44#define OMAP2_CONTROL_SYSCONFIG (OMAP2_CONTROL_INTERFACE + 0x10)
45
46/* CONTROL_GENERAL register offsets common to OMAP2 & 3 */
47#define OMAP2_CONTROL_DEVCONF0 (OMAP2_CONTROL_GENERAL + 0x0004)
48#define OMAP2_CONTROL_MSUSPENDMUX_0 (OMAP2_CONTROL_GENERAL + 0x0020)
49#define OMAP2_CONTROL_MSUSPENDMUX_1 (OMAP2_CONTROL_GENERAL + 0x0024)
50#define OMAP2_CONTROL_MSUSPENDMUX_2 (OMAP2_CONTROL_GENERAL + 0x0028)
51#define OMAP2_CONTROL_MSUSPENDMUX_3 (OMAP2_CONTROL_GENERAL + 0x002c)
52#define OMAP2_CONTROL_MSUSPENDMUX_4 (OMAP2_CONTROL_GENERAL + 0x0030)
53#define OMAP2_CONTROL_MSUSPENDMUX_5 (OMAP2_CONTROL_GENERAL + 0x0034)
54#define OMAP2_CONTROL_SEC_CTRL (OMAP2_CONTROL_GENERAL + 0x0040)
55#define OMAP2_CONTROL_RPUB_KEY_H_0 (OMAP2_CONTROL_GENERAL + 0x0090)
56#define OMAP2_CONTROL_RPUB_KEY_H_1 (OMAP2_CONTROL_GENERAL + 0x0094)
57#define OMAP2_CONTROL_RPUB_KEY_H_2 (OMAP2_CONTROL_GENERAL + 0x0098)
58#define OMAP2_CONTROL_RPUB_KEY_H_3 (OMAP2_CONTROL_GENERAL + 0x009c)
59
60/* 242x-only CONTROL_GENERAL register offsets */
61#define OMAP242X_CONTROL_DEVCONF OMAP2_CONTROL_DEVCONF0 /* match TRM */
62#define OMAP242X_CONTROL_OCM_RAM_PERM (OMAP2_CONTROL_GENERAL + 0x0068)
63
64/* 243x-only CONTROL_GENERAL register offsets */
65/* CONTROL_IVA2_BOOT{ADDR,MOD} are at the same place on 343x - noted below */
66#define OMAP243X_CONTROL_DEVCONF1 (OMAP2_CONTROL_GENERAL + 0x0078)
67#define OMAP243X_CONTROL_CSIRXFE (OMAP2_CONTROL_GENERAL + 0x007c)
68#define OMAP243X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
69#define OMAP243X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194)
70#define OMAP243X_CONTROL_IVA2_GEMCFG (OMAP2_CONTROL_GENERAL + 0x0198)
71
72/* 24xx-only CONTROL_GENERAL register offsets */
73#define OMAP24XX_CONTROL_DEBOBS (OMAP2_CONTROL_GENERAL + 0x0000)
74#define OMAP24XX_CONTROL_EMU_SUPPORT (OMAP2_CONTROL_GENERAL + 0x0008)
75#define OMAP24XX_CONTROL_SEC_TEST (OMAP2_CONTROL_GENERAL + 0x0044)
76#define OMAP24XX_CONTROL_PSA_CTRL (OMAP2_CONTROL_GENERAL + 0x0048)
77#define OMAP24XX_CONTROL_PSA_CMD (OMAP2_CONTROL_GENERAL + 0x004c)
78#define OMAP24XX_CONTROL_PSA_VALUE (OMAP2_CONTROL_GENERAL + 0x0050)
79#define OMAP24XX_CONTROL_SEC_EMU (OMAP2_CONTROL_GENERAL + 0x0060)
80#define OMAP24XX_CONTROL_SEC_TAP (OMAP2_CONTROL_GENERAL + 0x0064)
81#define OMAP24XX_CONTROL_OCM_PUB_RAM_ADD (OMAP2_CONTROL_GENERAL + 0x006c)
82#define OMAP24XX_CONTROL_EXT_SEC_RAM_START_ADD (OMAP2_CONTROL_GENERAL + 0x0070)
83#define OMAP24XX_CONTROL_EXT_SEC_RAM_STOP_ADD (OMAP2_CONTROL_GENERAL + 0x0074)
84#define OMAP24XX_CONTROL_SEC_STATUS (OMAP2_CONTROL_GENERAL + 0x0080)
85#define OMAP24XX_CONTROL_SEC_ERR_STATUS (OMAP2_CONTROL_GENERAL + 0x0084)
86#define OMAP24XX_CONTROL_STATUS (OMAP2_CONTROL_GENERAL + 0x0088)
87#define OMAP24XX_CONTROL_GENERAL_PURPOSE_STATUS (OMAP2_CONTROL_GENERAL + 0x008c)
88#define OMAP24XX_CONTROL_RAND_KEY_0 (OMAP2_CONTROL_GENERAL + 0x00a0)
89#define OMAP24XX_CONTROL_RAND_KEY_1 (OMAP2_CONTROL_GENERAL + 0x00a4)
90#define OMAP24XX_CONTROL_RAND_KEY_2 (OMAP2_CONTROL_GENERAL + 0x00a8)
91#define OMAP24XX_CONTROL_RAND_KEY_3 (OMAP2_CONTROL_GENERAL + 0x00ac)
92#define OMAP24XX_CONTROL_CUST_KEY_0 (OMAP2_CONTROL_GENERAL + 0x00b0)
93#define OMAP24XX_CONTROL_CUST_KEY_1 (OMAP2_CONTROL_GENERAL + 0x00b4)
94#define OMAP24XX_CONTROL_TEST_KEY_0 (OMAP2_CONTROL_GENERAL + 0x00c0)
95#define OMAP24XX_CONTROL_TEST_KEY_1 (OMAP2_CONTROL_GENERAL + 0x00c4)
96#define OMAP24XX_CONTROL_TEST_KEY_2 (OMAP2_CONTROL_GENERAL + 0x00c8)
97#define OMAP24XX_CONTROL_TEST_KEY_3 (OMAP2_CONTROL_GENERAL + 0x00cc)
98#define OMAP24XX_CONTROL_TEST_KEY_4 (OMAP2_CONTROL_GENERAL + 0x00d0)
99#define OMAP24XX_CONTROL_TEST_KEY_5 (OMAP2_CONTROL_GENERAL + 0x00d4)
100#define OMAP24XX_CONTROL_TEST_KEY_6 (OMAP2_CONTROL_GENERAL + 0x00d8)
101#define OMAP24XX_CONTROL_TEST_KEY_7 (OMAP2_CONTROL_GENERAL + 0x00dc)
102#define OMAP24XX_CONTROL_TEST_KEY_8 (OMAP2_CONTROL_GENERAL + 0x00e0)
103#define OMAP24XX_CONTROL_TEST_KEY_9 (OMAP2_CONTROL_GENERAL + 0x00e4)
104
105/* 34xx-only CONTROL_GENERAL register offsets */
106#define OMAP343X_CONTROL_PADCONF_OFF (OMAP2_CONTROL_GENERAL + 0x0000)
107#define OMAP343X_CONTROL_MEM_DFTRW0 (OMAP2_CONTROL_GENERAL + 0x0008)
108#define OMAP343X_CONTROL_MEM_DFTRW1 (OMAP2_CONTROL_GENERAL + 0x000c)
109#define OMAP343X_CONTROL_DEVCONF1 (OMAP2_CONTROL_GENERAL + 0x0068)
110#define OMAP343X_CONTROL_CSIRXFE (OMAP2_CONTROL_GENERAL + 0x006c)
111#define OMAP343X_CONTROL_SEC_STATUS (OMAP2_CONTROL_GENERAL + 0x0070)
112#define OMAP343X_CONTROL_SEC_ERR_STATUS (OMAP2_CONTROL_GENERAL + 0x0074)
113#define OMAP343X_CONTROL_SEC_ERR_STATUS_DEBUG (OMAP2_CONTROL_GENERAL + 0x0078)
114#define OMAP343X_CONTROL_STATUS (OMAP2_CONTROL_GENERAL + 0x0080)
115#define OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS (OMAP2_CONTROL_GENERAL + 0x0084)
116#define OMAP343X_CONTROL_RPUB_KEY_H_4 (OMAP2_CONTROL_GENERAL + 0x00a0)
117#define OMAP343X_CONTROL_RAND_KEY_0 (OMAP2_CONTROL_GENERAL + 0x00a8)
118#define OMAP343X_CONTROL_RAND_KEY_1 (OMAP2_CONTROL_GENERAL + 0x00ac)
119#define OMAP343X_CONTROL_RAND_KEY_2 (OMAP2_CONTROL_GENERAL + 0x00b0)
120#define OMAP343X_CONTROL_RAND_KEY_3 (OMAP2_CONTROL_GENERAL + 0x00b4)
121#define OMAP343X_CONTROL_TEST_KEY_0 (OMAP2_CONTROL_GENERAL + 0x00c8)
122#define OMAP343X_CONTROL_TEST_KEY_1 (OMAP2_CONTROL_GENERAL + 0x00cc)
123#define OMAP343X_CONTROL_TEST_KEY_2 (OMAP2_CONTROL_GENERAL + 0x00d0)
124#define OMAP343X_CONTROL_TEST_KEY_3 (OMAP2_CONTROL_GENERAL + 0x00d4)
125#define OMAP343X_CONTROL_TEST_KEY_4 (OMAP2_CONTROL_GENERAL + 0x00d8)
126#define OMAP343X_CONTROL_TEST_KEY_5 (OMAP2_CONTROL_GENERAL + 0x00dc)
127#define OMAP343X_CONTROL_TEST_KEY_6 (OMAP2_CONTROL_GENERAL + 0x00e0)
128#define OMAP343X_CONTROL_TEST_KEY_7 (OMAP2_CONTROL_GENERAL + 0x00e4)
129#define OMAP343X_CONTROL_TEST_KEY_8 (OMAP2_CONTROL_GENERAL + 0x00e8)
130#define OMAP343X_CONTROL_TEST_KEY_9 (OMAP2_CONTROL_GENERAL + 0x00ec)
131#define OMAP343X_CONTROL_TEST_KEY_10 (OMAP2_CONTROL_GENERAL + 0x00f0)
132#define OMAP343X_CONTROL_TEST_KEY_11 (OMAP2_CONTROL_GENERAL + 0x00f4)
133#define OMAP343X_CONTROL_TEST_KEY_12 (OMAP2_CONTROL_GENERAL + 0x00f8)
134#define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc)
135#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
136#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194)
137
138/*
139 * REVISIT: This list of registers is not comprehensive - there are more
140 * that should be added.
141 */
142
143/*
144 * Control module register bit defines - these should eventually go into
145 * their own regbits file. Some of these will be complicated, depending
146 * on the device type (general-purpose, emulator, test, secure, bad, other)
147 * and the security mode (secure, non-secure, don't care)
148 */
149/* CONTROL_DEVCONF0 bits */
150#define OMAP24XX_USBSTANDBYCTRL (1 << 15)
151#define OMAP2_MCBSP2_CLKS_MASK (1 << 6)
152#define OMAP2_MCBSP1_CLKS_MASK (1 << 2)
153
154/* CONTROL_DEVCONF1 bits */
155#define OMAP2_MCBSP5_CLKS_MASK (1 << 4) /* > 242x */
156#define OMAP2_MCBSP4_CLKS_MASK (1 << 2) /* > 242x */
157#define OMAP2_MCBSP3_CLKS_MASK (1 << 0) /* > 242x */
158
159/* CONTROL_STATUS bits */
160#define OMAP2_DEVICETYPE_MASK (0x7 << 8)
161#define OMAP2_SYSBOOT_5_MASK (1 << 5)
162#define OMAP2_SYSBOOT_4_MASK (1 << 4)
163#define OMAP2_SYSBOOT_3_MASK (1 << 3)
164#define OMAP2_SYSBOOT_2_MASK (1 << 2)
165#define OMAP2_SYSBOOT_1_MASK (1 << 1)
166#define OMAP2_SYSBOOT_0_MASK (1 << 0)
167
168#ifndef __ASSEMBLY__
169#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
170extern void __iomem *omap_ctrl_base_get(void);
171extern u8 omap_ctrl_readb(u16 offset);
172extern u16 omap_ctrl_readw(u16 offset);
173extern u32 omap_ctrl_readl(u16 offset);
174extern void omap_ctrl_writeb(u8 val, u16 offset);
175extern void omap_ctrl_writew(u16 val, u16 offset);
176extern void omap_ctrl_writel(u32 val, u16 offset);
177#else
178#define omap_ctrl_base_get() 0
179#define omap_ctrl_readb(x) 0
180#define omap_ctrl_readw(x) 0
181#define omap_ctrl_readl(x) 0
182#define omap_ctrl_writeb(x, y) WARN_ON(1)
183#define omap_ctrl_writew(x, y) WARN_ON(1)
184#define omap_ctrl_writel(x, y) WARN_ON(1)
185#endif
186#endif /* __ASSEMBLY__ */
187
188#endif /* __ASM_ARCH_CONTROL_H */
189
diff --git a/arch/arm/plat-omap/include/mach/cpu.h b/arch/arm/plat-omap/include/mach/cpu.h
new file mode 100644
index 000000000000..05aee0eda34f
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/cpu.h
@@ -0,0 +1,402 @@
1/*
2 * arch/arm/plat-omap/include/mach/cpu.h
3 *
4 * OMAP cpu type detection
5 *
6 * Copyright (C) 2004, 2008 Nokia Corporation
7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#ifndef __ASM_ARCH_OMAP_CPU_H
27#define __ASM_ARCH_OMAP_CPU_H
28
29struct omap_chip_id {
30 u8 oc;
31};
32
33#define OMAP_CHIP_INIT(x) { .oc = x }
34
35extern unsigned int system_rev;
36
37#define omap2_cpu_rev() ((system_rev >> 12) & 0x0f)
38
39/*
40 * Test if multicore OMAP support is needed
41 */
42#undef MULTI_OMAP1
43#undef MULTI_OMAP2
44#undef OMAP_NAME
45
46#ifdef CONFIG_ARCH_OMAP730
47# ifdef OMAP_NAME
48# undef MULTI_OMAP1
49# define MULTI_OMAP1
50# else
51# define OMAP_NAME omap730
52# endif
53#endif
54#ifdef CONFIG_ARCH_OMAP15XX
55# ifdef OMAP_NAME
56# undef MULTI_OMAP1
57# define MULTI_OMAP1
58# else
59# define OMAP_NAME omap1510
60# endif
61#endif
62#ifdef CONFIG_ARCH_OMAP16XX
63# ifdef OMAP_NAME
64# undef MULTI_OMAP1
65# define MULTI_OMAP1
66# else
67# define OMAP_NAME omap16xx
68# endif
69#endif
70#if (defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX))
71# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
72# error "OMAP1 and OMAP2 can't be selected at the same time"
73# endif
74#endif
75#ifdef CONFIG_ARCH_OMAP2420
76# ifdef OMAP_NAME
77# undef MULTI_OMAP2
78# define MULTI_OMAP2
79# else
80# define OMAP_NAME omap2420
81# endif
82#endif
83#ifdef CONFIG_ARCH_OMAP2430
84# ifdef OMAP_NAME
85# undef MULTI_OMAP2
86# define MULTI_OMAP2
87# else
88# define OMAP_NAME omap2430
89# endif
90#endif
91#ifdef CONFIG_ARCH_OMAP3430
92# ifdef OMAP_NAME
93# undef MULTI_OMAP2
94# define MULTI_OMAP2
95# else
96# define OMAP_NAME omap3430
97# endif
98#endif
99
100/*
101 * Macros to group OMAP into cpu classes.
102 * These can be used in most places.
103 * cpu_is_omap7xx(): True for OMAP730
104 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
105 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
106 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
107 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
108 * cpu_is_omap243x(): True for OMAP2430
109 * cpu_is_omap343x(): True for OMAP3430
110 */
111#define GET_OMAP_CLASS ((system_rev >> 24) & 0xff)
112
113#define IS_OMAP_CLASS(class, id) \
114static inline int is_omap ##class (void) \
115{ \
116 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
117}
118
119#define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff)
120
121#define IS_OMAP_SUBCLASS(subclass, id) \
122static inline int is_omap ##subclass (void) \
123{ \
124 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
125}
126
127IS_OMAP_CLASS(7xx, 0x07)
128IS_OMAP_CLASS(15xx, 0x15)
129IS_OMAP_CLASS(16xx, 0x16)
130IS_OMAP_CLASS(24xx, 0x24)
131IS_OMAP_CLASS(34xx, 0x34)
132
133IS_OMAP_SUBCLASS(242x, 0x242)
134IS_OMAP_SUBCLASS(243x, 0x243)
135IS_OMAP_SUBCLASS(343x, 0x343)
136
137#define cpu_is_omap7xx() 0
138#define cpu_is_omap15xx() 0
139#define cpu_is_omap16xx() 0
140#define cpu_is_omap24xx() 0
141#define cpu_is_omap242x() 0
142#define cpu_is_omap243x() 0
143#define cpu_is_omap34xx() 0
144#define cpu_is_omap343x() 0
145
146#if defined(MULTI_OMAP1)
147# if defined(CONFIG_ARCH_OMAP730)
148# undef cpu_is_omap7xx
149# define cpu_is_omap7xx() is_omap7xx()
150# endif
151# if defined(CONFIG_ARCH_OMAP15XX)
152# undef cpu_is_omap15xx
153# define cpu_is_omap15xx() is_omap15xx()
154# endif
155# if defined(CONFIG_ARCH_OMAP16XX)
156# undef cpu_is_omap16xx
157# define cpu_is_omap16xx() is_omap16xx()
158# endif
159#else
160# if defined(CONFIG_ARCH_OMAP730)
161# undef cpu_is_omap7xx
162# define cpu_is_omap7xx() 1
163# endif
164# if defined(CONFIG_ARCH_OMAP15XX)
165# undef cpu_is_omap15xx
166# define cpu_is_omap15xx() 1
167# endif
168# if defined(CONFIG_ARCH_OMAP16XX)
169# undef cpu_is_omap16xx
170# define cpu_is_omap16xx() 1
171# endif
172#endif
173
174#if defined(MULTI_OMAP2)
175# if defined(CONFIG_ARCH_OMAP24XX)
176# undef cpu_is_omap24xx
177# undef cpu_is_omap242x
178# undef cpu_is_omap243x
179# define cpu_is_omap24xx() is_omap24xx()
180# define cpu_is_omap242x() is_omap242x()
181# define cpu_is_omap243x() is_omap243x()
182# endif
183# if defined(CONFIG_ARCH_OMAP34XX)
184# undef cpu_is_omap34xx
185# undef cpu_is_omap343x
186# define cpu_is_omap34xx() is_omap34xx()
187# define cpu_is_omap343x() is_omap343x()
188# endif
189#else
190# if defined(CONFIG_ARCH_OMAP24XX)
191# undef cpu_is_omap24xx
192# define cpu_is_omap24xx() 1
193# endif
194# if defined(CONFIG_ARCH_OMAP2420)
195# undef cpu_is_omap242x
196# define cpu_is_omap242x() 1
197# endif
198# if defined(CONFIG_ARCH_OMAP2430)
199# undef cpu_is_omap243x
200# define cpu_is_omap243x() 1
201# endif
202# if defined(CONFIG_ARCH_OMAP34XX)
203# undef cpu_is_omap34xx
204# define cpu_is_omap34xx() 1
205# endif
206# if defined(CONFIG_ARCH_OMAP3430)
207# undef cpu_is_omap343x
208# define cpu_is_omap343x() 1
209# endif
210#endif
211
212/*
213 * Macros to detect individual cpu types.
214 * These are only rarely needed.
215 * cpu_is_omap330(): True for OMAP330
216 * cpu_is_omap730(): True for OMAP730
217 * cpu_is_omap1510(): True for OMAP1510
218 * cpu_is_omap1610(): True for OMAP1610
219 * cpu_is_omap1611(): True for OMAP1611
220 * cpu_is_omap5912(): True for OMAP5912
221 * cpu_is_omap1621(): True for OMAP1621
222 * cpu_is_omap1710(): True for OMAP1710
223 * cpu_is_omap2420(): True for OMAP2420
224 * cpu_is_omap2422(): True for OMAP2422
225 * cpu_is_omap2423(): True for OMAP2423
226 * cpu_is_omap2430(): True for OMAP2430
227 * cpu_is_omap3430(): True for OMAP3430
228 */
229#define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff)
230
231#define IS_OMAP_TYPE(type, id) \
232static inline int is_omap ##type (void) \
233{ \
234 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
235}
236
237IS_OMAP_TYPE(310, 0x0310)
238IS_OMAP_TYPE(730, 0x0730)
239IS_OMAP_TYPE(1510, 0x1510)
240IS_OMAP_TYPE(1610, 0x1610)
241IS_OMAP_TYPE(1611, 0x1611)
242IS_OMAP_TYPE(5912, 0x1611)
243IS_OMAP_TYPE(1621, 0x1621)
244IS_OMAP_TYPE(1710, 0x1710)
245IS_OMAP_TYPE(2420, 0x2420)
246IS_OMAP_TYPE(2422, 0x2422)
247IS_OMAP_TYPE(2423, 0x2423)
248IS_OMAP_TYPE(2430, 0x2430)
249IS_OMAP_TYPE(3430, 0x3430)
250
251#define cpu_is_omap310() 0
252#define cpu_is_omap730() 0
253#define cpu_is_omap1510() 0
254#define cpu_is_omap1610() 0
255#define cpu_is_omap5912() 0
256#define cpu_is_omap1611() 0
257#define cpu_is_omap1621() 0
258#define cpu_is_omap1710() 0
259#define cpu_is_omap2420() 0
260#define cpu_is_omap2422() 0
261#define cpu_is_omap2423() 0
262#define cpu_is_omap2430() 0
263#define cpu_is_omap3430() 0
264
265#if defined(MULTI_OMAP1)
266# if defined(CONFIG_ARCH_OMAP730)
267# undef cpu_is_omap730
268# define cpu_is_omap730() is_omap730()
269# endif
270#else
271# if defined(CONFIG_ARCH_OMAP730)
272# undef cpu_is_omap730
273# define cpu_is_omap730() 1
274# endif
275#endif
276
277/*
278 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
279 * between 330 vs. 1510 and 1611B/5912 vs. 1710.
280 */
281#if defined(CONFIG_ARCH_OMAP15XX)
282# undef cpu_is_omap310
283# undef cpu_is_omap1510
284# define cpu_is_omap310() is_omap310()
285# define cpu_is_omap1510() is_omap1510()
286#endif
287
288#if defined(CONFIG_ARCH_OMAP16XX)
289# undef cpu_is_omap1610
290# undef cpu_is_omap1611
291# undef cpu_is_omap5912
292# undef cpu_is_omap1621
293# undef cpu_is_omap1710
294# define cpu_is_omap1610() is_omap1610()
295# define cpu_is_omap1611() is_omap1611()
296# define cpu_is_omap5912() is_omap5912()
297# define cpu_is_omap1621() is_omap1621()
298# define cpu_is_omap1710() is_omap1710()
299#endif
300
301#if defined(CONFIG_ARCH_OMAP24XX)
302# undef cpu_is_omap2420
303# undef cpu_is_omap2422
304# undef cpu_is_omap2423
305# undef cpu_is_omap2430
306# define cpu_is_omap2420() is_omap2420()
307# define cpu_is_omap2422() is_omap2422()
308# define cpu_is_omap2423() is_omap2423()
309# define cpu_is_omap2430() is_omap2430()
310#endif
311
312#if defined(CONFIG_ARCH_OMAP34XX)
313# undef cpu_is_omap3430
314# define cpu_is_omap3430() is_omap3430()
315#endif
316
317/* Macros to detect if we have OMAP1 or OMAP2 */
318#define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \
319 cpu_is_omap16xx())
320#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx())
321
322#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
323/*
324 * Macros to detect silicon revision of OMAP2/3 processors.
325 * is_sil_rev_greater_than: true if passed cpu type & its rev is greater.
326 * is_sil_rev_lesser_than: true if passed cpu type & its rev is lesser.
327 * is_sil_rev_equal_to: true if passed cpu type & its rev is equal.
328 * get_sil_rev: return the silicon rev value.
329 */
330#define get_sil_omap_type(rev) ((rev & 0xffff0000) >> 16)
331#define get_sil_revision(rev) ((rev & 0x0000f000) >> 12)
332
333#define is_sil_rev_greater_than(rev) \
334 ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \
335 (get_sil_revision(system_rev) > get_sil_revision(rev)))
336
337#define is_sil_rev_less_than(rev) \
338 ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \
339 (get_sil_revision(system_rev) < get_sil_revision(rev)))
340
341#define is_sil_rev_equal_to(rev) \
342 ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \
343 (get_sil_revision(system_rev) == get_sil_revision(rev)))
344
345#define get_sil_rev() \
346 get_sil_revision(system_rev)
347
348/* Various silicon macros defined here */
349#define OMAP2420_REV_ES1_0 0x24200000
350#define OMAP2420_REV_ES2_0 0x24201000
351#define OMAP2430_REV_ES1_0 0x24300000
352#define OMAP3430_REV_ES1_0 0x34300000
353#define OMAP3430_REV_ES2_0 0x34301000
354#define OMAP3430_REV_ES2_1 0x34302000
355#define OMAP3430_REV_ES2_2 0x34303000
356
357/*
358 * omap_chip bits
359 *
360 * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
361 * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates
362 * something that is only valid on that particular ES revision.
363 *
364 * These bits may be ORed together to indicate structures that are
365 * available on multiple chip types.
366 *
367 * To test whether a particular structure matches the current OMAP chip type,
368 * use omap_chip_is().
369 *
370 */
371#define CHIP_IS_OMAP2420 (1 << 0)
372#define CHIP_IS_OMAP2430 (1 << 1)
373#define CHIP_IS_OMAP3430 (1 << 2)
374#define CHIP_IS_OMAP3430ES1 (1 << 3)
375#define CHIP_IS_OMAP3430ES2 (1 << 4)
376
377#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
378
379int omap_chip_is(struct omap_chip_id oci);
380
381
382/*
383 * Macro to detect device type i.e. EMU/HS/TST/GP/BAD
384 */
385#define DEVICE_TYPE_TEST 0
386#define DEVICE_TYPE_EMU 1
387#define DEVICE_TYPE_SEC 2
388#define DEVICE_TYPE_GP 3
389#define DEVICE_TYPE_BAD 4
390
391#define get_device_type() ((system_rev & 0x700) >> 8)
392#define is_device_type_test() (get_device_type() == DEVICE_TYPE_TEST)
393#define is_device_type_emu() (get_device_type() == DEVICE_TYPE_EMU)
394#define is_device_type_sec() (get_device_type() == DEVICE_TYPE_SEC)
395#define is_device_type_gp() (get_device_type() == DEVICE_TYPE_GP)
396#define is_device_type_bad() (get_device_type() == DEVICE_TYPE_BAD)
397
398void omap2_check_revision(void);
399
400#endif /* defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) */
401
402#endif
diff --git a/arch/arm/plat-omap/include/mach/debug-macro.S b/arch/arm/plat-omap/include/mach/debug-macro.S
new file mode 100644
index 000000000000..1b0039bdeb4e
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/debug-macro.S
@@ -0,0 +1,58 @@
1/* arch/arm/plat-omap/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 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17#ifdef CONFIG_ARCH_OMAP1
18 moveq \rx, #0xff000000 @ physical base address
19 movne \rx, #0xfe000000 @ virtual base
20 orr \rx, \rx, #0x00fb0000
21#ifdef CONFIG_OMAP_LL_DEBUG_UART3
22 orr \rx, \rx, #0x00009000 @ UART 3
23#endif
24#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3)
25 orr \rx, \rx, #0x00000800 @ UART 2 & 3
26#endif
27
28#elif CONFIG_ARCH_OMAP2
29 moveq \rx, #0x48000000 @ physical base address
30 movne \rx, #0xd8000000 @ virtual base
31 orr \rx, \rx, #0x0006a000
32#ifdef CONFIG_OMAP_LL_DEBUG_UART2
33 add \rx, \rx, #0x00002000 @ UART 2
34#endif
35#ifdef CONFIG_OMAP_LL_DEBUG_UART3
36 add \rx, \rx, #0x00004000 @ UART 3
37#endif
38#endif
39 .endm
40
41 .macro senduart,rd,rx
42 strb \rd, [\rx]
43 .endm
44
45 .macro busyuart,rd,rx
461001: ldrb \rd, [\rx, #(0x5 << 2)] @ OMAP-1510 and friends
47 and \rd, \rd, #0x60
48 teq \rd, #0x60
49 beq 1002f
50 ldrb \rd, [\rx, #(0x5 << 0)] @ OMAP-730 only
51 and \rd, \rd, #0x60
52 teq \rd, #0x60
53 bne 1001b
541002:
55 .endm
56
57 .macro waituart,rd,rx
58 .endm
diff --git a/arch/arm/plat-omap/include/mach/dma.h b/arch/arm/plat-omap/include/mach/dma.h
new file mode 100644
index 000000000000..54fe9665b182
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/dma.h
@@ -0,0 +1,570 @@
1/*
2 * arch/arm/plat-omap/include/mach/dma.h
3 *
4 * Copyright (C) 2003 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_DMA_H
22#define __ASM_ARCH_DMA_H
23
24/* Hardware registers for omap1 */
25#define OMAP1_DMA_BASE (0xfffed800)
26
27#define OMAP1_DMA_GCR 0x400
28#define OMAP1_DMA_GSCR 0x404
29#define OMAP1_DMA_GRST 0x408
30#define OMAP1_DMA_HW_ID 0x442
31#define OMAP1_DMA_PCH2_ID 0x444
32#define OMAP1_DMA_PCH0_ID 0x446
33#define OMAP1_DMA_PCH1_ID 0x448
34#define OMAP1_DMA_PCHG_ID 0x44a
35#define OMAP1_DMA_PCHD_ID 0x44c
36#define OMAP1_DMA_CAPS_0_U 0x44e
37#define OMAP1_DMA_CAPS_0_L 0x450
38#define OMAP1_DMA_CAPS_1_U 0x452
39#define OMAP1_DMA_CAPS_1_L 0x454
40#define OMAP1_DMA_CAPS_2 0x456
41#define OMAP1_DMA_CAPS_3 0x458
42#define OMAP1_DMA_CAPS_4 0x45a
43#define OMAP1_DMA_PCH2_SR 0x460
44#define OMAP1_DMA_PCH0_SR 0x480
45#define OMAP1_DMA_PCH1_SR 0x482
46#define OMAP1_DMA_PCHD_SR 0x4c0
47
48/* Hardware registers for omap2 and omap3 */
49#define OMAP24XX_DMA4_BASE (L4_24XX_BASE + 0x56000)
50#define OMAP34XX_DMA4_BASE (L4_34XX_BASE + 0x56000)
51
52#define OMAP_DMA4_REVISION 0x00
53#define OMAP_DMA4_GCR 0x78
54#define OMAP_DMA4_IRQSTATUS_L0 0x08
55#define OMAP_DMA4_IRQSTATUS_L1 0x0c
56#define OMAP_DMA4_IRQSTATUS_L2 0x10
57#define OMAP_DMA4_IRQSTATUS_L3 0x14
58#define OMAP_DMA4_IRQENABLE_L0 0x18
59#define OMAP_DMA4_IRQENABLE_L1 0x1c
60#define OMAP_DMA4_IRQENABLE_L2 0x20
61#define OMAP_DMA4_IRQENABLE_L3 0x24
62#define OMAP_DMA4_SYSSTATUS 0x28
63#define OMAP_DMA4_OCP_SYSCONFIG 0x2c
64#define OMAP_DMA4_CAPS_0 0x64
65#define OMAP_DMA4_CAPS_2 0x6c
66#define OMAP_DMA4_CAPS_3 0x70
67#define OMAP_DMA4_CAPS_4 0x74
68
69#define OMAP1_LOGICAL_DMA_CH_COUNT 17
70#define OMAP_DMA4_LOGICAL_DMA_CH_COUNT 32 /* REVISIT: Is this 32 + 2? */
71
72/* Common channel specific registers for omap1 */
73#define OMAP1_DMA_CH_BASE(n) (0x40 * (n) + 0x00)
74#define OMAP1_DMA_CSDP(n) (0x40 * (n) + 0x00)
75#define OMAP1_DMA_CCR(n) (0x40 * (n) + 0x02)
76#define OMAP1_DMA_CICR(n) (0x40 * (n) + 0x04)
77#define OMAP1_DMA_CSR(n) (0x40 * (n) + 0x06)
78#define OMAP1_DMA_CEN(n) (0x40 * (n) + 0x10)
79#define OMAP1_DMA_CFN(n) (0x40 * (n) + 0x12)
80#define OMAP1_DMA_CSFI(n) (0x40 * (n) + 0x14)
81#define OMAP1_DMA_CSEI(n) (0x40 * (n) + 0x16)
82#define OMAP1_DMA_CPC(n) (0x40 * (n) + 0x18) /* 15xx only */
83#define OMAP1_DMA_CSAC(n) (0x40 * (n) + 0x18)
84#define OMAP1_DMA_CDAC(n) (0x40 * (n) + 0x1a)
85#define OMAP1_DMA_CDEI(n) (0x40 * (n) + 0x1c)
86#define OMAP1_DMA_CDFI(n) (0x40 * (n) + 0x1e)
87#define OMAP1_DMA_CLNK_CTRL(n) (0x40 * (n) + 0x28)
88
89/* Common channel specific registers for omap2 */
90#define OMAP_DMA4_CH_BASE(n) (0x60 * (n) + 0x80)
91#define OMAP_DMA4_CCR(n) (0x60 * (n) + 0x80)
92#define OMAP_DMA4_CLNK_CTRL(n) (0x60 * (n) + 0x84)
93#define OMAP_DMA4_CICR(n) (0x60 * (n) + 0x88)
94#define OMAP_DMA4_CSR(n) (0x60 * (n) + 0x8c)
95#define OMAP_DMA4_CSDP(n) (0x60 * (n) + 0x90)
96#define OMAP_DMA4_CEN(n) (0x60 * (n) + 0x94)
97#define OMAP_DMA4_CFN(n) (0x60 * (n) + 0x98)
98#define OMAP_DMA4_CSEI(n) (0x60 * (n) + 0xa4)
99#define OMAP_DMA4_CSFI(n) (0x60 * (n) + 0xa8)
100#define OMAP_DMA4_CDEI(n) (0x60 * (n) + 0xac)
101#define OMAP_DMA4_CDFI(n) (0x60 * (n) + 0xb0)
102#define OMAP_DMA4_CSAC(n) (0x60 * (n) + 0xb4)
103#define OMAP_DMA4_CDAC(n) (0x60 * (n) + 0xb8)
104
105/* Channel specific registers only on omap1 */
106#define OMAP1_DMA_CSSA_L(n) (0x40 * (n) + 0x08)
107#define OMAP1_DMA_CSSA_U(n) (0x40 * (n) + 0x0a)
108#define OMAP1_DMA_CDSA_L(n) (0x40 * (n) + 0x0c)
109#define OMAP1_DMA_CDSA_U(n) (0x40 * (n) + 0x0e)
110#define OMAP1_DMA_COLOR_L(n) (0x40 * (n) + 0x20)
111#define OMAP1_DMA_COLOR_U(n) (0x40 * (n) + 0x22)
112#define OMAP1_DMA_CCR2(n) (0x40 * (n) + 0x24)
113#define OMAP1_DMA_LCH_CTRL(n) (0x40 * (n) + 0x2a) /* not on 15xx */
114#define OMAP1_DMA_CCEN(n) 0
115#define OMAP1_DMA_CCFN(n) 0
116
117/* Channel specific registers only on omap2 */
118#define OMAP_DMA4_CSSA(n) (0x60 * (n) + 0x9c)
119#define OMAP_DMA4_CDSA(n) (0x60 * (n) + 0xa0)
120#define OMAP_DMA4_CCEN(n) (0x60 * (n) + 0xbc)
121#define OMAP_DMA4_CCFN(n) (0x60 * (n) + 0xc0)
122#define OMAP_DMA4_COLOR(n) (0x60 * (n) + 0xc4)
123
124/* Dummy defines to keep multi-omap compiles happy */
125#define OMAP1_DMA_REVISION 0
126#define OMAP1_DMA_IRQSTATUS_L0 0
127#define OMAP1_DMA_IRQENABLE_L0 0
128#define OMAP1_DMA_OCP_SYSCONFIG 0
129#define OMAP_DMA4_HW_ID 0
130#define OMAP_DMA4_CAPS_0_L 0
131#define OMAP_DMA4_CAPS_0_U 0
132#define OMAP_DMA4_CAPS_1_L 0
133#define OMAP_DMA4_CAPS_1_U 0
134#define OMAP_DMA4_GSCR 0
135#define OMAP_DMA4_CPC(n) 0
136
137#define OMAP_DMA4_LCH_CTRL(n) 0
138#define OMAP_DMA4_COLOR_L(n) 0
139#define OMAP_DMA4_COLOR_U(n) 0
140#define OMAP_DMA4_CCR2(n) 0
141#define OMAP1_DMA_CSSA(n) 0
142#define OMAP1_DMA_CDSA(n) 0
143#define OMAP_DMA4_CSSA_L(n) 0
144#define OMAP_DMA4_CSSA_U(n) 0
145#define OMAP_DMA4_CDSA_L(n) 0
146#define OMAP_DMA4_CDSA_U(n) 0
147
148/*----------------------------------------------------------------------------*/
149
150/* DMA channels for omap1 */
151#define OMAP_DMA_NO_DEVICE 0
152#define OMAP_DMA_MCSI1_TX 1
153#define OMAP_DMA_MCSI1_RX 2
154#define OMAP_DMA_I2C_RX 3
155#define OMAP_DMA_I2C_TX 4
156#define OMAP_DMA_EXT_NDMA_REQ 5
157#define OMAP_DMA_EXT_NDMA_REQ2 6
158#define OMAP_DMA_UWIRE_TX 7
159#define OMAP_DMA_MCBSP1_TX 8
160#define OMAP_DMA_MCBSP1_RX 9
161#define OMAP_DMA_MCBSP3_TX 10
162#define OMAP_DMA_MCBSP3_RX 11
163#define OMAP_DMA_UART1_TX 12
164#define OMAP_DMA_UART1_RX 13
165#define OMAP_DMA_UART2_TX 14
166#define OMAP_DMA_UART2_RX 15
167#define OMAP_DMA_MCBSP2_TX 16
168#define OMAP_DMA_MCBSP2_RX 17
169#define OMAP_DMA_UART3_TX 18
170#define OMAP_DMA_UART3_RX 19
171#define OMAP_DMA_CAMERA_IF_RX 20
172#define OMAP_DMA_MMC_TX 21
173#define OMAP_DMA_MMC_RX 22
174#define OMAP_DMA_NAND 23
175#define OMAP_DMA_IRQ_LCD_LINE 24
176#define OMAP_DMA_MEMORY_STICK 25
177#define OMAP_DMA_USB_W2FC_RX0 26
178#define OMAP_DMA_USB_W2FC_RX1 27
179#define OMAP_DMA_USB_W2FC_RX2 28
180#define OMAP_DMA_USB_W2FC_TX0 29
181#define OMAP_DMA_USB_W2FC_TX1 30
182#define OMAP_DMA_USB_W2FC_TX2 31
183
184/* These are only for 1610 */
185#define OMAP_DMA_CRYPTO_DES_IN 32
186#define OMAP_DMA_SPI_TX 33
187#define OMAP_DMA_SPI_RX 34
188#define OMAP_DMA_CRYPTO_HASH 35
189#define OMAP_DMA_CCP_ATTN 36
190#define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37
191#define OMAP_DMA_CMT_APE_TX_CHAN_0 38
192#define OMAP_DMA_CMT_APE_RV_CHAN_0 39
193#define OMAP_DMA_CMT_APE_TX_CHAN_1 40
194#define OMAP_DMA_CMT_APE_RV_CHAN_1 41
195#define OMAP_DMA_CMT_APE_TX_CHAN_2 42
196#define OMAP_DMA_CMT_APE_RV_CHAN_2 43
197#define OMAP_DMA_CMT_APE_TX_CHAN_3 44
198#define OMAP_DMA_CMT_APE_RV_CHAN_3 45
199#define OMAP_DMA_CMT_APE_TX_CHAN_4 46
200#define OMAP_DMA_CMT_APE_RV_CHAN_4 47
201#define OMAP_DMA_CMT_APE_TX_CHAN_5 48
202#define OMAP_DMA_CMT_APE_RV_CHAN_5 49
203#define OMAP_DMA_CMT_APE_TX_CHAN_6 50
204#define OMAP_DMA_CMT_APE_RV_CHAN_6 51
205#define OMAP_DMA_CMT_APE_TX_CHAN_7 52
206#define OMAP_DMA_CMT_APE_RV_CHAN_7 53
207#define OMAP_DMA_MMC2_TX 54
208#define OMAP_DMA_MMC2_RX 55
209#define OMAP_DMA_CRYPTO_DES_OUT 56
210
211/* DMA channels for 24xx */
212#define OMAP24XX_DMA_NO_DEVICE 0
213#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
214#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
215#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
216#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
217#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
218#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
219#define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */
220#define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */
221#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */
222#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
223#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
224#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
225#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
226#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
227#define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */
228#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
229#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
230#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
231#define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */
232#define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */
233#define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
234#define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */
235#define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */
236#define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */
237#define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */
238#define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */
239#define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */
240#define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */
241#define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */
242#define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
243#define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
244#define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */
245#define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */
246#define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */
247#define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */
248#define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */
249#define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */
250#define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
251#define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
252#define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */
253#define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */
254#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
255#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
256#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
257#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
258#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
259#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
260#define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */
261#define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */
262#define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */
263#define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */
264#define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
265#define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
266#define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
267#define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
268#define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
269#define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
270#define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
271#define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
272#define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
273#define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
274#define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
275#define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
276#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
277#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
278#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
279#define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */
280#define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */
281#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
282#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
283#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
284#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */
285#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */
286#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */
287#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */
288#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */
289#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */
290#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
291#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
292#define OMAP24XX_DMA_MS 63 /* S_DMA_62 */
293#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
294#define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */
295#define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */
296#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
297#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
298#define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */
299#define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */
300#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
301#define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
302#define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
303#define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */
304#define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */
305#define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */
306#define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */
307#define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */
308#define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */
309#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
310#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
311
312/*----------------------------------------------------------------------------*/
313
314/* Hardware registers for LCD DMA */
315#define OMAP1510_DMA_LCD_BASE (0xfffedb00)
316#define OMAP1510_DMA_LCD_CTRL (OMAP1510_DMA_LCD_BASE + 0x00)
317#define OMAP1510_DMA_LCD_TOP_F1_L (OMAP1510_DMA_LCD_BASE + 0x02)
318#define OMAP1510_DMA_LCD_TOP_F1_U (OMAP1510_DMA_LCD_BASE + 0x04)
319#define OMAP1510_DMA_LCD_BOT_F1_L (OMAP1510_DMA_LCD_BASE + 0x06)
320#define OMAP1510_DMA_LCD_BOT_F1_U (OMAP1510_DMA_LCD_BASE + 0x08)
321
322#define OMAP1610_DMA_LCD_BASE (0xfffee300)
323#define OMAP1610_DMA_LCD_CSDP (OMAP1610_DMA_LCD_BASE + 0xc0)
324#define OMAP1610_DMA_LCD_CCR (OMAP1610_DMA_LCD_BASE + 0xc2)
325#define OMAP1610_DMA_LCD_CTRL (OMAP1610_DMA_LCD_BASE + 0xc4)
326#define OMAP1610_DMA_LCD_TOP_B1_L (OMAP1610_DMA_LCD_BASE + 0xc8)
327#define OMAP1610_DMA_LCD_TOP_B1_U (OMAP1610_DMA_LCD_BASE + 0xca)
328#define OMAP1610_DMA_LCD_BOT_B1_L (OMAP1610_DMA_LCD_BASE + 0xcc)
329#define OMAP1610_DMA_LCD_BOT_B1_U (OMAP1610_DMA_LCD_BASE + 0xce)
330#define OMAP1610_DMA_LCD_TOP_B2_L (OMAP1610_DMA_LCD_BASE + 0xd0)
331#define OMAP1610_DMA_LCD_TOP_B2_U (OMAP1610_DMA_LCD_BASE + 0xd2)
332#define OMAP1610_DMA_LCD_BOT_B2_L (OMAP1610_DMA_LCD_BASE + 0xd4)
333#define OMAP1610_DMA_LCD_BOT_B2_U (OMAP1610_DMA_LCD_BASE + 0xd6)
334#define OMAP1610_DMA_LCD_SRC_EI_B1 (OMAP1610_DMA_LCD_BASE + 0xd8)
335#define OMAP1610_DMA_LCD_SRC_FI_B1_L (OMAP1610_DMA_LCD_BASE + 0xda)
336#define OMAP1610_DMA_LCD_SRC_EN_B1 (OMAP1610_DMA_LCD_BASE + 0xe0)
337#define OMAP1610_DMA_LCD_SRC_FN_B1 (OMAP1610_DMA_LCD_BASE + 0xe4)
338#define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea)
339#define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4)
340
341#define OMAP1_DMA_TOUT_IRQ (1 << 0)
342#define OMAP_DMA_DROP_IRQ (1 << 1)
343#define OMAP_DMA_HALF_IRQ (1 << 2)
344#define OMAP_DMA_FRAME_IRQ (1 << 3)
345#define OMAP_DMA_LAST_IRQ (1 << 4)
346#define OMAP_DMA_BLOCK_IRQ (1 << 5)
347#define OMAP1_DMA_SYNC_IRQ (1 << 6)
348#define OMAP2_DMA_PKT_IRQ (1 << 7)
349#define OMAP2_DMA_TRANS_ERR_IRQ (1 << 8)
350#define OMAP2_DMA_SECURE_ERR_IRQ (1 << 9)
351#define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10)
352#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11)
353
354#define OMAP_DMA_DATA_TYPE_S8 0x00
355#define OMAP_DMA_DATA_TYPE_S16 0x01
356#define OMAP_DMA_DATA_TYPE_S32 0x02
357
358#define OMAP_DMA_SYNC_ELEMENT 0x00
359#define OMAP_DMA_SYNC_FRAME 0x01
360#define OMAP_DMA_SYNC_BLOCK 0x02
361#define OMAP_DMA_SYNC_PACKET 0x03
362
363#define OMAP_DMA_SRC_SYNC 0x01
364#define OMAP_DMA_DST_SYNC 0x00
365
366#define OMAP_DMA_PORT_EMIFF 0x00
367#define OMAP_DMA_PORT_EMIFS 0x01
368#define OMAP_DMA_PORT_OCP_T1 0x02
369#define OMAP_DMA_PORT_TIPB 0x03
370#define OMAP_DMA_PORT_OCP_T2 0x04
371#define OMAP_DMA_PORT_MPUI 0x05
372
373#define OMAP_DMA_AMODE_CONSTANT 0x00
374#define OMAP_DMA_AMODE_POST_INC 0x01
375#define OMAP_DMA_AMODE_SINGLE_IDX 0x02
376#define OMAP_DMA_AMODE_DOUBLE_IDX 0x03
377
378#define DMA_DEFAULT_FIFO_DEPTH 0x10
379#define DMA_DEFAULT_ARB_RATE 0x01
380/* Pass THREAD_RESERVE ORed with THREAD_FIFO for tparams */
381#define DMA_THREAD_RESERVE_NORM (0x00 << 12) /* Def */
382#define DMA_THREAD_RESERVE_ONET (0x01 << 12)
383#define DMA_THREAD_RESERVE_TWOT (0x02 << 12)
384#define DMA_THREAD_RESERVE_THREET (0x03 << 12)
385#define DMA_THREAD_FIFO_NONE (0x00 << 14) /* Def */
386#define DMA_THREAD_FIFO_75 (0x01 << 14)
387#define DMA_THREAD_FIFO_25 (0x02 << 14)
388#define DMA_THREAD_FIFO_50 (0x03 << 14)
389
390/* Chaining modes*/
391#ifndef CONFIG_ARCH_OMAP1
392#define OMAP_DMA_STATIC_CHAIN 0x1
393#define OMAP_DMA_DYNAMIC_CHAIN 0x2
394#define OMAP_DMA_CHAIN_ACTIVE 0x1
395#define OMAP_DMA_CHAIN_INACTIVE 0x0
396#endif
397
398#define DMA_CH_PRIO_HIGH 0x1
399#define DMA_CH_PRIO_LOW 0x0 /* Def */
400
401/* LCD DMA block numbers */
402enum {
403 OMAP_LCD_DMA_B1_TOP,
404 OMAP_LCD_DMA_B1_BOTTOM,
405 OMAP_LCD_DMA_B2_TOP,
406 OMAP_LCD_DMA_B2_BOTTOM
407};
408
409enum omap_dma_burst_mode {
410 OMAP_DMA_DATA_BURST_DIS = 0,
411 OMAP_DMA_DATA_BURST_4,
412 OMAP_DMA_DATA_BURST_8,
413 OMAP_DMA_DATA_BURST_16,
414};
415
416enum end_type {
417 OMAP_DMA_LITTLE_ENDIAN = 0,
418 OMAP_DMA_BIG_ENDIAN
419};
420
421enum omap_dma_color_mode {
422 OMAP_DMA_COLOR_DIS = 0,
423 OMAP_DMA_CONSTANT_FILL,
424 OMAP_DMA_TRANSPARENT_COPY
425};
426
427enum omap_dma_write_mode {
428 OMAP_DMA_WRITE_NON_POSTED = 0,
429 OMAP_DMA_WRITE_POSTED,
430 OMAP_DMA_WRITE_LAST_NON_POSTED
431};
432
433enum omap_dma_channel_mode {
434 OMAP_DMA_LCH_2D = 0,
435 OMAP_DMA_LCH_G,
436 OMAP_DMA_LCH_P,
437 OMAP_DMA_LCH_PD
438};
439
440struct omap_dma_channel_params {
441 int data_type; /* data type 8,16,32 */
442 int elem_count; /* number of elements in a frame */
443 int frame_count; /* number of frames in a element */
444
445 int src_port; /* Only on OMAP1 REVISIT: Is this needed? */
446 int src_amode; /* constant, post increment, indexed,
447 double indexed */
448 unsigned long src_start; /* source address : physical */
449 int src_ei; /* source element index */
450 int src_fi; /* source frame index */
451
452 int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */
453 int dst_amode; /* constant, post increment, indexed,
454 double indexed */
455 unsigned long dst_start; /* source address : physical */
456 int dst_ei; /* source element index */
457 int dst_fi; /* source frame index */
458
459 int trigger; /* trigger attached if the channel is
460 synchronized */
461 int sync_mode; /* sycn on element, frame , block or packet */
462 int src_or_dst_synch; /* source synch(1) or destination synch(0) */
463
464 int ie; /* interrupt enabled */
465
466 unsigned char read_prio;/* read priority */
467 unsigned char write_prio;/* write priority */
468
469#ifndef CONFIG_ARCH_OMAP1
470 enum omap_dma_burst_mode burst_mode; /* Burst mode 4/8/16 words */
471#endif
472};
473
474
475extern void omap_set_dma_priority(int lch, int dst_port, int priority);
476extern int omap_request_dma(int dev_id, const char *dev_name,
477 void (*callback)(int lch, u16 ch_status, void *data),
478 void *data, int *dma_ch);
479extern void omap_enable_dma_irq(int ch, u16 irq_bits);
480extern void omap_disable_dma_irq(int ch, u16 irq_bits);
481extern void omap_free_dma(int ch);
482extern void omap_start_dma(int lch);
483extern void omap_stop_dma(int lch);
484extern void omap_set_dma_transfer_params(int lch, int data_type,
485 int elem_count, int frame_count,
486 int sync_mode,
487 int dma_trigger, int src_or_dst_synch);
488extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode,
489 u32 color);
490extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode);
491extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode);
492
493extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
494 unsigned long src_start,
495 int src_ei, int src_fi);
496extern void omap_set_dma_src_index(int lch, int eidx, int fidx);
497extern void omap_set_dma_src_data_pack(int lch, int enable);
498extern void omap_set_dma_src_burst_mode(int lch,
499 enum omap_dma_burst_mode burst_mode);
500
501extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
502 unsigned long dest_start,
503 int dst_ei, int dst_fi);
504extern void omap_set_dma_dest_index(int lch, int eidx, int fidx);
505extern void omap_set_dma_dest_data_pack(int lch, int enable);
506extern void omap_set_dma_dest_burst_mode(int lch,
507 enum omap_dma_burst_mode burst_mode);
508
509extern void omap_set_dma_params(int lch,
510 struct omap_dma_channel_params *params);
511
512extern void omap_dma_link_lch(int lch_head, int lch_queue);
513extern void omap_dma_unlink_lch(int lch_head, int lch_queue);
514
515extern int omap_set_dma_callback(int lch,
516 void (*callback)(int lch, u16 ch_status, void *data),
517 void *data);
518extern dma_addr_t omap_get_dma_src_pos(int lch);
519extern dma_addr_t omap_get_dma_dst_pos(int lch);
520extern void omap_clear_dma(int lch);
521extern int omap_get_dma_active_status(int lch);
522extern int omap_dma_running(void);
523extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth,
524 int tparams);
525extern int omap_dma_set_prio_lch(int lch, unsigned char read_prio,
526 unsigned char write_prio);
527extern void omap_set_dma_dst_endian_type(int lch, enum end_type etype);
528extern void omap_set_dma_src_endian_type(int lch, enum end_type etype);
529extern int omap_get_dma_index(int lch, int *ei, int *fi);
530
531/* Chaining APIs */
532#ifndef CONFIG_ARCH_OMAP1
533extern int omap_request_dma_chain(int dev_id, const char *dev_name,
534 void (*callback) (int chain_id, u16 ch_status,
535 void *data),
536 int *chain_id, int no_of_chans,
537 int chain_mode,
538 struct omap_dma_channel_params params);
539extern int omap_free_dma_chain(int chain_id);
540extern int omap_dma_chain_a_transfer(int chain_id, int src_start,
541 int dest_start, int elem_count,
542 int frame_count, void *callbk_data);
543extern int omap_start_dma_chain_transfers(int chain_id);
544extern int omap_stop_dma_chain_transfers(int chain_id);
545extern int omap_get_dma_chain_index(int chain_id, int *ei, int *fi);
546extern int omap_get_dma_chain_dst_pos(int chain_id);
547extern int omap_get_dma_chain_src_pos(int chain_id);
548
549extern int omap_modify_dma_chain_params(int chain_id,
550 struct omap_dma_channel_params params);
551extern int omap_dma_chain_status(int chain_id);
552#endif
553
554/* LCD DMA functions */
555extern int omap_request_lcd_dma(void (*callback)(u16 status, void *data),
556 void *data);
557extern void omap_free_lcd_dma(void);
558extern void omap_setup_lcd_dma(void);
559extern void omap_enable_lcd_dma(void);
560extern void omap_stop_lcd_dma(void);
561extern void omap_set_lcd_dma_ext_controller(int external);
562extern void omap_set_lcd_dma_single_transfer(int single);
563extern void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
564 int data_type);
565extern void omap_set_lcd_dma_b1_rotation(int rotate);
566extern void omap_set_lcd_dma_b1_vxres(unsigned long vxres);
567extern void omap_set_lcd_dma_b1_mirror(int mirror);
568extern void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale);
569
570#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/plat-omap/include/mach/dmtimer.h b/arch/arm/plat-omap/include/mach/dmtimer.h
new file mode 100644
index 000000000000..6dc703138210
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/dmtimer.h
@@ -0,0 +1,84 @@
1/*
2 * arch/arm/plat-omap/include/mach/dmtimer.h
3 *
4 * OMAP Dual-Mode Timers
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 * Author: Lauri Leukkunen <lauri.leukkunen@nokia.com>
8 * PWM and clock framwork support by Timo Teras.
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29#ifndef __ASM_ARCH_DMTIMER_H
30#define __ASM_ARCH_DMTIMER_H
31
32/* clock sources */
33#define OMAP_TIMER_SRC_SYS_CLK 0x00
34#define OMAP_TIMER_SRC_32_KHZ 0x01
35#define OMAP_TIMER_SRC_EXT_CLK 0x02
36
37/* timer interrupt enable bits */
38#define OMAP_TIMER_INT_CAPTURE (1 << 2)
39#define OMAP_TIMER_INT_OVERFLOW (1 << 1)
40#define OMAP_TIMER_INT_MATCH (1 << 0)
41
42/* trigger types */
43#define OMAP_TIMER_TRIGGER_NONE 0x00
44#define OMAP_TIMER_TRIGGER_OVERFLOW 0x01
45#define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02
46
47struct omap_dm_timer;
48struct clk;
49
50int omap_dm_timer_init(void);
51
52struct omap_dm_timer *omap_dm_timer_request(void);
53struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
54void omap_dm_timer_free(struct omap_dm_timer *timer);
55void omap_dm_timer_enable(struct omap_dm_timer *timer);
56void omap_dm_timer_disable(struct omap_dm_timer *timer);
57
58int omap_dm_timer_get_irq(struct omap_dm_timer *timer);
59
60u32 omap_dm_timer_modify_idlect_mask(u32 inputmask);
61struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer);
62
63void omap_dm_timer_trigger(struct omap_dm_timer *timer);
64void omap_dm_timer_start(struct omap_dm_timer *timer);
65void omap_dm_timer_stop(struct omap_dm_timer *timer);
66
67void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source);
68void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value);
69void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value);
70void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match);
71void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger);
72void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler);
73
74void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value);
75
76unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer);
77void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value);
78unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer);
79void omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value);
80
81int omap_dm_timers_active(void);
82
83
84#endif /* __ASM_ARCH_DMTIMER_H */
diff --git a/arch/arm/plat-omap/include/mach/dsp_common.h b/arch/arm/plat-omap/include/mach/dsp_common.h
new file mode 100644
index 000000000000..da97736f3efa
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/dsp_common.h
@@ -0,0 +1,40 @@
1/*
2 * This file is part of OMAP DSP driver (DSP Gateway version 3.3.1)
3 *
4 * Copyright (C) 2004-2006 Nokia Corporation. All rights reserved.
5 *
6 * Contact: Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * 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., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef ASM_ARCH_DSP_COMMON_H
25#define ASM_ARCH_DSP_COMMON_H
26
27#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_OMAP_MMU_FWK)
28extern void omap_dsp_request_mpui(void);
29extern void omap_dsp_release_mpui(void);
30extern int omap_dsp_request_mem(void);
31extern int omap_dsp_release_mem(void);
32#else
33static inline int omap_dsp_request_mem(void)
34{
35 return 0;
36}
37#define omap_dsp_release_mem() do {} while (0)
38#endif
39
40#endif /* ASM_ARCH_DSP_COMMON_H */
diff --git a/arch/arm/plat-omap/include/mach/eac.h b/arch/arm/plat-omap/include/mach/eac.h
new file mode 100644
index 000000000000..9e62cf030270
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/eac.h
@@ -0,0 +1,100 @@
1/*
2 * arch/arm/plat-omap/include/mach2/eac.h
3 *
4 * Defines for Enhanced Audio Controller
5 *
6 * Contact: Jarkko Nikula <jarkko.nikula@nokia.com>
7 *
8 * Copyright (C) 2006 Nokia Corporation
9 * Copyright (C) 2004 Texas Instruments, Inc.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * version 2 as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * 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., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 *
25 */
26
27#ifndef __ASM_ARM_ARCH_OMAP2_EAC_H
28#define __ASM_ARM_ARCH_OMAP2_EAC_H
29
30#include <mach/io.h>
31#include <mach/hardware.h>
32#include <asm/irq.h>
33
34#include <sound/core.h>
35
36/* master codec clock source */
37#define EAC_MCLK_EXT_MASK 0x100
38enum eac_mclk_src {
39 EAC_MCLK_INT_11290000, /* internal 96 MHz / 8.5 = 11.29 Mhz */
40 EAC_MCLK_EXT_11289600 = EAC_MCLK_EXT_MASK,
41 EAC_MCLK_EXT_12288000,
42 EAC_MCLK_EXT_2x11289600,
43 EAC_MCLK_EXT_2x12288000,
44};
45
46/* codec port interface mode */
47enum eac_codec_mode {
48 EAC_CODEC_PCM,
49 EAC_CODEC_AC97,
50 EAC_CODEC_I2S_MASTER, /* codec port, I.e. EAC is the master */
51 EAC_CODEC_I2S_SLAVE,
52};
53
54/* configuration structure for I2S mode */
55struct eac_i2s_conf {
56 /* if enabled, then first data slot (left channel) is signaled as
57 * positive level of frame sync EAC.AC_FS */
58 unsigned polarity_changed_mode:1;
59 /* if enabled, then serial data starts one clock cycle after the
60 * of EAC.AC_FS for first audio slot */
61 unsigned sync_delay_enable:1;
62};
63
64/* configuration structure for EAC codec port */
65struct eac_codec {
66 enum eac_mclk_src mclk_src;
67
68 enum eac_codec_mode codec_mode;
69 union {
70 struct eac_i2s_conf i2s;
71 } codec_conf;
72
73 int default_rate; /* audio sampling rate */
74
75 int (* set_power)(void *private_data, int dac, int adc);
76 int (* register_controls)(void *private_data,
77 struct snd_card *card);
78 const char *short_name;
79
80 void *private_data;
81};
82
83/* structure for passing platform dependent data to the EAC driver */
84struct eac_platform_data {
85 int (* init)(struct device *eac_dev);
86 void (* cleanup)(struct device *eac_dev);
87 /* these callbacks are used to configure & control external MCLK
88 * source. NULL if not used */
89 int (* enable_ext_clocks)(struct device *eac_dev);
90 void (* disable_ext_clocks)(struct device *eac_dev);
91};
92
93extern void omap_init_eac(struct eac_platform_data *pdata);
94
95extern int eac_register_codec(struct device *eac_dev, struct eac_codec *codec);
96extern void eac_unregister_codec(struct device *eac_dev);
97
98extern int eac_set_mode(struct device *eac_dev, int play, int rec);
99
100#endif /* __ASM_ARM_ARCH_OMAP2_EAC_H */
diff --git a/arch/arm/plat-omap/include/mach/entry-macro.S b/arch/arm/plat-omap/include/mach/entry-macro.S
new file mode 100644
index 000000000000..d4e9043bf201
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/entry-macro.S
@@ -0,0 +1,89 @@
1/*
2 * arch/arm/plat-omap/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for OMAP-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#include <mach/io.h>
12#include <mach/irqs.h>
13
14#if defined(CONFIG_ARCH_OMAP1)
15
16#if defined(CONFIG_ARCH_OMAP730) && \
17 (defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX))
18#error "FIXME: OMAP730 doesn't support multiple-OMAP"
19#elif defined(CONFIG_ARCH_OMAP730)
20#define INT_IH2_IRQ INT_730_IH2_IRQ
21#elif defined(CONFIG_ARCH_OMAP15XX)
22#define INT_IH2_IRQ INT_1510_IH2_IRQ
23#elif defined(CONFIG_ARCH_OMAP16XX)
24#define INT_IH2_IRQ INT_1610_IH2_IRQ
25#else
26#warning "IH2 IRQ defaulted"
27#define INT_IH2_IRQ INT_1510_IH2_IRQ
28#endif
29
30 .macro disable_fiq
31 .endm
32
33 .macro get_irqnr_preamble, base, tmp
34 .endm
35
36 .macro arch_ret_to_user, tmp1, tmp2
37 .endm
38
39 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
40 ldr \base, =IO_ADDRESS(OMAP_IH1_BASE)
41 ldr \irqnr, [\base, #IRQ_ITR_REG_OFFSET]
42 ldr \tmp, [\base, #IRQ_MIR_REG_OFFSET]
43 mov \irqstat, #0xffffffff
44 bic \tmp, \irqstat, \tmp
45 tst \irqnr, \tmp
46 beq 1510f
47
48 ldr \irqnr, [\base, #IRQ_SIR_FIQ_REG_OFFSET]
49 cmp \irqnr, #0
50 ldreq \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET]
51 cmpeq \irqnr, #INT_IH2_IRQ
52 ldreq \base, =IO_ADDRESS(OMAP_IH2_BASE)
53 ldreq \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET]
54 addeqs \irqnr, \irqnr, #32
551510:
56 .endm
57
58#elif defined(CONFIG_ARCH_OMAP24XX)
59
60#include <mach/omap24xx.h>
61
62 .macro disable_fiq
63 .endm
64
65 .macro get_irqnr_preamble, base, tmp
66 .endm
67
68 .macro arch_ret_to_user, tmp1, tmp2
69 .endm
70
71 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
72 ldr \base, =OMAP2_VA_IC_BASE
73 ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */
74 cmp \irqnr, #0x0
75 bne 2222f
76 ldr \irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
77 cmp \irqnr, #0x0
78 bne 2222f
79 ldr \irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
80 cmp \irqnr, #0x0
812222:
82 ldrne \irqnr, [\base, #IRQ_SIR_IRQ]
83
84 .endm
85
86 .macro irq_prio_table
87 .endm
88
89#endif
diff --git a/arch/arm/plat-omap/include/mach/fpga.h b/arch/arm/plat-omap/include/mach/fpga.h
new file mode 100644
index 000000000000..c92e4b42b289
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/fpga.h
@@ -0,0 +1,197 @@
1/*
2 * arch/arm/plat-omap/include/mach/fpga.h
3 *
4 * Interrupt handler for OMAP-1510 FPGA
5 *
6 * Copyright (C) 2001 RidgeRun, Inc.
7 * Author: Greg Lonnon <glonnon@ridgerun.com>
8 *
9 * Copyright (C) 2002 MontaVista Software, Inc.
10 *
11 * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6
12 * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#ifndef __ASM_ARCH_OMAP_FPGA_H
20#define __ASM_ARCH_OMAP_FPGA_H
21
22#if defined(CONFIG_MACH_OMAP_INNOVATOR) && defined(CONFIG_ARCH_OMAP15XX)
23extern void omap1510_fpga_init_irq(void);
24#else
25#define omap1510_fpga_init_irq() (0)
26#endif
27
28#define fpga_read(reg) __raw_readb(reg)
29#define fpga_write(val, reg) __raw_writeb(val, reg)
30
31/*
32 * ---------------------------------------------------------------------------
33 * H2/P2 Debug board FPGA
34 * ---------------------------------------------------------------------------
35 */
36/* maps in the FPGA registers and the ETHR registers */
37#define H2P2_DBG_FPGA_BASE 0xE8000000 /* VA */
38#define H2P2_DBG_FPGA_SIZE SZ_4K /* SIZE */
39#define H2P2_DBG_FPGA_START 0x04000000 /* PA */
40
41#define H2P2_DBG_FPGA_ETHR_START (H2P2_DBG_FPGA_START + 0x300)
42#define H2P2_DBG_FPGA_FPGA_REV (H2P2_DBG_FPGA_BASE + 0x10) /* FPGA Revision */
43#define H2P2_DBG_FPGA_BOARD_REV (H2P2_DBG_FPGA_BASE + 0x12) /* Board Revision */
44#define H2P2_DBG_FPGA_GPIO (H2P2_DBG_FPGA_BASE + 0x14) /* GPIO outputs */
45#define H2P2_DBG_FPGA_LEDS (H2P2_DBG_FPGA_BASE + 0x16) /* LEDs outputs */
46#define H2P2_DBG_FPGA_MISC_INPUTS (H2P2_DBG_FPGA_BASE + 0x18) /* Misc inputs */
47#define H2P2_DBG_FPGA_LAN_STATUS (H2P2_DBG_FPGA_BASE + 0x1A) /* LAN Status line */
48#define H2P2_DBG_FPGA_LAN_RESET (H2P2_DBG_FPGA_BASE + 0x1C) /* LAN Reset line */
49
50/* NOTE: most boards don't have a static mapping for the FPGA ... */
51struct h2p2_dbg_fpga {
52 /* offset 0x00 */
53 u16 smc91x[8];
54 /* offset 0x10 */
55 u16 fpga_rev;
56 u16 board_rev;
57 u16 gpio_outputs;
58 u16 leds;
59 /* offset 0x18 */
60 u16 misc_inputs;
61 u16 lan_status;
62 u16 lan_reset;
63 u16 reserved0;
64 /* offset 0x20 */
65 u16 ps2_data;
66 u16 ps2_ctrl;
67 /* plus also 4 rs232 ports ... */
68};
69
70/* LEDs definition on debug board (16 LEDs, all physically green) */
71#define H2P2_DBG_FPGA_LED_GREEN (1 << 15)
72#define H2P2_DBG_FPGA_LED_AMBER (1 << 14)
73#define H2P2_DBG_FPGA_LED_RED (1 << 13)
74#define H2P2_DBG_FPGA_LED_BLUE (1 << 12)
75/* cpu0 load-meter LEDs */
76#define H2P2_DBG_FPGA_LOAD_METER (1 << 0) // A bit of fun on our board ...
77#define H2P2_DBG_FPGA_LOAD_METER_SIZE 11
78#define H2P2_DBG_FPGA_LOAD_METER_MASK ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1)
79
80#define H2P2_DBG_FPGA_P2_LED_TIMER (1 << 0)
81#define H2P2_DBG_FPGA_P2_LED_IDLE (1 << 1)
82
83/*
84 * ---------------------------------------------------------------------------
85 * OMAP-1510 FPGA
86 * ---------------------------------------------------------------------------
87 */
88#define OMAP1510_FPGA_BASE 0xE8000000 /* Virtual */
89#define OMAP1510_FPGA_SIZE SZ_4K
90#define OMAP1510_FPGA_START 0x08000000 /* Physical */
91
92/* Revision */
93#define OMAP1510_FPGA_REV_LOW (OMAP1510_FPGA_BASE + 0x0)
94#define OMAP1510_FPGA_REV_HIGH (OMAP1510_FPGA_BASE + 0x1)
95
96#define OMAP1510_FPGA_LCD_PANEL_CONTROL (OMAP1510_FPGA_BASE + 0x2)
97#define OMAP1510_FPGA_LED_DIGIT (OMAP1510_FPGA_BASE + 0x3)
98#define INNOVATOR_FPGA_HID_SPI (OMAP1510_FPGA_BASE + 0x4)
99#define OMAP1510_FPGA_POWER (OMAP1510_FPGA_BASE + 0x5)
100
101/* Interrupt status */
102#define OMAP1510_FPGA_ISR_LO (OMAP1510_FPGA_BASE + 0x6)
103#define OMAP1510_FPGA_ISR_HI (OMAP1510_FPGA_BASE + 0x7)
104
105/* Interrupt mask */
106#define OMAP1510_FPGA_IMR_LO (OMAP1510_FPGA_BASE + 0x8)
107#define OMAP1510_FPGA_IMR_HI (OMAP1510_FPGA_BASE + 0x9)
108
109/* Reset registers */
110#define OMAP1510_FPGA_HOST_RESET (OMAP1510_FPGA_BASE + 0xa)
111#define OMAP1510_FPGA_RST (OMAP1510_FPGA_BASE + 0xb)
112
113#define OMAP1510_FPGA_AUDIO (OMAP1510_FPGA_BASE + 0xc)
114#define OMAP1510_FPGA_DIP (OMAP1510_FPGA_BASE + 0xe)
115#define OMAP1510_FPGA_FPGA_IO (OMAP1510_FPGA_BASE + 0xf)
116#define OMAP1510_FPGA_UART1 (OMAP1510_FPGA_BASE + 0x14)
117#define OMAP1510_FPGA_UART2 (OMAP1510_FPGA_BASE + 0x15)
118#define OMAP1510_FPGA_OMAP1510_STATUS (OMAP1510_FPGA_BASE + 0x16)
119#define OMAP1510_FPGA_BOARD_REV (OMAP1510_FPGA_BASE + 0x18)
120#define OMAP1510P1_PPT_DATA (OMAP1510_FPGA_BASE + 0x100)
121#define OMAP1510P1_PPT_STATUS (OMAP1510_FPGA_BASE + 0x101)
122#define OMAP1510P1_PPT_CONTROL (OMAP1510_FPGA_BASE + 0x102)
123
124#define OMAP1510_FPGA_TOUCHSCREEN (OMAP1510_FPGA_BASE + 0x204)
125
126#define INNOVATOR_FPGA_INFO (OMAP1510_FPGA_BASE + 0x205)
127#define INNOVATOR_FPGA_LCD_BRIGHT_LO (OMAP1510_FPGA_BASE + 0x206)
128#define INNOVATOR_FPGA_LCD_BRIGHT_HI (OMAP1510_FPGA_BASE + 0x207)
129#define INNOVATOR_FPGA_LED_GRN_LO (OMAP1510_FPGA_BASE + 0x208)
130#define INNOVATOR_FPGA_LED_GRN_HI (OMAP1510_FPGA_BASE + 0x209)
131#define INNOVATOR_FPGA_LED_RED_LO (OMAP1510_FPGA_BASE + 0x20a)
132#define INNOVATOR_FPGA_LED_RED_HI (OMAP1510_FPGA_BASE + 0x20b)
133#define INNOVATOR_FPGA_CAM_USB_CONTROL (OMAP1510_FPGA_BASE + 0x20c)
134#define INNOVATOR_FPGA_EXP_CONTROL (OMAP1510_FPGA_BASE + 0x20d)
135#define INNOVATOR_FPGA_ISR2 (OMAP1510_FPGA_BASE + 0x20e)
136#define INNOVATOR_FPGA_IMR2 (OMAP1510_FPGA_BASE + 0x210)
137
138#define OMAP1510_FPGA_ETHR_START (OMAP1510_FPGA_START + 0x300)
139
140/*
141 * Power up Giga UART driver, turn on HID clock.
142 * Turn off BT power, since we're not using it and it
143 * draws power.
144 */
145#define OMAP1510_FPGA_RESET_VALUE 0x42
146
147#define OMAP1510_FPGA_PCR_IF_PD0 (1 << 7)
148#define OMAP1510_FPGA_PCR_COM2_EN (1 << 6)
149#define OMAP1510_FPGA_PCR_COM1_EN (1 << 5)
150#define OMAP1510_FPGA_PCR_EXP_PD0 (1 << 4)
151#define OMAP1510_FPGA_PCR_EXP_PD1 (1 << 3)
152#define OMAP1510_FPGA_PCR_48MHZ_CLK (1 << 2)
153#define OMAP1510_FPGA_PCR_4MHZ_CLK (1 << 1)
154#define OMAP1510_FPGA_PCR_RSRVD_BIT0 (1 << 0)
155
156/*
157 * Innovator/OMAP1510 FPGA HID register bit definitions
158 */
159#define OMAP1510_FPGA_HID_SCLK (1<<0) /* output */
160#define OMAP1510_FPGA_HID_MOSI (1<<1) /* output */
161#define OMAP1510_FPGA_HID_nSS (1<<2) /* output 0/1 chip idle/select */
162#define OMAP1510_FPGA_HID_nHSUS (1<<3) /* output 0/1 host active/suspended */
163#define OMAP1510_FPGA_HID_MISO (1<<4) /* input */
164#define OMAP1510_FPGA_HID_ATN (1<<5) /* input 0/1 chip idle/ATN */
165#define OMAP1510_FPGA_HID_rsrvd (1<<6)
166#define OMAP1510_FPGA_HID_RESETn (1<<7) /* output - 0/1 USAR reset/run */
167
168/* The FPGA IRQ is cascaded through GPIO_13 */
169#define OMAP1510_INT_FPGA (IH_GPIO_BASE + 13)
170
171/* IRQ Numbers for interrupts muxed through the FPGA */
172#define OMAP1510_INT_FPGA_ATN (OMAP_FPGA_IRQ_BASE + 0)
173#define OMAP1510_INT_FPGA_ACK (OMAP_FPGA_IRQ_BASE + 1)
174#define OMAP1510_INT_FPGA2 (OMAP_FPGA_IRQ_BASE + 2)
175#define OMAP1510_INT_FPGA3 (OMAP_FPGA_IRQ_BASE + 3)
176#define OMAP1510_INT_FPGA4 (OMAP_FPGA_IRQ_BASE + 4)
177#define OMAP1510_INT_FPGA5 (OMAP_FPGA_IRQ_BASE + 5)
178#define OMAP1510_INT_FPGA6 (OMAP_FPGA_IRQ_BASE + 6)
179#define OMAP1510_INT_FPGA7 (OMAP_FPGA_IRQ_BASE + 7)
180#define OMAP1510_INT_FPGA8 (OMAP_FPGA_IRQ_BASE + 8)
181#define OMAP1510_INT_FPGA9 (OMAP_FPGA_IRQ_BASE + 9)
182#define OMAP1510_INT_FPGA10 (OMAP_FPGA_IRQ_BASE + 10)
183#define OMAP1510_INT_FPGA11 (OMAP_FPGA_IRQ_BASE + 11)
184#define OMAP1510_INT_FPGA12 (OMAP_FPGA_IRQ_BASE + 12)
185#define OMAP1510_INT_ETHER (OMAP_FPGA_IRQ_BASE + 13)
186#define OMAP1510_INT_FPGAUART1 (OMAP_FPGA_IRQ_BASE + 14)
187#define OMAP1510_INT_FPGAUART2 (OMAP_FPGA_IRQ_BASE + 15)
188#define OMAP1510_INT_FPGA_TS (OMAP_FPGA_IRQ_BASE + 16)
189#define OMAP1510_INT_FPGA17 (OMAP_FPGA_IRQ_BASE + 17)
190#define OMAP1510_INT_FPGA_CAM (OMAP_FPGA_IRQ_BASE + 18)
191#define OMAP1510_INT_FPGA_RTC_A (OMAP_FPGA_IRQ_BASE + 19)
192#define OMAP1510_INT_FPGA_RTC_B (OMAP_FPGA_IRQ_BASE + 20)
193#define OMAP1510_INT_FPGA_CD (OMAP_FPGA_IRQ_BASE + 21)
194#define OMAP1510_INT_FPGA22 (OMAP_FPGA_IRQ_BASE + 22)
195#define OMAP1510_INT_FPGA23 (OMAP_FPGA_IRQ_BASE + 23)
196
197#endif
diff --git a/arch/arm/plat-omap/include/mach/gpio-switch.h b/arch/arm/plat-omap/include/mach/gpio-switch.h
new file mode 100644
index 000000000000..10da0e07c0cf
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/gpio-switch.h
@@ -0,0 +1,54 @@
1/*
2 * GPIO switch definitions
3 *
4 * Copyright (C) 2006 Nokia Corporation
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_OMAP_GPIO_SWITCH_H
12#define __ASM_ARCH_OMAP_GPIO_SWITCH_H
13
14#include <linux/types.h>
15
16/* Cover:
17 * high -> closed
18 * low -> open
19 * Connection:
20 * high -> connected
21 * low -> disconnected
22 * Activity:
23 * high -> active
24 * low -> inactive
25 *
26 */
27#define OMAP_GPIO_SWITCH_TYPE_COVER 0x0000
28#define OMAP_GPIO_SWITCH_TYPE_CONNECTION 0x0001
29#define OMAP_GPIO_SWITCH_TYPE_ACTIVITY 0x0002
30#define OMAP_GPIO_SWITCH_FLAG_INVERTED 0x0001
31#define OMAP_GPIO_SWITCH_FLAG_OUTPUT 0x0002
32
33struct omap_gpio_switch {
34 const char *name;
35 s16 gpio;
36 unsigned flags:4;
37 unsigned type:4;
38
39 /* Time in ms to debounce when transitioning from
40 * inactive state to active state. */
41 u16 debounce_rising;
42 /* Same for transition from active to inactive state. */
43 u16 debounce_falling;
44
45 /* notify board-specific code about state changes */
46 void (* notify)(void *data, int state);
47 void *notify_data;
48};
49
50/* Call at init time only */
51extern void omap_register_gpio_switches(const struct omap_gpio_switch *tbl,
52 int count);
53
54#endif
diff --git a/arch/arm/plat-omap/include/mach/gpio.h b/arch/arm/plat-omap/include/mach/gpio.h
new file mode 100644
index 000000000000..94ce2780e8ee
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/gpio.h
@@ -0,0 +1,122 @@
1/*
2 * arch/arm/plat-omap/include/mach/gpio.h
3 *
4 * OMAP GPIO handling defines and functions
5 *
6 * Copyright (C) 2003-2005 Nokia Corporation
7 *
8 * Written by Juha Yrjölä <juha.yrjola@nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#ifndef __ASM_ARCH_OMAP_GPIO_H
27#define __ASM_ARCH_OMAP_GPIO_H
28
29#include <mach/irqs.h>
30#include <asm/io.h>
31
32#define OMAP_MPUIO_BASE (void __iomem *)0xfffb5000
33
34#ifdef CONFIG_ARCH_OMAP730
35#define OMAP_MPUIO_INPUT_LATCH 0x00
36#define OMAP_MPUIO_OUTPUT 0x02
37#define OMAP_MPUIO_IO_CNTL 0x04
38#define OMAP_MPUIO_KBR_LATCH 0x08
39#define OMAP_MPUIO_KBC 0x0a
40#define OMAP_MPUIO_GPIO_EVENT_MODE 0x0c
41#define OMAP_MPUIO_GPIO_INT_EDGE 0x0e
42#define OMAP_MPUIO_KBD_INT 0x10
43#define OMAP_MPUIO_GPIO_INT 0x12
44#define OMAP_MPUIO_KBD_MASKIT 0x14
45#define OMAP_MPUIO_GPIO_MASKIT 0x16
46#define OMAP_MPUIO_GPIO_DEBOUNCING 0x18
47#define OMAP_MPUIO_LATCH 0x1a
48#else
49#define OMAP_MPUIO_INPUT_LATCH 0x00
50#define OMAP_MPUIO_OUTPUT 0x04
51#define OMAP_MPUIO_IO_CNTL 0x08
52#define OMAP_MPUIO_KBR_LATCH 0x10
53#define OMAP_MPUIO_KBC 0x14
54#define OMAP_MPUIO_GPIO_EVENT_MODE 0x18
55#define OMAP_MPUIO_GPIO_INT_EDGE 0x1c
56#define OMAP_MPUIO_KBD_INT 0x20
57#define OMAP_MPUIO_GPIO_INT 0x24
58#define OMAP_MPUIO_KBD_MASKIT 0x28
59#define OMAP_MPUIO_GPIO_MASKIT 0x2c
60#define OMAP_MPUIO_GPIO_DEBOUNCING 0x30
61#define OMAP_MPUIO_LATCH 0x34
62#endif
63
64#define OMAP34XX_NR_GPIOS 6
65
66#define OMAP_MPUIO(nr) (OMAP_MAX_GPIO_LINES + (nr))
67#define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES)
68
69#define OMAP_GPIO_IRQ(nr) (OMAP_GPIO_IS_MPUIO(nr) ? \
70 IH_MPUIO_BASE + ((nr) & 0x0f) : \
71 IH_GPIO_BASE + (nr))
72
73extern int omap_gpio_init(void); /* Call from board init only */
74extern int omap_request_gpio(int gpio);
75extern void omap_free_gpio(int gpio);
76extern void omap_set_gpio_direction(int gpio, int is_input);
77extern void omap_set_gpio_dataout(int gpio, int enable);
78extern int omap_get_gpio_datain(int gpio);
79extern void omap_set_gpio_debounce(int gpio, int enable);
80extern void omap_set_gpio_debounce_time(int gpio, int enable);
81
82/*-------------------------------------------------------------------------*/
83
84/* Wrappers for "new style" GPIO calls, using the new infrastructure
85 * which lets us plug in FPGA, I2C, and other implementations.
86 * *
87 * The original OMAP-specfic calls should eventually be removed.
88 */
89
90#include <linux/errno.h>
91#include <asm-generic/gpio.h>
92
93static inline int gpio_get_value(unsigned gpio)
94{
95 return __gpio_get_value(gpio);
96}
97
98static inline void gpio_set_value(unsigned gpio, int value)
99{
100 __gpio_set_value(gpio, value);
101}
102
103static inline int gpio_cansleep(unsigned gpio)
104{
105 return __gpio_cansleep(gpio);
106}
107
108static inline int gpio_to_irq(unsigned gpio)
109{
110 if (gpio < (OMAP_MAX_GPIO_LINES + 16))
111 return OMAP_GPIO_IRQ(gpio);
112 return -EINVAL;
113}
114
115static inline int irq_to_gpio(unsigned irq)
116{
117 if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16)))
118 return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES;
119 return irq - IH_GPIO_BASE;
120}
121
122#endif
diff --git a/arch/arm/plat-omap/include/mach/gpioexpander.h b/arch/arm/plat-omap/include/mach/gpioexpander.h
new file mode 100644
index 000000000000..90444a0d6b1a
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/gpioexpander.h
@@ -0,0 +1,35 @@
1/*
2 * arch/arm/plat-omap/include/mach/gpioexpander.h
3 *
4 *
5 * Copyright (C) 2004 Texas Instruments, Inc.
6 *
7 * This package 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 PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
12 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 */
15
16#ifndef __ASM_ARCH_OMAP_GPIOEXPANDER_H
17#define __ASM_ARCH_OMAP_GPIOEXPANDER_H
18
19/* Function Prototypes for GPIO Expander functions */
20
21#ifdef CONFIG_GPIOEXPANDER_OMAP
22int read_gpio_expa(u8 *, int);
23int write_gpio_expa(u8 , int);
24#else
25static inline int read_gpio_expa(u8 *val, int addr)
26{
27 return 0;
28}
29static inline int write_gpio_expa(u8 val, int addr)
30{
31 return 0;
32}
33#endif
34
35#endif /* __ASM_ARCH_OMAP_GPIOEXPANDER_H */
diff --git a/arch/arm/plat-omap/include/mach/gpmc.h b/arch/arm/plat-omap/include/mach/gpmc.h
new file mode 100644
index 000000000000..6a8e07ffc2d0
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/gpmc.h
@@ -0,0 +1,96 @@
1/*
2 * General-Purpose Memory Controller for OMAP2
3 *
4 * Copyright (C) 2005-2006 Nokia Corporation
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 __OMAP2_GPMC_H
12#define __OMAP2_GPMC_H
13
14#define GPMC_CS_CONFIG1 0x00
15#define GPMC_CS_CONFIG2 0x04
16#define GPMC_CS_CONFIG3 0x08
17#define GPMC_CS_CONFIG4 0x0c
18#define GPMC_CS_CONFIG5 0x10
19#define GPMC_CS_CONFIG6 0x14
20#define GPMC_CS_CONFIG7 0x18
21#define GPMC_CS_NAND_COMMAND 0x1c
22#define GPMC_CS_NAND_ADDRESS 0x20
23#define GPMC_CS_NAND_DATA 0x24
24
25#define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31)
26#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30)
27#define GPMC_CONFIG1_READTYPE_ASYNC (0 << 29)
28#define GPMC_CONFIG1_READTYPE_SYNC (1 << 29)
29#define GPMC_CONFIG1_WRITEMULTIPLE_SUPP (1 << 28)
30#define GPMC_CONFIG1_WRITETYPE_ASYNC (0 << 27)
31#define GPMC_CONFIG1_WRITETYPE_SYNC (1 << 27)
32#define GPMC_CONFIG1_CLKACTIVATIONTIME(val) ((val & 3) << 25)
33#define GPMC_CONFIG1_PAGE_LEN(val) ((val & 3) << 23)
34#define GPMC_CONFIG1_WAIT_READ_MON (1 << 22)
35#define GPMC_CONFIG1_WAIT_WRITE_MON (1 << 21)
36#define GPMC_CONFIG1_WAIT_MON_IIME(val) ((val & 3) << 18)
37#define GPMC_CONFIG1_WAIT_PIN_SEL(val) ((val & 3) << 16)
38#define GPMC_CONFIG1_DEVICESIZE(val) ((val & 3) << 12)
39#define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1)
40#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10)
41#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0)
42#define GPMC_CONFIG1_DEVICETYPE_NAND GPMC_CONFIG1_DEVICETYPE(1)
43#define GPMC_CONFIG1_MUXADDDATA (1 << 9)
44#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4)
45#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3)
46#define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1))
47#define GPMC_CONFIG1_FCLK_DIV3 (GPMC_CONFIG1_FCLK_DIV(2))
48#define GPMC_CONFIG1_FCLK_DIV4 (GPMC_CONFIG1_FCLK_DIV(3))
49
50/*
51 * Note that all values in this struct are in nanoseconds, while
52 * the register values are in gpmc_fck cycles.
53 */
54struct gpmc_timings {
55 /* Minimum clock period for synchronous mode */
56 u16 sync_clk;
57
58 /* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */
59 u16 cs_on; /* Assertion time */
60 u16 cs_rd_off; /* Read deassertion time */
61 u16 cs_wr_off; /* Write deassertion time */
62
63 /* ADV signal timings corresponding to GPMC_CONFIG3 */
64 u16 adv_on; /* Assertion time */
65 u16 adv_rd_off; /* Read deassertion time */
66 u16 adv_wr_off; /* Write deassertion time */
67
68 /* WE signals timings corresponding to GPMC_CONFIG4 */
69 u16 we_on; /* WE assertion time */
70 u16 we_off; /* WE deassertion time */
71
72 /* OE signals timings corresponding to GPMC_CONFIG4 */
73 u16 oe_on; /* OE assertion time */
74 u16 oe_off; /* OE deassertion time */
75
76 /* Access time and cycle time timings corresponding to GPMC_CONFIG5 */
77 u16 page_burst_access; /* Multiple access word delay */
78 u16 access; /* Start-cycle to first data valid delay */
79 u16 rd_cycle; /* Total read cycle time */
80 u16 wr_cycle; /* Total write cycle time */
81};
82
83extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns);
84extern unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns);
85extern unsigned long gpmc_get_fclk_period(void);
86
87extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
88extern u32 gpmc_cs_read_reg(int cs, int idx);
89extern int gpmc_cs_calc_divider(int cs, unsigned int sync_clk);
90extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
91extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
92extern void gpmc_cs_free(int cs);
93extern int gpmc_cs_set_reserved(int cs, int reserved);
94extern int gpmc_cs_reserved(int cs);
95
96#endif
diff --git a/arch/arm/plat-omap/include/mach/hardware.h b/arch/arm/plat-omap/include/mach/hardware.h
new file mode 100644
index 000000000000..07f5d7f21528
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/hardware.h
@@ -0,0 +1,355 @@
1/*
2 * arch/arm/plat-omap/include/mach/hardware.h
3 *
4 * Hardware definitions for TI OMAP processors and boards
5 *
6 * NOTE: Please put device driver specific defines into a separate header
7 * file for each driver.
8 *
9 * Copyright (C) 2001 RidgeRun, Inc.
10 * Author: RidgeRun, Inc. Greg Lonnon <glonnon@ridgerun.com>
11 *
12 * Reorganized for Linux-2.6 by Tony Lindgren <tony@atomide.com>
13 * and Dirk Behme <dirk.behme@de.bosch.com>
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
23 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35
36#ifndef __ASM_ARCH_OMAP_HARDWARE_H
37#define __ASM_ARCH_OMAP_HARDWARE_H
38
39#include <asm/sizes.h>
40#ifndef __ASSEMBLER__
41#include <asm/types.h>
42#include <mach/cpu.h>
43#endif
44#include <mach/serial.h>
45
46/*
47 * ---------------------------------------------------------------------------
48 * Common definitions for all OMAP processors
49 * NOTE: Put all processor or board specific parts to the special header
50 * files.
51 * ---------------------------------------------------------------------------
52 */
53
54/*
55 * ----------------------------------------------------------------------------
56 * Timers
57 * ----------------------------------------------------------------------------
58 */
59#define OMAP_MPU_TIMER1_BASE (0xfffec500)
60#define OMAP_MPU_TIMER2_BASE (0xfffec600)
61#define OMAP_MPU_TIMER3_BASE (0xfffec700)
62#define MPU_TIMER_FREE (1 << 6)
63#define MPU_TIMER_CLOCK_ENABLE (1 << 5)
64#define MPU_TIMER_AR (1 << 1)
65#define MPU_TIMER_ST (1 << 0)
66
67/*
68 * ----------------------------------------------------------------------------
69 * Clocks
70 * ----------------------------------------------------------------------------
71 */
72#define CLKGEN_REG_BASE (0xfffece00)
73#define ARM_CKCTL (CLKGEN_REG_BASE + 0x0)
74#define ARM_IDLECT1 (CLKGEN_REG_BASE + 0x4)
75#define ARM_IDLECT2 (CLKGEN_REG_BASE + 0x8)
76#define ARM_EWUPCT (CLKGEN_REG_BASE + 0xC)
77#define ARM_RSTCT1 (CLKGEN_REG_BASE + 0x10)
78#define ARM_RSTCT2 (CLKGEN_REG_BASE + 0x14)
79#define ARM_SYSST (CLKGEN_REG_BASE + 0x18)
80#define ARM_IDLECT3 (CLKGEN_REG_BASE + 0x24)
81
82#define CK_RATEF 1
83#define CK_IDLEF 2
84#define CK_ENABLEF 4
85#define CK_SELECTF 8
86#define SETARM_IDLE_SHIFT
87
88/* DPLL control registers */
89#define DPLL_CTL (0xfffecf00)
90
91/* DSP clock control. Must use __raw_readw() and __raw_writew() with these */
92#define DSP_CONFIG_REG_BASE (0xe1008000)
93#define DSP_CKCTL (DSP_CONFIG_REG_BASE + 0x0)
94#define DSP_IDLECT1 (DSP_CONFIG_REG_BASE + 0x4)
95#define DSP_IDLECT2 (DSP_CONFIG_REG_BASE + 0x8)
96#define DSP_RSTCT2 (DSP_CONFIG_REG_BASE + 0x14)
97
98/*
99 * ---------------------------------------------------------------------------
100 * UPLD
101 * ---------------------------------------------------------------------------
102 */
103#define ULPD_REG_BASE (0xfffe0800)
104#define ULPD_IT_STATUS (ULPD_REG_BASE + 0x14)
105#define ULPD_SETUP_ANALOG_CELL_3 (ULPD_REG_BASE + 0x24)
106#define ULPD_CLOCK_CTRL (ULPD_REG_BASE + 0x30)
107# define DIS_USB_PVCI_CLK (1 << 5) /* no USB/FAC synch */
108# define USB_MCLK_EN (1 << 4) /* enable W4_USB_CLKO */
109#define ULPD_SOFT_REQ (ULPD_REG_BASE + 0x34)
110# define SOFT_UDC_REQ (1 << 4)
111# define SOFT_USB_CLK_REQ (1 << 3)
112# define SOFT_DPLL_REQ (1 << 0)
113#define ULPD_DPLL_CTRL (ULPD_REG_BASE + 0x3c)
114#define ULPD_STATUS_REQ (ULPD_REG_BASE + 0x40)
115#define ULPD_APLL_CTRL (ULPD_REG_BASE + 0x4c)
116#define ULPD_POWER_CTRL (ULPD_REG_BASE + 0x50)
117#define ULPD_SOFT_DISABLE_REQ_REG (ULPD_REG_BASE + 0x68)
118# define DIS_MMC2_DPLL_REQ (1 << 11)
119# define DIS_MMC1_DPLL_REQ (1 << 10)
120# define DIS_UART3_DPLL_REQ (1 << 9)
121# define DIS_UART2_DPLL_REQ (1 << 8)
122# define DIS_UART1_DPLL_REQ (1 << 7)
123# define DIS_USB_HOST_DPLL_REQ (1 << 6)
124#define ULPD_SDW_CLK_DIV_CTRL_SEL (ULPD_REG_BASE + 0x74)
125#define ULPD_CAM_CLK_CTRL (ULPD_REG_BASE + 0x7c)
126
127/*
128 * ---------------------------------------------------------------------------
129 * Watchdog timer
130 * ---------------------------------------------------------------------------
131 */
132
133/* Watchdog timer within the OMAP3.2 gigacell */
134#define OMAP_MPU_WATCHDOG_BASE (0xfffec800)
135#define OMAP_WDT_TIMER (OMAP_MPU_WATCHDOG_BASE + 0x0)
136#define OMAP_WDT_LOAD_TIM (OMAP_MPU_WATCHDOG_BASE + 0x4)
137#define OMAP_WDT_READ_TIM (OMAP_MPU_WATCHDOG_BASE + 0x4)
138#define OMAP_WDT_TIMER_MODE (OMAP_MPU_WATCHDOG_BASE + 0x8)
139
140/*
141 * ---------------------------------------------------------------------------
142 * Interrupts
143 * ---------------------------------------------------------------------------
144 */
145#ifdef CONFIG_ARCH_OMAP1
146
147/*
148 * XXX: These probably want to be moved to arch/arm/mach-omap/omap1/irq.c
149 * or something similar.. -- PFM.
150 */
151
152#define OMAP_IH1_BASE 0xfffecb00
153#define OMAP_IH2_BASE 0xfffe0000
154
155#define OMAP_IH1_ITR (OMAP_IH1_BASE + 0x00)
156#define OMAP_IH1_MIR (OMAP_IH1_BASE + 0x04)
157#define OMAP_IH1_SIR_IRQ (OMAP_IH1_BASE + 0x10)
158#define OMAP_IH1_SIR_FIQ (OMAP_IH1_BASE + 0x14)
159#define OMAP_IH1_CONTROL (OMAP_IH1_BASE + 0x18)
160#define OMAP_IH1_ILR0 (OMAP_IH1_BASE + 0x1c)
161#define OMAP_IH1_ISR (OMAP_IH1_BASE + 0x9c)
162
163#define OMAP_IH2_ITR (OMAP_IH2_BASE + 0x00)
164#define OMAP_IH2_MIR (OMAP_IH2_BASE + 0x04)
165#define OMAP_IH2_SIR_IRQ (OMAP_IH2_BASE + 0x10)
166#define OMAP_IH2_SIR_FIQ (OMAP_IH2_BASE + 0x14)
167#define OMAP_IH2_CONTROL (OMAP_IH2_BASE + 0x18)
168#define OMAP_IH2_ILR0 (OMAP_IH2_BASE + 0x1c)
169#define OMAP_IH2_ISR (OMAP_IH2_BASE + 0x9c)
170
171#define IRQ_ITR_REG_OFFSET 0x00
172#define IRQ_MIR_REG_OFFSET 0x04
173#define IRQ_SIR_IRQ_REG_OFFSET 0x10
174#define IRQ_SIR_FIQ_REG_OFFSET 0x14
175#define IRQ_CONTROL_REG_OFFSET 0x18
176#define IRQ_ISR_REG_OFFSET 0x9c
177#define IRQ_ILR0_REG_OFFSET 0x1c
178#define IRQ_GMR_REG_OFFSET 0xa0
179
180#endif
181
182/*
183 * ----------------------------------------------------------------------------
184 * System control registers
185 * ----------------------------------------------------------------------------
186 */
187#define MOD_CONF_CTRL_0 0xfffe1080
188#define MOD_CONF_CTRL_1 0xfffe1110
189
190/*
191 * ----------------------------------------------------------------------------
192 * Pin multiplexing registers
193 * ----------------------------------------------------------------------------
194 */
195#define FUNC_MUX_CTRL_0 0xfffe1000
196#define FUNC_MUX_CTRL_1 0xfffe1004
197#define FUNC_MUX_CTRL_2 0xfffe1008
198#define COMP_MODE_CTRL_0 0xfffe100c
199#define FUNC_MUX_CTRL_3 0xfffe1010
200#define FUNC_MUX_CTRL_4 0xfffe1014
201#define FUNC_MUX_CTRL_5 0xfffe1018
202#define FUNC_MUX_CTRL_6 0xfffe101C
203#define FUNC_MUX_CTRL_7 0xfffe1020
204#define FUNC_MUX_CTRL_8 0xfffe1024
205#define FUNC_MUX_CTRL_9 0xfffe1028
206#define FUNC_MUX_CTRL_A 0xfffe102C
207#define FUNC_MUX_CTRL_B 0xfffe1030
208#define FUNC_MUX_CTRL_C 0xfffe1034
209#define FUNC_MUX_CTRL_D 0xfffe1038
210#define PULL_DWN_CTRL_0 0xfffe1040
211#define PULL_DWN_CTRL_1 0xfffe1044
212#define PULL_DWN_CTRL_2 0xfffe1048
213#define PULL_DWN_CTRL_3 0xfffe104c
214#define PULL_DWN_CTRL_4 0xfffe10ac
215
216/* OMAP-1610 specific multiplexing registers */
217#define FUNC_MUX_CTRL_E 0xfffe1090
218#define FUNC_MUX_CTRL_F 0xfffe1094
219#define FUNC_MUX_CTRL_10 0xfffe1098
220#define FUNC_MUX_CTRL_11 0xfffe109c
221#define FUNC_MUX_CTRL_12 0xfffe10a0
222#define PU_PD_SEL_0 0xfffe10b4
223#define PU_PD_SEL_1 0xfffe10b8
224#define PU_PD_SEL_2 0xfffe10bc
225#define PU_PD_SEL_3 0xfffe10c0
226#define PU_PD_SEL_4 0xfffe10c4
227
228/* Timer32K for 1610 and 1710*/
229#define OMAP_TIMER32K_BASE 0xFFFBC400
230
231/*
232 * ---------------------------------------------------------------------------
233 * TIPB bus interface
234 * ---------------------------------------------------------------------------
235 */
236#define TIPB_PUBLIC_CNTL_BASE 0xfffed300
237#define MPU_PUBLIC_TIPB_CNTL (TIPB_PUBLIC_CNTL_BASE + 0x8)
238#define TIPB_PRIVATE_CNTL_BASE 0xfffeca00
239#define MPU_PRIVATE_TIPB_CNTL (TIPB_PRIVATE_CNTL_BASE + 0x8)
240
241/*
242 * ----------------------------------------------------------------------------
243 * MPUI interface
244 * ----------------------------------------------------------------------------
245 */
246#define MPUI_BASE (0xfffec900)
247#define MPUI_CTRL (MPUI_BASE + 0x0)
248#define MPUI_DEBUG_ADDR (MPUI_BASE + 0x4)
249#define MPUI_DEBUG_DATA (MPUI_BASE + 0x8)
250#define MPUI_DEBUG_FLAG (MPUI_BASE + 0xc)
251#define MPUI_STATUS_REG (MPUI_BASE + 0x10)
252#define MPUI_DSP_STATUS (MPUI_BASE + 0x14)
253#define MPUI_DSP_BOOT_CONFIG (MPUI_BASE + 0x18)
254#define MPUI_DSP_API_CONFIG (MPUI_BASE + 0x1c)
255
256/*
257 * ----------------------------------------------------------------------------
258 * LED Pulse Generator
259 * ----------------------------------------------------------------------------
260 */
261#define OMAP_LPG1_BASE 0xfffbd000
262#define OMAP_LPG2_BASE 0xfffbd800
263#define OMAP_LPG1_LCR (OMAP_LPG1_BASE + 0x00)
264#define OMAP_LPG1_PMR (OMAP_LPG1_BASE + 0x04)
265#define OMAP_LPG2_LCR (OMAP_LPG2_BASE + 0x00)
266#define OMAP_LPG2_PMR (OMAP_LPG2_BASE + 0x04)
267
268/*
269 * ----------------------------------------------------------------------------
270 * Pulse-Width Light
271 * ----------------------------------------------------------------------------
272 */
273#define OMAP_PWL_BASE 0xfffb5800
274#define OMAP_PWL_ENABLE (OMAP_PWL_BASE + 0x00)
275#define OMAP_PWL_CLK_ENABLE (OMAP_PWL_BASE + 0x04)
276
277/*
278 * ---------------------------------------------------------------------------
279 * Processor specific defines
280 * ---------------------------------------------------------------------------
281 */
282
283#include "omap730.h"
284#include "omap1510.h"
285#include "omap24xx.h"
286#include "omap16xx.h"
287#include "omap34xx.h"
288
289#ifndef __ASSEMBLER__
290
291/*
292 * ---------------------------------------------------------------------------
293 * Board specific defines
294 * ---------------------------------------------------------------------------
295 */
296
297#ifdef CONFIG_MACH_OMAP_INNOVATOR
298#include "board-innovator.h"
299#endif
300
301#ifdef CONFIG_MACH_OMAP_H2
302#include "board-h2.h"
303#endif
304
305#ifdef CONFIG_MACH_OMAP_PERSEUS2
306#include "board-perseus2.h"
307#endif
308
309#ifdef CONFIG_MACH_OMAP_FSAMPLE
310#include "board-fsample.h"
311#endif
312
313#ifdef CONFIG_MACH_OMAP_H3
314#include "board-h3.h"
315#endif
316
317#ifdef CONFIG_MACH_OMAP_H4
318#include "board-h4.h"
319#endif
320
321#ifdef CONFIG_MACH_OMAP_2430SDP
322#include "board-2430sdp.h"
323#endif
324
325#ifdef CONFIG_MACH_OMAP_APOLLON
326#include "board-apollon.h"
327#endif
328
329#ifdef CONFIG_MACH_OMAP_OSK
330#include "board-osk.h"
331#endif
332
333#ifdef CONFIG_MACH_VOICEBLUE
334#include "board-voiceblue.h"
335#endif
336
337#ifdef CONFIG_MACH_OMAP_PALMTE
338#include "board-palmte.h"
339#endif
340
341#ifdef CONFIG_MACH_OMAP_PALMZ71
342#include "board-palmz71.h"
343#endif
344
345#ifdef CONFIG_MACH_OMAP_PALMTT
346#include "board-palmtt.h"
347#endif
348
349#ifdef CONFIG_MACH_SX1
350#include "board-sx1.h"
351#endif
352
353#endif /* !__ASSEMBLER__ */
354
355#endif /* __ASM_ARCH_OMAP_HARDWARE_H */
diff --git a/arch/arm/plat-omap/include/mach/hwa742.h b/arch/arm/plat-omap/include/mach/hwa742.h
new file mode 100644
index 000000000000..577f492f2d3c
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/hwa742.h
@@ -0,0 +1,12 @@
1#ifndef _HWA742_H
2#define _HWA742_H
3
4struct hwa742_platform_data {
5 void (*power_up)(struct device *dev);
6 void (*power_down)(struct device *dev);
7 unsigned long (*get_clock_rate)(struct device *dev);
8
9 unsigned te_connected:1;
10};
11
12#endif
diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h
new file mode 100644
index 000000000000..2a30b7d88cde
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/io.h
@@ -0,0 +1,197 @@
1/*
2 * arch/arm/plat-omap/include/mach/io.h
3 *
4 * IO definitions for TI OMAP processors and boards
5 *
6 * Copied from arch/arm/mach-sa1100/include/mach/io.h
7 * Copyright (C) 1997-1999 Russell King
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 *
29 * Modifications:
30 * 06-12-1997 RMK Created.
31 * 07-04-1999 RMK Major cleanup
32 */
33
34#ifndef __ASM_ARM_ARCH_IO_H
35#define __ASM_ARM_ARCH_IO_H
36
37#include <mach/hardware.h>
38
39#define IO_SPACE_LIMIT 0xffffffff
40
41/*
42 * We don't actually have real ISA nor PCI buses, but there is so many
43 * drivers out there that might just work if we fake them...
44 */
45#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
46#define __mem_pci(a) (a)
47
48/*
49 * ----------------------------------------------------------------------------
50 * I/O mapping
51 * ----------------------------------------------------------------------------
52 */
53
54#define PCIO_BASE 0
55
56#if defined(CONFIG_ARCH_OMAP1)
57
58#define IO_PHYS 0xFFFB0000
59#define IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
60#define IO_SIZE 0x40000
61#define IO_VIRT (IO_PHYS - IO_OFFSET)
62#define IO_ADDRESS(pa) ((pa) - IO_OFFSET)
63#define OMAP1_IO_ADDRESS(pa) ((pa) - IO_OFFSET)
64#define io_p2v(pa) ((pa) - IO_OFFSET)
65#define io_v2p(va) ((va) + IO_OFFSET)
66
67#elif defined(CONFIG_ARCH_OMAP2)
68
69/* We map both L3 and L4 on OMAP2 */
70#define L3_24XX_PHYS L3_24XX_BASE /* 0x68000000 */
71#define L3_24XX_VIRT 0xf8000000
72#define L3_24XX_SIZE SZ_1M /* 44kB of 128MB used, want 1MB sect */
73#define L4_24XX_PHYS L4_24XX_BASE /* 0x48000000 */
74#define L4_24XX_VIRT 0xd8000000
75#define L4_24XX_SIZE SZ_1M /* 1MB of 128MB used, want 1MB sect */
76
77#ifdef CONFIG_ARCH_OMAP2430
78#define L4_WK_243X_PHYS L4_WK_243X_BASE /* 0x49000000 */
79#define L4_WK_243X_VIRT 0xd9000000
80#define L4_WK_243X_SIZE SZ_1M
81#define OMAP243X_GPMC_PHYS OMAP243X_GPMC_BASE /* 0x49000000 */
82#define OMAP243X_GPMC_VIRT 0xFE000000
83#define OMAP243X_GPMC_SIZE SZ_1M
84#define OMAP243X_SDRC_PHYS OMAP243X_SDRC_BASE
85#define OMAP243X_SDRC_VIRT 0xFD000000
86#define OMAP243X_SDRC_SIZE SZ_1M
87#define OMAP243X_SMS_PHYS OMAP243X_SMS_BASE
88#define OMAP243X_SMS_VIRT 0xFC000000
89#define OMAP243X_SMS_SIZE SZ_1M
90
91#endif
92
93#define IO_OFFSET 0x90000000
94#define IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */
95#define OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */
96#define io_p2v(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */
97#define io_v2p(va) ((va) - IO_OFFSET) /* Works for L3 and L4 */
98
99/* DSP */
100#define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE /* 0x58000000 */
101#define DSP_MEM_24XX_VIRT 0xe0000000
102#define DSP_MEM_24XX_SIZE 0x28000
103#define DSP_IPI_24XX_PHYS OMAP2420_DSP_IPI_BASE /* 0x59000000 */
104#define DSP_IPI_24XX_VIRT 0xe1000000
105#define DSP_IPI_24XX_SIZE SZ_4K
106#define DSP_MMU_24XX_PHYS OMAP2420_DSP_MMU_BASE /* 0x5a000000 */
107#define DSP_MMU_24XX_VIRT 0xe2000000
108#define DSP_MMU_24XX_SIZE SZ_4K
109
110#elif defined(CONFIG_ARCH_OMAP3)
111
112/* We map both L3 and L4 on OMAP3 */
113#define L3_34XX_PHYS L3_34XX_BASE /* 0x68000000 */
114#define L3_34XX_VIRT 0xf8000000
115#define L3_34XX_SIZE SZ_1M /* 44kB of 128MB used, want 1MB sect */
116
117#define L4_34XX_PHYS L4_34XX_BASE /* 0x48000000 */
118#define L4_34XX_VIRT 0xd8000000
119#define L4_34XX_SIZE SZ_4M /* 1MB of 128MB used, want 1MB sect */
120
121/*
122 * Need to look at the Size 4M for L4.
123 * VPOM3430 was not working for Int controller
124 */
125
126#define L4_WK_34XX_PHYS L4_WK_34XX_BASE /* 0x48300000 */
127#define L4_WK_34XX_VIRT 0xd8300000
128#define L4_WK_34XX_SIZE SZ_1M
129
130#define L4_PER_34XX_PHYS L4_PER_34XX_BASE /* 0x49000000 */
131#define L4_PER_34XX_VIRT 0xd9000000
132#define L4_PER_34XX_SIZE SZ_1M
133
134#define L4_EMU_34XX_PHYS L4_EMU_34XX_BASE /* 0x54000000 */
135#define L4_EMU_34XX_VIRT 0xe4000000
136#define L4_EMU_34XX_SIZE SZ_64M
137
138#define OMAP34XX_GPMC_PHYS OMAP34XX_GPMC_BASE /* 0x6E000000 */
139#define OMAP34XX_GPMC_VIRT 0xFE000000
140#define OMAP34XX_GPMC_SIZE SZ_1M
141
142#define OMAP343X_SMS_PHYS OMAP343X_SMS_BASE /* 0x6C000000 */
143#define OMAP343X_SMS_VIRT 0xFC000000
144#define OMAP343X_SMS_SIZE SZ_1M
145
146#define OMAP343X_SDRC_PHYS OMAP343X_SDRC_BASE /* 0x6D000000 */
147#define OMAP343X_SDRC_VIRT 0xFD000000
148#define OMAP343X_SDRC_SIZE SZ_1M
149
150
151#define IO_OFFSET 0x90000000
152#define IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
153#define OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
154#define io_p2v(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
155#define io_v2p(va) ((va) - IO_OFFSET)/* Works for L3 and L4 */
156
157/* DSP */
158#define DSP_MEM_34XX_PHYS OMAP34XX_DSP_MEM_BASE /* 0x58000000 */
159#define DSP_MEM_34XX_VIRT 0xe0000000
160#define DSP_MEM_34XX_SIZE 0x28000
161#define DSP_IPI_34XX_PHYS OMAP34XX_DSP_IPI_BASE /* 0x59000000 */
162#define DSP_IPI_34XX_VIRT 0xe1000000
163#define DSP_IPI_34XX_SIZE SZ_4K
164#define DSP_MMU_34XX_PHYS OMAP34XX_DSP_MMU_BASE /* 0x5a000000 */
165#define DSP_MMU_34XX_VIRT 0xe2000000
166#define DSP_MMU_34XX_SIZE SZ_4K
167
168#endif
169
170#ifndef __ASSEMBLER__
171
172/*
173 * Functions to access the OMAP IO region
174 *
175 * NOTE: - Use omap_read/write[bwl] for physical register addresses
176 * - Use __raw_read/write[bwl]() for virtual register addresses
177 * - Use IO_ADDRESS(phys_addr) to convert registers to virtual addresses
178 * - DO NOT use hardcoded virtual addresses to allow changing the
179 * IO address space again if needed
180 */
181#define omap_readb(a) (*(volatile unsigned char *)IO_ADDRESS(a))
182#define omap_readw(a) (*(volatile unsigned short *)IO_ADDRESS(a))
183#define omap_readl(a) (*(volatile unsigned int *)IO_ADDRESS(a))
184
185#define omap_writeb(v,a) (*(volatile unsigned char *)IO_ADDRESS(a) = (v))
186#define omap_writew(v,a) (*(volatile unsigned short *)IO_ADDRESS(a) = (v))
187#define omap_writel(v,a) (*(volatile unsigned int *)IO_ADDRESS(a) = (v))
188
189extern void omap1_map_common_io(void);
190extern void omap1_init_common_hw(void);
191
192extern void omap2_map_common_io(void);
193extern void omap2_init_common_hw(void);
194
195#endif
196
197#endif
diff --git a/arch/arm/plat-omap/include/mach/irda.h b/arch/arm/plat-omap/include/mach/irda.h
new file mode 100644
index 000000000000..8372a00d8e0b
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/irda.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/plat-omap/include/mach/irda.h
3 *
4 * Copyright (C) 2005-2006 Komal Shah <komal_shah802003@yahoo.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef ASMARM_ARCH_IRDA_H
11#define ASMARM_ARCH_IRDA_H
12
13/* board specific transceiver capabilities */
14
15#define IR_SEL 1 /* Selects IrDA */
16#define IR_SIRMODE 2
17#define IR_FIRMODE 4
18#define IR_MIRMODE 8
19
20struct omap_irda_config {
21 int transceiver_cap;
22 int (*transceiver_mode)(struct device *dev, int mode);
23 int (*select_irda)(struct device *dev, int state);
24 /* Very specific to the needs of some platforms (h3,h4)
25 * having calls which can sleep in irda_set_speed.
26 */
27 struct delayed_work gpio_expa;
28 int rx_channel;
29 int tx_channel;
30 unsigned long dest_start;
31 unsigned long src_start;
32 int tx_trigger;
33 int rx_trigger;
34 int mode;
35};
36
37#endif
diff --git a/arch/arm/plat-omap/include/mach/irqs.h b/arch/arm/plat-omap/include/mach/irqs.h
new file mode 100644
index 000000000000..17248bbf3f27
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/irqs.h
@@ -0,0 +1,332 @@
1/*
2 * arch/arm/plat-omap/include/mach/irqs.h
3 *
4 * Copyright (C) Greg Lonnon 2001
5 * Updated for OMAP-1610 by Tony Lindgren <tony@atomide.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 * 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 * NOTE: The interrupt vectors for the OMAP-1509, OMAP-1510, and OMAP-1610
22 * are different.
23 */
24
25#ifndef __ASM_ARCH_OMAP15XX_IRQS_H
26#define __ASM_ARCH_OMAP15XX_IRQS_H
27
28/*
29 * IRQ numbers for interrupt handler 1
30 *
31 * NOTE: See also the OMAP-1510 and 1610 specific IRQ numbers below
32 *
33 */
34#define INT_CAMERA 1
35#define INT_FIQ 3
36#define INT_RTDX 6
37#define INT_DSP_MMU_ABORT 7
38#define INT_HOST 8
39#define INT_ABORT 9
40#define INT_BRIDGE_PRIV 13
41#define INT_GPIO_BANK1 14
42#define INT_UART3 15
43#define INT_TIMER3 16
44#define INT_DMA_CH0_6 19
45#define INT_DMA_CH1_7 20
46#define INT_DMA_CH2_8 21
47#define INT_DMA_CH3 22
48#define INT_DMA_CH4 23
49#define INT_DMA_CH5 24
50#define INT_DMA_LCD 25
51#define INT_TIMER1 26
52#define INT_WD_TIMER 27
53#define INT_BRIDGE_PUB 28
54#define INT_TIMER2 30
55#define INT_LCD_CTRL 31
56
57/*
58 * OMAP-1510 specific IRQ numbers for interrupt handler 1
59 */
60#define INT_1510_IH2_IRQ 0
61#define INT_1510_RES2 2
62#define INT_1510_SPI_TX 4
63#define INT_1510_SPI_RX 5
64#define INT_1510_DSP_MAILBOX1 10
65#define INT_1510_DSP_MAILBOX2 11
66#define INT_1510_RES12 12
67#define INT_1510_LB_MMU 17
68#define INT_1510_RES18 18
69#define INT_1510_LOCAL_BUS 29
70
71/*
72 * OMAP-1610 specific IRQ numbers for interrupt handler 1
73 */
74#define INT_1610_IH2_IRQ 0
75#define INT_1610_IH2_FIQ 2
76#define INT_1610_McBSP2_TX 4
77#define INT_1610_McBSP2_RX 5
78#define INT_1610_DSP_MAILBOX1 10
79#define INT_1610_DSP_MAILBOX2 11
80#define INT_1610_LCD_LINE 12
81#define INT_1610_GPTIMER1 17
82#define INT_1610_GPTIMER2 18
83#define INT_1610_SSR_FIFO_0 29
84
85/*
86 * OMAP-730 specific IRQ numbers for interrupt handler 1
87 */
88#define INT_730_IH2_FIQ 0
89#define INT_730_IH2_IRQ 1
90#define INT_730_USB_NON_ISO 2
91#define INT_730_USB_ISO 3
92#define INT_730_ICR 4
93#define INT_730_EAC 5
94#define INT_730_GPIO_BANK1 6
95#define INT_730_GPIO_BANK2 7
96#define INT_730_GPIO_BANK3 8
97#define INT_730_McBSP2TX 10
98#define INT_730_McBSP2RX 11
99#define INT_730_McBSP2RX_OVF 12
100#define INT_730_LCD_LINE 14
101#define INT_730_GSM_PROTECT 15
102#define INT_730_TIMER3 16
103#define INT_730_GPIO_BANK5 17
104#define INT_730_GPIO_BANK6 18
105#define INT_730_SPGIO_WR 29
106
107/*
108 * IRQ numbers for interrupt handler 2
109 *
110 * NOTE: See also the OMAP-1510 and 1610 specific IRQ numbers below
111 */
112#define IH2_BASE 32
113
114#define INT_KEYBOARD (1 + IH2_BASE)
115#define INT_uWireTX (2 + IH2_BASE)
116#define INT_uWireRX (3 + IH2_BASE)
117#define INT_I2C (4 + IH2_BASE)
118#define INT_MPUIO (5 + IH2_BASE)
119#define INT_USB_HHC_1 (6 + IH2_BASE)
120#define INT_McBSP3TX (10 + IH2_BASE)
121#define INT_McBSP3RX (11 + IH2_BASE)
122#define INT_McBSP1TX (12 + IH2_BASE)
123#define INT_McBSP1RX (13 + IH2_BASE)
124#define INT_UART1 (14 + IH2_BASE)
125#define INT_UART2 (15 + IH2_BASE)
126#define INT_BT_MCSI1TX (16 + IH2_BASE)
127#define INT_BT_MCSI1RX (17 + IH2_BASE)
128#define INT_USB_W2FC (20 + IH2_BASE)
129#define INT_1WIRE (21 + IH2_BASE)
130#define INT_OS_TIMER (22 + IH2_BASE)
131#define INT_MMC (23 + IH2_BASE)
132#define INT_GAUGE_32K (24 + IH2_BASE)
133#define INT_RTC_TIMER (25 + IH2_BASE)
134#define INT_RTC_ALARM (26 + IH2_BASE)
135#define INT_MEM_STICK (27 + IH2_BASE)
136
137/*
138 * OMAP-1510 specific IRQ numbers for interrupt handler 2
139 */
140#define INT_1510_DSP_MMU (28 + IH2_BASE)
141#define INT_1510_COM_SPI_RO (31 + IH2_BASE)
142
143/*
144 * OMAP-1610 specific IRQ numbers for interrupt handler 2
145 */
146#define INT_1610_FAC (0 + IH2_BASE)
147#define INT_1610_USB_HHC_2 (7 + IH2_BASE)
148#define INT_1610_USB_OTG (8 + IH2_BASE)
149#define INT_1610_SoSSI (9 + IH2_BASE)
150#define INT_1610_SoSSI_MATCH (19 + IH2_BASE)
151#define INT_1610_DSP_MMU (28 + IH2_BASE)
152#define INT_1610_McBSP2RX_OF (31 + IH2_BASE)
153#define INT_1610_STI (32 + IH2_BASE)
154#define INT_1610_STI_WAKEUP (33 + IH2_BASE)
155#define INT_1610_GPTIMER3 (34 + IH2_BASE)
156#define INT_1610_GPTIMER4 (35 + IH2_BASE)
157#define INT_1610_GPTIMER5 (36 + IH2_BASE)
158#define INT_1610_GPTIMER6 (37 + IH2_BASE)
159#define INT_1610_GPTIMER7 (38 + IH2_BASE)
160#define INT_1610_GPTIMER8 (39 + IH2_BASE)
161#define INT_1610_GPIO_BANK2 (40 + IH2_BASE)
162#define INT_1610_GPIO_BANK3 (41 + IH2_BASE)
163#define INT_1610_MMC2 (42 + IH2_BASE)
164#define INT_1610_CF (43 + IH2_BASE)
165#define INT_1610_WAKE_UP_REQ (46 + IH2_BASE)
166#define INT_1610_GPIO_BANK4 (48 + IH2_BASE)
167#define INT_1610_SPI (49 + IH2_BASE)
168#define INT_1610_DMA_CH6 (53 + IH2_BASE)
169#define INT_1610_DMA_CH7 (54 + IH2_BASE)
170#define INT_1610_DMA_CH8 (55 + IH2_BASE)
171#define INT_1610_DMA_CH9 (56 + IH2_BASE)
172#define INT_1610_DMA_CH10 (57 + IH2_BASE)
173#define INT_1610_DMA_CH11 (58 + IH2_BASE)
174#define INT_1610_DMA_CH12 (59 + IH2_BASE)
175#define INT_1610_DMA_CH13 (60 + IH2_BASE)
176#define INT_1610_DMA_CH14 (61 + IH2_BASE)
177#define INT_1610_DMA_CH15 (62 + IH2_BASE)
178#define INT_1610_NAND (63 + IH2_BASE)
179
180/*
181 * OMAP-730 specific IRQ numbers for interrupt handler 2
182 */
183#define INT_730_HW_ERRORS (0 + IH2_BASE)
184#define INT_730_NFIQ_PWR_FAIL (1 + IH2_BASE)
185#define INT_730_CFCD (2 + IH2_BASE)
186#define INT_730_CFIREQ (3 + IH2_BASE)
187#define INT_730_I2C (4 + IH2_BASE)
188#define INT_730_PCC (5 + IH2_BASE)
189#define INT_730_MPU_EXT_NIRQ (6 + IH2_BASE)
190#define INT_730_SPI_100K_1 (7 + IH2_BASE)
191#define INT_730_SYREN_SPI (8 + IH2_BASE)
192#define INT_730_VLYNQ (9 + IH2_BASE)
193#define INT_730_GPIO_BANK4 (10 + IH2_BASE)
194#define INT_730_McBSP1TX (11 + IH2_BASE)
195#define INT_730_McBSP1RX (12 + IH2_BASE)
196#define INT_730_McBSP1RX_OF (13 + IH2_BASE)
197#define INT_730_UART_MODEM_IRDA_2 (14 + IH2_BASE)
198#define INT_730_UART_MODEM_1 (15 + IH2_BASE)
199#define INT_730_MCSI (16 + IH2_BASE)
200#define INT_730_uWireTX (17 + IH2_BASE)
201#define INT_730_uWireRX (18 + IH2_BASE)
202#define INT_730_SMC_CD (19 + IH2_BASE)
203#define INT_730_SMC_IREQ (20 + IH2_BASE)
204#define INT_730_HDQ_1WIRE (21 + IH2_BASE)
205#define INT_730_TIMER32K (22 + IH2_BASE)
206#define INT_730_MMC_SDIO (23 + IH2_BASE)
207#define INT_730_UPLD (24 + IH2_BASE)
208#define INT_730_USB_HHC_1 (27 + IH2_BASE)
209#define INT_730_USB_HHC_2 (28 + IH2_BASE)
210#define INT_730_USB_GENI (29 + IH2_BASE)
211#define INT_730_USB_OTG (30 + IH2_BASE)
212#define INT_730_CAMERA_IF (31 + IH2_BASE)
213#define INT_730_RNG (32 + IH2_BASE)
214#define INT_730_DUAL_MODE_TIMER (33 + IH2_BASE)
215#define INT_730_DBB_RF_EN (34 + IH2_BASE)
216#define INT_730_MPUIO_KEYPAD (35 + IH2_BASE)
217#define INT_730_SHA1_MD5 (36 + IH2_BASE)
218#define INT_730_SPI_100K_2 (37 + IH2_BASE)
219#define INT_730_RNG_IDLE (38 + IH2_BASE)
220#define INT_730_MPUIO (39 + IH2_BASE)
221#define INT_730_LLPC_LCD_CTRL_CAN_BE_OFF (40 + IH2_BASE)
222#define INT_730_LLPC_OE_FALLING (41 + IH2_BASE)
223#define INT_730_LLPC_OE_RISING (42 + IH2_BASE)
224#define INT_730_LLPC_VSYNC (43 + IH2_BASE)
225#define INT_730_WAKE_UP_REQ (46 + IH2_BASE)
226#define INT_730_DMA_CH6 (53 + IH2_BASE)
227#define INT_730_DMA_CH7 (54 + IH2_BASE)
228#define INT_730_DMA_CH8 (55 + IH2_BASE)
229#define INT_730_DMA_CH9 (56 + IH2_BASE)
230#define INT_730_DMA_CH10 (57 + IH2_BASE)
231#define INT_730_DMA_CH11 (58 + IH2_BASE)
232#define INT_730_DMA_CH12 (59 + IH2_BASE)
233#define INT_730_DMA_CH13 (60 + IH2_BASE)
234#define INT_730_DMA_CH14 (61 + IH2_BASE)
235#define INT_730_DMA_CH15 (62 + IH2_BASE)
236#define INT_730_NAND (63 + IH2_BASE)
237
238#define INT_24XX_SYS_NIRQ 7
239#define INT_24XX_SDMA_IRQ0 12
240#define INT_24XX_SDMA_IRQ1 13
241#define INT_24XX_SDMA_IRQ2 14
242#define INT_24XX_SDMA_IRQ3 15
243#define INT_24XX_CAM_IRQ 24
244#define INT_24XX_DSS_IRQ 25
245#define INT_24XX_MAIL_U0_MPU 26
246#define INT_24XX_DSP_UMA 27
247#define INT_24XX_DSP_MMU 28
248#define INT_24XX_GPIO_BANK1 29
249#define INT_24XX_GPIO_BANK2 30
250#define INT_24XX_GPIO_BANK3 31
251#define INT_24XX_GPIO_BANK4 32
252#define INT_24XX_GPIO_BANK5 33
253#define INT_24XX_MAIL_U3_MPU 34
254#define INT_24XX_GPTIMER1 37
255#define INT_24XX_GPTIMER2 38
256#define INT_24XX_GPTIMER3 39
257#define INT_24XX_GPTIMER4 40
258#define INT_24XX_GPTIMER5 41
259#define INT_24XX_GPTIMER6 42
260#define INT_24XX_GPTIMER7 43
261#define INT_24XX_GPTIMER8 44
262#define INT_24XX_GPTIMER9 45
263#define INT_24XX_GPTIMER10 46
264#define INT_24XX_GPTIMER11 47
265#define INT_24XX_GPTIMER12 48
266#define INT_24XX_I2C1_IRQ 56
267#define INT_24XX_I2C2_IRQ 57
268#define INT_24XX_MCBSP1_IRQ_TX 59
269#define INT_24XX_MCBSP1_IRQ_RX 60
270#define INT_24XX_MCBSP2_IRQ_TX 62
271#define INT_24XX_MCBSP2_IRQ_RX 63
272#define INT_24XX_UART1_IRQ 72
273#define INT_24XX_UART2_IRQ 73
274#define INT_24XX_UART3_IRQ 74
275#define INT_24XX_USB_IRQ_GEN 75
276#define INT_24XX_USB_IRQ_NISO 76
277#define INT_24XX_USB_IRQ_ISO 77
278#define INT_24XX_USB_IRQ_HGEN 78
279#define INT_24XX_USB_IRQ_HSOF 79
280#define INT_24XX_USB_IRQ_OTG 80
281#define INT_24XX_MMC_IRQ 83
282
283/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and
284 * 16 MPUIO lines */
285#define OMAP_MAX_GPIO_LINES 192
286#define IH_GPIO_BASE (128 + IH2_BASE)
287#define IH_MPUIO_BASE (OMAP_MAX_GPIO_LINES + IH_GPIO_BASE)
288#define OMAP_IRQ_END (IH_MPUIO_BASE + 16)
289
290/* External FPGA handles interrupts on Innovator boards */
291#define OMAP_FPGA_IRQ_BASE (OMAP_IRQ_END)
292#ifdef CONFIG_MACH_OMAP_INNOVATOR
293#define OMAP_FPGA_NR_IRQS 24
294#else
295#define OMAP_FPGA_NR_IRQS 0
296#endif
297#define OMAP_FPGA_IRQ_END (OMAP_FPGA_IRQ_BASE + OMAP_FPGA_NR_IRQS)
298
299/* External TWL4030 can handle interrupts on 2430 and 34xx boards */
300#define TWL4030_IRQ_BASE (OMAP_FPGA_IRQ_END)
301#ifdef CONFIG_TWL4030_CORE
302#define TWL4030_BASE_NR_IRQS 8
303#define TWL4030_PWR_NR_IRQS 8
304#else
305#define TWL4030_BASE_NR_IRQS 0
306#define TWL4030_PWR_NR_IRQS 0
307#endif
308#define TWL4030_IRQ_END (TWL4030_IRQ_BASE + TWL4030_BASE_NR_IRQS)
309#define TWL4030_PWR_IRQ_BASE TWL4030_IRQ_END
310#define TWL4030_PWR_IRQ_END (TWL4030_PWR_IRQ_BASE + TWL4030_PWR_NR_IRQS)
311
312/* External TWL4030 gpio interrupts are optional */
313#define TWL4030_GPIO_IRQ_BASE TWL4030_PWR_IRQ_END
314#ifdef CONFIG_TWL4030_GPIO
315#define TWL4030_GPIO_NR_IRQS 18
316#else
317#define TWL4030_GPIO_NR_IRQS 0
318#endif
319#define TWL4030_GPIO_IRQ_END (TWL4030_GPIO_IRQ_BASE + TWL4030_GPIO_NR_IRQS)
320
321/* Total number of interrupts depends on the enabled blocks above */
322#define NR_IRQS TWL4030_GPIO_IRQ_END
323
324#define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32))
325
326#ifndef __ASSEMBLY__
327extern void omap_init_irq(void);
328#endif
329
330#include <mach/hardware.h>
331
332#endif
diff --git a/arch/arm/plat-omap/include/mach/keypad.h b/arch/arm/plat-omap/include/mach/keypad.h
new file mode 100644
index 000000000000..232923aaf61d
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/keypad.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/plat-omap/include/mach/keypad.h
3 *
4 * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef ASMARM_ARCH_KEYPAD_H
11#define ASMARM_ARCH_KEYPAD_H
12
13struct omap_kp_platform_data {
14 int rows;
15 int cols;
16 int *keymap;
17 unsigned int keymapsize;
18 unsigned int rep:1;
19 unsigned long delay;
20 unsigned int dbounce:1;
21 /* specific to OMAP242x*/
22 unsigned int *row_gpios;
23 unsigned int *col_gpios;
24};
25
26/* Group (0..3) -- when multiple keys are pressed, only the
27 * keys pressed in the same group are considered as pressed. This is
28 * in order to workaround certain crappy HW designs that produce ghost
29 * keypresses. */
30#define GROUP_0 (0 << 16)
31#define GROUP_1 (1 << 16)
32#define GROUP_2 (2 << 16)
33#define GROUP_3 (3 << 16)
34#define GROUP_MASK GROUP_3
35
36#define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
37
38#endif
39
diff --git a/arch/arm/plat-omap/include/mach/lcd_mipid.h b/arch/arm/plat-omap/include/mach/lcd_mipid.h
new file mode 100644
index 000000000000..f8fbc4801e52
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/lcd_mipid.h
@@ -0,0 +1,24 @@
1#ifndef __LCD_MIPID_H
2#define __LCD_MIPID_H
3
4enum mipid_test_num {
5 MIPID_TEST_RGB_LINES,
6};
7
8enum mipid_test_result {
9 MIPID_TEST_SUCCESS,
10 MIPID_TEST_INVALID,
11 MIPID_TEST_FAILED,
12};
13
14#ifdef __KERNEL__
15
16struct mipid_platform_data {
17 int nreset_gpio;
18 int data_lines;
19 void (*shutdown)(struct mipid_platform_data *pdata);
20};
21
22#endif
23
24#endif
diff --git a/arch/arm/plat-omap/include/mach/led.h b/arch/arm/plat-omap/include/mach/led.h
new file mode 100644
index 000000000000..25e451e7e2fd
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/led.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/plat-omap/include/mach/led.h
3 *
4 * Copyright (C) 2006 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef ASMARM_ARCH_LED_H
12#define ASMARM_ARCH_LED_H
13
14struct omap_led_config {
15 struct led_classdev cdev;
16 s16 gpio;
17};
18
19struct omap_led_platform_data {
20 s16 nr_leds;
21 struct omap_led_config *leds;
22};
23
24#endif
diff --git a/arch/arm/plat-omap/include/mach/mailbox.h b/arch/arm/plat-omap/include/mach/mailbox.h
new file mode 100644
index 000000000000..7cbed9332e16
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/mailbox.h
@@ -0,0 +1,73 @@
1/* mailbox.h */
2
3#ifndef MAILBOX_H
4#define MAILBOX_H
5
6#include <linux/wait.h>
7#include <linux/workqueue.h>
8#include <linux/blkdev.h>
9
10typedef u32 mbox_msg_t;
11typedef void (mbox_receiver_t)(mbox_msg_t msg);
12struct omap_mbox;
13
14typedef int __bitwise omap_mbox_irq_t;
15#define IRQ_TX ((__force omap_mbox_irq_t) 1)
16#define IRQ_RX ((__force omap_mbox_irq_t) 2)
17
18typedef int __bitwise omap_mbox_type_t;
19#define OMAP_MBOX_TYPE1 ((__force omap_mbox_type_t) 1)
20#define OMAP_MBOX_TYPE2 ((__force omap_mbox_type_t) 2)
21
22struct omap_mbox_ops {
23 omap_mbox_type_t type;
24 int (*startup)(struct omap_mbox *mbox);
25 void (*shutdown)(struct omap_mbox *mbox);
26 /* fifo */
27 mbox_msg_t (*fifo_read)(struct omap_mbox *mbox);
28 void (*fifo_write)(struct omap_mbox *mbox, mbox_msg_t msg);
29 int (*fifo_empty)(struct omap_mbox *mbox);
30 int (*fifo_full)(struct omap_mbox *mbox);
31 /* irq */
32 void (*enable_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
33 void (*disable_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
34 void (*ack_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
35 int (*is_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
36};
37
38struct omap_mbox_queue {
39 spinlock_t lock;
40 struct request_queue *queue;
41 struct work_struct work;
42 int (*callback)(void *);
43 struct omap_mbox *mbox;
44};
45
46struct omap_mbox {
47 char *name;
48 unsigned int irq;
49
50 struct omap_mbox_queue *txq, *rxq;
51
52 struct omap_mbox_ops *ops;
53
54 mbox_msg_t seq_snd, seq_rcv;
55
56 struct device dev;
57
58 struct omap_mbox *next;
59 void *priv;
60
61 void (*err_notify)(void);
62};
63
64int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg, void *);
65void omap_mbox_init_seq(struct omap_mbox *);
66
67struct omap_mbox *omap_mbox_get(const char *);
68void omap_mbox_put(struct omap_mbox *);
69
70int omap_mbox_register(struct omap_mbox *);
71int omap_mbox_unregister(struct omap_mbox *);
72
73#endif /* MAILBOX_H */
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
new file mode 100644
index 000000000000..6eb44a92871d
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -0,0 +1,380 @@
1/*
2 * arch/arm/plat-omap/include/mach/mcbsp.h
3 *
4 * Defines for Multi-Channel Buffered Serial Port
5 *
6 * Copyright (C) 2002 RidgeRun, Inc.
7 * Author: Steve Johnson
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#ifndef __ASM_ARCH_OMAP_MCBSP_H
25#define __ASM_ARCH_OMAP_MCBSP_H
26
27#include <linux/completion.h>
28#include <linux/spinlock.h>
29
30#include <mach/hardware.h>
31#include <mach/clock.h>
32
33#define OMAP730_MCBSP1_BASE 0xfffb1000
34#define OMAP730_MCBSP2_BASE 0xfffb1800
35
36#define OMAP1510_MCBSP1_BASE 0xe1011800
37#define OMAP1510_MCBSP2_BASE 0xfffb1000
38#define OMAP1510_MCBSP3_BASE 0xe1017000
39
40#define OMAP1610_MCBSP1_BASE 0xe1011800
41#define OMAP1610_MCBSP2_BASE 0xfffb1000
42#define OMAP1610_MCBSP3_BASE 0xe1017000
43
44#define OMAP24XX_MCBSP1_BASE 0x48074000
45#define OMAP24XX_MCBSP2_BASE 0x48076000
46
47#define OMAP34XX_MCBSP1_BASE 0x48074000
48#define OMAP34XX_MCBSP2_BASE 0x49022000
49
50#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730)
51
52#define OMAP_MCBSP_REG_DRR2 0x00
53#define OMAP_MCBSP_REG_DRR1 0x02
54#define OMAP_MCBSP_REG_DXR2 0x04
55#define OMAP_MCBSP_REG_DXR1 0x06
56#define OMAP_MCBSP_REG_SPCR2 0x08
57#define OMAP_MCBSP_REG_SPCR1 0x0a
58#define OMAP_MCBSP_REG_RCR2 0x0c
59#define OMAP_MCBSP_REG_RCR1 0x0e
60#define OMAP_MCBSP_REG_XCR2 0x10
61#define OMAP_MCBSP_REG_XCR1 0x12
62#define OMAP_MCBSP_REG_SRGR2 0x14
63#define OMAP_MCBSP_REG_SRGR1 0x16
64#define OMAP_MCBSP_REG_MCR2 0x18
65#define OMAP_MCBSP_REG_MCR1 0x1a
66#define OMAP_MCBSP_REG_RCERA 0x1c
67#define OMAP_MCBSP_REG_RCERB 0x1e
68#define OMAP_MCBSP_REG_XCERA 0x20
69#define OMAP_MCBSP_REG_XCERB 0x22
70#define OMAP_MCBSP_REG_PCR0 0x24
71#define OMAP_MCBSP_REG_RCERC 0x26
72#define OMAP_MCBSP_REG_RCERD 0x28
73#define OMAP_MCBSP_REG_XCERC 0x2A
74#define OMAP_MCBSP_REG_XCERD 0x2C
75#define OMAP_MCBSP_REG_RCERE 0x2E
76#define OMAP_MCBSP_REG_RCERF 0x30
77#define OMAP_MCBSP_REG_XCERE 0x32
78#define OMAP_MCBSP_REG_XCERF 0x34
79#define OMAP_MCBSP_REG_RCERG 0x36
80#define OMAP_MCBSP_REG_RCERH 0x38
81#define OMAP_MCBSP_REG_XCERG 0x3A
82#define OMAP_MCBSP_REG_XCERH 0x3C
83
84#define OMAP_MAX_MCBSP_COUNT 3
85#define MAX_MCBSP_CLOCKS 3
86
87#define AUDIO_MCBSP_DATAWRITE (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DXR1)
88#define AUDIO_MCBSP_DATAREAD (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DRR1)
89
90#define AUDIO_MCBSP OMAP_MCBSP1
91#define AUDIO_DMA_TX OMAP_DMA_MCBSP1_TX
92#define AUDIO_DMA_RX OMAP_DMA_MCBSP1_RX
93
94#elif defined(CONFIG_ARCH_OMAP24XX)
95
96#define OMAP_MCBSP_REG_DRR2 0x00
97#define OMAP_MCBSP_REG_DRR1 0x04
98#define OMAP_MCBSP_REG_DXR2 0x08
99#define OMAP_MCBSP_REG_DXR1 0x0C
100#define OMAP_MCBSP_REG_SPCR2 0x10
101#define OMAP_MCBSP_REG_SPCR1 0x14
102#define OMAP_MCBSP_REG_RCR2 0x18
103#define OMAP_MCBSP_REG_RCR1 0x1C
104#define OMAP_MCBSP_REG_XCR2 0x20
105#define OMAP_MCBSP_REG_XCR1 0x24
106#define OMAP_MCBSP_REG_SRGR2 0x28
107#define OMAP_MCBSP_REG_SRGR1 0x2C
108#define OMAP_MCBSP_REG_MCR2 0x30
109#define OMAP_MCBSP_REG_MCR1 0x34
110#define OMAP_MCBSP_REG_RCERA 0x38
111#define OMAP_MCBSP_REG_RCERB 0x3C
112#define OMAP_MCBSP_REG_XCERA 0x40
113#define OMAP_MCBSP_REG_XCERB 0x44
114#define OMAP_MCBSP_REG_PCR0 0x48
115#define OMAP_MCBSP_REG_RCERC 0x4C
116#define OMAP_MCBSP_REG_RCERD 0x50
117#define OMAP_MCBSP_REG_XCERC 0x54
118#define OMAP_MCBSP_REG_XCERD 0x58
119#define OMAP_MCBSP_REG_RCERE 0x5C
120#define OMAP_MCBSP_REG_RCERF 0x60
121#define OMAP_MCBSP_REG_XCERE 0x64
122#define OMAP_MCBSP_REG_XCERF 0x68
123#define OMAP_MCBSP_REG_RCERG 0x6C
124#define OMAP_MCBSP_REG_RCERH 0x70
125#define OMAP_MCBSP_REG_XCERG 0x74
126#define OMAP_MCBSP_REG_XCERH 0x78
127
128#define OMAP_MAX_MCBSP_COUNT 2
129#define MAX_MCBSP_CLOCKS 2
130
131#define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1)
132#define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1)
133
134#define AUDIO_MCBSP OMAP_MCBSP2
135#define AUDIO_DMA_TX OMAP24XX_DMA_MCBSP2_TX
136#define AUDIO_DMA_RX OMAP24XX_DMA_MCBSP2_RX
137
138#endif
139
140#define OMAP_MCBSP_READ(base, reg) __raw_readw((base) + OMAP_MCBSP_REG_##reg)
141#define OMAP_MCBSP_WRITE(base, reg, val) __raw_writew((val), (base) + OMAP_MCBSP_REG_##reg)
142
143
144/************************** McBSP SPCR1 bit definitions ***********************/
145#define RRST 0x0001
146#define RRDY 0x0002
147#define RFULL 0x0004
148#define RSYNC_ERR 0x0008
149#define RINTM(value) ((value)<<4) /* bits 4:5 */
150#define ABIS 0x0040
151#define DXENA 0x0080
152#define CLKSTP(value) ((value)<<11) /* bits 11:12 */
153#define RJUST(value) ((value)<<13) /* bits 13:14 */
154#define DLB 0x8000
155
156/************************** McBSP SPCR2 bit definitions ***********************/
157#define XRST 0x0001
158#define XRDY 0x0002
159#define XEMPTY 0x0004
160#define XSYNC_ERR 0x0008
161#define XINTM(value) ((value)<<4) /* bits 4:5 */
162#define GRST 0x0040
163#define FRST 0x0080
164#define SOFT 0x0100
165#define FREE 0x0200
166
167/************************** McBSP PCR bit definitions *************************/
168#define CLKRP 0x0001
169#define CLKXP 0x0002
170#define FSRP 0x0004
171#define FSXP 0x0008
172#define DR_STAT 0x0010
173#define DX_STAT 0x0020
174#define CLKS_STAT 0x0040
175#define SCLKME 0x0080
176#define CLKRM 0x0100
177#define CLKXM 0x0200
178#define FSRM 0x0400
179#define FSXM 0x0800
180#define RIOEN 0x1000
181#define XIOEN 0x2000
182#define IDLE_EN 0x4000
183
184/************************** McBSP RCR1 bit definitions ************************/
185#define RWDLEN1(value) ((value)<<5) /* Bits 5:7 */
186#define RFRLEN1(value) ((value)<<8) /* Bits 8:14 */
187
188/************************** McBSP XCR1 bit definitions ************************/
189#define XWDLEN1(value) ((value)<<5) /* Bits 5:7 */
190#define XFRLEN1(value) ((value)<<8) /* Bits 8:14 */
191
192/*************************** McBSP RCR2 bit definitions ***********************/
193#define RDATDLY(value) (value) /* Bits 0:1 */
194#define RFIG 0x0004
195#define RCOMPAND(value) ((value)<<3) /* Bits 3:4 */
196#define RWDLEN2(value) ((value)<<5) /* Bits 5:7 */
197#define RFRLEN2(value) ((value)<<8) /* Bits 8:14 */
198#define RPHASE 0x8000
199
200/*************************** McBSP XCR2 bit definitions ***********************/
201#define XDATDLY(value) (value) /* Bits 0:1 */
202#define XFIG 0x0004
203#define XCOMPAND(value) ((value)<<3) /* Bits 3:4 */
204#define XWDLEN2(value) ((value)<<5) /* Bits 5:7 */
205#define XFRLEN2(value) ((value)<<8) /* Bits 8:14 */
206#define XPHASE 0x8000
207
208/************************* McBSP SRGR1 bit definitions ************************/
209#define CLKGDV(value) (value) /* Bits 0:7 */
210#define FWID(value) ((value)<<8) /* Bits 8:15 */
211
212/************************* McBSP SRGR2 bit definitions ************************/
213#define FPER(value) (value) /* Bits 0:11 */
214#define FSGM 0x1000
215#define CLKSM 0x2000
216#define CLKSP 0x4000
217#define GSYNC 0x8000
218
219/************************* McBSP MCR1 bit definitions *************************/
220#define RMCM 0x0001
221#define RCBLK(value) ((value)<<2) /* Bits 2:4 */
222#define RPABLK(value) ((value)<<5) /* Bits 5:6 */
223#define RPBBLK(value) ((value)<<7) /* Bits 7:8 */
224
225/************************* McBSP MCR2 bit definitions *************************/
226#define XMCM(value) (value) /* Bits 0:1 */
227#define XCBLK(value) ((value)<<2) /* Bits 2:4 */
228#define XPABLK(value) ((value)<<5) /* Bits 5:6 */
229#define XPBBLK(value) ((value)<<7) /* Bits 7:8 */
230
231
232/* we don't do multichannel for now */
233struct omap_mcbsp_reg_cfg {
234 u16 spcr2;
235 u16 spcr1;
236 u16 rcr2;
237 u16 rcr1;
238 u16 xcr2;
239 u16 xcr1;
240 u16 srgr2;
241 u16 srgr1;
242 u16 mcr2;
243 u16 mcr1;
244 u16 pcr0;
245 u16 rcerc;
246 u16 rcerd;
247 u16 xcerc;
248 u16 xcerd;
249 u16 rcere;
250 u16 rcerf;
251 u16 xcere;
252 u16 xcerf;
253 u16 rcerg;
254 u16 rcerh;
255 u16 xcerg;
256 u16 xcerh;
257};
258
259typedef enum {
260 OMAP_MCBSP1 = 0,
261 OMAP_MCBSP2,
262 OMAP_MCBSP3,
263} omap_mcbsp_id;
264
265typedef int __bitwise omap_mcbsp_io_type_t;
266#define OMAP_MCBSP_IRQ_IO ((__force omap_mcbsp_io_type_t) 1)
267#define OMAP_MCBSP_POLL_IO ((__force omap_mcbsp_io_type_t) 2)
268
269typedef enum {
270 OMAP_MCBSP_WORD_8 = 0,
271 OMAP_MCBSP_WORD_12,
272 OMAP_MCBSP_WORD_16,
273 OMAP_MCBSP_WORD_20,
274 OMAP_MCBSP_WORD_24,
275 OMAP_MCBSP_WORD_32,
276} omap_mcbsp_word_length;
277
278typedef enum {
279 OMAP_MCBSP_CLK_RISING = 0,
280 OMAP_MCBSP_CLK_FALLING,
281} omap_mcbsp_clk_polarity;
282
283typedef enum {
284 OMAP_MCBSP_FS_ACTIVE_HIGH = 0,
285 OMAP_MCBSP_FS_ACTIVE_LOW,
286} omap_mcbsp_fs_polarity;
287
288typedef enum {
289 OMAP_MCBSP_CLK_STP_MODE_NO_DELAY = 0,
290 OMAP_MCBSP_CLK_STP_MODE_DELAY,
291} omap_mcbsp_clk_stp_mode;
292
293
294/******* SPI specific mode **********/
295typedef enum {
296 OMAP_MCBSP_SPI_MASTER = 0,
297 OMAP_MCBSP_SPI_SLAVE,
298} omap_mcbsp_spi_mode;
299
300struct omap_mcbsp_spi_cfg {
301 omap_mcbsp_spi_mode spi_mode;
302 omap_mcbsp_clk_polarity rx_clock_polarity;
303 omap_mcbsp_clk_polarity tx_clock_polarity;
304 omap_mcbsp_fs_polarity fsx_polarity;
305 u8 clk_div;
306 omap_mcbsp_clk_stp_mode clk_stp_mode;
307 omap_mcbsp_word_length word_length;
308};
309
310/* Platform specific configuration */
311struct omap_mcbsp_ops {
312 void (*request)(unsigned int);
313 void (*free)(unsigned int);
314 int (*check)(unsigned int);
315};
316
317struct omap_mcbsp_platform_data {
318 u32 virt_base;
319 u8 dma_rx_sync, dma_tx_sync;
320 u16 rx_irq, tx_irq;
321 struct omap_mcbsp_ops *ops;
322 char const *clk_name;
323};
324
325struct omap_mcbsp {
326 struct device *dev;
327 u32 io_base;
328 u8 id;
329 u8 free;
330 omap_mcbsp_word_length rx_word_length;
331 omap_mcbsp_word_length tx_word_length;
332
333 omap_mcbsp_io_type_t io_type; /* IRQ or poll */
334 /* IRQ based TX/RX */
335 int rx_irq;
336 int tx_irq;
337
338 /* DMA stuff */
339 u8 dma_rx_sync;
340 short dma_rx_lch;
341 u8 dma_tx_sync;
342 short dma_tx_lch;
343
344 /* Completion queues */
345 struct completion tx_irq_completion;
346 struct completion rx_irq_completion;
347 struct completion tx_dma_completion;
348 struct completion rx_dma_completion;
349
350 /* Protect the field .free, while checking if the mcbsp is in use */
351 spinlock_t lock;
352 struct omap_mcbsp_platform_data *pdata;
353 struct clk *clk;
354};
355
356int omap_mcbsp_init(void);
357void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
358 int size);
359void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config);
360int omap_mcbsp_request(unsigned int id);
361void omap_mcbsp_free(unsigned int id);
362void omap_mcbsp_start(unsigned int id);
363void omap_mcbsp_stop(unsigned int id);
364void omap_mcbsp_xmit_word(unsigned int id, u32 word);
365u32 omap_mcbsp_recv_word(unsigned int id);
366
367int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int length);
368int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int length);
369int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word);
370int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word);
371
372
373/* SPI specific API */
374void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg);
375
376/* Polled read/write functions */
377int omap_mcbsp_pollread(unsigned int id, u16 * buf);
378int omap_mcbsp_pollwrite(unsigned int id, u16 buf);
379
380#endif
diff --git a/arch/arm/plat-omap/include/mach/mcspi.h b/arch/arm/plat-omap/include/mach/mcspi.h
new file mode 100644
index 000000000000..1254e4945b6f
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/mcspi.h
@@ -0,0 +1,15 @@
1#ifndef _OMAP2_MCSPI_H
2#define _OMAP2_MCSPI_H
3
4struct omap2_mcspi_platform_config {
5 unsigned short num_cs;
6};
7
8struct omap2_mcspi_device_config {
9 unsigned turbo_mode:1;
10
11 /* Do we want one channel enabled at the same time? */
12 unsigned single_channel:1;
13};
14
15#endif
diff --git a/arch/arm/plat-omap/include/mach/memory.h b/arch/arm/plat-omap/include/mach/memory.h
new file mode 100644
index 000000000000..037486c5f4a4
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/memory.h
@@ -0,0 +1,103 @@
1/*
2 * arch/arm/plat-omap/include/mach/memory.h
3 *
4 * Memory map for OMAP-1510 and 1610
5 *
6 * Copyright (C) 2000 RidgeRun, Inc.
7 * Author: Greg Lonnon <glonnon@ridgerun.com>
8 *
9 * This file was derived from arch/arm/mach-intergrator/include/mach/memory.h
10 * Copyright (C) 1999 ARM Limited
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32
33#ifndef __ASM_ARCH_MEMORY_H
34#define __ASM_ARCH_MEMORY_H
35
36/*
37 * Physical DRAM offset.
38 */
39#if defined(CONFIG_ARCH_OMAP1)
40#define PHYS_OFFSET UL(0x10000000)
41#elif defined(CONFIG_ARCH_OMAP2)
42#define PHYS_OFFSET UL(0x80000000)
43#endif
44
45/*
46 * Conversion between SDRAM and fake PCI bus, used by USB
47 * NOTE: Physical address must be converted to Local Bus address
48 * on OMAP-1510 only
49 */
50
51/*
52 * Bus address is physical address, except for OMAP-1510 Local Bus.
53 */
54#define __virt_to_bus(x) __virt_to_phys(x)
55#define __bus_to_virt(x) __phys_to_virt(x)
56
57/*
58 * OMAP-1510 bus address is translated into a Local Bus address if the
59 * OMAP bus type is lbus. We do the address translation based on the
60 * device overriding the defaults used in the dma-mapping API.
61 * Note that the is_lbus_device() test is not very efficient on 1510
62 * because of the strncmp().
63 */
64#ifdef CONFIG_ARCH_OMAP15XX
65
66/*
67 * OMAP-1510 Local Bus address offset
68 */
69#define OMAP1510_LB_OFFSET UL(0x30000000)
70
71#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
72#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
73#define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0))
74
75#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \
76 (dma_addr_t)virt_to_lbus(page_address(page)) : \
77 (dma_addr_t)__virt_to_bus(page_address(page));})
78
79#define __arch_dma_to_virt(dev, addr) ({is_lbus_device(dev) ? \
80 lbus_to_virt(addr) : \
81 __bus_to_virt(addr);})
82
83#define __arch_virt_to_dma(dev, addr) ({is_lbus_device(dev) ? \
84 virt_to_lbus(addr) : \
85 __virt_to_bus(addr);})
86
87#endif /* CONFIG_ARCH_OMAP15XX */
88
89/* Override the ARM default */
90#ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
91
92#if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0)
93#undef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
94#define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 2
95#endif
96
97#define CONSISTENT_DMA_SIZE \
98 (((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE + 1) & ~1) * 1024 * 1024)
99
100#endif
101
102#endif
103
diff --git a/arch/arm/plat-omap/include/mach/menelaus.h b/arch/arm/plat-omap/include/mach/menelaus.h
new file mode 100644
index 000000000000..3122bf68c7ce
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/menelaus.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/plat-omap/include/mach/menelaus.h
3 *
4 * Functions to access Menelaus power management chip
5 */
6
7#ifndef __ASM_ARCH_MENELAUS_H
8#define __ASM_ARCH_MENELAUS_H
9
10struct device;
11
12struct menelaus_platform_data {
13 int (* late_init)(struct device *dev);
14};
15
16extern int menelaus_register_mmc_callback(void (*callback)(void *data, u8 card_mask),
17 void *data);
18extern void menelaus_unregister_mmc_callback(void);
19extern int menelaus_set_mmc_opendrain(int slot, int enable);
20extern int menelaus_set_mmc_slot(int slot, int enable, int power, int cd_on);
21
22extern int menelaus_set_vmem(unsigned int mV);
23extern int menelaus_set_vio(unsigned int mV);
24extern int menelaus_set_vmmc(unsigned int mV);
25extern int menelaus_set_vaux(unsigned int mV);
26extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
27extern int menelaus_set_slot_sel(int enable);
28extern int menelaus_get_slot_pin_states(void);
29extern int menelaus_set_vcore_sw(unsigned int mV);
30extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
31
32#define EN_VPLL_SLEEP (1 << 7)
33#define EN_VMMC_SLEEP (1 << 6)
34#define EN_VAUX_SLEEP (1 << 5)
35#define EN_VIO_SLEEP (1 << 4)
36#define EN_VMEM_SLEEP (1 << 3)
37#define EN_DC3_SLEEP (1 << 2)
38#define EN_DC2_SLEEP (1 << 1)
39#define EN_VC_SLEEP (1 << 0)
40
41extern int menelaus_set_regulator_sleep(int enable, u32 val);
42
43#if defined(CONFIG_ARCH_OMAP24XX) && defined(CONFIG_MENELAUS)
44#define omap_has_menelaus() 1
45#else
46#define omap_has_menelaus() 0
47#endif
48
49#endif
diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h
new file mode 100644
index 000000000000..fc15d13058fc
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/mmc.h
@@ -0,0 +1,74 @@
1/*
2 * MMC definitions for OMAP2
3 *
4 * Copyright (C) 2006 Nokia Corporation
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 __OMAP2_MMC_H
12#define __OMAP2_MMC_H
13
14#include <linux/types.h>
15#include <linux/device.h>
16#include <linux/mmc/host.h>
17
18#include <mach/board.h>
19
20#define OMAP_MMC_MAX_SLOTS 2
21
22struct omap_mmc_platform_data {
23 struct omap_mmc_conf conf;
24
25 /* number of slots on board */
26 unsigned nr_slots:2;
27
28 /* set if your board has components or wiring that limits the
29 * maximum frequency on the MMC bus */
30 unsigned int max_freq;
31
32 /* switch the bus to a new slot */
33 int (* switch_slot)(struct device *dev, int slot);
34 /* initialize board-specific MMC functionality, can be NULL if
35 * not supported */
36 int (* init)(struct device *dev);
37 void (* cleanup)(struct device *dev);
38 void (* shutdown)(struct device *dev);
39
40 /* To handle board related suspend/resume functionality for MMC */
41 int (*suspend)(struct device *dev, int slot);
42 int (*resume)(struct device *dev, int slot);
43
44 struct omap_mmc_slot_data {
45 int (* set_bus_mode)(struct device *dev, int slot, int bus_mode);
46 int (* set_power)(struct device *dev, int slot, int power_on, int vdd);
47 int (* get_ro)(struct device *dev, int slot);
48
49 /* return MMC cover switch state, can be NULL if not supported.
50 *
51 * possible return values:
52 * 0 - open
53 * 1 - closed
54 */
55 int (* get_cover_state)(struct device *dev, int slot);
56
57 const char *name;
58 u32 ocr_mask;
59
60 /* Card detection IRQs */
61 int card_detect_irq;
62 int (* card_detect)(int irq);
63
64 unsigned int ban_openended:1;
65
66 } slots[OMAP_MMC_MAX_SLOTS];
67};
68
69extern void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info);
70
71/* called from board-specific card detection service routine */
72extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed);
73
74#endif
diff --git a/arch/arm/plat-omap/include/mach/mtd-xip.h b/arch/arm/plat-omap/include/mach/mtd-xip.h
new file mode 100644
index 000000000000..5cee7e16a1b4
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/mtd-xip.h
@@ -0,0 +1,61 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions.
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Vladimir Barinov <vbarinov@ru.mvista.com>
7 *
8 * (c) 2005 MontaVista Software, Inc. This file is licensed under the
9 * terms of the GNU General Public License version 2. This program is
10 * licensed "as is" without any warranty of any kind, whether express or
11 * implied.
12 */
13
14#ifndef __ARCH_OMAP_MTD_XIP_H__
15#define __ARCH_OMAP_MTD_XIP_H__
16
17#include <mach/hardware.h>
18#define OMAP_MPU_TIMER_BASE (0xfffec500)
19#define OMAP_MPU_TIMER_OFFSET 0x100
20
21typedef struct {
22 u32 cntl; /* CNTL_TIMER, R/W */
23 u32 load_tim; /* LOAD_TIM, W */
24 u32 read_tim; /* READ_TIM, R */
25} xip_omap_mpu_timer_regs_t;
26
27#define xip_omap_mpu_timer_base(n) \
28((volatile xip_omap_mpu_timer_regs_t*)IO_ADDRESS(OMAP_MPU_TIMER_BASE + \
29 (n)*OMAP_MPU_TIMER_OFFSET))
30
31static inline unsigned long xip_omap_mpu_timer_read(int nr)
32{
33 volatile xip_omap_mpu_timer_regs_t* timer = xip_omap_mpu_timer_base(nr);
34 return timer->read_tim;
35}
36
37#define xip_irqpending() \
38 (omap_readl(OMAP_IH1_ITR) & ~omap_readl(OMAP_IH1_MIR))
39#define xip_currtime() (~xip_omap_mpu_timer_read(0))
40
41/*
42 * It's permitted to do approxmation for xip_elapsed_since macro
43 * (see linux/mtd/xip.h)
44 */
45
46#ifdef CONFIG_MACH_OMAP_PERSEUS2
47#define xip_elapsed_since(x) (signed)((~xip_omap_mpu_timer_read(0) - (x)) / 7)
48#else
49#define xip_elapsed_since(x) (signed)((~xip_omap_mpu_timer_read(0) - (x)) / 6)
50#endif
51
52/*
53 * xip_cpu_idle() is used when waiting for a delay equal or larger than
54 * the system timer tick period. This should put the CPU into idle mode
55 * to save power and to be woken up only when some interrupts are pending.
56 * As above, this should not rely upon standard kernel code.
57 */
58
59#define xip_cpu_idle() asm volatile ("mcr p15, 0, %0, c7, c0, 4" :: "r" (1))
60
61#endif /* __ARCH_OMAP_MTD_XIP_H__ */
diff --git a/arch/arm/plat-omap/include/mach/mux.h b/arch/arm/plat-omap/include/mach/mux.h
new file mode 100644
index 000000000000..614b2c1327c7
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/mux.h
@@ -0,0 +1,615 @@
1/*
2 * arch/arm/plat-omap/include/mach/mux.h
3 *
4 * Table of the Omap register configurations for the FUNC_MUX and
5 * PULL_DWN combinations.
6 *
7 * Copyright (C) 2004 - 2008 Texas Instruments Inc.
8 * Copyright (C) 2003 - 2008 Nokia Corporation
9 *
10 * Written by Tony Lindgren
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; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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 *
26 * NOTE: Please use the following naming style for new pin entries.
27 * For example, W8_1610_MMC2_DAT0, where:
28 * - W8 = ball
29 * - 1610 = 1510 or 1610, none if common for both 1510 and 1610
30 * - MMC2_DAT0 = function
31 */
32
33#ifndef __ASM_ARCH_MUX_H
34#define __ASM_ARCH_MUX_H
35
36#define PU_PD_SEL_NA 0 /* No pu_pd reg available */
37#define PULL_DWN_CTRL_NA 0 /* No pull-down control needed */
38
39#ifdef CONFIG_OMAP_MUX_DEBUG
40#define MUX_REG(reg, mode_offset, mode) .mux_reg_name = "FUNC_MUX_CTRL_"#reg, \
41 .mux_reg = FUNC_MUX_CTRL_##reg, \
42 .mask_offset = mode_offset, \
43 .mask = mode,
44
45#define PULL_REG(reg, bit, status) .pull_name = "PULL_DWN_CTRL_"#reg, \
46 .pull_reg = PULL_DWN_CTRL_##reg, \
47 .pull_bit = bit, \
48 .pull_val = status,
49
50#define PU_PD_REG(reg, status) .pu_pd_name = "PU_PD_SEL_"#reg, \
51 .pu_pd_reg = PU_PD_SEL_##reg, \
52 .pu_pd_val = status,
53
54#define MUX_REG_730(reg, mode_offset, mode) .mux_reg_name = "OMAP730_IO_CONF_"#reg, \
55 .mux_reg = OMAP730_IO_CONF_##reg, \
56 .mask_offset = mode_offset, \
57 .mask = mode,
58
59#define PULL_REG_730(reg, bit, status) .pull_name = "OMAP730_IO_CONF_"#reg, \
60 .pull_reg = OMAP730_IO_CONF_##reg, \
61 .pull_bit = bit, \
62 .pull_val = status,
63
64#else
65
66#define MUX_REG(reg, mode_offset, mode) .mux_reg = FUNC_MUX_CTRL_##reg, \
67 .mask_offset = mode_offset, \
68 .mask = mode,
69
70#define PULL_REG(reg, bit, status) .pull_reg = PULL_DWN_CTRL_##reg, \
71 .pull_bit = bit, \
72 .pull_val = status,
73
74#define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg, \
75 .pu_pd_val = status,
76
77#define MUX_REG_730(reg, mode_offset, mode) \
78 .mux_reg = OMAP730_IO_CONF_##reg, \
79 .mask_offset = mode_offset, \
80 .mask = mode,
81
82#define PULL_REG_730(reg, bit, status) .pull_reg = OMAP730_IO_CONF_##reg, \
83 .pull_bit = bit, \
84 .pull_val = status,
85
86#endif /* CONFIG_OMAP_MUX_DEBUG */
87
88#define MUX_CFG(desc, mux_reg, mode_offset, mode, \
89 pull_reg, pull_bit, pull_status, \
90 pu_pd_reg, pu_pd_status, debug_status) \
91{ \
92 .name = desc, \
93 .debug = debug_status, \
94 MUX_REG(mux_reg, mode_offset, mode) \
95 PULL_REG(pull_reg, pull_bit, pull_status) \
96 PU_PD_REG(pu_pd_reg, pu_pd_status) \
97},
98
99
100/*
101 * OMAP730 has a slightly different config for the pin mux.
102 * - config regs are the OMAP730_IO_CONF_x regs (see omap730.h) regs and
103 * not the FUNC_MUX_CTRL_x regs from hardware.h
104 * - for pull-up/down, only has one enable bit which is is in the same register
105 * as mux config
106 */
107#define MUX_CFG_730(desc, mux_reg, mode_offset, mode, \
108 pull_bit, pull_status, debug_status)\
109{ \
110 .name = desc, \
111 .debug = debug_status, \
112 MUX_REG_730(mux_reg, mode_offset, mode) \
113 PULL_REG_730(mux_reg, pull_bit, pull_status) \
114 PU_PD_REG(NA, 0) \
115},
116
117#define MUX_CFG_24XX(desc, reg_offset, mode, \
118 pull_en, pull_mode, dbg) \
119{ \
120 .name = desc, \
121 .debug = dbg, \
122 .mux_reg = reg_offset, \
123 .mask = mode, \
124 .pull_val = pull_en, \
125 .pu_pd_val = pull_mode, \
126},
127
128
129#define PULL_DISABLED 0
130#define PULL_ENABLED 1
131
132#define PULL_DOWN 0
133#define PULL_UP 1
134
135struct pin_config {
136 char *name;
137 unsigned char busy;
138 unsigned char debug;
139
140 const char *mux_reg_name;
141 const unsigned int mux_reg;
142 const unsigned char mask_offset;
143 const unsigned char mask;
144
145 const char *pull_name;
146 const unsigned int pull_reg;
147 const unsigned char pull_val;
148 const unsigned char pull_bit;
149
150 const char *pu_pd_name;
151 const unsigned int pu_pd_reg;
152 const unsigned char pu_pd_val;
153};
154
155enum omap730_index {
156 /* OMAP 730 keyboard */
157 E2_730_KBR0,
158 J7_730_KBR1,
159 E1_730_KBR2,
160 F3_730_KBR3,
161 D2_730_KBR4,
162 C2_730_KBC0,
163 D3_730_KBC1,
164 E4_730_KBC2,
165 F4_730_KBC3,
166 E3_730_KBC4,
167
168 /* USB */
169 AA17_730_USB_DM,
170 W16_730_USB_PU_EN,
171 W17_730_USB_VBUSI,
172};
173
174enum omap1xxx_index {
175 /* UART1 (BT_UART_GATING)*/
176 UART1_TX = 0,
177 UART1_RTS,
178
179 /* UART2 (COM_UART_GATING)*/
180 UART2_TX,
181 UART2_RX,
182 UART2_CTS,
183 UART2_RTS,
184
185 /* UART3 (GIGA_UART_GATING) */
186 UART3_TX,
187 UART3_RX,
188 UART3_CTS,
189 UART3_RTS,
190 UART3_CLKREQ,
191 UART3_BCLK, /* 12MHz clock out */
192 Y15_1610_UART3_RTS,
193
194 /* PWT & PWL */
195 PWT,
196 PWL,
197
198 /* USB master generic */
199 R18_USB_VBUS,
200 R18_1510_USB_GPIO0,
201 W4_USB_PUEN,
202 W4_USB_CLKO,
203 W4_USB_HIGHZ,
204 W4_GPIO58,
205
206 /* USB1 master */
207 USB1_SUSP,
208 USB1_SEO,
209 W13_1610_USB1_SE0,
210 USB1_TXEN,
211 USB1_TXD,
212 USB1_VP,
213 USB1_VM,
214 USB1_RCV,
215 USB1_SPEED,
216 R13_1610_USB1_SPEED,
217 R13_1710_USB1_SE0,
218
219 /* USB2 master */
220 USB2_SUSP,
221 USB2_VP,
222 USB2_TXEN,
223 USB2_VM,
224 USB2_RCV,
225 USB2_SEO,
226 USB2_TXD,
227
228 /* OMAP-1510 GPIO */
229 R18_1510_GPIO0,
230 R19_1510_GPIO1,
231 M14_1510_GPIO2,
232
233 /* OMAP1610 GPIO */
234 P18_1610_GPIO3,
235 Y15_1610_GPIO17,
236
237 /* OMAP-1710 GPIO */
238 R18_1710_GPIO0,
239 V2_1710_GPIO10,
240 N21_1710_GPIO14,
241 W15_1710_GPIO40,
242
243 /* MPUIO */
244 MPUIO2,
245 N15_1610_MPUIO2,
246 MPUIO4,
247 MPUIO5,
248 T20_1610_MPUIO5,
249 W11_1610_MPUIO6,
250 V10_1610_MPUIO7,
251 W11_1610_MPUIO9,
252 V10_1610_MPUIO10,
253 W10_1610_MPUIO11,
254 E20_1610_MPUIO13,
255 U20_1610_MPUIO14,
256 E19_1610_MPUIO15,
257
258 /* MCBSP2 */
259 MCBSP2_CLKR,
260 MCBSP2_CLKX,
261 MCBSP2_DR,
262 MCBSP2_DX,
263 MCBSP2_FSR,
264 MCBSP2_FSX,
265
266 /* MCBSP3 */
267 MCBSP3_CLKX,
268
269 /* Misc ballouts */
270 BALLOUT_V8_ARMIO3,
271 N20_HDQ,
272
273 /* OMAP-1610 MMC2 */
274 W8_1610_MMC2_DAT0,
275 V8_1610_MMC2_DAT1,
276 W15_1610_MMC2_DAT2,
277 R10_1610_MMC2_DAT3,
278 Y10_1610_MMC2_CLK,
279 Y8_1610_MMC2_CMD,
280 V9_1610_MMC2_CMDDIR,
281 V5_1610_MMC2_DATDIR0,
282 W19_1610_MMC2_DATDIR1,
283 R18_1610_MMC2_CLKIN,
284
285 /* OMAP-1610 External Trace Interface */
286 M19_1610_ETM_PSTAT0,
287 L15_1610_ETM_PSTAT1,
288 L18_1610_ETM_PSTAT2,
289 L19_1610_ETM_D0,
290 J19_1610_ETM_D6,
291 J18_1610_ETM_D7,
292
293 /* OMAP16XX GPIO */
294 P20_1610_GPIO4,
295 V9_1610_GPIO7,
296 W8_1610_GPIO9,
297 N20_1610_GPIO11,
298 N19_1610_GPIO13,
299 P10_1610_GPIO22,
300 V5_1610_GPIO24,
301 AA20_1610_GPIO_41,
302 W19_1610_GPIO48,
303 M7_1610_GPIO62,
304 V14_16XX_GPIO37,
305 R9_16XX_GPIO18,
306 L14_16XX_GPIO49,
307
308 /* OMAP-1610 uWire */
309 V19_1610_UWIRE_SCLK,
310 U18_1610_UWIRE_SDI,
311 W21_1610_UWIRE_SDO,
312 N14_1610_UWIRE_CS0,
313 P15_1610_UWIRE_CS3,
314 N15_1610_UWIRE_CS1,
315
316 /* OMAP-1610 SPI */
317 U19_1610_SPIF_SCK,
318 U18_1610_SPIF_DIN,
319 P20_1610_SPIF_DIN,
320 W21_1610_SPIF_DOUT,
321 R18_1610_SPIF_DOUT,
322 N14_1610_SPIF_CS0,
323 N15_1610_SPIF_CS1,
324 T19_1610_SPIF_CS2,
325 P15_1610_SPIF_CS3,
326
327 /* OMAP-1610 Flash */
328 L3_1610_FLASH_CS2B_OE,
329 M8_1610_FLASH_CS2B_WE,
330
331 /* First MMC */
332 MMC_CMD,
333 MMC_DAT1,
334 MMC_DAT2,
335 MMC_DAT0,
336 MMC_CLK,
337 MMC_DAT3,
338
339 /* OMAP-1710 MMC CMDDIR and DATDIR0 */
340 M15_1710_MMC_CLKI,
341 P19_1710_MMC_CMDDIR,
342 P20_1710_MMC_DATDIR0,
343
344 /* OMAP-1610 USB0 alternate pin configuration */
345 W9_USB0_TXEN,
346 AA9_USB0_VP,
347 Y5_USB0_RCV,
348 R9_USB0_VM,
349 V6_USB0_TXD,
350 W5_USB0_SE0,
351 V9_USB0_SPEED,
352 V9_USB0_SUSP,
353
354 /* USB2 */
355 W9_USB2_TXEN,
356 AA9_USB2_VP,
357 Y5_USB2_RCV,
358 R9_USB2_VM,
359 V6_USB2_TXD,
360 W5_USB2_SE0,
361
362 /* 16XX UART */
363 R13_1610_UART1_TX,
364 V14_16XX_UART1_RX,
365 R14_1610_UART1_CTS,
366 AA15_1610_UART1_RTS,
367 R9_16XX_UART2_RX,
368 L14_16XX_UART3_RX,
369
370 /* I2C OMAP-1610 */
371 I2C_SCL,
372 I2C_SDA,
373
374 /* Keypad */
375 F18_1610_KBC0,
376 D20_1610_KBC1,
377 D19_1610_KBC2,
378 E18_1610_KBC3,
379 C21_1610_KBC4,
380 G18_1610_KBR0,
381 F19_1610_KBR1,
382 H14_1610_KBR2,
383 E20_1610_KBR3,
384 E19_1610_KBR4,
385 N19_1610_KBR5,
386
387 /* Power management */
388 T20_1610_LOW_PWR,
389
390 /* MCLK Settings */
391 V5_1710_MCLK_ON,
392 V5_1710_MCLK_OFF,
393 R10_1610_MCLK_ON,
394 R10_1610_MCLK_OFF,
395
396 /* CompactFlash controller */
397 P11_1610_CF_CD2,
398 R11_1610_CF_IOIS16,
399 V10_1610_CF_IREQ,
400 W10_1610_CF_RESET,
401 W11_1610_CF_CD1,
402
403 /* parallel camera */
404 J15_1610_CAM_LCLK,
405 J18_1610_CAM_D7,
406 J19_1610_CAM_D6,
407 J14_1610_CAM_D5,
408 K18_1610_CAM_D4,
409 K19_1610_CAM_D3,
410 K15_1610_CAM_D2,
411 K14_1610_CAM_D1,
412 L19_1610_CAM_D0,
413 L18_1610_CAM_VS,
414 L15_1610_CAM_HS,
415 M19_1610_CAM_RSTZ,
416 Y15_1610_CAM_OUTCLK,
417
418 /* serial camera */
419 H19_1610_CAM_EXCLK,
420 Y12_1610_CCP_CLKP,
421 W13_1610_CCP_CLKM,
422 W14_1610_CCP_DATAP,
423 Y14_1610_CCP_DATAM,
424
425};
426
427enum omap24xx_index {
428 /* 24xx I2C */
429 M19_24XX_I2C1_SCL,
430 L15_24XX_I2C1_SDA,
431 J15_24XX_I2C2_SCL,
432 H19_24XX_I2C2_SDA,
433
434 /* 24xx Menelaus interrupt */
435 W19_24XX_SYS_NIRQ,
436
437 /* 24xx clock */
438 W14_24XX_SYS_CLKOUT,
439
440 /* 24xx GPMC chipselects, wait pin monitoring */
441 E2_GPMC_NCS2,
442 L2_GPMC_NCS7,
443 L3_GPMC_WAIT0,
444 N7_GPMC_WAIT1,
445 M1_GPMC_WAIT2,
446 P1_GPMC_WAIT3,
447
448 /* 242X McBSP */
449 Y15_24XX_MCBSP2_CLKX,
450 R14_24XX_MCBSP2_FSX,
451 W15_24XX_MCBSP2_DR,
452 V15_24XX_MCBSP2_DX,
453
454 /* 24xx GPIO */
455 M21_242X_GPIO11,
456 P21_242X_GPIO12,
457 AA10_242X_GPIO13,
458 AA6_242X_GPIO14,
459 AA4_242X_GPIO15,
460 Y11_242X_GPIO16,
461 AA12_242X_GPIO17,
462 AA8_242X_GPIO58,
463 Y20_24XX_GPIO60,
464 W4__24XX_GPIO74,
465 N15_24XX_GPIO85,
466 M15_24XX_GPIO92,
467 P20_24XX_GPIO93,
468 P18_24XX_GPIO95,
469 M18_24XX_GPIO96,
470 L14_24XX_GPIO97,
471 J15_24XX_GPIO99,
472 V14_24XX_GPIO117,
473 P14_24XX_GPIO125,
474
475 /* 242x DBG GPIO */
476 V4_242X_GPIO49,
477 W2_242X_GPIO50,
478 U4_242X_GPIO51,
479 V3_242X_GPIO52,
480 V2_242X_GPIO53,
481 V6_242X_GPIO53,
482 T4_242X_GPIO54,
483 Y4_242X_GPIO54,
484 T3_242X_GPIO55,
485 U2_242X_GPIO56,
486
487 /* 24xx external DMA requests */
488 AA10_242X_DMAREQ0,
489 AA6_242X_DMAREQ1,
490 E4_242X_DMAREQ2,
491 G4_242X_DMAREQ3,
492 D3_242X_DMAREQ4,
493 E3_242X_DMAREQ5,
494
495 /* UART3 */
496 K15_24XX_UART3_TX,
497 K14_24XX_UART3_RX,
498
499 /* MMC/SDIO */
500 G19_24XX_MMC_CLKO,
501 H18_24XX_MMC_CMD,
502 F20_24XX_MMC_DAT0,
503 H14_24XX_MMC_DAT1,
504 E19_24XX_MMC_DAT2,
505 D19_24XX_MMC_DAT3,
506 F19_24XX_MMC_DAT_DIR0,
507 E20_24XX_MMC_DAT_DIR1,
508 F18_24XX_MMC_DAT_DIR2,
509 E18_24XX_MMC_DAT_DIR3,
510 G18_24XX_MMC_CMD_DIR,
511 H15_24XX_MMC_CLKI,
512
513 /* Full speed USB */
514 J20_24XX_USB0_PUEN,
515 J19_24XX_USB0_VP,
516 K20_24XX_USB0_VM,
517 J18_24XX_USB0_RCV,
518 K19_24XX_USB0_TXEN,
519 J14_24XX_USB0_SE0,
520 K18_24XX_USB0_DAT,
521
522 N14_24XX_USB1_SE0,
523 W12_24XX_USB1_SE0,
524 P15_24XX_USB1_DAT,
525 R13_24XX_USB1_DAT,
526 W20_24XX_USB1_TXEN,
527 P13_24XX_USB1_TXEN,
528 V19_24XX_USB1_RCV,
529 V12_24XX_USB1_RCV,
530
531 AA10_24XX_USB2_SE0,
532 Y11_24XX_USB2_DAT,
533 AA12_24XX_USB2_TXEN,
534 AA6_24XX_USB2_RCV,
535 AA4_24XX_USB2_TLLSE0,
536
537 /* Keypad GPIO*/
538 T19_24XX_KBR0,
539 R19_24XX_KBR1,
540 V18_24XX_KBR2,
541 M21_24XX_KBR3,
542 E5__24XX_KBR4,
543 M18_24XX_KBR5,
544 R20_24XX_KBC0,
545 M14_24XX_KBC1,
546 H19_24XX_KBC2,
547 V17_24XX_KBC3,
548 P21_24XX_KBC4,
549 L14_24XX_KBC5,
550 N19_24XX_KBC6,
551
552 /* 24xx Menelaus Keypad GPIO */
553 B3__24XX_KBR5,
554 AA4_24XX_KBC2,
555 B13_24XX_KBC6,
556
557 /* 2430 USB */
558 AD9_2430_USB0_PUEN,
559 Y11_2430_USB0_VP,
560 AD7_2430_USB0_VM,
561 AE7_2430_USB0_RCV,
562 AD4_2430_USB0_TXEN,
563 AF9_2430_USB0_SE0,
564 AE6_2430_USB0_DAT,
565 AD24_2430_USB1_SE0,
566 AB24_2430_USB1_RCV,
567 Y25_2430_USB1_TXEN,
568 AA26_2430_USB1_DAT,
569
570 /* 2430 HS-USB */
571 AD9_2430_USB0HS_DATA3,
572 Y11_2430_USB0HS_DATA4,
573 AD7_2430_USB0HS_DATA5,
574 AE7_2430_USB0HS_DATA6,
575 AD4_2430_USB0HS_DATA2,
576 AF9_2430_USB0HS_DATA0,
577 AE6_2430_USB0HS_DATA1,
578 AE8_2430_USB0HS_CLK,
579 AD8_2430_USB0HS_DIR,
580 AE5_2430_USB0HS_STP,
581 AE9_2430_USB0HS_NXT,
582 AC7_2430_USB0HS_DATA7,
583
584 /* 2430 McBSP */
585 AC10_2430_MCBSP2_FSX,
586 AD16_2430_MCBSP2_CLX,
587 AE13_2430_MCBSP2_DX,
588 AD13_2430_MCBSP2_DR,
589 AC10_2430_MCBSP2_FSX_OFF,
590 AD16_2430_MCBSP2_CLX_OFF,
591 AE13_2430_MCBSP2_DX_OFF,
592 AD13_2430_MCBSP2_DR_OFF,
593
594};
595
596struct omap_mux_cfg {
597 struct pin_config *pins;
598 unsigned long size;
599 int (*cfg_reg)(const struct pin_config *cfg);
600};
601
602#ifdef CONFIG_OMAP_MUX
603/* setup pin muxing in Linux */
604extern int omap1_mux_init(void);
605extern int omap2_mux_init(void);
606extern int omap_mux_register(struct omap_mux_cfg *);
607extern int omap_cfg_reg(unsigned long reg_cfg);
608#else
609/* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */
610static inline int omap1_mux_init(void) { return 0; }
611static inline int omap2_mux_init(void) { return 0; }
612static inline int omap_cfg_reg(unsigned long reg_cfg) { return 0; }
613#endif
614
615#endif
diff --git a/arch/arm/plat-omap/include/mach/nand.h b/arch/arm/plat-omap/include/mach/nand.h
new file mode 100644
index 000000000000..631a7bed1eef
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/nand.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/plat-omap/include/mach/nand.h
3 *
4 * Copyright (C) 2006 Micron Technology Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/mtd/partitions.h>
12
13struct omap_nand_platform_data {
14 unsigned int options;
15 int cs;
16 int gpio_irq;
17 struct mtd_partition *parts;
18 int nr_parts;
19 int (*nand_setup)(void __iomem *);
20 int (*dev_ready)(struct omap_nand_platform_data *);
21 int dma_channel;
22 void __iomem *gpmc_cs_baseaddr;
23 void __iomem *gpmc_baseaddr;
24};
diff --git a/arch/arm/plat-omap/include/mach/omap-alsa.h b/arch/arm/plat-omap/include/mach/omap-alsa.h
new file mode 100644
index 000000000000..bdf30a0f87f2
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/omap-alsa.h
@@ -0,0 +1,123 @@
1/*
2 * arch/arm/plat-omap/include/mach/omap-alsa.h
3 *
4 * Alsa Driver for AIC23 and TSC2101 codecs on OMAP platform boards.
5 *
6 * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
7 *
8 * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
9 * Written by Daniel Petrini, David Cohen, Anderson Briglia
10 * {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 *
32 * History
33 * -------
34 *
35 * 2005/07/25 INdT-10LE Kernel Team - Alsa driver for omap osk,
36 * original version based in sa1100 driver
37 * and omap oss driver.
38 */
39
40#ifndef __OMAP_ALSA_H
41#define __OMAP_ALSA_H
42
43#include <mach/dma.h>
44#include <sound/core.h>
45#include <sound/pcm.h>
46#include <mach/mcbsp.h>
47#include <linux/platform_device.h>
48
49#define DMA_BUF_SIZE (1024 * 8)
50
51/*
52 * Buffer management for alsa and dma
53 */
54struct audio_stream {
55 char *id; /* identification string */
56 int stream_id; /* numeric identification */
57 int dma_dev; /* dma number of that device */
58 int *lch; /* Chain of channels this stream is linked to */
59 char started; /* to store if the chain was started or not */
60 int dma_q_head; /* DMA Channel Q Head */
61 int dma_q_tail; /* DMA Channel Q Tail */
62 char dma_q_count; /* DMA Channel Q Count */
63 int active:1; /* we are using this stream for transfer now */
64 int period; /* current transfer period */
65 int periods; /* current count of periods registerd in the DMA engine */
66 spinlock_t dma_lock; /* for locking in DMA operations */
67 struct snd_pcm_substream *stream; /* the pcm stream */
68 unsigned linked:1; /* dma channels linked */
69 int offset; /* store start position of the last period in the alsa buffer */
70 int (*hw_start)(void); /* interface to start HW interface, e.g. McBSP */
71 int (*hw_stop)(void); /* interface to stop HW interface, e.g. McBSP */
72};
73
74/*
75 * Alsa card structure for aic23
76 */
77struct snd_card_omap_codec {
78 struct snd_card *card;
79 struct snd_pcm *pcm;
80 long samplerate;
81 struct audio_stream s[2]; /* playback & capture */
82};
83
84/* Codec specific information and function pointers.
85 * Codec (omap-alsa-aic23.c and omap-alsa-tsc2101.c)
86 * are responsible for defining the function pointers.
87 */
88struct omap_alsa_codec_config {
89 char *name;
90 struct omap_mcbsp_reg_cfg *mcbsp_regs_alsa;
91 struct snd_pcm_hw_constraint_list *hw_constraints_rates;
92 struct snd_pcm_hardware *snd_omap_alsa_playback;
93 struct snd_pcm_hardware *snd_omap_alsa_capture;
94 void (*codec_configure_dev)(void);
95 void (*codec_set_samplerate)(long);
96 void (*codec_clock_setup)(void);
97 int (*codec_clock_on)(void);
98 int (*codec_clock_off)(void);
99 int (*get_default_samplerate)(void);
100};
101
102/*********** Mixer function prototypes *************************/
103int snd_omap_mixer(struct snd_card_omap_codec *);
104void snd_omap_init_mixer(void);
105
106#ifdef CONFIG_PM
107void snd_omap_suspend_mixer(void);
108void snd_omap_resume_mixer(void);
109#endif
110
111int snd_omap_alsa_post_probe(struct platform_device *pdev, struct omap_alsa_codec_config *config);
112int snd_omap_alsa_remove(struct platform_device *pdev);
113#ifdef CONFIG_PM
114int snd_omap_alsa_suspend(struct platform_device *pdev, pm_message_t state);
115int snd_omap_alsa_resume(struct platform_device *pdev);
116#else
117#define snd_omap_alsa_suspend NULL
118#define snd_omap_alsa_resume NULL
119#endif
120
121void callback_omap_alsa_sound_dma(void *);
122
123#endif
diff --git a/arch/arm/plat-omap/include/mach/omap1510.h b/arch/arm/plat-omap/include/mach/omap1510.h
new file mode 100644
index 000000000000..505a38af8b22
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/omap1510.h
@@ -0,0 +1,48 @@
1/* arch/arm/plat-omap/include/mach/omap1510.h
2 *
3 * Hardware definitions for TI OMAP1510 processor.
4 *
5 * Cleanup for Linux-2.6 by Dirk Behme <dirk.behme@de.bosch.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#ifndef __ASM_ARCH_OMAP15XX_H
29#define __ASM_ARCH_OMAP15XX_H
30
31/*
32 * ----------------------------------------------------------------------------
33 * Base addresses
34 * ----------------------------------------------------------------------------
35 */
36
37/* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */
38
39#define OMAP1510_DSP_BASE 0xE0000000
40#define OMAP1510_DSP_SIZE 0x28000
41#define OMAP1510_DSP_START 0xE0000000
42
43#define OMAP1510_DSPREG_BASE 0xE1000000
44#define OMAP1510_DSPREG_SIZE SZ_128K
45#define OMAP1510_DSPREG_START 0xE1000000
46
47#endif /* __ASM_ARCH_OMAP15XX_H */
48
diff --git a/arch/arm/plat-omap/include/mach/omap16xx.h b/arch/arm/plat-omap/include/mach/omap16xx.h
new file mode 100644
index 000000000000..c6c93afb2788
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/omap16xx.h
@@ -0,0 +1,197 @@
1/* arch/arm/plat-omap/include/mach/omap16xx.h
2 *
3 * Hardware definitions for TI OMAP1610/5912/1710 processors.
4 *
5 * Cleanup for Linux-2.6 by Dirk Behme <dirk.behme@de.bosch.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#ifndef __ASM_ARCH_OMAP16XX_H
29#define __ASM_ARCH_OMAP16XX_H
30
31/*
32 * ----------------------------------------------------------------------------
33 * Base addresses
34 * ----------------------------------------------------------------------------
35 */
36
37/* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */
38
39#define OMAP16XX_DSP_BASE 0xE0000000
40#define OMAP16XX_DSP_SIZE 0x28000
41#define OMAP16XX_DSP_START 0xE0000000
42
43#define OMAP16XX_DSPREG_BASE 0xE1000000
44#define OMAP16XX_DSPREG_SIZE SZ_128K
45#define OMAP16XX_DSPREG_START 0xE1000000
46
47/*
48 * ---------------------------------------------------------------------------
49 * Interrupts
50 * ---------------------------------------------------------------------------
51 */
52#define OMAP_IH2_0_BASE (0xfffe0000)
53#define OMAP_IH2_1_BASE (0xfffe0100)
54#define OMAP_IH2_2_BASE (0xfffe0200)
55#define OMAP_IH2_3_BASE (0xfffe0300)
56
57#define OMAP_IH2_0_ITR (OMAP_IH2_0_BASE + 0x00)
58#define OMAP_IH2_0_MIR (OMAP_IH2_0_BASE + 0x04)
59#define OMAP_IH2_0_SIR_IRQ (OMAP_IH2_0_BASE + 0x10)
60#define OMAP_IH2_0_SIR_FIQ (OMAP_IH2_0_BASE + 0x14)
61#define OMAP_IH2_0_CONTROL (OMAP_IH2_0_BASE + 0x18)
62#define OMAP_IH2_0_ILR0 (OMAP_IH2_0_BASE + 0x1c)
63#define OMAP_IH2_0_ISR (OMAP_IH2_0_BASE + 0x9c)
64
65#define OMAP_IH2_1_ITR (OMAP_IH2_1_BASE + 0x00)
66#define OMAP_IH2_1_MIR (OMAP_IH2_1_BASE + 0x04)
67#define OMAP_IH2_1_SIR_IRQ (OMAP_IH2_1_BASE + 0x10)
68#define OMAP_IH2_1_SIR_FIQ (OMAP_IH2_1_BASE + 0x14)
69#define OMAP_IH2_1_CONTROL (OMAP_IH2_1_BASE + 0x18)
70#define OMAP_IH2_1_ILR1 (OMAP_IH2_1_BASE + 0x1c)
71#define OMAP_IH2_1_ISR (OMAP_IH2_1_BASE + 0x9c)
72
73#define OMAP_IH2_2_ITR (OMAP_IH2_2_BASE + 0x00)
74#define OMAP_IH2_2_MIR (OMAP_IH2_2_BASE + 0x04)
75#define OMAP_IH2_2_SIR_IRQ (OMAP_IH2_2_BASE + 0x10)
76#define OMAP_IH2_2_SIR_FIQ (OMAP_IH2_2_BASE + 0x14)
77#define OMAP_IH2_2_CONTROL (OMAP_IH2_2_BASE + 0x18)
78#define OMAP_IH2_2_ILR2 (OMAP_IH2_2_BASE + 0x1c)
79#define OMAP_IH2_2_ISR (OMAP_IH2_2_BASE + 0x9c)
80
81#define OMAP_IH2_3_ITR (OMAP_IH2_3_BASE + 0x00)
82#define OMAP_IH2_3_MIR (OMAP_IH2_3_BASE + 0x04)
83#define OMAP_IH2_3_SIR_IRQ (OMAP_IH2_3_BASE + 0x10)
84#define OMAP_IH2_3_SIR_FIQ (OMAP_IH2_3_BASE + 0x14)
85#define OMAP_IH2_3_CONTROL (OMAP_IH2_3_BASE + 0x18)
86#define OMAP_IH2_3_ILR3 (OMAP_IH2_3_BASE + 0x1c)
87#define OMAP_IH2_3_ISR (OMAP_IH2_3_BASE + 0x9c)
88
89/*
90 * ----------------------------------------------------------------------------
91 * Clocks
92 * ----------------------------------------------------------------------------
93 */
94#define OMAP16XX_ARM_IDLECT3 (CLKGEN_REG_BASE + 0x24)
95
96/*
97 * ----------------------------------------------------------------------------
98 * Pin configuration registers
99 * ----------------------------------------------------------------------------
100 */
101#define OMAP16XX_CONF_VOLTAGE_VDDSHV6 (1 << 8)
102#define OMAP16XX_CONF_VOLTAGE_VDDSHV7 (1 << 9)
103#define OMAP16XX_CONF_VOLTAGE_VDDSHV8 (1 << 10)
104#define OMAP16XX_CONF_VOLTAGE_VDDSHV9 (1 << 11)
105#define OMAP16XX_SUBLVDS_CONF_VALID (1 << 13)
106
107/*
108 * ----------------------------------------------------------------------------
109 * System control registers
110 * ----------------------------------------------------------------------------
111 */
112#define OMAP1610_RESET_CONTROL 0xfffe1140
113
114/*
115 * ---------------------------------------------------------------------------
116 * TIPB bus interface
117 * ---------------------------------------------------------------------------
118 */
119#define TIPB_SWITCH_BASE (0xfffbc800)
120#define OMAP16XX_MMCSD2_SSW_MPU_CONF (TIPB_SWITCH_BASE + 0x160)
121
122/* UART3 Registers Maping through MPU bus */
123#define UART3_RHR (OMAP_UART3_BASE + 0)
124#define UART3_THR (OMAP_UART3_BASE + 0)
125#define UART3_DLL (OMAP_UART3_BASE + 0)
126#define UART3_IER (OMAP_UART3_BASE + 4)
127#define UART3_DLH (OMAP_UART3_BASE + 4)
128#define UART3_IIR (OMAP_UART3_BASE + 8)
129#define UART3_FCR (OMAP_UART3_BASE + 8)
130#define UART3_EFR (OMAP_UART3_BASE + 8)
131#define UART3_LCR (OMAP_UART3_BASE + 0x0C)
132#define UART3_MCR (OMAP_UART3_BASE + 0x10)
133#define UART3_XON1_ADDR1 (OMAP_UART3_BASE + 0x10)
134#define UART3_XON2_ADDR2 (OMAP_UART3_BASE + 0x14)
135#define UART3_LSR (OMAP_UART3_BASE + 0x14)
136#define UART3_TCR (OMAP_UART3_BASE + 0x18)
137#define UART3_MSR (OMAP_UART3_BASE + 0x18)
138#define UART3_XOFF1 (OMAP_UART3_BASE + 0x18)
139#define UART3_XOFF2 (OMAP_UART3_BASE + 0x1C)
140#define UART3_SPR (OMAP_UART3_BASE + 0x1C)
141#define UART3_TLR (OMAP_UART3_BASE + 0x1C)
142#define UART3_MDR1 (OMAP_UART3_BASE + 0x20)
143#define UART3_MDR2 (OMAP_UART3_BASE + 0x24)
144#define UART3_SFLSR (OMAP_UART3_BASE + 0x28)
145#define UART3_TXFLL (OMAP_UART3_BASE + 0x28)
146#define UART3_RESUME (OMAP_UART3_BASE + 0x2C)
147#define UART3_TXFLH (OMAP_UART3_BASE + 0x2C)
148#define UART3_SFREGL (OMAP_UART3_BASE + 0x30)
149#define UART3_RXFLL (OMAP_UART3_BASE + 0x30)
150#define UART3_SFREGH (OMAP_UART3_BASE + 0x34)
151#define UART3_RXFLH (OMAP_UART3_BASE + 0x34)
152#define UART3_BLR (OMAP_UART3_BASE + 0x38)
153#define UART3_ACREG (OMAP_UART3_BASE + 0x3C)
154#define UART3_DIV16 (OMAP_UART3_BASE + 0x3C)
155#define UART3_SCR (OMAP_UART3_BASE + 0x40)
156#define UART3_SSR (OMAP_UART3_BASE + 0x44)
157#define UART3_EBLR (OMAP_UART3_BASE + 0x48)
158#define UART3_OSC_12M_SEL (OMAP_UART3_BASE + 0x4C)
159#define UART3_MVR (OMAP_UART3_BASE + 0x50)
160
161/*
162 * ---------------------------------------------------------------------------
163 * Watchdog timer
164 * ---------------------------------------------------------------------------
165 */
166
167/* 32-bit Watchdog timer in OMAP 16XX */
168#define OMAP_16XX_WATCHDOG_BASE (0xfffeb000)
169#define OMAP_16XX_WIDR (OMAP_16XX_WATCHDOG_BASE + 0x00)
170#define OMAP_16XX_WD_SYSCONFIG (OMAP_16XX_WATCHDOG_BASE + 0x10)
171#define OMAP_16XX_WD_SYSSTATUS (OMAP_16XX_WATCHDOG_BASE + 0x14)
172#define OMAP_16XX_WCLR (OMAP_16XX_WATCHDOG_BASE + 0x24)
173#define OMAP_16XX_WCRR (OMAP_16XX_WATCHDOG_BASE + 0x28)
174#define OMAP_16XX_WLDR (OMAP_16XX_WATCHDOG_BASE + 0x2c)
175#define OMAP_16XX_WTGR (OMAP_16XX_WATCHDOG_BASE + 0x30)
176#define OMAP_16XX_WWPS (OMAP_16XX_WATCHDOG_BASE + 0x34)
177#define OMAP_16XX_WSPR (OMAP_16XX_WATCHDOG_BASE + 0x48)
178
179#define WCLR_PRE_SHIFT 5
180#define WCLR_PTV_SHIFT 2
181
182#define WWPS_W_PEND_WSPR (1 << 4)
183#define WWPS_W_PEND_WTGR (1 << 3)
184#define WWPS_W_PEND_WLDR (1 << 2)
185#define WWPS_W_PEND_WCRR (1 << 1)
186#define WWPS_W_PEND_WCLR (1 << 0)
187
188#define WSPR_ENABLE_0 (0x0000bbbb)
189#define WSPR_ENABLE_1 (0x00004444)
190#define WSPR_DISABLE_0 (0x0000aaaa)
191#define WSPR_DISABLE_1 (0x00005555)
192
193/* Mailbox */
194#define OMAP16XX_MAILBOX_BASE (0xfffcf000)
195
196#endif /* __ASM_ARCH_OMAP16XX_H */
197
diff --git a/arch/arm/plat-omap/include/mach/omap24xx.h b/arch/arm/plat-omap/include/mach/omap24xx.h
new file mode 100644
index 000000000000..bb8319d66e9f
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/omap24xx.h
@@ -0,0 +1,107 @@
1/*
2 * arch/arm/plat-omap/include/mach/omap24xx.h
3 *
4 * This file contains the processor specific definitions
5 * of the TI OMAP24XX.
6 *
7 * Copyright (C) 2007 Texas Instruments.
8 * Copyright (C) 2007 Nokia Corporation.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#ifndef __ASM_ARCH_OMAP24XX_H
27#define __ASM_ARCH_OMAP24XX_H
28
29/*
30 * Please place only base defines here and put the rest in device
31 * specific headers. Note also that some of these defines are needed
32 * for omap1 to compile without adding ifdefs.
33 */
34
35#define L4_24XX_BASE 0x48000000
36#define L4_WK_243X_BASE 0x49000000
37#define L3_24XX_BASE 0x68000000
38
39/* interrupt controller */
40#define OMAP24XX_IC_BASE (L4_24XX_BASE + 0xfe000)
41#define OMAP24XX_IVA_INTC_BASE 0x40000000
42#define IRQ_SIR_IRQ 0x0040
43
44#define OMAP2420_CTRL_BASE L4_24XX_BASE
45#define OMAP2420_32KSYNCT_BASE (L4_24XX_BASE + 0x4000)
46#define OMAP2420_PRCM_BASE (L4_24XX_BASE + 0x8000)
47#define OMAP2420_CM_BASE (L4_24XX_BASE + 0x8000)
48#define OMAP2420_PRM_BASE OMAP2420_CM_BASE
49#define OMAP2420_SDRC_BASE (L3_24XX_BASE + 0x9000)
50#define OMAP2420_SMS_BASE 0x68008000
51
52#define OMAP2430_32KSYNCT_BASE (L4_WK_243X_BASE + 0x20000)
53#define OMAP2430_PRCM_BASE (L4_WK_243X_BASE + 0x6000)
54#define OMAP2430_CM_BASE (L4_WK_243X_BASE + 0x6000)
55#define OMAP2430_PRM_BASE OMAP2430_CM_BASE
56
57#define OMAP243X_SMS_BASE 0x6C000000
58#define OMAP243X_SDRC_BASE 0x6D000000
59#define OMAP243X_GPMC_BASE 0x6E000000
60#define OMAP243X_SCM_BASE (L4_WK_243X_BASE + 0x2000)
61#define OMAP243X_CTRL_BASE OMAP243X_SCM_BASE
62#define OMAP243X_HS_BASE (L4_24XX_BASE + 0x000ac000)
63
64/* DSP SS */
65#define OMAP2420_DSP_BASE 0x58000000
66#define OMAP2420_DSP_MEM_BASE (OMAP2420_DSP_BASE + 0x0)
67#define OMAP2420_DSP_IPI_BASE (OMAP2420_DSP_BASE + 0x1000000)
68#define OMAP2420_DSP_MMU_BASE (OMAP2420_DSP_BASE + 0x2000000)
69
70#define OMAP243X_DSP_BASE 0x5C000000
71#define OMAP243X_DSP_MEM_BASE (OMAP243X_DSP_BASE + 0x0)
72#define OMAP243X_DSP_MMU_BASE (OMAP243X_DSP_BASE + 0x1000000)
73
74/* Mailbox */
75#define OMAP24XX_MAILBOX_BASE (L4_24XX_BASE + 0x94000)
76
77/* Camera */
78#define OMAP24XX_CAMERA_BASE (L4_24XX_BASE + 0x52000)
79
80/* Security */
81#define OMAP24XX_SEC_BASE (L4_24XX_BASE + 0xA0000)
82#define OMAP24XX_SEC_RNG_BASE (OMAP24XX_SEC_BASE + 0x0000)
83#define OMAP24XX_SEC_DES_BASE (OMAP24XX_SEC_BASE + 0x2000)
84#define OMAP24XX_SEC_SHA1MD5_BASE (OMAP24XX_SEC_BASE + 0x4000)
85#define OMAP24XX_SEC_AES_BASE (OMAP24XX_SEC_BASE + 0x6000)
86#define OMAP24XX_SEC_PKA_BASE (OMAP24XX_SEC_BASE + 0x8000)
87
88#if defined(CONFIG_ARCH_OMAP2420)
89
90#define OMAP2_32KSYNCT_BASE OMAP2420_32KSYNCT_BASE
91#define OMAP2_PRCM_BASE OMAP2420_PRCM_BASE
92#define OMAP2_CM_BASE OMAP2420_CM_BASE
93#define OMAP2_PRM_BASE OMAP2420_PRM_BASE
94#define OMAP2_VA_IC_BASE IO_ADDRESS(OMAP24XX_IC_BASE)
95
96#elif defined(CONFIG_ARCH_OMAP2430)
97
98#define OMAP2_32KSYNCT_BASE OMAP2430_32KSYNCT_BASE
99#define OMAP2_PRCM_BASE OMAP2430_PRCM_BASE
100#define OMAP2_CM_BASE OMAP2430_CM_BASE
101#define OMAP2_PRM_BASE OMAP2430_PRM_BASE
102#define OMAP2_VA_IC_BASE IO_ADDRESS(OMAP24XX_IC_BASE)
103
104#endif
105
106#endif /* __ASM_ARCH_OMAP24XX_H */
107
diff --git a/arch/arm/plat-omap/include/mach/omap34xx.h b/arch/arm/plat-omap/include/mach/omap34xx.h
new file mode 100644
index 000000000000..8e0479fff05a
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/omap34xx.h
@@ -0,0 +1,72 @@
1/*
2 * arch/arm/plat-omap/include/mach/omap34xx.h
3 *
4 * This file contains the processor specific definitions of the TI OMAP34XX.
5 *
6 * Copyright (C) 2007 Texas Instruments.
7 * Copyright (C) 2007 Nokia Corporation.
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#ifndef __ASM_ARCH_OMAP34XX_H
25#define __ASM_ARCH_OMAP34XX_H
26
27/*
28 * Please place only base defines here and put the rest in device
29 * specific headers.
30 */
31
32#define L4_34XX_BASE 0x48000000
33#define L4_WK_34XX_BASE 0x48300000
34#define L4_WK_OMAP_BASE L4_WK_34XX_BASE
35#define L4_PER_34XX_BASE 0x49000000
36#define L4_PER_OMAP_BASE L4_PER_34XX_BASE
37#define L4_EMU_34XX_BASE 0x54000000
38#define L4_EMU_BASE L4_EMU_34XX_BASE
39#define L3_34XX_BASE 0x68000000
40#define L3_OMAP_BASE L3_34XX_BASE
41
42#define OMAP3430_32KSYNCT_BASE 0x48320000
43#define OMAP3430_CM_BASE 0x48004800
44#define OMAP3430_PRM_BASE 0x48306800
45#define OMAP343X_SMS_BASE 0x6C000000
46#define OMAP343X_SDRC_BASE 0x6D000000
47#define OMAP34XX_GPMC_BASE 0x6E000000
48#define OMAP343X_SCM_BASE 0x48002000
49#define OMAP343X_CTRL_BASE OMAP343X_SCM_BASE
50
51#define OMAP34XX_IC_BASE 0x48200000
52#define OMAP34XX_IVA_INTC_BASE 0x40000000
53#define OMAP34XX_HSUSB_OTG_BASE (L4_34XX_BASE + 0xAB000)
54#define OMAP34XX_HSUSB_HOST_BASE (L4_34XX_BASE + 0x64000)
55#define OMAP34XX_USBTLL_BASE (L4_34XX_BASE + 0x62000)
56
57
58#if defined(CONFIG_ARCH_OMAP3430)
59
60#define OMAP2_32KSYNCT_BASE OMAP3430_32KSYNCT_BASE
61#define OMAP2_CM_BASE OMAP3430_CM_BASE
62#define OMAP2_PRM_BASE OMAP3430_PRM_BASE
63#define OMAP2_VA_IC_BASE IO_ADDRESS(OMAP34XX_IC_BASE)
64
65#endif
66
67#define OMAP34XX_DSP_BASE 0x58000000
68#define OMAP34XX_DSP_MEM_BASE (OMAP34XX_DSP_BASE + 0x0)
69#define OMAP34XX_DSP_IPI_BASE (OMAP34XX_DSP_BASE + 0x1000000)
70#define OMAP34XX_DSP_MMU_BASE (OMAP34XX_DSP_BASE + 0x2000000)
71#endif /* __ASM_ARCH_OMAP34XX_H */
72
diff --git a/arch/arm/plat-omap/include/mach/omap730.h b/arch/arm/plat-omap/include/mach/omap730.h
new file mode 100644
index 000000000000..14272bc1a6fd
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/omap730.h
@@ -0,0 +1,102 @@
1/* arch/arm/plat-omap/include/mach/omap730.h
2 *
3 * Hardware definitions for TI OMAP730 processor.
4 *
5 * Cleanup for Linux-2.6 by Dirk Behme <dirk.behme@de.bosch.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#ifndef __ASM_ARCH_OMAP730_H
29#define __ASM_ARCH_OMAP730_H
30
31/*
32 * ----------------------------------------------------------------------------
33 * Base addresses
34 * ----------------------------------------------------------------------------
35 */
36
37/* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */
38
39#define OMAP730_DSP_BASE 0xE0000000
40#define OMAP730_DSP_SIZE 0x50000
41#define OMAP730_DSP_START 0xE0000000
42
43#define OMAP730_DSPREG_BASE 0xE1000000
44#define OMAP730_DSPREG_SIZE SZ_128K
45#define OMAP730_DSPREG_START 0xE1000000
46
47/*
48 * ----------------------------------------------------------------------------
49 * OMAP730 specific configuration registers
50 * ----------------------------------------------------------------------------
51 */
52#define OMAP730_CONFIG_BASE 0xfffe1000
53#define OMAP730_IO_CONF_0 0xfffe1070
54#define OMAP730_IO_CONF_1 0xfffe1074
55#define OMAP730_IO_CONF_2 0xfffe1078
56#define OMAP730_IO_CONF_3 0xfffe107c
57#define OMAP730_IO_CONF_4 0xfffe1080
58#define OMAP730_IO_CONF_5 0xfffe1084
59#define OMAP730_IO_CONF_6 0xfffe1088
60#define OMAP730_IO_CONF_7 0xfffe108c
61#define OMAP730_IO_CONF_8 0xfffe1090
62#define OMAP730_IO_CONF_9 0xfffe1094
63#define OMAP730_IO_CONF_10 0xfffe1098
64#define OMAP730_IO_CONF_11 0xfffe109c
65#define OMAP730_IO_CONF_12 0xfffe10a0
66#define OMAP730_IO_CONF_13 0xfffe10a4
67
68#define OMAP730_MODE_1 0xfffe1010
69#define OMAP730_MODE_2 0xfffe1014
70
71/* CSMI specials: in terms of base + offset */
72#define OMAP730_MODE2_OFFSET 0x14
73
74/*
75 * ----------------------------------------------------------------------------
76 * OMAP730 traffic controller configuration registers
77 * ----------------------------------------------------------------------------
78 */
79#define OMAP730_FLASH_CFG_0 0xfffecc10
80#define OMAP730_FLASH_ACFG_0 0xfffecc50
81#define OMAP730_FLASH_CFG_1 0xfffecc14
82#define OMAP730_FLASH_ACFG_1 0xfffecc54
83
84/*
85 * ----------------------------------------------------------------------------
86 * OMAP730 DSP control registers
87 * ----------------------------------------------------------------------------
88 */
89#define OMAP730_ICR_BASE 0xfffbb800
90#define OMAP730_DSP_M_CTL 0xfffbb804
91#define OMAP730_DSP_MMU_BASE 0xfffed200
92
93/*
94 * ----------------------------------------------------------------------------
95 * OMAP730 PCC_UPLD configuration registers
96 * ----------------------------------------------------------------------------
97 */
98#define OMAP730_PCC_UPLD_CTRL_BASE (0xfffe0900)
99#define OMAP730_PCC_UPLD_CTRL (OMAP730_PCC_UPLD_CTRL_BASE + 0x00)
100
101#endif /* __ASM_ARCH_OMAP730_H */
102
diff --git a/arch/arm/plat-omap/include/mach/omapfb.h b/arch/arm/plat-omap/include/mach/omapfb.h
new file mode 100644
index 000000000000..cae037d13079
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/omapfb.h
@@ -0,0 +1,395 @@
1/*
2 * File: arch/arm/plat-omap/include/mach/omapfb.h
3 *
4 * Framebuffer driver for TI OMAP boards
5 *
6 * Copyright (C) 2004 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#ifndef __OMAPFB_H
25#define __OMAPFB_H
26
27#include <asm/ioctl.h>
28#include <asm/types.h>
29
30/* IOCTL commands. */
31
32#define OMAP_IOW(num, dtype) _IOW('O', num, dtype)
33#define OMAP_IOR(num, dtype) _IOR('O', num, dtype)
34#define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype)
35#define OMAP_IO(num) _IO('O', num)
36
37#define OMAPFB_MIRROR OMAP_IOW(31, int)
38#define OMAPFB_SYNC_GFX OMAP_IO(37)
39#define OMAPFB_VSYNC OMAP_IO(38)
40#define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int)
41#define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps)
42#define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int)
43#define OMAPFB_LCD_TEST OMAP_IOW(45, int)
44#define OMAPFB_CTRL_TEST OMAP_IOW(46, int)
45#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
46#define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key)
47#define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key)
48#define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info)
49#define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info)
50#define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window)
51#define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info)
52#define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info)
53
54#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
55#define OMAPFB_CAPS_LCDC_MASK 0x00fff000
56#define OMAPFB_CAPS_PANEL_MASK 0xff000000
57
58#define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000
59#define OMAPFB_CAPS_TEARSYNC 0x00002000
60#define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000
61#define OMAPFB_CAPS_PLANE_SCALE 0x00008000
62#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000
63#define OMAPFB_CAPS_WINDOW_SCALE 0x00020000
64#define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000
65#define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000
66
67/* Values from DSP must map to lower 16-bits */
68#define OMAPFB_FORMAT_MASK 0x00ff
69#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
70#define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200
71#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400
72#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800
73#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000
74
75#define OMAPFB_EVENT_READY 1
76#define OMAPFB_EVENT_DISABLED 2
77
78#define OMAPFB_MEMTYPE_SDRAM 0
79#define OMAPFB_MEMTYPE_SRAM 1
80#define OMAPFB_MEMTYPE_MAX 1
81
82enum omapfb_color_format {
83 OMAPFB_COLOR_RGB565 = 0,
84 OMAPFB_COLOR_YUV422,
85 OMAPFB_COLOR_YUV420,
86 OMAPFB_COLOR_CLUT_8BPP,
87 OMAPFB_COLOR_CLUT_4BPP,
88 OMAPFB_COLOR_CLUT_2BPP,
89 OMAPFB_COLOR_CLUT_1BPP,
90 OMAPFB_COLOR_RGB444,
91 OMAPFB_COLOR_YUY422,
92};
93
94struct omapfb_update_window {
95 __u32 x, y;
96 __u32 width, height;
97 __u32 format;
98 __u32 out_x, out_y;
99 __u32 out_width, out_height;
100 __u32 reserved[8];
101};
102
103struct omapfb_update_window_old {
104 __u32 x, y;
105 __u32 width, height;
106 __u32 format;
107};
108
109enum omapfb_plane {
110 OMAPFB_PLANE_GFX = 0,
111 OMAPFB_PLANE_VID1,
112 OMAPFB_PLANE_VID2,
113};
114
115enum omapfb_channel_out {
116 OMAPFB_CHANNEL_OUT_LCD = 0,
117 OMAPFB_CHANNEL_OUT_DIGIT,
118};
119
120struct omapfb_plane_info {
121 __u32 pos_x;
122 __u32 pos_y;
123 __u8 enabled;
124 __u8 channel_out;
125 __u8 mirror;
126 __u8 reserved1;
127 __u32 out_width;
128 __u32 out_height;
129 __u32 reserved2[12];
130};
131
132struct omapfb_mem_info {
133 __u32 size;
134 __u8 type;
135 __u8 reserved[3];
136};
137
138struct omapfb_caps {
139 __u32 ctrl;
140 __u32 plane_color;
141 __u32 wnd_color;
142};
143
144enum omapfb_color_key_type {
145 OMAPFB_COLOR_KEY_DISABLED = 0,
146 OMAPFB_COLOR_KEY_GFX_DST,
147 OMAPFB_COLOR_KEY_VID_SRC,
148};
149
150struct omapfb_color_key {
151 __u8 channel_out;
152 __u32 background;
153 __u32 trans_key;
154 __u8 key_type;
155};
156
157enum omapfb_update_mode {
158 OMAPFB_UPDATE_DISABLED = 0,
159 OMAPFB_AUTO_UPDATE,
160 OMAPFB_MANUAL_UPDATE
161};
162
163#ifdef __KERNEL__
164
165#include <linux/completion.h>
166#include <linux/interrupt.h>
167#include <linux/fb.h>
168#include <linux/mutex.h>
169
170#include <mach/board.h>
171
172#define OMAP_LCDC_INV_VSYNC 0x0001
173#define OMAP_LCDC_INV_HSYNC 0x0002
174#define OMAP_LCDC_INV_PIX_CLOCK 0x0004
175#define OMAP_LCDC_INV_OUTPUT_EN 0x0008
176#define OMAP_LCDC_HSVS_RISING_EDGE 0x0010
177#define OMAP_LCDC_HSVS_OPPOSITE 0x0020
178
179#define OMAP_LCDC_SIGNAL_MASK 0x003f
180
181#define OMAP_LCDC_PANEL_TFT 0x0100
182
183#define OMAPFB_PLANE_XRES_MIN 8
184#define OMAPFB_PLANE_YRES_MIN 8
185
186#ifdef CONFIG_ARCH_OMAP1
187#define OMAPFB_PLANE_NUM 1
188#else
189#define OMAPFB_PLANE_NUM 3
190#endif
191
192struct omapfb_device;
193
194struct lcd_panel {
195 const char *name;
196 int config; /* TFT/STN, signal inversion */
197 int bpp; /* Pixel format in fb mem */
198 int data_lines; /* Lines on LCD HW interface */
199
200 int x_res, y_res;
201 int pixel_clock; /* In kHz */
202 int hsw; /* Horizontal synchronization
203 pulse width */
204 int hfp; /* Horizontal front porch */
205 int hbp; /* Horizontal back porch */
206 int vsw; /* Vertical synchronization
207 pulse width */
208 int vfp; /* Vertical front porch */
209 int vbp; /* Vertical back porch */
210 int acb; /* ac-bias pin frequency */
211 int pcd; /* pixel clock divider.
212 Obsolete use pixel_clock instead */
213
214 int (*init) (struct lcd_panel *panel,
215 struct omapfb_device *fbdev);
216 void (*cleanup) (struct lcd_panel *panel);
217 int (*enable) (struct lcd_panel *panel);
218 void (*disable) (struct lcd_panel *panel);
219 unsigned long (*get_caps) (struct lcd_panel *panel);
220 int (*set_bklight_level)(struct lcd_panel *panel,
221 unsigned int level);
222 unsigned int (*get_bklight_level)(struct lcd_panel *panel);
223 unsigned int (*get_bklight_max) (struct lcd_panel *panel);
224 int (*run_test) (struct lcd_panel *panel, int test_num);
225};
226
227struct extif_timings {
228 int cs_on_time;
229 int cs_off_time;
230 int we_on_time;
231 int we_off_time;
232 int re_on_time;
233 int re_off_time;
234 int we_cycle_time;
235 int re_cycle_time;
236 int cs_pulse_width;
237 int access_time;
238
239 int clk_div;
240
241 u32 tim[5]; /* set by extif->convert_timings */
242
243 int converted;
244};
245
246struct lcd_ctrl_extif {
247 int (*init) (struct omapfb_device *fbdev);
248 void (*cleanup) (void);
249 void (*get_clk_info) (u32 *clk_period, u32 *max_clk_div);
250 unsigned long (*get_max_tx_rate)(void);
251 int (*convert_timings) (struct extif_timings *timings);
252 void (*set_timings) (const struct extif_timings *timings);
253 void (*set_bits_per_cycle)(int bpc);
254 void (*write_command) (const void *buf, unsigned int len);
255 void (*read_data) (void *buf, unsigned int len);
256 void (*write_data) (const void *buf, unsigned int len);
257 void (*transfer_area) (int width, int height,
258 void (callback)(void * data), void *data);
259 int (*setup_tearsync) (unsigned pin_cnt,
260 unsigned hs_pulse_time, unsigned vs_pulse_time,
261 int hs_pol_inv, int vs_pol_inv, int div);
262 int (*enable_tearsync) (int enable, unsigned line);
263
264 unsigned long max_transmit_size;
265};
266
267struct omapfb_notifier_block {
268 struct notifier_block nb;
269 void *data;
270 int plane_idx;
271};
272
273typedef int (*omapfb_notifier_callback_t)(struct notifier_block *,
274 unsigned long event,
275 void *fbi);
276
277struct omapfb_mem_region {
278 dma_addr_t paddr;
279 void *vaddr;
280 unsigned long size;
281 u8 type; /* OMAPFB_PLANE_MEM_* */
282 unsigned alloc:1; /* allocated by the driver */
283 unsigned map:1; /* kernel mapped by the driver */
284};
285
286struct omapfb_mem_desc {
287 int region_cnt;
288 struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
289};
290
291struct lcd_ctrl {
292 const char *name;
293 void *data;
294
295 int (*init) (struct omapfb_device *fbdev,
296 int ext_mode,
297 struct omapfb_mem_desc *req_md);
298 void (*cleanup) (void);
299 void (*bind_client) (struct omapfb_notifier_block *nb);
300 void (*get_caps) (int plane, struct omapfb_caps *caps);
301 int (*set_update_mode)(enum omapfb_update_mode mode);
302 enum omapfb_update_mode (*get_update_mode)(void);
303 int (*setup_plane) (int plane, int channel_out,
304 unsigned long offset,
305 int screen_width,
306 int pos_x, int pos_y, int width,
307 int height, int color_mode);
308 int (*setup_mem) (int plane, size_t size,
309 int mem_type, unsigned long *paddr);
310 int (*mmap) (struct fb_info *info,
311 struct vm_area_struct *vma);
312 int (*set_scale) (int plane,
313 int orig_width, int orig_height,
314 int out_width, int out_height);
315 int (*enable_plane) (int plane, int enable);
316 int (*update_window) (struct fb_info *fbi,
317 struct omapfb_update_window *win,
318 void (*callback)(void *),
319 void *callback_data);
320 void (*sync) (void);
321 void (*suspend) (void);
322 void (*resume) (void);
323 int (*run_test) (int test_num);
324 int (*setcolreg) (u_int regno, u16 red, u16 green,
325 u16 blue, u16 transp,
326 int update_hw_mem);
327 int (*set_color_key) (struct omapfb_color_key *ck);
328 int (*get_color_key) (struct omapfb_color_key *ck);
329};
330
331enum omapfb_state {
332 OMAPFB_DISABLED = 0,
333 OMAPFB_SUSPENDED= 99,
334 OMAPFB_ACTIVE = 100
335};
336
337struct omapfb_plane_struct {
338 int idx;
339 struct omapfb_plane_info info;
340 enum omapfb_color_format color_mode;
341 struct omapfb_device *fbdev;
342};
343
344struct omapfb_device {
345 int state;
346 int ext_lcdc; /* Using external
347 LCD controller */
348 struct mutex rqueue_mutex;
349
350 int palette_size;
351 u32 pseudo_palette[17];
352
353 struct lcd_panel *panel; /* LCD panel */
354 struct lcd_ctrl *ctrl; /* LCD controller */
355 struct lcd_ctrl *int_ctrl; /* internal LCD ctrl */
356 struct lcd_ctrl_extif *ext_if; /* LCD ctrl external
357 interface */
358 struct device *dev;
359 struct fb_var_screeninfo new_var; /* for mode changes */
360
361 struct omapfb_mem_desc mem_desc;
362 struct fb_info *fb_info[OMAPFB_PLANE_NUM];
363};
364
365struct omapfb_platform_data {
366 struct omap_lcd_config lcd;
367 struct omapfb_mem_desc mem_desc;
368 void *ctrl_platform_data;
369};
370
371#ifdef CONFIG_ARCH_OMAP1
372extern struct lcd_ctrl omap1_lcd_ctrl;
373#else
374extern struct lcd_ctrl omap2_disp_ctrl;
375#endif
376
377extern void omapfb_register_panel(struct lcd_panel *panel);
378extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval);
379extern void omapfb_notify_clients(struct omapfb_device *fbdev,
380 unsigned long event);
381extern int omapfb_register_client(struct omapfb_notifier_block *nb,
382 omapfb_notifier_callback_t callback,
383 void *callback_data);
384extern int omapfb_unregister_client(struct omapfb_notifier_block *nb);
385extern int omapfb_update_window_async(struct fb_info *fbi,
386 struct omapfb_update_window *win,
387 void (*callback)(void *),
388 void *callback_data);
389
390/* in arch/arm/plat-omap/fb.c */
391extern void omapfb_set_ctrl_platform_data(void *pdata);
392
393#endif /* __KERNEL__ */
394
395#endif /* __OMAPFB_H */
diff --git a/arch/arm/plat-omap/include/mach/onenand.h b/arch/arm/plat-omap/include/mach/onenand.h
new file mode 100644
index 000000000000..d57f20226b28
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/onenand.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/plat-omap/include/mach/onenand.h
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 * Author: Juha Yrjola
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#include <linux/mtd/partitions.h>
13
14struct omap_onenand_platform_data {
15 int cs;
16 int gpio_irq;
17 struct mtd_partition *parts;
18 int nr_parts;
19 int (*onenand_setup)(void __iomem *);
20 int dma_channel;
21};
diff --git a/arch/arm/plat-omap/include/mach/param.h b/arch/arm/plat-omap/include/mach/param.h
new file mode 100644
index 000000000000..1eb4dc326979
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/param.h
@@ -0,0 +1,8 @@
1/*
2 * arch/arm/plat-omap/include/mach/param.h
3 *
4 */
5
6#ifdef CONFIG_OMAP_32K_TIMER_HZ
7#define HZ CONFIG_OMAP_32K_TIMER_HZ
8#endif
diff --git a/arch/arm/plat-omap/include/mach/pm.h b/arch/arm/plat-omap/include/mach/pm.h
new file mode 100644
index 000000000000..bfa09325a5ff
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/pm.h
@@ -0,0 +1,356 @@
1/*
2 * arch/arm/plat-omap/include/mach/pm.h
3 *
4 * Header file for OMAP Power Management Routines
5 *
6 * Author: MontaVista Software, Inc.
7 * support@mvista.com
8 *
9 * Copyright 2002 MontaVista Software Inc.
10 *
11 * Cleanup 2004 for Linux 2.6 by Dirk Behme <dirk.behme@de.bosch.com>
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
21 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */
33
34#ifndef __ASM_ARCH_OMAP_PM_H
35#define __ASM_ARCH_OMAP_PM_H
36
37/*
38 * ----------------------------------------------------------------------------
39 * Register and offset definitions to be used in PM assembler code
40 * ----------------------------------------------------------------------------
41 */
42#define CLKGEN_REG_ASM_BASE io_p2v(0xfffece00)
43#define ARM_IDLECT1_ASM_OFFSET 0x04
44#define ARM_IDLECT2_ASM_OFFSET 0x08
45
46#define TCMIF_ASM_BASE io_p2v(0xfffecc00)
47#define EMIFS_CONFIG_ASM_OFFSET 0x0c
48#define EMIFF_SDRAM_CONFIG_ASM_OFFSET 0x20
49
50/*
51 * ----------------------------------------------------------------------------
52 * Power management bitmasks
53 * ----------------------------------------------------------------------------
54 */
55#define IDLE_WAIT_CYCLES 0x00000fff
56#define PERIPHERAL_ENABLE 0x2
57
58#define SELF_REFRESH_MODE 0x0c000001
59#define IDLE_EMIFS_REQUEST 0xc
60#define MODEM_32K_EN 0x1
61#define PER_EN 0x1
62
63#define CPU_SUSPEND_SIZE 200
64#define ULPD_LOW_PWR_EN 0x0001
65#define ULPD_DEEP_SLEEP_TRANSITION_EN 0x0010
66#define ULPD_SETUP_ANALOG_CELL_3_VAL 0
67#define ULPD_POWER_CTRL_REG_VAL 0x0219
68
69#define DSP_IDLE_DELAY 10
70#define DSP_IDLE 0x0040
71#define DSP_RST 0x0004
72#define DSP_ENABLE 0x0002
73#define SUFFICIENT_DSP_RESET_TIME 1000
74#define DEFAULT_MPUI_CONFIG 0x05cf
75#define ENABLE_XORCLK 0x2
76#define DSP_CLOCK_ENABLE 0x2000
77#define DSP_IDLE_MODE 0x2
78#define TC_IDLE_REQUEST (0x0000000c)
79
80#define IRQ_LEVEL2 (1<<0)
81#define IRQ_KEYBOARD (1<<1)
82#define IRQ_UART2 (1<<15)
83
84#define PDE_BIT 0x08
85#define PWD_EN_BIT 0x04
86#define EN_PERCK_BIT 0x04
87
88#define OMAP1510_DEEP_SLEEP_REQUEST 0x0ec7
89#define OMAP1510_BIG_SLEEP_REQUEST 0x0cc5
90#define OMAP1510_IDLE_LOOP_REQUEST 0x0c00
91#define OMAP1510_IDLE_CLOCK_DOMAINS 0x2
92
93/* Both big sleep and deep sleep use same values. Difference is in ULPD. */
94#define OMAP1610_IDLECT1_SLEEP_VAL 0x13c7
95#define OMAP1610_IDLECT2_SLEEP_VAL 0x09c7
96#define OMAP1610_IDLECT3_VAL 0x3f
97#define OMAP1610_IDLECT3_SLEEP_ORMASK 0x2c
98#define OMAP1610_IDLECT3 0xfffece24
99#define OMAP1610_IDLE_LOOP_REQUEST 0x0400
100
101#define OMAP730_IDLECT1_SLEEP_VAL 0x16c7
102#define OMAP730_IDLECT2_SLEEP_VAL 0x09c7
103#define OMAP730_IDLECT3_VAL 0x3f
104#define OMAP730_IDLECT3 0xfffece24
105#define OMAP730_IDLE_LOOP_REQUEST 0x0C00
106
107#if !defined(CONFIG_ARCH_OMAP730) && \
108 !defined(CONFIG_ARCH_OMAP15XX) && \
109 !defined(CONFIG_ARCH_OMAP16XX) && \
110 !defined(CONFIG_ARCH_OMAP24XX)
111#error "Power management for this processor not implemented yet"
112#endif
113
114#ifndef __ASSEMBLER__
115
116#include <linux/clk.h>
117
118extern void prevent_idle_sleep(void);
119extern void allow_idle_sleep(void);
120
121/**
122 * clk_deny_idle - Prevents the clock from being idled during MPU idle
123 * @clk: clock signal handle
124 */
125void clk_deny_idle(struct clk *clk);
126
127/**
128 * clk_allow_idle - Counters previous clk_deny_idle
129 * @clk: clock signal handle
130 */
131void clk_deny_idle(struct clk *clk);
132
133extern void omap_pm_idle(void);
134extern void omap_pm_suspend(void);
135extern void omap730_cpu_suspend(unsigned short, unsigned short);
136extern void omap1510_cpu_suspend(unsigned short, unsigned short);
137extern void omap1610_cpu_suspend(unsigned short, unsigned short);
138extern void omap24xx_cpu_suspend(u32 dll_ctrl, u32 cpu_revision);
139extern void omap730_idle_loop_suspend(void);
140extern void omap1510_idle_loop_suspend(void);
141extern void omap1610_idle_loop_suspend(void);
142extern void omap24xx_idle_loop_suspend(void);
143
144extern unsigned int omap730_cpu_suspend_sz;
145extern unsigned int omap1510_cpu_suspend_sz;
146extern unsigned int omap1610_cpu_suspend_sz;
147extern unsigned int omap24xx_cpu_suspend_sz;
148extern unsigned int omap730_idle_loop_suspend_sz;
149extern unsigned int omap1510_idle_loop_suspend_sz;
150extern unsigned int omap1610_idle_loop_suspend_sz;
151extern unsigned int omap24xx_idle_loop_suspend_sz;
152
153#ifdef CONFIG_OMAP_SERIAL_WAKE
154extern void omap_serial_wake_trigger(int enable);
155#else
156#define omap_serial_wakeup_init() {}
157#define omap_serial_wake_trigger(x) {}
158#endif /* CONFIG_OMAP_SERIAL_WAKE */
159
160#define ARM_SAVE(x) arm_sleep_save[ARM_SLEEP_SAVE_##x] = omap_readl(x)
161#define ARM_RESTORE(x) omap_writel((arm_sleep_save[ARM_SLEEP_SAVE_##x]), (x))
162#define ARM_SHOW(x) arm_sleep_save[ARM_SLEEP_SAVE_##x]
163
164#define DSP_SAVE(x) dsp_sleep_save[DSP_SLEEP_SAVE_##x] = __raw_readw(x)
165#define DSP_RESTORE(x) __raw_writew((dsp_sleep_save[DSP_SLEEP_SAVE_##x]), (x))
166#define DSP_SHOW(x) dsp_sleep_save[DSP_SLEEP_SAVE_##x]
167
168#define ULPD_SAVE(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x] = omap_readw(x)
169#define ULPD_RESTORE(x) omap_writew((ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]), (x))
170#define ULPD_SHOW(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]
171
172#define MPUI730_SAVE(x) mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x] = omap_readl(x)
173#define MPUI730_RESTORE(x) omap_writel((mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x]), (x))
174#define MPUI730_SHOW(x) mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x]
175
176#define MPUI1510_SAVE(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x] = omap_readl(x)
177#define MPUI1510_RESTORE(x) omap_writel((mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x]), (x))
178#define MPUI1510_SHOW(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x]
179
180#define MPUI1610_SAVE(x) mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x] = omap_readl(x)
181#define MPUI1610_RESTORE(x) omap_writel((mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x]), (x))
182#define MPUI1610_SHOW(x) mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x]
183
184#define OMAP24XX_SAVE(x) omap24xx_sleep_save[OMAP24XX_SLEEP_SAVE_##x] = x
185#define OMAP24XX_RESTORE(x) x = omap24xx_sleep_save[OMAP24XX_SLEEP_SAVE_##x]
186#define OMAP24XX_SHOW(x) omap24xx_sleep_save[OMAP24XX_SLEEP_SAVE_##x]
187
188/*
189 * List of global OMAP registers to preserve.
190 * More ones like CP and general purpose register values are preserved
191 * with the stack pointer in sleep.S.
192 */
193
194enum arm_save_state {
195 ARM_SLEEP_SAVE_START = 0,
196 /*
197 * MPU control registers 32 bits
198 */
199 ARM_SLEEP_SAVE_ARM_CKCTL,
200 ARM_SLEEP_SAVE_ARM_IDLECT1,
201 ARM_SLEEP_SAVE_ARM_IDLECT2,
202 ARM_SLEEP_SAVE_ARM_IDLECT3,
203 ARM_SLEEP_SAVE_ARM_EWUPCT,
204 ARM_SLEEP_SAVE_ARM_RSTCT1,
205 ARM_SLEEP_SAVE_ARM_RSTCT2,
206 ARM_SLEEP_SAVE_ARM_SYSST,
207 ARM_SLEEP_SAVE_SIZE
208};
209
210enum dsp_save_state {
211 DSP_SLEEP_SAVE_START = 0,
212 /*
213 * DSP registers 16 bits
214 */
215 DSP_SLEEP_SAVE_DSP_IDLECT2,
216 DSP_SLEEP_SAVE_SIZE
217};
218
219enum ulpd_save_state {
220 ULPD_SLEEP_SAVE_START = 0,
221 /*
222 * ULPD registers 16 bits
223 */
224 ULPD_SLEEP_SAVE_ULPD_IT_STATUS,
225 ULPD_SLEEP_SAVE_ULPD_CLOCK_CTRL,
226 ULPD_SLEEP_SAVE_ULPD_SOFT_REQ,
227 ULPD_SLEEP_SAVE_ULPD_STATUS_REQ,
228 ULPD_SLEEP_SAVE_ULPD_DPLL_CTRL,
229 ULPD_SLEEP_SAVE_ULPD_POWER_CTRL,
230 ULPD_SLEEP_SAVE_SIZE
231};
232
233enum mpui1510_save_state {
234 MPUI1510_SLEEP_SAVE_START = 0,
235 /*
236 * MPUI registers 32 bits
237 */
238 MPUI1510_SLEEP_SAVE_MPUI_CTRL,
239 MPUI1510_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG,
240 MPUI1510_SLEEP_SAVE_MPUI_DSP_API_CONFIG,
241 MPUI1510_SLEEP_SAVE_MPUI_DSP_STATUS,
242 MPUI1510_SLEEP_SAVE_EMIFF_SDRAM_CONFIG,
243 MPUI1510_SLEEP_SAVE_EMIFS_CONFIG,
244 MPUI1510_SLEEP_SAVE_OMAP_IH1_MIR,
245 MPUI1510_SLEEP_SAVE_OMAP_IH2_MIR,
246#if defined(CONFIG_ARCH_OMAP15XX)
247 MPUI1510_SLEEP_SAVE_SIZE
248#else
249 MPUI1510_SLEEP_SAVE_SIZE = 0
250#endif
251};
252
253enum mpui730_save_state {
254 MPUI730_SLEEP_SAVE_START = 0,
255 /*
256 * MPUI registers 32 bits
257 */
258 MPUI730_SLEEP_SAVE_MPUI_CTRL,
259 MPUI730_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG,
260 MPUI730_SLEEP_SAVE_MPUI_DSP_API_CONFIG,
261 MPUI730_SLEEP_SAVE_MPUI_DSP_STATUS,
262 MPUI730_SLEEP_SAVE_EMIFF_SDRAM_CONFIG,
263 MPUI730_SLEEP_SAVE_EMIFS_CONFIG,
264 MPUI730_SLEEP_SAVE_OMAP_IH1_MIR,
265 MPUI730_SLEEP_SAVE_OMAP_IH2_0_MIR,
266 MPUI730_SLEEP_SAVE_OMAP_IH2_1_MIR,
267#if defined(CONFIG_ARCH_OMAP730)
268 MPUI730_SLEEP_SAVE_SIZE
269#else
270 MPUI730_SLEEP_SAVE_SIZE = 0
271#endif
272};
273
274enum mpui1610_save_state {
275 MPUI1610_SLEEP_SAVE_START = 0,
276 /*
277 * MPUI registers 32 bits
278 */
279 MPUI1610_SLEEP_SAVE_MPUI_CTRL,
280 MPUI1610_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG,
281 MPUI1610_SLEEP_SAVE_MPUI_DSP_API_CONFIG,
282 MPUI1610_SLEEP_SAVE_MPUI_DSP_STATUS,
283 MPUI1610_SLEEP_SAVE_EMIFF_SDRAM_CONFIG,
284 MPUI1610_SLEEP_SAVE_EMIFS_CONFIG,
285 MPUI1610_SLEEP_SAVE_OMAP_IH1_MIR,
286 MPUI1610_SLEEP_SAVE_OMAP_IH2_0_MIR,
287 MPUI1610_SLEEP_SAVE_OMAP_IH2_1_MIR,
288 MPUI1610_SLEEP_SAVE_OMAP_IH2_2_MIR,
289 MPUI1610_SLEEP_SAVE_OMAP_IH2_3_MIR,
290#if defined(CONFIG_ARCH_OMAP16XX)
291 MPUI1610_SLEEP_SAVE_SIZE
292#else
293 MPUI1610_SLEEP_SAVE_SIZE = 0
294#endif
295};
296
297enum omap24xx_save_state {
298 OMAP24XX_SLEEP_SAVE_START = 0,
299 OMAP24XX_SLEEP_SAVE_INTC_MIR0,
300 OMAP24XX_SLEEP_SAVE_INTC_MIR1,
301 OMAP24XX_SLEEP_SAVE_INTC_MIR2,
302
303 OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_MPU,
304 OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_CORE,
305 OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_GFX,
306 OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_DSP,
307 OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_MDM,
308
309 OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_MPU,
310 OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_CORE,
311 OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_GFX,
312 OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_DSP,
313 OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_MDM,
314
315 OMAP24XX_SLEEP_SAVE_CM_IDLEST1_CORE,
316 OMAP24XX_SLEEP_SAVE_CM_IDLEST2_CORE,
317 OMAP24XX_SLEEP_SAVE_CM_IDLEST3_CORE,
318 OMAP24XX_SLEEP_SAVE_CM_IDLEST4_CORE,
319 OMAP24XX_SLEEP_SAVE_CM_IDLEST_GFX,
320 OMAP24XX_SLEEP_SAVE_CM_IDLEST_WKUP,
321 OMAP24XX_SLEEP_SAVE_CM_IDLEST_CKGEN,
322 OMAP24XX_SLEEP_SAVE_CM_IDLEST_DSP,
323 OMAP24XX_SLEEP_SAVE_CM_IDLEST_MDM,
324
325 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE1_CORE,
326 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE2_CORE,
327 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE3_CORE,
328 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE4_CORE,
329 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_WKUP,
330 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_PLL,
331 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_DSP,
332 OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_MDM,
333
334 OMAP24XX_SLEEP_SAVE_CM_FCLKEN1_CORE,
335 OMAP24XX_SLEEP_SAVE_CM_FCLKEN2_CORE,
336 OMAP24XX_SLEEP_SAVE_CM_ICLKEN1_CORE,
337 OMAP24XX_SLEEP_SAVE_CM_ICLKEN2_CORE,
338 OMAP24XX_SLEEP_SAVE_CM_ICLKEN3_CORE,
339 OMAP24XX_SLEEP_SAVE_CM_ICLKEN4_CORE,
340 OMAP24XX_SLEEP_SAVE_GPIO1_IRQENABLE1,
341 OMAP24XX_SLEEP_SAVE_GPIO2_IRQENABLE1,
342 OMAP24XX_SLEEP_SAVE_GPIO3_IRQENABLE1,
343 OMAP24XX_SLEEP_SAVE_GPIO4_IRQENABLE1,
344 OMAP24XX_SLEEP_SAVE_GPIO3_OE,
345 OMAP24XX_SLEEP_SAVE_GPIO4_OE,
346 OMAP24XX_SLEEP_SAVE_GPIO3_RISINGDETECT,
347 OMAP24XX_SLEEP_SAVE_GPIO3_FALLINGDETECT,
348 OMAP24XX_SLEEP_SAVE_CONTROL_PADCONF_SPI1_NCS2,
349 OMAP24XX_SLEEP_SAVE_CONTROL_PADCONF_MCBSP1_DX,
350 OMAP24XX_SLEEP_SAVE_CONTROL_PADCONF_SSI1_FLAG_TX,
351 OMAP24XX_SLEEP_SAVE_CONTROL_PADCONF_SYS_NIRQW0,
352 OMAP24XX_SLEEP_SAVE_SIZE
353};
354
355#endif /* ASSEMBLER */
356#endif /* __ASM_ARCH_OMAP_PM_H */
diff --git a/arch/arm/plat-omap/include/mach/prcm.h b/arch/arm/plat-omap/include/mach/prcm.h
new file mode 100644
index 000000000000..56eba0fd6f6a
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/prcm.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/plat-omap/include/mach/prcm.h
3 *
4 * Access definations for use in OMAP24XX clock and power management
5 *
6 * Copyright (C) 2005 Texas Instruments, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __ASM_ARM_ARCH_DPM_PRCM_H
24#define __ASM_ARM_ARCH_DPM_PRCM_H
25
26u32 omap_prcm_get_reset_sources(void);
27
28#endif
29
30
31
32
33
diff --git a/arch/arm/plat-omap/include/mach/sdrc.h b/arch/arm/plat-omap/include/mach/sdrc.h
new file mode 100644
index 000000000000..787b7acec546
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/sdrc.h
@@ -0,0 +1,75 @@
1#ifndef ____ASM_ARCH_SDRC_H
2#define ____ASM_ARCH_SDRC_H
3
4/*
5 * OMAP2/3 SDRC/SMS register definitions
6 *
7 * Copyright (C) 2007 Texas Instruments, Inc.
8 * Copyright (C) 2007 Nokia Corporation
9 *
10 * Written by Paul Walmsley
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <mach/io.h>
18
19/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
20
21#define SDRC_SYSCONFIG 0x010
22#define SDRC_DLLA_CTRL 0x060
23#define SDRC_DLLA_STATUS 0x064
24#define SDRC_DLLB_CTRL 0x068
25#define SDRC_DLLB_STATUS 0x06C
26#define SDRC_POWER 0x070
27#define SDRC_MR_0 0x084
28#define SDRC_RFR_CTRL_0 0x0a4
29
30/*
31 * These values represent the number of memory clock cycles between
32 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192
33 * rows per device, and include a subtraction of a 50 cycle window in the
34 * event that the autorefresh command is delayed due to other SDRC activity.
35 * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
36 * counter reaches 0.
37 *
38 * These represent optimal values for common parts, it won't work for all.
39 * As long as you scale down, most parameters are still work, they just
40 * become sub-optimal. The RFR value goes in the opposite direction. If you
41 * don't adjust it down as your clock period increases the refresh interval
42 * will not be met. Setting all parameters for complete worst case may work,
43 * but may cut memory performance by 2x. Due to errata the DLLs need to be
44 * unlocked and their value needs run time calibration. A dynamic call is
45 * need for that as no single right value exists acorss production samples.
46 *
47 * Only the FULL speed values are given. Current code is such that rate
48 * changes must be made at DPLLoutx2. The actual value adjustment for low
49 * frequency operation will be handled by omap_set_performance()
50 *
51 * By having the boot loader boot up in the fastest L4 speed available likely
52 * will result in something which you can switch between.
53 */
54#define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1)
55#define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1)
56#define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1)
57#define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */
58#define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */
59
60
61/*
62 * SMS register access
63 */
64
65
66#define OMAP242X_SMS_REGADDR(reg) (void __iomem *)IO_ADDRESS(OMAP2420_SMS_BASE + reg)
67#define OMAP243X_SMS_REGADDR(reg) (void __iomem *)IO_ADDRESS(OMAP243X_SMS_BASE + reg)
68#define OMAP343X_SMS_REGADDR(reg) (void __iomem *)IO_ADDRESS(OMAP343X_SMS_BASE + reg)
69
70/* SMS register offsets - read/write with sms_{read,write}_reg() */
71
72#define SMS_SYSCONFIG 0x010
73/* REVISIT: fill in other SMS registers here */
74
75#endif
diff --git a/arch/arm/plat-omap/include/mach/serial.h b/arch/arm/plat-omap/include/mach/serial.h
new file mode 100644
index 000000000000..cc6bfa51ccb5
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/serial.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/plat-omap/include/mach/serial.h
3 *
4 * This program is distributed in the hope that it will be useful,
5 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 * GNU General Public License for more details.
8 */
9
10#ifndef __ASM_ARCH_SERIAL_H
11#define __ASM_ARCH_SERIAL_H
12
13#if defined(CONFIG_ARCH_OMAP1)
14/* OMAP1 serial ports */
15#define OMAP_UART1_BASE 0xfffb0000
16#define OMAP_UART2_BASE 0xfffb0800
17#define OMAP_UART3_BASE 0xfffb9800
18#elif defined(CONFIG_ARCH_OMAP2)
19/* OMAP2 serial ports */
20#define OMAP_UART1_BASE 0x4806a000
21#define OMAP_UART2_BASE 0x4806c000
22#define OMAP_UART3_BASE 0x4806e000
23#endif
24
25#define OMAP_MAX_NR_PORTS 3
26#define OMAP1510_BASE_BAUD (12000000/16)
27#define OMAP16XX_BASE_BAUD (48000000/16)
28
29#define is_omap_port(p) ({int __ret = 0; \
30 if (p == IO_ADDRESS(OMAP_UART1_BASE) || \
31 p == IO_ADDRESS(OMAP_UART2_BASE) || \
32 p == IO_ADDRESS(OMAP_UART3_BASE)) \
33 __ret = 1; \
34 __ret; \
35 })
36
37#endif
diff --git a/arch/arm/plat-omap/include/mach/sram.h b/arch/arm/plat-omap/include/mach/sram.h
new file mode 100644
index 000000000000..e09323449981
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/sram.h
@@ -0,0 +1,56 @@
1/*
2 * arch/arm/plat-omap/include/mach/sram.h
3 *
4 * Interface for functions that need to be run in internal SRAM
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 __ARCH_ARM_OMAP_SRAM_H
12#define __ARCH_ARM_OMAP_SRAM_H
13
14extern int __init omap_sram_init(void);
15extern void * omap_sram_push(void * start, unsigned long size);
16extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
17
18extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
19 u32 base_cs, u32 force_unlock);
20extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
21 u32 mem_type);
22extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
23
24/* Do not use these */
25extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
26extern unsigned long omap1_sram_reprogram_clock_sz;
27
28extern void omap24xx_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
29extern unsigned long omap24xx_sram_reprogram_clock_sz;
30
31extern void omap242x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
32 u32 base_cs, u32 force_unlock);
33extern unsigned long omap242x_sram_ddr_init_sz;
34
35extern u32 omap242x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
36 int bypass);
37extern unsigned long omap242x_sram_set_prcm_sz;
38
39extern void omap242x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
40 u32 mem_type);
41extern unsigned long omap242x_sram_reprogram_sdrc_sz;
42
43
44extern void omap243x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
45 u32 base_cs, u32 force_unlock);
46extern unsigned long omap243x_sram_ddr_init_sz;
47
48extern u32 omap243x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
49 int bypass);
50extern unsigned long omap243x_sram_set_prcm_sz;
51
52extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
53 u32 mem_type);
54extern unsigned long omap243x_sram_reprogram_sdrc_sz;
55
56#endif
diff --git a/arch/arm/plat-omap/include/mach/system.h b/arch/arm/plat-omap/include/mach/system.h
new file mode 100644
index 000000000000..06a28c7b98de
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/system.h
@@ -0,0 +1,49 @@
1/*
2 * Copied from arch/arm/mach-sa1100/include/mach/system.h
3 * Copyright (c) 1999 Nicolas Pitre <nico@cam.org>
4 */
5#ifndef __ASM_ARCH_SYSTEM_H
6#define __ASM_ARCH_SYSTEM_H
7#include <linux/clk.h>
8
9#include <asm/mach-types.h>
10#include <mach/hardware.h>
11
12#ifndef CONFIG_MACH_VOICEBLUE
13#define voiceblue_reset() do {} while (0)
14#endif
15
16extern void omap_prcm_arch_reset(char mode);
17
18static inline void arch_idle(void)
19{
20 cpu_do_idle();
21}
22
23static inline void omap1_arch_reset(char mode)
24{
25 /*
26 * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28
27 * "Global Software Reset Affects Traffic Controller Frequency".
28 */
29 if (cpu_is_omap5912()) {
30 omap_writew(omap_readw(DPLL_CTL) & ~(1 << 4),
31 DPLL_CTL);
32 omap_writew(0x8, ARM_RSTCT1);
33 }
34
35 if (machine_is_voiceblue())
36 voiceblue_reset();
37 else
38 omap_writew(1, ARM_RSTCT1);
39}
40
41static inline void arch_reset(char mode)
42{
43 if (!cpu_is_omap24xx())
44 omap1_arch_reset(mode);
45 else
46 omap_prcm_arch_reset(mode);
47}
48
49#endif
diff --git a/arch/arm/plat-omap/include/mach/tc.h b/arch/arm/plat-omap/include/mach/tc.h
new file mode 100644
index 000000000000..d2fcd789bb9a
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/tc.h
@@ -0,0 +1,106 @@
1/*
2 * arch/arm/plat-omap/include/mach/tc.h
3 *
4 * OMAP Traffic Controller
5 *
6 * Copyright (C) 2004 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#ifndef __ASM_ARCH_TC_H
25#define __ASM_ARCH_TC_H
26
27#define TCMIF_BASE 0xfffecc00
28#define OMAP_TC_OCPT1_PRIOR (TCMIF_BASE + 0x00)
29#define OMAP_TC_EMIFS_PRIOR (TCMIF_BASE + 0x04)
30#define OMAP_TC_EMIFF_PRIOR (TCMIF_BASE + 0x08)
31#define EMIFS_CONFIG (TCMIF_BASE + 0x0c)
32#define EMIFS_CS0_CONFIG (TCMIF_BASE + 0x10)
33#define EMIFS_CS1_CONFIG (TCMIF_BASE + 0x14)
34#define EMIFS_CS2_CONFIG (TCMIF_BASE + 0x18)
35#define EMIFS_CS3_CONFIG (TCMIF_BASE + 0x1c)
36#define EMIFF_SDRAM_CONFIG (TCMIF_BASE + 0x20)
37#define EMIFF_MRS (TCMIF_BASE + 0x24)
38#define TC_TIMEOUT1 (TCMIF_BASE + 0x28)
39#define TC_TIMEOUT2 (TCMIF_BASE + 0x2c)
40#define TC_TIMEOUT3 (TCMIF_BASE + 0x30)
41#define TC_ENDIANISM (TCMIF_BASE + 0x34)
42#define EMIFF_SDRAM_CONFIG_2 (TCMIF_BASE + 0x3c)
43#define EMIF_CFG_DYNAMIC_WS (TCMIF_BASE + 0x40)
44#define EMIFS_ACS0 (TCMIF_BASE + 0x50)
45#define EMIFS_ACS1 (TCMIF_BASE + 0x54)
46#define EMIFS_ACS2 (TCMIF_BASE + 0x58)
47#define EMIFS_ACS3 (TCMIF_BASE + 0x5c)
48#define OMAP_TC_OCPT2_PRIOR (TCMIF_BASE + 0xd0)
49
50/* external EMIFS chipselect regions */
51#define OMAP_CS0_PHYS 0x00000000
52#define OMAP_CS0_SIZE SZ_64M
53
54#define OMAP_CS1_PHYS 0x04000000
55#define OMAP_CS1_SIZE SZ_64M
56
57#define OMAP_CS1A_PHYS OMAP_CS1_PHYS
58#define OMAP_CS1A_SIZE SZ_32M
59
60#define OMAP_CS1B_PHYS (OMAP_CS1A_PHYS + OMAP_CS1A_SIZE)
61#define OMAP_CS1B_SIZE SZ_32M
62
63#define OMAP_CS2_PHYS 0x08000000
64#define OMAP_CS2_SIZE SZ_64M
65
66#define OMAP_CS2A_PHYS OMAP_CS2_PHYS
67#define OMAP_CS2A_SIZE SZ_32M
68
69#define OMAP_CS2B_PHYS (OMAP_CS2A_PHYS + OMAP_CS2A_SIZE)
70#define OMAP_CS2B_SIZE SZ_32M
71
72#define OMAP_CS3_PHYS 0x0c000000
73#define OMAP_CS3_SIZE SZ_64M
74
75#ifndef __ASSEMBLER__
76
77/* EMIF Slow Interface Configuration Register */
78#define OMAP_EMIFS_CONFIG_FR (1 << 4)
79#define OMAP_EMIFS_CONFIG_PDE (1 << 3)
80#define OMAP_EMIFS_CONFIG_PWD_EN (1 << 2)
81#define OMAP_EMIFS_CONFIG_BM (1 << 1)
82#define OMAP_EMIFS_CONFIG_WP (1 << 0)
83
84#define EMIFS_CCS(n) (EMIFS_CS0_CONFIG + (4 * (n)))
85#define EMIFS_ACS(n) (EMIFS_ACS0 + (4 * (n)))
86
87/* Almost all documentation for chip and board memory maps assumes
88 * BM is clear. Most devel boards have a switch to control booting
89 * from NOR flash (using external chipselect 3) rather than mask ROM,
90 * which uses BM to interchange the physical CS0 and CS3 addresses.
91 */
92static inline u32 omap_cs0_phys(void)
93{
94 return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM)
95 ? OMAP_CS3_PHYS : 0;
96}
97
98static inline u32 omap_cs3_phys(void)
99{
100 return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM)
101 ? 0 : OMAP_CS3_PHYS;
102}
103
104#endif /* __ASSEMBLER__ */
105
106#endif /* __ASM_ARCH_TC_H */
diff --git a/arch/arm/plat-omap/include/mach/timex.h b/arch/arm/plat-omap/include/mach/timex.h
new file mode 100644
index 000000000000..6d35767bc48f
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/timex.h
@@ -0,0 +1,41 @@
1/*
2 * arch/arm/plat-omap/include/mach/timex.h
3 *
4 * Copyright (C) 2000 RidgeRun, Inc.
5 * Author: Greg Lonnon <glonnon@ridgerun.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#if !defined(__ASM_ARCH_OMAP_TIMEX_H)
29#define __ASM_ARCH_OMAP_TIMEX_H
30
31/*
32 * OMAP 32KHz timer updates time one jiffie at a time from a secondary timer,
33 * and that's why the CLOCK_TICK_RATE is not 32768.
34 */
35#ifdef CONFIG_OMAP_32K_TIMER
36#define CLOCK_TICK_RATE (CONFIG_OMAP_32K_TIMER_HZ)
37#else
38#define CLOCK_TICK_RATE (HZ * 100000UL)
39#endif
40
41#endif /* __ASM_ARCH_OMAP_TIMEX_H */
diff --git a/arch/arm/plat-omap/include/mach/uncompress.h b/arch/arm/plat-omap/include/mach/uncompress.h
new file mode 100644
index 000000000000..0814c5f210c3
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/uncompress.h
@@ -0,0 +1,83 @@
1/*
2 * arch/arm/plat-omap/include/mach/uncompress.h
3 *
4 * Serial port stubs for kernel decompress status messages
5 *
6 * Initially based on:
7 * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Author: Greg Lonnon <glonnon@ridgerun.com>
10 *
11 * Rewritten by:
12 * Author: <source@mvista.com>
13 * 2004 (c) MontaVista Software, 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/types.h>
21#include <linux/serial_reg.h>
22#include <mach/serial.h>
23
24unsigned int system_rev;
25
26#define UART_OMAP_MDR1 0x08 /* mode definition register */
27#define OMAP_ID_730 0x355F
28#define ID_MASK 0x7fff
29#define check_port(base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0)
30#define omap_get_id() ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK
31
32static void putc(int c)
33{
34 volatile u8 * uart = 0;
35 int shift = 2;
36
37#ifdef CONFIG_MACH_OMAP_PALMTE
38 return;
39#endif
40
41#ifdef CONFIG_ARCH_OMAP
42#ifdef CONFIG_OMAP_LL_DEBUG_UART3
43 uart = (volatile u8 *)(OMAP_UART3_BASE);
44#elif defined(CONFIG_OMAP_LL_DEBUG_UART2)
45 uart = (volatile u8 *)(OMAP_UART2_BASE);
46#else
47 uart = (volatile u8 *)(OMAP_UART1_BASE);
48#endif
49
50#ifdef CONFIG_ARCH_OMAP1
51 /* Determine which serial port to use */
52 do {
53 /* MMU is not on, so cpu_is_omapXXXX() won't work here */
54 unsigned int omap_id = omap_get_id();
55
56 if (omap_id == OMAP_ID_730)
57 shift = 0;
58
59 if (check_port(uart, shift))
60 break;
61 /* Silent boot if no serial ports are enabled. */
62 return;
63 } while (0);
64#endif /* CONFIG_ARCH_OMAP1 */
65#endif
66
67 /*
68 * Now, xmit each character
69 */
70 while (!(uart[UART_LSR << shift] & UART_LSR_THRE))
71 barrier();
72 uart[UART_TX << shift] = c;
73}
74
75static inline void flush(void)
76{
77}
78
79/*
80 * nothing to do
81 */
82#define arch_decomp_setup()
83#define arch_decomp_wdog()
diff --git a/arch/arm/plat-omap/include/mach/usb.h b/arch/arm/plat-omap/include/mach/usb.h
new file mode 100644
index 000000000000..a56a610950c2
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/usb.h
@@ -0,0 +1,141 @@
1// include/asm-arm/mach-omap/usb.h
2
3#ifndef __ASM_ARCH_OMAP_USB_H
4#define __ASM_ARCH_OMAP_USB_H
5
6#include <mach/board.h>
7
8/*-------------------------------------------------------------------------*/
9
10#define OMAP1_OTG_BASE 0xfffb0400
11#define OMAP1_UDC_BASE 0xfffb4000
12#define OMAP1_OHCI_BASE 0xfffba000
13
14#define OMAP2_OHCI_BASE 0x4805e000
15#define OMAP2_UDC_BASE 0x4805e200
16#define OMAP2_OTG_BASE 0x4805e300
17
18#ifdef CONFIG_ARCH_OMAP1
19
20#define OTG_BASE OMAP1_OTG_BASE
21#define UDC_BASE OMAP1_UDC_BASE
22#define OMAP_OHCI_BASE OMAP1_OHCI_BASE
23
24#else
25
26#define OTG_BASE OMAP2_OTG_BASE
27#define UDC_BASE OMAP2_UDC_BASE
28#define OMAP_OHCI_BASE OMAP2_OHCI_BASE
29
30#endif
31
32/*-------------------------------------------------------------------------*/
33
34/*
35 * OTG and transceiver registers, for OMAPs starting with ARM926
36 */
37#define OTG_REV (OTG_BASE + 0x00)
38#define OTG_SYSCON_1 (OTG_BASE + 0x04)
39# define USB2_TRX_MODE(w) (((w)>>24)&0x07)
40# define USB1_TRX_MODE(w) (((w)>>20)&0x07)
41# define USB0_TRX_MODE(w) (((w)>>16)&0x07)
42# define OTG_IDLE_EN (1 << 15)
43# define HST_IDLE_EN (1 << 14)
44# define DEV_IDLE_EN (1 << 13)
45# define OTG_RESET_DONE (1 << 2)
46# define OTG_SOFT_RESET (1 << 1)
47#define OTG_SYSCON_2 (OTG_BASE + 0x08)
48# define OTG_EN (1 << 31)
49# define USBX_SYNCHRO (1 << 30)
50# define OTG_MST16 (1 << 29)
51# define SRP_GPDATA (1 << 28)
52# define SRP_GPDVBUS (1 << 27)
53# define SRP_GPUVBUS(w) (((w)>>24)&0x07)
54# define A_WAIT_VRISE(w) (((w)>>20)&0x07)
55# define B_ASE_BRST(w) (((w)>>16)&0x07)
56# define SRP_DPW (1 << 14)
57# define SRP_DATA (1 << 13)
58# define SRP_VBUS (1 << 12)
59# define OTG_PADEN (1 << 10)
60# define HMC_PADEN (1 << 9)
61# define UHOST_EN (1 << 8)
62# define HMC_TLLSPEED (1 << 7)
63# define HMC_TLLATTACH (1 << 6)
64# define OTG_HMC(w) (((w)>>0)&0x3f)
65#define OTG_CTRL (OTG_BASE + 0x0c)
66# define OTG_USB2_EN (1 << 29)
67# define OTG_USB2_DP (1 << 28)
68# define OTG_USB2_DM (1 << 27)
69# define OTG_USB1_EN (1 << 26)
70# define OTG_USB1_DP (1 << 25)
71# define OTG_USB1_DM (1 << 24)
72# define OTG_USB0_EN (1 << 23)
73# define OTG_USB0_DP (1 << 22)
74# define OTG_USB0_DM (1 << 21)
75# define OTG_ASESSVLD (1 << 20)
76# define OTG_BSESSEND (1 << 19)
77# define OTG_BSESSVLD (1 << 18)
78# define OTG_VBUSVLD (1 << 17)
79# define OTG_ID (1 << 16)
80# define OTG_DRIVER_SEL (1 << 15)
81# define OTG_A_SETB_HNPEN (1 << 12)
82# define OTG_A_BUSREQ (1 << 11)
83# define OTG_B_HNPEN (1 << 9)
84# define OTG_B_BUSREQ (1 << 8)
85# define OTG_BUSDROP (1 << 7)
86# define OTG_PULLDOWN (1 << 5)
87# define OTG_PULLUP (1 << 4)
88# define OTG_DRV_VBUS (1 << 3)
89# define OTG_PD_VBUS (1 << 2)
90# define OTG_PU_VBUS (1 << 1)
91# define OTG_PU_ID (1 << 0)
92#define OTG_IRQ_EN (OTG_BASE + 0x10) /* 16-bit */
93# define DRIVER_SWITCH (1 << 15)
94# define A_VBUS_ERR (1 << 13)
95# define A_REQ_TMROUT (1 << 12)
96# define A_SRP_DETECT (1 << 11)
97# define B_HNP_FAIL (1 << 10)
98# define B_SRP_TMROUT (1 << 9)
99# define B_SRP_DONE (1 << 8)
100# define B_SRP_STARTED (1 << 7)
101# define OPRT_CHG (1 << 0)
102#define OTG_IRQ_SRC (OTG_BASE + 0x14) /* 16-bit */
103 // same bits as in IRQ_EN
104#define OTG_OUTCTRL (OTG_BASE + 0x18) /* 16-bit */
105# define OTGVPD (1 << 14)
106# define OTGVPU (1 << 13)
107# define OTGPUID (1 << 12)
108# define USB2VDR (1 << 10)
109# define USB2PDEN (1 << 9)
110# define USB2PUEN (1 << 8)
111# define USB1VDR (1 << 6)
112# define USB1PDEN (1 << 5)
113# define USB1PUEN (1 << 4)
114# define USB0VDR (1 << 2)
115# define USB0PDEN (1 << 1)
116# define USB0PUEN (1 << 0)
117#define OTG_TEST (OTG_BASE + 0x20) /* 16-bit */
118#define OTG_VENDOR_CODE (OTG_BASE + 0xfc) /* 16-bit */
119
120/*-------------------------------------------------------------------------*/
121
122/* OMAP1 */
123#define USB_TRANSCEIVER_CTRL (0xfffe1000 + 0x0064)
124# define CONF_USB2_UNI_R (1 << 8)
125# define CONF_USB1_UNI_R (1 << 7)
126# define CONF_USB_PORT0_R(x) (((x)>>4)&0x7)
127# define CONF_USB0_ISOLATE_R (1 << 3)
128# define CONF_USB_PWRDN_DM_R (1 << 2)
129# define CONF_USB_PWRDN_DP_R (1 << 1)
130
131/* OMAP2 */
132# define USB_UNIDIR 0x0
133# define USB_UNIDIR_TLL 0x1
134# define USB_BIDIR 0x2
135# define USB_BIDIR_TLL 0x3
136# define USBTXWRMODEI(port, x) ((x) << (22 - (port * 2)))
137# define USBT2TLL5PI (1 << 17)
138# define USB0PUENACTLOI (1 << 16)
139# define USBSTANDBYCTRL (1 << 15)
140
141#endif /* __ASM_ARCH_OMAP_USB_H */
diff --git a/arch/arm/plat-omap/include/mach/vmalloc.h b/arch/arm/plat-omap/include/mach/vmalloc.h
new file mode 100644
index 000000000000..dc104cd96197
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/vmalloc.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/plat-omap/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2000 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
21
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index ff1413eae0b8..1d7aec1a691a 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -31,7 +31,7 @@
31#include <linux/err.h> 31#include <linux/err.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/arch/mailbox.h> 34#include <mach/mailbox.h>
35#include "mailbox.h" 35#include "mailbox.h"
36 36
37static struct omap_mbox *mboxes; 37static struct omap_mbox *mboxes;
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index c7f74064696c..d0844050f2d2 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -24,8 +24,8 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <asm/arch/dma.h> 27#include <mach/dma.h>
28#include <asm/arch/mcbsp.h> 28#include <mach/mcbsp.h>
29 29
30static struct omap_mcbsp mcbsp[OMAP_MAX_MCBSP_COUNT]; 30static struct omap_mcbsp mcbsp[OMAP_MAX_MCBSP_COUNT];
31 31
diff --git a/arch/arm/plat-omap/mux.c b/arch/arm/plat-omap/mux.c
index 6f3f459731c8..847df208c46c 100644
--- a/arch/arm/plat-omap/mux.c
+++ b/arch/arm/plat-omap/mux.c
@@ -28,7 +28,7 @@
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <linux/spinlock.h> 30#include <linux/spinlock.h>
31#include <asm/arch/mux.h> 31#include <mach/mux.h>
32 32
33#ifdef CONFIG_OMAP_MUX 33#ifdef CONFIG_OMAP_MUX
34 34
diff --git a/arch/arm/plat-omap/ocpi.c b/arch/arm/plat-omap/ocpi.c
index b5d307026c82..8bdbf979a257 100644
--- a/arch/arm/plat-omap/ocpi.c
+++ b/arch/arm/plat-omap/ocpi.c
@@ -33,7 +33,7 @@
33#include <linux/clk.h> 33#include <linux/clk.h>
34 34
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/hardware.h> 36#include <mach/hardware.h>
37 37
38#define OCPI_BASE 0xfffec320 38#define OCPI_BASE 0xfffec320
39#define OCPI_FAULT (OCPI_BASE + 0x00) 39#define OCPI_FAULT (OCPI_BASE + 0x00)
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 554ee58e1294..ac67eeb6ca6a 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -22,10 +22,10 @@
22 22
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24 24
25#include <asm/arch/sram.h> 25#include <mach/sram.h>
26#include <asm/arch/board.h> 26#include <mach/board.h>
27 27
28#include <asm/arch/control.h> 28#include <mach/control.h>
29 29
30#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 30#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
31# include "../mach-omap2/prm.h" 31# include "../mach-omap2/prm.h"
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index 2699c16d4da0..777485e0636b 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -31,12 +31,12 @@
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/system.h> 33#include <asm/system.h>
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35 35
36#include <asm/arch/control.h> 36#include <mach/control.h>
37#include <asm/arch/mux.h> 37#include <mach/mux.h>
38#include <asm/arch/usb.h> 38#include <mach/usb.h>
39#include <asm/arch/board.h> 39#include <mach/board.h>
40 40
41#ifdef CONFIG_ARCH_OMAP1 41#ifdef CONFIG_ARCH_OMAP1
42 42
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 93c4ef9f0067..544d6b327f3a 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -16,7 +16,7 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <asm/mach/time.h> 18#include <asm/mach/time.h>
19#include <asm/arch/hardware.h> 19#include <mach/hardware.h>
20 20
21/* 21/*
22 * Number of timer ticks per jiffy. 22 * Number of timer ticks per jiffy.
diff --git a/arch/arm/plat-s3c24xx/clock.c b/arch/arm/plat-s3c24xx/clock.c
index 3ac8d8d781b3..54d4b8e2263c 100644
--- a/arch/arm/plat-s3c24xx/clock.c
+++ b/arch/arm/plat-s3c24xx/clock.c
@@ -40,12 +40,12 @@
40#include <linux/mutex.h> 40#include <linux/mutex.h>
41#include <linux/delay.h> 41#include <linux/delay.h>
42 42
43#include <asm/hardware.h> 43#include <mach/hardware.h>
44#include <asm/irq.h> 44#include <asm/irq.h>
45#include <asm/io.h> 45#include <asm/io.h>
46 46
47#include <asm/arch/regs-clock.h> 47#include <mach/regs-clock.h>
48#include <asm/arch/regs-gpio.h> 48#include <mach/regs-gpio.h>
49 49
50#include <asm/plat-s3c24xx/clock.h> 50#include <asm/plat-s3c24xx/clock.h>
51#include <asm/plat-s3c24xx/cpu.h> 51#include <asm/plat-s3c24xx/cpu.h>
diff --git a/arch/arm/plat-s3c24xx/common-smdk.c b/arch/arm/plat-s3c24xx/common-smdk.c
index 398c7ac25296..1863a1b1bc49 100644
--- a/arch/arm/plat-s3c24xx/common-smdk.c
+++ b/arch/arm/plat-s3c24xx/common-smdk.c
@@ -31,12 +31,12 @@
31#include <asm/mach/irq.h> 31#include <asm/mach/irq.h>
32 32
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/hardware.h> 34#include <mach/hardware.h>
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37 37
38#include <asm/arch/regs-gpio.h> 38#include <mach/regs-gpio.h>
39#include <asm/arch/leds-gpio.h> 39#include <mach/leds-gpio.h>
40 40
41#include <asm/plat-s3c/nand.h> 41#include <asm/plat-s3c/nand.h>
42 42
diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
index f5699cadb0c3..6d60f0476bb8 100644
--- a/arch/arm/plat-s3c24xx/cpu.c
+++ b/arch/arm/plat-s3c24xx/cpu.c
@@ -30,7 +30,7 @@
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32 32
33#include <asm/hardware.h> 33#include <mach/hardware.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/delay.h> 36#include <asm/delay.h>
@@ -39,9 +39,9 @@
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/map.h> 40#include <asm/mach/map.h>
41 41
42#include <asm/arch/system-reset.h> 42#include <mach/system-reset.h>
43 43
44#include <asm/arch/regs-gpio.h> 44#include <mach/regs-gpio.h>
45#include <asm/plat-s3c/regs-serial.h> 45#include <asm/plat-s3c/regs-serial.h>
46 46
47#include <asm/plat-s3c24xx/cpu.h> 47#include <asm/plat-s3c24xx/cpu.h>
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c
index eea3b32ff798..d6fb76578b11 100644
--- a/arch/arm/plat-s3c24xx/devs.c
+++ b/arch/arm/plat-s3c24xx/devs.c
@@ -23,8 +23,8 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26#include <asm/arch/fb.h> 26#include <mach/fb.h>
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30 30
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 8c5e656d5d8c..08c2aaf14c41 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -29,12 +29,12 @@
29 29
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/hardware.h> 32#include <mach/hardware.h>
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/dma.h> 34#include <asm/dma.h>
35 35
36#include <asm/mach/dma.h> 36#include <asm/mach/dma.h>
37#include <asm/arch/map.h> 37#include <mach/map.h>
38 38
39#include <asm/plat-s3c24xx/dma.h> 39#include <asm/plat-s3c24xx/dma.h>
40 40
diff --git a/arch/arm/plat-s3c24xx/gpio.c b/arch/arm/plat-s3c24xx/gpio.c
index ee99dcc7f0bd..dd27334e3d7e 100644
--- a/arch/arm/plat-s3c24xx/gpio.c
+++ b/arch/arm/plat-s3c24xx/gpio.c
@@ -27,11 +27,11 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/ioport.h> 28#include <linux/ioport.h>
29 29
30#include <asm/hardware.h> 30#include <mach/hardware.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/io.h> 32#include <asm/io.h>
33 33
34#include <asm/arch/regs-gpio.h> 34#include <mach/regs-gpio.h>
35 35
36void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function) 36void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function)
37{ 37{
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c
index 825d8d0c5ca2..849f8469714a 100644
--- a/arch/arm/plat-s3c24xx/gpiolib.c
+++ b/arch/arm/plat-s3c24xx/gpiolib.c
@@ -19,10 +19,10 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21 21
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24 24
25#include <asm/arch/regs-gpio.h> 25#include <mach/regs-gpio.h>
26 26
27struct s3c24xx_gpio_chip { 27struct s3c24xx_gpio_chip {
28 struct gpio_chip chip; 28 struct gpio_chip chip;
diff --git a/arch/arm/plat-s3c24xx/irq.c b/arch/arm/plat-s3c24xx/irq.c
index 001436c04b13..36cefe176835 100644
--- a/arch/arm/plat-s3c24xx/irq.c
+++ b/arch/arm/plat-s3c24xx/irq.c
@@ -56,14 +56,14 @@
56#include <linux/ioport.h> 56#include <linux/ioport.h>
57#include <linux/sysdev.h> 57#include <linux/sysdev.h>
58 58
59#include <asm/hardware.h> 59#include <mach/hardware.h>
60#include <asm/irq.h> 60#include <asm/irq.h>
61#include <asm/io.h> 61#include <asm/io.h>
62 62
63#include <asm/mach/irq.h> 63#include <asm/mach/irq.h>
64 64
65#include <asm/arch/regs-irq.h> 65#include <mach/regs-irq.h>
66#include <asm/arch/regs-gpio.h> 66#include <mach/regs-gpio.h>
67 67
68#include <asm/plat-s3c24xx/cpu.h> 68#include <asm/plat-s3c24xx/cpu.h>
69#include <asm/plat-s3c24xx/pm.h> 69#include <asm/plat-s3c24xx/pm.h>
diff --git a/arch/arm/plat-s3c24xx/pm-simtec.c b/arch/arm/plat-s3c24xx/pm-simtec.c
index cb0b3a4ccf1b..e6705014b2a0 100644
--- a/arch/arm/plat-s3c24xx/pm-simtec.c
+++ b/arch/arm/plat-s3c24xx/pm-simtec.c
@@ -24,12 +24,12 @@
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
27#include <asm/hardware.h> 27#include <mach/hardware.h>
28#include <asm/io.h> 28#include <asm/io.h>
29 29
30#include <asm/arch/map.h> 30#include <mach/map.h>
31#include <asm/arch/regs-gpio.h> 31#include <mach/regs-gpio.h>
32#include <asm/arch/regs-mem.h> 32#include <mach/regs-mem.h>
33 33
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35 35
diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c
index bf5581a9aeea..fc4b731a949c 100644
--- a/arch/arm/plat-s3c24xx/pm.c
+++ b/arch/arm/plat-s3c24xx/pm.c
@@ -37,14 +37,14 @@
37#include <linux/serial_core.h> 37#include <linux/serial_core.h>
38 38
39#include <asm/cacheflush.h> 39#include <asm/cacheflush.h>
40#include <asm/hardware.h> 40#include <mach/hardware.h>
41#include <asm/io.h> 41#include <asm/io.h>
42 42
43#include <asm/plat-s3c/regs-serial.h> 43#include <asm/plat-s3c/regs-serial.h>
44#include <asm/arch/regs-clock.h> 44#include <mach/regs-clock.h>
45#include <asm/arch/regs-gpio.h> 45#include <mach/regs-gpio.h>
46#include <asm/arch/regs-mem.h> 46#include <mach/regs-mem.h>
47#include <asm/arch/regs-irq.h> 47#include <mach/regs-irq.h>
48 48
49#include <asm/mach/time.h> 49#include <asm/mach/time.h>
50 50
diff --git a/arch/arm/plat-s3c24xx/pwm-clock.c b/arch/arm/plat-s3c24xx/pwm-clock.c
index 2cda3e3c6786..ccfdc9d7ae4b 100644
--- a/arch/arm/plat-s3c24xx/pwm-clock.c
+++ b/arch/arm/plat-s3c24xx/pwm-clock.c
@@ -18,11 +18,11 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include <asm/hardware.h> 21#include <mach/hardware.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23 23
24#include <asm/arch/regs-clock.h> 24#include <mach/regs-clock.h>
25#include <asm/arch/regs-gpio.h> 25#include <mach/regs-gpio.h>
26 26
27#include <asm/plat-s3c24xx/clock.h> 27#include <asm/plat-s3c24xx/clock.h>
28#include <asm/plat-s3c24xx/cpu.h> 28#include <asm/plat-s3c24xx/cpu.h>
diff --git a/arch/arm/plat-s3c24xx/s3c244x-clock.c b/arch/arm/plat-s3c24xx/s3c244x-clock.c
index faf3e0f9f4e2..8a5fffde6631 100644
--- a/arch/arm/plat-s3c24xx/s3c244x-clock.c
+++ b/arch/arm/plat-s3c24xx/s3c244x-clock.c
@@ -34,12 +34,12 @@
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/clk.h> 35#include <linux/clk.h>
36 36
37#include <asm/hardware.h> 37#include <mach/hardware.h>
38#include <asm/atomic.h> 38#include <asm/atomic.h>
39#include <asm/irq.h> 39#include <asm/irq.h>
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#include <asm/arch/regs-clock.h> 42#include <mach/regs-clock.h>
43 43
44#include <asm/plat-s3c24xx/clock.h> 44#include <asm/plat-s3c24xx/clock.h>
45#include <asm/plat-s3c24xx/cpu.h> 45#include <asm/plat-s3c24xx/cpu.h>
diff --git a/arch/arm/plat-s3c24xx/s3c244x-irq.c b/arch/arm/plat-s3c24xx/s3c244x-irq.c
index 2dbb2606d448..f3dc38cf1de4 100644
--- a/arch/arm/plat-s3c24xx/s3c244x-irq.c
+++ b/arch/arm/plat-s3c24xx/s3c244x-irq.c
@@ -25,14 +25,14 @@
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sysdev.h> 26#include <linux/sysdev.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/io.h> 30#include <asm/io.h>
31 31
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33 33
34#include <asm/arch/regs-irq.h> 34#include <mach/regs-irq.h>
35#include <asm/arch/regs-gpio.h> 35#include <mach/regs-gpio.h>
36 36
37#include <asm/plat-s3c24xx/cpu.h> 37#include <asm/plat-s3c24xx/cpu.h>
38#include <asm/plat-s3c24xx/pm.h> 38#include <asm/plat-s3c24xx/pm.h>
diff --git a/arch/arm/plat-s3c24xx/s3c244x.c b/arch/arm/plat-s3c24xx/s3c244x.c
index 2f01af5f64c4..281b4804ed38 100644
--- a/arch/arm/plat-s3c24xx/s3c244x.c
+++ b/arch/arm/plat-s3c24xx/s3c244x.c
@@ -25,15 +25,15 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
27 27
28#include <asm/hardware.h> 28#include <mach/hardware.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31 31
32#include <asm/arch/regs-clock.h> 32#include <mach/regs-clock.h>
33#include <asm/plat-s3c/regs-serial.h> 33#include <asm/plat-s3c/regs-serial.h>
34#include <asm/arch/regs-gpio.h> 34#include <mach/regs-gpio.h>
35#include <asm/arch/regs-gpioj.h> 35#include <mach/regs-gpioj.h>
36#include <asm/arch/regs-dsc.h> 36#include <mach/regs-dsc.h>
37 37
38#include <asm/plat-s3c24xx/s3c2410.h> 38#include <asm/plat-s3c24xx/s3c2410.h>
39#include <asm/plat-s3c24xx/s3c2440.h> 39#include <asm/plat-s3c24xx/s3c2440.h>
diff --git a/arch/arm/plat-s3c24xx/sleep.S b/arch/arm/plat-s3c24xx/sleep.S
index a646cbe8244c..4981a08b6ebb 100644
--- a/arch/arm/plat-s3c24xx/sleep.S
+++ b/arch/arm/plat-s3c24xx/sleep.S
@@ -26,12 +26,12 @@
26 26
27#include <linux/linkage.h> 27#include <linux/linkage.h>
28#include <asm/assembler.h> 28#include <asm/assembler.h>
29#include <asm/hardware.h> 29#include <mach/hardware.h>
30#include <asm/arch/map.h> 30#include <mach/map.h>
31 31
32#include <asm/arch/regs-gpio.h> 32#include <mach/regs-gpio.h>
33#include <asm/arch/regs-clock.h> 33#include <mach/regs-clock.h>
34#include <asm/arch/regs-mem.h> 34#include <mach/regs-mem.h>
35#include <asm/plat-s3c/regs-serial.h> 35#include <asm/plat-s3c/regs-serial.h>
36 36
37/* CONFIG_DEBUG_RESUME is dangerous if your bootloader does not 37/* CONFIG_DEBUG_RESUME is dangerous if your bootloader does not
diff --git a/arch/arm/plat-s3c24xx/time.c b/arch/arm/plat-s3c24xx/time.c
index 766473b3f98b..b471a21ae2e4 100644
--- a/arch/arm/plat-s3c24xx/time.c
+++ b/arch/arm/plat-s3c24xx/time.c
@@ -32,9 +32,9 @@
32 32
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/arch/map.h> 35#include <mach/map.h>
36#include <asm/plat-s3c/regs-timer.h> 36#include <asm/plat-s3c/regs-timer.h>
37#include <asm/arch/regs-irq.h> 37#include <mach/regs-irq.h>
38#include <asm/mach/time.h> 38#include <asm/mach/time.h>
39 39
40#include <asm/plat-s3c24xx/clock.h> 40#include <asm/plat-s3c24xx/clock.h>
diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile
index c2a4993a724c..1dbaa29ac4d7 100644
--- a/arch/arm/tools/Makefile
+++ b/arch/arm/tools/Makefile
@@ -6,4 +6,5 @@
6 6
7include/asm-arm/mach-types.h: $(src)/gen-mach-types $(src)/mach-types 7include/asm-arm/mach-types.h: $(src)/gen-mach-types $(src)/mach-types
8 @echo ' Generating $@' 8 @echo ' Generating $@'
9 @mkdir -p $(dir $@)
9 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } 10 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile
index 17a3529341dd..5b46433d53a5 100644
--- a/arch/avr32/Makefile
+++ b/arch/avr32/Makefile
@@ -23,9 +23,14 @@ KBUILD_AFLAGS += $(cpuflags-y)
23 23
24CHECKFLAGS += -D__avr32__ -D__BIG_ENDIAN 24CHECKFLAGS += -D__avr32__ -D__BIG_ENDIAN
25 25
26machine-$(CONFIG_PLATFORM_AT32AP) := at32ap
27machdirs := $(patsubst %,arch/avr32/mach-%/, $(machine-y))
28
29KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
30
26head-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/head.o 31head-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/head.o
27head-y += arch/avr32/kernel/head.o 32head-y += arch/avr32/kernel/head.o
28core-$(CONFIG_PLATFORM_AT32AP) += arch/avr32/mach-at32ap/ 33core-y += $(machdirs)
29core-$(CONFIG_BOARD_ATSTK1000) += arch/avr32/boards/atstk1000/ 34core-$(CONFIG_BOARD_ATSTK1000) += arch/avr32/boards/atstk1000/
30core-$(CONFIG_BOARD_ATNGW100) += arch/avr32/boards/atngw100/ 35core-$(CONFIG_BOARD_ATNGW100) += arch/avr32/boards/atngw100/
31core-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/ 36core-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/
diff --git a/arch/avr32/boards/atngw100/flash.c b/arch/avr32/boards/atngw100/flash.c
index b07ae63aa548..55ccc9ce4892 100644
--- a/arch/avr32/boards/atngw100/flash.c
+++ b/arch/avr32/boards/atngw100/flash.c
@@ -13,7 +13,7 @@
13#include <linux/mtd/partitions.h> 13#include <linux/mtd/partitions.h>
14#include <linux/mtd/physmap.h> 14#include <linux/mtd/physmap.h>
15 15
16#include <asm/arch/smc.h> 16#include <mach/smc.h>
17 17
18static struct smc_timing flash_timing __initdata = { 18static struct smc_timing flash_timing __initdata = {
19 .ncs_read_setup = 0, 19 .ncs_read_setup = 0,
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index c7fe94d03a1e..670c87b2db12 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -23,10 +23,10 @@
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/setup.h> 24#include <asm/setup.h>
25 25
26#include <asm/arch/at32ap700x.h> 26#include <mach/at32ap700x.h>
27#include <asm/arch/board.h> 27#include <mach/board.h>
28#include <asm/arch/init.h> 28#include <mach/init.h>
29#include <asm/arch/portmux.h> 29#include <mach/portmux.h>
30 30
31/* Oscillator frequencies. These are board-specific */ 31/* Oscillator frequencies. These are board-specific */
32unsigned long at32_board_osc_rates[3] = { 32unsigned long at32_board_osc_rates[3] = {
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 8538ba75ef92..b33542b97563 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -23,10 +23,10 @@
23#include <asm/setup.h> 23#include <asm/setup.h>
24#include <asm/atmel-mci.h> 24#include <asm/atmel-mci.h>
25 25
26#include <asm/arch/at32ap700x.h> 26#include <mach/at32ap700x.h>
27#include <asm/arch/board.h> 27#include <mach/board.h>
28#include <asm/arch/init.h> 28#include <mach/init.h>
29#include <asm/arch/portmux.h> 29#include <mach/portmux.h>
30 30
31#include "atstk1000.h" 31#include "atstk1000.h"
32 32
@@ -49,7 +49,7 @@ unsigned long at32_board_osc_rates[3] = {
49 */ 49 */
50#ifdef CONFIG_BOARD_ATSTK1006 50#ifdef CONFIG_BOARD_ATSTK1006
51#include <linux/mtd/partitions.h> 51#include <linux/mtd/partitions.h>
52#include <asm/arch/smc.h> 52#include <mach/smc.h>
53 53
54static struct smc_timing nand_timing __initdata = { 54static struct smc_timing nand_timing __initdata = {
55 .ncs_read_setup = 0, 55 .ncs_read_setup = 0,
diff --git a/arch/avr32/boards/atstk1000/atstk1003.c b/arch/avr32/boards/atstk1000/atstk1003.c
index 591fc73b554a..0cf664174c17 100644
--- a/arch/avr32/boards/atstk1000/atstk1003.c
+++ b/arch/avr32/boards/atstk1000/atstk1003.c
@@ -20,10 +20,10 @@
20 20
21#include <asm/setup.h> 21#include <asm/setup.h>
22 22
23#include <asm/arch/at32ap700x.h> 23#include <mach/at32ap700x.h>
24#include <asm/arch/board.h> 24#include <mach/board.h>
25#include <asm/arch/init.h> 25#include <mach/init.h>
26#include <asm/arch/portmux.h> 26#include <mach/portmux.h>
27 27
28#include "atstk1000.h" 28#include "atstk1000.h"
29 29
diff --git a/arch/avr32/boards/atstk1000/atstk1004.c b/arch/avr32/boards/atstk1000/atstk1004.c
index d9c5e0a21256..50a5273e5916 100644
--- a/arch/avr32/boards/atstk1000/atstk1004.c
+++ b/arch/avr32/boards/atstk1000/atstk1004.c
@@ -22,10 +22,10 @@
22 22
23#include <asm/setup.h> 23#include <asm/setup.h>
24 24
25#include <asm/arch/at32ap700x.h> 25#include <mach/at32ap700x.h>
26#include <asm/arch/board.h> 26#include <mach/board.h>
27#include <asm/arch/init.h> 27#include <mach/init.h>
28#include <asm/arch/portmux.h> 28#include <mach/portmux.h>
29 29
30#include "atstk1000.h" 30#include "atstk1000.h"
31 31
diff --git a/arch/avr32/boards/atstk1000/flash.c b/arch/avr32/boards/atstk1000/flash.c
index 3d0a102ad45e..6e4d561977ff 100644
--- a/arch/avr32/boards/atstk1000/flash.c
+++ b/arch/avr32/boards/atstk1000/flash.c
@@ -13,7 +13,7 @@
13#include <linux/mtd/partitions.h> 13#include <linux/mtd/partitions.h>
14#include <linux/mtd/physmap.h> 14#include <linux/mtd/physmap.h>
15 15
16#include <asm/arch/smc.h> 16#include <mach/smc.h>
17 17
18static struct smc_timing flash_timing __initdata = { 18static struct smc_timing flash_timing __initdata = {
19 .ncs_read_setup = 0, 19 .ncs_read_setup = 0,
diff --git a/arch/avr32/boards/atstk1000/setup.c b/arch/avr32/boards/atstk1000/setup.c
index 8bedf93876a3..2d6b560115d9 100644
--- a/arch/avr32/boards/atstk1000/setup.c
+++ b/arch/avr32/boards/atstk1000/setup.c
@@ -18,9 +18,9 @@
18 18
19#include <asm/setup.h> 19#include <asm/setup.h>
20 20
21#include <asm/arch/at32ap700x.h> 21#include <mach/at32ap700x.h>
22#include <asm/arch/board.h> 22#include <mach/board.h>
23#include <asm/arch/portmux.h> 23#include <mach/portmux.h>
24 24
25#include "atstk1000.h" 25#include "atstk1000.h"
26 26
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
new file mode 100644
index 000000000000..3136628ba8d2
--- /dev/null
+++ b/arch/avr32/include/asm/Kbuild
@@ -0,0 +1,3 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += cachectl.h
diff --git a/arch/sh/include/asm/a.out.h b/arch/avr32/include/asm/a.out.h
index 1f93130e179c..e46375a34a72 100644
--- a/arch/sh/include/asm/a.out.h
+++ b/arch/avr32/include/asm/a.out.h
@@ -1,5 +1,5 @@
1#ifndef __ASM_SH_A_OUT_H 1#ifndef __ASM_AVR32_A_OUT_H
2#define __ASM_SH_A_OUT_H 2#define __ASM_AVR32_A_OUT_H
3 3
4struct exec 4struct exec
5{ 5{
@@ -17,4 +17,4 @@ struct exec
17#define N_DRSIZE(a) ((a).a_drsize) 17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms) 18#define N_SYMSIZE(a) ((a).a_syms)
19 19
20#endif /* __ASM_SH_A_OUT_H */ 20#endif /* __ASM_AVR32_A_OUT_H */
diff --git a/arch/avr32/include/asm/addrspace.h b/arch/avr32/include/asm/addrspace.h
new file mode 100644
index 000000000000..366794858ec7
--- /dev/null
+++ b/arch/avr32/include/asm/addrspace.h
@@ -0,0 +1,43 @@
1/*
2 * Defitions for the address spaces of the AVR32 CPUs. Heavily based on
3 * include/asm-sh/addrspace.h
4 *
5 * Copyright (C) 2004-2006 Atmel Corporation
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#ifndef __ASM_AVR32_ADDRSPACE_H
12#define __ASM_AVR32_ADDRSPACE_H
13
14#ifdef CONFIG_MMU
15
16/* Memory segments when segmentation is enabled */
17#define P0SEG 0x00000000
18#define P1SEG 0x80000000
19#define P2SEG 0xa0000000
20#define P3SEG 0xc0000000
21#define P4SEG 0xe0000000
22
23/* Returns the privileged segment base of a given address */
24#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000)
25
26/* Returns the physical address of a PnSEG (n=1,2) address */
27#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
28
29/*
30 * Map an address to a certain privileged segment
31 */
32#define P1SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
33 | P1SEG))
34#define P2SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
35 | P2SEG))
36#define P3SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
37 | P3SEG))
38#define P4SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
39 | P4SEG))
40
41#endif /* CONFIG_MMU */
42
43#endif /* __ASM_AVR32_ADDRSPACE_H */
diff --git a/arch/avr32/include/asm/asm.h b/arch/avr32/include/asm/asm.h
new file mode 100644
index 000000000000..a2c64f404b98
--- /dev/null
+++ b/arch/avr32/include/asm/asm.h
@@ -0,0 +1,102 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_ASM_H__
9#define __ASM_AVR32_ASM_H__
10
11#include <asm/sysreg.h>
12#include <asm/asm-offsets.h>
13#include <asm/thread_info.h>
14
15#define mask_interrupts ssrf SYSREG_GM_OFFSET
16#define mask_exceptions ssrf SYSREG_EM_OFFSET
17#define unmask_interrupts csrf SYSREG_GM_OFFSET
18#define unmask_exceptions csrf SYSREG_EM_OFFSET
19
20#ifdef CONFIG_FRAME_POINTER
21 .macro save_fp
22 st.w --sp, r7
23 .endm
24 .macro restore_fp
25 ld.w r7, sp++
26 .endm
27 .macro zero_fp
28 mov r7, 0
29 .endm
30#else
31 .macro save_fp
32 .endm
33 .macro restore_fp
34 .endm
35 .macro zero_fp
36 .endm
37#endif
38 .macro get_thread_info reg
39 mov \reg, sp
40 andl \reg, ~(THREAD_SIZE - 1) & 0xffff
41 .endm
42
43 /* Save and restore registers */
44 .macro save_min sr, tmp=lr
45 pushm lr
46 mfsr \tmp, \sr
47 zero_fp
48 st.w --sp, \tmp
49 .endm
50
51 .macro restore_min sr, tmp=lr
52 ld.w \tmp, sp++
53 mtsr \sr, \tmp
54 popm lr
55 .endm
56
57 .macro save_half sr, tmp=lr
58 save_fp
59 pushm r8-r9,r10,r11,r12,lr
60 zero_fp
61 mfsr \tmp, \sr
62 st.w --sp, \tmp
63 .endm
64
65 .macro restore_half sr, tmp=lr
66 ld.w \tmp, sp++
67 mtsr \sr, \tmp
68 popm r8-r9,r10,r11,r12,lr
69 restore_fp
70 .endm
71
72 .macro save_full_user sr, tmp=lr
73 stmts --sp, r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,sp,lr
74 st.w --sp, lr
75 zero_fp
76 mfsr \tmp, \sr
77 st.w --sp, \tmp
78 .endm
79
80 .macro restore_full_user sr, tmp=lr
81 ld.w \tmp, sp++
82 mtsr \sr, \tmp
83 ld.w lr, sp++
84 ldmts sp++, r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,sp,lr
85 .endm
86
87 /* uaccess macros */
88 .macro branch_if_kernel scratch, label
89 get_thread_info \scratch
90 ld.w \scratch, \scratch[TI_flags]
91 bld \scratch, TIF_USERSPACE
92 brcc \label
93 .endm
94
95 .macro ret_if_privileged scratch, addr, size, ret
96 sub \scratch, \size, 1
97 add \scratch, \addr
98 retcs \ret
99 retmi \ret
100 .endm
101
102#endif /* __ASM_AVR32_ASM_H__ */
diff --git a/arch/avr32/include/asm/atmel-mci.h b/arch/avr32/include/asm/atmel-mci.h
new file mode 100644
index 000000000000..c2ea6e1c9aa1
--- /dev/null
+++ b/arch/avr32/include/asm/atmel-mci.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_AVR32_ATMEL_MCI_H
2#define __ASM_AVR32_ATMEL_MCI_H
3
4struct mci_platform_data {
5 int detect_pin;
6 int wp_pin;
7};
8
9#endif /* __ASM_AVR32_ATMEL_MCI_H */
diff --git a/arch/avr32/include/asm/atomic.h b/arch/avr32/include/asm/atomic.h
new file mode 100644
index 000000000000..7ef3862a73d0
--- /dev/null
+++ b/arch/avr32/include/asm/atomic.h
@@ -0,0 +1,201 @@
1/*
2 * Atomic operations that C can't guarantee us. Useful for
3 * resource counting etc.
4 *
5 * But use these as seldom as possible since they are slower than
6 * regular operations.
7 *
8 * Copyright (C) 2004-2006 Atmel Corporation
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14#ifndef __ASM_AVR32_ATOMIC_H
15#define __ASM_AVR32_ATOMIC_H
16
17#include <asm/system.h>
18
19typedef struct { volatile int counter; } atomic_t;
20#define ATOMIC_INIT(i) { (i) }
21
22#define atomic_read(v) ((v)->counter)
23#define atomic_set(v, i) (((v)->counter) = i)
24
25/*
26 * atomic_sub_return - subtract the atomic variable
27 * @i: integer value to subtract
28 * @v: pointer of type atomic_t
29 *
30 * Atomically subtracts @i from @v. Returns the resulting value.
31 */
32static inline int atomic_sub_return(int i, atomic_t *v)
33{
34 int result;
35
36 asm volatile(
37 "/* atomic_sub_return */\n"
38 "1: ssrf 5\n"
39 " ld.w %0, %2\n"
40 " sub %0, %3\n"
41 " stcond %1, %0\n"
42 " brne 1b"
43 : "=&r"(result), "=o"(v->counter)
44 : "m"(v->counter), "rKs21"(i)
45 : "cc");
46
47 return result;
48}
49
50/*
51 * atomic_add_return - add integer to atomic variable
52 * @i: integer value to add
53 * @v: pointer of type atomic_t
54 *
55 * Atomically adds @i to @v. Returns the resulting value.
56 */
57static inline int atomic_add_return(int i, atomic_t *v)
58{
59 int result;
60
61 if (__builtin_constant_p(i) && (i >= -1048575) && (i <= 1048576))
62 result = atomic_sub_return(-i, v);
63 else
64 asm volatile(
65 "/* atomic_add_return */\n"
66 "1: ssrf 5\n"
67 " ld.w %0, %1\n"
68 " add %0, %3\n"
69 " stcond %2, %0\n"
70 " brne 1b"
71 : "=&r"(result), "=o"(v->counter)
72 : "m"(v->counter), "r"(i)
73 : "cc", "memory");
74
75 return result;
76}
77
78/*
79 * atomic_sub_unless - sub unless the number is a given value
80 * @v: pointer of type atomic_t
81 * @a: the amount to add to v...
82 * @u: ...unless v is equal to u.
83 *
84 * If the atomic value v is not equal to u, this function subtracts a
85 * from v, and returns non zero. If v is equal to u then it returns
86 * zero. This is done as an atomic operation.
87*/
88static inline int atomic_sub_unless(atomic_t *v, int a, int u)
89{
90 int tmp, result = 0;
91
92 asm volatile(
93 "/* atomic_sub_unless */\n"
94 "1: ssrf 5\n"
95 " ld.w %0, %3\n"
96 " cp.w %0, %5\n"
97 " breq 1f\n"
98 " sub %0, %4\n"
99 " stcond %2, %0\n"
100 " brne 1b\n"
101 " mov %1, 1\n"
102 "1:"
103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter)
104 : "m"(v->counter), "rKs21"(a), "rKs21"(u), "1"(result)
105 : "cc", "memory");
106
107 return result;
108}
109
110/*
111 * atomic_add_unless - add unless the number is a given value
112 * @v: pointer of type atomic_t
113 * @a: the amount to add to v...
114 * @u: ...unless v is equal to u.
115 *
116 * If the atomic value v is not equal to u, this function adds a to v,
117 * and returns non zero. If v is equal to u then it returns zero. This
118 * is done as an atomic operation.
119*/
120static inline int atomic_add_unless(atomic_t *v, int a, int u)
121{
122 int tmp, result;
123
124 if (__builtin_constant_p(a) && (a >= -1048575) && (a <= 1048576))
125 result = atomic_sub_unless(v, -a, u);
126 else {
127 result = 0;
128 asm volatile(
129 "/* atomic_add_unless */\n"
130 "1: ssrf 5\n"
131 " ld.w %0, %3\n"
132 " cp.w %0, %5\n"
133 " breq 1f\n"
134 " add %0, %4\n"
135 " stcond %2, %0\n"
136 " brne 1b\n"
137 " mov %1, 1\n"
138 "1:"
139 : "=&r"(tmp), "=&r"(result), "=o"(v->counter)
140 : "m"(v->counter), "r"(a), "ir"(u), "1"(result)
141 : "cc", "memory");
142 }
143
144 return result;
145}
146
147/*
148 * atomic_sub_if_positive - conditionally subtract integer from atomic variable
149 * @i: integer value to subtract
150 * @v: pointer of type atomic_t
151 *
152 * Atomically test @v and subtract @i if @v is greater or equal than @i.
153 * The function returns the old value of @v minus @i.
154 */
155static inline int atomic_sub_if_positive(int i, atomic_t *v)
156{
157 int result;
158
159 asm volatile(
160 "/* atomic_sub_if_positive */\n"
161 "1: ssrf 5\n"
162 " ld.w %0, %2\n"
163 " sub %0, %3\n"
164 " brlt 1f\n"
165 " stcond %1, %0\n"
166 " brne 1b\n"
167 "1:"
168 : "=&r"(result), "=o"(v->counter)
169 : "m"(v->counter), "ir"(i)
170 : "cc", "memory");
171
172 return result;
173}
174
175#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
176#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
177
178#define atomic_sub(i, v) (void)atomic_sub_return(i, v)
179#define atomic_add(i, v) (void)atomic_add_return(i, v)
180#define atomic_dec(v) atomic_sub(1, (v))
181#define atomic_inc(v) atomic_add(1, (v))
182
183#define atomic_dec_return(v) atomic_sub_return(1, v)
184#define atomic_inc_return(v) atomic_add_return(1, v)
185
186#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
187#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0)
188#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0)
189#define atomic_add_negative(i, v) (atomic_add_return(i, v) < 0)
190
191#define atomic_inc_not_zero(v) atomic_add_unless(v, 1, 0)
192#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v)
193
194#define smp_mb__before_atomic_dec() barrier()
195#define smp_mb__after_atomic_dec() barrier()
196#define smp_mb__before_atomic_inc() barrier()
197#define smp_mb__after_atomic_inc() barrier()
198
199#include <asm-generic/atomic.h>
200
201#endif /* __ASM_AVR32_ATOMIC_H */
diff --git a/arch/avr32/include/asm/auxvec.h b/arch/avr32/include/asm/auxvec.h
new file mode 100644
index 000000000000..d5dd435bf8f4
--- /dev/null
+++ b/arch/avr32/include/asm/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASM_AVR32_AUXVEC_H
2#define __ASM_AVR32_AUXVEC_H
3
4#endif /* __ASM_AVR32_AUXVEC_H */
diff --git a/arch/avr32/include/asm/bitops.h b/arch/avr32/include/asm/bitops.h
new file mode 100644
index 000000000000..1a50b69b1a19
--- /dev/null
+++ b/arch/avr32/include/asm/bitops.h
@@ -0,0 +1,301 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_BITOPS_H
9#define __ASM_AVR32_BITOPS_H
10
11#ifndef _LINUX_BITOPS_H
12#error only <linux/bitops.h> can be included directly
13#endif
14
15#include <asm/byteorder.h>
16#include <asm/system.h>
17
18/*
19 * clear_bit() doesn't provide any barrier for the compiler
20 */
21#define smp_mb__before_clear_bit() barrier()
22#define smp_mb__after_clear_bit() barrier()
23
24/*
25 * set_bit - Atomically set a bit in memory
26 * @nr: the bit to set
27 * @addr: the address to start counting from
28 *
29 * This function is atomic and may not be reordered. See __set_bit()
30 * if you do not require the atomic guarantees.
31 *
32 * Note that @nr may be almost arbitrarily large; this function is not
33 * restricted to acting on a single-word quantity.
34 */
35static inline void set_bit(int nr, volatile void * addr)
36{
37 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
38 unsigned long tmp;
39
40 if (__builtin_constant_p(nr)) {
41 asm volatile(
42 "1: ssrf 5\n"
43 " ld.w %0, %2\n"
44 " sbr %0, %3\n"
45 " stcond %1, %0\n"
46 " brne 1b"
47 : "=&r"(tmp), "=o"(*p)
48 : "m"(*p), "i"(nr)
49 : "cc");
50 } else {
51 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
52 asm volatile(
53 "1: ssrf 5\n"
54 " ld.w %0, %2\n"
55 " or %0, %3\n"
56 " stcond %1, %0\n"
57 " brne 1b"
58 : "=&r"(tmp), "=o"(*p)
59 : "m"(*p), "r"(mask)
60 : "cc");
61 }
62}
63
64/*
65 * clear_bit - Clears a bit in memory
66 * @nr: Bit to clear
67 * @addr: Address to start counting from
68 *
69 * clear_bit() is atomic and may not be reordered. However, it does
70 * not contain a memory barrier, so if it is used for locking purposes,
71 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
72 * in order to ensure changes are visible on other processors.
73 */
74static inline void clear_bit(int nr, volatile void * addr)
75{
76 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
77 unsigned long tmp;
78
79 if (__builtin_constant_p(nr)) {
80 asm volatile(
81 "1: ssrf 5\n"
82 " ld.w %0, %2\n"
83 " cbr %0, %3\n"
84 " stcond %1, %0\n"
85 " brne 1b"
86 : "=&r"(tmp), "=o"(*p)
87 : "m"(*p), "i"(nr)
88 : "cc");
89 } else {
90 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
91 asm volatile(
92 "1: ssrf 5\n"
93 " ld.w %0, %2\n"
94 " andn %0, %3\n"
95 " stcond %1, %0\n"
96 " brne 1b"
97 : "=&r"(tmp), "=o"(*p)
98 : "m"(*p), "r"(mask)
99 : "cc");
100 }
101}
102
103/*
104 * change_bit - Toggle a bit in memory
105 * @nr: Bit to change
106 * @addr: Address to start counting from
107 *
108 * change_bit() is atomic and may not be reordered.
109 * Note that @nr may be almost arbitrarily large; this function is not
110 * restricted to acting on a single-word quantity.
111 */
112static inline void change_bit(int nr, volatile void * addr)
113{
114 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
115 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
116 unsigned long tmp;
117
118 asm volatile(
119 "1: ssrf 5\n"
120 " ld.w %0, %2\n"
121 " eor %0, %3\n"
122 " stcond %1, %0\n"
123 " brne 1b"
124 : "=&r"(tmp), "=o"(*p)
125 : "m"(*p), "r"(mask)
126 : "cc");
127}
128
129/*
130 * test_and_set_bit - Set a bit and return its old value
131 * @nr: Bit to set
132 * @addr: Address to count from
133 *
134 * This operation is atomic and cannot be reordered.
135 * It also implies a memory barrier.
136 */
137static inline int test_and_set_bit(int nr, volatile void * addr)
138{
139 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
140 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
141 unsigned long tmp, old;
142
143 if (__builtin_constant_p(nr)) {
144 asm volatile(
145 "1: ssrf 5\n"
146 " ld.w %0, %3\n"
147 " mov %2, %0\n"
148 " sbr %0, %4\n"
149 " stcond %1, %0\n"
150 " brne 1b"
151 : "=&r"(tmp), "=o"(*p), "=&r"(old)
152 : "m"(*p), "i"(nr)
153 : "memory", "cc");
154 } else {
155 asm volatile(
156 "1: ssrf 5\n"
157 " ld.w %2, %3\n"
158 " or %0, %2, %4\n"
159 " stcond %1, %0\n"
160 " brne 1b"
161 : "=&r"(tmp), "=o"(*p), "=&r"(old)
162 : "m"(*p), "r"(mask)
163 : "memory", "cc");
164 }
165
166 return (old & mask) != 0;
167}
168
169/*
170 * test_and_clear_bit - Clear a bit and return its old value
171 * @nr: Bit to clear
172 * @addr: Address to count from
173 *
174 * This operation is atomic and cannot be reordered.
175 * It also implies a memory barrier.
176 */
177static inline int test_and_clear_bit(int nr, volatile void * addr)
178{
179 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
180 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
181 unsigned long tmp, old;
182
183 if (__builtin_constant_p(nr)) {
184 asm volatile(
185 "1: ssrf 5\n"
186 " ld.w %0, %3\n"
187 " mov %2, %0\n"
188 " cbr %0, %4\n"
189 " stcond %1, %0\n"
190 " brne 1b"
191 : "=&r"(tmp), "=o"(*p), "=&r"(old)
192 : "m"(*p), "i"(nr)
193 : "memory", "cc");
194 } else {
195 asm volatile(
196 "1: ssrf 5\n"
197 " ld.w %0, %3\n"
198 " mov %2, %0\n"
199 " andn %0, %4\n"
200 " stcond %1, %0\n"
201 " brne 1b"
202 : "=&r"(tmp), "=o"(*p), "=&r"(old)
203 : "m"(*p), "r"(mask)
204 : "memory", "cc");
205 }
206
207 return (old & mask) != 0;
208}
209
210/*
211 * test_and_change_bit - Change a bit and return its old value
212 * @nr: Bit to change
213 * @addr: Address to count from
214 *
215 * This operation is atomic and cannot be reordered.
216 * It also implies a memory barrier.
217 */
218static inline int test_and_change_bit(int nr, volatile void * addr)
219{
220 unsigned long *p = ((unsigned long *)addr) + nr / BITS_PER_LONG;
221 unsigned long mask = 1UL << (nr % BITS_PER_LONG);
222 unsigned long tmp, old;
223
224 asm volatile(
225 "1: ssrf 5\n"
226 " ld.w %2, %3\n"
227 " eor %0, %2, %4\n"
228 " stcond %1, %0\n"
229 " brne 1b"
230 : "=&r"(tmp), "=o"(*p), "=&r"(old)
231 : "m"(*p), "r"(mask)
232 : "memory", "cc");
233
234 return (old & mask) != 0;
235}
236
237#include <asm-generic/bitops/non-atomic.h>
238
239/* Find First bit Set */
240static inline unsigned long __ffs(unsigned long word)
241{
242 unsigned long result;
243
244 asm("brev %1\n\t"
245 "clz %0,%1"
246 : "=r"(result), "=&r"(word)
247 : "1"(word));
248 return result;
249}
250
251/* Find First Zero */
252static inline unsigned long ffz(unsigned long word)
253{
254 return __ffs(~word);
255}
256
257/* Find Last bit Set */
258static inline int fls(unsigned long word)
259{
260 unsigned long result;
261
262 asm("clz %0,%1" : "=r"(result) : "r"(word));
263 return 32 - result;
264}
265
266unsigned long find_first_zero_bit(const unsigned long *addr,
267 unsigned long size);
268unsigned long find_next_zero_bit(const unsigned long *addr,
269 unsigned long size,
270 unsigned long offset);
271unsigned long find_first_bit(const unsigned long *addr,
272 unsigned long size);
273unsigned long find_next_bit(const unsigned long *addr,
274 unsigned long size,
275 unsigned long offset);
276
277/*
278 * ffs: find first bit set. This is defined the same way as
279 * the libc and compiler builtin ffs routines, therefore
280 * differs in spirit from the above ffz (man ffs).
281 *
282 * The difference is that bit numbering starts at 1, and if no bit is set,
283 * the function returns 0.
284 */
285static inline int ffs(unsigned long word)
286{
287 if(word == 0)
288 return 0;
289 return __ffs(word) + 1;
290}
291
292#include <asm-generic/bitops/fls64.h>
293#include <asm-generic/bitops/sched.h>
294#include <asm-generic/bitops/hweight.h>
295#include <asm-generic/bitops/lock.h>
296
297#include <asm-generic/bitops/ext2-non-atomic.h>
298#include <asm-generic/bitops/ext2-atomic.h>
299#include <asm-generic/bitops/minix-le.h>
300
301#endif /* __ASM_AVR32_BITOPS_H */
diff --git a/arch/avr32/include/asm/bug.h b/arch/avr32/include/asm/bug.h
new file mode 100644
index 000000000000..331d45bab18f
--- /dev/null
+++ b/arch/avr32/include/asm/bug.h
@@ -0,0 +1,73 @@
1/*
2 * Copyright (C) 2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_BUG_H
9#define __ASM_AVR32_BUG_H
10
11#ifdef CONFIG_BUG
12
13/*
14 * According to our Chief Architect, this compact opcode is very
15 * unlikely to ever be implemented.
16 */
17#define AVR32_BUG_OPCODE 0x5df0
18
19#ifdef CONFIG_DEBUG_BUGVERBOSE
20
21#define _BUG_OR_WARN(flags) \
22 asm volatile( \
23 "1: .hword %0\n" \
24 " .section __bug_table,\"a\",@progbits\n" \
25 "2: .long 1b\n" \
26 " .long %1\n" \
27 " .short %2\n" \
28 " .short %3\n" \
29 " .org 2b + %4\n" \
30 " .previous" \
31 : \
32 : "i"(AVR32_BUG_OPCODE), "i"(__FILE__), \
33 "i"(__LINE__), "i"(flags), \
34 "i"(sizeof(struct bug_entry)))
35
36#else
37
38#define _BUG_OR_WARN(flags) \
39 asm volatile( \
40 "1: .hword %0\n" \
41 " .section __bug_table,\"a\",@progbits\n" \
42 "2: .long 1b\n" \
43 " .short %1\n" \
44 " .org 2b + %2\n" \
45 " .previous" \
46 : \
47 : "i"(AVR32_BUG_OPCODE), "i"(flags), \
48 "i"(sizeof(struct bug_entry)))
49
50#endif /* CONFIG_DEBUG_BUGVERBOSE */
51
52#define BUG() \
53 do { \
54 _BUG_OR_WARN(0); \
55 for (;;); \
56 } while (0)
57
58#define WARN_ON(condition) \
59 ({ \
60 int __ret_warn_on = !!(condition); \
61 if (unlikely(__ret_warn_on)) \
62 _BUG_OR_WARN(BUGFLAG_WARNING); \
63 unlikely(__ret_warn_on); \
64 })
65
66#define HAVE_ARCH_BUG
67#define HAVE_ARCH_WARN_ON
68
69#endif /* CONFIG_BUG */
70
71#include <asm-generic/bug.h>
72
73#endif /* __ASM_AVR32_BUG_H */
diff --git a/arch/avr32/include/asm/bugs.h b/arch/avr32/include/asm/bugs.h
new file mode 100644
index 000000000000..7635e770622e
--- /dev/null
+++ b/arch/avr32/include/asm/bugs.h
@@ -0,0 +1,15 @@
1/*
2 * This is included by init/main.c to check for architecture-dependent bugs.
3 *
4 * Needs:
5 * void check_bugs(void);
6 */
7#ifndef __ASM_AVR32_BUGS_H
8#define __ASM_AVR32_BUGS_H
9
10static void __init check_bugs(void)
11{
12 cpu_data->loops_per_jiffy = loops_per_jiffy;
13}
14
15#endif /* __ASM_AVR32_BUGS_H */
diff --git a/arch/avr32/include/asm/byteorder.h b/arch/avr32/include/asm/byteorder.h
new file mode 100644
index 000000000000..d77b48ba7338
--- /dev/null
+++ b/arch/avr32/include/asm/byteorder.h
@@ -0,0 +1,31 @@
1/*
2 * AVR32 endian-conversion functions.
3 */
4#ifndef __ASM_AVR32_BYTEORDER_H
5#define __ASM_AVR32_BYTEORDER_H
6
7#include <asm/types.h>
8#include <linux/compiler.h>
9
10#ifdef __CHECKER__
11extern unsigned long __builtin_bswap_32(unsigned long x);
12extern unsigned short __builtin_bswap_16(unsigned short x);
13#endif
14
15/*
16 * avr32-linux-gcc versions earlier than 4.2 improperly sign-extends
17 * the result.
18 */
19#if !(__GNUC__ == 4 && __GNUC_MINOR__ < 2)
20#define __arch__swab32(x) __builtin_bswap_32(x)
21#define __arch__swab16(x) __builtin_bswap_16(x)
22#endif
23
24#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
25# define __BYTEORDER_HAS_U64__
26# define __SWAB_64_THRU_32__
27#endif
28
29#include <linux/byteorder/big_endian.h>
30
31#endif /* __ASM_AVR32_BYTEORDER_H */
diff --git a/arch/avr32/include/asm/cache.h b/arch/avr32/include/asm/cache.h
new file mode 100644
index 000000000000..d3cf35ab11ab
--- /dev/null
+++ b/arch/avr32/include/asm/cache.h
@@ -0,0 +1,38 @@
1#ifndef __ASM_AVR32_CACHE_H
2#define __ASM_AVR32_CACHE_H
3
4#define L1_CACHE_SHIFT 5
5#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
6
7/*
8 * Memory returned by kmalloc() may be used for DMA, so we must make
9 * sure that all such allocations are cache aligned. Otherwise,
10 * unrelated code may cause parts of the buffer to be read into the
11 * cache before the transfer is done, causing old data to be seen by
12 * the CPU.
13 */
14#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
15
16#ifndef __ASSEMBLER__
17struct cache_info {
18 unsigned int ways;
19 unsigned int sets;
20 unsigned int linesz;
21};
22#endif /* __ASSEMBLER */
23
24/* Cache operation constants */
25#define ICACHE_FLUSH 0x00
26#define ICACHE_INVALIDATE 0x01
27#define ICACHE_LOCK 0x02
28#define ICACHE_UNLOCK 0x03
29#define ICACHE_PREFETCH 0x04
30
31#define DCACHE_FLUSH 0x08
32#define DCACHE_LOCK 0x09
33#define DCACHE_UNLOCK 0x0a
34#define DCACHE_INVALIDATE 0x0b
35#define DCACHE_CLEAN 0x0c
36#define DCACHE_CLEAN_INVAL 0x0d
37
38#endif /* __ASM_AVR32_CACHE_H */
diff --git a/arch/avr32/include/asm/cachectl.h b/arch/avr32/include/asm/cachectl.h
new file mode 100644
index 000000000000..4faf1ce60061
--- /dev/null
+++ b/arch/avr32/include/asm/cachectl.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_AVR32_CACHECTL_H
2#define __ASM_AVR32_CACHECTL_H
3
4/*
5 * Operations that can be performed through the cacheflush system call
6 */
7
8/* Clean the data cache, then invalidate the icache */
9#define CACHE_IFLUSH 0
10
11#endif /* __ASM_AVR32_CACHECTL_H */
diff --git a/arch/avr32/include/asm/cacheflush.h b/arch/avr32/include/asm/cacheflush.h
new file mode 100644
index 000000000000..670674749b20
--- /dev/null
+++ b/arch/avr32/include/asm/cacheflush.h
@@ -0,0 +1,131 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_CACHEFLUSH_H
9#define __ASM_AVR32_CACHEFLUSH_H
10
11/* Keep includes the same across arches. */
12#include <linux/mm.h>
13
14#define CACHE_OP_ICACHE_INVALIDATE 0x01
15#define CACHE_OP_DCACHE_INVALIDATE 0x0b
16#define CACHE_OP_DCACHE_CLEAN 0x0c
17#define CACHE_OP_DCACHE_CLEAN_INVAL 0x0d
18
19/*
20 * Invalidate any cacheline containing virtual address vaddr without
21 * writing anything back to memory.
22 *
23 * Note that this function may corrupt unrelated data structures when
24 * applied on buffers that are not cacheline aligned in both ends.
25 */
26static inline void invalidate_dcache_line(void *vaddr)
27{
28 asm volatile("cache %0[0], %1"
29 :
30 : "r"(vaddr), "n"(CACHE_OP_DCACHE_INVALIDATE)
31 : "memory");
32}
33
34/*
35 * Make sure any cacheline containing virtual address vaddr is written
36 * to memory.
37 */
38static inline void clean_dcache_line(void *vaddr)
39{
40 asm volatile("cache %0[0], %1"
41 :
42 : "r"(vaddr), "n"(CACHE_OP_DCACHE_CLEAN)
43 : "memory");
44}
45
46/*
47 * Make sure any cacheline containing virtual address vaddr is written
48 * to memory and then invalidate it.
49 */
50static inline void flush_dcache_line(void *vaddr)
51{
52 asm volatile("cache %0[0], %1"
53 :
54 : "r"(vaddr), "n"(CACHE_OP_DCACHE_CLEAN_INVAL)
55 : "memory");
56}
57
58/*
59 * Invalidate any instruction cacheline containing virtual address
60 * vaddr.
61 */
62static inline void invalidate_icache_line(void *vaddr)
63{
64 asm volatile("cache %0[0], %1"
65 :
66 : "r"(vaddr), "n"(CACHE_OP_ICACHE_INVALIDATE)
67 : "memory");
68}
69
70/*
71 * Applies the above functions on all lines that are touched by the
72 * specified virtual address range.
73 */
74void invalidate_dcache_region(void *start, size_t len);
75void clean_dcache_region(void *start, size_t len);
76void flush_dcache_region(void *start, size_t len);
77void invalidate_icache_region(void *start, size_t len);
78
79/*
80 * Make sure any pending writes are completed before continuing.
81 */
82#define flush_write_buffer() asm volatile("sync 0" : : : "memory")
83
84/*
85 * The following functions are called when a virtual mapping changes.
86 * We do not need to flush anything in this case.
87 */
88#define flush_cache_all() do { } while (0)
89#define flush_cache_mm(mm) do { } while (0)
90#define flush_cache_dup_mm(mm) do { } while (0)
91#define flush_cache_range(vma, start, end) do { } while (0)
92#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
93#define flush_cache_vmap(start, end) do { } while (0)
94#define flush_cache_vunmap(start, end) do { } while (0)
95
96/*
97 * I think we need to implement this one to be able to reliably
98 * execute pages from RAMDISK. However, if we implement the
99 * flush_dcache_*() functions, it might not be needed anymore.
100 *
101 * #define flush_icache_page(vma, page) do { } while (0)
102 */
103extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
104
105/*
106 * These are (I think) related to D-cache aliasing. We might need to
107 * do something here, but only for certain configurations. No such
108 * configurations exist at this time.
109 */
110#define flush_dcache_page(page) do { } while (0)
111#define flush_dcache_mmap_lock(page) do { } while (0)
112#define flush_dcache_mmap_unlock(page) do { } while (0)
113
114/*
115 * These are for I/D cache coherency. In this case, we do need to
116 * flush with all configurations.
117 */
118extern void flush_icache_range(unsigned long start, unsigned long end);
119
120extern void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
121 unsigned long vaddr, void *dst, const void *src,
122 unsigned long len);
123
124static inline void copy_from_user_page(struct vm_area_struct *vma,
125 struct page *page, unsigned long vaddr, void *dst,
126 const void *src, unsigned long len)
127{
128 memcpy(dst, src, len);
129}
130
131#endif /* __ASM_AVR32_CACHEFLUSH_H */
diff --git a/arch/avr32/include/asm/checksum.h b/arch/avr32/include/asm/checksum.h
new file mode 100644
index 000000000000..4ddbfd2486af
--- /dev/null
+++ b/arch/avr32/include/asm/checksum.h
@@ -0,0 +1,152 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_CHECKSUM_H
9#define __ASM_AVR32_CHECKSUM_H
10
11/*
12 * computes the checksum of a memory block at buff, length len,
13 * and adds in "sum" (32-bit)
14 *
15 * returns a 32-bit number suitable for feeding into itself
16 * or csum_tcpudp_magic
17 *
18 * this function must be called with even lengths, except
19 * for the last fragment, which may be odd
20 *
21 * it's best to have buff aligned on a 32-bit boundary
22 */
23__wsum csum_partial(const void *buff, int len, __wsum sum);
24
25/*
26 * the same as csum_partial, but copies from src while it
27 * checksums, and handles user-space pointer exceptions correctly, when needed.
28 *
29 * here even more important to align src and dst on a 32-bit (or even
30 * better 64-bit) boundary
31 */
32__wsum csum_partial_copy_generic(const void *src, void *dst, int len,
33 __wsum sum, int *src_err_ptr,
34 int *dst_err_ptr);
35
36/*
37 * Note: when you get a NULL pointer exception here this means someone
38 * passed in an incorrect kernel address to one of these functions.
39 *
40 * If you use these functions directly please don't forget the
41 * access_ok().
42 */
43static inline
44__wsum csum_partial_copy_nocheck(const void *src, void *dst,
45 int len, __wsum sum)
46{
47 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
48}
49
50static inline
51__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
52 int len, __wsum sum, int *err_ptr)
53{
54 return csum_partial_copy_generic((const void __force *)src, dst, len,
55 sum, err_ptr, NULL);
56}
57
58/*
59 * This is a version of ip_compute_csum() optimized for IP headers,
60 * which always checksum on 4 octet boundaries.
61 */
62static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
63{
64 unsigned int sum, tmp;
65
66 __asm__ __volatile__(
67 " ld.w %0, %1++\n"
68 " ld.w %3, %1++\n"
69 " sub %2, 4\n"
70 " add %0, %3\n"
71 " ld.w %3, %1++\n"
72 " adc %0, %0, %3\n"
73 " ld.w %3, %1++\n"
74 " adc %0, %0, %3\n"
75 " acr %0\n"
76 "1: ld.w %3, %1++\n"
77 " add %0, %3\n"
78 " acr %0\n"
79 " sub %2, 1\n"
80 " brne 1b\n"
81 " lsl %3, %0, 16\n"
82 " andl %0, 0\n"
83 " mov %2, 0xffff\n"
84 " add %0, %3\n"
85 " adc %0, %0, %2\n"
86 " com %0\n"
87 " lsr %0, 16\n"
88 : "=r"(sum), "=r"(iph), "=r"(ihl), "=r"(tmp)
89 : "1"(iph), "2"(ihl)
90 : "memory", "cc");
91 return (__force __sum16)sum;
92}
93
94/*
95 * Fold a partial checksum
96 */
97
98static inline __sum16 csum_fold(__wsum sum)
99{
100 unsigned int tmp;
101
102 asm(" bfextu %1, %0, 0, 16\n"
103 " lsr %0, 16\n"
104 " add %0, %1\n"
105 " bfextu %1, %0, 16, 16\n"
106 " add %0, %1"
107 : "=&r"(sum), "=&r"(tmp)
108 : "0"(sum));
109
110 return (__force __sum16)~sum;
111}
112
113static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
114 unsigned short len,
115 unsigned short proto,
116 __wsum sum)
117{
118 asm(" add %0, %1\n"
119 " adc %0, %0, %2\n"
120 " adc %0, %0, %3\n"
121 " acr %0"
122 : "=r"(sum)
123 : "r"(daddr), "r"(saddr), "r"(len + proto),
124 "0"(sum)
125 : "cc");
126
127 return sum;
128}
129
130/*
131 * computes the checksum of the TCP/UDP pseudo-header
132 * returns a 16-bit checksum, already complemented
133 */
134static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
135 unsigned short len,
136 unsigned short proto,
137 __wsum sum)
138{
139 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
140}
141
142/*
143 * this routine is used for miscellaneous IP-like checksums, mainly
144 * in icmp.c
145 */
146
147static inline __sum16 ip_compute_csum(const void *buff, int len)
148{
149 return csum_fold(csum_partial(buff, len, 0));
150}
151
152#endif /* __ASM_AVR32_CHECKSUM_H */
diff --git a/arch/avr32/include/asm/cputime.h b/arch/avr32/include/asm/cputime.h
new file mode 100644
index 000000000000..e87e0f81cbeb
--- /dev/null
+++ b/arch/avr32/include/asm/cputime.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_CPUTIME_H
2#define __ASM_AVR32_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __ASM_AVR32_CPUTIME_H */
diff --git a/arch/avr32/include/asm/current.h b/arch/avr32/include/asm/current.h
new file mode 100644
index 000000000000..c7b0549eab8a
--- /dev/null
+++ b/arch/avr32/include/asm/current.h
@@ -0,0 +1,15 @@
1#ifndef __ASM_AVR32_CURRENT_H
2#define __ASM_AVR32_CURRENT_H
3
4#include <linux/thread_info.h>
5
6struct task_struct;
7
8inline static struct task_struct * get_current(void)
9{
10 return current_thread_info()->task;
11}
12
13#define current get_current()
14
15#endif /* __ASM_AVR32_CURRENT_H */
diff --git a/arch/avr32/include/asm/delay.h b/arch/avr32/include/asm/delay.h
new file mode 100644
index 000000000000..a0ed9a9839a5
--- /dev/null
+++ b/arch/avr32/include/asm/delay.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_AVR32_DELAY_H
2#define __ASM_AVR32_DELAY_H
3
4/*
5 * Copyright (C) 1993 Linus Torvalds
6 *
7 * Delay routines calling functions in arch/avr32/lib/delay.c
8 */
9
10extern void __bad_udelay(void);
11extern void __bad_ndelay(void);
12
13extern void __udelay(unsigned long usecs);
14extern void __ndelay(unsigned long nsecs);
15extern void __const_udelay(unsigned long xloops);
16extern void __delay(unsigned long loops);
17
18#define udelay(n) (__builtin_constant_p(n) ? \
19 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \
20 __udelay(n))
21
22#define ndelay(n) (__builtin_constant_p(n) ? \
23 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
24 __ndelay(n))
25
26#endif /* __ASM_AVR32_DELAY_H */
diff --git a/arch/avr32/include/asm/device.h b/arch/avr32/include/asm/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/arch/avr32/include/asm/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/arch/avr32/include/asm/div64.h b/arch/avr32/include/asm/div64.h
new file mode 100644
index 000000000000..d7ddd4fdeca6
--- /dev/null
+++ b/arch/avr32/include/asm/div64.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_DIV64_H
2#define __ASM_AVR32_DIV64_H
3
4#include <asm-generic/div64.h>
5
6#endif /* __ASM_AVR32_DIV64_H */
diff --git a/arch/avr32/include/asm/dma-mapping.h b/arch/avr32/include/asm/dma-mapping.h
new file mode 100644
index 000000000000..0399359ab5d8
--- /dev/null
+++ b/arch/avr32/include/asm/dma-mapping.h
@@ -0,0 +1,349 @@
1#ifndef __ASM_AVR32_DMA_MAPPING_H
2#define __ASM_AVR32_DMA_MAPPING_H
3
4#include <linux/mm.h>
5#include <linux/device.h>
6#include <linux/scatterlist.h>
7#include <asm/processor.h>
8#include <asm/cacheflush.h>
9#include <asm/io.h>
10
11extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
12 int direction);
13
14/*
15 * Return whether the given device DMA address mask can be supported
16 * properly. For example, if your device can only drive the low 24-bits
17 * during bus mastering, then you would pass 0x00ffffff as the mask
18 * to this function.
19 */
20static inline int dma_supported(struct device *dev, u64 mask)
21{
22 /* Fix when needed. I really don't know of any limitations */
23 return 1;
24}
25
26static inline int dma_set_mask(struct device *dev, u64 dma_mask)
27{
28 if (!dev->dma_mask || !dma_supported(dev, dma_mask))
29 return -EIO;
30
31 *dev->dma_mask = dma_mask;
32 return 0;
33}
34
35/*
36 * dma_map_single can't fail as it is implemented now.
37 */
38static inline int dma_mapping_error(struct device *dev, dma_addr_t addr)
39{
40 return 0;
41}
42
43/**
44 * dma_alloc_coherent - allocate consistent memory for DMA
45 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
46 * @size: required memory size
47 * @handle: bus-specific DMA address
48 *
49 * Allocate some uncached, unbuffered memory for a device for
50 * performing DMA. This function allocates pages, and will
51 * return the CPU-viewed address, and sets @handle to be the
52 * device-viewed address.
53 */
54extern void *dma_alloc_coherent(struct device *dev, size_t size,
55 dma_addr_t *handle, gfp_t gfp);
56
57/**
58 * dma_free_coherent - free memory allocated by dma_alloc_coherent
59 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
60 * @size: size of memory originally requested in dma_alloc_coherent
61 * @cpu_addr: CPU-view address returned from dma_alloc_coherent
62 * @handle: device-view address returned from dma_alloc_coherent
63 *
64 * Free (and unmap) a DMA buffer previously allocated by
65 * dma_alloc_coherent().
66 *
67 * References to memory and mappings associated with cpu_addr/handle
68 * during and after this call executing are illegal.
69 */
70extern void dma_free_coherent(struct device *dev, size_t size,
71 void *cpu_addr, dma_addr_t handle);
72
73/**
74 * dma_alloc_writecombine - allocate write-combining memory for DMA
75 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
76 * @size: required memory size
77 * @handle: bus-specific DMA address
78 *
79 * Allocate some uncached, buffered memory for a device for
80 * performing DMA. This function allocates pages, and will
81 * return the CPU-viewed address, and sets @handle to be the
82 * device-viewed address.
83 */
84extern void *dma_alloc_writecombine(struct device *dev, size_t size,
85 dma_addr_t *handle, gfp_t gfp);
86
87/**
88 * dma_free_coherent - free memory allocated by dma_alloc_writecombine
89 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
90 * @size: size of memory originally requested in dma_alloc_writecombine
91 * @cpu_addr: CPU-view address returned from dma_alloc_writecombine
92 * @handle: device-view address returned from dma_alloc_writecombine
93 *
94 * Free (and unmap) a DMA buffer previously allocated by
95 * dma_alloc_writecombine().
96 *
97 * References to memory and mappings associated with cpu_addr/handle
98 * during and after this call executing are illegal.
99 */
100extern void dma_free_writecombine(struct device *dev, size_t size,
101 void *cpu_addr, dma_addr_t handle);
102
103/**
104 * dma_map_single - map a single buffer for streaming DMA
105 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
106 * @cpu_addr: CPU direct mapped address of buffer
107 * @size: size of buffer to map
108 * @dir: DMA transfer direction
109 *
110 * Ensure that any data held in the cache is appropriately discarded
111 * or written back.
112 *
113 * The device owns this memory once this call has completed. The CPU
114 * can regain ownership by calling dma_unmap_single() or dma_sync_single().
115 */
116static inline dma_addr_t
117dma_map_single(struct device *dev, void *cpu_addr, size_t size,
118 enum dma_data_direction direction)
119{
120 dma_cache_sync(dev, cpu_addr, size, direction);
121 return virt_to_bus(cpu_addr);
122}
123
124/**
125 * dma_unmap_single - unmap a single buffer previously mapped
126 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
127 * @handle: DMA address of buffer
128 * @size: size of buffer to map
129 * @dir: DMA transfer direction
130 *
131 * Unmap a single streaming mode DMA translation. The handle and size
132 * must match what was provided in the previous dma_map_single() call.
133 * All other usages are undefined.
134 *
135 * After this call, reads by the CPU to the buffer are guaranteed to see
136 * whatever the device wrote there.
137 */
138static inline void
139dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
140 enum dma_data_direction direction)
141{
142
143}
144
145/**
146 * dma_map_page - map a portion of a page for streaming DMA
147 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
148 * @page: page that buffer resides in
149 * @offset: offset into page for start of buffer
150 * @size: size of buffer to map
151 * @dir: DMA transfer direction
152 *
153 * Ensure that any data held in the cache is appropriately discarded
154 * or written back.
155 *
156 * The device owns this memory once this call has completed. The CPU
157 * can regain ownership by calling dma_unmap_page() or dma_sync_single().
158 */
159static inline dma_addr_t
160dma_map_page(struct device *dev, struct page *page,
161 unsigned long offset, size_t size,
162 enum dma_data_direction direction)
163{
164 return dma_map_single(dev, page_address(page) + offset,
165 size, direction);
166}
167
168/**
169 * dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
170 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
171 * @handle: DMA address of buffer
172 * @size: size of buffer to map
173 * @dir: DMA transfer direction
174 *
175 * Unmap a single streaming mode DMA translation. The handle and size
176 * must match what was provided in the previous dma_map_single() call.
177 * All other usages are undefined.
178 *
179 * After this call, reads by the CPU to the buffer are guaranteed to see
180 * whatever the device wrote there.
181 */
182static inline void
183dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
184 enum dma_data_direction direction)
185{
186 dma_unmap_single(dev, dma_address, size, direction);
187}
188
189/**
190 * dma_map_sg - map a set of SG buffers for streaming mode DMA
191 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
192 * @sg: list of buffers
193 * @nents: number of buffers to map
194 * @dir: DMA transfer direction
195 *
196 * Map a set of buffers described by scatterlist in streaming
197 * mode for DMA. This is the scatter-gather version of the
198 * above pci_map_single interface. Here the scatter gather list
199 * elements are each tagged with the appropriate dma address
200 * and length. They are obtained via sg_dma_{address,length}(SG).
201 *
202 * NOTE: An implementation may be able to use a smaller number of
203 * DMA address/length pairs than there are SG table elements.
204 * (for example via virtual mapping capabilities)
205 * The routine returns the number of addr/length pairs actually
206 * used, at most nents.
207 *
208 * Device ownership issues as mentioned above for pci_map_single are
209 * the same here.
210 */
211static inline int
212dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
213 enum dma_data_direction direction)
214{
215 int i;
216
217 for (i = 0; i < nents; i++) {
218 char *virt;
219
220 sg[i].dma_address = page_to_bus(sg_page(&sg[i])) + sg[i].offset;
221 virt = sg_virt(&sg[i]);
222 dma_cache_sync(dev, virt, sg[i].length, direction);
223 }
224
225 return nents;
226}
227
228/**
229 * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
230 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
231 * @sg: list of buffers
232 * @nents: number of buffers to map
233 * @dir: DMA transfer direction
234 *
235 * Unmap a set of streaming mode DMA translations.
236 * Again, CPU read rules concerning calls here are the same as for
237 * pci_unmap_single() above.
238 */
239static inline void
240dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
241 enum dma_data_direction direction)
242{
243
244}
245
246/**
247 * dma_sync_single_for_cpu
248 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
249 * @handle: DMA address of buffer
250 * @size: size of buffer to map
251 * @dir: DMA transfer direction
252 *
253 * Make physical memory consistent for a single streaming mode DMA
254 * translation after a transfer.
255 *
256 * If you perform a dma_map_single() but wish to interrogate the
257 * buffer using the cpu, yet do not wish to teardown the DMA mapping,
258 * you must call this function before doing so. At the next point you
259 * give the DMA address back to the card, you must first perform a
260 * dma_sync_single_for_device, and then the device again owns the
261 * buffer.
262 */
263static inline void
264dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
265 size_t size, enum dma_data_direction direction)
266{
267 /*
268 * No need to do anything since the CPU isn't supposed to
269 * touch this memory after we flushed it at mapping- or
270 * sync-for-device time.
271 */
272}
273
274static inline void
275dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
276 size_t size, enum dma_data_direction direction)
277{
278 dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction);
279}
280
281static inline void
282dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
283 unsigned long offset, size_t size,
284 enum dma_data_direction direction)
285{
286 /* just sync everything, that's all the pci API can do */
287 dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
288}
289
290static inline void
291dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
292 unsigned long offset, size_t size,
293 enum dma_data_direction direction)
294{
295 /* just sync everything, that's all the pci API can do */
296 dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
297}
298
299/**
300 * dma_sync_sg_for_cpu
301 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
302 * @sg: list of buffers
303 * @nents: number of buffers to map
304 * @dir: DMA transfer direction
305 *
306 * Make physical memory consistent for a set of streaming
307 * mode DMA translations after a transfer.
308 *
309 * The same as dma_sync_single_for_* but for a scatter-gather list,
310 * same rules and usage.
311 */
312static inline void
313dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
314 int nents, enum dma_data_direction direction)
315{
316 /*
317 * No need to do anything since the CPU isn't supposed to
318 * touch this memory after we flushed it at mapping- or
319 * sync-for-device time.
320 */
321}
322
323static inline void
324dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
325 int nents, enum dma_data_direction direction)
326{
327 int i;
328
329 for (i = 0; i < nents; i++) {
330 dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, direction);
331 }
332}
333
334/* Now for the API extensions over the pci_ one */
335
336#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
337#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
338
339static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
340{
341 return 1;
342}
343
344static inline int dma_get_cache_alignment(void)
345{
346 return boot_cpu_data.dcache.linesz;
347}
348
349#endif /* __ASM_AVR32_DMA_MAPPING_H */
diff --git a/arch/avr32/include/asm/dma.h b/arch/avr32/include/asm/dma.h
new file mode 100644
index 000000000000..9e91205590ac
--- /dev/null
+++ b/arch/avr32/include/asm/dma.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_AVR32_DMA_H
2#define __ASM_AVR32_DMA_H
3
4/* The maximum address that we can perform a DMA transfer to on this platform.
5 * Not really applicable to AVR32, but some functions need it. */
6#define MAX_DMA_ADDRESS 0xffffffff
7
8#endif /* __ASM_AVR32_DMA_H */
diff --git a/arch/avr32/include/asm/elf.h b/arch/avr32/include/asm/elf.h
new file mode 100644
index 000000000000..64ce40ee1d58
--- /dev/null
+++ b/arch/avr32/include/asm/elf.h
@@ -0,0 +1,108 @@
1#ifndef __ASM_AVR32_ELF_H
2#define __ASM_AVR32_ELF_H
3
4/* AVR32 relocation numbers */
5#define R_AVR32_NONE 0
6#define R_AVR32_32 1
7#define R_AVR32_16 2
8#define R_AVR32_8 3
9#define R_AVR32_32_PCREL 4
10#define R_AVR32_16_PCREL 5
11#define R_AVR32_8_PCREL 6
12#define R_AVR32_DIFF32 7
13#define R_AVR32_DIFF16 8
14#define R_AVR32_DIFF8 9
15#define R_AVR32_GOT32 10
16#define R_AVR32_GOT16 11
17#define R_AVR32_GOT8 12
18#define R_AVR32_21S 13
19#define R_AVR32_16U 14
20#define R_AVR32_16S 15
21#define R_AVR32_8S 16
22#define R_AVR32_8S_EXT 17
23#define R_AVR32_22H_PCREL 18
24#define R_AVR32_18W_PCREL 19
25#define R_AVR32_16B_PCREL 20
26#define R_AVR32_16N_PCREL 21
27#define R_AVR32_14UW_PCREL 22
28#define R_AVR32_11H_PCREL 23
29#define R_AVR32_10UW_PCREL 24
30#define R_AVR32_9H_PCREL 25
31#define R_AVR32_9UW_PCREL 26
32#define R_AVR32_HI16 27
33#define R_AVR32_LO16 28
34#define R_AVR32_GOTPC 29
35#define R_AVR32_GOTCALL 30
36#define R_AVR32_LDA_GOT 31
37#define R_AVR32_GOT21S 32
38#define R_AVR32_GOT18SW 33
39#define R_AVR32_GOT16S 34
40#define R_AVR32_GOT7UW 35
41#define R_AVR32_32_CPENT 36
42#define R_AVR32_CPCALL 37
43#define R_AVR32_16_CP 38
44#define R_AVR32_9W_CP 39
45#define R_AVR32_RELATIVE 40
46#define R_AVR32_GLOB_DAT 41
47#define R_AVR32_JMP_SLOT 42
48#define R_AVR32_ALIGN 43
49
50/*
51 * ELF register definitions..
52 */
53
54#include <asm/ptrace.h>
55#include <asm/user.h>
56
57typedef unsigned long elf_greg_t;
58
59#define ELF_NGREG (sizeof (struct pt_regs) / sizeof (elf_greg_t))
60typedef elf_greg_t elf_gregset_t[ELF_NGREG];
61
62typedef struct user_fpu_struct elf_fpregset_t;
63
64/*
65 * This is used to ensure we don't load something for the wrong architecture.
66 */
67#define elf_check_arch(x) ( (x)->e_machine == EM_AVR32 )
68
69/*
70 * These are used to set parameters in the core dumps.
71 */
72#define ELF_CLASS ELFCLASS32
73#ifdef __LITTLE_ENDIAN__
74#define ELF_DATA ELFDATA2LSB
75#else
76#define ELF_DATA ELFDATA2MSB
77#endif
78#define ELF_ARCH EM_AVR32
79
80#define USE_ELF_CORE_DUMP
81#define ELF_EXEC_PAGESIZE 4096
82
83/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
84 use of this is to invoke "./ld.so someprog" to test out a new version of
85 the loader. We need to make sure that it is out of the way of the program
86 that it will "exec", and that there is sufficient room for the brk. */
87
88#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
89
90
91/* This yields a mask that user programs can use to figure out what
92 instruction set this CPU supports. This could be done in user space,
93 but it's not easy, and we've already done it here. */
94
95#define ELF_HWCAP (0)
96
97/* This yields a string that ld.so will use to load implementation
98 specific libraries for optimization. This is more specific in
99 intent than poking at uname or /proc/cpuinfo.
100
101 For the moment, we have only optimizations for the Intel generations,
102 but that could change... */
103
104#define ELF_PLATFORM (NULL)
105
106#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
107
108#endif /* __ASM_AVR32_ELF_H */
diff --git a/arch/avr32/include/asm/emergency-restart.h b/arch/avr32/include/asm/emergency-restart.h
new file mode 100644
index 000000000000..3e7e014776ba
--- /dev/null
+++ b/arch/avr32/include/asm/emergency-restart.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_EMERGENCY_RESTART_H
2#define __ASM_AVR32_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* __ASM_AVR32_EMERGENCY_RESTART_H */
diff --git a/arch/avr32/include/asm/errno.h b/arch/avr32/include/asm/errno.h
new file mode 100644
index 000000000000..558a7249f06d
--- /dev/null
+++ b/arch/avr32/include/asm/errno.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_ERRNO_H
2#define __ASM_AVR32_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#endif /* __ASM_AVR32_ERRNO_H */
diff --git a/arch/avr32/include/asm/fb.h b/arch/avr32/include/asm/fb.h
new file mode 100644
index 000000000000..41baf84ad402
--- /dev/null
+++ b/arch/avr32/include/asm/fb.h
@@ -0,0 +1,21 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = __pgprot((pgprot_val(vma->vm_page_prot)
12 & ~_PAGE_CACHABLE)
13 | (_PAGE_BUFFER | _PAGE_DIRTY));
14}
15
16static inline int fb_is_primary_device(struct fb_info *info)
17{
18 return 0;
19}
20
21#endif /* _ASM_FB_H_ */
diff --git a/arch/avr32/include/asm/fcntl.h b/arch/avr32/include/asm/fcntl.h
new file mode 100644
index 000000000000..14c0c4402b11
--- /dev/null
+++ b/arch/avr32/include/asm/fcntl.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_FCNTL_H
2#define __ASM_AVR32_FCNTL_H
3
4#include <asm-generic/fcntl.h>
5
6#endif /* __ASM_AVR32_FCNTL_H */
diff --git a/arch/avr32/include/asm/futex.h b/arch/avr32/include/asm/futex.h
new file mode 100644
index 000000000000..10419f14a68a
--- /dev/null
+++ b/arch/avr32/include/asm/futex.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_FUTEX_H
2#define __ASM_AVR32_FUTEX_H
3
4#include <asm-generic/futex.h>
5
6#endif /* __ASM_AVR32_FUTEX_H */
diff --git a/arch/avr32/include/asm/gpio.h b/arch/avr32/include/asm/gpio.h
new file mode 100644
index 000000000000..b771f7105964
--- /dev/null
+++ b/arch/avr32/include/asm/gpio.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_GPIO_H
2#define __ASM_AVR32_GPIO_H
3
4#include <mach/gpio.h>
5
6#endif /* __ASM_AVR32_GPIO_H */
diff --git a/arch/avr32/include/asm/hardirq.h b/arch/avr32/include/asm/hardirq.h
new file mode 100644
index 000000000000..267354356f60
--- /dev/null
+++ b/arch/avr32/include/asm/hardirq.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_AVR32_HARDIRQ_H
2#define __ASM_AVR32_HARDIRQ_H
3
4#include <linux/threads.h>
5#include <asm/irq.h>
6
7#ifndef __ASSEMBLY__
8
9#include <linux/cache.h>
10
11/* entry.S is sensitive to the offsets of these fields */
12typedef struct {
13 unsigned int __softirq_pending;
14} ____cacheline_aligned irq_cpustat_t;
15
16void ack_bad_irq(unsigned int irq);
17
18/* Standard mappings for irq_cpustat_t above */
19#include <linux/irq_cpustat.h>
20
21#endif /* __ASSEMBLY__ */
22
23#define HARDIRQ_BITS 12
24
25/*
26 * The hardirq mask has to be large enough to have
27 * space for potentially all IRQ sources in the system
28 * nesting on a single CPU:
29 */
30#if (1 << HARDIRQ_BITS) < NR_IRQS
31# error HARDIRQ_BITS is too low!
32#endif
33
34#endif /* __ASM_AVR32_HARDIRQ_H */
diff --git a/arch/avr32/include/asm/hw_irq.h b/arch/avr32/include/asm/hw_irq.h
new file mode 100644
index 000000000000..218b0a6bfd1b
--- /dev/null
+++ b/arch/avr32/include/asm/hw_irq.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_AVR32_HW_IRQ_H
2#define __ASM_AVR32_HW_IRQ_H
3
4static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
5{
6 /* Nothing to do */
7}
8
9#endif /* __ASM_AVR32_HW_IRQ_H */
diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h
new file mode 100644
index 000000000000..a520f77ead96
--- /dev/null
+++ b/arch/avr32/include/asm/io.h
@@ -0,0 +1,312 @@
1#ifndef __ASM_AVR32_IO_H
2#define __ASM_AVR32_IO_H
3
4#include <linux/kernel.h>
5#include <linux/string.h>
6#include <linux/types.h>
7
8#include <asm/addrspace.h>
9#include <asm/byteorder.h>
10
11#include <mach/io.h>
12
13/* virt_to_phys will only work when address is in P1 or P2 */
14static __inline__ unsigned long virt_to_phys(volatile void *address)
15{
16 return PHYSADDR(address);
17}
18
19static __inline__ void * phys_to_virt(unsigned long address)
20{
21 return (void *)P1SEGADDR(address);
22}
23
24#define cached_to_phys(addr) ((unsigned long)PHYSADDR(addr))
25#define uncached_to_phys(addr) ((unsigned long)PHYSADDR(addr))
26#define phys_to_cached(addr) ((void *)P1SEGADDR(addr))
27#define phys_to_uncached(addr) ((void *)P2SEGADDR(addr))
28
29/*
30 * Generic IO read/write. These perform native-endian accesses. Note
31 * that some architectures will want to re-define __raw_{read,write}w.
32 */
33extern void __raw_writesb(void __iomem *addr, const void *data, int bytelen);
34extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen);
35extern void __raw_writesl(void __iomem *addr, const void *data, int longlen);
36
37extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen);
38extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
39extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
40
41static inline void __raw_writeb(u8 v, volatile void __iomem *addr)
42{
43 *(volatile u8 __force *)addr = v;
44}
45static inline void __raw_writew(u16 v, volatile void __iomem *addr)
46{
47 *(volatile u16 __force *)addr = v;
48}
49static inline void __raw_writel(u32 v, volatile void __iomem *addr)
50{
51 *(volatile u32 __force *)addr = v;
52}
53
54static inline u8 __raw_readb(const volatile void __iomem *addr)
55{
56 return *(const volatile u8 __force *)addr;
57}
58static inline u16 __raw_readw(const volatile void __iomem *addr)
59{
60 return *(const volatile u16 __force *)addr;
61}
62static inline u32 __raw_readl(const volatile void __iomem *addr)
63{
64 return *(const volatile u32 __force *)addr;
65}
66
67/* Convert I/O port address to virtual address */
68#ifndef __io
69# define __io(p) ((void *)phys_to_uncached(p))
70#endif
71
72/*
73 * Not really sure about the best way to slow down I/O on
74 * AVR32. Defining it as a no-op until we have an actual test case.
75 */
76#define SLOW_DOWN_IO do { } while (0)
77
78#define __BUILD_MEMORY_SINGLE(pfx, bwl, type) \
79static inline void \
80pfx##write##bwl(type val, volatile void __iomem *addr) \
81{ \
82 volatile type *__addr; \
83 type __val; \
84 \
85 __addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \
86 __val = pfx##ioswab##bwl(__addr, val); \
87 \
88 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
89 \
90 *__addr = __val; \
91} \
92 \
93static inline type pfx##read##bwl(const volatile void __iomem *addr) \
94{ \
95 volatile type *__addr; \
96 type __val; \
97 \
98 __addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \
99 \
100 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
101 \
102 __val = *__addr; \
103 return pfx##ioswab##bwl(__addr, __val); \
104}
105
106#define __BUILD_IOPORT_SINGLE(pfx, bwl, type, p, slow) \
107static inline void pfx##out##bwl##p(type val, unsigned long port) \
108{ \
109 volatile type *__addr; \
110 type __val; \
111 \
112 __addr = __io(__swizzle_addr_##bwl(port)); \
113 __val = pfx##ioswab##bwl(__addr, val); \
114 \
115 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
116 \
117 *__addr = __val; \
118 slow; \
119} \
120 \
121static inline type pfx##in##bwl##p(unsigned long port) \
122{ \
123 volatile type *__addr; \
124 type __val; \
125 \
126 __addr = __io(__swizzle_addr_##bwl(port)); \
127 \
128 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
129 \
130 __val = *__addr; \
131 slow; \
132 \
133 return pfx##ioswab##bwl(__addr, __val); \
134}
135
136#define __BUILD_MEMORY_PFX(bus, bwl, type) \
137 __BUILD_MEMORY_SINGLE(bus, bwl, type)
138
139#define BUILDIO_MEM(bwl, type) \
140 __BUILD_MEMORY_PFX(, bwl, type) \
141 __BUILD_MEMORY_PFX(__mem_, bwl, type)
142
143#define __BUILD_IOPORT_PFX(bus, bwl, type) \
144 __BUILD_IOPORT_SINGLE(bus, bwl, type, ,) \
145 __BUILD_IOPORT_SINGLE(bus, bwl, type, _p, SLOW_DOWN_IO)
146
147#define BUILDIO_IOPORT(bwl, type) \
148 __BUILD_IOPORT_PFX(, bwl, type) \
149 __BUILD_IOPORT_PFX(__mem_, bwl, type)
150
151BUILDIO_MEM(b, u8)
152BUILDIO_MEM(w, u16)
153BUILDIO_MEM(l, u32)
154
155BUILDIO_IOPORT(b, u8)
156BUILDIO_IOPORT(w, u16)
157BUILDIO_IOPORT(l, u32)
158
159#define readb_relaxed readb
160#define readw_relaxed readw
161#define readl_relaxed readl
162
163#define __BUILD_MEMORY_STRING(bwl, type) \
164static inline void writes##bwl(volatile void __iomem *addr, \
165 const void *data, unsigned int count) \
166{ \
167 const type *__data = data; \
168 \
169 while (count--) \
170 __mem_write##bwl(*__data++, addr); \
171} \
172 \
173static inline void reads##bwl(const volatile void __iomem *addr, \
174 void *data, unsigned int count) \
175{ \
176 type *__data = data; \
177 \
178 while (count--) \
179 *__data++ = __mem_read##bwl(addr); \
180}
181
182#define __BUILD_IOPORT_STRING(bwl, type) \
183static inline void outs##bwl(unsigned long port, const void *data, \
184 unsigned int count) \
185{ \
186 const type *__data = data; \
187 \
188 while (count--) \
189 __mem_out##bwl(*__data++, port); \
190} \
191 \
192static inline void ins##bwl(unsigned long port, void *data, \
193 unsigned int count) \
194{ \
195 type *__data = data; \
196 \
197 while (count--) \
198 *__data++ = __mem_in##bwl(port); \
199}
200
201#define BUILDSTRING(bwl, type) \
202 __BUILD_MEMORY_STRING(bwl, type) \
203 __BUILD_IOPORT_STRING(bwl, type)
204
205BUILDSTRING(b, u8)
206BUILDSTRING(w, u16)
207BUILDSTRING(l, u32)
208
209/*
210 * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be
211 */
212#ifndef ioread8
213
214#define ioread8(p) ((unsigned int)readb(p))
215
216#define ioread16(p) ((unsigned int)readw(p))
217#define ioread16be(p) ((unsigned int)__raw_readw(p))
218
219#define ioread32(p) ((unsigned int)readl(p))
220#define ioread32be(p) ((unsigned int)__raw_readl(p))
221
222#define iowrite8(v,p) writeb(v, p)
223
224#define iowrite16(v,p) writew(v, p)
225#define iowrite16be(v,p) __raw_writew(v, p)
226
227#define iowrite32(v,p) writel(v, p)
228#define iowrite32be(v,p) __raw_writel(v, p)
229
230#define ioread8_rep(p,d,c) readsb(p,d,c)
231#define ioread16_rep(p,d,c) readsw(p,d,c)
232#define ioread32_rep(p,d,c) readsl(p,d,c)
233
234#define iowrite8_rep(p,s,c) writesb(p,s,c)
235#define iowrite16_rep(p,s,c) writesw(p,s,c)
236#define iowrite32_rep(p,s,c) writesl(p,s,c)
237
238#endif
239
240static inline void memcpy_fromio(void * to, const volatile void __iomem *from,
241 unsigned long count)
242{
243 memcpy(to, (const void __force *)from, count);
244}
245
246static inline void memcpy_toio(volatile void __iomem *to, const void * from,
247 unsigned long count)
248{
249 memcpy((void __force *)to, from, count);
250}
251
252static inline void memset_io(volatile void __iomem *addr, unsigned char val,
253 unsigned long count)
254{
255 memset((void __force *)addr, val, count);
256}
257
258#define mmiowb()
259
260#define IO_SPACE_LIMIT 0xffffffff
261
262extern void __iomem *__ioremap(unsigned long offset, size_t size,
263 unsigned long flags);
264extern void __iounmap(void __iomem *addr);
265
266/*
267 * ioremap - map bus memory into CPU space
268 * @offset bus address of the memory
269 * @size size of the resource to map
270 *
271 * ioremap performs a platform specific sequence of operations to make
272 * bus memory CPU accessible via the readb/.../writel functions and
273 * the other mmio helpers. The returned address is not guaranteed to
274 * be usable directly as a virtual address.
275 */
276#define ioremap(offset, size) \
277 __ioremap((offset), (size), 0)
278
279#define ioremap_nocache(offset, size) \
280 __ioremap((offset), (size), 0)
281
282#define iounmap(addr) \
283 __iounmap(addr)
284
285#define cached(addr) P1SEGADDR(addr)
286#define uncached(addr) P2SEGADDR(addr)
287
288#define virt_to_bus virt_to_phys
289#define bus_to_virt phys_to_virt
290#define page_to_bus page_to_phys
291#define bus_to_page phys_to_page
292
293/*
294 * Create a virtual mapping cookie for an IO port range. There exists
295 * no such thing as port-based I/O on AVR32, so a regular ioremap()
296 * should do what we need.
297 */
298#define ioport_map(port, nr) ioremap(port, nr)
299#define ioport_unmap(port) iounmap(port)
300
301/*
302 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
303 * access
304 */
305#define xlate_dev_mem_ptr(p) __va(p)
306
307/*
308 * Convert a virtual cached pointer to an uncached pointer
309 */
310#define xlate_dev_kmem_ptr(p) p
311
312#endif /* __ASM_AVR32_IO_H */
diff --git a/arch/avr32/include/asm/ioctl.h b/arch/avr32/include/asm/ioctl.h
new file mode 100644
index 000000000000..c8472c1398ef
--- /dev/null
+++ b/arch/avr32/include/asm/ioctl.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_IOCTL_H
2#define __ASM_AVR32_IOCTL_H
3
4#include <asm-generic/ioctl.h>
5
6#endif /* __ASM_AVR32_IOCTL_H */
diff --git a/arch/avr32/include/asm/ioctls.h b/arch/avr32/include/asm/ioctls.h
new file mode 100644
index 000000000000..0cf2c0a4502b
--- /dev/null
+++ b/arch/avr32/include/asm/ioctls.h
@@ -0,0 +1,87 @@
1#ifndef __ASM_AVR32_IOCTLS_H
2#define __ASM_AVR32_IOCTLS_H
3
4#include <asm/ioctl.h>
5
6/* 0x54 is just a magic number to make these relatively unique ('T') */
7
8#define TCGETS 0x5401
9#define TCSETS 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
10#define TCSETSW 0x5403
11#define TCSETSF 0x5404
12#define TCGETA 0x5405
13#define TCSETA 0x5406
14#define TCSETAW 0x5407
15#define TCSETAF 0x5408
16#define TCSBRK 0x5409
17#define TCXONC 0x540A
18#define TCFLSH 0x540B
19#define TIOCEXCL 0x540C
20#define TIOCNXCL 0x540D
21#define TIOCSCTTY 0x540E
22#define TIOCGPGRP 0x540F
23#define TIOCSPGRP 0x5410
24#define TIOCOUTQ 0x5411
25#define TIOCSTI 0x5412
26#define TIOCGWINSZ 0x5413
27#define TIOCSWINSZ 0x5414
28#define TIOCMGET 0x5415
29#define TIOCMBIS 0x5416
30#define TIOCMBIC 0x5417
31#define TIOCMSET 0x5418
32#define TIOCGSOFTCAR 0x5419
33#define TIOCSSOFTCAR 0x541A
34#define FIONREAD 0x541B
35#define TIOCINQ FIONREAD
36#define TIOCLINUX 0x541C
37#define TIOCCONS 0x541D
38#define TIOCGSERIAL 0x541E
39#define TIOCSSERIAL 0x541F
40#define TIOCPKT 0x5420
41#define FIONBIO 0x5421
42#define TIOCNOTTY 0x5422
43#define TIOCSETD 0x5423
44#define TIOCGETD 0x5424
45#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
46/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TCGETS2 _IOR('T',0x2A, struct termios2)
51#define TCSETS2 _IOW('T',0x2B, struct termios2)
52#define TCSETSW2 _IOW('T',0x2C, struct termios2)
53#define TCSETSF2 _IOW('T',0x2D, struct termios2)
54#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
55#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
56
57#define FIONCLEX 0x5450
58#define FIOCLEX 0x5451
59#define FIOASYNC 0x5452
60#define TIOCSERCONFIG 0x5453
61#define TIOCSERGWILD 0x5454
62#define TIOCSERSWILD 0x5455
63#define TIOCGLCKTRMIOS 0x5456
64#define TIOCSLCKTRMIOS 0x5457
65#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
66#define TIOCSERGETLSR 0x5459 /* Get line status register */
67#define TIOCSERGETMULTI 0x545A /* Get multiport config */
68#define TIOCSERSETMULTI 0x545B /* Set multiport config */
69
70#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
71#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
72#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
73#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
74#define FIOQSIZE 0x5460
75
76/* Used for packet mode */
77#define TIOCPKT_DATA 0
78#define TIOCPKT_FLUSHREAD 1
79#define TIOCPKT_FLUSHWRITE 2
80#define TIOCPKT_STOP 4
81#define TIOCPKT_START 8
82#define TIOCPKT_NOSTOP 16
83#define TIOCPKT_DOSTOP 32
84
85#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
86
87#endif /* __ASM_AVR32_IOCTLS_H */
diff --git a/arch/avr32/include/asm/ipcbuf.h b/arch/avr32/include/asm/ipcbuf.h
new file mode 100644
index 000000000000..1552c9698f5e
--- /dev/null
+++ b/arch/avr32/include/asm/ipcbuf.h
@@ -0,0 +1,29 @@
1#ifndef __ASM_AVR32_IPCBUF_H
2#define __ASM_AVR32_IPCBUF_H
3
4/*
5* The user_ipc_perm structure for AVR32 architecture.
6* Note extra padding because this structure is passed back and forth
7* between kernel and user space.
8*
9* Pad space is left for:
10* - 32-bit mode_t and seq
11* - 2 miscellaneous 32-bit values
12*/
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __ASM_AVR32_IPCBUF_H */
diff --git a/arch/avr32/include/asm/irq.h b/arch/avr32/include/asm/irq.h
new file mode 100644
index 000000000000..6fa8913f8548
--- /dev/null
+++ b/arch/avr32/include/asm/irq.h
@@ -0,0 +1,24 @@
1#ifndef __ASM_AVR32_IRQ_H
2#define __ASM_AVR32_IRQ_H
3
4#define NR_INTERNAL_IRQS 64
5
6#include <mach/irq.h>
7
8#ifndef NR_IRQS
9#define NR_IRQS (NR_INTERNAL_IRQS)
10#endif
11
12#define irq_canonicalize(i) (i)
13
14#ifndef __ASSEMBLER__
15int nmi_enable(void);
16void nmi_disable(void);
17
18/*
19 * Returns a bitmask of pending interrupts in a group.
20 */
21extern unsigned long intc_get_pending(unsigned int group);
22#endif
23
24#endif /* __ASM_AVR32_IOCTLS_H */
diff --git a/arch/avr32/include/asm/irq_regs.h b/arch/avr32/include/asm/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/arch/avr32/include/asm/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/arch/avr32/include/asm/irqflags.h b/arch/avr32/include/asm/irqflags.h
new file mode 100644
index 000000000000..93570daac38a
--- /dev/null
+++ b/arch/avr32/include/asm/irqflags.h
@@ -0,0 +1,68 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_IRQFLAGS_H
9#define __ASM_AVR32_IRQFLAGS_H
10
11#include <asm/sysreg.h>
12
13static inline unsigned long __raw_local_save_flags(void)
14{
15 return sysreg_read(SR);
16}
17
18#define raw_local_save_flags(x) \
19 do { (x) = __raw_local_save_flags(); } while (0)
20
21/*
22 * This will restore ALL status register flags, not only the interrupt
23 * mask flag.
24 *
25 * The empty asm statement informs the compiler of this fact while
26 * also serving as a barrier.
27 */
28static inline void raw_local_irq_restore(unsigned long flags)
29{
30 sysreg_write(SR, flags);
31 asm volatile("" : : : "memory", "cc");
32}
33
34static inline void raw_local_irq_disable(void)
35{
36 asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");
37}
38
39static inline void raw_local_irq_enable(void)
40{
41 asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");
42}
43
44static inline int raw_irqs_disabled_flags(unsigned long flags)
45{
46 return (flags & SYSREG_BIT(GM)) != 0;
47}
48
49static inline int raw_irqs_disabled(void)
50{
51 unsigned long flags = __raw_local_save_flags();
52
53 return raw_irqs_disabled_flags(flags);
54}
55
56static inline unsigned long __raw_local_irq_save(void)
57{
58 unsigned long flags = __raw_local_save_flags();
59
60 raw_local_irq_disable();
61
62 return flags;
63}
64
65#define raw_local_irq_save(flags) \
66 do { (flags) = __raw_local_irq_save(); } while (0)
67
68#endif /* __ASM_AVR32_IRQFLAGS_H */
diff --git a/arch/avr32/include/asm/kdebug.h b/arch/avr32/include/asm/kdebug.h
new file mode 100644
index 000000000000..ca4f9542365a
--- /dev/null
+++ b/arch/avr32/include/asm/kdebug.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_AVR32_KDEBUG_H
2#define __ASM_AVR32_KDEBUG_H
3
4/* Grossly misnamed. */
5enum die_val {
6 DIE_BREAKPOINT,
7 DIE_SSTEP,
8 DIE_NMI,
9};
10
11#endif /* __ASM_AVR32_KDEBUG_H */
diff --git a/arch/avr32/include/asm/kmap_types.h b/arch/avr32/include/asm/kmap_types.h
new file mode 100644
index 000000000000..b7f5c6870107
--- /dev/null
+++ b/arch/avr32/include/asm/kmap_types.h
@@ -0,0 +1,30 @@
1#ifndef __ASM_AVR32_KMAP_TYPES_H
2#define __ASM_AVR32_KMAP_TYPES_H
3
4#ifdef CONFIG_DEBUG_HIGHMEM
5# define D(n) __KM_FENCE_##n ,
6#else
7# define D(n)
8#endif
9
10enum km_type {
11D(0) KM_BOUNCE_READ,
12D(1) KM_SKB_SUNRPC_DATA,
13D(2) KM_SKB_DATA_SOFTIRQ,
14D(3) KM_USER0,
15D(4) KM_USER1,
16D(5) KM_BIO_SRC_IRQ,
17D(6) KM_BIO_DST_IRQ,
18D(7) KM_PTE0,
19D(8) KM_PTE1,
20D(9) KM_PTE2,
21D(10) KM_IRQ0,
22D(11) KM_IRQ1,
23D(12) KM_SOFTIRQ0,
24D(13) KM_SOFTIRQ1,
25D(14) KM_TYPE_NR
26};
27
28#undef D
29
30#endif /* __ASM_AVR32_KMAP_TYPES_H */
diff --git a/arch/avr32/include/asm/kprobes.h b/arch/avr32/include/asm/kprobes.h
new file mode 100644
index 000000000000..996cb656474e
--- /dev/null
+++ b/arch/avr32/include/asm/kprobes.h
@@ -0,0 +1,35 @@
1/*
2 * Kernel Probes (KProbes)
3 *
4 * Copyright (C) 2005-2006 Atmel Corporation
5 * Copyright (C) IBM Corporation, 2002, 2004
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#ifndef __ASM_AVR32_KPROBES_H
12#define __ASM_AVR32_KPROBES_H
13
14#include <linux/types.h>
15
16typedef u16 kprobe_opcode_t;
17#define BREAKPOINT_INSTRUCTION 0xd673 /* breakpoint */
18#define MAX_INSN_SIZE 2
19
20#define kretprobe_blacklist_size 0
21
22#define arch_remove_kprobe(p) do { } while (0)
23
24/* Architecture specific copy of original instruction */
25struct arch_specific_insn {
26 kprobe_opcode_t insn[MAX_INSN_SIZE];
27};
28
29extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
30extern int kprobe_exceptions_notify(struct notifier_block *self,
31 unsigned long val, void *data);
32
33#define flush_insn_slot(p) do { } while (0)
34
35#endif /* __ASM_AVR32_KPROBES_H */
diff --git a/arch/avr32/include/asm/linkage.h b/arch/avr32/include/asm/linkage.h
new file mode 100644
index 000000000000..f7b285e910d4
--- /dev/null
+++ b/arch/avr32/include/asm/linkage.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4#define __ALIGN .balign 2
5#define __ALIGN_STR ".balign 2"
6
7#endif /* __ASM_LINKAGE_H */
diff --git a/arch/avr32/include/asm/local.h b/arch/avr32/include/asm/local.h
new file mode 100644
index 000000000000..1c1619694da3
--- /dev/null
+++ b/arch/avr32/include/asm/local.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_LOCAL_H
2#define __ASM_AVR32_LOCAL_H
3
4#include <asm-generic/local.h>
5
6#endif /* __ASM_AVR32_LOCAL_H */
diff --git a/arch/avr32/include/asm/mach/serial_at91.h b/arch/avr32/include/asm/mach/serial_at91.h
new file mode 100644
index 000000000000..55b317a89061
--- /dev/null
+++ b/arch/avr32/include/asm/mach/serial_at91.h
@@ -0,0 +1,33 @@
1/*
2 * linux/include/asm-arm/mach/serial_at91.h
3 *
4 * Based on serial_sa1100.h by Nicolas Pitre
5 *
6 * Copyright (C) 2002 ATMEL Rousset
7 *
8 * Low level machine dependent UART functions.
9 */
10
11struct uart_port;
12
13/*
14 * This is a temporary structure for registering these
15 * functions; it is intended to be discarded after boot.
16 */
17struct atmel_port_fns {
18 void (*set_mctrl)(struct uart_port *, u_int);
19 u_int (*get_mctrl)(struct uart_port *);
20 void (*enable_ms)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23 int (*open)(struct uart_port *);
24 void (*close)(struct uart_port *);
25};
26
27#if defined(CONFIG_SERIAL_ATMEL)
28void atmel_register_uart_fns(struct atmel_port_fns *fns);
29#else
30#define atmel_register_uart_fns(fns) do { } while (0)
31#endif
32
33
diff --git a/arch/avr32/include/asm/mman.h b/arch/avr32/include/asm/mman.h
new file mode 100644
index 000000000000..648f91e7187a
--- /dev/null
+++ b/arch/avr32/include/asm/mman.h
@@ -0,0 +1,17 @@
1#ifndef __ASM_AVR32_MMAN_H__
2#define __ASM_AVR32_MMAN_H__
3
4#include <asm-generic/mman.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __ASM_AVR32_MMAN_H__ */
diff --git a/arch/avr32/include/asm/mmu.h b/arch/avr32/include/asm/mmu.h
new file mode 100644
index 000000000000..60c2d2650d32
--- /dev/null
+++ b/arch/avr32/include/asm/mmu.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_AVR32_MMU_H
2#define __ASM_AVR32_MMU_H
3
4/* Default "unsigned long" context */
5typedef unsigned long mm_context_t;
6
7#define MMU_ITLB_ENTRIES 64
8#define MMU_DTLB_ENTRIES 64
9
10#endif /* __ASM_AVR32_MMU_H */
diff --git a/arch/avr32/include/asm/mmu_context.h b/arch/avr32/include/asm/mmu_context.h
new file mode 100644
index 000000000000..27ff23407100
--- /dev/null
+++ b/arch/avr32/include/asm/mmu_context.h
@@ -0,0 +1,148 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * ASID handling taken from SH implementation.
5 * Copyright (C) 1999 Niibe Yutaka
6 * Copyright (C) 2003 Paul Mundt
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#ifndef __ASM_AVR32_MMU_CONTEXT_H
13#define __ASM_AVR32_MMU_CONTEXT_H
14
15#include <asm/tlbflush.h>
16#include <asm/sysreg.h>
17#include <asm-generic/mm_hooks.h>
18
19/*
20 * The MMU "context" consists of two things:
21 * (a) TLB cache version
22 * (b) ASID (Address Space IDentifier)
23 */
24#define MMU_CONTEXT_ASID_MASK 0x000000ff
25#define MMU_CONTEXT_VERSION_MASK 0xffffff00
26#define MMU_CONTEXT_FIRST_VERSION 0x00000100
27#define NO_CONTEXT 0
28
29#define MMU_NO_ASID 0x100
30
31/* Virtual Page Number mask */
32#define MMU_VPN_MASK 0xfffff000
33
34/* Cache of MMU context last used */
35extern unsigned long mmu_context_cache;
36
37/*
38 * Get MMU context if needed
39 */
40static inline void
41get_mmu_context(struct mm_struct *mm)
42{
43 unsigned long mc = mmu_context_cache;
44
45 if (((mm->context ^ mc) & MMU_CONTEXT_VERSION_MASK) == 0)
46 /* It's up to date, do nothing */
47 return;
48
49 /* It's old, we need to get new context with new version */
50 mc = ++mmu_context_cache;
51 if (!(mc & MMU_CONTEXT_ASID_MASK)) {
52 /*
53 * We have exhausted all ASIDs of this version.
54 * Flush the TLB and start new cycle.
55 */
56 flush_tlb_all();
57 /*
58 * Fix version. Note that we avoid version #0
59 * to distinguish NO_CONTEXT.
60 */
61 if (!mc)
62 mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION;
63 }
64 mm->context = mc;
65}
66
67/*
68 * Initialize the context related info for a new mm_struct
69 * instance.
70 */
71static inline int init_new_context(struct task_struct *tsk,
72 struct mm_struct *mm)
73{
74 mm->context = NO_CONTEXT;
75 return 0;
76}
77
78/*
79 * Destroy context related info for an mm_struct that is about
80 * to be put to rest.
81 */
82static inline void destroy_context(struct mm_struct *mm)
83{
84 /* Do nothing */
85}
86
87static inline void set_asid(unsigned long asid)
88{
89 /* XXX: We're destroying TLBEHI[8:31] */
90 sysreg_write(TLBEHI, asid & MMU_CONTEXT_ASID_MASK);
91 cpu_sync_pipeline();
92}
93
94static inline unsigned long get_asid(void)
95{
96 unsigned long asid;
97
98 asid = sysreg_read(TLBEHI);
99 return asid & MMU_CONTEXT_ASID_MASK;
100}
101
102static inline void activate_context(struct mm_struct *mm)
103{
104 get_mmu_context(mm);
105 set_asid(mm->context & MMU_CONTEXT_ASID_MASK);
106}
107
108static inline void switch_mm(struct mm_struct *prev,
109 struct mm_struct *next,
110 struct task_struct *tsk)
111{
112 if (likely(prev != next)) {
113 unsigned long __pgdir = (unsigned long)next->pgd;
114
115 sysreg_write(PTBR, __pgdir);
116 activate_context(next);
117 }
118}
119
120#define deactivate_mm(tsk,mm) do { } while(0)
121
122#define activate_mm(prev, next) switch_mm((prev), (next), NULL)
123
124static inline void
125enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
126{
127}
128
129
130static inline void enable_mmu(void)
131{
132 sysreg_write(MMUCR, (SYSREG_BIT(MMUCR_S)
133 | SYSREG_BIT(E)
134 | SYSREG_BIT(MMUCR_I)));
135 nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop();
136
137 if (mmu_context_cache == NO_CONTEXT)
138 mmu_context_cache = MMU_CONTEXT_FIRST_VERSION;
139
140 set_asid(mmu_context_cache & MMU_CONTEXT_ASID_MASK);
141}
142
143static inline void disable_mmu(void)
144{
145 sysreg_write(MMUCR, SYSREG_BIT(MMUCR_S));
146}
147
148#endif /* __ASM_AVR32_MMU_CONTEXT_H */
diff --git a/arch/avr32/include/asm/module.h b/arch/avr32/include/asm/module.h
new file mode 100644
index 000000000000..451444538a1b
--- /dev/null
+++ b/arch/avr32/include/asm/module.h
@@ -0,0 +1,28 @@
1#ifndef __ASM_AVR32_MODULE_H
2#define __ASM_AVR32_MODULE_H
3
4struct mod_arch_syminfo {
5 unsigned long got_offset;
6 int got_initialized;
7};
8
9struct mod_arch_specific {
10 /* Starting offset of got in the module core memory. */
11 unsigned long got_offset;
12 /* Size of the got. */
13 unsigned long got_size;
14 /* Number of symbols in syminfo. */
15 int nsyms;
16 /* Additional symbol information (got offsets). */
17 struct mod_arch_syminfo *syminfo;
18};
19
20#define Elf_Shdr Elf32_Shdr
21#define Elf_Sym Elf32_Sym
22#define Elf_Ehdr Elf32_Ehdr
23
24#define MODULE_PROC_FAMILY "AVR32v1"
25
26#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
27
28#endif /* __ASM_AVR32_MODULE_H */
diff --git a/arch/avr32/include/asm/msgbuf.h b/arch/avr32/include/asm/msgbuf.h
new file mode 100644
index 000000000000..ac18bc4da7f7
--- /dev/null
+++ b/arch/avr32/include/asm/msgbuf.h
@@ -0,0 +1,31 @@
1#ifndef __ASM_AVR32_MSGBUF_H
2#define __ASM_AVR32_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for i386 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* __ASM_AVR32_MSGBUF_H */
diff --git a/arch/avr32/include/asm/mutex.h b/arch/avr32/include/asm/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/arch/avr32/include/asm/mutex.h
@@ -0,0 +1,9 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/arch/avr32/include/asm/numnodes.h b/arch/avr32/include/asm/numnodes.h
new file mode 100644
index 000000000000..0b864d7ce330
--- /dev/null
+++ b/arch/avr32/include/asm/numnodes.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_AVR32_NUMNODES_H
2#define __ASM_AVR32_NUMNODES_H
3
4/* Max 4 nodes */
5#define NODES_SHIFT 2
6
7#endif /* __ASM_AVR32_NUMNODES_H */
diff --git a/arch/avr32/include/asm/ocd.h b/arch/avr32/include/asm/ocd.h
new file mode 100644
index 000000000000..6bef09490235
--- /dev/null
+++ b/arch/avr32/include/asm/ocd.h
@@ -0,0 +1,543 @@
1/*
2 * AVR32 OCD Interface and register definitions
3 *
4 * Copyright (C) 2004-2007 Atmel Corporation
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_AVR32_OCD_H
11#define __ASM_AVR32_OCD_H
12
13/* OCD Register offsets. Abbreviations used below:
14 *
15 * BP Breakpoint
16 * Comm Communication
17 * DT Data Trace
18 * PC Program Counter
19 * PID Process ID
20 * R/W Read/Write
21 * WP Watchpoint
22 */
23#define OCD_DID 0x0000 /* Device ID */
24#define OCD_DC 0x0008 /* Development Control */
25#define OCD_DS 0x0010 /* Development Status */
26#define OCD_RWCS 0x001c /* R/W Access Control */
27#define OCD_RWA 0x0024 /* R/W Access Address */
28#define OCD_RWD 0x0028 /* R/W Access Data */
29#define OCD_WT 0x002c /* Watchpoint Trigger */
30#define OCD_DTC 0x0034 /* Data Trace Control */
31#define OCD_DTSA0 0x0038 /* DT Start Addr Channel 0 */
32#define OCD_DTSA1 0x003c /* DT Start Addr Channel 1 */
33#define OCD_DTEA0 0x0048 /* DT End Addr Channel 0 */
34#define OCD_DTEA1 0x004c /* DT End Addr Channel 1 */
35#define OCD_BWC0A 0x0058 /* PC BP/WP Control 0A */
36#define OCD_BWC0B 0x005c /* PC BP/WP Control 0B */
37#define OCD_BWC1A 0x0060 /* PC BP/WP Control 1A */
38#define OCD_BWC1B 0x0064 /* PC BP/WP Control 1B */
39#define OCD_BWC2A 0x0068 /* PC BP/WP Control 2A */
40#define OCD_BWC2B 0x006c /* PC BP/WP Control 2B */
41#define OCD_BWC3A 0x0070 /* Data BP/WP Control 3A */
42#define OCD_BWC3B 0x0074 /* Data BP/WP Control 3B */
43#define OCD_BWA0A 0x0078 /* PC BP/WP Address 0A */
44#define OCD_BWA0B 0x007c /* PC BP/WP Address 0B */
45#define OCD_BWA1A 0x0080 /* PC BP/WP Address 1A */
46#define OCD_BWA1B 0x0084 /* PC BP/WP Address 1B */
47#define OCD_BWA2A 0x0088 /* PC BP/WP Address 2A */
48#define OCD_BWA2B 0x008c /* PC BP/WP Address 2B */
49#define OCD_BWA3A 0x0090 /* Data BP/WP Address 3A */
50#define OCD_BWA3B 0x0094 /* Data BP/WP Address 3B */
51#define OCD_NXCFG 0x0100 /* Nexus Configuration */
52#define OCD_DINST 0x0104 /* Debug Instruction */
53#define OCD_DPC 0x0108 /* Debug Program Counter */
54#define OCD_CPUCM 0x010c /* CPU Control Mask */
55#define OCD_DCCPU 0x0110 /* Debug Comm CPU */
56#define OCD_DCEMU 0x0114 /* Debug Comm Emulator */
57#define OCD_DCSR 0x0118 /* Debug Comm Status */
58#define OCD_PID 0x011c /* Ownership Trace PID */
59#define OCD_EPC0 0x0120 /* Event Pair Control 0 */
60#define OCD_EPC1 0x0124 /* Event Pair Control 1 */
61#define OCD_EPC2 0x0128 /* Event Pair Control 2 */
62#define OCD_EPC3 0x012c /* Event Pair Control 3 */
63#define OCD_AXC 0x0130 /* AUX port Control */
64
65/* Bits in DID */
66#define OCD_DID_MID_START 1
67#define OCD_DID_MID_SIZE 11
68#define OCD_DID_PN_START 12
69#define OCD_DID_PN_SIZE 16
70#define OCD_DID_RN_START 28
71#define OCD_DID_RN_SIZE 4
72
73/* Bits in DC */
74#define OCD_DC_TM_START 0
75#define OCD_DC_TM_SIZE 2
76#define OCD_DC_EIC_START 3
77#define OCD_DC_EIC_SIZE 2
78#define OCD_DC_OVC_START 5
79#define OCD_DC_OVC_SIZE 3
80#define OCD_DC_SS_BIT 8
81#define OCD_DC_DBR_BIT 12
82#define OCD_DC_DBE_BIT 13
83#define OCD_DC_EOS_START 20
84#define OCD_DC_EOS_SIZE 2
85#define OCD_DC_SQA_BIT 22
86#define OCD_DC_IRP_BIT 23
87#define OCD_DC_IFM_BIT 24
88#define OCD_DC_TOZ_BIT 25
89#define OCD_DC_TSR_BIT 26
90#define OCD_DC_RID_BIT 27
91#define OCD_DC_ORP_BIT 28
92#define OCD_DC_MM_BIT 29
93#define OCD_DC_RES_BIT 30
94#define OCD_DC_ABORT_BIT 31
95
96/* Bits in DS */
97#define OCD_DS_SSS_BIT 0
98#define OCD_DS_SWB_BIT 1
99#define OCD_DS_HWB_BIT 2
100#define OCD_DS_HWE_BIT 3
101#define OCD_DS_STP_BIT 4
102#define OCD_DS_DBS_BIT 5
103#define OCD_DS_BP_START 8
104#define OCD_DS_BP_SIZE 8
105#define OCD_DS_INC_BIT 24
106#define OCD_DS_BOZ_BIT 25
107#define OCD_DS_DBA_BIT 26
108#define OCD_DS_EXB_BIT 27
109#define OCD_DS_NTBF_BIT 28
110
111/* Bits in RWCS */
112#define OCD_RWCS_DV_BIT 0
113#define OCD_RWCS_ERR_BIT 1
114#define OCD_RWCS_CNT_START 2
115#define OCD_RWCS_CNT_SIZE 14
116#define OCD_RWCS_CRC_BIT 19
117#define OCD_RWCS_NTBC_START 20
118#define OCD_RWCS_NTBC_SIZE 2
119#define OCD_RWCS_NTE_BIT 22
120#define OCD_RWCS_NTAP_BIT 23
121#define OCD_RWCS_WRAPPED_BIT 24
122#define OCD_RWCS_CCTRL_START 25
123#define OCD_RWCS_CCTRL_SIZE 2
124#define OCD_RWCS_SZ_START 27
125#define OCD_RWCS_SZ_SIZE 3
126#define OCD_RWCS_RW_BIT 30
127#define OCD_RWCS_AC_BIT 31
128
129/* Bits in RWA */
130#define OCD_RWA_RWA_START 0
131#define OCD_RWA_RWA_SIZE 32
132
133/* Bits in RWD */
134#define OCD_RWD_RWD_START 0
135#define OCD_RWD_RWD_SIZE 32
136
137/* Bits in WT */
138#define OCD_WT_DTE_START 20
139#define OCD_WT_DTE_SIZE 3
140#define OCD_WT_DTS_START 23
141#define OCD_WT_DTS_SIZE 3
142#define OCD_WT_PTE_START 26
143#define OCD_WT_PTE_SIZE 3
144#define OCD_WT_PTS_START 29
145#define OCD_WT_PTS_SIZE 3
146
147/* Bits in DTC */
148#define OCD_DTC_T0WP_BIT 0
149#define OCD_DTC_T1WP_BIT 1
150#define OCD_DTC_ASID0EN_BIT 2
151#define OCD_DTC_ASID0_START 3
152#define OCD_DTC_ASID0_SIZE 8
153#define OCD_DTC_ASID1EN_BIT 11
154#define OCD_DTC_ASID1_START 12
155#define OCD_DTC_ASID1_SIZE 8
156#define OCD_DTC_RWT1_START 28
157#define OCD_DTC_RWT1_SIZE 2
158#define OCD_DTC_RWT0_START 30
159#define OCD_DTC_RWT0_SIZE 2
160
161/* Bits in DTSA0 */
162#define OCD_DTSA0_DTSA_START 0
163#define OCD_DTSA0_DTSA_SIZE 32
164
165/* Bits in DTSA1 */
166#define OCD_DTSA1_DTSA_START 0
167#define OCD_DTSA1_DTSA_SIZE 32
168
169/* Bits in DTEA0 */
170#define OCD_DTEA0_DTEA_START 0
171#define OCD_DTEA0_DTEA_SIZE 32
172
173/* Bits in DTEA1 */
174#define OCD_DTEA1_DTEA_START 0
175#define OCD_DTEA1_DTEA_SIZE 32
176
177/* Bits in BWC0A */
178#define OCD_BWC0A_ASIDEN_BIT 0
179#define OCD_BWC0A_ASID_START 1
180#define OCD_BWC0A_ASID_SIZE 8
181#define OCD_BWC0A_EOC_BIT 14
182#define OCD_BWC0A_AME_BIT 25
183#define OCD_BWC0A_BWE_START 30
184#define OCD_BWC0A_BWE_SIZE 2
185
186/* Bits in BWC0B */
187#define OCD_BWC0B_ASIDEN_BIT 0
188#define OCD_BWC0B_ASID_START 1
189#define OCD_BWC0B_ASID_SIZE 8
190#define OCD_BWC0B_EOC_BIT 14
191#define OCD_BWC0B_AME_BIT 25
192#define OCD_BWC0B_BWE_START 30
193#define OCD_BWC0B_BWE_SIZE 2
194
195/* Bits in BWC1A */
196#define OCD_BWC1A_ASIDEN_BIT 0
197#define OCD_BWC1A_ASID_START 1
198#define OCD_BWC1A_ASID_SIZE 8
199#define OCD_BWC1A_EOC_BIT 14
200#define OCD_BWC1A_AME_BIT 25
201#define OCD_BWC1A_BWE_START 30
202#define OCD_BWC1A_BWE_SIZE 2
203
204/* Bits in BWC1B */
205#define OCD_BWC1B_ASIDEN_BIT 0
206#define OCD_BWC1B_ASID_START 1
207#define OCD_BWC1B_ASID_SIZE 8
208#define OCD_BWC1B_EOC_BIT 14
209#define OCD_BWC1B_AME_BIT 25
210#define OCD_BWC1B_BWE_START 30
211#define OCD_BWC1B_BWE_SIZE 2
212
213/* Bits in BWC2A */
214#define OCD_BWC2A_ASIDEN_BIT 0
215#define OCD_BWC2A_ASID_START 1
216#define OCD_BWC2A_ASID_SIZE 8
217#define OCD_BWC2A_EOC_BIT 14
218#define OCD_BWC2A_AMB_START 20
219#define OCD_BWC2A_AMB_SIZE 5
220#define OCD_BWC2A_AME_BIT 25
221#define OCD_BWC2A_BWE_START 30
222#define OCD_BWC2A_BWE_SIZE 2
223
224/* Bits in BWC2B */
225#define OCD_BWC2B_ASIDEN_BIT 0
226#define OCD_BWC2B_ASID_START 1
227#define OCD_BWC2B_ASID_SIZE 8
228#define OCD_BWC2B_EOC_BIT 14
229#define OCD_BWC2B_AME_BIT 25
230#define OCD_BWC2B_BWE_START 30
231#define OCD_BWC2B_BWE_SIZE 2
232
233/* Bits in BWC3A */
234#define OCD_BWC3A_ASIDEN_BIT 0
235#define OCD_BWC3A_ASID_START 1
236#define OCD_BWC3A_ASID_SIZE 8
237#define OCD_BWC3A_SIZE_START 9
238#define OCD_BWC3A_SIZE_SIZE 3
239#define OCD_BWC3A_EOC_BIT 14
240#define OCD_BWC3A_BWO_START 16
241#define OCD_BWC3A_BWO_SIZE 2
242#define OCD_BWC3A_BME_START 20
243#define OCD_BWC3A_BME_SIZE 4
244#define OCD_BWC3A_BRW_START 28
245#define OCD_BWC3A_BRW_SIZE 2
246#define OCD_BWC3A_BWE_START 30
247#define OCD_BWC3A_BWE_SIZE 2
248
249/* Bits in BWC3B */
250#define OCD_BWC3B_ASIDEN_BIT 0
251#define OCD_BWC3B_ASID_START 1
252#define OCD_BWC3B_ASID_SIZE 8
253#define OCD_BWC3B_SIZE_START 9
254#define OCD_BWC3B_SIZE_SIZE 3
255#define OCD_BWC3B_EOC_BIT 14
256#define OCD_BWC3B_BWO_START 16
257#define OCD_BWC3B_BWO_SIZE 2
258#define OCD_BWC3B_BME_START 20
259#define OCD_BWC3B_BME_SIZE 4
260#define OCD_BWC3B_BRW_START 28
261#define OCD_BWC3B_BRW_SIZE 2
262#define OCD_BWC3B_BWE_START 30
263#define OCD_BWC3B_BWE_SIZE 2
264
265/* Bits in BWA0A */
266#define OCD_BWA0A_BWA_START 0
267#define OCD_BWA0A_BWA_SIZE 32
268
269/* Bits in BWA0B */
270#define OCD_BWA0B_BWA_START 0
271#define OCD_BWA0B_BWA_SIZE 32
272
273/* Bits in BWA1A */
274#define OCD_BWA1A_BWA_START 0
275#define OCD_BWA1A_BWA_SIZE 32
276
277/* Bits in BWA1B */
278#define OCD_BWA1B_BWA_START 0
279#define OCD_BWA1B_BWA_SIZE 32
280
281/* Bits in BWA2A */
282#define OCD_BWA2A_BWA_START 0
283#define OCD_BWA2A_BWA_SIZE 32
284
285/* Bits in BWA2B */
286#define OCD_BWA2B_BWA_START 0
287#define OCD_BWA2B_BWA_SIZE 32
288
289/* Bits in BWA3A */
290#define OCD_BWA3A_BWA_START 0
291#define OCD_BWA3A_BWA_SIZE 32
292
293/* Bits in BWA3B */
294#define OCD_BWA3B_BWA_START 0
295#define OCD_BWA3B_BWA_SIZE 32
296
297/* Bits in NXCFG */
298#define OCD_NXCFG_NXARCH_START 0
299#define OCD_NXCFG_NXARCH_SIZE 4
300#define OCD_NXCFG_NXOCD_START 4
301#define OCD_NXCFG_NXOCD_SIZE 4
302#define OCD_NXCFG_NXPCB_START 8
303#define OCD_NXCFG_NXPCB_SIZE 4
304#define OCD_NXCFG_NXDB_START 12
305#define OCD_NXCFG_NXDB_SIZE 4
306#define OCD_NXCFG_MXMSEO_BIT 16
307#define OCD_NXCFG_NXMDO_START 17
308#define OCD_NXCFG_NXMDO_SIZE 4
309#define OCD_NXCFG_NXPT_BIT 21
310#define OCD_NXCFG_NXOT_BIT 22
311#define OCD_NXCFG_NXDWT_BIT 23
312#define OCD_NXCFG_NXDRT_BIT 24
313#define OCD_NXCFG_NXDTC_START 25
314#define OCD_NXCFG_NXDTC_SIZE 3
315#define OCD_NXCFG_NXDMA_BIT 28
316
317/* Bits in DINST */
318#define OCD_DINST_DINST_START 0
319#define OCD_DINST_DINST_SIZE 32
320
321/* Bits in CPUCM */
322#define OCD_CPUCM_BEM_BIT 1
323#define OCD_CPUCM_FEM_BIT 2
324#define OCD_CPUCM_REM_BIT 3
325#define OCD_CPUCM_IBEM_BIT 4
326#define OCD_CPUCM_IEEM_BIT 5
327
328/* Bits in DCCPU */
329#define OCD_DCCPU_DATA_START 0
330#define OCD_DCCPU_DATA_SIZE 32
331
332/* Bits in DCEMU */
333#define OCD_DCEMU_DATA_START 0
334#define OCD_DCEMU_DATA_SIZE 32
335
336/* Bits in DCSR */
337#define OCD_DCSR_CPUD_BIT 0
338#define OCD_DCSR_EMUD_BIT 1
339
340/* Bits in PID */
341#define OCD_PID_PROCESS_START 0
342#define OCD_PID_PROCESS_SIZE 32
343
344/* Bits in EPC0 */
345#define OCD_EPC0_RNG_START 0
346#define OCD_EPC0_RNG_SIZE 2
347#define OCD_EPC0_CE_BIT 4
348#define OCD_EPC0_ECNT_START 16
349#define OCD_EPC0_ECNT_SIZE 16
350
351/* Bits in EPC1 */
352#define OCD_EPC1_RNG_START 0
353#define OCD_EPC1_RNG_SIZE 2
354#define OCD_EPC1_ATB_BIT 5
355#define OCD_EPC1_AM_BIT 6
356
357/* Bits in EPC2 */
358#define OCD_EPC2_RNG_START 0
359#define OCD_EPC2_RNG_SIZE 2
360#define OCD_EPC2_DB_START 2
361#define OCD_EPC2_DB_SIZE 2
362
363/* Bits in EPC3 */
364#define OCD_EPC3_RNG_START 0
365#define OCD_EPC3_RNG_SIZE 2
366#define OCD_EPC3_DWE_BIT 2
367
368/* Bits in AXC */
369#define OCD_AXC_DIV_START 0
370#define OCD_AXC_DIV_SIZE 4
371#define OCD_AXC_AXE_BIT 8
372#define OCD_AXC_AXS_BIT 9
373#define OCD_AXC_DDR_BIT 10
374#define OCD_AXC_LS_BIT 11
375#define OCD_AXC_REX_BIT 12
376#define OCD_AXC_REXTEN_BIT 13
377
378/* Constants for DC:EIC */
379#define OCD_EIC_PROGRAM_AND_DATA_TRACE 0
380#define OCD_EIC_BREAKPOINT 1
381#define OCD_EIC_NOP 2
382
383/* Constants for DC:OVC */
384#define OCD_OVC_OVERRUN 0
385#define OCD_OVC_DELAY_CPU_BTM 1
386#define OCD_OVC_DELAY_CPU_DTM 2
387#define OCD_OVC_DELAY_CPU_BTM_DTM 3
388
389/* Constants for DC:EOS */
390#define OCD_EOS_NOP 0
391#define OCD_EOS_DEBUG_MODE 1
392#define OCD_EOS_BREAKPOINT_WATCHPOINT 2
393#define OCD_EOS_THQ 3
394
395/* Constants for RWCS:NTBC */
396#define OCD_NTBC_OVERWRITE 0
397#define OCD_NTBC_DISABLE 1
398#define OCD_NTBC_BREAKPOINT 2
399
400/* Constants for RWCS:CCTRL */
401#define OCD_CCTRL_AUTO 0
402#define OCD_CCTRL_CACHED 1
403#define OCD_CCTRL_UNCACHED 2
404
405/* Constants for RWCS:SZ */
406#define OCD_SZ_BYTE 0
407#define OCD_SZ_HALFWORD 1
408#define OCD_SZ_WORD 2
409
410/* Constants for WT:PTS */
411#define OCD_PTS_DISABLED 0
412#define OCD_PTS_PROGRAM_0B 1
413#define OCD_PTS_PROGRAM_1A 2
414#define OCD_PTS_PROGRAM_1B 3
415#define OCD_PTS_PROGRAM_2A 4
416#define OCD_PTS_PROGRAM_2B 5
417#define OCD_PTS_DATA_3A 6
418#define OCD_PTS_DATA_3B 7
419
420/* Constants for DTC:RWT1 */
421#define OCD_RWT1_NO_TRACE 0
422#define OCD_RWT1_DATA_READ 1
423#define OCD_RWT1_DATA_WRITE 2
424#define OCD_RWT1_DATA_READ_WRITE 3
425
426/* Constants for DTC:RWT0 */
427#define OCD_RWT0_NO_TRACE 0
428#define OCD_RWT0_DATA_READ 1
429#define OCD_RWT0_DATA_WRITE 2
430#define OCD_RWT0_DATA_READ_WRITE 3
431
432/* Constants for BWC0A:BWE */
433#define OCD_BWE_DISABLED 0
434#define OCD_BWE_BREAKPOINT_ENABLED 1
435#define OCD_BWE_WATCHPOINT_ENABLED 3
436
437/* Constants for BWC0B:BWE */
438#define OCD_BWE_DISABLED 0
439#define OCD_BWE_BREAKPOINT_ENABLED 1
440#define OCD_BWE_WATCHPOINT_ENABLED 3
441
442/* Constants for BWC1A:BWE */
443#define OCD_BWE_DISABLED 0
444#define OCD_BWE_BREAKPOINT_ENABLED 1
445#define OCD_BWE_WATCHPOINT_ENABLED 3
446
447/* Constants for BWC1B:BWE */
448#define OCD_BWE_DISABLED 0
449#define OCD_BWE_BREAKPOINT_ENABLED 1
450#define OCD_BWE_WATCHPOINT_ENABLED 3
451
452/* Constants for BWC2A:BWE */
453#define OCD_BWE_DISABLED 0
454#define OCD_BWE_BREAKPOINT_ENABLED 1
455#define OCD_BWE_WATCHPOINT_ENABLED 3
456
457/* Constants for BWC2B:BWE */
458#define OCD_BWE_DISABLED 0
459#define OCD_BWE_BREAKPOINT_ENABLED 1
460#define OCD_BWE_WATCHPOINT_ENABLED 3
461
462/* Constants for BWC3A:SIZE */
463#define OCD_SIZE_BYTE_ACCESS 4
464#define OCD_SIZE_HALFWORD_ACCESS 5
465#define OCD_SIZE_WORD_ACCESS 6
466#define OCD_SIZE_DOUBLE_WORD_ACCESS 7
467
468/* Constants for BWC3A:BRW */
469#define OCD_BRW_READ_BREAK 0
470#define OCD_BRW_WRITE_BREAK 1
471#define OCD_BRW_ANY_ACCES_BREAK 2
472
473/* Constants for BWC3A:BWE */
474#define OCD_BWE_DISABLED 0
475#define OCD_BWE_BREAKPOINT_ENABLED 1
476#define OCD_BWE_WATCHPOINT_ENABLED 3
477
478/* Constants for BWC3B:SIZE */
479#define OCD_SIZE_BYTE_ACCESS 4
480#define OCD_SIZE_HALFWORD_ACCESS 5
481#define OCD_SIZE_WORD_ACCESS 6
482#define OCD_SIZE_DOUBLE_WORD_ACCESS 7
483
484/* Constants for BWC3B:BRW */
485#define OCD_BRW_READ_BREAK 0
486#define OCD_BRW_WRITE_BREAK 1
487#define OCD_BRW_ANY_ACCES_BREAK 2
488
489/* Constants for BWC3B:BWE */
490#define OCD_BWE_DISABLED 0
491#define OCD_BWE_BREAKPOINT_ENABLED 1
492#define OCD_BWE_WATCHPOINT_ENABLED 3
493
494/* Constants for EPC0:RNG */
495#define OCD_RNG_DISABLED 0
496#define OCD_RNG_EXCLUSIVE 1
497#define OCD_RNG_INCLUSIVE 2
498
499/* Constants for EPC1:RNG */
500#define OCD_RNG_DISABLED 0
501#define OCD_RNG_EXCLUSIVE 1
502#define OCD_RNG_INCLUSIVE 2
503
504/* Constants for EPC2:RNG */
505#define OCD_RNG_DISABLED 0
506#define OCD_RNG_EXCLUSIVE 1
507#define OCD_RNG_INCLUSIVE 2
508
509/* Constants for EPC2:DB */
510#define OCD_DB_DISABLED 0
511#define OCD_DB_CHAINED_B 1
512#define OCD_DB_CHAINED_A 2
513#define OCD_DB_AHAINED_A_AND_B 3
514
515/* Constants for EPC3:RNG */
516#define OCD_RNG_DISABLED 0
517#define OCD_RNG_EXCLUSIVE 1
518#define OCD_RNG_INCLUSIVE 2
519
520#ifndef __ASSEMBLER__
521
522/* Register access macros */
523static inline unsigned long __ocd_read(unsigned int reg)
524{
525 return __builtin_mfdr(reg);
526}
527
528static inline void __ocd_write(unsigned int reg, unsigned long value)
529{
530 __builtin_mtdr(reg, value);
531}
532
533#define ocd_read(reg) __ocd_read(OCD_##reg)
534#define ocd_write(reg, value) __ocd_write(OCD_##reg, value)
535
536struct task_struct;
537
538void ocd_enable(struct task_struct *child);
539void ocd_disable(struct task_struct *child);
540
541#endif /* !__ASSEMBLER__ */
542
543#endif /* __ASM_AVR32_OCD_H */
diff --git a/arch/avr32/include/asm/page.h b/arch/avr32/include/asm/page.h
new file mode 100644
index 000000000000..f805d1cb11bc
--- /dev/null
+++ b/arch/avr32/include/asm/page.h
@@ -0,0 +1,104 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PAGE_H
9#define __ASM_AVR32_PAGE_H
10
11#include <linux/const.h>
12
13/* PAGE_SHIFT determines the page size */
14#define PAGE_SHIFT 12
15#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
16#define PAGE_MASK (~(PAGE_SIZE-1))
17#define PTE_MASK PAGE_MASK
18
19#ifndef __ASSEMBLY__
20
21#include <asm/addrspace.h>
22
23extern void clear_page(void *to);
24extern void copy_page(void *to, void *from);
25
26#define clear_user_page(page, vaddr, pg) clear_page(page)
27#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
28
29/*
30 * These are used to make use of C type-checking..
31 */
32typedef struct { unsigned long pte; } pte_t;
33typedef struct { unsigned long pgd; } pgd_t;
34typedef struct { unsigned long pgprot; } pgprot_t;
35typedef struct page *pgtable_t;
36
37#define pte_val(x) ((x).pte)
38#define pgd_val(x) ((x).pgd)
39#define pgprot_val(x) ((x).pgprot)
40
41#define __pte(x) ((pte_t) { (x) })
42#define __pgd(x) ((pgd_t) { (x) })
43#define __pgprot(x) ((pgprot_t) { (x) })
44
45/* FIXME: These should be removed soon */
46extern unsigned long memory_start, memory_end;
47
48/* Pure 2^n version of get_order */
49static inline int get_order(unsigned long size)
50{
51 unsigned lz;
52
53 size = (size - 1) >> PAGE_SHIFT;
54 asm("clz %0, %1" : "=r"(lz) : "r"(size));
55 return 32 - lz;
56}
57
58#endif /* !__ASSEMBLY__ */
59
60/*
61 * The hardware maps the virtual addresses 0x80000000 -> 0x9fffffff
62 * permanently to the physical addresses 0x00000000 -> 0x1fffffff when
63 * segmentation is enabled. We want to make use of this in order to
64 * minimize TLB pressure.
65 */
66#define PAGE_OFFSET (0x80000000UL)
67
68/*
69 * ALSA uses virt_to_page() on DMA pages, which I'm not entirely sure
70 * is a good idea. Anyway, we can't simply subtract PAGE_OFFSET here
71 * in that case, so we'll have to mask out the three most significant
72 * bits of the address instead...
73 *
74 * What's the difference between __pa() and virt_to_phys() anyway?
75 */
76#define __pa(x) PHYSADDR(x)
77#define __va(x) ((void *)(P1SEGADDR(x)))
78
79#define MAP_NR(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> PAGE_SHIFT)
80
81#define phys_to_page(phys) (pfn_to_page(phys >> PAGE_SHIFT))
82#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
83
84#ifndef CONFIG_NEED_MULTIPLE_NODES
85
86#define PHYS_PFN_OFFSET (CONFIG_PHYS_OFFSET >> PAGE_SHIFT)
87
88#define pfn_to_page(pfn) (mem_map + ((pfn) - PHYS_PFN_OFFSET))
89#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + PHYS_PFN_OFFSET)
90#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
91#endif /* CONFIG_NEED_MULTIPLE_NODES */
92
93#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
94#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
95
96#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
97 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
98
99/*
100 * Memory above this physical address will be considered highmem.
101 */
102#define HIGHMEM_START 0x20000000UL
103
104#endif /* __ASM_AVR32_PAGE_H */
diff --git a/arch/avr32/include/asm/param.h b/arch/avr32/include/asm/param.h
new file mode 100644
index 000000000000..34bc8d4c3b29
--- /dev/null
+++ b/arch/avr32/include/asm/param.h
@@ -0,0 +1,23 @@
1#ifndef __ASM_AVR32_PARAM_H
2#define __ASM_AVR32_PARAM_H
3
4#ifdef __KERNEL__
5# define HZ CONFIG_HZ
6# define USER_HZ 100 /* User interfaces are in "ticks" */
7# define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
8#endif
9
10#ifndef HZ
11# define HZ 100
12#endif
13
14/* TODO: Should be configurable */
15#define EXEC_PAGESIZE 4096
16
17#ifndef NOGROUP
18# define NOGROUP (-1)
19#endif
20
21#define MAXHOSTNAMELEN 64
22
23#endif /* __ASM_AVR32_PARAM_H */
diff --git a/arch/avr32/include/asm/pci.h b/arch/avr32/include/asm/pci.h
new file mode 100644
index 000000000000..a32a02372017
--- /dev/null
+++ b/arch/avr32/include/asm/pci.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_AVR32_PCI_H__
2#define __ASM_AVR32_PCI_H__
3
4/* We don't support PCI yet, but some drivers require this file anyway */
5
6#define PCI_DMA_BUS_IS_PHYS (1)
7
8#include <asm-generic/pci-dma-compat.h>
9
10#endif /* __ASM_AVR32_PCI_H__ */
diff --git a/arch/avr32/include/asm/percpu.h b/arch/avr32/include/asm/percpu.h
new file mode 100644
index 000000000000..69227b4cd0d4
--- /dev/null
+++ b/arch/avr32/include/asm/percpu.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_PERCPU_H
2#define __ASM_AVR32_PERCPU_H
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ASM_AVR32_PERCPU_H */
diff --git a/arch/avr32/include/asm/pgalloc.h b/arch/avr32/include/asm/pgalloc.h
new file mode 100644
index 000000000000..640821323943
--- /dev/null
+++ b/arch/avr32/include/asm/pgalloc.h
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PGALLOC_H
9#define __ASM_AVR32_PGALLOC_H
10
11#include <linux/quicklist.h>
12#include <asm/page.h>
13#include <asm/pgtable.h>
14
15#define QUICK_PGD 0 /* Preserve kernel mappings over free */
16#define QUICK_PT 1 /* Zero on free */
17
18static inline void pmd_populate_kernel(struct mm_struct *mm,
19 pmd_t *pmd, pte_t *pte)
20{
21 set_pmd(pmd, __pmd((unsigned long)pte));
22}
23
24static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
25 pgtable_t pte)
26{
27 set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
28}
29#define pmd_pgtable(pmd) pmd_page(pmd)
30
31static inline void pgd_ctor(void *x)
32{
33 pgd_t *pgd = x;
34
35 memcpy(pgd + USER_PTRS_PER_PGD,
36 swapper_pg_dir + USER_PTRS_PER_PGD,
37 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
38}
39
40/*
41 * Allocate and free page tables
42 */
43static inline pgd_t *pgd_alloc(struct mm_struct *mm)
44{
45 return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor);
46}
47
48static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
49{
50 quicklist_free(QUICK_PGD, NULL, pgd);
51}
52
53static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
54 unsigned long address)
55{
56 return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
57}
58
59static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
60 unsigned long address)
61{
62 struct page *page;
63 void *pg;
64
65 pg = quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
66 if (!pg)
67 return NULL;
68
69 page = virt_to_page(pg);
70 pgtable_page_ctor(page);
71
72 return page;
73}
74
75static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
76{
77 quicklist_free(QUICK_PT, NULL, pte);
78}
79
80static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
81{
82 pgtable_page_dtor(pte);
83 quicklist_free_page(QUICK_PT, NULL, pte);
84}
85
86#define __pte_free_tlb(tlb,pte) \
87do { \
88 pgtable_page_dtor(pte); \
89 tlb_remove_page((tlb), pte); \
90} while (0)
91
92static inline void check_pgt_cache(void)
93{
94 quicklist_trim(QUICK_PGD, NULL, 25, 16);
95 quicklist_trim(QUICK_PT, NULL, 25, 16);
96}
97
98#endif /* __ASM_AVR32_PGALLOC_H */
diff --git a/arch/avr32/include/asm/pgtable-2level.h b/arch/avr32/include/asm/pgtable-2level.h
new file mode 100644
index 000000000000..425dd567b5b9
--- /dev/null
+++ b/arch/avr32/include/asm/pgtable-2level.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PGTABLE_2LEVEL_H
9#define __ASM_AVR32_PGTABLE_2LEVEL_H
10
11#include <asm-generic/pgtable-nopmd.h>
12
13/*
14 * Traditional 2-level paging structure
15 */
16#define PGDIR_SHIFT 22
17#define PTRS_PER_PGD 1024
18
19#define PTRS_PER_PTE 1024
20
21#ifndef __ASSEMBLY__
22#define pte_ERROR(e) \
23 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
24#define pgd_ERROR(e) \
25 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
26
27/*
28 * Certain architectures need to do special things when PTEs
29 * within a page table are directly modified. Thus, the following
30 * hook is made available.
31 */
32#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
33#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep, pteval)
34
35/*
36 * (pmds are folded into pgds so this doesn't get actually called,
37 * but the define is needed for a generic inline function.)
38 */
39#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
40
41#define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT)))
42#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
43#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
44
45#endif /* !__ASSEMBLY__ */
46
47#endif /* __ASM_AVR32_PGTABLE_2LEVEL_H */
diff --git a/arch/avr32/include/asm/pgtable.h b/arch/avr32/include/asm/pgtable.h
new file mode 100644
index 000000000000..fecdda16f444
--- /dev/null
+++ b/arch/avr32/include/asm/pgtable.h
@@ -0,0 +1,377 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PGTABLE_H
9#define __ASM_AVR32_PGTABLE_H
10
11#include <asm/addrspace.h>
12
13#ifndef __ASSEMBLY__
14#include <linux/sched.h>
15
16#endif /* !__ASSEMBLY__ */
17
18/*
19 * Use two-level page tables just as the i386 (without PAE)
20 */
21#include <asm/pgtable-2level.h>
22
23/*
24 * The following code might need some cleanup when the values are
25 * final...
26 */
27#define PMD_SIZE (1UL << PMD_SHIFT)
28#define PMD_MASK (~(PMD_SIZE-1))
29#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
30#define PGDIR_MASK (~(PGDIR_SIZE-1))
31
32#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
33#define FIRST_USER_ADDRESS 0
34
35#ifndef __ASSEMBLY__
36extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
37extern void paging_init(void);
38
39/*
40 * ZERO_PAGE is a global shared page that is always zero: used for
41 * zero-mapped memory areas etc.
42 */
43extern struct page *empty_zero_page;
44#define ZERO_PAGE(vaddr) (empty_zero_page)
45
46/*
47 * Just any arbitrary offset to the start of the vmalloc VM area: the
48 * current 8 MiB value just means that there will be a 8 MiB "hole"
49 * after the uncached physical memory (P2 segment) until the vmalloc
50 * area starts. That means that any out-of-bounds memory accesses will
51 * hopefully be caught; we don't know if the end of the P1/P2 segments
52 * are actually used for anything, but it is anyway safer to let the
53 * MMU catch these kinds of errors than to rely on the memory bus.
54 *
55 * A "hole" of the same size is added to the end of the P3 segment as
56 * well. It might seem wasteful to use 16 MiB of virtual address space
57 * on this, but we do have 512 MiB of it...
58 *
59 * The vmalloc() routines leave a hole of 4 KiB between each vmalloced
60 * area for the same reason.
61 */
62#define VMALLOC_OFFSET (8 * 1024 * 1024)
63#define VMALLOC_START (P3SEG + VMALLOC_OFFSET)
64#define VMALLOC_END (P4SEG - VMALLOC_OFFSET)
65#endif /* !__ASSEMBLY__ */
66
67/*
68 * Page flags. Some of these flags are not directly supported by
69 * hardware, so we have to emulate them.
70 */
71#define _TLBEHI_BIT_VALID 9
72#define _TLBEHI_VALID (1 << _TLBEHI_BIT_VALID)
73
74#define _PAGE_BIT_WT 0 /* W-bit : write-through */
75#define _PAGE_BIT_DIRTY 1 /* D-bit : page changed */
76#define _PAGE_BIT_SZ0 2 /* SZ0-bit : Size of page */
77#define _PAGE_BIT_SZ1 3 /* SZ1-bit : Size of page */
78#define _PAGE_BIT_EXECUTE 4 /* X-bit : execute access allowed */
79#define _PAGE_BIT_RW 5 /* AP0-bit : write access allowed */
80#define _PAGE_BIT_USER 6 /* AP1-bit : user space access allowed */
81#define _PAGE_BIT_BUFFER 7 /* B-bit : bufferable */
82#define _PAGE_BIT_GLOBAL 8 /* G-bit : global (ignore ASID) */
83#define _PAGE_BIT_CACHABLE 9 /* C-bit : cachable */
84
85/* If we drop support for 1K pages, we get two extra bits */
86#define _PAGE_BIT_PRESENT 10
87#define _PAGE_BIT_ACCESSED 11 /* software: page was accessed */
88
89/* The following flags are only valid when !PRESENT */
90#define _PAGE_BIT_FILE 0 /* software: pagecache or swap? */
91
92#define _PAGE_WT (1 << _PAGE_BIT_WT)
93#define _PAGE_DIRTY (1 << _PAGE_BIT_DIRTY)
94#define _PAGE_EXECUTE (1 << _PAGE_BIT_EXECUTE)
95#define _PAGE_RW (1 << _PAGE_BIT_RW)
96#define _PAGE_USER (1 << _PAGE_BIT_USER)
97#define _PAGE_BUFFER (1 << _PAGE_BIT_BUFFER)
98#define _PAGE_GLOBAL (1 << _PAGE_BIT_GLOBAL)
99#define _PAGE_CACHABLE (1 << _PAGE_BIT_CACHABLE)
100
101/* Software flags */
102#define _PAGE_ACCESSED (1 << _PAGE_BIT_ACCESSED)
103#define _PAGE_PRESENT (1 << _PAGE_BIT_PRESENT)
104#define _PAGE_FILE (1 << _PAGE_BIT_FILE)
105
106/*
107 * Page types, i.e. sizes. _PAGE_TYPE_NONE corresponds to what is
108 * usually called _PAGE_PROTNONE on other architectures.
109 *
110 * XXX: Find out if _PAGE_PROTNONE is equivalent with !_PAGE_USER. If
111 * so, we can encode all possible page sizes (although we can't really
112 * support 1K pages anyway due to the _PAGE_PRESENT and _PAGE_ACCESSED
113 * bits)
114 *
115 */
116#define _PAGE_TYPE_MASK ((1 << _PAGE_BIT_SZ0) | (1 << _PAGE_BIT_SZ1))
117#define _PAGE_TYPE_NONE (0 << _PAGE_BIT_SZ0)
118#define _PAGE_TYPE_SMALL (1 << _PAGE_BIT_SZ0)
119#define _PAGE_TYPE_MEDIUM (2 << _PAGE_BIT_SZ0)
120#define _PAGE_TYPE_LARGE (3 << _PAGE_BIT_SZ0)
121
122/*
123 * Mask which drop software flags. We currently can't handle more than
124 * 512 MiB of physical memory, so we can use bits 29-31 for other
125 * stuff. With a fixed 4K page size, we can use bits 10-11 as well as
126 * bits 2-3 (SZ)
127 */
128#define _PAGE_FLAGS_HARDWARE_MASK 0xfffff3ff
129
130#define _PAGE_FLAGS_CACHE_MASK (_PAGE_CACHABLE | _PAGE_BUFFER | _PAGE_WT)
131
132/* Flags that may be modified by software */
133#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY \
134 | _PAGE_FLAGS_CACHE_MASK)
135
136#define _PAGE_FLAGS_READ (_PAGE_CACHABLE | _PAGE_BUFFER)
137#define _PAGE_FLAGS_WRITE (_PAGE_FLAGS_READ | _PAGE_RW | _PAGE_DIRTY)
138
139#define _PAGE_NORMAL(x) __pgprot((x) | _PAGE_PRESENT | _PAGE_TYPE_SMALL \
140 | _PAGE_ACCESSED)
141
142#define PAGE_NONE (_PAGE_ACCESSED | _PAGE_TYPE_NONE)
143#define PAGE_READ (_PAGE_FLAGS_READ | _PAGE_USER)
144#define PAGE_EXEC (_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_USER)
145#define PAGE_WRITE (_PAGE_FLAGS_WRITE | _PAGE_USER)
146#define PAGE_KERNEL _PAGE_NORMAL(_PAGE_FLAGS_WRITE | _PAGE_EXECUTE | _PAGE_GLOBAL)
147#define PAGE_KERNEL_RO _PAGE_NORMAL(_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_GLOBAL)
148
149#define _PAGE_P(x) _PAGE_NORMAL((x) & ~(_PAGE_RW | _PAGE_DIRTY))
150#define _PAGE_S(x) _PAGE_NORMAL(x)
151
152#define PAGE_COPY _PAGE_P(PAGE_WRITE | PAGE_READ)
153#define PAGE_SHARED _PAGE_S(PAGE_WRITE | PAGE_READ)
154
155#ifndef __ASSEMBLY__
156/*
157 * The hardware supports flags for write- and execute access. Read is
158 * always allowed if the page is loaded into the TLB, so the "-w-",
159 * "--x" and "-wx" mappings are implemented as "rw-", "r-x" and "rwx",
160 * respectively.
161 *
162 * The "---" case is handled by software; the page will simply not be
163 * loaded into the TLB if the page type is _PAGE_TYPE_NONE.
164 */
165
166#define __P000 __pgprot(PAGE_NONE)
167#define __P001 _PAGE_P(PAGE_READ)
168#define __P010 _PAGE_P(PAGE_WRITE)
169#define __P011 _PAGE_P(PAGE_WRITE | PAGE_READ)
170#define __P100 _PAGE_P(PAGE_EXEC)
171#define __P101 _PAGE_P(PAGE_EXEC | PAGE_READ)
172#define __P110 _PAGE_P(PAGE_EXEC | PAGE_WRITE)
173#define __P111 _PAGE_P(PAGE_EXEC | PAGE_WRITE | PAGE_READ)
174
175#define __S000 __pgprot(PAGE_NONE)
176#define __S001 _PAGE_S(PAGE_READ)
177#define __S010 _PAGE_S(PAGE_WRITE)
178#define __S011 _PAGE_S(PAGE_WRITE | PAGE_READ)
179#define __S100 _PAGE_S(PAGE_EXEC)
180#define __S101 _PAGE_S(PAGE_EXEC | PAGE_READ)
181#define __S110 _PAGE_S(PAGE_EXEC | PAGE_WRITE)
182#define __S111 _PAGE_S(PAGE_EXEC | PAGE_WRITE | PAGE_READ)
183
184#define pte_none(x) (!pte_val(x))
185#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
186
187#define pte_clear(mm,addr,xp) \
188 do { \
189 set_pte_at(mm, addr, xp, __pte(0)); \
190 } while (0)
191
192/*
193 * The following only work if pte_present() is true.
194 * Undefined behaviour if not..
195 */
196static inline int pte_write(pte_t pte)
197{
198 return pte_val(pte) & _PAGE_RW;
199}
200static inline int pte_dirty(pte_t pte)
201{
202 return pte_val(pte) & _PAGE_DIRTY;
203}
204static inline int pte_young(pte_t pte)
205{
206 return pte_val(pte) & _PAGE_ACCESSED;
207}
208static inline int pte_special(pte_t pte)
209{
210 return 0;
211}
212
213/*
214 * The following only work if pte_present() is not true.
215 */
216static inline int pte_file(pte_t pte)
217{
218 return pte_val(pte) & _PAGE_FILE;
219}
220
221/* Mutator functions for PTE bits */
222static inline pte_t pte_wrprotect(pte_t pte)
223{
224 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW));
225 return pte;
226}
227static inline pte_t pte_mkclean(pte_t pte)
228{
229 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY));
230 return pte;
231}
232static inline pte_t pte_mkold(pte_t pte)
233{
234 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED));
235 return pte;
236}
237static inline pte_t pte_mkwrite(pte_t pte)
238{
239 set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW));
240 return pte;
241}
242static inline pte_t pte_mkdirty(pte_t pte)
243{
244 set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY));
245 return pte;
246}
247static inline pte_t pte_mkyoung(pte_t pte)
248{
249 set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED));
250 return pte;
251}
252static inline pte_t pte_mkspecial(pte_t pte)
253{
254 return pte;
255}
256
257#define pmd_none(x) (!pmd_val(x))
258#define pmd_present(x) (pmd_val(x))
259
260static inline void pmd_clear(pmd_t *pmdp)
261{
262 set_pmd(pmdp, __pmd(0));
263}
264
265#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
266
267/*
268 * Permanent address of a page. We don't support highmem, so this is
269 * trivial.
270 */
271#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
272#define pte_page(x) (pfn_to_page(pte_pfn(x)))
273
274/*
275 * Mark the prot value as uncacheable and unbufferable
276 */
277#define pgprot_noncached(prot) \
278 __pgprot(pgprot_val(prot) & ~(_PAGE_BUFFER | _PAGE_CACHABLE))
279
280/*
281 * Mark the prot value as uncacheable but bufferable
282 */
283#define pgprot_writecombine(prot) \
284 __pgprot((pgprot_val(prot) & ~_PAGE_CACHABLE) | _PAGE_BUFFER)
285
286/*
287 * Conversion functions: convert a page and protection to a page entry,
288 * and a page entry and page directory to the page they refer to.
289 *
290 * extern pte_t mk_pte(struct page *page, pgprot_t pgprot)
291 */
292#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
293
294static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
295{
296 set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK)
297 | pgprot_val(newprot)));
298 return pte;
299}
300
301#define page_pte(page) page_pte_prot(page, __pgprot(0))
302
303#define pmd_page_vaddr(pmd) pmd_val(pmd)
304#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
305
306/* to find an entry in a page-table-directory. */
307#define pgd_index(address) (((address) >> PGDIR_SHIFT) \
308 & (PTRS_PER_PGD - 1))
309#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
310
311/* to find an entry in a kernel page-table-directory */
312#define pgd_offset_k(address) pgd_offset(&init_mm, address)
313
314/* Find an entry in the third-level page table.. */
315#define pte_index(address) \
316 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
317#define pte_offset(dir, address) \
318 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
319#define pte_offset_kernel(dir, address) \
320 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
321#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
322#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
323#define pte_unmap(pte) do { } while (0)
324#define pte_unmap_nested(pte) do { } while (0)
325
326struct vm_area_struct;
327extern void update_mmu_cache(struct vm_area_struct * vma,
328 unsigned long address, pte_t pte);
329
330/*
331 * Encode and decode a swap entry
332 *
333 * Constraints:
334 * _PAGE_FILE at bit 0
335 * _PAGE_TYPE_* at bits 2-3 (for emulating _PAGE_PROTNONE)
336 * _PAGE_PRESENT at bit 10
337 *
338 * We encode the type into bits 4-9 and offset into bits 11-31. This
339 * gives us a 21 bits offset, or 2**21 * 4K = 8G usable swap space per
340 * device, and 64 possible types.
341 *
342 * NOTE: We should set ZEROs at the position of _PAGE_PRESENT
343 * and _PAGE_PROTNONE bits
344 */
345#define __swp_type(x) (((x).val >> 4) & 0x3f)
346#define __swp_offset(x) ((x).val >> 11)
347#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 4) | ((offset) << 11) })
348#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
349#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
350
351/*
352 * Encode and decode a nonlinear file mapping entry. We have to
353 * preserve _PAGE_FILE and _PAGE_PRESENT here. _PAGE_TYPE_* isn't
354 * necessary, since _PAGE_FILE implies !_PAGE_PROTNONE (?)
355 */
356#define PTE_FILE_MAX_BITS 30
357#define pte_to_pgoff(pte) (((pte_val(pte) >> 1) & 0x1ff) \
358 | ((pte_val(pte) >> 11) << 9))
359#define pgoff_to_pte(off) ((pte_t) { ((((off) & 0x1ff) << 1) \
360 | (((off) >> 9) << 11) \
361 | _PAGE_FILE) })
362
363typedef pte_t *pte_addr_t;
364
365#define kern_addr_valid(addr) (1)
366
367#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
368 remap_pfn_range(vma, vaddr, pfn, size, prot)
369
370/* No page table caches to initialize (?) */
371#define pgtable_cache_init() do { } while(0)
372
373#include <asm-generic/pgtable.h>
374
375#endif /* !__ASSEMBLY__ */
376
377#endif /* __ASM_AVR32_PGTABLE_H */
diff --git a/arch/avr32/include/asm/poll.h b/arch/avr32/include/asm/poll.h
new file mode 100644
index 000000000000..c98509d3149e
--- /dev/null
+++ b/arch/avr32/include/asm/poll.h
@@ -0,0 +1 @@
#include <asm-generic/poll.h>
diff --git a/arch/avr32/include/asm/posix_types.h b/arch/avr32/include/asm/posix_types.h
new file mode 100644
index 000000000000..fe0c0c014389
--- /dev/null
+++ b/arch/avr32/include/asm/posix_types.h
@@ -0,0 +1,125 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_POSIX_TYPES_H
9#define __ASM_AVR32_POSIX_TYPES_H
10
11/*
12 * This file is generally used by user-level software, so you need to
13 * be a little careful about namespace pollution etc. Also, we cannot
14 * assume GCC is being used.
15 */
16
17typedef unsigned long __kernel_ino_t;
18typedef unsigned short __kernel_mode_t;
19typedef unsigned short __kernel_nlink_t;
20typedef long __kernel_off_t;
21typedef int __kernel_pid_t;
22typedef unsigned short __kernel_ipc_pid_t;
23typedef unsigned int __kernel_uid_t;
24typedef unsigned int __kernel_gid_t;
25typedef unsigned long __kernel_size_t;
26typedef long __kernel_ssize_t;
27typedef int __kernel_ptrdiff_t;
28typedef long __kernel_time_t;
29typedef long __kernel_suseconds_t;
30typedef long __kernel_clock_t;
31typedef int __kernel_timer_t;
32typedef int __kernel_clockid_t;
33typedef int __kernel_daddr_t;
34typedef char * __kernel_caddr_t;
35typedef unsigned short __kernel_uid16_t;
36typedef unsigned short __kernel_gid16_t;
37typedef unsigned int __kernel_uid32_t;
38typedef unsigned int __kernel_gid32_t;
39
40typedef unsigned short __kernel_old_uid_t;
41typedef unsigned short __kernel_old_gid_t;
42typedef unsigned short __kernel_old_dev_t;
43
44#ifdef __GNUC__
45typedef long long __kernel_loff_t;
46#endif
47
48typedef struct {
49 int val[2];
50} __kernel_fsid_t;
51
52#if defined(__KERNEL__)
53
54#undef __FD_SET
55static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
56{
57 unsigned long __tmp = __fd / __NFDBITS;
58 unsigned long __rem = __fd % __NFDBITS;
59 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
60}
61
62#undef __FD_CLR
63static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
64{
65 unsigned long __tmp = __fd / __NFDBITS;
66 unsigned long __rem = __fd % __NFDBITS;
67 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
68}
69
70
71#undef __FD_ISSET
72static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
73{
74 unsigned long __tmp = __fd / __NFDBITS;
75 unsigned long __rem = __fd % __NFDBITS;
76 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
77}
78
79/*
80 * This will unroll the loop for the normal constant case (8 ints,
81 * for a 256-bit fd_set)
82 */
83#undef __FD_ZERO
84static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
85{
86 unsigned long *__tmp = __p->fds_bits;
87 int __i;
88
89 if (__builtin_constant_p(__FDSET_LONGS)) {
90 switch (__FDSET_LONGS) {
91 case 16:
92 __tmp[ 0] = 0; __tmp[ 1] = 0;
93 __tmp[ 2] = 0; __tmp[ 3] = 0;
94 __tmp[ 4] = 0; __tmp[ 5] = 0;
95 __tmp[ 6] = 0; __tmp[ 7] = 0;
96 __tmp[ 8] = 0; __tmp[ 9] = 0;
97 __tmp[10] = 0; __tmp[11] = 0;
98 __tmp[12] = 0; __tmp[13] = 0;
99 __tmp[14] = 0; __tmp[15] = 0;
100 return;
101
102 case 8:
103 __tmp[ 0] = 0; __tmp[ 1] = 0;
104 __tmp[ 2] = 0; __tmp[ 3] = 0;
105 __tmp[ 4] = 0; __tmp[ 5] = 0;
106 __tmp[ 6] = 0; __tmp[ 7] = 0;
107 return;
108
109 case 4:
110 __tmp[ 0] = 0; __tmp[ 1] = 0;
111 __tmp[ 2] = 0; __tmp[ 3] = 0;
112 return;
113 }
114 }
115 __i = __FDSET_LONGS;
116 while (__i) {
117 __i--;
118 *__tmp = 0;
119 __tmp++;
120 }
121}
122
123#endif /* defined(__KERNEL__) */
124
125#endif /* __ASM_AVR32_POSIX_TYPES_H */
diff --git a/arch/avr32/include/asm/processor.h b/arch/avr32/include/asm/processor.h
new file mode 100644
index 000000000000..49a88f5a9d2f
--- /dev/null
+++ b/arch/avr32/include/asm/processor.h
@@ -0,0 +1,178 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PROCESSOR_H
9#define __ASM_AVR32_PROCESSOR_H
10
11#include <asm/page.h>
12#include <asm/cache.h>
13
14#define TASK_SIZE 0x80000000
15
16#ifdef __KERNEL__
17#define STACK_TOP TASK_SIZE
18#define STACK_TOP_MAX STACK_TOP
19#endif
20
21#ifndef __ASSEMBLY__
22
23static inline void *current_text_addr(void)
24{
25 register void *pc asm("pc");
26 return pc;
27}
28
29enum arch_type {
30 ARCH_AVR32A,
31 ARCH_AVR32B,
32 ARCH_MAX
33};
34
35enum cpu_type {
36 CPU_MORGAN,
37 CPU_AT32AP,
38 CPU_MAX
39};
40
41enum tlb_config {
42 TLB_NONE,
43 TLB_SPLIT,
44 TLB_UNIFIED,
45 TLB_INVALID
46};
47
48#define AVR32_FEATURE_RMW (1 << 0)
49#define AVR32_FEATURE_DSP (1 << 1)
50#define AVR32_FEATURE_SIMD (1 << 2)
51#define AVR32_FEATURE_OCD (1 << 3)
52#define AVR32_FEATURE_PCTR (1 << 4)
53#define AVR32_FEATURE_JAVA (1 << 5)
54#define AVR32_FEATURE_FPU (1 << 6)
55
56struct avr32_cpuinfo {
57 struct clk *clk;
58 unsigned long loops_per_jiffy;
59 enum arch_type arch_type;
60 enum cpu_type cpu_type;
61 unsigned short arch_revision;
62 unsigned short cpu_revision;
63 enum tlb_config tlb_config;
64 unsigned long features;
65 u32 device_id;
66
67 struct cache_info icache;
68 struct cache_info dcache;
69};
70
71static inline unsigned int avr32_get_manufacturer_id(struct avr32_cpuinfo *cpu)
72{
73 return (cpu->device_id >> 1) & 0x7f;
74}
75static inline unsigned int avr32_get_product_number(struct avr32_cpuinfo *cpu)
76{
77 return (cpu->device_id >> 12) & 0xffff;
78}
79static inline unsigned int avr32_get_chip_revision(struct avr32_cpuinfo *cpu)
80{
81 return (cpu->device_id >> 28) & 0x0f;
82}
83
84extern struct avr32_cpuinfo boot_cpu_data;
85
86#ifdef CONFIG_SMP
87extern struct avr32_cpuinfo cpu_data[];
88#define current_cpu_data cpu_data[smp_processor_id()]
89#else
90#define cpu_data (&boot_cpu_data)
91#define current_cpu_data boot_cpu_data
92#endif
93
94/* This decides where the kernel will search for a free chunk of vm
95 * space during mmap's
96 */
97#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
98
99#define cpu_relax() barrier()
100#define cpu_sync_pipeline() asm volatile("sub pc, -2" : : : "memory")
101
102struct cpu_context {
103 unsigned long sr;
104 unsigned long pc;
105 unsigned long ksp; /* Kernel stack pointer */
106 unsigned long r7;
107 unsigned long r6;
108 unsigned long r5;
109 unsigned long r4;
110 unsigned long r3;
111 unsigned long r2;
112 unsigned long r1;
113 unsigned long r0;
114};
115
116/* This struct contains the CPU context as stored by switch_to() */
117struct thread_struct {
118 struct cpu_context cpu_context;
119 unsigned long single_step_addr;
120 u16 single_step_insn;
121};
122
123#define INIT_THREAD { \
124 .cpu_context = { \
125 .ksp = sizeof(init_stack) + (long)&init_stack, \
126 }, \
127}
128
129/*
130 * Do necessary setup to start up a newly executed thread.
131 */
132#define start_thread(regs, new_pc, new_sp) \
133 do { \
134 set_fs(USER_DS); \
135 memset(regs, 0, sizeof(*regs)); \
136 regs->sr = MODE_USER; \
137 regs->pc = new_pc & ~1; \
138 regs->sp = new_sp; \
139 } while(0)
140
141struct task_struct;
142
143/* Free all resources held by a thread */
144extern void release_thread(struct task_struct *);
145
146/* Create a kernel thread without removing it from tasklists */
147extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
148
149/* Prepare to copy thread state - unlazy all lazy status */
150#define prepare_to_copy(tsk) do { } while(0)
151
152/* Return saved PC of a blocked thread */
153#define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc)
154
155struct pt_regs;
156extern unsigned long get_wchan(struct task_struct *p);
157extern void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl);
158extern void show_stack_log_lvl(struct task_struct *tsk, unsigned long sp,
159 struct pt_regs *regs, const char *log_lvl);
160
161#define task_pt_regs(p) \
162 ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1)
163
164#define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc)
165#define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp)
166
167#define ARCH_HAS_PREFETCH
168
169static inline void prefetch(const void *x)
170{
171 const char *c = x;
172 asm volatile("pref %0" : : "r"(c));
173}
174#define PREFETCH_STRIDE L1_CACHE_BYTES
175
176#endif /* __ASSEMBLY__ */
177
178#endif /* __ASM_AVR32_PROCESSOR_H */
diff --git a/arch/avr32/include/asm/ptrace.h b/arch/avr32/include/asm/ptrace.h
new file mode 100644
index 000000000000..9e2d44f4e0fe
--- /dev/null
+++ b/arch/avr32/include/asm/ptrace.h
@@ -0,0 +1,157 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PTRACE_H
9#define __ASM_AVR32_PTRACE_H
10
11#define PTRACE_GETREGS 12
12#define PTRACE_SETREGS 13
13
14/*
15 * Status Register bits
16 */
17#define SR_H 0x20000000
18#define SR_J 0x10000000
19#define SR_DM 0x08000000
20#define SR_D 0x04000000
21#define MODE_NMI 0x01c00000
22#define MODE_EXCEPTION 0x01800000
23#define MODE_INT3 0x01400000
24#define MODE_INT2 0x01000000
25#define MODE_INT1 0x00c00000
26#define MODE_INT0 0x00800000
27#define MODE_SUPERVISOR 0x00400000
28#define MODE_USER 0x00000000
29#define MODE_MASK 0x01c00000
30#define SR_EM 0x00200000
31#define SR_I3M 0x00100000
32#define SR_I2M 0x00080000
33#define SR_I1M 0x00040000
34#define SR_I0M 0x00020000
35#define SR_GM 0x00010000
36
37#define SR_H_BIT 29
38#define SR_J_BIT 28
39#define SR_DM_BIT 27
40#define SR_D_BIT 26
41#define MODE_SHIFT 22
42#define SR_EM_BIT 21
43#define SR_I3M_BIT 20
44#define SR_I2M_BIT 19
45#define SR_I1M_BIT 18
46#define SR_I0M_BIT 17
47#define SR_GM_BIT 16
48
49/* The user-visible part */
50#define SR_L 0x00000020
51#define SR_Q 0x00000010
52#define SR_V 0x00000008
53#define SR_N 0x00000004
54#define SR_Z 0x00000002
55#define SR_C 0x00000001
56
57#define SR_L_BIT 5
58#define SR_Q_BIT 4
59#define SR_V_BIT 3
60#define SR_N_BIT 2
61#define SR_Z_BIT 1
62#define SR_C_BIT 0
63
64/*
65 * The order is defined by the stmts instruction. r0 is stored first,
66 * so it gets the highest address.
67 *
68 * Registers 0-12 are general-purpose registers (r12 is normally used for
69 * the function return value).
70 * Register 13 is the stack pointer
71 * Register 14 is the link register
72 * Register 15 is the program counter (retrieved from the RAR sysreg)
73 */
74#define FRAME_SIZE_FULL 72
75#define REG_R12_ORIG 68
76#define REG_R0 64
77#define REG_R1 60
78#define REG_R2 56
79#define REG_R3 52
80#define REG_R4 48
81#define REG_R5 44
82#define REG_R6 40
83#define REG_R7 36
84#define REG_R8 32
85#define REG_R9 28
86#define REG_R10 24
87#define REG_R11 20
88#define REG_R12 16
89#define REG_SP 12
90#define REG_LR 8
91
92#define FRAME_SIZE_MIN 8
93#define REG_PC 4
94#define REG_SR 0
95
96#ifndef __ASSEMBLY__
97struct pt_regs {
98 /* These are always saved */
99 unsigned long sr;
100 unsigned long pc;
101
102 /* These are sometimes saved */
103 unsigned long lr;
104 unsigned long sp;
105 unsigned long r12;
106 unsigned long r11;
107 unsigned long r10;
108 unsigned long r9;
109 unsigned long r8;
110 unsigned long r7;
111 unsigned long r6;
112 unsigned long r5;
113 unsigned long r4;
114 unsigned long r3;
115 unsigned long r2;
116 unsigned long r1;
117 unsigned long r0;
118
119 /* Only saved on system call */
120 unsigned long r12_orig;
121};
122
123#ifdef __KERNEL__
124
125#include <asm/ocd.h>
126
127#define arch_ptrace_attach(child) ocd_enable(child)
128
129#define user_mode(regs) (((regs)->sr & MODE_MASK) == MODE_USER)
130#define instruction_pointer(regs) ((regs)->pc)
131#define profile_pc(regs) instruction_pointer(regs)
132
133extern void show_regs (struct pt_regs *);
134
135static __inline__ int valid_user_regs(struct pt_regs *regs)
136{
137 /*
138 * Some of the Java bits might be acceptable if/when we
139 * implement some support for that stuff...
140 */
141 if ((regs->sr & 0xffff0000) == 0)
142 return 1;
143
144 /*
145 * Force status register flags to be sane and report this
146 * illegal behaviour...
147 */
148 regs->sr &= 0x0000ffff;
149 return 0;
150}
151
152
153#endif /* __KERNEL__ */
154
155#endif /* ! __ASSEMBLY__ */
156
157#endif /* __ASM_AVR32_PTRACE_H */
diff --git a/arch/avr32/include/asm/resource.h b/arch/avr32/include/asm/resource.h
new file mode 100644
index 000000000000..c6dd101472b1
--- /dev/null
+++ b/arch/avr32/include/asm/resource.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_RESOURCE_H
2#define __ASM_AVR32_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif /* __ASM_AVR32_RESOURCE_H */
diff --git a/arch/avr32/include/asm/scatterlist.h b/arch/avr32/include/asm/scatterlist.h
new file mode 100644
index 000000000000..377320e3bd17
--- /dev/null
+++ b/arch/avr32/include/asm/scatterlist.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_AVR32_SCATTERLIST_H
2#define __ASM_AVR32_SCATTERLIST_H
3
4#include <asm/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 unsigned long page_link;
11 unsigned int offset;
12 dma_addr_t dma_address;
13 unsigned int length;
14};
15
16/* These macros should be used after a pci_map_sg call has been done
17 * to get bus addresses of each of the SG entries and their lengths.
18 * You should only work with the number of sg entries pci_map_sg
19 * returns.
20 */
21#define sg_dma_address(sg) ((sg)->dma_address)
22#define sg_dma_len(sg) ((sg)->length)
23
24#define ISA_DMA_THRESHOLD (0xffffffff)
25
26#endif /* __ASM_AVR32_SCATTERLIST_H */
diff --git a/arch/avr32/include/asm/sections.h b/arch/avr32/include/asm/sections.h
new file mode 100644
index 000000000000..aa14252e4181
--- /dev/null
+++ b/arch/avr32/include/asm/sections.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_SECTIONS_H
2#define __ASM_AVR32_SECTIONS_H
3
4#include <asm-generic/sections.h>
5
6#endif /* __ASM_AVR32_SECTIONS_H */
diff --git a/arch/avr32/include/asm/sembuf.h b/arch/avr32/include/asm/sembuf.h
new file mode 100644
index 000000000000..e472216e0c97
--- /dev/null
+++ b/arch/avr32/include/asm/sembuf.h
@@ -0,0 +1,25 @@
1#ifndef __ASM_AVR32_SEMBUF_H
2#define __ASM_AVR32_SEMBUF_H
3
4/*
5* The semid64_ds structure for AVR32 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* __ASM_AVR32_SEMBUF_H */
diff --git a/arch/avr32/include/asm/serial.h b/arch/avr32/include/asm/serial.h
new file mode 100644
index 000000000000..5ecaebc22b02
--- /dev/null
+++ b/arch/avr32/include/asm/serial.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_SERIAL_H
2#define _ASM_SERIAL_H
3
4/*
5 * This assumes you have a 1.8432 MHz clock for your UART.
6 *
7 * It'd be nice if someone built a serial card with a 24.576 MHz
8 * clock, since the 16550A is capable of handling a top speed of 1.5
9 * megabits/second; but this requires the faster clock.
10 */
11#define BASE_BAUD (1843200 / 16)
12
13#endif /* _ASM_SERIAL_H */
diff --git a/arch/avr32/include/asm/setup.h b/arch/avr32/include/asm/setup.h
new file mode 100644
index 000000000000..ff5b7cf6be4d
--- /dev/null
+++ b/arch/avr32/include/asm/setup.h
@@ -0,0 +1,138 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * Based on linux/include/asm-arm/setup.h
5 * Copyright (C) 1997-1999 Russell King
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#ifndef __ASM_AVR32_SETUP_H__
12#define __ASM_AVR32_SETUP_H__
13
14#define COMMAND_LINE_SIZE 256
15
16#ifdef __KERNEL__
17
18/* Magic number indicating that a tag table is present */
19#define ATAG_MAGIC 0xa2a25441
20
21#ifndef __ASSEMBLY__
22
23/*
24 * Generic memory range, used by several tags.
25 *
26 * addr is always physical.
27 * size is measured in bytes.
28 * next is for use by the OS, e.g. for grouping regions into
29 * linked lists.
30 */
31struct tag_mem_range {
32 u32 addr;
33 u32 size;
34 struct tag_mem_range * next;
35};
36
37/* The list ends with an ATAG_NONE node. */
38#define ATAG_NONE 0x00000000
39
40struct tag_header {
41 u32 size;
42 u32 tag;
43};
44
45/* The list must start with an ATAG_CORE node */
46#define ATAG_CORE 0x54410001
47
48struct tag_core {
49 u32 flags;
50 u32 pagesize;
51 u32 rootdev;
52};
53
54/* it is allowed to have multiple ATAG_MEM nodes */
55#define ATAG_MEM 0x54410002
56/* ATAG_MEM uses tag_mem_range */
57
58/* command line: \0 terminated string */
59#define ATAG_CMDLINE 0x54410003
60
61struct tag_cmdline {
62 char cmdline[1]; /* this is the minimum size */
63};
64
65/* Ramdisk image (may be compressed) */
66#define ATAG_RDIMG 0x54410004
67/* ATAG_RDIMG uses tag_mem_range */
68
69/* Information about various clocks present in the system */
70#define ATAG_CLOCK 0x54410005
71
72struct tag_clock {
73 u32 clock_id; /* Which clock are we talking about? */
74 u32 clock_flags; /* Special features */
75 u64 clock_hz; /* Clock speed in Hz */
76};
77
78/* The clock types we know about */
79#define CLOCK_BOOTCPU 0
80
81/* Memory reserved for the system (e.g. the bootloader) */
82#define ATAG_RSVD_MEM 0x54410006
83/* ATAG_RSVD_MEM uses tag_mem_range */
84
85/* Ethernet information */
86
87#define ATAG_ETHERNET 0x54410007
88
89struct tag_ethernet {
90 u8 mac_index;
91 u8 mii_phy_addr;
92 u8 hw_address[6];
93};
94
95#define ETH_INVALID_PHY 0xff
96
97struct tag {
98 struct tag_header hdr;
99 union {
100 struct tag_core core;
101 struct tag_mem_range mem_range;
102 struct tag_cmdline cmdline;
103 struct tag_clock clock;
104 struct tag_ethernet ethernet;
105 } u;
106};
107
108struct tagtable {
109 u32 tag;
110 int (*parse)(struct tag *);
111};
112
113#define __tag __used __attribute__((__section__(".taglist.init")))
114#define __tagtable(tag, fn) \
115 static struct tagtable __tagtable_##fn __tag = { tag, fn }
116
117#define tag_member_present(tag,member) \
118 ((unsigned long)(&((struct tag *)0L)->member + 1) \
119 <= (tag)->hdr.size * 4)
120
121#define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size))
122#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
123
124#define for_each_tag(t,base) \
125 for (t = base; t->hdr.size; t = tag_next(t))
126
127extern struct tag *bootloader_tags;
128
129extern resource_size_t fbmem_start;
130extern resource_size_t fbmem_size;
131
132void setup_processor(void);
133
134#endif /* !__ASSEMBLY__ */
135
136#endif /* __KERNEL__ */
137
138#endif /* __ASM_AVR32_SETUP_H__ */
diff --git a/arch/avr32/include/asm/shmbuf.h b/arch/avr32/include/asm/shmbuf.h
new file mode 100644
index 000000000000..c62fba41739a
--- /dev/null
+++ b/arch/avr32/include/asm/shmbuf.h
@@ -0,0 +1,42 @@
1#ifndef __ASM_AVR32_SHMBUF_H
2#define __ASM_AVR32_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for i386 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* __ASM_AVR32_SHMBUF_H */
diff --git a/arch/avr32/include/asm/shmparam.h b/arch/avr32/include/asm/shmparam.h
new file mode 100644
index 000000000000..3681266c77f7
--- /dev/null
+++ b/arch/avr32/include/asm/shmparam.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_SHMPARAM_H
2#define __ASM_AVR32_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* __ASM_AVR32_SHMPARAM_H */
diff --git a/arch/avr32/include/asm/sigcontext.h b/arch/avr32/include/asm/sigcontext.h
new file mode 100644
index 000000000000..e04062b5f39f
--- /dev/null
+++ b/arch/avr32/include/asm/sigcontext.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_SIGCONTEXT_H
9#define __ASM_AVR32_SIGCONTEXT_H
10
11struct sigcontext {
12 unsigned long oldmask;
13
14 /* CPU registers */
15 unsigned long sr;
16 unsigned long pc;
17 unsigned long lr;
18 unsigned long sp;
19 unsigned long r12;
20 unsigned long r11;
21 unsigned long r10;
22 unsigned long r9;
23 unsigned long r8;
24 unsigned long r7;
25 unsigned long r6;
26 unsigned long r5;
27 unsigned long r4;
28 unsigned long r3;
29 unsigned long r2;
30 unsigned long r1;
31 unsigned long r0;
32};
33
34#endif /* __ASM_AVR32_SIGCONTEXT_H */
diff --git a/arch/avr32/include/asm/siginfo.h b/arch/avr32/include/asm/siginfo.h
new file mode 100644
index 000000000000..5ee93f40a8a8
--- /dev/null
+++ b/arch/avr32/include/asm/siginfo.h
@@ -0,0 +1,6 @@
1#ifndef _AVR32_SIGINFO_H
2#define _AVR32_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif
diff --git a/arch/avr32/include/asm/signal.h b/arch/avr32/include/asm/signal.h
new file mode 100644
index 000000000000..caffefeeba1f
--- /dev/null
+++ b/arch/avr32/include/asm/signal.h
@@ -0,0 +1,168 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_SIGNAL_H
9#define __ASM_AVR32_SIGNAL_H
10
11#include <linux/types.h>
12
13/* Avoid too many header ordering problems. */
14struct siginfo;
15
16#ifdef __KERNEL__
17/* Most things should be clean enough to redefine this at will, if care
18 is taken to make libc match. */
19
20#define _NSIG 64
21#define _NSIG_BPW 32
22#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
23
24typedef unsigned long old_sigset_t; /* at least 32 bits */
25
26typedef struct {
27 unsigned long sig[_NSIG_WORDS];
28} sigset_t;
29
30#else
31/* Here we must cater to libcs that poke about in kernel headers. */
32
33#define NSIG 32
34typedef unsigned long sigset_t;
35
36#endif /* __KERNEL__ */
37
38#define SIGHUP 1
39#define SIGINT 2
40#define SIGQUIT 3
41#define SIGILL 4
42#define SIGTRAP 5
43#define SIGABRT 6
44#define SIGIOT 6
45#define SIGBUS 7
46#define SIGFPE 8
47#define SIGKILL 9
48#define SIGUSR1 10
49#define SIGSEGV 11
50#define SIGUSR2 12
51#define SIGPIPE 13
52#define SIGALRM 14
53#define SIGTERM 15
54#define SIGSTKFLT 16
55#define SIGCHLD 17
56#define SIGCONT 18
57#define SIGSTOP 19
58#define SIGTSTP 20
59#define SIGTTIN 21
60#define SIGTTOU 22
61#define SIGURG 23
62#define SIGXCPU 24
63#define SIGXFSZ 25
64#define SIGVTALRM 26
65#define SIGPROF 27
66#define SIGWINCH 28
67#define SIGIO 29
68#define SIGPOLL SIGIO
69/*
70#define SIGLOST 29
71*/
72#define SIGPWR 30
73#define SIGSYS 31
74#define SIGUNUSED 31
75
76/* These should not be considered constants from userland. */
77#define SIGRTMIN 32
78#define SIGRTMAX (_NSIG-1)
79
80/*
81 * SA_FLAGS values:
82 *
83 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
84 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
85 * SA_SIGINFO deliver the signal with SIGINFO structs
86 * SA_ONSTACK indicates that a registered stack_t will be used.
87 * SA_RESTART flag to get restarting signals (which were the default long ago)
88 * SA_NODEFER prevents the current signal from being masked in the handler.
89 * SA_RESETHAND clears the handler when the signal is delivered.
90 *
91 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
92 * Unix names RESETHAND and NODEFER respectively.
93 */
94#define SA_NOCLDSTOP 0x00000001
95#define SA_NOCLDWAIT 0x00000002
96#define SA_SIGINFO 0x00000004
97#define SA_RESTORER 0x04000000
98#define SA_ONSTACK 0x08000000
99#define SA_RESTART 0x10000000
100#define SA_NODEFER 0x40000000
101#define SA_RESETHAND 0x80000000
102
103#define SA_NOMASK SA_NODEFER
104#define SA_ONESHOT SA_RESETHAND
105
106/*
107 * sigaltstack controls
108 */
109#define SS_ONSTACK 1
110#define SS_DISABLE 2
111
112#define MINSIGSTKSZ 2048
113#define SIGSTKSZ 8192
114
115#include <asm-generic/signal.h>
116
117#ifdef __KERNEL__
118struct old_sigaction {
119 __sighandler_t sa_handler;
120 old_sigset_t sa_mask;
121 unsigned long sa_flags;
122 __sigrestore_t sa_restorer;
123};
124
125struct sigaction {
126 __sighandler_t sa_handler;
127 unsigned long sa_flags;
128 __sigrestore_t sa_restorer;
129 sigset_t sa_mask; /* mask last for extensibility */
130};
131
132struct k_sigaction {
133 struct sigaction sa;
134};
135#else
136/* Here we must cater to libcs that poke about in kernel headers. */
137
138struct sigaction {
139 union {
140 __sighandler_t _sa_handler;
141 void (*_sa_sigaction)(int, struct siginfo *, void *);
142 } _u;
143 sigset_t sa_mask;
144 unsigned long sa_flags;
145 void (*sa_restorer)(void);
146};
147
148#define sa_handler _u._sa_handler
149#define sa_sigaction _u._sa_sigaction
150
151#endif /* __KERNEL__ */
152
153typedef struct sigaltstack {
154 void __user *ss_sp;
155 int ss_flags;
156 size_t ss_size;
157} stack_t;
158
159#ifdef __KERNEL__
160
161#include <asm/sigcontext.h>
162#undef __HAVE_ARCH_SIG_BITOPS
163
164#define ptrace_signal_deliver(regs, cookie) do { } while (0)
165
166#endif /* __KERNEL__ */
167
168#endif
diff --git a/arch/avr32/include/asm/socket.h b/arch/avr32/include/asm/socket.h
new file mode 100644
index 000000000000..35863f260929
--- /dev/null
+++ b/arch/avr32/include/asm/socket.h
@@ -0,0 +1,57 @@
1#ifndef __ASM_AVR32_SOCKET_H
2#define __ASM_AVR32_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43
44#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29
46#define SCM_TIMESTAMP SO_TIMESTAMP
47
48#define SO_ACCEPTCONN 30
49
50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54
55#define SO_MARK 36
56
57#endif /* __ASM_AVR32_SOCKET_H */
diff --git a/arch/avr32/include/asm/sockios.h b/arch/avr32/include/asm/sockios.h
new file mode 100644
index 000000000000..0802d742f97d
--- /dev/null
+++ b/arch/avr32/include/asm/sockios.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_AVR32_SOCKIOS_H
2#define __ASM_AVR32_SOCKIOS_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif /* __ASM_AVR32_SOCKIOS_H */
diff --git a/arch/avr32/include/asm/stat.h b/arch/avr32/include/asm/stat.h
new file mode 100644
index 000000000000..e72881e10230
--- /dev/null
+++ b/arch/avr32/include/asm/stat.h
@@ -0,0 +1,79 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_STAT_H
9#define __ASM_AVR32_STAT_H
10
11struct __old_kernel_stat {
12 unsigned short st_dev;
13 unsigned short st_ino;
14 unsigned short st_mode;
15 unsigned short st_nlink;
16 unsigned short st_uid;
17 unsigned short st_gid;
18 unsigned short st_rdev;
19 unsigned long st_size;
20 unsigned long st_atime;
21 unsigned long st_mtime;
22 unsigned long st_ctime;
23};
24
25struct stat {
26 unsigned long st_dev;
27 unsigned long st_ino;
28 unsigned short st_mode;
29 unsigned short st_nlink;
30 unsigned short st_uid;
31 unsigned short st_gid;
32 unsigned long st_rdev;
33 unsigned long st_size;
34 unsigned long st_blksize;
35 unsigned long st_blocks;
36 unsigned long st_atime;
37 unsigned long st_atime_nsec;
38 unsigned long st_mtime;
39 unsigned long st_mtime_nsec;
40 unsigned long st_ctime;
41 unsigned long st_ctime_nsec;
42 unsigned long __unused4;
43 unsigned long __unused5;
44};
45
46#define STAT_HAVE_NSEC 1
47
48struct stat64 {
49 unsigned long long st_dev;
50
51 unsigned long long st_ino;
52 unsigned int st_mode;
53 unsigned int st_nlink;
54
55 unsigned long st_uid;
56 unsigned long st_gid;
57
58 unsigned long long st_rdev;
59
60 long long st_size;
61 unsigned long __pad1; /* align 64-bit st_blocks */
62 unsigned long st_blksize;
63
64 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
65
66 unsigned long st_atime;
67 unsigned long st_atime_nsec;
68
69 unsigned long st_mtime;
70 unsigned long st_mtime_nsec;
71
72 unsigned long st_ctime;
73 unsigned long st_ctime_nsec;
74
75 unsigned long __unused1;
76 unsigned long __unused2;
77};
78
79#endif /* __ASM_AVR32_STAT_H */
diff --git a/arch/avr32/include/asm/statfs.h b/arch/avr32/include/asm/statfs.h
new file mode 100644
index 000000000000..2961bd18c50e
--- /dev/null
+++ b/arch/avr32/include/asm/statfs.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_STATFS_H
2#define __ASM_AVR32_STATFS_H
3
4#include <asm-generic/statfs.h>
5
6#endif /* __ASM_AVR32_STATFS_H */
diff --git a/arch/avr32/include/asm/string.h b/arch/avr32/include/asm/string.h
new file mode 100644
index 000000000000..c91a623cd585
--- /dev/null
+++ b/arch/avr32/include/asm/string.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_STRING_H
9#define __ASM_AVR32_STRING_H
10
11#define __HAVE_ARCH_MEMSET
12extern void *memset(void *b, int c, size_t len);
13
14#define __HAVE_ARCH_MEMCPY
15extern void *memcpy(void *to, const void *from, size_t len);
16
17#endif /* __ASM_AVR32_STRING_H */
diff --git a/arch/avr32/include/asm/sysreg.h b/arch/avr32/include/asm/sysreg.h
new file mode 100644
index 000000000000..d4e0950170ca
--- /dev/null
+++ b/arch/avr32/include/asm/sysreg.h
@@ -0,0 +1,291 @@
1/*
2 * AVR32 System Registers
3 *
4 * Copyright (C) 2004-2006 Atmel Corporation
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_AVR32_SYSREG_H
11#define __ASM_AVR32_SYSREG_H
12
13/* sysreg register offsets */
14#define SYSREG_SR 0x0000
15#define SYSREG_EVBA 0x0004
16#define SYSREG_ACBA 0x0008
17#define SYSREG_CPUCR 0x000c
18#define SYSREG_ECR 0x0010
19#define SYSREG_RSR_SUP 0x0014
20#define SYSREG_RSR_INT0 0x0018
21#define SYSREG_RSR_INT1 0x001c
22#define SYSREG_RSR_INT2 0x0020
23#define SYSREG_RSR_INT3 0x0024
24#define SYSREG_RSR_EX 0x0028
25#define SYSREG_RSR_NMI 0x002c
26#define SYSREG_RSR_DBG 0x0030
27#define SYSREG_RAR_SUP 0x0034
28#define SYSREG_RAR_INT0 0x0038
29#define SYSREG_RAR_INT1 0x003c
30#define SYSREG_RAR_INT2 0x0040
31#define SYSREG_RAR_INT3 0x0044
32#define SYSREG_RAR_EX 0x0048
33#define SYSREG_RAR_NMI 0x004c
34#define SYSREG_RAR_DBG 0x0050
35#define SYSREG_JECR 0x0054
36#define SYSREG_JOSP 0x0058
37#define SYSREG_JAVA_LV0 0x005c
38#define SYSREG_JAVA_LV1 0x0060
39#define SYSREG_JAVA_LV2 0x0064
40#define SYSREG_JAVA_LV3 0x0068
41#define SYSREG_JAVA_LV4 0x006c
42#define SYSREG_JAVA_LV5 0x0070
43#define SYSREG_JAVA_LV6 0x0074
44#define SYSREG_JAVA_LV7 0x0078
45#define SYSREG_JTBA 0x007c
46#define SYSREG_JBCR 0x0080
47#define SYSREG_CONFIG0 0x0100
48#define SYSREG_CONFIG1 0x0104
49#define SYSREG_COUNT 0x0108
50#define SYSREG_COMPARE 0x010c
51#define SYSREG_TLBEHI 0x0110
52#define SYSREG_TLBELO 0x0114
53#define SYSREG_PTBR 0x0118
54#define SYSREG_TLBEAR 0x011c
55#define SYSREG_MMUCR 0x0120
56#define SYSREG_TLBARLO 0x0124
57#define SYSREG_TLBARHI 0x0128
58#define SYSREG_PCCNT 0x012c
59#define SYSREG_PCNT0 0x0130
60#define SYSREG_PCNT1 0x0134
61#define SYSREG_PCCR 0x0138
62#define SYSREG_BEAR 0x013c
63#define SYSREG_SABAL 0x0300
64#define SYSREG_SABAH 0x0304
65#define SYSREG_SABD 0x0308
66
67/* Bitfields in SR */
68#define SYSREG_SR_C_OFFSET 0
69#define SYSREG_SR_C_SIZE 1
70#define SYSREG_Z_OFFSET 1
71#define SYSREG_Z_SIZE 1
72#define SYSREG_SR_N_OFFSET 2
73#define SYSREG_SR_N_SIZE 1
74#define SYSREG_SR_V_OFFSET 3
75#define SYSREG_SR_V_SIZE 1
76#define SYSREG_Q_OFFSET 4
77#define SYSREG_Q_SIZE 1
78#define SYSREG_L_OFFSET 5
79#define SYSREG_L_SIZE 1
80#define SYSREG_T_OFFSET 14
81#define SYSREG_T_SIZE 1
82#define SYSREG_SR_R_OFFSET 15
83#define SYSREG_SR_R_SIZE 1
84#define SYSREG_GM_OFFSET 16
85#define SYSREG_GM_SIZE 1
86#define SYSREG_I0M_OFFSET 17
87#define SYSREG_I0M_SIZE 1
88#define SYSREG_I1M_OFFSET 18
89#define SYSREG_I1M_SIZE 1
90#define SYSREG_I2M_OFFSET 19
91#define SYSREG_I2M_SIZE 1
92#define SYSREG_I3M_OFFSET 20
93#define SYSREG_I3M_SIZE 1
94#define SYSREG_EM_OFFSET 21
95#define SYSREG_EM_SIZE 1
96#define SYSREG_MODE_OFFSET 22
97#define SYSREG_MODE_SIZE 3
98#define SYSREG_M0_OFFSET 22
99#define SYSREG_M0_SIZE 1
100#define SYSREG_M1_OFFSET 23
101#define SYSREG_M1_SIZE 1
102#define SYSREG_M2_OFFSET 24
103#define SYSREG_M2_SIZE 1
104#define SYSREG_SR_D_OFFSET 26
105#define SYSREG_SR_D_SIZE 1
106#define SYSREG_DM_OFFSET 27
107#define SYSREG_DM_SIZE 1
108#define SYSREG_SR_J_OFFSET 28
109#define SYSREG_SR_J_SIZE 1
110#define SYSREG_H_OFFSET 29
111#define SYSREG_H_SIZE 1
112
113/* Bitfields in CPUCR */
114#define SYSREG_BI_OFFSET 0
115#define SYSREG_BI_SIZE 1
116#define SYSREG_BE_OFFSET 1
117#define SYSREG_BE_SIZE 1
118#define SYSREG_FE_OFFSET 2
119#define SYSREG_FE_SIZE 1
120#define SYSREG_RE_OFFSET 3
121#define SYSREG_RE_SIZE 1
122#define SYSREG_IBE_OFFSET 4
123#define SYSREG_IBE_SIZE 1
124#define SYSREG_IEE_OFFSET 5
125#define SYSREG_IEE_SIZE 1
126
127/* Bitfields in CONFIG0 */
128#define SYSREG_CONFIG0_R_OFFSET 0
129#define SYSREG_CONFIG0_R_SIZE 1
130#define SYSREG_CONFIG0_D_OFFSET 1
131#define SYSREG_CONFIG0_D_SIZE 1
132#define SYSREG_CONFIG0_S_OFFSET 2
133#define SYSREG_CONFIG0_S_SIZE 1
134#define SYSREG_CONFIG0_O_OFFSET 3
135#define SYSREG_CONFIG0_O_SIZE 1
136#define SYSREG_CONFIG0_P_OFFSET 4
137#define SYSREG_CONFIG0_P_SIZE 1
138#define SYSREG_CONFIG0_J_OFFSET 5
139#define SYSREG_CONFIG0_J_SIZE 1
140#define SYSREG_CONFIG0_F_OFFSET 6
141#define SYSREG_CONFIG0_F_SIZE 1
142#define SYSREG_MMUT_OFFSET 7
143#define SYSREG_MMUT_SIZE 3
144#define SYSREG_AR_OFFSET 10
145#define SYSREG_AR_SIZE 3
146#define SYSREG_AT_OFFSET 13
147#define SYSREG_AT_SIZE 3
148#define SYSREG_PROCESSORREVISION_OFFSET 16
149#define SYSREG_PROCESSORREVISION_SIZE 8
150#define SYSREG_PROCESSORID_OFFSET 24
151#define SYSREG_PROCESSORID_SIZE 8
152
153/* Bitfields in CONFIG1 */
154#define SYSREG_DASS_OFFSET 0
155#define SYSREG_DASS_SIZE 3
156#define SYSREG_DLSZ_OFFSET 3
157#define SYSREG_DLSZ_SIZE 3
158#define SYSREG_DSET_OFFSET 6
159#define SYSREG_DSET_SIZE 4
160#define SYSREG_IASS_OFFSET 10
161#define SYSREG_IASS_SIZE 3
162#define SYSREG_ILSZ_OFFSET 13
163#define SYSREG_ILSZ_SIZE 3
164#define SYSREG_ISET_OFFSET 16
165#define SYSREG_ISET_SIZE 4
166#define SYSREG_DMMUSZ_OFFSET 20
167#define SYSREG_DMMUSZ_SIZE 6
168#define SYSREG_IMMUSZ_OFFSET 26
169#define SYSREG_IMMUSZ_SIZE 6
170
171/* Bitfields in TLBEHI */
172#define SYSREG_ASID_OFFSET 0
173#define SYSREG_ASID_SIZE 8
174#define SYSREG_TLBEHI_I_OFFSET 8
175#define SYSREG_TLBEHI_I_SIZE 1
176#define SYSREG_TLBEHI_V_OFFSET 9
177#define SYSREG_TLBEHI_V_SIZE 1
178#define SYSREG_VPN_OFFSET 10
179#define SYSREG_VPN_SIZE 22
180
181/* Bitfields in TLBELO */
182#define SYSREG_W_OFFSET 0
183#define SYSREG_W_SIZE 1
184#define SYSREG_TLBELO_D_OFFSET 1
185#define SYSREG_TLBELO_D_SIZE 1
186#define SYSREG_SZ_OFFSET 2
187#define SYSREG_SZ_SIZE 2
188#define SYSREG_AP_OFFSET 4
189#define SYSREG_AP_SIZE 3
190#define SYSREG_B_OFFSET 7
191#define SYSREG_B_SIZE 1
192#define SYSREG_G_OFFSET 8
193#define SYSREG_G_SIZE 1
194#define SYSREG_TLBELO_C_OFFSET 9
195#define SYSREG_TLBELO_C_SIZE 1
196#define SYSREG_PFN_OFFSET 10
197#define SYSREG_PFN_SIZE 22
198
199/* Bitfields in MMUCR */
200#define SYSREG_E_OFFSET 0
201#define SYSREG_E_SIZE 1
202#define SYSREG_M_OFFSET 1
203#define SYSREG_M_SIZE 1
204#define SYSREG_MMUCR_I_OFFSET 2
205#define SYSREG_MMUCR_I_SIZE 1
206#define SYSREG_MMUCR_N_OFFSET 3
207#define SYSREG_MMUCR_N_SIZE 1
208#define SYSREG_MMUCR_S_OFFSET 4
209#define SYSREG_MMUCR_S_SIZE 1
210#define SYSREG_DLA_OFFSET 8
211#define SYSREG_DLA_SIZE 6
212#define SYSREG_DRP_OFFSET 14
213#define SYSREG_DRP_SIZE 6
214#define SYSREG_ILA_OFFSET 20
215#define SYSREG_ILA_SIZE 6
216#define SYSREG_IRP_OFFSET 26
217#define SYSREG_IRP_SIZE 6
218
219/* Bitfields in PCCR */
220#define SYSREG_PCCR_E_OFFSET 0
221#define SYSREG_PCCR_E_SIZE 1
222#define SYSREG_PCCR_R_OFFSET 1
223#define SYSREG_PCCR_R_SIZE 1
224#define SYSREG_PCCR_C_OFFSET 2
225#define SYSREG_PCCR_C_SIZE 1
226#define SYSREG_PCCR_S_OFFSET 3
227#define SYSREG_PCCR_S_SIZE 1
228#define SYSREG_IEC_OFFSET 4
229#define SYSREG_IEC_SIZE 1
230#define SYSREG_IE0_OFFSET 5
231#define SYSREG_IE0_SIZE 1
232#define SYSREG_IE1_OFFSET 6
233#define SYSREG_IE1_SIZE 1
234#define SYSREG_FC_OFFSET 8
235#define SYSREG_FC_SIZE 1
236#define SYSREG_F0_OFFSET 9
237#define SYSREG_F0_SIZE 1
238#define SYSREG_F1_OFFSET 10
239#define SYSREG_F1_SIZE 1
240#define SYSREG_CONF0_OFFSET 12
241#define SYSREG_CONF0_SIZE 6
242#define SYSREG_CONF1_OFFSET 18
243#define SYSREG_CONF1_SIZE 6
244
245/* Constants for ECR */
246#define ECR_UNRECOVERABLE 0
247#define ECR_TLB_MULTIPLE 1
248#define ECR_BUS_ERROR_WRITE 2
249#define ECR_BUS_ERROR_READ 3
250#define ECR_NMI 4
251#define ECR_ADDR_ALIGN_X 5
252#define ECR_PROTECTION_X 6
253#define ECR_DEBUG 7
254#define ECR_ILLEGAL_OPCODE 8
255#define ECR_UNIMPL_INSTRUCTION 9
256#define ECR_PRIVILEGE_VIOLATION 10
257#define ECR_FPE 11
258#define ECR_COPROC_ABSENT 12
259#define ECR_ADDR_ALIGN_R 13
260#define ECR_ADDR_ALIGN_W 14
261#define ECR_PROTECTION_R 15
262#define ECR_PROTECTION_W 16
263#define ECR_DTLB_MODIFIED 17
264#define ECR_TLB_MISS_X 20
265#define ECR_TLB_MISS_R 24
266#define ECR_TLB_MISS_W 28
267
268/* Bit manipulation macros */
269#define SYSREG_BIT(name) \
270 (1 << SYSREG_##name##_OFFSET)
271#define SYSREG_BF(name,value) \
272 (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) \
273 << SYSREG_##name##_OFFSET)
274#define SYSREG_BFEXT(name,value)\
275 (((value) >> SYSREG_##name##_OFFSET) \
276 & ((1 << SYSREG_##name##_SIZE) - 1))
277#define SYSREG_BFINS(name,value,old) \
278 (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) \
279 << SYSREG_##name##_OFFSET)) \
280 | SYSREG_BF(name,value))
281
282/* Register access macros */
283#ifdef __CHECKER__
284extern unsigned long __builtin_mfsr(unsigned long reg);
285extern void __builtin_mtsr(unsigned long reg, unsigned long value);
286#endif
287
288#define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg)
289#define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value)
290
291#endif /* __ASM_AVR32_SYSREG_H */
diff --git a/arch/avr32/include/asm/system.h b/arch/avr32/include/asm/system.h
new file mode 100644
index 000000000000..9702c2213e1e
--- /dev/null
+++ b/arch/avr32/include/asm/system.h
@@ -0,0 +1,178 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_SYSTEM_H
9#define __ASM_AVR32_SYSTEM_H
10
11#include <linux/compiler.h>
12#include <linux/linkage.h>
13#include <linux/types.h>
14
15#include <asm/ptrace.h>
16#include <asm/sysreg.h>
17
18#define xchg(ptr,x) \
19 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
20
21#define nop() asm volatile("nop")
22
23#define mb() asm volatile("" : : : "memory")
24#define rmb() mb()
25#define wmb() asm volatile("sync 0" : : : "memory")
26#define read_barrier_depends() do { } while(0)
27#define set_mb(var, value) do { var = value; mb(); } while(0)
28
29/*
30 * Help PathFinder and other Nexus-compliant debuggers keep track of
31 * the current PID by emitting an Ownership Trace Message each time we
32 * switch task.
33 */
34#ifdef CONFIG_OWNERSHIP_TRACE
35#include <asm/ocd.h>
36#define finish_arch_switch(prev) \
37 do { \
38 ocd_write(PID, prev->pid); \
39 ocd_write(PID, current->pid); \
40 } while(0)
41#endif
42
43/*
44 * switch_to(prev, next, last) should switch from task `prev' to task
45 * `next'. `prev' will never be the same as `next'.
46 *
47 * We just delegate everything to the __switch_to assembly function,
48 * which is implemented in arch/avr32/kernel/switch_to.S
49 *
50 * mb() tells GCC not to cache `current' across this call.
51 */
52struct cpu_context;
53struct task_struct;
54extern struct task_struct *__switch_to(struct task_struct *,
55 struct cpu_context *,
56 struct cpu_context *);
57#define switch_to(prev, next, last) \
58 do { \
59 last = __switch_to(prev, &prev->thread.cpu_context + 1, \
60 &next->thread.cpu_context); \
61 } while (0)
62
63#ifdef CONFIG_SMP
64# error "The AVR32 port does not support SMP"
65#else
66# define smp_mb() barrier()
67# define smp_rmb() barrier()
68# define smp_wmb() barrier()
69# define smp_read_barrier_depends() do { } while(0)
70#endif
71
72#include <linux/irqflags.h>
73
74extern void __xchg_called_with_bad_pointer(void);
75
76static inline unsigned long xchg_u32(u32 val, volatile u32 *m)
77{
78 u32 ret;
79
80 asm volatile("xchg %[ret], %[m], %[val]"
81 : [ret] "=&r"(ret), "=m"(*m)
82 : "m"(*m), [m] "r"(m), [val] "r"(val)
83 : "memory");
84 return ret;
85}
86
87static inline unsigned long __xchg(unsigned long x,
88 volatile void *ptr,
89 int size)
90{
91 switch(size) {
92 case 4:
93 return xchg_u32(x, ptr);
94 default:
95 __xchg_called_with_bad_pointer();
96 return x;
97 }
98}
99
100static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
101 unsigned long new)
102{
103 __u32 ret;
104
105 asm volatile(
106 "1: ssrf 5\n"
107 " ld.w %[ret], %[m]\n"
108 " cp.w %[ret], %[old]\n"
109 " brne 2f\n"
110 " stcond %[m], %[new]\n"
111 " brne 1b\n"
112 "2:\n"
113 : [ret] "=&r"(ret), [m] "=m"(*m)
114 : "m"(m), [old] "ir"(old), [new] "r"(new)
115 : "memory", "cc");
116 return ret;
117}
118
119extern unsigned long __cmpxchg_u64_unsupported_on_32bit_kernels(
120 volatile int * m, unsigned long old, unsigned long new);
121#define __cmpxchg_u64 __cmpxchg_u64_unsupported_on_32bit_kernels
122
123/* This function doesn't exist, so you'll get a linker error
124 if something tries to do an invalid cmpxchg(). */
125extern void __cmpxchg_called_with_bad_pointer(void);
126
127#define __HAVE_ARCH_CMPXCHG 1
128
129static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
130 unsigned long new, int size)
131{
132 switch (size) {
133 case 4:
134 return __cmpxchg_u32(ptr, old, new);
135 case 8:
136 return __cmpxchg_u64(ptr, old, new);
137 }
138
139 __cmpxchg_called_with_bad_pointer();
140 return old;
141}
142
143#define cmpxchg(ptr, old, new) \
144 ((typeof(*(ptr)))__cmpxchg((ptr), (unsigned long)(old), \
145 (unsigned long)(new), \
146 sizeof(*(ptr))))
147
148#include <asm-generic/cmpxchg-local.h>
149
150static inline unsigned long __cmpxchg_local(volatile void *ptr,
151 unsigned long old,
152 unsigned long new, int size)
153{
154 switch (size) {
155 case 4:
156 return __cmpxchg_u32(ptr, old, new);
157 default:
158 return __cmpxchg_local_generic(ptr, old, new, size);
159 }
160
161 return old;
162}
163
164#define cmpxchg_local(ptr, old, new) \
165 ((typeof(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(old), \
166 (unsigned long)(new), \
167 sizeof(*(ptr))))
168
169#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
170
171struct pt_regs;
172void NORET_TYPE die(const char *str, struct pt_regs *regs, long err);
173void _exception(long signr, struct pt_regs *regs, int code,
174 unsigned long addr);
175
176#define arch_align_stack(x) (x)
177
178#endif /* __ASM_AVR32_SYSTEM_H */
diff --git a/arch/avr32/include/asm/termbits.h b/arch/avr32/include/asm/termbits.h
new file mode 100644
index 000000000000..db2daab31fdb
--- /dev/null
+++ b/arch/avr32/include/asm/termbits.h
@@ -0,0 +1,195 @@
1#ifndef __ASM_AVR32_TERMBITS_H
2#define __ASM_AVR32_TERMBITS_H
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61/* c_iflag bits */
62#define IGNBRK 0000001
63#define BRKINT 0000002
64#define IGNPAR 0000004
65#define PARMRK 0000010
66#define INPCK 0000020
67#define ISTRIP 0000040
68#define INLCR 0000100
69#define IGNCR 0000200
70#define ICRNL 0000400
71#define IUCLC 0001000
72#define IXON 0002000
73#define IXANY 0004000
74#define IXOFF 0010000
75#define IMAXBEL 0020000
76#define IUTF8 0040000
77
78/* c_oflag bits */
79#define OPOST 0000001
80#define OLCUC 0000002
81#define ONLCR 0000004
82#define OCRNL 0000010
83#define ONOCR 0000020
84#define ONLRET 0000040
85#define OFILL 0000100
86#define OFDEL 0000200
87#define NLDLY 0000400
88#define NL0 0000000
89#define NL1 0000400
90#define CRDLY 0003000
91#define CR0 0000000
92#define CR1 0001000
93#define CR2 0002000
94#define CR3 0003000
95#define TABDLY 0014000
96#define TAB0 0000000
97#define TAB1 0004000
98#define TAB2 0010000
99#define TAB3 0014000
100#define XTABS 0014000
101#define BSDLY 0020000
102#define BS0 0000000
103#define BS1 0020000
104#define VTDLY 0040000
105#define VT0 0000000
106#define VT1 0040000
107#define FFDLY 0100000
108#define FF0 0000000
109#define FF1 0100000
110
111/* c_cflag bit meaning */
112#define CBAUD 0010017
113#define B0 0000000 /* hang up */
114#define B50 0000001
115#define B75 0000002
116#define B110 0000003
117#define B134 0000004
118#define B150 0000005
119#define B200 0000006
120#define B300 0000007
121#define B600 0000010
122#define B1200 0000011
123#define B1800 0000012
124#define B2400 0000013
125#define B4800 0000014
126#define B9600 0000015
127#define B19200 0000016
128#define B38400 0000017
129#define EXTA B19200
130#define EXTB B38400
131#define CSIZE 0000060
132#define CS5 0000000
133#define CS6 0000020
134#define CS7 0000040
135#define CS8 0000060
136#define CSTOPB 0000100
137#define CREAD 0000200
138#define PARENB 0000400
139#define PARODD 0001000
140#define HUPCL 0002000
141#define CLOCAL 0004000
142#define CBAUDEX 0010000
143#define B57600 0010001
144#define B115200 0010002
145#define B230400 0010003
146#define B460800 0010004
147#define B500000 0010005
148#define B576000 0010006
149#define B921600 0010007
150#define B1000000 0010010
151#define B1152000 0010011
152#define B1500000 0010012
153#define B2000000 0010013
154#define B2500000 0010014
155#define B3000000 0010015
156#define B3500000 0010016
157#define B4000000 0010017
158#define CIBAUD 002003600000 /* input baud rate (not used) */
159#define CMSPAR 010000000000 /* mark or space (stick) parity */
160#define CRTSCTS 020000000000 /* flow control */
161
162/* c_lflag bits */
163#define ISIG 0000001
164#define ICANON 0000002
165#define XCASE 0000004
166#define ECHO 0000010
167#define ECHOE 0000020
168#define ECHOK 0000040
169#define ECHONL 0000100
170#define NOFLSH 0000200
171#define TOSTOP 0000400
172#define ECHOCTL 0001000
173#define ECHOPRT 0002000
174#define ECHOKE 0004000
175#define FLUSHO 0010000
176#define PENDIN 0040000
177#define IEXTEN 0100000
178
179/* tcflow() and TCXONC use these */
180#define TCOOFF 0
181#define TCOON 1
182#define TCIOFF 2
183#define TCION 3
184
185/* tcflush() and TCFLSH use these */
186#define TCIFLUSH 0
187#define TCOFLUSH 1
188#define TCIOFLUSH 2
189
190/* tcsetattr uses these */
191#define TCSANOW 0
192#define TCSADRAIN 1
193#define TCSAFLUSH 2
194
195#endif /* __ASM_AVR32_TERMBITS_H */
diff --git a/arch/avr32/include/asm/termios.h b/arch/avr32/include/asm/termios.h
new file mode 100644
index 000000000000..0152aba35154
--- /dev/null
+++ b/arch/avr32/include/asm/termios.h
@@ -0,0 +1,62 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TERMIOS_H
9#define __ASM_AVR32_TERMIOS_H
10
11#include <asm/termbits.h>
12#include <asm/ioctls.h>
13
14struct winsize {
15 unsigned short ws_row;
16 unsigned short ws_col;
17 unsigned short ws_xpixel;
18 unsigned short ws_ypixel;
19};
20
21#define NCC 8
22struct termio {
23 unsigned short c_iflag; /* input mode flags */
24 unsigned short c_oflag; /* output mode flags */
25 unsigned short c_cflag; /* control mode flags */
26 unsigned short c_lflag; /* local mode flags */
27 unsigned char c_line; /* line discipline */
28 unsigned char c_cc[NCC]; /* control characters */
29};
30
31/* modem lines */
32#define TIOCM_LE 0x001
33#define TIOCM_DTR 0x002
34#define TIOCM_RTS 0x004
35#define TIOCM_ST 0x008
36#define TIOCM_SR 0x010
37#define TIOCM_CTS 0x020
38#define TIOCM_CAR 0x040
39#define TIOCM_RNG 0x080
40#define TIOCM_DSR 0x100
41#define TIOCM_CD TIOCM_CAR
42#define TIOCM_RI TIOCM_RNG
43#define TIOCM_OUT1 0x2000
44#define TIOCM_OUT2 0x4000
45#define TIOCM_LOOP 0x8000
46
47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
48
49#ifdef __KERNEL__
50/* intr=^C quit=^\ erase=del kill=^U
51 eof=^D vtime=\0 vmin=\1 sxtc=\0
52 start=^Q stop=^S susp=^Z eol=\0
53 reprint=^R discard=^U werase=^W lnext=^V
54 eol2=\0
55*/
56#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
57
58#include <asm-generic/termios.h>
59
60#endif /* __KERNEL__ */
61
62#endif /* __ASM_AVR32_TERMIOS_H */
diff --git a/arch/avr32/include/asm/thread_info.h b/arch/avr32/include/asm/thread_info.h
new file mode 100644
index 000000000000..294b25f9323d
--- /dev/null
+++ b/arch/avr32/include/asm/thread_info.h
@@ -0,0 +1,115 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_THREAD_INFO_H
9#define __ASM_AVR32_THREAD_INFO_H
10
11#include <asm/page.h>
12
13#define THREAD_SIZE_ORDER 1
14#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
15
16#ifndef __ASSEMBLY__
17#include <asm/types.h>
18
19struct task_struct;
20struct exec_domain;
21
22struct thread_info {
23 struct task_struct *task; /* main task structure */
24 struct exec_domain *exec_domain; /* execution domain */
25 unsigned long flags; /* low level flags */
26 __u32 cpu;
27 __s32 preempt_count; /* 0 => preemptable, <0 => BUG */
28 __u32 rar_saved; /* return address... */
29 __u32 rsr_saved; /* ...and status register
30 saved by debug handler
31 when setting up
32 trampoline */
33 struct restart_block restart_block;
34 __u8 supervisor_stack[0];
35};
36
37#define INIT_THREAD_INFO(tsk) \
38{ \
39 .task = &tsk, \
40 .exec_domain = &default_exec_domain, \
41 .flags = 0, \
42 .cpu = 0, \
43 .preempt_count = 1, \
44 .restart_block = { \
45 .fn = do_no_restart_syscall \
46 } \
47}
48
49#define init_thread_info (init_thread_union.thread_info)
50#define init_stack (init_thread_union.stack)
51
52/*
53 * Get the thread information struct from C.
54 * We do the usual trick and use the lower end of the stack for this
55 */
56static inline struct thread_info *current_thread_info(void)
57{
58 unsigned long addr = ~(THREAD_SIZE - 1);
59
60 asm("and %0, sp" : "=r"(addr) : "0"(addr));
61 return (struct thread_info *)addr;
62}
63
64#define get_thread_info(ti) get_task_struct((ti)->task)
65#define put_thread_info(ti) put_task_struct((ti)->task)
66
67#endif /* !__ASSEMBLY__ */
68
69#define PREEMPT_ACTIVE 0x40000000
70
71/*
72 * Thread information flags
73 * - these are process state flags that various assembly files may need to access
74 * - pending work-to-be-done flags are in LSW
75 * - other flags in MSW
76 */
77#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
78#define TIF_SIGPENDING 1 /* signal pending */
79#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
80#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
81 TIF_NEED_RESCHED */
82#define TIF_BREAKPOINT 4 /* enter monitor mode on return */
83#define TIF_SINGLE_STEP 5 /* single step in progress */
84#define TIF_MEMDIE 6
85#define TIF_RESTORE_SIGMASK 7 /* restore signal mask in do_signal */
86#define TIF_CPU_GOING_TO_SLEEP 8 /* CPU is entering sleep 0 mode */
87#define TIF_FREEZE 29
88#define TIF_DEBUG 30 /* debugging enabled */
89#define TIF_USERSPACE 31 /* true if FS sets userspace */
90
91#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
92#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
93#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
94#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
95#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP)
96#define _TIF_MEMDIE (1 << TIF_MEMDIE)
97#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
98#define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP)
99
100/* Note: The masks below must never span more than 16 bits! */
101
102/* work to do on interrupt/exception return */
103#define _TIF_WORK_MASK \
104 ((1 << TIF_SIGPENDING) \
105 | (1 << TIF_NEED_RESCHED) \
106 | (1 << TIF_POLLING_NRFLAG) \
107 | (1 << TIF_BREAKPOINT) \
108 | (1 << TIF_RESTORE_SIGMASK))
109
110/* work to do on any return to userspace */
111#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | (1 << TIF_SYSCALL_TRACE))
112/* work to do on return from debug mode */
113#define _TIF_DBGWORK_MASK (_TIF_WORK_MASK & ~(1 << TIF_BREAKPOINT))
114
115#endif /* __ASM_AVR32_THREAD_INFO_H */
diff --git a/arch/avr32/include/asm/timex.h b/arch/avr32/include/asm/timex.h
new file mode 100644
index 000000000000..187dcf38b210
--- /dev/null
+++ b/arch/avr32/include/asm/timex.h
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TIMEX_H
9#define __ASM_AVR32_TIMEX_H
10
11/*
12 * This is the frequency of the timer used for Linux's timer interrupt.
13 * The value should be defined as accurate as possible or under certain
14 * circumstances Linux timekeeping might become inaccurate or fail.
15 *
16 * For many system the exact clockrate of the timer isn't known but due to
17 * the way this value is used we can get away with a wrong value as long
18 * as this value is:
19 *
20 * - a multiple of HZ
21 * - a divisor of the actual rate
22 *
23 * 500000 is a good such cheat value.
24 *
25 * The obscure number 1193182 is the same as used by the original i8254
26 * time in legacy PC hardware; the chip is never found in AVR32 systems.
27 */
28#define CLOCK_TICK_RATE 500000 /* Underlying HZ */
29
30typedef unsigned long cycles_t;
31
32static inline cycles_t get_cycles (void)
33{
34 return 0;
35}
36
37#define ARCH_HAS_READ_CURRENT_TIMER
38
39#endif /* __ASM_AVR32_TIMEX_H */
diff --git a/arch/avr32/include/asm/tlb.h b/arch/avr32/include/asm/tlb.h
new file mode 100644
index 000000000000..5c55f9ce7c7d
--- /dev/null
+++ b/arch/avr32/include/asm/tlb.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TLB_H
9#define __ASM_AVR32_TLB_H
10
11#define tlb_start_vma(tlb, vma) \
12 flush_cache_range(vma, vma->vm_start, vma->vm_end)
13
14#define tlb_end_vma(tlb, vma) \
15 flush_tlb_range(vma, vma->vm_start, vma->vm_end)
16
17#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while(0)
18
19/*
20 * Flush whole TLB for MM
21 */
22#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
23
24#include <asm-generic/tlb.h>
25
26/*
27 * For debugging purposes
28 */
29extern void show_dtlb_entry(unsigned int index);
30extern void dump_dtlb(void);
31
32#endif /* __ASM_AVR32_TLB_H */
diff --git a/arch/avr32/include/asm/tlbflush.h b/arch/avr32/include/asm/tlbflush.h
new file mode 100644
index 000000000000..bf90a786f6be
--- /dev/null
+++ b/arch/avr32/include/asm/tlbflush.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TLBFLUSH_H
9#define __ASM_AVR32_TLBFLUSH_H
10
11#include <asm/mmu.h>
12
13/*
14 * TLB flushing:
15 *
16 * - flush_tlb() flushes the current mm struct TLBs
17 * - flush_tlb_all() flushes all processes' TLB entries
18 * - flush_tlb_mm(mm) flushes the specified mm context TLBs
19 * - flush_tlb_page(vma, vmaddr) flushes one page
20 * - flush_tlb_range(vma, start, end) flushes a range of pages
21 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
22 */
23extern void flush_tlb(void);
24extern void flush_tlb_all(void);
25extern void flush_tlb_mm(struct mm_struct *mm);
26extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
27 unsigned long end);
28extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
29
30extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
31
32#endif /* __ASM_AVR32_TLBFLUSH_H */
diff --git a/arch/avr32/include/asm/topology.h b/arch/avr32/include/asm/topology.h
new file mode 100644
index 000000000000..5b766cbb4806
--- /dev/null
+++ b/arch/avr32/include/asm/topology.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_TOPOLOGY_H
2#define __ASM_AVR32_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* __ASM_AVR32_TOPOLOGY_H */
diff --git a/arch/avr32/include/asm/traps.h b/arch/avr32/include/asm/traps.h
new file mode 100644
index 000000000000..6a8fb944f414
--- /dev/null
+++ b/arch/avr32/include/asm/traps.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TRAPS_H
9#define __ASM_AVR32_TRAPS_H
10
11#include <linux/list.h>
12
13struct undef_hook {
14 struct list_head node;
15 u32 insn_mask;
16 u32 insn_val;
17 int (*fn)(struct pt_regs *regs, u32 insn);
18};
19
20void register_undef_hook(struct undef_hook *hook);
21void unregister_undef_hook(struct undef_hook *hook);
22
23#endif /* __ASM_AVR32_TRAPS_H */
diff --git a/arch/avr32/include/asm/types.h b/arch/avr32/include/asm/types.h
new file mode 100644
index 000000000000..9cefda6f534a
--- /dev/null
+++ b/arch/avr32/include/asm/types.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_TYPES_H
9#define __ASM_AVR32_TYPES_H
10
11#include <asm-generic/int-ll64.h>
12
13#ifndef __ASSEMBLY__
14
15typedef unsigned short umode_t;
16
17#endif /* __ASSEMBLY__ */
18
19/*
20 * These aren't exported outside the kernel to avoid name space clashes
21 */
22#ifdef __KERNEL__
23
24#define BITS_PER_LONG 32
25
26#ifndef __ASSEMBLY__
27
28/* Dma addresses are 32-bits wide. */
29
30typedef u32 dma_addr_t;
31
32#endif /* __ASSEMBLY__ */
33
34#endif /* __KERNEL__ */
35
36
37#endif /* __ASM_AVR32_TYPES_H */
diff --git a/arch/avr32/include/asm/uaccess.h b/arch/avr32/include/asm/uaccess.h
new file mode 100644
index 000000000000..ed092395215e
--- /dev/null
+++ b/arch/avr32/include/asm/uaccess.h
@@ -0,0 +1,324 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_UACCESS_H
9#define __ASM_AVR32_UACCESS_H
10
11#include <linux/errno.h>
12#include <linux/sched.h>
13
14#define VERIFY_READ 0
15#define VERIFY_WRITE 1
16
17typedef struct {
18 unsigned int is_user_space;
19} mm_segment_t;
20
21/*
22 * The fs value determines whether argument validity checking should be
23 * performed or not. If get_fs() == USER_DS, checking is performed, with
24 * get_fs() == KERNEL_DS, checking is bypassed.
25 *
26 * For historical reasons (Data Segment Register?), these macros are misnamed.
27 */
28#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
29#define segment_eq(a,b) ((a).is_user_space == (b).is_user_space)
30
31#define USER_ADDR_LIMIT 0x80000000
32
33#define KERNEL_DS MAKE_MM_SEG(0)
34#define USER_DS MAKE_MM_SEG(1)
35
36#define get_ds() (KERNEL_DS)
37
38static inline mm_segment_t get_fs(void)
39{
40 return MAKE_MM_SEG(test_thread_flag(TIF_USERSPACE));
41}
42
43static inline void set_fs(mm_segment_t s)
44{
45 if (s.is_user_space)
46 set_thread_flag(TIF_USERSPACE);
47 else
48 clear_thread_flag(TIF_USERSPACE);
49}
50
51/*
52 * Test whether a block of memory is a valid user space address.
53 * Returns 0 if the range is valid, nonzero otherwise.
54 *
55 * We do the following checks:
56 * 1. Is the access from kernel space?
57 * 2. Does (addr + size) set the carry bit?
58 * 3. Is (addr + size) a negative number (i.e. >= 0x80000000)?
59 *
60 * If yes on the first check, access is granted.
61 * If no on any of the others, access is denied.
62 */
63#define __range_ok(addr, size) \
64 (test_thread_flag(TIF_USERSPACE) \
65 && (((unsigned long)(addr) >= 0x80000000) \
66 || ((unsigned long)(size) > 0x80000000) \
67 || (((unsigned long)(addr) + (unsigned long)(size)) > 0x80000000)))
68
69#define access_ok(type, addr, size) (likely(__range_ok(addr, size) == 0))
70
71/* Generic arbitrary sized copy. Return the number of bytes NOT copied */
72extern __kernel_size_t __copy_user(void *to, const void *from,
73 __kernel_size_t n);
74
75extern __kernel_size_t copy_to_user(void __user *to, const void *from,
76 __kernel_size_t n);
77extern __kernel_size_t copy_from_user(void *to, const void __user *from,
78 __kernel_size_t n);
79
80static inline __kernel_size_t __copy_to_user(void __user *to, const void *from,
81 __kernel_size_t n)
82{
83 return __copy_user((void __force *)to, from, n);
84}
85static inline __kernel_size_t __copy_from_user(void *to,
86 const void __user *from,
87 __kernel_size_t n)
88{
89 return __copy_user(to, (const void __force *)from, n);
90}
91
92#define __copy_to_user_inatomic __copy_to_user
93#define __copy_from_user_inatomic __copy_from_user
94
95/*
96 * put_user: - Write a simple value into user space.
97 * @x: Value to copy to user space.
98 * @ptr: Destination address, in user space.
99 *
100 * Context: User context only. This function may sleep.
101 *
102 * This macro copies a single simple value from kernel space to user
103 * space. It supports simple types like char and int, but not larger
104 * data types like structures or arrays.
105 *
106 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
107 * to the result of dereferencing @ptr.
108 *
109 * Returns zero on success, or -EFAULT on error.
110 */
111#define put_user(x,ptr) \
112 __put_user_check((x),(ptr),sizeof(*(ptr)))
113
114/*
115 * get_user: - Get a simple variable from user space.
116 * @x: Variable to store result.
117 * @ptr: Source address, in user space.
118 *
119 * Context: User context only. This function may sleep.
120 *
121 * This macro copies a single simple variable from user space to kernel
122 * space. It supports simple types like char and int, but not larger
123 * data types like structures or arrays.
124 *
125 * @ptr must have pointer-to-simple-variable type, and the result of
126 * dereferencing @ptr must be assignable to @x without a cast.
127 *
128 * Returns zero on success, or -EFAULT on error.
129 * On error, the variable @x is set to zero.
130 */
131#define get_user(x,ptr) \
132 __get_user_check((x),(ptr),sizeof(*(ptr)))
133
134/*
135 * __put_user: - Write a simple value into user space, with less checking.
136 * @x: Value to copy to user space.
137 * @ptr: Destination address, in user space.
138 *
139 * Context: User context only. This function may sleep.
140 *
141 * This macro copies a single simple value from kernel space to user
142 * space. It supports simple types like char and int, but not larger
143 * data types like structures or arrays.
144 *
145 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
146 * to the result of dereferencing @ptr.
147 *
148 * Caller must check the pointer with access_ok() before calling this
149 * function.
150 *
151 * Returns zero on success, or -EFAULT on error.
152 */
153#define __put_user(x,ptr) \
154 __put_user_nocheck((x),(ptr),sizeof(*(ptr)))
155
156/*
157 * __get_user: - Get a simple variable from user space, with less checking.
158 * @x: Variable to store result.
159 * @ptr: Source address, in user space.
160 *
161 * Context: User context only. This function may sleep.
162 *
163 * This macro copies a single simple variable from user space to kernel
164 * space. It supports simple types like char and int, but not larger
165 * data types like structures or arrays.
166 *
167 * @ptr must have pointer-to-simple-variable type, and the result of
168 * dereferencing @ptr must be assignable to @x without a cast.
169 *
170 * Caller must check the pointer with access_ok() before calling this
171 * function.
172 *
173 * Returns zero on success, or -EFAULT on error.
174 * On error, the variable @x is set to zero.
175 */
176#define __get_user(x,ptr) \
177 __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
178
179extern int __get_user_bad(void);
180extern int __put_user_bad(void);
181
182#define __get_user_nocheck(x, ptr, size) \
183({ \
184 unsigned long __gu_val = 0; \
185 int __gu_err = 0; \
186 \
187 switch (size) { \
188 case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \
189 case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \
190 case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \
191 default: __gu_err = __get_user_bad(); break; \
192 } \
193 \
194 x = (typeof(*(ptr)))__gu_val; \
195 __gu_err; \
196})
197
198#define __get_user_check(x, ptr, size) \
199({ \
200 unsigned long __gu_val = 0; \
201 const typeof(*(ptr)) __user * __gu_addr = (ptr); \
202 int __gu_err = 0; \
203 \
204 if (access_ok(VERIFY_READ, __gu_addr, size)) { \
205 switch (size) { \
206 case 1: \
207 __get_user_asm("ub", __gu_val, __gu_addr, \
208 __gu_err); \
209 break; \
210 case 2: \
211 __get_user_asm("uh", __gu_val, __gu_addr, \
212 __gu_err); \
213 break; \
214 case 4: \
215 __get_user_asm("w", __gu_val, __gu_addr, \
216 __gu_err); \
217 break; \
218 default: \
219 __gu_err = __get_user_bad(); \
220 break; \
221 } \
222 } else { \
223 __gu_err = -EFAULT; \
224 } \
225 x = (typeof(*(ptr)))__gu_val; \
226 __gu_err; \
227})
228
229#define __get_user_asm(suffix, __gu_val, ptr, __gu_err) \
230 asm volatile( \
231 "1: ld." suffix " %1, %3 \n" \
232 "2: \n" \
233 " .section .fixup, \"ax\" \n" \
234 "3: mov %0, %4 \n" \
235 " rjmp 2b \n" \
236 " .previous \n" \
237 " .section __ex_table, \"a\" \n" \
238 " .long 1b, 3b \n" \
239 " .previous \n" \
240 : "=r"(__gu_err), "=r"(__gu_val) \
241 : "0"(__gu_err), "m"(*(ptr)), "i"(-EFAULT))
242
243#define __put_user_nocheck(x, ptr, size) \
244({ \
245 typeof(*(ptr)) __pu_val; \
246 int __pu_err = 0; \
247 \
248 __pu_val = (x); \
249 switch (size) { \
250 case 1: __put_user_asm("b", ptr, __pu_val, __pu_err); break; \
251 case 2: __put_user_asm("h", ptr, __pu_val, __pu_err); break; \
252 case 4: __put_user_asm("w", ptr, __pu_val, __pu_err); break; \
253 case 8: __put_user_asm("d", ptr, __pu_val, __pu_err); break; \
254 default: __pu_err = __put_user_bad(); break; \
255 } \
256 __pu_err; \
257})
258
259#define __put_user_check(x, ptr, size) \
260({ \
261 typeof(*(ptr)) __pu_val; \
262 typeof(*(ptr)) __user *__pu_addr = (ptr); \
263 int __pu_err = 0; \
264 \
265 __pu_val = (x); \
266 if (access_ok(VERIFY_WRITE, __pu_addr, size)) { \
267 switch (size) { \
268 case 1: \
269 __put_user_asm("b", __pu_addr, __pu_val, \
270 __pu_err); \
271 break; \
272 case 2: \
273 __put_user_asm("h", __pu_addr, __pu_val, \
274 __pu_err); \
275 break; \
276 case 4: \
277 __put_user_asm("w", __pu_addr, __pu_val, \
278 __pu_err); \
279 break; \
280 case 8: \
281 __put_user_asm("d", __pu_addr, __pu_val, \
282 __pu_err); \
283 break; \
284 default: \
285 __pu_err = __put_user_bad(); \
286 break; \
287 } \
288 } else { \
289 __pu_err = -EFAULT; \
290 } \
291 __pu_err; \
292})
293
294#define __put_user_asm(suffix, ptr, __pu_val, __gu_err) \
295 asm volatile( \
296 "1: st." suffix " %1, %3 \n" \
297 "2: \n" \
298 " .section .fixup, \"ax\" \n" \
299 "3: mov %0, %4 \n" \
300 " rjmp 2b \n" \
301 " .previous \n" \
302 " .section __ex_table, \"a\" \n" \
303 " .long 1b, 3b \n" \
304 " .previous \n" \
305 : "=r"(__gu_err), "=m"(*(ptr)) \
306 : "0"(__gu_err), "r"(__pu_val), "i"(-EFAULT))
307
308extern __kernel_size_t clear_user(void __user *addr, __kernel_size_t size);
309extern __kernel_size_t __clear_user(void __user *addr, __kernel_size_t size);
310
311extern long strncpy_from_user(char *dst, const char __user *src, long count);
312extern long __strncpy_from_user(char *dst, const char __user *src, long count);
313
314extern long strnlen_user(const char __user *__s, long __n);
315extern long __strnlen_user(const char __user *__s, long __n);
316
317#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
318
319struct exception_table_entry
320{
321 unsigned long insn, fixup;
322};
323
324#endif /* __ASM_AVR32_UACCESS_H */
diff --git a/arch/avr32/include/asm/ucontext.h b/arch/avr32/include/asm/ucontext.h
new file mode 100644
index 000000000000..ac7259c2a799
--- /dev/null
+++ b/arch/avr32/include/asm/ucontext.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_AVR32_UCONTEXT_H
2#define __ASM_AVR32_UCONTEXT_H
3
4struct ucontext {
5 unsigned long uc_flags;
6 struct ucontext * uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask;
10};
11
12#endif /* __ASM_AVR32_UCONTEXT_H */
diff --git a/arch/avr32/include/asm/unaligned.h b/arch/avr32/include/asm/unaligned.h
new file mode 100644
index 000000000000..041877290470
--- /dev/null
+++ b/arch/avr32/include/asm/unaligned.h
@@ -0,0 +1,21 @@
1#ifndef _ASM_AVR32_UNALIGNED_H
2#define _ASM_AVR32_UNALIGNED_H
3
4/*
5 * AVR32 can handle some unaligned accesses, depending on the
6 * implementation. The AVR32 AP implementation can handle unaligned
7 * words, but halfwords must be halfword-aligned, and doublewords must
8 * be word-aligned.
9 *
10 * However, swapped word loads must be word-aligned so we can't
11 * optimize word loads in general.
12 */
13
14#include <linux/unaligned/be_struct.h>
15#include <linux/unaligned/le_byteshift.h>
16#include <linux/unaligned/generic.h>
17
18#define get_unaligned __get_unaligned_be
19#define put_unaligned __put_unaligned_be
20
21#endif /* _ASM_AVR32_UNALIGNED_H */
diff --git a/arch/avr32/include/asm/unistd.h b/arch/avr32/include/asm/unistd.h
new file mode 100644
index 000000000000..89861a27543e
--- /dev/null
+++ b/arch/avr32/include/asm/unistd.h
@@ -0,0 +1,345 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_UNISTD_H
9#define __ASM_AVR32_UNISTD_H
10
11/*
12 * This file contains the system call numbers.
13 */
14
15#define __NR_restart_syscall 0
16#define __NR_exit 1
17#define __NR_fork 2
18#define __NR_read 3
19#define __NR_write 4
20#define __NR_open 5
21#define __NR_close 6
22#define __NR_umask 7
23#define __NR_creat 8
24#define __NR_link 9
25#define __NR_unlink 10
26#define __NR_execve 11
27#define __NR_chdir 12
28#define __NR_time 13
29#define __NR_mknod 14
30#define __NR_chmod 15
31#define __NR_chown 16
32#define __NR_lchown 17
33#define __NR_lseek 18
34#define __NR__llseek 19
35#define __NR_getpid 20
36#define __NR_mount 21
37#define __NR_umount2 22
38#define __NR_setuid 23
39#define __NR_getuid 24
40#define __NR_stime 25
41#define __NR_ptrace 26
42#define __NR_alarm 27
43#define __NR_pause 28
44#define __NR_utime 29
45#define __NR_stat 30
46#define __NR_fstat 31
47#define __NR_lstat 32
48#define __NR_access 33
49#define __NR_chroot 34
50#define __NR_sync 35
51#define __NR_fsync 36
52#define __NR_kill 37
53#define __NR_rename 38
54#define __NR_mkdir 39
55#define __NR_rmdir 40
56#define __NR_dup 41
57#define __NR_pipe 42
58#define __NR_times 43
59#define __NR_clone 44
60#define __NR_brk 45
61#define __NR_setgid 46
62#define __NR_getgid 47
63#define __NR_getcwd 48
64#define __NR_geteuid 49
65#define __NR_getegid 50
66#define __NR_acct 51
67#define __NR_setfsuid 52
68#define __NR_setfsgid 53
69#define __NR_ioctl 54
70#define __NR_fcntl 55
71#define __NR_setpgid 56
72#define __NR_mremap 57
73#define __NR_setresuid 58
74#define __NR_getresuid 59
75#define __NR_setreuid 60
76#define __NR_setregid 61
77#define __NR_ustat 62
78#define __NR_dup2 63
79#define __NR_getppid 64
80#define __NR_getpgrp 65
81#define __NR_setsid 66
82#define __NR_rt_sigaction 67
83#define __NR_rt_sigreturn 68
84#define __NR_rt_sigprocmask 69
85#define __NR_rt_sigpending 70
86#define __NR_rt_sigtimedwait 71
87#define __NR_rt_sigqueueinfo 72
88#define __NR_rt_sigsuspend 73
89#define __NR_sethostname 74
90#define __NR_setrlimit 75
91#define __NR_getrlimit 76 /* SuS compliant getrlimit */
92#define __NR_getrusage 77
93#define __NR_gettimeofday 78
94#define __NR_settimeofday 79
95#define __NR_getgroups 80
96#define __NR_setgroups 81
97#define __NR_select 82
98#define __NR_symlink 83
99#define __NR_fchdir 84
100#define __NR_readlink 85
101#define __NR_pread 86
102#define __NR_pwrite 87
103#define __NR_swapon 88
104#define __NR_reboot 89
105#define __NR_mmap2 90
106#define __NR_munmap 91
107#define __NR_truncate 92
108#define __NR_ftruncate 93
109#define __NR_fchmod 94
110#define __NR_fchown 95
111#define __NR_getpriority 96
112#define __NR_setpriority 97
113#define __NR_wait4 98
114#define __NR_statfs 99
115#define __NR_fstatfs 100
116#define __NR_vhangup 101
117#define __NR_sigaltstack 102
118#define __NR_syslog 103
119#define __NR_setitimer 104
120#define __NR_getitimer 105
121#define __NR_swapoff 106
122#define __NR_sysinfo 107
123/* 108 was __NR_ipc for a little while */
124#define __NR_sendfile 109
125#define __NR_setdomainname 110
126#define __NR_uname 111
127#define __NR_adjtimex 112
128#define __NR_mprotect 113
129#define __NR_vfork 114
130#define __NR_init_module 115
131#define __NR_delete_module 116
132#define __NR_quotactl 117
133#define __NR_getpgid 118
134#define __NR_bdflush 119
135#define __NR_sysfs 120
136#define __NR_personality 121
137#define __NR_afs_syscall 122 /* Syscall for Andrew File System */
138#define __NR_getdents 123
139#define __NR_flock 124
140#define __NR_msync 125
141#define __NR_readv 126
142#define __NR_writev 127
143#define __NR_getsid 128
144#define __NR_fdatasync 129
145#define __NR__sysctl 130
146#define __NR_mlock 131
147#define __NR_munlock 132
148#define __NR_mlockall 133
149#define __NR_munlockall 134
150#define __NR_sched_setparam 135
151#define __NR_sched_getparam 136
152#define __NR_sched_setscheduler 137
153#define __NR_sched_getscheduler 138
154#define __NR_sched_yield 139
155#define __NR_sched_get_priority_max 140
156#define __NR_sched_get_priority_min 141
157#define __NR_sched_rr_get_interval 142
158#define __NR_nanosleep 143
159#define __NR_poll 144
160#define __NR_nfsservctl 145
161#define __NR_setresgid 146
162#define __NR_getresgid 147
163#define __NR_prctl 148
164#define __NR_socket 149
165#define __NR_bind 150
166#define __NR_connect 151
167#define __NR_listen 152
168#define __NR_accept 153
169#define __NR_getsockname 154
170#define __NR_getpeername 155
171#define __NR_socketpair 156
172#define __NR_send 157
173#define __NR_recv 158
174#define __NR_sendto 159
175#define __NR_recvfrom 160
176#define __NR_shutdown 161
177#define __NR_setsockopt 162
178#define __NR_getsockopt 163
179#define __NR_sendmsg 164
180#define __NR_recvmsg 165
181#define __NR_truncate64 166
182#define __NR_ftruncate64 167
183#define __NR_stat64 168
184#define __NR_lstat64 169
185#define __NR_fstat64 170
186#define __NR_pivot_root 171
187#define __NR_mincore 172
188#define __NR_madvise 173
189#define __NR_getdents64 174
190#define __NR_fcntl64 175
191#define __NR_gettid 176
192#define __NR_readahead 177
193#define __NR_setxattr 178
194#define __NR_lsetxattr 179
195#define __NR_fsetxattr 180
196#define __NR_getxattr 181
197#define __NR_lgetxattr 182
198#define __NR_fgetxattr 183
199#define __NR_listxattr 184
200#define __NR_llistxattr 185
201#define __NR_flistxattr 186
202#define __NR_removexattr 187
203#define __NR_lremovexattr 188
204#define __NR_fremovexattr 189
205#define __NR_tkill 190
206#define __NR_sendfile64 191
207#define __NR_futex 192
208#define __NR_sched_setaffinity 193
209#define __NR_sched_getaffinity 194
210#define __NR_capget 195
211#define __NR_capset 196
212#define __NR_io_setup 197
213#define __NR_io_destroy 198
214#define __NR_io_getevents 199
215#define __NR_io_submit 200
216#define __NR_io_cancel 201
217#define __NR_fadvise64 202
218#define __NR_exit_group 203
219#define __NR_lookup_dcookie 204
220#define __NR_epoll_create 205
221#define __NR_epoll_ctl 206
222#define __NR_epoll_wait 207
223#define __NR_remap_file_pages 208
224#define __NR_set_tid_address 209
225
226#define __NR_timer_create 210
227#define __NR_timer_settime 211
228#define __NR_timer_gettime 212
229#define __NR_timer_getoverrun 213
230#define __NR_timer_delete 214
231#define __NR_clock_settime 215
232#define __NR_clock_gettime 216
233#define __NR_clock_getres 217
234#define __NR_clock_nanosleep 218
235#define __NR_statfs64 219
236#define __NR_fstatfs64 220
237#define __NR_tgkill 221
238 /* 222 reserved for tux */
239#define __NR_utimes 223
240#define __NR_fadvise64_64 224
241
242#define __NR_cacheflush 225
243
244#define __NR_vserver 226
245#define __NR_mq_open 227
246#define __NR_mq_unlink 228
247#define __NR_mq_timedsend 229
248#define __NR_mq_timedreceive 230
249#define __NR_mq_notify 231
250#define __NR_mq_getsetattr 232
251#define __NR_kexec_load 233
252#define __NR_waitid 234
253#define __NR_add_key 235
254#define __NR_request_key 236
255#define __NR_keyctl 237
256#define __NR_ioprio_set 238
257#define __NR_ioprio_get 239
258#define __NR_inotify_init 240
259#define __NR_inotify_add_watch 241
260#define __NR_inotify_rm_watch 242
261#define __NR_openat 243
262#define __NR_mkdirat 244
263#define __NR_mknodat 245
264#define __NR_fchownat 246
265#define __NR_futimesat 247
266#define __NR_fstatat64 248
267#define __NR_unlinkat 249
268#define __NR_renameat 250
269#define __NR_linkat 251
270#define __NR_symlinkat 252
271#define __NR_readlinkat 253
272#define __NR_fchmodat 254
273#define __NR_faccessat 255
274#define __NR_pselect6 256
275#define __NR_ppoll 257
276#define __NR_unshare 258
277#define __NR_set_robust_list 259
278#define __NR_get_robust_list 260
279#define __NR_splice 261
280#define __NR_sync_file_range 262
281#define __NR_tee 263
282#define __NR_vmsplice 264
283#define __NR_epoll_pwait 265
284
285#define __NR_msgget 266
286#define __NR_msgsnd 267
287#define __NR_msgrcv 268
288#define __NR_msgctl 269
289#define __NR_semget 270
290#define __NR_semop 271
291#define __NR_semctl 272
292#define __NR_semtimedop 273
293#define __NR_shmat 274
294#define __NR_shmget 275
295#define __NR_shmdt 276
296#define __NR_shmctl 277
297
298#define __NR_utimensat 278
299#define __NR_signalfd 279
300/* 280 was __NR_timerfd */
301#define __NR_eventfd 281
302
303#ifdef __KERNEL__
304#define NR_syscalls 282
305
306/* Old stuff */
307#define __IGNORE_uselib
308#define __IGNORE_mmap
309
310/* NUMA stuff */
311#define __IGNORE_mbind
312#define __IGNORE_get_mempolicy
313#define __IGNORE_set_mempolicy
314#define __IGNORE_migrate_pages
315#define __IGNORE_move_pages
316
317/* SMP stuff */
318#define __IGNORE_getcpu
319
320#define __ARCH_WANT_IPC_PARSE_VERSION
321#define __ARCH_WANT_STAT64
322#define __ARCH_WANT_SYS_ALARM
323#define __ARCH_WANT_SYS_GETHOSTNAME
324#define __ARCH_WANT_SYS_PAUSE
325#define __ARCH_WANT_SYS_TIME
326#define __ARCH_WANT_SYS_UTIME
327#define __ARCH_WANT_SYS_WAITPID
328#define __ARCH_WANT_SYS_FADVISE64
329#define __ARCH_WANT_SYS_GETPGRP
330#define __ARCH_WANT_SYS_LLSEEK
331#define __ARCH_WANT_SYS_GETPGRP
332#define __ARCH_WANT_SYS_RT_SIGACTION
333#define __ARCH_WANT_SYS_RT_SIGSUSPEND
334
335/*
336 * "Conditional" syscalls
337 *
338 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
339 * but it doesn't work on all toolchains, so we just do it by hand
340 */
341#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
342
343#endif /* __KERNEL__ */
344
345#endif /* __ASM_AVR32_UNISTD_H */
diff --git a/arch/avr32/include/asm/user.h b/arch/avr32/include/asm/user.h
new file mode 100644
index 000000000000..7e9152f81f5e
--- /dev/null
+++ b/arch/avr32/include/asm/user.h
@@ -0,0 +1,65 @@
1/*
2 * Copyright (C) 2004-2006 Atmel 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 version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Note: We may not need these definitions for AVR32, as we don't
9 * support a.out.
10 */
11#ifndef __ASM_AVR32_USER_H
12#define __ASM_AVR32_USER_H
13
14#include <linux/types.h>
15#include <asm/ptrace.h>
16#include <asm/page.h>
17
18/*
19 * Core file format: The core file is written in such a way that gdb
20 * can understand it and provide useful information to the user (under
21 * linux we use the `trad-core' bfd). The file contents are as follows:
22 *
23 * upage: 1 page consisting of a user struct that tells gdb
24 * what is present in the file. Directly after this is a
25 * copy of the task_struct, which is currently not used by gdb,
26 * but it may come in handy at some point. All of the registers
27 * are stored as part of the upage. The upage should always be
28 * only one page long.
29 * data: The data segment follows next. We use current->end_text to
30 * current->brk to pick up all of the user variables, plus any memory
31 * that may have been sbrk'ed. No attempt is made to determine if a
32 * page is demand-zero or if a page is totally unused, we just cover
33 * the entire range. All of the addresses are rounded in such a way
34 * that an integral number of pages is written.
35 * stack: We need the stack information in order to get a meaningful
36 * backtrace. We need to write the data from usp to
37 * current->start_stack, so we round each of these in order to be able
38 * to write an integer number of pages.
39 */
40
41struct user_fpu_struct {
42 /* We have no FPU (yet) */
43};
44
45struct user {
46 struct pt_regs regs; /* entire machine state */
47 size_t u_tsize; /* text size (pages) */
48 size_t u_dsize; /* data size (pages) */
49 size_t u_ssize; /* stack size (pages) */
50 unsigned long start_code; /* text starting address */
51 unsigned long start_data; /* data starting address */
52 unsigned long start_stack; /* stack starting address */
53 long int signal; /* signal causing core dump */
54 unsigned long u_ar0; /* help gdb find registers */
55 unsigned long magic; /* identifies a core file */
56 char u_comm[32]; /* user command name */
57};
58
59#define NBPG PAGE_SIZE
60#define UPAGES 1
61#define HOST_TEXT_START_ADDR (u.start_code)
62#define HOST_DATA_START_ADDR (u.start_data)
63#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
64
65#endif /* __ASM_AVR32_USER_H */
diff --git a/arch/avr32/include/asm/xor.h b/arch/avr32/include/asm/xor.h
new file mode 100644
index 000000000000..99c87aa0af4f
--- /dev/null
+++ b/arch/avr32/include/asm/xor.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_XOR_H
2#define _ASM_XOR_H
3
4#include <asm-generic/xor.h>
5
6#endif
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index ff820a9e743a..2c08ac992ac3 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -18,7 +18,7 @@
18#include <asm/sysreg.h> 18#include <asm/sysreg.h>
19#include <asm/ocd.h> 19#include <asm/ocd.h>
20 20
21#include <asm/arch/pm.h> 21#include <mach/pm.h>
22 22
23void (*pm_power_off)(void) = NULL; 23void (*pm_power_off)(void) = NULL;
24EXPORT_SYMBOL(pm_power_off); 24EXPORT_SYMBOL(pm_power_off);
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
index ce48c14f4349..d8e623c426c1 100644
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -26,8 +26,8 @@
26#include <asm/setup.h> 26#include <asm/setup.h>
27#include <asm/sysreg.h> 27#include <asm/sysreg.h>
28 28
29#include <asm/arch/board.h> 29#include <mach/board.h>
30#include <asm/arch/init.h> 30#include <mach/init.h>
31 31
32extern int root_mountflags; 32extern int root_mountflags;
33 33
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 7e7f32771ae1..283481d74a5b 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -15,7 +15,7 @@
15 15
16#include <asm/sysreg.h> 16#include <asm/sysreg.h>
17 17
18#include <asm/arch/pm.h> 18#include <mach/pm.h>
19 19
20 20
21static cycle_t read_cycle_count(void) 21static cycle_t read_cycle_count(void)
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 1617048c86c5..92bfb4d8ae45 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -20,10 +20,10 @@
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22 22
23#include <asm/arch/at32ap700x.h> 23#include <mach/at32ap700x.h>
24#include <asm/arch/board.h> 24#include <mach/board.h>
25#include <asm/arch/portmux.h> 25#include <mach/portmux.h>
26#include <asm/arch/sram.h> 26#include <mach/sram.h>
27 27
28#include <video/atmel_lcdc.h> 28#include <video/atmel_lcdc.h>
29 29
diff --git a/arch/avr32/mach-at32ap/hsmc.c b/arch/avr32/mach-at32ap/hsmc.c
index b2d9bc61a35c..2875c11be95d 100644
--- a/arch/avr32/mach-at32ap/hsmc.c
+++ b/arch/avr32/mach-at32ap/hsmc.c
@@ -14,7 +14,7 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15 15
16#include <asm/io.h> 16#include <asm/io.h>
17#include <asm/arch/smc.h> 17#include <mach/smc.h>
18 18
19#include "hsmc.h" 19#include "hsmc.h"
20 20
diff --git a/arch/avr32/mach-at32ap/include/mach/at32ap700x.h b/arch/avr32/mach-at32ap/include/mach/at32ap700x.h
new file mode 100644
index 000000000000..d18a3053be0d
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/at32ap700x.h
@@ -0,0 +1,49 @@
1/*
2 * Pin definitions for AT32AP7000.
3 *
4 * Copyright (C) 2006 Atmel Corporation
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_ARCH_AT32AP700X_H__
11#define __ASM_ARCH_AT32AP700X_H__
12
13#define GPIO_PERIPH_A 0
14#define GPIO_PERIPH_B 1
15
16/*
17 * Pin numbers identifying specific GPIO pins on the chip. They can
18 * also be converted to IRQ numbers by passing them through
19 * gpio_to_irq().
20 */
21#define GPIO_PIOA_BASE (0)
22#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32)
23#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32)
24#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32)
25#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32)
26
27#define GPIO_PIN_PA(N) (GPIO_PIOA_BASE + (N))
28#define GPIO_PIN_PB(N) (GPIO_PIOB_BASE + (N))
29#define GPIO_PIN_PC(N) (GPIO_PIOC_BASE + (N))
30#define GPIO_PIN_PD(N) (GPIO_PIOD_BASE + (N))
31#define GPIO_PIN_PE(N) (GPIO_PIOE_BASE + (N))
32
33
34/*
35 * DMAC peripheral hardware handshaking interfaces, used with dw_dmac
36 */
37#define DMAC_MCI_RX 0
38#define DMAC_MCI_TX 1
39#define DMAC_DAC_TX 2
40#define DMAC_AC97_A_RX 3
41#define DMAC_AC97_A_TX 4
42#define DMAC_AC97_B_RX 5
43#define DMAC_AC97_B_TX 6
44#define DMAC_DMAREQ_0 7
45#define DMAC_DMAREQ_1 8
46#define DMAC_DMAREQ_2 9
47#define DMAC_DMAREQ_3 10
48
49#endif /* __ASM_ARCH_AT32AP700X_H__ */
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
new file mode 100644
index 000000000000..e60e9076544d
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -0,0 +1,121 @@
1/*
2 * Platform data definitions.
3 */
4#ifndef __ASM_ARCH_BOARD_H
5#define __ASM_ARCH_BOARD_H
6
7#include <linux/types.h>
8
9#define GPIO_PIN_NONE (-1)
10
11/*
12 * Clock rates for various on-board oscillators. The number of entries
13 * in this array is chip-dependent.
14 */
15extern unsigned long at32_board_osc_rates[];
16
17/* Add basic devices: system manager, interrupt controller, portmuxes, etc. */
18void at32_add_system_devices(void);
19
20#define ATMEL_MAX_UART 4
21extern struct platform_device *atmel_default_console_device;
22
23struct atmel_uart_data {
24 short use_dma_tx; /* use transmit DMA? */
25 short use_dma_rx; /* use receive DMA? */
26 void __iomem *regs; /* virtual base address, if any */
27};
28void at32_map_usart(unsigned int hw_id, unsigned int line);
29struct platform_device *at32_add_device_usart(unsigned int id);
30
31struct eth_platform_data {
32 u32 phy_mask;
33 u8 is_rmii;
34};
35struct platform_device *
36at32_add_device_eth(unsigned int id, struct eth_platform_data *data);
37
38struct spi_board_info;
39struct platform_device *
40at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n);
41
42struct atmel_lcdfb_info;
43struct platform_device *
44at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
45 unsigned long fbmem_start, unsigned long fbmem_len,
46 unsigned int pin_config);
47
48struct usba_platform_data;
49struct platform_device *
50at32_add_device_usba(unsigned int id, struct usba_platform_data *data);
51
52struct ide_platform_data {
53 u8 cs;
54};
55struct platform_device *
56at32_add_device_ide(unsigned int id, unsigned int extint,
57 struct ide_platform_data *data);
58
59/* mask says which PWM channels to mux */
60struct platform_device *at32_add_device_pwm(u32 mask);
61
62/* depending on what's hooked up, not all SSC pins will be used */
63#define ATMEL_SSC_TK 0x01
64#define ATMEL_SSC_TF 0x02
65#define ATMEL_SSC_TD 0x04
66#define ATMEL_SSC_TX (ATMEL_SSC_TK | ATMEL_SSC_TF | ATMEL_SSC_TD)
67
68#define ATMEL_SSC_RK 0x10
69#define ATMEL_SSC_RF 0x20
70#define ATMEL_SSC_RD 0x40
71#define ATMEL_SSC_RX (ATMEL_SSC_RK | ATMEL_SSC_RF | ATMEL_SSC_RD)
72
73struct platform_device *
74at32_add_device_ssc(unsigned int id, unsigned int flags);
75
76struct i2c_board_info;
77struct platform_device *at32_add_device_twi(unsigned int id,
78 struct i2c_board_info *b,
79 unsigned int n);
80
81struct mci_platform_data;
82struct platform_device *
83at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
84
85struct ac97c_platform_data {
86 unsigned short dma_rx_periph_id;
87 unsigned short dma_tx_periph_id;
88 unsigned short dma_controller_id;
89 int reset_pin;
90};
91struct platform_device *
92at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data);
93
94struct platform_device *at32_add_device_abdac(unsigned int id);
95struct platform_device *at32_add_device_psif(unsigned int id);
96
97struct cf_platform_data {
98 int detect_pin;
99 int reset_pin;
100 int vcc_pin;
101 int ready_pin;
102 u8 cs;
103};
104struct platform_device *
105at32_add_device_cf(unsigned int id, unsigned int extint,
106 struct cf_platform_data *data);
107
108/* NAND / SmartMedia */
109struct atmel_nand_data {
110 int enable_pin; /* chip enable */
111 int det_pin; /* card detect */
112 int rdy_pin; /* ready/busy */
113 u8 ale; /* address line number connected to ALE */
114 u8 cle; /* address line number connected to CLE */
115 u8 bus_width_16; /* buswidth is 16 bit */
116 struct mtd_partition *(*partition_info)(int size, int *num_partitions);
117};
118struct platform_device *
119at32_add_device_nand(unsigned int id, struct atmel_nand_data *data);
120
121#endif /* __ASM_ARCH_BOARD_H */
diff --git a/arch/avr32/mach-at32ap/include/mach/cpu.h b/arch/avr32/mach-at32ap/include/mach/cpu.h
new file mode 100644
index 000000000000..44d0bfa1f409
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/cpu.h
@@ -0,0 +1,35 @@
1/*
2 * AVR32 and (fake) AT91 CPU identification
3 *
4 * Copyright (C) 2007 Atmel Corporation
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_ARCH_CPU_H
11#define __ASM_ARCH_CPU_H
12
13/*
14 * Only AT32AP7000 is defined for now. We can identify the specific
15 * chip at runtime, but I'm not sure if it's really worth it.
16 */
17#ifdef CONFIG_CPU_AT32AP700X
18# define cpu_is_at32ap7000() (1)
19#else
20# define cpu_is_at32ap7000() (0)
21#endif
22
23/*
24 * Since this is AVR32, we will never run on any AT91 CPU. But these
25 * definitions may reduce clutter in common drivers.
26 */
27#define cpu_is_at91rm9200() (0)
28#define cpu_is_at91sam9xe() (0)
29#define cpu_is_at91sam9260() (0)
30#define cpu_is_at91sam9261() (0)
31#define cpu_is_at91sam9263() (0)
32#define cpu_is_at91sam9rl() (0)
33#define cpu_is_at91cap9() (0)
34
35#endif /* __ASM_ARCH_CPU_H */
diff --git a/arch/avr32/mach-at32ap/include/mach/gpio.h b/arch/avr32/mach-at32ap/include/mach/gpio.h
new file mode 100644
index 000000000000..0180f584ef03
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/gpio.h
@@ -0,0 +1,45 @@
1#ifndef __ASM_AVR32_ARCH_GPIO_H
2#define __ASM_AVR32_ARCH_GPIO_H
3
4#include <linux/compiler.h>
5#include <asm/irq.h>
6
7
8/* Some GPIO chips can manage IRQs; some can't. The exact numbers can
9 * be changed if needed, but for the moment they're not configurable.
10 */
11#define ARCH_NR_GPIOS (NR_GPIO_IRQS + 2 * 32)
12
13
14/* Arch-neutral GPIO API, supporting both "native" and external GPIOs. */
15#include <asm-generic/gpio.h>
16
17static inline int gpio_get_value(unsigned int gpio)
18{
19 return __gpio_get_value(gpio);
20}
21
22static inline void gpio_set_value(unsigned int gpio, int value)
23{
24 __gpio_set_value(gpio, value);
25}
26
27static inline int gpio_cansleep(unsigned int gpio)
28{
29 return __gpio_cansleep(gpio);
30}
31
32
33static inline int gpio_to_irq(unsigned int gpio)
34{
35 if (gpio < NR_GPIO_IRQS)
36 return gpio + GPIO_IRQ_BASE;
37 return -EINVAL;
38}
39
40static inline int irq_to_gpio(unsigned int irq)
41{
42 return irq - GPIO_IRQ_BASE;
43}
44
45#endif /* __ASM_AVR32_ARCH_GPIO_H */
diff --git a/arch/avr32/mach-at32ap/include/mach/init.h b/arch/avr32/mach-at32ap/include/mach/init.h
new file mode 100644
index 000000000000..bc40e3d46150
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/init.h
@@ -0,0 +1,18 @@
1/*
2 * AT32AP platform initialization calls.
3 *
4 * Copyright (C) 2006 Atmel Corporation
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_AVR32_AT32AP_INIT_H__
11#define __ASM_AVR32_AT32AP_INIT_H__
12
13void setup_platform(void);
14void setup_board(void);
15
16void at32_setup_serial_console(unsigned int usart_id);
17
18#endif /* __ASM_AVR32_AT32AP_INIT_H__ */
diff --git a/arch/avr32/mach-at32ap/include/mach/io.h b/arch/avr32/mach-at32ap/include/mach/io.h
new file mode 100644
index 000000000000..4ec6abc68ea3
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/io.h
@@ -0,0 +1,39 @@
1#ifndef __ASM_AVR32_ARCH_AT32AP_IO_H
2#define __ASM_AVR32_ARCH_AT32AP_IO_H
3
4/* For "bizarre" halfword swapping */
5#include <linux/byteorder/swabb.h>
6
7#if defined(CONFIG_AP700X_32_BIT_SMC)
8# define __swizzle_addr_b(addr) (addr ^ 3UL)
9# define __swizzle_addr_w(addr) (addr ^ 2UL)
10# define __swizzle_addr_l(addr) (addr)
11# define ioswabb(a, x) (x)
12# define ioswabw(a, x) (x)
13# define ioswabl(a, x) (x)
14# define __mem_ioswabb(a, x) (x)
15# define __mem_ioswabw(a, x) swab16(x)
16# define __mem_ioswabl(a, x) swab32(x)
17#elif defined(CONFIG_AP700X_16_BIT_SMC)
18# define __swizzle_addr_b(addr) (addr ^ 1UL)
19# define __swizzle_addr_w(addr) (addr)
20# define __swizzle_addr_l(addr) (addr)
21# define ioswabb(a, x) (x)
22# define ioswabw(a, x) (x)
23# define ioswabl(a, x) swahw32(x)
24# define __mem_ioswabb(a, x) (x)
25# define __mem_ioswabw(a, x) swab16(x)
26# define __mem_ioswabl(a, x) swahb32(x)
27#else
28# define __swizzle_addr_b(addr) (addr)
29# define __swizzle_addr_w(addr) (addr)
30# define __swizzle_addr_l(addr) (addr)
31# define ioswabb(a, x) (x)
32# define ioswabw(a, x) swab16(x)
33# define ioswabl(a, x) swab32(x)
34# define __mem_ioswabb(a, x) (x)
35# define __mem_ioswabw(a, x) (x)
36# define __mem_ioswabl(a, x) (x)
37#endif
38
39#endif /* __ASM_AVR32_ARCH_AT32AP_IO_H */
diff --git a/arch/avr32/mach-at32ap/include/mach/irq.h b/arch/avr32/mach-at32ap/include/mach/irq.h
new file mode 100644
index 000000000000..608e350368c7
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/irq.h
@@ -0,0 +1,14 @@
1#ifndef __ASM_AVR32_ARCH_IRQ_H
2#define __ASM_AVR32_ARCH_IRQ_H
3
4#define EIM_IRQ_BASE NR_INTERNAL_IRQS
5#define NR_EIM_IRQS 32
6#define AT32_EXTINT(n) (EIM_IRQ_BASE + (n))
7
8#define GPIO_IRQ_BASE (EIM_IRQ_BASE + NR_EIM_IRQS)
9#define NR_GPIO_CTLR (5 /*internal*/ + 1 /*external*/)
10#define NR_GPIO_IRQS (NR_GPIO_CTLR * 32)
11
12#define NR_IRQS (GPIO_IRQ_BASE + NR_GPIO_IRQS)
13
14#endif /* __ASM_AVR32_ARCH_IRQ_H */
diff --git a/arch/avr32/mach-at32ap/include/mach/pm.h b/arch/avr32/mach-at32ap/include/mach/pm.h
new file mode 100644
index 000000000000..979b355b77b6
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/pm.h
@@ -0,0 +1,51 @@
1/*
2 * AVR32 AP Power Management.
3 *
4 * Copyright (C) 2008 Atmel Corporation
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_AVR32_ARCH_PM_H
11#define __ASM_AVR32_ARCH_PM_H
12
13/* Possible arguments to the "sleep" instruction */
14#define CPU_SLEEP_IDLE 0
15#define CPU_SLEEP_FROZEN 1
16#define CPU_SLEEP_STANDBY 2
17#define CPU_SLEEP_STOP 3
18#define CPU_SLEEP_STATIC 5
19
20#ifndef __ASSEMBLY__
21extern void cpu_enter_idle(void);
22extern void cpu_enter_standby(unsigned long sdramc_base);
23
24extern bool disable_idle_sleep;
25
26static inline void cpu_disable_idle_sleep(void)
27{
28 disable_idle_sleep = true;
29}
30
31static inline void cpu_enable_idle_sleep(void)
32{
33 disable_idle_sleep = false;
34}
35
36static inline void cpu_idle_sleep(void)
37{
38 /*
39 * If we're using the COUNT and COMPARE registers for
40 * timekeeping, we can't use the IDLE state.
41 */
42 if (disable_idle_sleep)
43 cpu_relax();
44 else
45 cpu_enter_idle();
46}
47
48void intc_set_suspend_handler(unsigned long offset);
49#endif
50
51#endif /* __ASM_AVR32_ARCH_PM_H */
diff --git a/arch/avr32/mach-at32ap/include/mach/portmux.h b/arch/avr32/mach-at32ap/include/mach/portmux.h
new file mode 100644
index 000000000000..b1abe6b4e4ef
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/portmux.h
@@ -0,0 +1,29 @@
1/*
2 * AT32 portmux interface.
3 *
4 * Copyright (C) 2006 Atmel Corporation
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_ARCH_PORTMUX_H__
11#define __ASM_ARCH_PORTMUX_H__
12
13/*
14 * Set up pin multiplexing, called from board init only.
15 *
16 * The following flags determine the initial state of the pin.
17 */
18#define AT32_GPIOF_PULLUP 0x00000001 /* (not-OUT) Enable pull-up */
19#define AT32_GPIOF_OUTPUT 0x00000002 /* (OUT) Enable output driver */
20#define AT32_GPIOF_HIGH 0x00000004 /* (OUT) Set output high */
21#define AT32_GPIOF_DEGLITCH 0x00000008 /* (IN) Filter glitches */
22#define AT32_GPIOF_MULTIDRV 0x00000010 /* Enable multidriver option */
23
24void at32_select_periph(unsigned int pin, unsigned int periph,
25 unsigned long flags);
26void at32_select_gpio(unsigned int pin, unsigned long flags);
27void at32_reserve_pin(unsigned int pin);
28
29#endif /* __ASM_ARCH_PORTMUX_H__ */
diff --git a/arch/avr32/mach-at32ap/include/mach/smc.h b/arch/avr32/mach-at32ap/include/mach/smc.h
new file mode 100644
index 000000000000..c98eea44a70a
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/smc.h
@@ -0,0 +1,113 @@
1/*
2 * Static Memory Controller for AT32 chips
3 *
4 * Copyright (C) 2006 Atmel Corporation
5 *
6 * Inspired by the OMAP2 General-Purpose Memory Controller interface
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#ifndef __ARCH_AT32AP_SMC_H
13#define __ARCH_AT32AP_SMC_H
14
15/*
16 * All timing parameters are in nanoseconds.
17 */
18struct smc_timing {
19 /* Delay from address valid to assertion of given strobe */
20 int ncs_read_setup;
21 int nrd_setup;
22 int ncs_write_setup;
23 int nwe_setup;
24
25 /* Pulse length of given strobe */
26 int ncs_read_pulse;
27 int nrd_pulse;
28 int ncs_write_pulse;
29 int nwe_pulse;
30
31 /* Total cycle length of given operation */
32 int read_cycle;
33 int write_cycle;
34
35 /* Minimal recovery times, will extend cycle if needed */
36 int ncs_read_recover;
37 int nrd_recover;
38 int ncs_write_recover;
39 int nwe_recover;
40};
41
42/*
43 * All timing parameters are in clock cycles.
44 */
45struct smc_config {
46
47 /* Delay from address valid to assertion of given strobe */
48 u8 ncs_read_setup;
49 u8 nrd_setup;
50 u8 ncs_write_setup;
51 u8 nwe_setup;
52
53 /* Pulse length of given strobe */
54 u8 ncs_read_pulse;
55 u8 nrd_pulse;
56 u8 ncs_write_pulse;
57 u8 nwe_pulse;
58
59 /* Total cycle length of given operation */
60 u8 read_cycle;
61 u8 write_cycle;
62
63 /* Bus width in bytes */
64 u8 bus_width;
65
66 /*
67 * 0: Data is sampled on rising edge of NCS
68 * 1: Data is sampled on rising edge of NRD
69 */
70 unsigned int nrd_controlled:1;
71
72 /*
73 * 0: Data is driven on falling edge of NCS
74 * 1: Data is driven on falling edge of NWR
75 */
76 unsigned int nwe_controlled:1;
77
78 /*
79 * 0: NWAIT is disabled
80 * 1: Reserved
81 * 2: NWAIT is frozen mode
82 * 3: NWAIT in ready mode
83 */
84 unsigned int nwait_mode:2;
85
86 /*
87 * 0: Byte select access type
88 * 1: Byte write access type
89 */
90 unsigned int byte_write:1;
91
92 /*
93 * Number of clock cycles before data is released after
94 * the rising edge of the read controlling signal
95 *
96 * Total cycles from SMC is tdf_cycles + 1
97 */
98 unsigned int tdf_cycles:4;
99
100 /*
101 * 0: TDF optimization disabled
102 * 1: TDF optimization enabled
103 */
104 unsigned int tdf_mode:1;
105};
106
107extern void smc_set_timing(struct smc_config *config,
108 const struct smc_timing *timing);
109
110extern int smc_set_configuration(int cs, const struct smc_config *config);
111extern struct smc_config *smc_get_configuration(int cs);
112
113#endif /* __ARCH_AT32AP_SMC_H */
diff --git a/arch/avr32/mach-at32ap/include/mach/sram.h b/arch/avr32/mach-at32ap/include/mach/sram.h
new file mode 100644
index 000000000000..4838dae7601a
--- /dev/null
+++ b/arch/avr32/mach-at32ap/include/mach/sram.h
@@ -0,0 +1,30 @@
1/*
2 * Simple SRAM allocator
3 *
4 * Copyright (C) 2008 Atmel Corporation
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_AVR32_ARCH_SRAM_H
11#define __ASM_AVR32_ARCH_SRAM_H
12
13#include <linux/genalloc.h>
14
15extern struct gen_pool *sram_pool;
16
17static inline unsigned long sram_alloc(size_t len)
18{
19 if (!sram_pool)
20 return 0UL;
21
22 return gen_pool_alloc(sram_pool, len);
23}
24
25static inline void sram_free(unsigned long addr, size_t len)
26{
27 return gen_pool_free(sram_pool, addr, len);
28}
29
30#endif /* __ASM_AVR32_ARCH_SRAM_H */
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index 296294f8ed81..405ee6bad4ce 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -17,7 +17,7 @@
17#include <asm/gpio.h> 17#include <asm/gpio.h>
18#include <asm/io.h> 18#include <asm/io.h>
19 19
20#include <asm/arch/portmux.h> 20#include <mach/portmux.h>
21 21
22#include "pio.h" 22#include "pio.h"
23 23
diff --git a/arch/avr32/mach-at32ap/pm-at32ap700x.S b/arch/avr32/mach-at32ap/pm-at32ap700x.S
index 0a53ad314ff4..5be4de65b209 100644
--- a/arch/avr32/mach-at32ap/pm-at32ap700x.S
+++ b/arch/avr32/mach-at32ap/pm-at32ap700x.S
@@ -10,7 +10,7 @@
10#include <asm/asm.h> 10#include <asm/asm.h>
11#include <asm/asm-offsets.h> 11#include <asm/asm-offsets.h>
12#include <asm/thread_info.h> 12#include <asm/thread_info.h>
13#include <asm/arch/pm.h> 13#include <mach/pm.h>
14 14
15#include "pm.h" 15#include "pm.h"
16#include "sdramc.h" 16#include "sdramc.h"
diff --git a/arch/avr32/mach-at32ap/pm.c b/arch/avr32/mach-at32ap/pm.c
index 0b764320135d..a0cbef54fc2a 100644
--- a/arch/avr32/mach-at32ap/pm.c
+++ b/arch/avr32/mach-at32ap/pm.c
@@ -14,8 +14,8 @@
14#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
15#include <asm/sysreg.h> 15#include <asm/sysreg.h>
16 16
17#include <asm/arch/pm.h> 17#include <mach/pm.h>
18#include <asm/arch/sram.h> 18#include <mach/sram.h>
19 19
20/* FIXME: This is only valid for AP7000 */ 20/* FIXME: This is only valid for AP7000 */
21#define SDRAMC_BASE 0xfff03800 21#define SDRAMC_BASE 0xfff03800
diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
index dae9c982aa89..c7b25b0aacff 100644
--- a/arch/m68k/mac/baboon.c
+++ b/arch/m68k/mac/baboon.c
@@ -11,7 +11,6 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/ide.h>
15 14
16#include <asm/traps.h> 15#include <asm/traps.h>
17#include <asm/bootinfo.h> 16#include <asm/bootinfo.h>
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index f3b27d04a31f..1bdb03c73c0f 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -27,7 +27,6 @@
27#include <linux/mm.h> 27#include <linux/mm.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/ide.h>
31#include <linux/module.h> 30#include <linux/module.h>
32 31
33#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
diff --git a/arch/mips/emma2rh/markeins/setup.c b/arch/mips/emma2rh/markeins/setup.c
index a56c4b804b07..822a20e21fa4 100644
--- a/arch/mips/emma2rh/markeins/setup.c
+++ b/arch/mips/emma2rh/markeins/setup.c
@@ -27,7 +27,6 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/initrd.h> 28#include <linux/initrd.h>
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/ide.h>
31#include <linux/ioport.h> 30#include <linux/ioport.h>
32#include <linux/param.h> /* for HZ */ 31#include <linux/param.h> /* for HZ */
33#include <linux/root_dev.h> 32#include <linux/root_dev.h>
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index f60524e8bc44..b59ba6b93cdd 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -10,7 +10,6 @@
10 * Copyright (C) 2007 by Thomas Bogendoerfer 10 * Copyright (C) 2007 by Thomas Bogendoerfer
11 */ 11 */
12#include <linux/eisa.h> 12#include <linux/eisa.h>
13#include <linux/hdreg.h>
14#include <linux/init.h> 13#include <linux/init.h>
15#include <linux/ioport.h> 14#include <linux/ioport.h>
16#include <linux/sched.h> 15#include <linux/sched.h>
@@ -18,7 +17,6 @@
18#include <linux/mm.h> 17#include <linux/mm.h>
19#include <linux/console.h> 18#include <linux/console.h>
20#include <linux/fb.h> 19#include <linux/fb.h>
21#include <linux/ide.h>
22#include <linux/pm.h> 20#include <linux/pm.h>
23#include <linux/screen_info.h> 21#include <linux/screen_info.h>
24#include <linux/platform_device.h> 22#include <linux/platform_device.h>
diff --git a/arch/mn10300/kernel/module.c b/arch/mn10300/kernel/module.c
index 0e4d2f6fa6e8..8fa36893df7a 100644
--- a/arch/mn10300/kernel/module.c
+++ b/arch/mn10300/kernel/module.c
@@ -24,6 +24,7 @@
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/bug.h>
27 28
28#if 0 29#if 0
29#define DEBUGP printk 30#define DEBUGP printk
@@ -195,7 +196,7 @@ int module_finalize(const Elf_Ehdr *hdr,
195 const Elf_Shdr *sechdrs, 196 const Elf_Shdr *sechdrs,
196 struct module *me) 197 struct module *me)
197{ 198{
198 return 0; 199 return module_bug_finalize(hdr, sechdrs, me);
199} 200}
200 201
201/* 202/*
@@ -203,4 +204,5 @@ int module_finalize(const Elf_Ehdr *hdr,
203 */ 204 */
204void module_arch_cleanup(struct module *mod) 205void module_arch_cleanup(struct module *mod)
205{ 206{
207 module_bug_cleanup(mod);
206} 208}
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 8c8aadbe9563..4ebc52a19f0a 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -97,7 +97,7 @@ config IRQSTACKS
97 97
98config VIRQ_DEBUG 98config VIRQ_DEBUG
99 bool "Expose hardware/virtual IRQ mapping via debugfs" 99 bool "Expose hardware/virtual IRQ mapping via debugfs"
100 depends on DEBUG_FS && PPC_MERGE 100 depends on DEBUG_FS
101 help 101 help
102 This option will show the mapping relationship between hardware irq 102 This option will show the mapping relationship between hardware irq
103 numbers and virtual irq numbers. The mapping is exposed via debugfs 103 numbers and virtual irq numbers. The mapping is exposed via debugfs
diff --git a/arch/powerpc/boot/dts/mpc8610_hpcd.dts b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
index 666185f59459..3b3a1062cb25 100644
--- a/arch/powerpc/boot/dts/mpc8610_hpcd.dts
+++ b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
@@ -202,6 +202,11 @@
202 fsl,has-rstcr; 202 fsl,has-rstcr;
203 }; 203 };
204 204
205 wdt@e4000 {
206 compatible = "fsl,mpc8610-wdt";
207 reg = <0xe4000 0x100>;
208 };
209
205 i2s@16000 { 210 i2s@16000 {
206 compatible = "fsl,mpc8610-ssi"; 211 compatible = "fsl,mpc8610-ssi";
207 cell-index = <0>; 212 cell-index = <0>;
diff --git a/arch/powerpc/boot/io.h b/arch/powerpc/boot/io.h
index ccaedaec50d5..7c09f4861fe1 100644
--- a/arch/powerpc/boot/io.h
+++ b/arch/powerpc/boot/io.h
@@ -6,7 +6,7 @@
6/* 6/*
7 * Low-level I/O routines. 7 * Low-level I/O routines.
8 * 8 *
9 * Copied from <file:include/asm-powerpc/io.h> (which has no copyright) 9 * Copied from <file:arch/powerpc/include/asm/io.h> (which has no copyright)
10 */ 10 */
11static inline int in_8(const volatile unsigned char *addr) 11static inline int in_8(const volatile unsigned char *addr)
12{ 12{
diff --git a/arch/powerpc/include/asm/8253pit.h b/arch/powerpc/include/asm/8253pit.h
new file mode 100644
index 000000000000..b70d6e53b303
--- /dev/null
+++ b/arch/powerpc/include/asm/8253pit.h
@@ -0,0 +1,10 @@
1#ifndef _ASM_POWERPC_8253PIT_H
2#define _ASM_POWERPC_8253PIT_H
3
4/*
5 * 8253/8254 Programmable Interval Timer
6 */
7
8#define PIT_TICK_RATE 1193182UL
9
10#endif /* _ASM_POWERPC_8253PIT_H */
diff --git a/arch/powerpc/include/asm/8xx_immap.h b/arch/powerpc/include/asm/8xx_immap.h
new file mode 100644
index 000000000000..4b0e15206006
--- /dev/null
+++ b/arch/powerpc/include/asm/8xx_immap.h
@@ -0,0 +1,564 @@
1/*
2 * MPC8xx Internal Memory Map
3 * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
4 *
5 * The I/O on the MPC860 is comprised of blocks of special registers
6 * and the dual port ram for the Communication Processor Module.
7 * Within this space are functional units such as the SIU, memory
8 * controller, system timers, and other control functions. It is
9 * a combination that I found difficult to separate into logical
10 * functional files.....but anyone else is welcome to try. -- Dan
11 */
12#ifdef __KERNEL__
13#ifndef __IMMAP_8XX__
14#define __IMMAP_8XX__
15
16/* System configuration registers.
17*/
18typedef struct sys_conf {
19 uint sc_siumcr;
20 uint sc_sypcr;
21 uint sc_swt;
22 char res1[2];
23 ushort sc_swsr;
24 uint sc_sipend;
25 uint sc_simask;
26 uint sc_siel;
27 uint sc_sivec;
28 uint sc_tesr;
29 char res2[0xc];
30 uint sc_sdcr;
31 char res3[0x4c];
32} sysconf8xx_t;
33
34/* PCMCIA configuration registers.
35*/
36typedef struct pcmcia_conf {
37 uint pcmc_pbr0;
38 uint pcmc_por0;
39 uint pcmc_pbr1;
40 uint pcmc_por1;
41 uint pcmc_pbr2;
42 uint pcmc_por2;
43 uint pcmc_pbr3;
44 uint pcmc_por3;
45 uint pcmc_pbr4;
46 uint pcmc_por4;
47 uint pcmc_pbr5;
48 uint pcmc_por5;
49 uint pcmc_pbr6;
50 uint pcmc_por6;
51 uint pcmc_pbr7;
52 uint pcmc_por7;
53 char res1[0x20];
54 uint pcmc_pgcra;
55 uint pcmc_pgcrb;
56 uint pcmc_pscr;
57 char res2[4];
58 uint pcmc_pipr;
59 char res3[4];
60 uint pcmc_per;
61 char res4[4];
62} pcmconf8xx_t;
63
64/* Memory controller registers.
65*/
66typedef struct mem_ctlr {
67 uint memc_br0;
68 uint memc_or0;
69 uint memc_br1;
70 uint memc_or1;
71 uint memc_br2;
72 uint memc_or2;
73 uint memc_br3;
74 uint memc_or3;
75 uint memc_br4;
76 uint memc_or4;
77 uint memc_br5;
78 uint memc_or5;
79 uint memc_br6;
80 uint memc_or6;
81 uint memc_br7;
82 uint memc_or7;
83 char res1[0x24];
84 uint memc_mar;
85 uint memc_mcr;
86 char res2[4];
87 uint memc_mamr;
88 uint memc_mbmr;
89 ushort memc_mstat;
90 ushort memc_mptpr;
91 uint memc_mdr;
92 char res3[0x80];
93} memctl8xx_t;
94
95/*-----------------------------------------------------------------------
96 * BR - Memory Controler: Base Register 16-9
97 */
98#define BR_BA_MSK 0xffff8000 /* Base Address Mask */
99#define BR_AT_MSK 0x00007000 /* Address Type Mask */
100#define BR_PS_MSK 0x00000c00 /* Port Size Mask */
101#define BR_PS_32 0x00000000 /* 32 bit port size */
102#define BR_PS_16 0x00000800 /* 16 bit port size */
103#define BR_PS_8 0x00000400 /* 8 bit port size */
104#define BR_PARE 0x00000200 /* Parity Enable */
105#define BR_WP 0x00000100 /* Write Protect */
106#define BR_MS_MSK 0x000000c0 /* Machine Select Mask */
107#define BR_MS_GPCM 0x00000000 /* G.P.C.M. Machine Select */
108#define BR_MS_UPMA 0x00000080 /* U.P.M.A Machine Select */
109#define BR_MS_UPMB 0x000000c0 /* U.P.M.B Machine Select */
110#define BR_V 0x00000001 /* Bank Valid */
111
112/*-----------------------------------------------------------------------
113 * OR - Memory Controler: Option Register 16-11
114 */
115#define OR_AM_MSK 0xffff8000 /* Address Mask Mask */
116#define OR_ATM_MSK 0x00007000 /* Address Type Mask Mask */
117#define OR_CSNT_SAM 0x00000800 /* Chip Select Negation Time/ Start */
118 /* Address Multiplex */
119#define OR_ACS_MSK 0x00000600 /* Address to Chip Select Setup mask */
120#define OR_ACS_DIV1 0x00000000 /* CS is output at the same time */
121#define OR_ACS_DIV4 0x00000400 /* CS is output 1/4 a clock later */
122#define OR_ACS_DIV2 0x00000600 /* CS is output 1/2 a clock later */
123#define OR_G5LA 0x00000400 /* Output #GPL5 on #GPL_A5 */
124#define OR_G5LS 0x00000200 /* Drive #GPL high on falling edge of...*/
125#define OR_BI 0x00000100 /* Burst inhibit */
126#define OR_SCY_MSK 0x000000f0 /* Cycle Length in Clocks */
127#define OR_SCY_0_CLK 0x00000000 /* 0 clock cycles wait states */
128#define OR_SCY_1_CLK 0x00000010 /* 1 clock cycles wait states */
129#define OR_SCY_2_CLK 0x00000020 /* 2 clock cycles wait states */
130#define OR_SCY_3_CLK 0x00000030 /* 3 clock cycles wait states */
131#define OR_SCY_4_CLK 0x00000040 /* 4 clock cycles wait states */
132#define OR_SCY_5_CLK 0x00000050 /* 5 clock cycles wait states */
133#define OR_SCY_6_CLK 0x00000060 /* 6 clock cycles wait states */
134#define OR_SCY_7_CLK 0x00000070 /* 7 clock cycles wait states */
135#define OR_SCY_8_CLK 0x00000080 /* 8 clock cycles wait states */
136#define OR_SCY_9_CLK 0x00000090 /* 9 clock cycles wait states */
137#define OR_SCY_10_CLK 0x000000a0 /* 10 clock cycles wait states */
138#define OR_SCY_11_CLK 0x000000b0 /* 11 clock cycles wait states */
139#define OR_SCY_12_CLK 0x000000c0 /* 12 clock cycles wait states */
140#define OR_SCY_13_CLK 0x000000d0 /* 13 clock cycles wait states */
141#define OR_SCY_14_CLK 0x000000e0 /* 14 clock cycles wait states */
142#define OR_SCY_15_CLK 0x000000f0 /* 15 clock cycles wait states */
143#define OR_SETA 0x00000008 /* External Transfer Acknowledge */
144#define OR_TRLX 0x00000004 /* Timing Relaxed */
145#define OR_EHTR 0x00000002 /* Extended Hold Time on Read */
146
147/* System Integration Timers.
148*/
149typedef struct sys_int_timers {
150 ushort sit_tbscr;
151 char res0[0x02];
152 uint sit_tbreff0;
153 uint sit_tbreff1;
154 char res1[0x14];
155 ushort sit_rtcsc;
156 char res2[0x02];
157 uint sit_rtc;
158 uint sit_rtsec;
159 uint sit_rtcal;
160 char res3[0x10];
161 ushort sit_piscr;
162 char res4[2];
163 uint sit_pitc;
164 uint sit_pitr;
165 char res5[0x34];
166} sit8xx_t;
167
168#define TBSCR_TBIRQ_MASK ((ushort)0xff00)
169#define TBSCR_REFA ((ushort)0x0080)
170#define TBSCR_REFB ((ushort)0x0040)
171#define TBSCR_REFAE ((ushort)0x0008)
172#define TBSCR_REFBE ((ushort)0x0004)
173#define TBSCR_TBF ((ushort)0x0002)
174#define TBSCR_TBE ((ushort)0x0001)
175
176#define RTCSC_RTCIRQ_MASK ((ushort)0xff00)
177#define RTCSC_SEC ((ushort)0x0080)
178#define RTCSC_ALR ((ushort)0x0040)
179#define RTCSC_38K ((ushort)0x0010)
180#define RTCSC_SIE ((ushort)0x0008)
181#define RTCSC_ALE ((ushort)0x0004)
182#define RTCSC_RTF ((ushort)0x0002)
183#define RTCSC_RTE ((ushort)0x0001)
184
185#define PISCR_PIRQ_MASK ((ushort)0xff00)
186#define PISCR_PS ((ushort)0x0080)
187#define PISCR_PIE ((ushort)0x0004)
188#define PISCR_PTF ((ushort)0x0002)
189#define PISCR_PTE ((ushort)0x0001)
190
191/* Clocks and Reset.
192*/
193typedef struct clk_and_reset {
194 uint car_sccr;
195 uint car_plprcr;
196 uint car_rsr;
197 char res[0x74]; /* Reserved area */
198} car8xx_t;
199
200/* System Integration Timers keys.
201*/
202typedef struct sitk {
203 uint sitk_tbscrk;
204 uint sitk_tbreff0k;
205 uint sitk_tbreff1k;
206 uint sitk_tbk;
207 char res1[0x10];
208 uint sitk_rtcsck;
209 uint sitk_rtck;
210 uint sitk_rtseck;
211 uint sitk_rtcalk;
212 char res2[0x10];
213 uint sitk_piscrk;
214 uint sitk_pitck;
215 char res3[0x38];
216} sitk8xx_t;
217
218/* Clocks and reset keys.
219*/
220typedef struct cark {
221 uint cark_sccrk;
222 uint cark_plprcrk;
223 uint cark_rsrk;
224 char res[0x474];
225} cark8xx_t;
226
227/* The key to unlock registers maintained by keep-alive power.
228*/
229#define KAPWR_KEY ((unsigned int)0x55ccaa33)
230
231/* Video interface. MPC823 Only.
232*/
233typedef struct vid823 {
234 ushort vid_vccr;
235 ushort res1;
236 u_char vid_vsr;
237 u_char res2;
238 u_char vid_vcmr;
239 u_char res3;
240 uint vid_vbcb;
241 uint res4;
242 uint vid_vfcr0;
243 uint vid_vfaa0;
244 uint vid_vfba0;
245 uint vid_vfcr1;
246 uint vid_vfaa1;
247 uint vid_vfba1;
248 u_char res5[0x18];
249} vid823_t;
250
251/* LCD interface. 823 Only.
252*/
253typedef struct lcd {
254 uint lcd_lccr;
255 uint lcd_lchcr;
256 uint lcd_lcvcr;
257 char res1[4];
258 uint lcd_lcfaa;
259 uint lcd_lcfba;
260 char lcd_lcsr;
261 char res2[0x7];
262} lcd823_t;
263
264/* I2C
265*/
266typedef struct i2c {
267 u_char i2c_i2mod;
268 char res1[3];
269 u_char i2c_i2add;
270 char res2[3];
271 u_char i2c_i2brg;
272 char res3[3];
273 u_char i2c_i2com;
274 char res4[3];
275 u_char i2c_i2cer;
276 char res5[3];
277 u_char i2c_i2cmr;
278 char res6[0x8b];
279} i2c8xx_t;
280
281/* DMA control/status registers.
282*/
283typedef struct sdma_csr {
284 char res1[4];
285 uint sdma_sdar;
286 u_char sdma_sdsr;
287 char res3[3];
288 u_char sdma_sdmr;
289 char res4[3];
290 u_char sdma_idsr1;
291 char res5[3];
292 u_char sdma_idmr1;
293 char res6[3];
294 u_char sdma_idsr2;
295 char res7[3];
296 u_char sdma_idmr2;
297 char res8[0x13];
298} sdma8xx_t;
299
300/* Communication Processor Module Interrupt Controller.
301*/
302typedef struct cpm_ic {
303 ushort cpic_civr;
304 char res[0xe];
305 uint cpic_cicr;
306 uint cpic_cipr;
307 uint cpic_cimr;
308 uint cpic_cisr;
309} cpic8xx_t;
310
311/* Input/Output Port control/status registers.
312*/
313typedef struct io_port {
314 ushort iop_padir;
315 ushort iop_papar;
316 ushort iop_paodr;
317 ushort iop_padat;
318 char res1[8];
319 ushort iop_pcdir;
320 ushort iop_pcpar;
321 ushort iop_pcso;
322 ushort iop_pcdat;
323 ushort iop_pcint;
324 char res2[6];
325 ushort iop_pddir;
326 ushort iop_pdpar;
327 char res3[2];
328 ushort iop_pddat;
329 uint utmode;
330 char res4[4];
331} iop8xx_t;
332
333/* Communication Processor Module Timers
334*/
335typedef struct cpm_timers {
336 ushort cpmt_tgcr;
337 char res1[0xe];
338 ushort cpmt_tmr1;
339 ushort cpmt_tmr2;
340 ushort cpmt_trr1;
341 ushort cpmt_trr2;
342 ushort cpmt_tcr1;
343 ushort cpmt_tcr2;
344 ushort cpmt_tcn1;
345 ushort cpmt_tcn2;
346 ushort cpmt_tmr3;
347 ushort cpmt_tmr4;
348 ushort cpmt_trr3;
349 ushort cpmt_trr4;
350 ushort cpmt_tcr3;
351 ushort cpmt_tcr4;
352 ushort cpmt_tcn3;
353 ushort cpmt_tcn4;
354 ushort cpmt_ter1;
355 ushort cpmt_ter2;
356 ushort cpmt_ter3;
357 ushort cpmt_ter4;
358 char res2[8];
359} cpmtimer8xx_t;
360
361/* Finally, the Communication Processor stuff.....
362*/
363typedef struct scc { /* Serial communication channels */
364 uint scc_gsmrl;
365 uint scc_gsmrh;
366 ushort scc_psmr;
367 char res1[2];
368 ushort scc_todr;
369 ushort scc_dsr;
370 ushort scc_scce;
371 char res2[2];
372 ushort scc_sccm;
373 char res3;
374 u_char scc_sccs;
375 char res4[8];
376} scc_t;
377
378typedef struct smc { /* Serial management channels */
379 char res1[2];
380 ushort smc_smcmr;
381 char res2[2];
382 u_char smc_smce;
383 char res3[3];
384 u_char smc_smcm;
385 char res4[5];
386} smc_t;
387
388/* MPC860T Fast Ethernet Controller. It isn't part of the CPM, but
389 * it fits within the address space.
390 */
391
392typedef struct fec {
393 uint fec_addr_low; /* lower 32 bits of station address */
394 ushort fec_addr_high; /* upper 16 bits of station address */
395 ushort res1; /* reserved */
396 uint fec_hash_table_high; /* upper 32-bits of hash table */
397 uint fec_hash_table_low; /* lower 32-bits of hash table */
398 uint fec_r_des_start; /* beginning of Rx descriptor ring */
399 uint fec_x_des_start; /* beginning of Tx descriptor ring */
400 uint fec_r_buff_size; /* Rx buffer size */
401 uint res2[9]; /* reserved */
402 uint fec_ecntrl; /* ethernet control register */
403 uint fec_ievent; /* interrupt event register */
404 uint fec_imask; /* interrupt mask register */
405 uint fec_ivec; /* interrupt level and vector status */
406 uint fec_r_des_active; /* Rx ring updated flag */
407 uint fec_x_des_active; /* Tx ring updated flag */
408 uint res3[10]; /* reserved */
409 uint fec_mii_data; /* MII data register */
410 uint fec_mii_speed; /* MII speed control register */
411 uint res4[17]; /* reserved */
412 uint fec_r_bound; /* end of RAM (read-only) */
413 uint fec_r_fstart; /* Rx FIFO start address */
414 uint res5[6]; /* reserved */
415 uint fec_x_fstart; /* Tx FIFO start address */
416 uint res6[17]; /* reserved */
417 uint fec_fun_code; /* fec SDMA function code */
418 uint res7[3]; /* reserved */
419 uint fec_r_cntrl; /* Rx control register */
420 uint fec_r_hash; /* Rx hash register */
421 uint res8[14]; /* reserved */
422 uint fec_x_cntrl; /* Tx control register */
423 uint res9[0x1e]; /* reserved */
424} fec_t;
425
426/* The FEC and LCD color map share the same address space....
427 * I guess we will never see an 823T :-).
428 */
429union fec_lcd {
430 fec_t fl_un_fec;
431 u_char fl_un_cmap[0x200];
432};
433
434typedef struct comm_proc {
435 /* General control and status registers.
436 */
437 ushort cp_cpcr;
438 u_char res1[2];
439 ushort cp_rccr;
440 u_char res2;
441 u_char cp_rmds;
442 u_char res3[4];
443 ushort cp_cpmcr1;
444 ushort cp_cpmcr2;
445 ushort cp_cpmcr3;
446 ushort cp_cpmcr4;
447 u_char res4[2];
448 ushort cp_rter;
449 u_char res5[2];
450 ushort cp_rtmr;
451 u_char res6[0x14];
452
453 /* Baud rate generators.
454 */
455 uint cp_brgc1;
456 uint cp_brgc2;
457 uint cp_brgc3;
458 uint cp_brgc4;
459
460 /* Serial Communication Channels.
461 */
462 scc_t cp_scc[4];
463
464 /* Serial Management Channels.
465 */
466 smc_t cp_smc[2];
467
468 /* Serial Peripheral Interface.
469 */
470 ushort cp_spmode;
471 u_char res7[4];
472 u_char cp_spie;
473 u_char res8[3];
474 u_char cp_spim;
475 u_char res9[2];
476 u_char cp_spcom;
477 u_char res10[2];
478
479 /* Parallel Interface Port.
480 */
481 u_char res11[2];
482 ushort cp_pipc;
483 u_char res12[2];
484 ushort cp_ptpr;
485 uint cp_pbdir;
486 uint cp_pbpar;
487 u_char res13[2];
488 ushort cp_pbodr;
489 uint cp_pbdat;
490
491 /* Port E - MPC87x/88x only.
492 */
493 uint cp_pedir;
494 uint cp_pepar;
495 uint cp_peso;
496 uint cp_peodr;
497 uint cp_pedat;
498
499 /* Communications Processor Timing Register -
500 Contains RMII Timing for the FECs on MPC87x/88x only.
501 */
502 uint cp_cptr;
503
504 /* Serial Interface and Time Slot Assignment.
505 */
506 uint cp_simode;
507 u_char cp_sigmr;
508 u_char res15;
509 u_char cp_sistr;
510 u_char cp_sicmr;
511 u_char res16[4];
512 uint cp_sicr;
513 uint cp_sirp;
514 u_char res17[0xc];
515
516 /* 256 bytes of MPC823 video controller RAM array.
517 */
518 u_char cp_vcram[0x100];
519 u_char cp_siram[0x200];
520
521 /* The fast ethernet controller is not really part of the CPM,
522 * but it resides in the address space.
523 * The LCD color map is also here.
524 */
525 union fec_lcd fl_un;
526#define cp_fec fl_un.fl_un_fec
527#define lcd_cmap fl_un.fl_un_cmap
528 char res18[0xE00];
529
530 /* The DUET family has a second FEC here */
531 fec_t cp_fec2;
532#define cp_fec1 cp_fec /* consistency macro */
533
534 /* Dual Ported RAM follows.
535 * There are many different formats for this memory area
536 * depending upon the devices used and options chosen.
537 * Some processors don't have all of it populated.
538 */
539 u_char cp_dpmem[0x1C00]; /* BD / Data / ucode */
540 u_char cp_dparam[0x400]; /* Parameter RAM */
541} cpm8xx_t;
542
543/* Internal memory map.
544*/
545typedef struct immap {
546 sysconf8xx_t im_siu_conf; /* SIU Configuration */
547 pcmconf8xx_t im_pcmcia; /* PCMCIA Configuration */
548 memctl8xx_t im_memctl; /* Memory Controller */
549 sit8xx_t im_sit; /* System integration timers */
550 car8xx_t im_clkrst; /* Clocks and reset */
551 sitk8xx_t im_sitk; /* Sys int timer keys */
552 cark8xx_t im_clkrstk; /* Clocks and reset keys */
553 vid823_t im_vid; /* Video (823 only) */
554 lcd823_t im_lcd; /* LCD (823 only) */
555 i2c8xx_t im_i2c; /* I2C control/status */
556 sdma8xx_t im_sdma; /* SDMA control/status */
557 cpic8xx_t im_cpic; /* CPM Interrupt Controller */
558 iop8xx_t im_ioport; /* IO Port control/status */
559 cpmtimer8xx_t im_cpmtimer; /* CPM timers */
560 cpm8xx_t im_cpm; /* Communication processor */
561} immap_t;
562
563#endif /* __IMMAP_8XX__ */
564#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
new file mode 100644
index 000000000000..5ab7d7fe198c
--- /dev/null
+++ b/arch/powerpc/include/asm/Kbuild
@@ -0,0 +1,37 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += auxvec.h
4header-y += ioctls.h
5header-y += sembuf.h
6header-y += siginfo.h
7header-y += stat.h
8header-y += errno.h
9header-y += ipcbuf.h
10header-y += msgbuf.h
11header-y += shmbuf.h
12header-y += socket.h
13header-y += termbits.h
14header-y += fcntl.h
15header-y += poll.h
16header-y += sockios.h
17header-y += ucontext.h
18header-y += ioctl.h
19header-y += linkage.h
20header-y += resource.h
21header-y += sigcontext.h
22header-y += statfs.h
23header-y += ps3fb.h
24
25unifdef-y += bootx.h
26unifdef-y += byteorder.h
27unifdef-y += cputable.h
28unifdef-y += elf.h
29unifdef-y += nvram.h
30unifdef-y += param.h
31unifdef-y += posix_types.h
32unifdef-y += seccomp.h
33unifdef-y += signal.h
34unifdef-y += spu_info.h
35unifdef-y += termios.h
36unifdef-y += types.h
37unifdef-y += unistd.h
diff --git a/arch/powerpc/include/asm/a.out.h b/arch/powerpc/include/asm/a.out.h
new file mode 100644
index 000000000000..89cead6b176e
--- /dev/null
+++ b/arch/powerpc/include/asm/a.out.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_POWERPC_A_OUT_H
2#define _ASM_POWERPC_A_OUT_H
3
4struct exec
5{
6 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
7 unsigned a_text; /* length of text, in bytes */
8 unsigned a_data; /* length of data, in bytes */
9 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
10 unsigned a_syms; /* length of symbol table data in file, in bytes */
11 unsigned a_entry; /* start address */
12 unsigned a_trsize; /* length of relocation info for text, in bytes */
13 unsigned a_drsize; /* length of relocation info for data, in bytes */
14};
15
16#define N_TRSIZE(a) ((a).a_trsize)
17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms)
19
20#endif /* _ASM_POWERPC_A_OUT_H */
diff --git a/arch/powerpc/include/asm/abs_addr.h b/arch/powerpc/include/asm/abs_addr.h
new file mode 100644
index 000000000000..98324c5a8286
--- /dev/null
+++ b/arch/powerpc/include/asm/abs_addr.h
@@ -0,0 +1,75 @@
1#ifndef _ASM_POWERPC_ABS_ADDR_H
2#define _ASM_POWERPC_ABS_ADDR_H
3#ifdef __KERNEL__
4
5
6/*
7 * c 2001 PPC 64 Team, IBM Corp
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#include <linux/lmb.h>
16
17#include <asm/types.h>
18#include <asm/page.h>
19#include <asm/prom.h>
20#include <asm/firmware.h>
21
22struct mschunks_map {
23 unsigned long num_chunks;
24 unsigned long chunk_size;
25 unsigned long chunk_shift;
26 unsigned long chunk_mask;
27 u32 *mapping;
28};
29
30extern struct mschunks_map mschunks_map;
31
32/* Chunks are 256 KB */
33#define MSCHUNKS_CHUNK_SHIFT (18)
34#define MSCHUNKS_CHUNK_SIZE (1UL << MSCHUNKS_CHUNK_SHIFT)
35#define MSCHUNKS_OFFSET_MASK (MSCHUNKS_CHUNK_SIZE - 1)
36
37static inline unsigned long chunk_to_addr(unsigned long chunk)
38{
39 return chunk << MSCHUNKS_CHUNK_SHIFT;
40}
41
42static inline unsigned long addr_to_chunk(unsigned long addr)
43{
44 return addr >> MSCHUNKS_CHUNK_SHIFT;
45}
46
47static inline unsigned long phys_to_abs(unsigned long pa)
48{
49 unsigned long chunk;
50
51 /* This is a no-op on non-iSeries */
52 if (!firmware_has_feature(FW_FEATURE_ISERIES))
53 return pa;
54
55 chunk = addr_to_chunk(pa);
56
57 if (chunk < mschunks_map.num_chunks)
58 chunk = mschunks_map.mapping[chunk];
59
60 return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK);
61}
62
63/* Convenience macros */
64#define virt_to_abs(va) phys_to_abs(__pa(va))
65#define abs_to_virt(aa) __va(aa)
66
67/*
68 * Converts Virtual Address to Real Address for
69 * Legacy iSeries Hypervisor calls
70 */
71#define iseries_hv_addr(virtaddr) \
72 (0x8000000000000000 | virt_to_abs(virtaddr))
73
74#endif /* __KERNEL__ */
75#endif /* _ASM_POWERPC_ABS_ADDR_H */
diff --git a/arch/powerpc/include/asm/agp.h b/arch/powerpc/include/asm/agp.h
new file mode 100644
index 000000000000..86455c4c31ee
--- /dev/null
+++ b/arch/powerpc/include/asm/agp.h
@@ -0,0 +1,22 @@
1#ifndef _ASM_POWERPC_AGP_H
2#define _ASM_POWERPC_AGP_H
3#ifdef __KERNEL__
4
5#include <asm/io.h>
6
7#define map_page_into_agp(page)
8#define unmap_page_from_agp(page)
9#define flush_agp_cache() mb()
10
11/* Convert a physical address to an address suitable for the GART. */
12#define phys_to_gart(x) (x)
13#define gart_to_phys(x) (x)
14
15/* GATT allocation. Returns/accepts GATT kernel virtual address. */
16#define alloc_gatt_pages(order) \
17 ((char *)__get_free_pages(GFP_KERNEL, (order)))
18#define free_gatt_pages(table, order) \
19 free_pages((unsigned long)(table), (order))
20
21#endif /* __KERNEL__ */
22#endif /* _ASM_POWERPC_AGP_H */
diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
new file mode 100644
index 000000000000..8f0fe7971949
--- /dev/null
+++ b/arch/powerpc/include/asm/asm-compat.h
@@ -0,0 +1,69 @@
1#ifndef _ASM_POWERPC_ASM_COMPAT_H
2#define _ASM_POWERPC_ASM_COMPAT_H
3
4#include <asm/types.h>
5
6#ifdef __ASSEMBLY__
7# define stringify_in_c(...) __VA_ARGS__
8# define ASM_CONST(x) x
9#else
10/* This version of stringify will deal with commas... */
11# define __stringify_in_c(...) #__VA_ARGS__
12# define stringify_in_c(...) __stringify_in_c(__VA_ARGS__) " "
13# define __ASM_CONST(x) x##UL
14# define ASM_CONST(x) __ASM_CONST(x)
15#endif
16
17
18#ifdef __powerpc64__
19
20/* operations for longs and pointers */
21#define PPC_LL stringify_in_c(ld)
22#define PPC_STL stringify_in_c(std)
23#define PPC_LCMPI stringify_in_c(cmpdi)
24#define PPC_LONG stringify_in_c(.llong)
25#define PPC_LONG_ALIGN stringify_in_c(.balign 8)
26#define PPC_TLNEI stringify_in_c(tdnei)
27#define PPC_LLARX stringify_in_c(ldarx)
28#define PPC_STLCX stringify_in_c(stdcx.)
29#define PPC_CNTLZL stringify_in_c(cntlzd)
30
31/* Move to CR, single-entry optimized version. Only available
32 * on POWER4 and later.
33 */
34#ifdef CONFIG_POWER4_ONLY
35#define PPC_MTOCRF stringify_in_c(mtocrf)
36#else
37#define PPC_MTOCRF stringify_in_c(mtcrf)
38#endif
39
40#else /* 32-bit */
41
42/* operations for longs and pointers */
43#define PPC_LL stringify_in_c(lwz)
44#define PPC_STL stringify_in_c(stw)
45#define PPC_LCMPI stringify_in_c(cmpwi)
46#define PPC_LONG stringify_in_c(.long)
47#define PPC_LONG_ALIGN stringify_in_c(.balign 4)
48#define PPC_TLNEI stringify_in_c(twnei)
49#define PPC_LLARX stringify_in_c(lwarx)
50#define PPC_STLCX stringify_in_c(stwcx.)
51#define PPC_CNTLZL stringify_in_c(cntlzw)
52#define PPC_MTOCRF stringify_in_c(mtcrf)
53
54#endif
55
56#ifdef __KERNEL__
57#ifdef CONFIG_IBM405_ERR77
58/* Erratum #77 on the 405 means we need a sync or dcbt before every
59 * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
60 */
61#define PPC405_ERR77(ra,rb) stringify_in_c(dcbt ra, rb;)
62#define PPC405_ERR77_SYNC stringify_in_c(sync;)
63#else
64#define PPC405_ERR77(ra,rb)
65#define PPC405_ERR77_SYNC
66#endif
67#endif
68
69#endif /* _ASM_POWERPC_ASM_COMPAT_H */
diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
new file mode 100644
index 000000000000..f3fc733758f5
--- /dev/null
+++ b/arch/powerpc/include/asm/atomic.h
@@ -0,0 +1,479 @@
1#ifndef _ASM_POWERPC_ATOMIC_H_
2#define _ASM_POWERPC_ATOMIC_H_
3
4/*
5 * PowerPC atomic operations
6 */
7
8typedef struct { int counter; } atomic_t;
9
10#ifdef __KERNEL__
11#include <linux/compiler.h>
12#include <asm/synch.h>
13#include <asm/asm-compat.h>
14#include <asm/system.h>
15
16#define ATOMIC_INIT(i) { (i) }
17
18static __inline__ int atomic_read(const atomic_t *v)
19{
20 int t;
21
22 __asm__ __volatile__("lwz%U1%X1 %0,%1" : "=r"(t) : "m"(v->counter));
23
24 return t;
25}
26
27static __inline__ void atomic_set(atomic_t *v, int i)
28{
29 __asm__ __volatile__("stw%U0%X0 %1,%0" : "=m"(v->counter) : "r"(i));
30}
31
32static __inline__ void atomic_add(int a, atomic_t *v)
33{
34 int t;
35
36 __asm__ __volatile__(
37"1: lwarx %0,0,%3 # atomic_add\n\
38 add %0,%2,%0\n"
39 PPC405_ERR77(0,%3)
40" stwcx. %0,0,%3 \n\
41 bne- 1b"
42 : "=&r" (t), "+m" (v->counter)
43 : "r" (a), "r" (&v->counter)
44 : "cc");
45}
46
47static __inline__ int atomic_add_return(int a, atomic_t *v)
48{
49 int t;
50
51 __asm__ __volatile__(
52 LWSYNC_ON_SMP
53"1: lwarx %0,0,%2 # atomic_add_return\n\
54 add %0,%1,%0\n"
55 PPC405_ERR77(0,%2)
56" stwcx. %0,0,%2 \n\
57 bne- 1b"
58 ISYNC_ON_SMP
59 : "=&r" (t)
60 : "r" (a), "r" (&v->counter)
61 : "cc", "memory");
62
63 return t;
64}
65
66#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
67
68static __inline__ void atomic_sub(int a, atomic_t *v)
69{
70 int t;
71
72 __asm__ __volatile__(
73"1: lwarx %0,0,%3 # atomic_sub\n\
74 subf %0,%2,%0\n"
75 PPC405_ERR77(0,%3)
76" stwcx. %0,0,%3 \n\
77 bne- 1b"
78 : "=&r" (t), "+m" (v->counter)
79 : "r" (a), "r" (&v->counter)
80 : "cc");
81}
82
83static __inline__ int atomic_sub_return(int a, atomic_t *v)
84{
85 int t;
86
87 __asm__ __volatile__(
88 LWSYNC_ON_SMP
89"1: lwarx %0,0,%2 # atomic_sub_return\n\
90 subf %0,%1,%0\n"
91 PPC405_ERR77(0,%2)
92" stwcx. %0,0,%2 \n\
93 bne- 1b"
94 ISYNC_ON_SMP
95 : "=&r" (t)
96 : "r" (a), "r" (&v->counter)
97 : "cc", "memory");
98
99 return t;
100}
101
102static __inline__ void atomic_inc(atomic_t *v)
103{
104 int t;
105
106 __asm__ __volatile__(
107"1: lwarx %0,0,%2 # atomic_inc\n\
108 addic %0,%0,1\n"
109 PPC405_ERR77(0,%2)
110" stwcx. %0,0,%2 \n\
111 bne- 1b"
112 : "=&r" (t), "+m" (v->counter)
113 : "r" (&v->counter)
114 : "cc");
115}
116
117static __inline__ int atomic_inc_return(atomic_t *v)
118{
119 int t;
120
121 __asm__ __volatile__(
122 LWSYNC_ON_SMP
123"1: lwarx %0,0,%1 # atomic_inc_return\n\
124 addic %0,%0,1\n"
125 PPC405_ERR77(0,%1)
126" stwcx. %0,0,%1 \n\
127 bne- 1b"
128 ISYNC_ON_SMP
129 : "=&r" (t)
130 : "r" (&v->counter)
131 : "cc", "memory");
132
133 return t;
134}
135
136/*
137 * atomic_inc_and_test - increment and test
138 * @v: pointer of type atomic_t
139 *
140 * Atomically increments @v by 1
141 * and returns true if the result is zero, or false for all
142 * other cases.
143 */
144#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
145
146static __inline__ void atomic_dec(atomic_t *v)
147{
148 int t;
149
150 __asm__ __volatile__(
151"1: lwarx %0,0,%2 # atomic_dec\n\
152 addic %0,%0,-1\n"
153 PPC405_ERR77(0,%2)\
154" stwcx. %0,0,%2\n\
155 bne- 1b"
156 : "=&r" (t), "+m" (v->counter)
157 : "r" (&v->counter)
158 : "cc");
159}
160
161static __inline__ int atomic_dec_return(atomic_t *v)
162{
163 int t;
164
165 __asm__ __volatile__(
166 LWSYNC_ON_SMP
167"1: lwarx %0,0,%1 # atomic_dec_return\n\
168 addic %0,%0,-1\n"
169 PPC405_ERR77(0,%1)
170" stwcx. %0,0,%1\n\
171 bne- 1b"
172 ISYNC_ON_SMP
173 : "=&r" (t)
174 : "r" (&v->counter)
175 : "cc", "memory");
176
177 return t;
178}
179
180#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
181#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
182
183/**
184 * atomic_add_unless - add unless the number is a given value
185 * @v: pointer of type atomic_t
186 * @a: the amount to add to v...
187 * @u: ...unless v is equal to u.
188 *
189 * Atomically adds @a to @v, so long as it was not @u.
190 * Returns non-zero if @v was not @u, and zero otherwise.
191 */
192static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
193{
194 int t;
195
196 __asm__ __volatile__ (
197 LWSYNC_ON_SMP
198"1: lwarx %0,0,%1 # atomic_add_unless\n\
199 cmpw 0,%0,%3 \n\
200 beq- 2f \n\
201 add %0,%2,%0 \n"
202 PPC405_ERR77(0,%2)
203" stwcx. %0,0,%1 \n\
204 bne- 1b \n"
205 ISYNC_ON_SMP
206" subf %0,%2,%0 \n\
2072:"
208 : "=&r" (t)
209 : "r" (&v->counter), "r" (a), "r" (u)
210 : "cc", "memory");
211
212 return t != u;
213}
214
215#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
216
217#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0)
218#define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0)
219
220/*
221 * Atomically test *v and decrement if it is greater than 0.
222 * The function returns the old value of *v minus 1, even if
223 * the atomic variable, v, was not decremented.
224 */
225static __inline__ int atomic_dec_if_positive(atomic_t *v)
226{
227 int t;
228
229 __asm__ __volatile__(
230 LWSYNC_ON_SMP
231"1: lwarx %0,0,%1 # atomic_dec_if_positive\n\
232 cmpwi %0,1\n\
233 addi %0,%0,-1\n\
234 blt- 2f\n"
235 PPC405_ERR77(0,%1)
236" stwcx. %0,0,%1\n\
237 bne- 1b"
238 ISYNC_ON_SMP
239 "\n\
2402:" : "=&b" (t)
241 : "r" (&v->counter)
242 : "cc", "memory");
243
244 return t;
245}
246
247#define smp_mb__before_atomic_dec() smp_mb()
248#define smp_mb__after_atomic_dec() smp_mb()
249#define smp_mb__before_atomic_inc() smp_mb()
250#define smp_mb__after_atomic_inc() smp_mb()
251
252#ifdef __powerpc64__
253
254typedef struct { long counter; } atomic64_t;
255
256#define ATOMIC64_INIT(i) { (i) }
257
258static __inline__ long atomic64_read(const atomic64_t *v)
259{
260 long t;
261
262 __asm__ __volatile__("ld%U1%X1 %0,%1" : "=r"(t) : "m"(v->counter));
263
264 return t;
265}
266
267static __inline__ void atomic64_set(atomic64_t *v, long i)
268{
269 __asm__ __volatile__("std%U0%X0 %1,%0" : "=m"(v->counter) : "r"(i));
270}
271
272static __inline__ void atomic64_add(long a, atomic64_t *v)
273{
274 long t;
275
276 __asm__ __volatile__(
277"1: ldarx %0,0,%3 # atomic64_add\n\
278 add %0,%2,%0\n\
279 stdcx. %0,0,%3 \n\
280 bne- 1b"
281 : "=&r" (t), "+m" (v->counter)
282 : "r" (a), "r" (&v->counter)
283 : "cc");
284}
285
286static __inline__ long atomic64_add_return(long a, atomic64_t *v)
287{
288 long t;
289
290 __asm__ __volatile__(
291 LWSYNC_ON_SMP
292"1: ldarx %0,0,%2 # atomic64_add_return\n\
293 add %0,%1,%0\n\
294 stdcx. %0,0,%2 \n\
295 bne- 1b"
296 ISYNC_ON_SMP
297 : "=&r" (t)
298 : "r" (a), "r" (&v->counter)
299 : "cc", "memory");
300
301 return t;
302}
303
304#define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0)
305
306static __inline__ void atomic64_sub(long a, atomic64_t *v)
307{
308 long t;
309
310 __asm__ __volatile__(
311"1: ldarx %0,0,%3 # atomic64_sub\n\
312 subf %0,%2,%0\n\
313 stdcx. %0,0,%3 \n\
314 bne- 1b"
315 : "=&r" (t), "+m" (v->counter)
316 : "r" (a), "r" (&v->counter)
317 : "cc");
318}
319
320static __inline__ long atomic64_sub_return(long a, atomic64_t *v)
321{
322 long t;
323
324 __asm__ __volatile__(
325 LWSYNC_ON_SMP
326"1: ldarx %0,0,%2 # atomic64_sub_return\n\
327 subf %0,%1,%0\n\
328 stdcx. %0,0,%2 \n\
329 bne- 1b"
330 ISYNC_ON_SMP
331 : "=&r" (t)
332 : "r" (a), "r" (&v->counter)
333 : "cc", "memory");
334
335 return t;
336}
337
338static __inline__ void atomic64_inc(atomic64_t *v)
339{
340 long t;
341
342 __asm__ __volatile__(
343"1: ldarx %0,0,%2 # atomic64_inc\n\
344 addic %0,%0,1\n\
345 stdcx. %0,0,%2 \n\
346 bne- 1b"
347 : "=&r" (t), "+m" (v->counter)
348 : "r" (&v->counter)
349 : "cc");
350}
351
352static __inline__ long atomic64_inc_return(atomic64_t *v)
353{
354 long t;
355
356 __asm__ __volatile__(
357 LWSYNC_ON_SMP
358"1: ldarx %0,0,%1 # atomic64_inc_return\n\
359 addic %0,%0,1\n\
360 stdcx. %0,0,%1 \n\
361 bne- 1b"
362 ISYNC_ON_SMP
363 : "=&r" (t)
364 : "r" (&v->counter)
365 : "cc", "memory");
366
367 return t;
368}
369
370/*
371 * atomic64_inc_and_test - increment and test
372 * @v: pointer of type atomic64_t
373 *
374 * Atomically increments @v by 1
375 * and returns true if the result is zero, or false for all
376 * other cases.
377 */
378#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
379
380static __inline__ void atomic64_dec(atomic64_t *v)
381{
382 long t;
383
384 __asm__ __volatile__(
385"1: ldarx %0,0,%2 # atomic64_dec\n\
386 addic %0,%0,-1\n\
387 stdcx. %0,0,%2\n\
388 bne- 1b"
389 : "=&r" (t), "+m" (v->counter)
390 : "r" (&v->counter)
391 : "cc");
392}
393
394static __inline__ long atomic64_dec_return(atomic64_t *v)
395{
396 long t;
397
398 __asm__ __volatile__(
399 LWSYNC_ON_SMP
400"1: ldarx %0,0,%1 # atomic64_dec_return\n\
401 addic %0,%0,-1\n\
402 stdcx. %0,0,%1\n\
403 bne- 1b"
404 ISYNC_ON_SMP
405 : "=&r" (t)
406 : "r" (&v->counter)
407 : "cc", "memory");
408
409 return t;
410}
411
412#define atomic64_sub_and_test(a, v) (atomic64_sub_return((a), (v)) == 0)
413#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0)
414
415/*
416 * Atomically test *v and decrement if it is greater than 0.
417 * The function returns the old value of *v minus 1.
418 */
419static __inline__ long atomic64_dec_if_positive(atomic64_t *v)
420{
421 long t;
422
423 __asm__ __volatile__(
424 LWSYNC_ON_SMP
425"1: ldarx %0,0,%1 # atomic64_dec_if_positive\n\
426 addic. %0,%0,-1\n\
427 blt- 2f\n\
428 stdcx. %0,0,%1\n\
429 bne- 1b"
430 ISYNC_ON_SMP
431 "\n\
4322:" : "=&r" (t)
433 : "r" (&v->counter)
434 : "cc", "memory");
435
436 return t;
437}
438
439#define atomic64_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
440#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
441
442/**
443 * atomic64_add_unless - add unless the number is a given value
444 * @v: pointer of type atomic64_t
445 * @a: the amount to add to v...
446 * @u: ...unless v is equal to u.
447 *
448 * Atomically adds @a to @v, so long as it was not @u.
449 * Returns non-zero if @v was not @u, and zero otherwise.
450 */
451static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
452{
453 long t;
454
455 __asm__ __volatile__ (
456 LWSYNC_ON_SMP
457"1: ldarx %0,0,%1 # atomic_add_unless\n\
458 cmpd 0,%0,%3 \n\
459 beq- 2f \n\
460 add %0,%2,%0 \n"
461" stdcx. %0,0,%1 \n\
462 bne- 1b \n"
463 ISYNC_ON_SMP
464" subf %0,%2,%0 \n\
4652:"
466 : "=&r" (t)
467 : "r" (&v->counter), "r" (a), "r" (u)
468 : "cc", "memory");
469
470 return t != u;
471}
472
473#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
474
475#endif /* __powerpc64__ */
476
477#include <asm-generic/atomic.h>
478#endif /* __KERNEL__ */
479#endif /* _ASM_POWERPC_ATOMIC_H_ */
diff --git a/arch/powerpc/include/asm/auxvec.h b/arch/powerpc/include/asm/auxvec.h
new file mode 100644
index 000000000000..19a099b62cd6
--- /dev/null
+++ b/arch/powerpc/include/asm/auxvec.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_POWERPC_AUXVEC_H
2#define _ASM_POWERPC_AUXVEC_H
3
4/*
5 * We need to put in some extra aux table entries to tell glibc what
6 * the cache block size is, so it can use the dcbz instruction safely.
7 */
8#define AT_DCACHEBSIZE 19
9#define AT_ICACHEBSIZE 20
10#define AT_UCACHEBSIZE 21
11/* A special ignored type value for PPC, for glibc compatibility. */
12#define AT_IGNOREPPC 22
13
14/* The vDSO location. We have to use the same value as x86 for glibc's
15 * sake :-)
16 */
17#define AT_SYSINFO_EHDR 33
18
19#endif
diff --git a/arch/powerpc/include/asm/backlight.h b/arch/powerpc/include/asm/backlight.h
new file mode 100644
index 000000000000..8cf5c37c3817
--- /dev/null
+++ b/arch/powerpc/include/asm/backlight.h
@@ -0,0 +1,41 @@
1/*
2 * Routines for handling backlight control on PowerBooks
3 *
4 * For now, implementation resides in
5 * arch/powerpc/platforms/powermac/backlight.c
6 *
7 */
8#ifndef __ASM_POWERPC_BACKLIGHT_H
9#define __ASM_POWERPC_BACKLIGHT_H
10#ifdef __KERNEL__
11
12#include <linux/fb.h>
13#include <linux/mutex.h>
14
15/* For locking instructions, see the implementation file */
16extern struct backlight_device *pmac_backlight;
17extern struct mutex pmac_backlight_mutex;
18
19extern int pmac_backlight_curve_lookup(struct fb_info *info, int value);
20
21extern int pmac_has_backlight_type(const char *type);
22
23extern void pmac_backlight_key(int direction);
24static inline void pmac_backlight_key_up(void)
25{
26 pmac_backlight_key(0);
27}
28static inline void pmac_backlight_key_down(void)
29{
30 pmac_backlight_key(1);
31}
32
33extern void pmac_backlight_set_legacy_brightness_pmu(int brightness);
34extern int pmac_backlight_set_legacy_brightness(int brightness);
35extern int pmac_backlight_get_legacy_brightness(void);
36
37extern void pmac_backlight_enable(void);
38extern void pmac_backlight_disable(void);
39
40#endif /* __KERNEL__ */
41#endif
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h
new file mode 100644
index 000000000000..897eade3afbe
--- /dev/null
+++ b/arch/powerpc/include/asm/bitops.h
@@ -0,0 +1,410 @@
1/*
2 * PowerPC atomic bit operations.
3 *
4 * Merged version by David Gibson <david@gibson.dropbear.id.au>.
5 * Based on ppc64 versions by: Dave Engebretsen, Todd Inglett, Don
6 * Reed, Pat McCarthy, Peter Bergner, Anton Blanchard. They
7 * originally took it from the ppc32 code.
8 *
9 * Within a word, bits are numbered LSB first. Lot's of places make
10 * this assumption by directly testing bits with (val & (1<<nr)).
11 * This can cause confusion for large (> 1 word) bitmaps on a
12 * big-endian system because, unlike little endian, the number of each
13 * bit depends on the word size.
14 *
15 * The bitop functions are defined to work on unsigned longs, so for a
16 * ppc64 system the bits end up numbered:
17 * |63..............0|127............64|191...........128|255...........196|
18 * and on ppc32:
19 * |31.....0|63....31|95....64|127...96|159..128|191..160|223..192|255..224|
20 *
21 * There are a few little-endian macros used mostly for filesystem
22 * bitmaps, these work on similar bit arrays layouts, but
23 * byte-oriented:
24 * |7...0|15...8|23...16|31...24|39...32|47...40|55...48|63...56|
25 *
26 * The main difference is that bit 3-5 (64b) or 3-4 (32b) in the bit
27 * number field needs to be reversed compared to the big-endian bit
28 * fields. This can be achieved by XOR with 0x38 (64b) or 0x18 (32b).
29 *
30 * This program is free software; you can redistribute it and/or
31 * modify it under the terms of the GNU General Public License
32 * as published by the Free Software Foundation; either version
33 * 2 of the License, or (at your option) any later version.
34 */
35
36#ifndef _ASM_POWERPC_BITOPS_H
37#define _ASM_POWERPC_BITOPS_H
38
39#ifdef __KERNEL__
40
41#ifndef _LINUX_BITOPS_H
42#error only <linux/bitops.h> can be included directly
43#endif
44
45#include <linux/compiler.h>
46#include <asm/asm-compat.h>
47#include <asm/synch.h>
48
49/*
50 * clear_bit doesn't imply a memory barrier
51 */
52#define smp_mb__before_clear_bit() smp_mb()
53#define smp_mb__after_clear_bit() smp_mb()
54
55#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
56#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
57#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
58
59static __inline__ void set_bit(int nr, volatile unsigned long *addr)
60{
61 unsigned long old;
62 unsigned long mask = BITOP_MASK(nr);
63 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
64
65 __asm__ __volatile__(
66"1:" PPC_LLARX "%0,0,%3 # set_bit\n"
67 "or %0,%0,%2\n"
68 PPC405_ERR77(0,%3)
69 PPC_STLCX "%0,0,%3\n"
70 "bne- 1b"
71 : "=&r" (old), "+m" (*p)
72 : "r" (mask), "r" (p)
73 : "cc" );
74}
75
76static __inline__ void clear_bit(int nr, volatile unsigned long *addr)
77{
78 unsigned long old;
79 unsigned long mask = BITOP_MASK(nr);
80 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
81
82 __asm__ __volatile__(
83"1:" PPC_LLARX "%0,0,%3 # clear_bit\n"
84 "andc %0,%0,%2\n"
85 PPC405_ERR77(0,%3)
86 PPC_STLCX "%0,0,%3\n"
87 "bne- 1b"
88 : "=&r" (old), "+m" (*p)
89 : "r" (mask), "r" (p)
90 : "cc" );
91}
92
93static __inline__ void clear_bit_unlock(int nr, volatile unsigned long *addr)
94{
95 unsigned long old;
96 unsigned long mask = BITOP_MASK(nr);
97 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
98
99 __asm__ __volatile__(
100 LWSYNC_ON_SMP
101"1:" PPC_LLARX "%0,0,%3 # clear_bit_unlock\n"
102 "andc %0,%0,%2\n"
103 PPC405_ERR77(0,%3)
104 PPC_STLCX "%0,0,%3\n"
105 "bne- 1b"
106 : "=&r" (old), "+m" (*p)
107 : "r" (mask), "r" (p)
108 : "cc", "memory");
109}
110
111static __inline__ void change_bit(int nr, volatile unsigned long *addr)
112{
113 unsigned long old;
114 unsigned long mask = BITOP_MASK(nr);
115 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
116
117 __asm__ __volatile__(
118"1:" PPC_LLARX "%0,0,%3 # change_bit\n"
119 "xor %0,%0,%2\n"
120 PPC405_ERR77(0,%3)
121 PPC_STLCX "%0,0,%3\n"
122 "bne- 1b"
123 : "=&r" (old), "+m" (*p)
124 : "r" (mask), "r" (p)
125 : "cc" );
126}
127
128static __inline__ int test_and_set_bit(unsigned long nr,
129 volatile unsigned long *addr)
130{
131 unsigned long old, t;
132 unsigned long mask = BITOP_MASK(nr);
133 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
134
135 __asm__ __volatile__(
136 LWSYNC_ON_SMP
137"1:" PPC_LLARX "%0,0,%3 # test_and_set_bit\n"
138 "or %1,%0,%2 \n"
139 PPC405_ERR77(0,%3)
140 PPC_STLCX "%1,0,%3 \n"
141 "bne- 1b"
142 ISYNC_ON_SMP
143 : "=&r" (old), "=&r" (t)
144 : "r" (mask), "r" (p)
145 : "cc", "memory");
146
147 return (old & mask) != 0;
148}
149
150static __inline__ int test_and_set_bit_lock(unsigned long nr,
151 volatile unsigned long *addr)
152{
153 unsigned long old, t;
154 unsigned long mask = BITOP_MASK(nr);
155 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
156
157 __asm__ __volatile__(
158"1:" PPC_LLARX "%0,0,%3 # test_and_set_bit_lock\n"
159 "or %1,%0,%2 \n"
160 PPC405_ERR77(0,%3)
161 PPC_STLCX "%1,0,%3 \n"
162 "bne- 1b"
163 ISYNC_ON_SMP
164 : "=&r" (old), "=&r" (t)
165 : "r" (mask), "r" (p)
166 : "cc", "memory");
167
168 return (old & mask) != 0;
169}
170
171static __inline__ int test_and_clear_bit(unsigned long nr,
172 volatile unsigned long *addr)
173{
174 unsigned long old, t;
175 unsigned long mask = BITOP_MASK(nr);
176 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
177
178 __asm__ __volatile__(
179 LWSYNC_ON_SMP
180"1:" PPC_LLARX "%0,0,%3 # test_and_clear_bit\n"
181 "andc %1,%0,%2 \n"
182 PPC405_ERR77(0,%3)
183 PPC_STLCX "%1,0,%3 \n"
184 "bne- 1b"
185 ISYNC_ON_SMP
186 : "=&r" (old), "=&r" (t)
187 : "r" (mask), "r" (p)
188 : "cc", "memory");
189
190 return (old & mask) != 0;
191}
192
193static __inline__ int test_and_change_bit(unsigned long nr,
194 volatile unsigned long *addr)
195{
196 unsigned long old, t;
197 unsigned long mask = BITOP_MASK(nr);
198 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
199
200 __asm__ __volatile__(
201 LWSYNC_ON_SMP
202"1:" PPC_LLARX "%0,0,%3 # test_and_change_bit\n"
203 "xor %1,%0,%2 \n"
204 PPC405_ERR77(0,%3)
205 PPC_STLCX "%1,0,%3 \n"
206 "bne- 1b"
207 ISYNC_ON_SMP
208 : "=&r" (old), "=&r" (t)
209 : "r" (mask), "r" (p)
210 : "cc", "memory");
211
212 return (old & mask) != 0;
213}
214
215static __inline__ void set_bits(unsigned long mask, unsigned long *addr)
216{
217 unsigned long old;
218
219 __asm__ __volatile__(
220"1:" PPC_LLARX "%0,0,%3 # set_bits\n"
221 "or %0,%0,%2\n"
222 PPC_STLCX "%0,0,%3\n"
223 "bne- 1b"
224 : "=&r" (old), "+m" (*addr)
225 : "r" (mask), "r" (addr)
226 : "cc");
227}
228
229#include <asm-generic/bitops/non-atomic.h>
230
231static __inline__ void __clear_bit_unlock(int nr, volatile unsigned long *addr)
232{
233 __asm__ __volatile__(LWSYNC_ON_SMP "" ::: "memory");
234 __clear_bit(nr, addr);
235}
236
237/*
238 * Return the zero-based bit position (LE, not IBM bit numbering) of
239 * the most significant 1-bit in a double word.
240 */
241static __inline__ __attribute__((const))
242int __ilog2(unsigned long x)
243{
244 int lz;
245
246 asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x));
247 return BITS_PER_LONG - 1 - lz;
248}
249
250static inline __attribute__((const))
251int __ilog2_u32(u32 n)
252{
253 int bit;
254 asm ("cntlzw %0,%1" : "=r" (bit) : "r" (n));
255 return 31 - bit;
256}
257
258#ifdef __powerpc64__
259static inline __attribute__((const))
260int __ilog2_u64(u64 n)
261{
262 int bit;
263 asm ("cntlzd %0,%1" : "=r" (bit) : "r" (n));
264 return 63 - bit;
265}
266#endif
267
268/*
269 * Determines the bit position of the least significant 0 bit in the
270 * specified double word. The returned bit position will be
271 * zero-based, starting from the right side (63/31 - 0).
272 */
273static __inline__ unsigned long ffz(unsigned long x)
274{
275 /* no zero exists anywhere in the 8 byte area. */
276 if ((x = ~x) == 0)
277 return BITS_PER_LONG;
278
279 /*
280 * Calculate the bit position of the least signficant '1' bit in x
281 * (since x has been changed this will actually be the least signficant
282 * '0' bit in * the original x). Note: (x & -x) gives us a mask that
283 * is the least significant * (RIGHT-most) 1-bit of the value in x.
284 */
285 return __ilog2(x & -x);
286}
287
288static __inline__ int __ffs(unsigned long x)
289{
290 return __ilog2(x & -x);
291}
292
293/*
294 * ffs: find first bit set. This is defined the same way as
295 * the libc and compiler builtin ffs routines, therefore
296 * differs in spirit from the above ffz (man ffs).
297 */
298static __inline__ int ffs(int x)
299{
300 unsigned long i = (unsigned long)x;
301 return __ilog2(i & -i) + 1;
302}
303
304/*
305 * fls: find last (most-significant) bit set.
306 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
307 */
308static __inline__ int fls(unsigned int x)
309{
310 int lz;
311
312 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
313 return 32 - lz;
314}
315
316static __inline__ unsigned long __fls(unsigned long x)
317{
318 return __ilog2(x);
319}
320
321/*
322 * 64-bit can do this using one cntlzd (count leading zeroes doubleword)
323 * instruction; for 32-bit we use the generic version, which does two
324 * 32-bit fls calls.
325 */
326#ifdef __powerpc64__
327static __inline__ int fls64(__u64 x)
328{
329 int lz;
330
331 asm ("cntlzd %0,%1" : "=r" (lz) : "r" (x));
332 return 64 - lz;
333}
334#else
335#include <asm-generic/bitops/fls64.h>
336#endif /* __powerpc64__ */
337
338#include <asm-generic/bitops/hweight.h>
339#include <asm-generic/bitops/find.h>
340
341/* Little-endian versions */
342
343static __inline__ int test_le_bit(unsigned long nr,
344 __const__ unsigned long *addr)
345{
346 __const__ unsigned char *tmp = (__const__ unsigned char *) addr;
347 return (tmp[nr >> 3] >> (nr & 7)) & 1;
348}
349
350#define __set_le_bit(nr, addr) \
351 __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
352#define __clear_le_bit(nr, addr) \
353 __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
354
355#define test_and_set_le_bit(nr, addr) \
356 test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
357#define test_and_clear_le_bit(nr, addr) \
358 test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
359
360#define __test_and_set_le_bit(nr, addr) \
361 __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
362#define __test_and_clear_le_bit(nr, addr) \
363 __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
364
365#define find_first_zero_le_bit(addr, size) generic_find_next_zero_le_bit((addr), (size), 0)
366unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
367 unsigned long size, unsigned long offset);
368
369unsigned long generic_find_next_le_bit(const unsigned long *addr,
370 unsigned long size, unsigned long offset);
371/* Bitmap functions for the ext2 filesystem */
372
373#define ext2_set_bit(nr,addr) \
374 __test_and_set_le_bit((nr), (unsigned long*)addr)
375#define ext2_clear_bit(nr, addr) \
376 __test_and_clear_le_bit((nr), (unsigned long*)addr)
377
378#define ext2_set_bit_atomic(lock, nr, addr) \
379 test_and_set_le_bit((nr), (unsigned long*)addr)
380#define ext2_clear_bit_atomic(lock, nr, addr) \
381 test_and_clear_le_bit((nr), (unsigned long*)addr)
382
383#define ext2_test_bit(nr, addr) test_le_bit((nr),(unsigned long*)addr)
384
385#define ext2_find_first_zero_bit(addr, size) \
386 find_first_zero_le_bit((unsigned long*)addr, size)
387#define ext2_find_next_zero_bit(addr, size, off) \
388 generic_find_next_zero_le_bit((unsigned long*)addr, size, off)
389
390#define ext2_find_next_bit(addr, size, off) \
391 generic_find_next_le_bit((unsigned long *)addr, size, off)
392/* Bitmap functions for the minix filesystem. */
393
394#define minix_test_and_set_bit(nr,addr) \
395 __test_and_set_le_bit(nr, (unsigned long *)addr)
396#define minix_set_bit(nr,addr) \
397 __set_le_bit(nr, (unsigned long *)addr)
398#define minix_test_and_clear_bit(nr,addr) \
399 __test_and_clear_le_bit(nr, (unsigned long *)addr)
400#define minix_test_bit(nr,addr) \
401 test_le_bit(nr, (unsigned long *)addr)
402
403#define minix_find_first_zero_bit(addr,size) \
404 find_first_zero_le_bit((unsigned long *)addr, size)
405
406#include <asm-generic/bitops/sched.h>
407
408#endif /* __KERNEL__ */
409
410#endif /* _ASM_POWERPC_BITOPS_H */
diff --git a/arch/powerpc/include/asm/bootx.h b/arch/powerpc/include/asm/bootx.h
new file mode 100644
index 000000000000..57b82e3f89ce
--- /dev/null
+++ b/arch/powerpc/include/asm/bootx.h
@@ -0,0 +1,171 @@
1/*
2 * This file describes the structure passed from the BootX application
3 * (for MacOS) when it is used to boot Linux.
4 *
5 * Written by Benjamin Herrenschmidt.
6 */
7
8
9#ifndef __ASM_BOOTX_H__
10#define __ASM_BOOTX_H__
11
12#include <asm/types.h>
13
14#ifdef macintosh
15#include <Types.h>
16#include "linux_type_defs.h"
17#endif
18
19#ifdef macintosh
20/* All this requires PowerPC alignment */
21#pragma options align=power
22#endif
23
24/* On kernel entry:
25 *
26 * r3 = 0x426f6f58 ('BooX')
27 * r4 = pointer to boot_infos
28 * r5 = NULL
29 *
30 * Data and instruction translation disabled, interrupts
31 * disabled, kernel loaded at physical 0x00000000 on PCI
32 * machines (will be different on NuBus).
33 */
34
35#define BOOT_INFO_VERSION 5
36#define BOOT_INFO_COMPATIBLE_VERSION 1
37
38/* Bit in the architecture flag mask. More to be defined in
39 future versions. Note that either BOOT_ARCH_PCI or
40 BOOT_ARCH_NUBUS is set. The other BOOT_ARCH_NUBUS_xxx are
41 set additionally when BOOT_ARCH_NUBUS is set.
42 */
43#define BOOT_ARCH_PCI 0x00000001UL
44#define BOOT_ARCH_NUBUS 0x00000002UL
45#define BOOT_ARCH_NUBUS_PDM 0x00000010UL
46#define BOOT_ARCH_NUBUS_PERFORMA 0x00000020UL
47#define BOOT_ARCH_NUBUS_POWERBOOK 0x00000040UL
48
49/* Maximum number of ranges in phys memory map */
50#define MAX_MEM_MAP_SIZE 26
51
52/* This is the format of an element in the physical memory map. Note that
53 the map is optional and current BootX will only build it for pre-PCI
54 machines */
55typedef struct boot_info_map_entry
56{
57 __u32 physAddr; /* Physical starting address */
58 __u32 size; /* Size in bytes */
59} boot_info_map_entry_t;
60
61
62/* Here are the boot informations that are passed to the bootstrap
63 * Note that the kernel arguments and the device tree are appended
64 * at the end of this structure. */
65typedef struct boot_infos
66{
67 /* Version of this structure */
68 __u32 version;
69 /* backward compatible down to version: */
70 __u32 compatible_version;
71
72 /* NEW (vers. 2) this holds the current _logical_ base addr of
73 the frame buffer (for use by early boot message) */
74 __u8* logicalDisplayBase;
75
76 /* NEW (vers. 4) Apple's machine identification */
77 __u32 machineID;
78
79 /* NEW (vers. 4) Detected hw architecture */
80 __u32 architecture;
81
82 /* The device tree (internal addresses relative to the beginning of the tree,
83 * device tree offset relative to the beginning of this structure).
84 * On pre-PCI macintosh (BOOT_ARCH_PCI bit set to 0 in architecture), this
85 * field is 0.
86 */
87 __u32 deviceTreeOffset; /* Device tree offset */
88 __u32 deviceTreeSize; /* Size of the device tree */
89
90 /* Some infos about the current MacOS display */
91 __u32 dispDeviceRect[4]; /* left,top,right,bottom */
92 __u32 dispDeviceDepth; /* (8, 16 or 32) */
93 __u8* dispDeviceBase; /* base address (physical) */
94 __u32 dispDeviceRowBytes; /* rowbytes (in bytes) */
95 __u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */
96 /* Optional offset in the registry to the current
97 * MacOS display. (Can be 0 when not detected) */
98 __u32 dispDeviceRegEntryOffset;
99
100 /* Optional pointer to boot ramdisk (offset from this structure) */
101 __u32 ramDisk;
102 __u32 ramDiskSize; /* size of ramdisk image */
103
104 /* Kernel command line arguments (offset from this structure) */
105 __u32 kernelParamsOffset;
106
107 /* ALL BELOW NEW (vers. 4) */
108
109 /* This defines the physical memory. Valid with BOOT_ARCH_NUBUS flag
110 (non-PCI) only. On PCI, memory is contiguous and it's size is in the
111 device-tree. */
112 boot_info_map_entry_t
113 physMemoryMap[MAX_MEM_MAP_SIZE]; /* Where the phys memory is */
114 __u32 physMemoryMapSize; /* How many entries in map */
115
116
117 /* The framebuffer size (optional, currently 0) */
118 __u32 frameBufferSize; /* Represents a max size, can be 0. */
119
120 /* NEW (vers. 5) */
121
122 /* Total params size (args + colormap + device tree + ramdisk) */
123 __u32 totalParamsSize;
124
125} boot_infos_t;
126
127#ifdef __KERNEL__
128/* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index
129 * is represented by 3 short words containing a 16 bits (unsigned) color
130 * component. Later versions may contain the gamma table for direct-color
131 * devices here.
132 */
133#define BOOTX_COLORTABLE_SIZE (256UL*3UL*2UL)
134
135/* BootX passes the device-tree using a format that comes from earlier
136 * ppc32 kernels. This used to match what is in prom.h, but not anymore
137 * so we now define it here
138 */
139struct bootx_dt_prop {
140 u32 name;
141 int length;
142 u32 value;
143 u32 next;
144};
145
146struct bootx_dt_node {
147 u32 unused0;
148 u32 unused1;
149 u32 phandle; /* not really available */
150 u32 unused2;
151 u32 unused3;
152 u32 unused4;
153 u32 unused5;
154 u32 full_name;
155 u32 properties;
156 u32 parent;
157 u32 child;
158 u32 sibling;
159 u32 next;
160 u32 allnext;
161};
162
163extern void bootx_init(unsigned long r4, unsigned long phys);
164
165#endif /* __KERNEL__ */
166
167#ifdef macintosh
168#pragma options align=reset
169#endif
170
171#endif
diff --git a/arch/powerpc/include/asm/btext.h b/arch/powerpc/include/asm/btext.h
new file mode 100644
index 000000000000..906f46e31006
--- /dev/null
+++ b/arch/powerpc/include/asm/btext.h
@@ -0,0 +1,28 @@
1/*
2 * Definitions for using the procedures in btext.c.
3 *
4 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 */
6#ifndef __PPC_BTEXT_H
7#define __PPC_BTEXT_H
8#ifdef __KERNEL__
9
10extern int btext_find_display(int allow_nonstdout);
11extern void btext_update_display(unsigned long phys, int width, int height,
12 int depth, int pitch);
13extern void btext_setup_display(int width, int height, int depth, int pitch,
14 unsigned long address);
15extern void btext_prepare_BAT(void);
16extern void btext_unmap(void);
17
18extern void btext_drawchar(char c);
19extern void btext_drawstring(const char *str);
20extern void btext_drawhex(unsigned long v);
21extern void btext_drawtext(const char *c, unsigned int len);
22
23extern void btext_clearscreen(void);
24extern void btext_flushscreen(void);
25extern void btext_flushline(void);
26
27#endif /* __KERNEL__ */
28#endif /* __PPC_BTEXT_H */
diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h
new file mode 100644
index 000000000000..e55d1f66b86f
--- /dev/null
+++ b/arch/powerpc/include/asm/bug.h
@@ -0,0 +1,121 @@
1#ifndef _ASM_POWERPC_BUG_H
2#define _ASM_POWERPC_BUG_H
3#ifdef __KERNEL__
4
5#include <asm/asm-compat.h>
6/*
7 * Define an illegal instr to trap on the bug.
8 * We don't use 0 because that marks the end of a function
9 * in the ELF ABI. That's "Boo Boo" in case you wonder...
10 */
11#define BUG_OPCODE .long 0x00b00b00 /* For asm */
12#define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */
13
14#ifdef CONFIG_BUG
15
16#ifdef __ASSEMBLY__
17#ifdef CONFIG_DEBUG_BUGVERBOSE
18.macro EMIT_BUG_ENTRY addr,file,line,flags
19 .section __bug_table,"a"
205001: PPC_LONG \addr, 5002f
21 .short \line, \flags
22 .org 5001b+BUG_ENTRY_SIZE
23 .previous
24 .section .rodata,"a"
255002: .asciz "\file"
26 .previous
27.endm
28#else
29 .macro EMIT_BUG_ENTRY addr,file,line,flags
30 .section __bug_table,"a"
315001: PPC_LONG \addr
32 .short \flags
33 .org 5001b+BUG_ENTRY_SIZE
34 .previous
35.endm
36#endif /* verbose */
37
38#else /* !__ASSEMBLY__ */
39/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
40 sizeof(struct bug_entry), respectively */
41#ifdef CONFIG_DEBUG_BUGVERBOSE
42#define _EMIT_BUG_ENTRY \
43 ".section __bug_table,\"a\"\n" \
44 "2:\t" PPC_LONG "1b, %0\n" \
45 "\t.short %1, %2\n" \
46 ".org 2b+%3\n" \
47 ".previous\n"
48#else
49#define _EMIT_BUG_ENTRY \
50 ".section __bug_table,\"a\"\n" \
51 "2:\t" PPC_LONG "1b\n" \
52 "\t.short %2\n" \
53 ".org 2b+%3\n" \
54 ".previous\n"
55#endif
56
57/*
58 * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
59 * optimisations. However depending on the complexity of the condition
60 * some compiler versions may not produce optimal results.
61 */
62
63#define BUG() do { \
64 __asm__ __volatile__( \
65 "1: twi 31,0,0\n" \
66 _EMIT_BUG_ENTRY \
67 : : "i" (__FILE__), "i" (__LINE__), \
68 "i" (0), "i" (sizeof(struct bug_entry))); \
69 for(;;) ; \
70} while (0)
71
72#define BUG_ON(x) do { \
73 if (__builtin_constant_p(x)) { \
74 if (x) \
75 BUG(); \
76 } else { \
77 __asm__ __volatile__( \
78 "1: "PPC_TLNEI" %4,0\n" \
79 _EMIT_BUG_ENTRY \
80 : : "i" (__FILE__), "i" (__LINE__), "i" (0), \
81 "i" (sizeof(struct bug_entry)), \
82 "r" ((__force long)(x))); \
83 } \
84} while (0)
85
86#define __WARN() do { \
87 __asm__ __volatile__( \
88 "1: twi 31,0,0\n" \
89 _EMIT_BUG_ENTRY \
90 : : "i" (__FILE__), "i" (__LINE__), \
91 "i" (BUGFLAG_WARNING), \
92 "i" (sizeof(struct bug_entry))); \
93} while (0)
94
95#define WARN_ON(x) ({ \
96 int __ret_warn_on = !!(x); \
97 if (__builtin_constant_p(__ret_warn_on)) { \
98 if (__ret_warn_on) \
99 __WARN(); \
100 } else { \
101 __asm__ __volatile__( \
102 "1: "PPC_TLNEI" %4,0\n" \
103 _EMIT_BUG_ENTRY \
104 : : "i" (__FILE__), "i" (__LINE__), \
105 "i" (BUGFLAG_WARNING), \
106 "i" (sizeof(struct bug_entry)), \
107 "r" (__ret_warn_on)); \
108 } \
109 unlikely(__ret_warn_on); \
110})
111
112#define HAVE_ARCH_BUG
113#define HAVE_ARCH_BUG_ON
114#define HAVE_ARCH_WARN_ON
115#endif /* __ASSEMBLY __ */
116#endif /* CONFIG_BUG */
117
118#include <asm-generic/bug.h>
119
120#endif /* __KERNEL__ */
121#endif /* _ASM_POWERPC_BUG_H */
diff --git a/arch/powerpc/include/asm/bugs.h b/arch/powerpc/include/asm/bugs.h
new file mode 100644
index 000000000000..42fdb73e3068
--- /dev/null
+++ b/arch/powerpc/include/asm/bugs.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_POWERPC_BUGS_H
2#define _ASM_POWERPC_BUGS_H
3
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/*
12 * This file is included by 'init/main.c' to check for
13 * architecture-dependent bugs.
14 */
15
16static inline void check_bugs(void) { }
17
18#endif /* _ASM_POWERPC_BUGS_H */
diff --git a/arch/powerpc/include/asm/byteorder.h b/arch/powerpc/include/asm/byteorder.h
new file mode 100644
index 000000000000..b37752214a16
--- /dev/null
+++ b/arch/powerpc/include/asm/byteorder.h
@@ -0,0 +1,89 @@
1#ifndef _ASM_POWERPC_BYTEORDER_H
2#define _ASM_POWERPC_BYTEORDER_H
3
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#include <asm/types.h>
12#include <linux/compiler.h>
13
14#ifdef __GNUC__
15#ifdef __KERNEL__
16
17static __inline__ __u16 ld_le16(const volatile __u16 *addr)
18{
19 __u16 val;
20
21 __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
22 return val;
23}
24
25static __inline__ void st_le16(volatile __u16 *addr, const __u16 val)
26{
27 __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
28}
29
30static __inline__ __u32 ld_le32(const volatile __u32 *addr)
31{
32 __u32 val;
33
34 __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
35 return val;
36}
37
38static __inline__ void st_le32(volatile __u32 *addr, const __u32 val)
39{
40 __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
41}
42
43static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value)
44{
45 __u16 result;
46
47 __asm__("rlwimi %0,%1,8,16,23"
48 : "=r" (result)
49 : "r" (value), "0" (value >> 8));
50 return result;
51}
52
53static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 value)
54{
55 __u32 result;
56
57 __asm__("rlwimi %0,%1,24,16,23\n\t"
58 "rlwimi %0,%1,8,8,15\n\t"
59 "rlwimi %0,%1,24,0,7"
60 : "=r" (result)
61 : "r" (value), "0" (value >> 24));
62 return result;
63}
64
65#define __arch__swab16(x) ___arch__swab16(x)
66#define __arch__swab32(x) ___arch__swab32(x)
67
68/* The same, but returns converted value from the location pointer by addr. */
69#define __arch__swab16p(addr) ld_le16(addr)
70#define __arch__swab32p(addr) ld_le32(addr)
71
72/* The same, but do the conversion in situ, ie. put the value back to addr. */
73#define __arch__swab16s(addr) st_le16(addr,*addr)
74#define __arch__swab32s(addr) st_le32(addr,*addr)
75
76#endif /* __KERNEL__ */
77
78#ifndef __STRICT_ANSI__
79#define __BYTEORDER_HAS_U64__
80#ifndef __powerpc64__
81#define __SWAB_64_THRU_32__
82#endif /* __powerpc64__ */
83#endif /* __STRICT_ANSI__ */
84
85#endif /* __GNUC__ */
86
87#include <linux/byteorder/big_endian.h>
88
89#endif /* _ASM_POWERPC_BYTEORDER_H */
diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h
new file mode 100644
index 000000000000..81de6eb3455d
--- /dev/null
+++ b/arch/powerpc/include/asm/cache.h
@@ -0,0 +1,45 @@
1#ifndef _ASM_POWERPC_CACHE_H
2#define _ASM_POWERPC_CACHE_H
3
4#ifdef __KERNEL__
5
6
7/* bytes per L1 cache line */
8#if defined(CONFIG_8xx) || defined(CONFIG_403GCX)
9#define L1_CACHE_SHIFT 4
10#define MAX_COPY_PREFETCH 1
11#elif defined(CONFIG_PPC_E500MC)
12#define L1_CACHE_SHIFT 6
13#define MAX_COPY_PREFETCH 4
14#elif defined(CONFIG_PPC32)
15#define L1_CACHE_SHIFT 5
16#define MAX_COPY_PREFETCH 4
17#else /* CONFIG_PPC64 */
18#define L1_CACHE_SHIFT 7
19#endif
20
21#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
22
23#define SMP_CACHE_BYTES L1_CACHE_BYTES
24
25#if defined(__powerpc64__) && !defined(__ASSEMBLY__)
26struct ppc64_caches {
27 u32 dsize; /* L1 d-cache size */
28 u32 dline_size; /* L1 d-cache line size */
29 u32 log_dline_size;
30 u32 dlines_per_page;
31 u32 isize; /* L1 i-cache size */
32 u32 iline_size; /* L1 i-cache line size */
33 u32 log_iline_size;
34 u32 ilines_per_page;
35};
36
37extern struct ppc64_caches ppc64_caches;
38#endif /* __powerpc64__ && ! __ASSEMBLY__ */
39
40#if !defined(__ASSEMBLY__)
41#define __read_mostly __attribute__((__section__(".data.read_mostly")))
42#endif
43
44#endif /* __KERNEL__ */
45#endif /* _ASM_POWERPC_CACHE_H */
diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
new file mode 100644
index 000000000000..ba667a383b8c
--- /dev/null
+++ b/arch/powerpc/include/asm/cacheflush.h
@@ -0,0 +1,75 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version
5 * 2 of the License, or (at your option) any later version.
6 */
7#ifndef _ASM_POWERPC_CACHEFLUSH_H
8#define _ASM_POWERPC_CACHEFLUSH_H
9
10#ifdef __KERNEL__
11
12#include <linux/mm.h>
13#include <asm/cputable.h>
14
15/*
16 * No cache flushing is required when address mappings are changed,
17 * because the caches on PowerPCs are physically addressed.
18 */
19#define flush_cache_all() do { } while (0)
20#define flush_cache_mm(mm) do { } while (0)
21#define flush_cache_dup_mm(mm) do { } while (0)
22#define flush_cache_range(vma, start, end) do { } while (0)
23#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
24#define flush_icache_page(vma, page) do { } while (0)
25#define flush_cache_vmap(start, end) do { } while (0)
26#define flush_cache_vunmap(start, end) do { } while (0)
27
28extern void flush_dcache_page(struct page *page);
29#define flush_dcache_mmap_lock(mapping) do { } while (0)
30#define flush_dcache_mmap_unlock(mapping) do { } while (0)
31
32extern void __flush_icache_range(unsigned long, unsigned long);
33static inline void flush_icache_range(unsigned long start, unsigned long stop)
34{
35 if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
36 __flush_icache_range(start, stop);
37}
38
39extern void flush_icache_user_range(struct vm_area_struct *vma,
40 struct page *page, unsigned long addr,
41 int len);
42extern void __flush_dcache_icache(void *page_va);
43extern void flush_dcache_icache_page(struct page *page);
44#if defined(CONFIG_PPC32) && !defined(CONFIG_BOOKE)
45extern void __flush_dcache_icache_phys(unsigned long physaddr);
46#endif /* CONFIG_PPC32 && !CONFIG_BOOKE */
47
48extern void flush_dcache_range(unsigned long start, unsigned long stop);
49#ifdef CONFIG_PPC32
50extern void clean_dcache_range(unsigned long start, unsigned long stop);
51extern void invalidate_dcache_range(unsigned long start, unsigned long stop);
52#endif /* CONFIG_PPC32 */
53#ifdef CONFIG_PPC64
54extern void flush_inval_dcache_range(unsigned long start, unsigned long stop);
55extern void flush_dcache_phys_range(unsigned long start, unsigned long stop);
56#endif
57
58#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
59 do { \
60 memcpy(dst, src, len); \
61 flush_icache_user_range(vma, page, vaddr, len); \
62 } while (0)
63#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
64 memcpy(dst, src, len)
65
66
67
68#ifdef CONFIG_DEBUG_PAGEALLOC
69/* internal debugging function */
70void kernel_map_pages(struct page *page, int numpages, int enable);
71#endif
72
73#endif /* __KERNEL__ */
74
75#endif /* _ASM_POWERPC_CACHEFLUSH_H */
diff --git a/arch/powerpc/include/asm/cell-pmu.h b/arch/powerpc/include/asm/cell-pmu.h
new file mode 100644
index 000000000000..8066eede3a0c
--- /dev/null
+++ b/arch/powerpc/include/asm/cell-pmu.h
@@ -0,0 +1,105 @@
1/*
2 * Cell Broadband Engine Performance Monitor
3 *
4 * (C) Copyright IBM Corporation 2006
5 *
6 * Author:
7 * David Erb (djerb@us.ibm.com)
8 * Kevin Corry (kevcorry@us.ibm.com)
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#ifndef __ASM_CELL_PMU_H__
26#define __ASM_CELL_PMU_H__
27
28/* The Cell PMU has four hardware performance counters, which can be
29 * configured as four 32-bit counters or eight 16-bit counters.
30 */
31#define NR_PHYS_CTRS 4
32#define NR_CTRS (NR_PHYS_CTRS * 2)
33
34/* Macros for the pm_control register. */
35#define CBE_PM_16BIT_CTR(ctr) (1 << (24 - ((ctr) & (NR_PHYS_CTRS - 1))))
36#define CBE_PM_ENABLE_PERF_MON 0x80000000
37#define CBE_PM_STOP_AT_MAX 0x40000000
38#define CBE_PM_TRACE_MODE_GET(pm_control) (((pm_control) >> 28) & 0x3)
39#define CBE_PM_TRACE_MODE_SET(mode) (((mode) & 0x3) << 28)
40#define CBE_PM_COUNT_MODE_SET(count) (((count) & 0x3) << 18)
41#define CBE_PM_FREEZE_ALL_CTRS 0x00100000
42#define CBE_PM_ENABLE_EXT_TRACE 0x00008000
43
44/* Macros for the trace_address register. */
45#define CBE_PM_TRACE_BUF_FULL 0x00000800
46#define CBE_PM_TRACE_BUF_EMPTY 0x00000400
47#define CBE_PM_TRACE_BUF_DATA_COUNT(ta) ((ta) & 0x3ff)
48#define CBE_PM_TRACE_BUF_MAX_COUNT 0x400
49
50/* Macros for the pm07_control registers. */
51#define CBE_PM_CTR_INPUT_MUX(pm07_control) (((pm07_control) >> 26) & 0x3f)
52#define CBE_PM_CTR_INPUT_CONTROL 0x02000000
53#define CBE_PM_CTR_POLARITY 0x01000000
54#define CBE_PM_CTR_COUNT_CYCLES 0x00800000
55#define CBE_PM_CTR_ENABLE 0x00400000
56#define PM07_CTR_INPUT_MUX(x) (((x) & 0x3F) << 26)
57#define PM07_CTR_INPUT_CONTROL(x) (((x) & 1) << 25)
58#define PM07_CTR_POLARITY(x) (((x) & 1) << 24)
59#define PM07_CTR_COUNT_CYCLES(x) (((x) & 1) << 23)
60#define PM07_CTR_ENABLE(x) (((x) & 1) << 22)
61
62/* Macros for the pm_status register. */
63#define CBE_PM_CTR_OVERFLOW_INTR(ctr) (1 << (31 - ((ctr) & 7)))
64
65enum pm_reg_name {
66 group_control,
67 debug_bus_control,
68 trace_address,
69 ext_tr_timer,
70 pm_status,
71 pm_control,
72 pm_interval,
73 pm_start_stop,
74};
75
76/* Routines for reading/writing the PMU registers. */
77extern u32 cbe_read_phys_ctr(u32 cpu, u32 phys_ctr);
78extern void cbe_write_phys_ctr(u32 cpu, u32 phys_ctr, u32 val);
79extern u32 cbe_read_ctr(u32 cpu, u32 ctr);
80extern void cbe_write_ctr(u32 cpu, u32 ctr, u32 val);
81
82extern u32 cbe_read_pm07_control(u32 cpu, u32 ctr);
83extern void cbe_write_pm07_control(u32 cpu, u32 ctr, u32 val);
84extern u32 cbe_read_pm(u32 cpu, enum pm_reg_name reg);
85extern void cbe_write_pm(u32 cpu, enum pm_reg_name reg, u32 val);
86
87extern u32 cbe_get_ctr_size(u32 cpu, u32 phys_ctr);
88extern void cbe_set_ctr_size(u32 cpu, u32 phys_ctr, u32 ctr_size);
89
90extern void cbe_enable_pm(u32 cpu);
91extern void cbe_disable_pm(u32 cpu);
92
93extern void cbe_read_trace_buffer(u32 cpu, u64 *buf);
94
95extern void cbe_enable_pm_interrupts(u32 cpu, u32 thread, u32 mask);
96extern void cbe_disable_pm_interrupts(u32 cpu);
97extern u32 cbe_get_and_clear_pm_interrupts(u32 cpu);
98extern void cbe_sync_irq(int node);
99
100#define CBE_COUNT_SUPERVISOR_MODE 0
101#define CBE_COUNT_HYPERVISOR_MODE 1
102#define CBE_COUNT_PROBLEM_MODE 2
103#define CBE_COUNT_ALL_MODES 3
104
105#endif /* __ASM_CELL_PMU_H__ */
diff --git a/arch/powerpc/include/asm/cell-regs.h b/arch/powerpc/include/asm/cell-regs.h
new file mode 100644
index 000000000000..fd6fd00434ef
--- /dev/null
+++ b/arch/powerpc/include/asm/cell-regs.h
@@ -0,0 +1,315 @@
1/*
2 * cbe_regs.h
3 *
4 * This file is intended to hold the various register definitions for CBE
5 * on-chip system devices (memory controller, IO controller, etc...)
6 *
7 * (C) Copyright IBM Corporation 2001,2006
8 *
9 * Authors: Maximino Aguilar (maguilar@us.ibm.com)
10 * David J. Erb (djerb@us.ibm.com)
11 *
12 * (c) 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp.
13 */
14
15#ifndef CBE_REGS_H
16#define CBE_REGS_H
17
18#include <asm/cell-pmu.h>
19
20/*
21 *
22 * Some HID register definitions
23 *
24 */
25
26/* CBE specific HID0 bits */
27#define HID0_CBE_THERM_WAKEUP 0x0000020000000000ul
28#define HID0_CBE_SYSERR_WAKEUP 0x0000008000000000ul
29#define HID0_CBE_THERM_INT_EN 0x0000000400000000ul
30#define HID0_CBE_SYSERR_INT_EN 0x0000000200000000ul
31
32#define MAX_CBE 2
33
34/*
35 *
36 * Pervasive unit register definitions
37 *
38 */
39
40union spe_reg {
41 u64 val;
42 u8 spe[8];
43};
44
45union ppe_spe_reg {
46 u64 val;
47 struct {
48 u32 ppe;
49 u32 spe;
50 };
51};
52
53
54struct cbe_pmd_regs {
55 /* Debug Bus Control */
56 u64 pad_0x0000; /* 0x0000 */
57
58 u64 group_control; /* 0x0008 */
59
60 u8 pad_0x0010_0x00a8 [0x00a8 - 0x0010]; /* 0x0010 */
61
62 u64 debug_bus_control; /* 0x00a8 */
63
64 u8 pad_0x00b0_0x0100 [0x0100 - 0x00b0]; /* 0x00b0 */
65
66 u64 trace_aux_data; /* 0x0100 */
67 u64 trace_buffer_0_63; /* 0x0108 */
68 u64 trace_buffer_64_127; /* 0x0110 */
69 u64 trace_address; /* 0x0118 */
70 u64 ext_tr_timer; /* 0x0120 */
71
72 u8 pad_0x0128_0x0400 [0x0400 - 0x0128]; /* 0x0128 */
73
74 /* Performance Monitor */
75 u64 pm_status; /* 0x0400 */
76 u64 pm_control; /* 0x0408 */
77 u64 pm_interval; /* 0x0410 */
78 u64 pm_ctr[4]; /* 0x0418 */
79 u64 pm_start_stop; /* 0x0438 */
80 u64 pm07_control[8]; /* 0x0440 */
81
82 u8 pad_0x0480_0x0800 [0x0800 - 0x0480]; /* 0x0480 */
83
84 /* Thermal Sensor Registers */
85 union spe_reg ts_ctsr1; /* 0x0800 */
86 u64 ts_ctsr2; /* 0x0808 */
87 union spe_reg ts_mtsr1; /* 0x0810 */
88 u64 ts_mtsr2; /* 0x0818 */
89 union spe_reg ts_itr1; /* 0x0820 */
90 u64 ts_itr2; /* 0x0828 */
91 u64 ts_gitr; /* 0x0830 */
92 u64 ts_isr; /* 0x0838 */
93 u64 ts_imr; /* 0x0840 */
94 union spe_reg tm_cr1; /* 0x0848 */
95 u64 tm_cr2; /* 0x0850 */
96 u64 tm_simr; /* 0x0858 */
97 union ppe_spe_reg tm_tpr; /* 0x0860 */
98 union spe_reg tm_str1; /* 0x0868 */
99 u64 tm_str2; /* 0x0870 */
100 union ppe_spe_reg tm_tsr; /* 0x0878 */
101
102 /* Power Management */
103 u64 pmcr; /* 0x0880 */
104#define CBE_PMD_PAUSE_ZERO_CONTROL 0x10000
105 u64 pmsr; /* 0x0888 */
106
107 /* Time Base Register */
108 u64 tbr; /* 0x0890 */
109
110 u8 pad_0x0898_0x0c00 [0x0c00 - 0x0898]; /* 0x0898 */
111
112 /* Fault Isolation Registers */
113 u64 checkstop_fir; /* 0x0c00 */
114 u64 recoverable_fir; /* 0x0c08 */
115 u64 spec_att_mchk_fir; /* 0x0c10 */
116 u32 fir_mode_reg; /* 0x0c18 */
117 u8 pad_0x0c1c_0x0c20 [4]; /* 0x0c1c */
118#define CBE_PMD_FIR_MODE_M8 0x00800
119 u64 fir_enable_mask; /* 0x0c20 */
120
121 u8 pad_0x0c28_0x0ca8 [0x0ca8 - 0x0c28]; /* 0x0c28 */
122 u64 ras_esc_0; /* 0x0ca8 */
123 u8 pad_0x0cb0_0x1000 [0x1000 - 0x0cb0]; /* 0x0cb0 */
124};
125
126extern struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np);
127extern struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu);
128
129/*
130 * PMU shadow registers
131 *
132 * Many of the registers in the performance monitoring unit are write-only,
133 * so we need to save a copy of what we write to those registers.
134 *
135 * The actual data counters are read/write. However, writing to the counters
136 * only takes effect if the PMU is enabled. Otherwise the value is stored in
137 * a hardware latch until the next time the PMU is enabled. So we save a copy
138 * of the counter values if we need to read them back while the PMU is
139 * disabled. The counter_value_in_latch field is a bitmap indicating which
140 * counters currently have a value waiting to be written.
141 */
142
143struct cbe_pmd_shadow_regs {
144 u32 group_control;
145 u32 debug_bus_control;
146 u32 trace_address;
147 u32 ext_tr_timer;
148 u32 pm_status;
149 u32 pm_control;
150 u32 pm_interval;
151 u32 pm_start_stop;
152 u32 pm07_control[NR_CTRS];
153
154 u32 pm_ctr[NR_PHYS_CTRS];
155 u32 counter_value_in_latch;
156};
157
158extern struct cbe_pmd_shadow_regs *cbe_get_pmd_shadow_regs(struct device_node *np);
159extern struct cbe_pmd_shadow_regs *cbe_get_cpu_pmd_shadow_regs(int cpu);
160
161/*
162 *
163 * IIC unit register definitions
164 *
165 */
166
167struct cbe_iic_pending_bits {
168 u32 data;
169 u8 flags;
170 u8 class;
171 u8 source;
172 u8 prio;
173};
174
175#define CBE_IIC_IRQ_VALID 0x80
176#define CBE_IIC_IRQ_IPI 0x40
177
178struct cbe_iic_thread_regs {
179 struct cbe_iic_pending_bits pending;
180 struct cbe_iic_pending_bits pending_destr;
181 u64 generate;
182 u64 prio;
183};
184
185struct cbe_iic_regs {
186 u8 pad_0x0000_0x0400[0x0400 - 0x0000]; /* 0x0000 */
187
188 /* IIC interrupt registers */
189 struct cbe_iic_thread_regs thread[2]; /* 0x0400 */
190
191 u64 iic_ir; /* 0x0440 */
192#define CBE_IIC_IR_PRIO(x) (((x) & 0xf) << 12)
193#define CBE_IIC_IR_DEST_NODE(x) (((x) & 0xf) << 4)
194#define CBE_IIC_IR_DEST_UNIT(x) ((x) & 0xf)
195#define CBE_IIC_IR_IOC_0 0x0
196#define CBE_IIC_IR_IOC_1S 0xb
197#define CBE_IIC_IR_PT_0 0xe
198#define CBE_IIC_IR_PT_1 0xf
199
200 u64 iic_is; /* 0x0448 */
201#define CBE_IIC_IS_PMI 0x2
202
203 u8 pad_0x0450_0x0500[0x0500 - 0x0450]; /* 0x0450 */
204
205 /* IOC FIR */
206 u64 ioc_fir_reset; /* 0x0500 */
207 u64 ioc_fir_set; /* 0x0508 */
208 u64 ioc_checkstop_enable; /* 0x0510 */
209 u64 ioc_fir_error_mask; /* 0x0518 */
210 u64 ioc_syserr_enable; /* 0x0520 */
211 u64 ioc_fir; /* 0x0528 */
212
213 u8 pad_0x0530_0x1000[0x1000 - 0x0530]; /* 0x0530 */
214};
215
216extern struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np);
217extern struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu);
218
219
220struct cbe_mic_tm_regs {
221 u8 pad_0x0000_0x0040[0x0040 - 0x0000]; /* 0x0000 */
222
223 u64 mic_ctl_cnfg2; /* 0x0040 */
224#define CBE_MIC_ENABLE_AUX_TRC 0x8000000000000000LL
225#define CBE_MIC_DISABLE_PWR_SAV_2 0x0200000000000000LL
226#define CBE_MIC_DISABLE_AUX_TRC_WRAP 0x0100000000000000LL
227#define CBE_MIC_ENABLE_AUX_TRC_INT 0x0080000000000000LL
228
229 u64 pad_0x0048; /* 0x0048 */
230
231 u64 mic_aux_trc_base; /* 0x0050 */
232 u64 mic_aux_trc_max_addr; /* 0x0058 */
233 u64 mic_aux_trc_cur_addr; /* 0x0060 */
234 u64 mic_aux_trc_grf_addr; /* 0x0068 */
235 u64 mic_aux_trc_grf_data; /* 0x0070 */
236
237 u64 pad_0x0078; /* 0x0078 */
238
239 u64 mic_ctl_cnfg_0; /* 0x0080 */
240#define CBE_MIC_DISABLE_PWR_SAV_0 0x8000000000000000LL
241
242 u64 pad_0x0088; /* 0x0088 */
243
244 u64 slow_fast_timer_0; /* 0x0090 */
245 u64 slow_next_timer_0; /* 0x0098 */
246
247 u8 pad_0x00a0_0x00f8[0x00f8 - 0x00a0]; /* 0x00a0 */
248 u64 mic_df_ecc_address_0; /* 0x00f8 */
249
250 u8 pad_0x0100_0x01b8[0x01b8 - 0x0100]; /* 0x0100 */
251 u64 mic_df_ecc_address_1; /* 0x01b8 */
252
253 u64 mic_ctl_cnfg_1; /* 0x01c0 */
254#define CBE_MIC_DISABLE_PWR_SAV_1 0x8000000000000000LL
255
256 u64 pad_0x01c8; /* 0x01c8 */
257
258 u64 slow_fast_timer_1; /* 0x01d0 */
259 u64 slow_next_timer_1; /* 0x01d8 */
260
261 u8 pad_0x01e0_0x0208[0x0208 - 0x01e0]; /* 0x01e0 */
262 u64 mic_exc; /* 0x0208 */
263#define CBE_MIC_EXC_BLOCK_SCRUB 0x0800000000000000ULL
264#define CBE_MIC_EXC_FAST_SCRUB 0x0100000000000000ULL
265
266 u64 mic_mnt_cfg; /* 0x0210 */
267#define CBE_MIC_MNT_CFG_CHAN_0_POP 0x0002000000000000ULL
268#define CBE_MIC_MNT_CFG_CHAN_1_POP 0x0004000000000000ULL
269
270 u64 mic_df_config; /* 0x0218 */
271#define CBE_MIC_ECC_DISABLE_0 0x4000000000000000ULL
272#define CBE_MIC_ECC_REP_SINGLE_0 0x2000000000000000ULL
273#define CBE_MIC_ECC_DISABLE_1 0x0080000000000000ULL
274#define CBE_MIC_ECC_REP_SINGLE_1 0x0040000000000000ULL
275
276 u8 pad_0x0220_0x0230[0x0230 - 0x0220]; /* 0x0220 */
277 u64 mic_fir; /* 0x0230 */
278#define CBE_MIC_FIR_ECC_SINGLE_0_ERR 0x0200000000000000ULL
279#define CBE_MIC_FIR_ECC_MULTI_0_ERR 0x0100000000000000ULL
280#define CBE_MIC_FIR_ECC_SINGLE_1_ERR 0x0080000000000000ULL
281#define CBE_MIC_FIR_ECC_MULTI_1_ERR 0x0040000000000000ULL
282#define CBE_MIC_FIR_ECC_ERR_MASK 0xffff000000000000ULL
283#define CBE_MIC_FIR_ECC_SINGLE_0_CTE 0x0000020000000000ULL
284#define CBE_MIC_FIR_ECC_MULTI_0_CTE 0x0000010000000000ULL
285#define CBE_MIC_FIR_ECC_SINGLE_1_CTE 0x0000008000000000ULL
286#define CBE_MIC_FIR_ECC_MULTI_1_CTE 0x0000004000000000ULL
287#define CBE_MIC_FIR_ECC_CTE_MASK 0x0000ffff00000000ULL
288#define CBE_MIC_FIR_ECC_SINGLE_0_RESET 0x0000000002000000ULL
289#define CBE_MIC_FIR_ECC_MULTI_0_RESET 0x0000000001000000ULL
290#define CBE_MIC_FIR_ECC_SINGLE_1_RESET 0x0000000000800000ULL
291#define CBE_MIC_FIR_ECC_MULTI_1_RESET 0x0000000000400000ULL
292#define CBE_MIC_FIR_ECC_RESET_MASK 0x00000000ffff0000ULL
293#define CBE_MIC_FIR_ECC_SINGLE_0_SET 0x0000000000000200ULL
294#define CBE_MIC_FIR_ECC_MULTI_0_SET 0x0000000000000100ULL
295#define CBE_MIC_FIR_ECC_SINGLE_1_SET 0x0000000000000080ULL
296#define CBE_MIC_FIR_ECC_MULTI_1_SET 0x0000000000000040ULL
297#define CBE_MIC_FIR_ECC_SET_MASK 0x000000000000ffffULL
298 u64 mic_fir_debug; /* 0x0238 */
299
300 u8 pad_0x0240_0x1000[0x1000 - 0x0240]; /* 0x0240 */
301};
302
303extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np);
304extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu);
305
306/* some utility functions to deal with SMT */
307extern u32 cbe_get_hw_thread_id(int cpu);
308extern u32 cbe_cpu_to_node(int cpu);
309extern u32 cbe_node_to_cpu(int node);
310
311/* Init this module early */
312extern void cbe_regs_init(void);
313
314
315#endif /* CBE_REGS_H */
diff --git a/arch/powerpc/include/asm/checksum.h b/arch/powerpc/include/asm/checksum.h
new file mode 100644
index 000000000000..7cdf358337cf
--- /dev/null
+++ b/arch/powerpc/include/asm/checksum.h
@@ -0,0 +1,117 @@
1#ifndef _ASM_POWERPC_CHECKSUM_H
2#define _ASM_POWERPC_CHECKSUM_H
3#ifdef __KERNEL__
4
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 * This is a version of ip_compute_csum() optimized for IP headers,
14 * which always checksum on 4 octet boundaries. ihl is the number
15 * of 32-bit words and is always >= 5.
16 */
17extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
18
19/*
20 * computes the checksum of the TCP/UDP pseudo-header
21 * returns a 16-bit checksum, already complemented
22 */
23extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
24 unsigned short len,
25 unsigned short proto,
26 __wsum sum);
27
28/*
29 * computes the checksum of a memory block at buff, length len,
30 * and adds in "sum" (32-bit)
31 *
32 * returns a 32-bit number suitable for feeding into itself
33 * or csum_tcpudp_magic
34 *
35 * this function must be called with even lengths, except
36 * for the last fragment, which may be odd
37 *
38 * it's best to have buff aligned on a 32-bit boundary
39 */
40extern __wsum csum_partial(const void *buff, int len, __wsum sum);
41
42/*
43 * Computes the checksum of a memory block at src, length len,
44 * and adds in "sum" (32-bit), while copying the block to dst.
45 * If an access exception occurs on src or dst, it stores -EFAULT
46 * to *src_err or *dst_err respectively (if that pointer is not
47 * NULL), and, for an error on src, zeroes the rest of dst.
48 *
49 * Like csum_partial, this must be called with even lengths,
50 * except for the last fragment.
51 */
52extern __wsum csum_partial_copy_generic(const void *src, void *dst,
53 int len, __wsum sum,
54 int *src_err, int *dst_err);
55/*
56 * the same as csum_partial, but copies from src to dst while it
57 * checksums.
58 */
59#define csum_partial_copy_from_user(src, dst, len, sum, errp) \
60 csum_partial_copy_generic((__force const void *)(src), (dst), (len), (sum), (errp), NULL)
61
62#define csum_partial_copy_nocheck(src, dst, len, sum) \
63 csum_partial_copy_generic((src), (dst), (len), (sum), NULL, NULL)
64
65
66/*
67 * turns a 32-bit partial checksum (e.g. from csum_partial) into a
68 * 1's complement 16-bit checksum.
69 */
70static inline __sum16 csum_fold(__wsum sum)
71{
72 unsigned int tmp;
73
74 /* swap the two 16-bit halves of sum */
75 __asm__("rlwinm %0,%1,16,0,31" : "=r" (tmp) : "r" (sum));
76 /* if there is a carry from adding the two 16-bit halves,
77 it will carry from the lower half into the upper half,
78 giving us the correct sum in the upper half. */
79 return (__force __sum16)(~((__force u32)sum + tmp) >> 16);
80}
81
82/*
83 * this routine is used for miscellaneous IP-like checksums, mainly
84 * in icmp.c
85 */
86static inline __sum16 ip_compute_csum(const void *buff, int len)
87{
88 return csum_fold(csum_partial(buff, len, 0));
89}
90
91static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
92 unsigned short len,
93 unsigned short proto,
94 __wsum sum)
95{
96#ifdef __powerpc64__
97 unsigned long s = (__force u32)sum;
98
99 s += (__force u32)saddr;
100 s += (__force u32)daddr;
101 s += proto + len;
102 s += (s >> 32);
103 return (__force __wsum) s;
104#else
105 __asm__("\n\
106 addc %0,%0,%1 \n\
107 adde %0,%0,%2 \n\
108 adde %0,%0,%3 \n\
109 addze %0,%0 \n\
110 "
111 : "=r" (sum)
112 : "r" (daddr), "r"(saddr), "r"(proto + len), "0"(sum));
113 return sum;
114#endif
115}
116#endif /* __KERNEL__ */
117#endif
diff --git a/arch/powerpc/include/asm/clk_interface.h b/arch/powerpc/include/asm/clk_interface.h
new file mode 100644
index 000000000000..ab1882c1e176
--- /dev/null
+++ b/arch/powerpc/include/asm/clk_interface.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_POWERPC_CLK_INTERFACE_H
2#define __ASM_POWERPC_CLK_INTERFACE_H
3
4#include <linux/clk.h>
5
6struct clk_interface {
7 struct clk* (*clk_get) (struct device *dev, const char *id);
8 int (*clk_enable) (struct clk *clk);
9 void (*clk_disable) (struct clk *clk);
10 unsigned long (*clk_get_rate) (struct clk *clk);
11 void (*clk_put) (struct clk *clk);
12 long (*clk_round_rate) (struct clk *clk, unsigned long rate);
13 int (*clk_set_rate) (struct clk *clk, unsigned long rate);
14 int (*clk_set_parent) (struct clk *clk, struct clk *parent);
15 struct clk* (*clk_get_parent) (struct clk *clk);
16};
17
18extern struct clk_interface clk_functions;
19
20#endif /* __ASM_POWERPC_CLK_INTERFACE_H */
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
new file mode 100644
index 000000000000..107d9b915e33
--- /dev/null
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -0,0 +1,54 @@
1#ifndef _ASM_POWERPC_CODE_PATCHING_H
2#define _ASM_POWERPC_CODE_PATCHING_H
3
4/*
5 * Copyright 2008, Michael Ellerman, IBM Corporation.
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/types.h>
14
15#define PPC_NOP_INSTR 0x60000000
16#define PPC_LWSYNC_INSTR 0x7c2004ac
17
18/* Flags for create_branch:
19 * "b" == create_branch(addr, target, 0);
20 * "ba" == create_branch(addr, target, BRANCH_ABSOLUTE);
21 * "bl" == create_branch(addr, target, BRANCH_SET_LINK);
22 * "bla" == create_branch(addr, target, BRANCH_ABSOLUTE | BRANCH_SET_LINK);
23 */
24#define BRANCH_SET_LINK 0x1
25#define BRANCH_ABSOLUTE 0x2
26
27unsigned int create_branch(const unsigned int *addr,
28 unsigned long target, int flags);
29unsigned int create_cond_branch(const unsigned int *addr,
30 unsigned long target, int flags);
31void patch_branch(unsigned int *addr, unsigned long target, int flags);
32void patch_instruction(unsigned int *addr, unsigned int instr);
33
34int instr_is_relative_branch(unsigned int instr);
35int instr_is_branch_to_addr(const unsigned int *instr, unsigned long addr);
36unsigned long branch_target(const unsigned int *instr);
37unsigned int translate_branch(const unsigned int *dest,
38 const unsigned int *src);
39
40static inline unsigned long ppc_function_entry(void *func)
41{
42#ifdef CONFIG_PPC64
43 /*
44 * On PPC64 the function pointer actually points to the function's
45 * descriptor. The first entry in the descriptor is the address
46 * of the function text.
47 */
48 return ((func_descr_t *)func)->entry;
49#else
50 return (unsigned long)func;
51#endif
52}
53
54#endif /* _ASM_POWERPC_CODE_PATCHING_H */
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
new file mode 100644
index 000000000000..d811a8cd7b58
--- /dev/null
+++ b/arch/powerpc/include/asm/compat.h
@@ -0,0 +1,214 @@
1#ifndef _ASM_POWERPC_COMPAT_H
2#define _ASM_POWERPC_COMPAT_H
3#ifdef __KERNEL__
4/*
5 * Architecture specific compatibility types
6 */
7#include <linux/types.h>
8#include <linux/sched.h>
9
10#define COMPAT_USER_HZ 100
11
12typedef u32 compat_size_t;
13typedef s32 compat_ssize_t;
14typedef s32 compat_time_t;
15typedef s32 compat_clock_t;
16typedef s32 compat_pid_t;
17typedef u32 __compat_uid_t;
18typedef u32 __compat_gid_t;
19typedef u32 __compat_uid32_t;
20typedef u32 __compat_gid32_t;
21typedef u32 compat_mode_t;
22typedef u32 compat_ino_t;
23typedef u32 compat_dev_t;
24typedef s32 compat_off_t;
25typedef s64 compat_loff_t;
26typedef s16 compat_nlink_t;
27typedef u16 compat_ipc_pid_t;
28typedef s32 compat_daddr_t;
29typedef u32 compat_caddr_t;
30typedef __kernel_fsid_t compat_fsid_t;
31typedef s32 compat_key_t;
32typedef s32 compat_timer_t;
33
34typedef s32 compat_int_t;
35typedef s32 compat_long_t;
36typedef s64 compat_s64;
37typedef u32 compat_uint_t;
38typedef u32 compat_ulong_t;
39typedef u64 compat_u64;
40
41struct compat_timespec {
42 compat_time_t tv_sec;
43 s32 tv_nsec;
44};
45
46struct compat_timeval {
47 compat_time_t tv_sec;
48 s32 tv_usec;
49};
50
51struct compat_stat {
52 compat_dev_t st_dev;
53 compat_ino_t st_ino;
54 compat_mode_t st_mode;
55 compat_nlink_t st_nlink;
56 __compat_uid32_t st_uid;
57 __compat_gid32_t st_gid;
58 compat_dev_t st_rdev;
59 compat_off_t st_size;
60 compat_off_t st_blksize;
61 compat_off_t st_blocks;
62 compat_time_t st_atime;
63 u32 st_atime_nsec;
64 compat_time_t st_mtime;
65 u32 st_mtime_nsec;
66 compat_time_t st_ctime;
67 u32 st_ctime_nsec;
68 u32 __unused4[2];
69};
70
71struct compat_flock {
72 short l_type;
73 short l_whence;
74 compat_off_t l_start;
75 compat_off_t l_len;
76 compat_pid_t l_pid;
77};
78
79#define F_GETLK64 12 /* using 'struct flock64' */
80#define F_SETLK64 13
81#define F_SETLKW64 14
82
83struct compat_flock64 {
84 short l_type;
85 short l_whence;
86 compat_loff_t l_start;
87 compat_loff_t l_len;
88 compat_pid_t l_pid;
89};
90
91struct compat_statfs {
92 int f_type;
93 int f_bsize;
94 int f_blocks;
95 int f_bfree;
96 int f_bavail;
97 int f_files;
98 int f_ffree;
99 compat_fsid_t f_fsid;
100 int f_namelen; /* SunOS ignores this field. */
101 int f_frsize;
102 int f_spare[5];
103};
104
105#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
106#define COMPAT_RLIM_INFINITY 0xffffffff
107
108typedef u32 compat_old_sigset_t;
109
110#define _COMPAT_NSIG 64
111#define _COMPAT_NSIG_BPW 32
112
113typedef u32 compat_sigset_word;
114
115#define COMPAT_OFF_T_MAX 0x7fffffff
116#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
117
118/*
119 * A pointer passed in from user mode. This should not
120 * be used for syscall parameters, just declare them
121 * as pointers because the syscall entry code will have
122 * appropriately converted them already.
123 */
124typedef u32 compat_uptr_t;
125
126static inline void __user *compat_ptr(compat_uptr_t uptr)
127{
128 return (void __user *)(unsigned long)uptr;
129}
130
131static inline compat_uptr_t ptr_to_compat(void __user *uptr)
132{
133 return (u32)(unsigned long)uptr;
134}
135
136static inline void __user *compat_alloc_user_space(long len)
137{
138 struct pt_regs *regs = current->thread.regs;
139 unsigned long usp = regs->gpr[1];
140
141 /*
142 * We cant access below the stack pointer in the 32bit ABI and
143 * can access 288 bytes in the 64bit ABI
144 */
145 if (!(test_thread_flag(TIF_32BIT)))
146 usp -= 288;
147
148 return (void __user *) (usp - len);
149}
150
151/*
152 * ipc64_perm is actually 32/64bit clean but since the compat layer refers to
153 * it we may as well define it.
154 */
155struct compat_ipc64_perm {
156 compat_key_t key;
157 __compat_uid_t uid;
158 __compat_gid_t gid;
159 __compat_uid_t cuid;
160 __compat_gid_t cgid;
161 compat_mode_t mode;
162 unsigned int seq;
163 unsigned int __pad2;
164 unsigned long __unused1; /* yes they really are 64bit pads */
165 unsigned long __unused2;
166};
167
168struct compat_semid64_ds {
169 struct compat_ipc64_perm sem_perm;
170 unsigned int __unused1;
171 compat_time_t sem_otime;
172 unsigned int __unused2;
173 compat_time_t sem_ctime;
174 compat_ulong_t sem_nsems;
175 compat_ulong_t __unused3;
176 compat_ulong_t __unused4;
177};
178
179struct compat_msqid64_ds {
180 struct compat_ipc64_perm msg_perm;
181 unsigned int __unused1;
182 compat_time_t msg_stime;
183 unsigned int __unused2;
184 compat_time_t msg_rtime;
185 unsigned int __unused3;
186 compat_time_t msg_ctime;
187 compat_ulong_t msg_cbytes;
188 compat_ulong_t msg_qnum;
189 compat_ulong_t msg_qbytes;
190 compat_pid_t msg_lspid;
191 compat_pid_t msg_lrpid;
192 compat_ulong_t __unused4;
193 compat_ulong_t __unused5;
194};
195
196struct compat_shmid64_ds {
197 struct compat_ipc64_perm shm_perm;
198 unsigned int __unused1;
199 compat_time_t shm_atime;
200 unsigned int __unused2;
201 compat_time_t shm_dtime;
202 unsigned int __unused3;
203 compat_time_t shm_ctime;
204 unsigned int __unused4;
205 compat_size_t shm_segsz;
206 compat_pid_t shm_cpid;
207 compat_pid_t shm_lpid;
208 compat_ulong_t shm_nattch;
209 compat_ulong_t __unused5;
210 compat_ulong_t __unused6;
211};
212
213#endif /* __KERNEL__ */
214#endif /* _ASM_POWERPC_COMPAT_H */
diff --git a/arch/powerpc/include/asm/cpm.h b/arch/powerpc/include/asm/cpm.h
new file mode 100644
index 000000000000..24d79e3abd8e
--- /dev/null
+++ b/arch/powerpc/include/asm/cpm.h
@@ -0,0 +1,106 @@
1#ifndef __CPM_H
2#define __CPM_H
3
4#include <linux/compiler.h>
5#include <linux/types.h>
6#include <linux/of.h>
7
8/* Opcodes common to CPM1 and CPM2
9*/
10#define CPM_CR_INIT_TRX ((ushort)0x0000)
11#define CPM_CR_INIT_RX ((ushort)0x0001)
12#define CPM_CR_INIT_TX ((ushort)0x0002)
13#define CPM_CR_HUNT_MODE ((ushort)0x0003)
14#define CPM_CR_STOP_TX ((ushort)0x0004)
15#define CPM_CR_GRA_STOP_TX ((ushort)0x0005)
16#define CPM_CR_RESTART_TX ((ushort)0x0006)
17#define CPM_CR_CLOSE_RX_BD ((ushort)0x0007)
18#define CPM_CR_SET_GADDR ((ushort)0x0008)
19#define CPM_CR_SET_TIMER ((ushort)0x0008)
20#define CPM_CR_STOP_IDMA ((ushort)0x000b)
21
22/* Buffer descriptors used by many of the CPM protocols. */
23typedef struct cpm_buf_desc {
24 ushort cbd_sc; /* Status and Control */
25 ushort cbd_datlen; /* Data length in buffer */
26 uint cbd_bufaddr; /* Buffer address in host memory */
27} cbd_t;
28
29/* Buffer descriptor control/status used by serial
30 */
31
32#define BD_SC_EMPTY (0x8000) /* Receive is empty */
33#define BD_SC_READY (0x8000) /* Transmit is ready */
34#define BD_SC_WRAP (0x2000) /* Last buffer descriptor */
35#define BD_SC_INTRPT (0x1000) /* Interrupt on change */
36#define BD_SC_LAST (0x0800) /* Last buffer in frame */
37#define BD_SC_TC (0x0400) /* Transmit CRC */
38#define BD_SC_CM (0x0200) /* Continous mode */
39#define BD_SC_ID (0x0100) /* Rec'd too many idles */
40#define BD_SC_P (0x0100) /* xmt preamble */
41#define BD_SC_BR (0x0020) /* Break received */
42#define BD_SC_FR (0x0010) /* Framing error */
43#define BD_SC_PR (0x0008) /* Parity error */
44#define BD_SC_NAK (0x0004) /* NAK - did not respond */
45#define BD_SC_OV (0x0002) /* Overrun */
46#define BD_SC_UN (0x0002) /* Underrun */
47#define BD_SC_CD (0x0001) /* */
48#define BD_SC_CL (0x0001) /* Collision */
49
50/* Buffer descriptor control/status used by Ethernet receive.
51 * Common to SCC and FCC.
52 */
53#define BD_ENET_RX_EMPTY (0x8000)
54#define BD_ENET_RX_WRAP (0x2000)
55#define BD_ENET_RX_INTR (0x1000)
56#define BD_ENET_RX_LAST (0x0800)
57#define BD_ENET_RX_FIRST (0x0400)
58#define BD_ENET_RX_MISS (0x0100)
59#define BD_ENET_RX_BC (0x0080) /* FCC Only */
60#define BD_ENET_RX_MC (0x0040) /* FCC Only */
61#define BD_ENET_RX_LG (0x0020)
62#define BD_ENET_RX_NO (0x0010)
63#define BD_ENET_RX_SH (0x0008)
64#define BD_ENET_RX_CR (0x0004)
65#define BD_ENET_RX_OV (0x0002)
66#define BD_ENET_RX_CL (0x0001)
67#define BD_ENET_RX_STATS (0x01ff) /* All status bits */
68
69/* Buffer descriptor control/status used by Ethernet transmit.
70 * Common to SCC and FCC.
71 */
72#define BD_ENET_TX_READY (0x8000)
73#define BD_ENET_TX_PAD (0x4000)
74#define BD_ENET_TX_WRAP (0x2000)
75#define BD_ENET_TX_INTR (0x1000)
76#define BD_ENET_TX_LAST (0x0800)
77#define BD_ENET_TX_TC (0x0400)
78#define BD_ENET_TX_DEF (0x0200)
79#define BD_ENET_TX_HB (0x0100)
80#define BD_ENET_TX_LC (0x0080)
81#define BD_ENET_TX_RL (0x0040)
82#define BD_ENET_TX_RCMASK (0x003c)
83#define BD_ENET_TX_UN (0x0002)
84#define BD_ENET_TX_CSL (0x0001)
85#define BD_ENET_TX_STATS (0x03ff) /* All status bits */
86
87/* Buffer descriptor control/status used by Transparent mode SCC.
88 */
89#define BD_SCC_TX_LAST (0x0800)
90
91/* Buffer descriptor control/status used by I2C.
92 */
93#define BD_I2C_START (0x0400)
94
95int cpm_muram_init(void);
96unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);
97int cpm_muram_free(unsigned long offset);
98unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size);
99void __iomem *cpm_muram_addr(unsigned long offset);
100unsigned long cpm_muram_offset(void __iomem *addr);
101dma_addr_t cpm_muram_dma(void __iomem *addr);
102int cpm_command(u32 command, u8 opcode);
103
104int cpm2_gpiochip_add32(struct device_node *np);
105
106#endif
diff --git a/arch/powerpc/include/asm/cpm1.h b/arch/powerpc/include/asm/cpm1.h
new file mode 100644
index 000000000000..2ff798744c1d
--- /dev/null
+++ b/arch/powerpc/include/asm/cpm1.h
@@ -0,0 +1,652 @@
1/*
2 * MPC8xx Communication Processor Module.
3 * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
4 *
5 * This file contains structures and information for the communication
6 * processor channels. Some CPM control and status is available
7 * throught the MPC8xx internal memory map. See immap.h for details.
8 * This file only contains what I need for the moment, not the total
9 * CPM capabilities. I (or someone else) will add definitions as they
10 * are needed. -- Dan
11 *
12 * On the MBX board, EPPC-Bug loads CPM microcode into the first 512
13 * bytes of the DP RAM and relocates the I2C parameter area to the
14 * IDMA1 space. The remaining DP RAM is available for buffer descriptors
15 * or other use.
16 */
17#ifndef __CPM1__
18#define __CPM1__
19
20#include <asm/8xx_immap.h>
21#include <asm/ptrace.h>
22#include <asm/cpm.h>
23
24/* CPM Command register.
25*/
26#define CPM_CR_RST ((ushort)0x8000)
27#define CPM_CR_OPCODE ((ushort)0x0f00)
28#define CPM_CR_CHAN ((ushort)0x00f0)
29#define CPM_CR_FLG ((ushort)0x0001)
30
31/* Channel numbers.
32*/
33#define CPM_CR_CH_SCC1 ((ushort)0x0000)
34#define CPM_CR_CH_I2C ((ushort)0x0001) /* I2C and IDMA1 */
35#define CPM_CR_CH_SCC2 ((ushort)0x0004)
36#define CPM_CR_CH_SPI ((ushort)0x0005) /* SPI / IDMA2 / Timers */
37#define CPM_CR_CH_TIMER CPM_CR_CH_SPI
38#define CPM_CR_CH_SCC3 ((ushort)0x0008)
39#define CPM_CR_CH_SMC1 ((ushort)0x0009) /* SMC1 / DSP1 */
40#define CPM_CR_CH_SCC4 ((ushort)0x000c)
41#define CPM_CR_CH_SMC2 ((ushort)0x000d) /* SMC2 / DSP2 */
42
43#define mk_cr_cmd(CH, CMD) ((CMD << 8) | (CH << 4))
44
45/* Export the base address of the communication processor registers
46 * and dual port ram.
47 */
48extern cpm8xx_t __iomem *cpmp; /* Pointer to comm processor */
49
50#define cpm_dpalloc cpm_muram_alloc
51#define cpm_dpfree cpm_muram_free
52#define cpm_dpram_addr cpm_muram_addr
53#define cpm_dpram_phys cpm_muram_dma
54
55extern void cpm_setbrg(uint brg, uint rate);
56
57extern void cpm_load_patch(cpm8xx_t *cp);
58
59extern void cpm_reset(void);
60
61/* Parameter RAM offsets.
62*/
63#define PROFF_SCC1 ((uint)0x0000)
64#define PROFF_IIC ((uint)0x0080)
65#define PROFF_SCC2 ((uint)0x0100)
66#define PROFF_SPI ((uint)0x0180)
67#define PROFF_SCC3 ((uint)0x0200)
68#define PROFF_SMC1 ((uint)0x0280)
69#define PROFF_SCC4 ((uint)0x0300)
70#define PROFF_SMC2 ((uint)0x0380)
71
72/* Define enough so I can at least use the serial port as a UART.
73 * The MBX uses SMC1 as the host serial port.
74 */
75typedef struct smc_uart {
76 ushort smc_rbase; /* Rx Buffer descriptor base address */
77 ushort smc_tbase; /* Tx Buffer descriptor base address */
78 u_char smc_rfcr; /* Rx function code */
79 u_char smc_tfcr; /* Tx function code */
80 ushort smc_mrblr; /* Max receive buffer length */
81 uint smc_rstate; /* Internal */
82 uint smc_idp; /* Internal */
83 ushort smc_rbptr; /* Internal */
84 ushort smc_ibc; /* Internal */
85 uint smc_rxtmp; /* Internal */
86 uint smc_tstate; /* Internal */
87 uint smc_tdp; /* Internal */
88 ushort smc_tbptr; /* Internal */
89 ushort smc_tbc; /* Internal */
90 uint smc_txtmp; /* Internal */
91 ushort smc_maxidl; /* Maximum idle characters */
92 ushort smc_tmpidl; /* Temporary idle counter */
93 ushort smc_brklen; /* Last received break length */
94 ushort smc_brkec; /* rcv'd break condition counter */
95 ushort smc_brkcr; /* xmt break count register */
96 ushort smc_rmask; /* Temporary bit mask */
97 char res1[8]; /* Reserved */
98 ushort smc_rpbase; /* Relocation pointer */
99} smc_uart_t;
100
101/* Function code bits.
102*/
103#define SMC_EB ((u_char)0x10) /* Set big endian byte order */
104
105/* SMC uart mode register.
106*/
107#define SMCMR_REN ((ushort)0x0001)
108#define SMCMR_TEN ((ushort)0x0002)
109#define SMCMR_DM ((ushort)0x000c)
110#define SMCMR_SM_GCI ((ushort)0x0000)
111#define SMCMR_SM_UART ((ushort)0x0020)
112#define SMCMR_SM_TRANS ((ushort)0x0030)
113#define SMCMR_SM_MASK ((ushort)0x0030)
114#define SMCMR_PM_EVEN ((ushort)0x0100) /* Even parity, else odd */
115#define SMCMR_REVD SMCMR_PM_EVEN
116#define SMCMR_PEN ((ushort)0x0200) /* Parity enable */
117#define SMCMR_BS SMCMR_PEN
118#define SMCMR_SL ((ushort)0x0400) /* Two stops, else one */
119#define SMCR_CLEN_MASK ((ushort)0x7800) /* Character length */
120#define smcr_mk_clen(C) (((C) << 11) & SMCR_CLEN_MASK)
121
122/* SMC2 as Centronics parallel printer. It is half duplex, in that
123 * it can only receive or transmit. The parameter ram values for
124 * each direction are either unique or properly overlap, so we can
125 * include them in one structure.
126 */
127typedef struct smc_centronics {
128 ushort scent_rbase;
129 ushort scent_tbase;
130 u_char scent_cfcr;
131 u_char scent_smask;
132 ushort scent_mrblr;
133 uint scent_rstate;
134 uint scent_r_ptr;
135 ushort scent_rbptr;
136 ushort scent_r_cnt;
137 uint scent_rtemp;
138 uint scent_tstate;
139 uint scent_t_ptr;
140 ushort scent_tbptr;
141 ushort scent_t_cnt;
142 uint scent_ttemp;
143 ushort scent_max_sl;
144 ushort scent_sl_cnt;
145 ushort scent_character1;
146 ushort scent_character2;
147 ushort scent_character3;
148 ushort scent_character4;
149 ushort scent_character5;
150 ushort scent_character6;
151 ushort scent_character7;
152 ushort scent_character8;
153 ushort scent_rccm;
154 ushort scent_rccr;
155} smc_cent_t;
156
157/* Centronics Status Mask Register.
158*/
159#define SMC_CENT_F ((u_char)0x08)
160#define SMC_CENT_PE ((u_char)0x04)
161#define SMC_CENT_S ((u_char)0x02)
162
163/* SMC Event and Mask register.
164*/
165#define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */
166#define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */
167#define SMCM_TXE ((unsigned char)0x10) /* When in Transparent Mode */
168#define SMCM_BSY ((unsigned char)0x04)
169#define SMCM_TX ((unsigned char)0x02)
170#define SMCM_RX ((unsigned char)0x01)
171
172/* Baud rate generators.
173*/
174#define CPM_BRG_RST ((uint)0x00020000)
175#define CPM_BRG_EN ((uint)0x00010000)
176#define CPM_BRG_EXTC_INT ((uint)0x00000000)
177#define CPM_BRG_EXTC_CLK2 ((uint)0x00004000)
178#define CPM_BRG_EXTC_CLK6 ((uint)0x00008000)
179#define CPM_BRG_ATB ((uint)0x00002000)
180#define CPM_BRG_CD_MASK ((uint)0x00001ffe)
181#define CPM_BRG_DIV16 ((uint)0x00000001)
182
183/* SI Clock Route Register
184*/
185#define SICR_RCLK_SCC1_BRG1 ((uint)0x00000000)
186#define SICR_TCLK_SCC1_BRG1 ((uint)0x00000000)
187#define SICR_RCLK_SCC2_BRG2 ((uint)0x00000800)
188#define SICR_TCLK_SCC2_BRG2 ((uint)0x00000100)
189#define SICR_RCLK_SCC3_BRG3 ((uint)0x00100000)
190#define SICR_TCLK_SCC3_BRG3 ((uint)0x00020000)
191#define SICR_RCLK_SCC4_BRG4 ((uint)0x18000000)
192#define SICR_TCLK_SCC4_BRG4 ((uint)0x03000000)
193
194/* SCCs.
195*/
196#define SCC_GSMRH_IRP ((uint)0x00040000)
197#define SCC_GSMRH_GDE ((uint)0x00010000)
198#define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000)
199#define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000)
200#define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000)
201#define SCC_GSMRH_REVD ((uint)0x00002000)
202#define SCC_GSMRH_TRX ((uint)0x00001000)
203#define SCC_GSMRH_TTX ((uint)0x00000800)
204#define SCC_GSMRH_CDP ((uint)0x00000400)
205#define SCC_GSMRH_CTSP ((uint)0x00000200)
206#define SCC_GSMRH_CDS ((uint)0x00000100)
207#define SCC_GSMRH_CTSS ((uint)0x00000080)
208#define SCC_GSMRH_TFL ((uint)0x00000040)
209#define SCC_GSMRH_RFW ((uint)0x00000020)
210#define SCC_GSMRH_TXSY ((uint)0x00000010)
211#define SCC_GSMRH_SYNL16 ((uint)0x0000000c)
212#define SCC_GSMRH_SYNL8 ((uint)0x00000008)
213#define SCC_GSMRH_SYNL4 ((uint)0x00000004)
214#define SCC_GSMRH_RTSM ((uint)0x00000002)
215#define SCC_GSMRH_RSYN ((uint)0x00000001)
216
217#define SCC_GSMRL_SIR ((uint)0x80000000) /* SCC2 only */
218#define SCC_GSMRL_EDGE_NONE ((uint)0x60000000)
219#define SCC_GSMRL_EDGE_NEG ((uint)0x40000000)
220#define SCC_GSMRL_EDGE_POS ((uint)0x20000000)
221#define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000)
222#define SCC_GSMRL_TCI ((uint)0x10000000)
223#define SCC_GSMRL_TSNC_3 ((uint)0x0c000000)
224#define SCC_GSMRL_TSNC_4 ((uint)0x08000000)
225#define SCC_GSMRL_TSNC_14 ((uint)0x04000000)
226#define SCC_GSMRL_TSNC_INF ((uint)0x00000000)
227#define SCC_GSMRL_RINV ((uint)0x02000000)
228#define SCC_GSMRL_TINV ((uint)0x01000000)
229#define SCC_GSMRL_TPL_128 ((uint)0x00c00000)
230#define SCC_GSMRL_TPL_64 ((uint)0x00a00000)
231#define SCC_GSMRL_TPL_48 ((uint)0x00800000)
232#define SCC_GSMRL_TPL_32 ((uint)0x00600000)
233#define SCC_GSMRL_TPL_16 ((uint)0x00400000)
234#define SCC_GSMRL_TPL_8 ((uint)0x00200000)
235#define SCC_GSMRL_TPL_NONE ((uint)0x00000000)
236#define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000)
237#define SCC_GSMRL_TPP_01 ((uint)0x00100000)
238#define SCC_GSMRL_TPP_10 ((uint)0x00080000)
239#define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000)
240#define SCC_GSMRL_TEND ((uint)0x00040000)
241#define SCC_GSMRL_TDCR_32 ((uint)0x00030000)
242#define SCC_GSMRL_TDCR_16 ((uint)0x00020000)
243#define SCC_GSMRL_TDCR_8 ((uint)0x00010000)
244#define SCC_GSMRL_TDCR_1 ((uint)0x00000000)
245#define SCC_GSMRL_RDCR_32 ((uint)0x0000c000)
246#define SCC_GSMRL_RDCR_16 ((uint)0x00008000)
247#define SCC_GSMRL_RDCR_8 ((uint)0x00004000)
248#define SCC_GSMRL_RDCR_1 ((uint)0x00000000)
249#define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000)
250#define SCC_GSMRL_RENC_MANCH ((uint)0x00002000)
251#define SCC_GSMRL_RENC_FM0 ((uint)0x00001000)
252#define SCC_GSMRL_RENC_NRZI ((uint)0x00000800)
253#define SCC_GSMRL_RENC_NRZ ((uint)0x00000000)
254#define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600)
255#define SCC_GSMRL_TENC_MANCH ((uint)0x00000400)
256#define SCC_GSMRL_TENC_FM0 ((uint)0x00000200)
257#define SCC_GSMRL_TENC_NRZI ((uint)0x00000100)
258#define SCC_GSMRL_TENC_NRZ ((uint)0x00000000)
259#define SCC_GSMRL_DIAG_LE ((uint)0x000000c0) /* Loop and echo */
260#define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080)
261#define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040)
262#define SCC_GSMRL_DIAG_NORM ((uint)0x00000000)
263#define SCC_GSMRL_ENR ((uint)0x00000020)
264#define SCC_GSMRL_ENT ((uint)0x00000010)
265#define SCC_GSMRL_MODE_ENET ((uint)0x0000000c)
266#define SCC_GSMRL_MODE_QMC ((uint)0x0000000a)
267#define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009)
268#define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008)
269#define SCC_GSMRL_MODE_V14 ((uint)0x00000007)
270#define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006)
271#define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005)
272#define SCC_GSMRL_MODE_UART ((uint)0x00000004)
273#define SCC_GSMRL_MODE_SS7 ((uint)0x00000003)
274#define SCC_GSMRL_MODE_ATALK ((uint)0x00000002)
275#define SCC_GSMRL_MODE_HDLC ((uint)0x00000000)
276
277#define SCC_TODR_TOD ((ushort)0x8000)
278
279/* SCC Event and Mask register.
280*/
281#define SCCM_TXE ((unsigned char)0x10)
282#define SCCM_BSY ((unsigned char)0x04)
283#define SCCM_TX ((unsigned char)0x02)
284#define SCCM_RX ((unsigned char)0x01)
285
286typedef struct scc_param {
287 ushort scc_rbase; /* Rx Buffer descriptor base address */
288 ushort scc_tbase; /* Tx Buffer descriptor base address */
289 u_char scc_rfcr; /* Rx function code */
290 u_char scc_tfcr; /* Tx function code */
291 ushort scc_mrblr; /* Max receive buffer length */
292 uint scc_rstate; /* Internal */
293 uint scc_idp; /* Internal */
294 ushort scc_rbptr; /* Internal */
295 ushort scc_ibc; /* Internal */
296 uint scc_rxtmp; /* Internal */
297 uint scc_tstate; /* Internal */
298 uint scc_tdp; /* Internal */
299 ushort scc_tbptr; /* Internal */
300 ushort scc_tbc; /* Internal */
301 uint scc_txtmp; /* Internal */
302 uint scc_rcrc; /* Internal */
303 uint scc_tcrc; /* Internal */
304} sccp_t;
305
306/* Function code bits.
307*/
308#define SCC_EB ((u_char)0x10) /* Set big endian byte order */
309
310/* CPM Ethernet through SCCx.
311 */
312typedef struct scc_enet {
313 sccp_t sen_genscc;
314 uint sen_cpres; /* Preset CRC */
315 uint sen_cmask; /* Constant mask for CRC */
316 uint sen_crcec; /* CRC Error counter */
317 uint sen_alec; /* alignment error counter */
318 uint sen_disfc; /* discard frame counter */
319 ushort sen_pads; /* Tx short frame pad character */
320 ushort sen_retlim; /* Retry limit threshold */
321 ushort sen_retcnt; /* Retry limit counter */
322 ushort sen_maxflr; /* maximum frame length register */
323 ushort sen_minflr; /* minimum frame length register */
324 ushort sen_maxd1; /* maximum DMA1 length */
325 ushort sen_maxd2; /* maximum DMA2 length */
326 ushort sen_maxd; /* Rx max DMA */
327 ushort sen_dmacnt; /* Rx DMA counter */
328 ushort sen_maxb; /* Max BD byte count */
329 ushort sen_gaddr1; /* Group address filter */
330 ushort sen_gaddr2;
331 ushort sen_gaddr3;
332 ushort sen_gaddr4;
333 uint sen_tbuf0data0; /* Save area 0 - current frame */
334 uint sen_tbuf0data1; /* Save area 1 - current frame */
335 uint sen_tbuf0rba; /* Internal */
336 uint sen_tbuf0crc; /* Internal */
337 ushort sen_tbuf0bcnt; /* Internal */
338 ushort sen_paddrh; /* physical address (MSB) */
339 ushort sen_paddrm;
340 ushort sen_paddrl; /* physical address (LSB) */
341 ushort sen_pper; /* persistence */
342 ushort sen_rfbdptr; /* Rx first BD pointer */
343 ushort sen_tfbdptr; /* Tx first BD pointer */
344 ushort sen_tlbdptr; /* Tx last BD pointer */
345 uint sen_tbuf1data0; /* Save area 0 - current frame */
346 uint sen_tbuf1data1; /* Save area 1 - current frame */
347 uint sen_tbuf1rba; /* Internal */
348 uint sen_tbuf1crc; /* Internal */
349 ushort sen_tbuf1bcnt; /* Internal */
350 ushort sen_txlen; /* Tx Frame length counter */
351 ushort sen_iaddr1; /* Individual address filter */
352 ushort sen_iaddr2;
353 ushort sen_iaddr3;
354 ushort sen_iaddr4;
355 ushort sen_boffcnt; /* Backoff counter */
356
357 /* NOTE: Some versions of the manual have the following items
358 * incorrectly documented. Below is the proper order.
359 */
360 ushort sen_taddrh; /* temp address (MSB) */
361 ushort sen_taddrm;
362 ushort sen_taddrl; /* temp address (LSB) */
363} scc_enet_t;
364
365/* SCC Event register as used by Ethernet.
366*/
367#define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
368#define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
369#define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
370#define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
371#define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
372#define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
373
374/* SCC Mode Register (PMSR) as used by Ethernet.
375*/
376#define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */
377#define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */
378#define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */
379#define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */
380#define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
381#define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */
382#define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
383#define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */
384#define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */
385#define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */
386#define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */
387#define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */
388#define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */
389
390/* SCC as UART
391*/
392typedef struct scc_uart {
393 sccp_t scc_genscc;
394 char res1[8]; /* Reserved */
395 ushort scc_maxidl; /* Maximum idle chars */
396 ushort scc_idlc; /* temp idle counter */
397 ushort scc_brkcr; /* Break count register */
398 ushort scc_parec; /* receive parity error counter */
399 ushort scc_frmec; /* receive framing error counter */
400 ushort scc_nosec; /* receive noise counter */
401 ushort scc_brkec; /* receive break condition counter */
402 ushort scc_brkln; /* last received break length */
403 ushort scc_uaddr1; /* UART address character 1 */
404 ushort scc_uaddr2; /* UART address character 2 */
405 ushort scc_rtemp; /* Temp storage */
406 ushort scc_toseq; /* Transmit out of sequence char */
407 ushort scc_char1; /* control character 1 */
408 ushort scc_char2; /* control character 2 */
409 ushort scc_char3; /* control character 3 */
410 ushort scc_char4; /* control character 4 */
411 ushort scc_char5; /* control character 5 */
412 ushort scc_char6; /* control character 6 */
413 ushort scc_char7; /* control character 7 */
414 ushort scc_char8; /* control character 8 */
415 ushort scc_rccm; /* receive control character mask */
416 ushort scc_rccr; /* receive control character register */
417 ushort scc_rlbc; /* receive last break character */
418} scc_uart_t;
419
420/* SCC Event and Mask registers when it is used as a UART.
421*/
422#define UART_SCCM_GLR ((ushort)0x1000)
423#define UART_SCCM_GLT ((ushort)0x0800)
424#define UART_SCCM_AB ((ushort)0x0200)
425#define UART_SCCM_IDL ((ushort)0x0100)
426#define UART_SCCM_GRA ((ushort)0x0080)
427#define UART_SCCM_BRKE ((ushort)0x0040)
428#define UART_SCCM_BRKS ((ushort)0x0020)
429#define UART_SCCM_CCR ((ushort)0x0008)
430#define UART_SCCM_BSY ((ushort)0x0004)
431#define UART_SCCM_TX ((ushort)0x0002)
432#define UART_SCCM_RX ((ushort)0x0001)
433
434/* The SCC PMSR when used as a UART.
435*/
436#define SCU_PSMR_FLC ((ushort)0x8000)
437#define SCU_PSMR_SL ((ushort)0x4000)
438#define SCU_PSMR_CL ((ushort)0x3000)
439#define SCU_PSMR_UM ((ushort)0x0c00)
440#define SCU_PSMR_FRZ ((ushort)0x0200)
441#define SCU_PSMR_RZS ((ushort)0x0100)
442#define SCU_PSMR_SYN ((ushort)0x0080)
443#define SCU_PSMR_DRT ((ushort)0x0040)
444#define SCU_PSMR_PEN ((ushort)0x0010)
445#define SCU_PSMR_RPM ((ushort)0x000c)
446#define SCU_PSMR_REVP ((ushort)0x0008)
447#define SCU_PSMR_TPM ((ushort)0x0003)
448#define SCU_PSMR_TEVP ((ushort)0x0002)
449
450/* CPM Transparent mode SCC.
451 */
452typedef struct scc_trans {
453 sccp_t st_genscc;
454 uint st_cpres; /* Preset CRC */
455 uint st_cmask; /* Constant mask for CRC */
456} scc_trans_t;
457
458/* IIC parameter RAM.
459*/
460typedef struct iic {
461 ushort iic_rbase; /* Rx Buffer descriptor base address */
462 ushort iic_tbase; /* Tx Buffer descriptor base address */
463 u_char iic_rfcr; /* Rx function code */
464 u_char iic_tfcr; /* Tx function code */
465 ushort iic_mrblr; /* Max receive buffer length */
466 uint iic_rstate; /* Internal */
467 uint iic_rdp; /* Internal */
468 ushort iic_rbptr; /* Internal */
469 ushort iic_rbc; /* Internal */
470 uint iic_rxtmp; /* Internal */
471 uint iic_tstate; /* Internal */
472 uint iic_tdp; /* Internal */
473 ushort iic_tbptr; /* Internal */
474 ushort iic_tbc; /* Internal */
475 uint iic_txtmp; /* Internal */
476 char res1[4]; /* Reserved */
477 ushort iic_rpbase; /* Relocation pointer */
478 char res2[2]; /* Reserved */
479} iic_t;
480
481/* SPI parameter RAM.
482*/
483typedef struct spi {
484 ushort spi_rbase; /* Rx Buffer descriptor base address */
485 ushort spi_tbase; /* Tx Buffer descriptor base address */
486 u_char spi_rfcr; /* Rx function code */
487 u_char spi_tfcr; /* Tx function code */
488 ushort spi_mrblr; /* Max receive buffer length */
489 uint spi_rstate; /* Internal */
490 uint spi_rdp; /* Internal */
491 ushort spi_rbptr; /* Internal */
492 ushort spi_rbc; /* Internal */
493 uint spi_rxtmp; /* Internal */
494 uint spi_tstate; /* Internal */
495 uint spi_tdp; /* Internal */
496 ushort spi_tbptr; /* Internal */
497 ushort spi_tbc; /* Internal */
498 uint spi_txtmp; /* Internal */
499 uint spi_res;
500 ushort spi_rpbase; /* Relocation pointer */
501 ushort spi_res2;
502} spi_t;
503
504/* SPI Mode register.
505*/
506#define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
507#define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
508#define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
509#define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
510#define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
511#define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
512#define SPMODE_EN ((ushort)0x0100) /* Enable */
513#define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
514#define SPMODE_LEN4 ((ushort)0x0030) /* 4 bits per char */
515#define SPMODE_LEN8 ((ushort)0x0070) /* 8 bits per char */
516#define SPMODE_LEN16 ((ushort)0x00f0) /* 16 bits per char */
517#define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
518
519/* SPIE fields */
520#define SPIE_MME 0x20
521#define SPIE_TXE 0x10
522#define SPIE_BSY 0x04
523#define SPIE_TXB 0x02
524#define SPIE_RXB 0x01
525
526/*
527 * RISC Controller Configuration Register definitons
528 */
529#define RCCR_TIME 0x8000 /* RISC Timer Enable */
530#define RCCR_TIMEP(t) (((t) & 0x3F)<<8) /* RISC Timer Period */
531#define RCCR_TIME_MASK 0x00FF /* not RISC Timer related bits */
532
533/* RISC Timer Parameter RAM offset */
534#define PROFF_RTMR ((uint)0x01B0)
535
536typedef struct risc_timer_pram {
537 unsigned short tm_base; /* RISC Timer Table Base Address */
538 unsigned short tm_ptr; /* RISC Timer Table Pointer (internal) */
539 unsigned short r_tmr; /* RISC Timer Mode Register */
540 unsigned short r_tmv; /* RISC Timer Valid Register */
541 unsigned long tm_cmd; /* RISC Timer Command Register */
542 unsigned long tm_cnt; /* RISC Timer Internal Count */
543} rt_pram_t;
544
545/* Bits in RISC Timer Command Register */
546#define TM_CMD_VALID 0x80000000 /* Valid - Enables the timer */
547#define TM_CMD_RESTART 0x40000000 /* Restart - for automatic restart */
548#define TM_CMD_PWM 0x20000000 /* Run in Pulse Width Modulation Mode */
549#define TM_CMD_NUM(n) (((n)&0xF)<<16) /* Timer Number */
550#define TM_CMD_PERIOD(p) ((p)&0xFFFF) /* Timer Period */
551
552/* CPM interrupts. There are nearly 32 interrupts generated by CPM
553 * channels or devices. All of these are presented to the PPC core
554 * as a single interrupt. The CPM interrupt handler dispatches its
555 * own handlers, in a similar fashion to the PPC core handler. We
556 * use the table as defined in the manuals (i.e. no special high
557 * priority and SCC1 == SCCa, etc...).
558 */
559#define CPMVEC_NR 32
560#define CPMVEC_PIO_PC15 ((ushort)0x1f)
561#define CPMVEC_SCC1 ((ushort)0x1e)
562#define CPMVEC_SCC2 ((ushort)0x1d)
563#define CPMVEC_SCC3 ((ushort)0x1c)
564#define CPMVEC_SCC4 ((ushort)0x1b)
565#define CPMVEC_PIO_PC14 ((ushort)0x1a)
566#define CPMVEC_TIMER1 ((ushort)0x19)
567#define CPMVEC_PIO_PC13 ((ushort)0x18)
568#define CPMVEC_PIO_PC12 ((ushort)0x17)
569#define CPMVEC_SDMA_CB_ERR ((ushort)0x16)
570#define CPMVEC_IDMA1 ((ushort)0x15)
571#define CPMVEC_IDMA2 ((ushort)0x14)
572#define CPMVEC_TIMER2 ((ushort)0x12)
573#define CPMVEC_RISCTIMER ((ushort)0x11)
574#define CPMVEC_I2C ((ushort)0x10)
575#define CPMVEC_PIO_PC11 ((ushort)0x0f)
576#define CPMVEC_PIO_PC10 ((ushort)0x0e)
577#define CPMVEC_TIMER3 ((ushort)0x0c)
578#define CPMVEC_PIO_PC9 ((ushort)0x0b)
579#define CPMVEC_PIO_PC8 ((ushort)0x0a)
580#define CPMVEC_PIO_PC7 ((ushort)0x09)
581#define CPMVEC_TIMER4 ((ushort)0x07)
582#define CPMVEC_PIO_PC6 ((ushort)0x06)
583#define CPMVEC_SPI ((ushort)0x05)
584#define CPMVEC_SMC1 ((ushort)0x04)
585#define CPMVEC_SMC2 ((ushort)0x03)
586#define CPMVEC_PIO_PC5 ((ushort)0x02)
587#define CPMVEC_PIO_PC4 ((ushort)0x01)
588#define CPMVEC_ERROR ((ushort)0x00)
589
590/* CPM interrupt configuration vector.
591*/
592#define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */
593#define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
594#define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */
595#define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */
596#define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrupt */
597#define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
598#define CICR_IEN ((uint)0x00000080) /* Int. enable */
599#define CICR_SPS ((uint)0x00000001) /* SCC Spread */
600
601#define IMAP_ADDR (get_immrbase())
602
603#define CPM_PIN_INPUT 0
604#define CPM_PIN_OUTPUT 1
605#define CPM_PIN_PRIMARY 0
606#define CPM_PIN_SECONDARY 2
607#define CPM_PIN_GPIO 4
608#define CPM_PIN_OPENDRAIN 8
609
610enum cpm_port {
611 CPM_PORTA,
612 CPM_PORTB,
613 CPM_PORTC,
614 CPM_PORTD,
615 CPM_PORTE,
616};
617
618void cpm1_set_pin(enum cpm_port port, int pin, int flags);
619
620enum cpm_clk_dir {
621 CPM_CLK_RX,
622 CPM_CLK_TX,
623 CPM_CLK_RTX
624};
625
626enum cpm_clk_target {
627 CPM_CLK_SCC1,
628 CPM_CLK_SCC2,
629 CPM_CLK_SCC3,
630 CPM_CLK_SCC4,
631 CPM_CLK_SMC1,
632 CPM_CLK_SMC2,
633};
634
635enum cpm_clk {
636 CPM_BRG1, /* Baud Rate Generator 1 */
637 CPM_BRG2, /* Baud Rate Generator 2 */
638 CPM_BRG3, /* Baud Rate Generator 3 */
639 CPM_BRG4, /* Baud Rate Generator 4 */
640 CPM_CLK1, /* Clock 1 */
641 CPM_CLK2, /* Clock 2 */
642 CPM_CLK3, /* Clock 3 */
643 CPM_CLK4, /* Clock 4 */
644 CPM_CLK5, /* Clock 5 */
645 CPM_CLK6, /* Clock 6 */
646 CPM_CLK7, /* Clock 7 */
647 CPM_CLK8, /* Clock 8 */
648};
649
650int cpm1_clk_setup(enum cpm_clk_target target, int clock, int mode);
651
652#endif /* __CPM1__ */
diff --git a/arch/powerpc/include/asm/cpm2.h b/arch/powerpc/include/asm/cpm2.h
new file mode 100644
index 000000000000..2a6fa0183ac9
--- /dev/null
+++ b/arch/powerpc/include/asm/cpm2.h
@@ -0,0 +1,1195 @@
1/*
2 * Communication Processor Module v2.
3 *
4 * This file contains structures and information for the communication
5 * processor channels found in the dual port RAM or parameter RAM.
6 * All CPM control and status is available through the CPM2 internal
7 * memory map. See immap_cpm2.h for details.
8 */
9#ifdef __KERNEL__
10#ifndef __CPM2__
11#define __CPM2__
12
13#include <asm/immap_cpm2.h>
14#include <asm/cpm.h>
15#include <sysdev/fsl_soc.h>
16
17#ifdef CONFIG_PPC_85xx
18#define CPM_MAP_ADDR (get_immrbase() + 0x80000)
19#endif
20
21/* CPM Command register.
22*/
23#define CPM_CR_RST ((uint)0x80000000)
24#define CPM_CR_PAGE ((uint)0x7c000000)
25#define CPM_CR_SBLOCK ((uint)0x03e00000)
26#define CPM_CR_FLG ((uint)0x00010000)
27#define CPM_CR_MCN ((uint)0x00003fc0)
28#define CPM_CR_OPCODE ((uint)0x0000000f)
29
30/* Device sub-block and page codes.
31*/
32#define CPM_CR_SCC1_SBLOCK (0x04)
33#define CPM_CR_SCC2_SBLOCK (0x05)
34#define CPM_CR_SCC3_SBLOCK (0x06)
35#define CPM_CR_SCC4_SBLOCK (0x07)
36#define CPM_CR_SMC1_SBLOCK (0x08)
37#define CPM_CR_SMC2_SBLOCK (0x09)
38#define CPM_CR_SPI_SBLOCK (0x0a)
39#define CPM_CR_I2C_SBLOCK (0x0b)
40#define CPM_CR_TIMER_SBLOCK (0x0f)
41#define CPM_CR_RAND_SBLOCK (0x0e)
42#define CPM_CR_FCC1_SBLOCK (0x10)
43#define CPM_CR_FCC2_SBLOCK (0x11)
44#define CPM_CR_FCC3_SBLOCK (0x12)
45#define CPM_CR_IDMA1_SBLOCK (0x14)
46#define CPM_CR_IDMA2_SBLOCK (0x15)
47#define CPM_CR_IDMA3_SBLOCK (0x16)
48#define CPM_CR_IDMA4_SBLOCK (0x17)
49#define CPM_CR_MCC1_SBLOCK (0x1c)
50
51#define CPM_CR_FCC_SBLOCK(x) (x + 0x10)
52
53#define CPM_CR_SCC1_PAGE (0x00)
54#define CPM_CR_SCC2_PAGE (0x01)
55#define CPM_CR_SCC3_PAGE (0x02)
56#define CPM_CR_SCC4_PAGE (0x03)
57#define CPM_CR_SMC1_PAGE (0x07)
58#define CPM_CR_SMC2_PAGE (0x08)
59#define CPM_CR_SPI_PAGE (0x09)
60#define CPM_CR_I2C_PAGE (0x0a)
61#define CPM_CR_TIMER_PAGE (0x0a)
62#define CPM_CR_RAND_PAGE (0x0a)
63#define CPM_CR_FCC1_PAGE (0x04)
64#define CPM_CR_FCC2_PAGE (0x05)
65#define CPM_CR_FCC3_PAGE (0x06)
66#define CPM_CR_IDMA1_PAGE (0x07)
67#define CPM_CR_IDMA2_PAGE (0x08)
68#define CPM_CR_IDMA3_PAGE (0x09)
69#define CPM_CR_IDMA4_PAGE (0x0a)
70#define CPM_CR_MCC1_PAGE (0x07)
71#define CPM_CR_MCC2_PAGE (0x08)
72
73#define CPM_CR_FCC_PAGE(x) (x + 0x04)
74
75/* CPM2-specific opcodes (see cpm.h for common opcodes)
76*/
77#define CPM_CR_START_IDMA ((ushort)0x0009)
78
79#define mk_cr_cmd(PG, SBC, MCN, OP) \
80 ((PG << 26) | (SBC << 21) | (MCN << 6) | OP)
81
82/* The number of pages of host memory we allocate for CPM. This is
83 * done early in kernel initialization to get physically contiguous
84 * pages.
85 */
86#define NUM_CPM_HOST_PAGES 2
87
88/* Export the base address of the communication processor registers
89 * and dual port ram.
90 */
91extern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */
92
93#define cpm_dpalloc cpm_muram_alloc
94#define cpm_dpfree cpm_muram_free
95#define cpm_dpram_addr cpm_muram_addr
96
97extern void cpm2_reset(void);
98
99/* Baud rate generators.
100*/
101#define CPM_BRG_RST ((uint)0x00020000)
102#define CPM_BRG_EN ((uint)0x00010000)
103#define CPM_BRG_EXTC_INT ((uint)0x00000000)
104#define CPM_BRG_EXTC_CLK3_9 ((uint)0x00004000)
105#define CPM_BRG_EXTC_CLK5_15 ((uint)0x00008000)
106#define CPM_BRG_ATB ((uint)0x00002000)
107#define CPM_BRG_CD_MASK ((uint)0x00001ffe)
108#define CPM_BRG_DIV16 ((uint)0x00000001)
109
110#define CPM2_BRG_INT_CLK (get_brgfreq())
111#define CPM2_BRG_UART_CLK (CPM2_BRG_INT_CLK/16)
112
113extern void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src);
114
115/* This function is used by UARTS, or anything else that uses a 16x
116 * oversampled clock.
117 */
118static inline void cpm_setbrg(uint brg, uint rate)
119{
120 __cpm2_setbrg(brg, rate, CPM2_BRG_UART_CLK, 0, CPM_BRG_EXTC_INT);
121}
122
123/* This function is used to set high speed synchronous baud rate
124 * clocks.
125 */
126static inline void cpm2_fastbrg(uint brg, uint rate, int div16)
127{
128 __cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT);
129}
130
131/* Function code bits, usually generic to devices.
132*/
133#define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */
134#define CPMFCR_EB ((u_char)0x10) /* Set big endian byte order */
135#define CPMFCR_TC2 ((u_char)0x04) /* Transfer code 2 value */
136#define CPMFCR_DTB ((u_char)0x02) /* Use local bus for data when set */
137#define CPMFCR_BDB ((u_char)0x01) /* Use local bus for BD when set */
138
139/* Parameter RAM offsets from the base.
140*/
141#define PROFF_SCC1 ((uint)0x8000)
142#define PROFF_SCC2 ((uint)0x8100)
143#define PROFF_SCC3 ((uint)0x8200)
144#define PROFF_SCC4 ((uint)0x8300)
145#define PROFF_FCC1 ((uint)0x8400)
146#define PROFF_FCC2 ((uint)0x8500)
147#define PROFF_FCC3 ((uint)0x8600)
148#define PROFF_MCC1 ((uint)0x8700)
149#define PROFF_SMC1_BASE ((uint)0x87fc)
150#define PROFF_IDMA1_BASE ((uint)0x87fe)
151#define PROFF_MCC2 ((uint)0x8800)
152#define PROFF_SMC2_BASE ((uint)0x88fc)
153#define PROFF_IDMA2_BASE ((uint)0x88fe)
154#define PROFF_SPI_BASE ((uint)0x89fc)
155#define PROFF_IDMA3_BASE ((uint)0x89fe)
156#define PROFF_TIMERS ((uint)0x8ae0)
157#define PROFF_REVNUM ((uint)0x8af0)
158#define PROFF_RAND ((uint)0x8af8)
159#define PROFF_I2C_BASE ((uint)0x8afc)
160#define PROFF_IDMA4_BASE ((uint)0x8afe)
161
162#define PROFF_SCC_SIZE ((uint)0x100)
163#define PROFF_FCC_SIZE ((uint)0x100)
164#define PROFF_SMC_SIZE ((uint)64)
165
166/* The SMCs are relocated to any of the first eight DPRAM pages.
167 * We will fix these at the first locations of DPRAM, until we
168 * get some microcode patches :-).
169 * The parameter ram space for the SMCs is fifty-some bytes, and
170 * they are required to start on a 64 byte boundary.
171 */
172#define PROFF_SMC1 (0)
173#define PROFF_SMC2 (64)
174
175
176/* Define enough so I can at least use the serial port as a UART.
177 */
178typedef struct smc_uart {
179 ushort smc_rbase; /* Rx Buffer descriptor base address */
180 ushort smc_tbase; /* Tx Buffer descriptor base address */
181 u_char smc_rfcr; /* Rx function code */
182 u_char smc_tfcr; /* Tx function code */
183 ushort smc_mrblr; /* Max receive buffer length */
184 uint smc_rstate; /* Internal */
185 uint smc_idp; /* Internal */
186 ushort smc_rbptr; /* Internal */
187 ushort smc_ibc; /* Internal */
188 uint smc_rxtmp; /* Internal */
189 uint smc_tstate; /* Internal */
190 uint smc_tdp; /* Internal */
191 ushort smc_tbptr; /* Internal */
192 ushort smc_tbc; /* Internal */
193 uint smc_txtmp; /* Internal */
194 ushort smc_maxidl; /* Maximum idle characters */
195 ushort smc_tmpidl; /* Temporary idle counter */
196 ushort smc_brklen; /* Last received break length */
197 ushort smc_brkec; /* rcv'd break condition counter */
198 ushort smc_brkcr; /* xmt break count register */
199 ushort smc_rmask; /* Temporary bit mask */
200 uint smc_stmp; /* SDMA Temp */
201} smc_uart_t;
202
203/* SMC uart mode register (Internal memory map).
204*/
205#define SMCMR_REN ((ushort)0x0001)
206#define SMCMR_TEN ((ushort)0x0002)
207#define SMCMR_DM ((ushort)0x000c)
208#define SMCMR_SM_GCI ((ushort)0x0000)
209#define SMCMR_SM_UART ((ushort)0x0020)
210#define SMCMR_SM_TRANS ((ushort)0x0030)
211#define SMCMR_SM_MASK ((ushort)0x0030)
212#define SMCMR_PM_EVEN ((ushort)0x0100) /* Even parity, else odd */
213#define SMCMR_REVD SMCMR_PM_EVEN
214#define SMCMR_PEN ((ushort)0x0200) /* Parity enable */
215#define SMCMR_BS SMCMR_PEN
216#define SMCMR_SL ((ushort)0x0400) /* Two stops, else one */
217#define SMCR_CLEN_MASK ((ushort)0x7800) /* Character length */
218#define smcr_mk_clen(C) (((C) << 11) & SMCR_CLEN_MASK)
219
220/* SMC Event and Mask register.
221*/
222#define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */
223#define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */
224#define SMCM_TXE ((unsigned char)0x10)
225#define SMCM_BSY ((unsigned char)0x04)
226#define SMCM_TX ((unsigned char)0x02)
227#define SMCM_RX ((unsigned char)0x01)
228
229/* SCCs.
230*/
231#define SCC_GSMRH_IRP ((uint)0x00040000)
232#define SCC_GSMRH_GDE ((uint)0x00010000)
233#define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000)
234#define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000)
235#define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000)
236#define SCC_GSMRH_REVD ((uint)0x00002000)
237#define SCC_GSMRH_TRX ((uint)0x00001000)
238#define SCC_GSMRH_TTX ((uint)0x00000800)
239#define SCC_GSMRH_CDP ((uint)0x00000400)
240#define SCC_GSMRH_CTSP ((uint)0x00000200)
241#define SCC_GSMRH_CDS ((uint)0x00000100)
242#define SCC_GSMRH_CTSS ((uint)0x00000080)
243#define SCC_GSMRH_TFL ((uint)0x00000040)
244#define SCC_GSMRH_RFW ((uint)0x00000020)
245#define SCC_GSMRH_TXSY ((uint)0x00000010)
246#define SCC_GSMRH_SYNL16 ((uint)0x0000000c)
247#define SCC_GSMRH_SYNL8 ((uint)0x00000008)
248#define SCC_GSMRH_SYNL4 ((uint)0x00000004)
249#define SCC_GSMRH_RTSM ((uint)0x00000002)
250#define SCC_GSMRH_RSYN ((uint)0x00000001)
251
252#define SCC_GSMRL_SIR ((uint)0x80000000) /* SCC2 only */
253#define SCC_GSMRL_EDGE_NONE ((uint)0x60000000)
254#define SCC_GSMRL_EDGE_NEG ((uint)0x40000000)
255#define SCC_GSMRL_EDGE_POS ((uint)0x20000000)
256#define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000)
257#define SCC_GSMRL_TCI ((uint)0x10000000)
258#define SCC_GSMRL_TSNC_3 ((uint)0x0c000000)
259#define SCC_GSMRL_TSNC_4 ((uint)0x08000000)
260#define SCC_GSMRL_TSNC_14 ((uint)0x04000000)
261#define SCC_GSMRL_TSNC_INF ((uint)0x00000000)
262#define SCC_GSMRL_RINV ((uint)0x02000000)
263#define SCC_GSMRL_TINV ((uint)0x01000000)
264#define SCC_GSMRL_TPL_128 ((uint)0x00c00000)
265#define SCC_GSMRL_TPL_64 ((uint)0x00a00000)
266#define SCC_GSMRL_TPL_48 ((uint)0x00800000)
267#define SCC_GSMRL_TPL_32 ((uint)0x00600000)
268#define SCC_GSMRL_TPL_16 ((uint)0x00400000)
269#define SCC_GSMRL_TPL_8 ((uint)0x00200000)
270#define SCC_GSMRL_TPL_NONE ((uint)0x00000000)
271#define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000)
272#define SCC_GSMRL_TPP_01 ((uint)0x00100000)
273#define SCC_GSMRL_TPP_10 ((uint)0x00080000)
274#define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000)
275#define SCC_GSMRL_TEND ((uint)0x00040000)
276#define SCC_GSMRL_TDCR_32 ((uint)0x00030000)
277#define SCC_GSMRL_TDCR_16 ((uint)0x00020000)
278#define SCC_GSMRL_TDCR_8 ((uint)0x00010000)
279#define SCC_GSMRL_TDCR_1 ((uint)0x00000000)
280#define SCC_GSMRL_RDCR_32 ((uint)0x0000c000)
281#define SCC_GSMRL_RDCR_16 ((uint)0x00008000)
282#define SCC_GSMRL_RDCR_8 ((uint)0x00004000)
283#define SCC_GSMRL_RDCR_1 ((uint)0x00000000)
284#define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000)
285#define SCC_GSMRL_RENC_MANCH ((uint)0x00002000)
286#define SCC_GSMRL_RENC_FM0 ((uint)0x00001000)
287#define SCC_GSMRL_RENC_NRZI ((uint)0x00000800)
288#define SCC_GSMRL_RENC_NRZ ((uint)0x00000000)
289#define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600)
290#define SCC_GSMRL_TENC_MANCH ((uint)0x00000400)
291#define SCC_GSMRL_TENC_FM0 ((uint)0x00000200)
292#define SCC_GSMRL_TENC_NRZI ((uint)0x00000100)
293#define SCC_GSMRL_TENC_NRZ ((uint)0x00000000)
294#define SCC_GSMRL_DIAG_LE ((uint)0x000000c0) /* Loop and echo */
295#define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080)
296#define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040)
297#define SCC_GSMRL_DIAG_NORM ((uint)0x00000000)
298#define SCC_GSMRL_ENR ((uint)0x00000020)
299#define SCC_GSMRL_ENT ((uint)0x00000010)
300#define SCC_GSMRL_MODE_ENET ((uint)0x0000000c)
301#define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009)
302#define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008)
303#define SCC_GSMRL_MODE_V14 ((uint)0x00000007)
304#define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006)
305#define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005)
306#define SCC_GSMRL_MODE_UART ((uint)0x00000004)
307#define SCC_GSMRL_MODE_SS7 ((uint)0x00000003)
308#define SCC_GSMRL_MODE_ATALK ((uint)0x00000002)
309#define SCC_GSMRL_MODE_HDLC ((uint)0x00000000)
310
311#define SCC_TODR_TOD ((ushort)0x8000)
312
313/* SCC Event and Mask register.
314*/
315#define SCCM_TXE ((unsigned char)0x10)
316#define SCCM_BSY ((unsigned char)0x04)
317#define SCCM_TX ((unsigned char)0x02)
318#define SCCM_RX ((unsigned char)0x01)
319
320typedef struct scc_param {
321 ushort scc_rbase; /* Rx Buffer descriptor base address */
322 ushort scc_tbase; /* Tx Buffer descriptor base address */
323 u_char scc_rfcr; /* Rx function code */
324 u_char scc_tfcr; /* Tx function code */
325 ushort scc_mrblr; /* Max receive buffer length */
326 uint scc_rstate; /* Internal */
327 uint scc_idp; /* Internal */
328 ushort scc_rbptr; /* Internal */
329 ushort scc_ibc; /* Internal */
330 uint scc_rxtmp; /* Internal */
331 uint scc_tstate; /* Internal */
332 uint scc_tdp; /* Internal */
333 ushort scc_tbptr; /* Internal */
334 ushort scc_tbc; /* Internal */
335 uint scc_txtmp; /* Internal */
336 uint scc_rcrc; /* Internal */
337 uint scc_tcrc; /* Internal */
338} sccp_t;
339
340/* CPM Ethernet through SCC1.
341 */
342typedef struct scc_enet {
343 sccp_t sen_genscc;
344 uint sen_cpres; /* Preset CRC */
345 uint sen_cmask; /* Constant mask for CRC */
346 uint sen_crcec; /* CRC Error counter */
347 uint sen_alec; /* alignment error counter */
348 uint sen_disfc; /* discard frame counter */
349 ushort sen_pads; /* Tx short frame pad character */
350 ushort sen_retlim; /* Retry limit threshold */
351 ushort sen_retcnt; /* Retry limit counter */
352 ushort sen_maxflr; /* maximum frame length register */
353 ushort sen_minflr; /* minimum frame length register */
354 ushort sen_maxd1; /* maximum DMA1 length */
355 ushort sen_maxd2; /* maximum DMA2 length */
356 ushort sen_maxd; /* Rx max DMA */
357 ushort sen_dmacnt; /* Rx DMA counter */
358 ushort sen_maxb; /* Max BD byte count */
359 ushort sen_gaddr1; /* Group address filter */
360 ushort sen_gaddr2;
361 ushort sen_gaddr3;
362 ushort sen_gaddr4;
363 uint sen_tbuf0data0; /* Save area 0 - current frame */
364 uint sen_tbuf0data1; /* Save area 1 - current frame */
365 uint sen_tbuf0rba; /* Internal */
366 uint sen_tbuf0crc; /* Internal */
367 ushort sen_tbuf0bcnt; /* Internal */
368 ushort sen_paddrh; /* physical address (MSB) */
369 ushort sen_paddrm;
370 ushort sen_paddrl; /* physical address (LSB) */
371 ushort sen_pper; /* persistence */
372 ushort sen_rfbdptr; /* Rx first BD pointer */
373 ushort sen_tfbdptr; /* Tx first BD pointer */
374 ushort sen_tlbdptr; /* Tx last BD pointer */
375 uint sen_tbuf1data0; /* Save area 0 - current frame */
376 uint sen_tbuf1data1; /* Save area 1 - current frame */
377 uint sen_tbuf1rba; /* Internal */
378 uint sen_tbuf1crc; /* Internal */
379 ushort sen_tbuf1bcnt; /* Internal */
380 ushort sen_txlen; /* Tx Frame length counter */
381 ushort sen_iaddr1; /* Individual address filter */
382 ushort sen_iaddr2;
383 ushort sen_iaddr3;
384 ushort sen_iaddr4;
385 ushort sen_boffcnt; /* Backoff counter */
386
387 /* NOTE: Some versions of the manual have the following items
388 * incorrectly documented. Below is the proper order.
389 */
390 ushort sen_taddrh; /* temp address (MSB) */
391 ushort sen_taddrm;
392 ushort sen_taddrl; /* temp address (LSB) */
393} scc_enet_t;
394
395
396/* SCC Event register as used by Ethernet.
397*/
398#define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
399#define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
400#define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
401#define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
402#define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
403#define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
404
405/* SCC Mode Register (PSMR) as used by Ethernet.
406*/
407#define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */
408#define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */
409#define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */
410#define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */
411#define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
412#define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */
413#define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
414#define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */
415#define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */
416#define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */
417#define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */
418#define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */
419#define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */
420
421/* SCC as UART
422*/
423typedef struct scc_uart {
424 sccp_t scc_genscc;
425 uint scc_res1; /* Reserved */
426 uint scc_res2; /* Reserved */
427 ushort scc_maxidl; /* Maximum idle chars */
428 ushort scc_idlc; /* temp idle counter */
429 ushort scc_brkcr; /* Break count register */
430 ushort scc_parec; /* receive parity error counter */
431 ushort scc_frmec; /* receive framing error counter */
432 ushort scc_nosec; /* receive noise counter */
433 ushort scc_brkec; /* receive break condition counter */
434 ushort scc_brkln; /* last received break length */
435 ushort scc_uaddr1; /* UART address character 1 */
436 ushort scc_uaddr2; /* UART address character 2 */
437 ushort scc_rtemp; /* Temp storage */
438 ushort scc_toseq; /* Transmit out of sequence char */
439 ushort scc_char1; /* control character 1 */
440 ushort scc_char2; /* control character 2 */
441 ushort scc_char3; /* control character 3 */
442 ushort scc_char4; /* control character 4 */
443 ushort scc_char5; /* control character 5 */
444 ushort scc_char6; /* control character 6 */
445 ushort scc_char7; /* control character 7 */
446 ushort scc_char8; /* control character 8 */
447 ushort scc_rccm; /* receive control character mask */
448 ushort scc_rccr; /* receive control character register */
449 ushort scc_rlbc; /* receive last break character */
450} scc_uart_t;
451
452/* SCC Event and Mask registers when it is used as a UART.
453*/
454#define UART_SCCM_GLR ((ushort)0x1000)
455#define UART_SCCM_GLT ((ushort)0x0800)
456#define UART_SCCM_AB ((ushort)0x0200)
457#define UART_SCCM_IDL ((ushort)0x0100)
458#define UART_SCCM_GRA ((ushort)0x0080)
459#define UART_SCCM_BRKE ((ushort)0x0040)
460#define UART_SCCM_BRKS ((ushort)0x0020)
461#define UART_SCCM_CCR ((ushort)0x0008)
462#define UART_SCCM_BSY ((ushort)0x0004)
463#define UART_SCCM_TX ((ushort)0x0002)
464#define UART_SCCM_RX ((ushort)0x0001)
465
466/* The SCC PSMR when used as a UART.
467*/
468#define SCU_PSMR_FLC ((ushort)0x8000)
469#define SCU_PSMR_SL ((ushort)0x4000)
470#define SCU_PSMR_CL ((ushort)0x3000)
471#define SCU_PSMR_UM ((ushort)0x0c00)
472#define SCU_PSMR_FRZ ((ushort)0x0200)
473#define SCU_PSMR_RZS ((ushort)0x0100)
474#define SCU_PSMR_SYN ((ushort)0x0080)
475#define SCU_PSMR_DRT ((ushort)0x0040)
476#define SCU_PSMR_PEN ((ushort)0x0010)
477#define SCU_PSMR_RPM ((ushort)0x000c)
478#define SCU_PSMR_REVP ((ushort)0x0008)
479#define SCU_PSMR_TPM ((ushort)0x0003)
480#define SCU_PSMR_TEVP ((ushort)0x0002)
481
482/* CPM Transparent mode SCC.
483 */
484typedef struct scc_trans {
485 sccp_t st_genscc;
486 uint st_cpres; /* Preset CRC */
487 uint st_cmask; /* Constant mask for CRC */
488} scc_trans_t;
489
490/* How about some FCCs.....
491*/
492#define FCC_GFMR_DIAG_NORM ((uint)0x00000000)
493#define FCC_GFMR_DIAG_LE ((uint)0x40000000)
494#define FCC_GFMR_DIAG_AE ((uint)0x80000000)
495#define FCC_GFMR_DIAG_ALE ((uint)0xc0000000)
496#define FCC_GFMR_TCI ((uint)0x20000000)
497#define FCC_GFMR_TRX ((uint)0x10000000)
498#define FCC_GFMR_TTX ((uint)0x08000000)
499#define FCC_GFMR_TTX ((uint)0x08000000)
500#define FCC_GFMR_CDP ((uint)0x04000000)
501#define FCC_GFMR_CTSP ((uint)0x02000000)
502#define FCC_GFMR_CDS ((uint)0x01000000)
503#define FCC_GFMR_CTSS ((uint)0x00800000)
504#define FCC_GFMR_SYNL_NONE ((uint)0x00000000)
505#define FCC_GFMR_SYNL_AUTO ((uint)0x00004000)
506#define FCC_GFMR_SYNL_8 ((uint)0x00008000)
507#define FCC_GFMR_SYNL_16 ((uint)0x0000c000)
508#define FCC_GFMR_RTSM ((uint)0x00002000)
509#define FCC_GFMR_RENC_NRZ ((uint)0x00000000)
510#define FCC_GFMR_RENC_NRZI ((uint)0x00000800)
511#define FCC_GFMR_REVD ((uint)0x00000400)
512#define FCC_GFMR_TENC_NRZ ((uint)0x00000000)
513#define FCC_GFMR_TENC_NRZI ((uint)0x00000100)
514#define FCC_GFMR_TCRC_16 ((uint)0x00000000)
515#define FCC_GFMR_TCRC_32 ((uint)0x00000080)
516#define FCC_GFMR_ENR ((uint)0x00000020)
517#define FCC_GFMR_ENT ((uint)0x00000010)
518#define FCC_GFMR_MODE_ENET ((uint)0x0000000c)
519#define FCC_GFMR_MODE_ATM ((uint)0x0000000a)
520#define FCC_GFMR_MODE_HDLC ((uint)0x00000000)
521
522/* Generic FCC parameter ram.
523*/
524typedef struct fcc_param {
525 ushort fcc_riptr; /* Rx Internal temp pointer */
526 ushort fcc_tiptr; /* Tx Internal temp pointer */
527 ushort fcc_res1;
528 ushort fcc_mrblr; /* Max receive buffer length, mod 32 bytes */
529 uint fcc_rstate; /* Upper byte is Func code, must be set */
530 uint fcc_rbase; /* Receive BD base */
531 ushort fcc_rbdstat; /* RxBD status */
532 ushort fcc_rbdlen; /* RxBD down counter */
533 uint fcc_rdptr; /* RxBD internal data pointer */
534 uint fcc_tstate; /* Upper byte is Func code, must be set */
535 uint fcc_tbase; /* Transmit BD base */
536 ushort fcc_tbdstat; /* TxBD status */
537 ushort fcc_tbdlen; /* TxBD down counter */
538 uint fcc_tdptr; /* TxBD internal data pointer */
539 uint fcc_rbptr; /* Rx BD Internal buf pointer */
540 uint fcc_tbptr; /* Tx BD Internal buf pointer */
541 uint fcc_rcrc; /* Rx temp CRC */
542 uint fcc_res2;
543 uint fcc_tcrc; /* Tx temp CRC */
544} fccp_t;
545
546
547/* Ethernet controller through FCC.
548*/
549typedef struct fcc_enet {
550 fccp_t fen_genfcc;
551 uint fen_statbuf; /* Internal status buffer */
552 uint fen_camptr; /* CAM address */
553 uint fen_cmask; /* Constant mask for CRC */
554 uint fen_cpres; /* Preset CRC */
555 uint fen_crcec; /* CRC Error counter */
556 uint fen_alec; /* alignment error counter */
557 uint fen_disfc; /* discard frame counter */
558 ushort fen_retlim; /* Retry limit */
559 ushort fen_retcnt; /* Retry counter */
560 ushort fen_pper; /* Persistence */
561 ushort fen_boffcnt; /* backoff counter */
562 uint fen_gaddrh; /* Group address filter, high 32-bits */
563 uint fen_gaddrl; /* Group address filter, low 32-bits */
564 ushort fen_tfcstat; /* out of sequence TxBD */
565 ushort fen_tfclen;
566 uint fen_tfcptr;
567 ushort fen_mflr; /* Maximum frame length (1518) */
568 ushort fen_paddrh; /* MAC address */
569 ushort fen_paddrm;
570 ushort fen_paddrl;
571 ushort fen_ibdcount; /* Internal BD counter */
572 ushort fen_ibdstart; /* Internal BD start pointer */
573 ushort fen_ibdend; /* Internal BD end pointer */
574 ushort fen_txlen; /* Internal Tx frame length counter */
575 uint fen_ibdbase[8]; /* Internal use */
576 uint fen_iaddrh; /* Individual address filter */
577 uint fen_iaddrl;
578 ushort fen_minflr; /* Minimum frame length (64) */
579 ushort fen_taddrh; /* Filter transfer MAC address */
580 ushort fen_taddrm;
581 ushort fen_taddrl;
582 ushort fen_padptr; /* Pointer to pad byte buffer */
583 ushort fen_cftype; /* control frame type */
584 ushort fen_cfrange; /* control frame range */
585 ushort fen_maxb; /* maximum BD count */
586 ushort fen_maxd1; /* Max DMA1 length (1520) */
587 ushort fen_maxd2; /* Max DMA2 length (1520) */
588 ushort fen_maxd; /* internal max DMA count */
589 ushort fen_dmacnt; /* internal DMA counter */
590 uint fen_octc; /* Total octect counter */
591 uint fen_colc; /* Total collision counter */
592 uint fen_broc; /* Total broadcast packet counter */
593 uint fen_mulc; /* Total multicast packet count */
594 uint fen_uspc; /* Total packets < 64 bytes */
595 uint fen_frgc; /* Total packets < 64 bytes with errors */
596 uint fen_ospc; /* Total packets > 1518 */
597 uint fen_jbrc; /* Total packets > 1518 with errors */
598 uint fen_p64c; /* Total packets == 64 bytes */
599 uint fen_p65c; /* Total packets 64 < bytes <= 127 */
600 uint fen_p128c; /* Total packets 127 < bytes <= 255 */
601 uint fen_p256c; /* Total packets 256 < bytes <= 511 */
602 uint fen_p512c; /* Total packets 512 < bytes <= 1023 */
603 uint fen_p1024c; /* Total packets 1024 < bytes <= 1518 */
604 uint fen_cambuf; /* Internal CAM buffer poiner */
605 ushort fen_rfthr; /* Received frames threshold */
606 ushort fen_rfcnt; /* Received frames count */
607} fcc_enet_t;
608
609/* FCC Event/Mask register as used by Ethernet.
610*/
611#define FCC_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
612#define FCC_ENET_RXC ((ushort)0x0040) /* Control Frame Received */
613#define FCC_ENET_TXC ((ushort)0x0020) /* Out of seq. Tx sent */
614#define FCC_ENET_TXE ((ushort)0x0010) /* Transmit Error */
615#define FCC_ENET_RXF ((ushort)0x0008) /* Full frame received */
616#define FCC_ENET_BSY ((ushort)0x0004) /* Busy. Rx Frame dropped */
617#define FCC_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
618#define FCC_ENET_RXB ((ushort)0x0001) /* A buffer was received */
619
620/* FCC Mode Register (FPSMR) as used by Ethernet.
621*/
622#define FCC_PSMR_HBC ((uint)0x80000000) /* Enable heartbeat */
623#define FCC_PSMR_FC ((uint)0x40000000) /* Force Collision */
624#define FCC_PSMR_SBT ((uint)0x20000000) /* Stop backoff timer */
625#define FCC_PSMR_LPB ((uint)0x10000000) /* Local protect. 1 = FDX */
626#define FCC_PSMR_LCW ((uint)0x08000000) /* Late collision select */
627#define FCC_PSMR_FDE ((uint)0x04000000) /* Full Duplex Enable */
628#define FCC_PSMR_MON ((uint)0x02000000) /* RMON Enable */
629#define FCC_PSMR_PRO ((uint)0x00400000) /* Promiscuous Enable */
630#define FCC_PSMR_FCE ((uint)0x00200000) /* Flow Control Enable */
631#define FCC_PSMR_RSH ((uint)0x00100000) /* Receive Short Frames */
632#define FCC_PSMR_CAM ((uint)0x00000400) /* CAM enable */
633#define FCC_PSMR_BRO ((uint)0x00000200) /* Broadcast pkt discard */
634#define FCC_PSMR_ENCRC ((uint)0x00000080) /* Use 32-bit CRC */
635
636/* IIC parameter RAM.
637*/
638typedef struct iic {
639 ushort iic_rbase; /* Rx Buffer descriptor base address */
640 ushort iic_tbase; /* Tx Buffer descriptor base address */
641 u_char iic_rfcr; /* Rx function code */
642 u_char iic_tfcr; /* Tx function code */
643 ushort iic_mrblr; /* Max receive buffer length */
644 uint iic_rstate; /* Internal */
645 uint iic_rdp; /* Internal */
646 ushort iic_rbptr; /* Internal */
647 ushort iic_rbc; /* Internal */
648 uint iic_rxtmp; /* Internal */
649 uint iic_tstate; /* Internal */
650 uint iic_tdp; /* Internal */
651 ushort iic_tbptr; /* Internal */
652 ushort iic_tbc; /* Internal */
653 uint iic_txtmp; /* Internal */
654} iic_t;
655
656/* SPI parameter RAM.
657*/
658typedef struct spi {
659 ushort spi_rbase; /* Rx Buffer descriptor base address */
660 ushort spi_tbase; /* Tx Buffer descriptor base address */
661 u_char spi_rfcr; /* Rx function code */
662 u_char spi_tfcr; /* Tx function code */
663 ushort spi_mrblr; /* Max receive buffer length */
664 uint spi_rstate; /* Internal */
665 uint spi_rdp; /* Internal */
666 ushort spi_rbptr; /* Internal */
667 ushort spi_rbc; /* Internal */
668 uint spi_rxtmp; /* Internal */
669 uint spi_tstate; /* Internal */
670 uint spi_tdp; /* Internal */
671 ushort spi_tbptr; /* Internal */
672 ushort spi_tbc; /* Internal */
673 uint spi_txtmp; /* Internal */
674 uint spi_res; /* Tx temp. */
675 uint spi_res1[4]; /* SDMA temp. */
676} spi_t;
677
678/* SPI Mode register.
679*/
680#define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
681#define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
682#define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
683#define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
684#define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
685#define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
686#define SPMODE_EN ((ushort)0x0100) /* Enable */
687#define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
688#define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
689
690#define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)
691#define SPMODE_PM(x) ((x) &0xF)
692
693#define SPI_EB ((u_char)0x10) /* big endian byte order */
694
695/* IDMA parameter RAM
696*/
697typedef struct idma {
698 ushort ibase; /* IDMA buffer descriptor table base address */
699 ushort dcm; /* DMA channel mode */
700 ushort ibdptr; /* IDMA current buffer descriptor pointer */
701 ushort dpr_buf; /* IDMA transfer buffer base address */
702 ushort buf_inv; /* internal buffer inventory */
703 ushort ss_max; /* steady-state maximum transfer size */
704 ushort dpr_in_ptr; /* write pointer inside the internal buffer */
705 ushort sts; /* source transfer size */
706 ushort dpr_out_ptr; /* read pointer inside the internal buffer */
707 ushort seob; /* source end of burst */
708 ushort deob; /* destination end of burst */
709 ushort dts; /* destination transfer size */
710 ushort ret_add; /* return address when working in ERM=1 mode */
711 ushort res0; /* reserved */
712 uint bd_cnt; /* internal byte count */
713 uint s_ptr; /* source internal data pointer */
714 uint d_ptr; /* destination internal data pointer */
715 uint istate; /* internal state */
716 u_char res1[20]; /* pad to 64-byte length */
717} idma_t;
718
719/* DMA channel mode bit fields
720*/
721#define IDMA_DCM_FB ((ushort)0x8000) /* fly-by mode */
722#define IDMA_DCM_LP ((ushort)0x4000) /* low priority */
723#define IDMA_DCM_TC2 ((ushort)0x0400) /* value driven on TC[2] */
724#define IDMA_DCM_DMA_WRAP_MASK ((ushort)0x01c0) /* mask for DMA wrap */
725#define IDMA_DCM_DMA_WRAP_64 ((ushort)0x0000) /* 64-byte DMA xfer buffer */
726#define IDMA_DCM_DMA_WRAP_128 ((ushort)0x0040) /* 128-byte DMA xfer buffer */
727#define IDMA_DCM_DMA_WRAP_256 ((ushort)0x0080) /* 256-byte DMA xfer buffer */
728#define IDMA_DCM_DMA_WRAP_512 ((ushort)0x00c0) /* 512-byte DMA xfer buffer */
729#define IDMA_DCM_DMA_WRAP_1024 ((ushort)0x0100) /* 1024-byte DMA xfer buffer */
730#define IDMA_DCM_DMA_WRAP_2048 ((ushort)0x0140) /* 2048-byte DMA xfer buffer */
731#define IDMA_DCM_SINC ((ushort)0x0020) /* source inc addr */
732#define IDMA_DCM_DINC ((ushort)0x0010) /* destination inc addr */
733#define IDMA_DCM_ERM ((ushort)0x0008) /* external request mode */
734#define IDMA_DCM_DT ((ushort)0x0004) /* DONE treatment */
735#define IDMA_DCM_SD_MASK ((ushort)0x0003) /* mask for SD bit field */
736#define IDMA_DCM_SD_MEM2MEM ((ushort)0x0000) /* memory-to-memory xfer */
737#define IDMA_DCM_SD_PER2MEM ((ushort)0x0002) /* peripheral-to-memory xfer */
738#define IDMA_DCM_SD_MEM2PER ((ushort)0x0001) /* memory-to-peripheral xfer */
739
740/* IDMA Buffer Descriptors
741*/
742typedef struct idma_bd {
743 uint flags;
744 uint len; /* data length */
745 uint src; /* source data buffer pointer */
746 uint dst; /* destination data buffer pointer */
747} idma_bd_t;
748
749/* IDMA buffer descriptor flag bit fields
750*/
751#define IDMA_BD_V ((uint)0x80000000) /* valid */
752#define IDMA_BD_W ((uint)0x20000000) /* wrap */
753#define IDMA_BD_I ((uint)0x10000000) /* interrupt */
754#define IDMA_BD_L ((uint)0x08000000) /* last */
755#define IDMA_BD_CM ((uint)0x02000000) /* continuous mode */
756#define IDMA_BD_SDN ((uint)0x00400000) /* source done */
757#define IDMA_BD_DDN ((uint)0x00200000) /* destination done */
758#define IDMA_BD_DGBL ((uint)0x00100000) /* destination global */
759#define IDMA_BD_DBO_LE ((uint)0x00040000) /* little-end dest byte order */
760#define IDMA_BD_DBO_BE ((uint)0x00080000) /* big-end dest byte order */
761#define IDMA_BD_DDTB ((uint)0x00010000) /* destination data bus */
762#define IDMA_BD_SGBL ((uint)0x00002000) /* source global */
763#define IDMA_BD_SBO_LE ((uint)0x00000800) /* little-end src byte order */
764#define IDMA_BD_SBO_BE ((uint)0x00001000) /* big-end src byte order */
765#define IDMA_BD_SDTB ((uint)0x00000200) /* source data bus */
766
767/* per-channel IDMA registers
768*/
769typedef struct im_idma {
770 u_char idsr; /* IDMAn event status register */
771 u_char res0[3];
772 u_char idmr; /* IDMAn event mask register */
773 u_char res1[3];
774} im_idma_t;
775
776/* IDMA event register bit fields
777*/
778#define IDMA_EVENT_SC ((unsigned char)0x08) /* stop completed */
779#define IDMA_EVENT_OB ((unsigned char)0x04) /* out of buffers */
780#define IDMA_EVENT_EDN ((unsigned char)0x02) /* external DONE asserted */
781#define IDMA_EVENT_BC ((unsigned char)0x01) /* buffer descriptor complete */
782
783/* RISC Controller Configuration Register (RCCR) bit fields
784*/
785#define RCCR_TIME ((uint)0x80000000) /* timer enable */
786#define RCCR_TIMEP_MASK ((uint)0x3f000000) /* mask for timer period bit field */
787#define RCCR_DR0M ((uint)0x00800000) /* IDMA0 request mode */
788#define RCCR_DR1M ((uint)0x00400000) /* IDMA1 request mode */
789#define RCCR_DR2M ((uint)0x00000080) /* IDMA2 request mode */
790#define RCCR_DR3M ((uint)0x00000040) /* IDMA3 request mode */
791#define RCCR_DR0QP_MASK ((uint)0x00300000) /* mask for IDMA0 req priority */
792#define RCCR_DR0QP_HIGH ((uint)0x00000000) /* IDMA0 has high req priority */
793#define RCCR_DR0QP_MED ((uint)0x00100000) /* IDMA0 has medium req priority */
794#define RCCR_DR0QP_LOW ((uint)0x00200000) /* IDMA0 has low req priority */
795#define RCCR_DR1QP_MASK ((uint)0x00030000) /* mask for IDMA1 req priority */
796#define RCCR_DR1QP_HIGH ((uint)0x00000000) /* IDMA1 has high req priority */
797#define RCCR_DR1QP_MED ((uint)0x00010000) /* IDMA1 has medium req priority */
798#define RCCR_DR1QP_LOW ((uint)0x00020000) /* IDMA1 has low req priority */
799#define RCCR_DR2QP_MASK ((uint)0x00000030) /* mask for IDMA2 req priority */
800#define RCCR_DR2QP_HIGH ((uint)0x00000000) /* IDMA2 has high req priority */
801#define RCCR_DR2QP_MED ((uint)0x00000010) /* IDMA2 has medium req priority */
802#define RCCR_DR2QP_LOW ((uint)0x00000020) /* IDMA2 has low req priority */
803#define RCCR_DR3QP_MASK ((uint)0x00000003) /* mask for IDMA3 req priority */
804#define RCCR_DR3QP_HIGH ((uint)0x00000000) /* IDMA3 has high req priority */
805#define RCCR_DR3QP_MED ((uint)0x00000001) /* IDMA3 has medium req priority */
806#define RCCR_DR3QP_LOW ((uint)0x00000002) /* IDMA3 has low req priority */
807#define RCCR_EIE ((uint)0x00080000) /* external interrupt enable */
808#define RCCR_SCD ((uint)0x00040000) /* scheduler configuration */
809#define RCCR_ERAM_MASK ((uint)0x0000e000) /* mask for enable RAM microcode */
810#define RCCR_ERAM_0KB ((uint)0x00000000) /* use 0KB of dpram for microcode */
811#define RCCR_ERAM_2KB ((uint)0x00002000) /* use 2KB of dpram for microcode */
812#define RCCR_ERAM_4KB ((uint)0x00004000) /* use 4KB of dpram for microcode */
813#define RCCR_ERAM_6KB ((uint)0x00006000) /* use 6KB of dpram for microcode */
814#define RCCR_ERAM_8KB ((uint)0x00008000) /* use 8KB of dpram for microcode */
815#define RCCR_ERAM_10KB ((uint)0x0000a000) /* use 10KB of dpram for microcode */
816#define RCCR_ERAM_12KB ((uint)0x0000c000) /* use 12KB of dpram for microcode */
817#define RCCR_EDM0 ((uint)0x00000800) /* DREQ0 edge detect mode */
818#define RCCR_EDM1 ((uint)0x00000400) /* DREQ1 edge detect mode */
819#define RCCR_EDM2 ((uint)0x00000200) /* DREQ2 edge detect mode */
820#define RCCR_EDM3 ((uint)0x00000100) /* DREQ3 edge detect mode */
821#define RCCR_DEM01 ((uint)0x00000008) /* DONE0/DONE1 edge detect mode */
822#define RCCR_DEM23 ((uint)0x00000004) /* DONE2/DONE3 edge detect mode */
823
824/*-----------------------------------------------------------------------
825 * CMXFCR - CMX FCC Clock Route Register
826 */
827#define CMXFCR_FC1 0x40000000 /* FCC1 connection */
828#define CMXFCR_RF1CS_MSK 0x38000000 /* Receive FCC1 Clock Source Mask */
829#define CMXFCR_TF1CS_MSK 0x07000000 /* Transmit FCC1 Clock Source Mask */
830#define CMXFCR_FC2 0x00400000 /* FCC2 connection */
831#define CMXFCR_RF2CS_MSK 0x00380000 /* Receive FCC2 Clock Source Mask */
832#define CMXFCR_TF2CS_MSK 0x00070000 /* Transmit FCC2 Clock Source Mask */
833#define CMXFCR_FC3 0x00004000 /* FCC3 connection */
834#define CMXFCR_RF3CS_MSK 0x00003800 /* Receive FCC3 Clock Source Mask */
835#define CMXFCR_TF3CS_MSK 0x00000700 /* Transmit FCC3 Clock Source Mask */
836
837#define CMXFCR_RF1CS_BRG5 0x00000000 /* Receive FCC1 Clock Source is BRG5 */
838#define CMXFCR_RF1CS_BRG6 0x08000000 /* Receive FCC1 Clock Source is BRG6 */
839#define CMXFCR_RF1CS_BRG7 0x10000000 /* Receive FCC1 Clock Source is BRG7 */
840#define CMXFCR_RF1CS_BRG8 0x18000000 /* Receive FCC1 Clock Source is BRG8 */
841#define CMXFCR_RF1CS_CLK9 0x20000000 /* Receive FCC1 Clock Source is CLK9 */
842#define CMXFCR_RF1CS_CLK10 0x28000000 /* Receive FCC1 Clock Source is CLK10 */
843#define CMXFCR_RF1CS_CLK11 0x30000000 /* Receive FCC1 Clock Source is CLK11 */
844#define CMXFCR_RF1CS_CLK12 0x38000000 /* Receive FCC1 Clock Source is CLK12 */
845
846#define CMXFCR_TF1CS_BRG5 0x00000000 /* Transmit FCC1 Clock Source is BRG5 */
847#define CMXFCR_TF1CS_BRG6 0x01000000 /* Transmit FCC1 Clock Source is BRG6 */
848#define CMXFCR_TF1CS_BRG7 0x02000000 /* Transmit FCC1 Clock Source is BRG7 */
849#define CMXFCR_TF1CS_BRG8 0x03000000 /* Transmit FCC1 Clock Source is BRG8 */
850#define CMXFCR_TF1CS_CLK9 0x04000000 /* Transmit FCC1 Clock Source is CLK9 */
851#define CMXFCR_TF1CS_CLK10 0x05000000 /* Transmit FCC1 Clock Source is CLK10 */
852#define CMXFCR_TF1CS_CLK11 0x06000000 /* Transmit FCC1 Clock Source is CLK11 */
853#define CMXFCR_TF1CS_CLK12 0x07000000 /* Transmit FCC1 Clock Source is CLK12 */
854
855#define CMXFCR_RF2CS_BRG5 0x00000000 /* Receive FCC2 Clock Source is BRG5 */
856#define CMXFCR_RF2CS_BRG6 0x00080000 /* Receive FCC2 Clock Source is BRG6 */
857#define CMXFCR_RF2CS_BRG7 0x00100000 /* Receive FCC2 Clock Source is BRG7 */
858#define CMXFCR_RF2CS_BRG8 0x00180000 /* Receive FCC2 Clock Source is BRG8 */
859#define CMXFCR_RF2CS_CLK13 0x00200000 /* Receive FCC2 Clock Source is CLK13 */
860#define CMXFCR_RF2CS_CLK14 0x00280000 /* Receive FCC2 Clock Source is CLK14 */
861#define CMXFCR_RF2CS_CLK15 0x00300000 /* Receive FCC2 Clock Source is CLK15 */
862#define CMXFCR_RF2CS_CLK16 0x00380000 /* Receive FCC2 Clock Source is CLK16 */
863
864#define CMXFCR_TF2CS_BRG5 0x00000000 /* Transmit FCC2 Clock Source is BRG5 */
865#define CMXFCR_TF2CS_BRG6 0x00010000 /* Transmit FCC2 Clock Source is BRG6 */
866#define CMXFCR_TF2CS_BRG7 0x00020000 /* Transmit FCC2 Clock Source is BRG7 */
867#define CMXFCR_TF2CS_BRG8 0x00030000 /* Transmit FCC2 Clock Source is BRG8 */
868#define CMXFCR_TF2CS_CLK13 0x00040000 /* Transmit FCC2 Clock Source is CLK13 */
869#define CMXFCR_TF2CS_CLK14 0x00050000 /* Transmit FCC2 Clock Source is CLK14 */
870#define CMXFCR_TF2CS_CLK15 0x00060000 /* Transmit FCC2 Clock Source is CLK15 */
871#define CMXFCR_TF2CS_CLK16 0x00070000 /* Transmit FCC2 Clock Source is CLK16 */
872
873#define CMXFCR_RF3CS_BRG5 0x00000000 /* Receive FCC3 Clock Source is BRG5 */
874#define CMXFCR_RF3CS_BRG6 0x00000800 /* Receive FCC3 Clock Source is BRG6 */
875#define CMXFCR_RF3CS_BRG7 0x00001000 /* Receive FCC3 Clock Source is BRG7 */
876#define CMXFCR_RF3CS_BRG8 0x00001800 /* Receive FCC3 Clock Source is BRG8 */
877#define CMXFCR_RF3CS_CLK13 0x00002000 /* Receive FCC3 Clock Source is CLK13 */
878#define CMXFCR_RF3CS_CLK14 0x00002800 /* Receive FCC3 Clock Source is CLK14 */
879#define CMXFCR_RF3CS_CLK15 0x00003000 /* Receive FCC3 Clock Source is CLK15 */
880#define CMXFCR_RF3CS_CLK16 0x00003800 /* Receive FCC3 Clock Source is CLK16 */
881
882#define CMXFCR_TF3CS_BRG5 0x00000000 /* Transmit FCC3 Clock Source is BRG5 */
883#define CMXFCR_TF3CS_BRG6 0x00000100 /* Transmit FCC3 Clock Source is BRG6 */
884#define CMXFCR_TF3CS_BRG7 0x00000200 /* Transmit FCC3 Clock Source is BRG7 */
885#define CMXFCR_TF3CS_BRG8 0x00000300 /* Transmit FCC3 Clock Source is BRG8 */
886#define CMXFCR_TF3CS_CLK13 0x00000400 /* Transmit FCC3 Clock Source is CLK13 */
887#define CMXFCR_TF3CS_CLK14 0x00000500 /* Transmit FCC3 Clock Source is CLK14 */
888#define CMXFCR_TF3CS_CLK15 0x00000600 /* Transmit FCC3 Clock Source is CLK15 */
889#define CMXFCR_TF3CS_CLK16 0x00000700 /* Transmit FCC3 Clock Source is CLK16 */
890
891/*-----------------------------------------------------------------------
892 * CMXSCR - CMX SCC Clock Route Register
893 */
894#define CMXSCR_GR1 0x80000000 /* Grant Support of SCC1 */
895#define CMXSCR_SC1 0x40000000 /* SCC1 connection */
896#define CMXSCR_RS1CS_MSK 0x38000000 /* Receive SCC1 Clock Source Mask */
897#define CMXSCR_TS1CS_MSK 0x07000000 /* Transmit SCC1 Clock Source Mask */
898#define CMXSCR_GR2 0x00800000 /* Grant Support of SCC2 */
899#define CMXSCR_SC2 0x00400000 /* SCC2 connection */
900#define CMXSCR_RS2CS_MSK 0x00380000 /* Receive SCC2 Clock Source Mask */
901#define CMXSCR_TS2CS_MSK 0x00070000 /* Transmit SCC2 Clock Source Mask */
902#define CMXSCR_GR3 0x00008000 /* Grant Support of SCC3 */
903#define CMXSCR_SC3 0x00004000 /* SCC3 connection */
904#define CMXSCR_RS3CS_MSK 0x00003800 /* Receive SCC3 Clock Source Mask */
905#define CMXSCR_TS3CS_MSK 0x00000700 /* Transmit SCC3 Clock Source Mask */
906#define CMXSCR_GR4 0x00000080 /* Grant Support of SCC4 */
907#define CMXSCR_SC4 0x00000040 /* SCC4 connection */
908#define CMXSCR_RS4CS_MSK 0x00000038 /* Receive SCC4 Clock Source Mask */
909#define CMXSCR_TS4CS_MSK 0x00000007 /* Transmit SCC4 Clock Source Mask */
910
911#define CMXSCR_RS1CS_BRG1 0x00000000 /* SCC1 Rx Clock Source is BRG1 */
912#define CMXSCR_RS1CS_BRG2 0x08000000 /* SCC1 Rx Clock Source is BRG2 */
913#define CMXSCR_RS1CS_BRG3 0x10000000 /* SCC1 Rx Clock Source is BRG3 */
914#define CMXSCR_RS1CS_BRG4 0x18000000 /* SCC1 Rx Clock Source is BRG4 */
915#define CMXSCR_RS1CS_CLK11 0x20000000 /* SCC1 Rx Clock Source is CLK11 */
916#define CMXSCR_RS1CS_CLK12 0x28000000 /* SCC1 Rx Clock Source is CLK12 */
917#define CMXSCR_RS1CS_CLK3 0x30000000 /* SCC1 Rx Clock Source is CLK3 */
918#define CMXSCR_RS1CS_CLK4 0x38000000 /* SCC1 Rx Clock Source is CLK4 */
919
920#define CMXSCR_TS1CS_BRG1 0x00000000 /* SCC1 Tx Clock Source is BRG1 */
921#define CMXSCR_TS1CS_BRG2 0x01000000 /* SCC1 Tx Clock Source is BRG2 */
922#define CMXSCR_TS1CS_BRG3 0x02000000 /* SCC1 Tx Clock Source is BRG3 */
923#define CMXSCR_TS1CS_BRG4 0x03000000 /* SCC1 Tx Clock Source is BRG4 */
924#define CMXSCR_TS1CS_CLK11 0x04000000 /* SCC1 Tx Clock Source is CLK11 */
925#define CMXSCR_TS1CS_CLK12 0x05000000 /* SCC1 Tx Clock Source is CLK12 */
926#define CMXSCR_TS1CS_CLK3 0x06000000 /* SCC1 Tx Clock Source is CLK3 */
927#define CMXSCR_TS1CS_CLK4 0x07000000 /* SCC1 Tx Clock Source is CLK4 */
928
929#define CMXSCR_RS2CS_BRG1 0x00000000 /* SCC2 Rx Clock Source is BRG1 */
930#define CMXSCR_RS2CS_BRG2 0x00080000 /* SCC2 Rx Clock Source is BRG2 */
931#define CMXSCR_RS2CS_BRG3 0x00100000 /* SCC2 Rx Clock Source is BRG3 */
932#define CMXSCR_RS2CS_BRG4 0x00180000 /* SCC2 Rx Clock Source is BRG4 */
933#define CMXSCR_RS2CS_CLK11 0x00200000 /* SCC2 Rx Clock Source is CLK11 */
934#define CMXSCR_RS2CS_CLK12 0x00280000 /* SCC2 Rx Clock Source is CLK12 */
935#define CMXSCR_RS2CS_CLK3 0x00300000 /* SCC2 Rx Clock Source is CLK3 */
936#define CMXSCR_RS2CS_CLK4 0x00380000 /* SCC2 Rx Clock Source is CLK4 */
937
938#define CMXSCR_TS2CS_BRG1 0x00000000 /* SCC2 Tx Clock Source is BRG1 */
939#define CMXSCR_TS2CS_BRG2 0x00010000 /* SCC2 Tx Clock Source is BRG2 */
940#define CMXSCR_TS2CS_BRG3 0x00020000 /* SCC2 Tx Clock Source is BRG3 */
941#define CMXSCR_TS2CS_BRG4 0x00030000 /* SCC2 Tx Clock Source is BRG4 */
942#define CMXSCR_TS2CS_CLK11 0x00040000 /* SCC2 Tx Clock Source is CLK11 */
943#define CMXSCR_TS2CS_CLK12 0x00050000 /* SCC2 Tx Clock Source is CLK12 */
944#define CMXSCR_TS2CS_CLK3 0x00060000 /* SCC2 Tx Clock Source is CLK3 */
945#define CMXSCR_TS2CS_CLK4 0x00070000 /* SCC2 Tx Clock Source is CLK4 */
946
947#define CMXSCR_RS3CS_BRG1 0x00000000 /* SCC3 Rx Clock Source is BRG1 */
948#define CMXSCR_RS3CS_BRG2 0x00000800 /* SCC3 Rx Clock Source is BRG2 */
949#define CMXSCR_RS3CS_BRG3 0x00001000 /* SCC3 Rx Clock Source is BRG3 */
950#define CMXSCR_RS3CS_BRG4 0x00001800 /* SCC3 Rx Clock Source is BRG4 */
951#define CMXSCR_RS3CS_CLK5 0x00002000 /* SCC3 Rx Clock Source is CLK5 */
952#define CMXSCR_RS3CS_CLK6 0x00002800 /* SCC3 Rx Clock Source is CLK6 */
953#define CMXSCR_RS3CS_CLK7 0x00003000 /* SCC3 Rx Clock Source is CLK7 */
954#define CMXSCR_RS3CS_CLK8 0x00003800 /* SCC3 Rx Clock Source is CLK8 */
955
956#define CMXSCR_TS3CS_BRG1 0x00000000 /* SCC3 Tx Clock Source is BRG1 */
957#define CMXSCR_TS3CS_BRG2 0x00000100 /* SCC3 Tx Clock Source is BRG2 */
958#define CMXSCR_TS3CS_BRG3 0x00000200 /* SCC3 Tx Clock Source is BRG3 */
959#define CMXSCR_TS3CS_BRG4 0x00000300 /* SCC3 Tx Clock Source is BRG4 */
960#define CMXSCR_TS3CS_CLK5 0x00000400 /* SCC3 Tx Clock Source is CLK5 */
961#define CMXSCR_TS3CS_CLK6 0x00000500 /* SCC3 Tx Clock Source is CLK6 */
962#define CMXSCR_TS3CS_CLK7 0x00000600 /* SCC3 Tx Clock Source is CLK7 */
963#define CMXSCR_TS3CS_CLK8 0x00000700 /* SCC3 Tx Clock Source is CLK8 */
964
965#define CMXSCR_RS4CS_BRG1 0x00000000 /* SCC4 Rx Clock Source is BRG1 */
966#define CMXSCR_RS4CS_BRG2 0x00000008 /* SCC4 Rx Clock Source is BRG2 */
967#define CMXSCR_RS4CS_BRG3 0x00000010 /* SCC4 Rx Clock Source is BRG3 */
968#define CMXSCR_RS4CS_BRG4 0x00000018 /* SCC4 Rx Clock Source is BRG4 */
969#define CMXSCR_RS4CS_CLK5 0x00000020 /* SCC4 Rx Clock Source is CLK5 */
970#define CMXSCR_RS4CS_CLK6 0x00000028 /* SCC4 Rx Clock Source is CLK6 */
971#define CMXSCR_RS4CS_CLK7 0x00000030 /* SCC4 Rx Clock Source is CLK7 */
972#define CMXSCR_RS4CS_CLK8 0x00000038 /* SCC4 Rx Clock Source is CLK8 */
973
974#define CMXSCR_TS4CS_BRG1 0x00000000 /* SCC4 Tx Clock Source is BRG1 */
975#define CMXSCR_TS4CS_BRG2 0x00000001 /* SCC4 Tx Clock Source is BRG2 */
976#define CMXSCR_TS4CS_BRG3 0x00000002 /* SCC4 Tx Clock Source is BRG3 */
977#define CMXSCR_TS4CS_BRG4 0x00000003 /* SCC4 Tx Clock Source is BRG4 */
978#define CMXSCR_TS4CS_CLK5 0x00000004 /* SCC4 Tx Clock Source is CLK5 */
979#define CMXSCR_TS4CS_CLK6 0x00000005 /* SCC4 Tx Clock Source is CLK6 */
980#define CMXSCR_TS4CS_CLK7 0x00000006 /* SCC4 Tx Clock Source is CLK7 */
981#define CMXSCR_TS4CS_CLK8 0x00000007 /* SCC4 Tx Clock Source is CLK8 */
982
983/*-----------------------------------------------------------------------
984 * SIUMCR - SIU Module Configuration Register 4-31
985 */
986#define SIUMCR_BBD 0x80000000 /* Bus Busy Disable */
987#define SIUMCR_ESE 0x40000000 /* External Snoop Enable */
988#define SIUMCR_PBSE 0x20000000 /* Parity Byte Select Enable */
989#define SIUMCR_CDIS 0x10000000 /* Core Disable */
990#define SIUMCR_DPPC00 0x00000000 /* Data Parity Pins Configuration*/
991#define SIUMCR_DPPC01 0x04000000 /* - " - */
992#define SIUMCR_DPPC10 0x08000000 /* - " - */
993#define SIUMCR_DPPC11 0x0c000000 /* - " - */
994#define SIUMCR_L2CPC00 0x00000000 /* L2 Cache Pins Configuration */
995#define SIUMCR_L2CPC01 0x01000000 /* - " - */
996#define SIUMCR_L2CPC10 0x02000000 /* - " - */
997#define SIUMCR_L2CPC11 0x03000000 /* - " - */
998#define SIUMCR_LBPC00 0x00000000 /* Local Bus Pins Configuration */
999#define SIUMCR_LBPC01 0x00400000 /* - " - */
1000#define SIUMCR_LBPC10 0x00800000 /* - " - */
1001#define SIUMCR_LBPC11 0x00c00000 /* - " - */
1002#define SIUMCR_APPC00 0x00000000 /* Address Parity Pins Configuration*/
1003#define SIUMCR_APPC01 0x00100000 /* - " - */
1004#define SIUMCR_APPC10 0x00200000 /* - " - */
1005#define SIUMCR_APPC11 0x00300000 /* - " - */
1006#define SIUMCR_CS10PC00 0x00000000 /* CS10 Pin Configuration */
1007#define SIUMCR_CS10PC01 0x00040000 /* - " - */
1008#define SIUMCR_CS10PC10 0x00080000 /* - " - */
1009#define SIUMCR_CS10PC11 0x000c0000 /* - " - */
1010#define SIUMCR_BCTLC00 0x00000000 /* Buffer Control Configuration */
1011#define SIUMCR_BCTLC01 0x00010000 /* - " - */
1012#define SIUMCR_BCTLC10 0x00020000 /* - " - */
1013#define SIUMCR_BCTLC11 0x00030000 /* - " - */
1014#define SIUMCR_MMR00 0x00000000 /* Mask Masters Requests */
1015#define SIUMCR_MMR01 0x00004000 /* - " - */
1016#define SIUMCR_MMR10 0x00008000 /* - " - */
1017#define SIUMCR_MMR11 0x0000c000 /* - " - */
1018#define SIUMCR_LPBSE 0x00002000 /* LocalBus Parity Byte Select Enable*/
1019
1020/*-----------------------------------------------------------------------
1021 * SCCR - System Clock Control Register 9-8
1022*/
1023#define SCCR_PCI_MODE 0x00000100 /* PCI Mode */
1024#define SCCR_PCI_MODCK 0x00000080 /* Value of PCI_MODCK pin */
1025#define SCCR_PCIDF_MSK 0x00000078 /* PCI division factor */
1026#define SCCR_PCIDF_SHIFT 3
1027
1028#ifndef CPM_IMMR_OFFSET
1029#define CPM_IMMR_OFFSET 0x101a8
1030#endif
1031
1032#define FCC_PSMR_RMII ((uint)0x00020000) /* Use RMII interface */
1033
1034/* FCC iop & clock configuration. BSP code is responsible to define Fx_RXCLK & Fx_TXCLK
1035 * in order to use clock-computing stuff below for the FCC x
1036 */
1037
1038/* Automatically generates register configurations */
1039#define PC_CLK(x) ((uint)(1<<(x-1))) /* FCC CLK I/O ports */
1040
1041#define CMXFCR_RF1CS(x) ((uint)((x-5)<<27)) /* FCC1 Receive Clock Source */
1042#define CMXFCR_TF1CS(x) ((uint)((x-5)<<24)) /* FCC1 Transmit Clock Source */
1043#define CMXFCR_RF2CS(x) ((uint)((x-9)<<19)) /* FCC2 Receive Clock Source */
1044#define CMXFCR_TF2CS(x) ((uint)((x-9)<<16)) /* FCC2 Transmit Clock Source */
1045#define CMXFCR_RF3CS(x) ((uint)((x-9)<<11)) /* FCC3 Receive Clock Source */
1046#define CMXFCR_TF3CS(x) ((uint)((x-9)<<8)) /* FCC3 Transmit Clock Source */
1047
1048#define PC_F1RXCLK PC_CLK(F1_RXCLK)
1049#define PC_F1TXCLK PC_CLK(F1_TXCLK)
1050#define CMX1_CLK_ROUTE (CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK))
1051#define CMX1_CLK_MASK ((uint)0xff000000)
1052
1053#define PC_F2RXCLK PC_CLK(F2_RXCLK)
1054#define PC_F2TXCLK PC_CLK(F2_TXCLK)
1055#define CMX2_CLK_ROUTE (CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK))
1056#define CMX2_CLK_MASK ((uint)0x00ff0000)
1057
1058#define PC_F3RXCLK PC_CLK(F3_RXCLK)
1059#define PC_F3TXCLK PC_CLK(F3_TXCLK)
1060#define CMX3_CLK_ROUTE (CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK))
1061#define CMX3_CLK_MASK ((uint)0x0000ff00)
1062
1063#define CPMUX_CLK_MASK (CMX3_CLK_MASK | CMX2_CLK_MASK)
1064#define CPMUX_CLK_ROUTE (CMX3_CLK_ROUTE | CMX2_CLK_ROUTE)
1065
1066#define CLK_TRX (PC_F3TXCLK | PC_F3RXCLK | PC_F2TXCLK | PC_F2RXCLK)
1067
1068/* I/O Pin assignment for FCC1. I don't yet know the best way to do this,
1069 * but there is little variation among the choices.
1070 */
1071#define PA1_COL 0x00000001U
1072#define PA1_CRS 0x00000002U
1073#define PA1_TXER 0x00000004U
1074#define PA1_TXEN 0x00000008U
1075#define PA1_RXDV 0x00000010U
1076#define PA1_RXER 0x00000020U
1077#define PA1_TXDAT 0x00003c00U
1078#define PA1_RXDAT 0x0003c000U
1079#define PA1_PSORA0 (PA1_RXDAT | PA1_TXDAT)
1080#define PA1_PSORA1 (PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \
1081 PA1_RXDV | PA1_RXER)
1082#define PA1_DIRA0 (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV)
1083#define PA1_DIRA1 (PA1_TXDAT | PA1_TXEN | PA1_TXER)
1084
1085
1086/* I/O Pin assignment for FCC2. I don't yet know the best way to do this,
1087 * but there is little variation among the choices.
1088 */
1089#define PB2_TXER 0x00000001U
1090#define PB2_RXDV 0x00000002U
1091#define PB2_TXEN 0x00000004U
1092#define PB2_RXER 0x00000008U
1093#define PB2_COL 0x00000010U
1094#define PB2_CRS 0x00000020U
1095#define PB2_TXDAT 0x000003c0U
1096#define PB2_RXDAT 0x00003c00U
1097#define PB2_PSORB0 (PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \
1098 PB2_RXER | PB2_RXDV | PB2_TXER)
1099#define PB2_PSORB1 (PB2_TXEN)
1100#define PB2_DIRB0 (PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV)
1101#define PB2_DIRB1 (PB2_TXDAT | PB2_TXEN | PB2_TXER)
1102
1103
1104/* I/O Pin assignment for FCC3. I don't yet know the best way to do this,
1105 * but there is little variation among the choices.
1106 */
1107#define PB3_RXDV 0x00004000U
1108#define PB3_RXER 0x00008000U
1109#define PB3_TXER 0x00010000U
1110#define PB3_TXEN 0x00020000U
1111#define PB3_COL 0x00040000U
1112#define PB3_CRS 0x00080000U
1113#define PB3_TXDAT 0x0f000000U
1114#define PC3_TXDAT 0x00000010U
1115#define PB3_RXDAT 0x00f00000U
1116#define PB3_PSORB0 (PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \
1117 PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN)
1118#define PB3_PSORB1 0
1119#define PB3_DIRB0 (PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV)
1120#define PB3_DIRB1 (PB3_TXDAT | PB3_TXEN | PB3_TXER)
1121#define PC3_DIRC1 (PC3_TXDAT)
1122
1123/* Handy macro to specify mem for FCCs*/
1124#define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128))
1125#define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0)
1126#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1)
1127#define FCC3_MEM_OFFSET FCC_MEM_OFFSET(2)
1128
1129/* Clocks and GRG's */
1130
1131enum cpm_clk_dir {
1132 CPM_CLK_RX,
1133 CPM_CLK_TX,
1134 CPM_CLK_RTX
1135};
1136
1137enum cpm_clk_target {
1138 CPM_CLK_SCC1,
1139 CPM_CLK_SCC2,
1140 CPM_CLK_SCC3,
1141 CPM_CLK_SCC4,
1142 CPM_CLK_FCC1,
1143 CPM_CLK_FCC2,
1144 CPM_CLK_FCC3,
1145 CPM_CLK_SMC1,
1146 CPM_CLK_SMC2,
1147};
1148
1149enum cpm_clk {
1150 CPM_CLK_NONE = 0,
1151 CPM_BRG1, /* Baud Rate Generator 1 */
1152 CPM_BRG2, /* Baud Rate Generator 2 */
1153 CPM_BRG3, /* Baud Rate Generator 3 */
1154 CPM_BRG4, /* Baud Rate Generator 4 */
1155 CPM_BRG5, /* Baud Rate Generator 5 */
1156 CPM_BRG6, /* Baud Rate Generator 6 */
1157 CPM_BRG7, /* Baud Rate Generator 7 */
1158 CPM_BRG8, /* Baud Rate Generator 8 */
1159 CPM_CLK1, /* Clock 1 */
1160 CPM_CLK2, /* Clock 2 */
1161 CPM_CLK3, /* Clock 3 */
1162 CPM_CLK4, /* Clock 4 */
1163 CPM_CLK5, /* Clock 5 */
1164 CPM_CLK6, /* Clock 6 */
1165 CPM_CLK7, /* Clock 7 */
1166 CPM_CLK8, /* Clock 8 */
1167 CPM_CLK9, /* Clock 9 */
1168 CPM_CLK10, /* Clock 10 */
1169 CPM_CLK11, /* Clock 11 */
1170 CPM_CLK12, /* Clock 12 */
1171 CPM_CLK13, /* Clock 13 */
1172 CPM_CLK14, /* Clock 14 */
1173 CPM_CLK15, /* Clock 15 */
1174 CPM_CLK16, /* Clock 16 */
1175 CPM_CLK17, /* Clock 17 */
1176 CPM_CLK18, /* Clock 18 */
1177 CPM_CLK19, /* Clock 19 */
1178 CPM_CLK20, /* Clock 20 */
1179 CPM_CLK_DUMMY
1180};
1181
1182extern int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode);
1183extern int cpm2_smc_clk_setup(enum cpm_clk_target target, int clock);
1184
1185#define CPM_PIN_INPUT 0
1186#define CPM_PIN_OUTPUT 1
1187#define CPM_PIN_PRIMARY 0
1188#define CPM_PIN_SECONDARY 2
1189#define CPM_PIN_GPIO 4
1190#define CPM_PIN_OPENDRAIN 8
1191
1192void cpm2_set_pin(int port, int pin, int flags);
1193
1194#endif /* __CPM2__ */
1195#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
new file mode 100644
index 000000000000..ef8a248dfd55
--- /dev/null
+++ b/arch/powerpc/include/asm/cputable.h
@@ -0,0 +1,514 @@
1#ifndef __ASM_POWERPC_CPUTABLE_H
2#define __ASM_POWERPC_CPUTABLE_H
3
4#define PPC_FEATURE_32 0x80000000
5#define PPC_FEATURE_64 0x40000000
6#define PPC_FEATURE_601_INSTR 0x20000000
7#define PPC_FEATURE_HAS_ALTIVEC 0x10000000
8#define PPC_FEATURE_HAS_FPU 0x08000000
9#define PPC_FEATURE_HAS_MMU 0x04000000
10#define PPC_FEATURE_HAS_4xxMAC 0x02000000
11#define PPC_FEATURE_UNIFIED_CACHE 0x01000000
12#define PPC_FEATURE_HAS_SPE 0x00800000
13#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000
14#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000
15#define PPC_FEATURE_NO_TB 0x00100000
16#define PPC_FEATURE_POWER4 0x00080000
17#define PPC_FEATURE_POWER5 0x00040000
18#define PPC_FEATURE_POWER5_PLUS 0x00020000
19#define PPC_FEATURE_CELL 0x00010000
20#define PPC_FEATURE_BOOKE 0x00008000
21#define PPC_FEATURE_SMT 0x00004000
22#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
23#define PPC_FEATURE_ARCH_2_05 0x00001000
24#define PPC_FEATURE_PA6T 0x00000800
25#define PPC_FEATURE_HAS_DFP 0x00000400
26#define PPC_FEATURE_POWER6_EXT 0x00000200
27#define PPC_FEATURE_ARCH_2_06 0x00000100
28#define PPC_FEATURE_HAS_VSX 0x00000080
29
30#define PPC_FEATURE_PSERIES_PERFMON_COMPAT \
31 0x00000040
32
33#define PPC_FEATURE_TRUE_LE 0x00000002
34#define PPC_FEATURE_PPC_LE 0x00000001
35
36#ifdef __KERNEL__
37
38#include <asm/asm-compat.h>
39#include <asm/feature-fixups.h>
40
41#ifndef __ASSEMBLY__
42
43/* This structure can grow, it's real size is used by head.S code
44 * via the mkdefs mechanism.
45 */
46struct cpu_spec;
47
48typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
49typedef void (*cpu_restore_t)(void);
50
51enum powerpc_oprofile_type {
52 PPC_OPROFILE_INVALID = 0,
53 PPC_OPROFILE_RS64 = 1,
54 PPC_OPROFILE_POWER4 = 2,
55 PPC_OPROFILE_G4 = 3,
56 PPC_OPROFILE_FSL_EMB = 4,
57 PPC_OPROFILE_CELL = 5,
58 PPC_OPROFILE_PA6T = 6,
59};
60
61enum powerpc_pmc_type {
62 PPC_PMC_DEFAULT = 0,
63 PPC_PMC_IBM = 1,
64 PPC_PMC_PA6T = 2,
65};
66
67struct pt_regs;
68
69extern int machine_check_generic(struct pt_regs *regs);
70extern int machine_check_4xx(struct pt_regs *regs);
71extern int machine_check_440A(struct pt_regs *regs);
72extern int machine_check_e500(struct pt_regs *regs);
73extern int machine_check_e200(struct pt_regs *regs);
74
75/* NOTE WELL: Update identify_cpu() if fields are added or removed! */
76struct cpu_spec {
77 /* CPU is matched via (PVR & pvr_mask) == pvr_value */
78 unsigned int pvr_mask;
79 unsigned int pvr_value;
80
81 char *cpu_name;
82 unsigned long cpu_features; /* Kernel features */
83 unsigned int cpu_user_features; /* Userland features */
84
85 /* cache line sizes */
86 unsigned int icache_bsize;
87 unsigned int dcache_bsize;
88
89 /* number of performance monitor counters */
90 unsigned int num_pmcs;
91 enum powerpc_pmc_type pmc_type;
92
93 /* this is called to initialize various CPU bits like L1 cache,
94 * BHT, SPD, etc... from head.S before branching to identify_machine
95 */
96 cpu_setup_t cpu_setup;
97 /* Used to restore cpu setup on secondary processors and at resume */
98 cpu_restore_t cpu_restore;
99
100 /* Used by oprofile userspace to select the right counters */
101 char *oprofile_cpu_type;
102
103 /* Processor specific oprofile operations */
104 enum powerpc_oprofile_type oprofile_type;
105
106 /* Bit locations inside the mmcra change */
107 unsigned long oprofile_mmcra_sihv;
108 unsigned long oprofile_mmcra_sipr;
109
110 /* Bits to clear during an oprofile exception */
111 unsigned long oprofile_mmcra_clear;
112
113 /* Name of processor class, for the ELF AT_PLATFORM entry */
114 char *platform;
115
116 /* Processor specific machine check handling. Return negative
117 * if the error is fatal, 1 if it was fully recovered and 0 to
118 * pass up (not CPU originated) */
119 int (*machine_check)(struct pt_regs *regs);
120};
121
122extern struct cpu_spec *cur_cpu_spec;
123
124extern unsigned int __start___ftr_fixup, __stop___ftr_fixup;
125
126extern struct cpu_spec *identify_cpu(unsigned long offset, unsigned int pvr);
127extern void do_feature_fixups(unsigned long value, void *fixup_start,
128 void *fixup_end);
129
130extern const char *powerpc_base_platform;
131
132#endif /* __ASSEMBLY__ */
133
134/* CPU kernel features */
135
136/* Retain the 32b definitions all use bottom half of word */
137#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000000000000001)
138#define CPU_FTR_L2CR ASM_CONST(0x0000000000000002)
139#define CPU_FTR_SPEC7450 ASM_CONST(0x0000000000000004)
140#define CPU_FTR_ALTIVEC ASM_CONST(0x0000000000000008)
141#define CPU_FTR_TAU ASM_CONST(0x0000000000000010)
142#define CPU_FTR_CAN_DOZE ASM_CONST(0x0000000000000020)
143#define CPU_FTR_USE_TB ASM_CONST(0x0000000000000040)
144#define CPU_FTR_L2CSR ASM_CONST(0x0000000000000080)
145#define CPU_FTR_601 ASM_CONST(0x0000000000000100)
146#define CPU_FTR_HPTE_TABLE ASM_CONST(0x0000000000000200)
147#define CPU_FTR_CAN_NAP ASM_CONST(0x0000000000000400)
148#define CPU_FTR_L3CR ASM_CONST(0x0000000000000800)
149#define CPU_FTR_L3_DISABLE_NAP ASM_CONST(0x0000000000001000)
150#define CPU_FTR_NAP_DISABLE_L2_PR ASM_CONST(0x0000000000002000)
151#define CPU_FTR_DUAL_PLL_750FX ASM_CONST(0x0000000000004000)
152#define CPU_FTR_NO_DPM ASM_CONST(0x0000000000008000)
153#define CPU_FTR_HAS_HIGH_BATS ASM_CONST(0x0000000000010000)
154#define CPU_FTR_NEED_COHERENT ASM_CONST(0x0000000000020000)
155#define CPU_FTR_NO_BTIC ASM_CONST(0x0000000000040000)
156#define CPU_FTR_BIG_PHYS ASM_CONST(0x0000000000080000)
157#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000)
158#define CPU_FTR_PPC_LE ASM_CONST(0x0000000000200000)
159#define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000)
160#define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x0000000000800000)
161#define CPU_FTR_UNIFIED_ID_CACHE ASM_CONST(0x0000000001000000)
162#define CPU_FTR_SPE ASM_CONST(0x0000000002000000)
163#define CPU_FTR_NEED_PAIRED_STWCX ASM_CONST(0x0000000004000000)
164#define CPU_FTR_LWSYNC ASM_CONST(0x0000000008000000)
165
166/*
167 * Add the 64-bit processor unique features in the top half of the word;
168 * on 32-bit, make the names available but defined to be 0.
169 */
170#ifdef __powerpc64__
171#define LONG_ASM_CONST(x) ASM_CONST(x)
172#else
173#define LONG_ASM_CONST(x) 0
174#endif
175
176#define CPU_FTR_SLB LONG_ASM_CONST(0x0000000100000000)
177#define CPU_FTR_16M_PAGE LONG_ASM_CONST(0x0000000200000000)
178#define CPU_FTR_TLBIEL LONG_ASM_CONST(0x0000000400000000)
179#define CPU_FTR_NOEXECUTE LONG_ASM_CONST(0x0000000800000000)
180#define CPU_FTR_IABR LONG_ASM_CONST(0x0000002000000000)
181#define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000004000000000)
182#define CPU_FTR_CTRL LONG_ASM_CONST(0x0000008000000000)
183#define CPU_FTR_SMT LONG_ASM_CONST(0x0000010000000000)
184#define CPU_FTR_LOCKLESS_TLBIE LONG_ASM_CONST(0x0000040000000000)
185#define CPU_FTR_CI_LARGE_PAGE LONG_ASM_CONST(0x0000100000000000)
186#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000)
187#define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000)
188#define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000800000000000)
189#define CPU_FTR_SPURR LONG_ASM_CONST(0x0001000000000000)
190#define CPU_FTR_DSCR LONG_ASM_CONST(0x0002000000000000)
191#define CPU_FTR_1T_SEGMENT LONG_ASM_CONST(0x0004000000000000)
192#define CPU_FTR_NO_SLBIE_B LONG_ASM_CONST(0x0008000000000000)
193#define CPU_FTR_VSX LONG_ASM_CONST(0x0010000000000000)
194#define CPU_FTR_SAO LONG_ASM_CONST(0x0020000000000000)
195
196#ifndef __ASSEMBLY__
197
198#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_SLB | \
199 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \
200 CPU_FTR_NODSISRALIGN | CPU_FTR_16M_PAGE)
201
202/* We only set the altivec features if the kernel was compiled with altivec
203 * support
204 */
205#ifdef CONFIG_ALTIVEC
206#define CPU_FTR_ALTIVEC_COMP CPU_FTR_ALTIVEC
207#define PPC_FEATURE_HAS_ALTIVEC_COMP PPC_FEATURE_HAS_ALTIVEC
208#else
209#define CPU_FTR_ALTIVEC_COMP 0
210#define PPC_FEATURE_HAS_ALTIVEC_COMP 0
211#endif
212
213/* We only set the VSX features if the kernel was compiled with VSX
214 * support
215 */
216#ifdef CONFIG_VSX
217#define CPU_FTR_VSX_COMP CPU_FTR_VSX
218#define PPC_FEATURE_HAS_VSX_COMP PPC_FEATURE_HAS_VSX
219#else
220#define CPU_FTR_VSX_COMP 0
221#define PPC_FEATURE_HAS_VSX_COMP 0
222#endif
223
224/* We only set the spe features if the kernel was compiled with spe
225 * support
226 */
227#ifdef CONFIG_SPE
228#define CPU_FTR_SPE_COMP CPU_FTR_SPE
229#define PPC_FEATURE_HAS_SPE_COMP PPC_FEATURE_HAS_SPE
230#define PPC_FEATURE_HAS_EFP_SINGLE_COMP PPC_FEATURE_HAS_EFP_SINGLE
231#define PPC_FEATURE_HAS_EFP_DOUBLE_COMP PPC_FEATURE_HAS_EFP_DOUBLE
232#else
233#define CPU_FTR_SPE_COMP 0
234#define PPC_FEATURE_HAS_SPE_COMP 0
235#define PPC_FEATURE_HAS_EFP_SINGLE_COMP 0
236#define PPC_FEATURE_HAS_EFP_DOUBLE_COMP 0
237#endif
238
239/* We need to mark all pages as being coherent if we're SMP or we have a
240 * 74[45]x and an MPC107 host bridge. Also 83xx and PowerQUICC II
241 * require it for PCI "streaming/prefetch" to work properly.
242 */
243#if defined(CONFIG_SMP) || defined(CONFIG_MPC10X_BRIDGE) \
244 || defined(CONFIG_PPC_83xx) || defined(CONFIG_8260)
245#define CPU_FTR_COMMON CPU_FTR_NEED_COHERENT
246#else
247#define CPU_FTR_COMMON 0
248#endif
249
250/* The powersave features NAP & DOZE seems to confuse BDI when
251 debugging. So if a BDI is used, disable theses
252 */
253#ifndef CONFIG_BDI_SWITCH
254#define CPU_FTR_MAYBE_CAN_DOZE CPU_FTR_CAN_DOZE
255#define CPU_FTR_MAYBE_CAN_NAP CPU_FTR_CAN_NAP
256#else
257#define CPU_FTR_MAYBE_CAN_DOZE 0
258#define CPU_FTR_MAYBE_CAN_NAP 0
259#endif
260
261#define CLASSIC_PPC (!defined(CONFIG_8xx) && !defined(CONFIG_4xx) && \
262 !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4) && \
263 !defined(CONFIG_BOOKE))
264
265#define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | CPU_FTR_HPTE_TABLE | \
266 CPU_FTR_COHERENT_ICACHE | CPU_FTR_UNIFIED_ID_CACHE)
267#define CPU_FTRS_603 (CPU_FTR_COMMON | \
268 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
269 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
270#define CPU_FTRS_604 (CPU_FTR_COMMON | \
271 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_PPC_LE)
272#define CPU_FTRS_740_NOTAU (CPU_FTR_COMMON | \
273 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
274 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
275#define CPU_FTRS_740 (CPU_FTR_COMMON | \
276 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
277 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
278 CPU_FTR_PPC_LE)
279#define CPU_FTRS_750 (CPU_FTR_COMMON | \
280 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
281 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
282 CPU_FTR_PPC_LE)
283#define CPU_FTRS_750CL (CPU_FTRS_750 | CPU_FTR_HAS_HIGH_BATS)
284#define CPU_FTRS_750FX1 (CPU_FTRS_750 | CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM)
285#define CPU_FTRS_750FX2 (CPU_FTRS_750 | CPU_FTR_NO_DPM)
286#define CPU_FTRS_750FX (CPU_FTRS_750 | CPU_FTR_DUAL_PLL_750FX | \
287 CPU_FTR_HAS_HIGH_BATS)
288#define CPU_FTRS_750GX (CPU_FTRS_750FX)
289#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | \
290 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
291 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \
292 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
293#define CPU_FTRS_7400 (CPU_FTR_COMMON | \
294 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
295 CPU_FTR_TAU | CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \
296 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_PPC_LE)
297#define CPU_FTRS_7450_20 (CPU_FTR_COMMON | \
298 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
299 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
300 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
301#define CPU_FTRS_7450_21 (CPU_FTR_COMMON | \
302 CPU_FTR_USE_TB | \
303 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
304 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
305 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
306 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
307#define CPU_FTRS_7450_23 (CPU_FTR_COMMON | \
308 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \
309 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
310 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
311 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
312#define CPU_FTRS_7455_1 (CPU_FTR_COMMON | \
313 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \
314 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \
315 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \
316 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
317#define CPU_FTRS_7455_20 (CPU_FTR_COMMON | \
318 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \
319 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
320 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
321 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
322 CPU_FTR_NEED_COHERENT | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
323#define CPU_FTRS_7455 (CPU_FTR_COMMON | \
324 CPU_FTR_USE_TB | \
325 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
326 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
327 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
328 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
329#define CPU_FTRS_7447_10 (CPU_FTR_COMMON | \
330 CPU_FTR_USE_TB | \
331 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
332 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
333 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
334 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE | \
335 CPU_FTR_NEED_PAIRED_STWCX)
336#define CPU_FTRS_7447 (CPU_FTR_COMMON | \
337 CPU_FTR_USE_TB | \
338 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
339 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
340 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
341 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
342#define CPU_FTRS_7447A (CPU_FTR_COMMON | \
343 CPU_FTR_USE_TB | \
344 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
345 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
346 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
347 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
348#define CPU_FTRS_7448 (CPU_FTR_COMMON | \
349 CPU_FTR_USE_TB | \
350 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
351 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
352 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
353 CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
354#define CPU_FTRS_82XX (CPU_FTR_COMMON | \
355 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB)
356#define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \
357 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS)
358#define CPU_FTRS_E300 (CPU_FTR_MAYBE_CAN_DOZE | \
359 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \
360 CPU_FTR_COMMON)
361#define CPU_FTRS_E300C2 (CPU_FTR_MAYBE_CAN_DOZE | \
362 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \
363 CPU_FTR_COMMON | CPU_FTR_FPU_UNAVAILABLE)
364#define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON | \
365 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE)
366#define CPU_FTRS_8XX (CPU_FTR_USE_TB)
367#define CPU_FTRS_40X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN)
368#define CPU_FTRS_44X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN)
369#define CPU_FTRS_E200 (CPU_FTR_USE_TB | CPU_FTR_SPE_COMP | \
370 CPU_FTR_NODSISRALIGN | CPU_FTR_COHERENT_ICACHE | \
371 CPU_FTR_UNIFIED_ID_CACHE)
372#define CPU_FTRS_E500 (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
373 CPU_FTR_SPE_COMP | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_NODSISRALIGN)
374#define CPU_FTRS_E500_2 (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
375 CPU_FTR_SPE_COMP | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_BIG_PHYS | \
376 CPU_FTR_NODSISRALIGN)
377#define CPU_FTRS_E500MC (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
378 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_BIG_PHYS | CPU_FTR_NODSISRALIGN | \
379 CPU_FTR_L2CSR | CPU_FTR_LWSYNC)
380#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
381
382/* 64-bit CPUs */
383#define CPU_FTRS_POWER3 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
384 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | CPU_FTR_PPC_LE)
385#define CPU_FTRS_RS64 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
386 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \
387 CPU_FTR_MMCRA | CPU_FTR_CTRL)
388#define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
389 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
390 CPU_FTR_MMCRA)
391#define CPU_FTRS_PPC970 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
392 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
393 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA)
394#define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
395 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
396 CPU_FTR_MMCRA | CPU_FTR_SMT | \
397 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
398 CPU_FTR_PURR)
399#define CPU_FTRS_POWER6 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
400 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
401 CPU_FTR_MMCRA | CPU_FTR_SMT | \
402 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
403 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
404 CPU_FTR_DSCR)
405#define CPU_FTRS_POWER7 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
406 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
407 CPU_FTR_MMCRA | CPU_FTR_SMT | \
408 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
409 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
410 CPU_FTR_DSCR | CPU_FTR_SAO)
411#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
412 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
413 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
414 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_CELL_TB_BUG)
415#define CPU_FTRS_PA6T (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
416 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
417 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
418 CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_NO_SLBIE_B)
419#define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | \
420 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
421
422#ifdef __powerpc64__
423#define CPU_FTRS_POSSIBLE \
424 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \
425 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \
426 CPU_FTRS_POWER7 | CPU_FTRS_CELL | CPU_FTRS_PA6T | \
427 CPU_FTR_1T_SEGMENT | CPU_FTR_VSX)
428#else
429enum {
430 CPU_FTRS_POSSIBLE =
431#if CLASSIC_PPC
432 CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU |
433 CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 |
434 CPU_FTRS_750FX2 | CPU_FTRS_750FX | CPU_FTRS_750GX |
435 CPU_FTRS_7400_NOTAU | CPU_FTRS_7400 | CPU_FTRS_7450_20 |
436 CPU_FTRS_7450_21 | CPU_FTRS_7450_23 | CPU_FTRS_7455_1 |
437 CPU_FTRS_7455_20 | CPU_FTRS_7455 | CPU_FTRS_7447_10 |
438 CPU_FTRS_7447 | CPU_FTRS_7447A | CPU_FTRS_82XX |
439 CPU_FTRS_G2_LE | CPU_FTRS_E300 | CPU_FTRS_E300C2 |
440 CPU_FTRS_CLASSIC32 |
441#else
442 CPU_FTRS_GENERIC_32 |
443#endif
444#ifdef CONFIG_8xx
445 CPU_FTRS_8XX |
446#endif
447#ifdef CONFIG_40x
448 CPU_FTRS_40X |
449#endif
450#ifdef CONFIG_44x
451 CPU_FTRS_44X |
452#endif
453#ifdef CONFIG_E200
454 CPU_FTRS_E200 |
455#endif
456#ifdef CONFIG_E500
457 CPU_FTRS_E500 | CPU_FTRS_E500_2 | CPU_FTRS_E500MC |
458#endif
459 0,
460};
461#endif /* __powerpc64__ */
462
463#ifdef __powerpc64__
464#define CPU_FTRS_ALWAYS \
465 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \
466 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \
467 CPU_FTRS_POWER7 & CPU_FTRS_CELL & CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE)
468#else
469enum {
470 CPU_FTRS_ALWAYS =
471#if CLASSIC_PPC
472 CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU &
473 CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 &
474 CPU_FTRS_750FX2 & CPU_FTRS_750FX & CPU_FTRS_750GX &
475 CPU_FTRS_7400_NOTAU & CPU_FTRS_7400 & CPU_FTRS_7450_20 &
476 CPU_FTRS_7450_21 & CPU_FTRS_7450_23 & CPU_FTRS_7455_1 &
477 CPU_FTRS_7455_20 & CPU_FTRS_7455 & CPU_FTRS_7447_10 &
478 CPU_FTRS_7447 & CPU_FTRS_7447A & CPU_FTRS_82XX &
479 CPU_FTRS_G2_LE & CPU_FTRS_E300 & CPU_FTRS_E300C2 &
480 CPU_FTRS_CLASSIC32 &
481#else
482 CPU_FTRS_GENERIC_32 &
483#endif
484#ifdef CONFIG_8xx
485 CPU_FTRS_8XX &
486#endif
487#ifdef CONFIG_40x
488 CPU_FTRS_40X &
489#endif
490#ifdef CONFIG_44x
491 CPU_FTRS_44X &
492#endif
493#ifdef CONFIG_E200
494 CPU_FTRS_E200 &
495#endif
496#ifdef CONFIG_E500
497 CPU_FTRS_E500 & CPU_FTRS_E500_2 & CPU_FTRS_E500MC &
498#endif
499 CPU_FTRS_POSSIBLE,
500};
501#endif /* __powerpc64__ */
502
503static inline int cpu_has_feature(unsigned long feature)
504{
505 return (CPU_FTRS_ALWAYS & feature) ||
506 (CPU_FTRS_POSSIBLE
507 & cur_cpu_spec->cpu_features
508 & feature);
509}
510
511#endif /* !__ASSEMBLY__ */
512
513#endif /* __KERNEL__ */
514#endif /* __ASM_POWERPC_CPUTABLE_H */
diff --git a/arch/powerpc/include/asm/cputhreads.h b/arch/powerpc/include/asm/cputhreads.h
new file mode 100644
index 000000000000..fb11b0c459b8
--- /dev/null
+++ b/arch/powerpc/include/asm/cputhreads.h
@@ -0,0 +1,71 @@
1#ifndef _ASM_POWERPC_CPUTHREADS_H
2#define _ASM_POWERPC_CPUTHREADS_H
3
4#include <linux/cpumask.h>
5
6/*
7 * Mapping of threads to cores
8 */
9
10#ifdef CONFIG_SMP
11extern int threads_per_core;
12extern int threads_shift;
13extern cpumask_t threads_core_mask;
14#else
15#define threads_per_core 1
16#define threads_shift 0
17#define threads_core_mask (CPU_MASK_CPU0)
18#endif
19
20/* cpu_thread_mask_to_cores - Return a cpumask of one per cores
21 * hit by the argument
22 *
23 * @threads: a cpumask of threads
24 *
25 * This function returns a cpumask which will have one "cpu" (or thread)
26 * bit set for each core that has at least one thread set in the argument.
27 *
28 * This can typically be used for things like IPI for tlb invalidations
29 * since those need to be done only once per core/TLB
30 */
31static inline cpumask_t cpu_thread_mask_to_cores(cpumask_t threads)
32{
33 cpumask_t tmp, res;
34 int i;
35
36 res = CPU_MASK_NONE;
37 for (i = 0; i < NR_CPUS; i += threads_per_core) {
38 cpus_shift_left(tmp, threads_core_mask, i);
39 if (cpus_intersects(threads, tmp))
40 cpu_set(i, res);
41 }
42 return res;
43}
44
45static inline int cpu_nr_cores(void)
46{
47 return NR_CPUS >> threads_shift;
48}
49
50static inline cpumask_t cpu_online_cores_map(void)
51{
52 return cpu_thread_mask_to_cores(cpu_online_map);
53}
54
55static inline int cpu_thread_to_core(int cpu)
56{
57 return cpu >> threads_shift;
58}
59
60static inline int cpu_thread_in_core(int cpu)
61{
62 return cpu & (threads_per_core - 1);
63}
64
65static inline int cpu_first_thread_in_core(int cpu)
66{
67 return cpu & ~(threads_per_core - 1);
68}
69
70#endif /* _ASM_POWERPC_CPUTHREADS_H */
71
diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
new file mode 100644
index 000000000000..f42e623030ee
--- /dev/null
+++ b/arch/powerpc/include/asm/cputime.h
@@ -0,0 +1,235 @@
1/*
2 * Definitions for measuring cputime on powerpc machines.
3 *
4 * Copyright (C) 2006 Paul Mackerras, 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 * If we have CONFIG_VIRT_CPU_ACCOUNTING, we measure cpu time in
12 * the same units as the timebase. Otherwise we measure cpu time
13 * in jiffies using the generic definitions.
14 */
15
16#ifndef __POWERPC_CPUTIME_H
17#define __POWERPC_CPUTIME_H
18
19#ifndef CONFIG_VIRT_CPU_ACCOUNTING
20#include <asm-generic/cputime.h>
21#else
22
23#include <linux/types.h>
24#include <linux/time.h>
25#include <asm/div64.h>
26#include <asm/time.h>
27#include <asm/param.h>
28
29typedef u64 cputime_t;
30typedef u64 cputime64_t;
31
32#define cputime_zero ((cputime_t)0)
33#define cputime_max ((~((cputime_t)0) >> 1) - 1)
34#define cputime_add(__a, __b) ((__a) + (__b))
35#define cputime_sub(__a, __b) ((__a) - (__b))
36#define cputime_div(__a, __n) ((__a) / (__n))
37#define cputime_halve(__a) ((__a) >> 1)
38#define cputime_eq(__a, __b) ((__a) == (__b))
39#define cputime_gt(__a, __b) ((__a) > (__b))
40#define cputime_ge(__a, __b) ((__a) >= (__b))
41#define cputime_lt(__a, __b) ((__a) < (__b))
42#define cputime_le(__a, __b) ((__a) <= (__b))
43
44#define cputime64_zero ((cputime64_t)0)
45#define cputime64_add(__a, __b) ((__a) + (__b))
46#define cputime64_sub(__a, __b) ((__a) - (__b))
47#define cputime_to_cputime64(__ct) (__ct)
48
49#ifdef __KERNEL__
50
51/*
52 * Convert cputime <-> jiffies
53 */
54extern u64 __cputime_jiffies_factor;
55DECLARE_PER_CPU(unsigned long, cputime_last_delta);
56DECLARE_PER_CPU(unsigned long, cputime_scaled_last_delta);
57
58static inline unsigned long cputime_to_jiffies(const cputime_t ct)
59{
60 return mulhdu(ct, __cputime_jiffies_factor);
61}
62
63/* Estimate the scaled cputime by scaling the real cputime based on
64 * the last scaled to real ratio */
65static inline cputime_t cputime_to_scaled(const cputime_t ct)
66{
67 if (cpu_has_feature(CPU_FTR_SPURR) &&
68 per_cpu(cputime_last_delta, smp_processor_id()))
69 return ct *
70 per_cpu(cputime_scaled_last_delta, smp_processor_id())/
71 per_cpu(cputime_last_delta, smp_processor_id());
72 return ct;
73}
74
75static inline cputime_t jiffies_to_cputime(const unsigned long jif)
76{
77 cputime_t ct;
78 unsigned long sec;
79
80 /* have to be a little careful about overflow */
81 ct = jif % HZ;
82 sec = jif / HZ;
83 if (ct) {
84 ct *= tb_ticks_per_sec;
85 do_div(ct, HZ);
86 }
87 if (sec)
88 ct += (cputime_t) sec * tb_ticks_per_sec;
89 return ct;
90}
91
92static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
93{
94 cputime_t ct;
95 u64 sec;
96
97 /* have to be a little careful about overflow */
98 ct = jif % HZ;
99 sec = jif / HZ;
100 if (ct) {
101 ct *= tb_ticks_per_sec;
102 do_div(ct, HZ);
103 }
104 if (sec)
105 ct += (cputime_t) sec * tb_ticks_per_sec;
106 return ct;
107}
108
109static inline u64 cputime64_to_jiffies64(const cputime_t ct)
110{
111 return mulhdu(ct, __cputime_jiffies_factor);
112}
113
114/*
115 * Convert cputime <-> milliseconds
116 */
117extern u64 __cputime_msec_factor;
118
119static inline unsigned long cputime_to_msecs(const cputime_t ct)
120{
121 return mulhdu(ct, __cputime_msec_factor);
122}
123
124static inline cputime_t msecs_to_cputime(const unsigned long ms)
125{
126 cputime_t ct;
127 unsigned long sec;
128
129 /* have to be a little careful about overflow */
130 ct = ms % 1000;
131 sec = ms / 1000;
132 if (ct) {
133 ct *= tb_ticks_per_sec;
134 do_div(ct, 1000);
135 }
136 if (sec)
137 ct += (cputime_t) sec * tb_ticks_per_sec;
138 return ct;
139}
140
141/*
142 * Convert cputime <-> seconds
143 */
144extern u64 __cputime_sec_factor;
145
146static inline unsigned long cputime_to_secs(const cputime_t ct)
147{
148 return mulhdu(ct, __cputime_sec_factor);
149}
150
151static inline cputime_t secs_to_cputime(const unsigned long sec)
152{
153 return (cputime_t) sec * tb_ticks_per_sec;
154}
155
156/*
157 * Convert cputime <-> timespec
158 */
159static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p)
160{
161 u64 x = ct;
162 unsigned int frac;
163
164 frac = do_div(x, tb_ticks_per_sec);
165 p->tv_sec = x;
166 x = (u64) frac * 1000000000;
167 do_div(x, tb_ticks_per_sec);
168 p->tv_nsec = x;
169}
170
171static inline cputime_t timespec_to_cputime(const struct timespec *p)
172{
173 cputime_t ct;
174
175 ct = (u64) p->tv_nsec * tb_ticks_per_sec;
176 do_div(ct, 1000000000);
177 return ct + (u64) p->tv_sec * tb_ticks_per_sec;
178}
179
180/*
181 * Convert cputime <-> timeval
182 */
183static inline void cputime_to_timeval(const cputime_t ct, struct timeval *p)
184{
185 u64 x = ct;
186 unsigned int frac;
187
188 frac = do_div(x, tb_ticks_per_sec);
189 p->tv_sec = x;
190 x = (u64) frac * 1000000;
191 do_div(x, tb_ticks_per_sec);
192 p->tv_usec = x;
193}
194
195static inline cputime_t timeval_to_cputime(const struct timeval *p)
196{
197 cputime_t ct;
198
199 ct = (u64) p->tv_usec * tb_ticks_per_sec;
200 do_div(ct, 1000000);
201 return ct + (u64) p->tv_sec * tb_ticks_per_sec;
202}
203
204/*
205 * Convert cputime <-> clock_t (units of 1/USER_HZ seconds)
206 */
207extern u64 __cputime_clockt_factor;
208
209static inline unsigned long cputime_to_clock_t(const cputime_t ct)
210{
211 return mulhdu(ct, __cputime_clockt_factor);
212}
213
214static inline cputime_t clock_t_to_cputime(const unsigned long clk)
215{
216 cputime_t ct;
217 unsigned long sec;
218
219 /* have to be a little careful about overflow */
220 ct = clk % USER_HZ;
221 sec = clk / USER_HZ;
222 if (ct) {
223 ct *= tb_ticks_per_sec;
224 do_div(ct, USER_HZ);
225 }
226 if (sec)
227 ct += (cputime_t) sec * tb_ticks_per_sec;
228 return ct;
229}
230
231#define cputime64_to_clock_t(ct) cputime_to_clock_t((cputime_t)(ct))
232
233#endif /* __KERNEL__ */
234#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
235#endif /* __POWERPC_CPUTIME_H */
diff --git a/arch/powerpc/include/asm/current.h b/arch/powerpc/include/asm/current.h
new file mode 100644
index 000000000000..e2c7f06931e7
--- /dev/null
+++ b/arch/powerpc/include/asm/current.h
@@ -0,0 +1,40 @@
1#ifndef _ASM_POWERPC_CURRENT_H
2#define _ASM_POWERPC_CURRENT_H
3#ifdef __KERNEL__
4
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
12struct task_struct;
13
14#ifdef __powerpc64__
15#include <linux/stddef.h>
16#include <asm/paca.h>
17
18static inline struct task_struct *get_current(void)
19{
20 struct task_struct *task;
21
22 __asm__ __volatile__("ld %0,%1(13)"
23 : "=r" (task)
24 : "i" (offsetof(struct paca_struct, __current)));
25
26 return task;
27}
28#define current get_current()
29
30#else
31
32/*
33 * We keep `current' in r2 for speed.
34 */
35register struct task_struct *current asm ("r2");
36
37#endif
38
39#endif /* __KERNEL__ */
40#endif /* _ASM_POWERPC_CURRENT_H */
diff --git a/arch/powerpc/include/asm/dbdma.h b/arch/powerpc/include/asm/dbdma.h
new file mode 100644
index 000000000000..e23f07e73cb3
--- /dev/null
+++ b/arch/powerpc/include/asm/dbdma.h
@@ -0,0 +1,108 @@
1/*
2 * Definitions for using the Apple Descriptor-Based DMA controller
3 * in Power Macintosh computers.
4 *
5 * Copyright (C) 1996 Paul Mackerras.
6 */
7
8#ifdef __KERNEL__
9#ifndef _ASM_DBDMA_H_
10#define _ASM_DBDMA_H_
11/*
12 * DBDMA control/status registers. All little-endian.
13 */
14struct dbdma_regs {
15 unsigned int control; /* lets you change bits in status */
16 unsigned int status; /* DMA and device status bits (see below) */
17 unsigned int cmdptr_hi; /* upper 32 bits of command address */
18 unsigned int cmdptr; /* (lower 32 bits of) command address (phys) */
19 unsigned int intr_sel; /* select interrupt condition bit */
20 unsigned int br_sel; /* select branch condition bit */
21 unsigned int wait_sel; /* select wait condition bit */
22 unsigned int xfer_mode;
23 unsigned int data2ptr_hi;
24 unsigned int data2ptr;
25 unsigned int res1;
26 unsigned int address_hi;
27 unsigned int br_addr_hi;
28 unsigned int res2[3];
29};
30
31/* Bits in control and status registers */
32#define RUN 0x8000
33#define PAUSE 0x4000
34#define FLUSH 0x2000
35#define WAKE 0x1000
36#define DEAD 0x0800
37#define ACTIVE 0x0400
38#define BT 0x0100
39#define DEVSTAT 0x00ff
40
41/*
42 * DBDMA command structure. These fields are all little-endian!
43 */
44struct dbdma_cmd {
45 unsigned short req_count; /* requested byte transfer count */
46 unsigned short command; /* command word (has bit-fields) */
47 unsigned int phy_addr; /* physical data address */
48 unsigned int cmd_dep; /* command-dependent field */
49 unsigned short res_count; /* residual count after completion */
50 unsigned short xfer_status; /* transfer status */
51};
52
53/* DBDMA command values in command field */
54#define OUTPUT_MORE 0 /* transfer memory data to stream */
55#define OUTPUT_LAST 0x1000 /* ditto followed by end marker */
56#define INPUT_MORE 0x2000 /* transfer stream data to memory */
57#define INPUT_LAST 0x3000 /* ditto, expect end marker */
58#define STORE_WORD 0x4000 /* write word (4 bytes) to device reg */
59#define LOAD_WORD 0x5000 /* read word (4 bytes) from device reg */
60#define DBDMA_NOP 0x6000 /* do nothing */
61#define DBDMA_STOP 0x7000 /* suspend processing */
62
63/* Key values in command field */
64#define KEY_STREAM0 0 /* usual data stream */
65#define KEY_STREAM1 0x100 /* control/status stream */
66#define KEY_STREAM2 0x200 /* device-dependent stream */
67#define KEY_STREAM3 0x300 /* device-dependent stream */
68#define KEY_REGS 0x500 /* device register space */
69#define KEY_SYSTEM 0x600 /* system memory-mapped space */
70#define KEY_DEVICE 0x700 /* device memory-mapped space */
71
72/* Interrupt control values in command field */
73#define INTR_NEVER 0 /* don't interrupt */
74#define INTR_IFSET 0x10 /* intr if condition bit is 1 */
75#define INTR_IFCLR 0x20 /* intr if condition bit is 0 */
76#define INTR_ALWAYS 0x30 /* always interrupt */
77
78/* Branch control values in command field */
79#define BR_NEVER 0 /* don't branch */
80#define BR_IFSET 0x4 /* branch if condition bit is 1 */
81#define BR_IFCLR 0x8 /* branch if condition bit is 0 */
82#define BR_ALWAYS 0xc /* always branch */
83
84/* Wait control values in command field */
85#define WAIT_NEVER 0 /* don't wait */
86#define WAIT_IFSET 1 /* wait if condition bit is 1 */
87#define WAIT_IFCLR 2 /* wait if condition bit is 0 */
88#define WAIT_ALWAYS 3 /* always wait */
89
90/* Align an address for a DBDMA command structure */
91#define DBDMA_ALIGN(x) (((unsigned long)(x) + sizeof(struct dbdma_cmd) - 1) \
92 & -sizeof(struct dbdma_cmd))
93
94/* Useful macros */
95#define DBDMA_DO_STOP(regs) do { \
96 out_le32(&((regs)->control), (RUN|FLUSH)<<16); \
97 while(in_le32(&((regs)->status)) & (ACTIVE|FLUSH)) \
98 ; \
99} while(0)
100
101#define DBDMA_DO_RESET(regs) do { \
102 out_le32(&((regs)->control), (ACTIVE|DEAD|WAKE|FLUSH|PAUSE|RUN)<<16);\
103 while(in_le32(&((regs)->status)) & (RUN)) \
104 ; \
105} while(0)
106
107#endif /* _ASM_DBDMA_H_ */
108#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/dcr-generic.h b/arch/powerpc/include/asm/dcr-generic.h
new file mode 100644
index 000000000000..35b71599ec46
--- /dev/null
+++ b/arch/powerpc/include/asm/dcr-generic.h
@@ -0,0 +1,49 @@
1/*
2 * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org>
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
13 * the 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#ifndef _ASM_POWERPC_DCR_GENERIC_H
21#define _ASM_POWERPC_DCR_GENERIC_H
22#ifdef __KERNEL__
23#ifndef __ASSEMBLY__
24
25enum host_type_t {DCR_HOST_MMIO, DCR_HOST_NATIVE, DCR_HOST_INVALID};
26
27typedef struct {
28 enum host_type_t type;
29 union {
30 dcr_host_mmio_t mmio;
31 dcr_host_native_t native;
32 } host;
33} dcr_host_t;
34
35extern bool dcr_map_ok_generic(dcr_host_t host);
36
37extern dcr_host_t dcr_map_generic(struct device_node *dev, unsigned int dcr_n,
38 unsigned int dcr_c);
39extern void dcr_unmap_generic(dcr_host_t host, unsigned int dcr_c);
40
41extern u32 dcr_read_generic(dcr_host_t host, unsigned int dcr_n);
42
43extern void dcr_write_generic(dcr_host_t host, unsigned int dcr_n, u32 value);
44
45#endif /* __ASSEMBLY__ */
46#endif /* __KERNEL__ */
47#endif /* _ASM_POWERPC_DCR_GENERIC_H */
48
49
diff --git a/arch/powerpc/include/asm/dcr-mmio.h b/arch/powerpc/include/asm/dcr-mmio.h
new file mode 100644
index 000000000000..acd491dbd45a
--- /dev/null
+++ b/arch/powerpc/include/asm/dcr-mmio.h
@@ -0,0 +1,61 @@
1/*
2 * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org>
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
13 * the 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#ifndef _ASM_POWERPC_DCR_MMIO_H
21#define _ASM_POWERPC_DCR_MMIO_H
22#ifdef __KERNEL__
23
24#include <asm/io.h>
25
26typedef struct {
27 void __iomem *token;
28 unsigned int stride;
29 unsigned int base;
30} dcr_host_mmio_t;
31
32static inline bool dcr_map_ok_mmio(dcr_host_mmio_t host)
33{
34 return host.token != NULL;
35}
36
37extern dcr_host_mmio_t dcr_map_mmio(struct device_node *dev,
38 unsigned int dcr_n,
39 unsigned int dcr_c);
40extern void dcr_unmap_mmio(dcr_host_mmio_t host, unsigned int dcr_c);
41
42static inline u32 dcr_read_mmio(dcr_host_mmio_t host, unsigned int dcr_n)
43{
44 return in_be32(host.token + ((host.base + dcr_n) * host.stride));
45}
46
47static inline void dcr_write_mmio(dcr_host_mmio_t host,
48 unsigned int dcr_n,
49 u32 value)
50{
51 out_be32(host.token + ((host.base + dcr_n) * host.stride), value);
52}
53
54extern u64 of_translate_dcr_address(struct device_node *dev,
55 unsigned int dcr_n,
56 unsigned int *stride);
57
58#endif /* __KERNEL__ */
59#endif /* _ASM_POWERPC_DCR_MMIO_H */
60
61
diff --git a/arch/powerpc/include/asm/dcr-native.h b/arch/powerpc/include/asm/dcr-native.h
new file mode 100644
index 000000000000..72d2b72c7390
--- /dev/null
+++ b/arch/powerpc/include/asm/dcr-native.h
@@ -0,0 +1,116 @@
1/*
2 * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org>
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
13 * the 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#ifndef _ASM_POWERPC_DCR_NATIVE_H
21#define _ASM_POWERPC_DCR_NATIVE_H
22#ifdef __KERNEL__
23#ifndef __ASSEMBLY__
24
25#include <linux/spinlock.h>
26
27typedef struct {
28 unsigned int base;
29} dcr_host_native_t;
30
31static inline bool dcr_map_ok_native(dcr_host_native_t host)
32{
33 return 1;
34}
35
36#define dcr_map_native(dev, dcr_n, dcr_c) \
37 ((dcr_host_native_t){ .base = (dcr_n) })
38#define dcr_unmap_native(host, dcr_c) do {} while (0)
39#define dcr_read_native(host, dcr_n) mfdcr(dcr_n + host.base)
40#define dcr_write_native(host, dcr_n, value) mtdcr(dcr_n + host.base, value)
41
42/* Device Control Registers */
43void __mtdcr(int reg, unsigned int val);
44unsigned int __mfdcr(int reg);
45#define mfdcr(rn) \
46 ({unsigned int rval; \
47 if (__builtin_constant_p(rn)) \
48 asm volatile("mfdcr %0," __stringify(rn) \
49 : "=r" (rval)); \
50 else \
51 rval = __mfdcr(rn); \
52 rval;})
53
54#define mtdcr(rn, v) \
55do { \
56 if (__builtin_constant_p(rn)) \
57 asm volatile("mtdcr " __stringify(rn) ",%0" \
58 : : "r" (v)); \
59 else \
60 __mtdcr(rn, v); \
61} while (0)
62
63/* R/W of indirect DCRs make use of standard naming conventions for DCRs */
64extern spinlock_t dcr_ind_lock;
65
66static inline unsigned __mfdcri(int base_addr, int base_data, int reg)
67{
68 unsigned long flags;
69 unsigned int val;
70
71 spin_lock_irqsave(&dcr_ind_lock, flags);
72 __mtdcr(base_addr, reg);
73 val = __mfdcr(base_data);
74 spin_unlock_irqrestore(&dcr_ind_lock, flags);
75 return val;
76}
77
78static inline void __mtdcri(int base_addr, int base_data, int reg,
79 unsigned val)
80{
81 unsigned long flags;
82
83 spin_lock_irqsave(&dcr_ind_lock, flags);
84 __mtdcr(base_addr, reg);
85 __mtdcr(base_data, val);
86 spin_unlock_irqrestore(&dcr_ind_lock, flags);
87}
88
89static inline void __dcri_clrset(int base_addr, int base_data, int reg,
90 unsigned clr, unsigned set)
91{
92 unsigned long flags;
93 unsigned int val;
94
95 spin_lock_irqsave(&dcr_ind_lock, flags);
96 __mtdcr(base_addr, reg);
97 val = (__mfdcr(base_data) & ~clr) | set;
98 __mtdcr(base_data, val);
99 spin_unlock_irqrestore(&dcr_ind_lock, flags);
100}
101
102#define mfdcri(base, reg) __mfdcri(DCRN_ ## base ## _CONFIG_ADDR, \
103 DCRN_ ## base ## _CONFIG_DATA, \
104 reg)
105
106#define mtdcri(base, reg, data) __mtdcri(DCRN_ ## base ## _CONFIG_ADDR, \
107 DCRN_ ## base ## _CONFIG_DATA, \
108 reg, data)
109
110#define dcri_clrset(base, reg, clr, set) __dcri_clrset(DCRN_ ## base ## _CONFIG_ADDR, \
111 DCRN_ ## base ## _CONFIG_DATA, \
112 reg, clr, set)
113
114#endif /* __ASSEMBLY__ */
115#endif /* __KERNEL__ */
116#endif /* _ASM_POWERPC_DCR_NATIVE_H */
diff --git a/arch/powerpc/include/asm/dcr-regs.h b/arch/powerpc/include/asm/dcr-regs.h
new file mode 100644
index 000000000000..29b0ecef980a
--- /dev/null
+++ b/arch/powerpc/include/asm/dcr-regs.h
@@ -0,0 +1,149 @@
1/*
2 * Common DCR / SDR / CPR register definitions used on various IBM/AMCC
3 * 4xx processors
4 *
5 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp
6 * <benh@kernel.crashing.org>
7 *
8 * Mostly lifted from asm-ppc/ibm4xx.h by
9 *
10 * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
11 *
12 */
13
14#ifndef __DCR_REGS_H__
15#define __DCR_REGS_H__
16
17/*
18 * Most DCRs used for controlling devices such as the MAL, DMA engine,
19 * etc... are obtained for the device tree.
20 *
21 * The definitions in this files are fixed DCRs and indirect DCRs that
22 * are commonly used outside of specific drivers or refer to core
23 * common registers that may occasionally have to be tweaked outside
24 * of the driver main register set
25 */
26
27/* CPRs (440GX and 440SP/440SPe) */
28#define DCRN_CPR0_CONFIG_ADDR 0xc
29#define DCRN_CPR0_CONFIG_DATA 0xd
30
31/* SDRs (440GX and 440SP/440SPe) */
32#define DCRN_SDR0_CONFIG_ADDR 0xe
33#define DCRN_SDR0_CONFIG_DATA 0xf
34
35#define SDR0_PFC0 0x4100
36#define SDR0_PFC1 0x4101
37#define SDR0_PFC1_EPS 0x1c00000
38#define SDR0_PFC1_EPS_SHIFT 22
39#define SDR0_PFC1_RMII 0x02000000
40#define SDR0_MFR 0x4300
41#define SDR0_MFR_TAH0 0x80000000 /* TAHOE0 Enable */
42#define SDR0_MFR_TAH1 0x40000000 /* TAHOE1 Enable */
43#define SDR0_MFR_PCM 0x10000000 /* PPC440GP irq compat mode */
44#define SDR0_MFR_ECS 0x08000000 /* EMAC int clk */
45#define SDR0_MFR_T0TXFL 0x00080000
46#define SDR0_MFR_T0TXFH 0x00040000
47#define SDR0_MFR_T1TXFL 0x00020000
48#define SDR0_MFR_T1TXFH 0x00010000
49#define SDR0_MFR_E0TXFL 0x00008000
50#define SDR0_MFR_E0TXFH 0x00004000
51#define SDR0_MFR_E0RXFL 0x00002000
52#define SDR0_MFR_E0RXFH 0x00001000
53#define SDR0_MFR_E1TXFL 0x00000800
54#define SDR0_MFR_E1TXFH 0x00000400
55#define SDR0_MFR_E1RXFL 0x00000200
56#define SDR0_MFR_E1RXFH 0x00000100
57#define SDR0_MFR_E2TXFL 0x00000080
58#define SDR0_MFR_E2TXFH 0x00000040
59#define SDR0_MFR_E2RXFL 0x00000020
60#define SDR0_MFR_E2RXFH 0x00000010
61#define SDR0_MFR_E3TXFL 0x00000008
62#define SDR0_MFR_E3TXFH 0x00000004
63#define SDR0_MFR_E3RXFL 0x00000002
64#define SDR0_MFR_E3RXFH 0x00000001
65#define SDR0_UART0 0x0120
66#define SDR0_UART1 0x0121
67#define SDR0_UART2 0x0122
68#define SDR0_UART3 0x0123
69#define SDR0_CUST0 0x4000
70
71/*
72 * All those DCR register addresses are offsets from the base address
73 * for the SRAM0 controller (e.g. 0x20 on 440GX). The base address is
74 * excluded here and configured in the device tree.
75 */
76#define DCRN_SRAM0_SB0CR 0x00
77#define DCRN_SRAM0_SB1CR 0x01
78#define DCRN_SRAM0_SB2CR 0x02
79#define DCRN_SRAM0_SB3CR 0x03
80#define SRAM_SBCR_BU_MASK 0x00000180
81#define SRAM_SBCR_BS_64KB 0x00000800
82#define SRAM_SBCR_BU_RO 0x00000080
83#define SRAM_SBCR_BU_RW 0x00000180
84#define DCRN_SRAM0_BEAR 0x04
85#define DCRN_SRAM0_BESR0 0x05
86#define DCRN_SRAM0_BESR1 0x06
87#define DCRN_SRAM0_PMEG 0x07
88#define DCRN_SRAM0_CID 0x08
89#define DCRN_SRAM0_REVID 0x09
90#define DCRN_SRAM0_DPC 0x0a
91#define SRAM_DPC_ENABLE 0x80000000
92
93/*
94 * All those DCR register addresses are offsets from the base address
95 * for the SRAM0 controller (e.g. 0x30 on 440GX). The base address is
96 * excluded here and configured in the device tree.
97 */
98#define DCRN_L2C0_CFG 0x00
99#define L2C_CFG_L2M 0x80000000
100#define L2C_CFG_ICU 0x40000000
101#define L2C_CFG_DCU 0x20000000
102#define L2C_CFG_DCW_MASK 0x1e000000
103#define L2C_CFG_TPC 0x01000000
104#define L2C_CFG_CPC 0x00800000
105#define L2C_CFG_FRAN 0x00200000
106#define L2C_CFG_SS_MASK 0x00180000
107#define L2C_CFG_SS_256 0x00000000
108#define L2C_CFG_CPIM 0x00040000
109#define L2C_CFG_TPIM 0x00020000
110#define L2C_CFG_LIM 0x00010000
111#define L2C_CFG_PMUX_MASK 0x00007000
112#define L2C_CFG_PMUX_SNP 0x00000000
113#define L2C_CFG_PMUX_IF 0x00001000
114#define L2C_CFG_PMUX_DF 0x00002000
115#define L2C_CFG_PMUX_DS 0x00003000
116#define L2C_CFG_PMIM 0x00000800
117#define L2C_CFG_TPEI 0x00000400
118#define L2C_CFG_CPEI 0x00000200
119#define L2C_CFG_NAM 0x00000100
120#define L2C_CFG_SMCM 0x00000080
121#define L2C_CFG_NBRM 0x00000040
122#define L2C_CFG_RDBW 0x00000008 /* only 460EX/GT */
123#define DCRN_L2C0_CMD 0x01
124#define L2C_CMD_CLR 0x80000000
125#define L2C_CMD_DIAG 0x40000000
126#define L2C_CMD_INV 0x20000000
127#define L2C_CMD_CCP 0x10000000
128#define L2C_CMD_CTE 0x08000000
129#define L2C_CMD_STRC 0x04000000
130#define L2C_CMD_STPC 0x02000000
131#define L2C_CMD_RPMC 0x01000000
132#define L2C_CMD_HCC 0x00800000
133#define DCRN_L2C0_ADDR 0x02
134#define DCRN_L2C0_DATA 0x03
135#define DCRN_L2C0_SR 0x04
136#define L2C_SR_CC 0x80000000
137#define L2C_SR_CPE 0x40000000
138#define L2C_SR_TPE 0x20000000
139#define L2C_SR_LRU 0x10000000
140#define L2C_SR_PCS 0x08000000
141#define DCRN_L2C0_REVID 0x05
142#define DCRN_L2C0_SNP0 0x06
143#define DCRN_L2C0_SNP1 0x07
144#define L2C_SNP_BA_MASK 0xffff0000
145#define L2C_SNP_SSR_MASK 0x0000f000
146#define L2C_SNP_SSR_32G 0x0000f000
147#define L2C_SNP_ESR 0x00000800
148
149#endif /* __DCR_REGS_H__ */
diff --git a/arch/powerpc/include/asm/dcr.h b/arch/powerpc/include/asm/dcr.h
new file mode 100644
index 000000000000..d13fb68bb5c0
--- /dev/null
+++ b/arch/powerpc/include/asm/dcr.h
@@ -0,0 +1,78 @@
1/*
2 * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org>
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
13 * the 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#ifndef _ASM_POWERPC_DCR_H
21#define _ASM_POWERPC_DCR_H
22#ifdef __KERNEL__
23#ifndef __ASSEMBLY__
24#ifdef CONFIG_PPC_DCR
25
26#ifdef CONFIG_PPC_DCR_NATIVE
27#include <asm/dcr-native.h>
28#endif
29
30#ifdef CONFIG_PPC_DCR_MMIO
31#include <asm/dcr-mmio.h>
32#endif
33
34
35/* Indirection layer for providing both NATIVE and MMIO support. */
36
37#if defined(CONFIG_PPC_DCR_NATIVE) && defined(CONFIG_PPC_DCR_MMIO)
38
39#include <asm/dcr-generic.h>
40
41#define DCR_MAP_OK(host) dcr_map_ok_generic(host)
42#define dcr_map(dev, dcr_n, dcr_c) dcr_map_generic(dev, dcr_n, dcr_c)
43#define dcr_unmap(host, dcr_c) dcr_unmap_generic(host, dcr_c)
44#define dcr_read(host, dcr_n) dcr_read_generic(host, dcr_n)
45#define dcr_write(host, dcr_n, value) dcr_write_generic(host, dcr_n, value)
46
47#else
48
49#ifdef CONFIG_PPC_DCR_NATIVE
50typedef dcr_host_native_t dcr_host_t;
51#define DCR_MAP_OK(host) dcr_map_ok_native(host)
52#define dcr_map(dev, dcr_n, dcr_c) dcr_map_native(dev, dcr_n, dcr_c)
53#define dcr_unmap(host, dcr_c) dcr_unmap_native(host, dcr_c)
54#define dcr_read(host, dcr_n) dcr_read_native(host, dcr_n)
55#define dcr_write(host, dcr_n, value) dcr_write_native(host, dcr_n, value)
56#else
57typedef dcr_host_mmio_t dcr_host_t;
58#define DCR_MAP_OK(host) dcr_map_ok_mmio(host)
59#define dcr_map(dev, dcr_n, dcr_c) dcr_map_mmio(dev, dcr_n, dcr_c)
60#define dcr_unmap(host, dcr_c) dcr_unmap_mmio(host, dcr_c)
61#define dcr_read(host, dcr_n) dcr_read_mmio(host, dcr_n)
62#define dcr_write(host, dcr_n, value) dcr_write_mmio(host, dcr_n, value)
63#endif
64
65#endif /* defined(CONFIG_PPC_DCR_NATIVE) && defined(CONFIG_PPC_DCR_MMIO) */
66
67/*
68 * additional helpers to read the DCR * base from the device-tree
69 */
70struct device_node;
71extern unsigned int dcr_resource_start(struct device_node *np,
72 unsigned int index);
73extern unsigned int dcr_resource_len(struct device_node *np,
74 unsigned int index);
75#endif /* CONFIG_PPC_DCR */
76#endif /* __ASSEMBLY__ */
77#endif /* __KERNEL__ */
78#endif /* _ASM_POWERPC_DCR_H */
diff --git a/arch/powerpc/include/asm/delay.h b/arch/powerpc/include/asm/delay.h
new file mode 100644
index 000000000000..f9200a65c632
--- /dev/null
+++ b/arch/powerpc/include/asm/delay.h
@@ -0,0 +1,34 @@
1#ifndef _ASM_POWERPC_DELAY_H
2#define _ASM_POWERPC_DELAY_H
3#ifdef __KERNEL__
4
5/*
6 * Copyright 1996, Paul Mackerras.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 *
13 * PPC64 Support added by Dave Engebretsen, Todd Inglett, Mike Corrigan,
14 * Anton Blanchard.
15 */
16
17extern void __delay(unsigned long loops);
18extern void udelay(unsigned long usecs);
19
20/*
21 * On shared processor machines the generic implementation of mdelay can
22 * result in large errors. While each iteration of the loop inside mdelay
23 * is supposed to take 1ms, the hypervisor could sleep our partition for
24 * longer (eg 10ms). With the right timing these errors can add up.
25 *
26 * Since there is no 32bit overflow issue on 64bit kernels, just call
27 * udelay directly.
28 */
29#ifdef CONFIG_PPC64
30#define mdelay(n) udelay((n) * 1000)
31#endif
32
33#endif /* __KERNEL__ */
34#endif /* _ASM_POWERPC_DELAY_H */
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
new file mode 100644
index 000000000000..228ab2a315b9
--- /dev/null
+++ b/arch/powerpc/include/asm/device.h
@@ -0,0 +1,24 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef _ASM_POWERPC_DEVICE_H
7#define _ASM_POWERPC_DEVICE_H
8
9struct dma_mapping_ops;
10struct device_node;
11
12struct dev_archdata {
13 /* Optional pointer to an OF device node */
14 struct device_node *of_node;
15
16 /* DMA operations on that device */
17 struct dma_mapping_ops *dma_ops;
18 void *dma_data;
19
20 /* NUMA node if applicable */
21 int numa_node;
22};
23
24#endif /* _ASM_POWERPC_DEVICE_H */
diff --git a/arch/powerpc/include/asm/div64.h b/arch/powerpc/include/asm/div64.h
new file mode 100644
index 000000000000..6cd978cefb28
--- /dev/null
+++ b/arch/powerpc/include/asm/div64.h
@@ -0,0 +1 @@
#include <asm-generic/div64.h>
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
new file mode 100644
index 000000000000..c7ca45f97dd2
--- /dev/null
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -0,0 +1,474 @@
1/*
2 * Copyright (C) 2004 IBM
3 *
4 * Implements the generic device dma API for powerpc.
5 * the pci and vio busses
6 */
7#ifndef _ASM_DMA_MAPPING_H
8#define _ASM_DMA_MAPPING_H
9#ifdef __KERNEL__
10
11#include <linux/types.h>
12#include <linux/cache.h>
13/* need struct page definitions */
14#include <linux/mm.h>
15#include <linux/scatterlist.h>
16#include <linux/dma-attrs.h>
17#include <asm/io.h>
18
19#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
20
21#ifdef CONFIG_NOT_COHERENT_CACHE
22/*
23 * DMA-consistent mapping functions for PowerPCs that don't support
24 * cache snooping. These allocate/free a region of uncached mapped
25 * memory space for use with DMA devices. Alternatively, you could
26 * allocate the space "normally" and use the cache management functions
27 * to ensure it is consistent.
28 */
29extern void *__dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp);
30extern void __dma_free_coherent(size_t size, void *vaddr);
31extern void __dma_sync(void *vaddr, size_t size, int direction);
32extern void __dma_sync_page(struct page *page, unsigned long offset,
33 size_t size, int direction);
34
35#else /* ! CONFIG_NOT_COHERENT_CACHE */
36/*
37 * Cache coherent cores.
38 */
39
40#define __dma_alloc_coherent(gfp, size, handle) NULL
41#define __dma_free_coherent(size, addr) ((void)0)
42#define __dma_sync(addr, size, rw) ((void)0)
43#define __dma_sync_page(pg, off, sz, rw) ((void)0)
44
45#endif /* ! CONFIG_NOT_COHERENT_CACHE */
46
47#ifdef CONFIG_PPC64
48
49static inline unsigned long device_to_mask(struct device *dev)
50{
51 if (dev->dma_mask && *dev->dma_mask)
52 return *dev->dma_mask;
53 /* Assume devices without mask can take 32 bit addresses */
54 return 0xfffffffful;
55}
56
57/*
58 * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO
59 */
60struct dma_mapping_ops {
61 void * (*alloc_coherent)(struct device *dev, size_t size,
62 dma_addr_t *dma_handle, gfp_t flag);
63 void (*free_coherent)(struct device *dev, size_t size,
64 void *vaddr, dma_addr_t dma_handle);
65 dma_addr_t (*map_single)(struct device *dev, void *ptr,
66 size_t size, enum dma_data_direction direction,
67 struct dma_attrs *attrs);
68 void (*unmap_single)(struct device *dev, dma_addr_t dma_addr,
69 size_t size, enum dma_data_direction direction,
70 struct dma_attrs *attrs);
71 int (*map_sg)(struct device *dev, struct scatterlist *sg,
72 int nents, enum dma_data_direction direction,
73 struct dma_attrs *attrs);
74 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
75 int nents, enum dma_data_direction direction,
76 struct dma_attrs *attrs);
77 int (*dma_supported)(struct device *dev, u64 mask);
78 int (*set_dma_mask)(struct device *dev, u64 dma_mask);
79};
80
81static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
82{
83 /* We don't handle the NULL dev case for ISA for now. We could
84 * do it via an out of line call but it is not needed for now. The
85 * only ISA DMA device we support is the floppy and we have a hack
86 * in the floppy driver directly to get a device for us.
87 */
88 if (unlikely(dev == NULL || dev->archdata.dma_ops == NULL))
89 return NULL;
90 return dev->archdata.dma_ops;
91}
92
93static inline void set_dma_ops(struct device *dev, struct dma_mapping_ops *ops)
94{
95 dev->archdata.dma_ops = ops;
96}
97
98static inline int dma_supported(struct device *dev, u64 mask)
99{
100 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
101
102 if (unlikely(dma_ops == NULL))
103 return 0;
104 if (dma_ops->dma_supported == NULL)
105 return 1;
106 return dma_ops->dma_supported(dev, mask);
107}
108
109/* We have our own implementation of pci_set_dma_mask() */
110#define HAVE_ARCH_PCI_SET_DMA_MASK
111
112static inline int dma_set_mask(struct device *dev, u64 dma_mask)
113{
114 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
115
116 if (unlikely(dma_ops == NULL))
117 return -EIO;
118 if (dma_ops->set_dma_mask != NULL)
119 return dma_ops->set_dma_mask(dev, dma_mask);
120 if (!dev->dma_mask || !dma_supported(dev, dma_mask))
121 return -EIO;
122 *dev->dma_mask = dma_mask;
123 return 0;
124}
125
126static inline dma_addr_t dma_map_single_attrs(struct device *dev,
127 void *cpu_addr,
128 size_t size,
129 enum dma_data_direction direction,
130 struct dma_attrs *attrs)
131{
132 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
133
134 BUG_ON(!dma_ops);
135 return dma_ops->map_single(dev, cpu_addr, size, direction, attrs);
136}
137
138static inline void dma_unmap_single_attrs(struct device *dev,
139 dma_addr_t dma_addr,
140 size_t size,
141 enum dma_data_direction direction,
142 struct dma_attrs *attrs)
143{
144 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
145
146 BUG_ON(!dma_ops);
147 dma_ops->unmap_single(dev, dma_addr, size, direction, attrs);
148}
149
150static inline dma_addr_t dma_map_page_attrs(struct device *dev,
151 struct page *page,
152 unsigned long offset, size_t size,
153 enum dma_data_direction direction,
154 struct dma_attrs *attrs)
155{
156 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
157
158 BUG_ON(!dma_ops);
159 return dma_ops->map_single(dev, page_address(page) + offset, size,
160 direction, attrs);
161}
162
163static inline void dma_unmap_page_attrs(struct device *dev,
164 dma_addr_t dma_address,
165 size_t size,
166 enum dma_data_direction direction,
167 struct dma_attrs *attrs)
168{
169 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
170
171 BUG_ON(!dma_ops);
172 dma_ops->unmap_single(dev, dma_address, size, direction, attrs);
173}
174
175static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
176 int nents, enum dma_data_direction direction,
177 struct dma_attrs *attrs)
178{
179 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
180
181 BUG_ON(!dma_ops);
182 return dma_ops->map_sg(dev, sg, nents, direction, attrs);
183}
184
185static inline void dma_unmap_sg_attrs(struct device *dev,
186 struct scatterlist *sg,
187 int nhwentries,
188 enum dma_data_direction direction,
189 struct dma_attrs *attrs)
190{
191 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
192
193 BUG_ON(!dma_ops);
194 dma_ops->unmap_sg(dev, sg, nhwentries, direction, attrs);
195}
196
197static inline void *dma_alloc_coherent(struct device *dev, size_t size,
198 dma_addr_t *dma_handle, gfp_t flag)
199{
200 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
201
202 BUG_ON(!dma_ops);
203 return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
204}
205
206static inline void dma_free_coherent(struct device *dev, size_t size,
207 void *cpu_addr, dma_addr_t dma_handle)
208{
209 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
210
211 BUG_ON(!dma_ops);
212 dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
213}
214
215static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
216 size_t size,
217 enum dma_data_direction direction)
218{
219 return dma_map_single_attrs(dev, cpu_addr, size, direction, NULL);
220}
221
222static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
223 size_t size,
224 enum dma_data_direction direction)
225{
226 dma_unmap_single_attrs(dev, dma_addr, size, direction, NULL);
227}
228
229static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
230 unsigned long offset, size_t size,
231 enum dma_data_direction direction)
232{
233 return dma_map_page_attrs(dev, page, offset, size, direction, NULL);
234}
235
236static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
237 size_t size,
238 enum dma_data_direction direction)
239{
240 dma_unmap_page_attrs(dev, dma_address, size, direction, NULL);
241}
242
243static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
244 int nents, enum dma_data_direction direction)
245{
246 return dma_map_sg_attrs(dev, sg, nents, direction, NULL);
247}
248
249static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
250 int nhwentries,
251 enum dma_data_direction direction)
252{
253 dma_unmap_sg_attrs(dev, sg, nhwentries, direction, NULL);
254}
255
256/*
257 * Available generic sets of operations
258 */
259extern struct dma_mapping_ops dma_iommu_ops;
260extern struct dma_mapping_ops dma_direct_ops;
261
262#else /* CONFIG_PPC64 */
263
264#define dma_supported(dev, mask) (1)
265
266static inline int dma_set_mask(struct device *dev, u64 dma_mask)
267{
268 if (!dev->dma_mask || !dma_supported(dev, mask))
269 return -EIO;
270
271 *dev->dma_mask = dma_mask;
272
273 return 0;
274}
275
276static inline void *dma_alloc_coherent(struct device *dev, size_t size,
277 dma_addr_t * dma_handle,
278 gfp_t gfp)
279{
280#ifdef CONFIG_NOT_COHERENT_CACHE
281 return __dma_alloc_coherent(size, dma_handle, gfp);
282#else
283 void *ret;
284 /* ignore region specifiers */
285 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
286
287 if (dev == NULL || dev->coherent_dma_mask < 0xffffffff)
288 gfp |= GFP_DMA;
289
290 ret = (void *)__get_free_pages(gfp, get_order(size));
291
292 if (ret != NULL) {
293 memset(ret, 0, size);
294 *dma_handle = virt_to_bus(ret);
295 }
296
297 return ret;
298#endif
299}
300
301static inline void
302dma_free_coherent(struct device *dev, size_t size, void *vaddr,
303 dma_addr_t dma_handle)
304{
305#ifdef CONFIG_NOT_COHERENT_CACHE
306 __dma_free_coherent(size, vaddr);
307#else
308 free_pages((unsigned long)vaddr, get_order(size));
309#endif
310}
311
312static inline dma_addr_t
313dma_map_single(struct device *dev, void *ptr, size_t size,
314 enum dma_data_direction direction)
315{
316 BUG_ON(direction == DMA_NONE);
317
318 __dma_sync(ptr, size, direction);
319
320 return virt_to_bus(ptr);
321}
322
323static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
324 size_t size,
325 enum dma_data_direction direction)
326{
327 /* We do nothing. */
328}
329
330static inline dma_addr_t
331dma_map_page(struct device *dev, struct page *page,
332 unsigned long offset, size_t size,
333 enum dma_data_direction direction)
334{
335 BUG_ON(direction == DMA_NONE);
336
337 __dma_sync_page(page, offset, size, direction);
338
339 return page_to_bus(page) + offset;
340}
341
342static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
343 size_t size,
344 enum dma_data_direction direction)
345{
346 /* We do nothing. */
347}
348
349static inline int
350dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
351 enum dma_data_direction direction)
352{
353 struct scatterlist *sg;
354 int i;
355
356 BUG_ON(direction == DMA_NONE);
357
358 for_each_sg(sgl, sg, nents, i) {
359 BUG_ON(!sg_page(sg));
360 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
361 sg->dma_address = page_to_bus(sg_page(sg)) + sg->offset;
362 }
363
364 return nents;
365}
366
367static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
368 int nhwentries,
369 enum dma_data_direction direction)
370{
371 /* We don't do anything here. */
372}
373
374#endif /* CONFIG_PPC64 */
375
376static inline void dma_sync_single_for_cpu(struct device *dev,
377 dma_addr_t dma_handle, size_t size,
378 enum dma_data_direction direction)
379{
380 BUG_ON(direction == DMA_NONE);
381 __dma_sync(bus_to_virt(dma_handle), size, direction);
382}
383
384static inline void dma_sync_single_for_device(struct device *dev,
385 dma_addr_t dma_handle, size_t size,
386 enum dma_data_direction direction)
387{
388 BUG_ON(direction == DMA_NONE);
389 __dma_sync(bus_to_virt(dma_handle), size, direction);
390}
391
392static inline void dma_sync_sg_for_cpu(struct device *dev,
393 struct scatterlist *sgl, int nents,
394 enum dma_data_direction direction)
395{
396 struct scatterlist *sg;
397 int i;
398
399 BUG_ON(direction == DMA_NONE);
400
401 for_each_sg(sgl, sg, nents, i)
402 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
403}
404
405static inline void dma_sync_sg_for_device(struct device *dev,
406 struct scatterlist *sgl, int nents,
407 enum dma_data_direction direction)
408{
409 struct scatterlist *sg;
410 int i;
411
412 BUG_ON(direction == DMA_NONE);
413
414 for_each_sg(sgl, sg, nents, i)
415 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
416}
417
418static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
419{
420#ifdef CONFIG_PPC64
421 return (dma_addr == DMA_ERROR_CODE);
422#else
423 return 0;
424#endif
425}
426
427#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
428#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
429#ifdef CONFIG_NOT_COHERENT_CACHE
430#define dma_is_consistent(d, h) (0)
431#else
432#define dma_is_consistent(d, h) (1)
433#endif
434
435static inline int dma_get_cache_alignment(void)
436{
437#ifdef CONFIG_PPC64
438 /* no easy way to get cache size on all processors, so return
439 * the maximum possible, to be safe */
440 return (1 << INTERNODE_CACHE_SHIFT);
441#else
442 /*
443 * Each processor family will define its own L1_CACHE_SHIFT,
444 * L1_CACHE_BYTES wraps to this, so this is always safe.
445 */
446 return L1_CACHE_BYTES;
447#endif
448}
449
450static inline void dma_sync_single_range_for_cpu(struct device *dev,
451 dma_addr_t dma_handle, unsigned long offset, size_t size,
452 enum dma_data_direction direction)
453{
454 /* just sync everything for now */
455 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
456}
457
458static inline void dma_sync_single_range_for_device(struct device *dev,
459 dma_addr_t dma_handle, unsigned long offset, size_t size,
460 enum dma_data_direction direction)
461{
462 /* just sync everything for now */
463 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
464}
465
466static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
467 enum dma_data_direction direction)
468{
469 BUG_ON(direction == DMA_NONE);
470 __dma_sync(vaddr, size, (int)direction);
471}
472
473#endif /* __KERNEL__ */
474#endif /* _ASM_DMA_MAPPING_H */
diff --git a/arch/powerpc/include/asm/dma.h b/arch/powerpc/include/asm/dma.h
new file mode 100644
index 000000000000..a7e06e25c708
--- /dev/null
+++ b/arch/powerpc/include/asm/dma.h
@@ -0,0 +1,360 @@
1#ifndef _ASM_POWERPC_DMA_H
2#define _ASM_POWERPC_DMA_H
3#ifdef __KERNEL__
4
5/*
6 * Defines for using and allocating dma channels.
7 * Written by Hennus Bergman, 1992.
8 * High DMA channel support & info by Hannu Savolainen
9 * and John Boyd, Nov. 1992.
10 * Changes for ppc sound by Christoph Nadig
11 */
12
13/*
14 * Note: Adapted for PowerPC by Gary Thomas
15 * Modified by Cort Dougan <cort@cs.nmt.edu>
16 *
17 * None of this really applies for Power Macintoshes. There is
18 * basically just enough here to get kernel/dma.c to compile.
19 *
20 * There may be some comments or restrictions made here which are
21 * not valid for the PReP platform. Take what you read
22 * with a grain of salt.
23 */
24
25#include <asm/io.h>
26#include <linux/spinlock.h>
27#include <asm/system.h>
28
29#ifndef MAX_DMA_CHANNELS
30#define MAX_DMA_CHANNELS 8
31#endif
32
33/* The maximum address that we can perform a DMA transfer to on this platform */
34/* Doesn't really apply... */
35#define MAX_DMA_ADDRESS (~0UL)
36
37#if !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)
38
39#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
40#define dma_outb outb_p
41#else
42#define dma_outb outb
43#endif
44
45#define dma_inb inb
46
47/*
48 * NOTES about DMA transfers:
49 *
50 * controller 1: channels 0-3, byte operations, ports 00-1F
51 * controller 2: channels 4-7, word operations, ports C0-DF
52 *
53 * - ALL registers are 8 bits only, regardless of transfer size
54 * - channel 4 is not used - cascades 1 into 2.
55 * - channels 0-3 are byte - addresses/counts are for physical bytes
56 * - channels 5-7 are word - addresses/counts are for physical words
57 * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries
58 * - transfer count loaded to registers is 1 less than actual count
59 * - controller 2 offsets are all even (2x offsets for controller 1)
60 * - page registers for 5-7 don't use data bit 0, represent 128K pages
61 * - page registers for 0-3 use bit 0, represent 64K pages
62 *
63 * On PReP, DMA transfers are limited to the lower 16MB of _physical_ memory.
64 * On CHRP, the W83C553F (and VLSI Tollgate?) support full 32 bit addressing.
65 * Note that addresses loaded into registers must be _physical_ addresses,
66 * not logical addresses (which may differ if paging is active).
67 *
68 * Address mapping for channels 0-3:
69 *
70 * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses)
71 * | ... | | ... | | ... |
72 * | ... | | ... | | ... |
73 * | ... | | ... | | ... |
74 * P7 ... P0 A7 ... A0 A7 ... A0
75 * | Page | Addr MSB | Addr LSB | (DMA registers)
76 *
77 * Address mapping for channels 5-7:
78 *
79 * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses)
80 * | ... | \ \ ... \ \ \ ... \ \
81 * | ... | \ \ ... \ \ \ ... \ (not used)
82 * | ... | \ \ ... \ \ \ ... \
83 * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0
84 * | Page | Addr MSB | Addr LSB | (DMA registers)
85 *
86 * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses
87 * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at
88 * the hardware level, so odd-byte transfers aren't possible).
89 *
90 * Transfer count (_not # bytes_) is limited to 64K, represented as actual
91 * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more,
92 * and up to 128K bytes may be transferred on channels 5-7 in one operation.
93 *
94 */
95
96/* 8237 DMA controllers */
97#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
98#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
99
100/* DMA controller registers */
101#define DMA1_CMD_REG 0x08 /* command register (w) */
102#define DMA1_STAT_REG 0x08 /* status register (r) */
103#define DMA1_REQ_REG 0x09 /* request register (w) */
104#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
105#define DMA1_MODE_REG 0x0B /* mode register (w) */
106#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
107#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
108#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
109#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
110#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
111
112#define DMA2_CMD_REG 0xD0 /* command register (w) */
113#define DMA2_STAT_REG 0xD0 /* status register (r) */
114#define DMA2_REQ_REG 0xD2 /* request register (w) */
115#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
116#define DMA2_MODE_REG 0xD6 /* mode register (w) */
117#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
118#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
119#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
120#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
121#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
122
123#define DMA_ADDR_0 0x00 /* DMA address registers */
124#define DMA_ADDR_1 0x02
125#define DMA_ADDR_2 0x04
126#define DMA_ADDR_3 0x06
127#define DMA_ADDR_4 0xC0
128#define DMA_ADDR_5 0xC4
129#define DMA_ADDR_6 0xC8
130#define DMA_ADDR_7 0xCC
131
132#define DMA_CNT_0 0x01 /* DMA count registers */
133#define DMA_CNT_1 0x03
134#define DMA_CNT_2 0x05
135#define DMA_CNT_3 0x07
136#define DMA_CNT_4 0xC2
137#define DMA_CNT_5 0xC6
138#define DMA_CNT_6 0xCA
139#define DMA_CNT_7 0xCE
140
141#define DMA_LO_PAGE_0 0x87 /* DMA page registers */
142#define DMA_LO_PAGE_1 0x83
143#define DMA_LO_PAGE_2 0x81
144#define DMA_LO_PAGE_3 0x82
145#define DMA_LO_PAGE_5 0x8B
146#define DMA_LO_PAGE_6 0x89
147#define DMA_LO_PAGE_7 0x8A
148
149#define DMA_HI_PAGE_0 0x487 /* DMA page registers */
150#define DMA_HI_PAGE_1 0x483
151#define DMA_HI_PAGE_2 0x481
152#define DMA_HI_PAGE_3 0x482
153#define DMA_HI_PAGE_5 0x48B
154#define DMA_HI_PAGE_6 0x489
155#define DMA_HI_PAGE_7 0x48A
156
157#define DMA1_EXT_REG 0x40B
158#define DMA2_EXT_REG 0x4D6
159
160#ifndef __powerpc64__
161 /* in arch/ppc/kernel/setup.c -- Cort */
162 extern unsigned int DMA_MODE_WRITE;
163 extern unsigned int DMA_MODE_READ;
164 extern unsigned long ISA_DMA_THRESHOLD;
165#else
166 #define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
167 #define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
168#endif
169
170#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
171
172#define DMA_AUTOINIT 0x10
173
174extern spinlock_t dma_spin_lock;
175
176static __inline__ unsigned long claim_dma_lock(void)
177{
178 unsigned long flags;
179 spin_lock_irqsave(&dma_spin_lock, flags);
180 return flags;
181}
182
183static __inline__ void release_dma_lock(unsigned long flags)
184{
185 spin_unlock_irqrestore(&dma_spin_lock, flags);
186}
187
188/* enable/disable a specific DMA channel */
189static __inline__ void enable_dma(unsigned int dmanr)
190{
191 unsigned char ucDmaCmd = 0x00;
192
193 if (dmanr != 4) {
194 dma_outb(0, DMA2_MASK_REG); /* This may not be enabled */
195 dma_outb(ucDmaCmd, DMA2_CMD_REG); /* Enable group */
196 }
197 if (dmanr <= 3) {
198 dma_outb(dmanr, DMA1_MASK_REG);
199 dma_outb(ucDmaCmd, DMA1_CMD_REG); /* Enable group */
200 } else {
201 dma_outb(dmanr & 3, DMA2_MASK_REG);
202 }
203}
204
205static __inline__ void disable_dma(unsigned int dmanr)
206{
207 if (dmanr <= 3)
208 dma_outb(dmanr | 4, DMA1_MASK_REG);
209 else
210 dma_outb((dmanr & 3) | 4, DMA2_MASK_REG);
211}
212
213/* Clear the 'DMA Pointer Flip Flop'.
214 * Write 0 for LSB/MSB, 1 for MSB/LSB access.
215 * Use this once to initialize the FF to a known state.
216 * After that, keep track of it. :-)
217 * --- In order to do that, the DMA routines below should ---
218 * --- only be used while interrupts are disabled! ---
219 */
220static __inline__ void clear_dma_ff(unsigned int dmanr)
221{
222 if (dmanr <= 3)
223 dma_outb(0, DMA1_CLEAR_FF_REG);
224 else
225 dma_outb(0, DMA2_CLEAR_FF_REG);
226}
227
228/* set mode (above) for a specific DMA channel */
229static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
230{
231 if (dmanr <= 3)
232 dma_outb(mode | dmanr, DMA1_MODE_REG);
233 else
234 dma_outb(mode | (dmanr & 3), DMA2_MODE_REG);
235}
236
237/* Set only the page register bits of the transfer address.
238 * This is used for successive transfers when we know the contents of
239 * the lower 16 bits of the DMA current address register, but a 64k boundary
240 * may have been crossed.
241 */
242static __inline__ void set_dma_page(unsigned int dmanr, int pagenr)
243{
244 switch (dmanr) {
245 case 0:
246 dma_outb(pagenr, DMA_LO_PAGE_0);
247 dma_outb(pagenr >> 8, DMA_HI_PAGE_0);
248 break;
249 case 1:
250 dma_outb(pagenr, DMA_LO_PAGE_1);
251 dma_outb(pagenr >> 8, DMA_HI_PAGE_1);
252 break;
253 case 2:
254 dma_outb(pagenr, DMA_LO_PAGE_2);
255 dma_outb(pagenr >> 8, DMA_HI_PAGE_2);
256 break;
257 case 3:
258 dma_outb(pagenr, DMA_LO_PAGE_3);
259 dma_outb(pagenr >> 8, DMA_HI_PAGE_3);
260 break;
261 case 5:
262 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_5);
263 dma_outb(pagenr >> 8, DMA_HI_PAGE_5);
264 break;
265 case 6:
266 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_6);
267 dma_outb(pagenr >> 8, DMA_HI_PAGE_6);
268 break;
269 case 7:
270 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_7);
271 dma_outb(pagenr >> 8, DMA_HI_PAGE_7);
272 break;
273 }
274}
275
276/* Set transfer address & page bits for specific DMA channel.
277 * Assumes dma flipflop is clear.
278 */
279static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int phys)
280{
281 if (dmanr <= 3) {
282 dma_outb(phys & 0xff,
283 ((dmanr & 3) << 1) + IO_DMA1_BASE);
284 dma_outb((phys >> 8) & 0xff,
285 ((dmanr & 3) << 1) + IO_DMA1_BASE);
286 } else {
287 dma_outb((phys >> 1) & 0xff,
288 ((dmanr & 3) << 2) + IO_DMA2_BASE);
289 dma_outb((phys >> 9) & 0xff,
290 ((dmanr & 3) << 2) + IO_DMA2_BASE);
291 }
292 set_dma_page(dmanr, phys >> 16);
293}
294
295
296/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for
297 * a specific DMA channel.
298 * You must ensure the parameters are valid.
299 * NOTE: from a manual: "the number of transfers is one more
300 * than the initial word count"! This is taken into account.
301 * Assumes dma flip-flop is clear.
302 * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
303 */
304static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
305{
306 count--;
307 if (dmanr <= 3) {
308 dma_outb(count & 0xff,
309 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE);
310 dma_outb((count >> 8) & 0xff,
311 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE);
312 } else {
313 dma_outb((count >> 1) & 0xff,
314 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
315 dma_outb((count >> 9) & 0xff,
316 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
317 }
318}
319
320
321/* Get DMA residue count. After a DMA transfer, this
322 * should return zero. Reading this while a DMA transfer is
323 * still in progress will return unpredictable results.
324 * If called before the channel has been used, it may return 1.
325 * Otherwise, it returns the number of _bytes_ left to transfer.
326 *
327 * Assumes DMA flip-flop is clear.
328 */
329static __inline__ int get_dma_residue(unsigned int dmanr)
330{
331 unsigned int io_port = (dmanr <= 3)
332 ? ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE
333 : ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE;
334
335 /* using short to get 16-bit wrap around */
336 unsigned short count;
337
338 count = 1 + dma_inb(io_port);
339 count += dma_inb(io_port) << 8;
340
341 return (dmanr <= 3) ? count : (count << 1);
342}
343
344/* These are in kernel/dma.c: */
345
346/* reserve a DMA channel */
347extern int request_dma(unsigned int dmanr, const char *device_id);
348/* release it again */
349extern void free_dma(unsigned int dmanr);
350
351#ifdef CONFIG_PCI
352extern int isa_dma_bridge_buggy;
353#else
354#define isa_dma_bridge_buggy (0)
355#endif
356
357#endif /* !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) */
358
359#endif /* __KERNEL__ */
360#endif /* _ASM_POWERPC_DMA_H */
diff --git a/arch/powerpc/include/asm/edac.h b/arch/powerpc/include/asm/edac.h
new file mode 100644
index 000000000000..6ead88bbfbb8
--- /dev/null
+++ b/arch/powerpc/include/asm/edac.h
@@ -0,0 +1,40 @@
1/*
2 * PPC EDAC common defs
3 *
4 * Author: Dave Jiang <djiang@mvista.com>
5 *
6 * 2007 (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#ifndef ASM_EDAC_H
12#define ASM_EDAC_H
13/*
14 * ECC atomic, DMA, SMP and interrupt safe scrub function.
15 * Implements the per arch atomic_scrub() that EDAC use for software
16 * ECC scrubbing. It reads memory and then writes back the original
17 * value, allowing the hardware to detect and correct memory errors.
18 */
19static __inline__ void atomic_scrub(void *va, u32 size)
20{
21 unsigned int *virt_addr = va;
22 unsigned int temp;
23 unsigned int i;
24
25 for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) {
26 /* Very carefully read and write to memory atomically
27 * so we are interrupt, DMA and SMP safe.
28 */
29 __asm__ __volatile__ ("\n\
30 1: lwarx %0,0,%1\n\
31 stwcx. %0,0,%1\n\
32 bne- 1b\n\
33 isync"
34 : "=&r"(temp)
35 : "r"(virt_addr)
36 : "cr0", "memory");
37 }
38}
39
40#endif
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
new file mode 100644
index 000000000000..b886bec67016
--- /dev/null
+++ b/arch/powerpc/include/asm/eeh.h
@@ -0,0 +1,211 @@
1/*
2 * eeh.h
3 * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation.
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#ifndef _PPC64_EEH_H
21#define _PPC64_EEH_H
22#ifdef __KERNEL__
23
24#include <linux/init.h>
25#include <linux/list.h>
26#include <linux/string.h>
27
28struct pci_dev;
29struct pci_bus;
30struct device_node;
31
32#ifdef CONFIG_EEH
33
34extern int eeh_subsystem_enabled;
35
36/* Values for eeh_mode bits in device_node */
37#define EEH_MODE_SUPPORTED (1<<0)
38#define EEH_MODE_NOCHECK (1<<1)
39#define EEH_MODE_ISOLATED (1<<2)
40#define EEH_MODE_RECOVERING (1<<3)
41#define EEH_MODE_IRQ_DISABLED (1<<4)
42
43/* Max number of EEH freezes allowed before we consider the device
44 * to be permanently disabled. */
45#define EEH_MAX_ALLOWED_FREEZES 5
46
47void __init eeh_init(void);
48unsigned long eeh_check_failure(const volatile void __iomem *token,
49 unsigned long val);
50int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev);
51void __init pci_addr_cache_build(void);
52
53/**
54 * eeh_add_device_early
55 * eeh_add_device_late
56 *
57 * Perform eeh initialization for devices added after boot.
58 * Call eeh_add_device_early before doing any i/o to the
59 * device (including config space i/o). Call eeh_add_device_late
60 * to finish the eeh setup for this device.
61 */
62void eeh_add_device_tree_early(struct device_node *);
63void eeh_add_device_tree_late(struct pci_bus *);
64
65/**
66 * eeh_remove_device_recursive - undo EEH for device & children.
67 * @dev: pci device to be removed
68 *
69 * As above, this removes the device; it also removes child
70 * pci devices as well.
71 */
72void eeh_remove_bus_device(struct pci_dev *);
73
74/**
75 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
76 *
77 * If this macro yields TRUE, the caller relays to eeh_check_failure()
78 * which does further tests out of line.
79 */
80#define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0 && eeh_subsystem_enabled)
81
82/*
83 * Reads from a device which has been isolated by EEH will return
84 * all 1s. This macro gives an all-1s value of the given size (in
85 * bytes: 1, 2, or 4) for comparing with the result of a read.
86 */
87#define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8))
88
89#else /* !CONFIG_EEH */
90static inline void eeh_init(void) { }
91
92static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
93{
94 return val;
95}
96
97static inline int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
98{
99 return 0;
100}
101
102static inline void pci_addr_cache_build(void) { }
103
104static inline void eeh_add_device_tree_early(struct device_node *dn) { }
105
106static inline void eeh_add_device_tree_late(struct pci_bus *bus) { }
107
108static inline void eeh_remove_bus_device(struct pci_dev *dev) { }
109#define EEH_POSSIBLE_ERROR(val, type) (0)
110#define EEH_IO_ERROR_VALUE(size) (-1UL)
111#endif /* CONFIG_EEH */
112
113/*
114 * MMIO read/write operations with EEH support.
115 */
116static inline u8 eeh_readb(const volatile void __iomem *addr)
117{
118 u8 val = in_8(addr);
119 if (EEH_POSSIBLE_ERROR(val, u8))
120 return eeh_check_failure(addr, val);
121 return val;
122}
123
124static inline u16 eeh_readw(const volatile void __iomem *addr)
125{
126 u16 val = in_le16(addr);
127 if (EEH_POSSIBLE_ERROR(val, u16))
128 return eeh_check_failure(addr, val);
129 return val;
130}
131
132static inline u32 eeh_readl(const volatile void __iomem *addr)
133{
134 u32 val = in_le32(addr);
135 if (EEH_POSSIBLE_ERROR(val, u32))
136 return eeh_check_failure(addr, val);
137 return val;
138}
139
140static inline u64 eeh_readq(const volatile void __iomem *addr)
141{
142 u64 val = in_le64(addr);
143 if (EEH_POSSIBLE_ERROR(val, u64))
144 return eeh_check_failure(addr, val);
145 return val;
146}
147
148static inline u16 eeh_readw_be(const volatile void __iomem *addr)
149{
150 u16 val = in_be16(addr);
151 if (EEH_POSSIBLE_ERROR(val, u16))
152 return eeh_check_failure(addr, val);
153 return val;
154}
155
156static inline u32 eeh_readl_be(const volatile void __iomem *addr)
157{
158 u32 val = in_be32(addr);
159 if (EEH_POSSIBLE_ERROR(val, u32))
160 return eeh_check_failure(addr, val);
161 return val;
162}
163
164static inline u64 eeh_readq_be(const volatile void __iomem *addr)
165{
166 u64 val = in_be64(addr);
167 if (EEH_POSSIBLE_ERROR(val, u64))
168 return eeh_check_failure(addr, val);
169 return val;
170}
171
172static inline void eeh_memcpy_fromio(void *dest, const
173 volatile void __iomem *src,
174 unsigned long n)
175{
176 _memcpy_fromio(dest, src, n);
177
178 /* Look for ffff's here at dest[n]. Assume that at least 4 bytes
179 * were copied. Check all four bytes.
180 */
181 if (n >= 4 && EEH_POSSIBLE_ERROR(*((u32 *)(dest + n - 4)), u32))
182 eeh_check_failure(src, *((u32 *)(dest + n - 4)));
183}
184
185/* in-string eeh macros */
186static inline void eeh_readsb(const volatile void __iomem *addr, void * buf,
187 int ns)
188{
189 _insb(addr, buf, ns);
190 if (EEH_POSSIBLE_ERROR((*(((u8*)buf)+ns-1)), u8))
191 eeh_check_failure(addr, *(u8*)buf);
192}
193
194static inline void eeh_readsw(const volatile void __iomem *addr, void * buf,
195 int ns)
196{
197 _insw(addr, buf, ns);
198 if (EEH_POSSIBLE_ERROR((*(((u16*)buf)+ns-1)), u16))
199 eeh_check_failure(addr, *(u16*)buf);
200}
201
202static inline void eeh_readsl(const volatile void __iomem *addr, void * buf,
203 int nl)
204{
205 _insl(addr, buf, nl);
206 if (EEH_POSSIBLE_ERROR((*(((u32*)buf)+nl-1)), u32))
207 eeh_check_failure(addr, *(u32*)buf);
208}
209
210#endif /* __KERNEL__ */
211#endif /* _PPC64_EEH_H */
diff --git a/arch/powerpc/include/asm/eeh_event.h b/arch/powerpc/include/asm/eeh_event.h
new file mode 100644
index 000000000000..cc3cb04539ac
--- /dev/null
+++ b/arch/powerpc/include/asm/eeh_event.h
@@ -0,0 +1,53 @@
1/*
2 * eeh_event.h
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 (c) 2005 Linas Vepstas <linas@linas.org>
19 */
20
21#ifndef ASM_POWERPC_EEH_EVENT_H
22#define ASM_POWERPC_EEH_EVENT_H
23#ifdef __KERNEL__
24
25/** EEH event -- structure holding pci controller data that describes
26 * a change in the isolation status of a PCI slot. A pointer
27 * to this struct is passed as the data pointer in a notify callback.
28 */
29struct eeh_event {
30 struct list_head list;
31 struct device_node *dn; /* struct device node */
32 struct pci_dev *dev; /* affected device */
33};
34
35/**
36 * eeh_send_failure_event - generate a PCI error event
37 * @dev pci device
38 *
39 * This routine builds a PCI error event which will be delivered
40 * to all listeners on the eeh_notifier_chain.
41 *
42 * This routine can be called within an interrupt context;
43 * the actual event will be delivered in a normal context
44 * (from a workqueue).
45 */
46int eeh_send_failure_event (struct device_node *dn,
47 struct pci_dev *dev);
48
49/* Main recovery function */
50struct pci_dn * handle_eeh_events (struct eeh_event *);
51
52#endif /* __KERNEL__ */
53#endif /* ASM_POWERPC_EEH_EVENT_H */
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
new file mode 100644
index 000000000000..80d1f399ee51
--- /dev/null
+++ b/arch/powerpc/include/asm/elf.h
@@ -0,0 +1,424 @@
1#ifndef _ASM_POWERPC_ELF_H
2#define _ASM_POWERPC_ELF_H
3
4#ifdef __KERNEL__
5#include <linux/sched.h> /* for task_struct */
6#include <asm/page.h>
7#include <asm/string.h>
8#endif
9
10#include <asm/types.h>
11#include <asm/ptrace.h>
12#include <asm/cputable.h>
13#include <asm/auxvec.h>
14
15/* PowerPC relocations defined by the ABIs */
16#define R_PPC_NONE 0
17#define R_PPC_ADDR32 1 /* 32bit absolute address */
18#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
19#define R_PPC_ADDR16 3 /* 16bit absolute address */
20#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
21#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
22#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
23#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
24#define R_PPC_ADDR14_BRTAKEN 8
25#define R_PPC_ADDR14_BRNTAKEN 9
26#define R_PPC_REL24 10 /* PC relative 26 bit */
27#define R_PPC_REL14 11 /* PC relative 16 bit */
28#define R_PPC_REL14_BRTAKEN 12
29#define R_PPC_REL14_BRNTAKEN 13
30#define R_PPC_GOT16 14
31#define R_PPC_GOT16_LO 15
32#define R_PPC_GOT16_HI 16
33#define R_PPC_GOT16_HA 17
34#define R_PPC_PLTREL24 18
35#define R_PPC_COPY 19
36#define R_PPC_GLOB_DAT 20
37#define R_PPC_JMP_SLOT 21
38#define R_PPC_RELATIVE 22
39#define R_PPC_LOCAL24PC 23
40#define R_PPC_UADDR32 24
41#define R_PPC_UADDR16 25
42#define R_PPC_REL32 26
43#define R_PPC_PLT32 27
44#define R_PPC_PLTREL32 28
45#define R_PPC_PLT16_LO 29
46#define R_PPC_PLT16_HI 30
47#define R_PPC_PLT16_HA 31
48#define R_PPC_SDAREL16 32
49#define R_PPC_SECTOFF 33
50#define R_PPC_SECTOFF_LO 34
51#define R_PPC_SECTOFF_HI 35
52#define R_PPC_SECTOFF_HA 36
53
54/* PowerPC relocations defined for the TLS access ABI. */
55#define R_PPC_TLS 67 /* none (sym+add)@tls */
56#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */
57#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */
58#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
59#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
60#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
61#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */
62#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */
63#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
64#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
65#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
66#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */
67#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
68#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
69#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
70#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
71#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
72#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
73#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
74#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
75#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */
76#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */
77#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
78#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
79#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */
80#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
81#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
82#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
83
84/* keep this the last entry. */
85#define R_PPC_NUM 95
86
87/*
88 * ELF register definitions..
89 *
90 * This program is free software; you can redistribute it and/or
91 * modify it under the terms of the GNU General Public License
92 * as published by the Free Software Foundation; either version
93 * 2 of the License, or (at your option) any later version.
94 */
95
96#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
97#define ELF_NFPREG 33 /* includes fpscr */
98
99typedef unsigned long elf_greg_t64;
100typedef elf_greg_t64 elf_gregset_t64[ELF_NGREG];
101
102typedef unsigned int elf_greg_t32;
103typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG];
104typedef elf_gregset_t32 compat_elf_gregset_t;
105
106/*
107 * ELF_ARCH, CLASS, and DATA are used to set parameters in the core dumps.
108 */
109#ifdef __powerpc64__
110# define ELF_NVRREG32 33 /* includes vscr & vrsave stuffed together */
111# define ELF_NVRREG 34 /* includes vscr & vrsave in split vectors */
112# define ELF_NVSRHALFREG 32 /* Half the vsx registers */
113# define ELF_GREG_TYPE elf_greg_t64
114#else
115# define ELF_NEVRREG 34 /* includes acc (as 2) */
116# define ELF_NVRREG 33 /* includes vscr */
117# define ELF_GREG_TYPE elf_greg_t32
118# define ELF_ARCH EM_PPC
119# define ELF_CLASS ELFCLASS32
120# define ELF_DATA ELFDATA2MSB
121#endif /* __powerpc64__ */
122
123#ifndef ELF_ARCH
124# define ELF_ARCH EM_PPC64
125# define ELF_CLASS ELFCLASS64
126# define ELF_DATA ELFDATA2MSB
127 typedef elf_greg_t64 elf_greg_t;
128 typedef elf_gregset_t64 elf_gregset_t;
129#else
130 /* Assumption: ELF_ARCH == EM_PPC and ELF_CLASS == ELFCLASS32 */
131 typedef elf_greg_t32 elf_greg_t;
132 typedef elf_gregset_t32 elf_gregset_t;
133#endif /* ELF_ARCH */
134
135/* Floating point registers */
136typedef double elf_fpreg_t;
137typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
138
139/* Altivec registers */
140/*
141 * The entries with indexes 0-31 contain the corresponding vector registers.
142 * The entry with index 32 contains the vscr as the last word (offset 12)
143 * within the quadword. This allows the vscr to be stored as either a
144 * quadword (since it must be copied via a vector register to/from storage)
145 * or as a word.
146 *
147 * 64-bit kernel notes: The entry at index 33 contains the vrsave as the first
148 * word (offset 0) within the quadword.
149 *
150 * This definition of the VMX state is compatible with the current PPC32
151 * ptrace interface. This allows signal handling and ptrace to use the same
152 * structures. This also simplifies the implementation of a bi-arch
153 * (combined (32- and 64-bit) gdb.
154 *
155 * Note that it's _not_ compatible with 32 bits ucontext which stuffs the
156 * vrsave along with vscr and so only uses 33 vectors for the register set
157 */
158typedef __vector128 elf_vrreg_t;
159typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
160#ifdef __powerpc64__
161typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32];
162typedef elf_fpreg_t elf_vsrreghalf_t32[ELF_NVSRHALFREG];
163#endif
164
165#ifdef __KERNEL__
166/*
167 * This is used to ensure we don't load something for the wrong architecture.
168 */
169#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH)
170#define compat_elf_check_arch(x) ((x)->e_machine == EM_PPC)
171
172#define USE_ELF_CORE_DUMP
173#define CORE_DUMP_USE_REGSET
174#define ELF_EXEC_PAGESIZE PAGE_SIZE
175
176/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
177 use of this is to invoke "./ld.so someprog" to test out a new version of
178 the loader. We need to make sure that it is out of the way of the program
179 that it will "exec", and that there is sufficient room for the brk. */
180
181#define ELF_ET_DYN_BASE (0x20000000)
182
183/*
184 * Our registers are always unsigned longs, whether we're a 32 bit
185 * process or 64 bit, on either a 64 bit or 32 bit kernel.
186 *
187 * This macro relies on elf_regs[i] having the right type to truncate to,
188 * either u32 or u64. It defines the body of the elf_core_copy_regs
189 * function, either the native one with elf_gregset_t elf_regs or
190 * the 32-bit one with elf_gregset_t32 elf_regs.
191 */
192#define PPC_ELF_CORE_COPY_REGS(elf_regs, regs) \
193 int i, nregs = min(sizeof(*regs) / sizeof(unsigned long), \
194 (size_t)ELF_NGREG); \
195 for (i = 0; i < nregs; i++) \
196 elf_regs[i] = ((unsigned long *) regs)[i]; \
197 memset(&elf_regs[i], 0, (ELF_NGREG - i) * sizeof(elf_regs[0]))
198
199/* Common routine for both 32-bit and 64-bit native processes */
200static inline void ppc_elf_core_copy_regs(elf_gregset_t elf_regs,
201 struct pt_regs *regs)
202{
203 PPC_ELF_CORE_COPY_REGS(elf_regs, regs);
204}
205#define ELF_CORE_COPY_REGS(gregs, regs) ppc_elf_core_copy_regs(gregs, regs);
206
207typedef elf_vrregset_t elf_fpxregset_t;
208
209/* ELF_HWCAP yields a mask that user programs can use to figure out what
210 instruction set this cpu supports. This could be done in userspace,
211 but it's not easy, and we've already done it here. */
212# define ELF_HWCAP (cur_cpu_spec->cpu_user_features)
213
214/* This yields a string that ld.so will use to load implementation
215 specific libraries for optimization. This is more specific in
216 intent than poking at uname or /proc/cpuinfo. */
217
218#define ELF_PLATFORM (cur_cpu_spec->platform)
219
220/* While ELF_PLATFORM indicates the ISA supported by the platform, it
221 * may not accurately reflect the underlying behavior of the hardware
222 * (as in the case of running in Power5+ compatibility mode on a
223 * Power6 machine). ELF_BASE_PLATFORM allows ld.so to load libraries
224 * that are tuned for the real hardware.
225 */
226#define ELF_BASE_PLATFORM (powerpc_base_platform)
227
228#ifdef __powerpc64__
229# define ELF_PLAT_INIT(_r, load_addr) do { \
230 _r->gpr[2] = load_addr; \
231} while (0)
232#endif /* __powerpc64__ */
233
234#ifdef __powerpc64__
235# define SET_PERSONALITY(ex, ibcs2) \
236do { \
237 unsigned long new_flags = 0; \
238 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
239 new_flags = _TIF_32BIT; \
240 if ((current_thread_info()->flags & _TIF_32BIT) \
241 != new_flags) \
242 set_thread_flag(TIF_ABI_PENDING); \
243 else \
244 clear_thread_flag(TIF_ABI_PENDING); \
245 if (personality(current->personality) != PER_LINUX32) \
246 set_personality(PER_LINUX | \
247 (current->personality & (~PER_MASK))); \
248} while (0)
249/*
250 * An executable for which elf_read_implies_exec() returns TRUE will
251 * have the READ_IMPLIES_EXEC personality flag set automatically. This
252 * is only required to work around bugs in old 32bit toolchains. Since
253 * the 64bit ABI has never had these issues dont enable the workaround
254 * even if we have an executable stack.
255 */
256# define elf_read_implies_exec(ex, exec_stk) (test_thread_flag(TIF_32BIT) ? \
257 (exec_stk != EXSTACK_DISABLE_X) : 0)
258#else
259# define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
260#endif /* __powerpc64__ */
261
262extern int dcache_bsize;
263extern int icache_bsize;
264extern int ucache_bsize;
265
266/* vDSO has arch_setup_additional_pages */
267#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
268struct linux_binprm;
269extern int arch_setup_additional_pages(struct linux_binprm *bprm,
270 int executable_stack);
271#define VDSO_AUX_ENT(a,b) NEW_AUX_ENT(a,b);
272
273#endif /* __KERNEL__ */
274
275/*
276 * The requirements here are:
277 * - keep the final alignment of sp (sp & 0xf)
278 * - make sure the 32-bit value at the first 16 byte aligned position of
279 * AUXV is greater than 16 for glibc compatibility.
280 * AT_IGNOREPPC is used for that.
281 * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC,
282 * even if DLINFO_ARCH_ITEMS goes to zero or is undefined.
283 * update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes
284 */
285#define ARCH_DLINFO \
286do { \
287 /* Handle glibc compatibility. */ \
288 NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
289 NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
290 /* Cache size items */ \
291 NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize); \
292 NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize); \
293 NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize); \
294 VDSO_AUX_ENT(AT_SYSINFO_EHDR, current->mm->context.vdso_base) \
295} while (0)
296
297/* PowerPC64 relocations defined by the ABIs */
298#define R_PPC64_NONE R_PPC_NONE
299#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */
300#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */
301#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */
302#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */
303#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */
304#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
305#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */
306#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
307#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
308#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */
309#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */
310#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
311#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
312#define R_PPC64_GOT16 R_PPC_GOT16
313#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
314#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
315#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
316
317#define R_PPC64_COPY R_PPC_COPY
318#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
319#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
320#define R_PPC64_RELATIVE R_PPC_RELATIVE
321
322#define R_PPC64_UADDR32 R_PPC_UADDR32
323#define R_PPC64_UADDR16 R_PPC_UADDR16
324#define R_PPC64_REL32 R_PPC_REL32
325#define R_PPC64_PLT32 R_PPC_PLT32
326#define R_PPC64_PLTREL32 R_PPC_PLTREL32
327#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
328#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
329#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
330
331#define R_PPC64_SECTOFF R_PPC_SECTOFF
332#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
333#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
334#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
335#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2. */
336#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */
337#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */
338#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */
339#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */
340#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */
341#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */
342#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */
343#define R_PPC64_PLT64 45 /* doubleword64 L + A. */
344#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */
345#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */
346#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */
347#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */
348#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */
349#define R_PPC64_TOC 51 /* doubleword64 .TOC. */
350#define R_PPC64_PLTGOT16 52 /* half16* M + A. */
351#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */
352#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */
353#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */
354
355#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2. */
356#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2. */
357#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2. */
358#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2. */
359#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2. */
360#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2. */
361#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2. */
362#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2. */
363#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2. */
364#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2. */
365#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2. */
366
367/* PowerPC64 relocations defined for the TLS access ABI. */
368#define R_PPC64_TLS 67 /* none (sym+add)@tls */
369#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
370#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
371#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
372#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
373#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
374#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
375#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
376#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
377#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
378#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
379#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
380#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
381#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
382#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
383#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
384#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
385#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
386#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
387#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
388#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
389#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
390#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
391#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
392#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
393#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
394#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
395#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
396#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
397#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
398#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
399#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
400#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
401#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
402#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
403#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
404#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
405#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
406#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
407#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
408
409/* Keep this the last entry. */
410#define R_PPC64_NUM 107
411
412#ifdef __KERNEL__
413
414#ifdef CONFIG_SPU_BASE
415/* Notes used in ET_CORE. Note name is "SPU/<fd>/<filename>". */
416#define NT_SPU 1
417
418#define ARCH_HAVE_EXTRA_ELF_NOTES
419
420#endif /* CONFIG_SPU_BASE */
421
422#endif /* __KERNEL */
423
424#endif /* _ASM_POWERPC_ELF_H */
diff --git a/arch/powerpc/include/asm/emergency-restart.h b/arch/powerpc/include/asm/emergency-restart.h
new file mode 100644
index 000000000000..3711bd9d50bd
--- /dev/null
+++ b/arch/powerpc/include/asm/emergency-restart.h
@@ -0,0 +1 @@
#include <asm-generic/emergency-restart.h>
diff --git a/arch/powerpc/include/asm/errno.h b/arch/powerpc/include/asm/errno.h
new file mode 100644
index 000000000000..8c145fd17d86
--- /dev/null
+++ b/arch/powerpc/include/asm/errno.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_POWERPC_ERRNO_H
2#define _ASM_POWERPC_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#undef EDEADLOCK
7#define EDEADLOCK 58 /* File locking deadlock error */
8
9#define _LAST_ERRNO 516
10
11#endif /* _ASM_POWERPC_ERRNO_H */
diff --git a/arch/powerpc/include/asm/exception.h b/arch/powerpc/include/asm/exception.h
new file mode 100644
index 000000000000..329148b5acc6
--- /dev/null
+++ b/arch/powerpc/include/asm/exception.h
@@ -0,0 +1,311 @@
1#ifndef _ASM_POWERPC_EXCEPTION_H
2#define _ASM_POWERPC_EXCEPTION_H
3/*
4 * Extracted from head_64.S
5 *
6 * PowerPC version
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 *
9 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
10 * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
11 * Adapted for Power Macintosh by Paul Mackerras.
12 * Low-level exception handlers and MMU support
13 * rewritten by Paul Mackerras.
14 * Copyright (C) 1996 Paul Mackerras.
15 *
16 * Adapted for 64bit PowerPC by Dave Engebretsen, Peter Bergner, and
17 * Mike Corrigan {engebret|bergner|mikejc}@us.ibm.com
18 *
19 * This file contains the low-level support and setup for the
20 * PowerPC-64 platform, including trap and interrupt dispatch.
21 *
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * as published by the Free Software Foundation; either version
25 * 2 of the License, or (at your option) any later version.
26 */
27/*
28 * The following macros define the code that appears as
29 * the prologue to each of the exception handlers. They
30 * are split into two parts to allow a single kernel binary
31 * to be used for pSeries and iSeries.
32 *
33 * We make as much of the exception code common between native
34 * exception handlers (including pSeries LPAR) and iSeries LPAR
35 * implementations as possible.
36 */
37
38#define EX_R9 0
39#define EX_R10 8
40#define EX_R11 16
41#define EX_R12 24
42#define EX_R13 32
43#define EX_SRR0 40
44#define EX_DAR 48
45#define EX_DSISR 56
46#define EX_CCR 60
47#define EX_R3 64
48#define EX_LR 72
49
50/*
51 * We're short on space and time in the exception prolog, so we can't
52 * use the normal SET_REG_IMMEDIATE macro. Normally we just need the
53 * low halfword of the address, but for Kdump we need the whole low
54 * word.
55 */
56#ifdef CONFIG_CRASH_DUMP
57#define LOAD_HANDLER(reg, label) \
58 oris reg,reg,(label)@h; /* virt addr of handler ... */ \
59 ori reg,reg,(label)@l; /* .. and the rest */
60#else
61#define LOAD_HANDLER(reg, label) \
62 ori reg,reg,(label)@l; /* virt addr of handler ... */
63#endif
64
65#define EXCEPTION_PROLOG_1(area) \
66 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \
67 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
68 std r10,area+EX_R10(r13); \
69 std r11,area+EX_R11(r13); \
70 std r12,area+EX_R12(r13); \
71 mfspr r9,SPRN_SPRG1; \
72 std r9,area+EX_R13(r13); \
73 mfcr r9
74
75/*
76 * Equal to EXCEPTION_PROLOG_PSERIES, except that it forces 64bit mode.
77 * The firmware calls the registered system_reset_fwnmi and
78 * machine_check_fwnmi handlers in 32bit mode if the cpu happens to run
79 * a 32bit application at the time of the event.
80 * This firmware bug is present on POWER4 and JS20.
81 */
82#define EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(area, label) \
83 EXCEPTION_PROLOG_1(area); \
84 clrrdi r12,r13,32; /* get high part of &label */ \
85 mfmsr r10; \
86 /* force 64bit mode */ \
87 li r11,5; /* MSR_SF_LG|MSR_ISF_LG */ \
88 rldimi r10,r11,61,0; /* insert into top 3 bits */ \
89 /* done 64bit mode */ \
90 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
91 LOAD_HANDLER(r12,label) \
92 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
93 mtspr SPRN_SRR0,r12; \
94 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
95 mtspr SPRN_SRR1,r10; \
96 rfid; \
97 b . /* prevent speculative execution */
98
99#define EXCEPTION_PROLOG_PSERIES(area, label) \
100 EXCEPTION_PROLOG_1(area); \
101 clrrdi r12,r13,32; /* get high part of &label */ \
102 mfmsr r10; \
103 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
104 LOAD_HANDLER(r12,label) \
105 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
106 mtspr SPRN_SRR0,r12; \
107 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
108 mtspr SPRN_SRR1,r10; \
109 rfid; \
110 b . /* prevent speculative execution */
111
112/*
113 * The common exception prolog is used for all except a few exceptions
114 * such as a segment miss on a kernel address. We have to be prepared
115 * to take another exception from the point where we first touch the
116 * kernel stack onwards.
117 *
118 * On entry r13 points to the paca, r9-r13 are saved in the paca,
119 * r9 contains the saved CR, r11 and r12 contain the saved SRR0 and
120 * SRR1, and relocation is on.
121 */
122#define EXCEPTION_PROLOG_COMMON(n, area) \
123 andi. r10,r12,MSR_PR; /* See if coming from user */ \
124 mr r10,r1; /* Save r1 */ \
125 subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \
126 beq- 1f; \
127 ld r1,PACAKSAVE(r13); /* kernel stack to use */ \
1281: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \
129 bge- cr1,2f; /* abort if it is */ \
130 b 3f; \
1312: li r1,(n); /* will be reloaded later */ \
132 sth r1,PACA_TRAP_SAVE(r13); \
133 b bad_stack; \
1343: std r9,_CCR(r1); /* save CR in stackframe */ \
135 std r11,_NIP(r1); /* save SRR0 in stackframe */ \
136 std r12,_MSR(r1); /* save SRR1 in stackframe */ \
137 std r10,0(r1); /* make stack chain pointer */ \
138 std r0,GPR0(r1); /* save r0 in stackframe */ \
139 std r10,GPR1(r1); /* save r1 in stackframe */ \
140 ACCOUNT_CPU_USER_ENTRY(r9, r10); \
141 std r2,GPR2(r1); /* save r2 in stackframe */ \
142 SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \
143 SAVE_2GPRS(7, r1); /* save r7, r8 in stackframe */ \
144 ld r9,area+EX_R9(r13); /* move r9, r10 to stackframe */ \
145 ld r10,area+EX_R10(r13); \
146 std r9,GPR9(r1); \
147 std r10,GPR10(r1); \
148 ld r9,area+EX_R11(r13); /* move r11 - r13 to stackframe */ \
149 ld r10,area+EX_R12(r13); \
150 ld r11,area+EX_R13(r13); \
151 std r9,GPR11(r1); \
152 std r10,GPR12(r1); \
153 std r11,GPR13(r1); \
154 ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \
155 mflr r9; /* save LR in stackframe */ \
156 std r9,_LINK(r1); \
157 mfctr r10; /* save CTR in stackframe */ \
158 std r10,_CTR(r1); \
159 lbz r10,PACASOFTIRQEN(r13); \
160 mfspr r11,SPRN_XER; /* save XER in stackframe */ \
161 std r10,SOFTE(r1); \
162 std r11,_XER(r1); \
163 li r9,(n)+1; \
164 std r9,_TRAP(r1); /* set trap number */ \
165 li r10,0; \
166 ld r11,exception_marker@toc(r2); \
167 std r10,RESULT(r1); /* clear regs->result */ \
168 std r11,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame */
169
170/*
171 * Exception vectors.
172 */
173#define STD_EXCEPTION_PSERIES(n, label) \
174 . = n; \
175 .globl label##_pSeries; \
176label##_pSeries: \
177 HMT_MEDIUM; \
178 mtspr SPRN_SPRG1,r13; /* save r13 */ \
179 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
180
181#define HSTD_EXCEPTION_PSERIES(n, label) \
182 . = n; \
183 .globl label##_pSeries; \
184label##_pSeries: \
185 HMT_MEDIUM; \
186 mtspr SPRN_SPRG1,r20; /* save r20 */ \
187 mfspr r20,SPRN_HSRR0; /* copy HSRR0 to SRR0 */ \
188 mtspr SPRN_SRR0,r20; \
189 mfspr r20,SPRN_HSRR1; /* copy HSRR0 to SRR0 */ \
190 mtspr SPRN_SRR1,r20; \
191 mfspr r20,SPRN_SPRG1; /* restore r20 */ \
192 mtspr SPRN_SPRG1,r13; /* save r13 */ \
193 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
194
195
196#define MASKABLE_EXCEPTION_PSERIES(n, label) \
197 . = n; \
198 .globl label##_pSeries; \
199label##_pSeries: \
200 HMT_MEDIUM; \
201 mtspr SPRN_SPRG1,r13; /* save r13 */ \
202 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \
203 std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \
204 std r10,PACA_EXGEN+EX_R10(r13); \
205 lbz r10,PACASOFTIRQEN(r13); \
206 mfcr r9; \
207 cmpwi r10,0; \
208 beq masked_interrupt; \
209 mfspr r10,SPRN_SPRG1; \
210 std r10,PACA_EXGEN+EX_R13(r13); \
211 std r11,PACA_EXGEN+EX_R11(r13); \
212 std r12,PACA_EXGEN+EX_R12(r13); \
213 clrrdi r12,r13,32; /* get high part of &label */ \
214 mfmsr r10; \
215 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
216 LOAD_HANDLER(r12,label##_common) \
217 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
218 mtspr SPRN_SRR0,r12; \
219 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
220 mtspr SPRN_SRR1,r10; \
221 rfid; \
222 b . /* prevent speculative execution */
223
224#ifdef CONFIG_PPC_ISERIES
225#define DISABLE_INTS \
226 li r11,0; \
227 stb r11,PACASOFTIRQEN(r13); \
228BEGIN_FW_FTR_SECTION; \
229 stb r11,PACAHARDIRQEN(r13); \
230END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES); \
231 TRACE_DISABLE_INTS; \
232BEGIN_FW_FTR_SECTION; \
233 mfmsr r10; \
234 ori r10,r10,MSR_EE; \
235 mtmsrd r10,1; \
236END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
237#else
238#define DISABLE_INTS \
239 li r11,0; \
240 stb r11,PACASOFTIRQEN(r13); \
241 stb r11,PACAHARDIRQEN(r13); \
242 TRACE_DISABLE_INTS
243#endif /* CONFIG_PPC_ISERIES */
244
245#define ENABLE_INTS \
246 ld r12,_MSR(r1); \
247 mfmsr r11; \
248 rlwimi r11,r12,0,MSR_EE; \
249 mtmsrd r11,1
250
251#define STD_EXCEPTION_COMMON(trap, label, hdlr) \
252 .align 7; \
253 .globl label##_common; \
254label##_common: \
255 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
256 DISABLE_INTS; \
257 bl .save_nvgprs; \
258 addi r3,r1,STACK_FRAME_OVERHEAD; \
259 bl hdlr; \
260 b .ret_from_except
261
262/*
263 * Like STD_EXCEPTION_COMMON, but for exceptions that can occur
264 * in the idle task and therefore need the special idle handling.
265 */
266#define STD_EXCEPTION_COMMON_IDLE(trap, label, hdlr) \
267 .align 7; \
268 .globl label##_common; \
269label##_common: \
270 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
271 FINISH_NAP; \
272 DISABLE_INTS; \
273 bl .save_nvgprs; \
274 addi r3,r1,STACK_FRAME_OVERHEAD; \
275 bl hdlr; \
276 b .ret_from_except
277
278#define STD_EXCEPTION_COMMON_LITE(trap, label, hdlr) \
279 .align 7; \
280 .globl label##_common; \
281label##_common: \
282 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
283 FINISH_NAP; \
284 DISABLE_INTS; \
285BEGIN_FTR_SECTION \
286 bl .ppc64_runlatch_on; \
287END_FTR_SECTION_IFSET(CPU_FTR_CTRL) \
288 addi r3,r1,STACK_FRAME_OVERHEAD; \
289 bl hdlr; \
290 b .ret_from_except_lite
291
292/*
293 * When the idle code in power4_idle puts the CPU into NAP mode,
294 * it has to do so in a loop, and relies on the external interrupt
295 * and decrementer interrupt entry code to get it out of the loop.
296 * It sets the _TLF_NAPPING bit in current_thread_info()->local_flags
297 * to signal that it is in the loop and needs help to get out.
298 */
299#ifdef CONFIG_PPC_970_NAP
300#define FINISH_NAP \
301BEGIN_FTR_SECTION \
302 clrrdi r11,r1,THREAD_SHIFT; \
303 ld r9,TI_LOCAL_FLAGS(r11); \
304 andi. r10,r9,_TLF_NAPPING; \
305 bnel power4_fixup_nap; \
306END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
307#else
308#define FINISH_NAP
309#endif
310
311#endif /* _ASM_POWERPC_EXCEPTION_H */
diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
new file mode 100644
index 000000000000..411af8d17a69
--- /dev/null
+++ b/arch/powerpc/include/asm/fb.h
@@ -0,0 +1,21 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT,
12 vma->vm_end - vma->vm_start,
13 vma->vm_page_prot);
14}
15
16static inline int fb_is_primary_device(struct fb_info *info)
17{
18 return 0;
19}
20
21#endif /* _ASM_FB_H_ */
diff --git a/arch/powerpc/include/asm/fcntl.h b/arch/powerpc/include/asm/fcntl.h
new file mode 100644
index 000000000000..ce5c4516d404
--- /dev/null
+++ b/arch/powerpc/include/asm/fcntl.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_FCNTL_H
2#define _ASM_FCNTL_H
3
4#define O_DIRECTORY 040000 /* must be a directory */
5#define O_NOFOLLOW 0100000 /* don't follow links */
6#define O_LARGEFILE 0200000
7#define O_DIRECT 0400000 /* direct disk access hint */
8
9#include <asm-generic/fcntl.h>
10
11#endif /* _ASM_FCNTL_H */
diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h
new file mode 100644
index 000000000000..a1029967620b
--- /dev/null
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -0,0 +1,126 @@
1#ifndef __ASM_POWERPC_FEATURE_FIXUPS_H
2#define __ASM_POWERPC_FEATURE_FIXUPS_H
3
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#ifdef __ASSEMBLY__
12
13/*
14 * Feature section common macros
15 *
16 * Note that the entries now contain offsets between the table entry
17 * and the code rather than absolute code pointers in order to be
18 * useable with the vdso shared library. There is also an assumption
19 * that values will be negative, that is, the fixup table has to be
20 * located after the code it fixes up.
21 */
22#if defined(CONFIG_PPC64) && !defined(__powerpc64__)
23/* 64 bits kernel, 32 bits code (ie. vdso32) */
24#define FTR_ENTRY_LONG .llong
25#define FTR_ENTRY_OFFSET .long 0xffffffff; .long
26#else
27/* 64 bit kernel 64 bit code, or 32 bit kernel 32 bit code */
28#define FTR_ENTRY_LONG PPC_LONG
29#define FTR_ENTRY_OFFSET PPC_LONG
30#endif
31
32#define START_FTR_SECTION(label) label##1:
33
34#define FTR_SECTION_ELSE_NESTED(label) \
35label##2: \
36 .pushsection __ftr_alt_##label,"a"; \
37 .align 2; \
38label##3:
39
40#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
41label##4: \
42 .popsection; \
43 .pushsection sect,"a"; \
44 .align 3; \
45label##5: \
46 FTR_ENTRY_LONG msk; \
47 FTR_ENTRY_LONG val; \
48 FTR_ENTRY_OFFSET label##1b-label##5b; \
49 FTR_ENTRY_OFFSET label##2b-label##5b; \
50 FTR_ENTRY_OFFSET label##3b-label##5b; \
51 FTR_ENTRY_OFFSET label##4b-label##5b; \
52 .popsection;
53
54
55/* CPU feature dependent sections */
56#define BEGIN_FTR_SECTION_NESTED(label) START_FTR_SECTION(label)
57#define BEGIN_FTR_SECTION START_FTR_SECTION(97)
58
59#define END_FTR_SECTION_NESTED(msk, val, label) \
60 FTR_SECTION_ELSE_NESTED(label) \
61 MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup)
62
63#define END_FTR_SECTION(msk, val) \
64 END_FTR_SECTION_NESTED(msk, val, 97)
65
66#define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk))
67#define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0)
68
69/* CPU feature sections with alternatives, use BEGIN_FTR_SECTION to start */
70#define FTR_SECTION_ELSE FTR_SECTION_ELSE_NESTED(97)
71#define ALT_FTR_SECTION_END_NESTED(msk, val, label) \
72 MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup)
73#define ALT_FTR_SECTION_END_NESTED_IFSET(msk, label) \
74 ALT_FTR_SECTION_END_NESTED(msk, msk, label)
75#define ALT_FTR_SECTION_END_NESTED_IFCLR(msk, label) \
76 ALT_FTR_SECTION_END_NESTED(msk, 0, label)
77#define ALT_FTR_SECTION_END(msk, val) \
78 ALT_FTR_SECTION_END_NESTED(msk, val, 97)
79#define ALT_FTR_SECTION_END_IFSET(msk) \
80 ALT_FTR_SECTION_END_NESTED_IFSET(msk, 97)
81#define ALT_FTR_SECTION_END_IFCLR(msk) \
82 ALT_FTR_SECTION_END_NESTED_IFCLR(msk, 97)
83
84/* Firmware feature dependent sections */
85#define BEGIN_FW_FTR_SECTION_NESTED(label) START_FTR_SECTION(label)
86#define BEGIN_FW_FTR_SECTION START_FTR_SECTION(97)
87
88#define END_FW_FTR_SECTION_NESTED(msk, val, label) \
89 FTR_SECTION_ELSE_NESTED(label) \
90 MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup)
91
92#define END_FW_FTR_SECTION(msk, val) \
93 END_FW_FTR_SECTION_NESTED(msk, val, 97)
94
95#define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk))
96#define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0)
97
98/* Firmware feature sections with alternatives */
99#define FW_FTR_SECTION_ELSE_NESTED(label) FTR_SECTION_ELSE_NESTED(label)
100#define FW_FTR_SECTION_ELSE FTR_SECTION_ELSE_NESTED(97)
101#define ALT_FW_FTR_SECTION_END_NESTED(msk, val, label) \
102 MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup)
103#define ALT_FW_FTR_SECTION_END_NESTED_IFSET(msk, label) \
104 ALT_FW_FTR_SECTION_END_NESTED(msk, msk, label)
105#define ALT_FW_FTR_SECTION_END_NESTED_IFCLR(msk, label) \
106 ALT_FW_FTR_SECTION_END_NESTED(msk, 0, label)
107#define ALT_FW_FTR_SECTION_END(msk, val) \
108 ALT_FW_FTR_SECTION_END_NESTED(msk, val, 97)
109#define ALT_FW_FTR_SECTION_END_IFSET(msk) \
110 ALT_FW_FTR_SECTION_END_NESTED_IFSET(msk, 97)
111#define ALT_FW_FTR_SECTION_END_IFCLR(msk) \
112 ALT_FW_FTR_SECTION_END_NESTED_IFCLR(msk, 97)
113
114#endif /* __ASSEMBLY__ */
115
116/* LWSYNC feature sections */
117#define START_LWSYNC_SECTION(label) label##1:
118#define MAKE_LWSYNC_SECTION_ENTRY(label, sect) \
119label##2: \
120 .pushsection sect,"a"; \
121 .align 2; \
122label##3: \
123 .long label##1b-label##3b; \
124 .popsection;
125
126#endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */
diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h
new file mode 100644
index 000000000000..3a179827528d
--- /dev/null
+++ b/arch/powerpc/include/asm/firmware.h
@@ -0,0 +1,132 @@
1/*
2 * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
3 *
4 * Modifications for ppc64:
5 * Copyright (C) 2003 Dave Engebretsen <engebret@us.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#ifndef __ASM_POWERPC_FIRMWARE_H
13#define __ASM_POWERPC_FIRMWARE_H
14
15#ifdef __KERNEL__
16
17#include <asm/asm-compat.h>
18#include <asm/feature-fixups.h>
19
20/* firmware feature bitmask values */
21#define FIRMWARE_MAX_FEATURES 63
22
23#define FW_FEATURE_PFT ASM_CONST(0x0000000000000001)
24#define FW_FEATURE_TCE ASM_CONST(0x0000000000000002)
25#define FW_FEATURE_SPRG0 ASM_CONST(0x0000000000000004)
26#define FW_FEATURE_DABR ASM_CONST(0x0000000000000008)
27#define FW_FEATURE_COPY ASM_CONST(0x0000000000000010)
28#define FW_FEATURE_ASR ASM_CONST(0x0000000000000020)
29#define FW_FEATURE_DEBUG ASM_CONST(0x0000000000000040)
30#define FW_FEATURE_TERM ASM_CONST(0x0000000000000080)
31#define FW_FEATURE_PERF ASM_CONST(0x0000000000000100)
32#define FW_FEATURE_DUMP ASM_CONST(0x0000000000000200)
33#define FW_FEATURE_INTERRUPT ASM_CONST(0x0000000000000400)
34#define FW_FEATURE_MIGRATE ASM_CONST(0x0000000000000800)
35#define FW_FEATURE_PERFMON ASM_CONST(0x0000000000001000)
36#define FW_FEATURE_CRQ ASM_CONST(0x0000000000002000)
37#define FW_FEATURE_VIO ASM_CONST(0x0000000000004000)
38#define FW_FEATURE_RDMA ASM_CONST(0x0000000000008000)
39#define FW_FEATURE_LLAN ASM_CONST(0x0000000000010000)
40#define FW_FEATURE_BULK ASM_CONST(0x0000000000020000)
41#define FW_FEATURE_XDABR ASM_CONST(0x0000000000040000)
42#define FW_FEATURE_MULTITCE ASM_CONST(0x0000000000080000)
43#define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000)
44#define FW_FEATURE_ISERIES ASM_CONST(0x0000000000200000)
45#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000)
46#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000)
47#define FW_FEATURE_BEAT ASM_CONST(0x0000000001000000)
48#define FW_FEATURE_BULK_REMOVE ASM_CONST(0x0000000002000000)
49#define FW_FEATURE_CMO ASM_CONST(0x0000000004000000)
50
51#ifndef __ASSEMBLY__
52
53enum {
54#ifdef CONFIG_PPC64
55 FW_FEATURE_PSERIES_POSSIBLE = FW_FEATURE_PFT | FW_FEATURE_TCE |
56 FW_FEATURE_SPRG0 | FW_FEATURE_DABR | FW_FEATURE_COPY |
57 FW_FEATURE_ASR | FW_FEATURE_DEBUG | FW_FEATURE_TERM |
58 FW_FEATURE_PERF | FW_FEATURE_DUMP | FW_FEATURE_INTERRUPT |
59 FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ |
60 FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
61 FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE |
62 FW_FEATURE_SPLPAR | FW_FEATURE_LPAR | FW_FEATURE_CMO,
63 FW_FEATURE_PSERIES_ALWAYS = 0,
64 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
65 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
66 FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
67 FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
68 FW_FEATURE_CELLEB_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_BEAT,
69 FW_FEATURE_CELLEB_ALWAYS = 0,
70 FW_FEATURE_NATIVE_POSSIBLE = 0,
71 FW_FEATURE_NATIVE_ALWAYS = 0,
72 FW_FEATURE_POSSIBLE =
73#ifdef CONFIG_PPC_PSERIES
74 FW_FEATURE_PSERIES_POSSIBLE |
75#endif
76#ifdef CONFIG_PPC_ISERIES
77 FW_FEATURE_ISERIES_POSSIBLE |
78#endif
79#ifdef CONFIG_PPC_PS3
80 FW_FEATURE_PS3_POSSIBLE |
81#endif
82#ifdef CONFIG_PPC_CELLEB
83 FW_FEATURE_CELLEB_POSSIBLE |
84#endif
85#ifdef CONFIG_PPC_NATIVE
86 FW_FEATURE_NATIVE_ALWAYS |
87#endif
88 0,
89 FW_FEATURE_ALWAYS =
90#ifdef CONFIG_PPC_PSERIES
91 FW_FEATURE_PSERIES_ALWAYS &
92#endif
93#ifdef CONFIG_PPC_ISERIES
94 FW_FEATURE_ISERIES_ALWAYS &
95#endif
96#ifdef CONFIG_PPC_PS3
97 FW_FEATURE_PS3_ALWAYS &
98#endif
99#ifdef CONFIG_PPC_CELLEB
100 FW_FEATURE_CELLEB_ALWAYS &
101#endif
102#ifdef CONFIG_PPC_NATIVE
103 FW_FEATURE_NATIVE_ALWAYS &
104#endif
105 FW_FEATURE_POSSIBLE,
106
107#else /* CONFIG_PPC64 */
108 FW_FEATURE_POSSIBLE = 0,
109 FW_FEATURE_ALWAYS = 0,
110#endif
111};
112
113/* This is used to identify firmware features which are available
114 * to the kernel.
115 */
116extern unsigned long powerpc_firmware_features;
117
118#define firmware_has_feature(feature) \
119 ((FW_FEATURE_ALWAYS & (feature)) || \
120 (FW_FEATURE_POSSIBLE & powerpc_firmware_features & (feature)))
121
122extern void system_reset_fwnmi(void);
123extern void machine_check_fwnmi(void);
124
125/* This is true if we are using the firmware NMI handler (typically LPAR) */
126extern int fwnmi_active;
127
128extern unsigned int __start___fw_ftr_fixup, __stop___fw_ftr_fixup;
129
130#endif /* __ASSEMBLY__ */
131#endif /* __KERNEL__ */
132#endif /* __ASM_POWERPC_FIRMWARE_H */
diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h
new file mode 100644
index 000000000000..8428b38a3d30
--- /dev/null
+++ b/arch/powerpc/include/asm/fixmap.h
@@ -0,0 +1,106 @@
1/*
2 * fixmap.h: compile-time virtual memory allocation
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 * Copyright (C) 1998 Ingo Molnar
9 *
10 * Copyright 2008 Freescale Semiconductor Inc.
11 * Port to powerpc added by Kumar Gala
12 */
13
14#ifndef _ASM_FIXMAP_H
15#define _ASM_FIXMAP_H
16
17extern unsigned long FIXADDR_TOP;
18
19#ifndef __ASSEMBLY__
20#include <linux/kernel.h>
21#include <asm/page.h>
22#ifdef CONFIG_HIGHMEM
23#include <linux/threads.h>
24#include <asm/kmap_types.h>
25#endif
26
27/*
28 * Here we define all the compile-time 'special' virtual
29 * addresses. The point is to have a constant address at
30 * compile time, but to set the physical address only
31 * in the boot process. We allocate these special addresses
32 * from the end of virtual memory (0xfffff000) backwards.
33 * Also this lets us do fail-safe vmalloc(), we
34 * can guarantee that these special addresses and
35 * vmalloc()-ed addresses never overlap.
36 *
37 * these 'compile-time allocated' memory buffers are
38 * fixed-size 4k pages. (or larger if used with an increment
39 * highger than 1) use fixmap_set(idx,phys) to associate
40 * physical memory with fixmap indices.
41 *
42 * TLB entries of such buffers will not be flushed across
43 * task switches.
44 */
45enum fixed_addresses {
46 FIX_HOLE,
47#ifdef CONFIG_HIGHMEM
48 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
49 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
50#endif
51 /* FIX_PCIE_MCFG, */
52 __end_of_fixed_addresses
53};
54
55extern void __set_fixmap (enum fixed_addresses idx,
56 phys_addr_t phys, pgprot_t flags);
57
58#define set_fixmap(idx, phys) \
59 __set_fixmap(idx, phys, PAGE_KERNEL)
60/*
61 * Some hardware wants to get fixmapped without caching.
62 */
63#define set_fixmap_nocache(idx, phys) \
64 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
65
66#define clear_fixmap(idx) \
67 __set_fixmap(idx, 0, __pgprot(0))
68
69#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
70#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
71
72#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
73#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
74
75extern void __this_fixmap_does_not_exist(void);
76
77/*
78 * 'index to address' translation. If anyone tries to use the idx
79 * directly without tranlation, we catch the bug with a NULL-deference
80 * kernel oops. Illegal ranges of incoming indices are caught too.
81 */
82static __always_inline unsigned long fix_to_virt(const unsigned int idx)
83{
84 /*
85 * this branch gets completely eliminated after inlining,
86 * except when someone tries to use fixaddr indices in an
87 * illegal way. (such as mixing up address types or using
88 * out-of-range indices).
89 *
90 * If it doesn't get removed, the linker will complain
91 * loudly with a reasonably clear error message..
92 */
93 if (idx >= __end_of_fixed_addresses)
94 __this_fixmap_does_not_exist();
95
96 return __fix_to_virt(idx);
97}
98
99static inline unsigned long virt_to_fix(const unsigned long vaddr)
100{
101 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
102 return __virt_to_fix(vaddr);
103}
104
105#endif /* !__ASSEMBLY__ */
106#endif
diff --git a/arch/powerpc/include/asm/floppy.h b/arch/powerpc/include/asm/floppy.h
new file mode 100644
index 000000000000..24bd34c57e9d
--- /dev/null
+++ b/arch/powerpc/include/asm/floppy.h
@@ -0,0 +1,213 @@
1/*
2 * Architecture specific parts of the Floppy driver
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 * Copyright (C) 1995
9 */
10#ifndef __ASM_POWERPC_FLOPPY_H
11#define __ASM_POWERPC_FLOPPY_H
12#ifdef __KERNEL__
13
14#include <asm/machdep.h>
15
16#define fd_inb(port) inb_p(port)
17#define fd_outb(value,port) outb_p(value,port)
18
19#define fd_enable_dma() enable_dma(FLOPPY_DMA)
20#define fd_disable_dma() fd_ops->_disable_dma(FLOPPY_DMA)
21#define fd_free_dma() fd_ops->_free_dma(FLOPPY_DMA)
22#define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA)
23#define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA, mode)
24#define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA, count)
25#define fd_get_dma_residue() fd_ops->_get_dma_residue(FLOPPY_DMA)
26#define fd_enable_irq() enable_irq(FLOPPY_IRQ)
27#define fd_disable_irq() disable_irq(FLOPPY_IRQ)
28#define fd_cacheflush(addr,size) /* nothing */
29#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
30
31#include <linux/pci.h>
32#include <asm/ppc-pci.h> /* for isa_bridge_pcidev */
33
34#define fd_dma_setup(addr,size,mode,io) fd_ops->_dma_setup(addr,size,mode,io)
35
36static int fd_request_dma(void);
37
38struct fd_dma_ops {
39 void (*_disable_dma)(unsigned int dmanr);
40 void (*_free_dma)(unsigned int dmanr);
41 int (*_get_dma_residue)(unsigned int dummy);
42 int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
43};
44
45static int virtual_dma_count;
46static int virtual_dma_residue;
47static char *virtual_dma_addr;
48static int virtual_dma_mode;
49static int doing_vdma;
50static struct fd_dma_ops *fd_ops;
51
52static irqreturn_t floppy_hardint(int irq, void *dev_id)
53{
54 unsigned char st;
55 int lcount;
56 char *lptr;
57
58 if (!doing_vdma)
59 return floppy_interrupt(irq, dev_id);
60
61
62 st = 1;
63 for (lcount=virtual_dma_count, lptr=virtual_dma_addr;
64 lcount; lcount--, lptr++) {
65 st=inb(virtual_dma_port+4) & 0xa0 ;
66 if (st != 0xa0)
67 break;
68 if (virtual_dma_mode)
69 outb_p(*lptr, virtual_dma_port+5);
70 else
71 *lptr = inb_p(virtual_dma_port+5);
72 }
73 virtual_dma_count = lcount;
74 virtual_dma_addr = lptr;
75 st = inb(virtual_dma_port+4);
76
77 if (st == 0x20)
78 return IRQ_HANDLED;
79 if (!(st & 0x20)) {
80 virtual_dma_residue += virtual_dma_count;
81 virtual_dma_count=0;
82 doing_vdma = 0;
83 floppy_interrupt(irq, dev_id);
84 return IRQ_HANDLED;
85 }
86 return IRQ_HANDLED;
87}
88
89static void vdma_disable_dma(unsigned int dummy)
90{
91 doing_vdma = 0;
92 virtual_dma_residue += virtual_dma_count;
93 virtual_dma_count=0;
94}
95
96static void vdma_nop(unsigned int dummy)
97{
98}
99
100
101static int vdma_get_dma_residue(unsigned int dummy)
102{
103 return virtual_dma_count + virtual_dma_residue;
104}
105
106
107static int fd_request_irq(void)
108{
109 if (can_use_virtual_dma)
110 return request_irq(FLOPPY_IRQ, floppy_hardint,
111 IRQF_DISABLED, "floppy", NULL);
112 else
113 return request_irq(FLOPPY_IRQ, floppy_interrupt,
114 IRQF_DISABLED, "floppy", NULL);
115}
116
117static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
118{
119 doing_vdma = 1;
120 virtual_dma_port = io;
121 virtual_dma_mode = (mode == DMA_MODE_WRITE);
122 virtual_dma_addr = addr;
123 virtual_dma_count = size;
124 virtual_dma_residue = 0;
125 return 0;
126}
127
128static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
129{
130 static unsigned long prev_size;
131 static dma_addr_t bus_addr = 0;
132 static char *prev_addr;
133 static int prev_dir;
134 int dir;
135
136 doing_vdma = 0;
137 dir = (mode == DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
138
139 if (bus_addr
140 && (addr != prev_addr || size != prev_size || dir != prev_dir)) {
141 /* different from last time -- unmap prev */
142 pci_unmap_single(isa_bridge_pcidev, bus_addr, prev_size, prev_dir);
143 bus_addr = 0;
144 }
145
146 if (!bus_addr) /* need to map it */
147 bus_addr = pci_map_single(isa_bridge_pcidev, addr, size, dir);
148
149 /* remember this one as prev */
150 prev_addr = addr;
151 prev_size = size;
152 prev_dir = dir;
153
154 fd_clear_dma_ff();
155 fd_cacheflush(addr, size);
156 fd_set_dma_mode(mode);
157 set_dma_addr(FLOPPY_DMA, bus_addr);
158 fd_set_dma_count(size);
159 virtual_dma_port = io;
160 fd_enable_dma();
161
162 return 0;
163}
164
165static struct fd_dma_ops real_dma_ops =
166{
167 ._disable_dma = disable_dma,
168 ._free_dma = free_dma,
169 ._get_dma_residue = get_dma_residue,
170 ._dma_setup = hard_dma_setup
171};
172
173static struct fd_dma_ops virt_dma_ops =
174{
175 ._disable_dma = vdma_disable_dma,
176 ._free_dma = vdma_nop,
177 ._get_dma_residue = vdma_get_dma_residue,
178 ._dma_setup = vdma_dma_setup
179};
180
181static int fd_request_dma(void)
182{
183 if (can_use_virtual_dma & 1) {
184 fd_ops = &virt_dma_ops;
185 return 0;
186 }
187 else {
188 fd_ops = &real_dma_ops;
189 return request_dma(FLOPPY_DMA, "floppy");
190 }
191}
192
193static int FDC1 = 0x3f0;
194static int FDC2 = -1;
195
196/*
197 * Again, the CMOS information not available
198 */
199#define FLOPPY0_TYPE 6
200#define FLOPPY1_TYPE 0
201
202#define N_FDC 2 /* Don't change this! */
203#define N_DRIVE 8
204
205/*
206 * The PowerPC has no problems with floppy DMA crossing 64k borders.
207 */
208#define CROSS_64KB(a,s) (0)
209
210#define EXTRA_FLOPPY_PARAMS
211
212#endif /* __KERNEL__ */
213#endif /* __ASM_POWERPC_FLOPPY_H */
diff --git a/arch/powerpc/include/asm/fs_pd.h b/arch/powerpc/include/asm/fs_pd.h
new file mode 100644
index 000000000000..9361cd5342cc
--- /dev/null
+++ b/arch/powerpc/include/asm/fs_pd.h
@@ -0,0 +1,50 @@
1/*
2 * Platform information definitions.
3 *
4 * 2006 (c) MontaVista Software, Inc.
5 * Vitaly Bordug <vbordug@ru.mvista.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef FS_PD_H
13#define FS_PD_H
14#include <sysdev/fsl_soc.h>
15#include <asm/time.h>
16
17#ifdef CONFIG_CPM2
18#include <asm/cpm2.h>
19
20#if defined(CONFIG_8260)
21#include <asm/mpc8260.h>
22#endif
23
24#define cpm2_map(member) (&cpm2_immr->member)
25#define cpm2_map_size(member, size) (&cpm2_immr->member)
26#define cpm2_unmap(addr) do {} while(0)
27#endif
28
29#ifdef CONFIG_8xx
30#include <asm/8xx_immap.h>
31#include <asm/mpc8xx.h>
32
33extern immap_t __iomem *mpc8xx_immr;
34
35#define immr_map(member) (&mpc8xx_immr->member)
36#define immr_map_size(member, size) (&mpc8xx_immr->member)
37#define immr_unmap(addr) do {} while (0)
38#endif
39
40static inline int uart_baudrate(void)
41{
42 return get_baudrate();
43}
44
45static inline int uart_clock(void)
46{
47 return ppc_proc_freq;
48}
49
50#endif
diff --git a/arch/powerpc/include/asm/fsl_gtm.h b/arch/powerpc/include/asm/fsl_gtm.h
new file mode 100644
index 000000000000..8e8c9b5032d3
--- /dev/null
+++ b/arch/powerpc/include/asm/fsl_gtm.h
@@ -0,0 +1,47 @@
1/*
2 * Freescale General-purpose Timers Module
3 *
4 * Copyright (c) Freescale Semicondutor, Inc. 2006.
5 * Shlomi Gridish <gridish@freescale.com>
6 * Jerry Huang <Chang-Ming.Huang@freescale.com>
7 * Copyright (c) MontaVista Software, Inc. 2008.
8 * Anton Vorontsov <avorontsov@ru.mvista.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#ifndef __ASM_FSL_GTM_H
17#define __ASM_FSL_GTM_H
18
19#include <linux/types.h>
20
21struct gtm;
22
23struct gtm_timer {
24 unsigned int irq;
25
26 struct gtm *gtm;
27 bool requested;
28 u8 __iomem *gtcfr;
29 __be16 __iomem *gtmdr;
30 __be16 __iomem *gtpsr;
31 __be16 __iomem *gtcnr;
32 __be16 __iomem *gtrfr;
33 __be16 __iomem *gtevr;
34};
35
36extern struct gtm_timer *gtm_get_timer16(void);
37extern struct gtm_timer *gtm_get_specific_timer16(struct gtm *gtm,
38 unsigned int timer);
39extern void gtm_put_timer16(struct gtm_timer *tmr);
40extern int gtm_set_timer16(struct gtm_timer *tmr, unsigned long usec,
41 bool reload);
42extern int gtm_set_exact_timer16(struct gtm_timer *tmr, u16 usec,
43 bool reload);
44extern void gtm_stop_timer16(struct gtm_timer *tmr);
45extern void gtm_ack_timer16(struct gtm_timer *tmr, u16 events);
46
47#endif /* __ASM_FSL_GTM_H */
diff --git a/arch/powerpc/include/asm/fsl_lbc.h b/arch/powerpc/include/asm/fsl_lbc.h
new file mode 100644
index 000000000000..303f5484c050
--- /dev/null
+++ b/arch/powerpc/include/asm/fsl_lbc.h
@@ -0,0 +1,311 @@
1/* Freescale Local Bus Controller
2 *
3 * Copyright (c) 2006-2007 Freescale Semiconductor
4 *
5 * Authors: Nick Spence <nick.spence@freescale.com>,
6 * Scott Wood <scottwood@freescale.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __ASM_FSL_LBC_H
24#define __ASM_FSL_LBC_H
25
26#include <linux/types.h>
27#include <linux/spinlock.h>
28#include <asm/io.h>
29
30struct fsl_lbc_bank {
31 __be32 br; /**< Base Register */
32#define BR_BA 0xFFFF8000
33#define BR_BA_SHIFT 15
34#define BR_PS 0x00001800
35#define BR_PS_SHIFT 11
36#define BR_PS_8 0x00000800 /* Port Size 8 bit */
37#define BR_PS_16 0x00001000 /* Port Size 16 bit */
38#define BR_PS_32 0x00001800 /* Port Size 32 bit */
39#define BR_DECC 0x00000600
40#define BR_DECC_SHIFT 9
41#define BR_DECC_OFF 0x00000000 /* HW ECC checking and generation off */
42#define BR_DECC_CHK 0x00000200 /* HW ECC checking on, generation off */
43#define BR_DECC_CHK_GEN 0x00000400 /* HW ECC checking and generation on */
44#define BR_WP 0x00000100
45#define BR_WP_SHIFT 8
46#define BR_MSEL 0x000000E0
47#define BR_MSEL_SHIFT 5
48#define BR_MS_GPCM 0x00000000 /* GPCM */
49#define BR_MS_FCM 0x00000020 /* FCM */
50#define BR_MS_SDRAM 0x00000060 /* SDRAM */
51#define BR_MS_UPMA 0x00000080 /* UPMA */
52#define BR_MS_UPMB 0x000000A0 /* UPMB */
53#define BR_MS_UPMC 0x000000C0 /* UPMC */
54#define BR_V 0x00000001
55#define BR_V_SHIFT 0
56#define BR_RES ~(BR_BA|BR_PS|BR_DECC|BR_WP|BR_MSEL|BR_V)
57
58 __be32 or; /**< Base Register */
59#define OR0 0x5004
60#define OR1 0x500C
61#define OR2 0x5014
62#define OR3 0x501C
63#define OR4 0x5024
64#define OR5 0x502C
65#define OR6 0x5034
66#define OR7 0x503C
67
68#define OR_FCM_AM 0xFFFF8000
69#define OR_FCM_AM_SHIFT 15
70#define OR_FCM_BCTLD 0x00001000
71#define OR_FCM_BCTLD_SHIFT 12
72#define OR_FCM_PGS 0x00000400
73#define OR_FCM_PGS_SHIFT 10
74#define OR_FCM_CSCT 0x00000200
75#define OR_FCM_CSCT_SHIFT 9
76#define OR_FCM_CST 0x00000100
77#define OR_FCM_CST_SHIFT 8
78#define OR_FCM_CHT 0x00000080
79#define OR_FCM_CHT_SHIFT 7
80#define OR_FCM_SCY 0x00000070
81#define OR_FCM_SCY_SHIFT 4
82#define OR_FCM_SCY_1 0x00000010
83#define OR_FCM_SCY_2 0x00000020
84#define OR_FCM_SCY_3 0x00000030
85#define OR_FCM_SCY_4 0x00000040
86#define OR_FCM_SCY_5 0x00000050
87#define OR_FCM_SCY_6 0x00000060
88#define OR_FCM_SCY_7 0x00000070
89#define OR_FCM_RST 0x00000008
90#define OR_FCM_RST_SHIFT 3
91#define OR_FCM_TRLX 0x00000004
92#define OR_FCM_TRLX_SHIFT 2
93#define OR_FCM_EHTR 0x00000002
94#define OR_FCM_EHTR_SHIFT 1
95};
96
97struct fsl_lbc_regs {
98 struct fsl_lbc_bank bank[8];
99 u8 res0[0x28];
100 __be32 mar; /**< UPM Address Register */
101 u8 res1[0x4];
102 __be32 mamr; /**< UPMA Mode Register */
103#define MxMR_OP_NO (0 << 28) /**< normal operation */
104#define MxMR_OP_WA (1 << 28) /**< write array */
105#define MxMR_OP_RA (2 << 28) /**< read array */
106#define MxMR_OP_RP (3 << 28) /**< run pattern */
107#define MxMR_MAD 0x3f /**< machine address */
108 __be32 mbmr; /**< UPMB Mode Register */
109 __be32 mcmr; /**< UPMC Mode Register */
110 u8 res2[0x8];
111 __be32 mrtpr; /**< Memory Refresh Timer Prescaler Register */
112 __be32 mdr; /**< UPM Data Register */
113 u8 res3[0x4];
114 __be32 lsor; /**< Special Operation Initiation Register */
115 __be32 lsdmr; /**< SDRAM Mode Register */
116 u8 res4[0x8];
117 __be32 lurt; /**< UPM Refresh Timer */
118 __be32 lsrt; /**< SDRAM Refresh Timer */
119 u8 res5[0x8];
120 __be32 ltesr; /**< Transfer Error Status Register */
121#define LTESR_BM 0x80000000
122#define LTESR_FCT 0x40000000
123#define LTESR_PAR 0x20000000
124#define LTESR_WP 0x04000000
125#define LTESR_ATMW 0x00800000
126#define LTESR_ATMR 0x00400000
127#define LTESR_CS 0x00080000
128#define LTESR_CC 0x00000001
129#define LTESR_NAND_MASK (LTESR_FCT | LTESR_PAR | LTESR_CC)
130 __be32 ltedr; /**< Transfer Error Disable Register */
131 __be32 lteir; /**< Transfer Error Interrupt Register */
132 __be32 lteatr; /**< Transfer Error Attributes Register */
133 __be32 ltear; /**< Transfer Error Address Register */
134 u8 res6[0xC];
135 __be32 lbcr; /**< Configuration Register */
136#define LBCR_LDIS 0x80000000
137#define LBCR_LDIS_SHIFT 31
138#define LBCR_BCTLC 0x00C00000
139#define LBCR_BCTLC_SHIFT 22
140#define LBCR_AHD 0x00200000
141#define LBCR_LPBSE 0x00020000
142#define LBCR_LPBSE_SHIFT 17
143#define LBCR_EPAR 0x00010000
144#define LBCR_EPAR_SHIFT 16
145#define LBCR_BMT 0x0000FF00
146#define LBCR_BMT_SHIFT 8
147#define LBCR_INIT 0x00040000
148 __be32 lcrr; /**< Clock Ratio Register */
149#define LCRR_DBYP 0x80000000
150#define LCRR_DBYP_SHIFT 31
151#define LCRR_BUFCMDC 0x30000000
152#define LCRR_BUFCMDC_SHIFT 28
153#define LCRR_ECL 0x03000000
154#define LCRR_ECL_SHIFT 24
155#define LCRR_EADC 0x00030000
156#define LCRR_EADC_SHIFT 16
157#define LCRR_CLKDIV 0x0000000F
158#define LCRR_CLKDIV_SHIFT 0
159 u8 res7[0x8];
160 __be32 fmr; /**< Flash Mode Register */
161#define FMR_CWTO 0x0000F000
162#define FMR_CWTO_SHIFT 12
163#define FMR_BOOT 0x00000800
164#define FMR_ECCM 0x00000100
165#define FMR_AL 0x00000030
166#define FMR_AL_SHIFT 4
167#define FMR_OP 0x00000003
168#define FMR_OP_SHIFT 0
169 __be32 fir; /**< Flash Instruction Register */
170#define FIR_OP0 0xF0000000
171#define FIR_OP0_SHIFT 28
172#define FIR_OP1 0x0F000000
173#define FIR_OP1_SHIFT 24
174#define FIR_OP2 0x00F00000
175#define FIR_OP2_SHIFT 20
176#define FIR_OP3 0x000F0000
177#define FIR_OP3_SHIFT 16
178#define FIR_OP4 0x0000F000
179#define FIR_OP4_SHIFT 12
180#define FIR_OP5 0x00000F00
181#define FIR_OP5_SHIFT 8
182#define FIR_OP6 0x000000F0
183#define FIR_OP6_SHIFT 4
184#define FIR_OP7 0x0000000F
185#define FIR_OP7_SHIFT 0
186#define FIR_OP_NOP 0x0 /* No operation and end of sequence */
187#define FIR_OP_CA 0x1 /* Issue current column address */
188#define FIR_OP_PA 0x2 /* Issue current block+page address */
189#define FIR_OP_UA 0x3 /* Issue user defined address */
190#define FIR_OP_CM0 0x4 /* Issue command from FCR[CMD0] */
191#define FIR_OP_CM1 0x5 /* Issue command from FCR[CMD1] */
192#define FIR_OP_CM2 0x6 /* Issue command from FCR[CMD2] */
193#define FIR_OP_CM3 0x7 /* Issue command from FCR[CMD3] */
194#define FIR_OP_WB 0x8 /* Write FBCR bytes from FCM buffer */
195#define FIR_OP_WS 0x9 /* Write 1 or 2 bytes from MDR[AS] */
196#define FIR_OP_RB 0xA /* Read FBCR bytes to FCM buffer */
197#define FIR_OP_RS 0xB /* Read 1 or 2 bytes to MDR[AS] */
198#define FIR_OP_CW0 0xC /* Wait then issue FCR[CMD0] */
199#define FIR_OP_CW1 0xD /* Wait then issue FCR[CMD1] */
200#define FIR_OP_RBW 0xE /* Wait then read FBCR bytes */
201#define FIR_OP_RSW 0xE /* Wait then read 1 or 2 bytes */
202 __be32 fcr; /**< Flash Command Register */
203#define FCR_CMD0 0xFF000000
204#define FCR_CMD0_SHIFT 24
205#define FCR_CMD1 0x00FF0000
206#define FCR_CMD1_SHIFT 16
207#define FCR_CMD2 0x0000FF00
208#define FCR_CMD2_SHIFT 8
209#define FCR_CMD3 0x000000FF
210#define FCR_CMD3_SHIFT 0
211 __be32 fbar; /**< Flash Block Address Register */
212#define FBAR_BLK 0x00FFFFFF
213 __be32 fpar; /**< Flash Page Address Register */
214#define FPAR_SP_PI 0x00007C00
215#define FPAR_SP_PI_SHIFT 10
216#define FPAR_SP_MS 0x00000200
217#define FPAR_SP_CI 0x000001FF
218#define FPAR_SP_CI_SHIFT 0
219#define FPAR_LP_PI 0x0003F000
220#define FPAR_LP_PI_SHIFT 12
221#define FPAR_LP_MS 0x00000800
222#define FPAR_LP_CI 0x000007FF
223#define FPAR_LP_CI_SHIFT 0
224 __be32 fbcr; /**< Flash Byte Count Register */
225#define FBCR_BC 0x00000FFF
226 u8 res11[0x8];
227 u8 res8[0xF00];
228};
229
230extern struct fsl_lbc_regs __iomem *fsl_lbc_regs;
231extern spinlock_t fsl_lbc_lock;
232
233/*
234 * FSL UPM routines
235 */
236struct fsl_upm {
237 __be32 __iomem *mxmr;
238 int width;
239};
240
241extern int fsl_lbc_find(phys_addr_t addr_base);
242extern int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm);
243
244/**
245 * fsl_upm_start_pattern - start UPM patterns execution
246 * @upm: pointer to the fsl_upm structure obtained via fsl_upm_find
247 * @pat_offset: UPM pattern offset for the command to be executed
248 *
249 * This routine programmes UPM so the next memory access that hits an UPM
250 * will trigger pattern execution, starting at pat_offset.
251 */
252static inline void fsl_upm_start_pattern(struct fsl_upm *upm, u8 pat_offset)
253{
254 clrsetbits_be32(upm->mxmr, MxMR_MAD, MxMR_OP_RP | pat_offset);
255}
256
257/**
258 * fsl_upm_end_pattern - end UPM patterns execution
259 * @upm: pointer to the fsl_upm structure obtained via fsl_upm_find
260 *
261 * This routine reverts UPM to normal operation mode.
262 */
263static inline void fsl_upm_end_pattern(struct fsl_upm *upm)
264{
265 clrbits32(upm->mxmr, MxMR_OP_RP);
266
267 while (in_be32(upm->mxmr) & MxMR_OP_RP)
268 cpu_relax();
269}
270
271/**
272 * fsl_upm_run_pattern - actually run an UPM pattern
273 * @upm: pointer to the fsl_upm structure obtained via fsl_upm_find
274 * @io_base: remapped pointer to where memory access should happen
275 * @mar: MAR register content during pattern execution
276 *
277 * This function triggers dummy write to the memory specified by the io_base,
278 * thus UPM pattern actually executed. Note that mar usage depends on the
279 * pre-programmed AMX bits in the UPM RAM.
280 */
281static inline int fsl_upm_run_pattern(struct fsl_upm *upm,
282 void __iomem *io_base, u32 mar)
283{
284 int ret = 0;
285 unsigned long flags;
286
287 spin_lock_irqsave(&fsl_lbc_lock, flags);
288
289 out_be32(&fsl_lbc_regs->mar, mar << (32 - upm->width));
290
291 switch (upm->width) {
292 case 8:
293 out_8(io_base, 0x0);
294 break;
295 case 16:
296 out_be16(io_base, 0x0);
297 break;
298 case 32:
299 out_be32(io_base, 0x0);
300 break;
301 default:
302 ret = -EINVAL;
303 break;
304 }
305
306 spin_unlock_irqrestore(&fsl_lbc_lock, flags);
307
308 return ret;
309}
310
311#endif /* __ASM_FSL_LBC_H */
diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
new file mode 100644
index 000000000000..de921326cca8
--- /dev/null
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -0,0 +1,14 @@
1#ifndef _ASM_POWERPC_FTRACE
2#define _ASM_POWERPC_FTRACE
3
4#ifdef CONFIG_FTRACE
5#define MCOUNT_ADDR ((long)(_mcount))
6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
7
8#ifndef __ASSEMBLY__
9extern void _mcount(void);
10#endif
11
12#endif
13
14#endif /* _ASM_POWERPC_FTRACE */
diff --git a/arch/powerpc/include/asm/futex.h b/arch/powerpc/include/asm/futex.h
new file mode 100644
index 000000000000..6d406c5c5de4
--- /dev/null
+++ b/arch/powerpc/include/asm/futex.h
@@ -0,0 +1,117 @@
1#ifndef _ASM_POWERPC_FUTEX_H
2#define _ASM_POWERPC_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <linux/uaccess.h>
8#include <asm/errno.h>
9#include <asm/synch.h>
10#include <asm/asm-compat.h>
11
12#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
13 __asm__ __volatile ( \
14 LWSYNC_ON_SMP \
15"1: lwarx %0,0,%2\n" \
16 insn \
17 PPC405_ERR77(0, %2) \
18"2: stwcx. %1,0,%2\n" \
19 "bne- 1b\n" \
20 "li %1,0\n" \
21"3: .section .fixup,\"ax\"\n" \
22"4: li %1,%3\n" \
23 "b 3b\n" \
24 ".previous\n" \
25 ".section __ex_table,\"a\"\n" \
26 ".align 3\n" \
27 PPC_LONG "1b,4b,2b,4b\n" \
28 ".previous" \
29 : "=&r" (oldval), "=&r" (ret) \
30 : "b" (uaddr), "i" (-EFAULT), "1" (oparg) \
31 : "cr0", "memory")
32
33static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
34{
35 int op = (encoded_op >> 28) & 7;
36 int cmp = (encoded_op >> 24) & 15;
37 int oparg = (encoded_op << 8) >> 20;
38 int cmparg = (encoded_op << 20) >> 20;
39 int oldval = 0, ret;
40 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
41 oparg = 1 << oparg;
42
43 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
44 return -EFAULT;
45
46 pagefault_disable();
47
48 switch (op) {
49 case FUTEX_OP_SET:
50 __futex_atomic_op("", ret, oldval, uaddr, oparg);
51 break;
52 case FUTEX_OP_ADD:
53 __futex_atomic_op("add %1,%0,%1\n", ret, oldval, uaddr, oparg);
54 break;
55 case FUTEX_OP_OR:
56 __futex_atomic_op("or %1,%0,%1\n", ret, oldval, uaddr, oparg);
57 break;
58 case FUTEX_OP_ANDN:
59 __futex_atomic_op("andc %1,%0,%1\n", ret, oldval, uaddr, oparg);
60 break;
61 case FUTEX_OP_XOR:
62 __futex_atomic_op("xor %1,%0,%1\n", ret, oldval, uaddr, oparg);
63 break;
64 default:
65 ret = -ENOSYS;
66 }
67
68 pagefault_enable();
69
70 if (!ret) {
71 switch (cmp) {
72 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
73 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
74 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
75 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
76 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
77 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
78 default: ret = -ENOSYS;
79 }
80 }
81 return ret;
82}
83
84static inline int
85futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
86{
87 int prev;
88
89 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
90 return -EFAULT;
91
92 __asm__ __volatile__ (
93 LWSYNC_ON_SMP
94"1: lwarx %0,0,%2 # futex_atomic_cmpxchg_inatomic\n\
95 cmpw 0,%0,%3\n\
96 bne- 3f\n"
97 PPC405_ERR77(0,%2)
98"2: stwcx. %4,0,%2\n\
99 bne- 1b\n"
100 ISYNC_ON_SMP
101"3: .section .fixup,\"ax\"\n\
1024: li %0,%5\n\
103 b 3b\n\
104 .previous\n\
105 .section __ex_table,\"a\"\n\
106 .align 3\n\
107 " PPC_LONG "1b,4b,2b,4b\n\
108 .previous" \
109 : "=&r" (prev), "+m" (*uaddr)
110 : "r" (uaddr), "r" (oldval), "r" (newval), "i" (-EFAULT)
111 : "cc", "memory");
112
113 return prev;
114}
115
116#endif /* __KERNEL__ */
117#endif /* _ASM_POWERPC_FUTEX_H */
diff --git a/arch/powerpc/include/asm/gpio.h b/arch/powerpc/include/asm/gpio.h
new file mode 100644
index 000000000000..ea04632399d8
--- /dev/null
+++ b/arch/powerpc/include/asm/gpio.h
@@ -0,0 +1,56 @@
1/*
2 * Generic GPIO API implementation for PowerPC.
3 *
4 * Copyright (c) 2007-2008 MontaVista Software, Inc.
5 *
6 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __ASM_POWERPC_GPIO_H
15#define __ASM_POWERPC_GPIO_H
16
17#include <linux/errno.h>
18#include <asm-generic/gpio.h>
19
20#ifdef CONFIG_GPIOLIB
21
22/*
23 * We don't (yet) implement inlined/rapid versions for on-chip gpios.
24 * Just call gpiolib.
25 */
26static inline int gpio_get_value(unsigned int gpio)
27{
28 return __gpio_get_value(gpio);
29}
30
31static inline void gpio_set_value(unsigned int gpio, int value)
32{
33 __gpio_set_value(gpio, value);
34}
35
36static inline int gpio_cansleep(unsigned int gpio)
37{
38 return __gpio_cansleep(gpio);
39}
40
41/*
42 * Not implemented, yet.
43 */
44static inline int gpio_to_irq(unsigned int gpio)
45{
46 return -ENOSYS;
47}
48
49static inline int irq_to_gpio(unsigned int irq)
50{
51 return -EINVAL;
52}
53
54#endif /* CONFIG_GPIOLIB */
55
56#endif /* __ASM_POWERPC_GPIO_H */
diff --git a/arch/powerpc/include/asm/grackle.h b/arch/powerpc/include/asm/grackle.h
new file mode 100644
index 000000000000..bd7812a519d4
--- /dev/null
+++ b/arch/powerpc/include/asm/grackle.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_POWERPC_GRACKLE_H
2#define _ASM_POWERPC_GRACKLE_H
3#ifdef __KERNEL__
4/*
5 * Functions for setting up and using a MPC106 northbridge
6 */
7
8#include <asm/pci-bridge.h>
9
10extern void setup_grackle(struct pci_controller *hose);
11#endif /* __KERNEL__ */
12#endif /* _ASM_POWERPC_GRACKLE_H */
diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
new file mode 100644
index 000000000000..288e14d53b7f
--- /dev/null
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -0,0 +1,29 @@
1#ifndef _ASM_POWERPC_HARDIRQ_H
2#define _ASM_POWERPC_HARDIRQ_H
3#ifdef __KERNEL__
4
5#include <asm/irq.h>
6#include <asm/bug.h>
7
8/* The __last_jiffy_stamp field is needed to ensure that no decrementer
9 * interrupt is lost on SMP machines. Since on most CPUs it is in the same
10 * cache line as local_irq_count, it is cheap to access and is also used on UP
11 * for uniformity.
12 */
13typedef struct {
14 unsigned int __softirq_pending; /* set_bit is used on this */
15 unsigned int __last_jiffy_stamp;
16} ____cacheline_aligned irq_cpustat_t;
17
18#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
19
20#define last_jiffy_stamp(cpu) __IRQ_STAT((cpu), __last_jiffy_stamp)
21
22static inline void ack_bad_irq(int irq)
23{
24 printk(KERN_CRIT "illegal vector %d received!\n", irq);
25 BUG();
26}
27
28#endif /* __KERNEL__ */
29#endif /* _ASM_POWERPC_HARDIRQ_H */
diff --git a/arch/powerpc/include/asm/heathrow.h b/arch/powerpc/include/asm/heathrow.h
new file mode 100644
index 000000000000..93f54958a9d1
--- /dev/null
+++ b/arch/powerpc/include/asm/heathrow.h
@@ -0,0 +1,67 @@
1#ifndef _ASM_POWERPC_HEATHROW_H
2#define _ASM_POWERPC_HEATHROW_H
3#ifdef __KERNEL__
4/*
5 * heathrow.h: definitions for using the "Heathrow" I/O controller chip.
6 *
7 * Grabbed from Open Firmware definitions on a PowerBook G3 Series
8 *
9 * Copyright (C) 1997 Paul Mackerras.
10 */
11
12/* Front light color on Yikes/B&W G3. 32 bits */
13#define HEATHROW_FRONT_LIGHT 0x32 /* (set to 0 or 0xffffffff) */
14
15/* Brightness/contrast (gossamer iMac ?). 8 bits */
16#define HEATHROW_BRIGHTNESS_CNTL 0x32
17#define HEATHROW_CONTRAST_CNTL 0x33
18
19/* offset from ohare base for feature control register */
20#define HEATHROW_MBCR 0x34 /* Media bay control */
21#define HEATHROW_FCR 0x38 /* Feature control */
22#define HEATHROW_AUX_CNTL_REG 0x3c /* Aux control */
23
24/*
25 * Bits in feature control register.
26 * Bits postfixed with a _N are in inverse logic
27 */
28#define HRW_SCC_TRANS_EN_N 0x00000001 /* Also controls modem power */
29#define HRW_BAY_POWER_N 0x00000002
30#define HRW_BAY_PCI_ENABLE 0x00000004
31#define HRW_BAY_IDE_ENABLE 0x00000008
32#define HRW_BAY_FLOPPY_ENABLE 0x00000010
33#define HRW_IDE0_ENABLE 0x00000020
34#define HRW_IDE0_RESET_N 0x00000040
35#define HRW_BAY_DEV_MASK 0x0000001c
36#define HRW_BAY_RESET_N 0x00000080
37#define HRW_IOBUS_ENABLE 0x00000100 /* Internal IDE ? */
38#define HRW_SCC_ENABLE 0x00000200
39#define HRW_MESH_ENABLE 0x00000400
40#define HRW_SWIM_ENABLE 0x00000800
41#define HRW_SOUND_POWER_N 0x00001000
42#define HRW_SOUND_CLK_ENABLE 0x00002000
43#define HRW_SCCA_IO 0x00004000
44#define HRW_SCCB_IO 0x00008000
45#define HRW_PORT_OR_DESK_VIA_N 0x00010000 /* This one is 0 on PowerBook */
46#define HRW_PWM_MON_ID_N 0x00020000 /* ??? (0) */
47#define HRW_HOOK_MB_CNT_N 0x00040000 /* ??? (0) */
48#define HRW_SWIM_CLONE_FLOPPY 0x00080000 /* ??? (0) */
49#define HRW_AUD_RUN22 0x00100000 /* ??? (1) */
50#define HRW_SCSI_LINK_MODE 0x00200000 /* Read ??? (1) */
51#define HRW_ARB_BYPASS 0x00400000 /* Disable internal PCI arbitrer */
52#define HRW_IDE1_RESET_N 0x00800000 /* Media bay */
53#define HRW_SLOW_SCC_PCLK 0x01000000 /* ??? (0) */
54#define HRW_RESET_SCC 0x02000000
55#define HRW_MFDC_CELL_ENABLE 0x04000000 /* ??? (0) */
56#define HRW_USE_MFDC 0x08000000 /* ??? (0) */
57#define HRW_BMAC_IO_ENABLE 0x60000000 /* two bits, not documented in OF */
58#define HRW_BMAC_RESET 0x80000000 /* not documented in OF */
59
60/* We OR those features at boot on desktop G3s */
61#define HRW_DEFAULTS (HRW_SCCA_IO | HRW_SCCB_IO | HRW_SCC_ENABLE)
62
63/* Looks like Heathrow has some sort of GPIOs as well... */
64#define HRW_GPIO_MODEM_RESET 0x6d
65
66#endif /* __KERNEL__ */
67#endif /* _ASM_POWERPC_HEATHROW_H */
diff --git a/arch/powerpc/include/asm/highmem.h b/arch/powerpc/include/asm/highmem.h
new file mode 100644
index 000000000000..5d99b6489d56
--- /dev/null
+++ b/arch/powerpc/include/asm/highmem.h
@@ -0,0 +1,138 @@
1/*
2 * highmem.h: virtual kernel memory mappings for high memory
3 *
4 * PowerPC version, stolen from the i386 version.
5 *
6 * Used in CONFIG_HIGHMEM systems for memory pages which
7 * are not addressable by direct kernel virtual addresses.
8 *
9 * Copyright (C) 1999 Gerhard Wichert, Siemens AG
10 * Gerhard.Wichert@pdb.siemens.de
11 *
12 *
13 * Redesigned the x86 32-bit VM architecture to deal with
14 * up to 16 Terrabyte physical memory. With current x86 CPUs
15 * we now support up to 64 Gigabytes physical RAM.
16 *
17 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
18 */
19
20#ifndef _ASM_HIGHMEM_H
21#define _ASM_HIGHMEM_H
22
23#ifdef __KERNEL__
24
25#include <linux/init.h>
26#include <linux/interrupt.h>
27#include <asm/kmap_types.h>
28#include <asm/tlbflush.h>
29#include <asm/page.h>
30#include <asm/fixmap.h>
31
32extern pte_t *kmap_pte;
33extern pgprot_t kmap_prot;
34extern pte_t *pkmap_page_table;
35
36/*
37 * Right now we initialize only a single pte table. It can be extended
38 * easily, subsequent pte tables have to be allocated in one physical
39 * chunk of RAM.
40 */
41#define LAST_PKMAP (1 << PTE_SHIFT)
42#define LAST_PKMAP_MASK (LAST_PKMAP-1)
43#define PKMAP_BASE ((FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK)
44#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
45#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
46
47extern void *kmap_high(struct page *page);
48extern void kunmap_high(struct page *page);
49
50static inline void *kmap(struct page *page)
51{
52 might_sleep();
53 if (!PageHighMem(page))
54 return page_address(page);
55 return kmap_high(page);
56}
57
58static inline void kunmap(struct page *page)
59{
60 BUG_ON(in_interrupt());
61 if (!PageHighMem(page))
62 return;
63 kunmap_high(page);
64}
65
66/*
67 * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
68 * gives a more generic (and caching) interface. But kmap_atomic can
69 * be used in IRQ contexts, so in some (very limited) cases we need
70 * it.
71 */
72static inline void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot)
73{
74 unsigned int idx;
75 unsigned long vaddr;
76
77 /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
78 pagefault_disable();
79 if (!PageHighMem(page))
80 return page_address(page);
81
82 idx = type + KM_TYPE_NR*smp_processor_id();
83 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
84#ifdef CONFIG_DEBUG_HIGHMEM
85 BUG_ON(!pte_none(*(kmap_pte-idx)));
86#endif
87 set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot));
88 flush_tlb_page(NULL, vaddr);
89
90 return (void*) vaddr;
91}
92
93static inline void *kmap_atomic(struct page *page, enum km_type type)
94{
95 return kmap_atomic_prot(page, type, kmap_prot);
96}
97
98static inline void kunmap_atomic(void *kvaddr, enum km_type type)
99{
100#ifdef CONFIG_DEBUG_HIGHMEM
101 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
102 enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
103
104 if (vaddr < __fix_to_virt(FIX_KMAP_END)) {
105 pagefault_enable();
106 return;
107 }
108
109 BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
110
111 /*
112 * force other mappings to Oops if they'll try to access
113 * this pte without first remap it
114 */
115 pte_clear(&init_mm, vaddr, kmap_pte-idx);
116 flush_tlb_page(NULL, vaddr);
117#endif
118 pagefault_enable();
119}
120
121static inline struct page *kmap_atomic_to_page(void *ptr)
122{
123 unsigned long idx, vaddr = (unsigned long) ptr;
124 pte_t *pte;
125
126 if (vaddr < FIXADDR_START)
127 return virt_to_page(ptr);
128
129 idx = virt_to_fix(vaddr);
130 pte = kmap_pte - (idx - FIX_KMAP_BEGIN);
131 return pte_page(*pte);
132}
133
134#define flush_cache_kmaps() flush_cache_all()
135
136#endif /* __KERNEL__ */
137
138#endif /* _ASM_HIGHMEM_H */
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
new file mode 100644
index 000000000000..26f0d0ab27a5
--- /dev/null
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -0,0 +1,75 @@
1#ifndef _ASM_POWERPC_HUGETLB_H
2#define _ASM_POWERPC_HUGETLB_H
3
4#include <asm/page.h>
5
6
7int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
8 unsigned long len);
9
10void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
11 unsigned long end, unsigned long floor,
12 unsigned long ceiling);
13
14void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
15 pte_t *ptep, pte_t pte);
16
17pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
18 pte_t *ptep);
19
20/*
21 * If the arch doesn't supply something else, assume that hugepage
22 * size aligned regions are ok without further preparation.
23 */
24static inline int prepare_hugepage_range(struct file *file,
25 unsigned long addr, unsigned long len)
26{
27 struct hstate *h = hstate_file(file);
28 if (len & ~huge_page_mask(h))
29 return -EINVAL;
30 if (addr & ~huge_page_mask(h))
31 return -EINVAL;
32 return 0;
33}
34
35static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
36{
37}
38
39static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
40 unsigned long addr, pte_t *ptep)
41{
42}
43
44static inline int huge_pte_none(pte_t pte)
45{
46 return pte_none(pte);
47}
48
49static inline pte_t huge_pte_wrprotect(pte_t pte)
50{
51 return pte_wrprotect(pte);
52}
53
54static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
55 unsigned long addr, pte_t *ptep,
56 pte_t pte, int dirty)
57{
58 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
59}
60
61static inline pte_t huge_ptep_get(pte_t *ptep)
62{
63 return *ptep;
64}
65
66static inline int arch_prepare_hugepage(struct page *page)
67{
68 return 0;
69}
70
71static inline void arch_release_hugepage(struct page *page)
72{
73}
74
75#endif /* _ASM_POWERPC_HUGETLB_H */
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
new file mode 100644
index 000000000000..fbe2932fa9e9
--- /dev/null
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -0,0 +1,296 @@
1#ifndef _ASM_POWERPC_HVCALL_H
2#define _ASM_POWERPC_HVCALL_H
3#ifdef __KERNEL__
4
5#define HVSC .long 0x44000022
6
7#define H_SUCCESS 0
8#define H_BUSY 1 /* Hardware busy -- retry later */
9#define H_CLOSED 2 /* Resource closed */
10#define H_NOT_AVAILABLE 3
11#define H_CONSTRAINED 4 /* Resource request constrained to max allowed */
12#define H_PARTIAL 5
13#define H_IN_PROGRESS 14 /* Kind of like busy */
14#define H_PAGE_REGISTERED 15
15#define H_PARTIAL_STORE 16
16#define H_PENDING 17 /* returned from H_POLL_PENDING */
17#define H_CONTINUE 18 /* Returned from H_Join on success */
18#define H_LONG_BUSY_START_RANGE 9900 /* Start of long busy range */
19#define H_LONG_BUSY_ORDER_1_MSEC 9900 /* Long busy, hint that 1msec \
20 is a good time to retry */
21#define H_LONG_BUSY_ORDER_10_MSEC 9901 /* Long busy, hint that 10msec \
22 is a good time to retry */
23#define H_LONG_BUSY_ORDER_100_MSEC 9902 /* Long busy, hint that 100msec \
24 is a good time to retry */
25#define H_LONG_BUSY_ORDER_1_SEC 9903 /* Long busy, hint that 1sec \
26 is a good time to retry */
27#define H_LONG_BUSY_ORDER_10_SEC 9904 /* Long busy, hint that 10sec \
28 is a good time to retry */
29#define H_LONG_BUSY_ORDER_100_SEC 9905 /* Long busy, hint that 100sec \
30 is a good time to retry */
31#define H_LONG_BUSY_END_RANGE 9905 /* End of long busy range */
32#define H_HARDWARE -1 /* Hardware error */
33#define H_FUNCTION -2 /* Function not supported */
34#define H_PRIVILEGE -3 /* Caller not privileged */
35#define H_PARAMETER -4 /* Parameter invalid, out-of-range or conflicting */
36#define H_BAD_MODE -5 /* Illegal msr value */
37#define H_PTEG_FULL -6 /* PTEG is full */
38#define H_NOT_FOUND -7 /* PTE was not found" */
39#define H_RESERVED_DABR -8 /* DABR address is reserved by the hypervisor on this processor" */
40#define H_NO_MEM -9
41#define H_AUTHORITY -10
42#define H_PERMISSION -11
43#define H_DROPPED -12
44#define H_SOURCE_PARM -13
45#define H_DEST_PARM -14
46#define H_REMOTE_PARM -15
47#define H_RESOURCE -16
48#define H_ADAPTER_PARM -17
49#define H_RH_PARM -18
50#define H_RCQ_PARM -19
51#define H_SCQ_PARM -20
52#define H_EQ_PARM -21
53#define H_RT_PARM -22
54#define H_ST_PARM -23
55#define H_SIGT_PARM -24
56#define H_TOKEN_PARM -25
57#define H_MLENGTH_PARM -27
58#define H_MEM_PARM -28
59#define H_MEM_ACCESS_PARM -29
60#define H_ATTR_PARM -30
61#define H_PORT_PARM -31
62#define H_MCG_PARM -32
63#define H_VL_PARM -33
64#define H_TSIZE_PARM -34
65#define H_TRACE_PARM -35
66
67#define H_MASK_PARM -37
68#define H_MCG_FULL -38
69#define H_ALIAS_EXIST -39
70#define H_P_COUNTER -40
71#define H_TABLE_FULL -41
72#define H_ALT_TABLE -42
73#define H_MR_CONDITION -43
74#define H_NOT_ENOUGH_RESOURCES -44
75#define H_R_STATE -45
76#define H_RESCINDEND -46
77
78
79/* Long Busy is a condition that can be returned by the firmware
80 * when a call cannot be completed now, but the identical call
81 * should be retried later. This prevents calls blocking in the
82 * firmware for long periods of time. Annoyingly the firmware can return
83 * a range of return codes, hinting at how long we should wait before
84 * retrying. If you don't care for the hint, the macro below is a good
85 * way to check for the long_busy return codes
86 */
87#define H_IS_LONG_BUSY(x) ((x >= H_LONG_BUSY_START_RANGE) \
88 && (x <= H_LONG_BUSY_END_RANGE))
89
90/* Flags */
91#define H_LARGE_PAGE (1UL<<(63-16))
92#define H_EXACT (1UL<<(63-24)) /* Use exact PTE or return H_PTEG_FULL */
93#define H_R_XLATE (1UL<<(63-25)) /* include a valid logical page num in the pte if the valid bit is set */
94#define H_READ_4 (1UL<<(63-26)) /* Return 4 PTEs */
95#define H_PAGE_STATE_CHANGE (1UL<<(63-28))
96#define H_PAGE_UNUSED ((1UL<<(63-29)) | (1UL<<(63-30)))
97#define H_PAGE_SET_UNUSED (H_PAGE_STATE_CHANGE | H_PAGE_UNUSED)
98#define H_PAGE_SET_LOANED (H_PAGE_SET_UNUSED | (1UL<<(63-31)))
99#define H_PAGE_SET_ACTIVE H_PAGE_STATE_CHANGE
100#define H_AVPN (1UL<<(63-32)) /* An avpn is provided as a sanity test */
101#define H_ANDCOND (1UL<<(63-33))
102#define H_ICACHE_INVALIDATE (1UL<<(63-40)) /* icbi, etc. (ignored for IO pages) */
103#define H_ICACHE_SYNCHRONIZE (1UL<<(63-41)) /* dcbst, icbi, etc (ignored for IO pages */
104#define H_ZERO_PAGE (1UL<<(63-48)) /* zero the page before mapping (ignored for IO pages) */
105#define H_COPY_PAGE (1UL<<(63-49))
106#define H_N (1UL<<(63-61))
107#define H_PP1 (1UL<<(63-62))
108#define H_PP2 (1UL<<(63-63))
109
110/* VASI States */
111#define H_VASI_INVALID 0
112#define H_VASI_ENABLED 1
113#define H_VASI_ABORTED 2
114#define H_VASI_SUSPENDING 3
115#define H_VASI_SUSPENDED 4
116#define H_VASI_RESUMED 5
117#define H_VASI_COMPLETED 6
118
119/* DABRX flags */
120#define H_DABRX_HYPERVISOR (1UL<<(63-61))
121#define H_DABRX_KERNEL (1UL<<(63-62))
122#define H_DABRX_USER (1UL<<(63-63))
123
124/* Each control block has to be on a 4K bondary */
125#define H_CB_ALIGNMENT 4096
126
127/* pSeries hypervisor opcodes */
128#define H_REMOVE 0x04
129#define H_ENTER 0x08
130#define H_READ 0x0c
131#define H_CLEAR_MOD 0x10
132#define H_CLEAR_REF 0x14
133#define H_PROTECT 0x18
134#define H_GET_TCE 0x1c
135#define H_PUT_TCE 0x20
136#define H_SET_SPRG0 0x24
137#define H_SET_DABR 0x28
138#define H_PAGE_INIT 0x2c
139#define H_SET_ASR 0x30
140#define H_ASR_ON 0x34
141#define H_ASR_OFF 0x38
142#define H_LOGICAL_CI_LOAD 0x3c
143#define H_LOGICAL_CI_STORE 0x40
144#define H_LOGICAL_CACHE_LOAD 0x44
145#define H_LOGICAL_CACHE_STORE 0x48
146#define H_LOGICAL_ICBI 0x4c
147#define H_LOGICAL_DCBF 0x50
148#define H_GET_TERM_CHAR 0x54
149#define H_PUT_TERM_CHAR 0x58
150#define H_REAL_TO_LOGICAL 0x5c
151#define H_HYPERVISOR_DATA 0x60
152#define H_EOI 0x64
153#define H_CPPR 0x68
154#define H_IPI 0x6c
155#define H_IPOLL 0x70
156#define H_XIRR 0x74
157#define H_PERFMON 0x7c
158#define H_MIGRATE_DMA 0x78
159#define H_REGISTER_VPA 0xDC
160#define H_CEDE 0xE0
161#define H_CONFER 0xE4
162#define H_PROD 0xE8
163#define H_GET_PPP 0xEC
164#define H_SET_PPP 0xF0
165#define H_PURR 0xF4
166#define H_PIC 0xF8
167#define H_REG_CRQ 0xFC
168#define H_FREE_CRQ 0x100
169#define H_VIO_SIGNAL 0x104
170#define H_SEND_CRQ 0x108
171#define H_COPY_RDMA 0x110
172#define H_REGISTER_LOGICAL_LAN 0x114
173#define H_FREE_LOGICAL_LAN 0x118
174#define H_ADD_LOGICAL_LAN_BUFFER 0x11C
175#define H_SEND_LOGICAL_LAN 0x120
176#define H_BULK_REMOVE 0x124
177#define H_MULTICAST_CTRL 0x130
178#define H_SET_XDABR 0x134
179#define H_STUFF_TCE 0x138
180#define H_PUT_TCE_INDIRECT 0x13C
181#define H_CHANGE_LOGICAL_LAN_MAC 0x14C
182#define H_VTERM_PARTNER_INFO 0x150
183#define H_REGISTER_VTERM 0x154
184#define H_FREE_VTERM 0x158
185#define H_RESET_EVENTS 0x15C
186#define H_ALLOC_RESOURCE 0x160
187#define H_FREE_RESOURCE 0x164
188#define H_MODIFY_QP 0x168
189#define H_QUERY_QP 0x16C
190#define H_REREGISTER_PMR 0x170
191#define H_REGISTER_SMR 0x174
192#define H_QUERY_MR 0x178
193#define H_QUERY_MW 0x17C
194#define H_QUERY_HCA 0x180
195#define H_QUERY_PORT 0x184
196#define H_MODIFY_PORT 0x188
197#define H_DEFINE_AQP1 0x18C
198#define H_GET_TRACE_BUFFER 0x190
199#define H_DEFINE_AQP0 0x194
200#define H_RESIZE_MR 0x198
201#define H_ATTACH_MCQP 0x19C
202#define H_DETACH_MCQP 0x1A0
203#define H_CREATE_RPT 0x1A4
204#define H_REMOVE_RPT 0x1A8
205#define H_REGISTER_RPAGES 0x1AC
206#define H_DISABLE_AND_GETC 0x1B0
207#define H_ERROR_DATA 0x1B4
208#define H_GET_HCA_INFO 0x1B8
209#define H_GET_PERF_COUNT 0x1BC
210#define H_MANAGE_TRACE 0x1C0
211#define H_FREE_LOGICAL_LAN_BUFFER 0x1D4
212#define H_QUERY_INT_STATE 0x1E4
213#define H_POLL_PENDING 0x1D8
214#define H_ILLAN_ATTRIBUTES 0x244
215#define H_JOIN 0x298
216#define H_VASI_STATE 0x2A4
217#define H_ENABLE_CRQ 0x2B0
218#define H_SET_MPP 0x2D0
219#define H_GET_MPP 0x2D4
220#define MAX_HCALL_OPCODE H_GET_MPP
221
222#ifndef __ASSEMBLY__
223
224/**
225 * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments
226 * @opcode: The hypervisor call to make.
227 *
228 * This call supports up to 7 arguments and only returns the status of
229 * the hcall. Use this version where possible, its slightly faster than
230 * the other plpar_hcalls.
231 */
232long plpar_hcall_norets(unsigned long opcode, ...);
233
234/**
235 * plpar_hcall: - Make a pseries hypervisor call
236 * @opcode: The hypervisor call to make.
237 * @retbuf: Buffer to store up to 4 return arguments in.
238 *
239 * This call supports up to 6 arguments and 4 return arguments. Use
240 * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
241 *
242 * Used for all but the craziest of phyp interfaces (see plpar_hcall9)
243 */
244#define PLPAR_HCALL_BUFSIZE 4
245long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...);
246
247/**
248 * plpar_hcall_raw: - Make a hypervisor call without calculating hcall stats
249 * @opcode: The hypervisor call to make.
250 * @retbuf: Buffer to store up to 4 return arguments in.
251 *
252 * This call supports up to 6 arguments and 4 return arguments. Use
253 * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
254 *
255 * Used when phyp interface needs to be called in real mode. Similar to
256 * plpar_hcall, but plpar_hcall_raw works in real mode and does not
257 * calculate hypervisor call statistics.
258 */
259long plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...);
260
261/**
262 * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments
263 * @opcode: The hypervisor call to make.
264 * @retbuf: Buffer to store up to 9 return arguments in.
265 *
266 * This call supports up to 9 arguments and 9 return arguments. Use
267 * PLPAR_HCALL9_BUFSIZE to size the return argument buffer.
268 */
269#define PLPAR_HCALL9_BUFSIZE 9
270long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...);
271
272/* For hcall instrumentation. One structure per-hcall, per-CPU */
273struct hcall_stats {
274 unsigned long num_calls; /* number of calls (on this CPU) */
275 unsigned long tb_total; /* total wall time (mftb) of calls. */
276 unsigned long purr_total; /* total cpu time (PURR) of calls. */
277};
278#define HCALL_STAT_ARRAY_SIZE ((MAX_HCALL_OPCODE >> 2) + 1)
279
280struct hvcall_mpp_data {
281 unsigned long entitled_mem;
282 unsigned long mapped_mem;
283 unsigned short group_num;
284 unsigned short pool_num;
285 unsigned char mem_weight;
286 unsigned char unallocated_mem_weight;
287 unsigned long unallocated_entitlement; /* value in bytes */
288 unsigned long pool_size;
289 signed long loan_request;
290 unsigned long backing_mem;
291};
292
293int h_get_mpp(struct hvcall_mpp_data *);
294#endif /* __ASSEMBLY__ */
295#endif /* __KERNEL__ */
296#endif /* _ASM_POWERPC_HVCALL_H */
diff --git a/arch/powerpc/include/asm/hvconsole.h b/arch/powerpc/include/asm/hvconsole.h
new file mode 100644
index 000000000000..35ea69e8121f
--- /dev/null
+++ b/arch/powerpc/include/asm/hvconsole.h
@@ -0,0 +1,41 @@
1/*
2 * hvconsole.h
3 * Copyright (C) 2004 Ryan S Arnold, IBM Corporation
4 *
5 * LPAR console support.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _PPC64_HVCONSOLE_H
23#define _PPC64_HVCONSOLE_H
24#ifdef __KERNEL__
25
26/*
27 * PSeries firmware will only send/recv up to 16 bytes of character data per
28 * hcall.
29 */
30#define MAX_VIO_PUT_CHARS 16
31#define SIZE_VIO_GET_CHARS 16
32
33/*
34 * Vio firmware always attempts to fetch MAX_VIO_GET_CHARS chars. The 'count'
35 * parm is included to conform to put_chars() function pointer template
36 */
37extern int hvc_get_chars(uint32_t vtermno, char *buf, int count);
38extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count);
39
40#endif /* __KERNEL__ */
41#endif /* _PPC64_HVCONSOLE_H */
diff --git a/arch/powerpc/include/asm/hvcserver.h b/arch/powerpc/include/asm/hvcserver.h
new file mode 100644
index 000000000000..67d7da3a4da4
--- /dev/null
+++ b/arch/powerpc/include/asm/hvcserver.h
@@ -0,0 +1,59 @@
1/*
2 * hvcserver.h
3 * Copyright (C) 2004 Ryan S Arnold, IBM Corporation
4 *
5 * PPC64 virtual I/O console server support.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _PPC64_HVCSERVER_H
23#define _PPC64_HVCSERVER_H
24#ifdef __KERNEL__
25
26#include <linux/list.h>
27
28/* Converged Location Code length */
29#define HVCS_CLC_LENGTH 79
30
31/**
32 * hvcs_partner_info - an element in a list of partner info
33 * @node: list_head denoting this partner_info struct's position in the list of
34 * partner info.
35 * @unit_address: The partner unit address of this entry.
36 * @partition_ID: The partner partition ID of this entry.
37 * @location_code: The converged location code of this entry + 1 char for the
38 * null-term.
39 *
40 * This structure outlines the format that partner info is presented to a caller
41 * of the hvcs partner info fetching functions. These are strung together into
42 * a list using linux kernel lists.
43 */
44struct hvcs_partner_info {
45 struct list_head node;
46 uint32_t unit_address;
47 uint32_t partition_ID;
48 char location_code[HVCS_CLC_LENGTH + 1]; /* CLC + 1 null-term char */
49};
50
51extern int hvcs_free_partner_info(struct list_head *head);
52extern int hvcs_get_partner_info(uint32_t unit_address,
53 struct list_head *head, unsigned long *pi_buff);
54extern int hvcs_register_connection(uint32_t unit_address,
55 uint32_t p_partition_ID, uint32_t p_unit_address);
56extern int hvcs_free_connection(uint32_t unit_address);
57
58#endif /* __KERNEL__ */
59#endif /* _PPC64_HVCSERVER_H */
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
new file mode 100644
index 000000000000..f75a5fc64d2e
--- /dev/null
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -0,0 +1,135 @@
1/*
2 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
3 */
4#ifndef _ASM_POWERPC_HW_IRQ_H
5#define _ASM_POWERPC_HW_IRQ_H
6
7#ifdef __KERNEL__
8
9#include <linux/errno.h>
10#include <linux/compiler.h>
11#include <asm/ptrace.h>
12#include <asm/processor.h>
13
14extern void timer_interrupt(struct pt_regs *);
15
16#ifdef CONFIG_PPC64
17#include <asm/paca.h>
18
19static inline unsigned long local_get_flags(void)
20{
21 unsigned long flags;
22
23 __asm__ __volatile__("lbz %0,%1(13)"
24 : "=r" (flags)
25 : "i" (offsetof(struct paca_struct, soft_enabled)));
26
27 return flags;
28}
29
30static inline unsigned long raw_local_irq_disable(void)
31{
32 unsigned long flags, zero;
33
34 __asm__ __volatile__("li %1,0; lbz %0,%2(13); stb %1,%2(13)"
35 : "=r" (flags), "=&r" (zero)
36 : "i" (offsetof(struct paca_struct, soft_enabled))
37 : "memory");
38
39 return flags;
40}
41
42extern void raw_local_irq_restore(unsigned long);
43extern void iseries_handle_interrupts(void);
44
45#define raw_local_irq_enable() raw_local_irq_restore(1)
46#define raw_local_save_flags(flags) ((flags) = local_get_flags())
47#define raw_local_irq_save(flags) ((flags) = raw_local_irq_disable())
48
49#define raw_irqs_disabled() (local_get_flags() == 0)
50#define raw_irqs_disabled_flags(flags) ((flags) == 0)
51
52#define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1)
53#define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1)
54
55#define hard_irq_disable() \
56 do { \
57 __hard_irq_disable(); \
58 get_paca()->soft_enabled = 0; \
59 get_paca()->hard_enabled = 0; \
60 } while(0)
61
62static inline int irqs_disabled_flags(unsigned long flags)
63{
64 return flags == 0;
65}
66
67#else
68
69#if defined(CONFIG_BOOKE)
70#define SET_MSR_EE(x) mtmsr(x)
71#define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory")
72#else
73#define SET_MSR_EE(x) mtmsr(x)
74#define local_irq_restore(flags) mtmsr(flags)
75#endif
76
77static inline void local_irq_disable(void)
78{
79#ifdef CONFIG_BOOKE
80 __asm__ __volatile__("wrteei 0": : :"memory");
81#else
82 unsigned long msr;
83 __asm__ __volatile__("": : :"memory");
84 msr = mfmsr();
85 SET_MSR_EE(msr & ~MSR_EE);
86#endif
87}
88
89static inline void local_irq_enable(void)
90{
91#ifdef CONFIG_BOOKE
92 __asm__ __volatile__("wrteei 1": : :"memory");
93#else
94 unsigned long msr;
95 __asm__ __volatile__("": : :"memory");
96 msr = mfmsr();
97 SET_MSR_EE(msr | MSR_EE);
98#endif
99}
100
101static inline void local_irq_save_ptr(unsigned long *flags)
102{
103 unsigned long msr;
104 msr = mfmsr();
105 *flags = msr;
106#ifdef CONFIG_BOOKE
107 __asm__ __volatile__("wrteei 0": : :"memory");
108#else
109 SET_MSR_EE(msr & ~MSR_EE);
110#endif
111 __asm__ __volatile__("": : :"memory");
112}
113
114#define local_save_flags(flags) ((flags) = mfmsr())
115#define local_irq_save(flags) local_irq_save_ptr(&flags)
116#define irqs_disabled() ((mfmsr() & MSR_EE) == 0)
117
118#define hard_irq_enable() local_irq_enable()
119#define hard_irq_disable() local_irq_disable()
120
121static inline int irqs_disabled_flags(unsigned long flags)
122{
123 return (flags & MSR_EE) == 0;
124}
125
126#endif /* CONFIG_PPC64 */
127
128/*
129 * interrupt-retrigger: should we handle this via lost interrupts and IPIs
130 * or should we not care like we do now ? --BenH.
131 */
132struct hw_interrupt_type;
133
134#endif /* __KERNEL__ */
135#endif /* _ASM_POWERPC_HW_IRQ_H */
diff --git a/arch/powerpc/include/asm/hydra.h b/arch/powerpc/include/asm/hydra.h
new file mode 100644
index 000000000000..1ad4eed07fbe
--- /dev/null
+++ b/arch/powerpc/include/asm/hydra.h
@@ -0,0 +1,102 @@
1/*
2 * include/asm-ppc/hydra.h -- Mac I/O `Hydra' definitions
3 *
4 * Copyright (C) 1997 Geert Uytterhoeven
5 *
6 * This file is based on the following documentation:
7 *
8 * Macintosh Technology in the Common Hardware Reference Platform
9 * Apple Computer, Inc.
10 *
11 * © Copyright 1995 Apple Computer, Inc. All rights reserved.
12 *
13 * It's available online from http://chrp.apple.com/MacTech.pdf.
14 * You can obtain paper copies of this book from computer bookstores or by
15 * writing Morgan Kaufmann Publishers, Inc., 340 Pine Street, Sixth Floor, San
16 * Francisco, CA 94104. Reference ISBN 1-55860-393-X.
17 *
18 * This file is subject to the terms and conditions of the GNU General Public
19 * License. See the file COPYING in the main directory of this archive
20 * for more details.
21 */
22
23#ifndef _ASMPPC_HYDRA_H
24#define _ASMPPC_HYDRA_H
25
26#ifdef __KERNEL__
27
28struct Hydra {
29 /* DBDMA Controller Register Space */
30 char Pad1[0x30];
31 u_int CachePD;
32 u_int IDs;
33 u_int Feature_Control;
34 char Pad2[0x7fc4];
35 /* DBDMA Channel Register Space */
36 char SCSI_DMA[0x100];
37 char Pad3[0x300];
38 char SCCA_Tx_DMA[0x100];
39 char SCCA_Rx_DMA[0x100];
40 char SCCB_Tx_DMA[0x100];
41 char SCCB_Rx_DMA[0x100];
42 char Pad4[0x7800];
43 /* Device Register Space */
44 char SCSI[0x1000];
45 char ADB[0x1000];
46 char SCC_Legacy[0x1000];
47 char SCC[0x1000];
48 char Pad9[0x2000];
49 char VIA[0x2000];
50 char Pad10[0x28000];
51 char OpenPIC[0x40000];
52};
53
54extern volatile struct Hydra __iomem *Hydra;
55
56
57 /*
58 * Feature Control Register
59 */
60
61#define HYDRA_FC_SCC_CELL_EN 0x00000001 /* Enable SCC Clock */
62#define HYDRA_FC_SCSI_CELL_EN 0x00000002 /* Enable SCSI Clock */
63#define HYDRA_FC_SCCA_ENABLE 0x00000004 /* Enable SCC A Lines */
64#define HYDRA_FC_SCCB_ENABLE 0x00000008 /* Enable SCC B Lines */
65#define HYDRA_FC_ARB_BYPASS 0x00000010 /* Bypass Internal Arbiter */
66#define HYDRA_FC_RESET_SCC 0x00000020 /* Reset SCC */
67#define HYDRA_FC_MPIC_ENABLE 0x00000040 /* Enable OpenPIC */
68#define HYDRA_FC_SLOW_SCC_PCLK 0x00000080 /* 1=15.6672, 0=25 MHz */
69#define HYDRA_FC_MPIC_IS_MASTER 0x00000100 /* OpenPIC Master Mode */
70
71
72 /*
73 * OpenPIC Interrupt Sources
74 */
75
76#define HYDRA_INT_SIO 0
77#define HYDRA_INT_SCSI_DMA 1
78#define HYDRA_INT_SCCA_TX_DMA 2
79#define HYDRA_INT_SCCA_RX_DMA 3
80#define HYDRA_INT_SCCB_TX_DMA 4
81#define HYDRA_INT_SCCB_RX_DMA 5
82#define HYDRA_INT_SCSI 6
83#define HYDRA_INT_SCCA 7
84#define HYDRA_INT_SCCB 8
85#define HYDRA_INT_VIA 9
86#define HYDRA_INT_ADB 10
87#define HYDRA_INT_ADB_NMI 11
88#define HYDRA_INT_EXT1 12 /* PCI IRQW */
89#define HYDRA_INT_EXT2 13 /* PCI IRQX */
90#define HYDRA_INT_EXT3 14 /* PCI IRQY */
91#define HYDRA_INT_EXT4 15 /* PCI IRQZ */
92#define HYDRA_INT_EXT5 16 /* IDE Primay/Secondary */
93#define HYDRA_INT_EXT6 17 /* IDE Secondary */
94#define HYDRA_INT_EXT7 18 /* Power Off Request */
95#define HYDRA_INT_SPARE 19
96
97extern int hydra_init(void);
98extern void macio_adb_init(void);
99
100#endif /* __KERNEL__ */
101
102#endif /* _ASMPPC_HYDRA_H */
diff --git a/arch/powerpc/include/asm/i8259.h b/arch/powerpc/include/asm/i8259.h
new file mode 100644
index 000000000000..105ade297aad
--- /dev/null
+++ b/arch/powerpc/include/asm/i8259.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_POWERPC_I8259_H
2#define _ASM_POWERPC_I8259_H
3#ifdef __KERNEL__
4
5#include <linux/irq.h>
6
7extern void i8259_init(struct device_node *node, unsigned long intack_addr);
8extern unsigned int i8259_irq(void);
9extern struct irq_host *i8259_get_host(void);
10
11#endif /* __KERNEL__ */
12#endif /* _ASM_POWERPC_I8259_H */
diff --git a/arch/powerpc/include/asm/ibmebus.h b/arch/powerpc/include/asm/ibmebus.h
new file mode 100644
index 000000000000..1a9d9aea21fa
--- /dev/null
+++ b/arch/powerpc/include/asm/ibmebus.h
@@ -0,0 +1,60 @@
1/*
2 * IBM PowerPC eBus Infrastructure Support.
3 *
4 * Copyright (c) 2005 IBM Corporation
5 * Joachim Fenkes <fenkes@de.ibm.com>
6 * Heiko J Schick <schickhj@de.ibm.com>
7 *
8 * All rights reserved.
9 *
10 * This source code is distributed under a dual license of GPL v2.0 and OpenIB
11 * BSD.
12 *
13 * OpenIB BSD License
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions are met:
17 *
18 * Redistributions of source code must retain the above copyright notice, this
19 * list of conditions and the following disclaimer.
20 *
21 * Redistributions in binary form must reproduce the above copyright notice,
22 * this list of conditions and the following disclaimer in the documentation
23 * and/or other materials
24 * provided with the distribution.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
33 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
34 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifndef _ASM_EBUS_H
40#define _ASM_EBUS_H
41#ifdef __KERNEL__
42
43#include <linux/device.h>
44#include <linux/interrupt.h>
45#include <linux/mod_devicetable.h>
46#include <linux/of_device.h>
47#include <linux/of_platform.h>
48
49extern struct bus_type ibmebus_bus_type;
50
51int ibmebus_register_driver(struct of_platform_driver *drv);
52void ibmebus_unregister_driver(struct of_platform_driver *drv);
53
54int ibmebus_request_irq(u32 ist, irq_handler_t handler,
55 unsigned long irq_flags, const char *devname,
56 void *dev_id);
57void ibmebus_free_irq(u32 ist, void *dev_id);
58
59#endif /* __KERNEL__ */
60#endif /* _ASM_IBMEBUS_H */
diff --git a/arch/powerpc/include/asm/ide.h b/arch/powerpc/include/asm/ide.h
new file mode 100644
index 000000000000..048480e340f2
--- /dev/null
+++ b/arch/powerpc/include/asm/ide.h
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 1994-1996 Linus Torvalds & authors
3 *
4 * This file contains the powerpc architecture specific IDE code.
5 */
6#ifndef _ASM_POWERPC_IDE_H
7#define _ASM_POWERPC_IDE_H
8
9#ifdef __KERNEL__
10
11#ifndef __powerpc64__
12#include <linux/sched.h>
13#include <asm/mpc8xx.h>
14#endif
15#include <asm/io.h>
16
17#define __ide_mm_insw(p, a, c) readsw((void __iomem *)(p), (a), (c))
18#define __ide_mm_insl(p, a, c) readsl((void __iomem *)(p), (a), (c))
19#define __ide_mm_outsw(p, a, c) writesw((void __iomem *)(p), (a), (c))
20#define __ide_mm_outsl(p, a, c) writesl((void __iomem *)(p), (a), (c))
21
22#ifndef __powerpc64__
23#include <linux/ioport.h>
24
25/* FIXME: use ide_platform host driver */
26static __inline__ int ide_default_irq(unsigned long base)
27{
28#ifdef CONFIG_PPLUS
29 switch (base) {
30 case 0x1f0: return 14;
31 case 0x170: return 15;
32 }
33#endif
34 return 0;
35}
36
37/* FIXME: use ide_platform host driver */
38static __inline__ unsigned long ide_default_io_base(int index)
39{
40#ifdef CONFIG_PPLUS
41 switch (index) {
42 case 0: return 0x1f0;
43 case 1: return 0x170;
44 }
45#endif
46 return 0;
47}
48
49#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
50#define IDE_ARCH_ACK_INTR 1
51#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1)
52#endif
53
54#endif /* __powerpc64__ */
55
56#endif /* __KERNEL__ */
57
58#endif /* _ASM_POWERPC_IDE_H */
diff --git a/arch/powerpc/include/asm/immap_86xx.h b/arch/powerpc/include/asm/immap_86xx.h
new file mode 100644
index 000000000000..0f165e59c326
--- /dev/null
+++ b/arch/powerpc/include/asm/immap_86xx.h
@@ -0,0 +1,156 @@
1/**
2 * MPC86xx Internal Memory Map
3 *
4 * Authors: Jeff Brown
5 * Timur Tabi <timur@freescale.com>
6 *
7 * Copyright 2004,2007 Freescale Semiconductor, Inc
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This header file defines structures for various 86xx SOC devices that are
15 * used by multiple source files.
16 */
17
18#ifndef __ASM_POWERPC_IMMAP_86XX_H__
19#define __ASM_POWERPC_IMMAP_86XX_H__
20#ifdef __KERNEL__
21
22/* Global Utility Registers */
23struct ccsr_guts {
24 __be32 porpllsr; /* 0x.0000 - POR PLL Ratio Status Register */
25 __be32 porbmsr; /* 0x.0004 - POR Boot Mode Status Register */
26 __be32 porimpscr; /* 0x.0008 - POR I/O Impedance Status and Control Register */
27 __be32 pordevsr; /* 0x.000c - POR I/O Device Status Register */
28 __be32 pordbgmsr; /* 0x.0010 - POR Debug Mode Status Register */
29 u8 res1[0x20 - 0x14];
30 __be32 porcir; /* 0x.0020 - POR Configuration Information Register */
31 u8 res2[0x30 - 0x24];
32 __be32 gpiocr; /* 0x.0030 - GPIO Control Register */
33 u8 res3[0x40 - 0x34];
34 __be32 gpoutdr; /* 0x.0040 - General-Purpose Output Data Register */
35 u8 res4[0x50 - 0x44];
36 __be32 gpindr; /* 0x.0050 - General-Purpose Input Data Register */
37 u8 res5[0x60 - 0x54];
38 __be32 pmuxcr; /* 0x.0060 - Alternate Function Signal Multiplex Control */
39 u8 res6[0x70 - 0x64];
40 __be32 devdisr; /* 0x.0070 - Device Disable Control */
41 __be32 devdisr2; /* 0x.0074 - Device Disable Control 2 */
42 u8 res7[0x80 - 0x78];
43 __be32 powmgtcsr; /* 0x.0080 - Power Management Status and Control Register */
44 u8 res8[0x90 - 0x84];
45 __be32 mcpsumr; /* 0x.0090 - Machine Check Summary Register */
46 __be32 rstrscr; /* 0x.0094 - Reset Request Status and Control Register */
47 u8 res9[0xA0 - 0x98];
48 __be32 pvr; /* 0x.00a0 - Processor Version Register */
49 __be32 svr; /* 0x.00a4 - System Version Register */
50 u8 res10[0xB0 - 0xA8];
51 __be32 rstcr; /* 0x.00b0 - Reset Control Register */
52 u8 res11[0xC0 - 0xB4];
53 __be32 elbcvselcr; /* 0x.00c0 - eLBC Voltage Select Ctrl Reg */
54 u8 res12[0x800 - 0xC4];
55 __be32 clkdvdr; /* 0x.0800 - Clock Divide Register */
56 u8 res13[0x900 - 0x804];
57 __be32 ircr; /* 0x.0900 - Infrared Control Register */
58 u8 res14[0x908 - 0x904];
59 __be32 dmacr; /* 0x.0908 - DMA Control Register */
60 u8 res15[0x914 - 0x90C];
61 __be32 elbccr; /* 0x.0914 - eLBC Control Register */
62 u8 res16[0xB20 - 0x918];
63 __be32 ddr1clkdr; /* 0x.0b20 - DDR1 Clock Disable Register */
64 __be32 ddr2clkdr; /* 0x.0b24 - DDR2 Clock Disable Register */
65 __be32 ddrclkdr; /* 0x.0b28 - DDR Clock Disable Register */
66 u8 res17[0xE00 - 0xB2C];
67 __be32 clkocr; /* 0x.0e00 - Clock Out Select Register */
68 u8 res18[0xE10 - 0xE04];
69 __be32 ddrdllcr; /* 0x.0e10 - DDR DLL Control Register */
70 u8 res19[0xE20 - 0xE14];
71 __be32 lbcdllcr; /* 0x.0e20 - LBC DLL Control Register */
72 u8 res20[0xF04 - 0xE24];
73 __be32 srds1cr0; /* 0x.0f04 - SerDes1 Control Register 0 */
74 __be32 srds1cr1; /* 0x.0f08 - SerDes1 Control Register 0 */
75 u8 res21[0xF40 - 0xF0C];
76 __be32 srds2cr0; /* 0x.0f40 - SerDes1 Control Register 0 */
77 __be32 srds2cr1; /* 0x.0f44 - SerDes1 Control Register 0 */
78} __attribute__ ((packed));
79
80#define CCSR_GUTS_DMACR_DEV_SSI 0 /* DMA controller/channel set to SSI */
81#define CCSR_GUTS_DMACR_DEV_IR 1 /* DMA controller/channel set to IR */
82
83/*
84 * Set the DMACR register in the GUTS
85 *
86 * The DMACR register determines the source of initiated transfers for each
87 * channel on each DMA controller. Rather than have a bunch of repetitive
88 * macros for the bit patterns, we just have a function that calculates
89 * them.
90 *
91 * guts: Pointer to GUTS structure
92 * co: The DMA controller (0 or 1)
93 * ch: The channel on the DMA controller (0, 1, 2, or 3)
94 * device: The device to set as the source (CCSR_GUTS_DMACR_DEV_xx)
95 */
96static inline void guts_set_dmacr(struct ccsr_guts __iomem *guts,
97 unsigned int co, unsigned int ch, unsigned int device)
98{
99 unsigned int shift = 16 + (8 * (1 - co) + 2 * (3 - ch));
100
101 clrsetbits_be32(&guts->dmacr, 3 << shift, device << shift);
102}
103
104#define CCSR_GUTS_PMUXCR_LDPSEL 0x00010000
105#define CCSR_GUTS_PMUXCR_SSI1_MASK 0x0000C000 /* Bitmask for SSI1 */
106#define CCSR_GUTS_PMUXCR_SSI1_LA 0x00000000 /* Latched address */
107#define CCSR_GUTS_PMUXCR_SSI1_HI 0x00004000 /* High impedance */
108#define CCSR_GUTS_PMUXCR_SSI1_SSI 0x00008000 /* Used for SSI1 */
109#define CCSR_GUTS_PMUXCR_SSI2_MASK 0x00003000 /* Bitmask for SSI2 */
110#define CCSR_GUTS_PMUXCR_SSI2_LA 0x00000000 /* Latched address */
111#define CCSR_GUTS_PMUXCR_SSI2_HI 0x00001000 /* High impedance */
112#define CCSR_GUTS_PMUXCR_SSI2_SSI 0x00002000 /* Used for SSI2 */
113#define CCSR_GUTS_PMUXCR_LA_22_25_LA 0x00000000 /* Latched Address */
114#define CCSR_GUTS_PMUXCR_LA_22_25_HI 0x00000400 /* High impedance */
115#define CCSR_GUTS_PMUXCR_DBGDRV 0x00000200 /* Signals not driven */
116#define CCSR_GUTS_PMUXCR_DMA2_0 0x00000008
117#define CCSR_GUTS_PMUXCR_DMA2_3 0x00000004
118#define CCSR_GUTS_PMUXCR_DMA1_0 0x00000002
119#define CCSR_GUTS_PMUXCR_DMA1_3 0x00000001
120
121/*
122 * Set the DMA external control bits in the GUTS
123 *
124 * The DMA external control bits in the PMUXCR are only meaningful for
125 * channels 0 and 3. Any other channels are ignored.
126 *
127 * guts: Pointer to GUTS structure
128 * co: The DMA controller (0 or 1)
129 * ch: The channel on the DMA controller (0, 1, 2, or 3)
130 * value: the new value for the bit (0 or 1)
131 */
132static inline void guts_set_pmuxcr_dma(struct ccsr_guts __iomem *guts,
133 unsigned int co, unsigned int ch, unsigned int value)
134{
135 if ((ch == 0) || (ch == 3)) {
136 unsigned int shift = 2 * (co + 1) - (ch & 1) - 1;
137
138 clrsetbits_be32(&guts->pmuxcr, 1 << shift, value << shift);
139 }
140}
141
142#define CCSR_GUTS_CLKDVDR_PXCKEN 0x80000000
143#define CCSR_GUTS_CLKDVDR_SSICKEN 0x20000000
144#define CCSR_GUTS_CLKDVDR_PXCKINV 0x10000000
145#define CCSR_GUTS_CLKDVDR_PXCKDLY_SHIFT 25
146#define CCSR_GUTS_CLKDVDR_PXCKDLY_MASK 0x06000000
147#define CCSR_GUTS_CLKDVDR_PXCKDLY(x) \
148 (((x) & 3) << CCSR_GUTS_CLKDVDR_PXCKDLY_SHIFT)
149#define CCSR_GUTS_CLKDVDR_PXCLK_SHIFT 16
150#define CCSR_GUTS_CLKDVDR_PXCLK_MASK 0x001F0000
151#define CCSR_GUTS_CLKDVDR_PXCLK(x) (((x) & 31) << CCSR_GUTS_CLKDVDR_PXCLK_SHIFT)
152#define CCSR_GUTS_CLKDVDR_SSICLK_MASK 0x000000FF
153#define CCSR_GUTS_CLKDVDR_SSICLK(x) ((x) & CCSR_GUTS_CLKDVDR_SSICLK_MASK)
154
155#endif /* __ASM_POWERPC_IMMAP_86XX_H__ */
156#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/immap_cpm2.h b/arch/powerpc/include/asm/immap_cpm2.h
new file mode 100644
index 000000000000..4080bab0468c
--- /dev/null
+++ b/arch/powerpc/include/asm/immap_cpm2.h
@@ -0,0 +1,650 @@
1/*
2 * CPM2 Internal Memory Map
3 * Copyright (c) 1999 Dan Malek (dmalek@jlc.net)
4 *
5 * The Internal Memory Map for devices with CPM2 on them. This
6 * is the superset of all CPM2 devices (8260, 8266, 8280, 8272,
7 * 8560).
8 */
9#ifdef __KERNEL__
10#ifndef __IMMAP_CPM2__
11#define __IMMAP_CPM2__
12
13#include <linux/types.h>
14
15/* System configuration registers.
16*/
17typedef struct sys_82xx_conf {
18 u32 sc_siumcr;
19 u32 sc_sypcr;
20 u8 res1[6];
21 u16 sc_swsr;
22 u8 res2[20];
23 u32 sc_bcr;
24 u8 sc_ppc_acr;
25 u8 res3[3];
26 u32 sc_ppc_alrh;
27 u32 sc_ppc_alrl;
28 u8 sc_lcl_acr;
29 u8 res4[3];
30 u32 sc_lcl_alrh;
31 u32 sc_lcl_alrl;
32 u32 sc_tescr1;
33 u32 sc_tescr2;
34 u32 sc_ltescr1;
35 u32 sc_ltescr2;
36 u32 sc_pdtea;
37 u8 sc_pdtem;
38 u8 res5[3];
39 u32 sc_ldtea;
40 u8 sc_ldtem;
41 u8 res6[163];
42} sysconf_82xx_cpm2_t;
43
44typedef struct sys_85xx_conf {
45 u32 sc_cear;
46 u16 sc_ceer;
47 u16 sc_cemr;
48 u8 res1[70];
49 u32 sc_smaer;
50 u8 res2[4];
51 u32 sc_smevr;
52 u32 sc_smctr;
53 u32 sc_lmaer;
54 u8 res3[4];
55 u32 sc_lmevr;
56 u32 sc_lmctr;
57 u8 res4[144];
58} sysconf_85xx_cpm2_t;
59
60typedef union sys_conf {
61 sysconf_82xx_cpm2_t siu_82xx;
62 sysconf_85xx_cpm2_t siu_85xx;
63} sysconf_cpm2_t;
64
65
66
67/* Memory controller registers.
68*/
69typedef struct mem_ctlr {
70 u32 memc_br0;
71 u32 memc_or0;
72 u32 memc_br1;
73 u32 memc_or1;
74 u32 memc_br2;
75 u32 memc_or2;
76 u32 memc_br3;
77 u32 memc_or3;
78 u32 memc_br4;
79 u32 memc_or4;
80 u32 memc_br5;
81 u32 memc_or5;
82 u32 memc_br6;
83 u32 memc_or6;
84 u32 memc_br7;
85 u32 memc_or7;
86 u32 memc_br8;
87 u32 memc_or8;
88 u32 memc_br9;
89 u32 memc_or9;
90 u32 memc_br10;
91 u32 memc_or10;
92 u32 memc_br11;
93 u32 memc_or11;
94 u8 res1[8];
95 u32 memc_mar;
96 u8 res2[4];
97 u32 memc_mamr;
98 u32 memc_mbmr;
99 u32 memc_mcmr;
100 u8 res3[8];
101 u16 memc_mptpr;
102 u8 res4[2];
103 u32 memc_mdr;
104 u8 res5[4];
105 u32 memc_psdmr;
106 u32 memc_lsdmr;
107 u8 memc_purt;
108 u8 res6[3];
109 u8 memc_psrt;
110 u8 res7[3];
111 u8 memc_lurt;
112 u8 res8[3];
113 u8 memc_lsrt;
114 u8 res9[3];
115 u32 memc_immr;
116 u32 memc_pcibr0;
117 u32 memc_pcibr1;
118 u8 res10[16];
119 u32 memc_pcimsk0;
120 u32 memc_pcimsk1;
121 u8 res11[52];
122} memctl_cpm2_t;
123
124/* System Integration Timers.
125*/
126typedef struct sys_int_timers {
127 u8 res1[32];
128 u16 sit_tmcntsc;
129 u8 res2[2];
130 u32 sit_tmcnt;
131 u8 res3[4];
132 u32 sit_tmcntal;
133 u8 res4[16];
134 u16 sit_piscr;
135 u8 res5[2];
136 u32 sit_pitc;
137 u32 sit_pitr;
138 u8 res6[94];
139 u8 res7[390];
140} sit_cpm2_t;
141
142#define PISCR_PIRQ_MASK ((u16)0xff00)
143#define PISCR_PS ((u16)0x0080)
144#define PISCR_PIE ((u16)0x0004)
145#define PISCR_PTF ((u16)0x0002)
146#define PISCR_PTE ((u16)0x0001)
147
148/* PCI Controller.
149*/
150typedef struct pci_ctlr {
151 u32 pci_omisr;
152 u32 pci_omimr;
153 u8 res1[8];
154 u32 pci_ifqpr;
155 u32 pci_ofqpr;
156 u8 res2[8];
157 u32 pci_imr0;
158 u32 pci_imr1;
159 u32 pci_omr0;
160 u32 pci_omr1;
161 u32 pci_odr;
162 u8 res3[4];
163 u32 pci_idr;
164 u8 res4[20];
165 u32 pci_imisr;
166 u32 pci_imimr;
167 u8 res5[24];
168 u32 pci_ifhpr;
169 u8 res6[4];
170 u32 pci_iftpr;
171 u8 res7[4];
172 u32 pci_iphpr;
173 u8 res8[4];
174 u32 pci_iptpr;
175 u8 res9[4];
176 u32 pci_ofhpr;
177 u8 res10[4];
178 u32 pci_oftpr;
179 u8 res11[4];
180 u32 pci_ophpr;
181 u8 res12[4];
182 u32 pci_optpr;
183 u8 res13[8];
184 u32 pci_mucr;
185 u8 res14[8];
186 u32 pci_qbar;
187 u8 res15[12];
188 u32 pci_dmamr0;
189 u32 pci_dmasr0;
190 u32 pci_dmacdar0;
191 u8 res16[4];
192 u32 pci_dmasar0;
193 u8 res17[4];
194 u32 pci_dmadar0;
195 u8 res18[4];
196 u32 pci_dmabcr0;
197 u32 pci_dmandar0;
198 u8 res19[86];
199 u32 pci_dmamr1;
200 u32 pci_dmasr1;
201 u32 pci_dmacdar1;
202 u8 res20[4];
203 u32 pci_dmasar1;
204 u8 res21[4];
205 u32 pci_dmadar1;
206 u8 res22[4];
207 u32 pci_dmabcr1;
208 u32 pci_dmandar1;
209 u8 res23[88];
210 u32 pci_dmamr2;
211 u32 pci_dmasr2;
212 u32 pci_dmacdar2;
213 u8 res24[4];
214 u32 pci_dmasar2;
215 u8 res25[4];
216 u32 pci_dmadar2;
217 u8 res26[4];
218 u32 pci_dmabcr2;
219 u32 pci_dmandar2;
220 u8 res27[88];
221 u32 pci_dmamr3;
222 u32 pci_dmasr3;
223 u32 pci_dmacdar3;
224 u8 res28[4];
225 u32 pci_dmasar3;
226 u8 res29[4];
227 u32 pci_dmadar3;
228 u8 res30[4];
229 u32 pci_dmabcr3;
230 u32 pci_dmandar3;
231 u8 res31[344];
232 u32 pci_potar0;
233 u8 res32[4];
234 u32 pci_pobar0;
235 u8 res33[4];
236 u32 pci_pocmr0;
237 u8 res34[4];
238 u32 pci_potar1;
239 u8 res35[4];
240 u32 pci_pobar1;
241 u8 res36[4];
242 u32 pci_pocmr1;
243 u8 res37[4];
244 u32 pci_potar2;
245 u8 res38[4];
246 u32 pci_pobar2;
247 u8 res39[4];
248 u32 pci_pocmr2;
249 u8 res40[50];
250 u32 pci_ptcr;
251 u32 pci_gpcr;
252 u32 pci_gcr;
253 u32 pci_esr;
254 u32 pci_emr;
255 u32 pci_ecr;
256 u32 pci_eacr;
257 u8 res41[4];
258 u32 pci_edcr;
259 u8 res42[4];
260 u32 pci_eccr;
261 u8 res43[44];
262 u32 pci_pitar1;
263 u8 res44[4];
264 u32 pci_pibar1;
265 u8 res45[4];
266 u32 pci_picmr1;
267 u8 res46[4];
268 u32 pci_pitar0;
269 u8 res47[4];
270 u32 pci_pibar0;
271 u8 res48[4];
272 u32 pci_picmr0;
273 u8 res49[4];
274 u32 pci_cfg_addr;
275 u32 pci_cfg_data;
276 u32 pci_int_ack;
277 u8 res50[756];
278} pci_cpm2_t;
279
280/* Interrupt Controller.
281*/
282typedef struct interrupt_controller {
283 u16 ic_sicr;
284 u8 res1[2];
285 u32 ic_sivec;
286 u32 ic_sipnrh;
287 u32 ic_sipnrl;
288 u32 ic_siprr;
289 u32 ic_scprrh;
290 u32 ic_scprrl;
291 u32 ic_simrh;
292 u32 ic_simrl;
293 u32 ic_siexr;
294 u8 res2[88];
295} intctl_cpm2_t;
296
297/* Clocks and Reset.
298*/
299typedef struct clk_and_reset {
300 u32 car_sccr;
301 u8 res1[4];
302 u32 car_scmr;
303 u8 res2[4];
304 u32 car_rsr;
305 u32 car_rmr;
306 u8 res[104];
307} car_cpm2_t;
308
309/* Input/Output Port control/status registers.
310 * Names consistent with processor manual, although they are different
311 * from the original 8xx names.......
312 */
313typedef struct io_port {
314 u32 iop_pdira;
315 u32 iop_ppara;
316 u32 iop_psora;
317 u32 iop_podra;
318 u32 iop_pdata;
319 u8 res1[12];
320 u32 iop_pdirb;
321 u32 iop_pparb;
322 u32 iop_psorb;
323 u32 iop_podrb;
324 u32 iop_pdatb;
325 u8 res2[12];
326 u32 iop_pdirc;
327 u32 iop_pparc;
328 u32 iop_psorc;
329 u32 iop_podrc;
330 u32 iop_pdatc;
331 u8 res3[12];
332 u32 iop_pdird;
333 u32 iop_ppard;
334 u32 iop_psord;
335 u32 iop_podrd;
336 u32 iop_pdatd;
337 u8 res4[12];
338} iop_cpm2_t;
339
340/* Communication Processor Module Timers
341*/
342typedef struct cpm_timers {
343 u8 cpmt_tgcr1;
344 u8 res1[3];
345 u8 cpmt_tgcr2;
346 u8 res2[11];
347 u16 cpmt_tmr1;
348 u16 cpmt_tmr2;
349 u16 cpmt_trr1;
350 u16 cpmt_trr2;
351 u16 cpmt_tcr1;
352 u16 cpmt_tcr2;
353 u16 cpmt_tcn1;
354 u16 cpmt_tcn2;
355 u16 cpmt_tmr3;
356 u16 cpmt_tmr4;
357 u16 cpmt_trr3;
358 u16 cpmt_trr4;
359 u16 cpmt_tcr3;
360 u16 cpmt_tcr4;
361 u16 cpmt_tcn3;
362 u16 cpmt_tcn4;
363 u16 cpmt_ter1;
364 u16 cpmt_ter2;
365 u16 cpmt_ter3;
366 u16 cpmt_ter4;
367 u8 res3[584];
368} cpmtimer_cpm2_t;
369
370/* DMA control/status registers.
371*/
372typedef struct sdma_csr {
373 u8 res0[24];
374 u8 sdma_sdsr;
375 u8 res1[3];
376 u8 sdma_sdmr;
377 u8 res2[3];
378 u8 sdma_idsr1;
379 u8 res3[3];
380 u8 sdma_idmr1;
381 u8 res4[3];
382 u8 sdma_idsr2;
383 u8 res5[3];
384 u8 sdma_idmr2;
385 u8 res6[3];
386 u8 sdma_idsr3;
387 u8 res7[3];
388 u8 sdma_idmr3;
389 u8 res8[3];
390 u8 sdma_idsr4;
391 u8 res9[3];
392 u8 sdma_idmr4;
393 u8 res10[707];
394} sdma_cpm2_t;
395
396/* Fast controllers
397*/
398typedef struct fcc {
399 u32 fcc_gfmr;
400 u32 fcc_fpsmr;
401 u16 fcc_ftodr;
402 u8 res1[2];
403 u16 fcc_fdsr;
404 u8 res2[2];
405 u16 fcc_fcce;
406 u8 res3[2];
407 u16 fcc_fccm;
408 u8 res4[2];
409 u8 fcc_fccs;
410 u8 res5[3];
411 u8 fcc_ftirr_phy[4];
412} fcc_t;
413
414/* Fast controllers continued
415 */
416typedef struct fcc_c {
417 u32 fcc_firper;
418 u32 fcc_firer;
419 u32 fcc_firsr_hi;
420 u32 fcc_firsr_lo;
421 u8 fcc_gfemr;
422 u8 res1[15];
423} fcc_c_t;
424
425/* TC Layer
426 */
427typedef struct tclayer {
428 u16 tc_tcmode;
429 u16 tc_cdsmr;
430 u16 tc_tcer;
431 u16 tc_rcc;
432 u16 tc_tcmr;
433 u16 tc_fcc;
434 u16 tc_ccc;
435 u16 tc_icc;
436 u16 tc_tcc;
437 u16 tc_ecc;
438 u8 res1[12];
439} tclayer_t;
440
441
442/* I2C
443*/
444typedef struct i2c {
445 u8 i2c_i2mod;
446 u8 res1[3];
447 u8 i2c_i2add;
448 u8 res2[3];
449 u8 i2c_i2brg;
450 u8 res3[3];
451 u8 i2c_i2com;
452 u8 res4[3];
453 u8 i2c_i2cer;
454 u8 res5[3];
455 u8 i2c_i2cmr;
456 u8 res6[331];
457} i2c_cpm2_t;
458
459typedef struct scc { /* Serial communication channels */
460 u32 scc_gsmrl;
461 u32 scc_gsmrh;
462 u16 scc_psmr;
463 u8 res1[2];
464 u16 scc_todr;
465 u16 scc_dsr;
466 u16 scc_scce;
467 u8 res2[2];
468 u16 scc_sccm;
469 u8 res3;
470 u8 scc_sccs;
471 u8 res4[8];
472} scc_t;
473
474typedef struct smc { /* Serial management channels */
475 u8 res1[2];
476 u16 smc_smcmr;
477 u8 res2[2];
478 u8 smc_smce;
479 u8 res3[3];
480 u8 smc_smcm;
481 u8 res4[5];
482} smc_t;
483
484/* Serial Peripheral Interface.
485*/
486typedef struct spi_ctrl {
487 u16 spi_spmode;
488 u8 res1[4];
489 u8 spi_spie;
490 u8 res2[3];
491 u8 spi_spim;
492 u8 res3[2];
493 u8 spi_spcom;
494 u8 res4[82];
495} spictl_cpm2_t;
496
497/* CPM Mux.
498*/
499typedef struct cpmux {
500 u8 cmx_si1cr;
501 u8 res1;
502 u8 cmx_si2cr;
503 u8 res2;
504 u32 cmx_fcr;
505 u32 cmx_scr;
506 u8 cmx_smr;
507 u8 res3;
508 u16 cmx_uar;
509 u8 res4[16];
510} cpmux_t;
511
512/* SIRAM control
513*/
514typedef struct siram {
515 u16 si_amr;
516 u16 si_bmr;
517 u16 si_cmr;
518 u16 si_dmr;
519 u8 si_gmr;
520 u8 res1;
521 u8 si_cmdr;
522 u8 res2;
523 u8 si_str;
524 u8 res3;
525 u16 si_rsr;
526} siramctl_t;
527
528typedef struct mcc {
529 u16 mcc_mcce;
530 u8 res1[2];
531 u16 mcc_mccm;
532 u8 res2[2];
533 u8 mcc_mccf;
534 u8 res3[7];
535} mcc_t;
536
537typedef struct comm_proc {
538 u32 cp_cpcr;
539 u32 cp_rccr;
540 u8 res1[14];
541 u16 cp_rter;
542 u8 res2[2];
543 u16 cp_rtmr;
544 u16 cp_rtscr;
545 u8 res3[2];
546 u32 cp_rtsr;
547 u8 res4[12];
548} cpm_cpm2_t;
549
550/* USB Controller.
551*/
552typedef struct usb_ctlr {
553 u8 usb_usmod;
554 u8 usb_usadr;
555 u8 usb_uscom;
556 u8 res1[1];
557 u16 usb_usep1;
558 u16 usb_usep2;
559 u16 usb_usep3;
560 u16 usb_usep4;
561 u8 res2[4];
562 u16 usb_usber;
563 u8 res3[2];
564 u16 usb_usbmr;
565 u8 usb_usbs;
566 u8 res4[7];
567} usb_cpm2_t;
568
569/* ...and the whole thing wrapped up....
570*/
571
572typedef struct immap {
573 /* Some references are into the unique and known dpram spaces,
574 * others are from the generic base.
575 */
576#define im_dprambase im_dpram1
577 u8 im_dpram1[16*1024];
578 u8 res1[16*1024];
579 u8 im_dpram2[4*1024];
580 u8 res2[8*1024];
581 u8 im_dpram3[4*1024];
582 u8 res3[16*1024];
583
584 sysconf_cpm2_t im_siu_conf; /* SIU Configuration */
585 memctl_cpm2_t im_memctl; /* Memory Controller */
586 sit_cpm2_t im_sit; /* System Integration Timers */
587 pci_cpm2_t im_pci; /* PCI Controller */
588 intctl_cpm2_t im_intctl; /* Interrupt Controller */
589 car_cpm2_t im_clkrst; /* Clocks and reset */
590 iop_cpm2_t im_ioport; /* IO Port control/status */
591 cpmtimer_cpm2_t im_cpmtimer; /* CPM timers */
592 sdma_cpm2_t im_sdma; /* SDMA control/status */
593
594 fcc_t im_fcc[3]; /* Three FCCs */
595 u8 res4z[32];
596 fcc_c_t im_fcc_c[3]; /* Continued FCCs */
597
598 u8 res4[32];
599
600 tclayer_t im_tclayer[8]; /* Eight TCLayers */
601 u16 tc_tcgsr;
602 u16 tc_tcger;
603
604 /* First set of baud rate generators.
605 */
606 u8 res[236];
607 u32 im_brgc5;
608 u32 im_brgc6;
609 u32 im_brgc7;
610 u32 im_brgc8;
611
612 u8 res5[608];
613
614 i2c_cpm2_t im_i2c; /* I2C control/status */
615 cpm_cpm2_t im_cpm; /* Communication processor */
616
617 /* Second set of baud rate generators.
618 */
619 u32 im_brgc1;
620 u32 im_brgc2;
621 u32 im_brgc3;
622 u32 im_brgc4;
623
624 scc_t im_scc[4]; /* Four SCCs */
625 smc_t im_smc[2]; /* Couple of SMCs */
626 spictl_cpm2_t im_spi; /* A SPI */
627 cpmux_t im_cpmux; /* CPM clock route mux */
628 siramctl_t im_siramctl1; /* First SI RAM Control */
629 mcc_t im_mcc1; /* First MCC */
630 siramctl_t im_siramctl2; /* Second SI RAM Control */
631 mcc_t im_mcc2; /* Second MCC */
632 usb_cpm2_t im_usb; /* USB Controller */
633
634 u8 res6[1153];
635
636 u16 im_si1txram[256];
637 u8 res7[512];
638 u16 im_si1rxram[256];
639 u8 res8[512];
640 u16 im_si2txram[256];
641 u8 res9[512];
642 u16 im_si2rxram[256];
643 u8 res10[512];
644 u8 res11[4096];
645} cpm2_map_t;
646
647extern cpm2_map_t __iomem *cpm2_immr;
648
649#endif /* __IMMAP_CPM2__ */
650#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/immap_qe.h b/arch/powerpc/include/asm/immap_qe.h
new file mode 100644
index 000000000000..3c2fced3ac22
--- /dev/null
+++ b/arch/powerpc/include/asm/immap_qe.h
@@ -0,0 +1,483 @@
1/*
2 * QUICC Engine (QE) Internal Memory Map.
3 * The Internal Memory Map for devices with QE on them. This
4 * is the superset of all QE devices (8360, etc.).
5
6 * Copyright (C) 2006. Freescale Semicondutor, Inc. All rights reserved.
7 *
8 * Authors: Shlomi Gridish <gridish@freescale.com>
9 * Li Yang <leoli@freescale.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16#ifndef _ASM_POWERPC_IMMAP_QE_H
17#define _ASM_POWERPC_IMMAP_QE_H
18#ifdef __KERNEL__
19
20#include <linux/kernel.h>
21#include <asm/io.h>
22
23#define QE_IMMAP_SIZE (1024 * 1024) /* 1MB from 1MB+IMMR */
24
25/* QE I-RAM */
26struct qe_iram {
27 __be32 iadd; /* I-RAM Address Register */
28 __be32 idata; /* I-RAM Data Register */
29 u8 res0[0x78];
30} __attribute__ ((packed));
31
32/* QE Interrupt Controller */
33struct qe_ic_regs {
34 __be32 qicr;
35 __be32 qivec;
36 __be32 qripnr;
37 __be32 qipnr;
38 __be32 qipxcc;
39 __be32 qipycc;
40 __be32 qipwcc;
41 __be32 qipzcc;
42 __be32 qimr;
43 __be32 qrimr;
44 __be32 qicnr;
45 u8 res0[0x4];
46 __be32 qiprta;
47 __be32 qiprtb;
48 u8 res1[0x4];
49 __be32 qricr;
50 u8 res2[0x20];
51 __be32 qhivec;
52 u8 res3[0x1C];
53} __attribute__ ((packed));
54
55/* Communications Processor */
56struct cp_qe {
57 __be32 cecr; /* QE command register */
58 __be32 ceccr; /* QE controller configuration register */
59 __be32 cecdr; /* QE command data register */
60 u8 res0[0xA];
61 __be16 ceter; /* QE timer event register */
62 u8 res1[0x2];
63 __be16 cetmr; /* QE timers mask register */
64 __be32 cetscr; /* QE time-stamp timer control register */
65 __be32 cetsr1; /* QE time-stamp register 1 */
66 __be32 cetsr2; /* QE time-stamp register 2 */
67 u8 res2[0x8];
68 __be32 cevter; /* QE virtual tasks event register */
69 __be32 cevtmr; /* QE virtual tasks mask register */
70 __be16 cercr; /* QE RAM control register */
71 u8 res3[0x2];
72 u8 res4[0x24];
73 __be16 ceexe1; /* QE external request 1 event register */
74 u8 res5[0x2];
75 __be16 ceexm1; /* QE external request 1 mask register */
76 u8 res6[0x2];
77 __be16 ceexe2; /* QE external request 2 event register */
78 u8 res7[0x2];
79 __be16 ceexm2; /* QE external request 2 mask register */
80 u8 res8[0x2];
81 __be16 ceexe3; /* QE external request 3 event register */
82 u8 res9[0x2];
83 __be16 ceexm3; /* QE external request 3 mask register */
84 u8 res10[0x2];
85 __be16 ceexe4; /* QE external request 4 event register */
86 u8 res11[0x2];
87 __be16 ceexm4; /* QE external request 4 mask register */
88 u8 res12[0x3A];
89 __be32 ceurnr; /* QE microcode revision number register */
90 u8 res13[0x244];
91} __attribute__ ((packed));
92
93/* QE Multiplexer */
94struct qe_mux {
95 __be32 cmxgcr; /* CMX general clock route register */
96 __be32 cmxsi1cr_l; /* CMX SI1 clock route low register */
97 __be32 cmxsi1cr_h; /* CMX SI1 clock route high register */
98 __be32 cmxsi1syr; /* CMX SI1 SYNC route register */
99 __be32 cmxucr[4]; /* CMX UCCx clock route registers */
100 __be32 cmxupcr; /* CMX UPC clock route register */
101 u8 res0[0x1C];
102} __attribute__ ((packed));
103
104/* QE Timers */
105struct qe_timers {
106 u8 gtcfr1; /* Timer 1 and Timer 2 global config register*/
107 u8 res0[0x3];
108 u8 gtcfr2; /* Timer 3 and timer 4 global config register*/
109 u8 res1[0xB];
110 __be16 gtmdr1; /* Timer 1 mode register */
111 __be16 gtmdr2; /* Timer 2 mode register */
112 __be16 gtrfr1; /* Timer 1 reference register */
113 __be16 gtrfr2; /* Timer 2 reference register */
114 __be16 gtcpr1; /* Timer 1 capture register */
115 __be16 gtcpr2; /* Timer 2 capture register */
116 __be16 gtcnr1; /* Timer 1 counter */
117 __be16 gtcnr2; /* Timer 2 counter */
118 __be16 gtmdr3; /* Timer 3 mode register */
119 __be16 gtmdr4; /* Timer 4 mode register */
120 __be16 gtrfr3; /* Timer 3 reference register */
121 __be16 gtrfr4; /* Timer 4 reference register */
122 __be16 gtcpr3; /* Timer 3 capture register */
123 __be16 gtcpr4; /* Timer 4 capture register */
124 __be16 gtcnr3; /* Timer 3 counter */
125 __be16 gtcnr4; /* Timer 4 counter */
126 __be16 gtevr1; /* Timer 1 event register */
127 __be16 gtevr2; /* Timer 2 event register */
128 __be16 gtevr3; /* Timer 3 event register */
129 __be16 gtevr4; /* Timer 4 event register */
130 __be16 gtps; /* Timer 1 prescale register */
131 u8 res2[0x46];
132} __attribute__ ((packed));
133
134/* BRG */
135struct qe_brg {
136 __be32 brgc[16]; /* BRG configuration registers */
137 u8 res0[0x40];
138} __attribute__ ((packed));
139
140/* SPI */
141struct spi {
142 u8 res0[0x20];
143 __be32 spmode; /* SPI mode register */
144 u8 res1[0x2];
145 u8 spie; /* SPI event register */
146 u8 res2[0x1];
147 u8 res3[0x2];
148 u8 spim; /* SPI mask register */
149 u8 res4[0x1];
150 u8 res5[0x1];
151 u8 spcom; /* SPI command register */
152 u8 res6[0x2];
153 __be32 spitd; /* SPI transmit data register (cpu mode) */
154 __be32 spird; /* SPI receive data register (cpu mode) */
155 u8 res7[0x8];
156} __attribute__ ((packed));
157
158/* SI */
159struct si1 {
160 __be16 siamr1; /* SI1 TDMA mode register */
161 __be16 sibmr1; /* SI1 TDMB mode register */
162 __be16 sicmr1; /* SI1 TDMC mode register */
163 __be16 sidmr1; /* SI1 TDMD mode register */
164 u8 siglmr1_h; /* SI1 global mode register high */
165 u8 res0[0x1];
166 u8 sicmdr1_h; /* SI1 command register high */
167 u8 res2[0x1];
168 u8 sistr1_h; /* SI1 status register high */
169 u8 res3[0x1];
170 __be16 sirsr1_h; /* SI1 RAM shadow address register high */
171 u8 sitarc1; /* SI1 RAM counter Tx TDMA */
172 u8 sitbrc1; /* SI1 RAM counter Tx TDMB */
173 u8 sitcrc1; /* SI1 RAM counter Tx TDMC */
174 u8 sitdrc1; /* SI1 RAM counter Tx TDMD */
175 u8 sirarc1; /* SI1 RAM counter Rx TDMA */
176 u8 sirbrc1; /* SI1 RAM counter Rx TDMB */
177 u8 sircrc1; /* SI1 RAM counter Rx TDMC */
178 u8 sirdrc1; /* SI1 RAM counter Rx TDMD */
179 u8 res4[0x8];
180 __be16 siemr1; /* SI1 TDME mode register 16 bits */
181 __be16 sifmr1; /* SI1 TDMF mode register 16 bits */
182 __be16 sigmr1; /* SI1 TDMG mode register 16 bits */
183 __be16 sihmr1; /* SI1 TDMH mode register 16 bits */
184 u8 siglmg1_l; /* SI1 global mode register low 8 bits */
185 u8 res5[0x1];
186 u8 sicmdr1_l; /* SI1 command register low 8 bits */
187 u8 res6[0x1];
188 u8 sistr1_l; /* SI1 status register low 8 bits */
189 u8 res7[0x1];
190 __be16 sirsr1_l; /* SI1 RAM shadow address register low 16 bits*/
191 u8 siterc1; /* SI1 RAM counter Tx TDME 8 bits */
192 u8 sitfrc1; /* SI1 RAM counter Tx TDMF 8 bits */
193 u8 sitgrc1; /* SI1 RAM counter Tx TDMG 8 bits */
194 u8 sithrc1; /* SI1 RAM counter Tx TDMH 8 bits */
195 u8 sirerc1; /* SI1 RAM counter Rx TDME 8 bits */
196 u8 sirfrc1; /* SI1 RAM counter Rx TDMF 8 bits */
197 u8 sirgrc1; /* SI1 RAM counter Rx TDMG 8 bits */
198 u8 sirhrc1; /* SI1 RAM counter Rx TDMH 8 bits */
199 u8 res8[0x8];
200 __be32 siml1; /* SI1 multiframe limit register */
201 u8 siedm1; /* SI1 extended diagnostic mode register */
202 u8 res9[0xBB];
203} __attribute__ ((packed));
204
205/* SI Routing Tables */
206struct sir {
207 u8 tx[0x400];
208 u8 rx[0x400];
209 u8 res0[0x800];
210} __attribute__ ((packed));
211
212/* USB Controller */
213struct usb_ctlr {
214 u8 usb_usmod;
215 u8 usb_usadr;
216 u8 usb_uscom;
217 u8 res1[1];
218 __be16 usb_usep1;
219 __be16 usb_usep2;
220 __be16 usb_usep3;
221 __be16 usb_usep4;
222 u8 res2[4];
223 __be16 usb_usber;
224 u8 res3[2];
225 __be16 usb_usbmr;
226 u8 res4[1];
227 u8 usb_usbs;
228 __be16 usb_ussft;
229 u8 res5[2];
230 __be16 usb_usfrn;
231 u8 res6[0x22];
232} __attribute__ ((packed));
233
234/* MCC */
235struct mcc {
236 __be32 mcce; /* MCC event register */
237 __be32 mccm; /* MCC mask register */
238 __be32 mccf; /* MCC configuration register */
239 __be32 merl; /* MCC emergency request level register */
240 u8 res0[0xF0];
241} __attribute__ ((packed));
242
243/* QE UCC Slow */
244struct ucc_slow {
245 __be32 gumr_l; /* UCCx general mode register (low) */
246 __be32 gumr_h; /* UCCx general mode register (high) */
247 __be16 upsmr; /* UCCx protocol-specific mode register */
248 u8 res0[0x2];
249 __be16 utodr; /* UCCx transmit on demand register */
250 __be16 udsr; /* UCCx data synchronization register */
251 __be16 ucce; /* UCCx event register */
252 u8 res1[0x2];
253 __be16 uccm; /* UCCx mask register */
254 u8 res2[0x1];
255 u8 uccs; /* UCCx status register */
256 u8 res3[0x24];
257 __be16 utpt;
258 u8 res4[0x52];
259 u8 guemr; /* UCC general extended mode register */
260} __attribute__ ((packed));
261
262/* QE UCC Fast */
263struct ucc_fast {
264 __be32 gumr; /* UCCx general mode register */
265 __be32 upsmr; /* UCCx protocol-specific mode register */
266 __be16 utodr; /* UCCx transmit on demand register */
267 u8 res0[0x2];
268 __be16 udsr; /* UCCx data synchronization register */
269 u8 res1[0x2];
270 __be32 ucce; /* UCCx event register */
271 __be32 uccm; /* UCCx mask register */
272 u8 uccs; /* UCCx status register */
273 u8 res2[0x7];
274 __be32 urfb; /* UCC receive FIFO base */
275 __be16 urfs; /* UCC receive FIFO size */
276 u8 res3[0x2];
277 __be16 urfet; /* UCC receive FIFO emergency threshold */
278 __be16 urfset; /* UCC receive FIFO special emergency
279 threshold */
280 __be32 utfb; /* UCC transmit FIFO base */
281 __be16 utfs; /* UCC transmit FIFO size */
282 u8 res4[0x2];
283 __be16 utfet; /* UCC transmit FIFO emergency threshold */
284 u8 res5[0x2];
285 __be16 utftt; /* UCC transmit FIFO transmit threshold */
286 u8 res6[0x2];
287 __be16 utpt; /* UCC transmit polling timer */
288 u8 res7[0x2];
289 __be32 urtry; /* UCC retry counter register */
290 u8 res8[0x4C];
291 u8 guemr; /* UCC general extended mode register */
292} __attribute__ ((packed));
293
294struct ucc {
295 union {
296 struct ucc_slow slow;
297 struct ucc_fast fast;
298 u8 res[0x200]; /* UCC blocks are 512 bytes each */
299 };
300} __attribute__ ((packed));
301
302/* MultiPHY UTOPIA POS Controllers (UPC) */
303struct upc {
304 __be32 upgcr; /* UTOPIA/POS general configuration register */
305 __be32 uplpa; /* UTOPIA/POS last PHY address */
306 __be32 uphec; /* ATM HEC register */
307 __be32 upuc; /* UTOPIA/POS UCC configuration */
308 __be32 updc1; /* UTOPIA/POS device 1 configuration */
309 __be32 updc2; /* UTOPIA/POS device 2 configuration */
310 __be32 updc3; /* UTOPIA/POS device 3 configuration */
311 __be32 updc4; /* UTOPIA/POS device 4 configuration */
312 __be32 upstpa; /* UTOPIA/POS STPA threshold */
313 u8 res0[0xC];
314 __be32 updrs1_h; /* UTOPIA/POS device 1 rate select */
315 __be32 updrs1_l; /* UTOPIA/POS device 1 rate select */
316 __be32 updrs2_h; /* UTOPIA/POS device 2 rate select */
317 __be32 updrs2_l; /* UTOPIA/POS device 2 rate select */
318 __be32 updrs3_h; /* UTOPIA/POS device 3 rate select */
319 __be32 updrs3_l; /* UTOPIA/POS device 3 rate select */
320 __be32 updrs4_h; /* UTOPIA/POS device 4 rate select */
321 __be32 updrs4_l; /* UTOPIA/POS device 4 rate select */
322 __be32 updrp1; /* UTOPIA/POS device 1 receive priority low */
323 __be32 updrp2; /* UTOPIA/POS device 2 receive priority low */
324 __be32 updrp3; /* UTOPIA/POS device 3 receive priority low */
325 __be32 updrp4; /* UTOPIA/POS device 4 receive priority low */
326 __be32 upde1; /* UTOPIA/POS device 1 event */
327 __be32 upde2; /* UTOPIA/POS device 2 event */
328 __be32 upde3; /* UTOPIA/POS device 3 event */
329 __be32 upde4; /* UTOPIA/POS device 4 event */
330 __be16 uprp1;
331 __be16 uprp2;
332 __be16 uprp3;
333 __be16 uprp4;
334 u8 res1[0x8];
335 __be16 uptirr1_0; /* Device 1 transmit internal rate 0 */
336 __be16 uptirr1_1; /* Device 1 transmit internal rate 1 */
337 __be16 uptirr1_2; /* Device 1 transmit internal rate 2 */
338 __be16 uptirr1_3; /* Device 1 transmit internal rate 3 */
339 __be16 uptirr2_0; /* Device 2 transmit internal rate 0 */
340 __be16 uptirr2_1; /* Device 2 transmit internal rate 1 */
341 __be16 uptirr2_2; /* Device 2 transmit internal rate 2 */
342 __be16 uptirr2_3; /* Device 2 transmit internal rate 3 */
343 __be16 uptirr3_0; /* Device 3 transmit internal rate 0 */
344 __be16 uptirr3_1; /* Device 3 transmit internal rate 1 */
345 __be16 uptirr3_2; /* Device 3 transmit internal rate 2 */
346 __be16 uptirr3_3; /* Device 3 transmit internal rate 3 */
347 __be16 uptirr4_0; /* Device 4 transmit internal rate 0 */
348 __be16 uptirr4_1; /* Device 4 transmit internal rate 1 */
349 __be16 uptirr4_2; /* Device 4 transmit internal rate 2 */
350 __be16 uptirr4_3; /* Device 4 transmit internal rate 3 */
351 __be32 uper1; /* Device 1 port enable register */
352 __be32 uper2; /* Device 2 port enable register */
353 __be32 uper3; /* Device 3 port enable register */
354 __be32 uper4; /* Device 4 port enable register */
355 u8 res2[0x150];
356} __attribute__ ((packed));
357
358/* SDMA */
359struct sdma {
360 __be32 sdsr; /* Serial DMA status register */
361 __be32 sdmr; /* Serial DMA mode register */
362 __be32 sdtr1; /* SDMA system bus threshold register */
363 __be32 sdtr2; /* SDMA secondary bus threshold register */
364 __be32 sdhy1; /* SDMA system bus hysteresis register */
365 __be32 sdhy2; /* SDMA secondary bus hysteresis register */
366 __be32 sdta1; /* SDMA system bus address register */
367 __be32 sdta2; /* SDMA secondary bus address register */
368 __be32 sdtm1; /* SDMA system bus MSNUM register */
369 __be32 sdtm2; /* SDMA secondary bus MSNUM register */
370 u8 res0[0x10];
371 __be32 sdaqr; /* SDMA address bus qualify register */
372 __be32 sdaqmr; /* SDMA address bus qualify mask register */
373 u8 res1[0x4];
374 __be32 sdebcr; /* SDMA CAM entries base register */
375 u8 res2[0x38];
376} __attribute__ ((packed));
377
378/* Debug Space */
379struct dbg {
380 __be32 bpdcr; /* Breakpoint debug command register */
381 __be32 bpdsr; /* Breakpoint debug status register */
382 __be32 bpdmr; /* Breakpoint debug mask register */
383 __be32 bprmrr0; /* Breakpoint request mode risc register 0 */
384 __be32 bprmrr1; /* Breakpoint request mode risc register 1 */
385 u8 res0[0x8];
386 __be32 bprmtr0; /* Breakpoint request mode trb register 0 */
387 __be32 bprmtr1; /* Breakpoint request mode trb register 1 */
388 u8 res1[0x8];
389 __be32 bprmir; /* Breakpoint request mode immediate register */
390 __be32 bprmsr; /* Breakpoint request mode serial register */
391 __be32 bpemr; /* Breakpoint exit mode register */
392 u8 res2[0x48];
393} __attribute__ ((packed));
394
395/*
396 * RISC Special Registers (Trap and Breakpoint). These are described in
397 * the QE Developer's Handbook.
398 */
399struct rsp {
400 __be32 tibcr[16]; /* Trap/instruction breakpoint control regs */
401 u8 res0[64];
402 __be32 ibcr0;
403 __be32 ibs0;
404 __be32 ibcnr0;
405 u8 res1[4];
406 __be32 ibcr1;
407 __be32 ibs1;
408 __be32 ibcnr1;
409 __be32 npcr;
410 __be32 dbcr;
411 __be32 dbar;
412 __be32 dbamr;
413 __be32 dbsr;
414 __be32 dbcnr;
415 u8 res2[12];
416 __be32 dbdr_h;
417 __be32 dbdr_l;
418 __be32 dbdmr_h;
419 __be32 dbdmr_l;
420 __be32 bsr;
421 __be32 bor;
422 __be32 bior;
423 u8 res3[4];
424 __be32 iatr[4];
425 __be32 eccr; /* Exception control configuration register */
426 __be32 eicr;
427 u8 res4[0x100-0xf8];
428} __attribute__ ((packed));
429
430struct qe_immap {
431 struct qe_iram iram; /* I-RAM */
432 struct qe_ic_regs ic; /* Interrupt Controller */
433 struct cp_qe cp; /* Communications Processor */
434 struct qe_mux qmx; /* QE Multiplexer */
435 struct qe_timers qet; /* QE Timers */
436 struct spi spi[0x2]; /* spi */
437 struct mcc mcc; /* mcc */
438 struct qe_brg brg; /* brg */
439 struct usb_ctlr usb; /* USB */
440 struct si1 si1; /* SI */
441 u8 res11[0x800];
442 struct sir sir; /* SI Routing Tables */
443 struct ucc ucc1; /* ucc1 */
444 struct ucc ucc3; /* ucc3 */
445 struct ucc ucc5; /* ucc5 */
446 struct ucc ucc7; /* ucc7 */
447 u8 res12[0x600];
448 struct upc upc1; /* MultiPHY UTOPIA POS Ctrlr 1*/
449 struct ucc ucc2; /* ucc2 */
450 struct ucc ucc4; /* ucc4 */
451 struct ucc ucc6; /* ucc6 */
452 struct ucc ucc8; /* ucc8 */
453 u8 res13[0x600];
454 struct upc upc2; /* MultiPHY UTOPIA POS Ctrlr 2*/
455 struct sdma sdma; /* SDMA */
456 struct dbg dbg; /* 0x104080 - 0x1040FF
457 Debug Space */
458 struct rsp rsp[0x2]; /* 0x104100 - 0x1042FF
459 RISC Special Registers
460 (Trap and Breakpoint) */
461 u8 res14[0x300]; /* 0x104300 - 0x1045FF */
462 u8 res15[0x3A00]; /* 0x104600 - 0x107FFF */
463 u8 res16[0x8000]; /* 0x108000 - 0x110000 */
464 u8 muram[0xC000]; /* 0x110000 - 0x11C000
465 Multi-user RAM */
466 u8 res17[0x24000]; /* 0x11C000 - 0x140000 */
467 u8 res18[0xC0000]; /* 0x140000 - 0x200000 */
468} __attribute__ ((packed));
469
470extern struct qe_immap __iomem *qe_immr;
471extern phys_addr_t get_qe_base(void);
472
473static inline unsigned long immrbar_virt_to_phys(void *address)
474{
475 if ( ((u32)address >= (u32)qe_immr) &&
476 ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) )
477 return (unsigned long)(address - (u32)qe_immr +
478 (u32)get_qe_base());
479 return (unsigned long)virt_to_phys(address);
480}
481
482#endif /* __KERNEL__ */
483#endif /* _ASM_POWERPC_IMMAP_QE_H */
diff --git a/arch/powerpc/include/asm/io-defs.h b/arch/powerpc/include/asm/io-defs.h
new file mode 100644
index 000000000000..44d7927aec69
--- /dev/null
+++ b/arch/powerpc/include/asm/io-defs.h
@@ -0,0 +1,60 @@
1/* This file is meant to be include multiple times by other headers */
2/* last 2 argments are used by platforms/cell/io-workarounds.[ch] */
3
4DEF_PCI_AC_RET(readb, u8, (const PCI_IO_ADDR addr), (addr), mem, addr)
5DEF_PCI_AC_RET(readw, u16, (const PCI_IO_ADDR addr), (addr), mem, addr)
6DEF_PCI_AC_RET(readl, u32, (const PCI_IO_ADDR addr), (addr), mem, addr)
7DEF_PCI_AC_RET(readw_be, u16, (const PCI_IO_ADDR addr), (addr), mem, addr)
8DEF_PCI_AC_RET(readl_be, u32, (const PCI_IO_ADDR addr), (addr), mem, addr)
9DEF_PCI_AC_NORET(writeb, (u8 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
10DEF_PCI_AC_NORET(writew, (u16 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
11DEF_PCI_AC_NORET(writel, (u32 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
12DEF_PCI_AC_NORET(writew_be, (u16 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
13DEF_PCI_AC_NORET(writel_be, (u32 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
14
15#ifdef __powerpc64__
16DEF_PCI_AC_RET(readq, u64, (const PCI_IO_ADDR addr), (addr), mem, addr)
17DEF_PCI_AC_RET(readq_be, u64, (const PCI_IO_ADDR addr), (addr), mem, addr)
18DEF_PCI_AC_NORET(writeq, (u64 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
19DEF_PCI_AC_NORET(writeq_be, (u64 val, PCI_IO_ADDR addr), (val, addr), mem, addr)
20#endif /* __powerpc64__ */
21
22DEF_PCI_AC_RET(inb, u8, (unsigned long port), (port), pio, port)
23DEF_PCI_AC_RET(inw, u16, (unsigned long port), (port), pio, port)
24DEF_PCI_AC_RET(inl, u32, (unsigned long port), (port), pio, port)
25DEF_PCI_AC_NORET(outb, (u8 val, unsigned long port), (val, port), pio, port)
26DEF_PCI_AC_NORET(outw, (u16 val, unsigned long port), (val, port), pio, port)
27DEF_PCI_AC_NORET(outl, (u32 val, unsigned long port), (val, port), pio, port)
28
29DEF_PCI_AC_NORET(readsb, (const PCI_IO_ADDR a, void *b, unsigned long c),
30 (a, b, c), mem, a)
31DEF_PCI_AC_NORET(readsw, (const PCI_IO_ADDR a, void *b, unsigned long c),
32 (a, b, c), mem, a)
33DEF_PCI_AC_NORET(readsl, (const PCI_IO_ADDR a, void *b, unsigned long c),
34 (a, b, c), mem, a)
35DEF_PCI_AC_NORET(writesb, (PCI_IO_ADDR a, const void *b, unsigned long c),
36 (a, b, c), mem, a)
37DEF_PCI_AC_NORET(writesw, (PCI_IO_ADDR a, const void *b, unsigned long c),
38 (a, b, c), mem, a)
39DEF_PCI_AC_NORET(writesl, (PCI_IO_ADDR a, const void *b, unsigned long c),
40 (a, b, c), mem, a)
41
42DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c),
43 (p, b, c), pio, p)
44DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
45 (p, b, c), pio, p)
46DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
47 (p, b, c), pio, p)
48DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
49 (p, b, c), pio, p)
50DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
51 (p, b, c), pio, p)
52DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
53 (p, b, c), pio, p)
54
55DEF_PCI_AC_NORET(memset_io, (PCI_IO_ADDR a, int c, unsigned long n),
56 (a, c, n), mem, a)
57DEF_PCI_AC_NORET(memcpy_fromio, (void *d, const PCI_IO_ADDR s, unsigned long n),
58 (d, s, n), mem, s)
59DEF_PCI_AC_NORET(memcpy_toio, (PCI_IO_ADDR d, const void *s, unsigned long n),
60 (d, s, n), mem, d)
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
new file mode 100644
index 000000000000..77c7fa025e65
--- /dev/null
+++ b/arch/powerpc/include/asm/io.h
@@ -0,0 +1,787 @@
1#ifndef _ASM_POWERPC_IO_H
2#define _ASM_POWERPC_IO_H
3#ifdef __KERNEL__
4
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/* Check of existence of legacy devices */
13extern int check_legacy_ioport(unsigned long base_port);
14#define I8042_DATA_REG 0x60
15#define FDC_BASE 0x3f0
16/* only relevant for PReP */
17#define _PIDXR 0x279
18#define _PNPWRP 0xa79
19#define PNPBIOS_BASE 0xf000
20
21#include <linux/device.h>
22#include <linux/io.h>
23
24#include <linux/compiler.h>
25#include <asm/page.h>
26#include <asm/byteorder.h>
27#include <asm/synch.h>
28#include <asm/delay.h>
29#include <asm/mmu.h>
30
31#include <asm-generic/iomap.h>
32
33#ifdef CONFIG_PPC64
34#include <asm/paca.h>
35#endif
36
37#define SIO_CONFIG_RA 0x398
38#define SIO_CONFIG_RD 0x399
39
40#define SLOW_DOWN_IO
41
42/* 32 bits uses slightly different variables for the various IO
43 * bases. Most of this file only uses _IO_BASE though which we
44 * define properly based on the platform
45 */
46#ifndef CONFIG_PCI
47#define _IO_BASE 0
48#define _ISA_MEM_BASE 0
49#define PCI_DRAM_OFFSET 0
50#elif defined(CONFIG_PPC32)
51#define _IO_BASE isa_io_base
52#define _ISA_MEM_BASE isa_mem_base
53#define PCI_DRAM_OFFSET pci_dram_offset
54#else
55#define _IO_BASE pci_io_base
56#define _ISA_MEM_BASE isa_mem_base
57#define PCI_DRAM_OFFSET 0
58#endif
59
60extern unsigned long isa_io_base;
61extern unsigned long pci_io_base;
62extern unsigned long pci_dram_offset;
63
64extern resource_size_t isa_mem_base;
65
66#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_INDIRECT_IO)
67#error CONFIG_PPC_INDIRECT_IO is not yet supported on 32 bits
68#endif
69
70/*
71 *
72 * Low level MMIO accessors
73 *
74 * This provides the non-bus specific accessors to MMIO. Those are PowerPC
75 * specific and thus shouldn't be used in generic code. The accessors
76 * provided here are:
77 *
78 * in_8, in_le16, in_be16, in_le32, in_be32, in_le64, in_be64
79 * out_8, out_le16, out_be16, out_le32, out_be32, out_le64, out_be64
80 * _insb, _insw_ns, _insl_ns, _outsb, _outsw_ns, _outsl_ns
81 *
82 * Those operate directly on a kernel virtual address. Note that the prototype
83 * for the out_* accessors has the arguments in opposite order from the usual
84 * linux PCI accessors. Unlike those, they take the address first and the value
85 * next.
86 *
87 * Note: I might drop the _ns suffix on the stream operations soon as it is
88 * simply normal for stream operations to not swap in the first place.
89 *
90 */
91
92#ifdef CONFIG_PPC64
93#define IO_SET_SYNC_FLAG() do { local_paca->io_sync = 1; } while(0)
94#else
95#define IO_SET_SYNC_FLAG()
96#endif
97
98/* gcc 4.0 and older doesn't have 'Z' constraint */
99#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0)
100#define DEF_MMIO_IN_LE(name, size, insn) \
101static inline u##size name(const volatile u##size __iomem *addr) \
102{ \
103 u##size ret; \
104 __asm__ __volatile__("sync;"#insn" %0,0,%1;twi 0,%0,0;isync" \
105 : "=r" (ret) : "r" (addr), "m" (*addr) : "memory"); \
106 return ret; \
107}
108
109#define DEF_MMIO_OUT_LE(name, size, insn) \
110static inline void name(volatile u##size __iomem *addr, u##size val) \
111{ \
112 __asm__ __volatile__("sync;"#insn" %1,0,%2" \
113 : "=m" (*addr) : "r" (val), "r" (addr) : "memory"); \
114 IO_SET_SYNC_FLAG(); \
115}
116#else /* newer gcc */
117#define DEF_MMIO_IN_LE(name, size, insn) \
118static inline u##size name(const volatile u##size __iomem *addr) \
119{ \
120 u##size ret; \
121 __asm__ __volatile__("sync;"#insn" %0,%y1;twi 0,%0,0;isync" \
122 : "=r" (ret) : "Z" (*addr) : "memory"); \
123 return ret; \
124}
125
126#define DEF_MMIO_OUT_LE(name, size, insn) \
127static inline void name(volatile u##size __iomem *addr, u##size val) \
128{ \
129 __asm__ __volatile__("sync;"#insn" %1,%y0" \
130 : "=Z" (*addr) : "r" (val) : "memory"); \
131 IO_SET_SYNC_FLAG(); \
132}
133#endif
134
135#define DEF_MMIO_IN_BE(name, size, insn) \
136static inline u##size name(const volatile u##size __iomem *addr) \
137{ \
138 u##size ret; \
139 __asm__ __volatile__("sync;"#insn"%U1%X1 %0,%1;twi 0,%0,0;isync"\
140 : "=r" (ret) : "m" (*addr) : "memory"); \
141 return ret; \
142}
143
144#define DEF_MMIO_OUT_BE(name, size, insn) \
145static inline void name(volatile u##size __iomem *addr, u##size val) \
146{ \
147 __asm__ __volatile__("sync;"#insn"%U0%X0 %1,%0" \
148 : "=m" (*addr) : "r" (val) : "memory"); \
149 IO_SET_SYNC_FLAG(); \
150}
151
152
153DEF_MMIO_IN_BE(in_8, 8, lbz);
154DEF_MMIO_IN_BE(in_be16, 16, lhz);
155DEF_MMIO_IN_BE(in_be32, 32, lwz);
156DEF_MMIO_IN_LE(in_le16, 16, lhbrx);
157DEF_MMIO_IN_LE(in_le32, 32, lwbrx);
158
159DEF_MMIO_OUT_BE(out_8, 8, stb);
160DEF_MMIO_OUT_BE(out_be16, 16, sth);
161DEF_MMIO_OUT_BE(out_be32, 32, stw);
162DEF_MMIO_OUT_LE(out_le16, 16, sthbrx);
163DEF_MMIO_OUT_LE(out_le32, 32, stwbrx);
164
165#ifdef __powerpc64__
166DEF_MMIO_OUT_BE(out_be64, 64, std);
167DEF_MMIO_IN_BE(in_be64, 64, ld);
168
169/* There is no asm instructions for 64 bits reverse loads and stores */
170static inline u64 in_le64(const volatile u64 __iomem *addr)
171{
172 return swab64(in_be64(addr));
173}
174
175static inline void out_le64(volatile u64 __iomem *addr, u64 val)
176{
177 out_be64(addr, swab64(val));
178}
179#endif /* __powerpc64__ */
180
181/*
182 * Low level IO stream instructions are defined out of line for now
183 */
184extern void _insb(const volatile u8 __iomem *addr, void *buf, long count);
185extern void _outsb(volatile u8 __iomem *addr,const void *buf,long count);
186extern void _insw_ns(const volatile u16 __iomem *addr, void *buf, long count);
187extern void _outsw_ns(volatile u16 __iomem *addr, const void *buf, long count);
188extern void _insl_ns(const volatile u32 __iomem *addr, void *buf, long count);
189extern void _outsl_ns(volatile u32 __iomem *addr, const void *buf, long count);
190
191/* The _ns naming is historical and will be removed. For now, just #define
192 * the non _ns equivalent names
193 */
194#define _insw _insw_ns
195#define _insl _insl_ns
196#define _outsw _outsw_ns
197#define _outsl _outsl_ns
198
199
200/*
201 * memset_io, memcpy_toio, memcpy_fromio base implementations are out of line
202 */
203
204extern void _memset_io(volatile void __iomem *addr, int c, unsigned long n);
205extern void _memcpy_fromio(void *dest, const volatile void __iomem *src,
206 unsigned long n);
207extern void _memcpy_toio(volatile void __iomem *dest, const void *src,
208 unsigned long n);
209
210/*
211 *
212 * PCI and standard ISA accessors
213 *
214 * Those are globally defined linux accessors for devices on PCI or ISA
215 * busses. They follow the Linux defined semantics. The current implementation
216 * for PowerPC is as close as possible to the x86 version of these, and thus
217 * provides fairly heavy weight barriers for the non-raw versions
218 *
219 * In addition, they support a hook mechanism when CONFIG_PPC_INDIRECT_IO
220 * allowing the platform to provide its own implementation of some or all
221 * of the accessors.
222 */
223
224/*
225 * Include the EEH definitions when EEH is enabled only so they don't get
226 * in the way when building for 32 bits
227 */
228#ifdef CONFIG_EEH
229#include <asm/eeh.h>
230#endif
231
232/* Shortcut to the MMIO argument pointer */
233#define PCI_IO_ADDR volatile void __iomem *
234
235/* Indirect IO address tokens:
236 *
237 * When CONFIG_PPC_INDIRECT_IO is set, the platform can provide hooks
238 * on all IOs. (Note that this is all 64 bits only for now)
239 *
240 * To help platforms who may need to differenciate MMIO addresses in
241 * their hooks, a bitfield is reserved for use by the platform near the
242 * top of MMIO addresses (not PIO, those have to cope the hard way).
243 *
244 * This bit field is 12 bits and is at the top of the IO virtual
245 * addresses PCI_IO_INDIRECT_TOKEN_MASK.
246 *
247 * The kernel virtual space is thus:
248 *
249 * 0xD000000000000000 : vmalloc
250 * 0xD000080000000000 : PCI PHB IO space
251 * 0xD000080080000000 : ioremap
252 * 0xD0000fffffffffff : end of ioremap region
253 *
254 * Since the top 4 bits are reserved as the region ID, we use thus
255 * the next 12 bits and keep 4 bits available for the future if the
256 * virtual address space is ever to be extended.
257 *
258 * The direct IO mapping operations will then mask off those bits
259 * before doing the actual access, though that only happen when
260 * CONFIG_PPC_INDIRECT_IO is set, thus be careful when you use that
261 * mechanism
262 */
263
264#ifdef CONFIG_PPC_INDIRECT_IO
265#define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul
266#define PCI_IO_IND_TOKEN_SHIFT 48
267#define PCI_FIX_ADDR(addr) \
268 ((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK))
269#define PCI_GET_ADDR_TOKEN(addr) \
270 (((unsigned long)(addr) & PCI_IO_IND_TOKEN_MASK) >> \
271 PCI_IO_IND_TOKEN_SHIFT)
272#define PCI_SET_ADDR_TOKEN(addr, token) \
273do { \
274 unsigned long __a = (unsigned long)(addr); \
275 __a &= ~PCI_IO_IND_TOKEN_MASK; \
276 __a |= ((unsigned long)(token)) << PCI_IO_IND_TOKEN_SHIFT; \
277 (addr) = (void __iomem *)__a; \
278} while(0)
279#else
280#define PCI_FIX_ADDR(addr) (addr)
281#endif
282
283
284/*
285 * Non ordered and non-swapping "raw" accessors
286 */
287
288static inline unsigned char __raw_readb(const volatile void __iomem *addr)
289{
290 return *(volatile unsigned char __force *)PCI_FIX_ADDR(addr);
291}
292static inline unsigned short __raw_readw(const volatile void __iomem *addr)
293{
294 return *(volatile unsigned short __force *)PCI_FIX_ADDR(addr);
295}
296static inline unsigned int __raw_readl(const volatile void __iomem *addr)
297{
298 return *(volatile unsigned int __force *)PCI_FIX_ADDR(addr);
299}
300static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
301{
302 *(volatile unsigned char __force *)PCI_FIX_ADDR(addr) = v;
303}
304static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)
305{
306 *(volatile unsigned short __force *)PCI_FIX_ADDR(addr) = v;
307}
308static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
309{
310 *(volatile unsigned int __force *)PCI_FIX_ADDR(addr) = v;
311}
312
313#ifdef __powerpc64__
314static inline unsigned long __raw_readq(const volatile void __iomem *addr)
315{
316 return *(volatile unsigned long __force *)PCI_FIX_ADDR(addr);
317}
318static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
319{
320 *(volatile unsigned long __force *)PCI_FIX_ADDR(addr) = v;
321}
322#endif /* __powerpc64__ */
323
324/*
325 *
326 * PCI PIO and MMIO accessors.
327 *
328 *
329 * On 32 bits, PIO operations have a recovery mechanism in case they trigger
330 * machine checks (which they occasionally do when probing non existing
331 * IO ports on some platforms, like PowerMac and 8xx).
332 * I always found it to be of dubious reliability and I am tempted to get
333 * rid of it one of these days. So if you think it's important to keep it,
334 * please voice up asap. We never had it for 64 bits and I do not intend
335 * to port it over
336 */
337
338#ifdef CONFIG_PPC32
339
340#define __do_in_asm(name, op) \
341static inline unsigned int name(unsigned int port) \
342{ \
343 unsigned int x; \
344 __asm__ __volatile__( \
345 "sync\n" \
346 "0:" op " %0,0,%1\n" \
347 "1: twi 0,%0,0\n" \
348 "2: isync\n" \
349 "3: nop\n" \
350 "4:\n" \
351 ".section .fixup,\"ax\"\n" \
352 "5: li %0,-1\n" \
353 " b 4b\n" \
354 ".previous\n" \
355 ".section __ex_table,\"a\"\n" \
356 " .align 2\n" \
357 " .long 0b,5b\n" \
358 " .long 1b,5b\n" \
359 " .long 2b,5b\n" \
360 " .long 3b,5b\n" \
361 ".previous" \
362 : "=&r" (x) \
363 : "r" (port + _IO_BASE) \
364 : "memory"); \
365 return x; \
366}
367
368#define __do_out_asm(name, op) \
369static inline void name(unsigned int val, unsigned int port) \
370{ \
371 __asm__ __volatile__( \
372 "sync\n" \
373 "0:" op " %0,0,%1\n" \
374 "1: sync\n" \
375 "2:\n" \
376 ".section __ex_table,\"a\"\n" \
377 " .align 2\n" \
378 " .long 0b,2b\n" \
379 " .long 1b,2b\n" \
380 ".previous" \
381 : : "r" (val), "r" (port + _IO_BASE) \
382 : "memory"); \
383}
384
385__do_in_asm(_rec_inb, "lbzx")
386__do_in_asm(_rec_inw, "lhbrx")
387__do_in_asm(_rec_inl, "lwbrx")
388__do_out_asm(_rec_outb, "stbx")
389__do_out_asm(_rec_outw, "sthbrx")
390__do_out_asm(_rec_outl, "stwbrx")
391
392#endif /* CONFIG_PPC32 */
393
394/* The "__do_*" operations below provide the actual "base" implementation
395 * for each of the defined acccessor. Some of them use the out_* functions
396 * directly, some of them still use EEH, though we might change that in the
397 * future. Those macros below provide the necessary argument swapping and
398 * handling of the IO base for PIO.
399 *
400 * They are themselves used by the macros that define the actual accessors
401 * and can be used by the hooks if any.
402 *
403 * Note that PIO operations are always defined in terms of their corresonding
404 * MMIO operations. That allows platforms like iSeries who want to modify the
405 * behaviour of both to only hook on the MMIO version and get both. It's also
406 * possible to hook directly at the toplevel PIO operation if they have to
407 * be handled differently
408 */
409#define __do_writeb(val, addr) out_8(PCI_FIX_ADDR(addr), val)
410#define __do_writew(val, addr) out_le16(PCI_FIX_ADDR(addr), val)
411#define __do_writel(val, addr) out_le32(PCI_FIX_ADDR(addr), val)
412#define __do_writeq(val, addr) out_le64(PCI_FIX_ADDR(addr), val)
413#define __do_writew_be(val, addr) out_be16(PCI_FIX_ADDR(addr), val)
414#define __do_writel_be(val, addr) out_be32(PCI_FIX_ADDR(addr), val)
415#define __do_writeq_be(val, addr) out_be64(PCI_FIX_ADDR(addr), val)
416
417#ifdef CONFIG_EEH
418#define __do_readb(addr) eeh_readb(PCI_FIX_ADDR(addr))
419#define __do_readw(addr) eeh_readw(PCI_FIX_ADDR(addr))
420#define __do_readl(addr) eeh_readl(PCI_FIX_ADDR(addr))
421#define __do_readq(addr) eeh_readq(PCI_FIX_ADDR(addr))
422#define __do_readw_be(addr) eeh_readw_be(PCI_FIX_ADDR(addr))
423#define __do_readl_be(addr) eeh_readl_be(PCI_FIX_ADDR(addr))
424#define __do_readq_be(addr) eeh_readq_be(PCI_FIX_ADDR(addr))
425#else /* CONFIG_EEH */
426#define __do_readb(addr) in_8(PCI_FIX_ADDR(addr))
427#define __do_readw(addr) in_le16(PCI_FIX_ADDR(addr))
428#define __do_readl(addr) in_le32(PCI_FIX_ADDR(addr))
429#define __do_readq(addr) in_le64(PCI_FIX_ADDR(addr))
430#define __do_readw_be(addr) in_be16(PCI_FIX_ADDR(addr))
431#define __do_readl_be(addr) in_be32(PCI_FIX_ADDR(addr))
432#define __do_readq_be(addr) in_be64(PCI_FIX_ADDR(addr))
433#endif /* !defined(CONFIG_EEH) */
434
435#ifdef CONFIG_PPC32
436#define __do_outb(val, port) _rec_outb(val, port)
437#define __do_outw(val, port) _rec_outw(val, port)
438#define __do_outl(val, port) _rec_outl(val, port)
439#define __do_inb(port) _rec_inb(port)
440#define __do_inw(port) _rec_inw(port)
441#define __do_inl(port) _rec_inl(port)
442#else /* CONFIG_PPC32 */
443#define __do_outb(val, port) writeb(val,(PCI_IO_ADDR)_IO_BASE+port);
444#define __do_outw(val, port) writew(val,(PCI_IO_ADDR)_IO_BASE+port);
445#define __do_outl(val, port) writel(val,(PCI_IO_ADDR)_IO_BASE+port);
446#define __do_inb(port) readb((PCI_IO_ADDR)_IO_BASE + port);
447#define __do_inw(port) readw((PCI_IO_ADDR)_IO_BASE + port);
448#define __do_inl(port) readl((PCI_IO_ADDR)_IO_BASE + port);
449#endif /* !CONFIG_PPC32 */
450
451#ifdef CONFIG_EEH
452#define __do_readsb(a, b, n) eeh_readsb(PCI_FIX_ADDR(a), (b), (n))
453#define __do_readsw(a, b, n) eeh_readsw(PCI_FIX_ADDR(a), (b), (n))
454#define __do_readsl(a, b, n) eeh_readsl(PCI_FIX_ADDR(a), (b), (n))
455#else /* CONFIG_EEH */
456#define __do_readsb(a, b, n) _insb(PCI_FIX_ADDR(a), (b), (n))
457#define __do_readsw(a, b, n) _insw(PCI_FIX_ADDR(a), (b), (n))
458#define __do_readsl(a, b, n) _insl(PCI_FIX_ADDR(a), (b), (n))
459#endif /* !CONFIG_EEH */
460#define __do_writesb(a, b, n) _outsb(PCI_FIX_ADDR(a),(b),(n))
461#define __do_writesw(a, b, n) _outsw(PCI_FIX_ADDR(a),(b),(n))
462#define __do_writesl(a, b, n) _outsl(PCI_FIX_ADDR(a),(b),(n))
463
464#define __do_insb(p, b, n) readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
465#define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
466#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
467#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
468#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
469#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
470
471#define __do_memset_io(addr, c, n) \
472 _memset_io(PCI_FIX_ADDR(addr), c, n)
473#define __do_memcpy_toio(dst, src, n) \
474 _memcpy_toio(PCI_FIX_ADDR(dst), src, n)
475
476#ifdef CONFIG_EEH
477#define __do_memcpy_fromio(dst, src, n) \
478 eeh_memcpy_fromio(dst, PCI_FIX_ADDR(src), n)
479#else /* CONFIG_EEH */
480#define __do_memcpy_fromio(dst, src, n) \
481 _memcpy_fromio(dst,PCI_FIX_ADDR(src),n)
482#endif /* !CONFIG_EEH */
483
484#ifdef CONFIG_PPC_INDIRECT_IO
485#define DEF_PCI_HOOK(x) x
486#else
487#define DEF_PCI_HOOK(x) NULL
488#endif
489
490/* Structure containing all the hooks */
491extern struct ppc_pci_io {
492
493#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) ret (*name) at;
494#define DEF_PCI_AC_NORET(name, at, al, space, aa) void (*name) at;
495
496#include <asm/io-defs.h>
497
498#undef DEF_PCI_AC_RET
499#undef DEF_PCI_AC_NORET
500
501} ppc_pci_io;
502
503/* The inline wrappers */
504#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) \
505static inline ret name at \
506{ \
507 if (DEF_PCI_HOOK(ppc_pci_io.name) != NULL) \
508 return ppc_pci_io.name al; \
509 return __do_##name al; \
510}
511
512#define DEF_PCI_AC_NORET(name, at, al, space, aa) \
513static inline void name at \
514{ \
515 if (DEF_PCI_HOOK(ppc_pci_io.name) != NULL) \
516 ppc_pci_io.name al; \
517 else \
518 __do_##name al; \
519}
520
521#include <asm/io-defs.h>
522
523#undef DEF_PCI_AC_RET
524#undef DEF_PCI_AC_NORET
525
526/* Some drivers check for the presence of readq & writeq with
527 * a #ifdef, so we make them happy here.
528 */
529#ifdef __powerpc64__
530#define readq readq
531#define writeq writeq
532#endif
533
534/*
535 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
536 * access
537 */
538#define xlate_dev_mem_ptr(p) __va(p)
539
540/*
541 * Convert a virtual cached pointer to an uncached pointer
542 */
543#define xlate_dev_kmem_ptr(p) p
544
545/*
546 * We don't do relaxed operations yet, at least not with this semantic
547 */
548#define readb_relaxed(addr) readb(addr)
549#define readw_relaxed(addr) readw(addr)
550#define readl_relaxed(addr) readl(addr)
551#define readq_relaxed(addr) readq(addr)
552
553#ifdef CONFIG_PPC32
554#define mmiowb()
555#else
556/*
557 * Enforce synchronisation of stores vs. spin_unlock
558 * (this does it explicitly, though our implementation of spin_unlock
559 * does it implicitely too)
560 */
561static inline void mmiowb(void)
562{
563 unsigned long tmp;
564
565 __asm__ __volatile__("sync; li %0,0; stb %0,%1(13)"
566 : "=&r" (tmp) : "i" (offsetof(struct paca_struct, io_sync))
567 : "memory");
568}
569#endif /* !CONFIG_PPC32 */
570
571static inline void iosync(void)
572{
573 __asm__ __volatile__ ("sync" : : : "memory");
574}
575
576/* Enforce in-order execution of data I/O.
577 * No distinction between read/write on PPC; use eieio for all three.
578 * Those are fairly week though. They don't provide a barrier between
579 * MMIO and cacheable storage nor do they provide a barrier vs. locks,
580 * they only provide barriers between 2 __raw MMIO operations and
581 * possibly break write combining.
582 */
583#define iobarrier_rw() eieio()
584#define iobarrier_r() eieio()
585#define iobarrier_w() eieio()
586
587
588/*
589 * output pause versions need a delay at least for the
590 * w83c105 ide controller in a p610.
591 */
592#define inb_p(port) inb(port)
593#define outb_p(val, port) (udelay(1), outb((val), (port)))
594#define inw_p(port) inw(port)
595#define outw_p(val, port) (udelay(1), outw((val), (port)))
596#define inl_p(port) inl(port)
597#define outl_p(val, port) (udelay(1), outl((val), (port)))
598
599
600#define IO_SPACE_LIMIT ~(0UL)
601
602
603/**
604 * ioremap - map bus memory into CPU space
605 * @address: bus address of the memory
606 * @size: size of the resource to map
607 *
608 * ioremap performs a platform specific sequence of operations to
609 * make bus memory CPU accessible via the readb/readw/readl/writeb/
610 * writew/writel functions and the other mmio helpers. The returned
611 * address is not guaranteed to be usable directly as a virtual
612 * address.
613 *
614 * We provide a few variations of it:
615 *
616 * * ioremap is the standard one and provides non-cacheable guarded mappings
617 * and can be hooked by the platform via ppc_md
618 *
619 * * ioremap_flags allows to specify the page flags as an argument and can
620 * also be hooked by the platform via ppc_md. ioremap_prot is the exact
621 * same thing as ioremap_flags.
622 *
623 * * ioremap_nocache is identical to ioremap
624 *
625 * * iounmap undoes such a mapping and can be hooked
626 *
627 * * __ioremap_at (and the pending __iounmap_at) are low level functions to
628 * create hand-made mappings for use only by the PCI code and cannot
629 * currently be hooked. Must be page aligned.
630 *
631 * * __ioremap is the low level implementation used by ioremap and
632 * ioremap_flags and cannot be hooked (but can be used by a hook on one
633 * of the previous ones)
634 *
635 * * __iounmap, is the low level implementation used by iounmap and cannot
636 * be hooked (but can be used by a hook on iounmap)
637 *
638 */
639extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
640extern void __iomem *ioremap_flags(phys_addr_t address, unsigned long size,
641 unsigned long flags);
642#define ioremap_nocache(addr, size) ioremap((addr), (size))
643#define ioremap_prot(addr, size, prot) ioremap_flags((addr), (size), (prot))
644
645extern void iounmap(volatile void __iomem *addr);
646
647extern void __iomem *__ioremap(phys_addr_t, unsigned long size,
648 unsigned long flags);
649extern void __iounmap(volatile void __iomem *addr);
650
651extern void __iomem * __ioremap_at(phys_addr_t pa, void *ea,
652 unsigned long size, unsigned long flags);
653extern void __iounmap_at(void *ea, unsigned long size);
654
655/*
656 * When CONFIG_PPC_INDIRECT_IO is set, we use the generic iomap implementation
657 * which needs some additional definitions here. They basically allow PIO
658 * space overall to be 1GB. This will work as long as we never try to use
659 * iomap to map MMIO below 1GB which should be fine on ppc64
660 */
661#define HAVE_ARCH_PIO_SIZE 1
662#define PIO_OFFSET 0x00000000UL
663#define PIO_MASK (FULL_IO_SIZE - 1)
664#define PIO_RESERVED (FULL_IO_SIZE)
665
666#define mmio_read16be(addr) readw_be(addr)
667#define mmio_read32be(addr) readl_be(addr)
668#define mmio_write16be(val, addr) writew_be(val, addr)
669#define mmio_write32be(val, addr) writel_be(val, addr)
670#define mmio_insb(addr, dst, count) readsb(addr, dst, count)
671#define mmio_insw(addr, dst, count) readsw(addr, dst, count)
672#define mmio_insl(addr, dst, count) readsl(addr, dst, count)
673#define mmio_outsb(addr, src, count) writesb(addr, src, count)
674#define mmio_outsw(addr, src, count) writesw(addr, src, count)
675#define mmio_outsl(addr, src, count) writesl(addr, src, count)
676
677/**
678 * virt_to_phys - map virtual addresses to physical
679 * @address: address to remap
680 *
681 * The returned physical address is the physical (CPU) mapping for
682 * the memory address given. It is only valid to use this function on
683 * addresses directly mapped or allocated via kmalloc.
684 *
685 * This function does not give bus mappings for DMA transfers. In
686 * almost all conceivable cases a device driver should not be using
687 * this function
688 */
689static inline unsigned long virt_to_phys(volatile void * address)
690{
691 return __pa((unsigned long)address);
692}
693
694/**
695 * phys_to_virt - map physical address to virtual
696 * @address: address to remap
697 *
698 * The returned virtual address is a current CPU mapping for
699 * the memory address given. It is only valid to use this function on
700 * addresses that have a kernel mapping
701 *
702 * This function does not handle bus mappings for DMA transfers. In
703 * almost all conceivable cases a device driver should not be using
704 * this function
705 */
706static inline void * phys_to_virt(unsigned long address)
707{
708 return (void *)__va(address);
709}
710
711/*
712 * Change "struct page" to physical address.
713 */
714#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
715
716/* We do NOT want virtual merging, it would put too much pressure on
717 * our iommu allocator. Instead, we want drivers to be smart enough
718 * to coalesce sglists that happen to have been mapped in a contiguous
719 * way by the iommu
720 */
721#define BIO_VMERGE_BOUNDARY 0
722
723/*
724 * 32 bits still uses virt_to_bus() for it's implementation of DMA
725 * mappings se we have to keep it defined here. We also have some old
726 * drivers (shame shame shame) that use bus_to_virt() and haven't been
727 * fixed yet so I need to define it here.
728 */
729#ifdef CONFIG_PPC32
730
731static inline unsigned long virt_to_bus(volatile void * address)
732{
733 if (address == NULL)
734 return 0;
735 return __pa(address) + PCI_DRAM_OFFSET;
736}
737
738static inline void * bus_to_virt(unsigned long address)
739{
740 if (address == 0)
741 return NULL;
742 return __va(address - PCI_DRAM_OFFSET);
743}
744
745#define page_to_bus(page) (page_to_phys(page) + PCI_DRAM_OFFSET)
746
747#endif /* CONFIG_PPC32 */
748
749/* access ports */
750#define setbits32(_addr, _v) out_be32((_addr), in_be32(_addr) | (_v))
751#define clrbits32(_addr, _v) out_be32((_addr), in_be32(_addr) & ~(_v))
752
753#define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) | (_v))
754#define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v))
755
756#define setbits8(_addr, _v) out_8((_addr), in_8(_addr) | (_v))
757#define clrbits8(_addr, _v) out_8((_addr), in_8(_addr) & ~(_v))
758
759/* Clear and set bits in one shot. These macros can be used to clear and
760 * set multiple bits in a register using a single read-modify-write. These
761 * macros can also be used to set a multiple-bit bit pattern using a mask,
762 * by specifying the mask in the 'clear' parameter and the new bit pattern
763 * in the 'set' parameter.
764 */
765
766#define clrsetbits(type, addr, clear, set) \
767 out_##type((addr), (in_##type(addr) & ~(clear)) | (set))
768
769#ifdef __powerpc64__
770#define clrsetbits_be64(addr, clear, set) clrsetbits(be64, addr, clear, set)
771#define clrsetbits_le64(addr, clear, set) clrsetbits(le64, addr, clear, set)
772#endif
773
774#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set)
775#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set)
776
777#define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set)
778#define clrsetbits_le16(addr, clear, set) clrsetbits(le16, addr, clear, set)
779
780#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
781
782void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
783 size_t size, unsigned long flags);
784
785#endif /* __KERNEL__ */
786
787#endif /* _ASM_POWERPC_IO_H */
diff --git a/arch/powerpc/include/asm/ioctl.h b/arch/powerpc/include/asm/ioctl.h
new file mode 100644
index 000000000000..57d68304218b
--- /dev/null
+++ b/arch/powerpc/include/asm/ioctl.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_POWERPC_IOCTL_H
2#define _ASM_POWERPC_IOCTL_H
3
4#define _IOC_SIZEBITS 13
5#define _IOC_DIRBITS 3
6
7#define _IOC_NONE 1U
8#define _IOC_READ 2U
9#define _IOC_WRITE 4U
10
11#include <asm-generic/ioctl.h>
12
13#endif /* _ASM_POWERPC_IOCTL_H */
diff --git a/arch/powerpc/include/asm/ioctls.h b/arch/powerpc/include/asm/ioctls.h
new file mode 100644
index 000000000000..279a6229584b
--- /dev/null
+++ b/arch/powerpc/include/asm/ioctls.h
@@ -0,0 +1,110 @@
1#ifndef _ASM_POWERPC_IOCTLS_H
2#define _ASM_POWERPC_IOCTLS_H
3
4#include <asm/ioctl.h>
5
6#define FIOCLEX _IO('f', 1)
7#define FIONCLEX _IO('f', 2)
8#define FIOASYNC _IOW('f', 125, int)
9#define FIONBIO _IOW('f', 126, int)
10#define FIONREAD _IOR('f', 127, int)
11#define TIOCINQ FIONREAD
12#define FIOQSIZE _IOR('f', 128, loff_t)
13
14#define TIOCGETP _IOR('t', 8, struct sgttyb)
15#define TIOCSETP _IOW('t', 9, struct sgttyb)
16#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */
17
18#define TIOCSETC _IOW('t', 17, struct tchars)
19#define TIOCGETC _IOR('t', 18, struct tchars)
20#define TCGETS _IOR('t', 19, struct termios)
21#define TCSETS _IOW('t', 20, struct termios)
22#define TCSETSW _IOW('t', 21, struct termios)
23#define TCSETSF _IOW('t', 22, struct termios)
24
25#define TCGETA _IOR('t', 23, struct termio)
26#define TCSETA _IOW('t', 24, struct termio)
27#define TCSETAW _IOW('t', 25, struct termio)
28#define TCSETAF _IOW('t', 28, struct termio)
29
30#define TCSBRK _IO('t', 29)
31#define TCXONC _IO('t', 30)
32#define TCFLSH _IO('t', 31)
33
34#define TIOCSWINSZ _IOW('t', 103, struct winsize)
35#define TIOCGWINSZ _IOR('t', 104, struct winsize)
36#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
37#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
38#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
39
40#define TIOCGLTC _IOR('t', 116, struct ltchars)
41#define TIOCSLTC _IOW('t', 117, struct ltchars)
42#define TIOCSPGRP _IOW('t', 118, int)
43#define TIOCGPGRP _IOR('t', 119, int)
44
45#define TIOCEXCL 0x540C
46#define TIOCNXCL 0x540D
47#define TIOCSCTTY 0x540E
48
49#define TIOCSTI 0x5412
50#define TIOCMGET 0x5415
51#define TIOCMBIS 0x5416
52#define TIOCMBIC 0x5417
53#define TIOCMSET 0x5418
54# define TIOCM_LE 0x001
55# define TIOCM_DTR 0x002
56# define TIOCM_RTS 0x004
57# define TIOCM_ST 0x008
58# define TIOCM_SR 0x010
59# define TIOCM_CTS 0x020
60# define TIOCM_CAR 0x040
61# define TIOCM_RNG 0x080
62# define TIOCM_DSR 0x100
63# define TIOCM_CD TIOCM_CAR
64# define TIOCM_RI TIOCM_RNG
65#define TIOCM_OUT1 0x2000
66#define TIOCM_OUT2 0x4000
67#define TIOCM_LOOP 0x8000
68
69#define TIOCGSOFTCAR 0x5419
70#define TIOCSSOFTCAR 0x541A
71#define TIOCLINUX 0x541C
72#define TIOCCONS 0x541D
73#define TIOCGSERIAL 0x541E
74#define TIOCSSERIAL 0x541F
75#define TIOCPKT 0x5420
76# define TIOCPKT_DATA 0
77# define TIOCPKT_FLUSHREAD 1
78# define TIOCPKT_FLUSHWRITE 2
79# define TIOCPKT_STOP 4
80# define TIOCPKT_START 8
81# define TIOCPKT_NOSTOP 16
82# define TIOCPKT_DOSTOP 32
83
84
85#define TIOCNOTTY 0x5422
86#define TIOCSETD 0x5423
87#define TIOCGETD 0x5424
88#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
89#define TIOCSBRK 0x5427 /* BSD compatibility */
90#define TIOCCBRK 0x5428 /* BSD compatibility */
91#define TIOCGSID 0x5429 /* Return the session ID of FD */
92#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
93#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
94
95#define TIOCSERCONFIG 0x5453
96#define TIOCSERGWILD 0x5454
97#define TIOCSERSWILD 0x5455
98#define TIOCGLCKTRMIOS 0x5456
99#define TIOCSLCKTRMIOS 0x5457
100#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
101#define TIOCSERGETLSR 0x5459 /* Get line status register */
102 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
103# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
104#define TIOCSERGETMULTI 0x545A /* Get multiport config */
105#define TIOCSERSETMULTI 0x545B /* Set multiport config */
106
107#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
108#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
109
110#endif /* _ASM_POWERPC_IOCTLS_H */
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
new file mode 100644
index 000000000000..51ecfef8d843
--- /dev/null
+++ b/arch/powerpc/include/asm/iommu.h
@@ -0,0 +1,131 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
3 * Rewrite, cleanup:
4 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
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
21#ifndef _ASM_IOMMU_H
22#define _ASM_IOMMU_H
23#ifdef __KERNEL__
24
25#include <linux/compiler.h>
26#include <linux/spinlock.h>
27#include <linux/device.h>
28#include <linux/dma-mapping.h>
29#include <linux/bitops.h>
30#include <asm/machdep.h>
31#include <asm/types.h>
32
33#define IOMMU_PAGE_SHIFT 12
34#define IOMMU_PAGE_SIZE (ASM_CONST(1) << IOMMU_PAGE_SHIFT)
35#define IOMMU_PAGE_MASK (~((1 << IOMMU_PAGE_SHIFT) - 1))
36#define IOMMU_PAGE_ALIGN(addr) _ALIGN_UP(addr, IOMMU_PAGE_SIZE)
37
38/* Boot time flags */
39extern int iommu_is_off;
40extern int iommu_force_on;
41
42/* Pure 2^n version of get_order */
43static __inline__ __attribute_const__ int get_iommu_order(unsigned long size)
44{
45 return __ilog2((size - 1) >> IOMMU_PAGE_SHIFT) + 1;
46}
47
48
49/*
50 * IOMAP_MAX_ORDER defines the largest contiguous block
51 * of dma space we can get. IOMAP_MAX_ORDER = 13
52 * allows up to 2**12 pages (4096 * 4096) = 16 MB
53 */
54#define IOMAP_MAX_ORDER 13
55
56struct iommu_table {
57 unsigned long it_busno; /* Bus number this table belongs to */
58 unsigned long it_size; /* Size of iommu table in entries */
59 unsigned long it_offset; /* Offset into global table */
60 unsigned long it_base; /* mapped address of tce table */
61 unsigned long it_index; /* which iommu table this is */
62 unsigned long it_type; /* type: PCI or Virtual Bus */
63 unsigned long it_blocksize; /* Entries in each block (cacheline) */
64 unsigned long it_hint; /* Hint for next alloc */
65 unsigned long it_largehint; /* Hint for large allocs */
66 unsigned long it_halfpoint; /* Breaking point for small/large allocs */
67 spinlock_t it_lock; /* Protects it_map */
68 unsigned long *it_map; /* A simple allocation bitmap for now */
69};
70
71struct scatterlist;
72
73/* Frees table for an individual device node */
74extern void iommu_free_table(struct iommu_table *tbl, const char *node_name);
75
76/* Initializes an iommu_table based in values set in the passed-in
77 * structure
78 */
79extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
80 int nid);
81
82extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
83 struct scatterlist *sglist, int nelems,
84 unsigned long mask, enum dma_data_direction direction,
85 struct dma_attrs *attrs);
86extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
87 int nelems, enum dma_data_direction direction,
88 struct dma_attrs *attrs);
89
90extern void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
91 size_t size, dma_addr_t *dma_handle,
92 unsigned long mask, gfp_t flag, int node);
93extern void iommu_free_coherent(struct iommu_table *tbl, size_t size,
94 void *vaddr, dma_addr_t dma_handle);
95extern dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
96 void *vaddr, size_t size, unsigned long mask,
97 enum dma_data_direction direction,
98 struct dma_attrs *attrs);
99extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
100 size_t size, enum dma_data_direction direction,
101 struct dma_attrs *attrs);
102
103extern void iommu_init_early_pSeries(void);
104extern void iommu_init_early_iSeries(void);
105extern void iommu_init_early_dart(void);
106extern void iommu_init_early_pasemi(void);
107
108#ifdef CONFIG_PCI
109extern void pci_iommu_init(void);
110extern void pci_direct_iommu_init(void);
111#else
112static inline void pci_iommu_init(void) { }
113#endif
114
115extern void alloc_dart_table(void);
116#if defined(CONFIG_PPC64) && defined(CONFIG_PM)
117static inline void iommu_save(void)
118{
119 if (ppc_md.iommu_save)
120 ppc_md.iommu_save();
121}
122
123static inline void iommu_restore(void)
124{
125 if (ppc_md.iommu_restore)
126 ppc_md.iommu_restore();
127}
128#endif
129
130#endif /* __KERNEL__ */
131#endif /* _ASM_IOMMU_H */
diff --git a/arch/powerpc/include/asm/ipcbuf.h b/arch/powerpc/include/asm/ipcbuf.h
new file mode 100644
index 000000000000..2c3e1d94db1d
--- /dev/null
+++ b/arch/powerpc/include/asm/ipcbuf.h
@@ -0,0 +1,34 @@
1#ifndef _ASM_POWERPC_IPCBUF_H
2#define _ASM_POWERPC_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for the powerpc is identical to
6 * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the
7 * kernel. Note extra padding because this structure is passed back
8 * and forth between kernel and user space. Pad space is left for:
9 * - 1 32-bit value to fill up for 8-byte alignment
10 * - 2 miscellaneous 64-bit values
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/types.h>
19
20struct ipc64_perm
21{
22 __kernel_key_t key;
23 __kernel_uid_t uid;
24 __kernel_gid_t gid;
25 __kernel_uid_t cuid;
26 __kernel_gid_t cgid;
27 __kernel_mode_t mode;
28 unsigned int seq;
29 unsigned int __pad1;
30 unsigned long long __unused1;
31 unsigned long long __unused2;
32};
33
34#endif /* _ASM_POWERPC_IPCBUF_H */
diff --git a/arch/powerpc/include/asm/ipic.h b/arch/powerpc/include/asm/ipic.h
new file mode 100644
index 000000000000..fb59829983b8
--- /dev/null
+++ b/arch/powerpc/include/asm/ipic.h
@@ -0,0 +1,84 @@
1/*
2 * IPIC external definitions and structure.
3 *
4 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
5 *
6 * Copyright 2005 Freescale Semiconductor, Inc
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#ifdef __KERNEL__
14#ifndef __ASM_IPIC_H__
15#define __ASM_IPIC_H__
16
17#include <linux/irq.h>
18
19/* Flags when we init the IPIC */
20#define IPIC_SPREADMODE_GRP_A 0x00000001
21#define IPIC_SPREADMODE_GRP_B 0x00000002
22#define IPIC_SPREADMODE_GRP_C 0x00000004
23#define IPIC_SPREADMODE_GRP_D 0x00000008
24#define IPIC_SPREADMODE_MIX_A 0x00000010
25#define IPIC_SPREADMODE_MIX_B 0x00000020
26#define IPIC_DISABLE_MCP_OUT 0x00000040
27#define IPIC_IRQ0_MCP 0x00000080
28
29/* IPIC registers offsets */
30#define IPIC_SICFR 0x00 /* System Global Interrupt Configuration Register */
31#define IPIC_SIVCR 0x04 /* System Global Interrupt Vector Register */
32#define IPIC_SIPNR_H 0x08 /* System Internal Interrupt Pending Register (HIGH) */
33#define IPIC_SIPNR_L 0x0C /* System Internal Interrupt Pending Register (LOW) */
34#define IPIC_SIPRR_A 0x10 /* System Internal Interrupt group A Priority Register */
35#define IPIC_SIPRR_B 0x14 /* System Internal Interrupt group B Priority Register */
36#define IPIC_SIPRR_C 0x18 /* System Internal Interrupt group C Priority Register */
37#define IPIC_SIPRR_D 0x1C /* System Internal Interrupt group D Priority Register */
38#define IPIC_SIMSR_H 0x20 /* System Internal Interrupt Mask Register (HIGH) */
39#define IPIC_SIMSR_L 0x24 /* System Internal Interrupt Mask Register (LOW) */
40#define IPIC_SICNR 0x28 /* System Internal Interrupt Control Register */
41#define IPIC_SEPNR 0x2C /* System External Interrupt Pending Register */
42#define IPIC_SMPRR_A 0x30 /* System Mixed Interrupt group A Priority Register */
43#define IPIC_SMPRR_B 0x34 /* System Mixed Interrupt group B Priority Register */
44#define IPIC_SEMSR 0x38 /* System External Interrupt Mask Register */
45#define IPIC_SECNR 0x3C /* System External Interrupt Control Register */
46#define IPIC_SERSR 0x40 /* System Error Status Register */
47#define IPIC_SERMR 0x44 /* System Error Mask Register */
48#define IPIC_SERCR 0x48 /* System Error Control Register */
49#define IPIC_SIFCR_H 0x50 /* System Internal Interrupt Force Register (HIGH) */
50#define IPIC_SIFCR_L 0x54 /* System Internal Interrupt Force Register (LOW) */
51#define IPIC_SEFCR 0x58 /* System External Interrupt Force Register */
52#define IPIC_SERFR 0x5C /* System Error Force Register */
53#define IPIC_SCVCR 0x60 /* System Critical Interrupt Vector Register */
54#define IPIC_SMVCR 0x64 /* System Management Interrupt Vector Register */
55
56enum ipic_prio_grp {
57 IPIC_INT_GRP_A = IPIC_SIPRR_A,
58 IPIC_INT_GRP_D = IPIC_SIPRR_D,
59 IPIC_MIX_GRP_A = IPIC_SMPRR_A,
60 IPIC_MIX_GRP_B = IPIC_SMPRR_B,
61};
62
63enum ipic_mcp_irq {
64 IPIC_MCP_IRQ0 = 0,
65 IPIC_MCP_WDT = 1,
66 IPIC_MCP_SBA = 2,
67 IPIC_MCP_PCI1 = 5,
68 IPIC_MCP_PCI2 = 6,
69 IPIC_MCP_MU = 7,
70};
71
72extern int ipic_set_priority(unsigned int irq, unsigned int priority);
73extern void ipic_set_highest_priority(unsigned int irq);
74extern void ipic_set_default_priority(void);
75extern void ipic_enable_mcp(enum ipic_mcp_irq mcp_irq);
76extern void ipic_disable_mcp(enum ipic_mcp_irq mcp_irq);
77extern u32 ipic_get_mcp_status(void);
78extern void ipic_clear_mcp_status(u32 mask);
79
80extern struct ipic * ipic_init(struct device_node *node, unsigned int flags);
81extern unsigned int ipic_get_irq(void);
82
83#endif /* __ASM_IPIC_H__ */
84#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
new file mode 100644
index 000000000000..a372f76836c2
--- /dev/null
+++ b/arch/powerpc/include/asm/irq.h
@@ -0,0 +1,366 @@
1#ifdef __KERNEL__
2#ifndef _ASM_POWERPC_IRQ_H
3#define _ASM_POWERPC_IRQ_H
4
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 <linux/list.h>
14#include <linux/radix-tree.h>
15
16#include <asm/types.h>
17#include <asm/atomic.h>
18
19
20#define get_irq_desc(irq) (&irq_desc[(irq)])
21
22/* Define a way to iterate across irqs. */
23#define for_each_irq(i) \
24 for ((i) = 0; (i) < NR_IRQS; ++(i))
25
26extern atomic_t ppc_n_lost_interrupts;
27
28/* This number is used when no interrupt has been assigned */
29#define NO_IRQ (0)
30
31/* This is a special irq number to return from get_irq() to tell that
32 * no interrupt happened _and_ ignore it (don't count it as bad). Some
33 * platforms like iSeries rely on that.
34 */
35#define NO_IRQ_IGNORE ((unsigned int)-1)
36
37/* Total number of virq in the platform (make it a CONFIG_* option ? */
38#define NR_IRQS 512
39
40/* Number of irqs reserved for the legacy controller */
41#define NUM_ISA_INTERRUPTS 16
42
43/* This type is the placeholder for a hardware interrupt number. It has to
44 * be big enough to enclose whatever representation is used by a given
45 * platform.
46 */
47typedef unsigned long irq_hw_number_t;
48
49/* Interrupt controller "host" data structure. This could be defined as a
50 * irq domain controller. That is, it handles the mapping between hardware
51 * and virtual interrupt numbers for a given interrupt domain. The host
52 * structure is generally created by the PIC code for a given PIC instance
53 * (though a host can cover more than one PIC if they have a flat number
54 * model). It's the host callbacks that are responsible for setting the
55 * irq_chip on a given irq_desc after it's been mapped.
56 *
57 * The host code and data structures are fairly agnostic to the fact that
58 * we use an open firmware device-tree. We do have references to struct
59 * device_node in two places: in irq_find_host() to find the host matching
60 * a given interrupt controller node, and of course as an argument to its
61 * counterpart host->ops->match() callback. However, those are treated as
62 * generic pointers by the core and the fact that it's actually a device-node
63 * pointer is purely a convention between callers and implementation. This
64 * code could thus be used on other architectures by replacing those two
65 * by some sort of arch-specific void * "token" used to identify interrupt
66 * controllers.
67 */
68struct irq_host;
69struct radix_tree_root;
70
71/* Functions below are provided by the host and called whenever a new mapping
72 * is created or an old mapping is disposed. The host can then proceed to
73 * whatever internal data structures management is required. It also needs
74 * to setup the irq_desc when returning from map().
75 */
76struct irq_host_ops {
77 /* Match an interrupt controller device node to a host, returns
78 * 1 on a match
79 */
80 int (*match)(struct irq_host *h, struct device_node *node);
81
82 /* Create or update a mapping between a virtual irq number and a hw
83 * irq number. This is called only once for a given mapping.
84 */
85 int (*map)(struct irq_host *h, unsigned int virq, irq_hw_number_t hw);
86
87 /* Dispose of such a mapping */
88 void (*unmap)(struct irq_host *h, unsigned int virq);
89
90 /* Update of such a mapping */
91 void (*remap)(struct irq_host *h, unsigned int virq, irq_hw_number_t hw);
92
93 /* Translate device-tree interrupt specifier from raw format coming
94 * from the firmware to a irq_hw_number_t (interrupt line number) and
95 * type (sense) that can be passed to set_irq_type(). In the absence
96 * of this callback, irq_create_of_mapping() and irq_of_parse_and_map()
97 * will return the hw number in the first cell and IRQ_TYPE_NONE for
98 * the type (which amount to keeping whatever default value the
99 * interrupt controller has for that line)
100 */
101 int (*xlate)(struct irq_host *h, struct device_node *ctrler,
102 u32 *intspec, unsigned int intsize,
103 irq_hw_number_t *out_hwirq, unsigned int *out_type);
104};
105
106struct irq_host {
107 struct list_head link;
108
109 /* type of reverse mapping technique */
110 unsigned int revmap_type;
111#define IRQ_HOST_MAP_LEGACY 0 /* legacy 8259, gets irqs 1..15 */
112#define IRQ_HOST_MAP_NOMAP 1 /* no fast reverse mapping */
113#define IRQ_HOST_MAP_LINEAR 2 /* linear map of interrupts */
114#define IRQ_HOST_MAP_TREE 3 /* radix tree */
115 union {
116 struct {
117 unsigned int size;
118 unsigned int *revmap;
119 } linear;
120 struct radix_tree_root tree;
121 } revmap_data;
122 struct irq_host_ops *ops;
123 void *host_data;
124 irq_hw_number_t inval_irq;
125
126 /* Optional device node pointer */
127 struct device_node *of_node;
128};
129
130/* The main irq map itself is an array of NR_IRQ entries containing the
131 * associate host and irq number. An entry with a host of NULL is free.
132 * An entry can be allocated if it's free, the allocator always then sets
133 * hwirq first to the host's invalid irq number and then fills ops.
134 */
135struct irq_map_entry {
136 irq_hw_number_t hwirq;
137 struct irq_host *host;
138};
139
140extern struct irq_map_entry irq_map[NR_IRQS];
141
142extern irq_hw_number_t virq_to_hw(unsigned int virq);
143
144/**
145 * irq_alloc_host - Allocate a new irq_host data structure
146 * @of_node: optional device-tree node of the interrupt controller
147 * @revmap_type: type of reverse mapping to use
148 * @revmap_arg: for IRQ_HOST_MAP_LINEAR linear only: size of the map
149 * @ops: map/unmap host callbacks
150 * @inval_irq: provide a hw number in that host space that is always invalid
151 *
152 * Allocates and initialize and irq_host structure. Note that in the case of
153 * IRQ_HOST_MAP_LEGACY, the map() callback will be called before this returns
154 * for all legacy interrupts except 0 (which is always the invalid irq for
155 * a legacy controller). For a IRQ_HOST_MAP_LINEAR, the map is allocated by
156 * this call as well. For a IRQ_HOST_MAP_TREE, the radix tree will be allocated
157 * later during boot automatically (the reverse mapping will use the slow path
158 * until that happens).
159 */
160extern struct irq_host *irq_alloc_host(struct device_node *of_node,
161 unsigned int revmap_type,
162 unsigned int revmap_arg,
163 struct irq_host_ops *ops,
164 irq_hw_number_t inval_irq);
165
166
167/**
168 * irq_find_host - Locates a host for a given device node
169 * @node: device-tree node of the interrupt controller
170 */
171extern struct irq_host *irq_find_host(struct device_node *node);
172
173
174/**
175 * irq_set_default_host - Set a "default" host
176 * @host: default host pointer
177 *
178 * For convenience, it's possible to set a "default" host that will be used
179 * whenever NULL is passed to irq_create_mapping(). It makes life easier for
180 * platforms that want to manipulate a few hard coded interrupt numbers that
181 * aren't properly represented in the device-tree.
182 */
183extern void irq_set_default_host(struct irq_host *host);
184
185
186/**
187 * irq_set_virq_count - Set the maximum number of virt irqs
188 * @count: number of linux virtual irqs, capped with NR_IRQS
189 *
190 * This is mainly for use by platforms like iSeries who want to program
191 * the virtual irq number in the controller to avoid the reverse mapping
192 */
193extern void irq_set_virq_count(unsigned int count);
194
195
196/**
197 * irq_create_mapping - Map a hardware interrupt into linux virq space
198 * @host: host owning this hardware interrupt or NULL for default host
199 * @hwirq: hardware irq number in that host space
200 *
201 * Only one mapping per hardware interrupt is permitted. Returns a linux
202 * virq number.
203 * If the sense/trigger is to be specified, set_irq_type() should be called
204 * on the number returned from that call.
205 */
206extern unsigned int irq_create_mapping(struct irq_host *host,
207 irq_hw_number_t hwirq);
208
209
210/**
211 * irq_dispose_mapping - Unmap an interrupt
212 * @virq: linux virq number of the interrupt to unmap
213 */
214extern void irq_dispose_mapping(unsigned int virq);
215
216/**
217 * irq_find_mapping - Find a linux virq from an hw irq number.
218 * @host: host owning this hardware interrupt
219 * @hwirq: hardware irq number in that host space
220 *
221 * This is a slow path, for use by generic code. It's expected that an
222 * irq controller implementation directly calls the appropriate low level
223 * mapping function.
224 */
225extern unsigned int irq_find_mapping(struct irq_host *host,
226 irq_hw_number_t hwirq);
227
228/**
229 * irq_create_direct_mapping - Allocate a virq for direct mapping
230 * @host: host to allocate the virq for or NULL for default host
231 *
232 * This routine is used for irq controllers which can choose the hardware
233 * interrupt numbers they generate. In such a case it's simplest to use
234 * the linux virq as the hardware interrupt number.
235 */
236extern unsigned int irq_create_direct_mapping(struct irq_host *host);
237
238/**
239 * irq_radix_revmap - Find a linux virq from a hw irq number.
240 * @host: host owning this hardware interrupt
241 * @hwirq: hardware irq number in that host space
242 *
243 * This is a fast path, for use by irq controller code that uses radix tree
244 * revmaps
245 */
246extern unsigned int irq_radix_revmap(struct irq_host *host,
247 irq_hw_number_t hwirq);
248
249/**
250 * irq_linear_revmap - Find a linux virq from a hw irq number.
251 * @host: host owning this hardware interrupt
252 * @hwirq: hardware irq number in that host space
253 *
254 * This is a fast path, for use by irq controller code that uses linear
255 * revmaps. It does fallback to the slow path if the revmap doesn't exist
256 * yet and will create the revmap entry with appropriate locking
257 */
258
259extern unsigned int irq_linear_revmap(struct irq_host *host,
260 irq_hw_number_t hwirq);
261
262
263
264/**
265 * irq_alloc_virt - Allocate virtual irq numbers
266 * @host: host owning these new virtual irqs
267 * @count: number of consecutive numbers to allocate
268 * @hint: pass a hint number, the allocator will try to use a 1:1 mapping
269 *
270 * This is a low level function that is used internally by irq_create_mapping()
271 * and that can be used by some irq controllers implementations for things
272 * like allocating ranges of numbers for MSIs. The revmaps are left untouched.
273 */
274extern unsigned int irq_alloc_virt(struct irq_host *host,
275 unsigned int count,
276 unsigned int hint);
277
278/**
279 * irq_free_virt - Free virtual irq numbers
280 * @virq: virtual irq number of the first interrupt to free
281 * @count: number of interrupts to free
282 *
283 * This function is the opposite of irq_alloc_virt. It will not clear reverse
284 * maps, this should be done previously by unmap'ing the interrupt. In fact,
285 * all interrupts covered by the range being freed should have been unmapped
286 * prior to calling this.
287 */
288extern void irq_free_virt(unsigned int virq, unsigned int count);
289
290
291/* -- OF helpers -- */
292
293/* irq_create_of_mapping - Map a hardware interrupt into linux virq space
294 * @controller: Device node of the interrupt controller
295 * @inspec: Interrupt specifier from the device-tree
296 * @intsize: Size of the interrupt specifier from the device-tree
297 *
298 * This function is identical to irq_create_mapping except that it takes
299 * as input informations straight from the device-tree (typically the results
300 * of the of_irq_map_*() functions.
301 */
302extern unsigned int irq_create_of_mapping(struct device_node *controller,
303 u32 *intspec, unsigned int intsize);
304
305
306/* irq_of_parse_and_map - Parse nad Map an interrupt into linux virq space
307 * @device: Device node of the device whose interrupt is to be mapped
308 * @index: Index of the interrupt to map
309 *
310 * This function is a wrapper that chains of_irq_map_one() and
311 * irq_create_of_mapping() to make things easier to callers
312 */
313extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index);
314
315/* -- End OF helpers -- */
316
317/**
318 * irq_early_init - Init irq remapping subsystem
319 */
320extern void irq_early_init(void);
321
322static __inline__ int irq_canonicalize(int irq)
323{
324 return irq;
325}
326
327extern int distribute_irqs;
328
329struct irqaction;
330struct pt_regs;
331
332#define __ARCH_HAS_DO_SOFTIRQ
333
334#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
335/*
336 * Per-cpu stacks for handling critical, debug and machine check
337 * level interrupts.
338 */
339extern struct thread_info *critirq_ctx[NR_CPUS];
340extern struct thread_info *dbgirq_ctx[NR_CPUS];
341extern struct thread_info *mcheckirq_ctx[NR_CPUS];
342extern void exc_lvl_ctx_init(void);
343#else
344#define exc_lvl_ctx_init()
345#endif
346
347#ifdef CONFIG_IRQSTACKS
348/*
349 * Per-cpu stacks for handling hard and soft interrupts.
350 */
351extern struct thread_info *hardirq_ctx[NR_CPUS];
352extern struct thread_info *softirq_ctx[NR_CPUS];
353
354extern void irq_ctx_init(void);
355extern void call_do_softirq(struct thread_info *tp);
356extern int call_handle_irq(int irq, void *p1,
357 struct thread_info *tp, void *func);
358#else
359#define irq_ctx_init()
360
361#endif /* CONFIG_IRQSTACKS */
362
363extern void do_IRQ(struct pt_regs *regs);
364
365#endif /* _ASM_IRQ_H */
366#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/irq_regs.h b/arch/powerpc/include/asm/irq_regs.h
new file mode 100644
index 000000000000..ba94b51a0a70
--- /dev/null
+++ b/arch/powerpc/include/asm/irq_regs.h
@@ -0,0 +1,2 @@
1#include <asm-generic/irq_regs.h>
2
diff --git a/arch/powerpc/include/asm/irqflags.h b/arch/powerpc/include/asm/irqflags.h
new file mode 100644
index 000000000000..17ba3a881bfd
--- /dev/null
+++ b/arch/powerpc/include/asm/irqflags.h
@@ -0,0 +1,42 @@
1/*
2 * IRQ flags handling
3 */
4#ifndef _ASM_IRQFLAGS_H
5#define _ASM_IRQFLAGS_H
6
7#ifndef __ASSEMBLY__
8/*
9 * Get definitions for raw_local_save_flags(x), etc.
10 */
11#include <asm/hw_irq.h>
12
13#else
14#ifdef CONFIG_TRACE_IRQFLAGS
15/*
16 * Most of the CPU's IRQ-state tracing is done from assembly code; we
17 * have to call a C function so call a wrapper that saves all the
18 * C-clobbered registers.
19 */
20#define TRACE_ENABLE_INTS bl .trace_hardirqs_on
21#define TRACE_DISABLE_INTS bl .trace_hardirqs_off
22#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \
23 cmpdi en, 0; \
24 bne 95f; \
25 stb en,PACASOFTIRQEN(r13); \
26 bl .trace_hardirqs_off; \
27 b skip; \
2895: bl .trace_hardirqs_on; \
29 li en,1;
30#define TRACE_AND_RESTORE_IRQ(en) \
31 TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \
3296: stb en,PACASOFTIRQEN(r13)
33#else
34#define TRACE_ENABLE_INTS
35#define TRACE_DISABLE_INTS
36#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip)
37#define TRACE_AND_RESTORE_IRQ(en) \
38 stb en,PACASOFTIRQEN(r13)
39#endif
40#endif
41
42#endif
diff --git a/arch/powerpc/include/asm/iseries/alpaca.h b/arch/powerpc/include/asm/iseries/alpaca.h
new file mode 100644
index 000000000000..c0cce6727a69
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/alpaca.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright © 2008 Stephen Rothwell 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#ifndef _ASM_POWERPC_ISERIES_ALPACA_H
19#define _ASM_POWERPC_ISERIES_ALPACA_H
20
21/*
22 * This is the part of the paca that the iSeries hypervisor
23 * needs to be statically initialised. Immediately after boot
24 * we switch to the normal Linux paca.
25 */
26struct alpaca {
27 struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */
28 const void *reg_save_ptr; /* Pointer to LpRegSave for PLIC */
29};
30
31#endif /* _ASM_POWERPC_ISERIES_ALPACA_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_call.h b/arch/powerpc/include/asm/iseries/hv_call.h
new file mode 100644
index 000000000000..162d653ad51f
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/hv_call.h
@@ -0,0 +1,111 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan 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 * This file contains the "hypervisor call" interface which is used to
19 * drive the hypervisor from the OS.
20 */
21#ifndef _ASM_POWERPC_ISERIES_HV_CALL_H
22#define _ASM_POWERPC_ISERIES_HV_CALL_H
23
24#include <asm/iseries/hv_call_sc.h>
25#include <asm/iseries/hv_types.h>
26#include <asm/paca.h>
27
28/* Type of yield for HvCallBaseYieldProcessor */
29#define HvCall_YieldTimed 0 /* Yield until specified time (tb) */
30#define HvCall_YieldToActive 1 /* Yield until all active procs have run */
31#define HvCall_YieldToProc 2 /* Yield until the specified processor has run */
32
33/* interrupt masks for setEnabledInterrupts */
34#define HvCall_MaskIPI 0x00000001
35#define HvCall_MaskLpEvent 0x00000002
36#define HvCall_MaskLpProd 0x00000004
37#define HvCall_MaskTimeout 0x00000008
38
39/* Log buffer formats */
40#define HvCall_LogBuffer_ASCII 0
41#define HvCall_LogBuffer_EBCDIC 1
42
43#define HvCallBaseAckDeferredInts HvCallBase + 0
44#define HvCallBaseCpmPowerOff HvCallBase + 1
45#define HvCallBaseGetHwPatch HvCallBase + 2
46#define HvCallBaseReIplSpAttn HvCallBase + 3
47#define HvCallBaseSetASR HvCallBase + 4
48#define HvCallBaseSetASRAndRfi HvCallBase + 5
49#define HvCallBaseSetIMR HvCallBase + 6
50#define HvCallBaseSendIPI HvCallBase + 7
51#define HvCallBaseTerminateMachine HvCallBase + 8
52#define HvCallBaseTerminateMachineSrc HvCallBase + 9
53#define HvCallBaseProcessPlicInterrupts HvCallBase + 10
54#define HvCallBaseIsPrimaryCpmOrMsdIpl HvCallBase + 11
55#define HvCallBaseSetVirtualSIT HvCallBase + 12
56#define HvCallBaseVaryOffThisProcessor HvCallBase + 13
57#define HvCallBaseVaryOffMemoryChunk HvCallBase + 14
58#define HvCallBaseVaryOffInteractivePercentage HvCallBase + 15
59#define HvCallBaseSendLpProd HvCallBase + 16
60#define HvCallBaseSetEnabledInterrupts HvCallBase + 17
61#define HvCallBaseYieldProcessor HvCallBase + 18
62#define HvCallBaseVaryOffSharedProcUnits HvCallBase + 19
63#define HvCallBaseSetVirtualDecr HvCallBase + 20
64#define HvCallBaseClearLogBuffer HvCallBase + 21
65#define HvCallBaseGetLogBufferCodePage HvCallBase + 22
66#define HvCallBaseGetLogBufferFormat HvCallBase + 23
67#define HvCallBaseGetLogBufferLength HvCallBase + 24
68#define HvCallBaseReadLogBuffer HvCallBase + 25
69#define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26
70#define HvCallBaseWriteLogBuffer HvCallBase + 27
71#define HvCallBaseRouter28 HvCallBase + 28
72#define HvCallBaseRouter29 HvCallBase + 29
73#define HvCallBaseRouter30 HvCallBase + 30
74#define HvCallBaseSetDebugBus HvCallBase + 31
75
76#define HvCallCcSetDABR HvCallCc + 7
77
78static inline void HvCall_setVirtualDecr(void)
79{
80 /*
81 * Ignore any error return codes - most likely means that the
82 * target value for the LP has been increased and this vary off
83 * would bring us below the new target.
84 */
85 HvCall0(HvCallBaseSetVirtualDecr);
86}
87
88static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm)
89{
90 HvCall2(HvCallBaseYieldProcessor, typeOfYield, yieldParm);
91}
92
93static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts)
94{
95 HvCall1(HvCallBaseSetEnabledInterrupts, enabledInterrupts);
96}
97
98static inline void HvCall_setLogBufferFormatAndCodepage(int format,
99 u32 codePage)
100{
101 HvCall2(HvCallBaseSetLogBufferFormatAndCodePage, format, codePage);
102}
103
104extern void HvCall_writeLogBuffer(const void *buffer, u64 bufLen);
105
106static inline void HvCall_sendIPI(struct paca_struct *targetPaca)
107{
108 HvCall1(HvCallBaseSendIPI, targetPaca->paca_index);
109}
110
111#endif /* _ASM_POWERPC_ISERIES_HV_CALL_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_call_event.h b/arch/powerpc/include/asm/iseries/hv_call_event.h
new file mode 100644
index 000000000000..cc029d388e11
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/hv_call_event.h
@@ -0,0 +1,201 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan 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 * This file contains the "hypervisor call" interface which is used to
19 * drive the hypervisor from the OS.
20 */
21#ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
22#define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
23
24#include <linux/types.h>
25#include <linux/dma-mapping.h>
26
27#include <asm/iseries/hv_call_sc.h>
28#include <asm/iseries/hv_types.h>
29#include <asm/abs_addr.h>
30
31struct HvLpEvent;
32
33typedef u8 HvLpEvent_Type;
34typedef u8 HvLpEvent_AckInd;
35typedef u8 HvLpEvent_AckType;
36
37typedef u8 HvLpDma_Direction;
38typedef u8 HvLpDma_AddressType;
39
40typedef u64 HvLpEvent_Rc;
41typedef u64 HvLpDma_Rc;
42
43#define HvCallEventAckLpEvent HvCallEvent + 0
44#define HvCallEventCancelLpEvent HvCallEvent + 1
45#define HvCallEventCloseLpEventPath HvCallEvent + 2
46#define HvCallEventDmaBufList HvCallEvent + 3
47#define HvCallEventDmaSingle HvCallEvent + 4
48#define HvCallEventDmaToSp HvCallEvent + 5
49#define HvCallEventGetOverflowLpEvents HvCallEvent + 6
50#define HvCallEventGetSourceLpInstanceId HvCallEvent + 7
51#define HvCallEventGetTargetLpInstanceId HvCallEvent + 8
52#define HvCallEventOpenLpEventPath HvCallEvent + 9
53#define HvCallEventSetLpEventStack HvCallEvent + 10
54#define HvCallEventSignalLpEvent HvCallEvent + 11
55#define HvCallEventSignalLpEventParms HvCallEvent + 12
56#define HvCallEventSetInterLpQueueIndex HvCallEvent + 13
57#define HvCallEventSetLpEventQueueInterruptProc HvCallEvent + 14
58#define HvCallEventRouter15 HvCallEvent + 15
59
60static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex)
61{
62 HvCall1(HvCallEventGetOverflowLpEvents, queueIndex);
63}
64
65static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex)
66{
67 HvCall1(HvCallEventSetInterLpQueueIndex, queueIndex);
68}
69
70static inline void HvCallEvent_setLpEventStack(u8 queueIndex,
71 char *eventStackAddr, u32 eventStackSize)
72{
73 HvCall3(HvCallEventSetLpEventStack, queueIndex,
74 virt_to_abs(eventStackAddr), eventStackSize);
75}
76
77static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
78 u16 lpLogicalProcIndex)
79{
80 HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex,
81 lpLogicalProcIndex);
82}
83
84static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event)
85{
86 return HvCall1(HvCallEventSignalLpEvent, virt_to_abs(event));
87}
88
89static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
90 HvLpEvent_Type type, u16 subtype, HvLpEvent_AckInd ackInd,
91 HvLpEvent_AckType ackType, HvLpInstanceId sourceInstanceId,
92 HvLpInstanceId targetInstanceId, u64 correlationToken,
93 u64 eventData1, u64 eventData2, u64 eventData3,
94 u64 eventData4, u64 eventData5)
95{
96 /* Pack the misc bits into a single Dword to pass to PLIC */
97 union {
98 struct {
99 u8 ack_and_target;
100 u8 type;
101 u16 subtype;
102 HvLpInstanceId src_inst;
103 HvLpInstanceId target_inst;
104 } parms;
105 u64 dword;
106 } packed;
107
108 packed.parms.ack_and_target = (ackType << 7) | (ackInd << 6) | targetLp;
109 packed.parms.type = type;
110 packed.parms.subtype = subtype;
111 packed.parms.src_inst = sourceInstanceId;
112 packed.parms.target_inst = targetInstanceId;
113
114 return HvCall7(HvCallEventSignalLpEventParms, packed.dword,
115 correlationToken, eventData1, eventData2,
116 eventData3, eventData4, eventData5);
117}
118
119extern void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag);
120extern void iseries_hv_free(size_t size, void *vaddr, dma_addr_t dma_handle);
121extern dma_addr_t iseries_hv_map(void *vaddr, size_t size,
122 enum dma_data_direction direction);
123extern void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
124 enum dma_data_direction direction);
125
126static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event)
127{
128 return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event));
129}
130
131static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event)
132{
133 return HvCall1(HvCallEventCancelLpEvent, virt_to_abs(event));
134}
135
136static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId(
137 HvLpIndex targetLp, HvLpEvent_Type type)
138{
139 return HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type);
140}
141
142static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId(
143 HvLpIndex targetLp, HvLpEvent_Type type)
144{
145 return HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type);
146}
147
148static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp,
149 HvLpEvent_Type type)
150{
151 HvCall2(HvCallEventOpenLpEventPath, targetLp, type);
152}
153
154static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp,
155 HvLpEvent_Type type)
156{
157 HvCall2(HvCallEventCloseLpEventPath, targetLp, type);
158}
159
160static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
161 HvLpIndex remoteLp, HvLpDma_Direction direction,
162 HvLpInstanceId localInstanceId,
163 HvLpInstanceId remoteInstanceId,
164 HvLpDma_AddressType localAddressType,
165 HvLpDma_AddressType remoteAddressType,
166 /* Do these need to be converted to absolute addresses? */
167 u64 localBufList, u64 remoteBufList, u32 transferLength)
168{
169 /* Pack the misc bits into a single Dword to pass to PLIC */
170 union {
171 struct {
172 u8 flags;
173 HvLpIndex remote;
174 u8 type;
175 u8 reserved;
176 HvLpInstanceId local_inst;
177 HvLpInstanceId remote_inst;
178 } parms;
179 u64 dword;
180 } packed;
181
182 packed.parms.flags = (direction << 7) |
183 (localAddressType << 6) | (remoteAddressType << 5);
184 packed.parms.remote = remoteLp;
185 packed.parms.type = type;
186 packed.parms.reserved = 0;
187 packed.parms.local_inst = localInstanceId;
188 packed.parms.remote_inst = remoteInstanceId;
189
190 return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList,
191 remoteBufList, transferLength);
192}
193
194static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote,
195 u32 length, HvLpDma_Direction dir)
196{
197 return HvCall4(HvCallEventDmaToSp, virt_to_abs(local), remote,
198 length, dir);
199}
200
201#endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_call_sc.h b/arch/powerpc/include/asm/iseries/hv_call_sc.h
new file mode 100644
index 000000000000..f5d210959250
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/hv_call_sc.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan 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#ifndef _ASM_POWERPC_ISERIES_HV_CALL_SC_H
19#define _ASM_POWERPC_ISERIES_HV_CALL_SC_H
20
21#include <linux/types.h>
22
23#define HvCallBase 0x8000000000000000ul
24#define HvCallCc 0x8001000000000000ul
25#define HvCallCfg 0x8002000000000000ul
26#define HvCallEvent 0x8003000000000000ul
27#define HvCallHpt 0x8004000000000000ul
28#define HvCallPci 0x8005000000000000ul
29#define HvCallSm 0x8007000000000000ul
30#define HvCallXm 0x8009000000000000ul
31
32extern u64 HvCall0(u64);
33extern u64 HvCall1(u64, u64);
34extern u64 HvCall2(u64, u64, u64);
35extern u64 HvCall3(u64, u64, u64, u64);
36extern u64 HvCall4(u64, u64, u64, u64, u64);
37extern u64 HvCall5(u64, u64, u64, u64, u64, u64);
38extern u64 HvCall6(u64, u64, u64, u64, u64, u64, u64);
39extern u64 HvCall7(u64, u64, u64, u64, u64, u64, u64, u64);
40
41extern u64 HvCall0Ret16(u64, void *);
42extern u64 HvCall1Ret16(u64, void *, u64);
43extern u64 HvCall2Ret16(u64, void *, u64, u64);
44extern u64 HvCall3Ret16(u64, void *, u64, u64, u64);
45extern u64 HvCall4Ret16(u64, void *, u64, u64, u64, u64);
46extern u64 HvCall5Ret16(u64, void *, u64, u64, u64, u64, u64);
47extern u64 HvCall6Ret16(u64, void *, u64, u64, u64, u64, u64, u64);
48extern u64 HvCall7Ret16(u64, void *, u64, u64 ,u64 ,u64 ,u64 ,u64 ,u64);
49
50#endif /* _ASM_POWERPC_ISERIES_HV_CALL_SC_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_call_xm.h b/arch/powerpc/include/asm/iseries/hv_call_xm.h
new file mode 100644
index 000000000000..392ac3f54df0
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/hv_call_xm.h
@@ -0,0 +1,61 @@
1/*
2 * This file contains the "hypervisor call" interface which is used to
3 * drive the hypervisor from SLIC.
4 */
5#ifndef _ASM_POWERPC_ISERIES_HV_CALL_XM_H
6#define _ASM_POWERPC_ISERIES_HV_CALL_XM_H
7
8#include <asm/iseries/hv_call_sc.h>
9#include <asm/iseries/hv_types.h>
10
11#define HvCallXmGetTceTableParms HvCallXm + 0
12#define HvCallXmTestBus HvCallXm + 1
13#define HvCallXmConnectBusUnit HvCallXm + 2
14#define HvCallXmLoadTod HvCallXm + 8
15#define HvCallXmTestBusUnit HvCallXm + 9
16#define HvCallXmSetTce HvCallXm + 11
17#define HvCallXmSetTces HvCallXm + 13
18
19static inline void HvCallXm_getTceTableParms(u64 cb)
20{
21 HvCall1(HvCallXmGetTceTableParms, cb);
22}
23
24static inline u64 HvCallXm_setTce(u64 tceTableToken, u64 tceOffset, u64 tce)
25{
26 return HvCall3(HvCallXmSetTce, tceTableToken, tceOffset, tce);
27}
28
29static inline u64 HvCallXm_setTces(u64 tceTableToken, u64 tceOffset,
30 u64 numTces, u64 tce1, u64 tce2, u64 tce3, u64 tce4)
31{
32 return HvCall7(HvCallXmSetTces, tceTableToken, tceOffset, numTces,
33 tce1, tce2, tce3, tce4);
34}
35
36static inline u64 HvCallXm_testBus(u16 busNumber)
37{
38 return HvCall1(HvCallXmTestBus, busNumber);
39}
40
41static inline u64 HvCallXm_testBusUnit(u16 busNumber, u8 subBusNumber,
42 u8 deviceId)
43{
44 return HvCall2(HvCallXmTestBusUnit, busNumber,
45 (subBusNumber << 8) | deviceId);
46}
47
48static inline u64 HvCallXm_connectBusUnit(u16 busNumber, u8 subBusNumber,
49 u8 deviceId, u64 interruptToken)
50{
51 return HvCall5(HvCallXmConnectBusUnit, busNumber,
52 (subBusNumber << 8) | deviceId, interruptToken, 0,
53 0 /* HvLpConfig::mapDsaToQueueIndex(HvLpDSA(busNumber, xBoard, xCard)) */);
54}
55
56static inline u64 HvCallXm_loadTod(void)
57{
58 return HvCall0(HvCallXmLoadTod);
59}
60
61#endif /* _ASM_POWERPC_ISERIES_HV_CALL_XM_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_lp_config.h b/arch/powerpc/include/asm/iseries/hv_lp_config.h
new file mode 100644
index 000000000000..a006fd1e4a2c
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/hv_lp_config.h
@@ -0,0 +1,128 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan 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#ifndef _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H
19#define _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H
20
21/*
22 * This file contains the interface to the LPAR configuration data
23 * to determine which resources should be allocated to each partition.
24 */
25
26#include <asm/iseries/hv_call_sc.h>
27#include <asm/iseries/hv_types.h>
28
29enum {
30 HvCallCfg_Cur = 0,
31 HvCallCfg_Init = 1,
32 HvCallCfg_Max = 2,
33 HvCallCfg_Min = 3
34};
35
36#define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6
37#define HvCallCfgGetPhysicalProcessors HvCallCfg + 7
38#define HvCallCfgGetMsChunks HvCallCfg + 9
39#define HvCallCfgGetSharedPoolIndex HvCallCfg + 20
40#define HvCallCfgGetSharedProcUnits HvCallCfg + 21
41#define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22
42#define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30
43#define HvCallCfgGetHostingLpIndex HvCallCfg + 32
44
45extern HvLpIndex HvLpConfig_getLpIndex_outline(void);
46extern HvLpIndex HvLpConfig_getLpIndex(void);
47extern HvLpIndex HvLpConfig_getPrimaryLpIndex(void);
48
49static inline u64 HvLpConfig_getMsChunks(void)
50{
51 return HvCall2(HvCallCfgGetMsChunks, HvLpConfig_getLpIndex(),
52 HvCallCfg_Cur);
53}
54
55static inline u64 HvLpConfig_getSystemPhysicalProcessors(void)
56{
57 return HvCall0(HvCallCfgGetSystemPhysicalProcessors);
58}
59
60static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI)
61{
62 return (u16)HvCall1(HvCallCfgGetNumProcsInSharedPool, sPI);
63}
64
65static inline u64 HvLpConfig_getPhysicalProcessors(void)
66{
67 return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(),
68 HvCallCfg_Cur);
69}
70
71static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void)
72{
73 return HvCall1(HvCallCfgGetSharedPoolIndex, HvLpConfig_getLpIndex());
74}
75
76static inline u64 HvLpConfig_getSharedProcUnits(void)
77{
78 return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(),
79 HvCallCfg_Cur);
80}
81
82static inline u64 HvLpConfig_getMaxSharedProcUnits(void)
83{
84 return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(),
85 HvCallCfg_Max);
86}
87
88static inline u64 HvLpConfig_getMaxPhysicalProcessors(void)
89{
90 return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(),
91 HvCallCfg_Max);
92}
93
94static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp(
95 HvLpIndex lp)
96{
97 /*
98 * This is a new function in V5R1 so calls to this on older
99 * hypervisors will return -1
100 */
101 u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp);
102 if (retVal == -1)
103 retVal = 0;
104 return retVal;
105}
106
107static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void)
108{
109 return HvLpConfig_getVirtualLanIndexMapForLp(
110 HvLpConfig_getLpIndex_outline());
111}
112
113static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1,
114 HvLpIndex lp2)
115{
116 HvLpVirtualLanIndexMap virtualLanIndexMap1 =
117 HvLpConfig_getVirtualLanIndexMapForLp(lp1);
118 HvLpVirtualLanIndexMap virtualLanIndexMap2 =
119 HvLpConfig_getVirtualLanIndexMapForLp(lp2);
120 return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0);
121}
122
123static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp)
124{
125 return HvCall1(HvCallCfgGetHostingLpIndex, lp);
126}
127
128#endif /* _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_lp_event.h b/arch/powerpc/include/asm/iseries/hv_lp_event.h
new file mode 100644
index 000000000000..8f5da7d77202
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/hv_lp_event.h
@@ -0,0 +1,162 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan 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/* This file contains the class for HV events in the system. */
20
21#ifndef _ASM_POWERPC_ISERIES_HV_LP_EVENT_H
22#define _ASM_POWERPC_ISERIES_HV_LP_EVENT_H
23
24#include <asm/types.h>
25#include <asm/ptrace.h>
26#include <asm/iseries/hv_types.h>
27#include <asm/iseries/hv_call_event.h>
28
29/*
30 * HvLpEvent is the structure for Lp Event messages passed between
31 * partitions through PLIC.
32 */
33
34struct HvLpEvent {
35 u8 flags; /* Event flags x00-x00 */
36 u8 xType; /* Type of message x01-x01 */
37 u16 xSubtype; /* Subtype for event x02-x03 */
38 u8 xSourceLp; /* Source LP x04-x04 */
39 u8 xTargetLp; /* Target LP x05-x05 */
40 u8 xSizeMinus1; /* Size of Derived class - 1 x06-x06 */
41 u8 xRc; /* RC for Ack flows x07-x07 */
42 u16 xSourceInstanceId; /* Source sides instance id x08-x09 */
43 u16 xTargetInstanceId; /* Target sides instance id x0A-x0B */
44 union {
45 u32 xSubtypeData; /* Data usable by the subtype x0C-x0F */
46 u16 xSubtypeDataShort[2]; /* Data as 2 shorts */
47 u8 xSubtypeDataChar[4]; /* Data as 4 chars */
48 } x;
49
50 u64 xCorrelationToken; /* Unique value for source/type x10-x17 */
51};
52
53typedef void (*LpEventHandler)(struct HvLpEvent *);
54
55/* Register a handler for an event type - returns 0 on success */
56extern int HvLpEvent_registerHandler(HvLpEvent_Type eventType,
57 LpEventHandler hdlr);
58
59/*
60 * Unregister a handler for an event type
61 *
62 * This call will sleep until the handler being removed is guaranteed to
63 * be no longer executing on any CPU. Do not call with locks held.
64 *
65 * returns 0 on success
66 * Unregister will fail if there are any paths open for the type
67 */
68extern int HvLpEvent_unregisterHandler(HvLpEvent_Type eventType);
69
70/*
71 * Open an Lp Event Path for an event type
72 * returns 0 on success
73 * openPath will fail if there is no handler registered for the event type.
74 * The lpIndex specified is the partition index for the target partition
75 * (for VirtualIo, VirtualLan and SessionMgr) other types specify zero)
76 */
77extern int HvLpEvent_openPath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
78
79/*
80 * Close an Lp Event Path for a type and partition
81 * returns 0 on success
82 */
83extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
84
85#define HvLpEvent_Type_Hypervisor 0
86#define HvLpEvent_Type_MachineFac 1
87#define HvLpEvent_Type_SessionMgr 2
88#define HvLpEvent_Type_SpdIo 3
89#define HvLpEvent_Type_VirtualBus 4
90#define HvLpEvent_Type_PciIo 5
91#define HvLpEvent_Type_RioIo 6
92#define HvLpEvent_Type_VirtualLan 7
93#define HvLpEvent_Type_VirtualIo 8
94#define HvLpEvent_Type_NumTypes 9
95
96#define HvLpEvent_Rc_Good 0
97#define HvLpEvent_Rc_BufferNotAvailable 1
98#define HvLpEvent_Rc_Cancelled 2
99#define HvLpEvent_Rc_GenericError 3
100#define HvLpEvent_Rc_InvalidAddress 4
101#define HvLpEvent_Rc_InvalidPartition 5
102#define HvLpEvent_Rc_InvalidSize 6
103#define HvLpEvent_Rc_InvalidSubtype 7
104#define HvLpEvent_Rc_InvalidSubtypeData 8
105#define HvLpEvent_Rc_InvalidType 9
106#define HvLpEvent_Rc_PartitionDead 10
107#define HvLpEvent_Rc_PathClosed 11
108#define HvLpEvent_Rc_SubtypeError 12
109
110#define HvLpEvent_Function_Ack 0
111#define HvLpEvent_Function_Int 1
112
113#define HvLpEvent_AckInd_NoAck 0
114#define HvLpEvent_AckInd_DoAck 1
115
116#define HvLpEvent_AckType_ImmediateAck 0
117#define HvLpEvent_AckType_DeferredAck 1
118
119#define HV_LP_EVENT_INT 0x01
120#define HV_LP_EVENT_DO_ACK 0x02
121#define HV_LP_EVENT_DEFERRED_ACK 0x04
122#define HV_LP_EVENT_VALID 0x80
123
124#define HvLpDma_Direction_LocalToRemote 0
125#define HvLpDma_Direction_RemoteToLocal 1
126
127#define HvLpDma_AddressType_TceIndex 0
128#define HvLpDma_AddressType_RealAddress 1
129
130#define HvLpDma_Rc_Good 0
131#define HvLpDma_Rc_Error 1
132#define HvLpDma_Rc_PartitionDead 2
133#define HvLpDma_Rc_PathClosed 3
134#define HvLpDma_Rc_InvalidAddress 4
135#define HvLpDma_Rc_InvalidLength 5
136
137static inline int hvlpevent_is_valid(struct HvLpEvent *h)
138{
139 return h->flags & HV_LP_EVENT_VALID;
140}
141
142static inline void hvlpevent_invalidate(struct HvLpEvent *h)
143{
144 h->flags &= ~ HV_LP_EVENT_VALID;
145}
146
147static inline int hvlpevent_is_int(struct HvLpEvent *h)
148{
149 return h->flags & HV_LP_EVENT_INT;
150}
151
152static inline int hvlpevent_is_ack(struct HvLpEvent *h)
153{
154 return !hvlpevent_is_int(h);
155}
156
157static inline int hvlpevent_need_ack(struct HvLpEvent *h)
158{
159 return h->flags & HV_LP_EVENT_DO_ACK;
160}
161
162#endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */
diff --git a/arch/powerpc/include/asm/iseries/hv_types.h b/arch/powerpc/include/asm/iseries/hv_types.h
new file mode 100644
index 000000000000..c3e6d2a1d1c3
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/hv_types.h
@@ -0,0 +1,112 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan 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#ifndef _ASM_POWERPC_ISERIES_HV_TYPES_H
19#define _ASM_POWERPC_ISERIES_HV_TYPES_H
20
21/*
22 * General typedefs for the hypervisor.
23 */
24
25#include <asm/types.h>
26
27typedef u8 HvLpIndex;
28typedef u16 HvLpInstanceId;
29typedef u64 HvLpTOD;
30typedef u64 HvLpSystemSerialNum;
31typedef u8 HvLpDeviceSerialNum[12];
32typedef u16 HvLpSanHwSet;
33typedef u16 HvLpBus;
34typedef u16 HvLpBoard;
35typedef u16 HvLpCard;
36typedef u8 HvLpDeviceType[4];
37typedef u8 HvLpDeviceModel[3];
38typedef u64 HvIoToken;
39typedef u8 HvLpName[8];
40typedef u32 HvIoId;
41typedef u64 HvRealMemoryIndex;
42typedef u32 HvLpIndexMap; /* Must hold HVMAXARCHITECTEDLPS bits!!! */
43typedef u16 HvLpVrmIndex;
44typedef u32 HvXmGenerationId;
45typedef u8 HvLpBusPool;
46typedef u8 HvLpSharedPoolIndex;
47typedef u16 HvLpSharedProcUnitsX100;
48typedef u8 HvLpVirtualLanIndex;
49typedef u16 HvLpVirtualLanIndexMap; /* Must hold HVMAXARCHITECTEDVIRTUALLANS bits!!! */
50typedef u16 HvBusNumber; /* Hypervisor Bus Number */
51typedef u8 HvSubBusNumber; /* Hypervisor SubBus Number */
52typedef u8 HvAgentId; /* Hypervisor DevFn */
53
54
55#define HVMAXARCHITECTEDLPS 32
56#define HVMAXARCHITECTEDVIRTUALLANS 16
57#define HVMAXARCHITECTEDVIRTUALDISKS 32
58#define HVMAXARCHITECTEDVIRTUALCDROMS 8
59#define HVMAXARCHITECTEDVIRTUALTAPES 8
60#define HVCHUNKSIZE (256 * 1024)
61#define HVPAGESIZE (4 * 1024)
62#define HVLPMINMEGSPRIMARY 256
63#define HVLPMINMEGSSECONDARY 64
64#define HVCHUNKSPERMEG 4
65#define HVPAGESPERMEG 256
66#define HVPAGESPERCHUNK 64
67
68#define HvLpIndexInvalid ((HvLpIndex)0xff)
69
70/*
71 * Enums for the sub-components under PLIC
72 * Used in HvCall and HvPrimaryCall
73 */
74enum {
75 HvCallCompId = 0,
76 HvCallCpuCtlsCompId = 1,
77 HvCallCfgCompId = 2,
78 HvCallEventCompId = 3,
79 HvCallHptCompId = 4,
80 HvCallPciCompId = 5,
81 HvCallSlmCompId = 6,
82 HvCallSmCompId = 7,
83 HvCallSpdCompId = 8,
84 HvCallXmCompId = 9,
85 HvCallRioCompId = 10,
86 HvCallRsvd3CompId = 11,
87 HvCallRsvd2CompId = 12,
88 HvCallRsvd1CompId = 13,
89 HvCallMaxCompId = 14,
90 HvPrimaryCallCompId = 0,
91 HvPrimaryCallCfgCompId = 1,
92 HvPrimaryCallPciCompId = 2,
93 HvPrimaryCallSmCompId = 3,
94 HvPrimaryCallSpdCompId = 4,
95 HvPrimaryCallXmCompId = 5,
96 HvPrimaryCallRioCompId = 6,
97 HvPrimaryCallRsvd7CompId = 7,
98 HvPrimaryCallRsvd6CompId = 8,
99 HvPrimaryCallRsvd5CompId = 9,
100 HvPrimaryCallRsvd4CompId = 10,
101 HvPrimaryCallRsvd3CompId = 11,
102 HvPrimaryCallRsvd2CompId = 12,
103 HvPrimaryCallRsvd1CompId = 13,
104 HvPrimaryCallMaxCompId = HvCallMaxCompId
105};
106
107struct HvLpBufferList {
108 u64 addr;
109 u64 len;
110};
111
112#endif /* _ASM_POWERPC_ISERIES_HV_TYPES_H */
diff --git a/arch/powerpc/include/asm/iseries/iommu.h b/arch/powerpc/include/asm/iseries/iommu.h
new file mode 100644
index 000000000000..c59ee7e4bed1
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/iommu.h
@@ -0,0 +1,41 @@
1#ifndef _ASM_POWERPC_ISERIES_IOMMU_H
2#define _ASM_POWERPC_ISERIES_IOMMU_H
3
4/*
5 * Copyright (C) 2005 Stephen Rothwell, IBM Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the:
19 * Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330,
21 * Boston, MA 02111-1307 USA
22 */
23
24struct pci_dev;
25struct vio_dev;
26struct device_node;
27struct iommu_table;
28
29/* Creates table for an individual device node */
30extern void iommu_devnode_init_iSeries(struct pci_dev *pdev,
31 struct device_node *dn);
32
33/* Get table parameters from HV */
34extern void iommu_table_getparms_iSeries(unsigned long busno,
35 unsigned char slotno, unsigned char virtbus,
36 struct iommu_table *tbl);
37
38extern struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev);
39extern void iommu_vio_init(void);
40
41#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */
diff --git a/arch/powerpc/include/asm/iseries/it_lp_queue.h b/arch/powerpc/include/asm/iseries/it_lp_queue.h
new file mode 100644
index 000000000000..428278838821
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/it_lp_queue.h
@@ -0,0 +1,78 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan 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#ifndef _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H
19#define _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H
20
21/*
22 * This control block defines the simple LP queue structure that is
23 * shared between the hypervisor (PLIC) and the OS in order to send
24 * events to an LP.
25 */
26
27#include <asm/types.h>
28#include <asm/ptrace.h>
29
30#define IT_LP_MAX_QUEUES 8
31
32#define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */
33#define IT_LP_DEDICATED_IO 1 /* Queue dedicated to IO processor specified */
34#define IT_LP_DEDICATED_LP 2 /* Queue dedicated to LP specified */
35#define IT_LP_SHARED 3 /* Queue shared for both IO and LP */
36
37#define IT_LP_EVENT_STACK_SIZE 4096
38#define IT_LP_EVENT_MAX_SIZE 256
39#define IT_LP_EVENT_ALIGN 64
40
41struct hvlpevent_queue {
42/*
43 * The hq_current_event is the pointer to the next event stack entry
44 * that will become valid. The OS must peek at this entry to determine
45 * if it is valid. PLIC will set the valid indicator as the very last
46 * store into that entry.
47 *
48 * When the OS has completed processing of the event then it will mark
49 * the event as invalid so that PLIC knows it can store into that event
50 * location again.
51 *
52 * If the event stack fills and there are overflow events, then PLIC
53 * will set the hq_overflow_pending flag in which case the OS will
54 * have to fetch the additional LP events once they have drained the
55 * event stack.
56 *
57 * The first 16-bytes are known by both the OS and PLIC. The remainder
58 * of the cache line is for use by the OS.
59 */
60 u8 hq_overflow_pending; /* 0x00 Overflow events are pending */
61 u8 hq_status; /* 0x01 DedicatedIo or DedicatedLp or NotUsed */
62 u16 hq_proc_index; /* 0x02 Logical Proc Index for correlation */
63 u8 hq_reserved1[12]; /* 0x04 */
64 char *hq_current_event; /* 0x10 */
65 char *hq_last_event; /* 0x18 */
66 char *hq_event_stack; /* 0x20 */
67 u8 hq_index; /* 0x28 unique sequential index. */
68 u8 hq_reserved2[3]; /* 0x29-2b */
69 spinlock_t hq_lock;
70};
71
72extern struct hvlpevent_queue hvlpevent_queue;
73
74extern int hvlpevent_is_pending(void);
75extern void process_hvlpevents(void);
76extern void setup_hvlpevent_queue(void);
77
78#endif /* _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H */
diff --git a/arch/powerpc/include/asm/iseries/lpar_map.h b/arch/powerpc/include/asm/iseries/lpar_map.h
new file mode 100644
index 000000000000..5e9f3e128ee2
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/lpar_map.h
@@ -0,0 +1,85 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan 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#ifndef _ASM_POWERPC_ISERIES_LPAR_MAP_H
19#define _ASM_POWERPC_ISERIES_LPAR_MAP_H
20
21#ifndef __ASSEMBLY__
22
23#include <asm/types.h>
24
25#endif
26
27/*
28 * The iSeries hypervisor will set up mapping for one or more
29 * ESID/VSID pairs (in SLB/segment registers) and will set up
30 * mappings of one or more ranges of pages to VAs.
31 * We will have the hypervisor set up the ESID->VSID mapping
32 * for the four kernel segments (C-F). With shared processors,
33 * the hypervisor will clear all segment registers and reload
34 * these four whenever the processor is switched from one
35 * partition to another.
36 */
37
38/* The Vsid and Esid identified below will be used by the hypervisor
39 * to set up a memory mapping for part of the load area before giving
40 * control to the Linux kernel. The load area is 64 MB, but this must
41 * not attempt to map the whole load area. The Hashed Page Table may
42 * need to be located within the load area (if the total partition size
43 * is 64 MB), but cannot be mapped. Typically, this should specify
44 * to map half (32 MB) of the load area.
45 *
46 * The hypervisor will set up page table entries for the number of
47 * pages specified.
48 *
49 * In 32-bit mode, the hypervisor will load all four of the
50 * segment registers (identified by the low-order four bits of the
51 * Esid field. In 64-bit mode, the hypervisor will load one SLB
52 * entry to map the Esid to the Vsid.
53*/
54
55#define HvEsidsToMap 2
56#define HvRangesToMap 1
57
58/* Hypervisor initially maps 32MB of the load area */
59#define HvPagesToMap 8192
60
61#ifndef __ASSEMBLY__
62struct LparMap {
63 u64 xNumberEsids; // Number of ESID/VSID pairs
64 u64 xNumberRanges; // Number of VA ranges to map
65 u64 xSegmentTableOffs; // Page number within load area of seg table
66 u64 xRsvd[5];
67 struct {
68 u64 xKernelEsid; // Esid used to map kernel load
69 u64 xKernelVsid; // Vsid used to map kernel load
70 } xEsids[HvEsidsToMap];
71 struct {
72 u64 xPages; // Number of pages to be mapped
73 u64 xOffset; // Offset from start of load area
74 u64 xVPN; // Virtual Page Number
75 } xRanges[HvRangesToMap];
76};
77
78extern const struct LparMap xLparMap;
79
80#endif /* __ASSEMBLY__ */
81
82/* the fixed address where the LparMap exists */
83#define LPARMAP_PHYS 0x7000
84
85#endif /* _ASM_POWERPC_ISERIES_LPAR_MAP_H */
diff --git a/arch/powerpc/include/asm/iseries/mf.h b/arch/powerpc/include/asm/iseries/mf.h
new file mode 100644
index 000000000000..eb851a9c9e5c
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/mf.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2001 Troy D. Armstrong IBM Corporation
3 * Copyright (C) 2004 Stephen Rothwell IBM Corporation
4 *
5 * This modules exists as an interface between a Linux secondary partition
6 * running on an iSeries and the primary partition's Virtual Service
7 * Processor (VSP) object. The VSP has final authority over powering on/off
8 * all partitions in the iSeries. It also provides miscellaneous low-level
9 * machine facility type operations.
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 * 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#ifndef _ASM_POWERPC_ISERIES_MF_H
26#define _ASM_POWERPC_ISERIES_MF_H
27
28#include <linux/types.h>
29
30#include <asm/iseries/hv_types.h>
31#include <asm/iseries/hv_call_event.h>
32
33struct rtc_time;
34
35typedef void (*MFCompleteHandler)(void *clientToken, int returnCode);
36
37extern void mf_allocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type,
38 unsigned size, unsigned amount, MFCompleteHandler hdlr,
39 void *userToken);
40extern void mf_deallocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type,
41 unsigned count, MFCompleteHandler hdlr, void *userToken);
42
43extern void mf_power_off(void);
44extern void mf_reboot(char *cmd);
45
46extern void mf_display_src(u32 word);
47extern void mf_display_progress(u16 value);
48
49extern void mf_init(void);
50
51#endif /* _ASM_POWERPC_ISERIES_MF_H */
diff --git a/arch/powerpc/include/asm/iseries/vio.h b/arch/powerpc/include/asm/iseries/vio.h
new file mode 100644
index 000000000000..f9ac0d00b951
--- /dev/null
+++ b/arch/powerpc/include/asm/iseries/vio.h
@@ -0,0 +1,265 @@
1/* -*- linux-c -*-
2 *
3 * iSeries Virtual I/O Message Path header
4 *
5 * Authors: Dave Boutcher <boutcher@us.ibm.com>
6 * Ryan Arnold <ryanarn@us.ibm.com>
7 * Colin Devilbiss <devilbis@us.ibm.com>
8 *
9 * (C) Copyright 2000 IBM Corporation
10 *
11 * This header file is used by the iSeries virtual I/O device
12 * drivers. It defines the interfaces to the common functions
13 * (implemented in drivers/char/viopath.h) as well as defining
14 * common functions and structures. Currently (at the time I
15 * wrote this comment) the iSeries virtual I/O device drivers
16 * that use this are
17 * drivers/block/viodasd.c
18 * drivers/char/viocons.c
19 * drivers/char/viotape.c
20 * drivers/cdrom/viocd.c
21 *
22 * The iSeries virtual ethernet support (veth.c) uses a whole
23 * different set of functions.
24 *
25 * This program is free software; you can redistribute it and/or
26 * modify it under the terms of the GNU General Public License as
27 * published by the Free Software Foundation; either version 2 of the
28 * License, or (at your option) anyu later version.
29 *
30 * This program is distributed in the hope that it will be useful, but
31 * WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33 * General Public License for more details.
34 *
35 * You should have received a copy of the GNU General Public License
36 * along with this program; if not, write to the Free Software Foundation,
37 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 *
39 */
40#ifndef _ASM_POWERPC_ISERIES_VIO_H
41#define _ASM_POWERPC_ISERIES_VIO_H
42
43#include <asm/iseries/hv_types.h>
44#include <asm/iseries/hv_lp_event.h>
45
46/*
47 * iSeries virtual I/O events use the subtype field in
48 * HvLpEvent to figure out what kind of vio event is coming
49 * in. We use a table to route these, and this defines
50 * the maximum number of distinct subtypes
51 */
52#define VIO_MAX_SUBTYPES 8
53
54#define VIOMAXBLOCKDMA 12
55
56struct open_data {
57 u64 disk_size;
58 u16 max_disk;
59 u16 cylinders;
60 u16 tracks;
61 u16 sectors;
62 u16 bytes_per_sector;
63};
64
65struct rw_data {
66 u64 offset;
67 struct {
68 u32 token;
69 u32 reserved;
70 u64 len;
71 } dma_info[VIOMAXBLOCKDMA];
72};
73
74struct vioblocklpevent {
75 struct HvLpEvent event;
76 u32 reserved;
77 u16 version;
78 u16 sub_result;
79 u16 disk;
80 u16 flags;
81 union {
82 struct open_data open_data;
83 struct rw_data rw_data;
84 u64 changed;
85 } u;
86};
87
88#define vioblockflags_ro 0x0001
89
90enum vioblocksubtype {
91 vioblockopen = 0x0001,
92 vioblockclose = 0x0002,
93 vioblockread = 0x0003,
94 vioblockwrite = 0x0004,
95 vioblockflush = 0x0005,
96 vioblockcheck = 0x0007
97};
98
99struct viocdlpevent {
100 struct HvLpEvent event;
101 u32 reserved;
102 u16 version;
103 u16 sub_result;
104 u16 disk;
105 u16 flags;
106 u32 token;
107 u64 offset; /* On open, max number of disks */
108 u64 len; /* On open, size of the disk */
109 u32 block_size; /* Only set on open */
110 u32 media_size; /* Only set on open */
111};
112
113enum viocdsubtype {
114 viocdopen = 0x0001,
115 viocdclose = 0x0002,
116 viocdread = 0x0003,
117 viocdwrite = 0x0004,
118 viocdlockdoor = 0x0005,
119 viocdgetinfo = 0x0006,
120 viocdcheck = 0x0007
121};
122
123struct viotapelpevent {
124 struct HvLpEvent event;
125 u32 reserved;
126 u16 version;
127 u16 sub_type_result;
128 u16 tape;
129 u16 flags;
130 u32 token;
131 u64 len;
132 union {
133 struct {
134 u32 tape_op;
135 u32 count;
136 } op;
137 struct {
138 u32 type;
139 u32 resid;
140 u32 dsreg;
141 u32 gstat;
142 u32 erreg;
143 u32 file_no;
144 u32 block_no;
145 } get_status;
146 struct {
147 u32 block_no;
148 } get_pos;
149 } u;
150};
151
152enum viotapesubtype {
153 viotapeopen = 0x0001,
154 viotapeclose = 0x0002,
155 viotaperead = 0x0003,
156 viotapewrite = 0x0004,
157 viotapegetinfo = 0x0005,
158 viotapeop = 0x0006,
159 viotapegetpos = 0x0007,
160 viotapesetpos = 0x0008,
161 viotapegetstatus = 0x0009
162};
163
164/*
165 * Each subtype can register a handler to process their events.
166 * The handler must have this interface.
167 */
168typedef void (vio_event_handler_t) (struct HvLpEvent * event);
169
170extern int viopath_open(HvLpIndex remoteLp, int subtype, int numReq);
171extern int viopath_close(HvLpIndex remoteLp, int subtype, int numReq);
172extern int vio_setHandler(int subtype, vio_event_handler_t * beh);
173extern int vio_clearHandler(int subtype);
174extern int viopath_isactive(HvLpIndex lp);
175extern HvLpInstanceId viopath_sourceinst(HvLpIndex lp);
176extern HvLpInstanceId viopath_targetinst(HvLpIndex lp);
177extern void vio_set_hostlp(void);
178extern void *vio_get_event_buffer(int subtype);
179extern void vio_free_event_buffer(int subtype, void *buffer);
180
181extern struct vio_dev *vio_create_viodasd(u32 unit);
182
183extern HvLpIndex viopath_hostLp;
184extern HvLpIndex viopath_ourLp;
185
186#define VIOCHAR_MAX_DATA 200
187
188#define VIOMAJOR_SUBTYPE_MASK 0xff00
189#define VIOMINOR_SUBTYPE_MASK 0x00ff
190#define VIOMAJOR_SUBTYPE_SHIFT 8
191
192#define VIOVERSION 0x0101
193
194/*
195 * This is the general structure for VIO errors; each module should have
196 * a table of them, and each table should be terminated by an entry of
197 * { 0, 0, NULL }. Then, to find a specific error message, a module
198 * should pass its local table and the return code.
199 */
200struct vio_error_entry {
201 u16 rc;
202 int errno;
203 const char *msg;
204};
205extern const struct vio_error_entry *vio_lookup_rc(
206 const struct vio_error_entry *local_table, u16 rc);
207
208enum viosubtypes {
209 viomajorsubtype_monitor = 0x0100,
210 viomajorsubtype_blockio = 0x0200,
211 viomajorsubtype_chario = 0x0300,
212 viomajorsubtype_config = 0x0400,
213 viomajorsubtype_cdio = 0x0500,
214 viomajorsubtype_tape = 0x0600,
215 viomajorsubtype_scsi = 0x0700
216};
217
218enum vioconfigsubtype {
219 vioconfigget = 0x0001,
220};
221
222enum viorc {
223 viorc_good = 0x0000,
224 viorc_noConnection = 0x0001,
225 viorc_noReceiver = 0x0002,
226 viorc_noBufferAvailable = 0x0003,
227 viorc_invalidMessageType = 0x0004,
228 viorc_invalidRange = 0x0201,
229 viorc_invalidToken = 0x0202,
230 viorc_DMAError = 0x0203,
231 viorc_useError = 0x0204,
232 viorc_releaseError = 0x0205,
233 viorc_invalidDisk = 0x0206,
234 viorc_openRejected = 0x0301
235};
236
237/*
238 * The structure of the events that flow between us and OS/400 for chario
239 * events. You can't mess with this unless the OS/400 side changes too.
240 */
241struct viocharlpevent {
242 struct HvLpEvent event;
243 u32 reserved;
244 u16 version;
245 u16 subtype_result_code;
246 u8 virtual_device;
247 u8 len;
248 u8 data[VIOCHAR_MAX_DATA];
249};
250
251#define VIOCHAR_WINDOW 10
252
253enum viocharsubtype {
254 viocharopen = 0x0001,
255 viocharclose = 0x0002,
256 viochardata = 0x0003,
257 viocharack = 0x0004,
258 viocharconfig = 0x0005
259};
260
261enum viochar_rc {
262 viochar_rc_ebusy = 1
263};
264
265#endif /* _ASM_POWERPC_ISERIES_VIO_H */
diff --git a/arch/powerpc/include/asm/kdebug.h b/arch/powerpc/include/asm/kdebug.h
new file mode 100644
index 000000000000..ae6d206728af
--- /dev/null
+++ b/arch/powerpc/include/asm/kdebug.h
@@ -0,0 +1,15 @@
1#ifndef _ASM_POWERPC_KDEBUG_H
2#define _ASM_POWERPC_KDEBUG_H
3#ifdef __KERNEL__
4
5/* Grossly misnamed. */
6enum die_val {
7 DIE_OOPS = 1,
8 DIE_IABR_MATCH,
9 DIE_DABR_MATCH,
10 DIE_BPT,
11 DIE_SSTEP,
12};
13
14#endif /* __KERNEL__ */
15#endif /* _ASM_POWERPC_KDEBUG_H */
diff --git a/arch/powerpc/include/asm/kdump.h b/arch/powerpc/include/asm/kdump.h
new file mode 100644
index 000000000000..f6c93c716898
--- /dev/null
+++ b/arch/powerpc/include/asm/kdump.h
@@ -0,0 +1,35 @@
1#ifndef _PPC64_KDUMP_H
2#define _PPC64_KDUMP_H
3
4/* Kdump kernel runs at 32 MB, change at your peril. */
5#define KDUMP_KERNELBASE 0x2000000
6
7/* How many bytes to reserve at zero for kdump. The reserve limit should
8 * be greater or equal to the trampoline's end address.
9 * Reserve to the end of the FWNMI area, see head_64.S */
10#define KDUMP_RESERVE_LIMIT 0x10000 /* 64K */
11
12#ifdef CONFIG_CRASH_DUMP
13
14#define KDUMP_TRAMPOLINE_START 0x0100
15#define KDUMP_TRAMPOLINE_END 0x3000
16
17#define KDUMP_MIN_TCE_ENTRIES 2048
18
19#endif /* CONFIG_CRASH_DUMP */
20
21#ifndef __ASSEMBLY__
22#ifdef CONFIG_CRASH_DUMP
23
24extern void reserve_kdump_trampoline(void);
25extern void setup_kdump_trampoline(void);
26
27#else /* !CONFIG_CRASH_DUMP */
28
29static inline void reserve_kdump_trampoline(void) { ; }
30static inline void setup_kdump_trampoline(void) { ; }
31
32#endif /* CONFIG_CRASH_DUMP */
33#endif /* __ASSEMBLY__ */
34
35#endif /* __PPC64_KDUMP_H */
diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
new file mode 100644
index 000000000000..acdcdc66f1b6
--- /dev/null
+++ b/arch/powerpc/include/asm/kexec.h
@@ -0,0 +1,160 @@
1#ifndef _ASM_POWERPC_KEXEC_H
2#define _ASM_POWERPC_KEXEC_H
3#ifdef __KERNEL__
4
5/*
6 * Maximum page that is mapped directly into kernel memory.
7 * XXX: Since we copy virt we can use any page we allocate
8 */
9#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
10
11/*
12 * Maximum address we can reach in physical address mode.
13 * XXX: I want to allow initrd in highmem. Otherwise set to rmo on LPAR.
14 */
15#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
16
17/* Maximum address we can use for the control code buffer */
18#ifdef __powerpc64__
19#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
20#else
21/* TASK_SIZE, probably left over from use_mm ?? */
22#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
23#endif
24
25#define KEXEC_CONTROL_CODE_SIZE 4096
26
27/* The native architecture */
28#ifdef __powerpc64__
29#define KEXEC_ARCH KEXEC_ARCH_PPC64
30#else
31#define KEXEC_ARCH KEXEC_ARCH_PPC
32#endif
33
34#ifndef __ASSEMBLY__
35#include <linux/cpumask.h>
36
37typedef void (*crash_shutdown_t)(void);
38
39#ifdef CONFIG_KEXEC
40
41#ifdef __powerpc64__
42/*
43 * This function is responsible for capturing register states if coming
44 * via panic or invoking dump using sysrq-trigger.
45 */
46static inline void crash_setup_regs(struct pt_regs *newregs,
47 struct pt_regs *oldregs)
48{
49 if (oldregs)
50 memcpy(newregs, oldregs, sizeof(*newregs));
51 else {
52 /* FIXME Merge this with xmon_save_regs ?? */
53 unsigned long tmp1, tmp2;
54 __asm__ __volatile__ (
55 "std 0,0(%2)\n"
56 "std 1,8(%2)\n"
57 "std 2,16(%2)\n"
58 "std 3,24(%2)\n"
59 "std 4,32(%2)\n"
60 "std 5,40(%2)\n"
61 "std 6,48(%2)\n"
62 "std 7,56(%2)\n"
63 "std 8,64(%2)\n"
64 "std 9,72(%2)\n"
65 "std 10,80(%2)\n"
66 "std 11,88(%2)\n"
67 "std 12,96(%2)\n"
68 "std 13,104(%2)\n"
69 "std 14,112(%2)\n"
70 "std 15,120(%2)\n"
71 "std 16,128(%2)\n"
72 "std 17,136(%2)\n"
73 "std 18,144(%2)\n"
74 "std 19,152(%2)\n"
75 "std 20,160(%2)\n"
76 "std 21,168(%2)\n"
77 "std 22,176(%2)\n"
78 "std 23,184(%2)\n"
79 "std 24,192(%2)\n"
80 "std 25,200(%2)\n"
81 "std 26,208(%2)\n"
82 "std 27,216(%2)\n"
83 "std 28,224(%2)\n"
84 "std 29,232(%2)\n"
85 "std 30,240(%2)\n"
86 "std 31,248(%2)\n"
87 "mfmsr %0\n"
88 "std %0, 264(%2)\n"
89 "mfctr %0\n"
90 "std %0, 280(%2)\n"
91 "mflr %0\n"
92 "std %0, 288(%2)\n"
93 "bl 1f\n"
94 "1: mflr %1\n"
95 "std %1, 256(%2)\n"
96 "mtlr %0\n"
97 "mfxer %0\n"
98 "std %0, 296(%2)\n"
99 : "=&r" (tmp1), "=&r" (tmp2)
100 : "b" (newregs)
101 : "memory");
102 }
103}
104#else
105/*
106 * Provide a dummy definition to avoid build failures. Will remain
107 * empty till crash dump support is enabled.
108 */
109static inline void crash_setup_regs(struct pt_regs *newregs,
110 struct pt_regs *oldregs) { }
111#endif /* !__powerpc64 __ */
112
113extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
114 master to copy new code to 0 */
115extern int crashing_cpu;
116extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
117extern cpumask_t cpus_in_sr;
118static inline int kexec_sr_activated(int cpu)
119{
120 return cpu_isset(cpu,cpus_in_sr);
121}
122
123struct kimage;
124struct pt_regs;
125extern void default_machine_kexec(struct kimage *image);
126extern int default_machine_kexec_prepare(struct kimage *image);
127extern void default_machine_crash_shutdown(struct pt_regs *regs);
128extern int crash_shutdown_register(crash_shutdown_t handler);
129extern int crash_shutdown_unregister(crash_shutdown_t handler);
130
131extern void machine_kexec_simple(struct kimage *image);
132extern void crash_kexec_secondary(struct pt_regs *regs);
133extern int overlaps_crashkernel(unsigned long start, unsigned long size);
134extern void reserve_crashkernel(void);
135
136#else /* !CONFIG_KEXEC */
137static inline int kexec_sr_activated(int cpu) { return 0; }
138static inline void crash_kexec_secondary(struct pt_regs *regs) { }
139
140static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
141{
142 return 0;
143}
144
145static inline void reserve_crashkernel(void) { ; }
146
147static inline int crash_shutdown_register(crash_shutdown_t handler)
148{
149 return 0;
150}
151
152static inline int crash_shutdown_unregister(crash_shutdown_t handler)
153{
154 return 0;
155}
156
157#endif /* CONFIG_KEXEC */
158#endif /* ! __ASSEMBLY__ */
159#endif /* __KERNEL__ */
160#endif /* _ASM_POWERPC_KEXEC_H */
diff --git a/arch/powerpc/include/asm/keylargo.h b/arch/powerpc/include/asm/keylargo.h
new file mode 100644
index 000000000000..d8520ef121f9
--- /dev/null
+++ b/arch/powerpc/include/asm/keylargo.h
@@ -0,0 +1,261 @@
1#ifndef _ASM_POWERPC_KEYLARGO_H
2#define _ASM_POWERPC_KEYLARGO_H
3#ifdef __KERNEL__
4/*
5 * keylargo.h: definitions for using the "KeyLargo" I/O controller chip.
6 *
7 */
8
9/* "Pangea" chipset has keylargo device-id 0x25 while core99
10 * has device-id 0x22. The rev. of the pangea one is 0, so we
11 * fake an artificial rev. in keylargo_rev by oring 0x100
12 */
13#define KL_PANGEA_REV 0x100
14
15/* offset from base for feature control registers */
16#define KEYLARGO_MBCR 0x34 /* KL Only, Media bay control/status */
17#define KEYLARGO_FCR0 0x38
18#define KEYLARGO_FCR1 0x3c
19#define KEYLARGO_FCR2 0x40
20#define KEYLARGO_FCR3 0x44
21#define KEYLARGO_FCR4 0x48
22#define KEYLARGO_FCR5 0x4c /* Pangea only */
23
24/* K2 aditional FCRs */
25#define K2_FCR6 0x34
26#define K2_FCR7 0x30
27#define K2_FCR8 0x2c
28#define K2_FCR9 0x28
29#define K2_FCR10 0x24
30
31/* GPIO registers */
32#define KEYLARGO_GPIO_LEVELS0 0x50
33#define KEYLARGO_GPIO_LEVELS1 0x54
34#define KEYLARGO_GPIO_EXTINT_0 0x58
35#define KEYLARGO_GPIO_EXTINT_CNT 18
36#define KEYLARGO_GPIO_0 0x6A
37#define KEYLARGO_GPIO_CNT 17
38#define KEYLARGO_GPIO_EXTINT_DUAL_EDGE 0x80
39#define KEYLARGO_GPIO_OUTPUT_ENABLE 0x04
40#define KEYLARGO_GPIO_OUTOUT_DATA 0x01
41#define KEYLARGO_GPIO_INPUT_DATA 0x02
42
43/* K2 does only extint GPIOs and does 51 of them */
44#define K2_GPIO_EXTINT_0 0x58
45#define K2_GPIO_EXTINT_CNT 51
46
47/* Specific GPIO regs */
48
49#define KL_GPIO_MODEM_RESET (KEYLARGO_GPIO_0+0x03)
50#define KL_GPIO_MODEM_POWER (KEYLARGO_GPIO_0+0x02) /* Pangea */
51
52#define KL_GPIO_SOUND_POWER (KEYLARGO_GPIO_0+0x05)
53
54/* Hrm... this one is only to be used on Pismo. It seeem to also
55 * control the timebase enable on other machines. Still to be
56 * experimented... --BenH.
57 */
58#define KL_GPIO_FW_CABLE_POWER (KEYLARGO_GPIO_0+0x09)
59#define KL_GPIO_TB_ENABLE (KEYLARGO_GPIO_0+0x09)
60
61#define KL_GPIO_ETH_PHY_RESET (KEYLARGO_GPIO_0+0x10)
62
63#define KL_GPIO_EXTINT_CPU1 (KEYLARGO_GPIO_0+0x0a)
64#define KL_GPIO_EXTINT_CPU1_ASSERT 0x04
65#define KL_GPIO_EXTINT_CPU1_RELEASE 0x38
66
67#define KL_GPIO_RESET_CPU0 (KEYLARGO_GPIO_EXTINT_0+0x03)
68#define KL_GPIO_RESET_CPU1 (KEYLARGO_GPIO_EXTINT_0+0x04)
69#define KL_GPIO_RESET_CPU2 (KEYLARGO_GPIO_EXTINT_0+0x0f)
70#define KL_GPIO_RESET_CPU3 (KEYLARGO_GPIO_EXTINT_0+0x10)
71
72#define KL_GPIO_PMU_MESSAGE_IRQ (KEYLARGO_GPIO_EXTINT_0+0x09)
73#define KL_GPIO_PMU_MESSAGE_BIT KEYLARGO_GPIO_INPUT_DATA
74
75#define KL_GPIO_MEDIABAY_IRQ (KEYLARGO_GPIO_EXTINT_0+0x0e)
76
77#define KL_GPIO_AIRPORT_0 (KEYLARGO_GPIO_EXTINT_0+0x0a)
78#define KL_GPIO_AIRPORT_1 (KEYLARGO_GPIO_EXTINT_0+0x0d)
79#define KL_GPIO_AIRPORT_2 (KEYLARGO_GPIO_0+0x0d)
80#define KL_GPIO_AIRPORT_3 (KEYLARGO_GPIO_0+0x0e)
81#define KL_GPIO_AIRPORT_4 (KEYLARGO_GPIO_0+0x0f)
82
83/*
84 * Bits in feature control register. Those bits different for K2 are
85 * listed separately
86 */
87#define KL_MBCR_MB0_PCI_ENABLE 0x00000800 /* exist ? */
88#define KL_MBCR_MB0_IDE_ENABLE 0x00001000
89#define KL_MBCR_MB0_FLOPPY_ENABLE 0x00002000 /* exist ? */
90#define KL_MBCR_MB0_SOUND_ENABLE 0x00004000 /* hrm... */
91#define KL_MBCR_MB0_DEV_MASK 0x00007800
92#define KL_MBCR_MB0_DEV_POWER 0x00000400
93#define KL_MBCR_MB0_DEV_RESET 0x00000200
94#define KL_MBCR_MB0_ENABLE 0x00000100
95#define KL_MBCR_MB1_PCI_ENABLE 0x08000000 /* exist ? */
96#define KL_MBCR_MB1_IDE_ENABLE 0x10000000
97#define KL_MBCR_MB1_FLOPPY_ENABLE 0x20000000 /* exist ? */
98#define KL_MBCR_MB1_SOUND_ENABLE 0x40000000 /* hrm... */
99#define KL_MBCR_MB1_DEV_MASK 0x78000000
100#define KL_MBCR_MB1_DEV_POWER 0x04000000
101#define KL_MBCR_MB1_DEV_RESET 0x02000000
102#define KL_MBCR_MB1_ENABLE 0x01000000
103
104#define KL0_SCC_B_INTF_ENABLE 0x00000001 /* (KL Only) */
105#define KL0_SCC_A_INTF_ENABLE 0x00000002
106#define KL0_SCC_SLOWPCLK 0x00000004
107#define KL0_SCC_RESET 0x00000008
108#define KL0_SCCA_ENABLE 0x00000010
109#define KL0_SCCB_ENABLE 0x00000020
110#define KL0_SCC_CELL_ENABLE 0x00000040
111#define KL0_IRDA_HIGH_BAND 0x00000100 /* (KL Only) */
112#define KL0_IRDA_SOURCE2_SEL 0x00000200 /* (KL Only) */
113#define KL0_IRDA_SOURCE1_SEL 0x00000400 /* (KL Only) */
114#define KL0_PG_USB0_PMI_ENABLE 0x00000400 /* (Pangea/Intrepid Only) */
115#define KL0_IRDA_RESET 0x00000800 /* (KL Only) */
116#define KL0_PG_USB0_REF_SUSPEND_SEL 0x00000800 /* (Pangea/Intrepid Only) */
117#define KL0_IRDA_DEFAULT1 0x00001000 /* (KL Only) */
118#define KL0_PG_USB0_REF_SUSPEND 0x00001000 /* (Pangea/Intrepid Only) */
119#define KL0_IRDA_DEFAULT0 0x00002000 /* (KL Only) */
120#define KL0_PG_USB0_PAD_SUSPEND 0x00002000 /* (Pangea/Intrepid Only) */
121#define KL0_IRDA_FAST_CONNECT 0x00004000 /* (KL Only) */
122#define KL0_PG_USB1_PMI_ENABLE 0x00004000 /* (Pangea/Intrepid Only) */
123#define KL0_IRDA_ENABLE 0x00008000 /* (KL Only) */
124#define KL0_PG_USB1_REF_SUSPEND_SEL 0x00008000 /* (Pangea/Intrepid Only) */
125#define KL0_IRDA_CLK32_ENABLE 0x00010000 /* (KL Only) */
126#define KL0_PG_USB1_REF_SUSPEND 0x00010000 /* (Pangea/Intrepid Only) */
127#define KL0_IRDA_CLK19_ENABLE 0x00020000 /* (KL Only) */
128#define KL0_PG_USB1_PAD_SUSPEND 0x00020000 /* (Pangea/Intrepid Only) */
129#define KL0_USB0_PAD_SUSPEND0 0x00040000
130#define KL0_USB0_PAD_SUSPEND1 0x00080000
131#define KL0_USB0_CELL_ENABLE 0x00100000
132#define KL0_USB1_PAD_SUSPEND0 0x00400000
133#define KL0_USB1_PAD_SUSPEND1 0x00800000
134#define KL0_USB1_CELL_ENABLE 0x01000000
135#define KL0_USB_REF_SUSPEND 0x10000000 /* (KL Only) */
136
137#define KL0_SERIAL_ENABLE (KL0_SCC_B_INTF_ENABLE | \
138 KL0_SCC_SLOWPCLK | \
139 KL0_SCC_CELL_ENABLE | KL0_SCCA_ENABLE)
140
141#define KL1_USB2_PMI_ENABLE 0x00000001 /* Intrepid only */
142#define KL1_AUDIO_SEL_22MCLK 0x00000002 /* KL/Pangea only */
143#define KL1_USB2_REF_SUSPEND_SEL 0x00000002 /* Intrepid only */
144#define KL1_USB2_REF_SUSPEND 0x00000004 /* Intrepid only */
145#define KL1_AUDIO_CLK_ENABLE_BIT 0x00000008 /* KL/Pangea only */
146#define KL1_USB2_PAD_SUSPEND_SEL 0x00000008 /* Intrepid only */
147#define KL1_USB2_PAD_SUSPEND0 0x00000010 /* Intrepid only */
148#define KL1_AUDIO_CLK_OUT_ENABLE 0x00000020 /* KL/Pangea only */
149#define KL1_USB2_PAD_SUSPEND1 0x00000020 /* Intrepid only */
150#define KL1_AUDIO_CELL_ENABLE 0x00000040 /* KL/Pangea only */
151#define KL1_USB2_CELL_ENABLE 0x00000040 /* Intrepid only */
152#define KL1_AUDIO_CHOOSE 0x00000080 /* KL/Pangea only */
153#define KL1_I2S0_CHOOSE 0x00000200 /* KL Only */
154#define KL1_I2S0_CELL_ENABLE 0x00000400
155#define KL1_I2S0_CLK_ENABLE_BIT 0x00001000
156#define KL1_I2S0_ENABLE 0x00002000
157#define KL1_I2S1_CELL_ENABLE 0x00020000
158#define KL1_I2S1_CLK_ENABLE_BIT 0x00080000
159#define KL1_I2S1_ENABLE 0x00100000
160#define KL1_EIDE0_ENABLE 0x00800000 /* KL/Intrepid Only */
161#define KL1_EIDE0_RESET_N 0x01000000 /* KL/Intrepid Only */
162#define KL1_EIDE1_ENABLE 0x04000000 /* KL Only */
163#define KL1_EIDE1_RESET_N 0x08000000 /* KL Only */
164#define KL1_UIDE_ENABLE 0x20000000 /* KL/Pangea Only */
165#define KL1_UIDE_RESET_N 0x40000000 /* KL/Pangea Only */
166
167#define KL2_IOBUS_ENABLE 0x00000002
168#define KL2_SLEEP_STATE_BIT 0x00000100 /* KL Only */
169#define KL2_PG_STOP_ALL_CLOCKS 0x00000100 /* Pangea Only */
170#define KL2_MPIC_ENABLE 0x00020000
171#define KL2_CARDSLOT_RESET 0x00040000 /* Pangea/Intrepid Only */
172#define KL2_ALT_DATA_OUT 0x02000000 /* KL Only ??? */
173#define KL2_MEM_IS_BIG 0x04000000
174#define KL2_CARDSEL_16 0x08000000
175
176#define KL3_SHUTDOWN_PLL_TOTAL 0x00000001 /* KL/Pangea only */
177#define KL3_SHUTDOWN_PLLKW6 0x00000002 /* KL/Pangea only */
178#define KL3_IT_SHUTDOWN_PLL3 0x00000002 /* Intrepid only */
179#define KL3_SHUTDOWN_PLLKW4 0x00000004 /* KL/Pangea only */
180#define KL3_IT_SHUTDOWN_PLL2 0x00000004 /* Intrepid only */
181#define KL3_SHUTDOWN_PLLKW35 0x00000008 /* KL/Pangea only */
182#define KL3_IT_SHUTDOWN_PLL1 0x00000008 /* Intrepid only */
183#define KL3_SHUTDOWN_PLLKW12 0x00000010 /* KL Only */
184#define KL3_IT_ENABLE_PLL3_SHUTDOWN 0x00000010 /* Intrepid only */
185#define KL3_PLL_RESET 0x00000020 /* KL/Pangea only */
186#define KL3_IT_ENABLE_PLL2_SHUTDOWN 0x00000020 /* Intrepid only */
187#define KL3_IT_ENABLE_PLL1_SHUTDOWN 0x00000010 /* Intrepid only */
188#define KL3_SHUTDOWN_PLL2X 0x00000080 /* KL Only */
189#define KL3_CLK66_ENABLE 0x00000100 /* KL Only */
190#define KL3_CLK49_ENABLE 0x00000200
191#define KL3_CLK45_ENABLE 0x00000400
192#define KL3_CLK31_ENABLE 0x00000800 /* KL/Pangea only */
193#define KL3_TIMER_CLK18_ENABLE 0x00001000
194#define KL3_I2S1_CLK18_ENABLE 0x00002000
195#define KL3_I2S0_CLK18_ENABLE 0x00004000
196#define KL3_VIA_CLK16_ENABLE 0x00008000 /* KL/Pangea only */
197#define KL3_IT_VIA_CLK32_ENABLE 0x00008000 /* Intrepid only */
198#define KL3_STOPPING33_ENABLED 0x00080000 /* KL Only */
199#define KL3_PG_PLL_ENABLE_TEST 0x00080000 /* Pangea Only */
200
201/* Intrepid USB bus 2, port 0,1 */
202#define KL3_IT_PORT_WAKEUP_ENABLE(p) (0x00080000 << ((p)<<3))
203#define KL3_IT_PORT_RESUME_WAKE_EN(p) (0x00040000 << ((p)<<3))
204#define KL3_IT_PORT_CONNECT_WAKE_EN(p) (0x00020000 << ((p)<<3))
205#define KL3_IT_PORT_DISCONNECT_WAKE_EN(p) (0x00010000 << ((p)<<3))
206#define KL3_IT_PORT_RESUME_STAT(p) (0x00300000 << ((p)<<3))
207#define KL3_IT_PORT_CONNECT_STAT(p) (0x00200000 << ((p)<<3))
208#define KL3_IT_PORT_DISCONNECT_STAT(p) (0x00100000 << ((p)<<3))
209
210/* Port 0,1 : bus 0, port 2,3 : bus 1 */
211#define KL4_PORT_WAKEUP_ENABLE(p) (0x00000008 << ((p)<<3))
212#define KL4_PORT_RESUME_WAKE_EN(p) (0x00000004 << ((p)<<3))
213#define KL4_PORT_CONNECT_WAKE_EN(p) (0x00000002 << ((p)<<3))
214#define KL4_PORT_DISCONNECT_WAKE_EN(p) (0x00000001 << ((p)<<3))
215#define KL4_PORT_RESUME_STAT(p) (0x00000040 << ((p)<<3))
216#define KL4_PORT_CONNECT_STAT(p) (0x00000020 << ((p)<<3))
217#define KL4_PORT_DISCONNECT_STAT(p) (0x00000010 << ((p)<<3))
218
219/* Pangea and Intrepid only */
220#define KL5_VIA_USE_CLK31 0000000001 /* Pangea Only */
221#define KL5_SCC_USE_CLK31 0x00000002 /* Pangea Only */
222#define KL5_PWM_CLK32_EN 0x00000004
223#define KL5_CLK3_68_EN 0x00000010
224#define KL5_CLK32_EN 0x00000020
225
226
227/* K2 definitions */
228#define K2_FCR0_USB0_SWRESET 0x00200000
229#define K2_FCR0_USB1_SWRESET 0x02000000
230#define K2_FCR0_RING_PME_DISABLE 0x08000000
231
232#define K2_FCR1_PCI1_BUS_RESET_N 0x00000010
233#define K2_FCR1_PCI1_SLEEP_RESET_EN 0x00000020
234#define K2_FCR1_I2S0_CELL_ENABLE 0x00000400
235#define K2_FCR1_I2S0_RESET 0x00000800
236#define K2_FCR1_I2S0_CLK_ENABLE_BIT 0x00001000
237#define K2_FCR1_I2S0_ENABLE 0x00002000
238#define K2_FCR1_PCI1_CLK_ENABLE 0x00004000
239#define K2_FCR1_FW_CLK_ENABLE 0x00008000
240#define K2_FCR1_FW_RESET_N 0x00010000
241#define K2_FCR1_I2S1_CELL_ENABLE 0x00020000
242#define K2_FCR1_I2S1_CLK_ENABLE_BIT 0x00080000
243#define K2_FCR1_I2S1_ENABLE 0x00100000
244#define K2_FCR1_GMAC_CLK_ENABLE 0x00400000
245#define K2_FCR1_GMAC_POWER_DOWN 0x00800000
246#define K2_FCR1_GMAC_RESET_N 0x01000000
247#define K2_FCR1_SATA_CLK_ENABLE 0x02000000
248#define K2_FCR1_SATA_POWER_DOWN 0x04000000
249#define K2_FCR1_SATA_RESET_N 0x08000000
250#define K2_FCR1_UATA_CLK_ENABLE 0x10000000
251#define K2_FCR1_UATA_RESET_N 0x40000000
252#define K2_FCR1_UATA_CHOOSE_CLK66 0x80000000
253
254/* Shasta definitions */
255#define SH_FCR1_I2S2_CELL_ENABLE 0x00000010
256#define SH_FCR1_I2S2_CLK_ENABLE_BIT 0x00000040
257#define SH_FCR1_I2S2_ENABLE 0x00000080
258#define SH_FCR3_I2S2_CLK18_ENABLE 0x00008000
259
260#endif /* __KERNEL__ */
261#endif /* _ASM_POWERPC_KEYLARGO_H */
diff --git a/arch/powerpc/include/asm/kgdb.h b/arch/powerpc/include/asm/kgdb.h
new file mode 100644
index 000000000000..edd217006d27
--- /dev/null
+++ b/arch/powerpc/include/asm/kgdb.h
@@ -0,0 +1,63 @@
1/*
2 * The PowerPC (32/64) specific defines / externs for KGDB. Based on
3 * the previous 32bit and 64bit specific files, which had the following
4 * copyrights:
5 *
6 * PPC64 Mods (C) 2005 Frank Rowand (frowand@mvista.com)
7 * PPC Mods (C) 2004 Tom Rini (trini@mvista.com)
8 * PPC Mods (C) 2003 John Whitney (john.whitney@timesys.com)
9 * PPC Mods (C) 1998 Michael Tesch (tesch@cs.wisc.edu)
10 *
11 *
12 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
13 * Author: Tom Rini <trini@kernel.crashing.org>
14 *
15 * 2006 (c) MontaVista Software, Inc. This file is licensed under
16 * the terms of the GNU General Public License version 2. This program
17 * is licensed "as is" without any warranty of any kind, whether express
18 * or implied.
19 */
20#ifdef __KERNEL__
21#ifndef __POWERPC_KGDB_H__
22#define __POWERPC_KGDB_H__
23
24#ifndef __ASSEMBLY__
25
26#define BREAK_INSTR_SIZE 4
27#define BUFMAX ((NUMREGBYTES * 2) + 512)
28#define OUTBUFMAX ((NUMREGBYTES * 2) + 512)
29static inline void arch_kgdb_breakpoint(void)
30{
31 asm(".long 0x7d821008"); /* twge r2, r2 */
32}
33#define CACHE_FLUSH_IS_SAFE 1
34
35/* The number bytes of registers we have to save depends on a few
36 * things. For 64bit we default to not including vector registers and
37 * vector state registers. */
38#ifdef CONFIG_PPC64
39/*
40 * 64 bit (8 byte) registers:
41 * 32 gpr, 32 fpr, nip, msr, link, ctr
42 * 32 bit (4 byte) registers:
43 * ccr, xer, fpscr
44 */
45#define NUMREGBYTES ((68 * 8) + (3 * 4))
46#define NUMCRITREGBYTES 184
47#else /* CONFIG_PPC32 */
48/* On non-E500 family PPC32 we determine the size by picking the last
49 * register we need, but on E500 we skip sections so we list what we
50 * need to store, and add it up. */
51#ifndef CONFIG_E500
52#define MAXREG (PT_FPSCR+1)
53#else
54/* 32 GPRs (8 bytes), nip, msr, ccr, link, ctr, xer, acc (8 bytes), spefscr*/
55#define MAXREG ((32*2)+6+2+1)
56#endif
57#define NUMREGBYTES (MAXREG * sizeof(int))
58/* CR/LR, R1, R2, R13-R31 inclusive. */
59#define NUMCRITREGBYTES (23 * sizeof(int))
60#endif /* 32/64 */
61#endif /* !(__ASSEMBLY__) */
62#endif /* !__POWERPC_KGDB_H__ */
63#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/kmap_types.h b/arch/powerpc/include/asm/kmap_types.h
new file mode 100644
index 000000000000..b6bac6f61c16
--- /dev/null
+++ b/arch/powerpc/include/asm/kmap_types.h
@@ -0,0 +1,33 @@
1#ifndef _ASM_POWERPC_KMAP_TYPES_H
2#define _ASM_POWERPC_KMAP_TYPES_H
3
4#ifdef __KERNEL__
5
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
13enum km_type {
14 KM_BOUNCE_READ,
15 KM_SKB_SUNRPC_DATA,
16 KM_SKB_DATA_SOFTIRQ,
17 KM_USER0,
18 KM_USER1,
19 KM_BIO_SRC_IRQ,
20 KM_BIO_DST_IRQ,
21 KM_PTE0,
22 KM_PTE1,
23 KM_IRQ0,
24 KM_IRQ1,
25 KM_SOFTIRQ0,
26 KM_SOFTIRQ1,
27 KM_PPC_SYNC_PAGE,
28 KM_PPC_SYNC_ICACHE,
29 KM_TYPE_NR
30};
31
32#endif /* __KERNEL__ */
33#endif /* _ASM_POWERPC_KMAP_TYPES_H */
diff --git a/arch/powerpc/include/asm/kprobes.h b/arch/powerpc/include/asm/kprobes.h
new file mode 100644
index 000000000000..d0e7701fa1f6
--- /dev/null
+++ b/arch/powerpc/include/asm/kprobes.h
@@ -0,0 +1,118 @@
1#ifndef _ASM_POWERPC_KPROBES_H
2#define _ASM_POWERPC_KPROBES_H
3#ifdef __KERNEL__
4/*
5 * Kernel Probes (KProbes)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * Copyright (C) IBM Corporation, 2002, 2004
22 *
23 * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel
24 * Probes initial implementation ( includes suggestions from
25 * Rusty Russell).
26 * 2004-Nov Modified for PPC64 by Ananth N Mavinakayanahalli
27 * <ananth@in.ibm.com>
28 */
29#include <linux/types.h>
30#include <linux/ptrace.h>
31#include <linux/percpu.h>
32
33#define __ARCH_WANT_KPROBES_INSN_SLOT
34
35struct pt_regs;
36struct kprobe;
37
38typedef unsigned int kprobe_opcode_t;
39#define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */
40#define MAX_INSN_SIZE 1
41
42#define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008)
43#define IS_TD(instr) (((instr) & 0xfc0007fe) == 0x7c000088)
44#define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000)
45#define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000)
46
47#ifdef CONFIG_PPC64
48/*
49 * 64bit powerpc uses function descriptors.
50 * Handle cases where:
51 * - User passes a <.symbol> or <module:.symbol>
52 * - User passes a <symbol> or <module:symbol>
53 * - User passes a non-existant symbol, kallsyms_lookup_name
54 * returns 0. Don't deref the NULL pointer in that case
55 */
56#define kprobe_lookup_name(name, addr) \
57{ \
58 addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); \
59 if (addr) { \
60 char *colon; \
61 if ((colon = strchr(name, ':')) != NULL) { \
62 colon++; \
63 if (*colon != '\0' && *colon != '.') \
64 addr = *(kprobe_opcode_t **)addr; \
65 } else if (name[0] != '.') \
66 addr = *(kprobe_opcode_t **)addr; \
67 } else { \
68 char dot_name[KSYM_NAME_LEN]; \
69 dot_name[0] = '.'; \
70 dot_name[1] = '\0'; \
71 strncat(dot_name, name, KSYM_NAME_LEN - 2); \
72 addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \
73 } \
74}
75
76#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \
77 IS_TWI(instr) || IS_TDI(instr))
78#else
79/* Use stock kprobe_lookup_name since ppc32 doesn't use function descriptors */
80#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
81#endif
82
83#define flush_insn_slot(p) do { } while (0)
84#define kretprobe_blacklist_size 0
85
86void kretprobe_trampoline(void);
87extern void arch_remove_kprobe(struct kprobe *p);
88
89/* Architecture specific copy of original instruction */
90struct arch_specific_insn {
91 /* copy of original instruction */
92 kprobe_opcode_t *insn;
93 /*
94 * Set in kprobes code, initially to 0. If the instruction can be
95 * eumulated, this is set to 1, if not, to -1.
96 */
97 int boostable;
98};
99
100struct prev_kprobe {
101 struct kprobe *kp;
102 unsigned long status;
103 unsigned long saved_msr;
104};
105
106/* per-cpu kprobe control block */
107struct kprobe_ctlblk {
108 unsigned long kprobe_status;
109 unsigned long kprobe_saved_msr;
110 struct pt_regs jprobe_saved_regs;
111 struct prev_kprobe prev_kprobe;
112};
113
114extern int kprobe_exceptions_notify(struct notifier_block *self,
115 unsigned long val, void *data);
116extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
117#endif /* __KERNEL__ */
118#endif /* _ASM_POWERPC_KPROBES_H */
diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h
new file mode 100644
index 000000000000..f993e4198d5c
--- /dev/null
+++ b/arch/powerpc/include/asm/kvm.h
@@ -0,0 +1,55 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2007
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __LINUX_KVM_POWERPC_H
21#define __LINUX_KVM_POWERPC_H
22
23#include <asm/types.h>
24
25struct kvm_regs {
26 __u64 pc;
27 __u64 cr;
28 __u64 ctr;
29 __u64 lr;
30 __u64 xer;
31 __u64 msr;
32 __u64 srr0;
33 __u64 srr1;
34 __u64 pid;
35
36 __u64 sprg0;
37 __u64 sprg1;
38 __u64 sprg2;
39 __u64 sprg3;
40 __u64 sprg4;
41 __u64 sprg5;
42 __u64 sprg6;
43 __u64 sprg7;
44
45 __u64 gpr[32];
46};
47
48struct kvm_sregs {
49};
50
51struct kvm_fpu {
52 __u64 fpr[32];
53};
54
55#endif /* __LINUX_KVM_POWERPC_H */
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
new file mode 100644
index 000000000000..2197764796d9
--- /dev/null
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -0,0 +1,55 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __POWERPC_KVM_ASM_H__
21#define __POWERPC_KVM_ASM_H__
22
23/* IVPR must be 64KiB-aligned. */
24#define VCPU_SIZE_ORDER 4
25#define VCPU_SIZE_LOG (VCPU_SIZE_ORDER + 12)
26#define VCPU_TLB_PGSZ PPC44x_TLB_64K
27#define VCPU_SIZE_BYTES (1<<VCPU_SIZE_LOG)
28
29#define BOOKE_INTERRUPT_CRITICAL 0
30#define BOOKE_INTERRUPT_MACHINE_CHECK 1
31#define BOOKE_INTERRUPT_DATA_STORAGE 2
32#define BOOKE_INTERRUPT_INST_STORAGE 3
33#define BOOKE_INTERRUPT_EXTERNAL 4
34#define BOOKE_INTERRUPT_ALIGNMENT 5
35#define BOOKE_INTERRUPT_PROGRAM 6
36#define BOOKE_INTERRUPT_FP_UNAVAIL 7
37#define BOOKE_INTERRUPT_SYSCALL 8
38#define BOOKE_INTERRUPT_AP_UNAVAIL 9
39#define BOOKE_INTERRUPT_DECREMENTER 10
40#define BOOKE_INTERRUPT_FIT 11
41#define BOOKE_INTERRUPT_WATCHDOG 12
42#define BOOKE_INTERRUPT_DTLB_MISS 13
43#define BOOKE_INTERRUPT_ITLB_MISS 14
44#define BOOKE_INTERRUPT_DEBUG 15
45#define BOOKE_MAX_INTERRUPT 15
46
47#define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */
48#define RESUME_FLAG_HOST (1<<1) /* Resume host? */
49
50#define RESUME_GUEST 0
51#define RESUME_GUEST_NV RESUME_FLAG_NV
52#define RESUME_HOST RESUME_FLAG_HOST
53#define RESUME_HOST_NV (RESUME_FLAG_HOST|RESUME_FLAG_NV)
54
55#endif /* __POWERPC_KVM_ASM_H__ */
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
new file mode 100644
index 000000000000..2655e2a4831e
--- /dev/null
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -0,0 +1,155 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2007
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __POWERPC_KVM_HOST_H__
21#define __POWERPC_KVM_HOST_H__
22
23#include <linux/mutex.h>
24#include <linux/timer.h>
25#include <linux/types.h>
26#include <linux/kvm_types.h>
27#include <asm/kvm_asm.h>
28
29#define KVM_MAX_VCPUS 1
30#define KVM_MEMORY_SLOTS 32
31/* memory slots that does not exposed to userspace */
32#define KVM_PRIVATE_MEM_SLOTS 4
33
34#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
35
36/* We don't currently support large pages. */
37#define KVM_PAGES_PER_HPAGE (1<<31)
38
39struct kvm;
40struct kvm_run;
41struct kvm_vcpu;
42
43struct kvm_vm_stat {
44 u32 remote_tlb_flush;
45};
46
47struct kvm_vcpu_stat {
48 u32 sum_exits;
49 u32 mmio_exits;
50 u32 dcr_exits;
51 u32 signal_exits;
52 u32 light_exits;
53 /* Account for special types of light exits: */
54 u32 itlb_real_miss_exits;
55 u32 itlb_virt_miss_exits;
56 u32 dtlb_real_miss_exits;
57 u32 dtlb_virt_miss_exits;
58 u32 syscall_exits;
59 u32 isi_exits;
60 u32 dsi_exits;
61 u32 emulated_inst_exits;
62 u32 dec_exits;
63 u32 ext_intr_exits;
64 u32 halt_wakeup;
65};
66
67struct tlbe {
68 u32 tid; /* Only the low 8 bits are used. */
69 u32 word0;
70 u32 word1;
71 u32 word2;
72};
73
74struct kvm_arch {
75};
76
77struct kvm_vcpu_arch {
78 /* Unmodified copy of the guest's TLB. */
79 struct tlbe guest_tlb[PPC44x_TLB_SIZE];
80 /* TLB that's actually used when the guest is running. */
81 struct tlbe shadow_tlb[PPC44x_TLB_SIZE];
82 /* Pages which are referenced in the shadow TLB. */
83 struct page *shadow_pages[PPC44x_TLB_SIZE];
84 /* Copy of the host's TLB. */
85 struct tlbe host_tlb[PPC44x_TLB_SIZE];
86
87 u32 host_stack;
88 u32 host_pid;
89
90 u64 fpr[32];
91 u32 gpr[32];
92
93 u32 pc;
94 u32 cr;
95 u32 ctr;
96 u32 lr;
97 u32 xer;
98
99 u32 msr;
100 u32 mmucr;
101 u32 sprg0;
102 u32 sprg1;
103 u32 sprg2;
104 u32 sprg3;
105 u32 sprg4;
106 u32 sprg5;
107 u32 sprg6;
108 u32 sprg7;
109 u32 srr0;
110 u32 srr1;
111 u32 csrr0;
112 u32 csrr1;
113 u32 dsrr0;
114 u32 dsrr1;
115 u32 dear;
116 u32 esr;
117 u32 dec;
118 u32 decar;
119 u32 tbl;
120 u32 tbu;
121 u32 tcr;
122 u32 tsr;
123 u32 ivor[16];
124 u32 ivpr;
125 u32 pir;
126 u32 pid;
127 u32 pvr;
128 u32 ccr0;
129 u32 ccr1;
130 u32 dbcr0;
131 u32 dbcr1;
132
133 u32 last_inst;
134 u32 fault_dear;
135 u32 fault_esr;
136 gpa_t paddr_accessed;
137
138 u8 io_gpr; /* GPR used as IO source/target */
139 u8 mmio_is_bigendian;
140 u8 dcr_needed;
141 u8 dcr_is_write;
142
143 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */
144
145 struct timer_list dec_timer;
146 unsigned long pending_exceptions;
147};
148
149struct kvm_guest_debug {
150 int enabled;
151 unsigned long bp[4];
152 int singlestep;
153};
154
155#endif /* __POWERPC_KVM_HOST_H__ */
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
new file mode 100644
index 000000000000..2d48f6a63d0b
--- /dev/null
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -0,0 +1,37 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __POWERPC_KVM_PARA_H__
21#define __POWERPC_KVM_PARA_H__
22
23#ifdef __KERNEL__
24
25static inline int kvm_para_available(void)
26{
27 return 0;
28}
29
30static inline unsigned int kvm_arch_para_features(void)
31{
32 return 0;
33}
34
35#endif /* __KERNEL__ */
36
37#endif /* __POWERPC_KVM_PARA_H__ */
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
new file mode 100644
index 000000000000..a8b068792260
--- /dev/null
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -0,0 +1,95 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __POWERPC_KVM_PPC_H__
21#define __POWERPC_KVM_PPC_H__
22
23/* This file exists just so we can dereference kvm_vcpu, avoiding nested header
24 * dependencies. */
25
26#include <linux/mutex.h>
27#include <linux/timer.h>
28#include <linux/types.h>
29#include <linux/kvm_types.h>
30#include <linux/kvm_host.h>
31
32struct kvm_tlb {
33 struct tlbe guest_tlb[PPC44x_TLB_SIZE];
34 struct tlbe shadow_tlb[PPC44x_TLB_SIZE];
35};
36
37enum emulation_result {
38 EMULATE_DONE, /* no further processing */
39 EMULATE_DO_MMIO, /* kvm_run filled with MMIO request */
40 EMULATE_DO_DCR, /* kvm_run filled with DCR request */
41 EMULATE_FAIL, /* can't emulate this instruction */
42};
43
44extern const unsigned char exception_priority[];
45extern const unsigned char priority_exception[];
46
47extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
48extern char kvmppc_handlers_start[];
49extern unsigned long kvmppc_handler_len;
50
51extern void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu);
52extern int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
53 unsigned int rt, unsigned int bytes,
54 int is_bigendian);
55extern int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
56 u32 val, unsigned int bytes, int is_bigendian);
57
58extern int kvmppc_emulate_instruction(struct kvm_run *run,
59 struct kvm_vcpu *vcpu);
60extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu);
61
62extern void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn,
63 u64 asid, u32 flags);
64extern void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr,
65 gva_t eend, u32 asid);
66extern void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode);
67
68extern void kvmppc_check_and_deliver_interrupts(struct kvm_vcpu *vcpu);
69
70static inline void kvmppc_queue_exception(struct kvm_vcpu *vcpu, int exception)
71{
72 unsigned int priority = exception_priority[exception];
73 set_bit(priority, &vcpu->arch.pending_exceptions);
74}
75
76static inline void kvmppc_clear_exception(struct kvm_vcpu *vcpu, int exception)
77{
78 unsigned int priority = exception_priority[exception];
79 clear_bit(priority, &vcpu->arch.pending_exceptions);
80}
81
82/* Helper function for "full" MSR writes. No need to call this if only EE is
83 * changing. */
84static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr)
85{
86 if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR))
87 kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR);
88
89 vcpu->arch.msr = new_msr;
90
91 if (vcpu->arch.msr & MSR_WE)
92 kvm_vcpu_block(vcpu);
93}
94
95#endif /* __POWERPC_KVM_PPC_H__ */
diff --git a/arch/powerpc/include/asm/libata-portmap.h b/arch/powerpc/include/asm/libata-portmap.h
new file mode 100644
index 000000000000..4d8518049f4d
--- /dev/null
+++ b/arch/powerpc/include/asm/libata-portmap.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_POWERPC_LIBATA_PORTMAP_H
2#define __ASM_POWERPC_LIBATA_PORTMAP_H
3
4#define ATA_PRIMARY_CMD 0x1F0
5#define ATA_PRIMARY_CTL 0x3F6
6#define ATA_PRIMARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 0)
7
8#define ATA_SECONDARY_CMD 0x170
9#define ATA_SECONDARY_CTL 0x376
10#define ATA_SECONDARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 1)
11
12#endif
diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h
new file mode 100644
index 000000000000..e1c4ac1cc4ba
--- /dev/null
+++ b/arch/powerpc/include/asm/linkage.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_POWERPC_LINKAGE_H
2#define _ASM_POWERPC_LINKAGE_H
3
4/* Nothing to see here... */
5
6#endif /* _ASM_POWERPC_LINKAGE_H */
diff --git a/arch/powerpc/include/asm/lmb.h b/arch/powerpc/include/asm/lmb.h
new file mode 100644
index 000000000000..6f5fdf0a19ae
--- /dev/null
+++ b/arch/powerpc/include/asm/lmb.h
@@ -0,0 +1,15 @@
1#ifndef _ASM_POWERPC_LMB_H
2#define _ASM_POWERPC_LMB_H
3
4#include <asm/udbg.h>
5
6#define LMB_DBG(fmt...) udbg_printf(fmt)
7
8#ifdef CONFIG_PPC32
9extern phys_addr_t lowmem_end_addr;
10#define LMB_REAL_LIMIT lowmem_end_addr
11#else
12#define LMB_REAL_LIMIT 0
13#endif
14
15#endif /* _ASM_POWERPC_LMB_H */
diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
new file mode 100644
index 000000000000..612d83276653
--- /dev/null
+++ b/arch/powerpc/include/asm/local.h
@@ -0,0 +1,200 @@
1#ifndef _ARCH_POWERPC_LOCAL_H
2#define _ARCH_POWERPC_LOCAL_H
3
4#include <linux/percpu.h>
5#include <asm/atomic.h>
6
7typedef struct
8{
9 atomic_long_t a;
10} local_t;
11
12#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
13
14#define local_read(l) atomic_long_read(&(l)->a)
15#define local_set(l,i) atomic_long_set(&(l)->a, (i))
16
17#define local_add(i,l) atomic_long_add((i),(&(l)->a))
18#define local_sub(i,l) atomic_long_sub((i),(&(l)->a))
19#define local_inc(l) atomic_long_inc(&(l)->a)
20#define local_dec(l) atomic_long_dec(&(l)->a)
21
22static __inline__ long local_add_return(long a, local_t *l)
23{
24 long t;
25
26 __asm__ __volatile__(
27"1:" PPC_LLARX "%0,0,%2 # local_add_return\n\
28 add %0,%1,%0\n"
29 PPC405_ERR77(0,%2)
30 PPC_STLCX "%0,0,%2 \n\
31 bne- 1b"
32 : "=&r" (t)
33 : "r" (a), "r" (&(l->a.counter))
34 : "cc", "memory");
35
36 return t;
37}
38
39#define local_add_negative(a, l) (local_add_return((a), (l)) < 0)
40
41static __inline__ long local_sub_return(long a, local_t *l)
42{
43 long t;
44
45 __asm__ __volatile__(
46"1:" PPC_LLARX "%0,0,%2 # local_sub_return\n\
47 subf %0,%1,%0\n"
48 PPC405_ERR77(0,%2)
49 PPC_STLCX "%0,0,%2 \n\
50 bne- 1b"
51 : "=&r" (t)
52 : "r" (a), "r" (&(l->a.counter))
53 : "cc", "memory");
54
55 return t;
56}
57
58static __inline__ long local_inc_return(local_t *l)
59{
60 long t;
61
62 __asm__ __volatile__(
63"1:" PPC_LLARX "%0,0,%1 # local_inc_return\n\
64 addic %0,%0,1\n"
65 PPC405_ERR77(0,%1)
66 PPC_STLCX "%0,0,%1 \n\
67 bne- 1b"
68 : "=&r" (t)
69 : "r" (&(l->a.counter))
70 : "cc", "memory");
71
72 return t;
73}
74
75/*
76 * local_inc_and_test - increment and test
77 * @l: pointer of type local_t
78 *
79 * Atomically increments @l by 1
80 * and returns true if the result is zero, or false for all
81 * other cases.
82 */
83#define local_inc_and_test(l) (local_inc_return(l) == 0)
84
85static __inline__ long local_dec_return(local_t *l)
86{
87 long t;
88
89 __asm__ __volatile__(
90"1:" PPC_LLARX "%0,0,%1 # local_dec_return\n\
91 addic %0,%0,-1\n"
92 PPC405_ERR77(0,%1)
93 PPC_STLCX "%0,0,%1\n\
94 bne- 1b"
95 : "=&r" (t)
96 : "r" (&(l->a.counter))
97 : "cc", "memory");
98
99 return t;
100}
101
102#define local_cmpxchg(l, o, n) \
103 (cmpxchg_local(&((l)->a.counter), (o), (n)))
104#define local_xchg(l, n) (xchg_local(&((l)->a.counter), (n)))
105
106/**
107 * local_add_unless - add unless the number is a given value
108 * @l: pointer of type local_t
109 * @a: the amount to add to v...
110 * @u: ...unless v is equal to u.
111 *
112 * Atomically adds @a to @l, so long as it was not @u.
113 * Returns non-zero if @l was not @u, and zero otherwise.
114 */
115static __inline__ int local_add_unless(local_t *l, long a, long u)
116{
117 long t;
118
119 __asm__ __volatile__ (
120"1:" PPC_LLARX "%0,0,%1 # local_add_unless\n\
121 cmpw 0,%0,%3 \n\
122 beq- 2f \n\
123 add %0,%2,%0 \n"
124 PPC405_ERR77(0,%2)
125 PPC_STLCX "%0,0,%1 \n\
126 bne- 1b \n"
127" subf %0,%2,%0 \n\
1282:"
129 : "=&r" (t)
130 : "r" (&(l->a.counter)), "r" (a), "r" (u)
131 : "cc", "memory");
132
133 return t != u;
134}
135
136#define local_inc_not_zero(l) local_add_unless((l), 1, 0)
137
138#define local_sub_and_test(a, l) (local_sub_return((a), (l)) == 0)
139#define local_dec_and_test(l) (local_dec_return((l)) == 0)
140
141/*
142 * Atomically test *l and decrement if it is greater than 0.
143 * The function returns the old value of *l minus 1.
144 */
145static __inline__ long local_dec_if_positive(local_t *l)
146{
147 long t;
148
149 __asm__ __volatile__(
150"1:" PPC_LLARX "%0,0,%1 # local_dec_if_positive\n\
151 cmpwi %0,1\n\
152 addi %0,%0,-1\n\
153 blt- 2f\n"
154 PPC405_ERR77(0,%1)
155 PPC_STLCX "%0,0,%1\n\
156 bne- 1b"
157 "\n\
1582:" : "=&b" (t)
159 : "r" (&(l->a.counter))
160 : "cc", "memory");
161
162 return t;
163}
164
165/* Use these for per-cpu local_t variables: on some archs they are
166 * much more efficient than these naive implementations. Note they take
167 * a variable, not an address.
168 */
169
170#define __local_inc(l) ((l)->a.counter++)
171#define __local_dec(l) ((l)->a.counter++)
172#define __local_add(i,l) ((l)->a.counter+=(i))
173#define __local_sub(i,l) ((l)->a.counter-=(i))
174
175/* Need to disable preemption for the cpu local counters otherwise we could
176 still access a variable of a previous CPU in a non atomic way. */
177#define cpu_local_wrap_v(l) \
178 ({ local_t res__; \
179 preempt_disable(); \
180 res__ = (l); \
181 preempt_enable(); \
182 res__; })
183#define cpu_local_wrap(l) \
184 ({ preempt_disable(); \
185 l; \
186 preempt_enable(); }) \
187
188#define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
189#define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
190#define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l)))
191#define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l)))
192#define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l)))
193#define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l)))
194
195#define __cpu_local_inc(l) cpu_local_inc(l)
196#define __cpu_local_dec(l) cpu_local_dec(l)
197#define __cpu_local_add(i, l) cpu_local_add((i), (l))
198#define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
199
200#endif /* _ARCH_POWERPC_LOCAL_H */
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h
new file mode 100644
index 000000000000..2fe268b10333
--- /dev/null
+++ b/arch/powerpc/include/asm/lppaca.h
@@ -0,0 +1,159 @@
1/*
2 * lppaca.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
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#ifndef _ASM_POWERPC_LPPACA_H
20#define _ASM_POWERPC_LPPACA_H
21#ifdef __KERNEL__
22
23//=============================================================================
24//
25// This control block contains the data that is shared between the
26// hypervisor (PLIC) and the OS.
27//
28//
29//----------------------------------------------------------------------------
30#include <linux/cache.h>
31#include <asm/types.h>
32#include <asm/mmu.h>
33
34/* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k
35 * alignment is sufficient to prevent this */
36struct lppaca {
37//=============================================================================
38// CACHE_LINE_1 0x0000 - 0x007F Contains read-only data
39// NOTE: The xDynXyz fields are fields that will be dynamically changed by
40// PLIC when preparing to bring a processor online or when dispatching a
41// virtual processor!
42//=============================================================================
43 u32 desc; // Eye catcher 0xD397D781 x00-x03
44 u16 size; // Size of this struct x04-x05
45 u16 reserved1; // Reserved x06-x07
46 u16 reserved2:14; // Reserved x08-x09
47 u8 shared_proc:1; // Shared processor indicator ...
48 u8 secondary_thread:1; // Secondary thread indicator ...
49 volatile u8 dyn_proc_status:8; // Dynamic Status of this proc x0A-x0A
50 u8 secondary_thread_count; // Secondary thread count x0B-x0B
51 volatile u16 dyn_hv_phys_proc_index;// Dynamic HV Physical Proc Index0C-x0D
52 volatile u16 dyn_hv_log_proc_index;// Dynamic HV Logical Proc Indexx0E-x0F
53 u32 decr_val; // Value for Decr programming x10-x13
54 u32 pmc_val; // Value for PMC regs x14-x17
55 volatile u32 dyn_hw_node_id; // Dynamic Hardware Node id x18-x1B
56 volatile u32 dyn_hw_proc_id; // Dynamic Hardware Proc Id x1C-x1F
57 volatile u32 dyn_pir; // Dynamic ProcIdReg value x20-x23
58 u32 dsei_data; // DSEI data x24-x27
59 u64 sprg3; // SPRG3 value x28-x2F
60 u8 reserved3[80]; // Reserved x30-x7F
61
62//=============================================================================
63// CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data
64//=============================================================================
65 // This Dword contains a byte for each type of interrupt that can occur.
66 // The IPI is a count while the others are just a binary 1 or 0.
67 union {
68 u64 any_int;
69 struct {
70 u16 reserved; // Reserved - cleared by #mpasmbl
71 u8 xirr_int; // Indicates xXirrValue is valid or Immed IO
72 u8 ipi_cnt; // IPI Count
73 u8 decr_int; // DECR interrupt occurred
74 u8 pdc_int; // PDC interrupt occurred
75 u8 quantum_int; // Interrupt quantum reached
76 u8 old_plic_deferred_ext_int; // Old PLIC has a deferred XIRR pending
77 } fields;
78 } int_dword;
79
80 // Whenever any fields in this Dword are set then PLIC will defer the
81 // processing of external interrupts. Note that PLIC will store the
82 // XIRR directly into the xXirrValue field so that another XIRR will
83 // not be presented until this one clears. The layout of the low
84 // 4-bytes of this Dword is upto SLIC - PLIC just checks whether the
85 // entire Dword is zero or not. A non-zero value in the low order
86 // 2-bytes will result in SLIC being granted the highest thread
87 // priority upon return. A 0 will return to SLIC as medium priority.
88 u64 plic_defer_ints_area; // Entire Dword
89
90 // Used to pass the real SRR0/1 from PLIC to SLIC as well as to
91 // pass the target SRR0/1 from SLIC to PLIC on a SetAsrAndRfid.
92 u64 saved_srr0; // Saved SRR0 x10-x17
93 u64 saved_srr1; // Saved SRR1 x18-x1F
94
95 // Used to pass parms from the OS to PLIC for SetAsrAndRfid
96 u64 saved_gpr3; // Saved GPR3 x20-x27
97 u64 saved_gpr4; // Saved GPR4 x28-x2F
98 u64 saved_gpr5; // Saved GPR5 x30-x37
99
100 u8 reserved4; // Reserved x38-x38
101 u8 donate_dedicated_cpu; // Donate dedicated CPU cycles x39-x39
102 u8 fpregs_in_use; // FP regs in use x3A-x3A
103 u8 pmcregs_in_use; // PMC regs in use x3B-x3B
104 volatile u32 saved_decr; // Saved Decr Value x3C-x3F
105 volatile u64 emulated_time_base;// Emulated TB for this thread x40-x47
106 volatile u64 cur_plic_latency; // Unaccounted PLIC latency x48-x4F
107 u64 tot_plic_latency; // Accumulated PLIC latency x50-x57
108 u64 wait_state_cycles; // Wait cycles for this proc x58-x5F
109 u64 end_of_quantum; // TB at end of quantum x60-x67
110 u64 pdc_saved_sprg1; // Saved SPRG1 for PMC int x68-x6F
111 u64 pdc_saved_srr0; // Saved SRR0 for PMC int x70-x77
112 volatile u32 virtual_decr; // Virtual DECR for shared procsx78-x7B
113 u16 slb_count; // # of SLBs to maintain x7C-x7D
114 u8 idle; // Indicate OS is idle x7E
115 u8 vmxregs_in_use; // VMX registers in use x7F
116
117
118//=============================================================================
119// CACHE_LINE_3 0x0100 - 0x017F: This line is shared with other processors
120//=============================================================================
121 // This is the yield_count. An "odd" value (low bit on) means that
122 // the processor is yielded (either because of an OS yield or a PLIC
123 // preempt). An even value implies that the processor is currently
124 // executing.
125 // NOTE: This value will ALWAYS be zero for dedicated processors and
126 // will NEVER be zero for shared processors (ie, initialized to a 1).
127 volatile u32 yield_count; // PLIC increments each dispatchx00-x03
128 u32 reserved6;
129 volatile u64 cmo_faults; // CMO page fault count x08-x0F
130 volatile u64 cmo_fault_time; // CMO page fault time x10-x17
131 u8 reserved7[104]; // Reserved x18-x7F
132
133//=============================================================================
134// CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data
135//=============================================================================
136 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF
137} __attribute__((__aligned__(0x400)));
138
139extern struct lppaca lppaca[];
140
141/*
142 * SLB shadow buffer structure as defined in the PAPR. The save_area
143 * contains adjacent ESID and VSID pairs for each shadowed SLB. The
144 * ESID is stored in the lower 64bits, then the VSID.
145 */
146struct slb_shadow {
147 u32 persistent; // Number of persistent SLBs x00-x03
148 u32 buffer_length; // Total shadow buffer length x04-x07
149 u64 reserved; // Alignment x08-x0f
150 struct {
151 u64 esid;
152 u64 vsid;
153 } save_area[SLB_NUM_BOLTED]; // x10-x40
154} ____cacheline_aligned;
155
156extern struct slb_shadow slb_shadow[];
157
158#endif /* __KERNEL__ */
159#endif /* _ASM_POWERPC_LPPACA_H */
diff --git a/arch/powerpc/include/asm/lv1call.h b/arch/powerpc/include/asm/lv1call.h
new file mode 100644
index 000000000000..81713acf7529
--- /dev/null
+++ b/arch/powerpc/include/asm/lv1call.h
@@ -0,0 +1,348 @@
1/*
2 * PS3 hvcall interface.
3 *
4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp.
6 * Copyright 2003, 2004 (c) MontaVista Software, 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; 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#if !defined(_ASM_POWERPC_LV1CALL_H)
23#define _ASM_POWERPC_LV1CALL_H
24
25#if !defined(__ASSEMBLY__)
26
27#include <linux/types.h>
28
29/* lv1 call declaration macros */
30
31#define LV1_1_IN_ARG_DECL u64 in_1
32#define LV1_2_IN_ARG_DECL LV1_1_IN_ARG_DECL, u64 in_2
33#define LV1_3_IN_ARG_DECL LV1_2_IN_ARG_DECL, u64 in_3
34#define LV1_4_IN_ARG_DECL LV1_3_IN_ARG_DECL, u64 in_4
35#define LV1_5_IN_ARG_DECL LV1_4_IN_ARG_DECL, u64 in_5
36#define LV1_6_IN_ARG_DECL LV1_5_IN_ARG_DECL, u64 in_6
37#define LV1_7_IN_ARG_DECL LV1_6_IN_ARG_DECL, u64 in_7
38#define LV1_8_IN_ARG_DECL LV1_7_IN_ARG_DECL, u64 in_8
39#define LV1_1_OUT_ARG_DECL u64 *out_1
40#define LV1_2_OUT_ARG_DECL LV1_1_OUT_ARG_DECL, u64 *out_2
41#define LV1_3_OUT_ARG_DECL LV1_2_OUT_ARG_DECL, u64 *out_3
42#define LV1_4_OUT_ARG_DECL LV1_3_OUT_ARG_DECL, u64 *out_4
43#define LV1_5_OUT_ARG_DECL LV1_4_OUT_ARG_DECL, u64 *out_5
44#define LV1_6_OUT_ARG_DECL LV1_5_OUT_ARG_DECL, u64 *out_6
45#define LV1_7_OUT_ARG_DECL LV1_6_OUT_ARG_DECL, u64 *out_7
46
47#define LV1_0_IN_0_OUT_ARG_DECL void
48#define LV1_1_IN_0_OUT_ARG_DECL LV1_1_IN_ARG_DECL
49#define LV1_2_IN_0_OUT_ARG_DECL LV1_2_IN_ARG_DECL
50#define LV1_3_IN_0_OUT_ARG_DECL LV1_3_IN_ARG_DECL
51#define LV1_4_IN_0_OUT_ARG_DECL LV1_4_IN_ARG_DECL
52#define LV1_5_IN_0_OUT_ARG_DECL LV1_5_IN_ARG_DECL
53#define LV1_6_IN_0_OUT_ARG_DECL LV1_6_IN_ARG_DECL
54#define LV1_7_IN_0_OUT_ARG_DECL LV1_7_IN_ARG_DECL
55
56#define LV1_0_IN_1_OUT_ARG_DECL LV1_1_OUT_ARG_DECL
57#define LV1_1_IN_1_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
58#define LV1_2_IN_1_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
59#define LV1_3_IN_1_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
60#define LV1_4_IN_1_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
61#define LV1_5_IN_1_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
62#define LV1_6_IN_1_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
63#define LV1_7_IN_1_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
64#define LV1_8_IN_1_OUT_ARG_DECL LV1_8_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
65
66#define LV1_0_IN_2_OUT_ARG_DECL LV1_2_OUT_ARG_DECL
67#define LV1_1_IN_2_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
68#define LV1_2_IN_2_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
69#define LV1_3_IN_2_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
70#define LV1_4_IN_2_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
71#define LV1_5_IN_2_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
72#define LV1_6_IN_2_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
73#define LV1_7_IN_2_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
74
75#define LV1_0_IN_3_OUT_ARG_DECL LV1_3_OUT_ARG_DECL
76#define LV1_1_IN_3_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
77#define LV1_2_IN_3_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
78#define LV1_3_IN_3_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
79#define LV1_4_IN_3_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
80#define LV1_5_IN_3_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
81#define LV1_6_IN_3_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
82#define LV1_7_IN_3_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
83
84#define LV1_0_IN_4_OUT_ARG_DECL LV1_4_OUT_ARG_DECL
85#define LV1_1_IN_4_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
86#define LV1_2_IN_4_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
87#define LV1_3_IN_4_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
88#define LV1_4_IN_4_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
89#define LV1_5_IN_4_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
90#define LV1_6_IN_4_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
91#define LV1_7_IN_4_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
92
93#define LV1_0_IN_5_OUT_ARG_DECL LV1_5_OUT_ARG_DECL
94#define LV1_1_IN_5_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
95#define LV1_2_IN_5_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
96#define LV1_3_IN_5_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
97#define LV1_4_IN_5_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
98#define LV1_5_IN_5_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
99#define LV1_6_IN_5_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
100#define LV1_7_IN_5_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
101
102#define LV1_0_IN_6_OUT_ARG_DECL LV1_6_OUT_ARG_DECL
103#define LV1_1_IN_6_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
104#define LV1_2_IN_6_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
105#define LV1_3_IN_6_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
106#define LV1_4_IN_6_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
107#define LV1_5_IN_6_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
108#define LV1_6_IN_6_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
109#define LV1_7_IN_6_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
110
111#define LV1_0_IN_7_OUT_ARG_DECL LV1_7_OUT_ARG_DECL
112#define LV1_1_IN_7_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
113#define LV1_2_IN_7_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
114#define LV1_3_IN_7_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
115#define LV1_4_IN_7_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
116#define LV1_5_IN_7_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
117#define LV1_6_IN_7_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
118#define LV1_7_IN_7_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
119
120#define LV1_1_IN_ARGS in_1
121#define LV1_2_IN_ARGS LV1_1_IN_ARGS, in_2
122#define LV1_3_IN_ARGS LV1_2_IN_ARGS, in_3
123#define LV1_4_IN_ARGS LV1_3_IN_ARGS, in_4
124#define LV1_5_IN_ARGS LV1_4_IN_ARGS, in_5
125#define LV1_6_IN_ARGS LV1_5_IN_ARGS, in_6
126#define LV1_7_IN_ARGS LV1_6_IN_ARGS, in_7
127#define LV1_8_IN_ARGS LV1_7_IN_ARGS, in_8
128
129#define LV1_1_OUT_ARGS out_1
130#define LV1_2_OUT_ARGS LV1_1_OUT_ARGS, out_2
131#define LV1_3_OUT_ARGS LV1_2_OUT_ARGS, out_3
132#define LV1_4_OUT_ARGS LV1_3_OUT_ARGS, out_4
133#define LV1_5_OUT_ARGS LV1_4_OUT_ARGS, out_5
134#define LV1_6_OUT_ARGS LV1_5_OUT_ARGS, out_6
135#define LV1_7_OUT_ARGS LV1_6_OUT_ARGS, out_7
136
137#define LV1_0_IN_0_OUT_ARGS
138#define LV1_1_IN_0_OUT_ARGS LV1_1_IN_ARGS
139#define LV1_2_IN_0_OUT_ARGS LV1_2_IN_ARGS
140#define LV1_3_IN_0_OUT_ARGS LV1_3_IN_ARGS
141#define LV1_4_IN_0_OUT_ARGS LV1_4_IN_ARGS
142#define LV1_5_IN_0_OUT_ARGS LV1_5_IN_ARGS
143#define LV1_6_IN_0_OUT_ARGS LV1_6_IN_ARGS
144#define LV1_7_IN_0_OUT_ARGS LV1_7_IN_ARGS
145
146#define LV1_0_IN_1_OUT_ARGS LV1_1_OUT_ARGS
147#define LV1_1_IN_1_OUT_ARGS LV1_1_IN_ARGS, LV1_1_OUT_ARGS
148#define LV1_2_IN_1_OUT_ARGS LV1_2_IN_ARGS, LV1_1_OUT_ARGS
149#define LV1_3_IN_1_OUT_ARGS LV1_3_IN_ARGS, LV1_1_OUT_ARGS
150#define LV1_4_IN_1_OUT_ARGS LV1_4_IN_ARGS, LV1_1_OUT_ARGS
151#define LV1_5_IN_1_OUT_ARGS LV1_5_IN_ARGS, LV1_1_OUT_ARGS
152#define LV1_6_IN_1_OUT_ARGS LV1_6_IN_ARGS, LV1_1_OUT_ARGS
153#define LV1_7_IN_1_OUT_ARGS LV1_7_IN_ARGS, LV1_1_OUT_ARGS
154#define LV1_8_IN_1_OUT_ARGS LV1_8_IN_ARGS, LV1_1_OUT_ARGS
155
156#define LV1_0_IN_2_OUT_ARGS LV1_2_OUT_ARGS
157#define LV1_1_IN_2_OUT_ARGS LV1_1_IN_ARGS, LV1_2_OUT_ARGS
158#define LV1_2_IN_2_OUT_ARGS LV1_2_IN_ARGS, LV1_2_OUT_ARGS
159#define LV1_3_IN_2_OUT_ARGS LV1_3_IN_ARGS, LV1_2_OUT_ARGS
160#define LV1_4_IN_2_OUT_ARGS LV1_4_IN_ARGS, LV1_2_OUT_ARGS
161#define LV1_5_IN_2_OUT_ARGS LV1_5_IN_ARGS, LV1_2_OUT_ARGS
162#define LV1_6_IN_2_OUT_ARGS LV1_6_IN_ARGS, LV1_2_OUT_ARGS
163#define LV1_7_IN_2_OUT_ARGS LV1_7_IN_ARGS, LV1_2_OUT_ARGS
164
165#define LV1_0_IN_3_OUT_ARGS LV1_3_OUT_ARGS
166#define LV1_1_IN_3_OUT_ARGS LV1_1_IN_ARGS, LV1_3_OUT_ARGS
167#define LV1_2_IN_3_OUT_ARGS LV1_2_IN_ARGS, LV1_3_OUT_ARGS
168#define LV1_3_IN_3_OUT_ARGS LV1_3_IN_ARGS, LV1_3_OUT_ARGS
169#define LV1_4_IN_3_OUT_ARGS LV1_4_IN_ARGS, LV1_3_OUT_ARGS
170#define LV1_5_IN_3_OUT_ARGS LV1_5_IN_ARGS, LV1_3_OUT_ARGS
171#define LV1_6_IN_3_OUT_ARGS LV1_6_IN_ARGS, LV1_3_OUT_ARGS
172#define LV1_7_IN_3_OUT_ARGS LV1_7_IN_ARGS, LV1_3_OUT_ARGS
173
174#define LV1_0_IN_4_OUT_ARGS LV1_4_OUT_ARGS
175#define LV1_1_IN_4_OUT_ARGS LV1_1_IN_ARGS, LV1_4_OUT_ARGS
176#define LV1_2_IN_4_OUT_ARGS LV1_2_IN_ARGS, LV1_4_OUT_ARGS
177#define LV1_3_IN_4_OUT_ARGS LV1_3_IN_ARGS, LV1_4_OUT_ARGS
178#define LV1_4_IN_4_OUT_ARGS LV1_4_IN_ARGS, LV1_4_OUT_ARGS
179#define LV1_5_IN_4_OUT_ARGS LV1_5_IN_ARGS, LV1_4_OUT_ARGS
180#define LV1_6_IN_4_OUT_ARGS LV1_6_IN_ARGS, LV1_4_OUT_ARGS
181#define LV1_7_IN_4_OUT_ARGS LV1_7_IN_ARGS, LV1_4_OUT_ARGS
182
183#define LV1_0_IN_5_OUT_ARGS LV1_5_OUT_ARGS
184#define LV1_1_IN_5_OUT_ARGS LV1_1_IN_ARGS, LV1_5_OUT_ARGS
185#define LV1_2_IN_5_OUT_ARGS LV1_2_IN_ARGS, LV1_5_OUT_ARGS
186#define LV1_3_IN_5_OUT_ARGS LV1_3_IN_ARGS, LV1_5_OUT_ARGS
187#define LV1_4_IN_5_OUT_ARGS LV1_4_IN_ARGS, LV1_5_OUT_ARGS
188#define LV1_5_IN_5_OUT_ARGS LV1_5_IN_ARGS, LV1_5_OUT_ARGS
189#define LV1_6_IN_5_OUT_ARGS LV1_6_IN_ARGS, LV1_5_OUT_ARGS
190#define LV1_7_IN_5_OUT_ARGS LV1_7_IN_ARGS, LV1_5_OUT_ARGS
191
192#define LV1_0_IN_6_OUT_ARGS LV1_6_OUT_ARGS
193#define LV1_1_IN_6_OUT_ARGS LV1_1_IN_ARGS, LV1_6_OUT_ARGS
194#define LV1_2_IN_6_OUT_ARGS LV1_2_IN_ARGS, LV1_6_OUT_ARGS
195#define LV1_3_IN_6_OUT_ARGS LV1_3_IN_ARGS, LV1_6_OUT_ARGS
196#define LV1_4_IN_6_OUT_ARGS LV1_4_IN_ARGS, LV1_6_OUT_ARGS
197#define LV1_5_IN_6_OUT_ARGS LV1_5_IN_ARGS, LV1_6_OUT_ARGS
198#define LV1_6_IN_6_OUT_ARGS LV1_6_IN_ARGS, LV1_6_OUT_ARGS
199#define LV1_7_IN_6_OUT_ARGS LV1_7_IN_ARGS, LV1_6_OUT_ARGS
200
201#define LV1_0_IN_7_OUT_ARGS LV1_7_OUT_ARGS
202#define LV1_1_IN_7_OUT_ARGS LV1_1_IN_ARGS, LV1_7_OUT_ARGS
203#define LV1_2_IN_7_OUT_ARGS LV1_2_IN_ARGS, LV1_7_OUT_ARGS
204#define LV1_3_IN_7_OUT_ARGS LV1_3_IN_ARGS, LV1_7_OUT_ARGS
205#define LV1_4_IN_7_OUT_ARGS LV1_4_IN_ARGS, LV1_7_OUT_ARGS
206#define LV1_5_IN_7_OUT_ARGS LV1_5_IN_ARGS, LV1_7_OUT_ARGS
207#define LV1_6_IN_7_OUT_ARGS LV1_6_IN_ARGS, LV1_7_OUT_ARGS
208#define LV1_7_IN_7_OUT_ARGS LV1_7_IN_ARGS, LV1_7_OUT_ARGS
209
210/*
211 * This LV1_CALL() macro is for use by callers. It expands into an
212 * inline call wrapper and an underscored HV call declaration. The
213 * wrapper can be used to instrument the lv1 call interface. The
214 * file lv1call.S defines its own LV1_CALL() macro to expand into
215 * the actual underscored call definition.
216 */
217
218#if !defined(LV1_CALL)
219#define LV1_CALL(name, in, out, num) \
220 extern s64 _lv1_##name(LV1_##in##_IN_##out##_OUT_ARG_DECL); \
221 static inline int lv1_##name(LV1_##in##_IN_##out##_OUT_ARG_DECL) \
222 {return _lv1_##name(LV1_##in##_IN_##out##_OUT_ARGS);}
223#endif
224
225#endif /* !defined(__ASSEMBLY__) */
226
227/* lv1 call table */
228
229LV1_CALL(allocate_memory, 4, 2, 0 )
230LV1_CALL(write_htab_entry, 4, 0, 1 )
231LV1_CALL(construct_virtual_address_space, 3, 2, 2 )
232LV1_CALL(invalidate_htab_entries, 5, 0, 3 )
233LV1_CALL(get_virtual_address_space_id_of_ppe, 1, 1, 4 )
234LV1_CALL(query_logical_partition_address_region_info, 1, 5, 6 )
235LV1_CALL(select_virtual_address_space, 1, 0, 7 )
236LV1_CALL(pause, 1, 0, 9 )
237LV1_CALL(destruct_virtual_address_space, 1, 0, 10 )
238LV1_CALL(configure_irq_state_bitmap, 3, 0, 11 )
239LV1_CALL(connect_irq_plug_ext, 5, 0, 12 )
240LV1_CALL(release_memory, 1, 0, 13 )
241LV1_CALL(put_iopte, 5, 0, 15 )
242LV1_CALL(disconnect_irq_plug_ext, 3, 0, 17 )
243LV1_CALL(construct_event_receive_port, 0, 1, 18 )
244LV1_CALL(destruct_event_receive_port, 1, 0, 19 )
245LV1_CALL(send_event_locally, 1, 0, 24 )
246LV1_CALL(end_of_interrupt, 1, 0, 27 )
247LV1_CALL(connect_irq_plug, 2, 0, 28 )
248LV1_CALL(disconnect_irq_plug, 1, 0, 29 )
249LV1_CALL(end_of_interrupt_ext, 3, 0, 30 )
250LV1_CALL(did_update_interrupt_mask, 2, 0, 31 )
251LV1_CALL(shutdown_logical_partition, 1, 0, 44 )
252LV1_CALL(destruct_logical_spe, 1, 0, 54 )
253LV1_CALL(construct_logical_spe, 7, 6, 57 )
254LV1_CALL(set_spe_interrupt_mask, 3, 0, 61 )
255LV1_CALL(set_spe_transition_notifier, 3, 0, 64 )
256LV1_CALL(disable_logical_spe, 2, 0, 65 )
257LV1_CALL(clear_spe_interrupt_status, 4, 0, 66 )
258LV1_CALL(get_spe_interrupt_status, 2, 1, 67 )
259LV1_CALL(get_logical_ppe_id, 0, 1, 69 )
260LV1_CALL(set_interrupt_mask, 5, 0, 73 )
261LV1_CALL(get_logical_partition_id, 0, 1, 74 )
262LV1_CALL(configure_execution_time_variable, 1, 0, 77 )
263LV1_CALL(get_spe_irq_outlet, 2, 1, 78 )
264LV1_CALL(set_spe_privilege_state_area_1_register, 3, 0, 79 )
265LV1_CALL(create_repository_node, 6, 0, 90 )
266LV1_CALL(get_repository_node_value, 5, 2, 91 )
267LV1_CALL(modify_repository_node_value, 6, 0, 92 )
268LV1_CALL(remove_repository_node, 4, 0, 93 )
269LV1_CALL(read_htab_entries, 2, 5, 95 )
270LV1_CALL(set_dabr, 2, 0, 96 )
271LV1_CALL(get_total_execution_time, 2, 1, 103 )
272LV1_CALL(allocate_io_segment, 3, 1, 116 )
273LV1_CALL(release_io_segment, 2, 0, 117 )
274LV1_CALL(construct_io_irq_outlet, 1, 1, 120 )
275LV1_CALL(destruct_io_irq_outlet, 1, 0, 121 )
276LV1_CALL(map_htab, 1, 1, 122 )
277LV1_CALL(unmap_htab, 1, 0, 123 )
278LV1_CALL(get_version_info, 0, 1, 127 )
279LV1_CALL(insert_htab_entry, 6, 3, 158 )
280LV1_CALL(read_virtual_uart, 3, 1, 162 )
281LV1_CALL(write_virtual_uart, 3, 1, 163 )
282LV1_CALL(set_virtual_uart_param, 3, 0, 164 )
283LV1_CALL(get_virtual_uart_param, 2, 1, 165 )
284LV1_CALL(configure_virtual_uart_irq, 1, 1, 166 )
285LV1_CALL(open_device, 3, 0, 170 )
286LV1_CALL(close_device, 2, 0, 171 )
287LV1_CALL(map_device_mmio_region, 5, 1, 172 )
288LV1_CALL(unmap_device_mmio_region, 3, 0, 173 )
289LV1_CALL(allocate_device_dma_region, 5, 1, 174 )
290LV1_CALL(free_device_dma_region, 3, 0, 175 )
291LV1_CALL(map_device_dma_region, 6, 0, 176 )
292LV1_CALL(unmap_device_dma_region, 4, 0, 177 )
293LV1_CALL(net_add_multicast_address, 4, 0, 185 )
294LV1_CALL(net_remove_multicast_address, 4, 0, 186 )
295LV1_CALL(net_start_tx_dma, 4, 0, 187 )
296LV1_CALL(net_stop_tx_dma, 3, 0, 188 )
297LV1_CALL(net_start_rx_dma, 4, 0, 189 )
298LV1_CALL(net_stop_rx_dma, 3, 0, 190 )
299LV1_CALL(net_set_interrupt_status_indicator, 4, 0, 191 )
300LV1_CALL(net_set_interrupt_mask, 4, 0, 193 )
301LV1_CALL(net_control, 6, 2, 194 )
302LV1_CALL(connect_interrupt_event_receive_port, 4, 0, 197 )
303LV1_CALL(disconnect_interrupt_event_receive_port, 4, 0, 198 )
304LV1_CALL(get_spe_all_interrupt_statuses, 1, 1, 199 )
305LV1_CALL(deconfigure_virtual_uart_irq, 0, 0, 202 )
306LV1_CALL(enable_logical_spe, 2, 0, 207 )
307LV1_CALL(gpu_open, 1, 0, 210 )
308LV1_CALL(gpu_close, 0, 0, 211 )
309LV1_CALL(gpu_device_map, 1, 2, 212 )
310LV1_CALL(gpu_device_unmap, 1, 0, 213 )
311LV1_CALL(gpu_memory_allocate, 5, 2, 214 )
312LV1_CALL(gpu_memory_free, 1, 0, 216 )
313LV1_CALL(gpu_context_allocate, 2, 5, 217 )
314LV1_CALL(gpu_context_free, 1, 0, 218 )
315LV1_CALL(gpu_context_iomap, 5, 0, 221 )
316LV1_CALL(gpu_context_attribute, 6, 0, 225 )
317LV1_CALL(gpu_context_intr, 1, 1, 227 )
318LV1_CALL(gpu_attribute, 5, 0, 228 )
319LV1_CALL(get_rtc, 0, 2, 232 )
320LV1_CALL(set_ppe_periodic_tracer_frequency, 1, 0, 240 )
321LV1_CALL(start_ppe_periodic_tracer, 5, 0, 241 )
322LV1_CALL(stop_ppe_periodic_tracer, 1, 1, 242 )
323LV1_CALL(storage_read, 6, 1, 245 )
324LV1_CALL(storage_write, 6, 1, 246 )
325LV1_CALL(storage_send_device_command, 6, 1, 248 )
326LV1_CALL(storage_get_async_status, 1, 2, 249 )
327LV1_CALL(storage_check_async_status, 2, 1, 254 )
328LV1_CALL(panic, 1, 0, 255 )
329LV1_CALL(construct_lpm, 6, 3, 140 )
330LV1_CALL(destruct_lpm, 1, 0, 141 )
331LV1_CALL(start_lpm, 1, 0, 142 )
332LV1_CALL(stop_lpm, 1, 1, 143 )
333LV1_CALL(copy_lpm_trace_buffer, 3, 1, 144 )
334LV1_CALL(add_lpm_event_bookmark, 5, 0, 145 )
335LV1_CALL(delete_lpm_event_bookmark, 3, 0, 146 )
336LV1_CALL(set_lpm_interrupt_mask, 3, 1, 147 )
337LV1_CALL(get_lpm_interrupt_status, 1, 1, 148 )
338LV1_CALL(set_lpm_general_control, 5, 2, 149 )
339LV1_CALL(set_lpm_interval, 3, 1, 150 )
340LV1_CALL(set_lpm_trigger_control, 3, 1, 151 )
341LV1_CALL(set_lpm_counter_control, 4, 1, 152 )
342LV1_CALL(set_lpm_group_control, 3, 1, 153 )
343LV1_CALL(set_lpm_debug_bus_control, 3, 1, 154 )
344LV1_CALL(set_lpm_counter, 5, 2, 155 )
345LV1_CALL(set_lpm_signal, 7, 0, 156 )
346LV1_CALL(set_lpm_spr_trigger, 2, 0, 157 )
347
348#endif
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
new file mode 100644
index 000000000000..893aafd87fde
--- /dev/null
+++ b/arch/powerpc/include/asm/machdep.h
@@ -0,0 +1,365 @@
1#ifndef _ASM_POWERPC_MACHDEP_H
2#define _ASM_POWERPC_MACHDEP_H
3#ifdef __KERNEL__
4
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/seq_file.h>
13#include <linux/init.h>
14#include <linux/dma-mapping.h>
15
16#include <asm/setup.h>
17
18/* We export this macro for external modules like Alsa to know if
19 * ppc_md.feature_call is implemented or not
20 */
21#define CONFIG_PPC_HAS_FEATURE_CALLS
22
23struct pt_regs;
24struct pci_bus;
25struct device_node;
26struct iommu_table;
27struct rtc_time;
28struct file;
29struct pci_controller;
30#ifdef CONFIG_KEXEC
31struct kimage;
32#endif
33
34#ifdef CONFIG_SMP
35struct smp_ops_t {
36 void (*message_pass)(int target, int msg);
37 int (*probe)(void);
38 void (*kick_cpu)(int nr);
39 void (*setup_cpu)(int nr);
40 void (*take_timebase)(void);
41 void (*give_timebase)(void);
42 int (*cpu_enable)(unsigned int nr);
43 int (*cpu_disable)(void);
44 void (*cpu_die)(unsigned int nr);
45 int (*cpu_bootable)(unsigned int nr);
46};
47#endif
48
49struct machdep_calls {
50 char *name;
51#ifdef CONFIG_PPC64
52 void (*hpte_invalidate)(unsigned long slot,
53 unsigned long va,
54 int psize, int ssize,
55 int local);
56 long (*hpte_updatepp)(unsigned long slot,
57 unsigned long newpp,
58 unsigned long va,
59 int psize, int ssize,
60 int local);
61 void (*hpte_updateboltedpp)(unsigned long newpp,
62 unsigned long ea,
63 int psize, int ssize);
64 long (*hpte_insert)(unsigned long hpte_group,
65 unsigned long va,
66 unsigned long prpn,
67 unsigned long rflags,
68 unsigned long vflags,
69 int psize, int ssize);
70 long (*hpte_remove)(unsigned long hpte_group);
71 void (*hpte_removebolted)(unsigned long ea,
72 int psize, int ssize);
73 void (*flush_hash_range)(unsigned long number, int local);
74
75 /* special for kexec, to be called in real mode, linar mapping is
76 * destroyed as well */
77 void (*hpte_clear_all)(void);
78
79 int (*tce_build)(struct iommu_table *tbl,
80 long index,
81 long npages,
82 unsigned long uaddr,
83 enum dma_data_direction direction,
84 struct dma_attrs *attrs);
85 void (*tce_free)(struct iommu_table *tbl,
86 long index,
87 long npages);
88 unsigned long (*tce_get)(struct iommu_table *tbl,
89 long index);
90 void (*tce_flush)(struct iommu_table *tbl);
91 void (*pci_dma_dev_setup)(struct pci_dev *dev);
92 void (*pci_dma_bus_setup)(struct pci_bus *bus);
93
94 void __iomem * (*ioremap)(phys_addr_t addr, unsigned long size,
95 unsigned long flags);
96 void (*iounmap)(volatile void __iomem *token);
97
98#ifdef CONFIG_PM
99 void (*iommu_save)(void);
100 void (*iommu_restore)(void);
101#endif
102#endif /* CONFIG_PPC64 */
103
104 int (*probe)(void);
105 void (*setup_arch)(void); /* Optional, may be NULL */
106 void (*init_early)(void);
107 /* Optional, may be NULL. */
108 void (*show_cpuinfo)(struct seq_file *m);
109 void (*show_percpuinfo)(struct seq_file *m, int i);
110
111 void (*init_IRQ)(void);
112 unsigned int (*get_irq)(void);
113#ifdef CONFIG_KEXEC
114 void (*kexec_cpu_down)(int crash_shutdown, int secondary);
115#endif
116
117 /* PCI stuff */
118 /* Called after scanning the bus, before allocating resources */
119 void (*pcibios_fixup)(void);
120 int (*pci_probe_mode)(struct pci_bus *);
121 void (*pci_irq_fixup)(struct pci_dev *dev);
122
123 /* To setup PHBs when using automatic OF platform driver for PCI */
124 int (*pci_setup_phb)(struct pci_controller *host);
125
126#ifdef CONFIG_PCI_MSI
127 int (*msi_check_device)(struct pci_dev* dev,
128 int nvec, int type);
129 int (*setup_msi_irqs)(struct pci_dev *dev,
130 int nvec, int type);
131 void (*teardown_msi_irqs)(struct pci_dev *dev);
132#endif
133
134 void (*restart)(char *cmd);
135 void (*power_off)(void);
136 void (*halt)(void);
137 void (*panic)(char *str);
138 void (*cpu_die)(void);
139
140 long (*time_init)(void); /* Optional, may be NULL */
141
142 int (*set_rtc_time)(struct rtc_time *);
143 void (*get_rtc_time)(struct rtc_time *);
144 unsigned long (*get_boot_time)(void);
145 unsigned char (*rtc_read_val)(int addr);
146 void (*rtc_write_val)(int addr, unsigned char val);
147
148 void (*calibrate_decr)(void);
149
150 void (*progress)(char *, unsigned short);
151
152 /* Interface for platform error logging */
153 void (*log_error)(char *buf, unsigned int err_type, int fatal);
154
155 unsigned char (*nvram_read_val)(int addr);
156 void (*nvram_write_val)(int addr, unsigned char val);
157 ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index);
158 ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);
159 ssize_t (*nvram_size)(void);
160 void (*nvram_sync)(void);
161
162 /* Exception handlers */
163 int (*system_reset_exception)(struct pt_regs *regs);
164 int (*machine_check_exception)(struct pt_regs *regs);
165
166 /* Motherboard/chipset features. This is a kind of general purpose
167 * hook used to control some machine specific features (like reset
168 * lines, chip power control, etc...).
169 */
170 long (*feature_call)(unsigned int feature, ...);
171
172 /* Get legacy PCI/IDE interrupt mapping */
173 int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel);
174
175 /* Get access protection for /dev/mem */
176 pgprot_t (*phys_mem_access_prot)(struct file *file,
177 unsigned long pfn,
178 unsigned long size,
179 pgprot_t vma_prot);
180
181 /* Idle loop for this platform, leave empty for default idle loop */
182 void (*idle_loop)(void);
183
184 /*
185 * Function for waiting for work with reduced power in idle loop;
186 * called with interrupts disabled.
187 */
188 void (*power_save)(void);
189
190 /* Function to enable performance monitor counters for this
191 platform, called once per cpu. */
192 void (*enable_pmcs)(void);
193
194 /* Set DABR for this platform, leave empty for default implemenation */
195 int (*set_dabr)(unsigned long dabr);
196
197#ifdef CONFIG_PPC32 /* XXX for now */
198 /* A general init function, called by ppc_init in init/main.c.
199 May be NULL. */
200 void (*init)(void);
201
202 void (*kgdb_map_scc)(void);
203
204 /*
205 * optional PCI "hooks"
206 */
207 /* Called in indirect_* to avoid touching devices */
208 int (*pci_exclude_device)(struct pci_controller *, unsigned char, unsigned char);
209
210 /* Called at then very end of pcibios_init() */
211 void (*pcibios_after_init)(void);
212
213#endif /* CONFIG_PPC32 */
214
215 /* Called after PPC generic resource fixup to perform
216 machine specific fixups */
217 void (*pcibios_fixup_resources)(struct pci_dev *);
218
219 /* Called for each PCI bus in the system when it's probed */
220 void (*pcibios_fixup_bus)(struct pci_bus *);
221
222 /* Called when pci_enable_device() is called. Returns 0 to
223 * allow assignment/enabling of the device. */
224 int (*pcibios_enable_device_hook)(struct pci_dev *);
225
226 /* Called to shutdown machine specific hardware not already controlled
227 * by other drivers.
228 */
229 void (*machine_shutdown)(void);
230
231#ifdef CONFIG_KEXEC
232 /* Called to do the minimal shutdown needed to run a kexec'd kernel
233 * to run successfully.
234 * XXX Should we move this one out of kexec scope?
235 */
236 void (*machine_crash_shutdown)(struct pt_regs *regs);
237
238 /* Called to do what every setup is needed on image and the
239 * reboot code buffer. Returns 0 on success.
240 * Provide your own (maybe dummy) implementation if your platform
241 * claims to support kexec.
242 */
243 int (*machine_kexec_prepare)(struct kimage *image);
244
245 /* Called to handle any machine specific cleanup on image */
246 void (*machine_kexec_cleanup)(struct kimage *image);
247
248 /* Called to perform the _real_ kexec.
249 * Do NOT allocate memory or fail here. We are past the point of
250 * no return.
251 */
252 void (*machine_kexec)(struct kimage *image);
253#endif /* CONFIG_KEXEC */
254
255#ifdef CONFIG_SUSPEND
256 /* These are called to disable and enable, respectively, IRQs when
257 * entering a suspend state. If NULL, then the generic versions
258 * will be called. The generic versions disable/enable the
259 * decrementer along with interrupts.
260 */
261 void (*suspend_disable_irqs)(void);
262 void (*suspend_enable_irqs)(void);
263#endif
264};
265
266extern void e500_idle(void);
267extern void power4_idle(void);
268extern void power4_cpu_offline_powersave(void);
269extern void ppc6xx_idle(void);
270
271/*
272 * ppc_md contains a copy of the machine description structure for the
273 * current platform. machine_id contains the initial address where the
274 * description was found during boot.
275 */
276extern struct machdep_calls ppc_md;
277extern struct machdep_calls *machine_id;
278
279#define __machine_desc __attribute__ ((__section__ (".machine.desc")))
280
281#define define_machine(name) \
282 extern struct machdep_calls mach_##name; \
283 EXPORT_SYMBOL(mach_##name); \
284 struct machdep_calls mach_##name __machine_desc =
285
286#define machine_is(name) \
287 ({ \
288 extern struct machdep_calls mach_##name \
289 __attribute__((weak)); \
290 machine_id == &mach_##name; \
291 })
292
293extern void probe_machine(void);
294
295extern char cmd_line[COMMAND_LINE_SIZE];
296
297#ifdef CONFIG_PPC_PMAC
298/*
299 * Power macintoshes have either a CUDA, PMU or SMU controlling
300 * system reset, power, NVRAM, RTC.
301 */
302typedef enum sys_ctrler_kind {
303 SYS_CTRLER_UNKNOWN = 0,
304 SYS_CTRLER_CUDA = 1,
305 SYS_CTRLER_PMU = 2,
306 SYS_CTRLER_SMU = 3,
307} sys_ctrler_t;
308extern sys_ctrler_t sys_ctrler;
309
310#endif /* CONFIG_PPC_PMAC */
311
312extern void setup_pci_ptrs(void);
313
314#ifdef CONFIG_SMP
315/* Poor default implementations */
316extern void __devinit smp_generic_give_timebase(void);
317extern void __devinit smp_generic_take_timebase(void);
318#endif /* CONFIG_SMP */
319
320
321/* Functions to produce codes on the leds.
322 * The SRC code should be unique for the message category and should
323 * be limited to the lower 24 bits (the upper 8 are set by these funcs),
324 * and (for boot & dump) should be sorted numerically in the order
325 * the events occur.
326 */
327/* Print a boot progress message. */
328void ppc64_boot_msg(unsigned int src, const char *msg);
329/* Print a termination message (print only -- does not stop the kernel) */
330void ppc64_terminate_msg(unsigned int src, const char *msg);
331
332static inline void log_error(char *buf, unsigned int err_type, int fatal)
333{
334 if (ppc_md.log_error)
335 ppc_md.log_error(buf, err_type, fatal);
336}
337
338#define __define_machine_initcall(mach,level,fn,id) \
339 static int __init __machine_initcall_##mach##_##fn(void) { \
340 if (machine_is(mach)) return fn(); \
341 return 0; \
342 } \
343 __define_initcall(level,__machine_initcall_##mach##_##fn,id);
344
345#define machine_core_initcall(mach,fn) __define_machine_initcall(mach,"1",fn,1)
346#define machine_core_initcall_sync(mach,fn) __define_machine_initcall(mach,"1s",fn,1s)
347#define machine_postcore_initcall(mach,fn) __define_machine_initcall(mach,"2",fn,2)
348#define machine_postcore_initcall_sync(mach,fn) __define_machine_initcall(mach,"2s",fn,2s)
349#define machine_arch_initcall(mach,fn) __define_machine_initcall(mach,"3",fn,3)
350#define machine_arch_initcall_sync(mach,fn) __define_machine_initcall(mach,"3s",fn,3s)
351#define machine_subsys_initcall(mach,fn) __define_machine_initcall(mach,"4",fn,4)
352#define machine_subsys_initcall_sync(mach,fn) __define_machine_initcall(mach,"4s",fn,4s)
353#define machine_fs_initcall(mach,fn) __define_machine_initcall(mach,"5",fn,5)
354#define machine_fs_initcall_sync(mach,fn) __define_machine_initcall(mach,"5s",fn,5s)
355#define machine_rootfs_initcall(mach,fn) __define_machine_initcall(mach,"rootfs",fn,rootfs)
356#define machine_device_initcall(mach,fn) __define_machine_initcall(mach,"6",fn,6)
357#define machine_device_initcall_sync(mach,fn) __define_machine_initcall(mach,"6s",fn,6s)
358#define machine_late_initcall(mach,fn) __define_machine_initcall(mach,"7",fn,7)
359#define machine_late_initcall_sync(mach,fn) __define_machine_initcall(mach,"7s",fn,7s)
360
361void generic_suspend_disable_irqs(void);
362void generic_suspend_enable_irqs(void);
363
364#endif /* __KERNEL__ */
365#endif /* _ASM_POWERPC_MACHDEP_H */
diff --git a/arch/powerpc/include/asm/macio.h b/arch/powerpc/include/asm/macio.h
new file mode 100644
index 000000000000..079c06eae446
--- /dev/null
+++ b/arch/powerpc/include/asm/macio.h
@@ -0,0 +1,142 @@
1#ifndef __MACIO_ASIC_H__
2#define __MACIO_ASIC_H__
3#ifdef __KERNEL__
4
5#include <linux/of_device.h>
6
7extern struct bus_type macio_bus_type;
8
9/* MacIO device driver is defined later */
10struct macio_driver;
11struct macio_chip;
12
13#define MACIO_DEV_COUNT_RESOURCES 8
14#define MACIO_DEV_COUNT_IRQS 8
15
16/*
17 * the macio_bus structure is used to describe a "virtual" bus
18 * within a MacIO ASIC. It's typically provided by a macio_pci_asic
19 * PCI device, but could be provided differently as well (nubus
20 * machines using a fake OF tree).
21 *
22 * The pdev field can be NULL on non-PCI machines
23 */
24struct macio_bus
25{
26 struct macio_chip *chip; /* macio_chip (private use) */
27 int index; /* macio chip index in system */
28#ifdef CONFIG_PCI
29 struct pci_dev *pdev; /* PCI device hosting this bus */
30#endif
31};
32
33/*
34 * the macio_dev structure is used to describe a device
35 * within an Apple MacIO ASIC.
36 */
37struct macio_dev
38{
39 struct macio_bus *bus; /* macio bus this device is on */
40 struct macio_dev *media_bay; /* Device is part of a media bay */
41 struct of_device ofdev;
42 int n_resources;
43 struct resource resource[MACIO_DEV_COUNT_RESOURCES];
44 int n_interrupts;
45 struct resource interrupt[MACIO_DEV_COUNT_IRQS];
46};
47#define to_macio_device(d) container_of(d, struct macio_dev, ofdev.dev)
48#define of_to_macio_device(d) container_of(d, struct macio_dev, ofdev)
49
50extern struct macio_dev *macio_dev_get(struct macio_dev *dev);
51extern void macio_dev_put(struct macio_dev *dev);
52
53/*
54 * Accessors to resources & interrupts and other device
55 * fields
56 */
57
58static inline int macio_resource_count(struct macio_dev *dev)
59{
60 return dev->n_resources;
61}
62
63static inline unsigned long macio_resource_start(struct macio_dev *dev, int resource_no)
64{
65 return dev->resource[resource_no].start;
66}
67
68static inline unsigned long macio_resource_end(struct macio_dev *dev, int resource_no)
69{
70 return dev->resource[resource_no].end;
71}
72
73static inline unsigned long macio_resource_len(struct macio_dev *dev, int resource_no)
74{
75 struct resource *res = &dev->resource[resource_no];
76 if (res->start == 0 || res->end == 0 || res->end < res->start)
77 return 0;
78 return res->end - res->start + 1;
79}
80
81extern int macio_request_resource(struct macio_dev *dev, int resource_no, const char *name);
82extern void macio_release_resource(struct macio_dev *dev, int resource_no);
83extern int macio_request_resources(struct macio_dev *dev, const char *name);
84extern void macio_release_resources(struct macio_dev *dev);
85
86static inline int macio_irq_count(struct macio_dev *dev)
87{
88 return dev->n_interrupts;
89}
90
91static inline int macio_irq(struct macio_dev *dev, int irq_no)
92{
93 return dev->interrupt[irq_no].start;
94}
95
96static inline void macio_set_drvdata(struct macio_dev *dev, void *data)
97{
98 dev_set_drvdata(&dev->ofdev.dev, data);
99}
100
101static inline void* macio_get_drvdata(struct macio_dev *dev)
102{
103 return dev_get_drvdata(&dev->ofdev.dev);
104}
105
106static inline struct device_node *macio_get_of_node(struct macio_dev *mdev)
107{
108 return mdev->ofdev.node;
109}
110
111#ifdef CONFIG_PCI
112static inline struct pci_dev *macio_get_pci_dev(struct macio_dev *mdev)
113{
114 return mdev->bus->pdev;
115}
116#endif
117
118/*
119 * A driver for a mac-io chip based device
120 */
121struct macio_driver
122{
123 char *name;
124 struct of_device_id *match_table;
125 struct module *owner;
126
127 int (*probe)(struct macio_dev* dev, const struct of_device_id *match);
128 int (*remove)(struct macio_dev* dev);
129
130 int (*suspend)(struct macio_dev* dev, pm_message_t state);
131 int (*resume)(struct macio_dev* dev);
132 int (*shutdown)(struct macio_dev* dev);
133
134 struct device_driver driver;
135};
136#define to_macio_driver(drv) container_of(drv,struct macio_driver, driver)
137
138extern int macio_register_driver(struct macio_driver *);
139extern void macio_unregister_driver(struct macio_driver *);
140
141#endif /* __KERNEL__ */
142#endif /* __MACIO_ASIC_H__ */
diff --git a/arch/powerpc/include/asm/mc146818rtc.h b/arch/powerpc/include/asm/mc146818rtc.h
new file mode 100644
index 000000000000..f2741c8b59a1
--- /dev/null
+++ b/arch/powerpc/include/asm/mc146818rtc.h
@@ -0,0 +1,36 @@
1#ifndef _ASM_POWERPC_MC146818RTC_H
2#define _ASM_POWERPC_MC146818RTC_H
3
4/*
5 * Machine dependent access functions for RTC registers.
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#ifdef __KERNEL__
14
15#include <asm/io.h>
16
17#ifndef RTC_PORT
18#define RTC_PORT(x) (0x70 + (x))
19#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
20#endif
21
22/*
23 * The yet supported machines all access the RTC index register via
24 * an ISA port access but the way to access the date register differs ...
25 */
26#define CMOS_READ(addr) ({ \
27outb_p((addr),RTC_PORT(0)); \
28inb_p(RTC_PORT(1)); \
29})
30#define CMOS_WRITE(val, addr) ({ \
31outb_p((addr),RTC_PORT(0)); \
32outb_p((val),RTC_PORT(1)); \
33})
34
35#endif /* __KERNEL__ */
36#endif /* _ASM_POWERPC_MC146818RTC_H */
diff --git a/arch/powerpc/include/asm/mediabay.h b/arch/powerpc/include/asm/mediabay.h
new file mode 100644
index 000000000000..b2efb3325808
--- /dev/null
+++ b/arch/powerpc/include/asm/mediabay.h
@@ -0,0 +1,43 @@
1/*
2 * mediabay.h: definitions for using the media bay
3 * on PowerBook 3400 and similar computers.
4 *
5 * Copyright (C) 1997 Paul Mackerras.
6 */
7#ifndef _PPC_MEDIABAY_H
8#define _PPC_MEDIABAY_H
9
10#ifdef __KERNEL__
11
12#define MB_FD 0 /* media bay contains floppy drive (automatic eject ?) */
13#define MB_FD1 1 /* media bay contains floppy drive (manual eject ?) */
14#define MB_SOUND 2 /* sound device ? */
15#define MB_CD 3 /* media bay contains ATA drive such as CD or ZIP */
16#define MB_PCI 5 /* media bay contains a PCI device */
17#define MB_POWER 6 /* media bay contains a Power device (???) */
18#define MB_NO 7 /* media bay contains nothing */
19
20/* Number of bays in the machine or 0 */
21extern int media_bay_count;
22
23#ifdef CONFIG_BLK_DEV_IDE_PMAC
24#include <linux/ide.h>
25
26int check_media_bay_by_base(unsigned long base, int what);
27/* called by IDE PMAC host driver to register IDE controller for media bay */
28int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base,
29 int irq, ide_hwif_t *hwif);
30
31int check_media_bay(struct device_node *which_bay, int what);
32
33#else
34
35static inline int check_media_bay(struct device_node *which_bay, int what)
36{
37 return -ENODEV;
38}
39
40#endif
41
42#endif /* __KERNEL__ */
43#endif /* _PPC_MEDIABAY_H */
diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
new file mode 100644
index 000000000000..9209f755763e
--- /dev/null
+++ b/arch/powerpc/include/asm/mman.h
@@ -0,0 +1,63 @@
1#ifndef _ASM_POWERPC_MMAN_H
2#define _ASM_POWERPC_MMAN_H
3
4#include <asm-generic/mman.h>
5
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#define PROT_SAO 0x10 /* Strong Access Ordering */
14
15#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
16#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
17#define MAP_LOCKED 0x80
18
19#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
20#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
21#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
22
23#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
24#define MCL_FUTURE 0x4000 /* lock all additions to address space */
25
26#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
27#define MAP_NONBLOCK 0x10000 /* do not block on IO */
28
29#ifdef __KERNEL__
30#ifdef CONFIG_PPC64
31
32#include <asm/cputable.h>
33#include <linux/mm.h>
34
35/*
36 * This file is included by linux/mman.h, so we can't use cacl_vm_prot_bits()
37 * here. How important is the optimization?
38 */
39static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot)
40{
41 return (prot & PROT_SAO) ? VM_SAO : 0;
42}
43#define arch_calc_vm_prot_bits(prot) arch_calc_vm_prot_bits(prot)
44
45static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
46{
47 return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : 0;
48}
49#define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
50
51static inline int arch_validate_prot(unsigned long prot)
52{
53 if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
54 return 0;
55 if ((prot & PROT_SAO) && !cpu_has_feature(CPU_FTR_SAO))
56 return 0;
57 return 1;
58}
59#define arch_validate_prot(prot) arch_validate_prot(prot)
60
61#endif /* CONFIG_PPC64 */
62#endif /* __KERNEL__ */
63#endif /* _ASM_POWERPC_MMAN_H */
diff --git a/arch/powerpc/include/asm/mmu-40x.h b/arch/powerpc/include/asm/mmu-40x.h
new file mode 100644
index 000000000000..3d108676584c
--- /dev/null
+++ b/arch/powerpc/include/asm/mmu-40x.h
@@ -0,0 +1,63 @@
1#ifndef _ASM_POWERPC_MMU_40X_H_
2#define _ASM_POWERPC_MMU_40X_H_
3
4/*
5 * PPC40x support
6 */
7
8#define PPC40X_TLB_SIZE 64
9
10/*
11 * TLB entries are defined by a "high" tag portion and a "low" data
12 * portion. On all architectures, the data portion is 32-bits.
13 *
14 * TLB entries are managed entirely under software control by reading,
15 * writing, and searchoing using the 4xx-specific tlbre, tlbwr, and tlbsx
16 * instructions.
17 */
18
19#define TLB_LO 1
20#define TLB_HI 0
21
22#define TLB_DATA TLB_LO
23#define TLB_TAG TLB_HI
24
25/* Tag portion */
26
27#define TLB_EPN_MASK 0xFFFFFC00 /* Effective Page Number */
28#define TLB_PAGESZ_MASK 0x00000380
29#define TLB_PAGESZ(x) (((x) & 0x7) << 7)
30#define PAGESZ_1K 0
31#define PAGESZ_4K 1
32#define PAGESZ_16K 2
33#define PAGESZ_64K 3
34#define PAGESZ_256K 4
35#define PAGESZ_1M 5
36#define PAGESZ_4M 6
37#define PAGESZ_16M 7
38#define TLB_VALID 0x00000040 /* Entry is valid */
39
40/* Data portion */
41
42#define TLB_RPN_MASK 0xFFFFFC00 /* Real Page Number */
43#define TLB_PERM_MASK 0x00000300
44#define TLB_EX 0x00000200 /* Instruction execution allowed */
45#define TLB_WR 0x00000100 /* Writes permitted */
46#define TLB_ZSEL_MASK 0x000000F0
47#define TLB_ZSEL(x) (((x) & 0xF) << 4)
48#define TLB_ATTR_MASK 0x0000000F
49#define TLB_W 0x00000008 /* Caching is write-through */
50#define TLB_I 0x00000004 /* Caching is inhibited */
51#define TLB_M 0x00000002 /* Memory is coherent */
52#define TLB_G 0x00000001 /* Memory is guarded from prefetch */
53
54#ifndef __ASSEMBLY__
55
56typedef struct {
57 unsigned long id;
58 unsigned long vdso_base;
59} mm_context_t;
60
61#endif /* !__ASSEMBLY__ */
62
63#endif /* _ASM_POWERPC_MMU_40X_H_ */
diff --git a/arch/powerpc/include/asm/mmu-44x.h b/arch/powerpc/include/asm/mmu-44x.h
new file mode 100644
index 000000000000..a825524c981a
--- /dev/null
+++ b/arch/powerpc/include/asm/mmu-44x.h
@@ -0,0 +1,76 @@
1#ifndef _ASM_POWERPC_MMU_44X_H_
2#define _ASM_POWERPC_MMU_44X_H_
3/*
4 * PPC440 support
5 */
6
7#define PPC44x_MMUCR_TID 0x000000ff
8#define PPC44x_MMUCR_STS 0x00010000
9
10#define PPC44x_TLB_PAGEID 0
11#define PPC44x_TLB_XLAT 1
12#define PPC44x_TLB_ATTRIB 2
13
14/* Page identification fields */
15#define PPC44x_TLB_EPN_MASK 0xfffffc00 /* Effective Page Number */
16#define PPC44x_TLB_VALID 0x00000200 /* Valid flag */
17#define PPC44x_TLB_TS 0x00000100 /* Translation address space */
18#define PPC44x_TLB_1K 0x00000000 /* Page sizes */
19#define PPC44x_TLB_4K 0x00000010
20#define PPC44x_TLB_16K 0x00000020
21#define PPC44x_TLB_64K 0x00000030
22#define PPC44x_TLB_256K 0x00000040
23#define PPC44x_TLB_1M 0x00000050
24#define PPC44x_TLB_16M 0x00000070
25#define PPC44x_TLB_256M 0x00000090
26
27/* Translation fields */
28#define PPC44x_TLB_RPN_MASK 0xfffffc00 /* Real Page Number */
29#define PPC44x_TLB_ERPN_MASK 0x0000000f
30
31/* Storage attribute and access control fields */
32#define PPC44x_TLB_ATTR_MASK 0x0000ff80
33#define PPC44x_TLB_U0 0x00008000 /* User 0 */
34#define PPC44x_TLB_U1 0x00004000 /* User 1 */
35#define PPC44x_TLB_U2 0x00002000 /* User 2 */
36#define PPC44x_TLB_U3 0x00001000 /* User 3 */
37#define PPC44x_TLB_W 0x00000800 /* Caching is write-through */
38#define PPC44x_TLB_I 0x00000400 /* Caching is inhibited */
39#define PPC44x_TLB_M 0x00000200 /* Memory is coherent */
40#define PPC44x_TLB_G 0x00000100 /* Memory is guarded */
41#define PPC44x_TLB_E 0x00000080 /* Memory is guarded */
42
43#define PPC44x_TLB_PERM_MASK 0x0000003f
44#define PPC44x_TLB_UX 0x00000020 /* User execution */
45#define PPC44x_TLB_UW 0x00000010 /* User write */
46#define PPC44x_TLB_UR 0x00000008 /* User read */
47#define PPC44x_TLB_SX 0x00000004 /* Super execution */
48#define PPC44x_TLB_SW 0x00000002 /* Super write */
49#define PPC44x_TLB_SR 0x00000001 /* Super read */
50
51/* Number of TLB entries */
52#define PPC44x_TLB_SIZE 64
53
54#ifndef __ASSEMBLY__
55
56extern unsigned int tlb_44x_hwater;
57
58typedef struct {
59 unsigned long id;
60 unsigned long vdso_base;
61} mm_context_t;
62
63#endif /* !__ASSEMBLY__ */
64
65#ifndef CONFIG_PPC_EARLY_DEBUG_44x
66#define PPC44x_EARLY_TLBS 1
67#else
68#define PPC44x_EARLY_TLBS 2
69#define PPC44x_EARLY_DEBUG_VIRTADDR (ASM_CONST(0xf0000000) \
70 | (ASM_CONST(CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW) & 0xffff))
71#endif
72
73/* Size of the TLBs used for pinning in lowmem */
74#define PPC_PIN_SIZE (1 << 28) /* 256M */
75
76#endif /* _ASM_POWERPC_MMU_44X_H_ */
diff --git a/arch/powerpc/include/asm/mmu-8xx.h b/arch/powerpc/include/asm/mmu-8xx.h
new file mode 100644
index 000000000000..9db877eb88db
--- /dev/null
+++ b/arch/powerpc/include/asm/mmu-8xx.h
@@ -0,0 +1,145 @@
1#ifndef _ASM_POWERPC_MMU_8XX_H_
2#define _ASM_POWERPC_MMU_8XX_H_
3/*
4 * PPC8xx support
5 */
6
7/* Control/status registers for the MPC8xx.
8 * A write operation to these registers causes serialized access.
9 * During software tablewalk, the registers used perform mask/shift-add
10 * operations when written/read. A TLB entry is created when the Mx_RPN
11 * is written, and the contents of several registers are used to
12 * create the entry.
13 */
14#define SPRN_MI_CTR 784 /* Instruction TLB control register */
15#define MI_GPM 0x80000000 /* Set domain manager mode */
16#define MI_PPM 0x40000000 /* Set subpage protection */
17#define MI_CIDEF 0x20000000 /* Set cache inhibit when MMU dis */
18#define MI_RSV4I 0x08000000 /* Reserve 4 TLB entries */
19#define MI_PPCS 0x02000000 /* Use MI_RPN prob/priv state */
20#define MI_IDXMASK 0x00001f00 /* TLB index to be loaded */
21#define MI_RESETVAL 0x00000000 /* Value of register at reset */
22
23/* These are the Ks and Kp from the PowerPC books. For proper operation,
24 * Ks = 0, Kp = 1.
25 */
26#define SPRN_MI_AP 786
27#define MI_Ks 0x80000000 /* Should not be set */
28#define MI_Kp 0x40000000 /* Should always be set */
29
30/* The effective page number register. When read, contains the information
31 * about the last instruction TLB miss. When MI_RPN is written, bits in
32 * this register are used to create the TLB entry.
33 */
34#define SPRN_MI_EPN 787
35#define MI_EPNMASK 0xfffff000 /* Effective page number for entry */
36#define MI_EVALID 0x00000200 /* Entry is valid */
37#define MI_ASIDMASK 0x0000000f /* ASID match value */
38 /* Reset value is undefined */
39
40/* A "level 1" or "segment" or whatever you want to call it register.
41 * For the instruction TLB, it contains bits that get loaded into the
42 * TLB entry when the MI_RPN is written.
43 */
44#define SPRN_MI_TWC 789
45#define MI_APG 0x000001e0 /* Access protection group (0) */
46#define MI_GUARDED 0x00000010 /* Guarded storage */
47#define MI_PSMASK 0x0000000c /* Mask of page size bits */
48#define MI_PS8MEG 0x0000000c /* 8M page size */
49#define MI_PS512K 0x00000004 /* 512K page size */
50#define MI_PS4K_16K 0x00000000 /* 4K or 16K page size */
51#define MI_SVALID 0x00000001 /* Segment entry is valid */
52 /* Reset value is undefined */
53
54/* Real page number. Defined by the pte. Writing this register
55 * causes a TLB entry to be created for the instruction TLB, using
56 * additional information from the MI_EPN, and MI_TWC registers.
57 */
58#define SPRN_MI_RPN 790
59
60/* Define an RPN value for mapping kernel memory to large virtual
61 * pages for boot initialization. This has real page number of 0,
62 * large page size, shared page, cache enabled, and valid.
63 * Also mark all subpages valid and write access.
64 */
65#define MI_BOOTINIT 0x000001fd
66
67#define SPRN_MD_CTR 792 /* Data TLB control register */
68#define MD_GPM 0x80000000 /* Set domain manager mode */
69#define MD_PPM 0x40000000 /* Set subpage protection */
70#define MD_CIDEF 0x20000000 /* Set cache inhibit when MMU dis */
71#define MD_WTDEF 0x10000000 /* Set writethrough when MMU dis */
72#define MD_RSV4I 0x08000000 /* Reserve 4 TLB entries */
73#define MD_TWAM 0x04000000 /* Use 4K page hardware assist */
74#define MD_PPCS 0x02000000 /* Use MI_RPN prob/priv state */
75#define MD_IDXMASK 0x00001f00 /* TLB index to be loaded */
76#define MD_RESETVAL 0x04000000 /* Value of register at reset */
77
78#define SPRN_M_CASID 793 /* Address space ID (context) to match */
79#define MC_ASIDMASK 0x0000000f /* Bits used for ASID value */
80
81
82/* These are the Ks and Kp from the PowerPC books. For proper operation,
83 * Ks = 0, Kp = 1.
84 */
85#define SPRN_MD_AP 794
86#define MD_Ks 0x80000000 /* Should not be set */
87#define MD_Kp 0x40000000 /* Should always be set */
88
89/* The effective page number register. When read, contains the information
90 * about the last instruction TLB miss. When MD_RPN is written, bits in
91 * this register are used to create the TLB entry.
92 */
93#define SPRN_MD_EPN 795
94#define MD_EPNMASK 0xfffff000 /* Effective page number for entry */
95#define MD_EVALID 0x00000200 /* Entry is valid */
96#define MD_ASIDMASK 0x0000000f /* ASID match value */
97 /* Reset value is undefined */
98
99/* The pointer to the base address of the first level page table.
100 * During a software tablewalk, reading this register provides the address
101 * of the entry associated with MD_EPN.
102 */
103#define SPRN_M_TWB 796
104#define M_L1TB 0xfffff000 /* Level 1 table base address */
105#define M_L1INDX 0x00000ffc /* Level 1 index, when read */
106 /* Reset value is undefined */
107
108/* A "level 1" or "segment" or whatever you want to call it register.
109 * For the data TLB, it contains bits that get loaded into the TLB entry
110 * when the MD_RPN is written. It is also provides the hardware assist
111 * for finding the PTE address during software tablewalk.
112 */
113#define SPRN_MD_TWC 797
114#define MD_L2TB 0xfffff000 /* Level 2 table base address */
115#define MD_L2INDX 0xfffffe00 /* Level 2 index (*pte), when read */
116#define MD_APG 0x000001e0 /* Access protection group (0) */
117#define MD_GUARDED 0x00000010 /* Guarded storage */
118#define MD_PSMASK 0x0000000c /* Mask of page size bits */
119#define MD_PS8MEG 0x0000000c /* 8M page size */
120#define MD_PS512K 0x00000004 /* 512K page size */
121#define MD_PS4K_16K 0x00000000 /* 4K or 16K page size */
122#define MD_WT 0x00000002 /* Use writethrough page attribute */
123#define MD_SVALID 0x00000001 /* Segment entry is valid */
124 /* Reset value is undefined */
125
126
127/* Real page number. Defined by the pte. Writing this register
128 * causes a TLB entry to be created for the data TLB, using
129 * additional information from the MD_EPN, and MD_TWC registers.
130 */
131#define SPRN_MD_RPN 798
132
133/* This is a temporary storage register that could be used to save
134 * a processor working register during a tablewalk.
135 */
136#define SPRN_M_TW 799
137
138#ifndef __ASSEMBLY__
139typedef struct {
140 unsigned long id;
141 unsigned long vdso_base;
142} mm_context_t;
143#endif /* !__ASSEMBLY__ */
144
145#endif /* _ASM_POWERPC_MMU_8XX_H_ */
diff --git a/arch/powerpc/include/asm/mmu-fsl-booke.h b/arch/powerpc/include/asm/mmu-fsl-booke.h
new file mode 100644
index 000000000000..925d93cf64d8
--- /dev/null
+++ b/arch/powerpc/include/asm/mmu-fsl-booke.h
@@ -0,0 +1,82 @@
1#ifndef _ASM_POWERPC_MMU_FSL_BOOKE_H_
2#define _ASM_POWERPC_MMU_FSL_BOOKE_H_
3/*
4 * Freescale Book-E MMU support
5 */
6
7/* Book-E defined page sizes */
8#define BOOKE_PAGESZ_1K 0
9#define BOOKE_PAGESZ_4K 1
10#define BOOKE_PAGESZ_16K 2
11#define BOOKE_PAGESZ_64K 3
12#define BOOKE_PAGESZ_256K 4
13#define BOOKE_PAGESZ_1M 5
14#define BOOKE_PAGESZ_4M 6
15#define BOOKE_PAGESZ_16M 7
16#define BOOKE_PAGESZ_64M 8
17#define BOOKE_PAGESZ_256M 9
18#define BOOKE_PAGESZ_1GB 10
19#define BOOKE_PAGESZ_4GB 11
20#define BOOKE_PAGESZ_16GB 12
21#define BOOKE_PAGESZ_64GB 13
22#define BOOKE_PAGESZ_256GB 14
23#define BOOKE_PAGESZ_1TB 15
24
25#define MAS0_TLBSEL(x) ((x << 28) & 0x30000000)
26#define MAS0_ESEL(x) ((x << 16) & 0x0FFF0000)
27#define MAS0_NV(x) ((x) & 0x00000FFF)
28
29#define MAS1_VALID 0x80000000
30#define MAS1_IPROT 0x40000000
31#define MAS1_TID(x) ((x << 16) & 0x3FFF0000)
32#define MAS1_TS 0x00001000
33#define MAS1_TSIZE(x) ((x << 8) & 0x00000F00)
34
35#define MAS2_EPN 0xFFFFF000
36#define MAS2_X0 0x00000040
37#define MAS2_X1 0x00000020
38#define MAS2_W 0x00000010
39#define MAS2_I 0x00000008
40#define MAS2_M 0x00000004
41#define MAS2_G 0x00000002
42#define MAS2_E 0x00000001
43
44#define MAS3_RPN 0xFFFFF000
45#define MAS3_U0 0x00000200
46#define MAS3_U1 0x00000100
47#define MAS3_U2 0x00000080
48#define MAS3_U3 0x00000040
49#define MAS3_UX 0x00000020
50#define MAS3_SX 0x00000010
51#define MAS3_UW 0x00000008
52#define MAS3_SW 0x00000004
53#define MAS3_UR 0x00000002
54#define MAS3_SR 0x00000001
55
56#define MAS4_TLBSELD(x) MAS0_TLBSEL(x)
57#define MAS4_TIDDSEL 0x000F0000
58#define MAS4_TSIZED(x) MAS1_TSIZE(x)
59#define MAS4_X0D 0x00000040
60#define MAS4_X1D 0x00000020
61#define MAS4_WD 0x00000010
62#define MAS4_ID 0x00000008
63#define MAS4_MD 0x00000004
64#define MAS4_GD 0x00000002
65#define MAS4_ED 0x00000001
66
67#define MAS6_SPID0 0x3FFF0000
68#define MAS6_SPID1 0x00007FFE
69#define MAS6_SAS 0x00000001
70#define MAS6_SPID MAS6_SPID0
71
72#define MAS7_RPN 0xFFFFFFFF
73
74#ifndef __ASSEMBLY__
75
76typedef struct {
77 unsigned long id;
78 unsigned long vdso_base;
79} mm_context_t;
80#endif /* !__ASSEMBLY__ */
81
82#endif /* _ASM_POWERPC_MMU_FSL_BOOKE_H_ */
diff --git a/arch/powerpc/include/asm/mmu-hash32.h b/arch/powerpc/include/asm/mmu-hash32.h
new file mode 100644
index 000000000000..16b1a1e77e64
--- /dev/null
+++ b/arch/powerpc/include/asm/mmu-hash32.h
@@ -0,0 +1,83 @@
1#ifndef _ASM_POWERPC_MMU_HASH32_H_
2#define _ASM_POWERPC_MMU_HASH32_H_
3/*
4 * 32-bit hash table MMU support
5 */
6
7/*
8 * BATs
9 */
10
11/* Block size masks */
12#define BL_128K 0x000
13#define BL_256K 0x001
14#define BL_512K 0x003
15#define BL_1M 0x007
16#define BL_2M 0x00F
17#define BL_4M 0x01F
18#define BL_8M 0x03F
19#define BL_16M 0x07F
20#define BL_32M 0x0FF
21#define BL_64M 0x1FF
22#define BL_128M 0x3FF
23#define BL_256M 0x7FF
24
25/* BAT Access Protection */
26#define BPP_XX 0x00 /* No access */
27#define BPP_RX 0x01 /* Read only */
28#define BPP_RW 0x02 /* Read/write */
29
30#ifndef __ASSEMBLY__
31/* Contort a phys_addr_t into the right format/bits for a BAT */
32#ifdef CONFIG_PHYS_64BIT
33#define BAT_PHYS_ADDR(x) ((u32)((x & 0x00000000fffe0000ULL) | \
34 ((x & 0x0000000e00000000ULL) >> 24) | \
35 ((x & 0x0000000100000000ULL) >> 30)))
36#else
37#define BAT_PHYS_ADDR(x) (x)
38#endif
39
40struct ppc_bat {
41 u32 batu;
42 u32 batl;
43};
44#endif /* !__ASSEMBLY__ */
45
46/*
47 * Hash table
48 */
49
50/* Values for PP (assumes Ks=0, Kp=1) */
51#define PP_RWXX 0 /* Supervisor read/write, User none */
52#define PP_RWRX 1 /* Supervisor read/write, User read */
53#define PP_RWRW 2 /* Supervisor read/write, User read/write */
54#define PP_RXRX 3 /* Supervisor read, User read */
55
56#ifndef __ASSEMBLY__
57
58/* Hardware Page Table Entry */
59struct hash_pte {
60 unsigned long v:1; /* Entry is valid */
61 unsigned long vsid:24; /* Virtual segment identifier */
62 unsigned long h:1; /* Hash algorithm indicator */
63 unsigned long api:6; /* Abbreviated page index */
64 unsigned long rpn:20; /* Real (physical) page number */
65 unsigned long :3; /* Unused */
66 unsigned long r:1; /* Referenced */
67 unsigned long c:1; /* Changed */
68 unsigned long w:1; /* Write-thru cache mode */
69 unsigned long i:1; /* Cache inhibited */
70 unsigned long m:1; /* Memory coherence */
71 unsigned long g:1; /* Guarded */
72 unsigned long :1; /* Unused */
73 unsigned long pp:2; /* Page protection */
74};
75
76typedef struct {
77 unsigned long id;
78 unsigned long vdso_base;
79} mm_context_t;
80
81#endif /* !__ASSEMBLY__ */
82
83#endif /* _ASM_POWERPC_MMU_HASH32_H_ */
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
new file mode 100644
index 000000000000..19c7a9403490
--- /dev/null
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -0,0 +1,478 @@
1#ifndef _ASM_POWERPC_MMU_HASH64_H_
2#define _ASM_POWERPC_MMU_HASH64_H_
3/*
4 * PowerPC64 memory management structures
5 *
6 * Dave Engebretsen & Mike Corrigan <{engebret|mikejc}@us.ibm.com>
7 * PPC64 rework.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#include <asm/asm-compat.h>
16#include <asm/page.h>
17
18/*
19 * Segment table
20 */
21
22#define STE_ESID_V 0x80
23#define STE_ESID_KS 0x20
24#define STE_ESID_KP 0x10
25#define STE_ESID_N 0x08
26
27#define STE_VSID_SHIFT 12
28
29/* Location of cpu0's segment table */
30#define STAB0_PAGE 0x6
31#define STAB0_OFFSET (STAB0_PAGE << 12)
32#define STAB0_PHYS_ADDR (STAB0_OFFSET + PHYSICAL_START)
33
34#ifndef __ASSEMBLY__
35extern char initial_stab[];
36#endif /* ! __ASSEMBLY */
37
38/*
39 * SLB
40 */
41
42#define SLB_NUM_BOLTED 3
43#define SLB_CACHE_ENTRIES 8
44
45/* Bits in the SLB ESID word */
46#define SLB_ESID_V ASM_CONST(0x0000000008000000) /* valid */
47
48/* Bits in the SLB VSID word */
49#define SLB_VSID_SHIFT 12
50#define SLB_VSID_SHIFT_1T 24
51#define SLB_VSID_SSIZE_SHIFT 62
52#define SLB_VSID_B ASM_CONST(0xc000000000000000)
53#define SLB_VSID_B_256M ASM_CONST(0x0000000000000000)
54#define SLB_VSID_B_1T ASM_CONST(0x4000000000000000)
55#define SLB_VSID_KS ASM_CONST(0x0000000000000800)
56#define SLB_VSID_KP ASM_CONST(0x0000000000000400)
57#define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */
58#define SLB_VSID_L ASM_CONST(0x0000000000000100)
59#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */
60#define SLB_VSID_LP ASM_CONST(0x0000000000000030)
61#define SLB_VSID_LP_00 ASM_CONST(0x0000000000000000)
62#define SLB_VSID_LP_01 ASM_CONST(0x0000000000000010)
63#define SLB_VSID_LP_10 ASM_CONST(0x0000000000000020)
64#define SLB_VSID_LP_11 ASM_CONST(0x0000000000000030)
65#define SLB_VSID_LLP (SLB_VSID_L|SLB_VSID_LP)
66
67#define SLB_VSID_KERNEL (SLB_VSID_KP)
68#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C)
69
70#define SLBIE_C (0x08000000)
71#define SLBIE_SSIZE_SHIFT 25
72
73/*
74 * Hash table
75 */
76
77#define HPTES_PER_GROUP 8
78
79#define HPTE_V_SSIZE_SHIFT 62
80#define HPTE_V_AVPN_SHIFT 7
81#define HPTE_V_AVPN ASM_CONST(0x3fffffffffffff80)
82#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT)
83#define HPTE_V_COMPARE(x,y) (!(((x) ^ (y)) & 0xffffffffffffff80UL))
84#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010)
85#define HPTE_V_LOCK ASM_CONST(0x0000000000000008)
86#define HPTE_V_LARGE ASM_CONST(0x0000000000000004)
87#define HPTE_V_SECONDARY ASM_CONST(0x0000000000000002)
88#define HPTE_V_VALID ASM_CONST(0x0000000000000001)
89
90#define HPTE_R_PP0 ASM_CONST(0x8000000000000000)
91#define HPTE_R_TS ASM_CONST(0x4000000000000000)
92#define HPTE_R_RPN_SHIFT 12
93#define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000)
94#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff)
95#define HPTE_R_PP ASM_CONST(0x0000000000000003)
96#define HPTE_R_N ASM_CONST(0x0000000000000004)
97#define HPTE_R_C ASM_CONST(0x0000000000000080)
98#define HPTE_R_R ASM_CONST(0x0000000000000100)
99
100#define HPTE_V_1TB_SEG ASM_CONST(0x4000000000000000)
101#define HPTE_V_VRMA_MASK ASM_CONST(0x4001ffffff000000)
102
103/* Values for PP (assumes Ks=0, Kp=1) */
104/* pp0 will always be 0 for linux */
105#define PP_RWXX 0 /* Supervisor read/write, User none */
106#define PP_RWRX 1 /* Supervisor read/write, User read */
107#define PP_RWRW 2 /* Supervisor read/write, User read/write */
108#define PP_RXRX 3 /* Supervisor read, User read */
109
110#ifndef __ASSEMBLY__
111
112struct hash_pte {
113 unsigned long v;
114 unsigned long r;
115};
116
117extern struct hash_pte *htab_address;
118extern unsigned long htab_size_bytes;
119extern unsigned long htab_hash_mask;
120
121/*
122 * Page size definition
123 *
124 * shift : is the "PAGE_SHIFT" value for that page size
125 * sllp : is a bit mask with the value of SLB L || LP to be or'ed
126 * directly to a slbmte "vsid" value
127 * penc : is the HPTE encoding mask for the "LP" field:
128 *
129 */
130struct mmu_psize_def
131{
132 unsigned int shift; /* number of bits */
133 unsigned int penc; /* HPTE encoding */
134 unsigned int tlbiel; /* tlbiel supported for that page size */
135 unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */
136 unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
137};
138
139#endif /* __ASSEMBLY__ */
140
141/*
142 * The kernel use the constants below to index in the page sizes array.
143 * The use of fixed constants for this purpose is better for performances
144 * of the low level hash refill handlers.
145 *
146 * A non supported page size has a "shift" field set to 0
147 *
148 * Any new page size being implemented can get a new entry in here. Whether
149 * the kernel will use it or not is a different matter though. The actual page
150 * size used by hugetlbfs is not defined here and may be made variable
151 */
152
153#define MMU_PAGE_4K 0 /* 4K */
154#define MMU_PAGE_64K 1 /* 64K */
155#define MMU_PAGE_64K_AP 2 /* 64K Admixed (in a 4K segment) */
156#define MMU_PAGE_1M 3 /* 1M */
157#define MMU_PAGE_16M 4 /* 16M */
158#define MMU_PAGE_16G 5 /* 16G */
159#define MMU_PAGE_COUNT 6
160
161/*
162 * Segment sizes.
163 * These are the values used by hardware in the B field of
164 * SLB entries and the first dword of MMU hashtable entries.
165 * The B field is 2 bits; the values 2 and 3 are unused and reserved.
166 */
167#define MMU_SEGSIZE_256M 0
168#define MMU_SEGSIZE_1T 1
169
170
171#ifndef __ASSEMBLY__
172
173/*
174 * The current system page and segment sizes
175 */
176extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
177extern int mmu_linear_psize;
178extern int mmu_virtual_psize;
179extern int mmu_vmalloc_psize;
180extern int mmu_vmemmap_psize;
181extern int mmu_io_psize;
182extern int mmu_kernel_ssize;
183extern int mmu_highuser_ssize;
184extern u16 mmu_slb_size;
185extern unsigned long tce_alloc_start, tce_alloc_end;
186
187/*
188 * If the processor supports 64k normal pages but not 64k cache
189 * inhibited pages, we have to be prepared to switch processes
190 * to use 4k pages when they create cache-inhibited mappings.
191 * If this is the case, mmu_ci_restrictions will be set to 1.
192 */
193extern int mmu_ci_restrictions;
194
195#ifdef CONFIG_HUGETLB_PAGE
196/*
197 * The page size indexes of the huge pages for use by hugetlbfs
198 */
199extern unsigned int mmu_huge_psizes[MMU_PAGE_COUNT];
200
201#endif /* CONFIG_HUGETLB_PAGE */
202
203/*
204 * This function sets the AVPN and L fields of the HPTE appropriately
205 * for the page size
206 */
207static inline unsigned long hpte_encode_v(unsigned long va, int psize,
208 int ssize)
209{
210 unsigned long v;
211 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm);
212 v <<= HPTE_V_AVPN_SHIFT;
213 if (psize != MMU_PAGE_4K)
214 v |= HPTE_V_LARGE;
215 v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT;
216 return v;
217}
218
219/*
220 * This function sets the ARPN, and LP fields of the HPTE appropriately
221 * for the page size. We assume the pa is already "clean" that is properly
222 * aligned for the requested page size
223 */
224static inline unsigned long hpte_encode_r(unsigned long pa, int psize)
225{
226 unsigned long r;
227
228 /* A 4K page needs no special encoding */
229 if (psize == MMU_PAGE_4K)
230 return pa & HPTE_R_RPN;
231 else {
232 unsigned int penc = mmu_psize_defs[psize].penc;
233 unsigned int shift = mmu_psize_defs[psize].shift;
234 return (pa & ~((1ul << shift) - 1)) | (penc << 12);
235 }
236 return r;
237}
238
239/*
240 * Build a VA given VSID, EA and segment size
241 */
242static inline unsigned long hpt_va(unsigned long ea, unsigned long vsid,
243 int ssize)
244{
245 if (ssize == MMU_SEGSIZE_256M)
246 return (vsid << 28) | (ea & 0xfffffffUL);
247 return (vsid << 40) | (ea & 0xffffffffffUL);
248}
249
250/*
251 * This hashes a virtual address
252 */
253
254static inline unsigned long hpt_hash(unsigned long va, unsigned int shift,
255 int ssize)
256{
257 unsigned long hash, vsid;
258
259 if (ssize == MMU_SEGSIZE_256M) {
260 hash = (va >> 28) ^ ((va & 0x0fffffffUL) >> shift);
261 } else {
262 vsid = va >> 40;
263 hash = vsid ^ (vsid << 25) ^ ((va & 0xffffffffffUL) >> shift);
264 }
265 return hash & 0x7fffffffffUL;
266}
267
268extern int __hash_page_4K(unsigned long ea, unsigned long access,
269 unsigned long vsid, pte_t *ptep, unsigned long trap,
270 unsigned int local, int ssize, int subpage_prot);
271extern int __hash_page_64K(unsigned long ea, unsigned long access,
272 unsigned long vsid, pte_t *ptep, unsigned long trap,
273 unsigned int local, int ssize);
274struct mm_struct;
275extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap);
276extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
277 unsigned long ea, unsigned long vsid, int local,
278 unsigned long trap);
279
280extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
281 unsigned long pstart, unsigned long mode,
282 int psize, int ssize);
283extern void set_huge_psize(int psize);
284extern void add_gpage(unsigned long addr, unsigned long page_size,
285 unsigned long number_of_pages);
286extern void demote_segment_4k(struct mm_struct *mm, unsigned long addr);
287
288extern void htab_initialize(void);
289extern void htab_initialize_secondary(void);
290extern void hpte_init_native(void);
291extern void hpte_init_lpar(void);
292extern void hpte_init_iSeries(void);
293extern void hpte_init_beat(void);
294extern void hpte_init_beat_v3(void);
295
296extern void stabs_alloc(void);
297extern void slb_initialize(void);
298extern void slb_flush_and_rebolt(void);
299extern void stab_initialize(unsigned long stab);
300
301extern void slb_vmalloc_update(void);
302#endif /* __ASSEMBLY__ */
303
304/*
305 * VSID allocation
306 *
307 * We first generate a 36-bit "proto-VSID". For kernel addresses this
308 * is equal to the ESID, for user addresses it is:
309 * (context << 15) | (esid & 0x7fff)
310 *
311 * The two forms are distinguishable because the top bit is 0 for user
312 * addresses, whereas the top two bits are 1 for kernel addresses.
313 * Proto-VSIDs with the top two bits equal to 0b10 are reserved for
314 * now.
315 *
316 * The proto-VSIDs are then scrambled into real VSIDs with the
317 * multiplicative hash:
318 *
319 * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS
320 * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7
321 * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF
322 *
323 * This scramble is only well defined for proto-VSIDs below
324 * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are
325 * reserved. VSID_MULTIPLIER is prime, so in particular it is
326 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function.
327 * Because the modulus is 2^n-1 we can compute it efficiently without
328 * a divide or extra multiply (see below).
329 *
330 * This scheme has several advantages over older methods:
331 *
332 * - We have VSIDs allocated for every kernel address
333 * (i.e. everything above 0xC000000000000000), except the very top
334 * segment, which simplifies several things.
335 *
336 * - We allow for 15 significant bits of ESID and 20 bits of
337 * context for user addresses. i.e. 8T (43 bits) of address space for
338 * up to 1M contexts (although the page table structure and context
339 * allocation will need changes to take advantage of this).
340 *
341 * - The scramble function gives robust scattering in the hash
342 * table (at least based on some initial results). The previous
343 * method was more susceptible to pathological cases giving excessive
344 * hash collisions.
345 */
346/*
347 * WARNING - If you change these you must make sure the asm
348 * implementations in slb_allocate (slb_low.S), do_stab_bolted
349 * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly.
350 *
351 * You'll also need to change the precomputed VSID values in head.S
352 * which are used by the iSeries firmware.
353 */
354
355#define VSID_MULTIPLIER_256M ASM_CONST(200730139) /* 28-bit prime */
356#define VSID_BITS_256M 36
357#define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1)
358
359#define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */
360#define VSID_BITS_1T 24
361#define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1)
362
363#define CONTEXT_BITS 19
364#define USER_ESID_BITS 16
365#define USER_ESID_BITS_1T 4
366
367#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT))
368
369/*
370 * This macro generates asm code to compute the VSID scramble
371 * function. Used in slb_allocate() and do_stab_bolted. The function
372 * computed is: (protovsid*VSID_MULTIPLIER) % VSID_MODULUS
373 *
374 * rt = register continaing the proto-VSID and into which the
375 * VSID will be stored
376 * rx = scratch register (clobbered)
377 *
378 * - rt and rx must be different registers
379 * - The answer will end up in the low VSID_BITS bits of rt. The higher
380 * bits may contain other garbage, so you may need to mask the
381 * result.
382 */
383#define ASM_VSID_SCRAMBLE(rt, rx, size) \
384 lis rx,VSID_MULTIPLIER_##size@h; \
385 ori rx,rx,VSID_MULTIPLIER_##size@l; \
386 mulld rt,rt,rx; /* rt = rt * MULTIPLIER */ \
387 \
388 srdi rx,rt,VSID_BITS_##size; \
389 clrldi rt,rt,(64-VSID_BITS_##size); \
390 add rt,rt,rx; /* add high and low bits */ \
391 /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \
392 * 2^36-1+2^28-1. That in particular means that if r3 >= \
393 * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \
394 * the bit clear, r3 already has the answer we want, if it \
395 * doesn't, the answer is the low 36 bits of r3+1. So in all \
396 * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\
397 addi rx,rt,1; \
398 srdi rx,rx,VSID_BITS_##size; /* extract 2^VSID_BITS bit */ \
399 add rt,rt,rx
400
401
402#ifndef __ASSEMBLY__
403
404typedef unsigned long mm_context_id_t;
405
406typedef struct {
407 mm_context_id_t id;
408 u16 user_psize; /* page size index */
409
410#ifdef CONFIG_PPC_MM_SLICES
411 u64 low_slices_psize; /* SLB page size encodings */
412 u64 high_slices_psize; /* 4 bits per slice for now */
413#else
414 u16 sllp; /* SLB page size encoding */
415#endif
416 unsigned long vdso_base;
417} mm_context_t;
418
419
420#if 0
421/*
422 * The code below is equivalent to this function for arguments
423 * < 2^VSID_BITS, which is all this should ever be called
424 * with. However gcc is not clever enough to compute the
425 * modulus (2^n-1) without a second multiply.
426 */
427#define vsid_scrample(protovsid, size) \
428 ((((protovsid) * VSID_MULTIPLIER_##size) % VSID_MODULUS_##size))
429
430#else /* 1 */
431#define vsid_scramble(protovsid, size) \
432 ({ \
433 unsigned long x; \
434 x = (protovsid) * VSID_MULTIPLIER_##size; \
435 x = (x >> VSID_BITS_##size) + (x & VSID_MODULUS_##size); \
436 (x + ((x+1) >> VSID_BITS_##size)) & VSID_MODULUS_##size; \
437 })
438#endif /* 1 */
439
440/* This is only valid for addresses >= KERNELBASE */
441static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
442{
443 if (ssize == MMU_SEGSIZE_256M)
444 return vsid_scramble(ea >> SID_SHIFT, 256M);
445 return vsid_scramble(ea >> SID_SHIFT_1T, 1T);
446}
447
448/* Returns the segment size indicator for a user address */
449static inline int user_segment_size(unsigned long addr)
450{
451 /* Use 1T segments if possible for addresses >= 1T */
452 if (addr >= (1UL << SID_SHIFT_1T))
453 return mmu_highuser_ssize;
454 return MMU_SEGSIZE_256M;
455}
456
457/* This is only valid for user addresses (which are below 2^44) */
458static inline unsigned long get_vsid(unsigned long context, unsigned long ea,
459 int ssize)
460{
461 if (ssize == MMU_SEGSIZE_256M)
462 return vsid_scramble((context << USER_ESID_BITS)
463 | (ea >> SID_SHIFT), 256M);
464 return vsid_scramble((context << USER_ESID_BITS_1T)
465 | (ea >> SID_SHIFT_1T), 1T);
466}
467
468/*
469 * This is only used on legacy iSeries in lparmap.c,
470 * hence the 256MB segment assumption.
471 */
472#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER_256M) % \
473 VSID_MODULUS_256M)
474#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
475
476#endif /* __ASSEMBLY__ */
477
478#endif /* _ASM_POWERPC_MMU_HASH64_H_ */
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
new file mode 100644
index 000000000000..4c0e1b4f975c
--- /dev/null
+++ b/arch/powerpc/include/asm/mmu.h
@@ -0,0 +1,26 @@
1#ifndef _ASM_POWERPC_MMU_H_
2#define _ASM_POWERPC_MMU_H_
3#ifdef __KERNEL__
4
5#ifdef CONFIG_PPC64
6/* 64-bit classic hash table MMU */
7# include <asm/mmu-hash64.h>
8#elif defined(CONFIG_PPC_STD_MMU)
9/* 32-bit classic hash table MMU */
10# include <asm/mmu-hash32.h>
11#elif defined(CONFIG_40x)
12/* 40x-style software loaded TLB */
13# include <asm/mmu-40x.h>
14#elif defined(CONFIG_44x)
15/* 44x-style software loaded TLB */
16# include <asm/mmu-44x.h>
17#elif defined(CONFIG_FSL_BOOKE)
18/* Freescale Book-E software loaded TLB */
19# include <asm/mmu-fsl-booke.h>
20#elif defined (CONFIG_PPC_8xx)
21/* Motorola/Freescale 8xx software loaded TLB */
22# include <asm/mmu-8xx.h>
23#endif
24
25#endif /* __KERNEL__ */
26#endif /* _ASM_POWERPC_MMU_H_ */
diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
new file mode 100644
index 000000000000..9102b8bf0ead
--- /dev/null
+++ b/arch/powerpc/include/asm/mmu_context.h
@@ -0,0 +1,280 @@
1#ifndef __ASM_POWERPC_MMU_CONTEXT_H
2#define __ASM_POWERPC_MMU_CONTEXT_H
3#ifdef __KERNEL__
4
5#include <asm/mmu.h>
6#include <asm/cputable.h>
7#include <asm-generic/mm_hooks.h>
8
9#ifndef CONFIG_PPC64
10#include <asm/atomic.h>
11#include <linux/bitops.h>
12
13/*
14 * On 32-bit PowerPC 6xx/7xx/7xxx CPUs, we use a set of 16 VSIDs
15 * (virtual segment identifiers) for each context. Although the
16 * hardware supports 24-bit VSIDs, and thus >1 million contexts,
17 * we only use 32,768 of them. That is ample, since there can be
18 * at most around 30,000 tasks in the system anyway, and it means
19 * that we can use a bitmap to indicate which contexts are in use.
20 * Using a bitmap means that we entirely avoid all of the problems
21 * that we used to have when the context number overflowed,
22 * particularly on SMP systems.
23 * -- paulus.
24 */
25
26/*
27 * This function defines the mapping from contexts to VSIDs (virtual
28 * segment IDs). We use a skew on both the context and the high 4 bits
29 * of the 32-bit virtual address (the "effective segment ID") in order
30 * to spread out the entries in the MMU hash table. Note, if this
31 * function is changed then arch/ppc/mm/hashtable.S will have to be
32 * changed to correspond.
33 */
34#define CTX_TO_VSID(ctx, va) (((ctx) * (897 * 16) + ((va) >> 28) * 0x111) \
35 & 0xffffff)
36
37/*
38 The MPC8xx has only 16 contexts. We rotate through them on each
39 task switch. A better way would be to keep track of tasks that
40 own contexts, and implement an LRU usage. That way very active
41 tasks don't always have to pay the TLB reload overhead. The
42 kernel pages are mapped shared, so the kernel can run on behalf
43 of any task that makes a kernel entry. Shared does not mean they
44 are not protected, just that the ASID comparison is not performed.
45 -- Dan
46
47 The IBM4xx has 256 contexts, so we can just rotate through these
48 as a way of "switching" contexts. If the TID of the TLB is zero,
49 the PID/TID comparison is disabled, so we can use a TID of zero
50 to represent all kernel pages as shared among all contexts.
51 -- Dan
52 */
53
54static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
55{
56}
57
58#ifdef CONFIG_8xx
59#define NO_CONTEXT 16
60#define LAST_CONTEXT 15
61#define FIRST_CONTEXT 0
62
63#elif defined(CONFIG_4xx)
64#define NO_CONTEXT 256
65#define LAST_CONTEXT 255
66#define FIRST_CONTEXT 1
67
68#elif defined(CONFIG_E200) || defined(CONFIG_E500)
69#define NO_CONTEXT 256
70#define LAST_CONTEXT 255
71#define FIRST_CONTEXT 1
72
73#else
74
75/* PPC 6xx, 7xx CPUs */
76#define NO_CONTEXT ((unsigned long) -1)
77#define LAST_CONTEXT 32767
78#define FIRST_CONTEXT 1
79#endif
80
81/*
82 * Set the current MMU context.
83 * On 32-bit PowerPCs (other than the 8xx embedded chips), this is done by
84 * loading up the segment registers for the user part of the address space.
85 *
86 * Since the PGD is immediately available, it is much faster to simply
87 * pass this along as a second parameter, which is required for 8xx and
88 * can be used for debugging on all processors (if you happen to have
89 * an Abatron).
90 */
91extern void set_context(unsigned long contextid, pgd_t *pgd);
92
93/*
94 * Bitmap of contexts in use.
95 * The size of this bitmap is LAST_CONTEXT + 1 bits.
96 */
97extern unsigned long context_map[];
98
99/*
100 * This caches the next context number that we expect to be free.
101 * Its use is an optimization only, we can't rely on this context
102 * number to be free, but it usually will be.
103 */
104extern unsigned long next_mmu_context;
105
106/*
107 * If we don't have sufficient contexts to give one to every task
108 * that could be in the system, we need to be able to steal contexts.
109 * These variables support that.
110 */
111#if LAST_CONTEXT < 30000
112#define FEW_CONTEXTS 1
113extern atomic_t nr_free_contexts;
114extern struct mm_struct *context_mm[LAST_CONTEXT+1];
115extern void steal_context(void);
116#endif
117
118/*
119 * Get a new mmu context for the address space described by `mm'.
120 */
121static inline void get_mmu_context(struct mm_struct *mm)
122{
123 unsigned long ctx;
124
125 if (mm->context.id != NO_CONTEXT)
126 return;
127#ifdef FEW_CONTEXTS
128 while (atomic_dec_if_positive(&nr_free_contexts) < 0)
129 steal_context();
130#endif
131 ctx = next_mmu_context;
132 while (test_and_set_bit(ctx, context_map)) {
133 ctx = find_next_zero_bit(context_map, LAST_CONTEXT+1, ctx);
134 if (ctx > LAST_CONTEXT)
135 ctx = 0;
136 }
137 next_mmu_context = (ctx + 1) & LAST_CONTEXT;
138 mm->context.id = ctx;
139#ifdef FEW_CONTEXTS
140 context_mm[ctx] = mm;
141#endif
142}
143
144/*
145 * Set up the context for a new address space.
146 */
147static inline int init_new_context(struct task_struct *t, struct mm_struct *mm)
148{
149 mm->context.id = NO_CONTEXT;
150 mm->context.vdso_base = 0;
151 return 0;
152}
153
154/*
155 * We're finished using the context for an address space.
156 */
157static inline void destroy_context(struct mm_struct *mm)
158{
159 preempt_disable();
160 if (mm->context.id != NO_CONTEXT) {
161 clear_bit(mm->context.id, context_map);
162 mm->context.id = NO_CONTEXT;
163#ifdef FEW_CONTEXTS
164 atomic_inc(&nr_free_contexts);
165#endif
166 }
167 preempt_enable();
168}
169
170static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
171 struct task_struct *tsk)
172{
173#ifdef CONFIG_ALTIVEC
174 if (cpu_has_feature(CPU_FTR_ALTIVEC))
175 asm volatile ("dssall;\n"
176#ifndef CONFIG_POWER4
177 "sync;\n" /* G4 needs a sync here, G5 apparently not */
178#endif
179 : : );
180#endif /* CONFIG_ALTIVEC */
181
182 tsk->thread.pgdir = next->pgd;
183
184 /* No need to flush userspace segments if the mm doesnt change */
185 if (prev == next)
186 return;
187
188 /* Setup new userspace context */
189 get_mmu_context(next);
190 set_context(next->context.id, next->pgd);
191}
192
193#define deactivate_mm(tsk,mm) do { } while (0)
194
195/*
196 * After we have set current->mm to a new value, this activates
197 * the context for the new mm so we see the new mappings.
198 */
199#define activate_mm(active_mm, mm) switch_mm(active_mm, mm, current)
200
201extern void mmu_context_init(void);
202
203
204#else
205
206#include <linux/kernel.h>
207#include <linux/mm.h>
208#include <linux/sched.h>
209
210/*
211 * Copyright (C) 2001 PPC 64 Team, IBM Corp
212 *
213 * This program is free software; you can redistribute it and/or
214 * modify it under the terms of the GNU General Public License
215 * as published by the Free Software Foundation; either version
216 * 2 of the License, or (at your option) any later version.
217 */
218
219static inline void enter_lazy_tlb(struct mm_struct *mm,
220 struct task_struct *tsk)
221{
222}
223
224/*
225 * The proto-VSID space has 2^35 - 1 segments available for user mappings.
226 * Each segment contains 2^28 bytes. Each context maps 2^44 bytes,
227 * so we can support 2^19-1 contexts (19 == 35 + 28 - 44).
228 */
229#define NO_CONTEXT 0
230#define MAX_CONTEXT ((1UL << 19) - 1)
231
232extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
233extern void destroy_context(struct mm_struct *mm);
234
235extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm);
236extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
237
238/*
239 * switch_mm is the entry point called from the architecture independent
240 * code in kernel/sched.c
241 */
242static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
243 struct task_struct *tsk)
244{
245 if (!cpu_isset(smp_processor_id(), next->cpu_vm_mask))
246 cpu_set(smp_processor_id(), next->cpu_vm_mask);
247
248 /* No need to flush userspace segments if the mm doesnt change */
249 if (prev == next)
250 return;
251
252#ifdef CONFIG_ALTIVEC
253 if (cpu_has_feature(CPU_FTR_ALTIVEC))
254 asm volatile ("dssall");
255#endif /* CONFIG_ALTIVEC */
256
257 if (cpu_has_feature(CPU_FTR_SLB))
258 switch_slb(tsk, next);
259 else
260 switch_stab(tsk, next);
261}
262
263#define deactivate_mm(tsk,mm) do { } while (0)
264
265/*
266 * After we have set current->mm to a new value, this activates
267 * the context for the new mm so we see the new mappings.
268 */
269static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
270{
271 unsigned long flags;
272
273 local_irq_save(flags);
274 switch_mm(prev, next, current);
275 local_irq_restore(flags);
276}
277
278#endif /* CONFIG_PPC64 */
279#endif /* __KERNEL__ */
280#endif /* __ASM_POWERPC_MMU_CONTEXT_H */
diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
new file mode 100644
index 000000000000..19f299b7e256
--- /dev/null
+++ b/arch/powerpc/include/asm/mmzone.h
@@ -0,0 +1,47 @@
1/*
2 * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99
3 *
4 * PowerPC64 port:
5 * Copyright (C) 2002 Anton Blanchard, IBM Corp.
6 */
7#ifndef _ASM_MMZONE_H_
8#define _ASM_MMZONE_H_
9#ifdef __KERNEL__
10
11
12/*
13 * generic non-linear memory support:
14 *
15 * 1) we will not split memory into more chunks than will fit into the
16 * flags field of the struct page
17 */
18
19#ifdef CONFIG_NEED_MULTIPLE_NODES
20
21extern struct pglist_data *node_data[];
22/*
23 * Return a pointer to the node data for node n.
24 */
25#define NODE_DATA(nid) (node_data[nid])
26
27/*
28 * Following are specific to this numa platform.
29 */
30
31extern int numa_cpu_lookup_table[];
32extern cpumask_t numa_cpumask_lookup_table[];
33#ifdef CONFIG_MEMORY_HOTPLUG
34extern unsigned long max_pfn;
35#endif
36
37/*
38 * Following are macros that each numa implmentation must define.
39 */
40
41#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
42#define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn)
43
44#endif /* CONFIG_NEED_MULTIPLE_NODES */
45
46#endif /* __KERNEL__ */
47#endif /* _ASM_MMZONE_H_ */
diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h
new file mode 100644
index 000000000000..e5f14b13ccf0
--- /dev/null
+++ b/arch/powerpc/include/asm/module.h
@@ -0,0 +1,77 @@
1#ifndef _ASM_POWERPC_MODULE_H
2#define _ASM_POWERPC_MODULE_H
3#ifdef __KERNEL__
4
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/list.h>
13#include <asm/bug.h>
14
15
16#ifndef __powerpc64__
17/*
18 * Thanks to Paul M for explaining this.
19 *
20 * PPC can only do rel jumps += 32MB, and often the kernel and other
21 * modules are furthur away than this. So, we jump to a table of
22 * trampolines attached to the module (the Procedure Linkage Table)
23 * whenever that happens.
24 */
25
26struct ppc_plt_entry {
27 /* 16 byte jump instruction sequence (4 instructions) */
28 unsigned int jump[4];
29};
30#endif /* __powerpc64__ */
31
32
33struct mod_arch_specific {
34#ifdef __powerpc64__
35 unsigned int stubs_section; /* Index of stubs section in module */
36 unsigned int toc_section; /* What section is the TOC? */
37#else
38 /* Indices of PLT sections within module. */
39 unsigned int core_plt_section;
40 unsigned int init_plt_section;
41#endif
42
43 /* List of BUG addresses, source line numbers and filenames */
44 struct list_head bug_list;
45 struct bug_entry *bug_table;
46 unsigned int num_bugs;
47};
48
49/*
50 * Select ELF headers.
51 * Make empty section for module_frob_arch_sections to expand.
52 */
53
54#ifdef __powerpc64__
55# define Elf_Shdr Elf64_Shdr
56# define Elf_Sym Elf64_Sym
57# define Elf_Ehdr Elf64_Ehdr
58# ifdef MODULE
59 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
60# endif
61#else
62# define Elf_Shdr Elf32_Shdr
63# define Elf_Sym Elf32_Sym
64# define Elf_Ehdr Elf32_Ehdr
65# ifdef MODULE
66 asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
67 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
68# endif /* MODULE */
69#endif
70
71
72struct exception_table_entry;
73void sort_ex_table(struct exception_table_entry *start,
74 struct exception_table_entry *finish);
75
76#endif /* __KERNEL__ */
77#endif /* _ASM_POWERPC_MODULE_H */
diff --git a/arch/powerpc/include/asm/mpc512x.h b/arch/powerpc/include/asm/mpc512x.h
new file mode 100644
index 000000000000..c48a1658eeac
--- /dev/null
+++ b/arch/powerpc/include/asm/mpc512x.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
3 *
4 * Author: John Rigby, <jrigby@freescale.com>, Friday Apr 13 2007
5 *
6 * Description:
7 * MPC5121 Prototypes and definitions
8 *
9 * This is free software; you can redistribute it and/or modify it
10 * 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_POWERPC_MPC512x_H__
17#define __ASM_POWERPC_MPC512x_H__
18
19extern unsigned long mpc512x_find_ips_freq(struct device_node *node);
20
21#endif /* __ASM_POWERPC_MPC512x_H__ */
22
diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
new file mode 100644
index 000000000000..81ef10b6b672
--- /dev/null
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -0,0 +1,295 @@
1/*
2 * Prototypes, etc. for the Freescale MPC52xx embedded cpu chips
3 * May need to be cleaned as the port goes on ...
4 *
5 * Copyright (C) 2004-2005 Sylvain Munaut <tnt@246tNt.com>
6 * Copyright (C) 2003 MontaVista, Software, Inc.
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 */
12
13#ifndef __ASM_POWERPC_MPC52xx_H__
14#define __ASM_POWERPC_MPC52xx_H__
15
16#ifndef __ASSEMBLY__
17#include <asm/types.h>
18#include <asm/prom.h>
19#endif /* __ASSEMBLY__ */
20
21#include <linux/suspend.h>
22
23/* Variants of the 5200(B) */
24#define MPC5200_SVR 0x80110010
25#define MPC5200_SVR_MASK 0xfffffff0
26#define MPC5200B_SVR 0x80110020
27#define MPC5200B_SVR_MASK 0xfffffff0
28
29/* ======================================================================== */
30/* Structures mapping of some unit register set */
31/* ======================================================================== */
32
33#ifndef __ASSEMBLY__
34
35/* Memory Mapping Control */
36struct mpc52xx_mmap_ctl {
37 u32 mbar; /* MMAP_CTRL + 0x00 */
38
39 u32 cs0_start; /* MMAP_CTRL + 0x04 */
40 u32 cs0_stop; /* MMAP_CTRL + 0x08 */
41 u32 cs1_start; /* MMAP_CTRL + 0x0c */
42 u32 cs1_stop; /* MMAP_CTRL + 0x10 */
43 u32 cs2_start; /* MMAP_CTRL + 0x14 */
44 u32 cs2_stop; /* MMAP_CTRL + 0x18 */
45 u32 cs3_start; /* MMAP_CTRL + 0x1c */
46 u32 cs3_stop; /* MMAP_CTRL + 0x20 */
47 u32 cs4_start; /* MMAP_CTRL + 0x24 */
48 u32 cs4_stop; /* MMAP_CTRL + 0x28 */
49 u32 cs5_start; /* MMAP_CTRL + 0x2c */
50 u32 cs5_stop; /* MMAP_CTRL + 0x30 */
51
52 u32 sdram0; /* MMAP_CTRL + 0x34 */
53 u32 sdram1; /* MMAP_CTRL + 0X38 */
54
55 u32 reserved[4]; /* MMAP_CTRL + 0x3c .. 0x48 */
56
57 u32 boot_start; /* MMAP_CTRL + 0x4c */
58 u32 boot_stop; /* MMAP_CTRL + 0x50 */
59
60 u32 ipbi_ws_ctrl; /* MMAP_CTRL + 0x54 */
61
62 u32 cs6_start; /* MMAP_CTRL + 0x58 */
63 u32 cs6_stop; /* MMAP_CTRL + 0x5c */
64 u32 cs7_start; /* MMAP_CTRL + 0x60 */
65 u32 cs7_stop; /* MMAP_CTRL + 0x64 */
66};
67
68/* SDRAM control */
69struct mpc52xx_sdram {
70 u32 mode; /* SDRAM + 0x00 */
71 u32 ctrl; /* SDRAM + 0x04 */
72 u32 config1; /* SDRAM + 0x08 */
73 u32 config2; /* SDRAM + 0x0c */
74};
75
76/* SDMA */
77struct mpc52xx_sdma {
78 u32 taskBar; /* SDMA + 0x00 */
79 u32 currentPointer; /* SDMA + 0x04 */
80 u32 endPointer; /* SDMA + 0x08 */
81 u32 variablePointer; /* SDMA + 0x0c */
82
83 u8 IntVect1; /* SDMA + 0x10 */
84 u8 IntVect2; /* SDMA + 0x11 */
85 u16 PtdCntrl; /* SDMA + 0x12 */
86
87 u32 IntPend; /* SDMA + 0x14 */
88 u32 IntMask; /* SDMA + 0x18 */
89
90 u16 tcr[16]; /* SDMA + 0x1c .. 0x3a */
91
92 u8 ipr[32]; /* SDMA + 0x3c .. 0x5b */
93
94 u32 cReqSelect; /* SDMA + 0x5c */
95 u32 task_size0; /* SDMA + 0x60 */
96 u32 task_size1; /* SDMA + 0x64 */
97 u32 MDEDebug; /* SDMA + 0x68 */
98 u32 ADSDebug; /* SDMA + 0x6c */
99 u32 Value1; /* SDMA + 0x70 */
100 u32 Value2; /* SDMA + 0x74 */
101 u32 Control; /* SDMA + 0x78 */
102 u32 Status; /* SDMA + 0x7c */
103 u32 PTDDebug; /* SDMA + 0x80 */
104};
105
106/* GPT */
107struct mpc52xx_gpt {
108 u32 mode; /* GPTx + 0x00 */
109 u32 count; /* GPTx + 0x04 */
110 u32 pwm; /* GPTx + 0x08 */
111 u32 status; /* GPTx + 0X0c */
112};
113
114/* GPIO */
115struct mpc52xx_gpio {
116 u32 port_config; /* GPIO + 0x00 */
117 u32 simple_gpioe; /* GPIO + 0x04 */
118 u32 simple_ode; /* GPIO + 0x08 */
119 u32 simple_ddr; /* GPIO + 0x0c */
120 u32 simple_dvo; /* GPIO + 0x10 */
121 u32 simple_ival; /* GPIO + 0x14 */
122 u8 outo_gpioe; /* GPIO + 0x18 */
123 u8 reserved1[3]; /* GPIO + 0x19 */
124 u8 outo_dvo; /* GPIO + 0x1c */
125 u8 reserved2[3]; /* GPIO + 0x1d */
126 u8 sint_gpioe; /* GPIO + 0x20 */
127 u8 reserved3[3]; /* GPIO + 0x21 */
128 u8 sint_ode; /* GPIO + 0x24 */
129 u8 reserved4[3]; /* GPIO + 0x25 */
130 u8 sint_ddr; /* GPIO + 0x28 */
131 u8 reserved5[3]; /* GPIO + 0x29 */
132 u8 sint_dvo; /* GPIO + 0x2c */
133 u8 reserved6[3]; /* GPIO + 0x2d */
134 u8 sint_inten; /* GPIO + 0x30 */
135 u8 reserved7[3]; /* GPIO + 0x31 */
136 u16 sint_itype; /* GPIO + 0x34 */
137 u16 reserved8; /* GPIO + 0x36 */
138 u8 gpio_control; /* GPIO + 0x38 */
139 u8 reserved9[3]; /* GPIO + 0x39 */
140 u8 sint_istat; /* GPIO + 0x3c */
141 u8 sint_ival; /* GPIO + 0x3d */
142 u8 bus_errs; /* GPIO + 0x3e */
143 u8 reserved10; /* GPIO + 0x3f */
144};
145
146#define MPC52xx_GPIO_PSC_CONFIG_UART_WITHOUT_CD 4
147#define MPC52xx_GPIO_PSC_CONFIG_UART_WITH_CD 5
148#define MPC52xx_GPIO_PCI_DIS (1<<15)
149
150/* GPIO with WakeUp*/
151struct mpc52xx_gpio_wkup {
152 u8 wkup_gpioe; /* GPIO_WKUP + 0x00 */
153 u8 reserved1[3]; /* GPIO_WKUP + 0x03 */
154 u8 wkup_ode; /* GPIO_WKUP + 0x04 */
155 u8 reserved2[3]; /* GPIO_WKUP + 0x05 */
156 u8 wkup_ddr; /* GPIO_WKUP + 0x08 */
157 u8 reserved3[3]; /* GPIO_WKUP + 0x09 */
158 u8 wkup_dvo; /* GPIO_WKUP + 0x0C */
159 u8 reserved4[3]; /* GPIO_WKUP + 0x0D */
160 u8 wkup_inten; /* GPIO_WKUP + 0x10 */
161 u8 reserved5[3]; /* GPIO_WKUP + 0x11 */
162 u8 wkup_iinten; /* GPIO_WKUP + 0x14 */
163 u8 reserved6[3]; /* GPIO_WKUP + 0x15 */
164 u16 wkup_itype; /* GPIO_WKUP + 0x18 */
165 u8 reserved7[2]; /* GPIO_WKUP + 0x1A */
166 u8 wkup_maste; /* GPIO_WKUP + 0x1C */
167 u8 reserved8[3]; /* GPIO_WKUP + 0x1D */
168 u8 wkup_ival; /* GPIO_WKUP + 0x20 */
169 u8 reserved9[3]; /* GPIO_WKUP + 0x21 */
170 u8 wkup_istat; /* GPIO_WKUP + 0x24 */
171 u8 reserved10[3]; /* GPIO_WKUP + 0x25 */
172};
173
174/* XLB Bus control */
175struct mpc52xx_xlb {
176 u8 reserved[0x40];
177 u32 config; /* XLB + 0x40 */
178 u32 version; /* XLB + 0x44 */
179 u32 status; /* XLB + 0x48 */
180 u32 int_enable; /* XLB + 0x4c */
181 u32 addr_capture; /* XLB + 0x50 */
182 u32 bus_sig_capture; /* XLB + 0x54 */
183 u32 addr_timeout; /* XLB + 0x58 */
184 u32 data_timeout; /* XLB + 0x5c */
185 u32 bus_act_timeout; /* XLB + 0x60 */
186 u32 master_pri_enable; /* XLB + 0x64 */
187 u32 master_priority; /* XLB + 0x68 */
188 u32 base_address; /* XLB + 0x6c */
189 u32 snoop_window; /* XLB + 0x70 */
190};
191
192#define MPC52xx_XLB_CFG_PLDIS (1 << 31)
193#define MPC52xx_XLB_CFG_SNOOP (1 << 15)
194
195/* Clock Distribution control */
196struct mpc52xx_cdm {
197 u32 jtag_id; /* CDM + 0x00 reg0 read only */
198 u32 rstcfg; /* CDM + 0x04 reg1 read only */
199 u32 breadcrumb; /* CDM + 0x08 reg2 */
200
201 u8 mem_clk_sel; /* CDM + 0x0c reg3 byte0 */
202 u8 xlb_clk_sel; /* CDM + 0x0d reg3 byte1 read only */
203 u8 ipb_clk_sel; /* CDM + 0x0e reg3 byte2 */
204 u8 pci_clk_sel; /* CDM + 0x0f reg3 byte3 */
205
206 u8 ext_48mhz_en; /* CDM + 0x10 reg4 byte0 */
207 u8 fd_enable; /* CDM + 0x11 reg4 byte1 */
208 u16 fd_counters; /* CDM + 0x12 reg4 byte2,3 */
209
210 u32 clk_enables; /* CDM + 0x14 reg5 */
211
212 u8 osc_disable; /* CDM + 0x18 reg6 byte0 */
213 u8 reserved0[3]; /* CDM + 0x19 reg6 byte1,2,3 */
214
215 u8 ccs_sleep_enable; /* CDM + 0x1c reg7 byte0 */
216 u8 osc_sleep_enable; /* CDM + 0x1d reg7 byte1 */
217 u8 reserved1; /* CDM + 0x1e reg7 byte2 */
218 u8 ccs_qreq_test; /* CDM + 0x1f reg7 byte3 */
219
220 u8 soft_reset; /* CDM + 0x20 u8 byte0 */
221 u8 no_ckstp; /* CDM + 0x21 u8 byte0 */
222 u8 reserved2[2]; /* CDM + 0x22 u8 byte1,2,3 */
223
224 u8 pll_lock; /* CDM + 0x24 reg9 byte0 */
225 u8 pll_looselock; /* CDM + 0x25 reg9 byte1 */
226 u8 pll_sm_lockwin; /* CDM + 0x26 reg9 byte2 */
227 u8 reserved3; /* CDM + 0x27 reg9 byte3 */
228
229 u16 reserved4; /* CDM + 0x28 reg10 byte0,1 */
230 u16 mclken_div_psc1; /* CDM + 0x2a reg10 byte2,3 */
231
232 u16 reserved5; /* CDM + 0x2c reg11 byte0,1 */
233 u16 mclken_div_psc2; /* CDM + 0x2e reg11 byte2,3 */
234
235 u16 reserved6; /* CDM + 0x30 reg12 byte0,1 */
236 u16 mclken_div_psc3; /* CDM + 0x32 reg12 byte2,3 */
237
238 u16 reserved7; /* CDM + 0x34 reg13 byte0,1 */
239 u16 mclken_div_psc6; /* CDM + 0x36 reg13 byte2,3 */
240};
241
242#endif /* __ASSEMBLY__ */
243
244
245/* ========================================================================= */
246/* Prototypes for MPC52xx sysdev */
247/* ========================================================================= */
248
249#ifndef __ASSEMBLY__
250
251/* mpc52xx_common.c */
252extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
253extern void mpc5200_setup_xlb_arbiter(void);
254extern void mpc52xx_declare_of_platform_devices(void);
255extern void mpc52xx_map_common_devices(void);
256extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv);
257extern void mpc52xx_restart(char *cmd);
258
259/* mpc52xx_pic.c */
260extern void mpc52xx_init_irq(void);
261extern unsigned int mpc52xx_get_irq(void);
262
263/* mpc52xx_pci.c */
264#ifdef CONFIG_PCI
265extern int __init mpc52xx_add_bridge(struct device_node *node);
266extern void __init mpc52xx_setup_pci(void);
267#else
268static inline void mpc52xx_setup_pci(void) { }
269#endif
270
271#endif /* __ASSEMBLY__ */
272
273#ifdef CONFIG_PM
274struct mpc52xx_suspend {
275 void (*board_suspend_prepare)(void __iomem *mbar);
276 void (*board_resume_finish)(void __iomem *mbar);
277};
278
279extern struct mpc52xx_suspend mpc52xx_suspend;
280extern int __init mpc52xx_pm_init(void);
281extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level);
282
283#ifdef CONFIG_PPC_LITE5200
284extern int __init lite5200_pm_init(void);
285
286/* lite5200 calls mpc5200 suspend functions, so here they are */
287extern int mpc52xx_pm_prepare(void);
288extern int mpc52xx_pm_enter(suspend_state_t);
289extern void mpc52xx_pm_finish(void);
290extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */
291#endif
292#endif /* CONFIG_PM */
293
294#endif /* __ASM_POWERPC_MPC52xx_H__ */
295
diff --git a/arch/powerpc/include/asm/mpc52xx_psc.h b/arch/powerpc/include/asm/mpc52xx_psc.h
new file mode 100644
index 000000000000..8917ed630565
--- /dev/null
+++ b/arch/powerpc/include/asm/mpc52xx_psc.h
@@ -0,0 +1,276 @@
1/*
2 * include/asm-ppc/mpc52xx_psc.h
3 *
4 * Definitions of consts/structs to drive the Freescale MPC52xx OnChip
5 * PSCs. Theses are shared between multiple drivers since a PSC can be
6 * UART, AC97, IR, I2S, ... So this header is in asm-ppc.
7 *
8 *
9 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
10 *
11 * Based/Extracted from some header of the 2.4 originally written by
12 * Dale Farnsworth <dfarnsworth@mvista.com>
13 *
14 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
15 * Copyright (C) 2003 MontaVista, Software, Inc.
16 *
17 * This file is licensed under the terms of the GNU General Public License
18 * version 2. This program is licensed "as is" without any warranty of any
19 * kind, whether express or implied.
20 */
21
22#ifndef __ASM_MPC52xx_PSC_H__
23#define __ASM_MPC52xx_PSC_H__
24
25#include <asm/types.h>
26
27/* Max number of PSCs */
28#define MPC52xx_PSC_MAXNUM 6
29
30/* Programmable Serial Controller (PSC) status register bits */
31#define MPC52xx_PSC_SR_CDE 0x0080
32#define MPC52xx_PSC_SR_RXRDY 0x0100
33#define MPC52xx_PSC_SR_RXFULL 0x0200
34#define MPC52xx_PSC_SR_TXRDY 0x0400
35#define MPC52xx_PSC_SR_TXEMP 0x0800
36#define MPC52xx_PSC_SR_OE 0x1000
37#define MPC52xx_PSC_SR_PE 0x2000
38#define MPC52xx_PSC_SR_FE 0x4000
39#define MPC52xx_PSC_SR_RB 0x8000
40
41/* PSC Command values */
42#define MPC52xx_PSC_RX_ENABLE 0x0001
43#define MPC52xx_PSC_RX_DISABLE 0x0002
44#define MPC52xx_PSC_TX_ENABLE 0x0004
45#define MPC52xx_PSC_TX_DISABLE 0x0008
46#define MPC52xx_PSC_SEL_MODE_REG_1 0x0010
47#define MPC52xx_PSC_RST_RX 0x0020
48#define MPC52xx_PSC_RST_TX 0x0030
49#define MPC52xx_PSC_RST_ERR_STAT 0x0040
50#define MPC52xx_PSC_RST_BRK_CHG_INT 0x0050
51#define MPC52xx_PSC_START_BRK 0x0060
52#define MPC52xx_PSC_STOP_BRK 0x0070
53
54/* PSC TxRx FIFO status bits */
55#define MPC52xx_PSC_RXTX_FIFO_ERR 0x0040
56#define MPC52xx_PSC_RXTX_FIFO_UF 0x0020
57#define MPC52xx_PSC_RXTX_FIFO_OF 0x0010
58#define MPC52xx_PSC_RXTX_FIFO_FR 0x0008
59#define MPC52xx_PSC_RXTX_FIFO_FULL 0x0004
60#define MPC52xx_PSC_RXTX_FIFO_ALARM 0x0002
61#define MPC52xx_PSC_RXTX_FIFO_EMPTY 0x0001
62
63/* PSC interrupt status/mask bits */
64#define MPC52xx_PSC_IMR_TXRDY 0x0100
65#define MPC52xx_PSC_IMR_RXRDY 0x0200
66#define MPC52xx_PSC_IMR_DB 0x0400
67#define MPC52xx_PSC_IMR_TXEMP 0x0800
68#define MPC52xx_PSC_IMR_ORERR 0x1000
69#define MPC52xx_PSC_IMR_IPC 0x8000
70
71/* PSC input port change bit */
72#define MPC52xx_PSC_CTS 0x01
73#define MPC52xx_PSC_DCD 0x02
74#define MPC52xx_PSC_D_CTS 0x10
75#define MPC52xx_PSC_D_DCD 0x20
76
77/* PSC mode fields */
78#define MPC52xx_PSC_MODE_5_BITS 0x00
79#define MPC52xx_PSC_MODE_6_BITS 0x01
80#define MPC52xx_PSC_MODE_7_BITS 0x02
81#define MPC52xx_PSC_MODE_8_BITS 0x03
82#define MPC52xx_PSC_MODE_BITS_MASK 0x03
83#define MPC52xx_PSC_MODE_PAREVEN 0x00
84#define MPC52xx_PSC_MODE_PARODD 0x04
85#define MPC52xx_PSC_MODE_PARFORCE 0x08
86#define MPC52xx_PSC_MODE_PARNONE 0x10
87#define MPC52xx_PSC_MODE_ERR 0x20
88#define MPC52xx_PSC_MODE_FFULL 0x40
89#define MPC52xx_PSC_MODE_RXRTS 0x80
90
91#define MPC52xx_PSC_MODE_ONE_STOP_5_BITS 0x00
92#define MPC52xx_PSC_MODE_ONE_STOP 0x07
93#define MPC52xx_PSC_MODE_TWO_STOP 0x0f
94
95#define MPC52xx_PSC_RFNUM_MASK 0x01ff
96
97#define MPC52xx_PSC_SICR_DTS1 (1 << 29)
98#define MPC52xx_PSC_SICR_SHDR (1 << 28)
99#define MPC52xx_PSC_SICR_SIM_MASK (0xf << 24)
100#define MPC52xx_PSC_SICR_SIM_UART (0x0 << 24)
101#define MPC52xx_PSC_SICR_SIM_UART_DCD (0x8 << 24)
102#define MPC52xx_PSC_SICR_SIM_CODEC_8 (0x1 << 24)
103#define MPC52xx_PSC_SICR_SIM_CODEC_16 (0x2 << 24)
104#define MPC52xx_PSC_SICR_SIM_AC97 (0x3 << 24)
105#define MPC52xx_PSC_SICR_SIM_SIR (0x8 << 24)
106#define MPC52xx_PSC_SICR_SIM_SIR_DCD (0xc << 24)
107#define MPC52xx_PSC_SICR_SIM_MIR (0x5 << 24)
108#define MPC52xx_PSC_SICR_SIM_FIR (0x6 << 24)
109#define MPC52xx_PSC_SICR_SIM_CODEC_24 (0x7 << 24)
110#define MPC52xx_PSC_SICR_SIM_CODEC_32 (0xf << 24)
111#define MPC52xx_PSC_SICR_GENCLK (1 << 23)
112#define MPC52xx_PSC_SICR_I2S (1 << 22)
113#define MPC52xx_PSC_SICR_CLKPOL (1 << 21)
114#define MPC52xx_PSC_SICR_SYNCPOL (1 << 20)
115#define MPC52xx_PSC_SICR_CELLSLAVE (1 << 19)
116#define MPC52xx_PSC_SICR_CELL2XCLK (1 << 18)
117#define MPC52xx_PSC_SICR_ESAI (1 << 17)
118#define MPC52xx_PSC_SICR_ENAC97 (1 << 16)
119#define MPC52xx_PSC_SICR_SPI (1 << 15)
120#define MPC52xx_PSC_SICR_MSTR (1 << 14)
121#define MPC52xx_PSC_SICR_CPOL (1 << 13)
122#define MPC52xx_PSC_SICR_CPHA (1 << 12)
123#define MPC52xx_PSC_SICR_USEEOF (1 << 11)
124#define MPC52xx_PSC_SICR_DISABLEEOF (1 << 10)
125
126/* Structure of the hardware registers */
127struct mpc52xx_psc {
128 u8 mode; /* PSC + 0x00 */
129 u8 reserved0[3];
130 union { /* PSC + 0x04 */
131 u16 status;
132 u16 clock_select;
133 } sr_csr;
134#define mpc52xx_psc_status sr_csr.status
135#define mpc52xx_psc_clock_select sr_csr.clock_select
136 u16 reserved1;
137 u8 command; /* PSC + 0x08 */
138 u8 reserved2[3];
139 union { /* PSC + 0x0c */
140 u8 buffer_8;
141 u16 buffer_16;
142 u32 buffer_32;
143 } buffer;
144#define mpc52xx_psc_buffer_8 buffer.buffer_8
145#define mpc52xx_psc_buffer_16 buffer.buffer_16
146#define mpc52xx_psc_buffer_32 buffer.buffer_32
147 union { /* PSC + 0x10 */
148 u8 ipcr;
149 u8 acr;
150 } ipcr_acr;
151#define mpc52xx_psc_ipcr ipcr_acr.ipcr
152#define mpc52xx_psc_acr ipcr_acr.acr
153 u8 reserved3[3];
154 union { /* PSC + 0x14 */
155 u16 isr;
156 u16 imr;
157 } isr_imr;
158#define mpc52xx_psc_isr isr_imr.isr
159#define mpc52xx_psc_imr isr_imr.imr
160 u16 reserved4;
161 u8 ctur; /* PSC + 0x18 */
162 u8 reserved5[3];
163 u8 ctlr; /* PSC + 0x1c */
164 u8 reserved6[3];
165 /* BitClkDiv field of CCR is byte swapped in
166 * the hardware for mpc5200/b compatibility */
167 u32 ccr; /* PSC + 0x20 */
168 u32 ac97_slots; /* PSC + 0x24 */
169 u32 ac97_cmd; /* PSC + 0x28 */
170 u32 ac97_data; /* PSC + 0x2c */
171 u8 ivr; /* PSC + 0x30 */
172 u8 reserved8[3];
173 u8 ip; /* PSC + 0x34 */
174 u8 reserved9[3];
175 u8 op1; /* PSC + 0x38 */
176 u8 reserved10[3];
177 u8 op0; /* PSC + 0x3c */
178 u8 reserved11[3];
179 u32 sicr; /* PSC + 0x40 */
180 u8 ircr1; /* PSC + 0x44 */
181 u8 reserved13[3];
182 u8 ircr2; /* PSC + 0x44 */
183 u8 reserved14[3];
184 u8 irsdr; /* PSC + 0x4c */
185 u8 reserved15[3];
186 u8 irmdr; /* PSC + 0x50 */
187 u8 reserved16[3];
188 u8 irfdr; /* PSC + 0x54 */
189 u8 reserved17[3];
190};
191
192struct mpc52xx_psc_fifo {
193 u16 rfnum; /* PSC + 0x58 */
194 u16 reserved18;
195 u16 tfnum; /* PSC + 0x5c */
196 u16 reserved19;
197 u32 rfdata; /* PSC + 0x60 */
198 u16 rfstat; /* PSC + 0x64 */
199 u16 reserved20;
200 u8 rfcntl; /* PSC + 0x68 */
201 u8 reserved21[5];
202 u16 rfalarm; /* PSC + 0x6e */
203 u16 reserved22;
204 u16 rfrptr; /* PSC + 0x72 */
205 u16 reserved23;
206 u16 rfwptr; /* PSC + 0x76 */
207 u16 reserved24;
208 u16 rflrfptr; /* PSC + 0x7a */
209 u16 reserved25;
210 u16 rflwfptr; /* PSC + 0x7e */
211 u32 tfdata; /* PSC + 0x80 */
212 u16 tfstat; /* PSC + 0x84 */
213 u16 reserved26;
214 u8 tfcntl; /* PSC + 0x88 */
215 u8 reserved27[5];
216 u16 tfalarm; /* PSC + 0x8e */
217 u16 reserved28;
218 u16 tfrptr; /* PSC + 0x92 */
219 u16 reserved29;
220 u16 tfwptr; /* PSC + 0x96 */
221 u16 reserved30;
222 u16 tflrfptr; /* PSC + 0x9a */
223 u16 reserved31;
224 u16 tflwfptr; /* PSC + 0x9e */
225};
226
227#define MPC512x_PSC_FIFO_RESET_SLICE 0x80
228#define MPC512x_PSC_FIFO_ENABLE_SLICE 0x01
229#define MPC512x_PSC_FIFO_ENABLE_DMA 0x04
230
231#define MPC512x_PSC_FIFO_EMPTY 0x1
232#define MPC512x_PSC_FIFO_FULL 0x2
233#define MPC512x_PSC_FIFO_ALARM 0x4
234#define MPC512x_PSC_FIFO_URERR 0x8
235#define MPC512x_PSC_FIFO_ORERR 0x01
236#define MPC512x_PSC_FIFO_MEMERROR 0x02
237
238struct mpc512x_psc_fifo {
239 u32 reserved1[10];
240 u32 txcmd; /* PSC + 0x80 */
241 u32 txalarm; /* PSC + 0x84 */
242 u32 txsr; /* PSC + 0x88 */
243 u32 txisr; /* PSC + 0x8c */
244 u32 tximr; /* PSC + 0x90 */
245 u32 txcnt; /* PSC + 0x94 */
246 u32 txptr; /* PSC + 0x98 */
247 u32 txsz; /* PSC + 0x9c */
248 u32 reserved2[7];
249 union {
250 u8 txdata_8;
251 u16 txdata_16;
252 u32 txdata_32;
253 } txdata; /* PSC + 0xbc */
254#define txdata_8 txdata.txdata_8
255#define txdata_16 txdata.txdata_16
256#define txdata_32 txdata.txdata_32
257 u32 rxcmd; /* PSC + 0xc0 */
258 u32 rxalarm; /* PSC + 0xc4 */
259 u32 rxsr; /* PSC + 0xc8 */
260 u32 rxisr; /* PSC + 0xcc */
261 u32 rximr; /* PSC + 0xd0 */
262 u32 rxcnt; /* PSC + 0xd4 */
263 u32 rxptr; /* PSC + 0xd8 */
264 u32 rxsz; /* PSC + 0xdc */
265 u32 reserved3[7];
266 union {
267 u8 rxdata_8;
268 u16 rxdata_16;
269 u32 rxdata_32;
270 } rxdata; /* PSC + 0xfc */
271#define rxdata_8 rxdata.rxdata_8
272#define rxdata_16 rxdata.rxdata_16
273#define rxdata_32 rxdata.rxdata_32
274};
275
276#endif /* __ASM_MPC52xx_PSC_H__ */
diff --git a/arch/powerpc/include/asm/mpc6xx.h b/arch/powerpc/include/asm/mpc6xx.h
new file mode 100644
index 000000000000..effc2291beb2
--- /dev/null
+++ b/arch/powerpc/include/asm/mpc6xx.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_POWERPC_MPC6xx_H
2#define __ASM_POWERPC_MPC6xx_H
3
4void mpc6xx_enter_standby(void);
5
6#endif
diff --git a/arch/powerpc/include/asm/mpc8260.h b/arch/powerpc/include/asm/mpc8260.h
new file mode 100644
index 000000000000..03317e1e6185
--- /dev/null
+++ b/arch/powerpc/include/asm/mpc8260.h
@@ -0,0 +1,25 @@
1/*
2 * Since there are many different boards and no standard configuration,
3 * we have a unique include file for each. Rather than change every
4 * file that has to include MPC8260 configuration, they all include
5 * this one and the configuration switching is done here.
6 */
7#ifdef __KERNEL__
8#ifndef __ASM_POWERPC_MPC8260_H__
9#define __ASM_POWERPC_MPC8260_H__
10
11#define MPC82XX_BCR_PLDP 0x00800000 /* Pipeline Maximum Depth */
12
13#ifdef CONFIG_8260
14
15#if defined(CONFIG_PQ2ADS) || defined (CONFIG_PQ2FADS)
16#include <platforms/82xx/pq2ads.h>
17#endif
18
19#ifdef CONFIG_PCI_8260
20#include <platforms/82xx/m82xx_pci.h>
21#endif
22
23#endif /* CONFIG_8260 */
24#endif /* !__ASM_POWERPC_MPC8260_H__ */
25#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/mpc86xx.h b/arch/powerpc/include/asm/mpc86xx.h
new file mode 100644
index 000000000000..15f650f987e7
--- /dev/null
+++ b/arch/powerpc/include/asm/mpc86xx.h
@@ -0,0 +1,33 @@
1/*
2 * MPC86xx definitions
3 *
4 * Author: Jeff Brown
5 *
6 * Copyright 2004 Freescale Semiconductor, Inc
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifdef __KERNEL__
15#ifndef __ASM_POWERPC_MPC86xx_H__
16#define __ASM_POWERPC_MPC86xx_H__
17
18#include <asm/mmu.h>
19
20#ifdef CONFIG_PPC_86xx
21
22#define CPU0_BOOT_RELEASE 0x01000000
23#define CPU1_BOOT_RELEASE 0x02000000
24#define CPU_ALL_RELEASED (CPU0_BOOT_RELEASE | CPU1_BOOT_RELEASE)
25#define MCM_PORT_CONFIG_OFFSET 0x1010
26
27/* Offset from CCSRBAR */
28#define MPC86xx_MCM_OFFSET (0x00000)
29#define MPC86xx_MCM_SIZE (0x02000)
30
31#endif /* CONFIG_PPC_86xx */
32#endif /* __ASM_POWERPC_MPC86xx_H__ */
33#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/mpc8xx.h b/arch/powerpc/include/asm/mpc8xx.h
new file mode 100644
index 000000000000..98f3c4f17328
--- /dev/null
+++ b/arch/powerpc/include/asm/mpc8xx.h
@@ -0,0 +1,12 @@
1/* This is the single file included by all MPC8xx build options.
2 * Since there are many different boards and no standard configuration,
3 * we have a unique include file for each. Rather than change every
4 * file that has to include MPC8xx configuration, they all include
5 * this one and the configuration switching is done here.
6 */
7#ifndef __CONFIG_8xx_DEFS
8#define __CONFIG_8xx_DEFS
9
10extern struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops;
11
12#endif /* __CONFIG_8xx_DEFS */
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
new file mode 100644
index 000000000000..fe566a348a86
--- /dev/null
+++ b/arch/powerpc/include/asm/mpic.h
@@ -0,0 +1,481 @@
1#ifndef _ASM_POWERPC_MPIC_H
2#define _ASM_POWERPC_MPIC_H
3#ifdef __KERNEL__
4
5#include <linux/irq.h>
6#include <linux/sysdev.h>
7#include <asm/dcr.h>
8
9/*
10 * Global registers
11 */
12
13#define MPIC_GREG_BASE 0x01000
14
15#define MPIC_GREG_FEATURE_0 0x00000
16#define MPIC_GREG_FEATURE_LAST_SRC_MASK 0x07ff0000
17#define MPIC_GREG_FEATURE_LAST_SRC_SHIFT 16
18#define MPIC_GREG_FEATURE_LAST_CPU_MASK 0x00001f00
19#define MPIC_GREG_FEATURE_LAST_CPU_SHIFT 8
20#define MPIC_GREG_FEATURE_VERSION_MASK 0xff
21#define MPIC_GREG_FEATURE_1 0x00010
22#define MPIC_GREG_GLOBAL_CONF_0 0x00020
23#define MPIC_GREG_GCONF_RESET 0x80000000
24#define MPIC_GREG_GCONF_8259_PTHROU_DIS 0x20000000
25#define MPIC_GREG_GCONF_NO_BIAS 0x10000000
26#define MPIC_GREG_GCONF_BASE_MASK 0x000fffff
27#define MPIC_GREG_GCONF_MCK 0x08000000
28#define MPIC_GREG_GLOBAL_CONF_1 0x00030
29#define MPIC_GREG_GLOBAL_CONF_1_SIE 0x08000000
30#define MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK 0x70000000
31#define MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO(r) \
32 (((r) << 28) & MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK)
33#define MPIC_GREG_VENDOR_0 0x00040
34#define MPIC_GREG_VENDOR_1 0x00050
35#define MPIC_GREG_VENDOR_2 0x00060
36#define MPIC_GREG_VENDOR_3 0x00070
37#define MPIC_GREG_VENDOR_ID 0x00080
38#define MPIC_GREG_VENDOR_ID_STEPPING_MASK 0x00ff0000
39#define MPIC_GREG_VENDOR_ID_STEPPING_SHIFT 16
40#define MPIC_GREG_VENDOR_ID_DEVICE_ID_MASK 0x0000ff00
41#define MPIC_GREG_VENDOR_ID_DEVICE_ID_SHIFT 8
42#define MPIC_GREG_VENDOR_ID_VENDOR_ID_MASK 0x000000ff
43#define MPIC_GREG_PROCESSOR_INIT 0x00090
44#define MPIC_GREG_IPI_VECTOR_PRI_0 0x000a0
45#define MPIC_GREG_IPI_VECTOR_PRI_1 0x000b0
46#define MPIC_GREG_IPI_VECTOR_PRI_2 0x000c0
47#define MPIC_GREG_IPI_VECTOR_PRI_3 0x000d0
48#define MPIC_GREG_IPI_STRIDE 0x10
49#define MPIC_GREG_SPURIOUS 0x000e0
50#define MPIC_GREG_TIMER_FREQ 0x000f0
51
52/*
53 *
54 * Timer registers
55 */
56#define MPIC_TIMER_BASE 0x01100
57#define MPIC_TIMER_STRIDE 0x40
58
59#define MPIC_TIMER_CURRENT_CNT 0x00000
60#define MPIC_TIMER_BASE_CNT 0x00010
61#define MPIC_TIMER_VECTOR_PRI 0x00020
62#define MPIC_TIMER_DESTINATION 0x00030
63
64/*
65 * Per-Processor registers
66 */
67
68#define MPIC_CPU_THISBASE 0x00000
69#define MPIC_CPU_BASE 0x20000
70#define MPIC_CPU_STRIDE 0x01000
71
72#define MPIC_CPU_IPI_DISPATCH_0 0x00040
73#define MPIC_CPU_IPI_DISPATCH_1 0x00050
74#define MPIC_CPU_IPI_DISPATCH_2 0x00060
75#define MPIC_CPU_IPI_DISPATCH_3 0x00070
76#define MPIC_CPU_IPI_DISPATCH_STRIDE 0x00010
77#define MPIC_CPU_CURRENT_TASK_PRI 0x00080
78#define MPIC_CPU_TASKPRI_MASK 0x0000000f
79#define MPIC_CPU_WHOAMI 0x00090
80#define MPIC_CPU_WHOAMI_MASK 0x0000001f
81#define MPIC_CPU_INTACK 0x000a0
82#define MPIC_CPU_EOI 0x000b0
83#define MPIC_CPU_MCACK 0x000c0
84
85/*
86 * Per-source registers
87 */
88
89#define MPIC_IRQ_BASE 0x10000
90#define MPIC_IRQ_STRIDE 0x00020
91#define MPIC_IRQ_VECTOR_PRI 0x00000
92#define MPIC_VECPRI_MASK 0x80000000
93#define MPIC_VECPRI_ACTIVITY 0x40000000 /* Read Only */
94#define MPIC_VECPRI_PRIORITY_MASK 0x000f0000
95#define MPIC_VECPRI_PRIORITY_SHIFT 16
96#define MPIC_VECPRI_VECTOR_MASK 0x000007ff
97#define MPIC_VECPRI_POLARITY_POSITIVE 0x00800000
98#define MPIC_VECPRI_POLARITY_NEGATIVE 0x00000000
99#define MPIC_VECPRI_POLARITY_MASK 0x00800000
100#define MPIC_VECPRI_SENSE_LEVEL 0x00400000
101#define MPIC_VECPRI_SENSE_EDGE 0x00000000
102#define MPIC_VECPRI_SENSE_MASK 0x00400000
103#define MPIC_IRQ_DESTINATION 0x00010
104
105#define MPIC_MAX_IRQ_SOURCES 2048
106#define MPIC_MAX_CPUS 32
107#define MPIC_MAX_ISU 32
108
109/*
110 * Tsi108 implementation of MPIC has many differences from the original one
111 */
112
113/*
114 * Global registers
115 */
116
117#define TSI108_GREG_BASE 0x00000
118#define TSI108_GREG_FEATURE_0 0x00000
119#define TSI108_GREG_GLOBAL_CONF_0 0x00004
120#define TSI108_GREG_VENDOR_ID 0x0000c
121#define TSI108_GREG_IPI_VECTOR_PRI_0 0x00204 /* Doorbell 0 */
122#define TSI108_GREG_IPI_STRIDE 0x0c
123#define TSI108_GREG_SPURIOUS 0x00010
124#define TSI108_GREG_TIMER_FREQ 0x00014
125
126/*
127 * Timer registers
128 */
129#define TSI108_TIMER_BASE 0x0030
130#define TSI108_TIMER_STRIDE 0x10
131#define TSI108_TIMER_CURRENT_CNT 0x00000
132#define TSI108_TIMER_BASE_CNT 0x00004
133#define TSI108_TIMER_VECTOR_PRI 0x00008
134#define TSI108_TIMER_DESTINATION 0x0000c
135
136/*
137 * Per-Processor registers
138 */
139#define TSI108_CPU_BASE 0x00300
140#define TSI108_CPU_STRIDE 0x00040
141#define TSI108_CPU_IPI_DISPATCH_0 0x00200
142#define TSI108_CPU_IPI_DISPATCH_STRIDE 0x00000
143#define TSI108_CPU_CURRENT_TASK_PRI 0x00000
144#define TSI108_CPU_WHOAMI 0xffffffff
145#define TSI108_CPU_INTACK 0x00004
146#define TSI108_CPU_EOI 0x00008
147#define TSI108_CPU_MCACK 0x00004 /* Doesn't really exist here */
148
149/*
150 * Per-source registers
151 */
152#define TSI108_IRQ_BASE 0x00100
153#define TSI108_IRQ_STRIDE 0x00008
154#define TSI108_IRQ_VECTOR_PRI 0x00000
155#define TSI108_VECPRI_VECTOR_MASK 0x000000ff
156#define TSI108_VECPRI_POLARITY_POSITIVE 0x01000000
157#define TSI108_VECPRI_POLARITY_NEGATIVE 0x00000000
158#define TSI108_VECPRI_SENSE_LEVEL 0x02000000
159#define TSI108_VECPRI_SENSE_EDGE 0x00000000
160#define TSI108_VECPRI_POLARITY_MASK 0x01000000
161#define TSI108_VECPRI_SENSE_MASK 0x02000000
162#define TSI108_IRQ_DESTINATION 0x00004
163
164/* weird mpic register indices and mask bits in the HW info array */
165enum {
166 MPIC_IDX_GREG_BASE = 0,
167 MPIC_IDX_GREG_FEATURE_0,
168 MPIC_IDX_GREG_GLOBAL_CONF_0,
169 MPIC_IDX_GREG_VENDOR_ID,
170 MPIC_IDX_GREG_IPI_VECTOR_PRI_0,
171 MPIC_IDX_GREG_IPI_STRIDE,
172 MPIC_IDX_GREG_SPURIOUS,
173 MPIC_IDX_GREG_TIMER_FREQ,
174
175 MPIC_IDX_TIMER_BASE,
176 MPIC_IDX_TIMER_STRIDE,
177 MPIC_IDX_TIMER_CURRENT_CNT,
178 MPIC_IDX_TIMER_BASE_CNT,
179 MPIC_IDX_TIMER_VECTOR_PRI,
180 MPIC_IDX_TIMER_DESTINATION,
181
182 MPIC_IDX_CPU_BASE,
183 MPIC_IDX_CPU_STRIDE,
184 MPIC_IDX_CPU_IPI_DISPATCH_0,
185 MPIC_IDX_CPU_IPI_DISPATCH_STRIDE,
186 MPIC_IDX_CPU_CURRENT_TASK_PRI,
187 MPIC_IDX_CPU_WHOAMI,
188 MPIC_IDX_CPU_INTACK,
189 MPIC_IDX_CPU_EOI,
190 MPIC_IDX_CPU_MCACK,
191
192 MPIC_IDX_IRQ_BASE,
193 MPIC_IDX_IRQ_STRIDE,
194 MPIC_IDX_IRQ_VECTOR_PRI,
195
196 MPIC_IDX_VECPRI_VECTOR_MASK,
197 MPIC_IDX_VECPRI_POLARITY_POSITIVE,
198 MPIC_IDX_VECPRI_POLARITY_NEGATIVE,
199 MPIC_IDX_VECPRI_SENSE_LEVEL,
200 MPIC_IDX_VECPRI_SENSE_EDGE,
201 MPIC_IDX_VECPRI_POLARITY_MASK,
202 MPIC_IDX_VECPRI_SENSE_MASK,
203 MPIC_IDX_IRQ_DESTINATION,
204 MPIC_IDX_END
205};
206
207
208#ifdef CONFIG_MPIC_U3_HT_IRQS
209/* Fixup table entry */
210struct mpic_irq_fixup
211{
212 u8 __iomem *base;
213 u8 __iomem *applebase;
214 u32 data;
215 unsigned int index;
216};
217#endif /* CONFIG_MPIC_U3_HT_IRQS */
218
219
220enum mpic_reg_type {
221 mpic_access_mmio_le,
222 mpic_access_mmio_be,
223#ifdef CONFIG_PPC_DCR
224 mpic_access_dcr
225#endif
226};
227
228struct mpic_reg_bank {
229 u32 __iomem *base;
230#ifdef CONFIG_PPC_DCR
231 dcr_host_t dhost;
232#endif /* CONFIG_PPC_DCR */
233};
234
235struct mpic_irq_save {
236 u32 vecprio,
237 dest;
238#ifdef CONFIG_MPIC_U3_HT_IRQS
239 u32 fixup_data;
240#endif
241};
242
243/* The instance data of a given MPIC */
244struct mpic
245{
246 /* The remapper for this MPIC */
247 struct irq_host *irqhost;
248
249 /* The "linux" controller struct */
250 struct irq_chip hc_irq;
251#ifdef CONFIG_MPIC_U3_HT_IRQS
252 struct irq_chip hc_ht_irq;
253#endif
254#ifdef CONFIG_SMP
255 struct irq_chip hc_ipi;
256#endif
257 const char *name;
258 /* Flags */
259 unsigned int flags;
260 /* How many irq sources in a given ISU */
261 unsigned int isu_size;
262 unsigned int isu_shift;
263 unsigned int isu_mask;
264 unsigned int irq_count;
265 /* Number of sources */
266 unsigned int num_sources;
267 /* Number of CPUs */
268 unsigned int num_cpus;
269 /* default senses array */
270 unsigned char *senses;
271 unsigned int senses_count;
272
273 /* vector numbers used for internal sources (ipi/timers) */
274 unsigned int ipi_vecs[4];
275 unsigned int timer_vecs[4];
276
277 /* Spurious vector to program into unused sources */
278 unsigned int spurious_vec;
279
280#ifdef CONFIG_MPIC_U3_HT_IRQS
281 /* The fixup table */
282 struct mpic_irq_fixup *fixups;
283 spinlock_t fixup_lock;
284#endif
285
286 /* Register access method */
287 enum mpic_reg_type reg_type;
288
289 /* The various ioremap'ed bases */
290 struct mpic_reg_bank gregs;
291 struct mpic_reg_bank tmregs;
292 struct mpic_reg_bank cpuregs[MPIC_MAX_CPUS];
293 struct mpic_reg_bank isus[MPIC_MAX_ISU];
294
295 /* Protected sources */
296 unsigned long *protected;
297
298#ifdef CONFIG_MPIC_WEIRD
299 /* Pointer to HW info array */
300 u32 *hw_set;
301#endif
302
303#ifdef CONFIG_PCI_MSI
304 spinlock_t bitmap_lock;
305 unsigned long *hwirq_bitmap;
306#endif
307
308#ifdef CONFIG_MPIC_BROKEN_REGREAD
309 u32 isu_reg0_shadow[MPIC_MAX_IRQ_SOURCES];
310#endif
311
312 /* link */
313 struct mpic *next;
314
315 struct sys_device sysdev;
316
317#ifdef CONFIG_PM
318 struct mpic_irq_save *save_data;
319#endif
320};
321
322/*
323 * MPIC flags (passed to mpic_alloc)
324 *
325 * The top 4 bits contain an MPIC bhw id that is used to index the
326 * register offsets and some masks when CONFIG_MPIC_WEIRD is set.
327 * Note setting any ID (leaving those bits to 0) means standard MPIC
328 */
329
330/* This is the primary controller, only that one has IPIs and
331 * has afinity control. A non-primary MPIC always uses CPU0
332 * registers only
333 */
334#define MPIC_PRIMARY 0x00000001
335
336/* Set this for a big-endian MPIC */
337#define MPIC_BIG_ENDIAN 0x00000002
338/* Broken U3 MPIC */
339#define MPIC_U3_HT_IRQS 0x00000004
340/* Broken IPI registers (autodetected) */
341#define MPIC_BROKEN_IPI 0x00000008
342/* MPIC wants a reset */
343#define MPIC_WANTS_RESET 0x00000010
344/* Spurious vector requires EOI */
345#define MPIC_SPV_EOI 0x00000020
346/* No passthrough disable */
347#define MPIC_NO_PTHROU_DIS 0x00000040
348/* DCR based MPIC */
349#define MPIC_USES_DCR 0x00000080
350/* MPIC has 11-bit vector fields (or larger) */
351#define MPIC_LARGE_VECTORS 0x00000100
352/* Enable delivery of prio 15 interrupts as MCK instead of EE */
353#define MPIC_ENABLE_MCK 0x00000200
354/* Disable bias among target selection, spread interrupts evenly */
355#define MPIC_NO_BIAS 0x00000400
356/* Ignore NIRQS as reported by FRR */
357#define MPIC_BROKEN_FRR_NIRQS 0x00000800
358
359/* MPIC HW modification ID */
360#define MPIC_REGSET_MASK 0xf0000000
361#define MPIC_REGSET(val) (((val) & 0xf ) << 28)
362#define MPIC_GET_REGSET(flags) (((flags) >> 28) & 0xf)
363
364#define MPIC_REGSET_STANDARD MPIC_REGSET(0) /* Original MPIC */
365#define MPIC_REGSET_TSI108 MPIC_REGSET(1) /* Tsi108/109 PIC */
366
367/* Allocate the controller structure and setup the linux irq descs
368 * for the range if interrupts passed in. No HW initialization is
369 * actually performed.
370 *
371 * @phys_addr: physial base address of the MPIC
372 * @flags: flags, see constants above
373 * @isu_size: number of interrupts in an ISU. Use 0 to use a
374 * standard ISU-less setup (aka powermac)
375 * @irq_offset: first irq number to assign to this mpic
376 * @irq_count: number of irqs to use with this mpic IRQ sources. Pass 0
377 * to match the number of sources
378 * @ipi_offset: first irq number to assign to this mpic IPI sources,
379 * used only on primary mpic
380 * @senses: array of sense values
381 * @senses_num: number of entries in the array
382 *
383 * Note about the sense array. If none is passed, all interrupts are
384 * setup to be level negative unless MPIC_U3_HT_IRQS is set in which
385 * case they are edge positive (and the array is ignored anyway).
386 * The values in the array start at the first source of the MPIC,
387 * that is senses[0] correspond to linux irq "irq_offset".
388 */
389extern struct mpic *mpic_alloc(struct device_node *node,
390 phys_addr_t phys_addr,
391 unsigned int flags,
392 unsigned int isu_size,
393 unsigned int irq_count,
394 const char *name);
395
396/* Assign ISUs, to call before mpic_init()
397 *
398 * @mpic: controller structure as returned by mpic_alloc()
399 * @isu_num: ISU number
400 * @phys_addr: physical address of the ISU
401 */
402extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
403 phys_addr_t phys_addr);
404
405/* Set default sense codes
406 *
407 * @mpic: controller
408 * @senses: array of sense codes
409 * @count: size of above array
410 *
411 * Optionally provide an array (indexed on hardware interrupt numbers
412 * for this MPIC) of default sense codes for the chip. Those are linux
413 * sense codes IRQ_TYPE_*
414 *
415 * The driver gets ownership of the pointer, don't dispose of it or
416 * anything like that. __init only.
417 */
418extern void mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count);
419
420
421/* Initialize the controller. After this has been called, none of the above
422 * should be called again for this mpic
423 */
424extern void mpic_init(struct mpic *mpic);
425
426/*
427 * All of the following functions must only be used after the
428 * ISUs have been assigned and the controller fully initialized
429 * with mpic_init()
430 */
431
432
433/* Change the priority of an interrupt. Default is 8 for irqs and
434 * 10 for IPIs. You can call this on both IPIs and IRQ numbers, but the
435 * IPI number is then the offset'ed (linux irq number mapped to the IPI)
436 */
437extern void mpic_irq_set_priority(unsigned int irq, unsigned int pri);
438
439/* Setup a non-boot CPU */
440extern void mpic_setup_this_cpu(void);
441
442/* Clean up for kexec (or cpu offline or ...) */
443extern void mpic_teardown_this_cpu(int secondary);
444
445/* Get the current cpu priority for this cpu (0..15) */
446extern int mpic_cpu_get_priority(void);
447
448/* Set the current cpu priority for this cpu */
449extern void mpic_cpu_set_priority(int prio);
450
451/* Request IPIs on primary mpic */
452extern void mpic_request_ipis(void);
453
454/* Send an IPI (non offseted number 0..3) */
455extern void mpic_send_ipi(unsigned int ipi_no, unsigned int cpu_mask);
456
457/* Send a message (IPI) to a given target (cpu number or MSG_*) */
458void smp_mpic_message_pass(int target, int msg);
459
460/* Unmask a specific virq */
461extern void mpic_unmask_irq(unsigned int irq);
462/* Mask a specific virq */
463extern void mpic_mask_irq(unsigned int irq);
464/* EOI a specific virq */
465extern void mpic_end_irq(unsigned int irq);
466
467/* Fetch interrupt from a given mpic */
468extern unsigned int mpic_get_one_irq(struct mpic *mpic);
469/* This one gets from the primary mpic */
470extern unsigned int mpic_get_irq(void);
471/* Fetch Machine Check interrupt from primary mpic */
472extern unsigned int mpic_get_mcirq(void);
473
474/* Set the EPIC clock ratio */
475void mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio);
476
477/* Enable/Disable EPIC serial interrupt mode */
478void mpic_set_serial_int(struct mpic *mpic, int enable);
479
480#endif /* __KERNEL__ */
481#endif /* _ASM_POWERPC_MPIC_H */
diff --git a/arch/powerpc/include/asm/msgbuf.h b/arch/powerpc/include/asm/msgbuf.h
new file mode 100644
index 000000000000..dd76743c7537
--- /dev/null
+++ b/arch/powerpc/include/asm/msgbuf.h
@@ -0,0 +1,33 @@
1#ifndef _ASM_POWERPC_MSGBUF_H
2#define _ASM_POWERPC_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for the PowerPC architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 */
9
10struct msqid64_ds {
11 struct ipc64_perm msg_perm;
12#ifndef __powerpc64__
13 unsigned int __unused1;
14#endif
15 __kernel_time_t msg_stime; /* last msgsnd time */
16#ifndef __powerpc64__
17 unsigned int __unused2;
18#endif
19 __kernel_time_t msg_rtime; /* last msgrcv time */
20#ifndef __powerpc64__
21 unsigned int __unused3;
22#endif
23 __kernel_time_t msg_ctime; /* last change time */
24 unsigned long msg_cbytes; /* current number of bytes on queue */
25 unsigned long msg_qnum; /* number of messages in queue */
26 unsigned long msg_qbytes; /* max number of bytes on queue */
27 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
28 __kernel_pid_t msg_lrpid; /* last receive pid */
29 unsigned long __unused4;
30 unsigned long __unused5;
31};
32
33#endif /* _ASM_POWERPC_MSGBUF_H */
diff --git a/arch/powerpc/include/asm/mutex.h b/arch/powerpc/include/asm/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/arch/powerpc/include/asm/mutex.h
@@ -0,0 +1,9 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h
new file mode 100644
index 000000000000..efde5ac82f7b
--- /dev/null
+++ b/arch/powerpc/include/asm/nvram.h
@@ -0,0 +1,139 @@
1/*
2 * NVRAM definitions and access functions.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#ifndef _ASM_POWERPC_NVRAM_H
11#define _ASM_POWERPC_NVRAM_H
12
13#include <linux/errno.h>
14
15#define NVRW_CNT 0x20
16#define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */
17#define NVRAM_BLOCK_LEN 16
18#define NVRAM_MAX_REQ (2080/NVRAM_BLOCK_LEN)
19#define NVRAM_MIN_REQ (1056/NVRAM_BLOCK_LEN)
20
21#define NVRAM_AS0 0x74
22#define NVRAM_AS1 0x75
23#define NVRAM_DATA 0x77
24
25
26/* RTC Offsets */
27
28#define MOTO_RTC_SECONDS 0x1FF9
29#define MOTO_RTC_MINUTES 0x1FFA
30#define MOTO_RTC_HOURS 0x1FFB
31#define MOTO_RTC_DAY_OF_WEEK 0x1FFC
32#define MOTO_RTC_DAY_OF_MONTH 0x1FFD
33#define MOTO_RTC_MONTH 0x1FFE
34#define MOTO_RTC_YEAR 0x1FFF
35#define MOTO_RTC_CONTROLA 0x1FF8
36#define MOTO_RTC_CONTROLB 0x1FF9
37
38#define NVRAM_SIG_SP 0x02 /* support processor */
39#define NVRAM_SIG_OF 0x50 /* open firmware config */
40#define NVRAM_SIG_FW 0x51 /* general firmware */
41#define NVRAM_SIG_HW 0x52 /* hardware (VPD) */
42#define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */
43#define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */
44#define NVRAM_SIG_SYS 0x70 /* system env vars */
45#define NVRAM_SIG_CFG 0x71 /* config data */
46#define NVRAM_SIG_ELOG 0x72 /* error log */
47#define NVRAM_SIG_VEND 0x7e /* vendor defined */
48#define NVRAM_SIG_FREE 0x7f /* Free space */
49#define NVRAM_SIG_OS 0xa0 /* OS defined */
50#define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */
51
52/* If change this size, then change the size of NVNAME_LEN */
53struct nvram_header {
54 unsigned char signature;
55 unsigned char checksum;
56 unsigned short length;
57 char name[12];
58};
59
60#ifdef __KERNEL__
61
62#include <linux/list.h>
63
64struct nvram_partition {
65 struct list_head partition;
66 struct nvram_header header;
67 unsigned int index;
68};
69
70
71extern int nvram_write_error_log(char * buff, int length,
72 unsigned int err_type, unsigned int err_seq);
73extern int nvram_read_error_log(char * buff, int length,
74 unsigned int * err_type, unsigned int *err_seq);
75extern int nvram_clear_error_log(void);
76extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
77
78extern int pSeries_nvram_init(void);
79
80#ifdef CONFIG_MMIO_NVRAM
81extern int mmio_nvram_init(void);
82#else
83static inline int mmio_nvram_init(void)
84{
85 return -ENODEV;
86}
87#endif
88
89#endif /* __KERNEL__ */
90
91/* PowerMac specific nvram stuffs */
92
93enum {
94 pmac_nvram_OF, /* Open Firmware partition */
95 pmac_nvram_XPRAM, /* MacOS XPRAM partition */
96 pmac_nvram_NR /* MacOS Name Registry partition */
97};
98
99#ifdef __KERNEL__
100/* Return partition offset in nvram */
101extern int pmac_get_partition(int partition);
102
103/* Direct access to XPRAM on PowerMacs */
104extern u8 pmac_xpram_read(int xpaddr);
105extern void pmac_xpram_write(int xpaddr, u8 data);
106
107/* Synchronize NVRAM */
108extern void nvram_sync(void);
109
110/* Normal access to NVRAM */
111extern unsigned char nvram_read_byte(int i);
112extern void nvram_write_byte(unsigned char c, int i);
113#endif
114
115/* Some offsets in XPRAM */
116#define PMAC_XPRAM_MACHINE_LOC 0xe4
117#define PMAC_XPRAM_SOUND_VOLUME 0x08
118
119/* Machine location structure in PowerMac XPRAM */
120struct pmac_machine_location {
121 unsigned int latitude; /* 2+30 bit Fractional number */
122 unsigned int longitude; /* 2+30 bit Fractional number */
123 unsigned int delta; /* mix of GMT delta and DLS */
124};
125
126/*
127 * /dev/nvram ioctls
128 *
129 * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is
130 * definitely obsolete. Do not use it if you can avoid it
131 */
132
133#define OBSOLETE_PMAC_NVRAM_GET_OFFSET \
134 _IOWR('p', 0x40, int)
135
136#define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */
137#define IOC_NVRAM_SYNC _IO('p', 0x43) /* Sync NVRAM image */
138
139#endif /* _ASM_POWERPC_NVRAM_H */
diff --git a/arch/powerpc/include/asm/of_device.h b/arch/powerpc/include/asm/of_device.h
new file mode 100644
index 000000000000..3c123990ca2e
--- /dev/null
+++ b/arch/powerpc/include/asm/of_device.h
@@ -0,0 +1,31 @@
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_node *node; /* to be obsoleted */
16 u64 dma_mask; /* DMA mask */
17 struct device dev; /* Generic device interface */
18};
19
20extern struct of_device *of_device_alloc(struct device_node *np,
21 const char *bus_id,
22 struct device *parent);
23
24extern int of_device_uevent(struct device *dev,
25 struct kobj_uevent_env *env);
26
27/* This is just here during the transition */
28#include <linux/of_device.h>
29
30#endif /* __KERNEL__ */
31#endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/arch/powerpc/include/asm/of_platform.h b/arch/powerpc/include/asm/of_platform.h
new file mode 100644
index 000000000000..18659ef72139
--- /dev/null
+++ b/arch/powerpc/include/asm/of_platform.h
@@ -0,0 +1,42 @@
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/* This is just here during the transition */
15#include <linux/of_platform.h>
16
17/* Platform drivers register/unregister */
18static inline int of_register_platform_driver(struct of_platform_driver *drv)
19{
20 return of_register_driver(drv, &of_platform_bus_type);
21}
22static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
23{
24 of_unregister_driver(drv);
25}
26
27/* Platform devices and busses creation */
28extern struct of_device *of_platform_device_create(struct device_node *np,
29 const char *bus_id,
30 struct device *parent);
31/* pseudo "matches" value to not do deep probe */
32#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
33
34extern int of_platform_bus_probe(struct device_node *root,
35 const struct of_device_id *matches,
36 struct device *parent);
37
38extern struct of_device *of_find_device_by_phandle(phandle ph);
39
40extern void of_instantiate_rtc(void);
41
42#endif /* _ASM_POWERPC_OF_PLATFORM_H */
diff --git a/arch/powerpc/include/asm/ohare.h b/arch/powerpc/include/asm/ohare.h
new file mode 100644
index 000000000000..0d030f9dea24
--- /dev/null
+++ b/arch/powerpc/include/asm/ohare.h
@@ -0,0 +1,54 @@
1#ifndef _ASM_POWERPC_OHARE_H
2#define _ASM_POWERPC_OHARE_H
3#ifdef __KERNEL__
4/*
5 * ohare.h: definitions for using the "O'Hare" I/O controller chip.
6 *
7 * Copyright (C) 1997 Paul Mackerras.
8 *
9 * BenH: Changed to match those of heathrow (but not all of them). Please
10 * check if I didn't break anything (especially the media bay).
11 */
12
13/* offset from ohare base for feature control register */
14#define OHARE_MBCR 0x34
15#define OHARE_FCR 0x38
16
17/*
18 * Bits in feature control register.
19 * These were mostly derived by experiment on a powerbook 3400
20 * and may differ for other machines.
21 */
22#define OH_SCC_RESET 1
23#define OH_BAY_POWER_N 2 /* a guess */
24#define OH_BAY_PCI_ENABLE 4 /* a guess */
25#define OH_BAY_IDE_ENABLE 8
26#define OH_BAY_FLOPPY_ENABLE 0x10
27#define OH_IDE0_ENABLE 0x20
28#define OH_IDE0_RESET_N 0x40 /* a guess */
29#define OH_BAY_DEV_MASK 0x1c
30#define OH_BAY_RESET_N 0x80
31#define OH_IOBUS_ENABLE 0x100 /* IOBUS seems to be IDE */
32#define OH_SCC_ENABLE 0x200
33#define OH_MESH_ENABLE 0x400
34#define OH_FLOPPY_ENABLE 0x800
35#define OH_SCCA_IO 0x4000
36#define OH_SCCB_IO 0x8000
37#define OH_VIA_ENABLE 0x10000 /* Is apparently wrong, to be verified */
38#define OH_IDE1_RESET_N 0x800000
39
40/*
41 * Bits to set in the feature control register on PowerBooks.
42 */
43#define PBOOK_FEATURES (OH_IDE_ENABLE | OH_SCC_ENABLE | \
44 OH_MESH_ENABLE | OH_SCCA_IO | OH_SCCB_IO)
45
46/*
47 * A magic value to put into the feature control register of the
48 * "ohare" I/O controller on Starmaxes to enable the IDE CD interface.
49 * Contributed by Harry Eaton.
50 */
51#define STARMAX_FEATURES 0xbeff7a
52
53#endif /* __KERNEL__ */
54#endif /* _ASM_POWERPC_OHARE_H */
diff --git a/arch/powerpc/include/asm/oprofile_impl.h b/arch/powerpc/include/asm/oprofile_impl.h
new file mode 100644
index 000000000000..95035c602ba6
--- /dev/null
+++ b/arch/powerpc/include/asm/oprofile_impl.h
@@ -0,0 +1,134 @@
1/*
2 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
3 *
4 * Based on alpha version.
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#ifndef _ASM_POWERPC_OPROFILE_IMPL_H
13#define _ASM_POWERPC_OPROFILE_IMPL_H
14#ifdef __KERNEL__
15
16#define OP_MAX_COUNTER 8
17
18/* Per-counter configuration as set via oprofilefs. */
19struct op_counter_config {
20 unsigned long enabled;
21 unsigned long event;
22 unsigned long count;
23 /* Classic doesn't support per-counter user/kernel selection */
24 unsigned long kernel;
25 unsigned long user;
26 unsigned long unit_mask;
27};
28
29/* System-wide configuration as set via oprofilefs. */
30struct op_system_config {
31#ifdef CONFIG_PPC64
32 unsigned long mmcr0;
33 unsigned long mmcr1;
34 unsigned long mmcra;
35#endif
36 unsigned long enable_kernel;
37 unsigned long enable_user;
38};
39
40/* Per-arch configuration */
41struct op_powerpc_model {
42 int (*reg_setup) (struct op_counter_config *,
43 struct op_system_config *,
44 int num_counters);
45 int (*cpu_setup) (struct op_counter_config *);
46 int (*start) (struct op_counter_config *);
47 int (*global_start) (struct op_counter_config *);
48 void (*stop) (void);
49 void (*global_stop) (void);
50 int (*sync_start)(void);
51 int (*sync_stop)(void);
52 void (*handle_interrupt) (struct pt_regs *,
53 struct op_counter_config *);
54 int num_counters;
55};
56
57extern struct op_powerpc_model op_model_fsl_emb;
58extern struct op_powerpc_model op_model_rs64;
59extern struct op_powerpc_model op_model_power4;
60extern struct op_powerpc_model op_model_7450;
61extern struct op_powerpc_model op_model_cell;
62extern struct op_powerpc_model op_model_pa6t;
63
64
65/* All the classic PPC parts use these */
66static inline unsigned int classic_ctr_read(unsigned int i)
67{
68 switch(i) {
69 case 0:
70 return mfspr(SPRN_PMC1);
71 case 1:
72 return mfspr(SPRN_PMC2);
73 case 2:
74 return mfspr(SPRN_PMC3);
75 case 3:
76 return mfspr(SPRN_PMC4);
77 case 4:
78 return mfspr(SPRN_PMC5);
79 case 5:
80 return mfspr(SPRN_PMC6);
81
82/* No PPC32 chip has more than 6 so far */
83#ifdef CONFIG_PPC64
84 case 6:
85 return mfspr(SPRN_PMC7);
86 case 7:
87 return mfspr(SPRN_PMC8);
88#endif
89 default:
90 return 0;
91 }
92}
93
94static inline void classic_ctr_write(unsigned int i, unsigned int val)
95{
96 switch(i) {
97 case 0:
98 mtspr(SPRN_PMC1, val);
99 break;
100 case 1:
101 mtspr(SPRN_PMC2, val);
102 break;
103 case 2:
104 mtspr(SPRN_PMC3, val);
105 break;
106 case 3:
107 mtspr(SPRN_PMC4, val);
108 break;
109 case 4:
110 mtspr(SPRN_PMC5, val);
111 break;
112 case 5:
113 mtspr(SPRN_PMC6, val);
114 break;
115
116/* No PPC32 chip has more than 6, yet */
117#ifdef CONFIG_PPC64
118 case 6:
119 mtspr(SPRN_PMC7, val);
120 break;
121 case 7:
122 mtspr(SPRN_PMC8, val);
123 break;
124#endif
125 default:
126 break;
127 }
128}
129
130
131extern void op_powerpc_backtrace(struct pt_regs * const regs, unsigned int depth);
132
133#endif /* __KERNEL__ */
134#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */
diff --git a/arch/powerpc/include/asm/pSeries_reconfig.h b/arch/powerpc/include/asm/pSeries_reconfig.h
new file mode 100644
index 000000000000..e482e5352e69
--- /dev/null
+++ b/arch/powerpc/include/asm/pSeries_reconfig.h
@@ -0,0 +1,29 @@
1#ifndef _PPC64_PSERIES_RECONFIG_H
2#define _PPC64_PSERIES_RECONFIG_H
3#ifdef __KERNEL__
4
5#include <linux/notifier.h>
6
7/*
8 * Use this API if your code needs to know about OF device nodes being
9 * added or removed on pSeries systems.
10 */
11
12#define PSERIES_RECONFIG_ADD 0x0001
13#define PSERIES_RECONFIG_REMOVE 0x0002
14#define PSERIES_DRCONF_MEM_ADD 0x0003
15#define PSERIES_DRCONF_MEM_REMOVE 0x0004
16
17#ifdef CONFIG_PPC_PSERIES
18extern int pSeries_reconfig_notifier_register(struct notifier_block *);
19extern void pSeries_reconfig_notifier_unregister(struct notifier_block *);
20#else /* !CONFIG_PPC_PSERIES */
21static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb)
22{
23 return 0;
24}
25static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { }
26#endif /* CONFIG_PPC_PSERIES */
27
28#endif /* __KERNEL__ */
29#endif /* _PPC64_PSERIES_RECONFIG_H */
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
new file mode 100644
index 000000000000..6493a395508b
--- /dev/null
+++ b/arch/powerpc/include/asm/paca.h
@@ -0,0 +1,112 @@
1/*
2 * This control block defines the PACA which defines the processor
3 * specific data for each logical processor on the system.
4 * There are some pointers defined that are utilized by PLIC.
5 *
6 * C 2001 PPC 64 Team, IBM Corp
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef _ASM_POWERPC_PACA_H
14#define _ASM_POWERPC_PACA_H
15#ifdef __KERNEL__
16
17#include <asm/types.h>
18#include <asm/lppaca.h>
19#include <asm/mmu.h>
20
21register struct paca_struct *local_paca asm("r13");
22
23#if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP)
24extern unsigned int debug_smp_processor_id(void); /* from linux/smp.h */
25/*
26 * Add standard checks that preemption cannot occur when using get_paca():
27 * otherwise the paca_struct it points to may be the wrong one just after.
28 */
29#define get_paca() ((void) debug_smp_processor_id(), local_paca)
30#else
31#define get_paca() local_paca
32#endif
33
34#define get_lppaca() (get_paca()->lppaca_ptr)
35#define get_slb_shadow() (get_paca()->slb_shadow_ptr)
36
37struct task_struct;
38
39/*
40 * Defines the layout of the paca.
41 *
42 * This structure is not directly accessed by firmware or the service
43 * processor.
44 */
45struct paca_struct {
46 /*
47 * Because hw_cpu_id, unlike other paca fields, is accessed
48 * routinely from other CPUs (from the IRQ code), we stick to
49 * read-only (after boot) fields in the first cacheline to
50 * avoid cacheline bouncing.
51 */
52
53 struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */
54
55 /*
56 * MAGIC: the spinlock functions in arch/powerpc/lib/locks.c
57 * load lock_token and paca_index with a single lwz
58 * instruction. They must travel together and be properly
59 * aligned.
60 */
61 u16 lock_token; /* Constant 0x8000, used in locks */
62 u16 paca_index; /* Logical processor number */
63
64 u64 kernel_toc; /* Kernel TOC address */
65 u64 stab_real; /* Absolute address of segment table */
66 u64 stab_addr; /* Virtual address of segment table */
67 void *emergency_sp; /* pointer to emergency stack */
68 u64 data_offset; /* per cpu data offset */
69 s16 hw_cpu_id; /* Physical processor number */
70 u8 cpu_start; /* At startup, processor spins until */
71 /* this becomes non-zero. */
72 struct slb_shadow *slb_shadow_ptr;
73
74 /*
75 * Now, starting in cacheline 2, the exception save areas
76 */
77 /* used for most interrupts/exceptions */
78 u64 exgen[10] __attribute__((aligned(0x80)));
79 u64 exmc[10]; /* used for machine checks */
80 u64 exslb[10]; /* used for SLB/segment table misses
81 * on the linear mapping */
82
83 mm_context_t context;
84 u16 vmalloc_sllp;
85 u16 slb_cache_ptr;
86 u16 slb_cache[SLB_CACHE_ENTRIES];
87
88 /*
89 * then miscellaneous read-write fields
90 */
91 struct task_struct *__current; /* Pointer to current */
92 u64 kstack; /* Saved Kernel stack addr */
93 u64 stab_rr; /* stab/slb round-robin counter */
94 u64 saved_r1; /* r1 save for RTAS calls */
95 u64 saved_msr; /* MSR saved here by enter_rtas */
96 u16 trap_save; /* Used when bad stack is encountered */
97 u8 soft_enabled; /* irq soft-enable flag */
98 u8 hard_enabled; /* set if irqs are enabled in MSR */
99 u8 io_sync; /* writel() needs spin_unlock sync */
100
101 /* Stuff for accurate time accounting */
102 u64 user_time; /* accumulated usermode TB ticks */
103 u64 system_time; /* accumulated system TB ticks */
104 u64 startpurr; /* PURR/TB value snapshot */
105 u64 startspurr; /* SPURR value snapshot */
106};
107
108extern struct paca_struct paca[];
109extern void initialise_pacas(void);
110
111#endif /* __KERNEL__ */
112#endif /* _ASM_POWERPC_PACA_H */
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
new file mode 100644
index 000000000000..e088545cb3f5
--- /dev/null
+++ b/arch/powerpc/include/asm/page.h
@@ -0,0 +1,225 @@
1#ifndef _ASM_POWERPC_PAGE_H
2#define _ASM_POWERPC_PAGE_H
3
4/*
5 * Copyright (C) 2001,2005 IBM Corporation.
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/asm-compat.h>
14#include <asm/kdump.h>
15#include <asm/types.h>
16
17/*
18 * On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
19 * page size. When using 64K pages however, whether we are really supporting
20 * 64K pages in HW or not is irrelevant to those definitions.
21 */
22#ifdef CONFIG_PPC_64K_PAGES
23#define PAGE_SHIFT 16
24#else
25#define PAGE_SHIFT 12
26#endif
27
28#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
29
30/* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */
31#define __HAVE_ARCH_GATE_AREA 1
32
33/*
34 * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we
35 * assign PAGE_MASK to a larger type it gets extended the way we want
36 * (i.e. with 1s in the high bits)
37 */
38#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
39
40/*
41 * KERNELBASE is the virtual address of the start of the kernel, it's often
42 * the same as PAGE_OFFSET, but _might not be_.
43 *
44 * The kdump dump kernel is one example where KERNELBASE != PAGE_OFFSET.
45 *
46 * PAGE_OFFSET is the virtual address of the start of lowmem.
47 *
48 * PHYSICAL_START is the physical address of the start of the kernel.
49 *
50 * MEMORY_START is the physical address of the start of lowmem.
51 *
52 * KERNELBASE, PAGE_OFFSET, and PHYSICAL_START are all configurable on
53 * ppc32 and based on how they are set we determine MEMORY_START.
54 *
55 * For the linear mapping the following equation should be true:
56 * KERNELBASE - PAGE_OFFSET = PHYSICAL_START - MEMORY_START
57 *
58 * Also, KERNELBASE >= PAGE_OFFSET and PHYSICAL_START >= MEMORY_START
59 *
60 * There are two was to determine a physical address from a virtual one:
61 * va = pa + PAGE_OFFSET - MEMORY_START
62 * va = pa + KERNELBASE - PHYSICAL_START
63 *
64 * If you want to know something's offset from the start of the kernel you
65 * should subtract KERNELBASE.
66 *
67 * If you want to test if something's a kernel address, use is_kernel_addr().
68 */
69
70#define KERNELBASE ASM_CONST(CONFIG_KERNEL_START)
71#define PAGE_OFFSET ASM_CONST(CONFIG_PAGE_OFFSET)
72#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_PHYSICAL_START))
73
74#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_FLATMEM)
75#ifndef __ASSEMBLY__
76extern phys_addr_t memstart_addr;
77extern phys_addr_t kernstart_addr;
78#endif
79#define PHYSICAL_START kernstart_addr
80#define MEMORY_START memstart_addr
81#else
82#define PHYSICAL_START ASM_CONST(CONFIG_PHYSICAL_START)
83#define MEMORY_START (PHYSICAL_START + PAGE_OFFSET - KERNELBASE)
84#endif
85
86#ifdef CONFIG_FLATMEM
87#define ARCH_PFN_OFFSET (MEMORY_START >> PAGE_SHIFT)
88#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < (ARCH_PFN_OFFSET + max_mapnr))
89#endif
90
91#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
92#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
93#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
94
95#define __va(x) ((void *)((unsigned long)(x) - PHYSICAL_START + KERNELBASE))
96#define __pa(x) ((unsigned long)(x) + PHYSICAL_START - KERNELBASE)
97
98/*
99 * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI,
100 * and needs to be executable. This means the whole heap ends
101 * up being executable.
102 */
103#define VM_DATA_DEFAULT_FLAGS32 (VM_READ | VM_WRITE | VM_EXEC | \
104 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
105
106#define VM_DATA_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \
107 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
108
109#ifdef __powerpc64__
110#include <asm/page_64.h>
111#else
112#include <asm/page_32.h>
113#endif
114
115/* align addr on a size boundary - adjust address up/down if needed */
116#define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
117#define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1)))
118
119/* align addr on a size boundary - adjust address up if needed */
120#define _ALIGN(addr,size) _ALIGN_UP(addr,size)
121
122/*
123 * Don't compare things with KERNELBASE or PAGE_OFFSET to test for
124 * "kernelness", use is_kernel_addr() - it should do what you want.
125 */
126#define is_kernel_addr(x) ((x) >= PAGE_OFFSET)
127
128#ifndef __ASSEMBLY__
129
130#undef STRICT_MM_TYPECHECKS
131
132#ifdef STRICT_MM_TYPECHECKS
133/* These are used to make use of C type-checking. */
134
135/* PTE level */
136typedef struct { pte_basic_t pte; } pte_t;
137#define pte_val(x) ((x).pte)
138#define __pte(x) ((pte_t) { (x) })
139
140/* 64k pages additionally define a bigger "real PTE" type that gathers
141 * the "second half" part of the PTE for pseudo 64k pages
142 */
143#ifdef CONFIG_PPC_64K_PAGES
144typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
145#else
146typedef struct { pte_t pte; } real_pte_t;
147#endif
148
149/* PMD level */
150#ifdef CONFIG_PPC64
151typedef struct { unsigned long pmd; } pmd_t;
152#define pmd_val(x) ((x).pmd)
153#define __pmd(x) ((pmd_t) { (x) })
154
155/* PUD level exusts only on 4k pages */
156#ifndef CONFIG_PPC_64K_PAGES
157typedef struct { unsigned long pud; } pud_t;
158#define pud_val(x) ((x).pud)
159#define __pud(x) ((pud_t) { (x) })
160#endif /* !CONFIG_PPC_64K_PAGES */
161#endif /* CONFIG_PPC64 */
162
163/* PGD level */
164typedef struct { unsigned long pgd; } pgd_t;
165#define pgd_val(x) ((x).pgd)
166#define __pgd(x) ((pgd_t) { (x) })
167
168/* Page protection bits */
169typedef struct { unsigned long pgprot; } pgprot_t;
170#define pgprot_val(x) ((x).pgprot)
171#define __pgprot(x) ((pgprot_t) { (x) })
172
173#else
174
175/*
176 * .. while these make it easier on the compiler
177 */
178
179typedef pte_basic_t pte_t;
180#define pte_val(x) (x)
181#define __pte(x) (x)
182
183#ifdef CONFIG_PPC_64K_PAGES
184typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
185#else
186typedef unsigned long real_pte_t;
187#endif
188
189
190#ifdef CONFIG_PPC64
191typedef unsigned long pmd_t;
192#define pmd_val(x) (x)
193#define __pmd(x) (x)
194
195#ifndef CONFIG_PPC_64K_PAGES
196typedef unsigned long pud_t;
197#define pud_val(x) (x)
198#define __pud(x) (x)
199#endif /* !CONFIG_PPC_64K_PAGES */
200#endif /* CONFIG_PPC64 */
201
202typedef unsigned long pgd_t;
203#define pgd_val(x) (x)
204#define pgprot_val(x) (x)
205
206typedef unsigned long pgprot_t;
207#define __pgd(x) (x)
208#define __pgprot(x) (x)
209
210#endif
211
212struct page;
213extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
214extern void copy_user_page(void *to, void *from, unsigned long vaddr,
215 struct page *p);
216extern int page_is_ram(unsigned long pfn);
217
218struct vm_area_struct;
219
220typedef struct page *pgtable_t;
221
222#include <asm-generic/memory_model.h>
223#endif /* __ASSEMBLY__ */
224
225#endif /* _ASM_POWERPC_PAGE_H */
diff --git a/arch/powerpc/include/asm/page_32.h b/arch/powerpc/include/asm/page_32.h
new file mode 100644
index 000000000000..ebfae530a379
--- /dev/null
+++ b/arch/powerpc/include/asm/page_32.h
@@ -0,0 +1,38 @@
1#ifndef _ASM_POWERPC_PAGE_32_H
2#define _ASM_POWERPC_PAGE_32_H
3
4#if defined(CONFIG_PHYSICAL_ALIGN) && (CONFIG_PHYSICAL_START != 0)
5#if (CONFIG_PHYSICAL_START % CONFIG_PHYSICAL_ALIGN) != 0
6#error "CONFIG_PHYSICAL_START must be a multiple of CONFIG_PHYSICAL_ALIGN"
7#endif
8#endif
9
10#define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32
11
12#ifdef CONFIG_NOT_COHERENT_CACHE
13#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
14#endif
15
16#ifndef __ASSEMBLY__
17/*
18 * The basic type of a PTE - 64 bits for those CPUs with > 32 bit
19 * physical addressing. For now this just the IBM PPC440.
20 */
21#ifdef CONFIG_PTE_64BIT
22typedef unsigned long long pte_basic_t;
23#define PTE_SHIFT (PAGE_SHIFT - 3) /* 512 ptes per page */
24#else
25typedef unsigned long pte_basic_t;
26#define PTE_SHIFT (PAGE_SHIFT - 2) /* 1024 ptes per page */
27#endif
28
29struct page;
30extern void clear_pages(void *page, int order);
31static inline void clear_page(void *page) { clear_pages(page, 0); }
32extern void copy_page(void *to, void *from);
33
34#include <asm-generic/page.h>
35
36#endif /* __ASSEMBLY__ */
37
38#endif /* _ASM_POWERPC_PAGE_32_H */
diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h
new file mode 100644
index 000000000000..043bfdfe4f73
--- /dev/null
+++ b/arch/powerpc/include/asm/page_64.h
@@ -0,0 +1,185 @@
1#ifndef _ASM_POWERPC_PAGE_64_H
2#define _ASM_POWERPC_PAGE_64_H
3
4/*
5 * Copyright (C) 2001 PPC64 Team, IBM Corp
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 * We always define HW_PAGE_SHIFT to 12 as use of 64K pages remains Linux
15 * specific, every notion of page number shared with the firmware, TCEs,
16 * iommu, etc... still uses a page size of 4K.
17 */
18#define HW_PAGE_SHIFT 12
19#define HW_PAGE_SIZE (ASM_CONST(1) << HW_PAGE_SHIFT)
20#define HW_PAGE_MASK (~(HW_PAGE_SIZE-1))
21
22/*
23 * PAGE_FACTOR is the number of bits factor between PAGE_SHIFT and
24 * HW_PAGE_SHIFT, that is 4K pages.
25 */
26#define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT)
27
28/* Segment size; normal 256M segments */
29#define SID_SHIFT 28
30#define SID_MASK ASM_CONST(0xfffffffff)
31#define ESID_MASK 0xfffffffff0000000UL
32#define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK)
33
34/* 1T segments */
35#define SID_SHIFT_1T 40
36#define SID_MASK_1T 0xffffffUL
37#define ESID_MASK_1T 0xffffff0000000000UL
38#define GET_ESID_1T(x) (((x) >> SID_SHIFT_1T) & SID_MASK_1T)
39
40#ifndef __ASSEMBLY__
41#include <asm/cache.h>
42
43typedef unsigned long pte_basic_t;
44
45static __inline__ void clear_page(void *addr)
46{
47 unsigned long lines, line_size;
48
49 line_size = ppc64_caches.dline_size;
50 lines = ppc64_caches.dlines_per_page;
51
52 __asm__ __volatile__(
53 "mtctr %1 # clear_page\n\
541: dcbz 0,%0\n\
55 add %0,%0,%3\n\
56 bdnz+ 1b"
57 : "=r" (addr)
58 : "r" (lines), "0" (addr), "r" (line_size)
59 : "ctr", "memory");
60}
61
62extern void copy_4K_page(void *to, void *from);
63
64#ifdef CONFIG_PPC_64K_PAGES
65static inline void copy_page(void *to, void *from)
66{
67 unsigned int i;
68 for (i=0; i < (1 << (PAGE_SHIFT - 12)); i++) {
69 copy_4K_page(to, from);
70 to += 4096;
71 from += 4096;
72 }
73}
74#else /* CONFIG_PPC_64K_PAGES */
75static inline void copy_page(void *to, void *from)
76{
77 copy_4K_page(to, from);
78}
79#endif /* CONFIG_PPC_64K_PAGES */
80
81/* Log 2 of page table size */
82extern u64 ppc64_pft_size;
83
84/* Large pages size */
85#ifdef CONFIG_HUGETLB_PAGE
86extern unsigned int HPAGE_SHIFT;
87#else
88#define HPAGE_SHIFT PAGE_SHIFT
89#endif
90#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
91#define HPAGE_MASK (~(HPAGE_SIZE - 1))
92#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
93#define HUGE_MAX_HSTATE 3
94
95#endif /* __ASSEMBLY__ */
96
97#ifdef CONFIG_PPC_MM_SLICES
98
99#define SLICE_LOW_SHIFT 28
100#define SLICE_HIGH_SHIFT 40
101
102#define SLICE_LOW_TOP (0x100000000ul)
103#define SLICE_NUM_LOW (SLICE_LOW_TOP >> SLICE_LOW_SHIFT)
104#define SLICE_NUM_HIGH (PGTABLE_RANGE >> SLICE_HIGH_SHIFT)
105
106#define GET_LOW_SLICE_INDEX(addr) ((addr) >> SLICE_LOW_SHIFT)
107#define GET_HIGH_SLICE_INDEX(addr) ((addr) >> SLICE_HIGH_SHIFT)
108
109#ifndef __ASSEMBLY__
110
111struct slice_mask {
112 u16 low_slices;
113 u16 high_slices;
114};
115
116struct mm_struct;
117
118extern unsigned long slice_get_unmapped_area(unsigned long addr,
119 unsigned long len,
120 unsigned long flags,
121 unsigned int psize,
122 int topdown,
123 int use_cache);
124
125extern unsigned int get_slice_psize(struct mm_struct *mm,
126 unsigned long addr);
127
128extern void slice_init_context(struct mm_struct *mm, unsigned int psize);
129extern void slice_set_user_psize(struct mm_struct *mm, unsigned int psize);
130extern void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
131 unsigned long len, unsigned int psize);
132
133#define slice_mm_new_context(mm) ((mm)->context.id == 0)
134
135#endif /* __ASSEMBLY__ */
136#else
137#define slice_init()
138#define get_slice_psize(mm, addr) ((mm)->context.user_psize)
139#define slice_set_user_psize(mm, psize) \
140do { \
141 (mm)->context.user_psize = (psize); \
142 (mm)->context.sllp = SLB_VSID_USER | mmu_psize_defs[(psize)].sllp; \
143} while (0)
144#define slice_set_range_psize(mm, start, len, psize) \
145 slice_set_user_psize((mm), (psize))
146#define slice_mm_new_context(mm) 1
147#endif /* CONFIG_PPC_MM_SLICES */
148
149#ifdef CONFIG_HUGETLB_PAGE
150
151#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
152
153#endif /* !CONFIG_HUGETLB_PAGE */
154
155#ifdef MODULE
156#define __page_aligned __attribute__((__aligned__(PAGE_SIZE)))
157#else
158#define __page_aligned \
159 __attribute__((__aligned__(PAGE_SIZE), \
160 __section__(".data.page_aligned")))
161#endif
162
163#define VM_DATA_DEFAULT_FLAGS \
164 (test_thread_flag(TIF_32BIT) ? \
165 VM_DATA_DEFAULT_FLAGS32 : VM_DATA_DEFAULT_FLAGS64)
166
167/*
168 * This is the default if a program doesn't have a PT_GNU_STACK
169 * program header entry. The PPC64 ELF ABI has a non executable stack
170 * stack by default, so in the absense of a PT_GNU_STACK program header
171 * we turn execute permission off.
172 */
173#define VM_STACK_DEFAULT_FLAGS32 (VM_READ | VM_WRITE | VM_EXEC | \
174 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
175
176#define VM_STACK_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \
177 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
178
179#define VM_STACK_DEFAULT_FLAGS \
180 (test_thread_flag(TIF_32BIT) ? \
181 VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64)
182
183#include <asm-generic/page.h>
184
185#endif /* _ASM_POWERPC_PAGE_64_H */
diff --git a/arch/powerpc/include/asm/param.h b/arch/powerpc/include/asm/param.h
new file mode 100644
index 000000000000..094f63d4d5ca
--- /dev/null
+++ b/arch/powerpc/include/asm/param.h
@@ -0,0 +1,22 @@
1#ifndef _ASM_POWERPC_PARAM_H
2#define _ASM_POWERPC_PARAM_H
3
4#ifdef __KERNEL__
5#define HZ CONFIG_HZ /* internal kernel timer frequency */
6#define USER_HZ 100 /* for user interfaces in "ticks" */
7#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
8#endif /* __KERNEL__ */
9
10#ifndef HZ
11#define HZ 100
12#endif
13
14#define EXEC_PAGESIZE 4096
15
16#ifndef NOGROUP
17#define NOGROUP (-1)
18#endif
19
20#define MAXHOSTNAMELEN 64 /* max length of hostname */
21
22#endif /* _ASM_POWERPC_PARAM_H */
diff --git a/arch/powerpc/include/asm/parport.h b/arch/powerpc/include/asm/parport.h
new file mode 100644
index 000000000000..414c50e2e881
--- /dev/null
+++ b/arch/powerpc/include/asm/parport.h
@@ -0,0 +1,39 @@
1/*
2 * parport.h: platform-specific PC-style parport initialisation
3 *
4 * Copyright (C) 1999, 2000 Tim Waugh <tim@cyberelk.demon.co.uk>
5 *
6 * This file should only be included by drivers/parport/parport_pc.c.
7 */
8
9#ifndef _ASM_POWERPC_PARPORT_H
10#define _ASM_POWERPC_PARPORT_H
11#ifdef __KERNEL__
12
13#include <asm/prom.h>
14
15static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
16{
17 struct device_node *np;
18 const u32 *prop;
19 u32 io1, io2;
20 int propsize;
21 int count = 0;
22 for (np = NULL; (np = of_find_compatible_node(np,
23 "parallel",
24 "pnpPNP,400")) != NULL;) {
25 prop = of_get_property(np, "reg", &propsize);
26 if (!prop || propsize > 6*sizeof(u32))
27 continue;
28 io1 = prop[1]; io2 = prop[2];
29 prop = of_get_property(np, "interrupts", NULL);
30 if (!prop)
31 continue;
32 if (parport_pc_probe_port(io1, io2, prop[0], autodma, NULL) != NULL)
33 count++;
34 }
35 return count;
36}
37
38#endif /* __KERNEL__ */
39#endif /* !(_ASM_POWERPC_PARPORT_H) */
diff --git a/arch/powerpc/include/asm/pasemi_dma.h b/arch/powerpc/include/asm/pasemi_dma.h
new file mode 100644
index 000000000000..19fd7933e2d9
--- /dev/null
+++ b/arch/powerpc/include/asm/pasemi_dma.h
@@ -0,0 +1,538 @@
1/*
2 * Copyright (C) 2006-2008 PA Semi, Inc
3 *
4 * Hardware register layout and descriptor formats for the on-board
5 * DMA engine on PA Semi PWRficient. Used by ethernet, function and security
6 * drivers.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef ASM_PASEMI_DMA_H
23#define ASM_PASEMI_DMA_H
24
25/* status register layout in IOB region, at 0xfb800000 */
26struct pasdma_status {
27 u64 rx_sta[64]; /* RX channel status */
28 u64 tx_sta[20]; /* TX channel status */
29};
30
31
32/* All these registers live in the PCI configuration space for the DMA PCI
33 * device. Use the normal PCI config access functions for them.
34 */
35enum {
36 PAS_DMA_CAP_TXCH = 0x44, /* Transmit Channel Info */
37 PAS_DMA_CAP_RXCH = 0x48, /* Transmit Channel Info */
38 PAS_DMA_CAP_IFI = 0x4c, /* Interface Info */
39 PAS_DMA_COM_TXCMD = 0x100, /* Transmit Command Register */
40 PAS_DMA_COM_TXSTA = 0x104, /* Transmit Status Register */
41 PAS_DMA_COM_RXCMD = 0x108, /* Receive Command Register */
42 PAS_DMA_COM_RXSTA = 0x10c, /* Receive Status Register */
43 PAS_DMA_COM_CFG = 0x114, /* Common config reg */
44 PAS_DMA_TXF_SFLG0 = 0x140, /* Set flags */
45 PAS_DMA_TXF_SFLG1 = 0x144, /* Set flags */
46 PAS_DMA_TXF_CFLG0 = 0x148, /* Set flags */
47 PAS_DMA_TXF_CFLG1 = 0x14c, /* Set flags */
48};
49
50
51#define PAS_DMA_CAP_TXCH_TCHN_M 0x00ff0000 /* # of TX channels */
52#define PAS_DMA_CAP_TXCH_TCHN_S 16
53
54#define PAS_DMA_CAP_RXCH_RCHN_M 0x00ff0000 /* # of RX channels */
55#define PAS_DMA_CAP_RXCH_RCHN_S 16
56
57#define PAS_DMA_CAP_IFI_IOFF_M 0xff000000 /* Cfg reg for intf pointers */
58#define PAS_DMA_CAP_IFI_IOFF_S 24
59#define PAS_DMA_CAP_IFI_NIN_M 0x00ff0000 /* # of interfaces */
60#define PAS_DMA_CAP_IFI_NIN_S 16
61
62#define PAS_DMA_COM_TXCMD_EN 0x00000001 /* enable */
63#define PAS_DMA_COM_TXSTA_ACT 0x00000001 /* active */
64#define PAS_DMA_COM_RXCMD_EN 0x00000001 /* enable */
65#define PAS_DMA_COM_RXSTA_ACT 0x00000001 /* active */
66
67
68/* Per-interface and per-channel registers */
69#define _PAS_DMA_RXINT_STRIDE 0x20
70#define PAS_DMA_RXINT_RCMDSTA(i) (0x200+(i)*_PAS_DMA_RXINT_STRIDE)
71#define PAS_DMA_RXINT_RCMDSTA_EN 0x00000001
72#define PAS_DMA_RXINT_RCMDSTA_ST 0x00000002
73#define PAS_DMA_RXINT_RCMDSTA_MBT 0x00000008
74#define PAS_DMA_RXINT_RCMDSTA_MDR 0x00000010
75#define PAS_DMA_RXINT_RCMDSTA_MOO 0x00000020
76#define PAS_DMA_RXINT_RCMDSTA_MBP 0x00000040
77#define PAS_DMA_RXINT_RCMDSTA_BT 0x00000800
78#define PAS_DMA_RXINT_RCMDSTA_DR 0x00001000
79#define PAS_DMA_RXINT_RCMDSTA_OO 0x00002000
80#define PAS_DMA_RXINT_RCMDSTA_BP 0x00004000
81#define PAS_DMA_RXINT_RCMDSTA_TB 0x00008000
82#define PAS_DMA_RXINT_RCMDSTA_ACT 0x00010000
83#define PAS_DMA_RXINT_RCMDSTA_DROPS_M 0xfffe0000
84#define PAS_DMA_RXINT_RCMDSTA_DROPS_S 17
85#define PAS_DMA_RXINT_CFG(i) (0x204+(i)*_PAS_DMA_RXINT_STRIDE)
86#define PAS_DMA_RXINT_CFG_RBP 0x80000000
87#define PAS_DMA_RXINT_CFG_ITRR 0x40000000
88#define PAS_DMA_RXINT_CFG_DHL_M 0x07000000
89#define PAS_DMA_RXINT_CFG_DHL_S 24
90#define PAS_DMA_RXINT_CFG_DHL(x) (((x) << PAS_DMA_RXINT_CFG_DHL_S) & \
91 PAS_DMA_RXINT_CFG_DHL_M)
92#define PAS_DMA_RXINT_CFG_ITR 0x00400000
93#define PAS_DMA_RXINT_CFG_LW 0x00200000
94#define PAS_DMA_RXINT_CFG_L2 0x00100000
95#define PAS_DMA_RXINT_CFG_HEN 0x00080000
96#define PAS_DMA_RXINT_CFG_WIF 0x00000002
97#define PAS_DMA_RXINT_CFG_WIL 0x00000001
98
99#define PAS_DMA_RXINT_INCR(i) (0x210+(i)*_PAS_DMA_RXINT_STRIDE)
100#define PAS_DMA_RXINT_INCR_INCR_M 0x0000ffff
101#define PAS_DMA_RXINT_INCR_INCR_S 0
102#define PAS_DMA_RXINT_INCR_INCR(x) ((x) & 0x0000ffff)
103#define PAS_DMA_RXINT_BASEL(i) (0x218+(i)*_PAS_DMA_RXINT_STRIDE)
104#define PAS_DMA_RXINT_BASEL_BRBL(x) ((x) & ~0x3f)
105#define PAS_DMA_RXINT_BASEU(i) (0x21c+(i)*_PAS_DMA_RXINT_STRIDE)
106#define PAS_DMA_RXINT_BASEU_BRBH(x) ((x) & 0xfff)
107#define PAS_DMA_RXINT_BASEU_SIZ_M 0x3fff0000 /* # of cache lines worth of buffer ring */
108#define PAS_DMA_RXINT_BASEU_SIZ_S 16 /* 0 = 16K */
109#define PAS_DMA_RXINT_BASEU_SIZ(x) (((x) << PAS_DMA_RXINT_BASEU_SIZ_S) & \
110 PAS_DMA_RXINT_BASEU_SIZ_M)
111
112
113#define _PAS_DMA_TXCHAN_STRIDE 0x20 /* Size per channel */
114#define _PAS_DMA_TXCHAN_TCMDSTA 0x300 /* Command / Status */
115#define _PAS_DMA_TXCHAN_CFG 0x304 /* Configuration */
116#define _PAS_DMA_TXCHAN_DSCRBU 0x308 /* Descriptor BU Allocation */
117#define _PAS_DMA_TXCHAN_INCR 0x310 /* Descriptor increment */
118#define _PAS_DMA_TXCHAN_CNT 0x314 /* Descriptor count/offset */
119#define _PAS_DMA_TXCHAN_BASEL 0x318 /* Descriptor ring base (low) */
120#define _PAS_DMA_TXCHAN_BASEU 0x31c /* (high) */
121#define PAS_DMA_TXCHAN_TCMDSTA(c) (0x300+(c)*_PAS_DMA_TXCHAN_STRIDE)
122#define PAS_DMA_TXCHAN_TCMDSTA_EN 0x00000001 /* Enabled */
123#define PAS_DMA_TXCHAN_TCMDSTA_ST 0x00000002 /* Stop interface */
124#define PAS_DMA_TXCHAN_TCMDSTA_ACT 0x00010000 /* Active */
125#define PAS_DMA_TXCHAN_TCMDSTA_SZ 0x00000800
126#define PAS_DMA_TXCHAN_TCMDSTA_DB 0x00000400
127#define PAS_DMA_TXCHAN_TCMDSTA_DE 0x00000200
128#define PAS_DMA_TXCHAN_TCMDSTA_DA 0x00000100
129#define PAS_DMA_TXCHAN_CFG(c) (0x304+(c)*_PAS_DMA_TXCHAN_STRIDE)
130#define PAS_DMA_TXCHAN_CFG_TY_IFACE 0x00000000 /* Type = interface */
131#define PAS_DMA_TXCHAN_CFG_TY_COPY 0x00000001 /* Type = copy only */
132#define PAS_DMA_TXCHAN_CFG_TY_FUNC 0x00000002 /* Type = function */
133#define PAS_DMA_TXCHAN_CFG_TY_XOR 0x00000003 /* Type = xor only */
134#define PAS_DMA_TXCHAN_CFG_TATTR_M 0x0000003c
135#define PAS_DMA_TXCHAN_CFG_TATTR_S 2
136#define PAS_DMA_TXCHAN_CFG_TATTR(x) (((x) << PAS_DMA_TXCHAN_CFG_TATTR_S) & \
137 PAS_DMA_TXCHAN_CFG_TATTR_M)
138#define PAS_DMA_TXCHAN_CFG_LPDQ 0x00000800
139#define PAS_DMA_TXCHAN_CFG_LPSQ 0x00000400
140#define PAS_DMA_TXCHAN_CFG_WT_M 0x000003c0
141#define PAS_DMA_TXCHAN_CFG_WT_S 6
142#define PAS_DMA_TXCHAN_CFG_WT(x) (((x) << PAS_DMA_TXCHAN_CFG_WT_S) & \
143 PAS_DMA_TXCHAN_CFG_WT_M)
144#define PAS_DMA_TXCHAN_CFG_TRD 0x00010000 /* translate data */
145#define PAS_DMA_TXCHAN_CFG_TRR 0x00008000 /* translate rings */
146#define PAS_DMA_TXCHAN_CFG_UP 0x00004000 /* update tx descr when sent */
147#define PAS_DMA_TXCHAN_CFG_CL 0x00002000 /* Clean last line */
148#define PAS_DMA_TXCHAN_CFG_CF 0x00001000 /* Clean first line */
149#define PAS_DMA_TXCHAN_INCR(c) (0x310+(c)*_PAS_DMA_TXCHAN_STRIDE)
150#define PAS_DMA_TXCHAN_BASEL(c) (0x318+(c)*_PAS_DMA_TXCHAN_STRIDE)
151#define PAS_DMA_TXCHAN_BASEL_BRBL_M 0xffffffc0
152#define PAS_DMA_TXCHAN_BASEL_BRBL_S 0
153#define PAS_DMA_TXCHAN_BASEL_BRBL(x) (((x) << PAS_DMA_TXCHAN_BASEL_BRBL_S) & \
154 PAS_DMA_TXCHAN_BASEL_BRBL_M)
155#define PAS_DMA_TXCHAN_BASEU(c) (0x31c+(c)*_PAS_DMA_TXCHAN_STRIDE)
156#define PAS_DMA_TXCHAN_BASEU_BRBH_M 0x00000fff
157#define PAS_DMA_TXCHAN_BASEU_BRBH_S 0
158#define PAS_DMA_TXCHAN_BASEU_BRBH(x) (((x) << PAS_DMA_TXCHAN_BASEU_BRBH_S) & \
159 PAS_DMA_TXCHAN_BASEU_BRBH_M)
160/* # of cache lines worth of buffer ring */
161#define PAS_DMA_TXCHAN_BASEU_SIZ_M 0x3fff0000
162#define PAS_DMA_TXCHAN_BASEU_SIZ_S 16 /* 0 = 16K */
163#define PAS_DMA_TXCHAN_BASEU_SIZ(x) (((x) << PAS_DMA_TXCHAN_BASEU_SIZ_S) & \
164 PAS_DMA_TXCHAN_BASEU_SIZ_M)
165
166#define _PAS_DMA_RXCHAN_STRIDE 0x20 /* Size per channel */
167#define _PAS_DMA_RXCHAN_CCMDSTA 0x800 /* Command / Status */
168#define _PAS_DMA_RXCHAN_CFG 0x804 /* Configuration */
169#define _PAS_DMA_RXCHAN_INCR 0x810 /* Descriptor increment */
170#define _PAS_DMA_RXCHAN_CNT 0x814 /* Descriptor count/offset */
171#define _PAS_DMA_RXCHAN_BASEL 0x818 /* Descriptor ring base (low) */
172#define _PAS_DMA_RXCHAN_BASEU 0x81c /* (high) */
173#define PAS_DMA_RXCHAN_CCMDSTA(c) (0x800+(c)*_PAS_DMA_RXCHAN_STRIDE)
174#define PAS_DMA_RXCHAN_CCMDSTA_EN 0x00000001 /* Enabled */
175#define PAS_DMA_RXCHAN_CCMDSTA_ST 0x00000002 /* Stop interface */
176#define PAS_DMA_RXCHAN_CCMDSTA_ACT 0x00010000 /* Active */
177#define PAS_DMA_RXCHAN_CCMDSTA_DU 0x00020000
178#define PAS_DMA_RXCHAN_CCMDSTA_OD 0x00002000
179#define PAS_DMA_RXCHAN_CCMDSTA_FD 0x00001000
180#define PAS_DMA_RXCHAN_CCMDSTA_DT 0x00000800
181#define PAS_DMA_RXCHAN_CFG(c) (0x804+(c)*_PAS_DMA_RXCHAN_STRIDE)
182#define PAS_DMA_RXCHAN_CFG_CTR 0x00000400
183#define PAS_DMA_RXCHAN_CFG_HBU_M 0x00000380
184#define PAS_DMA_RXCHAN_CFG_HBU_S 7
185#define PAS_DMA_RXCHAN_CFG_HBU(x) (((x) << PAS_DMA_RXCHAN_CFG_HBU_S) & \
186 PAS_DMA_RXCHAN_CFG_HBU_M)
187#define PAS_DMA_RXCHAN_INCR(c) (0x810+(c)*_PAS_DMA_RXCHAN_STRIDE)
188#define PAS_DMA_RXCHAN_BASEL(c) (0x818+(c)*_PAS_DMA_RXCHAN_STRIDE)
189#define PAS_DMA_RXCHAN_BASEL_BRBL_M 0xffffffc0
190#define PAS_DMA_RXCHAN_BASEL_BRBL_S 0
191#define PAS_DMA_RXCHAN_BASEL_BRBL(x) (((x) << PAS_DMA_RXCHAN_BASEL_BRBL_S) & \
192 PAS_DMA_RXCHAN_BASEL_BRBL_M)
193#define PAS_DMA_RXCHAN_BASEU(c) (0x81c+(c)*_PAS_DMA_RXCHAN_STRIDE)
194#define PAS_DMA_RXCHAN_BASEU_BRBH_M 0x00000fff
195#define PAS_DMA_RXCHAN_BASEU_BRBH_S 0
196#define PAS_DMA_RXCHAN_BASEU_BRBH(x) (((x) << PAS_DMA_RXCHAN_BASEU_BRBH_S) & \
197 PAS_DMA_RXCHAN_BASEU_BRBH_M)
198/* # of cache lines worth of buffer ring */
199#define PAS_DMA_RXCHAN_BASEU_SIZ_M 0x3fff0000
200#define PAS_DMA_RXCHAN_BASEU_SIZ_S 16 /* 0 = 16K */
201#define PAS_DMA_RXCHAN_BASEU_SIZ(x) (((x) << PAS_DMA_RXCHAN_BASEU_SIZ_S) & \
202 PAS_DMA_RXCHAN_BASEU_SIZ_M)
203
204#define PAS_STATUS_PCNT_M 0x000000000000ffffull
205#define PAS_STATUS_PCNT_S 0
206#define PAS_STATUS_DCNT_M 0x00000000ffff0000ull
207#define PAS_STATUS_DCNT_S 16
208#define PAS_STATUS_BPCNT_M 0x0000ffff00000000ull
209#define PAS_STATUS_BPCNT_S 32
210#define PAS_STATUS_CAUSE_M 0xf000000000000000ull
211#define PAS_STATUS_TIMER 0x1000000000000000ull
212#define PAS_STATUS_ERROR 0x2000000000000000ull
213#define PAS_STATUS_SOFT 0x4000000000000000ull
214#define PAS_STATUS_INT 0x8000000000000000ull
215
216#define PAS_IOB_COM_PKTHDRCNT 0x120
217#define PAS_IOB_COM_PKTHDRCNT_PKTHDR1_M 0x0fff0000
218#define PAS_IOB_COM_PKTHDRCNT_PKTHDR1_S 16
219#define PAS_IOB_COM_PKTHDRCNT_PKTHDR0_M 0x00000fff
220#define PAS_IOB_COM_PKTHDRCNT_PKTHDR0_S 0
221
222#define PAS_IOB_DMA_RXCH_CFG(i) (0x1100 + (i)*4)
223#define PAS_IOB_DMA_RXCH_CFG_CNTTH_M 0x00000fff
224#define PAS_IOB_DMA_RXCH_CFG_CNTTH_S 0
225#define PAS_IOB_DMA_RXCH_CFG_CNTTH(x) (((x) << PAS_IOB_DMA_RXCH_CFG_CNTTH_S) & \
226 PAS_IOB_DMA_RXCH_CFG_CNTTH_M)
227#define PAS_IOB_DMA_TXCH_CFG(i) (0x1200 + (i)*4)
228#define PAS_IOB_DMA_TXCH_CFG_CNTTH_M 0x00000fff
229#define PAS_IOB_DMA_TXCH_CFG_CNTTH_S 0
230#define PAS_IOB_DMA_TXCH_CFG_CNTTH(x) (((x) << PAS_IOB_DMA_TXCH_CFG_CNTTH_S) & \
231 PAS_IOB_DMA_TXCH_CFG_CNTTH_M)
232#define PAS_IOB_DMA_RXCH_STAT(i) (0x1300 + (i)*4)
233#define PAS_IOB_DMA_RXCH_STAT_INTGEN 0x00001000
234#define PAS_IOB_DMA_RXCH_STAT_CNTDEL_M 0x00000fff
235#define PAS_IOB_DMA_RXCH_STAT_CNTDEL_S 0
236#define PAS_IOB_DMA_RXCH_STAT_CNTDEL(x) (((x) << PAS_IOB_DMA_RXCH_STAT_CNTDEL_S) &\
237 PAS_IOB_DMA_RXCH_STAT_CNTDEL_M)
238#define PAS_IOB_DMA_TXCH_STAT(i) (0x1400 + (i)*4)
239#define PAS_IOB_DMA_TXCH_STAT_INTGEN 0x00001000
240#define PAS_IOB_DMA_TXCH_STAT_CNTDEL_M 0x00000fff
241#define PAS_IOB_DMA_TXCH_STAT_CNTDEL_S 0
242#define PAS_IOB_DMA_TXCH_STAT_CNTDEL(x) (((x) << PAS_IOB_DMA_TXCH_STAT_CNTDEL_S) &\
243 PAS_IOB_DMA_TXCH_STAT_CNTDEL_M)
244#define PAS_IOB_DMA_RXCH_RESET(i) (0x1500 + (i)*4)
245#define PAS_IOB_DMA_RXCH_RESET_PCNT_M 0xffff0000
246#define PAS_IOB_DMA_RXCH_RESET_PCNT_S 16
247#define PAS_IOB_DMA_RXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_RXCH_RESET_PCNT_S) & \
248 PAS_IOB_DMA_RXCH_RESET_PCNT_M)
249#define PAS_IOB_DMA_RXCH_RESET_PCNTRST 0x00000020
250#define PAS_IOB_DMA_RXCH_RESET_DCNTRST 0x00000010
251#define PAS_IOB_DMA_RXCH_RESET_TINTC 0x00000008
252#define PAS_IOB_DMA_RXCH_RESET_DINTC 0x00000004
253#define PAS_IOB_DMA_RXCH_RESET_SINTC 0x00000002
254#define PAS_IOB_DMA_RXCH_RESET_PINTC 0x00000001
255#define PAS_IOB_DMA_TXCH_RESET(i) (0x1600 + (i)*4)
256#define PAS_IOB_DMA_TXCH_RESET_PCNT_M 0xffff0000
257#define PAS_IOB_DMA_TXCH_RESET_PCNT_S 16
258#define PAS_IOB_DMA_TXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_TXCH_RESET_PCNT_S) & \
259 PAS_IOB_DMA_TXCH_RESET_PCNT_M)
260#define PAS_IOB_DMA_TXCH_RESET_PCNTRST 0x00000020
261#define PAS_IOB_DMA_TXCH_RESET_DCNTRST 0x00000010
262#define PAS_IOB_DMA_TXCH_RESET_TINTC 0x00000008
263#define PAS_IOB_DMA_TXCH_RESET_DINTC 0x00000004
264#define PAS_IOB_DMA_TXCH_RESET_SINTC 0x00000002
265#define PAS_IOB_DMA_TXCH_RESET_PINTC 0x00000001
266
267#define PAS_IOB_DMA_COM_TIMEOUTCFG 0x1700
268#define PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_M 0x00ffffff
269#define PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_S 0
270#define PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(x) (((x) << PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_S) & \
271 PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_M)
272
273/* Transmit descriptor fields */
274#define XCT_MACTX_T 0x8000000000000000ull
275#define XCT_MACTX_ST 0x4000000000000000ull
276#define XCT_MACTX_NORES 0x0000000000000000ull
277#define XCT_MACTX_8BRES 0x1000000000000000ull
278#define XCT_MACTX_24BRES 0x2000000000000000ull
279#define XCT_MACTX_40BRES 0x3000000000000000ull
280#define XCT_MACTX_I 0x0800000000000000ull
281#define XCT_MACTX_O 0x0400000000000000ull
282#define XCT_MACTX_E 0x0200000000000000ull
283#define XCT_MACTX_VLAN_M 0x0180000000000000ull
284#define XCT_MACTX_VLAN_NOP 0x0000000000000000ull
285#define XCT_MACTX_VLAN_REMOVE 0x0080000000000000ull
286#define XCT_MACTX_VLAN_INSERT 0x0100000000000000ull
287#define XCT_MACTX_VLAN_REPLACE 0x0180000000000000ull
288#define XCT_MACTX_CRC_M 0x0060000000000000ull
289#define XCT_MACTX_CRC_NOP 0x0000000000000000ull
290#define XCT_MACTX_CRC_INSERT 0x0020000000000000ull
291#define XCT_MACTX_CRC_PAD 0x0040000000000000ull
292#define XCT_MACTX_CRC_REPLACE 0x0060000000000000ull
293#define XCT_MACTX_SS 0x0010000000000000ull
294#define XCT_MACTX_LLEN_M 0x00007fff00000000ull
295#define XCT_MACTX_LLEN_S 32ull
296#define XCT_MACTX_LLEN(x) ((((long)(x)) << XCT_MACTX_LLEN_S) & \
297 XCT_MACTX_LLEN_M)
298#define XCT_MACTX_IPH_M 0x00000000f8000000ull
299#define XCT_MACTX_IPH_S 27ull
300#define XCT_MACTX_IPH(x) ((((long)(x)) << XCT_MACTX_IPH_S) & \
301 XCT_MACTX_IPH_M)
302#define XCT_MACTX_IPO_M 0x0000000007c00000ull
303#define XCT_MACTX_IPO_S 22ull
304#define XCT_MACTX_IPO(x) ((((long)(x)) << XCT_MACTX_IPO_S) & \
305 XCT_MACTX_IPO_M)
306#define XCT_MACTX_CSUM_M 0x0000000000000060ull
307#define XCT_MACTX_CSUM_NOP 0x0000000000000000ull
308#define XCT_MACTX_CSUM_TCP 0x0000000000000040ull
309#define XCT_MACTX_CSUM_UDP 0x0000000000000060ull
310#define XCT_MACTX_V6 0x0000000000000010ull
311#define XCT_MACTX_C 0x0000000000000004ull
312#define XCT_MACTX_AL2 0x0000000000000002ull
313
314/* Receive descriptor fields */
315#define XCT_MACRX_T 0x8000000000000000ull
316#define XCT_MACRX_ST 0x4000000000000000ull
317#define XCT_MACRX_RR_M 0x3000000000000000ull
318#define XCT_MACRX_RR_NORES 0x0000000000000000ull
319#define XCT_MACRX_RR_8BRES 0x1000000000000000ull
320#define XCT_MACRX_O 0x0400000000000000ull
321#define XCT_MACRX_E 0x0200000000000000ull
322#define XCT_MACRX_FF 0x0100000000000000ull
323#define XCT_MACRX_PF 0x0080000000000000ull
324#define XCT_MACRX_OB 0x0040000000000000ull
325#define XCT_MACRX_OD 0x0020000000000000ull
326#define XCT_MACRX_FS 0x0010000000000000ull
327#define XCT_MACRX_NB_M 0x000fc00000000000ull
328#define XCT_MACRX_NB_S 46ULL
329#define XCT_MACRX_NB(x) ((((long)(x)) << XCT_MACRX_NB_S) & \
330 XCT_MACRX_NB_M)
331#define XCT_MACRX_LLEN_M 0x00003fff00000000ull
332#define XCT_MACRX_LLEN_S 32ULL
333#define XCT_MACRX_LLEN(x) ((((long)(x)) << XCT_MACRX_LLEN_S) & \
334 XCT_MACRX_LLEN_M)
335#define XCT_MACRX_CRC 0x0000000080000000ull
336#define XCT_MACRX_LEN_M 0x0000000060000000ull
337#define XCT_MACRX_LEN_TOOSHORT 0x0000000020000000ull
338#define XCT_MACRX_LEN_BELOWMIN 0x0000000040000000ull
339#define XCT_MACRX_LEN_TRUNC 0x0000000060000000ull
340#define XCT_MACRX_CAST_M 0x0000000018000000ull
341#define XCT_MACRX_CAST_UNI 0x0000000000000000ull
342#define XCT_MACRX_CAST_MULTI 0x0000000008000000ull
343#define XCT_MACRX_CAST_BROAD 0x0000000010000000ull
344#define XCT_MACRX_CAST_PAUSE 0x0000000018000000ull
345#define XCT_MACRX_VLC_M 0x0000000006000000ull
346#define XCT_MACRX_FM 0x0000000001000000ull
347#define XCT_MACRX_HTY_M 0x0000000000c00000ull
348#define XCT_MACRX_HTY_IPV4_OK 0x0000000000000000ull
349#define XCT_MACRX_HTY_IPV6 0x0000000000400000ull
350#define XCT_MACRX_HTY_IPV4_BAD 0x0000000000800000ull
351#define XCT_MACRX_HTY_NONIP 0x0000000000c00000ull
352#define XCT_MACRX_IPP_M 0x00000000003f0000ull
353#define XCT_MACRX_IPP_S 16
354#define XCT_MACRX_CSUM_M 0x000000000000ffffull
355#define XCT_MACRX_CSUM_S 0
356
357#define XCT_PTR_T 0x8000000000000000ull
358#define XCT_PTR_LEN_M 0x7ffff00000000000ull
359#define XCT_PTR_LEN_S 44
360#define XCT_PTR_LEN(x) ((((long)(x)) << XCT_PTR_LEN_S) & \
361 XCT_PTR_LEN_M)
362#define XCT_PTR_ADDR_M 0x00000fffffffffffull
363#define XCT_PTR_ADDR_S 0
364#define XCT_PTR_ADDR(x) ((((long)(x)) << XCT_PTR_ADDR_S) & \
365 XCT_PTR_ADDR_M)
366
367/* Receive interface 8byte result fields */
368#define XCT_RXRES_8B_L4O_M 0xff00000000000000ull
369#define XCT_RXRES_8B_L4O_S 56
370#define XCT_RXRES_8B_RULE_M 0x00ffff0000000000ull
371#define XCT_RXRES_8B_RULE_S 40
372#define XCT_RXRES_8B_EVAL_M 0x000000ffff000000ull
373#define XCT_RXRES_8B_EVAL_S 24
374#define XCT_RXRES_8B_HTYPE_M 0x0000000000f00000ull
375#define XCT_RXRES_8B_HASH_M 0x00000000000fffffull
376#define XCT_RXRES_8B_HASH_S 0
377
378/* Receive interface buffer fields */
379#define XCT_RXB_LEN_M 0x0ffff00000000000ull
380#define XCT_RXB_LEN_S 44
381#define XCT_RXB_LEN(x) ((((long)(x)) << XCT_RXB_LEN_S) & \
382 XCT_RXB_LEN_M)
383#define XCT_RXB_ADDR_M 0x00000fffffffffffull
384#define XCT_RXB_ADDR_S 0
385#define XCT_RXB_ADDR(x) ((((long)(x)) << XCT_RXB_ADDR_S) & \
386 XCT_RXB_ADDR_M)
387
388/* Copy descriptor fields */
389#define XCT_COPY_T 0x8000000000000000ull
390#define XCT_COPY_ST 0x4000000000000000ull
391#define XCT_COPY_RR_M 0x3000000000000000ull
392#define XCT_COPY_RR_NORES 0x0000000000000000ull
393#define XCT_COPY_RR_8BRES 0x1000000000000000ull
394#define XCT_COPY_RR_24BRES 0x2000000000000000ull
395#define XCT_COPY_RR_40BRES 0x3000000000000000ull
396#define XCT_COPY_I 0x0800000000000000ull
397#define XCT_COPY_O 0x0400000000000000ull
398#define XCT_COPY_E 0x0200000000000000ull
399#define XCT_COPY_STY_ZERO 0x01c0000000000000ull
400#define XCT_COPY_DTY_PREF 0x0038000000000000ull
401#define XCT_COPY_LLEN_M 0x0007ffff00000000ull
402#define XCT_COPY_LLEN_S 32
403#define XCT_COPY_LLEN(x) ((((long)(x)) << XCT_COPY_LLEN_S) & \
404 XCT_COPY_LLEN_M)
405#define XCT_COPY_SE 0x0000000000000001ull
406
407/* Function descriptor fields */
408#define XCT_FUN_T 0x8000000000000000ull
409#define XCT_FUN_ST 0x4000000000000000ull
410#define XCT_FUN_RR_M 0x3000000000000000ull
411#define XCT_FUN_RR_NORES 0x0000000000000000ull
412#define XCT_FUN_RR_8BRES 0x1000000000000000ull
413#define XCT_FUN_RR_24BRES 0x2000000000000000ull
414#define XCT_FUN_RR_40BRES 0x3000000000000000ull
415#define XCT_FUN_I 0x0800000000000000ull
416#define XCT_FUN_O 0x0400000000000000ull
417#define XCT_FUN_E 0x0200000000000000ull
418#define XCT_FUN_FUN_M 0x01c0000000000000ull
419#define XCT_FUN_FUN_S 54
420#define XCT_FUN_FUN(x) ((((long)(x)) << XCT_FUN_FUN_S) & XCT_FUN_FUN_M)
421#define XCT_FUN_CRM_M 0x0038000000000000ull
422#define XCT_FUN_CRM_NOP 0x0000000000000000ull
423#define XCT_FUN_CRM_SIG 0x0008000000000000ull
424#define XCT_FUN_LLEN_M 0x0007ffff00000000ull
425#define XCT_FUN_LLEN_S 32
426#define XCT_FUN_LLEN(x) ((((long)(x)) << XCT_FUN_LLEN_S) & XCT_FUN_LLEN_M)
427#define XCT_FUN_SHL_M 0x00000000f8000000ull
428#define XCT_FUN_SHL_S 27
429#define XCT_FUN_SHL(x) ((((long)(x)) << XCT_FUN_SHL_S) & XCT_FUN_SHL_M)
430#define XCT_FUN_CHL_M 0x0000000007c00000ull
431#define XCT_FUN_HSZ_M 0x00000000003c0000ull
432#define XCT_FUN_ALG_M 0x0000000000038000ull
433#define XCT_FUN_HP 0x0000000000004000ull
434#define XCT_FUN_BCM_M 0x0000000000003800ull
435#define XCT_FUN_BCP_M 0x0000000000000600ull
436#define XCT_FUN_SIG_M 0x00000000000001f0ull
437#define XCT_FUN_SIG_TCP4 0x0000000000000140ull
438#define XCT_FUN_SIG_TCP6 0x0000000000000150ull
439#define XCT_FUN_SIG_UDP4 0x0000000000000160ull
440#define XCT_FUN_SIG_UDP6 0x0000000000000170ull
441#define XCT_FUN_A 0x0000000000000008ull
442#define XCT_FUN_C 0x0000000000000004ull
443#define XCT_FUN_AL2 0x0000000000000002ull
444#define XCT_FUN_SE 0x0000000000000001ull
445
446/* Function descriptor 8byte result fields */
447#define XCT_FUNRES_8B_CS_M 0x0000ffff00000000ull
448#define XCT_FUNRES_8B_CS_S 32
449#define XCT_FUNRES_8B_CRC_M 0x00000000ffffffffull
450#define XCT_FUNRES_8B_CRC_S 0
451
452/* Control descriptor fields */
453#define CTRL_CMD_T 0x8000000000000000ull
454#define CTRL_CMD_META_EVT 0x2000000000000000ull
455#define CTRL_CMD_O 0x0400000000000000ull
456#define CTRL_CMD_ETYPE_M 0x0038000000000000ull
457#define CTRL_CMD_ETYPE_EXT 0x0000000000000000ull
458#define CTRL_CMD_ETYPE_WSET 0x0020000000000000ull
459#define CTRL_CMD_ETYPE_WCLR 0x0028000000000000ull
460#define CTRL_CMD_ETYPE_SET 0x0030000000000000ull
461#define CTRL_CMD_ETYPE_CLR 0x0038000000000000ull
462#define CTRL_CMD_REG_M 0x000000000000007full
463#define CTRL_CMD_REG_S 0
464#define CTRL_CMD_REG(x) ((((long)(x)) << CTRL_CMD_REG_S) & \
465 CTRL_CMD_REG_M)
466
467
468
469/* Prototypes for the shared DMA functions in the platform code. */
470
471/* DMA TX Channel type. Right now only limitations used are event types 0/1,
472 * for event-triggered DMA transactions.
473 */
474
475enum pasemi_dmachan_type {
476 RXCHAN = 0, /* Any RX chan */
477 TXCHAN = 1, /* Any TX chan */
478 TXCHAN_EVT0 = 0x1001, /* TX chan in event class 0 (chan 0-9) */
479 TXCHAN_EVT1 = 0x2001, /* TX chan in event class 1 (chan 10-19) */
480};
481
482struct pasemi_dmachan {
483 int chno; /* Channel number */
484 enum pasemi_dmachan_type chan_type; /* TX / RX */
485 u64 *status; /* Ptr to cacheable status */
486 int irq; /* IRQ used by channel */
487 unsigned int ring_size; /* size of allocated ring */
488 dma_addr_t ring_dma; /* DMA address for ring */
489 u64 *ring_virt; /* Virt address for ring */
490 void *priv; /* Ptr to start of client struct */
491};
492
493/* Read/write the different registers in the I/O Bridge, Ethernet
494 * and DMA Controller
495 */
496extern unsigned int pasemi_read_iob_reg(unsigned int reg);
497extern void pasemi_write_iob_reg(unsigned int reg, unsigned int val);
498
499extern unsigned int pasemi_read_mac_reg(int intf, unsigned int reg);
500extern void pasemi_write_mac_reg(int intf, unsigned int reg, unsigned int val);
501
502extern unsigned int pasemi_read_dma_reg(unsigned int reg);
503extern void pasemi_write_dma_reg(unsigned int reg, unsigned int val);
504
505/* Channel management routines */
506
507extern void *pasemi_dma_alloc_chan(enum pasemi_dmachan_type type,
508 int total_size, int offset);
509extern void pasemi_dma_free_chan(struct pasemi_dmachan *chan);
510
511extern void pasemi_dma_start_chan(const struct pasemi_dmachan *chan,
512 const u32 cmdsta);
513extern int pasemi_dma_stop_chan(const struct pasemi_dmachan *chan);
514
515/* Common routines to allocate rings and buffers */
516
517extern int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size);
518extern void pasemi_dma_free_ring(struct pasemi_dmachan *chan);
519
520extern void *pasemi_dma_alloc_buf(struct pasemi_dmachan *chan, int size,
521 dma_addr_t *handle);
522extern void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size,
523 dma_addr_t *handle);
524
525/* Routines to allocate flags (events) for channel syncronization */
526extern int pasemi_dma_alloc_flag(void);
527extern void pasemi_dma_free_flag(int flag);
528extern void pasemi_dma_set_flag(int flag);
529extern void pasemi_dma_clear_flag(int flag);
530
531/* Routines to allocate function engines */
532extern int pasemi_dma_alloc_fun(void);
533extern void pasemi_dma_free_fun(int fun);
534
535/* Initialize the library, must be called before any other functions */
536extern int pasemi_dma_init(void);
537
538#endif /* ASM_PASEMI_DMA_H */
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
new file mode 100644
index 000000000000..ae2ea803a0f2
--- /dev/null
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -0,0 +1,302 @@
1#ifndef _ASM_POWERPC_PCI_BRIDGE_H
2#define _ASM_POWERPC_PCI_BRIDGE_H
3#ifdef __KERNEL__
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#include <linux/pci.h>
11#include <linux/list.h>
12#include <linux/ioport.h>
13
14struct device_node;
15
16extern unsigned int ppc_pci_flags;
17enum {
18 /* Force re-assigning all resources (ignore firmware
19 * setup completely)
20 */
21 PPC_PCI_REASSIGN_ALL_RSRC = 0x00000001,
22
23 /* Re-assign all bus numbers */
24 PPC_PCI_REASSIGN_ALL_BUS = 0x00000002,
25
26 /* Do not try to assign, just use existing setup */
27 PPC_PCI_PROBE_ONLY = 0x00000004,
28
29 /* Don't bother with ISA alignment unless the bridge has
30 * ISA forwarding enabled
31 */
32 PPC_PCI_CAN_SKIP_ISA_ALIGN = 0x00000008,
33
34 /* Enable domain numbers in /proc */
35 PPC_PCI_ENABLE_PROC_DOMAINS = 0x00000010,
36 /* ... except for domain 0 */
37 PPC_PCI_COMPAT_DOMAIN_0 = 0x00000020,
38};
39
40
41/*
42 * Structure of a PCI controller (host bridge)
43 */
44struct pci_controller {
45 struct pci_bus *bus;
46 char is_dynamic;
47#ifdef CONFIG_PPC64
48 int node;
49#endif
50 struct device_node *dn;
51 struct list_head list_node;
52 struct device *parent;
53
54 int first_busno;
55 int last_busno;
56#ifndef CONFIG_PPC64
57 int self_busno;
58#endif
59
60 void __iomem *io_base_virt;
61#ifdef CONFIG_PPC64
62 void *io_base_alloc;
63#endif
64 resource_size_t io_base_phys;
65#ifndef CONFIG_PPC64
66 resource_size_t pci_io_size;
67#endif
68
69 /* Some machines (PReP) have a non 1:1 mapping of
70 * the PCI memory space in the CPU bus space
71 */
72 resource_size_t pci_mem_offset;
73#ifdef CONFIG_PPC64
74 unsigned long pci_io_size;
75#endif
76
77 struct pci_ops *ops;
78 unsigned int __iomem *cfg_addr;
79 void __iomem *cfg_data;
80
81#ifndef CONFIG_PPC64
82 /*
83 * Used for variants of PCI indirect handling and possible quirks:
84 * SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1
85 * EXT_REG - provides access to PCI-e extended registers
86 * SURPRESS_PRIMARY_BUS - we surpress the setting of PCI_PRIMARY_BUS
87 * on Freescale PCI-e controllers since they used the PCI_PRIMARY_BUS
88 * to determine which bus number to match on when generating type0
89 * config cycles
90 * NO_PCIE_LINK - the Freescale PCI-e controllers have issues with
91 * hanging if we don't have link and try to do config cycles to
92 * anything but the PHB. Only allow talking to the PHB if this is
93 * set.
94 * BIG_ENDIAN - cfg_addr is a big endian register
95 * BROKEN_MRM - the 440EPx/GRx chips have an errata that causes hangs on
96 * the PLB4. Effectively disable MRM commands by setting this.
97 */
98#define PPC_INDIRECT_TYPE_SET_CFG_TYPE 0x00000001
99#define PPC_INDIRECT_TYPE_EXT_REG 0x00000002
100#define PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS 0x00000004
101#define PPC_INDIRECT_TYPE_NO_PCIE_LINK 0x00000008
102#define PPC_INDIRECT_TYPE_BIG_ENDIAN 0x00000010
103#define PPC_INDIRECT_TYPE_BROKEN_MRM 0x00000020
104 u32 indirect_type;
105#endif /* !CONFIG_PPC64 */
106 /* Currently, we limit ourselves to 1 IO range and 3 mem
107 * ranges since the common pci_bus structure can't handle more
108 */
109 struct resource io_resource;
110 struct resource mem_resources[3];
111 int global_number; /* PCI domain number */
112#ifdef CONFIG_PPC64
113 unsigned long buid;
114 unsigned long dma_window_base_cur;
115 unsigned long dma_window_size;
116
117 void *private_data;
118#endif /* CONFIG_PPC64 */
119};
120
121#ifndef CONFIG_PPC64
122
123static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
124{
125 return bus->sysdata;
126}
127
128static inline int isa_vaddr_is_ioport(void __iomem *address)
129{
130 /* No specific ISA handling on ppc32 at this stage, it
131 * all goes through PCI
132 */
133 return 0;
134}
135
136/* These are used for config access before all the PCI probing
137 has been done. */
138extern int early_read_config_byte(struct pci_controller *hose, int bus,
139 int dev_fn, int where, u8 *val);
140extern int early_read_config_word(struct pci_controller *hose, int bus,
141 int dev_fn, int where, u16 *val);
142extern int early_read_config_dword(struct pci_controller *hose, int bus,
143 int dev_fn, int where, u32 *val);
144extern int early_write_config_byte(struct pci_controller *hose, int bus,
145 int dev_fn, int where, u8 val);
146extern int early_write_config_word(struct pci_controller *hose, int bus,
147 int dev_fn, int where, u16 val);
148extern int early_write_config_dword(struct pci_controller *hose, int bus,
149 int dev_fn, int where, u32 val);
150
151extern int early_find_capability(struct pci_controller *hose, int bus,
152 int dev_fn, int cap);
153
154extern void setup_indirect_pci(struct pci_controller* hose,
155 resource_size_t cfg_addr,
156 resource_size_t cfg_data, u32 flags);
157extern void setup_grackle(struct pci_controller *hose);
158#else /* CONFIG_PPC64 */
159
160/*
161 * PCI stuff, for nodes representing PCI devices, pointed to
162 * by device_node->data.
163 */
164struct iommu_table;
165
166struct pci_dn {
167 int busno; /* pci bus number */
168 int devfn; /* pci device and function number */
169
170 struct pci_controller *phb; /* for pci devices */
171 struct iommu_table *iommu_table; /* for phb's or bridges */
172 struct device_node *node; /* back-pointer to the device_node */
173
174 int pci_ext_config_space; /* for pci devices */
175
176#ifdef CONFIG_EEH
177 struct pci_dev *pcidev; /* back-pointer to the pci device */
178 int class_code; /* pci device class */
179 int eeh_mode; /* See eeh.h for possible EEH_MODEs */
180 int eeh_config_addr;
181 int eeh_pe_config_addr; /* new-style partition endpoint address */
182 int eeh_check_count; /* # times driver ignored error */
183 int eeh_freeze_count; /* # times this device froze up. */
184 int eeh_false_positives; /* # times this device reported #ff's */
185 u32 config_space[16]; /* saved PCI config space */
186#endif
187};
188
189/* Get the pointer to a device_node's pci_dn */
190#define PCI_DN(dn) ((struct pci_dn *) (dn)->data)
191
192extern struct device_node *fetch_dev_dn(struct pci_dev *dev);
193
194/* Get a device_node from a pci_dev. This code must be fast except
195 * in the case where the sysdata is incorrect and needs to be fixed
196 * up (this will only happen once).
197 * In this case the sysdata will have been inherited from a PCI host
198 * bridge or a PCI-PCI bridge further up the tree, so it will point
199 * to a valid struct pci_dn, just not the one we want.
200 */
201static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
202{
203 struct device_node *dn = dev->sysdata;
204 struct pci_dn *pdn = dn->data;
205
206 if (pdn && pdn->devfn == dev->devfn && pdn->busno == dev->bus->number)
207 return dn; /* fast path. sysdata is good */
208 return fetch_dev_dn(dev);
209}
210
211static inline int pci_device_from_OF_node(struct device_node *np,
212 u8 *bus, u8 *devfn)
213{
214 if (!PCI_DN(np))
215 return -ENODEV;
216 *bus = PCI_DN(np)->busno;
217 *devfn = PCI_DN(np)->devfn;
218 return 0;
219}
220
221static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
222{
223 if (bus->self)
224 return pci_device_to_OF_node(bus->self);
225 else
226 return bus->sysdata; /* Must be root bus (PHB) */
227}
228
229/** Find the bus corresponding to the indicated device node */
230extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn);
231
232/** Remove all of the PCI devices under this bus */
233extern void pcibios_remove_pci_devices(struct pci_bus *bus);
234
235/** Discover new pci devices under this bus, and add them */
236extern void pcibios_add_pci_devices(struct pci_bus *bus);
237extern void pcibios_fixup_new_pci_devices(struct pci_bus *bus);
238
239extern int pcibios_remove_root_bus(struct pci_controller *phb);
240
241static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
242{
243 struct device_node *busdn = bus->sysdata;
244
245 BUG_ON(busdn == NULL);
246 return PCI_DN(busdn)->phb;
247}
248
249
250extern void isa_bridge_find_early(struct pci_controller *hose);
251
252static inline int isa_vaddr_is_ioport(void __iomem *address)
253{
254 /* Check if address hits the reserved legacy IO range */
255 unsigned long ea = (unsigned long)address;
256 return ea >= ISA_IO_BASE && ea < ISA_IO_END;
257}
258
259extern int pcibios_unmap_io_space(struct pci_bus *bus);
260extern int pcibios_map_io_space(struct pci_bus *bus);
261
262/* Return values for ppc_md.pci_probe_mode function */
263#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
264#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
265#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
266
267#ifdef CONFIG_NUMA
268#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE))
269#else
270#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1)
271#endif
272
273#endif /* CONFIG_PPC64 */
274
275/* Get the PCI host controller for an OF device */
276extern struct pci_controller *pci_find_hose_for_OF_device(
277 struct device_node* node);
278
279/* Fill up host controller resources from the OF node */
280extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
281 struct device_node *dev, int primary);
282
283/* Allocate & free a PCI host bridge structure */
284extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev);
285extern void pcibios_free_controller(struct pci_controller *phb);
286
287#ifdef CONFIG_PCI
288extern unsigned long pci_address_to_pio(phys_addr_t address);
289extern int pcibios_vaddr_is_ioport(void __iomem *address);
290#else
291static inline unsigned long pci_address_to_pio(phys_addr_t address)
292{
293 return (unsigned long)-1;
294}
295static inline int pcibios_vaddr_is_ioport(void __iomem *address)
296{
297 return 0;
298}
299#endif /* CONFIG_PCI */
300
301#endif /* __KERNEL__ */
302#endif /* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
new file mode 100644
index 000000000000..a05a942b1c25
--- /dev/null
+++ b/arch/powerpc/include/asm/pci.h
@@ -0,0 +1,228 @@
1#ifndef __ASM_POWERPC_PCI_H
2#define __ASM_POWERPC_PCI_H
3#ifdef __KERNEL__
4
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/types.h>
13#include <linux/slab.h>
14#include <linux/string.h>
15#include <linux/dma-mapping.h>
16
17#include <asm/machdep.h>
18#include <asm/scatterlist.h>
19#include <asm/io.h>
20#include <asm/prom.h>
21#include <asm/pci-bridge.h>
22
23#include <asm-generic/pci-dma-compat.h>
24
25#define PCIBIOS_MIN_IO 0x1000
26#define PCIBIOS_MIN_MEM 0x10000000
27
28struct pci_dev;
29
30/* Values for the `which' argument to sys_pciconfig_iobase syscall. */
31#define IOBASE_BRIDGE_NUMBER 0
32#define IOBASE_MEMORY 1
33#define IOBASE_IO 2
34#define IOBASE_ISA_IO 3
35#define IOBASE_ISA_MEM 4
36
37/*
38 * Set this to 1 if you want the kernel to re-assign all PCI
39 * bus numbers (don't do that on ppc64 yet !)
40 */
41#define pcibios_assign_all_busses() (ppc_pci_flags & \
42 PPC_PCI_REASSIGN_ALL_BUS)
43#define pcibios_scan_all_fns(a, b) 0
44
45static inline void pcibios_set_master(struct pci_dev *dev)
46{
47 /* No special bus mastering setup handling */
48}
49
50static inline void pcibios_penalize_isa_irq(int irq, int active)
51{
52 /* We don't do dynamic PCI IRQ allocation */
53}
54
55#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
56static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
57{
58 if (ppc_md.pci_get_legacy_ide_irq)
59 return ppc_md.pci_get_legacy_ide_irq(dev, channel);
60 return channel ? 15 : 14;
61}
62
63#ifdef CONFIG_PPC64
64
65/*
66 * We want to avoid touching the cacheline size or MWI bit.
67 * pSeries firmware sets the cacheline size (which is not the cpu cacheline
68 * size in all cases) and hardware treats MWI the same as memory write.
69 */
70#define PCI_DISABLE_MWI
71
72#ifdef CONFIG_PCI
73extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
74extern struct dma_mapping_ops *get_pci_dma_ops(void);
75
76static inline void pci_dma_burst_advice(struct pci_dev *pdev,
77 enum pci_dma_burst_strategy *strat,
78 unsigned long *strategy_parameter)
79{
80 unsigned long cacheline_size;
81 u8 byte;
82
83 pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
84 if (byte == 0)
85 cacheline_size = 1024;
86 else
87 cacheline_size = (int) byte * 4;
88
89 *strat = PCI_DMA_BURST_MULTIPLE;
90 *strategy_parameter = cacheline_size;
91}
92#else /* CONFIG_PCI */
93#define set_pci_dma_ops(d)
94#define get_pci_dma_ops() NULL
95#endif
96
97#else /* 32-bit */
98
99#ifdef CONFIG_PCI
100static inline void pci_dma_burst_advice(struct pci_dev *pdev,
101 enum pci_dma_burst_strategy *strat,
102 unsigned long *strategy_parameter)
103{
104 *strat = PCI_DMA_BURST_INFINITY;
105 *strategy_parameter = ~0UL;
106}
107#endif
108#endif /* CONFIG_PPC64 */
109
110extern int pci_domain_nr(struct pci_bus *bus);
111
112/* Decide whether to display the domain number in /proc */
113extern int pci_proc_domain(struct pci_bus *bus);
114
115
116struct vm_area_struct;
117/* Map a range of PCI memory or I/O space for a device into user space */
118int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
119 enum pci_mmap_state mmap_state, int write_combine);
120
121/* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */
122#define HAVE_PCI_MMAP 1
123
124#if defined(CONFIG_PPC64) || defined(CONFIG_NOT_COHERENT_CACHE)
125/*
126 * For 64-bit kernels, pci_unmap_{single,page} is not a nop.
127 * For 32-bit non-coherent kernels, pci_dma_sync_single_for_cpu() and
128 * so on are not nops.
129 * and thus...
130 */
131#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
132 dma_addr_t ADDR_NAME;
133#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
134 __u32 LEN_NAME;
135#define pci_unmap_addr(PTR, ADDR_NAME) \
136 ((PTR)->ADDR_NAME)
137#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
138 (((PTR)->ADDR_NAME) = (VAL))
139#define pci_unmap_len(PTR, LEN_NAME) \
140 ((PTR)->LEN_NAME)
141#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
142 (((PTR)->LEN_NAME) = (VAL))
143
144#else /* 32-bit && coherent */
145
146/* pci_unmap_{page,single} is a nop so... */
147#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
148#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
149#define pci_unmap_addr(PTR, ADDR_NAME) (0)
150#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
151#define pci_unmap_len(PTR, LEN_NAME) (0)
152#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
153
154#endif /* CONFIG_PPC64 || CONFIG_NOT_COHERENT_CACHE */
155
156#ifdef CONFIG_PPC64
157
158/* The PCI address space does not equal the physical memory address
159 * space (we have an IOMMU). The IDE and SCSI device layers use
160 * this boolean for bounce buffer decisions.
161 */
162#define PCI_DMA_BUS_IS_PHYS (0)
163
164#else /* 32-bit */
165
166/* The PCI address space does equal the physical memory
167 * address space (no IOMMU). The IDE and SCSI device layers use
168 * this boolean for bounce buffer decisions.
169 */
170#define PCI_DMA_BUS_IS_PHYS (1)
171
172#endif /* CONFIG_PPC64 */
173
174extern void pcibios_resource_to_bus(struct pci_dev *dev,
175 struct pci_bus_region *region,
176 struct resource *res);
177
178extern void pcibios_bus_to_resource(struct pci_dev *dev,
179 struct resource *res,
180 struct pci_bus_region *region);
181
182static inline struct resource *pcibios_select_root(struct pci_dev *pdev,
183 struct resource *res)
184{
185 struct resource *root = NULL;
186
187 if (res->flags & IORESOURCE_IO)
188 root = &ioport_resource;
189 if (res->flags & IORESOURCE_MEM)
190 root = &iomem_resource;
191
192 return root;
193}
194
195extern void pcibios_setup_new_device(struct pci_dev *dev);
196
197extern void pcibios_claim_one_bus(struct pci_bus *b);
198
199extern void pcibios_resource_survey(void);
200
201extern struct pci_controller *init_phb_dynamic(struct device_node *dn);
202
203extern struct pci_dev *of_create_pci_dev(struct device_node *node,
204 struct pci_bus *bus, int devfn);
205
206extern void of_scan_pci_bridge(struct device_node *node,
207 struct pci_dev *dev);
208
209extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
210
211extern int pci_read_irq_line(struct pci_dev *dev);
212
213struct file;
214extern pgprot_t pci_phys_mem_access_prot(struct file *file,
215 unsigned long pfn,
216 unsigned long size,
217 pgprot_t prot);
218
219#define HAVE_ARCH_PCI_RESOURCE_TO_USER
220extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
221 const struct resource *rsrc,
222 resource_size_t *start, resource_size_t *end);
223
224extern void pcibios_do_bus_setup(struct pci_bus *bus);
225extern void pcibios_fixup_of_probed_bus(struct pci_bus *bus);
226
227#endif /* __KERNEL__ */
228#endif /* __ASM_POWERPC_PCI_H */
diff --git a/arch/powerpc/include/asm/percpu.h b/arch/powerpc/include/asm/percpu.h
new file mode 100644
index 000000000000..f879252b7ea6
--- /dev/null
+++ b/arch/powerpc/include/asm/percpu.h
@@ -0,0 +1,24 @@
1#ifndef _ASM_POWERPC_PERCPU_H_
2#define _ASM_POWERPC_PERCPU_H_
3#ifdef __powerpc64__
4#include <linux/compiler.h>
5
6/*
7 * Same as asm-generic/percpu.h, except that we store the per cpu offset
8 * in the paca. Based on the x86-64 implementation.
9 */
10
11#ifdef CONFIG_SMP
12
13#include <asm/paca.h>
14
15#define __per_cpu_offset(cpu) (paca[cpu].data_offset)
16#define __my_cpu_offset local_paca->data_offset
17#define per_cpu_offset(x) (__per_cpu_offset(x))
18
19#endif /* CONFIG_SMP */
20#endif /* __powerpc64__ */
21
22#include <asm-generic/percpu.h>
23
24#endif /* _ASM_POWERPC_PERCPU_H_ */
diff --git a/arch/powerpc/include/asm/pgalloc-32.h b/arch/powerpc/include/asm/pgalloc-32.h
new file mode 100644
index 000000000000..58c07147b3ea
--- /dev/null
+++ b/arch/powerpc/include/asm/pgalloc-32.h
@@ -0,0 +1,43 @@
1#ifndef _ASM_POWERPC_PGALLOC_32_H
2#define _ASM_POWERPC_PGALLOC_32_H
3
4#include <linux/threads.h>
5
6extern void __bad_pte(pmd_t *pmd);
7
8extern pgd_t *pgd_alloc(struct mm_struct *mm);
9extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
10
11/*
12 * We don't have any real pmd's, and this code never triggers because
13 * the pgd will always be present..
14 */
15/* #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) */
16#define pmd_free(mm, x) do { } while (0)
17#define __pmd_free_tlb(tlb,x) do { } while (0)
18/* #define pgd_populate(mm, pmd, pte) BUG() */
19
20#ifndef CONFIG_BOOKE
21#define pmd_populate_kernel(mm, pmd, pte) \
22 (pmd_val(*(pmd)) = __pa(pte) | _PMD_PRESENT)
23#define pmd_populate(mm, pmd, pte) \
24 (pmd_val(*(pmd)) = (page_to_pfn(pte) << PAGE_SHIFT) | _PMD_PRESENT)
25#define pmd_pgtable(pmd) pmd_page(pmd)
26#else
27#define pmd_populate_kernel(mm, pmd, pte) \
28 (pmd_val(*(pmd)) = (unsigned long)pte | _PMD_PRESENT)
29#define pmd_populate(mm, pmd, pte) \
30 (pmd_val(*(pmd)) = (unsigned long)lowmem_page_address(pte) | _PMD_PRESENT)
31#define pmd_pgtable(pmd) pmd_page(pmd)
32#endif
33
34extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
35extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr);
36extern void pte_free_kernel(struct mm_struct *mm, pte_t *pte);
37extern void pte_free(struct mm_struct *mm, pgtable_t pte);
38
39#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, (pte))
40
41#define check_pgt_cache() do { } while (0)
42
43#endif /* _ASM_POWERPC_PGALLOC_32_H */
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
new file mode 100644
index 000000000000..812a1d8f35cb
--- /dev/null
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -0,0 +1,166 @@
1#ifndef _ASM_POWERPC_PGALLOC_64_H
2#define _ASM_POWERPC_PGALLOC_64_H
3/*
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#include <linux/mm.h>
11#include <linux/slab.h>
12#include <linux/cpumask.h>
13#include <linux/percpu.h>
14
15#ifndef CONFIG_PPC_SUBPAGE_PROT
16static inline void subpage_prot_free(pgd_t *pgd) {}
17#endif
18
19extern struct kmem_cache *pgtable_cache[];
20
21#define PGD_CACHE_NUM 0
22#define PUD_CACHE_NUM 1
23#define PMD_CACHE_NUM 1
24#define HUGEPTE_CACHE_NUM 2
25#define PTE_NONCACHE_NUM 7 /* from GFP rather than kmem_cache */
26
27static inline pgd_t *pgd_alloc(struct mm_struct *mm)
28{
29 return kmem_cache_alloc(pgtable_cache[PGD_CACHE_NUM], GFP_KERNEL);
30}
31
32static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
33{
34 subpage_prot_free(pgd);
35 kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd);
36}
37
38#ifndef CONFIG_PPC_64K_PAGES
39
40#define pgd_populate(MM, PGD, PUD) pgd_set(PGD, PUD)
41
42static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
43{
44 return kmem_cache_alloc(pgtable_cache[PUD_CACHE_NUM],
45 GFP_KERNEL|__GFP_REPEAT);
46}
47
48static inline void pud_free(struct mm_struct *mm, pud_t *pud)
49{
50 kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud);
51}
52
53static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
54{
55 pud_set(pud, (unsigned long)pmd);
56}
57
58#define pmd_populate(mm, pmd, pte_page) \
59 pmd_populate_kernel(mm, pmd, page_address(pte_page))
60#define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, (unsigned long)(pte))
61#define pmd_pgtable(pmd) pmd_page(pmd)
62
63
64#else /* CONFIG_PPC_64K_PAGES */
65
66#define pud_populate(mm, pud, pmd) pud_set(pud, (unsigned long)pmd)
67
68static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
69 pte_t *pte)
70{
71 pmd_set(pmd, (unsigned long)pte);
72}
73
74#define pmd_populate(mm, pmd, pte_page) \
75 pmd_populate_kernel(mm, pmd, page_address(pte_page))
76#define pmd_pgtable(pmd) pmd_page(pmd)
77
78#endif /* CONFIG_PPC_64K_PAGES */
79
80static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
81{
82 return kmem_cache_alloc(pgtable_cache[PMD_CACHE_NUM],
83 GFP_KERNEL|__GFP_REPEAT);
84}
85
86static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
87{
88 kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd);
89}
90
91static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
92 unsigned long address)
93{
94 return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
95}
96
97static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
98 unsigned long address)
99{
100 struct page *page;
101 pte_t *pte;
102
103 pte = pte_alloc_one_kernel(mm, address);
104 if (!pte)
105 return NULL;
106 page = virt_to_page(pte);
107 pgtable_page_ctor(page);
108 return page;
109}
110
111static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
112{
113 free_page((unsigned long)pte);
114}
115
116static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
117{
118 pgtable_page_dtor(ptepage);
119 __free_page(ptepage);
120}
121
122#define PGF_CACHENUM_MASK 0x7
123
124typedef struct pgtable_free {
125 unsigned long val;
126} pgtable_free_t;
127
128static inline pgtable_free_t pgtable_free_cache(void *p, int cachenum,
129 unsigned long mask)
130{
131 BUG_ON(cachenum > PGF_CACHENUM_MASK);
132
133 return (pgtable_free_t){.val = ((unsigned long) p & ~mask) | cachenum};
134}
135
136static inline void pgtable_free(pgtable_free_t pgf)
137{
138 void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK);
139 int cachenum = pgf.val & PGF_CACHENUM_MASK;
140
141 if (cachenum == PTE_NONCACHE_NUM)
142 free_page((unsigned long)p);
143 else
144 kmem_cache_free(pgtable_cache[cachenum], p);
145}
146
147extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf);
148
149#define __pte_free_tlb(tlb,ptepage) \
150do { \
151 pgtable_page_dtor(ptepage); \
152 pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \
153 PTE_NONCACHE_NUM, PTE_TABLE_SIZE-1)); \
154} while (0)
155#define __pmd_free_tlb(tlb, pmd) \
156 pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \
157 PMD_CACHE_NUM, PMD_TABLE_SIZE-1))
158#ifndef CONFIG_PPC_64K_PAGES
159#define __pud_free_tlb(tlb, pud) \
160 pgtable_free_tlb(tlb, pgtable_free_cache(pud, \
161 PUD_CACHE_NUM, PUD_TABLE_SIZE-1))
162#endif /* CONFIG_PPC_64K_PAGES */
163
164#define check_pgt_cache() do { } while (0)
165
166#endif /* _ASM_POWERPC_PGALLOC_64_H */
diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h
new file mode 100644
index 000000000000..b4505ed0f0f2
--- /dev/null
+++ b/arch/powerpc/include/asm/pgalloc.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_POWERPC_PGALLOC_H
2#define _ASM_POWERPC_PGALLOC_H
3#ifdef __KERNEL__
4
5#ifdef CONFIG_PPC64
6#include <asm/pgalloc-64.h>
7#else
8#include <asm/pgalloc-32.h>
9#endif
10
11#endif /* __KERNEL__ */
12#endif /* _ASM_POWERPC_PGALLOC_H */
diff --git a/arch/powerpc/include/asm/pgtable-4k.h b/arch/powerpc/include/asm/pgtable-4k.h
new file mode 100644
index 000000000000..6b18ba9d2d85
--- /dev/null
+++ b/arch/powerpc/include/asm/pgtable-4k.h
@@ -0,0 +1,117 @@
1#ifndef _ASM_POWERPC_PGTABLE_4K_H
2#define _ASM_POWERPC_PGTABLE_4K_H
3/*
4 * Entries per page directory level. The PTE level must use a 64b record
5 * for each page table entry. The PMD and PGD level use a 32b record for
6 * each entry by assuming that each entry is page aligned.
7 */
8#define PTE_INDEX_SIZE 9
9#define PMD_INDEX_SIZE 7
10#define PUD_INDEX_SIZE 7
11#define PGD_INDEX_SIZE 9
12
13#ifndef __ASSEMBLY__
14#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE)
15#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE)
16#define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE)
17#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE)
18#endif /* __ASSEMBLY__ */
19
20#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
21#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
22#define PTRS_PER_PUD (1 << PMD_INDEX_SIZE)
23#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
24
25/* PMD_SHIFT determines what a second-level page table entry can map */
26#define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE)
27#define PMD_SIZE (1UL << PMD_SHIFT)
28#define PMD_MASK (~(PMD_SIZE-1))
29
30/* With 4k base page size, hugepage PTEs go at the PMD level */
31#define MIN_HUGEPTE_SHIFT PMD_SHIFT
32
33/* PUD_SHIFT determines what a third-level page table entry can map */
34#define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE)
35#define PUD_SIZE (1UL << PUD_SHIFT)
36#define PUD_MASK (~(PUD_SIZE-1))
37
38/* PGDIR_SHIFT determines what a fourth-level page table entry can map */
39#define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE)
40#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
41#define PGDIR_MASK (~(PGDIR_SIZE-1))
42
43/* PTE bits */
44#define _PAGE_HASHPTE 0x0400 /* software: pte has an associated HPTE */
45#define _PAGE_SECONDARY 0x8000 /* software: HPTE is in secondary group */
46#define _PAGE_GROUP_IX 0x7000 /* software: HPTE index within group */
47#define _PAGE_F_SECOND _PAGE_SECONDARY
48#define _PAGE_F_GIX _PAGE_GROUP_IX
49#define _PAGE_SPECIAL 0x10000 /* software: special page */
50#define __HAVE_ARCH_PTE_SPECIAL
51
52/* PTE flags to conserve for HPTE identification */
53#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | \
54 _PAGE_SECONDARY | _PAGE_GROUP_IX)
55
56/* There is no 4K PFN hack on 4K pages */
57#define _PAGE_4K_PFN 0
58
59/* PAGE_MASK gives the right answer below, but only by accident */
60/* It should be preserving the high 48 bits and then specifically */
61/* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */
62#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \
63 _PAGE_HPTEFLAGS)
64
65/* Bits to mask out from a PMD to get to the PTE page */
66#define PMD_MASKED_BITS 0
67/* Bits to mask out from a PUD to get to the PMD page */
68#define PUD_MASKED_BITS 0
69/* Bits to mask out from a PGD to get to the PUD page */
70#define PGD_MASKED_BITS 0
71
72/* shift to put page number into pte */
73#define PTE_RPN_SHIFT (17)
74
75#ifdef STRICT_MM_TYPECHECKS
76#define __real_pte(e,p) ((real_pte_t){(e)})
77#define __rpte_to_pte(r) ((r).pte)
78#else
79#define __real_pte(e,p) (e)
80#define __rpte_to_pte(r) (__pte(r))
81#endif
82#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> 12)
83
84#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
85 do { \
86 index = 0; \
87 shift = mmu_psize_defs[psize].shift; \
88
89#define pte_iterate_hashed_end() } while(0)
90
91#ifdef CONFIG_PPC_HAS_HASH_64K
92#define pte_pagesize_index(mm, addr, pte) get_slice_psize(mm, addr)
93#else
94#define pte_pagesize_index(mm, addr, pte) MMU_PAGE_4K
95#endif
96
97/*
98 * 4-level page tables related bits
99 */
100
101#define pgd_none(pgd) (!pgd_val(pgd))
102#define pgd_bad(pgd) (pgd_val(pgd) == 0)
103#define pgd_present(pgd) (pgd_val(pgd) != 0)
104#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0)
105#define pgd_page_vaddr(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS)
106#define pgd_page(pgd) virt_to_page(pgd_page_vaddr(pgd))
107
108#define pud_offset(pgdp, addr) \
109 (((pud_t *) pgd_page_vaddr(*(pgdp))) + \
110 (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)))
111
112#define pud_ERROR(e) \
113 printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e))
114
115#define remap_4k_pfn(vma, addr, pfn, prot) \
116 remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, (prot))
117#endif /* _ASM_POWERPC_PGTABLE_4K_H */
diff --git a/arch/powerpc/include/asm/pgtable-64k.h b/arch/powerpc/include/asm/pgtable-64k.h
new file mode 100644
index 000000000000..07b0d8f09cb6
--- /dev/null
+++ b/arch/powerpc/include/asm/pgtable-64k.h
@@ -0,0 +1,155 @@
1#ifndef _ASM_POWERPC_PGTABLE_64K_H
2#define _ASM_POWERPC_PGTABLE_64K_H
3
4#include <asm-generic/pgtable-nopud.h>
5
6
7#define PTE_INDEX_SIZE 12
8#define PMD_INDEX_SIZE 12
9#define PUD_INDEX_SIZE 0
10#define PGD_INDEX_SIZE 4
11
12#ifndef __ASSEMBLY__
13#define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE)
14#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE)
15#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE)
16
17#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
18#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
19#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
20
21#ifdef CONFIG_PPC_SUBPAGE_PROT
22/*
23 * For the sub-page protection option, we extend the PGD with one of
24 * these. Basically we have a 3-level tree, with the top level being
25 * the protptrs array. To optimize speed and memory consumption when
26 * only addresses < 4GB are being protected, pointers to the first
27 * four pages of sub-page protection words are stored in the low_prot
28 * array.
29 * Each page of sub-page protection words protects 1GB (4 bytes
30 * protects 64k). For the 3-level tree, each page of pointers then
31 * protects 8TB.
32 */
33struct subpage_prot_table {
34 unsigned long maxaddr; /* only addresses < this are protected */
35 unsigned int **protptrs[2];
36 unsigned int *low_prot[4];
37};
38
39#undef PGD_TABLE_SIZE
40#define PGD_TABLE_SIZE ((sizeof(pgd_t) << PGD_INDEX_SIZE) + \
41 sizeof(struct subpage_prot_table))
42
43#define SBP_L1_BITS (PAGE_SHIFT - 2)
44#define SBP_L2_BITS (PAGE_SHIFT - 3)
45#define SBP_L1_COUNT (1 << SBP_L1_BITS)
46#define SBP_L2_COUNT (1 << SBP_L2_BITS)
47#define SBP_L2_SHIFT (PAGE_SHIFT + SBP_L1_BITS)
48#define SBP_L3_SHIFT (SBP_L2_SHIFT + SBP_L2_BITS)
49
50extern void subpage_prot_free(pgd_t *pgd);
51
52static inline struct subpage_prot_table *pgd_subpage_prot(pgd_t *pgd)
53{
54 return (struct subpage_prot_table *)(pgd + PTRS_PER_PGD);
55}
56#endif /* CONFIG_PPC_SUBPAGE_PROT */
57#endif /* __ASSEMBLY__ */
58
59/* With 4k base page size, hugepage PTEs go at the PMD level */
60#define MIN_HUGEPTE_SHIFT PAGE_SHIFT
61
62/* PMD_SHIFT determines what a second-level page table entry can map */
63#define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE)
64#define PMD_SIZE (1UL << PMD_SHIFT)
65#define PMD_MASK (~(PMD_SIZE-1))
66
67/* PGDIR_SHIFT determines what a third-level page table entry can map */
68#define PGDIR_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE)
69#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
70#define PGDIR_MASK (~(PGDIR_SIZE-1))
71
72/* Additional PTE bits (don't change without checking asm in hash_low.S) */
73#define __HAVE_ARCH_PTE_SPECIAL
74#define _PAGE_SPECIAL 0x00000400 /* software: special page */
75#define _PAGE_HPTE_SUB 0x0ffff000 /* combo only: sub pages HPTE bits */
76#define _PAGE_HPTE_SUB0 0x08000000 /* combo only: first sub page */
77#define _PAGE_COMBO 0x10000000 /* this is a combo 4k page */
78#define _PAGE_4K_PFN 0x20000000 /* PFN is for a single 4k page */
79
80/* For 64K page, we don't have a separate _PAGE_HASHPTE bit. Instead,
81 * we set that to be the whole sub-bits mask. The C code will only
82 * test this, so a multi-bit mask will work. For combo pages, this
83 * is equivalent as effectively, the old _PAGE_HASHPTE was an OR of
84 * all the sub bits. For real 64k pages, we now have the assembly set
85 * _PAGE_HPTE_SUB0 in addition to setting the HIDX bits which overlap
86 * that mask. This is fine as long as the HIDX bits are never set on
87 * a PTE that isn't hashed, which is the case today.
88 *
89 * A little nit is for the huge page C code, which does the hashing
90 * in C, we need to provide which bit to use.
91 */
92#define _PAGE_HASHPTE _PAGE_HPTE_SUB
93
94/* Note the full page bits must be in the same location as for normal
95 * 4k pages as the same asssembly will be used to insert 64K pages
96 * wether the kernel has CONFIG_PPC_64K_PAGES or not
97 */
98#define _PAGE_F_SECOND 0x00008000 /* full page: hidx bits */
99#define _PAGE_F_GIX 0x00007000 /* full page: hidx bits */
100
101/* PTE flags to conserve for HPTE identification */
102#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | _PAGE_COMBO)
103
104/* Shift to put page number into pte.
105 *
106 * That gives us a max RPN of 34 bits, which means a max of 50 bits
107 * of addressable physical space, or 46 bits for the special 4k PFNs.
108 */
109#define PTE_RPN_SHIFT (30)
110#define PTE_RPN_MAX (1UL << (64 - PTE_RPN_SHIFT))
111#define PTE_RPN_MASK (~((1UL<<PTE_RPN_SHIFT)-1))
112
113/* _PAGE_CHG_MASK masks of bits that are to be preserved accross
114 * pgprot changes
115 */
116#define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \
117 _PAGE_ACCESSED)
118
119/* Bits to mask out from a PMD to get to the PTE page */
120#define PMD_MASKED_BITS 0x1ff
121/* Bits to mask out from a PGD/PUD to get to the PMD page */
122#define PUD_MASKED_BITS 0x1ff
123
124/* Manipulate "rpte" values */
125#define __real_pte(e,p) ((real_pte_t) { \
126 (e), pte_val(*((p) + PTRS_PER_PTE)) })
127#define __rpte_to_hidx(r,index) ((pte_val((r).pte) & _PAGE_COMBO) ? \
128 (((r).hidx >> ((index)<<2)) & 0xf) : ((pte_val((r).pte) >> 12) & 0xf))
129#define __rpte_to_pte(r) ((r).pte)
130#define __rpte_sub_valid(rpte, index) \
131 (pte_val(rpte.pte) & (_PAGE_HPTE_SUB0 >> (index)))
132
133
134/* Trick: we set __end to va + 64k, which happens works for
135 * a 16M page as well as we want only one iteration
136 */
137#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
138 do { \
139 unsigned long __end = va + PAGE_SIZE; \
140 unsigned __split = (psize == MMU_PAGE_4K || \
141 psize == MMU_PAGE_64K_AP); \
142 shift = mmu_psize_defs[psize].shift; \
143 for (index = 0; va < __end; index++, va += (1L << shift)) { \
144 if (!__split || __rpte_sub_valid(rpte, index)) do { \
145
146#define pte_iterate_hashed_end() } while(0); } } while(0)
147
148#define pte_pagesize_index(mm, addr, pte) \
149 (((pte) & _PAGE_COMBO)? MMU_PAGE_4K: MMU_PAGE_64K)
150
151#define remap_4k_pfn(vma, addr, pfn, prot) \
152 remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, \
153 __pgprot(pgprot_val((prot)) | _PAGE_4K_PFN))
154
155#endif /* _ASM_POWERPC_PGTABLE_64K_H */
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h
new file mode 100644
index 000000000000..6fe39e327047
--- /dev/null
+++ b/arch/powerpc/include/asm/pgtable-ppc32.h
@@ -0,0 +1,802 @@
1#ifndef _ASM_POWERPC_PGTABLE_PPC32_H
2#define _ASM_POWERPC_PGTABLE_PPC32_H
3
4#include <asm-generic/pgtable-nopmd.h>
5
6#ifndef __ASSEMBLY__
7#include <linux/sched.h>
8#include <linux/threads.h>
9#include <asm/io.h> /* For sub-arch specific PPC_PIN_SIZE */
10
11extern unsigned long va_to_phys(unsigned long address);
12extern pte_t *va_to_pte(unsigned long address);
13extern unsigned long ioremap_bot, ioremap_base;
14
15#ifdef CONFIG_44x
16extern int icache_44x_need_flush;
17#endif
18
19#endif /* __ASSEMBLY__ */
20
21/*
22 * The PowerPC MMU uses a hash table containing PTEs, together with
23 * a set of 16 segment registers (on 32-bit implementations), to define
24 * the virtual to physical address mapping.
25 *
26 * We use the hash table as an extended TLB, i.e. a cache of currently
27 * active mappings. We maintain a two-level page table tree, much
28 * like that used by the i386, for the sake of the Linux memory
29 * management code. Low-level assembler code in hashtable.S
30 * (procedure hash_page) is responsible for extracting ptes from the
31 * tree and putting them into the hash table when necessary, and
32 * updating the accessed and modified bits in the page table tree.
33 */
34
35/*
36 * The PowerPC MPC8xx uses a TLB with hardware assisted, software tablewalk.
37 * We also use the two level tables, but we can put the real bits in them
38 * needed for the TLB and tablewalk. These definitions require Mx_CTR.PPM = 0,
39 * Mx_CTR.PPCS = 0, and MD_CTR.TWAM = 1. The level 2 descriptor has
40 * additional page protection (when Mx_CTR.PPCS = 1) that allows TLB hit
41 * based upon user/super access. The TLB does not have accessed nor write
42 * protect. We assume that if the TLB get loaded with an entry it is
43 * accessed, and overload the changed bit for write protect. We use
44 * two bits in the software pte that are supposed to be set to zero in
45 * the TLB entry (24 and 25) for these indicators. Although the level 1
46 * descriptor contains the guarded and writethrough/copyback bits, we can
47 * set these at the page level since they get copied from the Mx_TWC
48 * register when the TLB entry is loaded. We will use bit 27 for guard, since
49 * that is where it exists in the MD_TWC, and bit 26 for writethrough.
50 * These will get masked from the level 2 descriptor at TLB load time, and
51 * copied to the MD_TWC before it gets loaded.
52 * Large page sizes added. We currently support two sizes, 4K and 8M.
53 * This also allows a TLB hander optimization because we can directly
54 * load the PMD into MD_TWC. The 8M pages are only used for kernel
55 * mapping of well known areas. The PMD (PGD) entries contain control
56 * flags in addition to the address, so care must be taken that the
57 * software no longer assumes these are only pointers.
58 */
59
60/*
61 * At present, all PowerPC 400-class processors share a similar TLB
62 * architecture. The instruction and data sides share a unified,
63 * 64-entry, fully-associative TLB which is maintained totally under
64 * software control. In addition, the instruction side has a
65 * hardware-managed, 4-entry, fully-associative TLB which serves as a
66 * first level to the shared TLB. These two TLBs are known as the UTLB
67 * and ITLB, respectively (see "mmu.h" for definitions).
68 */
69
70/*
71 * The normal case is that PTEs are 32-bits and we have a 1-page
72 * 1024-entry pgdir pointing to 1-page 1024-entry PTE pages. -- paulus
73 *
74 * For any >32-bit physical address platform, we can use the following
75 * two level page table layout where the pgdir is 8KB and the MS 13 bits
76 * are an index to the second level table. The combined pgdir/pmd first
77 * level has 2048 entries and the second level has 512 64-bit PTE entries.
78 * -Matt
79 */
80/* PGDIR_SHIFT determines what a top-level page table entry can map */
81#define PGDIR_SHIFT (PAGE_SHIFT + PTE_SHIFT)
82#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
83#define PGDIR_MASK (~(PGDIR_SIZE-1))
84
85/*
86 * entries per page directory level: our page-table tree is two-level, so
87 * we don't really have any PMD directory.
88 */
89#ifndef __ASSEMBLY__
90#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_SHIFT)
91#define PGD_TABLE_SIZE (sizeof(pgd_t) << (32 - PGDIR_SHIFT))
92#endif /* __ASSEMBLY__ */
93
94#define PTRS_PER_PTE (1 << PTE_SHIFT)
95#define PTRS_PER_PMD 1
96#define PTRS_PER_PGD (1 << (32 - PGDIR_SHIFT))
97
98#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
99#define FIRST_USER_ADDRESS 0
100
101#define pte_ERROR(e) \
102 printk("%s:%d: bad pte %llx.\n", __FILE__, __LINE__, \
103 (unsigned long long)pte_val(e))
104#define pgd_ERROR(e) \
105 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
106
107/*
108 * Just any arbitrary offset to the start of the vmalloc VM area: the
109 * current 64MB value just means that there will be a 64MB "hole" after the
110 * physical memory until the kernel virtual memory starts. That means that
111 * any out-of-bounds memory accesses will hopefully be caught.
112 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
113 * area for the same reason. ;)
114 *
115 * We no longer map larger than phys RAM with the BATs so we don't have
116 * to worry about the VMALLOC_OFFSET causing problems. We do have to worry
117 * about clashes between our early calls to ioremap() that start growing down
118 * from ioremap_base being run into the VM area allocations (growing upwards
119 * from VMALLOC_START). For this reason we have ioremap_bot to check when
120 * we actually run into our mappings setup in the early boot with the VM
121 * system. This really does become a problem for machines with good amounts
122 * of RAM. -- Cort
123 */
124#define VMALLOC_OFFSET (0x1000000) /* 16M */
125#ifdef PPC_PIN_SIZE
126#define VMALLOC_START (((_ALIGN((long)high_memory, PPC_PIN_SIZE) + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)))
127#else
128#define VMALLOC_START ((((long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)))
129#endif
130#define VMALLOC_END ioremap_bot
131
132/*
133 * Bits in a linux-style PTE. These match the bits in the
134 * (hardware-defined) PowerPC PTE as closely as possible.
135 */
136
137#if defined(CONFIG_40x)
138
139/* There are several potential gotchas here. The 40x hardware TLBLO
140 field looks like this:
141
142 0 1 2 3 4 ... 18 19 20 21 22 23 24 25 26 27 28 29 30 31
143 RPN..................... 0 0 EX WR ZSEL....... W I M G
144
145 Where possible we make the Linux PTE bits match up with this
146
147 - bits 20 and 21 must be cleared, because we use 4k pages (40x can
148 support down to 1k pages), this is done in the TLBMiss exception
149 handler.
150 - We use only zones 0 (for kernel pages) and 1 (for user pages)
151 of the 16 available. Bit 24-26 of the TLB are cleared in the TLB
152 miss handler. Bit 27 is PAGE_USER, thus selecting the correct
153 zone.
154 - PRESENT *must* be in the bottom two bits because swap cache
155 entries use the top 30 bits. Because 40x doesn't support SMP
156 anyway, M is irrelevant so we borrow it for PAGE_PRESENT. Bit 30
157 is cleared in the TLB miss handler before the TLB entry is loaded.
158 - All other bits of the PTE are loaded into TLBLO without
159 modification, leaving us only the bits 20, 21, 24, 25, 26, 30 for
160 software PTE bits. We actually use use bits 21, 24, 25, and
161 30 respectively for the software bits: ACCESSED, DIRTY, RW, and
162 PRESENT.
163*/
164
165/* Definitions for 40x embedded chips. */
166#define _PAGE_GUARDED 0x001 /* G: page is guarded from prefetch */
167#define _PAGE_FILE 0x001 /* when !present: nonlinear file mapping */
168#define _PAGE_PRESENT 0x002 /* software: PTE contains a translation */
169#define _PAGE_NO_CACHE 0x004 /* I: caching is inhibited */
170#define _PAGE_WRITETHRU 0x008 /* W: caching is write-through */
171#define _PAGE_USER 0x010 /* matches one of the zone permission bits */
172#define _PAGE_RW 0x040 /* software: Writes permitted */
173#define _PAGE_DIRTY 0x080 /* software: dirty page */
174#define _PAGE_HWWRITE 0x100 /* hardware: Dirty & RW, set in exception */
175#define _PAGE_HWEXEC 0x200 /* hardware: EX permission */
176#define _PAGE_ACCESSED 0x400 /* software: R: page referenced */
177
178#define _PMD_PRESENT 0x400 /* PMD points to page of PTEs */
179#define _PMD_BAD 0x802
180#define _PMD_SIZE 0x0e0 /* size field, != 0 for large-page PMD entry */
181#define _PMD_SIZE_4M 0x0c0
182#define _PMD_SIZE_16M 0x0e0
183#define PMD_PAGE_SIZE(pmdval) (1024 << (((pmdval) & _PMD_SIZE) >> 4))
184
185/* Until my rework is finished, 40x still needs atomic PTE updates */
186#define PTE_ATOMIC_UPDATES 1
187
188#elif defined(CONFIG_44x)
189/*
190 * Definitions for PPC440
191 *
192 * Because of the 3 word TLB entries to support 36-bit addressing,
193 * the attribute are difficult to map in such a fashion that they
194 * are easily loaded during exception processing. I decided to
195 * organize the entry so the ERPN is the only portion in the
196 * upper word of the PTE and the attribute bits below are packed
197 * in as sensibly as they can be in the area below a 4KB page size
198 * oriented RPN. This at least makes it easy to load the RPN and
199 * ERPN fields in the TLB. -Matt
200 *
201 * Note that these bits preclude future use of a page size
202 * less than 4KB.
203 *
204 *
205 * PPC 440 core has following TLB attribute fields;
206 *
207 * TLB1:
208 * 0 1 2 3 4 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
209 * RPN................................. - - - - - - ERPN.......
210 *
211 * TLB2:
212 * 0 1 2 3 4 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
213 * - - - - - - U0 U1 U2 U3 W I M G E - UX UW UR SX SW SR
214 *
215 * Newer 440 cores (440x6 as used on AMCC 460EX/460GT) have additional
216 * TLB2 storage attibute fields. Those are:
217 *
218 * TLB2:
219 * 0...10 11 12 13 14 15 16...31
220 * no change WL1 IL1I IL1D IL2I IL2D no change
221 *
222 * There are some constrains and options, to decide mapping software bits
223 * into TLB entry.
224 *
225 * - PRESENT *must* be in the bottom three bits because swap cache
226 * entries use the top 29 bits for TLB2.
227 *
228 * - FILE *must* be in the bottom three bits because swap cache
229 * entries use the top 29 bits for TLB2.
230 *
231 * - CACHE COHERENT bit (M) has no effect on PPC440 core, because it
232 * doesn't support SMP. So we can use this as software bit, like
233 * DIRTY.
234 *
235 * With the PPC 44x Linux implementation, the 0-11th LSBs of the PTE are used
236 * for memory protection related functions (see PTE structure in
237 * include/asm-ppc/mmu.h). The _PAGE_XXX definitions in this file map to the
238 * above bits. Note that the bit values are CPU specific, not architecture
239 * specific.
240 *
241 * The kernel PTE entry holds an arch-dependent swp_entry structure under
242 * certain situations. In other words, in such situations some portion of
243 * the PTE bits are used as a swp_entry. In the PPC implementation, the
244 * 3-24th LSB are shared with swp_entry, however the 0-2nd three LSB still
245 * hold protection values. That means the three protection bits are
246 * reserved for both PTE and SWAP entry at the most significant three
247 * LSBs.
248 *
249 * There are three protection bits available for SWAP entry:
250 * _PAGE_PRESENT
251 * _PAGE_FILE
252 * _PAGE_HASHPTE (if HW has)
253 *
254 * So those three bits have to be inside of 0-2nd LSB of PTE.
255 *
256 */
257
258#define _PAGE_PRESENT 0x00000001 /* S: PTE valid */
259#define _PAGE_RW 0x00000002 /* S: Write permission */
260#define _PAGE_FILE 0x00000004 /* S: nonlinear file mapping */
261#define _PAGE_HWEXEC 0x00000004 /* H: Execute permission */
262#define _PAGE_ACCESSED 0x00000008 /* S: Page referenced */
263#define _PAGE_DIRTY 0x00000010 /* S: Page dirty */
264#define _PAGE_USER 0x00000040 /* S: User page */
265#define _PAGE_ENDIAN 0x00000080 /* H: E bit */
266#define _PAGE_GUARDED 0x00000100 /* H: G bit */
267#define _PAGE_COHERENT 0x00000200 /* H: M bit */
268#define _PAGE_NO_CACHE 0x00000400 /* H: I bit */
269#define _PAGE_WRITETHRU 0x00000800 /* H: W bit */
270
271/* TODO: Add large page lowmem mapping support */
272#define _PMD_PRESENT 0
273#define _PMD_PRESENT_MASK (PAGE_MASK)
274#define _PMD_BAD (~PAGE_MASK)
275
276/* ERPN in a PTE never gets cleared, ignore it */
277#define _PTE_NONE_MASK 0xffffffff00000000ULL
278
279
280#elif defined(CONFIG_FSL_BOOKE)
281/*
282 MMU Assist Register 3:
283
284 32 33 34 35 36 ... 50 51 52 53 54 55 56 57 58 59 60 61 62 63
285 RPN...................... 0 0 U0 U1 U2 U3 UX SX UW SW UR SR
286
287 - PRESENT *must* be in the bottom three bits because swap cache
288 entries use the top 29 bits.
289
290 - FILE *must* be in the bottom three bits because swap cache
291 entries use the top 29 bits.
292*/
293
294/* Definitions for FSL Book-E Cores */
295#define _PAGE_PRESENT 0x00001 /* S: PTE contains a translation */
296#define _PAGE_USER 0x00002 /* S: User page (maps to UR) */
297#define _PAGE_FILE 0x00002 /* S: when !present: nonlinear file mapping */
298#define _PAGE_RW 0x00004 /* S: Write permission (SW) */
299#define _PAGE_DIRTY 0x00008 /* S: Page dirty */
300#define _PAGE_HWEXEC 0x00010 /* H: SX permission */
301#define _PAGE_ACCESSED 0x00020 /* S: Page referenced */
302
303#define _PAGE_ENDIAN 0x00040 /* H: E bit */
304#define _PAGE_GUARDED 0x00080 /* H: G bit */
305#define _PAGE_COHERENT 0x00100 /* H: M bit */
306#define _PAGE_NO_CACHE 0x00200 /* H: I bit */
307#define _PAGE_WRITETHRU 0x00400 /* H: W bit */
308
309#ifdef CONFIG_PTE_64BIT
310/* ERPN in a PTE never gets cleared, ignore it */
311#define _PTE_NONE_MASK 0xffffffffffff0000ULL
312#endif
313
314#define _PMD_PRESENT 0
315#define _PMD_PRESENT_MASK (PAGE_MASK)
316#define _PMD_BAD (~PAGE_MASK)
317
318#elif defined(CONFIG_8xx)
319/* Definitions for 8xx embedded chips. */
320#define _PAGE_PRESENT 0x0001 /* Page is valid */
321#define _PAGE_FILE 0x0002 /* when !present: nonlinear file mapping */
322#define _PAGE_NO_CACHE 0x0002 /* I: cache inhibit */
323#define _PAGE_SHARED 0x0004 /* No ASID (context) compare */
324
325/* These five software bits must be masked out when the entry is loaded
326 * into the TLB.
327 */
328#define _PAGE_EXEC 0x0008 /* software: i-cache coherency required */
329#define _PAGE_GUARDED 0x0010 /* software: guarded access */
330#define _PAGE_DIRTY 0x0020 /* software: page changed */
331#define _PAGE_RW 0x0040 /* software: user write access allowed */
332#define _PAGE_ACCESSED 0x0080 /* software: page referenced */
333
334/* Setting any bits in the nibble with the follow two controls will
335 * require a TLB exception handler change. It is assumed unused bits
336 * are always zero.
337 */
338#define _PAGE_HWWRITE 0x0100 /* h/w write enable: never set in Linux PTE */
339#define _PAGE_USER 0x0800 /* One of the PP bits, the other is USER&~RW */
340
341#define _PMD_PRESENT 0x0001
342#define _PMD_BAD 0x0ff0
343#define _PMD_PAGE_MASK 0x000c
344#define _PMD_PAGE_8M 0x000c
345
346#define _PTE_NONE_MASK _PAGE_ACCESSED
347
348/* Until my rework is finished, 8xx still needs atomic PTE updates */
349#define PTE_ATOMIC_UPDATES 1
350
351#else /* CONFIG_6xx */
352/* Definitions for 60x, 740/750, etc. */
353#define _PAGE_PRESENT 0x001 /* software: pte contains a translation */
354#define _PAGE_HASHPTE 0x002 /* hash_page has made an HPTE for this pte */
355#define _PAGE_FILE 0x004 /* when !present: nonlinear file mapping */
356#define _PAGE_USER 0x004 /* usermode access allowed */
357#define _PAGE_GUARDED 0x008 /* G: prohibit speculative access */
358#define _PAGE_COHERENT 0x010 /* M: enforce memory coherence (SMP systems) */
359#define _PAGE_NO_CACHE 0x020 /* I: cache inhibit */
360#define _PAGE_WRITETHRU 0x040 /* W: cache write-through */
361#define _PAGE_DIRTY 0x080 /* C: page changed */
362#define _PAGE_ACCESSED 0x100 /* R: page referenced */
363#define _PAGE_EXEC 0x200 /* software: i-cache coherency required */
364#define _PAGE_RW 0x400 /* software: user write access allowed */
365
366#define _PTE_NONE_MASK _PAGE_HASHPTE
367
368#define _PMD_PRESENT 0
369#define _PMD_PRESENT_MASK (PAGE_MASK)
370#define _PMD_BAD (~PAGE_MASK)
371
372/* Hash table based platforms need atomic updates of the linux PTE */
373#define PTE_ATOMIC_UPDATES 1
374
375#endif
376
377/*
378 * Some bits are only used on some cpu families...
379 */
380#ifndef _PAGE_HASHPTE
381#define _PAGE_HASHPTE 0
382#endif
383#ifndef _PTE_NONE_MASK
384#define _PTE_NONE_MASK 0
385#endif
386#ifndef _PAGE_SHARED
387#define _PAGE_SHARED 0
388#endif
389#ifndef _PAGE_HWWRITE
390#define _PAGE_HWWRITE 0
391#endif
392#ifndef _PAGE_HWEXEC
393#define _PAGE_HWEXEC 0
394#endif
395#ifndef _PAGE_EXEC
396#define _PAGE_EXEC 0
397#endif
398#ifndef _PAGE_ENDIAN
399#define _PAGE_ENDIAN 0
400#endif
401#ifndef _PAGE_COHERENT
402#define _PAGE_COHERENT 0
403#endif
404#ifndef _PAGE_WRITETHRU
405#define _PAGE_WRITETHRU 0
406#endif
407#ifndef _PMD_PRESENT_MASK
408#define _PMD_PRESENT_MASK _PMD_PRESENT
409#endif
410#ifndef _PMD_SIZE
411#define _PMD_SIZE 0
412#define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE()
413#endif
414
415#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
416
417
418#define PAGE_PROT_BITS __pgprot(_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \
419 _PAGE_WRITETHRU | _PAGE_ENDIAN | \
420 _PAGE_USER | _PAGE_ACCESSED | \
421 _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | \
422 _PAGE_EXEC | _PAGE_HWEXEC)
423/*
424 * Note: the _PAGE_COHERENT bit automatically gets set in the hardware
425 * PTE if CONFIG_SMP is defined (hash_page does this); there is no need
426 * to have it in the Linux PTE, and in fact the bit could be reused for
427 * another purpose. -- paulus.
428 */
429
430#ifdef CONFIG_44x
431#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_GUARDED)
432#else
433#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED)
434#endif
435#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE)
436#define _PAGE_KERNEL (_PAGE_BASE | _PAGE_SHARED | _PAGE_WRENABLE)
437
438#ifdef CONFIG_PPC_STD_MMU
439/* On standard PPC MMU, no user access implies kernel read/write access,
440 * so to write-protect kernel memory we must turn on user access */
441#define _PAGE_KERNEL_RO (_PAGE_BASE | _PAGE_SHARED | _PAGE_USER)
442#else
443#define _PAGE_KERNEL_RO (_PAGE_BASE | _PAGE_SHARED)
444#endif
445
446#define _PAGE_IO (_PAGE_KERNEL | _PAGE_NO_CACHE | _PAGE_GUARDED)
447#define _PAGE_RAM (_PAGE_KERNEL | _PAGE_HWEXEC)
448
449#if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) ||\
450 defined(CONFIG_KPROBES)
451/* We want the debuggers to be able to set breakpoints anywhere, so
452 * don't write protect the kernel text */
453#define _PAGE_RAM_TEXT _PAGE_RAM
454#else
455#define _PAGE_RAM_TEXT (_PAGE_KERNEL_RO | _PAGE_HWEXEC)
456#endif
457
458#define PAGE_NONE __pgprot(_PAGE_BASE)
459#define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER)
460#define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC)
461#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW)
462#define PAGE_SHARED_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW | _PAGE_EXEC)
463#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER)
464#define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC)
465
466#define PAGE_KERNEL __pgprot(_PAGE_RAM)
467#define PAGE_KERNEL_NOCACHE __pgprot(_PAGE_IO)
468
469/*
470 * The PowerPC can only do execute protection on a segment (256MB) basis,
471 * not on a page basis. So we consider execute permission the same as read.
472 * Also, write permissions imply read permissions.
473 * This is the closest we can get..
474 */
475#define __P000 PAGE_NONE
476#define __P001 PAGE_READONLY_X
477#define __P010 PAGE_COPY
478#define __P011 PAGE_COPY_X
479#define __P100 PAGE_READONLY
480#define __P101 PAGE_READONLY_X
481#define __P110 PAGE_COPY
482#define __P111 PAGE_COPY_X
483
484#define __S000 PAGE_NONE
485#define __S001 PAGE_READONLY_X
486#define __S010 PAGE_SHARED
487#define __S011 PAGE_SHARED_X
488#define __S100 PAGE_READONLY
489#define __S101 PAGE_READONLY_X
490#define __S110 PAGE_SHARED
491#define __S111 PAGE_SHARED_X
492
493#ifndef __ASSEMBLY__
494/* Make sure we get a link error if PMD_PAGE_SIZE is ever called on a
495 * kernel without large page PMD support */
496extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);
497
498/*
499 * Conversions between PTE values and page frame numbers.
500 */
501
502/* in some case we want to additionaly adjust where the pfn is in the pte to
503 * allow room for more flags */
504#if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_PTE_64BIT)
505#define PFN_SHIFT_OFFSET (PAGE_SHIFT + 8)
506#else
507#define PFN_SHIFT_OFFSET (PAGE_SHIFT)
508#endif
509
510#define pte_pfn(x) (pte_val(x) >> PFN_SHIFT_OFFSET)
511#define pte_page(x) pfn_to_page(pte_pfn(x))
512
513#define pfn_pte(pfn, prot) __pte(((pte_basic_t)(pfn) << PFN_SHIFT_OFFSET) |\
514 pgprot_val(prot))
515#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
516#endif /* __ASSEMBLY__ */
517
518#define pte_none(pte) ((pte_val(pte) & ~_PTE_NONE_MASK) == 0)
519#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
520#define pte_clear(mm,addr,ptep) do { set_pte_at((mm), (addr), (ptep), __pte(0)); } while (0)
521
522#define pmd_none(pmd) (!pmd_val(pmd))
523#define pmd_bad(pmd) (pmd_val(pmd) & _PMD_BAD)
524#define pmd_present(pmd) (pmd_val(pmd) & _PMD_PRESENT_MASK)
525#define pmd_clear(pmdp) do { pmd_val(*(pmdp)) = 0; } while (0)
526
527#ifndef __ASSEMBLY__
528/*
529 * The following only work if pte_present() is true.
530 * Undefined behaviour if not..
531 */
532static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
533static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
534static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
535static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
536static inline int pte_special(pte_t pte) { return 0; }
537
538static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
539static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
540
541static inline pte_t pte_wrprotect(pte_t pte) {
542 pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; }
543static inline pte_t pte_mkclean(pte_t pte) {
544 pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; }
545static inline pte_t pte_mkold(pte_t pte) {
546 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
547
548static inline pte_t pte_mkwrite(pte_t pte) {
549 pte_val(pte) |= _PAGE_RW; return pte; }
550static inline pte_t pte_mkdirty(pte_t pte) {
551 pte_val(pte) |= _PAGE_DIRTY; return pte; }
552static inline pte_t pte_mkyoung(pte_t pte) {
553 pte_val(pte) |= _PAGE_ACCESSED; return pte; }
554static inline pte_t pte_mkspecial(pte_t pte) {
555 return pte; }
556static inline unsigned long pte_pgprot(pte_t pte)
557{
558 return __pgprot(pte_val(pte)) & PAGE_PROT_BITS;
559}
560
561static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
562{
563 pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot);
564 return pte;
565}
566
567/*
568 * When flushing the tlb entry for a page, we also need to flush the hash
569 * table entry. flush_hash_pages is assembler (for speed) in hashtable.S.
570 */
571extern int flush_hash_pages(unsigned context, unsigned long va,
572 unsigned long pmdval, int count);
573
574/* Add an HPTE to the hash table */
575extern void add_hash_page(unsigned context, unsigned long va,
576 unsigned long pmdval);
577
578/*
579 * Atomic PTE updates.
580 *
581 * pte_update clears and sets bit atomically, and returns
582 * the old pte value. In the 64-bit PTE case we lock around the
583 * low PTE word since we expect ALL flag bits to be there
584 */
585#ifndef CONFIG_PTE_64BIT
586static inline unsigned long pte_update(pte_t *p,
587 unsigned long clr,
588 unsigned long set)
589{
590#ifdef PTE_ATOMIC_UPDATES
591 unsigned long old, tmp;
592
593 __asm__ __volatile__("\
5941: lwarx %0,0,%3\n\
595 andc %1,%0,%4\n\
596 or %1,%1,%5\n"
597 PPC405_ERR77(0,%3)
598" stwcx. %1,0,%3\n\
599 bne- 1b"
600 : "=&r" (old), "=&r" (tmp), "=m" (*p)
601 : "r" (p), "r" (clr), "r" (set), "m" (*p)
602 : "cc" );
603#else /* PTE_ATOMIC_UPDATES */
604 unsigned long old = pte_val(*p);
605 *p = __pte((old & ~clr) | set);
606#endif /* !PTE_ATOMIC_UPDATES */
607
608#ifdef CONFIG_44x
609 if ((old & _PAGE_USER) && (old & _PAGE_HWEXEC))
610 icache_44x_need_flush = 1;
611#endif
612 return old;
613}
614#else /* CONFIG_PTE_64BIT */
615/* TODO: Change that to only modify the low word and move set_pte_at()
616 * out of line
617 */
618static inline unsigned long long pte_update(pte_t *p,
619 unsigned long clr,
620 unsigned long set)
621{
622#ifdef PTE_ATOMIC_UPDATES
623 unsigned long long old;
624 unsigned long tmp;
625
626 __asm__ __volatile__("\
6271: lwarx %L0,0,%4\n\
628 lwzx %0,0,%3\n\
629 andc %1,%L0,%5\n\
630 or %1,%1,%6\n"
631 PPC405_ERR77(0,%3)
632" stwcx. %1,0,%4\n\
633 bne- 1b"
634 : "=&r" (old), "=&r" (tmp), "=m" (*p)
635 : "r" (p), "r" ((unsigned long)(p) + 4), "r" (clr), "r" (set), "m" (*p)
636 : "cc" );
637#else /* PTE_ATOMIC_UPDATES */
638 unsigned long long old = pte_val(*p);
639 *p = __pte((old & ~(unsigned long long)clr) | set);
640#endif /* !PTE_ATOMIC_UPDATES */
641
642#ifdef CONFIG_44x
643 if ((old & _PAGE_USER) && (old & _PAGE_HWEXEC))
644 icache_44x_need_flush = 1;
645#endif
646 return old;
647}
648#endif /* CONFIG_PTE_64BIT */
649
650/*
651 * set_pte stores a linux PTE into the linux page table.
652 * On machines which use an MMU hash table we avoid changing the
653 * _PAGE_HASHPTE bit.
654 */
655static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
656 pte_t *ptep, pte_t pte)
657{
658#if _PAGE_HASHPTE != 0
659 pte_update(ptep, ~_PAGE_HASHPTE, pte_val(pte) & ~_PAGE_HASHPTE);
660#else
661 *ptep = pte;
662#endif
663}
664
665/*
666 * 2.6 calls this without flushing the TLB entry; this is wrong
667 * for our hash-based implementation, we fix that up here.
668 */
669#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
670static inline int __ptep_test_and_clear_young(unsigned int context, unsigned long addr, pte_t *ptep)
671{
672 unsigned long old;
673 old = pte_update(ptep, _PAGE_ACCESSED, 0);
674#if _PAGE_HASHPTE != 0
675 if (old & _PAGE_HASHPTE) {
676 unsigned long ptephys = __pa(ptep) & PAGE_MASK;
677 flush_hash_pages(context, addr, ptephys, 1);
678 }
679#endif
680 return (old & _PAGE_ACCESSED) != 0;
681}
682#define ptep_test_and_clear_young(__vma, __addr, __ptep) \
683 __ptep_test_and_clear_young((__vma)->vm_mm->context.id, __addr, __ptep)
684
685#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
686static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
687 pte_t *ptep)
688{
689 return __pte(pte_update(ptep, ~_PAGE_HASHPTE, 0));
690}
691
692#define __HAVE_ARCH_PTEP_SET_WRPROTECT
693static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
694 pte_t *ptep)
695{
696 pte_update(ptep, (_PAGE_RW | _PAGE_HWWRITE), 0);
697}
698static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
699 unsigned long addr, pte_t *ptep)
700{
701 ptep_set_wrprotect(mm, addr, ptep);
702}
703
704
705#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
706static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
707{
708 unsigned long bits = pte_val(entry) &
709 (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW);
710 pte_update(ptep, 0, bits);
711}
712
713#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
714({ \
715 int __changed = !pte_same(*(__ptep), __entry); \
716 if (__changed) { \
717 __ptep_set_access_flags(__ptep, __entry, __dirty); \
718 flush_tlb_page_nohash(__vma, __address); \
719 } \
720 __changed; \
721})
722
723/*
724 * Macro to mark a page protection value as "uncacheable".
725 */
726#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED))
727
728struct file;
729extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
730 unsigned long size, pgprot_t vma_prot);
731#define __HAVE_PHYS_MEM_ACCESS_PROT
732
733#define __HAVE_ARCH_PTE_SAME
734#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HASHPTE) == 0)
735
736/*
737 * Note that on Book E processors, the pmd contains the kernel virtual
738 * (lowmem) address of the pte page. The physical address is less useful
739 * because everything runs with translation enabled (even the TLB miss
740 * handler). On everything else the pmd contains the physical address
741 * of the pte page. -- paulus
742 */
743#ifndef CONFIG_BOOKE
744#define pmd_page_vaddr(pmd) \
745 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
746#define pmd_page(pmd) \
747 (mem_map + (pmd_val(pmd) >> PAGE_SHIFT))
748#else
749#define pmd_page_vaddr(pmd) \
750 ((unsigned long) (pmd_val(pmd) & PAGE_MASK))
751#define pmd_page(pmd) \
752 pfn_to_page((__pa(pmd_val(pmd)) >> PAGE_SHIFT))
753#endif
754
755/* to find an entry in a kernel page-table-directory */
756#define pgd_offset_k(address) pgd_offset(&init_mm, address)
757
758/* to find an entry in a page-table-directory */
759#define pgd_index(address) ((address) >> PGDIR_SHIFT)
760#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
761
762/* Find an entry in the third-level page table.. */
763#define pte_index(address) \
764 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
765#define pte_offset_kernel(dir, addr) \
766 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr))
767#define pte_offset_map(dir, addr) \
768 ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr))
769#define pte_offset_map_nested(dir, addr) \
770 ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE1) + pte_index(addr))
771
772#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
773#define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
774
775/*
776 * Encode and decode a swap entry.
777 * Note that the bits we use in a PTE for representing a swap entry
778 * must not include the _PAGE_PRESENT bit, the _PAGE_FILE bit, or the
779 *_PAGE_HASHPTE bit (if used). -- paulus
780 */
781#define __swp_type(entry) ((entry).val & 0x1f)
782#define __swp_offset(entry) ((entry).val >> 5)
783#define __swp_entry(type, offset) ((swp_entry_t) { (type) | ((offset) << 5) })
784#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 3 })
785#define __swp_entry_to_pte(x) ((pte_t) { (x).val << 3 })
786
787/* Encode and decode a nonlinear file mapping entry */
788#define PTE_FILE_MAX_BITS 29
789#define pte_to_pgoff(pte) (pte_val(pte) >> 3)
790#define pgoff_to_pte(off) ((pte_t) { ((off) << 3) | _PAGE_FILE })
791
792/*
793 * No page table caches to initialise
794 */
795#define pgtable_cache_init() do { } while (0)
796
797extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep,
798 pmd_t **pmdp);
799
800#endif /* !__ASSEMBLY__ */
801
802#endif /* _ASM_POWERPC_PGTABLE_PPC32_H */
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
new file mode 100644
index 000000000000..db0b8f3b8807
--- /dev/null
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -0,0 +1,468 @@
1#ifndef _ASM_POWERPC_PGTABLE_PPC64_H_
2#define _ASM_POWERPC_PGTABLE_PPC64_H_
3/*
4 * This file contains the functions and defines necessary to modify and use
5 * the ppc64 hashed page table.
6 */
7
8#ifndef __ASSEMBLY__
9#include <linux/stddef.h>
10#include <asm/tlbflush.h>
11#endif /* __ASSEMBLY__ */
12
13#ifdef CONFIG_PPC_64K_PAGES
14#include <asm/pgtable-64k.h>
15#else
16#include <asm/pgtable-4k.h>
17#endif
18
19#define FIRST_USER_ADDRESS 0
20
21/*
22 * Size of EA range mapped by our pagetables.
23 */
24#define PGTABLE_EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \
25 PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT)
26#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE)
27
28#if TASK_SIZE_USER64 > PGTABLE_RANGE
29#error TASK_SIZE_USER64 exceeds pagetable range
30#endif
31
32#if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT))
33#error TASK_SIZE_USER64 exceeds user VSID range
34#endif
35
36
37/*
38 * Define the address range of the vmalloc VM area.
39 */
40#define VMALLOC_START ASM_CONST(0xD000000000000000)
41#define VMALLOC_SIZE (PGTABLE_RANGE >> 1)
42#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE)
43
44/*
45 * Define the address ranges for MMIO and IO space :
46 *
47 * ISA_IO_BASE = VMALLOC_END, 64K reserved area
48 * PHB_IO_BASE = ISA_IO_BASE + 64K to ISA_IO_BASE + 2G, PHB IO spaces
49 * IOREMAP_BASE = ISA_IO_BASE + 2G to VMALLOC_START + PGTABLE_RANGE
50 */
51#define FULL_IO_SIZE 0x80000000ul
52#define ISA_IO_BASE (VMALLOC_END)
53#define ISA_IO_END (VMALLOC_END + 0x10000ul)
54#define PHB_IO_BASE (ISA_IO_END)
55#define PHB_IO_END (VMALLOC_END + FULL_IO_SIZE)
56#define IOREMAP_BASE (PHB_IO_END)
57#define IOREMAP_END (VMALLOC_START + PGTABLE_RANGE)
58
59/*
60 * Region IDs
61 */
62#define REGION_SHIFT 60UL
63#define REGION_MASK (0xfUL << REGION_SHIFT)
64#define REGION_ID(ea) (((unsigned long)(ea)) >> REGION_SHIFT)
65
66#define VMALLOC_REGION_ID (REGION_ID(VMALLOC_START))
67#define KERNEL_REGION_ID (REGION_ID(PAGE_OFFSET))
68#define VMEMMAP_REGION_ID (0xfUL)
69#define USER_REGION_ID (0UL)
70
71/*
72 * Defines the address of the vmemap area, in its own region
73 */
74#define VMEMMAP_BASE (VMEMMAP_REGION_ID << REGION_SHIFT)
75#define vmemmap ((struct page *)VMEMMAP_BASE)
76
77
78/*
79 * Common bits in a linux-style PTE. These match the bits in the
80 * (hardware-defined) PowerPC PTE as closely as possible. Additional
81 * bits may be defined in pgtable-*.h
82 */
83#define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */
84#define _PAGE_USER 0x0002 /* matches one of the PP bits */
85#define _PAGE_FILE 0x0002 /* (!present only) software: pte holds file offset */
86#define _PAGE_EXEC 0x0004 /* No execute on POWER4 and newer (we invert) */
87#define _PAGE_GUARDED 0x0008
88#define _PAGE_COHERENT 0x0010 /* M: enforce memory coherence (SMP systems) */
89#define _PAGE_NO_CACHE 0x0020 /* I: cache inhibit */
90#define _PAGE_WRITETHRU 0x0040 /* W: cache write-through */
91#define _PAGE_DIRTY 0x0080 /* C: page changed */
92#define _PAGE_ACCESSED 0x0100 /* R: page referenced */
93#define _PAGE_RW 0x0200 /* software: user write access allowed */
94#define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */
95
96/* Strong Access Ordering */
97#define _PAGE_SAO (_PAGE_WRITETHRU | _PAGE_NO_CACHE | _PAGE_COHERENT)
98
99#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT)
100
101#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY)
102
103/* __pgprot defined in arch/powerpc/incliude/asm/page.h */
104#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED)
105
106#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER)
107#define PAGE_SHARED_X __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER | _PAGE_EXEC)
108#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER)
109#define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC)
110#define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER)
111#define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC)
112#define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_WRENABLE)
113#define PAGE_KERNEL_CI __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
114 _PAGE_WRENABLE | _PAGE_NO_CACHE | _PAGE_GUARDED)
115#define PAGE_KERNEL_EXEC __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_EXEC)
116
117#define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE)
118#define HAVE_PAGE_AGP
119
120#define PAGE_PROT_BITS __pgprot(_PAGE_GUARDED | _PAGE_COHERENT | \
121 _PAGE_NO_CACHE | _PAGE_WRITETHRU | \
122 _PAGE_4K_PFN | _PAGE_RW | _PAGE_USER | \
123 _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_EXEC)
124/* PTEIDX nibble */
125#define _PTEIDX_SECONDARY 0x8
126#define _PTEIDX_GROUP_IX 0x7
127
128
129/*
130 * POWER4 and newer have per page execute protection, older chips can only
131 * do this on a segment (256MB) basis.
132 *
133 * Also, write permissions imply read permissions.
134 * This is the closest we can get..
135 *
136 * Note due to the way vm flags are laid out, the bits are XWR
137 */
138#define __P000 PAGE_NONE
139#define __P001 PAGE_READONLY
140#define __P010 PAGE_COPY
141#define __P011 PAGE_COPY
142#define __P100 PAGE_READONLY_X
143#define __P101 PAGE_READONLY_X
144#define __P110 PAGE_COPY_X
145#define __P111 PAGE_COPY_X
146
147#define __S000 PAGE_NONE
148#define __S001 PAGE_READONLY
149#define __S010 PAGE_SHARED
150#define __S011 PAGE_SHARED
151#define __S100 PAGE_READONLY_X
152#define __S101 PAGE_READONLY_X
153#define __S110 PAGE_SHARED_X
154#define __S111 PAGE_SHARED_X
155
156#ifdef CONFIG_HUGETLB_PAGE
157
158#define HAVE_ARCH_UNMAPPED_AREA
159#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
160
161#endif
162
163#ifndef __ASSEMBLY__
164
165/*
166 * Conversion functions: convert a page and protection to a page entry,
167 * and a page entry and page directory to the page they refer to.
168 *
169 * mk_pte takes a (struct page *) as input
170 */
171#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
172
173static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
174{
175 pte_t pte;
176
177
178 pte_val(pte) = (pfn << PTE_RPN_SHIFT) | pgprot_val(pgprot);
179 return pte;
180}
181
182#define pte_modify(_pte, newprot) \
183 (__pte((pte_val(_pte) & _PAGE_CHG_MASK) | pgprot_val(newprot)))
184
185#define pte_none(pte) ((pte_val(pte) & ~_PAGE_HPTEFLAGS) == 0)
186#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
187
188/* pte_clear moved to later in this file */
189
190#define pte_pfn(x) ((unsigned long)((pte_val(x)>>PTE_RPN_SHIFT)))
191#define pte_page(x) pfn_to_page(pte_pfn(x))
192
193#define PMD_BAD_BITS (PTE_TABLE_SIZE-1)
194#define PUD_BAD_BITS (PMD_TABLE_SIZE-1)
195
196#define pmd_set(pmdp, pmdval) (pmd_val(*(pmdp)) = (pmdval))
197#define pmd_none(pmd) (!pmd_val(pmd))
198#define pmd_bad(pmd) (!is_kernel_addr(pmd_val(pmd)) \
199 || (pmd_val(pmd) & PMD_BAD_BITS))
200#define pmd_present(pmd) (pmd_val(pmd) != 0)
201#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0)
202#define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)
203#define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd))
204
205#define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval))
206#define pud_none(pud) (!pud_val(pud))
207#define pud_bad(pud) (!is_kernel_addr(pud_val(pud)) \
208 || (pud_val(pud) & PUD_BAD_BITS))
209#define pud_present(pud) (pud_val(pud) != 0)
210#define pud_clear(pudp) (pud_val(*(pudp)) = 0)
211#define pud_page_vaddr(pud) (pud_val(pud) & ~PUD_MASKED_BITS)
212#define pud_page(pud) virt_to_page(pud_page_vaddr(pud))
213
214#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);})
215
216/*
217 * Find an entry in a page-table-directory. We combine the address region
218 * (the high order N bits) and the pgd portion of the address.
219 */
220/* to avoid overflow in free_pgtables we don't use PTRS_PER_PGD here */
221#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & 0x1ff)
222
223#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
224
225#define pmd_offset(pudp,addr) \
226 (((pmd_t *) pud_page_vaddr(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)))
227
228#define pte_offset_kernel(dir,addr) \
229 (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
230
231#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr))
232#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr))
233#define pte_unmap(pte) do { } while(0)
234#define pte_unmap_nested(pte) do { } while(0)
235
236/* to find an entry in a kernel page-table-directory */
237/* This now only contains the vmalloc pages */
238#define pgd_offset_k(address) pgd_offset(&init_mm, address)
239
240/*
241 * The following only work if pte_present() is true.
242 * Undefined behaviour if not..
243 */
244static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;}
245static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;}
246static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;}
247static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;}
248static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; }
249
250static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
251static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
252
253static inline pte_t pte_wrprotect(pte_t pte) {
254 pte_val(pte) &= ~(_PAGE_RW); return pte; }
255static inline pte_t pte_mkclean(pte_t pte) {
256 pte_val(pte) &= ~(_PAGE_DIRTY); return pte; }
257static inline pte_t pte_mkold(pte_t pte) {
258 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
259static inline pte_t pte_mkwrite(pte_t pte) {
260 pte_val(pte) |= _PAGE_RW; return pte; }
261static inline pte_t pte_mkdirty(pte_t pte) {
262 pte_val(pte) |= _PAGE_DIRTY; return pte; }
263static inline pte_t pte_mkyoung(pte_t pte) {
264 pte_val(pte) |= _PAGE_ACCESSED; return pte; }
265static inline pte_t pte_mkhuge(pte_t pte) {
266 return pte; }
267static inline pte_t pte_mkspecial(pte_t pte) {
268 pte_val(pte) |= _PAGE_SPECIAL; return pte; }
269static inline unsigned long pte_pgprot(pte_t pte)
270{
271 return __pgprot(pte_val(pte)) & PAGE_PROT_BITS;
272}
273
274/* Atomic PTE updates */
275static inline unsigned long pte_update(struct mm_struct *mm,
276 unsigned long addr,
277 pte_t *ptep, unsigned long clr,
278 int huge)
279{
280 unsigned long old, tmp;
281
282 __asm__ __volatile__(
283 "1: ldarx %0,0,%3 # pte_update\n\
284 andi. %1,%0,%6\n\
285 bne- 1b \n\
286 andc %1,%0,%4 \n\
287 stdcx. %1,0,%3 \n\
288 bne- 1b"
289 : "=&r" (old), "=&r" (tmp), "=m" (*ptep)
290 : "r" (ptep), "r" (clr), "m" (*ptep), "i" (_PAGE_BUSY)
291 : "cc" );
292
293 if (old & _PAGE_HASHPTE)
294 hpte_need_flush(mm, addr, ptep, old, huge);
295 return old;
296}
297
298static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
299 unsigned long addr, pte_t *ptep)
300{
301 unsigned long old;
302
303 if ((pte_val(*ptep) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0)
304 return 0;
305 old = pte_update(mm, addr, ptep, _PAGE_ACCESSED, 0);
306 return (old & _PAGE_ACCESSED) != 0;
307}
308#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
309#define ptep_test_and_clear_young(__vma, __addr, __ptep) \
310({ \
311 int __r; \
312 __r = __ptep_test_and_clear_young((__vma)->vm_mm, __addr, __ptep); \
313 __r; \
314})
315
316#define __HAVE_ARCH_PTEP_SET_WRPROTECT
317static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
318 pte_t *ptep)
319{
320 unsigned long old;
321
322 if ((pte_val(*ptep) & _PAGE_RW) == 0)
323 return;
324 old = pte_update(mm, addr, ptep, _PAGE_RW, 0);
325}
326
327static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
328 unsigned long addr, pte_t *ptep)
329{
330 unsigned long old;
331
332 if ((pte_val(*ptep) & _PAGE_RW) == 0)
333 return;
334 old = pte_update(mm, addr, ptep, _PAGE_RW, 1);
335}
336
337/*
338 * We currently remove entries from the hashtable regardless of whether
339 * the entry was young or dirty. The generic routines only flush if the
340 * entry was young or dirty which is not good enough.
341 *
342 * We should be more intelligent about this but for the moment we override
343 * these functions and force a tlb flush unconditionally
344 */
345#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
346#define ptep_clear_flush_young(__vma, __address, __ptep) \
347({ \
348 int __young = __ptep_test_and_clear_young((__vma)->vm_mm, __address, \
349 __ptep); \
350 __young; \
351})
352
353#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
354static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
355 unsigned long addr, pte_t *ptep)
356{
357 unsigned long old = pte_update(mm, addr, ptep, ~0UL, 0);
358 return __pte(old);
359}
360
361static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
362 pte_t * ptep)
363{
364 pte_update(mm, addr, ptep, ~0UL, 0);
365}
366
367/*
368 * set_pte stores a linux PTE into the linux page table.
369 */
370static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
371 pte_t *ptep, pte_t pte)
372{
373 if (pte_present(*ptep))
374 pte_clear(mm, addr, ptep);
375 pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS);
376 *ptep = pte;
377}
378
379/* Set the dirty and/or accessed bits atomically in a linux PTE, this
380 * function doesn't need to flush the hash entry
381 */
382#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
383static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
384{
385 unsigned long bits = pte_val(entry) &
386 (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
387 unsigned long old, tmp;
388
389 __asm__ __volatile__(
390 "1: ldarx %0,0,%4\n\
391 andi. %1,%0,%6\n\
392 bne- 1b \n\
393 or %0,%3,%0\n\
394 stdcx. %0,0,%4\n\
395 bne- 1b"
396 :"=&r" (old), "=&r" (tmp), "=m" (*ptep)
397 :"r" (bits), "r" (ptep), "m" (*ptep), "i" (_PAGE_BUSY)
398 :"cc");
399}
400#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
401({ \
402 int __changed = !pte_same(*(__ptep), __entry); \
403 if (__changed) { \
404 __ptep_set_access_flags(__ptep, __entry, __dirty); \
405 flush_tlb_page_nohash(__vma, __address); \
406 } \
407 __changed; \
408})
409
410/*
411 * Macro to mark a page protection value as "uncacheable".
412 */
413#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED))
414
415struct file;
416extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
417 unsigned long size, pgprot_t vma_prot);
418#define __HAVE_PHYS_MEM_ACCESS_PROT
419
420#define __HAVE_ARCH_PTE_SAME
421#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0)
422
423#define pte_ERROR(e) \
424 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
425#define pmd_ERROR(e) \
426 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
427#define pgd_ERROR(e) \
428 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
429
430/* Encode and de-code a swap entry */
431#define __swp_type(entry) (((entry).val >> 1) & 0x3f)
432#define __swp_offset(entry) ((entry).val >> 8)
433#define __swp_entry(type, offset) ((swp_entry_t){((type)<< 1)|((offset)<<8)})
434#define __pte_to_swp_entry(pte) ((swp_entry_t){pte_val(pte) >> PTE_RPN_SHIFT})
435#define __swp_entry_to_pte(x) ((pte_t) { (x).val << PTE_RPN_SHIFT })
436#define pte_to_pgoff(pte) (pte_val(pte) >> PTE_RPN_SHIFT)
437#define pgoff_to_pte(off) ((pte_t) {((off) << PTE_RPN_SHIFT)|_PAGE_FILE})
438#define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT)
439
440void pgtable_cache_init(void);
441
442/*
443 * find_linux_pte returns the address of a linux pte for a given
444 * effective address and directory. If not found, it returns zero.
445 */static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea)
446{
447 pgd_t *pg;
448 pud_t *pu;
449 pmd_t *pm;
450 pte_t *pt = NULL;
451
452 pg = pgdir + pgd_index(ea);
453 if (!pgd_none(*pg)) {
454 pu = pud_offset(pg, ea);
455 if (!pud_none(*pu)) {
456 pm = pmd_offset(pu, ea);
457 if (pmd_present(*pm))
458 pt = pte_offset_kernel(pm, ea);
459 }
460 }
461 return pt;
462}
463
464pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long address);
465
466#endif /* __ASSEMBLY__ */
467
468#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
new file mode 100644
index 000000000000..dbb8ca172e44
--- /dev/null
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -0,0 +1,57 @@
1#ifndef _ASM_POWERPC_PGTABLE_H
2#define _ASM_POWERPC_PGTABLE_H
3#ifdef __KERNEL__
4
5#ifndef __ASSEMBLY__
6#include <asm/processor.h> /* For TASK_SIZE */
7#include <asm/mmu.h>
8#include <asm/page.h>
9struct mm_struct;
10#endif /* !__ASSEMBLY__ */
11
12#if defined(CONFIG_PPC64)
13# include <asm/pgtable-ppc64.h>
14#else
15# include <asm/pgtable-ppc32.h>
16#endif
17
18#ifndef __ASSEMBLY__
19/*
20 * ZERO_PAGE is a global shared page that is always zero: used
21 * for zero-mapped memory areas etc..
22 */
23extern unsigned long empty_zero_page[];
24#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
25
26extern pgd_t swapper_pg_dir[];
27
28extern void paging_init(void);
29
30/*
31 * kern_addr_valid is intended to indicate whether an address is a valid
32 * kernel address. Most 32-bit archs define it as always true (like this)
33 * but most 64-bit archs actually perform a test. What should we do here?
34 */
35#define kern_addr_valid(addr) (1)
36
37#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
38 remap_pfn_range(vma, vaddr, pfn, size, prot)
39
40#include <asm-generic/pgtable.h>
41
42
43/*
44 * This gets called at the end of handling a page fault, when
45 * the kernel has put a new PTE into the page table for the process.
46 * We use it to ensure coherency between the i-cache and d-cache
47 * for the page which has just been mapped in.
48 * On machines which use an MMU hash table, we use this to put a
49 * corresponding HPTE into the hash table ahead of time, instead of
50 * waiting for the inevitable extra hash-table miss exception.
51 */
52extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
53
54#endif /* __ASSEMBLY__ */
55
56#endif /* __KERNEL__ */
57#endif /* _ASM_POWERPC_PGTABLE_H */
diff --git a/arch/powerpc/include/asm/phyp_dump.h b/arch/powerpc/include/asm/phyp_dump.h
new file mode 100644
index 000000000000..fa74c6c3e106
--- /dev/null
+++ b/arch/powerpc/include/asm/phyp_dump.h
@@ -0,0 +1,47 @@
1/*
2 * Hypervisor-assisted dump
3 *
4 * Linas Vepstas, Manish Ahuja 2008
5 * Copyright 2008 IBM Corp.
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#ifndef _PPC64_PHYP_DUMP_H
14#define _PPC64_PHYP_DUMP_H
15
16#ifdef CONFIG_PHYP_DUMP
17
18/* The RMR region will be saved for later dumping
19 * whenever the kernel crashes. Set this to 256MB. */
20#define PHYP_DUMP_RMR_START 0x0
21#define PHYP_DUMP_RMR_END (1UL<<28)
22
23struct phyp_dump {
24 /* Memory that is reserved during very early boot. */
25 unsigned long init_reserve_start;
26 unsigned long init_reserve_size;
27 /* cmd line options during boot */
28 unsigned long reserve_bootvar;
29 unsigned long phyp_dump_at_boot;
30 /* Check status during boot if dump supported, active & present*/
31 unsigned long phyp_dump_configured;
32 unsigned long phyp_dump_is_active;
33 /* store cpu & hpte size */
34 unsigned long cpu_state_size;
35 unsigned long hpte_region_size;
36 /* previous scratch area values */
37 unsigned long reserved_scratch_addr;
38 unsigned long reserved_scratch_size;
39};
40
41extern struct phyp_dump *phyp_dump_info;
42
43int early_init_dt_scan_phyp_dump(unsigned long node,
44 const char *uname, int depth, void *data);
45
46#endif /* CONFIG_PHYP_DUMP */
47#endif /* _PPC64_PHYP_DUMP_H */
diff --git a/arch/powerpc/include/asm/pmac_feature.h b/arch/powerpc/include/asm/pmac_feature.h
new file mode 100644
index 000000000000..877c35a4356e
--- /dev/null
+++ b/arch/powerpc/include/asm/pmac_feature.h
@@ -0,0 +1,405 @@
1/*
2 * Definition of platform feature hooks for PowerMacs
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 * Copyright (C) 1998 Paul Mackerras &
9 * Ben. Herrenschmidt.
10 *
11 *
12 * Note: I removed media-bay details from the feature stuff, I believe it's
13 * not worth it, the media-bay driver can directly use the mac-io
14 * ASIC registers.
15 *
16 * Implementation note: Currently, none of these functions will block.
17 * However, they may internally protect themselves with a spinlock
18 * for way too long. Be prepared for at least some of these to block
19 * in the future.
20 *
21 * Unless specifically defined, the result code is assumed to be an
22 * error when negative, 0 is the default success result. Some functions
23 * may return additional positive result values.
24 *
25 * To keep implementation simple, all feature calls are assumed to have
26 * the prototype parameters (struct device_node* node, int value).
27 * When either is not used, pass 0.
28 */
29
30#ifdef __KERNEL__
31#ifndef __ASM_POWERPC_PMAC_FEATURE_H
32#define __ASM_POWERPC_PMAC_FEATURE_H
33
34#include <asm/macio.h>
35#include <asm/machdep.h>
36
37/*
38 * Known Mac motherboard models
39 *
40 * Please, report any error here to benh@kernel.crashing.org, thanks !
41 *
42 * Note that I don't fully maintain this list for Core99 & MacRISC2
43 * and I'm considering removing all NewWorld entries from it and
44 * entirely rely on the model string.
45 */
46
47/* PowerSurge are the first generation of PCI Pmacs. This include
48 * all of the Grand-Central based machines. We currently don't
49 * differenciate most of them.
50 */
51#define PMAC_TYPE_PSURGE 0x10 /* PowerSurge */
52#define PMAC_TYPE_ANS 0x11 /* Apple Network Server */
53
54/* Here is the infamous serie of OHare based machines
55 */
56#define PMAC_TYPE_COMET 0x20 /* Beleived to be PowerBook 2400 */
57#define PMAC_TYPE_HOOPER 0x21 /* Beleived to be PowerBook 3400 */
58#define PMAC_TYPE_KANGA 0x22 /* PowerBook 3500 (first G3) */
59#define PMAC_TYPE_ALCHEMY 0x23 /* Alchemy motherboard base */
60#define PMAC_TYPE_GAZELLE 0x24 /* Spartacus, some 5xxx/6xxx */
61#define PMAC_TYPE_UNKNOWN_OHARE 0x2f /* Unknown, but OHare based */
62
63/* Here are the Heathrow based machines
64 * FIXME: Differenciate wallstreet,mainstreet,wallstreetII
65 */
66#define PMAC_TYPE_GOSSAMER 0x30 /* Gossamer motherboard */
67#define PMAC_TYPE_SILK 0x31 /* Desktop PowerMac G3 */
68#define PMAC_TYPE_WALLSTREET 0x32 /* Wallstreet/Mainstreet PowerBook*/
69#define PMAC_TYPE_UNKNOWN_HEATHROW 0x3f /* Unknown but heathrow based */
70
71/* Here are newworld machines based on Paddington (heathrow derivative)
72 */
73#define PMAC_TYPE_101_PBOOK 0x40 /* 101 PowerBook (aka Lombard) */
74#define PMAC_TYPE_ORIG_IMAC 0x41 /* First generation iMac */
75#define PMAC_TYPE_YOSEMITE 0x42 /* B&W G3 */
76#define PMAC_TYPE_YIKES 0x43 /* Yikes G4 (PCI graphics) */
77#define PMAC_TYPE_UNKNOWN_PADDINGTON 0x4f /* Unknown but paddington based */
78
79/* Core99 machines based on UniNorth 1.0 and 1.5
80 *
81 * Note: A single entry here may cover several actual models according
82 * to the device-tree. (Sawtooth is most tower G4s, FW_IMAC is most
83 * FireWire based iMacs, etc...). Those machines are too similar to be
84 * distinguished here, when they need to be differencied, use the
85 * device-tree "model" or "compatible" property.
86 */
87#define PMAC_TYPE_ORIG_IBOOK 0x40 /* First iBook model (no firewire) */
88#define PMAC_TYPE_SAWTOOTH 0x41 /* Desktop G4s */
89#define PMAC_TYPE_FW_IMAC 0x42 /* FireWire iMacs (except Pangea based) */
90#define PMAC_TYPE_FW_IBOOK 0x43 /* FireWire iBooks (except iBook2) */
91#define PMAC_TYPE_CUBE 0x44 /* Cube PowerMac */
92#define PMAC_TYPE_QUICKSILVER 0x45 /* QuickSilver G4s */
93#define PMAC_TYPE_PISMO 0x46 /* Pismo PowerBook */
94#define PMAC_TYPE_TITANIUM 0x47 /* Titanium PowerBook */
95#define PMAC_TYPE_TITANIUM2 0x48 /* Titanium II PowerBook (no L3, M6) */
96#define PMAC_TYPE_TITANIUM3 0x49 /* Titanium III PowerBook (with L3 & M7) */
97#define PMAC_TYPE_TITANIUM4 0x50 /* Titanium IV PowerBook (with L3 & M9) */
98#define PMAC_TYPE_EMAC 0x50 /* eMac */
99#define PMAC_TYPE_UNKNOWN_CORE99 0x5f
100
101/* MacRisc2 with UniNorth 2.0 */
102#define PMAC_TYPE_RACKMAC 0x80 /* XServe */
103#define PMAC_TYPE_WINDTUNNEL 0x81
104
105/* MacRISC2 machines based on the Pangea chipset
106 */
107#define PMAC_TYPE_PANGEA_IMAC 0x100 /* Flower Power iMac */
108#define PMAC_TYPE_IBOOK2 0x101 /* iBook2 (polycarbonate) */
109#define PMAC_TYPE_FLAT_PANEL_IMAC 0x102 /* Flat panel iMac */
110#define PMAC_TYPE_UNKNOWN_PANGEA 0x10f
111
112/* MacRISC2 machines based on the Intrepid chipset
113 */
114#define PMAC_TYPE_UNKNOWN_INTREPID 0x11f /* Generic */
115
116/* MacRISC4 / G5 machines. We don't have per-machine selection here anymore,
117 * but rather machine families
118 */
119#define PMAC_TYPE_POWERMAC_G5 0x150 /* U3 & U3H based */
120#define PMAC_TYPE_POWERMAC_G5_U3L 0x151 /* U3L based desktop */
121#define PMAC_TYPE_IMAC_G5 0x152 /* iMac G5 */
122#define PMAC_TYPE_XSERVE_G5 0x153 /* Xserve G5 */
123#define PMAC_TYPE_UNKNOWN_K2 0x19f /* Any other K2 based */
124#define PMAC_TYPE_UNKNOWN_SHASTA 0x19e /* Any other Shasta based */
125
126/*
127 * Motherboard flags
128 */
129
130#define PMAC_MB_CAN_SLEEP 0x00000001
131#define PMAC_MB_HAS_FW_POWER 0x00000002
132#define PMAC_MB_OLD_CORE99 0x00000004
133#define PMAC_MB_MOBILE 0x00000008
134#define PMAC_MB_MAY_SLEEP 0x00000010
135
136/*
137 * Feature calls supported on pmac
138 *
139 */
140
141/*
142 * Use this inline wrapper
143 */
144struct device_node;
145
146static inline long pmac_call_feature(int selector, struct device_node* node,
147 long param, long value)
148{
149 if (!ppc_md.feature_call || !machine_is(powermac))
150 return -ENODEV;
151 return ppc_md.feature_call(selector, node, param, value);
152}
153
154/* PMAC_FTR_SERIAL_ENABLE (struct device_node* node, int param, int value)
155 * enable/disable an SCC side. Pass the node corresponding to the
156 * channel side as a parameter.
157 * param is the type of port
158 * if param is ored with PMAC_SCC_FLAG_XMON, then the SCC is locked enabled
159 * for use by xmon.
160 */
161#define PMAC_FTR_SCC_ENABLE PMAC_FTR_DEF(0)
162 #define PMAC_SCC_ASYNC 0
163 #define PMAC_SCC_IRDA 1
164 #define PMAC_SCC_I2S1 2
165 #define PMAC_SCC_FLAG_XMON 0x00001000
166
167/* PMAC_FTR_MODEM_ENABLE (struct device_node* node, 0, int value)
168 * enable/disable the internal modem.
169 */
170#define PMAC_FTR_MODEM_ENABLE PMAC_FTR_DEF(1)
171
172/* PMAC_FTR_SWIM3_ENABLE (struct device_node* node, 0,int value)
173 * enable/disable the swim3 (floppy) cell of a mac-io ASIC
174 */
175#define PMAC_FTR_SWIM3_ENABLE PMAC_FTR_DEF(2)
176
177/* PMAC_FTR_MESH_ENABLE (struct device_node* node, 0, int value)
178 * enable/disable the mesh (scsi) cell of a mac-io ASIC
179 */
180#define PMAC_FTR_MESH_ENABLE PMAC_FTR_DEF(3)
181
182/* PMAC_FTR_IDE_ENABLE (struct device_node* node, int busID, int value)
183 * enable/disable an IDE port of a mac-io ASIC
184 * pass the busID parameter
185 */
186#define PMAC_FTR_IDE_ENABLE PMAC_FTR_DEF(4)
187
188/* PMAC_FTR_IDE_RESET (struct device_node* node, int busID, int value)
189 * assert(1)/release(0) an IDE reset line (mac-io IDE only)
190 */
191#define PMAC_FTR_IDE_RESET PMAC_FTR_DEF(5)
192
193/* PMAC_FTR_BMAC_ENABLE (struct device_node* node, 0, int value)
194 * enable/disable the bmac (ethernet) cell of a mac-io ASIC, also drive
195 * it's reset line
196 */
197#define PMAC_FTR_BMAC_ENABLE PMAC_FTR_DEF(6)
198
199/* PMAC_FTR_GMAC_ENABLE (struct device_node* node, 0, int value)
200 * enable/disable the gmac (ethernet) cell of an uninorth ASIC. This
201 * control the cell's clock.
202 */
203#define PMAC_FTR_GMAC_ENABLE PMAC_FTR_DEF(7)
204
205/* PMAC_FTR_GMAC_PHY_RESET (struct device_node* node, 0, 0)
206 * Perform a HW reset of the PHY connected to a gmac controller.
207 * Pass the gmac device node, not the PHY node.
208 */
209#define PMAC_FTR_GMAC_PHY_RESET PMAC_FTR_DEF(8)
210
211/* PMAC_FTR_SOUND_CHIP_ENABLE (struct device_node* node, 0, int value)
212 * enable/disable the sound chip, whatever it is and provided it can
213 * acually be controlled
214 */
215#define PMAC_FTR_SOUND_CHIP_ENABLE PMAC_FTR_DEF(9)
216
217/* -- add various tweaks related to sound routing -- */
218
219/* PMAC_FTR_AIRPORT_ENABLE (struct device_node* node, 0, int value)
220 * enable/disable the airport card
221 */
222#define PMAC_FTR_AIRPORT_ENABLE PMAC_FTR_DEF(10)
223
224/* PMAC_FTR_RESET_CPU (NULL, int cpu_nr, 0)
225 * toggle the reset line of a CPU on an uninorth-based SMP machine
226 */
227#define PMAC_FTR_RESET_CPU PMAC_FTR_DEF(11)
228
229/* PMAC_FTR_USB_ENABLE (struct device_node* node, 0, int value)
230 * enable/disable an USB cell, along with the power of the USB "pad"
231 * on keylargo based machines
232 */
233#define PMAC_FTR_USB_ENABLE PMAC_FTR_DEF(12)
234
235/* PMAC_FTR_1394_ENABLE (struct device_node* node, 0, int value)
236 * enable/disable the firewire cell of an uninorth ASIC.
237 */
238#define PMAC_FTR_1394_ENABLE PMAC_FTR_DEF(13)
239
240/* PMAC_FTR_1394_CABLE_POWER (struct device_node* node, 0, int value)
241 * enable/disable the firewire cable power supply of the uninorth
242 * firewire cell
243 */
244#define PMAC_FTR_1394_CABLE_POWER PMAC_FTR_DEF(14)
245
246/* PMAC_FTR_SLEEP_STATE (struct device_node* node, 0, int value)
247 * set the sleep state of the motherboard.
248 *
249 * Pass -1 as value to query for sleep capability
250 * Pass 1 to set IOs to sleep
251 * Pass 0 to set IOs to wake
252 */
253#define PMAC_FTR_SLEEP_STATE PMAC_FTR_DEF(15)
254
255/* PMAC_FTR_GET_MB_INFO (NULL, selector, 0)
256 *
257 * returns some motherboard infos.
258 * selector: 0 - model id
259 * 1 - model flags (capabilities)
260 * 2 - model name (cast to const char *)
261 */
262#define PMAC_FTR_GET_MB_INFO PMAC_FTR_DEF(16)
263#define PMAC_MB_INFO_MODEL 0
264#define PMAC_MB_INFO_FLAGS 1
265#define PMAC_MB_INFO_NAME 2
266
267/* PMAC_FTR_READ_GPIO (NULL, int index, 0)
268 *
269 * read a GPIO from a mac-io controller of type KeyLargo or Pangea.
270 * the value returned is a byte (positive), or a negative error code
271 */
272#define PMAC_FTR_READ_GPIO PMAC_FTR_DEF(17)
273
274/* PMAC_FTR_WRITE_GPIO (NULL, int index, int value)
275 *
276 * write a GPIO of a mac-io controller of type KeyLargo or Pangea.
277 */
278#define PMAC_FTR_WRITE_GPIO PMAC_FTR_DEF(18)
279
280/* PMAC_FTR_ENABLE_MPIC
281 *
282 * Enable the MPIC cell
283 */
284#define PMAC_FTR_ENABLE_MPIC PMAC_FTR_DEF(19)
285
286/* PMAC_FTR_AACK_DELAY_ENABLE (NULL, int enable, 0)
287 *
288 * Enable/disable the AACK delay on the northbridge for systems using DFS
289 */
290#define PMAC_FTR_AACK_DELAY_ENABLE PMAC_FTR_DEF(20)
291
292/* PMAC_FTR_DEVICE_CAN_WAKE
293 *
294 * Used by video drivers to inform system that they can actually perform
295 * wakeup from sleep
296 */
297#define PMAC_FTR_DEVICE_CAN_WAKE PMAC_FTR_DEF(22)
298
299
300/* Don't use those directly, they are for the sake of pmac_setup.c */
301extern long pmac_do_feature_call(unsigned int selector, ...);
302extern void pmac_feature_init(void);
303
304/* Video suspend tweak */
305extern void pmac_set_early_video_resume(void (*proc)(void *data), void *data);
306extern void pmac_call_early_video_resume(void);
307
308#define PMAC_FTR_DEF(x) ((0x6660000) | (x))
309
310/* The AGP driver registers itself here */
311extern void pmac_register_agp_pm(struct pci_dev *bridge,
312 int (*suspend)(struct pci_dev *bridge),
313 int (*resume)(struct pci_dev *bridge));
314
315/* Those are meant to be used by video drivers to deal with AGP
316 * suspend resume properly
317 */
318extern void pmac_suspend_agp_for_card(struct pci_dev *dev);
319extern void pmac_resume_agp_for_card(struct pci_dev *dev);
320
321/*
322 * The part below is for use by macio_asic.c only, do not rely
323 * on the data structures or constants below in a normal driver
324 *
325 */
326
327#define MAX_MACIO_CHIPS 2
328
329enum {
330 macio_unknown = 0,
331 macio_grand_central,
332 macio_ohare,
333 macio_ohareII,
334 macio_heathrow,
335 macio_gatwick,
336 macio_paddington,
337 macio_keylargo,
338 macio_pangea,
339 macio_intrepid,
340 macio_keylargo2,
341 macio_shasta,
342};
343
344struct macio_chip
345{
346 struct device_node *of_node;
347 int type;
348 const char *name;
349 int rev;
350 volatile u32 __iomem *base;
351 unsigned long flags;
352
353 /* For use by macio_asic PCI driver */
354 struct macio_bus lbus;
355};
356
357extern struct macio_chip macio_chips[MAX_MACIO_CHIPS];
358
359#define MACIO_FLAG_SCCA_ON 0x00000001
360#define MACIO_FLAG_SCCB_ON 0x00000002
361#define MACIO_FLAG_SCC_LOCKED 0x00000004
362#define MACIO_FLAG_AIRPORT_ON 0x00000010
363#define MACIO_FLAG_FW_SUPPORTED 0x00000020
364
365extern struct macio_chip* macio_find(struct device_node* child, int type);
366
367#define MACIO_FCR32(macio, r) ((macio)->base + ((r) >> 2))
368#define MACIO_FCR8(macio, r) (((volatile u8 __iomem *)((macio)->base)) + (r))
369
370#define MACIO_IN32(r) (in_le32(MACIO_FCR32(macio,r)))
371#define MACIO_OUT32(r,v) (out_le32(MACIO_FCR32(macio,r), (v)))
372#define MACIO_BIS(r,v) (MACIO_OUT32((r), MACIO_IN32(r) | (v)))
373#define MACIO_BIC(r,v) (MACIO_OUT32((r), MACIO_IN32(r) & ~(v)))
374#define MACIO_IN8(r) (in_8(MACIO_FCR8(macio,r)))
375#define MACIO_OUT8(r,v) (out_8(MACIO_FCR8(macio,r), (v)))
376
377/*
378 * Those are exported by pmac feature for internal use by arch code
379 * only like the platform function callbacks, do not use directly in drivers
380 */
381extern spinlock_t feature_lock;
382extern struct device_node *uninorth_node;
383extern u32 __iomem *uninorth_base;
384
385/*
386 * Uninorth reg. access. Note that Uni-N regs are big endian
387 */
388
389#define UN_REG(r) (uninorth_base + ((r) >> 2))
390#define UN_IN(r) (in_be32(UN_REG(r)))
391#define UN_OUT(r,v) (out_be32(UN_REG(r), (v)))
392#define UN_BIS(r,v) (UN_OUT((r), UN_IN(r) | (v)))
393#define UN_BIC(r,v) (UN_OUT((r), UN_IN(r) & ~(v)))
394
395/* Uninorth variant:
396 *
397 * 0 = not uninorth
398 * 1 = U1.x or U2.x
399 * 3 = U3
400 * 4 = U4
401 */
402extern int pmac_get_uninorth_variant(void);
403
404#endif /* __ASM_POWERPC_PMAC_FEATURE_H */
405#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/pmac_low_i2c.h b/arch/powerpc/include/asm/pmac_low_i2c.h
new file mode 100644
index 000000000000..131011bd7e76
--- /dev/null
+++ b/arch/powerpc/include/asm/pmac_low_i2c.h
@@ -0,0 +1,107 @@
1/*
2 * include/asm-ppc/pmac_low_i2c.h
3 *
4 * Copyright (C) 2003 Ben. Herrenschmidt (benh@kernel.crashing.org)
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#ifndef __PMAC_LOW_I2C_H__
13#define __PMAC_LOW_I2C_H__
14#ifdef __KERNEL__
15
16/* i2c mode (based on the platform functions format) */
17enum {
18 pmac_i2c_mode_dumb = 1,
19 pmac_i2c_mode_std = 2,
20 pmac_i2c_mode_stdsub = 3,
21 pmac_i2c_mode_combined = 4,
22};
23
24/* RW bit in address */
25enum {
26 pmac_i2c_read = 0x01,
27 pmac_i2c_write = 0x00
28};
29
30/* i2c bus type */
31enum {
32 pmac_i2c_bus_keywest = 0,
33 pmac_i2c_bus_pmu = 1,
34 pmac_i2c_bus_smu = 2,
35};
36
37/* i2c bus features */
38enum {
39 /* can_largesub : supports >1 byte subaddresses (SMU only) */
40 pmac_i2c_can_largesub = 0x00000001u,
41
42 /* multibus : device node holds multiple busses, bus number is
43 * encoded in bits 0xff00 of "reg" of a given device
44 */
45 pmac_i2c_multibus = 0x00000002u,
46};
47
48/* i2c busses in the system */
49struct pmac_i2c_bus;
50struct i2c_adapter;
51
52/* Init, called early during boot */
53extern int pmac_i2c_init(void);
54
55/* Lookup an i2c bus for a device-node. The node can be either the bus
56 * node itself or a device below it. In the case of a multibus, the bus
57 * node itself is the controller node, else, it's a child of the controller
58 * node
59 */
60extern struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node);
61
62/* Get the address for an i2c device. This strips the bus number if
63 * necessary. The 7 bits address is returned 1 bit right shifted so that the
64 * direction can be directly ored in
65 */
66extern u8 pmac_i2c_get_dev_addr(struct device_node *device);
67
68/* Get infos about a bus */
69extern struct device_node *pmac_i2c_get_controller(struct pmac_i2c_bus *bus);
70extern struct device_node *pmac_i2c_get_bus_node(struct pmac_i2c_bus *bus);
71extern int pmac_i2c_get_type(struct pmac_i2c_bus *bus);
72extern int pmac_i2c_get_flags(struct pmac_i2c_bus *bus);
73extern int pmac_i2c_get_channel(struct pmac_i2c_bus *bus);
74
75/* i2c layer adapter attach/detach */
76extern void pmac_i2c_attach_adapter(struct pmac_i2c_bus *bus,
77 struct i2c_adapter *adapter);
78extern void pmac_i2c_detach_adapter(struct pmac_i2c_bus *bus,
79 struct i2c_adapter *adapter);
80extern struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus);
81extern struct pmac_i2c_bus *pmac_i2c_adapter_to_bus(struct i2c_adapter *adapter);
82
83/* March a device or bus with an i2c adapter structure, to be used by drivers
84 * to match device-tree nodes with i2c adapters during adapter discovery
85 * callbacks
86 */
87extern int pmac_i2c_match_adapter(struct device_node *dev,
88 struct i2c_adapter *adapter);
89
90
91/* (legacy) Locking functions exposed to i2c-keywest */
92extern int pmac_low_i2c_lock(struct device_node *np);
93extern int pmac_low_i2c_unlock(struct device_node *np);
94
95/* Access functions for platform code */
96extern int pmac_i2c_open(struct pmac_i2c_bus *bus, int polled);
97extern void pmac_i2c_close(struct pmac_i2c_bus *bus);
98extern int pmac_i2c_setmode(struct pmac_i2c_bus *bus, int mode);
99extern int pmac_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
100 u32 subaddr, u8 *data, int len);
101
102/* Suspend/resume code called by via-pmu directly for now */
103extern void pmac_pfunc_i2c_suspend(void);
104extern void pmac_pfunc_i2c_resume(void);
105
106#endif /* __KERNEL__ */
107#endif /* __PMAC_LOW_I2C_H__ */
diff --git a/arch/powerpc/include/asm/pmac_pfunc.h b/arch/powerpc/include/asm/pmac_pfunc.h
new file mode 100644
index 000000000000..1330d6a58c57
--- /dev/null
+++ b/arch/powerpc/include/asm/pmac_pfunc.h
@@ -0,0 +1,252 @@
1#ifndef __PMAC_PFUNC_H__
2#define __PMAC_PFUNC_H__
3
4#include <linux/types.h>
5#include <linux/list.h>
6
7/* Flags in command lists */
8#define PMF_FLAGS_ON_INIT 0x80000000u
9#define PMF_FLGAS_ON_TERM 0x40000000u
10#define PMF_FLAGS_ON_SLEEP 0x20000000u
11#define PMF_FLAGS_ON_WAKE 0x10000000u
12#define PMF_FLAGS_ON_DEMAND 0x08000000u
13#define PMF_FLAGS_INT_GEN 0x04000000u
14#define PMF_FLAGS_HIGH_SPEED 0x02000000u
15#define PMF_FLAGS_LOW_SPEED 0x01000000u
16#define PMF_FLAGS_SIDE_EFFECTS 0x00800000u
17
18/*
19 * Arguments to a platform function call.
20 *
21 * NOTE: By convention, pointer arguments point to an u32
22 */
23struct pmf_args {
24 union {
25 u32 v;
26 u32 *p;
27 } u[4];
28 unsigned int count;
29};
30
31/*
32 * A driver capable of interpreting commands provides a handlers
33 * structure filled with whatever handlers are implemented by this
34 * driver. Non implemented handlers are left NULL.
35 *
36 * PMF_STD_ARGS are the same arguments that are passed to the parser
37 * and that gets passed back to the various handlers.
38 *
39 * Interpreting a given function always start with a begin() call which
40 * returns an instance data to be passed around subsequent calls, and
41 * ends with an end() call. This allows the low level driver to implement
42 * locking policy or per-function instance data.
43 *
44 * For interrupt capable functions, irq_enable() is called when a client
45 * registers, and irq_disable() is called when the last client unregisters
46 * Note that irq_enable & irq_disable are called within a semaphore held
47 * by the core, thus you should not try to register yourself to some other
48 * pmf interrupt during those calls.
49 */
50
51#define PMF_STD_ARGS struct pmf_function *func, void *instdata, \
52 struct pmf_args *args
53
54struct pmf_function;
55
56struct pmf_handlers {
57 void * (*begin)(struct pmf_function *func, struct pmf_args *args);
58 void (*end)(struct pmf_function *func, void *instdata);
59
60 int (*irq_enable)(struct pmf_function *func);
61 int (*irq_disable)(struct pmf_function *func);
62
63 int (*write_gpio)(PMF_STD_ARGS, u8 value, u8 mask);
64 int (*read_gpio)(PMF_STD_ARGS, u8 mask, int rshift, u8 xor);
65
66 int (*write_reg32)(PMF_STD_ARGS, u32 offset, u32 value, u32 mask);
67 int (*read_reg32)(PMF_STD_ARGS, u32 offset);
68 int (*write_reg16)(PMF_STD_ARGS, u32 offset, u16 value, u16 mask);
69 int (*read_reg16)(PMF_STD_ARGS, u32 offset);
70 int (*write_reg8)(PMF_STD_ARGS, u32 offset, u8 value, u8 mask);
71 int (*read_reg8)(PMF_STD_ARGS, u32 offset);
72
73 int (*delay)(PMF_STD_ARGS, u32 duration);
74
75 int (*wait_reg32)(PMF_STD_ARGS, u32 offset, u32 value, u32 mask);
76 int (*wait_reg16)(PMF_STD_ARGS, u32 offset, u16 value, u16 mask);
77 int (*wait_reg8)(PMF_STD_ARGS, u32 offset, u8 value, u8 mask);
78
79 int (*read_i2c)(PMF_STD_ARGS, u32 len);
80 int (*write_i2c)(PMF_STD_ARGS, u32 len, const u8 *data);
81 int (*rmw_i2c)(PMF_STD_ARGS, u32 masklen, u32 valuelen, u32 totallen,
82 const u8 *maskdata, const u8 *valuedata);
83
84 int (*read_cfg)(PMF_STD_ARGS, u32 offset, u32 len);
85 int (*write_cfg)(PMF_STD_ARGS, u32 offset, u32 len, const u8 *data);
86 int (*rmw_cfg)(PMF_STD_ARGS, u32 offset, u32 masklen, u32 valuelen,
87 u32 totallen, const u8 *maskdata, const u8 *valuedata);
88
89 int (*read_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 len);
90 int (*write_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 len, const u8 *data);
91 int (*set_i2c_mode)(PMF_STD_ARGS, int mode);
92 int (*rmw_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 masklen, u32 valuelen,
93 u32 totallen, const u8 *maskdata,
94 const u8 *valuedata);
95
96 int (*read_reg32_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift,
97 u32 xor);
98 int (*read_reg16_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift,
99 u32 xor);
100 int (*read_reg8_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift,
101 u32 xor);
102
103 int (*write_reg32_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask);
104 int (*write_reg16_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask);
105 int (*write_reg8_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask);
106
107 int (*mask_and_compare)(PMF_STD_ARGS, u32 len, const u8 *maskdata,
108 const u8 *valuedata);
109
110 struct module *owner;
111};
112
113
114/*
115 * Drivers who expose platform functions register at init time, this
116 * causes the platform functions for that device node to be parsed in
117 * advance and associated with the device. The data structures are
118 * partially public so a driver can walk the list of platform functions
119 * and eventually inspect the flags
120 */
121struct pmf_device;
122
123struct pmf_function {
124 /* All functions for a given driver are linked */
125 struct list_head link;
126
127 /* Function node & driver data */
128 struct device_node *node;
129 void *driver_data;
130
131 /* For internal use by core */
132 struct pmf_device *dev;
133
134 /* The name is the "xxx" in "platform-do-xxx", this is how
135 * platform functions are identified by this code. Some functions
136 * only operate for a given target, in which case the phandle is
137 * here (or 0 if the filter doesn't apply)
138 */
139 const char *name;
140 u32 phandle;
141
142 /* The flags for that function. You can have several functions
143 * with the same name and different flag
144 */
145 u32 flags;
146
147 /* The actual tokenized function blob */
148 const void *data;
149 unsigned int length;
150
151 /* Interrupt clients */
152 struct list_head irq_clients;
153
154 /* Refcounting */
155 struct kref ref;
156};
157
158/*
159 * For platform functions that are interrupts, one can register
160 * irq_client structures. You canNOT use the same structure twice
161 * as it contains a link member. Also, the callback is called with
162 * a spinlock held, you must not call back into any of the pmf_* functions
163 * from within that callback
164 */
165struct pmf_irq_client {
166 void (*handler)(void *data);
167 void *data;
168 struct module *owner;
169 struct list_head link;
170 struct pmf_function *func;
171};
172
173
174/*
175 * Register/Unregister a function-capable driver and its handlers
176 */
177extern int pmf_register_driver(struct device_node *np,
178 struct pmf_handlers *handlers,
179 void *driverdata);
180
181extern void pmf_unregister_driver(struct device_node *np);
182
183
184/*
185 * Register/Unregister interrupt clients
186 */
187extern int pmf_register_irq_client(struct device_node *np,
188 const char *name,
189 struct pmf_irq_client *client);
190
191extern void pmf_unregister_irq_client(struct pmf_irq_client *client);
192
193/*
194 * Called by the handlers when an irq happens
195 */
196extern void pmf_do_irq(struct pmf_function *func);
197
198
199/*
200 * Low level call to platform functions.
201 *
202 * The phandle can filter on the target object for functions that have
203 * multiple targets, the flags allow you to restrict the call to a given
204 * combination of flags.
205 *
206 * The args array contains as many arguments as is required by the function,
207 * this is dependent on the function you are calling, unfortunately Apple
208 * mechanism provides no way to encode that so you have to get it right at
209 * the call site. Some functions require no args, in which case, you can
210 * pass NULL.
211 *
212 * You can also pass NULL to the name. This will match any function that has
213 * the appropriate combination of flags & phandle or you can pass 0 to the
214 * phandle to match any
215 */
216extern int pmf_do_functions(struct device_node *np, const char *name,
217 u32 phandle, u32 flags, struct pmf_args *args);
218
219
220
221/*
222 * High level call to a platform function.
223 *
224 * This one looks for the platform-xxx first so you should call it to the
225 * actual target if any. It will fallback to platform-do-xxx if it can't
226 * find one. It will also exclusively target functions that have
227 * the "OnDemand" flag.
228 */
229
230extern int pmf_call_function(struct device_node *target, const char *name,
231 struct pmf_args *args);
232
233
234/*
235 * For low latency interrupt usage, you can lookup for on-demand functions
236 * using the functions below
237 */
238
239extern struct pmf_function *pmf_find_function(struct device_node *target,
240 const char *name);
241
242extern struct pmf_function * pmf_get_function(struct pmf_function *func);
243extern void pmf_put_function(struct pmf_function *func);
244
245extern int pmf_call_one(struct pmf_function *func, struct pmf_args *args);
246
247
248/* Suspend/resume code called by via-pmu directly for now */
249extern void pmac_pfunc_base_suspend(void);
250extern void pmac_pfunc_base_resume(void);
251
252#endif /* __PMAC_PFUNC_H__ */
diff --git a/arch/powerpc/include/asm/pmc.h b/arch/powerpc/include/asm/pmc.h
new file mode 100644
index 000000000000..d6a616a1b3ea
--- /dev/null
+++ b/arch/powerpc/include/asm/pmc.h
@@ -0,0 +1,37 @@
1/*
2 * pmc.h
3 * Copyright (C) 2004 David Gibson, IBM Corporation
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#ifndef _POWERPC_PMC_H
20#define _POWERPC_PMC_H
21#ifdef __KERNEL__
22
23#include <asm/ptrace.h>
24
25typedef void (*perf_irq_t)(struct pt_regs *);
26extern perf_irq_t perf_irq;
27
28int reserve_pmc_hardware(perf_irq_t new_perf_irq);
29void release_pmc_hardware(void);
30
31#ifdef CONFIG_PPC64
32void power4_enable_pmcs(void);
33void pasemi_enable_pmcs(void);
34#endif
35
36#endif /* __KERNEL__ */
37#endif /* _POWERPC_PMC_H */
diff --git a/arch/powerpc/include/asm/pmi.h b/arch/powerpc/include/asm/pmi.h
new file mode 100644
index 000000000000..b4e91fbf5081
--- /dev/null
+++ b/arch/powerpc/include/asm/pmi.h
@@ -0,0 +1,66 @@
1#ifndef _POWERPC_PMI_H
2#define _POWERPC_PMI_H
3
4/*
5 * Definitions for talking with PMI device on PowerPC
6 *
7 * PMI (Platform Management Interrupt) is a way to communicate
8 * with the BMC (Baseboard Management Controller) via interrupts.
9 * Unlike IPMI it is bidirectional and has a low latency.
10 *
11 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
12 *
13 * Author: Christian Krafft <krafft@de.ibm.com>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30#ifdef __KERNEL__
31
32#define PMI_TYPE_FREQ_CHANGE 0x01
33#define PMI_TYPE_POWER_BUTTON 0x02
34#define PMI_READ_TYPE 0
35#define PMI_READ_DATA0 1
36#define PMI_READ_DATA1 2
37#define PMI_READ_DATA2 3
38#define PMI_WRITE_TYPE 4
39#define PMI_WRITE_DATA0 5
40#define PMI_WRITE_DATA1 6
41#define PMI_WRITE_DATA2 7
42
43#define PMI_ACK 0x80
44
45#define PMI_TIMEOUT 100
46
47typedef struct {
48 u8 type;
49 u8 data0;
50 u8 data1;
51 u8 data2;
52} pmi_message_t;
53
54struct pmi_handler {
55 struct list_head node;
56 u8 type;
57 void (*handle_pmi_message) (pmi_message_t);
58};
59
60int pmi_register_handler(struct pmi_handler *);
61void pmi_unregister_handler(struct pmi_handler *);
62
63int pmi_send_message(pmi_message_t);
64
65#endif /* __KERNEL__ */
66#endif /* _POWERPC_PMI_H */
diff --git a/arch/powerpc/include/asm/poll.h b/arch/powerpc/include/asm/poll.h
new file mode 100644
index 000000000000..c98509d3149e
--- /dev/null
+++ b/arch/powerpc/include/asm/poll.h
@@ -0,0 +1 @@
#include <asm-generic/poll.h>
diff --git a/arch/powerpc/include/asm/posix_types.h b/arch/powerpc/include/asm/posix_types.h
new file mode 100644
index 000000000000..c4e396b540df
--- /dev/null
+++ b/arch/powerpc/include/asm/posix_types.h
@@ -0,0 +1,128 @@
1#ifndef _ASM_POWERPC_POSIX_TYPES_H
2#define _ASM_POWERPC_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned long __kernel_ino_t;
11typedef unsigned int __kernel_mode_t;
12typedef long __kernel_off_t;
13typedef int __kernel_pid_t;
14typedef unsigned int __kernel_uid_t;
15typedef unsigned int __kernel_gid_t;
16typedef long __kernel_ptrdiff_t;
17typedef long __kernel_time_t;
18typedef long __kernel_clock_t;
19typedef int __kernel_timer_t;
20typedef int __kernel_clockid_t;
21typedef long __kernel_suseconds_t;
22typedef int __kernel_daddr_t;
23typedef char * __kernel_caddr_t;
24typedef unsigned short __kernel_uid16_t;
25typedef unsigned short __kernel_gid16_t;
26typedef unsigned int __kernel_uid32_t;
27typedef unsigned int __kernel_gid32_t;
28typedef unsigned int __kernel_old_uid_t;
29typedef unsigned int __kernel_old_gid_t;
30
31#ifdef __powerpc64__
32typedef unsigned long __kernel_nlink_t;
33typedef int __kernel_ipc_pid_t;
34typedef unsigned long __kernel_size_t;
35typedef long __kernel_ssize_t;
36typedef unsigned long __kernel_old_dev_t;
37#else
38typedef unsigned short __kernel_nlink_t;
39typedef short __kernel_ipc_pid_t;
40typedef unsigned int __kernel_size_t;
41typedef int __kernel_ssize_t;
42typedef unsigned int __kernel_old_dev_t;
43#endif
44
45#ifdef __powerpc64__
46typedef long long __kernel_loff_t;
47#else
48#ifdef __GNUC__
49typedef long long __kernel_loff_t;
50#endif
51#endif
52
53typedef struct {
54 int val[2];
55} __kernel_fsid_t;
56
57#ifndef __GNUC__
58
59#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
60#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
61#define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0)
62#define __FD_ZERO(set) \
63 ((void) memset ((void *) (set), 0, sizeof (__kernel_fd_set)))
64
65#else /* __GNUC__ */
66
67#if defined(__KERNEL__)
68/* With GNU C, use inline functions instead so args are evaluated only once: */
69
70#undef __FD_SET
71static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
72{
73 unsigned long _tmp = fd / __NFDBITS;
74 unsigned long _rem = fd % __NFDBITS;
75 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
76}
77
78#undef __FD_CLR
79static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
80{
81 unsigned long _tmp = fd / __NFDBITS;
82 unsigned long _rem = fd % __NFDBITS;
83 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
84}
85
86#undef __FD_ISSET
87static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p)
88{
89 unsigned long _tmp = fd / __NFDBITS;
90 unsigned long _rem = fd % __NFDBITS;
91 return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
92}
93
94/*
95 * This will unroll the loop for the normal constant case (8 ints,
96 * for a 256-bit fd_set)
97 */
98#undef __FD_ZERO
99static __inline__ void __FD_ZERO(__kernel_fd_set *p)
100{
101 unsigned long *tmp = (unsigned long *)p->fds_bits;
102 int i;
103
104 if (__builtin_constant_p(__FDSET_LONGS)) {
105 switch (__FDSET_LONGS) {
106 case 16:
107 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
108 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
109
110 case 8:
111 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
112
113 case 4:
114 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
115 return;
116 }
117 }
118 i = __FDSET_LONGS;
119 while (i) {
120 i--;
121 *tmp = 0;
122 tmp++;
123 }
124}
125
126#endif /* defined(__KERNEL__) */
127#endif /* __GNUC__ */
128#endif /* _ASM_POWERPC_POSIX_TYPES_H */
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
new file mode 100644
index 000000000000..854ab713f56c
--- /dev/null
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -0,0 +1,149 @@
1/*
2 * c 2001 PPC 64 Team, IBM Corp
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#ifndef _ASM_POWERPC_PPC_PCI_H
10#define _ASM_POWERPC_PPC_PCI_H
11#ifdef __KERNEL__
12
13#ifdef CONFIG_PCI
14
15#include <linux/pci.h>
16#include <asm/pci-bridge.h>
17
18extern unsigned long isa_io_base;
19
20extern void pci_setup_phb_io(struct pci_controller *hose, int primary);
21extern void pci_setup_phb_io_dynamic(struct pci_controller *hose, int primary);
22
23
24extern struct list_head hose_list;
25
26extern void find_and_init_phbs(void);
27
28extern struct pci_dev *isa_bridge_pcidev; /* may be NULL if no ISA bus */
29
30/** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID */
31#define BUID_HI(buid) ((buid) >> 32)
32#define BUID_LO(buid) ((buid) & 0xffffffff)
33
34/* PCI device_node operations */
35struct device_node;
36typedef void *(*traverse_func)(struct device_node *me, void *data);
37void *traverse_pci_devices(struct device_node *start, traverse_func pre,
38 void *data);
39
40extern void pci_devs_phb_init(void);
41extern void pci_devs_phb_init_dynamic(struct pci_controller *phb);
42extern void scan_phb(struct pci_controller *hose);
43
44/* From rtas_pci.h */
45extern void init_pci_config_tokens (void);
46extern unsigned long get_phb_buid (struct device_node *);
47extern int rtas_setup_phb(struct pci_controller *phb);
48
49extern unsigned long pci_probe_only;
50
51/* ---- EEH internal-use-only related routines ---- */
52#ifdef CONFIG_EEH
53
54void pci_addr_cache_insert_device(struct pci_dev *dev);
55void pci_addr_cache_remove_device(struct pci_dev *dev);
56void pci_addr_cache_build(void);
57struct pci_dev *pci_get_device_by_addr(unsigned long addr);
58
59/**
60 * eeh_slot_error_detail -- record and EEH error condition to the log
61 * @pdn: pci device node
62 * @severity: EEH_LOG_TEMP_FAILURE or EEH_LOG_PERM_FAILURE
63 *
64 * Obtains the EEH error details from the RTAS subsystem,
65 * and then logs these details with the RTAS error log system.
66 */
67#define EEH_LOG_TEMP_FAILURE 1
68#define EEH_LOG_PERM_FAILURE 2
69void eeh_slot_error_detail (struct pci_dn *pdn, int severity);
70
71/**
72 * rtas_pci_enable - enable IO transfers for this slot
73 * @pdn: pci device node
74 * @function: either EEH_THAW_MMIO or EEH_THAW_DMA
75 *
76 * Enable I/O transfers to this slot
77 */
78#define EEH_THAW_MMIO 2
79#define EEH_THAW_DMA 3
80int rtas_pci_enable(struct pci_dn *pdn, int function);
81
82/**
83 * rtas_set_slot_reset -- unfreeze a frozen slot
84 * @pdn: pci device node
85 *
86 * Clear the EEH-frozen condition on a slot. This routine
87 * does this by asserting the PCI #RST line for 1/8th of
88 * a second; this routine will sleep while the adapter is
89 * being reset.
90 *
91 * Returns a non-zero value if the reset failed.
92 */
93int rtas_set_slot_reset (struct pci_dn *);
94int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs);
95
96/**
97 * eeh_restore_bars - Restore device configuration info.
98 * @pdn: pci device node
99 *
100 * A reset of a PCI device will clear out its config space.
101 * This routines will restore the config space for this
102 * device, and is children, to values previously obtained
103 * from the firmware.
104 */
105void eeh_restore_bars(struct pci_dn *);
106
107/**
108 * rtas_configure_bridge -- firmware initialization of pci bridge
109 * @pdn: pci device node
110 *
111 * Ask the firmware to configure all PCI bridges devices
112 * located behind the indicated node. Required after a
113 * pci device reset. Does essentially the same hing as
114 * eeh_restore_bars, but for brdges, and lets firmware
115 * do the work.
116 */
117void rtas_configure_bridge(struct pci_dn *);
118
119int rtas_write_config(struct pci_dn *, int where, int size, u32 val);
120int rtas_read_config(struct pci_dn *, int where, int size, u32 *val);
121
122/**
123 * eeh_mark_slot -- set mode flags for pertition endpoint
124 * @pdn: pci device node
125 *
126 * mark and clear slots: find "partition endpoint" PE and set or
127 * clear the flags for each subnode of the PE.
128 */
129void eeh_mark_slot (struct device_node *dn, int mode_flag);
130void eeh_clear_slot (struct device_node *dn, int mode_flag);
131
132/**
133 * find_device_pe -- Find the associated "Partiationable Endpoint" PE
134 * @pdn: pci device node
135 */
136struct device_node * find_device_pe(struct device_node *dn);
137
138void eeh_sysfs_add_device(struct pci_dev *pdev);
139void eeh_sysfs_remove_device(struct pci_dev *pdev);
140
141#endif /* CONFIG_EEH */
142
143#else /* CONFIG_PCI */
144static inline void find_and_init_phbs(void) { }
145static inline void init_pci_config_tokens(void) { }
146#endif /* !CONFIG_PCI */
147
148#endif /* __KERNEL__ */
149#endif /* _ASM_POWERPC_PPC_PCI_H */
diff --git a/arch/powerpc/include/asm/ppc4xx.h b/arch/powerpc/include/asm/ppc4xx.h
new file mode 100644
index 000000000000..033039a80c42
--- /dev/null
+++ b/arch/powerpc/include/asm/ppc4xx.h
@@ -0,0 +1,18 @@
1/*
2 * PPC4xx Prototypes and definitions
3 *
4 * Copyright 2008 DENX Software Engineering, Stefan Roese <sr@denx.de>
5 *
6 * This is free software; you can redistribute it and/or modify it
7 * 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 */
12
13#ifndef __ASM_POWERPC_PPC4xx_H__
14#define __ASM_POWERPC_PPC4xx_H__
15
16extern void ppc4xx_reset_system(char *cmd);
17
18#endif /* __ASM_POWERPC_PPC4xx_H__ */
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
new file mode 100644
index 000000000000..0966899d974b
--- /dev/null
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -0,0 +1,689 @@
1/*
2 * Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan.
3 */
4#ifndef _ASM_POWERPC_PPC_ASM_H
5#define _ASM_POWERPC_PPC_ASM_H
6
7#include <linux/stringify.h>
8#include <asm/asm-compat.h>
9#include <asm/processor.h>
10
11#ifndef __ASSEMBLY__
12#error __FILE__ should only be used in assembler files
13#else
14
15#define SZL (BITS_PER_LONG/8)
16
17/*
18 * Stuff for accurate CPU time accounting.
19 * These macros handle transitions between user and system state
20 * in exception entry and exit and accumulate time to the
21 * user_time and system_time fields in the paca.
22 */
23
24#ifndef CONFIG_VIRT_CPU_ACCOUNTING
25#define ACCOUNT_CPU_USER_ENTRY(ra, rb)
26#define ACCOUNT_CPU_USER_EXIT(ra, rb)
27#else
28#define ACCOUNT_CPU_USER_ENTRY(ra, rb) \
29 beq 2f; /* if from kernel mode */ \
30BEGIN_FTR_SECTION; \
31 mfspr ra,SPRN_PURR; /* get processor util. reg */ \
32END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
33BEGIN_FTR_SECTION; \
34 MFTB(ra); /* or get TB if no PURR */ \
35END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
36 ld rb,PACA_STARTPURR(r13); \
37 std ra,PACA_STARTPURR(r13); \
38 subf rb,rb,ra; /* subtract start value */ \
39 ld ra,PACA_USER_TIME(r13); \
40 add ra,ra,rb; /* add on to user time */ \
41 std ra,PACA_USER_TIME(r13); \
422:
43
44#define ACCOUNT_CPU_USER_EXIT(ra, rb) \
45BEGIN_FTR_SECTION; \
46 mfspr ra,SPRN_PURR; /* get processor util. reg */ \
47END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
48BEGIN_FTR_SECTION; \
49 MFTB(ra); /* or get TB if no PURR */ \
50END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
51 ld rb,PACA_STARTPURR(r13); \
52 std ra,PACA_STARTPURR(r13); \
53 subf rb,rb,ra; /* subtract start value */ \
54 ld ra,PACA_SYSTEM_TIME(r13); \
55 add ra,ra,rb; /* add on to user time */ \
56 std ra,PACA_SYSTEM_TIME(r13);
57#endif
58
59/*
60 * Macros for storing registers into and loading registers from
61 * exception frames.
62 */
63#ifdef __powerpc64__
64#define SAVE_GPR(n, base) std n,GPR0+8*(n)(base)
65#define REST_GPR(n, base) ld n,GPR0+8*(n)(base)
66#define SAVE_NVGPRS(base) SAVE_8GPRS(14, base); SAVE_10GPRS(22, base)
67#define REST_NVGPRS(base) REST_8GPRS(14, base); REST_10GPRS(22, base)
68#else
69#define SAVE_GPR(n, base) stw n,GPR0+4*(n)(base)
70#define REST_GPR(n, base) lwz n,GPR0+4*(n)(base)
71#define SAVE_NVGPRS(base) SAVE_GPR(13, base); SAVE_8GPRS(14, base); \
72 SAVE_10GPRS(22, base)
73#define REST_NVGPRS(base) REST_GPR(13, base); REST_8GPRS(14, base); \
74 REST_10GPRS(22, base)
75#endif
76
77/*
78 * Define what the VSX XX1 form instructions will look like, then add
79 * the 128 bit load store instructions based on that.
80 */
81#define VSX_XX1(xs, ra, rb) (((xs) & 0x1f) << 21 | ((ra) << 16) | \
82 ((rb) << 11) | (((xs) >> 5)))
83
84#define STXVD2X(xs, ra, rb) .long (0x7c000798 | VSX_XX1((xs), (ra), (rb)))
85#define LXVD2X(xs, ra, rb) .long (0x7c000698 | VSX_XX1((xs), (ra), (rb)))
86
87#define SAVE_2GPRS(n, base) SAVE_GPR(n, base); SAVE_GPR(n+1, base)
88#define SAVE_4GPRS(n, base) SAVE_2GPRS(n, base); SAVE_2GPRS(n+2, base)
89#define SAVE_8GPRS(n, base) SAVE_4GPRS(n, base); SAVE_4GPRS(n+4, base)
90#define SAVE_10GPRS(n, base) SAVE_8GPRS(n, base); SAVE_2GPRS(n+8, base)
91#define REST_2GPRS(n, base) REST_GPR(n, base); REST_GPR(n+1, base)
92#define REST_4GPRS(n, base) REST_2GPRS(n, base); REST_2GPRS(n+2, base)
93#define REST_8GPRS(n, base) REST_4GPRS(n, base); REST_4GPRS(n+4, base)
94#define REST_10GPRS(n, base) REST_8GPRS(n, base); REST_2GPRS(n+8, base)
95
96#define SAVE_FPR(n, base) stfd n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base)
97#define SAVE_2FPRS(n, base) SAVE_FPR(n, base); SAVE_FPR(n+1, base)
98#define SAVE_4FPRS(n, base) SAVE_2FPRS(n, base); SAVE_2FPRS(n+2, base)
99#define SAVE_8FPRS(n, base) SAVE_4FPRS(n, base); SAVE_4FPRS(n+4, base)
100#define SAVE_16FPRS(n, base) SAVE_8FPRS(n, base); SAVE_8FPRS(n+8, base)
101#define SAVE_32FPRS(n, base) SAVE_16FPRS(n, base); SAVE_16FPRS(n+16, base)
102#define REST_FPR(n, base) lfd n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base)
103#define REST_2FPRS(n, base) REST_FPR(n, base); REST_FPR(n+1, base)
104#define REST_4FPRS(n, base) REST_2FPRS(n, base); REST_2FPRS(n+2, base)
105#define REST_8FPRS(n, base) REST_4FPRS(n, base); REST_4FPRS(n+4, base)
106#define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base)
107#define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base)
108
109#define SAVE_VR(n,b,base) li b,THREAD_VR0+(16*(n)); stvx n,b,base
110#define SAVE_2VRS(n,b,base) SAVE_VR(n,b,base); SAVE_VR(n+1,b,base)
111#define SAVE_4VRS(n,b,base) SAVE_2VRS(n,b,base); SAVE_2VRS(n+2,b,base)
112#define SAVE_8VRS(n,b,base) SAVE_4VRS(n,b,base); SAVE_4VRS(n+4,b,base)
113#define SAVE_16VRS(n,b,base) SAVE_8VRS(n,b,base); SAVE_8VRS(n+8,b,base)
114#define SAVE_32VRS(n,b,base) SAVE_16VRS(n,b,base); SAVE_16VRS(n+16,b,base)
115#define REST_VR(n,b,base) li b,THREAD_VR0+(16*(n)); lvx n,b,base
116#define REST_2VRS(n,b,base) REST_VR(n,b,base); REST_VR(n+1,b,base)
117#define REST_4VRS(n,b,base) REST_2VRS(n,b,base); REST_2VRS(n+2,b,base)
118#define REST_8VRS(n,b,base) REST_4VRS(n,b,base); REST_4VRS(n+4,b,base)
119#define REST_16VRS(n,b,base) REST_8VRS(n,b,base); REST_8VRS(n+8,b,base)
120#define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base)
121
122/* Save the lower 32 VSRs in the thread VSR region */
123#define SAVE_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); STXVD2X(n,b,base)
124#define SAVE_2VSRS(n,b,base) SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base)
125#define SAVE_4VSRS(n,b,base) SAVE_2VSRS(n,b,base); SAVE_2VSRS(n+2,b,base)
126#define SAVE_8VSRS(n,b,base) SAVE_4VSRS(n,b,base); SAVE_4VSRS(n+4,b,base)
127#define SAVE_16VSRS(n,b,base) SAVE_8VSRS(n,b,base); SAVE_8VSRS(n+8,b,base)
128#define SAVE_32VSRS(n,b,base) SAVE_16VSRS(n,b,base); SAVE_16VSRS(n+16,b,base)
129#define REST_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); LXVD2X(n,b,base)
130#define REST_2VSRS(n,b,base) REST_VSR(n,b,base); REST_VSR(n+1,b,base)
131#define REST_4VSRS(n,b,base) REST_2VSRS(n,b,base); REST_2VSRS(n+2,b,base)
132#define REST_8VSRS(n,b,base) REST_4VSRS(n,b,base); REST_4VSRS(n+4,b,base)
133#define REST_16VSRS(n,b,base) REST_8VSRS(n,b,base); REST_8VSRS(n+8,b,base)
134#define REST_32VSRS(n,b,base) REST_16VSRS(n,b,base); REST_16VSRS(n+16,b,base)
135/* Save the upper 32 VSRs (32-63) in the thread VSX region (0-31) */
136#define SAVE_VSRU(n,b,base) li b,THREAD_VR0+(16*(n)); STXVD2X(n+32,b,base)
137#define SAVE_2VSRSU(n,b,base) SAVE_VSRU(n,b,base); SAVE_VSRU(n+1,b,base)
138#define SAVE_4VSRSU(n,b,base) SAVE_2VSRSU(n,b,base); SAVE_2VSRSU(n+2,b,base)
139#define SAVE_8VSRSU(n,b,base) SAVE_4VSRSU(n,b,base); SAVE_4VSRSU(n+4,b,base)
140#define SAVE_16VSRSU(n,b,base) SAVE_8VSRSU(n,b,base); SAVE_8VSRSU(n+8,b,base)
141#define SAVE_32VSRSU(n,b,base) SAVE_16VSRSU(n,b,base); SAVE_16VSRSU(n+16,b,base)
142#define REST_VSRU(n,b,base) li b,THREAD_VR0+(16*(n)); LXVD2X(n+32,b,base)
143#define REST_2VSRSU(n,b,base) REST_VSRU(n,b,base); REST_VSRU(n+1,b,base)
144#define REST_4VSRSU(n,b,base) REST_2VSRSU(n,b,base); REST_2VSRSU(n+2,b,base)
145#define REST_8VSRSU(n,b,base) REST_4VSRSU(n,b,base); REST_4VSRSU(n+4,b,base)
146#define REST_16VSRSU(n,b,base) REST_8VSRSU(n,b,base); REST_8VSRSU(n+8,b,base)
147#define REST_32VSRSU(n,b,base) REST_16VSRSU(n,b,base); REST_16VSRSU(n+16,b,base)
148
149#define SAVE_EVR(n,s,base) evmergehi s,s,n; stw s,THREAD_EVR0+4*(n)(base)
150#define SAVE_2EVRS(n,s,base) SAVE_EVR(n,s,base); SAVE_EVR(n+1,s,base)
151#define SAVE_4EVRS(n,s,base) SAVE_2EVRS(n,s,base); SAVE_2EVRS(n+2,s,base)
152#define SAVE_8EVRS(n,s,base) SAVE_4EVRS(n,s,base); SAVE_4EVRS(n+4,s,base)
153#define SAVE_16EVRS(n,s,base) SAVE_8EVRS(n,s,base); SAVE_8EVRS(n+8,s,base)
154#define SAVE_32EVRS(n,s,base) SAVE_16EVRS(n,s,base); SAVE_16EVRS(n+16,s,base)
155#define REST_EVR(n,s,base) lwz s,THREAD_EVR0+4*(n)(base); evmergelo n,s,n
156#define REST_2EVRS(n,s,base) REST_EVR(n,s,base); REST_EVR(n+1,s,base)
157#define REST_4EVRS(n,s,base) REST_2EVRS(n,s,base); REST_2EVRS(n+2,s,base)
158#define REST_8EVRS(n,s,base) REST_4EVRS(n,s,base); REST_4EVRS(n+4,s,base)
159#define REST_16EVRS(n,s,base) REST_8EVRS(n,s,base); REST_8EVRS(n+8,s,base)
160#define REST_32EVRS(n,s,base) REST_16EVRS(n,s,base); REST_16EVRS(n+16,s,base)
161
162/* Macros to adjust thread priority for hardware multithreading */
163#define HMT_VERY_LOW or 31,31,31 # very low priority
164#define HMT_LOW or 1,1,1
165#define HMT_MEDIUM_LOW or 6,6,6 # medium low priority
166#define HMT_MEDIUM or 2,2,2
167#define HMT_MEDIUM_HIGH or 5,5,5 # medium high priority
168#define HMT_HIGH or 3,3,3
169
170/* handle instructions that older assemblers may not know */
171#define RFCI .long 0x4c000066 /* rfci instruction */
172#define RFDI .long 0x4c00004e /* rfdi instruction */
173#define RFMCI .long 0x4c00004c /* rfmci instruction */
174
175#ifdef __KERNEL__
176#ifdef CONFIG_PPC64
177
178#define XGLUE(a,b) a##b
179#define GLUE(a,b) XGLUE(a,b)
180
181#define _GLOBAL(name) \
182 .section ".text"; \
183 .align 2 ; \
184 .globl name; \
185 .globl GLUE(.,name); \
186 .section ".opd","aw"; \
187name: \
188 .quad GLUE(.,name); \
189 .quad .TOC.@tocbase; \
190 .quad 0; \
191 .previous; \
192 .type GLUE(.,name),@function; \
193GLUE(.,name):
194
195#define _INIT_GLOBAL(name) \
196 .section ".text.init.refok"; \
197 .align 2 ; \
198 .globl name; \
199 .globl GLUE(.,name); \
200 .section ".opd","aw"; \
201name: \
202 .quad GLUE(.,name); \
203 .quad .TOC.@tocbase; \
204 .quad 0; \
205 .previous; \
206 .type GLUE(.,name),@function; \
207GLUE(.,name):
208
209#define _KPROBE(name) \
210 .section ".kprobes.text","a"; \
211 .align 2 ; \
212 .globl name; \
213 .globl GLUE(.,name); \
214 .section ".opd","aw"; \
215name: \
216 .quad GLUE(.,name); \
217 .quad .TOC.@tocbase; \
218 .quad 0; \
219 .previous; \
220 .type GLUE(.,name),@function; \
221GLUE(.,name):
222
223#define _STATIC(name) \
224 .section ".text"; \
225 .align 2 ; \
226 .section ".opd","aw"; \
227name: \
228 .quad GLUE(.,name); \
229 .quad .TOC.@tocbase; \
230 .quad 0; \
231 .previous; \
232 .type GLUE(.,name),@function; \
233GLUE(.,name):
234
235#define _INIT_STATIC(name) \
236 .section ".text.init.refok"; \
237 .align 2 ; \
238 .section ".opd","aw"; \
239name: \
240 .quad GLUE(.,name); \
241 .quad .TOC.@tocbase; \
242 .quad 0; \
243 .previous; \
244 .type GLUE(.,name),@function; \
245GLUE(.,name):
246
247#else /* 32-bit */
248
249#define _ENTRY(n) \
250 .globl n; \
251n:
252
253#define _GLOBAL(n) \
254 .text; \
255 .stabs __stringify(n:F-1),N_FUN,0,0,n;\
256 .globl n; \
257n:
258
259#define _KPROBE(n) \
260 .section ".kprobes.text","a"; \
261 .globl n; \
262n:
263
264#endif
265
266/*
267 * LOAD_REG_IMMEDIATE(rn, expr)
268 * Loads the value of the constant expression 'expr' into register 'rn'
269 * using immediate instructions only. Use this when it's important not
270 * to reference other data (i.e. on ppc64 when the TOC pointer is not
271 * valid).
272 *
273 * LOAD_REG_ADDR(rn, name)
274 * Loads the address of label 'name' into register 'rn'. Use this when
275 * you don't particularly need immediate instructions only, but you need
276 * the whole address in one register (e.g. it's a structure address and
277 * you want to access various offsets within it). On ppc32 this is
278 * identical to LOAD_REG_IMMEDIATE.
279 *
280 * LOAD_REG_ADDRBASE(rn, name)
281 * ADDROFF(name)
282 * LOAD_REG_ADDRBASE loads part of the address of label 'name' into
283 * register 'rn'. ADDROFF(name) returns the remainder of the address as
284 * a constant expression. ADDROFF(name) is a signed expression < 16 bits
285 * in size, so is suitable for use directly as an offset in load and store
286 * instructions. Use this when loading/storing a single word or less as:
287 * LOAD_REG_ADDRBASE(rX, name)
288 * ld rY,ADDROFF(name)(rX)
289 */
290#ifdef __powerpc64__
291#define LOAD_REG_IMMEDIATE(reg,expr) \
292 lis (reg),(expr)@highest; \
293 ori (reg),(reg),(expr)@higher; \
294 rldicr (reg),(reg),32,31; \
295 oris (reg),(reg),(expr)@h; \
296 ori (reg),(reg),(expr)@l;
297
298#define LOAD_REG_ADDR(reg,name) \
299 ld (reg),name@got(r2)
300
301#define LOAD_REG_ADDRBASE(reg,name) LOAD_REG_ADDR(reg,name)
302#define ADDROFF(name) 0
303
304/* offsets for stack frame layout */
305#define LRSAVE 16
306
307#else /* 32-bit */
308
309#define LOAD_REG_IMMEDIATE(reg,expr) \
310 lis (reg),(expr)@ha; \
311 addi (reg),(reg),(expr)@l;
312
313#define LOAD_REG_ADDR(reg,name) LOAD_REG_IMMEDIATE(reg, name)
314
315#define LOAD_REG_ADDRBASE(reg, name) lis (reg),name@ha
316#define ADDROFF(name) name@l
317
318/* offsets for stack frame layout */
319#define LRSAVE 4
320
321#endif
322
323/* various errata or part fixups */
324#ifdef CONFIG_PPC601_SYNC_FIX
325#define SYNC \
326BEGIN_FTR_SECTION \
327 sync; \
328 isync; \
329END_FTR_SECTION_IFSET(CPU_FTR_601)
330#define SYNC_601 \
331BEGIN_FTR_SECTION \
332 sync; \
333END_FTR_SECTION_IFSET(CPU_FTR_601)
334#define ISYNC_601 \
335BEGIN_FTR_SECTION \
336 isync; \
337END_FTR_SECTION_IFSET(CPU_FTR_601)
338#else
339#define SYNC
340#define SYNC_601
341#define ISYNC_601
342#endif
343
344#ifdef CONFIG_PPC_CELL
345#define MFTB(dest) \
34690: mftb dest; \
347BEGIN_FTR_SECTION_NESTED(96); \
348 cmpwi dest,0; \
349 beq- 90b; \
350END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96)
351#else
352#define MFTB(dest) mftb dest
353#endif
354
355#ifndef CONFIG_SMP
356#define TLBSYNC
357#else /* CONFIG_SMP */
358/* tlbsync is not implemented on 601 */
359#define TLBSYNC \
360BEGIN_FTR_SECTION \
361 tlbsync; \
362 sync; \
363END_FTR_SECTION_IFCLR(CPU_FTR_601)
364#endif
365
366
367/*
368 * This instruction is not implemented on the PPC 603 or 601; however, on
369 * the 403GCX and 405GP tlbia IS defined and tlbie is not.
370 * All of these instructions exist in the 8xx, they have magical powers,
371 * and they must be used.
372 */
373
374#if !defined(CONFIG_4xx) && !defined(CONFIG_8xx)
375#define tlbia \
376 li r4,1024; \
377 mtctr r4; \
378 lis r4,KERNELBASE@h; \
3790: tlbie r4; \
380 addi r4,r4,0x1000; \
381 bdnz 0b
382#endif
383
384
385#ifdef CONFIG_IBM440EP_ERR42
386#define PPC440EP_ERR42 isync
387#else
388#define PPC440EP_ERR42
389#endif
390
391
392#if defined(CONFIG_BOOKE)
393#define toreal(rd)
394#define fromreal(rd)
395
396/*
397 * We use addis to ensure compatibility with the "classic" ppc versions of
398 * these macros, which use rs = 0 to get the tophys offset in rd, rather than
399 * converting the address in r0, and so this version has to do that too
400 * (i.e. set register rd to 0 when rs == 0).
401 */
402#define tophys(rd,rs) \
403 addis rd,rs,0
404
405#define tovirt(rd,rs) \
406 addis rd,rs,0
407
408#elif defined(CONFIG_PPC64)
409#define toreal(rd) /* we can access c000... in real mode */
410#define fromreal(rd)
411
412#define tophys(rd,rs) \
413 clrldi rd,rs,2
414
415#define tovirt(rd,rs) \
416 rotldi rd,rs,16; \
417 ori rd,rd,((KERNELBASE>>48)&0xFFFF);\
418 rotldi rd,rd,48
419#else
420/*
421 * On APUS (Amiga PowerPC cpu upgrade board), we don't know the
422 * physical base address of RAM at compile time.
423 */
424#define toreal(rd) tophys(rd,rd)
425#define fromreal(rd) tovirt(rd,rd)
426
427#define tophys(rd,rs) \
4280: addis rd,rs,-KERNELBASE@h; \
429 .section ".vtop_fixup","aw"; \
430 .align 1; \
431 .long 0b; \
432 .previous
433
434#define tovirt(rd,rs) \
4350: addis rd,rs,KERNELBASE@h; \
436 .section ".ptov_fixup","aw"; \
437 .align 1; \
438 .long 0b; \
439 .previous
440#endif
441
442#ifdef CONFIG_PPC64
443#define RFI rfid
444#define MTMSRD(r) mtmsrd r
445
446#else
447#define FIX_SRR1(ra, rb)
448#ifndef CONFIG_40x
449#define RFI rfi
450#else
451#define RFI rfi; b . /* Prevent prefetch past rfi */
452#endif
453#define MTMSRD(r) mtmsr r
454#define CLR_TOP32(r)
455#endif
456
457#endif /* __KERNEL__ */
458
459/* The boring bits... */
460
461/* Condition Register Bit Fields */
462
463#define cr0 0
464#define cr1 1
465#define cr2 2
466#define cr3 3
467#define cr4 4
468#define cr5 5
469#define cr6 6
470#define cr7 7
471
472
473/* General Purpose Registers (GPRs) */
474
475#define r0 0
476#define r1 1
477#define r2 2
478#define r3 3
479#define r4 4
480#define r5 5
481#define r6 6
482#define r7 7
483#define r8 8
484#define r9 9
485#define r10 10
486#define r11 11
487#define r12 12
488#define r13 13
489#define r14 14
490#define r15 15
491#define r16 16
492#define r17 17
493#define r18 18
494#define r19 19
495#define r20 20
496#define r21 21
497#define r22 22
498#define r23 23
499#define r24 24
500#define r25 25
501#define r26 26
502#define r27 27
503#define r28 28
504#define r29 29
505#define r30 30
506#define r31 31
507
508
509/* Floating Point Registers (FPRs) */
510
511#define fr0 0
512#define fr1 1
513#define fr2 2
514#define fr3 3
515#define fr4 4
516#define fr5 5
517#define fr6 6
518#define fr7 7
519#define fr8 8
520#define fr9 9
521#define fr10 10
522#define fr11 11
523#define fr12 12
524#define fr13 13
525#define fr14 14
526#define fr15 15
527#define fr16 16
528#define fr17 17
529#define fr18 18
530#define fr19 19
531#define fr20 20
532#define fr21 21
533#define fr22 22
534#define fr23 23
535#define fr24 24
536#define fr25 25
537#define fr26 26
538#define fr27 27
539#define fr28 28
540#define fr29 29
541#define fr30 30
542#define fr31 31
543
544/* AltiVec Registers (VPRs) */
545
546#define vr0 0
547#define vr1 1
548#define vr2 2
549#define vr3 3
550#define vr4 4
551#define vr5 5
552#define vr6 6
553#define vr7 7
554#define vr8 8
555#define vr9 9
556#define vr10 10
557#define vr11 11
558#define vr12 12
559#define vr13 13
560#define vr14 14
561#define vr15 15
562#define vr16 16
563#define vr17 17
564#define vr18 18
565#define vr19 19
566#define vr20 20
567#define vr21 21
568#define vr22 22
569#define vr23 23
570#define vr24 24
571#define vr25 25
572#define vr26 26
573#define vr27 27
574#define vr28 28
575#define vr29 29
576#define vr30 30
577#define vr31 31
578
579/* VSX Registers (VSRs) */
580
581#define vsr0 0
582#define vsr1 1
583#define vsr2 2
584#define vsr3 3
585#define vsr4 4
586#define vsr5 5
587#define vsr6 6
588#define vsr7 7
589#define vsr8 8
590#define vsr9 9
591#define vsr10 10
592#define vsr11 11
593#define vsr12 12
594#define vsr13 13
595#define vsr14 14
596#define vsr15 15
597#define vsr16 16
598#define vsr17 17
599#define vsr18 18
600#define vsr19 19
601#define vsr20 20
602#define vsr21 21
603#define vsr22 22
604#define vsr23 23
605#define vsr24 24
606#define vsr25 25
607#define vsr26 26
608#define vsr27 27
609#define vsr28 28
610#define vsr29 29
611#define vsr30 30
612#define vsr31 31
613#define vsr32 32
614#define vsr33 33
615#define vsr34 34
616#define vsr35 35
617#define vsr36 36
618#define vsr37 37
619#define vsr38 38
620#define vsr39 39
621#define vsr40 40
622#define vsr41 41
623#define vsr42 42
624#define vsr43 43
625#define vsr44 44
626#define vsr45 45
627#define vsr46 46
628#define vsr47 47
629#define vsr48 48
630#define vsr49 49
631#define vsr50 50
632#define vsr51 51
633#define vsr52 52
634#define vsr53 53
635#define vsr54 54
636#define vsr55 55
637#define vsr56 56
638#define vsr57 57
639#define vsr58 58
640#define vsr59 59
641#define vsr60 60
642#define vsr61 61
643#define vsr62 62
644#define vsr63 63
645
646/* SPE Registers (EVPRs) */
647
648#define evr0 0
649#define evr1 1
650#define evr2 2
651#define evr3 3
652#define evr4 4
653#define evr5 5
654#define evr6 6
655#define evr7 7
656#define evr8 8
657#define evr9 9
658#define evr10 10
659#define evr11 11
660#define evr12 12
661#define evr13 13
662#define evr14 14
663#define evr15 15
664#define evr16 16
665#define evr17 17
666#define evr18 18
667#define evr19 19
668#define evr20 20
669#define evr21 21
670#define evr22 22
671#define evr23 23
672#define evr24 24
673#define evr25 25
674#define evr26 26
675#define evr27 27
676#define evr28 28
677#define evr29 29
678#define evr30 30
679#define evr31 31
680
681/* some stab codes */
682#define N_FUN 36
683#define N_RSYM 64
684#define N_SLINE 68
685#define N_SO 100
686
687#endif /* __ASSEMBLY__ */
688
689#endif /* _ASM_POWERPC_PPC_ASM_H */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
new file mode 100644
index 000000000000..101ed87f7d84
--- /dev/null
+++ b/arch/powerpc/include/asm/processor.h
@@ -0,0 +1,314 @@
1#ifndef _ASM_POWERPC_PROCESSOR_H
2#define _ASM_POWERPC_PROCESSOR_H
3
4/*
5 * Copyright (C) 2001 PPC 64 Team, IBM Corp
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/reg.h>
14
15#ifdef CONFIG_VSX
16#define TS_FPRWIDTH 2
17#else
18#define TS_FPRWIDTH 1
19#endif
20
21#ifndef __ASSEMBLY__
22#include <linux/compiler.h>
23#include <asm/ptrace.h>
24#include <asm/types.h>
25
26/* We do _not_ want to define new machine types at all, those must die
27 * in favor of using the device-tree
28 * -- BenH.
29 */
30
31/* PREP sub-platform types see residual.h for these */
32#define _PREP_Motorola 0x01 /* motorola prep */
33#define _PREP_Firm 0x02 /* firmworks prep */
34#define _PREP_IBM 0x00 /* ibm prep */
35#define _PREP_Bull 0x03 /* bull prep */
36
37/* CHRP sub-platform types. These are arbitrary */
38#define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */
39#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
40#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */
41#define _CHRP_briq 0x07 /* TotalImpact's briQ */
42
43#if defined(__KERNEL__) && defined(CONFIG_PPC32)
44
45extern int _chrp_type;
46
47#ifdef CONFIG_PPC_PREP
48
49/* what kind of prep workstation we are */
50extern int _prep_type;
51
52#endif /* CONFIG_PPC_PREP */
53
54#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */
55
56/*
57 * Default implementation of macro that returns current
58 * instruction pointer ("program counter").
59 */
60#define current_text_addr() ({ __label__ _l; _l: &&_l;})
61
62/* Macros for adjusting thread priority (hardware multi-threading) */
63#define HMT_very_low() asm volatile("or 31,31,31 # very low priority")
64#define HMT_low() asm volatile("or 1,1,1 # low priority")
65#define HMT_medium_low() asm volatile("or 6,6,6 # medium low priority")
66#define HMT_medium() asm volatile("or 2,2,2 # medium priority")
67#define HMT_medium_high() asm volatile("or 5,5,5 # medium high priority")
68#define HMT_high() asm volatile("or 3,3,3 # high priority")
69
70#ifdef __KERNEL__
71
72extern int have_of;
73
74struct task_struct;
75void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp);
76void release_thread(struct task_struct *);
77
78/* Prepare to copy thread state - unlazy all lazy status */
79extern void prepare_to_copy(struct task_struct *tsk);
80
81/* Create a new kernel thread. */
82extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
83
84/* Lazy FPU handling on uni-processor */
85extern struct task_struct *last_task_used_math;
86extern struct task_struct *last_task_used_altivec;
87extern struct task_struct *last_task_used_vsx;
88extern struct task_struct *last_task_used_spe;
89
90#ifdef CONFIG_PPC32
91
92#if CONFIG_TASK_SIZE > CONFIG_KERNEL_START
93#error User TASK_SIZE overlaps with KERNEL_START address
94#endif
95#define TASK_SIZE (CONFIG_TASK_SIZE)
96
97/* This decides where the kernel will search for a free chunk of vm
98 * space during mmap's.
99 */
100#define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
101#endif
102
103#ifdef CONFIG_PPC64
104/* 64-bit user address space is 44-bits (16TB user VM) */
105#define TASK_SIZE_USER64 (0x0000100000000000UL)
106
107/*
108 * 32-bit user address space is 4GB - 1 page
109 * (this 1 page is needed so referencing of 0xFFFFFFFF generates EFAULT
110 */
111#define TASK_SIZE_USER32 (0x0000000100000000UL - (1*PAGE_SIZE))
112
113#define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \
114 TASK_SIZE_USER32 : TASK_SIZE_USER64)
115#define TASK_SIZE TASK_SIZE_OF(current)
116
117/* This decides where the kernel will search for a free chunk of vm
118 * space during mmap's.
119 */
120#define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
121#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_USER64 / 4))
122
123#define TASK_UNMAPPED_BASE ((test_thread_flag(TIF_32BIT)) ? \
124 TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 )
125#endif
126
127#ifdef __KERNEL__
128#ifdef __powerpc64__
129
130#define STACK_TOP_USER64 TASK_SIZE_USER64
131#define STACK_TOP_USER32 TASK_SIZE_USER32
132
133#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
134 STACK_TOP_USER32 : STACK_TOP_USER64)
135
136#define STACK_TOP_MAX STACK_TOP_USER64
137
138#else /* __powerpc64__ */
139
140#define STACK_TOP TASK_SIZE
141#define STACK_TOP_MAX STACK_TOP
142
143#endif /* __powerpc64__ */
144#endif /* __KERNEL__ */
145
146typedef struct {
147 unsigned long seg;
148} mm_segment_t;
149
150#define TS_FPROFFSET 0
151#define TS_VSRLOWOFFSET 1
152#define TS_FPR(i) fpr[i][TS_FPROFFSET]
153
154struct thread_struct {
155 unsigned long ksp; /* Kernel stack pointer */
156 unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */
157
158#ifdef CONFIG_PPC64
159 unsigned long ksp_vsid;
160#endif
161 struct pt_regs *regs; /* Pointer to saved register state */
162 mm_segment_t fs; /* for get_fs() validation */
163#ifdef CONFIG_PPC32
164 void *pgdir; /* root of page-table tree */
165#endif
166#if defined(CONFIG_4xx) || defined (CONFIG_BOOKE)
167 unsigned long dbcr0; /* debug control register values */
168 unsigned long dbcr1;
169#endif
170 /* FP and VSX 0-31 register set */
171 double fpr[32][TS_FPRWIDTH];
172 struct {
173
174 unsigned int pad;
175 unsigned int val; /* Floating point status */
176 } fpscr;
177 int fpexc_mode; /* floating-point exception mode */
178 unsigned int align_ctl; /* alignment handling control */
179#ifdef CONFIG_PPC64
180 unsigned long start_tb; /* Start purr when proc switched in */
181 unsigned long accum_tb; /* Total accumilated purr for process */
182#endif
183 unsigned long dabr; /* Data address breakpoint register */
184#ifdef CONFIG_ALTIVEC
185 /* Complete AltiVec register set */
186 vector128 vr[32] __attribute__((aligned(16)));
187 /* AltiVec status */
188 vector128 vscr __attribute__((aligned(16)));
189 unsigned long vrsave;
190 int used_vr; /* set if process has used altivec */
191#endif /* CONFIG_ALTIVEC */
192#ifdef CONFIG_VSX
193 /* VSR status */
194 int used_vsr; /* set if process has used altivec */
195#endif /* CONFIG_VSX */
196#ifdef CONFIG_SPE
197 unsigned long evr[32]; /* upper 32-bits of SPE regs */
198 u64 acc; /* Accumulator */
199 unsigned long spefscr; /* SPE & eFP status */
200 int used_spe; /* set if process has used spe */
201#endif /* CONFIG_SPE */
202};
203
204#define ARCH_MIN_TASKALIGN 16
205
206#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
207#define INIT_SP_LIMIT \
208 (_ALIGN_UP(sizeof(init_thread_info), 16) + (unsigned long) &init_stack)
209
210
211#ifdef CONFIG_PPC32
212#define INIT_THREAD { \
213 .ksp = INIT_SP, \
214 .ksp_limit = INIT_SP_LIMIT, \
215 .fs = KERNEL_DS, \
216 .pgdir = swapper_pg_dir, \
217 .fpexc_mode = MSR_FE0 | MSR_FE1, \
218}
219#else
220#define INIT_THREAD { \
221 .ksp = INIT_SP, \
222 .ksp_limit = INIT_SP_LIMIT, \
223 .regs = (struct pt_regs *)INIT_SP - 1, /* XXX bogus, I think */ \
224 .fs = KERNEL_DS, \
225 .fpr = {{0}}, \
226 .fpscr = { .val = 0, }, \
227 .fpexc_mode = 0, \
228}
229#endif
230
231/*
232 * Return saved PC of a blocked thread. For now, this is the "user" PC
233 */
234#define thread_saved_pc(tsk) \
235 ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
236
237#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.regs)
238
239unsigned long get_wchan(struct task_struct *p);
240
241#define KSTK_EIP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
242#define KSTK_ESP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0)
243
244/* Get/set floating-point exception mode */
245#define GET_FPEXC_CTL(tsk, adr) get_fpexc_mode((tsk), (adr))
246#define SET_FPEXC_CTL(tsk, val) set_fpexc_mode((tsk), (val))
247
248extern int get_fpexc_mode(struct task_struct *tsk, unsigned long adr);
249extern int set_fpexc_mode(struct task_struct *tsk, unsigned int val);
250
251#define GET_ENDIAN(tsk, adr) get_endian((tsk), (adr))
252#define SET_ENDIAN(tsk, val) set_endian((tsk), (val))
253
254extern int get_endian(struct task_struct *tsk, unsigned long adr);
255extern int set_endian(struct task_struct *tsk, unsigned int val);
256
257#define GET_UNALIGN_CTL(tsk, adr) get_unalign_ctl((tsk), (adr))
258#define SET_UNALIGN_CTL(tsk, val) set_unalign_ctl((tsk), (val))
259
260extern int get_unalign_ctl(struct task_struct *tsk, unsigned long adr);
261extern int set_unalign_ctl(struct task_struct *tsk, unsigned int val);
262
263static inline unsigned int __unpack_fe01(unsigned long msr_bits)
264{
265 return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8);
266}
267
268static inline unsigned long __pack_fe01(unsigned int fpmode)
269{
270 return ((fpmode << 10) & MSR_FE0) | ((fpmode << 8) & MSR_FE1);
271}
272
273#ifdef CONFIG_PPC64
274#define cpu_relax() do { HMT_low(); HMT_medium(); barrier(); } while (0)
275#else
276#define cpu_relax() barrier()
277#endif
278
279/* Check that a certain kernel stack pointer is valid in task_struct p */
280int validate_sp(unsigned long sp, struct task_struct *p,
281 unsigned long nbytes);
282
283/*
284 * Prefetch macros.
285 */
286#define ARCH_HAS_PREFETCH
287#define ARCH_HAS_PREFETCHW
288#define ARCH_HAS_SPINLOCK_PREFETCH
289
290static inline void prefetch(const void *x)
291{
292 if (unlikely(!x))
293 return;
294
295 __asm__ __volatile__ ("dcbt 0,%0" : : "r" (x));
296}
297
298static inline void prefetchw(const void *x)
299{
300 if (unlikely(!x))
301 return;
302
303 __asm__ __volatile__ ("dcbtst 0,%0" : : "r" (x));
304}
305
306#define spin_lock_prefetch(x) prefetchw(x)
307
308#ifdef CONFIG_PPC64
309#define HAVE_ARCH_PICK_MMAP_LAYOUT
310#endif
311
312#endif /* __KERNEL__ */
313#endif /* __ASSEMBLY__ */
314#endif /* _ASM_POWERPC_PROCESSOR_H */
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
new file mode 100644
index 000000000000..eb3bd2e1c7f6
--- /dev/null
+++ b/arch/powerpc/include/asm/prom.h
@@ -0,0 +1,356 @@
1#ifndef _POWERPC_PROM_H
2#define _POWERPC_PROM_H
3#ifdef __KERNEL__
4
5/*
6 * Definitions for talking to the Open Firmware PROM on
7 * Power Macintosh computers.
8 *
9 * Copyright (C) 1996-2005 Paul Mackerras.
10 *
11 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 */
18#include <linux/types.h>
19#include <linux/proc_fs.h>
20#include <linux/platform_device.h>
21#include <asm/irq.h>
22#include <asm/atomic.h>
23
24#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
25#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
26
27#define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2))
28#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
29#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
30
31/* Definitions used by the flattened device tree */
32#define OF_DT_HEADER 0xd00dfeed /* marker */
33#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
34#define OF_DT_END_NODE 0x2 /* End node */
35#define OF_DT_PROP 0x3 /* Property: name off, size,
36 * content */
37#define OF_DT_NOP 0x4 /* nop */
38#define OF_DT_END 0x9
39
40#define OF_DT_VERSION 0x10
41
42/*
43 * This is what gets passed to the kernel by prom_init or kexec
44 *
45 * The dt struct contains the device tree structure, full pathes and
46 * property contents. The dt strings contain a separate block with just
47 * the strings for the property names, and is fully page aligned and
48 * self contained in a page, so that it can be kept around by the kernel,
49 * each property name appears only once in this page (cheap compression)
50 *
51 * the mem_rsvmap contains a map of reserved ranges of physical memory,
52 * passing it here instead of in the device-tree itself greatly simplifies
53 * the job of everybody. It's just a list of u64 pairs (base/size) that
54 * ends when size is 0
55 */
56struct boot_param_header
57{
58 u32 magic; /* magic word OF_DT_HEADER */
59 u32 totalsize; /* total size of DT block */
60 u32 off_dt_struct; /* offset to structure */
61 u32 off_dt_strings; /* offset to strings */
62 u32 off_mem_rsvmap; /* offset to memory reserve map */
63 u32 version; /* format version */
64 u32 last_comp_version; /* last compatible version */
65 /* version 2 fields below */
66 u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
67 /* version 3 fields below */
68 u32 dt_strings_size; /* size of the DT strings block */
69 /* version 17 fields below */
70 u32 dt_struct_size; /* size of the DT structure block */
71};
72
73
74
75typedef u32 phandle;
76typedef u32 ihandle;
77
78struct property {
79 char *name;
80 int length;
81 void *value;
82 struct property *next;
83};
84
85struct device_node {
86 const char *name;
87 const char *type;
88 phandle node;
89 phandle linux_phandle;
90 char *full_name;
91
92 struct property *properties;
93 struct property *deadprops; /* removed properties */
94 struct device_node *parent;
95 struct device_node *child;
96 struct device_node *sibling;
97 struct device_node *next; /* next device of same type */
98 struct device_node *allnext; /* next in list of all nodes */
99 struct proc_dir_entry *pde; /* this node's proc directory */
100 struct kref kref;
101 unsigned long _flags;
102 void *data;
103};
104
105extern struct device_node *of_chosen;
106
107static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
108{
109 return test_bit(flag, &n->_flags);
110}
111
112static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
113{
114 set_bit(flag, &n->_flags);
115}
116
117
118#define HAVE_ARCH_DEVTREE_FIXUPS
119
120static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
121{
122 dn->pde = de;
123}
124
125
126extern struct device_node *of_find_all_nodes(struct device_node *prev);
127extern struct device_node *of_node_get(struct device_node *node);
128extern void of_node_put(struct device_node *node);
129
130/* For scanning the flat device-tree at boot time */
131extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
132 const char *uname, int depth,
133 void *data),
134 void *data);
135extern void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
136 unsigned long *size);
137extern int __init of_flat_dt_is_compatible(unsigned long node, const char *name);
138extern unsigned long __init of_get_flat_dt_root(void);
139
140/* For updating the device tree at runtime */
141extern void of_attach_node(struct device_node *);
142extern void of_detach_node(struct device_node *);
143
144/* Other Prototypes */
145extern void finish_device_tree(void);
146extern void unflatten_device_tree(void);
147extern void early_init_devtree(void *);
148extern int machine_is_compatible(const char *compat);
149extern void print_properties(struct device_node *node);
150extern int prom_n_intr_cells(struct device_node* np);
151extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
152extern int prom_add_property(struct device_node* np, struct property* prop);
153extern int prom_remove_property(struct device_node *np, struct property *prop);
154extern int prom_update_property(struct device_node *np,
155 struct property *newprop,
156 struct property *oldprop);
157
158#ifdef CONFIG_PPC32
159/*
160 * PCI <-> OF matching functions
161 * (XXX should these be here?)
162 */
163struct pci_bus;
164struct pci_dev;
165extern int pci_device_from_OF_node(struct device_node *node,
166 u8* bus, u8* devfn);
167extern struct device_node* pci_busdev_to_OF_node(struct pci_bus *, int);
168extern struct device_node* pci_device_to_OF_node(struct pci_dev *);
169extern void pci_create_OF_bus_map(void);
170#endif
171
172extern struct resource *request_OF_resource(struct device_node* node,
173 int index, const char* name_postfix);
174extern int release_OF_resource(struct device_node* node, int index);
175
176
177/*
178 * OF address retreival & translation
179 */
180
181
182/* Helper to read a big number; size is in cells (not bytes) */
183static inline u64 of_read_number(const u32 *cell, int size)
184{
185 u64 r = 0;
186 while (size--)
187 r = (r << 32) | *(cell++);
188 return r;
189}
190
191/* Like of_read_number, but we want an unsigned long result */
192#ifdef CONFIG_PPC32
193static inline unsigned long of_read_ulong(const u32 *cell, int size)
194{
195 return cell[size-1];
196}
197#else
198#define of_read_ulong(cell, size) of_read_number(cell, size)
199#endif
200
201/* Translate an OF address block into a CPU physical address
202 */
203extern u64 of_translate_address(struct device_node *np, const u32 *addr);
204
205/* Translate a DMA address from device space to CPU space */
206extern u64 of_translate_dma_address(struct device_node *dev,
207 const u32 *in_addr);
208
209/* Extract an address from a device, returns the region size and
210 * the address space flags too. The PCI version uses a BAR number
211 * instead of an absolute index
212 */
213extern const u32 *of_get_address(struct device_node *dev, int index,
214 u64 *size, unsigned int *flags);
215#ifdef CONFIG_PCI
216extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
217 u64 *size, unsigned int *flags);
218#else
219static inline const u32 *of_get_pci_address(struct device_node *dev,
220 int bar_no, u64 *size, unsigned int *flags)
221{
222 return NULL;
223}
224#endif /* CONFIG_PCI */
225
226/* Get an address as a resource. Note that if your address is
227 * a PIO address, the conversion will fail if the physical address
228 * can't be internally converted to an IO token with
229 * pci_address_to_pio(), that is because it's either called to early
230 * or it can't be matched to any host bridge IO space
231 */
232extern int of_address_to_resource(struct device_node *dev, int index,
233 struct resource *r);
234#ifdef CONFIG_PCI
235extern int of_pci_address_to_resource(struct device_node *dev, int bar,
236 struct resource *r);
237#else
238static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
239 struct resource *r)
240{
241 return -ENOSYS;
242}
243#endif /* CONFIG_PCI */
244
245/* Parse the ibm,dma-window property of an OF node into the busno, phys and
246 * size parameters.
247 */
248void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
249 unsigned long *busno, unsigned long *phys, unsigned long *size);
250
251extern void kdump_move_device_tree(void);
252
253/* CPU OF node matching */
254struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
255
256/* Get the MAC address */
257extern const void *of_get_mac_address(struct device_node *np);
258
259/*
260 * OF interrupt mapping
261 */
262
263/* This structure is returned when an interrupt is mapped. The controller
264 * field needs to be put() after use
265 */
266
267#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
268
269struct of_irq {
270 struct device_node *controller; /* Interrupt controller node */
271 u32 size; /* Specifier size */
272 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
273};
274
275/**
276 * of_irq_map_init - Initialize the irq remapper
277 * @flags: flags defining workarounds to enable
278 *
279 * Some machines have bugs in the device-tree which require certain workarounds
280 * to be applied. Call this before any interrupt mapping attempts to enable
281 * those workarounds.
282 */
283#define OF_IMAP_OLDWORLD_MAC 0x00000001
284#define OF_IMAP_NO_PHANDLE 0x00000002
285
286extern void of_irq_map_init(unsigned int flags);
287
288/**
289 * of_irq_map_raw - Low level interrupt tree parsing
290 * @parent: the device interrupt parent
291 * @intspec: interrupt specifier ("interrupts" property of the device)
292 * @ointsize: size of the passed in interrupt specifier
293 * @addr: address specifier (start of "reg" property of the device)
294 * @out_irq: structure of_irq filled by this function
295 *
296 * Returns 0 on success and a negative number on error
297 *
298 * This function is a low-level interrupt tree walking function. It
299 * can be used to do a partial walk with synthetized reg and interrupts
300 * properties, for example when resolving PCI interrupts when no device
301 * node exist for the parent.
302 *
303 */
304
305extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
306 u32 ointsize, const u32 *addr,
307 struct of_irq *out_irq);
308
309
310/**
311 * of_irq_map_one - Resolve an interrupt for a device
312 * @device: the device whose interrupt is to be resolved
313 * @index: index of the interrupt to resolve
314 * @out_irq: structure of_irq filled by this function
315 *
316 * This function resolves an interrupt, walking the tree, for a given
317 * device-tree node. It's the high level pendant to of_irq_map_raw().
318 * It also implements the workarounds for OldWolrd Macs.
319 */
320extern int of_irq_map_one(struct device_node *device, int index,
321 struct of_irq *out_irq);
322
323/**
324 * of_irq_map_pci - Resolve the interrupt for a PCI device
325 * @pdev: the device whose interrupt is to be resolved
326 * @out_irq: structure of_irq filled by this function
327 *
328 * This function resolves the PCI interrupt for a given PCI device. If a
329 * device-node exists for a given pci_dev, it will use normal OF tree
330 * walking. If not, it will implement standard swizzling and walk up the
331 * PCI tree until an device-node is found, at which point it will finish
332 * resolving using the OF tree walking.
333 */
334struct pci_dev;
335extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
336
337extern int of_irq_to_resource(struct device_node *dev, int index,
338 struct resource *r);
339
340/**
341 * of_iomap - Maps the memory mapped IO for a given device_node
342 * @device: the device whose io range will be mapped
343 * @index: index of the io range
344 *
345 * Returns a pointer to the mapped memory
346 */
347extern void __iomem *of_iomap(struct device_node *device, int index);
348
349/*
350 * NB: This is here while we transition from using asm/prom.h
351 * to linux/of.h
352 */
353#include <linux/of.h>
354
355#endif /* __KERNEL__ */
356#endif /* _POWERPC_PROM_H */
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
new file mode 100644
index 000000000000..f9e34c493cbb
--- /dev/null
+++ b/arch/powerpc/include/asm/ps3.h
@@ -0,0 +1,519 @@
1/*
2 * PS3 platform declarations.
3 *
4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp.
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; version 2 of the License.
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
21#if !defined(_ASM_POWERPC_PS3_H)
22#define _ASM_POWERPC_PS3_H
23
24#include <linux/init.h>
25#include <linux/types.h>
26#include <linux/device.h>
27#include "cell-pmu.h"
28
29union ps3_firmware_version {
30 u64 raw;
31 struct {
32 u16 pad;
33 u16 major;
34 u16 minor;
35 u16 rev;
36 };
37};
38
39void ps3_get_firmware_version(union ps3_firmware_version *v);
40int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev);
41
42/* 'Other OS' area */
43
44enum ps3_param_av_multi_out {
45 PS3_PARAM_AV_MULTI_OUT_NTSC = 0,
46 PS3_PARAM_AV_MULTI_OUT_PAL_RGB = 1,
47 PS3_PARAM_AV_MULTI_OUT_PAL_YCBCR = 2,
48 PS3_PARAM_AV_MULTI_OUT_SECAM = 3,
49};
50
51enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void);
52
53/* dma routines */
54
55enum ps3_dma_page_size {
56 PS3_DMA_4K = 12U,
57 PS3_DMA_64K = 16U,
58 PS3_DMA_1M = 20U,
59 PS3_DMA_16M = 24U,
60};
61
62enum ps3_dma_region_type {
63 PS3_DMA_OTHER = 0,
64 PS3_DMA_INTERNAL = 2,
65};
66
67struct ps3_dma_region_ops;
68
69/**
70 * struct ps3_dma_region - A per device dma state variables structure
71 * @did: The HV device id.
72 * @page_size: The ioc pagesize.
73 * @region_type: The HV region type.
74 * @bus_addr: The 'translated' bus address of the region.
75 * @len: The length in bytes of the region.
76 * @offset: The offset from the start of memory of the region.
77 * @ioid: The IOID of the device who owns this region
78 * @chunk_list: Opaque variable used by the ioc page manager.
79 * @region_ops: struct ps3_dma_region_ops - dma region operations
80 */
81
82struct ps3_dma_region {
83 struct ps3_system_bus_device *dev;
84 /* device variables */
85 const struct ps3_dma_region_ops *region_ops;
86 unsigned char ioid;
87 enum ps3_dma_page_size page_size;
88 enum ps3_dma_region_type region_type;
89 unsigned long len;
90 unsigned long offset;
91
92 /* driver variables (set by ps3_dma_region_create) */
93 unsigned long bus_addr;
94 struct {
95 spinlock_t lock;
96 struct list_head head;
97 } chunk_list;
98};
99
100struct ps3_dma_region_ops {
101 int (*create)(struct ps3_dma_region *);
102 int (*free)(struct ps3_dma_region *);
103 int (*map)(struct ps3_dma_region *,
104 unsigned long virt_addr,
105 unsigned long len,
106 unsigned long *bus_addr,
107 u64 iopte_pp);
108 int (*unmap)(struct ps3_dma_region *,
109 unsigned long bus_addr,
110 unsigned long len);
111};
112/**
113 * struct ps3_dma_region_init - Helper to initialize structure variables
114 *
115 * Helper to properly initialize variables prior to calling
116 * ps3_system_bus_device_register.
117 */
118
119struct ps3_system_bus_device;
120
121int ps3_dma_region_init(struct ps3_system_bus_device *dev,
122 struct ps3_dma_region *r, enum ps3_dma_page_size page_size,
123 enum ps3_dma_region_type region_type, void *addr, unsigned long len);
124int ps3_dma_region_create(struct ps3_dma_region *r);
125int ps3_dma_region_free(struct ps3_dma_region *r);
126int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr,
127 unsigned long len, unsigned long *bus_addr,
128 u64 iopte_pp);
129int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr,
130 unsigned long len);
131
132/* mmio routines */
133
134enum ps3_mmio_page_size {
135 PS3_MMIO_4K = 12U,
136 PS3_MMIO_64K = 16U
137};
138
139struct ps3_mmio_region_ops;
140/**
141 * struct ps3_mmio_region - a per device mmio state variables structure
142 *
143 * Current systems can be supported with a single region per device.
144 */
145
146struct ps3_mmio_region {
147 struct ps3_system_bus_device *dev;
148 const struct ps3_mmio_region_ops *mmio_ops;
149 unsigned long bus_addr;
150 unsigned long len;
151 enum ps3_mmio_page_size page_size;
152 unsigned long lpar_addr;
153};
154
155struct ps3_mmio_region_ops {
156 int (*create)(struct ps3_mmio_region *);
157 int (*free)(struct ps3_mmio_region *);
158};
159/**
160 * struct ps3_mmio_region_init - Helper to initialize structure variables
161 *
162 * Helper to properly initialize variables prior to calling
163 * ps3_system_bus_device_register.
164 */
165
166int ps3_mmio_region_init(struct ps3_system_bus_device *dev,
167 struct ps3_mmio_region *r, unsigned long bus_addr, unsigned long len,
168 enum ps3_mmio_page_size page_size);
169int ps3_mmio_region_create(struct ps3_mmio_region *r);
170int ps3_free_mmio_region(struct ps3_mmio_region *r);
171unsigned long ps3_mm_phys_to_lpar(unsigned long phys_addr);
172
173/* inrerrupt routines */
174
175enum ps3_cpu_binding {
176 PS3_BINDING_CPU_ANY = -1,
177 PS3_BINDING_CPU_0 = 0,
178 PS3_BINDING_CPU_1 = 1,
179};
180
181int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
182 unsigned int *virq);
183int ps3_irq_plug_destroy(unsigned int virq);
184int ps3_event_receive_port_setup(enum ps3_cpu_binding cpu, unsigned int *virq);
185int ps3_event_receive_port_destroy(unsigned int virq);
186int ps3_send_event_locally(unsigned int virq);
187
188int ps3_io_irq_setup(enum ps3_cpu_binding cpu, unsigned int interrupt_id,
189 unsigned int *virq);
190int ps3_io_irq_destroy(unsigned int virq);
191int ps3_vuart_irq_setup(enum ps3_cpu_binding cpu, void* virt_addr_bmp,
192 unsigned int *virq);
193int ps3_vuart_irq_destroy(unsigned int virq);
194int ps3_spe_irq_setup(enum ps3_cpu_binding cpu, unsigned long spe_id,
195 unsigned int class, unsigned int *virq);
196int ps3_spe_irq_destroy(unsigned int virq);
197
198int ps3_sb_event_receive_port_setup(struct ps3_system_bus_device *dev,
199 enum ps3_cpu_binding cpu, unsigned int *virq);
200int ps3_sb_event_receive_port_destroy(struct ps3_system_bus_device *dev,
201 unsigned int virq);
202
203/* lv1 result codes */
204
205enum lv1_result {
206 LV1_SUCCESS = 0,
207 /* not used -1 */
208 LV1_RESOURCE_SHORTAGE = -2,
209 LV1_NO_PRIVILEGE = -3,
210 LV1_DENIED_BY_POLICY = -4,
211 LV1_ACCESS_VIOLATION = -5,
212 LV1_NO_ENTRY = -6,
213 LV1_DUPLICATE_ENTRY = -7,
214 LV1_TYPE_MISMATCH = -8,
215 LV1_BUSY = -9,
216 LV1_EMPTY = -10,
217 LV1_WRONG_STATE = -11,
218 /* not used -12 */
219 LV1_NO_MATCH = -13,
220 LV1_ALREADY_CONNECTED = -14,
221 LV1_UNSUPPORTED_PARAMETER_VALUE = -15,
222 LV1_CONDITION_NOT_SATISFIED = -16,
223 LV1_ILLEGAL_PARAMETER_VALUE = -17,
224 LV1_BAD_OPTION = -18,
225 LV1_IMPLEMENTATION_LIMITATION = -19,
226 LV1_NOT_IMPLEMENTED = -20,
227 LV1_INVALID_CLASS_ID = -21,
228 LV1_CONSTRAINT_NOT_SATISFIED = -22,
229 LV1_ALIGNMENT_ERROR = -23,
230 LV1_HARDWARE_ERROR = -24,
231 LV1_INVALID_DATA_FORMAT = -25,
232 LV1_INVALID_OPERATION = -26,
233 LV1_INTERNAL_ERROR = -32768,
234};
235
236static inline const char* ps3_result(int result)
237{
238#if defined(DEBUG)
239 switch (result) {
240 case LV1_SUCCESS:
241 return "LV1_SUCCESS (0)";
242 case -1:
243 return "** unknown result ** (-1)";
244 case LV1_RESOURCE_SHORTAGE:
245 return "LV1_RESOURCE_SHORTAGE (-2)";
246 case LV1_NO_PRIVILEGE:
247 return "LV1_NO_PRIVILEGE (-3)";
248 case LV1_DENIED_BY_POLICY:
249 return "LV1_DENIED_BY_POLICY (-4)";
250 case LV1_ACCESS_VIOLATION:
251 return "LV1_ACCESS_VIOLATION (-5)";
252 case LV1_NO_ENTRY:
253 return "LV1_NO_ENTRY (-6)";
254 case LV1_DUPLICATE_ENTRY:
255 return "LV1_DUPLICATE_ENTRY (-7)";
256 case LV1_TYPE_MISMATCH:
257 return "LV1_TYPE_MISMATCH (-8)";
258 case LV1_BUSY:
259 return "LV1_BUSY (-9)";
260 case LV1_EMPTY:
261 return "LV1_EMPTY (-10)";
262 case LV1_WRONG_STATE:
263 return "LV1_WRONG_STATE (-11)";
264 case -12:
265 return "** unknown result ** (-12)";
266 case LV1_NO_MATCH:
267 return "LV1_NO_MATCH (-13)";
268 case LV1_ALREADY_CONNECTED:
269 return "LV1_ALREADY_CONNECTED (-14)";
270 case LV1_UNSUPPORTED_PARAMETER_VALUE:
271 return "LV1_UNSUPPORTED_PARAMETER_VALUE (-15)";
272 case LV1_CONDITION_NOT_SATISFIED:
273 return "LV1_CONDITION_NOT_SATISFIED (-16)";
274 case LV1_ILLEGAL_PARAMETER_VALUE:
275 return "LV1_ILLEGAL_PARAMETER_VALUE (-17)";
276 case LV1_BAD_OPTION:
277 return "LV1_BAD_OPTION (-18)";
278 case LV1_IMPLEMENTATION_LIMITATION:
279 return "LV1_IMPLEMENTATION_LIMITATION (-19)";
280 case LV1_NOT_IMPLEMENTED:
281 return "LV1_NOT_IMPLEMENTED (-20)";
282 case LV1_INVALID_CLASS_ID:
283 return "LV1_INVALID_CLASS_ID (-21)";
284 case LV1_CONSTRAINT_NOT_SATISFIED:
285 return "LV1_CONSTRAINT_NOT_SATISFIED (-22)";
286 case LV1_ALIGNMENT_ERROR:
287 return "LV1_ALIGNMENT_ERROR (-23)";
288 case LV1_HARDWARE_ERROR:
289 return "LV1_HARDWARE_ERROR (-24)";
290 case LV1_INVALID_DATA_FORMAT:
291 return "LV1_INVALID_DATA_FORMAT (-25)";
292 case LV1_INVALID_OPERATION:
293 return "LV1_INVALID_OPERATION (-26)";
294 case LV1_INTERNAL_ERROR:
295 return "LV1_INTERNAL_ERROR (-32768)";
296 default:
297 BUG();
298 return "** unknown result **";
299 };
300#else
301 return "";
302#endif
303}
304
305/* system bus routines */
306
307enum ps3_match_id {
308 PS3_MATCH_ID_EHCI = 1,
309 PS3_MATCH_ID_OHCI = 2,
310 PS3_MATCH_ID_GELIC = 3,
311 PS3_MATCH_ID_AV_SETTINGS = 4,
312 PS3_MATCH_ID_SYSTEM_MANAGER = 5,
313 PS3_MATCH_ID_STOR_DISK = 6,
314 PS3_MATCH_ID_STOR_ROM = 7,
315 PS3_MATCH_ID_STOR_FLASH = 8,
316 PS3_MATCH_ID_SOUND = 9,
317 PS3_MATCH_ID_GRAPHICS = 10,
318 PS3_MATCH_ID_LPM = 11,
319};
320
321#define PS3_MODULE_ALIAS_EHCI "ps3:1"
322#define PS3_MODULE_ALIAS_OHCI "ps3:2"
323#define PS3_MODULE_ALIAS_GELIC "ps3:3"
324#define PS3_MODULE_ALIAS_AV_SETTINGS "ps3:4"
325#define PS3_MODULE_ALIAS_SYSTEM_MANAGER "ps3:5"
326#define PS3_MODULE_ALIAS_STOR_DISK "ps3:6"
327#define PS3_MODULE_ALIAS_STOR_ROM "ps3:7"
328#define PS3_MODULE_ALIAS_STOR_FLASH "ps3:8"
329#define PS3_MODULE_ALIAS_SOUND "ps3:9"
330#define PS3_MODULE_ALIAS_GRAPHICS "ps3:10"
331#define PS3_MODULE_ALIAS_LPM "ps3:11"
332
333enum ps3_system_bus_device_type {
334 PS3_DEVICE_TYPE_IOC0 = 1,
335 PS3_DEVICE_TYPE_SB,
336 PS3_DEVICE_TYPE_VUART,
337 PS3_DEVICE_TYPE_LPM,
338};
339
340enum ps3_match_sub_id {
341 /* for PS3_MATCH_ID_GRAPHICS */
342 PS3_MATCH_SUB_ID_FB = 1,
343};
344
345/**
346 * struct ps3_system_bus_device - a device on the system bus
347 */
348
349struct ps3_system_bus_device {
350 enum ps3_match_id match_id;
351 enum ps3_match_sub_id match_sub_id;
352 enum ps3_system_bus_device_type dev_type;
353
354 u64 bus_id; /* SB */
355 u64 dev_id; /* SB */
356 unsigned int interrupt_id; /* SB */
357 struct ps3_dma_region *d_region; /* SB, IOC0 */
358 struct ps3_mmio_region *m_region; /* SB, IOC0*/
359 unsigned int port_number; /* VUART */
360 struct { /* LPM */
361 u64 node_id;
362 u64 pu_id;
363 u64 rights;
364 } lpm;
365
366/* struct iommu_table *iommu_table; -- waiting for BenH's cleanups */
367 struct device core;
368 void *driver_priv; /* private driver variables */
369};
370
371int ps3_open_hv_device(struct ps3_system_bus_device *dev);
372int ps3_close_hv_device(struct ps3_system_bus_device *dev);
373
374/**
375 * struct ps3_system_bus_driver - a driver for a device on the system bus
376 */
377
378struct ps3_system_bus_driver {
379 enum ps3_match_id match_id;
380 enum ps3_match_sub_id match_sub_id;
381 struct device_driver core;
382 int (*probe)(struct ps3_system_bus_device *);
383 int (*remove)(struct ps3_system_bus_device *);
384 int (*shutdown)(struct ps3_system_bus_device *);
385/* int (*suspend)(struct ps3_system_bus_device *, pm_message_t); */
386/* int (*resume)(struct ps3_system_bus_device *); */
387};
388
389int ps3_system_bus_device_register(struct ps3_system_bus_device *dev);
390int ps3_system_bus_driver_register(struct ps3_system_bus_driver *drv);
391void ps3_system_bus_driver_unregister(struct ps3_system_bus_driver *drv);
392
393static inline struct ps3_system_bus_driver *ps3_drv_to_system_bus_drv(
394 struct device_driver *_drv)
395{
396 return container_of(_drv, struct ps3_system_bus_driver, core);
397}
398static inline struct ps3_system_bus_device *ps3_dev_to_system_bus_dev(
399 struct device *_dev)
400{
401 return container_of(_dev, struct ps3_system_bus_device, core);
402}
403static inline struct ps3_system_bus_driver *
404 ps3_system_bus_dev_to_system_bus_drv(struct ps3_system_bus_device *_dev)
405{
406 BUG_ON(!_dev);
407 BUG_ON(!_dev->core.driver);
408 return ps3_drv_to_system_bus_drv(_dev->core.driver);
409}
410
411/**
412 * ps3_system_bus_set_drvdata -
413 * @dev: device structure
414 * @data: Data to set
415 */
416
417static inline void ps3_system_bus_set_driver_data(
418 struct ps3_system_bus_device *dev, void *data)
419{
420 dev->core.driver_data = data;
421}
422static inline void *ps3_system_bus_get_driver_data(
423 struct ps3_system_bus_device *dev)
424{
425 return dev->core.driver_data;
426}
427
428/* These two need global scope for get_dma_ops(). */
429
430extern struct bus_type ps3_system_bus_type;
431
432/* system manager */
433
434struct ps3_sys_manager_ops {
435 struct ps3_system_bus_device *dev;
436 void (*power_off)(struct ps3_system_bus_device *dev);
437 void (*restart)(struct ps3_system_bus_device *dev);
438};
439
440void ps3_sys_manager_register_ops(const struct ps3_sys_manager_ops *ops);
441void __noreturn ps3_sys_manager_power_off(void);
442void __noreturn ps3_sys_manager_restart(void);
443void __noreturn ps3_sys_manager_halt(void);
444int ps3_sys_manager_get_wol(void);
445void ps3_sys_manager_set_wol(int state);
446
447struct ps3_prealloc {
448 const char *name;
449 void *address;
450 unsigned long size;
451 unsigned long align;
452};
453
454extern struct ps3_prealloc ps3fb_videomemory;
455extern struct ps3_prealloc ps3flash_bounce_buffer;
456
457/* logical performance monitor */
458
459/**
460 * enum ps3_lpm_rights - Rigths granted by the system policy module.
461 *
462 * @PS3_LPM_RIGHTS_USE_LPM: The right to use the lpm.
463 * @PS3_LPM_RIGHTS_USE_TB: The right to use the internal trace buffer.
464 */
465
466enum ps3_lpm_rights {
467 PS3_LPM_RIGHTS_USE_LPM = 0x001,
468 PS3_LPM_RIGHTS_USE_TB = 0x100,
469};
470
471/**
472 * enum ps3_lpm_tb_type - Type of trace buffer lv1 should use.
473 *
474 * @PS3_LPM_TB_TYPE_NONE: Do not use a trace buffer.
475 * @PS3_LPM_RIGHTS_USE_TB: Use the lv1 internal trace buffer. Must have
476 * rights @PS3_LPM_RIGHTS_USE_TB.
477 */
478
479enum ps3_lpm_tb_type {
480 PS3_LPM_TB_TYPE_NONE = 0,
481 PS3_LPM_TB_TYPE_INTERNAL = 1,
482};
483
484int ps3_lpm_open(enum ps3_lpm_tb_type tb_type, void *tb_cache,
485 u64 tb_cache_size);
486int ps3_lpm_close(void);
487int ps3_lpm_copy_tb(unsigned long offset, void *buf, unsigned long count,
488 unsigned long *bytes_copied);
489int ps3_lpm_copy_tb_to_user(unsigned long offset, void __user *buf,
490 unsigned long count, unsigned long *bytes_copied);
491void ps3_set_bookmark(u64 bookmark);
492void ps3_set_pm_bookmark(u64 tag, u64 incident, u64 th_id);
493int ps3_set_signal(u64 rtas_signal_group, u8 signal_bit, u16 sub_unit,
494 u8 bus_word);
495
496u32 ps3_read_phys_ctr(u32 cpu, u32 phys_ctr);
497void ps3_write_phys_ctr(u32 cpu, u32 phys_ctr, u32 val);
498u32 ps3_read_ctr(u32 cpu, u32 ctr);
499void ps3_write_ctr(u32 cpu, u32 ctr, u32 val);
500
501u32 ps3_read_pm07_control(u32 cpu, u32 ctr);
502void ps3_write_pm07_control(u32 cpu, u32 ctr, u32 val);
503u32 ps3_read_pm(u32 cpu, enum pm_reg_name reg);
504void ps3_write_pm(u32 cpu, enum pm_reg_name reg, u32 val);
505
506u32 ps3_get_ctr_size(u32 cpu, u32 phys_ctr);
507void ps3_set_ctr_size(u32 cpu, u32 phys_ctr, u32 ctr_size);
508
509void ps3_enable_pm(u32 cpu);
510void ps3_disable_pm(u32 cpu);
511void ps3_enable_pm_interrupts(u32 cpu, u32 thread, u32 mask);
512void ps3_disable_pm_interrupts(u32 cpu);
513
514u32 ps3_get_and_clear_pm_interrupts(u32 cpu);
515void ps3_sync_irq(int node);
516u32 ps3_get_hw_thread_id(int cpu);
517u64 ps3_get_spe_id(void *arg);
518
519#endif
diff --git a/arch/powerpc/include/asm/ps3av.h b/arch/powerpc/include/asm/ps3av.h
new file mode 100644
index 000000000000..fda98715cd35
--- /dev/null
+++ b/arch/powerpc/include/asm/ps3av.h
@@ -0,0 +1,744 @@
1/*
2 * PS3 AV backend support.
3 *
4 * Copyright (C) 2007 Sony Computer Entertainment Inc.
5 * Copyright 2007 Sony Corp.
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; version 2 of the License.
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
21#ifndef _ASM_POWERPC_PS3AV_H_
22#define _ASM_POWERPC_PS3AV_H_
23
24/** command for ioctl() **/
25#define PS3AV_VERSION 0x205 /* version of ps3av command */
26
27#define PS3AV_CID_AV_INIT 0x00000001
28#define PS3AV_CID_AV_FIN 0x00000002
29#define PS3AV_CID_AV_GET_HW_CONF 0x00000003
30#define PS3AV_CID_AV_GET_MONITOR_INFO 0x00000004
31#define PS3AV_CID_AV_ENABLE_EVENT 0x00000006
32#define PS3AV_CID_AV_DISABLE_EVENT 0x00000007
33#define PS3AV_CID_AV_TV_MUTE 0x0000000a
34
35#define PS3AV_CID_AV_VIDEO_CS 0x00010001
36#define PS3AV_CID_AV_VIDEO_MUTE 0x00010002
37#define PS3AV_CID_AV_VIDEO_DISABLE_SIG 0x00010003
38#define PS3AV_CID_AV_AUDIO_PARAM 0x00020001
39#define PS3AV_CID_AV_AUDIO_MUTE 0x00020002
40#define PS3AV_CID_AV_HDMI_MODE 0x00040001
41
42#define PS3AV_CID_VIDEO_INIT 0x01000001
43#define PS3AV_CID_VIDEO_MODE 0x01000002
44#define PS3AV_CID_VIDEO_FORMAT 0x01000004
45#define PS3AV_CID_VIDEO_PITCH 0x01000005
46
47#define PS3AV_CID_AUDIO_INIT 0x02000001
48#define PS3AV_CID_AUDIO_MODE 0x02000002
49#define PS3AV_CID_AUDIO_MUTE 0x02000003
50#define PS3AV_CID_AUDIO_ACTIVE 0x02000004
51#define PS3AV_CID_AUDIO_INACTIVE 0x02000005
52#define PS3AV_CID_AUDIO_SPDIF_BIT 0x02000006
53#define PS3AV_CID_AUDIO_CTRL 0x02000007
54
55#define PS3AV_CID_EVENT_UNPLUGGED 0x10000001
56#define PS3AV_CID_EVENT_PLUGGED 0x10000002
57#define PS3AV_CID_EVENT_HDCP_DONE 0x10000003
58#define PS3AV_CID_EVENT_HDCP_FAIL 0x10000004
59#define PS3AV_CID_EVENT_HDCP_AUTH 0x10000005
60#define PS3AV_CID_EVENT_HDCP_ERROR 0x10000006
61
62#define PS3AV_CID_AVB_PARAM 0x04000001
63
64/* max backend ports */
65#define PS3AV_HDMI_MAX 2 /* HDMI_0 HDMI_1 */
66#define PS3AV_AVMULTI_MAX 1 /* AVMULTI_0 */
67#define PS3AV_AV_PORT_MAX (PS3AV_HDMI_MAX + PS3AV_AVMULTI_MAX)
68#define PS3AV_OPT_PORT_MAX 1 /* SPDIF0 */
69#define PS3AV_HEAD_MAX 2 /* HEAD_A HEAD_B */
70
71/* num of pkt for PS3AV_CID_AVB_PARAM */
72#define PS3AV_AVB_NUM_VIDEO PS3AV_HEAD_MAX
73#define PS3AV_AVB_NUM_AUDIO 0 /* not supported */
74#define PS3AV_AVB_NUM_AV_VIDEO PS3AV_AV_PORT_MAX
75#define PS3AV_AVB_NUM_AV_AUDIO PS3AV_HDMI_MAX
76
77#define PS3AV_MUTE_PORT_MAX 1 /* num of ports in mute pkt */
78
79/* event_bit */
80#define PS3AV_CMD_EVENT_BIT_UNPLUGGED (1 << 0)
81#define PS3AV_CMD_EVENT_BIT_PLUGGED (1 << 1)
82#define PS3AV_CMD_EVENT_BIT_HDCP_DONE (1 << 2)
83#define PS3AV_CMD_EVENT_BIT_HDCP_FAIL (1 << 3)
84#define PS3AV_CMD_EVENT_BIT_HDCP_REAUTH (1 << 4)
85#define PS3AV_CMD_EVENT_BIT_HDCP_TOPOLOGY (1 << 5)
86
87/* common params */
88/* mute */
89#define PS3AV_CMD_MUTE_OFF 0x0000
90#define PS3AV_CMD_MUTE_ON 0x0001
91/* avport */
92#define PS3AV_CMD_AVPORT_HDMI_0 0x0000
93#define PS3AV_CMD_AVPORT_HDMI_1 0x0001
94#define PS3AV_CMD_AVPORT_AVMULTI_0 0x0010
95#define PS3AV_CMD_AVPORT_SPDIF_0 0x0020
96#define PS3AV_CMD_AVPORT_SPDIF_1 0x0021
97
98/* for av backend */
99/* av_mclk */
100#define PS3AV_CMD_AV_MCLK_128 0x0000
101#define PS3AV_CMD_AV_MCLK_256 0x0001
102#define PS3AV_CMD_AV_MCLK_512 0x0003
103/* av_inputlen */
104#define PS3AV_CMD_AV_INPUTLEN_16 0x02
105#define PS3AV_CMD_AV_INPUTLEN_20 0x0a
106#define PS3AV_CMD_AV_INPUTLEN_24 0x0b
107/* alayout */
108#define PS3AV_CMD_AV_LAYOUT_32 (1 << 0)
109#define PS3AV_CMD_AV_LAYOUT_44 (1 << 1)
110#define PS3AV_CMD_AV_LAYOUT_48 (1 << 2)
111#define PS3AV_CMD_AV_LAYOUT_88 (1 << 3)
112#define PS3AV_CMD_AV_LAYOUT_96 (1 << 4)
113#define PS3AV_CMD_AV_LAYOUT_176 (1 << 5)
114#define PS3AV_CMD_AV_LAYOUT_192 (1 << 6)
115/* hdmi_mode */
116#define PS3AV_CMD_AV_HDMI_MODE_NORMAL 0xff
117#define PS3AV_CMD_AV_HDMI_HDCP_OFF 0x01
118#define PS3AV_CMD_AV_HDMI_EDID_PASS 0x80
119#define PS3AV_CMD_AV_HDMI_DVI 0x40
120
121/* for video module */
122/* video_head */
123#define PS3AV_CMD_VIDEO_HEAD_A 0x0000
124#define PS3AV_CMD_VIDEO_HEAD_B 0x0001
125/* video_cs_out video_cs_in */
126#define PS3AV_CMD_VIDEO_CS_NONE 0x0000
127#define PS3AV_CMD_VIDEO_CS_RGB_8 0x0001
128#define PS3AV_CMD_VIDEO_CS_YUV444_8 0x0002
129#define PS3AV_CMD_VIDEO_CS_YUV422_8 0x0003
130#define PS3AV_CMD_VIDEO_CS_XVYCC_8 0x0004
131#define PS3AV_CMD_VIDEO_CS_RGB_10 0x0005
132#define PS3AV_CMD_VIDEO_CS_YUV444_10 0x0006
133#define PS3AV_CMD_VIDEO_CS_YUV422_10 0x0007
134#define PS3AV_CMD_VIDEO_CS_XVYCC_10 0x0008
135#define PS3AV_CMD_VIDEO_CS_RGB_12 0x0009
136#define PS3AV_CMD_VIDEO_CS_YUV444_12 0x000a
137#define PS3AV_CMD_VIDEO_CS_YUV422_12 0x000b
138#define PS3AV_CMD_VIDEO_CS_XVYCC_12 0x000c
139/* video_vid */
140#define PS3AV_CMD_VIDEO_VID_NONE 0x0000
141#define PS3AV_CMD_VIDEO_VID_480I 0x0001
142#define PS3AV_CMD_VIDEO_VID_576I 0x0003
143#define PS3AV_CMD_VIDEO_VID_480P 0x0005
144#define PS3AV_CMD_VIDEO_VID_576P 0x0006
145#define PS3AV_CMD_VIDEO_VID_1080I_60HZ 0x0007
146#define PS3AV_CMD_VIDEO_VID_1080I_50HZ 0x0008
147#define PS3AV_CMD_VIDEO_VID_720P_60HZ 0x0009
148#define PS3AV_CMD_VIDEO_VID_720P_50HZ 0x000a
149#define PS3AV_CMD_VIDEO_VID_1080P_60HZ 0x000b
150#define PS3AV_CMD_VIDEO_VID_1080P_50HZ 0x000c
151#define PS3AV_CMD_VIDEO_VID_WXGA 0x000d
152#define PS3AV_CMD_VIDEO_VID_SXGA 0x000e
153#define PS3AV_CMD_VIDEO_VID_WUXGA 0x000f
154#define PS3AV_CMD_VIDEO_VID_480I_A 0x0010
155/* video_format */
156#define PS3AV_CMD_VIDEO_FORMAT_BLACK 0x0000
157#define PS3AV_CMD_VIDEO_FORMAT_ARGB_8BIT 0x0007
158/* video_order */
159#define PS3AV_CMD_VIDEO_ORDER_RGB 0x0000
160#define PS3AV_CMD_VIDEO_ORDER_BGR 0x0001
161/* video_fmt */
162#define PS3AV_CMD_VIDEO_FMT_X8R8G8B8 0x0000
163/* video_out_format */
164#define PS3AV_CMD_VIDEO_OUT_FORMAT_RGB_12BIT 0x0000
165/* video_cl_cnv */
166#define PS3AV_CMD_VIDEO_CL_CNV_ENABLE_LUT 0x0000
167#define PS3AV_CMD_VIDEO_CL_CNV_DISABLE_LUT 0x0010
168/* video_sync */
169#define PS3AV_CMD_VIDEO_SYNC_VSYNC 0x0001
170#define PS3AV_CMD_VIDEO_SYNC_CSYNC 0x0004
171#define PS3AV_CMD_VIDEO_SYNC_HSYNC 0x0010
172
173/* for audio module */
174/* num_of_ch */
175#define PS3AV_CMD_AUDIO_NUM_OF_CH_2 0x0000
176#define PS3AV_CMD_AUDIO_NUM_OF_CH_3 0x0001
177#define PS3AV_CMD_AUDIO_NUM_OF_CH_4 0x0002
178#define PS3AV_CMD_AUDIO_NUM_OF_CH_5 0x0003
179#define PS3AV_CMD_AUDIO_NUM_OF_CH_6 0x0004
180#define PS3AV_CMD_AUDIO_NUM_OF_CH_7 0x0005
181#define PS3AV_CMD_AUDIO_NUM_OF_CH_8 0x0006
182/* audio_fs */
183#define PS3AV_CMD_AUDIO_FS_32K 0x0001
184#define PS3AV_CMD_AUDIO_FS_44K 0x0002
185#define PS3AV_CMD_AUDIO_FS_48K 0x0003
186#define PS3AV_CMD_AUDIO_FS_88K 0x0004
187#define PS3AV_CMD_AUDIO_FS_96K 0x0005
188#define PS3AV_CMD_AUDIO_FS_176K 0x0006
189#define PS3AV_CMD_AUDIO_FS_192K 0x0007
190/* audio_word_bits */
191#define PS3AV_CMD_AUDIO_WORD_BITS_16 0x0001
192#define PS3AV_CMD_AUDIO_WORD_BITS_20 0x0002
193#define PS3AV_CMD_AUDIO_WORD_BITS_24 0x0003
194/* audio_format */
195#define PS3AV_CMD_AUDIO_FORMAT_PCM 0x0001
196#define PS3AV_CMD_AUDIO_FORMAT_BITSTREAM 0x00ff
197/* audio_source */
198#define PS3AV_CMD_AUDIO_SOURCE_SERIAL 0x0000
199#define PS3AV_CMD_AUDIO_SOURCE_SPDIF 0x0001
200/* audio_swap */
201#define PS3AV_CMD_AUDIO_SWAP_0 0x0000
202#define PS3AV_CMD_AUDIO_SWAP_1 0x0000
203/* audio_map */
204#define PS3AV_CMD_AUDIO_MAP_OUTPUT_0 0x0000
205#define PS3AV_CMD_AUDIO_MAP_OUTPUT_1 0x0001
206#define PS3AV_CMD_AUDIO_MAP_OUTPUT_2 0x0002
207#define PS3AV_CMD_AUDIO_MAP_OUTPUT_3 0x0003
208/* audio_layout */
209#define PS3AV_CMD_AUDIO_LAYOUT_2CH 0x0000
210#define PS3AV_CMD_AUDIO_LAYOUT_6CH 0x000b /* LREClr */
211#define PS3AV_CMD_AUDIO_LAYOUT_8CH 0x001f /* LREClrXY */
212/* audio_downmix */
213#define PS3AV_CMD_AUDIO_DOWNMIX_PERMITTED 0x0000
214#define PS3AV_CMD_AUDIO_DOWNMIX_PROHIBITED 0x0001
215
216/* audio_port */
217#define PS3AV_CMD_AUDIO_PORT_HDMI_0 ( 1 << 0 )
218#define PS3AV_CMD_AUDIO_PORT_HDMI_1 ( 1 << 1 )
219#define PS3AV_CMD_AUDIO_PORT_AVMULTI_0 ( 1 << 10 )
220#define PS3AV_CMD_AUDIO_PORT_SPDIF_0 ( 1 << 20 )
221#define PS3AV_CMD_AUDIO_PORT_SPDIF_1 ( 1 << 21 )
222
223/* audio_ctrl_id */
224#define PS3AV_CMD_AUDIO_CTRL_ID_DAC_RESET 0x0000
225#define PS3AV_CMD_AUDIO_CTRL_ID_DAC_DE_EMPHASIS 0x0001
226#define PS3AV_CMD_AUDIO_CTRL_ID_AVCLK 0x0002
227/* audio_ctrl_data[0] reset */
228#define PS3AV_CMD_AUDIO_CTRL_RESET_NEGATE 0x0000
229#define PS3AV_CMD_AUDIO_CTRL_RESET_ASSERT 0x0001
230/* audio_ctrl_data[0] de-emphasis */
231#define PS3AV_CMD_AUDIO_CTRL_DE_EMPHASIS_OFF 0x0000
232#define PS3AV_CMD_AUDIO_CTRL_DE_EMPHASIS_ON 0x0001
233/* audio_ctrl_data[0] avclk */
234#define PS3AV_CMD_AUDIO_CTRL_AVCLK_22 0x0000
235#define PS3AV_CMD_AUDIO_CTRL_AVCLK_18 0x0001
236
237/* av_vid */
238/* do not use these params directly, use vid_video2av */
239#define PS3AV_CMD_AV_VID_480I 0x0000
240#define PS3AV_CMD_AV_VID_480P 0x0001
241#define PS3AV_CMD_AV_VID_720P_60HZ 0x0002
242#define PS3AV_CMD_AV_VID_1080I_60HZ 0x0003
243#define PS3AV_CMD_AV_VID_1080P_60HZ 0x0004
244#define PS3AV_CMD_AV_VID_576I 0x0005
245#define PS3AV_CMD_AV_VID_576P 0x0006
246#define PS3AV_CMD_AV_VID_720P_50HZ 0x0007
247#define PS3AV_CMD_AV_VID_1080I_50HZ 0x0008
248#define PS3AV_CMD_AV_VID_1080P_50HZ 0x0009
249#define PS3AV_CMD_AV_VID_WXGA 0x000a
250#define PS3AV_CMD_AV_VID_SXGA 0x000b
251#define PS3AV_CMD_AV_VID_WUXGA 0x000c
252/* av_cs_out av_cs_in */
253/* use cs_video2av() */
254#define PS3AV_CMD_AV_CS_RGB_8 0x0000
255#define PS3AV_CMD_AV_CS_YUV444_8 0x0001
256#define PS3AV_CMD_AV_CS_YUV422_8 0x0002
257#define PS3AV_CMD_AV_CS_XVYCC_8 0x0003
258#define PS3AV_CMD_AV_CS_RGB_10 0x0004
259#define PS3AV_CMD_AV_CS_YUV444_10 0x0005
260#define PS3AV_CMD_AV_CS_YUV422_10 0x0006
261#define PS3AV_CMD_AV_CS_XVYCC_10 0x0007
262#define PS3AV_CMD_AV_CS_RGB_12 0x0008
263#define PS3AV_CMD_AV_CS_YUV444_12 0x0009
264#define PS3AV_CMD_AV_CS_YUV422_12 0x000a
265#define PS3AV_CMD_AV_CS_XVYCC_12 0x000b
266#define PS3AV_CMD_AV_CS_8 0x0000
267#define PS3AV_CMD_AV_CS_10 0x0001
268#define PS3AV_CMD_AV_CS_12 0x0002
269/* dither */
270#define PS3AV_CMD_AV_DITHER_OFF 0x0000
271#define PS3AV_CMD_AV_DITHER_ON 0x0001
272#define PS3AV_CMD_AV_DITHER_8BIT 0x0000
273#define PS3AV_CMD_AV_DITHER_10BIT 0x0002
274#define PS3AV_CMD_AV_DITHER_12BIT 0x0004
275/* super_white */
276#define PS3AV_CMD_AV_SUPER_WHITE_OFF 0x0000
277#define PS3AV_CMD_AV_SUPER_WHITE_ON 0x0001
278/* aspect */
279#define PS3AV_CMD_AV_ASPECT_16_9 0x0000
280#define PS3AV_CMD_AV_ASPECT_4_3 0x0001
281/* video_cs_cnv() */
282#define PS3AV_CMD_VIDEO_CS_RGB 0x0001
283#define PS3AV_CMD_VIDEO_CS_YUV422 0x0002
284#define PS3AV_CMD_VIDEO_CS_YUV444 0x0003
285
286/* for broadcast automode */
287#define PS3AV_RESBIT_720x480P 0x0003 /* 0x0001 | 0x0002 */
288#define PS3AV_RESBIT_720x576P 0x0003 /* 0x0001 | 0x0002 */
289#define PS3AV_RESBIT_1280x720P 0x0004
290#define PS3AV_RESBIT_1920x1080I 0x0008
291#define PS3AV_RESBIT_1920x1080P 0x4000
292#define PS3AV_RES_MASK_60 (PS3AV_RESBIT_720x480P \
293 | PS3AV_RESBIT_1280x720P \
294 | PS3AV_RESBIT_1920x1080I \
295 | PS3AV_RESBIT_1920x1080P)
296#define PS3AV_RES_MASK_50 (PS3AV_RESBIT_720x576P \
297 | PS3AV_RESBIT_1280x720P \
298 | PS3AV_RESBIT_1920x1080I \
299 | PS3AV_RESBIT_1920x1080P)
300
301/* for VESA automode */
302#define PS3AV_RESBIT_VGA 0x0001
303#define PS3AV_RESBIT_WXGA 0x0002
304#define PS3AV_RESBIT_SXGA 0x0004
305#define PS3AV_RESBIT_WUXGA 0x0008
306#define PS3AV_RES_MASK_VESA (PS3AV_RESBIT_WXGA |\
307 PS3AV_RESBIT_SXGA |\
308 PS3AV_RESBIT_WUXGA)
309
310#define PS3AV_MONITOR_TYPE_HDMI 1 /* HDMI */
311#define PS3AV_MONITOR_TYPE_DVI 2 /* DVI */
312
313
314/* for video mode */
315enum ps3av_mode_num {
316 PS3AV_MODE_AUTO = 0,
317 PS3AV_MODE_480I = 1,
318 PS3AV_MODE_480P = 2,
319 PS3AV_MODE_720P60 = 3,
320 PS3AV_MODE_1080I60 = 4,
321 PS3AV_MODE_1080P60 = 5,
322 PS3AV_MODE_576I = 6,
323 PS3AV_MODE_576P = 7,
324 PS3AV_MODE_720P50 = 8,
325 PS3AV_MODE_1080I50 = 9,
326 PS3AV_MODE_1080P50 = 10,
327 PS3AV_MODE_WXGA = 11,
328 PS3AV_MODE_SXGA = 12,
329 PS3AV_MODE_WUXGA = 13,
330};
331
332#define PS3AV_MODE_MASK 0x000F
333#define PS3AV_MODE_HDCP_OFF 0x1000 /* Retail PS3 product doesn't support this */
334#define PS3AV_MODE_DITHER 0x0800
335#define PS3AV_MODE_COLOR 0x0400
336#define PS3AV_MODE_WHITE 0x0200
337#define PS3AV_MODE_FULL 0x0080
338#define PS3AV_MODE_DVI 0x0040
339#define PS3AV_MODE_RGB 0x0020
340
341
342#define PS3AV_DEFAULT_HDMI_MODE_ID_REG_60 PS3AV_MODE_480P
343#define PS3AV_DEFAULT_AVMULTI_MODE_ID_REG_60 PS3AV_MODE_480I
344#define PS3AV_DEFAULT_HDMI_MODE_ID_REG_50 PS3AV_MODE_576P
345#define PS3AV_DEFAULT_AVMULTI_MODE_ID_REG_50 PS3AV_MODE_576I
346
347#define PS3AV_REGION_60 0x01
348#define PS3AV_REGION_50 0x02
349#define PS3AV_REGION_RGB 0x10
350
351#define get_status(buf) (((__u32 *)buf)[2])
352#define PS3AV_HDR_SIZE 4 /* version + size */
353
354
355/** command packet structure **/
356struct ps3av_send_hdr {
357 u16 version;
358 u16 size; /* size of command packet */
359 u32 cid; /* command id */
360};
361
362struct ps3av_reply_hdr {
363 u16 version;
364 u16 size;
365 u32 cid;
366 u32 status;
367};
368
369/* backend: initialization */
370struct ps3av_pkt_av_init {
371 struct ps3av_send_hdr send_hdr;
372 u32 event_bit;
373};
374
375/* backend: finalize */
376struct ps3av_pkt_av_fin {
377 struct ps3av_send_hdr send_hdr;
378 /* recv */
379 u32 reserved;
380};
381
382/* backend: get port */
383struct ps3av_pkt_av_get_hw_conf {
384 struct ps3av_send_hdr send_hdr;
385 /* recv */
386 u32 status;
387 u16 num_of_hdmi; /* out: number of hdmi */
388 u16 num_of_avmulti; /* out: number of avmulti */
389 u16 num_of_spdif; /* out: number of hdmi */
390 u16 reserved;
391};
392
393/* backend: get monitor info */
394struct ps3av_info_resolution {
395 u32 res_bits;
396 u32 native;
397};
398
399struct ps3av_info_cs {
400 u8 rgb;
401 u8 yuv444;
402 u8 yuv422;
403 u8 reserved;
404};
405
406struct ps3av_info_color {
407 u16 red_x;
408 u16 red_y;
409 u16 green_x;
410 u16 green_y;
411 u16 blue_x;
412 u16 blue_y;
413 u16 white_x;
414 u16 white_y;
415 u32 gamma;
416};
417
418struct ps3av_info_audio {
419 u8 type;
420 u8 max_num_of_ch;
421 u8 fs;
422 u8 sbit;
423};
424
425struct ps3av_info_monitor {
426 u8 avport;
427 u8 monitor_id[10];
428 u8 monitor_type;
429 u8 monitor_name[16];
430 struct ps3av_info_resolution res_60;
431 struct ps3av_info_resolution res_50;
432 struct ps3av_info_resolution res_other;
433 struct ps3av_info_resolution res_vesa;
434 struct ps3av_info_cs cs;
435 struct ps3av_info_color color;
436 u8 supported_ai;
437 u8 speaker_info;
438 u8 num_of_audio_block;
439 struct ps3av_info_audio audio[0]; /* 0 or more audio blocks */
440 u8 reserved[169];
441} __attribute__ ((packed));
442
443struct ps3av_pkt_av_get_monitor_info {
444 struct ps3av_send_hdr send_hdr;
445 u16 avport; /* in: avport */
446 u16 reserved;
447 /* recv */
448 struct ps3av_info_monitor info; /* out: monitor info */
449};
450
451/* backend: enable/disable event */
452struct ps3av_pkt_av_event {
453 struct ps3av_send_hdr send_hdr;
454 u32 event_bit; /* in */
455};
456
457/* backend: video cs param */
458struct ps3av_pkt_av_video_cs {
459 struct ps3av_send_hdr send_hdr;
460 u16 avport; /* in: avport */
461 u16 av_vid; /* in: video resolution */
462 u16 av_cs_out; /* in: output color space */
463 u16 av_cs_in; /* in: input color space */
464 u8 dither; /* in: dither bit length */
465 u8 bitlen_out; /* in: bit length */
466 u8 super_white; /* in: super white */
467 u8 aspect; /* in: aspect ratio */
468};
469
470/* backend: video mute */
471struct ps3av_av_mute {
472 u16 avport; /* in: avport */
473 u16 mute; /* in: mute on/off */
474};
475
476struct ps3av_pkt_av_video_mute {
477 struct ps3av_send_hdr send_hdr;
478 struct ps3av_av_mute mute[PS3AV_MUTE_PORT_MAX];
479};
480
481/* backend: video disable signal */
482struct ps3av_pkt_av_video_disable_sig {
483 struct ps3av_send_hdr send_hdr;
484 u16 avport; /* in: avport */
485 u16 reserved;
486};
487
488/* backend: audio param */
489struct ps3av_audio_info_frame {
490 struct pb1_bit {
491 u8 ct:4;
492 u8 rsv:1;
493 u8 cc:3;
494 } pb1;
495 struct pb2_bit {
496 u8 rsv:3;
497 u8 sf:3;
498 u8 ss:2;
499 } pb2;
500 u8 pb3;
501 u8 pb4;
502 struct pb5_bit {
503 u8 dm:1;
504 u8 lsv:4;
505 u8 rsv:3;
506 } pb5;
507};
508
509struct ps3av_pkt_av_audio_param {
510 struct ps3av_send_hdr send_hdr;
511 u16 avport; /* in: avport */
512 u16 reserved;
513 u8 mclk; /* in: audio mclk */
514 u8 ns[3]; /* in: audio ns val */
515 u8 enable; /* in: audio enable */
516 u8 swaplr; /* in: audio swap */
517 u8 fifomap; /* in: audio fifomap */
518 u8 inputctrl; /* in: audio input ctrl */
519 u8 inputlen; /* in: sample bit size */
520 u8 layout; /* in: speaker layout param */
521 struct ps3av_audio_info_frame info; /* in: info */
522 u8 chstat[5]; /* in: ch stat */
523};
524
525/* backend: audio_mute */
526struct ps3av_pkt_av_audio_mute {
527 struct ps3av_send_hdr send_hdr;
528 struct ps3av_av_mute mute[PS3AV_MUTE_PORT_MAX];
529};
530
531/* backend: hdmi_mode */
532struct ps3av_pkt_av_hdmi_mode {
533 struct ps3av_send_hdr send_hdr;
534 u8 mode; /* in: hdmi_mode */
535 u8 reserved0;
536 u8 reserved1;
537 u8 reserved2;
538};
539
540/* backend: tv_mute */
541struct ps3av_pkt_av_tv_mute {
542 struct ps3av_send_hdr send_hdr;
543 u16 avport; /* in: avport HDMI only */
544 u16 mute; /* in: mute */
545};
546
547/* video: initialize */
548struct ps3av_pkt_video_init {
549 struct ps3av_send_hdr send_hdr;
550 /* recv */
551 u32 reserved;
552};
553
554/* video: mode setting */
555struct ps3av_pkt_video_mode {
556 struct ps3av_send_hdr send_hdr;
557 u32 video_head; /* in: head */
558 u32 reserved;
559 u32 video_vid; /* in: video resolution */
560 u16 reserved1;
561 u16 width; /* in: width in pixel */
562 u16 reserved2;
563 u16 height; /* in: height in pixel */
564 u32 pitch; /* in: line size in byte */
565 u32 video_out_format; /* in: out format */
566 u32 video_format; /* in: input frame buffer format */
567 u8 reserved3;
568 u8 video_cl_cnv; /* in: color conversion */
569 u16 video_order; /* in: input RGB order */
570 u32 reserved4;
571};
572
573/* video: format */
574struct ps3av_pkt_video_format {
575 struct ps3av_send_hdr send_hdr;
576 u32 video_head; /* in: head */
577 u32 video_format; /* in: frame buffer format */
578 u8 reserved;
579 u8 video_cl_cnv; /* in: color conversion */
580 u16 video_order; /* in: input RGB order */
581};
582
583/* video: pitch */
584struct ps3av_pkt_video_pitch {
585 u16 version;
586 u16 size; /* size of command packet */
587 u32 cid; /* command id */
588 u32 video_head; /* in: head */
589 u32 pitch; /* in: line size in byte */
590};
591
592/* audio: initialize */
593struct ps3av_pkt_audio_init {
594 struct ps3av_send_hdr send_hdr;
595 /* recv */
596 u32 reserved;
597};
598
599/* audio: mode setting */
600struct ps3av_pkt_audio_mode {
601 struct ps3av_send_hdr send_hdr;
602 u8 avport; /* in: avport */
603 u8 reserved0[3];
604 u32 mask; /* in: mask */
605 u32 audio_num_of_ch; /* in: number of ch */
606 u32 audio_fs; /* in: sampling freq */
607 u32 audio_word_bits; /* in: sample bit size */
608 u32 audio_format; /* in: audio output format */
609 u32 audio_source; /* in: audio source */
610 u8 audio_enable[4]; /* in: audio enable */
611 u8 audio_swap[4]; /* in: audio swap */
612 u8 audio_map[4]; /* in: audio map */
613 u32 audio_layout; /* in: speaker layout */
614 u32 audio_downmix; /* in: audio downmix permission */
615 u32 audio_downmix_level;
616 u8 audio_cs_info[8]; /* in: IEC channel status */
617};
618
619/* audio: mute */
620struct ps3av_audio_mute {
621 u8 avport; /* in: opt_port optical */
622 u8 reserved[3];
623 u32 mute; /* in: mute */
624};
625
626struct ps3av_pkt_audio_mute {
627 struct ps3av_send_hdr send_hdr;
628 struct ps3av_audio_mute mute[PS3AV_OPT_PORT_MAX];
629};
630
631/* audio: active/inactive */
632struct ps3av_pkt_audio_active {
633 struct ps3av_send_hdr send_hdr;
634 u32 audio_port; /* in: audio active/inactive port */
635};
636
637/* audio: SPDIF user bit */
638struct ps3av_pkt_audio_spdif_bit {
639 u16 version;
640 u16 size; /* size of command packet */
641 u32 cid; /* command id */
642 u8 avport; /* in: avport SPDIF only */
643 u8 reserved[3];
644 u32 audio_port; /* in: SPDIF only */
645 u32 spdif_bit_data[12]; /* in: user bit data */
646};
647
648/* audio: audio control */
649struct ps3av_pkt_audio_ctrl {
650 u16 version;
651 u16 size; /* size of command packet */
652 u32 cid; /* command id */
653 u32 audio_ctrl_id; /* in: control id */
654 u32 audio_ctrl_data[4]; /* in: control data */
655};
656
657/* avb:param */
658#define PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE \
659 (PS3AV_AVB_NUM_VIDEO*sizeof(struct ps3av_pkt_video_mode) + \
660 PS3AV_AVB_NUM_AUDIO*sizeof(struct ps3av_pkt_audio_mode) + \
661 PS3AV_AVB_NUM_AV_VIDEO*sizeof(struct ps3av_pkt_av_video_cs) + \
662 PS3AV_AVB_NUM_AV_AUDIO*sizeof(struct ps3av_pkt_av_audio_param))
663
664struct ps3av_pkt_avb_param {
665 struct ps3av_send_hdr send_hdr;
666 u16 num_of_video_pkt;
667 u16 num_of_audio_pkt;
668 u16 num_of_av_video_pkt;
669 u16 num_of_av_audio_pkt;
670 /*
671 * The actual buffer layout depends on the fields above:
672 *
673 * struct ps3av_pkt_video_mode video[num_of_video_pkt];
674 * struct ps3av_pkt_audio_mode audio[num_of_audio_pkt];
675 * struct ps3av_pkt_av_video_cs av_video[num_of_av_video_pkt];
676 * struct ps3av_pkt_av_audio_param av_audio[num_of_av_audio_pkt];
677 */
678 u8 buf[PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE];
679};
680
681
682/** command status **/
683#define PS3AV_STATUS_SUCCESS 0x0000 /* success */
684#define PS3AV_STATUS_RECEIVE_VUART_ERROR 0x0001 /* receive vuart error */
685#define PS3AV_STATUS_SYSCON_COMMUNICATE_FAIL 0x0002 /* syscon communication error */
686#define PS3AV_STATUS_INVALID_COMMAND 0x0003 /* obsolete invalid CID */
687#define PS3AV_STATUS_INVALID_PORT 0x0004 /* invalid port number */
688#define PS3AV_STATUS_INVALID_VID 0x0005 /* invalid video format */
689#define PS3AV_STATUS_INVALID_COLOR_SPACE 0x0006 /* invalid video colose space */
690#define PS3AV_STATUS_INVALID_FS 0x0007 /* invalid audio sampling freq */
691#define PS3AV_STATUS_INVALID_AUDIO_CH 0x0008 /* invalid audio channel number */
692#define PS3AV_STATUS_UNSUPPORTED_VERSION 0x0009 /* version mismatch */
693#define PS3AV_STATUS_INVALID_SAMPLE_SIZE 0x000a /* invalid audio sample bit size */
694#define PS3AV_STATUS_FAILURE 0x000b /* other failures */
695#define PS3AV_STATUS_UNSUPPORTED_COMMAND 0x000c /* unsupported cid */
696#define PS3AV_STATUS_BUFFER_OVERFLOW 0x000d /* write buffer overflow */
697#define PS3AV_STATUS_INVALID_VIDEO_PARAM 0x000e /* invalid video param */
698#define PS3AV_STATUS_NO_SEL 0x000f /* not exist selector */
699#define PS3AV_STATUS_INVALID_AV_PARAM 0x0010 /* invalid backend param */
700#define PS3AV_STATUS_INVALID_AUDIO_PARAM 0x0011 /* invalid audio param */
701#define PS3AV_STATUS_UNSUPPORTED_HDMI_MODE 0x0012 /* unsupported hdmi mode */
702#define PS3AV_STATUS_NO_SYNC_HEAD 0x0013 /* sync head failed */
703
704extern void ps3av_set_hdr(u32, u16, struct ps3av_send_hdr *);
705extern int ps3av_do_pkt(u32, u16, size_t, struct ps3av_send_hdr *);
706
707extern int ps3av_cmd_init(void);
708extern int ps3av_cmd_fin(void);
709extern int ps3av_cmd_av_video_mute(int, u32 *, u32);
710extern int ps3av_cmd_av_video_disable_sig(u32);
711extern int ps3av_cmd_av_tv_mute(u32, u32);
712extern int ps3av_cmd_enable_event(void);
713extern int ps3av_cmd_av_hdmi_mode(u8);
714extern u32 ps3av_cmd_set_av_video_cs(void *, u32, int, int, int, u32);
715extern u32 ps3av_cmd_set_video_mode(void *, u32, int, int, u32);
716extern int ps3av_cmd_video_format_black(u32, u32, u32);
717extern int ps3av_cmd_av_audio_mute(int, u32 *, u32);
718extern u32 ps3av_cmd_set_av_audio_param(void *, u32,
719 const struct ps3av_pkt_audio_mode *,
720 u32);
721extern void ps3av_cmd_set_audio_mode(struct ps3av_pkt_audio_mode *, u32, u32,
722 u32, u32, u32, u32);
723extern int ps3av_cmd_audio_mode(struct ps3av_pkt_audio_mode *);
724extern int ps3av_cmd_audio_mute(int, u32 *, u32);
725extern int ps3av_cmd_audio_active(int, u32);
726extern int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *, u32);
727extern int ps3av_cmd_av_get_hw_conf(struct ps3av_pkt_av_get_hw_conf *);
728extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *,
729 u32);
730
731extern int ps3av_set_video_mode(u32);
732extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32);
733extern int ps3av_get_auto_mode(void);
734extern int ps3av_get_mode(void);
735extern int ps3av_video_mode2res(u32, u32 *, u32 *);
736extern int ps3av_video_mute(int);
737extern int ps3av_audio_mute(int);
738extern int ps3av_dev_open(void);
739extern int ps3av_dev_close(void);
740extern void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
741 void *flip_data);
742extern void ps3av_flip_ctl(int on);
743
744#endif /* _ASM_POWERPC_PS3AV_H_ */
diff --git a/arch/powerpc/include/asm/ps3fb.h b/arch/powerpc/include/asm/ps3fb.h
new file mode 100644
index 000000000000..3f121fe4010d
--- /dev/null
+++ b/arch/powerpc/include/asm/ps3fb.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2006 Sony Computer Entertainment Inc.
3 * Copyright 2006, 2007 Sony Corporation
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
7 * by the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef _ASM_POWERPC_PS3FB_H_
20#define _ASM_POWERPC_PS3FB_H_
21
22#include <linux/ioctl.h>
23
24/* ioctl */
25#define PS3FB_IOCTL_SETMODE _IOW('r', 1, int) /* set video mode */
26#define PS3FB_IOCTL_GETMODE _IOR('r', 2, int) /* get video mode */
27#define PS3FB_IOCTL_SCREENINFO _IOR('r', 3, int) /* get screen info */
28#define PS3FB_IOCTL_ON _IO('r', 4) /* use IOCTL_FSEL */
29#define PS3FB_IOCTL_OFF _IO('r', 5) /* return to normal-flip */
30#define PS3FB_IOCTL_FSEL _IOW('r', 6, int) /* blit and flip request */
31
32#ifndef FBIO_WAITFORVSYNC
33#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) /* wait for vsync */
34#endif
35
36struct ps3fb_ioctl_res {
37 __u32 xres; /* frame buffer x_size */
38 __u32 yres; /* frame buffer y_size */
39 __u32 xoff; /* margine x */
40 __u32 yoff; /* margine y */
41 __u32 num_frames; /* num of frame buffers */
42};
43
44#endif /* _ASM_POWERPC_PS3FB_H_ */
diff --git a/arch/powerpc/include/asm/ps3stor.h b/arch/powerpc/include/asm/ps3stor.h
new file mode 100644
index 000000000000..6fcaf714fa50
--- /dev/null
+++ b/arch/powerpc/include/asm/ps3stor.h
@@ -0,0 +1,71 @@
1/*
2 * PS3 Storage Devices
3 *
4 * Copyright (C) 2007 Sony Computer Entertainment Inc.
5 * Copyright 2007 Sony Corp.
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
9 * by the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef _ASM_POWERPC_PS3STOR_H_
22#define _ASM_POWERPC_PS3STOR_H_
23
24#include <linux/interrupt.h>
25
26#include <asm/ps3.h>
27
28
29struct ps3_storage_region {
30 unsigned int id;
31 u64 start;
32 u64 size;
33};
34
35struct ps3_storage_device {
36 struct ps3_system_bus_device sbd;
37
38 struct ps3_dma_region dma_region;
39 unsigned int irq;
40 u64 blk_size;
41
42 u64 tag;
43 u64 lv1_status;
44 struct completion done;
45
46 unsigned long bounce_size;
47 void *bounce_buf;
48 u64 bounce_lpar;
49 dma_addr_t bounce_dma;
50
51 unsigned int num_regions;
52 unsigned long accessible_regions;
53 unsigned int region_idx; /* first accessible region */
54 struct ps3_storage_region regions[0]; /* Must be last */
55};
56
57static inline struct ps3_storage_device *to_ps3_storage_device(struct device *dev)
58{
59 return container_of(dev, struct ps3_storage_device, sbd.core);
60}
61
62extern int ps3stor_setup(struct ps3_storage_device *dev,
63 irq_handler_t handler);
64extern void ps3stor_teardown(struct ps3_storage_device *dev);
65extern u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev, u64 lpar,
66 u64 start_sector, u64 sectors,
67 int write);
68extern u64 ps3stor_send_command(struct ps3_storage_device *dev, u64 cmd,
69 u64 arg1, u64 arg2, u64 arg3, u64 arg4);
70
71#endif /* _ASM_POWERPC_PS3STOR_H_ */
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
new file mode 100644
index 000000000000..734e0754fb9b
--- /dev/null
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -0,0 +1,293 @@
1#ifndef _ASM_POWERPC_PTRACE_H
2#define _ASM_POWERPC_PTRACE_H
3
4/*
5 * Copyright (C) 2001 PPC64 Team, IBM Corp
6 *
7 * This struct defines the way the registers are stored on the
8 * kernel stack during a system call or other kernel entry.
9 *
10 * this should only contain volatile regs
11 * since we can keep non-volatile in the thread_struct
12 * should set this up when only volatiles are saved
13 * by intr code.
14 *
15 * Since this is going on the stack, *CARE MUST BE TAKEN* to insure
16 * that the overall structure is a multiple of 16 bytes in length.
17 *
18 * Note that the offsets of the fields in this struct correspond with
19 * the PT_* values below. This simplifies arch/powerpc/kernel/ptrace.c.
20 *
21 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License
23 * as published by the Free Software Foundation; either version
24 * 2 of the License, or (at your option) any later version.
25 */
26
27#ifndef __ASSEMBLY__
28
29struct pt_regs {
30 unsigned long gpr[32];
31 unsigned long nip;
32 unsigned long msr;
33 unsigned long orig_gpr3; /* Used for restarting system calls */
34 unsigned long ctr;
35 unsigned long link;
36 unsigned long xer;
37 unsigned long ccr;
38#ifdef __powerpc64__
39 unsigned long softe; /* Soft enabled/disabled */
40#else
41 unsigned long mq; /* 601 only (not used at present) */
42 /* Used on APUS to hold IPL value. */
43#endif
44 unsigned long trap; /* Reason for being here */
45 /* N.B. for critical exceptions on 4xx, the dar and dsisr
46 fields are overloaded to hold srr0 and srr1. */
47 unsigned long dar; /* Fault registers */
48 unsigned long dsisr; /* on 4xx/Book-E used for ESR */
49 unsigned long result; /* Result of a system call */
50};
51
52#endif /* __ASSEMBLY__ */
53
54#ifdef __KERNEL__
55
56#ifdef __powerpc64__
57
58#define __ARCH_WANT_COMPAT_SYS_PTRACE
59
60#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
61#define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */
62#define STACK_FRAME_REGS_MARKER ASM_CONST(0x7265677368657265)
63#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \
64 STACK_FRAME_OVERHEAD + 288)
65#define STACK_FRAME_MARKER 12
66
67/* Size of dummy stack frame allocated when calling signal handler. */
68#define __SIGNAL_FRAMESIZE 128
69#define __SIGNAL_FRAMESIZE32 64
70
71#else /* __powerpc64__ */
72
73#define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */
74#define STACK_FRAME_LR_SAVE 1 /* Location of LR in stack frame */
75#define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773)
76#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD)
77#define STACK_FRAME_MARKER 2
78
79/* Size of stack frame allocated when calling signal handler. */
80#define __SIGNAL_FRAMESIZE 64
81
82#endif /* __powerpc64__ */
83
84#ifndef __ASSEMBLY__
85
86#define instruction_pointer(regs) ((regs)->nip)
87#define user_stack_pointer(regs) ((regs)->gpr[1])
88#define regs_return_value(regs) ((regs)->gpr[3])
89
90#ifdef CONFIG_SMP
91extern unsigned long profile_pc(struct pt_regs *regs);
92#else
93#define profile_pc(regs) instruction_pointer(regs)
94#endif
95
96#ifdef __powerpc64__
97#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
98#else
99#define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
100#endif
101
102#define force_successful_syscall_return() \
103 do { \
104 set_thread_flag(TIF_NOERROR); \
105 } while(0)
106
107struct task_struct;
108extern unsigned long ptrace_get_reg(struct task_struct *task, int regno);
109extern int ptrace_put_reg(struct task_struct *task, int regno,
110 unsigned long data);
111
112/*
113 * We use the least-significant bit of the trap field to indicate
114 * whether we have saved the full set of registers, or only a
115 * partial set. A 1 there means the partial set.
116 * On 4xx we use the next bit to indicate whether the exception
117 * is a critical exception (1 means it is).
118 */
119#define FULL_REGS(regs) (((regs)->trap & 1) == 0)
120#ifndef __powerpc64__
121#define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0)
122#define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0)
123#define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0)
124#endif /* ! __powerpc64__ */
125#define TRAP(regs) ((regs)->trap & ~0xF)
126#ifdef __powerpc64__
127#define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1)
128#else
129#define CHECK_FULL_REGS(regs) \
130do { \
131 if ((regs)->trap & 1) \
132 printk(KERN_CRIT "%s: partial register set\n", __FUNCTION__); \
133} while (0)
134#endif /* __powerpc64__ */
135
136/*
137 * These are defined as per linux/ptrace.h, which see.
138 */
139#define arch_has_single_step() (1)
140extern void user_enable_single_step(struct task_struct *);
141extern void user_disable_single_step(struct task_struct *);
142
143#endif /* __ASSEMBLY__ */
144
145#endif /* __KERNEL__ */
146
147/*
148 * Offsets used by 'ptrace' system call interface.
149 * These can't be changed without breaking binary compatibility
150 * with MkLinux, etc.
151 */
152#define PT_R0 0
153#define PT_R1 1
154#define PT_R2 2
155#define PT_R3 3
156#define PT_R4 4
157#define PT_R5 5
158#define PT_R6 6
159#define PT_R7 7
160#define PT_R8 8
161#define PT_R9 9
162#define PT_R10 10
163#define PT_R11 11
164#define PT_R12 12
165#define PT_R13 13
166#define PT_R14 14
167#define PT_R15 15
168#define PT_R16 16
169#define PT_R17 17
170#define PT_R18 18
171#define PT_R19 19
172#define PT_R20 20
173#define PT_R21 21
174#define PT_R22 22
175#define PT_R23 23
176#define PT_R24 24
177#define PT_R25 25
178#define PT_R26 26
179#define PT_R27 27
180#define PT_R28 28
181#define PT_R29 29
182#define PT_R30 30
183#define PT_R31 31
184
185#define PT_NIP 32
186#define PT_MSR 33
187#define PT_ORIG_R3 34
188#define PT_CTR 35
189#define PT_LNK 36
190#define PT_XER 37
191#define PT_CCR 38
192#ifndef __powerpc64__
193#define PT_MQ 39
194#else
195#define PT_SOFTE 39
196#endif
197#define PT_TRAP 40
198#define PT_DAR 41
199#define PT_DSISR 42
200#define PT_RESULT 43
201#define PT_REGS_COUNT 44
202
203#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
204
205#ifndef __powerpc64__
206
207#define PT_FPR31 (PT_FPR0 + 2*31)
208#define PT_FPSCR (PT_FPR0 + 2*32 + 1)
209
210#else /* __powerpc64__ */
211
212#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */
213
214#ifdef __KERNEL__
215#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */
216#endif
217
218#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */
219#define PT_VSCR (PT_VR0 + 32*2 + 1)
220#define PT_VRSAVE (PT_VR0 + 33*2)
221
222#ifdef __KERNEL__
223#define PT_VR0_32 164 /* each Vector reg occupies 4 slots in 32-bit */
224#define PT_VSCR_32 (PT_VR0 + 32*4 + 3)
225#define PT_VRSAVE_32 (PT_VR0 + 33*4)
226#endif
227
228/*
229 * Only store first 32 VSRs here. The second 32 VSRs in VR0-31
230 */
231#define PT_VSR0 150 /* each VSR reg occupies 2 slots in 64-bit */
232#define PT_VSR31 (PT_VSR0 + 2*31)
233#ifdef __KERNEL__
234#define PT_VSR0_32 300 /* each VSR reg occupies 4 slots in 32-bit */
235#endif
236#endif /* __powerpc64__ */
237
238/*
239 * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go.
240 * The transfer totals 34 quadword. Quadwords 0-31 contain the
241 * corresponding vector registers. Quadword 32 contains the vscr as the
242 * last word (offset 12) within that quadword. Quadword 33 contains the
243 * vrsave as the first word (offset 0) within the quadword.
244 *
245 * This definition of the VMX state is compatible with the current PPC32
246 * ptrace interface. This allows signal handling and ptrace to use the same
247 * structures. This also simplifies the implementation of a bi-arch
248 * (combined (32- and 64-bit) gdb.
249 */
250#define PTRACE_GETVRREGS 18
251#define PTRACE_SETVRREGS 19
252
253/* Get/set all the upper 32-bits of the SPE registers, accumulator, and
254 * spefscr, in one go */
255#define PTRACE_GETEVRREGS 20
256#define PTRACE_SETEVRREGS 21
257
258/* Get the first 32 128bit VSX registers */
259#define PTRACE_GETVSRREGS 27
260#define PTRACE_SETVSRREGS 28
261
262/*
263 * Get or set a debug register. The first 16 are DABR registers and the
264 * second 16 are IABR registers.
265 */
266#define PTRACE_GET_DEBUGREG 25
267#define PTRACE_SET_DEBUGREG 26
268
269/* (new) PTRACE requests using the same numbers as x86 and the same
270 * argument ordering. Additionally, they support more registers too
271 */
272#define PTRACE_GETREGS 12
273#define PTRACE_SETREGS 13
274#define PTRACE_GETFPREGS 14
275#define PTRACE_SETFPREGS 15
276#define PTRACE_GETREGS64 22
277#define PTRACE_SETREGS64 23
278
279/* (old) PTRACE requests with inverted arguments */
280#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */
281#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */
282#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */
283#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */
284
285/* Calls to trace a 64bit program from a 32bit program */
286#define PPC_PTRACE_PEEKTEXT_3264 0x95
287#define PPC_PTRACE_PEEKDATA_3264 0x94
288#define PPC_PTRACE_POKETEXT_3264 0x93
289#define PPC_PTRACE_POKEDATA_3264 0x92
290#define PPC_PTRACE_PEEKUSR_3264 0x91
291#define PPC_PTRACE_POKEUSR_3264 0x90
292
293#endif /* _ASM_POWERPC_PTRACE_H */
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
new file mode 100644
index 000000000000..edee15d269ea
--- /dev/null
+++ b/arch/powerpc/include/asm/qe.h
@@ -0,0 +1,642 @@
1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com>
6 *
7 * Description:
8 * QUICC Engine (QE) external definitions and structure.
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#ifndef _ASM_POWERPC_QE_H
16#define _ASM_POWERPC_QE_H
17#ifdef __KERNEL__
18
19#include <linux/spinlock.h>
20#include <asm/cpm.h>
21#include <asm/immap_qe.h>
22
23#define QE_NUM_OF_SNUM 28
24#define QE_NUM_OF_BRGS 16
25#define QE_NUM_OF_PORTS 1024
26
27/* Memory partitions
28*/
29#define MEM_PART_SYSTEM 0
30#define MEM_PART_SECONDARY 1
31#define MEM_PART_MURAM 2
32
33/* Clocks and BRGs */
34enum qe_clock {
35 QE_CLK_NONE = 0,
36 QE_BRG1, /* Baud Rate Generator 1 */
37 QE_BRG2, /* Baud Rate Generator 2 */
38 QE_BRG3, /* Baud Rate Generator 3 */
39 QE_BRG4, /* Baud Rate Generator 4 */
40 QE_BRG5, /* Baud Rate Generator 5 */
41 QE_BRG6, /* Baud Rate Generator 6 */
42 QE_BRG7, /* Baud Rate Generator 7 */
43 QE_BRG8, /* Baud Rate Generator 8 */
44 QE_BRG9, /* Baud Rate Generator 9 */
45 QE_BRG10, /* Baud Rate Generator 10 */
46 QE_BRG11, /* Baud Rate Generator 11 */
47 QE_BRG12, /* Baud Rate Generator 12 */
48 QE_BRG13, /* Baud Rate Generator 13 */
49 QE_BRG14, /* Baud Rate Generator 14 */
50 QE_BRG15, /* Baud Rate Generator 15 */
51 QE_BRG16, /* Baud Rate Generator 16 */
52 QE_CLK1, /* Clock 1 */
53 QE_CLK2, /* Clock 2 */
54 QE_CLK3, /* Clock 3 */
55 QE_CLK4, /* Clock 4 */
56 QE_CLK5, /* Clock 5 */
57 QE_CLK6, /* Clock 6 */
58 QE_CLK7, /* Clock 7 */
59 QE_CLK8, /* Clock 8 */
60 QE_CLK9, /* Clock 9 */
61 QE_CLK10, /* Clock 10 */
62 QE_CLK11, /* Clock 11 */
63 QE_CLK12, /* Clock 12 */
64 QE_CLK13, /* Clock 13 */
65 QE_CLK14, /* Clock 14 */
66 QE_CLK15, /* Clock 15 */
67 QE_CLK16, /* Clock 16 */
68 QE_CLK17, /* Clock 17 */
69 QE_CLK18, /* Clock 18 */
70 QE_CLK19, /* Clock 19 */
71 QE_CLK20, /* Clock 20 */
72 QE_CLK21, /* Clock 21 */
73 QE_CLK22, /* Clock 22 */
74 QE_CLK23, /* Clock 23 */
75 QE_CLK24, /* Clock 24 */
76 QE_CLK_DUMMY
77};
78
79static inline bool qe_clock_is_brg(enum qe_clock clk)
80{
81 return clk >= QE_BRG1 && clk <= QE_BRG16;
82}
83
84extern spinlock_t cmxgcr_lock;
85
86/* Export QE common operations */
87extern void __init qe_reset(void);
88
89/* QE PIO */
90#define QE_PIO_PINS 32
91
92struct qe_pio_regs {
93 __be32 cpodr; /* Open drain register */
94 __be32 cpdata; /* Data register */
95 __be32 cpdir1; /* Direction register */
96 __be32 cpdir2; /* Direction register */
97 __be32 cppar1; /* Pin assignment register */
98 __be32 cppar2; /* Pin assignment register */
99#ifdef CONFIG_PPC_85xx
100 u8 pad[8];
101#endif
102};
103
104extern int par_io_init(struct device_node *np);
105extern int par_io_of_config(struct device_node *np);
106#define QE_PIO_DIR_IN 2
107#define QE_PIO_DIR_OUT 1
108extern void __par_io_config_pin(struct qe_pio_regs __iomem *par_io, u8 pin,
109 int dir, int open_drain, int assignment,
110 int has_irq);
111extern int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
112 int assignment, int has_irq);
113extern int par_io_data_set(u8 port, u8 pin, u8 val);
114
115/* QE internal API */
116int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
117enum qe_clock qe_clock_source(const char *source);
118unsigned int qe_get_brg_clk(void);
119int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier);
120int qe_get_snum(void);
121void qe_put_snum(u8 snum);
122/* we actually use cpm_muram implementation, define this for convenience */
123#define qe_muram_init cpm_muram_init
124#define qe_muram_alloc cpm_muram_alloc
125#define qe_muram_alloc_fixed cpm_muram_alloc_fixed
126#define qe_muram_free cpm_muram_free
127#define qe_muram_addr cpm_muram_addr
128#define qe_muram_offset cpm_muram_offset
129
130/* Structure that defines QE firmware binary files.
131 *
132 * See Documentation/powerpc/qe-firmware.txt for a description of these
133 * fields.
134 */
135struct qe_firmware {
136 struct qe_header {
137 __be32 length; /* Length of the entire structure, in bytes */
138 u8 magic[3]; /* Set to { 'Q', 'E', 'F' } */
139 u8 version; /* Version of this layout. First ver is '1' */
140 } header;
141 u8 id[62]; /* Null-terminated identifier string */
142 u8 split; /* 0 = shared I-RAM, 1 = split I-RAM */
143 u8 count; /* Number of microcode[] structures */
144 struct {
145 __be16 model; /* The SOC model */
146 u8 major; /* The SOC revision major */
147 u8 minor; /* The SOC revision minor */
148 } __attribute__ ((packed)) soc;
149 u8 padding[4]; /* Reserved, for alignment */
150 __be64 extended_modes; /* Extended modes */
151 __be32 vtraps[8]; /* Virtual trap addresses */
152 u8 reserved[4]; /* Reserved, for future expansion */
153 struct qe_microcode {
154 u8 id[32]; /* Null-terminated identifier */
155 __be32 traps[16]; /* Trap addresses, 0 == ignore */
156 __be32 eccr; /* The value for the ECCR register */
157 __be32 iram_offset; /* Offset into I-RAM for the code */
158 __be32 count; /* Number of 32-bit words of the code */
159 __be32 code_offset; /* Offset of the actual microcode */
160 u8 major; /* The microcode version major */
161 u8 minor; /* The microcode version minor */
162 u8 revision; /* The microcode version revision */
163 u8 padding; /* Reserved, for alignment */
164 u8 reserved[4]; /* Reserved, for future expansion */
165 } __attribute__ ((packed)) microcode[1];
166 /* All microcode binaries should be located here */
167 /* CRC32 should be located here, after the microcode binaries */
168} __attribute__ ((packed));
169
170struct qe_firmware_info {
171 char id[64]; /* Firmware name */
172 u32 vtraps[8]; /* Virtual trap addresses */
173 u64 extended_modes; /* Extended modes */
174};
175
176/* Upload a firmware to the QE */
177int qe_upload_firmware(const struct qe_firmware *firmware);
178
179/* Obtain information on the uploaded firmware */
180struct qe_firmware_info *qe_get_firmware_info(void);
181
182/* QE USB */
183int qe_usb_clock_set(enum qe_clock clk, int rate);
184
185/* Buffer descriptors */
186struct qe_bd {
187 __be16 status;
188 __be16 length;
189 __be32 buf;
190} __attribute__ ((packed));
191
192#define BD_STATUS_MASK 0xffff0000
193#define BD_LENGTH_MASK 0x0000ffff
194
195/* Alignment */
196#define QE_INTR_TABLE_ALIGN 16 /* ??? */
197#define QE_ALIGNMENT_OF_BD 8
198#define QE_ALIGNMENT_OF_PRAM 64
199
200/* RISC allocation */
201enum qe_risc_allocation {
202 QE_RISC_ALLOCATION_RISC1 = 1, /* RISC 1 */
203 QE_RISC_ALLOCATION_RISC2 = 2, /* RISC 2 */
204 QE_RISC_ALLOCATION_RISC1_AND_RISC2 = 3 /* Dynamically choose
205 RISC 1 or RISC 2 */
206};
207
208/* QE extended filtering Table Lookup Key Size */
209enum qe_fltr_tbl_lookup_key_size {
210 QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES
211 = 0x3f, /* LookupKey parsed by the Generate LookupKey
212 CMD is truncated to 8 bytes */
213 QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES
214 = 0x5f, /* LookupKey parsed by the Generate LookupKey
215 CMD is truncated to 16 bytes */
216};
217
218/* QE FLTR extended filtering Largest External Table Lookup Key Size */
219enum qe_fltr_largest_external_tbl_lookup_key_size {
220 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE
221 = 0x0,/* not used */
222 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES
223 = QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES, /* 8 bytes */
224 QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES
225 = QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES, /* 16 bytes */
226};
227
228/* structure representing QE parameter RAM */
229struct qe_timer_tables {
230 u16 tm_base; /* QE timer table base adr */
231 u16 tm_ptr; /* QE timer table pointer */
232 u16 r_tmr; /* QE timer mode register */
233 u16 r_tmv; /* QE timer valid register */
234 u32 tm_cmd; /* QE timer cmd register */
235 u32 tm_cnt; /* QE timer internal cnt */
236} __attribute__ ((packed));
237
238#define QE_FLTR_TAD_SIZE 8
239
240/* QE extended filtering Termination Action Descriptor (TAD) */
241struct qe_fltr_tad {
242 u8 serialized[QE_FLTR_TAD_SIZE];
243} __attribute__ ((packed));
244
245/* Communication Direction */
246enum comm_dir {
247 COMM_DIR_NONE = 0,
248 COMM_DIR_RX = 1,
249 COMM_DIR_TX = 2,
250 COMM_DIR_RX_AND_TX = 3
251};
252
253/* QE CMXUCR Registers.
254 * There are two UCCs represented in each of the four CMXUCR registers.
255 * These values are for the UCC in the LSBs
256 */
257#define QE_CMXUCR_MII_ENET_MNG 0x00007000
258#define QE_CMXUCR_MII_ENET_MNG_SHIFT 12
259#define QE_CMXUCR_GRANT 0x00008000
260#define QE_CMXUCR_TSA 0x00004000
261#define QE_CMXUCR_BKPT 0x00000100
262#define QE_CMXUCR_TX_CLK_SRC_MASK 0x0000000F
263
264/* QE CMXGCR Registers.
265*/
266#define QE_CMXGCR_MII_ENET_MNG 0x00007000
267#define QE_CMXGCR_MII_ENET_MNG_SHIFT 12
268#define QE_CMXGCR_USBCS 0x0000000f
269#define QE_CMXGCR_USBCS_CLK3 0x1
270#define QE_CMXGCR_USBCS_CLK5 0x2
271#define QE_CMXGCR_USBCS_CLK7 0x3
272#define QE_CMXGCR_USBCS_CLK9 0x4
273#define QE_CMXGCR_USBCS_CLK13 0x5
274#define QE_CMXGCR_USBCS_CLK17 0x6
275#define QE_CMXGCR_USBCS_CLK19 0x7
276#define QE_CMXGCR_USBCS_CLK21 0x8
277#define QE_CMXGCR_USBCS_BRG9 0x9
278#define QE_CMXGCR_USBCS_BRG10 0xa
279
280/* QE CECR Commands.
281*/
282#define QE_CR_FLG 0x00010000
283#define QE_RESET 0x80000000
284#define QE_INIT_TX_RX 0x00000000
285#define QE_INIT_RX 0x00000001
286#define QE_INIT_TX 0x00000002
287#define QE_ENTER_HUNT_MODE 0x00000003
288#define QE_STOP_TX 0x00000004
289#define QE_GRACEFUL_STOP_TX 0x00000005
290#define QE_RESTART_TX 0x00000006
291#define QE_CLOSE_RX_BD 0x00000007
292#define QE_SWITCH_COMMAND 0x00000007
293#define QE_SET_GROUP_ADDRESS 0x00000008
294#define QE_START_IDMA 0x00000009
295#define QE_MCC_STOP_RX 0x00000009
296#define QE_ATM_TRANSMIT 0x0000000a
297#define QE_HPAC_CLEAR_ALL 0x0000000b
298#define QE_GRACEFUL_STOP_RX 0x0000001a
299#define QE_RESTART_RX 0x0000001b
300#define QE_HPAC_SET_PRIORITY 0x0000010b
301#define QE_HPAC_STOP_TX 0x0000020b
302#define QE_HPAC_STOP_RX 0x0000030b
303#define QE_HPAC_GRACEFUL_STOP_TX 0x0000040b
304#define QE_HPAC_GRACEFUL_STOP_RX 0x0000050b
305#define QE_HPAC_START_TX 0x0000060b
306#define QE_HPAC_START_RX 0x0000070b
307#define QE_USB_STOP_TX 0x0000000a
308#define QE_USB_RESTART_TX 0x0000000c
309#define QE_QMC_STOP_TX 0x0000000c
310#define QE_QMC_STOP_RX 0x0000000d
311#define QE_SS7_SU_FIL_RESET 0x0000000e
312/* jonathbr added from here down for 83xx */
313#define QE_RESET_BCS 0x0000000a
314#define QE_MCC_INIT_TX_RX_16 0x00000003
315#define QE_MCC_STOP_TX 0x00000004
316#define QE_MCC_INIT_TX_1 0x00000005
317#define QE_MCC_INIT_RX_1 0x00000006
318#define QE_MCC_RESET 0x00000007
319#define QE_SET_TIMER 0x00000008
320#define QE_RANDOM_NUMBER 0x0000000c
321#define QE_ATM_MULTI_THREAD_INIT 0x00000011
322#define QE_ASSIGN_PAGE 0x00000012
323#define QE_ADD_REMOVE_HASH_ENTRY 0x00000013
324#define QE_START_FLOW_CONTROL 0x00000014
325#define QE_STOP_FLOW_CONTROL 0x00000015
326#define QE_ASSIGN_PAGE_TO_DEVICE 0x00000016
327
328#define QE_ASSIGN_RISC 0x00000010
329#define QE_CR_MCN_NORMAL_SHIFT 6
330#define QE_CR_MCN_USB_SHIFT 4
331#define QE_CR_MCN_RISC_ASSIGN_SHIFT 8
332#define QE_CR_SNUM_SHIFT 17
333
334/* QE CECR Sub Block - sub block of QE command.
335*/
336#define QE_CR_SUBBLOCK_INVALID 0x00000000
337#define QE_CR_SUBBLOCK_USB 0x03200000
338#define QE_CR_SUBBLOCK_UCCFAST1 0x02000000
339#define QE_CR_SUBBLOCK_UCCFAST2 0x02200000
340#define QE_CR_SUBBLOCK_UCCFAST3 0x02400000
341#define QE_CR_SUBBLOCK_UCCFAST4 0x02600000
342#define QE_CR_SUBBLOCK_UCCFAST5 0x02800000
343#define QE_CR_SUBBLOCK_UCCFAST6 0x02a00000
344#define QE_CR_SUBBLOCK_UCCFAST7 0x02c00000
345#define QE_CR_SUBBLOCK_UCCFAST8 0x02e00000
346#define QE_CR_SUBBLOCK_UCCSLOW1 0x00000000
347#define QE_CR_SUBBLOCK_UCCSLOW2 0x00200000
348#define QE_CR_SUBBLOCK_UCCSLOW3 0x00400000
349#define QE_CR_SUBBLOCK_UCCSLOW4 0x00600000
350#define QE_CR_SUBBLOCK_UCCSLOW5 0x00800000
351#define QE_CR_SUBBLOCK_UCCSLOW6 0x00a00000
352#define QE_CR_SUBBLOCK_UCCSLOW7 0x00c00000
353#define QE_CR_SUBBLOCK_UCCSLOW8 0x00e00000
354#define QE_CR_SUBBLOCK_MCC1 0x03800000
355#define QE_CR_SUBBLOCK_MCC2 0x03a00000
356#define QE_CR_SUBBLOCK_MCC3 0x03000000
357#define QE_CR_SUBBLOCK_IDMA1 0x02800000
358#define QE_CR_SUBBLOCK_IDMA2 0x02a00000
359#define QE_CR_SUBBLOCK_IDMA3 0x02c00000
360#define QE_CR_SUBBLOCK_IDMA4 0x02e00000
361#define QE_CR_SUBBLOCK_HPAC 0x01e00000
362#define QE_CR_SUBBLOCK_SPI1 0x01400000
363#define QE_CR_SUBBLOCK_SPI2 0x01600000
364#define QE_CR_SUBBLOCK_RAND 0x01c00000
365#define QE_CR_SUBBLOCK_TIMER 0x01e00000
366#define QE_CR_SUBBLOCK_GENERAL 0x03c00000
367
368/* QE CECR Protocol - For non-MCC, specifies mode for QE CECR command */
369#define QE_CR_PROTOCOL_UNSPECIFIED 0x00 /* For all other protocols */
370#define QE_CR_PROTOCOL_HDLC_TRANSPARENT 0x00
371#define QE_CR_PROTOCOL_QMC 0x02
372#define QE_CR_PROTOCOL_UART 0x04
373#define QE_CR_PROTOCOL_ATM_POS 0x0A
374#define QE_CR_PROTOCOL_ETHERNET 0x0C
375#define QE_CR_PROTOCOL_L2_SWITCH 0x0D
376
377/* BRG configuration register */
378#define QE_BRGC_ENABLE 0x00010000
379#define QE_BRGC_DIVISOR_SHIFT 1
380#define QE_BRGC_DIVISOR_MAX 0xFFF
381#define QE_BRGC_DIV16 1
382
383/* QE Timers registers */
384#define QE_GTCFR1_PCAS 0x80
385#define QE_GTCFR1_STP2 0x20
386#define QE_GTCFR1_RST2 0x10
387#define QE_GTCFR1_GM2 0x08
388#define QE_GTCFR1_GM1 0x04
389#define QE_GTCFR1_STP1 0x02
390#define QE_GTCFR1_RST1 0x01
391
392/* SDMA registers */
393#define QE_SDSR_BER1 0x02000000
394#define QE_SDSR_BER2 0x01000000
395
396#define QE_SDMR_GLB_1_MSK 0x80000000
397#define QE_SDMR_ADR_SEL 0x20000000
398#define QE_SDMR_BER1_MSK 0x02000000
399#define QE_SDMR_BER2_MSK 0x01000000
400#define QE_SDMR_EB1_MSK 0x00800000
401#define QE_SDMR_ER1_MSK 0x00080000
402#define QE_SDMR_ER2_MSK 0x00040000
403#define QE_SDMR_CEN_MASK 0x0000E000
404#define QE_SDMR_SBER_1 0x00000200
405#define QE_SDMR_SBER_2 0x00000200
406#define QE_SDMR_EB1_PR_MASK 0x000000C0
407#define QE_SDMR_ER1_PR 0x00000008
408
409#define QE_SDMR_CEN_SHIFT 13
410#define QE_SDMR_EB1_PR_SHIFT 6
411
412#define QE_SDTM_MSNUM_SHIFT 24
413
414#define QE_SDEBCR_BA_MASK 0x01FFFFFF
415
416/* Communication Processor */
417#define QE_CP_CERCR_MEE 0x8000 /* Multi-user RAM ECC enable */
418#define QE_CP_CERCR_IEE 0x4000 /* Instruction RAM ECC enable */
419#define QE_CP_CERCR_CIR 0x0800 /* Common instruction RAM */
420
421/* I-RAM */
422#define QE_IRAM_IADD_AIE 0x80000000 /* Auto Increment Enable */
423#define QE_IRAM_IADD_BADDR 0x00080000 /* Base Address */
424
425/* UPC */
426#define UPGCR_PROTOCOL 0x80000000 /* protocol ul2 or pl2 */
427#define UPGCR_TMS 0x40000000 /* Transmit master/slave mode */
428#define UPGCR_RMS 0x20000000 /* Receive master/slave mode */
429#define UPGCR_ADDR 0x10000000 /* Master MPHY Addr multiplexing */
430#define UPGCR_DIAG 0x01000000 /* Diagnostic mode */
431
432/* UCC GUEMR register */
433#define UCC_GUEMR_MODE_MASK_RX 0x02
434#define UCC_GUEMR_MODE_FAST_RX 0x02
435#define UCC_GUEMR_MODE_SLOW_RX 0x00
436#define UCC_GUEMR_MODE_MASK_TX 0x01
437#define UCC_GUEMR_MODE_FAST_TX 0x01
438#define UCC_GUEMR_MODE_SLOW_TX 0x00
439#define UCC_GUEMR_MODE_MASK (UCC_GUEMR_MODE_MASK_RX | UCC_GUEMR_MODE_MASK_TX)
440#define UCC_GUEMR_SET_RESERVED3 0x10 /* Bit 3 in the guemr is reserved but
441 must be set 1 */
442
443/* structure representing UCC SLOW parameter RAM */
444struct ucc_slow_pram {
445 __be16 rbase; /* RX BD base address */
446 __be16 tbase; /* TX BD base address */
447 u8 rbmr; /* RX bus mode register (same as CPM's RFCR) */
448 u8 tbmr; /* TX bus mode register (same as CPM's TFCR) */
449 __be16 mrblr; /* Rx buffer length */
450 __be32 rstate; /* Rx internal state */
451 __be32 rptr; /* Rx internal data pointer */
452 __be16 rbptr; /* rb BD Pointer */
453 __be16 rcount; /* Rx internal byte count */
454 __be32 rtemp; /* Rx temp */
455 __be32 tstate; /* Tx internal state */
456 __be32 tptr; /* Tx internal data pointer */
457 __be16 tbptr; /* Tx BD pointer */
458 __be16 tcount; /* Tx byte count */
459 __be32 ttemp; /* Tx temp */
460 __be32 rcrc; /* temp receive CRC */
461 __be32 tcrc; /* temp transmit CRC */
462} __attribute__ ((packed));
463
464/* General UCC SLOW Mode Register (GUMRH & GUMRL) */
465#define UCC_SLOW_GUMR_H_SAM_QMC 0x00000000
466#define UCC_SLOW_GUMR_H_SAM_SATM 0x00008000
467#define UCC_SLOW_GUMR_H_REVD 0x00002000
468#define UCC_SLOW_GUMR_H_TRX 0x00001000
469#define UCC_SLOW_GUMR_H_TTX 0x00000800
470#define UCC_SLOW_GUMR_H_CDP 0x00000400
471#define UCC_SLOW_GUMR_H_CTSP 0x00000200
472#define UCC_SLOW_GUMR_H_CDS 0x00000100
473#define UCC_SLOW_GUMR_H_CTSS 0x00000080
474#define UCC_SLOW_GUMR_H_TFL 0x00000040
475#define UCC_SLOW_GUMR_H_RFW 0x00000020
476#define UCC_SLOW_GUMR_H_TXSY 0x00000010
477#define UCC_SLOW_GUMR_H_4SYNC 0x00000004
478#define UCC_SLOW_GUMR_H_8SYNC 0x00000008
479#define UCC_SLOW_GUMR_H_16SYNC 0x0000000c
480#define UCC_SLOW_GUMR_H_RTSM 0x00000002
481#define UCC_SLOW_GUMR_H_RSYN 0x00000001
482
483#define UCC_SLOW_GUMR_L_TCI 0x10000000
484#define UCC_SLOW_GUMR_L_RINV 0x02000000
485#define UCC_SLOW_GUMR_L_TINV 0x01000000
486#define UCC_SLOW_GUMR_L_TEND 0x00040000
487#define UCC_SLOW_GUMR_L_TDCR_MASK 0x00030000
488#define UCC_SLOW_GUMR_L_TDCR_32 0x00030000
489#define UCC_SLOW_GUMR_L_TDCR_16 0x00020000
490#define UCC_SLOW_GUMR_L_TDCR_8 0x00010000
491#define UCC_SLOW_GUMR_L_TDCR_1 0x00000000
492#define UCC_SLOW_GUMR_L_RDCR_MASK 0x0000c000
493#define UCC_SLOW_GUMR_L_RDCR_32 0x0000c000
494#define UCC_SLOW_GUMR_L_RDCR_16 0x00008000
495#define UCC_SLOW_GUMR_L_RDCR_8 0x00004000
496#define UCC_SLOW_GUMR_L_RDCR_1 0x00000000
497#define UCC_SLOW_GUMR_L_RENC_NRZI 0x00000800
498#define UCC_SLOW_GUMR_L_RENC_NRZ 0x00000000
499#define UCC_SLOW_GUMR_L_TENC_NRZI 0x00000100
500#define UCC_SLOW_GUMR_L_TENC_NRZ 0x00000000
501#define UCC_SLOW_GUMR_L_DIAG_MASK 0x000000c0
502#define UCC_SLOW_GUMR_L_DIAG_LE 0x000000c0
503#define UCC_SLOW_GUMR_L_DIAG_ECHO 0x00000080
504#define UCC_SLOW_GUMR_L_DIAG_LOOP 0x00000040
505#define UCC_SLOW_GUMR_L_DIAG_NORM 0x00000000
506#define UCC_SLOW_GUMR_L_ENR 0x00000020
507#define UCC_SLOW_GUMR_L_ENT 0x00000010
508#define UCC_SLOW_GUMR_L_MODE_MASK 0x0000000F
509#define UCC_SLOW_GUMR_L_MODE_BISYNC 0x00000008
510#define UCC_SLOW_GUMR_L_MODE_AHDLC 0x00000006
511#define UCC_SLOW_GUMR_L_MODE_UART 0x00000004
512#define UCC_SLOW_GUMR_L_MODE_QMC 0x00000002
513
514/* General UCC FAST Mode Register */
515#define UCC_FAST_GUMR_TCI 0x20000000
516#define UCC_FAST_GUMR_TRX 0x10000000
517#define UCC_FAST_GUMR_TTX 0x08000000
518#define UCC_FAST_GUMR_CDP 0x04000000
519#define UCC_FAST_GUMR_CTSP 0x02000000
520#define UCC_FAST_GUMR_CDS 0x01000000
521#define UCC_FAST_GUMR_CTSS 0x00800000
522#define UCC_FAST_GUMR_TXSY 0x00020000
523#define UCC_FAST_GUMR_RSYN 0x00010000
524#define UCC_FAST_GUMR_RTSM 0x00002000
525#define UCC_FAST_GUMR_REVD 0x00000400
526#define UCC_FAST_GUMR_ENR 0x00000020
527#define UCC_FAST_GUMR_ENT 0x00000010
528
529/* UART Slow UCC Event Register (UCCE) */
530#define UCC_UART_UCCE_AB 0x0200
531#define UCC_UART_UCCE_IDLE 0x0100
532#define UCC_UART_UCCE_GRA 0x0080
533#define UCC_UART_UCCE_BRKE 0x0040
534#define UCC_UART_UCCE_BRKS 0x0020
535#define UCC_UART_UCCE_CCR 0x0008
536#define UCC_UART_UCCE_BSY 0x0004
537#define UCC_UART_UCCE_TX 0x0002
538#define UCC_UART_UCCE_RX 0x0001
539
540/* HDLC Slow UCC Event Register (UCCE) */
541#define UCC_HDLC_UCCE_GLR 0x1000
542#define UCC_HDLC_UCCE_GLT 0x0800
543#define UCC_HDLC_UCCE_IDLE 0x0100
544#define UCC_HDLC_UCCE_BRKE 0x0040
545#define UCC_HDLC_UCCE_BRKS 0x0020
546#define UCC_HDLC_UCCE_TXE 0x0010
547#define UCC_HDLC_UCCE_RXF 0x0008
548#define UCC_HDLC_UCCE_BSY 0x0004
549#define UCC_HDLC_UCCE_TXB 0x0002
550#define UCC_HDLC_UCCE_RXB 0x0001
551
552/* BISYNC Slow UCC Event Register (UCCE) */
553#define UCC_BISYNC_UCCE_GRA 0x0080
554#define UCC_BISYNC_UCCE_TXE 0x0010
555#define UCC_BISYNC_UCCE_RCH 0x0008
556#define UCC_BISYNC_UCCE_BSY 0x0004
557#define UCC_BISYNC_UCCE_TXB 0x0002
558#define UCC_BISYNC_UCCE_RXB 0x0001
559
560/* Gigabit Ethernet Fast UCC Event Register (UCCE) */
561#define UCC_GETH_UCCE_MPD 0x80000000
562#define UCC_GETH_UCCE_SCAR 0x40000000
563#define UCC_GETH_UCCE_GRA 0x20000000
564#define UCC_GETH_UCCE_CBPR 0x10000000
565#define UCC_GETH_UCCE_BSY 0x08000000
566#define UCC_GETH_UCCE_RXC 0x04000000
567#define UCC_GETH_UCCE_TXC 0x02000000
568#define UCC_GETH_UCCE_TXE 0x01000000
569#define UCC_GETH_UCCE_TXB7 0x00800000
570#define UCC_GETH_UCCE_TXB6 0x00400000
571#define UCC_GETH_UCCE_TXB5 0x00200000
572#define UCC_GETH_UCCE_TXB4 0x00100000
573#define UCC_GETH_UCCE_TXB3 0x00080000
574#define UCC_GETH_UCCE_TXB2 0x00040000
575#define UCC_GETH_UCCE_TXB1 0x00020000
576#define UCC_GETH_UCCE_TXB0 0x00010000
577#define UCC_GETH_UCCE_RXB7 0x00008000
578#define UCC_GETH_UCCE_RXB6 0x00004000
579#define UCC_GETH_UCCE_RXB5 0x00002000
580#define UCC_GETH_UCCE_RXB4 0x00001000
581#define UCC_GETH_UCCE_RXB3 0x00000800
582#define UCC_GETH_UCCE_RXB2 0x00000400
583#define UCC_GETH_UCCE_RXB1 0x00000200
584#define UCC_GETH_UCCE_RXB0 0x00000100
585#define UCC_GETH_UCCE_RXF7 0x00000080
586#define UCC_GETH_UCCE_RXF6 0x00000040
587#define UCC_GETH_UCCE_RXF5 0x00000020
588#define UCC_GETH_UCCE_RXF4 0x00000010
589#define UCC_GETH_UCCE_RXF3 0x00000008
590#define UCC_GETH_UCCE_RXF2 0x00000004
591#define UCC_GETH_UCCE_RXF1 0x00000002
592#define UCC_GETH_UCCE_RXF0 0x00000001
593
594/* UPSMR, when used as a UART */
595#define UCC_UART_UPSMR_FLC 0x8000
596#define UCC_UART_UPSMR_SL 0x4000
597#define UCC_UART_UPSMR_CL_MASK 0x3000
598#define UCC_UART_UPSMR_CL_8 0x3000
599#define UCC_UART_UPSMR_CL_7 0x2000
600#define UCC_UART_UPSMR_CL_6 0x1000
601#define UCC_UART_UPSMR_CL_5 0x0000
602#define UCC_UART_UPSMR_UM_MASK 0x0c00
603#define UCC_UART_UPSMR_UM_NORMAL 0x0000
604#define UCC_UART_UPSMR_UM_MAN_MULTI 0x0400
605#define UCC_UART_UPSMR_UM_AUTO_MULTI 0x0c00
606#define UCC_UART_UPSMR_FRZ 0x0200
607#define UCC_UART_UPSMR_RZS 0x0100
608#define UCC_UART_UPSMR_SYN 0x0080
609#define UCC_UART_UPSMR_DRT 0x0040
610#define UCC_UART_UPSMR_PEN 0x0010
611#define UCC_UART_UPSMR_RPM_MASK 0x000c
612#define UCC_UART_UPSMR_RPM_ODD 0x0000
613#define UCC_UART_UPSMR_RPM_LOW 0x0004
614#define UCC_UART_UPSMR_RPM_EVEN 0x0008
615#define UCC_UART_UPSMR_RPM_HIGH 0x000C
616#define UCC_UART_UPSMR_TPM_MASK 0x0003
617#define UCC_UART_UPSMR_TPM_ODD 0x0000
618#define UCC_UART_UPSMR_TPM_LOW 0x0001
619#define UCC_UART_UPSMR_TPM_EVEN 0x0002
620#define UCC_UART_UPSMR_TPM_HIGH 0x0003
621
622/* UCC Transmit On Demand Register (UTODR) */
623#define UCC_SLOW_TOD 0x8000
624#define UCC_FAST_TOD 0x8000
625
626/* UCC Bus Mode Register masks */
627/* Not to be confused with the Bundle Mode Register */
628#define UCC_BMR_GBL 0x20
629#define UCC_BMR_BO_BE 0x10
630#define UCC_BMR_CETM 0x04
631#define UCC_BMR_DTB 0x02
632#define UCC_BMR_BDB 0x01
633
634/* Function code masks */
635#define FC_GBL 0x20
636#define FC_DTB_LCL 0x02
637#define UCC_FAST_FUNCTION_CODE_GBL 0x20
638#define UCC_FAST_FUNCTION_CODE_DTB_LCL 0x02
639#define UCC_FAST_FUNCTION_CODE_BDB_LCL 0x01
640
641#endif /* __KERNEL__ */
642#endif /* _ASM_POWERPC_QE_H */
diff --git a/arch/powerpc/include/asm/qe_ic.h b/arch/powerpc/include/asm/qe_ic.h
new file mode 100644
index 000000000000..56a7745ca343
--- /dev/null
+++ b/arch/powerpc/include/asm/qe_ic.h
@@ -0,0 +1,128 @@
1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com>
6 *
7 * Description:
8 * QE IC external definitions and structure.
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#ifndef _ASM_POWERPC_QE_IC_H
16#define _ASM_POWERPC_QE_IC_H
17
18#include <linux/irq.h>
19
20#define NUM_OF_QE_IC_GROUPS 6
21
22/* Flags when we init the QE IC */
23#define QE_IC_SPREADMODE_GRP_W 0x00000001
24#define QE_IC_SPREADMODE_GRP_X 0x00000002
25#define QE_IC_SPREADMODE_GRP_Y 0x00000004
26#define QE_IC_SPREADMODE_GRP_Z 0x00000008
27#define QE_IC_SPREADMODE_GRP_RISCA 0x00000010
28#define QE_IC_SPREADMODE_GRP_RISCB 0x00000020
29
30#define QE_IC_LOW_SIGNAL 0x00000100
31#define QE_IC_HIGH_SIGNAL 0x00000200
32
33#define QE_IC_GRP_W_PRI0_DEST_SIGNAL_HIGH 0x00001000
34#define QE_IC_GRP_W_PRI1_DEST_SIGNAL_HIGH 0x00002000
35#define QE_IC_GRP_X_PRI0_DEST_SIGNAL_HIGH 0x00004000
36#define QE_IC_GRP_X_PRI1_DEST_SIGNAL_HIGH 0x00008000
37#define QE_IC_GRP_Y_PRI0_DEST_SIGNAL_HIGH 0x00010000
38#define QE_IC_GRP_Y_PRI1_DEST_SIGNAL_HIGH 0x00020000
39#define QE_IC_GRP_Z_PRI0_DEST_SIGNAL_HIGH 0x00040000
40#define QE_IC_GRP_Z_PRI1_DEST_SIGNAL_HIGH 0x00080000
41#define QE_IC_GRP_RISCA_PRI0_DEST_SIGNAL_HIGH 0x00100000
42#define QE_IC_GRP_RISCA_PRI1_DEST_SIGNAL_HIGH 0x00200000
43#define QE_IC_GRP_RISCB_PRI0_DEST_SIGNAL_HIGH 0x00400000
44#define QE_IC_GRP_RISCB_PRI1_DEST_SIGNAL_HIGH 0x00800000
45#define QE_IC_GRP_W_DEST_SIGNAL_SHIFT (12)
46
47/* QE interrupt sources groups */
48enum qe_ic_grp_id {
49 QE_IC_GRP_W = 0, /* QE interrupt controller group W */
50 QE_IC_GRP_X, /* QE interrupt controller group X */
51 QE_IC_GRP_Y, /* QE interrupt controller group Y */
52 QE_IC_GRP_Z, /* QE interrupt controller group Z */
53 QE_IC_GRP_RISCA, /* QE interrupt controller RISC group A */
54 QE_IC_GRP_RISCB /* QE interrupt controller RISC group B */
55};
56
57void qe_ic_init(struct device_node *node, unsigned int flags,
58 void (*low_handler)(unsigned int irq, struct irq_desc *desc),
59 void (*high_handler)(unsigned int irq, struct irq_desc *desc));
60void qe_ic_set_highest_priority(unsigned int virq, int high);
61int qe_ic_set_priority(unsigned int virq, unsigned int priority);
62int qe_ic_set_high_priority(unsigned int virq, unsigned int priority, int high);
63
64struct qe_ic;
65unsigned int qe_ic_get_low_irq(struct qe_ic *qe_ic);
66unsigned int qe_ic_get_high_irq(struct qe_ic *qe_ic);
67
68static inline void qe_ic_cascade_low_ipic(unsigned int irq,
69 struct irq_desc *desc)
70{
71 struct qe_ic *qe_ic = desc->handler_data;
72 unsigned int cascade_irq = qe_ic_get_low_irq(qe_ic);
73
74 if (cascade_irq != NO_IRQ)
75 generic_handle_irq(cascade_irq);
76}
77
78static inline void qe_ic_cascade_high_ipic(unsigned int irq,
79 struct irq_desc *desc)
80{
81 struct qe_ic *qe_ic = desc->handler_data;
82 unsigned int cascade_irq = qe_ic_get_high_irq(qe_ic);
83
84 if (cascade_irq != NO_IRQ)
85 generic_handle_irq(cascade_irq);
86}
87
88static inline void qe_ic_cascade_low_mpic(unsigned int irq,
89 struct irq_desc *desc)
90{
91 struct qe_ic *qe_ic = desc->handler_data;
92 unsigned int cascade_irq = qe_ic_get_low_irq(qe_ic);
93
94 if (cascade_irq != NO_IRQ)
95 generic_handle_irq(cascade_irq);
96
97 desc->chip->eoi(irq);
98}
99
100static inline void qe_ic_cascade_high_mpic(unsigned int irq,
101 struct irq_desc *desc)
102{
103 struct qe_ic *qe_ic = desc->handler_data;
104 unsigned int cascade_irq = qe_ic_get_high_irq(qe_ic);
105
106 if (cascade_irq != NO_IRQ)
107 generic_handle_irq(cascade_irq);
108
109 desc->chip->eoi(irq);
110}
111
112static inline void qe_ic_cascade_muxed_mpic(unsigned int irq,
113 struct irq_desc *desc)
114{
115 struct qe_ic *qe_ic = desc->handler_data;
116 unsigned int cascade_irq;
117
118 cascade_irq = qe_ic_get_high_irq(qe_ic);
119 if (cascade_irq == NO_IRQ)
120 cascade_irq = qe_ic_get_low_irq(qe_ic);
121
122 if (cascade_irq != NO_IRQ)
123 generic_handle_irq(cascade_irq);
124
125 desc->chip->eoi(irq);
126}
127
128#endif /* _ASM_POWERPC_QE_IC_H */
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
new file mode 100644
index 000000000000..c6d1ab650778
--- /dev/null
+++ b/arch/powerpc/include/asm/reg.h
@@ -0,0 +1,788 @@
1/*
2 * Contains the definition of registers common to all PowerPC variants.
3 * If a register definition has been changed in a different PowerPC
4 * variant, we will case it in #ifndef XXX ... #endif, and have the
5 * number used in the Programming Environments Manual For 32-Bit
6 * Implementations of the PowerPC Architecture (a.k.a. Green Book) here.
7 */
8
9#ifndef _ASM_POWERPC_REG_H
10#define _ASM_POWERPC_REG_H
11#ifdef __KERNEL__
12
13#include <linux/stringify.h>
14#include <asm/cputable.h>
15
16/* Pickup Book E specific registers. */
17#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
18#include <asm/reg_booke.h>
19#endif /* CONFIG_BOOKE || CONFIG_40x */
20
21#ifdef CONFIG_FSL_EMB_PERFMON
22#include <asm/reg_fsl_emb.h>
23#endif
24
25#ifdef CONFIG_8xx
26#include <asm/reg_8xx.h>
27#endif /* CONFIG_8xx */
28
29#define MSR_SF_LG 63 /* Enable 64 bit mode */
30#define MSR_ISF_LG 61 /* Interrupt 64b mode valid on 630 */
31#define MSR_HV_LG 60 /* Hypervisor state */
32#define MSR_VEC_LG 25 /* Enable AltiVec */
33#define MSR_VSX_LG 23 /* Enable VSX */
34#define MSR_POW_LG 18 /* Enable Power Management */
35#define MSR_WE_LG 18 /* Wait State Enable */
36#define MSR_TGPR_LG 17 /* TLB Update registers in use */
37#define MSR_CE_LG 17 /* Critical Interrupt Enable */
38#define MSR_ILE_LG 16 /* Interrupt Little Endian */
39#define MSR_EE_LG 15 /* External Interrupt Enable */
40#define MSR_PR_LG 14 /* Problem State / Privilege Level */
41#define MSR_FP_LG 13 /* Floating Point enable */
42#define MSR_ME_LG 12 /* Machine Check Enable */
43#define MSR_FE0_LG 11 /* Floating Exception mode 0 */
44#define MSR_SE_LG 10 /* Single Step */
45#define MSR_BE_LG 9 /* Branch Trace */
46#define MSR_DE_LG 9 /* Debug Exception Enable */
47#define MSR_FE1_LG 8 /* Floating Exception mode 1 */
48#define MSR_IP_LG 6 /* Exception prefix 0x000/0xFFF */
49#define MSR_IR_LG 5 /* Instruction Relocate */
50#define MSR_DR_LG 4 /* Data Relocate */
51#define MSR_PE_LG 3 /* Protection Enable */
52#define MSR_PX_LG 2 /* Protection Exclusive Mode */
53#define MSR_PMM_LG 2 /* Performance monitor */
54#define MSR_RI_LG 1 /* Recoverable Exception */
55#define MSR_LE_LG 0 /* Little Endian */
56
57#ifdef __ASSEMBLY__
58#define __MASK(X) (1<<(X))
59#else
60#define __MASK(X) (1UL<<(X))
61#endif
62
63#ifdef CONFIG_PPC64
64#define MSR_SF __MASK(MSR_SF_LG) /* Enable 64 bit mode */
65#define MSR_ISF __MASK(MSR_ISF_LG) /* Interrupt 64b mode valid on 630 */
66#define MSR_HV __MASK(MSR_HV_LG) /* Hypervisor state */
67#else
68/* so tests for these bits fail on 32-bit */
69#define MSR_SF 0
70#define MSR_ISF 0
71#define MSR_HV 0
72#endif
73
74#define MSR_VEC __MASK(MSR_VEC_LG) /* Enable AltiVec */
75#define MSR_VSX __MASK(MSR_VSX_LG) /* Enable VSX */
76#define MSR_POW __MASK(MSR_POW_LG) /* Enable Power Management */
77#define MSR_WE __MASK(MSR_WE_LG) /* Wait State Enable */
78#define MSR_TGPR __MASK(MSR_TGPR_LG) /* TLB Update registers in use */
79#define MSR_CE __MASK(MSR_CE_LG) /* Critical Interrupt Enable */
80#define MSR_ILE __MASK(MSR_ILE_LG) /* Interrupt Little Endian */
81#define MSR_EE __MASK(MSR_EE_LG) /* External Interrupt Enable */
82#define MSR_PR __MASK(MSR_PR_LG) /* Problem State / Privilege Level */
83#define MSR_FP __MASK(MSR_FP_LG) /* Floating Point enable */
84#define MSR_ME __MASK(MSR_ME_LG) /* Machine Check Enable */
85#define MSR_FE0 __MASK(MSR_FE0_LG) /* Floating Exception mode 0 */
86#define MSR_SE __MASK(MSR_SE_LG) /* Single Step */
87#define MSR_BE __MASK(MSR_BE_LG) /* Branch Trace */
88#define MSR_DE __MASK(MSR_DE_LG) /* Debug Exception Enable */
89#define MSR_FE1 __MASK(MSR_FE1_LG) /* Floating Exception mode 1 */
90#define MSR_IP __MASK(MSR_IP_LG) /* Exception prefix 0x000/0xFFF */
91#define MSR_IR __MASK(MSR_IR_LG) /* Instruction Relocate */
92#define MSR_DR __MASK(MSR_DR_LG) /* Data Relocate */
93#define MSR_PE __MASK(MSR_PE_LG) /* Protection Enable */
94#define MSR_PX __MASK(MSR_PX_LG) /* Protection Exclusive Mode */
95#ifndef MSR_PMM
96#define MSR_PMM __MASK(MSR_PMM_LG) /* Performance monitor */
97#endif
98#define MSR_RI __MASK(MSR_RI_LG) /* Recoverable Exception */
99#define MSR_LE __MASK(MSR_LE_LG) /* Little Endian */
100
101#ifdef CONFIG_PPC64
102#define MSR_ MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF |MSR_HV
103#define MSR_KERNEL MSR_ | MSR_SF
104
105#define MSR_USER32 MSR_ | MSR_PR | MSR_EE
106#define MSR_USER64 MSR_USER32 | MSR_SF
107
108#else /* 32-bit */
109/* Default MSR for kernel mode. */
110#ifndef MSR_KERNEL /* reg_booke.h also defines this */
111#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR)
112#endif
113
114#define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE)
115#endif
116
117/* Floating Point Status and Control Register (FPSCR) Fields */
118#define FPSCR_FX 0x80000000 /* FPU exception summary */
119#define FPSCR_FEX 0x40000000 /* FPU enabled exception summary */
120#define FPSCR_VX 0x20000000 /* Invalid operation summary */
121#define FPSCR_OX 0x10000000 /* Overflow exception summary */
122#define FPSCR_UX 0x08000000 /* Underflow exception summary */
123#define FPSCR_ZX 0x04000000 /* Zero-divide exception summary */
124#define FPSCR_XX 0x02000000 /* Inexact exception summary */
125#define FPSCR_VXSNAN 0x01000000 /* Invalid op for SNaN */
126#define FPSCR_VXISI 0x00800000 /* Invalid op for Inv - Inv */
127#define FPSCR_VXIDI 0x00400000 /* Invalid op for Inv / Inv */
128#define FPSCR_VXZDZ 0x00200000 /* Invalid op for Zero / Zero */
129#define FPSCR_VXIMZ 0x00100000 /* Invalid op for Inv * Zero */
130#define FPSCR_VXVC 0x00080000 /* Invalid op for Compare */
131#define FPSCR_FR 0x00040000 /* Fraction rounded */
132#define FPSCR_FI 0x00020000 /* Fraction inexact */
133#define FPSCR_FPRF 0x0001f000 /* FPU Result Flags */
134#define FPSCR_FPCC 0x0000f000 /* FPU Condition Codes */
135#define FPSCR_VXSOFT 0x00000400 /* Invalid op for software request */
136#define FPSCR_VXSQRT 0x00000200 /* Invalid op for square root */
137#define FPSCR_VXCVI 0x00000100 /* Invalid op for integer convert */
138#define FPSCR_VE 0x00000080 /* Invalid op exception enable */
139#define FPSCR_OE 0x00000040 /* IEEE overflow exception enable */
140#define FPSCR_UE 0x00000020 /* IEEE underflow exception enable */
141#define FPSCR_ZE 0x00000010 /* IEEE zero divide exception enable */
142#define FPSCR_XE 0x00000008 /* FP inexact exception enable */
143#define FPSCR_NI 0x00000004 /* FPU non IEEE-Mode */
144#define FPSCR_RN 0x00000003 /* FPU rounding control */
145
146/* Special Purpose Registers (SPRNs)*/
147#define SPRN_CTR 0x009 /* Count Register */
148#define SPRN_DSCR 0x11
149#define SPRN_CTRLF 0x088
150#define SPRN_CTRLT 0x098
151#define CTRL_CT 0xc0000000 /* current thread */
152#define CTRL_CT0 0x80000000 /* thread 0 */
153#define CTRL_CT1 0x40000000 /* thread 1 */
154#define CTRL_TE 0x00c00000 /* thread enable */
155#define CTRL_RUNLATCH 0x1
156#define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */
157#define DABR_TRANSLATION (1UL << 2)
158#define SPRN_DABR2 0x13D /* e300 */
159#define SPRN_DABRX 0x3F7 /* Data Address Breakpoint Register Extension */
160#define DABRX_USER (1UL << 0)
161#define DABRX_KERNEL (1UL << 1)
162#define SPRN_DAR 0x013 /* Data Address Register */
163#define SPRN_DBCR 0x136 /* e300 Data Breakpoint Control Reg */
164#define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */
165#define DSISR_NOHPTE 0x40000000 /* no translation found */
166#define DSISR_PROTFAULT 0x08000000 /* protection fault */
167#define DSISR_ISSTORE 0x02000000 /* access was a store */
168#define DSISR_DABRMATCH 0x00400000 /* hit data breakpoint */
169#define DSISR_NOSEGMENT 0x00200000 /* STAB/SLB miss */
170#define SPRN_TBRL 0x10C /* Time Base Read Lower Register (user, R/O) */
171#define SPRN_TBRU 0x10D /* Time Base Read Upper Register (user, R/O) */
172#define SPRN_TBWL 0x11C /* Time Base Lower Register (super, R/W) */
173#define SPRN_TBWU 0x11D /* Time Base Upper Register (super, R/W) */
174#define SPRN_SPURR 0x134 /* Scaled PURR */
175#define SPRN_HIOR 0x137 /* 970 Hypervisor interrupt offset */
176#define SPRN_LPCR 0x13E /* LPAR Control Register */
177#define SPRN_DBAT0L 0x219 /* Data BAT 0 Lower Register */
178#define SPRN_DBAT0U 0x218 /* Data BAT 0 Upper Register */
179#define SPRN_DBAT1L 0x21B /* Data BAT 1 Lower Register */
180#define SPRN_DBAT1U 0x21A /* Data BAT 1 Upper Register */
181#define SPRN_DBAT2L 0x21D /* Data BAT 2 Lower Register */
182#define SPRN_DBAT2U 0x21C /* Data BAT 2 Upper Register */
183#define SPRN_DBAT3L 0x21F /* Data BAT 3 Lower Register */
184#define SPRN_DBAT3U 0x21E /* Data BAT 3 Upper Register */
185#define SPRN_DBAT4L 0x239 /* Data BAT 4 Lower Register */
186#define SPRN_DBAT4U 0x238 /* Data BAT 4 Upper Register */
187#define SPRN_DBAT5L 0x23B /* Data BAT 5 Lower Register */
188#define SPRN_DBAT5U 0x23A /* Data BAT 5 Upper Register */
189#define SPRN_DBAT6L 0x23D /* Data BAT 6 Lower Register */
190#define SPRN_DBAT6U 0x23C /* Data BAT 6 Upper Register */
191#define SPRN_DBAT7L 0x23F /* Data BAT 7 Lower Register */
192#define SPRN_DBAT7U 0x23E /* Data BAT 7 Upper Register */
193
194#define SPRN_DEC 0x016 /* Decrement Register */
195#define SPRN_DER 0x095 /* Debug Enable Regsiter */
196#define DER_RSTE 0x40000000 /* Reset Interrupt */
197#define DER_CHSTPE 0x20000000 /* Check Stop */
198#define DER_MCIE 0x10000000 /* Machine Check Interrupt */
199#define DER_EXTIE 0x02000000 /* External Interrupt */
200#define DER_ALIE 0x01000000 /* Alignment Interrupt */
201#define DER_PRIE 0x00800000 /* Program Interrupt */
202#define DER_FPUVIE 0x00400000 /* FP Unavailable Interrupt */
203#define DER_DECIE 0x00200000 /* Decrementer Interrupt */
204#define DER_SYSIE 0x00040000 /* System Call Interrupt */
205#define DER_TRE 0x00020000 /* Trace Interrupt */
206#define DER_SEIE 0x00004000 /* FP SW Emulation Interrupt */
207#define DER_ITLBMSE 0x00002000 /* Imp. Spec. Instruction TLB Miss */
208#define DER_ITLBERE 0x00001000 /* Imp. Spec. Instruction TLB Error */
209#define DER_DTLBMSE 0x00000800 /* Imp. Spec. Data TLB Miss */
210#define DER_DTLBERE 0x00000400 /* Imp. Spec. Data TLB Error */
211#define DER_LBRKE 0x00000008 /* Load/Store Breakpoint Interrupt */
212#define DER_IBRKE 0x00000004 /* Instruction Breakpoint Interrupt */
213#define DER_EBRKE 0x00000002 /* External Breakpoint Interrupt */
214#define DER_DPIE 0x00000001 /* Dev. Port Nonmaskable Request */
215#define SPRN_DMISS 0x3D0 /* Data TLB Miss Register */
216#define SPRN_EAR 0x11A /* External Address Register */
217#define SPRN_HASH1 0x3D2 /* Primary Hash Address Register */
218#define SPRN_HASH2 0x3D3 /* Secondary Hash Address Resgister */
219#define SPRN_HID0 0x3F0 /* Hardware Implementation Register 0 */
220#define HID0_EMCP (1<<31) /* Enable Machine Check pin */
221#define HID0_EBA (1<<29) /* Enable Bus Address Parity */
222#define HID0_EBD (1<<28) /* Enable Bus Data Parity */
223#define HID0_SBCLK (1<<27)
224#define HID0_EICE (1<<26)
225#define HID0_TBEN (1<<26) /* Timebase enable - 745x */
226#define HID0_ECLK (1<<25)
227#define HID0_PAR (1<<24)
228#define HID0_STEN (1<<24) /* Software table search enable - 745x */
229#define HID0_HIGH_BAT (1<<23) /* Enable high BATs - 7455 */
230#define HID0_DOZE (1<<23)
231#define HID0_NAP (1<<22)
232#define HID0_SLEEP (1<<21)
233#define HID0_DPM (1<<20)
234#define HID0_BHTCLR (1<<18) /* Clear branch history table - 7450 */
235#define HID0_XAEN (1<<17) /* Extended addressing enable - 7450 */
236#define HID0_NHR (1<<16) /* Not hard reset (software bit-7450)*/
237#define HID0_ICE (1<<15) /* Instruction Cache Enable */
238#define HID0_DCE (1<<14) /* Data Cache Enable */
239#define HID0_ILOCK (1<<13) /* Instruction Cache Lock */
240#define HID0_DLOCK (1<<12) /* Data Cache Lock */
241#define HID0_ICFI (1<<11) /* Instr. Cache Flash Invalidate */
242#define HID0_DCI (1<<10) /* Data Cache Invalidate */
243#define HID0_SPD (1<<9) /* Speculative disable */
244#define HID0_DAPUEN (1<<8) /* Debug APU enable */
245#define HID0_SGE (1<<7) /* Store Gathering Enable */
246#define HID0_SIED (1<<7) /* Serial Instr. Execution [Disable] */
247#define HID0_DCFA (1<<6) /* Data Cache Flush Assist */
248#define HID0_LRSTK (1<<4) /* Link register stack - 745x */
249#define HID0_BTIC (1<<5) /* Branch Target Instr Cache Enable */
250#define HID0_ABE (1<<3) /* Address Broadcast Enable */
251#define HID0_FOLD (1<<3) /* Branch Folding enable - 745x */
252#define HID0_BHTE (1<<2) /* Branch History Table Enable */
253#define HID0_BTCD (1<<1) /* Branch target cache disable */
254#define HID0_NOPDST (1<<1) /* No-op dst, dstt, etc. instr. */
255#define HID0_NOPTI (1<<0) /* No-op dcbt and dcbst instr. */
256
257#define SPRN_HID1 0x3F1 /* Hardware Implementation Register 1 */
258#define HID1_EMCP (1<<31) /* 7450 Machine Check Pin Enable */
259#define HID1_DFS (1<<22) /* 7447A Dynamic Frequency Scaling */
260#define HID1_PC0 (1<<16) /* 7450 PLL_CFG[0] */
261#define HID1_PC1 (1<<15) /* 7450 PLL_CFG[1] */
262#define HID1_PC2 (1<<14) /* 7450 PLL_CFG[2] */
263#define HID1_PC3 (1<<13) /* 7450 PLL_CFG[3] */
264#define HID1_SYNCBE (1<<11) /* 7450 ABE for sync, eieio */
265#define HID1_ABE (1<<10) /* 7450 Address Broadcast Enable */
266#define HID1_PS (1<<16) /* 750FX PLL selection */
267#define SPRN_HID2 0x3F8 /* Hardware Implementation Register 2 */
268#define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */
269#define SPRN_IABR2 0x3FA /* 83xx */
270#define SPRN_IBCR 0x135 /* 83xx Insn Breakpoint Control Reg */
271#define SPRN_HID4 0x3F4 /* 970 HID4 */
272#define SPRN_HID5 0x3F6 /* 970 HID5 */
273#define SPRN_HID6 0x3F9 /* BE HID 6 */
274#define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */
275#define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */
276#define SPRN_TSC_CELL 0x399 /* Thread switch control on Cell */
277#define TSC_CELL_DEC_ENABLE_0 0x400000 /* Decrementer Interrupt */
278#define TSC_CELL_DEC_ENABLE_1 0x200000 /* Decrementer Interrupt */
279#define TSC_CELL_EE_ENABLE 0x100000 /* External Interrupt */
280#define TSC_CELL_EE_BOOST 0x080000 /* External Interrupt Boost */
281#define SPRN_TSC 0x3FD /* Thread switch control on others */
282#define SPRN_TST 0x3FC /* Thread switch timeout on others */
283#if !defined(SPRN_IAC1) && !defined(SPRN_IAC2)
284#define SPRN_IAC1 0x3F4 /* Instruction Address Compare 1 */
285#define SPRN_IAC2 0x3F5 /* Instruction Address Compare 2 */
286#endif
287#define SPRN_IBAT0L 0x211 /* Instruction BAT 0 Lower Register */
288#define SPRN_IBAT0U 0x210 /* Instruction BAT 0 Upper Register */
289#define SPRN_IBAT1L 0x213 /* Instruction BAT 1 Lower Register */
290#define SPRN_IBAT1U 0x212 /* Instruction BAT 1 Upper Register */
291#define SPRN_IBAT2L 0x215 /* Instruction BAT 2 Lower Register */
292#define SPRN_IBAT2U 0x214 /* Instruction BAT 2 Upper Register */
293#define SPRN_IBAT3L 0x217 /* Instruction BAT 3 Lower Register */
294#define SPRN_IBAT3U 0x216 /* Instruction BAT 3 Upper Register */
295#define SPRN_IBAT4L 0x231 /* Instruction BAT 4 Lower Register */
296#define SPRN_IBAT4U 0x230 /* Instruction BAT 4 Upper Register */
297#define SPRN_IBAT5L 0x233 /* Instruction BAT 5 Lower Register */
298#define SPRN_IBAT5U 0x232 /* Instruction BAT 5 Upper Register */
299#define SPRN_IBAT6L 0x235 /* Instruction BAT 6 Lower Register */
300#define SPRN_IBAT6U 0x234 /* Instruction BAT 6 Upper Register */
301#define SPRN_IBAT7L 0x237 /* Instruction BAT 7 Lower Register */
302#define SPRN_IBAT7U 0x236 /* Instruction BAT 7 Upper Register */
303#define SPRN_ICMP 0x3D5 /* Instruction TLB Compare Register */
304#define SPRN_ICTC 0x3FB /* Instruction Cache Throttling Control Reg */
305#define SPRN_ICTRL 0x3F3 /* 1011 7450 icache and interrupt ctrl */
306#define ICTRL_EICE 0x08000000 /* enable icache parity errs */
307#define ICTRL_EDC 0x04000000 /* enable dcache parity errs */
308#define ICTRL_EICP 0x00000100 /* enable icache par. check */
309#define SPRN_IMISS 0x3D4 /* Instruction TLB Miss Register */
310#define SPRN_IMMR 0x27E /* Internal Memory Map Register */
311#define SPRN_L2CR 0x3F9 /* Level 2 Cache Control Regsiter */
312#define SPRN_L2CR2 0x3f8
313#define L2CR_L2E 0x80000000 /* L2 enable */
314#define L2CR_L2PE 0x40000000 /* L2 parity enable */
315#define L2CR_L2SIZ_MASK 0x30000000 /* L2 size mask */
316#define L2CR_L2SIZ_256KB 0x10000000 /* L2 size 256KB */
317#define L2CR_L2SIZ_512KB 0x20000000 /* L2 size 512KB */
318#define L2CR_L2SIZ_1MB 0x30000000 /* L2 size 1MB */
319#define L2CR_L2CLK_MASK 0x0e000000 /* L2 clock mask */
320#define L2CR_L2CLK_DISABLED 0x00000000 /* L2 clock disabled */
321#define L2CR_L2CLK_DIV1 0x02000000 /* L2 clock / 1 */
322#define L2CR_L2CLK_DIV1_5 0x04000000 /* L2 clock / 1.5 */
323#define L2CR_L2CLK_DIV2 0x08000000 /* L2 clock / 2 */
324#define L2CR_L2CLK_DIV2_5 0x0a000000 /* L2 clock / 2.5 */
325#define L2CR_L2CLK_DIV3 0x0c000000 /* L2 clock / 3 */
326#define L2CR_L2RAM_MASK 0x01800000 /* L2 RAM type mask */
327#define L2CR_L2RAM_FLOW 0x00000000 /* L2 RAM flow through */
328#define L2CR_L2RAM_PIPE 0x01000000 /* L2 RAM pipelined */
329#define L2CR_L2RAM_PIPE_LW 0x01800000 /* L2 RAM pipelined latewr */
330#define L2CR_L2DO 0x00400000 /* L2 data only */
331#define L2CR_L2I 0x00200000 /* L2 global invalidate */
332#define L2CR_L2CTL 0x00100000 /* L2 RAM control */
333#define L2CR_L2WT 0x00080000 /* L2 write-through */
334#define L2CR_L2TS 0x00040000 /* L2 test support */
335#define L2CR_L2OH_MASK 0x00030000 /* L2 output hold mask */
336#define L2CR_L2OH_0_5 0x00000000 /* L2 output hold 0.5 ns */
337#define L2CR_L2OH_1_0 0x00010000 /* L2 output hold 1.0 ns */
338#define L2CR_L2SL 0x00008000 /* L2 DLL slow */
339#define L2CR_L2DF 0x00004000 /* L2 differential clock */
340#define L2CR_L2BYP 0x00002000 /* L2 DLL bypass */
341#define L2CR_L2IP 0x00000001 /* L2 GI in progress */
342#define L2CR_L2IO_745x 0x00100000 /* L2 instr. only (745x) */
343#define L2CR_L2DO_745x 0x00010000 /* L2 data only (745x) */
344#define L2CR_L2REP_745x 0x00001000 /* L2 repl. algorithm (745x) */
345#define L2CR_L2HWF_745x 0x00000800 /* L2 hardware flush (745x) */
346#define SPRN_L3CR 0x3FA /* Level 3 Cache Control Regsiter */
347#define L3CR_L3E 0x80000000 /* L3 enable */
348#define L3CR_L3PE 0x40000000 /* L3 data parity enable */
349#define L3CR_L3APE 0x20000000 /* L3 addr parity enable */
350#define L3CR_L3SIZ 0x10000000 /* L3 size */
351#define L3CR_L3CLKEN 0x08000000 /* L3 clock enable */
352#define L3CR_L3RES 0x04000000 /* L3 special reserved bit */
353#define L3CR_L3CLKDIV 0x03800000 /* L3 clock divisor */
354#define L3CR_L3IO 0x00400000 /* L3 instruction only */
355#define L3CR_L3SPO 0x00040000 /* L3 sample point override */
356#define L3CR_L3CKSP 0x00030000 /* L3 clock sample point */
357#define L3CR_L3PSP 0x0000e000 /* L3 P-clock sample point */
358#define L3CR_L3REP 0x00001000 /* L3 replacement algorithm */
359#define L3CR_L3HWF 0x00000800 /* L3 hardware flush */
360#define L3CR_L3I 0x00000400 /* L3 global invalidate */
361#define L3CR_L3RT 0x00000300 /* L3 SRAM type */
362#define L3CR_L3NIRCA 0x00000080 /* L3 non-integer ratio clock adj. */
363#define L3CR_L3DO 0x00000040 /* L3 data only mode */
364#define L3CR_PMEN 0x00000004 /* L3 private memory enable */
365#define L3CR_PMSIZ 0x00000001 /* L3 private memory size */
366
367#define SPRN_MSSCR0 0x3f6 /* Memory Subsystem Control Register 0 */
368#define SPRN_MSSSR0 0x3f7 /* Memory Subsystem Status Register 1 */
369#define SPRN_LDSTCR 0x3f8 /* Load/Store control register */
370#define SPRN_LDSTDB 0x3f4 /* */
371#define SPRN_LR 0x008 /* Link Register */
372#ifndef SPRN_PIR
373#define SPRN_PIR 0x3FF /* Processor Identification Register */
374#endif
375#define SPRN_PTEHI 0x3D5 /* 981 7450 PTE HI word (S/W TLB load) */
376#define SPRN_PTELO 0x3D6 /* 982 7450 PTE LO word (S/W TLB load) */
377#define SPRN_PURR 0x135 /* Processor Utilization of Resources Reg */
378#define SPRN_PVR 0x11F /* Processor Version Register */
379#define SPRN_RPA 0x3D6 /* Required Physical Address Register */
380#define SPRN_SDA 0x3BF /* Sampled Data Address Register */
381#define SPRN_SDR1 0x019 /* MMU Hash Base Register */
382#define SPRN_ASR 0x118 /* Address Space Register */
383#define SPRN_SIA 0x3BB /* Sampled Instruction Address Register */
384#define SPRN_SPRG0 0x110 /* Special Purpose Register General 0 */
385#define SPRN_SPRG1 0x111 /* Special Purpose Register General 1 */
386#define SPRN_SPRG2 0x112 /* Special Purpose Register General 2 */
387#define SPRN_SPRG3 0x113 /* Special Purpose Register General 3 */
388#define SPRN_SPRG4 0x114 /* Special Purpose Register General 4 */
389#define SPRN_SPRG5 0x115 /* Special Purpose Register General 5 */
390#define SPRN_SPRG6 0x116 /* Special Purpose Register General 6 */
391#define SPRN_SPRG7 0x117 /* Special Purpose Register General 7 */
392#define SPRN_SRR0 0x01A /* Save/Restore Register 0 */
393#define SPRN_SRR1 0x01B /* Save/Restore Register 1 */
394#define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */
395#define SRR1_WAKERESET 0x00380000 /* System reset */
396#define SRR1_WAKESYSERR 0x00300000 /* System error */
397#define SRR1_WAKEEE 0x00200000 /* External interrupt */
398#define SRR1_WAKEMT 0x00280000 /* mtctrl */
399#define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */
400#define SRR1_WAKETHERM 0x00100000 /* Thermal management interrupt */
401#define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */
402#define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */
403
404#define SPRN_TBCTL 0x35f /* PA6T Timebase control register */
405#define TBCTL_FREEZE 0x0000000000000000ull /* Freeze all tbs */
406#define TBCTL_RESTART 0x0000000100000000ull /* Restart all tbs */
407#define TBCTL_UPDATE_UPPER 0x0000000200000000ull /* Set upper 32 bits */
408#define TBCTL_UPDATE_LOWER 0x0000000300000000ull /* Set lower 32 bits */
409
410#ifndef SPRN_SVR
411#define SPRN_SVR 0x11E /* System Version Register */
412#endif
413#define SPRN_THRM1 0x3FC /* Thermal Management Register 1 */
414/* these bits were defined in inverted endian sense originally, ugh, confusing */
415#define THRM1_TIN (1 << 31)
416#define THRM1_TIV (1 << 30)
417#define THRM1_THRES(x) ((x&0x7f)<<23)
418#define THRM3_SITV(x) ((x&0x3fff)<<1)
419#define THRM1_TID (1<<2)
420#define THRM1_TIE (1<<1)
421#define THRM1_V (1<<0)
422#define SPRN_THRM2 0x3FD /* Thermal Management Register 2 */
423#define SPRN_THRM3 0x3FE /* Thermal Management Register 3 */
424#define THRM3_E (1<<0)
425#define SPRN_TLBMISS 0x3D4 /* 980 7450 TLB Miss Register */
426#define SPRN_UMMCR0 0x3A8 /* User Monitor Mode Control Register 0 */
427#define SPRN_UMMCR1 0x3AC /* User Monitor Mode Control Register 0 */
428#define SPRN_UPMC1 0x3A9 /* User Performance Counter Register 1 */
429#define SPRN_UPMC2 0x3AA /* User Performance Counter Register 2 */
430#define SPRN_UPMC3 0x3AD /* User Performance Counter Register 3 */
431#define SPRN_UPMC4 0x3AE /* User Performance Counter Register 4 */
432#define SPRN_USIA 0x3AB /* User Sampled Instruction Address Register */
433#define SPRN_VRSAVE 0x100 /* Vector Register Save Register */
434#define SPRN_XER 0x001 /* Fixed Point Exception Register */
435
436#define SPRN_SCOMC 0x114 /* SCOM Access Control */
437#define SPRN_SCOMD 0x115 /* SCOM Access DATA */
438
439/* Performance monitor SPRs */
440#ifdef CONFIG_PPC64
441#define SPRN_MMCR0 795
442#define MMCR0_FC 0x80000000UL /* freeze counters */
443#define MMCR0_FCS 0x40000000UL /* freeze in supervisor state */
444#define MMCR0_KERNEL_DISABLE MMCR0_FCS
445#define MMCR0_FCP 0x20000000UL /* freeze in problem state */
446#define MMCR0_PROBLEM_DISABLE MMCR0_FCP
447#define MMCR0_FCM1 0x10000000UL /* freeze counters while MSR mark = 1 */
448#define MMCR0_FCM0 0x08000000UL /* freeze counters while MSR mark = 0 */
449#define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */
450#define MMCR0_FCECE 0x02000000UL /* freeze ctrs on enabled cond or event */
451#define MMCR0_TBEE 0x00400000UL /* time base exception enable */
452#define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/
453#define MMCR0_PMCjCE 0x00004000UL /* PMCj count enable*/
454#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */
455#define MMCR0_PMAO 0x00000080UL /* performance monitor alert has occurred, set to 0 after handling exception */
456#define MMCR0_SHRFC 0x00000040UL /* SHRre freeze conditions between threads */
457#define MMCR0_FCTI 0x00000008UL /* freeze counters in tags inactive mode */
458#define MMCR0_FCTA 0x00000004UL /* freeze counters in tags active mode */
459#define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */
460#define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */
461#define SPRN_MMCR1 798
462#define SPRN_MMCRA 0x312
463#define MMCRA_SIHV 0x10000000UL /* state of MSR HV when SIAR set */
464#define MMCRA_SIPR 0x08000000UL /* state of MSR PR when SIAR set */
465#define MMCRA_SLOT 0x07000000UL /* SLOT bits (37-39) */
466#define MMCRA_SLOT_SHIFT 24
467#define MMCRA_SAMPLE_ENABLE 0x00000001UL /* enable sampling */
468#define POWER6_MMCRA_SIHV 0x0000040000000000ULL
469#define POWER6_MMCRA_SIPR 0x0000020000000000ULL
470#define POWER6_MMCRA_THRM 0x00000020UL
471#define POWER6_MMCRA_OTHER 0x0000000EUL
472#define SPRN_PMC1 787
473#define SPRN_PMC2 788
474#define SPRN_PMC3 789
475#define SPRN_PMC4 790
476#define SPRN_PMC5 791
477#define SPRN_PMC6 792
478#define SPRN_PMC7 793
479#define SPRN_PMC8 794
480#define SPRN_SIAR 780
481#define SPRN_SDAR 781
482
483#define SPRN_PA6T_MMCR0 795
484#define PA6T_MMCR0_EN0 0x0000000000000001UL
485#define PA6T_MMCR0_EN1 0x0000000000000002UL
486#define PA6T_MMCR0_EN2 0x0000000000000004UL
487#define PA6T_MMCR0_EN3 0x0000000000000008UL
488#define PA6T_MMCR0_EN4 0x0000000000000010UL
489#define PA6T_MMCR0_EN5 0x0000000000000020UL
490#define PA6T_MMCR0_SUPEN 0x0000000000000040UL
491#define PA6T_MMCR0_PREN 0x0000000000000080UL
492#define PA6T_MMCR0_HYPEN 0x0000000000000100UL
493#define PA6T_MMCR0_FCM0 0x0000000000000200UL
494#define PA6T_MMCR0_FCM1 0x0000000000000400UL
495#define PA6T_MMCR0_INTGEN 0x0000000000000800UL
496#define PA6T_MMCR0_INTEN0 0x0000000000001000UL
497#define PA6T_MMCR0_INTEN1 0x0000000000002000UL
498#define PA6T_MMCR0_INTEN2 0x0000000000004000UL
499#define PA6T_MMCR0_INTEN3 0x0000000000008000UL
500#define PA6T_MMCR0_INTEN4 0x0000000000010000UL
501#define PA6T_MMCR0_INTEN5 0x0000000000020000UL
502#define PA6T_MMCR0_DISCNT 0x0000000000040000UL
503#define PA6T_MMCR0_UOP 0x0000000000080000UL
504#define PA6T_MMCR0_TRG 0x0000000000100000UL
505#define PA6T_MMCR0_TRGEN 0x0000000000200000UL
506#define PA6T_MMCR0_TRGREG 0x0000000001600000UL
507#define PA6T_MMCR0_SIARLOG 0x0000000002000000UL
508#define PA6T_MMCR0_SDARLOG 0x0000000004000000UL
509#define PA6T_MMCR0_PROEN 0x0000000008000000UL
510#define PA6T_MMCR0_PROLOG 0x0000000010000000UL
511#define PA6T_MMCR0_DAMEN2 0x0000000020000000UL
512#define PA6T_MMCR0_DAMEN3 0x0000000040000000UL
513#define PA6T_MMCR0_DAMEN4 0x0000000080000000UL
514#define PA6T_MMCR0_DAMEN5 0x0000000100000000UL
515#define PA6T_MMCR0_DAMSEL2 0x0000000200000000UL
516#define PA6T_MMCR0_DAMSEL3 0x0000000400000000UL
517#define PA6T_MMCR0_DAMSEL4 0x0000000800000000UL
518#define PA6T_MMCR0_DAMSEL5 0x0000001000000000UL
519#define PA6T_MMCR0_HANDDIS 0x0000002000000000UL
520#define PA6T_MMCR0_PCTEN 0x0000004000000000UL
521#define PA6T_MMCR0_SOCEN 0x0000008000000000UL
522#define PA6T_MMCR0_SOCMOD 0x0000010000000000UL
523
524#define SPRN_PA6T_MMCR1 798
525#define PA6T_MMCR1_ES2 0x00000000000000ffUL
526#define PA6T_MMCR1_ES3 0x000000000000ff00UL
527#define PA6T_MMCR1_ES4 0x0000000000ff0000UL
528#define PA6T_MMCR1_ES5 0x00000000ff000000UL
529
530#define SPRN_PA6T_UPMC0 771 /* User PerfMon Counter 0 */
531#define SPRN_PA6T_UPMC1 772 /* ... */
532#define SPRN_PA6T_UPMC2 773
533#define SPRN_PA6T_UPMC3 774
534#define SPRN_PA6T_UPMC4 775
535#define SPRN_PA6T_UPMC5 776
536#define SPRN_PA6T_UMMCR0 779 /* User Monitor Mode Control Register 0 */
537#define SPRN_PA6T_SIAR 780 /* Sampled Instruction Address */
538#define SPRN_PA6T_UMMCR1 782 /* User Monitor Mode Control Register 1 */
539#define SPRN_PA6T_SIER 785 /* Sampled Instruction Event Register */
540#define SPRN_PA6T_PMC0 787
541#define SPRN_PA6T_PMC1 788
542#define SPRN_PA6T_PMC2 789
543#define SPRN_PA6T_PMC3 790
544#define SPRN_PA6T_PMC4 791
545#define SPRN_PA6T_PMC5 792
546#define SPRN_PA6T_TSR0 793 /* Timestamp Register 0 */
547#define SPRN_PA6T_TSR1 794 /* Timestamp Register 1 */
548#define SPRN_PA6T_TSR2 799 /* Timestamp Register 2 */
549#define SPRN_PA6T_TSR3 784 /* Timestamp Register 3 */
550
551#define SPRN_PA6T_IER 981 /* Icache Error Register */
552#define SPRN_PA6T_DER 982 /* Dcache Error Register */
553#define SPRN_PA6T_BER 862 /* BIU Error Address Register */
554#define SPRN_PA6T_MER 849 /* MMU Error Register */
555
556#define SPRN_PA6T_IMA0 880 /* Instruction Match Array 0 */
557#define SPRN_PA6T_IMA1 881 /* ... */
558#define SPRN_PA6T_IMA2 882
559#define SPRN_PA6T_IMA3 883
560#define SPRN_PA6T_IMA4 884
561#define SPRN_PA6T_IMA5 885
562#define SPRN_PA6T_IMA6 886
563#define SPRN_PA6T_IMA7 887
564#define SPRN_PA6T_IMA8 888
565#define SPRN_PA6T_IMA9 889
566#define SPRN_PA6T_BTCR 978 /* Breakpoint and Tagging Control Register */
567#define SPRN_PA6T_IMAAT 979 /* Instruction Match Array Action Table */
568#define SPRN_PA6T_PCCR 1019 /* Power Counter Control Register */
569#define SPRN_BKMK 1020 /* Cell Bookmark Register */
570#define SPRN_PA6T_RPCCR 1021 /* Retire PC Trace Control Register */
571
572
573#else /* 32-bit */
574#define SPRN_MMCR0 952 /* Monitor Mode Control Register 0 */
575#define MMCR0_FC 0x80000000UL /* freeze counters */
576#define MMCR0_FCS 0x40000000UL /* freeze in supervisor state */
577#define MMCR0_FCP 0x20000000UL /* freeze in problem state */
578#define MMCR0_FCM1 0x10000000UL /* freeze counters while MSR mark = 1 */
579#define MMCR0_FCM0 0x08000000UL /* freeze counters while MSR mark = 0 */
580#define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */
581#define MMCR0_FCECE 0x02000000UL /* freeze ctrs on enabled cond or event */
582#define MMCR0_TBEE 0x00400000UL /* time base exception enable */
583#define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/
584#define MMCR0_PMCnCE 0x00004000UL /* count enable for all but PMC 1*/
585#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */
586#define MMCR0_PMC1SEL 0x00001fc0UL /* PMC 1 Event */
587#define MMCR0_PMC2SEL 0x0000003fUL /* PMC 2 Event */
588
589#define SPRN_MMCR1 956
590#define MMCR1_PMC3SEL 0xf8000000UL /* PMC 3 Event */
591#define MMCR1_PMC4SEL 0x07c00000UL /* PMC 4 Event */
592#define MMCR1_PMC5SEL 0x003e0000UL /* PMC 5 Event */
593#define MMCR1_PMC6SEL 0x0001f800UL /* PMC 6 Event */
594#define SPRN_MMCR2 944
595#define SPRN_PMC1 953 /* Performance Counter Register 1 */
596#define SPRN_PMC2 954 /* Performance Counter Register 2 */
597#define SPRN_PMC3 957 /* Performance Counter Register 3 */
598#define SPRN_PMC4 958 /* Performance Counter Register 4 */
599#define SPRN_PMC5 945 /* Performance Counter Register 5 */
600#define SPRN_PMC6 946 /* Performance Counter Register 6 */
601
602#define SPRN_SIAR 955 /* Sampled Instruction Address Register */
603
604/* Bit definitions for MMCR0 and PMC1 / PMC2. */
605#define MMCR0_PMC1_CYCLES (1 << 7)
606#define MMCR0_PMC1_ICACHEMISS (5 << 7)
607#define MMCR0_PMC1_DTLB (6 << 7)
608#define MMCR0_PMC2_DCACHEMISS 0x6
609#define MMCR0_PMC2_CYCLES 0x1
610#define MMCR0_PMC2_ITLB 0x7
611#define MMCR0_PMC2_LOADMISSTIME 0x5
612#endif
613
614/*
615 * An mtfsf instruction with the L bit set. On CPUs that support this a
616 * full 64bits of FPSCR is restored and on other CPUs the L bit is ignored.
617 *
618 * Until binutils gets the new form of mtfsf, hardwire the instruction.
619 */
620#ifdef CONFIG_PPC64
621#define MTFSF_L(REG) \
622 .long (0xfc00058e | ((0xff) << 17) | ((REG) << 11) | (1 << 25))
623#else
624#define MTFSF_L(REG) mtfsf 0xff, (REG)
625#endif
626
627/* Processor Version Register (PVR) field extraction */
628
629#define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */
630#define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */
631
632#define __is_processor(pv) (PVR_VER(mfspr(SPRN_PVR)) == (pv))
633
634/*
635 * IBM has further subdivided the standard PowerPC 16-bit version and
636 * revision subfields of the PVR for the PowerPC 403s into the following:
637 */
638
639#define PVR_FAM(pvr) (((pvr) >> 20) & 0xFFF) /* Family field */
640#define PVR_MEM(pvr) (((pvr) >> 16) & 0xF) /* Member field */
641#define PVR_CORE(pvr) (((pvr) >> 12) & 0xF) /* Core field */
642#define PVR_CFG(pvr) (((pvr) >> 8) & 0xF) /* Configuration field */
643#define PVR_MAJ(pvr) (((pvr) >> 4) & 0xF) /* Major revision field */
644#define PVR_MIN(pvr) (((pvr) >> 0) & 0xF) /* Minor revision field */
645
646/* Processor Version Numbers */
647
648#define PVR_403GA 0x00200000
649#define PVR_403GB 0x00200100
650#define PVR_403GC 0x00200200
651#define PVR_403GCX 0x00201400
652#define PVR_405GP 0x40110000
653#define PVR_STB03XXX 0x40310000
654#define PVR_NP405H 0x41410000
655#define PVR_NP405L 0x41610000
656#define PVR_601 0x00010000
657#define PVR_602 0x00050000
658#define PVR_603 0x00030000
659#define PVR_603e 0x00060000
660#define PVR_603ev 0x00070000
661#define PVR_603r 0x00071000
662#define PVR_604 0x00040000
663#define PVR_604e 0x00090000
664#define PVR_604r 0x000A0000
665#define PVR_620 0x00140000
666#define PVR_740 0x00080000
667#define PVR_750 PVR_740
668#define PVR_740P 0x10080000
669#define PVR_750P PVR_740P
670#define PVR_7400 0x000C0000
671#define PVR_7410 0x800C0000
672#define PVR_7450 0x80000000
673#define PVR_8540 0x80200000
674#define PVR_8560 0x80200000
675/*
676 * For the 8xx processors, all of them report the same PVR family for
677 * the PowerPC core. The various versions of these processors must be
678 * differentiated by the version number in the Communication Processor
679 * Module (CPM).
680 */
681#define PVR_821 0x00500000
682#define PVR_823 PVR_821
683#define PVR_850 PVR_821
684#define PVR_860 PVR_821
685#define PVR_8240 0x00810100
686#define PVR_8245 0x80811014
687#define PVR_8260 PVR_8240
688
689/* 64-bit processors */
690/* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */
691#define PV_NORTHSTAR 0x0033
692#define PV_PULSAR 0x0034
693#define PV_POWER4 0x0035
694#define PV_ICESTAR 0x0036
695#define PV_SSTAR 0x0037
696#define PV_POWER4p 0x0038
697#define PV_970 0x0039
698#define PV_POWER5 0x003A
699#define PV_POWER5p 0x003B
700#define PV_970FX 0x003C
701#define PV_630 0x0040
702#define PV_630p 0x0041
703#define PV_970MP 0x0044
704#define PV_970GX 0x0045
705#define PV_BE 0x0070
706#define PV_PA6T 0x0090
707
708/* Macros for setting and retrieving special purpose registers */
709#ifndef __ASSEMBLY__
710#define mfmsr() ({unsigned long rval; \
711 asm volatile("mfmsr %0" : "=r" (rval)); rval;})
712#ifdef CONFIG_PPC64
713#define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \
714 : : "r" (v))
715#define mtmsrd(v) __mtmsrd((v), 0)
716#define mtmsr(v) mtmsrd(v)
717#else
718#define mtmsr(v) asm volatile("mtmsr %0" : : "r" (v))
719#endif
720
721#define mfspr(rn) ({unsigned long rval; \
722 asm volatile("mfspr %0," __stringify(rn) \
723 : "=r" (rval)); rval;})
724#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))
725
726#ifdef __powerpc64__
727#ifdef CONFIG_PPC_CELL
728#define mftb() ({unsigned long rval; \
729 asm volatile( \
730 "90: mftb %0;\n" \
731 "97: cmpwi %0,0;\n" \
732 " beq- 90b;\n" \
733 "99:\n" \
734 ".section __ftr_fixup,\"a\"\n" \
735 ".align 3\n" \
736 "98:\n" \
737 " .llong %1\n" \
738 " .llong %1\n" \
739 " .llong 97b-98b\n" \
740 " .llong 99b-98b\n" \
741 " .llong 0\n" \
742 " .llong 0\n" \
743 ".previous" \
744 : "=r" (rval) : "i" (CPU_FTR_CELL_TB_BUG)); rval;})
745#else
746#define mftb() ({unsigned long rval; \
747 asm volatile("mftb %0" : "=r" (rval)); rval;})
748#endif /* !CONFIG_PPC_CELL */
749
750#else /* __powerpc64__ */
751
752#define mftbl() ({unsigned long rval; \
753 asm volatile("mftbl %0" : "=r" (rval)); rval;})
754#define mftbu() ({unsigned long rval; \
755 asm volatile("mftbu %0" : "=r" (rval)); rval;})
756#endif /* !__powerpc64__ */
757
758#define mttbl(v) asm volatile("mttbl %0":: "r"(v))
759#define mttbu(v) asm volatile("mttbu %0":: "r"(v))
760
761#ifdef CONFIG_PPC32
762#define mfsrin(v) ({unsigned int rval; \
763 asm volatile("mfsrin %0,%1" : "=r" (rval) : "r" (v)); \
764 rval;})
765#endif
766
767#define proc_trap() asm volatile("trap")
768
769#ifdef CONFIG_PPC64
770
771extern void ppc64_runlatch_on(void);
772extern void ppc64_runlatch_off(void);
773
774extern unsigned long scom970_read(unsigned int address);
775extern void scom970_write(unsigned int address, unsigned long value);
776
777#else
778#define ppc64_runlatch_on()
779#define ppc64_runlatch_off()
780
781#endif /* CONFIG_PPC64 */
782
783#define __get_SP() ({unsigned long sp; \
784 asm volatile("mr %0,1": "=r" (sp)); sp;})
785
786#endif /* __ASSEMBLY__ */
787#endif /* __KERNEL__ */
788#endif /* _ASM_POWERPC_REG_H */
diff --git a/arch/powerpc/include/asm/reg_8xx.h b/arch/powerpc/include/asm/reg_8xx.h
new file mode 100644
index 000000000000..e8ea346b21d3
--- /dev/null
+++ b/arch/powerpc/include/asm/reg_8xx.h
@@ -0,0 +1,42 @@
1/*
2 * Contains register definitions common to PowerPC 8xx CPUs. Notice
3 */
4#ifndef _ASM_POWERPC_REG_8xx_H
5#define _ASM_POWERPC_REG_8xx_H
6
7/* Cache control on the MPC8xx is provided through some additional
8 * special purpose registers.
9 */
10#define SPRN_IC_CST 560 /* Instruction cache control/status */
11#define SPRN_IC_ADR 561 /* Address needed for some commands */
12#define SPRN_IC_DAT 562 /* Read-only data register */
13#define SPRN_DC_CST 568 /* Data cache control/status */
14#define SPRN_DC_ADR 569 /* Address needed for some commands */
15#define SPRN_DC_DAT 570 /* Read-only data register */
16
17/* Commands. Only the first few are available to the instruction cache.
18*/
19#define IDC_ENABLE 0x02000000 /* Cache enable */
20#define IDC_DISABLE 0x04000000 /* Cache disable */
21#define IDC_LDLCK 0x06000000 /* Load and lock */
22#define IDC_UNLINE 0x08000000 /* Unlock line */
23#define IDC_UNALL 0x0a000000 /* Unlock all */
24#define IDC_INVALL 0x0c000000 /* Invalidate all */
25
26#define DC_FLINE 0x0e000000 /* Flush data cache line */
27#define DC_SFWT 0x01000000 /* Set forced writethrough mode */
28#define DC_CFWT 0x03000000 /* Clear forced writethrough mode */
29#define DC_SLES 0x05000000 /* Set little endian swap mode */
30#define DC_CLES 0x07000000 /* Clear little endian swap mode */
31
32/* Status.
33*/
34#define IDC_ENABLED 0x80000000 /* Cache is enabled */
35#define IDC_CERR1 0x00200000 /* Cache error 1 */
36#define IDC_CERR2 0x00100000 /* Cache error 2 */
37#define IDC_CERR3 0x00080000 /* Cache error 3 */
38
39#define DC_DFWT 0x40000000 /* Data cache is forced write through */
40#define DC_LES 0x20000000 /* Caches are little endian mode */
41
42#endif /* _ASM_POWERPC_REG_8xx_H */
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
new file mode 100644
index 000000000000..be980f4ee495
--- /dev/null
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -0,0 +1,501 @@
1/*
2 * Contains register definitions common to the Book E PowerPC
3 * specification. Notice that while the IBM-40x series of CPUs
4 * are not true Book E PowerPCs, they borrowed a number of features
5 * before Book E was finalized, and are included here as well. Unfortunatly,
6 * they sometimes used different locations than true Book E CPUs did.
7 */
8#ifdef __KERNEL__
9#ifndef __ASM_POWERPC_REG_BOOKE_H__
10#define __ASM_POWERPC_REG_BOOKE_H__
11
12/* Machine State Register (MSR) Fields */
13#define MSR_UCLE (1<<26) /* User-mode cache lock enable */
14#define MSR_SPE (1<<25) /* Enable SPE */
15#define MSR_DWE (1<<10) /* Debug Wait Enable */
16#define MSR_UBLE (1<<10) /* BTB lock enable (e500) */
17#define MSR_IS MSR_IR /* Instruction Space */
18#define MSR_DS MSR_DR /* Data Space */
19#define MSR_PMM (1<<2) /* Performance monitor mark bit */
20
21/* Default MSR for kernel mode. */
22#if defined (CONFIG_40x)
23#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE)
24#elif defined(CONFIG_BOOKE)
25#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_CE)
26#endif
27
28/* Special Purpose Registers (SPRNs)*/
29#define SPRN_DECAR 0x036 /* Decrementer Auto Reload Register */
30#define SPRN_IVPR 0x03F /* Interrupt Vector Prefix Register */
31#define SPRN_USPRG0 0x100 /* User Special Purpose Register General 0 */
32#define SPRN_SPRG4R 0x104 /* Special Purpose Register General 4 Read */
33#define SPRN_SPRG5R 0x105 /* Special Purpose Register General 5 Read */
34#define SPRN_SPRG6R 0x106 /* Special Purpose Register General 6 Read */
35#define SPRN_SPRG7R 0x107 /* Special Purpose Register General 7 Read */
36#define SPRN_SPRG4W 0x114 /* Special Purpose Register General 4 Write */
37#define SPRN_SPRG5W 0x115 /* Special Purpose Register General 5 Write */
38#define SPRN_SPRG6W 0x116 /* Special Purpose Register General 6 Write */
39#define SPRN_SPRG7W 0x117 /* Special Purpose Register General 7 Write */
40#define SPRN_DBCR2 0x136 /* Debug Control Register 2 */
41#define SPRN_IAC3 0x13A /* Instruction Address Compare 3 */
42#define SPRN_IAC4 0x13B /* Instruction Address Compare 4 */
43#define SPRN_DVC1 0x13E /* Data Value Compare Register 1 */
44#define SPRN_DVC2 0x13F /* Data Value Compare Register 2 */
45#define SPRN_IVOR0 0x190 /* Interrupt Vector Offset Register 0 */
46#define SPRN_IVOR1 0x191 /* Interrupt Vector Offset Register 1 */
47#define SPRN_IVOR2 0x192 /* Interrupt Vector Offset Register 2 */
48#define SPRN_IVOR3 0x193 /* Interrupt Vector Offset Register 3 */
49#define SPRN_IVOR4 0x194 /* Interrupt Vector Offset Register 4 */
50#define SPRN_IVOR5 0x195 /* Interrupt Vector Offset Register 5 */
51#define SPRN_IVOR6 0x196 /* Interrupt Vector Offset Register 6 */
52#define SPRN_IVOR7 0x197 /* Interrupt Vector Offset Register 7 */
53#define SPRN_IVOR8 0x198 /* Interrupt Vector Offset Register 8 */
54#define SPRN_IVOR9 0x199 /* Interrupt Vector Offset Register 9 */
55#define SPRN_IVOR10 0x19A /* Interrupt Vector Offset Register 10 */
56#define SPRN_IVOR11 0x19B /* Interrupt Vector Offset Register 11 */
57#define SPRN_IVOR12 0x19C /* Interrupt Vector Offset Register 12 */
58#define SPRN_IVOR13 0x19D /* Interrupt Vector Offset Register 13 */
59#define SPRN_IVOR14 0x19E /* Interrupt Vector Offset Register 14 */
60#define SPRN_IVOR15 0x19F /* Interrupt Vector Offset Register 15 */
61#define SPRN_SPEFSCR 0x200 /* SPE & Embedded FP Status & Control */
62#define SPRN_BBEAR 0x201 /* Branch Buffer Entry Address Register */
63#define SPRN_BBTAR 0x202 /* Branch Buffer Target Address Register */
64#define SPRN_L1CFG0 0x203 /* L1 Cache Configure Register 0 */
65#define SPRN_L1CFG1 0x204 /* L1 Cache Configure Register 1 */
66#define SPRN_ATB 0x20E /* Alternate Time Base */
67#define SPRN_ATBL 0x20E /* Alternate Time Base Lower */
68#define SPRN_ATBU 0x20F /* Alternate Time Base Upper */
69#define SPRN_IVOR32 0x210 /* Interrupt Vector Offset Register 32 */
70#define SPRN_IVOR33 0x211 /* Interrupt Vector Offset Register 33 */
71#define SPRN_IVOR34 0x212 /* Interrupt Vector Offset Register 34 */
72#define SPRN_IVOR35 0x213 /* Interrupt Vector Offset Register 35 */
73#define SPRN_IVOR36 0x214 /* Interrupt Vector Offset Register 36 */
74#define SPRN_IVOR37 0x215 /* Interrupt Vector Offset Register 37 */
75#define SPRN_MCSRR0 0x23A /* Machine Check Save and Restore Register 0 */
76#define SPRN_MCSRR1 0x23B /* Machine Check Save and Restore Register 1 */
77#define SPRN_MCSR 0x23C /* Machine Check Status Register */
78#define SPRN_MCAR 0x23D /* Machine Check Address Register */
79#define SPRN_DSRR0 0x23E /* Debug Save and Restore Register 0 */
80#define SPRN_DSRR1 0x23F /* Debug Save and Restore Register 1 */
81#define SPRN_SPRG8 0x25C /* Special Purpose Register General 8 */
82#define SPRN_SPRG9 0x25D /* Special Purpose Register General 9 */
83#define SPRN_L1CSR2 0x25E /* L1 Cache Control and Status Register 2 */
84#define SPRN_MAS0 0x270 /* MMU Assist Register 0 */
85#define SPRN_MAS1 0x271 /* MMU Assist Register 1 */
86#define SPRN_MAS2 0x272 /* MMU Assist Register 2 */
87#define SPRN_MAS3 0x273 /* MMU Assist Register 3 */
88#define SPRN_MAS4 0x274 /* MMU Assist Register 4 */
89#define SPRN_MAS5 0x275 /* MMU Assist Register 5 */
90#define SPRN_MAS6 0x276 /* MMU Assist Register 6 */
91#define SPRN_PID1 0x279 /* Process ID Register 1 */
92#define SPRN_PID2 0x27A /* Process ID Register 2 */
93#define SPRN_TLB0CFG 0x2B0 /* TLB 0 Config Register */
94#define SPRN_TLB1CFG 0x2B1 /* TLB 1 Config Register */
95#define SPRN_EPR 0x2BE /* External Proxy Register */
96#define SPRN_CCR1 0x378 /* Core Configuration Register 1 */
97#define SPRN_ZPR 0x3B0 /* Zone Protection Register (40x) */
98#define SPRN_MAS7 0x3B0 /* MMU Assist Register 7 */
99#define SPRN_MMUCR 0x3B2 /* MMU Control Register */
100#define SPRN_CCR0 0x3B3 /* Core Configuration Register 0 */
101#define SPRN_EPLC 0x3B3 /* External Process ID Load Context */
102#define SPRN_EPSC 0x3B4 /* External Process ID Store Context */
103#define SPRN_SGR 0x3B9 /* Storage Guarded Register */
104#define SPRN_DCWR 0x3BA /* Data Cache Write-thru Register */
105#define SPRN_SLER 0x3BB /* Little-endian real mode */
106#define SPRN_SU0R 0x3BC /* "User 0" real mode (40x) */
107#define SPRN_DCMP 0x3D1 /* Data TLB Compare Register */
108#define SPRN_ICDBDR 0x3D3 /* Instruction Cache Debug Data Register */
109#define SPRN_EVPR 0x3D6 /* Exception Vector Prefix Register */
110#define SPRN_L1CSR0 0x3F2 /* L1 Cache Control and Status Register 0 */
111#define SPRN_L1CSR1 0x3F3 /* L1 Cache Control and Status Register 1 */
112#define SPRN_PIT 0x3DB /* Programmable Interval Timer */
113#define SPRN_BUCSR 0x3F5 /* Branch Unit Control and Status */
114#define SPRN_L2CSR0 0x3F9 /* L2 Data Cache Control and Status Register 0 */
115#define SPRN_L2CSR1 0x3FA /* L2 Data Cache Control and Status Register 1 */
116#define SPRN_DCCR 0x3FA /* Data Cache Cacheability Register */
117#define SPRN_ICCR 0x3FB /* Instruction Cache Cacheability Register */
118#define SPRN_SVR 0x3FF /* System Version Register */
119
120/*
121 * SPRs which have conflicting definitions on true Book E versus classic,
122 * or IBM 40x.
123 */
124#ifdef CONFIG_BOOKE
125#define SPRN_PID 0x030 /* Process ID */
126#define SPRN_PID0 SPRN_PID/* Process ID Register 0 */
127#define SPRN_CSRR0 0x03A /* Critical Save and Restore Register 0 */
128#define SPRN_CSRR1 0x03B /* Critical Save and Restore Register 1 */
129#define SPRN_DEAR 0x03D /* Data Error Address Register */
130#define SPRN_ESR 0x03E /* Exception Syndrome Register */
131#define SPRN_PIR 0x11E /* Processor Identification Register */
132#define SPRN_DBSR 0x130 /* Debug Status Register */
133#define SPRN_DBCR0 0x134 /* Debug Control Register 0 */
134#define SPRN_DBCR1 0x135 /* Debug Control Register 1 */
135#define SPRN_IAC1 0x138 /* Instruction Address Compare 1 */
136#define SPRN_IAC2 0x139 /* Instruction Address Compare 2 */
137#define SPRN_DAC1 0x13C /* Data Address Compare 1 */
138#define SPRN_DAC2 0x13D /* Data Address Compare 2 */
139#define SPRN_TSR 0x150 /* Timer Status Register */
140#define SPRN_TCR 0x154 /* Timer Control Register */
141#endif /* Book E */
142#ifdef CONFIG_40x
143#define SPRN_PID 0x3B1 /* Process ID */
144#define SPRN_DBCR1 0x3BD /* Debug Control Register 1 */
145#define SPRN_ESR 0x3D4 /* Exception Syndrome Register */
146#define SPRN_DEAR 0x3D5 /* Data Error Address Register */
147#define SPRN_TSR 0x3D8 /* Timer Status Register */
148#define SPRN_TCR 0x3DA /* Timer Control Register */
149#define SPRN_SRR2 0x3DE /* Save/Restore Register 2 */
150#define SPRN_SRR3 0x3DF /* Save/Restore Register 3 */
151#define SPRN_DBSR 0x3F0 /* Debug Status Register */
152#define SPRN_DBCR0 0x3F2 /* Debug Control Register 0 */
153#define SPRN_DAC1 0x3F6 /* Data Address Compare 1 */
154#define SPRN_DAC2 0x3F7 /* Data Address Compare 2 */
155#define SPRN_CSRR0 SPRN_SRR2 /* Critical Save and Restore Register 0 */
156#define SPRN_CSRR1 SPRN_SRR3 /* Critical Save and Restore Register 1 */
157#endif
158
159/* Bit definitions for CCR1. */
160#define CCR1_DPC 0x00000100 /* Disable L1 I-Cache/D-Cache parity checking */
161#define CCR1_TCS 0x00000080 /* Timer Clock Select */
162
163/* Bit definitions for the MCSR. */
164#define MCSR_MCS 0x80000000 /* Machine Check Summary */
165#define MCSR_IB 0x40000000 /* Instruction PLB Error */
166#define MCSR_DRB 0x20000000 /* Data Read PLB Error */
167#define MCSR_DWB 0x10000000 /* Data Write PLB Error */
168#define MCSR_TLBP 0x08000000 /* TLB Parity Error */
169#define MCSR_ICP 0x04000000 /* I-Cache Parity Error */
170#define MCSR_DCSP 0x02000000 /* D-Cache Search Parity Error */
171#define MCSR_DCFP 0x01000000 /* D-Cache Flush Parity Error */
172#define MCSR_IMPE 0x00800000 /* Imprecise Machine Check Exception */
173
174#ifdef CONFIG_E500
175#define MCSR_MCP 0x80000000UL /* Machine Check Input Pin */
176#define MCSR_ICPERR 0x40000000UL /* I-Cache Parity Error */
177#define MCSR_DCP_PERR 0x20000000UL /* D-Cache Push Parity Error */
178#define MCSR_DCPERR 0x10000000UL /* D-Cache Parity Error */
179#define MCSR_BUS_IAERR 0x00000080UL /* Instruction Address Error */
180#define MCSR_BUS_RAERR 0x00000040UL /* Read Address Error */
181#define MCSR_BUS_WAERR 0x00000020UL /* Write Address Error */
182#define MCSR_BUS_IBERR 0x00000010UL /* Instruction Data Error */
183#define MCSR_BUS_RBERR 0x00000008UL /* Read Data Bus Error */
184#define MCSR_BUS_WBERR 0x00000004UL /* Write Data Bus Error */
185#define MCSR_BUS_IPERR 0x00000002UL /* Instruction parity Error */
186#define MCSR_BUS_RPERR 0x00000001UL /* Read parity Error */
187
188/* e500 parts may set unused bits in MCSR; mask these off */
189#define MCSR_MASK (MCSR_MCP | MCSR_ICPERR | MCSR_DCP_PERR | \
190 MCSR_DCPERR | MCSR_BUS_IAERR | MCSR_BUS_RAERR | \
191 MCSR_BUS_WAERR | MCSR_BUS_IBERR | MCSR_BUS_RBERR | \
192 MCSR_BUS_WBERR | MCSR_BUS_IPERR | MCSR_BUS_RPERR)
193#endif
194#ifdef CONFIG_E200
195#define MCSR_MCP 0x80000000UL /* Machine Check Input Pin */
196#define MCSR_CP_PERR 0x20000000UL /* Cache Push Parity Error */
197#define MCSR_CPERR 0x10000000UL /* Cache Parity Error */
198#define MCSR_EXCP_ERR 0x08000000UL /* ISI, ITLB, or Bus Error on 1st insn
199 fetch for an exception handler */
200#define MCSR_BUS_IRERR 0x00000010UL /* Read Bus Error on instruction fetch*/
201#define MCSR_BUS_DRERR 0x00000008UL /* Read Bus Error on data load */
202#define MCSR_BUS_WRERR 0x00000004UL /* Write Bus Error on buffered
203 store or cache line push */
204
205/* e200 parts may set unused bits in MCSR; mask these off */
206#define MCSR_MASK (MCSR_MCP | MCSR_CP_PERR | MCSR_CPERR | \
207 MCSR_EXCP_ERR | MCSR_BUS_IRERR | MCSR_BUS_DRERR | \
208 MCSR_BUS_WRERR)
209#endif
210
211/* Bit definitions for the DBSR. */
212/*
213 * DBSR bits which have conflicting definitions on true Book E versus IBM 40x.
214 */
215#ifdef CONFIG_BOOKE
216#define DBSR_IC 0x08000000 /* Instruction Completion */
217#define DBSR_BT 0x04000000 /* Branch Taken */
218#define DBSR_IRPT 0x02000000 /* Exception Debug Event */
219#define DBSR_TIE 0x01000000 /* Trap Instruction Event */
220#define DBSR_IAC1 0x00800000 /* Instr Address Compare 1 Event */
221#define DBSR_IAC2 0x00400000 /* Instr Address Compare 2 Event */
222#define DBSR_IAC3 0x00200000 /* Instr Address Compare 3 Event */
223#define DBSR_IAC4 0x00100000 /* Instr Address Compare 4 Event */
224#define DBSR_DAC1R 0x00080000 /* Data Addr Compare 1 Read Event */
225#define DBSR_DAC1W 0x00040000 /* Data Addr Compare 1 Write Event */
226#define DBSR_DAC2R 0x00020000 /* Data Addr Compare 2 Read Event */
227#define DBSR_DAC2W 0x00010000 /* Data Addr Compare 2 Write Event */
228#define DBSR_RET 0x00008000 /* Return Debug Event */
229#define DBSR_CIRPT 0x00000040 /* Critical Interrupt Taken Event */
230#define DBSR_CRET 0x00000020 /* Critical Return Debug Event */
231#endif
232#ifdef CONFIG_40x
233#define DBSR_IC 0x80000000 /* Instruction Completion */
234#define DBSR_BT 0x40000000 /* Branch taken */
235#define DBSR_IRPT 0x20000000 /* Exception Debug Event */
236#define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */
237#define DBSR_IAC1 0x04000000 /* Instruction Address Compare 1 Event */
238#define DBSR_IAC2 0x02000000 /* Instruction Address Compare 2 Event */
239#define DBSR_IAC3 0x00080000 /* Instruction Address Compare 3 Event */
240#define DBSR_IAC4 0x00040000 /* Instruction Address Compare 4 Event */
241#define DBSR_DAC1R 0x01000000 /* Data Address Compare 1 Read Event */
242#define DBSR_DAC1W 0x00800000 /* Data Address Compare 1 Write Event */
243#define DBSR_DAC2R 0x00400000 /* Data Address Compare 2 Read Event */
244#define DBSR_DAC2W 0x00200000 /* Data Address Compare 2 Write Event */
245#endif
246
247/* Bit definitions related to the ESR. */
248#define ESR_MCI 0x80000000 /* Machine Check - Instruction */
249#define ESR_IMCP 0x80000000 /* Instr. Machine Check - Protection */
250#define ESR_IMCN 0x40000000 /* Instr. Machine Check - Non-config */
251#define ESR_IMCB 0x20000000 /* Instr. Machine Check - Bus error */
252#define ESR_IMCT 0x10000000 /* Instr. Machine Check - Timeout */
253#define ESR_PIL 0x08000000 /* Program Exception - Illegal */
254#define ESR_PPR 0x04000000 /* Program Exception - Privileged */
255#define ESR_PTR 0x02000000 /* Program Exception - Trap */
256#define ESR_FP 0x01000000 /* Floating Point Operation */
257#define ESR_DST 0x00800000 /* Storage Exception - Data miss */
258#define ESR_DIZ 0x00400000 /* Storage Exception - Zone fault */
259#define ESR_ST 0x00800000 /* Store Operation */
260#define ESR_DLK 0x00200000 /* Data Cache Locking */
261#define ESR_ILK 0x00100000 /* Instr. Cache Locking */
262#define ESR_PUO 0x00040000 /* Unimplemented Operation exception */
263#define ESR_BO 0x00020000 /* Byte Ordering */
264
265/* Bit definitions related to the DBCR0. */
266#if defined(CONFIG_40x)
267#define DBCR0_EDM 0x80000000 /* External Debug Mode */
268#define DBCR0_IDM 0x40000000 /* Internal Debug Mode */
269#define DBCR0_RST 0x30000000 /* all the bits in the RST field */
270#define DBCR0_RST_SYSTEM 0x30000000 /* System Reset */
271#define DBCR0_RST_CHIP 0x20000000 /* Chip Reset */
272#define DBCR0_RST_CORE 0x10000000 /* Core Reset */
273#define DBCR0_RST_NONE 0x00000000 /* No Reset */
274#define DBCR0_IC 0x08000000 /* Instruction Completion */
275#define DBCR0_ICMP DBCR0_IC
276#define DBCR0_BT 0x04000000 /* Branch Taken */
277#define DBCR0_BRT DBCR0_BT
278#define DBCR0_EDE 0x02000000 /* Exception Debug Event */
279#define DBCR0_IRPT DBCR0_EDE
280#define DBCR0_TDE 0x01000000 /* TRAP Debug Event */
281#define DBCR0_IA1 0x00800000 /* Instr Addr compare 1 enable */
282#define DBCR0_IAC1 DBCR0_IA1
283#define DBCR0_IA2 0x00400000 /* Instr Addr compare 2 enable */
284#define DBCR0_IAC2 DBCR0_IA2
285#define DBCR0_IA12 0x00200000 /* Instr Addr 1-2 range enable */
286#define DBCR0_IA12X 0x00100000 /* Instr Addr 1-2 range eXclusive */
287#define DBCR0_IA3 0x00080000 /* Instr Addr compare 3 enable */
288#define DBCR0_IAC3 DBCR0_IA3
289#define DBCR0_IA4 0x00040000 /* Instr Addr compare 4 enable */
290#define DBCR0_IAC4 DBCR0_IA4
291#define DBCR0_IA34 0x00020000 /* Instr Addr 3-4 range Enable */
292#define DBCR0_IA34X 0x00010000 /* Instr Addr 3-4 range eXclusive */
293#define DBCR0_IA12T 0x00008000 /* Instr Addr 1-2 range Toggle */
294#define DBCR0_IA34T 0x00004000 /* Instr Addr 3-4 range Toggle */
295#define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */
296#elif defined(CONFIG_BOOKE)
297#define DBCR0_EDM 0x80000000 /* External Debug Mode */
298#define DBCR0_IDM 0x40000000 /* Internal Debug Mode */
299#define DBCR0_RST 0x30000000 /* all the bits in the RST field */
300/* DBCR0_RST_* is 44x specific and not followed in fsl booke */
301#define DBCR0_RST_SYSTEM 0x30000000 /* System Reset */
302#define DBCR0_RST_CHIP 0x20000000 /* Chip Reset */
303#define DBCR0_RST_CORE 0x10000000 /* Core Reset */
304#define DBCR0_RST_NONE 0x00000000 /* No Reset */
305#define DBCR0_ICMP 0x08000000 /* Instruction Completion */
306#define DBCR0_IC DBCR0_ICMP
307#define DBCR0_BRT 0x04000000 /* Branch Taken */
308#define DBCR0_BT DBCR0_BRT
309#define DBCR0_IRPT 0x02000000 /* Exception Debug Event */
310#define DBCR0_TDE 0x01000000 /* TRAP Debug Event */
311#define DBCR0_TIE DBCR0_TDE
312#define DBCR0_IAC1 0x00800000 /* Instr Addr compare 1 enable */
313#define DBCR0_IAC2 0x00400000 /* Instr Addr compare 2 enable */
314#define DBCR0_IAC3 0x00200000 /* Instr Addr compare 3 enable */
315#define DBCR0_IAC4 0x00100000 /* Instr Addr compare 4 enable */
316#define DBCR0_DAC1R 0x00080000 /* DAC 1 Read enable */
317#define DBCR0_DAC1W 0x00040000 /* DAC 1 Write enable */
318#define DBCR0_DAC2R 0x00020000 /* DAC 2 Read enable */
319#define DBCR0_DAC2W 0x00010000 /* DAC 2 Write enable */
320#define DBCR0_RET 0x00008000 /* Return Debug Event */
321#define DBCR0_CIRPT 0x00000040 /* Critical Interrupt Taken Event */
322#define DBCR0_CRET 0x00000020 /* Critical Return Debug Event */
323#define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */
324
325/* Bit definitions related to the DBCR1. */
326#define DBCR1_IAC12M 0x00800000 /* Instr Addr 1-2 range enable */
327#define DBCR1_IAC12MX 0x00C00000 /* Instr Addr 1-2 range eXclusive */
328#define DBCR1_IAC12AT 0x00010000 /* Instr Addr 1-2 range Toggle */
329#define DBCR1_IAC34M 0x00000080 /* Instr Addr 3-4 range enable */
330#define DBCR1_IAC34MX 0x000000C0 /* Instr Addr 3-4 range eXclusive */
331#define DBCR1_IAC34AT 0x00000001 /* Instr Addr 3-4 range Toggle */
332
333/* Bit definitions related to the DBCR2. */
334#define DBCR2_DAC12M 0x00800000 /* DAC 1-2 range enable */
335#define DBCR2_DAC12MX 0x00C00000 /* DAC 1-2 range eXclusive */
336#define DBCR2_DAC12A 0x00200000 /* DAC 1-2 Asynchronous */
337#endif
338
339/* Bit definitions related to the TCR. */
340#define TCR_WP(x) (((x)&0x3)<<30) /* WDT Period */
341#define TCR_WP_MASK TCR_WP(3)
342#define WP_2_17 0 /* 2^17 clocks */
343#define WP_2_21 1 /* 2^21 clocks */
344#define WP_2_25 2 /* 2^25 clocks */
345#define WP_2_29 3 /* 2^29 clocks */
346#define TCR_WRC(x) (((x)&0x3)<<28) /* WDT Reset Control */
347#define TCR_WRC_MASK TCR_WRC(3)
348#define WRC_NONE 0 /* No reset will occur */
349#define WRC_CORE 1 /* Core reset will occur */
350#define WRC_CHIP 2 /* Chip reset will occur */
351#define WRC_SYSTEM 3 /* System reset will occur */
352#define TCR_WIE 0x08000000 /* WDT Interrupt Enable */
353#define TCR_PIE 0x04000000 /* PIT Interrupt Enable */
354#define TCR_DIE TCR_PIE /* DEC Interrupt Enable */
355#define TCR_FP(x) (((x)&0x3)<<24) /* FIT Period */
356#define TCR_FP_MASK TCR_FP(3)
357#define FP_2_9 0 /* 2^9 clocks */
358#define FP_2_13 1 /* 2^13 clocks */
359#define FP_2_17 2 /* 2^17 clocks */
360#define FP_2_21 3 /* 2^21 clocks */
361#define TCR_FIE 0x00800000 /* FIT Interrupt Enable */
362#define TCR_ARE 0x00400000 /* Auto Reload Enable */
363
364/* Bit definitions for the TSR. */
365#define TSR_ENW 0x80000000 /* Enable Next Watchdog */
366#define TSR_WIS 0x40000000 /* WDT Interrupt Status */
367#define TSR_WRS(x) (((x)&0x3)<<28) /* WDT Reset Status */
368#define WRS_NONE 0 /* No WDT reset occurred */
369#define WRS_CORE 1 /* WDT forced core reset */
370#define WRS_CHIP 2 /* WDT forced chip reset */
371#define WRS_SYSTEM 3 /* WDT forced system reset */
372#define TSR_PIS 0x08000000 /* PIT Interrupt Status */
373#define TSR_DIS TSR_PIS /* DEC Interrupt Status */
374#define TSR_FIS 0x04000000 /* FIT Interrupt Status */
375
376/* Bit definitions for the DCCR. */
377#define DCCR_NOCACHE 0 /* Noncacheable */
378#define DCCR_CACHE 1 /* Cacheable */
379
380/* Bit definitions for DCWR. */
381#define DCWR_COPY 0 /* Copy-back */
382#define DCWR_WRITE 1 /* Write-through */
383
384/* Bit definitions for ICCR. */
385#define ICCR_NOCACHE 0 /* Noncacheable */
386#define ICCR_CACHE 1 /* Cacheable */
387
388/* Bit definitions for L1CSR0. */
389#define L1CSR0_CLFC 0x00000100 /* Cache Lock Bits Flash Clear */
390#define L1CSR0_DCFI 0x00000002 /* Data Cache Flash Invalidate */
391#define L1CSR0_CFI 0x00000002 /* Cache Flash Invalidate */
392#define L1CSR0_DCE 0x00000001 /* Data Cache Enable */
393
394/* Bit definitions for L1CSR1. */
395#define L1CSR1_ICLFR 0x00000100 /* Instr Cache Lock Bits Flash Reset */
396#define L1CSR1_ICFI 0x00000002 /* Instr Cache Flash Invalidate */
397#define L1CSR1_ICE 0x00000001 /* Instr Cache Enable */
398
399/* Bit definitions for L2CSR0. */
400#define L2CSR0_L2E 0x80000000 /* L2 Cache Enable */
401#define L2CSR0_L2PE 0x40000000 /* L2 Cache Parity/ECC Enable */
402#define L2CSR0_L2WP 0x1c000000 /* L2 I/D Way Partioning */
403#define L2CSR0_L2CM 0x03000000 /* L2 Cache Coherency Mode */
404#define L2CSR0_L2FI 0x00200000 /* L2 Cache Flash Invalidate */
405#define L2CSR0_L2IO 0x00100000 /* L2 Cache Instruction Only */
406#define L2CSR0_L2DO 0x00010000 /* L2 Cache Data Only */
407#define L2CSR0_L2REP 0x00003000 /* L2 Line Replacement Algo */
408#define L2CSR0_L2FL 0x00000800 /* L2 Cache Flush */
409#define L2CSR0_L2LFC 0x00000400 /* L2 Cache Lock Flash Clear */
410#define L2CSR0_L2LOA 0x00000080 /* L2 Cache Lock Overflow Allocate */
411#define L2CSR0_L2LO 0x00000020 /* L2 Cache Lock Overflow */
412
413/* Bit definitions for SGR. */
414#define SGR_NORMAL 0 /* Speculative fetching allowed. */
415#define SGR_GUARDED 1 /* Speculative fetching disallowed. */
416
417/* Bit definitions for SPEFSCR. */
418#define SPEFSCR_SOVH 0x80000000 /* Summary integer overflow high */
419#define SPEFSCR_OVH 0x40000000 /* Integer overflow high */
420#define SPEFSCR_FGH 0x20000000 /* Embedded FP guard bit high */
421#define SPEFSCR_FXH 0x10000000 /* Embedded FP sticky bit high */
422#define SPEFSCR_FINVH 0x08000000 /* Embedded FP invalid operation high */
423#define SPEFSCR_FDBZH 0x04000000 /* Embedded FP div by zero high */
424#define SPEFSCR_FUNFH 0x02000000 /* Embedded FP underflow high */
425#define SPEFSCR_FOVFH 0x01000000 /* Embedded FP overflow high */
426#define SPEFSCR_FINXS 0x00200000 /* Embedded FP inexact sticky */
427#define SPEFSCR_FINVS 0x00100000 /* Embedded FP invalid op. sticky */
428#define SPEFSCR_FDBZS 0x00080000 /* Embedded FP div by zero sticky */
429#define SPEFSCR_FUNFS 0x00040000 /* Embedded FP underflow sticky */
430#define SPEFSCR_FOVFS 0x00020000 /* Embedded FP overflow sticky */
431#define SPEFSCR_MODE 0x00010000 /* Embedded FP mode */
432#define SPEFSCR_SOV 0x00008000 /* Integer summary overflow */
433#define SPEFSCR_OV 0x00004000 /* Integer overflow */
434#define SPEFSCR_FG 0x00002000 /* Embedded FP guard bit */
435#define SPEFSCR_FX 0x00001000 /* Embedded FP sticky bit */
436#define SPEFSCR_FINV 0x00000800 /* Embedded FP invalid operation */
437#define SPEFSCR_FDBZ 0x00000400 /* Embedded FP div by zero */
438#define SPEFSCR_FUNF 0x00000200 /* Embedded FP underflow */
439#define SPEFSCR_FOVF 0x00000100 /* Embedded FP overflow */
440#define SPEFSCR_FINXE 0x00000040 /* Embedded FP inexact enable */
441#define SPEFSCR_FINVE 0x00000020 /* Embedded FP invalid op. enable */
442#define SPEFSCR_FDBZE 0x00000010 /* Embedded FP div by zero enable */
443#define SPEFSCR_FUNFE 0x00000008 /* Embedded FP underflow enable */
444#define SPEFSCR_FOVFE 0x00000004 /* Embedded FP overflow enable */
445#define SPEFSCR_FRMC 0x00000003 /* Embedded FP rounding mode control */
446
447/*
448 * The IBM-403 is an even more odd special case, as it is much
449 * older than the IBM-405 series. We put these down here incase someone
450 * wishes to support these machines again.
451 */
452#ifdef CONFIG_403GCX
453/* Special Purpose Registers (SPRNs)*/
454#define SPRN_TBHU 0x3CC /* Time Base High User-mode */
455#define SPRN_TBLU 0x3CD /* Time Base Low User-mode */
456#define SPRN_CDBCR 0x3D7 /* Cache Debug Control Register */
457#define SPRN_TBHI 0x3DC /* Time Base High */
458#define SPRN_TBLO 0x3DD /* Time Base Low */
459#define SPRN_DBCR 0x3F2 /* Debug Control Regsiter */
460#define SPRN_PBL1 0x3FC /* Protection Bound Lower 1 */
461#define SPRN_PBL2 0x3FE /* Protection Bound Lower 2 */
462#define SPRN_PBU1 0x3FD /* Protection Bound Upper 1 */
463#define SPRN_PBU2 0x3FF /* Protection Bound Upper 2 */
464
465
466/* Bit definitions for the DBCR. */
467#define DBCR_EDM DBCR0_EDM
468#define DBCR_IDM DBCR0_IDM
469#define DBCR_RST(x) (((x) & 0x3) << 28)
470#define DBCR_RST_NONE 0
471#define DBCR_RST_CORE 1
472#define DBCR_RST_CHIP 2
473#define DBCR_RST_SYSTEM 3
474#define DBCR_IC DBCR0_IC /* Instruction Completion Debug Evnt */
475#define DBCR_BT DBCR0_BT /* Branch Taken Debug Event */
476#define DBCR_EDE DBCR0_EDE /* Exception Debug Event */
477#define DBCR_TDE DBCR0_TDE /* TRAP Debug Event */
478#define DBCR_FER 0x00F80000 /* First Events Remaining Mask */
479#define DBCR_FT 0x00040000 /* Freeze Timers on Debug Event */
480#define DBCR_IA1 0x00020000 /* Instr. Addr. Compare 1 Enable */
481#define DBCR_IA2 0x00010000 /* Instr. Addr. Compare 2 Enable */
482#define DBCR_D1R 0x00008000 /* Data Addr. Compare 1 Read Enable */
483#define DBCR_D1W 0x00004000 /* Data Addr. Compare 1 Write Enable */
484#define DBCR_D1S(x) (((x) & 0x3) << 12) /* Data Adrr. Compare 1 Size */
485#define DAC_BYTE 0
486#define DAC_HALF 1
487#define DAC_WORD 2
488#define DAC_QUAD 3
489#define DBCR_D2R 0x00000800 /* Data Addr. Compare 2 Read Enable */
490#define DBCR_D2W 0x00000400 /* Data Addr. Compare 2 Write Enable */
491#define DBCR_D2S(x) (((x) & 0x3) << 8) /* Data Addr. Compare 2 Size */
492#define DBCR_SBT 0x00000040 /* Second Branch Taken Debug Event */
493#define DBCR_SED 0x00000020 /* Second Exception Debug Event */
494#define DBCR_STD 0x00000010 /* Second Trap Debug Event */
495#define DBCR_SIA 0x00000008 /* Second IAC Enable */
496#define DBCR_SDA 0x00000004 /* Second DAC Enable */
497#define DBCR_JOI 0x00000002 /* JTAG Serial Outbound Int. Enable */
498#define DBCR_JII 0x00000001 /* JTAG Serial Inbound Int. Enable */
499#endif /* 403GCX */
500#endif /* __ASM_POWERPC_REG_BOOKE_H__ */
501#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h b/arch/powerpc/include/asm/reg_fsl_emb.h
new file mode 100644
index 000000000000..1e180a594589
--- /dev/null
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -0,0 +1,72 @@
1/*
2 * Contains register definitions for the Freescale Embedded Performance
3 * Monitor.
4 */
5#ifdef __KERNEL__
6#ifndef __ASM_POWERPC_REG_FSL_EMB_H__
7#define __ASM_POWERPC_REG_FSL_EMB_H__
8
9#ifndef __ASSEMBLY__
10/* Performance Monitor Registers */
11#define mfpmr(rn) ({unsigned int rval; \
12 asm volatile("mfpmr %0," __stringify(rn) \
13 : "=r" (rval)); rval;})
14#define mtpmr(rn, v) asm volatile("mtpmr " __stringify(rn) ",%0" : : "r" (v))
15#endif /* __ASSEMBLY__ */
16
17/* Freescale Book E Performance Monitor APU Registers */
18#define PMRN_PMC0 0x010 /* Performance Monitor Counter 0 */
19#define PMRN_PMC1 0x011 /* Performance Monitor Counter 1 */
20#define PMRN_PMC2 0x012 /* Performance Monitor Counter 1 */
21#define PMRN_PMC3 0x013 /* Performance Monitor Counter 1 */
22#define PMRN_PMLCA0 0x090 /* PM Local Control A0 */
23#define PMRN_PMLCA1 0x091 /* PM Local Control A1 */
24#define PMRN_PMLCA2 0x092 /* PM Local Control A2 */
25#define PMRN_PMLCA3 0x093 /* PM Local Control A3 */
26
27#define PMLCA_FC 0x80000000 /* Freeze Counter */
28#define PMLCA_FCS 0x40000000 /* Freeze in Supervisor */
29#define PMLCA_FCU 0x20000000 /* Freeze in User */
30#define PMLCA_FCM1 0x10000000 /* Freeze when PMM==1 */
31#define PMLCA_FCM0 0x08000000 /* Freeze when PMM==0 */
32#define PMLCA_CE 0x04000000 /* Condition Enable */
33
34#define PMLCA_EVENT_MASK 0x007f0000 /* Event field */
35#define PMLCA_EVENT_SHIFT 16
36
37#define PMRN_PMLCB0 0x110 /* PM Local Control B0 */
38#define PMRN_PMLCB1 0x111 /* PM Local Control B1 */
39#define PMRN_PMLCB2 0x112 /* PM Local Control B2 */
40#define PMRN_PMLCB3 0x113 /* PM Local Control B3 */
41
42#define PMLCB_THRESHMUL_MASK 0x0700 /* Threshhold Multiple Field */
43#define PMLCB_THRESHMUL_SHIFT 8
44
45#define PMLCB_THRESHOLD_MASK 0x003f /* Threshold Field */
46#define PMLCB_THRESHOLD_SHIFT 0
47
48#define PMRN_PMGC0 0x190 /* PM Global Control 0 */
49
50#define PMGC0_FAC 0x80000000 /* Freeze all Counters */
51#define PMGC0_PMIE 0x40000000 /* Interrupt Enable */
52#define PMGC0_FCECE 0x20000000 /* Freeze countes on
53 Enabled Condition or
54 Event */
55
56#define PMRN_UPMC0 0x000 /* User Performance Monitor Counter 0 */
57#define PMRN_UPMC1 0x001 /* User Performance Monitor Counter 1 */
58#define PMRN_UPMC2 0x002 /* User Performance Monitor Counter 1 */
59#define PMRN_UPMC3 0x003 /* User Performance Monitor Counter 1 */
60#define PMRN_UPMLCA0 0x080 /* User PM Local Control A0 */
61#define PMRN_UPMLCA1 0x081 /* User PM Local Control A1 */
62#define PMRN_UPMLCA2 0x082 /* User PM Local Control A2 */
63#define PMRN_UPMLCA3 0x083 /* User PM Local Control A3 */
64#define PMRN_UPMLCB0 0x100 /* User PM Local Control B0 */
65#define PMRN_UPMLCB1 0x101 /* User PM Local Control B1 */
66#define PMRN_UPMLCB2 0x102 /* User PM Local Control B2 */
67#define PMRN_UPMLCB3 0x103 /* User PM Local Control B3 */
68#define PMRN_UPMGC0 0x180 /* User PM Global Control 0 */
69
70
71#endif /* __ASM_POWERPC_REG_FSL_EMB_H__ */
72#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/resource.h b/arch/powerpc/include/asm/resource.h
new file mode 100644
index 000000000000..04bc4db8921b
--- /dev/null
+++ b/arch/powerpc/include/asm/resource.h
@@ -0,0 +1 @@
#include <asm-generic/resource.h>
diff --git a/arch/powerpc/include/asm/rheap.h b/arch/powerpc/include/asm/rheap.h
new file mode 100644
index 000000000000..172381769cfc
--- /dev/null
+++ b/arch/powerpc/include/asm/rheap.h
@@ -0,0 +1,89 @@
1/*
2 * include/asm-ppc/rheap.h
3 *
4 * Header file for the implementation of a remote heap.
5 *
6 * Author: Pantelis Antoniou <panto@intracom.gr>
7 *
8 * 2004 (c) INTRACOM S.A. Greece. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#ifndef __ASM_PPC_RHEAP_H__
15#define __ASM_PPC_RHEAP_H__
16
17#include <linux/list.h>
18
19typedef struct _rh_block {
20 struct list_head list;
21 unsigned long start;
22 int size;
23 const char *owner;
24} rh_block_t;
25
26typedef struct _rh_info {
27 unsigned int alignment;
28 int max_blocks;
29 int empty_slots;
30 rh_block_t *block;
31 struct list_head empty_list;
32 struct list_head free_list;
33 struct list_head taken_list;
34 unsigned int flags;
35} rh_info_t;
36
37#define RHIF_STATIC_INFO 0x1
38#define RHIF_STATIC_BLOCK 0x2
39
40typedef struct _rh_stats {
41 unsigned long start;
42 int size;
43 const char *owner;
44} rh_stats_t;
45
46#define RHGS_FREE 0
47#define RHGS_TAKEN 1
48
49/* Create a remote heap dynamically */
50extern rh_info_t *rh_create(unsigned int alignment);
51
52/* Destroy a remote heap, created by rh_create() */
53extern void rh_destroy(rh_info_t * info);
54
55/* Initialize in place a remote info block */
56extern void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
57 rh_block_t * block);
58
59/* Attach a free region to manage */
60extern int rh_attach_region(rh_info_t * info, unsigned long start, int size);
61
62/* Detach a free region */
63extern unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size);
64
65/* Allocate the given size from the remote heap (with alignment) */
66extern unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment,
67 const char *owner);
68
69/* Allocate the given size from the remote heap */
70extern unsigned long rh_alloc(rh_info_t * info, int size, const char *owner);
71
72/* Allocate the given size from the given address */
73extern unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size,
74 const char *owner);
75
76/* Free the allocated area */
77extern int rh_free(rh_info_t * info, unsigned long start);
78
79/* Get stats for debugging purposes */
80extern int rh_get_stats(rh_info_t * info, int what, int max_stats,
81 rh_stats_t * stats);
82
83/* Simple dump of remote heap info */
84extern void rh_dump(rh_info_t * info);
85
86/* Set owner of taken block */
87extern int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner);
88
89#endif /* __ASM_PPC_RHEAP_H__ */
diff --git a/arch/powerpc/include/asm/rio.h b/arch/powerpc/include/asm/rio.h
new file mode 100644
index 000000000000..0018bf80cb25
--- /dev/null
+++ b/arch/powerpc/include/asm/rio.h
@@ -0,0 +1,18 @@
1/*
2 * RapidIO architecture support
3 *
4 * Copyright 2005 MontaVista Software, Inc.
5 * Matt Porter <mporter@kernel.crashing.org>
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 ASM_PPC_RIO_H
14#define ASM_PPC_RIO_H
15
16extern void platform_rio_init(void);
17
18#endif /* ASM_PPC_RIO_H */
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
new file mode 100644
index 000000000000..8eaa7b28d9d0
--- /dev/null
+++ b/arch/powerpc/include/asm/rtas.h
@@ -0,0 +1,247 @@
1#ifndef _POWERPC_RTAS_H
2#define _POWERPC_RTAS_H
3#ifdef __KERNEL__
4
5#include <linux/spinlock.h>
6#include <asm/page.h>
7
8/*
9 * Definitions for talking to the RTAS on CHRP machines.
10 *
11 * Copyright (C) 2001 Peter Bergner
12 * Copyright (C) 2001 PPC 64 Team, IBM Corp
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
18 */
19
20#define RTAS_UNKNOWN_SERVICE (-1)
21#define RTAS_INSTANTIATE_MAX (1UL<<30) /* Don't instantiate rtas at/above this value */
22
23/* Buffer size for ppc_rtas system call. */
24#define RTAS_RMOBUF_MAX (64 * 1024)
25
26/* RTAS return status codes */
27#define RTAS_NOT_SUSPENDABLE -9004
28#define RTAS_BUSY -2 /* RTAS Busy */
29#define RTAS_EXTENDED_DELAY_MIN 9900
30#define RTAS_EXTENDED_DELAY_MAX 9905
31
32/*
33 * In general to call RTAS use rtas_token("string") to lookup
34 * an RTAS token for the given string (e.g. "event-scan").
35 * To actually perform the call use
36 * ret = rtas_call(token, n_in, n_out, ...)
37 * Where n_in is the number of input parameters and
38 * n_out is the number of output parameters
39 *
40 * If the "string" is invalid on this system, RTAS_UNKNOWN_SERVICE
41 * will be returned as a token. rtas_call() does look for this
42 * token and error out gracefully so rtas_call(rtas_token("str"), ...)
43 * may be safely used for one-shot calls to RTAS.
44 *
45 */
46
47typedef u32 rtas_arg_t;
48
49struct rtas_args {
50 u32 token;
51 u32 nargs;
52 u32 nret;
53 rtas_arg_t args[16];
54 rtas_arg_t *rets; /* Pointer to return values in args[]. */
55};
56
57struct rtas_t {
58 unsigned long entry; /* physical address pointer */
59 unsigned long base; /* physical address pointer */
60 unsigned long size;
61 spinlock_t lock;
62 struct rtas_args args;
63 struct device_node *dev; /* virtual address pointer */
64};
65
66/* RTAS event classes */
67#define RTAS_INTERNAL_ERROR 0x80000000 /* set bit 0 */
68#define RTAS_EPOW_WARNING 0x40000000 /* set bit 1 */
69#define RTAS_POWERMGM_EVENTS 0x20000000 /* set bit 2 */
70#define RTAS_HOTPLUG_EVENTS 0x10000000 /* set bit 3 */
71#define RTAS_EVENT_SCAN_ALL_EVENTS 0xf0000000
72
73/* RTAS event severity */
74#define RTAS_SEVERITY_FATAL 0x5
75#define RTAS_SEVERITY_ERROR 0x4
76#define RTAS_SEVERITY_ERROR_SYNC 0x3
77#define RTAS_SEVERITY_WARNING 0x2
78#define RTAS_SEVERITY_EVENT 0x1
79#define RTAS_SEVERITY_NO_ERROR 0x0
80
81/* RTAS event disposition */
82#define RTAS_DISP_FULLY_RECOVERED 0x0
83#define RTAS_DISP_LIMITED_RECOVERY 0x1
84#define RTAS_DISP_NOT_RECOVERED 0x2
85
86/* RTAS event initiator */
87#define RTAS_INITIATOR_UNKNOWN 0x0
88#define RTAS_INITIATOR_CPU 0x1
89#define RTAS_INITIATOR_PCI 0x2
90#define RTAS_INITIATOR_ISA 0x3
91#define RTAS_INITIATOR_MEMORY 0x4
92#define RTAS_INITIATOR_POWERMGM 0x5
93
94/* RTAS event target */
95#define RTAS_TARGET_UNKNOWN 0x0
96#define RTAS_TARGET_CPU 0x1
97#define RTAS_TARGET_PCI 0x2
98#define RTAS_TARGET_ISA 0x3
99#define RTAS_TARGET_MEMORY 0x4
100#define RTAS_TARGET_POWERMGM 0x5
101
102/* RTAS event type */
103#define RTAS_TYPE_RETRY 0x01
104#define RTAS_TYPE_TCE_ERR 0x02
105#define RTAS_TYPE_INTERN_DEV_FAIL 0x03
106#define RTAS_TYPE_TIMEOUT 0x04
107#define RTAS_TYPE_DATA_PARITY 0x05
108#define RTAS_TYPE_ADDR_PARITY 0x06
109#define RTAS_TYPE_CACHE_PARITY 0x07
110#define RTAS_TYPE_ADDR_INVALID 0x08
111#define RTAS_TYPE_ECC_UNCORR 0x09
112#define RTAS_TYPE_ECC_CORR 0x0a
113#define RTAS_TYPE_EPOW 0x40
114#define RTAS_TYPE_PLATFORM 0xE0
115#define RTAS_TYPE_IO 0xE1
116#define RTAS_TYPE_INFO 0xE2
117#define RTAS_TYPE_DEALLOC 0xE3
118#define RTAS_TYPE_DUMP 0xE4
119/* I don't add PowerMGM events right now, this is a different topic */
120#define RTAS_TYPE_PMGM_POWER_SW_ON 0x60
121#define RTAS_TYPE_PMGM_POWER_SW_OFF 0x61
122#define RTAS_TYPE_PMGM_LID_OPEN 0x62
123#define RTAS_TYPE_PMGM_LID_CLOSE 0x63
124#define RTAS_TYPE_PMGM_SLEEP_BTN 0x64
125#define RTAS_TYPE_PMGM_WAKE_BTN 0x65
126#define RTAS_TYPE_PMGM_BATTERY_WARN 0x66
127#define RTAS_TYPE_PMGM_BATTERY_CRIT 0x67
128#define RTAS_TYPE_PMGM_SWITCH_TO_BAT 0x68
129#define RTAS_TYPE_PMGM_SWITCH_TO_AC 0x69
130#define RTAS_TYPE_PMGM_KBD_OR_MOUSE 0x6a
131#define RTAS_TYPE_PMGM_ENCLOS_OPEN 0x6b
132#define RTAS_TYPE_PMGM_ENCLOS_CLOSED 0x6c
133#define RTAS_TYPE_PMGM_RING_INDICATE 0x6d
134#define RTAS_TYPE_PMGM_LAN_ATTENTION 0x6e
135#define RTAS_TYPE_PMGM_TIME_ALARM 0x6f
136#define RTAS_TYPE_PMGM_CONFIG_CHANGE 0x70
137#define RTAS_TYPE_PMGM_SERVICE_PROC 0x71
138
139struct rtas_error_log {
140 unsigned long version:8; /* Architectural version */
141 unsigned long severity:3; /* Severity level of error */
142 unsigned long disposition:2; /* Degree of recovery */
143 unsigned long extended:1; /* extended log present? */
144 unsigned long /* reserved */ :2; /* Reserved for future use */
145 unsigned long initiator:4; /* Initiator of event */
146 unsigned long target:4; /* Target of failed operation */
147 unsigned long type:8; /* General event or error*/
148 unsigned long extended_log_length:32; /* length in bytes */
149 unsigned char buffer[1];
150};
151
152/*
153 * This can be set by the rtas_flash module so that it can get called
154 * as the absolutely last thing before the kernel terminates.
155 */
156extern void (*rtas_flash_term_hook)(int);
157
158extern struct rtas_t rtas;
159
160extern void enter_rtas(unsigned long);
161extern int rtas_token(const char *service);
162extern int rtas_service_present(const char *service);
163extern int rtas_call(int token, int, int, int *, ...);
164extern void rtas_restart(char *cmd);
165extern void rtas_power_off(void);
166extern void rtas_halt(void);
167extern void rtas_os_term(char *str);
168extern int rtas_get_sensor(int sensor, int index, int *state);
169extern int rtas_get_power_level(int powerdomain, int *level);
170extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
171extern int rtas_set_indicator(int indicator, int index, int new_value);
172extern int rtas_set_indicator_fast(int indicator, int index, int new_value);
173extern void rtas_progress(char *s, unsigned short hex);
174extern void rtas_initialize(void);
175
176struct rtc_time;
177extern unsigned long rtas_get_boot_time(void);
178extern void rtas_get_rtc_time(struct rtc_time *rtc_time);
179extern int rtas_set_rtc_time(struct rtc_time *rtc_time);
180
181extern unsigned int rtas_busy_delay_time(int status);
182extern unsigned int rtas_busy_delay(int status);
183
184extern int early_init_dt_scan_rtas(unsigned long node,
185 const char *uname, int depth, void *data);
186
187extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal);
188
189/* Error types logged. */
190#define ERR_FLAG_ALREADY_LOGGED 0x0
191#define ERR_FLAG_BOOT 0x1 /* log was pulled from NVRAM on boot */
192#define ERR_TYPE_RTAS_LOG 0x2 /* from rtas event-scan */
193#define ERR_TYPE_KERNEL_PANIC 0x4 /* from panic() */
194
195/* All the types and not flags */
196#define ERR_TYPE_MASK (ERR_TYPE_RTAS_LOG | ERR_TYPE_KERNEL_PANIC)
197
198#define RTAS_DEBUG KERN_DEBUG "RTAS: "
199
200#define RTAS_ERROR_LOG_MAX 2048
201
202/*
203 * Return the firmware-specified size of the error log buffer
204 * for all rtas calls that require an error buffer argument.
205 * This includes 'check-exception' and 'rtas-last-error'.
206 */
207extern int rtas_get_error_log_max(void);
208
209/* Event Scan Parameters */
210#define EVENT_SCAN_ALL_EVENTS 0xf0000000
211#define SURVEILLANCE_TOKEN 9000
212#define LOG_NUMBER 64 /* must be a power of two */
213#define LOG_NUMBER_MASK (LOG_NUMBER-1)
214
215/* Some RTAS ops require a data buffer and that buffer must be < 4G.
216 * Rather than having a memory allocator, just use this buffer
217 * (get the lock first), make the RTAS call. Copy the data instead
218 * of holding the buffer for long.
219 */
220
221#define RTAS_DATA_BUF_SIZE 4096
222extern spinlock_t rtas_data_buf_lock;
223extern char rtas_data_buf[RTAS_DATA_BUF_SIZE];
224
225/* RMO buffer reserved for user-space RTAS use */
226extern unsigned long rtas_rmo_buf;
227
228#define GLOBAL_INTERRUPT_QUEUE 9005
229
230/**
231 * rtas_config_addr - Format a busno, devfn and reg for RTAS.
232 * @busno: The bus number.
233 * @devfn: The device and function number as encoded by PCI_DEVFN().
234 * @reg: The register number.
235 *
236 * This function encodes the given busno, devfn and register number as
237 * required for RTAS calls that take a "config_addr" parameter.
238 * See PAPR requirement 7.3.4-1 for more info.
239 */
240static inline u32 rtas_config_addr(int busno, int devfn, int reg)
241{
242 return ((reg & 0xf00) << 20) | ((busno & 0xff) << 16) |
243 (devfn << 8) | (reg & 0xff);
244}
245
246#endif /* __KERNEL__ */
247#endif /* _POWERPC_RTAS_H */
diff --git a/arch/powerpc/include/asm/rtc.h b/arch/powerpc/include/asm/rtc.h
new file mode 100644
index 000000000000..f5802926b6c0
--- /dev/null
+++ b/arch/powerpc/include/asm/rtc.h
@@ -0,0 +1,78 @@
1/*
2 * Real-time clock definitions and interfaces
3 *
4 * Author: Tom Rini <trini@mvista.com>
5 *
6 * 2002 (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 * Based on:
12 * include/asm-m68k/rtc.h
13 *
14 * Copyright Richard Zidlicky
15 * implementation details for genrtc/q40rtc driver
16 *
17 * And the old drivers/macintosh/rtc.c which was heavily based on:
18 * Linux/SPARC Real Time Clock Driver
19 * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu)
20 *
21 * With additional work by Paul Mackerras and Franz Sirl.
22 */
23
24#ifndef __ASM_POWERPC_RTC_H__
25#define __ASM_POWERPC_RTC_H__
26
27#ifdef __KERNEL__
28
29#include <linux/rtc.h>
30
31#include <asm/machdep.h>
32#include <asm/time.h>
33
34#define RTC_PIE 0x40 /* periodic interrupt enable */
35#define RTC_AIE 0x20 /* alarm interrupt enable */
36#define RTC_UIE 0x10 /* update-finished interrupt enable */
37
38/* some dummy definitions */
39#define RTC_BATT_BAD 0x100 /* battery bad */
40#define RTC_SQWE 0x08 /* enable square-wave output */
41#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */
42#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
43#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
44
45static inline unsigned int get_rtc_time(struct rtc_time *time)
46{
47 if (ppc_md.get_rtc_time)
48 ppc_md.get_rtc_time(time);
49 return RTC_24H;
50}
51
52/* Set the current date and time in the real time clock. */
53static inline int set_rtc_time(struct rtc_time *time)
54{
55 if (ppc_md.set_rtc_time)
56 return ppc_md.set_rtc_time(time);
57 return -EINVAL;
58}
59
60static inline unsigned int get_rtc_ss(void)
61{
62 struct rtc_time h;
63
64 get_rtc_time(&h);
65 return h.tm_sec;
66}
67
68static inline int get_rtc_pll(struct rtc_pll_info *pll)
69{
70 return -EINVAL;
71}
72static inline int set_rtc_pll(struct rtc_pll_info *pll)
73{
74 return -EINVAL;
75}
76
77#endif /* __KERNEL__ */
78#endif /* __ASM_POWERPC_RTC_H__ */
diff --git a/arch/powerpc/include/asm/rwsem.h b/arch/powerpc/include/asm/rwsem.h
new file mode 100644
index 000000000000..24cd9281ec37
--- /dev/null
+++ b/arch/powerpc/include/asm/rwsem.h
@@ -0,0 +1,173 @@
1#ifndef _ASM_POWERPC_RWSEM_H
2#define _ASM_POWERPC_RWSEM_H
3
4#ifndef _LINUX_RWSEM_H
5#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."
6#endif
7
8#ifdef __KERNEL__
9
10/*
11 * R/W semaphores for PPC using the stuff in lib/rwsem.c.
12 * Adapted largely from include/asm-i386/rwsem.h
13 * by Paul Mackerras <paulus@samba.org>.
14 */
15
16#include <linux/list.h>
17#include <linux/spinlock.h>
18#include <asm/atomic.h>
19#include <asm/system.h>
20
21/*
22 * the semaphore definition
23 */
24struct rw_semaphore {
25 /* XXX this should be able to be an atomic_t -- paulus */
26 signed int count;
27#define RWSEM_UNLOCKED_VALUE 0x00000000
28#define RWSEM_ACTIVE_BIAS 0x00000001
29#define RWSEM_ACTIVE_MASK 0x0000ffff
30#define RWSEM_WAITING_BIAS (-0x00010000)
31#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
32#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
33 spinlock_t wait_lock;
34 struct list_head wait_list;
35#ifdef CONFIG_DEBUG_LOCK_ALLOC
36 struct lockdep_map dep_map;
37#endif
38};
39
40#ifdef CONFIG_DEBUG_LOCK_ALLOC
41# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
42#else
43# define __RWSEM_DEP_MAP_INIT(lockname)
44#endif
45
46#define __RWSEM_INITIALIZER(name) \
47 { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
48 LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
49
50#define DECLARE_RWSEM(name) \
51 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
52
53extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem);
54extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
55extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem);
56extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
57
58extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
59 struct lock_class_key *key);
60
61#define init_rwsem(sem) \
62 do { \
63 static struct lock_class_key __key; \
64 \
65 __init_rwsem((sem), #sem, &__key); \
66 } while (0)
67
68/*
69 * lock for reading
70 */
71static inline void __down_read(struct rw_semaphore *sem)
72{
73 if (unlikely(atomic_inc_return((atomic_t *)(&sem->count)) <= 0))
74 rwsem_down_read_failed(sem);
75}
76
77static inline int __down_read_trylock(struct rw_semaphore *sem)
78{
79 int tmp;
80
81 while ((tmp = sem->count) >= 0) {
82 if (tmp == cmpxchg(&sem->count, tmp,
83 tmp + RWSEM_ACTIVE_READ_BIAS)) {
84 return 1;
85 }
86 }
87 return 0;
88}
89
90/*
91 * lock for writing
92 */
93static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
94{
95 int tmp;
96
97 tmp = atomic_add_return(RWSEM_ACTIVE_WRITE_BIAS,
98 (atomic_t *)(&sem->count));
99 if (unlikely(tmp != RWSEM_ACTIVE_WRITE_BIAS))
100 rwsem_down_write_failed(sem);
101}
102
103static inline void __down_write(struct rw_semaphore *sem)
104{
105 __down_write_nested(sem, 0);
106}
107
108static inline int __down_write_trylock(struct rw_semaphore *sem)
109{
110 int tmp;
111
112 tmp = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE,
113 RWSEM_ACTIVE_WRITE_BIAS);
114 return tmp == RWSEM_UNLOCKED_VALUE;
115}
116
117/*
118 * unlock after reading
119 */
120static inline void __up_read(struct rw_semaphore *sem)
121{
122 int tmp;
123
124 tmp = atomic_dec_return((atomic_t *)(&sem->count));
125 if (unlikely(tmp < -1 && (tmp & RWSEM_ACTIVE_MASK) == 0))
126 rwsem_wake(sem);
127}
128
129/*
130 * unlock after writing
131 */
132static inline void __up_write(struct rw_semaphore *sem)
133{
134 if (unlikely(atomic_sub_return(RWSEM_ACTIVE_WRITE_BIAS,
135 (atomic_t *)(&sem->count)) < 0))
136 rwsem_wake(sem);
137}
138
139/*
140 * implement atomic add functionality
141 */
142static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
143{
144 atomic_add(delta, (atomic_t *)(&sem->count));
145}
146
147/*
148 * downgrade write lock to read lock
149 */
150static inline void __downgrade_write(struct rw_semaphore *sem)
151{
152 int tmp;
153
154 tmp = atomic_add_return(-RWSEM_WAITING_BIAS, (atomic_t *)(&sem->count));
155 if (tmp < 0)
156 rwsem_downgrade_wake(sem);
157}
158
159/*
160 * implement exchange and add functionality
161 */
162static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
163{
164 return atomic_add_return(delta, (atomic_t *)(&sem->count));
165}
166
167static inline int rwsem_is_locked(struct rw_semaphore *sem)
168{
169 return (sem->count != 0);
170}
171
172#endif /* __KERNEL__ */
173#endif /* _ASM_POWERPC_RWSEM_H */
diff --git a/arch/powerpc/include/asm/scatterlist.h b/arch/powerpc/include/asm/scatterlist.h
new file mode 100644
index 000000000000..fcf7d55afe45
--- /dev/null
+++ b/arch/powerpc/include/asm/scatterlist.h
@@ -0,0 +1,50 @@
1#ifndef _ASM_POWERPC_SCATTERLIST_H
2#define _ASM_POWERPC_SCATTERLIST_H
3/*
4 * Copyright (C) 2001 PPC64 Team, 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#ifdef __KERNEL__
13#include <linux/types.h>
14#include <asm/dma.h>
15
16struct scatterlist {
17#ifdef CONFIG_DEBUG_SG
18 unsigned long sg_magic;
19#endif
20 unsigned long page_link;
21 unsigned int offset;
22 unsigned int length;
23
24 /* For TCE support */
25 dma_addr_t dma_address;
26 u32 dma_length;
27};
28
29/*
30 * These macros should be used after a dma_map_sg call has been done
31 * to get bus addresses of each of the SG entries and their lengths.
32 * You should only work with the number of sg entries pci_map_sg
33 * returns, or alternatively stop on the first sg_dma_len(sg) which
34 * is 0.
35 */
36#define sg_dma_address(sg) ((sg)->dma_address)
37#ifdef __powerpc64__
38#define sg_dma_len(sg) ((sg)->dma_length)
39#else
40#define sg_dma_len(sg) ((sg)->length)
41#endif
42
43#ifdef __powerpc64__
44#define ISA_DMA_THRESHOLD (~0UL)
45#endif
46
47#define ARCH_HAS_SG_CHAIN
48
49#endif /* __KERNEL__ */
50#endif /* _ASM_POWERPC_SCATTERLIST_H */
diff --git a/arch/powerpc/include/asm/seccomp.h b/arch/powerpc/include/asm/seccomp.h
new file mode 100644
index 000000000000..853765eb1f65
--- /dev/null
+++ b/arch/powerpc/include/asm/seccomp.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_POWERPC_SECCOMP_H
2#define _ASM_POWERPC_SECCOMP_H
3
4#ifdef __KERNEL__
5#include <linux/thread_info.h>
6#endif
7
8#include <linux/unistd.h>
9
10#define __NR_seccomp_read __NR_read
11#define __NR_seccomp_write __NR_write
12#define __NR_seccomp_exit __NR_exit
13#define __NR_seccomp_sigreturn __NR_rt_sigreturn
14
15#define __NR_seccomp_read_32 __NR_read
16#define __NR_seccomp_write_32 __NR_write
17#define __NR_seccomp_exit_32 __NR_exit
18#define __NR_seccomp_sigreturn_32 __NR_sigreturn
19
20#endif /* _ASM_POWERPC_SECCOMP_H */
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h
new file mode 100644
index 000000000000..916018e425c4
--- /dev/null
+++ b/arch/powerpc/include/asm/sections.h
@@ -0,0 +1,22 @@
1#ifndef _ASM_POWERPC_SECTIONS_H
2#define _ASM_POWERPC_SECTIONS_H
3#ifdef __KERNEL__
4
5#include <asm-generic/sections.h>
6
7#ifdef __powerpc64__
8
9extern char _end[];
10
11static inline int in_kernel_text(unsigned long addr)
12{
13 if (addr >= (unsigned long)_stext && addr < (unsigned long)__init_end)
14 return 1;
15
16 return 0;
17}
18
19#endif
20
21#endif /* __KERNEL__ */
22#endif /* _ASM_POWERPC_SECTIONS_H */
diff --git a/arch/powerpc/include/asm/sembuf.h b/arch/powerpc/include/asm/sembuf.h
new file mode 100644
index 000000000000..99a41938ae3d
--- /dev/null
+++ b/arch/powerpc/include/asm/sembuf.h
@@ -0,0 +1,36 @@
1#ifndef _ASM_POWERPC_SEMBUF_H
2#define _ASM_POWERPC_SEMBUF_H
3
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/*
12 * The semid64_ds structure for PPC architecture.
13 * Note extra padding because this structure is passed back and forth
14 * between kernel and user space.
15 *
16 * Pad space is left for:
17 * - 64-bit time_t to solve y2038 problem
18 * - 2 miscellaneous 32-bit values
19 */
20
21struct semid64_ds {
22 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
23#ifndef __powerpc64__
24 unsigned long __unused1;
25#endif
26 __kernel_time_t sem_otime; /* last semop time */
27#ifndef __powerpc64__
28 unsigned long __unused2;
29#endif
30 __kernel_time_t sem_ctime; /* last change time */
31 unsigned long sem_nsems; /* no. of semaphores in array */
32 unsigned long __unused3;
33 unsigned long __unused4;
34};
35
36#endif /* _ASM_POWERPC_SEMBUF_H */
diff --git a/arch/powerpc/include/asm/serial.h b/arch/powerpc/include/asm/serial.h
new file mode 100644
index 000000000000..3e8589b43cb2
--- /dev/null
+++ b/arch/powerpc/include/asm/serial.h
@@ -0,0 +1,24 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version
5 * 2 of the License, or (at your option) any later version.
6 */
7#ifndef _ASM_POWERPC_SERIAL_H
8#define _ASM_POWERPC_SERIAL_H
9
10/*
11 * Serial ports are not listed here, because they are discovered
12 * through the device tree.
13 */
14
15/* Default baud base if not found in device-tree */
16#define BASE_BAUD ( 1843200 / 16 )
17
18#ifdef CONFIG_PPC_UDBG_16550
19extern void find_legacy_serial_ports(void);
20#else
21#define find_legacy_serial_ports() do { } while (0)
22#endif
23
24#endif /* _PPC64_SERIAL_H */
diff --git a/arch/powerpc/include/asm/setjmp.h b/arch/powerpc/include/asm/setjmp.h
new file mode 100644
index 000000000000..279d03a1eec6
--- /dev/null
+++ b/arch/powerpc/include/asm/setjmp.h
@@ -0,0 +1,18 @@
1/*
2 * Copyright © 2008 Michael Neuling IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *
9 */
10#ifndef _ASM_POWERPC_SETJMP_H
11#define _ASM_POWERPC_SETJMP_H
12
13#define JMP_BUF_LEN 23
14
15extern long setjmp(long *);
16extern void longjmp(long *, long);
17
18#endif /* _ASM_POWERPC_SETJMP_H */
diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
new file mode 100644
index 000000000000..817fac0a0714
--- /dev/null
+++ b/arch/powerpc/include/asm/setup.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_POWERPC_SETUP_H
2#define _ASM_POWERPC_SETUP_H
3
4#define COMMAND_LINE_SIZE 512
5
6#endif /* _ASM_POWERPC_SETUP_H */
diff --git a/arch/powerpc/include/asm/shmbuf.h b/arch/powerpc/include/asm/shmbuf.h
new file mode 100644
index 000000000000..8efa39698b6c
--- /dev/null
+++ b/arch/powerpc/include/asm/shmbuf.h
@@ -0,0 +1,59 @@
1#ifndef _ASM_POWERPC_SHMBUF_H
2#define _ASM_POWERPC_SHMBUF_H
3
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/*
12 * The shmid64_ds structure for PPC architecture.
13 *
14 * Note extra padding because this structure is passed back and forth
15 * between kernel and user space.
16 *
17 * Pad space is left for:
18 * - 64-bit time_t to solve y2038 problem
19 * - 2 miscellaneous 32-bit values
20 */
21
22struct shmid64_ds {
23 struct ipc64_perm shm_perm; /* operation perms */
24#ifndef __powerpc64__
25 unsigned long __unused1;
26#endif
27 __kernel_time_t shm_atime; /* last attach time */
28#ifndef __powerpc64__
29 unsigned long __unused2;
30#endif
31 __kernel_time_t shm_dtime; /* last detach time */
32#ifndef __powerpc64__
33 unsigned long __unused3;
34#endif
35 __kernel_time_t shm_ctime; /* last change time */
36#ifndef __powerpc64__
37 unsigned long __unused4;
38#endif
39 size_t shm_segsz; /* size of segment (bytes) */
40 __kernel_pid_t shm_cpid; /* pid of creator */
41 __kernel_pid_t shm_lpid; /* pid of last operator */
42 unsigned long shm_nattch; /* no. of current attaches */
43 unsigned long __unused5;
44 unsigned long __unused6;
45};
46
47struct shminfo64 {
48 unsigned long shmmax;
49 unsigned long shmmin;
50 unsigned long shmmni;
51 unsigned long shmseg;
52 unsigned long shmall;
53 unsigned long __unused1;
54 unsigned long __unused2;
55 unsigned long __unused3;
56 unsigned long __unused4;
57};
58
59#endif /* _ASM_POWERPC_SHMBUF_H */
diff --git a/arch/powerpc/include/asm/shmparam.h b/arch/powerpc/include/asm/shmparam.h
new file mode 100644
index 000000000000..5cda42a6d39e
--- /dev/null
+++ b/arch/powerpc/include/asm/shmparam.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_POWERPC_SHMPARAM_H
2#define _ASM_POWERPC_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _ASM_POWERPC_SHMPARAM_H */
diff --git a/arch/powerpc/include/asm/sigcontext.h b/arch/powerpc/include/asm/sigcontext.h
new file mode 100644
index 000000000000..9c1f24fd5d11
--- /dev/null
+++ b/arch/powerpc/include/asm/sigcontext.h
@@ -0,0 +1,87 @@
1#ifndef _ASM_POWERPC_SIGCONTEXT_H
2#define _ASM_POWERPC_SIGCONTEXT_H
3
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#include <linux/compiler.h>
11#include <asm/ptrace.h>
12#ifdef __powerpc64__
13#include <asm/elf.h>
14#endif
15
16struct sigcontext {
17 unsigned long _unused[4];
18 int signal;
19#ifdef __powerpc64__
20 int _pad0;
21#endif
22 unsigned long handler;
23 unsigned long oldmask;
24 struct pt_regs __user *regs;
25#ifdef __powerpc64__
26 elf_gregset_t gp_regs;
27 elf_fpregset_t fp_regs;
28/*
29 * To maintain compatibility with current implementations the sigcontext is
30 * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t)
31 * followed by an unstructured (vmx_reserve) field of 69 doublewords. This
32 * allows the array of vector registers to be quadword aligned independent of
33 * the alignment of the containing sigcontext or ucontext. It is the
34 * responsibility of the code setting the sigcontext to set this pointer to
35 * either NULL (if this processor does not support the VMX feature) or the
36 * address of the first quadword within the allocated (vmx_reserve) area.
37 *
38 * The pointer (v_regs) of vector type (elf_vrreg_t) is type compatible with
39 * an array of 34 quadword entries (elf_vrregset_t). The entries with
40 * indexes 0-31 contain the corresponding vector registers. The entry with
41 * index 32 contains the vscr as the last word (offset 12) within the
42 * quadword. This allows the vscr to be stored as either a quadword (since
43 * it must be copied via a vector register to/from storage) or as a word.
44 * The entry with index 33 contains the vrsave as the first word (offset 0)
45 * within the quadword.
46 *
47 * Part of the VSX data is stored here also by extending vmx_restore
48 * by an additional 32 double words. Architecturally the layout of
49 * the VSR registers and how they overlap on top of the legacy FPR and
50 * VR registers is shown below:
51 *
52 * VSR doubleword 0 VSR doubleword 1
53 * ----------------------------------------------------------------
54 * VSR[0] | FPR[0] | |
55 * ----------------------------------------------------------------
56 * VSR[1] | FPR[1] | |
57 * ----------------------------------------------------------------
58 * | ... | |
59 * | ... | |
60 * ----------------------------------------------------------------
61 * VSR[30] | FPR[30] | |
62 * ----------------------------------------------------------------
63 * VSR[31] | FPR[31] | |
64 * ----------------------------------------------------------------
65 * VSR[32] | VR[0] |
66 * ----------------------------------------------------------------
67 * VSR[33] | VR[1] |
68 * ----------------------------------------------------------------
69 * | ... |
70 * | ... |
71 * ----------------------------------------------------------------
72 * VSR[62] | VR[30] |
73 * ----------------------------------------------------------------
74 * VSR[63] | VR[31] |
75 * ----------------------------------------------------------------
76 *
77 * FPR/VSR 0-31 doubleword 0 is stored in fp_regs, and VMX/VSR 32-63
78 * is stored at the start of vmx_reserve. vmx_reserve is extended for
79 * backwards compatility to store VSR 0-31 doubleword 1 after the VMX
80 * registers and vscr/vrsave.
81 */
82 elf_vrreg_t __user *v_regs;
83 long vmx_reserve[ELF_NVRREG+ELF_NVRREG+32+1];
84#endif
85};
86
87#endif /* _ASM_POWERPC_SIGCONTEXT_H */
diff --git a/arch/powerpc/include/asm/siginfo.h b/arch/powerpc/include/asm/siginfo.h
new file mode 100644
index 000000000000..12f1bce037be
--- /dev/null
+++ b/arch/powerpc/include/asm/siginfo.h
@@ -0,0 +1,26 @@
1#ifndef _ASM_POWERPC_SIGINFO_H
2#define _ASM_POWERPC_SIGINFO_H
3
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#ifdef __powerpc64__
12# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
13# define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
14#endif
15
16#include <asm-generic/siginfo.h>
17
18/*
19 * SIGTRAP si_codes
20 */
21#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
22#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */
23#undef NSIGTRAP
24#define NSIGTRAP 4
25
26#endif /* _ASM_POWERPC_SIGINFO_H */
diff --git a/arch/powerpc/include/asm/signal.h b/arch/powerpc/include/asm/signal.h
new file mode 100644
index 000000000000..a7360cdd99eb
--- /dev/null
+++ b/arch/powerpc/include/asm/signal.h
@@ -0,0 +1,150 @@
1#ifndef _ASM_POWERPC_SIGNAL_H
2#define _ASM_POWERPC_SIGNAL_H
3
4#include <linux/types.h>
5
6#define _NSIG 64
7#ifdef __powerpc64__
8#define _NSIG_BPW 64
9#else
10#define _NSIG_BPW 32
11#endif
12#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
13
14typedef unsigned long old_sigset_t; /* at least 32 bits */
15
16typedef struct {
17 unsigned long sig[_NSIG_WORDS];
18} sigset_t;
19
20#define SIGHUP 1
21#define SIGINT 2
22#define SIGQUIT 3
23#define SIGILL 4
24#define SIGTRAP 5
25#define SIGABRT 6
26#define SIGIOT 6
27#define SIGBUS 7
28#define SIGFPE 8
29#define SIGKILL 9
30#define SIGUSR1 10
31#define SIGSEGV 11
32#define SIGUSR2 12
33#define SIGPIPE 13
34#define SIGALRM 14
35#define SIGTERM 15
36#define SIGSTKFLT 16
37#define SIGCHLD 17
38#define SIGCONT 18
39#define SIGSTOP 19
40#define SIGTSTP 20
41#define SIGTTIN 21
42#define SIGTTOU 22
43#define SIGURG 23
44#define SIGXCPU 24
45#define SIGXFSZ 25
46#define SIGVTALRM 26
47#define SIGPROF 27
48#define SIGWINCH 28
49#define SIGIO 29
50#define SIGPOLL SIGIO
51/*
52#define SIGLOST 29
53*/
54#define SIGPWR 30
55#define SIGSYS 31
56#define SIGUNUSED 31
57
58/* These should not be considered constants from userland. */
59#define SIGRTMIN 32
60#define SIGRTMAX _NSIG
61
62/*
63 * SA_FLAGS values:
64 *
65 * SA_ONSTACK is not currently supported, but will allow sigaltstack(2).
66 * SA_RESTART flag to get restarting signals (which were the default long ago)
67 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
68 * SA_RESETHAND clears the handler when the signal is delivered.
69 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
70 * SA_NODEFER prevents the current signal from being masked in the handler.
71 *
72 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
73 * Unix names RESETHAND and NODEFER respectively.
74 */
75#define SA_NOCLDSTOP 0x00000001U
76#define SA_NOCLDWAIT 0x00000002U
77#define SA_SIGINFO 0x00000004U
78#define SA_ONSTACK 0x08000000U
79#define SA_RESTART 0x10000000U
80#define SA_NODEFER 0x40000000U
81#define SA_RESETHAND 0x80000000U
82
83#define SA_NOMASK SA_NODEFER
84#define SA_ONESHOT SA_RESETHAND
85
86#define SA_RESTORER 0x04000000U
87
88/*
89 * sigaltstack controls
90 */
91#define SS_ONSTACK 1
92#define SS_DISABLE 2
93
94#define MINSIGSTKSZ 2048
95#define SIGSTKSZ 8192
96
97#include <asm-generic/signal.h>
98
99struct old_sigaction {
100 __sighandler_t sa_handler;
101 old_sigset_t sa_mask;
102 unsigned long sa_flags;
103 __sigrestore_t sa_restorer;
104};
105
106struct sigaction {
107 __sighandler_t sa_handler;
108 unsigned long sa_flags;
109 __sigrestore_t sa_restorer;
110 sigset_t sa_mask; /* mask last for extensibility */
111};
112
113struct k_sigaction {
114 struct sigaction sa;
115};
116
117typedef struct sigaltstack {
118 void __user *ss_sp;
119 int ss_flags;
120 size_t ss_size;
121} stack_t;
122
123#ifdef __KERNEL__
124struct pt_regs;
125extern void do_signal(struct pt_regs *regs, unsigned long thread_info_flags);
126#define ptrace_signal_deliver(regs, cookie) do { } while (0)
127#endif /* __KERNEL__ */
128
129#ifndef __powerpc64__
130/*
131 * These are parameters to dbg_sigreturn syscall. They enable or
132 * disable certain debugging things that can be done from signal
133 * handlers. The dbg_sigreturn syscall *must* be called from a
134 * SA_SIGINFO signal so the ucontext can be passed to it. It takes an
135 * array of struct sig_dbg_op, which has the debug operations to
136 * perform before returning from the signal.
137 */
138struct sig_dbg_op {
139 int dbg_type;
140 unsigned long dbg_value;
141};
142
143/* Enable or disable single-stepping. The value sets the state. */
144#define SIG_DBG_SINGLE_STEPPING 1
145
146/* Enable or disable branch tracing. The value sets the state. */
147#define SIG_DBG_BRANCH_TRACING 2
148#endif /* ! __powerpc64__ */
149
150#endif /* _ASM_POWERPC_SIGNAL_H */
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
new file mode 100644
index 000000000000..4d28e1e4521b
--- /dev/null
+++ b/arch/powerpc/include/asm/smp.h
@@ -0,0 +1,127 @@
1/*
2 * smp.h: PowerPC-specific SMP code.
3 *
4 * Original was a copy of sparc smp.h. Now heavily modified
5 * for PPC.
6 *
7 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
8 * Copyright (C) 1996-2001 Cort Dougan <cort@fsmlabs.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#ifndef _ASM_POWERPC_SMP_H
17#define _ASM_POWERPC_SMP_H
18#ifdef __KERNEL__
19
20#include <linux/threads.h>
21#include <linux/cpumask.h>
22#include <linux/kernel.h>
23
24#ifndef __ASSEMBLY__
25
26#ifdef CONFIG_PPC64
27#include <asm/paca.h>
28#endif
29#include <asm/percpu.h>
30
31extern int boot_cpuid;
32
33extern void cpu_die(void);
34
35#ifdef CONFIG_SMP
36
37extern void smp_send_debugger_break(int cpu);
38extern void smp_message_recv(int);
39
40DECLARE_PER_CPU(unsigned int, pvr);
41
42#ifdef CONFIG_HOTPLUG_CPU
43extern void fixup_irqs(cpumask_t map);
44int generic_cpu_disable(void);
45int generic_cpu_enable(unsigned int cpu);
46void generic_cpu_die(unsigned int cpu);
47void generic_mach_cpu_die(void);
48#endif
49
50#ifdef CONFIG_PPC64
51#define raw_smp_processor_id() (local_paca->paca_index)
52#define hard_smp_processor_id() (get_paca()->hw_cpu_id)
53#else
54/* 32-bit */
55extern int smp_hw_index[];
56
57#define raw_smp_processor_id() (current_thread_info()->cpu)
58#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
59#define get_hard_smp_processor_id(cpu) (smp_hw_index[(cpu)])
60#define set_hard_smp_processor_id(cpu, phys)\
61 (smp_hw_index[(cpu)] = (phys))
62#endif
63
64DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
65DECLARE_PER_CPU(cpumask_t, cpu_core_map);
66extern int cpu_to_core_id(int cpu);
67
68/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
69 *
70 * Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up
71 * in /proc/interrupts will be wrong!!! --Troy */
72#define PPC_MSG_CALL_FUNCTION 0
73#define PPC_MSG_RESCHEDULE 1
74#define PPC_MSG_CALL_FUNC_SINGLE 2
75#define PPC_MSG_DEBUGGER_BREAK 3
76
77void smp_init_iSeries(void);
78void smp_init_pSeries(void);
79void smp_init_cell(void);
80void smp_init_celleb(void);
81void smp_setup_cpu_maps(void);
82void smp_setup_cpu_sibling_map(void);
83
84extern int __cpu_disable(void);
85extern void __cpu_die(unsigned int cpu);
86
87#else
88/* for UP */
89#define hard_smp_processor_id() 0
90#define smp_setup_cpu_maps()
91
92#endif /* CONFIG_SMP */
93
94#ifdef CONFIG_PPC64
95#define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id)
96#define set_hard_smp_processor_id(CPU, VAL) \
97 do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0)
98
99extern void smp_release_cpus(void);
100
101#else
102/* 32-bit */
103#ifndef CONFIG_SMP
104extern int boot_cpuid_phys;
105#define get_hard_smp_processor_id(cpu) boot_cpuid_phys
106#define set_hard_smp_processor_id(cpu, phys)
107#endif
108#endif
109
110extern int smt_enabled_at_boot;
111
112extern int smp_mpic_probe(void);
113extern void smp_mpic_setup_cpu(int cpu);
114extern void smp_generic_kick_cpu(int nr);
115
116extern void smp_generic_give_timebase(void);
117extern void smp_generic_take_timebase(void);
118
119extern struct smp_ops_t *smp_ops;
120
121extern void arch_send_call_function_single_ipi(int cpu);
122extern void arch_send_call_function_ipi(cpumask_t mask);
123
124#endif /* __ASSEMBLY__ */
125
126#endif /* __KERNEL__ */
127#endif /* _ASM_POWERPC_SMP_H) */
diff --git a/arch/powerpc/include/asm/smu.h b/arch/powerpc/include/asm/smu.h
new file mode 100644
index 000000000000..7ae2753da565
--- /dev/null
+++ b/arch/powerpc/include/asm/smu.h
@@ -0,0 +1,700 @@
1#ifndef _SMU_H
2#define _SMU_H
3
4/*
5 * Definitions for talking to the SMU chip in newer G5 PowerMacs
6 */
7#ifdef __KERNEL__
8#include <linux/list.h>
9#endif
10#include <linux/types.h>
11
12/*
13 * Known SMU commands
14 *
15 * Most of what is below comes from looking at the Open Firmware driver,
16 * though this is still incomplete and could use better documentation here
17 * or there...
18 */
19
20
21/*
22 * Partition info commands
23 *
24 * These commands are used to retrieve the sdb-partition-XX datas from
25 * the SMU. The length is always 2. First byte is the subcommand code
26 * and second byte is the partition ID.
27 *
28 * The reply is 6 bytes:
29 *
30 * - 0..1 : partition address
31 * - 2 : a byte containing the partition ID
32 * - 3 : length (maybe other bits are rest of header ?)
33 *
34 * The data must then be obtained with calls to another command:
35 * SMU_CMD_MISC_ee_GET_DATABLOCK_REC (described below).
36 */
37#define SMU_CMD_PARTITION_COMMAND 0x3e
38#define SMU_CMD_PARTITION_LATEST 0x01
39#define SMU_CMD_PARTITION_BASE 0x02
40#define SMU_CMD_PARTITION_UPDATE 0x03
41
42
43/*
44 * Fan control
45 *
46 * This is a "mux" for fan control commands. The command seem to
47 * act differently based on the number of arguments. With 1 byte
48 * of argument, this seem to be queries for fans status, setpoint,
49 * etc..., while with 0xe arguments, we will set the fans speeds.
50 *
51 * Queries (1 byte arg):
52 * ---------------------
53 *
54 * arg=0x01: read RPM fans status
55 * arg=0x02: read RPM fans setpoint
56 * arg=0x11: read PWM fans status
57 * arg=0x12: read PWM fans setpoint
58 *
59 * the "status" queries return the current speed while the "setpoint" ones
60 * return the programmed/target speed. It _seems_ that the result is a bit
61 * mask in the first byte of active/available fans, followed by 6 words (16
62 * bits) containing the requested speed.
63 *
64 * Setpoint (14 bytes arg):
65 * ------------------------
66 *
67 * first arg byte is 0 for RPM fans and 0x10 for PWM. Second arg byte is the
68 * mask of fans affected by the command. Followed by 6 words containing the
69 * setpoint value for selected fans in the mask (or 0 if mask value is 0)
70 */
71#define SMU_CMD_FAN_COMMAND 0x4a
72
73
74/*
75 * Battery access
76 *
77 * Same command number as the PMU, could it be same syntax ?
78 */
79#define SMU_CMD_BATTERY_COMMAND 0x6f
80#define SMU_CMD_GET_BATTERY_INFO 0x00
81
82/*
83 * Real time clock control
84 *
85 * This is a "mux", first data byte contains the "sub" command.
86 * The "RTC" part of the SMU controls the date, time, powerup
87 * timer, but also a PRAM
88 *
89 * Dates are in BCD format on 7 bytes:
90 * [sec] [min] [hour] [weekday] [month day] [month] [year]
91 * with month being 1 based and year minus 100
92 */
93#define SMU_CMD_RTC_COMMAND 0x8e
94#define SMU_CMD_RTC_SET_PWRUP_TIMER 0x00 /* i: 7 bytes date */
95#define SMU_CMD_RTC_GET_PWRUP_TIMER 0x01 /* o: 7 bytes date */
96#define SMU_CMD_RTC_STOP_PWRUP_TIMER 0x02
97#define SMU_CMD_RTC_SET_PRAM_BYTE_ACC 0x20 /* i: 1 byte (address?) */
98#define SMU_CMD_RTC_SET_PRAM_AUTOINC 0x21 /* i: 1 byte (data?) */
99#define SMU_CMD_RTC_SET_PRAM_LO_BYTES 0x22 /* i: 10 bytes */
100#define SMU_CMD_RTC_SET_PRAM_HI_BYTES 0x23 /* i: 10 bytes */
101#define SMU_CMD_RTC_GET_PRAM_BYTE 0x28 /* i: 1 bytes (address?) */
102#define SMU_CMD_RTC_GET_PRAM_LO_BYTES 0x29 /* o: 10 bytes */
103#define SMU_CMD_RTC_GET_PRAM_HI_BYTES 0x2a /* o: 10 bytes */
104#define SMU_CMD_RTC_SET_DATETIME 0x80 /* i: 7 bytes date */
105#define SMU_CMD_RTC_GET_DATETIME 0x81 /* o: 7 bytes date */
106
107 /*
108 * i2c commands
109 *
110 * To issue an i2c command, first is to send a parameter block to the
111 * the SMU. This is a command of type 0x9a with 9 bytes of header
112 * eventually followed by data for a write:
113 *
114 * 0: bus number (from device-tree usually, SMU has lots of busses !)
115 * 1: transfer type/format (see below)
116 * 2: device address. For combined and combined4 type transfers, this
117 * is the "write" version of the address (bit 0x01 cleared)
118 * 3: subaddress length (0..3)
119 * 4: subaddress byte 0 (or only byte for subaddress length 1)
120 * 5: subaddress byte 1
121 * 6: subaddress byte 2
122 * 7: combined address (device address for combined mode data phase)
123 * 8: data length
124 *
125 * The transfer types are the same good old Apple ones it seems,
126 * that is:
127 * - 0x00: Simple transfer
128 * - 0x01: Subaddress transfer (addr write + data tx, no restart)
129 * - 0x02: Combined transfer (addr write + restart + data tx)
130 *
131 * This is then followed by actual data for a write.
132 *
133 * At this point, the OF driver seems to have a limitation on transfer
134 * sizes of 0xd bytes on reads and 0x5 bytes on writes. I do not know
135 * wether this is just an OF limit due to some temporary buffer size
136 * or if this is an SMU imposed limit. This driver has the same limitation
137 * for now as I use a 0x10 bytes temporary buffer as well
138 *
139 * Once that is completed, a response is expected from the SMU. This is
140 * obtained via a command of type 0x9a with a length of 1 byte containing
141 * 0 as the data byte. OF also fills the rest of the data buffer with 0xff's
142 * though I can't tell yet if this is actually necessary. Once this command
143 * is complete, at this point, all I can tell is what OF does. OF tests
144 * byte 0 of the reply:
145 * - on read, 0xfe or 0xfc : bus is busy, wait (see below) or nak ?
146 * - on read, 0x00 or 0x01 : reply is in buffer (after the byte 0)
147 * - on write, < 0 -> failure (immediate exit)
148 * - else, OF just exists (without error, weird)
149 *
150 * So on read, there is this wait-for-busy thing when getting a 0xfc or
151 * 0xfe result. OF does a loop of up to 64 retries, waiting 20ms and
152 * doing the above again until either the retries expire or the result
153 * is no longer 0xfe or 0xfc
154 *
155 * The Darwin I2C driver is less subtle though. On any non-success status
156 * from the response command, it waits 5ms and tries again up to 20 times,
157 * it doesn't differenciate between fatal errors or "busy" status.
158 *
159 * This driver provides an asynchronous paramblock based i2c command
160 * interface to be used either directly by low level code or by a higher
161 * level driver interfacing to the linux i2c layer. The current
162 * implementation of this relies on working timers & timer interrupts
163 * though, so be careful of calling context for now. This may be "fixed"
164 * in the future by adding a polling facility.
165 */
166#define SMU_CMD_I2C_COMMAND 0x9a
167 /* transfer types */
168#define SMU_I2C_TRANSFER_SIMPLE 0x00
169#define SMU_I2C_TRANSFER_STDSUB 0x01
170#define SMU_I2C_TRANSFER_COMBINED 0x02
171
172/*
173 * Power supply control
174 *
175 * The "sub" command is an ASCII string in the data, the
176 * data length is that of the string.
177 *
178 * The VSLEW command can be used to get or set the voltage slewing.
179 * - length 5 (only "VSLEW") : it returns "DONE" and 3 bytes of
180 * reply at data offset 6, 7 and 8.
181 * - length 8 ("VSLEWxyz") has 3 additional bytes appended, and is
182 * used to set the voltage slewing point. The SMU replies with "DONE"
183 * I yet have to figure out their exact meaning of those 3 bytes in
184 * both cases. They seem to be:
185 * x = processor mask
186 * y = op. point index
187 * z = processor freq. step index
188 * I haven't yet decyphered result codes
189 *
190 */
191#define SMU_CMD_POWER_COMMAND 0xaa
192#define SMU_CMD_POWER_RESTART "RESTART"
193#define SMU_CMD_POWER_SHUTDOWN "SHUTDOWN"
194#define SMU_CMD_POWER_VOLTAGE_SLEW "VSLEW"
195
196/*
197 * Read ADC sensors
198 *
199 * This command takes one byte of parameter: the sensor ID (or "reg"
200 * value in the device-tree) and returns a 16 bits value
201 */
202#define SMU_CMD_READ_ADC 0xd8
203
204
205/* Misc commands
206 *
207 * This command seem to be a grab bag of various things
208 *
209 * Parameters:
210 * 1: subcommand
211 */
212#define SMU_CMD_MISC_df_COMMAND 0xdf
213
214/*
215 * Sets "system ready" status
216 *
217 * I did not yet understand how it exactly works or what it does.
218 *
219 * Guessing from OF code, 0x02 activates the display backlight. Apple uses/used
220 * the same codebase for all OF versions. On PowerBooks, this command would
221 * enable the backlight. For the G5s, it only activates the front LED. However,
222 * don't take this for granted.
223 *
224 * Parameters:
225 * 2: status [0x00, 0x01 or 0x02]
226 */
227#define SMU_CMD_MISC_df_SET_DISPLAY_LIT 0x02
228
229/*
230 * Sets mode of power switch.
231 *
232 * What this actually does is not yet known. Maybe it enables some interrupt.
233 *
234 * Parameters:
235 * 2: enable power switch? [0x00 or 0x01]
236 * 3 (optional): enable nmi? [0x00 or 0x01]
237 *
238 * Returns:
239 * If parameter 2 is 0x00 and parameter 3 is not specified, returns wether
240 * NMI is enabled. Otherwise unknown.
241 */
242#define SMU_CMD_MISC_df_NMI_OPTION 0x04
243
244/* Sets LED dimm offset.
245 *
246 * The front LED dimms itself during sleep. Its brightness (or, well, the PWM
247 * frequency) depends on current time. Therefore, the SMU needs to know the
248 * timezone.
249 *
250 * Parameters:
251 * 2-8: unknown (BCD coding)
252 */
253#define SMU_CMD_MISC_df_DIMM_OFFSET 0x99
254
255
256/*
257 * Version info commands
258 *
259 * Parameters:
260 * 1 (optional): Specifies version part to retrieve
261 *
262 * Returns:
263 * Version value
264 */
265#define SMU_CMD_VERSION_COMMAND 0xea
266#define SMU_VERSION_RUNNING 0x00
267#define SMU_VERSION_BASE 0x01
268#define SMU_VERSION_UPDATE 0x02
269
270
271/*
272 * Switches
273 *
274 * These are switches whose status seems to be known to the SMU.
275 *
276 * Parameters:
277 * none
278 *
279 * Result:
280 * Switch bits (ORed, see below)
281 */
282#define SMU_CMD_SWITCHES 0xdc
283
284/* Switches bits */
285#define SMU_SWITCH_CASE_CLOSED 0x01
286#define SMU_SWITCH_AC_POWER 0x04
287#define SMU_SWITCH_POWER_SWITCH 0x08
288
289
290/*
291 * Misc commands
292 *
293 * This command seem to be a grab bag of various things
294 *
295 * SMU_CMD_MISC_ee_GET_DATABLOCK_REC is used, among others, to
296 * transfer blocks of data from the SMU. So far, I've decrypted it's
297 * usage to retrieve partition data. In order to do that, you have to
298 * break your transfer in "chunks" since that command cannot transfer
299 * more than a chunk at a time. The chunk size used by OF is 0xe bytes,
300 * but it seems that the darwin driver will let you do 0x1e bytes if
301 * your "PMU" version is >= 0x30. You can get the "PMU" version apparently
302 * either in the last 16 bits of property "smu-version-pmu" or as the 16
303 * bytes at offset 1 of "smu-version-info"
304 *
305 * For each chunk, the command takes 7 bytes of arguments:
306 * byte 0: subcommand code (0x02)
307 * byte 1: 0x04 (always, I don't know what it means, maybe the address
308 * space to use or some other nicety. It's hard coded in OF)
309 * byte 2..5: SMU address of the chunk (big endian 32 bits)
310 * byte 6: size to transfer (up to max chunk size)
311 *
312 * The data is returned directly
313 */
314#define SMU_CMD_MISC_ee_COMMAND 0xee
315#define SMU_CMD_MISC_ee_GET_DATABLOCK_REC 0x02
316
317/* Retrieves currently used watts.
318 *
319 * Parameters:
320 * 1: 0x03 (Meaning unknown)
321 */
322#define SMU_CMD_MISC_ee_GET_WATTS 0x03
323
324#define SMU_CMD_MISC_ee_LEDS_CTRL 0x04 /* i: 00 (00,01) [00] */
325#define SMU_CMD_MISC_ee_GET_DATA 0x05 /* i: 00 , o: ?? */
326
327
328/*
329 * Power related commands
330 *
331 * Parameters:
332 * 1: subcommand
333 */
334#define SMU_CMD_POWER_EVENTS_COMMAND 0x8f
335
336/* SMU_POWER_EVENTS subcommands */
337enum {
338 SMU_PWR_GET_POWERUP_EVENTS = 0x00,
339 SMU_PWR_SET_POWERUP_EVENTS = 0x01,
340 SMU_PWR_CLR_POWERUP_EVENTS = 0x02,
341 SMU_PWR_GET_WAKEUP_EVENTS = 0x03,
342 SMU_PWR_SET_WAKEUP_EVENTS = 0x04,
343 SMU_PWR_CLR_WAKEUP_EVENTS = 0x05,
344
345 /*
346 * Get last shutdown cause
347 *
348 * Returns:
349 * 1 byte (signed char): Last shutdown cause. Exact meaning unknown.
350 */
351 SMU_PWR_LAST_SHUTDOWN_CAUSE = 0x07,
352
353 /*
354 * Sets or gets server ID. Meaning or use is unknown.
355 *
356 * Parameters:
357 * 2 (optional): Set server ID (1 byte)
358 *
359 * Returns:
360 * 1 byte (server ID?)
361 */
362 SMU_PWR_SERVER_ID = 0x08,
363};
364
365/* Power events wakeup bits */
366enum {
367 SMU_PWR_WAKEUP_KEY = 0x01, /* Wake on key press */
368 SMU_PWR_WAKEUP_AC_INSERT = 0x02, /* Wake on AC adapter plug */
369 SMU_PWR_WAKEUP_AC_CHANGE = 0x04,
370 SMU_PWR_WAKEUP_LID_OPEN = 0x08,
371 SMU_PWR_WAKEUP_RING = 0x10,
372};
373
374
375/*
376 * - Kernel side interface -
377 */
378
379#ifdef __KERNEL__
380
381/*
382 * Asynchronous SMU commands
383 *
384 * Fill up this structure and submit it via smu_queue_command(),
385 * and get notified by the optional done() callback, or because
386 * status becomes != 1
387 */
388
389struct smu_cmd;
390
391struct smu_cmd
392{
393 /* public */
394 u8 cmd; /* command */
395 int data_len; /* data len */
396 int reply_len; /* reply len */
397 void *data_buf; /* data buffer */
398 void *reply_buf; /* reply buffer */
399 int status; /* command status */
400 void (*done)(struct smu_cmd *cmd, void *misc);
401 void *misc;
402
403 /* private */
404 struct list_head link;
405};
406
407/*
408 * Queues an SMU command, all fields have to be initialized
409 */
410extern int smu_queue_cmd(struct smu_cmd *cmd);
411
412/*
413 * Simple command wrapper. This structure embeds a small buffer
414 * to ease sending simple SMU commands from the stack
415 */
416struct smu_simple_cmd
417{
418 struct smu_cmd cmd;
419 u8 buffer[16];
420};
421
422/*
423 * Queues a simple command. All fields will be initialized by that
424 * function
425 */
426extern int smu_queue_simple(struct smu_simple_cmd *scmd, u8 command,
427 unsigned int data_len,
428 void (*done)(struct smu_cmd *cmd, void *misc),
429 void *misc,
430 ...);
431
432/*
433 * Completion helper. Pass it to smu_queue_simple or as 'done'
434 * member to smu_queue_cmd, it will call complete() on the struct
435 * completion passed in the "misc" argument
436 */
437extern void smu_done_complete(struct smu_cmd *cmd, void *misc);
438
439/*
440 * Synchronous helpers. Will spin-wait for completion of a command
441 */
442extern void smu_spinwait_cmd(struct smu_cmd *cmd);
443
444static inline void smu_spinwait_simple(struct smu_simple_cmd *scmd)
445{
446 smu_spinwait_cmd(&scmd->cmd);
447}
448
449/*
450 * Poll routine to call if blocked with irqs off
451 */
452extern void smu_poll(void);
453
454
455/*
456 * Init routine, presence check....
457 */
458extern int smu_init(void);
459extern int smu_present(void);
460struct of_device;
461extern struct of_device *smu_get_ofdev(void);
462
463
464/*
465 * Common command wrappers
466 */
467extern void smu_shutdown(void);
468extern void smu_restart(void);
469struct rtc_time;
470extern int smu_get_rtc_time(struct rtc_time *time, int spinwait);
471extern int smu_set_rtc_time(struct rtc_time *time, int spinwait);
472
473/*
474 * SMU command buffer absolute address, exported by pmac_setup,
475 * this is allocated very early during boot.
476 */
477extern unsigned long smu_cmdbuf_abs;
478
479
480/*
481 * Kenrel asynchronous i2c interface
482 */
483
484#define SMU_I2C_READ_MAX 0x1d
485#define SMU_I2C_WRITE_MAX 0x15
486
487/* SMU i2c header, exactly matches i2c header on wire */
488struct smu_i2c_param
489{
490 u8 bus; /* SMU bus ID (from device tree) */
491 u8 type; /* i2c transfer type */
492 u8 devaddr; /* device address (includes direction) */
493 u8 sublen; /* subaddress length */
494 u8 subaddr[3]; /* subaddress */
495 u8 caddr; /* combined address, filled by SMU driver */
496 u8 datalen; /* length of transfer */
497 u8 data[SMU_I2C_READ_MAX]; /* data */
498};
499
500struct smu_i2c_cmd
501{
502 /* public */
503 struct smu_i2c_param info;
504 void (*done)(struct smu_i2c_cmd *cmd, void *misc);
505 void *misc;
506 int status; /* 1 = pending, 0 = ok, <0 = fail */
507
508 /* private */
509 struct smu_cmd scmd;
510 int read;
511 int stage;
512 int retries;
513 u8 pdata[32];
514 struct list_head link;
515};
516
517/*
518 * Call this to queue an i2c command to the SMU. You must fill info,
519 * including info.data for a write, done and misc.
520 * For now, no polling interface is provided so you have to use completion
521 * callback.
522 */
523extern int smu_queue_i2c(struct smu_i2c_cmd *cmd);
524
525
526#endif /* __KERNEL__ */
527
528
529/*
530 * - SMU "sdb" partitions informations -
531 */
532
533
534/*
535 * Partition header format
536 */
537struct smu_sdbp_header {
538 __u8 id;
539 __u8 len;
540 __u8 version;
541 __u8 flags;
542};
543
544
545 /*
546 * demangle 16 and 32 bits integer in some SMU partitions
547 * (currently, afaik, this concerns only the FVT partition
548 * (0x12)
549 */
550#define SMU_U16_MIX(x) le16_to_cpu(x);
551#define SMU_U32_MIX(x) ((((x) & 0xff00ff00u) >> 8)|(((x) & 0x00ff00ffu) << 8))
552
553
554/* This is the definition of the SMU sdb-partition-0x12 table (called
555 * CPU F/V/T operating points in Darwin). The definition for all those
556 * SMU tables should be moved to some separate file
557 */
558#define SMU_SDB_FVT_ID 0x12
559
560struct smu_sdbp_fvt {
561 __u32 sysclk; /* Base SysClk frequency in Hz for
562 * this operating point. Value need to
563 * be unmixed with SMU_U32_MIX()
564 */
565 __u8 pad;
566 __u8 maxtemp; /* Max temp. supported by this
567 * operating point
568 */
569
570 __u16 volts[3]; /* CPU core voltage for the 3
571 * PowerTune modes, a mode with
572 * 0V = not supported. Value need
573 * to be unmixed with SMU_U16_MIX()
574 */
575};
576
577/* This partition contains voltage & current sensor calibration
578 * informations
579 */
580#define SMU_SDB_CPUVCP_ID 0x21
581
582struct smu_sdbp_cpuvcp {
583 __u16 volt_scale; /* u4.12 fixed point */
584 __s16 volt_offset; /* s4.12 fixed point */
585 __u16 curr_scale; /* u4.12 fixed point */
586 __s16 curr_offset; /* s4.12 fixed point */
587 __s32 power_quads[3]; /* s4.28 fixed point */
588};
589
590/* This partition contains CPU thermal diode calibration
591 */
592#define SMU_SDB_CPUDIODE_ID 0x18
593
594struct smu_sdbp_cpudiode {
595 __u16 m_value; /* u1.15 fixed point */
596 __s16 b_value; /* s10.6 fixed point */
597
598};
599
600/* This partition contains Slots power calibration
601 */
602#define SMU_SDB_SLOTSPOW_ID 0x78
603
604struct smu_sdbp_slotspow {
605 __u16 pow_scale; /* u4.12 fixed point */
606 __s16 pow_offset; /* s4.12 fixed point */
607};
608
609/* This partition contains machine specific version information about
610 * the sensor/control layout
611 */
612#define SMU_SDB_SENSORTREE_ID 0x25
613
614struct smu_sdbp_sensortree {
615 __u8 model_id;
616 __u8 unknown[3];
617};
618
619/* This partition contains CPU thermal control PID informations. So far
620 * only single CPU machines have been seen with an SMU, so we assume this
621 * carries only informations for those
622 */
623#define SMU_SDB_CPUPIDDATA_ID 0x17
624
625struct smu_sdbp_cpupiddata {
626 __u8 unknown1;
627 __u8 target_temp_delta;
628 __u8 unknown2;
629 __u8 history_len;
630 __s16 power_adj;
631 __u16 max_power;
632 __s32 gp,gr,gd;
633};
634
635
636/* Other partitions without known structures */
637#define SMU_SDB_DEBUG_SWITCHES_ID 0x05
638
639#ifdef __KERNEL__
640/*
641 * This returns the pointer to an SMU "sdb" partition data or NULL
642 * if not found. The data format is described below
643 */
644extern const struct smu_sdbp_header *smu_get_sdb_partition(int id,
645 unsigned int *size);
646
647/* Get "sdb" partition data from an SMU satellite */
648extern struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id,
649 int id, unsigned int *size);
650
651
652#endif /* __KERNEL__ */
653
654
655/*
656 * - Userland interface -
657 */
658
659/*
660 * A given instance of the device can be configured for 2 different
661 * things at the moment:
662 *
663 * - sending SMU commands (default at open() time)
664 * - receiving SMU events (not yet implemented)
665 *
666 * Commands are written with write() of a command block. They can be
667 * "driver" commands (for example to switch to event reception mode)
668 * or real SMU commands. They are made of a header followed by command
669 * data if any.
670 *
671 * For SMU commands (not for driver commands), you can then read() back
672 * a reply. The reader will be blocked or not depending on how the device
673 * file is opened. poll() isn't implemented yet. The reply will consist
674 * of a header as well, followed by the reply data if any. You should
675 * always provide a buffer large enough for the maximum reply data, I
676 * recommand one page.
677 *
678 * It is illegal to send SMU commands through a file descriptor configured
679 * for events reception
680 *
681 */
682struct smu_user_cmd_hdr
683{
684 __u32 cmdtype;
685#define SMU_CMDTYPE_SMU 0 /* SMU command */
686#define SMU_CMDTYPE_WANTS_EVENTS 1 /* switch fd to events mode */
687#define SMU_CMDTYPE_GET_PARTITION 2 /* retrieve an sdb partition */
688
689 __u8 cmd; /* SMU command byte */
690 __u8 pad[3]; /* padding */
691 __u32 data_len; /* Length of data following */
692};
693
694struct smu_user_reply_hdr
695{
696 __u32 status; /* Command status */
697 __u32 reply_len; /* Length of data follwing */
698};
699
700#endif /* _SMU_H */
diff --git a/arch/powerpc/include/asm/socket.h b/arch/powerpc/include/asm/socket.h
new file mode 100644
index 000000000000..f5a4e168e498
--- /dev/null
+++ b/arch/powerpc/include/asm/socket.h
@@ -0,0 +1,64 @@
1#ifndef _ASM_POWERPC_SOCKET_H
2#define _ASM_POWERPC_SOCKET_H
3
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#include <asm/sockios.h>
12
13/* For setsockopt(2) */
14#define SOL_SOCKET 1
15
16#define SO_DEBUG 1
17#define SO_REUSEADDR 2
18#define SO_TYPE 3
19#define SO_ERROR 4
20#define SO_DONTROUTE 5
21#define SO_BROADCAST 6
22#define SO_SNDBUF 7
23#define SO_RCVBUF 8
24#define SO_SNDBUFFORCE 32
25#define SO_RCVBUFFORCE 33
26#define SO_KEEPALIVE 9
27#define SO_OOBINLINE 10
28#define SO_NO_CHECK 11
29#define SO_PRIORITY 12
30#define SO_LINGER 13
31#define SO_BSDCOMPAT 14
32/* To add :#define SO_REUSEPORT 15 */
33#define SO_RCVLOWAT 16
34#define SO_SNDLOWAT 17
35#define SO_RCVTIMEO 18
36#define SO_SNDTIMEO 19
37#define SO_PASSCRED 20
38#define SO_PEERCRED 21
39
40/* Security levels - as per NRL IPv6 - don't actually do anything */
41#define SO_SECURITY_AUTHENTICATION 22
42#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
43#define SO_SECURITY_ENCRYPTION_NETWORK 24
44
45#define SO_BINDTODEVICE 25
46
47/* Socket filtering */
48#define SO_ATTACH_FILTER 26
49#define SO_DETACH_FILTER 27
50
51#define SO_PEERNAME 28
52#define SO_TIMESTAMP 29
53#define SCM_TIMESTAMP SO_TIMESTAMP
54
55#define SO_ACCEPTCONN 30
56
57#define SO_PEERSEC 31
58#define SO_PASSSEC 34
59#define SO_TIMESTAMPNS 35
60#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
61
62#define SO_MARK 36
63
64#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/arch/powerpc/include/asm/sockios.h b/arch/powerpc/include/asm/sockios.h
new file mode 100644
index 000000000000..55cef7675a31
--- /dev/null
+++ b/arch/powerpc/include/asm/sockios.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_POWERPC_SOCKIOS_H
2#define _ASM_POWERPC_SOCKIOS_H
3
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/* Socket-level I/O control calls. */
12#define FIOSETOWN 0x8901
13#define SIOCSPGRP 0x8902
14#define FIOGETOWN 0x8903
15#define SIOCGPGRP 0x8904
16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
18#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
19
20#endif /* _ASM_POWERPC_SOCKIOS_H */
diff --git a/arch/powerpc/include/asm/sparsemem.h b/arch/powerpc/include/asm/sparsemem.h
new file mode 100644
index 000000000000..54a47ea2c3aa
--- /dev/null
+++ b/arch/powerpc/include/asm/sparsemem.h
@@ -0,0 +1,32 @@
1#ifndef _ASM_POWERPC_SPARSEMEM_H
2#define _ASM_POWERPC_SPARSEMEM_H 1
3#ifdef __KERNEL__
4
5#ifdef CONFIG_SPARSEMEM
6/*
7 * SECTION_SIZE_BITS 2^N: how big each section will be
8 * MAX_PHYSADDR_BITS 2^N: how much physical address space we have
9 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
10 */
11#define SECTION_SIZE_BITS 24
12
13#define MAX_PHYSADDR_BITS 44
14#define MAX_PHYSMEM_BITS 44
15
16#endif /* CONFIG_SPARSEMEM */
17
18#ifdef CONFIG_MEMORY_HOTPLUG
19extern void create_section_mapping(unsigned long start, unsigned long end);
20extern int remove_section_mapping(unsigned long start, unsigned long end);
21#ifdef CONFIG_NUMA
22extern int hot_add_scn_to_nid(unsigned long scn_addr);
23#else
24static inline int hot_add_scn_to_nid(unsigned long scn_addr)
25{
26 return 0;
27}
28#endif /* CONFIG_NUMA */
29#endif /* CONFIG_MEMORY_HOTPLUG */
30
31#endif /* __KERNEL__ */
32#endif /* _ASM_POWERPC_SPARSEMEM_H */
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
new file mode 100644
index 000000000000..f56a843f4705
--- /dev/null
+++ b/arch/powerpc/include/asm/spinlock.h
@@ -0,0 +1,295 @@
1#ifndef __ASM_SPINLOCK_H
2#define __ASM_SPINLOCK_H
3#ifdef __KERNEL__
4
5/*
6 * Simple spin lock operations.
7 *
8 * Copyright (C) 2001-2004 Paul Mackerras <paulus@au.ibm.com>, IBM
9 * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM
10 * Copyright (C) 2002 Dave Engebretsen <engebret@us.ibm.com>, IBM
11 * Rework to support virtual processors
12 *
13 * Type of int is used as a full 64b word is not necessary.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 *
20 * (the type definitions are in asm/spinlock_types.h)
21 */
22#include <linux/irqflags.h>
23#ifdef CONFIG_PPC64
24#include <asm/paca.h>
25#include <asm/hvcall.h>
26#include <asm/iseries/hv_call.h>
27#endif
28#include <asm/asm-compat.h>
29#include <asm/synch.h>
30
31#define __raw_spin_is_locked(x) ((x)->slock != 0)
32
33#ifdef CONFIG_PPC64
34/* use 0x800000yy when locked, where yy == CPU number */
35#define LOCK_TOKEN (*(u32 *)(&get_paca()->lock_token))
36#else
37#define LOCK_TOKEN 1
38#endif
39
40#if defined(CONFIG_PPC64) && defined(CONFIG_SMP)
41#define CLEAR_IO_SYNC (get_paca()->io_sync = 0)
42#define SYNC_IO do { \
43 if (unlikely(get_paca()->io_sync)) { \
44 mb(); \
45 get_paca()->io_sync = 0; \
46 } \
47 } while (0)
48#else
49#define CLEAR_IO_SYNC
50#define SYNC_IO
51#endif
52
53/*
54 * This returns the old value in the lock, so we succeeded
55 * in getting the lock if the return value is 0.
56 */
57static inline unsigned long __spin_trylock(raw_spinlock_t *lock)
58{
59 unsigned long tmp, token;
60
61 token = LOCK_TOKEN;
62 __asm__ __volatile__(
63"1: lwarx %0,0,%2\n\
64 cmpwi 0,%0,0\n\
65 bne- 2f\n\
66 stwcx. %1,0,%2\n\
67 bne- 1b\n\
68 isync\n\
692:" : "=&r" (tmp)
70 : "r" (token), "r" (&lock->slock)
71 : "cr0", "memory");
72
73 return tmp;
74}
75
76static inline int __raw_spin_trylock(raw_spinlock_t *lock)
77{
78 CLEAR_IO_SYNC;
79 return __spin_trylock(lock) == 0;
80}
81
82/*
83 * On a system with shared processors (that is, where a physical
84 * processor is multiplexed between several virtual processors),
85 * there is no point spinning on a lock if the holder of the lock
86 * isn't currently scheduled on a physical processor. Instead
87 * we detect this situation and ask the hypervisor to give the
88 * rest of our timeslice to the lock holder.
89 *
90 * So that we can tell which virtual processor is holding a lock,
91 * we put 0x80000000 | smp_processor_id() in the lock when it is
92 * held. Conveniently, we have a word in the paca that holds this
93 * value.
94 */
95
96#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES)
97/* We only yield to the hypervisor if we are in shared processor mode */
98#define SHARED_PROCESSOR (get_lppaca()->shared_proc)
99extern void __spin_yield(raw_spinlock_t *lock);
100extern void __rw_yield(raw_rwlock_t *lock);
101#else /* SPLPAR || ISERIES */
102#define __spin_yield(x) barrier()
103#define __rw_yield(x) barrier()
104#define SHARED_PROCESSOR 0
105#endif
106
107static inline void __raw_spin_lock(raw_spinlock_t *lock)
108{
109 CLEAR_IO_SYNC;
110 while (1) {
111 if (likely(__spin_trylock(lock) == 0))
112 break;
113 do {
114 HMT_low();
115 if (SHARED_PROCESSOR)
116 __spin_yield(lock);
117 } while (unlikely(lock->slock != 0));
118 HMT_medium();
119 }
120}
121
122static inline
123void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
124{
125 unsigned long flags_dis;
126
127 CLEAR_IO_SYNC;
128 while (1) {
129 if (likely(__spin_trylock(lock) == 0))
130 break;
131 local_save_flags(flags_dis);
132 local_irq_restore(flags);
133 do {
134 HMT_low();
135 if (SHARED_PROCESSOR)
136 __spin_yield(lock);
137 } while (unlikely(lock->slock != 0));
138 HMT_medium();
139 local_irq_restore(flags_dis);
140 }
141}
142
143static inline void __raw_spin_unlock(raw_spinlock_t *lock)
144{
145 SYNC_IO;
146 __asm__ __volatile__("# __raw_spin_unlock\n\t"
147 LWSYNC_ON_SMP: : :"memory");
148 lock->slock = 0;
149}
150
151#ifdef CONFIG_PPC64
152extern void __raw_spin_unlock_wait(raw_spinlock_t *lock);
153#else
154#define __raw_spin_unlock_wait(lock) \
155 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
156#endif
157
158/*
159 * Read-write spinlocks, allowing multiple readers
160 * but only one writer.
161 *
162 * NOTE! it is quite common to have readers in interrupts
163 * but no interrupt writers. For those circumstances we
164 * can "mix" irq-safe locks - any writer needs to get a
165 * irq-safe write-lock, but readers can get non-irqsafe
166 * read-locks.
167 */
168
169#define __raw_read_can_lock(rw) ((rw)->lock >= 0)
170#define __raw_write_can_lock(rw) (!(rw)->lock)
171
172#ifdef CONFIG_PPC64
173#define __DO_SIGN_EXTEND "extsw %0,%0\n"
174#define WRLOCK_TOKEN LOCK_TOKEN /* it's negative */
175#else
176#define __DO_SIGN_EXTEND
177#define WRLOCK_TOKEN (-1)
178#endif
179
180/*
181 * This returns the old value in the lock + 1,
182 * so we got a read lock if the return value is > 0.
183 */
184static inline long __read_trylock(raw_rwlock_t *rw)
185{
186 long tmp;
187
188 __asm__ __volatile__(
189"1: lwarx %0,0,%1\n"
190 __DO_SIGN_EXTEND
191" addic. %0,%0,1\n\
192 ble- 2f\n"
193 PPC405_ERR77(0,%1)
194" stwcx. %0,0,%1\n\
195 bne- 1b\n\
196 isync\n\
1972:" : "=&r" (tmp)
198 : "r" (&rw->lock)
199 : "cr0", "xer", "memory");
200
201 return tmp;
202}
203
204/*
205 * This returns the old value in the lock,
206 * so we got the write lock if the return value is 0.
207 */
208static inline long __write_trylock(raw_rwlock_t *rw)
209{
210 long tmp, token;
211
212 token = WRLOCK_TOKEN;
213 __asm__ __volatile__(
214"1: lwarx %0,0,%2\n\
215 cmpwi 0,%0,0\n\
216 bne- 2f\n"
217 PPC405_ERR77(0,%1)
218" stwcx. %1,0,%2\n\
219 bne- 1b\n\
220 isync\n\
2212:" : "=&r" (tmp)
222 : "r" (token), "r" (&rw->lock)
223 : "cr0", "memory");
224
225 return tmp;
226}
227
228static inline void __raw_read_lock(raw_rwlock_t *rw)
229{
230 while (1) {
231 if (likely(__read_trylock(rw) > 0))
232 break;
233 do {
234 HMT_low();
235 if (SHARED_PROCESSOR)
236 __rw_yield(rw);
237 } while (unlikely(rw->lock < 0));
238 HMT_medium();
239 }
240}
241
242static inline void __raw_write_lock(raw_rwlock_t *rw)
243{
244 while (1) {
245 if (likely(__write_trylock(rw) == 0))
246 break;
247 do {
248 HMT_low();
249 if (SHARED_PROCESSOR)
250 __rw_yield(rw);
251 } while (unlikely(rw->lock != 0));
252 HMT_medium();
253 }
254}
255
256static inline int __raw_read_trylock(raw_rwlock_t *rw)
257{
258 return __read_trylock(rw) > 0;
259}
260
261static inline int __raw_write_trylock(raw_rwlock_t *rw)
262{
263 return __write_trylock(rw) == 0;
264}
265
266static inline void __raw_read_unlock(raw_rwlock_t *rw)
267{
268 long tmp;
269
270 __asm__ __volatile__(
271 "# read_unlock\n\t"
272 LWSYNC_ON_SMP
273"1: lwarx %0,0,%1\n\
274 addic %0,%0,-1\n"
275 PPC405_ERR77(0,%1)
276" stwcx. %0,0,%1\n\
277 bne- 1b"
278 : "=&r"(tmp)
279 : "r"(&rw->lock)
280 : "cr0", "memory");
281}
282
283static inline void __raw_write_unlock(raw_rwlock_t *rw)
284{
285 __asm__ __volatile__("# write_unlock\n\t"
286 LWSYNC_ON_SMP: : :"memory");
287 rw->lock = 0;
288}
289
290#define _raw_spin_relax(lock) __spin_yield(lock)
291#define _raw_read_relax(lock) __rw_yield(lock)
292#define _raw_write_relax(lock) __rw_yield(lock)
293
294#endif /* __KERNEL__ */
295#endif /* __ASM_SPINLOCK_H */
diff --git a/arch/powerpc/include/asm/spinlock_types.h b/arch/powerpc/include/asm/spinlock_types.h
new file mode 100644
index 000000000000..74236c9f05b1
--- /dev/null
+++ b/arch/powerpc/include/asm/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_POWERPC_SPINLOCK_TYPES_H
2#define _ASM_POWERPC_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int slock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile signed int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/arch/powerpc/include/asm/spu.h b/arch/powerpc/include/asm/spu.h
new file mode 100644
index 000000000000..8b2eb044270a
--- /dev/null
+++ b/arch/powerpc/include/asm/spu.h
@@ -0,0 +1,732 @@
1/*
2 * SPU core / file system interface and HW structures
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _SPU_H
24#define _SPU_H
25#ifdef __KERNEL__
26
27#include <linux/workqueue.h>
28#include <linux/sysdev.h>
29
30#define LS_SIZE (256 * 1024)
31#define LS_ADDR_MASK (LS_SIZE - 1)
32
33#define MFC_PUT_CMD 0x20
34#define MFC_PUTS_CMD 0x28
35#define MFC_PUTR_CMD 0x30
36#define MFC_PUTF_CMD 0x22
37#define MFC_PUTB_CMD 0x21
38#define MFC_PUTFS_CMD 0x2A
39#define MFC_PUTBS_CMD 0x29
40#define MFC_PUTRF_CMD 0x32
41#define MFC_PUTRB_CMD 0x31
42#define MFC_PUTL_CMD 0x24
43#define MFC_PUTRL_CMD 0x34
44#define MFC_PUTLF_CMD 0x26
45#define MFC_PUTLB_CMD 0x25
46#define MFC_PUTRLF_CMD 0x36
47#define MFC_PUTRLB_CMD 0x35
48
49#define MFC_GET_CMD 0x40
50#define MFC_GETS_CMD 0x48
51#define MFC_GETF_CMD 0x42
52#define MFC_GETB_CMD 0x41
53#define MFC_GETFS_CMD 0x4A
54#define MFC_GETBS_CMD 0x49
55#define MFC_GETL_CMD 0x44
56#define MFC_GETLF_CMD 0x46
57#define MFC_GETLB_CMD 0x45
58
59#define MFC_SDCRT_CMD 0x80
60#define MFC_SDCRTST_CMD 0x81
61#define MFC_SDCRZ_CMD 0x89
62#define MFC_SDCRS_CMD 0x8D
63#define MFC_SDCRF_CMD 0x8F
64
65#define MFC_GETLLAR_CMD 0xD0
66#define MFC_PUTLLC_CMD 0xB4
67#define MFC_PUTLLUC_CMD 0xB0
68#define MFC_PUTQLLUC_CMD 0xB8
69#define MFC_SNDSIG_CMD 0xA0
70#define MFC_SNDSIGB_CMD 0xA1
71#define MFC_SNDSIGF_CMD 0xA2
72#define MFC_BARRIER_CMD 0xC0
73#define MFC_EIEIO_CMD 0xC8
74#define MFC_SYNC_CMD 0xCC
75
76#define MFC_MIN_DMA_SIZE_SHIFT 4 /* 16 bytes */
77#define MFC_MAX_DMA_SIZE_SHIFT 14 /* 16384 bytes */
78#define MFC_MIN_DMA_SIZE (1 << MFC_MIN_DMA_SIZE_SHIFT)
79#define MFC_MAX_DMA_SIZE (1 << MFC_MAX_DMA_SIZE_SHIFT)
80#define MFC_MIN_DMA_SIZE_MASK (MFC_MIN_DMA_SIZE - 1)
81#define MFC_MAX_DMA_SIZE_MASK (MFC_MAX_DMA_SIZE - 1)
82#define MFC_MIN_DMA_LIST_SIZE 0x0008 /* 8 bytes */
83#define MFC_MAX_DMA_LIST_SIZE 0x4000 /* 16K bytes */
84
85#define MFC_TAGID_TO_TAGMASK(tag_id) (1 << (tag_id & 0x1F))
86
87/* Events for Channels 0-2 */
88#define MFC_DMA_TAG_STATUS_UPDATE_EVENT 0x00000001
89#define MFC_DMA_TAG_CMD_STALL_NOTIFY_EVENT 0x00000002
90#define MFC_DMA_QUEUE_AVAILABLE_EVENT 0x00000008
91#define MFC_SPU_MAILBOX_WRITTEN_EVENT 0x00000010
92#define MFC_DECREMENTER_EVENT 0x00000020
93#define MFC_PU_INT_MAILBOX_AVAILABLE_EVENT 0x00000040
94#define MFC_PU_MAILBOX_AVAILABLE_EVENT 0x00000080
95#define MFC_SIGNAL_2_EVENT 0x00000100
96#define MFC_SIGNAL_1_EVENT 0x00000200
97#define MFC_LLR_LOST_EVENT 0x00000400
98#define MFC_PRIV_ATTN_EVENT 0x00000800
99#define MFC_MULTI_SRC_EVENT 0x00001000
100
101/* Flag indicating progress during context switch. */
102#define SPU_CONTEXT_SWITCH_PENDING 0UL
103#define SPU_CONTEXT_FAULT_PENDING 1UL
104
105struct spu_context;
106struct spu_runqueue;
107struct spu_lscsa;
108struct device_node;
109
110enum spu_utilization_state {
111 SPU_UTIL_USER,
112 SPU_UTIL_SYSTEM,
113 SPU_UTIL_IOWAIT,
114 SPU_UTIL_IDLE_LOADED,
115 SPU_UTIL_MAX
116};
117
118struct spu {
119 const char *name;
120 unsigned long local_store_phys;
121 u8 *local_store;
122 unsigned long problem_phys;
123 struct spu_problem __iomem *problem;
124 struct spu_priv2 __iomem *priv2;
125 struct list_head cbe_list;
126 struct list_head full_list;
127 enum { SPU_FREE, SPU_USED } alloc_state;
128 int number;
129 unsigned int irqs[3];
130 u32 node;
131 u64 flags;
132 u64 class_0_pending;
133 u64 class_0_dar;
134 u64 class_1_dar;
135 u64 class_1_dsisr;
136 size_t ls_size;
137 unsigned int slb_replace;
138 struct mm_struct *mm;
139 struct spu_context *ctx;
140 struct spu_runqueue *rq;
141 unsigned long long timestamp;
142 pid_t pid;
143 pid_t tgid;
144 spinlock_t register_lock;
145
146 void (* wbox_callback)(struct spu *spu);
147 void (* ibox_callback)(struct spu *spu);
148 void (* stop_callback)(struct spu *spu, int irq);
149 void (* mfc_callback)(struct spu *spu);
150
151 char irq_c0[8];
152 char irq_c1[8];
153 char irq_c2[8];
154
155 u64 spe_id;
156
157 void* pdata; /* platform private data */
158
159 /* of based platforms only */
160 struct device_node *devnode;
161
162 /* native only */
163 struct spu_priv1 __iomem *priv1;
164
165 /* beat only */
166 u64 shadow_int_mask_RW[3];
167
168 struct sys_device sysdev;
169
170 int has_mem_affinity;
171 struct list_head aff_list;
172
173 struct {
174 /* protected by interrupt reentrancy */
175 enum spu_utilization_state util_state;
176 unsigned long long tstamp;
177 unsigned long long times[SPU_UTIL_MAX];
178 unsigned long long vol_ctx_switch;
179 unsigned long long invol_ctx_switch;
180 unsigned long long min_flt;
181 unsigned long long maj_flt;
182 unsigned long long hash_flt;
183 unsigned long long slb_flt;
184 unsigned long long class2_intr;
185 unsigned long long libassist;
186 } stats;
187};
188
189struct cbe_spu_info {
190 struct mutex list_mutex;
191 struct list_head spus;
192 int n_spus;
193 int nr_active;
194 atomic_t busy_spus;
195 atomic_t reserved_spus;
196};
197
198extern struct cbe_spu_info cbe_spu_info[];
199
200void spu_init_channels(struct spu *spu);
201void spu_irq_setaffinity(struct spu *spu, int cpu);
202
203void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa,
204 void *code, int code_size);
205
206#ifdef CONFIG_KEXEC
207void crash_register_spus(struct list_head *list);
208#else
209static inline void crash_register_spus(struct list_head *list)
210{
211}
212#endif
213
214extern void spu_invalidate_slbs(struct spu *spu);
215extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm);
216int spu_64k_pages_available(void);
217
218/* Calls from the memory management to the SPU */
219struct mm_struct;
220extern void spu_flush_all_slbs(struct mm_struct *mm);
221
222/* This interface allows a profiler (e.g., OProfile) to store a ref
223 * to spu context information that it creates. This caching technique
224 * avoids the need to recreate this information after a save/restore operation.
225 *
226 * Assumes the caller has already incremented the ref count to
227 * profile_info; then spu_context_destroy must call kref_put
228 * on prof_info_kref.
229 */
230void spu_set_profile_private_kref(struct spu_context *ctx,
231 struct kref *prof_info_kref,
232 void ( * prof_info_release) (struct kref *kref));
233
234void *spu_get_profile_private_kref(struct spu_context *ctx);
235
236/* system callbacks from the SPU */
237struct spu_syscall_block {
238 u64 nr_ret;
239 u64 parm[6];
240};
241extern long spu_sys_callback(struct spu_syscall_block *s);
242
243/* syscalls implemented in spufs */
244struct file;
245struct spufs_calls {
246 long (*create_thread)(const char __user *name,
247 unsigned int flags, mode_t mode,
248 struct file *neighbor);
249 long (*spu_run)(struct file *filp, __u32 __user *unpc,
250 __u32 __user *ustatus);
251 int (*coredump_extra_notes_size)(void);
252 int (*coredump_extra_notes_write)(struct file *file, loff_t *foffset);
253 void (*notify_spus_active)(void);
254 struct module *owner;
255};
256
257/* return status from spu_run, same as in libspe */
258#define SPE_EVENT_DMA_ALIGNMENT 0x0008 /*A DMA alignment error */
259#define SPE_EVENT_SPE_ERROR 0x0010 /*An illegal instruction error*/
260#define SPE_EVENT_SPE_DATA_SEGMENT 0x0020 /*A DMA segmentation error */
261#define SPE_EVENT_SPE_DATA_STORAGE 0x0040 /*A DMA storage error */
262#define SPE_EVENT_INVALID_DMA 0x0800 /* Invalid MFC DMA */
263
264/*
265 * Flags for sys_spu_create.
266 */
267#define SPU_CREATE_EVENTS_ENABLED 0x0001
268#define SPU_CREATE_GANG 0x0002
269#define SPU_CREATE_NOSCHED 0x0004
270#define SPU_CREATE_ISOLATE 0x0008
271#define SPU_CREATE_AFFINITY_SPU 0x0010
272#define SPU_CREATE_AFFINITY_MEM 0x0020
273
274#define SPU_CREATE_FLAG_ALL 0x003f /* mask of all valid flags */
275
276
277int register_spu_syscalls(struct spufs_calls *calls);
278void unregister_spu_syscalls(struct spufs_calls *calls);
279
280int spu_add_sysdev_attr(struct sysdev_attribute *attr);
281void spu_remove_sysdev_attr(struct sysdev_attribute *attr);
282
283int spu_add_sysdev_attr_group(struct attribute_group *attrs);
284void spu_remove_sysdev_attr_group(struct attribute_group *attrs);
285
286int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
287 unsigned long dsisr, unsigned *flt);
288
289/*
290 * Notifier blocks:
291 *
292 * oprofile can get notified when a context switch is performed
293 * on an spe. The notifer function that gets called is passed
294 * a pointer to the SPU structure as well as the object-id that
295 * identifies the binary running on that SPU now.
296 *
297 * For a context save, the object-id that is passed is zero,
298 * identifying that the kernel will run from that moment on.
299 *
300 * For a context restore, the object-id is the value written
301 * to object-id spufs file from user space and the notifer
302 * function can assume that spu->ctx is valid.
303 */
304struct notifier_block;
305int spu_switch_event_register(struct notifier_block * n);
306int spu_switch_event_unregister(struct notifier_block * n);
307
308extern void notify_spus_active(void);
309extern void do_notify_spus_active(void);
310
311/*
312 * This defines the Local Store, Problem Area and Privilege Area of an SPU.
313 */
314
315union mfc_tag_size_class_cmd {
316 struct {
317 u16 mfc_size;
318 u16 mfc_tag;
319 u8 pad;
320 u8 mfc_rclassid;
321 u16 mfc_cmd;
322 } u;
323 struct {
324 u32 mfc_size_tag32;
325 u32 mfc_class_cmd32;
326 } by32;
327 u64 all64;
328};
329
330struct mfc_cq_sr {
331 u64 mfc_cq_data0_RW;
332 u64 mfc_cq_data1_RW;
333 u64 mfc_cq_data2_RW;
334 u64 mfc_cq_data3_RW;
335};
336
337struct spu_problem {
338#define MS_SYNC_PENDING 1L
339 u64 spc_mssync_RW; /* 0x0000 */
340 u8 pad_0x0008_0x3000[0x3000 - 0x0008];
341
342 /* DMA Area */
343 u8 pad_0x3000_0x3004[0x4]; /* 0x3000 */
344 u32 mfc_lsa_W; /* 0x3004 */
345 u64 mfc_ea_W; /* 0x3008 */
346 union mfc_tag_size_class_cmd mfc_union_W; /* 0x3010 */
347 u8 pad_0x3018_0x3104[0xec]; /* 0x3018 */
348 u32 dma_qstatus_R; /* 0x3104 */
349 u8 pad_0x3108_0x3204[0xfc]; /* 0x3108 */
350 u32 dma_querytype_RW; /* 0x3204 */
351 u8 pad_0x3208_0x321c[0x14]; /* 0x3208 */
352 u32 dma_querymask_RW; /* 0x321c */
353 u8 pad_0x3220_0x322c[0xc]; /* 0x3220 */
354 u32 dma_tagstatus_R; /* 0x322c */
355#define DMA_TAGSTATUS_INTR_ANY 1u
356#define DMA_TAGSTATUS_INTR_ALL 2u
357 u8 pad_0x3230_0x4000[0x4000 - 0x3230]; /* 0x3230 */
358
359 /* SPU Control Area */
360 u8 pad_0x4000_0x4004[0x4]; /* 0x4000 */
361 u32 pu_mb_R; /* 0x4004 */
362 u8 pad_0x4008_0x400c[0x4]; /* 0x4008 */
363 u32 spu_mb_W; /* 0x400c */
364 u8 pad_0x4010_0x4014[0x4]; /* 0x4010 */
365 u32 mb_stat_R; /* 0x4014 */
366 u8 pad_0x4018_0x401c[0x4]; /* 0x4018 */
367 u32 spu_runcntl_RW; /* 0x401c */
368#define SPU_RUNCNTL_STOP 0L
369#define SPU_RUNCNTL_RUNNABLE 1L
370#define SPU_RUNCNTL_ISOLATE 2L
371 u8 pad_0x4020_0x4024[0x4]; /* 0x4020 */
372 u32 spu_status_R; /* 0x4024 */
373#define SPU_STOP_STATUS_SHIFT 16
374#define SPU_STATUS_STOPPED 0x0
375#define SPU_STATUS_RUNNING 0x1
376#define SPU_STATUS_STOPPED_BY_STOP 0x2
377#define SPU_STATUS_STOPPED_BY_HALT 0x4
378#define SPU_STATUS_WAITING_FOR_CHANNEL 0x8
379#define SPU_STATUS_SINGLE_STEP 0x10
380#define SPU_STATUS_INVALID_INSTR 0x20
381#define SPU_STATUS_INVALID_CH 0x40
382#define SPU_STATUS_ISOLATED_STATE 0x80
383#define SPU_STATUS_ISOLATED_LOAD_STATUS 0x200
384#define SPU_STATUS_ISOLATED_EXIT_STATUS 0x400
385 u8 pad_0x4028_0x402c[0x4]; /* 0x4028 */
386 u32 spu_spe_R; /* 0x402c */
387 u8 pad_0x4030_0x4034[0x4]; /* 0x4030 */
388 u32 spu_npc_RW; /* 0x4034 */
389 u8 pad_0x4038_0x14000[0x14000 - 0x4038]; /* 0x4038 */
390
391 /* Signal Notification Area */
392 u8 pad_0x14000_0x1400c[0xc]; /* 0x14000 */
393 u32 signal_notify1; /* 0x1400c */
394 u8 pad_0x14010_0x1c00c[0x7ffc]; /* 0x14010 */
395 u32 signal_notify2; /* 0x1c00c */
396} __attribute__ ((aligned(0x20000)));
397
398/* SPU Privilege 2 State Area */
399struct spu_priv2 {
400 /* MFC Registers */
401 u8 pad_0x0000_0x1100[0x1100 - 0x0000]; /* 0x0000 */
402
403 /* SLB Management Registers */
404 u8 pad_0x1100_0x1108[0x8]; /* 0x1100 */
405 u64 slb_index_W; /* 0x1108 */
406#define SLB_INDEX_MASK 0x7L
407 u64 slb_esid_RW; /* 0x1110 */
408 u64 slb_vsid_RW; /* 0x1118 */
409#define SLB_VSID_SUPERVISOR_STATE (0x1ull << 11)
410#define SLB_VSID_SUPERVISOR_STATE_MASK (0x1ull << 11)
411#define SLB_VSID_PROBLEM_STATE (0x1ull << 10)
412#define SLB_VSID_PROBLEM_STATE_MASK (0x1ull << 10)
413#define SLB_VSID_EXECUTE_SEGMENT (0x1ull << 9)
414#define SLB_VSID_NO_EXECUTE_SEGMENT (0x1ull << 9)
415#define SLB_VSID_EXECUTE_SEGMENT_MASK (0x1ull << 9)
416#define SLB_VSID_4K_PAGE (0x0 << 8)
417#define SLB_VSID_LARGE_PAGE (0x1ull << 8)
418#define SLB_VSID_PAGE_SIZE_MASK (0x1ull << 8)
419#define SLB_VSID_CLASS_MASK (0x1ull << 7)
420#define SLB_VSID_VIRTUAL_PAGE_SIZE_MASK (0x1ull << 6)
421 u64 slb_invalidate_entry_W; /* 0x1120 */
422 u64 slb_invalidate_all_W; /* 0x1128 */
423 u8 pad_0x1130_0x2000[0x2000 - 0x1130]; /* 0x1130 */
424
425 /* Context Save / Restore Area */
426 struct mfc_cq_sr spuq[16]; /* 0x2000 */
427 struct mfc_cq_sr puq[8]; /* 0x2200 */
428 u8 pad_0x2300_0x3000[0x3000 - 0x2300]; /* 0x2300 */
429
430 /* MFC Control */
431 u64 mfc_control_RW; /* 0x3000 */
432#define MFC_CNTL_RESUME_DMA_QUEUE (0ull << 0)
433#define MFC_CNTL_SUSPEND_DMA_QUEUE (1ull << 0)
434#define MFC_CNTL_SUSPEND_DMA_QUEUE_MASK (1ull << 0)
435#define MFC_CNTL_SUSPEND_MASK (1ull << 4)
436#define MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION (0ull << 8)
437#define MFC_CNTL_SUSPEND_IN_PROGRESS (1ull << 8)
438#define MFC_CNTL_SUSPEND_COMPLETE (3ull << 8)
439#define MFC_CNTL_SUSPEND_DMA_STATUS_MASK (3ull << 8)
440#define MFC_CNTL_DMA_QUEUES_EMPTY (1ull << 14)
441#define MFC_CNTL_DMA_QUEUES_EMPTY_MASK (1ull << 14)
442#define MFC_CNTL_PURGE_DMA_REQUEST (1ull << 15)
443#define MFC_CNTL_PURGE_DMA_IN_PROGRESS (1ull << 24)
444#define MFC_CNTL_PURGE_DMA_COMPLETE (3ull << 24)
445#define MFC_CNTL_PURGE_DMA_STATUS_MASK (3ull << 24)
446#define MFC_CNTL_RESTART_DMA_COMMAND (1ull << 32)
447#define MFC_CNTL_DMA_COMMAND_REISSUE_PENDING (1ull << 32)
448#define MFC_CNTL_DMA_COMMAND_REISSUE_STATUS_MASK (1ull << 32)
449#define MFC_CNTL_MFC_PRIVILEGE_STATE (2ull << 33)
450#define MFC_CNTL_MFC_PROBLEM_STATE (3ull << 33)
451#define MFC_CNTL_MFC_KEY_PROTECTION_STATE_MASK (3ull << 33)
452#define MFC_CNTL_DECREMENTER_HALTED (1ull << 35)
453#define MFC_CNTL_DECREMENTER_RUNNING (1ull << 40)
454#define MFC_CNTL_DECREMENTER_STATUS_MASK (1ull << 40)
455 u8 pad_0x3008_0x4000[0x4000 - 0x3008]; /* 0x3008 */
456
457 /* Interrupt Mailbox */
458 u64 puint_mb_R; /* 0x4000 */
459 u8 pad_0x4008_0x4040[0x4040 - 0x4008]; /* 0x4008 */
460
461 /* SPU Control */
462 u64 spu_privcntl_RW; /* 0x4040 */
463#define SPU_PRIVCNTL_MODE_NORMAL (0x0ull << 0)
464#define SPU_PRIVCNTL_MODE_SINGLE_STEP (0x1ull << 0)
465#define SPU_PRIVCNTL_MODE_MASK (0x1ull << 0)
466#define SPU_PRIVCNTL_NO_ATTENTION_EVENT (0x0ull << 1)
467#define SPU_PRIVCNTL_ATTENTION_EVENT (0x1ull << 1)
468#define SPU_PRIVCNTL_ATTENTION_EVENT_MASK (0x1ull << 1)
469#define SPU_PRIVCNT_LOAD_REQUEST_NORMAL (0x0ull << 2)
470#define SPU_PRIVCNT_LOAD_REQUEST_ENABLE_MASK (0x1ull << 2)
471 u8 pad_0x4048_0x4058[0x10]; /* 0x4048 */
472 u64 spu_lslr_RW; /* 0x4058 */
473 u64 spu_chnlcntptr_RW; /* 0x4060 */
474 u64 spu_chnlcnt_RW; /* 0x4068 */
475 u64 spu_chnldata_RW; /* 0x4070 */
476 u64 spu_cfg_RW; /* 0x4078 */
477 u8 pad_0x4080_0x5000[0x5000 - 0x4080]; /* 0x4080 */
478
479 /* PV2_ImplRegs: Implementation-specific privileged-state 2 regs */
480 u64 spu_pm_trace_tag_status_RW; /* 0x5000 */
481 u64 spu_tag_status_query_RW; /* 0x5008 */
482#define TAG_STATUS_QUERY_CONDITION_BITS (0x3ull << 32)
483#define TAG_STATUS_QUERY_MASK_BITS (0xffffffffull)
484 u64 spu_cmd_buf1_RW; /* 0x5010 */
485#define SPU_COMMAND_BUFFER_1_LSA_BITS (0x7ffffull << 32)
486#define SPU_COMMAND_BUFFER_1_EAH_BITS (0xffffffffull)
487 u64 spu_cmd_buf2_RW; /* 0x5018 */
488#define SPU_COMMAND_BUFFER_2_EAL_BITS ((0xffffffffull) << 32)
489#define SPU_COMMAND_BUFFER_2_TS_BITS (0xffffull << 16)
490#define SPU_COMMAND_BUFFER_2_TAG_BITS (0x3full)
491 u64 spu_atomic_status_RW; /* 0x5020 */
492} __attribute__ ((aligned(0x20000)));
493
494/* SPU Privilege 1 State Area */
495struct spu_priv1 {
496 /* Control and Configuration Area */
497 u64 mfc_sr1_RW; /* 0x000 */
498#define MFC_STATE1_LOCAL_STORAGE_DECODE_MASK 0x01ull
499#define MFC_STATE1_BUS_TLBIE_MASK 0x02ull
500#define MFC_STATE1_REAL_MODE_OFFSET_ENABLE_MASK 0x04ull
501#define MFC_STATE1_PROBLEM_STATE_MASK 0x08ull
502#define MFC_STATE1_RELOCATE_MASK 0x10ull
503#define MFC_STATE1_MASTER_RUN_CONTROL_MASK 0x20ull
504#define MFC_STATE1_TABLE_SEARCH_MASK 0x40ull
505 u64 mfc_lpid_RW; /* 0x008 */
506 u64 spu_idr_RW; /* 0x010 */
507 u64 mfc_vr_RO; /* 0x018 */
508#define MFC_VERSION_BITS (0xffff << 16)
509#define MFC_REVISION_BITS (0xffff)
510#define MFC_GET_VERSION_BITS(vr) (((vr) & MFC_VERSION_BITS) >> 16)
511#define MFC_GET_REVISION_BITS(vr) ((vr) & MFC_REVISION_BITS)
512 u64 spu_vr_RO; /* 0x020 */
513#define SPU_VERSION_BITS (0xffff << 16)
514#define SPU_REVISION_BITS (0xffff)
515#define SPU_GET_VERSION_BITS(vr) (vr & SPU_VERSION_BITS) >> 16
516#define SPU_GET_REVISION_BITS(vr) (vr & SPU_REVISION_BITS)
517 u8 pad_0x28_0x100[0x100 - 0x28]; /* 0x28 */
518
519 /* Interrupt Area */
520 u64 int_mask_RW[3]; /* 0x100 */
521#define CLASS0_ENABLE_DMA_ALIGNMENT_INTR 0x1L
522#define CLASS0_ENABLE_INVALID_DMA_COMMAND_INTR 0x2L
523#define CLASS0_ENABLE_SPU_ERROR_INTR 0x4L
524#define CLASS0_ENABLE_MFC_FIR_INTR 0x8L
525#define CLASS1_ENABLE_SEGMENT_FAULT_INTR 0x1L
526#define CLASS1_ENABLE_STORAGE_FAULT_INTR 0x2L
527#define CLASS1_ENABLE_LS_COMPARE_SUSPEND_ON_GET_INTR 0x4L
528#define CLASS1_ENABLE_LS_COMPARE_SUSPEND_ON_PUT_INTR 0x8L
529#define CLASS2_ENABLE_MAILBOX_INTR 0x1L
530#define CLASS2_ENABLE_SPU_STOP_INTR 0x2L
531#define CLASS2_ENABLE_SPU_HALT_INTR 0x4L
532#define CLASS2_ENABLE_SPU_DMA_TAG_GROUP_COMPLETE_INTR 0x8L
533#define CLASS2_ENABLE_MAILBOX_THRESHOLD_INTR 0x10L
534 u8 pad_0x118_0x140[0x28]; /* 0x118 */
535 u64 int_stat_RW[3]; /* 0x140 */
536#define CLASS0_DMA_ALIGNMENT_INTR 0x1L
537#define CLASS0_INVALID_DMA_COMMAND_INTR 0x2L
538#define CLASS0_SPU_ERROR_INTR 0x4L
539#define CLASS0_INTR_MASK 0x7L
540#define CLASS1_SEGMENT_FAULT_INTR 0x1L
541#define CLASS1_STORAGE_FAULT_INTR 0x2L
542#define CLASS1_LS_COMPARE_SUSPEND_ON_GET_INTR 0x4L
543#define CLASS1_LS_COMPARE_SUSPEND_ON_PUT_INTR 0x8L
544#define CLASS1_INTR_MASK 0xfL
545#define CLASS2_MAILBOX_INTR 0x1L
546#define CLASS2_SPU_STOP_INTR 0x2L
547#define CLASS2_SPU_HALT_INTR 0x4L
548#define CLASS2_SPU_DMA_TAG_GROUP_COMPLETE_INTR 0x8L
549#define CLASS2_MAILBOX_THRESHOLD_INTR 0x10L
550#define CLASS2_INTR_MASK 0x1fL
551 u8 pad_0x158_0x180[0x28]; /* 0x158 */
552 u64 int_route_RW; /* 0x180 */
553
554 /* Interrupt Routing */
555 u8 pad_0x188_0x200[0x200 - 0x188]; /* 0x188 */
556
557 /* Atomic Unit Control Area */
558 u64 mfc_atomic_flush_RW; /* 0x200 */
559#define mfc_atomic_flush_enable 0x1L
560 u8 pad_0x208_0x280[0x78]; /* 0x208 */
561 u64 resource_allocation_groupID_RW; /* 0x280 */
562 u64 resource_allocation_enable_RW; /* 0x288 */
563 u8 pad_0x290_0x3c8[0x3c8 - 0x290]; /* 0x290 */
564
565 /* SPU_Cache_ImplRegs: Implementation-dependent cache registers */
566
567 u64 smf_sbi_signal_sel; /* 0x3c8 */
568#define smf_sbi_mask_lsb 56
569#define smf_sbi_shift (63 - smf_sbi_mask_lsb)
570#define smf_sbi_mask (0x301LL << smf_sbi_shift)
571#define smf_sbi_bus0_bits (0x001LL << smf_sbi_shift)
572#define smf_sbi_bus2_bits (0x100LL << smf_sbi_shift)
573#define smf_sbi2_bus0_bits (0x201LL << smf_sbi_shift)
574#define smf_sbi2_bus2_bits (0x300LL << smf_sbi_shift)
575 u64 smf_ato_signal_sel; /* 0x3d0 */
576#define smf_ato_mask_lsb 35
577#define smf_ato_shift (63 - smf_ato_mask_lsb)
578#define smf_ato_mask (0x3LL << smf_ato_shift)
579#define smf_ato_bus0_bits (0x2LL << smf_ato_shift)
580#define smf_ato_bus2_bits (0x1LL << smf_ato_shift)
581 u8 pad_0x3d8_0x400[0x400 - 0x3d8]; /* 0x3d8 */
582
583 /* TLB Management Registers */
584 u64 mfc_sdr_RW; /* 0x400 */
585 u8 pad_0x408_0x500[0xf8]; /* 0x408 */
586 u64 tlb_index_hint_RO; /* 0x500 */
587 u64 tlb_index_W; /* 0x508 */
588 u64 tlb_vpn_RW; /* 0x510 */
589 u64 tlb_rpn_RW; /* 0x518 */
590 u8 pad_0x520_0x540[0x20]; /* 0x520 */
591 u64 tlb_invalidate_entry_W; /* 0x540 */
592 u64 tlb_invalidate_all_W; /* 0x548 */
593 u8 pad_0x550_0x580[0x580 - 0x550]; /* 0x550 */
594
595 /* SPU_MMU_ImplRegs: Implementation-dependent MMU registers */
596 u64 smm_hid; /* 0x580 */
597#define PAGE_SIZE_MASK 0xf000000000000000ull
598#define PAGE_SIZE_16MB_64KB 0x2000000000000000ull
599 u8 pad_0x588_0x600[0x600 - 0x588]; /* 0x588 */
600
601 /* MFC Status/Control Area */
602 u64 mfc_accr_RW; /* 0x600 */
603#define MFC_ACCR_EA_ACCESS_GET (1 << 0)
604#define MFC_ACCR_EA_ACCESS_PUT (1 << 1)
605#define MFC_ACCR_LS_ACCESS_GET (1 << 3)
606#define MFC_ACCR_LS_ACCESS_PUT (1 << 4)
607 u8 pad_0x608_0x610[0x8]; /* 0x608 */
608 u64 mfc_dsisr_RW; /* 0x610 */
609#define MFC_DSISR_PTE_NOT_FOUND (1 << 30)
610#define MFC_DSISR_ACCESS_DENIED (1 << 27)
611#define MFC_DSISR_ATOMIC (1 << 26)
612#define MFC_DSISR_ACCESS_PUT (1 << 25)
613#define MFC_DSISR_ADDR_MATCH (1 << 22)
614#define MFC_DSISR_LS (1 << 17)
615#define MFC_DSISR_L (1 << 16)
616#define MFC_DSISR_ADDRESS_OVERFLOW (1 << 0)
617 u8 pad_0x618_0x620[0x8]; /* 0x618 */
618 u64 mfc_dar_RW; /* 0x620 */
619 u8 pad_0x628_0x700[0x700 - 0x628]; /* 0x628 */
620
621 /* Replacement Management Table (RMT) Area */
622 u64 rmt_index_RW; /* 0x700 */
623 u8 pad_0x708_0x710[0x8]; /* 0x708 */
624 u64 rmt_data1_RW; /* 0x710 */
625 u8 pad_0x718_0x800[0x800 - 0x718]; /* 0x718 */
626
627 /* Control/Configuration Registers */
628 u64 mfc_dsir_R; /* 0x800 */
629#define MFC_DSIR_Q (1 << 31)
630#define MFC_DSIR_SPU_QUEUE MFC_DSIR_Q
631 u64 mfc_lsacr_RW; /* 0x808 */
632#define MFC_LSACR_COMPARE_MASK ((~0ull) << 32)
633#define MFC_LSACR_COMPARE_ADDR ((~0ull) >> 32)
634 u64 mfc_lscrr_R; /* 0x810 */
635#define MFC_LSCRR_Q (1 << 31)
636#define MFC_LSCRR_SPU_QUEUE MFC_LSCRR_Q
637#define MFC_LSCRR_QI_SHIFT 32
638#define MFC_LSCRR_QI_MASK ((~0ull) << MFC_LSCRR_QI_SHIFT)
639 u8 pad_0x818_0x820[0x8]; /* 0x818 */
640 u64 mfc_tclass_id_RW; /* 0x820 */
641#define MFC_TCLASS_ID_ENABLE (1L << 0L)
642#define MFC_TCLASS_SLOT2_ENABLE (1L << 5L)
643#define MFC_TCLASS_SLOT1_ENABLE (1L << 6L)
644#define MFC_TCLASS_SLOT0_ENABLE (1L << 7L)
645#define MFC_TCLASS_QUOTA_2_SHIFT 8L
646#define MFC_TCLASS_QUOTA_1_SHIFT 16L
647#define MFC_TCLASS_QUOTA_0_SHIFT 24L
648#define MFC_TCLASS_QUOTA_2_MASK (0x1FL << MFC_TCLASS_QUOTA_2_SHIFT)
649#define MFC_TCLASS_QUOTA_1_MASK (0x1FL << MFC_TCLASS_QUOTA_1_SHIFT)
650#define MFC_TCLASS_QUOTA_0_MASK (0x1FL << MFC_TCLASS_QUOTA_0_SHIFT)
651 u8 pad_0x828_0x900[0x900 - 0x828]; /* 0x828 */
652
653 /* Real Mode Support Registers */
654 u64 mfc_rm_boundary; /* 0x900 */
655 u8 pad_0x908_0x938[0x30]; /* 0x908 */
656 u64 smf_dma_signal_sel; /* 0x938 */
657#define mfc_dma1_mask_lsb 41
658#define mfc_dma1_shift (63 - mfc_dma1_mask_lsb)
659#define mfc_dma1_mask (0x3LL << mfc_dma1_shift)
660#define mfc_dma1_bits (0x1LL << mfc_dma1_shift)
661#define mfc_dma2_mask_lsb 43
662#define mfc_dma2_shift (63 - mfc_dma2_mask_lsb)
663#define mfc_dma2_mask (0x3LL << mfc_dma2_shift)
664#define mfc_dma2_bits (0x1LL << mfc_dma2_shift)
665 u8 pad_0x940_0xa38[0xf8]; /* 0x940 */
666 u64 smm_signal_sel; /* 0xa38 */
667#define smm_sig_mask_lsb 12
668#define smm_sig_shift (63 - smm_sig_mask_lsb)
669#define smm_sig_mask (0x3LL << smm_sig_shift)
670#define smm_sig_bus0_bits (0x2LL << smm_sig_shift)
671#define smm_sig_bus2_bits (0x1LL << smm_sig_shift)
672 u8 pad_0xa40_0xc00[0xc00 - 0xa40]; /* 0xa40 */
673
674 /* DMA Command Error Area */
675 u64 mfc_cer_R; /* 0xc00 */
676#define MFC_CER_Q (1 << 31)
677#define MFC_CER_SPU_QUEUE MFC_CER_Q
678 u8 pad_0xc08_0x1000[0x1000 - 0xc08]; /* 0xc08 */
679
680 /* PV1_ImplRegs: Implementation-dependent privileged-state 1 regs */
681 /* DMA Command Error Area */
682 u64 spu_ecc_cntl_RW; /* 0x1000 */
683#define SPU_ECC_CNTL_E (1ull << 0ull)
684#define SPU_ECC_CNTL_ENABLE SPU_ECC_CNTL_E
685#define SPU_ECC_CNTL_DISABLE (~SPU_ECC_CNTL_E & 1L)
686#define SPU_ECC_CNTL_S (1ull << 1ull)
687#define SPU_ECC_STOP_AFTER_ERROR SPU_ECC_CNTL_S
688#define SPU_ECC_CONTINUE_AFTER_ERROR (~SPU_ECC_CNTL_S & 2L)
689#define SPU_ECC_CNTL_B (1ull << 2ull)
690#define SPU_ECC_BACKGROUND_ENABLE SPU_ECC_CNTL_B
691#define SPU_ECC_BACKGROUND_DISABLE (~SPU_ECC_CNTL_B & 4L)
692#define SPU_ECC_CNTL_I_SHIFT 3ull
693#define SPU_ECC_CNTL_I_MASK (3ull << SPU_ECC_CNTL_I_SHIFT)
694#define SPU_ECC_WRITE_ALWAYS (~SPU_ECC_CNTL_I & 12L)
695#define SPU_ECC_WRITE_CORRECTABLE (1ull << SPU_ECC_CNTL_I_SHIFT)
696#define SPU_ECC_WRITE_UNCORRECTABLE (3ull << SPU_ECC_CNTL_I_SHIFT)
697#define SPU_ECC_CNTL_D (1ull << 5ull)
698#define SPU_ECC_DETECTION_ENABLE SPU_ECC_CNTL_D
699#define SPU_ECC_DETECTION_DISABLE (~SPU_ECC_CNTL_D & 32L)
700 u64 spu_ecc_stat_RW; /* 0x1008 */
701#define SPU_ECC_CORRECTED_ERROR (1ull << 0ul)
702#define SPU_ECC_UNCORRECTED_ERROR (1ull << 1ul)
703#define SPU_ECC_SCRUB_COMPLETE (1ull << 2ul)
704#define SPU_ECC_SCRUB_IN_PROGRESS (1ull << 3ul)
705#define SPU_ECC_INSTRUCTION_ERROR (1ull << 4ul)
706#define SPU_ECC_DATA_ERROR (1ull << 5ul)
707#define SPU_ECC_DMA_ERROR (1ull << 6ul)
708#define SPU_ECC_STATUS_CNT_MASK (256ull << 8)
709 u64 spu_ecc_addr_RW; /* 0x1010 */
710 u64 spu_err_mask_RW; /* 0x1018 */
711#define SPU_ERR_ILLEGAL_INSTR (1ull << 0ul)
712#define SPU_ERR_ILLEGAL_CHANNEL (1ull << 1ul)
713 u8 pad_0x1020_0x1028[0x1028 - 0x1020]; /* 0x1020 */
714
715 /* SPU Debug-Trace Bus (DTB) Selection Registers */
716 u64 spu_trig0_sel; /* 0x1028 */
717 u64 spu_trig1_sel; /* 0x1030 */
718 u64 spu_trig2_sel; /* 0x1038 */
719 u64 spu_trig3_sel; /* 0x1040 */
720 u64 spu_trace_sel; /* 0x1048 */
721#define spu_trace_sel_mask 0x1f1fLL
722#define spu_trace_sel_bus0_bits 0x1000LL
723#define spu_trace_sel_bus2_bits 0x0010LL
724 u64 spu_event0_sel; /* 0x1050 */
725 u64 spu_event1_sel; /* 0x1058 */
726 u64 spu_event2_sel; /* 0x1060 */
727 u64 spu_event3_sel; /* 0x1068 */
728 u64 spu_trace_cntl; /* 0x1070 */
729} __attribute__ ((aligned(0x2000)));
730
731#endif /* __KERNEL__ */
732#endif
diff --git a/arch/powerpc/include/asm/spu_csa.h b/arch/powerpc/include/asm/spu_csa.h
new file mode 100644
index 000000000000..a40fd491250c
--- /dev/null
+++ b/arch/powerpc/include/asm/spu_csa.h
@@ -0,0 +1,266 @@
1/*
2 * spu_csa.h: Definitions for SPU context save area (CSA).
3 *
4 * (C) Copyright IBM 2005
5 *
6 * Author: Mark Nutter <mnutter@us.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _SPU_CSA_H_
24#define _SPU_CSA_H_
25#ifdef __KERNEL__
26
27/*
28 * Total number of 128-bit registers.
29 */
30#define NR_SPU_GPRS 128
31#define NR_SPU_SPRS 9
32#define NR_SPU_REGS_PAD 7
33#define NR_SPU_SPILL_REGS 144 /* GPRS + SPRS + PAD */
34#define SIZEOF_SPU_SPILL_REGS NR_SPU_SPILL_REGS * 16
35
36#define SPU_SAVE_COMPLETE 0x3FFB
37#define SPU_RESTORE_COMPLETE 0x3FFC
38
39/*
40 * Definitions for various 'stopped' status conditions,
41 * to be recreated during context restore.
42 */
43#define SPU_STOPPED_STATUS_P 1
44#define SPU_STOPPED_STATUS_I 2
45#define SPU_STOPPED_STATUS_H 3
46#define SPU_STOPPED_STATUS_S 4
47#define SPU_STOPPED_STATUS_S_I 5
48#define SPU_STOPPED_STATUS_S_P 6
49#define SPU_STOPPED_STATUS_P_H 7
50#define SPU_STOPPED_STATUS_P_I 8
51#define SPU_STOPPED_STATUS_R 9
52
53/*
54 * Definitions for software decrementer status flag.
55 */
56#define SPU_DECR_STATUS_RUNNING 0x1
57#define SPU_DECR_STATUS_WRAPPED 0x2
58
59#ifndef __ASSEMBLY__
60/**
61 * spu_reg128 - generic 128-bit register definition.
62 */
63struct spu_reg128 {
64 u32 slot[4];
65};
66
67/**
68 * struct spu_lscsa - Local Store Context Save Area.
69 * @gprs: Array of saved registers.
70 * @fpcr: Saved floating point status control register.
71 * @decr: Saved decrementer value.
72 * @decr_status: Indicates software decrementer status flags.
73 * @ppu_mb: Saved PPU mailbox data.
74 * @ppuint_mb: Saved PPU interrupting mailbox data.
75 * @tag_mask: Saved tag group mask.
76 * @event_mask: Saved event mask.
77 * @srr0: Saved SRR0.
78 * @stopped_status: Conditions to be recreated by restore.
79 * @ls: Saved contents of Local Storage Area.
80 *
81 * The LSCSA represents state that is primarily saved and
82 * restored by SPU-side code.
83 */
84struct spu_lscsa {
85 struct spu_reg128 gprs[128];
86 struct spu_reg128 fpcr;
87 struct spu_reg128 decr;
88 struct spu_reg128 decr_status;
89 struct spu_reg128 ppu_mb;
90 struct spu_reg128 ppuint_mb;
91 struct spu_reg128 tag_mask;
92 struct spu_reg128 event_mask;
93 struct spu_reg128 srr0;
94 struct spu_reg128 stopped_status;
95
96 /*
97 * 'ls' must be page-aligned on all configurations.
98 * Since we don't want to rely on having the spu-gcc
99 * installed to build the kernel and this structure
100 * is used in the SPU-side code, make it 64k-page
101 * aligned for now.
102 */
103 unsigned char ls[LS_SIZE] __attribute__((aligned(65536)));
104};
105
106#ifndef __SPU__
107/*
108 * struct spu_problem_collapsed - condensed problem state area, w/o pads.
109 */
110struct spu_problem_collapsed {
111 u64 spc_mssync_RW;
112 u32 mfc_lsa_W;
113 u32 unused_pad0;
114 u64 mfc_ea_W;
115 union mfc_tag_size_class_cmd mfc_union_W;
116 u32 dma_qstatus_R;
117 u32 dma_querytype_RW;
118 u32 dma_querymask_RW;
119 u32 dma_tagstatus_R;
120 u32 pu_mb_R;
121 u32 spu_mb_W;
122 u32 mb_stat_R;
123 u32 spu_runcntl_RW;
124 u32 spu_status_R;
125 u32 spu_spc_R;
126 u32 spu_npc_RW;
127 u32 signal_notify1;
128 u32 signal_notify2;
129 u32 unused_pad1;
130};
131
132/*
133 * struct spu_priv1_collapsed - condensed privileged 1 area, w/o pads.
134 */
135struct spu_priv1_collapsed {
136 u64 mfc_sr1_RW;
137 u64 mfc_lpid_RW;
138 u64 spu_idr_RW;
139 u64 mfc_vr_RO;
140 u64 spu_vr_RO;
141 u64 int_mask_class0_RW;
142 u64 int_mask_class1_RW;
143 u64 int_mask_class2_RW;
144 u64 int_stat_class0_RW;
145 u64 int_stat_class1_RW;
146 u64 int_stat_class2_RW;
147 u64 int_route_RW;
148 u64 mfc_atomic_flush_RW;
149 u64 resource_allocation_groupID_RW;
150 u64 resource_allocation_enable_RW;
151 u64 mfc_fir_R;
152 u64 mfc_fir_status_or_W;
153 u64 mfc_fir_status_and_W;
154 u64 mfc_fir_mask_R;
155 u64 mfc_fir_mask_or_W;
156 u64 mfc_fir_mask_and_W;
157 u64 mfc_fir_chkstp_enable_RW;
158 u64 smf_sbi_signal_sel;
159 u64 smf_ato_signal_sel;
160 u64 tlb_index_hint_RO;
161 u64 tlb_index_W;
162 u64 tlb_vpn_RW;
163 u64 tlb_rpn_RW;
164 u64 tlb_invalidate_entry_W;
165 u64 tlb_invalidate_all_W;
166 u64 smm_hid;
167 u64 mfc_accr_RW;
168 u64 mfc_dsisr_RW;
169 u64 mfc_dar_RW;
170 u64 rmt_index_RW;
171 u64 rmt_data1_RW;
172 u64 mfc_dsir_R;
173 u64 mfc_lsacr_RW;
174 u64 mfc_lscrr_R;
175 u64 mfc_tclass_id_RW;
176 u64 mfc_rm_boundary;
177 u64 smf_dma_signal_sel;
178 u64 smm_signal_sel;
179 u64 mfc_cer_R;
180 u64 pu_ecc_cntl_RW;
181 u64 pu_ecc_stat_RW;
182 u64 spu_ecc_addr_RW;
183 u64 spu_err_mask_RW;
184 u64 spu_trig0_sel;
185 u64 spu_trig1_sel;
186 u64 spu_trig2_sel;
187 u64 spu_trig3_sel;
188 u64 spu_trace_sel;
189 u64 spu_event0_sel;
190 u64 spu_event1_sel;
191 u64 spu_event2_sel;
192 u64 spu_event3_sel;
193 u64 spu_trace_cntl;
194};
195
196/*
197 * struct spu_priv2_collapsed - condensed privileged 2 area, w/o pads.
198 */
199struct spu_priv2_collapsed {
200 u64 slb_index_W;
201 u64 slb_esid_RW;
202 u64 slb_vsid_RW;
203 u64 slb_invalidate_entry_W;
204 u64 slb_invalidate_all_W;
205 struct mfc_cq_sr spuq[16];
206 struct mfc_cq_sr puq[8];
207 u64 mfc_control_RW;
208 u64 puint_mb_R;
209 u64 spu_privcntl_RW;
210 u64 spu_lslr_RW;
211 u64 spu_chnlcntptr_RW;
212 u64 spu_chnlcnt_RW;
213 u64 spu_chnldata_RW;
214 u64 spu_cfg_RW;
215 u64 spu_tag_status_query_RW;
216 u64 spu_cmd_buf1_RW;
217 u64 spu_cmd_buf2_RW;
218 u64 spu_atomic_status_RW;
219};
220
221/**
222 * struct spu_state
223 * @lscsa: Local Store Context Save Area.
224 * @prob: Collapsed Problem State Area, w/o pads.
225 * @priv1: Collapsed Privileged 1 Area, w/o pads.
226 * @priv2: Collapsed Privileged 2 Area, w/o pads.
227 * @spu_chnlcnt_RW: Array of saved channel counts.
228 * @spu_chnldata_RW: Array of saved channel data.
229 * @suspend_time: Time stamp when decrementer disabled.
230 *
231 * Structure representing the whole of the SPU
232 * context save area (CSA). This struct contains
233 * all of the state necessary to suspend and then
234 * later optionally resume execution of an SPU
235 * context.
236 *
237 * The @lscsa region is by far the largest, and is
238 * allocated separately so that it may either be
239 * pinned or mapped to/from application memory, as
240 * appropriate for the OS environment.
241 */
242struct spu_state {
243 struct spu_lscsa *lscsa;
244#ifdef CONFIG_SPU_FS_64K_LS
245 int use_big_pages;
246 /* One struct page per 64k page */
247#define SPU_LSCSA_NUM_BIG_PAGES (sizeof(struct spu_lscsa) / 0x10000)
248 struct page *lscsa_pages[SPU_LSCSA_NUM_BIG_PAGES];
249#endif
250 struct spu_problem_collapsed prob;
251 struct spu_priv1_collapsed priv1;
252 struct spu_priv2_collapsed priv2;
253 u64 spu_chnlcnt_RW[32];
254 u64 spu_chnldata_RW[32];
255 u32 spu_mailbox_data[4];
256 u32 pu_mailbox_data[1];
257 u64 class_0_dar, class_0_pending;
258 u64 class_1_dar, class_1_dsisr;
259 unsigned long suspend_time;
260 spinlock_t register_lock;
261};
262
263#endif /* !__SPU__ */
264#endif /* __KERNEL__ */
265#endif /* !__ASSEMBLY__ */
266#endif /* _SPU_CSA_H_ */
diff --git a/arch/powerpc/include/asm/spu_info.h b/arch/powerpc/include/asm/spu_info.h
new file mode 100644
index 000000000000..3545efbf9891
--- /dev/null
+++ b/arch/powerpc/include/asm/spu_info.h
@@ -0,0 +1,54 @@
1/*
2 * SPU info structures
3 *
4 * (C) Copyright 2006 IBM Corp.
5 *
6 * Author: Dwayne Grant McConnell <decimal@us.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _SPU_INFO_H
24#define _SPU_INFO_H
25
26#ifdef __KERNEL__
27#include <asm/spu.h>
28#include <linux/types.h>
29#else
30struct mfc_cq_sr {
31 __u64 mfc_cq_data0_RW;
32 __u64 mfc_cq_data1_RW;
33 __u64 mfc_cq_data2_RW;
34 __u64 mfc_cq_data3_RW;
35};
36#endif /* __KERNEL__ */
37
38struct spu_dma_info {
39 __u64 dma_info_type;
40 __u64 dma_info_mask;
41 __u64 dma_info_status;
42 __u64 dma_info_stall_and_notify;
43 __u64 dma_info_atomic_command_status;
44 struct mfc_cq_sr dma_info_command_data[16];
45};
46
47struct spu_proxydma_info {
48 __u64 proxydma_info_type;
49 __u64 proxydma_info_mask;
50 __u64 proxydma_info_status;
51 struct mfc_cq_sr proxydma_info_command_data[8];
52};
53
54#endif
diff --git a/arch/powerpc/include/asm/spu_priv1.h b/arch/powerpc/include/asm/spu_priv1.h
new file mode 100644
index 000000000000..25020a34ce7f
--- /dev/null
+++ b/arch/powerpc/include/asm/spu_priv1.h
@@ -0,0 +1,236 @@
1/*
2 * Defines an spu hypervisor abstraction layer.
3 *
4 * Copyright 2006 Sony Corp.
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; version 2 of the License.
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#if !defined(_SPU_PRIV1_H)
21#define _SPU_PRIV1_H
22#if defined(__KERNEL__)
23
24#include <linux/types.h>
25
26struct spu;
27struct spu_context;
28
29/* access to priv1 registers */
30
31struct spu_priv1_ops {
32 void (*int_mask_and) (struct spu *spu, int class, u64 mask);
33 void (*int_mask_or) (struct spu *spu, int class, u64 mask);
34 void (*int_mask_set) (struct spu *spu, int class, u64 mask);
35 u64 (*int_mask_get) (struct spu *spu, int class);
36 void (*int_stat_clear) (struct spu *spu, int class, u64 stat);
37 u64 (*int_stat_get) (struct spu *spu, int class);
38 void (*cpu_affinity_set) (struct spu *spu, int cpu);
39 u64 (*mfc_dar_get) (struct spu *spu);
40 u64 (*mfc_dsisr_get) (struct spu *spu);
41 void (*mfc_dsisr_set) (struct spu *spu, u64 dsisr);
42 void (*mfc_sdr_setup) (struct spu *spu);
43 void (*mfc_sr1_set) (struct spu *spu, u64 sr1);
44 u64 (*mfc_sr1_get) (struct spu *spu);
45 void (*mfc_tclass_id_set) (struct spu *spu, u64 tclass_id);
46 u64 (*mfc_tclass_id_get) (struct spu *spu);
47 void (*tlb_invalidate) (struct spu *spu);
48 void (*resource_allocation_groupID_set) (struct spu *spu, u64 id);
49 u64 (*resource_allocation_groupID_get) (struct spu *spu);
50 void (*resource_allocation_enable_set) (struct spu *spu, u64 enable);
51 u64 (*resource_allocation_enable_get) (struct spu *spu);
52};
53
54extern const struct spu_priv1_ops* spu_priv1_ops;
55
56static inline void
57spu_int_mask_and (struct spu *spu, int class, u64 mask)
58{
59 spu_priv1_ops->int_mask_and(spu, class, mask);
60}
61
62static inline void
63spu_int_mask_or (struct spu *spu, int class, u64 mask)
64{
65 spu_priv1_ops->int_mask_or(spu, class, mask);
66}
67
68static inline void
69spu_int_mask_set (struct spu *spu, int class, u64 mask)
70{
71 spu_priv1_ops->int_mask_set(spu, class, mask);
72}
73
74static inline u64
75spu_int_mask_get (struct spu *spu, int class)
76{
77 return spu_priv1_ops->int_mask_get(spu, class);
78}
79
80static inline void
81spu_int_stat_clear (struct spu *spu, int class, u64 stat)
82{
83 spu_priv1_ops->int_stat_clear(spu, class, stat);
84}
85
86static inline u64
87spu_int_stat_get (struct spu *spu, int class)
88{
89 return spu_priv1_ops->int_stat_get (spu, class);
90}
91
92static inline void
93spu_cpu_affinity_set (struct spu *spu, int cpu)
94{
95 spu_priv1_ops->cpu_affinity_set(spu, cpu);
96}
97
98static inline u64
99spu_mfc_dar_get (struct spu *spu)
100{
101 return spu_priv1_ops->mfc_dar_get(spu);
102}
103
104static inline u64
105spu_mfc_dsisr_get (struct spu *spu)
106{
107 return spu_priv1_ops->mfc_dsisr_get(spu);
108}
109
110static inline void
111spu_mfc_dsisr_set (struct spu *spu, u64 dsisr)
112{
113 spu_priv1_ops->mfc_dsisr_set(spu, dsisr);
114}
115
116static inline void
117spu_mfc_sdr_setup (struct spu *spu)
118{
119 spu_priv1_ops->mfc_sdr_setup(spu);
120}
121
122static inline void
123spu_mfc_sr1_set (struct spu *spu, u64 sr1)
124{
125 spu_priv1_ops->mfc_sr1_set(spu, sr1);
126}
127
128static inline u64
129spu_mfc_sr1_get (struct spu *spu)
130{
131 return spu_priv1_ops->mfc_sr1_get(spu);
132}
133
134static inline void
135spu_mfc_tclass_id_set (struct spu *spu, u64 tclass_id)
136{
137 spu_priv1_ops->mfc_tclass_id_set(spu, tclass_id);
138}
139
140static inline u64
141spu_mfc_tclass_id_get (struct spu *spu)
142{
143 return spu_priv1_ops->mfc_tclass_id_get(spu);
144}
145
146static inline void
147spu_tlb_invalidate (struct spu *spu)
148{
149 spu_priv1_ops->tlb_invalidate(spu);
150}
151
152static inline void
153spu_resource_allocation_groupID_set (struct spu *spu, u64 id)
154{
155 spu_priv1_ops->resource_allocation_groupID_set(spu, id);
156}
157
158static inline u64
159spu_resource_allocation_groupID_get (struct spu *spu)
160{
161 return spu_priv1_ops->resource_allocation_groupID_get(spu);
162}
163
164static inline void
165spu_resource_allocation_enable_set (struct spu *spu, u64 enable)
166{
167 spu_priv1_ops->resource_allocation_enable_set(spu, enable);
168}
169
170static inline u64
171spu_resource_allocation_enable_get (struct spu *spu)
172{
173 return spu_priv1_ops->resource_allocation_enable_get(spu);
174}
175
176/* spu management abstraction */
177
178struct spu_management_ops {
179 int (*enumerate_spus)(int (*fn)(void *data));
180 int (*create_spu)(struct spu *spu, void *data);
181 int (*destroy_spu)(struct spu *spu);
182 void (*enable_spu)(struct spu_context *ctx);
183 void (*disable_spu)(struct spu_context *ctx);
184 int (*init_affinity)(void);
185};
186
187extern const struct spu_management_ops* spu_management_ops;
188
189static inline int
190spu_enumerate_spus (int (*fn)(void *data))
191{
192 return spu_management_ops->enumerate_spus(fn);
193}
194
195static inline int
196spu_create_spu (struct spu *spu, void *data)
197{
198 return spu_management_ops->create_spu(spu, data);
199}
200
201static inline int
202spu_destroy_spu (struct spu *spu)
203{
204 return spu_management_ops->destroy_spu(spu);
205}
206
207static inline int
208spu_init_affinity (void)
209{
210 return spu_management_ops->init_affinity();
211}
212
213static inline void
214spu_enable_spu (struct spu_context *ctx)
215{
216 spu_management_ops->enable_spu(ctx);
217}
218
219static inline void
220spu_disable_spu (struct spu_context *ctx)
221{
222 spu_management_ops->disable_spu(ctx);
223}
224
225/*
226 * The declarations folowing are put here for convenience
227 * and only intended to be used by the platform setup code.
228 */
229
230extern const struct spu_priv1_ops spu_priv1_mmio_ops;
231extern const struct spu_priv1_ops spu_priv1_beat_ops;
232
233extern const struct spu_management_ops spu_management_of_ops;
234
235#endif /* __KERNEL__ */
236#endif
diff --git a/arch/powerpc/include/asm/sstep.h b/arch/powerpc/include/asm/sstep.h
new file mode 100644
index 000000000000..f593b0f9b627
--- /dev/null
+++ b/arch/powerpc/include/asm/sstep.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2004 Paul Mackerras <paulus@au.ibm.com>, IBM
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10struct pt_regs;
11
12/*
13 * We don't allow single-stepping an mtmsrd that would clear
14 * MSR_RI, since that would make the exception unrecoverable.
15 * Since we need to single-step to proceed from a breakpoint,
16 * we don't allow putting a breakpoint on an mtmsrd instruction.
17 * Similarly we don't allow breakpoints on rfid instructions.
18 * These macros tell us if an instruction is a mtmsrd or rfid.
19 * Note that IS_MTMSRD returns true for both an mtmsr (32-bit)
20 * and an mtmsrd (64-bit).
21 */
22#define IS_MTMSRD(instr) (((instr) & 0xfc0007be) == 0x7c000124)
23#define IS_RFID(instr) (((instr) & 0xfc0007fe) == 0x4c000024)
24#define IS_RFI(instr) (((instr) & 0xfc0007fe) == 0x4c000064)
25
26/* Emulate instructions that cause a transfer of control. */
27extern int emulate_step(struct pt_regs *regs, unsigned int instr);
diff --git a/arch/powerpc/include/asm/stat.h b/arch/powerpc/include/asm/stat.h
new file mode 100644
index 000000000000..e4edc510b530
--- /dev/null
+++ b/arch/powerpc/include/asm/stat.h
@@ -0,0 +1,81 @@
1#ifndef _ASM_POWERPC_STAT_H
2#define _ASM_POWERPC_STAT_H
3/*
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/types.h>
10
11#define STAT_HAVE_NSEC 1
12
13#ifndef __powerpc64__
14struct __old_kernel_stat {
15 unsigned short st_dev;
16 unsigned short st_ino;
17 unsigned short st_mode;
18 unsigned short st_nlink;
19 unsigned short st_uid;
20 unsigned short st_gid;
21 unsigned short st_rdev;
22 unsigned long st_size;
23 unsigned long st_atime;
24 unsigned long st_mtime;
25 unsigned long st_ctime;
26};
27#endif /* !__powerpc64__ */
28
29struct stat {
30 unsigned long st_dev;
31 ino_t st_ino;
32#ifdef __powerpc64__
33 nlink_t st_nlink;
34 mode_t st_mode;
35#else
36 mode_t st_mode;
37 nlink_t st_nlink;
38#endif
39 uid_t st_uid;
40 gid_t st_gid;
41 unsigned long st_rdev;
42 off_t st_size;
43 unsigned long st_blksize;
44 unsigned long st_blocks;
45 unsigned long st_atime;
46 unsigned long st_atime_nsec;
47 unsigned long st_mtime;
48 unsigned long st_mtime_nsec;
49 unsigned long st_ctime;
50 unsigned long st_ctime_nsec;
51 unsigned long __unused4;
52 unsigned long __unused5;
53#ifdef __powerpc64__
54 unsigned long __unused6;
55#endif
56};
57
58/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
59struct stat64 {
60 unsigned long long st_dev; /* Device. */
61 unsigned long long st_ino; /* File serial number. */
62 unsigned int st_mode; /* File mode. */
63 unsigned int st_nlink; /* Link count. */
64 unsigned int st_uid; /* User ID of the file's owner. */
65 unsigned int st_gid; /* Group ID of the file's group. */
66 unsigned long long st_rdev; /* Device number, if device. */
67 unsigned short __pad2;
68 long long st_size; /* Size of file, in bytes. */
69 int st_blksize; /* Optimal block size for I/O. */
70 long long st_blocks; /* Number 512-byte blocks allocated. */
71 int st_atime; /* Time of last access. */
72 unsigned int st_atime_nsec;
73 int st_mtime; /* Time of last modification. */
74 unsigned int st_mtime_nsec;
75 int st_ctime; /* Time of last status change. */
76 unsigned int st_ctime_nsec;
77 unsigned int __unused4;
78 unsigned int __unused5;
79};
80
81#endif /* _ASM_POWERPC_STAT_H */
diff --git a/arch/powerpc/include/asm/statfs.h b/arch/powerpc/include/asm/statfs.h
new file mode 100644
index 000000000000..67024026c10d
--- /dev/null
+++ b/arch/powerpc/include/asm/statfs.h
@@ -0,0 +1,60 @@
1#ifndef _ASM_POWERPC_STATFS_H
2#define _ASM_POWERPC_STATFS_H
3
4/* For ppc32 we just use the generic definitions, not so simple on ppc64 */
5
6#ifndef __powerpc64__
7#include <asm-generic/statfs.h>
8#else
9
10#ifndef __KERNEL_STRICT_NAMES
11#include <linux/types.h>
12typedef __kernel_fsid_t fsid_t;
13#endif
14
15/*
16 * We're already 64-bit, so duplicate the definition
17 */
18struct statfs {
19 long f_type;
20 long f_bsize;
21 long f_blocks;
22 long f_bfree;
23 long f_bavail;
24 long f_files;
25 long f_ffree;
26 __kernel_fsid_t f_fsid;
27 long f_namelen;
28 long f_frsize;
29 long f_spare[5];
30};
31
32struct statfs64 {
33 long f_type;
34 long f_bsize;
35 long f_blocks;
36 long f_bfree;
37 long f_bavail;
38 long f_files;
39 long f_ffree;
40 __kernel_fsid_t f_fsid;
41 long f_namelen;
42 long f_frsize;
43 long f_spare[5];
44};
45
46struct compat_statfs64 {
47 __u32 f_type;
48 __u32 f_bsize;
49 __u64 f_blocks;
50 __u64 f_bfree;
51 __u64 f_bavail;
52 __u64 f_files;
53 __u64 f_ffree;
54 __kernel_fsid_t f_fsid;
55 __u32 f_namelen;
56 __u32 f_frsize;
57 __u32 f_spare[5];
58};
59#endif /* ! __powerpc64__ */
60#endif
diff --git a/arch/powerpc/include/asm/string.h b/arch/powerpc/include/asm/string.h
new file mode 100644
index 000000000000..e40010abcaf1
--- /dev/null
+++ b/arch/powerpc/include/asm/string.h
@@ -0,0 +1,32 @@
1#ifndef _ASM_POWERPC_STRING_H
2#define _ASM_POWERPC_STRING_H
3
4#ifdef __KERNEL__
5
6#define __HAVE_ARCH_STRCPY
7#define __HAVE_ARCH_STRNCPY
8#define __HAVE_ARCH_STRLEN
9#define __HAVE_ARCH_STRCMP
10#define __HAVE_ARCH_STRNCMP
11#define __HAVE_ARCH_STRCAT
12#define __HAVE_ARCH_MEMSET
13#define __HAVE_ARCH_MEMCPY
14#define __HAVE_ARCH_MEMMOVE
15#define __HAVE_ARCH_MEMCMP
16#define __HAVE_ARCH_MEMCHR
17
18extern char * strcpy(char *,const char *);
19extern char * strncpy(char *,const char *, __kernel_size_t);
20extern __kernel_size_t strlen(const char *);
21extern int strcmp(const char *,const char *);
22extern int strncmp(const char *, const char *, __kernel_size_t);
23extern char * strcat(char *, const char *);
24extern void * memset(void *,int,__kernel_size_t);
25extern void * memcpy(void *,const void *,__kernel_size_t);
26extern void * memmove(void *,const void *,__kernel_size_t);
27extern int memcmp(const void *,const void *,__kernel_size_t);
28extern void * memchr(const void *,int,__kernel_size_t);
29
30#endif /* __KERNEL__ */
31
32#endif /* _ASM_POWERPC_STRING_H */
diff --git a/arch/powerpc/include/asm/suspend.h b/arch/powerpc/include/asm/suspend.h
new file mode 100644
index 000000000000..cbf2c9404c37
--- /dev/null
+++ b/arch/powerpc/include/asm/suspend.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_POWERPC_SUSPEND_H
2#define __ASM_POWERPC_SUSPEND_H
3
4static inline int arch_prepare_suspend(void) { return 0; }
5
6void save_processor_state(void);
7void restore_processor_state(void);
8
9#endif /* __ASM_POWERPC_SUSPEND_H */
diff --git a/arch/powerpc/include/asm/synch.h b/arch/powerpc/include/asm/synch.h
new file mode 100644
index 000000000000..45963e80f557
--- /dev/null
+++ b/arch/powerpc/include/asm/synch.h
@@ -0,0 +1,44 @@
1#ifndef _ASM_POWERPC_SYNCH_H
2#define _ASM_POWERPC_SYNCH_H
3#ifdef __KERNEL__
4
5#include <linux/stringify.h>
6#include <asm/feature-fixups.h>
7
8#ifndef __ASSEMBLY__
9extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup;
10extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
11 void *fixup_end);
12
13static inline void eieio(void)
14{
15 __asm__ __volatile__ ("eieio" : : : "memory");
16}
17
18static inline void isync(void)
19{
20 __asm__ __volatile__ ("isync" : : : "memory");
21}
22#endif /* __ASSEMBLY__ */
23
24#if defined(__powerpc64__)
25# define LWSYNC lwsync
26#elif defined(CONFIG_E500)
27# define LWSYNC \
28 START_LWSYNC_SECTION(96); \
29 sync; \
30 MAKE_LWSYNC_SECTION_ENTRY(96, __lwsync_fixup);
31#else
32# define LWSYNC sync
33#endif
34
35#ifdef CONFIG_SMP
36#define ISYNC_ON_SMP "\n\tisync\n"
37#define LWSYNC_ON_SMP stringify_in_c(LWSYNC) "\n"
38#else
39#define ISYNC_ON_SMP
40#define LWSYNC_ON_SMP
41#endif
42
43#endif /* __KERNEL__ */
44#endif /* _ASM_POWERPC_SYNCH_H */
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
new file mode 100644
index 000000000000..efa7f0b879f3
--- /dev/null
+++ b/arch/powerpc/include/asm/syscall.h
@@ -0,0 +1,84 @@
1/*
2 * Access to user system call parameters and results
3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * See asm-generic/syscall.h for descriptions of what we must do here.
11 */
12
13#ifndef _ASM_SYSCALL_H
14#define _ASM_SYSCALL_H 1
15
16#include <linux/sched.h>
17
18static inline long syscall_get_nr(struct task_struct *task,
19 struct pt_regs *regs)
20{
21 return TRAP(regs) == 0xc00 ? regs->gpr[0] : -1L;
22}
23
24static inline void syscall_rollback(struct task_struct *task,
25 struct pt_regs *regs)
26{
27 regs->gpr[3] = regs->orig_gpr3;
28}
29
30static inline long syscall_get_error(struct task_struct *task,
31 struct pt_regs *regs)
32{
33 return (regs->ccr & 0x1000) ? -regs->gpr[3] : 0;
34}
35
36static inline long syscall_get_return_value(struct task_struct *task,
37 struct pt_regs *regs)
38{
39 return regs->gpr[3];
40}
41
42static inline void syscall_set_return_value(struct task_struct *task,
43 struct pt_regs *regs,
44 int error, long val)
45{
46 if (error) {
47 regs->ccr |= 0x1000L;
48 regs->gpr[3] = -error;
49 } else {
50 regs->ccr &= ~0x1000L;
51 regs->gpr[3] = val;
52 }
53}
54
55static inline void syscall_get_arguments(struct task_struct *task,
56 struct pt_regs *regs,
57 unsigned int i, unsigned int n,
58 unsigned long *args)
59{
60 BUG_ON(i + n > 6);
61#ifdef CONFIG_PPC64
62 if (test_tsk_thread_flag(task, TIF_32BIT)) {
63 /*
64 * Zero-extend 32-bit argument values. The high bits are
65 * garbage ignored by the actual syscall dispatch.
66 */
67 while (n-- > 0)
68 args[n] = (u32) regs->gpr[3 + i + n];
69 return;
70 }
71#endif
72 memcpy(args, &regs->gpr[3 + i], n * sizeof(args[0]));
73}
74
75static inline void syscall_set_arguments(struct task_struct *task,
76 struct pt_regs *regs,
77 unsigned int i, unsigned int n,
78 const unsigned long *args)
79{
80 BUG_ON(i + n > 6);
81 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
82}
83
84#endif /* _ASM_SYSCALL_H */
diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
new file mode 100644
index 000000000000..eb8eb400c664
--- /dev/null
+++ b/arch/powerpc/include/asm/syscalls.h
@@ -0,0 +1,52 @@
1#ifndef __ASM_POWERPC_SYSCALLS_H
2#define __ASM_POWERPC_SYSCALLS_H
3#ifdef __KERNEL__
4
5#include <linux/compiler.h>
6#include <linux/linkage.h>
7#include <linux/types.h>
8#include <asm/signal.h>
9
10struct new_utsname;
11struct pt_regs;
12struct rtas_args;
13struct sigaction;
14
15asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
16 unsigned long prot, unsigned long flags,
17 unsigned long fd, off_t offset);
18asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len,
19 unsigned long prot, unsigned long flags,
20 unsigned long fd, unsigned long pgoff);
21asmlinkage int sys_execve(unsigned long a0, unsigned long a1,
22 unsigned long a2, unsigned long a3, unsigned long a4,
23 unsigned long a5, struct pt_regs *regs);
24asmlinkage int sys_clone(unsigned long clone_flags, unsigned long usp,
25 int __user *parent_tidp, void __user *child_threadptr,
26 int __user *child_tidp, int p6, struct pt_regs *regs);
27asmlinkage int sys_fork(unsigned long p1, unsigned long p2,
28 unsigned long p3, unsigned long p4, unsigned long p5,
29 unsigned long p6, struct pt_regs *regs);
30asmlinkage int sys_vfork(unsigned long p1, unsigned long p2,
31 unsigned long p3, unsigned long p4, unsigned long p5,
32 unsigned long p6, struct pt_regs *regs);
33asmlinkage long sys_pipe(int __user *fildes);
34asmlinkage long sys_pipe2(int __user *fildes, int flags);
35asmlinkage long sys_rt_sigaction(int sig,
36 const struct sigaction __user *act,
37 struct sigaction __user *oact, size_t sigsetsize);
38asmlinkage int sys_ipc(uint call, int first, unsigned long second,
39 long third, void __user *ptr, long fifth);
40asmlinkage long ppc64_personality(unsigned long personality);
41asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
42asmlinkage time_t sys64_time(time_t __user * tloc);
43asmlinkage long ppc_newuname(struct new_utsname __user * name);
44
45asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset,
46 size_t sigsetsize);
47asmlinkage long sys_sigaltstack(const stack_t __user *uss,
48 stack_t __user *uoss, unsigned long r5, unsigned long r6,
49 unsigned long r7, unsigned long r8, struct pt_regs *regs);
50
51#endif /* __KERNEL__ */
52#endif /* __ASM_POWERPC_SYSCALLS_H */
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
new file mode 100644
index 000000000000..e084272ed1c2
--- /dev/null
+++ b/arch/powerpc/include/asm/systbl.h
@@ -0,0 +1,324 @@
1/*
2 * List of powerpc syscalls. For the meaning of the _SPU suffix see
3 * arch/powerpc/platforms/cell/spu_callbacks.c
4 */
5
6SYSCALL(restart_syscall)
7SYSCALL(exit)
8PPC_SYS(fork)
9SYSCALL_SPU(read)
10SYSCALL_SPU(write)
11COMPAT_SYS_SPU(open)
12SYSCALL_SPU(close)
13COMPAT_SYS_SPU(waitpid)
14COMPAT_SYS_SPU(creat)
15SYSCALL_SPU(link)
16SYSCALL_SPU(unlink)
17COMPAT_SYS(execve)
18SYSCALL_SPU(chdir)
19COMPAT_SYS_SPU(time)
20SYSCALL_SPU(mknod)
21SYSCALL_SPU(chmod)
22SYSCALL_SPU(lchown)
23SYSCALL(ni_syscall)
24OLDSYS(stat)
25SYSX_SPU(sys_lseek,ppc32_lseek,sys_lseek)
26SYSCALL_SPU(getpid)
27COMPAT_SYS(mount)
28SYSX(sys_ni_syscall,sys_oldumount,sys_oldumount)
29SYSCALL_SPU(setuid)
30SYSCALL_SPU(getuid)
31COMPAT_SYS_SPU(stime)
32COMPAT_SYS(ptrace)
33SYSCALL_SPU(alarm)
34OLDSYS(fstat)
35COMPAT_SYS(pause)
36COMPAT_SYS(utime)
37SYSCALL(ni_syscall)
38SYSCALL(ni_syscall)
39COMPAT_SYS_SPU(access)
40COMPAT_SYS_SPU(nice)
41SYSCALL(ni_syscall)
42SYSCALL_SPU(sync)
43COMPAT_SYS_SPU(kill)
44SYSCALL_SPU(rename)
45COMPAT_SYS_SPU(mkdir)
46SYSCALL_SPU(rmdir)
47SYSCALL_SPU(dup)
48SYSCALL_SPU(pipe)
49COMPAT_SYS_SPU(times)
50SYSCALL(ni_syscall)
51SYSCALL_SPU(brk)
52SYSCALL_SPU(setgid)
53SYSCALL_SPU(getgid)
54SYSCALL(signal)
55SYSCALL_SPU(geteuid)
56SYSCALL_SPU(getegid)
57SYSCALL(acct)
58SYSCALL(umount)
59SYSCALL(ni_syscall)
60COMPAT_SYS_SPU(ioctl)
61COMPAT_SYS_SPU(fcntl)
62SYSCALL(ni_syscall)
63COMPAT_SYS_SPU(setpgid)
64SYSCALL(ni_syscall)
65SYSX(sys_ni_syscall,sys_olduname, sys_olduname)
66COMPAT_SYS_SPU(umask)
67SYSCALL_SPU(chroot)
68SYSCALL(ustat)
69SYSCALL_SPU(dup2)
70SYSCALL_SPU(getppid)
71SYSCALL_SPU(getpgrp)
72SYSCALL_SPU(setsid)
73SYS32ONLY(sigaction)
74SYSCALL_SPU(sgetmask)
75COMPAT_SYS_SPU(ssetmask)
76SYSCALL_SPU(setreuid)
77SYSCALL_SPU(setregid)
78SYS32ONLY(sigsuspend)
79COMPAT_SYS(sigpending)
80COMPAT_SYS_SPU(sethostname)
81COMPAT_SYS_SPU(setrlimit)
82COMPAT_SYS(old_getrlimit)
83COMPAT_SYS_SPU(getrusage)
84COMPAT_SYS_SPU(gettimeofday)
85COMPAT_SYS_SPU(settimeofday)
86COMPAT_SYS_SPU(getgroups)
87COMPAT_SYS_SPU(setgroups)
88SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select)
89SYSCALL_SPU(symlink)
90OLDSYS(lstat)
91COMPAT_SYS_SPU(readlink)
92SYSCALL(uselib)
93SYSCALL(swapon)
94SYSCALL(reboot)
95SYSX(sys_ni_syscall,old32_readdir,old_readdir)
96SYSCALL_SPU(mmap)
97SYSCALL_SPU(munmap)
98SYSCALL_SPU(truncate)
99SYSCALL_SPU(ftruncate)
100SYSCALL_SPU(fchmod)
101SYSCALL_SPU(fchown)
102COMPAT_SYS_SPU(getpriority)
103COMPAT_SYS_SPU(setpriority)
104SYSCALL(ni_syscall)
105COMPAT_SYS(statfs)
106COMPAT_SYS(fstatfs)
107SYSCALL(ni_syscall)
108COMPAT_SYS_SPU(socketcall)
109COMPAT_SYS_SPU(syslog)
110COMPAT_SYS_SPU(setitimer)
111COMPAT_SYS_SPU(getitimer)
112COMPAT_SYS_SPU(newstat)
113COMPAT_SYS_SPU(newlstat)
114COMPAT_SYS_SPU(newfstat)
115SYSX(sys_ni_syscall,sys_uname,sys_uname)
116SYSCALL(ni_syscall)
117SYSCALL_SPU(vhangup)
118SYSCALL(ni_syscall)
119SYSCALL(ni_syscall)
120COMPAT_SYS_SPU(wait4)
121SYSCALL(swapoff)
122COMPAT_SYS_SPU(sysinfo)
123COMPAT_SYS(ipc)
124SYSCALL_SPU(fsync)
125SYS32ONLY(sigreturn)
126PPC_SYS(clone)
127COMPAT_SYS_SPU(setdomainname)
128PPC_SYS_SPU(newuname)
129SYSCALL(ni_syscall)
130COMPAT_SYS_SPU(adjtimex)
131SYSCALL_SPU(mprotect)
132SYSX(sys_ni_syscall,compat_sys_sigprocmask,sys_sigprocmask)
133SYSCALL(ni_syscall)
134SYSCALL(init_module)
135SYSCALL(delete_module)
136SYSCALL(ni_syscall)
137SYSCALL(quotactl)
138COMPAT_SYS_SPU(getpgid)
139SYSCALL_SPU(fchdir)
140SYSCALL_SPU(bdflush)
141COMPAT_SYS(sysfs)
142SYSX_SPU(ppc64_personality,ppc64_personality,sys_personality)
143SYSCALL(ni_syscall)
144SYSCALL_SPU(setfsuid)
145SYSCALL_SPU(setfsgid)
146SYSCALL_SPU(llseek)
147COMPAT_SYS_SPU(getdents)
148SYSX_SPU(sys_select,ppc32_select,ppc_select)
149SYSCALL_SPU(flock)
150SYSCALL_SPU(msync)
151COMPAT_SYS_SPU(readv)
152COMPAT_SYS_SPU(writev)
153COMPAT_SYS_SPU(getsid)
154SYSCALL_SPU(fdatasync)
155COMPAT_SYS(sysctl)
156SYSCALL_SPU(mlock)
157SYSCALL_SPU(munlock)
158SYSCALL_SPU(mlockall)
159SYSCALL_SPU(munlockall)
160COMPAT_SYS_SPU(sched_setparam)
161COMPAT_SYS_SPU(sched_getparam)
162COMPAT_SYS_SPU(sched_setscheduler)
163COMPAT_SYS_SPU(sched_getscheduler)
164SYSCALL_SPU(sched_yield)
165COMPAT_SYS_SPU(sched_get_priority_max)
166COMPAT_SYS_SPU(sched_get_priority_min)
167COMPAT_SYS_SPU(sched_rr_get_interval)
168COMPAT_SYS_SPU(nanosleep)
169SYSCALL_SPU(mremap)
170SYSCALL_SPU(setresuid)
171SYSCALL_SPU(getresuid)
172SYSCALL(ni_syscall)
173SYSCALL_SPU(poll)
174COMPAT_SYS(nfsservctl)
175SYSCALL_SPU(setresgid)
176SYSCALL_SPU(getresgid)
177COMPAT_SYS_SPU(prctl)
178COMPAT_SYS(rt_sigreturn)
179COMPAT_SYS(rt_sigaction)
180COMPAT_SYS(rt_sigprocmask)
181COMPAT_SYS(rt_sigpending)
182COMPAT_SYS(rt_sigtimedwait)
183COMPAT_SYS(rt_sigqueueinfo)
184COMPAT_SYS(rt_sigsuspend)
185COMPAT_SYS_SPU(pread64)
186COMPAT_SYS_SPU(pwrite64)
187SYSCALL_SPU(chown)
188SYSCALL_SPU(getcwd)
189SYSCALL_SPU(capget)
190SYSCALL_SPU(capset)
191COMPAT_SYS(sigaltstack)
192SYSX_SPU(sys_sendfile64,compat_sys_sendfile,sys_sendfile)
193SYSCALL(ni_syscall)
194SYSCALL(ni_syscall)
195PPC_SYS(vfork)
196COMPAT_SYS_SPU(getrlimit)
197COMPAT_SYS_SPU(readahead)
198SYS32ONLY(mmap2)
199SYS32ONLY(truncate64)
200SYS32ONLY(ftruncate64)
201SYSX(sys_ni_syscall,sys_stat64,sys_stat64)
202SYSX(sys_ni_syscall,sys_lstat64,sys_lstat64)
203SYSX(sys_ni_syscall,sys_fstat64,sys_fstat64)
204SYSCALL(pciconfig_read)
205SYSCALL(pciconfig_write)
206SYSCALL(pciconfig_iobase)
207SYSCALL(ni_syscall)
208SYSCALL_SPU(getdents64)
209SYSCALL_SPU(pivot_root)
210SYSX(sys_ni_syscall,compat_sys_fcntl64,sys_fcntl64)
211SYSCALL_SPU(madvise)
212SYSCALL_SPU(mincore)
213SYSCALL_SPU(gettid)
214SYSCALL_SPU(tkill)
215SYSCALL_SPU(setxattr)
216SYSCALL_SPU(lsetxattr)
217SYSCALL_SPU(fsetxattr)
218SYSCALL_SPU(getxattr)
219SYSCALL_SPU(lgetxattr)
220SYSCALL_SPU(fgetxattr)
221SYSCALL_SPU(listxattr)
222SYSCALL_SPU(llistxattr)
223SYSCALL_SPU(flistxattr)
224SYSCALL_SPU(removexattr)
225SYSCALL_SPU(lremovexattr)
226SYSCALL_SPU(fremovexattr)
227COMPAT_SYS_SPU(futex)
228COMPAT_SYS_SPU(sched_setaffinity)
229COMPAT_SYS_SPU(sched_getaffinity)
230SYSCALL(ni_syscall)
231SYSCALL(ni_syscall)
232SYS32ONLY(sendfile64)
233COMPAT_SYS_SPU(io_setup)
234SYSCALL_SPU(io_destroy)
235COMPAT_SYS_SPU(io_getevents)
236COMPAT_SYS_SPU(io_submit)
237SYSCALL_SPU(io_cancel)
238SYSCALL(set_tid_address)
239SYSX_SPU(sys_fadvise64,ppc32_fadvise64,sys_fadvise64)
240SYSCALL(exit_group)
241SYSX(sys_lookup_dcookie,ppc32_lookup_dcookie,sys_lookup_dcookie)
242SYSCALL_SPU(epoll_create)
243SYSCALL_SPU(epoll_ctl)
244SYSCALL_SPU(epoll_wait)
245SYSCALL_SPU(remap_file_pages)
246SYSX_SPU(sys_timer_create,compat_sys_timer_create,sys_timer_create)
247COMPAT_SYS_SPU(timer_settime)
248COMPAT_SYS_SPU(timer_gettime)
249SYSCALL_SPU(timer_getoverrun)
250SYSCALL_SPU(timer_delete)
251COMPAT_SYS_SPU(clock_settime)
252COMPAT_SYS_SPU(clock_gettime)
253COMPAT_SYS_SPU(clock_getres)
254COMPAT_SYS_SPU(clock_nanosleep)
255SYSX(ppc64_swapcontext,ppc32_swapcontext,ppc_swapcontext)
256COMPAT_SYS_SPU(tgkill)
257COMPAT_SYS_SPU(utimes)
258COMPAT_SYS_SPU(statfs64)
259COMPAT_SYS_SPU(fstatfs64)
260SYSX(sys_ni_syscall, ppc_fadvise64_64, ppc_fadvise64_64)
261PPC_SYS_SPU(rtas)
262OLDSYS(debug_setcontext)
263SYSCALL(ni_syscall)
264COMPAT_SYS(migrate_pages)
265COMPAT_SYS(mbind)
266COMPAT_SYS(get_mempolicy)
267COMPAT_SYS(set_mempolicy)
268COMPAT_SYS(mq_open)
269SYSCALL(mq_unlink)
270COMPAT_SYS(mq_timedsend)
271COMPAT_SYS(mq_timedreceive)
272COMPAT_SYS(mq_notify)
273COMPAT_SYS(mq_getsetattr)
274COMPAT_SYS(kexec_load)
275COMPAT_SYS(add_key)
276COMPAT_SYS(request_key)
277COMPAT_SYS(keyctl)
278COMPAT_SYS(waitid)
279COMPAT_SYS(ioprio_set)
280COMPAT_SYS(ioprio_get)
281SYSCALL(inotify_init)
282SYSCALL(inotify_add_watch)
283SYSCALL(inotify_rm_watch)
284SYSCALL(spu_run)
285SYSCALL(spu_create)
286COMPAT_SYS(pselect6)
287COMPAT_SYS(ppoll)
288SYSCALL_SPU(unshare)
289SYSCALL_SPU(splice)
290SYSCALL_SPU(tee)
291COMPAT_SYS_SPU(vmsplice)
292COMPAT_SYS_SPU(openat)
293SYSCALL_SPU(mkdirat)
294SYSCALL_SPU(mknodat)
295SYSCALL_SPU(fchownat)
296COMPAT_SYS_SPU(futimesat)
297SYSX_SPU(sys_newfstatat, sys_fstatat64, sys_fstatat64)
298SYSCALL_SPU(unlinkat)
299SYSCALL_SPU(renameat)
300SYSCALL_SPU(linkat)
301SYSCALL_SPU(symlinkat)
302SYSCALL_SPU(readlinkat)
303SYSCALL_SPU(fchmodat)
304SYSCALL_SPU(faccessat)
305COMPAT_SYS_SPU(get_robust_list)
306COMPAT_SYS_SPU(set_robust_list)
307COMPAT_SYS_SPU(move_pages)
308SYSCALL_SPU(getcpu)
309COMPAT_SYS(epoll_pwait)
310COMPAT_SYS_SPU(utimensat)
311COMPAT_SYS_SPU(signalfd)
312SYSCALL_SPU(timerfd_create)
313SYSCALL_SPU(eventfd)
314COMPAT_SYS_SPU(sync_file_range2)
315COMPAT_SYS(fallocate)
316SYSCALL(subpage_prot)
317COMPAT_SYS_SPU(timerfd_settime)
318COMPAT_SYS_SPU(timerfd_gettime)
319COMPAT_SYS_SPU(signalfd4)
320SYSCALL_SPU(eventfd2)
321SYSCALL_SPU(epoll_create1)
322SYSCALL_SPU(dup3)
323SYSCALL_SPU(pipe2)
324SYSCALL(inotify_init1)
diff --git a/arch/powerpc/include/asm/system.h b/arch/powerpc/include/asm/system.h
new file mode 100644
index 000000000000..d6648c143322
--- /dev/null
+++ b/arch/powerpc/include/asm/system.h
@@ -0,0 +1,548 @@
1/*
2 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
3 */
4#ifndef _ASM_POWERPC_SYSTEM_H
5#define _ASM_POWERPC_SYSTEM_H
6
7#include <linux/kernel.h>
8#include <linux/irqflags.h>
9
10#include <asm/hw_irq.h>
11
12/*
13 * Memory barrier.
14 * The sync instruction guarantees that all memory accesses initiated
15 * by this processor have been performed (with respect to all other
16 * mechanisms that access memory). The eieio instruction is a barrier
17 * providing an ordering (separately) for (a) cacheable stores and (b)
18 * loads and stores to non-cacheable memory (e.g. I/O devices).
19 *
20 * mb() prevents loads and stores being reordered across this point.
21 * rmb() prevents loads being reordered across this point.
22 * wmb() prevents stores being reordered across this point.
23 * read_barrier_depends() prevents data-dependent loads being reordered
24 * across this point (nop on PPC).
25 *
26 * We have to use the sync instructions for mb(), since lwsync doesn't
27 * order loads with respect to previous stores. Lwsync is fine for
28 * rmb(), though. Note that rmb() actually uses a sync on 32-bit
29 * architectures.
30 *
31 * For wmb(), we use sync since wmb is used in drivers to order
32 * stores to system memory with respect to writes to the device.
33 * However, smp_wmb() can be a lighter-weight lwsync or eieio barrier
34 * on SMP since it is only used to order updates to system memory.
35 */
36#define mb() __asm__ __volatile__ ("sync" : : : "memory")
37#define rmb() __asm__ __volatile__ ("sync" : : : "memory")
38#define wmb() __asm__ __volatile__ ("sync" : : : "memory")
39#define read_barrier_depends() do { } while(0)
40
41#define set_mb(var, value) do { var = value; mb(); } while (0)
42
43#ifdef __KERNEL__
44#define AT_VECTOR_SIZE_ARCH 6 /* entries in ARCH_DLINFO */
45#ifdef CONFIG_SMP
46
47#ifdef __SUBARCH_HAS_LWSYNC
48# define SMPWMB lwsync
49#else
50# define SMPWMB eieio
51#endif
52
53#define smp_mb() mb()
54#define smp_rmb() rmb()
55#define smp_wmb() __asm__ __volatile__ (__stringify(SMPWMB) : : :"memory")
56#define smp_read_barrier_depends() read_barrier_depends()
57#else
58#define smp_mb() barrier()
59#define smp_rmb() barrier()
60#define smp_wmb() barrier()
61#define smp_read_barrier_depends() do { } while(0)
62#endif /* CONFIG_SMP */
63
64/*
65 * This is a barrier which prevents following instructions from being
66 * started until the value of the argument x is known. For example, if
67 * x is a variable loaded from memory, this prevents following
68 * instructions from being executed until the load has been performed.
69 */
70#define data_barrier(x) \
71 asm volatile("twi 0,%0,0; isync" : : "r" (x) : "memory");
72
73struct task_struct;
74struct pt_regs;
75
76#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
77
78extern int (*__debugger)(struct pt_regs *regs);
79extern int (*__debugger_ipi)(struct pt_regs *regs);
80extern int (*__debugger_bpt)(struct pt_regs *regs);
81extern int (*__debugger_sstep)(struct pt_regs *regs);
82extern int (*__debugger_iabr_match)(struct pt_regs *regs);
83extern int (*__debugger_dabr_match)(struct pt_regs *regs);
84extern int (*__debugger_fault_handler)(struct pt_regs *regs);
85
86#define DEBUGGER_BOILERPLATE(__NAME) \
87static inline int __NAME(struct pt_regs *regs) \
88{ \
89 if (unlikely(__ ## __NAME)) \
90 return __ ## __NAME(regs); \
91 return 0; \
92}
93
94DEBUGGER_BOILERPLATE(debugger)
95DEBUGGER_BOILERPLATE(debugger_ipi)
96DEBUGGER_BOILERPLATE(debugger_bpt)
97DEBUGGER_BOILERPLATE(debugger_sstep)
98DEBUGGER_BOILERPLATE(debugger_iabr_match)
99DEBUGGER_BOILERPLATE(debugger_dabr_match)
100DEBUGGER_BOILERPLATE(debugger_fault_handler)
101
102#else
103static inline int debugger(struct pt_regs *regs) { return 0; }
104static inline int debugger_ipi(struct pt_regs *regs) { return 0; }
105static inline int debugger_bpt(struct pt_regs *regs) { return 0; }
106static inline int debugger_sstep(struct pt_regs *regs) { return 0; }
107static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; }
108static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; }
109static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
110#endif
111
112extern int set_dabr(unsigned long dabr);
113extern void do_dabr(struct pt_regs *regs, unsigned long address,
114 unsigned long error_code);
115extern void print_backtrace(unsigned long *);
116extern void show_regs(struct pt_regs * regs);
117extern void flush_instruction_cache(void);
118extern void hard_reset_now(void);
119extern void poweroff_now(void);
120
121#ifdef CONFIG_6xx
122extern long _get_L2CR(void);
123extern long _get_L3CR(void);
124extern void _set_L2CR(unsigned long);
125extern void _set_L3CR(unsigned long);
126#else
127#define _get_L2CR() 0L
128#define _get_L3CR() 0L
129#define _set_L2CR(val) do { } while(0)
130#define _set_L3CR(val) do { } while(0)
131#endif
132
133extern void via_cuda_init(void);
134extern void read_rtc_time(void);
135extern void pmac_find_display(void);
136extern void giveup_fpu(struct task_struct *);
137extern void disable_kernel_fp(void);
138extern void enable_kernel_fp(void);
139extern void flush_fp_to_thread(struct task_struct *);
140extern void enable_kernel_altivec(void);
141extern void giveup_altivec(struct task_struct *);
142extern void load_up_altivec(struct task_struct *);
143extern int emulate_altivec(struct pt_regs *);
144extern void __giveup_vsx(struct task_struct *);
145extern void giveup_vsx(struct task_struct *);
146extern void enable_kernel_spe(void);
147extern void giveup_spe(struct task_struct *);
148extern void load_up_spe(struct task_struct *);
149extern int fix_alignment(struct pt_regs *);
150extern void cvt_fd(float *from, double *to, struct thread_struct *thread);
151extern void cvt_df(double *from, float *to, struct thread_struct *thread);
152
153#ifndef CONFIG_SMP
154extern void discard_lazy_cpu_state(void);
155#else
156static inline void discard_lazy_cpu_state(void)
157{
158}
159#endif
160
161#ifdef CONFIG_ALTIVEC
162extern void flush_altivec_to_thread(struct task_struct *);
163#else
164static inline void flush_altivec_to_thread(struct task_struct *t)
165{
166}
167#endif
168
169#ifdef CONFIG_VSX
170extern void flush_vsx_to_thread(struct task_struct *);
171#else
172static inline void flush_vsx_to_thread(struct task_struct *t)
173{
174}
175#endif
176
177#ifdef CONFIG_SPE
178extern void flush_spe_to_thread(struct task_struct *);
179#else
180static inline void flush_spe_to_thread(struct task_struct *t)
181{
182}
183#endif
184
185extern int call_rtas(const char *, int, int, unsigned long *, ...);
186extern void cacheable_memzero(void *p, unsigned int nb);
187extern void *cacheable_memcpy(void *, const void *, unsigned int);
188extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long);
189extern void bad_page_fault(struct pt_regs *, unsigned long, int);
190extern int die(const char *, struct pt_regs *, long);
191extern void _exception(int, struct pt_regs *, int, unsigned long);
192extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
193
194#ifdef CONFIG_BOOKE_WDT
195extern u32 booke_wdt_enabled;
196extern u32 booke_wdt_period;
197#endif /* CONFIG_BOOKE_WDT */
198
199struct device_node;
200extern void note_scsi_host(struct device_node *, void *);
201
202extern struct task_struct *__switch_to(struct task_struct *,
203 struct task_struct *);
204#define switch_to(prev, next, last) ((last) = __switch_to((prev), (next)))
205
206struct thread_struct;
207extern struct task_struct *_switch(struct thread_struct *prev,
208 struct thread_struct *next);
209
210extern unsigned int rtas_data;
211extern int mem_init_done; /* set on boot once kmalloc can be called */
212extern int init_bootmem_done; /* set on !NUMA once bootmem is available */
213extern unsigned long memory_limit;
214extern unsigned long klimit;
215
216extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
217extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
218
219extern int powersave_nap; /* set if nap mode can be used in idle loop */
220
221/*
222 * Atomic exchange
223 *
224 * Changes the memory location '*ptr' to be val and returns
225 * the previous value stored there.
226 */
227static __always_inline unsigned long
228__xchg_u32(volatile void *p, unsigned long val)
229{
230 unsigned long prev;
231
232 __asm__ __volatile__(
233 LWSYNC_ON_SMP
234"1: lwarx %0,0,%2 \n"
235 PPC405_ERR77(0,%2)
236" stwcx. %3,0,%2 \n\
237 bne- 1b"
238 ISYNC_ON_SMP
239 : "=&r" (prev), "+m" (*(volatile unsigned int *)p)
240 : "r" (p), "r" (val)
241 : "cc", "memory");
242
243 return prev;
244}
245
246/*
247 * Atomic exchange
248 *
249 * Changes the memory location '*ptr' to be val and returns
250 * the previous value stored there.
251 */
252static __always_inline unsigned long
253__xchg_u32_local(volatile void *p, unsigned long val)
254{
255 unsigned long prev;
256
257 __asm__ __volatile__(
258"1: lwarx %0,0,%2 \n"
259 PPC405_ERR77(0,%2)
260" stwcx. %3,0,%2 \n\
261 bne- 1b"
262 : "=&r" (prev), "+m" (*(volatile unsigned int *)p)
263 : "r" (p), "r" (val)
264 : "cc", "memory");
265
266 return prev;
267}
268
269#ifdef CONFIG_PPC64
270static __always_inline unsigned long
271__xchg_u64(volatile void *p, unsigned long val)
272{
273 unsigned long prev;
274
275 __asm__ __volatile__(
276 LWSYNC_ON_SMP
277"1: ldarx %0,0,%2 \n"
278 PPC405_ERR77(0,%2)
279" stdcx. %3,0,%2 \n\
280 bne- 1b"
281 ISYNC_ON_SMP
282 : "=&r" (prev), "+m" (*(volatile unsigned long *)p)
283 : "r" (p), "r" (val)
284 : "cc", "memory");
285
286 return prev;
287}
288
289static __always_inline unsigned long
290__xchg_u64_local(volatile void *p, unsigned long val)
291{
292 unsigned long prev;
293
294 __asm__ __volatile__(
295"1: ldarx %0,0,%2 \n"
296 PPC405_ERR77(0,%2)
297" stdcx. %3,0,%2 \n\
298 bne- 1b"
299 : "=&r" (prev), "+m" (*(volatile unsigned long *)p)
300 : "r" (p), "r" (val)
301 : "cc", "memory");
302
303 return prev;
304}
305#endif
306
307/*
308 * This function doesn't exist, so you'll get a linker error
309 * if something tries to do an invalid xchg().
310 */
311extern void __xchg_called_with_bad_pointer(void);
312
313static __always_inline unsigned long
314__xchg(volatile void *ptr, unsigned long x, unsigned int size)
315{
316 switch (size) {
317 case 4:
318 return __xchg_u32(ptr, x);
319#ifdef CONFIG_PPC64
320 case 8:
321 return __xchg_u64(ptr, x);
322#endif
323 }
324 __xchg_called_with_bad_pointer();
325 return x;
326}
327
328static __always_inline unsigned long
329__xchg_local(volatile void *ptr, unsigned long x, unsigned int size)
330{
331 switch (size) {
332 case 4:
333 return __xchg_u32_local(ptr, x);
334#ifdef CONFIG_PPC64
335 case 8:
336 return __xchg_u64_local(ptr, x);
337#endif
338 }
339 __xchg_called_with_bad_pointer();
340 return x;
341}
342#define xchg(ptr,x) \
343 ({ \
344 __typeof__(*(ptr)) _x_ = (x); \
345 (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
346 })
347
348#define xchg_local(ptr,x) \
349 ({ \
350 __typeof__(*(ptr)) _x_ = (x); \
351 (__typeof__(*(ptr))) __xchg_local((ptr), \
352 (unsigned long)_x_, sizeof(*(ptr))); \
353 })
354
355/*
356 * Compare and exchange - if *p == old, set it to new,
357 * and return the old value of *p.
358 */
359#define __HAVE_ARCH_CMPXCHG 1
360
361static __always_inline unsigned long
362__cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
363{
364 unsigned int prev;
365
366 __asm__ __volatile__ (
367 LWSYNC_ON_SMP
368"1: lwarx %0,0,%2 # __cmpxchg_u32\n\
369 cmpw 0,%0,%3\n\
370 bne- 2f\n"
371 PPC405_ERR77(0,%2)
372" stwcx. %4,0,%2\n\
373 bne- 1b"
374 ISYNC_ON_SMP
375 "\n\
3762:"
377 : "=&r" (prev), "+m" (*p)
378 : "r" (p), "r" (old), "r" (new)
379 : "cc", "memory");
380
381 return prev;
382}
383
384static __always_inline unsigned long
385__cmpxchg_u32_local(volatile unsigned int *p, unsigned long old,
386 unsigned long new)
387{
388 unsigned int prev;
389
390 __asm__ __volatile__ (
391"1: lwarx %0,0,%2 # __cmpxchg_u32\n\
392 cmpw 0,%0,%3\n\
393 bne- 2f\n"
394 PPC405_ERR77(0,%2)
395" stwcx. %4,0,%2\n\
396 bne- 1b"
397 "\n\
3982:"
399 : "=&r" (prev), "+m" (*p)
400 : "r" (p), "r" (old), "r" (new)
401 : "cc", "memory");
402
403 return prev;
404}
405
406#ifdef CONFIG_PPC64
407static __always_inline unsigned long
408__cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new)
409{
410 unsigned long prev;
411
412 __asm__ __volatile__ (
413 LWSYNC_ON_SMP
414"1: ldarx %0,0,%2 # __cmpxchg_u64\n\
415 cmpd 0,%0,%3\n\
416 bne- 2f\n\
417 stdcx. %4,0,%2\n\
418 bne- 1b"
419 ISYNC_ON_SMP
420 "\n\
4212:"
422 : "=&r" (prev), "+m" (*p)
423 : "r" (p), "r" (old), "r" (new)
424 : "cc", "memory");
425
426 return prev;
427}
428
429static __always_inline unsigned long
430__cmpxchg_u64_local(volatile unsigned long *p, unsigned long old,
431 unsigned long new)
432{
433 unsigned long prev;
434
435 __asm__ __volatile__ (
436"1: ldarx %0,0,%2 # __cmpxchg_u64\n\
437 cmpd 0,%0,%3\n\
438 bne- 2f\n\
439 stdcx. %4,0,%2\n\
440 bne- 1b"
441 "\n\
4422:"
443 : "=&r" (prev), "+m" (*p)
444 : "r" (p), "r" (old), "r" (new)
445 : "cc", "memory");
446
447 return prev;
448}
449#endif
450
451/* This function doesn't exist, so you'll get a linker error
452 if something tries to do an invalid cmpxchg(). */
453extern void __cmpxchg_called_with_bad_pointer(void);
454
455static __always_inline unsigned long
456__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new,
457 unsigned int size)
458{
459 switch (size) {
460 case 4:
461 return __cmpxchg_u32(ptr, old, new);
462#ifdef CONFIG_PPC64
463 case 8:
464 return __cmpxchg_u64(ptr, old, new);
465#endif
466 }
467 __cmpxchg_called_with_bad_pointer();
468 return old;
469}
470
471static __always_inline unsigned long
472__cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
473 unsigned int size)
474{
475 switch (size) {
476 case 4:
477 return __cmpxchg_u32_local(ptr, old, new);
478#ifdef CONFIG_PPC64
479 case 8:
480 return __cmpxchg_u64_local(ptr, old, new);
481#endif
482 }
483 __cmpxchg_called_with_bad_pointer();
484 return old;
485}
486
487#define cmpxchg(ptr, o, n) \
488 ({ \
489 __typeof__(*(ptr)) _o_ = (o); \
490 __typeof__(*(ptr)) _n_ = (n); \
491 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
492 (unsigned long)_n_, sizeof(*(ptr))); \
493 })
494
495
496#define cmpxchg_local(ptr, o, n) \
497 ({ \
498 __typeof__(*(ptr)) _o_ = (o); \
499 __typeof__(*(ptr)) _n_ = (n); \
500 (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \
501 (unsigned long)_n_, sizeof(*(ptr))); \
502 })
503
504#ifdef CONFIG_PPC64
505/*
506 * We handle most unaligned accesses in hardware. On the other hand
507 * unaligned DMA can be very expensive on some ppc64 IO chips (it does
508 * powers of 2 writes until it reaches sufficient alignment).
509 *
510 * Based on this we disable the IP header alignment in network drivers.
511 * We also modify NET_SKB_PAD to be a cacheline in size, thus maintaining
512 * cacheline alignment of buffers.
513 */
514#define NET_IP_ALIGN 0
515#define NET_SKB_PAD L1_CACHE_BYTES
516
517#define cmpxchg64(ptr, o, n) \
518 ({ \
519 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
520 cmpxchg((ptr), (o), (n)); \
521 })
522#define cmpxchg64_local(ptr, o, n) \
523 ({ \
524 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
525 cmpxchg_local((ptr), (o), (n)); \
526 })
527#else
528#include <asm-generic/cmpxchg-local.h>
529#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
530#endif
531
532#define arch_align_stack(x) (x)
533
534/* Used in very early kernel initialization. */
535extern unsigned long reloc_offset(void);
536extern unsigned long add_reloc_offset(unsigned long);
537extern void reloc_got2(unsigned long);
538
539#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
540
541#ifdef CONFIG_VIRT_CPU_ACCOUNTING
542extern void account_system_vtime(struct task_struct *);
543#endif
544
545extern struct dentry *powerpc_debugfs_root;
546
547#endif /* __KERNEL__ */
548#endif /* _ASM_POWERPC_SYSTEM_H */
diff --git a/arch/powerpc/include/asm/tce.h b/arch/powerpc/include/asm/tce.h
new file mode 100644
index 000000000000..f663634cccc9
--- /dev/null
+++ b/arch/powerpc/include/asm/tce.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
3 * Rewrite, cleanup:
4 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
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
21#ifndef _ASM_POWERPC_TCE_H
22#define _ASM_POWERPC_TCE_H
23#ifdef __KERNEL__
24
25#include <asm/iommu.h>
26
27/*
28 * Tces come in two formats, one for the virtual bus and a different
29 * format for PCI
30 */
31#define TCE_VB 0
32#define TCE_PCI 1
33
34/* TCE page size is 4096 bytes (1 << 12) */
35
36#define TCE_SHIFT 12
37#define TCE_PAGE_SIZE (1 << TCE_SHIFT)
38
39#define TCE_ENTRY_SIZE 8 /* each TCE is 64 bits */
40
41#define TCE_RPN_MASK 0xfffffffffful /* 40-bit RPN (4K pages) */
42#define TCE_RPN_SHIFT 12
43#define TCE_VALID 0x800 /* TCE valid */
44#define TCE_ALLIO 0x400 /* TCE valid for all lpars */
45#define TCE_PCI_WRITE 0x2 /* write from PCI allowed */
46#define TCE_PCI_READ 0x1 /* read from PCI allowed */
47#define TCE_VB_WRITE 0x1 /* write from VB allowed */
48
49#endif /* __KERNEL__ */
50#endif /* _ASM_POWERPC_TCE_H */
diff --git a/arch/powerpc/include/asm/termbits.h b/arch/powerpc/include/asm/termbits.h
new file mode 100644
index 000000000000..6698188ca550
--- /dev/null
+++ b/arch/powerpc/include/asm/termbits.h
@@ -0,0 +1,209 @@
1#ifndef _ASM_POWERPC_TERMBITS_H
2#define _ASM_POWERPC_TERMBITS_H
3
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
11typedef unsigned char cc_t;
12typedef unsigned int speed_t;
13typedef unsigned int tcflag_t;
14
15/*
16 * termios type and macro definitions. Be careful about adding stuff
17 * to this file since it's used in GNU libc and there are strict rules
18 * concerning namespace pollution.
19 */
20
21#define NCCS 19
22struct termios {
23 tcflag_t c_iflag; /* input mode flags */
24 tcflag_t c_oflag; /* output mode flags */
25 tcflag_t c_cflag; /* control mode flags */
26 tcflag_t c_lflag; /* local mode flags */
27 cc_t c_cc[NCCS]; /* control characters */
28 cc_t c_line; /* line discipline (== c_cc[19]) */
29 speed_t c_ispeed; /* input speed */
30 speed_t c_ospeed; /* output speed */
31};
32
33/* For PowerPC the termios and ktermios are the same */
34
35struct ktermios {
36 tcflag_t c_iflag; /* input mode flags */
37 tcflag_t c_oflag; /* output mode flags */
38 tcflag_t c_cflag; /* control mode flags */
39 tcflag_t c_lflag; /* local mode flags */
40 cc_t c_cc[NCCS]; /* control characters */
41 cc_t c_line; /* line discipline (== c_cc[19]) */
42 speed_t c_ispeed; /* input speed */
43 speed_t c_ospeed; /* output speed */
44};
45
46/* c_cc characters */
47#define VINTR 0
48#define VQUIT 1
49#define VERASE 2
50#define VKILL 3
51#define VEOF 4
52#define VMIN 5
53#define VEOL 6
54#define VTIME 7
55#define VEOL2 8
56#define VSWTC 9
57#define VWERASE 10
58#define VREPRINT 11
59#define VSUSP 12
60#define VSTART 13
61#define VSTOP 14
62#define VLNEXT 15
63#define VDISCARD 16
64
65/* c_iflag bits */
66#define IGNBRK 0000001
67#define BRKINT 0000002
68#define IGNPAR 0000004
69#define PARMRK 0000010
70#define INPCK 0000020
71#define ISTRIP 0000040
72#define INLCR 0000100
73#define IGNCR 0000200
74#define ICRNL 0000400
75#define IXON 0001000
76#define IXOFF 0002000
77#define IXANY 0004000
78#define IUCLC 0010000
79#define IMAXBEL 0020000
80#define IUTF8 0040000
81
82/* c_oflag bits */
83#define OPOST 0000001
84#define ONLCR 0000002
85#define OLCUC 0000004
86
87#define OCRNL 0000010
88#define ONOCR 0000020
89#define ONLRET 0000040
90
91#define OFILL 00000100
92#define OFDEL 00000200
93#define NLDLY 00001400
94#define NL0 00000000
95#define NL1 00000400
96#define NL2 00001000
97#define NL3 00001400
98#define TABDLY 00006000
99#define TAB0 00000000
100#define TAB1 00002000
101#define TAB2 00004000
102#define TAB3 00006000
103#define XTABS 00006000 /* required by POSIX to == TAB3 */
104#define CRDLY 00030000
105#define CR0 00000000
106#define CR1 00010000
107#define CR2 00020000
108#define CR3 00030000
109#define FFDLY 00040000
110#define FF0 00000000
111#define FF1 00040000
112#define BSDLY 00100000
113#define BS0 00000000
114#define BS1 00100000
115#define VTDLY 00200000
116#define VT0 00000000
117#define VT1 00200000
118
119/* c_cflag bit meaning */
120#define CBAUD 0000377
121#define B0 0000000 /* hang up */
122#define B50 0000001
123#define B75 0000002
124#define B110 0000003
125#define B134 0000004
126#define B150 0000005
127#define B200 0000006
128#define B300 0000007
129#define B600 0000010
130#define B1200 0000011
131#define B1800 0000012
132#define B2400 0000013
133#define B4800 0000014
134#define B9600 0000015
135#define B19200 0000016
136#define B38400 0000017
137#define EXTA B19200
138#define EXTB B38400
139#define CBAUDEX 0000000
140#define B57600 00020
141#define B115200 00021
142#define B230400 00022
143#define B460800 00023
144#define B500000 00024
145#define B576000 00025
146#define B921600 00026
147#define B1000000 00027
148#define B1152000 00030
149#define B1500000 00031
150#define B2000000 00032
151#define B2500000 00033
152#define B3000000 00034
153#define B3500000 00035
154#define B4000000 00036
155#define BOTHER 00037
156
157#define CIBAUD 077600000
158#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
159
160#define CSIZE 00001400
161#define CS5 00000000
162#define CS6 00000400
163#define CS7 00001000
164#define CS8 00001400
165
166#define CSTOPB 00002000
167#define CREAD 00004000
168#define PARENB 00010000
169#define PARODD 00020000
170#define HUPCL 00040000
171
172#define CLOCAL 00100000
173#define CMSPAR 010000000000 /* mark or space (stick) parity */
174#define CRTSCTS 020000000000 /* flow control */
175
176/* c_lflag bits */
177#define ISIG 0x00000080
178#define ICANON 0x00000100
179#define XCASE 0x00004000
180#define ECHO 0x00000008
181#define ECHOE 0x00000002
182#define ECHOK 0x00000004
183#define ECHONL 0x00000010
184#define NOFLSH 0x80000000
185#define TOSTOP 0x00400000
186#define ECHOCTL 0x00000040
187#define ECHOPRT 0x00000020
188#define ECHOKE 0x00000001
189#define FLUSHO 0x00800000
190#define PENDIN 0x20000000
191#define IEXTEN 0x00000400
192
193/* Values for the ACTION argument to `tcflow'. */
194#define TCOOFF 0
195#define TCOON 1
196#define TCIOFF 2
197#define TCION 3
198
199/* Values for the QUEUE_SELECTOR argument to `tcflush'. */
200#define TCIFLUSH 0
201#define TCOFLUSH 1
202#define TCIOFLUSH 2
203
204/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
205#define TCSANOW 0
206#define TCSADRAIN 1
207#define TCSAFLUSH 2
208
209#endif /* _ASM_POWERPC_TERMBITS_H */
diff --git a/arch/powerpc/include/asm/termios.h b/arch/powerpc/include/asm/termios.h
new file mode 100644
index 000000000000..2c14fea07c8a
--- /dev/null
+++ b/arch/powerpc/include/asm/termios.h
@@ -0,0 +1,85 @@
1#ifndef _ASM_POWERPC_TERMIOS_H
2#define _ASM_POWERPC_TERMIOS_H
3
4/*
5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[]
6 * fields have been reordered so that termio & termios share the
7 * common subset in the same order (for brain dead programs that don't
8 * know or care about the differences).
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <asm/ioctls.h>
17#include <asm/termbits.h>
18
19struct sgttyb {
20 char sg_ispeed;
21 char sg_ospeed;
22 char sg_erase;
23 char sg_kill;
24 short sg_flags;
25};
26
27struct tchars {
28 char t_intrc;
29 char t_quitc;
30 char t_startc;
31 char t_stopc;
32 char t_eofc;
33 char t_brkc;
34};
35
36struct ltchars {
37 char t_suspc;
38 char t_dsuspc;
39 char t_rprntc;
40 char t_flushc;
41 char t_werasc;
42 char t_lnextc;
43};
44
45struct winsize {
46 unsigned short ws_row;
47 unsigned short ws_col;
48 unsigned short ws_xpixel;
49 unsigned short ws_ypixel;
50};
51
52#define NCC 10
53struct termio {
54 unsigned short c_iflag; /* input mode flags */
55 unsigned short c_oflag; /* output mode flags */
56 unsigned short c_cflag; /* control mode flags */
57 unsigned short c_lflag; /* local mode flags */
58 unsigned char c_line; /* line discipline */
59 unsigned char c_cc[NCC]; /* control characters */
60};
61
62/* c_cc characters */
63#define _VINTR 0
64#define _VQUIT 1
65#define _VERASE 2
66#define _VKILL 3
67#define _VEOF 4
68#define _VMIN 5
69#define _VEOL 6
70#define _VTIME 7
71#define _VEOL2 8
72#define _VSWTC 9
73
74#ifdef __KERNEL__
75/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */
76#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025"
77#endif
78
79#ifdef __KERNEL__
80
81#include <asm-generic/termios.h>
82
83#endif /* __KERNEL__ */
84
85#endif /* _ASM_POWERPC_TERMIOS_H */
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
new file mode 100644
index 000000000000..9665a26a253a
--- /dev/null
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -0,0 +1,161 @@
1/* thread_info.h: PowerPC low-level thread information
2 * adapted from the i386 version by Paul Mackerras
3 *
4 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
6 */
7
8#ifndef _ASM_POWERPC_THREAD_INFO_H
9#define _ASM_POWERPC_THREAD_INFO_H
10
11#ifdef __KERNEL__
12
13/* We have 8k stacks on ppc32 and 16k on ppc64 */
14
15#ifdef CONFIG_PPC64
16#define THREAD_SHIFT 14
17#else
18#define THREAD_SHIFT 13
19#endif
20
21#define THREAD_SIZE (1 << THREAD_SHIFT)
22
23#ifndef __ASSEMBLY__
24#include <linux/cache.h>
25#include <asm/processor.h>
26#include <asm/page.h>
27#include <linux/stringify.h>
28
29/*
30 * low level task data.
31 */
32struct thread_info {
33 struct task_struct *task; /* main task structure */
34 struct exec_domain *exec_domain; /* execution domain */
35 int cpu; /* cpu we're on */
36 int preempt_count; /* 0 => preemptable,
37 <0 => BUG */
38 struct restart_block restart_block;
39 unsigned long local_flags; /* private flags for thread */
40
41 /* low level flags - has atomic operations done on it */
42 unsigned long flags ____cacheline_aligned_in_smp;
43};
44
45/*
46 * macros/functions for gaining access to the thread information structure
47 *
48 * preempt_count needs to be 1 initially, until the scheduler is functional.
49 */
50#define INIT_THREAD_INFO(tsk) \
51{ \
52 .task = &tsk, \
53 .exec_domain = &default_exec_domain, \
54 .cpu = 0, \
55 .preempt_count = 1, \
56 .restart_block = { \
57 .fn = do_no_restart_syscall, \
58 }, \
59 .flags = 0, \
60}
61
62#define init_thread_info (init_thread_union.thread_info)
63#define init_stack (init_thread_union.stack)
64
65/* thread information allocation */
66
67#if THREAD_SHIFT >= PAGE_SHIFT
68
69#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
70
71#else /* THREAD_SHIFT < PAGE_SHIFT */
72
73#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
74
75extern struct thread_info *alloc_thread_info(struct task_struct *tsk);
76extern void free_thread_info(struct thread_info *ti);
77
78#endif /* THREAD_SHIFT < PAGE_SHIFT */
79
80/* how to get the thread information struct from C */
81static inline struct thread_info *current_thread_info(void)
82{
83 register unsigned long sp asm("r1");
84
85 /* gcc4, at least, is smart enough to turn this into a single
86 * rlwinm for ppc32 and clrrdi for ppc64 */
87 return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
88}
89
90#endif /* __ASSEMBLY__ */
91
92#define PREEMPT_ACTIVE 0x10000000
93
94/*
95 * thread information flag bit numbers
96 */
97#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
98#define TIF_SIGPENDING 1 /* signal pending */
99#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
100#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
101 TIF_NEED_RESCHED */
102#define TIF_32BIT 4 /* 32 bit binary */
103#define TIF_PERFMON_WORK 5 /* work for pfm_handle_work() */
104#define TIF_PERFMON_CTXSW 6 /* perfmon needs ctxsw calls */
105#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
106#define TIF_SINGLESTEP 8 /* singlestepping active */
107#define TIF_MEMDIE 9
108#define TIF_SECCOMP 10 /* secure computing */
109#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */
110#define TIF_NOERROR 12 /* Force successful syscall return */
111#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */
112#define TIF_FREEZE 14 /* Freezing for suspend */
113#define TIF_RUNLATCH 15 /* Is the runlatch enabled? */
114#define TIF_ABI_PENDING 16 /* 32/64 bit switch needed */
115
116/* as above, but as bit values */
117#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
118#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
119#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
120#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
121#define _TIF_32BIT (1<<TIF_32BIT)
122#define _TIF_PERFMON_WORK (1<<TIF_PERFMON_WORK)
123#define _TIF_PERFMON_CTXSW (1<<TIF_PERFMON_CTXSW)
124#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
125#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
126#define _TIF_SECCOMP (1<<TIF_SECCOMP)
127#define _TIF_RESTOREALL (1<<TIF_RESTOREALL)
128#define _TIF_NOERROR (1<<TIF_NOERROR)
129#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
130#define _TIF_FREEZE (1<<TIF_FREEZE)
131#define _TIF_RUNLATCH (1<<TIF_RUNLATCH)
132#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
133#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
134
135#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
136 _TIF_NOTIFY_RESUME)
137#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR)
138
139/* Bits in local_flags */
140/* Don't move TLF_NAPPING without adjusting the code in entry_32.S */
141#define TLF_NAPPING 0 /* idle thread enabled NAP mode */
142#define TLF_SLEEPING 1 /* suspend code enabled SLEEP mode */
143#define TLF_RESTORE_SIGMASK 2 /* Restore signal mask in do_signal */
144
145#define _TLF_NAPPING (1 << TLF_NAPPING)
146#define _TLF_SLEEPING (1 << TLF_SLEEPING)
147#define _TLF_RESTORE_SIGMASK (1 << TLF_RESTORE_SIGMASK)
148
149#ifndef __ASSEMBLY__
150#define HAVE_SET_RESTORE_SIGMASK 1
151static inline void set_restore_sigmask(void)
152{
153 struct thread_info *ti = current_thread_info();
154 ti->local_flags |= _TLF_RESTORE_SIGMASK;
155 set_bit(TIF_SIGPENDING, &ti->flags);
156}
157#endif /* !__ASSEMBLY__ */
158
159#endif /* __KERNEL__ */
160
161#endif /* _ASM_POWERPC_THREAD_INFO_H */
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
new file mode 100644
index 000000000000..febd581ec9b0
--- /dev/null
+++ b/arch/powerpc/include/asm/time.h
@@ -0,0 +1,255 @@
1/*
2 * Common time prototypes and such for all ppc machines.
3 *
4 * Written by Cort Dougan (cort@cs.nmt.edu) to merge
5 * Paul Mackerras' version and mine for PReP and Pmac.
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#ifndef __POWERPC_TIME_H
14#define __POWERPC_TIME_H
15
16#ifdef __KERNEL__
17#include <linux/types.h>
18#include <linux/percpu.h>
19
20#include <asm/processor.h>
21#ifdef CONFIG_PPC_ISERIES
22#include <asm/paca.h>
23#include <asm/firmware.h>
24#include <asm/iseries/hv_call.h>
25#endif
26
27/* time.c */
28extern unsigned long tb_ticks_per_jiffy;
29extern unsigned long tb_ticks_per_usec;
30extern unsigned long tb_ticks_per_sec;
31extern u64 tb_to_xs;
32extern unsigned tb_to_us;
33
34struct rtc_time;
35extern void to_tm(int tim, struct rtc_time * tm);
36extern void GregorianDay(struct rtc_time *tm);
37extern time_t last_rtc_update;
38
39extern void generic_calibrate_decr(void);
40extern void wakeup_decrementer(void);
41extern void snapshot_timebase(void);
42
43extern void set_dec_cpu6(unsigned int val);
44
45/* Some sane defaults: 125 MHz timebase, 1GHz processor */
46extern unsigned long ppc_proc_freq;
47#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
48extern unsigned long ppc_tb_freq;
49#define DEFAULT_TB_FREQ 125000000UL
50
51/*
52 * By putting all of this stuff into a single struct we
53 * reduce the number of cache lines touched by do_gettimeofday.
54 * Both by collecting all of the data in one cache line and
55 * by touching only one TOC entry on ppc64.
56 */
57struct gettimeofday_vars {
58 u64 tb_to_xs;
59 u64 stamp_xsec;
60 u64 tb_orig_stamp;
61};
62
63struct gettimeofday_struct {
64 unsigned long tb_ticks_per_sec;
65 struct gettimeofday_vars vars[2];
66 struct gettimeofday_vars * volatile varp;
67 unsigned var_idx;
68 unsigned tb_to_us;
69};
70
71struct div_result {
72 u64 result_high;
73 u64 result_low;
74};
75
76/* Accessor functions for the timebase (RTC on 601) registers. */
77/* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
78#ifdef CONFIG_6xx
79#define __USE_RTC() (!cpu_has_feature(CPU_FTR_USE_TB))
80#else
81#define __USE_RTC() 0
82#endif
83
84#ifdef CONFIG_PPC64
85
86/* For compatibility, get_tbl() is defined as get_tb() on ppc64 */
87#define get_tbl get_tb
88
89#else
90
91static inline unsigned long get_tbl(void)
92{
93#if defined(CONFIG_403GCX)
94 unsigned long tbl;
95 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
96 return tbl;
97#else
98 return mftbl();
99#endif
100}
101
102static inline unsigned int get_tbu(void)
103{
104#ifdef CONFIG_403GCX
105 unsigned int tbu;
106 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu));
107 return tbu;
108#else
109 return mftbu();
110#endif
111}
112#endif /* !CONFIG_PPC64 */
113
114static inline unsigned int get_rtcl(void)
115{
116 unsigned int rtcl;
117
118 asm volatile("mfrtcl %0" : "=r" (rtcl));
119 return rtcl;
120}
121
122static inline u64 get_rtc(void)
123{
124 unsigned int hi, lo, hi2;
125
126 do {
127 asm volatile("mfrtcu %0; mfrtcl %1; mfrtcu %2"
128 : "=r" (hi), "=r" (lo), "=r" (hi2));
129 } while (hi2 != hi);
130 return (u64)hi * 1000000000 + lo;
131}
132
133#ifdef CONFIG_PPC64
134static inline u64 get_tb(void)
135{
136 return mftb();
137}
138#else /* CONFIG_PPC64 */
139static inline u64 get_tb(void)
140{
141 unsigned int tbhi, tblo, tbhi2;
142
143 do {
144 tbhi = get_tbu();
145 tblo = get_tbl();
146 tbhi2 = get_tbu();
147 } while (tbhi != tbhi2);
148
149 return ((u64)tbhi << 32) | tblo;
150}
151#endif /* !CONFIG_PPC64 */
152
153static inline u64 get_tb_or_rtc(void)
154{
155 return __USE_RTC() ? get_rtc() : get_tb();
156}
157
158static inline void set_tb(unsigned int upper, unsigned int lower)
159{
160 mtspr(SPRN_TBWL, 0);
161 mtspr(SPRN_TBWU, upper);
162 mtspr(SPRN_TBWL, lower);
163}
164
165/* Accessor functions for the decrementer register.
166 * The 4xx doesn't even have a decrementer. I tried to use the
167 * generic timer interrupt code, which seems OK, with the 4xx PIT
168 * in auto-reload mode. The problem is PIT stops counting when it
169 * hits zero. If it would wrap, we could use it just like a decrementer.
170 */
171static inline unsigned int get_dec(void)
172{
173#if defined(CONFIG_40x)
174 return (mfspr(SPRN_PIT));
175#else
176 return (mfspr(SPRN_DEC));
177#endif
178}
179
180/*
181 * Note: Book E and 4xx processors differ from other PowerPC processors
182 * in when the decrementer generates its interrupt: on the 1 to 0
183 * transition for Book E/4xx, but on the 0 to -1 transition for others.
184 */
185static inline void set_dec(int val)
186{
187#if defined(CONFIG_40x)
188 mtspr(SPRN_PIT, val);
189#elif defined(CONFIG_8xx_CPU6)
190 set_dec_cpu6(val - 1);
191#else
192#ifndef CONFIG_BOOKE
193 --val;
194#endif
195#ifdef CONFIG_PPC_ISERIES
196 if (firmware_has_feature(FW_FEATURE_ISERIES) &&
197 get_lppaca()->shared_proc) {
198 get_lppaca()->virtual_decr = val;
199 if (get_dec() > val)
200 HvCall_setVirtualDecr();
201 return;
202 }
203#endif
204 mtspr(SPRN_DEC, val);
205#endif /* not 40x or 8xx_CPU6 */
206}
207
208static inline unsigned long tb_ticks_since(unsigned long tstamp)
209{
210 if (__USE_RTC()) {
211 int delta = get_rtcl() - (unsigned int) tstamp;
212 return delta < 0 ? delta + 1000000000 : delta;
213 }
214 return get_tbl() - tstamp;
215}
216
217#define mulhwu(x,y) \
218({unsigned z; asm ("mulhwu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;})
219
220#ifdef CONFIG_PPC64
221#define mulhdu(x,y) \
222({unsigned long z; asm ("mulhdu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;})
223#else
224extern u64 mulhdu(u64, u64);
225#endif
226
227extern void smp_space_timers(unsigned int);
228
229extern unsigned mulhwu_scale_factor(unsigned, unsigned);
230extern void div128_by_32(u64 dividend_high, u64 dividend_low,
231 unsigned divisor, struct div_result *dr);
232
233/* Used to store Processor Utilization register (purr) values */
234
235struct cpu_usage {
236 u64 current_tb; /* Holds the current purr register values */
237};
238
239DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
240
241#if defined(CONFIG_VIRT_CPU_ACCOUNTING)
242extern void calculate_steal_time(void);
243extern void snapshot_timebases(void);
244#define account_process_vtime(tsk) account_process_tick(tsk, 0)
245#else
246#define calculate_steal_time() do { } while (0)
247#define snapshot_timebases() do { } while (0)
248#define account_process_vtime(tsk) do { } while (0)
249#endif
250
251extern void secondary_cpu_time_init(void);
252extern void iSeries_time_init_early(void);
253
254#endif /* __KERNEL__ */
255#endif /* __POWERPC_TIME_H */
diff --git a/arch/powerpc/include/asm/timex.h b/arch/powerpc/include/asm/timex.h
new file mode 100644
index 000000000000..c55e14f7ef44
--- /dev/null
+++ b/arch/powerpc/include/asm/timex.h
@@ -0,0 +1,50 @@
1#ifndef _ASM_POWERPC_TIMEX_H
2#define _ASM_POWERPC_TIMEX_H
3
4#ifdef __KERNEL__
5
6/*
7 * PowerPC architecture timex specifications
8 */
9
10#include <asm/cputable.h>
11#include <asm/reg.h>
12
13#define CLOCK_TICK_RATE 1024000 /* Underlying HZ */
14
15typedef unsigned long cycles_t;
16
17static inline cycles_t get_cycles(void)
18{
19#ifdef __powerpc64__
20 return mftb();
21#else
22 cycles_t ret;
23
24 /*
25 * For the "cycle" counter we use the timebase lower half.
26 * Currently only used on SMP.
27 */
28
29 ret = 0;
30
31 __asm__ __volatile__(
32 "97: mftb %0\n"
33 "99:\n"
34 ".section __ftr_fixup,\"a\"\n"
35 ".align 2\n"
36 "98:\n"
37 " .long %1\n"
38 " .long 0\n"
39 " .long 97b-98b\n"
40 " .long 99b-98b\n"
41 " .long 0\n"
42 " .long 0\n"
43 ".previous"
44 : "=r" (ret) : "i" (CPU_FTR_601));
45 return ret;
46#endif
47}
48
49#endif /* __KERNEL__ */
50#endif /* _ASM_POWERPC_TIMEX_H */
diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h
new file mode 100644
index 000000000000..e20ff7541f36
--- /dev/null
+++ b/arch/powerpc/include/asm/tlb.h
@@ -0,0 +1,81 @@
1/*
2 * TLB shootdown specifics for powerpc
3 *
4 * Copyright (C) 2002 Anton Blanchard, IBM Corp.
5 * Copyright (C) 2002 Paul Mackerras, IBM Corp.
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#ifndef _ASM_POWERPC_TLB_H
13#define _ASM_POWERPC_TLB_H
14#ifdef __KERNEL__
15
16#ifndef __powerpc64__
17#include <asm/pgtable.h>
18#endif
19#include <asm/pgalloc.h>
20#include <asm/tlbflush.h>
21#ifndef __powerpc64__
22#include <asm/page.h>
23#include <asm/mmu.h>
24#endif
25
26#include <linux/pagemap.h>
27
28struct mmu_gather;
29
30#define tlb_start_vma(tlb, vma) do { } while (0)
31#define tlb_end_vma(tlb, vma) do { } while (0)
32
33#if !defined(CONFIG_PPC_STD_MMU)
34
35#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
36
37#elif defined(__powerpc64__)
38
39extern void pte_free_finish(void);
40
41static inline void tlb_flush(struct mmu_gather *tlb)
42{
43 struct ppc64_tlb_batch *tlbbatch = &__get_cpu_var(ppc64_tlb_batch);
44
45 /* If there's a TLB batch pending, then we must flush it because the
46 * pages are going to be freed and we really don't want to have a CPU
47 * access a freed page because it has a stale TLB
48 */
49 if (tlbbatch->index)
50 __flush_tlb_pending(tlbbatch);
51
52 pte_free_finish();
53}
54
55#else
56
57extern void tlb_flush(struct mmu_gather *tlb);
58
59#endif
60
61/* Get the generic bits... */
62#include <asm-generic/tlb.h>
63
64#if !defined(CONFIG_PPC_STD_MMU) || defined(__powerpc64__)
65
66#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0)
67
68#else
69extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep,
70 unsigned long address);
71
72static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
73 unsigned long address)
74{
75 if (pte_val(*ptep) & _PAGE_HASHPTE)
76 flush_hash_entry(tlb->mm, ptep, address);
77}
78
79#endif
80#endif /* __KERNEL__ */
81#endif /* __ASM_POWERPC_TLB_H */
diff --git a/arch/powerpc/include/asm/tlbflush.h b/arch/powerpc/include/asm/tlbflush.h
new file mode 100644
index 000000000000..361cd5c7a32b
--- /dev/null
+++ b/arch/powerpc/include/asm/tlbflush.h
@@ -0,0 +1,166 @@
1#ifndef _ASM_POWERPC_TLBFLUSH_H
2#define _ASM_POWERPC_TLBFLUSH_H
3
4/*
5 * TLB flushing:
6 *
7 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
8 * - flush_tlb_page(vma, vmaddr) flushes one page
9 * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB
10 * - flush_tlb_range(vma, start, end) flushes a range of pages
11 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 */
18#ifdef __KERNEL__
19
20#if defined(CONFIG_4xx) || defined(CONFIG_8xx) || defined(CONFIG_FSL_BOOKE)
21/*
22 * TLB flushing for software loaded TLB chips
23 *
24 * TODO: (CONFIG_FSL_BOOKE) determine if flush_tlb_range &
25 * flush_tlb_kernel_range are best implemented as tlbia vs
26 * specific tlbie's
27 */
28
29#include <linux/mm.h>
30
31extern void _tlbie(unsigned long address, unsigned int pid);
32
33#if defined(CONFIG_40x) || defined(CONFIG_8xx)
34#define _tlbia() asm volatile ("tlbia; sync" : : : "memory")
35#else /* CONFIG_44x || CONFIG_FSL_BOOKE */
36extern void _tlbia(void);
37#endif
38
39static inline void flush_tlb_mm(struct mm_struct *mm)
40{
41 _tlbia();
42}
43
44static inline void flush_tlb_page(struct vm_area_struct *vma,
45 unsigned long vmaddr)
46{
47 _tlbie(vmaddr, vma ? vma->vm_mm->context.id : 0);
48}
49
50static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
51 unsigned long vmaddr)
52{
53 _tlbie(vmaddr, vma ? vma->vm_mm->context.id : 0);
54}
55
56static inline void flush_tlb_range(struct vm_area_struct *vma,
57 unsigned long start, unsigned long end)
58{
59 _tlbia();
60}
61
62static inline void flush_tlb_kernel_range(unsigned long start,
63 unsigned long end)
64{
65 _tlbia();
66}
67
68#elif defined(CONFIG_PPC32)
69/*
70 * TLB flushing for "classic" hash-MMMU 32-bit CPUs, 6xx, 7xx, 7xxx
71 */
72extern void _tlbie(unsigned long address);
73extern void _tlbia(void);
74
75extern void flush_tlb_mm(struct mm_struct *mm);
76extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
77extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr);
78extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
79 unsigned long end);
80extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
81
82#else
83/*
84 * TLB flushing for 64-bit has-MMU CPUs
85 */
86
87#include <linux/percpu.h>
88#include <asm/page.h>
89
90#define PPC64_TLB_BATCH_NR 192
91
92struct ppc64_tlb_batch {
93 int active;
94 unsigned long index;
95 struct mm_struct *mm;
96 real_pte_t pte[PPC64_TLB_BATCH_NR];
97 unsigned long vaddr[PPC64_TLB_BATCH_NR];
98 unsigned int psize;
99 int ssize;
100};
101DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
102
103extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch);
104
105extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
106 pte_t *ptep, unsigned long pte, int huge);
107
108#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
109
110static inline void arch_enter_lazy_mmu_mode(void)
111{
112 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
113
114 batch->active = 1;
115}
116
117static inline void arch_leave_lazy_mmu_mode(void)
118{
119 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
120
121 if (batch->index)
122 __flush_tlb_pending(batch);
123 batch->active = 0;
124}
125
126#define arch_flush_lazy_mmu_mode() do {} while (0)
127
128
129extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize,
130 int ssize, int local);
131extern void flush_hash_range(unsigned long number, int local);
132
133
134static inline void flush_tlb_mm(struct mm_struct *mm)
135{
136}
137
138static inline void flush_tlb_page(struct vm_area_struct *vma,
139 unsigned long vmaddr)
140{
141}
142
143static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
144 unsigned long vmaddr)
145{
146}
147
148static inline void flush_tlb_range(struct vm_area_struct *vma,
149 unsigned long start, unsigned long end)
150{
151}
152
153static inline void flush_tlb_kernel_range(unsigned long start,
154 unsigned long end)
155{
156}
157
158/* Private function for use by PCI IO mapping code */
159extern void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
160 unsigned long end);
161
162
163#endif
164
165#endif /*__KERNEL__ */
166#endif /* _ASM_POWERPC_TLBFLUSH_H */
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
new file mode 100644
index 000000000000..c32da6f97999
--- /dev/null
+++ b/arch/powerpc/include/asm/topology.h
@@ -0,0 +1,117 @@
1#ifndef _ASM_POWERPC_TOPOLOGY_H
2#define _ASM_POWERPC_TOPOLOGY_H
3#ifdef __KERNEL__
4
5
6struct sys_device;
7struct device_node;
8
9#ifdef CONFIG_NUMA
10
11#include <asm/mmzone.h>
12
13static inline int cpu_to_node(int cpu)
14{
15 return numa_cpu_lookup_table[cpu];
16}
17
18#define parent_node(node) (node)
19
20static inline cpumask_t node_to_cpumask(int node)
21{
22 return numa_cpumask_lookup_table[node];
23}
24
25static inline int node_to_first_cpu(int node)
26{
27 cpumask_t tmp;
28 tmp = node_to_cpumask(node);
29 return first_cpu(tmp);
30}
31
32int of_node_to_nid(struct device_node *device);
33
34struct pci_bus;
35#ifdef CONFIG_PCI
36extern int pcibus_to_node(struct pci_bus *bus);
37#else
38static inline int pcibus_to_node(struct pci_bus *bus)
39{
40 return -1;
41}
42#endif
43
44#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
45 CPU_MASK_ALL : \
46 node_to_cpumask(pcibus_to_node(bus)) \
47 )
48
49/* sched_domains SD_NODE_INIT for PPC64 machines */
50#define SD_NODE_INIT (struct sched_domain) { \
51 .span = CPU_MASK_NONE, \
52 .parent = NULL, \
53 .child = NULL, \
54 .groups = NULL, \
55 .min_interval = 8, \
56 .max_interval = 32, \
57 .busy_factor = 32, \
58 .imbalance_pct = 125, \
59 .cache_nice_tries = 1, \
60 .busy_idx = 3, \
61 .idle_idx = 1, \
62 .newidle_idx = 2, \
63 .wake_idx = 1, \
64 .flags = SD_LOAD_BALANCE \
65 | SD_BALANCE_EXEC \
66 | SD_BALANCE_NEWIDLE \
67 | SD_WAKE_IDLE \
68 | SD_SERIALIZE \
69 | SD_WAKE_BALANCE, \
70 .last_balance = jiffies, \
71 .balance_interval = 1, \
72 .nr_balance_failed = 0, \
73}
74
75extern void __init dump_numa_cpu_topology(void);
76
77extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
78extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid);
79
80#else
81
82static inline int of_node_to_nid(struct device_node *device)
83{
84 return 0;
85}
86
87static inline void dump_numa_cpu_topology(void) {}
88
89static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid)
90{
91 return 0;
92}
93
94static inline void sysfs_remove_device_from_node(struct sys_device *dev,
95 int nid)
96{
97}
98
99#endif /* CONFIG_NUMA */
100
101#include <asm-generic/topology.h>
102
103#ifdef CONFIG_SMP
104#include <asm/cputable.h>
105#define smt_capable() (cpu_has_feature(CPU_FTR_SMT))
106
107#ifdef CONFIG_PPC64
108#include <asm/smp.h>
109
110#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
111#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
112#define topology_core_id(cpu) (cpu_to_core_id(cpu))
113#endif
114#endif
115
116#endif /* __KERNEL__ */
117#endif /* _ASM_POWERPC_TOPOLOGY_H */
diff --git a/arch/powerpc/include/asm/tsi108.h b/arch/powerpc/include/asm/tsi108.h
new file mode 100644
index 000000000000..f8b60793b7a9
--- /dev/null
+++ b/arch/powerpc/include/asm/tsi108.h
@@ -0,0 +1,121 @@
1/*
2 * common routine and memory layout for Tundra TSI108(Grendel) host bridge
3 * memory controller.
4 *
5 * Author: Jacob Pan (jacob.pan@freescale.com)
6 * Alex Bounine (alexandreb@tundra.com)
7 *
8 * Copyright 2004-2006 Freescale Semiconductor, Inc.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#ifndef __PPC_KERNEL_TSI108_H
17#define __PPC_KERNEL_TSI108_H
18
19#include <asm/pci-bridge.h>
20
21/* Size of entire register space */
22#define TSI108_REG_SIZE (0x10000)
23
24/* Sizes of register spaces for individual blocks */
25#define TSI108_HLP_SIZE 0x1000
26#define TSI108_PCI_SIZE 0x1000
27#define TSI108_CLK_SIZE 0x1000
28#define TSI108_PB_SIZE 0x1000
29#define TSI108_SD_SIZE 0x1000
30#define TSI108_DMA_SIZE 0x1000
31#define TSI108_ETH_SIZE 0x1000
32#define TSI108_I2C_SIZE 0x400
33#define TSI108_MPIC_SIZE 0x400
34#define TSI108_UART0_SIZE 0x200
35#define TSI108_GPIO_SIZE 0x200
36#define TSI108_UART1_SIZE 0x200
37
38/* Offsets within Tsi108(A) CSR space for individual blocks */
39#define TSI108_HLP_OFFSET 0x0000
40#define TSI108_PCI_OFFSET 0x1000
41#define TSI108_CLK_OFFSET 0x2000
42#define TSI108_PB_OFFSET 0x3000
43#define TSI108_SD_OFFSET 0x4000
44#define TSI108_DMA_OFFSET 0x5000
45#define TSI108_ETH_OFFSET 0x6000
46#define TSI108_I2C_OFFSET 0x7000
47#define TSI108_MPIC_OFFSET 0x7400
48#define TSI108_UART0_OFFSET 0x7800
49#define TSI108_GPIO_OFFSET 0x7A00
50#define TSI108_UART1_OFFSET 0x7C00
51
52/* Tsi108 registers used by common code components */
53#define TSI108_PCI_CSR (0x004)
54#define TSI108_PCI_IRP_CFG_CTL (0x180)
55#define TSI108_PCI_IRP_STAT (0x184)
56#define TSI108_PCI_IRP_ENABLE (0x188)
57#define TSI108_PCI_IRP_INTAD (0x18C)
58
59#define TSI108_PCI_IRP_STAT_P_INT (0x00400000)
60#define TSI108_PCI_IRP_ENABLE_P_INT (0x00400000)
61
62#define TSI108_CG_PWRUP_STATUS (0x234)
63
64#define TSI108_PB_ISR (0x00C)
65#define TSI108_PB_ERRCS (0x404)
66#define TSI108_PB_AERR (0x408)
67
68#define TSI108_PB_ERRCS_ES (1 << 1)
69#define TSI108_PB_ISR_PBS_RD_ERR (1 << 8)
70
71#define TSI108_PCI_CFG_SIZE (0x01000000)
72
73/*
74 * PHY Configuration Options
75 *
76 * Specify "bcm54xx" in the compatible property of your device tree phy
77 * nodes if your board uses the Broadcom PHYs
78 */
79#define TSI108_PHY_MV88E 0 /* Marvel 88Exxxx PHY */
80#define TSI108_PHY_BCM54XX 1 /* Broardcom BCM54xx PHY */
81
82/* Global variables */
83
84extern u32 tsi108_pci_cfg_base;
85/* Exported functions */
86
87extern int tsi108_bridge_init(struct pci_controller *hose, uint phys_csr_base);
88extern unsigned long tsi108_get_mem_size(void);
89extern unsigned long tsi108_get_cpu_clk(void);
90extern unsigned long tsi108_get_sdc_clk(void);
91extern int tsi108_direct_write_config(struct pci_bus *bus, unsigned int devfn,
92 int offset, int len, u32 val);
93extern int tsi108_direct_read_config(struct pci_bus *bus, unsigned int devfn,
94 int offset, int len, u32 * val);
95extern void tsi108_clear_pci_error(u32 pci_cfg_base);
96
97extern phys_addr_t get_csrbase(void);
98
99typedef struct {
100 u32 regs; /* hw registers base address */
101 u32 phyregs; /* phy registers base address */
102 u16 phy; /* phy address */
103 u16 irq_num; /* irq number */
104 u8 mac_addr[6]; /* phy mac address */
105 u16 phy_type; /* type of phy on board */
106} hw_info;
107
108extern u32 get_vir_csrbase(void);
109extern u32 tsi108_csr_vir_base;
110
111static inline u32 tsi108_read_reg(u32 reg_offset)
112{
113 return in_be32((volatile u32 *)(tsi108_csr_vir_base + reg_offset));
114}
115
116static inline void tsi108_write_reg(u32 reg_offset, u32 val)
117{
118 out_be32((volatile u32 *)(tsi108_csr_vir_base + reg_offset), val);
119}
120
121#endif /* __PPC_KERNEL_TSI108_H */
diff --git a/arch/powerpc/include/asm/tsi108_irq.h b/arch/powerpc/include/asm/tsi108_irq.h
new file mode 100644
index 000000000000..6ed93979fbe4
--- /dev/null
+++ b/arch/powerpc/include/asm/tsi108_irq.h
@@ -0,0 +1,124 @@
1/*
2 * (C) Copyright 2005 Tundra Semiconductor Corp.
3 * Alex Bounine, <alexandreb at tundra.com).
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24/*
25 * definitions for interrupt controller initialization and external interrupt
26 * demultiplexing on TSI108EMU/SVB boards.
27 */
28
29#ifndef _ASM_POWERPC_TSI108_IRQ_H
30#define _ASM_POWERPC_TSI108_IRQ_H
31
32/*
33 * Tsi108 interrupts
34 */
35#ifndef TSI108_IRQ_REG_BASE
36#define TSI108_IRQ_REG_BASE 0
37#endif
38
39#define TSI108_IRQ(x) (TSI108_IRQ_REG_BASE + (x))
40
41#define TSI108_MAX_VECTORS (36 + 4) /* 36 sources + PCI INT demux */
42#define MAX_TASK_PRIO 0xF
43
44#define TSI108_IRQ_SPURIOUS (TSI108_MAX_VECTORS)
45
46#define DEFAULT_PRIO_LVL 10 /* initial priority level */
47
48/* Interrupt vectors assignment to external and internal
49 * sources of requests. */
50
51/* EXTERNAL INTERRUPT SOURCES */
52
53#define IRQ_TSI108_EXT_INT0 TSI108_IRQ(0) /* External Source at INT[0] */
54#define IRQ_TSI108_EXT_INT1 TSI108_IRQ(1) /* External Source at INT[1] */
55#define IRQ_TSI108_EXT_INT2 TSI108_IRQ(2) /* External Source at INT[2] */
56#define IRQ_TSI108_EXT_INT3 TSI108_IRQ(3) /* External Source at INT[3] */
57
58/* INTERNAL INTERRUPT SOURCES */
59
60#define IRQ_TSI108_RESERVED0 TSI108_IRQ(4) /* Reserved IRQ */
61#define IRQ_TSI108_RESERVED1 TSI108_IRQ(5) /* Reserved IRQ */
62#define IRQ_TSI108_RESERVED2 TSI108_IRQ(6) /* Reserved IRQ */
63#define IRQ_TSI108_RESERVED3 TSI108_IRQ(7) /* Reserved IRQ */
64#define IRQ_TSI108_DMA0 TSI108_IRQ(8) /* DMA0 */
65#define IRQ_TSI108_DMA1 TSI108_IRQ(9) /* DMA1 */
66#define IRQ_TSI108_DMA2 TSI108_IRQ(10) /* DMA2 */
67#define IRQ_TSI108_DMA3 TSI108_IRQ(11) /* DMA3 */
68#define IRQ_TSI108_UART0 TSI108_IRQ(12) /* UART0 */
69#define IRQ_TSI108_UART1 TSI108_IRQ(13) /* UART1 */
70#define IRQ_TSI108_I2C TSI108_IRQ(14) /* I2C */
71#define IRQ_TSI108_GPIO TSI108_IRQ(15) /* GPIO */
72#define IRQ_TSI108_GIGE0 TSI108_IRQ(16) /* GIGE0 */
73#define IRQ_TSI108_GIGE1 TSI108_IRQ(17) /* GIGE1 */
74#define IRQ_TSI108_RESERVED4 TSI108_IRQ(18) /* Reserved IRQ */
75#define IRQ_TSI108_HLP TSI108_IRQ(19) /* HLP */
76#define IRQ_TSI108_SDRAM TSI108_IRQ(20) /* SDC */
77#define IRQ_TSI108_PROC_IF TSI108_IRQ(21) /* Processor IF */
78#define IRQ_TSI108_RESERVED5 TSI108_IRQ(22) /* Reserved IRQ */
79#define IRQ_TSI108_PCI TSI108_IRQ(23) /* PCI/X block */
80
81#define IRQ_TSI108_MBOX0 TSI108_IRQ(24) /* Mailbox 0 register */
82#define IRQ_TSI108_MBOX1 TSI108_IRQ(25) /* Mailbox 1 register */
83#define IRQ_TSI108_MBOX2 TSI108_IRQ(26) /* Mailbox 2 register */
84#define IRQ_TSI108_MBOX3 TSI108_IRQ(27) /* Mailbox 3 register */
85
86#define IRQ_TSI108_DBELL0 TSI108_IRQ(28) /* Doorbell 0 */
87#define IRQ_TSI108_DBELL1 TSI108_IRQ(29) /* Doorbell 1 */
88#define IRQ_TSI108_DBELL2 TSI108_IRQ(30) /* Doorbell 2 */
89#define IRQ_TSI108_DBELL3 TSI108_IRQ(31) /* Doorbell 3 */
90
91#define IRQ_TSI108_TIMER0 TSI108_IRQ(32) /* Global Timer 0 */
92#define IRQ_TSI108_TIMER1 TSI108_IRQ(33) /* Global Timer 1 */
93#define IRQ_TSI108_TIMER2 TSI108_IRQ(34) /* Global Timer 2 */
94#define IRQ_TSI108_TIMER3 TSI108_IRQ(35) /* Global Timer 3 */
95
96/*
97 * PCI bus INTA# - INTD# lines demultiplexor
98 */
99#define IRQ_PCI_INTAD_BASE TSI108_IRQ(36)
100#define IRQ_PCI_INTA (IRQ_PCI_INTAD_BASE + 0)
101#define IRQ_PCI_INTB (IRQ_PCI_INTAD_BASE + 1)
102#define IRQ_PCI_INTC (IRQ_PCI_INTAD_BASE + 2)
103#define IRQ_PCI_INTD (IRQ_PCI_INTAD_BASE + 3)
104#define NUM_PCI_IRQS (4)
105
106/* number of entries in vector dispatch table */
107#define IRQ_TSI108_TAB_SIZE (TSI108_MAX_VECTORS + 1)
108
109/* Mapping of MPIC outputs to processors' interrupt pins */
110
111#define IDIR_INT_OUT0 0x1
112#define IDIR_INT_OUT1 0x2
113#define IDIR_INT_OUT2 0x4
114#define IDIR_INT_OUT3 0x8
115
116/*---------------------------------------------------------------
117 * IRQ line configuration parameters */
118
119/* Interrupt delivery modes */
120typedef enum {
121 TSI108_IRQ_DIRECTED,
122 TSI108_IRQ_DISTRIBUTED,
123} TSI108_IRQ_MODE;
124#endif /* _ASM_POWERPC_TSI108_IRQ_H */
diff --git a/arch/powerpc/include/asm/tsi108_pci.h b/arch/powerpc/include/asm/tsi108_pci.h
new file mode 100644
index 000000000000..5653d7cc3e24
--- /dev/null
+++ b/arch/powerpc/include/asm/tsi108_pci.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright 2007 IBM Corp
3 *
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 as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (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,
18 * MA 02111-1307 USA
19 */
20
21#ifndef _ASM_POWERPC_TSI108_PCI_H
22#define _ASM_POWERPC_TSI108_PCI_H
23
24#include <asm/tsi108.h>
25
26/* Register definitions */
27#define TSI108_PCI_P2O_BAR0 (TSI108_PCI_OFFSET + 0x10)
28#define TSI108_PCI_P2O_BAR0_UPPER (TSI108_PCI_OFFSET + 0x14)
29#define TSI108_PCI_P2O_BAR2 (TSI108_PCI_OFFSET + 0x18)
30#define TSI108_PCI_P2O_BAR2_UPPER (TSI108_PCI_OFFSET + 0x1c)
31#define TSI108_PCI_P2O_PAGE_SIZES (TSI108_PCI_OFFSET + 0x4c)
32#define TSI108_PCI_PFAB_BAR0 (TSI108_PCI_OFFSET + 0x204)
33#define TSI108_PCI_PFAB_BAR0_UPPER (TSI108_PCI_OFFSET + 0x208)
34#define TSI108_PCI_PFAB_IO (TSI108_PCI_OFFSET + 0x20c)
35#define TSI108_PCI_PFAB_IO_UPPER (TSI108_PCI_OFFSET + 0x210)
36#define TSI108_PCI_PFAB_MEM32 (TSI108_PCI_OFFSET + 0x214)
37#define TSI108_PCI_PFAB_PFM3 (TSI108_PCI_OFFSET + 0x220)
38#define TSI108_PCI_PFAB_PFM4 (TSI108_PCI_OFFSET + 0x230)
39
40extern int tsi108_setup_pci(struct device_node *dev, u32 cfg_phys, int primary);
41extern void tsi108_pci_int_init(struct device_node *node);
42extern void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc);
43extern void tsi108_clear_pci_cfg_error(void);
44
45#endif /* _ASM_POWERPC_TSI108_PCI_H */
diff --git a/arch/powerpc/include/asm/types.h b/arch/powerpc/include/asm/types.h
new file mode 100644
index 000000000000..d3374bc865ba
--- /dev/null
+++ b/arch/powerpc/include/asm/types.h
@@ -0,0 +1,75 @@
1#ifndef _ASM_POWERPC_TYPES_H
2#define _ASM_POWERPC_TYPES_H
3
4#ifdef __powerpc64__
5# include <asm-generic/int-l64.h>
6#else
7# include <asm-generic/int-ll64.h>
8#endif
9
10#ifndef __ASSEMBLY__
11
12/*
13 * This file is never included by application software unless
14 * explicitly requested (e.g., via linux/types.h) in which case the
15 * application is Linux specific so (user-) name space pollution is
16 * not a major issue. However, for interoperability, libraries still
17 * need to be careful to avoid a name clashes.
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version
22 * 2 of the License, or (at your option) any later version.
23 */
24
25#ifdef __powerpc64__
26typedef unsigned int umode_t;
27#else
28typedef unsigned short umode_t;
29#endif
30
31typedef struct {
32 __u32 u[4];
33} __attribute__((aligned(16))) __vector128;
34
35#endif /* __ASSEMBLY__ */
36
37#ifdef __KERNEL__
38/*
39 * These aren't exported outside the kernel to avoid name space clashes
40 */
41#ifdef __powerpc64__
42#define BITS_PER_LONG 64
43#else
44#define BITS_PER_LONG 32
45#endif
46
47#ifndef __ASSEMBLY__
48
49typedef __vector128 vector128;
50
51/* Physical address used by some IO functions */
52#if defined(CONFIG_PPC64) || defined(CONFIG_PHYS_64BIT)
53typedef u64 phys_addr_t;
54#else
55typedef u32 phys_addr_t;
56#endif
57
58#ifdef __powerpc64__
59typedef u64 dma_addr_t;
60#else
61typedef u32 dma_addr_t;
62#endif
63typedef u64 dma64_addr_t;
64
65typedef struct {
66 unsigned long entry;
67 unsigned long toc;
68 unsigned long env;
69} func_descr_t;
70
71#endif /* __ASSEMBLY__ */
72
73#endif /* __KERNEL__ */
74
75#endif /* _ASM_POWERPC_TYPES_H */
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
new file mode 100644
index 000000000000..bd0fb8495154
--- /dev/null
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -0,0 +1,496 @@
1#ifndef _ARCH_POWERPC_UACCESS_H
2#define _ARCH_POWERPC_UACCESS_H
3
4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__
6
7#include <linux/sched.h>
8#include <linux/errno.h>
9#include <asm/asm-compat.h>
10#include <asm/processor.h>
11#include <asm/page.h>
12
13#define VERIFY_READ 0
14#define VERIFY_WRITE 1
15
16/*
17 * The fs value determines whether argument validity checking should be
18 * performed or not. If get_fs() == USER_DS, checking is performed, with
19 * get_fs() == KERNEL_DS, checking is bypassed.
20 *
21 * For historical reasons, these macros are grossly misnamed.
22 *
23 * The fs/ds values are now the highest legal address in the "segment".
24 * This simplifies the checking in the routines below.
25 */
26
27#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
28
29#define KERNEL_DS MAKE_MM_SEG(~0UL)
30#ifdef __powerpc64__
31/* We use TASK_SIZE_USER64 as TASK_SIZE is not constant */
32#define USER_DS MAKE_MM_SEG(TASK_SIZE_USER64 - 1)
33#else
34#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
35#endif
36
37#define get_ds() (KERNEL_DS)
38#define get_fs() (current->thread.fs)
39#define set_fs(val) (current->thread.fs = (val))
40
41#define segment_eq(a, b) ((a).seg == (b).seg)
42
43#ifdef __powerpc64__
44/*
45 * This check is sufficient because there is a large enough
46 * gap between user addresses and the kernel addresses
47 */
48#define __access_ok(addr, size, segment) \
49 (((addr) <= (segment).seg) && ((size) <= (segment).seg))
50
51#else
52
53#define __access_ok(addr, size, segment) \
54 (((addr) <= (segment).seg) && \
55 (((size) == 0) || (((size) - 1) <= ((segment).seg - (addr)))))
56
57#endif
58
59#define access_ok(type, addr, size) \
60 (__chk_user_ptr(addr), \
61 __access_ok((__force unsigned long)(addr), (size), get_fs()))
62
63/*
64 * The exception table consists of pairs of addresses: the first is the
65 * address of an instruction that is allowed to fault, and the second is
66 * the address at which the program should continue. No registers are
67 * modified, so it is entirely up to the continuation code to figure out
68 * what to do.
69 *
70 * All the routines below use bits of fixup code that are out of line
71 * with the main instruction path. This means when everything is well,
72 * we don't even have to jump over them. Further, they do not intrude
73 * on our cache or tlb entries.
74 */
75
76struct exception_table_entry {
77 unsigned long insn;
78 unsigned long fixup;
79};
80
81/*
82 * These are the main single-value transfer routines. They automatically
83 * use the right size if we just have the right pointer type.
84 *
85 * This gets kind of ugly. We want to return _two_ values in "get_user()"
86 * and yet we don't want to do any pointers, because that is too much
87 * of a performance impact. Thus we have a few rather ugly macros here,
88 * and hide all the ugliness from the user.
89 *
90 * The "__xxx" versions of the user access functions are versions that
91 * do not verify the address space, that must have been done previously
92 * with a separate "access_ok()" call (this is used when we do multiple
93 * accesses to the same area of user memory).
94 *
95 * As we use the same address space for kernel and user data on the
96 * PowerPC, we can just do these as direct assignments. (Of course, the
97 * exception handling means that it's no longer "just"...)
98 *
99 * The "user64" versions of the user access functions are versions that
100 * allow access of 64-bit data. The "get_user" functions do not
101 * properly handle 64-bit data because the value gets down cast to a long.
102 * The "put_user" functions already handle 64-bit data properly but we add
103 * "user64" versions for completeness
104 */
105#define get_user(x, ptr) \
106 __get_user_check((x), (ptr), sizeof(*(ptr)))
107#define put_user(x, ptr) \
108 __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
109
110#define __get_user(x, ptr) \
111 __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
112#define __put_user(x, ptr) \
113 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
114
115#ifndef __powerpc64__
116#define __get_user64(x, ptr) \
117 __get_user64_nocheck((x), (ptr), sizeof(*(ptr)))
118#define __put_user64(x, ptr) __put_user(x, ptr)
119#endif
120
121#define __get_user_inatomic(x, ptr) \
122 __get_user_nosleep((x), (ptr), sizeof(*(ptr)))
123#define __put_user_inatomic(x, ptr) \
124 __put_user_nosleep((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
125
126#define __get_user_unaligned __get_user
127#define __put_user_unaligned __put_user
128
129extern long __put_user_bad(void);
130
131/*
132 * We don't tell gcc that we are accessing memory, but this is OK
133 * because we do not write to any memory gcc knows about, so there
134 * are no aliasing issues.
135 */
136#define __put_user_asm(x, addr, err, op) \
137 __asm__ __volatile__( \
138 "1: " op " %1,0(%2) # put_user\n" \
139 "2:\n" \
140 ".section .fixup,\"ax\"\n" \
141 "3: li %0,%3\n" \
142 " b 2b\n" \
143 ".previous\n" \
144 ".section __ex_table,\"a\"\n" \
145 PPC_LONG_ALIGN "\n" \
146 PPC_LONG "1b,3b\n" \
147 ".previous" \
148 : "=r" (err) \
149 : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
150
151#ifdef __powerpc64__
152#define __put_user_asm2(x, ptr, retval) \
153 __put_user_asm(x, ptr, retval, "std")
154#else /* __powerpc64__ */
155#define __put_user_asm2(x, addr, err) \
156 __asm__ __volatile__( \
157 "1: stw %1,0(%2)\n" \
158 "2: stw %1+1,4(%2)\n" \
159 "3:\n" \
160 ".section .fixup,\"ax\"\n" \
161 "4: li %0,%3\n" \
162 " b 3b\n" \
163 ".previous\n" \
164 ".section __ex_table,\"a\"\n" \
165 PPC_LONG_ALIGN "\n" \
166 PPC_LONG "1b,4b\n" \
167 PPC_LONG "2b,4b\n" \
168 ".previous" \
169 : "=r" (err) \
170 : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
171#endif /* __powerpc64__ */
172
173#define __put_user_size(x, ptr, size, retval) \
174do { \
175 retval = 0; \
176 switch (size) { \
177 case 1: __put_user_asm(x, ptr, retval, "stb"); break; \
178 case 2: __put_user_asm(x, ptr, retval, "sth"); break; \
179 case 4: __put_user_asm(x, ptr, retval, "stw"); break; \
180 case 8: __put_user_asm2(x, ptr, retval); break; \
181 default: __put_user_bad(); \
182 } \
183} while (0)
184
185#define __put_user_nocheck(x, ptr, size) \
186({ \
187 long __pu_err; \
188 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
189 if (!is_kernel_addr((unsigned long)__pu_addr)) \
190 might_sleep(); \
191 __chk_user_ptr(ptr); \
192 __put_user_size((x), __pu_addr, (size), __pu_err); \
193 __pu_err; \
194})
195
196#define __put_user_check(x, ptr, size) \
197({ \
198 long __pu_err = -EFAULT; \
199 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
200 might_sleep(); \
201 if (access_ok(VERIFY_WRITE, __pu_addr, size)) \
202 __put_user_size((x), __pu_addr, (size), __pu_err); \
203 __pu_err; \
204})
205
206#define __put_user_nosleep(x, ptr, size) \
207({ \
208 long __pu_err; \
209 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
210 __chk_user_ptr(ptr); \
211 __put_user_size((x), __pu_addr, (size), __pu_err); \
212 __pu_err; \
213})
214
215
216extern long __get_user_bad(void);
217
218#define __get_user_asm(x, addr, err, op) \
219 __asm__ __volatile__( \
220 "1: "op" %1,0(%2) # get_user\n" \
221 "2:\n" \
222 ".section .fixup,\"ax\"\n" \
223 "3: li %0,%3\n" \
224 " li %1,0\n" \
225 " b 2b\n" \
226 ".previous\n" \
227 ".section __ex_table,\"a\"\n" \
228 PPC_LONG_ALIGN "\n" \
229 PPC_LONG "1b,3b\n" \
230 ".previous" \
231 : "=r" (err), "=r" (x) \
232 : "b" (addr), "i" (-EFAULT), "0" (err))
233
234#ifdef __powerpc64__
235#define __get_user_asm2(x, addr, err) \
236 __get_user_asm(x, addr, err, "ld")
237#else /* __powerpc64__ */
238#define __get_user_asm2(x, addr, err) \
239 __asm__ __volatile__( \
240 "1: lwz %1,0(%2)\n" \
241 "2: lwz %1+1,4(%2)\n" \
242 "3:\n" \
243 ".section .fixup,\"ax\"\n" \
244 "4: li %0,%3\n" \
245 " li %1,0\n" \
246 " li %1+1,0\n" \
247 " b 3b\n" \
248 ".previous\n" \
249 ".section __ex_table,\"a\"\n" \
250 PPC_LONG_ALIGN "\n" \
251 PPC_LONG "1b,4b\n" \
252 PPC_LONG "2b,4b\n" \
253 ".previous" \
254 : "=r" (err), "=&r" (x) \
255 : "b" (addr), "i" (-EFAULT), "0" (err))
256#endif /* __powerpc64__ */
257
258#define __get_user_size(x, ptr, size, retval) \
259do { \
260 retval = 0; \
261 __chk_user_ptr(ptr); \
262 if (size > sizeof(x)) \
263 (x) = __get_user_bad(); \
264 switch (size) { \
265 case 1: __get_user_asm(x, ptr, retval, "lbz"); break; \
266 case 2: __get_user_asm(x, ptr, retval, "lhz"); break; \
267 case 4: __get_user_asm(x, ptr, retval, "lwz"); break; \
268 case 8: __get_user_asm2(x, ptr, retval); break; \
269 default: (x) = __get_user_bad(); \
270 } \
271} while (0)
272
273#define __get_user_nocheck(x, ptr, size) \
274({ \
275 long __gu_err; \
276 unsigned long __gu_val; \
277 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
278 __chk_user_ptr(ptr); \
279 if (!is_kernel_addr((unsigned long)__gu_addr)) \
280 might_sleep(); \
281 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
282 (x) = (__typeof__(*(ptr)))__gu_val; \
283 __gu_err; \
284})
285
286#ifndef __powerpc64__
287#define __get_user64_nocheck(x, ptr, size) \
288({ \
289 long __gu_err; \
290 long long __gu_val; \
291 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
292 __chk_user_ptr(ptr); \
293 if (!is_kernel_addr((unsigned long)__gu_addr)) \
294 might_sleep(); \
295 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
296 (x) = (__typeof__(*(ptr)))__gu_val; \
297 __gu_err; \
298})
299#endif /* __powerpc64__ */
300
301#define __get_user_check(x, ptr, size) \
302({ \
303 long __gu_err = -EFAULT; \
304 unsigned long __gu_val = 0; \
305 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
306 might_sleep(); \
307 if (access_ok(VERIFY_READ, __gu_addr, (size))) \
308 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
309 (x) = (__typeof__(*(ptr)))__gu_val; \
310 __gu_err; \
311})
312
313#define __get_user_nosleep(x, ptr, size) \
314({ \
315 long __gu_err; \
316 unsigned long __gu_val; \
317 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
318 __chk_user_ptr(ptr); \
319 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
320 (x) = (__typeof__(*(ptr)))__gu_val; \
321 __gu_err; \
322})
323
324
325/* more complex routines */
326
327extern unsigned long __copy_tofrom_user(void __user *to,
328 const void __user *from, unsigned long size);
329
330#ifndef __powerpc64__
331
332static inline unsigned long copy_from_user(void *to,
333 const void __user *from, unsigned long n)
334{
335 unsigned long over;
336
337 if (access_ok(VERIFY_READ, from, n))
338 return __copy_tofrom_user((__force void __user *)to, from, n);
339 if ((unsigned long)from < TASK_SIZE) {
340 over = (unsigned long)from + n - TASK_SIZE;
341 return __copy_tofrom_user((__force void __user *)to, from,
342 n - over) + over;
343 }
344 return n;
345}
346
347static inline unsigned long copy_to_user(void __user *to,
348 const void *from, unsigned long n)
349{
350 unsigned long over;
351
352 if (access_ok(VERIFY_WRITE, to, n))
353 return __copy_tofrom_user(to, (__force void __user *)from, n);
354 if ((unsigned long)to < TASK_SIZE) {
355 over = (unsigned long)to + n - TASK_SIZE;
356 return __copy_tofrom_user(to, (__force void __user *)from,
357 n - over) + over;
358 }
359 return n;
360}
361
362#else /* __powerpc64__ */
363
364#define __copy_in_user(to, from, size) \
365 __copy_tofrom_user((to), (from), (size))
366
367extern unsigned long copy_from_user(void *to, const void __user *from,
368 unsigned long n);
369extern unsigned long copy_to_user(void __user *to, const void *from,
370 unsigned long n);
371extern unsigned long copy_in_user(void __user *to, const void __user *from,
372 unsigned long n);
373
374#endif /* __powerpc64__ */
375
376static inline unsigned long __copy_from_user_inatomic(void *to,
377 const void __user *from, unsigned long n)
378{
379 if (__builtin_constant_p(n) && (n <= 8)) {
380 unsigned long ret = 1;
381
382 switch (n) {
383 case 1:
384 __get_user_size(*(u8 *)to, from, 1, ret);
385 break;
386 case 2:
387 __get_user_size(*(u16 *)to, from, 2, ret);
388 break;
389 case 4:
390 __get_user_size(*(u32 *)to, from, 4, ret);
391 break;
392 case 8:
393 __get_user_size(*(u64 *)to, from, 8, ret);
394 break;
395 }
396 if (ret == 0)
397 return 0;
398 }
399 return __copy_tofrom_user((__force void __user *)to, from, n);
400}
401
402static inline unsigned long __copy_to_user_inatomic(void __user *to,
403 const void *from, unsigned long n)
404{
405 if (__builtin_constant_p(n) && (n <= 8)) {
406 unsigned long ret = 1;
407
408 switch (n) {
409 case 1:
410 __put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret);
411 break;
412 case 2:
413 __put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret);
414 break;
415 case 4:
416 __put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret);
417 break;
418 case 8:
419 __put_user_size(*(u64 *)from, (u64 __user *)to, 8, ret);
420 break;
421 }
422 if (ret == 0)
423 return 0;
424 }
425 return __copy_tofrom_user(to, (__force const void __user *)from, n);
426}
427
428static inline unsigned long __copy_from_user(void *to,
429 const void __user *from, unsigned long size)
430{
431 might_sleep();
432 return __copy_from_user_inatomic(to, from, size);
433}
434
435static inline unsigned long __copy_to_user(void __user *to,
436 const void *from, unsigned long size)
437{
438 might_sleep();
439 return __copy_to_user_inatomic(to, from, size);
440}
441
442extern unsigned long __clear_user(void __user *addr, unsigned long size);
443
444static inline unsigned long clear_user(void __user *addr, unsigned long size)
445{
446 might_sleep();
447 if (likely(access_ok(VERIFY_WRITE, addr, size)))
448 return __clear_user(addr, size);
449 if ((unsigned long)addr < TASK_SIZE) {
450 unsigned long over = (unsigned long)addr + size - TASK_SIZE;
451 return __clear_user(addr, size - over) + over;
452 }
453 return size;
454}
455
456extern int __strncpy_from_user(char *dst, const char __user *src, long count);
457
458static inline long strncpy_from_user(char *dst, const char __user *src,
459 long count)
460{
461 might_sleep();
462 if (likely(access_ok(VERIFY_READ, src, 1)))
463 return __strncpy_from_user(dst, src, count);
464 return -EFAULT;
465}
466
467/*
468 * Return the size of a string (including the ending 0)
469 *
470 * Return 0 for error
471 */
472extern int __strnlen_user(const char __user *str, long len, unsigned long top);
473
474/*
475 * Returns the length of the string at str (including the null byte),
476 * or 0 if we hit a page we can't access,
477 * or something > len if we didn't find a null byte.
478 *
479 * The `top' parameter to __strnlen_user is to make sure that
480 * we can never overflow from the user area into kernel space.
481 */
482static inline int strnlen_user(const char __user *str, long len)
483{
484 unsigned long top = current->thread.fs.seg;
485
486 if ((unsigned long)str > top)
487 return 0;
488 return __strnlen_user(str, len, top);
489}
490
491#define strlen_user(str) strnlen_user((str), 0x7ffffffe)
492
493#endif /* __ASSEMBLY__ */
494#endif /* __KERNEL__ */
495
496#endif /* _ARCH_POWERPC_UACCESS_H */
diff --git a/arch/powerpc/include/asm/ucc.h b/arch/powerpc/include/asm/ucc.h
new file mode 100644
index 000000000000..46b09ba6bead
--- /dev/null
+++ b/arch/powerpc/include/asm/ucc.h
@@ -0,0 +1,64 @@
1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com>
6 *
7 * Description:
8 * Internal header file for UCC unit routines.
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#ifndef __UCC_H__
16#define __UCC_H__
17
18#include <asm/immap_qe.h>
19#include <asm/qe.h>
20
21#define STATISTICS
22
23#define UCC_MAX_NUM 8
24
25/* Slow or fast type for UCCs.
26*/
27enum ucc_speed_type {
28 UCC_SPEED_TYPE_FAST = UCC_GUEMR_MODE_FAST_RX | UCC_GUEMR_MODE_FAST_TX,
29 UCC_SPEED_TYPE_SLOW = UCC_GUEMR_MODE_SLOW_RX | UCC_GUEMR_MODE_SLOW_TX
30};
31
32/* ucc_set_type
33 * Sets UCC to slow or fast mode.
34 *
35 * ucc_num - (In) number of UCC (0-7).
36 * speed - (In) slow or fast mode for UCC.
37 */
38int ucc_set_type(unsigned int ucc_num, enum ucc_speed_type speed);
39
40int ucc_set_qe_mux_mii_mng(unsigned int ucc_num);
41
42int ucc_set_qe_mux_rxtx(unsigned int ucc_num, enum qe_clock clock,
43 enum comm_dir mode);
44
45int ucc_mux_set_grant_tsa_bkpt(unsigned int ucc_num, int set, u32 mask);
46
47/* QE MUX clock routing for UCC
48*/
49static inline int ucc_set_qe_mux_grant(unsigned int ucc_num, int set)
50{
51 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_GRANT);
52}
53
54static inline int ucc_set_qe_mux_tsa(unsigned int ucc_num, int set)
55{
56 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_TSA);
57}
58
59static inline int ucc_set_qe_mux_bkpt(unsigned int ucc_num, int set)
60{
61 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_BKPT);
62}
63
64#endif /* __UCC_H__ */
diff --git a/arch/powerpc/include/asm/ucc_fast.h b/arch/powerpc/include/asm/ucc_fast.h
new file mode 100644
index 000000000000..839aab8bf37d
--- /dev/null
+++ b/arch/powerpc/include/asm/ucc_fast.h
@@ -0,0 +1,244 @@
1/*
2 * Internal header file for UCC FAST unit routines.
3 *
4 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
5 *
6 * Authors: Shlomi Gridish <gridish@freescale.com>
7 * Li Yang <leoli@freescale.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14#ifndef __UCC_FAST_H__
15#define __UCC_FAST_H__
16
17#include <linux/kernel.h>
18
19#include <asm/immap_qe.h>
20#include <asm/qe.h>
21
22#include "ucc.h"
23
24/* Receive BD's status */
25#define R_E 0x80000000 /* buffer empty */
26#define R_W 0x20000000 /* wrap bit */
27#define R_I 0x10000000 /* interrupt on reception */
28#define R_L 0x08000000 /* last */
29#define R_F 0x04000000 /* first */
30
31/* transmit BD's status */
32#define T_R 0x80000000 /* ready bit */
33#define T_W 0x20000000 /* wrap bit */
34#define T_I 0x10000000 /* interrupt on completion */
35#define T_L 0x08000000 /* last */
36
37/* Rx Data buffer must be 4 bytes aligned in most cases */
38#define UCC_FAST_RX_ALIGN 4
39#define UCC_FAST_MRBLR_ALIGNMENT 4
40#define UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT 8
41
42/* Sizes */
43#define UCC_FAST_URFS_MIN_VAL 0x88
44#define UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR 8
45
46/* ucc_fast_channel_protocol_mode - UCC FAST mode */
47enum ucc_fast_channel_protocol_mode {
48 UCC_FAST_PROTOCOL_MODE_HDLC = 0x00000000,
49 UCC_FAST_PROTOCOL_MODE_RESERVED01 = 0x00000001,
50 UCC_FAST_PROTOCOL_MODE_RESERVED_QMC = 0x00000002,
51 UCC_FAST_PROTOCOL_MODE_RESERVED02 = 0x00000003,
52 UCC_FAST_PROTOCOL_MODE_RESERVED_UART = 0x00000004,
53 UCC_FAST_PROTOCOL_MODE_RESERVED03 = 0x00000005,
54 UCC_FAST_PROTOCOL_MODE_RESERVED_EX_MAC_1 = 0x00000006,
55 UCC_FAST_PROTOCOL_MODE_RESERVED_EX_MAC_2 = 0x00000007,
56 UCC_FAST_PROTOCOL_MODE_RESERVED_BISYNC = 0x00000008,
57 UCC_FAST_PROTOCOL_MODE_RESERVED04 = 0x00000009,
58 UCC_FAST_PROTOCOL_MODE_ATM = 0x0000000A,
59 UCC_FAST_PROTOCOL_MODE_RESERVED05 = 0x0000000B,
60 UCC_FAST_PROTOCOL_MODE_ETHERNET = 0x0000000C,
61 UCC_FAST_PROTOCOL_MODE_RESERVED06 = 0x0000000D,
62 UCC_FAST_PROTOCOL_MODE_POS = 0x0000000E,
63 UCC_FAST_PROTOCOL_MODE_RESERVED07 = 0x0000000F
64};
65
66/* ucc_fast_transparent_txrx - UCC Fast Transparent TX & RX */
67enum ucc_fast_transparent_txrx {
68 UCC_FAST_GUMR_TRANSPARENT_TTX_TRX_NORMAL = 0x00000000,
69 UCC_FAST_GUMR_TRANSPARENT_TTX_TRX_TRANSPARENT = 0x18000000
70};
71
72/* UCC fast diagnostic mode */
73enum ucc_fast_diag_mode {
74 UCC_FAST_DIAGNOSTIC_NORMAL = 0x0,
75 UCC_FAST_DIAGNOSTIC_LOCAL_LOOP_BACK = 0x40000000,
76 UCC_FAST_DIAGNOSTIC_AUTO_ECHO = 0x80000000,
77 UCC_FAST_DIAGNOSTIC_LOOP_BACK_AND_ECHO = 0xC0000000
78};
79
80/* UCC fast Sync length (transparent mode only) */
81enum ucc_fast_sync_len {
82 UCC_FAST_SYNC_LEN_NOT_USED = 0x0,
83 UCC_FAST_SYNC_LEN_AUTOMATIC = 0x00004000,
84 UCC_FAST_SYNC_LEN_8_BIT = 0x00008000,
85 UCC_FAST_SYNC_LEN_16_BIT = 0x0000C000
86};
87
88/* UCC fast RTS mode */
89enum ucc_fast_ready_to_send {
90 UCC_FAST_SEND_IDLES_BETWEEN_FRAMES = 0x00000000,
91 UCC_FAST_SEND_FLAGS_BETWEEN_FRAMES = 0x00002000
92};
93
94/* UCC fast receiver decoding mode */
95enum ucc_fast_rx_decoding_method {
96 UCC_FAST_RX_ENCODING_NRZ = 0x00000000,
97 UCC_FAST_RX_ENCODING_NRZI = 0x00000800,
98 UCC_FAST_RX_ENCODING_RESERVED0 = 0x00001000,
99 UCC_FAST_RX_ENCODING_RESERVED1 = 0x00001800
100};
101
102/* UCC fast transmitter encoding mode */
103enum ucc_fast_tx_encoding_method {
104 UCC_FAST_TX_ENCODING_NRZ = 0x00000000,
105 UCC_FAST_TX_ENCODING_NRZI = 0x00000100,
106 UCC_FAST_TX_ENCODING_RESERVED0 = 0x00000200,
107 UCC_FAST_TX_ENCODING_RESERVED1 = 0x00000300
108};
109
110/* UCC fast CRC length */
111enum ucc_fast_transparent_tcrc {
112 UCC_FAST_16_BIT_CRC = 0x00000000,
113 UCC_FAST_CRC_RESERVED0 = 0x00000040,
114 UCC_FAST_32_BIT_CRC = 0x00000080,
115 UCC_FAST_CRC_RESERVED1 = 0x000000C0
116};
117
118/* Fast UCC initialization structure */
119struct ucc_fast_info {
120 int ucc_num;
121 enum qe_clock rx_clock;
122 enum qe_clock tx_clock;
123 u32 regs;
124 int irq;
125 u32 uccm_mask;
126 int bd_mem_part;
127 int brkpt_support;
128 int grant_support;
129 int tsa;
130 int cdp;
131 int cds;
132 int ctsp;
133 int ctss;
134 int tci;
135 int txsy;
136 int rtsm;
137 int revd;
138 int rsyn;
139 u16 max_rx_buf_length;
140 u16 urfs;
141 u16 urfet;
142 u16 urfset;
143 u16 utfs;
144 u16 utfet;
145 u16 utftt;
146 u16 ufpt;
147 enum ucc_fast_channel_protocol_mode mode;
148 enum ucc_fast_transparent_txrx ttx_trx;
149 enum ucc_fast_tx_encoding_method tenc;
150 enum ucc_fast_rx_decoding_method renc;
151 enum ucc_fast_transparent_tcrc tcrc;
152 enum ucc_fast_sync_len synl;
153};
154
155struct ucc_fast_private {
156 struct ucc_fast_info *uf_info;
157 struct ucc_fast __iomem *uf_regs; /* a pointer to the UCC regs. */
158 u32 __iomem *p_ucce; /* a pointer to the event register in memory. */
159 u32 __iomem *p_uccm; /* a pointer to the mask register in memory. */
160#ifdef CONFIG_UGETH_TX_ON_DEMAND
161 u16 __iomem *p_utodr; /* pointer to the transmit on demand register */
162#endif
163 int enabled_tx; /* Whether channel is enabled for Tx (ENT) */
164 int enabled_rx; /* Whether channel is enabled for Rx (ENR) */
165 int stopped_tx; /* Whether channel has been stopped for Tx
166 (STOP_TX, etc.) */
167 int stopped_rx; /* Whether channel has been stopped for Rx */
168 u32 ucc_fast_tx_virtual_fifo_base_offset;/* pointer to base of Tx
169 virtual fifo */
170 u32 ucc_fast_rx_virtual_fifo_base_offset;/* pointer to base of Rx
171 virtual fifo */
172#ifdef STATISTICS
173 u32 tx_frames; /* Transmitted frames counter. */
174 u32 rx_frames; /* Received frames counter (only frames
175 passed to application). */
176 u32 tx_discarded; /* Discarded tx frames counter (frames that
177 were discarded by the driver due to errors).
178 */
179 u32 rx_discarded; /* Discarded rx frames counter (frames that
180 were discarded by the driver due to errors).
181 */
182#endif /* STATISTICS */
183 u16 mrblr; /* maximum receive buffer length */
184};
185
186/* ucc_fast_init
187 * Initializes Fast UCC according to user provided parameters.
188 *
189 * uf_info - (In) pointer to the fast UCC info structure.
190 * uccf_ret - (Out) pointer to the fast UCC structure.
191 */
192int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** uccf_ret);
193
194/* ucc_fast_free
195 * Frees all resources for fast UCC.
196 *
197 * uccf - (In) pointer to the fast UCC structure.
198 */
199void ucc_fast_free(struct ucc_fast_private * uccf);
200
201/* ucc_fast_enable
202 * Enables a fast UCC port.
203 * This routine enables Tx and/or Rx through the General UCC Mode Register.
204 *
205 * uccf - (In) pointer to the fast UCC structure.
206 * mode - (In) TX, RX, or both.
207 */
208void ucc_fast_enable(struct ucc_fast_private * uccf, enum comm_dir mode);
209
210/* ucc_fast_disable
211 * Disables a fast UCC port.
212 * This routine disables Tx and/or Rx through the General UCC Mode Register.
213 *
214 * uccf - (In) pointer to the fast UCC structure.
215 * mode - (In) TX, RX, or both.
216 */
217void ucc_fast_disable(struct ucc_fast_private * uccf, enum comm_dir mode);
218
219/* ucc_fast_irq
220 * Handles interrupts on fast UCC.
221 * Called from the general interrupt routine to handle interrupts on fast UCC.
222 *
223 * uccf - (In) pointer to the fast UCC structure.
224 */
225void ucc_fast_irq(struct ucc_fast_private * uccf);
226
227/* ucc_fast_transmit_on_demand
228 * Immediately forces a poll of the transmitter for data to be sent.
229 * Typically, the hardware performs a periodic poll for data that the
230 * transmit routine has set up to be transmitted. In cases where
231 * this polling cycle is not soon enough, this optional routine can
232 * be invoked to force a poll right away, instead. Proper use for
233 * each transmission for which this functionality is desired is to
234 * call the transmit routine and then this routine right after.
235 *
236 * uccf - (In) pointer to the fast UCC structure.
237 */
238void ucc_fast_transmit_on_demand(struct ucc_fast_private * uccf);
239
240u32 ucc_fast_get_qe_cr_subblock(int uccf_num);
241
242void ucc_fast_dump_regs(struct ucc_fast_private * uccf);
243
244#endif /* __UCC_FAST_H__ */
diff --git a/arch/powerpc/include/asm/ucc_slow.h b/arch/powerpc/include/asm/ucc_slow.h
new file mode 100644
index 000000000000..0980e6ad335b
--- /dev/null
+++ b/arch/powerpc/include/asm/ucc_slow.h
@@ -0,0 +1,290 @@
1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com>
6 *
7 * Description:
8 * Internal header file for UCC SLOW unit routines.
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#ifndef __UCC_SLOW_H__
16#define __UCC_SLOW_H__
17
18#include <linux/kernel.h>
19
20#include <asm/immap_qe.h>
21#include <asm/qe.h>
22
23#include "ucc.h"
24
25/* transmit BD's status */
26#define T_R 0x80000000 /* ready bit */
27#define T_PAD 0x40000000 /* add pads to short frames */
28#define T_W 0x20000000 /* wrap bit */
29#define T_I 0x10000000 /* interrupt on completion */
30#define T_L 0x08000000 /* last */
31
32#define T_A 0x04000000 /* Address - the data transmitted as address
33 chars */
34#define T_TC 0x04000000 /* transmit CRC */
35#define T_CM 0x02000000 /* continuous mode */
36#define T_DEF 0x02000000 /* collision on previous attempt to transmit */
37#define T_P 0x01000000 /* Preamble - send Preamble sequence before
38 data */
39#define T_HB 0x01000000 /* heartbeat */
40#define T_NS 0x00800000 /* No Stop */
41#define T_LC 0x00800000 /* late collision */
42#define T_RL 0x00400000 /* retransmission limit */
43#define T_UN 0x00020000 /* underrun */
44#define T_CT 0x00010000 /* CTS lost */
45#define T_CSL 0x00010000 /* carrier sense lost */
46#define T_RC 0x003c0000 /* retry count */
47
48/* Receive BD's status */
49#define R_E 0x80000000 /* buffer empty */
50#define R_W 0x20000000 /* wrap bit */
51#define R_I 0x10000000 /* interrupt on reception */
52#define R_L 0x08000000 /* last */
53#define R_C 0x08000000 /* the last byte in this buffer is a cntl
54 char */
55#define R_F 0x04000000 /* first */
56#define R_A 0x04000000 /* the first byte in this buffer is address
57 byte */
58#define R_CM 0x02000000 /* continuous mode */
59#define R_ID 0x01000000 /* buffer close on reception of idles */
60#define R_M 0x01000000 /* Frame received because of promiscuous
61 mode */
62#define R_AM 0x00800000 /* Address match */
63#define R_DE 0x00800000 /* Address match */
64#define R_LG 0x00200000 /* Break received */
65#define R_BR 0x00200000 /* Frame length violation */
66#define R_NO 0x00100000 /* Rx Non Octet Aligned Packet */
67#define R_FR 0x00100000 /* Framing Error (no stop bit) character
68 received */
69#define R_PR 0x00080000 /* Parity Error character received */
70#define R_AB 0x00080000 /* Frame Aborted */
71#define R_SH 0x00080000 /* frame is too short */
72#define R_CR 0x00040000 /* CRC Error */
73#define R_OV 0x00020000 /* Overrun */
74#define R_CD 0x00010000 /* CD lost */
75#define R_CL 0x00010000 /* this frame is closed because of a
76 collision */
77
78/* Rx Data buffer must be 4 bytes aligned in most cases.*/
79#define UCC_SLOW_RX_ALIGN 4
80#define UCC_SLOW_MRBLR_ALIGNMENT 4
81#define UCC_SLOW_PRAM_SIZE 0x100
82#define ALIGNMENT_OF_UCC_SLOW_PRAM 64
83
84/* UCC Slow Channel Protocol Mode */
85enum ucc_slow_channel_protocol_mode {
86 UCC_SLOW_CHANNEL_PROTOCOL_MODE_QMC = 0x00000002,
87 UCC_SLOW_CHANNEL_PROTOCOL_MODE_UART = 0x00000004,
88 UCC_SLOW_CHANNEL_PROTOCOL_MODE_BISYNC = 0x00000008,
89};
90
91/* UCC Slow Transparent Transmit CRC (TCRC) */
92enum ucc_slow_transparent_tcrc {
93 /* 16-bit CCITT CRC (HDLC). (X16 + X12 + X5 + 1) */
94 UCC_SLOW_TRANSPARENT_TCRC_CCITT_CRC16 = 0x00000000,
95 /* CRC16 (BISYNC). (X16 + X15 + X2 + 1) */
96 UCC_SLOW_TRANSPARENT_TCRC_CRC16 = 0x00004000,
97 /* 32-bit CCITT CRC (Ethernet and HDLC) */
98 UCC_SLOW_TRANSPARENT_TCRC_CCITT_CRC32 = 0x00008000,
99};
100
101/* UCC Slow oversampling rate for transmitter (TDCR) */
102enum ucc_slow_tx_oversampling_rate {
103 /* 1x clock mode */
104 UCC_SLOW_OVERSAMPLING_RATE_TX_TDCR_1 = 0x00000000,
105 /* 8x clock mode */
106 UCC_SLOW_OVERSAMPLING_RATE_TX_TDCR_8 = 0x00010000,
107 /* 16x clock mode */
108 UCC_SLOW_OVERSAMPLING_RATE_TX_TDCR_16 = 0x00020000,
109 /* 32x clock mode */
110 UCC_SLOW_OVERSAMPLING_RATE_TX_TDCR_32 = 0x00030000,
111};
112
113/* UCC Slow Oversampling rate for receiver (RDCR)
114*/
115enum ucc_slow_rx_oversampling_rate {
116 /* 1x clock mode */
117 UCC_SLOW_OVERSAMPLING_RATE_RX_RDCR_1 = 0x00000000,
118 /* 8x clock mode */
119 UCC_SLOW_OVERSAMPLING_RATE_RX_RDCR_8 = 0x00004000,
120 /* 16x clock mode */
121 UCC_SLOW_OVERSAMPLING_RATE_RX_RDCR_16 = 0x00008000,
122 /* 32x clock mode */
123 UCC_SLOW_OVERSAMPLING_RATE_RX_RDCR_32 = 0x0000c000,
124};
125
126/* UCC Slow Transmitter encoding method (TENC)
127*/
128enum ucc_slow_tx_encoding_method {
129 UCC_SLOW_TRANSMITTER_ENCODING_METHOD_TENC_NRZ = 0x00000000,
130 UCC_SLOW_TRANSMITTER_ENCODING_METHOD_TENC_NRZI = 0x00000100
131};
132
133/* UCC Slow Receiver decoding method (RENC)
134*/
135enum ucc_slow_rx_decoding_method {
136 UCC_SLOW_RECEIVER_DECODING_METHOD_RENC_NRZ = 0x00000000,
137 UCC_SLOW_RECEIVER_DECODING_METHOD_RENC_NRZI = 0x00000800
138};
139
140/* UCC Slow Diagnostic mode (DIAG)
141*/
142enum ucc_slow_diag_mode {
143 UCC_SLOW_DIAG_MODE_NORMAL = 0x00000000,
144 UCC_SLOW_DIAG_MODE_LOOPBACK = 0x00000040,
145 UCC_SLOW_DIAG_MODE_ECHO = 0x00000080,
146 UCC_SLOW_DIAG_MODE_LOOPBACK_ECHO = 0x000000c0
147};
148
149struct ucc_slow_info {
150 int ucc_num;
151 int protocol; /* QE_CR_PROTOCOL_xxx */
152 enum qe_clock rx_clock;
153 enum qe_clock tx_clock;
154 phys_addr_t regs;
155 int irq;
156 u16 uccm_mask;
157 int data_mem_part;
158 int init_tx;
159 int init_rx;
160 u32 tx_bd_ring_len;
161 u32 rx_bd_ring_len;
162 int rx_interrupts;
163 int brkpt_support;
164 int grant_support;
165 int tsa;
166 int cdp;
167 int cds;
168 int ctsp;
169 int ctss;
170 int rinv;
171 int tinv;
172 int rtsm;
173 int rfw;
174 int tci;
175 int tend;
176 int tfl;
177 int txsy;
178 u16 max_rx_buf_length;
179 enum ucc_slow_transparent_tcrc tcrc;
180 enum ucc_slow_channel_protocol_mode mode;
181 enum ucc_slow_diag_mode diag;
182 enum ucc_slow_tx_oversampling_rate tdcr;
183 enum ucc_slow_rx_oversampling_rate rdcr;
184 enum ucc_slow_tx_encoding_method tenc;
185 enum ucc_slow_rx_decoding_method renc;
186};
187
188struct ucc_slow_private {
189 struct ucc_slow_info *us_info;
190 struct ucc_slow __iomem *us_regs; /* Ptr to memory map of UCC regs */
191 struct ucc_slow_pram *us_pram; /* a pointer to the parameter RAM */
192 u32 us_pram_offset;
193 int enabled_tx; /* Whether channel is enabled for Tx (ENT) */
194 int enabled_rx; /* Whether channel is enabled for Rx (ENR) */
195 int stopped_tx; /* Whether channel has been stopped for Tx
196 (STOP_TX, etc.) */
197 int stopped_rx; /* Whether channel has been stopped for Rx */
198 struct list_head confQ; /* frames passed to chip waiting for tx */
199 u32 first_tx_bd_mask; /* mask is used in Tx routine to save status
200 and length for first BD in a frame */
201 u32 tx_base_offset; /* first BD in Tx BD table offset (In MURAM) */
202 u32 rx_base_offset; /* first BD in Rx BD table offset (In MURAM) */
203 struct qe_bd *confBd; /* next BD for confirm after Tx */
204 struct qe_bd *tx_bd; /* next BD for new Tx request */
205 struct qe_bd *rx_bd; /* next BD to collect after Rx */
206 void *p_rx_frame; /* accumulating receive frame */
207 u16 *p_ucce; /* a pointer to the event register in memory.
208 */
209 u16 *p_uccm; /* a pointer to the mask register in memory */
210 u16 saved_uccm; /* a saved mask for the RX Interrupt bits */
211#ifdef STATISTICS
212 u32 tx_frames; /* Transmitted frames counters */
213 u32 rx_frames; /* Received frames counters (only frames
214 passed to application) */
215 u32 rx_discarded; /* Discarded frames counters (frames that
216 were discarded by the driver due to
217 errors) */
218#endif /* STATISTICS */
219};
220
221/* ucc_slow_init
222 * Initializes Slow UCC according to provided parameters.
223 *
224 * us_info - (In) pointer to the slow UCC info structure.
225 * uccs_ret - (Out) pointer to the slow UCC structure.
226 */
227int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccs_ret);
228
229/* ucc_slow_free
230 * Frees all resources for slow UCC.
231 *
232 * uccs - (In) pointer to the slow UCC structure.
233 */
234void ucc_slow_free(struct ucc_slow_private * uccs);
235
236/* ucc_slow_enable
237 * Enables a fast UCC port.
238 * This routine enables Tx and/or Rx through the General UCC Mode Register.
239 *
240 * uccs - (In) pointer to the slow UCC structure.
241 * mode - (In) TX, RX, or both.
242 */
243void ucc_slow_enable(struct ucc_slow_private * uccs, enum comm_dir mode);
244
245/* ucc_slow_disable
246 * Disables a fast UCC port.
247 * This routine disables Tx and/or Rx through the General UCC Mode Register.
248 *
249 * uccs - (In) pointer to the slow UCC structure.
250 * mode - (In) TX, RX, or both.
251 */
252void ucc_slow_disable(struct ucc_slow_private * uccs, enum comm_dir mode);
253
254/* ucc_slow_poll_transmitter_now
255 * Immediately forces a poll of the transmitter for data to be sent.
256 * Typically, the hardware performs a periodic poll for data that the
257 * transmit routine has set up to be transmitted. In cases where
258 * this polling cycle is not soon enough, this optional routine can
259 * be invoked to force a poll right away, instead. Proper use for
260 * each transmission for which this functionality is desired is to
261 * call the transmit routine and then this routine right after.
262 *
263 * uccs - (In) pointer to the slow UCC structure.
264 */
265void ucc_slow_poll_transmitter_now(struct ucc_slow_private * uccs);
266
267/* ucc_slow_graceful_stop_tx
268 * Smoothly stops transmission on a specified slow UCC.
269 *
270 * uccs - (In) pointer to the slow UCC structure.
271 */
272void ucc_slow_graceful_stop_tx(struct ucc_slow_private * uccs);
273
274/* ucc_slow_stop_tx
275 * Stops transmission on a specified slow UCC.
276 *
277 * uccs - (In) pointer to the slow UCC structure.
278 */
279void ucc_slow_stop_tx(struct ucc_slow_private * uccs);
280
281/* ucc_slow_restart_tx
282 * Restarts transmitting on a specified slow UCC.
283 *
284 * uccs - (In) pointer to the slow UCC structure.
285 */
286void ucc_slow_restart_tx(struct ucc_slow_private *uccs);
287
288u32 ucc_slow_get_qe_cr_subblock(int uccs_num);
289
290#endif /* __UCC_SLOW_H__ */
diff --git a/arch/powerpc/include/asm/ucontext.h b/arch/powerpc/include/asm/ucontext.h
new file mode 100644
index 000000000000..d9a4ddf0cc86
--- /dev/null
+++ b/arch/powerpc/include/asm/ucontext.h
@@ -0,0 +1,40 @@
1#ifndef _ASM_POWERPC_UCONTEXT_H
2#define _ASM_POWERPC_UCONTEXT_H
3
4#ifdef __powerpc64__
5#include <asm/sigcontext.h>
6#else
7#include <asm/elf.h>
8#endif
9#include <asm/signal.h>
10
11#ifndef __powerpc64__
12struct mcontext {
13 elf_gregset_t mc_gregs;
14 elf_fpregset_t mc_fregs;
15 unsigned long mc_pad[2];
16 elf_vrregset_t mc_vregs __attribute__((__aligned__(16)));
17};
18#endif
19
20struct ucontext {
21 unsigned long uc_flags;
22 struct ucontext __user *uc_link;
23 stack_t uc_stack;
24#ifndef __powerpc64__
25 int uc_pad[7];
26 struct mcontext __user *uc_regs;/* points to uc_mcontext field */
27#endif
28 sigset_t uc_sigmask;
29 /* glibc has 1024-bit signal masks, ours are 64-bit */
30#ifdef __powerpc64__
31 sigset_t __unused[15]; /* Allow for uc_sigmask growth */
32 struct sigcontext uc_mcontext; /* last for extensibility */
33#else
34 int uc_maskext[30];
35 int uc_pad2[3];
36 struct mcontext uc_mcontext;
37#endif
38};
39
40#endif /* _ASM_POWERPC_UCONTEXT_H */
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
new file mode 100644
index 000000000000..6418ceea44b7
--- /dev/null
+++ b/arch/powerpc/include/asm/udbg.h
@@ -0,0 +1,55 @@
1/*
2 * (c) 2001, 2006 IBM Corporation.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#ifndef _ASM_POWERPC_UDBG_H
11#define _ASM_POWERPC_UDBG_H
12#ifdef __KERNEL__
13
14#include <linux/compiler.h>
15#include <linux/init.h>
16
17extern void (*udbg_putc)(char c);
18extern int (*udbg_getc)(void);
19extern int (*udbg_getc_poll)(void);
20
21extern void udbg_puts(const char *s);
22extern int udbg_write(const char *s, int n);
23extern int udbg_read(char *buf, int buflen);
24
25extern void register_early_udbg_console(void);
26extern void udbg_printf(const char *fmt, ...)
27 __attribute__ ((format (printf, 1, 2)));
28extern void udbg_progress(char *s, unsigned short hex);
29
30extern void udbg_init_uart(void __iomem *comport, unsigned int speed,
31 unsigned int clock);
32extern unsigned int udbg_probe_uart_speed(void __iomem *comport,
33 unsigned int clock);
34
35struct device_node;
36extern void udbg_scc_init(int force_scc);
37extern int udbg_adb_init(int force_btext);
38extern void udbg_adb_init_early(void);
39
40extern void __init udbg_early_init(void);
41extern void __init udbg_init_debug_lpar(void);
42extern void __init udbg_init_pmac_realmode(void);
43extern void __init udbg_init_maple_realmode(void);
44extern void __init udbg_init_pas_realmode(void);
45extern void __init udbg_init_iseries(void);
46extern void __init udbg_init_rtas_panel(void);
47extern void __init udbg_init_rtas_console(void);
48extern void __init udbg_init_debug_beat(void);
49extern void __init udbg_init_btext(void);
50extern void __init udbg_init_44x_as1(void);
51extern void __init udbg_init_40x_realmode(void);
52extern void __init udbg_init_cpm(void);
53
54#endif /* __KERNEL__ */
55#endif /* _ASM_POWERPC_UDBG_H */
diff --git a/arch/powerpc/include/asm/uic.h b/arch/powerpc/include/asm/uic.h
new file mode 100644
index 000000000000..597edfcae3d6
--- /dev/null
+++ b/arch/powerpc/include/asm/uic.h
@@ -0,0 +1,21 @@
1/*
2 * IBM PPC4xx UIC external definitions and structure.
3 *
4 * Maintainer: David Gibson <dwg@au1.ibm.com>
5 * Copyright 2007 IBM Corporation.
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#ifndef _ASM_POWERPC_UIC_H
13#define _ASM_POWERPC_UIC_H
14
15#ifdef __KERNEL__
16
17extern void __init uic_init_tree(void);
18extern unsigned int uic_get_irq(void);
19
20#endif /* __KERNEL__ */
21#endif /* _ASM_POWERPC_UIC_H */
diff --git a/arch/powerpc/include/asm/unaligned.h b/arch/powerpc/include/asm/unaligned.h
new file mode 100644
index 000000000000..5f1b1e3c2137
--- /dev/null
+++ b/arch/powerpc/include/asm/unaligned.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_POWERPC_UNALIGNED_H
2#define _ASM_POWERPC_UNALIGNED_H
3
4#ifdef __KERNEL__
5
6/*
7 * The PowerPC can do unaligned accesses itself in big endian mode.
8 */
9#include <linux/unaligned/access_ok.h>
10#include <linux/unaligned/generic.h>
11
12#define get_unaligned __get_unaligned_be
13#define put_unaligned __put_unaligned_be
14
15#endif /* __KERNEL__ */
16#endif /* _ASM_POWERPC_UNALIGNED_H */
diff --git a/arch/powerpc/include/asm/uninorth.h b/arch/powerpc/include/asm/uninorth.h
new file mode 100644
index 000000000000..f737732c3861
--- /dev/null
+++ b/arch/powerpc/include/asm/uninorth.h
@@ -0,0 +1,229 @@
1/*
2 * uninorth.h: definitions for using the "UniNorth" host bridge chip
3 * from Apple. This chip is used on "Core99" machines
4 * This also includes U2 used on more recent MacRISC2/3
5 * machines and U3 (G5)
6 *
7 */
8#ifdef __KERNEL__
9#ifndef __ASM_UNINORTH_H__
10#define __ASM_UNINORTH_H__
11
12/*
13 * Uni-N and U3 config space reg. definitions
14 *
15 * (Little endian)
16 */
17
18/* Address ranges selection. This one should work with Bandit too */
19/* Not U3 */
20#define UNI_N_ADDR_SELECT 0x48
21#define UNI_N_ADDR_COARSE_MASK 0xffff0000 /* 256Mb regions at *0000000 */
22#define UNI_N_ADDR_FINE_MASK 0x0000ffff /* 16Mb regions at f*000000 */
23
24/* AGP registers */
25/* Not U3 */
26#define UNI_N_CFG_GART_BASE 0x8c
27#define UNI_N_CFG_AGP_BASE 0x90
28#define UNI_N_CFG_GART_CTRL 0x94
29#define UNI_N_CFG_INTERNAL_STATUS 0x98
30#define UNI_N_CFG_GART_DUMMY_PAGE 0xa4
31
32/* UNI_N_CFG_GART_CTRL bits definitions */
33#define UNI_N_CFG_GART_INVAL 0x00000001
34#define UNI_N_CFG_GART_ENABLE 0x00000100
35#define UNI_N_CFG_GART_2xRESET 0x00010000
36#define UNI_N_CFG_GART_DISSBADET 0x00020000
37/* The following seems to only be used only on U3 <j.glisse@gmail.com> */
38#define U3_N_CFG_GART_SYNCMODE 0x00040000
39#define U3_N_CFG_GART_PERFRD 0x00080000
40#define U3_N_CFG_GART_B2BGNT 0x00200000
41#define U3_N_CFG_GART_FASTDDR 0x00400000
42
43/* My understanding of UniNorth AGP as of UniNorth rev 1.0x,
44 * revision 1.5 (x4 AGP) may need further changes.
45 *
46 * AGP_BASE register contains the base address of the AGP aperture on
47 * the AGP bus. It doesn't seem to be visible to the CPU as of UniNorth 1.x,
48 * even if decoding of this address range is enabled in the address select
49 * register. Apparently, the only supported bases are 256Mb multiples
50 * (high 4 bits of that register).
51 *
52 * GART_BASE register appear to contain the physical address of the GART
53 * in system memory in the high address bits (page aligned), and the
54 * GART size in the low order bits (number of GART pages)
55 *
56 * The GART format itself is one 32bits word per physical memory page.
57 * This word contains, in little-endian format (!!!), the physical address
58 * of the page in the high bits, and what appears to be an "enable" bit
59 * in the LSB bit (0) that must be set to 1 when the entry is valid.
60 *
61 * Obviously, the GART is not cache coherent and so any change to it
62 * must be flushed to memory (or maybe just make the GART space non
63 * cachable). AGP memory itself doens't seem to be cache coherent neither.
64 *
65 * In order to invalidate the GART (which is probably necessary to inval
66 * the bridge internal TLBs), the following sequence has to be written,
67 * in order, to the GART_CTRL register:
68 *
69 * UNI_N_CFG_GART_ENABLE | UNI_N_CFG_GART_INVAL
70 * UNI_N_CFG_GART_ENABLE
71 * UNI_N_CFG_GART_ENABLE | UNI_N_CFG_GART_2xRESET
72 * UNI_N_CFG_GART_ENABLE
73 *
74 * As far as AGP "features" are concerned, it looks like fast write may
75 * not be supported but this has to be confirmed.
76 *
77 * Turning on AGP seem to require a double invalidate operation, one before
78 * setting the AGP command register, on after.
79 *
80 * Turning off AGP seems to require the following sequence: first wait
81 * for the AGP to be idle by reading the internal status register, then
82 * write in that order to the GART_CTRL register:
83 *
84 * UNI_N_CFG_GART_ENABLE | UNI_N_CFG_GART_INVAL
85 * 0
86 * UNI_N_CFG_GART_2xRESET
87 * 0
88 */
89
90/*
91 * Uni-N memory mapped reg. definitions
92 *
93 * Those registers are Big-Endian !!
94 *
95 * Their meaning come from either Darwin and/or from experiments I made with
96 * the bootrom, I'm not sure about their exact meaning yet
97 *
98 */
99
100/* Version of the UniNorth chip */
101#define UNI_N_VERSION 0x0000 /* Known versions: 3,7 and 8 */
102
103#define UNI_N_VERSION_107 0x0003 /* 1.0.7 */
104#define UNI_N_VERSION_10A 0x0007 /* 1.0.10 */
105#define UNI_N_VERSION_150 0x0011 /* 1.5 */
106#define UNI_N_VERSION_200 0x0024 /* 2.0 */
107#define UNI_N_VERSION_PANGEA 0x00C0 /* Integrated U1 + K */
108#define UNI_N_VERSION_INTREPID 0x00D2 /* Integrated U2 + K */
109#define UNI_N_VERSION_300 0x0030 /* 3.0 (U3 on G5) */
110
111/* This register is used to enable/disable various clocks */
112#define UNI_N_CLOCK_CNTL 0x0020
113#define UNI_N_CLOCK_CNTL_PCI 0x00000001 /* PCI2 clock control */
114#define UNI_N_CLOCK_CNTL_GMAC 0x00000002 /* GMAC clock control */
115#define UNI_N_CLOCK_CNTL_FW 0x00000004 /* FireWire clock control */
116#define UNI_N_CLOCK_CNTL_ATA100 0x00000010 /* ATA-100 clock control (U2) */
117
118/* Power Management control */
119#define UNI_N_POWER_MGT 0x0030
120#define UNI_N_POWER_MGT_NORMAL 0x00
121#define UNI_N_POWER_MGT_IDLE2 0x01
122#define UNI_N_POWER_MGT_SLEEP 0x02
123
124/* This register is configured by Darwin depending on the UniN
125 * revision
126 */
127#define UNI_N_ARB_CTRL 0x0040
128#define UNI_N_ARB_CTRL_QACK_DELAY_SHIFT 15
129#define UNI_N_ARB_CTRL_QACK_DELAY_MASK 0x0e1f8000
130#define UNI_N_ARB_CTRL_QACK_DELAY 0x30
131#define UNI_N_ARB_CTRL_QACK_DELAY105 0x00
132
133/* This one _might_ return the CPU number of the CPU reading it;
134 * the bootROM decides whether to boot or to sleep/spinloop depending
135 * on this register beeing 0 or not
136 */
137#define UNI_N_CPU_NUMBER 0x0050
138
139/* This register appear to be read by the bootROM to decide what
140 * to do on a non-recoverable reset (powerup or wakeup)
141 */
142#define UNI_N_HWINIT_STATE 0x0070
143#define UNI_N_HWINIT_STATE_SLEEPING 0x01
144#define UNI_N_HWINIT_STATE_RUNNING 0x02
145/* This last bit appear to be used by the bootROM to know the second
146 * CPU has started and will enter it's sleep loop with IP=0
147 */
148#define UNI_N_HWINIT_STATE_CPU1_FLAG 0x10000000
149
150/* This register controls AACK delay, which is set when 2004 iBook/PowerBook
151 * is in low speed mode.
152 */
153#define UNI_N_AACK_DELAY 0x0100
154#define UNI_N_AACK_DELAY_ENABLE 0x00000001
155
156/* Clock status for Intrepid */
157#define UNI_N_CLOCK_STOP_STATUS0 0x0150
158#define UNI_N_CLOCK_STOPPED_EXTAGP 0x00200000
159#define UNI_N_CLOCK_STOPPED_AGPDEL 0x00100000
160#define UNI_N_CLOCK_STOPPED_I2S0_45_49 0x00080000
161#define UNI_N_CLOCK_STOPPED_I2S0_18 0x00040000
162#define UNI_N_CLOCK_STOPPED_I2S1_45_49 0x00020000
163#define UNI_N_CLOCK_STOPPED_I2S1_18 0x00010000
164#define UNI_N_CLOCK_STOPPED_TIMER 0x00008000
165#define UNI_N_CLOCK_STOPPED_SCC_RTCLK18 0x00004000
166#define UNI_N_CLOCK_STOPPED_SCC_RTCLK32 0x00002000
167#define UNI_N_CLOCK_STOPPED_SCC_VIA32 0x00001000
168#define UNI_N_CLOCK_STOPPED_SCC_SLOT0 0x00000800
169#define UNI_N_CLOCK_STOPPED_SCC_SLOT1 0x00000400
170#define UNI_N_CLOCK_STOPPED_SCC_SLOT2 0x00000200
171#define UNI_N_CLOCK_STOPPED_PCI_FBCLKO 0x00000100
172#define UNI_N_CLOCK_STOPPED_VEO0 0x00000080
173#define UNI_N_CLOCK_STOPPED_VEO1 0x00000040
174#define UNI_N_CLOCK_STOPPED_USB0 0x00000020
175#define UNI_N_CLOCK_STOPPED_USB1 0x00000010
176#define UNI_N_CLOCK_STOPPED_USB2 0x00000008
177#define UNI_N_CLOCK_STOPPED_32 0x00000004
178#define UNI_N_CLOCK_STOPPED_45 0x00000002
179#define UNI_N_CLOCK_STOPPED_49 0x00000001
180
181#define UNI_N_CLOCK_STOP_STATUS1 0x0160
182#define UNI_N_CLOCK_STOPPED_PLL4REF 0x00080000
183#define UNI_N_CLOCK_STOPPED_CPUDEL 0x00040000
184#define UNI_N_CLOCK_STOPPED_CPU 0x00020000
185#define UNI_N_CLOCK_STOPPED_BUF_REFCKO 0x00010000
186#define UNI_N_CLOCK_STOPPED_PCI2 0x00008000
187#define UNI_N_CLOCK_STOPPED_FW 0x00004000
188#define UNI_N_CLOCK_STOPPED_GB 0x00002000
189#define UNI_N_CLOCK_STOPPED_ATA66 0x00001000
190#define UNI_N_CLOCK_STOPPED_ATA100 0x00000800
191#define UNI_N_CLOCK_STOPPED_MAX 0x00000400
192#define UNI_N_CLOCK_STOPPED_PCI1 0x00000200
193#define UNI_N_CLOCK_STOPPED_KLPCI 0x00000100
194#define UNI_N_CLOCK_STOPPED_USB0PCI 0x00000080
195#define UNI_N_CLOCK_STOPPED_USB1PCI 0x00000040
196#define UNI_N_CLOCK_STOPPED_USB2PCI 0x00000020
197#define UNI_N_CLOCK_STOPPED_7PCI1 0x00000008
198#define UNI_N_CLOCK_STOPPED_AGP 0x00000004
199#define UNI_N_CLOCK_STOPPED_PCI0 0x00000002
200#define UNI_N_CLOCK_STOPPED_18 0x00000001
201
202/* Intrepid registe to OF do-platform-clockspreading */
203#define UNI_N_CLOCK_SPREADING 0x190
204
205/* Uninorth 1.5 rev. has additional perf. monitor registers at 0xf00-0xf50 */
206
207
208/*
209 * U3 specific registers
210 */
211
212
213/* U3 Toggle */
214#define U3_TOGGLE_REG 0x00e0
215#define U3_PMC_START_STOP 0x0001
216#define U3_MPIC_RESET 0x0002
217#define U3_MPIC_OUTPUT_ENABLE 0x0004
218
219/* U3 API PHY Config 1 */
220#define U3_API_PHY_CONFIG_1 0x23030
221
222/* U3 HyperTransport registers */
223#define U3_HT_CONFIG_BASE 0x70000
224#define U3_HT_LINK_COMMAND 0x100
225#define U3_HT_LINK_CONFIG 0x110
226#define U3_HT_LINK_FREQ 0x120
227
228#endif /* __ASM_UNINORTH_H__ */
229#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
new file mode 100644
index 000000000000..e07d0c76ed77
--- /dev/null
+++ b/arch/powerpc/include/asm/unistd.h
@@ -0,0 +1,398 @@
1#ifndef _ASM_POWERPC_UNISTD_H_
2#define _ASM_POWERPC_UNISTD_H_
3
4/*
5 * This file contains the system call numbers.
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#define __NR_restart_syscall 0
14#define __NR_exit 1
15#define __NR_fork 2
16#define __NR_read 3
17#define __NR_write 4
18#define __NR_open 5
19#define __NR_close 6
20#define __NR_waitpid 7
21#define __NR_creat 8
22#define __NR_link 9
23#define __NR_unlink 10
24#define __NR_execve 11
25#define __NR_chdir 12
26#define __NR_time 13
27#define __NR_mknod 14
28#define __NR_chmod 15
29#define __NR_lchown 16
30#define __NR_break 17
31#define __NR_oldstat 18
32#define __NR_lseek 19
33#define __NR_getpid 20
34#define __NR_mount 21
35#define __NR_umount 22
36#define __NR_setuid 23
37#define __NR_getuid 24
38#define __NR_stime 25
39#define __NR_ptrace 26
40#define __NR_alarm 27
41#define __NR_oldfstat 28
42#define __NR_pause 29
43#define __NR_utime 30
44#define __NR_stty 31
45#define __NR_gtty 32
46#define __NR_access 33
47#define __NR_nice 34
48#define __NR_ftime 35
49#define __NR_sync 36
50#define __NR_kill 37
51#define __NR_rename 38
52#define __NR_mkdir 39
53#define __NR_rmdir 40
54#define __NR_dup 41
55#define __NR_pipe 42
56#define __NR_times 43
57#define __NR_prof 44
58#define __NR_brk 45
59#define __NR_setgid 46
60#define __NR_getgid 47
61#define __NR_signal 48
62#define __NR_geteuid 49
63#define __NR_getegid 50
64#define __NR_acct 51
65#define __NR_umount2 52
66#define __NR_lock 53
67#define __NR_ioctl 54
68#define __NR_fcntl 55
69#define __NR_mpx 56
70#define __NR_setpgid 57
71#define __NR_ulimit 58
72#define __NR_oldolduname 59
73#define __NR_umask 60
74#define __NR_chroot 61
75#define __NR_ustat 62
76#define __NR_dup2 63
77#define __NR_getppid 64
78#define __NR_getpgrp 65
79#define __NR_setsid 66
80#define __NR_sigaction 67
81#define __NR_sgetmask 68
82#define __NR_ssetmask 69
83#define __NR_setreuid 70
84#define __NR_setregid 71
85#define __NR_sigsuspend 72
86#define __NR_sigpending 73
87#define __NR_sethostname 74
88#define __NR_setrlimit 75
89#define __NR_getrlimit 76
90#define __NR_getrusage 77
91#define __NR_gettimeofday 78
92#define __NR_settimeofday 79
93#define __NR_getgroups 80
94#define __NR_setgroups 81
95#define __NR_select 82
96#define __NR_symlink 83
97#define __NR_oldlstat 84
98#define __NR_readlink 85
99#define __NR_uselib 86
100#define __NR_swapon 87
101#define __NR_reboot 88
102#define __NR_readdir 89
103#define __NR_mmap 90
104#define __NR_munmap 91
105#define __NR_truncate 92
106#define __NR_ftruncate 93
107#define __NR_fchmod 94
108#define __NR_fchown 95
109#define __NR_getpriority 96
110#define __NR_setpriority 97
111#define __NR_profil 98
112#define __NR_statfs 99
113#define __NR_fstatfs 100
114#define __NR_ioperm 101
115#define __NR_socketcall 102
116#define __NR_syslog 103
117#define __NR_setitimer 104
118#define __NR_getitimer 105
119#define __NR_stat 106
120#define __NR_lstat 107
121#define __NR_fstat 108
122#define __NR_olduname 109
123#define __NR_iopl 110
124#define __NR_vhangup 111
125#define __NR_idle 112
126#define __NR_vm86 113
127#define __NR_wait4 114
128#define __NR_swapoff 115
129#define __NR_sysinfo 116
130#define __NR_ipc 117
131#define __NR_fsync 118
132#define __NR_sigreturn 119
133#define __NR_clone 120
134#define __NR_setdomainname 121
135#define __NR_uname 122
136#define __NR_modify_ldt 123
137#define __NR_adjtimex 124
138#define __NR_mprotect 125
139#define __NR_sigprocmask 126
140#define __NR_create_module 127
141#define __NR_init_module 128
142#define __NR_delete_module 129
143#define __NR_get_kernel_syms 130
144#define __NR_quotactl 131
145#define __NR_getpgid 132
146#define __NR_fchdir 133
147#define __NR_bdflush 134
148#define __NR_sysfs 135
149#define __NR_personality 136
150#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
151#define __NR_setfsuid 138
152#define __NR_setfsgid 139
153#define __NR__llseek 140
154#define __NR_getdents 141
155#define __NR__newselect 142
156#define __NR_flock 143
157#define __NR_msync 144
158#define __NR_readv 145
159#define __NR_writev 146
160#define __NR_getsid 147
161#define __NR_fdatasync 148
162#define __NR__sysctl 149
163#define __NR_mlock 150
164#define __NR_munlock 151
165#define __NR_mlockall 152
166#define __NR_munlockall 153
167#define __NR_sched_setparam 154
168#define __NR_sched_getparam 155
169#define __NR_sched_setscheduler 156
170#define __NR_sched_getscheduler 157
171#define __NR_sched_yield 158
172#define __NR_sched_get_priority_max 159
173#define __NR_sched_get_priority_min 160
174#define __NR_sched_rr_get_interval 161
175#define __NR_nanosleep 162
176#define __NR_mremap 163
177#define __NR_setresuid 164
178#define __NR_getresuid 165
179#define __NR_query_module 166
180#define __NR_poll 167
181#define __NR_nfsservctl 168
182#define __NR_setresgid 169
183#define __NR_getresgid 170
184#define __NR_prctl 171
185#define __NR_rt_sigreturn 172
186#define __NR_rt_sigaction 173
187#define __NR_rt_sigprocmask 174
188#define __NR_rt_sigpending 175
189#define __NR_rt_sigtimedwait 176
190#define __NR_rt_sigqueueinfo 177
191#define __NR_rt_sigsuspend 178
192#define __NR_pread64 179
193#define __NR_pwrite64 180
194#define __NR_chown 181
195#define __NR_getcwd 182
196#define __NR_capget 183
197#define __NR_capset 184
198#define __NR_sigaltstack 185
199#define __NR_sendfile 186
200#define __NR_getpmsg 187 /* some people actually want streams */
201#define __NR_putpmsg 188 /* some people actually want streams */
202#define __NR_vfork 189
203#define __NR_ugetrlimit 190 /* SuS compliant getrlimit */
204#define __NR_readahead 191
205#ifndef __powerpc64__ /* these are 32-bit only */
206#define __NR_mmap2 192
207#define __NR_truncate64 193
208#define __NR_ftruncate64 194
209#define __NR_stat64 195
210#define __NR_lstat64 196
211#define __NR_fstat64 197
212#endif
213#define __NR_pciconfig_read 198
214#define __NR_pciconfig_write 199
215#define __NR_pciconfig_iobase 200
216#define __NR_multiplexer 201
217#define __NR_getdents64 202
218#define __NR_pivot_root 203
219#ifndef __powerpc64__
220#define __NR_fcntl64 204
221#endif
222#define __NR_madvise 205
223#define __NR_mincore 206
224#define __NR_gettid 207
225#define __NR_tkill 208
226#define __NR_setxattr 209
227#define __NR_lsetxattr 210
228#define __NR_fsetxattr 211
229#define __NR_getxattr 212
230#define __NR_lgetxattr 213
231#define __NR_fgetxattr 214
232#define __NR_listxattr 215
233#define __NR_llistxattr 216
234#define __NR_flistxattr 217
235#define __NR_removexattr 218
236#define __NR_lremovexattr 219
237#define __NR_fremovexattr 220
238#define __NR_futex 221
239#define __NR_sched_setaffinity 222
240#define __NR_sched_getaffinity 223
241/* 224 currently unused */
242#define __NR_tuxcall 225
243#ifndef __powerpc64__
244#define __NR_sendfile64 226
245#endif
246#define __NR_io_setup 227
247#define __NR_io_destroy 228
248#define __NR_io_getevents 229
249#define __NR_io_submit 230
250#define __NR_io_cancel 231
251#define __NR_set_tid_address 232
252#define __NR_fadvise64 233
253#define __NR_exit_group 234
254#define __NR_lookup_dcookie 235
255#define __NR_epoll_create 236
256#define __NR_epoll_ctl 237
257#define __NR_epoll_wait 238
258#define __NR_remap_file_pages 239
259#define __NR_timer_create 240
260#define __NR_timer_settime 241
261#define __NR_timer_gettime 242
262#define __NR_timer_getoverrun 243
263#define __NR_timer_delete 244
264#define __NR_clock_settime 245
265#define __NR_clock_gettime 246
266#define __NR_clock_getres 247
267#define __NR_clock_nanosleep 248
268#define __NR_swapcontext 249
269#define __NR_tgkill 250
270#define __NR_utimes 251
271#define __NR_statfs64 252
272#define __NR_fstatfs64 253
273#ifndef __powerpc64__
274#define __NR_fadvise64_64 254
275#endif
276#define __NR_rtas 255
277#define __NR_sys_debug_setcontext 256
278/* Number 257 is reserved for vserver */
279#define __NR_migrate_pages 258
280#define __NR_mbind 259
281#define __NR_get_mempolicy 260
282#define __NR_set_mempolicy 261
283#define __NR_mq_open 262
284#define __NR_mq_unlink 263
285#define __NR_mq_timedsend 264
286#define __NR_mq_timedreceive 265
287#define __NR_mq_notify 266
288#define __NR_mq_getsetattr 267
289#define __NR_kexec_load 268
290#define __NR_add_key 269
291#define __NR_request_key 270
292#define __NR_keyctl 271
293#define __NR_waitid 272
294#define __NR_ioprio_set 273
295#define __NR_ioprio_get 274
296#define __NR_inotify_init 275
297#define __NR_inotify_add_watch 276
298#define __NR_inotify_rm_watch 277
299#define __NR_spu_run 278
300#define __NR_spu_create 279
301#define __NR_pselect6 280
302#define __NR_ppoll 281
303#define __NR_unshare 282
304#define __NR_splice 283
305#define __NR_tee 284
306#define __NR_vmsplice 285
307#define __NR_openat 286
308#define __NR_mkdirat 287
309#define __NR_mknodat 288
310#define __NR_fchownat 289
311#define __NR_futimesat 290
312#ifdef __powerpc64__
313#define __NR_newfstatat 291
314#else
315#define __NR_fstatat64 291
316#endif
317#define __NR_unlinkat 292
318#define __NR_renameat 293
319#define __NR_linkat 294
320#define __NR_symlinkat 295
321#define __NR_readlinkat 296
322#define __NR_fchmodat 297
323#define __NR_faccessat 298
324#define __NR_get_robust_list 299
325#define __NR_set_robust_list 300
326#define __NR_move_pages 301
327#define __NR_getcpu 302
328#define __NR_epoll_pwait 303
329#define __NR_utimensat 304
330#define __NR_signalfd 305
331#define __NR_timerfd_create 306
332#define __NR_eventfd 307
333#define __NR_sync_file_range2 308
334#define __NR_fallocate 309
335#define __NR_subpage_prot 310
336#define __NR_timerfd_settime 311
337#define __NR_timerfd_gettime 312
338#define __NR_signalfd4 313
339#define __NR_eventfd2 314
340#define __NR_epoll_create1 315
341#define __NR_dup3 316
342#define __NR_pipe2 317
343#define __NR_inotify_init1 318
344
345#ifdef __KERNEL__
346
347#define __NR_syscalls 319
348
349#define __NR__exit __NR_exit
350#define NR_syscalls __NR_syscalls
351
352#ifndef __ASSEMBLY__
353
354#include <linux/types.h>
355#include <linux/compiler.h>
356#include <linux/linkage.h>
357
358#define __ARCH_WANT_IPC_PARSE_VERSION
359#define __ARCH_WANT_OLD_READDIR
360#define __ARCH_WANT_STAT64
361#define __ARCH_WANT_SYS_ALARM
362#define __ARCH_WANT_SYS_GETHOSTNAME
363#define __ARCH_WANT_SYS_PAUSE
364#define __ARCH_WANT_SYS_SGETMASK
365#define __ARCH_WANT_SYS_SIGNAL
366#define __ARCH_WANT_SYS_TIME
367#define __ARCH_WANT_SYS_UTIME
368#define __ARCH_WANT_SYS_WAITPID
369#define __ARCH_WANT_SYS_SOCKETCALL
370#define __ARCH_WANT_SYS_FADVISE64
371#define __ARCH_WANT_SYS_GETPGRP
372#define __ARCH_WANT_SYS_LLSEEK
373#define __ARCH_WANT_SYS_NICE
374#define __ARCH_WANT_SYS_OLD_GETRLIMIT
375#define __ARCH_WANT_SYS_OLDUMOUNT
376#define __ARCH_WANT_SYS_SIGPENDING
377#define __ARCH_WANT_SYS_SIGPROCMASK
378#define __ARCH_WANT_SYS_RT_SIGACTION
379#define __ARCH_WANT_SYS_RT_SIGSUSPEND
380#ifdef CONFIG_PPC32
381#define __ARCH_WANT_OLD_STAT
382#endif
383#ifdef CONFIG_PPC64
384#define __ARCH_WANT_COMPAT_SYS_TIME
385#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
386#define __ARCH_WANT_SYS_NEWFSTATAT
387#endif
388
389/*
390 * "Conditional" syscalls
391 */
392#define cond_syscall(x) \
393 asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
394
395#endif /* __ASSEMBLY__ */
396#endif /* __KERNEL__ */
397
398#endif /* _ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/include/asm/user.h b/arch/powerpc/include/asm/user.h
new file mode 100644
index 000000000000..3fd4545dd74e
--- /dev/null
+++ b/arch/powerpc/include/asm/user.h
@@ -0,0 +1,51 @@
1#ifndef _ASM_POWERPC_USER_H
2#define _ASM_POWERPC_USER_H
3
4#include <asm/ptrace.h>
5#include <asm/page.h>
6
7/*
8 * Adapted from <asm-alpha/user.h>
9 *
10 * Core file format: The core file is written in such a way that gdb
11 * can understand it and provide useful information to the user (under
12 * linux we use the `trad-core' bfd, NOT the osf-core). The file contents
13 * are as follows:
14 *
15 * upage: 1 page consisting of a user struct that tells gdb
16 * what is present in the file. Directly after this is a
17 * copy of the task_struct, which is currently not used by gdb,
18 * but it may come in handy at some point. All of the registers
19 * are stored as part of the upage. The upage should always be
20 * only one page long.
21 * data: The data segment follows next. We use current->end_text to
22 * current->brk to pick up all of the user variables, plus any memory
23 * that may have been sbrk'ed. No attempt is made to determine if a
24 * page is demand-zero or if a page is totally unused, we just cover
25 * the entire range. All of the addresses are rounded in such a way
26 * that an integral number of pages is written.
27 * stack: We need the stack information in order to get a meaningful
28 * backtrace. We need to write the data from usp to
29 * current->start_stack, so we round each of these in order to be able
30 * to write an integer number of pages.
31 */
32struct user {
33 struct pt_regs regs; /* entire machine state */
34 size_t u_tsize; /* text size (pages) */
35 size_t u_dsize; /* data size (pages) */
36 size_t u_ssize; /* stack size (pages) */
37 unsigned long start_code; /* text starting address */
38 unsigned long start_data; /* data starting address */
39 unsigned long start_stack; /* stack starting address */
40 long int signal; /* signal causing core dump */
41 unsigned long u_ar0; /* help gdb find registers */
42 unsigned long magic; /* identifies a core file */
43 char u_comm[32]; /* user command name */
44};
45
46#define NBPG PAGE_SIZE
47#define UPAGES 1
48#define HOST_TEXT_START_ADDR (u.start_code)
49#define HOST_DATA_START_ADDR (u.start_data)
50#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
51#endif /* _ASM_POWERPC_USER_H */
diff --git a/arch/powerpc/include/asm/vdso.h b/arch/powerpc/include/asm/vdso.h
new file mode 100644
index 000000000000..26fc449bd989
--- /dev/null
+++ b/arch/powerpc/include/asm/vdso.h
@@ -0,0 +1,78 @@
1#ifndef __PPC64_VDSO_H__
2#define __PPC64_VDSO_H__
3
4#ifdef __KERNEL__
5
6/* Default link addresses for the vDSOs */
7#define VDSO32_LBASE 0x100000
8#define VDSO64_LBASE 0x100000
9
10/* Default map addresses */
11#define VDSO32_MBASE VDSO32_LBASE
12#define VDSO64_MBASE VDSO64_LBASE
13
14#define VDSO_VERSION_STRING LINUX_2.6.15
15
16/* Define if 64 bits VDSO has procedure descriptors */
17#undef VDS64_HAS_DESCRIPTORS
18
19#ifndef __ASSEMBLY__
20
21/* Offsets relative to thread->vdso_base */
22extern unsigned long vdso64_rt_sigtramp;
23extern unsigned long vdso32_sigtramp;
24extern unsigned long vdso32_rt_sigtramp;
25
26#else /* __ASSEMBLY__ */
27
28#ifdef __VDSO64__
29#ifdef VDS64_HAS_DESCRIPTORS
30#define V_FUNCTION_BEGIN(name) \
31 .globl name; \
32 .section ".opd","a"; \
33 .align 3; \
34 name: \
35 .quad .name,.TOC.@tocbase,0; \
36 .previous; \
37 .globl .name; \
38 .type .name,@function; \
39 .name: \
40
41#define V_FUNCTION_END(name) \
42 .size .name,.-.name;
43
44#define V_LOCAL_FUNC(name) (.name)
45
46#else /* VDS64_HAS_DESCRIPTORS */
47
48#define V_FUNCTION_BEGIN(name) \
49 .globl name; \
50 name: \
51
52#define V_FUNCTION_END(name) \
53 .size name,.-name;
54
55#define V_LOCAL_FUNC(name) (name)
56
57#endif /* VDS64_HAS_DESCRIPTORS */
58#endif /* __VDSO64__ */
59
60#ifdef __VDSO32__
61
62#define V_FUNCTION_BEGIN(name) \
63 .globl name; \
64 .type name,@function; \
65 name: \
66
67#define V_FUNCTION_END(name) \
68 .size name,.-name;
69
70#define V_LOCAL_FUNC(name) (name)
71
72#endif /* __VDSO32__ */
73
74#endif /* __ASSEMBLY__ */
75
76#endif /* __KERNEL__ */
77
78#endif /* __PPC64_VDSO_H__ */
diff --git a/arch/powerpc/include/asm/vdso_datapage.h b/arch/powerpc/include/asm/vdso_datapage.h
new file mode 100644
index 000000000000..f01393224b52
--- /dev/null
+++ b/arch/powerpc/include/asm/vdso_datapage.h
@@ -0,0 +1,121 @@
1#ifndef _VDSO_DATAPAGE_H
2#define _VDSO_DATAPAGE_H
3#ifdef __KERNEL__
4
5/*
6 * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM
7 * Copyright (C) 2005 Benjamin Herrenschmidy <benh@kernel.crashing.org>,
8 * IBM Corp.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16
17/*
18 * Note about this structure:
19 *
20 * This structure was historically called systemcfg and exposed to
21 * userland via /proc/ppc64/systemcfg. Unfortunately, this became an
22 * ABI issue as some proprietary software started relying on being able
23 * to mmap() it, thus we have to keep the base layout at least for a
24 * few kernel versions.
25 *
26 * However, since ppc32 doesn't suffer from this backward handicap,
27 * a simpler version of the data structure is used there with only the
28 * fields actually used by the vDSO.
29 *
30 */
31
32/*
33 * If the major version changes we are incompatible.
34 * Minor version changes are a hint.
35 */
36#define SYSTEMCFG_MAJOR 1
37#define SYSTEMCFG_MINOR 1
38
39#ifndef __ASSEMBLY__
40
41#include <linux/unistd.h>
42
43#define SYSCALL_MAP_SIZE ((__NR_syscalls + 31) / 32)
44
45/*
46 * So here is the ppc64 backward compatible version
47 */
48
49#ifdef CONFIG_PPC64
50
51struct vdso_data {
52 __u8 eye_catcher[16]; /* Eyecatcher: SYSTEMCFG:PPC64 0x00 */
53 struct { /* Systemcfg version numbers */
54 __u32 major; /* Major number 0x10 */
55 __u32 minor; /* Minor number 0x14 */
56 } version;
57
58 /* Note about the platform flags: it now only contains the lpar
59 * bit. The actual platform number is dead and burried
60 */
61 __u32 platform; /* Platform flags 0x18 */
62 __u32 processor; /* Processor type 0x1C */
63 __u64 processorCount; /* # of physical processors 0x20 */
64 __u64 physicalMemorySize; /* Size of real memory(B) 0x28 */
65 __u64 tb_orig_stamp; /* Timebase at boot 0x30 */
66 __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */
67 __u64 tb_to_xs; /* Inverse of TB to 2^20 0x40 */
68 __u64 stamp_xsec; /* 0x48 */
69 __u64 tb_update_count; /* Timebase atomicity ctr 0x50 */
70 __u32 tz_minuteswest; /* Minutes west of Greenwich 0x58 */
71 __u32 tz_dsttime; /* Type of dst correction 0x5C */
72 __u32 dcache_size; /* L1 d-cache size 0x60 */
73 __u32 dcache_line_size; /* L1 d-cache line size 0x64 */
74 __u32 icache_size; /* L1 i-cache size 0x68 */
75 __u32 icache_line_size; /* L1 i-cache line size 0x6C */
76
77 /* those additional ones don't have to be located anywhere
78 * special as they were not part of the original systemcfg
79 */
80 __u32 dcache_block_size; /* L1 d-cache block size */
81 __u32 icache_block_size; /* L1 i-cache block size */
82 __u32 dcache_log_block_size; /* L1 d-cache log block size */
83 __u32 icache_log_block_size; /* L1 i-cache log block size */
84 __s32 wtom_clock_sec; /* Wall to monotonic clock */
85 __s32 wtom_clock_nsec;
86 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */
87 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
88};
89
90#else /* CONFIG_PPC64 */
91
92/*
93 * And here is the simpler 32 bits version
94 */
95struct vdso_data {
96 __u64 tb_orig_stamp; /* Timebase at boot 0x30 */
97 __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */
98 __u64 tb_to_xs; /* Inverse of TB to 2^20 0x40 */
99 __u64 stamp_xsec; /* 0x48 */
100 __u32 tb_update_count; /* Timebase atomicity ctr 0x50 */
101 __u32 tz_minuteswest; /* Minutes west of Greenwich 0x58 */
102 __u32 tz_dsttime; /* Type of dst correction 0x5C */
103 __s32 wtom_clock_sec; /* Wall to monotonic clock */
104 __s32 wtom_clock_nsec;
105 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
106 __u32 dcache_block_size; /* L1 d-cache block size */
107 __u32 icache_block_size; /* L1 i-cache block size */
108 __u32 dcache_log_block_size; /* L1 d-cache log block size */
109 __u32 icache_log_block_size; /* L1 i-cache log block size */
110};
111
112#endif /* CONFIG_PPC64 */
113
114#ifdef __KERNEL__
115extern struct vdso_data *vdso_data;
116#endif
117
118#endif /* __ASSEMBLY__ */
119
120#endif /* __KERNEL__ */
121#endif /* _SYSTEMCFG_H */
diff --git a/arch/powerpc/include/asm/vga.h b/arch/powerpc/include/asm/vga.h
new file mode 100644
index 000000000000..a2eac409c1ec
--- /dev/null
+++ b/arch/powerpc/include/asm/vga.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_POWERPC_VGA_H_
2#define _ASM_POWERPC_VGA_H_
3
4#ifdef __KERNEL__
5
6/*
7 * Access to VGA videoram
8 *
9 * (c) 1998 Martin Mares <mj@ucw.cz>
10 */
11
12
13#include <asm/io.h>
14
15
16#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
17
18#define VT_BUF_HAVE_RW
19/*
20 * These are only needed for supporting VGA or MDA text mode, which use little
21 * endian byte ordering.
22 * In other cases, we can optimize by using native byte ordering and
23 * <linux/vt_buffer.h> has already done the right job for us.
24 */
25
26static inline void scr_writew(u16 val, volatile u16 *addr)
27{
28 st_le16(addr, val);
29}
30
31static inline u16 scr_readw(volatile const u16 *addr)
32{
33 return ld_le16(addr);
34}
35
36#define VT_BUF_HAVE_MEMCPYW
37#define scr_memcpyw memcpy
38
39#endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */
40
41extern unsigned long vgacon_remap_base;
42
43#ifdef __powerpc64__
44#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s))
45#else
46#define VGA_MAP_MEM(x,s) (x + vgacon_remap_base)
47#endif
48
49#define vga_readb(x) (*(x))
50#define vga_writeb(x,y) (*(y) = (x))
51
52#endif /* __KERNEL__ */
53#endif /* _ASM_POWERPC_VGA_H_ */
diff --git a/arch/powerpc/include/asm/vio.h b/arch/powerpc/include/asm/vio.h
new file mode 100644
index 000000000000..0a290a195946
--- /dev/null
+++ b/arch/powerpc/include/asm/vio.h
@@ -0,0 +1,118 @@
1/*
2 * IBM PowerPC Virtual I/O Infrastructure Support.
3 *
4 * Copyright (c) 2003 IBM Corp.
5 * Dave Engebretsen engebret@us.ibm.com
6 * Santiago Leon santil@us.ibm.com
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#ifndef _ASM_POWERPC_VIO_H
15#define _ASM_POWERPC_VIO_H
16#ifdef __KERNEL__
17
18#include <linux/init.h>
19#include <linux/errno.h>
20#include <linux/device.h>
21#include <linux/dma-mapping.h>
22#include <linux/mod_devicetable.h>
23
24#include <asm/hvcall.h>
25#include <asm/scatterlist.h>
26
27/*
28 * Architecture-specific constants for drivers to
29 * extract attributes of the device using vio_get_attribute()
30 */
31#define VETH_MAC_ADDR "local-mac-address"
32#define VETH_MCAST_FILTER_SIZE "ibm,mac-address-filters"
33
34/* End architecture-specific constants */
35
36#define h_vio_signal(ua, mode) \
37 plpar_hcall_norets(H_VIO_SIGNAL, ua, mode)
38
39#define VIO_IRQ_DISABLE 0UL
40#define VIO_IRQ_ENABLE 1UL
41
42/*
43 * VIO CMO minimum entitlement for all devices and spare entitlement
44 */
45#define VIO_CMO_MIN_ENT 1562624
46
47struct iommu_table;
48
49/**
50 * vio_dev - This structure is used to describe virtual I/O devices.
51 *
52 * @desired: set from return of driver's get_desired_dma() function
53 * @entitled: bytes of IO data that has been reserved for this device.
54 * @allocated: bytes of IO data currently in use by the device.
55 * @allocs_failed: number of DMA failures due to insufficient entitlement.
56 */
57struct vio_dev {
58 const char *name;
59 const char *type;
60 uint32_t unit_address;
61 unsigned int irq;
62 struct {
63 size_t desired;
64 size_t entitled;
65 size_t allocated;
66 atomic_t allocs_failed;
67 } cmo;
68 struct device dev;
69};
70
71struct vio_driver {
72 const struct vio_device_id *id_table;
73 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
74 int (*remove)(struct vio_dev *dev);
75 /* A driver must have a get_desired_dma() function to
76 * be loaded in a CMO environment if it uses DMA.
77 */
78 unsigned long (*get_desired_dma)(struct vio_dev *dev);
79 struct device_driver driver;
80};
81
82extern int vio_register_driver(struct vio_driver *drv);
83extern void vio_unregister_driver(struct vio_driver *drv);
84
85extern int vio_cmo_entitlement_update(size_t);
86extern void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired);
87
88extern void __devinit vio_unregister_device(struct vio_dev *dev);
89
90struct device_node;
91
92extern struct vio_dev *vio_register_device_node(
93 struct device_node *node_vdev);
94extern const void *vio_get_attribute(struct vio_dev *vdev, char *which,
95 int *length);
96#ifdef CONFIG_PPC_PSERIES
97extern struct vio_dev *vio_find_node(struct device_node *vnode);
98extern int vio_enable_interrupts(struct vio_dev *dev);
99extern int vio_disable_interrupts(struct vio_dev *dev);
100#else
101static inline int vio_enable_interrupts(struct vio_dev *dev)
102{
103 return 0;
104}
105#endif
106
107static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
108{
109 return container_of(drv, struct vio_driver, driver);
110}
111
112static inline struct vio_dev *to_vio_dev(struct device *dev)
113{
114 return container_of(dev, struct vio_dev, dev);
115}
116
117#endif /* __KERNEL__ */
118#endif /* _ASM_POWERPC_VIO_H */
diff --git a/arch/powerpc/include/asm/xilinx_intc.h b/arch/powerpc/include/asm/xilinx_intc.h
new file mode 100644
index 000000000000..343612f8fece
--- /dev/null
+++ b/arch/powerpc/include/asm/xilinx_intc.h
@@ -0,0 +1,20 @@
1/*
2 * Xilinx intc external definitions
3 *
4 * Copyright 2007 Secret Lab Technologies Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11#ifndef _ASM_POWERPC_XILINX_INTC_H
12#define _ASM_POWERPC_XILINX_INTC_H
13
14#ifdef __KERNEL__
15
16extern void __init xilinx_intc_init_tree(void);
17extern unsigned int xilinx_intc_get_irq(void);
18
19#endif /* __KERNEL__ */
20#endif /* _ASM_POWERPC_XILINX_INTC_H */
diff --git a/arch/powerpc/include/asm/xmon.h b/arch/powerpc/include/asm/xmon.h
new file mode 100644
index 000000000000..5eb8e599e5cc
--- /dev/null
+++ b/arch/powerpc/include/asm/xmon.h
@@ -0,0 +1,33 @@
1#ifndef __ASM_POWERPC_XMON_H
2#define __ASM_POWERPC_XMON_H
3
4/*
5 * Copyrignt (C) 2006 IBM Corp
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#ifdef __KERNEL__
14
15#include <linux/irqreturn.h>
16
17#ifdef CONFIG_XMON
18extern void xmon_setup(void);
19extern void xmon_register_spus(struct list_head *list);
20struct pt_regs;
21extern int xmon(struct pt_regs *excp);
22extern irqreturn_t xmon_irq(int, void *);
23#else
24static inline void xmon_setup(void) { };
25static inline void xmon_register_spus(struct list_head *list) { };
26#endif
27
28#if defined(CONFIG_XMON) && defined(CONFIG_SMP)
29extern int cpus_are_in_xmon(void);
30#endif
31
32#endif /* __KERNEL __ */
33#endif /* __ASM_POWERPC_XMON_H */
diff --git a/arch/powerpc/include/asm/xor.h b/arch/powerpc/include/asm/xor.h
new file mode 100644
index 000000000000..c82eb12a5b18
--- /dev/null
+++ b/arch/powerpc/include/asm/xor.h
@@ -0,0 +1 @@
#include <asm-generic/xor.h>
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 1a4094704b1f..64f5948ebc9d 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -59,8 +59,6 @@ obj64-$(CONFIG_HIBERNATION) += swsusp_asm64.o
59obj-$(CONFIG_MODULES) += module.o module_$(CONFIG_WORD_SIZE).o 59obj-$(CONFIG_MODULES) += module.o module_$(CONFIG_WORD_SIZE).o
60obj-$(CONFIG_44x) += cpu_setup_44x.o 60obj-$(CONFIG_44x) += cpu_setup_44x.o
61 61
62ifeq ($(CONFIG_PPC_MERGE),y)
63
64extra-$(CONFIG_PPC_STD_MMU) := head_32.o 62extra-$(CONFIG_PPC_STD_MMU) := head_32.o
65extra-$(CONFIG_PPC64) := head_64.o 63extra-$(CONFIG_PPC64) := head_64.o
66extra-$(CONFIG_40x) := head_40x.o 64extra-$(CONFIG_40x) := head_40x.o
@@ -100,12 +98,6 @@ ifneq ($(CONFIG_PPC_INDIRECT_IO),y)
100obj-y += iomap.o 98obj-y += iomap.o
101endif 99endif
102 100
103else
104# stuff used from here for ARCH=ppc
105smpobj-$(CONFIG_SMP) += smp.o
106
107endif
108
109obj-$(CONFIG_PPC64) += $(obj64-y) 101obj-$(CONFIG_PPC64) += $(obj64-y)
110 102
111extra-$(CONFIG_PPC_FPU) += fpu.o 103extra-$(CONFIG_PPC_FPU) += fpu.o
@@ -121,9 +113,6 @@ PHONY += systbl_chk
121systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i 113systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i
122 $(call cmd,systbl_chk) 114 $(call cmd,systbl_chk)
123 115
124
125ifeq ($(CONFIG_PPC_MERGE),y)
126
127$(obj)/built-in.o: prom_init_check 116$(obj)/built-in.o: prom_init_check
128 117
129quiet_cmd_prom_init_check = CALL $< 118quiet_cmd_prom_init_check = CALL $<
@@ -133,7 +122,4 @@ PHONY += prom_init_check
133prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o 122prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o
134 $(call cmd,prom_init_check) 123 $(call cmd,prom_init_check)
135 124
136endif
137
138
139clean-files := vmlinux.lds 125clean-files := vmlinux.lds
diff --git a/arch/powerpc/kernel/cpu_setup_44x.S b/arch/powerpc/kernel/cpu_setup_44x.S
index 5465e8de0e61..80cac984d85d 100644
--- a/arch/powerpc/kernel/cpu_setup_44x.S
+++ b/arch/powerpc/kernel/cpu_setup_44x.S
@@ -39,12 +39,6 @@ _GLOBAL(__setup_cpu_440gx)
39_GLOBAL(__setup_cpu_440spe) 39_GLOBAL(__setup_cpu_440spe)
40 b __fixup_440A_mcheck 40 b __fixup_440A_mcheck
41 41
42 /* Temporary fixup for arch/ppc until we kill the whole thing */
43#ifndef CONFIG_PPC_MERGE
44_GLOBAL(__fixup_440A_mcheck)
45 blr
46#endif
47
48/* enable APU between CPU and FPU */ 42/* enable APU between CPU and FPU */
49_GLOBAL(__init_fpu_44x) 43_GLOBAL(__init_fpu_44x)
50 mfspr r3,SPRN_CCR0 44 mfspr r3,SPRN_CCR0
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 6ac8612da3c3..d972decf0324 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -77,22 +77,12 @@ static int ppc_spurious_interrupts;
77EXPORT_SYMBOL(__irq_offset_value); 77EXPORT_SYMBOL(__irq_offset_value);
78atomic_t ppc_n_lost_interrupts; 78atomic_t ppc_n_lost_interrupts;
79 79
80#ifndef CONFIG_PPC_MERGE
81#define NR_MASK_WORDS ((NR_IRQS + 31) / 32)
82unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
83#endif
84
85#ifdef CONFIG_TAU_INT 80#ifdef CONFIG_TAU_INT
86extern int tau_initialized; 81extern int tau_initialized;
87extern int tau_interrupts(int); 82extern int tau_interrupts(int);
88#endif 83#endif
89#endif /* CONFIG_PPC32 */ 84#endif /* CONFIG_PPC32 */
90 85
91#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_MERGE)
92extern atomic_t ipi_recv;
93extern atomic_t ipi_sent;
94#endif
95
96#ifdef CONFIG_PPC64 86#ifdef CONFIG_PPC64
97EXPORT_SYMBOL(irq_desc); 87EXPORT_SYMBOL(irq_desc);
98 88
@@ -216,21 +206,14 @@ int show_interrupts(struct seq_file *p, void *v)
216skip: 206skip:
217 spin_unlock_irqrestore(&desc->lock, flags); 207 spin_unlock_irqrestore(&desc->lock, flags);
218 } else if (i == NR_IRQS) { 208 } else if (i == NR_IRQS) {
219#ifdef CONFIG_PPC32 209#if defined(CONFIG_PPC32) && defined(CONFIG_TAU_INT)
220#ifdef CONFIG_TAU_INT
221 if (tau_initialized){ 210 if (tau_initialized){
222 seq_puts(p, "TAU: "); 211 seq_puts(p, "TAU: ");
223 for_each_online_cpu(j) 212 for_each_online_cpu(j)
224 seq_printf(p, "%10u ", tau_interrupts(j)); 213 seq_printf(p, "%10u ", tau_interrupts(j));
225 seq_puts(p, " PowerPC Thermal Assist (cpu temp)\n"); 214 seq_puts(p, " PowerPC Thermal Assist (cpu temp)\n");
226 } 215 }
227#endif 216#endif /* CONFIG_PPC32 && CONFIG_TAU_INT*/
228#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_MERGE)
229 /* should this be per processor send/receive? */
230 seq_printf(p, "IPI (recv/sent): %10u/%u\n",
231 atomic_read(&ipi_recv), atomic_read(&ipi_sent));
232#endif
233#endif /* CONFIG_PPC32 */
234 seq_printf(p, "BAD: %10u\n", ppc_spurious_interrupts); 217 seq_printf(p, "BAD: %10u\n", ppc_spurious_interrupts);
235 } 218 }
236 return 0; 219 return 0;
@@ -454,8 +437,6 @@ void do_softirq(void)
454 * IRQ controller and virtual interrupts 437 * IRQ controller and virtual interrupts
455 */ 438 */
456 439
457#ifdef CONFIG_PPC_MERGE
458
459static LIST_HEAD(irq_hosts); 440static LIST_HEAD(irq_hosts);
460static DEFINE_SPINLOCK(irq_big_lock); 441static DEFINE_SPINLOCK(irq_big_lock);
461static DEFINE_PER_CPU(unsigned int, irq_radix_reader); 442static DEFINE_PER_CPU(unsigned int, irq_radix_reader);
@@ -1114,8 +1095,6 @@ static int __init irq_debugfs_init(void)
1114__initcall(irq_debugfs_init); 1095__initcall(irq_debugfs_init);
1115#endif /* CONFIG_VIRQ_DEBUG */ 1096#endif /* CONFIG_VIRQ_DEBUG */
1116 1097
1117#endif /* CONFIG_PPC_MERGE */
1118
1119#ifdef CONFIG_PPC64 1098#ifdef CONFIG_PPC64
1120static int __init setup_noirqdistrib(char *str) 1099static int __init setup_noirqdistrib(char *str)
1121{ 1100{
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index e030f3bd5024..957bded0020d 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -276,10 +276,8 @@ int set_dabr(unsigned long dabr)
276{ 276{
277 __get_cpu_var(current_dabr) = dabr; 277 __get_cpu_var(current_dabr) = dabr;
278 278
279#ifdef CONFIG_PPC_MERGE /* XXX for now */
280 if (ppc_md.set_dabr) 279 if (ppc_md.set_dabr)
281 return ppc_md.set_dabr(dabr); 280 return ppc_md.set_dabr(dabr);
282#endif
283 281
284 /* XXX should we have a CPU_FTR_HAS_DABR ? */ 282 /* XXX should we have a CPU_FTR_HAS_DABR ? */
285#if defined(CONFIG_PPC64) || defined(CONFIG_6xx) 283#if defined(CONFIG_PPC64) || defined(CONFIG_6xx)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index f177c60ea766..65639a43e644 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -788,9 +788,7 @@ static int __init vdso_init(void)
788 788
789 return 0; 789 return 0;
790} 790}
791#ifdef CONFIG_PPC_MERGE
792arch_initcall(vdso_init); 791arch_initcall(vdso_init);
793#endif
794 792
795int in_gate_area_no_task(unsigned long addr) 793int in_gate_area_no_task(unsigned long addr)
796{ 794{
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 2a88e8b9a3c6..d69912c07ce7 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -6,12 +6,10 @@ ifeq ($(CONFIG_PPC64),y)
6EXTRA_CFLAGS += -mno-minimal-toc 6EXTRA_CFLAGS += -mno-minimal-toc
7endif 7endif
8 8
9ifeq ($(CONFIG_PPC_MERGE),y)
10obj-y := string.o alloc.o \ 9obj-y := string.o alloc.o \
11 checksum_$(CONFIG_WORD_SIZE).o 10 checksum_$(CONFIG_WORD_SIZE).o
12obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o 11obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o
13obj-$(CONFIG_HAS_IOMEM) += devres.o 12obj-$(CONFIG_HAS_IOMEM) += devres.o
14endif
15 13
16obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \ 14obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
17 memcpy_64.o usercopy_64.o mem_64.o string.o 15 memcpy_64.o usercopy_64.o mem_64.o string.o
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 702691cb9e82..1c93c255873b 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -311,7 +311,7 @@ void __init paging_init(void)
311#endif /* CONFIG_HIGHMEM */ 311#endif /* CONFIG_HIGHMEM */
312 312
313 printk(KERN_DEBUG "Top of RAM: 0x%llx, Total RAM: 0x%lx\n", 313 printk(KERN_DEBUG "Top of RAM: 0x%llx, Total RAM: 0x%lx\n",
314 (u64)top_of_ram, total_ram); 314 (unsigned long long)top_of_ram, total_ram);
315 printk(KERN_DEBUG "Memory hole size: %ldMB\n", 315 printk(KERN_DEBUG "Memory hole size: %ldMB\n",
316 (long int)((top_of_ram - total_ram) >> 20)); 316 (long int)((top_of_ram - total_ram) >> 20));
317 memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); 317 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index c53145f61942..6aa120813775 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -236,8 +236,8 @@ void __init MMU_init_hw(void)
236 236
237 Hash_end = (struct hash_pte *) ((unsigned long)Hash + Hash_size); 237 Hash_end = (struct hash_pte *) ((unsigned long)Hash + Hash_size);
238 238
239 printk("Total memory = %ldMB; using %ldkB for hash table (at %p)\n", 239 printk("Total memory = %lldMB; using %ldkB for hash table (at %p)\n",
240 total_memory >> 20, Hash_size >> 10, Hash); 240 (unsigned long long)(total_memory >> 20), Hash_size >> 10, Hash);
241 241
242 242
243 /* 243 /*
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index 409fcc7b63ce..be7dd422c0fa 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -34,7 +34,7 @@
34DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); 34DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
35 35
36/* This is declared as we are using the more or less generic 36/* This is declared as we are using the more or less generic
37 * include/asm-powerpc/tlb.h file -- tgall 37 * arch/powerpc/include/asm/tlb.h file -- tgall
38 */ 38 */
39DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 39DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
40static DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); 40static DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
diff --git a/arch/powerpc/platforms/52xx/Makefile b/arch/powerpc/platforms/52xx/Makefile
index daf0e1568d6d..b8a52062738a 100644
--- a/arch/powerpc/platforms/52xx/Makefile
+++ b/arch/powerpc/platforms/52xx/Makefile
@@ -1,10 +1,8 @@
1# 1#
2# Makefile for 52xx based boards 2# Makefile for 52xx based boards
3# 3#
4ifeq ($(CONFIG_PPC_MERGE),y)
5obj-y += mpc52xx_pic.o mpc52xx_common.o 4obj-y += mpc52xx_pic.o mpc52xx_common.o
6obj-$(CONFIG_PCI) += mpc52xx_pci.o 5obj-$(CONFIG_PCI) += mpc52xx_pci.o
7endif
8 6
9obj-$(CONFIG_PPC_MPC5200_SIMPLE) += mpc5200_simple.o 7obj-$(CONFIG_PPC_MPC5200_SIMPLE) += mpc5200_simple.o
10obj-$(CONFIG_PPC_EFIKA) += efika.o 8obj-$(CONFIG_PPC_EFIKA) += efika.o
@@ -15,4 +13,4 @@ ifeq ($(CONFIG_PPC_LITE5200),y)
15 obj-$(CONFIG_PM) += lite5200_sleep.o lite5200_pm.o 13 obj-$(CONFIG_PM) += lite5200_sleep.o lite5200_pm.o
16endif 14endif
17 15
18obj-$(CONFIG_PPC_MPC5200_GPIO) += mpc52xx_gpio.o \ No newline at end of file 16obj-$(CONFIG_PPC_MPC5200_GPIO) += mpc52xx_gpio.o
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_smp.c b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
index 835f2dc24dc9..014e26cda08d 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_smp.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
@@ -19,7 +19,7 @@
19#include <asm/page.h> 19#include <asm/page.h>
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21#include <asm/pci-bridge.h> 21#include <asm/pci-bridge.h>
22#include <asm-powerpc/mpic.h> 22#include <asm/mpic.h>
23#include <asm/mpc86xx.h> 23#include <asm/mpc86xx.h>
24#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
25 25
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index 423a0234dc31..8079e0b4fd69 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -1,13 +1,7 @@
1 1
2obj-$(CONFIG_FSL_ULI1575) += fsl_uli1575.o 2obj-$(CONFIG_FSL_ULI1575) += fsl_uli1575.o
3 3
4ifeq ($(CONFIG_PPC_MERGE),y)
5obj-$(CONFIG_PPC_PMAC) += powermac/ 4obj-$(CONFIG_PPC_PMAC) += powermac/
6else
7ifeq ($(CONFIG_PPC64),y)
8obj-$(CONFIG_PPC_PMAC) += powermac/
9endif
10endif
11obj-$(CONFIG_PPC_CHRP) += chrp/ 5obj-$(CONFIG_PPC_CHRP) += chrp/
12obj-$(CONFIG_40x) += 40x/ 6obj-$(CONFIG_40x) += 40x/
13obj-$(CONFIG_44x) += 44x/ 7obj-$(CONFIG_44x) += 44x/
diff --git a/arch/powerpc/platforms/powermac/Makefile b/arch/powerpc/platforms/powermac/Makefile
index 89774177b209..58ecdd72630f 100644
--- a/arch/powerpc/platforms/powermac/Makefile
+++ b/arch/powerpc/platforms/powermac/Makefile
@@ -7,7 +7,7 @@ endif
7 7
8obj-y += pic.o setup.o time.o feature.o pci.o \ 8obj-y += pic.o setup.o time.o feature.o pci.o \
9 sleep.o low_i2c.o cache.o pfunc_core.o \ 9 sleep.o low_i2c.o cache.o pfunc_core.o \
10 pfunc_base.o 10 pfunc_base.o udbg_scc.o udbg_adb.o
11obj-$(CONFIG_PMAC_BACKLIGHT) += backlight.o 11obj-$(CONFIG_PMAC_BACKLIGHT) += backlight.o
12obj-$(CONFIG_CPU_FREQ_PMAC) += cpufreq_32.o 12obj-$(CONFIG_CPU_FREQ_PMAC) += cpufreq_32.o
13obj-$(CONFIG_CPU_FREQ_PMAC64) += cpufreq_64.o 13obj-$(CONFIG_CPU_FREQ_PMAC64) += cpufreq_64.o
@@ -19,4 +19,3 @@ obj-$(CONFIG_NVRAM:m=y) += nvram.o
19obj-$(CONFIG_PPC64) += nvram.o 19obj-$(CONFIG_PPC64) += nvram.o
20obj-$(CONFIG_PPC32) += bootx_init.o 20obj-$(CONFIG_PPC32) += bootx_init.o
21obj-$(CONFIG_SMP) += smp.o 21obj-$(CONFIG_SMP) += smp.o
22obj-$(CONFIG_PPC_MERGE) += udbg_scc.o udbg_adb.o
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 16a0ed28eb00..a90054b56d5c 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_MV64X60) += $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o \
25obj-$(CONFIG_RTC_DRV_CMOS) += rtc_cmos_setup.o 25obj-$(CONFIG_RTC_DRV_CMOS) += rtc_cmos_setup.o
26obj-$(CONFIG_AXON_RAM) += axonram.o 26obj-$(CONFIG_AXON_RAM) += axonram.o
27 27
28ifeq ($(CONFIG_PPC_MERGE),y)
29obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o 28obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
30obj-$(CONFIG_PPC_I8259) += i8259.o 29obj-$(CONFIG_PPC_I8259) += i8259.o
31obj-$(CONFIG_IPIC) += ipic.o 30obj-$(CONFIG_IPIC) += ipic.o
@@ -36,7 +35,6 @@ obj-$(CONFIG_OF_RTC) += of_rtc.o
36ifeq ($(CONFIG_PCI),y) 35ifeq ($(CONFIG_PCI),y)
37obj-$(CONFIG_4xx) += ppc4xx_pci.o 36obj-$(CONFIG_4xx) += ppc4xx_pci.o
38endif 37endif
39endif
40 38
41# Temporary hack until we have migrated to asm-powerpc 39# Temporary hack until we have migrated to asm-powerpc
42ifeq ($(ARCH),powerpc) 40ifeq ($(ARCH),powerpc)
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
new file mode 100644
index 000000000000..63a23415fba6
--- /dev/null
+++ b/arch/s390/include/asm/Kbuild
@@ -0,0 +1,15 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += dasd.h
4header-y += monwriter.h
5header-y += qeth.h
6header-y += tape390.h
7header-y += ucontext.h
8header-y += vtoc.h
9header-y += zcrypt.h
10header-y += chsc.h
11
12unifdef-y += cmb.h
13unifdef-y += debug.h
14unifdef-y += chpid.h
15unifdef-y += schid.h
diff --git a/arch/s390/include/asm/airq.h b/arch/s390/include/asm/airq.h
new file mode 100644
index 000000000000..1ac80d6b0588
--- /dev/null
+++ b/arch/s390/include/asm/airq.h
@@ -0,0 +1,19 @@
1/*
2 * include/asm-s390/airq.h
3 *
4 * Copyright IBM Corp. 2002,2007
5 * Author(s): Ingo Adlung <adlung@de.ibm.com>
6 * Cornelia Huck <cornelia.huck@de.ibm.com>
7 * Arnd Bergmann <arndb@de.ibm.com>
8 * Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
9 */
10
11#ifndef _ASM_S390_AIRQ_H
12#define _ASM_S390_AIRQ_H
13
14typedef void (*adapter_int_handler_t)(void *, void *);
15
16void *s390_register_adapter_interrupt(adapter_int_handler_t, void *, u8);
17void s390_unregister_adapter_interrupt(void *, u8);
18
19#endif /* _ASM_S390_AIRQ_H */
diff --git a/arch/s390/include/asm/appldata.h b/arch/s390/include/asm/appldata.h
new file mode 100644
index 000000000000..79283dac8281
--- /dev/null
+++ b/arch/s390/include/asm/appldata.h
@@ -0,0 +1,90 @@
1/*
2 * include/asm-s390/appldata.h
3 *
4 * Copyright (C) IBM Corp. 2006
5 *
6 * Author(s): Melissa Howland <melissah@us.ibm.com>
7 */
8
9#ifndef _ASM_S390_APPLDATA_H
10#define _ASM_S390_APPLDATA_H
11
12#include <asm/io.h>
13
14#ifndef CONFIG_64BIT
15
16#define APPLDATA_START_INTERVAL_REC 0x00 /* Function codes for */
17#define APPLDATA_STOP_REC 0x01 /* DIAG 0xDC */
18#define APPLDATA_GEN_EVENT_REC 0x02
19#define APPLDATA_START_CONFIG_REC 0x03
20
21/*
22 * Parameter list for DIAGNOSE X'DC'
23 */
24struct appldata_parameter_list {
25 u16 diag; /* The DIAGNOSE code X'00DC' */
26 u8 function; /* The function code for the DIAGNOSE */
27 u8 parlist_length; /* Length of the parameter list */
28 u32 product_id_addr; /* Address of the 16-byte product ID */
29 u16 reserved;
30 u16 buffer_length; /* Length of the application data buffer */
31 u32 buffer_addr; /* Address of the application data buffer */
32} __attribute__ ((packed));
33
34#else /* CONFIG_64BIT */
35
36#define APPLDATA_START_INTERVAL_REC 0x80
37#define APPLDATA_STOP_REC 0x81
38#define APPLDATA_GEN_EVENT_REC 0x82
39#define APPLDATA_START_CONFIG_REC 0x83
40
41/*
42 * Parameter list for DIAGNOSE X'DC'
43 */
44struct appldata_parameter_list {
45 u16 diag;
46 u8 function;
47 u8 parlist_length;
48 u32 unused01;
49 u16 reserved;
50 u16 buffer_length;
51 u32 unused02;
52 u64 product_id_addr;
53 u64 buffer_addr;
54} __attribute__ ((packed));
55
56#endif /* CONFIG_64BIT */
57
58struct appldata_product_id {
59 char prod_nr[7]; /* product number */
60 u16 prod_fn; /* product function */
61 u8 record_nr; /* record number */
62 u16 version_nr; /* version */
63 u16 release_nr; /* release */
64 u16 mod_lvl; /* modification level */
65} __attribute__ ((packed));
66
67static inline int appldata_asm(struct appldata_product_id *id,
68 unsigned short fn, void *buffer,
69 unsigned short length)
70{
71 struct appldata_parameter_list parm_list;
72 int ry;
73
74 if (!MACHINE_IS_VM)
75 return -ENOSYS;
76 parm_list.diag = 0xdc;
77 parm_list.function = fn;
78 parm_list.parlist_length = sizeof(parm_list);
79 parm_list.buffer_length = length;
80 parm_list.product_id_addr = (unsigned long) id;
81 parm_list.buffer_addr = virt_to_phys(buffer);
82 asm volatile(
83 " diag %1,%0,0xdc"
84 : "=d" (ry)
85 : "d" (&parm_list), "m" (parm_list), "m" (*id)
86 : "cc");
87 return ry;
88}
89
90#endif /* _ASM_S390_APPLDATA_H */
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
new file mode 100644
index 000000000000..2d184655bc5d
--- /dev/null
+++ b/arch/s390/include/asm/atomic.h
@@ -0,0 +1,285 @@
1#ifndef __ARCH_S390_ATOMIC__
2#define __ARCH_S390_ATOMIC__
3
4#include <linux/compiler.h>
5
6/*
7 * include/asm-s390/atomic.h
8 *
9 * S390 version
10 * Copyright (C) 1999-2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
11 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
12 * Denis Joseph Barrow,
13 * Arnd Bergmann (arndb@de.ibm.com)
14 *
15 * Derived from "include/asm-i386/bitops.h"
16 * Copyright (C) 1992, Linus Torvalds
17 *
18 */
19
20/*
21 * Atomic operations that C can't guarantee us. Useful for
22 * resource counting etc..
23 * S390 uses 'Compare And Swap' for atomicity in SMP enviroment
24 */
25
26typedef struct {
27 int counter;
28} __attribute__ ((aligned (4))) atomic_t;
29#define ATOMIC_INIT(i) { (i) }
30
31#ifdef __KERNEL__
32
33#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
34
35#define __CS_LOOP(ptr, op_val, op_string) ({ \
36 typeof(ptr->counter) old_val, new_val; \
37 asm volatile( \
38 " l %0,%2\n" \
39 "0: lr %1,%0\n" \
40 op_string " %1,%3\n" \
41 " cs %0,%1,%2\n" \
42 " jl 0b" \
43 : "=&d" (old_val), "=&d" (new_val), \
44 "=Q" (((atomic_t *)(ptr))->counter) \
45 : "d" (op_val), "Q" (((atomic_t *)(ptr))->counter) \
46 : "cc", "memory"); \
47 new_val; \
48})
49
50#else /* __GNUC__ */
51
52#define __CS_LOOP(ptr, op_val, op_string) ({ \
53 typeof(ptr->counter) old_val, new_val; \
54 asm volatile( \
55 " l %0,0(%3)\n" \
56 "0: lr %1,%0\n" \
57 op_string " %1,%4\n" \
58 " cs %0,%1,0(%3)\n" \
59 " jl 0b" \
60 : "=&d" (old_val), "=&d" (new_val), \
61 "=m" (((atomic_t *)(ptr))->counter) \
62 : "a" (ptr), "d" (op_val), \
63 "m" (((atomic_t *)(ptr))->counter) \
64 : "cc", "memory"); \
65 new_val; \
66})
67
68#endif /* __GNUC__ */
69
70static inline int atomic_read(const atomic_t *v)
71{
72 barrier();
73 return v->counter;
74}
75
76static inline void atomic_set(atomic_t *v, int i)
77{
78 v->counter = i;
79 barrier();
80}
81
82static __inline__ int atomic_add_return(int i, atomic_t * v)
83{
84 return __CS_LOOP(v, i, "ar");
85}
86#define atomic_add(_i, _v) atomic_add_return(_i, _v)
87#define atomic_add_negative(_i, _v) (atomic_add_return(_i, _v) < 0)
88#define atomic_inc(_v) atomic_add_return(1, _v)
89#define atomic_inc_return(_v) atomic_add_return(1, _v)
90#define atomic_inc_and_test(_v) (atomic_add_return(1, _v) == 0)
91
92static __inline__ int atomic_sub_return(int i, atomic_t * v)
93{
94 return __CS_LOOP(v, i, "sr");
95}
96#define atomic_sub(_i, _v) atomic_sub_return(_i, _v)
97#define atomic_sub_and_test(_i, _v) (atomic_sub_return(_i, _v) == 0)
98#define atomic_dec(_v) atomic_sub_return(1, _v)
99#define atomic_dec_return(_v) atomic_sub_return(1, _v)
100#define atomic_dec_and_test(_v) (atomic_sub_return(1, _v) == 0)
101
102static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t * v)
103{
104 __CS_LOOP(v, ~mask, "nr");
105}
106
107static __inline__ void atomic_set_mask(unsigned long mask, atomic_t * v)
108{
109 __CS_LOOP(v, mask, "or");
110}
111
112#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
113
114static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new)
115{
116#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
117 asm volatile(
118 " cs %0,%2,%1"
119 : "+d" (old), "=Q" (v->counter)
120 : "d" (new), "Q" (v->counter)
121 : "cc", "memory");
122#else /* __GNUC__ */
123 asm volatile(
124 " cs %0,%3,0(%2)"
125 : "+d" (old), "=m" (v->counter)
126 : "a" (v), "d" (new), "m" (v->counter)
127 : "cc", "memory");
128#endif /* __GNUC__ */
129 return old;
130}
131
132static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
133{
134 int c, old;
135 c = atomic_read(v);
136 for (;;) {
137 if (unlikely(c == u))
138 break;
139 old = atomic_cmpxchg(v, c, c + a);
140 if (likely(old == c))
141 break;
142 c = old;
143 }
144 return c != u;
145}
146
147#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
148
149#undef __CS_LOOP
150
151#ifdef __s390x__
152typedef struct {
153 long long counter;
154} __attribute__ ((aligned (8))) atomic64_t;
155#define ATOMIC64_INIT(i) { (i) }
156
157#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
158
159#define __CSG_LOOP(ptr, op_val, op_string) ({ \
160 typeof(ptr->counter) old_val, new_val; \
161 asm volatile( \
162 " lg %0,%2\n" \
163 "0: lgr %1,%0\n" \
164 op_string " %1,%3\n" \
165 " csg %0,%1,%2\n" \
166 " jl 0b" \
167 : "=&d" (old_val), "=&d" (new_val), \
168 "=Q" (((atomic_t *)(ptr))->counter) \
169 : "d" (op_val), "Q" (((atomic_t *)(ptr))->counter) \
170 : "cc", "memory" ); \
171 new_val; \
172})
173
174#else /* __GNUC__ */
175
176#define __CSG_LOOP(ptr, op_val, op_string) ({ \
177 typeof(ptr->counter) old_val, new_val; \
178 asm volatile( \
179 " lg %0,0(%3)\n" \
180 "0: lgr %1,%0\n" \
181 op_string " %1,%4\n" \
182 " csg %0,%1,0(%3)\n" \
183 " jl 0b" \
184 : "=&d" (old_val), "=&d" (new_val), \
185 "=m" (((atomic_t *)(ptr))->counter) \
186 : "a" (ptr), "d" (op_val), \
187 "m" (((atomic_t *)(ptr))->counter) \
188 : "cc", "memory" ); \
189 new_val; \
190})
191
192#endif /* __GNUC__ */
193
194static inline long long atomic64_read(const atomic64_t *v)
195{
196 barrier();
197 return v->counter;
198}
199
200static inline void atomic64_set(atomic64_t *v, long long i)
201{
202 v->counter = i;
203 barrier();
204}
205
206static __inline__ long long atomic64_add_return(long long i, atomic64_t * v)
207{
208 return __CSG_LOOP(v, i, "agr");
209}
210#define atomic64_add(_i, _v) atomic64_add_return(_i, _v)
211#define atomic64_add_negative(_i, _v) (atomic64_add_return(_i, _v) < 0)
212#define atomic64_inc(_v) atomic64_add_return(1, _v)
213#define atomic64_inc_return(_v) atomic64_add_return(1, _v)
214#define atomic64_inc_and_test(_v) (atomic64_add_return(1, _v) == 0)
215
216static __inline__ long long atomic64_sub_return(long long i, atomic64_t * v)
217{
218 return __CSG_LOOP(v, i, "sgr");
219}
220#define atomic64_sub(_i, _v) atomic64_sub_return(_i, _v)
221#define atomic64_sub_and_test(_i, _v) (atomic64_sub_return(_i, _v) == 0)
222#define atomic64_dec(_v) atomic64_sub_return(1, _v)
223#define atomic64_dec_return(_v) atomic64_sub_return(1, _v)
224#define atomic64_dec_and_test(_v) (atomic64_sub_return(1, _v) == 0)
225
226static __inline__ void atomic64_clear_mask(unsigned long mask, atomic64_t * v)
227{
228 __CSG_LOOP(v, ~mask, "ngr");
229}
230
231static __inline__ void atomic64_set_mask(unsigned long mask, atomic64_t * v)
232{
233 __CSG_LOOP(v, mask, "ogr");
234}
235
236#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
237
238static __inline__ long long atomic64_cmpxchg(atomic64_t *v,
239 long long old, long long new)
240{
241#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
242 asm volatile(
243 " csg %0,%2,%1"
244 : "+d" (old), "=Q" (v->counter)
245 : "d" (new), "Q" (v->counter)
246 : "cc", "memory");
247#else /* __GNUC__ */
248 asm volatile(
249 " csg %0,%3,0(%2)"
250 : "+d" (old), "=m" (v->counter)
251 : "a" (v), "d" (new), "m" (v->counter)
252 : "cc", "memory");
253#endif /* __GNUC__ */
254 return old;
255}
256
257static __inline__ int atomic64_add_unless(atomic64_t *v,
258 long long a, long long u)
259{
260 long long c, old;
261 c = atomic64_read(v);
262 for (;;) {
263 if (unlikely(c == u))
264 break;
265 old = atomic64_cmpxchg(v, c, c + a);
266 if (likely(old == c))
267 break;
268 c = old;
269 }
270 return c != u;
271}
272
273#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
274
275#undef __CSG_LOOP
276#endif
277
278#define smp_mb__before_atomic_dec() smp_mb()
279#define smp_mb__after_atomic_dec() smp_mb()
280#define smp_mb__before_atomic_inc() smp_mb()
281#define smp_mb__after_atomic_inc() smp_mb()
282
283#include <asm-generic/atomic.h>
284#endif /* __KERNEL__ */
285#endif /* __ARCH_S390_ATOMIC__ */
diff --git a/arch/s390/include/asm/auxvec.h b/arch/s390/include/asm/auxvec.h
new file mode 100644
index 000000000000..0d340720fd99
--- /dev/null
+++ b/arch/s390/include/asm/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __ASMS390_AUXVEC_H
2#define __ASMS390_AUXVEC_H
3
4#endif
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
new file mode 100644
index 000000000000..b4eb24ab5af9
--- /dev/null
+++ b/arch/s390/include/asm/bitops.h
@@ -0,0 +1,884 @@
1#ifndef _S390_BITOPS_H
2#define _S390_BITOPS_H
3
4/*
5 * include/asm-s390/bitops.h
6 *
7 * S390 version
8 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
10 *
11 * Derived from "include/asm-i386/bitops.h"
12 * Copyright (C) 1992, Linus Torvalds
13 *
14 */
15
16#ifdef __KERNEL__
17
18#ifndef _LINUX_BITOPS_H
19#error only <linux/bitops.h> can be included directly
20#endif
21
22#include <linux/compiler.h>
23
24/*
25 * 32 bit bitops format:
26 * bit 0 is the LSB of *addr; bit 31 is the MSB of *addr;
27 * bit 32 is the LSB of *(addr+4). That combined with the
28 * big endian byte order on S390 give the following bit
29 * order in memory:
30 * 1f 1e 1d 1c 1b 1a 19 18 17 16 15 14 13 12 11 10 \
31 * 0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
32 * after that follows the next long with bit numbers
33 * 3f 3e 3d 3c 3b 3a 39 38 37 36 35 34 33 32 31 30
34 * 2f 2e 2d 2c 2b 2a 29 28 27 26 25 24 23 22 21 20
35 * The reason for this bit ordering is the fact that
36 * in the architecture independent code bits operations
37 * of the form "flags |= (1 << bitnr)" are used INTERMIXED
38 * with operation of the form "set_bit(bitnr, flags)".
39 *
40 * 64 bit bitops format:
41 * bit 0 is the LSB of *addr; bit 63 is the MSB of *addr;
42 * bit 64 is the LSB of *(addr+8). That combined with the
43 * big endian byte order on S390 give the following bit
44 * order in memory:
45 * 3f 3e 3d 3c 3b 3a 39 38 37 36 35 34 33 32 31 30
46 * 2f 2e 2d 2c 2b 2a 29 28 27 26 25 24 23 22 21 20
47 * 1f 1e 1d 1c 1b 1a 19 18 17 16 15 14 13 12 11 10
48 * 0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
49 * after that follows the next long with bit numbers
50 * 7f 7e 7d 7c 7b 7a 79 78 77 76 75 74 73 72 71 70
51 * 6f 6e 6d 6c 6b 6a 69 68 67 66 65 64 63 62 61 60
52 * 5f 5e 5d 5c 5b 5a 59 58 57 56 55 54 53 52 51 50
53 * 4f 4e 4d 4c 4b 4a 49 48 47 46 45 44 43 42 41 40
54 * The reason for this bit ordering is the fact that
55 * in the architecture independent code bits operations
56 * of the form "flags |= (1 << bitnr)" are used INTERMIXED
57 * with operation of the form "set_bit(bitnr, flags)".
58 */
59
60/* bitmap tables from arch/S390/kernel/bitmap.S */
61extern const char _oi_bitmap[];
62extern const char _ni_bitmap[];
63extern const char _zb_findmap[];
64extern const char _sb_findmap[];
65
66#ifndef __s390x__
67
68#define __BITOPS_ALIGN 3
69#define __BITOPS_WORDSIZE 32
70#define __BITOPS_OR "or"
71#define __BITOPS_AND "nr"
72#define __BITOPS_XOR "xr"
73
74#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
75
76#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
77 asm volatile( \
78 " l %0,%2\n" \
79 "0: lr %1,%0\n" \
80 __op_string " %1,%3\n" \
81 " cs %0,%1,%2\n" \
82 " jl 0b" \
83 : "=&d" (__old), "=&d" (__new), \
84 "=Q" (*(unsigned long *) __addr) \
85 : "d" (__val), "Q" (*(unsigned long *) __addr) \
86 : "cc");
87
88#else /* __GNUC__ */
89
90#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
91 asm volatile( \
92 " l %0,0(%4)\n" \
93 "0: lr %1,%0\n" \
94 __op_string " %1,%3\n" \
95 " cs %0,%1,0(%4)\n" \
96 " jl 0b" \
97 : "=&d" (__old), "=&d" (__new), \
98 "=m" (*(unsigned long *) __addr) \
99 : "d" (__val), "a" (__addr), \
100 "m" (*(unsigned long *) __addr) : "cc");
101
102#endif /* __GNUC__ */
103
104#else /* __s390x__ */
105
106#define __BITOPS_ALIGN 7
107#define __BITOPS_WORDSIZE 64
108#define __BITOPS_OR "ogr"
109#define __BITOPS_AND "ngr"
110#define __BITOPS_XOR "xgr"
111
112#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
113
114#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
115 asm volatile( \
116 " lg %0,%2\n" \
117 "0: lgr %1,%0\n" \
118 __op_string " %1,%3\n" \
119 " csg %0,%1,%2\n" \
120 " jl 0b" \
121 : "=&d" (__old), "=&d" (__new), \
122 "=Q" (*(unsigned long *) __addr) \
123 : "d" (__val), "Q" (*(unsigned long *) __addr) \
124 : "cc");
125
126#else /* __GNUC__ */
127
128#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string) \
129 asm volatile( \
130 " lg %0,0(%4)\n" \
131 "0: lgr %1,%0\n" \
132 __op_string " %1,%3\n" \
133 " csg %0,%1,0(%4)\n" \
134 " jl 0b" \
135 : "=&d" (__old), "=&d" (__new), \
136 "=m" (*(unsigned long *) __addr) \
137 : "d" (__val), "a" (__addr), \
138 "m" (*(unsigned long *) __addr) : "cc");
139
140
141#endif /* __GNUC__ */
142
143#endif /* __s390x__ */
144
145#define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE)
146#define __BITOPS_BARRIER() asm volatile("" : : : "memory")
147
148#ifdef CONFIG_SMP
149/*
150 * SMP safe set_bit routine based on compare and swap (CS)
151 */
152static inline void set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
153{
154 unsigned long addr, old, new, mask;
155
156 addr = (unsigned long) ptr;
157 /* calculate address for CS */
158 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
159 /* make OR mask */
160 mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1));
161 /* Do the atomic update. */
162 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_OR);
163}
164
165/*
166 * SMP safe clear_bit routine based on compare and swap (CS)
167 */
168static inline void clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
169{
170 unsigned long addr, old, new, mask;
171
172 addr = (unsigned long) ptr;
173 /* calculate address for CS */
174 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
175 /* make AND mask */
176 mask = ~(1UL << (nr & (__BITOPS_WORDSIZE - 1)));
177 /* Do the atomic update. */
178 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_AND);
179}
180
181/*
182 * SMP safe change_bit routine based on compare and swap (CS)
183 */
184static inline void change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
185{
186 unsigned long addr, old, new, mask;
187
188 addr = (unsigned long) ptr;
189 /* calculate address for CS */
190 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
191 /* make XOR mask */
192 mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1));
193 /* Do the atomic update. */
194 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_XOR);
195}
196
197/*
198 * SMP safe test_and_set_bit routine based on compare and swap (CS)
199 */
200static inline int
201test_and_set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
202{
203 unsigned long addr, old, new, mask;
204
205 addr = (unsigned long) ptr;
206 /* calculate address for CS */
207 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
208 /* make OR/test mask */
209 mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1));
210 /* Do the atomic update. */
211 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_OR);
212 __BITOPS_BARRIER();
213 return (old & mask) != 0;
214}
215
216/*
217 * SMP safe test_and_clear_bit routine based on compare and swap (CS)
218 */
219static inline int
220test_and_clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
221{
222 unsigned long addr, old, new, mask;
223
224 addr = (unsigned long) ptr;
225 /* calculate address for CS */
226 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
227 /* make AND/test mask */
228 mask = ~(1UL << (nr & (__BITOPS_WORDSIZE - 1)));
229 /* Do the atomic update. */
230 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_AND);
231 __BITOPS_BARRIER();
232 return (old ^ new) != 0;
233}
234
235/*
236 * SMP safe test_and_change_bit routine based on compare and swap (CS)
237 */
238static inline int
239test_and_change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
240{
241 unsigned long addr, old, new, mask;
242
243 addr = (unsigned long) ptr;
244 /* calculate address for CS */
245 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
246 /* make XOR/test mask */
247 mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1));
248 /* Do the atomic update. */
249 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_XOR);
250 __BITOPS_BARRIER();
251 return (old & mask) != 0;
252}
253#endif /* CONFIG_SMP */
254
255/*
256 * fast, non-SMP set_bit routine
257 */
258static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr)
259{
260 unsigned long addr;
261
262 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
263 asm volatile(
264 " oc 0(1,%1),0(%2)"
265 : "=m" (*(char *) addr) : "a" (addr),
266 "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" );
267}
268
269static inline void
270__constant_set_bit(const unsigned long nr, volatile unsigned long *ptr)
271{
272 unsigned long addr;
273
274 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
275 *(unsigned char *) addr |= 1 << (nr & 7);
276}
277
278#define set_bit_simple(nr,addr) \
279(__builtin_constant_p((nr)) ? \
280 __constant_set_bit((nr),(addr)) : \
281 __set_bit((nr),(addr)) )
282
283/*
284 * fast, non-SMP clear_bit routine
285 */
286static inline void
287__clear_bit(unsigned long nr, volatile unsigned long *ptr)
288{
289 unsigned long addr;
290
291 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
292 asm volatile(
293 " nc 0(1,%1),0(%2)"
294 : "=m" (*(char *) addr) : "a" (addr),
295 "a" (_ni_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc");
296}
297
298static inline void
299__constant_clear_bit(const unsigned long nr, volatile unsigned long *ptr)
300{
301 unsigned long addr;
302
303 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
304 *(unsigned char *) addr &= ~(1 << (nr & 7));
305}
306
307#define clear_bit_simple(nr,addr) \
308(__builtin_constant_p((nr)) ? \
309 __constant_clear_bit((nr),(addr)) : \
310 __clear_bit((nr),(addr)) )
311
312/*
313 * fast, non-SMP change_bit routine
314 */
315static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr)
316{
317 unsigned long addr;
318
319 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
320 asm volatile(
321 " xc 0(1,%1),0(%2)"
322 : "=m" (*(char *) addr) : "a" (addr),
323 "a" (_oi_bitmap + (nr & 7)), "m" (*(char *) addr) : "cc" );
324}
325
326static inline void
327__constant_change_bit(const unsigned long nr, volatile unsigned long *ptr)
328{
329 unsigned long addr;
330
331 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
332 *(unsigned char *) addr ^= 1 << (nr & 7);
333}
334
335#define change_bit_simple(nr,addr) \
336(__builtin_constant_p((nr)) ? \
337 __constant_change_bit((nr),(addr)) : \
338 __change_bit((nr),(addr)) )
339
340/*
341 * fast, non-SMP test_and_set_bit routine
342 */
343static inline int
344test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr)
345{
346 unsigned long addr;
347 unsigned char ch;
348
349 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
350 ch = *(unsigned char *) addr;
351 asm volatile(
352 " oc 0(1,%1),0(%2)"
353 : "=m" (*(char *) addr)
354 : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
355 "m" (*(char *) addr) : "cc", "memory");
356 return (ch >> (nr & 7)) & 1;
357}
358#define __test_and_set_bit(X,Y) test_and_set_bit_simple(X,Y)
359
360/*
361 * fast, non-SMP test_and_clear_bit routine
362 */
363static inline int
364test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr)
365{
366 unsigned long addr;
367 unsigned char ch;
368
369 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
370 ch = *(unsigned char *) addr;
371 asm volatile(
372 " nc 0(1,%1),0(%2)"
373 : "=m" (*(char *) addr)
374 : "a" (addr), "a" (_ni_bitmap + (nr & 7)),
375 "m" (*(char *) addr) : "cc", "memory");
376 return (ch >> (nr & 7)) & 1;
377}
378#define __test_and_clear_bit(X,Y) test_and_clear_bit_simple(X,Y)
379
380/*
381 * fast, non-SMP test_and_change_bit routine
382 */
383static inline int
384test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr)
385{
386 unsigned long addr;
387 unsigned char ch;
388
389 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
390 ch = *(unsigned char *) addr;
391 asm volatile(
392 " xc 0(1,%1),0(%2)"
393 : "=m" (*(char *) addr)
394 : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
395 "m" (*(char *) addr) : "cc", "memory");
396 return (ch >> (nr & 7)) & 1;
397}
398#define __test_and_change_bit(X,Y) test_and_change_bit_simple(X,Y)
399
400#ifdef CONFIG_SMP
401#define set_bit set_bit_cs
402#define clear_bit clear_bit_cs
403#define change_bit change_bit_cs
404#define test_and_set_bit test_and_set_bit_cs
405#define test_and_clear_bit test_and_clear_bit_cs
406#define test_and_change_bit test_and_change_bit_cs
407#else
408#define set_bit set_bit_simple
409#define clear_bit clear_bit_simple
410#define change_bit change_bit_simple
411#define test_and_set_bit test_and_set_bit_simple
412#define test_and_clear_bit test_and_clear_bit_simple
413#define test_and_change_bit test_and_change_bit_simple
414#endif
415
416
417/*
418 * This routine doesn't need to be atomic.
419 */
420
421static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr)
422{
423 unsigned long addr;
424 unsigned char ch;
425
426 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
427 ch = *(volatile unsigned char *) addr;
428 return (ch >> (nr & 7)) & 1;
429}
430
431static inline int
432__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) {
433 return (((volatile char *) addr)
434 [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7))) != 0;
435}
436
437#define test_bit(nr,addr) \
438(__builtin_constant_p((nr)) ? \
439 __constant_test_bit((nr),(addr)) : \
440 __test_bit((nr),(addr)) )
441
442/*
443 * Optimized find bit helper functions.
444 */
445
446/**
447 * __ffz_word_loop - find byte offset of first long != -1UL
448 * @addr: pointer to array of unsigned long
449 * @size: size of the array in bits
450 */
451static inline unsigned long __ffz_word_loop(const unsigned long *addr,
452 unsigned long size)
453{
454 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
455 unsigned long bytes = 0;
456
457 asm volatile(
458#ifndef __s390x__
459 " ahi %1,-1\n"
460 " sra %1,5\n"
461 " jz 1f\n"
462 "0: c %2,0(%0,%3)\n"
463 " jne 1f\n"
464 " la %0,4(%0)\n"
465 " brct %1,0b\n"
466 "1:\n"
467#else
468 " aghi %1,-1\n"
469 " srag %1,%1,6\n"
470 " jz 1f\n"
471 "0: cg %2,0(%0,%3)\n"
472 " jne 1f\n"
473 " la %0,8(%0)\n"
474 " brct %1,0b\n"
475 "1:\n"
476#endif
477 : "+&a" (bytes), "+&d" (size)
478 : "d" (-1UL), "a" (addr), "m" (*(addrtype *) addr)
479 : "cc" );
480 return bytes;
481}
482
483/**
484 * __ffs_word_loop - find byte offset of first long != 0UL
485 * @addr: pointer to array of unsigned long
486 * @size: size of the array in bits
487 */
488static inline unsigned long __ffs_word_loop(const unsigned long *addr,
489 unsigned long size)
490{
491 typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
492 unsigned long bytes = 0;
493
494 asm volatile(
495#ifndef __s390x__
496 " ahi %1,-1\n"
497 " sra %1,5\n"
498 " jz 1f\n"
499 "0: c %2,0(%0,%3)\n"
500 " jne 1f\n"
501 " la %0,4(%0)\n"
502 " brct %1,0b\n"
503 "1:\n"
504#else
505 " aghi %1,-1\n"
506 " srag %1,%1,6\n"
507 " jz 1f\n"
508 "0: cg %2,0(%0,%3)\n"
509 " jne 1f\n"
510 " la %0,8(%0)\n"
511 " brct %1,0b\n"
512 "1:\n"
513#endif
514 : "+&a" (bytes), "+&a" (size)
515 : "d" (0UL), "a" (addr), "m" (*(addrtype *) addr)
516 : "cc" );
517 return bytes;
518}
519
520/**
521 * __ffz_word - add number of the first unset bit
522 * @nr: base value the bit number is added to
523 * @word: the word that is searched for unset bits
524 */
525static inline unsigned long __ffz_word(unsigned long nr, unsigned long word)
526{
527#ifdef __s390x__
528 if (likely((word & 0xffffffff) == 0xffffffff)) {
529 word >>= 32;
530 nr += 32;
531 }
532#endif
533 if (likely((word & 0xffff) == 0xffff)) {
534 word >>= 16;
535 nr += 16;
536 }
537 if (likely((word & 0xff) == 0xff)) {
538 word >>= 8;
539 nr += 8;
540 }
541 return nr + _zb_findmap[(unsigned char) word];
542}
543
544/**
545 * __ffs_word - add number of the first set bit
546 * @nr: base value the bit number is added to
547 * @word: the word that is searched for set bits
548 */
549static inline unsigned long __ffs_word(unsigned long nr, unsigned long word)
550{
551#ifdef __s390x__
552 if (likely((word & 0xffffffff) == 0)) {
553 word >>= 32;
554 nr += 32;
555 }
556#endif
557 if (likely((word & 0xffff) == 0)) {
558 word >>= 16;
559 nr += 16;
560 }
561 if (likely((word & 0xff) == 0)) {
562 word >>= 8;
563 nr += 8;
564 }
565 return nr + _sb_findmap[(unsigned char) word];
566}
567
568
569/**
570 * __load_ulong_be - load big endian unsigned long
571 * @p: pointer to array of unsigned long
572 * @offset: byte offset of source value in the array
573 */
574static inline unsigned long __load_ulong_be(const unsigned long *p,
575 unsigned long offset)
576{
577 p = (unsigned long *)((unsigned long) p + offset);
578 return *p;
579}
580
581/**
582 * __load_ulong_le - load little endian unsigned long
583 * @p: pointer to array of unsigned long
584 * @offset: byte offset of source value in the array
585 */
586static inline unsigned long __load_ulong_le(const unsigned long *p,
587 unsigned long offset)
588{
589 unsigned long word;
590
591 p = (unsigned long *)((unsigned long) p + offset);
592#ifndef __s390x__
593 asm volatile(
594 " ic %0,0(%1)\n"
595 " icm %0,2,1(%1)\n"
596 " icm %0,4,2(%1)\n"
597 " icm %0,8,3(%1)"
598 : "=&d" (word) : "a" (p), "m" (*p) : "cc");
599#else
600 asm volatile(
601 " lrvg %0,%1"
602 : "=d" (word) : "m" (*p) );
603#endif
604 return word;
605}
606
607/*
608 * The various find bit functions.
609 */
610
611/*
612 * ffz - find first zero in word.
613 * @word: The word to search
614 *
615 * Undefined if no zero exists, so code should check against ~0UL first.
616 */
617static inline unsigned long ffz(unsigned long word)
618{
619 return __ffz_word(0, word);
620}
621
622/**
623 * __ffs - find first bit in word.
624 * @word: The word to search
625 *
626 * Undefined if no bit exists, so code should check against 0 first.
627 */
628static inline unsigned long __ffs (unsigned long word)
629{
630 return __ffs_word(0, word);
631}
632
633/**
634 * ffs - find first bit set
635 * @x: the word to search
636 *
637 * This is defined the same way as
638 * the libc and compiler builtin ffs routines, therefore
639 * differs in spirit from the above ffz (man ffs).
640 */
641static inline int ffs(int x)
642{
643 if (!x)
644 return 0;
645 return __ffs_word(1, x);
646}
647
648/**
649 * find_first_zero_bit - find the first zero bit in a memory region
650 * @addr: The address to start the search at
651 * @size: The maximum size to search
652 *
653 * Returns the bit-number of the first zero bit, not the number of the byte
654 * containing a bit.
655 */
656static inline unsigned long find_first_zero_bit(const unsigned long *addr,
657 unsigned long size)
658{
659 unsigned long bytes, bits;
660
661 if (!size)
662 return 0;
663 bytes = __ffz_word_loop(addr, size);
664 bits = __ffz_word(bytes*8, __load_ulong_be(addr, bytes));
665 return (bits < size) ? bits : size;
666}
667
668/**
669 * find_first_bit - find the first set bit in a memory region
670 * @addr: The address to start the search at
671 * @size: The maximum size to search
672 *
673 * Returns the bit-number of the first set bit, not the number of the byte
674 * containing a bit.
675 */
676static inline unsigned long find_first_bit(const unsigned long * addr,
677 unsigned long size)
678{
679 unsigned long bytes, bits;
680
681 if (!size)
682 return 0;
683 bytes = __ffs_word_loop(addr, size);
684 bits = __ffs_word(bytes*8, __load_ulong_be(addr, bytes));
685 return (bits < size) ? bits : size;
686}
687
688/**
689 * find_next_zero_bit - find the first zero bit in a memory region
690 * @addr: The address to base the search on
691 * @offset: The bitnumber to start searching at
692 * @size: The maximum size to search
693 */
694static inline int find_next_zero_bit (const unsigned long * addr,
695 unsigned long size,
696 unsigned long offset)
697{
698 const unsigned long *p;
699 unsigned long bit, set;
700
701 if (offset >= size)
702 return size;
703 bit = offset & (__BITOPS_WORDSIZE - 1);
704 offset -= bit;
705 size -= offset;
706 p = addr + offset / __BITOPS_WORDSIZE;
707 if (bit) {
708 /*
709 * __ffz_word returns __BITOPS_WORDSIZE
710 * if no zero bit is present in the word.
711 */
712 set = __ffz_word(0, *p >> bit) + bit;
713 if (set >= size)
714 return size + offset;
715 if (set < __BITOPS_WORDSIZE)
716 return set + offset;
717 offset += __BITOPS_WORDSIZE;
718 size -= __BITOPS_WORDSIZE;
719 p++;
720 }
721 return offset + find_first_zero_bit(p, size);
722}
723
724/**
725 * find_next_bit - find the first set bit in a memory region
726 * @addr: The address to base the search on
727 * @offset: The bitnumber to start searching at
728 * @size: The maximum size to search
729 */
730static inline int find_next_bit (const unsigned long * addr,
731 unsigned long size,
732 unsigned long offset)
733{
734 const unsigned long *p;
735 unsigned long bit, set;
736
737 if (offset >= size)
738 return size;
739 bit = offset & (__BITOPS_WORDSIZE - 1);
740 offset -= bit;
741 size -= offset;
742 p = addr + offset / __BITOPS_WORDSIZE;
743 if (bit) {
744 /*
745 * __ffs_word returns __BITOPS_WORDSIZE
746 * if no one bit is present in the word.
747 */
748 set = __ffs_word(0, *p & (~0UL << bit));
749 if (set >= size)
750 return size + offset;
751 if (set < __BITOPS_WORDSIZE)
752 return set + offset;
753 offset += __BITOPS_WORDSIZE;
754 size -= __BITOPS_WORDSIZE;
755 p++;
756 }
757 return offset + find_first_bit(p, size);
758}
759
760/*
761 * Every architecture must define this function. It's the fastest
762 * way of searching a 140-bit bitmap where the first 100 bits are
763 * unlikely to be set. It's guaranteed that at least one of the 140
764 * bits is cleared.
765 */
766static inline int sched_find_first_bit(unsigned long *b)
767{
768 return find_first_bit(b, 140);
769}
770
771#include <asm-generic/bitops/fls.h>
772#include <asm-generic/bitops/__fls.h>
773#include <asm-generic/bitops/fls64.h>
774
775#include <asm-generic/bitops/hweight.h>
776#include <asm-generic/bitops/lock.h>
777
778/*
779 * ATTENTION: intel byte ordering convention for ext2 and minix !!
780 * bit 0 is the LSB of addr; bit 31 is the MSB of addr;
781 * bit 32 is the LSB of (addr+4).
782 * That combined with the little endian byte order of Intel gives the
783 * following bit order in memory:
784 * 07 06 05 04 03 02 01 00 15 14 13 12 11 10 09 08 \
785 * 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24
786 */
787
788#define ext2_set_bit(nr, addr) \
789 __test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
790#define ext2_set_bit_atomic(lock, nr, addr) \
791 test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
792#define ext2_clear_bit(nr, addr) \
793 __test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
794#define ext2_clear_bit_atomic(lock, nr, addr) \
795 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
796#define ext2_test_bit(nr, addr) \
797 test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
798
799static inline int ext2_find_first_zero_bit(void *vaddr, unsigned int size)
800{
801 unsigned long bytes, bits;
802
803 if (!size)
804 return 0;
805 bytes = __ffz_word_loop(vaddr, size);
806 bits = __ffz_word(bytes*8, __load_ulong_le(vaddr, bytes));
807 return (bits < size) ? bits : size;
808}
809
810static inline int ext2_find_next_zero_bit(void *vaddr, unsigned long size,
811 unsigned long offset)
812{
813 unsigned long *addr = vaddr, *p;
814 unsigned long bit, set;
815
816 if (offset >= size)
817 return size;
818 bit = offset & (__BITOPS_WORDSIZE - 1);
819 offset -= bit;
820 size -= offset;
821 p = addr + offset / __BITOPS_WORDSIZE;
822 if (bit) {
823 /*
824 * s390 version of ffz returns __BITOPS_WORDSIZE
825 * if no zero bit is present in the word.
826 */
827 set = ffz(__load_ulong_le(p, 0) >> bit) + bit;
828 if (set >= size)
829 return size + offset;
830 if (set < __BITOPS_WORDSIZE)
831 return set + offset;
832 offset += __BITOPS_WORDSIZE;
833 size -= __BITOPS_WORDSIZE;
834 p++;
835 }
836 return offset + ext2_find_first_zero_bit(p, size);
837}
838
839static inline unsigned long ext2_find_first_bit(void *vaddr,
840 unsigned long size)
841{
842 unsigned long bytes, bits;
843
844 if (!size)
845 return 0;
846 bytes = __ffs_word_loop(vaddr, size);
847 bits = __ffs_word(bytes*8, __load_ulong_le(vaddr, bytes));
848 return (bits < size) ? bits : size;
849}
850
851static inline int ext2_find_next_bit(void *vaddr, unsigned long size,
852 unsigned long offset)
853{
854 unsigned long *addr = vaddr, *p;
855 unsigned long bit, set;
856
857 if (offset >= size)
858 return size;
859 bit = offset & (__BITOPS_WORDSIZE - 1);
860 offset -= bit;
861 size -= offset;
862 p = addr + offset / __BITOPS_WORDSIZE;
863 if (bit) {
864 /*
865 * s390 version of ffz returns __BITOPS_WORDSIZE
866 * if no zero bit is present in the word.
867 */
868 set = ffs(__load_ulong_le(p, 0) >> bit) + bit;
869 if (set >= size)
870 return size + offset;
871 if (set < __BITOPS_WORDSIZE)
872 return set + offset;
873 offset += __BITOPS_WORDSIZE;
874 size -= __BITOPS_WORDSIZE;
875 p++;
876 }
877 return offset + ext2_find_first_bit(p, size);
878}
879
880#include <asm-generic/bitops/minix.h>
881
882#endif /* __KERNEL__ */
883
884#endif /* _S390_BITOPS_H */
diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h
new file mode 100644
index 000000000000..384e3621e341
--- /dev/null
+++ b/arch/s390/include/asm/bug.h
@@ -0,0 +1,70 @@
1#ifndef _ASM_S390_BUG_H
2#define _ASM_S390_BUG_H
3
4#include <linux/kernel.h>
5
6#ifdef CONFIG_BUG
7
8#ifdef CONFIG_64BIT
9#define S390_LONG ".quad"
10#else
11#define S390_LONG ".long"
12#endif
13
14#ifdef CONFIG_DEBUG_BUGVERBOSE
15
16#define __EMIT_BUG(x) do { \
17 asm volatile( \
18 "0: j 0b+2\n" \
19 "1:\n" \
20 ".section .rodata.str,\"aMS\",@progbits,1\n" \
21 "2: .asciz \""__FILE__"\"\n" \
22 ".previous\n" \
23 ".section __bug_table,\"a\"\n" \
24 "3:\t" S390_LONG "\t1b,2b\n" \
25 " .short %0,%1\n" \
26 " .org 3b+%2\n" \
27 ".previous\n" \
28 : : "i" (__LINE__), \
29 "i" (x), \
30 "i" (sizeof(struct bug_entry))); \
31} while (0)
32
33#else /* CONFIG_DEBUG_BUGVERBOSE */
34
35#define __EMIT_BUG(x) do { \
36 asm volatile( \
37 "0: j 0b+2\n" \
38 "1:\n" \
39 ".section __bug_table,\"a\"\n" \
40 "2:\t" S390_LONG "\t1b\n" \
41 " .short %0\n" \
42 " .org 2b+%1\n" \
43 ".previous\n" \
44 : : "i" (x), \
45 "i" (sizeof(struct bug_entry))); \
46} while (0)
47
48#endif /* CONFIG_DEBUG_BUGVERBOSE */
49
50#define BUG() __EMIT_BUG(0)
51
52#define WARN_ON(x) ({ \
53 int __ret_warn_on = !!(x); \
54 if (__builtin_constant_p(__ret_warn_on)) { \
55 if (__ret_warn_on) \
56 __EMIT_BUG(BUGFLAG_WARNING); \
57 } else { \
58 if (unlikely(__ret_warn_on)) \
59 __EMIT_BUG(BUGFLAG_WARNING); \
60 } \
61 unlikely(__ret_warn_on); \
62})
63
64#define HAVE_ARCH_BUG
65#define HAVE_ARCH_WARN_ON
66#endif /* CONFIG_BUG */
67
68#include <asm-generic/bug.h>
69
70#endif /* _ASM_S390_BUG_H */
diff --git a/arch/s390/include/asm/bugs.h b/arch/s390/include/asm/bugs.h
new file mode 100644
index 000000000000..011f1e6a2a6c
--- /dev/null
+++ b/arch/s390/include/asm/bugs.h
@@ -0,0 +1,22 @@
1/*
2 * include/asm-s390/bugs.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * Derived from "include/asm-i386/bugs.h"
9 * Copyright (C) 1994 Linus Torvalds
10 */
11
12/*
13 * This is included by init/main.c to check for architecture-dependent bugs.
14 *
15 * Needs:
16 * void check_bugs(void);
17 */
18
19static inline void check_bugs(void)
20{
21 /* s390 has no bugs ... */
22}
diff --git a/arch/s390/include/asm/byteorder.h b/arch/s390/include/asm/byteorder.h
new file mode 100644
index 000000000000..1fe2492baa8d
--- /dev/null
+++ b/arch/s390/include/asm/byteorder.h
@@ -0,0 +1,125 @@
1#ifndef _S390_BYTEORDER_H
2#define _S390_BYTEORDER_H
3
4/*
5 * include/asm-s390/byteorder.h
6 *
7 * S390 version
8 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
10 */
11
12#include <asm/types.h>
13
14#ifdef __GNUC__
15
16#ifdef __s390x__
17static inline __u64 ___arch__swab64p(const __u64 *x)
18{
19 __u64 result;
20
21 asm volatile("lrvg %0,%1" : "=d" (result) : "m" (*x));
22 return result;
23}
24
25static inline __u64 ___arch__swab64(__u64 x)
26{
27 __u64 result;
28
29 asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x));
30 return result;
31}
32
33static inline void ___arch__swab64s(__u64 *x)
34{
35 *x = ___arch__swab64p(x);
36}
37#endif /* __s390x__ */
38
39static inline __u32 ___arch__swab32p(const __u32 *x)
40{
41 __u32 result;
42
43 asm volatile(
44#ifndef __s390x__
45 " icm %0,8,3(%1)\n"
46 " icm %0,4,2(%1)\n"
47 " icm %0,2,1(%1)\n"
48 " ic %0,0(%1)"
49 : "=&d" (result) : "a" (x), "m" (*x) : "cc");
50#else /* __s390x__ */
51 " lrv %0,%1"
52 : "=d" (result) : "m" (*x));
53#endif /* __s390x__ */
54 return result;
55}
56
57static inline __u32 ___arch__swab32(__u32 x)
58{
59#ifndef __s390x__
60 return ___arch__swab32p(&x);
61#else /* __s390x__ */
62 __u32 result;
63
64 asm volatile("lrvr %0,%1" : "=d" (result) : "d" (x));
65 return result;
66#endif /* __s390x__ */
67}
68
69static __inline__ void ___arch__swab32s(__u32 *x)
70{
71 *x = ___arch__swab32p(x);
72}
73
74static __inline__ __u16 ___arch__swab16p(const __u16 *x)
75{
76 __u16 result;
77
78 asm volatile(
79#ifndef __s390x__
80 " icm %0,2,1(%1)\n"
81 " ic %0,0(%1)\n"
82 : "=&d" (result) : "a" (x), "m" (*x) : "cc");
83#else /* __s390x__ */
84 " lrvh %0,%1"
85 : "=d" (result) : "m" (*x));
86#endif /* __s390x__ */
87 return result;
88}
89
90static __inline__ __u16 ___arch__swab16(__u16 x)
91{
92 return ___arch__swab16p(&x);
93}
94
95static __inline__ void ___arch__swab16s(__u16 *x)
96{
97 *x = ___arch__swab16p(x);
98}
99
100#ifdef __s390x__
101#define __arch__swab64(x) ___arch__swab64(x)
102#define __arch__swab64p(x) ___arch__swab64p(x)
103#define __arch__swab64s(x) ___arch__swab64s(x)
104#endif /* __s390x__ */
105#define __arch__swab32(x) ___arch__swab32(x)
106#define __arch__swab16(x) ___arch__swab16(x)
107#define __arch__swab32p(x) ___arch__swab32p(x)
108#define __arch__swab16p(x) ___arch__swab16p(x)
109#define __arch__swab32s(x) ___arch__swab32s(x)
110#define __arch__swab16s(x) ___arch__swab16s(x)
111
112#ifndef __s390x__
113#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
114# define __BYTEORDER_HAS_U64__
115# define __SWAB_64_THRU_32__
116#endif
117#else /* __s390x__ */
118#define __BYTEORDER_HAS_U64__
119#endif /* __s390x__ */
120
121#endif /* __GNUC__ */
122
123#include <linux/byteorder/big_endian.h>
124
125#endif /* _S390_BYTEORDER_H */
diff --git a/arch/s390/include/asm/cache.h b/arch/s390/include/asm/cache.h
new file mode 100644
index 000000000000..9b866816863c
--- /dev/null
+++ b/arch/s390/include/asm/cache.h
@@ -0,0 +1,19 @@
1/*
2 * include/asm-s390/cache.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 *
7 * Derived from "include/asm-i386/cache.h"
8 * Copyright (C) 1992, Linus Torvalds
9 */
10
11#ifndef __ARCH_S390_CACHE_H
12#define __ARCH_S390_CACHE_H
13
14#define L1_CACHE_BYTES 256
15#define L1_CACHE_SHIFT 8
16
17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18
19#endif
diff --git a/arch/s390/include/asm/cacheflush.h b/arch/s390/include/asm/cacheflush.h
new file mode 100644
index 000000000000..49d5af916d01
--- /dev/null
+++ b/arch/s390/include/asm/cacheflush.h
@@ -0,0 +1,31 @@
1#ifndef _S390_CACHEFLUSH_H
2#define _S390_CACHEFLUSH_H
3
4/* Keep includes the same across arches. */
5#include <linux/mm.h>
6
7/* Caches aren't brain-dead on the s390. */
8#define flush_cache_all() do { } while (0)
9#define flush_cache_mm(mm) do { } while (0)
10#define flush_cache_dup_mm(mm) do { } while (0)
11#define flush_cache_range(vma, start, end) do { } while (0)
12#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
13#define flush_dcache_page(page) do { } while (0)
14#define flush_dcache_mmap_lock(mapping) do { } while (0)
15#define flush_dcache_mmap_unlock(mapping) do { } while (0)
16#define flush_icache_range(start, end) do { } while (0)
17#define flush_icache_page(vma,pg) do { } while (0)
18#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
19#define flush_cache_vmap(start, end) do { } while (0)
20#define flush_cache_vunmap(start, end) do { } while (0)
21
22#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
23 memcpy(dst, src, len)
24#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
25 memcpy(dst, src, len)
26
27#ifdef CONFIG_DEBUG_PAGEALLOC
28void kernel_map_pages(struct page *page, int numpages, int enable);
29#endif
30
31#endif /* _S390_CACHEFLUSH_H */
diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h
new file mode 100644
index 000000000000..ba007d8df941
--- /dev/null
+++ b/arch/s390/include/asm/ccwdev.h
@@ -0,0 +1,192 @@
1/*
2 * include/asm-s390/ccwdev.h
3 * include/asm-s390x/ccwdev.h
4 *
5 * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Arnd Bergmann <arndb@de.ibm.com>
7 *
8 * Interface for CCW device drivers
9 */
10#ifndef _S390_CCWDEV_H_
11#define _S390_CCWDEV_H_
12
13#include <linux/device.h>
14#include <linux/mod_devicetable.h>
15#include <asm/fcx.h>
16
17/* structs from asm/cio.h */
18struct irb;
19struct ccw1;
20struct ccw_dev_id;
21
22/* simplified initializers for struct ccw_device:
23 * CCW_DEVICE and CCW_DEVICE_DEVTYPE initialize one
24 * entry in your MODULE_DEVICE_TABLE and set the match_flag correctly */
25#define CCW_DEVICE(cu, cum) \
26 .cu_type=(cu), .cu_model=(cum), \
27 .match_flags=(CCW_DEVICE_ID_MATCH_CU_TYPE \
28 | (cum ? CCW_DEVICE_ID_MATCH_CU_MODEL : 0))
29
30#define CCW_DEVICE_DEVTYPE(cu, cum, dev, devm) \
31 .cu_type=(cu), .cu_model=(cum), .dev_type=(dev), .dev_model=(devm),\
32 .match_flags=CCW_DEVICE_ID_MATCH_CU_TYPE \
33 | ((cum) ? CCW_DEVICE_ID_MATCH_CU_MODEL : 0) \
34 | CCW_DEVICE_ID_MATCH_DEVICE_TYPE \
35 | ((devm) ? CCW_DEVICE_ID_MATCH_DEVICE_MODEL : 0)
36
37/* scan through an array of device ids and return the first
38 * entry that matches the device.
39 *
40 * the array must end with an entry containing zero match_flags
41 */
42static inline const struct ccw_device_id *
43ccw_device_id_match(const struct ccw_device_id *array,
44 const struct ccw_device_id *match)
45{
46 const struct ccw_device_id *id = array;
47
48 for (id = array; id->match_flags; id++) {
49 if ((id->match_flags & CCW_DEVICE_ID_MATCH_CU_TYPE)
50 && (id->cu_type != match->cu_type))
51 continue;
52
53 if ((id->match_flags & CCW_DEVICE_ID_MATCH_CU_MODEL)
54 && (id->cu_model != match->cu_model))
55 continue;
56
57 if ((id->match_flags & CCW_DEVICE_ID_MATCH_DEVICE_TYPE)
58 && (id->dev_type != match->dev_type))
59 continue;
60
61 if ((id->match_flags & CCW_DEVICE_ID_MATCH_DEVICE_MODEL)
62 && (id->dev_model != match->dev_model))
63 continue;
64
65 return id;
66 }
67
68 return NULL;
69}
70
71/**
72 * struct ccw_device - channel attached device
73 * @ccwlock: pointer to device lock
74 * @id: id of this device
75 * @drv: ccw driver for this device
76 * @dev: embedded device structure
77 * @online: online status of device
78 * @handler: interrupt handler
79 *
80 * @handler is a member of the device rather than the driver since a driver
81 * can have different interrupt handlers for different ccw devices
82 * (multi-subchannel drivers).
83 */
84struct ccw_device {
85 spinlock_t *ccwlock;
86/* private: */
87 struct ccw_device_private *private; /* cio private information */
88/* public: */
89 struct ccw_device_id id;
90 struct ccw_driver *drv;
91 struct device dev;
92 int online;
93 void (*handler) (struct ccw_device *, unsigned long, struct irb *);
94};
95
96
97/**
98 * struct ccw driver - device driver for channel attached devices
99 * @owner: owning module
100 * @ids: ids supported by this driver
101 * @probe: function called on probe
102 * @remove: function called on remove
103 * @set_online: called when setting device online
104 * @set_offline: called when setting device offline
105 * @notify: notify driver of device state changes
106 * @shutdown: called at device shutdown
107 * @driver: embedded device driver structure
108 * @name: device driver name
109 */
110struct ccw_driver {
111 struct module *owner;
112 struct ccw_device_id *ids;
113 int (*probe) (struct ccw_device *);
114 void (*remove) (struct ccw_device *);
115 int (*set_online) (struct ccw_device *);
116 int (*set_offline) (struct ccw_device *);
117 int (*notify) (struct ccw_device *, int);
118 void (*shutdown) (struct ccw_device *);
119 struct device_driver driver;
120 char *name;
121};
122
123extern struct ccw_device *get_ccwdev_by_busid(struct ccw_driver *cdrv,
124 const char *bus_id);
125
126/* devices drivers call these during module load and unload.
127 * When a driver is registered, its probe method is called
128 * when new devices for its type pop up */
129extern int ccw_driver_register (struct ccw_driver *driver);
130extern void ccw_driver_unregister (struct ccw_driver *driver);
131
132struct ccw1;
133
134extern int ccw_device_set_options_mask(struct ccw_device *, unsigned long);
135extern int ccw_device_set_options(struct ccw_device *, unsigned long);
136extern void ccw_device_clear_options(struct ccw_device *, unsigned long);
137
138/* Allow for i/o completion notification after primary interrupt status. */
139#define CCWDEV_EARLY_NOTIFICATION 0x0001
140/* Report all interrupt conditions. */
141#define CCWDEV_REPORT_ALL 0x0002
142/* Try to perform path grouping. */
143#define CCWDEV_DO_PATHGROUP 0x0004
144/* Allow forced onlining of boxed devices. */
145#define CCWDEV_ALLOW_FORCE 0x0008
146
147extern int ccw_device_start(struct ccw_device *, struct ccw1 *,
148 unsigned long, __u8, unsigned long);
149extern int ccw_device_start_timeout(struct ccw_device *, struct ccw1 *,
150 unsigned long, __u8, unsigned long, int);
151extern int ccw_device_start_key(struct ccw_device *, struct ccw1 *,
152 unsigned long, __u8, __u8, unsigned long);
153extern int ccw_device_start_timeout_key(struct ccw_device *, struct ccw1 *,
154 unsigned long, __u8, __u8,
155 unsigned long, int);
156
157
158extern int ccw_device_resume(struct ccw_device *);
159extern int ccw_device_halt(struct ccw_device *, unsigned long);
160extern int ccw_device_clear(struct ccw_device *, unsigned long);
161int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw,
162 unsigned long intparm, u8 lpm, u8 key);
163int ccw_device_tm_start_key(struct ccw_device *, struct tcw *,
164 unsigned long, u8, u8);
165int ccw_device_tm_start_timeout_key(struct ccw_device *, struct tcw *,
166 unsigned long, u8, u8, int);
167int ccw_device_tm_start(struct ccw_device *, struct tcw *,
168 unsigned long, u8);
169int ccw_device_tm_start_timeout(struct ccw_device *, struct tcw *,
170 unsigned long, u8, int);
171int ccw_device_tm_intrg(struct ccw_device *cdev);
172
173extern int ccw_device_set_online(struct ccw_device *cdev);
174extern int ccw_device_set_offline(struct ccw_device *cdev);
175
176
177extern struct ciw *ccw_device_get_ciw(struct ccw_device *, __u32 cmd);
178extern __u8 ccw_device_get_path_mask(struct ccw_device *);
179extern void ccw_device_get_id(struct ccw_device *, struct ccw_dev_id *);
180
181#define get_ccwdev_lock(x) (x)->ccwlock
182
183#define to_ccwdev(n) container_of(n, struct ccw_device, dev)
184#define to_ccwdrv(n) container_of(n, struct ccw_driver, driver)
185
186extern struct ccw_device *ccw_device_probe_console(void);
187
188// FIXME: these have to go
189extern int _ccw_device_get_subchannel_number(struct ccw_device *);
190
191extern void *ccw_device_get_chp_desc(struct ccw_device *, int);
192#endif /* _S390_CCWDEV_H_ */
diff --git a/arch/s390/include/asm/ccwgroup.h b/arch/s390/include/asm/ccwgroup.h
new file mode 100644
index 000000000000..a27f68985a79
--- /dev/null
+++ b/arch/s390/include/asm/ccwgroup.h
@@ -0,0 +1,69 @@
1#ifndef S390_CCWGROUP_H
2#define S390_CCWGROUP_H
3
4struct ccw_device;
5struct ccw_driver;
6
7/**
8 * struct ccwgroup_device - ccw group device
9 * @creator_id: unique number of the driver
10 * @state: online/offline state
11 * @count: number of attached slave devices
12 * @dev: embedded device structure
13 * @cdev: variable number of slave devices, allocated as needed
14 */
15struct ccwgroup_device {
16 unsigned long creator_id;
17 enum {
18 CCWGROUP_OFFLINE,
19 CCWGROUP_ONLINE,
20 } state;
21/* private: */
22 atomic_t onoff;
23 struct mutex reg_mutex;
24/* public: */
25 unsigned int count;
26 struct device dev;
27 struct ccw_device *cdev[0];
28};
29
30/**
31 * struct ccwgroup_driver - driver for ccw group devices
32 * @owner: driver owner
33 * @name: driver name
34 * @max_slaves: maximum number of slave devices
35 * @driver_id: unique id
36 * @probe: function called on probe
37 * @remove: function called on remove
38 * @set_online: function called when device is set online
39 * @set_offline: function called when device is set offline
40 * @shutdown: function called when device is shut down
41 * @driver: embedded driver structure
42 */
43struct ccwgroup_driver {
44 struct module *owner;
45 char *name;
46 int max_slaves;
47 unsigned long driver_id;
48
49 int (*probe) (struct ccwgroup_device *);
50 void (*remove) (struct ccwgroup_device *);
51 int (*set_online) (struct ccwgroup_device *);
52 int (*set_offline) (struct ccwgroup_device *);
53 void (*shutdown)(struct ccwgroup_device *);
54
55 struct device_driver driver;
56};
57
58extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver);
59extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver);
60int ccwgroup_create_from_string(struct device *root, unsigned int creator_id,
61 struct ccw_driver *cdrv, int num_devices,
62 const char *buf);
63
64extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
65extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);
66
67#define to_ccwgroupdev(x) container_of((x), struct ccwgroup_device, dev)
68#define to_ccwgroupdrv(x) container_of((x), struct ccwgroup_driver, driver)
69#endif
diff --git a/arch/s390/include/asm/checksum.h b/arch/s390/include/asm/checksum.h
new file mode 100644
index 000000000000..d5a8e7c1477c
--- /dev/null
+++ b/arch/s390/include/asm/checksum.h
@@ -0,0 +1,166 @@
1#ifndef _S390_CHECKSUM_H
2#define _S390_CHECKSUM_H
3
4/*
5 * include/asm-s390/checksum.h
6 * S390 fast network checksum routines
7 * see also arch/S390/lib/checksum.c
8 *
9 * S390 version
10 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
11 * Author(s): Ulrich Hild (first version)
12 * Martin Schwidefsky (heavily optimized CKSM version)
13 * D.J. Barrow (third attempt)
14 */
15
16#include <asm/uaccess.h>
17
18/*
19 * computes the checksum of a memory block at buff, length len,
20 * and adds in "sum" (32-bit)
21 *
22 * returns a 32-bit number suitable for feeding into itself
23 * or csum_tcpudp_magic
24 *
25 * this function must be called with even lengths, except
26 * for the last fragment, which may be odd
27 *
28 * it's best to have buff aligned on a 32-bit boundary
29 */
30static inline __wsum
31csum_partial(const void *buff, int len, __wsum sum)
32{
33 register unsigned long reg2 asm("2") = (unsigned long) buff;
34 register unsigned long reg3 asm("3") = (unsigned long) len;
35
36 asm volatile(
37 "0: cksm %0,%1\n" /* do checksum on longs */
38 " jo 0b\n"
39 : "+d" (sum), "+d" (reg2), "+d" (reg3) : : "cc", "memory");
40 return sum;
41}
42
43/*
44 * the same as csum_partial_copy, but copies from user space.
45 *
46 * here even more important to align src and dst on a 32-bit (or even
47 * better 64-bit) boundary
48 *
49 * Copy from userspace and compute checksum. If we catch an exception
50 * then zero the rest of the buffer.
51 */
52static inline __wsum
53csum_partial_copy_from_user(const void __user *src, void *dst,
54 int len, __wsum sum,
55 int *err_ptr)
56{
57 int missing;
58
59 missing = copy_from_user(dst, src, len);
60 if (missing) {
61 memset(dst + len - missing, 0, missing);
62 *err_ptr = -EFAULT;
63 }
64
65 return csum_partial(dst, len, sum);
66}
67
68
69static inline __wsum
70csum_partial_copy_nocheck (const void *src, void *dst, int len, __wsum sum)
71{
72 memcpy(dst,src,len);
73 return csum_partial(dst, len, sum);
74}
75
76/*
77 * Fold a partial checksum without adding pseudo headers
78 */
79static inline __sum16 csum_fold(__wsum sum)
80{
81#ifndef __s390x__
82 register_pair rp;
83
84 asm volatile(
85 " slr %N1,%N1\n" /* %0 = H L */
86 " lr %1,%0\n" /* %0 = H L, %1 = H L 0 0 */
87 " srdl %1,16\n" /* %0 = H L, %1 = 0 H L 0 */
88 " alr %1,%N1\n" /* %0 = H L, %1 = L H L 0 */
89 " alr %0,%1\n" /* %0 = H+L+C L+H */
90 " srl %0,16\n" /* %0 = H+L+C */
91 : "+&d" (sum), "=d" (rp) : : "cc");
92#else /* __s390x__ */
93 asm volatile(
94 " sr 3,3\n" /* %0 = H*65536 + L */
95 " lr 2,%0\n" /* %0 = H L, 2/3 = H L / 0 0 */
96 " srdl 2,16\n" /* %0 = H L, 2/3 = 0 H / L 0 */
97 " alr 2,3\n" /* %0 = H L, 2/3 = L H / L 0 */
98 " alr %0,2\n" /* %0 = H+L+C L+H */
99 " srl %0,16\n" /* %0 = H+L+C */
100 : "+&d" (sum) : : "cc", "2", "3");
101#endif /* __s390x__ */
102 return (__force __sum16) ~sum;
103}
104
105/*
106 * This is a version of ip_compute_csum() optimized for IP headers,
107 * which always checksum on 4 octet boundaries.
108 *
109 */
110static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
111{
112 return csum_fold(csum_partial(iph, ihl*4, 0));
113}
114
115/*
116 * computes the checksum of the TCP/UDP pseudo-header
117 * returns a 32-bit checksum
118 */
119static inline __wsum
120csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
121 unsigned short len, unsigned short proto,
122 __wsum sum)
123{
124 __u32 csum = (__force __u32)sum;
125
126 csum += (__force __u32)saddr;
127 if (csum < (__force __u32)saddr)
128 csum++;
129
130 csum += (__force __u32)daddr;
131 if (csum < (__force __u32)daddr)
132 csum++;
133
134 csum += len + proto;
135 if (csum < len + proto)
136 csum++;
137
138 return (__force __wsum)csum;
139}
140
141/*
142 * computes the checksum of the TCP/UDP pseudo-header
143 * returns a 16-bit checksum, already complemented
144 */
145
146static inline __sum16
147csum_tcpudp_magic(__be32 saddr, __be32 daddr,
148 unsigned short len, unsigned short proto,
149 __wsum sum)
150{
151 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
152}
153
154/*
155 * this routine is used for miscellaneous IP-like checksums, mainly
156 * in icmp.c
157 */
158
159static inline __sum16 ip_compute_csum(const void *buff, int len)
160{
161 return csum_fold(csum_partial(buff, len, 0));
162}
163
164#endif /* _S390_CHECKSUM_H */
165
166
diff --git a/arch/s390/include/asm/chpid.h b/arch/s390/include/asm/chpid.h
new file mode 100644
index 000000000000..dfe3c7f3439a
--- /dev/null
+++ b/arch/s390/include/asm/chpid.h
@@ -0,0 +1,56 @@
1/*
2 * drivers/s390/cio/chpid.h
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_CHPID_H
9#define _ASM_S390_CHPID_H _ASM_S390_CHPID_H
10
11#include <linux/string.h>
12#include <asm/types.h>
13
14#define __MAX_CHPID 255
15
16struct chp_id {
17 u8 reserved1;
18 u8 cssid;
19 u8 reserved2;
20 u8 id;
21} __attribute__((packed));
22
23#ifdef __KERNEL__
24#include <asm/cio.h>
25
26static inline void chp_id_init(struct chp_id *chpid)
27{
28 memset(chpid, 0, sizeof(struct chp_id));
29}
30
31static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b)
32{
33 return (a->id == b->id) && (a->cssid == b->cssid);
34}
35
36static inline void chp_id_next(struct chp_id *chpid)
37{
38 if (chpid->id < __MAX_CHPID)
39 chpid->id++;
40 else {
41 chpid->id = 0;
42 chpid->cssid++;
43 }
44}
45
46static inline int chp_id_is_valid(struct chp_id *chpid)
47{
48 return (chpid->cssid <= __MAX_CSSID);
49}
50
51
52#define chp_id_for_each(c) \
53 for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c))
54#endif /* __KERNEL */
55
56#endif /* _ASM_S390_CHPID_H */
diff --git a/arch/s390/include/asm/chsc.h b/arch/s390/include/asm/chsc.h
new file mode 100644
index 000000000000..d38d0cf62d4b
--- /dev/null
+++ b/arch/s390/include/asm/chsc.h
@@ -0,0 +1,127 @@
1/*
2 * ioctl interface for /dev/chsc
3 *
4 * Copyright 2008 IBM Corp.
5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6 */
7
8#ifndef _ASM_CHSC_H
9#define _ASM_CHSC_H
10
11#include <asm/chpid.h>
12#include <asm/schid.h>
13
14struct chsc_async_header {
15 __u16 length;
16 __u16 code;
17 __u32 cmd_dependend;
18 __u32 key : 4;
19 __u32 : 28;
20 struct subchannel_id sid;
21} __attribute__ ((packed));
22
23struct chsc_async_area {
24 struct chsc_async_header header;
25 __u8 data[PAGE_SIZE - 16 /* size of chsc_async_header */];
26} __attribute__ ((packed));
27
28
29struct chsc_response_struct {
30 __u16 length;
31 __u16 code;
32 __u32 parms;
33 __u8 data[PAGE_SIZE - 8];
34} __attribute__ ((packed));
35
36struct chsc_chp_cd {
37 struct chp_id chpid;
38 int m;
39 int fmt;
40 struct chsc_response_struct cpcb;
41};
42
43struct chsc_cu_cd {
44 __u16 cun;
45 __u8 cssid;
46 int m;
47 int fmt;
48 struct chsc_response_struct cucb;
49};
50
51struct chsc_sch_cud {
52 struct subchannel_id schid;
53 int fmt;
54 struct chsc_response_struct scub;
55};
56
57struct conf_id {
58 int m;
59 __u8 cssid;
60 __u8 ssid;
61};
62
63struct chsc_conf_info {
64 struct conf_id id;
65 int fmt;
66 struct chsc_response_struct scid;
67};
68
69struct ccl_parm_chpid {
70 int m;
71 struct chp_id chp;
72};
73
74struct ccl_parm_cssids {
75 __u8 f_cssid;
76 __u8 l_cssid;
77};
78
79struct chsc_comp_list {
80 struct {
81 enum {
82 CCL_CU_ON_CHP = 1,
83 CCL_CHP_TYPE_CAP = 2,
84 CCL_CSS_IMG = 4,
85 CCL_CSS_IMG_CONF_CHAR = 5,
86 CCL_IOP_CHP = 6,
87 } ctype;
88 int fmt;
89 struct ccl_parm_chpid chpid;
90 struct ccl_parm_cssids cssids;
91 } req;
92 struct chsc_response_struct sccl;
93};
94
95struct chsc_dcal {
96 struct {
97 enum {
98 DCAL_CSS_IID_PN = 4,
99 } atype;
100 __u32 list_parm[2];
101 int fmt;
102 } req;
103 struct chsc_response_struct sdcal;
104};
105
106struct chsc_cpd_info {
107 struct chp_id chpid;
108 int m;
109 int fmt;
110 int rfmt;
111 int c;
112 struct chsc_response_struct chpdb;
113};
114
115#define CHSC_IOCTL_MAGIC 'c'
116
117#define CHSC_START _IOWR(CHSC_IOCTL_MAGIC, 0x81, struct chsc_async_area)
118#define CHSC_INFO_CHANNEL_PATH _IOWR(CHSC_IOCTL_MAGIC, 0x82, \
119 struct chsc_chp_cd)
120#define CHSC_INFO_CU _IOWR(CHSC_IOCTL_MAGIC, 0x83, struct chsc_cu_cd)
121#define CHSC_INFO_SCH_CU _IOWR(CHSC_IOCTL_MAGIC, 0x84, struct chsc_sch_cud)
122#define CHSC_INFO_CI _IOWR(CHSC_IOCTL_MAGIC, 0x85, struct chsc_conf_info)
123#define CHSC_INFO_CCL _IOWR(CHSC_IOCTL_MAGIC, 0x86, struct chsc_comp_list)
124#define CHSC_INFO_CPD _IOWR(CHSC_IOCTL_MAGIC, 0x87, struct chsc_cpd_info)
125#define CHSC_INFO_DCAL _IOWR(CHSC_IOCTL_MAGIC, 0x88, struct chsc_dcal)
126
127#endif
diff --git a/arch/s390/include/asm/cio.h b/arch/s390/include/asm/cio.h
new file mode 100644
index 000000000000..6dccb071aec3
--- /dev/null
+++ b/arch/s390/include/asm/cio.h
@@ -0,0 +1,514 @@
1/*
2 * include/asm-s390/cio.h
3 * include/asm-s390x/cio.h
4 *
5 * Common interface for I/O on S/390
6 */
7#ifndef _ASM_S390_CIO_H_
8#define _ASM_S390_CIO_H_
9
10#include <linux/spinlock.h>
11#include <asm/types.h>
12
13#ifdef __KERNEL__
14
15#define LPM_ANYPATH 0xff
16#define __MAX_CSSID 0
17
18/**
19 * struct cmd_scsw - command-mode subchannel status word
20 * @key: subchannel key
21 * @sctl: suspend control
22 * @eswf: esw format
23 * @cc: deferred condition code
24 * @fmt: format
25 * @pfch: prefetch
26 * @isic: initial-status interruption control
27 * @alcc: address-limit checking control
28 * @ssi: suppress-suspended interruption
29 * @zcc: zero condition code
30 * @ectl: extended control
31 * @pno: path not operational
32 * @res: reserved
33 * @fctl: function control
34 * @actl: activity control
35 * @stctl: status control
36 * @cpa: channel program address
37 * @dstat: device status
38 * @cstat: subchannel status
39 * @count: residual count
40 */
41struct cmd_scsw {
42 __u32 key : 4;
43 __u32 sctl : 1;
44 __u32 eswf : 1;
45 __u32 cc : 2;
46 __u32 fmt : 1;
47 __u32 pfch : 1;
48 __u32 isic : 1;
49 __u32 alcc : 1;
50 __u32 ssi : 1;
51 __u32 zcc : 1;
52 __u32 ectl : 1;
53 __u32 pno : 1;
54 __u32 res : 1;
55 __u32 fctl : 3;
56 __u32 actl : 7;
57 __u32 stctl : 5;
58 __u32 cpa;
59 __u32 dstat : 8;
60 __u32 cstat : 8;
61 __u32 count : 16;
62} __attribute__ ((packed));
63
64/**
65 * struct tm_scsw - transport-mode subchannel status word
66 * @key: subchannel key
67 * @eswf: esw format
68 * @cc: deferred condition code
69 * @fmt: format
70 * @x: IRB-format control
71 * @q: interrogate-complete
72 * @ectl: extended control
73 * @pno: path not operational
74 * @fctl: function control
75 * @actl: activity control
76 * @stctl: status control
77 * @tcw: TCW address
78 * @dstat: device status
79 * @cstat: subchannel status
80 * @fcxs: FCX status
81 * @schxs: subchannel-extended status
82 */
83struct tm_scsw {
84 u32 key:4;
85 u32 :1;
86 u32 eswf:1;
87 u32 cc:2;
88 u32 fmt:3;
89 u32 x:1;
90 u32 q:1;
91 u32 :1;
92 u32 ectl:1;
93 u32 pno:1;
94 u32 :1;
95 u32 fctl:3;
96 u32 actl:7;
97 u32 stctl:5;
98 u32 tcw;
99 u32 dstat:8;
100 u32 cstat:8;
101 u32 fcxs:8;
102 u32 schxs:8;
103} __attribute__ ((packed));
104
105/**
106 * union scsw - subchannel status word
107 * @cmd: command-mode SCSW
108 * @tm: transport-mode SCSW
109 */
110union scsw {
111 struct cmd_scsw cmd;
112 struct tm_scsw tm;
113} __attribute__ ((packed));
114
115int scsw_is_tm(union scsw *scsw);
116u32 scsw_key(union scsw *scsw);
117u32 scsw_eswf(union scsw *scsw);
118u32 scsw_cc(union scsw *scsw);
119u32 scsw_ectl(union scsw *scsw);
120u32 scsw_pno(union scsw *scsw);
121u32 scsw_fctl(union scsw *scsw);
122u32 scsw_actl(union scsw *scsw);
123u32 scsw_stctl(union scsw *scsw);
124u32 scsw_dstat(union scsw *scsw);
125u32 scsw_cstat(union scsw *scsw);
126int scsw_is_solicited(union scsw *scsw);
127int scsw_is_valid_key(union scsw *scsw);
128int scsw_is_valid_eswf(union scsw *scsw);
129int scsw_is_valid_cc(union scsw *scsw);
130int scsw_is_valid_ectl(union scsw *scsw);
131int scsw_is_valid_pno(union scsw *scsw);
132int scsw_is_valid_fctl(union scsw *scsw);
133int scsw_is_valid_actl(union scsw *scsw);
134int scsw_is_valid_stctl(union scsw *scsw);
135int scsw_is_valid_dstat(union scsw *scsw);
136int scsw_is_valid_cstat(union scsw *scsw);
137int scsw_cmd_is_valid_key(union scsw *scsw);
138int scsw_cmd_is_valid_sctl(union scsw *scsw);
139int scsw_cmd_is_valid_eswf(union scsw *scsw);
140int scsw_cmd_is_valid_cc(union scsw *scsw);
141int scsw_cmd_is_valid_fmt(union scsw *scsw);
142int scsw_cmd_is_valid_pfch(union scsw *scsw);
143int scsw_cmd_is_valid_isic(union scsw *scsw);
144int scsw_cmd_is_valid_alcc(union scsw *scsw);
145int scsw_cmd_is_valid_ssi(union scsw *scsw);
146int scsw_cmd_is_valid_zcc(union scsw *scsw);
147int scsw_cmd_is_valid_ectl(union scsw *scsw);
148int scsw_cmd_is_valid_pno(union scsw *scsw);
149int scsw_cmd_is_valid_fctl(union scsw *scsw);
150int scsw_cmd_is_valid_actl(union scsw *scsw);
151int scsw_cmd_is_valid_stctl(union scsw *scsw);
152int scsw_cmd_is_valid_dstat(union scsw *scsw);
153int scsw_cmd_is_valid_cstat(union scsw *scsw);
154int scsw_cmd_is_solicited(union scsw *scsw);
155int scsw_tm_is_valid_key(union scsw *scsw);
156int scsw_tm_is_valid_eswf(union scsw *scsw);
157int scsw_tm_is_valid_cc(union scsw *scsw);
158int scsw_tm_is_valid_fmt(union scsw *scsw);
159int scsw_tm_is_valid_x(union scsw *scsw);
160int scsw_tm_is_valid_q(union scsw *scsw);
161int scsw_tm_is_valid_ectl(union scsw *scsw);
162int scsw_tm_is_valid_pno(union scsw *scsw);
163int scsw_tm_is_valid_fctl(union scsw *scsw);
164int scsw_tm_is_valid_actl(union scsw *scsw);
165int scsw_tm_is_valid_stctl(union scsw *scsw);
166int scsw_tm_is_valid_dstat(union scsw *scsw);
167int scsw_tm_is_valid_cstat(union scsw *scsw);
168int scsw_tm_is_valid_fcxs(union scsw *scsw);
169int scsw_tm_is_valid_schxs(union scsw *scsw);
170int scsw_tm_is_solicited(union scsw *scsw);
171
172#define SCSW_FCTL_CLEAR_FUNC 0x1
173#define SCSW_FCTL_HALT_FUNC 0x2
174#define SCSW_FCTL_START_FUNC 0x4
175
176#define SCSW_ACTL_SUSPENDED 0x1
177#define SCSW_ACTL_DEVACT 0x2
178#define SCSW_ACTL_SCHACT 0x4
179#define SCSW_ACTL_CLEAR_PEND 0x8
180#define SCSW_ACTL_HALT_PEND 0x10
181#define SCSW_ACTL_START_PEND 0x20
182#define SCSW_ACTL_RESUME_PEND 0x40
183
184#define SCSW_STCTL_STATUS_PEND 0x1
185#define SCSW_STCTL_SEC_STATUS 0x2
186#define SCSW_STCTL_PRIM_STATUS 0x4
187#define SCSW_STCTL_INTER_STATUS 0x8
188#define SCSW_STCTL_ALERT_STATUS 0x10
189
190#define DEV_STAT_ATTENTION 0x80
191#define DEV_STAT_STAT_MOD 0x40
192#define DEV_STAT_CU_END 0x20
193#define DEV_STAT_BUSY 0x10
194#define DEV_STAT_CHN_END 0x08
195#define DEV_STAT_DEV_END 0x04
196#define DEV_STAT_UNIT_CHECK 0x02
197#define DEV_STAT_UNIT_EXCEP 0x01
198
199#define SCHN_STAT_PCI 0x80
200#define SCHN_STAT_INCORR_LEN 0x40
201#define SCHN_STAT_PROG_CHECK 0x20
202#define SCHN_STAT_PROT_CHECK 0x10
203#define SCHN_STAT_CHN_DATA_CHK 0x08
204#define SCHN_STAT_CHN_CTRL_CHK 0x04
205#define SCHN_STAT_INTF_CTRL_CHK 0x02
206#define SCHN_STAT_CHAIN_CHECK 0x01
207
208/*
209 * architectured values for first sense byte
210 */
211#define SNS0_CMD_REJECT 0x80
212#define SNS_CMD_REJECT SNS0_CMD_REJEC
213#define SNS0_INTERVENTION_REQ 0x40
214#define SNS0_BUS_OUT_CHECK 0x20
215#define SNS0_EQUIPMENT_CHECK 0x10
216#define SNS0_DATA_CHECK 0x08
217#define SNS0_OVERRUN 0x04
218#define SNS0_INCOMPL_DOMAIN 0x01
219
220/*
221 * architectured values for second sense byte
222 */
223#define SNS1_PERM_ERR 0x80
224#define SNS1_INV_TRACK_FORMAT 0x40
225#define SNS1_EOC 0x20
226#define SNS1_MESSAGE_TO_OPER 0x10
227#define SNS1_NO_REC_FOUND 0x08
228#define SNS1_FILE_PROTECTED 0x04
229#define SNS1_WRITE_INHIBITED 0x02
230#define SNS1_INPRECISE_END 0x01
231
232/*
233 * architectured values for third sense byte
234 */
235#define SNS2_REQ_INH_WRITE 0x80
236#define SNS2_CORRECTABLE 0x40
237#define SNS2_FIRST_LOG_ERR 0x20
238#define SNS2_ENV_DATA_PRESENT 0x10
239#define SNS2_INPRECISE_END 0x04
240
241/**
242 * struct ccw1 - channel command word
243 * @cmd_code: command code
244 * @flags: flags, like IDA adressing, etc.
245 * @count: byte count
246 * @cda: data address
247 *
248 * The ccw is the basic structure to build channel programs that perform
249 * operations with the device or the control unit. Only Format-1 channel
250 * command words are supported.
251 */
252struct ccw1 {
253 __u8 cmd_code;
254 __u8 flags;
255 __u16 count;
256 __u32 cda;
257} __attribute__ ((packed,aligned(8)));
258
259#define CCW_FLAG_DC 0x80
260#define CCW_FLAG_CC 0x40
261#define CCW_FLAG_SLI 0x20
262#define CCW_FLAG_SKIP 0x10
263#define CCW_FLAG_PCI 0x08
264#define CCW_FLAG_IDA 0x04
265#define CCW_FLAG_SUSPEND 0x02
266
267#define CCW_CMD_READ_IPL 0x02
268#define CCW_CMD_NOOP 0x03
269#define CCW_CMD_BASIC_SENSE 0x04
270#define CCW_CMD_TIC 0x08
271#define CCW_CMD_STLCK 0x14
272#define CCW_CMD_SENSE_PGID 0x34
273#define CCW_CMD_SUSPEND_RECONN 0x5B
274#define CCW_CMD_RDC 0x64
275#define CCW_CMD_RELEASE 0x94
276#define CCW_CMD_SET_PGID 0xAF
277#define CCW_CMD_SENSE_ID 0xE4
278#define CCW_CMD_DCTL 0xF3
279
280#define SENSE_MAX_COUNT 0x20
281
282/**
283 * struct erw - extended report word
284 * @res0: reserved
285 * @auth: authorization check
286 * @pvrf: path-verification-required flag
287 * @cpt: channel-path timeout
288 * @fsavf: failing storage address validity flag
289 * @cons: concurrent sense
290 * @scavf: secondary ccw address validity flag
291 * @fsaf: failing storage address format
292 * @scnt: sense count, if @cons == %1
293 * @res16: reserved
294 */
295struct erw {
296 __u32 res0 : 3;
297 __u32 auth : 1;
298 __u32 pvrf : 1;
299 __u32 cpt : 1;
300 __u32 fsavf : 1;
301 __u32 cons : 1;
302 __u32 scavf : 1;
303 __u32 fsaf : 1;
304 __u32 scnt : 6;
305 __u32 res16 : 16;
306} __attribute__ ((packed));
307
308/**
309 * struct sublog - subchannel logout area
310 * @res0: reserved
311 * @esf: extended status flags
312 * @lpum: last path used mask
313 * @arep: ancillary report
314 * @fvf: field-validity flags
315 * @sacc: storage access code
316 * @termc: termination code
317 * @devsc: device-status check
318 * @serr: secondary error
319 * @ioerr: i/o-error alert
320 * @seqc: sequence code
321 */
322struct sublog {
323 __u32 res0 : 1;
324 __u32 esf : 7;
325 __u32 lpum : 8;
326 __u32 arep : 1;
327 __u32 fvf : 5;
328 __u32 sacc : 2;
329 __u32 termc : 2;
330 __u32 devsc : 1;
331 __u32 serr : 1;
332 __u32 ioerr : 1;
333 __u32 seqc : 3;
334} __attribute__ ((packed));
335
336/**
337 * struct esw0 - Format 0 Extended Status Word (ESW)
338 * @sublog: subchannel logout
339 * @erw: extended report word
340 * @faddr: failing storage address
341 * @saddr: secondary ccw address
342 */
343struct esw0 {
344 struct sublog sublog;
345 struct erw erw;
346 __u32 faddr[2];
347 __u32 saddr;
348} __attribute__ ((packed));
349
350/**
351 * struct esw1 - Format 1 Extended Status Word (ESW)
352 * @zero0: reserved zeros
353 * @lpum: last path used mask
354 * @zero16: reserved zeros
355 * @erw: extended report word
356 * @zeros: three fullwords of zeros
357 */
358struct esw1 {
359 __u8 zero0;
360 __u8 lpum;
361 __u16 zero16;
362 struct erw erw;
363 __u32 zeros[3];
364} __attribute__ ((packed));
365
366/**
367 * struct esw2 - Format 2 Extended Status Word (ESW)
368 * @zero0: reserved zeros
369 * @lpum: last path used mask
370 * @dcti: device-connect-time interval
371 * @erw: extended report word
372 * @zeros: three fullwords of zeros
373 */
374struct esw2 {
375 __u8 zero0;
376 __u8 lpum;
377 __u16 dcti;
378 struct erw erw;
379 __u32 zeros[3];
380} __attribute__ ((packed));
381
382/**
383 * struct esw3 - Format 3 Extended Status Word (ESW)
384 * @zero0: reserved zeros
385 * @lpum: last path used mask
386 * @res: reserved
387 * @erw: extended report word
388 * @zeros: three fullwords of zeros
389 */
390struct esw3 {
391 __u8 zero0;
392 __u8 lpum;
393 __u16 res;
394 struct erw erw;
395 __u32 zeros[3];
396} __attribute__ ((packed));
397
398/**
399 * struct irb - interruption response block
400 * @scsw: subchannel status word
401 * @esw: extened status word, 4 formats
402 * @ecw: extended control word
403 *
404 * The irb that is handed to the device driver when an interrupt occurs. For
405 * solicited interrupts, the common I/O layer already performs checks whether
406 * a field is valid; a field not being valid is always passed as %0.
407 * If a unit check occured, @ecw may contain sense data; this is retrieved
408 * by the common I/O layer itself if the device doesn't support concurrent
409 * sense (so that the device driver never needs to perform basic sene itself).
410 * For unsolicited interrupts, the irb is passed as-is (expect for sense data,
411 * if applicable).
412 */
413struct irb {
414 union scsw scsw;
415 union {
416 struct esw0 esw0;
417 struct esw1 esw1;
418 struct esw2 esw2;
419 struct esw3 esw3;
420 } esw;
421 __u8 ecw[32];
422} __attribute__ ((packed,aligned(4)));
423
424/**
425 * struct ciw - command information word (CIW) layout
426 * @et: entry type
427 * @reserved: reserved bits
428 * @ct: command type
429 * @cmd: command code
430 * @count: command count
431 */
432struct ciw {
433 __u32 et : 2;
434 __u32 reserved : 2;
435 __u32 ct : 4;
436 __u32 cmd : 8;
437 __u32 count : 16;
438} __attribute__ ((packed));
439
440#define CIW_TYPE_RCD 0x0 /* read configuration data */
441#define CIW_TYPE_SII 0x1 /* set interface identifier */
442#define CIW_TYPE_RNI 0x2 /* read node identifier */
443
444/*
445 * Flags used as input parameters for do_IO()
446 */
447#define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */
448#define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */
449#define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */
450 /* ... for suspended CCWs */
451/* Device or subchannel gone. */
452#define CIO_GONE 0x0001
453/* No path to device. */
454#define CIO_NO_PATH 0x0002
455/* Device has appeared. */
456#define CIO_OPER 0x0004
457/* Sick revalidation of device. */
458#define CIO_REVALIDATE 0x0008
459
460/**
461 * struct ccw_dev_id - unique identifier for ccw devices
462 * @ssid: subchannel set id
463 * @devno: device number
464 *
465 * This structure is not directly based on any hardware structure. The
466 * hardware identifies a device by its device number and its subchannel,
467 * which is in turn identified by its id. In order to get a unique identifier
468 * for ccw devices across subchannel sets, @struct ccw_dev_id has been
469 * introduced.
470 */
471struct ccw_dev_id {
472 u8 ssid;
473 u16 devno;
474};
475
476/**
477 * ccw_device_id_is_equal() - compare two ccw_dev_ids
478 * @dev_id1: a ccw_dev_id
479 * @dev_id2: another ccw_dev_id
480 * Returns:
481 * %1 if the two structures are equal field-by-field,
482 * %0 if not.
483 * Context:
484 * any
485 */
486static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
487 struct ccw_dev_id *dev_id2)
488{
489 if ((dev_id1->ssid == dev_id2->ssid) &&
490 (dev_id1->devno == dev_id2->devno))
491 return 1;
492 return 0;
493}
494
495extern void wait_cons_dev(void);
496
497extern void css_schedule_reprobe(void);
498
499extern void reipl_ccw_dev(struct ccw_dev_id *id);
500
501struct cio_iplinfo {
502 u16 devno;
503 int is_qdio;
504};
505
506extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
507
508/* Function from drivers/s390/cio/chsc.c */
509int chsc_sstpc(void *page, unsigned int op, u16 ctrl);
510int chsc_sstpi(void *page, void *result, size_t size);
511
512#endif
513
514#endif
diff --git a/arch/s390/include/asm/cmb.h b/arch/s390/include/asm/cmb.h
new file mode 100644
index 000000000000..50196857d27a
--- /dev/null
+++ b/arch/s390/include/asm/cmb.h
@@ -0,0 +1,58 @@
1#ifndef S390_CMB_H
2#define S390_CMB_H
3/**
4 * struct cmbdata - channel measurement block data for user space
5 * @size: size of the stored data
6 * @elapsed_time: time since last sampling
7 * @ssch_rsch_count: number of ssch and rsch
8 * @sample_count: number of samples
9 * @device_connect_time: time of device connect
10 * @function_pending_time: time of function pending
11 * @device_disconnect_time: time of device disconnect
12 * @control_unit_queuing_time: time of control unit queuing
13 * @device_active_only_time: time of device active only
14 * @device_busy_time: time of device busy (ext. format)
15 * @initial_command_response_time: initial command response time (ext. format)
16 *
17 * All values are stored as 64 bit for simplicity, especially
18 * in 32 bit emulation mode. All time values are normalized to
19 * nanoseconds.
20 * Currently, two formats are known, which differ by the size of
21 * this structure, i.e. the last two members are only set when
22 * the extended channel measurement facility (first shipped in
23 * z990 machines) is activated.
24 * Potentially, more fields could be added, which would result in a
25 * new ioctl number.
26 */
27struct cmbdata {
28 __u64 size;
29 __u64 elapsed_time;
30 /* basic and exended format: */
31 __u64 ssch_rsch_count;
32 __u64 sample_count;
33 __u64 device_connect_time;
34 __u64 function_pending_time;
35 __u64 device_disconnect_time;
36 __u64 control_unit_queuing_time;
37 __u64 device_active_only_time;
38 /* extended format only: */
39 __u64 device_busy_time;
40 __u64 initial_command_response_time;
41};
42
43/* enable channel measurement */
44#define BIODASDCMFENABLE _IO(DASD_IOCTL_LETTER, 32)
45/* enable channel measurement */
46#define BIODASDCMFDISABLE _IO(DASD_IOCTL_LETTER, 33)
47/* read channel measurement data */
48#define BIODASDREADALLCMB _IOWR(DASD_IOCTL_LETTER, 33, struct cmbdata)
49
50#ifdef __KERNEL__
51struct ccw_device;
52extern int enable_cmf(struct ccw_device *cdev);
53extern int disable_cmf(struct ccw_device *cdev);
54extern u64 cmf_read(struct ccw_device *cdev, int index);
55extern int cmf_readall(struct ccw_device *cdev, struct cmbdata *data);
56
57#endif /* __KERNEL__ */
58#endif /* S390_CMB_H */
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
new file mode 100644
index 000000000000..de065b32381a
--- /dev/null
+++ b/arch/s390/include/asm/compat.h
@@ -0,0 +1,233 @@
1#ifndef _ASM_S390X_COMPAT_H
2#define _ASM_S390X_COMPAT_H
3/*
4 * Architecture specific compatibility types
5 */
6#include <linux/types.h>
7#include <linux/sched.h>
8
9#define PSW32_MASK_PER 0x40000000UL
10#define PSW32_MASK_DAT 0x04000000UL
11#define PSW32_MASK_IO 0x02000000UL
12#define PSW32_MASK_EXT 0x01000000UL
13#define PSW32_MASK_KEY 0x00F00000UL
14#define PSW32_MASK_MCHECK 0x00040000UL
15#define PSW32_MASK_WAIT 0x00020000UL
16#define PSW32_MASK_PSTATE 0x00010000UL
17#define PSW32_MASK_ASC 0x0000C000UL
18#define PSW32_MASK_CC 0x00003000UL
19#define PSW32_MASK_PM 0x00000f00UL
20
21#define PSW32_ADDR_AMODE31 0x80000000UL
22#define PSW32_ADDR_INSN 0x7FFFFFFFUL
23
24#define PSW32_BASE_BITS 0x00080000UL
25
26#define PSW32_ASC_PRIMARY 0x00000000UL
27#define PSW32_ASC_ACCREG 0x00004000UL
28#define PSW32_ASC_SECONDARY 0x00008000UL
29#define PSW32_ASC_HOME 0x0000C000UL
30
31#define PSW32_MASK_MERGE(CURRENT,NEW) \
32 (((CURRENT) & ~(PSW32_MASK_CC|PSW32_MASK_PM)) | \
33 ((NEW) & (PSW32_MASK_CC|PSW32_MASK_PM)))
34
35extern long psw32_user_bits;
36
37#define COMPAT_USER_HZ 100
38
39typedef u32 compat_size_t;
40typedef s32 compat_ssize_t;
41typedef s32 compat_time_t;
42typedef s32 compat_clock_t;
43typedef s32 compat_pid_t;
44typedef u16 __compat_uid_t;
45typedef u16 __compat_gid_t;
46typedef u32 __compat_uid32_t;
47typedef u32 __compat_gid32_t;
48typedef u16 compat_mode_t;
49typedef u32 compat_ino_t;
50typedef u16 compat_dev_t;
51typedef s32 compat_off_t;
52typedef s64 compat_loff_t;
53typedef u16 compat_nlink_t;
54typedef u16 compat_ipc_pid_t;
55typedef s32 compat_daddr_t;
56typedef u32 compat_caddr_t;
57typedef __kernel_fsid_t compat_fsid_t;
58typedef s32 compat_key_t;
59typedef s32 compat_timer_t;
60
61typedef s32 compat_int_t;
62typedef s32 compat_long_t;
63typedef s64 compat_s64;
64typedef u32 compat_uint_t;
65typedef u32 compat_ulong_t;
66typedef u64 compat_u64;
67
68struct compat_timespec {
69 compat_time_t tv_sec;
70 s32 tv_nsec;
71};
72
73struct compat_timeval {
74 compat_time_t tv_sec;
75 s32 tv_usec;
76};
77
78struct compat_stat {
79 compat_dev_t st_dev;
80 u16 __pad1;
81 compat_ino_t st_ino;
82 compat_mode_t st_mode;
83 compat_nlink_t st_nlink;
84 __compat_uid_t st_uid;
85 __compat_gid_t st_gid;
86 compat_dev_t st_rdev;
87 u16 __pad2;
88 u32 st_size;
89 u32 st_blksize;
90 u32 st_blocks;
91 u32 st_atime;
92 u32 st_atime_nsec;
93 u32 st_mtime;
94 u32 st_mtime_nsec;
95 u32 st_ctime;
96 u32 st_ctime_nsec;
97 u32 __unused4;
98 u32 __unused5;
99};
100
101struct compat_flock {
102 short l_type;
103 short l_whence;
104 compat_off_t l_start;
105 compat_off_t l_len;
106 compat_pid_t l_pid;
107};
108
109#define F_GETLK64 12
110#define F_SETLK64 13
111#define F_SETLKW64 14
112
113struct compat_flock64 {
114 short l_type;
115 short l_whence;
116 compat_loff_t l_start;
117 compat_loff_t l_len;
118 compat_pid_t l_pid;
119};
120
121struct compat_statfs {
122 s32 f_type;
123 s32 f_bsize;
124 s32 f_blocks;
125 s32 f_bfree;
126 s32 f_bavail;
127 s32 f_files;
128 s32 f_ffree;
129 compat_fsid_t f_fsid;
130 s32 f_namelen;
131 s32 f_frsize;
132 s32 f_spare[6];
133};
134
135#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
136#define COMPAT_RLIM_INFINITY 0xffffffff
137
138typedef u32 compat_old_sigset_t; /* at least 32 bits */
139
140#define _COMPAT_NSIG 64
141#define _COMPAT_NSIG_BPW 32
142
143typedef u32 compat_sigset_word;
144
145#define COMPAT_OFF_T_MAX 0x7fffffff
146#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
147
148/*
149 * A pointer passed in from user mode. This should not
150 * be used for syscall parameters, just declare them
151 * as pointers because the syscall entry code will have
152 * appropriately converted them already.
153 */
154typedef u32 compat_uptr_t;
155
156static inline void __user *compat_ptr(compat_uptr_t uptr)
157{
158 return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
159}
160
161static inline compat_uptr_t ptr_to_compat(void __user *uptr)
162{
163 return (u32)(unsigned long)uptr;
164}
165
166static inline void __user *compat_alloc_user_space(long len)
167{
168 unsigned long stack;
169
170 stack = KSTK_ESP(current);
171 if (test_thread_flag(TIF_31BIT))
172 stack &= 0x7fffffffUL;
173 return (void __user *) (stack - len);
174}
175
176struct compat_ipc64_perm {
177 compat_key_t key;
178 __compat_uid32_t uid;
179 __compat_gid32_t gid;
180 __compat_uid32_t cuid;
181 __compat_gid32_t cgid;
182 compat_mode_t mode;
183 unsigned short __pad1;
184 unsigned short seq;
185 unsigned short __pad2;
186 unsigned int __unused1;
187 unsigned int __unused2;
188};
189
190struct compat_semid64_ds {
191 struct compat_ipc64_perm sem_perm;
192 compat_time_t sem_otime;
193 compat_ulong_t __pad1;
194 compat_time_t sem_ctime;
195 compat_ulong_t __pad2;
196 compat_ulong_t sem_nsems;
197 compat_ulong_t __unused1;
198 compat_ulong_t __unused2;
199};
200
201struct compat_msqid64_ds {
202 struct compat_ipc64_perm msg_perm;
203 compat_time_t msg_stime;
204 compat_ulong_t __pad1;
205 compat_time_t msg_rtime;
206 compat_ulong_t __pad2;
207 compat_time_t msg_ctime;
208 compat_ulong_t __pad3;
209 compat_ulong_t msg_cbytes;
210 compat_ulong_t msg_qnum;
211 compat_ulong_t msg_qbytes;
212 compat_pid_t msg_lspid;
213 compat_pid_t msg_lrpid;
214 compat_ulong_t __unused1;
215 compat_ulong_t __unused2;
216};
217
218struct compat_shmid64_ds {
219 struct compat_ipc64_perm shm_perm;
220 compat_size_t shm_segsz;
221 compat_time_t shm_atime;
222 compat_ulong_t __pad1;
223 compat_time_t shm_dtime;
224 compat_ulong_t __pad2;
225 compat_time_t shm_ctime;
226 compat_ulong_t __pad3;
227 compat_pid_t shm_cpid;
228 compat_pid_t shm_lpid;
229 compat_ulong_t shm_nattch;
230 compat_ulong_t __unused1;
231 compat_ulong_t __unused2;
232};
233#endif /* _ASM_S390X_COMPAT_H */
diff --git a/arch/s390/include/asm/cpcmd.h b/arch/s390/include/asm/cpcmd.h
new file mode 100644
index 000000000000..48a9eab16429
--- /dev/null
+++ b/arch/s390/include/asm/cpcmd.h
@@ -0,0 +1,34 @@
1/*
2 * arch/s390/kernel/cpcmd.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Christian Borntraeger (cborntra@de.ibm.com),
8 */
9
10#ifndef _ASM_S390_CPCMD_H
11#define _ASM_S390_CPCMD_H
12
13/*
14 * the lowlevel function for cpcmd
15 * the caller of __cpcmd has to ensure that the response buffer is below 2 GB
16 */
17extern int __cpcmd(const char *cmd, char *response, int rlen, int *response_code);
18
19/*
20 * cpcmd is the in-kernel interface for issuing CP commands
21 *
22 * cmd: null-terminated command string, max 240 characters
23 * response: response buffer for VM's textual response
24 * rlen: size of the response buffer, cpcmd will not exceed this size
25 * but will cap the output, if its too large. Everything that
26 * did not fit into the buffer will be silently dropped
27 * response_code: return pointer for VM's error code
28 * return value: the size of the response. The caller can check if the buffer
29 * was large enough by comparing the return value and rlen
30 * NOTE: If the response buffer is not below 2 GB, cpcmd can sleep
31 */
32extern int cpcmd(const char *cmd, char *response, int rlen, int *response_code);
33
34#endif /* _ASM_S390_CPCMD_H */
diff --git a/arch/s390/include/asm/cpu.h b/arch/s390/include/asm/cpu.h
new file mode 100644
index 000000000000..e5a6a9ba3adf
--- /dev/null
+++ b/arch/s390/include/asm/cpu.h
@@ -0,0 +1,33 @@
1/*
2 * include/asm-s390/cpu.h
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_CPU_H_
9#define _ASM_S390_CPU_H_
10
11#include <linux/types.h>
12#include <linux/percpu.h>
13#include <linux/spinlock.h>
14
15struct s390_idle_data {
16 spinlock_t lock;
17 unsigned int in_idle;
18 unsigned long long idle_count;
19 unsigned long long idle_enter;
20 unsigned long long idle_time;
21};
22
23DECLARE_PER_CPU(struct s390_idle_data, s390_idle);
24
25void s390_idle_leave(void);
26
27static inline void s390_idle_check(void)
28{
29 if ((&__get_cpu_var(s390_idle))->in_idle)
30 s390_idle_leave();
31}
32
33#endif /* _ASM_S390_CPU_H_ */
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
new file mode 100644
index 000000000000..133ce054fc89
--- /dev/null
+++ b/arch/s390/include/asm/cputime.h
@@ -0,0 +1,177 @@
1/*
2 * include/asm-s390/cputime.h
3 *
4 * (C) Copyright IBM Corp. 2004
5 *
6 * Author: Martin Schwidefsky <schwidefsky@de.ibm.com>
7 */
8
9#ifndef _S390_CPUTIME_H
10#define _S390_CPUTIME_H
11
12#include <asm/div64.h>
13
14/* We want to use micro-second resolution. */
15
16typedef unsigned long long cputime_t;
17typedef unsigned long long cputime64_t;
18
19#ifndef __s390x__
20
21static inline unsigned int
22__div(unsigned long long n, unsigned int base)
23{
24 register_pair rp;
25
26 rp.pair = n >> 1;
27 asm ("dr %0,%1" : "+d" (rp) : "d" (base >> 1));
28 return rp.subreg.odd;
29}
30
31#else /* __s390x__ */
32
33static inline unsigned int
34__div(unsigned long long n, unsigned int base)
35{
36 return n / base;
37}
38
39#endif /* __s390x__ */
40
41#define cputime_zero (0ULL)
42#define cputime_max ((~0UL >> 1) - 1)
43#define cputime_add(__a, __b) ((__a) + (__b))
44#define cputime_sub(__a, __b) ((__a) - (__b))
45#define cputime_div(__a, __n) ({ \
46 unsigned long long __div = (__a); \
47 do_div(__div,__n); \
48 __div; \
49})
50#define cputime_halve(__a) ((__a) >> 1)
51#define cputime_eq(__a, __b) ((__a) == (__b))
52#define cputime_gt(__a, __b) ((__a) > (__b))
53#define cputime_ge(__a, __b) ((__a) >= (__b))
54#define cputime_lt(__a, __b) ((__a) < (__b))
55#define cputime_le(__a, __b) ((__a) <= (__b))
56#define cputime_to_jiffies(__ct) (__div((__ct), 1000000 / HZ))
57#define cputime_to_scaled(__ct) (__ct)
58#define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (1000000 / HZ))
59
60#define cputime64_zero (0ULL)
61#define cputime64_add(__a, __b) ((__a) + (__b))
62#define cputime_to_cputime64(__ct) (__ct)
63
64static inline u64
65cputime64_to_jiffies64(cputime64_t cputime)
66{
67 do_div(cputime, 1000000 / HZ);
68 return cputime;
69}
70
71/*
72 * Convert cputime to milliseconds and back.
73 */
74static inline unsigned int
75cputime_to_msecs(const cputime_t cputime)
76{
77 return __div(cputime, 1000);
78}
79
80static inline cputime_t
81msecs_to_cputime(const unsigned int m)
82{
83 return (cputime_t) m * 1000;
84}
85
86/*
87 * Convert cputime to milliseconds and back.
88 */
89static inline unsigned int
90cputime_to_secs(const cputime_t cputime)
91{
92 return __div(cputime, 1000000);
93}
94
95static inline cputime_t
96secs_to_cputime(const unsigned int s)
97{
98 return (cputime_t) s * 1000000;
99}
100
101/*
102 * Convert cputime to timespec and back.
103 */
104static inline cputime_t
105timespec_to_cputime(const struct timespec *value)
106{
107 return value->tv_nsec / 1000 + (u64) value->tv_sec * 1000000;
108}
109
110static inline void
111cputime_to_timespec(const cputime_t cputime, struct timespec *value)
112{
113#ifndef __s390x__
114 register_pair rp;
115
116 rp.pair = cputime >> 1;
117 asm ("dr %0,%1" : "+d" (rp) : "d" (1000000 >> 1));
118 value->tv_nsec = rp.subreg.even * 1000;
119 value->tv_sec = rp.subreg.odd;
120#else
121 value->tv_nsec = (cputime % 1000000) * 1000;
122 value->tv_sec = cputime / 1000000;
123#endif
124}
125
126/*
127 * Convert cputime to timeval and back.
128 * Since cputime and timeval have the same resolution (microseconds)
129 * this is easy.
130 */
131static inline cputime_t
132timeval_to_cputime(const struct timeval *value)
133{
134 return value->tv_usec + (u64) value->tv_sec * 1000000;
135}
136
137static inline void
138cputime_to_timeval(const cputime_t cputime, struct timeval *value)
139{
140#ifndef __s390x__
141 register_pair rp;
142
143 rp.pair = cputime >> 1;
144 asm ("dr %0,%1" : "+d" (rp) : "d" (1000000 >> 1));
145 value->tv_usec = rp.subreg.even;
146 value->tv_sec = rp.subreg.odd;
147#else
148 value->tv_usec = cputime % 1000000;
149 value->tv_sec = cputime / 1000000;
150#endif
151}
152
153/*
154 * Convert cputime to clock and back.
155 */
156static inline clock_t
157cputime_to_clock_t(cputime_t cputime)
158{
159 return __div(cputime, 1000000 / USER_HZ);
160}
161
162static inline cputime_t
163clock_t_to_cputime(unsigned long x)
164{
165 return (cputime_t) x * (1000000 / USER_HZ);
166}
167
168/*
169 * Convert cputime64 to clock.
170 */
171static inline clock_t
172cputime64_to_clock_t(cputime64_t cputime)
173{
174 return __div(cputime, 1000000 / USER_HZ);
175}
176
177#endif /* _S390_CPUTIME_H */
diff --git a/arch/s390/include/asm/current.h b/arch/s390/include/asm/current.h
new file mode 100644
index 000000000000..83cf36cde2da
--- /dev/null
+++ b/arch/s390/include/asm/current.h
@@ -0,0 +1,23 @@
1/*
2 * include/asm-s390/current.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * Derived from "include/asm-i386/current.h"
9 */
10
11#ifndef _S390_CURRENT_H
12#define _S390_CURRENT_H
13
14#ifdef __KERNEL__
15#include <asm/lowcore.h>
16
17struct task_struct;
18
19#define current ((struct task_struct *const)S390_lowcore.current_task)
20
21#endif
22
23#endif /* !(_S390_CURRENT_H) */
diff --git a/arch/s390/include/asm/dasd.h b/arch/s390/include/asm/dasd.h
new file mode 100644
index 000000000000..3f002e13d024
--- /dev/null
+++ b/arch/s390/include/asm/dasd.h
@@ -0,0 +1,270 @@
1/*
2 * File...........: linux/drivers/s390/block/dasd.c
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Bugreports.to..: <Linux390@de.ibm.com>
5 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
6 *
7 * This file is the interface of the DASD device driver, which is exported to user space
8 * any future changes wrt the API will result in a change of the APIVERSION reported
9 * to userspace by the DASDAPIVER-ioctl
10 *
11 */
12
13#ifndef DASD_H
14#define DASD_H
15#include <linux/ioctl.h>
16
17#define DASD_IOCTL_LETTER 'D'
18
19#define DASD_API_VERSION 6
20
21/*
22 * struct dasd_information2_t
23 * represents any data about the device, which is visible to userspace.
24 * including foramt and featueres.
25 */
26typedef struct dasd_information2_t {
27 unsigned int devno; /* S/390 devno */
28 unsigned int real_devno; /* for aliases */
29 unsigned int schid; /* S/390 subchannel identifier */
30 unsigned int cu_type : 16; /* from SenseID */
31 unsigned int cu_model : 8; /* from SenseID */
32 unsigned int dev_type : 16; /* from SenseID */
33 unsigned int dev_model : 8; /* from SenseID */
34 unsigned int open_count;
35 unsigned int req_queue_len;
36 unsigned int chanq_len; /* length of chanq */
37 char type[4]; /* from discipline.name, 'none' for unknown */
38 unsigned int status; /* current device level */
39 unsigned int label_block; /* where to find the VOLSER */
40 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
41 unsigned int characteristics_size;
42 unsigned int confdata_size;
43 char characteristics[64]; /* from read_device_characteristics */
44 char configuration_data[256]; /* from read_configuration_data */
45 unsigned int format; /* format info like formatted/cdl/ldl/... */
46 unsigned int features; /* dasd features like 'ro',... */
47 unsigned int reserved0; /* reserved for further use ,... */
48 unsigned int reserved1; /* reserved for further use ,... */
49 unsigned int reserved2; /* reserved for further use ,... */
50 unsigned int reserved3; /* reserved for further use ,... */
51 unsigned int reserved4; /* reserved for further use ,... */
52 unsigned int reserved5; /* reserved for further use ,... */
53 unsigned int reserved6; /* reserved for further use ,... */
54 unsigned int reserved7; /* reserved for further use ,... */
55} dasd_information2_t;
56
57/*
58 * values to be used for dasd_information_t.format
59 * 0x00: NOT formatted
60 * 0x01: Linux disc layout
61 * 0x02: Common disc layout
62 */
63#define DASD_FORMAT_NONE 0
64#define DASD_FORMAT_LDL 1
65#define DASD_FORMAT_CDL 2
66/*
67 * values to be used for dasd_information_t.features
68 * 0x00: default features
69 * 0x01: readonly (ro)
70 * 0x02: use diag discipline (diag)
71 * 0x04: set the device initially online (internal use only)
72 * 0x08: enable ERP related logging
73 */
74#define DASD_FEATURE_DEFAULT 0x00
75#define DASD_FEATURE_READONLY 0x01
76#define DASD_FEATURE_USEDIAG 0x02
77#define DASD_FEATURE_INITIAL_ONLINE 0x04
78#define DASD_FEATURE_ERPLOG 0x08
79
80#define DASD_PARTN_BITS 2
81
82/*
83 * struct dasd_information_t
84 * represents any data about the data, which is visible to userspace
85 */
86typedef struct dasd_information_t {
87 unsigned int devno; /* S/390 devno */
88 unsigned int real_devno; /* for aliases */
89 unsigned int schid; /* S/390 subchannel identifier */
90 unsigned int cu_type : 16; /* from SenseID */
91 unsigned int cu_model : 8; /* from SenseID */
92 unsigned int dev_type : 16; /* from SenseID */
93 unsigned int dev_model : 8; /* from SenseID */
94 unsigned int open_count;
95 unsigned int req_queue_len;
96 unsigned int chanq_len; /* length of chanq */
97 char type[4]; /* from discipline.name, 'none' for unknown */
98 unsigned int status; /* current device level */
99 unsigned int label_block; /* where to find the VOLSER */
100 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
101 unsigned int characteristics_size;
102 unsigned int confdata_size;
103 char characteristics[64]; /* from read_device_characteristics */
104 char configuration_data[256]; /* from read_configuration_data */
105} dasd_information_t;
106
107/*
108 * Read Subsystem Data - Performance Statistics
109 */
110typedef struct dasd_rssd_perf_stats_t {
111 unsigned char invalid:1;
112 unsigned char format:3;
113 unsigned char data_format:4;
114 unsigned char unit_address;
115 unsigned short device_status;
116 unsigned int nr_read_normal;
117 unsigned int nr_read_normal_hits;
118 unsigned int nr_write_normal;
119 unsigned int nr_write_fast_normal_hits;
120 unsigned int nr_read_seq;
121 unsigned int nr_read_seq_hits;
122 unsigned int nr_write_seq;
123 unsigned int nr_write_fast_seq_hits;
124 unsigned int nr_read_cache;
125 unsigned int nr_read_cache_hits;
126 unsigned int nr_write_cache;
127 unsigned int nr_write_fast_cache_hits;
128 unsigned int nr_inhibit_cache;
129 unsigned int nr_bybass_cache;
130 unsigned int nr_seq_dasd_to_cache;
131 unsigned int nr_dasd_to_cache;
132 unsigned int nr_cache_to_dasd;
133 unsigned int nr_delayed_fast_write;
134 unsigned int nr_normal_fast_write;
135 unsigned int nr_seq_fast_write;
136 unsigned int nr_cache_miss;
137 unsigned char status2;
138 unsigned int nr_quick_write_promotes;
139 unsigned char reserved;
140 unsigned short ssid;
141 unsigned char reseved2[96];
142} __attribute__((packed)) dasd_rssd_perf_stats_t;
143
144/*
145 * struct profile_info_t
146 * holds the profinling information
147 */
148typedef struct dasd_profile_info_t {
149 unsigned int dasd_io_reqs; /* number of requests processed at all */
150 unsigned int dasd_io_sects; /* number of sectors processed at all */
151 unsigned int dasd_io_secs[32]; /* histogram of request's sizes */
152 unsigned int dasd_io_times[32]; /* histogram of requests's times */
153 unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */
154 unsigned int dasd_io_time1[32]; /* histogram of time from build to start */
155 unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */
156 unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
157 unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */
158 unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
159} dasd_profile_info_t;
160
161/*
162 * struct format_data_t
163 * represents all data necessary to format a dasd
164 */
165typedef struct format_data_t {
166 int start_unit; /* from track */
167 int stop_unit; /* to track */
168 int blksize; /* sectorsize */
169 int intensity;
170} format_data_t;
171
172/*
173 * values to be used for format_data_t.intensity
174 * 0/8: normal format
175 * 1/9: also write record zero
176 * 3/11: also write home address
177 * 4/12: invalidate track
178 */
179#define DASD_FMT_INT_FMT_R0 1 /* write record zero */
180#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
181#define DASD_FMT_INT_INVAL 4 /* invalidate tracks */
182#define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
183
184
185/*
186 * struct attrib_data_t
187 * represents the operation (cache) bits for the device.
188 * Used in DE to influence caching of the DASD.
189 */
190typedef struct attrib_data_t {
191 unsigned char operation:3; /* cache operation mode */
192 unsigned char reserved:5; /* cache operation mode */
193 __u16 nr_cyl; /* no of cyliners for read ahaed */
194 __u8 reserved2[29]; /* for future use */
195} __attribute__ ((packed)) attrib_data_t;
196
197/* definition of operation (cache) bits within attributes of DE */
198#define DASD_NORMAL_CACHE 0x0
199#define DASD_BYPASS_CACHE 0x1
200#define DASD_INHIBIT_LOAD 0x2
201#define DASD_SEQ_ACCESS 0x3
202#define DASD_SEQ_PRESTAGE 0x4
203#define DASD_REC_ACCESS 0x5
204
205
206/********************************************************************************
207 * SECTION: Definition of IOCTLs
208 *
209 * Here ist how the ioctl-nr should be used:
210 * 0 - 31 DASD driver itself
211 * 32 - 239 still open
212 * 240 - 255 reserved for EMC
213 *******************************************************************************/
214
215/* Disable the volume (for Linux) */
216#define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
217/* Enable the volume (for Linux) */
218#define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1)
219/* Issue a reserve/release command, rsp. */
220#define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */
221#define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */
222#define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */
223/* reset profiling information of a device */
224#define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5)
225/* Quiesce IO on device */
226#define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)
227/* Resume IO on device */
228#define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7)
229
230
231/* retrieve API version number */
232#define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int)
233/* Get information on a dasd device */
234#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
235/* retrieve profiling information of a device */
236#define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
237/* Get information on a dasd device (enhanced) */
238#define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
239/* Performance Statistics Read */
240#define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
241/* Get Attributes (cache operations) */
242#define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)
243
244
245/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
246#define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)
247/* Set Attributes (cache operations) */
248#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
249
250
251#endif /* DASD_H */
252
253/*
254 * Overrides for Emacs so that we follow Linus's tabbing style.
255 * Emacs will notice this stuff at the end of the file and automatically
256 * adjust the settings for this buffer only. This must remain at the end
257 * of the file.
258 * ---------------------------------------------------------------------------
259 * Local variables:
260 * c-indent-level: 4
261 * c-brace-imaginary-offset: 0
262 * c-brace-offset: -4
263 * c-argdecl-indent: 4
264 * c-label-offset: -4
265 * c-continued-statement-offset: 4
266 * c-continued-brace-offset: 0
267 * indent-tabs-mode: nil
268 * tab-width: 8
269 * End:
270 */
diff --git a/arch/s390/include/asm/debug.h b/arch/s390/include/asm/debug.h
new file mode 100644
index 000000000000..9450ce6e32de
--- /dev/null
+++ b/arch/s390/include/asm/debug.h
@@ -0,0 +1,261 @@
1/*
2 * include/asm-s390/debug.h
3 * S/390 debug facility
4 *
5 * Copyright (C) 1999, 2000 IBM Deutschland Entwicklung GmbH,
6 * IBM Corporation
7 */
8
9#ifndef DEBUG_H
10#define DEBUG_H
11
12#include <linux/fs.h>
13
14/* Note:
15 * struct __debug_entry must be defined outside of #ifdef __KERNEL__
16 * in order to allow a user program to analyze the 'raw'-view.
17 */
18
19struct __debug_entry{
20 union {
21 struct {
22 unsigned long long clock:52;
23 unsigned long long exception:1;
24 unsigned long long level:3;
25 unsigned long long cpuid:8;
26 } fields;
27
28 unsigned long long stck;
29 } id;
30 void* caller;
31} __attribute__((packed));
32
33
34#define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */
35
36#ifdef __KERNEL__
37#include <linux/string.h>
38#include <linux/spinlock.h>
39#include <linux/kernel.h>
40#include <linux/time.h>
41
42#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */
43#define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */
44#define DEBUG_FLUSH_ALL -1 /* parameter to flush all areas */
45#define DEBUG_MAX_VIEWS 10 /* max number of views in proc fs */
46#define DEBUG_MAX_NAME_LEN 64 /* max length for a debugfs file name */
47#define DEBUG_DEFAULT_LEVEL 3 /* initial debug level */
48
49#define DEBUG_DIR_ROOT "s390dbf" /* name of debug root directory in proc fs */
50
51#define DEBUG_DATA(entry) (char*)(entry + 1) /* data is stored behind */
52 /* the entry information */
53
54typedef struct __debug_entry debug_entry_t;
55
56struct debug_view;
57
58typedef struct debug_info {
59 struct debug_info* next;
60 struct debug_info* prev;
61 atomic_t ref_count;
62 spinlock_t lock;
63 int level;
64 int nr_areas;
65 int pages_per_area;
66 int buf_size;
67 int entry_size;
68 debug_entry_t*** areas;
69 int active_area;
70 int *active_pages;
71 int *active_entries;
72 struct dentry* debugfs_root_entry;
73 struct dentry* debugfs_entries[DEBUG_MAX_VIEWS];
74 struct debug_view* views[DEBUG_MAX_VIEWS];
75 char name[DEBUG_MAX_NAME_LEN];
76 mode_t mode;
77} debug_info_t;
78
79typedef int (debug_header_proc_t) (debug_info_t* id,
80 struct debug_view* view,
81 int area,
82 debug_entry_t* entry,
83 char* out_buf);
84
85typedef int (debug_format_proc_t) (debug_info_t* id,
86 struct debug_view* view, char* out_buf,
87 const char* in_buf);
88typedef int (debug_prolog_proc_t) (debug_info_t* id,
89 struct debug_view* view,
90 char* out_buf);
91typedef int (debug_input_proc_t) (debug_info_t* id,
92 struct debug_view* view,
93 struct file* file,
94 const char __user *user_buf,
95 size_t in_buf_size, loff_t* offset);
96
97int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view,
98 int area, debug_entry_t* entry, char* out_buf);
99
100struct debug_view {
101 char name[DEBUG_MAX_NAME_LEN];
102 debug_prolog_proc_t* prolog_proc;
103 debug_header_proc_t* header_proc;
104 debug_format_proc_t* format_proc;
105 debug_input_proc_t* input_proc;
106 void* private_data;
107};
108
109extern struct debug_view debug_hex_ascii_view;
110extern struct debug_view debug_raw_view;
111extern struct debug_view debug_sprintf_view;
112
113/* do NOT use the _common functions */
114
115debug_entry_t* debug_event_common(debug_info_t* id, int level,
116 const void* data, int length);
117
118debug_entry_t* debug_exception_common(debug_info_t* id, int level,
119 const void* data, int length);
120
121/* Debug Feature API: */
122
123debug_info_t *debug_register(const char *name, int pages, int nr_areas,
124 int buf_size);
125
126debug_info_t *debug_register_mode(const char *name, int pages, int nr_areas,
127 int buf_size, mode_t mode, uid_t uid,
128 gid_t gid);
129
130void debug_unregister(debug_info_t* id);
131
132void debug_set_level(debug_info_t* id, int new_level);
133
134void debug_stop_all(void);
135
136static inline debug_entry_t*
137debug_event(debug_info_t* id, int level, void* data, int length)
138{
139 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
140 return NULL;
141 return debug_event_common(id,level,data,length);
142}
143
144static inline debug_entry_t*
145debug_int_event(debug_info_t* id, int level, unsigned int tag)
146{
147 unsigned int t=tag;
148 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
149 return NULL;
150 return debug_event_common(id,level,&t,sizeof(unsigned int));
151}
152
153static inline debug_entry_t *
154debug_long_event (debug_info_t* id, int level, unsigned long tag)
155{
156 unsigned long t=tag;
157 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
158 return NULL;
159 return debug_event_common(id,level,&t,sizeof(unsigned long));
160}
161
162static inline debug_entry_t*
163debug_text_event(debug_info_t* id, int level, const char* txt)
164{
165 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
166 return NULL;
167 return debug_event_common(id,level,txt,strlen(txt));
168}
169
170extern debug_entry_t *
171debug_sprintf_event(debug_info_t* id,int level,char *string,...)
172 __attribute__ ((format(printf, 3, 4)));
173
174
175static inline debug_entry_t*
176debug_exception(debug_info_t* id, int level, void* data, int length)
177{
178 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
179 return NULL;
180 return debug_exception_common(id,level,data,length);
181}
182
183static inline debug_entry_t*
184debug_int_exception(debug_info_t* id, int level, unsigned int tag)
185{
186 unsigned int t=tag;
187 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
188 return NULL;
189 return debug_exception_common(id,level,&t,sizeof(unsigned int));
190}
191
192static inline debug_entry_t *
193debug_long_exception (debug_info_t* id, int level, unsigned long tag)
194{
195 unsigned long t=tag;
196 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
197 return NULL;
198 return debug_exception_common(id,level,&t,sizeof(unsigned long));
199}
200
201static inline debug_entry_t*
202debug_text_exception(debug_info_t* id, int level, const char* txt)
203{
204 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
205 return NULL;
206 return debug_exception_common(id,level,txt,strlen(txt));
207}
208
209
210extern debug_entry_t *
211debug_sprintf_exception(debug_info_t* id,int level,char *string,...)
212 __attribute__ ((format(printf, 3, 4)));
213
214int debug_register_view(debug_info_t* id, struct debug_view* view);
215int debug_unregister_view(debug_info_t* id, struct debug_view* view);
216
217/*
218 define the debug levels:
219 - 0 No debugging output to console or syslog
220 - 1 Log internal errors to syslog, ignore check conditions
221 - 2 Log internal errors and check conditions to syslog
222 - 3 Log internal errors to console, log check conditions to syslog
223 - 4 Log internal errors and check conditions to console
224 - 5 panic on internal errors, log check conditions to console
225 - 6 panic on both, internal errors and check conditions
226 */
227
228#ifndef DEBUG_LEVEL
229#define DEBUG_LEVEL 4
230#endif
231
232#define INTERNAL_ERRMSG(x,y...) "E" __FILE__ "%d: " x, __LINE__, y
233#define INTERNAL_WRNMSG(x,y...) "W" __FILE__ "%d: " x, __LINE__, y
234#define INTERNAL_INFMSG(x,y...) "I" __FILE__ "%d: " x, __LINE__, y
235#define INTERNAL_DEBMSG(x,y...) "D" __FILE__ "%d: " x, __LINE__, y
236
237#if DEBUG_LEVEL > 0
238#define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
239#define PRINT_INFO(x...) printk ( KERN_INFO PRINTK_HEADER x )
240#define PRINT_WARN(x...) printk ( KERN_WARNING PRINTK_HEADER x )
241#define PRINT_ERR(x...) printk ( KERN_ERR PRINTK_HEADER x )
242#define PRINT_FATAL(x...) panic ( PRINTK_HEADER x )
243#else
244#define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
245#define PRINT_INFO(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
246#define PRINT_WARN(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
247#define PRINT_ERR(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
248#define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
249#endif /* DASD_DEBUG */
250
251#undef DEBUG_MALLOC
252#ifdef DEBUG_MALLOC
253void *b;
254#define kmalloc(x...) (PRINT_INFO(" kmalloc %p\n",b=kmalloc(x)),b)
255#define kfree(x) PRINT_INFO(" kfree %p\n",x);kfree(x)
256#define get_zeroed_page(x...) (PRINT_INFO(" gfp %p\n",b=get_zeroed_page(x)),b)
257#define __get_free_pages(x...) (PRINT_INFO(" gfps %p\n",b=__get_free_pages(x)),b)
258#endif /* DEBUG_MALLOC */
259
260#endif /* __KERNEL__ */
261#endif /* DEBUG_H */
diff --git a/arch/s390/include/asm/delay.h b/arch/s390/include/asm/delay.h
new file mode 100644
index 000000000000..78357314c450
--- /dev/null
+++ b/arch/s390/include/asm/delay.h
@@ -0,0 +1,22 @@
1/*
2 * include/asm-s390/delay.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * Derived from "include/asm-i386/delay.h"
9 * Copyright (C) 1993 Linus Torvalds
10 *
11 * Delay routines calling functions in arch/s390/lib/delay.c
12 */
13
14#ifndef _S390_DELAY_H
15#define _S390_DELAY_H
16
17extern void __udelay(unsigned long usecs);
18extern void __delay(unsigned long loops);
19
20#define udelay(n) __udelay(n)
21
22#endif /* defined(_S390_DELAY_H) */
diff --git a/arch/s390/include/asm/device.h b/arch/s390/include/asm/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/arch/s390/include/asm/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/arch/s390/include/asm/diag.h b/arch/s390/include/asm/diag.h
new file mode 100644
index 000000000000..72b2e2f2d32d
--- /dev/null
+++ b/arch/s390/include/asm/diag.h
@@ -0,0 +1,39 @@
1/*
2 * s390 diagnose functions
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_DIAG_H
9#define _ASM_S390_DIAG_H
10
11/*
12 * Diagnose 10: Release pages
13 */
14extern void diag10(unsigned long addr);
15
16/*
17 * Diagnose 14: Input spool file manipulation
18 */
19extern int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode);
20
21/*
22 * Diagnose 210: Get information about a virtual device
23 */
24struct diag210 {
25 u16 vrdcdvno; /* device number (input) */
26 u16 vrdclen; /* data block length (input) */
27 u8 vrdcvcla; /* virtual device class (output) */
28 u8 vrdcvtyp; /* virtual device type (output) */
29 u8 vrdcvsta; /* virtual device status (output) */
30 u8 vrdcvfla; /* virtual device flags (output) */
31 u8 vrdcrccl; /* real device class (output) */
32 u8 vrdccrty; /* real device type (output) */
33 u8 vrdccrmd; /* real device model (output) */
34 u8 vrdccrft; /* real device feature (output) */
35} __attribute__((packed, aligned(4)));
36
37extern int diag210(struct diag210 *addr);
38
39#endif /* _ASM_S390_DIAG_H */
diff --git a/arch/s390/include/asm/div64.h b/arch/s390/include/asm/div64.h
new file mode 100644
index 000000000000..6cd978cefb28
--- /dev/null
+++ b/arch/s390/include/asm/div64.h
@@ -0,0 +1 @@
#include <asm-generic/div64.h>
diff --git a/arch/s390/include/asm/dma.h b/arch/s390/include/asm/dma.h
new file mode 100644
index 000000000000..7425c6af6cd4
--- /dev/null
+++ b/arch/s390/include/asm/dma.h
@@ -0,0 +1,16 @@
1/*
2 * include/asm-s390/dma.h
3 *
4 * S390 version
5 */
6
7#ifndef _ASM_DMA_H
8#define _ASM_DMA_H
9
10#include <asm/io.h> /* need byte IO */
11
12#define MAX_DMA_ADDRESS 0x80000000
13
14#define free_dma(x) do { } while (0)
15
16#endif /* _ASM_DMA_H */
diff --git a/arch/s390/include/asm/ebcdic.h b/arch/s390/include/asm/ebcdic.h
new file mode 100644
index 000000000000..7f6f641d32f4
--- /dev/null
+++ b/arch/s390/include/asm/ebcdic.h
@@ -0,0 +1,49 @@
1/*
2 * include/asm-s390/ebcdic.h
3 * EBCDIC -> ASCII, ASCII -> EBCDIC conversion routines.
4 *
5 * S390 version
6 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
8 */
9
10#ifndef _EBCDIC_H
11#define _EBCDIC_H
12
13#ifndef _S390_TYPES_H
14#include <types.h>
15#endif
16
17extern __u8 _ascebc_500[256]; /* ASCII -> EBCDIC 500 conversion table */
18extern __u8 _ebcasc_500[256]; /* EBCDIC 500 -> ASCII conversion table */
19extern __u8 _ascebc[256]; /* ASCII -> EBCDIC conversion table */
20extern __u8 _ebcasc[256]; /* EBCDIC -> ASCII conversion table */
21extern __u8 _ebc_tolower[256]; /* EBCDIC -> lowercase */
22extern __u8 _ebc_toupper[256]; /* EBCDIC -> uppercase */
23
24static inline void
25codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr)
26{
27 if (nr-- <= 0)
28 return;
29 asm volatile(
30 " bras 1,1f\n"
31 " tr 0(1,%0),0(%2)\n"
32 "0: tr 0(256,%0),0(%2)\n"
33 " la %0,256(%0)\n"
34 "1: ahi %1,-256\n"
35 " jnm 0b\n"
36 " ex %1,0(1)"
37 : "+&a" (addr), "+&a" (nr)
38 : "a" (codepage) : "cc", "memory", "1");
39}
40
41#define ASCEBC(addr,nr) codepage_convert(_ascebc, addr, nr)
42#define EBCASC(addr,nr) codepage_convert(_ebcasc, addr, nr)
43#define ASCEBC_500(addr,nr) codepage_convert(_ascebc_500, addr, nr)
44#define EBCASC_500(addr,nr) codepage_convert(_ebcasc_500, addr, nr)
45#define EBC_TOLOWER(addr,nr) codepage_convert(_ebc_tolower, addr, nr)
46#define EBC_TOUPPER(addr,nr) codepage_convert(_ebc_toupper, addr, nr)
47
48#endif
49
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
new file mode 100644
index 000000000000..3cad56923815
--- /dev/null
+++ b/arch/s390/include/asm/elf.h
@@ -0,0 +1,196 @@
1/*
2 * include/asm-s390/elf.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/elf.h"
7 */
8
9#ifndef __ASMS390_ELF_H
10#define __ASMS390_ELF_H
11
12/* s390 relocations defined by the ABIs */
13#define R_390_NONE 0 /* No reloc. */
14#define R_390_8 1 /* Direct 8 bit. */
15#define R_390_12 2 /* Direct 12 bit. */
16#define R_390_16 3 /* Direct 16 bit. */
17#define R_390_32 4 /* Direct 32 bit. */
18#define R_390_PC32 5 /* PC relative 32 bit. */
19#define R_390_GOT12 6 /* 12 bit GOT offset. */
20#define R_390_GOT32 7 /* 32 bit GOT offset. */
21#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */
22#define R_390_COPY 9 /* Copy symbol at runtime. */
23#define R_390_GLOB_DAT 10 /* Create GOT entry. */
24#define R_390_JMP_SLOT 11 /* Create PLT entry. */
25#define R_390_RELATIVE 12 /* Adjust by program base. */
26#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */
27#define R_390_GOTPC 14 /* 32 bit PC rel. offset to GOT. */
28#define R_390_GOT16 15 /* 16 bit GOT offset. */
29#define R_390_PC16 16 /* PC relative 16 bit. */
30#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */
31#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */
32#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */
33#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */
34#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */
35#define R_390_64 22 /* Direct 64 bit. */
36#define R_390_PC64 23 /* PC relative 64 bit. */
37#define R_390_GOT64 24 /* 64 bit GOT offset. */
38#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */
39#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */
40#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */
41#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */
42#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */
43#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */
44#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */
45#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */
46#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */
47#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */
48#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */
49#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */
50#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */
51#define R_390_TLS_GDCALL 38 /* Tag for function call in general
52 dynamic TLS code. */
53#define R_390_TLS_LDCALL 39 /* Tag for function call in local
54 dynamic TLS code. */
55#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic
56 thread local data. */
57#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic
58 thread local data. */
59#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS
60 block offset. */
61#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS
62 block offset. */
63#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS
64 block offset. */
65#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic
66 thread local data in LD code. */
67#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic
68 thread local data in LD code. */
69#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for
70 negated static TLS block offset. */
71#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for
72 negated static TLS block offset. */
73#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for
74 negated static TLS block offset. */
75#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to
76 static TLS block. */
77#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to
78 static TLS block. */
79#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS
80 block. */
81#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS
82 block. */
83#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */
84#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */
85#define R_390_TLS_TPOFF 56 /* Negate offset in static TLS
86 block. */
87#define R_390_20 57 /* Direct 20 bit. */
88#define R_390_GOT20 58 /* 20 bit GOT offset. */
89#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
90#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS
91 block offset. */
92/* Keep this the last entry. */
93#define R_390_NUM 61
94
95/*
96 * These are used to set parameters in the core dumps.
97 */
98#ifndef __s390x__
99#define ELF_CLASS ELFCLASS32
100#else /* __s390x__ */
101#define ELF_CLASS ELFCLASS64
102#endif /* __s390x__ */
103#define ELF_DATA ELFDATA2MSB
104#define ELF_ARCH EM_S390
105
106/*
107 * ELF register definitions..
108 */
109
110#include <asm/ptrace.h>
111#include <asm/user.h>
112
113typedef s390_fp_regs elf_fpregset_t;
114typedef s390_regs elf_gregset_t;
115
116typedef s390_fp_regs compat_elf_fpregset_t;
117typedef s390_compat_regs compat_elf_gregset_t;
118
119#include <linux/sched.h> /* for task_struct */
120#include <asm/system.h> /* for save_access_regs */
121#include <asm/mmu_context.h>
122
123/*
124 * This is used to ensure we don't load something for the wrong architecture.
125 */
126#define elf_check_arch(x) \
127 (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
128 && (x)->e_ident[EI_CLASS] == ELF_CLASS)
129#define compat_elf_check_arch(x) \
130 (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
131 && (x)->e_ident[EI_CLASS] == ELF_CLASS)
132#define compat_start_thread start_thread31
133
134/* For SVR4/S390 the function pointer to be registered with `atexit` is
135 passed in R14. */
136#define ELF_PLAT_INIT(_r, load_addr) \
137 do { \
138 _r->gprs[14] = 0; \
139 } while (0)
140
141#define CORE_DUMP_USE_REGSET
142#define USE_ELF_CORE_DUMP
143#define ELF_EXEC_PAGESIZE 4096
144
145/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
146 use of this is to invoke "./ld.so someprog" to test out a new version of
147 the loader. We need to make sure that it is out of the way of the program
148 that it will "exec", and that there is sufficient room for the brk. */
149#define ELF_ET_DYN_BASE (STACK_TOP / 3 * 2)
150
151/* This yields a mask that user programs can use to figure out what
152 instruction set this CPU supports. */
153
154extern unsigned long elf_hwcap;
155#define ELF_HWCAP (elf_hwcap)
156
157/* This yields a string that ld.so will use to load implementation
158 specific libraries for optimization. This is more specific in
159 intent than poking at uname or /proc/cpuinfo.
160
161 For the moment, we have only optimizations for the Intel generations,
162 but that could change... */
163
164#define ELF_PLATFORM_SIZE 8
165extern char elf_platform[];
166#define ELF_PLATFORM (elf_platform)
167
168#ifndef __s390x__
169#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
170#else /* __s390x__ */
171#define SET_PERSONALITY(ex, ibcs2) \
172do { \
173 if (ibcs2) \
174 set_personality(PER_SVR4); \
175 else if (current->personality != PER_LINUX32) \
176 set_personality(PER_LINUX); \
177 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
178 set_thread_flag(TIF_31BIT); \
179 else \
180 clear_thread_flag(TIF_31BIT); \
181} while (0)
182#endif /* __s390x__ */
183
184/*
185 * An executable for which elf_read_implies_exec() returns TRUE will
186 * have the READ_IMPLIES_EXEC personality flag set automatically.
187 */
188#define elf_read_implies_exec(ex, executable_stack) \
189({ \
190 if (current->mm->context.noexec && \
191 executable_stack != EXSTACK_DISABLE_X) \
192 disable_noexec(current->mm, current); \
193 current->mm->context.noexec == 0; \
194})
195
196#endif
diff --git a/arch/s390/include/asm/emergency-restart.h b/arch/s390/include/asm/emergency-restart.h
new file mode 100644
index 000000000000..108d8c48e42e
--- /dev/null
+++ b/arch/s390/include/asm/emergency-restart.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/arch/s390/include/asm/errno.h b/arch/s390/include/asm/errno.h
new file mode 100644
index 000000000000..e41d5b37c4d6
--- /dev/null
+++ b/arch/s390/include/asm/errno.h
@@ -0,0 +1,13 @@
1/*
2 * include/asm-s390/errno.h
3 *
4 * S390 version
5 *
6 */
7
8#ifndef _S390_ERRNO_H
9#define _S390_ERRNO_H
10
11#include <asm-generic/errno.h>
12
13#endif
diff --git a/arch/s390/include/asm/etr.h b/arch/s390/include/asm/etr.h
new file mode 100644
index 000000000000..80ef58c61970
--- /dev/null
+++ b/arch/s390/include/asm/etr.h
@@ -0,0 +1,258 @@
1/*
2 * include/asm-s390/etr.h
3 *
4 * Copyright IBM Corp. 2006
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
6 */
7#ifndef __S390_ETR_H
8#define __S390_ETR_H
9
10/* ETR attachment control register */
11struct etr_eacr {
12 unsigned int e0 : 1; /* port 0 stepping control */
13 unsigned int e1 : 1; /* port 1 stepping control */
14 unsigned int _pad0 : 5; /* must be 00100 */
15 unsigned int dp : 1; /* data port control */
16 unsigned int p0 : 1; /* port 0 change recognition control */
17 unsigned int p1 : 1; /* port 1 change recognition control */
18 unsigned int _pad1 : 3; /* must be 000 */
19 unsigned int ea : 1; /* ETR alert control */
20 unsigned int es : 1; /* ETR sync check control */
21 unsigned int sl : 1; /* switch to local control */
22} __attribute__ ((packed));
23
24/* Port state returned by steai */
25enum etr_psc {
26 etr_psc_operational = 0,
27 etr_psc_semi_operational = 1,
28 etr_psc_protocol_error = 4,
29 etr_psc_no_symbols = 8,
30 etr_psc_no_signal = 12,
31 etr_psc_pps_mode = 13
32};
33
34/* Logical port state returned by stetr */
35enum etr_lpsc {
36 etr_lpsc_operational_step = 0,
37 etr_lpsc_operational_alt = 1,
38 etr_lpsc_semi_operational = 2,
39 etr_lpsc_protocol_error = 4,
40 etr_lpsc_no_symbol_sync = 8,
41 etr_lpsc_no_signal = 12,
42 etr_lpsc_pps_mode = 13
43};
44
45/* ETR status words */
46struct etr_esw {
47 struct etr_eacr eacr; /* attachment control register */
48 unsigned int y : 1; /* stepping mode */
49 unsigned int _pad0 : 5; /* must be 00000 */
50 unsigned int p : 1; /* stepping port number */
51 unsigned int q : 1; /* data port number */
52 unsigned int psc0 : 4; /* port 0 state code */
53 unsigned int psc1 : 4; /* port 1 state code */
54} __attribute__ ((packed));
55
56/* Second level data register status word */
57struct etr_slsw {
58 unsigned int vv1 : 1; /* copy of validity bit data frame 1 */
59 unsigned int vv2 : 1; /* copy of validity bit data frame 2 */
60 unsigned int vv3 : 1; /* copy of validity bit data frame 3 */
61 unsigned int vv4 : 1; /* copy of validity bit data frame 4 */
62 unsigned int _pad0 : 19; /* must by all zeroes */
63 unsigned int n : 1; /* EAF port number */
64 unsigned int v1 : 1; /* validity bit ETR data frame 1 */
65 unsigned int v2 : 1; /* validity bit ETR data frame 2 */
66 unsigned int v3 : 1; /* validity bit ETR data frame 3 */
67 unsigned int v4 : 1; /* validity bit ETR data frame 4 */
68 unsigned int _pad1 : 4; /* must be 0000 */
69} __attribute__ ((packed));
70
71/* ETR data frames */
72struct etr_edf1 {
73 unsigned int u : 1; /* untuned bit */
74 unsigned int _pad0 : 1; /* must be 0 */
75 unsigned int r : 1; /* service request bit */
76 unsigned int _pad1 : 4; /* must be 0000 */
77 unsigned int a : 1; /* time adjustment bit */
78 unsigned int net_id : 8; /* ETR network id */
79 unsigned int etr_id : 8; /* id of ETR which sends data frames */
80 unsigned int etr_pn : 8; /* port number of ETR output port */
81} __attribute__ ((packed));
82
83struct etr_edf2 {
84 unsigned int etv : 32; /* Upper 32 bits of TOD. */
85} __attribute__ ((packed));
86
87struct etr_edf3 {
88 unsigned int rc : 8; /* failure reason code */
89 unsigned int _pad0 : 3; /* must be 000 */
90 unsigned int c : 1; /* ETR coupled bit */
91 unsigned int tc : 4; /* ETR type code */
92 unsigned int blto : 8; /* biased local time offset */
93 /* (blto - 128) * 15 = minutes */
94 unsigned int buo : 8; /* biased utc offset */
95 /* (buo - 128) = leap seconds */
96} __attribute__ ((packed));
97
98struct etr_edf4 {
99 unsigned int ed : 8; /* ETS device dependent data */
100 unsigned int _pad0 : 1; /* must be 0 */
101 unsigned int buc : 5; /* biased ut1 correction */
102 /* (buc - 16) * 0.1 seconds */
103 unsigned int em : 6; /* ETS error magnitude */
104 unsigned int dc : 6; /* ETS drift code */
105 unsigned int sc : 6; /* ETS steering code */
106} __attribute__ ((packed));
107
108/*
109 * ETR attachment information block, two formats
110 * format 1 has 4 reserved words with a size of 64 bytes
111 * format 2 has 16 reserved words with a size of 96 bytes
112 */
113struct etr_aib {
114 struct etr_esw esw;
115 struct etr_slsw slsw;
116 unsigned long long tsp;
117 struct etr_edf1 edf1;
118 struct etr_edf2 edf2;
119 struct etr_edf3 edf3;
120 struct etr_edf4 edf4;
121 unsigned int reserved[16];
122} __attribute__ ((packed,aligned(8)));
123
124/* ETR interruption parameter */
125struct etr_irq_parm {
126 unsigned int _pad0 : 8;
127 unsigned int pc0 : 1; /* port 0 state change */
128 unsigned int pc1 : 1; /* port 1 state change */
129 unsigned int _pad1 : 3;
130 unsigned int eai : 1; /* ETR alert indication */
131 unsigned int _pad2 : 18;
132} __attribute__ ((packed));
133
134/* Query TOD offset result */
135struct etr_ptff_qto {
136 unsigned long long physical_clock;
137 unsigned long long tod_offset;
138 unsigned long long logical_tod_offset;
139 unsigned long long tod_epoch_difference;
140} __attribute__ ((packed));
141
142/* Inline assembly helper functions */
143static inline int etr_setr(struct etr_eacr *ctrl)
144{
145 int rc = -ENOSYS;
146
147 asm volatile(
148 " .insn s,0xb2160000,0(%2)\n"
149 "0: la %0,0\n"
150 "1:\n"
151 EX_TABLE(0b,1b)
152 : "+d" (rc) : "m" (*ctrl), "a" (ctrl));
153 return rc;
154}
155
156/* Stores a format 1 aib with 64 bytes */
157static inline int etr_stetr(struct etr_aib *aib)
158{
159 int rc = -ENOSYS;
160
161 asm volatile(
162 " .insn s,0xb2170000,0(%2)\n"
163 "0: la %0,0\n"
164 "1:\n"
165 EX_TABLE(0b,1b)
166 : "+d" (rc) : "m" (*aib), "a" (aib));
167 return rc;
168}
169
170/* Stores a format 2 aib with 96 bytes for specified port */
171static inline int etr_steai(struct etr_aib *aib, unsigned int func)
172{
173 register unsigned int reg0 asm("0") = func;
174 int rc = -ENOSYS;
175
176 asm volatile(
177 " .insn s,0xb2b30000,0(%2)\n"
178 "0: la %0,0\n"
179 "1:\n"
180 EX_TABLE(0b,1b)
181 : "+d" (rc) : "m" (*aib), "a" (aib), "d" (reg0));
182 return rc;
183}
184
185/* Function codes for the steai instruction. */
186#define ETR_STEAI_STEPPING_PORT 0x10
187#define ETR_STEAI_ALTERNATE_PORT 0x11
188#define ETR_STEAI_PORT_0 0x12
189#define ETR_STEAI_PORT_1 0x13
190
191static inline int etr_ptff(void *ptff_block, unsigned int func)
192{
193 register unsigned int reg0 asm("0") = func;
194 register unsigned long reg1 asm("1") = (unsigned long) ptff_block;
195 int rc = -ENOSYS;
196
197 asm volatile(
198 " .word 0x0104\n"
199 " ipm %0\n"
200 " srl %0,28\n"
201 : "=d" (rc), "=m" (ptff_block)
202 : "d" (reg0), "d" (reg1), "m" (ptff_block) : "cc");
203 return rc;
204}
205
206/* Function codes for the ptff instruction. */
207#define ETR_PTFF_QAF 0x00 /* query available functions */
208#define ETR_PTFF_QTO 0x01 /* query tod offset */
209#define ETR_PTFF_QSI 0x02 /* query steering information */
210#define ETR_PTFF_ATO 0x40 /* adjust tod offset */
211#define ETR_PTFF_STO 0x41 /* set tod offset */
212#define ETR_PTFF_SFS 0x42 /* set fine steering rate */
213#define ETR_PTFF_SGS 0x43 /* set gross steering rate */
214
215/* Functions needed by the machine check handler */
216void etr_switch_to_local(void);
217void etr_sync_check(void);
218
219/* STP interruption parameter */
220struct stp_irq_parm {
221 unsigned int _pad0 : 14;
222 unsigned int tsc : 1; /* Timing status change */
223 unsigned int lac : 1; /* Link availability change */
224 unsigned int tcpc : 1; /* Time control parameter change */
225 unsigned int _pad2 : 15;
226} __attribute__ ((packed));
227
228#define STP_OP_SYNC 1
229#define STP_OP_CTRL 3
230
231struct stp_sstpi {
232 unsigned int rsvd0;
233 unsigned int rsvd1 : 8;
234 unsigned int stratum : 8;
235 unsigned int vbits : 16;
236 unsigned int leaps : 16;
237 unsigned int tmd : 4;
238 unsigned int ctn : 4;
239 unsigned int rsvd2 : 3;
240 unsigned int c : 1;
241 unsigned int tst : 4;
242 unsigned int tzo : 16;
243 unsigned int dsto : 16;
244 unsigned int ctrl : 16;
245 unsigned int rsvd3 : 16;
246 unsigned int tto;
247 unsigned int rsvd4;
248 unsigned int ctnid[3];
249 unsigned int rsvd5;
250 unsigned int todoff[4];
251 unsigned int rsvd6[48];
252} __attribute__ ((packed));
253
254/* Functions needed by the machine check handler */
255void stp_sync_check(void);
256void stp_island_check(void);
257
258#endif /* __S390_ETR_H */
diff --git a/arch/s390/include/asm/extmem.h b/arch/s390/include/asm/extmem.h
new file mode 100644
index 000000000000..33837d756184
--- /dev/null
+++ b/arch/s390/include/asm/extmem.h
@@ -0,0 +1,33 @@
1/*
2 * include/asm-s390x/extmem.h
3 *
4 * definitions for external memory segment support
5 * Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 */
7
8#ifndef _ASM_S390X_DCSS_H
9#define _ASM_S390X_DCSS_H
10#ifndef __ASSEMBLY__
11
12/* possible values for segment type as returned by segment_info */
13#define SEG_TYPE_SW 0
14#define SEG_TYPE_EW 1
15#define SEG_TYPE_SR 2
16#define SEG_TYPE_ER 3
17#define SEG_TYPE_SN 4
18#define SEG_TYPE_EN 5
19#define SEG_TYPE_SC 6
20#define SEG_TYPE_EWEN 7
21
22#define SEGMENT_SHARED 0
23#define SEGMENT_EXCLUSIVE 1
24
25int segment_load (char *name, int segtype, unsigned long *addr, unsigned long *length);
26void segment_unload(char *name);
27void segment_save(char *name);
28int segment_type (char* name);
29int segment_modify_shared (char *name, int do_nonshared);
30void segment_warning(int rc, char *seg_name);
31
32#endif
33#endif
diff --git a/arch/s390/include/asm/fb.h b/arch/s390/include/asm/fb.h
new file mode 100644
index 000000000000..c7df38030992
--- /dev/null
+++ b/arch/s390/include/asm/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/arch/s390/include/asm/fcntl.h b/arch/s390/include/asm/fcntl.h
new file mode 100644
index 000000000000..46ab12db5739
--- /dev/null
+++ b/arch/s390/include/asm/fcntl.h
@@ -0,0 +1 @@
#include <asm-generic/fcntl.h>
diff --git a/arch/s390/include/asm/fcx.h b/arch/s390/include/asm/fcx.h
new file mode 100644
index 000000000000..8be1f3a58042
--- /dev/null
+++ b/arch/s390/include/asm/fcx.h
@@ -0,0 +1,311 @@
1/*
2 * Functions for assembling fcx enabled I/O control blocks.
3 *
4 * Copyright IBM Corp. 2008
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_FCX_H
9#define _ASM_S390_FCX_H _ASM_S390_FCX_H
10
11#include <linux/types.h>
12
13#define TCW_FORMAT_DEFAULT 0
14#define TCW_TIDAW_FORMAT_DEFAULT 0
15#define TCW_FLAGS_INPUT_TIDA 1 << (23 - 5)
16#define TCW_FLAGS_TCCB_TIDA 1 << (23 - 6)
17#define TCW_FLAGS_OUTPUT_TIDA 1 << (23 - 7)
18#define TCW_FLAGS_TIDAW_FORMAT(x) ((x) & 3) << (23 - 9)
19#define TCW_FLAGS_GET_TIDAW_FORMAT(x) (((x) >> (23 - 9)) & 3)
20
21/**
22 * struct tcw - Transport Control Word (TCW)
23 * @format: TCW format
24 * @flags: TCW flags
25 * @tccbl: Transport-Command-Control-Block Length
26 * @r: Read Operations
27 * @w: Write Operations
28 * @output: Output-Data Address
29 * @input: Input-Data Address
30 * @tsb: Transport-Status-Block Address
31 * @tccb: Transport-Command-Control-Block Address
32 * @output_count: Output Count
33 * @input_count: Input Count
34 * @intrg: Interrogate TCW Address
35 */
36struct tcw {
37 u32 format:2;
38 u32 :6;
39 u32 flags:24;
40 u32 :8;
41 u32 tccbl:6;
42 u32 r:1;
43 u32 w:1;
44 u32 :16;
45 u64 output;
46 u64 input;
47 u64 tsb;
48 u64 tccb;
49 u32 output_count;
50 u32 input_count;
51 u32 :32;
52 u32 :32;
53 u32 :32;
54 u32 intrg;
55} __attribute__ ((packed, aligned(64)));
56
57#define TIDAW_FLAGS_LAST 1 << (7 - 0)
58#define TIDAW_FLAGS_SKIP 1 << (7 - 1)
59#define TIDAW_FLAGS_DATA_INT 1 << (7 - 2)
60#define TIDAW_FLAGS_TTIC 1 << (7 - 3)
61#define TIDAW_FLAGS_INSERT_CBC 1 << (7 - 4)
62
63/**
64 * struct tidaw - Transport-Indirect-Addressing Word (TIDAW)
65 * @flags: TIDAW flags. Can be an arithmetic OR of the following constants:
66 * %TIDAW_FLAGS_LAST, %TIDAW_FLAGS_SKIP, %TIDAW_FLAGS_DATA_INT,
67 * %TIDAW_FLAGS_TTIC, %TIDAW_FLAGS_INSERT_CBC
68 * @count: Count
69 * @addr: Address
70 */
71struct tidaw {
72 u32 flags:8;
73 u32 :24;
74 u32 count;
75 u64 addr;
76} __attribute__ ((packed, aligned(16)));
77
78/**
79 * struct tsa_iostat - I/O-Status Transport-Status Area (IO-Stat TSA)
80 * @dev_time: Device Time
81 * @def_time: Defer Time
82 * @queue_time: Queue Time
83 * @dev_busy_time: Device-Busy Time
84 * @dev_act_time: Device-Active-Only Time
85 * @sense: Sense Data (if present)
86 */
87struct tsa_iostat {
88 u32 dev_time;
89 u32 def_time;
90 u32 queue_time;
91 u32 dev_busy_time;
92 u32 dev_act_time;
93 u8 sense[32];
94} __attribute__ ((packed));
95
96/**
97 * struct tsa_ddpcs - Device-Detected-Program-Check Transport-Status Area (DDPC TSA)
98 * @rc: Reason Code
99 * @rcq: Reason Code Qualifier
100 * @sense: Sense Data (if present)
101 */
102struct tsa_ddpc {
103 u32 :24;
104 u32 rc:8;
105 u8 rcq[16];
106 u8 sense[32];
107} __attribute__ ((packed));
108
109#define TSA_INTRG_FLAGS_CU_STATE_VALID 1 << (7 - 0)
110#define TSA_INTRG_FLAGS_DEV_STATE_VALID 1 << (7 - 1)
111#define TSA_INTRG_FLAGS_OP_STATE_VALID 1 << (7 - 2)
112
113/**
114 * struct tsa_intrg - Interrogate Transport-Status Area (Intrg. TSA)
115 * @format: Format
116 * @flags: Flags. Can be an arithmetic OR of the following constants:
117 * %TSA_INTRG_FLAGS_CU_STATE_VALID, %TSA_INTRG_FLAGS_DEV_STATE_VALID,
118 * %TSA_INTRG_FLAGS_OP_STATE_VALID
119 * @cu_state: Controle-Unit State
120 * @dev_state: Device State
121 * @op_state: Operation State
122 * @sd_info: State-Dependent Information
123 * @dl_id: Device-Level Identifier
124 * @dd_data: Device-Dependent Data
125 */
126struct tsa_intrg {
127 u32 format:8;
128 u32 flags:8;
129 u32 cu_state:8;
130 u32 dev_state:8;
131 u32 op_state:8;
132 u32 :24;
133 u8 sd_info[12];
134 u32 dl_id;
135 u8 dd_data[28];
136} __attribute__ ((packed));
137
138#define TSB_FORMAT_NONE 0
139#define TSB_FORMAT_IOSTAT 1
140#define TSB_FORMAT_DDPC 2
141#define TSB_FORMAT_INTRG 3
142
143#define TSB_FLAGS_DCW_OFFSET_VALID 1 << (7 - 0)
144#define TSB_FLAGS_COUNT_VALID 1 << (7 - 1)
145#define TSB_FLAGS_CACHE_MISS 1 << (7 - 2)
146#define TSB_FLAGS_TIME_VALID 1 << (7 - 3)
147#define TSB_FLAGS_FORMAT(x) ((x) & 7)
148#define TSB_FORMAT(t) ((t)->flags & 7)
149
150/**
151 * struct tsb - Transport-Status Block (TSB)
152 * @length: Length
153 * @flags: Flags. Can be an arithmetic OR of the following constants:
154 * %TSB_FLAGS_DCW_OFFSET_VALID, %TSB_FLAGS_COUNT_VALID, %TSB_FLAGS_CACHE_MISS,
155 * %TSB_FLAGS_TIME_VALID
156 * @dcw_offset: DCW Offset
157 * @count: Count
158 * @tsa: Transport-Status-Area
159 */
160struct tsb {
161 u32 length:8;
162 u32 flags:8;
163 u32 dcw_offset:16;
164 u32 count;
165 u32 :32;
166 union {
167 struct tsa_iostat iostat;
168 struct tsa_ddpc ddpc;
169 struct tsa_intrg intrg;
170 } __attribute__ ((packed)) tsa;
171} __attribute__ ((packed, aligned(8)));
172
173#define DCW_INTRG_FORMAT_DEFAULT 0
174
175#define DCW_INTRG_RC_UNSPECIFIED 0
176#define DCW_INTRG_RC_TIMEOUT 1
177
178#define DCW_INTRG_RCQ_UNSPECIFIED 0
179#define DCW_INTRG_RCQ_PRIMARY 1
180#define DCW_INTRG_RCQ_SECONDARY 2
181
182#define DCW_INTRG_FLAGS_MPM 1 < (7 - 0)
183#define DCW_INTRG_FLAGS_PPR 1 < (7 - 1)
184#define DCW_INTRG_FLAGS_CRIT 1 < (7 - 2)
185
186/**
187 * struct dcw_intrg_data - Interrogate DCW data
188 * @format: Format. Should be %DCW_INTRG_FORMAT_DEFAULT
189 * @rc: Reason Code. Can be one of %DCW_INTRG_RC_UNSPECIFIED,
190 * %DCW_INTRG_RC_TIMEOUT
191 * @rcq: Reason Code Qualifier: Can be one of %DCW_INTRG_RCQ_UNSPECIFIED,
192 * %DCW_INTRG_RCQ_PRIMARY, %DCW_INTRG_RCQ_SECONDARY
193 * @lpm: Logical-Path Mask
194 * @pam: Path-Available Mask
195 * @pim: Path-Installed Mask
196 * @timeout: Timeout
197 * @flags: Flags. Can be an arithmetic OR of %DCW_INTRG_FLAGS_MPM,
198 * %DCW_INTRG_FLAGS_PPR, %DCW_INTRG_FLAGS_CRIT
199 * @time: Time
200 * @prog_id: Program Identifier
201 * @prog_data: Program-Dependent Data
202 */
203struct dcw_intrg_data {
204 u32 format:8;
205 u32 rc:8;
206 u32 rcq:8;
207 u32 lpm:8;
208 u32 pam:8;
209 u32 pim:8;
210 u32 timeout:16;
211 u32 flags:8;
212 u32 :24;
213 u32 :32;
214 u64 time;
215 u64 prog_id;
216 u8 prog_data[0];
217} __attribute__ ((packed));
218
219#define DCW_FLAGS_CC 1 << (7 - 1)
220
221#define DCW_CMD_WRITE 0x01
222#define DCW_CMD_READ 0x02
223#define DCW_CMD_CONTROL 0x03
224#define DCW_CMD_SENSE 0x04
225#define DCW_CMD_SENSE_ID 0xe4
226#define DCW_CMD_INTRG 0x40
227
228/**
229 * struct dcw - Device-Command Word (DCW)
230 * @cmd: Command Code. Can be one of %DCW_CMD_WRITE, %DCW_CMD_READ,
231 * %DCW_CMD_CONTROL, %DCW_CMD_SENSE, %DCW_CMD_SENSE_ID, %DCW_CMD_INTRG
232 * @flags: Flags. Can be an arithmetic OR of %DCW_FLAGS_CC
233 * @cd_count: Control-Data Count
234 * @count: Count
235 * @cd: Control Data
236 */
237struct dcw {
238 u32 cmd:8;
239 u32 flags:8;
240 u32 :8;
241 u32 cd_count:8;
242 u32 count;
243 u8 cd[0];
244} __attribute__ ((packed));
245
246#define TCCB_FORMAT_DEFAULT 0x7f
247#define TCCB_MAX_DCW 30
248#define TCCB_MAX_SIZE (sizeof(struct tccb_tcah) + \
249 TCCB_MAX_DCW * sizeof(struct dcw) + \
250 sizeof(struct tccb_tcat))
251#define TCCB_SAC_DEFAULT 0xf901
252#define TCCB_SAC_INTRG 0xf902
253
254/**
255 * struct tccb_tcah - Transport-Command-Area Header (TCAH)
256 * @format: Format. Should be %TCCB_FORMAT_DEFAULT
257 * @tcal: Transport-Command-Area Length
258 * @sac: Service-Action Code. Can be one of %TCCB_SAC_DEFAULT, %TCCB_SAC_INTRG
259 * @prio: Priority
260 */
261struct tccb_tcah {
262 u32 format:8;
263 u32 :24;
264 u32 :24;
265 u32 tcal:8;
266 u32 sac:16;
267 u32 :8;
268 u32 prio:8;
269 u32 :32;
270} __attribute__ ((packed));
271
272/**
273 * struct tccb_tcat - Transport-Command-Area Trailer (TCAT)
274 * @count: Transport Count
275 */
276struct tccb_tcat {
277 u32 :32;
278 u32 count;
279} __attribute__ ((packed));
280
281/**
282 * struct tccb - (partial) Transport-Command-Control Block (TCCB)
283 * @tcah: TCAH
284 * @tca: Transport-Command Area
285 */
286struct tccb {
287 struct tccb_tcah tcah;
288 u8 tca[0];
289} __attribute__ ((packed, aligned(8)));
290
291struct tcw *tcw_get_intrg(struct tcw *tcw);
292void *tcw_get_data(struct tcw *tcw);
293struct tccb *tcw_get_tccb(struct tcw *tcw);
294struct tsb *tcw_get_tsb(struct tcw *tcw);
295
296void tcw_init(struct tcw *tcw, int r, int w);
297void tcw_finalize(struct tcw *tcw, int num_tidaws);
298
299void tcw_set_intrg(struct tcw *tcw, struct tcw *intrg_tcw);
300void tcw_set_data(struct tcw *tcw, void *data, int use_tidal);
301void tcw_set_tccb(struct tcw *tcw, struct tccb *tccb);
302void tcw_set_tsb(struct tcw *tcw, struct tsb *tsb);
303
304void tccb_init(struct tccb *tccb, size_t tccb_size, u32 sac);
305void tsb_init(struct tsb *tsb);
306struct dcw *tccb_add_dcw(struct tccb *tccb, size_t tccb_size, u8 cmd, u8 flags,
307 void *cd, u8 cd_count, u32 count);
308struct tidaw *tcw_add_tidaw(struct tcw *tcw, int num_tidaws, u8 flags,
309 void *addr, u32 count);
310
311#endif /* _ASM_S390_FCX_H */
diff --git a/arch/s390/include/asm/futex.h b/arch/s390/include/asm/futex.h
new file mode 100644
index 000000000000..5c5d02de49e9
--- /dev/null
+++ b/arch/s390/include/asm/futex.h
@@ -0,0 +1,52 @@
1#ifndef _ASM_S390_FUTEX_H
2#define _ASM_S390_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <linux/uaccess.h>
8#include <asm/errno.h>
9
10static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
11{
12 int op = (encoded_op >> 28) & 7;
13 int cmp = (encoded_op >> 24) & 15;
14 int oparg = (encoded_op << 8) >> 20;
15 int cmparg = (encoded_op << 20) >> 20;
16 int oldval, ret;
17
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 pagefault_disable();
25 ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval);
26 pagefault_enable();
27
28 if (!ret) {
29 switch (cmp) {
30 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
31 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
32 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
33 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
34 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
35 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
36 default: ret = -ENOSYS;
37 }
38 }
39 return ret;
40}
41
42static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr,
43 int oldval, int newval)
44{
45 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
46 return -EFAULT;
47
48 return uaccess.futex_atomic_cmpxchg(uaddr, oldval, newval);
49}
50
51#endif /* __KERNEL__ */
52#endif /* _ASM_S390_FUTEX_H */
diff --git a/arch/s390/include/asm/hardirq.h b/arch/s390/include/asm/hardirq.h
new file mode 100644
index 000000000000..89ec7056da28
--- /dev/null
+++ b/arch/s390/include/asm/hardirq.h
@@ -0,0 +1,51 @@
1/*
2 * include/asm-s390/hardirq.h
3 *
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
8 *
9 * Derived from "include/asm-i386/hardirq.h"
10 */
11
12#ifndef __ASM_HARDIRQ_H
13#define __ASM_HARDIRQ_H
14
15#include <linux/threads.h>
16#include <linux/sched.h>
17#include <linux/cache.h>
18#include <linux/interrupt.h>
19#include <asm/lowcore.h>
20
21/* irq_cpustat_t is unused currently, but could be converted
22 * into a percpu variable instead of storing softirq_pending
23 * on the lowcore */
24typedef struct {
25 unsigned int __softirq_pending;
26} irq_cpustat_t;
27
28#define local_softirq_pending() (S390_lowcore.softirq_pending)
29
30#define __ARCH_IRQ_STAT
31#define __ARCH_HAS_DO_SOFTIRQ
32
33#define HARDIRQ_BITS 8
34
35void clock_comparator_work(void);
36
37static inline unsigned long long local_tick_disable(void)
38{
39 unsigned long long old;
40
41 old = S390_lowcore.clock_comparator;
42 S390_lowcore.clock_comparator = -1ULL;
43 return old;
44}
45
46static inline void local_tick_enable(unsigned long long comp)
47{
48 S390_lowcore.clock_comparator = comp;
49}
50
51#endif /* __ASM_HARDIRQ_H */
diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
new file mode 100644
index 000000000000..670a1d1745d2
--- /dev/null
+++ b/arch/s390/include/asm/hugetlb.h
@@ -0,0 +1,184 @@
1/*
2 * IBM System z Huge TLB Page Support for Kernel.
3 *
4 * Copyright IBM Corp. 2008
5 * Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_HUGETLB_H
9#define _ASM_S390_HUGETLB_H
10
11#include <asm/page.h>
12#include <asm/pgtable.h>
13
14
15#define is_hugepage_only_range(mm, addr, len) 0
16#define hugetlb_free_pgd_range free_pgd_range
17
18void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
19 pte_t *ptep, pte_t pte);
20
21/*
22 * If the arch doesn't supply something else, assume that hugepage
23 * size aligned regions are ok without further preparation.
24 */
25static inline int prepare_hugepage_range(struct file *file,
26 unsigned long addr, unsigned long len)
27{
28 if (len & ~HPAGE_MASK)
29 return -EINVAL;
30 if (addr & ~HPAGE_MASK)
31 return -EINVAL;
32 return 0;
33}
34
35#define hugetlb_prefault_arch_hook(mm) do { } while (0)
36
37int arch_prepare_hugepage(struct page *page);
38void arch_release_hugepage(struct page *page);
39
40static inline pte_t pte_mkhuge(pte_t pte)
41{
42 /*
43 * PROT_NONE needs to be remapped from the pte type to the ste type.
44 * The HW invalid bit is also different for pte and ste. The pte
45 * invalid bit happens to be the same as the ste _SEGMENT_ENTRY_LARGE
46 * bit, so we don't have to clear it.
47 */
48 if (pte_val(pte) & _PAGE_INVALID) {
49 if (pte_val(pte) & _PAGE_SWT)
50 pte_val(pte) |= _HPAGE_TYPE_NONE;
51 pte_val(pte) |= _SEGMENT_ENTRY_INV;
52 }
53 /*
54 * Clear SW pte bits SWT and SWX, there are no SW bits in a segment
55 * table entry.
56 */
57 pte_val(pte) &= ~(_PAGE_SWT | _PAGE_SWX);
58 /*
59 * Also set the change-override bit because we don't need dirty bit
60 * tracking for hugetlbfs pages.
61 */
62 pte_val(pte) |= (_SEGMENT_ENTRY_LARGE | _SEGMENT_ENTRY_CO);
63 return pte;
64}
65
66static inline pte_t huge_pte_wrprotect(pte_t pte)
67{
68 pte_val(pte) |= _PAGE_RO;
69 return pte;
70}
71
72static inline int huge_pte_none(pte_t pte)
73{
74 return (pte_val(pte) & _SEGMENT_ENTRY_INV) &&
75 !(pte_val(pte) & _SEGMENT_ENTRY_RO);
76}
77
78static inline pte_t huge_ptep_get(pte_t *ptep)
79{
80 pte_t pte = *ptep;
81 unsigned long mask;
82
83 if (!MACHINE_HAS_HPAGE) {
84 ptep = (pte_t *) (pte_val(pte) & _SEGMENT_ENTRY_ORIGIN);
85 if (ptep) {
86 mask = pte_val(pte) &
87 (_SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO);
88 pte = pte_mkhuge(*ptep);
89 pte_val(pte) |= mask;
90 }
91 }
92 return pte;
93}
94
95static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
96 unsigned long addr, pte_t *ptep)
97{
98 pte_t pte = huge_ptep_get(ptep);
99
100 pmd_clear((pmd_t *) ptep);
101 return pte;
102}
103
104static inline void __pmd_csp(pmd_t *pmdp)
105{
106 register unsigned long reg2 asm("2") = pmd_val(*pmdp);
107 register unsigned long reg3 asm("3") = pmd_val(*pmdp) |
108 _SEGMENT_ENTRY_INV;
109 register unsigned long reg4 asm("4") = ((unsigned long) pmdp) + 5;
110
111 asm volatile(
112 " csp %1,%3"
113 : "=m" (*pmdp)
114 : "d" (reg2), "d" (reg3), "d" (reg4), "m" (*pmdp) : "cc");
115 pmd_val(*pmdp) = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY;
116}
117
118static inline void __pmd_idte(unsigned long address, pmd_t *pmdp)
119{
120 unsigned long sto = (unsigned long) pmdp -
121 pmd_index(address) * sizeof(pmd_t);
122
123 if (!(pmd_val(*pmdp) & _SEGMENT_ENTRY_INV)) {
124 asm volatile(
125 " .insn rrf,0xb98e0000,%2,%3,0,0"
126 : "=m" (*pmdp)
127 : "m" (*pmdp), "a" (sto),
128 "a" ((address & HPAGE_MASK))
129 );
130 }
131 pmd_val(*pmdp) = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY;
132}
133
134static inline void huge_ptep_invalidate(struct mm_struct *mm,
135 unsigned long address, pte_t *ptep)
136{
137 pmd_t *pmdp = (pmd_t *) ptep;
138
139 if (!MACHINE_HAS_IDTE) {
140 __pmd_csp(pmdp);
141 if (mm->context.noexec) {
142 pmdp = get_shadow_table(pmdp);
143 __pmd_csp(pmdp);
144 }
145 return;
146 }
147
148 __pmd_idte(address, pmdp);
149 if (mm->context.noexec) {
150 pmdp = get_shadow_table(pmdp);
151 __pmd_idte(address, pmdp);
152 }
153 return;
154}
155
156#define huge_ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty) \
157({ \
158 int __changed = !pte_same(huge_ptep_get(__ptep), __entry); \
159 if (__changed) { \
160 huge_ptep_invalidate((__vma)->vm_mm, __addr, __ptep); \
161 set_huge_pte_at((__vma)->vm_mm, __addr, __ptep, __entry); \
162 } \
163 __changed; \
164})
165
166#define huge_ptep_set_wrprotect(__mm, __addr, __ptep) \
167({ \
168 pte_t __pte = huge_ptep_get(__ptep); \
169 if (pte_write(__pte)) { \
170 if (atomic_read(&(__mm)->mm_users) > 1 || \
171 (__mm) != current->active_mm) \
172 huge_ptep_invalidate(__mm, __addr, __ptep); \
173 set_huge_pte_at(__mm, __addr, __ptep, \
174 huge_pte_wrprotect(__pte)); \
175 } \
176})
177
178static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
179 unsigned long address, pte_t *ptep)
180{
181 huge_ptep_invalidate(vma->vm_mm, address, ptep);
182}
183
184#endif /* _ASM_S390_HUGETLB_H */
diff --git a/arch/s390/include/asm/idals.h b/arch/s390/include/asm/idals.h
new file mode 100644
index 000000000000..e82c10efe65a
--- /dev/null
+++ b/arch/s390/include/asm/idals.h
@@ -0,0 +1,256 @@
1/*
2 * File...........: linux/include/asm-s390x/idals.h
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Martin Schwidefsky <schwidefsky@de.ibm.com>
5 * Bugreports.to..: <Linux390@de.ibm.com>
6 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000a
7
8 * History of changes
9 * 07/24/00 new file
10 * 05/04/02 code restructuring.
11 */
12
13#ifndef _S390_IDALS_H
14#define _S390_IDALS_H
15
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/types.h>
19#include <linux/slab.h>
20#include <asm/cio.h>
21#include <asm/uaccess.h>
22
23#ifdef __s390x__
24#define IDA_SIZE_LOG 12 /* 11 for 2k , 12 for 4k */
25#else
26#define IDA_SIZE_LOG 11 /* 11 for 2k , 12 for 4k */
27#endif
28#define IDA_BLOCK_SIZE (1L<<IDA_SIZE_LOG)
29
30/*
31 * Test if an address/length pair needs an idal list.
32 */
33static inline int
34idal_is_needed(void *vaddr, unsigned int length)
35{
36#ifdef __s390x__
37 return ((__pa(vaddr) + length - 1) >> 31) != 0;
38#else
39 return 0;
40#endif
41}
42
43
44/*
45 * Return the number of idal words needed for an address/length pair.
46 */
47static inline unsigned int
48idal_nr_words(void *vaddr, unsigned int length)
49{
50#ifdef __s390x__
51 if (idal_is_needed(vaddr, length))
52 return ((__pa(vaddr) & (IDA_BLOCK_SIZE-1)) + length +
53 (IDA_BLOCK_SIZE-1)) >> IDA_SIZE_LOG;
54#endif
55 return 0;
56}
57
58/*
59 * Create the list of idal words for an address/length pair.
60 */
61static inline unsigned long *
62idal_create_words(unsigned long *idaws, void *vaddr, unsigned int length)
63{
64#ifdef __s390x__
65 unsigned long paddr;
66 unsigned int cidaw;
67
68 paddr = __pa(vaddr);
69 cidaw = ((paddr & (IDA_BLOCK_SIZE-1)) + length +
70 (IDA_BLOCK_SIZE-1)) >> IDA_SIZE_LOG;
71 *idaws++ = paddr;
72 paddr &= -IDA_BLOCK_SIZE;
73 while (--cidaw > 0) {
74 paddr += IDA_BLOCK_SIZE;
75 *idaws++ = paddr;
76 }
77#endif
78 return idaws;
79}
80
81/*
82 * Sets the address of the data in CCW.
83 * If necessary it allocates an IDAL and sets the appropriate flags.
84 */
85static inline int
86set_normalized_cda(struct ccw1 * ccw, void *vaddr)
87{
88#ifdef __s390x__
89 unsigned int nridaws;
90 unsigned long *idal;
91
92 if (ccw->flags & CCW_FLAG_IDA)
93 return -EINVAL;
94 nridaws = idal_nr_words(vaddr, ccw->count);
95 if (nridaws > 0) {
96 idal = kmalloc(nridaws * sizeof(unsigned long),
97 GFP_ATOMIC | GFP_DMA );
98 if (idal == NULL)
99 return -ENOMEM;
100 idal_create_words(idal, vaddr, ccw->count);
101 ccw->flags |= CCW_FLAG_IDA;
102 vaddr = idal;
103 }
104#endif
105 ccw->cda = (__u32)(unsigned long) vaddr;
106 return 0;
107}
108
109/*
110 * Releases any allocated IDAL related to the CCW.
111 */
112static inline void
113clear_normalized_cda(struct ccw1 * ccw)
114{
115#ifdef __s390x__
116 if (ccw->flags & CCW_FLAG_IDA) {
117 kfree((void *)(unsigned long) ccw->cda);
118 ccw->flags &= ~CCW_FLAG_IDA;
119 }
120#endif
121 ccw->cda = 0;
122}
123
124/*
125 * Idal buffer extension
126 */
127struct idal_buffer {
128 size_t size;
129 size_t page_order;
130 void *data[0];
131};
132
133/*
134 * Allocate an idal buffer
135 */
136static inline struct idal_buffer *
137idal_buffer_alloc(size_t size, int page_order)
138{
139 struct idal_buffer *ib;
140 int nr_chunks, nr_ptrs, i;
141
142 nr_ptrs = (size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG;
143 nr_chunks = (4096 << page_order) >> IDA_SIZE_LOG;
144 ib = kmalloc(sizeof(struct idal_buffer) + nr_ptrs*sizeof(void *),
145 GFP_DMA | GFP_KERNEL);
146 if (ib == NULL)
147 return ERR_PTR(-ENOMEM);
148 ib->size = size;
149 ib->page_order = page_order;
150 for (i = 0; i < nr_ptrs; i++) {
151 if ((i & (nr_chunks - 1)) != 0) {
152 ib->data[i] = ib->data[i-1] + IDA_BLOCK_SIZE;
153 continue;
154 }
155 ib->data[i] = (void *)
156 __get_free_pages(GFP_KERNEL, page_order);
157 if (ib->data[i] != NULL)
158 continue;
159 // Not enough memory
160 while (i >= nr_chunks) {
161 i -= nr_chunks;
162 free_pages((unsigned long) ib->data[i],
163 ib->page_order);
164 }
165 kfree(ib);
166 return ERR_PTR(-ENOMEM);
167 }
168 return ib;
169}
170
171/*
172 * Free an idal buffer.
173 */
174static inline void
175idal_buffer_free(struct idal_buffer *ib)
176{
177 int nr_chunks, nr_ptrs, i;
178
179 nr_ptrs = (ib->size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG;
180 nr_chunks = (4096 << ib->page_order) >> IDA_SIZE_LOG;
181 for (i = 0; i < nr_ptrs; i += nr_chunks)
182 free_pages((unsigned long) ib->data[i], ib->page_order);
183 kfree(ib);
184}
185
186/*
187 * Test if a idal list is really needed.
188 */
189static inline int
190__idal_buffer_is_needed(struct idal_buffer *ib)
191{
192#ifdef __s390x__
193 return ib->size > (4096ul << ib->page_order) ||
194 idal_is_needed(ib->data[0], ib->size);
195#else
196 return ib->size > (4096ul << ib->page_order);
197#endif
198}
199
200/*
201 * Set channel data address to idal buffer.
202 */
203static inline void
204idal_buffer_set_cda(struct idal_buffer *ib, struct ccw1 *ccw)
205{
206 if (__idal_buffer_is_needed(ib)) {
207 // setup idals;
208 ccw->cda = (u32)(addr_t) ib->data;
209 ccw->flags |= CCW_FLAG_IDA;
210 } else
211 // we do not need idals - use direct addressing
212 ccw->cda = (u32)(addr_t) ib->data[0];
213 ccw->count = ib->size;
214}
215
216/*
217 * Copy count bytes from an idal buffer to user memory
218 */
219static inline size_t
220idal_buffer_to_user(struct idal_buffer *ib, void __user *to, size_t count)
221{
222 size_t left;
223 int i;
224
225 BUG_ON(count > ib->size);
226 for (i = 0; count > IDA_BLOCK_SIZE; i++) {
227 left = copy_to_user(to, ib->data[i], IDA_BLOCK_SIZE);
228 if (left)
229 return left + count - IDA_BLOCK_SIZE;
230 to = (void __user *) to + IDA_BLOCK_SIZE;
231 count -= IDA_BLOCK_SIZE;
232 }
233 return copy_to_user(to, ib->data[i], count);
234}
235
236/*
237 * Copy count bytes from user memory to an idal buffer
238 */
239static inline size_t
240idal_buffer_from_user(struct idal_buffer *ib, const void __user *from, size_t count)
241{
242 size_t left;
243 int i;
244
245 BUG_ON(count > ib->size);
246 for (i = 0; count > IDA_BLOCK_SIZE; i++) {
247 left = copy_from_user(ib->data[i], from, IDA_BLOCK_SIZE);
248 if (left)
249 return left + count - IDA_BLOCK_SIZE;
250 from = (void __user *) from + IDA_BLOCK_SIZE;
251 count -= IDA_BLOCK_SIZE;
252 }
253 return copy_from_user(ib->data[i], from, count);
254}
255
256#endif
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
new file mode 100644
index 000000000000..b7ff6afc3caa
--- /dev/null
+++ b/arch/s390/include/asm/io.h
@@ -0,0 +1,54 @@
1/*
2 * include/asm-s390/io.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * Derived from "include/asm-i386/io.h"
9 */
10
11#ifndef _S390_IO_H
12#define _S390_IO_H
13
14#ifdef __KERNEL__
15
16#include <asm/page.h>
17
18#define IO_SPACE_LIMIT 0xffffffff
19
20/*
21 * Change virtual addresses to physical addresses and vv.
22 * These are pretty trivial
23 */
24static inline unsigned long virt_to_phys(volatile void * address)
25{
26 unsigned long real_address;
27 asm volatile(
28 " lra %0,0(%1)\n"
29 " jz 0f\n"
30 " la %0,0\n"
31 "0:"
32 : "=a" (real_address) : "a" (address) : "cc");
33 return real_address;
34}
35
36static inline void * phys_to_virt(unsigned long address)
37{
38 return (void *) address;
39}
40
41/*
42 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
43 * access
44 */
45#define xlate_dev_mem_ptr(p) __va(p)
46
47/*
48 * Convert a virtual cached pointer to an uncached pointer
49 */
50#define xlate_dev_kmem_ptr(p) p
51
52#endif /* __KERNEL__ */
53
54#endif
diff --git a/arch/s390/include/asm/ioctl.h b/arch/s390/include/asm/ioctl.h
new file mode 100644
index 000000000000..b279fe06dfe5
--- /dev/null
+++ b/arch/s390/include/asm/ioctl.h
@@ -0,0 +1 @@
#include <asm-generic/ioctl.h>
diff --git a/arch/s390/include/asm/ioctls.h b/arch/s390/include/asm/ioctls.h
new file mode 100644
index 000000000000..40e481b1b461
--- /dev/null
+++ b/arch/s390/include/asm/ioctls.h
@@ -0,0 +1,92 @@
1/*
2 * include/asm-s390/ioctls.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/ioctls.h"
7 */
8
9#ifndef __ARCH_S390_IOCTLS_H__
10#define __ARCH_S390_IOCTLS_H__
11
12#include <asm/ioctl.h>
13
14/* 0x54 is just a magic number to make these relatively unique ('T') */
15
16#define TCGETS 0x5401
17#define TCSETS 0x5402
18#define TCSETSW 0x5403
19#define TCSETSF 0x5404
20#define TCGETA 0x5405
21#define TCSETA 0x5406
22#define TCSETAW 0x5407
23#define TCSETAF 0x5408
24#define TCSBRK 0x5409
25#define TCXONC 0x540A
26#define TCFLSH 0x540B
27#define TIOCEXCL 0x540C
28#define TIOCNXCL 0x540D
29#define TIOCSCTTY 0x540E
30#define TIOCGPGRP 0x540F
31#define TIOCSPGRP 0x5410
32#define TIOCOUTQ 0x5411
33#define TIOCSTI 0x5412
34#define TIOCGWINSZ 0x5413
35#define TIOCSWINSZ 0x5414
36#define TIOCMGET 0x5415
37#define TIOCMBIS 0x5416
38#define TIOCMBIC 0x5417
39#define TIOCMSET 0x5418
40#define TIOCGSOFTCAR 0x5419
41#define TIOCSSOFTCAR 0x541A
42#define FIONREAD 0x541B
43#define TIOCINQ FIONREAD
44#define TIOCLINUX 0x541C
45#define TIOCCONS 0x541D
46#define TIOCGSERIAL 0x541E
47#define TIOCSSERIAL 0x541F
48#define TIOCPKT 0x5420
49#define FIONBIO 0x5421
50#define TIOCNOTTY 0x5422
51#define TIOCSETD 0x5423
52#define TIOCGETD 0x5424
53#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
54#define TIOCSBRK 0x5427 /* BSD compatibility */
55#define TIOCCBRK 0x5428 /* BSD compatibility */
56#define TIOCGSID 0x5429 /* Return the session ID of FD */
57#define TCGETS2 _IOR('T',0x2A, struct termios2)
58#define TCSETS2 _IOW('T',0x2B, struct termios2)
59#define TCSETSW2 _IOW('T',0x2C, struct termios2)
60#define TCSETSF2 _IOW('T',0x2D, struct termios2)
61#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
62#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
63
64#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
65#define FIOCLEX 0x5451
66#define FIOASYNC 0x5452
67#define TIOCSERCONFIG 0x5453
68#define TIOCSERGWILD 0x5454
69#define TIOCSERSWILD 0x5455
70#define TIOCGLCKTRMIOS 0x5456
71#define TIOCSLCKTRMIOS 0x5457
72#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
73#define TIOCSERGETLSR 0x5459 /* Get line status register */
74#define TIOCSERGETMULTI 0x545A /* Get multiport config */
75#define TIOCSERSETMULTI 0x545B /* Set multiport config */
76
77#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
78#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
79#define FIOQSIZE 0x545E
80
81/* Used for packet mode */
82#define TIOCPKT_DATA 0
83#define TIOCPKT_FLUSHREAD 1
84#define TIOCPKT_FLUSHWRITE 2
85#define TIOCPKT_STOP 4
86#define TIOCPKT_START 8
87#define TIOCPKT_NOSTOP 16
88#define TIOCPKT_DOSTOP 32
89
90#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
91
92#endif
diff --git a/arch/s390/include/asm/ipcbuf.h b/arch/s390/include/asm/ipcbuf.h
new file mode 100644
index 000000000000..37f293d12c8f
--- /dev/null
+++ b/arch/s390/include/asm/ipcbuf.h
@@ -0,0 +1,31 @@
1#ifndef __S390_IPCBUF_H__
2#define __S390_IPCBUF_H__
3
4/*
5 * The user_ipc_perm structure for S/390 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24#ifndef __s390x__
25 unsigned short __pad2;
26#endif /* ! __s390x__ */
27 unsigned long __unused1;
28 unsigned long __unused2;
29};
30
31#endif /* __S390_IPCBUF_H__ */
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
new file mode 100644
index 000000000000..1171e6d144a3
--- /dev/null
+++ b/arch/s390/include/asm/ipl.h
@@ -0,0 +1,168 @@
1/*
2 * s390 (re)ipl support
3 *
4 * Copyright IBM Corp. 2007
5 */
6
7#ifndef _ASM_S390_IPL_H
8#define _ASM_S390_IPL_H
9
10#include <asm/types.h>
11#include <asm/cio.h>
12#include <asm/setup.h>
13
14#define IPL_PARMBLOCK_ORIGIN 0x2000
15
16#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \
17 sizeof(struct ipl_block_fcp))
18
19#define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 8)
20
21#define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \
22 sizeof(struct ipl_block_ccw))
23
24#define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 8)
25
26#define IPL_MAX_SUPPORTED_VERSION (0)
27
28#define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \
29 IPL_PARMBLOCK_ORIGIN)
30#define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.len)
31
32struct ipl_list_hdr {
33 u32 len;
34 u8 reserved1[3];
35 u8 version;
36 u32 blk0_len;
37 u8 pbt;
38 u8 flags;
39 u16 reserved2;
40} __attribute__((packed));
41
42struct ipl_block_fcp {
43 u8 reserved1[313-1];
44 u8 opt;
45 u8 reserved2[3];
46 u16 reserved3;
47 u16 devno;
48 u8 reserved4[4];
49 u64 wwpn;
50 u64 lun;
51 u32 bootprog;
52 u8 reserved5[12];
53 u64 br_lba;
54 u32 scp_data_len;
55 u8 reserved6[260];
56 u8 scp_data[];
57} __attribute__((packed));
58
59#define DIAG308_VMPARM_SIZE 64
60
61struct ipl_block_ccw {
62 u8 load_parm[8];
63 u8 reserved1[84];
64 u8 reserved2[2];
65 u16 devno;
66 u8 vm_flags;
67 u8 reserved3[3];
68 u32 vm_parm_len;
69 u8 nss_name[8];
70 u8 vm_parm[DIAG308_VMPARM_SIZE];
71 u8 reserved4[8];
72} __attribute__((packed));
73
74struct ipl_parameter_block {
75 struct ipl_list_hdr hdr;
76 union {
77 struct ipl_block_fcp fcp;
78 struct ipl_block_ccw ccw;
79 } ipl_info;
80} __attribute__((packed,aligned(4096)));
81
82/*
83 * IPL validity flags
84 */
85extern u32 ipl_flags;
86extern u32 dump_prefix_page;
87extern unsigned int zfcpdump_prefix_array[];
88
89extern void do_reipl(void);
90extern void do_halt(void);
91extern void do_poff(void);
92extern void ipl_save_parameters(void);
93extern void ipl_update_parameters(void);
94extern void get_ipl_vmparm(char *);
95
96enum {
97 IPL_DEVNO_VALID = 1,
98 IPL_PARMBLOCK_VALID = 2,
99 IPL_NSS_VALID = 4,
100};
101
102enum ipl_type {
103 IPL_TYPE_UNKNOWN = 1,
104 IPL_TYPE_CCW = 2,
105 IPL_TYPE_FCP = 4,
106 IPL_TYPE_FCP_DUMP = 8,
107 IPL_TYPE_NSS = 16,
108};
109
110struct ipl_info
111{
112 enum ipl_type type;
113 union {
114 struct {
115 struct ccw_dev_id dev_id;
116 } ccw;
117 struct {
118 struct ccw_dev_id dev_id;
119 u64 wwpn;
120 u64 lun;
121 } fcp;
122 struct {
123 char name[NSS_NAME_SIZE + 1];
124 } nss;
125 } data;
126};
127
128extern struct ipl_info ipl_info;
129extern void setup_ipl(void);
130
131/*
132 * DIAG 308 support
133 */
134enum diag308_subcode {
135 DIAG308_REL_HSA = 2,
136 DIAG308_IPL = 3,
137 DIAG308_DUMP = 4,
138 DIAG308_SET = 5,
139 DIAG308_STORE = 6,
140};
141
142enum diag308_ipl_type {
143 DIAG308_IPL_TYPE_FCP = 0,
144 DIAG308_IPL_TYPE_CCW = 2,
145};
146
147enum diag308_opt {
148 DIAG308_IPL_OPT_IPL = 0x10,
149 DIAG308_IPL_OPT_DUMP = 0x20,
150};
151
152enum diag308_flags {
153 DIAG308_FLAGS_LP_VALID = 0x80,
154};
155
156enum diag308_vm_flags {
157 DIAG308_VM_FLAGS_NSS_VALID = 0x80,
158 DIAG308_VM_FLAGS_VP_VALID = 0x40,
159};
160
161enum diag308_rc {
162 DIAG308_RC_OK = 0x0001,
163 DIAG308_RC_NOCONFIG = 0x0102,
164};
165
166extern int diag308(unsigned long subcode, void *addr);
167
168#endif /* _ASM_S390_IPL_H */
diff --git a/arch/s390/include/asm/irq.h b/arch/s390/include/asm/irq.h
new file mode 100644
index 000000000000..7da991a858f8
--- /dev/null
+++ b/arch/s390/include/asm/irq.h
@@ -0,0 +1,23 @@
1#ifndef _ASM_IRQ_H
2#define _ASM_IRQ_H
3
4#ifdef __KERNEL__
5#include <linux/hardirq.h>
6
7/*
8 * the definition of irqs has changed in 2.5.46:
9 * NR_IRQS is no longer the number of i/o
10 * interrupts (65536), but rather the number
11 * of interrupt classes (2).
12 * Only external and i/o interrupts make much sense here (CH).
13 */
14
15enum interruption_class {
16 EXTERNAL_INTERRUPT,
17 IO_INTERRUPT,
18
19 NR_IRQS,
20};
21
22#endif /* __KERNEL__ */
23#endif
diff --git a/arch/s390/include/asm/irq_regs.h b/arch/s390/include/asm/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/arch/s390/include/asm/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/arch/s390/include/asm/irqflags.h b/arch/s390/include/asm/irqflags.h
new file mode 100644
index 000000000000..3f26131120b7
--- /dev/null
+++ b/arch/s390/include/asm/irqflags.h
@@ -0,0 +1,106 @@
1/*
2 * include/asm-s390/irqflags.h
3 *
4 * Copyright (C) IBM Corp. 2006
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */
7
8#ifndef __ASM_IRQFLAGS_H
9#define __ASM_IRQFLAGS_H
10
11#ifdef __KERNEL__
12
13#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
14
15/* store then or system mask. */
16#define __raw_local_irq_stosm(__or) \
17({ \
18 unsigned long __mask; \
19 asm volatile( \
20 " stosm %0,%1" \
21 : "=Q" (__mask) : "i" (__or) : "memory"); \
22 __mask; \
23})
24
25/* store then and system mask. */
26#define __raw_local_irq_stnsm(__and) \
27({ \
28 unsigned long __mask; \
29 asm volatile( \
30 " stnsm %0,%1" \
31 : "=Q" (__mask) : "i" (__and) : "memory"); \
32 __mask; \
33})
34
35/* set system mask. */
36#define __raw_local_irq_ssm(__mask) \
37({ \
38 asm volatile("ssm %0" : : "Q" (__mask) : "memory"); \
39})
40
41#else /* __GNUC__ */
42
43/* store then or system mask. */
44#define __raw_local_irq_stosm(__or) \
45({ \
46 unsigned long __mask; \
47 asm volatile( \
48 " stosm 0(%1),%2" \
49 : "=m" (__mask) \
50 : "a" (&__mask), "i" (__or) : "memory"); \
51 __mask; \
52})
53
54/* store then and system mask. */
55#define __raw_local_irq_stnsm(__and) \
56({ \
57 unsigned long __mask; \
58 asm volatile( \
59 " stnsm 0(%1),%2" \
60 : "=m" (__mask) \
61 : "a" (&__mask), "i" (__and) : "memory"); \
62 __mask; \
63})
64
65/* set system mask. */
66#define __raw_local_irq_ssm(__mask) \
67({ \
68 asm volatile( \
69 " ssm 0(%0)" \
70 : : "a" (&__mask), "m" (__mask) : "memory"); \
71})
72
73#endif /* __GNUC__ */
74
75/* interrupt control.. */
76static inline unsigned long raw_local_irq_enable(void)
77{
78 return __raw_local_irq_stosm(0x03);
79}
80
81static inline unsigned long raw_local_irq_disable(void)
82{
83 return __raw_local_irq_stnsm(0xfc);
84}
85
86#define raw_local_save_flags(x) \
87do { \
88 typecheck(unsigned long, x); \
89 (x) = __raw_local_irq_stosm(0x00); \
90} while (0)
91
92static inline void raw_local_irq_restore(unsigned long flags)
93{
94 __raw_local_irq_ssm(flags);
95}
96
97static inline int raw_irqs_disabled_flags(unsigned long flags)
98{
99 return !(flags & (3UL << (BITS_PER_LONG - 8)));
100}
101
102/* For spinlocks etc */
103#define raw_local_irq_save(x) ((x) = raw_local_irq_disable())
104
105#endif /* __KERNEL__ */
106#endif /* __ASM_IRQFLAGS_H */
diff --git a/arch/s390/include/asm/isc.h b/arch/s390/include/asm/isc.h
new file mode 100644
index 000000000000..34bb8916db4f
--- /dev/null
+++ b/arch/s390/include/asm/isc.h
@@ -0,0 +1,25 @@
1#ifndef _ASM_S390_ISC_H
2#define _ASM_S390_ISC_H
3
4#include <linux/types.h>
5
6/*
7 * I/O interruption subclasses used by drivers.
8 * Please add all used iscs here so that it is possible to distribute
9 * isc usage between drivers.
10 * Reminder: 0 is highest priority, 7 lowest.
11 */
12#define MAX_ISC 7
13
14/* Regular I/O interrupts. */
15#define IO_SCH_ISC 3 /* regular I/O subchannels */
16#define CONSOLE_ISC 1 /* console I/O subchannel */
17#define CHSC_SCH_ISC 7 /* CHSC subchannels */
18/* Adapter interrupts. */
19#define QDIO_AIRQ_ISC IO_SCH_ISC /* I/O subchannel in qdio mode */
20
21/* Functions for registration of I/O interruption subclasses */
22void isc_register(unsigned int isc);
23void isc_unregister(unsigned int isc);
24
25#endif /* _ASM_S390_ISC_H */
diff --git a/arch/s390/include/asm/itcw.h b/arch/s390/include/asm/itcw.h
new file mode 100644
index 000000000000..a9bc5c36b32a
--- /dev/null
+++ b/arch/s390/include/asm/itcw.h
@@ -0,0 +1,30 @@
1/*
2 * Functions for incremental construction of fcx enabled I/O control blocks.
3 *
4 * Copyright IBM Corp. 2008
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_ITCW_H
9#define _ASM_S390_ITCW_H _ASM_S390_ITCW_H
10
11#include <linux/types.h>
12#include <asm/fcx.h>
13
14#define ITCW_OP_READ 0
15#define ITCW_OP_WRITE 1
16
17struct itcw;
18
19struct tcw *itcw_get_tcw(struct itcw *itcw);
20size_t itcw_calc_size(int intrg, int max_tidaws, int intrg_max_tidaws);
21struct itcw *itcw_init(void *buffer, size_t size, int op, int intrg,
22 int max_tidaws, int intrg_max_tidaws);
23struct dcw *itcw_add_dcw(struct itcw *itcw, u8 cmd, u8 flags, void *cd,
24 u8 cd_count, u32 count);
25struct tidaw *itcw_add_tidaw(struct itcw *itcw, u8 flags, void *addr,
26 u32 count);
27void itcw_set_data(struct itcw *itcw, void *addr, int use_tidal);
28void itcw_finalize(struct itcw *itcw);
29
30#endif /* _ASM_S390_ITCW_H */
diff --git a/arch/s390/include/asm/kdebug.h b/arch/s390/include/asm/kdebug.h
new file mode 100644
index 000000000000..40db27cd6e60
--- /dev/null
+++ b/arch/s390/include/asm/kdebug.h
@@ -0,0 +1,27 @@
1#ifndef _S390_KDEBUG_H
2#define _S390_KDEBUG_H
3
4/*
5 * Feb 2006 Ported to s390 <grundym@us.ibm.com>
6 */
7
8struct pt_regs;
9
10enum die_val {
11 DIE_OOPS = 1,
12 DIE_BPT,
13 DIE_SSTEP,
14 DIE_PANIC,
15 DIE_NMI,
16 DIE_DIE,
17 DIE_NMIWATCHDOG,
18 DIE_KERNELDEBUG,
19 DIE_TRAP,
20 DIE_GPF,
21 DIE_CALL,
22 DIE_NMI_IPI,
23};
24
25extern void die(const char *, struct pt_regs *, long);
26
27#endif
diff --git a/arch/s390/include/asm/kexec.h b/arch/s390/include/asm/kexec.h
new file mode 100644
index 000000000000..f219c6411e0b
--- /dev/null
+++ b/arch/s390/include/asm/kexec.h
@@ -0,0 +1,43 @@
1/*
2 * include/asm-s390/kexec.h
3 *
4 * (C) Copyright IBM Corp. 2005
5 *
6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com>
7 *
8 */
9
10#ifndef _S390_KEXEC_H
11#define _S390_KEXEC_H
12
13#ifdef __KERNEL__
14#include <asm/page.h>
15#endif
16#include <asm/processor.h>
17/*
18 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
19 * I.e. Maximum page that is mapped directly into kernel memory,
20 * and kmap is not required.
21 */
22
23/* Maximum physical address we can use pages from */
24#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
25
26/* Maximum address we can reach in physical address mode */
27#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
28
29/* Maximum address we can use for the control pages */
30/* Not more than 2GB */
31#define KEXEC_CONTROL_MEMORY_LIMIT (1UL<<31)
32
33/* Allocate one page for the pdp and the second for the code */
34#define KEXEC_CONTROL_CODE_SIZE 4096
35
36/* The native architecture */
37#define KEXEC_ARCH KEXEC_ARCH_S390
38
39/* Provide a dummy definition to avoid build failures. */
40static inline void crash_setup_regs(struct pt_regs *newregs,
41 struct pt_regs *oldregs) { }
42
43#endif /*_S390_KEXEC_H */
diff --git a/arch/s390/include/asm/kmap_types.h b/arch/s390/include/asm/kmap_types.h
new file mode 100644
index 000000000000..fd1574648223
--- /dev/null
+++ b/arch/s390/include/asm/kmap_types.h
@@ -0,0 +1,23 @@
1#ifdef __KERNEL__
2#ifndef _ASM_KMAP_TYPES_H
3#define _ASM_KMAP_TYPES_H
4
5enum km_type {
6 KM_BOUNCE_READ,
7 KM_SKB_SUNRPC_DATA,
8 KM_SKB_DATA_SOFTIRQ,
9 KM_USER0,
10 KM_USER1,
11 KM_BIO_SRC_IRQ,
12 KM_BIO_DST_IRQ,
13 KM_PTE0,
14 KM_PTE1,
15 KM_IRQ0,
16 KM_IRQ1,
17 KM_SOFTIRQ0,
18 KM_SOFTIRQ1,
19 KM_TYPE_NR
20};
21
22#endif
23#endif /* __KERNEL__ */
diff --git a/arch/s390/include/asm/kprobes.h b/arch/s390/include/asm/kprobes.h
new file mode 100644
index 000000000000..330f68caffe4
--- /dev/null
+++ b/arch/s390/include/asm/kprobes.h
@@ -0,0 +1,103 @@
1#ifndef _ASM_S390_KPROBES_H
2#define _ASM_S390_KPROBES_H
3/*
4 * Kernel Probes (KProbes)
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 (C) IBM Corporation, 2002, 2006
21 *
22 * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel
23 * Probes initial implementation ( includes suggestions from
24 * Rusty Russell).
25 * 2004-Nov Modified for PPC64 by Ananth N Mavinakayanahalli
26 * <ananth@in.ibm.com>
27 * 2005-Dec Used as a template for s390 by Mike Grundy
28 * <grundym@us.ibm.com>
29 */
30#include <linux/types.h>
31#include <linux/ptrace.h>
32#include <linux/percpu.h>
33
34#define __ARCH_WANT_KPROBES_INSN_SLOT
35struct pt_regs;
36struct kprobe;
37
38typedef u16 kprobe_opcode_t;
39#define BREAKPOINT_INSTRUCTION 0x0002
40
41/* Maximum instruction size is 3 (16bit) halfwords: */
42#define MAX_INSN_SIZE 0x0003
43#define MAX_STACK_SIZE 64
44#define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \
45 (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \
46 ? (MAX_STACK_SIZE) \
47 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
48
49#define kretprobe_blacklist_size 0
50
51#define KPROBE_SWAP_INST 0x10
52
53#define FIXUP_PSW_NORMAL 0x08
54#define FIXUP_BRANCH_NOT_TAKEN 0x04
55#define FIXUP_RETURN_REGISTER 0x02
56#define FIXUP_NOT_REQUIRED 0x01
57
58/* Architecture specific copy of original instruction */
59struct arch_specific_insn {
60 /* copy of original instruction */
61 kprobe_opcode_t *insn;
62 int fixup;
63 int ilen;
64 int reg;
65};
66
67struct ins_replace_args {
68 kprobe_opcode_t *ptr;
69 kprobe_opcode_t old;
70 kprobe_opcode_t new;
71};
72struct prev_kprobe {
73 struct kprobe *kp;
74 unsigned long status;
75 unsigned long saved_psw;
76 unsigned long kprobe_saved_imask;
77 unsigned long kprobe_saved_ctl[3];
78};
79
80/* per-cpu kprobe control block */
81struct kprobe_ctlblk {
82 unsigned long kprobe_status;
83 unsigned long kprobe_saved_imask;
84 unsigned long kprobe_saved_ctl[3];
85 struct pt_regs jprobe_saved_regs;
86 unsigned long jprobe_saved_r14;
87 unsigned long jprobe_saved_r15;
88 struct prev_kprobe prev_kprobe;
89 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
90};
91
92void arch_remove_kprobe(struct kprobe *p);
93void kretprobe_trampoline(void);
94int is_prohibited_opcode(kprobe_opcode_t *instruction);
95void get_instruction_type(struct arch_specific_insn *ainsn);
96
97int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
98int kprobe_exceptions_notify(struct notifier_block *self,
99 unsigned long val, void *data);
100
101#define flush_insn_slot(p) do { } while (0)
102
103#endif /* _ASM_S390_KPROBES_H */
diff --git a/arch/s390/include/asm/kvm.h b/arch/s390/include/asm/kvm.h
new file mode 100644
index 000000000000..d74002f95794
--- /dev/null
+++ b/arch/s390/include/asm/kvm.h
@@ -0,0 +1,45 @@
1#ifndef __LINUX_KVM_S390_H
2#define __LINUX_KVM_S390_H
3
4/*
5 * asm-s390/kvm.h - KVM s390 specific structures and definitions
6 *
7 * Copyright IBM Corp. 2008
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License (version 2 only)
11 * as published by the Free Software Foundation.
12 *
13 * Author(s): Carsten Otte <cotte@de.ibm.com>
14 * Christian Borntraeger <borntraeger@de.ibm.com>
15 */
16#include <asm/types.h>
17
18/* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */
19struct kvm_pic_state {
20 /* no PIC for s390 */
21};
22
23struct kvm_ioapic_state {
24 /* no IOAPIC for s390 */
25};
26
27/* for KVM_GET_REGS and KVM_SET_REGS */
28struct kvm_regs {
29 /* general purpose regs for s390 */
30 __u64 gprs[16];
31};
32
33/* for KVM_GET_SREGS and KVM_SET_SREGS */
34struct kvm_sregs {
35 __u32 acrs[16];
36 __u64 crs[16];
37};
38
39/* for KVM_GET_FPU and KVM_SET_FPU */
40struct kvm_fpu {
41 __u32 fpc;
42 __u64 fprs[16];
43};
44
45#endif
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
new file mode 100644
index 000000000000..3c55e4107dcc
--- /dev/null
+++ b/arch/s390/include/asm/kvm_host.h
@@ -0,0 +1,235 @@
1/*
2 * asm-s390/kvm_host.h - definition for kernel virtual machines on s390
3 *
4 * Copyright IBM Corp. 2008
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 only)
8 * as published by the Free Software Foundation.
9 *
10 * Author(s): Carsten Otte <cotte@de.ibm.com>
11 */
12
13
14#ifndef ASM_KVM_HOST_H
15#define ASM_KVM_HOST_H
16#include <linux/kvm_host.h>
17#include <asm/debug.h>
18
19#define KVM_MAX_VCPUS 64
20#define KVM_MEMORY_SLOTS 32
21/* memory slots that does not exposed to userspace */
22#define KVM_PRIVATE_MEM_SLOTS 4
23
24struct kvm_guest_debug {
25};
26
27struct sca_entry {
28 atomic_t scn;
29 __u64 reserved;
30 __u64 sda;
31 __u64 reserved2[2];
32} __attribute__((packed));
33
34
35struct sca_block {
36 __u64 ipte_control;
37 __u64 reserved[5];
38 __u64 mcn;
39 __u64 reserved2;
40 struct sca_entry cpu[64];
41} __attribute__((packed));
42
43#define KVM_PAGES_PER_HPAGE 256
44
45#define CPUSTAT_HOST 0x80000000
46#define CPUSTAT_WAIT 0x10000000
47#define CPUSTAT_ECALL_PEND 0x08000000
48#define CPUSTAT_STOP_INT 0x04000000
49#define CPUSTAT_IO_INT 0x02000000
50#define CPUSTAT_EXT_INT 0x01000000
51#define CPUSTAT_RUNNING 0x00800000
52#define CPUSTAT_RETAINED 0x00400000
53#define CPUSTAT_TIMING_SUB 0x00020000
54#define CPUSTAT_SIE_SUB 0x00010000
55#define CPUSTAT_RRF 0x00008000
56#define CPUSTAT_SLSV 0x00004000
57#define CPUSTAT_SLSR 0x00002000
58#define CPUSTAT_ZARCH 0x00000800
59#define CPUSTAT_MCDS 0x00000100
60#define CPUSTAT_SM 0x00000080
61#define CPUSTAT_G 0x00000008
62#define CPUSTAT_J 0x00000002
63#define CPUSTAT_P 0x00000001
64
65struct kvm_s390_sie_block {
66 atomic_t cpuflags; /* 0x0000 */
67 __u32 prefix; /* 0x0004 */
68 __u8 reserved8[32]; /* 0x0008 */
69 __u64 cputm; /* 0x0028 */
70 __u64 ckc; /* 0x0030 */
71 __u64 epoch; /* 0x0038 */
72 __u8 reserved40[4]; /* 0x0040 */
73#define LCTL_CR0 0x8000
74 __u16 lctl; /* 0x0044 */
75 __s16 icpua; /* 0x0046 */
76 __u32 ictl; /* 0x0048 */
77 __u32 eca; /* 0x004c */
78 __u8 icptcode; /* 0x0050 */
79 __u8 reserved51; /* 0x0051 */
80 __u16 ihcpu; /* 0x0052 */
81 __u8 reserved54[2]; /* 0x0054 */
82 __u16 ipa; /* 0x0056 */
83 __u32 ipb; /* 0x0058 */
84 __u32 scaoh; /* 0x005c */
85 __u8 reserved60; /* 0x0060 */
86 __u8 ecb; /* 0x0061 */
87 __u8 reserved62[2]; /* 0x0062 */
88 __u32 scaol; /* 0x0064 */
89 __u8 reserved68[4]; /* 0x0068 */
90 __u32 todpr; /* 0x006c */
91 __u8 reserved70[16]; /* 0x0070 */
92 __u64 gmsor; /* 0x0080 */
93 __u64 gmslm; /* 0x0088 */
94 psw_t gpsw; /* 0x0090 */
95 __u64 gg14; /* 0x00a0 */
96 __u64 gg15; /* 0x00a8 */
97 __u8 reservedb0[30]; /* 0x00b0 */
98 __u16 iprcc; /* 0x00ce */
99 __u8 reservedd0[48]; /* 0x00d0 */
100 __u64 gcr[16]; /* 0x0100 */
101 __u64 gbea; /* 0x0180 */
102 __u8 reserved188[120]; /* 0x0188 */
103} __attribute__((packed));
104
105struct kvm_vcpu_stat {
106 u32 exit_userspace;
107 u32 exit_null;
108 u32 exit_external_request;
109 u32 exit_external_interrupt;
110 u32 exit_stop_request;
111 u32 exit_validity;
112 u32 exit_instruction;
113 u32 instruction_lctl;
114 u32 instruction_lctlg;
115 u32 exit_program_interruption;
116 u32 exit_instr_and_program;
117 u32 deliver_emergency_signal;
118 u32 deliver_service_signal;
119 u32 deliver_virtio_interrupt;
120 u32 deliver_stop_signal;
121 u32 deliver_prefix_signal;
122 u32 deliver_restart_signal;
123 u32 deliver_program_int;
124 u32 exit_wait_state;
125 u32 instruction_stidp;
126 u32 instruction_spx;
127 u32 instruction_stpx;
128 u32 instruction_stap;
129 u32 instruction_storage_key;
130 u32 instruction_stsch;
131 u32 instruction_chsc;
132 u32 instruction_stsi;
133 u32 instruction_stfl;
134 u32 instruction_sigp_sense;
135 u32 instruction_sigp_emergency;
136 u32 instruction_sigp_stop;
137 u32 instruction_sigp_arch;
138 u32 instruction_sigp_prefix;
139 u32 instruction_sigp_restart;
140 u32 diagnose_44;
141};
142
143struct kvm_s390_io_info {
144 __u16 subchannel_id; /* 0x0b8 */
145 __u16 subchannel_nr; /* 0x0ba */
146 __u32 io_int_parm; /* 0x0bc */
147 __u32 io_int_word; /* 0x0c0 */
148};
149
150struct kvm_s390_ext_info {
151 __u32 ext_params;
152 __u64 ext_params2;
153};
154
155#define PGM_OPERATION 0x01
156#define PGM_PRIVILEGED_OPERATION 0x02
157#define PGM_EXECUTE 0x03
158#define PGM_PROTECTION 0x04
159#define PGM_ADDRESSING 0x05
160#define PGM_SPECIFICATION 0x06
161#define PGM_DATA 0x07
162
163struct kvm_s390_pgm_info {
164 __u16 code;
165};
166
167struct kvm_s390_prefix_info {
168 __u32 address;
169};
170
171struct kvm_s390_interrupt_info {
172 struct list_head list;
173 u64 type;
174 union {
175 struct kvm_s390_io_info io;
176 struct kvm_s390_ext_info ext;
177 struct kvm_s390_pgm_info pgm;
178 struct kvm_s390_prefix_info prefix;
179 };
180};
181
182/* for local_interrupt.action_flags */
183#define ACTION_STORE_ON_STOP 1
184#define ACTION_STOP_ON_STOP 2
185
186struct kvm_s390_local_interrupt {
187 spinlock_t lock;
188 struct list_head list;
189 atomic_t active;
190 struct kvm_s390_float_interrupt *float_int;
191 int timer_due; /* event indicator for waitqueue below */
192 wait_queue_head_t wq;
193 atomic_t *cpuflags;
194 unsigned int action_bits;
195};
196
197struct kvm_s390_float_interrupt {
198 spinlock_t lock;
199 struct list_head list;
200 atomic_t active;
201 int next_rr_cpu;
202 unsigned long idle_mask [(64 + sizeof(long) - 1) / sizeof(long)];
203 struct kvm_s390_local_interrupt *local_int[64];
204};
205
206
207struct kvm_vcpu_arch {
208 struct kvm_s390_sie_block *sie_block;
209 unsigned long guest_gprs[16];
210 s390_fp_regs host_fpregs;
211 unsigned int host_acrs[NUM_ACRS];
212 s390_fp_regs guest_fpregs;
213 unsigned int guest_acrs[NUM_ACRS];
214 struct kvm_s390_local_interrupt local_int;
215 struct timer_list ckc_timer;
216 union {
217 cpuid_t cpu_id;
218 u64 stidp_data;
219 };
220};
221
222struct kvm_vm_stat {
223 u32 remote_tlb_flush;
224};
225
226struct kvm_arch{
227 unsigned long guest_origin;
228 unsigned long guest_memsize;
229 struct sca_block *sca;
230 debug_info_t *dbf;
231 struct kvm_s390_float_interrupt float_int;
232};
233
234extern int sie64a(struct kvm_s390_sie_block *, unsigned long *);
235#endif
diff --git a/arch/s390/include/asm/kvm_para.h b/arch/s390/include/asm/kvm_para.h
new file mode 100644
index 000000000000..2c503796b619
--- /dev/null
+++ b/arch/s390/include/asm/kvm_para.h
@@ -0,0 +1,150 @@
1/*
2 * asm-s390/kvm_para.h - definition for paravirtual devices on s390
3 *
4 * Copyright IBM Corp. 2008
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 only)
8 * as published by the Free Software Foundation.
9 *
10 * Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
11 */
12
13#ifndef __S390_KVM_PARA_H
14#define __S390_KVM_PARA_H
15
16/*
17 * Hypercalls for KVM on s390. The calling convention is similar to the
18 * s390 ABI, so we use R2-R6 for parameters 1-5. In addition we use R1
19 * as hypercall number and R7 as parameter 6. The return value is
20 * written to R2. We use the diagnose instruction as hypercall. To avoid
21 * conflicts with existing diagnoses for LPAR and z/VM, we do not use
22 * the instruction encoded number, but specify the number in R1 and
23 * use 0x500 as KVM hypercall
24 *
25 * Copyright IBM Corp. 2007,2008
26 * Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
27 *
28 * This work is licensed under the terms of the GNU GPL, version 2.
29 */
30
31static inline long kvm_hypercall0(unsigned long nr)
32{
33 register unsigned long __nr asm("1") = nr;
34 register long __rc asm("2");
35
36 asm volatile ("diag 2,4,0x500\n"
37 : "=d" (__rc) : "d" (__nr): "memory", "cc");
38 return __rc;
39}
40
41static inline long kvm_hypercall1(unsigned long nr, unsigned long p1)
42{
43 register unsigned long __nr asm("1") = nr;
44 register unsigned long __p1 asm("2") = p1;
45 register long __rc asm("2");
46
47 asm volatile ("diag 2,4,0x500\n"
48 : "=d" (__rc) : "d" (__nr), "0" (__p1) : "memory", "cc");
49 return __rc;
50}
51
52static inline long kvm_hypercall2(unsigned long nr, unsigned long p1,
53 unsigned long p2)
54{
55 register unsigned long __nr asm("1") = nr;
56 register unsigned long __p1 asm("2") = p1;
57 register unsigned long __p2 asm("3") = p2;
58 register long __rc asm("2");
59
60 asm volatile ("diag 2,4,0x500\n"
61 : "=d" (__rc) : "d" (__nr), "0" (__p1), "d" (__p2)
62 : "memory", "cc");
63 return __rc;
64}
65
66static inline long kvm_hypercall3(unsigned long nr, unsigned long p1,
67 unsigned long p2, unsigned long p3)
68{
69 register unsigned long __nr asm("1") = nr;
70 register unsigned long __p1 asm("2") = p1;
71 register unsigned long __p2 asm("3") = p2;
72 register unsigned long __p3 asm("4") = p3;
73 register long __rc asm("2");
74
75 asm volatile ("diag 2,4,0x500\n"
76 : "=d" (__rc) : "d" (__nr), "0" (__p1), "d" (__p2),
77 "d" (__p3) : "memory", "cc");
78 return __rc;
79}
80
81
82static inline long kvm_hypercall4(unsigned long nr, unsigned long p1,
83 unsigned long p2, unsigned long p3,
84 unsigned long p4)
85{
86 register unsigned long __nr asm("1") = nr;
87 register unsigned long __p1 asm("2") = p1;
88 register unsigned long __p2 asm("3") = p2;
89 register unsigned long __p3 asm("4") = p3;
90 register unsigned long __p4 asm("5") = p4;
91 register long __rc asm("2");
92
93 asm volatile ("diag 2,4,0x500\n"
94 : "=d" (__rc) : "d" (__nr), "0" (__p1), "d" (__p2),
95 "d" (__p3), "d" (__p4) : "memory", "cc");
96 return __rc;
97}
98
99static inline long kvm_hypercall5(unsigned long nr, unsigned long p1,
100 unsigned long p2, unsigned long p3,
101 unsigned long p4, unsigned long p5)
102{
103 register unsigned long __nr asm("1") = nr;
104 register unsigned long __p1 asm("2") = p1;
105 register unsigned long __p2 asm("3") = p2;
106 register unsigned long __p3 asm("4") = p3;
107 register unsigned long __p4 asm("5") = p4;
108 register unsigned long __p5 asm("6") = p5;
109 register long __rc asm("2");
110
111 asm volatile ("diag 2,4,0x500\n"
112 : "=d" (__rc) : "d" (__nr), "0" (__p1), "d" (__p2),
113 "d" (__p3), "d" (__p4), "d" (__p5) : "memory", "cc");
114 return __rc;
115}
116
117static inline long kvm_hypercall6(unsigned long nr, unsigned long p1,
118 unsigned long p2, unsigned long p3,
119 unsigned long p4, unsigned long p5,
120 unsigned long p6)
121{
122 register unsigned long __nr asm("1") = nr;
123 register unsigned long __p1 asm("2") = p1;
124 register unsigned long __p2 asm("3") = p2;
125 register unsigned long __p3 asm("4") = p3;
126 register unsigned long __p4 asm("5") = p4;
127 register unsigned long __p5 asm("6") = p5;
128 register unsigned long __p6 asm("7") = p6;
129 register long __rc asm("2");
130
131 asm volatile ("diag 2,4,0x500\n"
132 : "=d" (__rc) : "d" (__nr), "0" (__p1), "d" (__p2),
133 "d" (__p3), "d" (__p4), "d" (__p5), "d" (__p6)
134 : "memory", "cc");
135 return __rc;
136}
137
138/* kvm on s390 is always paravirtualization enabled */
139static inline int kvm_para_available(void)
140{
141 return 1;
142}
143
144/* No feature bits are currently assigned for kvm on s390 */
145static inline unsigned int kvm_arch_para_features(void)
146{
147 return 0;
148}
149
150#endif /* __S390_KVM_PARA_H */
diff --git a/arch/s390/include/asm/kvm_virtio.h b/arch/s390/include/asm/kvm_virtio.h
new file mode 100644
index 000000000000..146100224def
--- /dev/null
+++ b/arch/s390/include/asm/kvm_virtio.h
@@ -0,0 +1,63 @@
1/*
2 * kvm_virtio.h - definition for virtio for kvm on s390
3 *
4 * Copyright IBM Corp. 2008
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 only)
8 * as published by the Free Software Foundation.
9 *
10 * Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
11 */
12
13#ifndef __KVM_S390_VIRTIO_H
14#define __KVM_S390_VIRTIO_H
15
16#include <linux/types.h>
17
18struct kvm_device_desc {
19 /* The device type: console, network, disk etc. Type 0 terminates. */
20 __u8 type;
21 /* The number of virtqueues (first in config array) */
22 __u8 num_vq;
23 /*
24 * The number of bytes of feature bits. Multiply by 2: one for host
25 * features and one for guest acknowledgements.
26 */
27 __u8 feature_len;
28 /* The number of bytes of the config array after virtqueues. */
29 __u8 config_len;
30 /* A status byte, written by the Guest. */
31 __u8 status;
32 __u8 config[0];
33};
34
35/*
36 * This is how we expect the device configuration field for a virtqueue
37 * to be laid out in config space.
38 */
39struct kvm_vqconfig {
40 /* The token returned with an interrupt. Set by the guest */
41 __u64 token;
42 /* The address of the virtio ring */
43 __u64 address;
44 /* The number of entries in the virtio_ring */
45 __u16 num;
46
47};
48
49#define KVM_S390_VIRTIO_NOTIFY 0
50#define KVM_S390_VIRTIO_RESET 1
51#define KVM_S390_VIRTIO_SET_STATUS 2
52
53#ifdef __KERNEL__
54/* early virtio console setup */
55#ifdef CONFIG_VIRTIO_CONSOLE
56extern void s390_virtio_console_init(void);
57#else
58static inline void s390_virtio_console_init(void)
59{
60}
61#endif /* CONFIG_VIRTIO_CONSOLE */
62#endif /* __KERNEL__ */
63#endif
diff --git a/arch/s390/include/asm/linkage.h b/arch/s390/include/asm/linkage.h
new file mode 100644
index 000000000000..291c2d01c44f
--- /dev/null
+++ b/arch/s390/include/asm/linkage.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4/* Nothing to see here... */
5
6#endif
diff --git a/arch/s390/include/asm/local.h b/arch/s390/include/asm/local.h
new file mode 100644
index 000000000000..c11c530f74d0
--- /dev/null
+++ b/arch/s390/include/asm/local.h
@@ -0,0 +1 @@
#include <asm-generic/local.h>
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
new file mode 100644
index 000000000000..0bc51d52a899
--- /dev/null
+++ b/arch/s390/include/asm/lowcore.h
@@ -0,0 +1,433 @@
1/*
2 * include/asm-s390/lowcore.h
3 *
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Hartmut Penner (hp@de.ibm.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com),
8 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
9 */
10
11#ifndef _ASM_S390_LOWCORE_H
12#define _ASM_S390_LOWCORE_H
13
14#ifndef __s390x__
15#define __LC_EXT_OLD_PSW 0x018
16#define __LC_SVC_OLD_PSW 0x020
17#define __LC_PGM_OLD_PSW 0x028
18#define __LC_MCK_OLD_PSW 0x030
19#define __LC_IO_OLD_PSW 0x038
20#define __LC_EXT_NEW_PSW 0x058
21#define __LC_SVC_NEW_PSW 0x060
22#define __LC_PGM_NEW_PSW 0x068
23#define __LC_MCK_NEW_PSW 0x070
24#define __LC_IO_NEW_PSW 0x078
25#else /* !__s390x__ */
26#define __LC_EXT_OLD_PSW 0x0130
27#define __LC_SVC_OLD_PSW 0x0140
28#define __LC_PGM_OLD_PSW 0x0150
29#define __LC_MCK_OLD_PSW 0x0160
30#define __LC_IO_OLD_PSW 0x0170
31#define __LC_EXT_NEW_PSW 0x01b0
32#define __LC_SVC_NEW_PSW 0x01c0
33#define __LC_PGM_NEW_PSW 0x01d0
34#define __LC_MCK_NEW_PSW 0x01e0
35#define __LC_IO_NEW_PSW 0x01f0
36#endif /* !__s390x__ */
37
38#define __LC_IPL_PARMBLOCK_PTR 0x014
39#define __LC_EXT_PARAMS 0x080
40#define __LC_CPU_ADDRESS 0x084
41#define __LC_EXT_INT_CODE 0x086
42
43#define __LC_SVC_ILC 0x088
44#define __LC_SVC_INT_CODE 0x08A
45#define __LC_PGM_ILC 0x08C
46#define __LC_PGM_INT_CODE 0x08E
47
48#define __LC_PER_ATMID 0x096
49#define __LC_PER_ADDRESS 0x098
50#define __LC_PER_ACCESS_ID 0x0A1
51#define __LC_AR_MODE_ID 0x0A3
52
53#define __LC_SUBCHANNEL_ID 0x0B8
54#define __LC_SUBCHANNEL_NR 0x0BA
55#define __LC_IO_INT_PARM 0x0BC
56#define __LC_IO_INT_WORD 0x0C0
57#define __LC_MCCK_CODE 0x0E8
58
59#define __LC_LAST_BREAK 0x110
60
61#define __LC_RETURN_PSW 0x200
62
63#define __LC_SAVE_AREA 0xC00
64
65#ifndef __s390x__
66#define __LC_IRB 0x208
67#define __LC_SYNC_ENTER_TIMER 0x248
68#define __LC_ASYNC_ENTER_TIMER 0x250
69#define __LC_EXIT_TIMER 0x258
70#define __LC_LAST_UPDATE_TIMER 0x260
71#define __LC_USER_TIMER 0x268
72#define __LC_SYSTEM_TIMER 0x270
73#define __LC_LAST_UPDATE_CLOCK 0x278
74#define __LC_STEAL_CLOCK 0x280
75#define __LC_RETURN_MCCK_PSW 0x288
76#define __LC_KERNEL_STACK 0xC40
77#define __LC_THREAD_INFO 0xC44
78#define __LC_ASYNC_STACK 0xC48
79#define __LC_KERNEL_ASCE 0xC4C
80#define __LC_USER_ASCE 0xC50
81#define __LC_PANIC_STACK 0xC54
82#define __LC_CPUID 0xC60
83#define __LC_CPUADDR 0xC68
84#define __LC_IPLDEV 0xC7C
85#define __LC_CURRENT 0xC90
86#define __LC_INT_CLOCK 0xC98
87#else /* __s390x__ */
88#define __LC_IRB 0x210
89#define __LC_SYNC_ENTER_TIMER 0x250
90#define __LC_ASYNC_ENTER_TIMER 0x258
91#define __LC_EXIT_TIMER 0x260
92#define __LC_LAST_UPDATE_TIMER 0x268
93#define __LC_USER_TIMER 0x270
94#define __LC_SYSTEM_TIMER 0x278
95#define __LC_LAST_UPDATE_CLOCK 0x280
96#define __LC_STEAL_CLOCK 0x288
97#define __LC_RETURN_MCCK_PSW 0x290
98#define __LC_KERNEL_STACK 0xD40
99#define __LC_THREAD_INFO 0xD48
100#define __LC_ASYNC_STACK 0xD50
101#define __LC_KERNEL_ASCE 0xD58
102#define __LC_USER_ASCE 0xD60
103#define __LC_PANIC_STACK 0xD68
104#define __LC_CPUID 0xD80
105#define __LC_CPUADDR 0xD88
106#define __LC_IPLDEV 0xDB8
107#define __LC_CURRENT 0xDD8
108#define __LC_INT_CLOCK 0xDE8
109#endif /* __s390x__ */
110
111
112#define __LC_PANIC_MAGIC 0xE00
113#ifndef __s390x__
114#define __LC_PFAULT_INTPARM 0x080
115#define __LC_CPU_TIMER_SAVE_AREA 0x0D8
116#define __LC_CLOCK_COMP_SAVE_AREA 0x0E0
117#define __LC_PSW_SAVE_AREA 0x100
118#define __LC_PREFIX_SAVE_AREA 0x108
119#define __LC_AREGS_SAVE_AREA 0x120
120#define __LC_FPREGS_SAVE_AREA 0x160
121#define __LC_GPREGS_SAVE_AREA 0x180
122#define __LC_CREGS_SAVE_AREA 0x1C0
123#else /* __s390x__ */
124#define __LC_PFAULT_INTPARM 0x11B8
125#define __LC_FPREGS_SAVE_AREA 0x1200
126#define __LC_GPREGS_SAVE_AREA 0x1280
127#define __LC_PSW_SAVE_AREA 0x1300
128#define __LC_PREFIX_SAVE_AREA 0x1318
129#define __LC_FP_CREG_SAVE_AREA 0x131C
130#define __LC_TODREG_SAVE_AREA 0x1324
131#define __LC_CPU_TIMER_SAVE_AREA 0x1328
132#define __LC_CLOCK_COMP_SAVE_AREA 0x1331
133#define __LC_AREGS_SAVE_AREA 0x1340
134#define __LC_CREGS_SAVE_AREA 0x1380
135#endif /* __s390x__ */
136
137#ifndef __ASSEMBLY__
138
139#include <asm/processor.h>
140#include <linux/types.h>
141#include <asm/sigp.h>
142
143void restart_int_handler(void);
144void ext_int_handler(void);
145void system_call(void);
146void pgm_check_handler(void);
147void mcck_int_handler(void);
148void io_int_handler(void);
149
150struct save_area_s390 {
151 u32 ext_save;
152 u64 timer;
153 u64 clk_cmp;
154 u8 pad1[24];
155 u8 psw[8];
156 u32 pref_reg;
157 u8 pad2[20];
158 u32 acc_regs[16];
159 u64 fp_regs[4];
160 u32 gp_regs[16];
161 u32 ctrl_regs[16];
162} __attribute__((packed));
163
164struct save_area_s390x {
165 u64 fp_regs[16];
166 u64 gp_regs[16];
167 u8 psw[16];
168 u8 pad1[8];
169 u32 pref_reg;
170 u32 fp_ctrl_reg;
171 u8 pad2[4];
172 u32 tod_reg;
173 u64 timer;
174 u64 clk_cmp;
175 u8 pad3[8];
176 u32 acc_regs[16];
177 u64 ctrl_regs[16];
178} __attribute__((packed));
179
180union save_area {
181 struct save_area_s390 s390;
182 struct save_area_s390x s390x;
183};
184
185#define SAVE_AREA_BASE_S390 0xd4
186#define SAVE_AREA_BASE_S390X 0x1200
187
188#ifndef __s390x__
189#define SAVE_AREA_SIZE sizeof(struct save_area_s390)
190#define SAVE_AREA_BASE SAVE_AREA_BASE_S390
191#else
192#define SAVE_AREA_SIZE sizeof(struct save_area_s390x)
193#define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
194#endif
195
196struct _lowcore
197{
198#ifndef __s390x__
199 /* prefix area: defined by architecture */
200 psw_t restart_psw; /* 0x000 */
201 __u32 ccw2[4]; /* 0x008 */
202 psw_t external_old_psw; /* 0x018 */
203 psw_t svc_old_psw; /* 0x020 */
204 psw_t program_old_psw; /* 0x028 */
205 psw_t mcck_old_psw; /* 0x030 */
206 psw_t io_old_psw; /* 0x038 */
207 __u8 pad1[0x58-0x40]; /* 0x040 */
208 psw_t external_new_psw; /* 0x058 */
209 psw_t svc_new_psw; /* 0x060 */
210 psw_t program_new_psw; /* 0x068 */
211 psw_t mcck_new_psw; /* 0x070 */
212 psw_t io_new_psw; /* 0x078 */
213 __u32 ext_params; /* 0x080 */
214 __u16 cpu_addr; /* 0x084 */
215 __u16 ext_int_code; /* 0x086 */
216 __u16 svc_ilc; /* 0x088 */
217 __u16 svc_code; /* 0x08a */
218 __u16 pgm_ilc; /* 0x08c */
219 __u16 pgm_code; /* 0x08e */
220 __u32 trans_exc_code; /* 0x090 */
221 __u16 mon_class_num; /* 0x094 */
222 __u16 per_perc_atmid; /* 0x096 */
223 __u32 per_address; /* 0x098 */
224 __u32 monitor_code; /* 0x09c */
225 __u8 exc_access_id; /* 0x0a0 */
226 __u8 per_access_id; /* 0x0a1 */
227 __u8 pad2[0xB8-0xA2]; /* 0x0a2 */
228 __u16 subchannel_id; /* 0x0b8 */
229 __u16 subchannel_nr; /* 0x0ba */
230 __u32 io_int_parm; /* 0x0bc */
231 __u32 io_int_word; /* 0x0c0 */
232 __u8 pad3[0xc8-0xc4]; /* 0x0c4 */
233 __u32 stfl_fac_list; /* 0x0c8 */
234 __u8 pad4[0xd4-0xcc]; /* 0x0cc */
235 __u32 extended_save_area_addr; /* 0x0d4 */
236 __u32 cpu_timer_save_area[2]; /* 0x0d8 */
237 __u32 clock_comp_save_area[2]; /* 0x0e0 */
238 __u32 mcck_interruption_code[2]; /* 0x0e8 */
239 __u8 pad5[0xf4-0xf0]; /* 0x0f0 */
240 __u32 external_damage_code; /* 0x0f4 */
241 __u32 failing_storage_address; /* 0x0f8 */
242 __u8 pad6[0x100-0xfc]; /* 0x0fc */
243 __u32 st_status_fixed_logout[4];/* 0x100 */
244 __u8 pad7[0x120-0x110]; /* 0x110 */
245 __u32 access_regs_save_area[16];/* 0x120 */
246 __u32 floating_pt_save_area[8]; /* 0x160 */
247 __u32 gpregs_save_area[16]; /* 0x180 */
248 __u32 cregs_save_area[16]; /* 0x1c0 */
249
250 psw_t return_psw; /* 0x200 */
251 __u8 irb[64]; /* 0x208 */
252 __u64 sync_enter_timer; /* 0x248 */
253 __u64 async_enter_timer; /* 0x250 */
254 __u64 exit_timer; /* 0x258 */
255 __u64 last_update_timer; /* 0x260 */
256 __u64 user_timer; /* 0x268 */
257 __u64 system_timer; /* 0x270 */
258 __u64 last_update_clock; /* 0x278 */
259 __u64 steal_clock; /* 0x280 */
260 psw_t return_mcck_psw; /* 0x288 */
261 __u8 pad8[0xc00-0x290]; /* 0x290 */
262
263 /* System info area */
264 __u32 save_area[16]; /* 0xc00 */
265 __u32 kernel_stack; /* 0xc40 */
266 __u32 thread_info; /* 0xc44 */
267 __u32 async_stack; /* 0xc48 */
268 __u32 kernel_asce; /* 0xc4c */
269 __u32 user_asce; /* 0xc50 */
270 __u32 panic_stack; /* 0xc54 */
271 __u32 user_exec_asce; /* 0xc58 */
272 __u8 pad10[0xc60-0xc5c]; /* 0xc5c */
273 /* entry.S sensitive area start */
274 struct cpuinfo_S390 cpu_data; /* 0xc60 */
275 __u32 ipl_device; /* 0xc7c */
276 /* entry.S sensitive area end */
277
278 /* SMP info area: defined by DJB */
279 __u64 clock_comparator; /* 0xc80 */
280 __u32 ext_call_fast; /* 0xc88 */
281 __u32 percpu_offset; /* 0xc8c */
282 __u32 current_task; /* 0xc90 */
283 __u32 softirq_pending; /* 0xc94 */
284 __u64 int_clock; /* 0xc98 */
285 __u8 pad11[0xe00-0xca0]; /* 0xca0 */
286
287 /* 0xe00 is used as indicator for dump tools */
288 /* whether the kernel died with panic() or not */
289 __u32 panic_magic; /* 0xe00 */
290
291 /* Align to the top 1k of prefix area */
292 __u8 pad12[0x1000-0xe04]; /* 0xe04 */
293#else /* !__s390x__ */
294 /* prefix area: defined by architecture */
295 __u32 ccw1[2]; /* 0x000 */
296 __u32 ccw2[4]; /* 0x008 */
297 __u8 pad1[0x80-0x18]; /* 0x018 */
298 __u32 ext_params; /* 0x080 */
299 __u16 cpu_addr; /* 0x084 */
300 __u16 ext_int_code; /* 0x086 */
301 __u16 svc_ilc; /* 0x088 */
302 __u16 svc_code; /* 0x08a */
303 __u16 pgm_ilc; /* 0x08c */
304 __u16 pgm_code; /* 0x08e */
305 __u32 data_exc_code; /* 0x090 */
306 __u16 mon_class_num; /* 0x094 */
307 __u16 per_perc_atmid; /* 0x096 */
308 addr_t per_address; /* 0x098 */
309 __u8 exc_access_id; /* 0x0a0 */
310 __u8 per_access_id; /* 0x0a1 */
311 __u8 op_access_id; /* 0x0a2 */
312 __u8 ar_access_id; /* 0x0a3 */
313 __u8 pad2[0xA8-0xA4]; /* 0x0a4 */
314 addr_t trans_exc_code; /* 0x0A0 */
315 addr_t monitor_code; /* 0x09c */
316 __u16 subchannel_id; /* 0x0b8 */
317 __u16 subchannel_nr; /* 0x0ba */
318 __u32 io_int_parm; /* 0x0bc */
319 __u32 io_int_word; /* 0x0c0 */
320 __u8 pad3[0xc8-0xc4]; /* 0x0c4 */
321 __u32 stfl_fac_list; /* 0x0c8 */
322 __u8 pad4[0xe8-0xcc]; /* 0x0cc */
323 __u32 mcck_interruption_code[2]; /* 0x0e8 */
324 __u8 pad5[0xf4-0xf0]; /* 0x0f0 */
325 __u32 external_damage_code; /* 0x0f4 */
326 addr_t failing_storage_address; /* 0x0f8 */
327 __u8 pad6[0x120-0x100]; /* 0x100 */
328 psw_t restart_old_psw; /* 0x120 */
329 psw_t external_old_psw; /* 0x130 */
330 psw_t svc_old_psw; /* 0x140 */
331 psw_t program_old_psw; /* 0x150 */
332 psw_t mcck_old_psw; /* 0x160 */
333 psw_t io_old_psw; /* 0x170 */
334 __u8 pad7[0x1a0-0x180]; /* 0x180 */
335 psw_t restart_psw; /* 0x1a0 */
336 psw_t external_new_psw; /* 0x1b0 */
337 psw_t svc_new_psw; /* 0x1c0 */
338 psw_t program_new_psw; /* 0x1d0 */
339 psw_t mcck_new_psw; /* 0x1e0 */
340 psw_t io_new_psw; /* 0x1f0 */
341 psw_t return_psw; /* 0x200 */
342 __u8 irb[64]; /* 0x210 */
343 __u64 sync_enter_timer; /* 0x250 */
344 __u64 async_enter_timer; /* 0x258 */
345 __u64 exit_timer; /* 0x260 */
346 __u64 last_update_timer; /* 0x268 */
347 __u64 user_timer; /* 0x270 */
348 __u64 system_timer; /* 0x278 */
349 __u64 last_update_clock; /* 0x280 */
350 __u64 steal_clock; /* 0x288 */
351 psw_t return_mcck_psw; /* 0x290 */
352 __u8 pad8[0xc00-0x2a0]; /* 0x2a0 */
353 /* System info area */
354 __u64 save_area[16]; /* 0xc00 */
355 __u8 pad9[0xd40-0xc80]; /* 0xc80 */
356 __u64 kernel_stack; /* 0xd40 */
357 __u64 thread_info; /* 0xd48 */
358 __u64 async_stack; /* 0xd50 */
359 __u64 kernel_asce; /* 0xd58 */
360 __u64 user_asce; /* 0xd60 */
361 __u64 panic_stack; /* 0xd68 */
362 __u64 user_exec_asce; /* 0xd70 */
363 __u8 pad10[0xd80-0xd78]; /* 0xd78 */
364 /* entry.S sensitive area start */
365 struct cpuinfo_S390 cpu_data; /* 0xd80 */
366 __u32 ipl_device; /* 0xdb8 */
367 __u32 pad11; /* 0xdbc */
368 /* entry.S sensitive area end */
369
370 /* SMP info area: defined by DJB */
371 __u64 clock_comparator; /* 0xdc0 */
372 __u64 ext_call_fast; /* 0xdc8 */
373 __u64 percpu_offset; /* 0xdd0 */
374 __u64 current_task; /* 0xdd8 */
375 __u32 softirq_pending; /* 0xde0 */
376 __u32 pad_0x0de4; /* 0xde4 */
377 __u64 int_clock; /* 0xde8 */
378 __u8 pad12[0xe00-0xdf0]; /* 0xdf0 */
379
380 /* 0xe00 is used as indicator for dump tools */
381 /* whether the kernel died with panic() or not */
382 __u32 panic_magic; /* 0xe00 */
383
384 __u8 pad13[0x11b8-0xe04]; /* 0xe04 */
385
386 /* 64 bit extparam used for pfault, diag 250 etc */
387 __u64 ext_params2; /* 0x11B8 */
388
389 __u8 pad14[0x1200-0x11C0]; /* 0x11C0 */
390
391 /* System info area */
392
393 __u64 floating_pt_save_area[16]; /* 0x1200 */
394 __u64 gpregs_save_area[16]; /* 0x1280 */
395 __u32 st_status_fixed_logout[4]; /* 0x1300 */
396 __u8 pad15[0x1318-0x1310]; /* 0x1310 */
397 __u32 prefixreg_save_area; /* 0x1318 */
398 __u32 fpt_creg_save_area; /* 0x131c */
399 __u8 pad16[0x1324-0x1320]; /* 0x1320 */
400 __u32 tod_progreg_save_area; /* 0x1324 */
401 __u32 cpu_timer_save_area[2]; /* 0x1328 */
402 __u32 clock_comp_save_area[2]; /* 0x1330 */
403 __u8 pad17[0x1340-0x1338]; /* 0x1338 */
404 __u32 access_regs_save_area[16]; /* 0x1340 */
405 __u64 cregs_save_area[16]; /* 0x1380 */
406
407 /* align to the top of the prefix area */
408
409 __u8 pad18[0x2000-0x1400]; /* 0x1400 */
410#endif /* !__s390x__ */
411} __attribute__((packed)); /* End structure*/
412
413#define S390_lowcore (*((struct _lowcore *) 0))
414extern struct _lowcore *lowcore_ptr[];
415
416static inline void set_prefix(__u32 address)
417{
418 asm volatile("spx %0" : : "m" (address) : "memory");
419}
420
421static inline __u32 store_prefix(void)
422{
423 __u32 address;
424
425 asm volatile("stpx %0" : "=m" (address));
426 return address;
427}
428
429#define __PANIC_MAGIC 0xDEADC0DE
430
431#endif
432
433#endif
diff --git a/arch/s390/include/asm/mathemu.h b/arch/s390/include/asm/mathemu.h
new file mode 100644
index 000000000000..e8dd1ba8edb0
--- /dev/null
+++ b/arch/s390/include/asm/mathemu.h
@@ -0,0 +1,29 @@
1/*
2 * arch/s390/kernel/mathemu.h
3 * IEEE floating point emulation.
4 *
5 * S390 version
6 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
8 */
9
10#ifndef __MATHEMU__
11#define __MATHEMU__
12
13extern int math_emu_b3(__u8 *, struct pt_regs *);
14extern int math_emu_ed(__u8 *, struct pt_regs *);
15extern int math_emu_ldr(__u8 *);
16extern int math_emu_ler(__u8 *);
17extern int math_emu_std(__u8 *, struct pt_regs *);
18extern int math_emu_ld(__u8 *, struct pt_regs *);
19extern int math_emu_ste(__u8 *, struct pt_regs *);
20extern int math_emu_le(__u8 *, struct pt_regs *);
21extern int math_emu_lfpc(__u8 *, struct pt_regs *);
22extern int math_emu_stfpc(__u8 *, struct pt_regs *);
23extern int math_emu_srnm(__u8 *, struct pt_regs *);
24
25#endif /* __MATHEMU__ */
26
27
28
29
diff --git a/arch/s390/include/asm/mman.h b/arch/s390/include/asm/mman.h
new file mode 100644
index 000000000000..7839767d837e
--- /dev/null
+++ b/arch/s390/include/asm/mman.h
@@ -0,0 +1,25 @@
1/*
2 * include/asm-s390/mman.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/mman.h"
7 */
8
9#ifndef __S390_MMAN_H__
10#define __S390_MMAN_H__
11
12#include <asm-generic/mman.h>
13
14#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
15#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
16#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
17#define MAP_LOCKED 0x2000 /* pages are locked */
18#define MAP_NORESERVE 0x4000 /* don't check for reservations */
19#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
20#define MAP_NONBLOCK 0x10000 /* do not block on IO */
21
22#define MCL_CURRENT 1 /* lock all current mappings */
23#define MCL_FUTURE 2 /* lock all future mappings */
24
25#endif /* __S390_MMAN_H__ */
diff --git a/arch/s390/include/asm/mmu.h b/arch/s390/include/asm/mmu.h
new file mode 100644
index 000000000000..5dd5e7b3476f
--- /dev/null
+++ b/arch/s390/include/asm/mmu.h
@@ -0,0 +1,13 @@
1#ifndef __MMU_H
2#define __MMU_H
3
4typedef struct {
5 struct list_head crst_list;
6 struct list_head pgtable_list;
7 unsigned long asce_bits;
8 unsigned long asce_limit;
9 int noexec;
10 int pgstes;
11} mm_context_t;
12
13#endif
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
new file mode 100644
index 000000000000..4c2fbf48c9c4
--- /dev/null
+++ b/arch/s390/include/asm/mmu_context.h
@@ -0,0 +1,77 @@
1/*
2 * include/asm-s390/mmu_context.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/mmu_context.h"
7 */
8
9#ifndef __S390_MMU_CONTEXT_H
10#define __S390_MMU_CONTEXT_H
11
12#include <asm/pgalloc.h>
13#include <asm/uaccess.h>
14#include <asm-generic/mm_hooks.h>
15
16static inline int init_new_context(struct task_struct *tsk,
17 struct mm_struct *mm)
18{
19 mm->context.asce_bits = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS;
20#ifdef CONFIG_64BIT
21 mm->context.asce_bits |= _ASCE_TYPE_REGION3;
22#endif
23 if (current->mm->context.pgstes) {
24 mm->context.noexec = 0;
25 mm->context.pgstes = 1;
26 } else {
27 mm->context.noexec = s390_noexec;
28 mm->context.pgstes = 0;
29 }
30 mm->context.asce_limit = STACK_TOP_MAX;
31 crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm));
32 return 0;
33}
34
35#define destroy_context(mm) do { } while (0)
36
37#ifndef __s390x__
38#define LCTL_OPCODE "lctl"
39#else
40#define LCTL_OPCODE "lctlg"
41#endif
42
43static inline void update_mm(struct mm_struct *mm, struct task_struct *tsk)
44{
45 pgd_t *pgd = mm->pgd;
46
47 S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd);
48 if (switch_amode) {
49 /* Load primary space page table origin. */
50 pgd = mm->context.noexec ? get_shadow_table(pgd) : pgd;
51 S390_lowcore.user_exec_asce = mm->context.asce_bits | __pa(pgd);
52 asm volatile(LCTL_OPCODE" 1,1,%0\n"
53 : : "m" (S390_lowcore.user_exec_asce) );
54 } else
55 /* Load home space page table origin. */
56 asm volatile(LCTL_OPCODE" 13,13,%0"
57 : : "m" (S390_lowcore.user_asce) );
58 set_fs(current->thread.mm_segment);
59}
60
61static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
62 struct task_struct *tsk)
63{
64 cpu_set(smp_processor_id(), next->cpu_vm_mask);
65 update_mm(next, tsk);
66}
67
68#define enter_lazy_tlb(mm,tsk) do { } while (0)
69#define deactivate_mm(tsk,mm) do { } while (0)
70
71static inline void activate_mm(struct mm_struct *prev,
72 struct mm_struct *next)
73{
74 switch_mm(prev, next, current);
75}
76
77#endif /* __S390_MMU_CONTEXT_H */
diff --git a/arch/s390/include/asm/module.h b/arch/s390/include/asm/module.h
new file mode 100644
index 000000000000..1cc1c5af705a
--- /dev/null
+++ b/arch/s390/include/asm/module.h
@@ -0,0 +1,46 @@
1#ifndef _ASM_S390_MODULE_H
2#define _ASM_S390_MODULE_H
3/*
4 * This file contains the s390 architecture specific module code.
5 */
6
7struct mod_arch_syminfo
8{
9 unsigned long got_offset;
10 unsigned long plt_offset;
11 int got_initialized;
12 int plt_initialized;
13};
14
15struct mod_arch_specific
16{
17 /* Starting offset of got in the module core memory. */
18 unsigned long got_offset;
19 /* Starting offset of plt in the module core memory. */
20 unsigned long plt_offset;
21 /* Size of the got. */
22 unsigned long got_size;
23 /* Size of the plt. */
24 unsigned long plt_size;
25 /* Number of symbols in syminfo. */
26 int nsyms;
27 /* Additional symbol information (got and plt offsets). */
28 struct mod_arch_syminfo *syminfo;
29};
30
31#ifdef __s390x__
32#define ElfW(x) Elf64_ ## x
33#define ELFW(x) ELF64_ ## x
34#else
35#define ElfW(x) Elf32_ ## x
36#define ELFW(x) ELF32_ ## x
37#endif
38
39#define Elf_Addr ElfW(Addr)
40#define Elf_Rela ElfW(Rela)
41#define Elf_Shdr ElfW(Shdr)
42#define Elf_Sym ElfW(Sym)
43#define Elf_Ehdr ElfW(Ehdr)
44#define ELF_R_SYM ELFW(R_SYM)
45#define ELF_R_TYPE ELFW(R_TYPE)
46#endif /* _ASM_S390_MODULE_H */
diff --git a/arch/s390/include/asm/monwriter.h b/arch/s390/include/asm/monwriter.h
new file mode 100644
index 000000000000..f0cbf96c52e6
--- /dev/null
+++ b/arch/s390/include/asm/monwriter.h
@@ -0,0 +1,33 @@
1/*
2 * include/asm-s390/monwriter.h
3 *
4 * Copyright (C) IBM Corp. 2006
5 * Character device driver for writing z/VM APPLDATA monitor records
6 * Version 1.0
7 * Author(s): Melissa Howland <melissah@us.ibm.com>
8 *
9 */
10
11#ifndef _ASM_390_MONWRITER_H
12#define _ASM_390_MONWRITER_H
13
14/* mon_function values */
15#define MONWRITE_START_INTERVAL 0x00 /* start interval recording */
16#define MONWRITE_STOP_INTERVAL 0x01 /* stop interval or config recording */
17#define MONWRITE_GEN_EVENT 0x02 /* generate event record */
18#define MONWRITE_START_CONFIG 0x03 /* start configuration recording */
19
20/* the header the app uses in its write() data */
21struct monwrite_hdr {
22 unsigned char mon_function;
23 unsigned short applid;
24 unsigned char record_num;
25 unsigned short version;
26 unsigned short release;
27 unsigned short mod_level;
28 unsigned short datalen;
29 unsigned char hdrlen;
30
31} __attribute__((packed));
32
33#endif /* _ASM_390_MONWRITER_H */
diff --git a/arch/s390/include/asm/msgbuf.h b/arch/s390/include/asm/msgbuf.h
new file mode 100644
index 000000000000..1bbdee927924
--- /dev/null
+++ b/arch/s390/include/asm/msgbuf.h
@@ -0,0 +1,37 @@
1#ifndef _S390_MSGBUF_H
2#define _S390_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for S/390 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17#ifndef __s390x__
18 unsigned long __unused1;
19#endif /* ! __s390x__ */
20 __kernel_time_t msg_rtime; /* last msgrcv time */
21#ifndef __s390x__
22 unsigned long __unused2;
23#endif /* ! __s390x__ */
24 __kernel_time_t msg_ctime; /* last change time */
25#ifndef __s390x__
26 unsigned long __unused3;
27#endif /* ! __s390x__ */
28 unsigned long msg_cbytes; /* current number of bytes on queue */
29 unsigned long msg_qnum; /* number of messages in queue */
30 unsigned long msg_qbytes; /* max number of bytes on queue */
31 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
32 __kernel_pid_t msg_lrpid; /* last receive pid */
33 unsigned long __unused4;
34 unsigned long __unused5;
35};
36
37#endif /* _S390_MSGBUF_H */
diff --git a/arch/s390/include/asm/mutex.h b/arch/s390/include/asm/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/arch/s390/include/asm/mutex.h
@@ -0,0 +1,9 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
new file mode 100644
index 000000000000..991ba939408c
--- /dev/null
+++ b/arch/s390/include/asm/page.h
@@ -0,0 +1,155 @@
1/*
2 * include/asm-s390/page.h
3 *
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Hartmut Penner (hp@de.ibm.com)
7 */
8
9#ifndef _S390_PAGE_H
10#define _S390_PAGE_H
11
12#include <linux/const.h>
13#include <asm/types.h>
14
15/* PAGE_SHIFT determines the page size */
16#define PAGE_SHIFT 12
17#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
18#define PAGE_MASK (~(PAGE_SIZE-1))
19#define PAGE_DEFAULT_ACC 0
20#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
21
22#define HPAGE_SHIFT 20
23#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
24#define HPAGE_MASK (~(HPAGE_SIZE - 1))
25#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
26
27#define ARCH_HAS_SETCLEAR_HUGE_PTE
28#define ARCH_HAS_HUGE_PTE_TYPE
29#define ARCH_HAS_PREPARE_HUGEPAGE
30#define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH
31
32#include <asm/setup.h>
33#ifndef __ASSEMBLY__
34
35static inline void clear_page(void *page)
36{
37 if (MACHINE_HAS_PFMF) {
38 asm volatile(
39 " .insn rre,0xb9af0000,%0,%1"
40 : : "d" (0x10000), "a" (page) : "memory", "cc");
41 } else {
42 register unsigned long reg1 asm ("1") = 0;
43 register void *reg2 asm ("2") = page;
44 register unsigned long reg3 asm ("3") = 4096;
45 asm volatile(
46 " mvcl 2,0"
47 : "+d" (reg2), "+d" (reg3) : "d" (reg1)
48 : "memory", "cc");
49 }
50}
51
52static inline void copy_page(void *to, void *from)
53{
54 if (MACHINE_HAS_MVPG) {
55 register unsigned long reg0 asm ("0") = 0;
56 asm volatile(
57 " mvpg %0,%1"
58 : : "a" (to), "a" (from), "d" (reg0)
59 : "memory", "cc");
60 } else
61 asm volatile(
62 " mvc 0(256,%0),0(%1)\n"
63 " mvc 256(256,%0),256(%1)\n"
64 " mvc 512(256,%0),512(%1)\n"
65 " mvc 768(256,%0),768(%1)\n"
66 " mvc 1024(256,%0),1024(%1)\n"
67 " mvc 1280(256,%0),1280(%1)\n"
68 " mvc 1536(256,%0),1536(%1)\n"
69 " mvc 1792(256,%0),1792(%1)\n"
70 " mvc 2048(256,%0),2048(%1)\n"
71 " mvc 2304(256,%0),2304(%1)\n"
72 " mvc 2560(256,%0),2560(%1)\n"
73 " mvc 2816(256,%0),2816(%1)\n"
74 " mvc 3072(256,%0),3072(%1)\n"
75 " mvc 3328(256,%0),3328(%1)\n"
76 " mvc 3584(256,%0),3584(%1)\n"
77 " mvc 3840(256,%0),3840(%1)\n"
78 : : "a" (to), "a" (from) : "memory");
79}
80
81#define clear_user_page(page, vaddr, pg) clear_page(page)
82#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
83
84#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
85 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
86#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
87
88/*
89 * These are used to make use of C type-checking..
90 */
91
92typedef struct { unsigned long pgprot; } pgprot_t;
93typedef struct { unsigned long pte; } pte_t;
94typedef struct { unsigned long pmd; } pmd_t;
95typedef struct { unsigned long pud; } pud_t;
96typedef struct { unsigned long pgd; } pgd_t;
97typedef pte_t *pgtable_t;
98
99#define pgprot_val(x) ((x).pgprot)
100#define pte_val(x) ((x).pte)
101#define pmd_val(x) ((x).pmd)
102#define pud_val(x) ((x).pud)
103#define pgd_val(x) ((x).pgd)
104
105#define __pte(x) ((pte_t) { (x) } )
106#define __pmd(x) ((pmd_t) { (x) } )
107#define __pgd(x) ((pgd_t) { (x) } )
108#define __pgprot(x) ((pgprot_t) { (x) } )
109
110/* default storage key used for all pages */
111extern unsigned int default_storage_key;
112
113static inline void
114page_set_storage_key(unsigned long addr, unsigned int skey)
115{
116 asm volatile("sske %0,%1" : : "d" (skey), "a" (addr));
117}
118
119static inline unsigned int
120page_get_storage_key(unsigned long addr)
121{
122 unsigned int skey;
123
124 asm volatile("iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0));
125 return skey;
126}
127
128#ifdef CONFIG_PAGE_STATES
129
130struct page;
131void arch_free_page(struct page *page, int order);
132void arch_alloc_page(struct page *page, int order);
133
134#define HAVE_ARCH_FREE_PAGE
135#define HAVE_ARCH_ALLOC_PAGE
136
137#endif
138
139#endif /* !__ASSEMBLY__ */
140
141#define __PAGE_OFFSET 0x0UL
142#define PAGE_OFFSET 0x0UL
143#define __pa(x) (unsigned long)(x)
144#define __va(x) (void *)(unsigned long)(x)
145#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
146#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
147#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
148
149#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
150 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
151
152#include <asm-generic/memory_model.h>
153#include <asm-generic/page.h>
154
155#endif /* _S390_PAGE_H */
diff --git a/arch/s390/include/asm/param.h b/arch/s390/include/asm/param.h
new file mode 100644
index 000000000000..34aaa4603347
--- /dev/null
+++ b/arch/s390/include/asm/param.h
@@ -0,0 +1,30 @@
1/*
2 * include/asm-s390/param.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/param.h"
7 */
8
9#ifndef _ASMS390_PARAM_H
10#define _ASMS390_PARAM_H
11
12#ifdef __KERNEL__
13# define HZ CONFIG_HZ /* Internal kernel timer frequency */
14# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
15# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
16#endif
17
18#ifndef HZ
19#define HZ 100
20#endif
21
22#define EXEC_PAGESIZE 4096
23
24#ifndef NOGROUP
25#define NOGROUP (-1)
26#endif
27
28#define MAXHOSTNAMELEN 64 /* max length of hostname */
29
30#endif
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
new file mode 100644
index 000000000000..42a145c9ddd6
--- /dev/null
+++ b/arch/s390/include/asm/pci.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_S390_PCI_H
2#define __ASM_S390_PCI_H
3
4/* S/390 systems don't have a PCI bus. This file is just here because some stupid .c code
5 * includes it even if CONFIG_PCI is not set.
6 */
7#define PCI_DMA_BUS_IS_PHYS (0)
8
9#endif /* __ASM_S390_PCI_H */
10
diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h
new file mode 100644
index 000000000000..408d60b4f75b
--- /dev/null
+++ b/arch/s390/include/asm/percpu.h
@@ -0,0 +1,37 @@
1#ifndef __ARCH_S390_PERCPU__
2#define __ARCH_S390_PERCPU__
3
4#include <linux/compiler.h>
5#include <asm/lowcore.h>
6
7/*
8 * s390 uses its own implementation for per cpu data, the offset of
9 * the cpu local data area is cached in the cpu's lowcore memory.
10 * For 64 bit module code s390 forces the use of a GOT slot for the
11 * address of the per cpu variable. This is needed because the module
12 * may be more than 4G above the per cpu area.
13 */
14#if defined(__s390x__) && defined(MODULE)
15
16#define SHIFT_PERCPU_PTR(ptr,offset) (({ \
17 extern int simple_identifier_##var(void); \
18 unsigned long *__ptr; \
19 asm ( "larl %0, %1@GOTENT" \
20 : "=a" (__ptr) : "X" (ptr) ); \
21 (typeof(ptr))((*__ptr) + (offset)); }))
22
23#else
24
25#define SHIFT_PERCPU_PTR(ptr, offset) (({ \
26 extern int simple_identifier_##var(void); \
27 unsigned long __ptr; \
28 asm ( "" : "=a" (__ptr) : "0" (ptr) ); \
29 (typeof(ptr)) (__ptr + (offset)); }))
30
31#endif
32
33#define __my_cpu_offset S390_lowcore.percpu_offset
34
35#include <asm-generic/percpu.h>
36
37#endif /* __ARCH_S390_PERCPU__ */
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
new file mode 100644
index 000000000000..f5b2bf3d7c1d
--- /dev/null
+++ b/arch/s390/include/asm/pgalloc.h
@@ -0,0 +1,174 @@
1/*
2 * include/asm-s390/pgalloc.h
3 *
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Hartmut Penner (hp@de.ibm.com)
7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 *
9 * Derived from "include/asm-i386/pgalloc.h"
10 * Copyright (C) 1994 Linus Torvalds
11 */
12
13#ifndef _S390_PGALLOC_H
14#define _S390_PGALLOC_H
15
16#include <linux/threads.h>
17#include <linux/gfp.h>
18#include <linux/mm.h>
19
20#define check_pgt_cache() do {} while (0)
21
22unsigned long *crst_table_alloc(struct mm_struct *, int);
23void crst_table_free(struct mm_struct *, unsigned long *);
24
25unsigned long *page_table_alloc(struct mm_struct *);
26void page_table_free(struct mm_struct *, unsigned long *);
27void disable_noexec(struct mm_struct *, struct task_struct *);
28
29static inline void clear_table(unsigned long *s, unsigned long val, size_t n)
30{
31 *s = val;
32 n = (n / 256) - 1;
33 asm volatile(
34#ifdef CONFIG_64BIT
35 " mvc 8(248,%0),0(%0)\n"
36#else
37 " mvc 4(252,%0),0(%0)\n"
38#endif
39 "0: mvc 256(256,%0),0(%0)\n"
40 " la %0,256(%0)\n"
41 " brct %1,0b\n"
42 : "+a" (s), "+d" (n));
43}
44
45static inline void crst_table_init(unsigned long *crst, unsigned long entry)
46{
47 clear_table(crst, entry, sizeof(unsigned long)*2048);
48 crst = get_shadow_table(crst);
49 if (crst)
50 clear_table(crst, entry, sizeof(unsigned long)*2048);
51}
52
53#ifndef __s390x__
54
55static inline unsigned long pgd_entry_type(struct mm_struct *mm)
56{
57 return _SEGMENT_ENTRY_EMPTY;
58}
59
60#define pud_alloc_one(mm,address) ({ BUG(); ((pud_t *)2); })
61#define pud_free(mm, x) do { } while (0)
62
63#define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); })
64#define pmd_free(mm, x) do { } while (0)
65
66#define pgd_populate(mm, pgd, pud) BUG()
67#define pgd_populate_kernel(mm, pgd, pud) BUG()
68
69#define pud_populate(mm, pud, pmd) BUG()
70#define pud_populate_kernel(mm, pud, pmd) BUG()
71
72#else /* __s390x__ */
73
74static inline unsigned long pgd_entry_type(struct mm_struct *mm)
75{
76 if (mm->context.asce_limit <= (1UL << 31))
77 return _SEGMENT_ENTRY_EMPTY;
78 if (mm->context.asce_limit <= (1UL << 42))
79 return _REGION3_ENTRY_EMPTY;
80 return _REGION2_ENTRY_EMPTY;
81}
82
83int crst_table_upgrade(struct mm_struct *, unsigned long limit);
84void crst_table_downgrade(struct mm_struct *, unsigned long limit);
85
86static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
87{
88 unsigned long *table = crst_table_alloc(mm, mm->context.noexec);
89 if (table)
90 crst_table_init(table, _REGION3_ENTRY_EMPTY);
91 return (pud_t *) table;
92}
93#define pud_free(mm, pud) crst_table_free(mm, (unsigned long *) pud)
94
95static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
96{
97 unsigned long *table = crst_table_alloc(mm, mm->context.noexec);
98 if (table)
99 crst_table_init(table, _SEGMENT_ENTRY_EMPTY);
100 return (pmd_t *) table;
101}
102#define pmd_free(mm, pmd) crst_table_free(mm, (unsigned long *) pmd)
103
104static inline void pgd_populate_kernel(struct mm_struct *mm,
105 pgd_t *pgd, pud_t *pud)
106{
107 pgd_val(*pgd) = _REGION2_ENTRY | __pa(pud);
108}
109
110static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
111{
112 pgd_populate_kernel(mm, pgd, pud);
113 if (mm->context.noexec) {
114 pgd = get_shadow_table(pgd);
115 pud = get_shadow_table(pud);
116 pgd_populate_kernel(mm, pgd, pud);
117 }
118}
119
120static inline void pud_populate_kernel(struct mm_struct *mm,
121 pud_t *pud, pmd_t *pmd)
122{
123 pud_val(*pud) = _REGION3_ENTRY | __pa(pmd);
124}
125
126static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
127{
128 pud_populate_kernel(mm, pud, pmd);
129 if (mm->context.noexec) {
130 pud = get_shadow_table(pud);
131 pmd = get_shadow_table(pmd);
132 pud_populate_kernel(mm, pud, pmd);
133 }
134}
135
136#endif /* __s390x__ */
137
138static inline pgd_t *pgd_alloc(struct mm_struct *mm)
139{
140 INIT_LIST_HEAD(&mm->context.crst_list);
141 INIT_LIST_HEAD(&mm->context.pgtable_list);
142 return (pgd_t *) crst_table_alloc(mm, s390_noexec);
143}
144#define pgd_free(mm, pgd) crst_table_free(mm, (unsigned long *) pgd)
145
146static inline void pmd_populate_kernel(struct mm_struct *mm,
147 pmd_t *pmd, pte_t *pte)
148{
149 pmd_val(*pmd) = _SEGMENT_ENTRY + __pa(pte);
150}
151
152static inline void pmd_populate(struct mm_struct *mm,
153 pmd_t *pmd, pgtable_t pte)
154{
155 pmd_populate_kernel(mm, pmd, pte);
156 if (mm->context.noexec) {
157 pmd = get_shadow_table(pmd);
158 pmd_populate_kernel(mm, pmd, pte + PTRS_PER_PTE);
159 }
160}
161
162#define pmd_pgtable(pmd) \
163 (pgtable_t)(pmd_val(pmd) & -sizeof(pte_t)*PTRS_PER_PTE)
164
165/*
166 * page table entry allocation/free routines.
167 */
168#define pte_alloc_one_kernel(mm, vmaddr) ((pte_t *) page_table_alloc(mm))
169#define pte_alloc_one(mm, vmaddr) ((pte_t *) page_table_alloc(mm))
170
171#define pte_free_kernel(mm, pte) page_table_free(mm, (unsigned long *) pte)
172#define pte_free(mm, pte) page_table_free(mm, (unsigned long *) pte)
173
174#endif /* _S390_PGALLOC_H */
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
new file mode 100644
index 000000000000..0bdb704ae051
--- /dev/null
+++ b/arch/s390/include/asm/pgtable.h
@@ -0,0 +1,1093 @@
1/*
2 * include/asm-s390/pgtable.h
3 *
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Hartmut Penner (hp@de.ibm.com)
7 * Ulrich Weigand (weigand@de.ibm.com)
8 * Martin Schwidefsky (schwidefsky@de.ibm.com)
9 *
10 * Derived from "include/asm-i386/pgtable.h"
11 */
12
13#ifndef _ASM_S390_PGTABLE_H
14#define _ASM_S390_PGTABLE_H
15
16/*
17 * The Linux memory management assumes a three-level page table setup. For
18 * s390 31 bit we "fold" the mid level into the top-level page table, so
19 * that we physically have the same two-level page table as the s390 mmu
20 * expects in 31 bit mode. For s390 64 bit we use three of the five levels
21 * the hardware provides (region first and region second tables are not
22 * used).
23 *
24 * The "pgd_xxx()" functions are trivial for a folded two-level
25 * setup: the pgd is never bad, and a pmd always exists (as it's folded
26 * into the pgd entry)
27 *
28 * This file contains the functions and defines necessary to modify and use
29 * the S390 page table tree.
30 */
31#ifndef __ASSEMBLY__
32#include <linux/sched.h>
33#include <linux/mm_types.h>
34#include <asm/bitops.h>
35#include <asm/bug.h>
36#include <asm/processor.h>
37
38extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096)));
39extern void paging_init(void);
40extern void vmem_map_init(void);
41
42/*
43 * The S390 doesn't have any external MMU info: the kernel page
44 * tables contain all the necessary information.
45 */
46#define update_mmu_cache(vma, address, pte) do { } while (0)
47
48/*
49 * ZERO_PAGE is a global shared page that is always zero: used
50 * for zero-mapped memory areas etc..
51 */
52extern char empty_zero_page[PAGE_SIZE];
53#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
54#endif /* !__ASSEMBLY__ */
55
56/*
57 * PMD_SHIFT determines the size of the area a second-level page
58 * table can map
59 * PGDIR_SHIFT determines what a third-level page table entry can map
60 */
61#ifndef __s390x__
62# define PMD_SHIFT 20
63# define PUD_SHIFT 20
64# define PGDIR_SHIFT 20
65#else /* __s390x__ */
66# define PMD_SHIFT 20
67# define PUD_SHIFT 31
68# define PGDIR_SHIFT 42
69#endif /* __s390x__ */
70
71#define PMD_SIZE (1UL << PMD_SHIFT)
72#define PMD_MASK (~(PMD_SIZE-1))
73#define PUD_SIZE (1UL << PUD_SHIFT)
74#define PUD_MASK (~(PUD_SIZE-1))
75#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
76#define PGDIR_MASK (~(PGDIR_SIZE-1))
77
78/*
79 * entries per page directory level: the S390 is two-level, so
80 * we don't really have any PMD directory physically.
81 * for S390 segment-table entries are combined to one PGD
82 * that leads to 1024 pte per pgd
83 */
84#define PTRS_PER_PTE 256
85#ifndef __s390x__
86#define PTRS_PER_PMD 1
87#define PTRS_PER_PUD 1
88#else /* __s390x__ */
89#define PTRS_PER_PMD 2048
90#define PTRS_PER_PUD 2048
91#endif /* __s390x__ */
92#define PTRS_PER_PGD 2048
93
94#define FIRST_USER_ADDRESS 0
95
96#define pte_ERROR(e) \
97 printk("%s:%d: bad pte %p.\n", __FILE__, __LINE__, (void *) pte_val(e))
98#define pmd_ERROR(e) \
99 printk("%s:%d: bad pmd %p.\n", __FILE__, __LINE__, (void *) pmd_val(e))
100#define pud_ERROR(e) \
101 printk("%s:%d: bad pud %p.\n", __FILE__, __LINE__, (void *) pud_val(e))
102#define pgd_ERROR(e) \
103 printk("%s:%d: bad pgd %p.\n", __FILE__, __LINE__, (void *) pgd_val(e))
104
105#ifndef __ASSEMBLY__
106/*
107 * The vmalloc area will always be on the topmost area of the kernel
108 * mapping. We reserve 96MB (31bit) / 1GB (64bit) for vmalloc,
109 * which should be enough for any sane case.
110 * By putting vmalloc at the top, we maximise the gap between physical
111 * memory and vmalloc to catch misplaced memory accesses. As a side
112 * effect, this also makes sure that 64 bit module code cannot be used
113 * as system call address.
114 */
115#ifndef __s390x__
116#define VMALLOC_START 0x78000000UL
117#define VMALLOC_END 0x7e000000UL
118#define VMEM_MAP_END 0x80000000UL
119#else /* __s390x__ */
120#define VMALLOC_START 0x3e000000000UL
121#define VMALLOC_END 0x3e040000000UL
122#define VMEM_MAP_END 0x40000000000UL
123#endif /* __s390x__ */
124
125/*
126 * VMEM_MAX_PHYS is the highest physical address that can be added to the 1:1
127 * mapping. This needs to be calculated at compile time since the size of the
128 * VMEM_MAP is static but the size of struct page can change.
129 */
130#define VMEM_MAX_PAGES ((VMEM_MAP_END - VMALLOC_END) / sizeof(struct page))
131#define VMEM_MAX_PFN min(VMALLOC_START >> PAGE_SHIFT, VMEM_MAX_PAGES)
132#define VMEM_MAX_PHYS ((VMEM_MAX_PFN << PAGE_SHIFT) & ~((16 << 20) - 1))
133#define vmemmap ((struct page *) VMALLOC_END)
134
135/*
136 * A 31 bit pagetable entry of S390 has following format:
137 * | PFRA | | OS |
138 * 0 0IP0
139 * 00000000001111111111222222222233
140 * 01234567890123456789012345678901
141 *
142 * I Page-Invalid Bit: Page is not available for address-translation
143 * P Page-Protection Bit: Store access not possible for page
144 *
145 * A 31 bit segmenttable entry of S390 has following format:
146 * | P-table origin | |PTL
147 * 0 IC
148 * 00000000001111111111222222222233
149 * 01234567890123456789012345678901
150 *
151 * I Segment-Invalid Bit: Segment is not available for address-translation
152 * C Common-Segment Bit: Segment is not private (PoP 3-30)
153 * PTL Page-Table-Length: Page-table length (PTL+1*16 entries -> up to 256)
154 *
155 * The 31 bit segmenttable origin of S390 has following format:
156 *
157 * |S-table origin | | STL |
158 * X **GPS
159 * 00000000001111111111222222222233
160 * 01234567890123456789012345678901
161 *
162 * X Space-Switch event:
163 * G Segment-Invalid Bit: *
164 * P Private-Space Bit: Segment is not private (PoP 3-30)
165 * S Storage-Alteration:
166 * STL Segment-Table-Length: Segment-table length (STL+1*16 entries -> up to 2048)
167 *
168 * A 64 bit pagetable entry of S390 has following format:
169 * | PFRA |0IP0| OS |
170 * 0000000000111111111122222222223333333333444444444455555555556666
171 * 0123456789012345678901234567890123456789012345678901234567890123
172 *
173 * I Page-Invalid Bit: Page is not available for address-translation
174 * P Page-Protection Bit: Store access not possible for page
175 *
176 * A 64 bit segmenttable entry of S390 has following format:
177 * | P-table origin | TT
178 * 0000000000111111111122222222223333333333444444444455555555556666
179 * 0123456789012345678901234567890123456789012345678901234567890123
180 *
181 * I Segment-Invalid Bit: Segment is not available for address-translation
182 * C Common-Segment Bit: Segment is not private (PoP 3-30)
183 * P Page-Protection Bit: Store access not possible for page
184 * TT Type 00
185 *
186 * A 64 bit region table entry of S390 has following format:
187 * | S-table origin | TF TTTL
188 * 0000000000111111111122222222223333333333444444444455555555556666
189 * 0123456789012345678901234567890123456789012345678901234567890123
190 *
191 * I Segment-Invalid Bit: Segment is not available for address-translation
192 * TT Type 01
193 * TF
194 * TL Table length
195 *
196 * The 64 bit regiontable origin of S390 has following format:
197 * | region table origon | DTTL
198 * 0000000000111111111122222222223333333333444444444455555555556666
199 * 0123456789012345678901234567890123456789012345678901234567890123
200 *
201 * X Space-Switch event:
202 * G Segment-Invalid Bit:
203 * P Private-Space Bit:
204 * S Storage-Alteration:
205 * R Real space
206 * TL Table-Length:
207 *
208 * A storage key has the following format:
209 * | ACC |F|R|C|0|
210 * 0 3 4 5 6 7
211 * ACC: access key
212 * F : fetch protection bit
213 * R : referenced bit
214 * C : changed bit
215 */
216
217/* Hardware bits in the page table entry */
218#define _PAGE_RO 0x200 /* HW read-only bit */
219#define _PAGE_INVALID 0x400 /* HW invalid bit */
220
221/* Software bits in the page table entry */
222#define _PAGE_SWT 0x001 /* SW pte type bit t */
223#define _PAGE_SWX 0x002 /* SW pte type bit x */
224#define _PAGE_SPECIAL 0x004 /* SW associated with special page */
225#define __HAVE_ARCH_PTE_SPECIAL
226
227/* Set of bits not changed in pte_modify */
228#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_SPECIAL)
229
230/* Six different types of pages. */
231#define _PAGE_TYPE_EMPTY 0x400
232#define _PAGE_TYPE_NONE 0x401
233#define _PAGE_TYPE_SWAP 0x403
234#define _PAGE_TYPE_FILE 0x601 /* bit 0x002 is used for offset !! */
235#define _PAGE_TYPE_RO 0x200
236#define _PAGE_TYPE_RW 0x000
237#define _PAGE_TYPE_EX_RO 0x202
238#define _PAGE_TYPE_EX_RW 0x002
239
240/*
241 * Only four types for huge pages, using the invalid bit and protection bit
242 * of a segment table entry.
243 */
244#define _HPAGE_TYPE_EMPTY 0x020 /* _SEGMENT_ENTRY_INV */
245#define _HPAGE_TYPE_NONE 0x220
246#define _HPAGE_TYPE_RO 0x200 /* _SEGMENT_ENTRY_RO */
247#define _HPAGE_TYPE_RW 0x000
248
249/*
250 * PTE type bits are rather complicated. handle_pte_fault uses pte_present,
251 * pte_none and pte_file to find out the pte type WITHOUT holding the page
252 * table lock. ptep_clear_flush on the other hand uses ptep_clear_flush to
253 * invalidate a given pte. ipte sets the hw invalid bit and clears all tlbs
254 * for the page. The page table entry is set to _PAGE_TYPE_EMPTY afterwards.
255 * This change is done while holding the lock, but the intermediate step
256 * of a previously valid pte with the hw invalid bit set can be observed by
257 * handle_pte_fault. That makes it necessary that all valid pte types with
258 * the hw invalid bit set must be distinguishable from the four pte types
259 * empty, none, swap and file.
260 *
261 * irxt ipte irxt
262 * _PAGE_TYPE_EMPTY 1000 -> 1000
263 * _PAGE_TYPE_NONE 1001 -> 1001
264 * _PAGE_TYPE_SWAP 1011 -> 1011
265 * _PAGE_TYPE_FILE 11?1 -> 11?1
266 * _PAGE_TYPE_RO 0100 -> 1100
267 * _PAGE_TYPE_RW 0000 -> 1000
268 * _PAGE_TYPE_EX_RO 0110 -> 1110
269 * _PAGE_TYPE_EX_RW 0010 -> 1010
270 *
271 * pte_none is true for bits combinations 1000, 1010, 1100, 1110
272 * pte_present is true for bits combinations 0000, 0010, 0100, 0110, 1001
273 * pte_file is true for bits combinations 1101, 1111
274 * swap pte is 1011 and 0001, 0011, 0101, 0111 are invalid.
275 */
276
277/* Page status table bits for virtualization */
278#define RCP_PCL_BIT 55
279#define RCP_HR_BIT 54
280#define RCP_HC_BIT 53
281#define RCP_GR_BIT 50
282#define RCP_GC_BIT 49
283
284#ifndef __s390x__
285
286/* Bits in the segment table address-space-control-element */
287#define _ASCE_SPACE_SWITCH 0x80000000UL /* space switch event */
288#define _ASCE_ORIGIN_MASK 0x7ffff000UL /* segment table origin */
289#define _ASCE_PRIVATE_SPACE 0x100 /* private space control */
290#define _ASCE_ALT_EVENT 0x80 /* storage alteration event control */
291#define _ASCE_TABLE_LENGTH 0x7f /* 128 x 64 entries = 8k */
292
293/* Bits in the segment table entry */
294#define _SEGMENT_ENTRY_ORIGIN 0x7fffffc0UL /* page table origin */
295#define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */
296#define _SEGMENT_ENTRY_COMMON 0x10 /* common segment bit */
297#define _SEGMENT_ENTRY_PTL 0x0f /* page table length */
298
299#define _SEGMENT_ENTRY (_SEGMENT_ENTRY_PTL)
300#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV)
301
302#else /* __s390x__ */
303
304/* Bits in the segment/region table address-space-control-element */
305#define _ASCE_ORIGIN ~0xfffUL/* segment table origin */
306#define _ASCE_PRIVATE_SPACE 0x100 /* private space control */
307#define _ASCE_ALT_EVENT 0x80 /* storage alteration event control */
308#define _ASCE_SPACE_SWITCH 0x40 /* space switch event */
309#define _ASCE_REAL_SPACE 0x20 /* real space control */
310#define _ASCE_TYPE_MASK 0x0c /* asce table type mask */
311#define _ASCE_TYPE_REGION1 0x0c /* region first table type */
312#define _ASCE_TYPE_REGION2 0x08 /* region second table type */
313#define _ASCE_TYPE_REGION3 0x04 /* region third table type */
314#define _ASCE_TYPE_SEGMENT 0x00 /* segment table type */
315#define _ASCE_TABLE_LENGTH 0x03 /* region table length */
316
317/* Bits in the region table entry */
318#define _REGION_ENTRY_ORIGIN ~0xfffUL/* region/segment table origin */
319#define _REGION_ENTRY_INV 0x20 /* invalid region table entry */
320#define _REGION_ENTRY_TYPE_MASK 0x0c /* region/segment table type mask */
321#define _REGION_ENTRY_TYPE_R1 0x0c /* region first table type */
322#define _REGION_ENTRY_TYPE_R2 0x08 /* region second table type */
323#define _REGION_ENTRY_TYPE_R3 0x04 /* region third table type */
324#define _REGION_ENTRY_LENGTH 0x03 /* region third length */
325
326#define _REGION1_ENTRY (_REGION_ENTRY_TYPE_R1 | _REGION_ENTRY_LENGTH)
327#define _REGION1_ENTRY_EMPTY (_REGION_ENTRY_TYPE_R1 | _REGION_ENTRY_INV)
328#define _REGION2_ENTRY (_REGION_ENTRY_TYPE_R2 | _REGION_ENTRY_LENGTH)
329#define _REGION2_ENTRY_EMPTY (_REGION_ENTRY_TYPE_R2 | _REGION_ENTRY_INV)
330#define _REGION3_ENTRY (_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_LENGTH)
331#define _REGION3_ENTRY_EMPTY (_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INV)
332
333/* Bits in the segment table entry */
334#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */
335#define _SEGMENT_ENTRY_RO 0x200 /* page protection bit */
336#define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */
337
338#define _SEGMENT_ENTRY (0)
339#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV)
340
341#define _SEGMENT_ENTRY_LARGE 0x400 /* STE-format control, large page */
342#define _SEGMENT_ENTRY_CO 0x100 /* change-recording override */
343
344#endif /* __s390x__ */
345
346/*
347 * A user page table pointer has the space-switch-event bit, the
348 * private-space-control bit and the storage-alteration-event-control
349 * bit set. A kernel page table pointer doesn't need them.
350 */
351#define _ASCE_USER_BITS (_ASCE_SPACE_SWITCH | _ASCE_PRIVATE_SPACE | \
352 _ASCE_ALT_EVENT)
353
354/* Bits int the storage key */
355#define _PAGE_CHANGED 0x02 /* HW changed bit */
356#define _PAGE_REFERENCED 0x04 /* HW referenced bit */
357
358/*
359 * Page protection definitions.
360 */
361#define PAGE_NONE __pgprot(_PAGE_TYPE_NONE)
362#define PAGE_RO __pgprot(_PAGE_TYPE_RO)
363#define PAGE_RW __pgprot(_PAGE_TYPE_RW)
364#define PAGE_EX_RO __pgprot(_PAGE_TYPE_EX_RO)
365#define PAGE_EX_RW __pgprot(_PAGE_TYPE_EX_RW)
366
367#define PAGE_KERNEL PAGE_RW
368#define PAGE_COPY PAGE_RO
369
370/*
371 * Dependent on the EXEC_PROTECT option s390 can do execute protection.
372 * Write permission always implies read permission. In theory with a
373 * primary/secondary page table execute only can be implemented but
374 * it would cost an additional bit in the pte to distinguish all the
375 * different pte types. To avoid that execute permission currently
376 * implies read permission as well.
377 */
378 /*xwr*/
379#define __P000 PAGE_NONE
380#define __P001 PAGE_RO
381#define __P010 PAGE_RO
382#define __P011 PAGE_RO
383#define __P100 PAGE_EX_RO
384#define __P101 PAGE_EX_RO
385#define __P110 PAGE_EX_RO
386#define __P111 PAGE_EX_RO
387
388#define __S000 PAGE_NONE
389#define __S001 PAGE_RO
390#define __S010 PAGE_RW
391#define __S011 PAGE_RW
392#define __S100 PAGE_EX_RO
393#define __S101 PAGE_EX_RO
394#define __S110 PAGE_EX_RW
395#define __S111 PAGE_EX_RW
396
397#ifndef __s390x__
398# define PxD_SHADOW_SHIFT 1
399#else /* __s390x__ */
400# define PxD_SHADOW_SHIFT 2
401#endif /* __s390x__ */
402
403static inline void *get_shadow_table(void *table)
404{
405 unsigned long addr, offset;
406 struct page *page;
407
408 addr = (unsigned long) table;
409 offset = addr & ((PAGE_SIZE << PxD_SHADOW_SHIFT) - 1);
410 page = virt_to_page((void *)(addr ^ offset));
411 return (void *)(addr_t)(page->index ? (page->index | offset) : 0UL);
412}
413
414/*
415 * Certain architectures need to do special things when PTEs
416 * within a page table are directly modified. Thus, the following
417 * hook is made available.
418 */
419static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
420 pte_t *ptep, pte_t entry)
421{
422 *ptep = entry;
423 if (mm->context.noexec) {
424 if (!(pte_val(entry) & _PAGE_INVALID) &&
425 (pte_val(entry) & _PAGE_SWX))
426 pte_val(entry) |= _PAGE_RO;
427 else
428 pte_val(entry) = _PAGE_TYPE_EMPTY;
429 ptep[PTRS_PER_PTE] = entry;
430 }
431}
432
433/*
434 * pgd/pmd/pte query functions
435 */
436#ifndef __s390x__
437
438static inline int pgd_present(pgd_t pgd) { return 1; }
439static inline int pgd_none(pgd_t pgd) { return 0; }
440static inline int pgd_bad(pgd_t pgd) { return 0; }
441
442static inline int pud_present(pud_t pud) { return 1; }
443static inline int pud_none(pud_t pud) { return 0; }
444static inline int pud_bad(pud_t pud) { return 0; }
445
446#else /* __s390x__ */
447
448static inline int pgd_present(pgd_t pgd)
449{
450 if ((pgd_val(pgd) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R2)
451 return 1;
452 return (pgd_val(pgd) & _REGION_ENTRY_ORIGIN) != 0UL;
453}
454
455static inline int pgd_none(pgd_t pgd)
456{
457 if ((pgd_val(pgd) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R2)
458 return 0;
459 return (pgd_val(pgd) & _REGION_ENTRY_INV) != 0UL;
460}
461
462static inline int pgd_bad(pgd_t pgd)
463{
464 /*
465 * With dynamic page table levels the pgd can be a region table
466 * entry or a segment table entry. Check for the bit that are
467 * invalid for either table entry.
468 */
469 unsigned long mask =
470 ~_SEGMENT_ENTRY_ORIGIN & ~_REGION_ENTRY_INV &
471 ~_REGION_ENTRY_TYPE_MASK & ~_REGION_ENTRY_LENGTH;
472 return (pgd_val(pgd) & mask) != 0;
473}
474
475static inline int pud_present(pud_t pud)
476{
477 if ((pud_val(pud) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R3)
478 return 1;
479 return (pud_val(pud) & _REGION_ENTRY_ORIGIN) != 0UL;
480}
481
482static inline int pud_none(pud_t pud)
483{
484 if ((pud_val(pud) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R3)
485 return 0;
486 return (pud_val(pud) & _REGION_ENTRY_INV) != 0UL;
487}
488
489static inline int pud_bad(pud_t pud)
490{
491 /*
492 * With dynamic page table levels the pud can be a region table
493 * entry or a segment table entry. Check for the bit that are
494 * invalid for either table entry.
495 */
496 unsigned long mask =
497 ~_SEGMENT_ENTRY_ORIGIN & ~_REGION_ENTRY_INV &
498 ~_REGION_ENTRY_TYPE_MASK & ~_REGION_ENTRY_LENGTH;
499 return (pud_val(pud) & mask) != 0;
500}
501
502#endif /* __s390x__ */
503
504static inline int pmd_present(pmd_t pmd)
505{
506 return (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN) != 0UL;
507}
508
509static inline int pmd_none(pmd_t pmd)
510{
511 return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) != 0UL;
512}
513
514static inline int pmd_bad(pmd_t pmd)
515{
516 unsigned long mask = ~_SEGMENT_ENTRY_ORIGIN & ~_SEGMENT_ENTRY_INV;
517 return (pmd_val(pmd) & mask) != _SEGMENT_ENTRY;
518}
519
520static inline int pte_none(pte_t pte)
521{
522 return (pte_val(pte) & _PAGE_INVALID) && !(pte_val(pte) & _PAGE_SWT);
523}
524
525static inline int pte_present(pte_t pte)
526{
527 unsigned long mask = _PAGE_RO | _PAGE_INVALID | _PAGE_SWT | _PAGE_SWX;
528 return (pte_val(pte) & mask) == _PAGE_TYPE_NONE ||
529 (!(pte_val(pte) & _PAGE_INVALID) &&
530 !(pte_val(pte) & _PAGE_SWT));
531}
532
533static inline int pte_file(pte_t pte)
534{
535 unsigned long mask = _PAGE_RO | _PAGE_INVALID | _PAGE_SWT;
536 return (pte_val(pte) & mask) == _PAGE_TYPE_FILE;
537}
538
539static inline int pte_special(pte_t pte)
540{
541 return (pte_val(pte) & _PAGE_SPECIAL);
542}
543
544#define __HAVE_ARCH_PTE_SAME
545#define pte_same(a,b) (pte_val(a) == pte_val(b))
546
547static inline void rcp_lock(pte_t *ptep)
548{
549#ifdef CONFIG_PGSTE
550 unsigned long *pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
551 preempt_disable();
552 while (test_and_set_bit(RCP_PCL_BIT, pgste))
553 ;
554#endif
555}
556
557static inline void rcp_unlock(pte_t *ptep)
558{
559#ifdef CONFIG_PGSTE
560 unsigned long *pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
561 clear_bit(RCP_PCL_BIT, pgste);
562 preempt_enable();
563#endif
564}
565
566/* forward declaration for SetPageUptodate in page-flags.h*/
567static inline void page_clear_dirty(struct page *page);
568#include <linux/page-flags.h>
569
570static inline void ptep_rcp_copy(pte_t *ptep)
571{
572#ifdef CONFIG_PGSTE
573 struct page *page = virt_to_page(pte_val(*ptep));
574 unsigned int skey;
575 unsigned long *pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
576
577 skey = page_get_storage_key(page_to_phys(page));
578 if (skey & _PAGE_CHANGED)
579 set_bit_simple(RCP_GC_BIT, pgste);
580 if (skey & _PAGE_REFERENCED)
581 set_bit_simple(RCP_GR_BIT, pgste);
582 if (test_and_clear_bit_simple(RCP_HC_BIT, pgste))
583 SetPageDirty(page);
584 if (test_and_clear_bit_simple(RCP_HR_BIT, pgste))
585 SetPageReferenced(page);
586#endif
587}
588
589/*
590 * query functions pte_write/pte_dirty/pte_young only work if
591 * pte_present() is true. Undefined behaviour if not..
592 */
593static inline int pte_write(pte_t pte)
594{
595 return (pte_val(pte) & _PAGE_RO) == 0;
596}
597
598static inline int pte_dirty(pte_t pte)
599{
600 /* A pte is neither clean nor dirty on s/390. The dirty bit
601 * is in the storage key. See page_test_and_clear_dirty for
602 * details.
603 */
604 return 0;
605}
606
607static inline int pte_young(pte_t pte)
608{
609 /* A pte is neither young nor old on s/390. The young bit
610 * is in the storage key. See page_test_and_clear_young for
611 * details.
612 */
613 return 0;
614}
615
616/*
617 * pgd/pmd/pte modification functions
618 */
619
620#ifndef __s390x__
621
622#define pgd_clear(pgd) do { } while (0)
623#define pud_clear(pud) do { } while (0)
624
625#else /* __s390x__ */
626
627static inline void pgd_clear_kernel(pgd_t * pgd)
628{
629 if ((pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R2)
630 pgd_val(*pgd) = _REGION2_ENTRY_EMPTY;
631}
632
633static inline void pgd_clear(pgd_t * pgd)
634{
635 pgd_t *shadow = get_shadow_table(pgd);
636
637 pgd_clear_kernel(pgd);
638 if (shadow)
639 pgd_clear_kernel(shadow);
640}
641
642static inline void pud_clear_kernel(pud_t *pud)
643{
644 if ((pud_val(*pud) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3)
645 pud_val(*pud) = _REGION3_ENTRY_EMPTY;
646}
647
648static inline void pud_clear(pud_t *pud)
649{
650 pud_t *shadow = get_shadow_table(pud);
651
652 pud_clear_kernel(pud);
653 if (shadow)
654 pud_clear_kernel(shadow);
655}
656
657#endif /* __s390x__ */
658
659static inline void pmd_clear_kernel(pmd_t * pmdp)
660{
661 pmd_val(*pmdp) = _SEGMENT_ENTRY_EMPTY;
662}
663
664static inline void pmd_clear(pmd_t *pmd)
665{
666 pmd_t *shadow = get_shadow_table(pmd);
667
668 pmd_clear_kernel(pmd);
669 if (shadow)
670 pmd_clear_kernel(shadow);
671}
672
673static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
674{
675 if (mm->context.pgstes)
676 ptep_rcp_copy(ptep);
677 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
678 if (mm->context.noexec)
679 pte_val(ptep[PTRS_PER_PTE]) = _PAGE_TYPE_EMPTY;
680}
681
682/*
683 * The following pte modification functions only work if
684 * pte_present() is true. Undefined behaviour if not..
685 */
686static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
687{
688 pte_val(pte) &= _PAGE_CHG_MASK;
689 pte_val(pte) |= pgprot_val(newprot);
690 return pte;
691}
692
693static inline pte_t pte_wrprotect(pte_t pte)
694{
695 /* Do not clobber _PAGE_TYPE_NONE pages! */
696 if (!(pte_val(pte) & _PAGE_INVALID))
697 pte_val(pte) |= _PAGE_RO;
698 return pte;
699}
700
701static inline pte_t pte_mkwrite(pte_t pte)
702{
703 pte_val(pte) &= ~_PAGE_RO;
704 return pte;
705}
706
707static inline pte_t pte_mkclean(pte_t pte)
708{
709 /* The only user of pte_mkclean is the fork() code.
710 We must *not* clear the *physical* page dirty bit
711 just because fork() wants to clear the dirty bit in
712 *one* of the page's mappings. So we just do nothing. */
713 return pte;
714}
715
716static inline pte_t pte_mkdirty(pte_t pte)
717{
718 /* We do not explicitly set the dirty bit because the
719 * sske instruction is slow. It is faster to let the
720 * next instruction set the dirty bit.
721 */
722 return pte;
723}
724
725static inline pte_t pte_mkold(pte_t pte)
726{
727 /* S/390 doesn't keep its dirty/referenced bit in the pte.
728 * There is no point in clearing the real referenced bit.
729 */
730 return pte;
731}
732
733static inline pte_t pte_mkyoung(pte_t pte)
734{
735 /* S/390 doesn't keep its dirty/referenced bit in the pte.
736 * There is no point in setting the real referenced bit.
737 */
738 return pte;
739}
740
741static inline pte_t pte_mkspecial(pte_t pte)
742{
743 pte_val(pte) |= _PAGE_SPECIAL;
744 return pte;
745}
746
747#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
748static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
749 unsigned long addr, pte_t *ptep)
750{
751#ifdef CONFIG_PGSTE
752 unsigned long physpage;
753 int young;
754 unsigned long *pgste;
755
756 if (!vma->vm_mm->context.pgstes)
757 return 0;
758 physpage = pte_val(*ptep) & PAGE_MASK;
759 pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
760
761 young = ((page_get_storage_key(physpage) & _PAGE_REFERENCED) != 0);
762 rcp_lock(ptep);
763 if (young)
764 set_bit_simple(RCP_GR_BIT, pgste);
765 young |= test_and_clear_bit_simple(RCP_HR_BIT, pgste);
766 rcp_unlock(ptep);
767 return young;
768#endif
769 return 0;
770}
771
772#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
773static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
774 unsigned long address, pte_t *ptep)
775{
776 /* No need to flush TLB
777 * On s390 reference bits are in storage key and never in TLB
778 * With virtualization we handle the reference bit, without we
779 * we can simply return */
780#ifdef CONFIG_PGSTE
781 return ptep_test_and_clear_young(vma, address, ptep);
782#endif
783 return 0;
784}
785
786static inline void __ptep_ipte(unsigned long address, pte_t *ptep)
787{
788 if (!(pte_val(*ptep) & _PAGE_INVALID)) {
789#ifndef __s390x__
790 /* pto must point to the start of the segment table */
791 pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00);
792#else
793 /* ipte in zarch mode can do the math */
794 pte_t *pto = ptep;
795#endif
796 asm volatile(
797 " ipte %2,%3"
798 : "=m" (*ptep) : "m" (*ptep),
799 "a" (pto), "a" (address));
800 }
801}
802
803static inline void ptep_invalidate(struct mm_struct *mm,
804 unsigned long address, pte_t *ptep)
805{
806 if (mm->context.pgstes) {
807 rcp_lock(ptep);
808 __ptep_ipte(address, ptep);
809 ptep_rcp_copy(ptep);
810 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
811 rcp_unlock(ptep);
812 return;
813 }
814 __ptep_ipte(address, ptep);
815 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
816 if (mm->context.noexec) {
817 __ptep_ipte(address, ptep + PTRS_PER_PTE);
818 pte_val(*(ptep + PTRS_PER_PTE)) = _PAGE_TYPE_EMPTY;
819 }
820}
821
822/*
823 * This is hard to understand. ptep_get_and_clear and ptep_clear_flush
824 * both clear the TLB for the unmapped pte. The reason is that
825 * ptep_get_and_clear is used in common code (e.g. change_pte_range)
826 * to modify an active pte. The sequence is
827 * 1) ptep_get_and_clear
828 * 2) set_pte_at
829 * 3) flush_tlb_range
830 * On s390 the tlb needs to get flushed with the modification of the pte
831 * if the pte is active. The only way how this can be implemented is to
832 * have ptep_get_and_clear do the tlb flush. In exchange flush_tlb_range
833 * is a nop.
834 */
835#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
836#define ptep_get_and_clear(__mm, __address, __ptep) \
837({ \
838 pte_t __pte = *(__ptep); \
839 if (atomic_read(&(__mm)->mm_users) > 1 || \
840 (__mm) != current->active_mm) \
841 ptep_invalidate(__mm, __address, __ptep); \
842 else \
843 pte_clear((__mm), (__address), (__ptep)); \
844 __pte; \
845})
846
847#define __HAVE_ARCH_PTEP_CLEAR_FLUSH
848static inline pte_t ptep_clear_flush(struct vm_area_struct *vma,
849 unsigned long address, pte_t *ptep)
850{
851 pte_t pte = *ptep;
852 ptep_invalidate(vma->vm_mm, address, ptep);
853 return pte;
854}
855
856/*
857 * The batched pte unmap code uses ptep_get_and_clear_full to clear the
858 * ptes. Here an optimization is possible. tlb_gather_mmu flushes all
859 * tlbs of an mm if it can guarantee that the ptes of the mm_struct
860 * cannot be accessed while the batched unmap is running. In this case
861 * full==1 and a simple pte_clear is enough. See tlb.h.
862 */
863#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
864static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
865 unsigned long addr,
866 pte_t *ptep, int full)
867{
868 pte_t pte = *ptep;
869
870 if (full)
871 pte_clear(mm, addr, ptep);
872 else
873 ptep_invalidate(mm, addr, ptep);
874 return pte;
875}
876
877#define __HAVE_ARCH_PTEP_SET_WRPROTECT
878#define ptep_set_wrprotect(__mm, __addr, __ptep) \
879({ \
880 pte_t __pte = *(__ptep); \
881 if (pte_write(__pte)) { \
882 if (atomic_read(&(__mm)->mm_users) > 1 || \
883 (__mm) != current->active_mm) \
884 ptep_invalidate(__mm, __addr, __ptep); \
885 set_pte_at(__mm, __addr, __ptep, pte_wrprotect(__pte)); \
886 } \
887})
888
889#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
890#define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty) \
891({ \
892 int __changed = !pte_same(*(__ptep), __entry); \
893 if (__changed) { \
894 ptep_invalidate((__vma)->vm_mm, __addr, __ptep); \
895 set_pte_at((__vma)->vm_mm, __addr, __ptep, __entry); \
896 } \
897 __changed; \
898})
899
900/*
901 * Test and clear dirty bit in storage key.
902 * We can't clear the changed bit atomically. This is a potential
903 * race against modification of the referenced bit. This function
904 * should therefore only be called if it is not mapped in any
905 * address space.
906 */
907#define __HAVE_ARCH_PAGE_TEST_DIRTY
908static inline int page_test_dirty(struct page *page)
909{
910 return (page_get_storage_key(page_to_phys(page)) & _PAGE_CHANGED) != 0;
911}
912
913#define __HAVE_ARCH_PAGE_CLEAR_DIRTY
914static inline void page_clear_dirty(struct page *page)
915{
916 page_set_storage_key(page_to_phys(page), PAGE_DEFAULT_KEY);
917}
918
919/*
920 * Test and clear referenced bit in storage key.
921 */
922#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
923static inline int page_test_and_clear_young(struct page *page)
924{
925 unsigned long physpage = page_to_phys(page);
926 int ccode;
927
928 asm volatile(
929 " rrbe 0,%1\n"
930 " ipm %0\n"
931 " srl %0,28\n"
932 : "=d" (ccode) : "a" (physpage) : "cc" );
933 return ccode & 2;
934}
935
936/*
937 * Conversion functions: convert a page and protection to a page entry,
938 * and a page entry and page directory to the page they refer to.
939 */
940static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
941{
942 pte_t __pte;
943 pte_val(__pte) = physpage + pgprot_val(pgprot);
944 return __pte;
945}
946
947static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
948{
949 unsigned long physpage = page_to_phys(page);
950
951 return mk_pte_phys(physpage, pgprot);
952}
953
954#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
955#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
956#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
957#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))
958
959#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
960#define pgd_offset_k(address) pgd_offset(&init_mm, address)
961
962#ifndef __s390x__
963
964#define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN)
965#define pud_deref(pmd) ({ BUG(); 0UL; })
966#define pgd_deref(pmd) ({ BUG(); 0UL; })
967
968#define pud_offset(pgd, address) ((pud_t *) pgd)
969#define pmd_offset(pud, address) ((pmd_t *) pud + pmd_index(address))
970
971#else /* __s390x__ */
972
973#define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN)
974#define pud_deref(pud) (pud_val(pud) & _REGION_ENTRY_ORIGIN)
975#define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN)
976
977static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
978{
979 pud_t *pud = (pud_t *) pgd;
980 if ((pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R2)
981 pud = (pud_t *) pgd_deref(*pgd);
982 return pud + pud_index(address);
983}
984
985static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
986{
987 pmd_t *pmd = (pmd_t *) pud;
988 if ((pud_val(*pud) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3)
989 pmd = (pmd_t *) pud_deref(*pud);
990 return pmd + pmd_index(address);
991}
992
993#endif /* __s390x__ */
994
995#define pfn_pte(pfn,pgprot) mk_pte_phys(__pa((pfn) << PAGE_SHIFT),(pgprot))
996#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
997#define pte_page(x) pfn_to_page(pte_pfn(x))
998
999#define pmd_page(pmd) pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)
1000
1001/* Find an entry in the lowest level page table.. */
1002#define pte_offset(pmd, addr) ((pte_t *) pmd_deref(*(pmd)) + pte_index(addr))
1003#define pte_offset_kernel(pmd, address) pte_offset(pmd,address)
1004#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
1005#define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address)
1006#define pte_unmap(pte) do { } while (0)
1007#define pte_unmap_nested(pte) do { } while (0)
1008
1009/*
1010 * 31 bit swap entry format:
1011 * A page-table entry has some bits we have to treat in a special way.
1012 * Bits 0, 20 and bit 23 have to be zero, otherwise an specification
1013 * exception will occur instead of a page translation exception. The
1014 * specifiation exception has the bad habit not to store necessary
1015 * information in the lowcore.
1016 * Bit 21 and bit 22 are the page invalid bit and the page protection
1017 * bit. We set both to indicate a swapped page.
1018 * Bit 30 and 31 are used to distinguish the different page types. For
1019 * a swapped page these bits need to be zero.
1020 * This leaves the bits 1-19 and bits 24-29 to store type and offset.
1021 * We use the 5 bits from 25-29 for the type and the 20 bits from 1-19
1022 * plus 24 for the offset.
1023 * 0| offset |0110|o|type |00|
1024 * 0 0000000001111111111 2222 2 22222 33
1025 * 0 1234567890123456789 0123 4 56789 01
1026 *
1027 * 64 bit swap entry format:
1028 * A page-table entry has some bits we have to treat in a special way.
1029 * Bits 52 and bit 55 have to be zero, otherwise an specification
1030 * exception will occur instead of a page translation exception. The
1031 * specifiation exception has the bad habit not to store necessary
1032 * information in the lowcore.
1033 * Bit 53 and bit 54 are the page invalid bit and the page protection
1034 * bit. We set both to indicate a swapped page.
1035 * Bit 62 and 63 are used to distinguish the different page types. For
1036 * a swapped page these bits need to be zero.
1037 * This leaves the bits 0-51 and bits 56-61 to store type and offset.
1038 * We use the 5 bits from 57-61 for the type and the 53 bits from 0-51
1039 * plus 56 for the offset.
1040 * | offset |0110|o|type |00|
1041 * 0000000000111111111122222222223333333333444444444455 5555 5 55566 66
1042 * 0123456789012345678901234567890123456789012345678901 2345 6 78901 23
1043 */
1044#ifndef __s390x__
1045#define __SWP_OFFSET_MASK (~0UL >> 12)
1046#else
1047#define __SWP_OFFSET_MASK (~0UL >> 11)
1048#endif
1049static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
1050{
1051 pte_t pte;
1052 offset &= __SWP_OFFSET_MASK;
1053 pte_val(pte) = _PAGE_TYPE_SWAP | ((type & 0x1f) << 2) |
1054 ((offset & 1UL) << 7) | ((offset & ~1UL) << 11);
1055 return pte;
1056}
1057
1058#define __swp_type(entry) (((entry).val >> 2) & 0x1f)
1059#define __swp_offset(entry) (((entry).val >> 11) | (((entry).val >> 7) & 1))
1060#define __swp_entry(type,offset) ((swp_entry_t) { pte_val(mk_swap_pte((type),(offset))) })
1061
1062#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
1063#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
1064
1065#ifndef __s390x__
1066# define PTE_FILE_MAX_BITS 26
1067#else /* __s390x__ */
1068# define PTE_FILE_MAX_BITS 59
1069#endif /* __s390x__ */
1070
1071#define pte_to_pgoff(__pte) \
1072 ((((__pte).pte >> 12) << 7) + (((__pte).pte >> 1) & 0x7f))
1073
1074#define pgoff_to_pte(__off) \
1075 ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \
1076 | _PAGE_TYPE_FILE })
1077
1078#endif /* !__ASSEMBLY__ */
1079
1080#define kern_addr_valid(addr) (1)
1081
1082extern int vmem_add_mapping(unsigned long start, unsigned long size);
1083extern int vmem_remove_mapping(unsigned long start, unsigned long size);
1084extern int s390_enable_sie(void);
1085
1086/*
1087 * No page table caches to initialise
1088 */
1089#define pgtable_cache_init() do { } while (0)
1090
1091#include <asm-generic/pgtable.h>
1092
1093#endif /* _S390_PAGE_H */
diff --git a/arch/s390/include/asm/poll.h b/arch/s390/include/asm/poll.h
new file mode 100644
index 000000000000..c98509d3149e
--- /dev/null
+++ b/arch/s390/include/asm/poll.h
@@ -0,0 +1 @@
#include <asm-generic/poll.h>
diff --git a/arch/s390/include/asm/posix_types.h b/arch/s390/include/asm/posix_types.h
new file mode 100644
index 000000000000..397d93fba3a7
--- /dev/null
+++ b/arch/s390/include/asm/posix_types.h
@@ -0,0 +1,111 @@
1/*
2 * include/asm-s390/posix_types.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/posix_types.h"
7 */
8
9#ifndef __ARCH_S390_POSIX_TYPES_H
10#define __ARCH_S390_POSIX_TYPES_H
11
12/*
13 * This file is generally used by user-level software, so you need to
14 * be a little careful about namespace pollution etc. Also, we cannot
15 * assume GCC is being used.
16 */
17
18typedef long __kernel_off_t;
19typedef int __kernel_pid_t;
20typedef unsigned long __kernel_size_t;
21typedef long __kernel_time_t;
22typedef long __kernel_suseconds_t;
23typedef long __kernel_clock_t;
24typedef int __kernel_timer_t;
25typedef int __kernel_clockid_t;
26typedef int __kernel_daddr_t;
27typedef char * __kernel_caddr_t;
28typedef unsigned short __kernel_uid16_t;
29typedef unsigned short __kernel_gid16_t;
30
31#ifdef __GNUC__
32typedef long long __kernel_loff_t;
33#endif
34
35#ifndef __s390x__
36
37typedef unsigned long __kernel_ino_t;
38typedef unsigned short __kernel_mode_t;
39typedef unsigned short __kernel_nlink_t;
40typedef unsigned short __kernel_ipc_pid_t;
41typedef unsigned short __kernel_uid_t;
42typedef unsigned short __kernel_gid_t;
43typedef int __kernel_ssize_t;
44typedef int __kernel_ptrdiff_t;
45typedef unsigned int __kernel_uid32_t;
46typedef unsigned int __kernel_gid32_t;
47typedef unsigned short __kernel_old_uid_t;
48typedef unsigned short __kernel_old_gid_t;
49typedef unsigned short __kernel_old_dev_t;
50
51#else /* __s390x__ */
52
53typedef unsigned int __kernel_ino_t;
54typedef unsigned int __kernel_mode_t;
55typedef unsigned int __kernel_nlink_t;
56typedef int __kernel_ipc_pid_t;
57typedef unsigned int __kernel_uid_t;
58typedef unsigned int __kernel_gid_t;
59typedef long __kernel_ssize_t;
60typedef long __kernel_ptrdiff_t;
61typedef unsigned long __kernel_sigset_t; /* at least 32 bits */
62typedef __kernel_uid_t __kernel_old_uid_t;
63typedef __kernel_gid_t __kernel_old_gid_t;
64typedef __kernel_uid_t __kernel_uid32_t;
65typedef __kernel_gid_t __kernel_gid32_t;
66typedef unsigned short __kernel_old_dev_t;
67
68#endif /* __s390x__ */
69
70typedef struct {
71#if defined(__KERNEL__) || defined(__USE_ALL)
72 int val[2];
73#else /* !defined(__KERNEL__) && !defined(__USE_ALL)*/
74 int __val[2];
75#endif /* !defined(__KERNEL__) && !defined(__USE_ALL)*/
76} __kernel_fsid_t;
77
78
79#ifdef __KERNEL__
80
81#undef __FD_SET
82static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
83{
84 unsigned long _tmp = fd / __NFDBITS;
85 unsigned long _rem = fd % __NFDBITS;
86 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
87}
88
89#undef __FD_CLR
90static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
91{
92 unsigned long _tmp = fd / __NFDBITS;
93 unsigned long _rem = fd % __NFDBITS;
94 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
95}
96
97#undef __FD_ISSET
98static inline int __FD_ISSET(unsigned long fd, const __kernel_fd_set *fdsetp)
99{
100 unsigned long _tmp = fd / __NFDBITS;
101 unsigned long _rem = fd % __NFDBITS;
102 return (fdsetp->fds_bits[_tmp] & (1UL<<_rem)) != 0;
103}
104
105#undef __FD_ZERO
106#define __FD_ZERO(fdsetp) \
107 ((void) memset ((void *) (fdsetp), 0, sizeof (__kernel_fd_set)))
108
109#endif /* __KERNEL__ */
110
111#endif
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
new file mode 100644
index 000000000000..4af80af2a88f
--- /dev/null
+++ b/arch/s390/include/asm/processor.h
@@ -0,0 +1,360 @@
1/*
2 * include/asm-s390/processor.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Hartmut Penner (hp@de.ibm.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 *
9 * Derived from "include/asm-i386/processor.h"
10 * Copyright (C) 1994, Linus Torvalds
11 */
12
13#ifndef __ASM_S390_PROCESSOR_H
14#define __ASM_S390_PROCESSOR_H
15
16#include <asm/ptrace.h>
17
18#ifdef __KERNEL__
19/*
20 * Default implementation of macro that returns current
21 * instruction pointer ("program counter").
22 */
23#define current_text_addr() ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; })
24
25/*
26 * CPU type and hardware bug flags. Kept separately for each CPU.
27 * Members of this structure are referenced in head.S, so think twice
28 * before touching them. [mj]
29 */
30
31typedef struct
32{
33 unsigned int version : 8;
34 unsigned int ident : 24;
35 unsigned int machine : 16;
36 unsigned int unused : 16;
37} __attribute__ ((packed)) cpuid_t;
38
39static inline void get_cpu_id(cpuid_t *ptr)
40{
41 asm volatile("stidp 0(%1)" : "=m" (*ptr) : "a" (ptr));
42}
43
44struct cpuinfo_S390
45{
46 cpuid_t cpu_id;
47 __u16 cpu_addr;
48 __u16 cpu_nr;
49 unsigned long loops_per_jiffy;
50 unsigned long *pgd_quick;
51#ifdef __s390x__
52 unsigned long *pmd_quick;
53#endif /* __s390x__ */
54 unsigned long *pte_quick;
55 unsigned long pgtable_cache_sz;
56};
57
58extern void s390_adjust_jiffies(void);
59extern void print_cpu_info(struct cpuinfo_S390 *);
60extern int get_cpu_capability(unsigned int *);
61
62/*
63 * User space process size: 2GB for 31 bit, 4TB for 64 bit.
64 */
65#ifndef __s390x__
66
67#define TASK_SIZE (1UL << 31)
68#define TASK_UNMAPPED_BASE (1UL << 30)
69
70#else /* __s390x__ */
71
72#define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk,TIF_31BIT) ? \
73 (1UL << 31) : (1UL << 53))
74#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_31BIT) ? \
75 (1UL << 30) : (1UL << 41))
76#define TASK_SIZE TASK_SIZE_OF(current)
77
78#endif /* __s390x__ */
79
80#ifdef __KERNEL__
81
82#ifndef __s390x__
83#define STACK_TOP (1UL << 31)
84#define STACK_TOP_MAX (1UL << 31)
85#else /* __s390x__ */
86#define STACK_TOP (1UL << (test_thread_flag(TIF_31BIT) ? 31:42))
87#define STACK_TOP_MAX (1UL << 42)
88#endif /* __s390x__ */
89
90
91#endif
92
93#define HAVE_ARCH_PICK_MMAP_LAYOUT
94
95typedef struct {
96 __u32 ar4;
97} mm_segment_t;
98
99/*
100 * Thread structure
101 */
102struct thread_struct {
103 s390_fp_regs fp_regs;
104 unsigned int acrs[NUM_ACRS];
105 unsigned long ksp; /* kernel stack pointer */
106 mm_segment_t mm_segment;
107 unsigned long prot_addr; /* address of protection-excep. */
108 unsigned int trap_no;
109 per_struct per_info;
110 /* Used to give failing instruction back to user for ieee exceptions */
111 unsigned long ieee_instruction_pointer;
112 /* pfault_wait is used to block the process on a pfault event */
113 unsigned long pfault_wait;
114};
115
116typedef struct thread_struct thread_struct;
117
118/*
119 * Stack layout of a C stack frame.
120 */
121#ifndef __PACK_STACK
122struct stack_frame {
123 unsigned long back_chain;
124 unsigned long empty1[5];
125 unsigned long gprs[10];
126 unsigned int empty2[8];
127};
128#else
129struct stack_frame {
130 unsigned long empty1[5];
131 unsigned int empty2[8];
132 unsigned long gprs[10];
133 unsigned long back_chain;
134};
135#endif
136
137#define ARCH_MIN_TASKALIGN 8
138
139#define INIT_THREAD { \
140 .ksp = sizeof(init_stack) + (unsigned long) &init_stack, \
141}
142
143/*
144 * Do necessary setup to start up a new thread.
145 */
146#define start_thread(regs, new_psw, new_stackp) do { \
147 set_fs(USER_DS); \
148 regs->psw.mask = psw_user_bits; \
149 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \
150 regs->gprs[15] = new_stackp; \
151} while (0)
152
153#define start_thread31(regs, new_psw, new_stackp) do { \
154 set_fs(USER_DS); \
155 regs->psw.mask = psw_user32_bits; \
156 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \
157 regs->gprs[15] = new_stackp; \
158 crst_table_downgrade(current->mm, 1UL << 31); \
159} while (0)
160
161/* Forward declaration, a strange C thing */
162struct task_struct;
163struct mm_struct;
164struct seq_file;
165
166/* Free all resources held by a thread. */
167extern void release_thread(struct task_struct *);
168extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
169
170/* Prepare to copy thread state - unlazy all lazy status */
171#define prepare_to_copy(tsk) do { } while (0)
172
173/*
174 * Return saved PC of a blocked thread.
175 */
176extern unsigned long thread_saved_pc(struct task_struct *t);
177
178/*
179 * Print register of task into buffer. Used in fs/proc/array.c.
180 */
181extern void task_show_regs(struct seq_file *m, struct task_struct *task);
182
183extern void show_code(struct pt_regs *regs);
184
185unsigned long get_wchan(struct task_struct *p);
186#define task_pt_regs(tsk) ((struct pt_regs *) \
187 (task_stack_page(tsk) + THREAD_SIZE) - 1)
188#define KSTK_EIP(tsk) (task_pt_regs(tsk)->psw.addr)
189#define KSTK_ESP(tsk) (task_pt_regs(tsk)->gprs[15])
190
191/*
192 * Give up the time slice of the virtual PU.
193 */
194static inline void cpu_relax(void)
195{
196 if (MACHINE_HAS_DIAG44)
197 asm volatile("diag 0,0,68");
198 barrier();
199}
200
201static inline void psw_set_key(unsigned int key)
202{
203 asm volatile("spka 0(%0)" : : "d" (key));
204}
205
206/*
207 * Set PSW to specified value.
208 */
209static inline void __load_psw(psw_t psw)
210{
211#ifndef __s390x__
212 asm volatile("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc");
213#else
214 asm volatile("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc");
215#endif
216}
217
218/*
219 * Set PSW mask to specified value, while leaving the
220 * PSW addr pointing to the next instruction.
221 */
222
223static inline void __load_psw_mask (unsigned long mask)
224{
225 unsigned long addr;
226 psw_t psw;
227
228 psw.mask = mask;
229
230#ifndef __s390x__
231 asm volatile(
232 " basr %0,0\n"
233 "0: ahi %0,1f-0b\n"
234 " st %0,4(%1)\n"
235 " lpsw 0(%1)\n"
236 "1:"
237 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc");
238#else /* __s390x__ */
239 asm volatile(
240 " larl %0,1f\n"
241 " stg %0,8(%1)\n"
242 " lpswe 0(%1)\n"
243 "1:"
244 : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc");
245#endif /* __s390x__ */
246}
247
248/*
249 * Function to stop a processor until an interruption occurred
250 */
251static inline void enabled_wait(void)
252{
253 __load_psw_mask(PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT |
254 PSW_MASK_MCHECK | PSW_MASK_WAIT | PSW_DEFAULT_KEY);
255}
256
257/*
258 * Function to drop a processor into disabled wait state
259 */
260
261static inline void disabled_wait(unsigned long code)
262{
263 unsigned long ctl_buf;
264 psw_t dw_psw;
265
266 dw_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT;
267 dw_psw.addr = code;
268 /*
269 * Store status and then load disabled wait psw,
270 * the processor is dead afterwards
271 */
272#ifndef __s390x__
273 asm volatile(
274 " stctl 0,0,0(%2)\n"
275 " ni 0(%2),0xef\n" /* switch off protection */
276 " lctl 0,0,0(%2)\n"
277 " stpt 0xd8\n" /* store timer */
278 " stckc 0xe0\n" /* store clock comparator */
279 " stpx 0x108\n" /* store prefix register */
280 " stam 0,15,0x120\n" /* store access registers */
281 " std 0,0x160\n" /* store f0 */
282 " std 2,0x168\n" /* store f2 */
283 " std 4,0x170\n" /* store f4 */
284 " std 6,0x178\n" /* store f6 */
285 " stm 0,15,0x180\n" /* store general registers */
286 " stctl 0,15,0x1c0\n" /* store control registers */
287 " oi 0x1c0,0x10\n" /* fake protection bit */
288 " lpsw 0(%1)"
289 : "=m" (ctl_buf)
290 : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc");
291#else /* __s390x__ */
292 asm volatile(
293 " stctg 0,0,0(%2)\n"
294 " ni 4(%2),0xef\n" /* switch off protection */
295 " lctlg 0,0,0(%2)\n"
296 " lghi 1,0x1000\n"
297 " stpt 0x328(1)\n" /* store timer */
298 " stckc 0x330(1)\n" /* store clock comparator */
299 " stpx 0x318(1)\n" /* store prefix register */
300 " stam 0,15,0x340(1)\n"/* store access registers */
301 " stfpc 0x31c(1)\n" /* store fpu control */
302 " std 0,0x200(1)\n" /* store f0 */
303 " std 1,0x208(1)\n" /* store f1 */
304 " std 2,0x210(1)\n" /* store f2 */
305 " std 3,0x218(1)\n" /* store f3 */
306 " std 4,0x220(1)\n" /* store f4 */
307 " std 5,0x228(1)\n" /* store f5 */
308 " std 6,0x230(1)\n" /* store f6 */
309 " std 7,0x238(1)\n" /* store f7 */
310 " std 8,0x240(1)\n" /* store f8 */
311 " std 9,0x248(1)\n" /* store f9 */
312 " std 10,0x250(1)\n" /* store f10 */
313 " std 11,0x258(1)\n" /* store f11 */
314 " std 12,0x260(1)\n" /* store f12 */
315 " std 13,0x268(1)\n" /* store f13 */
316 " std 14,0x270(1)\n" /* store f14 */
317 " std 15,0x278(1)\n" /* store f15 */
318 " stmg 0,15,0x280(1)\n"/* store general registers */
319 " stctg 0,15,0x380(1)\n"/* store control registers */
320 " oi 0x384(1),0x10\n"/* fake protection bit */
321 " lpswe 0(%1)"
322 : "=m" (ctl_buf)
323 : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc", "0");
324#endif /* __s390x__ */
325}
326
327/*
328 * Basic Machine Check/Program Check Handler.
329 */
330
331extern void s390_base_mcck_handler(void);
332extern void s390_base_pgm_handler(void);
333extern void s390_base_ext_handler(void);
334
335extern void (*s390_base_mcck_handler_fn)(void);
336extern void (*s390_base_pgm_handler_fn)(void);
337extern void (*s390_base_ext_handler_fn)(void);
338
339#define ARCH_LOW_ADDRESS_LIMIT 0x7fffffffUL
340
341#endif
342
343/*
344 * Helper macro for exception table entries
345 */
346#ifndef __s390x__
347#define EX_TABLE(_fault,_target) \
348 ".section __ex_table,\"a\"\n" \
349 " .align 4\n" \
350 " .long " #_fault "," #_target "\n" \
351 ".previous\n"
352#else
353#define EX_TABLE(_fault,_target) \
354 ".section __ex_table,\"a\"\n" \
355 " .align 8\n" \
356 " .quad " #_fault "," #_target "\n" \
357 ".previous\n"
358#endif
359
360#endif /* __ASM_S390_PROCESSOR_H */
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
new file mode 100644
index 000000000000..af2c9ac28a07
--- /dev/null
+++ b/arch/s390/include/asm/ptrace.h
@@ -0,0 +1,499 @@
1/*
2 * include/asm-s390/ptrace.h
3 *
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
7 */
8
9#ifndef _S390_PTRACE_H
10#define _S390_PTRACE_H
11
12/*
13 * Offsets in the user_regs_struct. They are used for the ptrace
14 * system call and in entry.S
15 */
16#ifndef __s390x__
17
18#define PT_PSWMASK 0x00
19#define PT_PSWADDR 0x04
20#define PT_GPR0 0x08
21#define PT_GPR1 0x0C
22#define PT_GPR2 0x10
23#define PT_GPR3 0x14
24#define PT_GPR4 0x18
25#define PT_GPR5 0x1C
26#define PT_GPR6 0x20
27#define PT_GPR7 0x24
28#define PT_GPR8 0x28
29#define PT_GPR9 0x2C
30#define PT_GPR10 0x30
31#define PT_GPR11 0x34
32#define PT_GPR12 0x38
33#define PT_GPR13 0x3C
34#define PT_GPR14 0x40
35#define PT_GPR15 0x44
36#define PT_ACR0 0x48
37#define PT_ACR1 0x4C
38#define PT_ACR2 0x50
39#define PT_ACR3 0x54
40#define PT_ACR4 0x58
41#define PT_ACR5 0x5C
42#define PT_ACR6 0x60
43#define PT_ACR7 0x64
44#define PT_ACR8 0x68
45#define PT_ACR9 0x6C
46#define PT_ACR10 0x70
47#define PT_ACR11 0x74
48#define PT_ACR12 0x78
49#define PT_ACR13 0x7C
50#define PT_ACR14 0x80
51#define PT_ACR15 0x84
52#define PT_ORIGGPR2 0x88
53#define PT_FPC 0x90
54/*
55 * A nasty fact of life that the ptrace api
56 * only supports passing of longs.
57 */
58#define PT_FPR0_HI 0x98
59#define PT_FPR0_LO 0x9C
60#define PT_FPR1_HI 0xA0
61#define PT_FPR1_LO 0xA4
62#define PT_FPR2_HI 0xA8
63#define PT_FPR2_LO 0xAC
64#define PT_FPR3_HI 0xB0
65#define PT_FPR3_LO 0xB4
66#define PT_FPR4_HI 0xB8
67#define PT_FPR4_LO 0xBC
68#define PT_FPR5_HI 0xC0
69#define PT_FPR5_LO 0xC4
70#define PT_FPR6_HI 0xC8
71#define PT_FPR6_LO 0xCC
72#define PT_FPR7_HI 0xD0
73#define PT_FPR7_LO 0xD4
74#define PT_FPR8_HI 0xD8
75#define PT_FPR8_LO 0XDC
76#define PT_FPR9_HI 0xE0
77#define PT_FPR9_LO 0xE4
78#define PT_FPR10_HI 0xE8
79#define PT_FPR10_LO 0xEC
80#define PT_FPR11_HI 0xF0
81#define PT_FPR11_LO 0xF4
82#define PT_FPR12_HI 0xF8
83#define PT_FPR12_LO 0xFC
84#define PT_FPR13_HI 0x100
85#define PT_FPR13_LO 0x104
86#define PT_FPR14_HI 0x108
87#define PT_FPR14_LO 0x10C
88#define PT_FPR15_HI 0x110
89#define PT_FPR15_LO 0x114
90#define PT_CR_9 0x118
91#define PT_CR_10 0x11C
92#define PT_CR_11 0x120
93#define PT_IEEE_IP 0x13C
94#define PT_LASTOFF PT_IEEE_IP
95#define PT_ENDREGS 0x140-1
96
97#define GPR_SIZE 4
98#define CR_SIZE 4
99
100#define STACK_FRAME_OVERHEAD 96 /* size of minimum stack frame */
101
102#else /* __s390x__ */
103
104#define PT_PSWMASK 0x00
105#define PT_PSWADDR 0x08
106#define PT_GPR0 0x10
107#define PT_GPR1 0x18
108#define PT_GPR2 0x20
109#define PT_GPR3 0x28
110#define PT_GPR4 0x30
111#define PT_GPR5 0x38
112#define PT_GPR6 0x40
113#define PT_GPR7 0x48
114#define PT_GPR8 0x50
115#define PT_GPR9 0x58
116#define PT_GPR10 0x60
117#define PT_GPR11 0x68
118#define PT_GPR12 0x70
119#define PT_GPR13 0x78
120#define PT_GPR14 0x80
121#define PT_GPR15 0x88
122#define PT_ACR0 0x90
123#define PT_ACR1 0x94
124#define PT_ACR2 0x98
125#define PT_ACR3 0x9C
126#define PT_ACR4 0xA0
127#define PT_ACR5 0xA4
128#define PT_ACR6 0xA8
129#define PT_ACR7 0xAC
130#define PT_ACR8 0xB0
131#define PT_ACR9 0xB4
132#define PT_ACR10 0xB8
133#define PT_ACR11 0xBC
134#define PT_ACR12 0xC0
135#define PT_ACR13 0xC4
136#define PT_ACR14 0xC8
137#define PT_ACR15 0xCC
138#define PT_ORIGGPR2 0xD0
139#define PT_FPC 0xD8
140#define PT_FPR0 0xE0
141#define PT_FPR1 0xE8
142#define PT_FPR2 0xF0
143#define PT_FPR3 0xF8
144#define PT_FPR4 0x100
145#define PT_FPR5 0x108
146#define PT_FPR6 0x110
147#define PT_FPR7 0x118
148#define PT_FPR8 0x120
149#define PT_FPR9 0x128
150#define PT_FPR10 0x130
151#define PT_FPR11 0x138
152#define PT_FPR12 0x140
153#define PT_FPR13 0x148
154#define PT_FPR14 0x150
155#define PT_FPR15 0x158
156#define PT_CR_9 0x160
157#define PT_CR_10 0x168
158#define PT_CR_11 0x170
159#define PT_IEEE_IP 0x1A8
160#define PT_LASTOFF PT_IEEE_IP
161#define PT_ENDREGS 0x1B0-1
162
163#define GPR_SIZE 8
164#define CR_SIZE 8
165
166#define STACK_FRAME_OVERHEAD 160 /* size of minimum stack frame */
167
168#endif /* __s390x__ */
169
170#define NUM_GPRS 16
171#define NUM_FPRS 16
172#define NUM_CRS 16
173#define NUM_ACRS 16
174
175#define FPR_SIZE 8
176#define FPC_SIZE 4
177#define FPC_PAD_SIZE 4 /* gcc insists on aligning the fpregs */
178#define ACR_SIZE 4
179
180
181#define PTRACE_OLDSETOPTIONS 21
182
183#ifndef __ASSEMBLY__
184#include <linux/stddef.h>
185#include <linux/types.h>
186
187typedef union
188{
189 float f;
190 double d;
191 __u64 ui;
192 struct
193 {
194 __u32 hi;
195 __u32 lo;
196 } fp;
197} freg_t;
198
199typedef struct
200{
201 __u32 fpc;
202 freg_t fprs[NUM_FPRS];
203} s390_fp_regs;
204
205#define FPC_EXCEPTION_MASK 0xF8000000
206#define FPC_FLAGS_MASK 0x00F80000
207#define FPC_DXC_MASK 0x0000FF00
208#define FPC_RM_MASK 0x00000003
209#define FPC_VALID_MASK 0xF8F8FF03
210
211/* this typedef defines how a Program Status Word looks like */
212typedef struct
213{
214 unsigned long mask;
215 unsigned long addr;
216} __attribute__ ((aligned(8))) psw_t;
217
218typedef struct
219{
220 __u32 mask;
221 __u32 addr;
222} __attribute__ ((aligned(8))) psw_compat_t;
223
224#ifndef __s390x__
225
226#define PSW_MASK_PER 0x40000000UL
227#define PSW_MASK_DAT 0x04000000UL
228#define PSW_MASK_IO 0x02000000UL
229#define PSW_MASK_EXT 0x01000000UL
230#define PSW_MASK_KEY 0x00F00000UL
231#define PSW_MASK_MCHECK 0x00040000UL
232#define PSW_MASK_WAIT 0x00020000UL
233#define PSW_MASK_PSTATE 0x00010000UL
234#define PSW_MASK_ASC 0x0000C000UL
235#define PSW_MASK_CC 0x00003000UL
236#define PSW_MASK_PM 0x00000F00UL
237
238#define PSW_ADDR_AMODE 0x80000000UL
239#define PSW_ADDR_INSN 0x7FFFFFFFUL
240
241#define PSW_BASE_BITS 0x00080000UL
242#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20)
243
244#define PSW_ASC_PRIMARY 0x00000000UL
245#define PSW_ASC_ACCREG 0x00004000UL
246#define PSW_ASC_SECONDARY 0x00008000UL
247#define PSW_ASC_HOME 0x0000C000UL
248
249#else /* __s390x__ */
250
251#define PSW_MASK_PER 0x4000000000000000UL
252#define PSW_MASK_DAT 0x0400000000000000UL
253#define PSW_MASK_IO 0x0200000000000000UL
254#define PSW_MASK_EXT 0x0100000000000000UL
255#define PSW_MASK_KEY 0x00F0000000000000UL
256#define PSW_MASK_MCHECK 0x0004000000000000UL
257#define PSW_MASK_WAIT 0x0002000000000000UL
258#define PSW_MASK_PSTATE 0x0001000000000000UL
259#define PSW_MASK_ASC 0x0000C00000000000UL
260#define PSW_MASK_CC 0x0000300000000000UL
261#define PSW_MASK_PM 0x00000F0000000000UL
262
263#define PSW_ADDR_AMODE 0x0000000000000000UL
264#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL
265
266#define PSW_BASE_BITS 0x0000000180000000UL
267#define PSW_BASE32_BITS 0x0000000080000000UL
268#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52)
269
270#define PSW_ASC_PRIMARY 0x0000000000000000UL
271#define PSW_ASC_ACCREG 0x0000400000000000UL
272#define PSW_ASC_SECONDARY 0x0000800000000000UL
273#define PSW_ASC_HOME 0x0000C00000000000UL
274
275extern long psw_user32_bits;
276
277#endif /* __s390x__ */
278
279extern long psw_kernel_bits;
280extern long psw_user_bits;
281
282/* This macro merges a NEW PSW mask specified by the user into
283 the currently active PSW mask CURRENT, modifying only those
284 bits in CURRENT that the user may be allowed to change: this
285 is the condition code and the program mask bits. */
286#define PSW_MASK_MERGE(CURRENT,NEW) \
287 (((CURRENT) & ~(PSW_MASK_CC|PSW_MASK_PM)) | \
288 ((NEW) & (PSW_MASK_CC|PSW_MASK_PM)))
289
290/*
291 * The s390_regs structure is used to define the elf_gregset_t.
292 */
293typedef struct
294{
295 psw_t psw;
296 unsigned long gprs[NUM_GPRS];
297 unsigned int acrs[NUM_ACRS];
298 unsigned long orig_gpr2;
299} s390_regs;
300
301typedef struct
302{
303 psw_compat_t psw;
304 __u32 gprs[NUM_GPRS];
305 __u32 acrs[NUM_ACRS];
306 __u32 orig_gpr2;
307} s390_compat_regs;
308
309
310#ifdef __KERNEL__
311#include <asm/setup.h>
312#include <asm/page.h>
313
314/*
315 * The pt_regs struct defines the way the registers are stored on
316 * the stack during a system call.
317 */
318struct pt_regs
319{
320 unsigned long args[1];
321 psw_t psw;
322 unsigned long gprs[NUM_GPRS];
323 unsigned long orig_gpr2;
324 unsigned short ilc;
325 unsigned short trap;
326};
327#endif
328
329/*
330 * Now for the program event recording (trace) definitions.
331 */
332typedef struct
333{
334 unsigned long cr[3];
335} per_cr_words;
336
337#define PER_EM_MASK 0xE8000000UL
338
339typedef struct
340{
341#ifdef __s390x__
342 unsigned : 32;
343#endif /* __s390x__ */
344 unsigned em_branching : 1;
345 unsigned em_instruction_fetch : 1;
346 /*
347 * Switching on storage alteration automatically fixes
348 * the storage alteration event bit in the users std.
349 */
350 unsigned em_storage_alteration : 1;
351 unsigned em_gpr_alt_unused : 1;
352 unsigned em_store_real_address : 1;
353 unsigned : 3;
354 unsigned branch_addr_ctl : 1;
355 unsigned : 1;
356 unsigned storage_alt_space_ctl : 1;
357 unsigned : 21;
358 unsigned long starting_addr;
359 unsigned long ending_addr;
360} per_cr_bits;
361
362typedef struct
363{
364 unsigned short perc_atmid;
365 unsigned long address;
366 unsigned char access_id;
367} per_lowcore_words;
368
369typedef struct
370{
371 unsigned perc_branching : 1;
372 unsigned perc_instruction_fetch : 1;
373 unsigned perc_storage_alteration : 1;
374 unsigned perc_gpr_alt_unused : 1;
375 unsigned perc_store_real_address : 1;
376 unsigned : 3;
377 unsigned atmid_psw_bit_31 : 1;
378 unsigned atmid_validity_bit : 1;
379 unsigned atmid_psw_bit_32 : 1;
380 unsigned atmid_psw_bit_5 : 1;
381 unsigned atmid_psw_bit_16 : 1;
382 unsigned atmid_psw_bit_17 : 1;
383 unsigned si : 2;
384 unsigned long address;
385 unsigned : 4;
386 unsigned access_id : 4;
387} per_lowcore_bits;
388
389typedef struct
390{
391 union {
392 per_cr_words words;
393 per_cr_bits bits;
394 } control_regs;
395 /*
396 * Use these flags instead of setting em_instruction_fetch
397 * directly they are used so that single stepping can be
398 * switched on & off while not affecting other tracing
399 */
400 unsigned single_step : 1;
401 unsigned instruction_fetch : 1;
402 unsigned : 30;
403 /*
404 * These addresses are copied into cr10 & cr11 if single
405 * stepping is switched off
406 */
407 unsigned long starting_addr;
408 unsigned long ending_addr;
409 union {
410 per_lowcore_words words;
411 per_lowcore_bits bits;
412 } lowcore;
413} per_struct;
414
415typedef struct
416{
417 unsigned int len;
418 unsigned long kernel_addr;
419 unsigned long process_addr;
420} ptrace_area;
421
422/*
423 * S/390 specific non posix ptrace requests. I chose unusual values so
424 * they are unlikely to clash with future ptrace definitions.
425 */
426#define PTRACE_PEEKUSR_AREA 0x5000
427#define PTRACE_POKEUSR_AREA 0x5001
428#define PTRACE_PEEKTEXT_AREA 0x5002
429#define PTRACE_PEEKDATA_AREA 0x5003
430#define PTRACE_POKETEXT_AREA 0x5004
431#define PTRACE_POKEDATA_AREA 0x5005
432
433/*
434 * PT_PROT definition is loosely based on hppa bsd definition in
435 * gdb/hppab-nat.c
436 */
437#define PTRACE_PROT 21
438
439typedef enum
440{
441 ptprot_set_access_watchpoint,
442 ptprot_set_write_watchpoint,
443 ptprot_disable_watchpoint
444} ptprot_flags;
445
446typedef struct
447{
448 unsigned long lowaddr;
449 unsigned long hiaddr;
450 ptprot_flags prot;
451} ptprot_area;
452
453/* Sequence of bytes for breakpoint illegal instruction. */
454#define S390_BREAKPOINT {0x0,0x1}
455#define S390_BREAKPOINT_U16 ((__u16)0x0001)
456#define S390_SYSCALL_OPCODE ((__u16)0x0a00)
457#define S390_SYSCALL_SIZE 2
458
459/*
460 * The user_regs_struct defines the way the user registers are
461 * store on the stack for signal handling.
462 */
463struct user_regs_struct
464{
465 psw_t psw;
466 unsigned long gprs[NUM_GPRS];
467 unsigned int acrs[NUM_ACRS];
468 unsigned long orig_gpr2;
469 s390_fp_regs fp_regs;
470 /*
471 * These per registers are in here so that gdb can modify them
472 * itself as there is no "official" ptrace interface for hardware
473 * watchpoints. This is the way intel does it.
474 */
475 per_struct per_info;
476 unsigned long ieee_instruction_pointer;
477 /* Used to give failing instruction back to user for ieee exceptions */
478};
479
480#ifdef __KERNEL__
481/*
482 * These are defined as per linux/ptrace.h, which see.
483 */
484#define arch_has_single_step() (1)
485struct task_struct;
486extern void user_enable_single_step(struct task_struct *);
487extern void user_disable_single_step(struct task_struct *);
488
489#define __ARCH_WANT_COMPAT_SYS_PTRACE
490
491#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
492#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
493#define regs_return_value(regs)((regs)->gprs[2])
494#define profile_pc(regs) instruction_pointer(regs)
495extern void show_regs(struct pt_regs * regs);
496#endif /* __KERNEL__ */
497#endif /* __ASSEMBLY__ */
498
499#endif /* _S390_PTRACE_H */
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
new file mode 100644
index 000000000000..6813772171f2
--- /dev/null
+++ b/arch/s390/include/asm/qdio.h
@@ -0,0 +1,382 @@
1/*
2 * linux/include/asm-s390/qdio.h
3 *
4 * Copyright 2000,2008 IBM Corp.
5 * Author(s): Utz Bacher <utz.bacher@de.ibm.com>
6 * Jan Glauber <jang@linux.vnet.ibm.com>
7 *
8 */
9#ifndef __QDIO_H__
10#define __QDIO_H__
11
12#include <linux/interrupt.h>
13#include <asm/cio.h>
14#include <asm/ccwdev.h>
15
16#define QDIO_MAX_QUEUES_PER_IRQ 32
17#define QDIO_MAX_BUFFERS_PER_Q 128
18#define QDIO_MAX_BUFFERS_MASK (QDIO_MAX_BUFFERS_PER_Q - 1)
19#define QDIO_MAX_ELEMENTS_PER_BUFFER 16
20#define QDIO_SBAL_SIZE 256
21
22#define QDIO_QETH_QFMT 0
23#define QDIO_ZFCP_QFMT 1
24#define QDIO_IQDIO_QFMT 2
25
26/**
27 * struct qdesfmt0 - queue descriptor, format 0
28 * @sliba: storage list information block address
29 * @sla: storage list address
30 * @slsba: storage list state block address
31 * @akey: access key for DLIB
32 * @bkey: access key for SL
33 * @ckey: access key for SBALs
34 * @dkey: access key for SLSB
35 */
36struct qdesfmt0 {
37 u64 sliba;
38 u64 sla;
39 u64 slsba;
40 u32 : 32;
41 u32 akey : 4;
42 u32 bkey : 4;
43 u32 ckey : 4;
44 u32 dkey : 4;
45 u32 : 16;
46} __attribute__ ((packed));
47
48/**
49 * struct qdr - queue description record (QDR)
50 * @qfmt: queue format
51 * @pfmt: implementation dependent parameter format
52 * @ac: adapter characteristics
53 * @iqdcnt: input queue descriptor count
54 * @oqdcnt: output queue descriptor count
55 * @iqdsz: inpout queue descriptor size
56 * @oqdsz: output queue descriptor size
57 * @qiba: queue information block address
58 * @qkey: queue information block key
59 * @qdf0: queue descriptions
60 */
61struct qdr {
62 u32 qfmt : 8;
63 u32 pfmt : 8;
64 u32 : 8;
65 u32 ac : 8;
66 u32 : 8;
67 u32 iqdcnt : 8;
68 u32 : 8;
69 u32 oqdcnt : 8;
70 u32 : 8;
71 u32 iqdsz : 8;
72 u32 : 8;
73 u32 oqdsz : 8;
74 /* private: */
75 u32 res[9];
76 /* public: */
77 u64 qiba;
78 u32 : 32;
79 u32 qkey : 4;
80 u32 : 28;
81 struct qdesfmt0 qdf0[126];
82} __attribute__ ((packed, aligned(4096)));
83
84#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
85#define QIB_RFLAGS_ENABLE_QEBSM 0x80
86
87/**
88 * struct qib - queue information block (QIB)
89 * @qfmt: queue format
90 * @pfmt: implementation dependent parameter format
91 * @rflags: QEBSM
92 * @ac: adapter characteristics
93 * @isliba: absolute address of first input SLIB
94 * @osliba: absolute address of first output SLIB
95 * @ebcnam: adapter identifier in EBCDIC
96 * @parm: implementation dependent parameters
97 */
98struct qib {
99 u32 qfmt : 8;
100 u32 pfmt : 8;
101 u32 rflags : 8;
102 u32 ac : 8;
103 u32 : 32;
104 u64 isliba;
105 u64 osliba;
106 u32 : 32;
107 u32 : 32;
108 u8 ebcnam[8];
109 /* private: */
110 u8 res[88];
111 /* public: */
112 u8 parm[QDIO_MAX_BUFFERS_PER_Q];
113} __attribute__ ((packed, aligned(256)));
114
115/**
116 * struct slibe - storage list information block element (SLIBE)
117 * @parms: implementation dependent parameters
118 */
119struct slibe {
120 u64 parms;
121};
122
123/**
124 * struct slib - storage list information block (SLIB)
125 * @nsliba: next SLIB address (if any)
126 * @sla: SL address
127 * @slsba: SLSB address
128 * @slibe: SLIB elements
129 */
130struct slib {
131 u64 nsliba;
132 u64 sla;
133 u64 slsba;
134 /* private: */
135 u8 res[1000];
136 /* public: */
137 struct slibe slibe[QDIO_MAX_BUFFERS_PER_Q];
138} __attribute__ ((packed, aligned(2048)));
139
140/**
141 * struct sbal_flags - storage block address list flags
142 * @last: last entry
143 * @cont: contiguous storage
144 * @frag: fragmentation
145 */
146struct sbal_flags {
147 u8 : 1;
148 u8 last : 1;
149 u8 cont : 1;
150 u8 : 1;
151 u8 frag : 2;
152 u8 : 2;
153} __attribute__ ((packed));
154
155#define SBAL_FLAGS_FIRST_FRAG 0x04000000UL
156#define SBAL_FLAGS_MIDDLE_FRAG 0x08000000UL
157#define SBAL_FLAGS_LAST_FRAG 0x0c000000UL
158#define SBAL_FLAGS_LAST_ENTRY 0x40000000UL
159#define SBAL_FLAGS_CONTIGUOUS 0x20000000UL
160
161#define SBAL_FLAGS0_DATA_CONTINUATION 0x20UL
162
163/* Awesome OpenFCP extensions */
164#define SBAL_FLAGS0_TYPE_STATUS 0x00UL
165#define SBAL_FLAGS0_TYPE_WRITE 0x08UL
166#define SBAL_FLAGS0_TYPE_READ 0x10UL
167#define SBAL_FLAGS0_TYPE_WRITE_READ 0x18UL
168#define SBAL_FLAGS0_MORE_SBALS 0x04UL
169#define SBAL_FLAGS0_COMMAND 0x02UL
170#define SBAL_FLAGS0_LAST_SBAL 0x00UL
171#define SBAL_FLAGS0_ONLY_SBAL SBAL_FLAGS0_COMMAND
172#define SBAL_FLAGS0_MIDDLE_SBAL SBAL_FLAGS0_MORE_SBALS
173#define SBAL_FLAGS0_FIRST_SBAL SBAL_FLAGS0_MORE_SBALS | SBAL_FLAGS0_COMMAND
174#define SBAL_FLAGS0_PCI 0x40
175
176/**
177 * struct sbal_sbalf_0 - sbal flags for sbale 0
178 * @pci: PCI indicator
179 * @cont: data continuation
180 * @sbtype: storage-block type (FCP)
181 */
182struct sbal_sbalf_0 {
183 u8 : 1;
184 u8 pci : 1;
185 u8 cont : 1;
186 u8 sbtype : 2;
187 u8 : 3;
188} __attribute__ ((packed));
189
190/**
191 * struct sbal_sbalf_1 - sbal flags for sbale 1
192 * @key: storage key
193 */
194struct sbal_sbalf_1 {
195 u8 : 4;
196 u8 key : 4;
197} __attribute__ ((packed));
198
199/**
200 * struct sbal_sbalf_14 - sbal flags for sbale 14
201 * @erridx: error index
202 */
203struct sbal_sbalf_14 {
204 u8 : 4;
205 u8 erridx : 4;
206} __attribute__ ((packed));
207
208/**
209 * struct sbal_sbalf_15 - sbal flags for sbale 15
210 * @reason: reason for error state
211 */
212struct sbal_sbalf_15 {
213 u8 reason;
214} __attribute__ ((packed));
215
216/**
217 * union sbal_sbalf - storage block address list flags
218 * @i0: sbalf0
219 * @i1: sbalf1
220 * @i14: sbalf14
221 * @i15: sblaf15
222 * @value: raw value
223 */
224union sbal_sbalf {
225 struct sbal_sbalf_0 i0;
226 struct sbal_sbalf_1 i1;
227 struct sbal_sbalf_14 i14;
228 struct sbal_sbalf_15 i15;
229 u8 value;
230};
231
232/**
233 * struct qdio_buffer_element - SBAL entry
234 * @flags: flags
235 * @length: length
236 * @addr: address
237*/
238struct qdio_buffer_element {
239 u32 flags;
240 u32 length;
241#ifdef CONFIG_32BIT
242 /* private: */
243 void *reserved;
244 /* public: */
245#endif
246 void *addr;
247} __attribute__ ((packed, aligned(16)));
248
249/**
250 * struct qdio_buffer - storage block address list (SBAL)
251 * @element: SBAL entries
252 */
253struct qdio_buffer {
254 struct qdio_buffer_element element[QDIO_MAX_ELEMENTS_PER_BUFFER];
255} __attribute__ ((packed, aligned(256)));
256
257/**
258 * struct sl_element - storage list entry
259 * @sbal: absolute SBAL address
260 */
261struct sl_element {
262#ifdef CONFIG_32BIT
263 /* private: */
264 unsigned long reserved;
265 /* public: */
266#endif
267 unsigned long sbal;
268} __attribute__ ((packed));
269
270/**
271 * struct sl - storage list (SL)
272 * @element: SL entries
273 */
274struct sl {
275 struct sl_element element[QDIO_MAX_BUFFERS_PER_Q];
276} __attribute__ ((packed, aligned(1024)));
277
278/**
279 * struct slsb - storage list state block (SLSB)
280 * @val: state per buffer
281 */
282struct slsb {
283 u8 val[QDIO_MAX_BUFFERS_PER_Q];
284} __attribute__ ((packed, aligned(256)));
285
286struct qdio_ssqd_desc {
287 u8 flags;
288 u8:8;
289 u16 sch;
290 u8 qfmt;
291 u8 parm;
292 u8 qdioac1;
293 u8 sch_class;
294 u8 pcnt;
295 u8 icnt;
296 u8:8;
297 u8 ocnt;
298 u8:8;
299 u8 mbccnt;
300 u16 qdioac2;
301 u64 sch_token;
302 u64:64;
303} __attribute__ ((packed));
304
305/* params are: ccw_device, qdio_error, queue_number,
306 first element processed, number of elements processed, int_parm */
307typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
308 int, int, unsigned long);
309
310/* qdio errors reported to the upper-layer program */
311#define QDIO_ERROR_SIGA_ACCESS_EXCEPTION 0x10
312#define QDIO_ERROR_SIGA_BUSY 0x20
313#define QDIO_ERROR_ACTIVATE_CHECK_CONDITION 0x40
314#define QDIO_ERROR_SLSB_STATE 0x80
315
316/* for qdio_initialize */
317#define QDIO_INBOUND_0COPY_SBALS 0x01
318#define QDIO_OUTBOUND_0COPY_SBALS 0x02
319#define QDIO_USE_OUTBOUND_PCIS 0x04
320
321/* for qdio_cleanup */
322#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01
323#define QDIO_FLAG_CLEANUP_USING_HALT 0x02
324
325/**
326 * struct qdio_initialize - qdio initalization data
327 * @cdev: associated ccw device
328 * @q_format: queue format
329 * @adapter_name: name for the adapter
330 * @qib_param_field_format: format for qib_parm_field
331 * @qib_param_field: pointer to 128 bytes or NULL, if no param field
332 * @input_slib_elements: pointer to no_input_qs * 128 words of data or NULL
333 * @output_slib_elements: pointer to no_output_qs * 128 words of data or NULL
334 * @no_input_qs: number of input queues
335 * @no_output_qs: number of output queues
336 * @input_handler: handler to be called for input queues
337 * @output_handler: handler to be called for output queues
338 * @int_parm: interruption parameter
339 * @flags: initialization flags
340 * @input_sbal_addr_array: address of no_input_qs * 128 pointers
341 * @output_sbal_addr_array: address of no_output_qs * 128 pointers
342 */
343struct qdio_initialize {
344 struct ccw_device *cdev;
345 unsigned char q_format;
346 unsigned char adapter_name[8];
347 unsigned int qib_param_field_format;
348 unsigned char *qib_param_field;
349 unsigned long *input_slib_elements;
350 unsigned long *output_slib_elements;
351 unsigned int no_input_qs;
352 unsigned int no_output_qs;
353 qdio_handler_t *input_handler;
354 qdio_handler_t *output_handler;
355 unsigned long int_parm;
356 unsigned long flags;
357 void **input_sbal_addr_array;
358 void **output_sbal_addr_array;
359};
360
361#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */
362#define QDIO_STATE_ESTABLISHED 0x00000004 /* after qdio_establish */
363#define QDIO_STATE_ACTIVE 0x00000008 /* after qdio_activate */
364#define QDIO_STATE_STOPPED 0x00000010 /* after queues went down */
365
366#define QDIO_FLAG_SYNC_INPUT 0x01
367#define QDIO_FLAG_SYNC_OUTPUT 0x02
368#define QDIO_FLAG_PCI_OUT 0x10
369
370extern int qdio_initialize(struct qdio_initialize *init_data);
371extern int qdio_allocate(struct qdio_initialize *init_data);
372extern int qdio_establish(struct qdio_initialize *init_data);
373extern int qdio_activate(struct ccw_device *);
374
375extern int do_QDIO(struct ccw_device*, unsigned int flags,
376 int q_nr, int qidx, int count);
377extern int qdio_cleanup(struct ccw_device*, int how);
378extern int qdio_shutdown(struct ccw_device*, int how);
379extern int qdio_free(struct ccw_device *);
380extern struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev);
381
382#endif /* __QDIO_H__ */
diff --git a/arch/s390/include/asm/qeth.h b/arch/s390/include/asm/qeth.h
new file mode 100644
index 000000000000..930d378ef75a
--- /dev/null
+++ b/arch/s390/include/asm/qeth.h
@@ -0,0 +1,78 @@
1/*
2 * include/asm-s390/qeth.h
3 *
4 * ioctl definitions for qeth driver
5 *
6 * Copyright (C) 2004 IBM Corporation
7 *
8 * Author(s): Thomas Spatzier <tspat@de.ibm.com>
9 *
10 */
11#ifndef __ASM_S390_QETH_IOCTL_H__
12#define __ASM_S390_QETH_IOCTL_H__
13#include <linux/ioctl.h>
14
15#define SIOC_QETH_ARP_SET_NO_ENTRIES (SIOCDEVPRIVATE)
16#define SIOC_QETH_ARP_QUERY_INFO (SIOCDEVPRIVATE + 1)
17#define SIOC_QETH_ARP_ADD_ENTRY (SIOCDEVPRIVATE + 2)
18#define SIOC_QETH_ARP_REMOVE_ENTRY (SIOCDEVPRIVATE + 3)
19#define SIOC_QETH_ARP_FLUSH_CACHE (SIOCDEVPRIVATE + 4)
20#define SIOC_QETH_ADP_SET_SNMP_CONTROL (SIOCDEVPRIVATE + 5)
21#define SIOC_QETH_GET_CARD_TYPE (SIOCDEVPRIVATE + 6)
22
23struct qeth_arp_cache_entry {
24 __u8 macaddr[6];
25 __u8 reserved1[2];
26 __u8 ipaddr[16]; /* for both IPv4 and IPv6 */
27 __u8 reserved2[32];
28} __attribute__ ((packed));
29
30struct qeth_arp_qi_entry7 {
31 __u8 media_specific[32];
32 __u8 macaddr_type;
33 __u8 ipaddr_type;
34 __u8 macaddr[6];
35 __u8 ipaddr[4];
36} __attribute__((packed));
37
38struct qeth_arp_qi_entry7_short {
39 __u8 macaddr_type;
40 __u8 ipaddr_type;
41 __u8 macaddr[6];
42 __u8 ipaddr[4];
43} __attribute__((packed));
44
45struct qeth_arp_qi_entry5 {
46 __u8 media_specific[32];
47 __u8 macaddr_type;
48 __u8 ipaddr_type;
49 __u8 ipaddr[4];
50} __attribute__((packed));
51
52struct qeth_arp_qi_entry5_short {
53 __u8 macaddr_type;
54 __u8 ipaddr_type;
55 __u8 ipaddr[4];
56} __attribute__((packed));
57
58/*
59 * can be set by user if no "media specific information" is wanted
60 * -> saves a lot of space in user space buffer
61 */
62#define QETH_QARP_STRIP_ENTRIES 0x8000
63#define QETH_QARP_REQUEST_MASK 0x00ff
64
65/* data sent to user space as result of query arp ioctl */
66#define QETH_QARP_USER_DATA_SIZE 20000
67#define QETH_QARP_MASK_OFFSET 4
68#define QETH_QARP_ENTRIES_OFFSET 6
69struct qeth_arp_query_user_data {
70 union {
71 __u32 data_len; /* set by user space program */
72 __u32 no_entries; /* set by kernel */
73 } u;
74 __u16 mask_bits;
75 char *entries;
76} __attribute__((packed));
77
78#endif /* __ASM_S390_QETH_IOCTL_H__ */
diff --git a/arch/s390/include/asm/reset.h b/arch/s390/include/asm/reset.h
new file mode 100644
index 000000000000..f584f4a52581
--- /dev/null
+++ b/arch/s390/include/asm/reset.h
@@ -0,0 +1,21 @@
1/*
2 * include/asm-s390/reset.h
3 *
4 * Copyright IBM Corp. 2006
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_RESET_H
9#define _ASM_S390_RESET_H
10
11#include <linux/list.h>
12
13struct reset_call {
14 struct list_head list;
15 void (*fn)(void);
16};
17
18extern void register_reset_call(struct reset_call *reset);
19extern void unregister_reset_call(struct reset_call *reset);
20extern void s390_reset_system(void);
21#endif /* _ASM_S390_RESET_H */
diff --git a/arch/s390/include/asm/resource.h b/arch/s390/include/asm/resource.h
new file mode 100644
index 000000000000..366c01de04f2
--- /dev/null
+++ b/arch/s390/include/asm/resource.h
@@ -0,0 +1,15 @@
1/*
2 * include/asm-s390/resource.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/resources.h"
7 */
8
9#ifndef _S390_RESOURCE_H
10#define _S390_RESOURCE_H
11
12#include <asm-generic/resource.h>
13
14#endif
15
diff --git a/arch/s390/include/asm/rwsem.h b/arch/s390/include/asm/rwsem.h
new file mode 100644
index 000000000000..9d2a17971805
--- /dev/null
+++ b/arch/s390/include/asm/rwsem.h
@@ -0,0 +1,387 @@
1#ifndef _S390_RWSEM_H
2#define _S390_RWSEM_H
3
4/*
5 * include/asm-s390/rwsem.h
6 *
7 * S390 version
8 * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
10 *
11 * Based on asm-alpha/semaphore.h and asm-i386/rwsem.h
12 */
13
14/*
15 *
16 * The MSW of the count is the negated number of active writers and waiting
17 * lockers, and the LSW is the total number of active locks
18 *
19 * The lock count is initialized to 0 (no active and no waiting lockers).
20 *
21 * When a writer subtracts WRITE_BIAS, it'll get 0xffff0001 for the case of an
22 * uncontended lock. This can be determined because XADD returns the old value.
23 * Readers increment by 1 and see a positive value when uncontended, negative
24 * if there are writers (and maybe) readers waiting (in which case it goes to
25 * sleep).
26 *
27 * The value of WAITING_BIAS supports up to 32766 waiting processes. This can
28 * be extended to 65534 by manually checking the whole MSW rather than relying
29 * on the S flag.
30 *
31 * The value of ACTIVE_BIAS supports up to 65535 active processes.
32 *
33 * This should be totally fair - if anything is waiting, a process that wants a
34 * lock will go to the back of the queue. When the currently active lock is
35 * released, if there's a writer at the front of the queue, then that and only
36 * that will be woken up; if there's a bunch of consequtive readers at the
37 * front, then they'll all be woken up, but no other readers will be.
38 */
39
40#ifndef _LINUX_RWSEM_H
41#error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead"
42#endif
43
44#ifdef __KERNEL__
45
46#include <linux/list.h>
47#include <linux/spinlock.h>
48
49struct rwsem_waiter;
50
51extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *);
52extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *);
53extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *);
54extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *);
55extern struct rw_semaphore *rwsem_downgrade_write(struct rw_semaphore *);
56
57/*
58 * the semaphore definition
59 */
60struct rw_semaphore {
61 signed long count;
62 spinlock_t wait_lock;
63 struct list_head wait_list;
64#ifdef CONFIG_DEBUG_LOCK_ALLOC
65 struct lockdep_map dep_map;
66#endif
67};
68
69#ifndef __s390x__
70#define RWSEM_UNLOCKED_VALUE 0x00000000
71#define RWSEM_ACTIVE_BIAS 0x00000001
72#define RWSEM_ACTIVE_MASK 0x0000ffff
73#define RWSEM_WAITING_BIAS (-0x00010000)
74#else /* __s390x__ */
75#define RWSEM_UNLOCKED_VALUE 0x0000000000000000L
76#define RWSEM_ACTIVE_BIAS 0x0000000000000001L
77#define RWSEM_ACTIVE_MASK 0x00000000ffffffffL
78#define RWSEM_WAITING_BIAS (-0x0000000100000000L)
79#endif /* __s390x__ */
80#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
81#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
82
83/*
84 * initialisation
85 */
86
87#ifdef CONFIG_DEBUG_LOCK_ALLOC
88# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
89#else
90# define __RWSEM_DEP_MAP_INIT(lockname)
91#endif
92
93#define __RWSEM_INITIALIZER(name) \
94 { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait.lock), \
95 LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
96
97#define DECLARE_RWSEM(name) \
98 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
99
100static inline void init_rwsem(struct rw_semaphore *sem)
101{
102 sem->count = RWSEM_UNLOCKED_VALUE;
103 spin_lock_init(&sem->wait_lock);
104 INIT_LIST_HEAD(&sem->wait_list);
105}
106
107extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
108 struct lock_class_key *key);
109
110#define init_rwsem(sem) \
111do { \
112 static struct lock_class_key __key; \
113 \
114 __init_rwsem((sem), #sem, &__key); \
115} while (0)
116
117
118/*
119 * lock for reading
120 */
121static inline void __down_read(struct rw_semaphore *sem)
122{
123 signed long old, new;
124
125 asm volatile(
126#ifndef __s390x__
127 " l %0,0(%3)\n"
128 "0: lr %1,%0\n"
129 " ahi %1,%5\n"
130 " cs %0,%1,0(%3)\n"
131 " jl 0b"
132#else /* __s390x__ */
133 " lg %0,0(%3)\n"
134 "0: lgr %1,%0\n"
135 " aghi %1,%5\n"
136 " csg %0,%1,0(%3)\n"
137 " jl 0b"
138#endif /* __s390x__ */
139 : "=&d" (old), "=&d" (new), "=m" (sem->count)
140 : "a" (&sem->count), "m" (sem->count),
141 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory");
142 if (old < 0)
143 rwsem_down_read_failed(sem);
144}
145
146/*
147 * trylock for reading -- returns 1 if successful, 0 if contention
148 */
149static inline int __down_read_trylock(struct rw_semaphore *sem)
150{
151 signed long old, new;
152
153 asm volatile(
154#ifndef __s390x__
155 " l %0,0(%3)\n"
156 "0: ltr %1,%0\n"
157 " jm 1f\n"
158 " ahi %1,%5\n"
159 " cs %0,%1,0(%3)\n"
160 " jl 0b\n"
161 "1:"
162#else /* __s390x__ */
163 " lg %0,0(%3)\n"
164 "0: ltgr %1,%0\n"
165 " jm 1f\n"
166 " aghi %1,%5\n"
167 " csg %0,%1,0(%3)\n"
168 " jl 0b\n"
169 "1:"
170#endif /* __s390x__ */
171 : "=&d" (old), "=&d" (new), "=m" (sem->count)
172 : "a" (&sem->count), "m" (sem->count),
173 "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory");
174 return old >= 0 ? 1 : 0;
175}
176
177/*
178 * lock for writing
179 */
180static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
181{
182 signed long old, new, tmp;
183
184 tmp = RWSEM_ACTIVE_WRITE_BIAS;
185 asm volatile(
186#ifndef __s390x__
187 " l %0,0(%3)\n"
188 "0: lr %1,%0\n"
189 " a %1,%5\n"
190 " cs %0,%1,0(%3)\n"
191 " jl 0b"
192#else /* __s390x__ */
193 " lg %0,0(%3)\n"
194 "0: lgr %1,%0\n"
195 " ag %1,%5\n"
196 " csg %0,%1,0(%3)\n"
197 " jl 0b"
198#endif /* __s390x__ */
199 : "=&d" (old), "=&d" (new), "=m" (sem->count)
200 : "a" (&sem->count), "m" (sem->count), "m" (tmp)
201 : "cc", "memory");
202 if (old != 0)
203 rwsem_down_write_failed(sem);
204}
205
206static inline void __down_write(struct rw_semaphore *sem)
207{
208 __down_write_nested(sem, 0);
209}
210
211/*
212 * trylock for writing -- returns 1 if successful, 0 if contention
213 */
214static inline int __down_write_trylock(struct rw_semaphore *sem)
215{
216 signed long old;
217
218 asm volatile(
219#ifndef __s390x__
220 " l %0,0(%2)\n"
221 "0: ltr %0,%0\n"
222 " jnz 1f\n"
223 " cs %0,%4,0(%2)\n"
224 " jl 0b\n"
225#else /* __s390x__ */
226 " lg %0,0(%2)\n"
227 "0: ltgr %0,%0\n"
228 " jnz 1f\n"
229 " csg %0,%4,0(%2)\n"
230 " jl 0b\n"
231#endif /* __s390x__ */
232 "1:"
233 : "=&d" (old), "=m" (sem->count)
234 : "a" (&sem->count), "m" (sem->count),
235 "d" (RWSEM_ACTIVE_WRITE_BIAS) : "cc", "memory");
236 return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0;
237}
238
239/*
240 * unlock after reading
241 */
242static inline void __up_read(struct rw_semaphore *sem)
243{
244 signed long old, new;
245
246 asm volatile(
247#ifndef __s390x__
248 " l %0,0(%3)\n"
249 "0: lr %1,%0\n"
250 " ahi %1,%5\n"
251 " cs %0,%1,0(%3)\n"
252 " jl 0b"
253#else /* __s390x__ */
254 " lg %0,0(%3)\n"
255 "0: lgr %1,%0\n"
256 " aghi %1,%5\n"
257 " csg %0,%1,0(%3)\n"
258 " jl 0b"
259#endif /* __s390x__ */
260 : "=&d" (old), "=&d" (new), "=m" (sem->count)
261 : "a" (&sem->count), "m" (sem->count),
262 "i" (-RWSEM_ACTIVE_READ_BIAS)
263 : "cc", "memory");
264 if (new < 0)
265 if ((new & RWSEM_ACTIVE_MASK) == 0)
266 rwsem_wake(sem);
267}
268
269/*
270 * unlock after writing
271 */
272static inline void __up_write(struct rw_semaphore *sem)
273{
274 signed long old, new, tmp;
275
276 tmp = -RWSEM_ACTIVE_WRITE_BIAS;
277 asm volatile(
278#ifndef __s390x__
279 " l %0,0(%3)\n"
280 "0: lr %1,%0\n"
281 " a %1,%5\n"
282 " cs %0,%1,0(%3)\n"
283 " jl 0b"
284#else /* __s390x__ */
285 " lg %0,0(%3)\n"
286 "0: lgr %1,%0\n"
287 " ag %1,%5\n"
288 " csg %0,%1,0(%3)\n"
289 " jl 0b"
290#endif /* __s390x__ */
291 : "=&d" (old), "=&d" (new), "=m" (sem->count)
292 : "a" (&sem->count), "m" (sem->count), "m" (tmp)
293 : "cc", "memory");
294 if (new < 0)
295 if ((new & RWSEM_ACTIVE_MASK) == 0)
296 rwsem_wake(sem);
297}
298
299/*
300 * downgrade write lock to read lock
301 */
302static inline void __downgrade_write(struct rw_semaphore *sem)
303{
304 signed long old, new, tmp;
305
306 tmp = -RWSEM_WAITING_BIAS;
307 asm volatile(
308#ifndef __s390x__
309 " l %0,0(%3)\n"
310 "0: lr %1,%0\n"
311 " a %1,%5\n"
312 " cs %0,%1,0(%3)\n"
313 " jl 0b"
314#else /* __s390x__ */
315 " lg %0,0(%3)\n"
316 "0: lgr %1,%0\n"
317 " ag %1,%5\n"
318 " csg %0,%1,0(%3)\n"
319 " jl 0b"
320#endif /* __s390x__ */
321 : "=&d" (old), "=&d" (new), "=m" (sem->count)
322 : "a" (&sem->count), "m" (sem->count), "m" (tmp)
323 : "cc", "memory");
324 if (new > 1)
325 rwsem_downgrade_wake(sem);
326}
327
328/*
329 * implement atomic add functionality
330 */
331static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
332{
333 signed long old, new;
334
335 asm volatile(
336#ifndef __s390x__
337 " l %0,0(%3)\n"
338 "0: lr %1,%0\n"
339 " ar %1,%5\n"
340 " cs %0,%1,0(%3)\n"
341 " jl 0b"
342#else /* __s390x__ */
343 " lg %0,0(%3)\n"
344 "0: lgr %1,%0\n"
345 " agr %1,%5\n"
346 " csg %0,%1,0(%3)\n"
347 " jl 0b"
348#endif /* __s390x__ */
349 : "=&d" (old), "=&d" (new), "=m" (sem->count)
350 : "a" (&sem->count), "m" (sem->count), "d" (delta)
351 : "cc", "memory");
352}
353
354/*
355 * implement exchange and add functionality
356 */
357static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
358{
359 signed long old, new;
360
361 asm volatile(
362#ifndef __s390x__
363 " l %0,0(%3)\n"
364 "0: lr %1,%0\n"
365 " ar %1,%5\n"
366 " cs %0,%1,0(%3)\n"
367 " jl 0b"
368#else /* __s390x__ */
369 " lg %0,0(%3)\n"
370 "0: lgr %1,%0\n"
371 " agr %1,%5\n"
372 " csg %0,%1,0(%3)\n"
373 " jl 0b"
374#endif /* __s390x__ */
375 : "=&d" (old), "=&d" (new), "=m" (sem->count)
376 : "a" (&sem->count), "m" (sem->count), "d" (delta)
377 : "cc", "memory");
378 return new;
379}
380
381static inline int rwsem_is_locked(struct rw_semaphore *sem)
382{
383 return (sem->count != 0);
384}
385
386#endif /* __KERNEL__ */
387#endif /* _S390_RWSEM_H */
diff --git a/arch/s390/include/asm/s390_ext.h b/arch/s390/include/asm/s390_ext.h
new file mode 100644
index 000000000000..2afc060266a2
--- /dev/null
+++ b/arch/s390/include/asm/s390_ext.h
@@ -0,0 +1,32 @@
1#ifndef _S390_EXTINT_H
2#define _S390_EXTINT_H
3
4/*
5 * include/asm-s390/s390_ext.h
6 *
7 * S390 version
8 * Copyright IBM Corp. 1999,2007
9 * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com),
10 * Martin Schwidefsky (schwidefsky@de.ibm.com)
11 */
12
13#include <linux/types.h>
14
15typedef void (*ext_int_handler_t)(__u16 code);
16
17typedef struct ext_int_info_t {
18 struct ext_int_info_t *next;
19 ext_int_handler_t handler;
20 __u16 code;
21} ext_int_info_t;
22
23extern ext_int_info_t *ext_int_hash[];
24
25int register_external_interrupt(__u16 code, ext_int_handler_t handler);
26int register_early_external_interrupt(__u16 code, ext_int_handler_t handler,
27 ext_int_info_t *info);
28int unregister_external_interrupt(__u16 code, ext_int_handler_t handler);
29int unregister_early_external_interrupt(__u16 code, ext_int_handler_t handler,
30 ext_int_info_t *info);
31
32#endif
diff --git a/arch/s390/include/asm/s390_rdev.h b/arch/s390/include/asm/s390_rdev.h
new file mode 100644
index 000000000000..6fa20442a48c
--- /dev/null
+++ b/arch/s390/include/asm/s390_rdev.h
@@ -0,0 +1,15 @@
1/*
2 * include/asm-s390/ccwdev.h
3 *
4 * Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6 * Carsten Otte <cotte@de.ibm.com>
7 *
8 * Interface for s390 root device
9 */
10
11#ifndef _S390_RDEV_H_
12#define _S390_RDEV_H_
13extern struct device *s390_root_dev_register(const char *);
14extern void s390_root_dev_unregister(struct device *);
15#endif /* _S390_RDEV_H_ */
diff --git a/arch/s390/include/asm/scatterlist.h b/arch/s390/include/asm/scatterlist.h
new file mode 100644
index 000000000000..29ec8e28c8df
--- /dev/null
+++ b/arch/s390/include/asm/scatterlist.h
@@ -0,0 +1,19 @@
1#ifndef _ASMS390_SCATTERLIST_H
2#define _ASMS390_SCATTERLIST_H
3
4struct scatterlist {
5#ifdef CONFIG_DEBUG_SG
6 unsigned long sg_magic;
7#endif
8 unsigned long page_link;
9 unsigned int offset;
10 unsigned int length;
11};
12
13#ifdef __s390x__
14#define ISA_DMA_THRESHOLD (0xffffffffffffffffUL)
15#else
16#define ISA_DMA_THRESHOLD (0xffffffffUL)
17#endif
18
19#endif /* _ASMS390X_SCATTERLIST_H */
diff --git a/arch/s390/include/asm/schid.h b/arch/s390/include/asm/schid.h
new file mode 100644
index 000000000000..825503cf3dc2
--- /dev/null
+++ b/arch/s390/include/asm/schid.h
@@ -0,0 +1,32 @@
1#ifndef ASM_SCHID_H
2#define ASM_SCHID_H
3
4struct subchannel_id {
5 __u32 cssid : 8;
6 __u32 : 4;
7 __u32 m : 1;
8 __u32 ssid : 2;
9 __u32 one : 1;
10 __u32 sch_no : 16;
11} __attribute__ ((packed, aligned(4)));
12
13#ifdef __KERNEL__
14#include <linux/string.h>
15
16/* Helper function for sane state of pre-allocated subchannel_id. */
17static inline void
18init_subchannel_id(struct subchannel_id *schid)
19{
20 memset(schid, 0, sizeof(struct subchannel_id));
21 schid->one = 1;
22}
23
24static inline int
25schid_equal(struct subchannel_id *schid1, struct subchannel_id *schid2)
26{
27 return !memcmp(schid1, schid2, sizeof(struct subchannel_id));
28}
29
30#endif /* __KERNEL__ */
31
32#endif /* ASM_SCHID_H */
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h
new file mode 100644
index 000000000000..fed7bee650a0
--- /dev/null
+++ b/arch/s390/include/asm/sclp.h
@@ -0,0 +1,58 @@
1/*
2 * include/asm-s390/sclp.h
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_SCLP_H
9#define _ASM_S390_SCLP_H
10
11#include <linux/types.h>
12#include <asm/chpid.h>
13
14#define SCLP_CHP_INFO_MASK_SIZE 32
15
16struct sclp_chp_info {
17 u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
18 u8 standby[SCLP_CHP_INFO_MASK_SIZE];
19 u8 configured[SCLP_CHP_INFO_MASK_SIZE];
20};
21
22#define LOADPARM_LEN 8
23
24struct sclp_ipl_info {
25 int is_valid;
26 int has_dump;
27 char loadparm[LOADPARM_LEN];
28};
29
30struct sclp_cpu_entry {
31 u8 address;
32 u8 reserved0[13];
33 u8 type;
34 u8 reserved1;
35} __attribute__((packed));
36
37struct sclp_cpu_info {
38 unsigned int configured;
39 unsigned int standby;
40 unsigned int combined;
41 int has_cpu_type;
42 struct sclp_cpu_entry cpu[255];
43};
44
45int sclp_get_cpu_info(struct sclp_cpu_info *info);
46int sclp_cpu_configure(u8 cpu);
47int sclp_cpu_deconfigure(u8 cpu);
48void sclp_facilities_detect(void);
49unsigned long long sclp_get_rnmax(void);
50unsigned long long sclp_get_rzm(void);
51int sclp_sdias_blk_count(void);
52int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
53int sclp_chp_configure(struct chp_id chpid);
54int sclp_chp_deconfigure(struct chp_id chpid);
55int sclp_chp_read_info(struct sclp_chp_info *info);
56void sclp_get_ipl_info(struct sclp_ipl_info *info);
57
58#endif /* _ASM_S390_SCLP_H */
diff --git a/arch/s390/include/asm/sections.h b/arch/s390/include/asm/sections.h
new file mode 100644
index 000000000000..fbd9116eb17b
--- /dev/null
+++ b/arch/s390/include/asm/sections.h
@@ -0,0 +1,8 @@
1#ifndef _S390_SECTIONS_H
2#define _S390_SECTIONS_H
3
4#include <asm-generic/sections.h>
5
6extern char _eshared[], _ehead[];
7
8#endif
diff --git a/arch/s390/include/asm/segment.h b/arch/s390/include/asm/segment.h
new file mode 100644
index 000000000000..8bfce3475b1c
--- /dev/null
+++ b/arch/s390/include/asm/segment.h
@@ -0,0 +1,4 @@
1#ifndef _ASM_SEGMENT_H
2#define _ASM_SEGMENT_H
3
4#endif
diff --git a/arch/s390/include/asm/sembuf.h b/arch/s390/include/asm/sembuf.h
new file mode 100644
index 000000000000..32626b0cac4b
--- /dev/null
+++ b/arch/s390/include/asm/sembuf.h
@@ -0,0 +1,29 @@
1#ifndef _S390_SEMBUF_H
2#define _S390_SEMBUF_H
3
4/*
5 * The semid64_ds structure for S/390 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem (for !__s390x__)
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17#ifndef __s390x__
18 unsigned long __unused1;
19#endif /* ! __s390x__ */
20 __kernel_time_t sem_ctime; /* last change time */
21#ifndef __s390x__
22 unsigned long __unused2;
23#endif /* ! __s390x__ */
24 unsigned long sem_nsems; /* no. of semaphores in array */
25 unsigned long __unused3;
26 unsigned long __unused4;
27};
28
29#endif /* _S390_SEMBUF_H */
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
new file mode 100644
index 000000000000..2bd9faeb3919
--- /dev/null
+++ b/arch/s390/include/asm/setup.h
@@ -0,0 +1,140 @@
1/*
2 * include/asm-s390/setup.h
3 *
4 * S390 version
5 * Copyright IBM Corp. 1999,2006
6 */
7
8#ifndef _ASM_S390_SETUP_H
9#define _ASM_S390_SETUP_H
10
11#define COMMAND_LINE_SIZE 1024
12
13#define ARCH_COMMAND_LINE_SIZE 896
14
15#ifdef __KERNEL__
16
17#include <asm/types.h>
18
19#define PARMAREA 0x10400
20#define MEMORY_CHUNKS 256
21
22#ifndef __ASSEMBLY__
23
24#ifndef __s390x__
25#define IPL_DEVICE (*(unsigned long *) (0x10404))
26#define INITRD_START (*(unsigned long *) (0x1040C))
27#define INITRD_SIZE (*(unsigned long *) (0x10414))
28#else /* __s390x__ */
29#define IPL_DEVICE (*(unsigned long *) (0x10400))
30#define INITRD_START (*(unsigned long *) (0x10408))
31#define INITRD_SIZE (*(unsigned long *) (0x10410))
32#endif /* __s390x__ */
33#define COMMAND_LINE ((char *) (0x10480))
34
35#define CHUNK_READ_WRITE 0
36#define CHUNK_READ_ONLY 1
37
38struct mem_chunk {
39 unsigned long addr;
40 unsigned long size;
41 int type;
42};
43
44extern struct mem_chunk memory_chunk[];
45extern unsigned long real_memory_size;
46
47void detect_memory_layout(struct mem_chunk chunk[]);
48
49#ifdef CONFIG_S390_SWITCH_AMODE
50extern unsigned int switch_amode;
51#else
52#define switch_amode (0)
53#endif
54
55#ifdef CONFIG_S390_EXEC_PROTECT
56extern unsigned int s390_noexec;
57#else
58#define s390_noexec (0)
59#endif
60
61/*
62 * Machine features detected in head.S
63 */
64extern unsigned long machine_flags;
65
66#define MACHINE_FLAG_VM (1UL << 0)
67#define MACHINE_FLAG_IEEE (1UL << 1)
68#define MACHINE_FLAG_CSP (1UL << 3)
69#define MACHINE_FLAG_MVPG (1UL << 4)
70#define MACHINE_FLAG_DIAG44 (1UL << 5)
71#define MACHINE_FLAG_IDTE (1UL << 6)
72#define MACHINE_FLAG_DIAG9C (1UL << 7)
73#define MACHINE_FLAG_MVCOS (1UL << 8)
74#define MACHINE_FLAG_KVM (1UL << 9)
75#define MACHINE_FLAG_HPAGE (1UL << 10)
76#define MACHINE_FLAG_PFMF (1UL << 11)
77
78#define MACHINE_IS_VM (machine_flags & MACHINE_FLAG_VM)
79#define MACHINE_IS_KVM (machine_flags & MACHINE_FLAG_KVM)
80#define MACHINE_HAS_DIAG9C (machine_flags & MACHINE_FLAG_DIAG9C)
81
82#ifndef __s390x__
83#define MACHINE_HAS_IEEE (machine_flags & MACHINE_FLAG_IEEE)
84#define MACHINE_HAS_CSP (machine_flags & MACHINE_FLAG_CSP)
85#define MACHINE_HAS_IDTE (0)
86#define MACHINE_HAS_DIAG44 (1)
87#define MACHINE_HAS_MVPG (machine_flags & MACHINE_FLAG_MVPG)
88#define MACHINE_HAS_MVCOS (0)
89#define MACHINE_HAS_HPAGE (0)
90#define MACHINE_HAS_PFMF (0)
91#else /* __s390x__ */
92#define MACHINE_HAS_IEEE (1)
93#define MACHINE_HAS_CSP (1)
94#define MACHINE_HAS_IDTE (machine_flags & MACHINE_FLAG_IDTE)
95#define MACHINE_HAS_DIAG44 (machine_flags & MACHINE_FLAG_DIAG44)
96#define MACHINE_HAS_MVPG (1)
97#define MACHINE_HAS_MVCOS (machine_flags & MACHINE_FLAG_MVCOS)
98#define MACHINE_HAS_HPAGE (machine_flags & MACHINE_FLAG_HPAGE)
99#define MACHINE_HAS_PFMF (machine_flags & MACHINE_FLAG_PFMF)
100#endif /* __s390x__ */
101
102#define ZFCPDUMP_HSA_SIZE (32UL<<20)
103
104/*
105 * Console mode. Override with conmode=
106 */
107extern unsigned int console_mode;
108extern unsigned int console_devno;
109extern unsigned int console_irq;
110
111extern char vmhalt_cmd[];
112extern char vmpoff_cmd[];
113
114#define CONSOLE_IS_UNDEFINED (console_mode == 0)
115#define CONSOLE_IS_SCLP (console_mode == 1)
116#define CONSOLE_IS_3215 (console_mode == 2)
117#define CONSOLE_IS_3270 (console_mode == 3)
118#define SET_CONSOLE_SCLP do { console_mode = 1; } while (0)
119#define SET_CONSOLE_3215 do { console_mode = 2; } while (0)
120#define SET_CONSOLE_3270 do { console_mode = 3; } while (0)
121
122#define NSS_NAME_SIZE 8
123extern char kernel_nss_name[];
124
125#else /* __ASSEMBLY__ */
126
127#ifndef __s390x__
128#define IPL_DEVICE 0x10404
129#define INITRD_START 0x1040C
130#define INITRD_SIZE 0x10414
131#else /* __s390x__ */
132#define IPL_DEVICE 0x10400
133#define INITRD_START 0x10408
134#define INITRD_SIZE 0x10410
135#endif /* __s390x__ */
136#define COMMAND_LINE 0x10480
137
138#endif /* __ASSEMBLY__ */
139#endif /* __KERNEL__ */
140#endif /* _ASM_S390_SETUP_H */
diff --git a/arch/s390/include/asm/sfp-machine.h b/arch/s390/include/asm/sfp-machine.h
new file mode 100644
index 000000000000..4e16aede4b06
--- /dev/null
+++ b/arch/s390/include/asm/sfp-machine.h
@@ -0,0 +1,142 @@
1/* Machine-dependent software floating-point definitions.
2 S/390 kernel version.
3 Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Richard Henderson (rth@cygnus.com),
6 Jakub Jelinek (jj@ultra.linux.cz),
7 David S. Miller (davem@redhat.com) and
8 Peter Maydell (pmaydell@chiark.greenend.org.uk).
9
10 The GNU C Library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Library General Public License as
12 published by the Free Software Foundation; either version 2 of the
13 License, or (at your option) any later version.
14
15 The GNU C Library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
19
20 You should have received a copy of the GNU Library General Public
21 License along with the GNU C Library; see the file COPYING.LIB. If
22 not, write to the Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24
25#ifndef _SFP_MACHINE_H
26#define _SFP_MACHINE_H
27
28
29#define _FP_W_TYPE_SIZE 32
30#define _FP_W_TYPE unsigned int
31#define _FP_WS_TYPE signed int
32#define _FP_I_TYPE int
33
34#define _FP_MUL_MEAT_S(R,X,Y) \
35 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
36#define _FP_MUL_MEAT_D(R,X,Y) \
37 _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
38#define _FP_MUL_MEAT_Q(R,X,Y) \
39 _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
40
41#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y)
42#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
43#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
44
45#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
46#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
47#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
48#define _FP_NANSIGN_S 0
49#define _FP_NANSIGN_D 0
50#define _FP_NANSIGN_Q 0
51
52#define _FP_KEEPNANFRACP 1
53
54/*
55 * If one NaN is signaling and the other is not,
56 * we choose that one, otherwise we choose X.
57 */
58#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
59 do { \
60 if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
61 && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
62 { \
63 R##_s = Y##_s; \
64 _FP_FRAC_COPY_##wc(R,Y); \
65 } \
66 else \
67 { \
68 R##_s = X##_s; \
69 _FP_FRAC_COPY_##wc(R,X); \
70 } \
71 R##_c = FP_CLS_NAN; \
72 } while (0)
73
74/* Some assembly to speed things up. */
75#define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) ({ \
76 unsigned int __r2 = (x2) + (y2); \
77 unsigned int __r1 = (x1); \
78 unsigned int __r0 = (x0); \
79 asm volatile( \
80 " alr %2,%3\n" \
81 " brc 12,0f\n" \
82 " lhi 0,1\n" \
83 " alr %1,0\n" \
84 " brc 12,0f\n" \
85 " alr %0,0\n" \
86 "0:" \
87 : "+&d" (__r2), "+&d" (__r1), "+&d" (__r0) \
88 : "d" (y0), "i" (1) : "cc", "0" ); \
89 asm volatile( \
90 " alr %1,%2\n" \
91 " brc 12,0f\n" \
92 " ahi %0,1\n" \
93 "0:" \
94 : "+&d" (__r2), "+&d" (__r1) \
95 : "d" (y1) : "cc"); \
96 (r2) = __r2; \
97 (r1) = __r1; \
98 (r0) = __r0; \
99})
100
101#define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) ({ \
102 unsigned int __r2 = (x2) - (y2); \
103 unsigned int __r1 = (x1); \
104 unsigned int __r0 = (x0); \
105 asm volatile( \
106 " slr %2,%3\n" \
107 " brc 3,0f\n" \
108 " lhi 0,1\n" \
109 " slr %1,0\n" \
110 " brc 3,0f\n" \
111 " slr %0,0\n" \
112 "0:" \
113 : "+&d" (__r2), "+&d" (__r1), "+&d" (__r0) \
114 : "d" (y0) : "cc", "0"); \
115 asm volatile( \
116 " slr %1,%2\n" \
117 " brc 3,0f\n" \
118 " ahi %0,-1\n" \
119 "0:" \
120 : "+&d" (__r2), "+&d" (__r1) \
121 : "d" (y1) : "cc"); \
122 (r2) = __r2; \
123 (r1) = __r1; \
124 (r0) = __r0; \
125})
126
127#define __FP_FRAC_DEC_3(x2,x1,x0,y2,y1,y0) __FP_FRAC_SUB_3(x2,x1,x0,x2,x1,x0,y2,y1,y0)
128
129/* Obtain the current rounding mode. */
130#define FP_ROUNDMODE mode
131
132/* Exception flags. */
133#define FP_EX_INVALID 0x800000
134#define FP_EX_DIVZERO 0x400000
135#define FP_EX_OVERFLOW 0x200000
136#define FP_EX_UNDERFLOW 0x100000
137#define FP_EX_INEXACT 0x080000
138
139/* We write the results always */
140#define FP_INHIBIT_RESULTS 0
141
142#endif
diff --git a/arch/s390/include/asm/sfp-util.h b/arch/s390/include/asm/sfp-util.h
new file mode 100644
index 000000000000..0addc6466d95
--- /dev/null
+++ b/arch/s390/include/asm/sfp-util.h
@@ -0,0 +1,77 @@
1#include <linux/kernel.h>
2#include <linux/sched.h>
3#include <linux/types.h>
4#include <asm/byteorder.h>
5
6#define add_ssaaaa(sh, sl, ah, al, bh, bl) ({ \
7 unsigned int __sh = (ah); \
8 unsigned int __sl = (al); \
9 asm volatile( \
10 " alr %1,%3\n" \
11 " brc 12,0f\n" \
12 " ahi %0,1\n" \
13 "0: alr %0,%2" \
14 : "+&d" (__sh), "+d" (__sl) \
15 : "d" (bh), "d" (bl) : "cc"); \
16 (sh) = __sh; \
17 (sl) = __sl; \
18})
19
20#define sub_ddmmss(sh, sl, ah, al, bh, bl) ({ \
21 unsigned int __sh = (ah); \
22 unsigned int __sl = (al); \
23 asm volatile( \
24 " slr %1,%3\n" \
25 " brc 3,0f\n" \
26 " ahi %0,-1\n" \
27 "0: slr %0,%2" \
28 : "+&d" (__sh), "+d" (__sl) \
29 : "d" (bh), "d" (bl) : "cc"); \
30 (sh) = __sh; \
31 (sl) = __sl; \
32})
33
34/* a umul b = a mul b + (a>=2<<31) ? b<<32:0 + (b>=2<<31) ? a<<32:0 */
35#define umul_ppmm(wh, wl, u, v) ({ \
36 unsigned int __wh = u; \
37 unsigned int __wl = v; \
38 asm volatile( \
39 " ltr 1,%0\n" \
40 " mr 0,%1\n" \
41 " jnm 0f\n" \
42 " alr 0,%1\n" \
43 "0: ltr %1,%1\n" \
44 " jnm 1f\n" \
45 " alr 0,%0\n" \
46 "1: lr %0,0\n" \
47 " lr %1,1\n" \
48 : "+d" (__wh), "+d" (__wl) \
49 : : "0", "1", "cc"); \
50 wh = __wh; \
51 wl = __wl; \
52})
53
54#ifdef __s390x__
55#define udiv_qrnnd(q, r, n1, n0, d) \
56 do { unsigned long __n; \
57 unsigned int __r, __d; \
58 __n = ((unsigned long)(n1) << 32) + n0; \
59 __d = (d); \
60 (q) = __n / __d; \
61 (r) = __n % __d; \
62 } while (0)
63#else
64#define udiv_qrnnd(q, r, n1, n0, d) \
65 do { unsigned int __r; \
66 (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \
67 (r) = __r; \
68 } while (0)
69extern unsigned long __udiv_qrnnd (unsigned int *, unsigned int,
70 unsigned int , unsigned int);
71#endif
72
73#define UDIV_NEEDS_NORMALIZATION 0
74
75#define abort() return 0
76
77#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/arch/s390/include/asm/shmbuf.h b/arch/s390/include/asm/shmbuf.h
new file mode 100644
index 000000000000..eed2e280ce37
--- /dev/null
+++ b/arch/s390/include/asm/shmbuf.h
@@ -0,0 +1,48 @@
1#ifndef _S390_SHMBUF_H
2#define _S390_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for S/390 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem (for !__s390x__)
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18#ifndef __s390x__
19 unsigned long __unused1;
20#endif /* ! __s390x__ */
21 __kernel_time_t shm_dtime; /* last detach time */
22#ifndef __s390x__
23 unsigned long __unused2;
24#endif /* ! __s390x__ */
25 __kernel_time_t shm_ctime; /* last change time */
26#ifndef __s390x__
27 unsigned long __unused3;
28#endif /* ! __s390x__ */
29 __kernel_pid_t shm_cpid; /* pid of creator */
30 __kernel_pid_t shm_lpid; /* pid of last operator */
31 unsigned long shm_nattch; /* no. of current attaches */
32 unsigned long __unused4;
33 unsigned long __unused5;
34};
35
36struct shminfo64 {
37 unsigned long shmmax;
38 unsigned long shmmin;
39 unsigned long shmmni;
40 unsigned long shmseg;
41 unsigned long shmall;
42 unsigned long __unused1;
43 unsigned long __unused2;
44 unsigned long __unused3;
45 unsigned long __unused4;
46};
47
48#endif /* _S390_SHMBUF_H */
diff --git a/arch/s390/include/asm/shmparam.h b/arch/s390/include/asm/shmparam.h
new file mode 100644
index 000000000000..c2e0c0508e73
--- /dev/null
+++ b/arch/s390/include/asm/shmparam.h
@@ -0,0 +1,13 @@
1/*
2 * include/asm-s390/shmparam.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/shmparam.h"
7 */
8#ifndef _ASM_S390_SHMPARAM_H
9#define _ASM_S390_SHMPARAM_H
10
11#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
12
13#endif /* _ASM_S390_SHMPARAM_H */
diff --git a/arch/s390/include/asm/sigcontext.h b/arch/s390/include/asm/sigcontext.h
new file mode 100644
index 000000000000..aeb6e0b13329
--- /dev/null
+++ b/arch/s390/include/asm/sigcontext.h
@@ -0,0 +1,71 @@
1/*
2 * include/asm-s390/sigcontext.h
3 *
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 */
7
8#ifndef _ASM_S390_SIGCONTEXT_H
9#define _ASM_S390_SIGCONTEXT_H
10
11#include <linux/compiler.h>
12
13#define __NUM_GPRS 16
14#define __NUM_FPRS 16
15#define __NUM_ACRS 16
16
17#ifndef __s390x__
18
19/* Has to be at least _NSIG_WORDS from asm/signal.h */
20#define _SIGCONTEXT_NSIG 64
21#define _SIGCONTEXT_NSIG_BPW 32
22/* Size of stack frame allocated when calling signal handler. */
23#define __SIGNAL_FRAMESIZE 96
24
25#else /* __s390x__ */
26
27/* Has to be at least _NSIG_WORDS from asm/signal.h */
28#define _SIGCONTEXT_NSIG 64
29#define _SIGCONTEXT_NSIG_BPW 64
30/* Size of stack frame allocated when calling signal handler. */
31#define __SIGNAL_FRAMESIZE 160
32
33#endif /* __s390x__ */
34
35#define _SIGCONTEXT_NSIG_WORDS (_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW)
36#define _SIGMASK_COPY_SIZE (sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS)
37
38typedef struct
39{
40 unsigned long mask;
41 unsigned long addr;
42} __attribute__ ((aligned(8))) _psw_t;
43
44typedef struct
45{
46 _psw_t psw;
47 unsigned long gprs[__NUM_GPRS];
48 unsigned int acrs[__NUM_ACRS];
49} _s390_regs_common;
50
51typedef struct
52{
53 unsigned int fpc;
54 double fprs[__NUM_FPRS];
55} _s390_fp_regs;
56
57typedef struct
58{
59 _s390_regs_common regs;
60 _s390_fp_regs fpregs;
61} _sigregs;
62
63struct sigcontext
64{
65 unsigned long oldmask[_SIGCONTEXT_NSIG_WORDS];
66 _sigregs __user *sregs;
67};
68
69
70#endif
71
diff --git a/arch/s390/include/asm/siginfo.h b/arch/s390/include/asm/siginfo.h
new file mode 100644
index 000000000000..e0ff1ab054be
--- /dev/null
+++ b/arch/s390/include/asm/siginfo.h
@@ -0,0 +1,18 @@
1/*
2 * include/asm-s390/siginfo.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/siginfo.h"
7 */
8
9#ifndef _S390_SIGINFO_H
10#define _S390_SIGINFO_H
11
12#ifdef __s390x__
13#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
14#endif
15
16#include <asm-generic/siginfo.h>
17
18#endif
diff --git a/arch/s390/include/asm/signal.h b/arch/s390/include/asm/signal.h
new file mode 100644
index 000000000000..f6cfddb278cb
--- /dev/null
+++ b/arch/s390/include/asm/signal.h
@@ -0,0 +1,172 @@
1/*
2 * include/asm-s390/signal.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/signal.h"
7 */
8
9#ifndef _ASMS390_SIGNAL_H
10#define _ASMS390_SIGNAL_H
11
12#include <linux/types.h>
13#include <linux/time.h>
14
15/* Avoid too many header ordering problems. */
16struct siginfo;
17struct pt_regs;
18
19#ifdef __KERNEL__
20/* Most things should be clean enough to redefine this at will, if care
21 is taken to make libc match. */
22#include <asm/sigcontext.h>
23#define _NSIG _SIGCONTEXT_NSIG
24#define _NSIG_BPW _SIGCONTEXT_NSIG_BPW
25#define _NSIG_WORDS _SIGCONTEXT_NSIG_WORDS
26
27typedef unsigned long old_sigset_t; /* at least 32 bits */
28
29typedef struct {
30 unsigned long sig[_NSIG_WORDS];
31} sigset_t;
32
33#else
34/* Here we must cater to libcs that poke about in kernel headers. */
35
36#define NSIG 32
37typedef unsigned long sigset_t;
38
39#endif /* __KERNEL__ */
40
41#define SIGHUP 1
42#define SIGINT 2
43#define SIGQUIT 3
44#define SIGILL 4
45#define SIGTRAP 5
46#define SIGABRT 6
47#define SIGIOT 6
48#define SIGBUS 7
49#define SIGFPE 8
50#define SIGKILL 9
51#define SIGUSR1 10
52#define SIGSEGV 11
53#define SIGUSR2 12
54#define SIGPIPE 13
55#define SIGALRM 14
56#define SIGTERM 15
57#define SIGSTKFLT 16
58#define SIGCHLD 17
59#define SIGCONT 18
60#define SIGSTOP 19
61#define SIGTSTP 20
62#define SIGTTIN 21
63#define SIGTTOU 22
64#define SIGURG 23
65#define SIGXCPU 24
66#define SIGXFSZ 25
67#define SIGVTALRM 26
68#define SIGPROF 27
69#define SIGWINCH 28
70#define SIGIO 29
71#define SIGPOLL SIGIO
72/*
73#define SIGLOST 29
74*/
75#define SIGPWR 30
76#define SIGSYS 31
77#define SIGUNUSED 31
78
79/* These should not be considered constants from userland. */
80#define SIGRTMIN 32
81#define SIGRTMAX _NSIG
82
83/*
84 * SA_FLAGS values:
85 *
86 * SA_ONSTACK indicates that a registered stack_t will be used.
87 * SA_RESTART flag to get restarting signals (which were the default long ago)
88 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
89 * SA_RESETHAND clears the handler when the signal is delivered.
90 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
91 * SA_NODEFER prevents the current signal from being masked in the handler.
92 *
93 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
94 * Unix names RESETHAND and NODEFER respectively.
95 */
96#define SA_NOCLDSTOP 0x00000001
97#define SA_NOCLDWAIT 0x00000002
98#define SA_SIGINFO 0x00000004
99#define SA_ONSTACK 0x08000000
100#define SA_RESTART 0x10000000
101#define SA_NODEFER 0x40000000
102#define SA_RESETHAND 0x80000000
103
104#define SA_NOMASK SA_NODEFER
105#define SA_ONESHOT SA_RESETHAND
106
107#define SA_RESTORER 0x04000000
108
109/*
110 * sigaltstack controls
111 */
112#define SS_ONSTACK 1
113#define SS_DISABLE 2
114
115#define MINSIGSTKSZ 2048
116#define SIGSTKSZ 8192
117
118#include <asm-generic/signal.h>
119
120#ifdef __KERNEL__
121struct old_sigaction {
122 __sighandler_t sa_handler;
123 old_sigset_t sa_mask;
124 unsigned long sa_flags;
125 void (*sa_restorer)(void);
126};
127
128struct sigaction {
129 __sighandler_t sa_handler;
130 unsigned long sa_flags;
131 void (*sa_restorer)(void);
132 sigset_t sa_mask; /* mask last for extensibility */
133};
134
135struct k_sigaction {
136 struct sigaction sa;
137};
138
139#define ptrace_signal_deliver(regs, cookie) do { } while (0)
140
141#else
142/* Here we must cater to libcs that poke about in kernel headers. */
143
144struct sigaction {
145 union {
146 __sighandler_t _sa_handler;
147 void (*_sa_sigaction)(int, struct siginfo *, void *);
148 } _u;
149#ifndef __s390x__ /* lovely */
150 sigset_t sa_mask;
151 unsigned long sa_flags;
152 void (*sa_restorer)(void);
153#else /* __s390x__ */
154 unsigned long sa_flags;
155 void (*sa_restorer)(void);
156 sigset_t sa_mask;
157#endif /* __s390x__ */
158};
159
160#define sa_handler _u._sa_handler
161#define sa_sigaction _u._sa_sigaction
162
163#endif /* __KERNEL__ */
164
165typedef struct sigaltstack {
166 void __user *ss_sp;
167 int ss_flags;
168 size_t ss_size;
169} stack_t;
170
171
172#endif
diff --git a/arch/s390/include/asm/sigp.h b/arch/s390/include/asm/sigp.h
new file mode 100644
index 000000000000..e16d56f8dfe1
--- /dev/null
+++ b/arch/s390/include/asm/sigp.h
@@ -0,0 +1,126 @@
1/*
2 * include/asm-s390/sigp.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 * Heiko Carstens (heiko.carstens@de.ibm.com)
9 *
10 * sigp.h by D.J. Barrow (c) IBM 1999
11 * contains routines / structures for signalling other S/390 processors in an
12 * SMP configuration.
13 */
14
15#ifndef __SIGP__
16#define __SIGP__
17
18#include <asm/ptrace.h>
19#include <asm/atomic.h>
20
21/* get real cpu address from logical cpu number */
22extern volatile int __cpu_logical_map[];
23
24typedef enum
25{
26 sigp_unassigned=0x0,
27 sigp_sense,
28 sigp_external_call,
29 sigp_emergency_signal,
30 sigp_start,
31 sigp_stop,
32 sigp_restart,
33 sigp_unassigned1,
34 sigp_unassigned2,
35 sigp_stop_and_store_status,
36 sigp_unassigned3,
37 sigp_initial_cpu_reset,
38 sigp_cpu_reset,
39 sigp_set_prefix,
40 sigp_store_status_at_address,
41 sigp_store_extended_status_at_address
42} sigp_order_code;
43
44typedef __u32 sigp_status_word;
45
46typedef enum
47{
48 sigp_order_code_accepted=0,
49 sigp_status_stored,
50 sigp_busy,
51 sigp_not_operational
52} sigp_ccode;
53
54
55/*
56 * Definitions for the external call
57 */
58
59/* 'Bit' signals, asynchronous */
60typedef enum
61{
62 ec_schedule=0,
63 ec_call_function,
64 ec_bit_last
65} ec_bit_sig;
66
67/*
68 * Signal processor
69 */
70static inline sigp_ccode
71signal_processor(__u16 cpu_addr, sigp_order_code order_code)
72{
73 register unsigned long reg1 asm ("1") = 0;
74 sigp_ccode ccode;
75
76 asm volatile(
77 " sigp %1,%2,0(%3)\n"
78 " ipm %0\n"
79 " srl %0,28\n"
80 : "=d" (ccode)
81 : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
82 "a" (order_code) : "cc" , "memory");
83 return ccode;
84}
85
86/*
87 * Signal processor with parameter
88 */
89static inline sigp_ccode
90signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code)
91{
92 register unsigned int reg1 asm ("1") = parameter;
93 sigp_ccode ccode;
94
95 asm volatile(
96 " sigp %1,%2,0(%3)\n"
97 " ipm %0\n"
98 " srl %0,28\n"
99 : "=d" (ccode)
100 : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
101 "a" (order_code) : "cc" , "memory");
102 return ccode;
103}
104
105/*
106 * Signal processor with parameter and return status
107 */
108static inline sigp_ccode
109signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr,
110 sigp_order_code order_code)
111{
112 register unsigned int reg1 asm ("1") = parameter;
113 sigp_ccode ccode;
114
115 asm volatile(
116 " sigp %1,%2,0(%3)\n"
117 " ipm %0\n"
118 " srl %0,28\n"
119 : "=d" (ccode), "+d" (reg1)
120 : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
121 : "cc" , "memory");
122 *statusptr = reg1;
123 return ccode;
124}
125
126#endif /* __SIGP__ */
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h
new file mode 100644
index 000000000000..ae89cf2478fc
--- /dev/null
+++ b/arch/s390/include/asm/smp.h
@@ -0,0 +1,116 @@
1/*
2 * include/asm-s390/smp.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 * Heiko Carstens (heiko.carstens@de.ibm.com)
9 */
10#ifndef __ASM_SMP_H
11#define __ASM_SMP_H
12
13#include <linux/threads.h>
14#include <linux/cpumask.h>
15#include <linux/bitops.h>
16
17#if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__)
18
19#include <asm/lowcore.h>
20#include <asm/sigp.h>
21#include <asm/ptrace.h>
22#include <asm/system.h>
23
24/*
25 s390 specific smp.c headers
26 */
27typedef struct
28{
29 int intresting;
30 sigp_ccode ccode;
31 __u32 status;
32 __u16 cpu;
33} sigp_info;
34
35extern void machine_restart_smp(char *);
36extern void machine_halt_smp(void);
37extern void machine_power_off_smp(void);
38
39#define NO_PROC_ID 0xFF /* No processor magic marker */
40
41/*
42 * This magic constant controls our willingness to transfer
43 * a process across CPUs. Such a transfer incurs misses on the L1
44 * cache, and on a P6 or P5 with multiple L2 caches L2 hits. My
45 * gut feeling is this will vary by board in value. For a board
46 * with separate L2 cache it probably depends also on the RSS, and
47 * for a board with shared L2 cache it ought to decay fast as other
48 * processes are run.
49 */
50
51#define PROC_CHANGE_PENALTY 20 /* Schedule penalty */
52
53#define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr)
54
55static inline __u16 hard_smp_processor_id(void)
56{
57 return stap();
58}
59
60/*
61 * returns 1 if cpu is in stopped/check stopped state or not operational
62 * returns 0 otherwise
63 */
64static inline int
65smp_cpu_not_running(int cpu)
66{
67 __u32 status;
68
69 switch (signal_processor_ps(&status, 0, cpu, sigp_sense)) {
70 case sigp_order_code_accepted:
71 case sigp_status_stored:
72 /* Check for stopped and check stop state */
73 if (status & 0x50)
74 return 1;
75 break;
76 case sigp_not_operational:
77 return 1;
78 default:
79 break;
80 }
81 return 0;
82}
83
84#define cpu_logical_map(cpu) (cpu)
85
86extern int __cpu_disable (void);
87extern void __cpu_die (unsigned int cpu);
88extern void cpu_die (void) __attribute__ ((noreturn));
89extern int __cpu_up (unsigned int cpu);
90
91extern struct mutex smp_cpu_state_mutex;
92extern int smp_cpu_polarization[];
93
94extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *),
95 void *info, int wait);
96#endif
97
98#ifndef CONFIG_SMP
99static inline void smp_send_stop(void)
100{
101 /* Disable all interrupts/machine checks */
102 __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
103}
104
105#define hard_smp_processor_id() 0
106#define smp_cpu_not_running(cpu) 1
107#endif
108
109#ifdef CONFIG_HOTPLUG_CPU
110extern int smp_rescan_cpus(void);
111#else
112static inline int smp_rescan_cpus(void) { return 0; }
113#endif
114
115extern union save_area *zfcpdump_save_areas[NR_CPUS + 1];
116#endif
diff --git a/arch/s390/include/asm/socket.h b/arch/s390/include/asm/socket.h
new file mode 100644
index 000000000000..c786ab623b2d
--- /dev/null
+++ b/arch/s390/include/asm/socket.h
@@ -0,0 +1,65 @@
1/*
2 * include/asm-s390/socket.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/socket.h"
7 */
8
9#ifndef _ASM_SOCKET_H
10#define _ASM_SOCKET_H
11
12#include <asm/sockios.h>
13
14/* For setsockopt(2) */
15#define SOL_SOCKET 1
16
17#define SO_DEBUG 1
18#define SO_REUSEADDR 2
19#define SO_TYPE 3
20#define SO_ERROR 4
21#define SO_DONTROUTE 5
22#define SO_BROADCAST 6
23#define SO_SNDBUF 7
24#define SO_RCVBUF 8
25#define SO_SNDBUFFORCE 32
26#define SO_RCVBUFFORCE 33
27#define SO_KEEPALIVE 9
28#define SO_OOBINLINE 10
29#define SO_NO_CHECK 11
30#define SO_PRIORITY 12
31#define SO_LINGER 13
32#define SO_BSDCOMPAT 14
33/* To add :#define SO_REUSEPORT 15 */
34#define SO_PASSCRED 16
35#define SO_PEERCRED 17
36#define SO_RCVLOWAT 18
37#define SO_SNDLOWAT 19
38#define SO_RCVTIMEO 20
39#define SO_SNDTIMEO 21
40
41/* Security levels - as per NRL IPv6 - don't actually do anything */
42#define SO_SECURITY_AUTHENTICATION 22
43#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
44#define SO_SECURITY_ENCRYPTION_NETWORK 24
45
46#define SO_BINDTODEVICE 25
47
48/* Socket filtering */
49#define SO_ATTACH_FILTER 26
50#define SO_DETACH_FILTER 27
51
52#define SO_PEERNAME 28
53#define SO_TIMESTAMP 29
54#define SCM_TIMESTAMP SO_TIMESTAMP
55
56#define SO_ACCEPTCONN 30
57
58#define SO_PEERSEC 31
59#define SO_PASSSEC 34
60#define SO_TIMESTAMPNS 35
61#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
62
63#define SO_MARK 36
64
65#endif /* _ASM_SOCKET_H */
diff --git a/arch/s390/include/asm/sockios.h b/arch/s390/include/asm/sockios.h
new file mode 100644
index 000000000000..f4fc16c7da59
--- /dev/null
+++ b/arch/s390/include/asm/sockios.h
@@ -0,0 +1,21 @@
1/*
2 * include/asm-s390/sockios.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/sockios.h"
7 */
8
9#ifndef __ARCH_S390_SOCKIOS__
10#define __ARCH_S390_SOCKIOS__
11
12/* Socket-level I/O control calls. */
13#define FIOSETOWN 0x8901
14#define SIOCSPGRP 0x8902
15#define FIOGETOWN 0x8903
16#define SIOCGPGRP 0x8904
17#define SIOCATMARK 0x8905
18#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
19#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
20
21#endif
diff --git a/arch/s390/include/asm/sparsemem.h b/arch/s390/include/asm/sparsemem.h
new file mode 100644
index 000000000000..545d219e6a2d
--- /dev/null
+++ b/arch/s390/include/asm/sparsemem.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_S390_SPARSEMEM_H
2#define _ASM_S390_SPARSEMEM_H
3
4#ifdef CONFIG_64BIT
5
6#define SECTION_SIZE_BITS 28
7#define MAX_PHYSADDR_BITS 42
8#define MAX_PHYSMEM_BITS 42
9
10#else
11
12#define SECTION_SIZE_BITS 25
13#define MAX_PHYSADDR_BITS 31
14#define MAX_PHYSMEM_BITS 31
15
16#endif /* CONFIG_64BIT */
17
18#endif /* _ASM_S390_SPARSEMEM_H */
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h
new file mode 100644
index 000000000000..df84ae96915f
--- /dev/null
+++ b/arch/s390/include/asm/spinlock.h
@@ -0,0 +1,178 @@
1/*
2 * include/asm-s390/spinlock.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * Derived from "include/asm-i386/spinlock.h"
9 */
10
11#ifndef __ASM_SPINLOCK_H
12#define __ASM_SPINLOCK_H
13
14#include <linux/smp.h>
15
16#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
17
18static inline int
19_raw_compare_and_swap(volatile unsigned int *lock,
20 unsigned int old, unsigned int new)
21{
22 asm volatile(
23 " cs %0,%3,%1"
24 : "=d" (old), "=Q" (*lock)
25 : "0" (old), "d" (new), "Q" (*lock)
26 : "cc", "memory" );
27 return old;
28}
29
30#else /* __GNUC__ */
31
32static inline int
33_raw_compare_and_swap(volatile unsigned int *lock,
34 unsigned int old, unsigned int new)
35{
36 asm volatile(
37 " cs %0,%3,0(%4)"
38 : "=d" (old), "=m" (*lock)
39 : "0" (old), "d" (new), "a" (lock), "m" (*lock)
40 : "cc", "memory" );
41 return old;
42}
43
44#endif /* __GNUC__ */
45
46/*
47 * Simple spin lock operations. There are two variants, one clears IRQ's
48 * on the local processor, one does not.
49 *
50 * We make no fairness assumptions. They have a cost.
51 *
52 * (the type definitions are in asm/spinlock_types.h)
53 */
54
55#define __raw_spin_is_locked(x) ((x)->owner_cpu != 0)
56#define __raw_spin_unlock_wait(lock) \
57 do { while (__raw_spin_is_locked(lock)) \
58 _raw_spin_relax(lock); } while (0)
59
60extern void _raw_spin_lock_wait(raw_spinlock_t *);
61extern void _raw_spin_lock_wait_flags(raw_spinlock_t *, unsigned long flags);
62extern int _raw_spin_trylock_retry(raw_spinlock_t *);
63extern void _raw_spin_relax(raw_spinlock_t *lock);
64
65static inline void __raw_spin_lock(raw_spinlock_t *lp)
66{
67 int old;
68
69 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
70 if (likely(old == 0))
71 return;
72 _raw_spin_lock_wait(lp);
73}
74
75static inline void __raw_spin_lock_flags(raw_spinlock_t *lp,
76 unsigned long flags)
77{
78 int old;
79
80 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
81 if (likely(old == 0))
82 return;
83 _raw_spin_lock_wait_flags(lp, flags);
84}
85
86static inline int __raw_spin_trylock(raw_spinlock_t *lp)
87{
88 int old;
89
90 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
91 if (likely(old == 0))
92 return 1;
93 return _raw_spin_trylock_retry(lp);
94}
95
96static inline void __raw_spin_unlock(raw_spinlock_t *lp)
97{
98 _raw_compare_and_swap(&lp->owner_cpu, lp->owner_cpu, 0);
99}
100
101/*
102 * Read-write spinlocks, allowing multiple readers
103 * but only one writer.
104 *
105 * NOTE! it is quite common to have readers in interrupts
106 * but no interrupt writers. For those circumstances we
107 * can "mix" irq-safe locks - any writer needs to get a
108 * irq-safe write-lock, but readers can get non-irqsafe
109 * read-locks.
110 */
111
112/**
113 * read_can_lock - would read_trylock() succeed?
114 * @lock: the rwlock in question.
115 */
116#define __raw_read_can_lock(x) ((int)(x)->lock >= 0)
117
118/**
119 * write_can_lock - would write_trylock() succeed?
120 * @lock: the rwlock in question.
121 */
122#define __raw_write_can_lock(x) ((x)->lock == 0)
123
124extern void _raw_read_lock_wait(raw_rwlock_t *lp);
125extern int _raw_read_trylock_retry(raw_rwlock_t *lp);
126extern void _raw_write_lock_wait(raw_rwlock_t *lp);
127extern int _raw_write_trylock_retry(raw_rwlock_t *lp);
128
129static inline void __raw_read_lock(raw_rwlock_t *rw)
130{
131 unsigned int old;
132 old = rw->lock & 0x7fffffffU;
133 if (_raw_compare_and_swap(&rw->lock, old, old + 1) != old)
134 _raw_read_lock_wait(rw);
135}
136
137static inline void __raw_read_unlock(raw_rwlock_t *rw)
138{
139 unsigned int old, cmp;
140
141 old = rw->lock;
142 do {
143 cmp = old;
144 old = _raw_compare_and_swap(&rw->lock, old, old - 1);
145 } while (cmp != old);
146}
147
148static inline void __raw_write_lock(raw_rwlock_t *rw)
149{
150 if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0))
151 _raw_write_lock_wait(rw);
152}
153
154static inline void __raw_write_unlock(raw_rwlock_t *rw)
155{
156 _raw_compare_and_swap(&rw->lock, 0x80000000, 0);
157}
158
159static inline int __raw_read_trylock(raw_rwlock_t *rw)
160{
161 unsigned int old;
162 old = rw->lock & 0x7fffffffU;
163 if (likely(_raw_compare_and_swap(&rw->lock, old, old + 1) == old))
164 return 1;
165 return _raw_read_trylock_retry(rw);
166}
167
168static inline int __raw_write_trylock(raw_rwlock_t *rw)
169{
170 if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0))
171 return 1;
172 return _raw_write_trylock_retry(rw);
173}
174
175#define _raw_read_relax(lock) cpu_relax()
176#define _raw_write_relax(lock) cpu_relax()
177
178#endif /* __ASM_SPINLOCK_H */
diff --git a/arch/s390/include/asm/spinlock_types.h b/arch/s390/include/asm/spinlock_types.h
new file mode 100644
index 000000000000..654abc40de04
--- /dev/null
+++ b/arch/s390/include/asm/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int owner_cpu;
10} __attribute__ ((aligned (4))) raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/arch/s390/include/asm/stat.h b/arch/s390/include/asm/stat.h
new file mode 100644
index 000000000000..d92959eebb65
--- /dev/null
+++ b/arch/s390/include/asm/stat.h
@@ -0,0 +1,105 @@
1/*
2 * include/asm-s390/stat.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/stat.h"
7 */
8
9#ifndef _S390_STAT_H
10#define _S390_STAT_H
11
12#ifndef __s390x__
13struct __old_kernel_stat {
14 unsigned short st_dev;
15 unsigned short st_ino;
16 unsigned short st_mode;
17 unsigned short st_nlink;
18 unsigned short st_uid;
19 unsigned short st_gid;
20 unsigned short st_rdev;
21 unsigned long st_size;
22 unsigned long st_atime;
23 unsigned long st_mtime;
24 unsigned long st_ctime;
25};
26
27struct stat {
28 unsigned short st_dev;
29 unsigned short __pad1;
30 unsigned long st_ino;
31 unsigned short st_mode;
32 unsigned short st_nlink;
33 unsigned short st_uid;
34 unsigned short st_gid;
35 unsigned short st_rdev;
36 unsigned short __pad2;
37 unsigned long st_size;
38 unsigned long st_blksize;
39 unsigned long st_blocks;
40 unsigned long st_atime;
41 unsigned long st_atime_nsec;
42 unsigned long st_mtime;
43 unsigned long st_mtime_nsec;
44 unsigned long st_ctime;
45 unsigned long st_ctime_nsec;
46 unsigned long __unused4;
47 unsigned long __unused5;
48};
49
50/* This matches struct stat64 in glibc2.1, hence the absolutely
51 * insane amounts of padding around dev_t's.
52 */
53struct stat64 {
54 unsigned long long st_dev;
55 unsigned int __pad1;
56#define STAT64_HAS_BROKEN_ST_INO 1
57 unsigned long __st_ino;
58 unsigned int st_mode;
59 unsigned int st_nlink;
60 unsigned long st_uid;
61 unsigned long st_gid;
62 unsigned long long st_rdev;
63 unsigned int __pad3;
64 long long st_size;
65 unsigned long st_blksize;
66 unsigned char __pad4[4];
67 unsigned long __pad5; /* future possible st_blocks high bits */
68 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
69 unsigned long st_atime;
70 unsigned long st_atime_nsec;
71 unsigned long st_mtime;
72 unsigned long st_mtime_nsec;
73 unsigned long st_ctime;
74 unsigned long st_ctime_nsec; /* will be high 32 bits of ctime someday */
75 unsigned long long st_ino;
76};
77
78#else /* __s390x__ */
79
80struct stat {
81 unsigned long st_dev;
82 unsigned long st_ino;
83 unsigned long st_nlink;
84 unsigned int st_mode;
85 unsigned int st_uid;
86 unsigned int st_gid;
87 unsigned int __pad1;
88 unsigned long st_rdev;
89 unsigned long st_size;
90 unsigned long st_atime;
91 unsigned long st_atime_nsec;
92 unsigned long st_mtime;
93 unsigned long st_mtime_nsec;
94 unsigned long st_ctime;
95 unsigned long st_ctime_nsec;
96 unsigned long st_blksize;
97 long st_blocks;
98 unsigned long __unused[3];
99};
100
101#endif /* __s390x__ */
102
103#define STAT_HAVE_NSEC 1
104
105#endif
diff --git a/arch/s390/include/asm/statfs.h b/arch/s390/include/asm/statfs.h
new file mode 100644
index 000000000000..099a45579190
--- /dev/null
+++ b/arch/s390/include/asm/statfs.h
@@ -0,0 +1,71 @@
1/*
2 * include/asm-s390/statfs.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/statfs.h"
7 */
8
9#ifndef _S390_STATFS_H
10#define _S390_STATFS_H
11
12#ifndef __s390x__
13#include <asm-generic/statfs.h>
14#else
15
16#ifndef __KERNEL_STRICT_NAMES
17
18#include <linux/types.h>
19
20typedef __kernel_fsid_t fsid_t;
21
22#endif
23
24/*
25 * This is ugly -- we're already 64-bit clean, so just duplicate the
26 * definitions.
27 */
28struct statfs {
29 int f_type;
30 int f_bsize;
31 long f_blocks;
32 long f_bfree;
33 long f_bavail;
34 long f_files;
35 long f_ffree;
36 __kernel_fsid_t f_fsid;
37 int f_namelen;
38 int f_frsize;
39 int f_spare[5];
40};
41
42struct statfs64 {
43 int f_type;
44 int f_bsize;
45 long f_blocks;
46 long f_bfree;
47 long f_bavail;
48 long f_files;
49 long f_ffree;
50 __kernel_fsid_t f_fsid;
51 int f_namelen;
52 int f_frsize;
53 int f_spare[5];
54};
55
56struct compat_statfs64 {
57 __u32 f_type;
58 __u32 f_bsize;
59 __u64 f_blocks;
60 __u64 f_bfree;
61 __u64 f_bavail;
62 __u64 f_files;
63 __u64 f_ffree;
64 __kernel_fsid_t f_fsid;
65 __u32 f_namelen;
66 __u32 f_frsize;
67 __u32 f_spare[5];
68};
69
70#endif /* __s390x__ */
71#endif
diff --git a/arch/s390/include/asm/string.h b/arch/s390/include/asm/string.h
new file mode 100644
index 000000000000..d074673a6d9b
--- /dev/null
+++ b/arch/s390/include/asm/string.h
@@ -0,0 +1,143 @@
1/*
2 * include/asm-s390/string.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 */
8
9#ifndef _S390_STRING_H_
10#define _S390_STRING_H_
11
12#ifdef __KERNEL__
13
14#ifndef _LINUX_TYPES_H
15#include <linux/types.h>
16#endif
17
18#define __HAVE_ARCH_MEMCHR /* inline & arch function */
19#define __HAVE_ARCH_MEMCMP /* arch function */
20#define __HAVE_ARCH_MEMCPY /* gcc builtin & arch function */
21#define __HAVE_ARCH_MEMSCAN /* inline & arch function */
22#define __HAVE_ARCH_MEMSET /* gcc builtin & arch function */
23#define __HAVE_ARCH_STRCAT /* inline & arch function */
24#define __HAVE_ARCH_STRCMP /* arch function */
25#define __HAVE_ARCH_STRCPY /* inline & arch function */
26#define __HAVE_ARCH_STRLCAT /* arch function */
27#define __HAVE_ARCH_STRLCPY /* arch function */
28#define __HAVE_ARCH_STRLEN /* inline & arch function */
29#define __HAVE_ARCH_STRNCAT /* arch function */
30#define __HAVE_ARCH_STRNCPY /* arch function */
31#define __HAVE_ARCH_STRNLEN /* inline & arch function */
32#define __HAVE_ARCH_STRRCHR /* arch function */
33#define __HAVE_ARCH_STRSTR /* arch function */
34
35/* Prototypes for non-inlined arch strings functions. */
36extern int memcmp(const void *, const void *, size_t);
37extern void *memcpy(void *, const void *, size_t);
38extern void *memset(void *, int, size_t);
39extern int strcmp(const char *,const char *);
40extern size_t strlcat(char *, const char *, size_t);
41extern size_t strlcpy(char *, const char *, size_t);
42extern char *strncat(char *, const char *, size_t);
43extern char *strncpy(char *, const char *, size_t);
44extern char *strrchr(const char *, int);
45extern char *strstr(const char *, const char *);
46
47#undef __HAVE_ARCH_MEMMOVE
48#undef __HAVE_ARCH_STRCHR
49#undef __HAVE_ARCH_STRNCHR
50#undef __HAVE_ARCH_STRNCMP
51#undef __HAVE_ARCH_STRNICMP
52#undef __HAVE_ARCH_STRPBRK
53#undef __HAVE_ARCH_STRSEP
54#undef __HAVE_ARCH_STRSPN
55
56#if !defined(IN_ARCH_STRING_C)
57
58static inline void *memchr(const void * s, int c, size_t n)
59{
60 register int r0 asm("0") = (char) c;
61 const void *ret = s + n;
62
63 asm volatile(
64 "0: srst %0,%1\n"
65 " jo 0b\n"
66 " jl 1f\n"
67 " la %0,0\n"
68 "1:"
69 : "+a" (ret), "+&a" (s) : "d" (r0) : "cc");
70 return (void *) ret;
71}
72
73static inline void *memscan(void *s, int c, size_t n)
74{
75 register int r0 asm("0") = (char) c;
76 const void *ret = s + n;
77
78 asm volatile(
79 "0: srst %0,%1\n"
80 " jo 0b\n"
81 : "+a" (ret), "+&a" (s) : "d" (r0) : "cc");
82 return (void *) ret;
83}
84
85static inline char *strcat(char *dst, const char *src)
86{
87 register int r0 asm("0") = 0;
88 unsigned long dummy;
89 char *ret = dst;
90
91 asm volatile(
92 "0: srst %0,%1\n"
93 " jo 0b\n"
94 "1: mvst %0,%2\n"
95 " jo 1b"
96 : "=&a" (dummy), "+a" (dst), "+a" (src)
97 : "d" (r0), "0" (0) : "cc", "memory" );
98 return ret;
99}
100
101static inline char *strcpy(char *dst, const char *src)
102{
103 register int r0 asm("0") = 0;
104 char *ret = dst;
105
106 asm volatile(
107 "0: mvst %0,%1\n"
108 " jo 0b"
109 : "+&a" (dst), "+&a" (src) : "d" (r0)
110 : "cc", "memory");
111 return ret;
112}
113
114static inline size_t strlen(const char *s)
115{
116 register unsigned long r0 asm("0") = 0;
117 const char *tmp = s;
118
119 asm volatile(
120 "0: srst %0,%1\n"
121 " jo 0b"
122 : "+d" (r0), "+a" (tmp) : : "cc");
123 return r0 - (unsigned long) s;
124}
125
126static inline size_t strnlen(const char * s, size_t n)
127{
128 register int r0 asm("0") = 0;
129 const char *tmp = s;
130 const char *end = s + n;
131
132 asm volatile(
133 "0: srst %0,%1\n"
134 " jo 0b"
135 : "+a" (end), "+a" (tmp) : "d" (r0) : "cc");
136 return end - s;
137}
138
139#endif /* !IN_ARCH_STRING_C */
140
141#endif /* __KERNEL__ */
142
143#endif /* __S390_STRING_H_ */
diff --git a/arch/s390/include/asm/suspend.h b/arch/s390/include/asm/suspend.h
new file mode 100644
index 000000000000..1f34580e67a7
--- /dev/null
+++ b/arch/s390/include/asm/suspend.h
@@ -0,0 +1,5 @@
1#ifndef __ASM_S390_SUSPEND_H
2#define __ASM_S390_SUSPEND_H
3
4#endif
5
diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h
new file mode 100644
index 000000000000..79d01343f8b0
--- /dev/null
+++ b/arch/s390/include/asm/sysinfo.h
@@ -0,0 +1,121 @@
1/*
2 * definition for store system information stsi
3 *
4 * Copyright IBM Corp. 2001,2008
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 only)
8 * as published by the Free Software Foundation.
9 *
10 * Author(s): Ulrich Weigand <weigand@de.ibm.com>
11 * Christian Borntraeger <borntraeger@de.ibm.com>
12 */
13
14#ifndef __ASM_S390_SYSINFO_H
15#define __ASM_S390_SYSINFO_H
16
17struct sysinfo_1_1_1 {
18 char reserved_0[32];
19 char manufacturer[16];
20 char type[4];
21 char reserved_1[12];
22 char model_capacity[16];
23 char sequence[16];
24 char plant[4];
25 char model[16];
26 char model_perm_cap[16];
27 char model_temp_cap[16];
28 char model_cap_rating[4];
29 char model_perm_cap_rating[4];
30 char model_temp_cap_rating[4];
31};
32
33struct sysinfo_1_2_1 {
34 char reserved_0[80];
35 char sequence[16];
36 char plant[4];
37 char reserved_1[2];
38 unsigned short cpu_address;
39};
40
41struct sysinfo_1_2_2 {
42 char format;
43 char reserved_0[1];
44 unsigned short acc_offset;
45 char reserved_1[24];
46 unsigned int secondary_capability;
47 unsigned int capability;
48 unsigned short cpus_total;
49 unsigned short cpus_configured;
50 unsigned short cpus_standby;
51 unsigned short cpus_reserved;
52 unsigned short adjustment[0];
53};
54
55struct sysinfo_1_2_2_extension {
56 unsigned int alt_capability;
57 unsigned short alt_adjustment[0];
58};
59
60struct sysinfo_2_2_1 {
61 char reserved_0[80];
62 char sequence[16];
63 char plant[4];
64 unsigned short cpu_id;
65 unsigned short cpu_address;
66};
67
68struct sysinfo_2_2_2 {
69 char reserved_0[32];
70 unsigned short lpar_number;
71 char reserved_1;
72 unsigned char characteristics;
73 unsigned short cpus_total;
74 unsigned short cpus_configured;
75 unsigned short cpus_standby;
76 unsigned short cpus_reserved;
77 char name[8];
78 unsigned int caf;
79 char reserved_2[16];
80 unsigned short cpus_dedicated;
81 unsigned short cpus_shared;
82};
83
84#define LPAR_CHAR_DEDICATED (1 << 7)
85#define LPAR_CHAR_SHARED (1 << 6)
86#define LPAR_CHAR_LIMITED (1 << 5)
87
88struct sysinfo_3_2_2 {
89 char reserved_0[31];
90 unsigned char count;
91 struct {
92 char reserved_0[4];
93 unsigned short cpus_total;
94 unsigned short cpus_configured;
95 unsigned short cpus_standby;
96 unsigned short cpus_reserved;
97 char name[8];
98 unsigned int caf;
99 char cpi[16];
100 char reserved_1[24];
101
102 } vm[8];
103};
104
105static inline int stsi(void *sysinfo, int fc, int sel1, int sel2)
106{
107 register int r0 asm("0") = (fc << 28) | sel1;
108 register int r1 asm("1") = sel2;
109
110 asm volatile(
111 " stsi 0(%2)\n"
112 "0: jz 2f\n"
113 "1: lhi %0,%3\n"
114 "2:\n"
115 EX_TABLE(0b, 1b)
116 : "+d" (r0) : "d" (r1), "a" (sysinfo), "K" (-ENOSYS)
117 : "cc", "memory");
118 return r0;
119}
120
121#endif /* __ASM_S390_SYSINFO_H */
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h
new file mode 100644
index 000000000000..819e7d99ca0c
--- /dev/null
+++ b/arch/s390/include/asm/system.h
@@ -0,0 +1,462 @@
1/*
2 * include/asm-s390/system.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 *
8 * Derived from "include/asm-i386/system.h"
9 */
10
11#ifndef __ASM_SYSTEM_H
12#define __ASM_SYSTEM_H
13
14#include <linux/kernel.h>
15#include <asm/types.h>
16#include <asm/ptrace.h>
17#include <asm/setup.h>
18#include <asm/processor.h>
19#include <asm/lowcore.h>
20
21#ifdef __KERNEL__
22
23struct task_struct;
24
25extern struct task_struct *__switch_to(void *, void *);
26
27static inline void save_fp_regs(s390_fp_regs *fpregs)
28{
29 asm volatile(
30 " std 0,8(%1)\n"
31 " std 2,24(%1)\n"
32 " std 4,40(%1)\n"
33 " std 6,56(%1)"
34 : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory");
35 if (!MACHINE_HAS_IEEE)
36 return;
37 asm volatile(
38 " stfpc 0(%1)\n"
39 " std 1,16(%1)\n"
40 " std 3,32(%1)\n"
41 " std 5,48(%1)\n"
42 " std 7,64(%1)\n"
43 " std 8,72(%1)\n"
44 " std 9,80(%1)\n"
45 " std 10,88(%1)\n"
46 " std 11,96(%1)\n"
47 " std 12,104(%1)\n"
48 " std 13,112(%1)\n"
49 " std 14,120(%1)\n"
50 " std 15,128(%1)\n"
51 : "=m" (*fpregs) : "a" (fpregs), "m" (*fpregs) : "memory");
52}
53
54static inline void restore_fp_regs(s390_fp_regs *fpregs)
55{
56 asm volatile(
57 " ld 0,8(%0)\n"
58 " ld 2,24(%0)\n"
59 " ld 4,40(%0)\n"
60 " ld 6,56(%0)"
61 : : "a" (fpregs), "m" (*fpregs));
62 if (!MACHINE_HAS_IEEE)
63 return;
64 asm volatile(
65 " lfpc 0(%0)\n"
66 " ld 1,16(%0)\n"
67 " ld 3,32(%0)\n"
68 " ld 5,48(%0)\n"
69 " ld 7,64(%0)\n"
70 " ld 8,72(%0)\n"
71 " ld 9,80(%0)\n"
72 " ld 10,88(%0)\n"
73 " ld 11,96(%0)\n"
74 " ld 12,104(%0)\n"
75 " ld 13,112(%0)\n"
76 " ld 14,120(%0)\n"
77 " ld 15,128(%0)\n"
78 : : "a" (fpregs), "m" (*fpregs));
79}
80
81static inline void save_access_regs(unsigned int *acrs)
82{
83 asm volatile("stam 0,15,0(%0)" : : "a" (acrs) : "memory");
84}
85
86static inline void restore_access_regs(unsigned int *acrs)
87{
88 asm volatile("lam 0,15,0(%0)" : : "a" (acrs));
89}
90
91#define switch_to(prev,next,last) do { \
92 if (prev == next) \
93 break; \
94 save_fp_regs(&prev->thread.fp_regs); \
95 restore_fp_regs(&next->thread.fp_regs); \
96 save_access_regs(&prev->thread.acrs[0]); \
97 restore_access_regs(&next->thread.acrs[0]); \
98 prev = __switch_to(prev,next); \
99} while (0)
100
101#ifdef CONFIG_VIRT_CPU_ACCOUNTING
102extern void account_vtime(struct task_struct *);
103extern void account_tick_vtime(struct task_struct *);
104extern void account_system_vtime(struct task_struct *);
105#else
106#define account_vtime(x) do { /* empty */ } while (0)
107#endif
108
109#ifdef CONFIG_PFAULT
110extern void pfault_irq_init(void);
111extern int pfault_init(void);
112extern void pfault_fini(void);
113#else /* CONFIG_PFAULT */
114#define pfault_irq_init() do { } while (0)
115#define pfault_init() ({-1;})
116#define pfault_fini() do { } while (0)
117#endif /* CONFIG_PFAULT */
118
119#ifdef CONFIG_PAGE_STATES
120extern void cmma_init(void);
121#else
122static inline void cmma_init(void) { }
123#endif
124
125#define finish_arch_switch(prev) do { \
126 set_fs(current->thread.mm_segment); \
127 account_vtime(prev); \
128} while (0)
129
130#define nop() asm volatile("nop")
131
132#define xchg(ptr,x) \
133({ \
134 __typeof__(*(ptr)) __ret; \
135 __ret = (__typeof__(*(ptr))) \
136 __xchg((unsigned long)(x), (void *)(ptr),sizeof(*(ptr))); \
137 __ret; \
138})
139
140extern void __xchg_called_with_bad_pointer(void);
141
142static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
143{
144 unsigned long addr, old;
145 int shift;
146
147 switch (size) {
148 case 1:
149 addr = (unsigned long) ptr;
150 shift = (3 ^ (addr & 3)) << 3;
151 addr ^= addr & 3;
152 asm volatile(
153 " l %0,0(%4)\n"
154 "0: lr 0,%0\n"
155 " nr 0,%3\n"
156 " or 0,%2\n"
157 " cs %0,0,0(%4)\n"
158 " jl 0b\n"
159 : "=&d" (old), "=m" (*(int *) addr)
160 : "d" (x << shift), "d" (~(255 << shift)), "a" (addr),
161 "m" (*(int *) addr) : "memory", "cc", "0");
162 return old >> shift;
163 case 2:
164 addr = (unsigned long) ptr;
165 shift = (2 ^ (addr & 2)) << 3;
166 addr ^= addr & 2;
167 asm volatile(
168 " l %0,0(%4)\n"
169 "0: lr 0,%0\n"
170 " nr 0,%3\n"
171 " or 0,%2\n"
172 " cs %0,0,0(%4)\n"
173 " jl 0b\n"
174 : "=&d" (old), "=m" (*(int *) addr)
175 : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr),
176 "m" (*(int *) addr) : "memory", "cc", "0");
177 return old >> shift;
178 case 4:
179 asm volatile(
180 " l %0,0(%3)\n"
181 "0: cs %0,%2,0(%3)\n"
182 " jl 0b\n"
183 : "=&d" (old), "=m" (*(int *) ptr)
184 : "d" (x), "a" (ptr), "m" (*(int *) ptr)
185 : "memory", "cc");
186 return old;
187#ifdef __s390x__
188 case 8:
189 asm volatile(
190 " lg %0,0(%3)\n"
191 "0: csg %0,%2,0(%3)\n"
192 " jl 0b\n"
193 : "=&d" (old), "=m" (*(long *) ptr)
194 : "d" (x), "a" (ptr), "m" (*(long *) ptr)
195 : "memory", "cc");
196 return old;
197#endif /* __s390x__ */
198 }
199 __xchg_called_with_bad_pointer();
200 return x;
201}
202
203/*
204 * Atomic compare and exchange. Compare OLD with MEM, if identical,
205 * store NEW in MEM. Return the initial value in MEM. Success is
206 * indicated by comparing RETURN with OLD.
207 */
208
209#define __HAVE_ARCH_CMPXCHG 1
210
211#define cmpxchg(ptr, o, n) \
212 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
213 (unsigned long)(n), sizeof(*(ptr))))
214
215extern void __cmpxchg_called_with_bad_pointer(void);
216
217static inline unsigned long
218__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
219{
220 unsigned long addr, prev, tmp;
221 int shift;
222
223 switch (size) {
224 case 1:
225 addr = (unsigned long) ptr;
226 shift = (3 ^ (addr & 3)) << 3;
227 addr ^= addr & 3;
228 asm volatile(
229 " l %0,0(%4)\n"
230 "0: nr %0,%5\n"
231 " lr %1,%0\n"
232 " or %0,%2\n"
233 " or %1,%3\n"
234 " cs %0,%1,0(%4)\n"
235 " jnl 1f\n"
236 " xr %1,%0\n"
237 " nr %1,%5\n"
238 " jnz 0b\n"
239 "1:"
240 : "=&d" (prev), "=&d" (tmp)
241 : "d" (old << shift), "d" (new << shift), "a" (ptr),
242 "d" (~(255 << shift))
243 : "memory", "cc");
244 return prev >> shift;
245 case 2:
246 addr = (unsigned long) ptr;
247 shift = (2 ^ (addr & 2)) << 3;
248 addr ^= addr & 2;
249 asm volatile(
250 " l %0,0(%4)\n"
251 "0: nr %0,%5\n"
252 " lr %1,%0\n"
253 " or %0,%2\n"
254 " or %1,%3\n"
255 " cs %0,%1,0(%4)\n"
256 " jnl 1f\n"
257 " xr %1,%0\n"
258 " nr %1,%5\n"
259 " jnz 0b\n"
260 "1:"
261 : "=&d" (prev), "=&d" (tmp)
262 : "d" (old << shift), "d" (new << shift), "a" (ptr),
263 "d" (~(65535 << shift))
264 : "memory", "cc");
265 return prev >> shift;
266 case 4:
267 asm volatile(
268 " cs %0,%2,0(%3)\n"
269 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
270 : "memory", "cc");
271 return prev;
272#ifdef __s390x__
273 case 8:
274 asm volatile(
275 " csg %0,%2,0(%3)\n"
276 : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
277 : "memory", "cc");
278 return prev;
279#endif /* __s390x__ */
280 }
281 __cmpxchg_called_with_bad_pointer();
282 return old;
283}
284
285/*
286 * Force strict CPU ordering.
287 * And yes, this is required on UP too when we're talking
288 * to devices.
289 *
290 * This is very similar to the ppc eieio/sync instruction in that is
291 * does a checkpoint syncronisation & makes sure that
292 * all memory ops have completed wrt other CPU's ( see 7-15 POP DJB ).
293 */
294
295#define eieio() asm volatile("bcr 15,0" : : : "memory")
296#define SYNC_OTHER_CORES(x) eieio()
297#define mb() eieio()
298#define rmb() eieio()
299#define wmb() eieio()
300#define read_barrier_depends() do { } while(0)
301#define smp_mb() mb()
302#define smp_rmb() rmb()
303#define smp_wmb() wmb()
304#define smp_read_barrier_depends() read_barrier_depends()
305#define smp_mb__before_clear_bit() smp_mb()
306#define smp_mb__after_clear_bit() smp_mb()
307
308
309#define set_mb(var, value) do { var = value; mb(); } while (0)
310
311#ifdef __s390x__
312
313#define __ctl_load(array, low, high) ({ \
314 typedef struct { char _[sizeof(array)]; } addrtype; \
315 asm volatile( \
316 " lctlg %1,%2,0(%0)\n" \
317 : : "a" (&array), "i" (low), "i" (high), \
318 "m" (*(addrtype *)(&array))); \
319 })
320
321#define __ctl_store(array, low, high) ({ \
322 typedef struct { char _[sizeof(array)]; } addrtype; \
323 asm volatile( \
324 " stctg %2,%3,0(%1)\n" \
325 : "=m" (*(addrtype *)(&array)) \
326 : "a" (&array), "i" (low), "i" (high)); \
327 })
328
329#else /* __s390x__ */
330
331#define __ctl_load(array, low, high) ({ \
332 typedef struct { char _[sizeof(array)]; } addrtype; \
333 asm volatile( \
334 " lctl %1,%2,0(%0)\n" \
335 : : "a" (&array), "i" (low), "i" (high), \
336 "m" (*(addrtype *)(&array))); \
337})
338
339#define __ctl_store(array, low, high) ({ \
340 typedef struct { char _[sizeof(array)]; } addrtype; \
341 asm volatile( \
342 " stctl %2,%3,0(%1)\n" \
343 : "=m" (*(addrtype *)(&array)) \
344 : "a" (&array), "i" (low), "i" (high)); \
345 })
346
347#endif /* __s390x__ */
348
349#define __ctl_set_bit(cr, bit) ({ \
350 unsigned long __dummy; \
351 __ctl_store(__dummy, cr, cr); \
352 __dummy |= 1UL << (bit); \
353 __ctl_load(__dummy, cr, cr); \
354})
355
356#define __ctl_clear_bit(cr, bit) ({ \
357 unsigned long __dummy; \
358 __ctl_store(__dummy, cr, cr); \
359 __dummy &= ~(1UL << (bit)); \
360 __ctl_load(__dummy, cr, cr); \
361})
362
363#include <linux/irqflags.h>
364
365#include <asm-generic/cmpxchg-local.h>
366
367static inline unsigned long __cmpxchg_local(volatile void *ptr,
368 unsigned long old,
369 unsigned long new, int size)
370{
371 switch (size) {
372 case 1:
373 case 2:
374 case 4:
375#ifdef __s390x__
376 case 8:
377#endif
378 return __cmpxchg(ptr, old, new, size);
379 default:
380 return __cmpxchg_local_generic(ptr, old, new, size);
381 }
382
383 return old;
384}
385
386/*
387 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
388 * them available.
389 */
390#define cmpxchg_local(ptr, o, n) \
391 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
392 (unsigned long)(n), sizeof(*(ptr))))
393#ifdef __s390x__
394#define cmpxchg64_local(ptr, o, n) \
395 ({ \
396 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
397 cmpxchg_local((ptr), (o), (n)); \
398 })
399#else
400#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
401#endif
402
403/*
404 * Use to set psw mask except for the first byte which
405 * won't be changed by this function.
406 */
407static inline void
408__set_psw_mask(unsigned long mask)
409{
410 __load_psw_mask(mask | (__raw_local_irq_stosm(0x00) & ~(-1UL >> 8)));
411}
412
413#define local_mcck_enable() __set_psw_mask(psw_kernel_bits)
414#define local_mcck_disable() __set_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK)
415
416int stfle(unsigned long long *list, int doublewords);
417
418#ifdef CONFIG_SMP
419
420extern void smp_ctl_set_bit(int cr, int bit);
421extern void smp_ctl_clear_bit(int cr, int bit);
422#define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
423#define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
424
425#else
426
427#define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
428#define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
429
430#endif /* CONFIG_SMP */
431
432static inline unsigned int stfl(void)
433{
434 asm volatile(
435 " .insn s,0xb2b10000,0(0)\n" /* stfl */
436 "0:\n"
437 EX_TABLE(0b,0b));
438 return S390_lowcore.stfl_fac_list;
439}
440
441static inline unsigned short stap(void)
442{
443 unsigned short cpu_address;
444
445 asm volatile("stap %0" : "=m" (cpu_address));
446 return cpu_address;
447}
448
449extern void (*_machine_restart)(char *command);
450extern void (*_machine_halt)(void);
451extern void (*_machine_power_off)(void);
452
453#define arch_align_stack(x) (x)
454
455#ifdef CONFIG_TRACE_IRQFLAGS
456extern psw_t sysc_restore_trace_psw;
457extern psw_t io_restore_trace_psw;
458#endif
459
460#endif /* __KERNEL__ */
461
462#endif
diff --git a/arch/s390/include/asm/tape390.h b/arch/s390/include/asm/tape390.h
new file mode 100644
index 000000000000..884fba48f1ff
--- /dev/null
+++ b/arch/s390/include/asm/tape390.h
@@ -0,0 +1,103 @@
1/*************************************************************************
2 *
3 * tape390.h
4 * enables user programs to display messages and control encryption
5 * on s390 tape devices
6 *
7 * Copyright IBM Corp. 2001,2006
8 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
9 *
10 *************************************************************************/
11
12#ifndef _TAPE390_H
13#define _TAPE390_H
14
15#define TAPE390_DISPLAY _IOW('d', 1, struct display_struct)
16
17/*
18 * The TAPE390_DISPLAY ioctl calls the Load Display command
19 * which transfers 17 bytes of data from the channel to the subsystem:
20 * - 1 format control byte, and
21 * - two 8-byte messages
22 *
23 * Format control byte:
24 * 0-2: New Message Overlay
25 * 3: Alternate Messages
26 * 4: Blink Message
27 * 5: Display Low/High Message
28 * 6: Reserved
29 * 7: Automatic Load Request
30 *
31 */
32
33typedef struct display_struct {
34 char cntrl;
35 char message1[8];
36 char message2[8];
37} display_struct;
38
39/*
40 * Tape encryption support
41 */
42
43struct tape390_crypt_info {
44 char capability;
45 char status;
46 char medium_status;
47} __attribute__ ((packed));
48
49
50/* Macros for "capable" field */
51#define TAPE390_CRYPT_SUPPORTED_MASK 0x01
52#define TAPE390_CRYPT_SUPPORTED(x) \
53 ((x.capability & TAPE390_CRYPT_SUPPORTED_MASK))
54
55/* Macros for "status" field */
56#define TAPE390_CRYPT_ON_MASK 0x01
57#define TAPE390_CRYPT_ON(x) (((x.status) & TAPE390_CRYPT_ON_MASK))
58
59/* Macros for "medium status" field */
60#define TAPE390_MEDIUM_LOADED_MASK 0x01
61#define TAPE390_MEDIUM_ENCRYPTED_MASK 0x02
62#define TAPE390_MEDIUM_ENCRYPTED(x) \
63 (((x.medium_status) & TAPE390_MEDIUM_ENCRYPTED_MASK))
64#define TAPE390_MEDIUM_LOADED(x) \
65 (((x.medium_status) & TAPE390_MEDIUM_LOADED_MASK))
66
67/*
68 * The TAPE390_CRYPT_SET ioctl is used to switch on/off encryption.
69 * The "encryption_capable" and "tape_status" fields are ignored for this ioctl!
70 */
71#define TAPE390_CRYPT_SET _IOW('d', 2, struct tape390_crypt_info)
72
73/*
74 * The TAPE390_CRYPT_QUERY ioctl is used to query the encryption state.
75 */
76#define TAPE390_CRYPT_QUERY _IOR('d', 3, struct tape390_crypt_info)
77
78/* Values for "kekl1/2_type" and "kekl1/2_type_on_tape" fields */
79#define TAPE390_KEKL_TYPE_NONE 0
80#define TAPE390_KEKL_TYPE_LABEL 1
81#define TAPE390_KEKL_TYPE_HASH 2
82
83struct tape390_kekl {
84 unsigned char type;
85 unsigned char type_on_tape;
86 char label[65];
87} __attribute__ ((packed));
88
89struct tape390_kekl_pair {
90 struct tape390_kekl kekl[2];
91} __attribute__ ((packed));
92
93/*
94 * The TAPE390_KEKL_SET ioctl is used to set Key Encrypting Key labels.
95 */
96#define TAPE390_KEKL_SET _IOW('d', 4, struct tape390_kekl_pair)
97
98/*
99 * The TAPE390_KEKL_QUERY ioctl is used to query Key Encrypting Key labels.
100 */
101#define TAPE390_KEKL_QUERY _IOR('d', 5, struct tape390_kekl_pair)
102
103#endif
diff --git a/arch/s390/include/asm/termbits.h b/arch/s390/include/asm/termbits.h
new file mode 100644
index 000000000000..58731853d529
--- /dev/null
+++ b/arch/s390/include/asm/termbits.h
@@ -0,0 +1,206 @@
1/*
2 * include/asm-s390/termbits.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/termbits.h"
7 */
8
9#ifndef __ARCH_S390_TERMBITS_H__
10#define __ARCH_S390_TERMBITS_H__
11
12#include <linux/posix_types.h>
13
14typedef unsigned char cc_t;
15typedef unsigned int speed_t;
16typedef unsigned int tcflag_t;
17
18#define NCCS 19
19struct termios {
20 tcflag_t c_iflag; /* input mode flags */
21 tcflag_t c_oflag; /* output mode flags */
22 tcflag_t c_cflag; /* control mode flags */
23 tcflag_t c_lflag; /* local mode flags */
24 cc_t c_line; /* line discipline */
25 cc_t c_cc[NCCS]; /* control characters */
26};
27
28struct termios2 {
29 tcflag_t c_iflag; /* input mode flags */
30 tcflag_t c_oflag; /* output mode flags */
31 tcflag_t c_cflag; /* control mode flags */
32 tcflag_t c_lflag; /* local mode flags */
33 cc_t c_line; /* line discipline */
34 cc_t c_cc[NCCS]; /* control characters */
35 speed_t c_ispeed; /* input speed */
36 speed_t c_ospeed; /* output speed */
37};
38
39struct ktermios {
40 tcflag_t c_iflag; /* input mode flags */
41 tcflag_t c_oflag; /* output mode flags */
42 tcflag_t c_cflag; /* control mode flags */
43 tcflag_t c_lflag; /* local mode flags */
44 cc_t c_line; /* line discipline */
45 cc_t c_cc[NCCS]; /* control characters */
46 speed_t c_ispeed; /* input speed */
47 speed_t c_ospeed; /* output speed */
48};
49
50/* c_cc characters */
51#define VINTR 0
52#define VQUIT 1
53#define VERASE 2
54#define VKILL 3
55#define VEOF 4
56#define VTIME 5
57#define VMIN 6
58#define VSWTC 7
59#define VSTART 8
60#define VSTOP 9
61#define VSUSP 10
62#define VEOL 11
63#define VREPRINT 12
64#define VDISCARD 13
65#define VWERASE 14
66#define VLNEXT 15
67#define VEOL2 16
68
69/* c_iflag bits */
70#define IGNBRK 0000001
71#define BRKINT 0000002
72#define IGNPAR 0000004
73#define PARMRK 0000010
74#define INPCK 0000020
75#define ISTRIP 0000040
76#define INLCR 0000100
77#define IGNCR 0000200
78#define ICRNL 0000400
79#define IUCLC 0001000
80#define IXON 0002000
81#define IXANY 0004000
82#define IXOFF 0010000
83#define IMAXBEL 0020000
84#define IUTF8 0040000
85
86/* c_oflag bits */
87#define OPOST 0000001
88#define OLCUC 0000002
89#define ONLCR 0000004
90#define OCRNL 0000010
91#define ONOCR 0000020
92#define ONLRET 0000040
93#define OFILL 0000100
94#define OFDEL 0000200
95#define NLDLY 0000400
96#define NL0 0000000
97#define NL1 0000400
98#define CRDLY 0003000
99#define CR0 0000000
100#define CR1 0001000
101#define CR2 0002000
102#define CR3 0003000
103#define TABDLY 0014000
104#define TAB0 0000000
105#define TAB1 0004000
106#define TAB2 0010000
107#define TAB3 0014000
108#define XTABS 0014000
109#define BSDLY 0020000
110#define BS0 0000000
111#define BS1 0020000
112#define VTDLY 0040000
113#define VT0 0000000
114#define VT1 0040000
115#define FFDLY 0100000
116#define FF0 0000000
117#define FF1 0100000
118
119/* c_cflag bit meaning */
120#define CBAUD 0010017
121#define B0 0000000 /* hang up */
122#define B50 0000001
123#define B75 0000002
124#define B110 0000003
125#define B134 0000004
126#define B150 0000005
127#define B200 0000006
128#define B300 0000007
129#define B600 0000010
130#define B1200 0000011
131#define B1800 0000012
132#define B2400 0000013
133#define B4800 0000014
134#define B9600 0000015
135#define B19200 0000016
136#define B38400 0000017
137#define EXTA B19200
138#define EXTB B38400
139#define CSIZE 0000060
140#define CS5 0000000
141#define CS6 0000020
142#define CS7 0000040
143#define CS8 0000060
144#define CSTOPB 0000100
145#define CREAD 0000200
146#define PARENB 0000400
147#define PARODD 0001000
148#define HUPCL 0002000
149#define CLOCAL 0004000
150#define CBAUDEX 0010000
151#define BOTHER 0010000
152#define B57600 0010001
153#define B115200 0010002
154#define B230400 0010003
155#define B460800 0010004
156#define B500000 0010005
157#define B576000 0010006
158#define B921600 0010007
159#define B1000000 0010010
160#define B1152000 0010011
161#define B1500000 0010012
162#define B2000000 0010013
163#define B2500000 0010014
164#define B3000000 0010015
165#define B3500000 0010016
166#define B4000000 0010017
167#define CIBAUD 002003600000 /* input baud rate */
168#define CMSPAR 010000000000 /* mark or space (stick) parity */
169#define CRTSCTS 020000000000 /* flow control */
170
171#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
172
173/* c_lflag bits */
174#define ISIG 0000001
175#define ICANON 0000002
176#define XCASE 0000004
177#define ECHO 0000010
178#define ECHOE 0000020
179#define ECHOK 0000040
180#define ECHONL 0000100
181#define NOFLSH 0000200
182#define TOSTOP 0000400
183#define ECHOCTL 0001000
184#define ECHOPRT 0002000
185#define ECHOKE 0004000
186#define FLUSHO 0010000
187#define PENDIN 0040000
188#define IEXTEN 0100000
189
190/* tcflow() and TCXONC use these */
191#define TCOOFF 0
192#define TCOON 1
193#define TCIOFF 2
194#define TCION 3
195
196/* tcflush() and TCFLSH use these */
197#define TCIFLUSH 0
198#define TCOFLUSH 1
199#define TCIOFLUSH 2
200
201/* tcsetattr uses these */
202#define TCSANOW 0
203#define TCSADRAIN 1
204#define TCSAFLUSH 2
205
206#endif
diff --git a/arch/s390/include/asm/termios.h b/arch/s390/include/asm/termios.h
new file mode 100644
index 000000000000..67f66278f533
--- /dev/null
+++ b/arch/s390/include/asm/termios.h
@@ -0,0 +1,67 @@
1/*
2 * include/asm-s390/termios.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/termios.h"
7 */
8
9#ifndef _S390_TERMIOS_H
10#define _S390_TERMIOS_H
11
12#include <asm/termbits.h>
13#include <asm/ioctls.h>
14
15struct winsize {
16 unsigned short ws_row;
17 unsigned short ws_col;
18 unsigned short ws_xpixel;
19 unsigned short ws_ypixel;
20};
21
22#define NCC 8
23struct termio {
24 unsigned short c_iflag; /* input mode flags */
25 unsigned short c_oflag; /* output mode flags */
26 unsigned short c_cflag; /* control mode flags */
27 unsigned short c_lflag; /* local mode flags */
28 unsigned char c_line; /* line discipline */
29 unsigned char c_cc[NCC]; /* control characters */
30};
31
32/* modem lines */
33#define TIOCM_LE 0x001
34#define TIOCM_DTR 0x002
35#define TIOCM_RTS 0x004
36#define TIOCM_ST 0x008
37#define TIOCM_SR 0x010
38#define TIOCM_CTS 0x020
39#define TIOCM_CAR 0x040
40#define TIOCM_RNG 0x080
41#define TIOCM_DSR 0x100
42#define TIOCM_CD TIOCM_CAR
43#define TIOCM_RI TIOCM_RNG
44#define TIOCM_OUT1 0x2000
45#define TIOCM_OUT2 0x4000
46#define TIOCM_LOOP 0x8000
47
48/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
49
50#ifdef __KERNEL__
51
52/* intr=^C quit=^\ erase=del kill=^U
53 eof=^D vtime=\0 vmin=\1 sxtc=\0
54 start=^Q stop=^S susp=^Z eol=\0
55 reprint=^R discard=^U werase=^W lnext=^V
56 eol2=\0
57*/
58#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
59
60#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
61#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
62
63#include <asm-generic/termios.h>
64
65#endif /* __KERNEL__ */
66
67#endif /* _S390_TERMIOS_H */
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
new file mode 100644
index 000000000000..91a8f93ad355
--- /dev/null
+++ b/arch/s390/include/asm/thread_info.h
@@ -0,0 +1,118 @@
1/*
2 * include/asm-s390/thread_info.h
3 *
4 * S390 version
5 * Copyright (C) IBM Corp. 2002,2006
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 */
8
9#ifndef _ASM_THREAD_INFO_H
10#define _ASM_THREAD_INFO_H
11
12#ifdef __KERNEL__
13
14/*
15 * Size of kernel stack for each process
16 */
17#ifndef __s390x__
18#ifndef __SMALL_STACK
19#define THREAD_ORDER 1
20#define ASYNC_ORDER 1
21#else
22#define THREAD_ORDER 0
23#define ASYNC_ORDER 0
24#endif
25#else /* __s390x__ */
26#ifndef __SMALL_STACK
27#define THREAD_ORDER 2
28#define ASYNC_ORDER 2
29#else
30#define THREAD_ORDER 1
31#define ASYNC_ORDER 1
32#endif
33#endif /* __s390x__ */
34
35#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
36#define ASYNC_SIZE (PAGE_SIZE << ASYNC_ORDER)
37
38#ifndef __ASSEMBLY__
39#include <asm/processor.h>
40#include <asm/lowcore.h>
41
42/*
43 * low level task data that entry.S needs immediate access to
44 * - this struct should fit entirely inside of one cache line
45 * - this struct shares the supervisor stack pages
46 * - if the contents of this structure are changed, the assembly constants must also be changed
47 */
48struct thread_info {
49 struct task_struct *task; /* main task structure */
50 struct exec_domain *exec_domain; /* execution domain */
51 unsigned long flags; /* low level flags */
52 unsigned int cpu; /* current CPU */
53 int preempt_count; /* 0 => preemptable, <0 => BUG */
54 struct restart_block restart_block;
55};
56
57/*
58 * macros/functions for gaining access to the thread information structure
59 */
60#define INIT_THREAD_INFO(tsk) \
61{ \
62 .task = &tsk, \
63 .exec_domain = &default_exec_domain, \
64 .flags = 0, \
65 .cpu = 0, \
66 .preempt_count = 1, \
67 .restart_block = { \
68 .fn = do_no_restart_syscall, \
69 }, \
70}
71
72#define init_thread_info (init_thread_union.thread_info)
73#define init_stack (init_thread_union.stack)
74
75/* how to get the thread information struct from C */
76static inline struct thread_info *current_thread_info(void)
77{
78 return (struct thread_info *)((*(unsigned long *) __LC_KERNEL_STACK)-THREAD_SIZE);
79}
80
81#define THREAD_SIZE_ORDER THREAD_ORDER
82
83#endif
84
85/*
86 * thread information flags bit numbers
87 */
88#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
89#define TIF_SIGPENDING 2 /* signal pending */
90#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
91#define TIF_RESTART_SVC 4 /* restart svc with new svc number */
92#define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */
93#define TIF_SINGLE_STEP 6 /* deliver sigtrap on return to user */
94#define TIF_MCCK_PENDING 7 /* machine check handling is pending */
95#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
96#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling
97 TIF_NEED_RESCHED */
98#define TIF_31BIT 18 /* 32bit process */
99#define TIF_MEMDIE 19
100#define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */
101
102#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
103#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
104#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
105#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
106#define _TIF_RESTART_SVC (1<<TIF_RESTART_SVC)
107#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
108#define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP)
109#define _TIF_MCCK_PENDING (1<<TIF_MCCK_PENDING)
110#define _TIF_USEDFPU (1<<TIF_USEDFPU)
111#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
112#define _TIF_31BIT (1<<TIF_31BIT)
113
114#endif /* __KERNEL__ */
115
116#define PREEMPT_ACTIVE 0x4000000
117
118#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/s390/include/asm/timer.h b/arch/s390/include/asm/timer.h
new file mode 100644
index 000000000000..d98d79e35cd6
--- /dev/null
+++ b/arch/s390/include/asm/timer.h
@@ -0,0 +1,65 @@
1/*
2 * include/asm-s390/timer.h
3 *
4 * (C) Copyright IBM Corp. 2003,2006
5 * Virtual CPU timer
6 *
7 * Author: Jan Glauber (jang@de.ibm.com)
8 */
9
10#ifndef _ASM_S390_TIMER_H
11#define _ASM_S390_TIMER_H
12
13#ifdef __KERNEL__
14
15#include <linux/timer.h>
16
17#define VTIMER_MAX_SLICE (0x7ffffffffffff000LL)
18
19struct vtimer_list {
20 struct list_head entry;
21
22 int cpu;
23 __u64 expires;
24 __u64 interval;
25
26 spinlock_t lock;
27 unsigned long magic;
28
29 void (*function)(unsigned long);
30 unsigned long data;
31};
32
33/* the offset value will wrap after ca. 71 years */
34struct vtimer_queue {
35 struct list_head list;
36 spinlock_t lock;
37 __u64 to_expire; /* current event expire time */
38 __u64 offset; /* list offset to zero */
39 __u64 idle; /* temp var for idle */
40};
41
42extern void init_virt_timer(struct vtimer_list *timer);
43extern void add_virt_timer(void *new);
44extern void add_virt_timer_periodic(void *new);
45extern int mod_virt_timer(struct vtimer_list *timer, __u64 expires);
46extern int del_virt_timer(struct vtimer_list *timer);
47
48extern void init_cpu_vtimer(void);
49extern void vtime_init(void);
50
51#ifdef CONFIG_VIRT_TIMER
52
53extern void vtime_start_cpu_timer(void);
54extern void vtime_stop_cpu_timer(void);
55
56#else
57
58static inline void vtime_start_cpu_timer(void) { }
59static inline void vtime_stop_cpu_timer(void) { }
60
61#endif /* CONFIG_VIRT_TIMER */
62
63#endif /* __KERNEL__ */
64
65#endif /* _ASM_S390_TIMER_H */
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
new file mode 100644
index 000000000000..d744c3d62de5
--- /dev/null
+++ b/arch/s390/include/asm/timex.h
@@ -0,0 +1,88 @@
1/*
2 * include/asm-s390/timex.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 *
7 * Derived from "include/asm-i386/timex.h"
8 * Copyright (C) 1992, Linus Torvalds
9 */
10
11#ifndef _ASM_S390_TIMEX_H
12#define _ASM_S390_TIMEX_H
13
14/* Inline functions for clock register access. */
15static inline int set_clock(__u64 time)
16{
17 int cc;
18
19 asm volatile(
20 " sck 0(%2)\n"
21 " ipm %0\n"
22 " srl %0,28\n"
23 : "=d" (cc) : "m" (time), "a" (&time) : "cc");
24 return cc;
25}
26
27static inline int store_clock(__u64 *time)
28{
29 int cc;
30
31 asm volatile(
32 " stck 0(%2)\n"
33 " ipm %0\n"
34 " srl %0,28\n"
35 : "=d" (cc), "=m" (*time) : "a" (time) : "cc");
36 return cc;
37}
38
39static inline void set_clock_comparator(__u64 time)
40{
41 asm volatile("sckc 0(%1)" : : "m" (time), "a" (&time));
42}
43
44static inline void store_clock_comparator(__u64 *time)
45{
46 asm volatile("stckc 0(%1)" : "=m" (*time) : "a" (time));
47}
48
49#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
50
51typedef unsigned long long cycles_t;
52
53static inline unsigned long long get_clock (void)
54{
55 unsigned long long clk;
56
57#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
58 asm volatile("stck %0" : "=Q" (clk) : : "cc");
59#else /* __GNUC__ */
60 asm volatile("stck 0(%1)" : "=m" (clk) : "a" (&clk) : "cc");
61#endif /* __GNUC__ */
62 return clk;
63}
64
65static inline unsigned long long get_clock_xt(void)
66{
67 unsigned char clk[16];
68
69#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
70 asm volatile("stcke %0" : "=Q" (clk) : : "cc");
71#else /* __GNUC__ */
72 asm volatile("stcke 0(%1)" : "=m" (clk)
73 : "a" (clk) : "cc");
74#endif /* __GNUC__ */
75
76 return *((unsigned long long *)&clk[1]);
77}
78
79static inline cycles_t get_cycles(void)
80{
81 return (cycles_t) get_clock() >> 2;
82}
83
84int get_sync_clock(unsigned long long *clock);
85void init_cpu_timer(void);
86unsigned long long monotonic_clock(void);
87
88#endif
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
new file mode 100644
index 000000000000..3d8a96d39d9d
--- /dev/null
+++ b/arch/s390/include/asm/tlb.h
@@ -0,0 +1,156 @@
1#ifndef _S390_TLB_H
2#define _S390_TLB_H
3
4/*
5 * TLB flushing on s390 is complicated. The following requirement
6 * from the principles of operation is the most arduous:
7 *
8 * "A valid table entry must not be changed while it is attached
9 * to any CPU and may be used for translation by that CPU except to
10 * (1) invalidate the entry by using INVALIDATE PAGE TABLE ENTRY,
11 * or INVALIDATE DAT TABLE ENTRY, (2) alter bits 56-63 of a page
12 * table entry, or (3) make a change by means of a COMPARE AND SWAP
13 * AND PURGE instruction that purges the TLB."
14 *
15 * The modification of a pte of an active mm struct therefore is
16 * a two step process: i) invalidate the pte, ii) store the new pte.
17 * This is true for the page protection bit as well.
18 * The only possible optimization is to flush at the beginning of
19 * a tlb_gather_mmu cycle if the mm_struct is currently not in use.
20 *
21 * Pages used for the page tables is a different story. FIXME: more
22 */
23
24#include <linux/mm.h>
25#include <linux/swap.h>
26#include <asm/processor.h>
27#include <asm/pgalloc.h>
28#include <asm/smp.h>
29#include <asm/tlbflush.h>
30
31#ifndef CONFIG_SMP
32#define TLB_NR_PTRS 1
33#else
34#define TLB_NR_PTRS 508
35#endif
36
37struct mmu_gather {
38 struct mm_struct *mm;
39 unsigned int fullmm;
40 unsigned int nr_ptes;
41 unsigned int nr_pxds;
42 void *array[TLB_NR_PTRS];
43};
44
45DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
46
47static inline struct mmu_gather *tlb_gather_mmu(struct mm_struct *mm,
48 unsigned int full_mm_flush)
49{
50 struct mmu_gather *tlb = &get_cpu_var(mmu_gathers);
51
52 tlb->mm = mm;
53 tlb->fullmm = full_mm_flush || (num_online_cpus() == 1) ||
54 (atomic_read(&mm->mm_users) <= 1 && mm == current->active_mm);
55 tlb->nr_ptes = 0;
56 tlb->nr_pxds = TLB_NR_PTRS;
57 if (tlb->fullmm)
58 __tlb_flush_mm(mm);
59 return tlb;
60}
61
62static inline void tlb_flush_mmu(struct mmu_gather *tlb,
63 unsigned long start, unsigned long end)
64{
65 if (!tlb->fullmm && (tlb->nr_ptes > 0 || tlb->nr_pxds < TLB_NR_PTRS))
66 __tlb_flush_mm(tlb->mm);
67 while (tlb->nr_ptes > 0)
68 pte_free(tlb->mm, tlb->array[--tlb->nr_ptes]);
69 while (tlb->nr_pxds < TLB_NR_PTRS)
70 /* pgd_free frees the pointer as region or segment table */
71 pgd_free(tlb->mm, tlb->array[tlb->nr_pxds++]);
72}
73
74static inline void tlb_finish_mmu(struct mmu_gather *tlb,
75 unsigned long start, unsigned long end)
76{
77 tlb_flush_mmu(tlb, start, end);
78
79 /* keep the page table cache within bounds */
80 check_pgt_cache();
81
82 put_cpu_var(mmu_gathers);
83}
84
85/*
86 * Release the page cache reference for a pte removed by
87 * tlb_ptep_clear_flush. In both flush modes the tlb fo a page cache page
88 * has already been freed, so just do free_page_and_swap_cache.
89 */
90static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
91{
92 free_page_and_swap_cache(page);
93}
94
95/*
96 * pte_free_tlb frees a pte table and clears the CRSTE for the
97 * page table from the tlb.
98 */
99static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte)
100{
101 if (!tlb->fullmm) {
102 tlb->array[tlb->nr_ptes++] = pte;
103 if (tlb->nr_ptes >= tlb->nr_pxds)
104 tlb_flush_mmu(tlb, 0, 0);
105 } else
106 pte_free(tlb->mm, pte);
107}
108
109/*
110 * pmd_free_tlb frees a pmd table and clears the CRSTE for the
111 * segment table entry from the tlb.
112 * If the mm uses a two level page table the single pmd is freed
113 * as the pgd. pmd_free_tlb checks the asce_limit against 2GB
114 * to avoid the double free of the pmd in this case.
115 */
116static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
117{
118#ifdef __s390x__
119 if (tlb->mm->context.asce_limit <= (1UL << 31))
120 return;
121 if (!tlb->fullmm) {
122 tlb->array[--tlb->nr_pxds] = pmd;
123 if (tlb->nr_ptes >= tlb->nr_pxds)
124 tlb_flush_mmu(tlb, 0, 0);
125 } else
126 pmd_free(tlb->mm, pmd);
127#endif
128}
129
130/*
131 * pud_free_tlb frees a pud table and clears the CRSTE for the
132 * region third table entry from the tlb.
133 * If the mm uses a three level page table the single pud is freed
134 * as the pgd. pud_free_tlb checks the asce_limit against 4TB
135 * to avoid the double free of the pud in this case.
136 */
137static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud)
138{
139#ifdef __s390x__
140 if (tlb->mm->context.asce_limit <= (1UL << 42))
141 return;
142 if (!tlb->fullmm) {
143 tlb->array[--tlb->nr_pxds] = pud;
144 if (tlb->nr_ptes >= tlb->nr_pxds)
145 tlb_flush_mmu(tlb, 0, 0);
146 } else
147 pud_free(tlb->mm, pud);
148#endif
149}
150
151#define tlb_start_vma(tlb, vma) do { } while (0)
152#define tlb_end_vma(tlb, vma) do { } while (0)
153#define tlb_remove_tlb_entry(tlb, ptep, addr) do { } while (0)
154#define tlb_migrate_finish(mm) do { } while (0)
155
156#endif /* _S390_TLB_H */
diff --git a/arch/s390/include/asm/tlbflush.h b/arch/s390/include/asm/tlbflush.h
new file mode 100644
index 000000000000..d60394b9745e
--- /dev/null
+++ b/arch/s390/include/asm/tlbflush.h
@@ -0,0 +1,140 @@
1#ifndef _S390_TLBFLUSH_H
2#define _S390_TLBFLUSH_H
3
4#include <linux/mm.h>
5#include <linux/sched.h>
6#include <asm/processor.h>
7#include <asm/pgalloc.h>
8
9/*
10 * Flush all tlb entries on the local cpu.
11 */
12static inline void __tlb_flush_local(void)
13{
14 asm volatile("ptlb" : : : "memory");
15}
16
17#ifdef CONFIG_SMP
18/*
19 * Flush all tlb entries on all cpus.
20 */
21void smp_ptlb_all(void);
22
23static inline void __tlb_flush_global(void)
24{
25 register unsigned long reg2 asm("2");
26 register unsigned long reg3 asm("3");
27 register unsigned long reg4 asm("4");
28 long dummy;
29
30#ifndef __s390x__
31 if (!MACHINE_HAS_CSP) {
32 smp_ptlb_all();
33 return;
34 }
35#endif /* __s390x__ */
36
37 dummy = 0;
38 reg2 = reg3 = 0;
39 reg4 = ((unsigned long) &dummy) + 1;
40 asm volatile(
41 " csp %0,%2"
42 : : "d" (reg2), "d" (reg3), "d" (reg4), "m" (dummy) : "cc" );
43}
44
45static inline void __tlb_flush_full(struct mm_struct *mm)
46{
47 cpumask_t local_cpumask;
48
49 preempt_disable();
50 /*
51 * If the process only ran on the local cpu, do a local flush.
52 */
53 local_cpumask = cpumask_of_cpu(smp_processor_id());
54 if (cpus_equal(mm->cpu_vm_mask, local_cpumask))
55 __tlb_flush_local();
56 else
57 __tlb_flush_global();
58 preempt_enable();
59}
60#else
61#define __tlb_flush_full(mm) __tlb_flush_local()
62#endif
63
64/*
65 * Flush all tlb entries of a page table on all cpus.
66 */
67static inline void __tlb_flush_idte(unsigned long asce)
68{
69 asm volatile(
70 " .insn rrf,0xb98e0000,0,%0,%1,0"
71 : : "a" (2048), "a" (asce) : "cc" );
72}
73
74static inline void __tlb_flush_mm(struct mm_struct * mm)
75{
76 if (unlikely(cpus_empty(mm->cpu_vm_mask)))
77 return;
78 /*
79 * If the machine has IDTE we prefer to do a per mm flush
80 * on all cpus instead of doing a local flush if the mm
81 * only ran on the local cpu.
82 */
83 if (MACHINE_HAS_IDTE) {
84 if (mm->context.noexec)
85 __tlb_flush_idte((unsigned long)
86 get_shadow_table(mm->pgd) |
87 mm->context.asce_bits);
88 __tlb_flush_idte((unsigned long) mm->pgd |
89 mm->context.asce_bits);
90 return;
91 }
92 __tlb_flush_full(mm);
93}
94
95static inline void __tlb_flush_mm_cond(struct mm_struct * mm)
96{
97 if (atomic_read(&mm->mm_users) <= 1 && mm == current->active_mm)
98 __tlb_flush_mm(mm);
99}
100
101/*
102 * TLB flushing:
103 * flush_tlb() - flushes the current mm struct TLBs
104 * flush_tlb_all() - flushes all processes TLBs
105 * flush_tlb_mm(mm) - flushes the specified mm context TLB's
106 * flush_tlb_page(vma, vmaddr) - flushes one page
107 * flush_tlb_range(vma, start, end) - flushes a range of pages
108 * flush_tlb_kernel_range(start, end) - flushes a range of kernel pages
109 */
110
111/*
112 * flush_tlb_mm goes together with ptep_set_wrprotect for the
113 * copy_page_range operation and flush_tlb_range is related to
114 * ptep_get_and_clear for change_protection. ptep_set_wrprotect and
115 * ptep_get_and_clear do not flush the TLBs directly if the mm has
116 * only one user. At the end of the update the flush_tlb_mm and
117 * flush_tlb_range functions need to do the flush.
118 */
119#define flush_tlb() do { } while (0)
120#define flush_tlb_all() do { } while (0)
121#define flush_tlb_page(vma, addr) do { } while (0)
122
123static inline void flush_tlb_mm(struct mm_struct *mm)
124{
125 __tlb_flush_mm_cond(mm);
126}
127
128static inline void flush_tlb_range(struct vm_area_struct *vma,
129 unsigned long start, unsigned long end)
130{
131 __tlb_flush_mm_cond(vma->vm_mm);
132}
133
134static inline void flush_tlb_kernel_range(unsigned long start,
135 unsigned long end)
136{
137 __tlb_flush_mm(&init_mm);
138}
139
140#endif /* _S390_TLBFLUSH_H */
diff --git a/arch/s390/include/asm/todclk.h b/arch/s390/include/asm/todclk.h
new file mode 100644
index 000000000000..c7f62055488a
--- /dev/null
+++ b/arch/s390/include/asm/todclk.h
@@ -0,0 +1,23 @@
1/*
2 * File...........: linux/include/asm/todclk.h
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Bugreports.to..: <Linux390@de.ibm.com>
5 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
6 *
7 * History of changes (starts July 2000)
8 */
9
10#ifndef __ASM_TODCLK_H
11#define __ASM_TODCLK_H
12
13#ifdef __KERNEL__
14
15#define TOD_uSEC (0x1000ULL)
16#define TOD_mSEC (1000 * TOD_uSEC)
17#define TOD_SEC (1000 * TOD_mSEC)
18#define TOD_MIN (60 * TOD_SEC)
19#define TOD_HOUR (60 * TOD_MIN)
20
21#endif
22
23#endif
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
new file mode 100644
index 000000000000..d96c91643458
--- /dev/null
+++ b/arch/s390/include/asm/topology.h
@@ -0,0 +1,33 @@
1#ifndef _ASM_S390_TOPOLOGY_H
2#define _ASM_S390_TOPOLOGY_H
3
4#include <linux/cpumask.h>
5
6#define mc_capable() (1)
7
8cpumask_t cpu_coregroup_map(unsigned int cpu);
9
10extern cpumask_t cpu_core_map[NR_CPUS];
11
12#define topology_core_siblings(cpu) (cpu_core_map[cpu])
13
14int topology_set_cpu_management(int fc);
15void topology_schedule_update(void);
16
17#define POLARIZATION_UNKNWN (-1)
18#define POLARIZATION_HRZ (0)
19#define POLARIZATION_VL (1)
20#define POLARIZATION_VM (2)
21#define POLARIZATION_VH (3)
22
23#ifdef CONFIG_SMP
24void s390_init_cpu_topology(void);
25#else
26static inline void s390_init_cpu_topology(void)
27{
28};
29#endif
30
31#include <asm-generic/topology.h>
32
33#endif /* _ASM_S390_TOPOLOGY_H */
diff --git a/arch/s390/include/asm/types.h b/arch/s390/include/asm/types.h
new file mode 100644
index 000000000000..41c547656130
--- /dev/null
+++ b/arch/s390/include/asm/types.h
@@ -0,0 +1,63 @@
1/*
2 * include/asm-s390/types.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/types.h"
7 */
8
9#ifndef _S390_TYPES_H
10#define _S390_TYPES_H
11
12#ifndef __s390x__
13# include <asm-generic/int-ll64.h>
14#else
15# include <asm-generic/int-l64.h>
16#endif
17
18#ifndef __ASSEMBLY__
19
20typedef unsigned short umode_t;
21
22/* A address type so that arithmetic can be done on it & it can be upgraded to
23 64 bit when necessary
24*/
25typedef unsigned long addr_t;
26typedef __signed__ long saddr_t;
27
28#endif /* __ASSEMBLY__ */
29
30/*
31 * These aren't exported outside the kernel to avoid name space clashes
32 */
33#ifdef __KERNEL__
34
35#ifndef __s390x__
36#define BITS_PER_LONG 32
37#else
38#define BITS_PER_LONG 64
39#endif
40
41#ifndef __ASSEMBLY__
42
43typedef u64 dma64_addr_t;
44#ifdef __s390x__
45/* DMA addresses come in 32-bit and 64-bit flavours. */
46typedef u64 dma_addr_t;
47#else
48typedef u32 dma_addr_t;
49#endif
50
51#ifndef __s390x__
52typedef union {
53 unsigned long long pair;
54 struct {
55 unsigned long even;
56 unsigned long odd;
57 } subreg;
58} register_pair;
59
60#endif /* ! __s390x__ */
61#endif /* __ASSEMBLY__ */
62#endif /* __KERNEL__ */
63#endif /* _S390_TYPES_H */
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
new file mode 100644
index 000000000000..0235970278f0
--- /dev/null
+++ b/arch/s390/include/asm/uaccess.h
@@ -0,0 +1,363 @@
1/*
2 * include/asm-s390/uaccess.h
3 *
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Hartmut Penner (hp@de.ibm.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 *
9 * Derived from "include/asm-i386/uaccess.h"
10 */
11#ifndef __S390_UACCESS_H
12#define __S390_UACCESS_H
13
14/*
15 * User space memory access functions
16 */
17#include <linux/sched.h>
18#include <linux/errno.h>
19
20#define VERIFY_READ 0
21#define VERIFY_WRITE 1
22
23
24/*
25 * The fs value determines whether argument validity checking should be
26 * performed or not. If get_fs() == USER_DS, checking is performed, with
27 * get_fs() == KERNEL_DS, checking is bypassed.
28 *
29 * For historical reasons, these macros are grossly misnamed.
30 */
31
32#define MAKE_MM_SEG(a) ((mm_segment_t) { (a) })
33
34
35#define KERNEL_DS MAKE_MM_SEG(0)
36#define USER_DS MAKE_MM_SEG(1)
37
38#define get_ds() (KERNEL_DS)
39#define get_fs() (current->thread.mm_segment)
40
41#define set_fs(x) \
42({ \
43 unsigned long __pto; \
44 current->thread.mm_segment = (x); \
45 __pto = current->thread.mm_segment.ar4 ? \
46 S390_lowcore.user_asce : S390_lowcore.kernel_asce; \
47 __ctl_load(__pto, 7, 7); \
48})
49
50#define segment_eq(a,b) ((a).ar4 == (b).ar4)
51
52
53static inline int __access_ok(const void __user *addr, unsigned long size)
54{
55 return 1;
56}
57#define access_ok(type,addr,size) __access_ok(addr,size)
58
59/*
60 * The exception table consists of pairs of addresses: the first is the
61 * address of an instruction that is allowed to fault, and the second is
62 * the address at which the program should continue. No registers are
63 * modified, so it is entirely up to the continuation code to figure out
64 * what to do.
65 *
66 * All the routines below use bits of fixup code that are out of line
67 * with the main instruction path. This means when everything is well,
68 * we don't even have to jump over them. Further, they do not intrude
69 * on our cache or tlb entries.
70 */
71
72struct exception_table_entry
73{
74 unsigned long insn, fixup;
75};
76
77struct uaccess_ops {
78 size_t (*copy_from_user)(size_t, const void __user *, void *);
79 size_t (*copy_from_user_small)(size_t, const void __user *, void *);
80 size_t (*copy_to_user)(size_t, void __user *, const void *);
81 size_t (*copy_to_user_small)(size_t, void __user *, const void *);
82 size_t (*copy_in_user)(size_t, void __user *, const void __user *);
83 size_t (*clear_user)(size_t, void __user *);
84 size_t (*strnlen_user)(size_t, const char __user *);
85 size_t (*strncpy_from_user)(size_t, const char __user *, char *);
86 int (*futex_atomic_op)(int op, int __user *, int oparg, int *old);
87 int (*futex_atomic_cmpxchg)(int __user *, int old, int new);
88};
89
90extern struct uaccess_ops uaccess;
91extern struct uaccess_ops uaccess_std;
92extern struct uaccess_ops uaccess_mvcos;
93extern struct uaccess_ops uaccess_mvcos_switch;
94extern struct uaccess_ops uaccess_pt;
95
96static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
97{
98 size = uaccess.copy_to_user_small(size, ptr, x);
99 return size ? -EFAULT : size;
100}
101
102static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
103{
104 size = uaccess.copy_from_user_small(size, ptr, x);
105 return size ? -EFAULT : size;
106}
107
108/*
109 * These are the main single-value transfer routines. They automatically
110 * use the right size if we just have the right pointer type.
111 */
112#define __put_user(x, ptr) \
113({ \
114 __typeof__(*(ptr)) __x = (x); \
115 int __pu_err = -EFAULT; \
116 __chk_user_ptr(ptr); \
117 switch (sizeof (*(ptr))) { \
118 case 1: \
119 case 2: \
120 case 4: \
121 case 8: \
122 __pu_err = __put_user_fn(sizeof (*(ptr)), \
123 ptr, &__x); \
124 break; \
125 default: \
126 __put_user_bad(); \
127 break; \
128 } \
129 __pu_err; \
130})
131
132#define put_user(x, ptr) \
133({ \
134 might_sleep(); \
135 __put_user(x, ptr); \
136})
137
138
139extern int __put_user_bad(void) __attribute__((noreturn));
140
141#define __get_user(x, ptr) \
142({ \
143 int __gu_err = -EFAULT; \
144 __chk_user_ptr(ptr); \
145 switch (sizeof(*(ptr))) { \
146 case 1: { \
147 unsigned char __x; \
148 __gu_err = __get_user_fn(sizeof (*(ptr)), \
149 ptr, &__x); \
150 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
151 break; \
152 }; \
153 case 2: { \
154 unsigned short __x; \
155 __gu_err = __get_user_fn(sizeof (*(ptr)), \
156 ptr, &__x); \
157 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
158 break; \
159 }; \
160 case 4: { \
161 unsigned int __x; \
162 __gu_err = __get_user_fn(sizeof (*(ptr)), \
163 ptr, &__x); \
164 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
165 break; \
166 }; \
167 case 8: { \
168 unsigned long long __x; \
169 __gu_err = __get_user_fn(sizeof (*(ptr)), \
170 ptr, &__x); \
171 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
172 break; \
173 }; \
174 default: \
175 __get_user_bad(); \
176 break; \
177 } \
178 __gu_err; \
179})
180
181#define get_user(x, ptr) \
182({ \
183 might_sleep(); \
184 __get_user(x, ptr); \
185})
186
187extern int __get_user_bad(void) __attribute__((noreturn));
188
189#define __put_user_unaligned __put_user
190#define __get_user_unaligned __get_user
191
192/**
193 * __copy_to_user: - Copy a block of data into user space, with less checking.
194 * @to: Destination address, in user space.
195 * @from: Source address, in kernel space.
196 * @n: Number of bytes to copy.
197 *
198 * Context: User context only. This function may sleep.
199 *
200 * Copy data from kernel space to user space. Caller must check
201 * the specified block with access_ok() before calling this function.
202 *
203 * Returns number of bytes that could not be copied.
204 * On success, this will be zero.
205 */
206static inline unsigned long __must_check
207__copy_to_user(void __user *to, const void *from, unsigned long n)
208{
209 if (__builtin_constant_p(n) && (n <= 256))
210 return uaccess.copy_to_user_small(n, to, from);
211 else
212 return uaccess.copy_to_user(n, to, from);
213}
214
215#define __copy_to_user_inatomic __copy_to_user
216#define __copy_from_user_inatomic __copy_from_user
217
218/**
219 * copy_to_user: - Copy a block of data into user space.
220 * @to: Destination address, in user space.
221 * @from: Source address, in kernel space.
222 * @n: Number of bytes to copy.
223 *
224 * Context: User context only. This function may sleep.
225 *
226 * Copy data from kernel space to user space.
227 *
228 * Returns number of bytes that could not be copied.
229 * On success, this will be zero.
230 */
231static inline unsigned long __must_check
232copy_to_user(void __user *to, const void *from, unsigned long n)
233{
234 might_sleep();
235 if (access_ok(VERIFY_WRITE, to, n))
236 n = __copy_to_user(to, from, n);
237 return n;
238}
239
240/**
241 * __copy_from_user: - Copy a block of data from user space, with less checking.
242 * @to: Destination address, in kernel space.
243 * @from: Source address, in user space.
244 * @n: Number of bytes to copy.
245 *
246 * Context: User context only. This function may sleep.
247 *
248 * Copy data from user space to kernel space. Caller must check
249 * the specified block with access_ok() before calling this function.
250 *
251 * Returns number of bytes that could not be copied.
252 * On success, this will be zero.
253 *
254 * If some data could not be copied, this function will pad the copied
255 * data to the requested size using zero bytes.
256 */
257static inline unsigned long __must_check
258__copy_from_user(void *to, const void __user *from, unsigned long n)
259{
260 if (__builtin_constant_p(n) && (n <= 256))
261 return uaccess.copy_from_user_small(n, from, to);
262 else
263 return uaccess.copy_from_user(n, from, to);
264}
265
266/**
267 * copy_from_user: - Copy a block of data from user space.
268 * @to: Destination address, in kernel space.
269 * @from: Source address, in user space.
270 * @n: Number of bytes to copy.
271 *
272 * Context: User context only. This function may sleep.
273 *
274 * Copy data from user space to kernel space.
275 *
276 * Returns number of bytes that could not be copied.
277 * On success, this will be zero.
278 *
279 * If some data could not be copied, this function will pad the copied
280 * data to the requested size using zero bytes.
281 */
282static inline unsigned long __must_check
283copy_from_user(void *to, const void __user *from, unsigned long n)
284{
285 might_sleep();
286 if (access_ok(VERIFY_READ, from, n))
287 n = __copy_from_user(to, from, n);
288 else
289 memset(to, 0, n);
290 return n;
291}
292
293static inline unsigned long __must_check
294__copy_in_user(void __user *to, const void __user *from, unsigned long n)
295{
296 return uaccess.copy_in_user(n, to, from);
297}
298
299static inline unsigned long __must_check
300copy_in_user(void __user *to, const void __user *from, unsigned long n)
301{
302 might_sleep();
303 if (__access_ok(from,n) && __access_ok(to,n))
304 n = __copy_in_user(to, from, n);
305 return n;
306}
307
308/*
309 * Copy a null terminated string from userspace.
310 */
311static inline long __must_check
312strncpy_from_user(char *dst, const char __user *src, long count)
313{
314 long res = -EFAULT;
315 might_sleep();
316 if (access_ok(VERIFY_READ, src, 1))
317 res = uaccess.strncpy_from_user(count, src, dst);
318 return res;
319}
320
321static inline unsigned long
322strnlen_user(const char __user * src, unsigned long n)
323{
324 might_sleep();
325 return uaccess.strnlen_user(n, src);
326}
327
328/**
329 * strlen_user: - Get the size of a string in user space.
330 * @str: The string to measure.
331 *
332 * Context: User context only. This function may sleep.
333 *
334 * Get the size of a NUL-terminated string in user space.
335 *
336 * Returns the size of the string INCLUDING the terminating NUL.
337 * On exception, returns 0.
338 *
339 * If there is a limit on the length of a valid string, you may wish to
340 * consider using strnlen_user() instead.
341 */
342#define strlen_user(str) strnlen_user(str, ~0UL)
343
344/*
345 * Zero Userspace
346 */
347
348static inline unsigned long __must_check
349__clear_user(void __user *to, unsigned long n)
350{
351 return uaccess.clear_user(n, to);
352}
353
354static inline unsigned long __must_check
355clear_user(void __user *to, unsigned long n)
356{
357 might_sleep();
358 if (access_ok(VERIFY_WRITE, to, n))
359 n = uaccess.clear_user(n, to);
360 return n;
361}
362
363#endif /* __S390_UACCESS_H */
diff --git a/arch/s390/include/asm/ucontext.h b/arch/s390/include/asm/ucontext.h
new file mode 100644
index 000000000000..d69bec0b03f5
--- /dev/null
+++ b/arch/s390/include/asm/ucontext.h
@@ -0,0 +1,20 @@
1/*
2 * include/asm-s390/ucontext.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/ucontext.h"
7 */
8
9#ifndef _ASM_S390_UCONTEXT_H
10#define _ASM_S390_UCONTEXT_H
11
12struct ucontext {
13 unsigned long uc_flags;
14 struct ucontext *uc_link;
15 stack_t uc_stack;
16 _sigregs uc_mcontext;
17 sigset_t uc_sigmask; /* mask last for extensibility */
18};
19
20#endif /* !_ASM_S390_UCONTEXT_H */
diff --git a/arch/s390/include/asm/unaligned.h b/arch/s390/include/asm/unaligned.h
new file mode 100644
index 000000000000..da9627afe5d8
--- /dev/null
+++ b/arch/s390/include/asm/unaligned.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_S390_UNALIGNED_H
2#define _ASM_S390_UNALIGNED_H
3
4/*
5 * The S390 can do unaligned accesses itself.
6 */
7#include <linux/unaligned/access_ok.h>
8#include <linux/unaligned/generic.h>
9
10#define get_unaligned __get_unaligned_be
11#define put_unaligned __put_unaligned_be
12
13#endif /* _ASM_S390_UNALIGNED_H */
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
new file mode 100644
index 000000000000..c8ad350d1444
--- /dev/null
+++ b/arch/s390/include/asm/unistd.h
@@ -0,0 +1,411 @@
1/*
2 * include/asm-s390/unistd.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/unistd.h"
7 */
8
9#ifndef _ASM_S390_UNISTD_H_
10#define _ASM_S390_UNISTD_H_
11
12/*
13 * This file contains the system call numbers.
14 */
15
16#define __NR_exit 1
17#define __NR_fork 2
18#define __NR_read 3
19#define __NR_write 4
20#define __NR_open 5
21#define __NR_close 6
22#define __NR_restart_syscall 7
23#define __NR_creat 8
24#define __NR_link 9
25#define __NR_unlink 10
26#define __NR_execve 11
27#define __NR_chdir 12
28#define __NR_mknod 14
29#define __NR_chmod 15
30#define __NR_lseek 19
31#define __NR_getpid 20
32#define __NR_mount 21
33#define __NR_umount 22
34#define __NR_ptrace 26
35#define __NR_alarm 27
36#define __NR_pause 29
37#define __NR_utime 30
38#define __NR_access 33
39#define __NR_nice 34
40#define __NR_sync 36
41#define __NR_kill 37
42#define __NR_rename 38
43#define __NR_mkdir 39
44#define __NR_rmdir 40
45#define __NR_dup 41
46#define __NR_pipe 42
47#define __NR_times 43
48#define __NR_brk 45
49#define __NR_signal 48
50#define __NR_acct 51
51#define __NR_umount2 52
52#define __NR_ioctl 54
53#define __NR_fcntl 55
54#define __NR_setpgid 57
55#define __NR_umask 60
56#define __NR_chroot 61
57#define __NR_ustat 62
58#define __NR_dup2 63
59#define __NR_getppid 64
60#define __NR_getpgrp 65
61#define __NR_setsid 66
62#define __NR_sigaction 67
63#define __NR_sigsuspend 72
64#define __NR_sigpending 73
65#define __NR_sethostname 74
66#define __NR_setrlimit 75
67#define __NR_getrusage 77
68#define __NR_gettimeofday 78
69#define __NR_settimeofday 79
70#define __NR_symlink 83
71#define __NR_readlink 85
72#define __NR_uselib 86
73#define __NR_swapon 87
74#define __NR_reboot 88
75#define __NR_readdir 89
76#define __NR_mmap 90
77#define __NR_munmap 91
78#define __NR_truncate 92
79#define __NR_ftruncate 93
80#define __NR_fchmod 94
81#define __NR_getpriority 96
82#define __NR_setpriority 97
83#define __NR_statfs 99
84#define __NR_fstatfs 100
85#define __NR_socketcall 102
86#define __NR_syslog 103
87#define __NR_setitimer 104
88#define __NR_getitimer 105
89#define __NR_stat 106
90#define __NR_lstat 107
91#define __NR_fstat 108
92#define __NR_lookup_dcookie 110
93#define __NR_vhangup 111
94#define __NR_idle 112
95#define __NR_wait4 114
96#define __NR_swapoff 115
97#define __NR_sysinfo 116
98#define __NR_ipc 117
99#define __NR_fsync 118
100#define __NR_sigreturn 119
101#define __NR_clone 120
102#define __NR_setdomainname 121
103#define __NR_uname 122
104#define __NR_adjtimex 124
105#define __NR_mprotect 125
106#define __NR_sigprocmask 126
107#define __NR_create_module 127
108#define __NR_init_module 128
109#define __NR_delete_module 129
110#define __NR_get_kernel_syms 130
111#define __NR_quotactl 131
112#define __NR_getpgid 132
113#define __NR_fchdir 133
114#define __NR_bdflush 134
115#define __NR_sysfs 135
116#define __NR_personality 136
117#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
118#define __NR_getdents 141
119#define __NR_flock 143
120#define __NR_msync 144
121#define __NR_readv 145
122#define __NR_writev 146
123#define __NR_getsid 147
124#define __NR_fdatasync 148
125#define __NR__sysctl 149
126#define __NR_mlock 150
127#define __NR_munlock 151
128#define __NR_mlockall 152
129#define __NR_munlockall 153
130#define __NR_sched_setparam 154
131#define __NR_sched_getparam 155
132#define __NR_sched_setscheduler 156
133#define __NR_sched_getscheduler 157
134#define __NR_sched_yield 158
135#define __NR_sched_get_priority_max 159
136#define __NR_sched_get_priority_min 160
137#define __NR_sched_rr_get_interval 161
138#define __NR_nanosleep 162
139#define __NR_mremap 163
140#define __NR_query_module 167
141#define __NR_poll 168
142#define __NR_nfsservctl 169
143#define __NR_prctl 172
144#define __NR_rt_sigreturn 173
145#define __NR_rt_sigaction 174
146#define __NR_rt_sigprocmask 175
147#define __NR_rt_sigpending 176
148#define __NR_rt_sigtimedwait 177
149#define __NR_rt_sigqueueinfo 178
150#define __NR_rt_sigsuspend 179
151#define __NR_pread64 180
152#define __NR_pwrite64 181
153#define __NR_getcwd 183
154#define __NR_capget 184
155#define __NR_capset 185
156#define __NR_sigaltstack 186
157#define __NR_sendfile 187
158#define __NR_getpmsg 188
159#define __NR_putpmsg 189
160#define __NR_vfork 190
161#define __NR_pivot_root 217
162#define __NR_mincore 218
163#define __NR_madvise 219
164#define __NR_getdents64 220
165#define __NR_readahead 222
166#define __NR_setxattr 224
167#define __NR_lsetxattr 225
168#define __NR_fsetxattr 226
169#define __NR_getxattr 227
170#define __NR_lgetxattr 228
171#define __NR_fgetxattr 229
172#define __NR_listxattr 230
173#define __NR_llistxattr 231
174#define __NR_flistxattr 232
175#define __NR_removexattr 233
176#define __NR_lremovexattr 234
177#define __NR_fremovexattr 235
178#define __NR_gettid 236
179#define __NR_tkill 237
180#define __NR_futex 238
181#define __NR_sched_setaffinity 239
182#define __NR_sched_getaffinity 240
183#define __NR_tgkill 241
184/* Number 242 is reserved for tux */
185#define __NR_io_setup 243
186#define __NR_io_destroy 244
187#define __NR_io_getevents 245
188#define __NR_io_submit 246
189#define __NR_io_cancel 247
190#define __NR_exit_group 248
191#define __NR_epoll_create 249
192#define __NR_epoll_ctl 250
193#define __NR_epoll_wait 251
194#define __NR_set_tid_address 252
195#define __NR_fadvise64 253
196#define __NR_timer_create 254
197#define __NR_timer_settime (__NR_timer_create+1)
198#define __NR_timer_gettime (__NR_timer_create+2)
199#define __NR_timer_getoverrun (__NR_timer_create+3)
200#define __NR_timer_delete (__NR_timer_create+4)
201#define __NR_clock_settime (__NR_timer_create+5)
202#define __NR_clock_gettime (__NR_timer_create+6)
203#define __NR_clock_getres (__NR_timer_create+7)
204#define __NR_clock_nanosleep (__NR_timer_create+8)
205/* Number 263 is reserved for vserver */
206#define __NR_statfs64 265
207#define __NR_fstatfs64 266
208#define __NR_remap_file_pages 267
209/* Number 268 is reserved for new sys_mbind */
210/* Number 269 is reserved for new sys_get_mempolicy */
211/* Number 270 is reserved for new sys_set_mempolicy */
212#define __NR_mq_open 271
213#define __NR_mq_unlink 272
214#define __NR_mq_timedsend 273
215#define __NR_mq_timedreceive 274
216#define __NR_mq_notify 275
217#define __NR_mq_getsetattr 276
218#define __NR_kexec_load 277
219#define __NR_add_key 278
220#define __NR_request_key 279
221#define __NR_keyctl 280
222#define __NR_waitid 281
223#define __NR_ioprio_set 282
224#define __NR_ioprio_get 283
225#define __NR_inotify_init 284
226#define __NR_inotify_add_watch 285
227#define __NR_inotify_rm_watch 286
228/* Number 287 is reserved for new sys_migrate_pages */
229#define __NR_openat 288
230#define __NR_mkdirat 289
231#define __NR_mknodat 290
232#define __NR_fchownat 291
233#define __NR_futimesat 292
234#define __NR_unlinkat 294
235#define __NR_renameat 295
236#define __NR_linkat 296
237#define __NR_symlinkat 297
238#define __NR_readlinkat 298
239#define __NR_fchmodat 299
240#define __NR_faccessat 300
241#define __NR_pselect6 301
242#define __NR_ppoll 302
243#define __NR_unshare 303
244#define __NR_set_robust_list 304
245#define __NR_get_robust_list 305
246#define __NR_splice 306
247#define __NR_sync_file_range 307
248#define __NR_tee 308
249#define __NR_vmsplice 309
250/* Number 310 is reserved for new sys_move_pages */
251#define __NR_getcpu 311
252#define __NR_epoll_pwait 312
253#define __NR_utimes 313
254#define __NR_fallocate 314
255#define __NR_utimensat 315
256#define __NR_signalfd 316
257#define __NR_timerfd 317
258#define __NR_eventfd 318
259#define __NR_timerfd_create 319
260#define __NR_timerfd_settime 320
261#define __NR_timerfd_gettime 321
262#define __NR_signalfd4 322
263#define __NR_eventfd2 323
264#define __NR_inotify_init1 324
265#define __NR_pipe2 325
266#define __NR_dup3 326
267#define __NR_epoll_create1 327
268#define NR_syscalls 328
269
270/*
271 * There are some system calls that are not present on 64 bit, some
272 * have a different name although they do the same (e.g. __NR_chown32
273 * is __NR_chown on 64 bit).
274 */
275#ifndef __s390x__
276
277#define __NR_time 13
278#define __NR_lchown 16
279#define __NR_setuid 23
280#define __NR_getuid 24
281#define __NR_stime 25
282#define __NR_setgid 46
283#define __NR_getgid 47
284#define __NR_geteuid 49
285#define __NR_getegid 50
286#define __NR_setreuid 70
287#define __NR_setregid 71
288#define __NR_getrlimit 76
289#define __NR_getgroups 80
290#define __NR_setgroups 81
291#define __NR_fchown 95
292#define __NR_ioperm 101
293#define __NR_setfsuid 138
294#define __NR_setfsgid 139
295#define __NR__llseek 140
296#define __NR__newselect 142
297#define __NR_setresuid 164
298#define __NR_getresuid 165
299#define __NR_setresgid 170
300#define __NR_getresgid 171
301#define __NR_chown 182
302#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
303#define __NR_mmap2 192
304#define __NR_truncate64 193
305#define __NR_ftruncate64 194
306#define __NR_stat64 195
307#define __NR_lstat64 196
308#define __NR_fstat64 197
309#define __NR_lchown32 198
310#define __NR_getuid32 199
311#define __NR_getgid32 200
312#define __NR_geteuid32 201
313#define __NR_getegid32 202
314#define __NR_setreuid32 203
315#define __NR_setregid32 204
316#define __NR_getgroups32 205
317#define __NR_setgroups32 206
318#define __NR_fchown32 207
319#define __NR_setresuid32 208
320#define __NR_getresuid32 209
321#define __NR_setresgid32 210
322#define __NR_getresgid32 211
323#define __NR_chown32 212
324#define __NR_setuid32 213
325#define __NR_setgid32 214
326#define __NR_setfsuid32 215
327#define __NR_setfsgid32 216
328#define __NR_fcntl64 221
329#define __NR_sendfile64 223
330#define __NR_fadvise64_64 264
331#define __NR_fstatat64 293
332
333#else
334
335#define __NR_select 142
336#define __NR_getrlimit 191 /* SuS compliant getrlimit */
337#define __NR_lchown 198
338#define __NR_getuid 199
339#define __NR_getgid 200
340#define __NR_geteuid 201
341#define __NR_getegid 202
342#define __NR_setreuid 203
343#define __NR_setregid 204
344#define __NR_getgroups 205
345#define __NR_setgroups 206
346#define __NR_fchown 207
347#define __NR_setresuid 208
348#define __NR_getresuid 209
349#define __NR_setresgid 210
350#define __NR_getresgid 211
351#define __NR_chown 212
352#define __NR_setuid 213
353#define __NR_setgid 214
354#define __NR_setfsuid 215
355#define __NR_setfsgid 216
356#define __NR_newfstatat 293
357
358#endif
359
360#ifdef __KERNEL__
361
362#ifndef CONFIG_64BIT
363#define __IGNORE_select
364#else
365#define __IGNORE_time
366#endif
367
368/* Ignore NUMA system calls. Not wired up on s390. */
369#define __IGNORE_mbind
370#define __IGNORE_get_mempolicy
371#define __IGNORE_set_mempolicy
372#define __IGNORE_migrate_pages
373#define __IGNORE_move_pages
374
375#define __ARCH_WANT_IPC_PARSE_VERSION
376#define __ARCH_WANT_OLD_READDIR
377#define __ARCH_WANT_SYS_ALARM
378#define __ARCH_WANT_SYS_GETHOSTNAME
379#define __ARCH_WANT_SYS_PAUSE
380#define __ARCH_WANT_SYS_SIGNAL
381#define __ARCH_WANT_SYS_UTIME
382#define __ARCH_WANT_SYS_SOCKETCALL
383#define __ARCH_WANT_SYS_FADVISE64
384#define __ARCH_WANT_SYS_GETPGRP
385#define __ARCH_WANT_SYS_LLSEEK
386#define __ARCH_WANT_SYS_NICE
387#define __ARCH_WANT_SYS_OLD_GETRLIMIT
388#define __ARCH_WANT_SYS_OLDUMOUNT
389#define __ARCH_WANT_SYS_SIGPENDING
390#define __ARCH_WANT_SYS_SIGPROCMASK
391#define __ARCH_WANT_SYS_RT_SIGACTION
392#define __ARCH_WANT_SYS_RT_SIGSUSPEND
393# ifndef CONFIG_64BIT
394# define __ARCH_WANT_STAT64
395# define __ARCH_WANT_SYS_TIME
396# endif
397# ifdef CONFIG_COMPAT
398# define __ARCH_WANT_COMPAT_SYS_TIME
399# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
400# endif
401
402/*
403 * "Conditional" syscalls
404 *
405 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
406 * but it doesn't work on all toolchains, so we just do it by hand
407 */
408#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
409
410#endif /* __KERNEL__ */
411#endif /* _ASM_S390_UNISTD_H_ */
diff --git a/arch/s390/include/asm/user.h b/arch/s390/include/asm/user.h
new file mode 100644
index 000000000000..1b050e35fdc6
--- /dev/null
+++ b/arch/s390/include/asm/user.h
@@ -0,0 +1,76 @@
1/*
2 * include/asm-s390/user.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/usr.h"
7 */
8
9#ifndef _S390_USER_H
10#define _S390_USER_H
11
12#include <asm/page.h>
13#include <asm/ptrace.h>
14/* Core file format: The core file is written in such a way that gdb
15 can understand it and provide useful information to the user (under
16 linux we use the 'trad-core' bfd). There are quite a number of
17 obstacles to being able to view the contents of the floating point
18 registers, and until these are solved you will not be able to view the
19 contents of them. Actually, you can read in the core file and look at
20 the contents of the user struct to find out what the floating point
21 registers contain.
22 The actual file contents are as follows:
23 UPAGE: 1 page consisting of a user struct that tells gdb what is present
24 in the file. Directly after this is a copy of the task_struct, which
25 is currently not used by gdb, but it may come in useful at some point.
26 All of the registers are stored as part of the upage. The upage should
27 always be only one page.
28 DATA: The data area is stored. We use current->end_text to
29 current->brk to pick up all of the user variables, plus any memory
30 that may have been malloced. No attempt is made to determine if a page
31 is demand-zero or if a page is totally unused, we just cover the entire
32 range. All of the addresses are rounded in such a way that an integral
33 number of pages is written.
34 STACK: We need the stack information in order to get a meaningful
35 backtrace. We need to write the data from (esp) to
36 current->start_stack, so we round each of these off in order to be able
37 to write an integer number of pages.
38 The minimum core file size is 3 pages, or 12288 bytes.
39*/
40
41
42/*
43 * This is the old layout of "struct pt_regs", and
44 * is still the layout used by user mode (the new
45 * pt_regs doesn't have all registers as the kernel
46 * doesn't use the extra segment registers)
47 */
48
49/* When the kernel dumps core, it starts by dumping the user struct -
50 this will be used by gdb to figure out where the data and stack segments
51 are within the file, and what virtual addresses to use. */
52struct user {
53/* We start with the registers, to mimic the way that "memory" is returned
54 from the ptrace(3,...) function. */
55 struct user_regs_struct regs; /* Where the registers are actually stored */
56/* The rest of this junk is to help gdb figure out what goes where */
57 unsigned long int u_tsize; /* Text segment size (pages). */
58 unsigned long int u_dsize; /* Data segment size (pages). */
59 unsigned long int u_ssize; /* Stack segment size (pages). */
60 unsigned long start_code; /* Starting virtual address of text. */
61 unsigned long start_stack; /* Starting virtual address of stack area.
62 This is actually the bottom of the stack,
63 the top of the stack is always found in the
64 esp register. */
65 long int signal; /* Signal that caused the core dump. */
66 unsigned long u_ar0; /* Used by gdb to help find the values for */
67 /* the registers. */
68 unsigned long magic; /* To uniquely identify a core file */
69 char u_comm[32]; /* User command that was responsible */
70};
71#define NBPG PAGE_SIZE
72#define UPAGES 1
73#define HOST_TEXT_START_ADDR (u.start_code)
74#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
75
76#endif /* _S390_USER_H */
diff --git a/arch/s390/include/asm/vtoc.h b/arch/s390/include/asm/vtoc.h
new file mode 100644
index 000000000000..3a5267d90d29
--- /dev/null
+++ b/arch/s390/include/asm/vtoc.h
@@ -0,0 +1,203 @@
1/*
2 * include/asm-s390/vtoc.h
3 *
4 * This file contains volume label definitions for DASD devices.
5 *
6 * (C) Copyright IBM Corp. 2005
7 *
8 * Author(s): Volker Sameske <sameske@de.ibm.com>
9 *
10 */
11
12#ifndef _ASM_S390_VTOC_H
13#define _ASM_S390_VTOC_H
14
15#include <linux/types.h>
16
17struct vtoc_ttr
18{
19 __u16 tt;
20 __u8 r;
21} __attribute__ ((packed));
22
23struct vtoc_cchhb
24{
25 __u16 cc;
26 __u16 hh;
27 __u8 b;
28} __attribute__ ((packed));
29
30struct vtoc_cchh
31{
32 __u16 cc;
33 __u16 hh;
34} __attribute__ ((packed));
35
36struct vtoc_labeldate
37{
38 __u8 year;
39 __u16 day;
40} __attribute__ ((packed));
41
42struct vtoc_volume_label
43{
44 char volkey[4]; /* volume key = volume label */
45 char vollbl[4]; /* volume label */
46 char volid[6]; /* volume identifier */
47 __u8 security; /* security byte */
48 struct vtoc_cchhb vtoc; /* VTOC address */
49 char res1[5]; /* reserved */
50 char cisize[4]; /* CI-size for FBA,... */
51 /* ...blanks for CKD */
52 char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */
53 char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */
54 char res2[4]; /* reserved */
55 char lvtoc[14]; /* owner code for LVTOC */
56 char res3[29]; /* reserved */
57} __attribute__ ((packed));
58
59struct vtoc_extent
60{
61 __u8 typeind; /* extent type indicator */
62 __u8 seqno; /* extent sequence number */
63 struct vtoc_cchh llimit; /* starting point of this extent */
64 struct vtoc_cchh ulimit; /* ending point of this extent */
65} __attribute__ ((packed));
66
67struct vtoc_dev_const
68{
69 __u16 DS4DSCYL; /* number of logical cyls */
70 __u16 DS4DSTRK; /* number of tracks in a logical cylinder */
71 __u16 DS4DEVTK; /* device track length */
72 __u8 DS4DEVI; /* non-last keyed record overhead */
73 __u8 DS4DEVL; /* last keyed record overhead */
74 __u8 DS4DEVK; /* non-keyed record overhead differential */
75 __u8 DS4DEVFG; /* flag byte */
76 __u16 DS4DEVTL; /* device tolerance */
77 __u8 DS4DEVDT; /* number of DSCB's per track */
78 __u8 DS4DEVDB; /* number of directory blocks per track */
79} __attribute__ ((packed));
80
81struct vtoc_format1_label
82{
83 char DS1DSNAM[44]; /* data set name */
84 __u8 DS1FMTID; /* format identifier */
85 char DS1DSSN[6]; /* data set serial number */
86 __u16 DS1VOLSQ; /* volume sequence number */
87 struct vtoc_labeldate DS1CREDT; /* creation date: ydd */
88 struct vtoc_labeldate DS1EXPDT; /* expiration date */
89 __u8 DS1NOEPV; /* number of extents on volume */
90 __u8 DS1NOBDB; /* no. of bytes used in last direction blk */
91 __u8 DS1FLAG1; /* flag 1 */
92 char DS1SYSCD[13]; /* system code */
93 struct vtoc_labeldate DS1REFD; /* date last referenced */
94 __u8 DS1SMSFG; /* system managed storage indicators */
95 __u8 DS1SCXTF; /* sec. space extension flag byte */
96 __u16 DS1SCXTV; /* secondary space extension value */
97 __u8 DS1DSRG1; /* data set organisation byte 1 */
98 __u8 DS1DSRG2; /* data set organisation byte 2 */
99 __u8 DS1RECFM; /* record format */
100 __u8 DS1OPTCD; /* option code */
101 __u16 DS1BLKL; /* block length */
102 __u16 DS1LRECL; /* record length */
103 __u8 DS1KEYL; /* key length */
104 __u16 DS1RKP; /* relative key position */
105 __u8 DS1DSIND; /* data set indicators */
106 __u8 DS1SCAL1; /* secondary allocation flag byte */
107 char DS1SCAL3[3]; /* secondary allocation quantity */
108 struct vtoc_ttr DS1LSTAR; /* last used track and block on track */
109 __u16 DS1TRBAL; /* space remaining on last used track */
110 __u16 res1; /* reserved */
111 struct vtoc_extent DS1EXT1; /* first extent description */
112 struct vtoc_extent DS1EXT2; /* second extent description */
113 struct vtoc_extent DS1EXT3; /* third extent description */
114 struct vtoc_cchhb DS1PTRDS; /* possible pointer to f2 or f3 DSCB */
115} __attribute__ ((packed));
116
117struct vtoc_format4_label
118{
119 char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */
120 __u8 DS4IDFMT; /* format identifier */
121 struct vtoc_cchhb DS4HPCHR; /* highest address of a format 1 DSCB */
122 __u16 DS4DSREC; /* number of available DSCB's */
123 struct vtoc_cchh DS4HCCHH; /* CCHH of next available alternate track */
124 __u16 DS4NOATK; /* number of remaining alternate tracks */
125 __u8 DS4VTOCI; /* VTOC indicators */
126 __u8 DS4NOEXT; /* number of extents in VTOC */
127 __u8 DS4SMSFG; /* system managed storage indicators */
128 __u8 DS4DEVAC; /* number of alternate cylinders.
129 * Subtract from first two bytes of
130 * DS4DEVSZ to get number of usable
131 * cylinders. can be zero. valid
132 * only if DS4DEVAV on. */
133 struct vtoc_dev_const DS4DEVCT; /* device constants */
134 char DS4AMTIM[8]; /* VSAM time stamp */
135 char DS4AMCAT[3]; /* VSAM catalog indicator */
136 char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */
137 char res1[5]; /* reserved */
138 char DS4F6PTR[5]; /* pointer to first format 6 DSCB */
139 struct vtoc_extent DS4VTOCE; /* VTOC extent description */
140 char res2[10]; /* reserved */
141 __u8 DS4EFLVL; /* extended free-space management level */
142 struct vtoc_cchhb DS4EFPTR; /* pointer to extended free-space info */
143 char res3[9]; /* reserved */
144} __attribute__ ((packed));
145
146struct vtoc_ds5ext
147{
148 __u16 t; /* RTA of the first track of free extent */
149 __u16 fc; /* number of whole cylinders in free ext. */
150 __u8 ft; /* number of remaining free tracks */
151} __attribute__ ((packed));
152
153struct vtoc_format5_label
154{
155 char DS5KEYID[4]; /* key identifier */
156 struct vtoc_ds5ext DS5AVEXT; /* first available (free-space) extent. */
157 struct vtoc_ds5ext DS5EXTAV[7]; /* seven available extents */
158 __u8 DS5FMTID; /* format identifier */
159 struct vtoc_ds5ext DS5MAVET[18]; /* eighteen available extents */
160 struct vtoc_cchhb DS5PTRDS; /* pointer to next format5 DSCB */
161} __attribute__ ((packed));
162
163struct vtoc_ds7ext
164{
165 __u32 a; /* starting RTA value */
166 __u32 b; /* ending RTA value + 1 */
167} __attribute__ ((packed));
168
169struct vtoc_format7_label
170{
171 char DS7KEYID[4]; /* key identifier */
172 struct vtoc_ds7ext DS7EXTNT[5]; /* space for 5 extent descriptions */
173 __u8 DS7FMTID; /* format identifier */
174 struct vtoc_ds7ext DS7ADEXT[11]; /* space for 11 extent descriptions */
175 char res1[2]; /* reserved */
176 struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */
177} __attribute__ ((packed));
178
179struct vtoc_cms_label {
180 __u8 label_id[4]; /* Label identifier */
181 __u8 vol_id[6]; /* Volid */
182 __u16 version_id; /* Version identifier */
183 __u32 block_size; /* Disk block size */
184 __u32 origin_ptr; /* Disk origin pointer */
185 __u32 usable_count; /* Number of usable cylinders/blocks */
186 __u32 formatted_count; /* Maximum number of formatted cylinders/
187 * blocks */
188 __u32 block_count; /* Disk size in CMS blocks */
189 __u32 used_count; /* Number of CMS blocks in use */
190 __u32 fst_size; /* File Status Table (FST) size */
191 __u32 fst_count; /* Number of FSTs per CMS block */
192 __u8 format_date[6]; /* Disk FORMAT date */
193 __u8 reserved1[2];
194 __u32 disk_offset; /* Disk offset when reserved*/
195 __u32 map_block; /* Allocation Map Block with next hole */
196 __u32 hblk_disp; /* Displacement into HBLK data of next hole */
197 __u32 user_disp; /* Displacement into user part of Allocation
198 * map */
199 __u8 reserved2[4];
200 __u8 segment_name[8]; /* Name of shared segment */
201} __attribute__ ((packed));
202
203#endif /* _ASM_S390_VTOC_H */
diff --git a/arch/s390/include/asm/xor.h b/arch/s390/include/asm/xor.h
new file mode 100644
index 000000000000..c82eb12a5b18
--- /dev/null
+++ b/arch/s390/include/asm/xor.h
@@ -0,0 +1 @@
#include <asm-generic/xor.h>
diff --git a/arch/s390/include/asm/zcrypt.h b/arch/s390/include/asm/zcrypt.h
new file mode 100644
index 000000000000..00d3bbd44117
--- /dev/null
+++ b/arch/s390/include/asm/zcrypt.h
@@ -0,0 +1,276 @@
1/*
2 * include/asm-s390/zcrypt.h
3 *
4 * zcrypt 2.1.0 (user-visible header)
5 *
6 * Copyright (C) 2001, 2006 IBM Corporation
7 * Author(s): Robert Burroughs
8 * Eric Rossman (edrossma@us.ibm.com)
9 *
10 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ASM_S390_ZCRYPT_H
28#define __ASM_S390_ZCRYPT_H
29
30#define ZCRYPT_VERSION 2
31#define ZCRYPT_RELEASE 1
32#define ZCRYPT_VARIANT 1
33
34#include <linux/ioctl.h>
35#include <linux/compiler.h>
36
37/**
38 * struct ica_rsa_modexpo
39 *
40 * Requirements:
41 * - outputdatalength is at least as large as inputdatalength.
42 * - All key parts are right justified in their fields, padded on
43 * the left with zeroes.
44 * - length(b_key) = inputdatalength
45 * - length(n_modulus) = inputdatalength
46 */
47struct ica_rsa_modexpo {
48 char __user * inputdata;
49 unsigned int inputdatalength;
50 char __user * outputdata;
51 unsigned int outputdatalength;
52 char __user * b_key;
53 char __user * n_modulus;
54};
55
56/**
57 * struct ica_rsa_modexpo_crt
58 *
59 * Requirements:
60 * - inputdatalength is even.
61 * - outputdatalength is at least as large as inputdatalength.
62 * - All key parts are right justified in their fields, padded on
63 * the left with zeroes.
64 * - length(bp_key) = inputdatalength/2 + 8
65 * - length(bq_key) = inputdatalength/2
66 * - length(np_key) = inputdatalength/2 + 8
67 * - length(nq_key) = inputdatalength/2
68 * - length(u_mult_inv) = inputdatalength/2 + 8
69 */
70struct ica_rsa_modexpo_crt {
71 char __user * inputdata;
72 unsigned int inputdatalength;
73 char __user * outputdata;
74 unsigned int outputdatalength;
75 char __user * bp_key;
76 char __user * bq_key;
77 char __user * np_prime;
78 char __user * nq_prime;
79 char __user * u_mult_inv;
80};
81
82/**
83 * CPRBX
84 * Note that all shorts and ints are big-endian.
85 * All pointer fields are 16 bytes long, and mean nothing.
86 *
87 * A request CPRB is followed by a request_parameter_block.
88 *
89 * The request (or reply) parameter block is organized thus:
90 * function code
91 * VUD block
92 * key block
93 */
94struct CPRBX {
95 unsigned short cprb_len; /* CPRB length 220 */
96 unsigned char cprb_ver_id; /* CPRB version id. 0x02 */
97 unsigned char pad_000[3]; /* Alignment pad bytes */
98 unsigned char func_id[2]; /* function id 0x5432 */
99 unsigned char cprb_flags[4]; /* Flags */
100 unsigned int req_parml; /* request parameter buffer len */
101 unsigned int req_datal; /* request data buffer */
102 unsigned int rpl_msgbl; /* reply message block length */
103 unsigned int rpld_parml; /* replied parameter block len */
104 unsigned int rpl_datal; /* reply data block len */
105 unsigned int rpld_datal; /* replied data block len */
106 unsigned int req_extbl; /* request extension block len */
107 unsigned char pad_001[4]; /* reserved */
108 unsigned int rpld_extbl; /* replied extension block len */
109 unsigned char padx000[16 - sizeof (char *)];
110 unsigned char * req_parmb; /* request parm block 'address' */
111 unsigned char padx001[16 - sizeof (char *)];
112 unsigned char * req_datab; /* request data block 'address' */
113 unsigned char padx002[16 - sizeof (char *)];
114 unsigned char * rpl_parmb; /* reply parm block 'address' */
115 unsigned char padx003[16 - sizeof (char *)];
116 unsigned char * rpl_datab; /* reply data block 'address' */
117 unsigned char padx004[16 - sizeof (char *)];
118 unsigned char * req_extb; /* request extension block 'addr'*/
119 unsigned char padx005[16 - sizeof (char *)];
120 unsigned char * rpl_extb; /* reply extension block 'address'*/
121 unsigned short ccp_rtcode; /* server return code */
122 unsigned short ccp_rscode; /* server reason code */
123 unsigned int mac_data_len; /* Mac Data Length */
124 unsigned char logon_id[8]; /* Logon Identifier */
125 unsigned char mac_value[8]; /* Mac Value */
126 unsigned char mac_content_flgs;/* Mac content flag byte */
127 unsigned char pad_002; /* Alignment */
128 unsigned short domain; /* Domain */
129 unsigned char usage_domain[4];/* Usage domain */
130 unsigned char cntrl_domain[4];/* Control domain */
131 unsigned char S390enf_mask[4];/* S/390 enforcement mask */
132 unsigned char pad_004[36]; /* reserved */
133} __attribute__((packed));
134
135/**
136 * xcRB
137 */
138struct ica_xcRB {
139 unsigned short agent_ID;
140 unsigned int user_defined;
141 unsigned short request_ID;
142 unsigned int request_control_blk_length;
143 unsigned char padding1[16 - sizeof (char *)];
144 char __user * request_control_blk_addr;
145 unsigned int request_data_length;
146 char padding2[16 - sizeof (char *)];
147 char __user * request_data_address;
148 unsigned int reply_control_blk_length;
149 char padding3[16 - sizeof (char *)];
150 char __user * reply_control_blk_addr;
151 unsigned int reply_data_length;
152 char padding4[16 - sizeof (char *)];
153 char __user * reply_data_addr;
154 unsigned short priority_window;
155 unsigned int status;
156} __attribute__((packed));
157#define AUTOSELECT ((unsigned int)0xFFFFFFFF)
158
159#define ZCRYPT_IOCTL_MAGIC 'z'
160
161/**
162 * Interface notes:
163 *
164 * The ioctl()s which are implemented (along with relevant details)
165 * are:
166 *
167 * ICARSAMODEXPO
168 * Perform an RSA operation using a Modulus-Exponent pair
169 * This takes an ica_rsa_modexpo struct as its arg.
170 *
171 * NOTE: please refer to the comments preceding this structure
172 * for the implementation details for the contents of the
173 * block
174 *
175 * ICARSACRT
176 * Perform an RSA operation using a Chinese-Remainder Theorem key
177 * This takes an ica_rsa_modexpo_crt struct as its arg.
178 *
179 * NOTE: please refer to the comments preceding this structure
180 * for the implementation details for the contents of the
181 * block
182 *
183 * ZSECSENDCPRB
184 * Send an arbitrary CPRB to a crypto card.
185 *
186 * Z90STAT_STATUS_MASK
187 * Return an 64 element array of unsigned chars for the status of
188 * all devices.
189 * 0x01: PCICA
190 * 0x02: PCICC
191 * 0x03: PCIXCC_MCL2
192 * 0x04: PCIXCC_MCL3
193 * 0x05: CEX2C
194 * 0x06: CEX2A
195 * 0x0d: device is disabled via the proc filesystem
196 *
197 * Z90STAT_QDEPTH_MASK
198 * Return an 64 element array of unsigned chars for the queue
199 * depth of all devices.
200 *
201 * Z90STAT_PERDEV_REQCNT
202 * Return an 64 element array of unsigned integers for the number
203 * of successfully completed requests per device since the device
204 * was detected and made available.
205 *
206 * Z90STAT_REQUESTQ_COUNT
207 * Return an integer count of the number of entries waiting to be
208 * sent to a device.
209 *
210 * Z90STAT_PENDINGQ_COUNT
211 * Return an integer count of the number of entries sent to all
212 * devices awaiting the reply.
213 *
214 * Z90STAT_TOTALOPEN_COUNT
215 * Return an integer count of the number of open file handles.
216 *
217 * Z90STAT_DOMAIN_INDEX
218 * Return the integer value of the Cryptographic Domain.
219 *
220 * The following ioctls are deprecated and should be no longer used:
221 *
222 * Z90STAT_TOTALCOUNT
223 * Return an integer count of all device types together.
224 *
225 * Z90STAT_PCICACOUNT
226 * Return an integer count of all PCICAs.
227 *
228 * Z90STAT_PCICCCOUNT
229 * Return an integer count of all PCICCs.
230 *
231 * Z90STAT_PCIXCCMCL2COUNT
232 * Return an integer count of all MCL2 PCIXCCs.
233 *
234 * Z90STAT_PCIXCCMCL3COUNT
235 * Return an integer count of all MCL3 PCIXCCs.
236 *
237 * Z90STAT_CEX2CCOUNT
238 * Return an integer count of all CEX2Cs.
239 *
240 * Z90STAT_CEX2ACOUNT
241 * Return an integer count of all CEX2As.
242 *
243 * ICAZ90STATUS
244 * Return some device driver status in a ica_z90_status struct
245 * This takes an ica_z90_status struct as its arg.
246 *
247 * Z90STAT_PCIXCCCOUNT
248 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
249 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
250 * MCL2 PCIXCCs.
251 */
252
253/**
254 * Supported ioctl calls
255 */
256#define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x05, 0)
257#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0)
258#define ZSECSENDCPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0)
259
260/* New status calls */
261#define Z90STAT_TOTALCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x40, int)
262#define Z90STAT_PCICACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x41, int)
263#define Z90STAT_PCICCCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x42, int)
264#define Z90STAT_PCIXCCMCL2COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4b, int)
265#define Z90STAT_PCIXCCMCL3COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4c, int)
266#define Z90STAT_CEX2CCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4d, int)
267#define Z90STAT_CEX2ACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4e, int)
268#define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int)
269#define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int)
270#define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int)
271#define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int)
272#define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64])
273#define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64])
274#define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64])
275
276#endif /* __ASM_S390_ZCRYPT_H */
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index cb992c3d6b71..5131d50f851a 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -48,6 +48,9 @@ config GENERIC_HWEIGHT
48config GENERIC_HARDIRQS 48config GENERIC_HARDIRQS
49 def_bool y 49 def_bool y
50 50
51config GENERIC_HARDIRQS_NO__DO_IRQ
52 def_bool y
53
51config GENERIC_IRQ_PROBE 54config GENERIC_IRQ_PROBE
52 def_bool y 55 def_bool y
53 56
@@ -63,6 +66,10 @@ config GENERIC_TIME
63config GENERIC_CLOCKEVENTS 66config GENERIC_CLOCKEVENTS
64 def_bool n 67 def_bool n
65 68
69config GENERIC_LOCKBREAK
70 def_bool y
71 depends on SMP && PREEMPT
72
66config SYS_SUPPORTS_PM 73config SYS_SUPPORTS_PM
67 bool 74 bool
68 75
@@ -94,9 +101,6 @@ config ARCH_HAS_ILOG2_U64
94config ARCH_NO_VIRT_TO_BUS 101config ARCH_NO_VIRT_TO_BUS
95 def_bool y 102 def_bool y
96 103
97config ARCH_SUPPORTS_AOUT
98 def_bool y
99
100config IO_TRAPPED 104config IO_TRAPPED
101 bool 105 bool
102 106
@@ -483,6 +487,23 @@ config CRASH_DUMP
483 487
484 For more details see Documentation/kdump/kdump.txt 488 For more details see Documentation/kdump/kdump.txt
485 489
490config SECCOMP
491 bool "Enable seccomp to safely compute untrusted bytecode"
492 depends on PROC_FS
493 default y
494 help
495 This kernel feature is useful for number crunching applications
496 that may need to compute untrusted bytecode during their
497 execution. By using pipes or other transports made available to
498 the process as file descriptors supporting the read/write
499 syscalls, it's possible to isolate those applications in
500 their own address space using seccomp. Once seccomp is
501 enabled via prctl, it cannot be disabled and the task is only
502 allowed to execute a few safe syscalls defined by each seccomp
503 mode.
504
505 If unsure, say N.
506
486config SMP 507config SMP
487 bool "Symmetric multi-processing support" 508 bool "Symmetric multi-processing support"
488 depends on SYS_SUPPORTS_SMP 509 depends on SYS_SUPPORTS_SMP
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index 36f4b1f7066d..4d2d102e00d5 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -182,7 +182,7 @@ if SUPERH64
182 182
183config SH64_PROC_ASIDS 183config SH64_PROC_ASIDS
184 bool "Debug: report ASIDs through /proc/asids" 184 bool "Debug: report ASIDs through /proc/asids"
185 depends on PROC_FS 185 depends on PROC_FS && MMU
186 186
187config SH64_SR_WATCH 187config SH64_SR_WATCH
188 bool "Debug: set SR.WATCH to enable hardware watchpoints and trace" 188 bool "Debug: set SR.WATCH to enable hardware watchpoints and trace"
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 25659ce74baa..01d85c74481d 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -95,8 +95,6 @@ head-y := arch/sh/kernel/init_task.o
95head-$(CONFIG_SUPERH32) += arch/sh/kernel/head_32.o 95head-$(CONFIG_SUPERH32) += arch/sh/kernel/head_32.o
96head-$(CONFIG_SUPERH64) += arch/sh/kernel/head_64.o 96head-$(CONFIG_SUPERH64) += arch/sh/kernel/head_64.o
97 97
98LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
99
100core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/ 98core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/
101core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ 99core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
102 100
@@ -145,10 +143,6 @@ cpuincdir-$(CONFIG_CPU_SH4) += cpu-sh4
145cpuincdir-$(CONFIG_CPU_SH5) += cpu-sh5 143cpuincdir-$(CONFIG_CPU_SH5) += cpu-sh5
146cpuincdir-y += cpu-common # Must be last 144cpuincdir-y += cpu-common # Must be last
147 145
148libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
149libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
150libs-y += $(LIBGCC)
151
152drivers-y += arch/sh/drivers/ 146drivers-y += arch/sh/drivers/
153drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/ 147drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/
154 148
@@ -161,10 +155,16 @@ KBUILD_CFLAGS += -pipe $(cflags-y)
161KBUILD_CPPFLAGS += $(cflags-y) 155KBUILD_CPPFLAGS += $(cflags-y)
162KBUILD_AFLAGS += $(cflags-y) 156KBUILD_AFLAGS += $(cflags-y)
163 157
158LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
159
160libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
161libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
162libs-y += $(LIBGCC)
163
164PHONY += maketools FORCE 164PHONY += maketools FORCE
165 165
166maketools: include/linux/version.h FORCE 166maketools: include/linux/version.h FORCE
167 $(Q)$(MAKE) $(build)=arch/sh/tools arch/sh/include/asm/machtypes.h 167 $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
168 168
169all: $(KBUILD_IMAGE) 169all: $(KBUILD_IMAGE)
170 170
@@ -215,4 +215,4 @@ arch/sh/lib64/syscalltab.h: arch/sh/kernel/syscalls_64.S
215 $(call filechk,gen-syscalltab) 215 $(call filechk,gen-syscalltab)
216 216
217CLEAN_FILES += arch/sh/lib64/syscalltab.h \ 217CLEAN_FILES += arch/sh/lib64/syscalltab.h \
218 arch/sh/include/asm/machtypes.h 218 include/asm-sh/machtypes.h
diff --git a/arch/sh/boards/Makefile b/arch/sh/boards/Makefile
index ff9b93c5a91b..463022c7df3c 100644
--- a/arch/sh/boards/Makefile
+++ b/arch/sh/boards/Makefile
@@ -5,4 +5,4 @@ obj-$(CONFIG_SH_AP325RXA) += board-ap325rxa.o
5obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o 5obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o
6obj-$(CONFIG_SH_RSK7203) += board-rsk7203.o 6obj-$(CONFIG_SH_RSK7203) += board-rsk7203.o
7obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o 7obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o
8obj-$(CONFIG_SH_SHMIN) += board-shmin..o 8obj-$(CONFIG_SH_SHMIN) += board-shmin.o
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index 9c71603d29a2..025d4fe55a58 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -17,7 +17,6 @@
17#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/delay.h>
21#include <linux/smc911x.h> 20#include <linux/smc911x.h>
22#include <media/soc_camera_platform.h> 21#include <media/soc_camera_platform.h>
23#include <media/sh_mobile_ceu.h> 22#include <media/sh_mobile_ceu.h>
diff --git a/arch/sh/boards/mach-se/7343/irq.c b/arch/sh/boards/mach-se/7343/irq.c
index 5d96e2eef82a..051c29d4eae0 100644
--- a/arch/sh/boards/mach-se/7343/irq.c
+++ b/arch/sh/boards/mach-se/7343/irq.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/irq.h>
17#include <linux/io.h> 16#include <linux/io.h>
18#include <mach-se/mach/se7343.h> 17#include <mach-se/mach/se7343.h>
19 18
diff --git a/arch/sh/boards/mach-systemh/irq.c b/arch/sh/boards/mach-systemh/irq.c
index 0ba2fe674c47..601c9c8cdbec 100644
--- a/arch/sh/boards/mach-systemh/irq.c
+++ b/arch/sh/boards/mach-systemh/irq.c
@@ -11,9 +11,8 @@
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/interrupt.h>
14 15
15#include <linux/hdreg.h>
16#include <linux/ide.h>
17#include <asm/io.h> 16#include <asm/io.h>
18#include <asm/systemh7751.h> 17#include <asm/systemh7751.h>
19#include <asm/smc37c93x.h> 18#include <asm/smc37c93x.h>
diff --git a/arch/sh/configs/dreamcast_defconfig b/arch/sh/configs/dreamcast_defconfig
index d4075283956d..3dc1cbd8a981 100644
--- a/arch/sh/configs/dreamcast_defconfig
+++ b/arch/sh/configs/dreamcast_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.26 3# Linux kernel version: 2.6.27-rc1
4# Wed Jul 30 01:34:24 2008 4# Mon Aug 4 16:49:13 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -11,6 +11,7 @@ CONFIG_GENERIC_BUG=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
14CONFIG_GENERIC_IRQ_PROBE=y 15CONFIG_GENERIC_IRQ_PROBE=y
15CONFIG_GENERIC_CALIBRATE_DELAY=y 16CONFIG_GENERIC_CALIBRATE_DELAY=y
16CONFIG_GENERIC_TIME=y 17CONFIG_GENERIC_TIME=y
@@ -21,7 +22,6 @@ CONFIG_LOCKDEP_SUPPORT=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set 22# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set 23# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_ARCH_NO_VIRT_TO_BUS=y 24CONFIG_ARCH_NO_VIRT_TO_BUS=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
26 26
27# 27#
@@ -87,6 +87,7 @@ CONFIG_HAVE_OPROFILE=y
87# CONFIG_USE_GENERIC_SMP_HELPERS is not set 87# CONFIG_USE_GENERIC_SMP_HELPERS is not set
88CONFIG_HAVE_CLK=y 88CONFIG_HAVE_CLK=y
89CONFIG_PROC_PAGE_MONITOR=y 89CONFIG_PROC_PAGE_MONITOR=y
90CONFIG_HAVE_GENERIC_DMA_COHERENT=y
90CONFIG_SLABINFO=y 91CONFIG_SLABINFO=y
91CONFIG_RT_MUTEXES=y 92CONFIG_RT_MUTEXES=y
92# CONFIG_TINY_SHMEM is not set 93# CONFIG_TINY_SHMEM is not set
@@ -284,6 +285,7 @@ CONFIG_HZ=250
284# CONFIG_SCHED_HRTICK is not set 285# CONFIG_SCHED_HRTICK is not set
285# CONFIG_KEXEC is not set 286# CONFIG_KEXEC is not set
286# CONFIG_CRASH_DUMP is not set 287# CONFIG_CRASH_DUMP is not set
288CONFIG_SECCOMP=y
287# CONFIG_PREEMPT_NONE is not set 289# CONFIG_PREEMPT_NONE is not set
288# CONFIG_PREEMPT_VOLUNTARY is not set 290# CONFIG_PREEMPT_VOLUNTARY is not set
289CONFIG_PREEMPT=y 291CONFIG_PREEMPT=y
@@ -317,10 +319,6 @@ CONFIG_PCI_LEGACY=y
317# 319#
318CONFIG_BINFMT_ELF=y 320CONFIG_BINFMT_ELF=y
319# CONFIG_BINFMT_MISC is not set 321# CONFIG_BINFMT_MISC is not set
320
321#
322# Networking
323#
324CONFIG_NET=y 322CONFIG_NET=y
325 323
326# 324#
@@ -555,7 +553,7 @@ CONFIG_INPUT_KEYBOARD=y
555# CONFIG_KEYBOARD_XTKBD is not set 553# CONFIG_KEYBOARD_XTKBD is not set
556# CONFIG_KEYBOARD_NEWTON is not set 554# CONFIG_KEYBOARD_NEWTON is not set
557# CONFIG_KEYBOARD_STOWAWAY is not set 555# CONFIG_KEYBOARD_STOWAWAY is not set
558# CONFIG_KEYBOARD_MAPLE is not set 556CONFIG_KEYBOARD_MAPLE=y
559# CONFIG_KEYBOARD_SH_KEYSC is not set 557# CONFIG_KEYBOARD_SH_KEYSC is not set
560CONFIG_INPUT_MOUSE=y 558CONFIG_INPUT_MOUSE=y
561# CONFIG_MOUSE_PS2 is not set 559# CONFIG_MOUSE_PS2 is not set
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index 643ab5a7cf3b..b86aeabba61a 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -104,6 +104,15 @@ struct pt_dspregs {
104 104
105extern void show_regs(struct pt_regs *); 105extern void show_regs(struct pt_regs *);
106 106
107/*
108 * These are defined as per linux/ptrace.h.
109 */
110struct task_struct;
111
112#define arch_has_single_step() (1)
113extern void user_enable_single_step(struct task_struct *);
114extern void user_disable_single_step(struct task_struct *);
115
107#ifdef CONFIG_SH_DSP 116#ifdef CONFIG_SH_DSP
108#define task_pt_regs(task) \ 117#define task_pt_regs(task) \
109 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \ 118 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
diff --git a/arch/sh/include/asm/seccomp.h b/arch/sh/include/asm/seccomp.h
new file mode 100644
index 000000000000..3280ed3802ef
--- /dev/null
+++ b/arch/sh/include/asm/seccomp.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_SECCOMP_H
2
3#include <linux/unistd.h>
4
5#define __NR_seccomp_read __NR_read
6#define __NR_seccomp_write __NR_write
7#define __NR_seccomp_exit __NR_exit
8#define __NR_seccomp_sigreturn __NR_rt_sigreturn
9
10#endif /* __ASM_SECCOMP_H */
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index eeb4c747119e..0a894cafb1dd 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -117,24 +117,45 @@ static inline struct thread_info *current_thread_info(void)
117#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 117#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
118#define TIF_RESTORE_SIGMASK 3 /* restore signal mask in do_signal() */ 118#define TIF_RESTORE_SIGMASK 3 /* restore signal mask in do_signal() */
119#define TIF_SINGLESTEP 4 /* singlestepping active */ 119#define TIF_SINGLESTEP 4 /* singlestepping active */
120#define TIF_SYSCALL_AUDIT 5 120#define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */
121#define TIF_SECCOMP 6 /* secure computing */
122#define TIF_NOTIFY_RESUME 7 /* callback before returning to user */
121#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 123#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
122#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 124#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
123#define TIF_MEMDIE 18 125#define TIF_MEMDIE 18
124#define TIF_FREEZE 19 126#define TIF_FREEZE 19 /* Freezing for suspend */
125 127
126#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 128#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
127#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 129#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
128#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 130#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
129#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 131#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
130#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 132#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
131#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 133#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
132#define _TIF_USEDFPU (1<<TIF_USEDFPU) 134#define _TIF_SECCOMP (1 << TIF_SECCOMP)
133#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 135#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
134#define _TIF_FREEZE (1<<TIF_FREEZE) 136#define _TIF_USEDFPU (1 << TIF_USEDFPU)
135 137#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
136#define _TIF_WORK_MASK 0x000000FE /* work to do on interrupt/exception return */ 138#define _TIF_FREEZE (1 << TIF_FREEZE)
137#define _TIF_ALLWORK_MASK 0x000000FF /* work to do on any return to u-space */ 139
140/*
141 * _TIF_ALLWORK_MASK and _TIF_WORK_MASK need to fit within a byte, or we
142 * blow the tst immediate size constraints and need to fix up
143 * arch/sh/kernel/entry-common.S.
144 */
145
146/* work to do in syscall trace */
147#define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
148 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
149
150/* work to do on any return to u-space */
151#define _TIF_ALLWORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SIGPENDING | \
152 _TIF_NEED_RESCHED | _TIF_SYSCALL_AUDIT | \
153 _TIF_SINGLESTEP | _TIF_RESTORE_SIGMASK | \
154 _TIF_NOTIFY_RESUME)
155
156/* work to do on interrupt/exception return */
157#define _TIF_WORK_MASK (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
158 _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP))
138 159
139#endif /* __KERNEL__ */ 160#endif /* __KERNEL__ */
140 161
diff --git a/arch/sh/include/asm/tlb_64.h b/arch/sh/include/asm/tlb_64.h
index 0a96f3af69e3..ef0ae2a28f23 100644
--- a/arch/sh/include/asm/tlb_64.h
+++ b/arch/sh/include/asm/tlb_64.h
@@ -21,11 +21,9 @@
21#ifndef __ASSEMBLY__ 21#ifndef __ASSEMBLY__
22 22
23/** 23/**
24 * for_each_dtlb_entry 24 * for_each_dtlb_entry - Iterate over free (non-wired) DTLB entries
25 * 25 *
26 * @tlb: TLB entry 26 * @tlb: TLB entry
27 *
28 * Iterate over free (non-wired) DTLB entries
29 */ 27 */
30#define for_each_dtlb_entry(tlb) \ 28#define for_each_dtlb_entry(tlb) \
31 for (tlb = cpu_data->dtlb.first; \ 29 for (tlb = cpu_data->dtlb.first; \
@@ -33,11 +31,9 @@
33 tlb += cpu_data->dtlb.step) 31 tlb += cpu_data->dtlb.step)
34 32
35/** 33/**
36 * for_each_itlb_entry 34 * for_each_itlb_entry - Iterate over free (non-wired) ITLB entries
37 * 35 *
38 * @tlb: TLB entry 36 * @tlb: TLB entry
39 *
40 * Iterate over free (non-wired) ITLB entries
41 */ 37 */
42#define for_each_itlb_entry(tlb) \ 38#define for_each_itlb_entry(tlb) \
43 for (tlb = cpu_data->itlb.first; \ 39 for (tlb = cpu_data->itlb.first; \
@@ -45,11 +41,9 @@
45 tlb += cpu_data->itlb.step) 41 tlb += cpu_data->itlb.step)
46 42
47/** 43/**
48 * __flush_tlb_slot 44 * __flush_tlb_slot - Flushes TLB slot @slot.
49 * 45 *
50 * @slot: Address of TLB slot. 46 * @slot: Address of TLB slot.
51 *
52 * Flushes TLB slot @slot.
53 */ 47 */
54static inline void __flush_tlb_slot(unsigned long long slot) 48static inline void __flush_tlb_slot(unsigned long long slot)
55{ 49{
diff --git a/arch/sh/include/cpu-sh2/cpu/cache.h b/arch/sh/include/cpu-sh2/cpu/cache.h
index 4e0b16500686..673515bc4135 100644
--- a/arch/sh/include/cpu-sh2/cpu/cache.h
+++ b/arch/sh/include/cpu-sh2/cpu/cache.h
@@ -21,11 +21,11 @@
21#define CCR 0xffffffec 21#define CCR 0xffffffec
22 22
23#define CCR_CACHE_CE 0x01 /* Cache enable */ 23#define CCR_CACHE_CE 0x01 /* Cache enable */
24#define CCR_CACHE_WT 0x06 /* CCR[bit1=1,bit2=1] */ 24#define CCR_CACHE_WT 0x02 /* CCR[bit1=1,bit2=1] */
25 /* 0x00000000-0x7fffffff: Write-through */ 25 /* 0x00000000-0x7fffffff: Write-through */
26 /* 0x80000000-0x9fffffff: Write-back */ 26 /* 0x80000000-0x9fffffff: Write-back */
27 /* 0xc0000000-0xdfffffff: Write-through */ 27 /* 0xc0000000-0xdfffffff: Write-through */
28#define CCR_CACHE_CB 0x00 /* CCR[bit1=0,bit2=0] */ 28#define CCR_CACHE_CB 0x04 /* CCR[bit1=0,bit2=0] */
29 /* 0x00000000-0x7fffffff: Write-back */ 29 /* 0x00000000-0x7fffffff: Write-back */
30 /* 0x80000000-0x9fffffff: Write-through */ 30 /* 0x80000000-0x9fffffff: Write-through */
31 /* 0xc0000000-0xdfffffff: Write-back */ 31 /* 0xc0000000-0xdfffffff: Write-back */
@@ -36,6 +36,8 @@
36 36
37#define CCR_CACHE_ENABLE CCR_CACHE_CE 37#define CCR_CACHE_ENABLE CCR_CACHE_CE
38#define CCR_CACHE_INVALIDATE CCR_CACHE_CF 38#define CCR_CACHE_INVALIDATE CCR_CACHE_CF
39#define CACHE_PHYSADDR_MASK 0x1ffffc00
40
39#endif 41#endif
40 42
41#endif /* __ASM_CPU_SH2_CACHE_H */ 43#endif /* __ASM_CPU_SH2_CACHE_H */
diff --git a/arch/sh/include/cpu-sh2a/cpu/addrspace.h b/arch/sh/include/cpu-sh2a/cpu/addrspace.h
new file mode 100644
index 000000000000..31eb4b58aa6d
--- /dev/null
+++ b/arch/sh/include/cpu-sh2a/cpu/addrspace.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_SH_CPU_SH2A_ADDRSPACE_H
2#define __ASM_SH_CPU_SH2A_ADDRSPACE_H
3
4#define P0SEG 0x00000000
5#define P1SEG 0x00000000
6#define P2SEG 0x20000000
7#define P3SEG 0x40000000
8#define P4SEG 0x60000000
9
10#endif /* __ASM_SH_CPU_SH2A_ADDRSPACE_H */
diff --git a/arch/sh/include/cpu-sh2a/cpu/cache.h b/arch/sh/include/cpu-sh2a/cpu/cache.h
index afe228b3f493..defb0baa5a06 100644
--- a/arch/sh/include/cpu-sh2a/cpu/cache.h
+++ b/arch/sh/include/cpu-sh2a/cpu/cache.h
@@ -36,5 +36,8 @@
36 36
37#define CCR_CACHE_ENABLE (CCR_CACHE_OCE | CCR_CACHE_ICE) 37#define CCR_CACHE_ENABLE (CCR_CACHE_OCE | CCR_CACHE_ICE)
38#define CCR_CACHE_INVALIDATE (CCR_CACHE_OCI | CCR_CACHE_ICI) 38#define CCR_CACHE_INVALIDATE (CCR_CACHE_OCI | CCR_CACHE_ICI)
39#define CCR_ICACHE_INVALIDATE CCR_CACHE_ICI
40#define CCR_OCACHE_INVALIDATE CCR_CACHE_OCI
41#define CACHE_PHYSADDR_MASK 0x1ffffc00
39 42
40#endif /* __ASM_CPU_SH2A_CACHE_H */ 43#endif /* __ASM_CPU_SH2A_CACHE_H */
diff --git a/arch/sh/include/cpu-sh2a/cpu/cacheflush.h b/arch/sh/include/cpu-sh2a/cpu/cacheflush.h
new file mode 100644
index 000000000000..3d3b9205d2ac
--- /dev/null
+++ b/arch/sh/include/cpu-sh2a/cpu/cacheflush.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_CPU_SH2A_CACHEFLUSH_H
2#define __ASM_CPU_SH2A_CACHEFLUSH_H
3
4/*
5 * Cache flushing:
6 *
7 * - flush_cache_all() flushes entire cache
8 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
9 * - flush_cache_dup mm(mm) handles cache flushing when forking
10 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
11 * - flush_cache_range(vma, start, end) flushes a range of pages
12 *
13 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
14 * - flush_icache_range(start, end) flushes(invalidates) a range for icache
15 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
16 *
17 * Caches are indexed (effectively) by physical address on SH-2, so
18 * we don't need them.
19 */
20#define flush_cache_all() do { } while (0)
21#define flush_cache_mm(mm) do { } while (0)
22#define flush_cache_dup_mm(mm) do { } while (0)
23#define flush_cache_range(vma, start, end) do { } while (0)
24#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
25#define flush_dcache_page(page) do { } while (0)
26#define flush_dcache_mmap_lock(mapping) do { } while (0)
27#define flush_dcache_mmap_unlock(mapping) do { } while (0)
28void flush_icache_range(unsigned long start, unsigned long end);
29#define flush_icache_page(vma,pg) do { } while (0)
30#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
31#define flush_cache_sigtramp(vaddr) do { } while (0)
32
33#define p3_cache_init() do { } while (0)
34#endif /* __ASM_CPU_SH2A_CACHEFLUSH_H */
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c
index dcdf959a3d44..8a8a993f55ea 100644
--- a/arch/sh/kernel/cpu/sh4/sq.c
+++ b/arch/sh/kernel/cpu/sh4/sq.c
@@ -199,7 +199,7 @@ EXPORT_SYMBOL(sq_remap);
199 199
200/** 200/**
201 * sq_unmap - Unmap a Store Queue allocation 201 * sq_unmap - Unmap a Store Queue allocation
202 * @map: Pre-allocated Store Queue mapping. 202 * @vaddr: Pre-allocated Store Queue mapping.
203 * 203 *
204 * Unmaps the store queue allocation @map that was previously created by 204 * Unmaps the store queue allocation @map that was previously created by
205 * sq_remap(). Also frees up the pte that was previously inserted into 205 * sq_remap(). Also frees up the pte that was previously inserted into
diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S
index ca08e7f26a3a..04c7da968146 100644
--- a/arch/sh/kernel/cpu/sh5/entry.S
+++ b/arch/sh/kernel/cpu/sh5/entry.S
@@ -987,11 +987,11 @@ work_resched:
987work_notifysig: 987work_notifysig:
988 gettr tr1, LINK 988 gettr tr1, LINK
989 989
990 movi do_signal, r6 990 movi do_notify_resume, r6
991 ptabs r6, tr0 991 ptabs r6, tr0
992 or SP, ZERO, r2 992 or SP, ZERO, r2
993 or ZERO, ZERO, r3 993 or r7, ZERO, r3
994 blink tr0, LINK /* Call do_signal(regs, 0), return here */ 994 blink tr0, LINK /* Call do_notify_resume(regs, current_thread_info->flags), return here */
995 995
996restore_all: 996restore_all:
997 /* Do prefetches */ 997 /* Do prefetches */
@@ -1300,18 +1300,20 @@ syscall_allowed:
1300 1300
1301 getcon KCR0, r2 1301 getcon KCR0, r2
1302 ld.l r2, TI_FLAGS, r4 1302 ld.l r2, TI_FLAGS, r4
1303 movi (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | _TIF_SYSCALL_AUDIT), r6 1303 movi _TIF_WORK_SYSCALL_MASK, r6
1304 and r6, r4, r6 1304 and r6, r4, r6
1305 beq/l r6, ZERO, tr0 1305 beq/l r6, ZERO, tr0
1306 1306
1307 /* Trace it by calling syscall_trace before and after */ 1307 /* Trace it by calling syscall_trace before and after */
1308 movi syscall_trace, r4 1308 movi do_syscall_trace_enter, r4
1309 or SP, ZERO, r2 1309 or SP, ZERO, r2
1310 or ZERO, ZERO, r3
1311 ptabs r4, tr0 1310 ptabs r4, tr0
1312 blink tr0, LINK 1311 blink tr0, LINK
1313 1312
1314 /* Reload syscall number as r5 is trashed by syscall_trace */ 1313 /* Save the retval */
1314 st.q SP, FRAME_R(2), r2
1315
1316 /* Reload syscall number as r5 is trashed by do_syscall_trace_enter */
1315 ld.q SP, FRAME_S(FSYSCALL_ID), r5 1317 ld.q SP, FRAME_S(FSYSCALL_ID), r5
1316 andi r5, 0x1ff, r5 1318 andi r5, 0x1ff, r5
1317 1319
@@ -1343,9 +1345,8 @@ syscall_ret_trace:
1343 /* We get back here only if under trace */ 1345 /* We get back here only if under trace */
1344 st.q SP, FRAME_R(9), r2 /* Save return value */ 1346 st.q SP, FRAME_R(9), r2 /* Save return value */
1345 1347
1346 movi syscall_trace, LINK 1348 movi do_syscall_trace_leave, LINK
1347 or SP, ZERO, r2 1349 or SP, ZERO, r2
1348 movi 1, r3
1349 ptabs LINK, tr0 1350 ptabs LINK, tr0
1350 blink tr0, LINK 1351 blink tr0, LINK
1351 1352
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index 5e0dd1933847..0bc17def55a7 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -202,7 +202,7 @@ work_resched:
202syscall_exit_work: 202syscall_exit_work:
203 ! r0: current_thread_info->flags 203 ! r0: current_thread_info->flags
204 ! r8: current_thread_info 204 ! r8: current_thread_info
205 tst #_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | _TIF_SYSCALL_AUDIT, r0 205 tst #_TIF_WORK_SYSCALL_MASK, r0
206 bt/s work_pending 206 bt/s work_pending
207 tst #_TIF_NEED_RESCHED, r0 207 tst #_TIF_NEED_RESCHED, r0
208#ifdef CONFIG_TRACE_IRQFLAGS 208#ifdef CONFIG_TRACE_IRQFLAGS
@@ -211,10 +211,8 @@ syscall_exit_work:
211 nop 211 nop
212#endif 212#endif
213 sti 213 sti
214 ! XXX setup arguments...
215 mov r15, r4 214 mov r15, r4
216 mov #1, r5 215 mov.l 8f, r0 ! do_syscall_trace_leave
217 mov.l 4f, r0 ! do_syscall_trace
218 jsr @r0 216 jsr @r0
219 nop 217 nop
220 bra resume_userspace 218 bra resume_userspace
@@ -223,12 +221,11 @@ syscall_exit_work:
223 .align 2 221 .align 2
224syscall_trace_entry: 222syscall_trace_entry:
225 ! Yes it is traced. 223 ! Yes it is traced.
226 ! XXX setup arguments...
227 mov r15, r4 224 mov r15, r4
228 mov #0, r5 225 mov.l 7f, r11 ! Call do_syscall_trace_enter which notifies
229 mov.l 4f, r11 ! Call do_syscall_trace which notifies
230 jsr @r11 ! superior (will chomp R[0-7]) 226 jsr @r11 ! superior (will chomp R[0-7])
231 nop 227 nop
228 mov.l r0, @(OFF_R0,r15) ! Save return value
232 ! Reload R0-R4 from kernel stack, where the 229 ! Reload R0-R4 from kernel stack, where the
233 ! parent may have modified them using 230 ! parent may have modified them using
234 ! ptrace(POKEUSR). (Note that R0-R2 are 231 ! ptrace(POKEUSR). (Note that R0-R2 are
@@ -351,7 +348,7 @@ ENTRY(system_call)
351 ! 348 !
352 get_current_thread_info r8, r10 349 get_current_thread_info r8, r10
353 mov.l @(TI_FLAGS,r8), r8 350 mov.l @(TI_FLAGS,r8), r8
354 mov #(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT), r10 351 mov #_TIF_WORK_SYSCALL_MASK, r10
355 tst r10, r8 352 tst r10, r8
356 bf syscall_trace_entry 353 bf syscall_trace_entry
357 ! 354 !
@@ -389,8 +386,9 @@ syscall_exit:
389#endif 386#endif
3902: .long NR_syscalls 3872: .long NR_syscalls
3913: .long sys_call_table 3883: .long sys_call_table
3924: .long do_syscall_trace
393#ifdef CONFIG_TRACE_IRQFLAGS 389#ifdef CONFIG_TRACE_IRQFLAGS
3945: .long trace_hardirqs_on 3905: .long trace_hardirqs_on
3956: .long trace_hardirqs_off 3916: .long trace_hardirqs_off
396#endif 392#endif
3937: .long do_syscall_trace_enter
3948: .long do_syscall_trace_leave
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c
index ec1eadce4aaa..4703dff174d5 100644
--- a/arch/sh/kernel/machine_kexec.c
+++ b/arch/sh/kernel/machine_kexec.c
@@ -13,6 +13,7 @@
13#include <linux/kexec.h> 13#include <linux/kexec.h>
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/reboot.h> 15#include <linux/reboot.h>
16#include <linux/numa.h>
16#include <asm/pgtable.h> 17#include <asm/pgtable.h>
17#include <asm/pgalloc.h> 18#include <asm/pgalloc.h>
18#include <asm/mmu_context.h> 19#include <asm/mmu_context.h>
@@ -104,3 +105,10 @@ void machine_kexec(struct kimage *image)
104 (*rnk)(page_list, reboot_code_buffer, image->start, vbr_reg); 105 (*rnk)(page_list, reboot_code_buffer, image->start, vbr_reg);
105} 106}
106 107
108void arch_crash_save_vmcoreinfo(void)
109{
110#ifdef CONFIG_NUMA
111 VMCOREINFO_SYMBOL(node_data);
112 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
113#endif
114}
diff --git a/arch/sh/kernel/module.c b/arch/sh/kernel/module.c
index 5482e65375a9..c43081039dd5 100644
--- a/arch/sh/kernel/module.c
+++ b/arch/sh/kernel/module.c
@@ -27,6 +27,7 @@
27#include <linux/moduleloader.h> 27#include <linux/moduleloader.h>
28#include <linux/elf.h> 28#include <linux/elf.h>
29#include <linux/vmalloc.h> 29#include <linux/vmalloc.h>
30#include <linux/bug.h>
30#include <linux/fs.h> 31#include <linux/fs.h>
31#include <linux/string.h> 32#include <linux/string.h>
32#include <linux/kernel.h> 33#include <linux/kernel.h>
@@ -36,7 +37,8 @@ void *module_alloc(unsigned long size)
36{ 37{
37 if (size == 0) 38 if (size == 0)
38 return NULL; 39 return NULL;
39 return vmalloc(size); 40
41 return vmalloc_exec(size);
40} 42}
41 43
42 44
@@ -145,9 +147,10 @@ int module_finalize(const Elf_Ehdr *hdr,
145 const Elf_Shdr *sechdrs, 147 const Elf_Shdr *sechdrs,
146 struct module *me) 148 struct module *me)
147{ 149{
148 return 0; 150 return module_bug_finalize(hdr, sechdrs, me);
149} 151}
150 152
151void module_arch_cleanup(struct module *mod) 153void module_arch_cleanup(struct module *mod)
152{ 154{
155 module_bug_cleanup(mod);
153} 156}
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 2bc72def5cf8..035cb300d3dc 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -20,6 +20,8 @@
20#include <linux/signal.h> 20#include <linux/signal.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/audit.h> 22#include <linux/audit.h>
23#include <linux/seccomp.h>
24#include <linux/tracehook.h>
23#include <asm/uaccess.h> 25#include <asm/uaccess.h>
24#include <asm/pgtable.h> 26#include <asm/pgtable.h>
25#include <asm/system.h> 27#include <asm/system.h>
@@ -57,7 +59,23 @@ static inline int put_stack_long(struct task_struct *task, int offset,
57 return 0; 59 return 0;
58} 60}
59 61
60static void ptrace_disable_singlestep(struct task_struct *child) 62void user_enable_single_step(struct task_struct *child)
63{
64 struct pt_regs *regs = task_pt_regs(child);
65 long pc;
66
67 pc = get_stack_long(child, (long)&regs->pc);
68
69 /* Next scheduling will set up UBC */
70 if (child->thread.ubc_pc == 0)
71 ubc_usercnt += 1;
72
73 child->thread.ubc_pc = pc;
74
75 set_tsk_thread_flag(child, TIF_SINGLESTEP);
76}
77
78void user_disable_single_step(struct task_struct *child)
61{ 79{
62 clear_tsk_thread_flag(child, TIF_SINGLESTEP); 80 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
63 81
@@ -81,7 +99,7 @@ static void ptrace_disable_singlestep(struct task_struct *child)
81 */ 99 */
82void ptrace_disable(struct task_struct *child) 100void ptrace_disable(struct task_struct *child)
83{ 101{
84 ptrace_disable_singlestep(child); 102 user_disable_single_step(child);
85} 103}
86 104
87long arch_ptrace(struct task_struct *child, long request, long addr, long data) 105long arch_ptrace(struct task_struct *child, long request, long addr, long data)
@@ -90,12 +108,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
90 int ret; 108 int ret;
91 109
92 switch (request) { 110 switch (request) {
93 /* when I and D space are separate, these will need to be fixed. */
94 case PTRACE_PEEKTEXT: /* read word at location addr. */
95 case PTRACE_PEEKDATA:
96 ret = generic_ptrace_peekdata(child, addr, data);
97 break;
98
99 /* read the word at location addr in the USER area. */ 111 /* read the word at location addr in the USER area. */
100 case PTRACE_PEEKUSR: { 112 case PTRACE_PEEKUSR: {
101 unsigned long tmp; 113 unsigned long tmp;
@@ -125,12 +137,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
125 break; 137 break;
126 } 138 }
127 139
128 /* when I and D space are separate, this will have to be fixed. */
129 case PTRACE_POKETEXT: /* write the word at location addr. */
130 case PTRACE_POKEDATA:
131 ret = generic_ptrace_pokedata(child, addr, data);
132 break;
133
134 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 140 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
135 ret = -EIO; 141 ret = -EIO;
136 if ((addr & 3) || addr < 0 || 142 if ((addr & 3) || addr < 0 ||
@@ -151,67 +157,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
151 } 157 }
152 break; 158 break;
153 159
154 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
155 case PTRACE_CONT: { /* restart after signal. */
156 ret = -EIO;
157 if (!valid_signal(data))
158 break;
159 if (request == PTRACE_SYSCALL)
160 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
161 else
162 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
163
164 ptrace_disable_singlestep(child);
165
166 child->exit_code = data;
167 wake_up_process(child);
168 ret = 0;
169 break;
170 }
171
172/*
173 * make the child exit. Best I can do is send it a sigkill.
174 * perhaps it should be put in the status that it wants to
175 * exit.
176 */
177 case PTRACE_KILL: {
178 ret = 0;
179 if (child->exit_state == EXIT_ZOMBIE) /* already dead */
180 break;
181 ptrace_disable_singlestep(child);
182 child->exit_code = SIGKILL;
183 wake_up_process(child);
184 break;
185 }
186
187 case PTRACE_SINGLESTEP: { /* set the trap flag. */
188 long pc;
189 struct pt_regs *regs = NULL;
190
191 ret = -EIO;
192 if (!valid_signal(data))
193 break;
194 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
195 if ((child->ptrace & PT_DTRACE) == 0) {
196 /* Spurious delayed TF traps may occur */
197 child->ptrace |= PT_DTRACE;
198 }
199
200 pc = get_stack_long(child, (long)&regs->pc);
201
202 /* Next scheduling will set up UBC */
203 if (child->thread.ubc_pc == 0)
204 ubc_usercnt += 1;
205 child->thread.ubc_pc = pc;
206
207 set_tsk_thread_flag(child, TIF_SINGLESTEP);
208 child->exit_code = data;
209 /* give it a chance to run. */
210 wake_up_process(child);
211 ret = 0;
212 break;
213 }
214
215#ifdef CONFIG_SH_DSP 160#ifdef CONFIG_SH_DSP
216 case PTRACE_GETDSPREGS: { 161 case PTRACE_GETDSPREGS: {
217 unsigned long dp; 162 unsigned long dp;
@@ -272,39 +217,49 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
272 return ret; 217 return ret;
273} 218}
274 219
275asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) 220static inline int audit_arch(void)
276{ 221{
277 struct task_struct *tsk = current; 222 int arch = EM_SH;
278 223
279 if (unlikely(current->audit_context) && entryexit) 224#ifdef CONFIG_CPU_LITTLE_ENDIAN
280 audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]), 225 arch |= __AUDIT_ARCH_LE;
281 regs->regs[0]); 226#endif
282 227
283 if (!test_thread_flag(TIF_SYSCALL_TRACE) && 228 return arch;
284 !test_thread_flag(TIF_SINGLESTEP)) 229}
285 goto out;
286 if (!(tsk->ptrace & PT_PTRACED))
287 goto out;
288 230
289 /* the 0x80 provides a way for the tracing parent to distinguish 231asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
290 between a syscall stop and SIGTRAP delivery */ 232{
291 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) && 233 long ret = 0;
292 !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
293 234
294 /* 235 secure_computing(regs->regs[0]);
295 * this isn't the same as continuing with a signal, but it will do 236
296 * for normal use. strace only continues with a signal if the 237 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
297 * stopping signal is not SIGTRAP. -brl 238 tracehook_report_syscall_entry(regs))
298 */ 239 /*
299 if (tsk->exit_code) { 240 * Tracing decided this syscall should not happen.
300 send_sig(tsk->exit_code, tsk, 1); 241 * We'll return a bogus call number to get an ENOSYS
301 tsk->exit_code = 0; 242 * error, but leave the original number in regs->regs[0].
302 } 243 */
244 ret = -1L;
303 245
304out: 246 if (unlikely(current->audit_context))
305 if (unlikely(current->audit_context) && !entryexit) 247 audit_syscall_entry(audit_arch(), regs->regs[3],
306 audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[3],
307 regs->regs[4], regs->regs[5], 248 regs->regs[4], regs->regs[5],
308 regs->regs[6], regs->regs[7]); 249 regs->regs[6], regs->regs[7]);
309 250
251 return ret ?: regs->regs[0];
252}
253
254asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
255{
256 int step;
257
258 if (unlikely(current->audit_context))
259 audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]),
260 regs->regs[0]);
261
262 step = test_thread_flag(TIF_SINGLESTEP);
263 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
264 tracehook_report_syscall_exit(regs, step);
310} 265}
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index d453c47dc522..5922edd416db 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -27,6 +27,8 @@
27#include <linux/signal.h> 27#include <linux/signal.h>
28#include <linux/syscalls.h> 28#include <linux/syscalls.h>
29#include <linux/audit.h> 29#include <linux/audit.h>
30#include <linux/seccomp.h>
31#include <linux/tracehook.h>
30#include <asm/io.h> 32#include <asm/io.h>
31#include <asm/uaccess.h> 33#include <asm/uaccess.h>
32#include <asm/pgtable.h> 34#include <asm/pgtable.h>
@@ -120,18 +122,23 @@ put_fpu_long(struct task_struct *task, unsigned long addr, unsigned long data)
120 return 0; 122 return 0;
121} 123}
122 124
125void user_enable_single_step(struct task_struct *child)
126{
127 struct pt_regs *regs = child->thread.uregs;
128
129 regs->sr |= SR_SSTEP; /* auto-resetting upon exception */
130}
131
132void user_disable_single_step(struct task_struct *child)
133{
134 regs->sr &= ~SR_SSTEP;
135}
123 136
124long arch_ptrace(struct task_struct *child, long request, long addr, long data) 137long arch_ptrace(struct task_struct *child, long request, long addr, long data)
125{ 138{
126 int ret; 139 int ret;
127 140
128 switch (request) { 141 switch (request) {
129 /* when I and D space are separate, these will need to be fixed. */
130 case PTRACE_PEEKTEXT: /* read word at location addr. */
131 case PTRACE_PEEKDATA:
132 ret = generic_ptrace_peekdata(child, addr, data);
133 break;
134
135 /* read the word at location addr in the USER area. */ 142 /* read the word at location addr in the USER area. */
136 case PTRACE_PEEKUSR: { 143 case PTRACE_PEEKUSR: {
137 unsigned long tmp; 144 unsigned long tmp;
@@ -154,12 +161,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
154 break; 161 break;
155 } 162 }
156 163
157 /* when I and D space are separate, this will have to be fixed. */
158 case PTRACE_POKETEXT: /* write the word at location addr. */
159 case PTRACE_POKEDATA:
160 ret = generic_ptrace_pokedata(child, addr, data);
161 break;
162
163 case PTRACE_POKEUSR: 164 case PTRACE_POKEUSR:
164 /* write the word at location addr in the USER area. We must 165 /* write the word at location addr in the USER area. We must
165 disallow any changes to certain SR bits or u_fpvalid, since 166 disallow any changes to certain SR bits or u_fpvalid, since
@@ -191,58 +192,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
191 } 192 }
192 break; 193 break;
193 194
194 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
195 case PTRACE_CONT: { /* restart after signal. */
196 ret = -EIO;
197 if (!valid_signal(data))
198 break;
199 if (request == PTRACE_SYSCALL)
200 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
201 else
202 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
203 child->exit_code = data;
204 wake_up_process(child);
205 ret = 0;
206 break;
207 }
208
209/*
210 * make the child exit. Best I can do is send it a sigkill.
211 * perhaps it should be put in the status that it wants to
212 * exit.
213 */
214 case PTRACE_KILL: {
215 ret = 0;
216 if (child->exit_state == EXIT_ZOMBIE) /* already dead */
217 break;
218 child->exit_code = SIGKILL;
219 wake_up_process(child);
220 break;
221 }
222
223 case PTRACE_SINGLESTEP: { /* set the trap flag. */
224 struct pt_regs *regs;
225
226 ret = -EIO;
227 if (!valid_signal(data))
228 break;
229 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
230 if ((child->ptrace & PT_DTRACE) == 0) {
231 /* Spurious delayed TF traps may occur */
232 child->ptrace |= PT_DTRACE;
233 }
234
235 regs = child->thread.uregs;
236
237 regs->sr |= SR_SSTEP; /* auto-resetting upon exception */
238
239 child->exit_code = data;
240 /* give it a chance to run. */
241 wake_up_process(child);
242 ret = 0;
243 break;
244 }
245
246 default: 195 default:
247 ret = ptrace_request(child, request, addr, data); 196 ret = ptrace_request(child, request, addr, data);
248 break; 197 break;
@@ -273,38 +222,51 @@ asmlinkage int sh64_ptrace(long request, long pid, long addr, long data)
273 return sys_ptrace(request, pid, addr, data); 222 return sys_ptrace(request, pid, addr, data);
274} 223}
275 224
276asmlinkage void syscall_trace(struct pt_regs *regs, int entryexit) 225static inline int audit_arch(void)
277{ 226{
278 struct task_struct *tsk = current; 227 int arch = EM_SH;
279 228
280 if (unlikely(current->audit_context) && entryexit) 229#ifdef CONFIG_64BIT
281 audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]), 230 arch |= __AUDIT_ARCH_64BIT;
282 regs->regs[9]); 231#endif
232#ifdef CONFIG_CPU_LITTLE_ENDIAN
233 arch |= __AUDIT_ARCH_LE;
234#endif
283 235
284 if (!test_thread_flag(TIF_SYSCALL_TRACE) && 236 return arch;
285 !test_thread_flag(TIF_SINGLESTEP)) 237}
286 goto out;
287 if (!(tsk->ptrace & PT_PTRACED))
288 goto out;
289
290 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) &&
291 !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
292
293 /*
294 * this isn't the same as continuing with a signal, but it will do
295 * for normal use. strace only continues with a signal if the
296 * stopping signal is not SIGTRAP. -brl
297 */
298 if (tsk->exit_code) {
299 send_sig(tsk->exit_code, tsk, 1);
300 tsk->exit_code = 0;
301 }
302 238
303out: 239asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
304 if (unlikely(current->audit_context) && !entryexit) 240{
305 audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[1], 241 long long ret = 0;
242
243 secure_computing(regs->regs[9]);
244
245 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
246 tracehook_report_syscall_entry(regs))
247 /*
248 * Tracing decided this syscall should not happen.
249 * We'll return a bogus call number to get an ENOSYS
250 * error, but leave the original number in regs->regs[0].
251 */
252 ret = -1LL;
253
254 if (unlikely(current->audit_context))
255 audit_syscall_entry(audit_arch(), regs->regs[1],
306 regs->regs[2], regs->regs[3], 256 regs->regs[2], regs->regs[3],
307 regs->regs[4], regs->regs[5]); 257 regs->regs[4], regs->regs[5]);
258
259 return ret ?: regs->regs[9];
260}
261
262asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
263{
264 if (unlikely(current->audit_context))
265 audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]),
266 regs->regs[9]);
267
268 if (test_thread_flag(TIF_SYSCALL_TRACE))
269 tracehook_report_syscall_exit(regs, 0);
308} 270}
309 271
310/* Called with interrupts disabled */ 272/* Called with interrupts disabled */
@@ -338,5 +300,5 @@ asmlinkage void do_software_break_point(unsigned long long vec,
338 */ 300 */
339void ptrace_disable(struct task_struct *child) 301void ptrace_disable(struct task_struct *child)
340{ 302{
341 /* nothing to do.. */ 303 user_disable_single_step(child);
342} 304}
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 6339d0c95715..a35207655e7b 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -25,6 +25,7 @@
25#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/debugfs.h> 27#include <linux/debugfs.h>
28#include <linux/crash_dump.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/io.h> 30#include <asm/io.h>
30#include <asm/page.h> 31#include <asm/page.h>
@@ -286,6 +287,25 @@ static void __init setup_memory(void)
286extern void __init setup_memory(void); 287extern void __init setup_memory(void);
287#endif 288#endif
288 289
290/*
291 * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
292 * is_kdump_kernel() to determine if we are booting after a panic. Hence
293 * ifdef it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
294 */
295#ifdef CONFIG_CRASH_DUMP
296/* elfcorehdr= specifies the location of elf core header
297 * stored by the crashed kernel.
298 */
299static int __init parse_elfcorehdr(char *arg)
300{
301 if (!arg)
302 return -EINVAL;
303 elfcorehdr_addr = memparse(arg, &arg);
304 return 0;
305}
306early_param("elfcorehdr", parse_elfcorehdr);
307#endif
308
289void __init setup_arch(char **cmdline_p) 309void __init setup_arch(char **cmdline_p)
290{ 310{
291 enable_mmu(); 311 enable_mmu();
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 4bbbde895a53..51689d29ad45 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -24,6 +24,7 @@
24#include <linux/binfmts.h> 24#include <linux/binfmts.h>
25#include <linux/freezer.h> 25#include <linux/freezer.h>
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/tracehook.h>
27#include <asm/system.h> 28#include <asm/system.h>
28#include <asm/ucontext.h> 29#include <asm/ucontext.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
@@ -507,14 +508,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
507 switch (regs->regs[0]) { 508 switch (regs->regs[0]) {
508 case -ERESTART_RESTARTBLOCK: 509 case -ERESTART_RESTARTBLOCK:
509 case -ERESTARTNOHAND: 510 case -ERESTARTNOHAND:
511 no_system_call_restart:
510 regs->regs[0] = -EINTR; 512 regs->regs[0] = -EINTR;
511 break; 513 break;
512 514
513 case -ERESTARTSYS: 515 case -ERESTARTSYS:
514 if (!(ka->sa.sa_flags & SA_RESTART)) { 516 if (!(ka->sa.sa_flags & SA_RESTART))
515 regs->regs[0] = -EINTR; 517 goto no_system_call_restart;
516 break;
517 }
518 /* fallthrough */ 518 /* fallthrough */
519 case -ERESTARTNOINTR: 519 case -ERESTARTNOINTR:
520 regs->regs[0] = save_r0; 520 regs->regs[0] = save_r0;
@@ -589,12 +589,15 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
589 * clear the TIF_RESTORE_SIGMASK flag */ 589 * clear the TIF_RESTORE_SIGMASK flag */
590 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 590 if (test_thread_flag(TIF_RESTORE_SIGMASK))
591 clear_thread_flag(TIF_RESTORE_SIGMASK); 591 clear_thread_flag(TIF_RESTORE_SIGMASK);
592
593 tracehook_signal_handler(signr, &info, &ka, regs,
594 test_thread_flag(TIF_SINGLESTEP));
592 } 595 }
593 596
594 return; 597 return;
595 } 598 }
596 599
597 no_signal: 600no_signal:
598 /* Did we come from a system call? */ 601 /* Did we come from a system call? */
599 if (regs->tra >= 0) { 602 if (regs->tra >= 0) {
600 /* Restart the system call - no handlers present */ 603 /* Restart the system call - no handlers present */
@@ -618,9 +621,14 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
618} 621}
619 622
620asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0, 623asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
621 __u32 thread_info_flags) 624 unsigned long thread_info_flags)
622{ 625{
623 /* deal with pending signal delivery */ 626 /* deal with pending signal delivery */
624 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) 627 if (thread_info_flags & _TIF_SIGPENDING)
625 do_signal(regs, save_r0); 628 do_signal(regs, save_r0);
629
630 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
631 clear_thread_flag(TIF_NOTIFY_RESUME);
632 tracehook_notify_resume(regs);
633 }
626} 634}
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c
index 552eb810cd85..1d62dfef77f1 100644
--- a/arch/sh/kernel/signal_64.c
+++ b/arch/sh/kernel/signal_64.c
@@ -22,6 +22,7 @@
22#include <linux/ptrace.h> 22#include <linux/ptrace.h>
23#include <linux/unistd.h> 23#include <linux/unistd.h>
24#include <linux/stddef.h> 24#include <linux/stddef.h>
25#include <linux/tracehook.h>
25#include <asm/ucontext.h> 26#include <asm/ucontext.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
27#include <asm/pgtable.h> 28#include <asm/pgtable.h>
@@ -42,7 +43,84 @@
42 43
43#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 44#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
44 45
45asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset); 46/*
47 * Note that 'init' is a special process: it doesn't get signals it doesn't
48 * want to handle. Thus you cannot kill init even with a SIGKILL even by
49 * mistake.
50 *
51 * Note that we go through the signals twice: once to check the signals that
52 * the kernel can handle, and then we build all the user-level signal handling
53 * stack-frames in one go after that.
54 */
55static int do_signal(struct pt_regs *regs, sigset_t *oldset)
56{
57 siginfo_t info;
58 int signr;
59 struct k_sigaction ka;
60
61 /*
62 * We want the common case to go fast, which
63 * is why we may in certain cases get here from
64 * kernel mode. Just return without doing anything
65 * if so.
66 */
67 if (!user_mode(regs))
68 return 1;
69
70 if (try_to_freeze())
71 goto no_signal;
72
73 if (test_thread_flag(TIF_RESTORE_SIGMASK))
74 oldset = &current->saved_sigmask;
75 else if (!oldset)
76 oldset = &current->blocked;
77
78 signr = get_signal_to_deliver(&info, &ka, regs, 0);
79
80 if (signr > 0) {
81 /* Whee! Actually deliver the signal. */
82 handle_signal(signr, &info, &ka, oldset, regs);
83
84 /*
85 * If a signal was successfully delivered, the saved sigmask
86 * is in its frame, and we can clear the TIF_RESTORE_SIGMASK
87 * flag.
88 */
89 if (test_thread_flag(TIF_RESTORE_SIGMASK))
90 clear_thread_flag(TIF_RESTORE_SIGMASK);
91
92 tracehook_signal_handler(signr, &info, &ka, regs, 0);
93 return 1;
94 }
95
96no_signal:
97 /* Did we come from a system call? */
98 if (regs->syscall_nr >= 0) {
99 /* Restart the system call - no handlers present */
100 switch (regs->regs[REG_RET]) {
101 case -ERESTARTNOHAND:
102 case -ERESTARTSYS:
103 case -ERESTARTNOINTR:
104 /* Decode Syscall # */
105 regs->regs[REG_RET] = regs->syscall_nr;
106 regs->pc -= 4;
107 break;
108
109 case -ERESTART_RESTARTBLOCK:
110 regs->regs[REG_RET] = __NR_restart_syscall;
111 regs->pc -= 4;
112 break;
113 }
114 }
115
116 /* No signal to deliver -- put the saved sigmask back */
117 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
118 clear_thread_flag(TIF_RESTORE_SIGMASK);
119 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
120 }
121
122 return 0;
123}
46 124
47/* 125/*
48 * Atomically swap in the new signal mask, and wait for a signal. 126 * Atomically swap in the new signal mask, and wait for a signal.
@@ -643,14 +721,13 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
643 switch (regs->regs[REG_RET]) { 721 switch (regs->regs[REG_RET]) {
644 case -ERESTART_RESTARTBLOCK: 722 case -ERESTART_RESTARTBLOCK:
645 case -ERESTARTNOHAND: 723 case -ERESTARTNOHAND:
724 no_system_call_restart:
646 regs->regs[REG_RET] = -EINTR; 725 regs->regs[REG_RET] = -EINTR;
647 break; 726 break;
648 727
649 case -ERESTARTSYS: 728 case -ERESTARTSYS:
650 if (!(ka->sa.sa_flags & SA_RESTART)) { 729 if (!(ka->sa.sa_flags & SA_RESTART))
651 regs->regs[REG_RET] = -EINTR; 730 goto no_system_call_restart;
652 break;
653 }
654 /* fallthrough */ 731 /* fallthrough */
655 case -ERESTARTNOINTR: 732 case -ERESTARTNOINTR:
656 /* Decode syscall # */ 733 /* Decode syscall # */
@@ -673,80 +750,13 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
673 spin_unlock_irq(&current->sighand->siglock); 750 spin_unlock_irq(&current->sighand->siglock);
674} 751}
675 752
676/* 753asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
677 * Note that 'init' is a special process: it doesn't get signals it doesn't
678 * want to handle. Thus you cannot kill init even with a SIGKILL even by
679 * mistake.
680 *
681 * Note that we go through the signals twice: once to check the signals that
682 * the kernel can handle, and then we build all the user-level signal handling
683 * stack-frames in one go after that.
684 */
685int do_signal(struct pt_regs *regs, sigset_t *oldset)
686{ 754{
687 siginfo_t info; 755 if (thread_info_flags & _TIF_SIGPENDING)
688 int signr; 756 do_signal(regs, 0);
689 struct k_sigaction ka;
690
691 /*
692 * We want the common case to go fast, which
693 * is why we may in certain cases get here from
694 * kernel mode. Just return without doing anything
695 * if so.
696 */
697 if (!user_mode(regs))
698 return 1;
699
700 if (try_to_freeze())
701 goto no_signal;
702
703 if (test_thread_flag(TIF_RESTORE_SIGMASK))
704 oldset = &current->saved_sigmask;
705 else if (!oldset)
706 oldset = &current->blocked;
707
708 signr = get_signal_to_deliver(&info, &ka, regs, 0);
709
710 if (signr > 0) {
711 /* Whee! Actually deliver the signal. */
712 handle_signal(signr, &info, &ka, oldset, regs);
713 757
714 /* 758 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
715 * If a signal was successfully delivered, the saved sigmask 759 clear_thread_flag(TIF_NOTIFY_RESUME);
716 * is in its frame, and we can clear the TIF_RESTORE_SIGMASK 760 tracehook_notify_resume(regs);
717 * flag.
718 */
719 if (test_thread_flag(TIF_RESTORE_SIGMASK))
720 clear_thread_flag(TIF_RESTORE_SIGMASK);
721
722 return 1;
723 } 761 }
724
725no_signal:
726 /* Did we come from a system call? */
727 if (regs->syscall_nr >= 0) {
728 /* Restart the system call - no handlers present */
729 switch (regs->regs[REG_RET]) {
730 case -ERESTARTNOHAND:
731 case -ERESTARTSYS:
732 case -ERESTARTNOINTR:
733 /* Decode Syscall # */
734 regs->regs[REG_RET] = regs->syscall_nr;
735 regs->pc -= 4;
736 break;
737
738 case -ERESTART_RESTARTBLOCK:
739 regs->regs[REG_RET] = __NR_restart_syscall;
740 regs->pc -= 4;
741 break;
742 }
743 }
744
745 /* No signal to deliver -- put the saved sigmask back */
746 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
747 clear_thread_flag(TIF_RESTORE_SIGMASK);
748 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
749 }
750
751 return 0;
752} 762}
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 56d0a7daa34b..9c131cac91a4 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -237,7 +237,6 @@ choice
237 237
238config CACHE_WRITEBACK 238config CACHE_WRITEBACK
239 bool "Write-back" 239 bool "Write-back"
240 depends on CPU_SH2A || CPU_SH3 || CPU_SH4 || CPU_SH5
241 240
242config CACHE_WRITETHROUGH 241config CACHE_WRITETHROUGH
243 bool "Write-through" 242 bool "Write-through"
diff --git a/arch/sh/mm/Makefile_32 b/arch/sh/mm/Makefile_32
index e295db60b91b..70e0906023cc 100644
--- a/arch/sh/mm/Makefile_32
+++ b/arch/sh/mm/Makefile_32
@@ -5,12 +5,15 @@
5obj-y := init.o extable_32.o consistent.o 5obj-y := init.o extable_32.o consistent.o
6 6
7ifndef CONFIG_CACHE_OFF 7ifndef CONFIG_CACHE_OFF
8obj-$(CONFIG_CPU_SH2) += cache-sh2.o 8cache-$(CONFIG_CPU_SH2) := cache-sh2.o
9obj-$(CONFIG_CPU_SH3) += cache-sh3.o 9cache-$(CONFIG_CPU_SH2A) := cache-sh2a.o
10obj-$(CONFIG_CPU_SH4) += cache-sh4.o 10cache-$(CONFIG_CPU_SH3) := cache-sh3.o
11obj-$(CONFIG_SH7705_CACHE_32KB) += cache-sh7705.o 11cache-$(CONFIG_CPU_SH4) := cache-sh4.o
12cache-$(CONFIG_SH7705_CACHE_32KB) += cache-sh7705.o
12endif 13endif
13 14
15obj-y += $(cache-y)
16
14mmu-y := tlb-nommu.o pg-nommu.o 17mmu-y := tlb-nommu.o pg-nommu.o
15mmu-$(CONFIG_MMU) := fault_32.o tlbflush_32.o ioremap_32.o 18mmu-$(CONFIG_MMU) := fault_32.o tlbflush_32.o ioremap_32.o
16 19
diff --git a/arch/sh/mm/cache-sh2.c b/arch/sh/mm/cache-sh2.c
index 6614033f6be9..c4e80d2b764b 100644
--- a/arch/sh/mm/cache-sh2.c
+++ b/arch/sh/mm/cache-sh2.c
@@ -2,6 +2,7 @@
2 * arch/sh/mm/cache-sh2.c 2 * arch/sh/mm/cache-sh2.c
3 * 3 *
4 * Copyright (C) 2002 Paul Mundt 4 * Copyright (C) 2002 Paul Mundt
5 * Copyright (C) 2008 Yoshinori Sato
5 * 6 *
6 * Released under the terms of the GNU GPL v2.0. 7 * Released under the terms of the GNU GPL v2.0.
7 */ 8 */
@@ -24,8 +25,15 @@ void __flush_wback_region(void *start, int size)
24 end = ((unsigned long)start + size + L1_CACHE_BYTES-1) 25 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
25 & ~(L1_CACHE_BYTES-1); 26 & ~(L1_CACHE_BYTES-1);
26 for (v = begin; v < end; v+=L1_CACHE_BYTES) { 27 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
27 /* FIXME cache purge */ 28 unsigned long addr = CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0);
28 ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008); 29 int way;
30 for (way = 0; way < 4; way++) {
31 unsigned long data = ctrl_inl(addr | (way << 12));
32 if ((data & CACHE_PHYSADDR_MASK) == (v & CACHE_PHYSADDR_MASK)) {
33 data &= ~SH_CACHE_UPDATED;
34 ctrl_outl(data, addr | (way << 12));
35 }
36 }
29 } 37 }
30} 38}
31 39
@@ -37,21 +45,40 @@ void __flush_purge_region(void *start, int size)
37 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1); 45 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
38 end = ((unsigned long)start + size + L1_CACHE_BYTES-1) 46 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
39 & ~(L1_CACHE_BYTES-1); 47 & ~(L1_CACHE_BYTES-1);
40 for (v = begin; v < end; v+=L1_CACHE_BYTES) { 48
41 ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008); 49 for (v = begin; v < end; v+=L1_CACHE_BYTES)
42 } 50 ctrl_outl((v & CACHE_PHYSADDR_MASK),
51 CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008);
43} 52}
44 53
45void __flush_invalidate_region(void *start, int size) 54void __flush_invalidate_region(void *start, int size)
46{ 55{
56#ifdef CONFIG_CACHE_WRITEBACK
57 /*
58 * SH-2 does not support individual line invalidation, only a
59 * global invalidate.
60 */
61 unsigned long ccr;
62 unsigned long flags;
63 local_irq_save(flags);
64 jump_to_uncached();
65
66 ccr = ctrl_inl(CCR);
67 ccr |= CCR_CACHE_INVALIDATE;
68 ctrl_outl(ccr, CCR);
69
70 back_to_cached();
71 local_irq_restore(flags);
72#else
47 unsigned long v; 73 unsigned long v;
48 unsigned long begin, end; 74 unsigned long begin, end;
49 75
50 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1); 76 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
51 end = ((unsigned long)start + size + L1_CACHE_BYTES-1) 77 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
52 & ~(L1_CACHE_BYTES-1); 78 & ~(L1_CACHE_BYTES-1);
53 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
54 ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
55 }
56}
57 79
80 for (v = begin; v < end; v+=L1_CACHE_BYTES)
81 ctrl_outl((v & CACHE_PHYSADDR_MASK),
82 CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008);
83#endif
84}
diff --git a/arch/sh/mm/cache-sh2a.c b/arch/sh/mm/cache-sh2a.c
new file mode 100644
index 000000000000..62c0c5f35120
--- /dev/null
+++ b/arch/sh/mm/cache-sh2a.c
@@ -0,0 +1,129 @@
1/*
2 * arch/sh/mm/cache-sh2a.c
3 *
4 * Copyright (C) 2008 Yoshinori Sato
5 *
6 * Released under the terms of the GNU GPL v2.0.
7 */
8
9#include <linux/init.h>
10#include <linux/mm.h>
11
12#include <asm/cache.h>
13#include <asm/addrspace.h>
14#include <asm/processor.h>
15#include <asm/cacheflush.h>
16#include <asm/io.h>
17
18void __flush_wback_region(void *start, int size)
19{
20 unsigned long v;
21 unsigned long begin, end;
22 unsigned long flags;
23
24 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
25 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
26 & ~(L1_CACHE_BYTES-1);
27
28 local_irq_save(flags);
29 jump_to_uncached();
30
31 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
32 unsigned long addr = CACHE_OC_ADDRESS_ARRAY | (v & 0x000007f0);
33 int way;
34 for (way = 0; way < 4; way++) {
35 unsigned long data = ctrl_inl(addr | (way << 11));
36 if ((data & CACHE_PHYSADDR_MASK) == (v & CACHE_PHYSADDR_MASK)) {
37 data &= ~SH_CACHE_UPDATED;
38 ctrl_outl(data, addr | (way << 11));
39 }
40 }
41 }
42
43 back_to_cached();
44 local_irq_restore(flags);
45}
46
47void __flush_purge_region(void *start, int size)
48{
49 unsigned long v;
50 unsigned long begin, end;
51 unsigned long flags;
52
53 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
54 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
55 & ~(L1_CACHE_BYTES-1);
56
57 local_irq_save(flags);
58 jump_to_uncached();
59
60 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
61 ctrl_outl((v & CACHE_PHYSADDR_MASK),
62 CACHE_OC_ADDRESS_ARRAY | (v & 0x000003f0) | 0x00000008);
63 }
64 back_to_cached();
65 local_irq_restore(flags);
66}
67
68void __flush_invalidate_region(void *start, int size)
69{
70 unsigned long v;
71 unsigned long begin, end;
72 unsigned long flags;
73
74 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
75 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
76 & ~(L1_CACHE_BYTES-1);
77 local_irq_save(flags);
78 jump_to_uncached();
79
80#ifdef CONFIG_CACHE_WRITEBACK
81 ctrl_outl(ctrl_inl(CCR) | CCR_OCACHE_INVALIDATE, CCR);
82 /* I-cache invalidate */
83 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
84 ctrl_outl((v & CACHE_PHYSADDR_MASK),
85 CACHE_IC_ADDRESS_ARRAY | (v & 0x000003f0) | 0x00000008);
86 }
87#else
88 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
89 ctrl_outl((v & CACHE_PHYSADDR_MASK),
90 CACHE_IC_ADDRESS_ARRAY | (v & 0x000003f0) | 0x00000008);
91 ctrl_outl((v & CACHE_PHYSADDR_MASK),
92 CACHE_OC_ADDRESS_ARRAY | (v & 0x000003f0) | 0x00000008);
93 }
94#endif
95 back_to_cached();
96 local_irq_restore(flags);
97}
98
99/* WBack O-Cache and flush I-Cache */
100void flush_icache_range(unsigned long start, unsigned long end)
101{
102 unsigned long v;
103 unsigned long flags;
104
105 start = start & ~(L1_CACHE_BYTES-1);
106 end = (end + L1_CACHE_BYTES-1) & ~(L1_CACHE_BYTES-1);
107
108 local_irq_save(flags);
109 jump_to_uncached();
110
111 for (v = start; v < end; v+=L1_CACHE_BYTES) {
112 unsigned long addr = (v & 0x000007f0);
113 int way;
114 /* O-Cache writeback */
115 for (way = 0; way < 4; way++) {
116 unsigned long data = ctrl_inl(CACHE_OC_ADDRESS_ARRAY | addr | (way << 11));
117 if ((data & CACHE_PHYSADDR_MASK) == (v & CACHE_PHYSADDR_MASK)) {
118 data &= ~SH_CACHE_UPDATED;
119 ctrl_outl(data, CACHE_OC_ADDRESS_ARRAY | addr | (way << 11));
120 }
121 }
122 /* I-Cache invalidate */
123 ctrl_outl(addr,
124 CACHE_IC_ADDRESS_ARRAY | addr | 0x00000008);
125 }
126
127 back_to_cached();
128 local_irq_restore(flags);
129}
diff --git a/arch/sh/mm/tlb-sh5.c b/arch/sh/mm/tlb-sh5.c
index f34274a1ded3..dae131243bcc 100644
--- a/arch/sh/mm/tlb-sh5.c
+++ b/arch/sh/mm/tlb-sh5.c
@@ -15,9 +15,7 @@
15#include <asm/mmu_context.h> 15#include <asm/mmu_context.h>
16 16
17/** 17/**
18 * sh64_tlb_init 18 * sh64_tlb_init - Perform initial setup for the DTLB and ITLB.
19 *
20 * Perform initial setup for the DTLB and ITLB.
21 */ 19 */
22int __init sh64_tlb_init(void) 20int __init sh64_tlb_init(void)
23{ 21{
@@ -46,9 +44,7 @@ int __init sh64_tlb_init(void)
46} 44}
47 45
48/** 46/**
49 * sh64_next_free_dtlb_entry 47 * sh64_next_free_dtlb_entry - Find the next available DTLB entry
50 *
51 * Find the next available DTLB entry
52 */ 48 */
53unsigned long long sh64_next_free_dtlb_entry(void) 49unsigned long long sh64_next_free_dtlb_entry(void)
54{ 50{
@@ -56,9 +52,7 @@ unsigned long long sh64_next_free_dtlb_entry(void)
56} 52}
57 53
58/** 54/**
59 * sh64_get_wired_dtlb_entry 55 * sh64_get_wired_dtlb_entry - Allocate a wired (locked-in) entry in the DTLB
60 *
61 * Allocate a wired (locked-in) entry in the DTLB
62 */ 56 */
63unsigned long long sh64_get_wired_dtlb_entry(void) 57unsigned long long sh64_get_wired_dtlb_entry(void)
64{ 58{
@@ -71,12 +65,10 @@ unsigned long long sh64_get_wired_dtlb_entry(void)
71} 65}
72 66
73/** 67/**
74 * sh64_put_wired_dtlb_entry 68 * sh64_put_wired_dtlb_entry - Free a wired (locked-in) entry in the DTLB.
75 * 69 *
76 * @entry: Address of TLB slot. 70 * @entry: Address of TLB slot.
77 * 71 *
78 * Free a wired (locked-in) entry in the DTLB.
79 *
80 * Works like a stack, last one to allocate must be first one to free. 72 * Works like a stack, last one to allocate must be first one to free.
81 */ 73 */
82int sh64_put_wired_dtlb_entry(unsigned long long entry) 74int sh64_put_wired_dtlb_entry(unsigned long long entry)
@@ -115,7 +107,7 @@ int sh64_put_wired_dtlb_entry(unsigned long long entry)
115} 107}
116 108
117/** 109/**
118 * sh64_setup_tlb_slot 110 * sh64_setup_tlb_slot - Load up a translation in a wired slot.
119 * 111 *
120 * @config_addr: Address of TLB slot. 112 * @config_addr: Address of TLB slot.
121 * @eaddr: Virtual address. 113 * @eaddr: Virtual address.
@@ -154,7 +146,7 @@ inline void sh64_setup_tlb_slot(unsigned long long config_addr,
154} 146}
155 147
156/** 148/**
157 * sh64_teardown_tlb_slot 149 * sh64_teardown_tlb_slot - Teardown a translation.
158 * 150 *
159 * @config_addr: Address of TLB slot. 151 * @config_addr: Address of TLB slot.
160 * 152 *
diff --git a/arch/sh/tools/Makefile b/arch/sh/tools/Makefile
index b5d202be8206..567516b58acc 100644
--- a/arch/sh/tools/Makefile
+++ b/arch/sh/tools/Makefile
@@ -10,7 +10,7 @@
10# Shamelessly cloned from ARM. 10# Shamelessly cloned from ARM.
11# 11#
12 12
13arch/sh/include/asm/machtypes.h: $(src)/gen-mach-types $(src)/mach-types 13include/asm-sh/machtypes.h: $(src)/gen-mach-types $(src)/mach-types
14 @echo ' Generating $@' 14 @echo ' Generating $@'
15 $(Q)if [ ! -d arch/sh/include/asm ]; then mkdir -p arch/sh/include/asm; fi 15 $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
16 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } 16 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
diff --git a/arch/sparc/include/asm/futex_64.h b/arch/sparc/include/asm/futex_64.h
index d8378935ae90..47f95839dc69 100644
--- a/arch/sparc/include/asm/futex_64.h
+++ b/arch/sparc/include/asm/futex_64.h
@@ -59,7 +59,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
59 __futex_cas_op("or\t%2, %4, %1", ret, oldval, uaddr, oparg); 59 __futex_cas_op("or\t%2, %4, %1", ret, oldval, uaddr, oparg);
60 break; 60 break;
61 case FUTEX_OP_ANDN: 61 case FUTEX_OP_ANDN:
62 __futex_cas_op("and\t%2, %4, %1", ret, oldval, uaddr, oparg); 62 __futex_cas_op("andn\t%2, %4, %1", ret, oldval, uaddr, oparg);
63 break; 63 break;
64 case FUTEX_OP_XOR: 64 case FUTEX_OP_XOR:
65 __futex_cas_op("xor\t%2, %4, %1", ret, oldval, uaddr, oparg); 65 __futex_cas_op("xor\t%2, %4, %1", ret, oldval, uaddr, oparg);
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h
index 0bb9bf531745..3473e25231d9 100644
--- a/arch/sparc/include/asm/irq_64.h
+++ b/arch/sparc/include/asm/irq_64.h
@@ -90,4 +90,7 @@ static inline unsigned long get_softint(void)
90 return retval; 90 return retval;
91} 91}
92 92
93void __trigger_all_cpu_backtrace(void);
94#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
95
93#endif 96#endif
diff --git a/arch/sparc/include/asm/of_platform.h b/arch/sparc/include/asm/of_platform.h
index aa699775ffba..93a262c44022 100644
--- a/arch/sparc/include/asm/of_platform.h
+++ b/arch/sparc/include/asm/of_platform.h
@@ -1,8 +1,24 @@
1#ifndef ___ASM_SPARC_OF_PLATFORM_H 1#ifndef ___ASM_SPARC_OF_PLATFORM_H
2#define ___ASM_SPARC_OF_PLATFORM_H 2#define ___ASM_SPARC_OF_PLATFORM_H
3#if defined(__sparc__) && defined(__arch64__) 3/*
4#include <asm/of_platform_64.h> 4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5#else 5 * <benh@kernel.crashing.org>
6#include <asm/of_platform_32.h> 6 * Modified for Sparc by merging parts of asm/of_device.h
7#endif 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/* This is just here during the transition */
17#include <linux/of_platform.h>
18
19extern struct bus_type ebus_bus_type;
20extern struct bus_type sbus_bus_type;
21
22#define of_bus_type of_platform_bus_type /* for compatibility */
23
8#endif 24#endif
diff --git a/arch/sparc/include/asm/of_platform_32.h b/arch/sparc/include/asm/of_platform_32.h
deleted file mode 100644
index 723f7c9b7411..000000000000
--- a/arch/sparc/include/asm/of_platform_32.h
+++ /dev/null
@@ -1,24 +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/* This is just here during the transition */
17#include <linux/of_platform.h>
18
19extern struct bus_type ebus_bus_type;
20extern struct bus_type sbus_bus_type;
21
22#define of_bus_type of_platform_bus_type /* for compatibility */
23
24#endif /* _ASM_SPARC_OF_PLATFORM_H */
diff --git a/arch/sparc/include/asm/of_platform_64.h b/arch/sparc/include/asm/of_platform_64.h
deleted file mode 100644
index 4f66a5f6342d..000000000000
--- a/arch/sparc/include/asm/of_platform_64.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _ASM_SPARC64_OF_PLATFORM_H
2#define _ASM_SPARC64_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/* This is just here during the transition */
17#include <linux/of_platform.h>
18
19extern struct bus_type isa_bus_type;
20extern struct bus_type ebus_bus_type;
21extern struct bus_type sbus_bus_type;
22
23#define of_bus_type of_platform_bus_type /* for compatibility */
24
25#endif /* _ASM_SPARC64_OF_PLATFORM_H */
diff --git a/arch/sparc/include/asm/ptrace_32.h b/arch/sparc/include/asm/ptrace_32.h
index d43c88b86834..d409c4f21a5c 100644
--- a/arch/sparc/include/asm/ptrace_32.h
+++ b/arch/sparc/include/asm/ptrace_32.h
@@ -40,16 +40,6 @@ struct pt_regs {
40#define UREG_FP UREG_I6 40#define UREG_FP UREG_I6
41#define UREG_RETPC UREG_I7 41#define UREG_RETPC UREG_I7
42 42
43static inline bool pt_regs_is_syscall(struct pt_regs *regs)
44{
45 return (regs->psr & PSR_SYSCALL);
46}
47
48static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
49{
50 return (regs->psr &= ~PSR_SYSCALL);
51}
52
53/* A register window */ 43/* A register window */
54struct reg_window { 44struct reg_window {
55 unsigned long locals[8]; 45 unsigned long locals[8];
@@ -72,6 +62,16 @@ struct sparc_stackf {
72 62
73#ifdef __KERNEL__ 63#ifdef __KERNEL__
74 64
65static inline bool pt_regs_is_syscall(struct pt_regs *regs)
66{
67 return (regs->psr & PSR_SYSCALL);
68}
69
70static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
71{
72 return (regs->psr &= ~PSR_SYSCALL);
73}
74
75#define user_mode(regs) (!((regs)->psr & PSR_PS)) 75#define user_mode(regs) (!((regs)->psr & PSR_PS))
76#define instruction_pointer(regs) ((regs)->pc) 76#define instruction_pointer(regs) ((regs)->pc)
77#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP]) 77#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
diff --git a/arch/sparc/include/asm/ptrace_64.h b/arch/sparc/include/asm/ptrace_64.h
index ec6d45c84cd0..06e4914c13f4 100644
--- a/arch/sparc/include/asm/ptrace_64.h
+++ b/arch/sparc/include/asm/ptrace_64.h
@@ -37,21 +37,6 @@ struct pt_regs {
37 unsigned int magic; 37 unsigned int magic;
38}; 38};
39 39
40static inline int pt_regs_trap_type(struct pt_regs *regs)
41{
42 return regs->magic & 0x1ff;
43}
44
45static inline bool pt_regs_is_syscall(struct pt_regs *regs)
46{
47 return (regs->tstate & TSTATE_SYSCALL);
48}
49
50static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
51{
52 return (regs->tstate &= ~TSTATE_SYSCALL);
53}
54
55struct pt_regs32 { 40struct pt_regs32 {
56 unsigned int psr; 41 unsigned int psr;
57 unsigned int pc; 42 unsigned int pc;
@@ -128,15 +113,30 @@ struct sparc_trapf {
128 113
129#ifdef __KERNEL__ 114#ifdef __KERNEL__
130 115
116static inline int pt_regs_trap_type(struct pt_regs *regs)
117{
118 return regs->magic & 0x1ff;
119}
120
121static inline bool pt_regs_is_syscall(struct pt_regs *regs)
122{
123 return (regs->tstate & TSTATE_SYSCALL);
124}
125
126static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
127{
128 return (regs->tstate &= ~TSTATE_SYSCALL);
129}
130
131struct global_reg_snapshot { 131struct global_reg_snapshot {
132 unsigned long tstate; 132 unsigned long tstate;
133 unsigned long tpc; 133 unsigned long tpc;
134 unsigned long tnpc; 134 unsigned long tnpc;
135 unsigned long o7; 135 unsigned long o7;
136 unsigned long i7; 136 unsigned long i7;
137 unsigned long rpc;
137 struct thread_info *thread; 138 struct thread_info *thread;
138 unsigned long pad1; 139 unsigned long pad1;
139 unsigned long pad2;
140}; 140};
141 141
142#define __ARCH_WANT_COMPAT_SYS_PTRACE 142#define __ARCH_WANT_COMPAT_SYS_PTRACE
@@ -154,7 +154,6 @@ extern unsigned long profile_pc(struct pt_regs *);
154#define profile_pc(regs) instruction_pointer(regs) 154#define profile_pc(regs) instruction_pointer(regs)
155#endif 155#endif
156extern void show_regs(struct pt_regs *); 156extern void show_regs(struct pt_regs *);
157extern void __show_regs(struct pt_regs *);
158#endif 157#endif
159 158
160#else /* __ASSEMBLY__ */ 159#else /* __ASSEMBLY__ */
@@ -315,9 +314,9 @@ extern void __show_regs(struct pt_regs *);
315#define GR_SNAP_TNPC 0x10 314#define GR_SNAP_TNPC 0x10
316#define GR_SNAP_O7 0x18 315#define GR_SNAP_O7 0x18
317#define GR_SNAP_I7 0x20 316#define GR_SNAP_I7 0x20
318#define GR_SNAP_THREAD 0x28 317#define GR_SNAP_RPC 0x28
319#define GR_SNAP_PAD1 0x30 318#define GR_SNAP_THREAD 0x30
320#define GR_SNAP_PAD2 0x38 319#define GR_SNAP_PAD1 0x38
321 320
322#endif /* __KERNEL__ */ 321#endif /* __KERNEL__ */
323 322
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index c481673d249c..ba43d85e8dde 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -915,12 +915,18 @@ static void __init sun4v_init_mondo_queues(void)
915 alloc_one_mondo(&tb->nonresum_mondo_pa, tb->nonresum_qmask); 915 alloc_one_mondo(&tb->nonresum_mondo_pa, tb->nonresum_qmask);
916 alloc_one_kbuf(&tb->nonresum_kernel_buf_pa, 916 alloc_one_kbuf(&tb->nonresum_kernel_buf_pa,
917 tb->nonresum_qmask); 917 tb->nonresum_qmask);
918 }
919}
920
921static void __init init_send_mondo_info(void)
922{
923 int cpu;
924
925 for_each_possible_cpu(cpu) {
926 struct trap_per_cpu *tb = &trap_block[cpu];
918 927
919 init_cpu_send_mondo_info(tb); 928 init_cpu_send_mondo_info(tb);
920 } 929 }
921
922 /* Load up the boot cpu's entries. */
923 sun4v_register_mondo_queues(hard_smp_processor_id());
924} 930}
925 931
926static struct irqaction timer_irq_action = { 932static struct irqaction timer_irq_action = {
@@ -949,6 +955,13 @@ void __init init_IRQ(void)
949 if (tlb_type == hypervisor) 955 if (tlb_type == hypervisor)
950 sun4v_init_mondo_queues(); 956 sun4v_init_mondo_queues();
951 957
958 init_send_mondo_info();
959
960 if (tlb_type == hypervisor) {
961 /* Load up the boot cpu's entries. */
962 sun4v_register_mondo_queues(hard_smp_processor_id());
963 }
964
952 /* We need to clear any IRQ's pending in the soft interrupt 965 /* We need to clear any IRQ's pending in the soft interrupt
953 * registers, a spurious one could be left around from the 966 * registers, a spurious one could be left around from the
954 * PROM timer which we just disabled. 967 * PROM timer which we just disabled.
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index 4fd48ab7dda4..f8b50cbf4bf7 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -56,9 +56,6 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
56EXPORT_SYMBOL(of_find_device_by_node); 56EXPORT_SYMBOL(of_find_device_by_node);
57 57
58#ifdef CONFIG_PCI 58#ifdef CONFIG_PCI
59struct bus_type isa_bus_type;
60EXPORT_SYMBOL(isa_bus_type);
61
62struct bus_type ebus_bus_type; 59struct bus_type ebus_bus_type;
63EXPORT_SYMBOL(ebus_bus_type); 60EXPORT_SYMBOL(ebus_bus_type);
64#endif 61#endif
@@ -842,8 +839,6 @@ static int __init of_bus_driver_init(void)
842 err = of_bus_type_init(&of_platform_bus_type, "of"); 839 err = of_bus_type_init(&of_platform_bus_type, "of");
843#ifdef CONFIG_PCI 840#ifdef CONFIG_PCI
844 if (!err) 841 if (!err)
845 err = of_bus_type_init(&isa_bus_type, "isa");
846 if (!err)
847 err = of_bus_type_init(&ebus_bus_type, "ebus"); 842 err = of_bus_type_init(&ebus_bus_type, "ebus");
848#endif 843#endif
849#ifdef CONFIG_SBUS 844#ifdef CONFIG_SBUS
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 8a9cd3e165b9..7f5debdc5fed 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -52,8 +52,6 @@
52#include <asm/irq_regs.h> 52#include <asm/irq_regs.h>
53#include <asm/smp.h> 53#include <asm/smp.h>
54 54
55/* #define VERBOSE_SHOWREGS */
56
57static void sparc64_yield(int cpu) 55static void sparc64_yield(int cpu)
58{ 56{
59 if (tlb_type != hypervisor) 57 if (tlb_type != hypervisor)
@@ -213,22 +211,8 @@ static void show_regwindow(struct pt_regs *regs)
213 printk("I7: <%pS>\n", (void *) rwk->ins[7]); 211 printk("I7: <%pS>\n", (void *) rwk->ins[7]);
214} 212}
215 213
216#ifdef CONFIG_SMP 214void show_regs(struct pt_regs *regs)
217static DEFINE_SPINLOCK(regdump_lock);
218#endif
219
220void __show_regs(struct pt_regs * regs)
221{ 215{
222#ifdef CONFIG_SMP
223 unsigned long flags;
224
225 /* Protect against xcall ipis which might lead to livelock on the lock */
226 __asm__ __volatile__("rdpr %%pstate, %0\n\t"
227 "wrpr %0, %1, %%pstate"
228 : "=r" (flags)
229 : "i" (PSTATE_IE));
230 spin_lock(&regdump_lock);
231#endif
232 printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x %s\n", regs->tstate, 216 printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x %s\n", regs->tstate,
233 regs->tpc, regs->tnpc, regs->y, print_tainted()); 217 regs->tpc, regs->tnpc, regs->y, print_tainted());
234 printk("TPC: <%pS>\n", (void *) regs->tpc); 218 printk("TPC: <%pS>\n", (void *) regs->tpc);
@@ -246,64 +230,24 @@ void __show_regs(struct pt_regs * regs)
246 regs->u_regs[15]); 230 regs->u_regs[15]);
247 printk("RPC: <%pS>\n", (void *) regs->u_regs[15]); 231 printk("RPC: <%pS>\n", (void *) regs->u_regs[15]);
248 show_regwindow(regs); 232 show_regwindow(regs);
249#ifdef CONFIG_SMP
250 spin_unlock(&regdump_lock);
251 __asm__ __volatile__("wrpr %0, 0, %%pstate"
252 : : "r" (flags));
253#endif
254} 233}
255 234
256#ifdef VERBOSE_SHOWREGS 235struct global_reg_snapshot global_reg_snapshot[NR_CPUS];
257static void idump_from_user (unsigned int *pc) 236static DEFINE_SPINLOCK(global_reg_snapshot_lock);
258{
259 int i;
260 int code;
261
262 if((((unsigned long) pc) & 3))
263 return;
264
265 pc -= 3;
266 for(i = -3; i < 6; i++) {
267 get_user(code, pc);
268 printk("%c%08x%c",i?' ':'<',code,i?' ':'>');
269 pc++;
270 }
271 printk("\n");
272}
273#endif
274 237
275void show_regs(struct pt_regs *regs) 238static bool kstack_valid(struct thread_info *tp, struct reg_window *rw)
276{ 239{
277#ifdef VERBOSE_SHOWREGS 240 unsigned long thread_base, fp;
278 extern long etrap, etraptl1;
279#endif
280 __show_regs(regs);
281#if 0
282#ifdef CONFIG_SMP
283 {
284 extern void smp_report_regs(void);
285 241
286 smp_report_regs(); 242 thread_base = (unsigned long) tp;
287 } 243 fp = (unsigned long) rw;
288#endif
289#endif
290 244
291#ifdef VERBOSE_SHOWREGS 245 if (fp < (thread_base + sizeof(struct thread_info)) ||
292 if (regs->tpc >= &etrap && regs->tpc < &etraptl1 && 246 fp >= (thread_base + THREAD_SIZE))
293 regs->u_regs[14] >= (long)current - PAGE_SIZE && 247 return false;
294 regs->u_regs[14] < (long)current + 6 * PAGE_SIZE) { 248 return true;
295 printk ("*********parent**********\n");
296 __show_regs((struct pt_regs *)(regs->u_regs[14] + PTREGS_OFF));
297 idump_from_user(((struct pt_regs *)(regs->u_regs[14] + PTREGS_OFF))->tpc);
298 printk ("*********endpar**********\n");
299 }
300#endif
301} 249}
302 250
303#ifdef CONFIG_MAGIC_SYSRQ
304struct global_reg_snapshot global_reg_snapshot[NR_CPUS];
305static DEFINE_SPINLOCK(global_reg_snapshot_lock);
306
307static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs, 251static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs,
308 int this_cpu) 252 int this_cpu)
309{ 253{
@@ -315,14 +259,22 @@ static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs,
315 global_reg_snapshot[this_cpu].o7 = regs->u_regs[UREG_I7]; 259 global_reg_snapshot[this_cpu].o7 = regs->u_regs[UREG_I7];
316 260
317 if (regs->tstate & TSTATE_PRIV) { 261 if (regs->tstate & TSTATE_PRIV) {
262 struct thread_info *tp = current_thread_info();
318 struct reg_window *rw; 263 struct reg_window *rw;
319 264
320 rw = (struct reg_window *) 265 rw = (struct reg_window *)
321 (regs->u_regs[UREG_FP] + STACK_BIAS); 266 (regs->u_regs[UREG_FP] + STACK_BIAS);
322 global_reg_snapshot[this_cpu].i7 = rw->ins[6]; 267 if (kstack_valid(tp, rw)) {
323 } else 268 global_reg_snapshot[this_cpu].i7 = rw->ins[7];
269 rw = (struct reg_window *)
270 (rw->ins[6] + STACK_BIAS);
271 if (kstack_valid(tp, rw))
272 global_reg_snapshot[this_cpu].rpc = rw->ins[7];
273 }
274 } else {
324 global_reg_snapshot[this_cpu].i7 = 0; 275 global_reg_snapshot[this_cpu].i7 = 0;
325 276 global_reg_snapshot[this_cpu].rpc = 0;
277 }
326 global_reg_snapshot[this_cpu].thread = tp; 278 global_reg_snapshot[this_cpu].thread = tp;
327} 279}
328 280
@@ -341,7 +293,7 @@ static void __global_reg_poll(struct global_reg_snapshot *gp)
341 } 293 }
342} 294}
343 295
344static void sysrq_handle_globreg(int key, struct tty_struct *tty) 296void __trigger_all_cpu_backtrace(void)
345{ 297{
346 struct thread_info *tp = current_thread_info(); 298 struct thread_info *tp = current_thread_info();
347 struct pt_regs *regs = get_irq_regs(); 299 struct pt_regs *regs = get_irq_regs();
@@ -375,13 +327,14 @@ static void sysrq_handle_globreg(int key, struct tty_struct *tty)
375 ((tp && tp->task) ? tp->task->pid : -1)); 327 ((tp && tp->task) ? tp->task->pid : -1));
376 328
377 if (gp->tstate & TSTATE_PRIV) { 329 if (gp->tstate & TSTATE_PRIV) {
378 printk(" TPC[%pS] O7[%pS] I7[%pS]\n", 330 printk(" TPC[%pS] O7[%pS] I7[%pS] RPC[%pS]\n",
379 (void *) gp->tpc, 331 (void *) gp->tpc,
380 (void *) gp->o7, 332 (void *) gp->o7,
381 (void *) gp->i7); 333 (void *) gp->i7,
334 (void *) gp->rpc);
382 } else { 335 } else {
383 printk(" TPC[%lx] O7[%lx] I7[%lx]\n", 336 printk(" TPC[%lx] O7[%lx] I7[%lx] RPC[%lx]\n",
384 gp->tpc, gp->o7, gp->i7); 337 gp->tpc, gp->o7, gp->i7, gp->rpc);
385 } 338 }
386 } 339 }
387 340
@@ -390,6 +343,13 @@ static void sysrq_handle_globreg(int key, struct tty_struct *tty)
390 spin_unlock_irqrestore(&global_reg_snapshot_lock, flags); 343 spin_unlock_irqrestore(&global_reg_snapshot_lock, flags);
391} 344}
392 345
346#ifdef CONFIG_MAGIC_SYSRQ
347
348static void sysrq_handle_globreg(int key, struct tty_struct *tty)
349{
350 __trigger_all_cpu_backtrace();
351}
352
393static struct sysrq_key_op sparc_globalreg_op = { 353static struct sysrq_key_op sparc_globalreg_op = {
394 .handler = sysrq_handle_globreg, 354 .handler = sysrq_handle_globreg,
395 .help_msg = "Globalregs", 355 .help_msg = "Globalregs",
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index d1b84456a9ee..ec82d76dc6f2 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -2,7 +2,7 @@
2 * arch/sparc64/kernel/signal.c 2 * arch/sparc64/kernel/signal.c
3 * 3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 5 * Copyright (C) 1995, 2008 David S. Miller (davem@davemloft.net)
6 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) 6 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
7 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) 7 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
8 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 8 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -23,7 +23,6 @@
23#include <linux/tty.h> 23#include <linux/tty.h>
24#include <linux/binfmts.h> 24#include <linux/binfmts.h>
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26#include <linux/tracehook.h>
27 26
28#include <asm/uaccess.h> 27#include <asm/uaccess.h>
29#include <asm/ptrace.h> 28#include <asm/ptrace.h>
@@ -91,7 +90,9 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
91 err |= __get_user(regs->u_regs[UREG_G4], (&(*grp)[MC_G4])); 90 err |= __get_user(regs->u_regs[UREG_G4], (&(*grp)[MC_G4]));
92 err |= __get_user(regs->u_regs[UREG_G5], (&(*grp)[MC_G5])); 91 err |= __get_user(regs->u_regs[UREG_G5], (&(*grp)[MC_G5]));
93 err |= __get_user(regs->u_regs[UREG_G6], (&(*grp)[MC_G6])); 92 err |= __get_user(regs->u_regs[UREG_G6], (&(*grp)[MC_G6]));
94 err |= __get_user(regs->u_regs[UREG_G7], (&(*grp)[MC_G7])); 93
94 /* Skip %g7 as that's the thread register in userspace. */
95
95 err |= __get_user(regs->u_regs[UREG_I0], (&(*grp)[MC_O0])); 96 err |= __get_user(regs->u_regs[UREG_I0], (&(*grp)[MC_O0]));
96 err |= __get_user(regs->u_regs[UREG_I1], (&(*grp)[MC_O1])); 97 err |= __get_user(regs->u_regs[UREG_I1], (&(*grp)[MC_O1]));
97 err |= __get_user(regs->u_regs[UREG_I2], (&(*grp)[MC_O2])); 98 err |= __get_user(regs->u_regs[UREG_I2], (&(*grp)[MC_O2]));
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 7cf72b4bb108..27b81775a4de 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -459,27 +459,35 @@ again:
459 } 459 }
460} 460}
461 461
462static inline void spitfire_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask) 462static void spitfire_xcall_deliver(struct trap_per_cpu *tb, int cnt)
463{ 463{
464 u64 *mondo, data0, data1, data2;
465 u16 *cpu_list;
464 u64 pstate; 466 u64 pstate;
465 int i; 467 int i;
466 468
467 __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate)); 469 __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate));
468 for_each_cpu_mask(i, mask) 470 cpu_list = __va(tb->cpu_list_pa);
469 spitfire_xcall_helper(data0, data1, data2, pstate, i); 471 mondo = __va(tb->cpu_mondo_block_pa);
472 data0 = mondo[0];
473 data1 = mondo[1];
474 data2 = mondo[2];
475 for (i = 0; i < cnt; i++)
476 spitfire_xcall_helper(data0, data1, data2, pstate, cpu_list[i]);
470} 477}
471 478
472/* Cheetah now allows to send the whole 64-bytes of data in the interrupt 479/* Cheetah now allows to send the whole 64-bytes of data in the interrupt
473 * packet, but we have no use for that. However we do take advantage of 480 * packet, but we have no use for that. However we do take advantage of
474 * the new pipelining feature (ie. dispatch to multiple cpus simultaneously). 481 * the new pipelining feature (ie. dispatch to multiple cpus simultaneously).
475 */ 482 */
476static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask) 483static void cheetah_xcall_deliver(struct trap_per_cpu *tb, int cnt)
477{ 484{
478 u64 pstate, ver, busy_mask;
479 int nack_busy_id, is_jbus, need_more; 485 int nack_busy_id, is_jbus, need_more;
486 u64 *mondo, pstate, ver, busy_mask;
487 u16 *cpu_list;
480 488
481 if (cpus_empty(mask)) 489 cpu_list = __va(tb->cpu_list_pa);
482 return; 490 mondo = __va(tb->cpu_mondo_block_pa);
483 491
484 /* Unfortunately, someone at Sun had the brilliant idea to make the 492 /* Unfortunately, someone at Sun had the brilliant idea to make the
485 * busy/nack fields hard-coded by ITID number for this Ultra-III 493 * busy/nack fields hard-coded by ITID number for this Ultra-III
@@ -502,7 +510,7 @@ retry:
502 "stxa %2, [%5] %6\n\t" 510 "stxa %2, [%5] %6\n\t"
503 "membar #Sync\n\t" 511 "membar #Sync\n\t"
504 : /* no outputs */ 512 : /* no outputs */
505 : "r" (data0), "r" (data1), "r" (data2), 513 : "r" (mondo[0]), "r" (mondo[1]), "r" (mondo[2]),
506 "r" (0x40), "r" (0x50), "r" (0x60), 514 "r" (0x40), "r" (0x50), "r" (0x60),
507 "i" (ASI_INTR_W)); 515 "i" (ASI_INTR_W));
508 516
@@ -511,11 +519,16 @@ retry:
511 { 519 {
512 int i; 520 int i;
513 521
514 for_each_cpu_mask(i, mask) { 522 for (i = 0; i < cnt; i++) {
515 u64 target = (i << 14) | 0x70; 523 u64 target, nr;
516 524
525 nr = cpu_list[i];
526 if (nr == 0xffff)
527 continue;
528
529 target = (nr << 14) | 0x70;
517 if (is_jbus) { 530 if (is_jbus) {
518 busy_mask |= (0x1UL << (i * 2)); 531 busy_mask |= (0x1UL << (nr * 2));
519 } else { 532 } else {
520 target |= (nack_busy_id << 24); 533 target |= (nack_busy_id << 24);
521 busy_mask |= (0x1UL << 534 busy_mask |= (0x1UL <<
@@ -549,11 +562,13 @@ retry:
549 __asm__ __volatile__("wrpr %0, 0x0, %%pstate" 562 __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
550 : : "r" (pstate)); 563 : : "r" (pstate));
551 if (unlikely(need_more)) { 564 if (unlikely(need_more)) {
552 int i, cnt = 0; 565 int i, this_cnt = 0;
553 for_each_cpu_mask(i, mask) { 566 for (i = 0; i < cnt; i++) {
554 cpu_clear(i, mask); 567 if (cpu_list[i] == 0xffff)
555 cnt++; 568 continue;
556 if (cnt == 32) 569 cpu_list[i] = 0xffff;
570 this_cnt++;
571 if (this_cnt == 32)
557 break; 572 break;
558 } 573 }
559 goto retry; 574 goto retry;
@@ -584,16 +599,20 @@ retry:
584 /* Clear out the mask bits for cpus which did not 599 /* Clear out the mask bits for cpus which did not
585 * NACK us. 600 * NACK us.
586 */ 601 */
587 for_each_cpu_mask(i, mask) { 602 for (i = 0; i < cnt; i++) {
588 u64 check_mask; 603 u64 check_mask, nr;
604
605 nr = cpu_list[i];
606 if (nr == 0xffff)
607 continue;
589 608
590 if (is_jbus) 609 if (is_jbus)
591 check_mask = (0x2UL << (2*i)); 610 check_mask = (0x2UL << (2*nr));
592 else 611 else
593 check_mask = (0x2UL << 612 check_mask = (0x2UL <<
594 this_busy_nack); 613 this_busy_nack);
595 if ((dispatch_stat & check_mask) == 0) 614 if ((dispatch_stat & check_mask) == 0)
596 cpu_clear(i, mask); 615 cpu_list[i] = 0xffff;
597 this_busy_nack += 2; 616 this_busy_nack += 2;
598 if (this_busy_nack == 64) 617 if (this_busy_nack == 64)
599 break; 618 break;
@@ -605,47 +624,17 @@ retry:
605} 624}
606 625
607/* Multi-cpu list version. */ 626/* Multi-cpu list version. */
608static void hypervisor_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask) 627static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt)
609{ 628{
610 struct trap_per_cpu *tb; 629 int retries, this_cpu, prev_sent, i, saw_cpu_error;
630 unsigned long status;
611 u16 *cpu_list; 631 u16 *cpu_list;
612 u64 *mondo;
613 cpumask_t error_mask;
614 unsigned long flags, status;
615 int cnt, retries, this_cpu, prev_sent, i;
616
617 if (cpus_empty(mask))
618 return;
619
620 /* We have to do this whole thing with interrupts fully disabled.
621 * Otherwise if we send an xcall from interrupt context it will
622 * corrupt both our mondo block and cpu list state.
623 *
624 * One consequence of this is that we cannot use timeout mechanisms
625 * that depend upon interrupts being delivered locally. So, for
626 * example, we cannot sample jiffies and expect it to advance.
627 *
628 * Fortunately, udelay() uses %stick/%tick so we can use that.
629 */
630 local_irq_save(flags);
631 632
632 this_cpu = smp_processor_id(); 633 this_cpu = smp_processor_id();
633 tb = &trap_block[this_cpu];
634
635 mondo = __va(tb->cpu_mondo_block_pa);
636 mondo[0] = data0;
637 mondo[1] = data1;
638 mondo[2] = data2;
639 wmb();
640 634
641 cpu_list = __va(tb->cpu_list_pa); 635 cpu_list = __va(tb->cpu_list_pa);
642 636
643 /* Setup the initial cpu list. */ 637 saw_cpu_error = 0;
644 cnt = 0;
645 for_each_cpu_mask(i, mask)
646 cpu_list[cnt++] = i;
647
648 cpus_clear(error_mask);
649 retries = 0; 638 retries = 0;
650 prev_sent = 0; 639 prev_sent = 0;
651 do { 640 do {
@@ -690,10 +679,9 @@ static void hypervisor_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t
690 continue; 679 continue;
691 680
692 err = sun4v_cpu_state(cpu); 681 err = sun4v_cpu_state(cpu);
693 if (err >= 0 && 682 if (err == HV_CPU_STATE_ERROR) {
694 err == HV_CPU_STATE_ERROR) { 683 saw_cpu_error = (cpu + 1);
695 cpu_list[i] = 0xffff; 684 cpu_list[i] = 0xffff;
696 cpu_set(cpu, error_mask);
697 } 685 }
698 } 686 }
699 } else if (unlikely(status != HV_EWOULDBLOCK)) 687 } else if (unlikely(status != HV_EWOULDBLOCK))
@@ -717,32 +705,24 @@ static void hypervisor_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t
717 } 705 }
718 } while (1); 706 } while (1);
719 707
720 local_irq_restore(flags); 708 if (unlikely(saw_cpu_error))
721
722 if (unlikely(!cpus_empty(error_mask)))
723 goto fatal_mondo_cpu_error; 709 goto fatal_mondo_cpu_error;
724 710
725 return; 711 return;
726 712
727fatal_mondo_cpu_error: 713fatal_mondo_cpu_error:
728 printk(KERN_CRIT "CPU[%d]: SUN4V mondo cpu error, some target cpus " 714 printk(KERN_CRIT "CPU[%d]: SUN4V mondo cpu error, some target cpus "
729 "were in error state\n", 715 "(including %d) were in error state\n",
730 this_cpu); 716 this_cpu, saw_cpu_error - 1);
731 printk(KERN_CRIT "CPU[%d]: Error mask [ ", this_cpu);
732 for_each_cpu_mask(i, error_mask)
733 printk("%d ", i);
734 printk("]\n");
735 return; 717 return;
736 718
737fatal_mondo_timeout: 719fatal_mondo_timeout:
738 local_irq_restore(flags);
739 printk(KERN_CRIT "CPU[%d]: SUN4V mondo timeout, no forward " 720 printk(KERN_CRIT "CPU[%d]: SUN4V mondo timeout, no forward "
740 " progress after %d retries.\n", 721 " progress after %d retries.\n",
741 this_cpu, retries); 722 this_cpu, retries);
742 goto dump_cpu_list_and_out; 723 goto dump_cpu_list_and_out;
743 724
744fatal_mondo_error: 725fatal_mondo_error:
745 local_irq_restore(flags);
746 printk(KERN_CRIT "CPU[%d]: Unexpected SUN4V mondo error %lu\n", 726 printk(KERN_CRIT "CPU[%d]: Unexpected SUN4V mondo error %lu\n",
747 this_cpu, status); 727 this_cpu, status);
748 printk(KERN_CRIT "CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) " 728 printk(KERN_CRIT "CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) "
@@ -756,58 +736,93 @@ dump_cpu_list_and_out:
756 printk("]\n"); 736 printk("]\n");
757} 737}
758 738
759/* Send cross call to all processors mentioned in MASK 739static void (*xcall_deliver_impl)(struct trap_per_cpu *, int);
760 * except self. 740
741static void xcall_deliver(u64 data0, u64 data1, u64 data2, const cpumask_t *mask)
742{
743 struct trap_per_cpu *tb;
744 int this_cpu, i, cnt;
745 unsigned long flags;
746 u16 *cpu_list;
747 u64 *mondo;
748
749 /* We have to do this whole thing with interrupts fully disabled.
750 * Otherwise if we send an xcall from interrupt context it will
751 * corrupt both our mondo block and cpu list state.
752 *
753 * One consequence of this is that we cannot use timeout mechanisms
754 * that depend upon interrupts being delivered locally. So, for
755 * example, we cannot sample jiffies and expect it to advance.
756 *
757 * Fortunately, udelay() uses %stick/%tick so we can use that.
758 */
759 local_irq_save(flags);
760
761 this_cpu = smp_processor_id();
762 tb = &trap_block[this_cpu];
763
764 mondo = __va(tb->cpu_mondo_block_pa);
765 mondo[0] = data0;
766 mondo[1] = data1;
767 mondo[2] = data2;
768 wmb();
769
770 cpu_list = __va(tb->cpu_list_pa);
771
772 /* Setup the initial cpu list. */
773 cnt = 0;
774 for_each_cpu_mask_nr(i, *mask) {
775 if (i == this_cpu || !cpu_online(i))
776 continue;
777 cpu_list[cnt++] = i;
778 }
779
780 if (cnt)
781 xcall_deliver_impl(tb, cnt);
782
783 local_irq_restore(flags);
784}
785
786/* Send cross call to all processors mentioned in MASK_P
787 * except self. Really, there are only two cases currently,
788 * "&cpu_online_map" and "&mm->cpu_vm_mask".
761 */ 789 */
762static void smp_cross_call_masked(unsigned long *func, u32 ctx, u64 data1, u64 data2, cpumask_t mask) 790static void smp_cross_call_masked(unsigned long *func, u32 ctx, u64 data1, u64 data2, const cpumask_t *mask)
763{ 791{
764 u64 data0 = (((u64)ctx)<<32 | (((u64)func) & 0xffffffff)); 792 u64 data0 = (((u64)ctx)<<32 | (((u64)func) & 0xffffffff));
765 int this_cpu = get_cpu();
766
767 cpus_and(mask, mask, cpu_online_map);
768 cpu_clear(this_cpu, mask);
769 793
770 if (tlb_type == spitfire) 794 xcall_deliver(data0, data1, data2, mask);
771 spitfire_xcall_deliver(data0, data1, data2, mask); 795}
772 else if (tlb_type == cheetah || tlb_type == cheetah_plus)
773 cheetah_xcall_deliver(data0, data1, data2, mask);
774 else
775 hypervisor_xcall_deliver(data0, data1, data2, mask);
776 /* NOTE: Caller runs local copy on master. */
777 796
778 put_cpu(); 797/* Send cross call to all processors except self. */
798static void smp_cross_call(unsigned long *func, u32 ctx, u64 data1, u64 data2)
799{
800 smp_cross_call_masked(func, ctx, data1, data2, &cpu_online_map);
779} 801}
780 802
781extern unsigned long xcall_sync_tick; 803extern unsigned long xcall_sync_tick;
782 804
783static void smp_start_sync_tick_client(int cpu) 805static void smp_start_sync_tick_client(int cpu)
784{ 806{
785 cpumask_t mask = cpumask_of_cpu(cpu); 807 xcall_deliver((u64) &xcall_sync_tick, 0, 0,
786 808 &cpumask_of_cpu(cpu));
787 smp_cross_call_masked(&xcall_sync_tick,
788 0, 0, 0, mask);
789} 809}
790 810
791extern unsigned long xcall_call_function; 811extern unsigned long xcall_call_function;
792 812
793void arch_send_call_function_ipi(cpumask_t mask) 813void arch_send_call_function_ipi(cpumask_t mask)
794{ 814{
795 smp_cross_call_masked(&xcall_call_function, 0, 0, 0, mask); 815 xcall_deliver((u64) &xcall_call_function, 0, 0, &mask);
796} 816}
797 817
798extern unsigned long xcall_call_function_single; 818extern unsigned long xcall_call_function_single;
799 819
800void arch_send_call_function_single_ipi(int cpu) 820void arch_send_call_function_single_ipi(int cpu)
801{ 821{
802 cpumask_t mask = cpumask_of_cpu(cpu); 822 xcall_deliver((u64) &xcall_call_function_single, 0, 0,
803 823 &cpumask_of_cpu(cpu));
804 smp_cross_call_masked(&xcall_call_function_single, 0, 0, 0, mask);
805} 824}
806 825
807/* Send cross call to all processors except self. */
808#define smp_cross_call(func, ctx, data1, data2) \
809 smp_cross_call_masked(func, ctx, data1, data2, cpu_online_map)
810
811void smp_call_function_client(int irq, struct pt_regs *regs) 826void smp_call_function_client(int irq, struct pt_regs *regs)
812{ 827{
813 clear_softint(1 << irq); 828 clear_softint(1 << irq);
@@ -843,7 +858,6 @@ void smp_tsb_sync(struct mm_struct *mm)
843extern unsigned long xcall_flush_tlb_mm; 858extern unsigned long xcall_flush_tlb_mm;
844extern unsigned long xcall_flush_tlb_pending; 859extern unsigned long xcall_flush_tlb_pending;
845extern unsigned long xcall_flush_tlb_kernel_range; 860extern unsigned long xcall_flush_tlb_kernel_range;
846extern unsigned long xcall_report_regs;
847#ifdef CONFIG_MAGIC_SYSRQ 861#ifdef CONFIG_MAGIC_SYSRQ
848extern unsigned long xcall_fetch_glob_regs; 862extern unsigned long xcall_fetch_glob_regs;
849#endif 863#endif
@@ -878,7 +892,6 @@ static inline void __local_flush_dcache_page(struct page *page)
878 892
879void smp_flush_dcache_page_impl(struct page *page, int cpu) 893void smp_flush_dcache_page_impl(struct page *page, int cpu)
880{ 894{
881 cpumask_t mask = cpumask_of_cpu(cpu);
882 int this_cpu; 895 int this_cpu;
883 896
884 if (tlb_type == hypervisor) 897 if (tlb_type == hypervisor)
@@ -894,29 +907,24 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu)
894 __local_flush_dcache_page(page); 907 __local_flush_dcache_page(page);
895 } else if (cpu_online(cpu)) { 908 } else if (cpu_online(cpu)) {
896 void *pg_addr = page_address(page); 909 void *pg_addr = page_address(page);
897 u64 data0; 910 u64 data0 = 0;
898 911
899 if (tlb_type == spitfire) { 912 if (tlb_type == spitfire) {
900 data0 = 913 data0 = ((u64)&xcall_flush_dcache_page_spitfire);
901 ((u64)&xcall_flush_dcache_page_spitfire);
902 if (page_mapping(page) != NULL) 914 if (page_mapping(page) != NULL)
903 data0 |= ((u64)1 << 32); 915 data0 |= ((u64)1 << 32);
904 spitfire_xcall_deliver(data0,
905 __pa(pg_addr),
906 (u64) pg_addr,
907 mask);
908 } else if (tlb_type == cheetah || tlb_type == cheetah_plus) { 916 } else if (tlb_type == cheetah || tlb_type == cheetah_plus) {
909#ifdef DCACHE_ALIASING_POSSIBLE 917#ifdef DCACHE_ALIASING_POSSIBLE
910 data0 = 918 data0 = ((u64)&xcall_flush_dcache_page_cheetah);
911 ((u64)&xcall_flush_dcache_page_cheetah);
912 cheetah_xcall_deliver(data0,
913 __pa(pg_addr),
914 0, mask);
915#endif 919#endif
916 } 920 }
921 if (data0) {
922 xcall_deliver(data0, __pa(pg_addr),
923 (u64) pg_addr, &cpumask_of_cpu(cpu));
917#ifdef CONFIG_DEBUG_DCFLUSH 924#ifdef CONFIG_DEBUG_DCFLUSH
918 atomic_inc(&dcpage_flushes_xcall); 925 atomic_inc(&dcpage_flushes_xcall);
919#endif 926#endif
927 }
920 } 928 }
921 929
922 put_cpu(); 930 put_cpu();
@@ -924,66 +932,41 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu)
924 932
925void flush_dcache_page_all(struct mm_struct *mm, struct page *page) 933void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
926{ 934{
927 void *pg_addr = page_address(page); 935 void *pg_addr;
928 cpumask_t mask = cpu_online_map;
929 u64 data0;
930 int this_cpu; 936 int this_cpu;
937 u64 data0;
931 938
932 if (tlb_type == hypervisor) 939 if (tlb_type == hypervisor)
933 return; 940 return;
934 941
935 this_cpu = get_cpu(); 942 this_cpu = get_cpu();
936 943
937 cpu_clear(this_cpu, mask);
938
939#ifdef CONFIG_DEBUG_DCFLUSH 944#ifdef CONFIG_DEBUG_DCFLUSH
940 atomic_inc(&dcpage_flushes); 945 atomic_inc(&dcpage_flushes);
941#endif 946#endif
942 if (cpus_empty(mask)) 947 data0 = 0;
943 goto flush_self; 948 pg_addr = page_address(page);
944 if (tlb_type == spitfire) { 949 if (tlb_type == spitfire) {
945 data0 = ((u64)&xcall_flush_dcache_page_spitfire); 950 data0 = ((u64)&xcall_flush_dcache_page_spitfire);
946 if (page_mapping(page) != NULL) 951 if (page_mapping(page) != NULL)
947 data0 |= ((u64)1 << 32); 952 data0 |= ((u64)1 << 32);
948 spitfire_xcall_deliver(data0,
949 __pa(pg_addr),
950 (u64) pg_addr,
951 mask);
952 } else if (tlb_type == cheetah || tlb_type == cheetah_plus) { 953 } else if (tlb_type == cheetah || tlb_type == cheetah_plus) {
953#ifdef DCACHE_ALIASING_POSSIBLE 954#ifdef DCACHE_ALIASING_POSSIBLE
954 data0 = ((u64)&xcall_flush_dcache_page_cheetah); 955 data0 = ((u64)&xcall_flush_dcache_page_cheetah);
955 cheetah_xcall_deliver(data0,
956 __pa(pg_addr),
957 0, mask);
958#endif 956#endif
959 } 957 }
958 if (data0) {
959 xcall_deliver(data0, __pa(pg_addr),
960 (u64) pg_addr, &cpu_online_map);
960#ifdef CONFIG_DEBUG_DCFLUSH 961#ifdef CONFIG_DEBUG_DCFLUSH
961 atomic_inc(&dcpage_flushes_xcall); 962 atomic_inc(&dcpage_flushes_xcall);
962#endif 963#endif
963 flush_self: 964 }
964 __local_flush_dcache_page(page); 965 __local_flush_dcache_page(page);
965 966
966 put_cpu(); 967 put_cpu();
967} 968}
968 969
969static void __smp_receive_signal_mask(cpumask_t mask)
970{
971 smp_cross_call_masked(&xcall_receive_signal, 0, 0, 0, mask);
972}
973
974void smp_receive_signal(int cpu)
975{
976 cpumask_t mask = cpumask_of_cpu(cpu);
977
978 if (cpu_online(cpu))
979 __smp_receive_signal_mask(mask);
980}
981
982void smp_receive_signal_client(int irq, struct pt_regs *regs)
983{
984 clear_softint(1 << irq);
985}
986
987void smp_new_mmu_context_version_client(int irq, struct pt_regs *regs) 970void smp_new_mmu_context_version_client(int irq, struct pt_regs *regs)
988{ 971{
989 struct mm_struct *mm; 972 struct mm_struct *mm;
@@ -1022,11 +1005,6 @@ void kgdb_roundup_cpus(unsigned long flags)
1022} 1005}
1023#endif 1006#endif
1024 1007
1025void smp_report_regs(void)
1026{
1027 smp_cross_call(&xcall_report_regs, 0, 0, 0);
1028}
1029
1030#ifdef CONFIG_MAGIC_SYSRQ 1008#ifdef CONFIG_MAGIC_SYSRQ
1031void smp_fetch_global_regs(void) 1009void smp_fetch_global_regs(void)
1032{ 1010{
@@ -1089,7 +1067,7 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
1089 1067
1090 smp_cross_call_masked(&xcall_flush_tlb_mm, 1068 smp_cross_call_masked(&xcall_flush_tlb_mm,
1091 ctx, 0, 0, 1069 ctx, 0, 0,
1092 mm->cpu_vm_mask); 1070 &mm->cpu_vm_mask);
1093 1071
1094local_flush_and_out: 1072local_flush_and_out:
1095 __flush_tlb_mm(ctx, SECONDARY_CONTEXT); 1073 __flush_tlb_mm(ctx, SECONDARY_CONTEXT);
@@ -1107,7 +1085,7 @@ void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long
1107 else 1085 else
1108 smp_cross_call_masked(&xcall_flush_tlb_pending, 1086 smp_cross_call_masked(&xcall_flush_tlb_pending,
1109 ctx, nr, (unsigned long) vaddrs, 1087 ctx, nr, (unsigned long) vaddrs,
1110 mm->cpu_vm_mask); 1088 &mm->cpu_vm_mask);
1111 1089
1112 __flush_tlb_pending(ctx, nr, vaddrs); 1090 __flush_tlb_pending(ctx, nr, vaddrs);
1113 1091
@@ -1208,6 +1186,16 @@ void __devinit smp_prepare_boot_cpu(void)
1208{ 1186{
1209} 1187}
1210 1188
1189void __init smp_setup_processor_id(void)
1190{
1191 if (tlb_type == spitfire)
1192 xcall_deliver_impl = spitfire_xcall_deliver;
1193 else if (tlb_type == cheetah || tlb_type == cheetah_plus)
1194 xcall_deliver_impl = cheetah_xcall_deliver;
1195 else
1196 xcall_deliver_impl = hypervisor_xcall_deliver;
1197}
1198
1211void __devinit smp_fill_in_sib_core_maps(void) 1199void __devinit smp_fill_in_sib_core_maps(void)
1212{ 1200{
1213 unsigned int i; 1201 unsigned int i;
@@ -1376,7 +1364,13 @@ void __init smp_cpus_done(unsigned int max_cpus)
1376 1364
1377void smp_send_reschedule(int cpu) 1365void smp_send_reschedule(int cpu)
1378{ 1366{
1379 smp_receive_signal(cpu); 1367 xcall_deliver((u64) &xcall_receive_signal, 0, 0,
1368 &cpumask_of_cpu(cpu));
1369}
1370
1371void smp_receive_signal_client(int irq, struct pt_regs *regs)
1372{
1373 clear_softint(1 << irq);
1380} 1374}
1381 1375
1382/* This is a nop because we capture all other cpus 1376/* This is a nop because we capture all other cpus
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index 504e678ee128..0804f71df6cb 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -68,7 +68,6 @@ extern void *__memscan_zero(void *, size_t);
68extern void *__memscan_generic(void *, int, size_t); 68extern void *__memscan_generic(void *, int, size_t);
69extern int __memcmp(const void *, const void *, __kernel_size_t); 69extern int __memcmp(const void *, const void *, __kernel_size_t);
70extern __kernel_size_t strlen(const char *); 70extern __kernel_size_t strlen(const char *);
71extern void show_regs(struct pt_regs *);
72extern void syscall_trace(struct pt_regs *, int); 71extern void syscall_trace(struct pt_regs *, int);
73extern void sys_sigsuspend(void); 72extern void sys_sigsuspend(void);
74extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg); 73extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg);
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index bd30ecba5630..404e8561e2d0 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -1777,7 +1777,7 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent,
1777 pfx, 1777 pfx,
1778 ent->err_raddr, ent->err_size, ent->err_cpu); 1778 ent->err_raddr, ent->err_size, ent->err_cpu);
1779 1779
1780 __show_regs(regs); 1780 show_regs(regs);
1781 1781
1782 if ((cnt = atomic_read(ocnt)) != 0) { 1782 if ((cnt = atomic_read(ocnt)) != 0) {
1783 atomic_set(ocnt, 0); 1783 atomic_set(ocnt, 0);
@@ -2177,7 +2177,6 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
2177void die_if_kernel(char *str, struct pt_regs *regs) 2177void die_if_kernel(char *str, struct pt_regs *regs)
2178{ 2178{
2179 static int die_counter; 2179 static int die_counter;
2180 extern void smp_report_regs(void);
2181 int count = 0; 2180 int count = 0;
2182 2181
2183 /* Amuse the user. */ 2182 /* Amuse the user. */
@@ -2190,7 +2189,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2190 printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter); 2189 printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter);
2191 notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV); 2190 notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV);
2192 __asm__ __volatile__("flushw"); 2191 __asm__ __volatile__("flushw");
2193 __show_regs(regs); 2192 show_regs(regs);
2194 add_taint(TAINT_DIE); 2193 add_taint(TAINT_DIE);
2195 if (regs->tstate & TSTATE_PRIV) { 2194 if (regs->tstate & TSTATE_PRIV) {
2196 struct reg_window *rw = (struct reg_window *) 2195 struct reg_window *rw = (struct reg_window *)
@@ -2215,11 +2214,6 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2215 } 2214 }
2216 user_instruction_dump ((unsigned int __user *) regs->tpc); 2215 user_instruction_dump ((unsigned int __user *) regs->tpc);
2217 } 2216 }
2218#if 0
2219#ifdef CONFIG_SMP
2220 smp_report_regs();
2221#endif
2222#endif
2223 if (regs->tstate & TSTATE_PRIV) 2217 if (regs->tstate & TSTATE_PRIV)
2224 do_exit(SIGKILL); 2218 do_exit(SIGKILL);
2225 do_exit(SIGSEGV); 2219 do_exit(SIGSEGV);
diff --git a/arch/sparc64/mm/tsb.c b/arch/sparc64/mm/tsb.c
index 3547937b17a2..587f8efb2e05 100644
--- a/arch/sparc64/mm/tsb.c
+++ b/arch/sparc64/mm/tsb.c
@@ -1,9 +1,10 @@
1/* arch/sparc64/mm/tsb.c 1/* arch/sparc64/mm/tsb.c
2 * 2 *
3 * Copyright (C) 2006 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 2006, 2008 David S. Miller <davem@davemloft.net>
4 */ 4 */
5 5
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/preempt.h>
7#include <asm/system.h> 8#include <asm/system.h>
8#include <asm/page.h> 9#include <asm/page.h>
9#include <asm/tlbflush.h> 10#include <asm/tlbflush.h>
@@ -415,7 +416,9 @@ retry_tsb_alloc:
415 tsb_context_switch(mm); 416 tsb_context_switch(mm);
416 417
417 /* Now force other processors to do the same. */ 418 /* Now force other processors to do the same. */
419 preempt_disable();
418 smp_tsb_sync(mm); 420 smp_tsb_sync(mm);
421 preempt_enable();
419 422
420 /* Now it is safe to free the old tsb. */ 423 /* Now it is safe to free the old tsb. */
421 kmem_cache_free(tsb_caches[old_cache_index], old_tsb); 424 kmem_cache_free(tsb_caches[old_cache_index], old_tsb);
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S
index 4c8ca131ffaf..ff1dc44d363e 100644
--- a/arch/sparc64/mm/ultra.S
+++ b/arch/sparc64/mm/ultra.S
@@ -480,41 +480,6 @@ xcall_sync_tick:
480 b rtrap_xcall 480 b rtrap_xcall
481 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 481 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
482 482
483 /* NOTE: This is SPECIAL!! We do etrap/rtrap however
484 * we choose to deal with the "BH's run with
485 * %pil==15" problem (described in asm/pil.h)
486 * by just invoking rtrap directly past where
487 * BH's are checked for.
488 *
489 * We do it like this because we do not want %pil==15
490 * lockups to prevent regs being reported.
491 */
492 .globl xcall_report_regs
493xcall_report_regs:
494
495661: rdpr %pstate, %g2
496 wrpr %g2, PSTATE_IG | PSTATE_AG, %pstate
497 .section .sun4v_2insn_patch, "ax"
498 .word 661b
499 nop
500 nop
501 .previous
502
503 rdpr %pil, %g2
504 wrpr %g0, 15, %pil
505 sethi %hi(109f), %g7
506 b,pt %xcc, etrap_irq
507109: or %g7, %lo(109b), %g7
508#ifdef CONFIG_TRACE_IRQFLAGS
509 call trace_hardirqs_off
510 nop
511#endif
512 call __show_regs
513 add %sp, PTREGS_OFF, %o0
514 /* Has to be a non-v9 branch due to the large distance. */
515 b rtrap_xcall
516 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
517
518#ifdef CONFIG_MAGIC_SYSRQ 483#ifdef CONFIG_MAGIC_SYSRQ
519 .globl xcall_fetch_glob_regs 484 .globl xcall_fetch_glob_regs
520xcall_fetch_glob_regs: 485xcall_fetch_glob_regs:
@@ -531,6 +496,13 @@ xcall_fetch_glob_regs:
531 stx %g7, [%g1 + GR_SNAP_TNPC] 496 stx %g7, [%g1 + GR_SNAP_TNPC]
532 stx %o7, [%g1 + GR_SNAP_O7] 497 stx %o7, [%g1 + GR_SNAP_O7]
533 stx %i7, [%g1 + GR_SNAP_I7] 498 stx %i7, [%g1 + GR_SNAP_I7]
499 /* Don't try this at home kids... */
500 rdpr %cwp, %g2
501 sub %g2, 1, %g7
502 wrpr %g7, %cwp
503 mov %i7, %g7
504 wrpr %g2, %cwp
505 stx %g7, [%g1 + GR_SNAP_RPC]
534 sethi %hi(trap_block), %g7 506 sethi %hi(trap_block), %g7
535 or %g7, %lo(trap_block), %g7 507 or %g7, %lo(trap_block), %g7
536 sllx %g2, TRAP_BLOCK_SZ_SHIFT, %g2 508 sllx %g2, TRAP_BLOCK_SZ_SHIFT, %g2
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c
index 6e52cdd6166f..c9a7c5b74a0d 100644
--- a/arch/xtensa/kernel/xtensa_ksyms.c
+++ b/arch/xtensa/kernel/xtensa_ksyms.c
@@ -18,7 +18,6 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <asm/irq.h> 19#include <asm/irq.h>
20#include <linux/in6.h> 20#include <linux/in6.h>
21#include <linux/ide.h>
22 21
23#include <asm/uaccess.h> 22#include <asm/uaccess.h>
24#include <asm/checksum.h> 23#include <asm/checksum.h>