aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/abi.h25
-rw-r--r--include/asm-mips/addrspace.h90
-rw-r--r--include/asm-mips/asm.h4
-rw-r--r--include/asm-mips/atomic.h40
-rw-r--r--include/asm-mips/bitops.h209
-rw-r--r--include/asm-mips/bootinfo.h5
-rw-r--r--include/asm-mips/break.h1
-rw-r--r--include/asm-mips/bug.h11
-rw-r--r--include/asm-mips/bugs.h6
-rw-r--r--include/asm-mips/cache.h3
-rw-r--r--include/asm-mips/cacheflush.h31
-rw-r--r--include/asm-mips/checksum.h159
-rw-r--r--include/asm-mips/cobalt/cobalt.h52
-rw-r--r--include/asm-mips/cobalt/mach-gt64120.h1
-rw-r--r--include/asm-mips/compat.h12
-rw-r--r--include/asm-mips/cpu-features.h66
-rw-r--r--include/asm-mips/cpu-info.h2
-rw-r--r--include/asm-mips/cpu.h87
-rw-r--r--include/asm-mips/dec/ecc.h3
-rw-r--r--include/asm-mips/dec/ioasic_addrs.h3
-rw-r--r--include/asm-mips/dec/kn01.h34
-rw-r--r--include/asm-mips/dec/kn02.h33
-rw-r--r--include/asm-mips/dec/kn02xa.h46
-rw-r--r--include/asm-mips/dec/kn03.h13
-rw-r--r--include/asm-mips/dec/kn05.h76
-rw-r--r--include/asm-mips/dec/prom.h30
-rw-r--r--include/asm-mips/dec/system.h18
-rw-r--r--include/asm-mips/dec/tc.h10
-rw-r--r--include/asm-mips/delay.h8
-rw-r--r--include/asm-mips/dma-mapping.h4
-rw-r--r--include/asm-mips/dsp.h83
-rw-r--r--include/asm-mips/elf.h96
-rw-r--r--include/asm-mips/errno.h4
-rw-r--r--include/asm-mips/fcntl.h17
-rw-r--r--include/asm-mips/fixmap.h7
-rw-r--r--include/asm-mips/fpu.h9
-rw-r--r--include/asm-mips/fpu_emulator.h19
-rw-r--r--include/asm-mips/futex.h50
-rw-r--r--include/asm-mips/hazards.h58
-rw-r--r--include/asm-mips/highmem.h2
-rw-r--r--include/asm-mips/inst.h10
-rw-r--r--include/asm-mips/interrupt.h137
-rw-r--r--include/asm-mips/inventory.h8
-rw-r--r--include/asm-mips/io.h164
-rw-r--r--include/asm-mips/irq.h4
-rw-r--r--include/asm-mips/jmr3927/jmr3927.h14
-rw-r--r--include/asm-mips/mach-au1x00/au1000.h554
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx.h44
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_dbdma.h128
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_gpio.h20
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h301
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_psc.h2
-rw-r--r--include/asm-mips/mach-au1x00/ioremap.h32
-rw-r--r--include/asm-mips/mach-db1x00/db1200.h224
-rw-r--r--include/asm-mips/mach-dec/mc146818rtc.h11
-rw-r--r--include/asm-mips/mach-generic/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-generic/ide.h73
-rw-r--r--include/asm-mips/mach-generic/ioremap.h23
-rw-r--r--include/asm-mips/mach-generic/kernel-entry-init.h25
-rw-r--r--include/asm-mips/mach-generic/kmalloc.h13
-rw-r--r--include/asm-mips/mach-generic/spaces.h10
-rw-r--r--include/asm-mips/mach-ip22/cpu-feature-overrides.h8
-rw-r--r--include/asm-mips/mach-ip22/spaces.h2
-rw-r--r--include/asm-mips/mach-ip27/cpu-feature-overrides.h1
-rw-r--r--include/asm-mips/mach-ip27/kernel-entry-init.h52
-rw-r--r--include/asm-mips/mach-ip27/kmalloc.h8
-rw-r--r--include/asm-mips/mach-ip27/mmzone.h2
-rw-r--r--include/asm-mips/mach-ip27/spaces.h1
-rw-r--r--include/asm-mips/mach-ip27/topology.h3
-rw-r--r--include/asm-mips/mach-ip32/cpu-feature-overrides.h1
-rw-r--r--include/asm-mips/mach-ip32/kmalloc.h12
-rw-r--r--include/asm-mips/mach-ip32/spaces.h8
-rw-r--r--include/asm-mips/mach-ja/cpu-feature-overrides.h7
-rw-r--r--include/asm-mips/mach-mips/cpu-feature-overrides.h6
-rw-r--r--include/asm-mips/mach-mips/irq.h14
-rw-r--r--include/asm-mips/mach-ocelot3/cpu-feature-overrides.h7
-rw-r--r--include/asm-mips/mach-pb1x00/pb1200.h252
-rw-r--r--include/asm-mips/mach-pnx8550/cm.h43
-rw-r--r--include/asm-mips/mach-pnx8550/glb.h86
-rw-r--r--include/asm-mips/mach-pnx8550/int.h140
-rw-r--r--include/asm-mips/mach-pnx8550/kernel-entry-init.h262
-rw-r--r--include/asm-mips/mach-pnx8550/nand.h121
-rw-r--r--include/asm-mips/mach-pnx8550/pci.h185
-rw-r--r--include/asm-mips/mach-pnx8550/uart.h16
-rw-r--r--include/asm-mips/mach-pnx8550/usb.h32
-rw-r--r--include/asm-mips/mach-rm200/cpu-feature-overrides.h3
-rw-r--r--include/asm-mips/mach-sibyte/cpu-feature-overrides.h1
-rw-r--r--include/asm-mips/mach-sim/cpu-feature-overrides.h66
-rw-r--r--include/asm-mips/mach-yosemite/cpu-feature-overrides.h7
-rw-r--r--include/asm-mips/mips-boards/generic.h7
-rw-r--r--include/asm-mips/mips-boards/maltaint.h58
-rw-r--r--include/asm-mips/mips-boards/msc01_pci.h241
-rw-r--r--include/asm-mips/mips-boards/sim.h40
-rw-r--r--include/asm-mips/mips-boards/simint.h34
-rw-r--r--include/asm-mips/mipsmtregs.h391
-rw-r--r--include/asm-mips/mipsregs.h394
-rw-r--r--include/asm-mips/mmu_context.h4
-rw-r--r--include/asm-mips/mmzone.h1
-rw-r--r--include/asm-mips/module.h90
-rw-r--r--include/asm-mips/paccess.h8
-rw-r--r--include/asm-mips/page.h42
-rw-r--r--include/asm-mips/pci.h36
-rw-r--r--include/asm-mips/pgalloc.h19
-rw-r--r--include/asm-mips/pgtable-32.h53
-rw-r--r--include/asm-mips/pgtable-64.h71
-rw-r--r--include/asm-mips/pgtable-bits.h6
-rw-r--r--include/asm-mips/pgtable.h24
-rw-r--r--include/asm-mips/processor.h22
-rw-r--r--include/asm-mips/ptrace.h19
-rw-r--r--include/asm-mips/r4kcache.h72
-rw-r--r--include/asm-mips/rtc.h53
-rw-r--r--include/asm-mips/rtlx.h56
-rw-r--r--include/asm-mips/semaphore.h3
-rw-r--r--include/asm-mips/serial.h35
-rw-r--r--include/asm-mips/sgi/hpc3.h40
-rw-r--r--include/asm-mips/sibyte/bcm1480_int.h310
-rw-r--r--include/asm-mips/sibyte/bcm1480_l2c.h176
-rw-r--r--include/asm-mips/sibyte/bcm1480_mc.h962
-rw-r--r--include/asm-mips/sibyte/bcm1480_regs.h869
-rw-r--r--include/asm-mips/sibyte/bcm1480_scd.h436
-rw-r--r--include/asm-mips/sibyte/bigsur.h49
-rw-r--r--include/asm-mips/sibyte/board.h16
-rw-r--r--include/asm-mips/sibyte/sb1250.h13
-rw-r--r--include/asm-mips/sibyte/sb1250_defs.h33
-rw-r--r--include/asm-mips/sibyte/sb1250_dma.h70
-rw-r--r--include/asm-mips/sibyte/sb1250_genbus.h230
-rw-r--r--include/asm-mips/sibyte/sb1250_int.h8
-rw-r--r--include/asm-mips/sibyte/sb1250_l2c.h11
-rw-r--r--include/asm-mips/sibyte/sb1250_ldt.h2
-rw-r--r--include/asm-mips/sibyte/sb1250_mac.h35
-rw-r--r--include/asm-mips/sibyte/sb1250_mc.h6
-rw-r--r--include/asm-mips/sibyte/sb1250_regs.h35
-rw-r--r--include/asm-mips/sibyte/sb1250_scd.h102
-rw-r--r--include/asm-mips/sibyte/sb1250_smbus.h58
-rw-r--r--include/asm-mips/sibyte/sb1250_syncser.h2
-rw-r--r--include/asm-mips/sibyte/sb1250_uart.h13
-rw-r--r--include/asm-mips/sibyte/swarm.h2
-rw-r--r--include/asm-mips/sigcontext.h60
-rw-r--r--include/asm-mips/siginfo.h1
-rw-r--r--include/asm-mips/signal.h29
-rw-r--r--include/asm-mips/sn/sn0/arch.h5
-rw-r--r--include/asm-mips/socket.h5
-rw-r--r--include/asm-mips/spinlock.h26
-rw-r--r--include/asm-mips/stackframe.h29
-rw-r--r--include/asm-mips/system.h71
-rw-r--r--include/asm-mips/thread_info.h11
-rw-r--r--include/asm-mips/traps.h3
-rw-r--r--include/asm-mips/tx4938/rbtx4938.h207
-rw-r--r--include/asm-mips/tx4938/spi.h74
-rw-r--r--include/asm-mips/tx4938/tx4938.h706
-rw-r--r--include/asm-mips/tx4938/tx4938_mips.h54
-rw-r--r--include/asm-mips/uaccess.h158
-rw-r--r--include/asm-mips/unistd.h26
-rw-r--r--include/asm-mips/vga.h25
-rw-r--r--include/asm-mips/war.h14
155 files changed, 9954 insertions, 1379 deletions
diff --git a/include/asm-mips/abi.h b/include/asm-mips/abi.h
new file mode 100644
index 000000000000..2e7e651c3e3f
--- /dev/null
+++ b/include/asm-mips/abi.h
@@ -0,0 +1,25 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 by Ralf Baechle
7 * Copyright (C) 2005 MIPS Technologies, Inc.
8 */
9#ifndef _ASM_ABI_H
10#define _ASM_ABI_H
11
12#include <asm/signal.h>
13#include <asm/siginfo.h>
14
15struct mips_abi {
16 int (* const do_signal)(sigset_t *oldset, struct pt_regs *regs);
17 int (* const setup_frame)(struct k_sigaction * ka,
18 struct pt_regs *regs, int signr,
19 sigset_t *set);
20 int (* const setup_rt_frame)(struct k_sigaction * ka,
21 struct pt_regs *regs, int signr,
22 sigset_t *set, siginfo_t *info);
23};
24
25#endif /* _ASM_ABI_H */
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
index 7dc2619f5006..42520cc84b0f 100644
--- a/include/asm-mips/addrspace.h
+++ b/include/asm-mips/addrspace.h
@@ -20,10 +20,12 @@
20#define _ATYPE_ 20#define _ATYPE_
21#define _ATYPE32_ 21#define _ATYPE32_
22#define _ATYPE64_ 22#define _ATYPE64_
23#define _LLCONST_(x) x
23#else 24#else
24#define _ATYPE_ __PTRDIFF_TYPE__ 25#define _ATYPE_ __PTRDIFF_TYPE__
25#define _ATYPE32_ int 26#define _ATYPE32_ int
26#define _ATYPE64_ long long 27#define _ATYPE64_ long long
28#define _LLCONST_(x) x ## LL
27#endif 29#endif
28 30
29/* 31/*
@@ -45,8 +47,9 @@
45/* 47/*
46 * Returns the physical address of a CKSEGx / XKPHYS address 48 * Returns the physical address of a CKSEGx / XKPHYS address
47 */ 49 */
48#define CPHYSADDR(a) ((_ACAST32_ (a)) & 0x1fffffff) 50#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
49#define XPHYSADDR(a) ((_ACAST64_ (a)) & 0x000000ffffffffff) 51#define XPHYSADDR(a) ((_ACAST64_(a)) & \
52 _LLCONST_(0x000000ffffffffff))
50 53
51#ifdef CONFIG_64BIT 54#ifdef CONFIG_64BIT
52 55
@@ -55,14 +58,14 @@
55 * The compatibility segments use the full 64-bit sign extended value. Note 58 * The compatibility segments use the full 64-bit sign extended value. Note
56 * the R8000 doesn't have them so don't reference these in generic MIPS code. 59 * the R8000 doesn't have them so don't reference these in generic MIPS code.
57 */ 60 */
58#define XKUSEG 0x0000000000000000 61#define XKUSEG _LLCONST_(0x0000000000000000)
59#define XKSSEG 0x4000000000000000 62#define XKSSEG _LLCONST_(0x4000000000000000)
60#define XKPHYS 0x8000000000000000 63#define XKPHYS _LLCONST_(0x8000000000000000)
61#define XKSEG 0xc000000000000000 64#define XKSEG _LLCONST_(0xc000000000000000)
62#define CKSEG0 0xffffffff80000000 65#define CKSEG0 _LLCONST_(0xffffffff80000000)
63#define CKSEG1 0xffffffffa0000000 66#define CKSEG1 _LLCONST_(0xffffffffa0000000)
64#define CKSSEG 0xffffffffc0000000 67#define CKSSEG _LLCONST_(0xffffffffc0000000)
65#define CKSEG3 0xffffffffe0000000 68#define CKSEG3 _LLCONST_(0xffffffffe0000000)
66 69
67#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0) 70#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0)
68#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1) 71#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1)
@@ -120,7 +123,8 @@
120#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED,(p)) 123#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED,(p))
121#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE,(p)) 124#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE,(p))
122#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK) 125#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
123#define PHYS_TO_XKPHYS(cm,a) (0x8000000000000000 | ((cm)<<59) | (a)) 126#define PHYS_TO_XKPHYS(cm,a) (_LLCONST_(0x8000000000000000) | \
127 ((cm)<<59) | (a))
124 128
125#if defined (CONFIG_CPU_R4300) \ 129#if defined (CONFIG_CPU_R4300) \
126 || defined (CONFIG_CPU_R4X00) \ 130 || defined (CONFIG_CPU_R4X00) \
@@ -128,46 +132,56 @@
128 || defined (CONFIG_CPU_NEVADA) \ 132 || defined (CONFIG_CPU_NEVADA) \
129 || defined (CONFIG_CPU_TX49XX) \ 133 || defined (CONFIG_CPU_TX49XX) \
130 || defined (CONFIG_CPU_MIPS64) 134 || defined (CONFIG_CPU_MIPS64)
131#define KUSIZE 0x0000010000000000 /* 2^^40 */ 135#define KUSIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
132#define KUSIZE_64 0x0000010000000000 /* 2^^40 */ 136#define KUSIZE_64 _LLCONST_(0x0000010000000000) /* 2^^40 */
133#define K0SIZE 0x0000001000000000 /* 2^^36 */ 137#define K0SIZE _LLCONST_(0x0000001000000000) /* 2^^36 */
134#define K1SIZE 0x0000001000000000 /* 2^^36 */ 138#define K1SIZE _LLCONST_(0x0000001000000000) /* 2^^36 */
135#define K2SIZE 0x000000ff80000000 139#define K2SIZE _LLCONST_(0x000000ff80000000)
136#define KSEGSIZE 0x000000ff80000000 /* max syssegsz */ 140#define KSEGSIZE _LLCONST_(0x000000ff80000000) /* max syssegsz */
137#define TO_PHYS_MASK 0x0000000fffffffff /* 2^^36 - 1 */ 141#define TO_PHYS_MASK _LLCONST_(0x0000000fffffffff) /* 2^^36 - 1 */
138#endif 142#endif
139 143
140#if defined (CONFIG_CPU_R8000) 144#if defined (CONFIG_CPU_R8000)
141/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */ 145/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */
142#define KUSIZE 0x0000010000000000 /* 2^^40 */ 146#define KUSIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
143#define KUSIZE_64 0x0000010000000000 /* 2^^40 */ 147#define KUSIZE_64 _LLCONST_(0x0000010000000000) /* 2^^40 */
144#define K0SIZE 0x0000010000000000 /* 2^^40 */ 148#define K0SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
145#define K1SIZE 0x0000010000000000 /* 2^^40 */ 149#define K1SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
146#define K2SIZE 0x0001000000000000 150#define K2SIZE _LLCONST_(0x0001000000000000)
147#define KSEGSIZE 0x0000010000000000 /* max syssegsz */ 151#define KSEGSIZE _LLCONST_(0x0000010000000000) /* max syssegsz */
148#define TO_PHYS_MASK 0x000000ffffffffff /* 2^^40 - 1 */ 152#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */
149#endif 153#endif
150 154
151#if defined (CONFIG_CPU_R10000) 155#if defined (CONFIG_CPU_R10000)
152#define KUSIZE 0x0000010000000000 /* 2^^40 */ 156#define KUSIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
153#define KUSIZE_64 0x0000010000000000 /* 2^^40 */ 157#define KUSIZE_64 _LLCONST_(0x0000010000000000) /* 2^^40 */
154#define K0SIZE 0x0000010000000000 /* 2^^40 */ 158#define K0SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
155#define K1SIZE 0x0000010000000000 /* 2^^40 */ 159#define K1SIZE _LLCONST_(0x0000010000000000) /* 2^^40 */
156#define K2SIZE 0x00000fff80000000 160#define K2SIZE _LLCONST_(0x00000fff80000000)
157#define KSEGSIZE 0x00000fff80000000 /* max syssegsz */ 161#define KSEGSIZE _LLCONST_(0x00000fff80000000) /* max syssegsz */
158#define TO_PHYS_MASK 0x000000ffffffffff /* 2^^40 - 1 */ 162#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */
163#endif
164
165#if defined(CONFIG_CPU_SB1) || defined(CONFIG_CPU_SB1A)
166#define KUSIZE _LLCONST_(0x0000100000000000) /* 2^^44 */
167#define KUSIZE_64 _LLCONST_(0x0000100000000000) /* 2^^44 */
168#define K0SIZE _LLCONST_(0x0000100000000000) /* 2^^44 */
169#define K1SIZE _LLCONST_(0x0000100000000000) /* 2^^44 */
170#define K2SIZE _LLCONST_(0x0000ffff80000000)
171#define KSEGSIZE _LLCONST_(0x0000ffff80000000) /* max syssegsz */
172#define TO_PHYS_MASK _LLCONST_(0x00000fffffffffff) /* 2^^44 - 1 */
159#endif 173#endif
160 174
161/* 175/*
162 * Further names for SGI source compatibility. These are stolen from 176 * Further names for SGI source compatibility. These are stolen from
163 * IRIX's <sys/mips_addrspace.h>. 177 * IRIX's <sys/mips_addrspace.h>.
164 */ 178 */
165#define KUBASE 0 179#define KUBASE _LLCONST_(0)
166#define KUSIZE_32 0x0000000080000000 /* KUSIZE 180#define KUSIZE_32 _LLCONST_(0x0000000080000000) /* KUSIZE
167 for a 32 bit proc */ 181 for a 32 bit proc */
168#define K0BASE_EXL_WR 0xa800000000000000 /* exclusive on write */ 182#define K0BASE_EXL_WR _LLCONST_(0xa800000000000000) /* exclusive on write */
169#define K0BASE_NONCOH 0x9800000000000000 /* noncoherent */ 183#define K0BASE_NONCOH _LLCONST_(0x9800000000000000) /* noncoherent */
170#define K0BASE_EXL 0xa000000000000000 /* exclusive */ 184#define K0BASE_EXL _LLCONST_(0xa000000000000000) /* exclusive */
171 185
172#ifndef CONFIG_CPU_R8000 186#ifndef CONFIG_CPU_R8000
173 187
@@ -176,7 +190,7 @@
176 * in order to catch bugs in the source code. 190 * in order to catch bugs in the source code.
177 */ 191 */
178 192
179#define COMPAT_K1BASE32 0xffffffffa0000000 193#define COMPAT_K1BASE32 _LLCONST_(0xffffffffa0000000)
180#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */ 194#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */
181 195
182#endif 196#endif
diff --git a/include/asm-mips/asm.h b/include/asm-mips/asm.h
index f53237772985..4b090f3142e0 100644
--- a/include/asm-mips/asm.h
+++ b/include/asm-mips/asm.h
@@ -107,6 +107,7 @@ symbol = value
107/* 107/*
108 * Print formatted string 108 * Print formatted string
109 */ 109 */
110#ifdef CONFIG_PRINTK
110#define PRINT(string) \ 111#define PRINT(string) \
111 .set push; \ 112 .set push; \
112 .set reorder; \ 113 .set reorder; \
@@ -114,6 +115,9 @@ symbol = value
114 jal printk; \ 115 jal printk; \
115 .set pop; \ 116 .set pop; \
116 TEXT(string) 117 TEXT(string)
118#else
119#define PRINT(string)
120#endif
117 121
118#define TEXT(msg) \ 122#define TEXT(msg) \
119 .pushsection .data; \ 123 .pushsection .data; \
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index c0bd8d014e14..6202eb8a14b7 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -62,20 +62,24 @@ static __inline__ void atomic_add(int i, atomic_t * v)
62 unsigned long temp; 62 unsigned long temp;
63 63
64 __asm__ __volatile__( 64 __asm__ __volatile__(
65 " .set mips3 \n"
65 "1: ll %0, %1 # atomic_add \n" 66 "1: ll %0, %1 # atomic_add \n"
66 " addu %0, %2 \n" 67 " addu %0, %2 \n"
67 " sc %0, %1 \n" 68 " sc %0, %1 \n"
68 " beqzl %0, 1b \n" 69 " beqzl %0, 1b \n"
70 " .set mips0 \n"
69 : "=&r" (temp), "=m" (v->counter) 71 : "=&r" (temp), "=m" (v->counter)
70 : "Ir" (i), "m" (v->counter)); 72 : "Ir" (i), "m" (v->counter));
71 } else if (cpu_has_llsc) { 73 } else if (cpu_has_llsc) {
72 unsigned long temp; 74 unsigned long temp;
73 75
74 __asm__ __volatile__( 76 __asm__ __volatile__(
77 " .set mips3 \n"
75 "1: ll %0, %1 # atomic_add \n" 78 "1: ll %0, %1 # atomic_add \n"
76 " addu %0, %2 \n" 79 " addu %0, %2 \n"
77 " sc %0, %1 \n" 80 " sc %0, %1 \n"
78 " beqz %0, 1b \n" 81 " beqz %0, 1b \n"
82 " .set mips0 \n"
79 : "=&r" (temp), "=m" (v->counter) 83 : "=&r" (temp), "=m" (v->counter)
80 : "Ir" (i), "m" (v->counter)); 84 : "Ir" (i), "m" (v->counter));
81 } else { 85 } else {
@@ -100,20 +104,24 @@ static __inline__ void atomic_sub(int i, atomic_t * v)
100 unsigned long temp; 104 unsigned long temp;
101 105
102 __asm__ __volatile__( 106 __asm__ __volatile__(
107 " .set mips3 \n"
103 "1: ll %0, %1 # atomic_sub \n" 108 "1: ll %0, %1 # atomic_sub \n"
104 " subu %0, %2 \n" 109 " subu %0, %2 \n"
105 " sc %0, %1 \n" 110 " sc %0, %1 \n"
106 " beqzl %0, 1b \n" 111 " beqzl %0, 1b \n"
112 " .set mips0 \n"
107 : "=&r" (temp), "=m" (v->counter) 113 : "=&r" (temp), "=m" (v->counter)
108 : "Ir" (i), "m" (v->counter)); 114 : "Ir" (i), "m" (v->counter));
109 } else if (cpu_has_llsc) { 115 } else if (cpu_has_llsc) {
110 unsigned long temp; 116 unsigned long temp;
111 117
112 __asm__ __volatile__( 118 __asm__ __volatile__(
119 " .set mips3 \n"
113 "1: ll %0, %1 # atomic_sub \n" 120 "1: ll %0, %1 # atomic_sub \n"
114 " subu %0, %2 \n" 121 " subu %0, %2 \n"
115 " sc %0, %1 \n" 122 " sc %0, %1 \n"
116 " beqz %0, 1b \n" 123 " beqz %0, 1b \n"
124 " .set mips0 \n"
117 : "=&r" (temp), "=m" (v->counter) 125 : "=&r" (temp), "=m" (v->counter)
118 : "Ir" (i), "m" (v->counter)); 126 : "Ir" (i), "m" (v->counter));
119 } else { 127 } else {
@@ -136,12 +144,14 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
136 unsigned long temp; 144 unsigned long temp;
137 145
138 __asm__ __volatile__( 146 __asm__ __volatile__(
147 " .set mips3 \n"
139 "1: ll %1, %2 # atomic_add_return \n" 148 "1: ll %1, %2 # atomic_add_return \n"
140 " addu %0, %1, %3 \n" 149 " addu %0, %1, %3 \n"
141 " sc %0, %2 \n" 150 " sc %0, %2 \n"
142 " beqzl %0, 1b \n" 151 " beqzl %0, 1b \n"
143 " addu %0, %1, %3 \n" 152 " addu %0, %1, %3 \n"
144 " sync \n" 153 " sync \n"
154 " .set mips0 \n"
145 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 155 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
146 : "Ir" (i), "m" (v->counter) 156 : "Ir" (i), "m" (v->counter)
147 : "memory"); 157 : "memory");
@@ -149,12 +159,14 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
149 unsigned long temp; 159 unsigned long temp;
150 160
151 __asm__ __volatile__( 161 __asm__ __volatile__(
162 " .set mips3 \n"
152 "1: ll %1, %2 # atomic_add_return \n" 163 "1: ll %1, %2 # atomic_add_return \n"
153 " addu %0, %1, %3 \n" 164 " addu %0, %1, %3 \n"
154 " sc %0, %2 \n" 165 " sc %0, %2 \n"
155 " beqz %0, 1b \n" 166 " beqz %0, 1b \n"
156 " addu %0, %1, %3 \n" 167 " addu %0, %1, %3 \n"
157 " sync \n" 168 " sync \n"
169 " .set mips0 \n"
158 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 170 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
159 : "Ir" (i), "m" (v->counter) 171 : "Ir" (i), "m" (v->counter)
160 : "memory"); 172 : "memory");
@@ -179,12 +191,14 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
179 unsigned long temp; 191 unsigned long temp;
180 192
181 __asm__ __volatile__( 193 __asm__ __volatile__(
194 " .set mips3 \n"
182 "1: ll %1, %2 # atomic_sub_return \n" 195 "1: ll %1, %2 # atomic_sub_return \n"
183 " subu %0, %1, %3 \n" 196 " subu %0, %1, %3 \n"
184 " sc %0, %2 \n" 197 " sc %0, %2 \n"
185 " beqzl %0, 1b \n" 198 " beqzl %0, 1b \n"
186 " subu %0, %1, %3 \n" 199 " subu %0, %1, %3 \n"
187 " sync \n" 200 " sync \n"
201 " .set mips0 \n"
188 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 202 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
189 : "Ir" (i), "m" (v->counter) 203 : "Ir" (i), "m" (v->counter)
190 : "memory"); 204 : "memory");
@@ -192,12 +206,14 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
192 unsigned long temp; 206 unsigned long temp;
193 207
194 __asm__ __volatile__( 208 __asm__ __volatile__(
209 " .set mips3 \n"
195 "1: ll %1, %2 # atomic_sub_return \n" 210 "1: ll %1, %2 # atomic_sub_return \n"
196 " subu %0, %1, %3 \n" 211 " subu %0, %1, %3 \n"
197 " sc %0, %2 \n" 212 " sc %0, %2 \n"
198 " beqz %0, 1b \n" 213 " beqz %0, 1b \n"
199 " subu %0, %1, %3 \n" 214 " subu %0, %1, %3 \n"
200 " sync \n" 215 " sync \n"
216 " .set mips0 \n"
201 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 217 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
202 : "Ir" (i), "m" (v->counter) 218 : "Ir" (i), "m" (v->counter)
203 : "memory"); 219 : "memory");
@@ -229,6 +245,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
229 unsigned long temp; 245 unsigned long temp;
230 246
231 __asm__ __volatile__( 247 __asm__ __volatile__(
248 " .set mips3 \n"
232 "1: ll %1, %2 # atomic_sub_if_positive\n" 249 "1: ll %1, %2 # atomic_sub_if_positive\n"
233 " subu %0, %1, %3 \n" 250 " subu %0, %1, %3 \n"
234 " bltz %0, 1f \n" 251 " bltz %0, 1f \n"
@@ -236,6 +253,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
236 " beqzl %0, 1b \n" 253 " beqzl %0, 1b \n"
237 " sync \n" 254 " sync \n"
238 "1: \n" 255 "1: \n"
256 " .set mips0 \n"
239 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 257 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
240 : "Ir" (i), "m" (v->counter) 258 : "Ir" (i), "m" (v->counter)
241 : "memory"); 259 : "memory");
@@ -243,6 +261,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
243 unsigned long temp; 261 unsigned long temp;
244 262
245 __asm__ __volatile__( 263 __asm__ __volatile__(
264 " .set mips3 \n"
246 "1: ll %1, %2 # atomic_sub_if_positive\n" 265 "1: ll %1, %2 # atomic_sub_if_positive\n"
247 " subu %0, %1, %3 \n" 266 " subu %0, %1, %3 \n"
248 " bltz %0, 1f \n" 267 " bltz %0, 1f \n"
@@ -250,6 +269,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
250 " beqz %0, 1b \n" 269 " beqz %0, 1b \n"
251 " sync \n" 270 " sync \n"
252 "1: \n" 271 "1: \n"
272 " .set mips0 \n"
253 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 273 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
254 : "Ir" (i), "m" (v->counter) 274 : "Ir" (i), "m" (v->counter)
255 : "memory"); 275 : "memory");
@@ -367,20 +387,24 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
367 unsigned long temp; 387 unsigned long temp;
368 388
369 __asm__ __volatile__( 389 __asm__ __volatile__(
390 " .set mips3 \n"
370 "1: lld %0, %1 # atomic64_add \n" 391 "1: lld %0, %1 # atomic64_add \n"
371 " addu %0, %2 \n" 392 " addu %0, %2 \n"
372 " scd %0, %1 \n" 393 " scd %0, %1 \n"
373 " beqzl %0, 1b \n" 394 " beqzl %0, 1b \n"
395 " .set mips0 \n"
374 : "=&r" (temp), "=m" (v->counter) 396 : "=&r" (temp), "=m" (v->counter)
375 : "Ir" (i), "m" (v->counter)); 397 : "Ir" (i), "m" (v->counter));
376 } else if (cpu_has_llsc) { 398 } else if (cpu_has_llsc) {
377 unsigned long temp; 399 unsigned long temp;
378 400
379 __asm__ __volatile__( 401 __asm__ __volatile__(
402 " .set mips3 \n"
380 "1: lld %0, %1 # atomic64_add \n" 403 "1: lld %0, %1 # atomic64_add \n"
381 " addu %0, %2 \n" 404 " addu %0, %2 \n"
382 " scd %0, %1 \n" 405 " scd %0, %1 \n"
383 " beqz %0, 1b \n" 406 " beqz %0, 1b \n"
407 " .set mips0 \n"
384 : "=&r" (temp), "=m" (v->counter) 408 : "=&r" (temp), "=m" (v->counter)
385 : "Ir" (i), "m" (v->counter)); 409 : "Ir" (i), "m" (v->counter));
386 } else { 410 } else {
@@ -405,20 +429,24 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
405 unsigned long temp; 429 unsigned long temp;
406 430
407 __asm__ __volatile__( 431 __asm__ __volatile__(
432 " .set mips3 \n"
408 "1: lld %0, %1 # atomic64_sub \n" 433 "1: lld %0, %1 # atomic64_sub \n"
409 " subu %0, %2 \n" 434 " subu %0, %2 \n"
410 " scd %0, %1 \n" 435 " scd %0, %1 \n"
411 " beqzl %0, 1b \n" 436 " beqzl %0, 1b \n"
437 " .set mips0 \n"
412 : "=&r" (temp), "=m" (v->counter) 438 : "=&r" (temp), "=m" (v->counter)
413 : "Ir" (i), "m" (v->counter)); 439 : "Ir" (i), "m" (v->counter));
414 } else if (cpu_has_llsc) { 440 } else if (cpu_has_llsc) {
415 unsigned long temp; 441 unsigned long temp;
416 442
417 __asm__ __volatile__( 443 __asm__ __volatile__(
444 " .set mips3 \n"
418 "1: lld %0, %1 # atomic64_sub \n" 445 "1: lld %0, %1 # atomic64_sub \n"
419 " subu %0, %2 \n" 446 " subu %0, %2 \n"
420 " scd %0, %1 \n" 447 " scd %0, %1 \n"
421 " beqz %0, 1b \n" 448 " beqz %0, 1b \n"
449 " .set mips0 \n"
422 : "=&r" (temp), "=m" (v->counter) 450 : "=&r" (temp), "=m" (v->counter)
423 : "Ir" (i), "m" (v->counter)); 451 : "Ir" (i), "m" (v->counter));
424 } else { 452 } else {
@@ -441,12 +469,14 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
441 unsigned long temp; 469 unsigned long temp;
442 470
443 __asm__ __volatile__( 471 __asm__ __volatile__(
472 " .set mips3 \n"
444 "1: lld %1, %2 # atomic64_add_return \n" 473 "1: lld %1, %2 # atomic64_add_return \n"
445 " addu %0, %1, %3 \n" 474 " addu %0, %1, %3 \n"
446 " scd %0, %2 \n" 475 " scd %0, %2 \n"
447 " beqzl %0, 1b \n" 476 " beqzl %0, 1b \n"
448 " addu %0, %1, %3 \n" 477 " addu %0, %1, %3 \n"
449 " sync \n" 478 " sync \n"
479 " .set mips0 \n"
450 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 480 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
451 : "Ir" (i), "m" (v->counter) 481 : "Ir" (i), "m" (v->counter)
452 : "memory"); 482 : "memory");
@@ -454,12 +484,14 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
454 unsigned long temp; 484 unsigned long temp;
455 485
456 __asm__ __volatile__( 486 __asm__ __volatile__(
487 " .set mips3 \n"
457 "1: lld %1, %2 # atomic64_add_return \n" 488 "1: lld %1, %2 # atomic64_add_return \n"
458 " addu %0, %1, %3 \n" 489 " addu %0, %1, %3 \n"
459 " scd %0, %2 \n" 490 " scd %0, %2 \n"
460 " beqz %0, 1b \n" 491 " beqz %0, 1b \n"
461 " addu %0, %1, %3 \n" 492 " addu %0, %1, %3 \n"
462 " sync \n" 493 " sync \n"
494 " .set mips0 \n"
463 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 495 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
464 : "Ir" (i), "m" (v->counter) 496 : "Ir" (i), "m" (v->counter)
465 : "memory"); 497 : "memory");
@@ -484,12 +516,14 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
484 unsigned long temp; 516 unsigned long temp;
485 517
486 __asm__ __volatile__( 518 __asm__ __volatile__(
519 " .set mips3 \n"
487 "1: lld %1, %2 # atomic64_sub_return \n" 520 "1: lld %1, %2 # atomic64_sub_return \n"
488 " subu %0, %1, %3 \n" 521 " subu %0, %1, %3 \n"
489 " scd %0, %2 \n" 522 " scd %0, %2 \n"
490 " beqzl %0, 1b \n" 523 " beqzl %0, 1b \n"
491 " subu %0, %1, %3 \n" 524 " subu %0, %1, %3 \n"
492 " sync \n" 525 " sync \n"
526 " .set mips0 \n"
493 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 527 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
494 : "Ir" (i), "m" (v->counter) 528 : "Ir" (i), "m" (v->counter)
495 : "memory"); 529 : "memory");
@@ -497,12 +531,14 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
497 unsigned long temp; 531 unsigned long temp;
498 532
499 __asm__ __volatile__( 533 __asm__ __volatile__(
534 " .set mips3 \n"
500 "1: lld %1, %2 # atomic64_sub_return \n" 535 "1: lld %1, %2 # atomic64_sub_return \n"
501 " subu %0, %1, %3 \n" 536 " subu %0, %1, %3 \n"
502 " scd %0, %2 \n" 537 " scd %0, %2 \n"
503 " beqz %0, 1b \n" 538 " beqz %0, 1b \n"
504 " subu %0, %1, %3 \n" 539 " subu %0, %1, %3 \n"
505 " sync \n" 540 " sync \n"
541 " .set mips0 \n"
506 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 542 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
507 : "Ir" (i), "m" (v->counter) 543 : "Ir" (i), "m" (v->counter)
508 : "memory"); 544 : "memory");
@@ -534,6 +570,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
534 unsigned long temp; 570 unsigned long temp;
535 571
536 __asm__ __volatile__( 572 __asm__ __volatile__(
573 " .set mips3 \n"
537 "1: lld %1, %2 # atomic64_sub_if_positive\n" 574 "1: lld %1, %2 # atomic64_sub_if_positive\n"
538 " dsubu %0, %1, %3 \n" 575 " dsubu %0, %1, %3 \n"
539 " bltz %0, 1f \n" 576 " bltz %0, 1f \n"
@@ -541,6 +578,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
541 " beqzl %0, 1b \n" 578 " beqzl %0, 1b \n"
542 " sync \n" 579 " sync \n"
543 "1: \n" 580 "1: \n"
581 " .set mips0 \n"
544 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 582 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
545 : "Ir" (i), "m" (v->counter) 583 : "Ir" (i), "m" (v->counter)
546 : "memory"); 584 : "memory");
@@ -548,6 +586,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
548 unsigned long temp; 586 unsigned long temp;
549 587
550 __asm__ __volatile__( 588 __asm__ __volatile__(
589 " .set mips3 \n"
551 "1: lld %1, %2 # atomic64_sub_if_positive\n" 590 "1: lld %1, %2 # atomic64_sub_if_positive\n"
552 " dsubu %0, %1, %3 \n" 591 " dsubu %0, %1, %3 \n"
553 " bltz %0, 1f \n" 592 " bltz %0, 1f \n"
@@ -555,6 +594,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
555 " beqz %0, 1b \n" 594 " beqz %0, 1b \n"
556 " sync \n" 595 " sync \n"
557 "1: \n" 596 "1: \n"
597 " .set mips0 \n"
558 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 598 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
559 : "Ir" (i), "m" (v->counter) 599 : "Ir" (i), "m" (v->counter)
560 : "memory"); 600 : "memory");
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index eb8d79dba11c..5496f9064a6a 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -12,20 +12,21 @@
12#include <linux/config.h> 12#include <linux/config.h>
13#include <linux/compiler.h> 13#include <linux/compiler.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <asm/bug.h>
15#include <asm/byteorder.h> /* sigh ... */ 16#include <asm/byteorder.h> /* sigh ... */
16#include <asm/cpu-features.h> 17#include <asm/cpu-features.h>
17 18
18#if (_MIPS_SZLONG == 32) 19#if (_MIPS_SZLONG == 32)
19#define SZLONG_LOG 5 20#define SZLONG_LOG 5
20#define SZLONG_MASK 31UL 21#define SZLONG_MASK 31UL
21#define __LL "ll " 22#define __LL "ll "
22#define __SC "sc " 23#define __SC "sc "
23#define cpu_to_lelongp(x) cpu_to_le32p((__u32 *) (x)) 24#define cpu_to_lelongp(x) cpu_to_le32p((__u32 *) (x))
24#elif (_MIPS_SZLONG == 64) 25#elif (_MIPS_SZLONG == 64)
25#define SZLONG_LOG 6 26#define SZLONG_LOG 6
26#define SZLONG_MASK 63UL 27#define SZLONG_MASK 63UL
27#define __LL "lld " 28#define __LL "lld "
28#define __SC "scd " 29#define __SC "scd "
29#define cpu_to_lelongp(x) cpu_to_le64p((__u64 *) (x)) 30#define cpu_to_lelongp(x) cpu_to_le64p((__u64 *) (x))
30#endif 31#endif
31 32
@@ -72,18 +73,22 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
72 73
73 if (cpu_has_llsc && R10000_LLSC_WAR) { 74 if (cpu_has_llsc && R10000_LLSC_WAR) {
74 __asm__ __volatile__( 75 __asm__ __volatile__(
76 " .set mips3 \n"
75 "1: " __LL "%0, %1 # set_bit \n" 77 "1: " __LL "%0, %1 # set_bit \n"
76 " or %0, %2 \n" 78 " or %0, %2 \n"
77 " "__SC "%0, %1 \n" 79 " " __SC "%0, %1 \n"
78 " beqzl %0, 1b \n" 80 " beqzl %0, 1b \n"
81 " .set mips0 \n"
79 : "=&r" (temp), "=m" (*m) 82 : "=&r" (temp), "=m" (*m)
80 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m)); 83 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m));
81 } else if (cpu_has_llsc) { 84 } else if (cpu_has_llsc) {
82 __asm__ __volatile__( 85 __asm__ __volatile__(
86 " .set mips3 \n"
83 "1: " __LL "%0, %1 # set_bit \n" 87 "1: " __LL "%0, %1 # set_bit \n"
84 " or %0, %2 \n" 88 " or %0, %2 \n"
85 " "__SC "%0, %1 \n" 89 " " __SC "%0, %1 \n"
86 " beqz %0, 1b \n" 90 " beqz %0, 1b \n"
91 " .set mips0 \n"
87 : "=&r" (temp), "=m" (*m) 92 : "=&r" (temp), "=m" (*m)
88 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m)); 93 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m));
89 } else { 94 } else {
@@ -132,18 +137,22 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
132 137
133 if (cpu_has_llsc && R10000_LLSC_WAR) { 138 if (cpu_has_llsc && R10000_LLSC_WAR) {
134 __asm__ __volatile__( 139 __asm__ __volatile__(
140 " .set mips3 \n"
135 "1: " __LL "%0, %1 # clear_bit \n" 141 "1: " __LL "%0, %1 # clear_bit \n"
136 " and %0, %2 \n" 142 " and %0, %2 \n"
137 " " __SC "%0, %1 \n" 143 " " __SC "%0, %1 \n"
138 " beqzl %0, 1b \n" 144 " beqzl %0, 1b \n"
145 " .set mips0 \n"
139 : "=&r" (temp), "=m" (*m) 146 : "=&r" (temp), "=m" (*m)
140 : "ir" (~(1UL << (nr & SZLONG_MASK))), "m" (*m)); 147 : "ir" (~(1UL << (nr & SZLONG_MASK))), "m" (*m));
141 } else if (cpu_has_llsc) { 148 } else if (cpu_has_llsc) {
142 __asm__ __volatile__( 149 __asm__ __volatile__(
150 " .set mips3 \n"
143 "1: " __LL "%0, %1 # clear_bit \n" 151 "1: " __LL "%0, %1 # clear_bit \n"
144 " and %0, %2 \n" 152 " and %0, %2 \n"
145 " " __SC "%0, %1 \n" 153 " " __SC "%0, %1 \n"
146 " beqz %0, 1b \n" 154 " beqz %0, 1b \n"
155 " .set mips0 \n"
147 : "=&r" (temp), "=m" (*m) 156 : "=&r" (temp), "=m" (*m)
148 : "ir" (~(1UL << (nr & SZLONG_MASK))), "m" (*m)); 157 : "ir" (~(1UL << (nr & SZLONG_MASK))), "m" (*m));
149 } else { 158 } else {
@@ -191,10 +200,12 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
191 unsigned long temp; 200 unsigned long temp;
192 201
193 __asm__ __volatile__( 202 __asm__ __volatile__(
203 " .set mips3 \n"
194 "1: " __LL "%0, %1 # change_bit \n" 204 "1: " __LL "%0, %1 # change_bit \n"
195 " xor %0, %2 \n" 205 " xor %0, %2 \n"
196 " "__SC "%0, %1 \n" 206 " " __SC "%0, %1 \n"
197 " beqzl %0, 1b \n" 207 " beqzl %0, 1b \n"
208 " .set mips0 \n"
198 : "=&r" (temp), "=m" (*m) 209 : "=&r" (temp), "=m" (*m)
199 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m)); 210 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m));
200 } else if (cpu_has_llsc) { 211 } else if (cpu_has_llsc) {
@@ -202,10 +213,12 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
202 unsigned long temp; 213 unsigned long temp;
203 214
204 __asm__ __volatile__( 215 __asm__ __volatile__(
216 " .set mips3 \n"
205 "1: " __LL "%0, %1 # change_bit \n" 217 "1: " __LL "%0, %1 # change_bit \n"
206 " xor %0, %2 \n" 218 " xor %0, %2 \n"
207 " "__SC "%0, %1 \n" 219 " " __SC "%0, %1 \n"
208 " beqz %0, 1b \n" 220 " beqz %0, 1b \n"
221 " .set mips0 \n"
209 : "=&r" (temp), "=m" (*m) 222 : "=&r" (temp), "=m" (*m)
210 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m)); 223 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m));
211 } else { 224 } else {
@@ -253,14 +266,16 @@ static inline int test_and_set_bit(unsigned long nr,
253 unsigned long temp, res; 266 unsigned long temp, res;
254 267
255 __asm__ __volatile__( 268 __asm__ __volatile__(
269 " .set mips3 \n"
256 "1: " __LL "%0, %1 # test_and_set_bit \n" 270 "1: " __LL "%0, %1 # test_and_set_bit \n"
257 " or %2, %0, %3 \n" 271 " or %2, %0, %3 \n"
258 " " __SC "%2, %1 \n" 272 " " __SC "%2, %1 \n"
259 " beqzl %2, 1b \n" 273 " beqzl %2, 1b \n"
260 " and %2, %0, %3 \n" 274 " and %2, %0, %3 \n"
261#ifdef CONFIG_SMP 275#ifdef CONFIG_SMP
262 "sync \n" 276 " sync \n"
263#endif 277#endif
278 " .set mips0 \n"
264 : "=&r" (temp), "=m" (*m), "=&r" (res) 279 : "=&r" (temp), "=m" (*m), "=&r" (res)
265 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 280 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
266 : "memory"); 281 : "memory");
@@ -271,16 +286,18 @@ static inline int test_and_set_bit(unsigned long nr,
271 unsigned long temp, res; 286 unsigned long temp, res;
272 287
273 __asm__ __volatile__( 288 __asm__ __volatile__(
274 " .set noreorder # test_and_set_bit \n" 289 " .set push \n"
275 "1: " __LL "%0, %1 \n" 290 " .set noreorder \n"
291 " .set mips3 \n"
292 "1: " __LL "%0, %1 # test_and_set_bit \n"
276 " or %2, %0, %3 \n" 293 " or %2, %0, %3 \n"
277 " " __SC "%2, %1 \n" 294 " " __SC "%2, %1 \n"
278 " beqz %2, 1b \n" 295 " beqz %2, 1b \n"
279 " and %2, %0, %3 \n" 296 " and %2, %0, %3 \n"
280#ifdef CONFIG_SMP 297#ifdef CONFIG_SMP
281 "sync \n" 298 " sync \n"
282#endif 299#endif
283 ".set\treorder" 300 " .set pop \n"
284 : "=&r" (temp), "=m" (*m), "=&r" (res) 301 : "=&r" (temp), "=m" (*m), "=&r" (res)
285 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 302 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
286 : "memory"); 303 : "memory");
@@ -343,15 +360,17 @@ static inline int test_and_clear_bit(unsigned long nr,
343 unsigned long temp, res; 360 unsigned long temp, res;
344 361
345 __asm__ __volatile__( 362 __asm__ __volatile__(
363 " .set mips3 \n"
346 "1: " __LL "%0, %1 # test_and_clear_bit \n" 364 "1: " __LL "%0, %1 # test_and_clear_bit \n"
347 " or %2, %0, %3 \n" 365 " or %2, %0, %3 \n"
348 " xor %2, %3 \n" 366 " xor %2, %3 \n"
349 __SC "%2, %1 \n" 367 " " __SC "%2, %1 \n"
350 " beqzl %2, 1b \n" 368 " beqzl %2, 1b \n"
351 " and %2, %0, %3 \n" 369 " and %2, %0, %3 \n"
352#ifdef CONFIG_SMP 370#ifdef CONFIG_SMP
353 " sync \n" 371 " sync \n"
354#endif 372#endif
373 " .set mips0 \n"
355 : "=&r" (temp), "=m" (*m), "=&r" (res) 374 : "=&r" (temp), "=m" (*m), "=&r" (res)
356 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 375 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
357 : "memory"); 376 : "memory");
@@ -362,17 +381,19 @@ static inline int test_and_clear_bit(unsigned long nr,
362 unsigned long temp, res; 381 unsigned long temp, res;
363 382
364 __asm__ __volatile__( 383 __asm__ __volatile__(
365 " .set noreorder # test_and_clear_bit \n" 384 " .set push \n"
366 "1: " __LL "%0, %1 \n" 385 " .set noreorder \n"
386 " .set mips3 \n"
387 "1: " __LL "%0, %1 # test_and_clear_bit \n"
367 " or %2, %0, %3 \n" 388 " or %2, %0, %3 \n"
368 " xor %2, %3 \n" 389 " xor %2, %3 \n"
369 __SC "%2, %1 \n" 390 " " __SC "%2, %1 \n"
370 " beqz %2, 1b \n" 391 " beqz %2, 1b \n"
371 " and %2, %0, %3 \n" 392 " and %2, %0, %3 \n"
372#ifdef CONFIG_SMP 393#ifdef CONFIG_SMP
373 " sync \n" 394 " sync \n"
374#endif 395#endif
375 " .set reorder \n" 396 " .set pop \n"
376 : "=&r" (temp), "=m" (*m), "=&r" (res) 397 : "=&r" (temp), "=m" (*m), "=&r" (res)
377 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 398 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
378 : "memory"); 399 : "memory");
@@ -435,14 +456,16 @@ static inline int test_and_change_bit(unsigned long nr,
435 unsigned long temp, res; 456 unsigned long temp, res;
436 457
437 __asm__ __volatile__( 458 __asm__ __volatile__(
438 "1: " __LL " %0, %1 # test_and_change_bit \n" 459 " .set mips3 \n"
460 "1: " __LL "%0, %1 # test_and_change_bit \n"
439 " xor %2, %0, %3 \n" 461 " xor %2, %0, %3 \n"
440 " "__SC "%2, %1 \n" 462 " " __SC "%2, %1 \n"
441 " beqzl %2, 1b \n" 463 " beqzl %2, 1b \n"
442 " and %2, %0, %3 \n" 464 " and %2, %0, %3 \n"
443#ifdef CONFIG_SMP 465#ifdef CONFIG_SMP
444 " sync \n" 466 " sync \n"
445#endif 467#endif
468 " .set mips0 \n"
446 : "=&r" (temp), "=m" (*m), "=&r" (res) 469 : "=&r" (temp), "=m" (*m), "=&r" (res)
447 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 470 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
448 : "memory"); 471 : "memory");
@@ -453,16 +476,18 @@ static inline int test_and_change_bit(unsigned long nr,
453 unsigned long temp, res; 476 unsigned long temp, res;
454 477
455 __asm__ __volatile__( 478 __asm__ __volatile__(
456 " .set noreorder # test_and_change_bit \n" 479 " .set push \n"
457 "1: " __LL " %0, %1 \n" 480 " .set noreorder \n"
481 " .set mips3 \n"
482 "1: " __LL "%0, %1 # test_and_change_bit \n"
458 " xor %2, %0, %3 \n" 483 " xor %2, %0, %3 \n"
459 " "__SC "\t%2, %1 \n" 484 " " __SC "\t%2, %1 \n"
460 " beqz %2, 1b \n" 485 " beqz %2, 1b \n"
461 " and %2, %0, %3 \n" 486 " and %2, %0, %3 \n"
462#ifdef CONFIG_SMP 487#ifdef CONFIG_SMP
463 " sync \n" 488 " sync \n"
464#endif 489#endif
465 " .set reorder \n" 490 " .set pop \n"
466 : "=&r" (temp), "=m" (*m), "=&r" (res) 491 : "=&r" (temp), "=m" (*m), "=&r" (res)
467 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 492 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
468 : "memory"); 493 : "memory");
@@ -523,22 +548,60 @@ static inline int test_bit(unsigned long nr, const volatile unsigned long *addr)
523} 548}
524 549
525/* 550/*
526 * ffz - find first zero in word. 551 * Return the bit position (0..63) of the most significant 1 bit in a word
552 * Returns -1 if no 1 bit exists
553 */
554static inline int __ilog2(unsigned long x)
555{
556 int lz;
557
558 if (sizeof(x) == 4) {
559 __asm__ (
560 " .set push \n"
561 " .set mips32 \n"
562 " clz %0, %1 \n"
563 " .set pop \n"
564 : "=r" (lz)
565 : "r" (x));
566
567 return 31 - lz;
568 }
569
570 BUG_ON(sizeof(x) != 8);
571
572 __asm__ (
573 " .set push \n"
574 " .set mips64 \n"
575 " dclz %0, %1 \n"
576 " .set pop \n"
577 : "=r" (lz)
578 : "r" (x));
579
580 return 63 - lz;
581}
582
583/*
584 * __ffs - find first bit in word.
527 * @word: The word to search 585 * @word: The word to search
528 * 586 *
529 * Undefined if no zero exists, so code should check against ~0UL first. 587 * Returns 0..SZLONG-1
588 * Undefined if no bit exists, so code should check against 0 first.
530 */ 589 */
531static inline unsigned long ffz(unsigned long word) 590static inline unsigned long __ffs(unsigned long word)
532{ 591{
592#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
593 return __ilog2(word & -word);
594#else
533 int b = 0, s; 595 int b = 0, s;
534 596
535 word = ~word;
536#ifdef CONFIG_32BIT 597#ifdef CONFIG_32BIT
537 s = 16; if (word << 16 != 0) s = 0; b += s; word >>= s; 598 s = 16; if (word << 16 != 0) s = 0; b += s; word >>= s;
538 s = 8; if (word << 24 != 0) s = 0; b += s; word >>= s; 599 s = 8; if (word << 24 != 0) s = 0; b += s; word >>= s;
539 s = 4; if (word << 28 != 0) s = 0; b += s; word >>= s; 600 s = 4; if (word << 28 != 0) s = 0; b += s; word >>= s;
540 s = 2; if (word << 30 != 0) s = 0; b += s; word >>= s; 601 s = 2; if (word << 30 != 0) s = 0; b += s; word >>= s;
541 s = 1; if (word << 31 != 0) s = 0; b += s; 602 s = 1; if (word << 31 != 0) s = 0; b += s;
603
604 return b;
542#endif 605#endif
543#ifdef CONFIG_64BIT 606#ifdef CONFIG_64BIT
544 s = 32; if (word << 32 != 0) s = 0; b += s; word >>= s; 607 s = 32; if (word << 32 != 0) s = 0; b += s; word >>= s;
@@ -547,27 +610,92 @@ static inline unsigned long ffz(unsigned long word)
547 s = 4; if (word << 60 != 0) s = 0; b += s; word >>= s; 610 s = 4; if (word << 60 != 0) s = 0; b += s; word >>= s;
548 s = 2; if (word << 62 != 0) s = 0; b += s; word >>= s; 611 s = 2; if (word << 62 != 0) s = 0; b += s; word >>= s;
549 s = 1; if (word << 63 != 0) s = 0; b += s; 612 s = 1; if (word << 63 != 0) s = 0; b += s;
550#endif
551 613
552 return b; 614 return b;
615#endif
616#endif
553} 617}
554 618
555/* 619/*
556 * __ffs - find first bit in word. 620 * ffs - find first bit set.
557 * @word: The word to search 621 * @word: The word to search
558 * 622 *
559 * Undefined if no bit exists, so code should check against 0 first. 623 * Returns 1..SZLONG
624 * Returns 0 if no bit exists
560 */ 625 */
561static inline unsigned long __ffs(unsigned long word) 626
627static inline unsigned long ffs(unsigned long word)
562{ 628{
563 return ffz(~word); 629 if (!word)
630 return 0;
631
632 return __ffs(word) + 1;
564} 633}
565 634
566/* 635/*
567 * fls: find last bit set. 636 * ffz - find first zero in word.
637 * @word: The word to search
638 *
639 * Undefined if no zero exists, so code should check against ~0UL first.
640 */
641static inline unsigned long ffz(unsigned long word)
642{
643 return __ffs (~word);
644}
645
646/*
647 * flz - find last zero in word.
648 * @word: The word to search
649 *
650 * Returns 0..SZLONG-1
651 * Undefined if no zero exists, so code should check against ~0UL first.
652 */
653static inline unsigned long flz(unsigned long word)
654{
655#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
656 return __ilog2(~word);
657#else
658#ifdef CONFIG_32BIT
659 int r = 31, s;
660 word = ~word;
661 s = 16; if ((word & 0xffff0000)) s = 0; r -= s; word <<= s;
662 s = 8; if ((word & 0xff000000)) s = 0; r -= s; word <<= s;
663 s = 4; if ((word & 0xf0000000)) s = 0; r -= s; word <<= s;
664 s = 2; if ((word & 0xc0000000)) s = 0; r -= s; word <<= s;
665 s = 1; if ((word & 0x80000000)) s = 0; r -= s;
666
667 return r;
668#endif
669#ifdef CONFIG_64BIT
670 int r = 63, s;
671 word = ~word;
672 s = 32; if ((word & 0xffffffff00000000UL)) s = 0; r -= s; word <<= s;
673 s = 16; if ((word & 0xffff000000000000UL)) s = 0; r -= s; word <<= s;
674 s = 8; if ((word & 0xff00000000000000UL)) s = 0; r -= s; word <<= s;
675 s = 4; if ((word & 0xf000000000000000UL)) s = 0; r -= s; word <<= s;
676 s = 2; if ((word & 0xc000000000000000UL)) s = 0; r -= s; word <<= s;
677 s = 1; if ((word & 0x8000000000000000UL)) s = 0; r -= s;
678
679 return r;
680#endif
681#endif
682}
683
684/*
685 * fls - find last bit set.
686 * @word: The word to search
687 *
688 * Returns 1..SZLONG
689 * Returns 0 if no bit exists
568 */ 690 */
691static inline unsigned long fls(unsigned long word)
692{
693 if (word == 0)
694 return 0;
695
696 return flz(~word) + 1;
697}
569 698
570#define fls(x) generic_fls(x)
571 699
572/* 700/*
573 * find_next_zero_bit - find the first zero bit in a memory region 701 * find_next_zero_bit - find the first zero bit in a memory region
@@ -704,17 +832,6 @@ static inline int sched_find_first_bit(const unsigned long *b)
704} 832}
705 833
706/* 834/*
707 * ffs - find first bit set
708 * @x: the word to search
709 *
710 * This is defined the same way as
711 * the libc and compiler builtin ffs routines, therefore
712 * differs in spirit from the above ffz (man ffs).
713 */
714
715#define ffs(x) generic_ffs(x)
716
717/*
718 * hweightN - returns the hamming weight of a N-bit word 835 * hweightN - returns the hamming weight of a N-bit word
719 * @x: the word to weigh 836 * @x: the word to weigh
720 * 837 *
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
index b1e57d783604..14fc88f27226 100644
--- a/include/asm-mips/bootinfo.h
+++ b/include/asm-mips/bootinfo.h
@@ -77,6 +77,7 @@
77#define MACH_SGI_IP27 1 /* Origin 200, Origin 2000, Onyx 2 */ 77#define MACH_SGI_IP27 1 /* Origin 200, Origin 2000, Onyx 2 */
78#define MACH_SGI_IP28 2 /* Indigo2 Impact */ 78#define MACH_SGI_IP28 2 /* Indigo2 Impact */
79#define MACH_SGI_IP32 3 /* O2 */ 79#define MACH_SGI_IP32 3 /* O2 */
80#define MACH_SGI_IP30 4 /* Octane, Octane2 */
80 81
81/* 82/*
82 * Valid machtype for group COBALT 83 * Valid machtype for group COBALT
@@ -136,6 +137,7 @@
136#define MACH_GROUP_PHILIPS 14 137#define MACH_GROUP_PHILIPS 14
137#define MACH_PHILIPS_NINO 0 /* Nino */ 138#define MACH_PHILIPS_NINO 0 /* Nino */
138#define MACH_PHILIPS_VELO 1 /* Velo */ 139#define MACH_PHILIPS_VELO 1 /* Velo */
140#define MACH_PHILIPS_JBS 2 /* JBS */
139 141
140/* 142/*
141 * Valid machtype for group Globespan 143 * Valid machtype for group Globespan
@@ -159,6 +161,7 @@
159#define MACH_TOSHIBA_JMR3927 3 /* JMR-TX3927 CPU/IO board */ 161#define MACH_TOSHIBA_JMR3927 3 /* JMR-TX3927 CPU/IO board */
160#define MACH_TOSHIBA_RBTX4927 4 162#define MACH_TOSHIBA_RBTX4927 4
161#define MACH_TOSHIBA_RBTX4937 5 163#define MACH_TOSHIBA_RBTX4937 5
164#define MACH_TOSHIBA_RBTX4938 6
162 165
163#define GROUP_TOSHIBA_NAMES { "Pallas", "TopasCE", "JMR", "JMR TX3927", \ 166#define GROUP_TOSHIBA_NAMES { "Pallas", "TopasCE", "JMR", "JMR TX3927", \
164 "RBTX4927", "RBTX4937" } 167 "RBTX4927", "RBTX4937" }
@@ -177,6 +180,8 @@
177#define MACH_MTX1 7 /* 4G MTX-1 Au1500-based board */ 180#define MACH_MTX1 7 /* 4G MTX-1 Au1500-based board */
178#define MACH_PB1550 8 /* Au1550-based eval board */ 181#define MACH_PB1550 8 /* Au1550-based eval board */
179#define MACH_DB1550 9 /* Au1550-based eval board */ 182#define MACH_DB1550 9 /* Au1550-based eval board */
183#define MACH_PB1200 10 /* Au1200-based eval board */
184#define MACH_DB1200 11 /* Au1200-based eval board */
180 185
181/* 186/*
182 * Valid machtype for group NEC_VR41XX 187 * Valid machtype for group NEC_VR41XX
diff --git a/include/asm-mips/break.h b/include/asm-mips/break.h
index 2e6de788f207..25b980c91e7e 100644
--- a/include/asm-mips/break.h
+++ b/include/asm-mips/break.h
@@ -28,6 +28,7 @@
28#define BRK_NORLD 10 /* No rld found - not used by Linux/MIPS */ 28#define BRK_NORLD 10 /* No rld found - not used by Linux/MIPS */
29#define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */ 29#define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */
30#define BRK_BUG 512 /* Used by BUG() */ 30#define BRK_BUG 512 /* Used by BUG() */
31#define BRK_KDB 513 /* Used in KDB_ENTER() */
31#define BRK_MULOVF 1023 /* Multiply overflow */ 32#define BRK_MULOVF 1023 /* Multiply overflow */
32 33
33#endif /* __ASM_BREAK_H */ 34#endif /* __ASM_BREAK_H */
diff --git a/include/asm-mips/bug.h b/include/asm-mips/bug.h
index 3f594b440abc..87d49a5bdc63 100644
--- a/include/asm-mips/bug.h
+++ b/include/asm-mips/bug.h
@@ -1,16 +1,21 @@
1#ifndef __ASM_BUG_H 1#ifndef __ASM_BUG_H
2#define __ASM_BUG_H 2#define __ASM_BUG_H
3 3
4#include <asm/break.h> 4#include <linux/config.h>
5 5
6#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
7#define HAVE_ARCH_BUG 7
8#include <asm/break.h>
9
8#define BUG() \ 10#define BUG() \
9do { \ 11do { \
10 __asm__ __volatile__("break %0" : : "i" (BRK_BUG)); \ 12 __asm__ __volatile__("break %0" : : "i" (BRK_BUG)); \
11} while (0) 13} while (0)
14
15#define HAVE_ARCH_BUG
16
12#endif 17#endif
13 18
14#include <asm-generic/bug.h> 19#include <asm-generic/bug.h>
15 20
16#endif 21#endif /* __ASM_BUG_H */
diff --git a/include/asm-mips/bugs.h b/include/asm-mips/bugs.h
index b14b961c2100..cb2ea7c15c7a 100644
--- a/include/asm-mips/bugs.h
+++ b/include/asm-mips/bugs.h
@@ -8,12 +8,18 @@
8#define _ASM_BUGS_H 8#define _ASM_BUGS_H
9 9
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/delay.h>
12#include <asm/cpu.h>
13#include <asm/cpu-info.h>
11 14
12extern void check_bugs32(void); 15extern void check_bugs32(void);
13extern void check_bugs64(void); 16extern void check_bugs64(void);
14 17
15static inline void check_bugs(void) 18static inline void check_bugs(void)
16{ 19{
20 unsigned int cpu = smp_processor_id();
21
22 cpu_data[cpu].udelay_val = loops_per_jiffy;
17 check_bugs32(); 23 check_bugs32();
18#ifdef CONFIG_64BIT 24#ifdef CONFIG_64BIT
19 check_bugs64(); 25 check_bugs64();
diff --git a/include/asm-mips/cache.h b/include/asm-mips/cache.h
index 4517bdf20953..1a5d1a669db3 100644
--- a/include/asm-mips/cache.h
+++ b/include/asm-mips/cache.h
@@ -10,6 +10,7 @@
10#define _ASM_CACHE_H 10#define _ASM_CACHE_H
11 11
12#include <linux/config.h> 12#include <linux/config.h>
13#include <kmalloc.h>
13 14
14#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT 15#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT
15#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 16#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
@@ -18,6 +19,4 @@
18#define SMP_CACHE_SHIFT L1_CACHE_SHIFT 19#define SMP_CACHE_SHIFT L1_CACHE_SHIFT
19#define SMP_CACHE_BYTES L1_CACHE_BYTES 20#define SMP_CACHE_BYTES L1_CACHE_BYTES
20 21
21#define ARCH_KMALLOC_MINALIGN 8
22
23#endif /* _ASM_CACHE_H */ 22#endif /* _ASM_CACHE_H */
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index 635f1bfb403e..a18ba2edc0b6 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -49,17 +49,29 @@ static inline void flush_dcache_page(struct page *page)
49 49
50extern void (*flush_icache_page)(struct vm_area_struct *vma, 50extern void (*flush_icache_page)(struct vm_area_struct *vma,
51 struct page *page); 51 struct page *page);
52extern void (*flush_icache_range)(unsigned long start, unsigned long end); 52extern void (*flush_icache_range)(unsigned long __user start,
53 unsigned long __user end);
53#define flush_cache_vmap(start, end) flush_cache_all() 54#define flush_cache_vmap(start, end) flush_cache_all()
54#define flush_cache_vunmap(start, end) flush_cache_all() 55#define flush_cache_vunmap(start, end) flush_cache_all()
55 56
56#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 57static inline void copy_to_user_page(struct vm_area_struct *vma,
57do { \ 58 struct page *page, unsigned long vaddr, void *dst, const void *src,
58 memcpy(dst, (void *) src, len); \ 59 unsigned long len)
59 flush_icache_page(vma, page); \ 60{
60} while (0) 61 if (cpu_has_dc_aliases)
61#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 62 flush_cache_page(vma, vaddr, page_to_pfn(page));
62 memcpy(dst, src, len) 63 memcpy(dst, src, len);
64 flush_icache_page(vma, page);
65}
66
67static inline void copy_from_user_page(struct vm_area_struct *vma,
68 struct page *page, unsigned long vaddr, void *dst, const void *src,
69 unsigned long len)
70{
71 if (cpu_has_dc_aliases)
72 flush_cache_page(vma, vaddr, page_to_pfn(page));
73 memcpy(dst, src, len);
74}
63 75
64extern void (*flush_cache_sigtramp)(unsigned long addr); 76extern void (*flush_cache_sigtramp)(unsigned long addr);
65extern void (*flush_icache_all)(void); 77extern void (*flush_icache_all)(void);
@@ -78,4 +90,7 @@ extern void (*flush_data_cache_page)(unsigned long addr);
78#define ClearPageDcacheDirty(page) \ 90#define ClearPageDcacheDirty(page) \
79 clear_bit(PG_dcache_dirty, &(page)->flags) 91 clear_bit(PG_dcache_dirty, &(page)->flags)
80 92
93/* Run kernel code uncached, useful for cache probing functions. */
94unsigned long __init run_uncached(void *func);
95
81#endif /* _ASM_CACHEFLUSH_H */ 96#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
index c1ea5a8714f3..b09f8971e95d 100644
--- a/include/asm-mips/checksum.h
+++ b/include/asm-mips/checksum.h
@@ -34,8 +34,9 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum);
34 * this is a new version of the above that records errors it finds in *errp, 34 * this is a new version of the above that records errors it finds in *errp,
35 * but continues and zeros the rest of the buffer. 35 * but continues and zeros the rest of the buffer.
36 */ 36 */
37unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int len, 37unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
38 unsigned int sum, int *errp); 38 unsigned char *dst, int len,
39 unsigned int sum, int *errp);
39 40
40/* 41/*
41 * Copy and checksum to user 42 * Copy and checksum to user
@@ -70,14 +71,15 @@ unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *
70static inline unsigned short int csum_fold(unsigned int sum) 71static inline unsigned short int csum_fold(unsigned int sum)
71{ 72{
72 __asm__( 73 __asm__(
73 ".set\tnoat\t\t\t# csum_fold\n\t" 74 " .set push # csum_fold\n"
74 "sll\t$1,%0,16\n\t" 75 " .set noat \n"
75 "addu\t%0,$1\n\t" 76 " sll $1, %0, 16 \n"
76 "sltu\t$1,%0,$1\n\t" 77 " addu %0, $1 \n"
77 "srl\t%0,%0,16\n\t" 78 " sltu $1, %0, $1 \n"
78 "addu\t%0,$1\n\t" 79 " srl %0, %0, 16 \n"
79 "xori\t%0,0xffff\n\t" 80 " addu %0, $1 \n"
80 ".set\tat" 81 " xori %0, 0xffff \n"
82 " .set pop"
81 : "=r" (sum) 83 : "=r" (sum)
82 : "0" (sum)); 84 : "0" (sum));
83 85
@@ -127,29 +129,30 @@ static inline unsigned int csum_tcpudp_nofold(unsigned long saddr,
127 unsigned int sum) 129 unsigned int sum)
128{ 130{
129 __asm__( 131 __asm__(
130 ".set\tnoat\t\t\t# csum_tcpudp_nofold\n\t" 132 " .set push # csum_tcpudp_nofold\n"
133 " .set noat \n"
131#ifdef CONFIG_32BIT 134#ifdef CONFIG_32BIT
132 "addu\t%0, %2\n\t" 135 " addu %0, %2 \n"
133 "sltu\t$1, %0, %2\n\t" 136 " sltu $1, %0, %2 \n"
134 "addu\t%0, $1\n\t" 137 " addu %0, $1 \n"
135 138
136 "addu\t%0, %3\n\t" 139 " addu %0, %3 \n"
137 "sltu\t$1, %0, %3\n\t" 140 " sltu $1, %0, %3 \n"
138 "addu\t%0, $1\n\t" 141 " addu %0, $1 \n"
139 142
140 "addu\t%0, %4\n\t" 143 " addu %0, %4 \n"
141 "sltu\t$1, %0, %4\n\t" 144 " sltu $1, %0, %4 \n"
142 "addu\t%0, $1\n\t" 145 " addu %0, $1 \n"
143#endif 146#endif
144#ifdef CONFIG_64BIT 147#ifdef CONFIG_64BIT
145 "daddu\t%0, %2\n\t" 148 " daddu %0, %2 \n"
146 "daddu\t%0, %3\n\t" 149 " daddu %0, %3 \n"
147 "daddu\t%0, %4\n\t" 150 " daddu %0, %4 \n"
148 "dsll32\t$1, %0, 0\n\t" 151 " dsll32 $1, %0, 0 \n"
149 "daddu\t%0, $1\n\t" 152 " daddu %0, $1 \n"
150 "dsrl32\t%0, %0, 0\n\t" 153 " dsra32 %0, %0, 0 \n"
151#endif 154#endif
152 ".set\tat" 155 " .set pop"
153 : "=r" (sum) 156 : "=r" (sum)
154 : "0" (daddr), "r"(saddr), 157 : "0" (daddr), "r"(saddr),
155#ifdef __MIPSEL__ 158#ifdef __MIPSEL__
@@ -192,57 +195,57 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
192 unsigned int sum) 195 unsigned int sum)
193{ 196{
194 __asm__( 197 __asm__(
195 ".set\tpush\t\t\t# csum_ipv6_magic\n\t" 198 " .set push # csum_ipv6_magic\n"
196 ".set\tnoreorder\n\t" 199 " .set noreorder \n"
197 ".set\tnoat\n\t" 200 " .set noat \n"
198 "addu\t%0, %5\t\t\t# proto (long in network byte order)\n\t" 201 " addu %0, %5 # proto (long in network byte order)\n"
199 "sltu\t$1, %0, %5\n\t" 202 " sltu $1, %0, %5 \n"
200 "addu\t%0, $1\n\t" 203 " addu %0, $1 \n"
201 204
202 "addu\t%0, %6\t\t\t# csum\n\t" 205 " addu %0, %6 # csum\n"
203 "sltu\t$1, %0, %6\n\t" 206 " sltu $1, %0, %6 \n"
204 "lw\t%1, 0(%2)\t\t\t# four words source address\n\t" 207 " lw %1, 0(%2) # four words source address\n"
205 "addu\t%0, $1\n\t" 208 " addu %0, $1 \n"
206 "addu\t%0, %1\n\t" 209 " addu %0, %1 \n"
207 "sltu\t$1, %0, %1\n\t" 210 " sltu $1, %0, %1 \n"
208 211
209 "lw\t%1, 4(%2)\n\t" 212 " lw %1, 4(%2) \n"
210 "addu\t%0, $1\n\t" 213 " addu %0, $1 \n"
211 "addu\t%0, %1\n\t" 214 " addu %0, %1 \n"
212 "sltu\t$1, %0, %1\n\t" 215 " sltu $1, %0, %1 \n"
213 216
214 "lw\t%1, 8(%2)\n\t" 217 " lw %1, 8(%2) \n"
215 "addu\t%0, $1\n\t" 218 " addu %0, $1 \n"
216 "addu\t%0, %1\n\t" 219 " addu %0, %1 \n"
217 "sltu\t$1, %0, %1\n\t" 220 " sltu $1, %0, %1 \n"
218 221
219 "lw\t%1, 12(%2)\n\t" 222 " lw %1, 12(%2) \n"
220 "addu\t%0, $1\n\t" 223 " addu %0, $1 \n"
221 "addu\t%0, %1\n\t" 224 " addu %0, %1 \n"
222 "sltu\t$1, %0, %1\n\t" 225 " sltu $1, %0, %1 \n"
223 226
224 "lw\t%1, 0(%3)\n\t" 227 " lw %1, 0(%3) \n"
225 "addu\t%0, $1\n\t" 228 " addu %0, $1 \n"
226 "addu\t%0, %1\n\t" 229 " addu %0, %1 \n"
227 "sltu\t$1, %0, %1\n\t" 230 " sltu $1, %0, %1 \n"
228 231
229 "lw\t%1, 4(%3)\n\t" 232 " lw %1, 4(%3) \n"
230 "addu\t%0, $1\n\t" 233 " addu %0, $1 \n"
231 "addu\t%0, %1\n\t" 234 " addu %0, %1 \n"
232 "sltu\t$1, %0, %1\n\t" 235 " sltu $1, %0, %1 \n"
233 236
234 "lw\t%1, 8(%3)\n\t" 237 " lw %1, 8(%3) \n"
235 "addu\t%0, $1\n\t" 238 " addu %0, $1 \n"
236 "addu\t%0, %1\n\t" 239 " addu %0, %1 \n"
237 "sltu\t$1, %0, %1\n\t" 240 " sltu $1, %0, %1 \n"
238 241
239 "lw\t%1, 12(%3)\n\t" 242 " lw %1, 12(%3) \n"
240 "addu\t%0, $1\n\t" 243 " addu %0, $1 \n"
241 "addu\t%0, %1\n\t" 244 " addu %0, %1 \n"
242 "sltu\t$1, %0, %1\n\t" 245 " sltu $1, %0, %1 \n"
243 246
244 "addu\t%0, $1\t\t\t# Add final carry\n\t" 247 " addu %0, $1 # Add final carry\n"
245 ".set\tpop" 248 " .set pop"
246 : "=r" (sum), "=r" (proto) 249 : "=r" (sum), "=r" (proto)
247 : "r" (saddr), "r" (daddr), 250 : "r" (saddr), "r" (daddr),
248 "0" (htonl(len)), "1" (htonl(proto)), "r" (sum)); 251 "0" (htonl(len)), "1" (htonl(proto)), "r" (sum));
diff --git a/include/asm-mips/cobalt/cobalt.h b/include/asm-mips/cobalt/cobalt.h
index ca1fbc0579fe..78e1df2095fb 100644
--- a/include/asm-mips/cobalt/cobalt.h
+++ b/include/asm-mips/cobalt/cobalt.h
@@ -19,18 +19,23 @@
19 * 9 - PCI 19 * 9 - PCI
20 * 14 - IDE0 20 * 14 - IDE0
21 * 15 - IDE1 21 * 15 - IDE1
22 * 22 */
23#define COBALT_QUBE_SLOT_IRQ 9
24
25/*
23 * CPU IRQs are 16 ... 23 26 * CPU IRQs are 16 ... 23
24 */ 27 */
25#define COBALT_TIMER_IRQ 18 28#define COBALT_CPU_IRQ 16
26#define COBALT_SCC_IRQ 19 /* pre-production has 85C30 */ 29
27#define COBALT_RAQ_SCSI_IRQ 19 30#define COBALT_GALILEO_IRQ (COBALT_CPU_IRQ + 2)
28#define COBALT_ETH0_IRQ 19 31#define COBALT_SCC_IRQ (COBALT_CPU_IRQ + 3) /* pre-production has 85C30 */
29#define COBALT_ETH1_IRQ 20 32#define COBALT_RAQ_SCSI_IRQ (COBALT_CPU_IRQ + 3)
30#define COBALT_SERIAL_IRQ 21 33#define COBALT_ETH0_IRQ (COBALT_CPU_IRQ + 3)
31#define COBALT_SCSI_IRQ 21 34#define COBALT_QUBE1_ETH0_IRQ (COBALT_CPU_IRQ + 4)
32#define COBALT_VIA_IRQ 22 /* Chained to VIA ISA bridge */ 35#define COBALT_ETH1_IRQ (COBALT_CPU_IRQ + 4)
33#define COBALT_QUBE_SLOT_IRQ 23 36#define COBALT_SERIAL_IRQ (COBALT_CPU_IRQ + 5)
37#define COBALT_SCSI_IRQ (COBALT_CPU_IRQ + 5)
38#define COBALT_VIA_IRQ (COBALT_CPU_IRQ + 6) /* Chained to VIA ISA bridge */
34 39
35/* 40/*
36 * PCI configuration space manifest constants. These are wired into 41 * PCI configuration space manifest constants. These are wired into
@@ -69,16 +74,21 @@
69 * Most of this really should go into a separate GT64111 header file. 74 * Most of this really should go into a separate GT64111 header file.
70 */ 75 */
71#define GT64111_IO_BASE 0x10000000UL 76#define GT64111_IO_BASE 0x10000000UL
77#define GT64111_IO_END 0x11ffffffUL
78#define GT64111_MEM_BASE 0x12000000UL
79#define GT64111_MEM_END 0x13ffffffUL
72#define GT64111_BASE 0x14000000UL 80#define GT64111_BASE 0x14000000UL
73#define GALILEO_REG(ofs) (KSEG0 + GT64111_BASE + (unsigned long)(ofs)) 81#define GALILEO_REG(ofs) CKSEG1ADDR(GT64111_BASE + (unsigned long)(ofs))
74 82
75#define GALILEO_INL(port) (*(volatile unsigned int *) GALILEO_REG(port)) 83#define GALILEO_INL(port) (*(volatile unsigned int *) GALILEO_REG(port))
76#define GALILEO_OUTL(val, port) \ 84#define GALILEO_OUTL(val, port) \
77do { \ 85do { \
78 *(volatile unsigned int *) GALILEO_REG(port) = (port); \ 86 *(volatile unsigned int *) GALILEO_REG(port) = (val); \
79} while (0) 87} while (0)
80 88
81#define GALILEO_T0EXP 0x0100 89#define GALILEO_INTR_T0EXP (1 << 8)
90#define GALILEO_INTR_RETRY_CTR (1 << 20)
91
82#define GALILEO_ENTC0 0x01 92#define GALILEO_ENTC0 0x01
83#define GALILEO_SELTC0 0x02 93#define GALILEO_SELTC0 0x02
84 94
@@ -86,5 +96,21 @@ do { \
86 GALILEO_OUTL((0x80000000 | (PCI_SLOT (devfn) << 11) | \ 96 GALILEO_OUTL((0x80000000 | (PCI_SLOT (devfn) << 11) | \
87 (PCI_FUNC (devfn) << 8) | (where)), GT_PCI0_CFGADDR_OFS) 97 (PCI_FUNC (devfn) << 8) | (where)), GT_PCI0_CFGADDR_OFS)
88 98
99#define COBALT_LED_PORT (*(volatile unsigned char *) CKSEG1ADDR(0x1c000000))
100# define COBALT_LED_BAR_LEFT (1 << 0) /* Qube */
101# define COBALT_LED_BAR_RIGHT (1 << 1) /* Qube */
102# define COBALT_LED_WEB (1 << 2) /* RaQ */
103# define COBALT_LED_POWER_OFF (1 << 3) /* RaQ */
104# define COBALT_LED_RESET 0x0f
105
106#define COBALT_KEY_PORT ((~*(volatile unsigned int *) CKSEG1ADDR(0x1d000000) >> 24) & COBALT_KEY_MASK)
107# define COBALT_KEY_CLEAR (1 << 1)
108# define COBALT_KEY_LEFT (1 << 2)
109# define COBALT_KEY_UP (1 << 3)
110# define COBALT_KEY_DOWN (1 << 4)
111# define COBALT_KEY_RIGHT (1 << 5)
112# define COBALT_KEY_ENTER (1 << 6)
113# define COBALT_KEY_SELECT (1 << 7)
114# define COBALT_KEY_MASK 0xfe
89 115
90#endif /* __ASM_COBALT_H */ 116#endif /* __ASM_COBALT_H */
diff --git a/include/asm-mips/cobalt/mach-gt64120.h b/include/asm-mips/cobalt/mach-gt64120.h
new file mode 100644
index 000000000000..587fc4378f44
--- /dev/null
+++ b/include/asm-mips/cobalt/mach-gt64120.h
@@ -0,0 +1 @@
/* there's something here ... in the dark */
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
index 2c084cd4bc0a..35d2604fe69c 100644
--- a/include/asm-mips/compat.h
+++ b/include/asm-mips/compat.h
@@ -15,10 +15,10 @@ typedef s32 compat_clock_t;
15typedef s32 compat_suseconds_t; 15typedef s32 compat_suseconds_t;
16 16
17typedef s32 compat_pid_t; 17typedef s32 compat_pid_t;
18typedef u32 __compat_uid_t; 18typedef s32 __compat_uid_t;
19typedef u32 __compat_gid_t; 19typedef s32 __compat_gid_t;
20typedef u32 __compat_uid32_t; 20typedef __compat_uid_t __compat_uid32_t;
21typedef u32 __compat_gid32_t; 21typedef __compat_gid_t __compat_gid32_t;
22typedef u32 compat_mode_t; 22typedef u32 compat_mode_t;
23typedef u32 compat_ino_t; 23typedef u32 compat_ino_t;
24typedef u32 compat_dev_t; 24typedef u32 compat_dev_t;
@@ -54,8 +54,8 @@ struct compat_stat {
54 compat_ino_t st_ino; 54 compat_ino_t st_ino;
55 compat_mode_t st_mode; 55 compat_mode_t st_mode;
56 compat_nlink_t st_nlink; 56 compat_nlink_t st_nlink;
57 __compat_uid32_t st_uid; 57 __compat_uid_t st_uid;
58 __compat_gid32_t st_gid; 58 __compat_gid_t st_gid;
59 compat_dev_t st_rdev; 59 compat_dev_t st_rdev;
60 s32 st_pad2[2]; 60 s32 st_pad2[2];
61 compat_off_t st_size; 61 compat_off_t st_size;
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index 9a2de642eee6..03627cfb3e45 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -4,6 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle 6 * Copyright (C) 2003, 2004 Ralf Baechle
7 * Copyright (C) 2004 Maciej W. Rozycki
7 */ 8 */
8#ifndef __ASM_CPU_FEATURES_H 9#ifndef __ASM_CPU_FEATURES_H
9#define __ASM_CPU_FEATURES_H 10#define __ASM_CPU_FEATURES_H
@@ -24,8 +25,19 @@
24#ifndef cpu_has_4kex 25#ifndef cpu_has_4kex
25#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX) 26#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX)
26#endif 27#endif
27#ifndef cpu_has_4ktlb 28#ifndef cpu_has_3k_cache
28#define cpu_has_4ktlb (cpu_data[0].options & MIPS_CPU_4KTLB) 29#define cpu_has_3k_cache (cpu_data[0].options & MIPS_CPU_3K_CACHE)
30#endif
31#define cpu_has_6k_cache 0
32#define cpu_has_8k_cache 0
33#ifndef cpu_has_4k_cache
34#define cpu_has_4k_cache (cpu_data[0].options & MIPS_CPU_4K_CACHE)
35#endif
36#ifndef cpu_has_tx39_cache
37#define cpu_has_tx39_cache (cpu_data[0].options & MIPS_CPU_TX39_CACHE)
38#endif
39#ifndef cpu_has_sb1_cache
40#define cpu_has_sb1_cache (cpu_data[0].options & MIPS_CPU_SB1_CACHE)
29#endif 41#endif
30#ifndef cpu_has_fpu 42#ifndef cpu_has_fpu
31#define cpu_has_fpu (cpu_data[0].options & MIPS_CPU_FPU) 43#define cpu_has_fpu (cpu_data[0].options & MIPS_CPU_FPU)
@@ -39,9 +51,6 @@
39#ifndef cpu_has_watch 51#ifndef cpu_has_watch
40#define cpu_has_watch (cpu_data[0].options & MIPS_CPU_WATCH) 52#define cpu_has_watch (cpu_data[0].options & MIPS_CPU_WATCH)
41#endif 53#endif
42#ifndef cpu_has_mips16
43#define cpu_has_mips16 (cpu_data[0].options & MIPS_CPU_MIPS16)
44#endif
45#ifndef cpu_has_divec 54#ifndef cpu_has_divec
46#define cpu_has_divec (cpu_data[0].options & MIPS_CPU_DIVEC) 55#define cpu_has_divec (cpu_data[0].options & MIPS_CPU_DIVEC)
47#endif 56#endif
@@ -66,6 +75,18 @@
66#ifndef cpu_has_llsc 75#ifndef cpu_has_llsc
67#define cpu_has_llsc (cpu_data[0].options & MIPS_CPU_LLSC) 76#define cpu_has_llsc (cpu_data[0].options & MIPS_CPU_LLSC)
68#endif 77#endif
78#ifndef cpu_has_mips16
79#define cpu_has_mips16 (cpu_data[0].ases & MIPS_ASE_MIPS16)
80#endif
81#ifndef cpu_has_mdmx
82#define cpu_has_mdmx (cpu_data[0].ases & MIPS_ASE_MDMX)
83#endif
84#ifndef cpu_has_mips3d
85#define cpu_has_mips3d (cpu_data[0].ases & MIPS_ASE_MIPS3D)
86#endif
87#ifndef cpu_has_smartmips
88#define cpu_has_smartmips (cpu_data[0].ases & MIPS_ASE_SMARTMIPS)
89#endif
69#ifndef cpu_has_vtag_icache 90#ifndef cpu_has_vtag_icache
70#define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG) 91#define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG)
71#endif 92#endif
@@ -95,15 +116,16 @@
95#endif 116#endif
96#endif 117#endif
97 118
98/* 119#ifndef cpu_has_dsp
99 * Certain CPUs may throw bizarre exceptions if not the whole cacheline 120#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP)
100 * contains valid instructions. For these we ensure proper alignment of 121#endif
101 * signal trampolines and pad them to the size of a full cache lines with 122
102 * nops. This is also used in structure definitions so can't be a test macro 123#ifdef CONFIG_MIPS_MT
103 * like the others. 124#ifndef cpu_has_mipsmt
104 */ 125# define cpu_has_mipsmt (cpu_data[0].ases & MIPS_ASE_MIPSMT)
105#ifndef PLAT_TRAMPOLINE_STUFF_LINE 126#endif
106#define PLAT_TRAMPOLINE_STUFF_LINE 0UL 127#else
128# define cpu_has_mipsmt 0
107#endif 129#endif
108 130
109#ifdef CONFIG_32BIT 131#ifdef CONFIG_32BIT
@@ -142,6 +164,22 @@
142# endif 164# endif
143#endif 165#endif
144 166
167#ifdef CONFIG_CPU_MIPSR2
168# if defined(CONFIG_CPU_MIPSR2_IRQ_VI) && !defined(cpu_has_vint)
169# define cpu_has_vint (cpu_data[0].options & MIPS_CPU_VINT)
170# else
171# define cpu_has_vint 0
172# endif
173# if defined(CONFIG_CPU_MIPSR2_IRQ_EI) && !defined(cpu_has_veic)
174# define cpu_has_veic (cpu_data[0].options & MIPS_CPU_VEIC)
175# else
176# define cpu_has_veic 0
177# endif
178#else
179# define cpu_has_vint 0
180# define cpu_has_veic 0
181#endif
182
145#ifndef cpu_has_subset_pcaches 183#ifndef cpu_has_subset_pcaches
146#define cpu_has_subset_pcaches (cpu_data[0].options & MIPS_CPU_SUBSET_CACHES) 184#define cpu_has_subset_pcaches (cpu_data[0].options & MIPS_CPU_SUBSET_CACHES)
147#endif 185#endif
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index 20a35b15a31d..d5cf519f8fcc 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -7,6 +7,7 @@
7 * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 Ralf Baechle 7 * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 Ralf Baechle
8 * Copyright (C) 1996 Paul M. Antoine 8 * Copyright (C) 1996 Paul M. Antoine
9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 * Copyright (C) 2004 Maciej W. Rozycki
10 */ 11 */
11#ifndef __ASM_CPU_INFO_H 12#ifndef __ASM_CPU_INFO_H
12#define __ASM_CPU_INFO_H 13#define __ASM_CPU_INFO_H
@@ -61,6 +62,7 @@ struct cpuinfo_mips {
61 * Capability and feature descriptor structure for MIPS CPU 62 * Capability and feature descriptor structure for MIPS CPU
62 */ 63 */
63 unsigned long options; 64 unsigned long options;
65 unsigned long ases;
64 unsigned int processor_id; 66 unsigned int processor_id;
65 unsigned int fpu_id; 67 unsigned int fpu_id;
66 unsigned int cputype; 68 unsigned int cputype;
diff --git a/include/asm-mips/cpu.h b/include/asm-mips/cpu.h
index dec060b49556..48eac296060f 100644
--- a/include/asm-mips/cpu.h
+++ b/include/asm-mips/cpu.h
@@ -3,6 +3,7 @@
3 * various MIPS cpu types. 3 * various MIPS cpu types.
4 * 4 *
5 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) 5 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
6 * Copyright (C) 2004 Maciej W. Rozycki
6 */ 7 */
7#ifndef _ASM_CPU_H 8#ifndef _ASM_CPU_H
8#define _ASM_CPU_H 9#define _ASM_CPU_H
@@ -22,12 +23,17 @@
22 spec. 23 spec.
23*/ 24*/
24 25
25#define PRID_COMP_LEGACY 0x000000 26#define PRID_COMP_LEGACY 0x000000
26#define PRID_COMP_MIPS 0x010000 27#define PRID_COMP_MIPS 0x010000
27#define PRID_COMP_BROADCOM 0x020000 28#define PRID_COMP_BROADCOM 0x020000
28#define PRID_COMP_ALCHEMY 0x030000 29#define PRID_COMP_ALCHEMY 0x030000
29#define PRID_COMP_SIBYTE 0x040000 30#define PRID_COMP_SIBYTE 0x040000
30#define PRID_COMP_SANDCRAFT 0x050000 31#define PRID_COMP_SANDCRAFT 0x050000
32#define PRID_COMP_PHILIPS 0x060000
33#define PRID_COMP_TOSHIBA 0x070000
34#define PRID_COMP_LSI 0x080000
35#define PRID_COMP_LEXRA 0x0b0000
36
31 37
32/* 38/*
33 * Assigned values for the product ID register. In order to detect a 39 * Assigned values for the product ID register. In order to detect a
@@ -46,6 +52,7 @@
46#define PRID_IMP_VR41XX 0x0c00 52#define PRID_IMP_VR41XX 0x0c00
47#define PRID_IMP_R12000 0x0e00 53#define PRID_IMP_R12000 0x0e00
48#define PRID_IMP_R8000 0x1000 54#define PRID_IMP_R8000 0x1000
55#define PRID_IMP_PR4450 0x1200
49#define PRID_IMP_R4600 0x2000 56#define PRID_IMP_R4600 0x2000
50#define PRID_IMP_R4700 0x2100 57#define PRID_IMP_R4700 0x2100
51#define PRID_IMP_TX39 0x2200 58#define PRID_IMP_TX39 0x2200
@@ -60,6 +67,13 @@
60#define PRID_IMP_RM9000 0x3400 67#define PRID_IMP_RM9000 0x3400
61#define PRID_IMP_R5432 0x5400 68#define PRID_IMP_R5432 0x5400
62#define PRID_IMP_R5500 0x5500 69#define PRID_IMP_R5500 0x5500
70
71#define PRID_IMP_UNKNOWN 0xff00
72
73/*
74 * These are the PRID's for when 23:16 == PRID_COMP_MIPS
75 */
76
63#define PRID_IMP_4KC 0x8000 77#define PRID_IMP_4KC 0x8000
64#define PRID_IMP_5KC 0x8100 78#define PRID_IMP_5KC 0x8100
65#define PRID_IMP_20KC 0x8200 79#define PRID_IMP_20KC 0x8200
@@ -71,14 +85,15 @@
71#define PRID_IMP_4KEMPR2 0x9100 85#define PRID_IMP_4KEMPR2 0x9100
72#define PRID_IMP_4KSD 0x9200 86#define PRID_IMP_4KSD 0x9200
73#define PRID_IMP_24K 0x9300 87#define PRID_IMP_24K 0x9300
74 88#define PRID_IMP_34K 0x9500
75#define PRID_IMP_UNKNOWN 0xff00 89#define PRID_IMP_24KE 0x9600
76 90
77/* 91/*
78 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE 92 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
79 */ 93 */
80 94
81#define PRID_IMP_SB1 0x0100 95#define PRID_IMP_SB1 0x0100
96#define PRID_IMP_SB1A 0x1100
82 97
83/* 98/*
84 * These are the PRID's for when 23:16 == PRID_COMP_SANDCRAFT 99 * These are the PRID's for when 23:16 == PRID_COMP_SANDCRAFT
@@ -177,7 +192,11 @@
177#define CPU_VR4133 56 192#define CPU_VR4133 56
178#define CPU_AU1550 57 193#define CPU_AU1550 57
179#define CPU_24K 58 194#define CPU_24K 58
180#define CPU_LAST 58 195#define CPU_AU1200 59
196#define CPU_34K 60
197#define CPU_PR4450 61
198#define CPU_SB1A 62
199#define CPU_LAST 62
181 200
182/* 201/*
183 * ISA Level encodings 202 * ISA Level encodings
@@ -200,23 +219,37 @@
200 * CPU Option encodings 219 * CPU Option encodings
201 */ 220 */
202#define MIPS_CPU_TLB 0x00000001 /* CPU has TLB */ 221#define MIPS_CPU_TLB 0x00000001 /* CPU has TLB */
203/* Leave a spare bit for variant MMU types... */ 222#define MIPS_CPU_4KEX 0x00000002 /* "R4K" exception model */
204#define MIPS_CPU_4KEX 0x00000004 /* "R4K" exception model */ 223#define MIPS_CPU_3K_CACHE 0x00000004 /* R3000-style caches */
205#define MIPS_CPU_4KTLB 0x00000008 /* "R4K" TLB handler */ 224#define MIPS_CPU_4K_CACHE 0x00000008 /* R4000-style caches */
206#define MIPS_CPU_FPU 0x00000010 /* CPU has FPU */ 225#define MIPS_CPU_TX39_CACHE 0x00000010 /* TX3900-style caches */
207#define MIPS_CPU_32FPR 0x00000020 /* 32 dbl. prec. FP registers */ 226#define MIPS_CPU_SB1_CACHE 0x00000020 /* SB1-style caches */
208#define MIPS_CPU_COUNTER 0x00000040 /* Cycle count/compare */ 227#define MIPS_CPU_FPU 0x00000040 /* CPU has FPU */
209#define MIPS_CPU_WATCH 0x00000080 /* watchpoint registers */ 228#define MIPS_CPU_32FPR 0x00000080 /* 32 dbl. prec. FP registers */
210#define MIPS_CPU_MIPS16 0x00000100 /* code compression */ 229#define MIPS_CPU_COUNTER 0x00000100 /* Cycle count/compare */
211#define MIPS_CPU_DIVEC 0x00000200 /* dedicated interrupt vector */ 230#define MIPS_CPU_WATCH 0x00000200 /* watchpoint registers */
212#define MIPS_CPU_VCE 0x00000400 /* virt. coherence conflict possible */ 231#define MIPS_CPU_DIVEC 0x00000400 /* dedicated interrupt vector */
213#define MIPS_CPU_CACHE_CDEX_P 0x00000800 /* Create_Dirty_Exclusive CACHE op */ 232#define MIPS_CPU_VCE 0x00000800 /* virt. coherence conflict possible */
214#define MIPS_CPU_CACHE_CDEX_S 0x00001000 /* ... same for seconary cache ... */ 233#define MIPS_CPU_CACHE_CDEX_P 0x00001000 /* Create_Dirty_Exclusive CACHE op */
215#define MIPS_CPU_MCHECK 0x00002000 /* Machine check exception */ 234#define MIPS_CPU_CACHE_CDEX_S 0x00002000 /* ... same for seconary cache ... */
216#define MIPS_CPU_EJTAG 0x00004000 /* EJTAG exception */ 235#define MIPS_CPU_MCHECK 0x00004000 /* Machine check exception */
217#define MIPS_CPU_NOFPUEX 0x00008000 /* no FPU exception */ 236#define MIPS_CPU_EJTAG 0x00008000 /* EJTAG exception */
218#define MIPS_CPU_LLSC 0x00010000 /* CPU has ll/sc instructions */ 237#define MIPS_CPU_NOFPUEX 0x00010000 /* no FPU exception */
219#define MIPS_CPU_SUBSET_CACHES 0x00020000 /* P-cache subset enforced */ 238#define MIPS_CPU_LLSC 0x00020000 /* CPU has ll/sc instructions */
220#define MIPS_CPU_PREFETCH 0x00040000 /* CPU has usable prefetch */ 239#define MIPS_CPU_SUBSET_CACHES 0x00040000 /* P-cache subset enforced */
240#define MIPS_CPU_PREFETCH 0x00080000 /* CPU has usable prefetch */
241#define MIPS_CPU_VINT 0x00100000 /* CPU supports MIPSR2 vectored interrupts */
242#define MIPS_CPU_VEIC 0x00200000 /* CPU supports MIPSR2 external interrupt controller mode */
243
244/*
245 * CPU ASE encodings
246 */
247#define MIPS_ASE_MIPS16 0x00000001 /* code compression */
248#define MIPS_ASE_MDMX 0x00000002 /* MIPS digital media extension */
249#define MIPS_ASE_MIPS3D 0x00000004 /* MIPS-3D */
250#define MIPS_ASE_SMARTMIPS 0x00000008 /* SmartMIPS */
251#define MIPS_ASE_DSP 0x00000010 /* Signal Processing ASE */
252#define MIPS_ASE_MIPSMT 0x00000020 /* CPU supports MIPS MT */
253
221 254
222#endif /* _ASM_CPU_H */ 255#endif /* _ASM_CPU_H */
diff --git a/include/asm-mips/dec/ecc.h b/include/asm-mips/dec/ecc.h
index 724908b0bf13..19495a490e72 100644
--- a/include/asm-mips/dec/ecc.h
+++ b/include/asm-mips/dec/ecc.h
@@ -49,7 +49,8 @@ struct pt_regs;
49 49
50extern void dec_ecc_be_init(void); 50extern void dec_ecc_be_init(void);
51extern int dec_ecc_be_handler(struct pt_regs *regs, int is_fixup); 51extern int dec_ecc_be_handler(struct pt_regs *regs, int is_fixup);
52extern irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id, struct pt_regs *regs); 52extern irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id,
53 struct pt_regs *regs);
53#endif 54#endif
54 55
55#endif /* __ASM_MIPS_DEC_ECC_H */ 56#endif /* __ASM_MIPS_DEC_ECC_H */
diff --git a/include/asm-mips/dec/ioasic_addrs.h b/include/asm-mips/dec/ioasic_addrs.h
index 5e18a7510592..4cbc1f8a1129 100644
--- a/include/asm-mips/dec/ioasic_addrs.h
+++ b/include/asm-mips/dec/ioasic_addrs.h
@@ -45,7 +45,8 @@
45 45
46 46
47/* 47/*
48 * Offsets for I/O ASIC registers (relative to (system_base + IOASIC_IOCTL)). 48 * Offsets for I/O ASIC registers
49 * (relative to (dec_kn_slot_base + IOASIC_IOCTL)).
49 */ 50 */
50 /* all systems */ 51 /* all systems */
51#define IO_REG_SCSI_DMA_P 0x00 /* SCSI DMA Pointer */ 52#define IO_REG_SCSI_DMA_P 0x00 /* SCSI DMA Pointer */
diff --git a/include/asm-mips/dec/kn01.h b/include/asm-mips/dec/kn01.h
index 946943502f83..eb522aa1e226 100644
--- a/include/asm-mips/dec/kn01.h
+++ b/include/asm-mips/dec/kn01.h
@@ -8,14 +8,12 @@
8 * 8 *
9 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions 9 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
10 * are by courtesy of Chris Fraser. 10 * are by courtesy of Chris Fraser.
11 * Copyright (C) 2002, 2003 Maciej W. Rozycki 11 * Copyright (C) 2002, 2003, 2005 Maciej W. Rozycki
12 */ 12 */
13#ifndef __ASM_MIPS_DEC_KN01_H 13#ifndef __ASM_MIPS_DEC_KN01_H
14#define __ASM_MIPS_DEC_KN01_H 14#define __ASM_MIPS_DEC_KN01_H
15 15
16#include <asm/addrspace.h> 16#define KN01_SLOT_BASE 0x10000000
17
18#define KN01_SLOT_BASE KSEG1ADDR(0x10000000)
19#define KN01_SLOT_SIZE 0x01000000 17#define KN01_SLOT_SIZE 0x01000000
20 18
21/* 19/*
@@ -41,17 +39,9 @@
41 39
42 40
43/* 41/*
44 * Some port addresses...
45 */
46#define KN01_LANCE_BASE (KN01_SLOT_BASE + KN01_LANCE) /* 0xB8000000 */
47#define KN01_DZ11_BASE (KN01_SLOT_BASE + KN01_DZ11) /* 0xBC000000 */
48#define KN01_RTC_BASE (KN01_SLOT_BASE + KN01_RTC) /* 0xBD000000 */
49
50
51/*
52 * Frame buffer memory address. 42 * Frame buffer memory address.
53 */ 43 */
54#define KN01_VFB_MEM KSEG1ADDR(0x0fc00000) 44#define KN01_VFB_MEM 0x0fc00000
55 45
56/* 46/*
57 * CPU interrupt bits. 47 * CPU interrupt bits.
@@ -80,4 +70,22 @@
80#define KN01_CSR_VRGTRB (1<<0) /* red DAC voltage over blue (r/o) */ 70#define KN01_CSR_VRGTRB (1<<0) /* red DAC voltage over blue (r/o) */
81#define KN01_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */ 71#define KN01_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
82 72
73
74#ifndef __ASSEMBLY__
75
76#include <linux/interrupt.h>
77#include <linux/spinlock.h>
78#include <linux/types.h>
79
80struct pt_regs;
81
82extern u16 cached_kn01_csr;
83extern spinlock_t kn01_lock;
84
85extern void dec_kn01_be_init(void);
86extern int dec_kn01_be_handler(struct pt_regs *regs, int is_fixup);
87extern irqreturn_t dec_kn01_be_interrupt(int irq, void *dev_id,
88 struct pt_regs *regs);
89#endif
90
83#endif /* __ASM_MIPS_DEC_KN01_H */ 91#endif /* __ASM_MIPS_DEC_KN01_H */
diff --git a/include/asm-mips/dec/kn02.h b/include/asm-mips/dec/kn02.h
index f797f7045920..8319ad77b250 100644
--- a/include/asm-mips/dec/kn02.h
+++ b/include/asm-mips/dec/kn02.h
@@ -8,21 +8,12 @@
8 * 8 *
9 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions 9 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
10 * are by courtesy of Chris Fraser. 10 * are by courtesy of Chris Fraser.
11 * Copyright (C) 2002, 2003 Maciej W. Rozycki 11 * Copyright (C) 2002, 2003, 2005 Maciej W. Rozycki
12 */ 12 */
13#ifndef __ASM_MIPS_DEC_KN02_H 13#ifndef __ASM_MIPS_DEC_KN02_H
14#define __ASM_MIPS_DEC_KN02_H 14#define __ASM_MIPS_DEC_KN02_H
15 15
16#ifndef __ASSEMBLY__ 16#define KN02_SLOT_BASE 0x1fc00000
17#include <linux/spinlock.h>
18#include <linux/types.h>
19#endif
20
21#include <asm/addrspace.h>
22#include <asm/dec/ecc.h>
23
24
25#define KN02_SLOT_BASE KSEG1ADDR(0x1fc00000)
26#define KN02_SLOT_SIZE 0x00080000 17#define KN02_SLOT_SIZE 0x00080000
27 18
28/* 19/*
@@ -39,22 +30,14 @@
39 30
40 31
41/* 32/*
42 * Some port addresses...
43 */
44#define KN02_DZ11_BASE (KN02_SLOT_BASE + KN02_DZ11) /* DZ11 */
45#define KN02_RTC_BASE (KN02_SLOT_BASE + KN02_RTC) /* RTC */
46#define KN02_CSR_BASE (KN02_SLOT_BASE + KN02_CSR) /* CSR */
47
48
49/*
50 * System Control & Status Register bits. 33 * System Control & Status Register bits.
51 */ 34 */
52#define KN02_CSR_RES_28 (0xf<<28) /* unused */ 35#define KN02_CSR_RES_28 (0xf<<28) /* unused */
53#define KN02_CSR_PSU (1<<27) /* power supply unit warning */ 36#define KN02_CSR_PSU (1<<27) /* power supply unit warning */
54#define KN02_CSR_NVRAM (1<<26) /* ~NVRAM clear jumper */ 37#define KN02_CSR_NVRAM (1<<26) /* ~NVRAM clear jumper */
55#define KN02_CSR_REFEVEN (1<<25) /* mem refresh bank toggle */ 38#define KN02_CSR_REFEVEN (1<<25) /* mem refresh bank toggle */
56#define KN03_CSR_NRMOD (1<<24) /* ~NRMOD manufact. jumper */ 39#define KN02_CSR_NRMOD (1<<24) /* ~NRMOD manufact. jumper */
57#define KN03_CSR_IOINTEN (0xff<<16) /* IRQ mask bits */ 40#define KN02_CSR_IOINTEN (0xff<<16) /* IRQ mask bits */
58#define KN02_CSR_DIAGCHK (1<<15) /* diagn/norml ECC reads */ 41#define KN02_CSR_DIAGCHK (1<<15) /* diagn/norml ECC reads */
59#define KN02_CSR_DIAGGEN (1<<14) /* diagn/norml ECC writes */ 42#define KN02_CSR_DIAGGEN (1<<14) /* diagn/norml ECC writes */
60#define KN02_CSR_CORRECT (1<<13) /* ECC correct/check */ 43#define KN02_CSR_CORRECT (1<<13) /* ECC correct/check */
@@ -63,8 +46,8 @@
63#define KN02_CSR_BNK32M (1<<10) /* 32M/8M stride */ 46#define KN02_CSR_BNK32M (1<<10) /* 32M/8M stride */
64#define KN02_CSR_DIAGDN (1<<9) /* DIAGDN manufact. jumper */ 47#define KN02_CSR_DIAGDN (1<<9) /* DIAGDN manufact. jumper */
65#define KN02_CSR_BAUD38 (1<<8) /* DZ11 38/19kbps ext. rate */ 48#define KN02_CSR_BAUD38 (1<<8) /* DZ11 38/19kbps ext. rate */
66#define KN03_CSR_IOINT (0xff<<0) /* IRQ status bits (r/o) */ 49#define KN02_CSR_IOINT (0xff<<0) /* IRQ status bits (r/o) */
67#define KN03_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */ 50#define KN02_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
68 51
69 52
70/* 53/*
@@ -98,6 +81,10 @@
98 81
99 82
100#ifndef __ASSEMBLY__ 83#ifndef __ASSEMBLY__
84
85#include <linux/spinlock.h>
86#include <linux/types.h>
87
101extern u32 cached_kn02_csr; 88extern u32 cached_kn02_csr;
102extern spinlock_t kn02_lock; 89extern spinlock_t kn02_lock;
103extern void init_kn02_irqs(int base); 90extern void init_kn02_irqs(int base);
diff --git a/include/asm-mips/dec/kn02xa.h b/include/asm-mips/dec/kn02xa.h
index 648c4dcbba1d..a25f3d7da7f7 100644
--- a/include/asm-mips/dec/kn02xa.h
+++ b/include/asm-mips/dec/kn02xa.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions 10 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
11 * are by courtesy of Chris Fraser. 11 * are by courtesy of Chris Fraser.
12 * Copyright (C) 2000, 2002, 2003 Maciej W. Rozycki 12 * Copyright (C) 2000, 2002, 2003, 2005 Maciej W. Rozycki
13 * 13 *
14 * These are addresses which have to be known early in the boot process. 14 * These are addresses which have to be known early in the boot process.
15 * For other addresses refer to tc.h, ioasic_addrs.h and friends. 15 * For other addresses refer to tc.h, ioasic_addrs.h and friends.
@@ -17,31 +17,23 @@
17#ifndef __ASM_MIPS_DEC_KN02XA_H 17#ifndef __ASM_MIPS_DEC_KN02XA_H
18#define __ASM_MIPS_DEC_KN02XA_H 18#define __ASM_MIPS_DEC_KN02XA_H
19 19
20#include <asm/addrspace.h>
21#include <asm/dec/ioasic_addrs.h> 20#include <asm/dec/ioasic_addrs.h>
22 21
23#define KN02XA_SLOT_BASE KSEG1ADDR(0x1c000000) 22#define KN02XA_SLOT_BASE 0x1c000000
24
25/*
26 * Some port addresses...
27 */
28#define KN02XA_IOASIC_BASE (KN02XA_SLOT_BASE + IOASIC_IOCTL) /* I/O ASIC */
29#define KN02XA_RTC_BASE (KN02XA_SLOT_BASE + IOASIC_TOY) /* RTC */
30
31 23
32/* 24/*
33 * Memory control ASIC registers. 25 * Memory control ASIC registers.
34 */ 26 */
35#define KN02XA_MER KSEG1ADDR(0x0c400000) /* memory error register */ 27#define KN02XA_MER 0x0c400000 /* memory error register */
36#define KN02XA_MSR KSEG1ADDR(0x0c800000) /* memory size register */ 28#define KN02XA_MSR 0x0c800000 /* memory size register */
37 29
38/* 30/*
39 * CPU control ASIC registers. 31 * CPU control ASIC registers.
40 */ 32 */
41#define KN02XA_MEM_CONF KSEG1ADDR(0x0e000000) /* write timeout config */ 33#define KN02XA_MEM_CONF 0x0e000000 /* write timeout config */
42#define KN02XA_EAR KSEG1ADDR(0x0e000004) /* error address register */ 34#define KN02XA_EAR 0x0e000004 /* error address register */
43#define KN02XA_BOOT0 KSEG1ADDR(0x0e000008) /* boot 0 register */ 35#define KN02XA_BOOT0 0x0e000008 /* boot 0 register */
44#define KN02XA_MEM_INTR KSEG1ADDR(0x0e00000c) /* write err IRQ stat & ack */ 36#define KN02XA_MEM_INTR 0x0e00000c /* write err IRQ stat & ack */
45 37
46/* 38/*
47 * Memory Error Register bits, common definitions. 39 * Memory Error Register bits, common definitions.
@@ -52,8 +44,13 @@
52#define KN02XA_MER_PAGERR (1<<16) /* 2k page boundary error */ 44#define KN02XA_MER_PAGERR (1<<16) /* 2k page boundary error */
53#define KN02XA_MER_TRANSERR (1<<15) /* transfer length error */ 45#define KN02XA_MER_TRANSERR (1<<15) /* transfer length error */
54#define KN02XA_MER_PARDIS (1<<14) /* parity error disable */ 46#define KN02XA_MER_PARDIS (1<<14) /* parity error disable */
55#define KN02XA_MER_RES_12 (0x3<<12) /* unused */ 47#define KN02XA_MER_SIZE (1<<13) /* r/o mirror of MSR_SIZE */
56#define KN02XA_MER_BYTERR (0xf<<8) /* byte lane error bitmask */ 48#define KN02XA_MER_RES_12 (1<<12) /* unused */
49#define KN02XA_MER_BYTERR (0xf<<8) /* byte lane error bitmask: */
50#define KN02XA_MER_BYTERR_3 (0x8<<8) /* byte lane #3 */
51#define KN02XA_MER_BYTERR_2 (0x4<<8) /* byte lane #2 */
52#define KN02XA_MER_BYTERR_1 (0x2<<8) /* byte lane #1 */
53#define KN02XA_MER_BYTERR_0 (0x1<<8) /* byte lane #0 */
57#define KN02XA_MER_RES_0 (0xff<<0) /* unused */ 54#define KN02XA_MER_RES_0 (0xff<<0) /* unused */
58 55
59/* 56/*
@@ -72,4 +69,17 @@
72#define KN02XA_EAR_ADDRESS (0x7ffffff<<2) /* address involved */ 69#define KN02XA_EAR_ADDRESS (0x7ffffff<<2) /* address involved */
73#define KN02XA_EAR_RES_0 (0x3<<0) /* unused */ 70#define KN02XA_EAR_RES_0 (0x3<<0) /* unused */
74 71
72
73#ifndef __ASSEMBLY__
74
75#include <linux/interrupt.h>
76
77struct pt_regs;
78
79extern void dec_kn02xa_be_init(void);
80extern int dec_kn02xa_be_handler(struct pt_regs *regs, int is_fixup);
81extern irqreturn_t dec_kn02xa_be_interrupt(int irq, void *dev_id,
82 struct pt_regs *regs);
83#endif
84
75#endif /* __ASM_MIPS_DEC_KN02XA_H */ 85#endif /* __ASM_MIPS_DEC_KN02XA_H */
diff --git a/include/asm-mips/dec/kn03.h b/include/asm-mips/dec/kn03.h
index 676abd17c6a4..edede923ffb8 100644
--- a/include/asm-mips/dec/kn03.h
+++ b/include/asm-mips/dec/kn03.h
@@ -10,24 +10,15 @@
10 * 10 *
11 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions 11 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
12 * are by courtesy of Chris Fraser. 12 * are by courtesy of Chris Fraser.
13 * Copyright (C) 2000, 2002, 2003 Maciej W. Rozycki 13 * Copyright (C) 2000, 2002, 2003, 2005 Maciej W. Rozycki
14 */ 14 */
15#ifndef __ASM_MIPS_DEC_KN03_H 15#ifndef __ASM_MIPS_DEC_KN03_H
16#define __ASM_MIPS_DEC_KN03_H 16#define __ASM_MIPS_DEC_KN03_H
17 17
18#include <asm/addrspace.h>
19#include <asm/dec/ecc.h> 18#include <asm/dec/ecc.h>
20#include <asm/dec/ioasic_addrs.h> 19#include <asm/dec/ioasic_addrs.h>
21 20
22#define KN03_SLOT_BASE KSEG1ADDR(0x1f800000) 21#define KN03_SLOT_BASE 0x1f800000
23
24/*
25 * Some port addresses...
26 */
27#define KN03_IOASIC_BASE (KN03_SLOT_BASE + IOASIC_IOCTL) /* I/O ASIC */
28#define KN03_RTC_BASE (KN03_SLOT_BASE + IOASIC_TOY) /* RTC */
29#define KN03_MCR_BASE (KN03_SLOT_BASE + IOASIC_MCR) /* MCR */
30
31 22
32/* 23/*
33 * CPU interrupt bits. 24 * CPU interrupt bits.
diff --git a/include/asm-mips/dec/kn05.h b/include/asm-mips/dec/kn05.h
index b120362b8f13..15fe8f881e60 100644
--- a/include/asm-mips/dec/kn05.h
+++ b/include/asm-mips/dec/kn05.h
@@ -1,10 +1,12 @@
1/* 1/*
2 * include/asm-mips/dec/kn05.h 2 * include/asm-mips/dec/kn05.h
3 * 3 *
4 * DECstation 5000/260 (4max+ or KN05) and DECsystem 5900/260 4 * DECstation/DECsystem 5000/260 (4max+ or KN05), 5000/150 (4min
5 * or KN04-BA), Personal DECstation/DECsystem 5000/50 (4maxine or
6 * KN04-CA) and DECsystem 5900/260 (KN05) R4k CPU card MB ASIC
5 * definitions. 7 * definitions.
6 * 8 *
7 * Copyright (C) 2002, 2003 Maciej W. Rozycki 9 * Copyright (C) 2002, 2003, 2005 Maciej W. Rozycki
8 * 10 *
9 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License 12 * modify it under the terms of the GNU General Public License
@@ -13,8 +15,8 @@
13 * 15 *
14 * WARNING! All this information is pure guesswork based on the 16 * WARNING! All this information is pure guesswork based on the
15 * ROM. It is provided here in hope it will give someone some 17 * ROM. It is provided here in hope it will give someone some
16 * food for thought. No documentation for the KN05 module has 18 * food for thought. No documentation for the KN05 nor the KN04
17 * been located so far. 19 * module has been located so far.
18 */ 20 */
19#ifndef __ASM_MIPS_DEC_KN05_H 21#ifndef __ASM_MIPS_DEC_KN05_H
20#define __ASM_MIPS_DEC_KN05_H 22#define __ASM_MIPS_DEC_KN05_H
@@ -24,48 +26,50 @@
24/* 26/*
25 * The oncard MB (Memory Buffer) ASIC provides an additional address 27 * The oncard MB (Memory Buffer) ASIC provides an additional address
26 * decoder. Certain address ranges within the "high" 16 slots are 28 * decoder. Certain address ranges within the "high" 16 slots are
27 * passed to the I/O ASIC's decoder like with the KN03. Others are 29 * passed to the I/O ASIC's decoder like with the KN03 or KN02-BA/CA.
28 * handled locally. "Low" slots are always passed. 30 * Others are handled locally. "Low" slots are always passed.
29 */ 31 */
30#define KN05_MB_ROM (16*IOASIC_SLOT_SIZE) /* KN05 card ROM */ 32#define KN4K_SLOT_BASE 0x1fc00000
31#define KN05_IOCTL (17*IOASIC_SLOT_SIZE) /* I/O ASIC */ 33
32#define KN05_ESAR (18*IOASIC_SLOT_SIZE) /* LANCE MAC address chip */ 34#define KN4K_MB_ROM (0*IOASIC_SLOT_SIZE) /* KN05/KN04 card ROM */
33#define KN05_LANCE (19*IOASIC_SLOT_SIZE) /* LANCE Ethernet */ 35#define KN4K_IOCTL (1*IOASIC_SLOT_SIZE) /* I/O ASIC */
34#define KN05_MB_INT (20*IOASIC_SLOT_SIZE) /* MB interrupt register */ 36#define KN4K_ESAR (2*IOASIC_SLOT_SIZE) /* LANCE MAC address chip */
35#define KN05_MB_EA (21*IOASIC_SLOT_SIZE) /* MB error address? */ 37#define KN4K_LANCE (3*IOASIC_SLOT_SIZE) /* LANCE Ethernet */
36#define KN05_MB_EC (22*IOASIC_SLOT_SIZE) /* MB error ??? */ 38#define KN4K_MB_INT (4*IOASIC_SLOT_SIZE) /* MB interrupt register */
37#define KN05_MB_CSR (23*IOASIC_SLOT_SIZE) /* MB control & status */ 39#define KN4K_MB_EA (5*IOASIC_SLOT_SIZE) /* MB error address? */
38#define KN05_RES_24 (24*IOASIC_SLOT_SIZE) /* unused? */ 40#define KN4K_MB_EC (6*IOASIC_SLOT_SIZE) /* MB error ??? */
39#define KN05_RES_25 (25*IOASIC_SLOT_SIZE) /* unused? */ 41#define KN4K_MB_CSR (7*IOASIC_SLOT_SIZE) /* MB control & status */
40#define KN05_RES_26 (26*IOASIC_SLOT_SIZE) /* unused? */ 42#define KN4K_RES_08 (8*IOASIC_SLOT_SIZE) /* unused? */
41#define KN05_RES_27 (27*IOASIC_SLOT_SIZE) /* unused? */ 43#define KN4K_RES_09 (9*IOASIC_SLOT_SIZE) /* unused? */
42#define KN05_SCSI (28*IOASIC_SLOT_SIZE) /* ASC SCSI */ 44#define KN4K_RES_10 (10*IOASIC_SLOT_SIZE) /* unused? */
43#define KN05_RES_29 (29*IOASIC_SLOT_SIZE) /* unused? */ 45#define KN4K_RES_11 (11*IOASIC_SLOT_SIZE) /* unused? */
44#define KN05_RES_30 (30*IOASIC_SLOT_SIZE) /* unused? */ 46#define KN4K_SCSI (12*IOASIC_SLOT_SIZE) /* ASC SCSI */
45#define KN05_RES_31 (31*IOASIC_SLOT_SIZE) /* unused? */ 47#define KN4K_RES_13 (13*IOASIC_SLOT_SIZE) /* unused? */
48#define KN4K_RES_14 (14*IOASIC_SLOT_SIZE) /* unused? */
49#define KN4K_RES_15 (15*IOASIC_SLOT_SIZE) /* unused? */
46 50
47/* 51/*
48 * Bits for the MB interrupt register. 52 * Bits for the MB interrupt register.
49 * The register appears read-only. 53 * The register appears read-only.
50 */ 54 */
51#define KN05_MB_INT_TC (1<<0) /* TURBOchannel? */ 55#define KN4K_MB_INT_TC (1<<0) /* TURBOchannel? */
52#define KN05_MB_INT_RTC (1<<1) /* RTC? */ 56#define KN4K_MB_INT_RTC (1<<1) /* RTC? */
53#define KN05_MB_INT_MT (1<<3) /* ??? */ 57#define KN4K_MB_INT_MT (1<<3) /* ??? */
54 58
55/* 59/*
56 * Bits for the MB control & status register. 60 * Bits for the MB control & status register.
57 * Set to 0x00bf8001 on my system by the ROM. 61 * Set to 0x00bf8001 on my system by the ROM.
58 */ 62 */
59#define KN05_MB_CSR_PF (1<<0) /* PreFetching enable? */ 63#define KN4K_MB_CSR_PF (1<<0) /* PreFetching enable? */
60#define KN05_MB_CSR_F (1<<1) /* ??? */ 64#define KN4K_MB_CSR_F (1<<1) /* ??? */
61#define KN05_MB_CSR_ECC (0xff<<2) /* ??? */ 65#define KN4K_MB_CSR_ECC (0xff<<2) /* ??? */
62#define KN05_MB_CSR_OD (1<<10) /* ??? */ 66#define KN4K_MB_CSR_OD (1<<10) /* ??? */
63#define KN05_MB_CSR_CP (1<<11) /* ??? */ 67#define KN4K_MB_CSR_CP (1<<11) /* ??? */
64#define KN05_MB_CSR_UNC (1<<12) /* ??? */ 68#define KN4K_MB_CSR_UNC (1<<12) /* ??? */
65#define KN05_MB_CSR_IM (1<<13) /* ??? */ 69#define KN4K_MB_CSR_IM (1<<13) /* ??? */
66#define KN05_MB_CSR_NC (1<<14) /* ??? */ 70#define KN4K_MB_CSR_NC (1<<14) /* ??? */
67#define KN05_MB_CSR_EE (1<<15) /* (bus) Exception Enable? */ 71#define KN4K_MB_CSR_EE (1<<15) /* (bus) Exception Enable? */
68#define KN05_MB_CSR_MSK (0x1f<<16) /* ??? */ 72#define KN4K_MB_CSR_MSK (0x1f<<16) /* ??? */
69#define KN05_MB_CSR_FW (1<<21) /* ??? */ 73#define KN4K_MB_CSR_FW (1<<21) /* ??? */
70 74
71#endif /* __ASM_MIPS_DEC_KN05_H */ 75#endif /* __ASM_MIPS_DEC_KN05_H */
diff --git a/include/asm-mips/dec/prom.h b/include/asm-mips/dec/prom.h
index a05d6d3395fe..1384dd0964b9 100644
--- a/include/asm-mips/dec/prom.h
+++ b/include/asm-mips/dec/prom.h
@@ -24,7 +24,7 @@
24 * PMAX/3MAX PROM entry points for DS2100/3100's and DS5000/2xx's. 24 * PMAX/3MAX PROM entry points for DS2100/3100's and DS5000/2xx's.
25 * Many of these will work for MIPSen as well! 25 * Many of these will work for MIPSen as well!
26 */ 26 */
27#define VEC_RESET (u64 *)KSEG1ADDR(0x1fc00000) 27#define VEC_RESET (u64 *)CKSEG1ADDR(0x1fc00000)
28 /* Prom base address */ 28 /* Prom base address */
29 29
30#define PMAX_PROM_ENTRY(x) (VEC_RESET + (x)) /* Prom jump table */ 30#define PMAX_PROM_ENTRY(x) (VEC_RESET + (x)) /* Prom jump table */
@@ -111,19 +111,21 @@ extern int (*__pmax_close)(int);
111 * On MIPS64 we have to call PROM functions via a helper 111 * On MIPS64 we have to call PROM functions via a helper
112 * dispatcher to accomodate ABI incompatibilities. 112 * dispatcher to accomodate ABI incompatibilities.
113 */ 113 */
114#define __DEC_PROM_O32 __attribute__((alias("call_o32"))) 114#define __DEC_PROM_O32(fun, arg) fun arg __asm__(#fun); \
115 115 __asm__(#fun " = call_o32")
116int _rex_bootinit(int (*)(void)) __DEC_PROM_O32; 116
117int _rex_bootread(int (*)(void)) __DEC_PROM_O32; 117int __DEC_PROM_O32(_rex_bootinit, (int (*)(void)));
118int _rex_getbitmap(int (*)(memmap *), memmap *) __DEC_PROM_O32; 118int __DEC_PROM_O32(_rex_bootread, (int (*)(void)));
119unsigned long *_rex_slot_address(unsigned long *(*)(int), int) __DEC_PROM_O32; 119int __DEC_PROM_O32(_rex_getbitmap, (int (*)(memmap *), memmap *));
120void *_rex_gettcinfo(void *(*)(void)) __DEC_PROM_O32; 120unsigned long *__DEC_PROM_O32(_rex_slot_address,
121int _rex_getsysid(int (*)(void)) __DEC_PROM_O32; 121 (unsigned long *(*)(int), int));
122void _rex_clear_cache(void (*)(void)) __DEC_PROM_O32; 122void *__DEC_PROM_O32(_rex_gettcinfo, (void *(*)(void)));
123 123int __DEC_PROM_O32(_rex_getsysid, (int (*)(void)));
124int _prom_getchar(int (*)(void)) __DEC_PROM_O32; 124void __DEC_PROM_O32(_rex_clear_cache, (void (*)(void)));
125char *_prom_getenv(char *(*)(char *), char *) __DEC_PROM_O32; 125
126int _prom_printf(int (*)(char *, ...), char *, ...) __DEC_PROM_O32; 126int __DEC_PROM_O32(_prom_getchar, (int (*)(void)));
127char *__DEC_PROM_O32(_prom_getenv, (char *(*)(char *), char *));
128int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), char *, ...));
127 129
128 130
129#define rex_bootinit() _rex_bootinit(__rex_bootinit) 131#define rex_bootinit() _rex_bootinit(__rex_bootinit)
diff --git a/include/asm-mips/dec/system.h b/include/asm-mips/dec/system.h
new file mode 100644
index 000000000000..78af51fbc797
--- /dev/null
+++ b/include/asm-mips/dec/system.h
@@ -0,0 +1,18 @@
1/*
2 * include/asm-mips/dec/system.h
3 *
4 * Generic DECstation/DECsystem bits.
5 *
6 * Copyright (C) 2005 Maciej W. Rozycki
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_DEC_SYSTEM_H
14#define __ASM_DEC_SYSTEM_H
15
16extern unsigned long dec_kn_slot_base, dec_kn_slot_size;
17
18#endif /* __ASM_DEC_SYSTEM_H */
diff --git a/include/asm-mips/dec/tc.h b/include/asm-mips/dec/tc.h
index d7bba43f863a..9cb51f24d42c 100644
--- a/include/asm-mips/dec/tc.h
+++ b/include/asm-mips/dec/tc.h
@@ -7,10 +7,8 @@
7 * 7 *
8 * Copyright (c) 1998 Harald Koerfgen 8 * Copyright (c) 1998 Harald Koerfgen
9 */ 9 */
10#ifndef ASM_TC_H 10#ifndef __ASM_DEC_TC_H
11#define ASM_TC_H 11#define __ASM_DEC_TC_H
12
13extern unsigned long system_base;
14 12
15/* 13/*
16 * Search for a TURBOchannel Option Module 14 * Search for a TURBOchannel Option Module
@@ -36,8 +34,8 @@ extern unsigned long get_tc_base_addr(int);
36 */ 34 */
37extern unsigned long get_tc_irq_nr(int); 35extern unsigned long get_tc_irq_nr(int);
38/* 36/*
39 * Return TURBOchannel clock frequency in hz 37 * Return TURBOchannel clock frequency in Hz
40 */ 38 */
41extern unsigned long get_tc_speed(void); 39extern unsigned long get_tc_speed(void);
42 40
43#endif 41#endif /* __ASM_DEC_TC_H */
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index a606dbee0412..85435a8d4e52 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -12,11 +12,9 @@
12 12
13#include <linux/config.h> 13#include <linux/config.h>
14#include <linux/param.h> 14#include <linux/param.h>
15 15#include <linux/smp.h>
16#include <asm/compiler.h> 16#include <asm/compiler.h>
17 17
18extern unsigned long loops_per_jiffy;
19
20static inline void __delay(unsigned long loops) 18static inline void __delay(unsigned long loops)
21{ 19{
22 if (sizeof(long) == 4) 20 if (sizeof(long) == 4)
@@ -82,11 +80,7 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
82 __delay(usecs); 80 __delay(usecs);
83} 81}
84 82
85#ifdef CONFIG_SMP
86#define __udelay_val cpu_data[smp_processor_id()].udelay_val 83#define __udelay_val cpu_data[smp_processor_id()].udelay_val
87#else
88#define __udelay_val loops_per_jiffy
89#endif
90 84
91#define udelay(usecs) __udelay((usecs),__udelay_val) 85#define udelay(usecs) __udelay((usecs),__udelay_val)
92 86
diff --git a/include/asm-mips/dma-mapping.h b/include/asm-mips/dma-mapping.h
index af28dc88930b..43288634c38a 100644
--- a/include/asm-mips/dma-mapping.h
+++ b/include/asm-mips/dma-mapping.h
@@ -5,13 +5,13 @@
5#include <asm/cache.h> 5#include <asm/cache.h>
6 6
7void *dma_alloc_noncoherent(struct device *dev, size_t size, 7void *dma_alloc_noncoherent(struct device *dev, size_t size,
8 dma_addr_t *dma_handle, int flag); 8 dma_addr_t *dma_handle, gfp_t flag);
9 9
10void dma_free_noncoherent(struct device *dev, size_t size, 10void dma_free_noncoherent(struct device *dev, size_t size,
11 void *vaddr, dma_addr_t dma_handle); 11 void *vaddr, dma_addr_t dma_handle);
12 12
13void *dma_alloc_coherent(struct device *dev, size_t size, 13void *dma_alloc_coherent(struct device *dev, size_t size,
14 dma_addr_t *dma_handle, int flag); 14 dma_addr_t *dma_handle, gfp_t flag);
15 15
16void dma_free_coherent(struct device *dev, size_t size, 16void dma_free_coherent(struct device *dev, size_t size,
17 void *vaddr, dma_addr_t dma_handle); 17 void *vaddr, dma_addr_t dma_handle);
diff --git a/include/asm-mips/dsp.h b/include/asm-mips/dsp.h
new file mode 100644
index 000000000000..50f556bb4978
--- /dev/null
+++ b/include/asm-mips/dsp.h
@@ -0,0 +1,83 @@
1/*
2 * Copyright (C) 2005 Mips Technologies
3 * Author: Chris Dearman, chris@mips.com derived from fpu.h
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#ifndef _ASM_DSP_H
11#define _ASM_DSP_H
12
13#include <asm/cpu.h>
14#include <asm/cpu-features.h>
15#include <asm/hazards.h>
16#include <asm/mipsregs.h>
17
18#define DSP_DEFAULT 0x00000000
19#define DSP_MASK 0x1f
20
21#define __enable_dsp_hazard() \
22do { \
23 asm("_ehb"); \
24} while (0)
25
26static inline void __init_dsp(void)
27{
28 mthi1(0);
29 mtlo1(0);
30 mthi2(0);
31 mtlo2(0);
32 mthi3(0);
33 mtlo3(0);
34 wrdsp(DSP_DEFAULT, DSP_MASK);
35}
36
37static inline void init_dsp(void)
38{
39 if (cpu_has_dsp)
40 __init_dsp();
41}
42
43#define __save_dsp(tsk) \
44do { \
45 tsk->thread.dsp.dspr[0] = mfhi1(); \
46 tsk->thread.dsp.dspr[1] = mflo1(); \
47 tsk->thread.dsp.dspr[2] = mfhi2(); \
48 tsk->thread.dsp.dspr[3] = mflo2(); \
49 tsk->thread.dsp.dspr[4] = mfhi3(); \
50 tsk->thread.dsp.dspr[5] = mflo3(); \
51} while (0)
52
53#define save_dsp(tsk) \
54do { \
55 if (cpu_has_dsp) \
56 __save_dsp(tsk); \
57} while (0)
58
59#define __restore_dsp(tsk) \
60do { \
61 mthi1(tsk->thread.dsp.dspr[0]); \
62 mtlo1(tsk->thread.dsp.dspr[1]); \
63 mthi2(tsk->thread.dsp.dspr[2]); \
64 mtlo2(tsk->thread.dsp.dspr[3]); \
65 mthi3(tsk->thread.dsp.dspr[4]); \
66 mtlo3(tsk->thread.dsp.dspr[5]); \
67} while (0)
68
69#define restore_dsp(tsk) \
70do { \
71 if (cpu_has_dsp) \
72 __restore_dsp(tsk); \
73} while (0)
74
75#define __get_dsp_regs(tsk) \
76({ \
77 if (tsk == current) \
78 __save_dsp(current); \
79 \
80 tsk->thread.dsp.dspr; \
81})
82
83#endif /* _ASM_DSP_H */
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
index e48811440015..7420f12742bb 100644
--- a/include/asm-mips/elf.h
+++ b/include/asm-mips/elf.h
@@ -2,6 +2,8 @@
2 * This file is subject to the terms and conditions of the GNU General Public 2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 *
6 * Much of this is taken from binutils and GNU libc ...
5 */ 7 */
6#ifndef _ASM_ELF_H 8#ifndef _ASM_ELF_H
7#define _ASM_ELF_H 9#define _ASM_ELF_H
@@ -17,6 +19,8 @@
17#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ 19#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
18#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */ 20#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */
19#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */ 21#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */
22#define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32 R2 code. */
23#define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64 R2 code. */
20 24
21/* The ABI of a file. */ 25/* The ABI of a file. */
22#define EF_MIPS_ABI_O32 0x00001000 /* O32 ABI. */ 26#define EF_MIPS_ABI_O32 0x00001000 /* O32 ABI. */
@@ -105,7 +109,11 @@
105#define R_MIPS_LOVENDOR 100 109#define R_MIPS_LOVENDOR 100
106#define R_MIPS_HIVENDOR 127 110#define R_MIPS_HIVENDOR 127
107 111
108#define SHN_MIPS_ACCOMON 0xff00 112#define SHN_MIPS_ACCOMON 0xff00 /* Allocated common symbols */
113#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
114#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
115#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
116#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
109 117
110#define SHT_MIPS_LIST 0x70000000 118#define SHT_MIPS_LIST 0x70000000
111#define SHT_MIPS_CONFLICT 0x70000002 119#define SHT_MIPS_CONFLICT 0x70000002
@@ -193,50 +201,92 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
193 201
194#ifdef __KERNEL__ 202#ifdef __KERNEL__
195 203
204struct mips_abi;
205
206extern struct mips_abi mips_abi;
207extern struct mips_abi mips_abi_32;
208extern struct mips_abi mips_abi_n32;
209
196#ifdef CONFIG_32BIT 210#ifdef CONFIG_32BIT
197 211
198#define SET_PERSONALITY(ex, ibcs2) \ 212#define SET_PERSONALITY(ex, ibcs2) \
199do { \ 213do { \
200 if (ibcs2) \ 214 if (ibcs2) \
201 set_personality(PER_SVR4); \ 215 set_personality(PER_SVR4); \
202 set_personality(PER_LINUX); \ 216 set_personality(PER_LINUX); \
217 \
218 current->thread.abi = &mips_abi; \
203} while (0) 219} while (0)
204 220
205#endif /* CONFIG_32BIT */ 221#endif /* CONFIG_32BIT */
206 222
207#ifdef CONFIG_64BIT 223#ifdef CONFIG_64BIT
208 224
209#define SET_PERSONALITY(ex, ibcs2) \ 225#ifdef CONFIG_MIPS32_N32
210do { current->thread.mflags &= ~MF_ABI_MASK; \ 226#define __SET_PERSONALITY32_N32() \
211 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) { \ 227 do { \
212 if ((((ex).e_flags & EF_MIPS_ABI2) != 0) && \ 228 current->thread.mflags |= MF_N32; \
213 ((ex).e_flags & EF_MIPS_ABI) == 0) \ 229 current->thread.abi = &mips_abi_n32; \
214 current->thread.mflags |= MF_N32; \ 230 } while (0)
215 else \ 231#else
216 current->thread.mflags |= MF_O32; \ 232#define __SET_PERSONALITY32_N32() \
217 } else \ 233 do { } while (0)
218 current->thread.mflags |= MF_N64; \ 234#endif
219 if (ibcs2) \ 235
220 set_personality(PER_SVR4); \ 236#ifdef CONFIG_MIPS32_O32
221 else if (current->personality != PER_LINUX32) \ 237#define __SET_PERSONALITY32_O32() \
222 set_personality(PER_LINUX); \ 238 do { \
239 current->thread.mflags |= MF_O32; \
240 current->thread.abi = &mips_abi_32; \
241 } while (0)
242#else
243#define __SET_PERSONALITY32_O32() \
244 do { } while (0)
245#endif
246
247#ifdef CONFIG_MIPS32_COMPAT
248#define __SET_PERSONALITY32(ex) \
249do { \
250 if ((((ex).e_flags & EF_MIPS_ABI2) != 0) && \
251 ((ex).e_flags & EF_MIPS_ABI) == 0) \
252 __SET_PERSONALITY32_N32(); \
253 else \
254 __SET_PERSONALITY32_O32(); \
255} while (0)
256#else
257#define __SET_PERSONALITY32(ex) do { } while (0)
258#endif
259
260#define SET_PERSONALITY(ex, ibcs2) \
261do { \
262 current->thread.mflags &= ~MF_ABI_MASK; \
263 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
264 __SET_PERSONALITY32(ex); \
265 else { \
266 current->thread.mflags |= MF_N64; \
267 current->thread.abi = &mips_abi; \
268 } \
269 \
270 if (ibcs2) \
271 set_personality(PER_SVR4); \
272 else if (current->personality != PER_LINUX32) \
273 set_personality(PER_LINUX); \
223} while (0) 274} while (0)
224 275
225#endif /* CONFIG_64BIT */ 276#endif /* CONFIG_64BIT */
226 277
227extern void dump_regs(elf_greg_t *, struct pt_regs *regs); 278extern void dump_regs(elf_greg_t *, struct pt_regs *regs);
279extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
228extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); 280extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
229 281
230#define ELF_CORE_COPY_REGS(elf_regs, regs) \ 282#define ELF_CORE_COPY_REGS(elf_regs, regs) \
231 dump_regs((elf_greg_t *)&(elf_regs), regs); 283 dump_regs((elf_greg_t *)&(elf_regs), regs);
284#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
232#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \ 285#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \
233 dump_task_fpu(tsk, elf_fpregs) 286 dump_task_fpu(tsk, elf_fpregs)
234 287
235#endif /* __KERNEL__ */ 288#endif /* __KERNEL__ */
236 289
237/* This one accepts IRIX binaries. */
238#define irix_elf_check_arch(hdr) ((hdr)->e_flags & RHF_SGI_ONLY)
239
240#define USE_ELF_CORE_DUMP 290#define USE_ELF_CORE_DUMP
241#define ELF_EXEC_PAGESIZE PAGE_SIZE 291#define ELF_EXEC_PAGESIZE PAGE_SIZE
242 292
diff --git a/include/asm-mips/errno.h b/include/asm-mips/errno.h
index 3c0d840e4577..9d3e6e7cdb92 100644
--- a/include/asm-mips/errno.h
+++ b/include/asm-mips/errno.h
@@ -119,6 +119,10 @@
119#define EOWNERDEAD 165 /* Owner died */ 119#define EOWNERDEAD 165 /* Owner died */
120#define ENOTRECOVERABLE 166 /* State not recoverable */ 120#define ENOTRECOVERABLE 166 /* State not recoverable */
121 121
122/* for robust mutexes */
123#define EOWNERDEAD 165 /* Owner died */
124#define ENOTRECOVERABLE 166 /* State not recoverable */
125
122#define EDQUOT 1133 /* Quota exceeded */ 126#define EDQUOT 1133 /* Quota exceeded */
123 127
124#ifdef __KERNEL__ 128#ifdef __KERNEL__
diff --git a/include/asm-mips/fcntl.h b/include/asm-mips/fcntl.h
index 06c5d13faf66..43d047a9a6af 100644
--- a/include/asm-mips/fcntl.h
+++ b/include/asm-mips/fcntl.h
@@ -3,11 +3,13 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1995, 96, 97, 98, 99, 2003 Ralf Baechle 6 * Copyright (C) 1995, 96, 97, 98, 99, 2003, 05 Ralf Baechle
7 */ 7 */
8#ifndef _ASM_FCNTL_H 8#ifndef _ASM_FCNTL_H
9#define _ASM_FCNTL_H 9#define _ASM_FCNTL_H
10 10
11#include <linux/config.h>
12
11#define O_APPEND 0x0008 13#define O_APPEND 0x0008
12#define O_SYNC 0x0010 14#define O_SYNC 0x0010
13#define O_NONBLOCK 0x0080 15#define O_NONBLOCK 0x0080
@@ -40,13 +42,13 @@
40 * contain all the same fields as struct flock. 42 * contain all the same fields as struct flock.
41 */ 43 */
42 44
43#ifndef __mips64 45#ifdef CONFIG_32BIT
44 46
45struct flock { 47struct flock {
46 short l_type; 48 short l_type;
47 short l_whence; 49 short l_whence;
48 __kernel_off_t l_start; 50 off_t l_start;
49 __kernel_off_t l_len; 51 off_t l_len;
50 long l_sysid; 52 long l_sysid;
51 __kernel_pid_t l_pid; 53 __kernel_pid_t l_pid;
52 long pad[4]; 54 long pad[4];
@@ -54,13 +56,8 @@ struct flock {
54 56
55#define HAVE_ARCH_STRUCT_FLOCK 57#define HAVE_ARCH_STRUCT_FLOCK
56 58
57#endif 59#endif /* CONFIG_32BIT */
58 60
59#include <asm-generic/fcntl.h> 61#include <asm-generic/fcntl.h>
60 62
61typedef struct flock flock_t;
62#ifndef __mips64
63typedef struct flock64 flock64_t;
64#endif
65
66#endif /* _ASM_FCNTL_H */ 63#endif /* _ASM_FCNTL_H */
diff --git a/include/asm-mips/fixmap.h b/include/asm-mips/fixmap.h
index 26b6a90a690b..73a3028dd9f9 100644
--- a/include/asm-mips/fixmap.h
+++ b/include/asm-mips/fixmap.h
@@ -107,4 +107,11 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
107 return __virt_to_fix(vaddr); 107 return __virt_to_fix(vaddr);
108} 108}
109 109
110/*
111 * Called from pgtable_init()
112 */
113extern void fixrange_init(unsigned long start, unsigned long end,
114 pgd_t *pgd_base);
115
116
110#endif 117#endif
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index ea24e733b1bc..9c828b1f8218 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -80,9 +80,14 @@ do { \
80 80
81#define clear_fpu_owner() clear_thread_flag(TIF_USEDFPU) 81#define clear_fpu_owner() clear_thread_flag(TIF_USEDFPU)
82 82
83static inline int __is_fpu_owner(void)
84{
85 return test_thread_flag(TIF_USEDFPU);
86}
87
83static inline int is_fpu_owner(void) 88static inline int is_fpu_owner(void)
84{ 89{
85 return cpu_has_fpu && test_thread_flag(TIF_USEDFPU); 90 return cpu_has_fpu && __is_fpu_owner();
86} 91}
87 92
88static inline void own_fpu(void) 93static inline void own_fpu(void)
@@ -127,7 +132,7 @@ static inline void restore_fp(struct task_struct *tsk)
127static inline fpureg_t *get_fpu_regs(struct task_struct *tsk) 132static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
128{ 133{
129 if (cpu_has_fpu) { 134 if (cpu_has_fpu) {
130 if ((tsk == current) && is_fpu_owner()) 135 if ((tsk == current) && __is_fpu_owner())
131 _save_fp(current); 136 _save_fp(current);
132 return tsk->thread.fpu.hard.fpr; 137 return tsk->thread.fpu.hard.fpr;
133 } 138 }
diff --git a/include/asm-mips/fpu_emulator.h b/include/asm-mips/fpu_emulator.h
index 46972ae2b95d..16cb4d11dd0b 100644
--- a/include/asm-mips/fpu_emulator.h
+++ b/include/asm-mips/fpu_emulator.h
@@ -23,16 +23,15 @@
23#ifndef _ASM_FPU_EMULATOR_H 23#ifndef _ASM_FPU_EMULATOR_H
24#define _ASM_FPU_EMULATOR_H 24#define _ASM_FPU_EMULATOR_H
25 25
26struct mips_fpu_emulator_private { 26struct mips_fpu_emulator_stats {
27 unsigned int eir; 27 unsigned int emulated;
28 struct { 28 unsigned int loads;
29 unsigned int emulated; 29 unsigned int stores;
30 unsigned int loads; 30 unsigned int cp1ops;
31 unsigned int stores; 31 unsigned int cp1xops;
32 unsigned int cp1ops; 32 unsigned int errors;
33 unsigned int cp1xops;
34 unsigned int errors;
35 } stats;
36}; 33};
37 34
35extern struct mips_fpu_emulator_stats fpuemustats;
36
38#endif /* _ASM_FPU_EMULATOR_H */ 37#endif /* _ASM_FPU_EMULATOR_H */
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
index 9feff4ce1424..2454c44a8f54 100644
--- a/include/asm-mips/futex.h
+++ b/include/asm-mips/futex.h
@@ -3,10 +3,45 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/config.h>
6#include <linux/futex.h> 7#include <linux/futex.h>
7#include <asm/errno.h> 8#include <asm/errno.h>
8#include <asm/uaccess.h> 9#include <asm/uaccess.h>
9 10
11#ifdef CONFIG_SMP
12#define __FUTEX_SMP_SYNC " sync \n"
13#else
14#define __FUTEX_SMP_SYNC
15#endif
16
17#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
18{ \
19 __asm__ __volatile__( \
20 " .set push \n" \
21 " .set noat \n" \
22 " .set mips3 \n" \
23 "1: ll %1, (%3) # __futex_atomic_op1 \n" \
24 " .set mips0 \n" \
25 " " insn " \n" \
26 " .set mips3 \n" \
27 "2: sc $1, (%3) \n" \
28 " beqzl $1, 1b \n" \
29 __FUTEX_SMP_SYNC \
30 "3: \n" \
31 " .set pop \n" \
32 " .set mips0 \n" \
33 " .section .fixup,\"ax\" \n" \
34 "4: li %0, %5 \n" \
35 " j 2b \n" \
36 " .previous \n" \
37 " .section __ex_table,\"a\" \n" \
38 " "__UA_ADDR "\t1b, 4b \n" \
39 " "__UA_ADDR "\t2b, 4b \n" \
40 " .previous \n" \
41 : "=r" (ret), "=r" (oldval) \
42 : "0" (0), "r" (uaddr), "Jr" (oparg), "i" (-EFAULT)); \
43}
44
10static inline int 45static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr) 46futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{ 47{
@@ -25,10 +60,25 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
25 60
26 switch (op) { 61 switch (op) {
27 case FUTEX_OP_SET: 62 case FUTEX_OP_SET:
63 __futex_atomic_op("move $1, %z4", ret, oldval, uaddr, oparg);
64 break;
65
28 case FUTEX_OP_ADD: 66 case FUTEX_OP_ADD:
67 __futex_atomic_op("addu $1, %1, %z4",
68 ret, oldval, uaddr, oparg);
69 break;
29 case FUTEX_OP_OR: 70 case FUTEX_OP_OR:
71 __futex_atomic_op("or $1, %1, %z4",
72 ret, oldval, uaddr, oparg);
73 break;
30 case FUTEX_OP_ANDN: 74 case FUTEX_OP_ANDN:
75 __futex_atomic_op("and $1, %1, %z4",
76 ret, oldval, uaddr, ~oparg);
77 break;
31 case FUTEX_OP_XOR: 78 case FUTEX_OP_XOR:
79 __futex_atomic_op("xor $1, %1, %z4",
80 ret, oldval, uaddr, oparg);
81 break;
32 default: 82 default:
33 ret = -ENOSYS; 83 ret = -ENOSYS;
34 } 84 }
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index f524eaccd5f1..7517189e469f 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -74,7 +74,8 @@
74#define irq_disable_hazard 74#define irq_disable_hazard
75 _ehb 75 _ehb
76 76
77#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) 77#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) || \
78 defined(CONFIG_CPU_SB1)
78 79
79/* 80/*
80 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. 81 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
@@ -107,6 +108,7 @@ __asm__(
107 " .endm \n\t"); 108 " .endm \n\t");
108 109
109#ifdef CONFIG_CPU_RM9000 110#ifdef CONFIG_CPU_RM9000
111
110/* 112/*
111 * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent 113 * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent
112 * use of the JTLB for instructions should not occur for 4 cpu cycles and use 114 * use of the JTLB for instructions should not occur for 4 cpu cycles and use
@@ -124,6 +126,9 @@ __asm__(
124 ".set\tmips32\n\t" \ 126 ".set\tmips32\n\t" \
125 "_ssnop; _ssnop; _ssnop; _ssnop\n\t" \ 127 "_ssnop; _ssnop; _ssnop; _ssnop\n\t" \
126 ".set\tmips0") 128 ".set\tmips0")
129
130#define back_to_back_c0_hazard() do { } while (0)
131
127#else 132#else
128 133
129/* 134/*
@@ -144,15 +149,13 @@ __asm__(
144#endif 149#endif
145 150
146/* 151/*
147 * mtc0->mfc0 hazard 152 * Interrupt enable/disable hazards
148 * The 24K has a 2 cycle mtc0/mfc0 execution hazard. 153 * Some processors have hazards when modifying
149 * It is a MIPS32R2 processor so ehb will clear the hazard. 154 * the status register to change the interrupt state
150 */ 155 */
151 156
152#ifdef CONFIG_CPU_MIPSR2 157#ifdef CONFIG_CPU_MIPSR2
153/* 158
154 * Use a macro for ehb unless explicit support for MIPSR2 is enabled
155 */
156__asm__( 159__asm__(
157 " .macro\tirq_enable_hazard \n\t" 160 " .macro\tirq_enable_hazard \n\t"
158 " _ehb \n\t" 161 " _ehb \n\t"
@@ -160,17 +163,26 @@ __asm__(
160 " \n\t" 163 " \n\t"
161 " .macro\tirq_disable_hazard \n\t" 164 " .macro\tirq_disable_hazard \n\t"
162 " _ehb \n\t" 165 " _ehb \n\t"
166 " .endm \n\t"
167 " \n\t"
168 " .macro\tback_to_back_c0_hazard \n\t"
169 " _ehb \n\t"
163 " .endm"); 170 " .endm");
164 171
165#define irq_enable_hazard() \ 172#define irq_enable_hazard() \
166 __asm__ __volatile__( \ 173 __asm__ __volatile__( \
167 "_ehb\t\t\t\t# irq_enable_hazard") 174 "irq_enable_hazard")
168 175
169#define irq_disable_hazard() \ 176#define irq_disable_hazard() \
170 __asm__ __volatile__( \ 177 __asm__ __volatile__( \
171 "_ehb\t\t\t\t# irq_disable_hazard") 178 "irq_disable_hazard")
179
180#define back_to_back_c0_hazard() \
181 __asm__ __volatile__( \
182 "back_to_back_c0_hazard")
172 183
173#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) 184#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) || \
185 defined(CONFIG_CPU_SB1)
174 186
175/* 187/*
176 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. 188 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
@@ -186,6 +198,8 @@ __asm__(
186#define irq_enable_hazard() do { } while (0) 198#define irq_enable_hazard() do { } while (0)
187#define irq_disable_hazard() do { } while (0) 199#define irq_disable_hazard() do { } while (0)
188 200
201#define back_to_back_c0_hazard() do { } while (0)
202
189#else 203#else
190 204
191/* 205/*
@@ -208,10 +222,32 @@ __asm__(
208#define irq_enable_hazard() do { } while (0) 222#define irq_enable_hazard() do { } while (0)
209#define irq_disable_hazard() \ 223#define irq_disable_hazard() \
210 __asm__ __volatile__( \ 224 __asm__ __volatile__( \
211 "_ssnop; _ssnop; _ssnop;\t\t# irq_disable_hazard") 225 "irq_disable_hazard")
226
227#define back_to_back_c0_hazard() \
228 __asm__ __volatile__( \
229 " .set noreorder \n" \
230 " nop; nop; nop \n" \
231 " .set reorder \n")
212 232
213#endif 233#endif
214 234
235#ifdef CONFIG_CPU_MIPSR2
236#define instruction_hazard() \
237do { \
238__label__ __next; \
239 __asm__ __volatile__( \
240 " jr.hb %0 \n" \
241 : \
242 : "r" (&&__next)); \
243__next: \
244 ; \
245} while (0)
246
247#else
248#define instruction_hazard() do { } while (0)
249#endif
250
215#endif /* __ASSEMBLY__ */ 251#endif /* __ASSEMBLY__ */
216 252
217#endif /* _ASM_HAZARDS_H */ 253#endif /* _ASM_HAZARDS_H */
diff --git a/include/asm-mips/highmem.h b/include/asm-mips/highmem.h
index f49930d947d4..8cf598402492 100644
--- a/include/asm-mips/highmem.h
+++ b/include/asm-mips/highmem.h
@@ -75,6 +75,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
75} 75}
76 76
77static inline void kunmap_atomic(void *kvaddr, enum km_type type) { } 77static inline void kunmap_atomic(void *kvaddr, enum km_type type) { }
78#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))
78 79
79#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 80#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
80 81
@@ -86,6 +87,7 @@ extern void *__kmap(struct page *page);
86extern void __kunmap(struct page *page); 87extern void __kunmap(struct page *page);
87extern void *__kmap_atomic(struct page *page, enum km_type type); 88extern void *__kmap_atomic(struct page *page, enum km_type type);
88extern void __kunmap_atomic(void *kvaddr, enum km_type type); 89extern void __kunmap_atomic(void *kvaddr, enum km_type type);
90extern void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
89extern struct page *__kmap_atomic_to_page(void *ptr); 91extern struct page *__kmap_atomic_to_page(void *ptr);
90 92
91#define kmap __kmap 93#define kmap __kmap
diff --git a/include/asm-mips/inst.h b/include/asm-mips/inst.h
index 6ad517241768..e0745f4ff624 100644
--- a/include/asm-mips/inst.h
+++ b/include/asm-mips/inst.h
@@ -28,7 +28,7 @@ enum major_op {
28 sdl_op, sdr_op, swr_op, cache_op, 28 sdl_op, sdr_op, swr_op, cache_op,
29 ll_op, lwc1_op, lwc2_op, pref_op, 29 ll_op, lwc1_op, lwc2_op, pref_op,
30 lld_op, ldc1_op, ldc2_op, ld_op, 30 lld_op, ldc1_op, ldc2_op, ld_op,
31 sc_op, swc1_op, swc2_op, major_3b_op, /* Opcode 0x3b is unused */ 31 sc_op, swc1_op, swc2_op, rdhwr_op,
32 scd_op, sdc1_op, sdc2_op, sd_op 32 scd_op, sdc1_op, sdc2_op, sd_op
33}; 33};
34 34
@@ -62,10 +62,10 @@ enum rt_op {
62 spimi_op, unused_rt_op_0x05, unused_rt_op_0x06, unused_rt_op_0x07, 62 spimi_op, unused_rt_op_0x05, unused_rt_op_0x06, unused_rt_op_0x07,
63 tgei_op, tgeiu_op, tlti_op, tltiu_op, 63 tgei_op, tgeiu_op, tlti_op, tltiu_op,
64 teqi_op, unused_0x0d_rt_op, tnei_op, unused_0x0f_rt_op, 64 teqi_op, unused_0x0d_rt_op, tnei_op, unused_0x0f_rt_op,
65 bltzal_op, bgezal_op, bltzall_op, bgezall_op 65 bltzal_op, bgezal_op, bltzall_op, bgezall_op,
66 /* 66 rt_op_0x14, rt_op_0x15, rt_op_0x16, rt_op_0x17,
67 * The others (0x14 - 0x1f) are unused. 67 rt_op_0x18, rt_op_0x19, rt_op_0x1a, rt_op_0x1b,
68 */ 68 bposge32_op, rt_op_0x1d, rt_op_0x1e, rt_op_0x1f
69}; 69};
70 70
71/* 71/*
diff --git a/include/asm-mips/interrupt.h b/include/asm-mips/interrupt.h
index e8357f5379fa..a5735761f5e5 100644
--- a/include/asm-mips/interrupt.h
+++ b/include/asm-mips/interrupt.h
@@ -11,20 +11,25 @@
11#ifndef _ASM_INTERRUPT_H 11#ifndef _ASM_INTERRUPT_H
12#define _ASM_INTERRUPT_H 12#define _ASM_INTERRUPT_H
13 13
14#include <linux/config.h>
14#include <asm/hazards.h> 15#include <asm/hazards.h>
15 16
16__asm__ ( 17__asm__ (
17 ".macro\tlocal_irq_enable\n\t" 18 " .macro local_irq_enable \n"
18 ".set\tpush\n\t" 19 " .set push \n"
19 ".set\treorder\n\t" 20 " .set reorder \n"
20 ".set\tnoat\n\t" 21 " .set noat \n"
21 "mfc0\t$1,$12\n\t" 22#ifdef CONFIG_CPU_MIPSR2
22 "ori\t$1,0x1f\n\t" 23 " ei \n"
23 "xori\t$1,0x1e\n\t" 24#else
24 "mtc0\t$1,$12\n\t" 25 " mfc0 $1,$12 \n"
25 "irq_enable_hazard\n\t" 26 " ori $1,0x1f \n"
26 ".set\tpop\n\t" 27 " xori $1,0x1e \n"
27 ".endm"); 28 " mtc0 $1,$12 \n"
29#endif
30 " irq_enable_hazard \n"
31 " .set pop \n"
32 " .endm");
28 33
29static inline void local_irq_enable(void) 34static inline void local_irq_enable(void)
30{ 35{
@@ -43,17 +48,21 @@ static inline void local_irq_enable(void)
43 * no nops at all. 48 * no nops at all.
44 */ 49 */
45__asm__ ( 50__asm__ (
46 ".macro\tlocal_irq_disable\n\t" 51 " .macro local_irq_disable\n"
47 ".set\tpush\n\t" 52 " .set push \n"
48 ".set\tnoat\n\t" 53 " .set noat \n"
49 "mfc0\t$1,$12\n\t" 54#ifdef CONFIG_CPU_MIPSR2
50 "ori\t$1,1\n\t" 55 " di \n"
51 "xori\t$1,1\n\t" 56#else
52 ".set\tnoreorder\n\t" 57 " mfc0 $1,$12 \n"
53 "mtc0\t$1,$12\n\t" 58 " ori $1,1 \n"
54 "irq_disable_hazard\n\t" 59 " xori $1,1 \n"
55 ".set\tpop\n\t" 60 " .set noreorder \n"
56 ".endm"); 61 " mtc0 $1,$12 \n"
62#endif
63 " irq_disable_hazard \n"
64 " .set pop \n"
65 " .endm \n");
57 66
58static inline void local_irq_disable(void) 67static inline void local_irq_disable(void)
59{ 68{
@@ -65,12 +74,12 @@ static inline void local_irq_disable(void)
65} 74}
66 75
67__asm__ ( 76__asm__ (
68 ".macro\tlocal_save_flags flags\n\t" 77 " .macro local_save_flags flags \n"
69 ".set\tpush\n\t" 78 " .set push \n"
70 ".set\treorder\n\t" 79 " .set reorder \n"
71 "mfc0\t\\flags, $12\n\t" 80 " mfc0 \\flags, $12 \n"
72 ".set\tpop\n\t" 81 " .set pop \n"
73 ".endm"); 82 " .endm \n");
74 83
75#define local_save_flags(x) \ 84#define local_save_flags(x) \
76__asm__ __volatile__( \ 85__asm__ __volatile__( \
@@ -78,18 +87,22 @@ __asm__ __volatile__( \
78 : "=r" (x)) 87 : "=r" (x))
79 88
80__asm__ ( 89__asm__ (
81 ".macro\tlocal_irq_save result\n\t" 90 " .macro local_irq_save result \n"
82 ".set\tpush\n\t" 91 " .set push \n"
83 ".set\treorder\n\t" 92 " .set reorder \n"
84 ".set\tnoat\n\t" 93 " .set noat \n"
85 "mfc0\t\\result, $12\n\t" 94#ifdef CONFIG_CPU_MIPSR2
86 "ori\t$1, \\result, 1\n\t" 95 " di \\result \n"
87 "xori\t$1, 1\n\t" 96#else
88 ".set\tnoreorder\n\t" 97 " mfc0 \\result, $12 \n"
89 "mtc0\t$1, $12\n\t" 98 " ori $1, \\result, 1 \n"
90 "irq_disable_hazard\n\t" 99 " xori $1, 1 \n"
91 ".set\tpop\n\t" 100 " .set noreorder \n"
92 ".endm"); 101 " mtc0 $1, $12 \n"
102#endif
103 " irq_disable_hazard \n"
104 " .set pop \n"
105 " .endm \n");
93 106
94#define local_irq_save(x) \ 107#define local_irq_save(x) \
95__asm__ __volatile__( \ 108__asm__ __volatile__( \
@@ -99,19 +112,37 @@ __asm__ __volatile__( \
99 : "memory") 112 : "memory")
100 113
101__asm__ ( 114__asm__ (
102 ".macro\tlocal_irq_restore flags\n\t" 115 " .macro local_irq_restore flags \n"
103 ".set\tnoreorder\n\t" 116 " .set noreorder \n"
104 ".set\tnoat\n\t" 117 " .set noat \n"
105 "mfc0\t$1, $12\n\t" 118#if defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU)
106 "andi\t\\flags, 1\n\t" 119 /*
107 "ori\t$1, 1\n\t" 120 * Slow, but doesn't suffer from a relativly unlikely race
108 "xori\t$1, 1\n\t" 121 * condition we're having since days 1.
109 "or\t\\flags, $1\n\t" 122 */
110 "mtc0\t\\flags, $12\n\t" 123 " beqz \\flags, 1f \n"
111 "irq_disable_hazard\n\t" 124 " di \n"
112 ".set\tat\n\t" 125 " ei \n"
113 ".set\treorder\n\t" 126 "1: \n"
114 ".endm"); 127#elif defined(CONFIG_CPU_MIPSR2)
128 /*
129 * Fast, dangerous. Life is fun, life is good.
130 */
131 " mfc0 $1, $12 \n"
132 " ins $1, \\flags, 0, 1 \n"
133 " mtc0 $1, $12 \n"
134#else
135 " mfc0 $1, $12 \n"
136 " andi \\flags, 1 \n"
137 " ori $1, 1 \n"
138 " xori $1, 1 \n"
139 " or \\flags, $1 \n"
140 " mtc0 \\flags, $12 \n"
141#endif
142 " irq_disable_hazard \n"
143 " .set at \n"
144 " .set reorder \n"
145 " .endm \n");
115 146
116#define local_irq_restore(flags) \ 147#define local_irq_restore(flags) \
117do { \ 148do { \
diff --git a/include/asm-mips/inventory.h b/include/asm-mips/inventory.h
index 4cd36fe98173..92d90f75a636 100644
--- a/include/asm-mips/inventory.h
+++ b/include/asm-mips/inventory.h
@@ -4,6 +4,8 @@
4#ifndef __ASM_INVENTORY_H 4#ifndef __ASM_INVENTORY_H
5#define __ASM_INVENTORY_H 5#define __ASM_INVENTORY_H
6 6
7#include <linux/compiler.h>
8
7typedef struct inventory_s { 9typedef struct inventory_s {
8 struct inventory_s *inv_next; 10 struct inventory_s *inv_next;
9 int inv_class; 11 int inv_class;
@@ -14,7 +16,9 @@ typedef struct inventory_s {
14} inventory_t; 16} inventory_t;
15 17
16extern int inventory_items; 18extern int inventory_items;
17void add_to_inventory (int class, int type, int controller, int unit, int state); 19
18int dump_inventory_to_user (void *userbuf, int size); 20extern void add_to_inventory (int class, int type, int controller, int unit, int state);
21extern int dump_inventory_to_user (void __user *userbuf, int size);
22extern int __init init_inventory(void);
19 23
20#endif /* __ASM_INVENTORY_H */ 24#endif /* __ASM_INVENTORY_H */
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 039845f2e6b0..3061870b7f6c 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -25,7 +25,9 @@
25#include <asm/page.h> 25#include <asm/page.h>
26#include <asm/pgtable-bits.h> 26#include <asm/pgtable-bits.h>
27#include <asm/processor.h> 27#include <asm/processor.h>
28#include <asm/string.h>
28 29
30#include <ioremap.h>
29#include <mangle-port.h> 31#include <mangle-port.h>
30 32
31/* 33/*
@@ -34,7 +36,7 @@
34#undef CONF_SLOWDOWN_IO 36#undef CONF_SLOWDOWN_IO
35 37
36/* 38/*
37 * Raw operations are never swapped in software. Otoh values that raw 39 * Raw operations are never swapped in software. OTOH values that raw
38 * operations are working on may or may not have been swapped by the bus 40 * operations are working on may or may not have been swapped by the bus
39 * hardware. An example use would be for flash memory that's used for 41 * hardware. An example use would be for flash memory that's used for
40 * execute in place. 42 * execute in place.
@@ -43,45 +45,53 @@
43# define __raw_ioswabw(x) (x) 45# define __raw_ioswabw(x) (x)
44# define __raw_ioswabl(x) (x) 46# define __raw_ioswabl(x) (x)
45# define __raw_ioswabq(x) (x) 47# define __raw_ioswabq(x) (x)
48# define ____raw_ioswabq(x) (x)
46 49
47/* 50/*
48 * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware; 51 * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
49 * less sane hardware forces software to fiddle with this... 52 * less sane hardware forces software to fiddle with this...
53 *
54 * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
55 * you can't have the numerical value of data and byte addresses within
56 * multibyte quantities both preserved at the same time. Hence two
57 * variations of functions: non-prefixed ones that preserve the value
58 * and prefixed ones that preserve byte addresses. The latters are
59 * typically used for moving raw data between a peripheral and memory (cf.
60 * string I/O functions), hence the "mem_" prefix.
50 */ 61 */
51#if defined(CONFIG_SWAP_IO_SPACE) 62#if defined(CONFIG_SWAP_IO_SPACE)
52 63
53# define ioswabb(x) (x) 64# define ioswabb(x) (x)
65# define mem_ioswabb(x) (x)
54# ifdef CONFIG_SGI_IP22 66# ifdef CONFIG_SGI_IP22
55/* 67/*
56 * IP22 seems braindead enough to swap 16bits values in hardware, but 68 * IP22 seems braindead enough to swap 16bits values in hardware, but
57 * not 32bits. Go figure... Can't tell without documentation. 69 * not 32bits. Go figure... Can't tell without documentation.
58 */ 70 */
59# define ioswabw(x) (x) 71# define ioswabw(x) (x)
72# define mem_ioswabw(x) le16_to_cpu(x)
60# else 73# else
61# define ioswabw(x) le16_to_cpu(x) 74# define ioswabw(x) le16_to_cpu(x)
75# define mem_ioswabw(x) (x)
62# endif 76# endif
63# define ioswabl(x) le32_to_cpu(x) 77# define ioswabl(x) le32_to_cpu(x)
78# define mem_ioswabl(x) (x)
64# define ioswabq(x) le64_to_cpu(x) 79# define ioswabq(x) le64_to_cpu(x)
80# define mem_ioswabq(x) (x)
65 81
66#else 82#else
67 83
68# define ioswabb(x) (x) 84# define ioswabb(x) (x)
85# define mem_ioswabb(x) (x)
69# define ioswabw(x) (x) 86# define ioswabw(x) (x)
87# define mem_ioswabw(x) cpu_to_le16(x)
70# define ioswabl(x) (x) 88# define ioswabl(x) (x)
89# define mem_ioswabl(x) cpu_to_le32(x)
71# define ioswabq(x) (x) 90# define ioswabq(x) (x)
91# define mem_ioswabq(x) cpu_to_le32(x)
72 92
73#endif 93#endif
74 94
75/*
76 * Native bus accesses never swapped.
77 */
78#define bus_ioswabb(x) (x)
79#define bus_ioswabw(x) (x)
80#define bus_ioswabl(x) (x)
81#define bus_ioswabq(x) (x)
82
83#define __bus_ioswabq bus_ioswabq
84
85#define IO_SPACE_LIMIT 0xffff 95#define IO_SPACE_LIMIT 0xffff
86 96
87/* 97/*
@@ -194,12 +204,14 @@ extern unsigned long isa_slot_offset;
194 */ 204 */
195#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 205#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
196 206
197extern void * __ioremap(phys_t offset, phys_t size, unsigned long flags); 207extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags);
198extern void __iounmap(volatile void __iomem *addr); 208extern void __iounmap(volatile void __iomem *addr);
199 209
200static inline void * __ioremap_mode(phys_t offset, unsigned long size, 210static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
201 unsigned long flags) 211 unsigned long flags)
202{ 212{
213#define __IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL))
214
203 if (cpu_has_64bit_addresses) { 215 if (cpu_has_64bit_addresses) {
204 u64 base = UNCAC_BASE; 216 u64 base = UNCAC_BASE;
205 217
@@ -209,10 +221,30 @@ static inline void * __ioremap_mode(phys_t offset, unsigned long size,
209 */ 221 */
210 if (flags == _CACHE_UNCACHED) 222 if (flags == _CACHE_UNCACHED)
211 base = (u64) IO_BASE; 223 base = (u64) IO_BASE;
212 return (void *) (unsigned long) (base + offset); 224 return (void __iomem *) (unsigned long) (base + offset);
225 } else if (__builtin_constant_p(offset) &&
226 __builtin_constant_p(size) && __builtin_constant_p(flags)) {
227 phys_t phys_addr, last_addr;
228
229 phys_addr = fixup_bigphys_addr(offset, size);
230
231 /* Don't allow wraparound or zero size. */
232 last_addr = phys_addr + size - 1;
233 if (!size || last_addr < phys_addr)
234 return NULL;
235
236 /*
237 * Map uncached objects in the low 512MB of address
238 * space using KSEG1.
239 */
240 if (__IS_LOW512(phys_addr) && __IS_LOW512(last_addr) &&
241 flags == _CACHE_UNCACHED)
242 return (void __iomem *)CKSEG1ADDR(phys_addr);
213 } 243 }
214 244
215 return __ioremap(offset, size, flags); 245 return __ioremap(offset, size, flags);
246
247#undef __IS_LOW512
216} 248}
217 249
218/* 250/*
@@ -264,12 +296,16 @@ static inline void * __ioremap_mode(phys_t offset, unsigned long size,
264 296
265static inline void iounmap(volatile void __iomem *addr) 297static inline void iounmap(volatile void __iomem *addr)
266{ 298{
267 if (cpu_has_64bit_addresses) 299#define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1)
300
301 if (cpu_has_64bit_addresses ||
302 (__builtin_constant_p(addr) && __IS_KSEG1(addr)))
268 return; 303 return;
269 304
270 __iounmap(addr); 305 __iounmap(addr);
271}
272 306
307#undef __IS_KSEG1
308}
273 309
274#define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq) \ 310#define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq) \
275 \ 311 \
@@ -319,7 +355,8 @@ static inline type pfx##read##bwlq(volatile void __iomem *mem) \
319 else if (cpu_has_64bits) { \ 355 else if (cpu_has_64bits) { \
320 unsigned long __flags; \ 356 unsigned long __flags; \
321 \ 357 \
322 local_irq_save(__flags); \ 358 if (irq) \
359 local_irq_save(__flags); \
323 __asm__ __volatile__( \ 360 __asm__ __volatile__( \
324 ".set mips3" "\t\t# __readq" "\n\t" \ 361 ".set mips3" "\t\t# __readq" "\n\t" \
325 "ld %L0, %1" "\n\t" \ 362 "ld %L0, %1" "\n\t" \
@@ -328,7 +365,8 @@ static inline type pfx##read##bwlq(volatile void __iomem *mem) \
328 ".set mips0" "\n" \ 365 ".set mips0" "\n" \
329 : "=r" (__val) \ 366 : "=r" (__val) \
330 : "m" (*__mem)); \ 367 : "m" (*__mem)); \
331 local_irq_restore(__flags); \ 368 if (irq) \
369 local_irq_restore(__flags); \
332 } else { \ 370 } else { \
333 __val = 0; \ 371 __val = 0; \
334 BUG(); \ 372 BUG(); \
@@ -349,11 +387,11 @@ static inline void pfx##out##bwlq##p(type val, unsigned long port) \
349 \ 387 \
350 __val = pfx##ioswab##bwlq(val); \ 388 __val = pfx##ioswab##bwlq(val); \
351 \ 389 \
352 if (sizeof(type) != sizeof(u64)) { \ 390 /* Really, we want this to be atomic */ \
353 *__addr = __val; \ 391 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
354 slow; \ 392 \
355 } else \ 393 *__addr = __val; \
356 BUILD_BUG(); \ 394 slow; \
357} \ 395} \
358 \ 396 \
359static inline type pfx##in##bwlq##p(unsigned long port) \ 397static inline type pfx##in##bwlq##p(unsigned long port) \
@@ -364,13 +402,10 @@ static inline type pfx##in##bwlq##p(unsigned long port) \
364 port = __swizzle_addr_##bwlq(port); \ 402 port = __swizzle_addr_##bwlq(port); \
365 __addr = (void *)(mips_io_port_base + port); \ 403 __addr = (void *)(mips_io_port_base + port); \
366 \ 404 \
367 if (sizeof(type) != sizeof(u64)) { \ 405 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
368 __val = *__addr; \ 406 \
369 slow; \ 407 __val = *__addr; \
370 } else { \ 408 slow; \
371 __val = 0; \
372 BUILD_BUG(); \
373 } \
374 \ 409 \
375 return pfx##ioswab##bwlq(__val); \ 410 return pfx##ioswab##bwlq(__val); \
376} 411}
@@ -379,27 +414,35 @@ static inline type pfx##in##bwlq##p(unsigned long port) \
379 \ 414 \
380__BUILD_MEMORY_SINGLE(bus, bwlq, type, 1) 415__BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
381 416
382#define __BUILD_IOPORT_PFX(bus, bwlq, type) \ 417#define BUILDIO_MEM(bwlq, type) \
383 \
384__BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \
385__BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
386
387#define BUILDIO(bwlq, type) \
388 \ 418 \
389__BUILD_MEMORY_PFX(, bwlq, type) \
390__BUILD_MEMORY_PFX(__raw_, bwlq, type) \ 419__BUILD_MEMORY_PFX(__raw_, bwlq, type) \
391__BUILD_MEMORY_PFX(bus_, bwlq, type) \ 420__BUILD_MEMORY_PFX(, bwlq, type) \
392__BUILD_IOPORT_PFX(, bwlq, type) \ 421__BUILD_MEMORY_PFX(mem_, bwlq, type) \
393__BUILD_IOPORT_PFX(__raw_, bwlq, type) 422
423BUILDIO_MEM(b, u8)
424BUILDIO_MEM(w, u16)
425BUILDIO_MEM(l, u32)
426BUILDIO_MEM(q, u64)
427
428#define __BUILD_IOPORT_PFX(bus, bwlq, type) \
429 __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \
430 __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
431
432#define BUILDIO_IOPORT(bwlq, type) \
433 __BUILD_IOPORT_PFX(, bwlq, type) \
434 __BUILD_IOPORT_PFX(mem_, bwlq, type)
435
436BUILDIO_IOPORT(b, u8)
437BUILDIO_IOPORT(w, u16)
438BUILDIO_IOPORT(l, u32)
439#ifdef CONFIG_64BIT
440BUILDIO_IOPORT(q, u64)
441#endif
394 442
395#define __BUILDIO(bwlq, type) \ 443#define __BUILDIO(bwlq, type) \
396 \ 444 \
397__BUILD_MEMORY_SINGLE(__bus_, bwlq, type, 0) 445__BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 0)
398
399BUILDIO(b, u8)
400BUILDIO(w, u16)
401BUILDIO(l, u32)
402BUILDIO(q, u64)
403 446
404__BUILDIO(q, u64) 447__BUILDIO(q, u64)
405 448
@@ -422,7 +465,7 @@ static inline void writes##bwlq(volatile void __iomem *mem, void *addr, \
422 volatile type *__addr = addr; \ 465 volatile type *__addr = addr; \
423 \ 466 \
424 while (count--) { \ 467 while (count--) { \
425 __raw_write##bwlq(*__addr, mem); \ 468 mem_write##bwlq(*__addr, mem); \
426 __addr++; \ 469 __addr++; \
427 } \ 470 } \
428} \ 471} \
@@ -433,20 +476,20 @@ static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
433 volatile type *__addr = addr; \ 476 volatile type *__addr = addr; \
434 \ 477 \
435 while (count--) { \ 478 while (count--) { \
436 *__addr = __raw_read##bwlq(mem); \ 479 *__addr = mem_read##bwlq(mem); \
437 __addr++; \ 480 __addr++; \
438 } \ 481 } \
439} 482}
440 483
441#define __BUILD_IOPORT_STRING(bwlq, type) \ 484#define __BUILD_IOPORT_STRING(bwlq, type) \
442 \ 485 \
443static inline void outs##bwlq(unsigned long port, void *addr, \ 486static inline void outs##bwlq(unsigned long port, const void *addr, \
444 unsigned int count) \ 487 unsigned int count) \
445{ \ 488{ \
446 volatile type *__addr = addr; \ 489 const volatile type *__addr = addr; \
447 \ 490 \
448 while (count--) { \ 491 while (count--) { \
449 __raw_out##bwlq(*__addr, port); \ 492 mem_out##bwlq(*__addr, port); \
450 __addr++; \ 493 __addr++; \
451 } \ 494 } \
452} \ 495} \
@@ -457,7 +500,7 @@ static inline void ins##bwlq(unsigned long port, void *addr, \
457 volatile type *__addr = addr; \ 500 volatile type *__addr = addr; \
458 \ 501 \
459 while (count--) { \ 502 while (count--) { \
460 *__addr = __raw_in##bwlq(port); \ 503 *__addr = mem_in##bwlq(port); \
461 __addr++; \ 504 __addr++; \
462 } \ 505 } \
463} 506}
@@ -470,15 +513,26 @@ __BUILD_IOPORT_STRING(bwlq, type)
470BUILDSTRING(b, u8) 513BUILDSTRING(b, u8)
471BUILDSTRING(w, u16) 514BUILDSTRING(w, u16)
472BUILDSTRING(l, u32) 515BUILDSTRING(l, u32)
516#ifdef CONFIG_64BIT
473BUILDSTRING(q, u64) 517BUILDSTRING(q, u64)
518#endif
474 519
475 520
476/* Depends on MIPS II instruction set */ 521/* Depends on MIPS II instruction set */
477#define mmiowb() asm volatile ("sync" ::: "memory") 522#define mmiowb() asm volatile ("sync" ::: "memory")
478 523
479#define memset_io(a,b,c) memset((void *)(a),(b),(c)) 524static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
480#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) 525{
481#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) 526 memset((void __force *) addr, val, count);
527}
528static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
529{
530 memcpy(dst, (void __force *) src, count);
531}
532static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count)
533{
534 memcpy((void __force *) dst, src, count);
535}
482 536
483/* 537/*
484 * Memory Mapped I/O 538 * Memory Mapped I/O
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 3f2470e9e678..8a342ccb34a8 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -24,11 +24,9 @@ static inline int irq_canonicalize(int irq)
24 24
25struct pt_regs; 25struct pt_regs;
26 26
27#ifdef CONFIG_PREEMPT
28
29extern asmlinkage unsigned int do_IRQ(unsigned int irq, struct pt_regs *regs); 27extern asmlinkage unsigned int do_IRQ(unsigned int irq, struct pt_regs *regs);
30 28
31#else 29#ifdef CONFIG_PREEMPT
32 30
33/* 31/*
34 * do_IRQ handles all normal device IRQ's (the special 32 * do_IRQ handles all normal device IRQ's (the special
diff --git a/include/asm-mips/jmr3927/jmr3927.h b/include/asm-mips/jmr3927/jmr3927.h
index 86df317b4078..baf412967afa 100644
--- a/include/asm-mips/jmr3927/jmr3927.h
+++ b/include/asm-mips/jmr3927/jmr3927.h
@@ -202,20 +202,6 @@ static inline int jmr3927_have_isac(void)
202#endif /* !__ASSEMBLY__ */ 202#endif /* !__ASSEMBLY__ */
203 203
204/* 204/*
205 * UART defines for serial.h
206 */
207
208/* use Pre-scaler T0 (1/2) */
209#define JMR3927_BASE_BAUD (JMR3927_IMCLK / 2 / 16)
210
211#define UART0_ADDR 0xfffef300
212#define UART1_ADDR 0xfffef400
213#define UART0_INT JMR3927_IRQ_IRC_SIO0
214#define UART1_INT JMR3927_IRQ_IRC_SIO1
215#define UART0_FLAGS ASYNC_BOOT_AUTOCONF
216#define UART1_FLAGS 0
217
218/*
219 * IRQ mappings 205 * IRQ mappings
220 */ 206 */
221 207
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
index 148bae2fa7d3..8327ec341c18 100644
--- a/include/asm-mips/mach-au1x00/au1000.h
+++ b/include/asm-mips/mach-au1x00/au1000.h
@@ -60,59 +60,36 @@ void static inline au_sync_delay(int ms)
60 mdelay(ms); 60 mdelay(ms);
61} 61}
62 62
63void static inline au_writeb(u8 val, int reg) 63void static inline au_writeb(u8 val, unsigned long reg)
64{ 64{
65 *(volatile u8 *)(reg) = val; 65 *(volatile u8 *)(reg) = val;
66} 66}
67 67
68void static inline au_writew(u16 val, int reg) 68void static inline au_writew(u16 val, unsigned long reg)
69{ 69{
70 *(volatile u16 *)(reg) = val; 70 *(volatile u16 *)(reg) = val;
71} 71}
72 72
73void static inline au_writel(u32 val, int reg) 73void static inline au_writel(u32 val, unsigned long reg)
74{ 74{
75 *(volatile u32 *)(reg) = val; 75 *(volatile u32 *)(reg) = val;
76} 76}
77 77
78static inline u8 au_readb(unsigned long port) 78static inline u8 au_readb(unsigned long reg)
79{ 79{
80 return (*(volatile u8 *)port); 80 return (*(volatile u8 *)reg);
81} 81}
82 82
83static inline u16 au_readw(unsigned long port) 83static inline u16 au_readw(unsigned long reg)
84{ 84{
85 return (*(volatile u16 *)port); 85 return (*(volatile u16 *)reg);
86} 86}
87 87
88static inline u32 au_readl(unsigned long port) 88static inline u32 au_readl(unsigned long reg)
89{ 89{
90 return (*(volatile u32 *)port); 90 return (*(volatile u32 *)reg);
91} 91}
92 92
93/* These next three functions should be a generic part of the MIPS
94 * kernel (with the 'au_' removed from the name) and selected for
95 * processors that support the instructions.
96 * Taken from PPC tree. -- Dan
97 */
98/* Return the bit position of the most significant 1 bit in a word */
99static __inline__ int __ilog2(unsigned int x)
100{
101 int lz;
102
103 asm volatile (
104 ".set\tnoreorder\n\t"
105 ".set\tnoat\n\t"
106 ".set\tmips32\n\t"
107 "clz\t%0,%1\n\t"
108 ".set\tmips0\n\t"
109 ".set\tat\n\t"
110 ".set\treorder"
111 : "=r" (lz)
112 : "r" (x));
113
114 return 31 - lz;
115}
116 93
117static __inline__ int au_ffz(unsigned int x) 94static __inline__ int au_ffz(unsigned int x)
118{ 95{
@@ -162,28 +139,293 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
162#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5) 139#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
163#endif 140#endif
164 141
165/* SDRAM Controller */ 142/*
143 * SDRAM Register Offsets
144 */
166#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100) 145#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100)
167#define MEM_SDMODE0 0xB4000000 146#define MEM_SDMODE0 (0x0000)
168#define MEM_SDMODE1 0xB4000004 147#define MEM_SDMODE1 (0x0004)
169#define MEM_SDMODE2 0xB4000008 148#define MEM_SDMODE2 (0x0008)
149#define MEM_SDADDR0 (0x000C)
150#define MEM_SDADDR1 (0x0010)
151#define MEM_SDADDR2 (0x0014)
152#define MEM_SDREFCFG (0x0018)
153#define MEM_SDPRECMD (0x001C)
154#define MEM_SDAUTOREF (0x0020)
155#define MEM_SDWRMD0 (0x0024)
156#define MEM_SDWRMD1 (0x0028)
157#define MEM_SDWRMD2 (0x002C)
158#define MEM_SDSLEEP (0x0030)
159#define MEM_SDSMCKE (0x0034)
170 160
171#define MEM_SDADDR0 0xB400000C 161/*
172#define MEM_SDADDR1 0xB4000010 162 * MEM_SDMODE register content definitions
173#define MEM_SDADDR2 0xB4000014 163 */
164#define MEM_SDMODE_F (1<<22)
165#define MEM_SDMODE_SR (1<<21)
166#define MEM_SDMODE_BS (1<<20)
167#define MEM_SDMODE_RS (3<<18)
168#define MEM_SDMODE_CS (7<<15)
169#define MEM_SDMODE_TRAS (15<<11)
170#define MEM_SDMODE_TMRD (3<<9)
171#define MEM_SDMODE_TWR (3<<7)
172#define MEM_SDMODE_TRP (3<<5)
173#define MEM_SDMODE_TRCD (3<<3)
174#define MEM_SDMODE_TCL (7<<0)
175
176#define MEM_SDMODE_BS_2Bank (0<<20)
177#define MEM_SDMODE_BS_4Bank (1<<20)
178#define MEM_SDMODE_RS_11Row (0<<18)
179#define MEM_SDMODE_RS_12Row (1<<18)
180#define MEM_SDMODE_RS_13Row (2<<18)
181#define MEM_SDMODE_RS_N(N) ((N)<<18)
182#define MEM_SDMODE_CS_7Col (0<<15)
183#define MEM_SDMODE_CS_8Col (1<<15)
184#define MEM_SDMODE_CS_9Col (2<<15)
185#define MEM_SDMODE_CS_10Col (3<<15)
186#define MEM_SDMODE_CS_11Col (4<<15)
187#define MEM_SDMODE_CS_N(N) ((N)<<15)
188#define MEM_SDMODE_TRAS_N(N) ((N)<<11)
189#define MEM_SDMODE_TMRD_N(N) ((N)<<9)
190#define MEM_SDMODE_TWR_N(N) ((N)<<7)
191#define MEM_SDMODE_TRP_N(N) ((N)<<5)
192#define MEM_SDMODE_TRCD_N(N) ((N)<<3)
193#define MEM_SDMODE_TCL_N(N) ((N)<<0)
174 194
175#define MEM_SDREFCFG 0xB4000018 195/*
176#define MEM_SDPRECMD 0xB400001C 196 * MEM_SDADDR register contents definitions
177#define MEM_SDAUTOREF 0xB4000020 197 */
198#define MEM_SDADDR_E (1<<20)
199#define MEM_SDADDR_CSBA (0x03FF<<10)
200#define MEM_SDADDR_CSMASK (0x03FF<<0)
201#define MEM_SDADDR_CSBA_N(N) ((N)&(0x03FF<<22)>>12)
202#define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF<<22)>>22)
203
204/*
205 * MEM_SDREFCFG register content definitions
206 */
207#define MEM_SDREFCFG_TRC (15<<28)
208#define MEM_SDREFCFG_TRPM (3<<26)
209#define MEM_SDREFCFG_E (1<<25)
210#define MEM_SDREFCFG_RE (0x1ffffff<<0)
211#define MEM_SDREFCFG_TRC_N(N) ((N)<<MEM_SDREFCFG_TRC)
212#define MEM_SDREFCFG_TRPM_N(N) ((N)<<MEM_SDREFCFG_TRPM)
213#define MEM_SDREFCFG_REF_N(N) (N)
214#endif
178 215
179#define MEM_SDWRMD0 0xB4000024 216/***********************************************************************/
180#define MEM_SDWRMD1 0xB4000028
181#define MEM_SDWRMD2 0xB400002C
182 217
183#define MEM_SDSLEEP 0xB4000030 218/*
184#define MEM_SDSMCKE 0xB4000034 219 * Au1550 SDRAM Register Offsets
220 */
221
222/***********************************************************************/
223
224#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
225#define MEM_SDMODE0 (0x0800)
226#define MEM_SDMODE1 (0x0808)
227#define MEM_SDMODE2 (0x0810)
228#define MEM_SDADDR0 (0x0820)
229#define MEM_SDADDR1 (0x0828)
230#define MEM_SDADDR2 (0x0830)
231#define MEM_SDCONFIGA (0x0840)
232#define MEM_SDCONFIGB (0x0848)
233#define MEM_SDSTAT (0x0850)
234#define MEM_SDERRADDR (0x0858)
235#define MEM_SDSTRIDE0 (0x0860)
236#define MEM_SDSTRIDE1 (0x0868)
237#define MEM_SDSTRIDE2 (0x0870)
238#define MEM_SDWRMD0 (0x0880)
239#define MEM_SDWRMD1 (0x0888)
240#define MEM_SDWRMD2 (0x0890)
241#define MEM_SDPRECMD (0x08C0)
242#define MEM_SDAUTOREF (0x08C8)
243#define MEM_SDSREF (0x08D0)
244#define MEM_SDSLEEP MEM_SDSREF
245
246#endif
247
248/*
249 * Physical base addresses for integrated peripherals
250 */
251
252#ifdef CONFIG_SOC_AU1000
253#define MEM_PHYS_ADDR 0x14000000
254#define STATIC_MEM_PHYS_ADDR 0x14001000
255#define DMA0_PHYS_ADDR 0x14002000
256#define DMA1_PHYS_ADDR 0x14002100
257#define DMA2_PHYS_ADDR 0x14002200
258#define DMA3_PHYS_ADDR 0x14002300
259#define DMA4_PHYS_ADDR 0x14002400
260#define DMA5_PHYS_ADDR 0x14002500
261#define DMA6_PHYS_ADDR 0x14002600
262#define DMA7_PHYS_ADDR 0x14002700
263#define IC0_PHYS_ADDR 0x10400000
264#define IC1_PHYS_ADDR 0x11800000
265#define AC97_PHYS_ADDR 0x10000000
266#define USBH_PHYS_ADDR 0x10100000
267#define USBD_PHYS_ADDR 0x10200000
268#define IRDA_PHYS_ADDR 0x10300000
269#define MAC0_PHYS_ADDR 0x10500000
270#define MAC1_PHYS_ADDR 0x10510000
271#define MACEN_PHYS_ADDR 0x10520000
272#define MACDMA0_PHYS_ADDR 0x14004000
273#define MACDMA1_PHYS_ADDR 0x14004200
274#define I2S_PHYS_ADDR 0x11000000
275#define UART0_PHYS_ADDR 0x11100000
276#define UART1_PHYS_ADDR 0x11200000
277#define UART2_PHYS_ADDR 0x11300000
278#define UART3_PHYS_ADDR 0x11400000
279#define SSI0_PHYS_ADDR 0x11600000
280#define SSI1_PHYS_ADDR 0x11680000
281#define SYS_PHYS_ADDR 0x11900000
282#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
283#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
284#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
185#endif 285#endif
186 286
287/********************************************************************/
288
289#ifdef CONFIG_SOC_AU1500
290#define MEM_PHYS_ADDR 0x14000000
291#define STATIC_MEM_PHYS_ADDR 0x14001000
292#define DMA0_PHYS_ADDR 0x14002000
293#define DMA1_PHYS_ADDR 0x14002100
294#define DMA2_PHYS_ADDR 0x14002200
295#define DMA3_PHYS_ADDR 0x14002300
296#define DMA4_PHYS_ADDR 0x14002400
297#define DMA5_PHYS_ADDR 0x14002500
298#define DMA6_PHYS_ADDR 0x14002600
299#define DMA7_PHYS_ADDR 0x14002700
300#define IC0_PHYS_ADDR 0x10400000
301#define IC1_PHYS_ADDR 0x11800000
302#define AC97_PHYS_ADDR 0x10000000
303#define USBH_PHYS_ADDR 0x10100000
304#define USBD_PHYS_ADDR 0x10200000
305#define PCI_PHYS_ADDR 0x14005000
306#define MAC0_PHYS_ADDR 0x11500000
307#define MAC1_PHYS_ADDR 0x11510000
308#define MACEN_PHYS_ADDR 0x11520000
309#define MACDMA0_PHYS_ADDR 0x14004000
310#define MACDMA1_PHYS_ADDR 0x14004200
311#define I2S_PHYS_ADDR 0x11000000
312#define UART0_PHYS_ADDR 0x11100000
313#define UART3_PHYS_ADDR 0x11400000
314#define GPIO2_PHYS_ADDR 0x11700000
315#define SYS_PHYS_ADDR 0x11900000
316#define PCI_MEM_PHYS_ADDR 0x400000000ULL
317#define PCI_IO_PHYS_ADDR 0x500000000ULL
318#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
319#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
320#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
321#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
322#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
323#endif
324
325/********************************************************************/
326
327#ifdef CONFIG_SOC_AU1100
328#define MEM_PHYS_ADDR 0x14000000
329#define STATIC_MEM_PHYS_ADDR 0x14001000
330#define DMA0_PHYS_ADDR 0x14002000
331#define DMA1_PHYS_ADDR 0x14002100
332#define DMA2_PHYS_ADDR 0x14002200
333#define DMA3_PHYS_ADDR 0x14002300
334#define DMA4_PHYS_ADDR 0x14002400
335#define DMA5_PHYS_ADDR 0x14002500
336#define DMA6_PHYS_ADDR 0x14002600
337#define DMA7_PHYS_ADDR 0x14002700
338#define IC0_PHYS_ADDR 0x10400000
339#define SD0_PHYS_ADDR 0x10600000
340#define SD1_PHYS_ADDR 0x10680000
341#define IC1_PHYS_ADDR 0x11800000
342#define AC97_PHYS_ADDR 0x10000000
343#define USBH_PHYS_ADDR 0x10100000
344#define USBD_PHYS_ADDR 0x10200000
345#define IRDA_PHYS_ADDR 0x10300000
346#define MAC0_PHYS_ADDR 0x10500000
347#define MACEN_PHYS_ADDR 0x10520000
348#define MACDMA0_PHYS_ADDR 0x14004000
349#define MACDMA1_PHYS_ADDR 0x14004200
350#define I2S_PHYS_ADDR 0x11000000
351#define UART0_PHYS_ADDR 0x11100000
352#define UART1_PHYS_ADDR 0x11200000
353#define UART3_PHYS_ADDR 0x11400000
354#define SSI0_PHYS_ADDR 0x11600000
355#define SSI1_PHYS_ADDR 0x11680000
356#define GPIO2_PHYS_ADDR 0x11700000
357#define SYS_PHYS_ADDR 0x11900000
358#define LCD_PHYS_ADDR 0x15000000
359#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
360#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
361#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
362#endif
363
364/***********************************************************************/
365
366#ifdef CONFIG_SOC_AU1550
367#define MEM_PHYS_ADDR 0x14000000
368#define STATIC_MEM_PHYS_ADDR 0x14001000
369#define IC0_PHYS_ADDR 0x10400000
370#define IC1_PHYS_ADDR 0x11800000
371#define USBH_PHYS_ADDR 0x14020000
372#define USBD_PHYS_ADDR 0x10200000
373#define PCI_PHYS_ADDR 0x14005000
374#define MAC0_PHYS_ADDR 0x10500000
375#define MAC1_PHYS_ADDR 0x10510000
376#define MACEN_PHYS_ADDR 0x10520000
377#define MACDMA0_PHYS_ADDR 0x14004000
378#define MACDMA1_PHYS_ADDR 0x14004200
379#define UART0_PHYS_ADDR 0x11100000
380#define UART1_PHYS_ADDR 0x11200000
381#define UART3_PHYS_ADDR 0x11400000
382#define GPIO2_PHYS_ADDR 0x11700000
383#define SYS_PHYS_ADDR 0x11900000
384#define DDMA_PHYS_ADDR 0x14002000
385#define PE_PHYS_ADDR 0x14008000
386#define PSC0_PHYS_ADDR 0x11A00000
387#define PSC1_PHYS_ADDR 0x11B00000
388#define PSC2_PHYS_ADDR 0x10A00000
389#define PSC3_PHYS_ADDR 0x10B00000
390#define PCI_MEM_PHYS_ADDR 0x400000000ULL
391#define PCI_IO_PHYS_ADDR 0x500000000ULL
392#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
393#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
394#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
395#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
396#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
397#endif
398
399/***********************************************************************/
400
401#ifdef CONFIG_SOC_AU1200
402#define MEM_PHYS_ADDR 0x14000000
403#define STATIC_MEM_PHYS_ADDR 0x14001000
404#define AES_PHYS_ADDR 0x10300000
405#define CIM_PHYS_ADDR 0x14004000
406#define IC0_PHYS_ADDR 0x10400000
407#define IC1_PHYS_ADDR 0x11800000
408#define USBM_PHYS_ADDR 0x14020000
409#define USBH_PHYS_ADDR 0x14020100
410#define UART0_PHYS_ADDR 0x11100000
411#define UART1_PHYS_ADDR 0x11200000
412#define GPIO2_PHYS_ADDR 0x11700000
413#define SYS_PHYS_ADDR 0x11900000
414#define DDMA_PHYS_ADDR 0x14002000
415#define PSC0_PHYS_ADDR 0x11A00000
416#define PSC1_PHYS_ADDR 0x11B00000
417#define SD0_PHYS_ADDR 0x10600000
418#define SD1_PHYS_ADDR 0x10680000
419#define LCD_PHYS_ADDR 0x15000000
420#define SWCNT_PHYS_ADDR 0x1110010C
421#define MAEFE_PHYS_ADDR 0x14012000
422#define MAEBE_PHYS_ADDR 0x14010000
423#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
424#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
425#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
426#endif
427
428
187/* Static Bus Controller */ 429/* Static Bus Controller */
188#define MEM_STCFG0 0xB4001000 430#define MEM_STCFG0 0xB4001000
189#define MEM_STTIME0 0xB4001004 431#define MEM_STTIME0 0xB4001004
@@ -369,7 +611,7 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
369#define AU1000_MAC0_ENABLE 0xB0520000 611#define AU1000_MAC0_ENABLE 0xB0520000
370#define AU1000_MAC1_ENABLE 0xB0520004 612#define AU1000_MAC1_ENABLE 0xB0520004
371#define NUM_ETH_INTERFACES 2 613#define NUM_ETH_INTERFACES 2
372#endif // CONFIG_SOC_AU1000 614#endif /* CONFIG_SOC_AU1000 */
373 615
374/* Au1500 */ 616/* Au1500 */
375#ifdef CONFIG_SOC_AU1500 617#ifdef CONFIG_SOC_AU1500
@@ -429,6 +671,12 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
429#define AU1500_GPIO_207 62 671#define AU1500_GPIO_207 62
430#define AU1500_GPIO_208_215 63 672#define AU1500_GPIO_208_215 63
431 673
674/* shortcuts */
675#define INTA AU1000_PCI_INTA
676#define INTB AU1000_PCI_INTB
677#define INTC AU1000_PCI_INTC
678#define INTD AU1000_PCI_INTD
679
432#define UART0_ADDR 0xB1100000 680#define UART0_ADDR 0xB1100000
433#define UART3_ADDR 0xB1400000 681#define UART3_ADDR 0xB1400000
434 682
@@ -440,7 +688,7 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
440#define AU1500_MAC0_ENABLE 0xB1520000 688#define AU1500_MAC0_ENABLE 0xB1520000
441#define AU1500_MAC1_ENABLE 0xB1520004 689#define AU1500_MAC1_ENABLE 0xB1520004
442#define NUM_ETH_INTERFACES 2 690#define NUM_ETH_INTERFACES 2
443#endif // CONFIG_SOC_AU1500 691#endif /* CONFIG_SOC_AU1500 */
444 692
445/* Au1100 */ 693/* Au1100 */
446#ifdef CONFIG_SOC_AU1100 694#ifdef CONFIG_SOC_AU1100
@@ -485,6 +733,22 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
485#define AU1000_GPIO_13 45 733#define AU1000_GPIO_13 45
486#define AU1000_GPIO_14 46 734#define AU1000_GPIO_14 46
487#define AU1000_GPIO_15 47 735#define AU1000_GPIO_15 47
736#define AU1000_GPIO_16 48
737#define AU1000_GPIO_17 49
738#define AU1000_GPIO_18 50
739#define AU1000_GPIO_19 51
740#define AU1000_GPIO_20 52
741#define AU1000_GPIO_21 53
742#define AU1000_GPIO_22 54
743#define AU1000_GPIO_23 55
744#define AU1000_GPIO_24 56
745#define AU1000_GPIO_25 57
746#define AU1000_GPIO_26 58
747#define AU1000_GPIO_27 59
748#define AU1000_GPIO_28 60
749#define AU1000_GPIO_29 61
750#define AU1000_GPIO_30 62
751#define AU1000_GPIO_31 63
488 752
489#define UART0_ADDR 0xB1100000 753#define UART0_ADDR 0xB1100000
490#define UART1_ADDR 0xB1200000 754#define UART1_ADDR 0xB1200000
@@ -496,7 +760,7 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
496#define AU1100_ETH0_BASE 0xB0500000 760#define AU1100_ETH0_BASE 0xB0500000
497#define AU1100_MAC0_ENABLE 0xB0520000 761#define AU1100_MAC0_ENABLE 0xB0520000
498#define NUM_ETH_INTERFACES 1 762#define NUM_ETH_INTERFACES 1
499#endif // CONFIG_SOC_AU1100 763#endif /* CONFIG_SOC_AU1100 */
500 764
501#ifdef CONFIG_SOC_AU1550 765#ifdef CONFIG_SOC_AU1550
502#define AU1550_UART0_INT 0 766#define AU1550_UART0_INT 0
@@ -513,14 +777,14 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
513#define AU1550_PSC1_INT 11 777#define AU1550_PSC1_INT 11
514#define AU1550_PSC2_INT 12 778#define AU1550_PSC2_INT 12
515#define AU1550_PSC3_INT 13 779#define AU1550_PSC3_INT 13
516#define AU1550_TOY_INT 14 780#define AU1000_TOY_INT 14
517#define AU1550_TOY_MATCH0_INT 15 781#define AU1000_TOY_MATCH0_INT 15
518#define AU1550_TOY_MATCH1_INT 16 782#define AU1000_TOY_MATCH1_INT 16
519#define AU1550_TOY_MATCH2_INT 17 783#define AU1000_TOY_MATCH2_INT 17
520#define AU1550_RTC_INT 18 784#define AU1000_RTC_INT 18
521#define AU1550_RTC_MATCH0_INT 19 785#define AU1000_RTC_MATCH0_INT 19
522#define AU1550_RTC_MATCH1_INT 20 786#define AU1000_RTC_MATCH1_INT 20
523#define AU1550_RTC_MATCH2_INT 21 787#define AU1000_RTC_MATCH2_INT 21
524#define AU1550_NAND_INT 23 788#define AU1550_NAND_INT 23
525#define AU1550_USB_DEV_REQ_INT 24 789#define AU1550_USB_DEV_REQ_INT 24
526#define AU1550_USB_DEV_SUS_INT 25 790#define AU1550_USB_DEV_SUS_INT 25
@@ -563,6 +827,12 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
563#define AU1500_GPIO_207 62 827#define AU1500_GPIO_207 62
564#define AU1500_GPIO_208_218 63 // Logical or of GPIO208:218 828#define AU1500_GPIO_208_218 63 // Logical or of GPIO208:218
565 829
830/* shortcuts */
831#define INTA AU1550_PCI_INTA
832#define INTB AU1550_PCI_INTB
833#define INTC AU1550_PCI_INTC
834#define INTD AU1550_PCI_INTD
835
566#define UART0_ADDR 0xB1100000 836#define UART0_ADDR 0xB1100000
567#define UART1_ADDR 0xB1200000 837#define UART1_ADDR 0xB1200000
568#define UART3_ADDR 0xB1400000 838#define UART3_ADDR 0xB1400000
@@ -575,7 +845,7 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
575#define AU1550_MAC0_ENABLE 0xB0520000 845#define AU1550_MAC0_ENABLE 0xB0520000
576#define AU1550_MAC1_ENABLE 0xB0520004 846#define AU1550_MAC1_ENABLE 0xB0520004
577#define NUM_ETH_INTERFACES 2 847#define NUM_ETH_INTERFACES 2
578#endif // CONFIG_SOC_AU1550 848#endif /* CONFIG_SOC_AU1550 */
579 849
580#ifdef CONFIG_SOC_AU1200 850#ifdef CONFIG_SOC_AU1200
581#define AU1200_UART0_INT 0 851#define AU1200_UART0_INT 0
@@ -592,14 +862,14 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
592#define AU1200_PSC1_INT 11 862#define AU1200_PSC1_INT 11
593#define AU1200_AES_INT 12 863#define AU1200_AES_INT 12
594#define AU1200_CAMERA_INT 13 864#define AU1200_CAMERA_INT 13
595#define AU1200_TOY_INT 14 865#define AU1000_TOY_INT 14
596#define AU1200_TOY_MATCH0_INT 15 866#define AU1000_TOY_MATCH0_INT 15
597#define AU1200_TOY_MATCH1_INT 16 867#define AU1000_TOY_MATCH1_INT 16
598#define AU1200_TOY_MATCH2_INT 17 868#define AU1000_TOY_MATCH2_INT 17
599#define AU1200_RTC_INT 18 869#define AU1000_RTC_INT 18
600#define AU1200_RTC_MATCH0_INT 19 870#define AU1000_RTC_MATCH0_INT 19
601#define AU1200_RTC_MATCH1_INT 20 871#define AU1000_RTC_MATCH1_INT 20
602#define AU1200_RTC_MATCH2_INT 21 872#define AU1000_RTC_MATCH2_INT 21
603#define AU1200_NAND_INT 23 873#define AU1200_NAND_INT 23
604#define AU1200_GPIO_204 24 874#define AU1200_GPIO_204 24
605#define AU1200_GPIO_205 25 875#define AU1200_GPIO_205 25
@@ -607,6 +877,7 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
607#define AU1200_GPIO_207 27 877#define AU1200_GPIO_207 27
608#define AU1200_GPIO_208_215 28 // Logical OR of 208:215 878#define AU1200_GPIO_208_215 28 // Logical OR of 208:215
609#define AU1200_USB_INT 29 879#define AU1200_USB_INT 29
880#define AU1000_USB_HOST_INT AU1200_USB_INT
610#define AU1200_LCD_INT 30 881#define AU1200_LCD_INT 30
611#define AU1200_MAE_BOTH_INT 31 882#define AU1200_MAE_BOTH_INT 31
612#define AU1000_GPIO_0 32 883#define AU1000_GPIO_0 32
@@ -645,20 +916,36 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
645#define UART0_ADDR 0xB1100000 916#define UART0_ADDR 0xB1100000
646#define UART1_ADDR 0xB1200000 917#define UART1_ADDR 0xB1200000
647 918
648#define USB_OHCI_BASE 0x14020000 // phys addr for ioremap 919#define USB_UOC_BASE 0x14020020
649#define USB_HOST_CONFIG 0xB4027ffc 920#define USB_UOC_LEN 0x20
650 921#define USB_OHCI_BASE 0x14020100
651// these are here for prototyping on au1550 (do not exist on au1200) 922#define USB_OHCI_LEN 0x100
652#define AU1200_ETH0_BASE 0xB0500000 923#define USB_EHCI_BASE 0x14020200
653#define AU1200_ETH1_BASE 0xB0510000 924#define USB_EHCI_LEN 0x100
654#define AU1200_MAC0_ENABLE 0xB0520000 925#define USB_UDC_BASE 0x14022000
655#define AU1200_MAC1_ENABLE 0xB0520004 926#define USB_UDC_LEN 0x2000
656#define NUM_ETH_INTERFACES 2 927#define USB_MSR_BASE 0xB4020000
657#endif // CONFIG_SOC_AU1200 928#define USB_MSR_MCFG 4
929#define USBMSRMCFG_OMEMEN 0
930#define USBMSRMCFG_OBMEN 1
931#define USBMSRMCFG_EMEMEN 2
932#define USBMSRMCFG_EBMEN 3
933#define USBMSRMCFG_DMEMEN 4
934#define USBMSRMCFG_DBMEN 5
935#define USBMSRMCFG_GMEMEN 6
936#define USBMSRMCFG_OHCCLKEN 16
937#define USBMSRMCFG_EHCCLKEN 17
938#define USBMSRMCFG_UDCCLKEN 18
939#define USBMSRMCFG_PHYPLLEN 19
940#define USBMSRMCFG_RDCOMB 30
941#define USBMSRMCFG_PFEN 31
942
943#endif /* CONFIG_SOC_AU1200 */
658 944
659#define AU1000_LAST_INTC0_INT 31 945#define AU1000_LAST_INTC0_INT 31
946#define AU1000_LAST_INTC1_INT 63
660#define AU1000_MAX_INTR 63 947#define AU1000_MAX_INTR 63
661 948#define INTX 0xFF /* not valid */
662 949
663/* Programmable Counters 0 and 1 */ 950/* Programmable Counters 0 and 1 */
664#define SYS_BASE 0xB1900000 951#define SYS_BASE 0xB1900000
@@ -730,6 +1017,8 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
730 #define I2S_CONTROL_D (1<<1) 1017 #define I2S_CONTROL_D (1<<1)
731 #define I2S_CONTROL_CE (1<<0) 1018 #define I2S_CONTROL_CE (1<<0)
732 1019
1020#ifndef CONFIG_SOC_AU1200
1021
733/* USB Host Controller */ 1022/* USB Host Controller */
734#define USB_OHCI_LEN 0x00100000 1023#define USB_OHCI_LEN 0x00100000
735 1024
@@ -775,6 +1064,8 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
775 #define USBDEV_ENABLE (1<<1) 1064 #define USBDEV_ENABLE (1<<1)
776 #define USBDEV_CE (1<<0) 1065 #define USBDEV_CE (1<<0)
777 1066
1067#endif /* !CONFIG_SOC_AU1200 */
1068
778/* Ethernet Controllers */ 1069/* Ethernet Controllers */
779 1070
780/* 4 byte offsets from AU1000_ETH_BASE */ 1071/* 4 byte offsets from AU1000_ETH_BASE */
@@ -1173,6 +1464,37 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
1173 #define SYS_PF_PSC1_S1 (1 << 1) 1464 #define SYS_PF_PSC1_S1 (1 << 1)
1174 #define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2)) 1465 #define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
1175 1466
1467/* Au1200 Only */
1468#ifdef CONFIG_SOC_AU1200
1469#define SYS_PINFUNC_DMA (1<<31)
1470#define SYS_PINFUNC_S0A (1<<30)
1471#define SYS_PINFUNC_S1A (1<<29)
1472#define SYS_PINFUNC_LP0 (1<<28)
1473#define SYS_PINFUNC_LP1 (1<<27)
1474#define SYS_PINFUNC_LD16 (1<<26)
1475#define SYS_PINFUNC_LD8 (1<<25)
1476#define SYS_PINFUNC_LD1 (1<<24)
1477#define SYS_PINFUNC_LD0 (1<<23)
1478#define SYS_PINFUNC_P1A (3<<21)
1479#define SYS_PINFUNC_P1B (1<<20)
1480#define SYS_PINFUNC_FS3 (1<<19)
1481#define SYS_PINFUNC_P0A (3<<17)
1482#define SYS_PINFUNC_CS (1<<16)
1483#define SYS_PINFUNC_CIM (1<<15)
1484#define SYS_PINFUNC_P1C (1<<14)
1485#define SYS_PINFUNC_U1T (1<<12)
1486#define SYS_PINFUNC_U1R (1<<11)
1487#define SYS_PINFUNC_EX1 (1<<10)
1488#define SYS_PINFUNC_EX0 (1<<9)
1489#define SYS_PINFUNC_U0R (1<<8)
1490#define SYS_PINFUNC_MC (1<<7)
1491#define SYS_PINFUNC_S0B (1<<6)
1492#define SYS_PINFUNC_S0C (1<<5)
1493#define SYS_PINFUNC_P0B (1<<4)
1494#define SYS_PINFUNC_U0T (1<<3)
1495#define SYS_PINFUNC_S1B (1<<2)
1496#endif
1497
1176#define SYS_TRIOUTRD 0xB1900100 1498#define SYS_TRIOUTRD 0xB1900100
1177#define SYS_TRIOUTCLR 0xB1900100 1499#define SYS_TRIOUTCLR 0xB1900100
1178#define SYS_OUTPUTRD 0xB1900108 1500#define SYS_OUTPUTRD 0xB1900108
@@ -1239,6 +1561,12 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
1239 #define SYS_CS_MI2_MASK (0x7<<SYS_CS_MI2_BIT) 1561 #define SYS_CS_MI2_MASK (0x7<<SYS_CS_MI2_BIT)
1240 #define SYS_CS_DI2 (1<<16) 1562 #define SYS_CS_DI2 (1<<16)
1241 #define SYS_CS_CI2 (1<<15) 1563 #define SYS_CS_CI2 (1<<15)
1564#ifdef CONFIG_SOC_AU1100
1565 #define SYS_CS_ML_BIT 7
1566 #define SYS_CS_ML_MASK (0x7<<SYS_CS_ML_BIT)
1567 #define SYS_CS_DL (1<<6)
1568 #define SYS_CS_CL (1<<5)
1569#else
1242 #define SYS_CS_MUH_BIT 12 1570 #define SYS_CS_MUH_BIT 12
1243 #define SYS_CS_MUH_MASK (0x7<<SYS_CS_MUH_BIT) 1571 #define SYS_CS_MUH_MASK (0x7<<SYS_CS_MUH_BIT)
1244 #define SYS_CS_DUH (1<<11) 1572 #define SYS_CS_DUH (1<<11)
@@ -1247,6 +1575,7 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
1247 #define SYS_CS_MUD_MASK (0x7<<SYS_CS_MUD_BIT) 1575 #define SYS_CS_MUD_MASK (0x7<<SYS_CS_MUD_BIT)
1248 #define SYS_CS_DUD (1<<6) 1576 #define SYS_CS_DUD (1<<6)
1249 #define SYS_CS_CUD (1<<5) 1577 #define SYS_CS_CUD (1<<5)
1578#endif
1250 #define SYS_CS_MIR_BIT 2 1579 #define SYS_CS_MIR_BIT 2
1251 #define SYS_CS_MIR_MASK (0x7<<SYS_CS_MIR_BIT) 1580 #define SYS_CS_MIR_MASK (0x7<<SYS_CS_MIR_BIT)
1252 #define SYS_CS_DIR (1<<1) 1581 #define SYS_CS_DIR (1<<1)
@@ -1300,7 +1629,6 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
1300#define SD1_XMIT_FIFO 0xB0680000 1629#define SD1_XMIT_FIFO 0xB0680000
1301#define SD1_RECV_FIFO 0xB0680004 1630#define SD1_RECV_FIFO 0xB0680004
1302 1631
1303
1304#if defined (CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550) 1632#if defined (CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
1305/* Au1500 PCI Controller */ 1633/* Au1500 PCI Controller */
1306#define Au1500_CFG_BASE 0xB4005000 // virtual, kseg0 addr 1634#define Au1500_CFG_BASE 0xB4005000 // virtual, kseg0 addr
@@ -1363,36 +1691,77 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
1363 _ctl_; }) 1691 _ctl_; })
1364 1692
1365 1693
1366#else /* Au1000 and Au1100 */ 1694#else /* Au1000 and Au1100 and Au1200 */
1367 1695
1368/* don't allow any legacy ports probing */ 1696/* don't allow any legacy ports probing */
1369#define IOPORT_RESOURCE_START 0x10000000; 1697#define IOPORT_RESOURCE_START 0x10000000
1370#define IOPORT_RESOURCE_END 0xffffffff 1698#define IOPORT_RESOURCE_END 0xffffffff
1371#define IOMEM_RESOURCE_START 0x10000000 1699#define IOMEM_RESOURCE_START 0x10000000
1372#define IOMEM_RESOURCE_END 0xffffffff 1700#define IOMEM_RESOURCE_END 0xffffffff
1373 1701
1374#ifdef CONFIG_MIPS_PB1000
1375#define PCI_IO_START 0x10000000
1376#define PCI_IO_END 0x1000ffff
1377#define PCI_MEM_START 0x18000000
1378#define PCI_MEM_END 0x18ffffff
1379#define PCI_FIRST_DEVFN 0
1380#define PCI_LAST_DEVFN 1
1381#else
1382/* no PCI bus controller */
1383#define PCI_IO_START 0 1702#define PCI_IO_START 0
1384#define PCI_IO_END 0 1703#define PCI_IO_END 0
1385#define PCI_MEM_START 0 1704#define PCI_MEM_START 0
1386#define PCI_MEM_END 0 1705#define PCI_MEM_END 0
1387#define PCI_FIRST_DEVFN 0 1706#define PCI_FIRST_DEVFN 0
1388#define PCI_LAST_DEVFN 0 1707#define PCI_LAST_DEVFN 0
1389#endif
1390 1708
1391#endif 1709#endif
1392 1710
1711#ifndef _LANGUAGE_ASSEMBLY
1712typedef volatile struct
1713{
1714 /* 0x0000 */ u32 toytrim;
1715 /* 0x0004 */ u32 toywrite;
1716 /* 0x0008 */ u32 toymatch0;
1717 /* 0x000C */ u32 toymatch1;
1718 /* 0x0010 */ u32 toymatch2;
1719 /* 0x0014 */ u32 cntrctrl;
1720 /* 0x0018 */ u32 scratch0;
1721 /* 0x001C */ u32 scratch1;
1722 /* 0x0020 */ u32 freqctrl0;
1723 /* 0x0024 */ u32 freqctrl1;
1724 /* 0x0028 */ u32 clksrc;
1725 /* 0x002C */ u32 pinfunc;
1726 /* 0x0030 */ u32 reserved0;
1727 /* 0x0034 */ u32 wakemsk;
1728 /* 0x0038 */ u32 endian;
1729 /* 0x003C */ u32 powerctrl;
1730 /* 0x0040 */ u32 toyread;
1731 /* 0x0044 */ u32 rtctrim;
1732 /* 0x0048 */ u32 rtcwrite;
1733 /* 0x004C */ u32 rtcmatch0;
1734 /* 0x0050 */ u32 rtcmatch1;
1735 /* 0x0054 */ u32 rtcmatch2;
1736 /* 0x0058 */ u32 rtcread;
1737 /* 0x005C */ u32 wakesrc;
1738 /* 0x0060 */ u32 cpupll;
1739 /* 0x0064 */ u32 auxpll;
1740 /* 0x0068 */ u32 reserved1;
1741 /* 0x006C */ u32 reserved2;
1742 /* 0x0070 */ u32 reserved3;
1743 /* 0x0074 */ u32 reserved4;
1744 /* 0x0078 */ u32 slppwr;
1745 /* 0x007C */ u32 sleep;
1746 /* 0x0080 */ u32 reserved5[32];
1747 /* 0x0100 */ u32 trioutrd;
1748#define trioutclr trioutrd
1749 /* 0x0104 */ u32 reserved6;
1750 /* 0x0108 */ u32 outputrd;
1751#define outputset outputrd
1752 /* 0x010C */ u32 outputclr;
1753 /* 0x0110 */ u32 pinstaterd;
1754#define pininputen pinstaterd
1755
1756} AU1X00_SYS;
1757
1758static AU1X00_SYS* const sys = (AU1X00_SYS *)SYS_BASE;
1759
1760#endif
1393/* Processor information base on prid. 1761/* Processor information base on prid.
1394 * Copied from PowerPC. 1762 * Copied from PowerPC.
1395 */ 1763 */
1764#ifndef _LANGUAGE_ASSEMBLY
1396struct cpu_spec { 1765struct cpu_spec {
1397 /* CPU is matched via (PRID & prid_mask) == prid_value */ 1766 /* CPU is matched via (PRID & prid_mask) == prid_value */
1398 unsigned int prid_mask; 1767 unsigned int prid_mask;
@@ -1406,3 +1775,6 @@ struct cpu_spec {
1406extern struct cpu_spec cpu_specs[]; 1775extern struct cpu_spec cpu_specs[];
1407extern struct cpu_spec *cur_cpu_spec[]; 1776extern struct cpu_spec *cur_cpu_spec[];
1408#endif 1777#endif
1778
1779#endif
1780
diff --git a/include/asm-mips/mach-au1x00/au1xxx.h b/include/asm-mips/mach-au1x00/au1xxx.h
new file mode 100644
index 000000000000..b7b46dd9b929
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/au1xxx.h
@@ -0,0 +1,44 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
8 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
10 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
11 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
13 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
16 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _AU1XXX_H_
24#define _AU1XXX_H_
25
26#include <linux/config.h>
27
28#include <asm/mach-au1x00/au1000.h>
29
30#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550)
31#include <asm/mach-db1x00/db1x00.h>
32
33#elif defined(CONFIG_MIPS_PB1550)
34#include <asm/mach-pb1x00/pb1550.h>
35
36#elif defined(CONFIG_MIPS_PB1200)
37#include <asm/mach-pb1x00/pb1200.h>
38
39#elif defined(CONFIG_MIPS_DB1200)
40#include <asm/mach-db1x00/db1200.h>
41
42#endif
43
44#endif /* _AU1XXX_H_ */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
index d5eb88cd7d51..b327bcd3fee1 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
@@ -45,7 +45,7 @@
45#define DDMA_GLOBAL_BASE 0xb4003000 45#define DDMA_GLOBAL_BASE 0xb4003000
46#define DDMA_CHANNEL_BASE 0xb4002000 46#define DDMA_CHANNEL_BASE 0xb4002000
47 47
48typedef struct dbdma_global { 48typedef volatile struct dbdma_global {
49 u32 ddma_config; 49 u32 ddma_config;
50 u32 ddma_intstat; 50 u32 ddma_intstat;
51 u32 ddma_throttle; 51 u32 ddma_throttle;
@@ -62,7 +62,7 @@ typedef struct dbdma_global {
62 62
63/* The structure of a DMA Channel. 63/* The structure of a DMA Channel.
64*/ 64*/
65typedef struct au1xxx_dma_channel { 65typedef volatile struct au1xxx_dma_channel {
66 u32 ddma_cfg; /* See below */ 66 u32 ddma_cfg; /* See below */
67 u32 ddma_desptr; /* 32-byte aligned pointer to descriptor */ 67 u32 ddma_desptr; /* 32-byte aligned pointer to descriptor */
68 u32 ddma_statptr; /* word aligned pointer to status word */ 68 u32 ddma_statptr; /* word aligned pointer to status word */
@@ -98,7 +98,7 @@ typedef struct au1xxx_dma_channel {
98/* "Standard" DDMA Descriptor. 98/* "Standard" DDMA Descriptor.
99 * Must be 32-byte aligned. 99 * Must be 32-byte aligned.
100 */ 100 */
101typedef struct au1xxx_ddma_desc { 101typedef volatile struct au1xxx_ddma_desc {
102 u32 dscr_cmd0; /* See below */ 102 u32 dscr_cmd0; /* See below */
103 u32 dscr_cmd1; /* See below */ 103 u32 dscr_cmd1; /* See below */
104 u32 dscr_source0; /* source phys address */ 104 u32 dscr_source0; /* source phys address */
@@ -107,6 +107,12 @@ typedef struct au1xxx_ddma_desc {
107 u32 dscr_dest1; /* See below */ 107 u32 dscr_dest1; /* See below */
108 u32 dscr_stat; /* completion status */ 108 u32 dscr_stat; /* completion status */
109 u32 dscr_nxtptr; /* Next descriptor pointer (mostly) */ 109 u32 dscr_nxtptr; /* Next descriptor pointer (mostly) */
110 /* First 32bytes are HW specific!!!
111 Lets have some SW data following.. make sure its 32bytes
112 */
113 u32 sw_status;
114 u32 sw_context;
115 u32 sw_reserved[6];
110} au1x_ddma_desc_t; 116} au1x_ddma_desc_t;
111 117
112#define DSCR_CMD0_V (1 << 31) /* Descriptor valid */ 118#define DSCR_CMD0_V (1 << 31) /* Descriptor valid */
@@ -125,8 +131,11 @@ typedef struct au1xxx_ddma_desc {
125#define DSCR_CMD0_CV (0x1 << 2) /* Clear Valid when done */ 131#define DSCR_CMD0_CV (0x1 << 2) /* Clear Valid when done */
126#define DSCR_CMD0_ST_MASK (0x3 << 0) /* Status instruction */ 132#define DSCR_CMD0_ST_MASK (0x3 << 0) /* Status instruction */
127 133
134#define SW_STATUS_INUSE (1<<0)
135
128/* Command 0 device IDs. 136/* Command 0 device IDs.
129*/ 137*/
138#ifdef CONFIG_SOC_AU1550
130#define DSCR_CMD0_UART0_TX 0 139#define DSCR_CMD0_UART0_TX 0
131#define DSCR_CMD0_UART0_RX 1 140#define DSCR_CMD0_UART0_RX 1
132#define DSCR_CMD0_UART3_TX 2 141#define DSCR_CMD0_UART3_TX 2
@@ -155,9 +164,45 @@ typedef struct au1xxx_ddma_desc {
155#define DSCR_CMD0_MAC0_TX 25 164#define DSCR_CMD0_MAC0_TX 25
156#define DSCR_CMD0_MAC1_RX 26 165#define DSCR_CMD0_MAC1_RX 26
157#define DSCR_CMD0_MAC1_TX 27 166#define DSCR_CMD0_MAC1_TX 27
167#endif /* CONFIG_SOC_AU1550 */
168
169#ifdef CONFIG_SOC_AU1200
170#define DSCR_CMD0_UART0_TX 0
171#define DSCR_CMD0_UART0_RX 1
172#define DSCR_CMD0_UART1_TX 2
173#define DSCR_CMD0_UART1_RX 3
174#define DSCR_CMD0_DMA_REQ0 4
175#define DSCR_CMD0_DMA_REQ1 5
176#define DSCR_CMD0_MAE_BE 6
177#define DSCR_CMD0_MAE_FE 7
178#define DSCR_CMD0_SDMS_TX0 8
179#define DSCR_CMD0_SDMS_RX0 9
180#define DSCR_CMD0_SDMS_TX1 10
181#define DSCR_CMD0_SDMS_RX1 11
182#define DSCR_CMD0_AES_TX 13
183#define DSCR_CMD0_AES_RX 12
184#define DSCR_CMD0_PSC0_TX 14
185#define DSCR_CMD0_PSC0_RX 15
186#define DSCR_CMD0_PSC1_TX 16
187#define DSCR_CMD0_PSC1_RX 17
188#define DSCR_CMD0_CIM_RXA 18
189#define DSCR_CMD0_CIM_RXB 19
190#define DSCR_CMD0_CIM_RXC 20
191#define DSCR_CMD0_MAE_BOTH 21
192#define DSCR_CMD0_LCD 22
193#define DSCR_CMD0_NAND_FLASH 23
194#define DSCR_CMD0_PSC0_SYNC 24
195#define DSCR_CMD0_PSC1_SYNC 25
196#define DSCR_CMD0_CIM_SYNC 26
197#endif /* CONFIG_SOC_AU1200 */
198
158#define DSCR_CMD0_THROTTLE 30 199#define DSCR_CMD0_THROTTLE 30
159#define DSCR_CMD0_ALWAYS 31 200#define DSCR_CMD0_ALWAYS 31
160#define DSCR_NDEV_IDS 32 201#define DSCR_NDEV_IDS 32
202/* THis macro is used to find/create custom device types */
203#define DSCR_DEV2CUSTOM_ID(x,d) (((((x)&0xFFFF)<<8)|0x32000000)|((d)&0xFF))
204#define DSCR_CUSTOM2DEV_ID(x) ((x)&0xFF)
205
161 206
162#define DSCR_CMD0_SID(x) (((x) & 0x1f) << 25) 207#define DSCR_CMD0_SID(x) (((x) & 0x1f) << 25)
163#define DSCR_CMD0_DID(x) (((x) & 0x1f) << 20) 208#define DSCR_CMD0_DID(x) (((x) & 0x1f) << 20)
@@ -246,6 +291,43 @@ typedef struct au1xxx_ddma_desc {
246*/ 291*/
247#define NUM_DBDMA_CHANS 16 292#define NUM_DBDMA_CHANS 16
248 293
294/*
295 * Ddma API definitions
296 * FIXME: may not fit to this header file
297 */
298typedef struct dbdma_device_table {
299 u32 dev_id;
300 u32 dev_flags;
301 u32 dev_tsize;
302 u32 dev_devwidth;
303 u32 dev_physaddr; /* If FIFO */
304 u32 dev_intlevel;
305 u32 dev_intpolarity;
306} dbdev_tab_t;
307
308
309typedef struct dbdma_chan_config {
310 spinlock_t lock;
311
312 u32 chan_flags;
313 u32 chan_index;
314 dbdev_tab_t *chan_src;
315 dbdev_tab_t *chan_dest;
316 au1x_dma_chan_t *chan_ptr;
317 au1x_ddma_desc_t *chan_desc_base;
318 au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr;
319 void *chan_callparam;
320 void (*chan_callback)(int, void *, struct pt_regs *);
321} chan_tab_t;
322
323#define DEV_FLAGS_INUSE (1 << 0)
324#define DEV_FLAGS_ANYUSE (1 << 1)
325#define DEV_FLAGS_OUT (1 << 2)
326#define DEV_FLAGS_IN (1 << 3)
327#define DEV_FLAGS_BURSTABLE (1 << 4)
328#define DEV_FLAGS_SYNC (1 << 5)
329/* end Ddma API definitions */
330
249/* External functions for drivers to use. 331/* External functions for drivers to use.
250*/ 332*/
251/* Use this to allocate a dbdma channel. The device ids are one of the 333/* Use this to allocate a dbdma channel. The device ids are one of the
@@ -258,18 +340,6 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
258 340
259#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS 341#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS
260 342
261/* ACK! These should be in a board specific description file.
262*/
263#ifdef CONFIG_MIPS_PB1550
264#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
265#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
266#endif
267#ifdef CONFIG_MIPS_DB1550
268#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
269#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
270#endif
271
272
273/* Set the device width of a in/out fifo. 343/* Set the device width of a in/out fifo.
274*/ 344*/
275u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits); 345u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits);
@@ -280,8 +350,8 @@ u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries);
280 350
281/* Put buffers on source/destination descriptors. 351/* Put buffers on source/destination descriptors.
282*/ 352*/
283u32 au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes); 353u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags);
284u32 au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes); 354u32 _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags);
285 355
286/* Get a buffer from the destination descriptor. 356/* Get a buffer from the destination descriptor.
287*/ 357*/
@@ -295,5 +365,29 @@ u32 au1xxx_get_dma_residue(u32 chanid);
295void au1xxx_dbdma_chan_free(u32 chanid); 365void au1xxx_dbdma_chan_free(u32 chanid);
296void au1xxx_dbdma_dump(u32 chanid); 366void au1xxx_dbdma_dump(u32 chanid);
297 367
368u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr );
369
370u32 au1xxx_ddma_add_device( dbdev_tab_t *dev );
371void * au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp);
372
373/*
374 Some compatibilty macros --
375 Needed to make changes to API without breaking existing drivers
376*/
377#define au1xxx_dbdma_put_source(chanid,buf,nbytes)_au1xxx_dbdma_put_source(chanid, buf, nbytes, DDMA_FLAGS_IE)
378#define au1xxx_dbdma_put_source_flags(chanid,buf,nbytes,flags) _au1xxx_dbdma_put_source(chanid, buf, nbytes, flags)
379#define put_source_flags(chanid,buf,nbytes,flags) au1xxx_dbdma_put_source_flags(chanid,buf,nbytes,flags)
380
381
382#define au1xxx_dbdma_put_dest(chanid,buf,nbytes) _au1xxx_dbdma_put_dest(chanid, buf, nbytes, DDMA_FLAGS_IE)
383#define au1xxx_dbdma_put_dest_flags(chanid,buf,nbytes,flags) _au1xxx_dbdma_put_dest(chanid, buf, nbytes, flags)
384#define put_dest_flags(chanid,buf,nbytes,flags) au1xxx_dbdma_put_dest_flags(chanid,buf,nbytes,flags)
385
386/*
387 * Flags for the put_source/put_dest functions.
388 */
389#define DDMA_FLAGS_IE (1<<0)
390#define DDMA_FLAGS_NOIE (1<<1)
391
298#endif /* _LANGUAGE_ASSEMBLY */ 392#endif /* _LANGUAGE_ASSEMBLY */
299#endif /* _AU1000_DBDMA_H_ */ 393#endif /* _AU1000_DBDMA_H_ */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_gpio.h b/include/asm-mips/mach-au1x00/au1xxx_gpio.h
new file mode 100644
index 000000000000..27911e054ffc
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/au1xxx_gpio.h
@@ -0,0 +1,20 @@
1#ifndef __AU1XXX_GPIO_H
2#define __AU1XXX_GPIO_H
3
4void au1xxx_gpio1_set_inputs(void);
5void au1xxx_gpio_tristate(int signal);
6void au1xxx_gpio_write(int signal, int value);
7int au1xxx_gpio_read(int signal);
8
9typedef volatile struct
10{
11 u32 dir;
12 u32 reserved;
13 u32 output;
14 u32 pinstate;
15 u32 inten;
16 u32 enable;
17
18} AU1X00_GPIO2;
19
20#endif //__AU1XXX_GPIO_H
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
new file mode 100644
index 000000000000..33d275c3b84c
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -0,0 +1,301 @@
1/*
2 * include/asm-mips/mach-au1x00/au1xxx_ide.h version 01.30.00 Aug. 02 2005
3 *
4 * BRIEF MODULE DESCRIPTION
5 * AMD Alchemy Au1xxx IDE interface routines over the Static Bus
6 *
7 * Copyright (c) 2003-2005 AMD, Personal Connectivity Solutions
8 *
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the License, or (at your option) any later
12 * version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
15 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 * POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along with
26 * this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 *
29 * Note: for more information, please refer "AMD Alchemy Au1200/Au1550 IDE
30 * Interface and Linux Device Driver" Application Note.
31 */
32#include <linux/config.h>
33
34#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
35 #define DMA_WAIT_TIMEOUT 100
36 #define NUM_DESCRIPTORS PRD_ENTRIES
37#else /* CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA */
38 #define NUM_DESCRIPTORS 2
39#endif
40
41#ifndef AU1XXX_ATA_RQSIZE
42 #define AU1XXX_ATA_RQSIZE 128
43#endif
44
45/* Disable Burstable-Support for DBDMA */
46#ifndef CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON
47 #define CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON 0
48#endif
49
50#ifdef CONFIG_PM
51/*
52* This will enable the device to be powered up when write() or read()
53* is called. If this is not defined, the driver will return -EBUSY.
54*/
55#define WAKE_ON_ACCESS 1
56
57typedef struct
58{
59 spinlock_t lock; /* Used to block on state transitions */
60 au1xxx_power_dev_t *dev; /* Power Managers device structure */
61 unsigned stopped; /* USed to signaling device is stopped */
62} pm_state;
63#endif
64
65
66typedef struct
67{
68 u32 tx_dev_id, rx_dev_id, target_dev_id;
69 u32 tx_chan, rx_chan;
70 void *tx_desc_head, *rx_desc_head;
71 ide_hwif_t *hwif;
72#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
73 ide_drive_t *drive;
74 u8 white_list, black_list;
75 struct dbdma_cmd *dma_table_cpu;
76 dma_addr_t dma_table_dma;
77 struct scatterlist *sg_table;
78 int sg_nents;
79 int sg_dma_direction;
80#endif
81 struct device *dev;
82 int irq;
83 u32 regbase;
84#ifdef CONFIG_PM
85 pm_state pm;
86#endif
87} _auide_hwif;
88
89#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
90struct drive_list_entry {
91 const char * id_model;
92 const char * id_firmware;
93};
94
95/* HD white list */
96static const struct drive_list_entry dma_white_list [] = {
97/*
98 * Hitachi
99 */
100 { "HITACHI_DK14FA-20" , "ALL" },
101 { "HTS726060M9AT00" , "ALL" },
102/*
103 * Maxtor
104 */
105 { "Maxtor 6E040L0" , "ALL" },
106 { "Maxtor 6Y080P0" , "ALL" },
107 { "Maxtor 6Y160P0" , "ALL" },
108/*
109 * Seagate
110 */
111 { "ST3120026A" , "ALL" },
112 { "ST320014A" , "ALL" },
113 { "ST94011A" , "ALL" },
114 { "ST340016A" , "ALL" },
115/*
116 * Western Digital
117 */
118 { "WDC WD400UE-00HCT0" , "ALL" },
119 { "WDC WD400JB-00JJC0" , "ALL" },
120 { NULL , NULL }
121};
122
123/* HD black list */
124static const struct drive_list_entry dma_black_list [] = {
125/*
126 * Western Digital
127 */
128 { "WDC WD100EB-00CGH0" , "ALL" },
129 { "WDC WD200BB-00AUA1" , "ALL" },
130 { "WDC AC24300L" , "ALL" },
131 { NULL , NULL }
132};
133#endif
134
135/* function prototyping */
136u8 auide_inb(unsigned long port);
137u16 auide_inw(unsigned long port);
138u32 auide_inl(unsigned long port);
139void auide_insw(unsigned long port, void *addr, u32 count);
140void auide_insl(unsigned long port, void *addr, u32 count);
141void auide_outb(u8 addr, unsigned long port);
142void auide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port);
143void auide_outw(u16 addr, unsigned long port);
144void auide_outl(u32 addr, unsigned long port);
145void auide_outsw(unsigned long port, void *addr, u32 count);
146void auide_outsl(unsigned long port, void *addr, u32 count);
147static void auide_tune_drive(ide_drive_t *drive, byte pio);
148static int auide_tune_chipset (ide_drive_t *drive, u8 speed);
149static int auide_ddma_init( _auide_hwif *auide );
150static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif);
151int __init auide_probe(void);
152
153#ifdef CONFIG_PM
154 int au1200ide_pm_callback( au1xxx_power_dev_t *dev,
155 au1xxx_request_t request, void *data);
156 static int au1xxxide_pm_standby( au1xxx_power_dev_t *dev );
157 static int au1xxxide_pm_sleep( au1xxx_power_dev_t *dev );
158 static int au1xxxide_pm_resume( au1xxx_power_dev_t *dev );
159 static int au1xxxide_pm_getstatus( au1xxx_power_dev_t *dev );
160 static int au1xxxide_pm_access( au1xxx_power_dev_t *dev );
161 static int au1xxxide_pm_idle( au1xxx_power_dev_t *dev );
162 static int au1xxxide_pm_cleanup( au1xxx_power_dev_t *dev );
163#endif
164
165
166/*
167 * Multi-Word DMA + DbDMA functions
168 */
169#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
170
171 static int in_drive_list(struct hd_driveid *id,
172 const struct drive_list_entry *drive_table);
173 static int auide_build_sglist(ide_drive_t *drive, struct request *rq);
174 static int auide_build_dmatable(ide_drive_t *drive);
175 static int auide_dma_end(ide_drive_t *drive);
176 static void auide_dma_start(ide_drive_t *drive );
177 ide_startstop_t auide_dma_intr (ide_drive_t *drive);
178 static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command);
179 static int auide_dma_setup(ide_drive_t *drive);
180 static int auide_dma_check(ide_drive_t *drive);
181 static int auide_dma_test_irq(ide_drive_t *drive);
182 static int auide_dma_host_off(ide_drive_t *drive);
183 static int auide_dma_host_on(ide_drive_t *drive);
184 static int auide_dma_lostirq(ide_drive_t *drive);
185 static int auide_dma_on(ide_drive_t *drive);
186 static void auide_ddma_tx_callback(int irq, void *param,
187 struct pt_regs *regs);
188 static void auide_ddma_rx_callback(int irq, void *param,
189 struct pt_regs *regs);
190 static int auide_dma_off_quietly(ide_drive_t *drive);
191 static int auide_dma_timeout(ide_drive_t *drive);
192
193#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
194
195/*******************************************************************************
196* PIO Mode timing calculation : *
197* *
198* Static Bus Spec ATA Spec *
199* Tcsoe = t1 *
200* Toecs = t9 *
201* Twcs = t9 *
202* Tcsh = t2i | t2 *
203* Tcsoff = t2i | t2 *
204* Twp = t2 *
205* Tcsw = t1 *
206* Tpm = 0 *
207* Ta = t1+t2 *
208*******************************************************************************/
209
210#define TCSOE_MASK (0x07<<29)
211#define TOECS_MASK (0x07<<26)
212#define TWCS_MASK (0x07<<28)
213#define TCSH_MASK (0x0F<<24)
214#define TCSOFF_MASK (0x07<<20)
215#define TWP_MASK (0x3F<<14)
216#define TCSW_MASK (0x0F<<10)
217#define TPM_MASK (0x0F<<6)
218#define TA_MASK (0x3F<<0)
219#define TS_MASK (1<<8)
220
221/* Timing parameters PIO mode 0 */
222#define SBC_IDE_PIO0_TCSOE (0x04<<29)
223#define SBC_IDE_PIO0_TOECS (0x01<<26)
224#define SBC_IDE_PIO0_TWCS (0x02<<28)
225#define SBC_IDE_PIO0_TCSH (0x08<<24)
226#define SBC_IDE_PIO0_TCSOFF (0x07<<20)
227#define SBC_IDE_PIO0_TWP (0x10<<14)
228#define SBC_IDE_PIO0_TCSW (0x04<<10)
229#define SBC_IDE_PIO0_TPM (0x0<<6)
230#define SBC_IDE_PIO0_TA (0x15<<0)
231/* Timing parameters PIO mode 1 */
232#define SBC_IDE_PIO1_TCSOE (0x03<<29)
233#define SBC_IDE_PIO1_TOECS (0x01<<26)
234#define SBC_IDE_PIO1_TWCS (0x01<<28)
235#define SBC_IDE_PIO1_TCSH (0x06<<24)
236#define SBC_IDE_PIO1_TCSOFF (0x06<<20)
237#define SBC_IDE_PIO1_TWP (0x08<<14)
238#define SBC_IDE_PIO1_TCSW (0x03<<10)
239#define SBC_IDE_PIO1_TPM (0x00<<6)
240#define SBC_IDE_PIO1_TA (0x0B<<0)
241/* Timing parameters PIO mode 2 */
242#define SBC_IDE_PIO2_TCSOE (0x05<<29)
243#define SBC_IDE_PIO2_TOECS (0x01<<26)
244#define SBC_IDE_PIO2_TWCS (0x01<<28)
245#define SBC_IDE_PIO2_TCSH (0x07<<24)
246#define SBC_IDE_PIO2_TCSOFF (0x07<<20)
247#define SBC_IDE_PIO2_TWP (0x1F<<14)
248#define SBC_IDE_PIO2_TCSW (0x05<<10)
249#define SBC_IDE_PIO2_TPM (0x00<<6)
250#define SBC_IDE_PIO2_TA (0x22<<0)
251/* Timing parameters PIO mode 3 */
252#define SBC_IDE_PIO3_TCSOE (0x05<<29)
253#define SBC_IDE_PIO3_TOECS (0x01<<26)
254#define SBC_IDE_PIO3_TWCS (0x01<<28)
255#define SBC_IDE_PIO3_TCSH (0x0D<<24)
256#define SBC_IDE_PIO3_TCSOFF (0x0D<<20)
257#define SBC_IDE_PIO3_TWP (0x15<<14)
258#define SBC_IDE_PIO3_TCSW (0x05<<10)
259#define SBC_IDE_PIO3_TPM (0x00<<6)
260#define SBC_IDE_PIO3_TA (0x1A<<0)
261/* Timing parameters PIO mode 4 */
262#define SBC_IDE_PIO4_TCSOE (0x04<<29)
263#define SBC_IDE_PIO4_TOECS (0x01<<26)
264#define SBC_IDE_PIO4_TWCS (0x01<<28)
265#define SBC_IDE_PIO4_TCSH (0x04<<24)
266#define SBC_IDE_PIO4_TCSOFF (0x04<<20)
267#define SBC_IDE_PIO4_TWP (0x0D<<14)
268#define SBC_IDE_PIO4_TCSW (0x03<<10)
269#define SBC_IDE_PIO4_TPM (0x00<<6)
270#define SBC_IDE_PIO4_TA (0x12<<0)
271/* Timing parameters MDMA mode 0 */
272#define SBC_IDE_MDMA0_TCSOE (0x03<<29)
273#define SBC_IDE_MDMA0_TOECS (0x01<<26)
274#define SBC_IDE_MDMA0_TWCS (0x01<<28)
275#define SBC_IDE_MDMA0_TCSH (0x07<<24)
276#define SBC_IDE_MDMA0_TCSOFF (0x07<<20)
277#define SBC_IDE_MDMA0_TWP (0x0C<<14)
278#define SBC_IDE_MDMA0_TCSW (0x03<<10)
279#define SBC_IDE_MDMA0_TPM (0x00<<6)
280#define SBC_IDE_MDMA0_TA (0x0F<<0)
281/* Timing parameters MDMA mode 1 */
282#define SBC_IDE_MDMA1_TCSOE (0x05<<29)
283#define SBC_IDE_MDMA1_TOECS (0x01<<26)
284#define SBC_IDE_MDMA1_TWCS (0x01<<28)
285#define SBC_IDE_MDMA1_TCSH (0x05<<24)
286#define SBC_IDE_MDMA1_TCSOFF (0x05<<20)
287#define SBC_IDE_MDMA1_TWP (0x0F<<14)
288#define SBC_IDE_MDMA1_TCSW (0x05<<10)
289#define SBC_IDE_MDMA1_TPM (0x00<<6)
290#define SBC_IDE_MDMA1_TA (0x15<<0)
291/* Timing parameters MDMA mode 2 */
292#define SBC_IDE_MDMA2_TCSOE (0x04<<29)
293#define SBC_IDE_MDMA2_TOECS (0x01<<26)
294#define SBC_IDE_MDMA2_TWCS (0x01<<28)
295#define SBC_IDE_MDMA2_TCSH (0x04<<24)
296#define SBC_IDE_MDMA2_TCSOFF (0x04<<20)
297#define SBC_IDE_MDMA2_TWP (0x0D<<14)
298#define SBC_IDE_MDMA2_TCSW (0x04<<10)
299#define SBC_IDE_MDMA2_TPM (0x00<<6)
300#define SBC_IDE_MDMA2_TA (0x12<<0)
301
diff --git a/include/asm-mips/mach-au1x00/au1xxx_psc.h b/include/asm-mips/mach-au1x00/au1xxx_psc.h
index 283519dfdec4..8e5fb3c7da4d 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_psc.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_psc.h
@@ -33,6 +33,8 @@
33#ifndef _AU1000_PSC_H_ 33#ifndef _AU1000_PSC_H_
34#define _AU1000_PSC_H_ 34#define _AU1000_PSC_H_
35 35
36#include <linux/config.h>
37
36/* The PSC base addresses. */ 38/* The PSC base addresses. */
37#ifdef CONFIG_SOC_AU1550 39#ifdef CONFIG_SOC_AU1550
38#define PSC0_BASE_ADDR 0xb1a00000 40#define PSC0_BASE_ADDR 0xb1a00000
diff --git a/include/asm-mips/mach-au1x00/ioremap.h b/include/asm-mips/mach-au1x00/ioremap.h
new file mode 100644
index 000000000000..d3ec6274575a
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/ioremap.h
@@ -0,0 +1,32 @@
1/*
2 * include/asm-mips/mach-au1x00/ioremap.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#ifndef __ASM_MACH_AU1X00_IOREMAP_H
10#define __ASM_MACH_AU1X00_IOREMAP_H
11
12#include <linux/config.h>
13#include <linux/types.h>
14
15#ifdef CONFIG_64BIT_PHYS_ADDR
16extern phys_t __fixup_bigphys_addr(phys_t, phys_t);
17#else
18static inline phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
19{
20 return phys_addr;
21}
22#endif
23
24/*
25 * Allow physical addresses to be fixed up to help 36-bit peripherals.
26 */
27static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
28{
29 return __fixup_bigphys_addr(phys_addr, size);
30}
31
32#endif /* __ASM_MACH_AU1X00_IOREMAP_H */
diff --git a/include/asm-mips/mach-db1x00/db1200.h b/include/asm-mips/mach-db1x00/db1200.h
new file mode 100644
index 000000000000..5d894376fc1a
--- /dev/null
+++ b/include/asm-mips/mach-db1x00/db1200.h
@@ -0,0 +1,224 @@
1/*
2 * AMD Alchemy DB1200 Referrence Board
3 * Board Registers defines.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 *
23 */
24#ifndef __ASM_DB1200_H
25#define __ASM_DB1200_H
26
27#include <linux/types.h>
28
29// This is defined in au1000.h with bogus value
30#undef AU1X00_EXTERNAL_INT
31
32#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
33#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
34#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX
35#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
36
37/* SPI and SMB are muxed on the Pb1200 board.
38 Refer to board documentation.
39 */
40#define SPI_PSC_BASE PSC0_BASE_ADDR
41#define SMBUS_PSC_BASE PSC0_BASE_ADDR
42/* AC97 and I2S are muxed on the Pb1200 board.
43 Refer to board documentation.
44 */
45#define AC97_PSC_BASE PSC1_BASE_ADDR
46#define I2S_PSC_BASE PSC1_BASE_ADDR
47
48#define BCSR_KSEG1_ADDR 0xB9800000
49
50typedef volatile struct
51{
52 /*00*/ u16 whoami;
53 u16 reserved0;
54 /*04*/ u16 status;
55 u16 reserved1;
56 /*08*/ u16 switches;
57 u16 reserved2;
58 /*0C*/ u16 resets;
59 u16 reserved3;
60
61 /*10*/ u16 pcmcia;
62 u16 reserved4;
63 /*14*/ u16 board;
64 u16 reserved5;
65 /*18*/ u16 disk_leds;
66 u16 reserved6;
67 /*1C*/ u16 system;
68 u16 reserved7;
69
70 /*20*/ u16 intclr;
71 u16 reserved8;
72 /*24*/ u16 intset;
73 u16 reserved9;
74 /*28*/ u16 intclr_mask;
75 u16 reserved10;
76 /*2C*/ u16 intset_mask;
77 u16 reserved11;
78
79 /*30*/ u16 sig_status;
80 u16 reserved12;
81 /*34*/ u16 int_status;
82 u16 reserved13;
83 /*38*/ u16 reserved14;
84 u16 reserved15;
85 /*3C*/ u16 reserved16;
86 u16 reserved17;
87
88} BCSR;
89
90static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
91
92/*
93 * Register bit definitions for the BCSRs
94 */
95#define BCSR_WHOAMI_DCID 0x000F
96#define BCSR_WHOAMI_CPLD 0x00F0
97#define BCSR_WHOAMI_BOARD 0x0F00
98
99#define BCSR_STATUS_PCMCIA0VS 0x0003
100#define BCSR_STATUS_PCMCIA1VS 0x000C
101#define BCSR_STATUS_SWAPBOOT 0x0040
102#define BCSR_STATUS_FLASHBUSY 0x0100
103#define BCSR_STATUS_IDECBLID 0x0200
104#define BCSR_STATUS_SD0WP 0x0400
105#define BCSR_STATUS_U0RXD 0x1000
106#define BCSR_STATUS_U1RXD 0x2000
107
108#define BCSR_SWITCHES_OCTAL 0x00FF
109#define BCSR_SWITCHES_DIP_1 0x0080
110#define BCSR_SWITCHES_DIP_2 0x0040
111#define BCSR_SWITCHES_DIP_3 0x0020
112#define BCSR_SWITCHES_DIP_4 0x0010
113#define BCSR_SWITCHES_DIP_5 0x0008
114#define BCSR_SWITCHES_DIP_6 0x0004
115#define BCSR_SWITCHES_DIP_7 0x0002
116#define BCSR_SWITCHES_DIP_8 0x0001
117#define BCSR_SWITCHES_ROTARY 0x0F00
118
119#define BCSR_RESETS_ETH 0x0001
120#define BCSR_RESETS_CAMERA 0x0002
121#define BCSR_RESETS_DC 0x0004
122#define BCSR_RESETS_IDE 0x0008
123#define BCSR_RESETS_TV 0x0010
124/* not resets but in the same register */
125#define BCSR_RESETS_PWMR1mUX 0x0800
126#define BCSR_RESETS_PCS0MUX 0x1000
127#define BCSR_RESETS_PCS1MUX 0x2000
128#define BCSR_RESETS_SPISEL 0x4000
129
130#define BCSR_PCMCIA_PC0VPP 0x0003
131#define BCSR_PCMCIA_PC0VCC 0x000C
132#define BCSR_PCMCIA_PC0DRVEN 0x0010
133#define BCSR_PCMCIA_PC0RST 0x0080
134#define BCSR_PCMCIA_PC1VPP 0x0300
135#define BCSR_PCMCIA_PC1VCC 0x0C00
136#define BCSR_PCMCIA_PC1DRVEN 0x1000
137#define BCSR_PCMCIA_PC1RST 0x8000
138
139#define BCSR_BOARD_LCDVEE 0x0001
140#define BCSR_BOARD_LCDVDD 0x0002
141#define BCSR_BOARD_LCDBL 0x0004
142#define BCSR_BOARD_CAMSNAP 0x0010
143#define BCSR_BOARD_CAMPWR 0x0020
144#define BCSR_BOARD_SD0PWR 0x0040
145
146#define BCSR_LEDS_DECIMALS 0x0003
147#define BCSR_LEDS_LED0 0x0100
148#define BCSR_LEDS_LED1 0x0200
149#define BCSR_LEDS_LED2 0x0400
150#define BCSR_LEDS_LED3 0x0800
151
152#define BCSR_SYSTEM_POWEROFF 0x4000
153#define BCSR_SYSTEM_RESET 0x8000
154
155/* Bit positions for the different interrupt sources */
156#define BCSR_INT_IDE 0x0001
157#define BCSR_INT_ETH 0x0002
158#define BCSR_INT_PC0 0x0004
159#define BCSR_INT_PC0STSCHG 0x0008
160#define BCSR_INT_PC1 0x0010
161#define BCSR_INT_PC1STSCHG 0x0020
162#define BCSR_INT_DC 0x0040
163#define BCSR_INT_FLASHBUSY 0x0080
164#define BCSR_INT_PC0INSERT 0x0100
165#define BCSR_INT_PC0EJECT 0x0200
166#define BCSR_INT_PC1INSERT 0x0400
167#define BCSR_INT_PC1EJECT 0x0800
168#define BCSR_INT_SD0INSERT 0x1000
169#define BCSR_INT_SD0EJECT 0x2000
170
171#define AU1XXX_SMC91111_PHYS_ADDR (0x19000300)
172#define AU1XXX_SMC91111_IRQ DB1200_ETH_INT
173
174#define AU1XXX_ATA_PHYS_ADDR (0x18800000)
175#define AU1XXX_ATA_PHYS_LEN (0x100)
176#define AU1XXX_ATA_REG_OFFSET (5)
177#define AU1XXX_ATA_INT DB1200_IDE_INT
178#define AU1XXX_ATA_DDMA_REQ DSCR_CMD0_DMA_REQ1;
179#define AU1XXX_ATA_RQSIZE 128
180
181#define NAND_PHYS_ADDR 0x20000000
182
183/*
184 * External Interrupts for Pb1200 as of 8/6/2004.
185 * Bit positions in the CPLD registers can be calculated by taking
186 * the interrupt define and subtracting the DB1200_INT_BEGIN value.
187 * *example: IDE bis pos is = 64 - 64
188 ETH bit pos is = 65 - 64
189 */
190#define DB1200_INT_BEGIN (AU1000_LAST_INTC1_INT + 1)
191#define DB1200_IDE_INT (DB1200_INT_BEGIN + 0)
192#define DB1200_ETH_INT (DB1200_INT_BEGIN + 1)
193#define DB1200_PC0_INT (DB1200_INT_BEGIN + 2)
194#define DB1200_PC0_STSCHG_INT (DB1200_INT_BEGIN + 3)
195#define DB1200_PC1_INT (DB1200_INT_BEGIN + 4)
196#define DB1200_PC1_STSCHG_INT (DB1200_INT_BEGIN + 5)
197#define DB1200_DC_INT (DB1200_INT_BEGIN + 6)
198#define DB1200_FLASHBUSY_INT (DB1200_INT_BEGIN + 7)
199#define DB1200_PC0_INSERT_INT (DB1200_INT_BEGIN + 8)
200#define DB1200_PC0_EJECT_INT (DB1200_INT_BEGIN + 9)
201#define DB1200_PC1_INSERT_INT (DB1200_INT_BEGIN + 10)
202#define DB1200_PC1_EJECT_INT (DB1200_INT_BEGIN + 11)
203#define DB1200_SD0_INSERT_INT (DB1200_INT_BEGIN + 12)
204#define DB1200_SD0_EJECT_INT (DB1200_INT_BEGIN + 13)
205
206#define DB1200_INT_END (DB1200_INT_BEGIN + 15)
207
208/* For drivers/pcmcia/au1000_db1x00.c */
209
210/* PCMCIA Db1x00 specific defines */
211
212#define PCMCIA_MAX_SOCK 1
213#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
214
215/* VPP/VCC */
216#define SET_VCC_VPP(VCC, VPP, SLOT)\
217 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
218
219#define BOARD_PC0_INT DB1200_PC0_INT
220#define BOARD_PC1_INT DB1200_PC1_INT
221#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1<<(8+(2*SOCKET)))
222
223#endif /* __ASM_DB1200_H */
224
diff --git a/include/asm-mips/mach-dec/mc146818rtc.h b/include/asm-mips/mach-dec/mc146818rtc.h
index a326f451253b..6d37a5675803 100644
--- a/include/asm-mips/mach-dec/mc146818rtc.h
+++ b/include/asm-mips/mach-dec/mc146818rtc.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 1998, 2001 by Ralf Baechle 4 * Copyright (C) 1998, 2001 by Ralf Baechle
5 * Copyright (C) 1998 by Harald Koerfgen 5 * Copyright (C) 1998 by Harald Koerfgen
6 * Copyright (C) 2002 Maciej W. Rozycki 6 * Copyright (C) 2002, 2005 Maciej W. Rozycki
7 * 7 *
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License 9 * modify it under the terms of the GNU General Public License
@@ -14,23 +14,18 @@
14#define __ASM_MIPS_DEC_RTC_DEC_H 14#define __ASM_MIPS_DEC_RTC_DEC_H
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17
18#include <asm/addrspace.h> 17#include <asm/addrspace.h>
18#include <asm/dec/system.h>
19 19
20extern volatile u8 *dec_rtc_base; 20extern volatile u8 *dec_rtc_base;
21extern unsigned long dec_kn_slot_size;
22 21
23#define RTC_PORT(x) CPHYSADDR(dec_rtc_base) 22#define RTC_PORT(x) CPHYSADDR((long)dec_rtc_base)
24#define RTC_IO_EXTENT dec_kn_slot_size 23#define RTC_IO_EXTENT dec_kn_slot_size
25#define RTC_IOMAPPED 0 24#define RTC_IOMAPPED 0
26#undef RTC_IRQ 25#undef RTC_IRQ
27 26
28#define RTC_DEC_YEAR 0x3f /* Where we store the real year on DECs. */ 27#define RTC_DEC_YEAR 0x3f /* Where we store the real year on DECs. */
29 28
30#include <linux/mc146818rtc.h>
31#include <linux/module.h>
32#include <linux/types.h>
33
34static inline unsigned char CMOS_READ(unsigned long addr) 29static inline unsigned char CMOS_READ(unsigned long addr)
35{ 30{
36 return dec_rtc_base[addr * 4]; 31 return dec_rtc_base[addr * 4];
diff --git a/include/asm-mips/mach-generic/cpu-feature-overrides.h b/include/asm-mips/mach-generic/cpu-feature-overrides.h
index 0aecfd08e39a..7c185bb06f13 100644
--- a/include/asm-mips/mach-generic/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-generic/cpu-feature-overrides.h
@@ -8,6 +8,6 @@
8#ifndef __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H 8#ifndef __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H 9#define __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H
10 10
11/* Intensionally empty file ... */ 11/* Intentionally empty file ... */
12 12
13#endif /* __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H */ 13#endif /* __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
index cb2edd018ad6..961006948c7c 100644
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -18,6 +18,7 @@
18#include <linux/config.h> 18#include <linux/config.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/stddef.h> 20#include <linux/stddef.h>
21#include <asm/processor.h>
21 22
22#ifndef MAX_HWIFS 23#ifndef MAX_HWIFS
23# ifdef CONFIG_BLK_DEV_IDEPCI 24# ifdef CONFIG_BLK_DEV_IDEPCI
@@ -104,15 +105,71 @@ static __inline__ unsigned long ide_default_io_base(int index)
104 105
105/* MIPS port and memory-mapped I/O string operations. */ 106/* MIPS port and memory-mapped I/O string operations. */
106 107
107#define __ide_insw insw 108static inline void __ide_flush_dcache_range(unsigned long addr, unsigned long size)
108#define __ide_insl insl 109{
109#define __ide_outsw outsw 110 if (cpu_has_dc_aliases) {
110#define __ide_outsl outsl 111 unsigned long end = addr + size;
112 for (; addr < end; addr += PAGE_SIZE)
113 flush_dcache_page(virt_to_page(addr));
114 }
115}
116
117static inline void __ide_insw(unsigned long port, void *addr,
118 unsigned int count)
119{
120 insw(port, addr, count);
121 __ide_flush_dcache_range((unsigned long)addr, count * 2);
122}
123
124static inline void __ide_insl(unsigned long port, void *addr, unsigned int count)
125{
126 insl(port, addr, count);
127 __ide_flush_dcache_range((unsigned long)addr, count * 4);
128}
129
130static inline void __ide_outsw(unsigned long port, const void *addr,
131 unsigned long count)
132{
133 outsw(port, addr, count);
134 __ide_flush_dcache_range((unsigned long)addr, count * 2);
135}
136
137static inline void __ide_outsl(unsigned long port, const void *addr,
138 unsigned long count)
139{
140 outsl(port, addr, count);
141 __ide_flush_dcache_range((unsigned long)addr, count * 4);
142}
143
144static inline void __ide_mm_insw(void __iomem *port, void *addr, u32 count)
145{
146 readsw(port, addr, count);
147 __ide_flush_dcache_range((unsigned long)addr, count * 2);
148}
149
150static inline void __ide_mm_insl(void __iomem *port, void *addr, u32 count)
151{
152 readsl(port, addr, count);
153 __ide_flush_dcache_range((unsigned long)addr, count * 4);
154}
155
156static inline void __ide_mm_outsw(void __iomem *port, void *addr, u32 count)
157{
158 writesw(port, addr, count);
159 __ide_flush_dcache_range((unsigned long)addr, count * 2);
160}
161
162static inline void __ide_mm_outsl(void __iomem * port, void *addr, u32 count)
163{
164 writesl(port, addr, count);
165 __ide_flush_dcache_range((unsigned long)addr, count * 4);
166}
111 167
112#define __ide_mm_insw readsw 168/* ide_insw calls insw, not __ide_insw. Why? */
113#define __ide_mm_insl readsl 169#undef insw
114#define __ide_mm_outsw writesw 170#undef insl
115#define __ide_mm_outsl writesl 171#define insw(port, addr, count) __ide_insw(port, addr, count)
172#define insl(port, addr, count) __ide_insl(port, addr, count)
116 173
117#endif /* __KERNEL__ */ 174#endif /* __KERNEL__ */
118 175
diff --git a/include/asm-mips/mach-generic/ioremap.h b/include/asm-mips/mach-generic/ioremap.h
new file mode 100644
index 000000000000..9b64ff6e485d
--- /dev/null
+++ b/include/asm-mips/mach-generic/ioremap.h
@@ -0,0 +1,23 @@
1/*
2 * include/asm-mips/mach-generic/ioremap.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#ifndef __ASM_MACH_GENERIC_IOREMAP_H
10#define __ASM_MACH_GENERIC_IOREMAP_H
11
12#include <linux/types.h>
13
14/*
15 * Allow physical addresses to be fixed up to help peripherals located
16 * outside the low 32-bit range -- generic pass-through version.
17 */
18static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
19{
20 return phys_addr;
21}
22
23#endif /* __ASM_MACH_GENERIC_IOREMAP_H */
diff --git a/include/asm-mips/mach-generic/kernel-entry-init.h b/include/asm-mips/mach-generic/kernel-entry-init.h
new file mode 100644
index 000000000000..7e66505fa574
--- /dev/null
+++ b/include/asm-mips/mach-generic/kernel-entry-init.h
@@ -0,0 +1,25 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 Embedded Alley Solutions, Inc
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_MACH_GENERIC_KERNEL_ENTRY_H
10#define __ASM_MACH_GENERIC_KERNEL_ENTRY_H
11
12/* Intentionally empty macro, used in head.S. Override in
13 * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
14 */
15.macro kernel_entry_setup
16.endm
17
18/*
19 * Do SMP slave processor setup necessary before we can savely execute C code.
20 */
21 .macro smp_slave_setup
22 .endm
23
24
25#endif /* __ASM_MACH_GENERIC_KERNEL_ENTRY_H */
diff --git a/include/asm-mips/mach-generic/kmalloc.h b/include/asm-mips/mach-generic/kmalloc.h
new file mode 100644
index 000000000000..373d66dee9d7
--- /dev/null
+++ b/include/asm-mips/mach-generic/kmalloc.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_MACH_GENERIC_KMALLOC_H
2#define __ASM_MACH_GENERIC_KMALLOC_H
3
4#include <linux/config.h>
5
6#ifndef CONFIG_DMA_COHERENT
7/*
8 * Total overkill for most systems but need as a safe default.
9 */
10#define ARCH_KMALLOC_MINALIGN 128
11#endif
12
13#endif /* __ASM_MACH_GENERIC_KMALLOC_H */
diff --git a/include/asm-mips/mach-generic/spaces.h b/include/asm-mips/mach-generic/spaces.h
index 5a2c1efb4eb7..b849d8dd7e78 100644
--- a/include/asm-mips/mach-generic/spaces.h
+++ b/include/asm-mips/mach-generic/spaces.h
@@ -55,13 +55,13 @@
55#endif 55#endif
56 56
57#ifdef CONFIG_DMA_NONCOHERENT 57#ifdef CONFIG_DMA_NONCOHERENT
58#define CAC_BASE 0x9800000000000000 58#define CAC_BASE 0x9800000000000000UL
59#else 59#else
60#define CAC_BASE 0xa800000000000000 60#define CAC_BASE 0xa800000000000000UL
61#endif 61#endif
62#define IO_BASE 0x9000000000000000 62#define IO_BASE 0x9000000000000000UL
63#define UNCAC_BASE 0x9000000000000000 63#define UNCAC_BASE 0x9000000000000000UL
64#define MAP_BASE 0xc000000000000000 64#define MAP_BASE 0xc000000000000000UL
65 65
66#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK)) 66#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
67#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK)) 67#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
diff --git a/include/asm-mips/mach-ip22/cpu-feature-overrides.h b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
index 3c8896d9b133..ab9714668177 100644
--- a/include/asm-mips/mach-ip22/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
@@ -11,6 +11,12 @@
11/* 11/*
12 * IP22 with a variety of processors so we can't use defaults for everything. 12 * IP22 with a variety of processors so we can't use defaults for everything.
13 */ 13 */
14#define cpu_has_tlb 1
15#define cpu_has_4kex 1
16#define cpu_has_4kcache 1
17#define cpu_has_fpu 1
18#define cpu_has_32fpr 1
19#define cpu_has_counter 1
14#define cpu_has_mips16 0 20#define cpu_has_mips16 0
15#define cpu_has_divec 0 21#define cpu_has_divec 0
16#define cpu_has_cache_cdex_p 1 22#define cpu_has_cache_cdex_p 1
@@ -23,6 +29,8 @@
23#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) 29#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
24#define cpu_has_ic_fills_f_dc 0 30#define cpu_has_ic_fills_f_dc 0
25 31
32#define cpu_has_dsp 0
33
26#define cpu_has_nofpuex 0 34#define cpu_has_nofpuex 0
27#define cpu_has_64bits 1 35#define cpu_has_64bits 1
28 36
diff --git a/include/asm-mips/mach-ip22/spaces.h b/include/asm-mips/mach-ip22/spaces.h
index e96166f27c49..8385f716798d 100644
--- a/include/asm-mips/mach-ip22/spaces.h
+++ b/include/asm-mips/mach-ip22/spaces.h
@@ -44,7 +44,7 @@
44#define CAC_BASE 0xffffffff80000000 44#define CAC_BASE 0xffffffff80000000
45#define IO_BASE 0xffffffffa0000000 45#define IO_BASE 0xffffffffa0000000
46#define UNCAC_BASE 0xffffffffa0000000 46#define UNCAC_BASE 0xffffffffa0000000
47#define MAP_BASE 0xffffffffc0000000 47#define MAP_BASE 0xc000000000000000
48 48
49#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK)) 49#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
50#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK)) 50#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
diff --git a/include/asm-mips/mach-ip27/cpu-feature-overrides.h b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
index fe96d7358517..4c8a90051fd0 100644
--- a/include/asm-mips/mach-ip27/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
@@ -25,6 +25,7 @@
25#define cpu_has_vtag_icache 0 25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0 26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0 27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0
28#define cpu_icache_snoops_remote_store 1 29#define cpu_icache_snoops_remote_store 1
29 30
30#define cpu_has_nofpuex 0 31#define cpu_has_nofpuex 0
diff --git a/include/asm-mips/mach-ip27/kernel-entry-init.h b/include/asm-mips/mach-ip27/kernel-entry-init.h
new file mode 100644
index 000000000000..c1a10314b317
--- /dev/null
+++ b/include/asm-mips/mach-ip27/kernel-entry-init.h
@@ -0,0 +1,52 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000 Silicon Graphics, Inc.
7 * Copyright (C) 2005 Ralf Baechle <ralf@linux-mips.org>
8 */
9#ifndef __ASM_MACH_IP27_KERNEL_ENTRY_H
10#define __ASM_MACH_IP27_KERNEL_ENTRY_H
11
12#include <asm/sn/addrs.h>
13#include <asm/sn/sn0/hubni.h>
14#include <asm/sn/klkernvars.h>
15
16/*
17 * Returns the local nasid into res.
18 */
19 .macro GET_NASID_ASM res
20 dli \res, LOCAL_HUB_ADDR(NI_STATUS_REV_ID)
21 ld \res, (\res)
22 and \res, NSRI_NODEID_MASK
23 dsrl \res, NSRI_NODEID_SHFT
24 .endm
25
26/*
27 * Intentionally empty macro, used in head.S. Override in
28 * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
29 */
30 .macro kernel_entry_setup
31 GET_NASID_ASM t1
32 move t2, t1 # text and data are here
33 MAPPED_KERNEL_SETUP_TLB
34 .endm
35
36/*
37 * Do SMP slave processor setup necessary before we can savely execute C code.
38 */
39 .macro smp_slave_setup
40 GET_NASID_ASM t1
41 dli t0, KLDIR_OFFSET + (KLI_KERN_VARS * KLDIR_ENT_SIZE) + \
42 KLDIR_OFF_POINTER + CAC_BASE
43 dsll t1, NASID_SHFT
44 or t0, t0, t1
45 ld t0, 0(t0) # t0 points to kern_vars struct
46 lh t1, KV_RO_NASID_OFFSET(t0)
47 lh t2, KV_RW_NASID_OFFSET(t0)
48 MAPPED_KERNEL_SETUP_TLB
49 ARC64_TWIDDLE_PC
50 .endm
51
52#endif /* __ASM_MACH_IP27_KERNEL_ENTRY_H */
diff --git a/include/asm-mips/mach-ip27/kmalloc.h b/include/asm-mips/mach-ip27/kmalloc.h
new file mode 100644
index 000000000000..426bd049b2d7
--- /dev/null
+++ b/include/asm-mips/mach-ip27/kmalloc.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_MACH_IP27_KMALLOC_H
2#define __ASM_MACH_IP27_KMALLOC_H
3
4/*
5 * All happy, no need to define ARCH_KMALLOC_MINALIGN
6 */
7
8#endif /* __ASM_MACH_IP27_KMALLOC_H */
diff --git a/include/asm-mips/mach-ip27/mmzone.h b/include/asm-mips/mach-ip27/mmzone.h
index d3f566362e9d..986a3b9b59a7 100644
--- a/include/asm-mips/mach-ip27/mmzone.h
+++ b/include/asm-mips/mach-ip27/mmzone.h
@@ -10,7 +10,6 @@
10#define LEVELS_PER_SLICE 128 10#define LEVELS_PER_SLICE 128
11 11
12struct slice_data { 12struct slice_data {
13 unsigned long irq_alloc_mask[2];
14 unsigned long irq_enable_mask[2]; 13 unsigned long irq_enable_mask[2];
15 int level_to_irq[LEVELS_PER_SLICE]; 14 int level_to_irq[LEVELS_PER_SLICE];
16}; 15};
@@ -20,6 +19,7 @@ struct hub_data {
20 DECLARE_BITMAP(h_bigwin_used, HUB_NUM_BIG_WINDOW); 19 DECLARE_BITMAP(h_bigwin_used, HUB_NUM_BIG_WINDOW);
21 cpumask_t h_cpus; 20 cpumask_t h_cpus;
22 unsigned long slice_map; 21 unsigned long slice_map;
22 unsigned long irq_alloc_mask[2];
23 struct slice_data slice[2]; 23 struct slice_data slice[2];
24}; 24};
25 25
diff --git a/include/asm-mips/mach-ip27/spaces.h b/include/asm-mips/mach-ip27/spaces.h
index e3b3fe32eeb1..45e61785ef42 100644
--- a/include/asm-mips/mach-ip27/spaces.h
+++ b/include/asm-mips/mach-ip27/spaces.h
@@ -20,6 +20,7 @@
20#define IO_BASE 0x9200000000000000 20#define IO_BASE 0x9200000000000000
21#define MSPEC_BASE 0x9400000000000000 21#define MSPEC_BASE 0x9400000000000000
22#define UNCAC_BASE 0x9600000000000000 22#define UNCAC_BASE 0x9600000000000000
23#define MAP_BASE 0xc000000000000000
23 24
24#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK)) 25#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
25#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK)) 26#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
diff --git a/include/asm-mips/mach-ip27/topology.h b/include/asm-mips/mach-ip27/topology.h
index a70a81257c3d..82141c711c33 100644
--- a/include/asm-mips/mach-ip27/topology.h
+++ b/include/asm-mips/mach-ip27/topology.h
@@ -9,6 +9,9 @@
9#define parent_node(node) (node) 9#define parent_node(node) (node)
10#define node_to_cpumask(node) (hub_data(node)->h_cpus) 10#define node_to_cpumask(node) (hub_data(node)->h_cpus)
11#define node_to_first_cpu(node) (first_cpu(node_to_cpumask(node))) 11#define node_to_first_cpu(node) (first_cpu(node_to_cpumask(node)))
12struct pci_bus;
13extern int pcibus_to_node(struct pci_bus *);
14
12#define pcibus_to_cpumask(bus) (cpu_online_map) 15#define pcibus_to_cpumask(bus) (cpu_online_map)
13 16
14extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; 17extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
diff --git a/include/asm-mips/mach-ip32/cpu-feature-overrides.h b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
index 04713973c6c3..ab37fc1842ba 100644
--- a/include/asm-mips/mach-ip32/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
@@ -37,5 +37,6 @@
37#define cpu_has_ejtag 0 37#define cpu_has_ejtag 0
38#define cpu_has_vtag_icache 0 38#define cpu_has_vtag_icache 0
39#define cpu_has_ic_fills_f_dc 0 39#define cpu_has_ic_fills_f_dc 0
40#define cpu_has_dsp 0
40 41
41#endif /* __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H */ 42#endif /* __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip32/kmalloc.h b/include/asm-mips/mach-ip32/kmalloc.h
new file mode 100644
index 000000000000..9d2d4d9ac036
--- /dev/null
+++ b/include/asm-mips/mach-ip32/kmalloc.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_MACH_IP32_KMALLOC_H
2#define __ASM_MACH_IP32_KMALLOC_H
3
4#include <linux/config.h>
5
6#if defined(CONFIG_CPU_R5000) || defined (CONFIG_CPU_RM7000)
7#define ARCH_KMALLOC_MINALIGN 32
8#else
9#define ARCH_KMALLOC_MINALIGN 128
10#endif
11
12#endif /* __ASM_MACH_IP32_KMALLOC_H */
diff --git a/include/asm-mips/mach-ip32/spaces.h b/include/asm-mips/mach-ip32/spaces.h
index c7839f85c68d..44abe5c02389 100644
--- a/include/asm-mips/mach-ip32/spaces.h
+++ b/include/asm-mips/mach-ip32/spaces.h
@@ -19,10 +19,10 @@
19#define HIGHMEM_START (1UL << 59UL) 19#define HIGHMEM_START (1UL << 59UL)
20#endif 20#endif
21 21
22#define CAC_BASE 0x9800000000000000 22#define CAC_BASE 0x9800000000000000UL
23#define IO_BASE 0x9000000000000000 23#define IO_BASE 0x9000000000000000UL
24#define UNCAC_BASE 0x9000000000000000 24#define UNCAC_BASE 0x9000000000000000UL
25#define MAP_BASE 0xc000000000000000 25#define MAP_BASE 0xc000000000000000UL
26 26
27#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK)) 27#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
28#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK)) 28#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
diff --git a/include/asm-mips/mach-ja/cpu-feature-overrides.h b/include/asm-mips/mach-ja/cpu-feature-overrides.h
index ca57e7db98bb..a0fde405d4c4 100644
--- a/include/asm-mips/mach-ja/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ja/cpu-feature-overrides.h
@@ -25,6 +25,7 @@
25#define cpu_has_vtag_icache 0 25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0 26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0 27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0
28#define cpu_icache_snoops_remote_store 0 29#define cpu_icache_snoops_remote_store 0
29 30
30#define cpu_has_nofpuex 0 31#define cpu_has_nofpuex 0
@@ -36,10 +37,4 @@
36#define cpu_icache_line_size() 32 37#define cpu_icache_line_size() 32
37#define cpu_scache_line_size() 32 38#define cpu_scache_line_size() 32
38 39
39/*
40 * On the RM9000 we need to ensure that I-cache lines being fetches only
41 * contain valid instructions are funny things will happen.
42 */
43#define PLAT_TRAMPOLINE_STUFF_LINE 32UL
44
45#endif /* __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H */ 40#endif /* __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-mips/cpu-feature-overrides.h b/include/asm-mips/mach-mips/cpu-feature-overrides.h
index 6f51be571bf0..9f92aed17754 100644
--- a/include/asm-mips/mach-mips/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-mips/cpu-feature-overrides.h
@@ -17,7 +17,7 @@
17#ifdef CONFIG_CPU_MIPS32 17#ifdef CONFIG_CPU_MIPS32
18#define cpu_has_tlb 1 18#define cpu_has_tlb 1
19#define cpu_has_4kex 1 19#define cpu_has_4kex 1
20#define cpu_has_4ktlb 1 20#define cpu_has_4kcache 1
21/* #define cpu_has_fpu ? */ 21/* #define cpu_has_fpu ? */
22/* #define cpu_has_32fpr ? */ 22/* #define cpu_has_32fpr ? */
23#define cpu_has_counter 1 23#define cpu_has_counter 1
@@ -37,12 +37,13 @@
37/* #define cpu_has_64bits ? */ 37/* #define cpu_has_64bits ? */
38/* #define cpu_has_64bit_zero_reg ? */ 38/* #define cpu_has_64bit_zero_reg ? */
39/* #define cpu_has_subset_pcaches ? */ 39/* #define cpu_has_subset_pcaches ? */
40#define cpu_icache_snoops_remote_store 1
40#endif 41#endif
41 42
42#ifdef CONFIG_CPU_MIPS64 43#ifdef CONFIG_CPU_MIPS64
43#define cpu_has_tlb 1 44#define cpu_has_tlb 1
44#define cpu_has_4kex 1 45#define cpu_has_4kex 1
45#define cpu_has_4ktlb 1 46#define cpu_has_4kcache 1
46/* #define cpu_has_fpu ? */ 47/* #define cpu_has_fpu ? */
47/* #define cpu_has_32fpr ? */ 48/* #define cpu_has_32fpr ? */
48#define cpu_has_counter 1 49#define cpu_has_counter 1
@@ -62,6 +63,7 @@
62/* #define cpu_has_64bits ? */ 63/* #define cpu_has_64bits ? */
63/* #define cpu_has_64bit_zero_reg ? */ 64/* #define cpu_has_64bit_zero_reg ? */
64/* #define cpu_has_subset_pcaches ? */ 65/* #define cpu_has_subset_pcaches ? */
66#define cpu_icache_snoops_remote_store 1
65#endif 67#endif
66 68
67#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */ 69#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-mips/irq.h b/include/asm-mips/mach-mips/irq.h
new file mode 100644
index 000000000000..f8579696ca54
--- /dev/null
+++ b/include/asm-mips/mach-mips/irq.h
@@ -0,0 +1,14 @@
1#ifndef __ASM_MACH_MIPS_IRQ_H
2#define __ASM_MACH_MIPS_IRQ_H
3
4#include <linux/config.h>
5
6#define NR_IRQS 256
7
8#ifdef CONFIG_SMP
9
10#define ARCH_HAS_IRQ_PER_CPU
11
12#endif
13
14#endif /* __ASM_MACH_MIPS_IRQ_H */
diff --git a/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h b/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
index 7473512384bc..825c5f674dfc 100644
--- a/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
@@ -28,6 +28,7 @@
28#define cpu_has_vtag_icache 0 28#define cpu_has_vtag_icache 0
29#define cpu_has_dc_aliases 0 29#define cpu_has_dc_aliases 0
30#define cpu_has_ic_fills_f_dc 0 30#define cpu_has_ic_fills_f_dc 0
31#define cpu_has_dsp 0
31#define cpu_icache_snoops_remote_store 0 32#define cpu_icache_snoops_remote_store 0
32 33
33#define cpu_has_nofpuex 0 34#define cpu_has_nofpuex 0
@@ -39,10 +40,4 @@
39#define cpu_icache_line_size() 32 40#define cpu_icache_line_size() 32
40#define cpu_scache_line_size() 32 41#define cpu_scache_line_size() 32
41 42
42/*
43 * On the RM9000 we need to ensure that I-cache lines being fetches only
44 * contain valid instructions are funny things will happen.
45 */
46#define PLAT_TRAMPOLINE_STUFF_LINE 32UL
47
48#endif /* __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H */ 43#endif /* __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1200.h b/include/asm-mips/mach-pb1x00/pb1200.h
new file mode 100644
index 000000000000..9a3088b19bf3
--- /dev/null
+++ b/include/asm-mips/mach-pb1x00/pb1200.h
@@ -0,0 +1,252 @@
1/*
2 * AMD Alchemy PB1200 Referrence Board
3 * Board Registers defines.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 *
23 */
24#ifndef __ASM_PB1200_H
25#define __ASM_PB1200_H
26
27#include <linux/types.h>
28
29// This is defined in au1000.h with bogus value
30#undef AU1X00_EXTERNAL_INT
31
32#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
33#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
34#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX
35#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
36
37/* SPI and SMB are muxed on the Pb1200 board.
38 Refer to board documentation.
39 */
40#define SPI_PSC_BASE PSC0_BASE_ADDR
41#define SMBUS_PSC_BASE PSC0_BASE_ADDR
42/* AC97 and I2S are muxed on the Pb1200 board.
43 Refer to board documentation.
44 */
45#define AC97_PSC_BASE PSC1_BASE_ADDR
46#define I2S_PSC_BASE PSC1_BASE_ADDR
47
48#define BCSR_KSEG1_ADDR 0xAD800000
49
50typedef volatile struct
51{
52 /*00*/ u16 whoami;
53 u16 reserved0;
54 /*04*/ u16 status;
55 u16 reserved1;
56 /*08*/ u16 switches;
57 u16 reserved2;
58 /*0C*/ u16 resets;
59 u16 reserved3;
60
61 /*10*/ u16 pcmcia;
62 u16 reserved4;
63 /*14*/ u16 board;
64 u16 reserved5;
65 /*18*/ u16 disk_leds;
66 u16 reserved6;
67 /*1C*/ u16 system;
68 u16 reserved7;
69
70 /*20*/ u16 intclr;
71 u16 reserved8;
72 /*24*/ u16 intset;
73 u16 reserved9;
74 /*28*/ u16 intclr_mask;
75 u16 reserved10;
76 /*2C*/ u16 intset_mask;
77 u16 reserved11;
78
79 /*30*/ u16 sig_status;
80 u16 reserved12;
81 /*34*/ u16 int_status;
82 u16 reserved13;
83 /*38*/ u16 reserved14;
84 u16 reserved15;
85 /*3C*/ u16 reserved16;
86 u16 reserved17;
87
88} BCSR;
89
90static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
91
92/*
93 * Register bit definitions for the BCSRs
94 */
95#define BCSR_WHOAMI_DCID 0x000F
96#define BCSR_WHOAMI_CPLD 0x00F0
97#define BCSR_WHOAMI_BOARD 0x0F00
98
99#define BCSR_STATUS_PCMCIA0VS 0x0003
100#define BCSR_STATUS_PCMCIA1VS 0x000C
101#define BCSR_STATUS_SWAPBOOT 0x0040
102#define BCSR_STATUS_FLASHBUSY 0x0100
103#define BCSR_STATUS_IDECBLID 0x0200
104#define BCSR_STATUS_SD0WP 0x0400
105#define BCSR_STATUS_SD1WP 0x0800
106#define BCSR_STATUS_U0RXD 0x1000
107#define BCSR_STATUS_U1RXD 0x2000
108
109#define BCSR_SWITCHES_OCTAL 0x00FF
110#define BCSR_SWITCHES_DIP_1 0x0080
111#define BCSR_SWITCHES_DIP_2 0x0040
112#define BCSR_SWITCHES_DIP_3 0x0020
113#define BCSR_SWITCHES_DIP_4 0x0010
114#define BCSR_SWITCHES_DIP_5 0x0008
115#define BCSR_SWITCHES_DIP_6 0x0004
116#define BCSR_SWITCHES_DIP_7 0x0002
117#define BCSR_SWITCHES_DIP_8 0x0001
118#define BCSR_SWITCHES_ROTARY 0x0F00
119
120#define BCSR_RESETS_ETH 0x0001
121#define BCSR_RESETS_CAMERA 0x0002
122#define BCSR_RESETS_DC 0x0004
123#define BCSR_RESETS_IDE 0x0008
124/* not resets but in the same register */
125#define BCSR_RESETS_WSCFSM 0x0800
126#define BCSR_RESETS_PCS0MUX 0x1000
127#define BCSR_RESETS_PCS1MUX 0x2000
128#define BCSR_RESETS_SPISEL 0x4000
129#define BCSR_RESETS_SD1MUX 0x8000
130
131#define BCSR_PCMCIA_PC0VPP 0x0003
132#define BCSR_PCMCIA_PC0VCC 0x000C
133#define BCSR_PCMCIA_PC0DRVEN 0x0010
134#define BCSR_PCMCIA_PC0RST 0x0080
135#define BCSR_PCMCIA_PC1VPP 0x0300
136#define BCSR_PCMCIA_PC1VCC 0x0C00
137#define BCSR_PCMCIA_PC1DRVEN 0x1000
138#define BCSR_PCMCIA_PC1RST 0x8000
139
140#define BCSR_BOARD_LCDVEE 0x0001
141#define BCSR_BOARD_LCDVDD 0x0002
142#define BCSR_BOARD_LCDBL 0x0004
143#define BCSR_BOARD_CAMSNAP 0x0010
144#define BCSR_BOARD_CAMPWR 0x0020
145#define BCSR_BOARD_SD0PWR 0x0040
146#define BCSR_BOARD_SD1PWR 0x0080
147
148#define BCSR_LEDS_DECIMALS 0x00FF
149#define BCSR_LEDS_LED0 0x0100
150#define BCSR_LEDS_LED1 0x0200
151#define BCSR_LEDS_LED2 0x0400
152#define BCSR_LEDS_LED3 0x0800
153
154#define BCSR_SYSTEM_VDDI 0x001F
155#define BCSR_SYSTEM_POWEROFF 0x4000
156#define BCSR_SYSTEM_RESET 0x8000
157
158/* Bit positions for the different interrupt sources */
159#define BCSR_INT_IDE 0x0001
160#define BCSR_INT_ETH 0x0002
161#define BCSR_INT_PC0 0x0004
162#define BCSR_INT_PC0STSCHG 0x0008
163#define BCSR_INT_PC1 0x0010
164#define BCSR_INT_PC1STSCHG 0x0020
165#define BCSR_INT_DC 0x0040
166#define BCSR_INT_FLASHBUSY 0x0080
167#define BCSR_INT_PC0INSERT 0x0100
168#define BCSR_INT_PC0EJECT 0x0200
169#define BCSR_INT_PC1INSERT 0x0400
170#define BCSR_INT_PC1EJECT 0x0800
171#define BCSR_INT_SD0INSERT 0x1000
172#define BCSR_INT_SD0EJECT 0x2000
173#define BCSR_INT_SD1INSERT 0x4000
174#define BCSR_INT_SD1EJECT 0x8000
175
176/* PCMCIA Db1x00 specific defines */
177#define PCMCIA_MAX_SOCK 1
178#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
179
180/* VPP/VCC */
181#define SET_VCC_VPP(VCC, VPP, SLOT)\
182 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
183
184#define AU1XXX_SMC91111_PHYS_ADDR (0x0D000300)
185#define AU1XXX_SMC91111_IRQ PB1200_ETH_INT
186
187#define AU1XXX_ATA_PHYS_ADDR (0x0C800000)
188#define AU1XXX_ATA_PHYS_LEN (0x100)
189#define AU1XXX_ATA_REG_OFFSET (5)
190#define AU1XXX_ATA_INT PB1200_IDE_INT
191#define AU1XXX_ATA_DDMA_REQ DSCR_CMD0_DMA_REQ1;
192#define AU1XXX_ATA_RQSIZE 128
193
194#define NAND_PHYS_ADDR 0x1C000000
195
196/* Timing values as described in databook, * ns value stripped of
197 * lower 2 bits.
198 * These defines are here rather than an SOC1200 generic file because
199 * the parts chosen on another board may be different and may require
200 * different timings.
201 */
202#define NAND_T_H (18 >> 2)
203#define NAND_T_PUL (30 >> 2)
204#define NAND_T_SU (30 >> 2)
205#define NAND_T_WH (30 >> 2)
206
207/* Bitfield shift amounts */
208#define NAND_T_H_SHIFT 0
209#define NAND_T_PUL_SHIFT 4
210#define NAND_T_SU_SHIFT 8
211#define NAND_T_WH_SHIFT 12
212
213#define NAND_TIMING ((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
214 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
215 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
216 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT)
217
218
219/*
220 * External Interrupts for Pb1200 as of 8/6/2004.
221 * Bit positions in the CPLD registers can be calculated by taking
222 * the interrupt define and subtracting the PB1200_INT_BEGIN value.
223 * *example: IDE bis pos is = 64 - 64
224 ETH bit pos is = 65 - 64
225 */
226#define PB1200_INT_BEGIN (AU1000_LAST_INTC1_INT + 1)
227#define PB1200_IDE_INT (PB1200_INT_BEGIN + 0)
228#define PB1200_ETH_INT (PB1200_INT_BEGIN + 1)
229#define PB1200_PC0_INT (PB1200_INT_BEGIN + 2)
230#define PB1200_PC0_STSCHG_INT (PB1200_INT_BEGIN + 3)
231#define PB1200_PC1_INT (PB1200_INT_BEGIN + 4)
232#define PB1200_PC1_STSCHG_INT (PB1200_INT_BEGIN + 5)
233#define PB1200_DC_INT (PB1200_INT_BEGIN + 6)
234#define PB1200_FLASHBUSY_INT (PB1200_INT_BEGIN + 7)
235#define PB1200_PC0_INSERT_INT (PB1200_INT_BEGIN + 8)
236#define PB1200_PC0_EJECT_INT (PB1200_INT_BEGIN + 9)
237#define PB1200_PC1_INSERT_INT (PB1200_INT_BEGIN + 10)
238#define PB1200_PC1_EJECT_INT (PB1200_INT_BEGIN + 11)
239#define PB1200_SD0_INSERT_INT (PB1200_INT_BEGIN + 12)
240#define PB1200_SD0_EJECT_INT (PB1200_INT_BEGIN + 13)
241#define PB1200_SD1_INSERT_INT (PB1200_INT_BEGIN + 14)
242#define PB1200_SD1_EJECT_INT (PB1200_INT_BEGIN + 15)
243
244#define PB1200_INT_END (PB1200_INT_BEGIN + 15)
245
246/* For drivers/pcmcia/au1000_db1x00.c */
247#define BOARD_PC0_INT PB1200_PC0_INT
248#define BOARD_PC1_INT PB1200_PC1_INT
249#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1<<(8+(2*SOCKET)))
250
251#endif /* __ASM_PB1200_H */
252
diff --git a/include/asm-mips/mach-pnx8550/cm.h b/include/asm-mips/mach-pnx8550/cm.h
new file mode 100644
index 000000000000..bb0a56c7d011
--- /dev/null
+++ b/include/asm-mips/mach-pnx8550/cm.h
@@ -0,0 +1,43 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Clock module specific definitions
5 *
6 * Author: source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * 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 it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 */
21
22#ifndef __PNX8550_CM_H
23#define __PNX8550_CM_H
24
25#define PNX8550_CM_BASE 0xBBE47000
26
27#define PNX8550_CM_PLL0_CTL *(volatile unsigned long *)(PNX8550_CM_BASE + 0x000)
28#define PNX8550_CM_PLL1_CTL *(volatile unsigned long *)(PNX8550_CM_BASE + 0x004)
29#define PNX8550_CM_PLL2_CTL *(volatile unsigned long *)(PNX8550_CM_BASE + 0x008)
30#define PNX8550_CM_PLL3_CTL *(volatile unsigned long *)(PNX8550_CM_BASE + 0x00C)
31
32// Table not complete.....
33
34#define PNX8550_CM_PLL_BLOCKED_MASK 0x80000000
35#define PNX8550_CM_PLL_LOCK_MASK 0x40000000
36#define PNX8550_CM_PLL_CURRENT_ADJ_MASK 0x3c000000
37#define PNX8550_CM_PLL_N_MASK 0x01ff0000
38#define PNX8550_CM_PLL_M_MASK 0x00003f00
39#define PNX8550_CM_PLL_P_MASK 0x0000000c
40#define PNX8550_CM_PLL_PD_MASK 0x00000002
41
42
43#endif
diff --git a/include/asm-mips/mach-pnx8550/glb.h b/include/asm-mips/mach-pnx8550/glb.h
new file mode 100644
index 000000000000..07aa85e609bc
--- /dev/null
+++ b/include/asm-mips/mach-pnx8550/glb.h
@@ -0,0 +1,86 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * PNX8550 global definitions
5 *
6 * Author: source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * 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 it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 */
21
22#ifndef __PNX8550_GLB_H
23#define __PNX8550_GLB_H
24
25#define PNX8550_GLB1_BASE 0xBBE63000
26#define PNX8550_GLB2_BASE 0xBBE4d000
27#define PNX8550_RESET_BASE 0xBBE60000
28
29/* PCI Inta Output Enable Registers */
30#define PNX8550_GLB2_ENAB_INTA_O *(volatile unsigned long *)(PNX8550_GLB2_BASE + 0x050)
31
32/* Bit 1:Enable DAC Powerdown
33 0:DACs are enabled and are working normally
34 1:DACs are powerdown
35*/
36#define PNX8550_GLB_DAC_PD 0x2
37/* Bit 0:Enable of PCI inta output
38 0 = Disable PCI inta output
39 1 = Enable PCI inta output
40*/
41#define PNX8550_GLB_ENABLE_INTA_O 0x1
42
43/* PCI Direct Mappings */
44#define PNX8550_PCIMEM 0x12000000
45#define PNX8550_PCIMEM_SIZE 0x08000000
46#define PNX8550_PCIIO 0x1c000000
47#define PNX8550_PCIIO_SIZE 0x02000000 /* 32M */
48
49#define PNX8550_PORT_BASE KSEG1
50
51// GPIO def
52#define PNX8550_GPIO_BASE 0x1Be00000
53
54#define PNX8550_GPIO_DIRQ0 (PNX8550_GPIO_BASE + 0x104500)
55#define PNX8550_GPIO_MC1 (PNX8550_GPIO_BASE + 0x104004)
56#define PNX8550_GPIO_MC_31_BIT 30
57#define PNX8550_GPIO_MC_30_BIT 28
58#define PNX8550_GPIO_MC_29_BIT 26
59#define PNX8550_GPIO_MC_28_BIT 24
60#define PNX8550_GPIO_MC_27_BIT 22
61#define PNX8550_GPIO_MC_26_BIT 20
62#define PNX8550_GPIO_MC_25_BIT 18
63#define PNX8550_GPIO_MC_24_BIT 16
64#define PNX8550_GPIO_MC_23_BIT 14
65#define PNX8550_GPIO_MC_22_BIT 12
66#define PNX8550_GPIO_MC_21_BIT 10
67#define PNX8550_GPIO_MC_20_BIT 8
68#define PNX8550_GPIO_MC_19_BIT 6
69#define PNX8550_GPIO_MC_18_BIT 4
70#define PNX8550_GPIO_MC_17_BIT 2
71#define PNX8550_GPIO_MC_16_BIT 0
72
73#define PNX8550_GPIO_MODE_PRIMOP 0x1
74#define PNX8550_GPIO_MODE_NO_OPENDR 0x2
75#define PNX8550_GPIO_MODE_OPENDR 0x3
76
77// RESET module
78#define PNX8550_RST_CTL *(volatile unsigned long *)(PNX8550_RESET_BASE + 0x0)
79#define PNX8550_RST_CAUSE *(volatile unsigned long *)(PNX8550_RESET_BASE + 0x4)
80#define PNX8550_RST_EN_WATCHDOG *(volatile unsigned long *)(PNX8550_RESET_BASE + 0x8)
81
82#define PNX8550_RST_REL_MIPS_RST_N 0x8
83#define PNX8550_RST_DO_SW_RST 0x4
84#define PNX8550_RST_REL_SYS_RST_OUT 0x2
85#define PNX8550_RST_ASSERT_SYS_RST_OUT 0x1
86#endif
diff --git a/include/asm-mips/mach-pnx8550/int.h b/include/asm-mips/mach-pnx8550/int.h
new file mode 100644
index 000000000000..0e0668b524f4
--- /dev/null
+++ b/include/asm-mips/mach-pnx8550/int.h
@@ -0,0 +1,140 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Interrupt specific definitions
5 *
6 * Author: source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * 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 it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 */
21
22#ifndef __PNX8550_INT_H
23#define __PNX8550_INT_H
24
25#define PNX8550_GIC_BASE 0xBBE3E000
26
27#define PNX8550_GIC_PRIMASK_0 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x000)
28#define PNX8550_GIC_PRIMASK_1 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x004)
29#define PNX8550_GIC_VECTOR_0 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x100)
30#define PNX8550_GIC_VECTOR_1 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x104)
31#define PNX8550_GIC_PEND_1_31 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x200)
32#define PNX8550_GIC_PEND_32_63 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x204)
33#define PNX8550_GIC_PEND_64_70 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x208)
34#define PNX8550_GIC_FEATURES *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x300)
35#define PNX8550_GIC_REQ(x) *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x400 + (x)*4)
36#define PNX8550_GIC_MOD_ID *(volatile unsigned long *)(PNX8550_GIC_BASE + 0xFFC)
37
38// cp0 is two software + six hw exceptions
39#define PNX8550_INT_CP0_TOTINT 8
40#define PNX8550_INT_CP0_MIN 0
41#define PNX8550_INT_CP0_MAX (PNX8550_INT_CP0_MIN + PNX8550_INT_CP0_TOTINT - 1)
42
43#define MIPS_CPU_GIC_IRQ 2
44#define MIPS_CPU_TIMER_IRQ 7
45
46// GIC are 71 exceptions connected to cp0's first hardware exception
47#define PNX8550_INT_GIC_TOTINT 71
48#define PNX8550_INT_GIC_MIN (PNX8550_INT_CP0_MAX+1)
49#define PNX8550_INT_GIC_MAX (PNX8550_INT_GIC_MIN + PNX8550_INT_GIC_TOTINT - 1)
50
51#define PNX8550_INT_UNDEF (PNX8550_INT_GIC_MIN+0)
52#define PNX8550_INT_IPC_TARGET0_MIPS (PNX8550_INT_GIC_MIN+1)
53#define PNX8550_INT_IPC_TARGET1_TM32_1 (PNX8550_INT_GIC_MIN+2)
54#define PNX8550_INT_IPC_TARGET1_TM32_2 (PNX8550_INT_GIC_MIN+3)
55#define PNX8550_INT_RESERVED_4 (PNX8550_INT_GIC_MIN+4)
56#define PNX8550_INT_USB (PNX8550_INT_GIC_MIN+5)
57#define PNX8550_INT_GPIO_EQ1 (PNX8550_INT_GIC_MIN+6)
58#define PNX8550_INT_GPIO_EQ2 (PNX8550_INT_GIC_MIN+7)
59#define PNX8550_INT_GPIO_EQ3 (PNX8550_INT_GIC_MIN+8)
60#define PNX8550_INT_GPIO_EQ4 (PNX8550_INT_GIC_MIN+9)
61
62#define PNX8550_INT_GPIO_EQ5 (PNX8550_INT_GIC_MIN+10)
63#define PNX8550_INT_GPIO_EQ6 (PNX8550_INT_GIC_MIN+11)
64#define PNX8550_INT_RESERVED_12 (PNX8550_INT_GIC_MIN+12)
65#define PNX8550_INT_QVCP1 (PNX8550_INT_GIC_MIN+13)
66#define PNX8550_INT_QVCP2 (PNX8550_INT_GIC_MIN+14)
67#define PNX8550_INT_I2C1 (PNX8550_INT_GIC_MIN+15)
68#define PNX8550_INT_I2C2 (PNX8550_INT_GIC_MIN+16)
69#define PNX8550_INT_ISO_UART1 (PNX8550_INT_GIC_MIN+17)
70#define PNX8550_INT_ISO_UART2 (PNX8550_INT_GIC_MIN+18)
71#define PNX8550_INT_UART1 (PNX8550_INT_GIC_MIN+19)
72
73#define PNX8550_INT_UART2 (PNX8550_INT_GIC_MIN+20)
74#define PNX8550_INT_QNTR (PNX8550_INT_GIC_MIN+21)
75#define PNX8550_INT_RESERVED22 (PNX8550_INT_GIC_MIN+22)
76#define PNX8550_INT_T_DSC (PNX8550_INT_GIC_MIN+23)
77#define PNX8550_INT_M_DSC (PNX8550_INT_GIC_MIN+24)
78#define PNX8550_INT_RESERVED25 (PNX8550_INT_GIC_MIN+25)
79#define PNX8550_INT_2D_DRAW_ENG (PNX8550_INT_GIC_MIN+26)
80#define PNX8550_INT_MEM_BASED_SCALAR1 (PNX8550_INT_GIC_MIN+27)
81#define PNX8550_INT_VIDEO_MPEG (PNX8550_INT_GIC_MIN+28)
82#define PNX8550_INT_VIDEO_INPUT_P1 (PNX8550_INT_GIC_MIN+29)
83
84#define PNX8550_INT_VIDEO_INPUT_P2 (PNX8550_INT_GIC_MIN+30)
85#define PNX8550_INT_SPDI1 (PNX8550_INT_GIC_MIN+31)
86#define PNX8550_INT_SPDO (PNX8550_INT_GIC_MIN+32)
87#define PNX8550_INT_AUDIO_INPUT1 (PNX8550_INT_GIC_MIN+33)
88#define PNX8550_INT_AUDIO_OUTPUT1 (PNX8550_INT_GIC_MIN+34)
89#define PNX8550_INT_AUDIO_INPUT2 (PNX8550_INT_GIC_MIN+35)
90#define PNX8550_INT_AUDIO_OUTPUT2 (PNX8550_INT_GIC_MIN+36)
91#define PNX8550_INT_MEMBASED_SCALAR2 (PNX8550_INT_GIC_MIN+37)
92#define PNX8550_INT_VPK (PNX8550_INT_GIC_MIN+38)
93#define PNX8550_INT_MPEG1_MIPS (PNX8550_INT_GIC_MIN+39)
94
95#define PNX8550_INT_MPEG1_TM (PNX8550_INT_GIC_MIN+40)
96#define PNX8550_INT_MPEG2_MIPS (PNX8550_INT_GIC_MIN+41)
97#define PNX8550_INT_MPEG2_TM (PNX8550_INT_GIC_MIN+42)
98#define PNX8550_INT_TS_DMA (PNX8550_INT_GIC_MIN+43)
99#define PNX8550_INT_EDMA (PNX8550_INT_GIC_MIN+44)
100#define PNX8550_INT_TM_DEBUG1 (PNX8550_INT_GIC_MIN+45)
101#define PNX8550_INT_TM_DEBUG2 (PNX8550_INT_GIC_MIN+46)
102#define PNX8550_INT_PCI_INTA (PNX8550_INT_GIC_MIN+47)
103#define PNX8550_INT_CLOCK_MODULE (PNX8550_INT_GIC_MIN+48)
104#define PNX8550_INT_PCI_XIO_INTA_PCI (PNX8550_INT_GIC_MIN+49)
105
106#define PNX8550_INT_PCI_XIO_INTB_DMA (PNX8550_INT_GIC_MIN+50)
107#define PNX8550_INT_PCI_XIO_INTC_GPPM (PNX8550_INT_GIC_MIN+51)
108#define PNX8550_INT_PCI_XIO_INTD_GPXIO (PNX8550_INT_GIC_MIN+52)
109#define PNX8550_INT_DVD_CSS (PNX8550_INT_GIC_MIN+53)
110#define PNX8550_INT_VLD (PNX8550_INT_GIC_MIN+54)
111#define PNX8550_INT_GPIO_TSU_7_0 (PNX8550_INT_GIC_MIN+55)
112#define PNX8550_INT_GPIO_TSU_15_8 (PNX8550_INT_GIC_MIN+56)
113#define PNX8550_INT_GPIO_CTU_IR (PNX8550_INT_GIC_MIN+57)
114#define PNX8550_INT_GPIO0 (PNX8550_INT_GIC_MIN+58)
115#define PNX8550_INT_GPIO1 (PNX8550_INT_GIC_MIN+59)
116
117#define PNX8550_INT_GPIO2 (PNX8550_INT_GIC_MIN+60)
118#define PNX8550_INT_GPIO3 (PNX8550_INT_GIC_MIN+61)
119#define PNX8550_INT_GPIO4 (PNX8550_INT_GIC_MIN+62)
120#define PNX8550_INT_GPIO5 (PNX8550_INT_GIC_MIN+63)
121#define PNX8550_INT_GPIO6 (PNX8550_INT_GIC_MIN+64)
122#define PNX8550_INT_GPIO7 (PNX8550_INT_GIC_MIN+65)
123#define PNX8550_INT_PMAN_SECURITY (PNX8550_INT_GIC_MIN+66)
124#define PNX8550_INT_I2C3 (PNX8550_INT_GIC_MIN+67)
125#define PNX8550_INT_RESERVED_68 (PNX8550_INT_GIC_MIN+68)
126#define PNX8550_INT_SPDI2 (PNX8550_INT_GIC_MIN+69)
127
128#define PNX8550_INT_I2C4 (PNX8550_INT_GIC_MIN+70)
129
130// Timer are 3 exceptions connected to cp0's 7th hardware exception
131#define PNX8550_INT_TIMER_TOTINT 3
132#define PNX8550_INT_TIMER_MIN (PNX8550_INT_GIC_MAX+1)
133#define PNX8550_INT_TIMER_MAX (PNX8550_INT_TIMER_MIN + PNX8550_INT_TIMER_TOTINT - 1)
134
135#define PNX8550_INT_TIMER1 (PNX8550_INT_TIMER_MIN+0)
136#define PNX8550_INT_TIMER2 (PNX8550_INT_TIMER_MIN+1)
137#define PNX8550_INT_TIMER3 (PNX8550_INT_TIMER_MIN+2)
138#define PNX8550_INT_WATCHDOG PNX8550_INT_TIMER3
139
140#endif
diff --git a/include/asm-mips/mach-pnx8550/kernel-entry-init.h b/include/asm-mips/mach-pnx8550/kernel-entry-init.h
new file mode 100644
index 000000000000..57102fa9da51
--- /dev/null
+++ b/include/asm-mips/mach-pnx8550/kernel-entry-init.h
@@ -0,0 +1,262 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 Embedded Alley Solutions, Inc
7 */
8#ifndef __ASM_MACH_KERNEL_ENTRY_INIT_H
9#define __ASM_MACH_KERNEL_ENTRY_INIT_H
10
11#include <asm/cacheops.h>
12#include <asm/addrspace.h>
13
14#define CO_CONFIGPR_VALID 0x3F1F41FF /* valid bits to write to ConfigPR */
15#define HAZARD_CP0 nop; nop; nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;
16#define CACHE_OPC 0xBC000000 /* MIPS cache instruction opcode */
17#define ICACHE_LINE_SIZE 32 /* Instruction cache line size bytes */
18#define DCACHE_LINE_SIZE 32 /* Data cache line size in bytes */
19
20#define ICACHE_SET_COUNT 256 /* Instruction cache set count */
21#define DCACHE_SET_COUNT 128 /* Data cache set count */
22
23#define ICACHE_SET_SIZE (ICACHE_SET_COUNT * ICACHE_LINE_SIZE)
24#define DCACHE_SET_SIZE (DCACHE_SET_COUNT * DCACHE_LINE_SIZE)
25
26 .macro kernel_entry_setup
27 .set push
28 .set noreorder
29 /*
30 * PNX8550 entry point, when running a non compressed
31 * kernel. When loading a zImage, the head.S code in
32 * arch/mips/zboot/pnx8550 will init the caches and,
33 * decompress the kernel, and branch to kernel_entry.
34 */
35cache_begin: li t0, (1<<28)
36 mtc0 t0, CP0_STATUS /* cp0 usable */
37 HAZARD_CP0
38
39 mtc0 zero, CP0_CAUSE
40 HAZARD_CP0
41
42
43 /* Set static virtual to phys address translation and TLB disabled */
44 mfc0 t0, CP0_CONFIG, 7
45 HAZARD_CP0
46
47 and t0,~((1<<19) | (1<<20)) /* TLB/MAP cleared */
48 mtc0 t0, CP0_CONFIG, 7
49 HAZARD_CP0
50
51 /* CPU boots with kseg0 cache algo set to 0x2 -- uncached */
52
53 init_icache
54 nop
55 init_dcache
56 nop
57
58 cachePr4450ICReset
59 nop
60
61 cachePr4450DCReset
62 nop
63
64 /* read ConfigPR into t0 */
65 mfc0 t0, CP0_CONFIG, 7
66 HAZARD_CP0
67
68 /* enable the TLB */
69 or t0, (1<<19)
70
71 /* disable the ICACHE: at least 10x slower */
72 /* or t0, (1<<26) */
73
74 /* disable the DCACHE; CONFIG_CPU_HAS_LLSC should not be set */
75 /* or t0, (1<<27) */
76
77 and t0, CO_CONFIGPR_VALID
78
79 /* enable TLB. */
80 mtc0 t0, CP0_CONFIG, 7
81 HAZARD_CP0
82cache_end:
83 /* Setup CMEM_0 to MMIO address space, 2MB */
84 lui t0, 0x1BE0
85 addi t0, t0, 0x3
86 mtc0 $8, $22, 4
87 nop
88
89 /* Setup CMEM_1, 128MB */
90 lui t0, 0x1000
91 addi t0, t0, 0xf
92 mtc0 $8, $22, 5
93 nop
94
95
96 /* Setup CMEM_2, 32MB */
97 lui t0, 0x1C00
98 addi t0, t0, 0xb
99 mtc0 $8, $22, 6
100 nop
101
102 /* Setup CMEM_3, 0MB */
103 lui t0, 0x0
104 addi t0, t0, 0x0
105 mtc0 $8, $22, 7
106 nop
107
108 /* Enable cache */
109 mfc0 t0, CP0_CONFIG
110 HAZARD_CP0
111 and t0, t0, 0xFFFFFFF8
112 or t0, t0, 3
113 mtc0 t0, CP0_CONFIG
114 HAZARD_CP0
115 .set pop
116 .endm
117
118 .macro init_icache
119 .set push
120 .set noreorder
121
122 /* Get Cache Configuration */
123 mfc0 t3, CP0_CONFIG, 1
124 HAZARD_CP0
125
126 /* get cache Line size */
127
128 srl t1, t3, 19 /* C0_CONFIGPR_IL_SHIFT */
129 andi t1, t1, 0x7 /* C0_CONFIGPR_IL_MASK */
130 beq t1, zero, pr4450_instr_cache_invalidated /* if zero instruction cache is absent */
131 nop
132 addiu t0, t1, 1
133 ori t1, zero, 1
134 sllv t1, t1, t0
135
136 /* get max cache Index */
137 srl t2, t3, 22 /* C0_CONFIGPR_IS_SHIFT */
138 andi t2, t2, 0x7 /* C0_CONFIGPR_IS_MASK */
139 addiu t0, t2, 6
140 ori t2, zero, 1
141 sllv t2, t2, t0
142
143 /* get max cache way */
144 srl t3, t3, 16 /* C0_CONFIGPR_IA_SHIFT */
145 andi t3, t3, 0x7 /* C0_CONFIGPR_IA_MASK */
146 addiu t3, t3, 1
147
148 /* total no of cache lines */
149 multu t2, t3 /* max index * max way */
150 mflo t2
151 addiu t2, t2, -1
152
153 move t0, zero
154pr4450_next_instruction_cache_set:
155 cache Index_Invalidate_I, 0(t0)
156 addu t0, t0, t1 /* add bytes in a line */
157 bne t2, zero, pr4450_next_instruction_cache_set
158 addiu t2, t2, -1 /* reduce no of lines to invalidate by one */
159pr4450_instr_cache_invalidated:
160 .set pop
161 .endm
162
163 .macro init_dcache
164 .set push
165 .set noreorder
166 move t1, zero
167
168 /* Store Tag Information */
169 mtc0 zero, CP0_TAGLO, 0
170 HAZARD_CP0
171
172 mtc0 zero, CP0_TAGHI, 0
173 HAZARD_CP0
174
175 /* Cache size is 16384 = 512 lines x 32 bytes per line */
176 or t2, zero, (128*4)-1 /* 512 lines */
177 /* Invalidate all lines */
1782:
179 cache Index_Store_Tag_D, 0(t1)
180 addiu t2, t2, -1
181 bne t2, zero, 2b
182 addiu t1, t1, 32 /* 32 bytes in a line */
183 .set pop
184 .endm
185
186 .macro cachePr4450ICReset
187 .set push
188 .set noreorder
189
190 /* Save CP0 status reg on entry; */
191 /* disable interrupts during cache reset */
192 mfc0 t0, CP0_STATUS /* T0 = interrupt status on entry */
193 HAZARD_CP0
194
195 mtc0 zero, CP0_STATUS /* disable CPU interrupts */
196 HAZARD_CP0
197
198 or t1, zero, zero /* T1 = starting cache index (0) */
199 ori t2, zero, (256 - 1) /* T2 = inst cache set cnt - 1 */
200
201 icache_invd_loop:
202 /* 9 == register t1 */
203 .word (CACHE_OPC | (9 << 21) | (Index_Invalidate_I << 16) | \
204 (0 * ICACHE_SET_SIZE)) /* invalidate inst cache WAY0 */
205 .word (CACHE_OPC | (9 << 21) | (Index_Invalidate_I << 16) | \
206 (1 * ICACHE_SET_SIZE)) /* invalidate inst cache WAY1 */
207
208 addiu t1, t1, ICACHE_LINE_SIZE /* T1 = next cache line index */
209 bne t2, zero, icache_invd_loop /* T2 = 0 if all sets invalidated */
210 addiu t2, t2, -1 /* decrement T2 set cnt (delay slot) */
211
212 /* Initialize the latches in the instruction cache tag */
213 /* that drive the way selection tri-state bus drivers, by doing a */
214 /* dummy load while the instruction cache is still disabled. */
215 /* TODO: Is this needed ? */
216 la t1, KSEG0 /* T1 = cached memory base address */
217 lw zero, 0x0000(t1) /* (dummy read of first memory word) */
218
219 mtc0 t0, CP0_STATUS /* restore interrupt status on entry */
220 HAZARD_CP0
221 .set pop
222 .endm
223
224 .macro cachePr4450DCReset
225 .set push
226 .set noreorder
227 mfc0 t0, CP0_STATUS /* T0 = interrupt status on entry */
228 HAZARD_CP0
229 mtc0 zero, CP0_STATUS /* disable CPU interrupts */
230 HAZARD_CP0
231
232 /* Writeback/invalidate entire data cache sets/ways/lines */
233 or t1, zero, zero /* T1 = starting cache index (0) */
234 ori t2, zero, (DCACHE_SET_COUNT - 1) /* T2 = data cache set cnt - 1 */
235
236 dcache_wbinvd_loop:
237 /* 9 == register t1 */
238 .word (CACHE_OPC | (9 << 21) | (Index_Writeback_Inv_D << 16) | \
239 (0 * DCACHE_SET_SIZE)) /* writeback/invalidate WAY0 */
240 .word (CACHE_OPC | (9 << 21) | (Index_Writeback_Inv_D << 16) | \
241 (1 * DCACHE_SET_SIZE)) /* writeback/invalidate WAY1 */
242 .word (CACHE_OPC | (9 << 21) | (Index_Writeback_Inv_D << 16) | \
243 (2 * DCACHE_SET_SIZE)) /* writeback/invalidate WAY2 */
244 .word (CACHE_OPC | (9 << 21) | (Index_Writeback_Inv_D << 16) | \
245 (3 * DCACHE_SET_SIZE)) /* writeback/invalidate WAY3 */
246
247 addiu t1, t1, DCACHE_LINE_SIZE /* T1 = next data cache line index */
248 bne t2, zero, dcache_wbinvd_loop /* T2 = 0 when wbinvd entire cache */
249 addiu t2, t2, -1 /* decrement T2 set cnt (delay slot) */
250
251 /* Initialize the latches in the data cache tag that drive the way
252 selection tri-state bus drivers, by doing a dummy load while the
253 data cache is still in the disabled mode. TODO: Is this needed ? */
254 la t1, KSEG0 /* T1 = cached memory base address */
255 lw zero, 0x0000(t1) /* (dummy read of first memory word) */
256
257 mtc0 t0, CP0_STATUS /* restore interrupt status on entry */
258 HAZARD_CP0
259 .set pop
260 .endm
261
262#endif /* __ASM_MACH_KERNEL_ENTRY_INIT_H */
diff --git a/include/asm-mips/mach-pnx8550/nand.h b/include/asm-mips/mach-pnx8550/nand.h
new file mode 100644
index 000000000000..aefbc514ab09
--- /dev/null
+++ b/include/asm-mips/mach-pnx8550/nand.h
@@ -0,0 +1,121 @@
1#ifndef __PNX8550_NAND_H
2#define __PNX8550_NAND_H
3
4#define PNX8550_NAND_BASE_ADDR 0x10000000
5#define PNX8550_PCIXIO_BASE 0xBBE40000
6
7#define PNX8550_DMA_EXT_ADDR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x800)
8#define PNX8550_DMA_INT_ADDR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x804)
9#define PNX8550_DMA_TRANS_SIZE *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x808)
10#define PNX8550_DMA_CTRL *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x80c)
11#define PNX8550_XIO_SEL0 *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x814)
12#define PNX8550_GPXIO_ADDR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x820)
13#define PNX8550_GPXIO_WR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x824)
14#define PNX8550_GPXIO_RD *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x828)
15#define PNX8550_GPXIO_CTRL *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x82C)
16#define PNX8550_XIO_FLASH_CTRL *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x830)
17#define PNX8550_GPXIO_INT_STATUS *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfb0)
18#define PNX8550_GPXIO_INT_ENABLE *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfb4)
19#define PNX8550_GPXIO_INT_CLEAR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfb8)
20#define PNX8550_DMA_INT_STATUS *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfd0)
21#define PNX8550_DMA_INT_ENABLE *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfd4)
22#define PNX8550_DMA_INT_CLEAR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfd8)
23
24#define PNX8550_XIO_SEL0_EN_16BIT 0x00800000
25#define PNX8550_XIO_SEL0_USE_ACK 0x00400000
26#define PNX8550_XIO_SEL0_REN_HIGH 0x00100000
27#define PNX8550_XIO_SEL0_REN_LOW 0x00040000
28#define PNX8550_XIO_SEL0_WEN_HIGH 0x00010000
29#define PNX8550_XIO_SEL0_WEN_LOW 0x00004000
30#define PNX8550_XIO_SEL0_WAIT 0x00000200
31#define PNX8550_XIO_SEL0_OFFSET 0x00000020
32#define PNX8550_XIO_SEL0_TYPE_68360 0x00000000
33#define PNX8550_XIO_SEL0_TYPE_NOR 0x00000008
34#define PNX8550_XIO_SEL0_TYPE_NAND 0x00000010
35#define PNX8550_XIO_SEL0_TYPE_IDE 0x00000018
36#define PNX8550_XIO_SEL0_SIZE_8MB 0x00000000
37#define PNX8550_XIO_SEL0_SIZE_16MB 0x00000002
38#define PNX8550_XIO_SEL0_SIZE_32MB 0x00000004
39#define PNX8550_XIO_SEL0_SIZE_64MB 0x00000006
40#define PNX8550_XIO_SEL0_ENAB 0x00000001
41
42#define PNX8550_SEL0_DEFAULT ((PNX8550_XIO_SEL0_EN_16BIT) | \
43 (PNX8550_XIO_SEL0_REN_HIGH*0)| \
44 (PNX8550_XIO_SEL0_REN_LOW*2) | \
45 (PNX8550_XIO_SEL0_WEN_HIGH*0)| \
46 (PNX8550_XIO_SEL0_WEN_LOW*2) | \
47 (PNX8550_XIO_SEL0_WAIT*4) | \
48 (PNX8550_XIO_SEL0_OFFSET*0) | \
49 (PNX8550_XIO_SEL0_TYPE_NAND) | \
50 (PNX8550_XIO_SEL0_SIZE_32MB) | \
51 (PNX8550_XIO_SEL0_ENAB))
52
53#define PNX8550_GPXIO_PENDING 0x00000200
54#define PNX8550_GPXIO_DONE 0x00000100
55#define PNX8550_GPXIO_CLR_DONE 0x00000080
56#define PNX8550_GPXIO_INIT 0x00000040
57#define PNX8550_GPXIO_READ_CMD 0x00000010
58#define PNX8550_GPXIO_BEN 0x0000000F
59
60#define PNX8550_XIO_FLASH_64MB 0x00200000
61#define PNX8550_XIO_FLASH_INC_DATA 0x00100000
62#define PNX8550_XIO_FLASH_CMD_PH 0x000C0000
63#define PNX8550_XIO_FLASH_CMD_PH2 0x00080000
64#define PNX8550_XIO_FLASH_CMD_PH1 0x00040000
65#define PNX8550_XIO_FLASH_CMD_PH0 0x00000000
66#define PNX8550_XIO_FLASH_ADR_PH 0x00030000
67#define PNX8550_XIO_FLASH_ADR_PH3 0x00030000
68#define PNX8550_XIO_FLASH_ADR_PH2 0x00020000
69#define PNX8550_XIO_FLASH_ADR_PH1 0x00010000
70#define PNX8550_XIO_FLASH_ADR_PH0 0x00000000
71#define PNX8550_XIO_FLASH_CMD_B(x) ((x<<8) & 0x0000FF00)
72#define PNX8550_XIO_FLASH_CMD_A(x) (x & 0x000000FF)
73
74#define PNX8550_XIO_INT_ACK 0x00004000
75#define PNX8550_XIO_INT_COMPL 0x00002000
76#define PNX8550_XIO_INT_NONSUP 0x00000200
77#define PNX8550_XIO_INT_ABORT 0x00000004
78
79#define PNX8550_DMA_CTRL_SINGLE_DATA 0x00000400
80#define PNX8550_DMA_CTRL_SND2XIO 0x00000200
81#define PNX8550_DMA_CTRL_FIX_ADDR 0x00000100
82#define PNX8550_DMA_CTRL_BURST_8 0x00000000
83#define PNX8550_DMA_CTRL_BURST_16 0x00000020
84#define PNX8550_DMA_CTRL_BURST_32 0x00000040
85#define PNX8550_DMA_CTRL_BURST_64 0x00000060
86#define PNX8550_DMA_CTRL_BURST_128 0x00000080
87#define PNX8550_DMA_CTRL_BURST_256 0x000000A0
88#define PNX8550_DMA_CTRL_BURST_512 0x000000C0
89#define PNX8550_DMA_CTRL_BURST_NORES 0x000000E0
90#define PNX8550_DMA_CTRL_INIT_DMA 0x00000010
91#define PNX8550_DMA_CTRL_CMD_TYPE 0x0000000F
92
93/* see PCI system arch, page 100 for the full list: */
94#define PNX8550_DMA_CTRL_PCI_CMD_READ 0x00000006
95#define PNX8550_DMA_CTRL_PCI_CMD_WRITE 0x00000007
96
97#define PNX8550_DMA_INT_STAT_ACK_DONE (1<<14)
98#define PNX8550_DMA_INT_STAT_DMA_DONE (1<<12)
99#define PNX8550_DMA_INT_STAT_DMA_ERR (1<<9)
100#define PNX8550_DMA_INT_STAT_PERR5 (1<<5)
101#define PNX8550_DMA_INT_STAT_PERR4 (1<<4)
102#define PNX8550_DMA_INT_STAT_M_ABORT (1<<2)
103#define PNX8550_DMA_INT_STAT_T_ABORT (1<<1)
104
105#define PNX8550_DMA_INT_EN_ACK_DONE (1<<14)
106#define PNX8550_DMA_INT_EN_DMA_DONE (1<<12)
107#define PNX8550_DMA_INT_EN_DMA_ERR (1<<9)
108#define PNX8550_DMA_INT_EN_PERR5 (1<<5)
109#define PNX8550_DMA_INT_EN_PERR4 (1<<4)
110#define PNX8550_DMA_INT_EN_M_ABORT (1<<2)
111#define PNX8550_DMA_INT_EN_T_ABORT (1<<1)
112
113#define PNX8550_DMA_INT_CLR_ACK_DONE (1<<14)
114#define PNX8550_DMA_INT_CLR_DMA_DONE (1<<12)
115#define PNX8550_DMA_INT_CLR_DMA_ERR (1<<9)
116#define PNX8550_DMA_INT_CLR_PERR5 (1<<5)
117#define PNX8550_DMA_INT_CLR_PERR4 (1<<4)
118#define PNX8550_DMA_INT_CLR_M_ABORT (1<<2)
119#define PNX8550_DMA_INT_CLR_T_ABORT (1<<1)
120
121#endif
diff --git a/include/asm-mips/mach-pnx8550/pci.h b/include/asm-mips/mach-pnx8550/pci.h
new file mode 100644
index 000000000000..b921508d701b
--- /dev/null
+++ b/include/asm-mips/mach-pnx8550/pci.h
@@ -0,0 +1,185 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * PCI specific definitions
5 *
6 * Author: source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * 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 it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 */
21
22#ifndef __PNX8550_PCI_H
23#define __PNX8550_PCI_H
24
25#include <linux/types.h>
26#include <linux/pci.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29
30#define PCI_ACCESS_READ 0
31#define PCI_ACCESS_WRITE 1
32
33#define PCI_CMD_IOR 0x20
34#define PCI_CMD_IOW 0x30
35#define PCI_CMD_CONFIG_READ 0xa0
36#define PCI_CMD_CONFIG_WRITE 0xb0
37
38#define PCI_IO_TIMEOUT 1000
39#define PCI_IO_RETRY 5
40/* Timeout for IO and CFG accesses.
41 This is in 1/1024 th of a jiffie(=10ms)
42 i.e. approx 10us */
43#define PCI_IO_JIFFIES_TIMEOUT 40
44#define PCI_IO_JIFFIES_SHIFT 10
45
46#define PCI_BYTE_ENABLE_MASK 0x0000000f
47#define PCI_CFG_BUS_SHIFT 16
48#define PCI_CFG_FUNC_SHIFT 8
49#define PCI_CFG_REG_SHIFT 2
50
51#define PCI_BASE 0x1be00000
52#define PCI_SETUP 0x00040010
53#define PCI_DIS_REQGNT (1<<30)
54#define PCI_DIS_REQGNTA (1<<29)
55#define PCI_DIS_REQGNTB (1<<28)
56#define PCI_D2_SUPPORT (1<<27)
57#define PCI_D1_SUPPORT (1<<26)
58#define PCI_EN_TA (1<<24)
59#define PCI_EN_PCI2MMI (1<<23)
60#define PCI_EN_XIO (1<<22)
61#define PCI_BASE18_PREF (1<<21)
62#define SIZE_16M 0x3
63#define SIZE_32M 0x4
64#define SIZE_64M 0x5
65#define SIZE_128M 0x6
66#define PCI_SETUP_BASE18_SIZE(X) (X<<18)
67#define PCI_SETUP_BASE18_EN (1<<17)
68#define PCI_SETUP_BASE14_PREF (1<<16)
69#define PCI_SETUP_BASE14_SIZE(X) (X<<12)
70#define PCI_SETUP_BASE14_EN (1<<11)
71#define PCI_SETUP_BASE10_PREF (1<<10)
72#define PCI_SETUP_BASE10_SIZE(X) (X<<7)
73#define PCI_SETUP_CFGMANAGE_EN (1<<1)
74#define PCI_SETUP_PCIARB_EN (1<<0)
75
76#define PCI_CTRL 0x040014
77#define PCI_SWPB_DCS_PCI (1<<16)
78#define PCI_SWPB_PCI_PCI (1<<15)
79#define PCI_SWPB_PCI_DCS (1<<14)
80#define PCI_REG_WR_POST (1<<13)
81#define PCI_XIO_WR_POST (1<<12)
82#define PCI_PCI2_WR_POST (1<<13)
83#define PCI_PCI1_WR_POST (1<<12)
84#define PCI_SERR_SEEN (1<<11)
85#define PCI_B10_SPEC_RD (1<<6)
86#define PCI_B14_SPEC_RD (1<<5)
87#define PCI_B18_SPEC_RD (1<<4)
88#define PCI_B10_NOSUBWORD (1<<3)
89#define PCI_B14_NOSUBWORD (1<<2)
90#define PCI_B18_NOSUBWORD (1<<1)
91#define PCI_RETRY_TMREN (1<<0)
92
93#define PCI_BASE1_LO 0x040018
94#define PCI_BASE1_HI 0x04001C
95#define PCI_BASE2_LO 0x040020
96#define PCI_BASE2_HI 0x040024
97#define PCI_RDLIFETIM 0x040028
98#define PCI_GPPM_ADDR 0x04002C
99#define PCI_GPPM_WDAT 0x040030
100#define PCI_GPPM_RDAT 0x040034
101#define PCI_GPPM_CTRL 0x040038
102#define GPPM_DONE (1<<10)
103#define INIT_PCI_CYCLE (1<<9)
104#define GPPM_CMD(X) (((X)&0xf)<<4)
105#define GPPM_BYTEEN(X) ((X)&0xf)
106#define PCI_UNLOCKREG 0x04003C
107#define UNLOCK_SSID(X) (((X)&0xff)<<8)
108#define UNLOCK_SETUP(X) (((X)&0xff)<<0)
109#define UNLOCK_MAGIC 0xCA
110#define PCI_DEV_VEND_ID 0x040040
111#define DEVICE_ID(X) (((X)>>16)&0xffff)
112#define VENDOR_ID(X) (((X)&0xffff))
113#define PCI_CFG_CMDSTAT 0x040044
114#define PCI_CFG_STATUS(X) (((X)>>16)&0xffff)
115#define PCI_CFG_COMMAND(X) ((X)&0xffff)
116#define PCI_CLASS_REV 0x040048
117#define PCI_CLASSCODE(X) (((X)>>8)&0xffffff)
118#define PCI_REVID(X) ((X)&0xff)
119#define PCI_LAT_TMR 0x04004c
120#define PCI_BASE10 0x040050
121#define PCI_BASE14 0x040054
122#define PCI_BASE18 0x040058
123#define PCI_SUBSYS_ID 0x04006c
124#define PCI_CAP_PTR 0x040074
125#define PCI_CFG_MISC 0x04007c
126#define PCI_PMC 0x040080
127#define PCI_PWR_STATE 0x040084
128#define PCI_IO 0x040088
129#define PCI_SLVTUNING 0x04008C
130#define PCI_DMATUNING 0x040090
131#define PCI_DMAEADDR 0x040800
132#define PCI_DMAIADDR 0x040804
133#define PCI_DMALEN 0x040808
134#define PCI_DMACTRL 0x04080C
135#define PCI_XIOCTRL 0x040810
136#define PCI_SEL0PROF 0x040814
137#define PCI_SEL1PROF 0x040818
138#define PCI_SEL2PROF 0x04081C
139#define PCI_GPXIOADDR 0x040820
140#define PCI_NANDCTRLS 0x400830
141#define PCI_SEL3PROF 0x040834
142#define PCI_SEL4PROF 0x040838
143#define PCI_GPXIO_STAT 0x040FB0
144#define PCI_GPXIO_IMASK 0x040FB4
145#define PCI_GPXIO_ICLR 0x040FB8
146#define PCI_GPXIO_ISET 0x040FBC
147#define PCI_GPPM_STATUS 0x040FC0
148#define GPPM_DONE (1<<10)
149#define GPPM_ERR (1<<9)
150#define GPPM_MPAR_ERR (1<<8)
151#define GPPM_PAR_ERR (1<<7)
152#define GPPM_R_MABORT (1<<2)
153#define GPPM_R_TABORT (1<<1)
154#define PCI_GPPM_IMASK 0x040FC4
155#define PCI_GPPM_ICLR 0x040FC8
156#define PCI_GPPM_ISET 0x040FCC
157#define PCI_DMA_STATUS 0x040FD0
158#define PCI_DMA_IMASK 0x040FD4
159#define PCI_DMA_ICLR 0x040FD8
160#define PCI_DMA_ISET 0x040FDC
161#define PCI_ISTATUS 0x040FE0
162#define PCI_IMASK 0x040FE4
163#define PCI_ICLR 0x040FE8
164#define PCI_ISET 0x040FEC
165#define PCI_MOD_ID 0x040FFC
166
167/*
168 * PCI configuration cycle AD bus definition
169 */
170/* Type 0 */
171#define PCI_CFG_TYPE0_REG_SHF 0
172#define PCI_CFG_TYPE0_FUNC_SHF 8
173
174/* Type 1 */
175#define PCI_CFG_TYPE1_REG_SHF 0
176#define PCI_CFG_TYPE1_FUNC_SHF 8
177#define PCI_CFG_TYPE1_DEV_SHF 11
178#define PCI_CFG_TYPE1_BUS_SHF 16
179
180/*
181 * Ethernet device DP83816 definition
182 */
183#define DP83816_IRQ_ETHER 66
184
185#endif
diff --git a/include/asm-mips/mach-pnx8550/uart.h b/include/asm-mips/mach-pnx8550/uart.h
new file mode 100644
index 000000000000..e32b9a23d70e
--- /dev/null
+++ b/include/asm-mips/mach-pnx8550/uart.h
@@ -0,0 +1,16 @@
1#ifndef __IP3106_UART_H
2#define __IP3106_UART_H
3
4#include <int.h>
5
6/* early macros for kgdb use. fixme: clean this up */
7
8#define UART_BASE 0xbbe4a000 /* PNX8550 */
9
10#define PNX8550_UART_PORT0 (UART_BASE)
11#define PNX8550_UART_PORT1 (UART_BASE + 0x1000)
12
13#define PNX8550_UART_INT(x) (PNX8550_INT_GIC_MIN+19+x)
14#define IRQ_TO_UART(x) (x-PNX8550_INT_GIC_MIN-19)
15
16#endif
diff --git a/include/asm-mips/mach-pnx8550/usb.h b/include/asm-mips/mach-pnx8550/usb.h
new file mode 100644
index 000000000000..483b7fc65d41
--- /dev/null
+++ b/include/asm-mips/mach-pnx8550/usb.h
@@ -0,0 +1,32 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * USB specific definitions
5 *
6 * Author: source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * 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 it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 */
21
22#ifndef __PNX8550_USB_H
23#define __PNX8550_USB_H
24
25/*
26 * USB Host controller
27 */
28
29#define PNX8550_USB_OHCI_OP_BASE 0x1be48000
30#define PNX8550_USB_OHCI_OP_LEN 0x1000
31
32#endif
diff --git a/include/asm-mips/mach-rm200/cpu-feature-overrides.h b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
index f48736032b2a..79f9b064c864 100644
--- a/include/asm-mips/mach-rm200/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
@@ -14,7 +14,7 @@
14 14
15#define cpu_has_tlb 1 15#define cpu_has_tlb 1
16#define cpu_has_4kex 1 16#define cpu_has_4kex 1
17#define cpu_has_4ktlb 1 17#define cpu_has_4kcache 1
18#define cpu_has_fpu 1 18#define cpu_has_fpu 1
19#define cpu_has_32fpr 1 19#define cpu_has_32fpr 1
20#define cpu_has_counter 1 20#define cpu_has_counter 1
@@ -31,6 +31,7 @@
31#define cpu_has_vtag_icache 0 31#define cpu_has_vtag_icache 0
32#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) 32#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
33#define cpu_has_ic_fills_f_dc 0 33#define cpu_has_ic_fills_f_dc 0
34#define cpu_has_dsp 0
34#define cpu_has_nofpuex 0 35#define cpu_has_nofpuex 0
35#define cpu_has_64bits 1 36#define cpu_has_64bits 1
36 37
diff --git a/include/asm-mips/mach-sibyte/cpu-feature-overrides.h b/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
index a3a2cc6014b2..193a666cd131 100644
--- a/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
@@ -25,6 +25,7 @@
25#define cpu_has_vtag_icache 1 25#define cpu_has_vtag_icache 1
26#define cpu_has_dc_aliases 0 26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0 27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0
28#define cpu_icache_snoops_remote_store 0 29#define cpu_icache_snoops_remote_store 0
29 30
30#define cpu_has_nofpuex 0 31#define cpu_has_nofpuex 0
diff --git a/include/asm-mips/mach-sim/cpu-feature-overrides.h b/include/asm-mips/mach-sim/cpu-feature-overrides.h
new file mode 100644
index 000000000000..cadbe8eda79c
--- /dev/null
+++ b/include/asm-mips/mach-sim/cpu-feature-overrides.h
@@ -0,0 +1,66 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Chris Dearman
7 */
8#ifndef __ASM_MACH_SIM_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_SIM_CPU_FEATURE_OVERRIDES_H
10
11#include <linux/config.h>
12
13/*
14 * CPU feature overrides for MIPS boards
15 */
16#ifdef CONFIG_CPU_MIPS32
17#define cpu_has_tlb 1
18#define cpu_has_4kex 1
19#define cpu_has_4kcache 1
20#define cpu_has_fpu 0
21/* #define cpu_has_32fpr ? */
22#define cpu_has_counter 1
23/* #define cpu_has_watch ? */
24#define cpu_has_divec 1
25#define cpu_has_vce 0
26/* #define cpu_has_cache_cdex_p ? */
27/* #define cpu_has_cache_cdex_s ? */
28/* #define cpu_has_prefetch ? */
29#define cpu_has_mcheck 1
30/* #define cpu_has_ejtag ? */
31#define cpu_has_llsc 1
32/* #define cpu_has_vtag_icache ? */
33/* #define cpu_has_dc_aliases ? */
34/* #define cpu_has_ic_fills_f_dc ? */
35#define cpu_has_nofpuex 0
36/* #define cpu_has_64bits ? */
37/* #define cpu_has_64bit_zero_reg ? */
38/* #define cpu_has_subset_pcaches ? */
39#endif
40
41#ifdef CONFIG_CPU_MIPS64
42#define cpu_has_tlb 1
43#define cpu_has_4kex 1
44#define cpu_has_4kcache 1
45/* #define cpu_has_fpu ? */
46/* #define cpu_has_32fpr ? */
47#define cpu_has_counter 1
48/* #define cpu_has_watch ? */
49#define cpu_has_divec 1
50#define cpu_has_vce 0
51/* #define cpu_has_cache_cdex_p ? */
52/* #define cpu_has_cache_cdex_s ? */
53/* #define cpu_has_prefetch ? */
54#define cpu_has_mcheck 1
55/* #define cpu_has_ejtag ? */
56#define cpu_has_llsc 1
57/* #define cpu_has_vtag_icache ? */
58/* #define cpu_has_dc_aliases ? */
59/* #define cpu_has_ic_fills_f_dc ? */
60#define cpu_has_nofpuex 0
61/* #define cpu_has_64bits ? */
62/* #define cpu_has_64bit_zero_reg ? */
63/* #define cpu_has_subset_pcaches ? */
64#endif
65
66#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
index 58603e3daca6..463d051f4683 100644
--- a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
@@ -25,6 +25,7 @@
25#define cpu_has_vtag_icache 0 25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0 26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0 27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0
28#define cpu_icache_snoops_remote_store 0 29#define cpu_icache_snoops_remote_store 0
29 30
30#define cpu_has_nofpuex 0 31#define cpu_has_nofpuex 0
@@ -36,10 +37,4 @@
36#define cpu_icache_line_size() 32 37#define cpu_icache_line_size() 32
37#define cpu_scache_line_size() 32 38#define cpu_scache_line_size() 32
38 39
39/*
40 * On the RM9000 we need to ensure that I-cache lines being fetches only
41 * contain valid instructions are funny things will happen.
42 */
43#define PLAT_TRAMPOLINE_STUFF_LINE 32UL
44
45#endif /* __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H */ 40#endif /* __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mips-boards/generic.h b/include/asm-mips/mips-boards/generic.h
index 65d1d16eab16..25b6ffc26623 100644
--- a/include/asm-mips/mips-boards/generic.h
+++ b/include/asm-mips/mips-boards/generic.h
@@ -66,6 +66,7 @@
66#define MIPS_REVISION_CORID_CORE_EMUL 6 66#define MIPS_REVISION_CORID_CORE_EMUL 6
67#define MIPS_REVISION_CORID_CORE_FPGA2 7 67#define MIPS_REVISION_CORID_CORE_FPGA2 7
68#define MIPS_REVISION_CORID_CORE_FPGAR2 8 68#define MIPS_REVISION_CORID_CORE_FPGAR2 8
69#define MIPS_REVISION_CORID_CORE_FPGA3 9
69 70
70/**** Artificial corid defines ****/ 71/**** Artificial corid defines ****/
71/* 72/*
@@ -79,4 +80,10 @@
79 80
80extern unsigned int mips_revision_corid; 81extern unsigned int mips_revision_corid;
81 82
83#ifdef CONFIG_PCI
84extern void mips_pcibios_init(void);
85#else
86#define mips_pcibios_init() do { } while (0)
87#endif
88
82#endif /* __ASM_MIPS_BOARDS_GENERIC_H */ 89#endif /* __ASM_MIPS_BOARDS_GENERIC_H */
diff --git a/include/asm-mips/mips-boards/maltaint.h b/include/asm-mips/mips-boards/maltaint.h
index 376181882e81..da6cc2fbbc78 100644
--- a/include/asm-mips/mips-boards/maltaint.h
+++ b/include/asm-mips/mips-boards/maltaint.h
@@ -25,9 +25,63 @@
25#ifndef _MIPS_MALTAINT_H 25#ifndef _MIPS_MALTAINT_H
26#define _MIPS_MALTAINT_H 26#define _MIPS_MALTAINT_H
27 27
28/* Number of IRQ supported on hw interrupt 0. */ 28/*
29#define MALTAINT_END 16 29 * Interrupts 0..15 are used for Malta ISA compatible interrupts
30 */
31#define MALTA_INT_BASE 0
32
33/*
34 * Interrupts 16..23 are used for Malta CPU interrupts (nonEIC mode)
35 */
36#define MIPSCPU_INT_BASE 16
37
38/* CPU interrupt offsets */
39#define MIPSCPU_INT_SW0 0
40#define MIPSCPU_INT_SW1 1
41#define MIPSCPU_INT_MB0 2
42#define MIPSCPU_INT_I8259A MIPSCPU_INT_MB0
43#define MIPSCPU_INT_MB1 3
44#define MIPSCPU_INT_SMI MIPSCPU_INT_MB1
45#define MIPSCPU_INT_MB2 4
46#define MIPSCPU_INT_MB3 5
47#define MIPSCPU_INT_COREHI MIPSCPU_INT_MB3
48#define MIPSCPU_INT_MB4 6
49#define MIPSCPU_INT_CORELO MIPSCPU_INT_MB4
50#define MIPSCPU_INT_CPUCTR 7
51
52/*
53 * Interrupts 64..127 are used for Soc-it Classic interrupts
54 */
55#define MSC01C_INT_BASE 64
56
57/* SOC-it Classic interrupt offsets */
58#define MSC01C_INT_TMR 0
59#define MSC01C_INT_PCI 1
60
61/*
62 * Interrupts 64..127 are used for Soc-it EIC interrupts
63 */
64#define MSC01E_INT_BASE 64
65
66/* SOC-it EIC interrupt offsets */
67#define MSC01E_INT_SW0 1
68#define MSC01E_INT_SW1 2
69#define MSC01E_INT_MB0 3
70#define MSC01E_INT_I8259A MSC01E_INT_MB0
71#define MSC01E_INT_MB1 4
72#define MSC01E_INT_SMI MSC01E_INT_MB1
73#define MSC01E_INT_MB2 5
74#define MSC01E_INT_MB3 6
75#define MSC01E_INT_COREHI MSC01E_INT_MB3
76#define MSC01E_INT_MB4 7
77#define MSC01E_INT_CORELO MSC01E_INT_MB4
78#define MSC01E_INT_TMR 8
79#define MSC01E_INT_PCI 9
80#define MSC01E_INT_PERFCTR 10
81#define MSC01E_INT_CPUCTR 11
30 82
83#ifndef __ASSEMBLY__
31extern void maltaint_init(void); 84extern void maltaint_init(void);
85#endif
32 86
33#endif /* !(_MIPS_MALTAINT_H) */ 87#endif /* !(_MIPS_MALTAINT_H) */
diff --git a/include/asm-mips/mips-boards/msc01_pci.h b/include/asm-mips/mips-boards/msc01_pci.h
index 6b2a87a38f4b..8eaefb837b9d 100644
--- a/include/asm-mips/mips-boards/msc01_pci.h
+++ b/include/asm-mips/mips-boards/msc01_pci.h
@@ -1,8 +1,9 @@
1/* 1/*
2 * PCI Register definitions for the MIPS System Controller. 2 * PCI Register definitions for the MIPS System Controller.
3 * 3 *
4 * Carsten Langgaard, carstenl@mips.com 4 * Copyright (C) 2002, 2005 MIPS Technologies, Inc. All rights reserved.
5 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved. 5 * Authors: Carsten Langgaard <carstenl@mips.com>
6 * Maciej W. Rozycki <macro@mips.com>
6 * 7 *
7 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -29,22 +30,22 @@
29#define MSC01_PCI_CFGADDR_OFS 0x0610 30#define MSC01_PCI_CFGADDR_OFS 0x0610
30#define MSC01_PCI_CFGDATA_OFS 0x0618 31#define MSC01_PCI_CFGDATA_OFS 0x0618
31#define MSC01_PCI_IACK_OFS 0x0620 32#define MSC01_PCI_IACK_OFS 0x0620
32#define MSC01_PCI_HEAD0_OFS 0x2000 /* DevID, VendorID */ 33#define MSC01_PCI_HEAD0_OFS 0x2000 /* DevID, VendorID */
33#define MSC01_PCI_HEAD1_OFS 0x2008 /* Status, Command */ 34#define MSC01_PCI_HEAD1_OFS 0x2008 /* Status, Command */
34#define MSC01_PCI_HEAD2_OFS 0x2010 /* Class code, RevID */ 35#define MSC01_PCI_HEAD2_OFS 0x2010 /* Class code, RevID */
35#define MSC01_PCI_HEAD3_OFS 0x2018 /* bist, header, latency */ 36#define MSC01_PCI_HEAD3_OFS 0x2018 /* bist, header, latency */
36#define MSC01_PCI_HEAD4_OFS 0x2020 /* BAR 0 */ 37#define MSC01_PCI_HEAD4_OFS 0x2020 /* BAR 0 */
37#define MSC01_PCI_HEAD5_OFS 0x2028 /* BAR 1 */ 38#define MSC01_PCI_HEAD5_OFS 0x2028 /* BAR 1 */
38#define MSC01_PCI_HEAD6_OFS 0x2030 /* BAR 2 */ 39#define MSC01_PCI_HEAD6_OFS 0x2030 /* BAR 2 */
39#define MSC01_PCI_HEAD7_OFS 0x2038 /* BAR 3 */ 40#define MSC01_PCI_HEAD7_OFS 0x2038 /* BAR 3 */
40#define MSC01_PCI_HEAD8_OFS 0x2040 /* BAR 4 */ 41#define MSC01_PCI_HEAD8_OFS 0x2040 /* BAR 4 */
41#define MSC01_PCI_HEAD9_OFS 0x2048 /* BAR 5 */ 42#define MSC01_PCI_HEAD9_OFS 0x2048 /* BAR 5 */
42#define MSC01_PCI_HEAD10_OFS 0x2050 /* CardBus CIS Ptr */ 43#define MSC01_PCI_HEAD10_OFS 0x2050 /* CardBus CIS Ptr */
43#define MSC01_PCI_HEAD11_OFS 0x2058 /* SubSystem ID, -VendorID */ 44#define MSC01_PCI_HEAD11_OFS 0x2058 /* SubSystem ID, -VendorID */
44#define MSC01_PCI_HEAD12_OFS 0x2060 /* ROM BAR */ 45#define MSC01_PCI_HEAD12_OFS 0x2060 /* ROM BAR */
45#define MSC01_PCI_HEAD13_OFS 0x2068 /* Capabilities ptr */ 46#define MSC01_PCI_HEAD13_OFS 0x2068 /* Capabilities ptr */
46#define MSC01_PCI_HEAD14_OFS 0x2070 /* reserved */ 47#define MSC01_PCI_HEAD14_OFS 0x2070 /* reserved */
47#define MSC01_PCI_HEAD15_OFS 0x2078 /* Maxl, ming, intpin, int */ 48#define MSC01_PCI_HEAD15_OFS 0x2078 /* Maxl, ming, intpin, int */
48#define MSC01_PCI_BAR0_OFS 0x2220 49#define MSC01_PCI_BAR0_OFS 0x2220
49#define MSC01_PCI_CFG_OFS 0x2380 50#define MSC01_PCI_CFG_OFS 0x2380
50#define MSC01_PCI_SWAP_OFS 0x2388 51#define MSC01_PCI_SWAP_OFS 0x2388
@@ -86,73 +87,73 @@
86#define MSC01_PCI_P2SCMAPL_MAP_SHF 24 87#define MSC01_PCI_P2SCMAPL_MAP_SHF 24
87#define MSC01_PCI_P2SCMAPL_MAP_MSK 0xff000000 88#define MSC01_PCI_P2SCMAPL_MAP_MSK 0xff000000
88 89
89#define MSC01_PCI_INTCFG_RST_SHF 10 90#define MSC01_PCI_INTCFG_RST_SHF 10
90#define MSC01_PCI_INTCFG_RST_MSK 0x00000400 91#define MSC01_PCI_INTCFG_RST_MSK 0x00000400
91#define MSC01_PCI_INTCFG_RST_BIT 0x00000400 92#define MSC01_PCI_INTCFG_RST_BIT 0x00000400
92#define MSC01_PCI_INTCFG_MWE_SHF 9 93#define MSC01_PCI_INTCFG_MWE_SHF 9
93#define MSC01_PCI_INTCFG_MWE_MSK 0x00000200 94#define MSC01_PCI_INTCFG_MWE_MSK 0x00000200
94#define MSC01_PCI_INTCFG_MWE_BIT 0x00000200 95#define MSC01_PCI_INTCFG_MWE_BIT 0x00000200
95#define MSC01_PCI_INTCFG_DTO_SHF 8 96#define MSC01_PCI_INTCFG_DTO_SHF 8
96#define MSC01_PCI_INTCFG_DTO_MSK 0x00000100 97#define MSC01_PCI_INTCFG_DTO_MSK 0x00000100
97#define MSC01_PCI_INTCFG_DTO_BIT 0x00000100 98#define MSC01_PCI_INTCFG_DTO_BIT 0x00000100
98#define MSC01_PCI_INTCFG_MA_SHF 7 99#define MSC01_PCI_INTCFG_MA_SHF 7
99#define MSC01_PCI_INTCFG_MA_MSK 0x00000080 100#define MSC01_PCI_INTCFG_MA_MSK 0x00000080
100#define MSC01_PCI_INTCFG_MA_BIT 0x00000080 101#define MSC01_PCI_INTCFG_MA_BIT 0x00000080
101#define MSC01_PCI_INTCFG_TA_SHF 6 102#define MSC01_PCI_INTCFG_TA_SHF 6
102#define MSC01_PCI_INTCFG_TA_MSK 0x00000040 103#define MSC01_PCI_INTCFG_TA_MSK 0x00000040
103#define MSC01_PCI_INTCFG_TA_BIT 0x00000040 104#define MSC01_PCI_INTCFG_TA_BIT 0x00000040
104#define MSC01_PCI_INTCFG_RTY_SHF 5 105#define MSC01_PCI_INTCFG_RTY_SHF 5
105#define MSC01_PCI_INTCFG_RTY_MSK 0x00000020 106#define MSC01_PCI_INTCFG_RTY_MSK 0x00000020
106#define MSC01_PCI_INTCFG_RTY_BIT 0x00000020 107#define MSC01_PCI_INTCFG_RTY_BIT 0x00000020
107#define MSC01_PCI_INTCFG_MWP_SHF 4 108#define MSC01_PCI_INTCFG_MWP_SHF 4
108#define MSC01_PCI_INTCFG_MWP_MSK 0x00000010 109#define MSC01_PCI_INTCFG_MWP_MSK 0x00000010
109#define MSC01_PCI_INTCFG_MWP_BIT 0x00000010 110#define MSC01_PCI_INTCFG_MWP_BIT 0x00000010
110#define MSC01_PCI_INTCFG_MRP_SHF 3 111#define MSC01_PCI_INTCFG_MRP_SHF 3
111#define MSC01_PCI_INTCFG_MRP_MSK 0x00000008 112#define MSC01_PCI_INTCFG_MRP_MSK 0x00000008
112#define MSC01_PCI_INTCFG_MRP_BIT 0x00000008 113#define MSC01_PCI_INTCFG_MRP_BIT 0x00000008
113#define MSC01_PCI_INTCFG_SWP_SHF 2 114#define MSC01_PCI_INTCFG_SWP_SHF 2
114#define MSC01_PCI_INTCFG_SWP_MSK 0x00000004 115#define MSC01_PCI_INTCFG_SWP_MSK 0x00000004
115#define MSC01_PCI_INTCFG_SWP_BIT 0x00000004 116#define MSC01_PCI_INTCFG_SWP_BIT 0x00000004
116#define MSC01_PCI_INTCFG_SRP_SHF 1 117#define MSC01_PCI_INTCFG_SRP_SHF 1
117#define MSC01_PCI_INTCFG_SRP_MSK 0x00000002 118#define MSC01_PCI_INTCFG_SRP_MSK 0x00000002
118#define MSC01_PCI_INTCFG_SRP_BIT 0x00000002 119#define MSC01_PCI_INTCFG_SRP_BIT 0x00000002
119#define MSC01_PCI_INTCFG_SE_SHF 0 120#define MSC01_PCI_INTCFG_SE_SHF 0
120#define MSC01_PCI_INTCFG_SE_MSK 0x00000001 121#define MSC01_PCI_INTCFG_SE_MSK 0x00000001
121#define MSC01_PCI_INTCFG_SE_BIT 0x00000001 122#define MSC01_PCI_INTCFG_SE_BIT 0x00000001
122 123
123#define MSC01_PCI_INTSTAT_RST_SHF 10 124#define MSC01_PCI_INTSTAT_RST_SHF 10
124#define MSC01_PCI_INTSTAT_RST_MSK 0x00000400 125#define MSC01_PCI_INTSTAT_RST_MSK 0x00000400
125#define MSC01_PCI_INTSTAT_RST_BIT 0x00000400 126#define MSC01_PCI_INTSTAT_RST_BIT 0x00000400
126#define MSC01_PCI_INTSTAT_MWE_SHF 9 127#define MSC01_PCI_INTSTAT_MWE_SHF 9
127#define MSC01_PCI_INTSTAT_MWE_MSK 0x00000200 128#define MSC01_PCI_INTSTAT_MWE_MSK 0x00000200
128#define MSC01_PCI_INTSTAT_MWE_BIT 0x00000200 129#define MSC01_PCI_INTSTAT_MWE_BIT 0x00000200
129#define MSC01_PCI_INTSTAT_DTO_SHF 8 130#define MSC01_PCI_INTSTAT_DTO_SHF 8
130#define MSC01_PCI_INTSTAT_DTO_MSK 0x00000100 131#define MSC01_PCI_INTSTAT_DTO_MSK 0x00000100
131#define MSC01_PCI_INTSTAT_DTO_BIT 0x00000100 132#define MSC01_PCI_INTSTAT_DTO_BIT 0x00000100
132#define MSC01_PCI_INTSTAT_MA_SHF 7 133#define MSC01_PCI_INTSTAT_MA_SHF 7
133#define MSC01_PCI_INTSTAT_MA_MSK 0x00000080 134#define MSC01_PCI_INTSTAT_MA_MSK 0x00000080
134#define MSC01_PCI_INTSTAT_MA_BIT 0x00000080 135#define MSC01_PCI_INTSTAT_MA_BIT 0x00000080
135#define MSC01_PCI_INTSTAT_TA_SHF 6 136#define MSC01_PCI_INTSTAT_TA_SHF 6
136#define MSC01_PCI_INTSTAT_TA_MSK 0x00000040 137#define MSC01_PCI_INTSTAT_TA_MSK 0x00000040
137#define MSC01_PCI_INTSTAT_TA_BIT 0x00000040 138#define MSC01_PCI_INTSTAT_TA_BIT 0x00000040
138#define MSC01_PCI_INTSTAT_RTY_SHF 5 139#define MSC01_PCI_INTSTAT_RTY_SHF 5
139#define MSC01_PCI_INTSTAT_RTY_MSK 0x00000020 140#define MSC01_PCI_INTSTAT_RTY_MSK 0x00000020
140#define MSC01_PCI_INTSTAT_RTY_BIT 0x00000020 141#define MSC01_PCI_INTSTAT_RTY_BIT 0x00000020
141#define MSC01_PCI_INTSTAT_MWP_SHF 4 142#define MSC01_PCI_INTSTAT_MWP_SHF 4
142#define MSC01_PCI_INTSTAT_MWP_MSK 0x00000010 143#define MSC01_PCI_INTSTAT_MWP_MSK 0x00000010
143#define MSC01_PCI_INTSTAT_MWP_BIT 0x00000010 144#define MSC01_PCI_INTSTAT_MWP_BIT 0x00000010
144#define MSC01_PCI_INTSTAT_MRP_SHF 3 145#define MSC01_PCI_INTSTAT_MRP_SHF 3
145#define MSC01_PCI_INTSTAT_MRP_MSK 0x00000008 146#define MSC01_PCI_INTSTAT_MRP_MSK 0x00000008
146#define MSC01_PCI_INTSTAT_MRP_BIT 0x00000008 147#define MSC01_PCI_INTSTAT_MRP_BIT 0x00000008
147#define MSC01_PCI_INTSTAT_SWP_SHF 2 148#define MSC01_PCI_INTSTAT_SWP_SHF 2
148#define MSC01_PCI_INTSTAT_SWP_MSK 0x00000004 149#define MSC01_PCI_INTSTAT_SWP_MSK 0x00000004
149#define MSC01_PCI_INTSTAT_SWP_BIT 0x00000004 150#define MSC01_PCI_INTSTAT_SWP_BIT 0x00000004
150#define MSC01_PCI_INTSTAT_SRP_SHF 1 151#define MSC01_PCI_INTSTAT_SRP_SHF 1
151#define MSC01_PCI_INTSTAT_SRP_MSK 0x00000002 152#define MSC01_PCI_INTSTAT_SRP_MSK 0x00000002
152#define MSC01_PCI_INTSTAT_SRP_BIT 0x00000002 153#define MSC01_PCI_INTSTAT_SRP_BIT 0x00000002
153#define MSC01_PCI_INTSTAT_SE_SHF 0 154#define MSC01_PCI_INTSTAT_SE_SHF 0
154#define MSC01_PCI_INTSTAT_SE_MSK 0x00000001 155#define MSC01_PCI_INTSTAT_SE_MSK 0x00000001
155#define MSC01_PCI_INTSTAT_SE_BIT 0x00000001 156#define MSC01_PCI_INTSTAT_SE_BIT 0x00000001
156 157
157#define MSC01_PCI_CFGADDR_BNUM_SHF 16 158#define MSC01_PCI_CFGADDR_BNUM_SHF 16
158#define MSC01_PCI_CFGADDR_BNUM_MSK 0x00ff0000 159#define MSC01_PCI_CFGADDR_BNUM_MSK 0x00ff0000
@@ -167,29 +168,29 @@
167#define MSC01_PCI_CFGDATA_DATA_MSK 0xffffffff 168#define MSC01_PCI_CFGDATA_DATA_MSK 0xffffffff
168 169
169/* The defines below are ONLY valid for a MEM bar! */ 170/* The defines below are ONLY valid for a MEM bar! */
170#define MSC01_PCI_BAR0_SIZE_SHF 4 171#define MSC01_PCI_BAR0_SIZE_SHF 4
171#define MSC01_PCI_BAR0_SIZE_MSK 0xfffffff0 172#define MSC01_PCI_BAR0_SIZE_MSK 0xfffffff0
172#define MSC01_PCI_BAR0_P_SHF 3 173#define MSC01_PCI_BAR0_P_SHF 3
173#define MSC01_PCI_BAR0_P_MSK 0x00000008 174#define MSC01_PCI_BAR0_P_MSK 0x00000008
174#define MSC01_PCI_BAR0_P_BIT MSC01_PCI_BAR0_P_MSK 175#define MSC01_PCI_BAR0_P_BIT MSC01_PCI_BAR0_P_MSK
175#define MSC01_PCI_BAR0_D_SHF 1 176#define MSC01_PCI_BAR0_D_SHF 1
176#define MSC01_PCI_BAR0_D_MSK 0x00000006 177#define MSC01_PCI_BAR0_D_MSK 0x00000006
177#define MSC01_PCI_BAR0_T_SHF 0 178#define MSC01_PCI_BAR0_T_SHF 0
178#define MSC01_PCI_BAR0_T_MSK 0x00000001 179#define MSC01_PCI_BAR0_T_MSK 0x00000001
179#define MSC01_PCI_BAR0_T_BIT MSC01_PCI_BAR0_T_MSK 180#define MSC01_PCI_BAR0_T_BIT MSC01_PCI_BAR0_T_MSK
180 181
181 182
182#define MSC01_PCI_CFG_RA_SHF 17 183#define MSC01_PCI_CFG_RA_SHF 17
183#define MSC01_PCI_CFG_RA_MSK 0x00020000 184#define MSC01_PCI_CFG_RA_MSK 0x00020000
184#define MSC01_PCI_CFG_RA_BIT MSC01_PCI_CFG_RA_MSK 185#define MSC01_PCI_CFG_RA_BIT MSC01_PCI_CFG_RA_MSK
185#define MSC01_PCI_CFG_G_SHF 16 186#define MSC01_PCI_CFG_G_SHF 16
186#define MSC01_PCI_CFG_G_MSK 0x00010000 187#define MSC01_PCI_CFG_G_MSK 0x00010000
187#define MSC01_PCI_CFG_G_BIT MSC01_PCI_CFG_G_MSK 188#define MSC01_PCI_CFG_G_BIT MSC01_PCI_CFG_G_MSK
188#define MSC01_PCI_CFG_EN_SHF 15 189#define MSC01_PCI_CFG_EN_SHF 15
189#define MSC01_PCI_CFG_EN_MSK 0x00008000 190#define MSC01_PCI_CFG_EN_MSK 0x00008000
190#define MSC01_PCI_CFG_EN_BIT MSC01_PCI_CFG_EN_MSK 191#define MSC01_PCI_CFG_EN_BIT MSC01_PCI_CFG_EN_MSK
191#define MSC01_PCI_CFG_MAXRTRY_SHF 0 192#define MSC01_PCI_CFG_MAXRTRY_SHF 0
192#define MSC01_PCI_CFG_MAXRTRY_MSK 0x000000ff 193#define MSC01_PCI_CFG_MAXRTRY_MSK 0x00000fff
193 194
194#define MSC01_PCI_SWAP_IO_SHF 18 195#define MSC01_PCI_SWAP_IO_SHF 18
195#define MSC01_PCI_SWAP_IO_MSK 0x000c0000 196#define MSC01_PCI_SWAP_IO_MSK 0x000c0000
@@ -206,7 +207,7 @@
206 * FIXME - are these macros specific to Malta and co or to the MSC? If the 207 * FIXME - are these macros specific to Malta and co or to the MSC? If the
207 * latter, they should be moved elsewhere. 208 * latter, they should be moved elsewhere.
208 */ 209 */
209#define MIPS_MSC01_PCI_REG_BASE 0x1bd00000 210#define MIPS_MSC01_PCI_REG_BASE 0x1bd00000
210 211
211extern unsigned long _pcictrl_msc; 212extern unsigned long _pcictrl_msc;
212 213
@@ -219,19 +220,19 @@ extern unsigned long _pcictrl_msc;
219 * Registers absolute addresses 220 * Registers absolute addresses
220 */ 221 */
221 222
222#define MSC01_PCI_ID (MSC01_PCI_REG_BASE + MSC01_PCI_ID_OFS) 223#define MSC01_PCI_ID (MSC01_PCI_REG_BASE + MSC01_PCI_ID_OFS)
223#define MSC01_PCI_SC2PMBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMBASL_OFS) 224#define MSC01_PCI_SC2PMBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMBASL_OFS)
224#define MSC01_PCI_SC2PMMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMSKL_OFS) 225#define MSC01_PCI_SC2PMMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMSKL_OFS)
225#define MSC01_PCI_SC2PMMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMAPL_OFS) 226#define MSC01_PCI_SC2PMMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMAPL_OFS)
226#define MSC01_PCI_SC2PIOBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOBASL_OFS) 227#define MSC01_PCI_SC2PIOBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOBASL_OFS)
227#define MSC01_PCI_SC2PIOMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMSKL_OFS) 228#define MSC01_PCI_SC2PIOMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMSKL_OFS)
228#define MSC01_PCI_SC2PIOMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMAPL_OFS) 229#define MSC01_PCI_SC2PIOMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMAPL_OFS)
229#define MSC01_PCI_P2SCMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMSKL_OFS) 230#define MSC01_PCI_P2SCMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMSKL_OFS)
230#define MSC01_PCI_P2SCMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMAPL_OFS) 231#define MSC01_PCI_P2SCMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMAPL_OFS)
231#define MSC01_PCI_INTCFG (MSC01_PCI_REG_BASE + MSC01_PCI_INTCFG_OFS) 232#define MSC01_PCI_INTCFG (MSC01_PCI_REG_BASE + MSC01_PCI_INTCFG_OFS)
232#define MSC01_PCI_INTSTAT (MSC01_PCI_REG_BASE + MSC01_PCI_INTSTAT_OFS) 233#define MSC01_PCI_INTSTAT (MSC01_PCI_REG_BASE + MSC01_PCI_INTSTAT_OFS)
233#define MSC01_PCI_CFGADDR (MSC01_PCI_REG_BASE + MSC01_PCI_CFGADDR_OFS) 234#define MSC01_PCI_CFGADDR (MSC01_PCI_REG_BASE + MSC01_PCI_CFGADDR_OFS)
234#define MSC01_PCI_CFGDATA (MSC01_PCI_REG_BASE + MSC01_PCI_CFGDATA_OFS) 235#define MSC01_PCI_CFGDATA (MSC01_PCI_REG_BASE + MSC01_PCI_CFGDATA_OFS)
235#define MSC01_PCI_IACK (MSC01_PCI_REG_BASE + MSC01_PCI_IACK_OFS) 236#define MSC01_PCI_IACK (MSC01_PCI_REG_BASE + MSC01_PCI_IACK_OFS)
236#define MSC01_PCI_HEAD0 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD0_OFS) 237#define MSC01_PCI_HEAD0 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD0_OFS)
237#define MSC01_PCI_HEAD1 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD1_OFS) 238#define MSC01_PCI_HEAD1 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD1_OFS)
@@ -248,7 +249,7 @@ extern unsigned long _pcictrl_msc;
248#define MSC01_PCI_HEAD12 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS) 249#define MSC01_PCI_HEAD12 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
249#define MSC01_PCI_HEAD13 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS) 250#define MSC01_PCI_HEAD13 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
250#define MSC01_PCI_HEAD14 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS) 251#define MSC01_PCI_HEAD14 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
251#define MSC01_PCI_HEAD15 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS) 252#define MSC01_PCI_HEAD15 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
252#define MSC01_PCI_BAR0 (MSC01_PCI_REG_BASE + MSC01_PCI_BAR0_OFS) 253#define MSC01_PCI_BAR0 (MSC01_PCI_REG_BASE + MSC01_PCI_BAR0_OFS)
253#define MSC01_PCI_CFG (MSC01_PCI_REG_BASE + MSC01_PCI_CFG_OFS) 254#define MSC01_PCI_CFG (MSC01_PCI_REG_BASE + MSC01_PCI_CFG_OFS)
254#define MSC01_PCI_SWAP (MSC01_PCI_REG_BASE + MSC01_PCI_SWAP_OFS) 255#define MSC01_PCI_SWAP (MSC01_PCI_REG_BASE + MSC01_PCI_SWAP_OFS)
diff --git a/include/asm-mips/mips-boards/sim.h b/include/asm-mips/mips-boards/sim.h
new file mode 100644
index 000000000000..acb7c2331d98
--- /dev/null
+++ b/include/asm-mips/mips-boards/sim.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as
6 * 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
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 *
17 */
18
19#ifndef _ASM_MIPS_BOARDS_SIM_H
20#define _ASM_MIPS_BOARDS_SIM_H
21
22#define STATS_ON 1
23#define STATS_OFF 2
24#define STATS_CLEAR 3
25#define STATS_DUMP 4
26#define TRACE_ON 5
27#define TRACE_OFF 6
28
29
30#define simcfg(code) \
31({ \
32 __asm__ __volatile__( \
33 "sltiu $0,$0, %0" \
34 ::"i"(code) \
35 ); \
36})
37
38
39
40#endif
diff --git a/include/asm-mips/mips-boards/simint.h b/include/asm-mips/mips-boards/simint.h
new file mode 100644
index 000000000000..4952e0b3bf11
--- /dev/null
+++ b/include/asm-mips/mips-boards/simint.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as
6 * 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
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 */
17#ifndef _MIPS_SIMINT_H
18#define _MIPS_SIMINT_H
19
20
21#define SIM_INT_BASE 0
22#define MIPSCPU_INT_MB0 2
23#define MIPSCPU_INT_BASE 16
24#define MIPS_CPU_TIMER_IRQ 7
25
26
27#define MIPSCPU_INT_CPUCTR 7
28
29#define MSC01E_INT_BASE 64
30
31#define MIPSCPU_INT_CPUCTR 7
32#define MSC01E_INT_CPUCTR 11
33
34#endif
diff --git a/include/asm-mips/mipsmtregs.h b/include/asm-mips/mipsmtregs.h
new file mode 100644
index 000000000000..a669c0702c66
--- /dev/null
+++ b/include/asm-mips/mipsmtregs.h
@@ -0,0 +1,391 @@
1/*
2 * MT regs definitions, follows on from mipsregs.h
3 * Copyright (C) 2004 - 2005 MIPS Technologies, Inc. All rights reserved.
4 * Elizabeth Clarke et. al.
5 *
6 */
7#ifndef _ASM_MIPSMTREGS_H
8#define _ASM_MIPSMTREGS_H
9
10#include <asm/mipsregs.h>
11#include <asm/war.h>
12
13#ifndef __ASSEMBLY__
14
15/*
16 * C macros
17 */
18
19#define read_c0_mvpcontrol() __read_32bit_c0_register($0, 1)
20#define write_c0_mvpcontrol(val) __write_32bit_c0_register($0, 1, val)
21
22#define read_c0_mvpconf0() __read_32bit_c0_register($0, 2)
23#define read_c0_mvpconf1() __read_32bit_c0_register($0, 3)
24
25#define read_c0_vpecontrol() __read_32bit_c0_register($1, 1)
26#define write_c0_vpecontrol(val) __write_32bit_c0_register($1, 1, val)
27
28#define read_c0_vpeconf0() __read_32bit_c0_register($1, 2)
29#define write_c0_vpeconf0(val) __write_32bit_c0_register($1, 2, val)
30
31#define read_c0_tcstatus() __read_32bit_c0_register($2, 1)
32#define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val)
33
34#define read_c0_tcbind() __read_32bit_c0_register($2, 2)
35
36#define read_c0_tccontext() __read_32bit_c0_register($2, 5)
37#define write_c0_tccontext(val) __write_32bit_c0_register($2, 5, val)
38
39#else /* Assembly */
40/*
41 * Macros for use in assembly language code
42 */
43
44#define CP0_MVPCONTROL $0,1
45#define CP0_MVPCONF0 $0,2
46#define CP0_MVPCONF1 $0,3
47#define CP0_VPECONTROL $1,1
48#define CP0_VPECONF0 $1,2
49#define CP0_VPECONF1 $1,3
50#define CP0_YQMASK $1,4
51#define CP0_VPESCHEDULE $1,5
52#define CP0_VPESCHEFBK $1,6
53#define CP0_TCSTATUS $2,1
54#define CP0_TCBIND $2,2
55#define CP0_TCRESTART $2,3
56#define CP0_TCHALT $2,4
57#define CP0_TCCONTEXT $2,5
58#define CP0_TCSCHEDULE $2,6
59#define CP0_TCSCHEFBK $2,7
60#define CP0_SRSCONF0 $6,1
61#define CP0_SRSCONF1 $6,2
62#define CP0_SRSCONF2 $6,3
63#define CP0_SRSCONF3 $6,4
64#define CP0_SRSCONF4 $6,5
65
66#endif
67
68/* MVPControl fields */
69#define MVPCONTROL_EVP (_ULCAST_(1))
70
71#define MVPCONTROL_VPC_SHIFT 1
72#define MVPCONTROL_VPC (_ULCAST_(1) << MVPCONTROL_VPC_SHIFT)
73
74#define MVPCONTROL_STLB_SHIFT 2
75#define MVPCONTROL_STLB (_ULCAST_(1) << MVPCONTROL_STLB_SHIFT)
76
77
78/* MVPConf0 fields */
79#define MVPCONF0_PTC_SHIFT 0
80#define MVPCONF0_PTC ( _ULCAST_(0xff))
81#define MVPCONF0_PVPE_SHIFT 10
82#define MVPCONF0_PVPE ( _ULCAST_(0xf) << MVPCONF0_PVPE_SHIFT)
83#define MVPCONF0_TCA_SHIFT 15
84#define MVPCONF0_TCA ( _ULCAST_(1) << MVPCONF0_TCA_SHIFT)
85#define MVPCONF0_PTLBE_SHIFT 16
86#define MVPCONF0_PTLBE (_ULCAST_(0x3ff) << MVPCONF0_PTLBE_SHIFT)
87#define MVPCONF0_TLBS_SHIFT 29
88#define MVPCONF0_TLBS (_ULCAST_(1) << MVPCONF0_TLBS_SHIFT)
89#define MVPCONF0_M_SHIFT 31
90#define MVPCONF0_M (_ULCAST_(0x1) << MVPCONF0_M_SHIFT)
91
92
93/* config3 fields */
94#define CONFIG3_MT_SHIFT 2
95#define CONFIG3_MT (_ULCAST_(1) << CONFIG3_MT_SHIFT)
96
97
98/* VPEControl fields (per VPE) */
99#define VPECONTROL_TARGTC (_ULCAST_(0xff))
100
101#define VPECONTROL_TE_SHIFT 15
102#define VPECONTROL_TE (_ULCAST_(1) << VPECONTROL_TE_SHIFT)
103#define VPECONTROL_EXCPT_SHIFT 16
104#define VPECONTROL_EXCPT (_ULCAST_(0x7) << VPECONTROL_EXCPT_SHIFT)
105
106/* Thread Exception Codes for EXCPT field */
107#define THREX_TU 0
108#define THREX_TO 1
109#define THREX_IYQ 2
110#define THREX_GSX 3
111#define THREX_YSCH 4
112#define THREX_GSSCH 5
113
114#define VPECONTROL_GSI_SHIFT 20
115#define VPECONTROL_GSI (_ULCAST_(1) << VPECONTROL_GSI_SHIFT)
116#define VPECONTROL_YSI_SHIFT 21
117#define VPECONTROL_YSI (_ULCAST_(1) << VPECONTROL_YSI_SHIFT)
118
119/* VPEConf0 fields (per VPE) */
120#define VPECONF0_VPA_SHIFT 0
121#define VPECONF0_VPA (_ULCAST_(1) << VPECONF0_VPA_SHIFT)
122#define VPECONF0_MVP_SHIFT 1
123#define VPECONF0_MVP (_ULCAST_(1) << VPECONF0_MVP_SHIFT)
124#define VPECONF0_XTC_SHIFT 21
125#define VPECONF0_XTC (_ULCAST_(0xff) << VPECONF0_XTC_SHIFT)
126
127/* TCStatus fields (per TC) */
128#define TCSTATUS_TASID (_ULCAST_(0xff))
129#define TCSTATUS_IXMT_SHIFT 10
130#define TCSTATUS_IXMT (_ULCAST_(1) << TCSTATUS_IXMT_SHIFT)
131#define TCSTATUS_TKSU_SHIFT 11
132#define TCSTATUS_TKSU (_ULCAST_(3) << TCSTATUS_TKSU_SHIFT)
133#define TCSTATUS_A_SHIFT 13
134#define TCSTATUS_A (_ULCAST_(1) << TCSTATUS_A_SHIFT)
135#define TCSTATUS_DA_SHIFT 15
136#define TCSTATUS_DA (_ULCAST_(1) << TCSTATUS_DA_SHIFT)
137#define TCSTATUS_DT_SHIFT 20
138#define TCSTATUS_DT (_ULCAST_(1) << TCSTATUS_DT_SHIFT)
139#define TCSTATUS_TDS_SHIFT 21
140#define TCSTATUS_TDS (_ULCAST_(1) << TCSTATUS_TDS_SHIFT)
141#define TCSTATUS_TSST_SHIFT 22
142#define TCSTATUS_TSST (_ULCAST_(1) << TCSTATUS_TSST_SHIFT)
143#define TCSTATUS_RNST_SHIFT 23
144#define TCSTATUS_RNST (_ULCAST_(3) << TCSTATUS_RNST_SHIFT)
145/* Codes for RNST */
146#define TC_RUNNING 0
147#define TC_WAITING 1
148#define TC_YIELDING 2
149#define TC_GATED 3
150
151#define TCSTATUS_TMX_SHIFT 27
152#define TCSTATUS_TMX (_ULCAST_(1) << TCSTATUS_TMX_SHIFT)
153/* TCStatus TCU bits can use same definitions/offsets as CU bits in Status */
154
155/* TCBind */
156#define TCBIND_CURVPE_SHIFT 0
157#define TCBIND_CURVPE (_ULCAST_(0xf))
158
159#define TCBIND_CURTC_SHIFT 21
160
161#define TCBIND_CURTC (_ULCAST_(0xff) << TCBIND_CURTC_SHIFT)
162
163/* TCHalt */
164#define TCHALT_H (_ULCAST_(1))
165
166#ifndef __ASSEMBLY__
167
168extern void mips_mt_regdump(void);
169
170static inline unsigned int dvpe(void)
171{
172 int res = 0;
173
174 __asm__ __volatile__(
175 " .set push \n"
176 " .set noreorder \n"
177 " .set noat \n"
178 " .set mips32r2 \n"
179 " .word 0x41610001 # dvpe $1 \n"
180 " move %0, $1 \n"
181 " ehb \n"
182 " .set pop \n"
183 : "=r" (res));
184
185 instruction_hazard();
186
187 return res;
188}
189
190static inline void __raw_evpe(void)
191{
192 __asm__ __volatile__(
193 " .set push \n"
194 " .set noreorder \n"
195 " .set noat \n"
196 " .set mips32r2 \n"
197 " .word 0x41600021 # evpe \n"
198 " ehb \n"
199 " .set pop \n");
200}
201
202/* Enable multiMT if previous suggested it should be.
203 EMT_ENABLE to force */
204
205#define EVPE_ENABLE MVPCONTROL_EVP
206
207static inline void evpe(int previous)
208{
209 if ((previous & MVPCONTROL_EVP))
210 __raw_evpe();
211}
212
213static inline unsigned int dmt(void)
214{
215 int res;
216
217 __asm__ __volatile__(
218 " .set push \n"
219 " .set mips32r2 \n"
220 " .set noat \n"
221 " .word 0x41610BC1 # dmt $1 \n"
222 " ehb \n"
223 " move %0, $1 \n"
224 " .set pop \n"
225 : "=r" (res));
226
227 instruction_hazard();
228
229 return res;
230}
231
232static inline void __raw_emt(void)
233{
234 __asm__ __volatile__(
235 " .set noreorder \n"
236 " .set mips32r2 \n"
237 " emt \n"
238 " ehb \n"
239 " .set mips0 \n"
240 " .set reorder");
241}
242
243/* enable multiVPE if previous suggested it should be.
244 EVPE_ENABLE to force */
245
246#define EMT_ENABLE VPECONTROL_TE
247
248static inline void emt(int previous)
249{
250 if ((previous & EMT_ENABLE))
251 __raw_emt();
252}
253
254static inline void ehb(void)
255{
256 __asm__ __volatile__(
257 " .set mips32r2 \n"
258 " ehb \n"
259 " .set mips0 \n");
260}
261
262#define mftc0(rt,sel) \
263({ \
264 unsigned long __res; \
265 \
266 __asm__ __volatile__( \
267 " .set push \n" \
268 " .set mips32r2 \n" \
269 " .set noat \n" \
270 " # mftc0 $1, $" #rt ", " #sel " \n" \
271 " .word 0x41000800 | (" #rt " << 16) | " #sel " \n" \
272 " move %0, $1 \n" \
273 " .set pop \n" \
274 : "=r" (__res)); \
275 \
276 __res; \
277})
278
279#define mftgpr(rt) \
280({ \
281 unsigned long __res; \
282 \
283 __asm__ __volatile__( \
284 " .set push \n" \
285 " .set mips32r2 \n" \
286 " mftgpr %0," #rt " \n" \
287 " .set pop \n" \
288 : "=r" (__res)); \
289 \
290 __res; \
291})
292
293#define mftr(rt,u,sel) \
294({ \
295 unsigned long __res; \
296 \
297 __asm__ __volatile__( \
298 ".set noat\n\t" \
299 "mftr\t%0, " #rt ", " #u ", " #sel "\n\t" \
300 ".set at\n\t" \
301 : "=r" (__res)); \
302 \
303 __res; \
304})
305
306#define mttgpr(rd,v) \
307do { \
308 __asm__ __volatile__( \
309 " .set push \n" \
310 " .set mips32r2 \n" \
311 " .set noat \n" \
312 " move $1, %0 \n" \
313 " # mttgpr $1, " #rd " \n" \
314 " .word 0x41810020 | (" #rd " << 11) \n" \
315 " .set pop \n" \
316 : : "r" (v)); \
317} while (0)
318
319#define mttc0(rd,sel,v) \
320({ \
321 __asm__ __volatile__( \
322 " .set push \n" \
323 " .set mips32r2 \n" \
324 " .set noat \n" \
325 " move $1, %0 \n" \
326 " # mttc0 %0," #rd ", " #sel " \n" \
327 " .word 0x41810000 | (" #rd " << 11) | " #sel " \n" \
328 " .set pop \n" \
329 : \
330 : "r" (v)); \
331})
332
333
334#define mttr(rd,u,sel,v) \
335({ \
336 __asm__ __volatile__( \
337 "mttr %0," #rd ", " #u ", " #sel \
338 : : "r" (v)); \
339})
340
341
342#define settc(tc) \
343do { \
344 write_c0_vpecontrol((read_c0_vpecontrol()&~VPECONTROL_TARGTC) | (tc)); \
345 ehb(); \
346} while (0)
347
348
349/* you *must* set the target tc (settc) before trying to use these */
350#define read_vpe_c0_vpecontrol() mftc0(1, 1)
351#define write_vpe_c0_vpecontrol(val) mttc0(1, 1, val)
352#define read_vpe_c0_vpeconf0() mftc0(1, 2)
353#define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val)
354#define read_vpe_c0_status() mftc0(12, 0)
355#define write_vpe_c0_status(val) mttc0(12, 0, val)
356#define read_vpe_c0_cause() mftc0(13, 0)
357#define write_vpe_c0_cause(val) mttc0(13, 0, val)
358#define read_vpe_c0_config() mftc0(16, 0)
359#define write_vpe_c0_config(val) mttc0(16, 0, val)
360#define read_vpe_c0_config1() mftc0(16, 1)
361#define write_vpe_c0_config1(val) mttc0(16, 1, val)
362#define read_vpe_c0_config7() mftc0(16, 7)
363#define write_vpe_c0_config7(val) mttc0(16, 7, val)
364#define read_vpe_c0_ebase() mftc0(15,1)
365#define write_vpe_c0_ebase(val) mttc0(15, 1, val)
366#define write_vpe_c0_compare(val) mttc0(11, 0, val)
367
368
369/* TC */
370#define read_tc_c0_tcstatus() mftc0(2, 1)
371#define write_tc_c0_tcstatus(val) mttc0(2,1,val)
372#define read_tc_c0_tcbind() mftc0(2, 2)
373#define write_tc_c0_tcbind(val) mttc0(2,2,val)
374#define read_tc_c0_tcrestart() mftc0(2, 3)
375#define write_tc_c0_tcrestart(val) mttc0(2,3,val)
376#define read_tc_c0_tchalt() mftc0(2, 4)
377#define write_tc_c0_tchalt(val) mttc0(2,4,val)
378#define read_tc_c0_tccontext() mftc0(2, 5)
379#define write_tc_c0_tccontext(val) mttc0(2,5,val)
380
381/* GPR */
382#define read_tc_gpr_sp() mftgpr(29)
383#define write_tc_gpr_sp(val) mttgpr(29, val)
384#define read_tc_gpr_gp() mftgpr(28)
385#define write_tc_gpr_gp(val) mttgpr(28, val)
386
387__BUILD_SET_C0(mvpcontrol)
388
389#endif /* Not __ASSEMBLY__ */
390
391#endif
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
index 2197aa4ce456..80370e0a5589 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -8,7 +8,7 @@
8 * Modified for further R[236]000 support by Paul M. Antoine, 1996. 8 * Modified for further R[236]000 support by Paul M. Antoine, 1996.
9 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com 9 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. 10 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
11 * Copyright (C) 2003 Maciej W. Rozycki 11 * Copyright (C) 2003, 2004 Maciej W. Rozycki
12 */ 12 */
13#ifndef _ASM_MIPSREGS_H 13#ifndef _ASM_MIPSREGS_H
14#define _ASM_MIPSREGS_H 14#define _ASM_MIPSREGS_H
@@ -96,6 +96,16 @@
96#define CP0_S1_INTCONTROL $20 96#define CP0_S1_INTCONTROL $20
97 97
98/* 98/*
99 * Coprocessor 0 Set 2 register names
100 */
101#define CP0_S2_SRSCTL $12 /* MIPSR2 */
102
103/*
104 * Coprocessor 0 Set 3 register names
105 */
106#define CP0_S3_SRSMAP $12 /* MIPSR2 */
107
108/*
99 * TX39 Series 109 * TX39 Series
100 */ 110 */
101#define CP0_TX39_CACHE $7 111#define CP0_TX39_CACHE $7
@@ -281,6 +291,11 @@
281#define ST0_DL (_ULCAST_(1) << 24) 291#define ST0_DL (_ULCAST_(1) << 24)
282 292
283/* 293/*
294 * Enable the MIPS DSP ASE
295 */
296#define ST0_MX 0x01000000
297
298/*
284 * Bitfields in the TX39 family CP0 Configuration Register 3 299 * Bitfields in the TX39 family CP0 Configuration Register 3
285 */ 300 */
286#define TX39_CONF_ICS_SHIFT 19 301#define TX39_CONF_ICS_SHIFT 19
@@ -433,6 +448,14 @@
433#define R5K_CONF_SE (_ULCAST_(1) << 12) 448#define R5K_CONF_SE (_ULCAST_(1) << 12)
434#define R5K_CONF_SS (_ULCAST_(3) << 20) 449#define R5K_CONF_SS (_ULCAST_(3) << 20)
435 450
451/* Bits specific to the RM7000. */
452#define RM7K_CONF_SE (_ULCAST_(1) << 3)
453#define RM7K_CONF_TE (_ULCAST_(1) << 12)
454#define RM7K_CONF_CLK (_ULCAST_(1) << 16)
455#define RM7K_CONF_TC (_ULCAST_(1) << 17)
456#define RM7K_CONF_SI (_ULCAST_(3) << 20)
457#define RM7K_CONF_SC (_ULCAST_(1) << 31)
458
436/* Bits specific to the R10000. */ 459/* Bits specific to the R10000. */
437#define R10K_CONF_DN (_ULCAST_(3) << 3) 460#define R10K_CONF_DN (_ULCAST_(3) << 3)
438#define R10K_CONF_CT (_ULCAST_(1) << 5) 461#define R10K_CONF_CT (_ULCAST_(1) << 5)
@@ -475,6 +498,53 @@
475#define MIPS_CONF_M (_ULCAST_(1) << 31) 498#define MIPS_CONF_M (_ULCAST_(1) << 31)
476 499
477/* 500/*
501 * Bits in the MIPS32/64 PRA coprocessor 0 config registers 1 and above.
502 */
503#define MIPS_CONF1_FP (_ULCAST_(1) << 0)
504#define MIPS_CONF1_EP (_ULCAST_(1) << 1)
505#define MIPS_CONF1_CA (_ULCAST_(1) << 2)
506#define MIPS_CONF1_WR (_ULCAST_(1) << 3)
507#define MIPS_CONF1_PC (_ULCAST_(1) << 4)
508#define MIPS_CONF1_MD (_ULCAST_(1) << 5)
509#define MIPS_CONF1_C2 (_ULCAST_(1) << 6)
510#define MIPS_CONF1_DA (_ULCAST_(7) << 7)
511#define MIPS_CONF1_DL (_ULCAST_(7) << 10)
512#define MIPS_CONF1_DS (_ULCAST_(7) << 13)
513#define MIPS_CONF1_IA (_ULCAST_(7) << 16)
514#define MIPS_CONF1_IL (_ULCAST_(7) << 19)
515#define MIPS_CONF1_IS (_ULCAST_(7) << 22)
516#define MIPS_CONF1_TLBS (_ULCAST_(63)<< 25)
517
518#define MIPS_CONF2_SA (_ULCAST_(15)<< 0)
519#define MIPS_CONF2_SL (_ULCAST_(15)<< 4)
520#define MIPS_CONF2_SS (_ULCAST_(15)<< 8)
521#define MIPS_CONF2_SU (_ULCAST_(15)<< 12)
522#define MIPS_CONF2_TA (_ULCAST_(15)<< 16)
523#define MIPS_CONF2_TL (_ULCAST_(15)<< 20)
524#define MIPS_CONF2_TS (_ULCAST_(15)<< 24)
525#define MIPS_CONF2_TU (_ULCAST_(7) << 28)
526
527#define MIPS_CONF3_TL (_ULCAST_(1) << 0)
528#define MIPS_CONF3_SM (_ULCAST_(1) << 1)
529#define MIPS_CONF3_MT (_ULCAST_(1) << 2)
530#define MIPS_CONF3_SP (_ULCAST_(1) << 4)
531#define MIPS_CONF3_VINT (_ULCAST_(1) << 5)
532#define MIPS_CONF3_VEIC (_ULCAST_(1) << 6)
533#define MIPS_CONF3_LPA (_ULCAST_(1) << 7)
534#define MIPS_CONF3_DSP (_ULCAST_(1) << 10)
535
536/*
537 * Bits in the MIPS32/64 coprocessor 1 (FPU) revision register.
538 */
539#define MIPS_FPIR_S (_ULCAST_(1) << 16)
540#define MIPS_FPIR_D (_ULCAST_(1) << 17)
541#define MIPS_FPIR_PS (_ULCAST_(1) << 18)
542#define MIPS_FPIR_3D (_ULCAST_(1) << 19)
543#define MIPS_FPIR_W (_ULCAST_(1) << 20)
544#define MIPS_FPIR_L (_ULCAST_(1) << 21)
545#define MIPS_FPIR_F64 (_ULCAST_(1) << 22)
546
547/*
478 * R10000 performance counter definitions. 548 * R10000 performance counter definitions.
479 * 549 *
480 * FIXME: The R10000 performance counter opens a nice way to implement CPU 550 * FIXME: The R10000 performance counter opens a nice way to implement CPU
@@ -621,13 +691,13 @@ do { \
621 if (sel == 0) \ 691 if (sel == 0) \
622 __asm__ __volatile__( \ 692 __asm__ __volatile__( \
623 "mtc0\t%z0, " #register "\n\t" \ 693 "mtc0\t%z0, " #register "\n\t" \
624 : : "Jr" ((unsigned int)value)); \ 694 : : "Jr" ((unsigned int)(value))); \
625 else \ 695 else \
626 __asm__ __volatile__( \ 696 __asm__ __volatile__( \
627 ".set\tmips32\n\t" \ 697 ".set\tmips32\n\t" \
628 "mtc0\t%z0, " #register ", " #sel "\n\t" \ 698 "mtc0\t%z0, " #register ", " #sel "\n\t" \
629 ".set\tmips0" \ 699 ".set\tmips0" \
630 : : "Jr" ((unsigned int)value)); \ 700 : : "Jr" ((unsigned int)(value))); \
631} while (0) 701} while (0)
632 702
633#define __write_64bit_c0_register(register, sel, value) \ 703#define __write_64bit_c0_register(register, sel, value) \
@@ -676,7 +746,7 @@ do { \
676do { \ 746do { \
677 __asm__ __volatile__( \ 747 __asm__ __volatile__( \
678 "ctc0\t%z0, " #register "\n\t" \ 748 "ctc0\t%z0, " #register "\n\t" \
679 : : "Jr" ((unsigned int)value)); \ 749 : : "Jr" ((unsigned int)(value))); \
680} while (0) 750} while (0)
681 751
682/* 752/*
@@ -769,12 +839,24 @@ do { \
769#define read_c0_count() __read_32bit_c0_register($9, 0) 839#define read_c0_count() __read_32bit_c0_register($9, 0)
770#define write_c0_count(val) __write_32bit_c0_register($9, 0, val) 840#define write_c0_count(val) __write_32bit_c0_register($9, 0, val)
771 841
842#define read_c0_count2() __read_32bit_c0_register($9, 6) /* pnx8550 */
843#define write_c0_count2(val) __write_32bit_c0_register($9, 6, val)
844
845#define read_c0_count3() __read_32bit_c0_register($9, 7) /* pnx8550 */
846#define write_c0_count3(val) __write_32bit_c0_register($9, 7, val)
847
772#define read_c0_entryhi() __read_ulong_c0_register($10, 0) 848#define read_c0_entryhi() __read_ulong_c0_register($10, 0)
773#define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val) 849#define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val)
774 850
775#define read_c0_compare() __read_32bit_c0_register($11, 0) 851#define read_c0_compare() __read_32bit_c0_register($11, 0)
776#define write_c0_compare(val) __write_32bit_c0_register($11, 0, val) 852#define write_c0_compare(val) __write_32bit_c0_register($11, 0, val)
777 853
854#define read_c0_compare2() __read_32bit_c0_register($11, 6) /* pnx8550 */
855#define write_c0_compare2(val) __write_32bit_c0_register($11, 6, val)
856
857#define read_c0_compare3() __read_32bit_c0_register($11, 7) /* pnx8550 */
858#define write_c0_compare3(val) __write_32bit_c0_register($11, 7, val)
859
778#define read_c0_status() __read_32bit_c0_register($12, 0) 860#define read_c0_status() __read_32bit_c0_register($12, 0)
779#define write_c0_status(val) __write_32bit_c0_register($12, 0, val) 861#define write_c0_status(val) __write_32bit_c0_register($12, 0, val)
780 862
@@ -790,10 +872,18 @@ do { \
790#define read_c0_config1() __read_32bit_c0_register($16, 1) 872#define read_c0_config1() __read_32bit_c0_register($16, 1)
791#define read_c0_config2() __read_32bit_c0_register($16, 2) 873#define read_c0_config2() __read_32bit_c0_register($16, 2)
792#define read_c0_config3() __read_32bit_c0_register($16, 3) 874#define read_c0_config3() __read_32bit_c0_register($16, 3)
875#define read_c0_config4() __read_32bit_c0_register($16, 4)
876#define read_c0_config5() __read_32bit_c0_register($16, 5)
877#define read_c0_config6() __read_32bit_c0_register($16, 6)
878#define read_c0_config7() __read_32bit_c0_register($16, 7)
793#define write_c0_config(val) __write_32bit_c0_register($16, 0, val) 879#define write_c0_config(val) __write_32bit_c0_register($16, 0, val)
794#define write_c0_config1(val) __write_32bit_c0_register($16, 1, val) 880#define write_c0_config1(val) __write_32bit_c0_register($16, 1, val)
795#define write_c0_config2(val) __write_32bit_c0_register($16, 2, val) 881#define write_c0_config2(val) __write_32bit_c0_register($16, 2, val)
796#define write_c0_config3(val) __write_32bit_c0_register($16, 3, val) 882#define write_c0_config3(val) __write_32bit_c0_register($16, 3, val)
883#define write_c0_config4(val) __write_32bit_c0_register($16, 4, val)
884#define write_c0_config5(val) __write_32bit_c0_register($16, 5, val)
885#define write_c0_config6(val) __write_32bit_c0_register($16, 6, val)
886#define write_c0_config7(val) __write_32bit_c0_register($16, 7, val)
797 887
798/* 888/*
799 * The WatchLo register. There may be upto 8 of them. 889 * The WatchLo register. There may be upto 8 of them.
@@ -917,6 +1007,22 @@ do { \
917#define read_c0_errorepc() __read_ulong_c0_register($30, 0) 1007#define read_c0_errorepc() __read_ulong_c0_register($30, 0)
918#define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val) 1008#define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val)
919 1009
1010/* MIPSR2 */
1011#define read_c0_hwrena() __read_32bit_c0_register($7,0)
1012#define write_c0_hwrena(val) __write_32bit_c0_register($7, 0, val)
1013
1014#define read_c0_intctl() __read_32bit_c0_register($12, 1)
1015#define write_c0_intctl(val) __write_32bit_c0_register($12, 1, val)
1016
1017#define read_c0_srsctl() __read_32bit_c0_register($12, 2)
1018#define write_c0_srsctl(val) __write_32bit_c0_register($12, 2, val)
1019
1020#define read_c0_srsmap() __read_32bit_c0_register($12, 3)
1021#define write_c0_srsmap(val) __write_32bit_c0_register($12, 3, val)
1022
1023#define read_c0_ebase() __read_32bit_c0_register($15,1)
1024#define write_c0_ebase(val) __write_32bit_c0_register($15, 1, val)
1025
920/* 1026/*
921 * Macros to access the floating point coprocessor control registers 1027 * Macros to access the floating point coprocessor control registers
922 */ 1028 */
@@ -930,6 +1036,284 @@ do { \
930 : "=r" (__res)); \ 1036 : "=r" (__res)); \
931 __res;}) 1037 __res;})
932 1038
1039#define rddsp(mask) \
1040({ \
1041 unsigned int __res; \
1042 \
1043 __asm__ __volatile__( \
1044 " .set push \n" \
1045 " .set noat \n" \
1046 " # rddsp $1, %x1 \n" \
1047 " .word 0x7c000cb8 | (%x1 << 16) \n" \
1048 " move %0, $1 \n" \
1049 " .set pop \n" \
1050 : "=r" (__res) \
1051 : "i" (mask)); \
1052 __res; \
1053})
1054
1055#define wrdsp(val, mask) \
1056do { \
1057 __asm__ __volatile__( \
1058 " .set push \n" \
1059 " .set noat \n" \
1060 " move $1, %0 \n" \
1061 " # wrdsp $1, %x1 \n" \
1062 " .word 0x7c2004f8 | (%x1 << 15) \n" \
1063 " .set pop \n" \
1064 : \
1065 : "r" (val), "i" (mask)); \
1066} while (0)
1067
1068#if 0 /* Need DSP ASE capable assembler ... */
1069#define mflo0() ({ long mflo0; __asm__("mflo %0, $ac0" : "=r" (mflo0)); mflo0;})
1070#define mflo1() ({ long mflo1; __asm__("mflo %0, $ac1" : "=r" (mflo1)); mflo1;})
1071#define mflo2() ({ long mflo2; __asm__("mflo %0, $ac2" : "=r" (mflo2)); mflo2;})
1072#define mflo3() ({ long mflo3; __asm__("mflo %0, $ac3" : "=r" (mflo3)); mflo3;})
1073
1074#define mfhi0() ({ long mfhi0; __asm__("mfhi %0, $ac0" : "=r" (mfhi0)); mfhi0;})
1075#define mfhi1() ({ long mfhi1; __asm__("mfhi %0, $ac1" : "=r" (mfhi1)); mfhi1;})
1076#define mfhi2() ({ long mfhi2; __asm__("mfhi %0, $ac2" : "=r" (mfhi2)); mfhi2;})
1077#define mfhi3() ({ long mfhi3; __asm__("mfhi %0, $ac3" : "=r" (mfhi3)); mfhi3;})
1078
1079#define mtlo0(x) __asm__("mtlo %0, $ac0" ::"r" (x))
1080#define mtlo1(x) __asm__("mtlo %0, $ac1" ::"r" (x))
1081#define mtlo2(x) __asm__("mtlo %0, $ac2" ::"r" (x))
1082#define mtlo3(x) __asm__("mtlo %0, $ac3" ::"r" (x))
1083
1084#define mthi0(x) __asm__("mthi %0, $ac0" ::"r" (x))
1085#define mthi1(x) __asm__("mthi %0, $ac1" ::"r" (x))
1086#define mthi2(x) __asm__("mthi %0, $ac2" ::"r" (x))
1087#define mthi3(x) __asm__("mthi %0, $ac3" ::"r" (x))
1088
1089#else
1090
1091#define mfhi0() \
1092({ \
1093 unsigned long __treg; \
1094 \
1095 __asm__ __volatile__( \
1096 " .set push \n" \
1097 " .set noat \n" \
1098 " # mfhi %0, $ac0 \n" \
1099 " .word 0x00000810 \n" \
1100 " move %0, $1 \n" \
1101 " .set pop \n" \
1102 : "=r" (__treg)); \
1103 __treg; \
1104})
1105
1106#define mfhi1() \
1107({ \
1108 unsigned long __treg; \
1109 \
1110 __asm__ __volatile__( \
1111 " .set push \n" \
1112 " .set noat \n" \
1113 " # mfhi %0, $ac1 \n" \
1114 " .word 0x00200810 \n" \
1115 " move %0, $1 \n" \
1116 " .set pop \n" \
1117 : "=r" (__treg)); \
1118 __treg; \
1119})
1120
1121#define mfhi2() \
1122({ \
1123 unsigned long __treg; \
1124 \
1125 __asm__ __volatile__( \
1126 " .set push \n" \
1127 " .set noat \n" \
1128 " # mfhi %0, $ac2 \n" \
1129 " .word 0x00400810 \n" \
1130 " move %0, $1 \n" \
1131 " .set pop \n" \
1132 : "=r" (__treg)); \
1133 __treg; \
1134})
1135
1136#define mfhi3() \
1137({ \
1138 unsigned long __treg; \
1139 \
1140 __asm__ __volatile__( \
1141 " .set push \n" \
1142 " .set noat \n" \
1143 " # mfhi %0, $ac3 \n" \
1144 " .word 0x00600810 \n" \
1145 " move %0, $1 \n" \
1146 " .set pop \n" \
1147 : "=r" (__treg)); \
1148 __treg; \
1149})
1150
1151#define mflo0() \
1152({ \
1153 unsigned long __treg; \
1154 \
1155 __asm__ __volatile__( \
1156 " .set push \n" \
1157 " .set noat \n" \
1158 " # mflo %0, $ac0 \n" \
1159 " .word 0x00000812 \n" \
1160 " move %0, $1 \n" \
1161 " .set pop \n" \
1162 : "=r" (__treg)); \
1163 __treg; \
1164})
1165
1166#define mflo1() \
1167({ \
1168 unsigned long __treg; \
1169 \
1170 __asm__ __volatile__( \
1171 " .set push \n" \
1172 " .set noat \n" \
1173 " # mflo %0, $ac1 \n" \
1174 " .word 0x00200812 \n" \
1175 " move %0, $1 \n" \
1176 " .set pop \n" \
1177 : "=r" (__treg)); \
1178 __treg; \
1179})
1180
1181#define mflo2() \
1182({ \
1183 unsigned long __treg; \
1184 \
1185 __asm__ __volatile__( \
1186 " .set push \n" \
1187 " .set noat \n" \
1188 " # mflo %0, $ac2 \n" \
1189 " .word 0x00400812 \n" \
1190 " move %0, $1 \n" \
1191 " .set pop \n" \
1192 : "=r" (__treg)); \
1193 __treg; \
1194})
1195
1196#define mflo3() \
1197({ \
1198 unsigned long __treg; \
1199 \
1200 __asm__ __volatile__( \
1201 " .set push \n" \
1202 " .set noat \n" \
1203 " # mflo %0, $ac3 \n" \
1204 " .word 0x00600812 \n" \
1205 " move %0, $1 \n" \
1206 " .set pop \n" \
1207 : "=r" (__treg)); \
1208 __treg; \
1209})
1210
1211#define mthi0(x) \
1212do { \
1213 __asm__ __volatile__( \
1214 " .set push \n" \
1215 " .set noat \n" \
1216 " move $1, %0 \n" \
1217 " # mthi $1, $ac0 \n" \
1218 " .word 0x00200011 \n" \
1219 " .set pop \n" \
1220 : \
1221 : "r" (x)); \
1222} while (0)
1223
1224#define mthi1(x) \
1225do { \
1226 __asm__ __volatile__( \
1227 " .set push \n" \
1228 " .set noat \n" \
1229 " move $1, %0 \n" \
1230 " # mthi $1, $ac1 \n" \
1231 " .word 0x00200811 \n" \
1232 " .set pop \n" \
1233 : \
1234 : "r" (x)); \
1235} while (0)
1236
1237#define mthi2(x) \
1238do { \
1239 __asm__ __volatile__( \
1240 " .set push \n" \
1241 " .set noat \n" \
1242 " move $1, %0 \n" \
1243 " # mthi $1, $ac2 \n" \
1244 " .word 0x00201011 \n" \
1245 " .set pop \n" \
1246 : \
1247 : "r" (x)); \
1248} while (0)
1249
1250#define mthi3(x) \
1251do { \
1252 __asm__ __volatile__( \
1253 " .set push \n" \
1254 " .set noat \n" \
1255 " move $1, %0 \n" \
1256 " # mthi $1, $ac3 \n" \
1257 " .word 0x00201811 \n" \
1258 " .set pop \n" \
1259 : \
1260 : "r" (x)); \
1261} while (0)
1262
1263#define mtlo0(x) \
1264do { \
1265 __asm__ __volatile__( \
1266 " .set push \n" \
1267 " .set noat \n" \
1268 " move $1, %0 \n" \
1269 " # mtlo $1, $ac0 \n" \
1270 " .word 0x00200013 \n" \
1271 " .set pop \n" \
1272 : \
1273 : "r" (x)); \
1274} while (0)
1275
1276#define mtlo1(x) \
1277do { \
1278 __asm__ __volatile__( \
1279 " .set push \n" \
1280 " .set noat \n" \
1281 " move $1, %0 \n" \
1282 " # mtlo $1, $ac1 \n" \
1283 " .word 0x00200813 \n" \
1284 " .set pop \n" \
1285 : \
1286 : "r" (x)); \
1287} while (0)
1288
1289#define mtlo2(x) \
1290do { \
1291 __asm__ __volatile__( \
1292 " .set push \n" \
1293 " .set noat \n" \
1294 " move $1, %0 \n" \
1295 " # mtlo $1, $ac2 \n" \
1296 " .word 0x00201013 \n" \
1297 " .set pop \n" \
1298 : \
1299 : "r" (x)); \
1300} while (0)
1301
1302#define mtlo3(x) \
1303do { \
1304 __asm__ __volatile__( \
1305 " .set push \n" \
1306 " .set noat \n" \
1307 " move $1, %0 \n" \
1308 " # mtlo $1, $ac3 \n" \
1309 " .word 0x00201813 \n" \
1310 " .set pop \n" \
1311 : \
1312 : "r" (x)); \
1313} while (0)
1314
1315#endif
1316
933/* 1317/*
934 * TLB operations. 1318 * TLB operations.
935 * 1319 *
@@ -1012,6 +1396,8 @@ __BUILD_SET_C0(status)
1012__BUILD_SET_C0(cause) 1396__BUILD_SET_C0(cause)
1013__BUILD_SET_C0(config) 1397__BUILD_SET_C0(config)
1014__BUILD_SET_C0(intcontrol) 1398__BUILD_SET_C0(intcontrol)
1399__BUILD_SET_C0(intctl)
1400__BUILD_SET_C0(srsmap)
1015 1401
1016#endif /* !__ASSEMBLY__ */ 1402#endif /* !__ASSEMBLY__ */
1017 1403
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index 45cd72d172e8..19cdf7642e66 100644
--- a/include/asm-mips/mmu_context.h
+++ b/include/asm-mips/mmu_context.h
@@ -30,7 +30,7 @@ extern unsigned long pgd_current[];
30 30
31#ifdef CONFIG_32BIT 31#ifdef CONFIG_32BIT
32#define TLBMISS_HANDLER_SETUP() \ 32#define TLBMISS_HANDLER_SETUP() \
33 write_c0_context((unsigned long) smp_processor_id() << 23); \ 33 write_c0_context((unsigned long) smp_processor_id() << 25); \
34 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 34 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
35#endif 35#endif
36#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) 36#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
@@ -40,7 +40,7 @@ extern unsigned long pgd_current[];
40#endif 40#endif
41#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64) 41#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
42#define TLBMISS_HANDLER_SETUP() \ 42#define TLBMISS_HANDLER_SETUP() \
43 write_c0_context((unsigned long) smp_processor_id() << 23); \ 43 write_c0_context((unsigned long) smp_processor_id() << 26); \
44 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 44 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
45#endif 45#endif
46 46
diff --git a/include/asm-mips/mmzone.h b/include/asm-mips/mmzone.h
index d721143dbd47..011caebac369 100644
--- a/include/asm-mips/mmzone.h
+++ b/include/asm-mips/mmzone.h
@@ -5,6 +5,7 @@
5#ifndef _ASM_MMZONE_H_ 5#ifndef _ASM_MMZONE_H_
6#define _ASM_MMZONE_H_ 6#define _ASM_MMZONE_H_
7 7
8#include <linux/config.h>
8#include <asm/page.h> 9#include <asm/page.h>
9#include <mmzone.h> 10#include <mmzone.h>
10 11
diff --git a/include/asm-mips/module.h b/include/asm-mips/module.h
index 0be58b2aeb9f..2be399311eec 100644
--- a/include/asm-mips/module.h
+++ b/include/asm-mips/module.h
@@ -14,15 +14,23 @@ struct mod_arch_specific {
14 14
15typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ 15typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
16 16
17typedef struct 17typedef struct {
18{ 18 Elf64_Addr r_offset; /* Address of relocation. */
19 Elf64_Addr r_offset; /* Address of relocation. */ 19 Elf64_Word r_sym; /* Symbol index. */
20 Elf64_Word r_sym; /* Symbol index. */ 20 Elf64_Byte r_ssym; /* Special symbol. */
21 Elf64_Byte r_ssym; /* Special symbol. */ 21 Elf64_Byte r_type3; /* Third relocation. */
22 Elf64_Byte r_type3; /* Third relocation. */ 22 Elf64_Byte r_type2; /* Second relocation. */
23 Elf64_Byte r_type2; /* Second relocation. */ 23 Elf64_Byte r_type; /* First relocation. */
24 Elf64_Byte r_type; /* First relocation. */ 24} Elf64_Mips_Rel;
25 Elf64_Sxword r_addend; /* Addend. */ 25
26typedef struct {
27 Elf64_Addr r_offset; /* Address of relocation. */
28 Elf64_Word r_sym; /* Symbol index. */
29 Elf64_Byte r_ssym; /* Special symbol. */
30 Elf64_Byte r_type3; /* Third relocation. */
31 Elf64_Byte r_type2; /* Second relocation. */
32 Elf64_Byte r_type; /* First relocation. */
33 Elf64_Sxword r_addend; /* Addend. */
26} Elf64_Mips_Rela; 34} Elf64_Mips_Rela;
27 35
28#ifdef CONFIG_32BIT 36#ifdef CONFIG_32BIT
@@ -30,6 +38,13 @@ typedef struct
30#define Elf_Shdr Elf32_Shdr 38#define Elf_Shdr Elf32_Shdr
31#define Elf_Sym Elf32_Sym 39#define Elf_Sym Elf32_Sym
32#define Elf_Ehdr Elf32_Ehdr 40#define Elf_Ehdr Elf32_Ehdr
41#define Elf_Addr Elf32_Addr
42
43#define Elf_Mips_Rel Elf32_Rel
44#define Elf_Mips_Rela Elf32_Rela
45
46#define ELF_MIPS_R_SYM(rel) ELF32_R_SYM(rel.r_info)
47#define ELF_MIPS_R_TYPE(rel) ELF32_R_TYPE(rel.r_info)
33 48
34#endif 49#endif
35 50
@@ -38,6 +53,13 @@ typedef struct
38#define Elf_Shdr Elf64_Shdr 53#define Elf_Shdr Elf64_Shdr
39#define Elf_Sym Elf64_Sym 54#define Elf_Sym Elf64_Sym
40#define Elf_Ehdr Elf64_Ehdr 55#define Elf_Ehdr Elf64_Ehdr
56#define Elf_Addr Elf64_Addr
57
58#define Elf_Mips_Rel Elf64_Mips_Rel
59#define Elf_Mips_Rela Elf64_Mips_Rela
60
61#define ELF_MIPS_R_SYM(rel) (rel.r_sym)
62#define ELF_MIPS_R_TYPE(rel) (rel.r_type)
41 63
42#endif 64#endif
43 65
@@ -53,4 +75,54 @@ search_module_dbetables(unsigned long addr)
53} 75}
54#endif 76#endif
55 77
78#ifdef CONFIG_CPU_MIPS32_R1
79#define MODULE_PROC_FAMILY "MIPS32_R1"
80#elif defined CONFIG_CPU_MIPS32_R2
81#define MODULE_PROC_FAMILY "MIPS32_R2"
82#elif defined CONFIG_CPU_MIPS64_R1
83#define MODULE_PROC_FAMILY "MIPS64_R1"
84#elif defined CONFIG_CPU_MIPS64_R2
85#define MODULE_PROC_FAMILY "MIPS64_R2"
86#elif defined CONFIG_CPU_R3000
87#define MODULE_PROC_FAMILY "R3000"
88#elif defined CONFIG_CPU_TX39XX
89#define MODULE_PROC_FAMILY "TX39XX"
90#elif defined CONFIG_CPU_VR41XX
91#define MODULE_PROC_FAMILY "VR41XX"
92#elif defined CONFIG_CPU_R4300
93#define MODULE_PROC_FAMILY "R4300"
94#elif defined CONFIG_CPU_R4X00
95#define MODULE_PROC_FAMILY "R4X00"
96#elif defined CONFIG_CPU_TX49XX
97#define MODULE_PROC_FAMILY "TX49XX"
98#elif defined CONFIG_CPU_R5000
99#define MODULE_PROC_FAMILY "R5000"
100#elif defined CONFIG_CPU_R5432
101#define MODULE_PROC_FAMILY "R5432"
102#elif defined CONFIG_CPU_R6000
103#define MODULE_PROC_FAMILY "R6000"
104#elif defined CONFIG_CPU_NEVADA
105#define MODULE_PROC_FAMILY "NEVADA"
106#elif defined CONFIG_CPU_R8000
107#define MODULE_PROC_FAMILY "R8000"
108#elif defined CONFIG_CPU_R10000
109#define MODULE_PROC_FAMILY "R10000"
110#elif defined CONFIG_CPU_RM7000
111#define MODULE_PROC_FAMILY "RM7000"
112#elif defined CONFIG_CPU_RM9000
113#define MODULE_PROC_FAMILY "RM9000"
114#elif defined CONFIG_CPU_SB1
115#define MODULE_PROC_FAMILY "SB1"
116#else
117#error MODULE_PROC_FAMILY undefined for your processor configuration
118#endif
119
120#ifdef CONFIG_32BIT
121#define MODULE_KERNEL_TYPE "32BIT "
122#elif defined CONFIG_64BIT
123#define MODULE_KERNEL_TYPE "64BIT "
124#endif
125
126#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_KERNEL_TYPE
127
56#endif /* _ASM_MODULE_H */ 128#endif /* _ASM_MODULE_H */
diff --git a/include/asm-mips/paccess.h b/include/asm-mips/paccess.h
index 309bc3099f68..46f2d23d2697 100644
--- a/include/asm-mips/paccess.h
+++ b/include/asm-mips/paccess.h
@@ -52,7 +52,7 @@ struct __large_pstruct { unsigned long buf[100]; };
52}) 52})
53 53
54#define __get_dbe_asm(insn) \ 54#define __get_dbe_asm(insn) \
55({ \ 55{ \
56 __asm__ __volatile__( \ 56 __asm__ __volatile__( \
57 "1:\t" insn "\t%1,%2\n\t" \ 57 "1:\t" insn "\t%1,%2\n\t" \
58 "move\t%0,$0\n" \ 58 "move\t%0,$0\n" \
@@ -67,7 +67,7 @@ struct __large_pstruct { unsigned long buf[100]; };
67 ".previous" \ 67 ".previous" \
68 :"=r" (__gu_err), "=r" (__gu_val) \ 68 :"=r" (__gu_err), "=r" (__gu_val) \
69 :"o" (__mp(__gu_addr)), "i" (-EFAULT)); \ 69 :"o" (__mp(__gu_addr)), "i" (-EFAULT)); \
70}) 70}
71 71
72extern void __get_dbe_unknown(void); 72extern void __get_dbe_unknown(void);
73 73
@@ -90,7 +90,7 @@ extern void __get_dbe_unknown(void);
90}) 90})
91 91
92#define __put_dbe_asm(insn) \ 92#define __put_dbe_asm(insn) \
93({ \ 93{ \
94 __asm__ __volatile__( \ 94 __asm__ __volatile__( \
95 "1:\t" insn "\t%1,%2\n\t" \ 95 "1:\t" insn "\t%1,%2\n\t" \
96 "move\t%0,$0\n" \ 96 "move\t%0,$0\n" \
@@ -104,7 +104,7 @@ extern void __get_dbe_unknown(void);
104 ".previous" \ 104 ".previous" \
105 : "=r" (__pu_err) \ 105 : "=r" (__pu_err) \
106 : "r" (__pu_val), "o" (__mp(__pu_addr)), "i" (-EFAULT)); \ 106 : "r" (__pu_val), "o" (__mp(__pu_addr)), "i" (-EFAULT)); \
107}) 107}
108 108
109extern void __put_dbe_unknown(void); 109extern void __put_dbe_unknown(void);
110 110
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 652b6d67a571..ee25a779bf49 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -87,22 +87,48 @@ static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
87typedef struct { unsigned long pte; } pte_t; 87typedef struct { unsigned long pte; } pte_t;
88#define pte_val(x) ((x).pte) 88#define pte_val(x) ((x).pte)
89#endif 89#endif
90#define __pte(x) ((pte_t) { (x) } )
90 91
91typedef struct { unsigned long pmd; } pmd_t; 92/*
92typedef struct { unsigned long pgd; } pgd_t; 93 * For 3-level pagetables we defines these ourselves, for 2-level the
93typedef struct { unsigned long pgprot; } pgprot_t; 94 * definitions are supplied by <asm-generic/pgtable-nopmd.h>.
95 */
96#ifdef CONFIG_64BIT
94 97
98typedef struct { unsigned long pmd; } pmd_t;
95#define pmd_val(x) ((x).pmd) 99#define pmd_val(x) ((x).pmd)
96#define pgd_val(x) ((x).pgd) 100#define __pmd(x) ((pmd_t) { (x) } )
97#define pgprot_val(x) ((x).pgprot)
98 101
99#define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t))) 102#endif
100 103
101#define __pte(x) ((pte_t) { (x) } ) 104/*
102#define __pmd(x) ((pmd_t) { (x) } ) 105 * Right now we don't support 4-level pagetables, so all pud-related
106 * definitions come from <asm-generic/pgtable-nopud.h>.
107 */
108
109/*
110 * Finall the top of the hierarchy, the pgd
111 */
112typedef struct { unsigned long pgd; } pgd_t;
113#define pgd_val(x) ((x).pgd)
103#define __pgd(x) ((pgd_t) { (x) } ) 114#define __pgd(x) ((pgd_t) { (x) } )
115
116/*
117 * Manipulate page protection bits
118 */
119typedef struct { unsigned long pgprot; } pgprot_t;
120#define pgprot_val(x) ((x).pgprot)
104#define __pgprot(x) ((pgprot_t) { (x) } ) 121#define __pgprot(x) ((pgprot_t) { (x) } )
105 122
123/*
124 * On R4000-style MMUs where a TLB entry is mapping a adjacent even / odd
125 * pair of pages we only have a single global bit per pair of pages. When
126 * writing to the TLB make sure we always have the bit set for both pages
127 * or none. This macro is used to access the `buddy' of the pte we're just
128 * working on.
129 */
130#define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t)))
131
106#endif /* !__ASSEMBLY__ */ 132#endif /* !__ASSEMBLY__ */
107 133
108/* to align the pointer to the (next) page boundary */ 134/* to align the pointer to the (next) page boundary */
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
index c9a00ca1c012..6c9ad8171a77 100644
--- a/include/asm-mips/pci.h
+++ b/include/asm-mips/pci.h
@@ -40,6 +40,11 @@ struct pci_controller {
40 unsigned int need_domain_info; 40 unsigned int need_domain_info;
41 41
42 int iommu; 42 int iommu;
43
44 /* Optional access methods for reading/writing the bus number
45 of the PCI controller */
46 int (*get_busno)(void);
47 void (*set_busno)(int busno);
43}; 48};
44 49
45/* 50/*
@@ -142,8 +147,22 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
142 147
143extern void pcibios_resource_to_bus(struct pci_dev *dev, 148extern void pcibios_resource_to_bus(struct pci_dev *dev,
144 struct pci_bus_region *region, struct resource *res); 149 struct pci_bus_region *region, struct resource *res);
145extern void pcibios_bus_to_resource(struct pci_dev *dev, 150
146 struct resource *res, struct pci_bus_region *region); 151extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
152 struct pci_bus_region *region);
153
154static inline struct resource *
155pcibios_select_root(struct pci_dev *pdev, struct resource *res)
156{
157 struct resource *root = NULL;
158
159 if (res->flags & IORESOURCE_IO)
160 root = &ioport_resource;
161 if (res->flags & IORESOURCE_MEM)
162 root = &iomem_resource;
163
164 return root;
165}
147 166
148#ifdef CONFIG_PCI_DOMAINS 167#ifdef CONFIG_PCI_DOMAINS
149 168
@@ -169,17 +188,4 @@ static inline void pcibios_add_platform_entries(struct pci_dev *dev)
169/* Do platform specific device initialization at pci_enable_device() time */ 188/* Do platform specific device initialization at pci_enable_device() time */
170extern int pcibios_plat_dev_init(struct pci_dev *dev); 189extern int pcibios_plat_dev_init(struct pci_dev *dev);
171 190
172static inline struct resource *
173pcibios_select_root(struct pci_dev *pdev, struct resource *res)
174{
175 struct resource *root = NULL;
176
177 if (res->flags & IORESOURCE_IO)
178 root = &ioport_resource;
179 if (res->flags & IORESOURCE_MEM)
180 root = &iomem_resource;
181
182 return root;
183}
184
185#endif /* _ASM_PCI_H */ 191#endif /* _ASM_PCI_H */
diff --git a/include/asm-mips/pgalloc.h b/include/asm-mips/pgalloc.h
index ce57288d43bd..fe1df572318b 100644
--- a/include/asm-mips/pgalloc.h
+++ b/include/asm-mips/pgalloc.h
@@ -26,10 +26,22 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
26} 26}
27 27
28/* 28/*
29 * Initialize a new pmd table with invalid pointers.
30 */
31extern void pmd_init(unsigned long page, unsigned long pagetable);
32
33#ifdef CONFIG_64BIT
34
35static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
36{
37 set_pud(pud, __pud((unsigned long)pmd));
38}
39#endif
40
41/*
29 * Initialize a new pgd / pmd table with invalid pointers. 42 * Initialize a new pgd / pmd table with invalid pointers.
30 */ 43 */
31extern void pgd_init(unsigned long page); 44extern void pgd_init(unsigned long page);
32extern void pmd_init(unsigned long page, unsigned long pagetable);
33 45
34static inline pgd_t *pgd_alloc(struct mm_struct *mm) 46static inline pgd_t *pgd_alloc(struct mm_struct *mm)
35{ 47{
@@ -86,21 +98,18 @@ static inline void pte_free(struct page *pte)
86#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) 98#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
87 99
88#ifdef CONFIG_32BIT 100#ifdef CONFIG_32BIT
89#define pgd_populate(mm, pmd, pte) BUG()
90 101
91/* 102/*
92 * allocating and freeing a pmd is trivial: the 1-entry pmd is 103 * allocating and freeing a pmd is trivial: the 1-entry pmd is
93 * inside the pgd, so has no extra memory associated with it. 104 * inside the pgd, so has no extra memory associated with it.
94 */ 105 */
95#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
96#define pmd_free(x) do { } while (0) 106#define pmd_free(x) do { } while (0)
97#define __pmd_free_tlb(tlb,x) do { } while (0) 107#define __pmd_free_tlb(tlb,x) do { } while (0)
108
98#endif 109#endif
99 110
100#ifdef CONFIG_64BIT 111#ifdef CONFIG_64BIT
101 112
102#define pgd_populate(mm, pgd, pmd) set_pgd(pgd, __pgd(pmd))
103
104static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) 113static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
105{ 114{
106 pmd_t *pmd; 115 pmd_t *pmd;
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index 7fec93b76da9..0cff64ce0fb8 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -17,6 +17,8 @@
17#include <asm/cachectl.h> 17#include <asm/cachectl.h>
18#include <asm/fixmap.h> 18#include <asm/fixmap.h>
19 19
20#include <asm-generic/pgtable-nopmd.h>
21
20/* 22/*
21 * - add_wired_entry() add a fixed TLB entry, and move wired register 23 * - add_wired_entry() add a fixed TLB entry, and move wired register
22 */ 24 */
@@ -41,42 +43,38 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
41 * works even with the cache aliasing problem the R4k and above have. 43 * works even with the cache aliasing problem the R4k and above have.
42 */ 44 */
43 45
44/* PMD_SHIFT determines the size of the area a second-level page table can map */ 46/* PGDIR_SHIFT determines what a third-level page table entry can map */
45#ifdef CONFIG_64BIT_PHYS_ADDR 47#ifdef CONFIG_64BIT_PHYS_ADDR
46#define PMD_SHIFT 21 48#define PGDIR_SHIFT 21
47#else 49#else
48#define PMD_SHIFT 22 50#define PGDIR_SHIFT 22
49#endif 51#endif
50#define PMD_SIZE (1UL << PMD_SHIFT)
51#define PMD_MASK (~(PMD_SIZE-1))
52
53/* PGDIR_SHIFT determines what a third-level page table entry can map */
54#define PGDIR_SHIFT PMD_SHIFT
55#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 52#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
56#define PGDIR_MASK (~(PGDIR_SIZE-1)) 53#define PGDIR_MASK (~(PGDIR_SIZE-1))
57 54
58/* 55/*
59 * Entries per page directory level: we use two-level, so 56 * Entries per page directory level: we use two-level, so
60 * we don't really have any PMD directory physically. 57 * we don't really have any PUD/PMD directory physically.
61 */ 58 */
62#ifdef CONFIG_64BIT_PHYS_ADDR 59#ifdef CONFIG_64BIT_PHYS_ADDR
63#define PGD_ORDER 1 60#define PGD_ORDER 1
64#define PMD_ORDER 0 61#define PUD_ORDER aieeee_attempt_to_allocate_pud
62#define PMD_ORDER 1
65#define PTE_ORDER 0 63#define PTE_ORDER 0
66#else 64#else
67#define PGD_ORDER 0 65#define PGD_ORDER 0
68#define PMD_ORDER 0 66#define PUD_ORDER aieeee_attempt_to_allocate_pud
67#define PMD_ORDER 1
69#define PTE_ORDER 0 68#define PTE_ORDER 0
70#endif 69#endif
71 70
72#define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t)) 71#define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
73#define PTRS_PER_PMD 1
74#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) 72#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
75 73
76#define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE) 74#define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE)
77#define FIRST_USER_ADDRESS 0 75#define FIRST_USER_ADDRESS 0
78 76
79#define VMALLOC_START KSEG2 77#define VMALLOC_START MAP_BASE
80 78
81#ifdef CONFIG_HIGHMEM 79#ifdef CONFIG_HIGHMEM
82# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) 80# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
@@ -91,8 +89,6 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
91#define pte_ERROR(e) \ 89#define pte_ERROR(e) \
92 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) 90 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
93#endif 91#endif
94#define pmd_ERROR(e) \
95 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
96#define pgd_ERROR(e) \ 92#define pgd_ERROR(e) \
97 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) 93 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
98 94
@@ -120,17 +116,7 @@ static inline void pmd_clear(pmd_t *pmdp)
120 pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); 116 pmd_val(*pmdp) = ((unsigned long) invalid_pte_table);
121} 117}
122 118
123/* 119#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
124 * The "pgd_xxx()" functions here are trivial for a folded two-level
125 * setup: the pgd is never bad, and a pmd always exists (as it's folded
126 * into the pgd entry)
127 */
128static inline int pgd_none(pgd_t pgd) { return 0; }
129static inline int pgd_bad(pgd_t pgd) { return 0; }
130static inline int pgd_present(pgd_t pgd) { return 1; }
131static inline void pgd_clear(pgd_t *pgdp) { }
132
133#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
134#define pte_page(x) pfn_to_page(pte_pfn(x)) 120#define pte_page(x) pfn_to_page(pte_pfn(x))
135#define pte_pfn(x) ((unsigned long)((x).pte_high >> 6)) 121#define pte_pfn(x) ((unsigned long)((x).pte_high >> 6))
136static inline pte_t 122static inline pte_t
@@ -151,27 +137,22 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
151#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot)) 137#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
152#else 138#else
153#define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT)) 139#define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT))
154#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 140#define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
155#endif 141#endif
156#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */ 142#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) */
157 143
158#define __pgd_offset(address) pgd_index(address) 144#define __pgd_offset(address) pgd_index(address)
145#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
159#define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) 146#define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
160 147
161/* to find an entry in a kernel page-table-directory */ 148/* to find an entry in a kernel page-table-directory */
162#define pgd_offset_k(address) pgd_offset(&init_mm, address) 149#define pgd_offset_k(address) pgd_offset(&init_mm, address)
163 150
164#define pgd_index(address) ((address) >> PGDIR_SHIFT) 151#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
165 152
166/* to find an entry in a page-table-directory */ 153/* to find an entry in a page-table-directory */
167#define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) 154#define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr))
168 155
169/* Find an entry in the second-level page table.. */
170static inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address)
171{
172 return (pmd_t *) dir;
173}
174
175/* Find an entry in the third-level page table.. */ 156/* Find an entry in the third-level page table.. */
176#define __pte_offset(address) \ 157#define __pte_offset(address) \
177 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 158 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
@@ -221,7 +202,7 @@ static inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address)
221 */ 202 */
222#define PTE_FILE_MAX_BITS 27 203#define PTE_FILE_MAX_BITS 27
223 204
224#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 205#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
225 /* fixme */ 206 /* fixme */
226#define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f)) 207#define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f))
227#define pgoff_to_pte(off) \ 208#define pgoff_to_pte(off) \
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index 1011e0635f56..82166b254b27 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -16,13 +16,15 @@
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/cachectl.h> 17#include <asm/cachectl.h>
18 18
19#include <asm-generic/pgtable-nopud.h>
20
19/* 21/*
20 * Each address space has 2 4K pages as its page directory, giving 1024 22 * Each address space has 2 4K pages as its page directory, giving 1024
21 * (== PTRS_PER_PGD) 8 byte pointers to pmd tables. Each pmd table is a 23 * (== PTRS_PER_PGD) 8 byte pointers to pmd tables. Each pmd table is a
22 * pair of 4K pages, giving 1024 (== PTRS_PER_PMD) 8 byte pointers to 24 * single 4K page, giving 512 (== PTRS_PER_PMD) 8 byte pointers to page
23 * page tables. Each page table is a single 4K page, giving 512 (== 25 * tables. Each page table is also a single 4K page, giving 512 (==
24 * PTRS_PER_PTE) 8 byte ptes. Each pgde is initialized to point to 26 * PTRS_PER_PTE) 8 byte ptes. Each pud entry is initialized to point to
25 * invalid_pmd_table, each pmde is initialized to point to 27 * invalid_pmd_table, each pmd entry is initialized to point to
26 * invalid_pte_table, each pte is initialized to 0. When memory is low, 28 * invalid_pte_table, each pte is initialized to 0. When memory is low,
27 * and a pmd table or a page table allocation fails, empty_bad_pmd_table 29 * and a pmd table or a page table allocation fails, empty_bad_pmd_table
28 * and empty_bad_page_table is returned back to higher layer code, so 30 * and empty_bad_page_table is returned back to higher layer code, so
@@ -36,17 +38,17 @@
36 */ 38 */
37 39
38/* PMD_SHIFT determines the size of the area a second-level page table can map */ 40/* PMD_SHIFT determines the size of the area a second-level page table can map */
39#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT - 3)) 41#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3))
40#define PMD_SIZE (1UL << PMD_SHIFT) 42#define PMD_SIZE (1UL << PMD_SHIFT)
41#define PMD_MASK (~(PMD_SIZE-1)) 43#define PMD_MASK (~(PMD_SIZE-1))
42 44
43/* PGDIR_SHIFT determines what a third-level page table entry can map */ 45/* PGDIR_SHIFT determines what a third-level page table entry can map */
44#define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + 1 - 3)) 46#define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3))
45#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 47#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
46#define PGDIR_MASK (~(PGDIR_SIZE-1)) 48#define PGDIR_MASK (~(PGDIR_SIZE-1))
47 49
48/* 50/*
49 * For 4kB page size we use a 3 level page tree and a 8kB pmd and pgds which 51 * For 4kB page size we use a 3 level page tree and an 8kB pud, which
50 * permits us mapping 40 bits of virtual address space. 52 * permits us mapping 40 bits of virtual address space.
51 * 53 *
52 * We used to implement 41 bits by having an order 1 pmd level but that seemed 54 * We used to implement 41 bits by having an order 1 pmd level but that seemed
@@ -57,7 +59,7 @@
57 * two levels would be easy to implement. 59 * two levels would be easy to implement.
58 * 60 *
59 * For 16kB page size we use a 2 level page tree which permits a total of 61 * For 16kB page size we use a 2 level page tree which permits a total of
60 * 36 bits of virtual address space. We could add a third leve. but it seems 62 * 36 bits of virtual address space. We could add a third level but it seems
61 * like at the moment there's no need for this. 63 * like at the moment there's no need for this.
62 * 64 *
63 * For 64kB page size we use a 2 level page table tree for a total of 42 bits 65 * For 64kB page size we use a 2 level page table tree for a total of 42 bits
@@ -65,21 +67,25 @@
65 */ 67 */
66#ifdef CONFIG_PAGE_SIZE_4KB 68#ifdef CONFIG_PAGE_SIZE_4KB
67#define PGD_ORDER 1 69#define PGD_ORDER 1
70#define PUD_ORDER aieeee_attempt_to_allocate_pud
68#define PMD_ORDER 0 71#define PMD_ORDER 0
69#define PTE_ORDER 0 72#define PTE_ORDER 0
70#endif 73#endif
71#ifdef CONFIG_PAGE_SIZE_8KB 74#ifdef CONFIG_PAGE_SIZE_8KB
72#define PGD_ORDER 0 75#define PGD_ORDER 0
76#define PUD_ORDER aieeee_attempt_to_allocate_pud
73#define PMD_ORDER 0 77#define PMD_ORDER 0
74#define PTE_ORDER 0 78#define PTE_ORDER 0
75#endif 79#endif
76#ifdef CONFIG_PAGE_SIZE_16KB 80#ifdef CONFIG_PAGE_SIZE_16KB
77#define PGD_ORDER 0 81#define PGD_ORDER 0
82#define PUD_ORDER aieeee_attempt_to_allocate_pud
78#define PMD_ORDER 0 83#define PMD_ORDER 0
79#define PTE_ORDER 0 84#define PTE_ORDER 0
80#endif 85#endif
81#ifdef CONFIG_PAGE_SIZE_64KB 86#ifdef CONFIG_PAGE_SIZE_64KB
82#define PGD_ORDER 0 87#define PGD_ORDER 0
88#define PUD_ORDER aieeee_attempt_to_allocate_pud
83#define PMD_ORDER 0 89#define PMD_ORDER 0
84#define PTE_ORDER 0 90#define PTE_ORDER 0
85#endif 91#endif
@@ -91,7 +97,7 @@
91#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) 97#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
92#define FIRST_USER_ADDRESS 0 98#define FIRST_USER_ADDRESS 0
93 99
94#define VMALLOC_START XKSEG 100#define VMALLOC_START MAP_BASE
95#define VMALLOC_END \ 101#define VMALLOC_END \
96 (VMALLOC_START + PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE) 102 (VMALLOC_START + PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE)
97 103
@@ -102,13 +108,13 @@
102#define pgd_ERROR(e) \ 108#define pgd_ERROR(e) \
103 printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) 109 printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e))
104 110
105extern pte_t invalid_pte_table[PAGE_SIZE/sizeof(pte_t)]; 111extern pte_t invalid_pte_table[PTRS_PER_PTE];
106extern pte_t empty_bad_page_table[PAGE_SIZE/sizeof(pte_t)]; 112extern pte_t empty_bad_page_table[PTRS_PER_PTE];
107extern pmd_t invalid_pmd_table[2*PAGE_SIZE/sizeof(pmd_t)]; 113extern pmd_t invalid_pmd_table[PTRS_PER_PMD];
108extern pmd_t empty_bad_pmd_table[2*PAGE_SIZE/sizeof(pmd_t)]; 114extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD];
109 115
110/* 116/*
111 * Empty pmd entries point to the invalid_pte_table. 117 * Empty pgd/pmd entries point to the invalid_pte_table.
112 */ 118 */
113static inline int pmd_none(pmd_t pmd) 119static inline int pmd_none(pmd_t pmd)
114{ 120{
@@ -128,26 +134,30 @@ static inline void pmd_clear(pmd_t *pmdp)
128} 134}
129 135
130/* 136/*
131 * Empty pgd entries point to the invalid_pmd_table. 137 * Empty pud entries point to the invalid_pmd_table.
132 */ 138 */
133static inline int pgd_none(pgd_t pgd) 139static inline int pud_none(pud_t pud)
134{ 140{
135 return pgd_val(pgd) == (unsigned long) invalid_pmd_table; 141 return pud_val(pud) == (unsigned long) invalid_pmd_table;
136} 142}
137 143
138#define pgd_bad(pgd) (pgd_val(pgd) &~ PAGE_MASK) 144static inline int pud_bad(pud_t pud)
145{
146 return pud_val(pud) & ~PAGE_MASK;
147}
139 148
140static inline int pgd_present(pgd_t pgd) 149static inline int pud_present(pud_t pud)
141{ 150{
142 return pgd_val(pgd) != (unsigned long) invalid_pmd_table; 151 return pud_val(pud) != (unsigned long) invalid_pmd_table;
143} 152}
144 153
145static inline void pgd_clear(pgd_t *pgdp) 154static inline void pud_clear(pud_t *pudp)
146{ 155{
147 pgd_val(*pgdp) = ((unsigned long) invalid_pmd_table); 156 pud_val(*pudp) = ((unsigned long) invalid_pmd_table);
148} 157}
149 158
150#define pte_page(x) pfn_to_page((unsigned long)((pte_val(x) >> PAGE_SHIFT))) 159#define pte_page(x) pfn_to_page(pte_pfn(x))
160
151#ifdef CONFIG_CPU_VR41XX 161#ifdef CONFIG_CPU_VR41XX
152#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2))) 162#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
153#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot)) 163#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
@@ -157,26 +167,27 @@ static inline void pgd_clear(pgd_t *pgdp)
157#endif 167#endif
158 168
159#define __pgd_offset(address) pgd_index(address) 169#define __pgd_offset(address) pgd_index(address)
160#define page_pte(page) page_pte_prot(page, __pgprot(0)) 170#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
171#define __pmd_offset(address) pmd_index(address)
161 172
162/* to find an entry in a kernel page-table-directory */ 173/* to find an entry in a kernel page-table-directory */
163#define pgd_offset_k(address) pgd_offset(&init_mm, 0) 174#define pgd_offset_k(address) pgd_offset(&init_mm, 0)
164 175
165#define pgd_index(address) ((address) >> PGDIR_SHIFT) 176#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
177#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
166 178
167/* to find an entry in a page-table-directory */ 179/* to find an entry in a page-table-directory */
168#define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) 180#define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr))
169 181
170static inline unsigned long pgd_page(pgd_t pgd) 182static inline unsigned long pud_page(pud_t pud)
171{ 183{
172 return pgd_val(pgd); 184 return pud_val(pud);
173} 185}
174 186
175/* Find an entry in the second-level page table.. */ 187/* Find an entry in the second-level page table.. */
176static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address) 188static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address)
177{ 189{
178 return (pmd_t *) pgd_page(*dir) + 190 return (pmd_t *) pud_page(*pud) + pmd_index(address);
179 ((address >> PMD_SHIFT) & (PTRS_PER_PMD - 1));
180} 191}
181 192
182/* Find an entry in the third-level page table.. */ 193/* Find an entry in the third-level page table.. */
diff --git a/include/asm-mips/pgtable-bits.h b/include/asm-mips/pgtable-bits.h
index 3aad751ccd5f..01e76e932e3f 100644
--- a/include/asm-mips/pgtable-bits.h
+++ b/include/asm-mips/pgtable-bits.h
@@ -33,7 +33,7 @@
33 * unpredictable things. The code (when it is written) to deal with 33 * unpredictable things. The code (when it is written) to deal with
34 * this problem will be in the update_mmu_cache() code for the r4k. 34 * this problem will be in the update_mmu_cache() code for the r4k.
35 */ 35 */
36#if defined(CONFIG_CPU_MIPS32) && defined(CONFIG_64BIT_PHYS_ADDR) 36#if defined(CONFIG_CPU_MIPS32_R1) && defined(CONFIG_64BIT_PHYS_ADDR)
37 37
38#define _PAGE_PRESENT (1<<6) /* implemented in software */ 38#define _PAGE_PRESENT (1<<6) /* implemented in software */
39#define _PAGE_READ (1<<7) /* implemented in software */ 39#define _PAGE_READ (1<<7) /* implemented in software */
@@ -123,7 +123,7 @@
123 123
124#endif 124#endif
125#endif 125#endif
126#endif /* defined(CONFIG_CPU_MIPS32) && defined(CONFIG_64BIT_PHYS_ADDR) */ 126#endif /* defined(CONFIG_CPU_MIPS32_R1) && defined(CONFIG_64BIT_PHYS_ADDR) */
127 127
128#define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED) 128#define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED)
129#define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED) 129#define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED)
@@ -140,7 +140,7 @@
140#define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_COW 140#define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_COW
141#endif 141#endif
142 142
143#if defined(CONFIG_CPU_MIPS32) && defined(CONFIG_64BIT_PHYS_ADDR) 143#if defined(CONFIG_CPU_MIPS32_R1) && defined(CONFIG_64BIT_PHYS_ADDR)
144#define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 3) 144#define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 3)
145#else 145#else
146#define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 9) 146#define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 9)
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index eaf5d9b3a0e1..34facd996503 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -8,8 +8,6 @@
8#ifndef _ASM_PGTABLE_H 8#ifndef _ASM_PGTABLE_H
9#define _ASM_PGTABLE_H 9#define _ASM_PGTABLE_H
10 10
11#include <asm-generic/4level-fixup.h>
12
13#include <linux/config.h> 11#include <linux/config.h>
14#ifdef CONFIG_32BIT 12#ifdef CONFIG_32BIT
15#include <asm/pgtable-32.h> 13#include <asm/pgtable-32.h>
@@ -18,6 +16,7 @@
18#include <asm/pgtable-64.h> 16#include <asm/pgtable-64.h>
19#endif 17#endif
20 18
19#include <asm/io.h>
21#include <asm/pgtable-bits.h> 20#include <asm/pgtable-bits.h>
22 21
23#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT) 22#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT)
@@ -76,7 +75,6 @@ extern void paging_init(void);
76 * Conversion functions: convert a page and protection to a page entry, 75 * Conversion functions: convert a page and protection to a page entry,
77 * and a page entry and page directory to the page they refer to. 76 * and a page entry and page directory to the page they refer to.
78 */ 77 */
79#define page_pte(page) page_pte_prot(page, __pgprot(0))
80#define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) 78#define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET)
81#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) 79#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
82#define pmd_page_kernel(pmd) pmd_val(pmd) 80#define pmd_page_kernel(pmd) pmd_val(pmd)
@@ -84,7 +82,7 @@ extern void paging_init(void);
84#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL)) 82#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
85#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) 83#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
86 84
87#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 85#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
88static inline void set_pte(pte_t *ptep, pte_t pte) 86static inline void set_pte(pte_t *ptep, pte_t pte)
89{ 87{
90 ptep->pte_high = pte.pte_high; 88 ptep->pte_high = pte.pte_high;
@@ -148,11 +146,18 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt
148#endif 146#endif
149 147
150/* 148/*
151 * (pmds are folded into pgds so this doesn't get actually called, 149 * (pmds are folded into puds so this doesn't get actually called,
152 * but the define is needed for a generic inline function.) 150 * but the define is needed for a generic inline function.)
153 */ 151 */
154#define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0) 152#define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
155#define set_pgd(pgdptr, pgdval) do { *(pgdptr) = (pgdval); } while(0) 153
154#ifdef CONFIG_64BIT
155/*
156 * (puds are folded into pgds so this doesn't get actually called,
157 * but the define is needed for a generic inline function.)
158 */
159#define set_pud(pudptr, pudval) do { *(pudptr) = (pudval); } while(0)
160#endif
156 161
157#define PGD_T_LOG2 ffz(~sizeof(pgd_t)) 162#define PGD_T_LOG2 ffz(~sizeof(pgd_t))
158#define PMD_T_LOG2 ffz(~sizeof(pmd_t)) 163#define PMD_T_LOG2 ffz(~sizeof(pmd_t))
@@ -165,7 +170,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
165 * Undefined behaviour if not.. 170 * Undefined behaviour if not..
166 */ 171 */
167static inline int pte_user(pte_t pte) { BUG(); return 0; } 172static inline int pte_user(pte_t pte) { BUG(); return 0; }
168#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 173#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
169static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_READ; } 174static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_READ; }
170static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_WRITE; } 175static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_WRITE; }
171static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_MODIFIED; } 176static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_MODIFIED; }
@@ -324,7 +329,7 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
324 */ 329 */
325#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 330#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
326 331
327#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 332#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
328static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 333static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
329{ 334{
330 pte.pte_low &= _PAGE_CHG_MASK; 335 pte.pte_low &= _PAGE_CHG_MASK;
@@ -357,7 +362,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
357#endif 362#endif
358 363
359#ifdef CONFIG_64BIT_PHYS_ADDR 364#ifdef CONFIG_64BIT_PHYS_ADDR
360extern phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size);
361extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); 365extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot);
362 366
363static inline int io_remap_pfn_range(struct vm_area_struct *vma, 367static inline int io_remap_pfn_range(struct vm_area_struct *vma,
@@ -367,7 +371,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
367 pgprot_t prot) 371 pgprot_t prot)
368{ 372{
369 phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size); 373 phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size);
370 return remap_pfn_range(vma, vaddr, pfn, size, prot); 374 return remap_pfn_range(vma, vaddr, phys_addr_high >> PAGE_SHIFT, size, prot);
371} 375}
372#else 376#else
373#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ 377#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
index d6466aa09fb7..f1980c6c3bcc 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -96,12 +96,26 @@ union mips_fpu_union {
96 {{0,},} \ 96 {{0,},} \
97} 97}
98 98
99#define NUM_DSP_REGS 6
100
101typedef __u32 dspreg_t;
102
103struct mips_dsp_state {
104 dspreg_t dspr[NUM_DSP_REGS];
105 unsigned int dspcontrol;
106 unsigned short used_dsp;
107};
108
109#define INIT_DSP {{0,},}
110
99typedef struct { 111typedef struct {
100 unsigned long seg; 112 unsigned long seg;
101} mm_segment_t; 113} mm_segment_t;
102 114
103#define ARCH_MIN_TASKALIGN 8 115#define ARCH_MIN_TASKALIGN 8
104 116
117struct mips_abi;
118
105/* 119/*
106 * If you change thread_struct remember to change the #defines below too! 120 * If you change thread_struct remember to change the #defines below too!
107 */ 121 */
@@ -117,6 +131,9 @@ struct thread_struct {
117 /* Saved fpu/fpu emulator stuff. */ 131 /* Saved fpu/fpu emulator stuff. */
118 union mips_fpu_union fpu; 132 union mips_fpu_union fpu;
119 133
134 /* Saved state of the DSP ASE, if available. */
135 struct mips_dsp_state dsp;
136
120 /* Other stuff associated with the thread. */ 137 /* Other stuff associated with the thread. */
121 unsigned long cp0_badvaddr; /* Last user fault */ 138 unsigned long cp0_badvaddr; /* Last user fault */
122 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */ 139 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
@@ -129,6 +146,7 @@ struct thread_struct {
129 unsigned long mflags; 146 unsigned long mflags;
130 unsigned long irix_trampoline; /* Wheee... */ 147 unsigned long irix_trampoline; /* Wheee... */
131 unsigned long irix_oldctx; 148 unsigned long irix_oldctx;
149 struct mips_abi *abi;
132}; 150};
133 151
134#define MF_ABI_MASK (MF_32BIT_REGS | MF_32BIT_ADDR) 152#define MF_ABI_MASK (MF_32BIT_REGS | MF_32BIT_ADDR)
@@ -151,6 +169,10 @@ struct thread_struct {
151 */ \ 169 */ \
152 INIT_FPU, \ 170 INIT_FPU, \
153 /* \ 171 /* \
172 * saved dsp/dsp emulator stuff \
173 */ \
174 INIT_DSP, \
175 /* \
154 * Other stuff associated with the process \ 176 * Other stuff associated with the process \
155 */ \ 177 */ \
156 0, 0, 0, 0, \ 178 0, 0, 0, 0, \
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index 2b5c624c3d4f..95c5839ac465 100644
--- a/include/asm-mips/ptrace.h
+++ b/include/asm-mips/ptrace.h
@@ -22,6 +22,8 @@
22#define MMLO 68 22#define MMLO 68
23#define FPC_CSR 69 23#define FPC_CSR 69
24#define FPC_EIR 70 24#define FPC_EIR 70
25#define DSP_BASE 71 /* 3 more hi / lo register pairs */
26#define DSP_CONTROL 77
25 27
26/* 28/*
27 * This struct defines the way the registers are stored on the stack during a 29 * This struct defines the way the registers are stored on the stack during a
@@ -38,18 +40,18 @@ struct pt_regs {
38 40
39 /* Saved special registers. */ 41 /* Saved special registers. */
40 unsigned long cp0_status; 42 unsigned long cp0_status;
41 unsigned long lo;
42 unsigned long hi; 43 unsigned long hi;
44 unsigned long lo;
43 unsigned long cp0_badvaddr; 45 unsigned long cp0_badvaddr;
44 unsigned long cp0_cause; 46 unsigned long cp0_cause;
45 unsigned long cp0_epc; 47 unsigned long cp0_epc;
46}; 48};
47 49
48/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ 50/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
49/* #define PTRACE_GETREGS 12 */ 51#define PTRACE_GETREGS 12
50/* #define PTRACE_SETREGS 13 */ 52#define PTRACE_SETREGS 13
51/* #define PTRACE_GETFPREGS 14 */ 53#define PTRACE_GETFPREGS 14
52/* #define PTRACE_SETFPREGS 15 */ 54#define PTRACE_SETFPREGS 15
53/* #define PTRACE_GETFPXREGS 18 */ 55/* #define PTRACE_GETFPXREGS 18 */
54/* #define PTRACE_SETFPXREGS 19 */ 56/* #define PTRACE_SETFPXREGS 19 */
55 57
@@ -58,6 +60,13 @@ struct pt_regs {
58#define PTRACE_GET_THREAD_AREA 25 60#define PTRACE_GET_THREAD_AREA 25
59#define PTRACE_SET_THREAD_AREA 26 61#define PTRACE_SET_THREAD_AREA 26
60 62
63/* Calls to trace a 64bit program from a 32bit program. */
64#define PTRACE_PEEKTEXT_3264 0xc0
65#define PTRACE_PEEKDATA_3264 0xc1
66#define PTRACE_POKETEXT_3264 0xc2
67#define PTRACE_POKEDATA_3264 0xc3
68#define PTRACE_GET_THREAD_AREA_3264 0xc4
69
61#ifdef __KERNEL__ 70#ifdef __KERNEL__
62 71
63#include <linux/linkage.h> 72#include <linux/linkage.h>
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
index 5bea49feec66..a5ea9d828aee 100644
--- a/include/asm-mips/r4kcache.h
+++ b/include/asm-mips/r4kcache.h
@@ -21,7 +21,7 @@
21 * 21 *
22 * - The MIPS32 and MIPS64 specs permit an implementation to directly derive 22 * - The MIPS32 and MIPS64 specs permit an implementation to directly derive
23 * the index bits from the virtual address. This breaks with tradition 23 * the index bits from the virtual address. This breaks with tradition
24 * set by the R4000. To keep unpleassant surprises from happening we pick 24 * set by the R4000. To keep unpleasant surprises from happening we pick
25 * an address in KSEG0 / CKSEG0. 25 * an address in KSEG0 / CKSEG0.
26 * - We need a properly sign extended address for 64-bit code. To get away 26 * - We need a properly sign extended address for 64-bit code. To get away
27 * without ifdefs we let the compiler do it by a type cast. 27 * without ifdefs we let the compiler do it by a type cast.
@@ -30,11 +30,11 @@
30 30
31#define cache_op(op,addr) \ 31#define cache_op(op,addr) \
32 __asm__ __volatile__( \ 32 __asm__ __volatile__( \
33 " .set push \n" \
33 " .set noreorder \n" \ 34 " .set noreorder \n" \
34 " .set mips3\n\t \n" \ 35 " .set mips3\n\t \n" \
35 " cache %0, %1 \n" \ 36 " cache %0, %1 \n" \
36 " .set mips0 \n" \ 37 " .set pop \n" \
37 " .set reorder" \
38 : \ 38 : \
39 : "i" (op), "m" (*(unsigned char *)(addr))) 39 : "i" (op), "m" (*(unsigned char *)(addr)))
40 40
@@ -84,14 +84,14 @@ static inline void flush_scache_line(unsigned long addr)
84static inline void protected_flush_icache_line(unsigned long addr) 84static inline void protected_flush_icache_line(unsigned long addr)
85{ 85{
86 __asm__ __volatile__( 86 __asm__ __volatile__(
87 ".set noreorder\n\t" 87 " .set push \n"
88 ".set mips3\n" 88 " .set noreorder \n"
89 "1:\tcache %0,(%1)\n" 89 " .set mips3 \n"
90 "2:\t.set mips0\n\t" 90 "1: cache %0, (%1) \n"
91 ".set reorder\n\t" 91 "2: .set pop \n"
92 ".section\t__ex_table,\"a\"\n\t" 92 " .section __ex_table,\"a\" \n"
93 STR(PTR)"\t1b,2b\n\t" 93 " "STR(PTR)" 1b, 2b \n"
94 ".previous" 94 " .previous"
95 : 95 :
96 : "i" (Hit_Invalidate_I), "r" (addr)); 96 : "i" (Hit_Invalidate_I), "r" (addr));
97} 97}
@@ -100,19 +100,19 @@ static inline void protected_flush_icache_line(unsigned long addr)
100 * R10000 / R12000 hazard - these processors don't support the Hit_Writeback_D 100 * R10000 / R12000 hazard - these processors don't support the Hit_Writeback_D
101 * cacheop so we use Hit_Writeback_Inv_D which is supported by all R4000-style 101 * cacheop so we use Hit_Writeback_Inv_D which is supported by all R4000-style
102 * caches. We're talking about one cacheline unnecessarily getting invalidated 102 * caches. We're talking about one cacheline unnecessarily getting invalidated
103 * here so the penaltiy isn't overly hard. 103 * here so the penalty isn't overly hard.
104 */ 104 */
105static inline void protected_writeback_dcache_line(unsigned long addr) 105static inline void protected_writeback_dcache_line(unsigned long addr)
106{ 106{
107 __asm__ __volatile__( 107 __asm__ __volatile__(
108 ".set noreorder\n\t" 108 " .set push \n"
109 ".set mips3\n" 109 " .set noreorder \n"
110 "1:\tcache %0,(%1)\n" 110 " .set mips3 \n"
111 "2:\t.set mips0\n\t" 111 "1: cache %0, (%1) \n"
112 ".set reorder\n\t" 112 "2: .set pop \n"
113 ".section\t__ex_table,\"a\"\n\t" 113 " .section __ex_table,\"a\" \n"
114 STR(PTR)"\t1b,2b\n\t" 114 " "STR(PTR)" 1b, 2b \n"
115 ".previous" 115 " .previous"
116 : 116 :
117 : "i" (Hit_Writeback_Inv_D), "r" (addr)); 117 : "i" (Hit_Writeback_Inv_D), "r" (addr));
118} 118}
@@ -120,14 +120,14 @@ static inline void protected_writeback_dcache_line(unsigned long addr)
120static inline void protected_writeback_scache_line(unsigned long addr) 120static inline void protected_writeback_scache_line(unsigned long addr)
121{ 121{
122 __asm__ __volatile__( 122 __asm__ __volatile__(
123 ".set noreorder\n\t" 123 " .set push \n"
124 ".set mips3\n" 124 " .set noreorder \n"
125 "1:\tcache %0,(%1)\n" 125 " .set mips3 \n"
126 "2:\t.set mips0\n\t" 126 "1: cache %0, (%1) \n"
127 ".set reorder\n\t" 127 "2: .set pop \n"
128 ".section\t__ex_table,\"a\"\n\t" 128 " .section __ex_table,\"a\" \n"
129 STR(PTR)"\t1b,2b\n\t" 129 " "STR(PTR)" 1b, 2b \n"
130 ".previous" 130 " .previous"
131 : 131 :
132 : "i" (Hit_Writeback_Inv_SD), "r" (addr)); 132 : "i" (Hit_Writeback_Inv_SD), "r" (addr));
133} 133}
@@ -142,6 +142,7 @@ static inline void invalidate_tcache_page(unsigned long addr)
142 142
143#define cache16_unroll32(base,op) \ 143#define cache16_unroll32(base,op) \
144 __asm__ __volatile__( \ 144 __asm__ __volatile__( \
145 " .set push \n" \
145 " .set noreorder \n" \ 146 " .set noreorder \n" \
146 " .set mips3 \n" \ 147 " .set mips3 \n" \
147 " cache %1, 0x000(%0); cache %1, 0x010(%0) \n" \ 148 " cache %1, 0x000(%0); cache %1, 0x010(%0) \n" \
@@ -160,8 +161,7 @@ static inline void invalidate_tcache_page(unsigned long addr)
160 " cache %1, 0x1a0(%0); cache %1, 0x1b0(%0) \n" \ 161 " cache %1, 0x1a0(%0); cache %1, 0x1b0(%0) \n" \
161 " cache %1, 0x1c0(%0); cache %1, 0x1d0(%0) \n" \ 162 " cache %1, 0x1c0(%0); cache %1, 0x1d0(%0) \n" \
162 " cache %1, 0x1e0(%0); cache %1, 0x1f0(%0) \n" \ 163 " cache %1, 0x1e0(%0); cache %1, 0x1f0(%0) \n" \
163 " .set mips0 \n" \ 164 " .set pop \n" \
164 " .set reorder \n" \
165 : \ 165 : \
166 : "r" (base), \ 166 : "r" (base), \
167 "i" (op)); 167 "i" (op));
@@ -285,6 +285,7 @@ static inline void blast_scache16_page_indexed(unsigned long page)
285 285
286#define cache32_unroll32(base,op) \ 286#define cache32_unroll32(base,op) \
287 __asm__ __volatile__( \ 287 __asm__ __volatile__( \
288 " .set push \n" \
288 " .set noreorder \n" \ 289 " .set noreorder \n" \
289 " .set mips3 \n" \ 290 " .set mips3 \n" \
290 " cache %1, 0x000(%0); cache %1, 0x020(%0) \n" \ 291 " cache %1, 0x000(%0); cache %1, 0x020(%0) \n" \
@@ -303,8 +304,7 @@ static inline void blast_scache16_page_indexed(unsigned long page)
303 " cache %1, 0x340(%0); cache %1, 0x360(%0) \n" \ 304 " cache %1, 0x340(%0); cache %1, 0x360(%0) \n" \
304 " cache %1, 0x380(%0); cache %1, 0x3a0(%0) \n" \ 305 " cache %1, 0x380(%0); cache %1, 0x3a0(%0) \n" \
305 " cache %1, 0x3c0(%0); cache %1, 0x3e0(%0) \n" \ 306 " cache %1, 0x3c0(%0); cache %1, 0x3e0(%0) \n" \
306 " .set mips0 \n" \ 307 " .set pop \n" \
307 " .set reorder \n" \
308 : \ 308 : \
309 : "r" (base), \ 309 : "r" (base), \
310 "i" (op)); 310 "i" (op));
@@ -428,6 +428,7 @@ static inline void blast_scache32_page_indexed(unsigned long page)
428 428
429#define cache64_unroll32(base,op) \ 429#define cache64_unroll32(base,op) \
430 __asm__ __volatile__( \ 430 __asm__ __volatile__( \
431 " .set push \n" \
431 " .set noreorder \n" \ 432 " .set noreorder \n" \
432 " .set mips3 \n" \ 433 " .set mips3 \n" \
433 " cache %1, 0x000(%0); cache %1, 0x040(%0) \n" \ 434 " cache %1, 0x000(%0); cache %1, 0x040(%0) \n" \
@@ -446,8 +447,7 @@ static inline void blast_scache32_page_indexed(unsigned long page)
446 " cache %1, 0x680(%0); cache %1, 0x6c0(%0) \n" \ 447 " cache %1, 0x680(%0); cache %1, 0x6c0(%0) \n" \
447 " cache %1, 0x700(%0); cache %1, 0x740(%0) \n" \ 448 " cache %1, 0x700(%0); cache %1, 0x740(%0) \n" \
448 " cache %1, 0x780(%0); cache %1, 0x7c0(%0) \n" \ 449 " cache %1, 0x780(%0); cache %1, 0x7c0(%0) \n" \
449 " .set mips0 \n" \ 450 " .set pop \n" \
450 " .set reorder \n" \
451 : \ 451 : \
452 : "r" (base), \ 452 : "r" (base), \
453 "i" (op)); 453 "i" (op));
@@ -532,6 +532,7 @@ static inline void blast_scache64_page_indexed(unsigned long page)
532 532
533#define cache128_unroll32(base,op) \ 533#define cache128_unroll32(base,op) \
534 __asm__ __volatile__( \ 534 __asm__ __volatile__( \
535 " .set push \n" \
535 " .set noreorder \n" \ 536 " .set noreorder \n" \
536 " .set mips3 \n" \ 537 " .set mips3 \n" \
537 " cache %1, 0x000(%0); cache %1, 0x080(%0) \n" \ 538 " cache %1, 0x000(%0); cache %1, 0x080(%0) \n" \
@@ -550,8 +551,7 @@ static inline void blast_scache64_page_indexed(unsigned long page)
550 " cache %1, 0xd00(%0); cache %1, 0xd80(%0) \n" \ 551 " cache %1, 0xd00(%0); cache %1, 0xd80(%0) \n" \
551 " cache %1, 0xe00(%0); cache %1, 0xe80(%0) \n" \ 552 " cache %1, 0xe00(%0); cache %1, 0xe80(%0) \n" \
552 " cache %1, 0xf00(%0); cache %1, 0xf80(%0) \n" \ 553 " cache %1, 0xf00(%0); cache %1, 0xf80(%0) \n" \
553 " .set mips0 \n" \ 554 " .set pop \n" \
554 " .set reorder \n" \
555 : \ 555 : \
556 : "r" (base), \ 556 : "r" (base), \
557 "i" (op)); 557 "i" (op));
diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h
index 3c4b637fd925..a60e0dc7c9b9 100644
--- a/include/asm-mips/rtc.h
+++ b/include/asm-mips/rtc.h
@@ -14,7 +14,9 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16 16
17#include <linux/spinlock.h>
17#include <linux/rtc.h> 18#include <linux/rtc.h>
19#include <asm/time.h>
18 20
19#define RTC_PIE 0x40 /* periodic interrupt enable */ 21#define RTC_PIE 0x40 /* periodic interrupt enable */
20#define RTC_AIE 0x20 /* alarm interrupt enable */ 22#define RTC_AIE 0x20 /* alarm interrupt enable */
@@ -27,11 +29,52 @@
27#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ 29#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
28#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ 30#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
29 31
30unsigned int get_rtc_time(struct rtc_time *time); 32static DEFINE_SPINLOCK(mips_rtc_lock);
31int set_rtc_time(struct rtc_time *time);
32unsigned int get_rtc_ss(void);
33int get_rtc_pll(struct rtc_pll_info *pll);
34int set_rtc_pll(struct rtc_pll_info *pll);
35 33
34static inline unsigned int get_rtc_time(struct rtc_time *time)
35{
36 unsigned long nowtime;
37
38 spin_lock(&mips_rtc_lock);
39 nowtime = rtc_get_time();
40 to_tm(nowtime, time);
41 time->tm_year -= 1900;
42 spin_unlock(&mips_rtc_lock);
43
44 return RTC_24H;
45}
46
47static inline int set_rtc_time(struct rtc_time *time)
48{
49 unsigned long nowtime;
50 int ret;
51
52 spin_lock(&mips_rtc_lock);
53 nowtime = mktime(time->tm_year+1900, time->tm_mon+1,
54 time->tm_mday, time->tm_hour, time->tm_min,
55 time->tm_sec);
56 ret = rtc_set_time(nowtime);
57 spin_unlock(&mips_rtc_lock);
58
59 return ret;
60}
61
62static inline unsigned int get_rtc_ss(void)
63{
64 struct rtc_time h;
65
66 get_rtc_time(&h);
67 return h.tm_sec;
68}
69
70static inline int get_rtc_pll(struct rtc_pll_info *pll)
71{
72 return -EINVAL;
73}
74
75static inline int set_rtc_pll(struct rtc_pll_info *pll)
76{
77 return -EINVAL;
78}
36#endif 79#endif
37#endif 80#endif
diff --git a/include/asm-mips/rtlx.h b/include/asm-mips/rtlx.h
new file mode 100644
index 000000000000..83cdf6ab0d1f
--- /dev/null
+++ b/include/asm-mips/rtlx.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 */
5
6#ifndef _RTLX_H
7#define _RTLX_H_
8
9#define LX_NODE_BASE 10
10
11#define MIPSCPU_INT_BASE 16
12#define MIPS_CPU_RTLX_IRQ 0
13
14#define RTLX_VERSION 1
15#define RTLX_xID 0x12345600
16#define RTLX_ID (RTLX_xID | RTLX_VERSION)
17#define RTLX_CHANNELS 8
18
19enum rtlx_state {
20 RTLX_STATE_UNUSED = 0,
21 RTLX_STATE_INITIALISED,
22 RTLX_STATE_REMOTE_READY,
23 RTLX_STATE_OPENED
24};
25
26#define RTLX_BUFFER_SIZE 1024
27/* each channel supports read and write.
28 linux (vpe0) reads lx_buffer and writes rt_buffer
29 SP (vpe1) reads rt_buffer and writes lx_buffer
30*/
31typedef struct rtlx_channel {
32 enum rtlx_state rt_state;
33 enum rtlx_state lx_state;
34
35 int buffer_size;
36
37 /* read and write indexes per buffer */
38 int rt_write, rt_read;
39 char *rt_buffer;
40
41 int lx_write, lx_read;
42 char *lx_buffer;
43
44 void *queues;
45
46} rtlx_channel_t;
47
48typedef struct rtlx_info {
49 unsigned long id;
50 enum rtlx_state state;
51
52 struct rtlx_channel channel[RTLX_CHANNELS];
53
54} rtlx_info_t;
55
56#endif
diff --git a/include/asm-mips/semaphore.h b/include/asm-mips/semaphore.h
index c2c97dec661b..3d6aa7c7ea81 100644
--- a/include/asm-mips/semaphore.h
+++ b/include/asm-mips/semaphore.h
@@ -45,9 +45,6 @@ struct semaphore {
45 .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ 45 .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \
46} 46}
47 47
48#define __MUTEX_INITIALIZER(name) \
49 __SEMAPHORE_INITIALIZER(name, 1)
50
51#define __DECLARE_SEMAPHORE_GENERIC(name, count) \ 48#define __DECLARE_SEMAPHORE_GENERIC(name, count) \
52 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) 49 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
53 50
diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h
index 4eed8e2acdc3..e796d75f027e 100644
--- a/include/asm-mips/serial.h
+++ b/include/asm-mips/serial.h
@@ -52,16 +52,6 @@
52#define JAZZ_SERIAL_PORT_DEFNS 52#define JAZZ_SERIAL_PORT_DEFNS
53#endif 53#endif
54 54
55#ifdef CONFIG_MIPS_COBALT
56#include <asm/cobalt/cobalt.h>
57#define COBALT_BASE_BAUD (18432000 / 16)
58#define COBALT_SERIAL_PORT_DEFNS \
59 /* UART CLK PORT IRQ FLAGS */ \
60 { 0, COBALT_BASE_BAUD, 0xc800000, COBALT_SERIAL_IRQ, STD_COM_FLAGS }, /* ttyS0 */
61#else
62#define COBALT_SERIAL_PORT_DEFNS
63#endif
64
65/* 55/*
66 * Both Galileo boards have the same UART mappings. 56 * Both Galileo boards have the same UART mappings.
67 */ 57 */
@@ -113,17 +103,6 @@
113#define IVR_SERIAL_PORT_DEFNS 103#define IVR_SERIAL_PORT_DEFNS
114#endif 104#endif
115 105
116#ifdef CONFIG_TOSHIBA_JMR3927
117#include <asm/jmr3927/jmr3927.h>
118#define TXX927_SERIAL_PORT_DEFNS \
119 { .baud_base = JMR3927_BASE_BAUD, .port = UART0_ADDR, .irq = UART0_INT, \
120 .flags = UART0_FLAGS, .type = 1 }, \
121 { .baud_base = JMR3927_BASE_BAUD, .port = UART1_ADDR, .irq = UART1_INT, \
122 .flags = UART1_FLAGS, .type = 1 },
123#else
124#define TXX927_SERIAL_PORT_DEFNS
125#endif
126
127#ifdef CONFIG_SERIAL_AU1X00 106#ifdef CONFIG_SERIAL_AU1X00
128#include <asm/mach-au1x00/au1000.h> 107#include <asm/mach-au1x00/au1000.h>
129#ifdef CONFIG_SOC_AU1000 108#ifdef CONFIG_SOC_AU1000
@@ -227,9 +206,9 @@
227#define JAGUAR_ATX_SERIAL1_BASE 0xfd000023L 206#define JAGUAR_ATX_SERIAL1_BASE 0xfd000023L
228 207
229#define _JAGUAR_ATX_SERIAL_INIT(int, base) \ 208#define _JAGUAR_ATX_SERIAL_INIT(int, base) \
230 { baud_base: JAGUAR_ATX_BASE_BAUD, irq: int, \ 209 { .baud_base = JAGUAR_ATX_BASE_BAUD, irq: int, \
231 flags: (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \ 210 .flags = (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
232 iomem_base: (u8 *) base, iomem_reg_shift: 2, \ 211 .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
233 io_type: SERIAL_IO_MEM } 212 io_type: SERIAL_IO_MEM }
234#define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS \ 213#define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS \
235 _JAGUAR_ATX_SERIAL_INIT(JAGUAR_ATX_SERIAL1_IRQ, JAGUAR_ATX_SERIAL1_BASE) 214 _JAGUAR_ATX_SERIAL_INIT(JAGUAR_ATX_SERIAL1_IRQ, JAGUAR_ATX_SERIAL1_BASE)
@@ -243,9 +222,9 @@
243#define OCELOT_3_SERIAL_BASE (signed)0xfd000020 222#define OCELOT_3_SERIAL_BASE (signed)0xfd000020
244 223
245#define _OCELOT_3_SERIAL_INIT(int, base) \ 224#define _OCELOT_3_SERIAL_INIT(int, base) \
246 { baud_base: OCELOT_3_BASE_BAUD, irq: int, \ 225 { .baud_base = OCELOT_3_BASE_BAUD, irq: int, \
247 flags: STD_COM_FLAGS, \ 226 .flags = STD_COM_FLAGS, \
248 iomem_base: (u8 *) base, iomem_reg_shift: 2, \ 227 .iomem_base = (u8 *) base, iomem_reg_shift: 2, \
249 io_type: SERIAL_IO_MEM } 228 io_type: SERIAL_IO_MEM }
250 229
251#define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \ 230#define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
@@ -342,7 +321,6 @@
342#endif /* CONFIG_SGI_IP32 */ 321#endif /* CONFIG_SGI_IP32 */
343 322
344#define SERIAL_PORT_DFNS \ 323#define SERIAL_PORT_DFNS \
345 COBALT_SERIAL_PORT_DEFNS \
346 DDB5477_SERIAL_PORT_DEFNS \ 324 DDB5477_SERIAL_PORT_DEFNS \
347 EV96100_SERIAL_PORT_DEFNS \ 325 EV96100_SERIAL_PORT_DEFNS \
348 IP32_SERIAL_PORT_DEFNS \ 326 IP32_SERIAL_PORT_DEFNS \
@@ -354,7 +332,6 @@
354 MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \ 332 MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
355 MOMENCO_OCELOT_SERIAL_PORT_DEFNS \ 333 MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
356 MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \ 334 MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
357 TXX927_SERIAL_PORT_DEFNS \
358 AU1000_SERIAL_PORT_DEFNS 335 AU1000_SERIAL_PORT_DEFNS
359 336
360#endif /* _ASM_SERIAL_H */ 337#endif /* _ASM_SERIAL_H */
diff --git a/include/asm-mips/sgi/hpc3.h b/include/asm-mips/sgi/hpc3.h
index ac3dfc7af5b0..fcec52bafb25 100644
--- a/include/asm-mips/sgi/hpc3.h
+++ b/include/asm-mips/sgi/hpc3.h
@@ -128,26 +128,26 @@ struct hpc3_ethregs {
128 volatile u32 rx_gfptr; /* current GIO fifo ptr */ 128 volatile u32 rx_gfptr; /* current GIO fifo ptr */
129 volatile u32 rx_dfptr; /* current device fifo ptr */ 129 volatile u32 rx_dfptr; /* current device fifo ptr */
130 u32 _unused1; /* padding */ 130 u32 _unused1; /* padding */
131 volatile u32 rx_reset; /* reset register */ 131 volatile u32 reset; /* reset register */
132#define HPC3_ERXRST_CRESET 0x1 /* Reset dma channel and external controller */ 132#define HPC3_ERST_CRESET 0x1 /* Reset dma channel and external controller */
133#define HPC3_ERXRST_CLRIRQ 0x2 /* Clear channel interrupt */ 133#define HPC3_ERST_CLRIRQ 0x2 /* Clear channel interrupt */
134#define HPC3_ERXRST_LBACK 0x4 /* Enable diagnostic loopback mode of Seeq8003 */ 134#define HPC3_ERST_LBACK 0x4 /* Enable diagnostic loopback mode of Seeq8003 */
135 135
136 volatile u32 rx_dconfig; /* DMA configuration register */ 136 volatile u32 dconfig; /* DMA configuration register */
137#define HPC3_ERXDCFG_D1 0x0000f /* Cycles to spend in D1 state for PIO */ 137#define HPC3_EDCFG_D1 0x0000f /* Cycles to spend in D1 state for PIO */
138#define HPC3_ERXDCFG_D2 0x000f0 /* Cycles to spend in D2 state for PIO */ 138#define HPC3_EDCFG_D2 0x000f0 /* Cycles to spend in D2 state for PIO */
139#define HPC3_ERXDCFG_D3 0x00f00 /* Cycles to spend in D3 state for PIO */ 139#define HPC3_EDCFG_D3 0x00f00 /* Cycles to spend in D3 state for PIO */
140#define HPC3_ERXDCFG_WCTRL 0x01000 /* Enable writes of desc into ex ctrl port */ 140#define HPC3_EDCFG_WCTRL 0x01000 /* Enable writes of desc into ex ctrl port */
141#define HPC3_ERXDCFG_FRXDC 0x02000 /* Clear eop stat bits upon rxdc, hw seeq fix */ 141#define HPC3_EDCFG_FRXDC 0x02000 /* Clear eop stat bits upon rxdc, hw seeq fix */
142#define HPC3_ERXDCFG_FEOP 0x04000 /* Bad packet marker timeout enable */ 142#define HPC3_EDCFG_FEOP 0x04000 /* Bad packet marker timeout enable */
143#define HPC3_ERXDCFG_FIRQ 0x08000 /* Another bad packet timeout enable */ 143#define HPC3_EDCFG_FIRQ 0x08000 /* Another bad packet timeout enable */
144#define HPC3_ERXDCFG_PTO 0x30000 /* Programmed timeout value for above two */ 144#define HPC3_EDCFG_PTO 0x30000 /* Programmed timeout value for above two */
145 145
146 volatile u32 rx_pconfig; /* PIO configuration register */ 146 volatile u32 pconfig; /* PIO configuration register */
147#define HPC3_ERXPCFG_P1 0x000f /* Cycles to spend in P1 state for PIO */ 147#define HPC3_EPCFG_P1 0x000f /* Cycles to spend in P1 state for PIO */
148#define HPC3_ERXPCFG_P2 0x00f0 /* Cycles to spend in P2 state for PIO */ 148#define HPC3_EPCFG_P2 0x00f0 /* Cycles to spend in P2 state for PIO */
149#define HPC3_ERXPCFG_P3 0x0f00 /* Cycles to spend in P3 state for PIO */ 149#define HPC3_EPCFG_P3 0x0f00 /* Cycles to spend in P3 state for PIO */
150#define HPC3_ERXPCFG_TST 0x1000 /* Diagnistic ram test feature bit */ 150#define HPC3_EPCFG_TST 0x1000 /* Diagnistic ram test feature bit */
151 151
152 u32 _unused2[0x1000/4 - 8]; /* padding */ 152 u32 _unused2[0x1000/4 - 8]; /* padding */
153 153
diff --git a/include/asm-mips/sibyte/bcm1480_int.h b/include/asm-mips/sibyte/bcm1480_int.h
new file mode 100644
index 000000000000..42d4cf00efd3
--- /dev/null
+++ b/include/asm-mips/sibyte/bcm1480_int.h
@@ -0,0 +1,310 @@
1/* *********************************************************************
2 * BCM1280/BCM1480 Board Support Package
3 *
4 * Interrupt Mapper definitions File: bcm1480_int.h
5 *
6 * This module contains constants for manipulating the
7 * BCM1255/BCM1280/BCM1455/BCM1480's interrupt mapper and
8 * definitions for the interrupt sources.
9 *
10 * BCM1480 specification level: 1X55_1X80-UM100-D4 (11/24/03)
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License as
19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 * MA 02111-1307 USA
31 ********************************************************************* */
32
33
34#ifndef _BCM1480_INT_H
35#define _BCM1480_INT_H
36
37#include "sb1250_defs.h"
38
39/* *********************************************************************
40 * Interrupt Mapper Constants
41 ********************************************************************* */
42
43/*
44 * The interrupt mapper deals with 128-bit logical registers that are
45 * implemented as pairs of 64-bit registers, with the "low" 64 bits in
46 * a register that has an address 0x1000 higher(!) than the
47 * corresponding "high" register.
48 *
49 * For appropriate registers, bit 0 of the "high" register is a
50 * cascade bit that summarizes (as a bit-OR) the 64 bits of the "low"
51 * register.
52 */
53
54/*
55 * This entire file uses _BCM1480_ in all the symbols because it is
56 * entirely BCM1480 specific.
57 */
58
59/*
60 * Interrupt sources (Table 22)
61 */
62
63#define K_BCM1480_INT_SOURCES 128
64
65#define _BCM1480_INT_HIGH(k) (k)
66#define _BCM1480_INT_LOW(k) ((k)+64)
67
68#define K_BCM1480_INT_ADDR_TRAP _BCM1480_INT_HIGH(1)
69#define K_BCM1480_INT_GPIO_0 _BCM1480_INT_HIGH(4)
70#define K_BCM1480_INT_GPIO_1 _BCM1480_INT_HIGH(5)
71#define K_BCM1480_INT_GPIO_2 _BCM1480_INT_HIGH(6)
72#define K_BCM1480_INT_GPIO_3 _BCM1480_INT_HIGH(7)
73#define K_BCM1480_INT_PCI_INTA _BCM1480_INT_HIGH(8)
74#define K_BCM1480_INT_PCI_INTB _BCM1480_INT_HIGH(9)
75#define K_BCM1480_INT_PCI_INTC _BCM1480_INT_HIGH(10)
76#define K_BCM1480_INT_PCI_INTD _BCM1480_INT_HIGH(11)
77#define K_BCM1480_INT_CYCLE_CP0 _BCM1480_INT_HIGH(12)
78#define K_BCM1480_INT_CYCLE_CP1 _BCM1480_INT_HIGH(13)
79#define K_BCM1480_INT_CYCLE_CP2 _BCM1480_INT_HIGH(14)
80#define K_BCM1480_INT_CYCLE_CP3 _BCM1480_INT_HIGH(15)
81#define K_BCM1480_INT_TIMER_0 _BCM1480_INT_HIGH(20)
82#define K_BCM1480_INT_TIMER_1 _BCM1480_INT_HIGH(21)
83#define K_BCM1480_INT_TIMER_2 _BCM1480_INT_HIGH(22)
84#define K_BCM1480_INT_TIMER_3 _BCM1480_INT_HIGH(23)
85#define K_BCM1480_INT_DM_CH_0 _BCM1480_INT_HIGH(28)
86#define K_BCM1480_INT_DM_CH_1 _BCM1480_INT_HIGH(29)
87#define K_BCM1480_INT_DM_CH_2 _BCM1480_INT_HIGH(30)
88#define K_BCM1480_INT_DM_CH_3 _BCM1480_INT_HIGH(31)
89#define K_BCM1480_INT_MAC_0 _BCM1480_INT_HIGH(36)
90#define K_BCM1480_INT_MAC_0_CH1 _BCM1480_INT_HIGH(37)
91#define K_BCM1480_INT_MAC_1 _BCM1480_INT_HIGH(38)
92#define K_BCM1480_INT_MAC_1_CH1 _BCM1480_INT_HIGH(39)
93#define K_BCM1480_INT_MAC_2 _BCM1480_INT_HIGH(40)
94#define K_BCM1480_INT_MAC_2_CH1 _BCM1480_INT_HIGH(41)
95#define K_BCM1480_INT_MAC_3 _BCM1480_INT_HIGH(42)
96#define K_BCM1480_INT_MAC_3_CH1 _BCM1480_INT_HIGH(43)
97#define K_BCM1480_INT_PMI_LOW _BCM1480_INT_HIGH(52)
98#define K_BCM1480_INT_PMI_HIGH _BCM1480_INT_HIGH(53)
99#define K_BCM1480_INT_PMO_LOW _BCM1480_INT_HIGH(54)
100#define K_BCM1480_INT_PMO_HIGH _BCM1480_INT_HIGH(55)
101#define K_BCM1480_INT_MBOX_0_0 _BCM1480_INT_HIGH(56)
102#define K_BCM1480_INT_MBOX_0_1 _BCM1480_INT_HIGH(57)
103#define K_BCM1480_INT_MBOX_0_2 _BCM1480_INT_HIGH(58)
104#define K_BCM1480_INT_MBOX_0_3 _BCM1480_INT_HIGH(59)
105#define K_BCM1480_INT_MBOX_1_0 _BCM1480_INT_HIGH(60)
106#define K_BCM1480_INT_MBOX_1_1 _BCM1480_INT_HIGH(61)
107#define K_BCM1480_INT_MBOX_1_2 _BCM1480_INT_HIGH(62)
108#define K_BCM1480_INT_MBOX_1_3 _BCM1480_INT_HIGH(63)
109
110#define K_BCM1480_INT_BAD_ECC _BCM1480_INT_LOW(1)
111#define K_BCM1480_INT_COR_ECC _BCM1480_INT_LOW(2)
112#define K_BCM1480_INT_IO_BUS _BCM1480_INT_LOW(3)
113#define K_BCM1480_INT_PERF_CNT _BCM1480_INT_LOW(4)
114#define K_BCM1480_INT_SW_PERF_CNT _BCM1480_INT_LOW(5)
115#define K_BCM1480_INT_TRACE_FREEZE _BCM1480_INT_LOW(6)
116#define K_BCM1480_INT_SW_TRACE_FREEZE _BCM1480_INT_LOW(7)
117#define K_BCM1480_INT_WATCHDOG_TIMER_0 _BCM1480_INT_LOW(8)
118#define K_BCM1480_INT_WATCHDOG_TIMER_1 _BCM1480_INT_LOW(9)
119#define K_BCM1480_INT_WATCHDOG_TIMER_2 _BCM1480_INT_LOW(10)
120#define K_BCM1480_INT_WATCHDOG_TIMER_3 _BCM1480_INT_LOW(11)
121#define K_BCM1480_INT_PCI_ERROR _BCM1480_INT_LOW(16)
122#define K_BCM1480_INT_PCI_RESET _BCM1480_INT_LOW(17)
123#define K_BCM1480_INT_NODE_CONTROLLER _BCM1480_INT_LOW(18)
124#define K_BCM1480_INT_HOST_BRIDGE _BCM1480_INT_LOW(19)
125#define K_BCM1480_INT_PORT_0_FATAL _BCM1480_INT_LOW(20)
126#define K_BCM1480_INT_PORT_0_NONFATAL _BCM1480_INT_LOW(21)
127#define K_BCM1480_INT_PORT_1_FATAL _BCM1480_INT_LOW(22)
128#define K_BCM1480_INT_PORT_1_NONFATAL _BCM1480_INT_LOW(23)
129#define K_BCM1480_INT_PORT_2_FATAL _BCM1480_INT_LOW(24)
130#define K_BCM1480_INT_PORT_2_NONFATAL _BCM1480_INT_LOW(25)
131#define K_BCM1480_INT_LDT_SMI _BCM1480_INT_LOW(32)
132#define K_BCM1480_INT_LDT_NMI _BCM1480_INT_LOW(33)
133#define K_BCM1480_INT_LDT_INIT _BCM1480_INT_LOW(34)
134#define K_BCM1480_INT_LDT_STARTUP _BCM1480_INT_LOW(35)
135#define K_BCM1480_INT_LDT_EXT _BCM1480_INT_LOW(36)
136#define K_BCM1480_INT_SMB_0 _BCM1480_INT_LOW(40)
137#define K_BCM1480_INT_SMB_1 _BCM1480_INT_LOW(41)
138#define K_BCM1480_INT_PCMCIA _BCM1480_INT_LOW(42)
139#define K_BCM1480_INT_UART_0 _BCM1480_INT_LOW(44)
140#define K_BCM1480_INT_UART_1 _BCM1480_INT_LOW(45)
141#define K_BCM1480_INT_UART_2 _BCM1480_INT_LOW(46)
142#define K_BCM1480_INT_UART_3 _BCM1480_INT_LOW(47)
143#define K_BCM1480_INT_GPIO_4 _BCM1480_INT_LOW(52)
144#define K_BCM1480_INT_GPIO_5 _BCM1480_INT_LOW(53)
145#define K_BCM1480_INT_GPIO_6 _BCM1480_INT_LOW(54)
146#define K_BCM1480_INT_GPIO_7 _BCM1480_INT_LOW(55)
147#define K_BCM1480_INT_GPIO_8 _BCM1480_INT_LOW(56)
148#define K_BCM1480_INT_GPIO_9 _BCM1480_INT_LOW(57)
149#define K_BCM1480_INT_GPIO_10 _BCM1480_INT_LOW(58)
150#define K_BCM1480_INT_GPIO_11 _BCM1480_INT_LOW(59)
151#define K_BCM1480_INT_GPIO_12 _BCM1480_INT_LOW(60)
152#define K_BCM1480_INT_GPIO_13 _BCM1480_INT_LOW(61)
153#define K_BCM1480_INT_GPIO_14 _BCM1480_INT_LOW(62)
154#define K_BCM1480_INT_GPIO_15 _BCM1480_INT_LOW(63)
155
156/*
157 * Mask values for each interrupt
158 */
159
160#define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F))
161#define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6)
162
163#define M_BCM1480_INT_CASCADE _BCM1480_INT_MASK1(_BCM1480_INT_HIGH(0))
164
165#define M_BCM1480_INT_ADDR_TRAP _BCM1480_INT_MASK1(K_BCM1480_INT_ADDR_TRAP)
166#define M_BCM1480_INT_GPIO_0 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_0)
167#define M_BCM1480_INT_GPIO_1 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_1)
168#define M_BCM1480_INT_GPIO_2 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_2)
169#define M_BCM1480_INT_GPIO_3 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_3)
170#define M_BCM1480_INT_PCI_INTA _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTA)
171#define M_BCM1480_INT_PCI_INTB _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTB)
172#define M_BCM1480_INT_PCI_INTC _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTC)
173#define M_BCM1480_INT_PCI_INTD _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTD)
174#define M_BCM1480_INT_CYCLE_CP0 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP0)
175#define M_BCM1480_INT_CYCLE_CP1 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP1)
176#define M_BCM1480_INT_CYCLE_CP2 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP2)
177#define M_BCM1480_INT_CYCLE_CP3 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP3)
178#define M_BCM1480_INT_TIMER_0 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_0)
179#define M_BCM1480_INT_TIMER_1 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_1)
180#define M_BCM1480_INT_TIMER_2 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_2)
181#define M_BCM1480_INT_TIMER_3 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_3)
182#define M_BCM1480_INT_DM_CH_0 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_0)
183#define M_BCM1480_INT_DM_CH_1 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_1)
184#define M_BCM1480_INT_DM_CH_2 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_2)
185#define M_BCM1480_INT_DM_CH_3 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_3)
186#define M_BCM1480_INT_MAC_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_0)
187#define M_BCM1480_INT_MAC_0_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_0_CH1)
188#define M_BCM1480_INT_MAC_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_1)
189#define M_BCM1480_INT_MAC_1_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_1_CH1)
190#define M_BCM1480_INT_MAC_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_2)
191#define M_BCM1480_INT_MAC_2_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_2_CH1)
192#define M_BCM1480_INT_MAC_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_3)
193#define M_BCM1480_INT_MAC_3_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_3_CH1)
194#define M_BCM1480_INT_PMI_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_LOW)
195#define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH)
196#define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW)
197#define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH)
198#define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0)
199#define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1)
200#define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2)
201#define M_BCM1480_INT_MBOX_0_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_3)
202#define M_BCM1480_INT_MBOX_1_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_0)
203#define M_BCM1480_INT_MBOX_1_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_1)
204#define M_BCM1480_INT_MBOX_1_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_2)
205#define M_BCM1480_INT_MBOX_1_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_3)
206#define M_BCM1480_INT_BAD_ECC _BCM1480_INT_MASK1(K_BCM1480_INT_BAD_ECC)
207#define M_BCM1480_INT_COR_ECC _BCM1480_INT_MASK1(K_BCM1480_INT_COR_ECC)
208#define M_BCM1480_INT_IO_BUS _BCM1480_INT_MASK1(K_BCM1480_INT_IO_BUS)
209#define M_BCM1480_INT_PERF_CNT _BCM1480_INT_MASK1(K_BCM1480_INT_PERF_CNT)
210#define M_BCM1480_INT_SW_PERF_CNT _BCM1480_INT_MASK1(K_BCM1480_INT_SW_PERF_CNT)
211#define M_BCM1480_INT_TRACE_FREEZE _BCM1480_INT_MASK1(K_BCM1480_INT_TRACE_FREEZE)
212#define M_BCM1480_INT_SW_TRACE_FREEZE _BCM1480_INT_MASK1(K_BCM1480_INT_SW_TRACE_FREEZE)
213#define M_BCM1480_INT_WATCHDOG_TIMER_0 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_0)
214#define M_BCM1480_INT_WATCHDOG_TIMER_1 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_1)
215#define M_BCM1480_INT_WATCHDOG_TIMER_2 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_2)
216#define M_BCM1480_INT_WATCHDOG_TIMER_3 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_3)
217#define M_BCM1480_INT_PCI_ERROR _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_ERROR)
218#define M_BCM1480_INT_PCI_RESET _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_RESET)
219#define M_BCM1480_INT_NODE_CONTROLLER _BCM1480_INT_MASK1(K_BCM1480_INT_NODE_CONTROLLER)
220#define M_BCM1480_INT_HOST_BRIDGE _BCM1480_INT_MASK1(K_BCM1480_INT_HOST_BRIDGE)
221#define M_BCM1480_INT_PORT_0_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_0_FATAL)
222#define M_BCM1480_INT_PORT_0_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_0_NONFATAL)
223#define M_BCM1480_INT_PORT_1_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_1_FATAL)
224#define M_BCM1480_INT_PORT_1_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_1_NONFATAL)
225#define M_BCM1480_INT_PORT_2_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_2_FATAL)
226#define M_BCM1480_INT_PORT_2_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_2_NONFATAL)
227#define M_BCM1480_INT_LDT_SMI _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_SMI)
228#define M_BCM1480_INT_LDT_NMI _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_NMI)
229#define M_BCM1480_INT_LDT_INIT _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_INIT)
230#define M_BCM1480_INT_LDT_STARTUP _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_STARTUP)
231#define M_BCM1480_INT_LDT_EXT _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_EXT)
232#define M_BCM1480_INT_SMB_0 _BCM1480_INT_MASK1(K_BCM1480_INT_SMB_0)
233#define M_BCM1480_INT_SMB_1 _BCM1480_INT_MASK1(K_BCM1480_INT_SMB_1)
234#define M_BCM1480_INT_PCMCIA _BCM1480_INT_MASK1(K_BCM1480_INT_PCMCIA)
235#define M_BCM1480_INT_UART_0 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_0)
236#define M_BCM1480_INT_UART_1 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_1)
237#define M_BCM1480_INT_UART_2 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_2)
238#define M_BCM1480_INT_UART_3 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_3)
239#define M_BCM1480_INT_GPIO_4 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_4)
240#define M_BCM1480_INT_GPIO_5 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_5)
241#define M_BCM1480_INT_GPIO_6 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_6)
242#define M_BCM1480_INT_GPIO_7 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_7)
243#define M_BCM1480_INT_GPIO_8 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_8)
244#define M_BCM1480_INT_GPIO_9 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_9)
245#define M_BCM1480_INT_GPIO_10 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_10)
246#define M_BCM1480_INT_GPIO_11 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_11)
247#define M_BCM1480_INT_GPIO_12 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_12)
248#define M_BCM1480_INT_GPIO_13 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_13)
249#define M_BCM1480_INT_GPIO_14 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_14)
250#define M_BCM1480_INT_GPIO_15 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_15)
251
252/*
253 * Interrupt mappings (Table 18)
254 */
255
256#define K_BCM1480_INT_MAP_I0 0 /* interrupt pins on processor */
257#define K_BCM1480_INT_MAP_I1 1
258#define K_BCM1480_INT_MAP_I2 2
259#define K_BCM1480_INT_MAP_I3 3
260#define K_BCM1480_INT_MAP_I4 4
261#define K_BCM1480_INT_MAP_I5 5
262#define K_BCM1480_INT_MAP_NMI 6 /* nonmaskable */
263#define K_BCM1480_INT_MAP_DINT 7 /* debug interrupt */
264
265/*
266 * Interrupt LDT Set Register (Table 19)
267 */
268
269#define S_BCM1480_INT_HT_INTMSG 0
270#define M_BCM1480_INT_HT_INTMSG _SB_MAKEMASK(3,S_BCM1480_INT_HT_INTMSG)
271#define V_BCM1480_INT_HT_INTMSG(x) _SB_MAKEVALUE(x,S_BCM1480_INT_HT_INTMSG)
272#define G_BCM1480_INT_HT_INTMSG(x) _SB_GETVALUE(x,S_BCM1480_INT_HT_INTMSG,M_BCM1480_INT_HT_INTMSG)
273
274#define K_BCM1480_INT_HT_INTMSG_FIXED 0
275#define K_BCM1480_INT_HT_INTMSG_ARBITRATED 1
276#define K_BCM1480_INT_HT_INTMSG_SMI 2
277#define K_BCM1480_INT_HT_INTMSG_NMI 3
278#define K_BCM1480_INT_HT_INTMSG_INIT 4
279#define K_BCM1480_INT_HT_INTMSG_STARTUP 5
280#define K_BCM1480_INT_HT_INTMSG_EXTINT 6
281#define K_BCM1480_INT_HT_INTMSG_RESERVED 7
282
283#define M_BCM1480_INT_HT_TRIGGERMODE _SB_MAKEMASK1(3)
284#define V_BCM1480_INT_HT_EDGETRIGGER 0
285#define V_BCM1480_INT_HT_LEVELTRIGGER M_BCM1480_INT_HT_TRIGGERMODE
286
287#define M_BCM1480_INT_HT_DESTMODE _SB_MAKEMASK1(4)
288#define V_BCM1480_INT_HT_PHYSICALDEST 0
289#define V_BCM1480_INT_HT_LOGICALDEST M_BCM1480_INT_HT_DESTMODE
290
291#define S_BCM1480_INT_HT_INTDEST 5
292#define M_BCM1480_INT_HT_INTDEST _SB_MAKEMASK(8,S_BCM1480_INT_HT_INTDEST)
293#define V_BCM1480_INT_HT_INTDEST(x) _SB_MAKEVALUE(x,S_BCM1480_INT_HT_INTDEST)
294#define G_BCM1480_INT_HT_INTDEST(x) _SB_GETVALUE(x,S_BCM1480_INT_HT_INTDEST,M_BCM1480_INT_HT_INTDEST)
295
296#define S_BCM1480_INT_HT_VECTOR 13
297#define M_BCM1480_INT_HT_VECTOR _SB_MAKEMASK(8,S_BCM1480_INT_HT_VECTOR)
298#define V_BCM1480_INT_HT_VECTOR(x) _SB_MAKEVALUE(x,S_BCM1480_INT_HT_VECTOR)
299#define G_BCM1480_INT_HT_VECTOR(x) _SB_GETVALUE(x,S_BCM1480_INT_HT_VECTOR,M_BCM1480_INT_HT_VECTOR)
300
301/*
302 * Vector prefix (Table 4-7)
303 */
304
305#define M_BCM1480_HTVECT_RAISE_INTLDT_HIGH 0x00
306#define M_BCM1480_HTVECT_RAISE_MBOX_0 0x40
307#define M_BCM1480_HTVECT_RAISE_INTLDT_LO 0x80
308#define M_BCM1480_HTVECT_RAISE_MBOX_1 0xC0
309
310#endif /* _BCM1480_INT_H */
diff --git a/include/asm-mips/sibyte/bcm1480_l2c.h b/include/asm-mips/sibyte/bcm1480_l2c.h
new file mode 100644
index 000000000000..886b099565e6
--- /dev/null
+++ b/include/asm-mips/sibyte/bcm1480_l2c.h
@@ -0,0 +1,176 @@
1/* *********************************************************************
2 * BCM1280/BCM1480 Board Support Package
3 *
4 * L2 Cache constants and macros File: bcm1480_l2c.h
5 *
6 * This module contains constants useful for manipulating the
7 * level 2 cache.
8 *
9 * BCM1400 specification level: 1280-UM100-D2 (11/14/03)
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _BCM1480_L2C_H
34#define _BCM1480_L2C_H
35
36#include "sb1250_defs.h"
37
38/*
39 * Format of level 2 cache management address (Table 55)
40 */
41
42#define S_BCM1480_L2C_MGMT_INDEX 5
43#define M_BCM1480_L2C_MGMT_INDEX _SB_MAKEMASK(12,S_BCM1480_L2C_MGMT_INDEX)
44#define V_BCM1480_L2C_MGMT_INDEX(x) _SB_MAKEVALUE(x,S_BCM1480_L2C_MGMT_INDEX)
45#define G_BCM1480_L2C_MGMT_INDEX(x) _SB_GETVALUE(x,S_BCM1480_L2C_MGMT_INDEX,M_BCM1480_L2C_MGMT_INDEX)
46
47#define S_BCM1480_L2C_MGMT_WAY 17
48#define M_BCM1480_L2C_MGMT_WAY _SB_MAKEMASK(3,S_BCM1480_L2C_MGMT_WAY)
49#define V_BCM1480_L2C_MGMT_WAY(x) _SB_MAKEVALUE(x,S_BCM1480_L2C_MGMT_WAY)
50#define G_BCM1480_L2C_MGMT_WAY(x) _SB_GETVALUE(x,S_BCM1480_L2C_MGMT_WAY,M_BCM1480_L2C_MGMT_WAY)
51
52#define M_BCM1480_L2C_MGMT_DIRTY _SB_MAKEMASK1(20)
53#define M_BCM1480_L2C_MGMT_VALID _SB_MAKEMASK1(21)
54
55#define S_BCM1480_L2C_MGMT_ECC_DIAG 22
56#define M_BCM1480_L2C_MGMT_ECC_DIAG _SB_MAKEMASK(2,S_BCM1480_L2C_MGMT_ECC_DIAG)
57#define V_BCM1480_L2C_MGMT_ECC_DIAG(x) _SB_MAKEVALUE(x,S_BCM1480_L2C_MGMT_ECC_DIAG)
58#define G_BCM1480_L2C_MGMT_ECC_DIAG(x) _SB_GETVALUE(x,S_BCM1480_L2C_MGMT_ECC_DIAG,M_BCM1480_L2C_MGMT_ECC_DIAG)
59
60#define A_BCM1480_L2C_MGMT_TAG_BASE 0x00D0000000
61
62#define BCM1480_L2C_ENTRIES_PER_WAY 4096
63#define BCM1480_L2C_NUM_WAYS 8
64
65
66/*
67 * Level 2 Cache Tag register (Table 59)
68 */
69
70#define S_BCM1480_L2C_TAG_MBZ 0
71#define M_BCM1480_L2C_TAG_MBZ _SB_MAKEMASK(5,S_BCM1480_L2C_TAG_MBZ)
72
73#define S_BCM1480_L2C_TAG_INDEX 5
74#define M_BCM1480_L2C_TAG_INDEX _SB_MAKEMASK(12,S_BCM1480_L2C_TAG_INDEX)
75#define V_BCM1480_L2C_TAG_INDEX(x) _SB_MAKEVALUE(x,S_BCM1480_L2C_TAG_INDEX)
76#define G_BCM1480_L2C_TAG_INDEX(x) _SB_GETVALUE(x,S_BCM1480_L2C_TAG_INDEX,M_BCM1480_L2C_TAG_INDEX)
77
78/* Note that index bit 16 is also tag bit 40 */
79#define S_BCM1480_L2C_TAG_TAG 17
80#define M_BCM1480_L2C_TAG_TAG _SB_MAKEMASK(23,S_BCM1480_L2C_TAG_TAG)
81#define V_BCM1480_L2C_TAG_TAG(x) _SB_MAKEVALUE(x,S_BCM1480_L2C_TAG_TAG)
82#define G_BCM1480_L2C_TAG_TAG(x) _SB_GETVALUE(x,S_BCM1480_L2C_TAG_TAG,M_BCM1480_L2C_TAG_TAG)
83
84#define S_BCM1480_L2C_TAG_ECC 40
85#define M_BCM1480_L2C_TAG_ECC _SB_MAKEMASK(6,S_BCM1480_L2C_TAG_ECC)
86#define V_BCM1480_L2C_TAG_ECC(x) _SB_MAKEVALUE(x,S_BCM1480_L2C_TAG_ECC)
87#define G_BCM1480_L2C_TAG_ECC(x) _SB_GETVALUE(x,S_BCM1480_L2C_TAG_ECC,M_BCM1480_L2C_TAG_ECC)
88
89#define S_BCM1480_L2C_TAG_WAY 46
90#define M_BCM1480_L2C_TAG_WAY _SB_MAKEMASK(3,S_BCM1480_L2C_TAG_WAY)
91#define V_BCM1480_L2C_TAG_WAY(x) _SB_MAKEVALUE(x,S_BCM1480_L2C_TAG_WAY)
92#define G_BCM1480_L2C_TAG_WAY(x) _SB_GETVALUE(x,S_BCM1480_L2C_TAG_WAY,M_BCM1480_L2C_TAG_WAY)
93
94#define M_BCM1480_L2C_TAG_DIRTY _SB_MAKEMASK1(49)
95#define M_BCM1480_L2C_TAG_VALID _SB_MAKEMASK1(50)
96
97#define S_BCM1480_L2C_DATA_ECC 51
98#define M_BCM1480_L2C_DATA_ECC _SB_MAKEMASK(10,S_BCM1480_L2C_DATA_ECC)
99#define V_BCM1480_L2C_DATA_ECC(x) _SB_MAKEVALUE(x,S_BCM1480_L2C_DATA_ECC)
100#define G_BCM1480_L2C_DATA_ECC(x) _SB_GETVALUE(x,S_BCM1480_L2C_DATA_ECC,M_BCM1480_L2C_DATA_ECC)
101
102
103/*
104 * L2 Misc0 Value Register (Table 60)
105 */
106
107#define S_BCM1480_L2C_MISC0_WAY_REMOTE 0
108#define M_BCM1480_L2C_MISC0_WAY_REMOTE _SB_MAKEMASK(8,S_BCM1480_L2C_MISC0_WAY_REMOTE)
109#define G_BCM1480_L2C_MISC0_WAY_REMOTE(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC0_WAY_REMOTE,M_BCM1480_L2C_MISC0_WAY_REMOTE)
110
111#define S_BCM1480_L2C_MISC0_WAY_LOCAL 8
112#define M_BCM1480_L2C_MISC0_WAY_LOCAL _SB_MAKEMASK(8,S_BCM1480_L2C_MISC0_WAY_LOCAL)
113#define G_BCM1480_L2C_MISC0_WAY_LOCAL(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC0_WAY_LOCAL,M_BCM1480_L2C_MISC0_WAY_LOCAL)
114
115#define S_BCM1480_L2C_MISC0_WAY_ENABLE 16
116#define M_BCM1480_L2C_MISC0_WAY_ENABLE _SB_MAKEMASK(8,S_BCM1480_L2C_MISC0_WAY_ENABLE)
117#define G_BCM1480_L2C_MISC0_WAY_ENABLE(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC0_WAY_ENABLE,M_BCM1480_L2C_MISC0_WAY_ENABLE)
118
119#define S_BCM1480_L2C_MISC0_CACHE_DISABLE 24
120#define M_BCM1480_L2C_MISC0_CACHE_DISABLE _SB_MAKEMASK(2,S_BCM1480_L2C_MISC0_CACHE_DISABLE)
121#define G_BCM1480_L2C_MISC0_CACHE_DISABLE(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC0_CACHE_DISABLE,M_BCM1480_L2C_MISC0_CACHE_DISABLE)
122
123#define S_BCM1480_L2C_MISC0_CACHE_QUAD 26
124#define M_BCM1480_L2C_MISC0_CACHE_QUAD _SB_MAKEMASK(2,S_BCM1480_L2C_MISC0_CACHE_QUAD)
125#define G_BCM1480_L2C_MISC0_CACHE_QUAD(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC0_CACHE_QUAD,M_BCM1480_L2C_MISC0_CACHE_QUAD)
126
127#define S_BCM1480_L2C_MISC0_MC_PRIORITY 30
128#define M_BCM1480_L2C_MISC0_MC_PRIORITY _SB_MAKEMASK1(S_BCM1480_L2C_MISC0_MC_PRIORITY)
129
130#define S_BCM1480_L2C_MISC0_ECC_CLEANUP 31
131#define M_BCM1480_L2C_MISC0_ECC_CLEANUP _SB_MAKEMASK1(S_BCM1480_L2C_MISC0_ECC_CLEANUP)
132
133
134/*
135 * L2 Misc1 Value Register (Table 60)
136 */
137
138#define S_BCM1480_L2C_MISC1_WAY_AGENT_0 0
139#define M_BCM1480_L2C_MISC1_WAY_AGENT_0 _SB_MAKEMASK(8,S_BCM1480_L2C_MISC1_WAY_AGENT_0)
140#define G_BCM1480_L2C_MISC1_WAY_AGENT_0(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC1_WAY_AGENT_0,M_BCM1480_L2C_MISC1_WAY_AGENT_0)
141
142#define S_BCM1480_L2C_MISC1_WAY_AGENT_1 8
143#define M_BCM1480_L2C_MISC1_WAY_AGENT_1 _SB_MAKEMASK(8,S_BCM1480_L2C_MISC1_WAY_AGENT_1)
144#define G_BCM1480_L2C_MISC1_WAY_AGENT_1(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC1_WAY_AGENT_1,M_BCM1480_L2C_MISC1_WAY_AGENT_1)
145
146#define S_BCM1480_L2C_MISC1_WAY_AGENT_2 16
147#define M_BCM1480_L2C_MISC1_WAY_AGENT_2 _SB_MAKEMASK(8,S_BCM1480_L2C_MISC1_WAY_AGENT_2)
148#define G_BCM1480_L2C_MISC1_WAY_AGENT_2(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC1_WAY_AGENT_2,M_BCM1480_L2C_MISC1_WAY_AGENT_2)
149
150#define S_BCM1480_L2C_MISC1_WAY_AGENT_3 24
151#define M_BCM1480_L2C_MISC1_WAY_AGENT_3 _SB_MAKEMASK(8,S_BCM1480_L2C_MISC1_WAY_AGENT_3)
152#define G_BCM1480_L2C_MISC1_WAY_AGENT_3(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC1_WAY_AGENT_3,M_BCM1480_L2C_MISC1_WAY_AGENT_3)
153
154#define S_BCM1480_L2C_MISC1_WAY_AGENT_4 32
155#define M_BCM1480_L2C_MISC1_WAY_AGENT_4 _SB_MAKEMASK(8,S_BCM1480_L2C_MISC1_WAY_AGENT_4)
156#define G_BCM1480_L2C_MISC1_WAY_AGENT_4(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC1_WAY_AGENT_4,M_BCM1480_L2C_MISC1_WAY_AGENT_4)
157
158
159/*
160 * L2 Misc2 Value Register (Table 60)
161 */
162
163#define S_BCM1480_L2C_MISC2_WAY_AGENT_8 0
164#define M_BCM1480_L2C_MISC2_WAY_AGENT_8 _SB_MAKEMASK(8,S_BCM1480_L2C_MISC2_WAY_AGENT_8)
165#define G_BCM1480_L2C_MISC2_WAY_AGENT_8(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC2_WAY_AGENT_8,M_BCM1480_L2C_MISC2_WAY_AGENT_8)
166
167#define S_BCM1480_L2C_MISC2_WAY_AGENT_9 8
168#define M_BCM1480_L2C_MISC2_WAY_AGENT_9 _SB_MAKEMASK(8,S_BCM1480_L2C_MISC2_WAY_AGENT_9)
169#define G_BCM1480_L2C_MISC2_WAY_AGENT_9(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC2_WAY_AGENT_9,M_BCM1480_L2C_MISC2_WAY_AGENT_9)
170
171#define S_BCM1480_L2C_MISC2_WAY_AGENT_A 16
172#define M_BCM1480_L2C_MISC2_WAY_AGENT_A _SB_MAKEMASK(8,S_BCM1480_L2C_MISC2_WAY_AGENT_A)
173#define G_BCM1480_L2C_MISC2_WAY_AGENT_A(x) _SB_GETVALUE(x,S_BCM1480_L2C_MISC2_WAY_AGENT_A,M_BCM1480_L2C_MISC2_WAY_AGENT_A)
174
175
176#endif /* _BCM1480_L2C_H */
diff --git a/include/asm-mips/sibyte/bcm1480_mc.h b/include/asm-mips/sibyte/bcm1480_mc.h
new file mode 100644
index 000000000000..6bdc941afc91
--- /dev/null
+++ b/include/asm-mips/sibyte/bcm1480_mc.h
@@ -0,0 +1,962 @@
1/* *********************************************************************
2 * BCM1280/BCM1480 Board Support Package
3 *
4 * Memory Controller constants File: bcm1480_mc.h
5 *
6 * This module contains constants and macros useful for
7 * programming the memory controller.
8 *
9 * BCM1400 specification level: 1280-UM100-D1 (11/14/03 Review Copy)
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _BCM1480_MC_H
34#define _BCM1480_MC_H
35
36#include "sb1250_defs.h"
37
38/*
39 * Memory Channel Configuration Register (Table 81)
40 */
41
42#define S_BCM1480_MC_INTLV0 0
43#define M_BCM1480_MC_INTLV0 _SB_MAKEMASK(6,S_BCM1480_MC_INTLV0)
44#define V_BCM1480_MC_INTLV0(x) _SB_MAKEVALUE(x,S_BCM1480_MC_INTLV0)
45#define G_BCM1480_MC_INTLV0(x) _SB_GETVALUE(x,S_BCM1480_MC_INTLV0,M_BCM1480_MC_INTLV0)
46#define V_BCM1480_MC_INTLV0_DEFAULT V_BCM1480_MC_INTLV0(0)
47
48#define S_BCM1480_MC_INTLV1 8
49#define M_BCM1480_MC_INTLV1 _SB_MAKEMASK(6,S_BCM1480_MC_INTLV1)
50#define V_BCM1480_MC_INTLV1(x) _SB_MAKEVALUE(x,S_BCM1480_MC_INTLV1)
51#define G_BCM1480_MC_INTLV1(x) _SB_GETVALUE(x,S_BCM1480_MC_INTLV1,M_BCM1480_MC_INTLV1)
52#define V_BCM1480_MC_INTLV1_DEFAULT V_BCM1480_MC_INTLV1(0)
53
54#define S_BCM1480_MC_INTLV2 16
55#define M_BCM1480_MC_INTLV2 _SB_MAKEMASK(6,S_BCM1480_MC_INTLV2)
56#define V_BCM1480_MC_INTLV2(x) _SB_MAKEVALUE(x,S_BCM1480_MC_INTLV2)
57#define G_BCM1480_MC_INTLV2(x) _SB_GETVALUE(x,S_BCM1480_MC_INTLV2,M_BCM1480_MC_INTLV2)
58#define V_BCM1480_MC_INTLV2_DEFAULT V_BCM1480_MC_INTLV2(0)
59
60#define S_BCM1480_MC_CS_MODE 32
61#define M_BCM1480_MC_CS_MODE _SB_MAKEMASK(8,S_BCM1480_MC_CS_MODE)
62#define V_BCM1480_MC_CS_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS_MODE)
63#define G_BCM1480_MC_CS_MODE(x) _SB_GETVALUE(x,S_BCM1480_MC_CS_MODE,M_BCM1480_MC_CS_MODE)
64#define V_BCM1480_MC_CS_MODE_DEFAULT V_BCM1480_MC_CS_MODE(0)
65
66#define V_BCM1480_MC_CONFIG_DEFAULT (V_BCM1480_MC_INTLV0_DEFAULT | \
67 V_BCM1480_MC_INTLV1_DEFAULT | \
68 V_BCM1480_MC_INTLV2_DEFAULT | \
69 V_BCM1480_MC_CS_MODE_DEFAULT)
70
71#define K_BCM1480_MC_CS01_MODE 0x03
72#define K_BCM1480_MC_CS02_MODE 0x05
73#define K_BCM1480_MC_CS0123_MODE 0x0F
74#define K_BCM1480_MC_CS0246_MODE 0x55
75#define K_BCM1480_MC_CS0145_MODE 0x33
76#define K_BCM1480_MC_CS0167_MODE 0xC3
77#define K_BCM1480_MC_CSFULL_MODE 0xFF
78
79/*
80 * Chip Select Start Address Register (Table 82)
81 */
82
83#define S_BCM1480_MC_CS0_START 0
84#define M_BCM1480_MC_CS0_START _SB_MAKEMASK(12,S_BCM1480_MC_CS0_START)
85#define V_BCM1480_MC_CS0_START(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS0_START)
86#define G_BCM1480_MC_CS0_START(x) _SB_GETVALUE(x,S_BCM1480_MC_CS0_START,M_BCM1480_MC_CS0_START)
87
88#define S_BCM1480_MC_CS1_START 16
89#define M_BCM1480_MC_CS1_START _SB_MAKEMASK(12,S_BCM1480_MC_CS1_START)
90#define V_BCM1480_MC_CS1_START(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS1_START)
91#define G_BCM1480_MC_CS1_START(x) _SB_GETVALUE(x,S_BCM1480_MC_CS1_START,M_BCM1480_MC_CS1_START)
92
93#define S_BCM1480_MC_CS2_START 32
94#define M_BCM1480_MC_CS2_START _SB_MAKEMASK(12,S_BCM1480_MC_CS2_START)
95#define V_BCM1480_MC_CS2_START(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS2_START)
96#define G_BCM1480_MC_CS2_START(x) _SB_GETVALUE(x,S_BCM1480_MC_CS2_START,M_BCM1480_MC_CS2_START)
97
98#define S_BCM1480_MC_CS3_START 48
99#define M_BCM1480_MC_CS3_START _SB_MAKEMASK(12,S_BCM1480_MC_CS3_START)
100#define V_BCM1480_MC_CS3_START(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS3_START)
101#define G_BCM1480_MC_CS3_START(x) _SB_GETVALUE(x,S_BCM1480_MC_CS3_START,M_BCM1480_MC_CS3_START)
102
103/*
104 * Chip Select End Address Register (Table 83)
105 */
106
107#define S_BCM1480_MC_CS0_END 0
108#define M_BCM1480_MC_CS0_END _SB_MAKEMASK(12,S_BCM1480_MC_CS0_END)
109#define V_BCM1480_MC_CS0_END(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS0_END)
110#define G_BCM1480_MC_CS0_END(x) _SB_GETVALUE(x,S_BCM1480_MC_CS0_END,M_BCM1480_MC_CS0_END)
111
112#define S_BCM1480_MC_CS1_END 16
113#define M_BCM1480_MC_CS1_END _SB_MAKEMASK(12,S_BCM1480_MC_CS1_END)
114#define V_BCM1480_MC_CS1_END(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS1_END)
115#define G_BCM1480_MC_CS1_END(x) _SB_GETVALUE(x,S_BCM1480_MC_CS1_END,M_BCM1480_MC_CS1_END)
116
117#define S_BCM1480_MC_CS2_END 32
118#define M_BCM1480_MC_CS2_END _SB_MAKEMASK(12,S_BCM1480_MC_CS2_END)
119#define V_BCM1480_MC_CS2_END(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS2_END)
120#define G_BCM1480_MC_CS2_END(x) _SB_GETVALUE(x,S_BCM1480_MC_CS2_END,M_BCM1480_MC_CS2_END)
121
122#define S_BCM1480_MC_CS3_END 48
123#define M_BCM1480_MC_CS3_END _SB_MAKEMASK(12,S_BCM1480_MC_CS3_END)
124#define V_BCM1480_MC_CS3_END(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS3_END)
125#define G_BCM1480_MC_CS3_END(x) _SB_GETVALUE(x,S_BCM1480_MC_CS3_END,M_BCM1480_MC_CS3_END)
126
127/*
128 * Row Address Bit Select Register 0 (Table 84)
129 */
130
131#define S_BCM1480_MC_ROW00 0
132#define M_BCM1480_MC_ROW00 _SB_MAKEMASK(6,S_BCM1480_MC_ROW00)
133#define V_BCM1480_MC_ROW00(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW00)
134#define G_BCM1480_MC_ROW00(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW00,M_BCM1480_MC_ROW00)
135
136#define S_BCM1480_MC_ROW01 8
137#define M_BCM1480_MC_ROW01 _SB_MAKEMASK(6,S_BCM1480_MC_ROW01)
138#define V_BCM1480_MC_ROW01(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW01)
139#define G_BCM1480_MC_ROW01(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW01,M_BCM1480_MC_ROW01)
140
141#define S_BCM1480_MC_ROW02 16
142#define M_BCM1480_MC_ROW02 _SB_MAKEMASK(6,S_BCM1480_MC_ROW02)
143#define V_BCM1480_MC_ROW02(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW02)
144#define G_BCM1480_MC_ROW02(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW02,M_BCM1480_MC_ROW02)
145
146#define S_BCM1480_MC_ROW03 24
147#define M_BCM1480_MC_ROW03 _SB_MAKEMASK(6,S_BCM1480_MC_ROW03)
148#define V_BCM1480_MC_ROW03(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW03)
149#define G_BCM1480_MC_ROW03(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW03,M_BCM1480_MC_ROW03)
150
151#define S_BCM1480_MC_ROW04 32
152#define M_BCM1480_MC_ROW04 _SB_MAKEMASK(6,S_BCM1480_MC_ROW04)
153#define V_BCM1480_MC_ROW04(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW04)
154#define G_BCM1480_MC_ROW04(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW04,M_BCM1480_MC_ROW04)
155
156#define S_BCM1480_MC_ROW05 40
157#define M_BCM1480_MC_ROW05 _SB_MAKEMASK(6,S_BCM1480_MC_ROW05)
158#define V_BCM1480_MC_ROW05(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW05)
159#define G_BCM1480_MC_ROW05(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW05,M_BCM1480_MC_ROW05)
160
161#define S_BCM1480_MC_ROW06 48
162#define M_BCM1480_MC_ROW06 _SB_MAKEMASK(6,S_BCM1480_MC_ROW06)
163#define V_BCM1480_MC_ROW06(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW06)
164#define G_BCM1480_MC_ROW06(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW06,M_BCM1480_MC_ROW06)
165
166#define S_BCM1480_MC_ROW07 56
167#define M_BCM1480_MC_ROW07 _SB_MAKEMASK(6,S_BCM1480_MC_ROW07)
168#define V_BCM1480_MC_ROW07(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW07)
169#define G_BCM1480_MC_ROW07(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW07,M_BCM1480_MC_ROW07)
170
171/*
172 * Row Address Bit Select Register 1 (Table 85)
173 */
174
175#define S_BCM1480_MC_ROW08 0
176#define M_BCM1480_MC_ROW08 _SB_MAKEMASK(6,S_BCM1480_MC_ROW08)
177#define V_BCM1480_MC_ROW08(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW08)
178#define G_BCM1480_MC_ROW08(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW08,M_BCM1480_MC_ROW08)
179
180#define S_BCM1480_MC_ROW09 8
181#define M_BCM1480_MC_ROW09 _SB_MAKEMASK(6,S_BCM1480_MC_ROW09)
182#define V_BCM1480_MC_ROW09(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW09)
183#define G_BCM1480_MC_ROW09(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW09,M_BCM1480_MC_ROW09)
184
185#define S_BCM1480_MC_ROW10 16
186#define M_BCM1480_MC_ROW10 _SB_MAKEMASK(6,S_BCM1480_MC_ROW10)
187#define V_BCM1480_MC_ROW10(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW10)
188#define G_BCM1480_MC_ROW10(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW10,M_BCM1480_MC_ROW10)
189
190#define S_BCM1480_MC_ROW11 24
191#define M_BCM1480_MC_ROW11 _SB_MAKEMASK(6,S_BCM1480_MC_ROW11)
192#define V_BCM1480_MC_ROW11(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW11)
193#define G_BCM1480_MC_ROW11(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW11,M_BCM1480_MC_ROW11)
194
195#define S_BCM1480_MC_ROW12 32
196#define M_BCM1480_MC_ROW12 _SB_MAKEMASK(6,S_BCM1480_MC_ROW12)
197#define V_BCM1480_MC_ROW12(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW12)
198#define G_BCM1480_MC_ROW12(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW12,M_BCM1480_MC_ROW12)
199
200#define S_BCM1480_MC_ROW13 40
201#define M_BCM1480_MC_ROW13 _SB_MAKEMASK(6,S_BCM1480_MC_ROW13)
202#define V_BCM1480_MC_ROW13(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW13)
203#define G_BCM1480_MC_ROW13(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW13,M_BCM1480_MC_ROW13)
204
205#define S_BCM1480_MC_ROW14 48
206#define M_BCM1480_MC_ROW14 _SB_MAKEMASK(6,S_BCM1480_MC_ROW14)
207#define V_BCM1480_MC_ROW14(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ROW14)
208#define G_BCM1480_MC_ROW14(x) _SB_GETVALUE(x,S_BCM1480_MC_ROW14,M_BCM1480_MC_ROW14)
209
210#define K_BCM1480_MC_ROWX_BIT_SPACING 8
211
212/*
213 * Column Address Bit Select Register 0 (Table 86)
214 */
215
216#define S_BCM1480_MC_COL00 0
217#define M_BCM1480_MC_COL00 _SB_MAKEMASK(6,S_BCM1480_MC_COL00)
218#define V_BCM1480_MC_COL00(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL00)
219#define G_BCM1480_MC_COL00(x) _SB_GETVALUE(x,S_BCM1480_MC_COL00,M_BCM1480_MC_COL00)
220
221#define S_BCM1480_MC_COL01 8
222#define M_BCM1480_MC_COL01 _SB_MAKEMASK(6,S_BCM1480_MC_COL01)
223#define V_BCM1480_MC_COL01(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL01)
224#define G_BCM1480_MC_COL01(x) _SB_GETVALUE(x,S_BCM1480_MC_COL01,M_BCM1480_MC_COL01)
225
226#define S_BCM1480_MC_COL02 16
227#define M_BCM1480_MC_COL02 _SB_MAKEMASK(6,S_BCM1480_MC_COL02)
228#define V_BCM1480_MC_COL02(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL02)
229#define G_BCM1480_MC_COL02(x) _SB_GETVALUE(x,S_BCM1480_MC_COL02,M_BCM1480_MC_COL02)
230
231#define S_BCM1480_MC_COL03 24
232#define M_BCM1480_MC_COL03 _SB_MAKEMASK(6,S_BCM1480_MC_COL03)
233#define V_BCM1480_MC_COL03(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL03)
234#define G_BCM1480_MC_COL03(x) _SB_GETVALUE(x,S_BCM1480_MC_COL03,M_BCM1480_MC_COL03)
235
236#define S_BCM1480_MC_COL04 32
237#define M_BCM1480_MC_COL04 _SB_MAKEMASK(6,S_BCM1480_MC_COL04)
238#define V_BCM1480_MC_COL04(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL04)
239#define G_BCM1480_MC_COL04(x) _SB_GETVALUE(x,S_BCM1480_MC_COL04,M_BCM1480_MC_COL04)
240
241#define S_BCM1480_MC_COL05 40
242#define M_BCM1480_MC_COL05 _SB_MAKEMASK(6,S_BCM1480_MC_COL05)
243#define V_BCM1480_MC_COL05(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL05)
244#define G_BCM1480_MC_COL05(x) _SB_GETVALUE(x,S_BCM1480_MC_COL05,M_BCM1480_MC_COL05)
245
246#define S_BCM1480_MC_COL06 48
247#define M_BCM1480_MC_COL06 _SB_MAKEMASK(6,S_BCM1480_MC_COL06)
248#define V_BCM1480_MC_COL06(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL06)
249#define G_BCM1480_MC_COL06(x) _SB_GETVALUE(x,S_BCM1480_MC_COL06,M_BCM1480_MC_COL06)
250
251#define S_BCM1480_MC_COL07 56
252#define M_BCM1480_MC_COL07 _SB_MAKEMASK(6,S_BCM1480_MC_COL07)
253#define V_BCM1480_MC_COL07(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL07)
254#define G_BCM1480_MC_COL07(x) _SB_GETVALUE(x,S_BCM1480_MC_COL07,M_BCM1480_MC_COL07)
255
256/*
257 * Column Address Bit Select Register 1 (Table 87)
258 */
259
260#define S_BCM1480_MC_COL08 0
261#define M_BCM1480_MC_COL08 _SB_MAKEMASK(6,S_BCM1480_MC_COL08)
262#define V_BCM1480_MC_COL08(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL08)
263#define G_BCM1480_MC_COL08(x) _SB_GETVALUE(x,S_BCM1480_MC_COL08,M_BCM1480_MC_COL08)
264
265#define S_BCM1480_MC_COL09 8
266#define M_BCM1480_MC_COL09 _SB_MAKEMASK(6,S_BCM1480_MC_COL09)
267#define V_BCM1480_MC_COL09(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL09)
268#define G_BCM1480_MC_COL09(x) _SB_GETVALUE(x,S_BCM1480_MC_COL09,M_BCM1480_MC_COL09)
269
270#define S_BCM1480_MC_COL10 16 /* not a valid position, must be prog as 0 */
271
272#define S_BCM1480_MC_COL11 24
273#define M_BCM1480_MC_COL11 _SB_MAKEMASK(6,S_BCM1480_MC_COL11)
274#define V_BCM1480_MC_COL11(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL11)
275#define G_BCM1480_MC_COL11(x) _SB_GETVALUE(x,S_BCM1480_MC_COL11,M_BCM1480_MC_COL11)
276
277#define S_BCM1480_MC_COL12 32
278#define M_BCM1480_MC_COL12 _SB_MAKEMASK(6,S_BCM1480_MC_COL12)
279#define V_BCM1480_MC_COL12(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL12)
280#define G_BCM1480_MC_COL12(x) _SB_GETVALUE(x,S_BCM1480_MC_COL12,M_BCM1480_MC_COL12)
281
282#define S_BCM1480_MC_COL13 40
283#define M_BCM1480_MC_COL13 _SB_MAKEMASK(6,S_BCM1480_MC_COL13)
284#define V_BCM1480_MC_COL13(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL13)
285#define G_BCM1480_MC_COL13(x) _SB_GETVALUE(x,S_BCM1480_MC_COL13,M_BCM1480_MC_COL13)
286
287#define S_BCM1480_MC_COL14 48
288#define M_BCM1480_MC_COL14 _SB_MAKEMASK(6,S_BCM1480_MC_COL14)
289#define V_BCM1480_MC_COL14(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COL14)
290#define G_BCM1480_MC_COL14(x) _SB_GETVALUE(x,S_BCM1480_MC_COL14,M_BCM1480_MC_COL14)
291
292#define K_BCM1480_MC_COLX_BIT_SPACING 8
293
294/*
295 * CS0 and CS1 Bank Address Bit Select Register (Table 88)
296 */
297
298#define S_BCM1480_MC_CS01_BANK0 0
299#define M_BCM1480_MC_CS01_BANK0 _SB_MAKEMASK(6,S_BCM1480_MC_CS01_BANK0)
300#define V_BCM1480_MC_CS01_BANK0(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS01_BANK0)
301#define G_BCM1480_MC_CS01_BANK0(x) _SB_GETVALUE(x,S_BCM1480_MC_CS01_BANK0,M_BCM1480_MC_CS01_BANK0)
302
303#define S_BCM1480_MC_CS01_BANK1 8
304#define M_BCM1480_MC_CS01_BANK1 _SB_MAKEMASK(6,S_BCM1480_MC_CS01_BANK1)
305#define V_BCM1480_MC_CS01_BANK1(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS01_BANK1)
306#define G_BCM1480_MC_CS01_BANK1(x) _SB_GETVALUE(x,S_BCM1480_MC_CS01_BANK1,M_BCM1480_MC_CS01_BANK1)
307
308#define S_BCM1480_MC_CS01_BANK2 16
309#define M_BCM1480_MC_CS01_BANK2 _SB_MAKEMASK(6,S_BCM1480_MC_CS01_BANK2)
310#define V_BCM1480_MC_CS01_BANK2(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS01_BANK2)
311#define G_BCM1480_MC_CS01_BANK2(x) _SB_GETVALUE(x,S_BCM1480_MC_CS01_BANK2,M_BCM1480_MC_CS01_BANK2)
312
313/*
314 * CS2 and CS3 Bank Address Bit Select Register (Table 89)
315 */
316
317#define S_BCM1480_MC_CS23_BANK0 0
318#define M_BCM1480_MC_CS23_BANK0 _SB_MAKEMASK(6,S_BCM1480_MC_CS23_BANK0)
319#define V_BCM1480_MC_CS23_BANK0(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS23_BANK0)
320#define G_BCM1480_MC_CS23_BANK0(x) _SB_GETVALUE(x,S_BCM1480_MC_CS23_BANK0,M_BCM1480_MC_CS23_BANK0)
321
322#define S_BCM1480_MC_CS23_BANK1 8
323#define M_BCM1480_MC_CS23_BANK1 _SB_MAKEMASK(6,S_BCM1480_MC_CS23_BANK1)
324#define V_BCM1480_MC_CS23_BANK1(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS23_BANK1)
325#define G_BCM1480_MC_CS23_BANK1(x) _SB_GETVALUE(x,S_BCM1480_MC_CS23_BANK1,M_BCM1480_MC_CS23_BANK1)
326
327#define S_BCM1480_MC_CS23_BANK2 16
328#define M_BCM1480_MC_CS23_BANK2 _SB_MAKEMASK(6,S_BCM1480_MC_CS23_BANK2)
329#define V_BCM1480_MC_CS23_BANK2(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS23_BANK2)
330#define G_BCM1480_MC_CS23_BANK2(x) _SB_GETVALUE(x,S_BCM1480_MC_CS23_BANK2,M_BCM1480_MC_CS23_BANK2)
331
332#define K_BCM1480_MC_CSXX_BANKX_BIT_SPACING 8
333
334/*
335 * DRAM Command Register (Table 90)
336 */
337
338#define S_BCM1480_MC_COMMAND 0
339#define M_BCM1480_MC_COMMAND _SB_MAKEMASK(4,S_BCM1480_MC_COMMAND)
340#define V_BCM1480_MC_COMMAND(x) _SB_MAKEVALUE(x,S_BCM1480_MC_COMMAND)
341#define G_BCM1480_MC_COMMAND(x) _SB_GETVALUE(x,S_BCM1480_MC_COMMAND,M_BCM1480_MC_COMMAND)
342
343#define K_BCM1480_MC_COMMAND_EMRS 0
344#define K_BCM1480_MC_COMMAND_MRS 1
345#define K_BCM1480_MC_COMMAND_PRE 2
346#define K_BCM1480_MC_COMMAND_AR 3
347#define K_BCM1480_MC_COMMAND_SETRFSH 4
348#define K_BCM1480_MC_COMMAND_CLRRFSH 5
349#define K_BCM1480_MC_COMMAND_SETPWRDN 6
350#define K_BCM1480_MC_COMMAND_CLRPWRDN 7
351
352#if SIBYTE_HDR_FEATURE(1480, PASS2)
353#define K_BCM1480_MC_COMMAND_EMRS2 8
354#define K_BCM1480_MC_COMMAND_EMRS3 9
355#define K_BCM1480_MC_COMMAND_ENABLE_MCLK 10
356#define K_BCM1480_MC_COMMAND_DISABLE_MCLK 11
357#endif
358
359#define V_BCM1480_MC_COMMAND_EMRS V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_EMRS)
360#define V_BCM1480_MC_COMMAND_MRS V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_MRS)
361#define V_BCM1480_MC_COMMAND_PRE V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_PRE)
362#define V_BCM1480_MC_COMMAND_AR V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_AR)
363#define V_BCM1480_MC_COMMAND_SETRFSH V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_SETRFSH)
364#define V_BCM1480_MC_COMMAND_CLRRFSH V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_CLRRFSH)
365#define V_BCM1480_MC_COMMAND_SETPWRDN V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_SETPWRDN)
366#define V_BCM1480_MC_COMMAND_CLRPWRDN V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_CLRPWRDN)
367
368#if SIBYTE_HDR_FEATURE(1480, PASS2)
369#define V_BCM1480_MC_COMMAND_EMRS2 V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_EMRS2)
370#define V_BCM1480_MC_COMMAND_EMRS3 V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_EMRS3)
371#define V_BCM1480_MC_COMMAND_ENABLE_MCLK V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_ENABLE_MCLK)
372#define V_BCM1480_MC_COMMAND_DISABLE_MCLK V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_DISABLE_MCLK)
373#endif
374
375#define S_BCM1480_MC_CS0 4
376#define M_BCM1480_MC_CS0 _SB_MAKEMASK1(4)
377#define M_BCM1480_MC_CS1 _SB_MAKEMASK1(5)
378#define M_BCM1480_MC_CS2 _SB_MAKEMASK1(6)
379#define M_BCM1480_MC_CS3 _SB_MAKEMASK1(7)
380#define M_BCM1480_MC_CS4 _SB_MAKEMASK1(8)
381#define M_BCM1480_MC_CS5 _SB_MAKEMASK1(9)
382#define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10)
383#define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11)
384
385#define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16)
386
387/*
388 * DRAM Mode Register (Table 91)
389 */
390
391#define S_BCM1480_MC_EMODE 0
392#define M_BCM1480_MC_EMODE _SB_MAKEMASK(15,S_BCM1480_MC_EMODE)
393#define V_BCM1480_MC_EMODE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_EMODE)
394#define G_BCM1480_MC_EMODE(x) _SB_GETVALUE(x,S_BCM1480_MC_EMODE,M_BCM1480_MC_EMODE)
395#define V_BCM1480_MC_EMODE_DEFAULT V_BCM1480_MC_EMODE(0)
396
397#define S_BCM1480_MC_MODE 16
398#define M_BCM1480_MC_MODE _SB_MAKEMASK(15,S_BCM1480_MC_MODE)
399#define V_BCM1480_MC_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_MODE)
400#define G_BCM1480_MC_MODE(x) _SB_GETVALUE(x,S_BCM1480_MC_MODE,M_BCM1480_MC_MODE)
401#define V_BCM1480_MC_MODE_DEFAULT V_BCM1480_MC_MODE(0)
402
403#define S_BCM1480_MC_DRAM_TYPE 32
404#define M_BCM1480_MC_DRAM_TYPE _SB_MAKEMASK(4,S_BCM1480_MC_DRAM_TYPE)
405#define V_BCM1480_MC_DRAM_TYPE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DRAM_TYPE)
406#define G_BCM1480_MC_DRAM_TYPE(x) _SB_GETVALUE(x,S_BCM1480_MC_DRAM_TYPE,M_BCM1480_MC_DRAM_TYPE)
407
408#define K_BCM1480_MC_DRAM_TYPE_JEDEC 0
409#define K_BCM1480_MC_DRAM_TYPE_FCRAM 1
410
411#if SIBYTE_HDR_FEATURE(1480, PASS2)
412#define K_BCM1480_MC_DRAM_TYPE_DDR2 2
413#endif
414
415#define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC)
416#define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM)
417
418#if SIBYTE_HDR_FEATURE(1480, PASS2)
419#define V_BCM1480_MC_DRAM_TYPE_DDR2 V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_DDR2)
420#endif
421
422#define M_BCM1480_MC_GANGED _SB_MAKEMASK1(36)
423#define M_BCM1480_MC_BY9_INTF _SB_MAKEMASK1(37)
424#define M_BCM1480_MC_FORCE_ECC64 _SB_MAKEMASK1(38)
425#define M_BCM1480_MC_ECC_DISABLE _SB_MAKEMASK1(39)
426
427#define S_BCM1480_MC_PG_POLICY 40
428#define M_BCM1480_MC_PG_POLICY _SB_MAKEMASK(2,S_BCM1480_MC_PG_POLICY)
429#define V_BCM1480_MC_PG_POLICY(x) _SB_MAKEVALUE(x,S_BCM1480_MC_PG_POLICY)
430#define G_BCM1480_MC_PG_POLICY(x) _SB_GETVALUE(x,S_BCM1480_MC_PG_POLICY,M_BCM1480_MC_PG_POLICY)
431
432#define K_BCM1480_MC_PG_POLICY_CLOSED 0
433#define K_BCM1480_MC_PG_POLICY_CAS_TIME_CHK 1
434
435#define V_BCM1480_MC_PG_POLICY_CLOSED V_BCM1480_MC_PG_POLICY(K_BCM1480_MC_PG_POLICY_CLOSED)
436#define V_BCM1480_MC_PG_POLICY_CAS_TIME_CHK V_BCM1480_MC_PG_POLICY(K_BCM1480_MC_PG_POLICY_CAS_TIME_CHK)
437
438#if SIBYTE_HDR_FEATURE(1480, PASS2)
439#define M_BCM1480_MC_2T_CMD _SB_MAKEMASK1(42)
440#define M_BCM1480_MC_ECC_COR_DIS _SB_MAKEMASK1(43)
441#endif
442
443#define V_BCM1480_MC_DRAMMODE_DEFAULT V_BCM1480_MC_EMODE_DEFAULT | V_BCM1480_MC_MODE_DEFAULT | V_BCM1480_MC_DRAM_TYPE_JEDEC | \
444 V_BCM1480_MC_PG_POLICY(K_BCM1480_MC_PG_POLICY_CAS_TIME_CHK)
445
446/*
447 * Memory Clock Configuration Register (Table 92)
448 */
449
450#define S_BCM1480_MC_CLK_RATIO 0
451#define M_BCM1480_MC_CLK_RATIO _SB_MAKEMASK(6,S_BCM1480_MC_CLK_RATIO)
452#define V_BCM1480_MC_CLK_RATIO(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CLK_RATIO)
453#define G_BCM1480_MC_CLK_RATIO(x) _SB_GETVALUE(x,S_BCM1480_MC_CLK_RATIO,M_BCM1480_MC_CLK_RATIO)
454
455#define V_BCM1480_MC_CLK_RATIO_DEFAULT V_BCM1480_MC_CLK_RATIO(10)
456
457#define S_BCM1480_MC_REF_RATE 8
458#define M_BCM1480_MC_REF_RATE _SB_MAKEMASK(8,S_BCM1480_MC_REF_RATE)
459#define V_BCM1480_MC_REF_RATE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_REF_RATE)
460#define G_BCM1480_MC_REF_RATE(x) _SB_GETVALUE(x,S_BCM1480_MC_REF_RATE,M_BCM1480_MC_REF_RATE)
461
462#define K_BCM1480_MC_REF_RATE_100MHz 0x31
463#define K_BCM1480_MC_REF_RATE_200MHz 0x62
464#define K_BCM1480_MC_REF_RATE_400MHz 0xC4
465
466#define V_BCM1480_MC_REF_RATE_100MHz V_BCM1480_MC_REF_RATE(K_BCM1480_MC_REF_RATE_100MHz)
467#define V_BCM1480_MC_REF_RATE_200MHz V_BCM1480_MC_REF_RATE(K_BCM1480_MC_REF_RATE_200MHz)
468#define V_BCM1480_MC_REF_RATE_400MHz V_BCM1480_MC_REF_RATE(K_BCM1480_MC_REF_RATE_400MHz)
469#define V_BCM1480_MC_REF_RATE_DEFAULT V_BCM1480_MC_REF_RATE_400MHz
470
471#if SIBYTE_HDR_FEATURE(1480, PASS2)
472#define M_BCM1480_MC_AUTO_REF_DIS _SB_MAKEMASK1(16)
473#endif
474
475/*
476 * ODT Register (Table 99)
477 */
478
479#if SIBYTE_HDR_FEATURE(1480, PASS2)
480#define M_BCM1480_MC_RD_ODT0_CS0 _SB_MAKEMASK1(0)
481#define M_BCM1480_MC_RD_ODT0_CS2 _SB_MAKEMASK1(1)
482#define M_BCM1480_MC_RD_ODT0_CS4 _SB_MAKEMASK1(2)
483#define M_BCM1480_MC_RD_ODT0_CS6 _SB_MAKEMASK1(3)
484#define M_BCM1480_MC_WR_ODT0_CS0 _SB_MAKEMASK1(4)
485#define M_BCM1480_MC_WR_ODT0_CS2 _SB_MAKEMASK1(5)
486#define M_BCM1480_MC_WR_ODT0_CS4 _SB_MAKEMASK1(6)
487#define M_BCM1480_MC_WR_ODT0_CS6 _SB_MAKEMASK1(7)
488#define M_BCM1480_MC_RD_ODT2_CS0 _SB_MAKEMASK1(8)
489#define M_BCM1480_MC_RD_ODT2_CS2 _SB_MAKEMASK1(9)
490#define M_BCM1480_MC_RD_ODT2_CS4 _SB_MAKEMASK1(10)
491#define M_BCM1480_MC_RD_ODT2_CS6 _SB_MAKEMASK1(11)
492#define M_BCM1480_MC_WR_ODT2_CS0 _SB_MAKEMASK1(12)
493#define M_BCM1480_MC_WR_ODT2_CS2 _SB_MAKEMASK1(13)
494#define M_BCM1480_MC_WR_ODT2_CS4 _SB_MAKEMASK1(14)
495#define M_BCM1480_MC_WR_ODT2_CS6 _SB_MAKEMASK1(15)
496#define M_BCM1480_MC_RD_ODT4_CS0 _SB_MAKEMASK1(16)
497#define M_BCM1480_MC_RD_ODT4_CS2 _SB_MAKEMASK1(17)
498#define M_BCM1480_MC_RD_ODT4_CS4 _SB_MAKEMASK1(18)
499#define M_BCM1480_MC_RD_ODT4_CS6 _SB_MAKEMASK1(19)
500#define M_BCM1480_MC_WR_ODT4_CS0 _SB_MAKEMASK1(20)
501#define M_BCM1480_MC_WR_ODT4_CS2 _SB_MAKEMASK1(21)
502#define M_BCM1480_MC_WR_ODT4_CS4 _SB_MAKEMASK1(22)
503#define M_BCM1480_MC_WR_ODT4_CS6 _SB_MAKEMASK1(23)
504#define M_BCM1480_MC_RD_ODT6_CS0 _SB_MAKEMASK1(24)
505#define M_BCM1480_MC_RD_ODT6_CS2 _SB_MAKEMASK1(25)
506#define M_BCM1480_MC_RD_ODT6_CS4 _SB_MAKEMASK1(26)
507#define M_BCM1480_MC_RD_ODT6_CS6 _SB_MAKEMASK1(27)
508#define M_BCM1480_MC_WR_ODT6_CS0 _SB_MAKEMASK1(28)
509#define M_BCM1480_MC_WR_ODT6_CS2 _SB_MAKEMASK1(29)
510#define M_BCM1480_MC_WR_ODT6_CS4 _SB_MAKEMASK1(30)
511#define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31)
512
513#define M_BCM1480_MC_CS_ODD_ODT_EN _SB_MAKEMASK1(32)
514#endif
515
516/*
517 * Memory DLL Configuration Register (Table 93)
518 */
519
520#define S_BCM1480_MC_ADDR_COARSE_ADJ 0
521#define M_BCM1480_MC_ADDR_COARSE_ADJ _SB_MAKEMASK(6,S_BCM1480_MC_ADDR_COARSE_ADJ)
522#define V_BCM1480_MC_ADDR_COARSE_ADJ(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ADDR_COARSE_ADJ)
523#define G_BCM1480_MC_ADDR_COARSE_ADJ(x) _SB_GETVALUE(x,S_BCM1480_MC_ADDR_COARSE_ADJ,M_BCM1480_MC_ADDR_COARSE_ADJ)
524#define V_BCM1480_MC_ADDR_COARSE_ADJ_DEFAULT V_BCM1480_MC_ADDR_COARSE_ADJ(0x0)
525
526#if SIBYTE_HDR_FEATURE(1480, PASS2)
527#define S_BCM1480_MC_ADDR_FREQ_RANGE 8
528#define M_BCM1480_MC_ADDR_FREQ_RANGE _SB_MAKEMASK(4,S_BCM1480_MC_ADDR_FREQ_RANGE)
529#define V_BCM1480_MC_ADDR_FREQ_RANGE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ADDR_FREQ_RANGE)
530#define G_BCM1480_MC_ADDR_FREQ_RANGE(x) _SB_GETVALUE(x,S_BCM1480_MC_ADDR_FREQ_RANGE,M_BCM1480_MC_ADDR_FREQ_RANGE)
531#define V_BCM1480_MC_ADDR_FREQ_RANGE_DEFAULT V_BCM1480_MC_ADDR_FREQ_RANGE(0x4)
532#endif
533
534#define S_BCM1480_MC_ADDR_FINE_ADJ 8
535#define M_BCM1480_MC_ADDR_FINE_ADJ _SB_MAKEMASK(4,S_BCM1480_MC_ADDR_FINE_ADJ)
536#define V_BCM1480_MC_ADDR_FINE_ADJ(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ADDR_FINE_ADJ)
537#define G_BCM1480_MC_ADDR_FINE_ADJ(x) _SB_GETVALUE(x,S_BCM1480_MC_ADDR_FINE_ADJ,M_BCM1480_MC_ADDR_FINE_ADJ)
538#define V_BCM1480_MC_ADDR_FINE_ADJ_DEFAULT V_BCM1480_MC_ADDR_FINE_ADJ(0x8)
539
540#define S_BCM1480_MC_DQI_COARSE_ADJ 16
541#define M_BCM1480_MC_DQI_COARSE_ADJ _SB_MAKEMASK(6,S_BCM1480_MC_DQI_COARSE_ADJ)
542#define V_BCM1480_MC_DQI_COARSE_ADJ(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DQI_COARSE_ADJ)
543#define G_BCM1480_MC_DQI_COARSE_ADJ(x) _SB_GETVALUE(x,S_BCM1480_MC_DQI_COARSE_ADJ,M_BCM1480_MC_DQI_COARSE_ADJ)
544#define V_BCM1480_MC_DQI_COARSE_ADJ_DEFAULT V_BCM1480_MC_DQI_COARSE_ADJ(0x0)
545
546#if SIBYTE_HDR_FEATURE(1480, PASS2)
547#define S_BCM1480_MC_DQI_FREQ_RANGE 24
548#define M_BCM1480_MC_DQI_FREQ_RANGE _SB_MAKEMASK(4,S_BCM1480_MC_DQI_FREQ_RANGE)
549#define V_BCM1480_MC_DQI_FREQ_RANGE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DQI_FREQ_RANGE)
550#define G_BCM1480_MC_DQI_FREQ_RANGE(x) _SB_GETVALUE(x,S_BCM1480_MC_DQI_FREQ_RANGE,M_BCM1480_MC_DQI_FREQ_RANGE)
551#define V_BCM1480_MC_DQI_FREQ_RANGE_DEFAULT V_BCM1480_MC_DQI_FREQ_RANGE(0x4)
552#endif
553
554#define S_BCM1480_MC_DQI_FINE_ADJ 24
555#define M_BCM1480_MC_DQI_FINE_ADJ _SB_MAKEMASK(4,S_BCM1480_MC_DQI_FINE_ADJ)
556#define V_BCM1480_MC_DQI_FINE_ADJ(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DQI_FINE_ADJ)
557#define G_BCM1480_MC_DQI_FINE_ADJ(x) _SB_GETVALUE(x,S_BCM1480_MC_DQI_FINE_ADJ,M_BCM1480_MC_DQI_FINE_ADJ)
558#define V_BCM1480_MC_DQI_FINE_ADJ_DEFAULT V_BCM1480_MC_DQI_FINE_ADJ(0x8)
559
560#define S_BCM1480_MC_DQO_COARSE_ADJ 32
561#define M_BCM1480_MC_DQO_COARSE_ADJ _SB_MAKEMASK(6,S_BCM1480_MC_DQO_COARSE_ADJ)
562#define V_BCM1480_MC_DQO_COARSE_ADJ(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DQO_COARSE_ADJ)
563#define G_BCM1480_MC_DQO_COARSE_ADJ(x) _SB_GETVALUE(x,S_BCM1480_MC_DQO_COARSE_ADJ,M_BCM1480_MC_DQO_COARSE_ADJ)
564#define V_BCM1480_MC_DQO_COARSE_ADJ_DEFAULT V_BCM1480_MC_DQO_COARSE_ADJ(0x0)
565
566#if SIBYTE_HDR_FEATURE(1480, PASS2)
567#define S_BCM1480_MC_DQO_FREQ_RANGE 40
568#define M_BCM1480_MC_DQO_FREQ_RANGE _SB_MAKEMASK(4,S_BCM1480_MC_DQO_FREQ_RANGE)
569#define V_BCM1480_MC_DQO_FREQ_RANGE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DQO_FREQ_RANGE)
570#define G_BCM1480_MC_DQO_FREQ_RANGE(x) _SB_GETVALUE(x,S_BCM1480_MC_DQO_FREQ_RANGE,M_BCM1480_MC_DQO_FREQ_RANGE)
571#define V_BCM1480_MC_DQO_FREQ_RANGE_DEFAULT V_BCM1480_MC_DQO_FREQ_RANGE(0x4)
572#endif
573
574#define S_BCM1480_MC_DQO_FINE_ADJ 40
575#define M_BCM1480_MC_DQO_FINE_ADJ _SB_MAKEMASK(4,S_BCM1480_MC_DQO_FINE_ADJ)
576#define V_BCM1480_MC_DQO_FINE_ADJ(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DQO_FINE_ADJ)
577#define G_BCM1480_MC_DQO_FINE_ADJ(x) _SB_GETVALUE(x,S_BCM1480_MC_DQO_FINE_ADJ,M_BCM1480_MC_DQO_FINE_ADJ)
578#define V_BCM1480_MC_DQO_FINE_ADJ_DEFAULT V_BCM1480_MC_DQO_FINE_ADJ(0x8)
579
580#if SIBYTE_HDR_FEATURE(1480, PASS2)
581#define S_BCM1480_MC_DLL_PDSEL 44
582#define M_BCM1480_MC_DLL_PDSEL _SB_MAKEMASK(2,S_BCM1480_MC_DLL_PDSEL)
583#define V_BCM1480_MC_DLL_PDSEL(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_PDSEL)
584#define G_BCM1480_MC_DLL_PDSEL(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_PDSEL,M_BCM1480_MC_DLL_PDSEL)
585#define V_BCM1480_MC_DLL_DEFAULT_PDSEL V_BCM1480_MC_DLL_PDSEL(0x0)
586
587#define M_BCM1480_MC_DLL_REGBYPASS _SB_MAKEMASK1(46)
588#define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47)
589#endif
590
591#define S_BCM1480_MC_DLL_DEFAULT 48
592#define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6,S_BCM1480_MC_DLL_DEFAULT)
593#define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_DEFAULT)
594#define G_BCM1480_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_DEFAULT,M_BCM1480_MC_DLL_DEFAULT)
595#define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10)
596
597#if SIBYTE_HDR_FEATURE(1480, PASS2)
598#define S_BCM1480_MC_DLL_REGCTRL 54
599#define M_BCM1480_MC_DLL_REGCTRL _SB_MAKEMASK(2,S_BCM1480_MC_DLL_REGCTRL)
600#define V_BCM1480_MC_DLL_REGCTRL(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_REGCTRL)
601#define G_BCM1480_MC_DLL_REGCTRL(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_REGCTRL,M_BCM1480_MC_DLL_REGCTRL)
602#define V_BCM1480_MC_DLL_DEFAULT_REGCTRL V_BCM1480_MC_DLL_REGCTRL(0x0)
603#endif
604
605#if SIBYTE_HDR_FEATURE(1480, PASS2)
606#define S_BCM1480_MC_DLL_FREQ_RANGE 56
607#define M_BCM1480_MC_DLL_FREQ_RANGE _SB_MAKEMASK(4,S_BCM1480_MC_DLL_FREQ_RANGE)
608#define V_BCM1480_MC_DLL_FREQ_RANGE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_FREQ_RANGE)
609#define G_BCM1480_MC_DLL_FREQ_RANGE(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_FREQ_RANGE,M_BCM1480_MC_DLL_FREQ_RANGE)
610#define V_BCM1480_MC_DLL_FREQ_RANGE_DEFAULT V_BCM1480_MC_DLL_FREQ_RANGE(0x4)
611#endif
612
613#define S_BCM1480_MC_DLL_STEP_SIZE 56
614#define M_BCM1480_MC_DLL_STEP_SIZE _SB_MAKEMASK(4,S_BCM1480_MC_DLL_STEP_SIZE)
615#define V_BCM1480_MC_DLL_STEP_SIZE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_STEP_SIZE)
616#define G_BCM1480_MC_DLL_STEP_SIZE(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_STEP_SIZE,M_BCM1480_MC_DLL_STEP_SIZE)
617#define V_BCM1480_MC_DLL_STEP_SIZE_DEFAULT V_BCM1480_MC_DLL_STEP_SIZE(0x8)
618
619#if SIBYTE_HDR_FEATURE(1480, PASS2)
620#define S_BCM1480_MC_DLL_BGCTRL 60
621#define M_BCM1480_MC_DLL_BGCTRL _SB_MAKEMASK(2,S_BCM1480_MC_DLL_BGCTRL)
622#define V_BCM1480_MC_DLL_BGCTRL(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_BGCTRL)
623#define G_BCM1480_MC_DLL_BGCTRL(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_BGCTRL,M_BCM1480_MC_DLL_BGCTRL)
624#define V_BCM1480_MC_DLL_DEFAULT_BGCTRL V_BCM1480_MC_DLL_BGCTRL(0x0)
625#endif
626
627#define M_BCM1480_MC_DLL_BYPASS _SB_MAKEMASK1(63)
628
629/*
630 * Memory Drive Configuration Register (Table 94)
631 */
632
633#define S_BCM1480_MC_RTT_BYP_PULLDOWN 0
634#define M_BCM1480_MC_RTT_BYP_PULLDOWN _SB_MAKEMASK(3,S_BCM1480_MC_RTT_BYP_PULLDOWN)
635#define V_BCM1480_MC_RTT_BYP_PULLDOWN(x) _SB_MAKEVALUE(x,S_BCM1480_MC_RTT_BYP_PULLDOWN)
636#define G_BCM1480_MC_RTT_BYP_PULLDOWN(x) _SB_GETVALUE(x,S_BCM1480_MC_RTT_BYP_PULLDOWN,M_BCM1480_MC_RTT_BYP_PULLDOWN)
637
638#define S_BCM1480_MC_RTT_BYP_PULLUP 6
639#define M_BCM1480_MC_RTT_BYP_PULLUP _SB_MAKEMASK(3,S_BCM1480_MC_RTT_BYP_PULLUP)
640#define V_BCM1480_MC_RTT_BYP_PULLUP(x) _SB_MAKEVALUE(x,S_BCM1480_MC_RTT_BYP_PULLUP)
641#define G_BCM1480_MC_RTT_BYP_PULLUP(x) _SB_GETVALUE(x,S_BCM1480_MC_RTT_BYP_PULLUP,M_BCM1480_MC_RTT_BYP_PULLUP)
642
643#define M_BCM1480_MC_RTT_BYPASS _SB_MAKEMASK1(8)
644#define M_BCM1480_MC_RTT_COMP_MOV_AVG _SB_MAKEMASK1(9)
645
646#define S_BCM1480_MC_PVT_BYP_C1_PULLDOWN 10
647#define M_BCM1480_MC_PVT_BYP_C1_PULLDOWN _SB_MAKEMASK(4,S_BCM1480_MC_PVT_BYP_C1_PULLDOWN)
648#define V_BCM1480_MC_PVT_BYP_C1_PULLDOWN(x) _SB_MAKEVALUE(x,S_BCM1480_MC_PVT_BYP_C1_PULLDOWN)
649#define G_BCM1480_MC_PVT_BYP_C1_PULLDOWN(x) _SB_GETVALUE(x,S_BCM1480_MC_PVT_BYP_C1_PULLDOWN,M_BCM1480_MC_PVT_BYP_C1_PULLDOWN)
650
651#define S_BCM1480_MC_PVT_BYP_C1_PULLUP 15
652#define M_BCM1480_MC_PVT_BYP_C1_PULLUP _SB_MAKEMASK(4,S_BCM1480_MC_PVT_BYP_C1_PULLUP)
653#define V_BCM1480_MC_PVT_BYP_C1_PULLUP(x) _SB_MAKEVALUE(x,S_BCM1480_MC_PVT_BYP_C1_PULLUP)
654#define G_BCM1480_MC_PVT_BYP_C1_PULLUP(x) _SB_GETVALUE(x,S_BCM1480_MC_PVT_BYP_C1_PULLUP,M_BCM1480_MC_PVT_BYP_C1_PULLUP)
655
656#define S_BCM1480_MC_PVT_BYP_C2_PULLDOWN 20
657#define M_BCM1480_MC_PVT_BYP_C2_PULLDOWN _SB_MAKEMASK(4,S_BCM1480_MC_PVT_BYP_C2_PULLDOWN)
658#define V_BCM1480_MC_PVT_BYP_C2_PULLDOWN(x) _SB_MAKEVALUE(x,S_BCM1480_MC_PVT_BYP_C2_PULLDOWN)
659#define G_BCM1480_MC_PVT_BYP_C2_PULLDOWN(x) _SB_GETVALUE(x,S_BCM1480_MC_PVT_BYP_C2_PULLDOWN,M_BCM1480_MC_PVT_BYP_C2_PULLDOWN)
660
661#define S_BCM1480_MC_PVT_BYP_C2_PULLUP 25
662#define M_BCM1480_MC_PVT_BYP_C2_PULLUP _SB_MAKEMASK(4,S_BCM1480_MC_PVT_BYP_C2_PULLUP)
663#define V_BCM1480_MC_PVT_BYP_C2_PULLUP(x) _SB_MAKEVALUE(x,S_BCM1480_MC_PVT_BYP_C2_PULLUP)
664#define G_BCM1480_MC_PVT_BYP_C2_PULLUP(x) _SB_GETVALUE(x,S_BCM1480_MC_PVT_BYP_C2_PULLUP,M_BCM1480_MC_PVT_BYP_C2_PULLUP)
665
666#define M_BCM1480_MC_PVT_BYPASS _SB_MAKEMASK1(30)
667#define M_BCM1480_MC_PVT_COMP_MOV_AVG _SB_MAKEMASK1(31)
668
669#define M_BCM1480_MC_CLK_CLASS _SB_MAKEMASK1(34)
670#define M_BCM1480_MC_DATA_CLASS _SB_MAKEMASK1(35)
671#define M_BCM1480_MC_ADDR_CLASS _SB_MAKEMASK1(36)
672
673#define M_BCM1480_MC_DQ_ODT_75 _SB_MAKEMASK1(37)
674#define M_BCM1480_MC_DQ_ODT_150 _SB_MAKEMASK1(38)
675#define M_BCM1480_MC_DQS_ODT_75 _SB_MAKEMASK1(39)
676#define M_BCM1480_MC_DQS_ODT_150 _SB_MAKEMASK1(40)
677#define M_BCM1480_MC_DQS_DIFF _SB_MAKEMASK1(41)
678
679/*
680 * ECC Test Data Register (Table 95)
681 */
682
683#define S_BCM1480_MC_DATA_INVERT 0
684#define M_DATA_ECC_INVERT _SB_MAKEMASK(64,S_BCM1480_MC_ECC_INVERT)
685
686/*
687 * ECC Test ECC Register (Table 96)
688 */
689
690#define S_BCM1480_MC_ECC_INVERT 0
691#define M_BCM1480_MC_ECC_INVERT _SB_MAKEMASK(8,S_BCM1480_MC_ECC_INVERT)
692
693/*
694 * SDRAM Timing Register (Table 97)
695 */
696
697#define S_BCM1480_MC_tRCD 0
698#define M_BCM1480_MC_tRCD _SB_MAKEMASK(4,S_BCM1480_MC_tRCD)
699#define V_BCM1480_MC_tRCD(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tRCD)
700#define G_BCM1480_MC_tRCD(x) _SB_GETVALUE(x,S_BCM1480_MC_tRCD,M_BCM1480_MC_tRCD)
701#define K_BCM1480_MC_tRCD_DEFAULT 3
702#define V_BCM1480_MC_tRCD_DEFAULT V_BCM1480_MC_tRCD(K_BCM1480_MC_tRCD_DEFAULT)
703
704#define S_BCM1480_MC_tCL 4
705#define M_BCM1480_MC_tCL _SB_MAKEMASK(4,S_BCM1480_MC_tCL)
706#define V_BCM1480_MC_tCL(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tCL)
707#define G_BCM1480_MC_tCL(x) _SB_GETVALUE(x,S_BCM1480_MC_tCL,M_BCM1480_MC_tCL)
708#define K_BCM1480_MC_tCL_DEFAULT 2
709#define V_BCM1480_MC_tCL_DEFAULT V_BCM1480_MC_tCL(K_BCM1480_MC_tCL_DEFAULT)
710
711#define M_BCM1480_MC_tCrDh _SB_MAKEMASK1(8)
712
713#define S_BCM1480_MC_tWR 9
714#define M_BCM1480_MC_tWR _SB_MAKEMASK(3,S_BCM1480_MC_tWR)
715#define V_BCM1480_MC_tWR(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tWR)
716#define G_BCM1480_MC_tWR(x) _SB_GETVALUE(x,S_BCM1480_MC_tWR,M_BCM1480_MC_tWR)
717#define K_BCM1480_MC_tWR_DEFAULT 2
718#define V_BCM1480_MC_tWR_DEFAULT V_BCM1480_MC_tWR(K_BCM1480_MC_tWR_DEFAULT)
719
720#define S_BCM1480_MC_tCwD 12
721#define M_BCM1480_MC_tCwD _SB_MAKEMASK(4,S_BCM1480_MC_tCwD)
722#define V_BCM1480_MC_tCwD(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tCwD)
723#define G_BCM1480_MC_tCwD(x) _SB_GETVALUE(x,S_BCM1480_MC_tCwD,M_BCM1480_MC_tCwD)
724#define K_BCM1480_MC_tCwD_DEFAULT 1
725#define V_BCM1480_MC_tCwD_DEFAULT V_BCM1480_MC_tCwD(K_BCM1480_MC_tCwD_DEFAULT)
726
727#define S_BCM1480_MC_tRP 16
728#define M_BCM1480_MC_tRP _SB_MAKEMASK(4,S_BCM1480_MC_tRP)
729#define V_BCM1480_MC_tRP(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tRP)
730#define G_BCM1480_MC_tRP(x) _SB_GETVALUE(x,S_BCM1480_MC_tRP,M_BCM1480_MC_tRP)
731#define K_BCM1480_MC_tRP_DEFAULT 4
732#define V_BCM1480_MC_tRP_DEFAULT V_BCM1480_MC_tRP(K_BCM1480_MC_tRP_DEFAULT)
733
734#define S_BCM1480_MC_tRRD 20
735#define M_BCM1480_MC_tRRD _SB_MAKEMASK(4,S_BCM1480_MC_tRRD)
736#define V_BCM1480_MC_tRRD(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tRRD)
737#define G_BCM1480_MC_tRRD(x) _SB_GETVALUE(x,S_BCM1480_MC_tRRD,M_BCM1480_MC_tRRD)
738#define K_BCM1480_MC_tRRD_DEFAULT 2
739#define V_BCM1480_MC_tRRD_DEFAULT V_BCM1480_MC_tRRD(K_BCM1480_MC_tRRD_DEFAULT)
740
741#define S_BCM1480_MC_tRCw 24
742#define M_BCM1480_MC_tRCw _SB_MAKEMASK(5,S_BCM1480_MC_tRCw)
743#define V_BCM1480_MC_tRCw(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tRCw)
744#define G_BCM1480_MC_tRCw(x) _SB_GETVALUE(x,S_BCM1480_MC_tRCw,M_BCM1480_MC_tRCw)
745#define K_BCM1480_MC_tRCw_DEFAULT 10
746#define V_BCM1480_MC_tRCw_DEFAULT V_BCM1480_MC_tRCw(K_BCM1480_MC_tRCw_DEFAULT)
747
748#define S_BCM1480_MC_tRCr 32
749#define M_BCM1480_MC_tRCr _SB_MAKEMASK(5,S_BCM1480_MC_tRCr)
750#define V_BCM1480_MC_tRCr(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tRCr)
751#define G_BCM1480_MC_tRCr(x) _SB_GETVALUE(x,S_BCM1480_MC_tRCr,M_BCM1480_MC_tRCr)
752#define K_BCM1480_MC_tRCr_DEFAULT 9
753#define V_BCM1480_MC_tRCr_DEFAULT V_BCM1480_MC_tRCr(K_BCM1480_MC_tRCr_DEFAULT)
754
755#if SIBYTE_HDR_FEATURE(1480, PASS2)
756#define S_BCM1480_MC_tFAW 40
757#define M_BCM1480_MC_tFAW _SB_MAKEMASK(6,S_BCM1480_MC_tFAW)
758#define V_BCM1480_MC_tFAW(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tFAW)
759#define G_BCM1480_MC_tFAW(x) _SB_GETVALUE(x,S_BCM1480_MC_tFAW,M_BCM1480_MC_tFAW)
760#define K_BCM1480_MC_tFAW_DEFAULT 0
761#define V_BCM1480_MC_tFAW_DEFAULT V_BCM1480_MC_tFAW(K_BCM1480_MC_tFAW_DEFAULT)
762#endif
763
764#define S_BCM1480_MC_tRFC 48
765#define M_BCM1480_MC_tRFC _SB_MAKEMASK(7,S_BCM1480_MC_tRFC)
766#define V_BCM1480_MC_tRFC(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tRFC)
767#define G_BCM1480_MC_tRFC(x) _SB_GETVALUE(x,S_BCM1480_MC_tRFC,M_BCM1480_MC_tRFC)
768#define K_BCM1480_MC_tRFC_DEFAULT 12
769#define V_BCM1480_MC_tRFC_DEFAULT V_BCM1480_MC_tRFC(K_BCM1480_MC_tRFC_DEFAULT)
770
771#define S_BCM1480_MC_tFIFO 56
772#define M_BCM1480_MC_tFIFO _SB_MAKEMASK(2,S_BCM1480_MC_tFIFO)
773#define V_BCM1480_MC_tFIFO(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tFIFO)
774#define G_BCM1480_MC_tFIFO(x) _SB_GETVALUE(x,S_BCM1480_MC_tFIFO,M_BCM1480_MC_tFIFO)
775#define K_BCM1480_MC_tFIFO_DEFAULT 0
776#define V_BCM1480_MC_tFIFO_DEFAULT V_BCM1480_MC_tFIFO(K_BCM1480_MC_tFIFO_DEFAULT)
777
778#define S_BCM1480_MC_tW2R 58
779#define M_BCM1480_MC_tW2R _SB_MAKEMASK(2,S_BCM1480_MC_tW2R)
780#define V_BCM1480_MC_tW2R(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tW2R)
781#define G_BCM1480_MC_tW2R(x) _SB_GETVALUE(x,S_BCM1480_MC_tW2R,M_BCM1480_MC_tW2R)
782#define K_BCM1480_MC_tW2R_DEFAULT 1
783#define V_BCM1480_MC_tW2R_DEFAULT V_BCM1480_MC_tW2R(K_BCM1480_MC_tW2R_DEFAULT)
784
785#define S_BCM1480_MC_tR2W 60
786#define M_BCM1480_MC_tR2W _SB_MAKEMASK(2,S_BCM1480_MC_tR2W)
787#define V_BCM1480_MC_tR2W(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tR2W)
788#define G_BCM1480_MC_tR2W(x) _SB_GETVALUE(x,S_BCM1480_MC_tR2W,M_BCM1480_MC_tR2W)
789#define K_BCM1480_MC_tR2W_DEFAULT 0
790#define V_BCM1480_MC_tR2W_DEFAULT V_BCM1480_MC_tR2W(K_BCM1480_MC_tR2W_DEFAULT)
791
792#define M_BCM1480_MC_tR2R _SB_MAKEMASK1(62)
793
794#define V_BCM1480_MC_TIMING_DEFAULT (M_BCM1480_MC_tR2R | \
795 V_BCM1480_MC_tFIFO_DEFAULT | \
796 V_BCM1480_MC_tR2W_DEFAULT | \
797 V_BCM1480_MC_tW2R_DEFAULT | \
798 V_BCM1480_MC_tRFC_DEFAULT | \
799 V_BCM1480_MC_tRCr_DEFAULT | \
800 V_BCM1480_MC_tRCw_DEFAULT | \
801 V_BCM1480_MC_tRRD_DEFAULT | \
802 V_BCM1480_MC_tRP_DEFAULT | \
803 V_BCM1480_MC_tCwD_DEFAULT | \
804 V_BCM1480_MC_tWR_DEFAULT | \
805 M_BCM1480_MC_tCrDh | \
806 V_BCM1480_MC_tCL_DEFAULT | \
807 V_BCM1480_MC_tRCD_DEFAULT)
808
809/*
810 * SDRAM Timing Register 2
811 */
812
813#if SIBYTE_HDR_FEATURE(1480, PASS2)
814
815#define S_BCM1480_MC_tAL 0
816#define M_BCM1480_MC_tAL _SB_MAKEMASK(4,S_BCM1480_MC_tAL)
817#define V_BCM1480_MC_tAL(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tAL)
818#define G_BCM1480_MC_tAL(x) _SB_GETVALUE(x,S_BCM1480_MC_tAL,M_BCM1480_MC_tAL)
819#define K_BCM1480_MC_tAL_DEFAULT 0
820#define V_BCM1480_MC_tAL_DEFAULT V_BCM1480_MC_tAL(K_BCM1480_MC_tAL_DEFAULT)
821
822#define S_BCM1480_MC_tRTP 4
823#define M_BCM1480_MC_tRTP _SB_MAKEMASK(3,S_BCM1480_MC_tRTP)
824#define V_BCM1480_MC_tRTP(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tRTP)
825#define G_BCM1480_MC_tRTP(x) _SB_GETVALUE(x,S_BCM1480_MC_tRTP,M_BCM1480_MC_tRTP)
826#define K_BCM1480_MC_tRTP_DEFAULT 2
827#define V_BCM1480_MC_tRTP_DEFAULT V_BCM1480_MC_tRTP(K_BCM1480_MC_tRTP_DEFAULT)
828
829#define S_BCM1480_MC_tW2W 8
830#define M_BCM1480_MC_tW2W _SB_MAKEMASK(2,S_BCM1480_MC_tW2W)
831#define V_BCM1480_MC_tW2W(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tW2W)
832#define G_BCM1480_MC_tW2W(x) _SB_GETVALUE(x,S_BCM1480_MC_tW2W,M_BCM1480_MC_tW2W)
833#define K_BCM1480_MC_tW2W_DEFAULT 0
834#define V_BCM1480_MC_tW2W_DEFAULT V_BCM1480_MC_tW2W(K_BCM1480_MC_tW2W_DEFAULT)
835
836#define S_BCM1480_MC_tRAP 12
837#define M_BCM1480_MC_tRAP _SB_MAKEMASK(4,S_BCM1480_MC_tRAP)
838#define V_BCM1480_MC_tRAP(x) _SB_MAKEVALUE(x,S_BCM1480_MC_tRAP)
839#define G_BCM1480_MC_tRAP(x) _SB_GETVALUE(x,S_BCM1480_MC_tRAP,M_BCM1480_MC_tRAP)
840#define K_BCM1480_MC_tRAP_DEFAULT 0
841#define V_BCM1480_MC_tRAP_DEFAULT V_BCM1480_MC_tRAP(K_BCM1480_MC_tRAP_DEFAULT)
842
843#endif
844
845
846
847/*
848 * Global Registers: single instances per BCM1480
849 */
850
851/*
852 * Global Configuration Register (Table 99)
853 */
854
855#define S_BCM1480_MC_BLK_SET_MARK 8
856#define M_BCM1480_MC_BLK_SET_MARK _SB_MAKEMASK(4,S_BCM1480_MC_BLK_SET_MARK)
857#define V_BCM1480_MC_BLK_SET_MARK(x) _SB_MAKEVALUE(x,S_BCM1480_MC_BLK_SET_MARK)
858#define G_BCM1480_MC_BLK_SET_MARK(x) _SB_GETVALUE(x,S_BCM1480_MC_BLK_SET_MARK,M_BCM1480_MC_BLK_SET_MARK)
859
860#define S_BCM1480_MC_BLK_CLR_MARK 12
861#define M_BCM1480_MC_BLK_CLR_MARK _SB_MAKEMASK(4,S_BCM1480_MC_BLK_CLR_MARK)
862#define V_BCM1480_MC_BLK_CLR_MARK(x) _SB_MAKEVALUE(x,S_BCM1480_MC_BLK_CLR_MARK)
863#define G_BCM1480_MC_BLK_CLR_MARK(x) _SB_GETVALUE(x,S_BCM1480_MC_BLK_CLR_MARK,M_BCM1480_MC_BLK_CLR_MARK)
864
865#define M_BCM1480_MC_PKT_PRIORITY _SB_MAKEMASK1(16)
866
867#define S_BCM1480_MC_MAX_AGE 20
868#define M_BCM1480_MC_MAX_AGE _SB_MAKEMASK(4,S_BCM1480_MC_MAX_AGE)
869#define V_BCM1480_MC_MAX_AGE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_MAX_AGE)
870#define G_BCM1480_MC_MAX_AGE(x) _SB_GETVALUE(x,S_BCM1480_MC_MAX_AGE,M_BCM1480_MC_MAX_AGE)
871
872#define M_BCM1480_MC_BERR_DISABLE _SB_MAKEMASK1(29)
873#define M_BCM1480_MC_FORCE_SEQ _SB_MAKEMASK1(30)
874#define M_BCM1480_MC_VGEN _SB_MAKEMASK1(32)
875
876#define S_BCM1480_MC_SLEW 33
877#define M_BCM1480_MC_SLEW _SB_MAKEMASK(2,S_BCM1480_MC_SLEW)
878#define V_BCM1480_MC_SLEW(x) _SB_MAKEVALUE(x,S_BCM1480_MC_SLEW)
879#define G_BCM1480_MC_SLEW(x) _SB_GETVALUE(x,S_BCM1480_MC_SLEW,M_BCM1480_MC_SLEW)
880
881#define M_BCM1480_MC_SSTL_VOLTAGE _SB_MAKEMASK1(35)
882
883/*
884 * Global Channel Interleave Register (Table 100)
885 */
886
887#define S_BCM1480_MC_INTLV0 0
888#define M_BCM1480_MC_INTLV0 _SB_MAKEMASK(6,S_BCM1480_MC_INTLV0)
889#define V_BCM1480_MC_INTLV0(x) _SB_MAKEVALUE(x,S_BCM1480_MC_INTLV0)
890#define G_BCM1480_MC_INTLV0(x) _SB_GETVALUE(x,S_BCM1480_MC_INTLV0,M_BCM1480_MC_INTLV0)
891
892#define S_BCM1480_MC_INTLV1 8
893#define M_BCM1480_MC_INTLV1 _SB_MAKEMASK(6,S_BCM1480_MC_INTLV1)
894#define V_BCM1480_MC_INTLV1(x) _SB_MAKEVALUE(x,S_BCM1480_MC_INTLV1)
895#define G_BCM1480_MC_INTLV1(x) _SB_GETVALUE(x,S_BCM1480_MC_INTLV1,M_BCM1480_MC_INTLV1)
896
897#define S_BCM1480_MC_INTLV_MODE 16
898#define M_BCM1480_MC_INTLV_MODE _SB_MAKEMASK(3,S_BCM1480_MC_INTLV_MODE)
899#define V_BCM1480_MC_INTLV_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_MC_INTLV_MODE)
900#define G_BCM1480_MC_INTLV_MODE(x) _SB_GETVALUE(x,S_BCM1480_MC_INTLV_MODE,M_BCM1480_MC_INTLV_MODE)
901
902#define K_BCM1480_MC_INTLV_MODE_NONE 0x0
903#define K_BCM1480_MC_INTLV_MODE_01 0x1
904#define K_BCM1480_MC_INTLV_MODE_23 0x2
905#define K_BCM1480_MC_INTLV_MODE_01_23 0x3
906#define K_BCM1480_MC_INTLV_MODE_0123 0x4
907
908#define V_BCM1480_MC_INTLV_MODE_NONE V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_NONE)
909#define V_BCM1480_MC_INTLV_MODE_01 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_01)
910#define V_BCM1480_MC_INTLV_MODE_23 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_23)
911#define V_BCM1480_MC_INTLV_MODE_01_23 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_01_23)
912#define V_BCM1480_MC_INTLV_MODE_0123 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_0123)
913
914/*
915 * ECC Status Register
916 */
917
918#define S_BCM1480_MC_ECC_ERR_ADDR 0
919#define M_BCM1480_MC_ECC_ERR_ADDR _SB_MAKEMASK(37,S_BCM1480_MC_ECC_ERR_ADDR)
920#define V_BCM1480_MC_ECC_ERR_ADDR(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ECC_ERR_ADDR)
921#define G_BCM1480_MC_ECC_ERR_ADDR(x) _SB_GETVALUE(x,S_BCM1480_MC_ECC_ERR_ADDR,M_BCM1480_MC_ECC_ERR_ADDR)
922
923#if SIBYTE_HDR_FEATURE(1480, PASS2)
924#define M_BCM1480_MC_ECC_ERR_RMW _SB_MAKEMASK1(60)
925#endif
926
927#define M_BCM1480_MC_ECC_MULT_ERR_DET _SB_MAKEMASK1(61)
928#define M_BCM1480_MC_ECC_UERR_DET _SB_MAKEMASK1(62)
929#define M_BCM1480_MC_ECC_CERR_DET _SB_MAKEMASK1(63)
930
931/*
932 * Global ECC Address Register (Table 102)
933 */
934
935#define S_BCM1480_MC_ECC_CORR_ADDR 0
936#define M_BCM1480_MC_ECC_CORR_ADDR _SB_MAKEMASK(37,S_BCM1480_MC_ECC_CORR_ADDR)
937#define V_BCM1480_MC_ECC_CORR_ADDR(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ECC_CORR_ADDR)
938#define G_BCM1480_MC_ECC_CORR_ADDR(x) _SB_GETVALUE(x,S_BCM1480_MC_ECC_CORR_ADDR,M_BCM1480_MC_ECC_CORR_ADDR)
939
940/*
941 * Global ECC Correction Register (Table 103)
942 */
943
944#define S_BCM1480_MC_ECC_CORRECT 0
945#define M_BCM1480_MC_ECC_CORRECT _SB_MAKEMASK(64,S_BCM1480_MC_ECC_CORRECT)
946#define V_BCM1480_MC_ECC_CORRECT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ECC_CORRECT)
947#define G_BCM1480_MC_ECC_CORRECT(x) _SB_GETVALUE(x,S_BCM1480_MC_ECC_CORRECT,M_BCM1480_MC_ECC_CORRECT)
948
949/*
950 * Global ECC Performance Counters Control Register (Table 104)
951 */
952
953#define S_BCM1480_MC_CHANNEL_SELECT 0
954#define M_BCM1480_MC_CHANNEL_SELECT _SB_MAKEMASK(4,S_BCM1480_MC_CHANNEL_SELECT)
955#define V_BCM1480_MC_CHANNEL_SELECT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CHANNEL_SELECT)
956#define G_BCM1480_MC_CHANNEL_SELECT(x) _SB_GETVALUE(x,S_BCM1480_MC_CHANNEL_SELECT,M_BCM1480_MC_CHANNEL_SELECT)
957#define K_BCM1480_MC_CHANNEL_SELECT_0 0x1
958#define K_BCM1480_MC_CHANNEL_SELECT_1 0x2
959#define K_BCM1480_MC_CHANNEL_SELECT_2 0x4
960#define K_BCM1480_MC_CHANNEL_SELECT_3 0x8
961
962#endif /* _BCM1480_MC_H */
diff --git a/include/asm-mips/sibyte/bcm1480_regs.h b/include/asm-mips/sibyte/bcm1480_regs.h
new file mode 100644
index 000000000000..c2dd2fe3047c
--- /dev/null
+++ b/include/asm-mips/sibyte/bcm1480_regs.h
@@ -0,0 +1,869 @@
1/* *********************************************************************
2 * BCM1255/BCM1280/BCM1455/BCM1480 Board Support Package
3 *
4 * Register Definitions File: bcm1480_regs.h
5 *
6 * This module contains the addresses of the on-chip peripherals
7 * on the BCM1280 and BCM1480.
8 *
9 * BCM1480 specification level: 1X55_1X80-UM100-D4 (11/24/03)
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32#ifndef _BCM1480_REGS_H
33#define _BCM1480_REGS_H
34
35#include "sb1250_defs.h"
36
37/* *********************************************************************
38 * Pull in the BCM1250's registers since a great deal of the 1480's
39 * functions are the same as the BCM1250.
40 ********************************************************************* */
41
42#include "sb1250_regs.h"
43
44
45/* *********************************************************************
46 * Some general notes:
47 *
48 * Register addresses are grouped by function and follow the order
49 * of the User Manual.
50 *
51 * For the most part, when there is more than one peripheral
52 * of the same type on the SOC, the constants below will be
53 * offsets from the base of each peripheral. For example,
54 * the MAC registers are described as offsets from the first
55 * MAC register, and there will be a MAC_REGISTER() macro
56 * to calculate the base address of a given MAC.
57 *
58 * The information in this file is based on the BCM1X55/BCM1X80
59 * User Manual, Document 1X55_1X80-UM100-R, 22/12/03.
60 *
61 * This file is basically a "what's new" header file. Since the
62 * BCM1250 and the new BCM1480 (and derivatives) share many common
63 * features, this file contains only what's new or changed from
64 * the 1250. (above, you can see that we include the 1250 symbols
65 * to get the base functionality).
66 *
67 * In software, be sure to use the correct symbols, particularly
68 * for blocks that are different between the two chip families.
69 * All BCM1480-specific symbols have _BCM1480_ in their names,
70 * and all BCM1250-specific and "base" functions that are common in
71 * both chips have no special names (this is for compatibility with
72 * older include files). Therefore, if you're working with the
73 * SCD, which is very different on each chip, A_SCD_xxx implies
74 * the BCM1250 version and A_BCM1480_SCD_xxx implies the BCM1480
75 * version.
76 ********************************************************************* */
77
78
79/* *********************************************************************
80 * Memory Controller Registers (Section 6)
81 ********************************************************************* */
82
83#define A_BCM1480_MC_BASE_0 0x0010050000
84#define A_BCM1480_MC_BASE_1 0x0010051000
85#define A_BCM1480_MC_BASE_2 0x0010052000
86#define A_BCM1480_MC_BASE_3 0x0010053000
87#define BCM1480_MC_REGISTER_SPACING 0x1000
88
89#define A_BCM1480_MC_BASE(ctlid) (A_BCM1480_MC_BASE_0+(ctlid)*BCM1480_MC_REGISTER_SPACING)
90#define A_BCM1480_MC_REGISTER(ctlid,reg) (A_BCM1480_MC_BASE(ctlid)+(reg))
91
92#define R_BCM1480_MC_CONFIG 0x0000000100
93#define R_BCM1480_MC_CS_START 0x0000000120
94#define R_BCM1480_MC_CS_END 0x0000000140
95#define S_BCM1480_MC_CS_STARTEND 24
96
97#define R_BCM1480_MC_CS01_ROW0 0x0000000180
98#define R_BCM1480_MC_CS01_ROW1 0x00000001A0
99#define R_BCM1480_MC_CS23_ROW0 0x0000000200
100#define R_BCM1480_MC_CS23_ROW1 0x0000000220
101#define R_BCM1480_MC_CS01_COL0 0x0000000280
102#define R_BCM1480_MC_CS01_COL1 0x00000002A0
103#define R_BCM1480_MC_CS23_COL0 0x0000000300
104#define R_BCM1480_MC_CS23_COL1 0x0000000320
105
106#define R_BCM1480_MC_CSX_BASE 0x0000000180
107#define R_BCM1480_MC_CSX_ROW0 0x0000000000 /* relative to CSX_BASE */
108#define R_BCM1480_MC_CSX_ROW1 0x0000000020 /* relative to CSX_BASE */
109#define R_BCM1480_MC_CSX_COL0 0x0000000100 /* relative to CSX_BASE */
110#define R_BCM1480_MC_CSX_COL1 0x0000000120 /* relative to CSX_BASE */
111#define BCM1480_MC_CSX_SPACING 0x0000000080 /* CS23 relative to CS01 */
112
113#define R_BCM1480_MC_CS01_BA 0x0000000380
114#define R_BCM1480_MC_CS23_BA 0x00000003A0
115#define R_BCM1480_MC_DRAMCMD 0x0000000400
116#define R_BCM1480_MC_DRAMMODE 0x0000000420
117#define R_BCM1480_MC_CLOCK_CFG 0x0000000440
118#define R_BCM1480_MC_MCLK_CFG R_BCM1480_MC_CLOCK_CFG
119#define R_BCM1480_MC_TEST_DATA 0x0000000480
120#define R_BCM1480_MC_TEST_ECC 0x00000004A0
121#define R_BCM1480_MC_TIMING1 0x00000004C0
122#define R_BCM1480_MC_TIMING2 0x00000004E0
123#define R_BCM1480_MC_DLL_CFG 0x0000000500
124#define R_BCM1480_MC_DRIVE_CFG 0x0000000520
125
126#if SIBYTE_HDR_FEATURE(1480, PASS2)
127#define R_BCM1480_MC_ODT 0x0000000460
128#define R_BCM1480_MC_ECC_STATUS 0x0000000540
129#endif
130
131/* Global registers (single instance) */
132#define A_BCM1480_MC_GLB_CONFIG 0x0010054100
133#define A_BCM1480_MC_GLB_INTLV 0x0010054120
134#define A_BCM1480_MC_GLB_ECC_STATUS 0x0010054140
135#define A_BCM1480_MC_GLB_ECC_ADDR 0x0010054160
136#define A_BCM1480_MC_GLB_ECC_CORRECT 0x0010054180
137#define A_BCM1480_MC_GLB_PERF_CNT_CONTROL 0x00100541A0
138
139/* *********************************************************************
140 * L2 Cache Control Registers (Section 5)
141 ********************************************************************* */
142
143#define A_BCM1480_L2_BASE 0x0010040000
144
145#define A_BCM1480_L2_READ_TAG 0x0010040018
146#define A_BCM1480_L2_ECC_TAG 0x0010040038
147#define A_BCM1480_L2_MISC0_VALUE 0x0010040058
148#define A_BCM1480_L2_MISC1_VALUE 0x0010040078
149#define A_BCM1480_L2_MISC2_VALUE 0x0010040098
150#define A_BCM1480_L2_MISC_CONFIG 0x0010040040 /* x040 */
151#define A_BCM1480_L2_CACHE_DISABLE 0x0010040060 /* x060 */
152#define A_BCM1480_L2_MAKECACHEDISABLE(x) (A_BCM1480_L2_CACHE_DISABLE | (((x)&0xF) << 12))
153#define A_BCM1480_L2_WAY_ENABLE_3_0 0x0010040080 /* x080 */
154#define A_BCM1480_L2_WAY_ENABLE_7_4 0x00100400A0 /* x0A0 */
155#define A_BCM1480_L2_MAKE_WAY_ENABLE_LO(x) (A_BCM1480_L2_WAY_ENABLE_3_0 | (((x)&0xF) << 12))
156#define A_BCM1480_L2_MAKE_WAY_ENABLE_HI(x) (A_BCM1480_L2_WAY_ENABLE_7_4 | (((x)&0xF) << 12))
157#define A_BCM1480_L2_MAKE_WAY_DISABLE_LO(x) (A_BCM1480_L2_WAY_ENABLE_3_0 | (((~x)&0xF) << 12))
158#define A_BCM1480_L2_MAKE_WAY_DISABLE_HI(x) (A_BCM1480_L2_WAY_ENABLE_7_4 | (((~x)&0xF) << 12))
159#define A_BCM1480_L2_WAY_LOCAL_3_0 0x0010040100 /* x100 */
160#define A_BCM1480_L2_WAY_LOCAL_7_4 0x0010040120 /* x120 */
161#define A_BCM1480_L2_WAY_REMOTE_3_0 0x0010040140 /* x140 */
162#define A_BCM1480_L2_WAY_REMOTE_7_4 0x0010040160 /* x160 */
163#define A_BCM1480_L2_WAY_AGENT_3_0 0x00100400C0 /* xxC0 */
164#define A_BCM1480_L2_WAY_AGENT_7_4 0x00100400E0 /* xxE0 */
165#define A_BCM1480_L2_WAY_ENABLE(A, banks) (A | (((~(banks))&0x0F) << 8))
166#define A_BCM1480_L2_BANK_BASE 0x00D0300000
167#define A_BCM1480_L2_BANK_ADDRESS(b) (A_BCM1480_L2_BANK_BASE | (((b)&0x7)<<17))
168#define A_BCM1480_L2_MGMT_TAG_BASE 0x00D0000000
169
170
171/* *********************************************************************
172 * PCI-X Interface Registers (Section 7)
173 ********************************************************************* */
174
175#define A_BCM1480_PCI_BASE 0x0010061400
176
177#define A_BCM1480_PCI_RESET 0x0010061400
178#define A_BCM1480_PCI_DLL 0x0010061500
179
180#define A_BCM1480_PCI_TYPE00_HEADER 0x002E000000
181
182/* *********************************************************************
183 * Ethernet MAC Registers (Section 11) and DMA Registers (Section 10.6)
184 ********************************************************************* */
185
186/* No register changes with Rev.C BCM1250, but one additional MAC */
187
188#define A_BCM1480_MAC_BASE_2 0x0010066000
189
190#ifndef A_MAC_BASE_2
191#define A_MAC_BASE_2 A_BCM1480_MAC_BASE_2
192#endif
193
194#define A_BCM1480_MAC_BASE_3 0x0010067000
195#define A_MAC_BASE_3 A_BCM1480_MAC_BASE_3
196
197#define R_BCM1480_MAC_DMA_OODPKTLOST 0x00000038
198
199#ifndef R_MAC_DMA_OODPKTLOST
200#define R_MAC_DMA_OODPKTLOST R_BCM1480_MAC_DMA_OODPKTLOST
201#endif
202
203
204/* *********************************************************************
205 * DUART Registers (Section 14)
206 ********************************************************************* */
207
208/* No significant differences from BCM1250, two DUARTs */
209
210/* Conventions, per user manual:
211 * DUART generic, channels A,B,C,D
212 * DUART0 implementing channels A,B
213 * DUART1 inplementing channels C,D
214 */
215
216#define BCM1480_DUART_NUM_PORTS 4
217
218#define A_BCM1480_DUART0 0x0010060000
219#define A_BCM1480_DUART1 0x0010060400
220#define A_BCM1480_DUART(chan) ((((chan)&2) == 0)? A_BCM1480_DUART0 : A_BCM1480_DUART1)
221
222#define BCM1480_DUART_CHANREG_SPACING 0x100
223#define A_BCM1480_DUART_CHANREG(chan,reg) (A_BCM1480_DUART(chan) \
224 + BCM1480_DUART_CHANREG_SPACING*((chan)&1) \
225 + (reg))
226#define R_BCM1480_DUART_CHANREG(chan,reg) (BCM1480_DUART_CHANREG_SPACING*((chan)&1) + (reg))
227
228#define R_BCM1480_DUART_IMRREG(chan) (R_DUART_IMR_A + ((chan)&1)*DUART_IMRISR_SPACING)
229#define R_BCM1480_DUART_ISRREG(chan) (R_DUART_ISR_A + ((chan)&1)*DUART_IMRISR_SPACING)
230
231#define A_BCM1480_DUART_IMRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_IMRREG(chan))
232#define A_BCM1480_DUART_ISRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_ISRREG(chan))
233
234/*
235 * These constants are the absolute addresses.
236 */
237
238#define A_BCM1480_DUART_MODE_REG_1_C 0x0010060400
239#define A_BCM1480_DUART_MODE_REG_2_C 0x0010060410
240#define A_BCM1480_DUART_STATUS_C 0x0010060420
241#define A_BCM1480_DUART_CLK_SEL_C 0x0010060430
242#define A_BCM1480_DUART_FULL_CTL_C 0x0010060440
243#define A_BCM1480_DUART_CMD_C 0x0010060450
244#define A_BCM1480_DUART_RX_HOLD_C 0x0010060460
245#define A_BCM1480_DUART_TX_HOLD_C 0x0010060470
246#define A_BCM1480_DUART_OPCR_C 0x0010060480
247#define A_BCM1480_DUART_AUX_CTRL_C 0x0010060490
248
249#define A_BCM1480_DUART_MODE_REG_1_D 0x0010060500
250#define A_BCM1480_DUART_MODE_REG_2_D 0x0010060510
251#define A_BCM1480_DUART_STATUS_D 0x0010060520
252#define A_BCM1480_DUART_CLK_SEL_D 0x0010060530
253#define A_BCM1480_DUART_FULL_CTL_D 0x0010060540
254#define A_BCM1480_DUART_CMD_D 0x0010060550
255#define A_BCM1480_DUART_RX_HOLD_D 0x0010060560
256#define A_BCM1480_DUART_TX_HOLD_D 0x0010060570
257#define A_BCM1480_DUART_OPCR_D 0x0010060580
258#define A_BCM1480_DUART_AUX_CTRL_D 0x0010060590
259
260#define A_BCM1480_DUART_INPORT_CHNG_CD 0x0010060600
261#define A_BCM1480_DUART_AUX_CTRL_CD 0x0010060610
262#define A_BCM1480_DUART_ISR_C 0x0010060620
263#define A_BCM1480_DUART_IMR_C 0x0010060630
264#define A_BCM1480_DUART_ISR_D 0x0010060640
265#define A_BCM1480_DUART_IMR_D 0x0010060650
266#define A_BCM1480_DUART_OUT_PORT_CD 0x0010060660
267#define A_BCM1480_DUART_OPCR_CD 0x0010060670
268#define A_BCM1480_DUART_IN_PORT_CD 0x0010060680
269#define A_BCM1480_DUART_ISR_CD 0x0010060690
270#define A_BCM1480_DUART_IMR_CD 0x00100606A0
271#define A_BCM1480_DUART_SET_OPR_CD 0x00100606B0
272#define A_BCM1480_DUART_CLEAR_OPR_CD 0x00100606C0
273#define A_BCM1480_DUART_INPORT_CHNG_C 0x00100606D0
274#define A_BCM1480_DUART_INPORT_CHNG_D 0x00100606E0
275
276
277/* *********************************************************************
278 * Generic Bus Registers (Section 15) and PCMCIA Registers (Section 16)
279 ********************************************************************* */
280
281#define A_BCM1480_IO_PCMCIA_CFG_B 0x0010061A58
282#define A_BCM1480_IO_PCMCIA_STATUS_B 0x0010061A68
283
284/* *********************************************************************
285 * GPIO Registers (Section 17)
286 ********************************************************************* */
287
288/* One additional GPIO register, placed _before_ the BCM1250's GPIO block base */
289
290#define A_BCM1480_GPIO_INT_ADD_TYPE 0x0010061A78
291#define R_BCM1480_GPIO_INT_ADD_TYPE (-8)
292
293#define A_GPIO_INT_ADD_TYPE A_BCM1480_GPIO_INT_ADD_TYPE
294#define R_GPIO_INT_ADD_TYPE R_BCM1480_GPIO_INT_ADD_TYPE
295
296/* *********************************************************************
297 * SMBus Registers (Section 18)
298 ********************************************************************* */
299
300/* No changes from BCM1250 */
301
302/* *********************************************************************
303 * Timer Registers (Sections 4.6)
304 ********************************************************************* */
305
306/* BCM1480 has two additional watchdogs */
307
308/* Watchdog timers */
309
310#define A_BCM1480_SCD_WDOG_2 0x0010022050
311#define A_BCM1480_SCD_WDOG_3 0x0010022150
312
313#define BCM1480_SCD_NUM_WDOGS 4
314
315#define A_BCM1480_SCD_WDOG_BASE(w) (A_BCM1480_SCD_WDOG_0+((w)&2)*0x1000 + ((w)&1)*0x100)
316#define A_BCM1480_SCD_WDOG_REGISTER(w,r) (A_BCM1480_SCD_WDOG_BASE(w) + (r))
317
318#define A_BCM1480_SCD_WDOG_INIT_2 0x0010022050
319#define A_BCM1480_SCD_WDOG_CNT_2 0x0010022058
320#define A_BCM1480_SCD_WDOG_CFG_2 0x0010022060
321
322#define A_BCM1480_SCD_WDOG_INIT_3 0x0010022150
323#define A_BCM1480_SCD_WDOG_CNT_3 0x0010022158
324#define A_BCM1480_SCD_WDOG_CFG_3 0x0010022160
325
326/* BCM1480 has two additional compare registers */
327
328#define A_BCM1480_SCD_ZBBUS_CYCLE_COUNT A_SCD_ZBBUS_CYCLE_COUNT
329#define A_BCM1480_SCD_ZBBUS_CYCLE_CP_BASE 0x0010020C00
330#define A_BCM1480_SCD_ZBBUS_CYCLE_CP0 A_SCD_ZBBUS_CYCLE_CP0
331#define A_BCM1480_SCD_ZBBUS_CYCLE_CP1 A_SCD_ZBBUS_CYCLE_CP1
332#define A_BCM1480_SCD_ZBBUS_CYCLE_CP2 0x0010020C10
333#define A_BCM1480_SCD_ZBBUS_CYCLE_CP3 0x0010020C18
334
335/* *********************************************************************
336 * System Control Registers (Section 4.2)
337 ********************************************************************* */
338
339/* Scratch register in different place */
340
341#define A_BCM1480_SCD_SCRATCH 0x100200A0
342
343/* *********************************************************************
344 * System Address Trap Registers (Section 4.9)
345 ********************************************************************* */
346
347/* No changes from BCM1250 */
348
349/* *********************************************************************
350 * System Interrupt Mapper Registers (Sections 4.3-4.5)
351 ********************************************************************* */
352
353#define A_BCM1480_IMR_CPU0_BASE 0x0010020000
354#define A_BCM1480_IMR_CPU1_BASE 0x0010022000
355#define A_BCM1480_IMR_CPU2_BASE 0x0010024000
356#define A_BCM1480_IMR_CPU3_BASE 0x0010026000
357#define BCM1480_IMR_REGISTER_SPACING 0x2000
358#define BCM1480_IMR_REGISTER_SPACING_SHIFT 13
359
360#define A_BCM1480_IMR_MAPPER(cpu) (A_BCM1480_IMR_CPU0_BASE+(cpu)*BCM1480_IMR_REGISTER_SPACING)
361#define A_BCM1480_IMR_REGISTER(cpu,reg) (A_BCM1480_IMR_MAPPER(cpu)+(reg))
362
363/* Most IMR registers are 128 bits, implemented as non-contiguous
364 64-bit registers high (_H) and low (_L) */
365#define BCM1480_IMR_HL_SPACING 0x1000
366
367#define R_BCM1480_IMR_INTERRUPT_DIAG_H 0x0010
368#define R_BCM1480_IMR_LDT_INTERRUPT_H 0x0018
369#define R_BCM1480_IMR_LDT_INTERRUPT_CLR_H 0x0020
370#define R_BCM1480_IMR_INTERRUPT_MASK_H 0x0028
371#define R_BCM1480_IMR_INTERRUPT_TRACE_H 0x0038
372#define R_BCM1480_IMR_INTERRUPT_SOURCE_STATUS_H 0x0040
373#define R_BCM1480_IMR_LDT_INTERRUPT_SET 0x0048
374#define R_BCM1480_IMR_MAILBOX_0_CPU 0x00C0
375#define R_BCM1480_IMR_MAILBOX_0_SET_CPU 0x00C8
376#define R_BCM1480_IMR_MAILBOX_0_CLR_CPU 0x00D0
377#define R_BCM1480_IMR_MAILBOX_1_CPU 0x00E0
378#define R_BCM1480_IMR_MAILBOX_1_SET_CPU 0x00E8
379#define R_BCM1480_IMR_MAILBOX_1_CLR_CPU 0x00F0
380#define R_BCM1480_IMR_INTERRUPT_STATUS_BASE_H 0x0100
381#define BCM1480_IMR_INTERRUPT_STATUS_COUNT 8
382#define R_BCM1480_IMR_INTERRUPT_MAP_BASE_H 0x0200
383#define BCM1480_IMR_INTERRUPT_MAP_COUNT 64
384
385#define R_BCM1480_IMR_INTERRUPT_DIAG_L 0x1010
386#define R_BCM1480_IMR_LDT_INTERRUPT_L 0x1018
387#define R_BCM1480_IMR_LDT_INTERRUPT_CLR_L 0x1020
388#define R_BCM1480_IMR_INTERRUPT_MASK_L 0x1028
389#define R_BCM1480_IMR_INTERRUPT_TRACE_L 0x1038
390#define R_BCM1480_IMR_INTERRUPT_SOURCE_STATUS_L 0x1040
391#define R_BCM1480_IMR_INTERRUPT_STATUS_BASE_L 0x1100
392#define R_BCM1480_IMR_INTERRUPT_MAP_BASE_L 0x1200
393
394#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU0_BASE 0x0010028000
395#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU1_BASE 0x0010028100
396#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU2_BASE 0x0010028200
397#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU3_BASE 0x0010028300
398#define BCM1480_IMR_ALIAS_MAILBOX_SPACING 0100
399
400#define A_BCM1480_IMR_ALIAS_MAILBOX(cpu) (A_BCM1480_IMR_ALIAS_MAILBOX_CPU0_BASE + \
401 (cpu)*BCM1480_IMR_ALIAS_MAILBOX_SPACING)
402#define A_BCM1480_IMR_ALIAS_MAILBOX_REGISTER(cpu,reg) (A_BCM1480_IMR_ALIAS_MAILBOX(cpu)+(reg))
403
404#define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000 /* 0x0x0 */
405#define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008 /* 0x0x8 */
406
407/* *********************************************************************
408 * System Performance Counter Registers (Section 4.7)
409 ********************************************************************* */
410
411/* BCM1480 has four more performance counter registers, and two control
412 registers. */
413
414#define A_BCM1480_SCD_PERF_CNT_BASE 0x00100204C0
415
416#define A_BCM1480_SCD_PERF_CNT_CFG0 0x00100204C0
417#define A_BCM1480_SCD_PERF_CNT_CFG_0 A_BCM1480_SCD_PERF_CNT_CFG0
418#define A_BCM1480_SCD_PERF_CNT_CFG1 0x00100204C8
419#define A_BCM1480_SCD_PERF_CNT_CFG_1 A_BCM1480_SCD_PERF_CNT_CFG1
420
421#define A_BCM1480_SCD_PERF_CNT_0 A_SCD_PERF_CNT_0
422#define A_BCM1480_SCD_PERF_CNT_1 A_SCD_PERF_CNT_1
423#define A_BCM1480_SCD_PERF_CNT_2 A_SCD_PERF_CNT_2
424#define A_BCM1480_SCD_PERF_CNT_3 A_SCD_PERF_CNT_3
425
426#define A_BCM1480_SCD_PERF_CNT_4 0x00100204F0
427#define A_BCM1480_SCD_PERF_CNT_5 0x00100204F8
428#define A_BCM1480_SCD_PERF_CNT_6 0x0010020500
429#define A_BCM1480_SCD_PERF_CNT_7 0x0010020508
430
431/* *********************************************************************
432 * System Bus Watcher Registers (Section 4.8)
433 ********************************************************************* */
434
435
436/* Same as 1250 except BUS_ERR_STATUS_DEBUG is in a different place. */
437
438#define A_BCM1480_BUS_ERR_STATUS_DEBUG 0x00100208D8
439
440/* *********************************************************************
441 * System Debug Controller Registers (Section 19)
442 ********************************************************************* */
443
444/* Same as 1250 */
445
446/* *********************************************************************
447 * System Trace Unit Registers (Sections 4.10)
448 ********************************************************************* */
449
450/* Same as 1250 */
451
452/* *********************************************************************
453 * Data Mover DMA Registers (Section 10.7)
454 ********************************************************************* */
455
456/* Same as 1250 */
457
458
459/* *********************************************************************
460 * HyperTransport Interface Registers (Section 8)
461 ********************************************************************* */
462
463#define BCM1480_HT_NUM_PORTS 3
464#define BCM1480_HT_PORT_SPACING 0x800
465#define A_BCM1480_HT_PORT_HEADER(x) (A_BCM1480_HT_PORT0_HEADER + ((x)*BCM1480_HT_PORT_SPACING))
466
467#define A_BCM1480_HT_PORT0_HEADER 0x00FE000000
468#define A_BCM1480_HT_PORT1_HEADER 0x00FE000800
469#define A_BCM1480_HT_PORT2_HEADER 0x00FE001000
470#define A_BCM1480_HT_TYPE00_HEADER 0x00FE002000
471
472
473/* *********************************************************************
474 * Node Controller Registers (Section 9)
475 ********************************************************************* */
476
477#define A_BCM1480_NC_BASE 0x00DFBD0000
478
479#define A_BCM1480_NC_RLD_FIELD 0x00DFBD0000
480#define A_BCM1480_NC_RLD_TRIGGER 0x00DFBD0020
481#define A_BCM1480_NC_RLD_BAD_ERROR 0x00DFBD0040
482#define A_BCM1480_NC_RLD_COR_ERROR 0x00DFBD0060
483#define A_BCM1480_NC_RLD_ECC_STATUS 0x00DFBD0080
484#define A_BCM1480_NC_RLD_WAY_ENABLE 0x00DFBD00A0
485#define A_BCM1480_NC_RLD_RANDOM_LFSR 0x00DFBD00C0
486
487#define A_BCM1480_NC_INTERRUPT_STATUS 0x00DFBD00E0
488#define A_BCM1480_NC_INTERRUPT_ENABLE 0x00DFBD0100
489#define A_BCM1480_NC_TIMEOUT_COUNTER 0x00DFBD0120
490#define A_BCM1480_NC_TIMEOUT_COUNTER_SEL 0x00DFBD0140
491
492#define A_BCM1480_NC_CREDIT_STATUS_REG0 0x00DFBD0200
493#define A_BCM1480_NC_CREDIT_STATUS_REG1 0x00DFBD0220
494#define A_BCM1480_NC_CREDIT_STATUS_REG2 0x00DFBD0240
495#define A_BCM1480_NC_CREDIT_STATUS_REG3 0x00DFBD0260
496#define A_BCM1480_NC_CREDIT_STATUS_REG4 0x00DFBD0280
497#define A_BCM1480_NC_CREDIT_STATUS_REG5 0x00DFBD02A0
498#define A_BCM1480_NC_CREDIT_STATUS_REG6 0x00DFBD02C0
499#define A_BCM1480_NC_CREDIT_STATUS_REG7 0x00DFBD02E0
500#define A_BCM1480_NC_CREDIT_STATUS_REG8 0x00DFBD0300
501#define A_BCM1480_NC_CREDIT_STATUS_REG9 0x00DFBD0320
502#define A_BCM1480_NC_CREDIT_STATUS_REG10 0x00DFBE0000
503#define A_BCM1480_NC_CREDIT_STATUS_REG11 0x00DFBE0020
504#define A_BCM1480_NC_CREDIT_STATUS_REG12 0x00DFBE0040
505
506#define A_BCM1480_NC_SR_TIMEOUT_COUNTER 0x00DFBE0060
507#define A_BCM1480_NC_SR_TIMEOUT_COUNTER_SEL 0x00DFBE0080
508
509
510/* *********************************************************************
511 * H&R Block Configuration Registers (Section 12.4)
512 ********************************************************************* */
513
514#define A_BCM1480_HR_BASE_0 0x00DF820000
515#define A_BCM1480_HR_BASE_1 0x00DF8A0000
516#define A_BCM1480_HR_BASE_2 0x00DF920000
517#define BCM1480_HR_REGISTER_SPACING 0x80000
518
519#define A_BCM1480_HR_BASE(idx) (A_BCM1480_HR_BASE_0 + ((idx)*BCM1480_HR_REGISTER_SPACING))
520#define A_BCM1480_HR_REGISTER(idx,reg) (A_BCM1480_HR_BASE(idx) + (reg))
521
522#define R_BCM1480_HR_CFG 0x0000000000
523
524#define R_BCM1480_HR_MAPPING 0x0000010010
525
526#define BCM1480_HR_RULE_SPACING 0x0000000010
527#define BCM1480_HR_NUM_RULES 16
528#define BCM1480_HR_OP_OFFSET 0x0000000100
529#define BCM1480_HR_TYPE_OFFSET 0x0000000108
530#define R_BCM1480_HR_RULE_OP(idx) (BCM1480_HR_OP_OFFSET + ((idx)*BCM1480_HR_RULE_SPACING))
531#define R_BCM1480_HR_RULE_TYPE(idx) (BCM1480_HR_TYPE_OFFSET + ((idx)*BCM1480_HR_RULE_SPACING))
532
533#define BCM1480_HR_LEAF_SPACING 0x0000000010
534#define BCM1480_HR_NUM_LEAVES 10
535#define BCM1480_HR_LEAF_OFFSET 0x0000000300
536#define R_BCM1480_HR_HA_LEAF0(idx) (BCM1480_HR_LEAF_OFFSET + ((idx)*BCM1480_HR_LEAF_SPACING))
537
538#define R_BCM1480_HR_EX_LEAF0 0x00000003A0
539
540#define BCM1480_HR_PATH_SPACING 0x0000000010
541#define BCM1480_HR_NUM_PATHS 16
542#define BCM1480_HR_PATH_OFFSET 0x0000000600
543#define R_BCM1480_HR_PATH(idx) (BCM1480_HR_PATH_OFFSET + ((idx)*BCM1480_HR_PATH_SPACING))
544
545#define R_BCM1480_HR_PATH_DEFAULT 0x0000000700
546
547#define BCM1480_HR_ROUTE_SPACING 8
548#define BCM1480_HR_NUM_ROUTES 512
549#define BCM1480_HR_ROUTE_OFFSET 0x0000001000
550#define R_BCM1480_HR_RT_WORD(idx) (BCM1480_HR_ROUTE_OFFSET + ((idx)*BCM1480_HR_ROUTE_SPACING))
551
552
553/* checked to here - ehs */
554/* *********************************************************************
555 * Packet Manager DMA Registers (Section 12.5)
556 ********************************************************************* */
557
558#define A_BCM1480_PM_BASE 0x0010056000
559
560#define A_BCM1480_PMI_LCL_0 0x0010058000
561#define A_BCM1480_PMO_LCL_0 0x001005C000
562#define A_BCM1480_PMI_OFFSET_0 (A_BCM1480_PMI_LCL_0 - A_BCM1480_PM_BASE)
563#define A_BCM1480_PMO_OFFSET_0 (A_BCM1480_PMO_LCL_0 - A_BCM1480_PM_BASE)
564
565#define BCM1480_PM_LCL_REGISTER_SPACING 0x100
566#define BCM1480_PM_NUM_CHANNELS 32
567
568#define A_BCM1480_PMI_LCL_BASE(idx) (A_BCM1480_PMI_LCL_0 + ((idx)*BCM1480_PM_LCL_REGISTER_SPACING))
569#define A_BCM1480_PMI_LCL_REGISTER(idx,reg) (A_BCM1480_PMI_LCL_BASE(idx) + (reg))
570#define A_BCM1480_PMO_LCL_BASE(idx) (A_BCM1480_PMO_LCL_0 + ((idx)*BCM1480_PM_LCL_REGISTER_SPACING))
571#define A_BCM1480_PMO_LCL_REGISTER(idx,reg) (A_BCM1480_PMO_LCL_BASE(idx) + (reg))
572
573#define BCM1480_PM_INT_PACKING 8
574#define BCM1480_PM_INT_FUNCTION_SPACING 0x40
575#define BCM1480_PM_INT_NUM_FUNCTIONS 3
576
577/*
578 * DMA channel registers relative to A_BCM1480_PMI_LCL_BASE(n) and A_BCM1480_PMO_LCL_BASE(n)
579 */
580
581#define R_BCM1480_PM_BASE_SIZE 0x0000000000
582#define R_BCM1480_PM_CNT 0x0000000008
583#define R_BCM1480_PM_PFCNT 0x0000000010
584#define R_BCM1480_PM_LAST 0x0000000018
585#define R_BCM1480_PM_PFINDX 0x0000000020
586#define R_BCM1480_PM_INT_WMK 0x0000000028
587#define R_BCM1480_PM_CONFIG0 0x0000000030
588#define R_BCM1480_PM_LOCALDEBUG 0x0000000078
589#define R_BCM1480_PM_CACHEABILITY 0x0000000080 /* PMI only */
590#define R_BCM1480_PM_INT_CNFG 0x0000000088
591#define R_BCM1480_PM_DESC_MERGE_TIMER 0x0000000090
592#define R_BCM1480_PM_LOCALDEBUG_PIB 0x00000000F8 /* PMI only */
593#define R_BCM1480_PM_LOCALDEBUG_POB 0x00000000F8 /* PMO only */
594
595/*
596 * Global Registers (Not Channelized)
597 */
598
599#define A_BCM1480_PMI_GLB_0 0x0010056000
600#define A_BCM1480_PMO_GLB_0 0x0010057000
601
602/*
603 * PM to TX Mapping Register relative to A_BCM1480_PMI_GLB_0 and A_BCM1480_PMO_GLB_0
604 */
605
606#define R_BCM1480_PM_PMO_MAPPING 0x00000008C8 /* PMO only */
607
608#define A_BCM1480_PM_PMO_MAPPING (A_BCM1480_PMO_GLB_0 + R_BCM1480_PM_PMO_MAPPING)
609
610/*
611 * Interrupt mapping registers
612 */
613
614
615#define A_BCM1480_PMI_INT_0 0x0010056800
616#define A_BCM1480_PMI_INT(q) (A_BCM1480_PMI_INT_0 + ((q>>8)<<8))
617#define A_BCM1480_PMI_INT_OFFSET_0 (A_BCM1480_PMI_INT_0 - A_BCM1480_PM_BASE)
618#define A_BCM1480_PMO_INT_0 0x0010057800
619#define A_BCM1480_PMO_INT(q) (A_BCM1480_PMO_INT_0 + ((q>>8)<<8))
620#define A_BCM1480_PMO_INT_OFFSET_0 (A_BCM1480_PMO_INT_0 - A_BCM1480_PM_BASE)
621
622/*
623 * Interrupt registers relative to A_BCM1480_PMI_INT_0 and A_BCM1480_PMO_INT_0
624 */
625
626#define R_BCM1480_PM_INT_ST 0x0000000000
627#define R_BCM1480_PM_INT_MSK 0x0000000040
628#define R_BCM1480_PM_INT_CLR 0x0000000080
629#define R_BCM1480_PM_MRGD_INT 0x00000000C0
630
631/*
632 * Debug registers (global)
633 */
634
635#define A_BCM1480_PM_GLOBALDEBUGMODE_PMI 0x0010056000
636#define A_BCM1480_PM_GLOBALDEBUG_PID 0x00100567F8
637#define A_BCM1480_PM_GLOBALDEBUG_PIB 0x0010056FF8
638#define A_BCM1480_PM_GLOBALDEBUGMODE_PMO 0x0010057000
639#define A_BCM1480_PM_GLOBALDEBUG_POD 0x00100577F8
640#define A_BCM1480_PM_GLOBALDEBUG_POB 0x0010057FF8
641
642/* *********************************************************************
643 * Switch performance counters
644 ********************************************************************* */
645
646#define A_BCM1480_SWPERF_CFG 0xdfb91800
647#define A_BCM1480_SWPERF_CNT0 0xdfb91880
648#define A_BCM1480_SWPERF_CNT1 0xdfb91888
649#define A_BCM1480_SWPERF_CNT2 0xdfb91890
650#define A_BCM1480_SWPERF_CNT3 0xdfb91898
651
652
653/* *********************************************************************
654 * Switch Trace Unit
655 ********************************************************************* */
656
657#define A_BCM1480_SWTRC_MATCH_CONTROL_0 0xDFB91000
658#define A_BCM1480_SWTRC_MATCH_DATA_VALUE_0 0xDFB91100
659#define A_BCM1480_SWTRC_MATCH_DATA_MASK_0 0xDFB91108
660#define A_BCM1480_SWTRC_MATCH_TAG_VALUE_0 0xDFB91200
661#define A_BCM1480_SWTRC_MATCH_TAG_MAKS_0 0xDFB91208
662#define A_BCM1480_SWTRC_EVENT_0 0xDFB91300
663#define A_BCM1480_SWTRC_SEQUENCE_0 0xDFB91400
664
665#define A_BCM1480_SWTRC_CFG 0xDFB91500
666#define A_BCM1480_SWTRC_READ 0xDFB91508
667
668#define A_BCM1480_SWDEBUG_SCHEDSTOP 0xDFB92000
669
670#define A_BCM1480_SWTRC_MATCH_CONTROL(x) (A_BCM1480_SWTRC_MATCH_CONTROL_0 + ((x)*8))
671#define A_BCM1480_SWTRC_EVENT(x) (A_BCM1480_SWTRC_EVENT_0 + ((x)*8))
672#define A_BCM1480_SWTRC_SEQUENCE(x) (A_BCM1480_SWTRC_SEQUENCE_0 + ((x)*8))
673
674#define A_BCM1480_SWTRC_MATCH_DATA_VALUE(x) (A_BCM1480_SWTRC_MATCH_DATA_VALUE_0 + ((x)*16))
675#define A_BCM1480_SWTRC_MATCH_DATA_MASK(x) (A_BCM1480_SWTRC_MATCH_DATA_MASK_0 + ((x)*16))
676#define A_BCM1480_SWTRC_MATCH_TAG_VALUE(x) (A_BCM1480_SWTRC_MATCH_TAG_VALUE_0 + ((x)*16))
677#define A_BCM1480_SWTRC_MATCH_TAG_MASK(x) (A_BCM1480_SWTRC_MATCH_TAG_MASK_0 + ((x)*16))
678
679
680
681/* *********************************************************************
682 * High-Speed Port Registers (Section 13)
683 ********************************************************************* */
684
685#define A_BCM1480_HSP_BASE_0 0x00DF810000
686#define A_BCM1480_HSP_BASE_1 0x00DF890000
687#define A_BCM1480_HSP_BASE_2 0x00DF910000
688#define BCM1480_HSP_REGISTER_SPACING 0x80000
689
690#define A_BCM1480_HSP_BASE(idx) (A_BCM1480_HSP_BASE_0 + ((idx)*BCM1480_HSP_REGISTER_SPACING))
691#define A_BCM1480_HSP_REGISTER(idx,reg) (A_BCM1480_HSP_BASE(idx) + (reg))
692
693#define R_BCM1480_HSP_RX_SPI4_CFG_0 0x0000000000
694#define R_BCM1480_HSP_RX_SPI4_CFG_1 0x0000000008
695#define R_BCM1480_HSP_RX_SPI4_DESKEW_OVERRIDE 0x0000000010
696#define R_BCM1480_HSP_RX_SPI4_DESKEW_DATAPATH 0x0000000018
697#define R_BCM1480_HSP_RX_SPI4_PORT_INT_EN 0x0000000020
698#define R_BCM1480_HSP_RX_SPI4_PORT_INT_STATUS 0x0000000028
699
700#define R_BCM1480_HSP_RX_SPI4_CALENDAR_0 0x0000000200
701#define R_BCM1480_HSP_RX_SPI4_CALENDAR_1 0x0000000208
702
703#define R_BCM1480_HSP_RX_PLL_CNFG 0x0000000800
704#define R_BCM1480_HSP_RX_CALIBRATION 0x0000000808
705#define R_BCM1480_HSP_RX_TEST 0x0000000810
706#define R_BCM1480_HSP_RX_DIAG_DETAILS 0x0000000818
707#define R_BCM1480_HSP_RX_DIAG_CRC_0 0x0000000820
708#define R_BCM1480_HSP_RX_DIAG_CRC_1 0x0000000828
709#define R_BCM1480_HSP_RX_DIAG_HTCMD 0x0000000830
710#define R_BCM1480_HSP_RX_DIAG_PKTCTL 0x0000000838
711
712#define R_BCM1480_HSP_RX_VIS_FLCTRL_COUNTER 0x0000000870
713
714#define R_BCM1480_HSP_RX_PKT_RAMALLOC_0 0x0000020020
715#define R_BCM1480_HSP_RX_PKT_RAMALLOC_1 0x0000020028
716#define R_BCM1480_HSP_RX_PKT_RAMALLOC_2 0x0000020030
717#define R_BCM1480_HSP_RX_PKT_RAMALLOC_3 0x0000020038
718#define R_BCM1480_HSP_RX_PKT_RAMALLOC_4 0x0000020040
719#define R_BCM1480_HSP_RX_PKT_RAMALLOC_5 0x0000020048
720#define R_BCM1480_HSP_RX_PKT_RAMALLOC_6 0x0000020050
721#define R_BCM1480_HSP_RX_PKT_RAMALLOC_7 0x0000020058
722#define R_BCM1480_HSP_RX_PKT_RAMALLOC(idx) (R_BCM1480_HSP_RX_PKT_RAMALLOC_0 + 8*(idx))
723
724/* XXX Following registers were shuffled. Renamed/renumbered per errata. */
725#define R_BCM1480_HSP_RX_HT_RAMALLOC_0 0x0000020078
726#define R_BCM1480_HSP_RX_HT_RAMALLOC_1 0x0000020080
727#define R_BCM1480_HSP_RX_HT_RAMALLOC_2 0x0000020088
728#define R_BCM1480_HSP_RX_HT_RAMALLOC_3 0x0000020090
729#define R_BCM1480_HSP_RX_HT_RAMALLOC_4 0x0000020098
730#define R_BCM1480_HSP_RX_HT_RAMALLOC_5 0x00000200A0
731
732#define R_BCM1480_HSP_RX_SPI_WATERMARK_0 0x00000200B0
733#define R_BCM1480_HSP_RX_SPI_WATERMARK_1 0x00000200B8
734#define R_BCM1480_HSP_RX_SPI_WATERMARK_2 0x00000200C0
735#define R_BCM1480_HSP_RX_SPI_WATERMARK_3 0x00000200C8
736#define R_BCM1480_HSP_RX_SPI_WATERMARK_4 0x00000200D0
737#define R_BCM1480_HSP_RX_SPI_WATERMARK_5 0x00000200D8
738#define R_BCM1480_HSP_RX_SPI_WATERMARK_6 0x00000200E0
739#define R_BCM1480_HSP_RX_SPI_WATERMARK_7 0x00000200E8
740#define R_BCM1480_HSP_RX_SPI_WATERMARK(idx) (R_BCM1480_HSP_RX_SPI_WATERMARK_0 + 8*(idx))
741
742#define R_BCM1480_HSP_RX_VIS_CMDQ_0 0x00000200F0
743#define R_BCM1480_HSP_RX_VIS_CMDQ_1 0x00000200F8
744#define R_BCM1480_HSP_RX_VIS_CMDQ_2 0x0000020100
745#define R_BCM1480_HSP_RX_RAM_READCTL 0x0000020108
746#define R_BCM1480_HSP_RX_RAM_READWINDOW 0x0000020110
747#define R_BCM1480_HSP_RX_RF_READCTL 0x0000020118
748#define R_BCM1480_HSP_RX_RF_READWINDOW 0x0000020120
749
750#define R_BCM1480_HSP_TX_SPI4_CFG_0 0x0000040000
751#define R_BCM1480_HSP_TX_SPI4_CFG_1 0x0000040008
752#define R_BCM1480_HSP_TX_SPI4_TRAINING_FMT 0x0000040010
753
754#define R_BCM1480_HSP_TX_PKT_RAMALLOC_0 0x0000040020
755#define R_BCM1480_HSP_TX_PKT_RAMALLOC_1 0x0000040028
756#define R_BCM1480_HSP_TX_PKT_RAMALLOC_2 0x0000040030
757#define R_BCM1480_HSP_TX_PKT_RAMALLOC_3 0x0000040038
758#define R_BCM1480_HSP_TX_PKT_RAMALLOC_4 0x0000040040
759#define R_BCM1480_HSP_TX_PKT_RAMALLOC_5 0x0000040048
760#define R_BCM1480_HSP_TX_PKT_RAMALLOC_6 0x0000040050
761#define R_BCM1480_HSP_TX_PKT_RAMALLOC_7 0x0000040058
762#define R_BCM1480_HSP_TX_PKT_RAMALLOC(idx) (R_BCM1480_HSP_TX_PKT_RAMALLOC_0 + 8*(idx))
763#define R_BCM1480_HSP_TX_NPC_RAMALLOC 0x0000040078
764#define R_BCM1480_HSP_TX_RSP_RAMALLOC 0x0000040080
765#define R_BCM1480_HSP_TX_PC_RAMALLOC 0x0000040088
766#define R_BCM1480_HSP_TX_HTCC_RAMALLOC_0 0x0000040090
767#define R_BCM1480_HSP_TX_HTCC_RAMALLOC_1 0x0000040098
768#define R_BCM1480_HSP_TX_HTCC_RAMALLOC_2 0x00000400A0
769
770#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_0 0x00000400B0
771#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_1 0x00000400B8
772#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_2 0x00000400C0
773#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_3 0x00000400C8
774#define R_BCM1480_HSP_TX_PKT_RXPHITCNT(idx) (R_BCM1480_HSP_TX_PKT_RXPHITCNT_0 + 8*(idx))
775#define R_BCM1480_HSP_TX_HTIO_RXPHITCNT 0x00000400D0
776#define R_BCM1480_HSP_TX_HTCC_RXPHITCNT 0x00000400D8
777
778#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_0 0x00000400E0
779#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_1 0x00000400E8
780#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_2 0x00000400F0
781#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_3 0x00000400F8
782#define R_BCM1480_HSP_TX_PKT_TXPHITCNT(idx) (R_BCM1480_HSP_TX_PKT_TXPHITCNT_0 + 8*(idx))
783#define R_BCM1480_HSP_TX_HTIO_TXPHITCNT 0x0000040100
784#define R_BCM1480_HSP_TX_HTCC_TXPHITCNT 0x0000040108
785
786#define R_BCM1480_HSP_TX_SPI4_CALENDAR_0 0x0000040200
787#define R_BCM1480_HSP_TX_SPI4_CALENDAR_1 0x0000040208
788
789#define R_BCM1480_HSP_TX_PLL_CNFG 0x0000040800
790#define R_BCM1480_HSP_TX_CALIBRATION 0x0000040808
791#define R_BCM1480_HSP_TX_TEST 0x0000040810
792
793#define R_BCM1480_HSP_TX_VIS_CMDQ_0 0x0000040840
794#define R_BCM1480_HSP_TX_VIS_CMDQ_1 0x0000040848
795#define R_BCM1480_HSP_TX_VIS_CMDQ_2 0x0000040850
796#define R_BCM1480_HSP_TX_RAM_READCTL 0x0000040860
797#define R_BCM1480_HSP_TX_RAM_READWINDOW 0x0000040868
798#define R_BCM1480_HSP_TX_RF_READCTL 0x0000040870
799#define R_BCM1480_HSP_TX_RF_READWINDOW 0x0000040878
800
801#define R_BCM1480_HSP_TX_SPI4_PORT_INT_STATUS 0x0000040880
802#define R_BCM1480_HSP_TX_SPI4_PORT_INT_EN 0x0000040888
803
804#define R_BCM1480_HSP_TX_NEXT_ADDR_BASE 0x000040400
805#define R_BCM1480_HSP_TX_NEXT_ADDR_REGISTER(x) (R_BCM1480_HSP_TX_NEXT_ADDR_BASE+ 8*(x))
806
807
808
809/* *********************************************************************
810 * Physical Address Map (Table 10 and Figure 7)
811 ********************************************************************* */
812
813#define A_BCM1480_PHYS_MEMORY_0 _SB_MAKE64(0x0000000000)
814#define A_BCM1480_PHYS_MEMORY_SIZE _SB_MAKE64((256*1024*1024))
815#define A_BCM1480_PHYS_SYSTEM_CTL _SB_MAKE64(0x0010000000)
816#define A_BCM1480_PHYS_IO_SYSTEM _SB_MAKE64(0x0010060000)
817#define A_BCM1480_PHYS_GENBUS _SB_MAKE64(0x0010090000)
818#define A_BCM1480_PHYS_GENBUS_END _SB_MAKE64(0x0028000000)
819#define A_BCM1480_PHYS_PCI_MISC_MATCH_BYTES _SB_MAKE64(0x0028000000)
820#define A_BCM1480_PHYS_PCI_IACK_MATCH_BYTES _SB_MAKE64(0x0029000000)
821#define A_BCM1480_PHYS_PCI_IO_MATCH_BYTES _SB_MAKE64(0x002C000000)
822#define A_BCM1480_PHYS_PCI_CFG_MATCH_BYTES _SB_MAKE64(0x002E000000)
823#define A_BCM1480_PHYS_PCI_OMAP_MATCH_BYTES _SB_MAKE64(0x002F000000)
824#define A_BCM1480_PHYS_PCI_MEM_MATCH_BYTES _SB_MAKE64(0x0030000000)
825#define A_BCM1480_PHYS_HT_MEM_MATCH_BYTES _SB_MAKE64(0x0040000000)
826#define A_BCM1480_PHYS_HT_MEM_MATCH_BITS _SB_MAKE64(0x0060000000)
827#define A_BCM1480_PHYS_MEMORY_1 _SB_MAKE64(0x0080000000)
828#define A_BCM1480_PHYS_MEMORY_2 _SB_MAKE64(0x0090000000)
829#define A_BCM1480_PHYS_PCI_MISC_MATCH_BITS _SB_MAKE64(0x00A8000000)
830#define A_BCM1480_PHYS_PCI_IACK_MATCH_BITS _SB_MAKE64(0x00A9000000)
831#define A_BCM1480_PHYS_PCI_IO_MATCH_BITS _SB_MAKE64(0x00AC000000)
832#define A_BCM1480_PHYS_PCI_CFG_MATCH_BITS _SB_MAKE64(0x00AE000000)
833#define A_BCM1480_PHYS_PCI_OMAP_MATCH_BITS _SB_MAKE64(0x00AF000000)
834#define A_BCM1480_PHYS_PCI_MEM_MATCH_BITS _SB_MAKE64(0x00B0000000)
835#define A_BCM1480_PHYS_MEMORY_3 _SB_MAKE64(0x00C0000000)
836#define A_BCM1480_PHYS_L2_CACHE_TEST _SB_MAKE64(0x00D0000000)
837#define A_BCM1480_PHYS_HT_SPECIAL_MATCH_BYTES _SB_MAKE64(0x00D8000000)
838#define A_BCM1480_PHYS_HT_IO_MATCH_BYTES _SB_MAKE64(0x00DC000000)
839#define A_BCM1480_PHYS_HT_CFG_MATCH_BYTES _SB_MAKE64(0x00DE000000)
840#define A_BCM1480_PHYS_HS_SUBSYS _SB_MAKE64(0x00DF000000)
841#define A_BCM1480_PHYS_HT_SPECIAL_MATCH_BITS _SB_MAKE64(0x00F8000000)
842#define A_BCM1480_PHYS_HT_IO_MATCH_BITS _SB_MAKE64(0x00FC000000)
843#define A_BCM1480_PHYS_HT_CFG_MATCH_BITS _SB_MAKE64(0x00FE000000)
844#define A_BCM1480_PHYS_MEMORY_EXP _SB_MAKE64(0x0100000000)
845#define A_BCM1480_PHYS_MEMORY_EXP_SIZE _SB_MAKE64((508*1024*1024*1024))
846#define A_BCM1480_PHYS_PCI_UPPER _SB_MAKE64(0x1000000000)
847#define A_BCM1480_PHYS_HT_UPPER_MATCH_BYTES _SB_MAKE64(0x2000000000)
848#define A_BCM1480_PHYS_HT_UPPER_MATCH_BITS _SB_MAKE64(0x3000000000)
849#define A_BCM1480_PHYS_HT_NODE_ALIAS _SB_MAKE64(0x4000000000)
850#define A_BCM1480_PHYS_HT_FULLACCESS _SB_MAKE64(0xF000000000)
851
852
853/* *********************************************************************
854 * L2 Cache as RAM (Table 54)
855 ********************************************************************* */
856
857#define A_BCM1480_PHYS_L2CACHE_WAY_SIZE _SB_MAKE64(0x0000020000)
858#define BCM1480_PHYS_L2CACHE_NUM_WAYS 8
859#define A_BCM1480_PHYS_L2CACHE_TOTAL_SIZE _SB_MAKE64(0x0000100000)
860#define A_BCM1480_PHYS_L2CACHE_WAY0 _SB_MAKE64(0x00D0300000)
861#define A_BCM1480_PHYS_L2CACHE_WAY1 _SB_MAKE64(0x00D0320000)
862#define A_BCM1480_PHYS_L2CACHE_WAY2 _SB_MAKE64(0x00D0340000)
863#define A_BCM1480_PHYS_L2CACHE_WAY3 _SB_MAKE64(0x00D0360000)
864#define A_BCM1480_PHYS_L2CACHE_WAY4 _SB_MAKE64(0x00D0380000)
865#define A_BCM1480_PHYS_L2CACHE_WAY5 _SB_MAKE64(0x00D03A0000)
866#define A_BCM1480_PHYS_L2CACHE_WAY6 _SB_MAKE64(0x00D03C0000)
867#define A_BCM1480_PHYS_L2CACHE_WAY7 _SB_MAKE64(0x00D03E0000)
868
869#endif /* _BCM1480_REGS_H */
diff --git a/include/asm-mips/sibyte/bcm1480_scd.h b/include/asm-mips/sibyte/bcm1480_scd.h
new file mode 100644
index 000000000000..648bed96780f
--- /dev/null
+++ b/include/asm-mips/sibyte/bcm1480_scd.h
@@ -0,0 +1,436 @@
1/* *********************************************************************
2 * BCM1280/BCM1400 Board Support Package
3 *
4 * SCD Constants and Macros File: bcm1480_scd.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the System Control and Debug module.
8 *
9 * BCM1400 specification level: 1X55_1X80-UM100-R (12/18/03)
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32#ifndef _BCM1480_SCD_H
33#define _BCM1480_SCD_H
34
35#include "sb1250_defs.h"
36
37/* *********************************************************************
38 * Pull in the BCM1250's SCD since lots of stuff is the same.
39 ********************************************************************* */
40
41#include "sb1250_scd.h"
42
43/* *********************************************************************
44 * Some general notes:
45 *
46 * This file is basically a "what's new" header file. Since the
47 * BCM1250 and the new BCM1480 (and derivatives) share many common
48 * features, this file contains only what's new or changed from
49 * the 1250. (above, you can see that we include the 1250 symbols
50 * to get the base functionality).
51 *
52 * In software, be sure to use the correct symbols, particularly
53 * for blocks that are different between the two chip families.
54 * All BCM1480-specific symbols have _BCM1480_ in their names,
55 * and all BCM1250-specific and "base" functions that are common in
56 * both chips have no special names (this is for compatibility with
57 * older include files). Therefore, if you're working with the
58 * SCD, which is very different on each chip, A_SCD_xxx implies
59 * the BCM1250 version and A_BCM1480_SCD_xxx implies the BCM1480
60 * version.
61 ********************************************************************* */
62
63/* *********************************************************************
64 * System control/debug registers
65 ********************************************************************* */
66
67/*
68 * System Identification and Revision Register (Table 12)
69 * Register: SCD_SYSTEM_REVISION
70 * This register is field compatible with the 1250.
71 */
72
73/*
74 * New part definitions
75 */
76
77#define K_SYS_PART_BCM1480 0x1406
78#define K_SYS_PART_BCM1280 0x1206
79#define K_SYS_PART_BCM1455 0x1407
80#define K_SYS_PART_BCM1255 0x1257
81
82/*
83 * Manufacturing Information Register (Table 14)
84 * Register: SCD_SYSTEM_MANUF
85 */
86
87/*
88 * System Configuration Register (Table 15)
89 * Register: SCD_SYSTEM_CFG
90 * Entire register is different from 1250, all new constants below
91 */
92
93#define M_BCM1480_SYS_RESERVED0 _SB_MAKEMASK1(0)
94#define M_BCM1480_SYS_HT_MINRSTCNT _SB_MAKEMASK1(1)
95#define M_BCM1480_SYS_RESERVED2 _SB_MAKEMASK1(2)
96#define M_BCM1480_SYS_RESERVED3 _SB_MAKEMASK1(3)
97#define M_BCM1480_SYS_RESERVED4 _SB_MAKEMASK1(4)
98#define M_BCM1480_SYS_IOB_DIV _SB_MAKEMASK1(5)
99
100#define S_BCM1480_SYS_PLL_DIV _SB_MAKE64(6)
101#define M_BCM1480_SYS_PLL_DIV _SB_MAKEMASK(5,S_BCM1480_SYS_PLL_DIV)
102#define V_BCM1480_SYS_PLL_DIV(x) _SB_MAKEVALUE(x,S_BCM1480_SYS_PLL_DIV)
103#define G_BCM1480_SYS_PLL_DIV(x) _SB_GETVALUE(x,S_BCM1480_SYS_PLL_DIV,M_BCM1480_SYS_PLL_DIV)
104
105#define S_BCM1480_SYS_SW_DIV _SB_MAKE64(11)
106#define M_BCM1480_SYS_SW_DIV _SB_MAKEMASK(5,S_BCM1480_SYS_SW_DIV)
107#define V_BCM1480_SYS_SW_DIV(x) _SB_MAKEVALUE(x,S_BCM1480_SYS_SW_DIV)
108#define G_BCM1480_SYS_SW_DIV(x) _SB_GETVALUE(x,S_BCM1480_SYS_SW_DIV,M_BCM1480_SYS_SW_DIV)
109
110#define M_BCM1480_SYS_PCMCIA_ENABLE _SB_MAKEMASK1(16)
111#define M_BCM1480_SYS_DUART1_ENABLE _SB_MAKEMASK1(17)
112
113#define S_BCM1480_SYS_BOOT_MODE _SB_MAKE64(18)
114#define M_BCM1480_SYS_BOOT_MODE _SB_MAKEMASK(2,S_BCM1480_SYS_BOOT_MODE)
115#define V_BCM1480_SYS_BOOT_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_SYS_BOOT_MODE)
116#define G_BCM1480_SYS_BOOT_MODE(x) _SB_GETVALUE(x,S_BCM1480_SYS_BOOT_MODE,M_BCM1480_SYS_BOOT_MODE)
117#define K_BCM1480_SYS_BOOT_MODE_ROM32 0
118#define K_BCM1480_SYS_BOOT_MODE_ROM8 1
119#define K_BCM1480_SYS_BOOT_MODE_SMBUS_SMALL 2
120#define K_BCM1480_SYS_BOOT_MODE_SMBUS_BIG 3
121#define M_BCM1480_SYS_BOOT_MODE_SMBUS _SB_MAKEMASK1(19)
122
123#define M_BCM1480_SYS_PCI_HOST _SB_MAKEMASK1(20)
124#define M_BCM1480_SYS_PCI_ARBITER _SB_MAKEMASK1(21)
125#define M_BCM1480_SYS_BIG_ENDIAN _SB_MAKEMASK1(22)
126#define M_BCM1480_SYS_GENCLK_EN _SB_MAKEMASK1(23)
127#define M_BCM1480_SYS_GEN_PARITY_EN _SB_MAKEMASK1(24)
128#define M_BCM1480_SYS_RESERVED25 _SB_MAKEMASK1(25)
129
130#define S_BCM1480_SYS_CONFIG 26
131#define M_BCM1480_SYS_CONFIG _SB_MAKEMASK(6,S_BCM1480_SYS_CONFIG)
132#define V_BCM1480_SYS_CONFIG(x) _SB_MAKEVALUE(x,S_BCM1480_SYS_CONFIG)
133#define G_BCM1480_SYS_CONFIG(x) _SB_GETVALUE(x,S_BCM1480_SYS_CONFIG,M_BCM1480_SYS_CONFIG)
134
135#define M_BCM1480_SYS_RESERVED32 _SB_MAKEMASK(32,15)
136
137#define S_BCM1480_SYS_NODEID 47
138#define M_BCM1480_SYS_NODEID _SB_MAKEMASK(4,S_BCM1480_SYS_NODEID)
139#define V_BCM1480_SYS_NODEID(x) _SB_MAKEVALUE(x,S_BCM1480_SYS_NODEID)
140#define G_BCM1480_SYS_NODEID(x) _SB_GETVALUE(x,S_BCM1480_SYS_NODEID,M_BCM1480_SYS_NODEID)
141
142#define M_BCM1480_SYS_CCNUMA_EN _SB_MAKEMASK1(51)
143#define M_BCM1480_SYS_CPU_RESET_0 _SB_MAKEMASK1(52)
144#define M_BCM1480_SYS_CPU_RESET_1 _SB_MAKEMASK1(53)
145#define M_BCM1480_SYS_CPU_RESET_2 _SB_MAKEMASK1(54)
146#define M_BCM1480_SYS_CPU_RESET_3 _SB_MAKEMASK1(55)
147#define S_BCM1480_SYS_DISABLECPU0 56
148#define M_BCM1480_SYS_DISABLECPU0 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU0)
149#define S_BCM1480_SYS_DISABLECPU1 57
150#define M_BCM1480_SYS_DISABLECPU1 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU1)
151#define S_BCM1480_SYS_DISABLECPU2 58
152#define M_BCM1480_SYS_DISABLECPU2 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU2)
153#define S_BCM1480_SYS_DISABLECPU3 59
154#define M_BCM1480_SYS_DISABLECPU3 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU3)
155
156#define M_BCM1480_SYS_SB_SOFTRES _SB_MAKEMASK1(60)
157#define M_BCM1480_SYS_EXT_RESET _SB_MAKEMASK1(61)
158#define M_BCM1480_SYS_SYSTEM_RESET _SB_MAKEMASK1(62)
159#define M_BCM1480_SYS_SW_FLAG _SB_MAKEMASK1(63)
160
161/*
162 * Scratch Register (Table 16)
163 * Register: SCD_SYSTEM_SCRATCH
164 * Same as BCM1250
165 */
166
167
168/*
169 * Mailbox Registers (Table 17)
170 * Registers: SCD_MBOX_{0,1}_CPU_x
171 * Same as BCM1250
172 */
173
174
175/*
176 * See bcm1480_int.h for interrupt mapper registers.
177 */
178
179
180/*
181 * Watchdog Timer Initial Count Registers (Table 23)
182 * Registers: SCD_WDOG_INIT_CNT_x
183 *
184 * The watchdogs are almost the same as the 1250, except
185 * the configuration register has more bits to control the
186 * other CPUs.
187 */
188
189
190/*
191 * Watchdog Timer Configuration Registers (Table 25)
192 * Registers: SCD_WDOG_CFG_x
193 */
194
195#define M_BCM1480_SCD_WDOG_ENABLE _SB_MAKEMASK1(0)
196
197#define S_BCM1480_SCD_WDOG_RESET_TYPE 2
198#define M_BCM1480_SCD_WDOG_RESET_TYPE _SB_MAKEMASK(5,S_BCM1480_SCD_WDOG_RESET_TYPE)
199#define V_BCM1480_SCD_WDOG_RESET_TYPE(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_WDOG_RESET_TYPE)
200#define G_BCM1480_SCD_WDOG_RESET_TYPE(x) _SB_GETVALUE(x,S_BCM1480_SCD_WDOG_RESET_TYPE,M_BCM1480_SCD_WDOG_RESET_TYPE)
201
202#define K_BCM1480_SCD_WDOG_RESET_FULL 0 /* actually, (x & 1) == 0 */
203#define K_BCM1480_SCD_WDOG_RESET_SOFT 1
204#define K_BCM1480_SCD_WDOG_RESET_CPU0 3
205#define K_BCM1480_SCD_WDOG_RESET_CPU1 5
206#define K_BCM1480_SCD_WDOG_RESET_CPU2 9
207#define K_BCM1480_SCD_WDOG_RESET_CPU3 17
208#define K_BCM1480_SCD_WDOG_RESET_ALL_CPUS 31
209
210
211#define M_BCM1480_SCD_WDOG_HAS_RESET _SB_MAKEMASK1(8)
212
213/*
214 * General Timer Initial Count Registers (Table 26)
215 * Registers: SCD_TIMER_INIT_x
216 *
217 * The timer registers are the same as the BCM1250
218 */
219
220
221/*
222 * ZBbus Count Register (Table 29)
223 * Register: ZBBUS_CYCLE_COUNT
224 *
225 * Same as BCM1250
226 */
227
228/*
229 * ZBbus Compare Registers (Table 30)
230 * Registers: ZBBUS_CYCLE_CPx
231 *
232 * Same as BCM1250
233 */
234
235
236/*
237 * System Performance Counter Configuration Register (Table 31)
238 * Register: PERF_CNT_CFG_0
239 *
240 * Since the clear/enable bits are moved compared to the
241 * 1250 and there are more fields, this register will be BCM1480 specific.
242 */
243
244#define S_BCM1480_SPC_CFG_SRC0 0
245#define M_BCM1480_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC0)
246#define V_BCM1480_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC0)
247#define G_BCM1480_SPC_CFG_SRC0(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC0,M_BCM1480_SPC_CFG_SRC0)
248
249#define S_BCM1480_SPC_CFG_SRC1 8
250#define M_BCM1480_SPC_CFG_SRC1 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC1)
251#define V_BCM1480_SPC_CFG_SRC1(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC1)
252#define G_BCM1480_SPC_CFG_SRC1(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC1,M_BCM1480_SPC_CFG_SRC1)
253
254#define S_BCM1480_SPC_CFG_SRC2 16
255#define M_BCM1480_SPC_CFG_SRC2 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC2)
256#define V_BCM1480_SPC_CFG_SRC2(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC2)
257#define G_BCM1480_SPC_CFG_SRC2(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC2,M_BCM1480_SPC_CFG_SRC2)
258
259#define S_BCM1480_SPC_CFG_SRC3 24
260#define M_BCM1480_SPC_CFG_SRC3 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC3)
261#define V_BCM1480_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC3)
262#define G_BCM1480_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC3,M_BCM1480_SPC_CFG_SRC3)
263
264#define S_BCM1480_SPC_CFG_SRC4 32
265#define M_BCM1480_SPC_CFG_SRC4 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC4)
266#define V_BCM1480_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC4)
267#define G_BCM1480_SPC_CFG_SRC4(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC4,M_BCM1480_SPC_CFG_SRC4)
268
269#define S_BCM1480_SPC_CFG_SRC5 40
270#define M_BCM1480_SPC_CFG_SRC5 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC5)
271#define V_BCM1480_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC5)
272#define G_BCM1480_SPC_CFG_SRC5(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC5,M_BCM1480_SPC_CFG_SRC5)
273
274#define S_BCM1480_SPC_CFG_SRC6 48
275#define M_BCM1480_SPC_CFG_SRC6 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC6)
276#define V_BCM1480_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC6)
277#define G_BCM1480_SPC_CFG_SRC6(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC6,M_BCM1480_SPC_CFG_SRC6)
278
279#define S_BCM1480_SPC_CFG_SRC7 56
280#define M_BCM1480_SPC_CFG_SRC7 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC7)
281#define V_BCM1480_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC7)
282#define G_BCM1480_SPC_CFG_SRC7(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC7,M_BCM1480_SPC_CFG_SRC7)
283
284/*
285 * System Performance Counter Control Register (Table 32)
286 * Register: PERF_CNT_CFG_1
287 * BCM1480 specific
288 */
289
290#define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0)
291#define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1)
292
293/*
294 * System Performance Counters (Table 33)
295 * Registers: PERF_CNT_x
296 */
297
298#define S_BCM1480_SPC_CNT_COUNT 0
299#define M_BCM1480_SPC_CNT_COUNT _SB_MAKEMASK(40,S_BCM1480_SPC_CNT_COUNT)
300#define V_BCM1480_SPC_CNT_COUNT(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CNT_COUNT)
301#define G_BCM1480_SPC_CNT_COUNT(x) _SB_GETVALUE(x,S_BCM1480_SPC_CNT_COUNT,M_BCM1480_SPC_CNT_COUNT)
302
303#define M_BCM1480_SPC_CNT_OFLOW _SB_MAKEMASK1(40)
304
305
306/*
307 * Bus Watcher Error Status Register (Tables 36, 37)
308 * Registers: BUS_ERR_STATUS, BUS_ERR_STATUS_DEBUG
309 * Same as BCM1250.
310 */
311
312/*
313 * Bus Watcher Error Data Registers (Table 38)
314 * Registers: BUS_ERR_DATA_x
315 * Same as BCM1250.
316 */
317
318/*
319 * Bus Watcher L2 ECC Counter Register (Table 39)
320 * Register: BUS_L2_ERRORS
321 * Same as BCM1250.
322 */
323
324
325/*
326 * Bus Watcher Memory and I/O Error Counter Register (Table 40)
327 * Register: BUS_MEM_IO_ERRORS
328 * Same as BCM1250.
329 */
330
331
332/*
333 * Address Trap Registers
334 *
335 * Register layout same as BCM1250, almost. The bus agents
336 * are different, and the address trap configuration bits are
337 * slightly different.
338 */
339
340#define M_BCM1480_ATRAP_INDEX _SB_MAKEMASK(4,0)
341#define M_BCM1480_ATRAP_ADDRESS _SB_MAKEMASK(40,0)
342
343#define S_BCM1480_ATRAP_CFG_CNT 0
344#define M_BCM1480_ATRAP_CFG_CNT _SB_MAKEMASK(3,S_BCM1480_ATRAP_CFG_CNT)
345#define V_BCM1480_ATRAP_CFG_CNT(x) _SB_MAKEVALUE(x,S_BCM1480_ATRAP_CFG_CNT)
346#define G_BCM1480_ATRAP_CFG_CNT(x) _SB_GETVALUE(x,S_BCM1480_ATRAP_CFG_CNT,M_BCM1480_ATRAP_CFG_CNT)
347
348#define M_BCM1480_ATRAP_CFG_WRITE _SB_MAKEMASK1(3)
349#define M_BCM1480_ATRAP_CFG_ALL _SB_MAKEMASK1(4)
350#define M_BCM1480_ATRAP_CFG_INV _SB_MAKEMASK1(5)
351#define M_BCM1480_ATRAP_CFG_USESRC _SB_MAKEMASK1(6)
352#define M_BCM1480_ATRAP_CFG_SRCINV _SB_MAKEMASK1(7)
353
354#define S_BCM1480_ATRAP_CFG_AGENTID 8
355#define M_BCM1480_ATRAP_CFG_AGENTID _SB_MAKEMASK(4,S_BCM1480_ATRAP_CFG_AGENTID)
356#define V_BCM1480_ATRAP_CFG_AGENTID(x) _SB_MAKEVALUE(x,S_BCM1480_ATRAP_CFG_AGENTID)
357#define G_BCM1480_ATRAP_CFG_AGENTID(x) _SB_GETVALUE(x,S_BCM1480_ATRAP_CFG_AGENTID,M_BCM1480_ATRAP_CFG_AGENTID)
358
359
360#define K_BCM1480_BUS_AGENT_CPU0 0
361#define K_BCM1480_BUS_AGENT_CPU1 1
362#define K_BCM1480_BUS_AGENT_NC 2
363#define K_BCM1480_BUS_AGENT_IOB 3
364#define K_BCM1480_BUS_AGENT_SCD 4
365#define K_BCM1480_BUS_AGENT_L2C 6
366#define K_BCM1480_BUS_AGENT_MC 7
367#define K_BCM1480_BUS_AGENT_CPU2 8
368#define K_BCM1480_BUS_AGENT_CPU3 9
369#define K_BCM1480_BUS_AGENT_PM 10
370
371#define S_BCM1480_ATRAP_CFG_CATTR 12
372#define M_BCM1480_ATRAP_CFG_CATTR _SB_MAKEMASK(2,S_BCM1480_ATRAP_CFG_CATTR)
373#define V_BCM1480_ATRAP_CFG_CATTR(x) _SB_MAKEVALUE(x,S_BCM1480_ATRAP_CFG_CATTR)
374#define G_BCM1480_ATRAP_CFG_CATTR(x) _SB_GETVALUE(x,S_BCM1480_ATRAP_CFG_CATTR,M_BCM1480_ATRAP_CFG_CATTR)
375
376#define K_BCM1480_ATRAP_CFG_CATTR_IGNORE 0
377#define K_BCM1480_ATRAP_CFG_CATTR_UNC 1
378#define K_BCM1480_ATRAP_CFG_CATTR_NONCOH 2
379#define K_BCM1480_ATRAP_CFG_CATTR_COHERENT 3
380
381#define M_BCM1480_ATRAP_CFG_CATTRINV _SB_MAKEMASK1(14)
382
383
384/*
385 * Trace Event Registers (Table 47)
386 * Same as BCM1250.
387 */
388
389/*
390 * Trace Sequence Control Registers (Table 48)
391 * Registers: TRACE_SEQUENCE_x
392 *
393 * Same as BCM1250 except for two new fields.
394 */
395
396
397#define M_BCM1480_SCD_TRSEQ_TID_MATCH_EN _SB_MAKEMASK1(25)
398
399#define S_BCM1480_SCD_TRSEQ_SWFUNC 26
400#define M_BCM1480_SCD_TRSEQ_SWFUNC _SB_MAKEMASK(2,S_BCM1480_SCD_TRSEQ_SWFUNC)
401#define V_BCM1480_SCD_TRSEQ_SWFUNC(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRSEQ_SWFUNC)
402#define G_BCM1480_SCD_TRSEQ_SWFUNC(x) _SB_GETVALUE(x,S_BCM1480_SCD_TRSEQ_SWFUNC,M_BCM1480_SCD_TRSEQ_SWFUNC)
403
404/*
405 * Trace Control Register (Table 49)
406 * Register: TRACE_CFG
407 *
408 * Bits 0..8 are the same as the BCM1250, rest are different.
409 * Entire register is redefined below.
410 */
411
412#define M_BCM1480_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
413#define M_BCM1480_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
414#define M_BCM1480_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
415#define M_BCM1480_SCD_TRACE_CFG_STOP _SB_MAKEMASK1(3)
416#define M_BCM1480_SCD_TRACE_CFG_FREEZE _SB_MAKEMASK1(4)
417#define M_BCM1480_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
418#define M_BCM1480_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
419#define M_BCM1480_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
420#define M_BCM1480_SCD_TRACE_CFG_FORCE_CNT _SB_MAKEMASK1(8)
421
422#define S_BCM1480_SCD_TRACE_CFG_MODE 16
423#define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2,S_BCM1480_SCD_TRACE_CFG_MODE)
424#define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_MODE)
425#define G_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_GETVALUE(x,S_BCM1480_SCD_TRACE_CFG_MODE,M_BCM1480_SCD_TRACE_CFG_MODE)
426
427#define K_BCM1480_SCD_TRACE_CFG_MODE_BLOCKERS 0
428#define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1
429#define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2
430
431#define S_BCM1480_SCD_TRACE_CFG_CUR_ADDR 24
432#define M_BCM1480_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
433#define V_BCM1480_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
434#define G_BCM1480_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR,M_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
435
436#endif /* _BCM1480_SCD_H */
diff --git a/include/asm-mips/sibyte/bigsur.h b/include/asm-mips/sibyte/bigsur.h
new file mode 100644
index 000000000000..ebefe797fc1d
--- /dev/null
+++ b/include/asm-mips/sibyte/bigsur.h
@@ -0,0 +1,49 @@
1/*
2 * Copyright (C) 2000,2001,2002,2003,2004 Broadcom 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 2
7 * of the License, or (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_SIBYTE_BIGSUR_H
19#define __ASM_SIBYTE_BIGSUR_H
20
21#include <asm/sibyte/sb1250.h>
22#include <asm/sibyte/bcm1480_int.h>
23
24#ifdef CONFIG_SIBYTE_BIGSUR
25#define SIBYTE_BOARD_NAME "BCM91x80A/B (BigSur)"
26#define SIBYTE_HAVE_PCMCIA 1
27#define SIBYTE_HAVE_IDE 1
28#endif
29
30/* Generic bus chip selects */
31#define LEDS_CS 3
32#define LEDS_PHYS 0x100a0000
33
34#ifdef SIBYTE_HAVE_IDE
35#define IDE_CS 4
36#define IDE_PHYS 0x100b0000
37#define K_GPIO_GB_IDE 4
38#define K_INT_GB_IDE (K_INT_GPIO_0 + K_GPIO_GB_IDE)
39#endif
40
41#ifdef SIBYTE_HAVE_PCMCIA
42#define PCMCIA_CS 6
43#define PCMCIA_PHYS 0x11000000
44#define K_GPIO_PC_READY 9
45#define K_INT_PC_READY (K_INT_GPIO_0 + K_GPIO_PC_READY)
46#endif
47
48#endif /* __ASM_SIBYTE_BIGSUR_H */
49
diff --git a/include/asm-mips/sibyte/board.h b/include/asm-mips/sibyte/board.h
index d7b11b6c7c32..900edcbeec37 100644
--- a/include/asm-mips/sibyte/board.h
+++ b/include/asm-mips/sibyte/board.h
@@ -21,8 +21,6 @@
21 21
22#include <linux/config.h> 22#include <linux/config.h>
23 23
24#ifdef CONFIG_SIBYTE_BOARD
25
26#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \ 24#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \
27 defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \ 25 defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \
28 defined(CONFIG_SIBYTE_LITTLESUR) 26 defined(CONFIG_SIBYTE_LITTLESUR)
@@ -37,6 +35,10 @@
37#include <asm/sibyte/carmel.h> 35#include <asm/sibyte/carmel.h>
38#endif 36#endif
39 37
38#ifdef CONFIG_SIBYTE_BIGSUR
39#include <asm/sibyte/bigsur.h>
40#endif
41
40#ifdef __ASSEMBLY__ 42#ifdef __ASSEMBLY__
41 43
42#ifdef LEDS_PHYS 44#ifdef LEDS_PHYS
@@ -54,16 +56,6 @@
54#define setleds(t0,t1,c0,c1,c2,c3) 56#define setleds(t0,t1,c0,c1,c2,c3)
55#endif /* LEDS_PHYS */ 57#endif /* LEDS_PHYS */
56 58
57#else
58
59#ifdef LEDS_PHYS
60extern void setleds(char *str);
61#else
62#define setleds(s) do { } while (0)
63#endif /* LEDS_PHYS */
64
65#endif /* __ASSEMBLY__ */ 59#endif /* __ASSEMBLY__ */
66 60
67#endif /* CONFIG_SIBYTE_BOARD */
68
69#endif /* _SIBYTE_BOARD_H */ 61#endif /* _SIBYTE_BOARD_H */
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h
index d62da4e2dd36..a474c29cd701 100644
--- a/include/asm-mips/sibyte/sb1250.h
+++ b/include/asm-mips/sibyte/sb1250.h
@@ -27,6 +27,9 @@
27 27
28#define SB1250_NR_IRQS 64 28#define SB1250_NR_IRQS 64
29 29
30#define BCM1480_NR_IRQS 128
31#define BCM1480_NR_IRQS_HALF 64
32
30#define SB1250_DUART_MINOR_BASE 64 33#define SB1250_DUART_MINOR_BASE 64
31 34
32#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
@@ -35,6 +38,7 @@
35 38
36/* For revision/pass information */ 39/* For revision/pass information */
37#include <asm/sibyte/sb1250_scd.h> 40#include <asm/sibyte/sb1250_scd.h>
41#include <asm/sibyte/bcm1480_scd.h>
38extern unsigned int sb1_pass; 42extern unsigned int sb1_pass;
39extern unsigned int soc_pass; 43extern unsigned int soc_pass;
40extern unsigned int soc_type; 44extern unsigned int soc_type;
@@ -46,6 +50,13 @@ extern unsigned long sb1250_gettimeoffset(void);
46extern void sb1250_mask_irq(int cpu, int irq); 50extern void sb1250_mask_irq(int cpu, int irq);
47extern void sb1250_unmask_irq(int cpu, int irq); 51extern void sb1250_unmask_irq(int cpu, int irq);
48extern void sb1250_smp_finish(void); 52extern void sb1250_smp_finish(void);
53
54extern void bcm1480_time_init(void);
55extern unsigned long bcm1480_gettimeoffset(void);
56extern void bcm1480_mask_irq(int cpu, int irq);
57extern void bcm1480_unmask_irq(int cpu, int irq);
58extern void bcm1480_smp_finish(void);
59
49extern void prom_printf(char *fmt, ...); 60extern void prom_printf(char *fmt, ...);
50 61
51#define AT_spin \ 62#define AT_spin \
@@ -58,6 +69,6 @@ extern void prom_printf(char *fmt, ...);
58 69
59#endif 70#endif
60 71
61#define IOADDR(a) (IO_BASE + (a)) 72#define IOADDR(a) ((volatile void __iomem *)(IO_BASE + (a)))
62 73
63#endif 74#endif
diff --git a/include/asm-mips/sibyte/sb1250_defs.h b/include/asm-mips/sibyte/sb1250_defs.h
index 40ef97c76c8b..335dbaf1d831 100644
--- a/include/asm-mips/sibyte/sb1250_defs.h
+++ b/include/asm-mips/sibyte/sb1250_defs.h
@@ -8,8 +8,6 @@
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg
12 *
13 ********************************************************************* 11 *********************************************************************
14 * 12 *
15 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003
@@ -97,13 +95,17 @@
97 * ordering, so be careful when adding support for new minor revs. 95 * ordering, so be careful when adding support for new minor revs.
98 ********************************************************************* */ 96 ********************************************************************* */
99 97
100#define SIBYTE_HDR_FMASK_1250_ALL 0x00000ff 98#define SIBYTE_HDR_FMASK_1250_ALL 0x000000ff
101#define SIBYTE_HDR_FMASK_1250_PASS1 0x0000001 99#define SIBYTE_HDR_FMASK_1250_PASS1 0x00000001
102#define SIBYTE_HDR_FMASK_1250_PASS2 0x0000002 100#define SIBYTE_HDR_FMASK_1250_PASS2 0x00000002
103#define SIBYTE_HDR_FMASK_1250_PASS3 0x0000004 101#define SIBYTE_HDR_FMASK_1250_PASS3 0x00000004
102
103#define SIBYTE_HDR_FMASK_112x_ALL 0x00000f00
104#define SIBYTE_HDR_FMASK_112x_PASS1 0x00000100
104 105
105#define SIBYTE_HDR_FMASK_112x_ALL 0x0000f00 106#define SIBYTE_HDR_FMASK_1480_ALL 0x0000f000
106#define SIBYTE_HDR_FMASK_112x_PASS1 0x0000100 107#define SIBYTE_HDR_FMASK_1480_PASS1 0x00001000
108#define SIBYTE_HDR_FMASK_1480_PASS2 0x00002000
107 109
108/* Bit mask for chip/revision. (use _ALL for all revisions of a chip). */ 110/* Bit mask for chip/revision. (use _ALL for all revisions of a chip). */
109#define SIBYTE_HDR_FMASK(chip, pass) \ 111#define SIBYTE_HDR_FMASK(chip, pass) \
@@ -111,8 +113,17 @@
111#define SIBYTE_HDR_FMASK_ALLREVS(chip) \ 113#define SIBYTE_HDR_FMASK_ALLREVS(chip) \
112 (SIBYTE_HDR_FMASK_ ## chip ## _ALL) 114 (SIBYTE_HDR_FMASK_ ## chip ## _ALL)
113 115
116/* Default constant value for all chips, all revisions */
114#define SIBYTE_HDR_FMASK_ALL \ 117#define SIBYTE_HDR_FMASK_ALL \
118 (SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL \
119 | SIBYTE_HDR_FMASK_1480_ALL)
120
121/* This one is used for the "original" BCM1250/BCM112x chips. We use this
122 to weed out constants and macros that do not exist on later chips like
123 the BCM1480 */
124#define SIBYTE_HDR_FMASK_1250_112x_ALL \
115 (SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL) 125 (SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL)
126#define SIBYTE_HDR_FMASK_1250_112x SIBYTE_HDR_FMASK_1250_112x_ALL
116 127
117#ifndef SIBYTE_HDR_FEATURES 128#ifndef SIBYTE_HDR_FEATURES
118#define SIBYTE_HDR_FEATURES SIBYTE_HDR_FMASK_ALL 129#define SIBYTE_HDR_FEATURES SIBYTE_HDR_FMASK_ALL
@@ -133,6 +144,12 @@
133#define SIBYTE_HDR_FEATURE_CHIP(chip) \ 144#define SIBYTE_HDR_FEATURE_CHIP(chip) \
134 (!! (SIBYTE_HDR_FMASK_ALLREVS(chip) & SIBYTE_HDR_FEATURES)) 145 (!! (SIBYTE_HDR_FMASK_ALLREVS(chip) & SIBYTE_HDR_FEATURES))
135 146
147/* True for all versions of the BCM1250 and BCM1125, but not true for
148 anything else */
149#define SIBYTE_HDR_FEATURE_1250_112x \
150 (SIBYTE_HDR_FEATURE_CHIP(1250) || SIBYTE_HDR_FEATURE_CHIP(112x))
151/* (!! (SIBYTE_HDR_FEATURES & SIBYHTE_HDR_FMASK_1250_112x)) */
152
136/* True if header features enabled for that rev or later, inclusive. */ 153/* True if header features enabled for that rev or later, inclusive. */
137#define SIBYTE_HDR_FEATURE(chip, pass) \ 154#define SIBYTE_HDR_FEATURE(chip, pass) \
138 (!! ((SIBYTE_HDR_FMASK(chip, pass) \ 155 (!! ((SIBYTE_HDR_FMASK(chip, pass) \
diff --git a/include/asm-mips/sibyte/sb1250_dma.h b/include/asm-mips/sibyte/sb1250_dma.h
index 3cdb48f50ed0..e6145f524fbd 100644
--- a/include/asm-mips/sibyte/sb1250_dma.h
+++ b/include/asm-mips/sibyte/sb1250_dma.h
@@ -7,9 +7,8 @@
7 * programming the SB1250's DMA controllers, both the data mover 7 * programming the SB1250's DMA controllers, both the data mover
8 * and the Ethernet DMA. 8 * and the Ethernet DMA.
9 * 9 *
10 * SB1250 specification level: User's manual 1/02/02 10 * SB1250 specification level: User's manual 10/21/02
11 * 11 * BCM1280 specification level: User's manual 11/24/03
12 * Author: Mitch Lichtenberg
13 * 12 *
14 ********************************************************************* 13 *********************************************************************
15 * 14 *
@@ -58,17 +57,17 @@
58#define M_DMA_RESERVED1 _SB_MAKEMASK1(2) 57#define M_DMA_RESERVED1 _SB_MAKEMASK1(2)
59 58
60#define S_DMA_DESC_TYPE _SB_MAKE64(1) 59#define S_DMA_DESC_TYPE _SB_MAKE64(1)
61#define M_DMA_DESC_TYPE _SB_MAKE64(2,S_DMA_DESC_TYPE) 60#define M_DMA_DESC_TYPE _SB_MAKEMASK(2,S_DMA_DESC_TYPE)
62#define V_DMA_DESC_TYPE(x) _SB_MAKEVALUE(x,S_DMA_DESC_TYPE) 61#define V_DMA_DESC_TYPE(x) _SB_MAKEVALUE(x,S_DMA_DESC_TYPE)
63#define G_DMA_DESC_TYPE(x) _SB_GETVALUE(x,S_DMA_DESC_TYPE,M_DMA_DESC_TYPE) 62#define G_DMA_DESC_TYPE(x) _SB_GETVALUE(x,S_DMA_DESC_TYPE,M_DMA_DESC_TYPE)
64 63
65#define K_DMA_DESC_TYPE_RING_AL 0 64#define K_DMA_DESC_TYPE_RING_AL 0
66#define K_DMA_DESC_TYPE_CHAIN_AL 1 65#define K_DMA_DESC_TYPE_CHAIN_AL 1
67 66
68#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 67#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
69#define K_DMA_DESC_TYPE_RING_UAL_WI 2 68#define K_DMA_DESC_TYPE_RING_UAL_WI 2
70#define K_DMA_DESC_TYPE_RING_UAL_RMW 3 69#define K_DMA_DESC_TYPE_RING_UAL_RMW 3
71#endif /* 1250 PASS3 || 112x PASS1 */ 70#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
72 71
73#define M_DMA_EOP_INT_EN _SB_MAKEMASK1(3) 72#define M_DMA_EOP_INT_EN _SB_MAKEMASK1(3)
74#define M_DMA_HWM_INT_EN _SB_MAKEMASK1(4) 73#define M_DMA_HWM_INT_EN _SB_MAKEMASK1(4)
@@ -111,11 +110,11 @@
111#define M_DMA_NO_DSCR_UPDT _SB_MAKEMASK1(4) 110#define M_DMA_NO_DSCR_UPDT _SB_MAKEMASK1(4)
112#define M_DMA_L2CA _SB_MAKEMASK1(5) 111#define M_DMA_L2CA _SB_MAKEMASK1(5)
113 112
114#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 113#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
115#define M_DMA_RX_XTRA_STATUS _SB_MAKEMASK1(6) 114#define M_DMA_RX_XTRA_STATUS _SB_MAKEMASK1(6)
116#define M_DMA_TX_CPU_PAUSE _SB_MAKEMASK1(6) 115#define M_DMA_TX_CPU_PAUSE _SB_MAKEMASK1(6)
117#define M_DMA_TX_FC_PAUSE_EN _SB_MAKEMASK1(7) 116#define M_DMA_TX_FC_PAUSE_EN _SB_MAKEMASK1(7)
118#endif /* 1250 PASS3 || 112x PASS1 */ 117#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
119 118
120#define M_DMA_MBZ1 _SB_MAKEMASK(6,15) 119#define M_DMA_MBZ1 _SB_MAKEMASK(6,15)
121 120
@@ -165,14 +164,14 @@
165#define S_DMA_CURDSCR_COUNT _SB_MAKE64(40) 164#define S_DMA_CURDSCR_COUNT _SB_MAKE64(40)
166#define M_DMA_CURDSCR_COUNT _SB_MAKEMASK(16,S_DMA_CURDSCR_COUNT) 165#define M_DMA_CURDSCR_COUNT _SB_MAKEMASK(16,S_DMA_CURDSCR_COUNT)
167 166
168#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 167#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
169#define M_DMA_TX_CH_PAUSE_ON _SB_MAKEMASK1(56) 168#define M_DMA_TX_CH_PAUSE_ON _SB_MAKEMASK1(56)
170#endif /* 1250 PASS3 || 112x PASS1 */ 169#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
171 170
172/* 171/*
173 * Receive Packet Drop Registers 172 * Receive Packet Drop Registers
174 */ 173 */
175#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 174#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
176#define S_DMA_OODLOST_RX _SB_MAKE64(0) 175#define S_DMA_OODLOST_RX _SB_MAKE64(0)
177#define M_DMA_OODLOST_RX _SB_MAKEMASK(16,S_DMA_OODLOST_RX) 176#define M_DMA_OODLOST_RX _SB_MAKEMASK(16,S_DMA_OODLOST_RX)
178#define G_DMA_OODLOST_RX(x) _SB_GETVALUE(x,S_DMA_OODLOST_RX,M_DMA_OODLOST_RX) 177#define G_DMA_OODLOST_RX(x) _SB_GETVALUE(x,S_DMA_OODLOST_RX,M_DMA_OODLOST_RX)
@@ -180,7 +179,7 @@
180#define S_DMA_EOP_COUNT_RX _SB_MAKE64(16) 179#define S_DMA_EOP_COUNT_RX _SB_MAKE64(16)
181#define M_DMA_EOP_COUNT_RX _SB_MAKEMASK(8,S_DMA_EOP_COUNT_RX) 180#define M_DMA_EOP_COUNT_RX _SB_MAKEMASK(8,S_DMA_EOP_COUNT_RX)
182#define G_DMA_EOP_COUNT_RX(x) _SB_GETVALUE(x,S_DMA_EOP_COUNT_RX,M_DMA_EOP_COUNT_RX) 181#define G_DMA_EOP_COUNT_RX(x) _SB_GETVALUE(x,S_DMA_EOP_COUNT_RX,M_DMA_EOP_COUNT_RX)
183#endif /* 1250 PASS3 || 112x PASS1 */ 182#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
184 183
185/* ********************************************************************* 184/* *********************************************************************
186 * DMA Descriptors 185 * DMA Descriptors
@@ -201,21 +200,21 @@
201 200
202#define M_DMA_DSCRA_A_ADDR_OFFSET (M_DMA_DSCRA_OFFSET | M_DMA_DSCRA_A_ADDR) 201#define M_DMA_DSCRA_A_ADDR_OFFSET (M_DMA_DSCRA_OFFSET | M_DMA_DSCRA_A_ADDR)
203 202
204#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 203#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
205#define S_DMA_DSCRA_A_ADDR_UA _SB_MAKE64(0) 204#define S_DMA_DSCRA_A_ADDR_UA _SB_MAKE64(0)
206#define M_DMA_DSCRA_A_ADDR_UA _SB_MAKEMASK(40,S_DMA_DSCRA_A_ADDR_UA) 205#define M_DMA_DSCRA_A_ADDR_UA _SB_MAKEMASK(40,S_DMA_DSCRA_A_ADDR_UA)
207#endif /* 1250 PASS3 || 112x PASS1 */ 206#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
208 207
209#define S_DMA_DSCRA_A_SIZE _SB_MAKE64(40) 208#define S_DMA_DSCRA_A_SIZE _SB_MAKE64(40)
210#define M_DMA_DSCRA_A_SIZE _SB_MAKEMASK(9,S_DMA_DSCRA_A_SIZE) 209#define M_DMA_DSCRA_A_SIZE _SB_MAKEMASK(9,S_DMA_DSCRA_A_SIZE)
211#define V_DMA_DSCRA_A_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRA_A_SIZE) 210#define V_DMA_DSCRA_A_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRA_A_SIZE)
212#define G_DMA_DSCRA_A_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRA_A_SIZE,M_DMA_DSCRA_A_SIZE) 211#define G_DMA_DSCRA_A_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRA_A_SIZE,M_DMA_DSCRA_A_SIZE)
213 212
214#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 213#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
215#define S_DMA_DSCRA_DSCR_CNT _SB_MAKE64(40) 214#define S_DMA_DSCRA_DSCR_CNT _SB_MAKE64(40)
216#define M_DMA_DSCRA_DSCR_CNT _SB_MAKEMASK(8,S_DMA_DSCRA_DSCR_CNT) 215#define M_DMA_DSCRA_DSCR_CNT _SB_MAKEMASK(8,S_DMA_DSCRA_DSCR_CNT)
217#define G_DMA_DSCRA_DSCR_CNT(x) _SB_GETVALUE(x,S_DMA_DSCRA_DSCR_CNT,M_DMA_DSCRA_DSCR_CNT) 216#define G_DMA_DSCRA_DSCR_CNT(x) _SB_GETVALUE(x,S_DMA_DSCRA_DSCR_CNT,M_DMA_DSCRA_DSCR_CNT)
218#endif /* 1250 PASS3 || 112x PASS1 */ 217#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
219 218
220#define M_DMA_DSCRA_INTERRUPT _SB_MAKEMASK1(49) 219#define M_DMA_DSCRA_INTERRUPT _SB_MAKEMASK1(49)
221#define M_DMA_DSCRA_OFFSETB _SB_MAKEMASK1(50) 220#define M_DMA_DSCRA_OFFSETB _SB_MAKEMASK1(50)
@@ -235,12 +234,12 @@
235#define V_DMA_DSCRB_OPTIONS(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_OPTIONS) 234#define V_DMA_DSCRB_OPTIONS(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_OPTIONS)
236#define G_DMA_DSCRB_OPTIONS(x) _SB_GETVALUE(x,S_DMA_DSCRB_OPTIONS,M_DMA_DSCRB_OPTIONS) 235#define G_DMA_DSCRB_OPTIONS(x) _SB_GETVALUE(x,S_DMA_DSCRB_OPTIONS,M_DMA_DSCRB_OPTIONS)
237 236
238#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 237#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
239#define S_DMA_DSCRB_A_SIZE _SB_MAKE64(8) 238#define S_DMA_DSCRB_A_SIZE _SB_MAKE64(8)
240#define M_DMA_DSCRB_A_SIZE _SB_MAKEMASK(14,S_DMA_DSCRB_A_SIZE) 239#define M_DMA_DSCRB_A_SIZE _SB_MAKEMASK(14,S_DMA_DSCRB_A_SIZE)
241#define V_DMA_DSCRB_A_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_A_SIZE) 240#define V_DMA_DSCRB_A_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_A_SIZE)
242#define G_DMA_DSCRB_A_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRB_A_SIZE,M_DMA_DSCRB_A_SIZE) 241#define G_DMA_DSCRB_A_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRB_A_SIZE,M_DMA_DSCRB_A_SIZE)
243#endif /* 1250 PASS3 || 112x PASS1 */ 242#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
244 243
245#define R_DMA_DSCRB_ADDR _SB_MAKE64(0x10) 244#define R_DMA_DSCRB_ADDR _SB_MAKE64(0x10)
246 245
@@ -255,12 +254,12 @@
255 254
256#define M_DMA_DSCRB_B_VALID _SB_MAKEMASK1(49) 255#define M_DMA_DSCRB_B_VALID _SB_MAKEMASK1(49)
257 256
258#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 257#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
259#define S_DMA_DSCRB_PKT_SIZE_MSB _SB_MAKE64(48) 258#define S_DMA_DSCRB_PKT_SIZE_MSB _SB_MAKE64(48)
260#define M_DMA_DSCRB_PKT_SIZE_MSB _SB_MAKEMASK(2,S_DMA_DSCRB_PKT_SIZE_MSB) 259#define M_DMA_DSCRB_PKT_SIZE_MSB _SB_MAKEMASK(2,S_DMA_DSCRB_PKT_SIZE_MSB)
261#define V_DMA_DSCRB_PKT_SIZE_MSB(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_PKT_SIZE_MSB) 260#define V_DMA_DSCRB_PKT_SIZE_MSB(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_PKT_SIZE_MSB)
262#define G_DMA_DSCRB_PKT_SIZE_MSB(x) _SB_GETVALUE(x,S_DMA_DSCRB_PKT_SIZE_MSB,M_DMA_DSCRB_PKT_SIZE_MSB) 261#define G_DMA_DSCRB_PKT_SIZE_MSB(x) _SB_GETVALUE(x,S_DMA_DSCRB_PKT_SIZE_MSB,M_DMA_DSCRB_PKT_SIZE_MSB)
263#endif /* 1250 PASS3 || 112x PASS1 */ 262#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
264 263
265#define S_DMA_DSCRB_PKT_SIZE _SB_MAKE64(50) 264#define S_DMA_DSCRB_PKT_SIZE _SB_MAKE64(50)
266#define M_DMA_DSCRB_PKT_SIZE _SB_MAKEMASK(14,S_DMA_DSCRB_PKT_SIZE) 265#define M_DMA_DSCRB_PKT_SIZE _SB_MAKEMASK(14,S_DMA_DSCRB_PKT_SIZE)
@@ -282,15 +281,16 @@
282#define M_DMA_ETHRX_BADIP4CS _SB_MAKEMASK1(51) 281#define M_DMA_ETHRX_BADIP4CS _SB_MAKEMASK1(51)
283#define M_DMA_ETHRX_DSCRERR _SB_MAKEMASK1(52) 282#define M_DMA_ETHRX_DSCRERR _SB_MAKEMASK1(52)
284 283
285#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 284#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
286/* Note: BADTCPCS is actually in DSCR_B options field */ 285/* Note: This bit is in the DSCR_B options field */
287#define M_DMA_ETHRX_BADTCPCS _SB_MAKEMASK1(0) 286#define M_DMA_ETHRX_BADTCPCS _SB_MAKEMASK1(0)
288#endif /* 1250 PASS2 || 112x PASS1 */ 287#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
289 288
290#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 289#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
290/* Note: These bits are in the DSCR_B options field */
291#define M_DMA_ETH_VLAN_FLAG _SB_MAKEMASK1(1) 291#define M_DMA_ETH_VLAN_FLAG _SB_MAKEMASK1(1)
292#define M_DMA_ETH_CRC_FLAG _SB_MAKEMASK1(2) 292#define M_DMA_ETH_CRC_FLAG _SB_MAKEMASK1(2)
293#endif /* 1250 PASS3 || 112x PASS1 */ 293#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
294 294
295#define S_DMA_ETHRX_RXCH 53 295#define S_DMA_ETHRX_RXCH 53
296#define M_DMA_ETHRX_RXCH _SB_MAKEMASK(2,S_DMA_ETHRX_RXCH) 296#define M_DMA_ETHRX_RXCH _SB_MAKEMASK(2,S_DMA_ETHRX_RXCH)
@@ -438,7 +438,7 @@
438 M_DM_CUR_DSCR_DSCR_COUNT) 438 M_DM_CUR_DSCR_DSCR_COUNT)
439 439
440 440
441#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 441#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
442/* 442/*
443 * Data Mover Channel Partial Result Registers 443 * Data Mover Channel Partial Result Registers
444 * Register: DM_PARTIAL_0 444 * Register: DM_PARTIAL_0
@@ -459,10 +459,10 @@
459 M_DM_PARTIAL_TCPCS_PARTIAL) 459 M_DM_PARTIAL_TCPCS_PARTIAL)
460 460
461#define M_DM_PARTIAL_ODD_BYTE _SB_MAKEMASK1(48) 461#define M_DM_PARTIAL_ODD_BYTE _SB_MAKEMASK1(48)
462#endif /* 1250 PASS3 || 112x PASS1 */ 462#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
463 463
464 464
465#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 465#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
466/* 466/*
467 * Data Mover CRC Definition Registers 467 * Data Mover CRC Definition Registers
468 * Register: CRC_DEF_0 468 * Register: CRC_DEF_0
@@ -479,10 +479,10 @@
479#define V_CRC_DEF_CRC_POLY(r) _SB_MAKEVALUE(r,S_CRC_DEF_CRC_POLY) 479#define V_CRC_DEF_CRC_POLY(r) _SB_MAKEVALUE(r,S_CRC_DEF_CRC_POLY)
480#define G_CRC_DEF_CRC_POLY(r) _SB_GETVALUE(r,S_CRC_DEF_CRC_POLY,\ 480#define G_CRC_DEF_CRC_POLY(r) _SB_GETVALUE(r,S_CRC_DEF_CRC_POLY,\
481 M_CRC_DEF_CRC_POLY) 481 M_CRC_DEF_CRC_POLY)
482#endif /* 1250 PASS3 || 112x PASS1 */ 482#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
483 483
484 484
485#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 485#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
486/* 486/*
487 * Data Mover CRC/Checksum Definition Registers 487 * Data Mover CRC/Checksum Definition Registers
488 * Register: CTCP_DEF_0 488 * Register: CTCP_DEF_0
@@ -511,7 +511,7 @@
511#define K_CTCP_DEF_CRC_WIDTH_1 2 511#define K_CTCP_DEF_CRC_WIDTH_1 2
512 512
513#define M_CTCP_DEF_CRC_BIT_ORDER _SB_MAKEMASK1(50) 513#define M_CTCP_DEF_CRC_BIT_ORDER _SB_MAKEMASK1(50)
514#endif /* 1250 PASS3 || 112x PASS1 */ 514#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
515 515
516 516
517/* 517/*
@@ -560,12 +560,12 @@
560#define M_DM_DSCRA_L2C_DEST _SB_MAKEMASK1(50) 560#define M_DM_DSCRA_L2C_DEST _SB_MAKEMASK1(50)
561#define M_DM_DSCRA_L2C_SRC _SB_MAKEMASK1(51) 561#define M_DM_DSCRA_L2C_SRC _SB_MAKEMASK1(51)
562 562
563#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 563#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
564#define M_DM_DSCRA_RD_BKOFF _SB_MAKEMASK1(52) 564#define M_DM_DSCRA_RD_BKOFF _SB_MAKEMASK1(52)
565#define M_DM_DSCRA_WR_BKOFF _SB_MAKEMASK1(53) 565#define M_DM_DSCRA_WR_BKOFF _SB_MAKEMASK1(53)
566#endif /* 1250 PASS2 || 112x PASS1 */ 566#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
567 567
568#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 568#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
569#define M_DM_DSCRA_TCPCS_EN _SB_MAKEMASK1(54) 569#define M_DM_DSCRA_TCPCS_EN _SB_MAKEMASK1(54)
570#define M_DM_DSCRA_TCPCS_RES _SB_MAKEMASK1(55) 570#define M_DM_DSCRA_TCPCS_RES _SB_MAKEMASK1(55)
571#define M_DM_DSCRA_TCPCS_AP _SB_MAKEMASK1(56) 571#define M_DM_DSCRA_TCPCS_AP _SB_MAKEMASK1(56)
@@ -574,7 +574,7 @@
574#define M_DM_DSCRA_CRC_AP _SB_MAKEMASK1(59) 574#define M_DM_DSCRA_CRC_AP _SB_MAKEMASK1(59)
575#define M_DM_DSCRA_CRC_DFN _SB_MAKEMASK1(60) 575#define M_DM_DSCRA_CRC_DFN _SB_MAKEMASK1(60)
576#define M_DM_DSCRA_CRC_XBIT _SB_MAKEMASK1(61) 576#define M_DM_DSCRA_CRC_XBIT _SB_MAKEMASK1(61)
577#endif /* 1250 PASS3 || 112x PASS1 */ 577#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
578 578
579#define M_DM_DSCRA_RESERVED2 _SB_MAKEMASK(3,61) 579#define M_DM_DSCRA_RESERVED2 _SB_MAKEMASK(3,61)
580 580
diff --git a/include/asm-mips/sibyte/sb1250_genbus.h b/include/asm-mips/sibyte/sb1250_genbus.h
index f1f509f295c4..1b5cbc5c6454 100644
--- a/include/asm-mips/sibyte/sb1250_genbus.h
+++ b/include/asm-mips/sibyte/sb1250_genbus.h
@@ -6,9 +6,8 @@
6 * This module contains constants and macros useful for 6 * This module contains constants and macros useful for
7 * manipulating the SB1250's Generic Bus interface 7 * manipulating the SB1250's Generic Bus interface
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 10/21/02
10 * 10 * BCM1280 specification level: User's Manual 11/14/03
11 * Author: Mitch Lichtenberg
12 * 11 *
13 ********************************************************************* 12 *********************************************************************
14 * 13 *
@@ -51,19 +50,21 @@
51#define M_IO_WIDTH_SEL _SB_MAKEMASK(2,S_IO_WIDTH_SEL) 50#define M_IO_WIDTH_SEL _SB_MAKEMASK(2,S_IO_WIDTH_SEL)
52#define K_IO_WIDTH_SEL_1 0 51#define K_IO_WIDTH_SEL_1 0
53#define K_IO_WIDTH_SEL_2 1 52#define K_IO_WIDTH_SEL_2 1
54#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 53#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
54 || SIBYTE_HDR_FEATURE_CHIP(1480)
55#define K_IO_WIDTH_SEL_1L 2 55#define K_IO_WIDTH_SEL_1L 2
56#endif /* 1250 PASS2 || 112x PASS1 */ 56#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
57#define K_IO_WIDTH_SEL_4 3 57#define K_IO_WIDTH_SEL_4 3
58#define V_IO_WIDTH_SEL(x) _SB_MAKEVALUE(x,S_IO_WIDTH_SEL) 58#define V_IO_WIDTH_SEL(x) _SB_MAKEVALUE(x,S_IO_WIDTH_SEL)
59#define G_IO_WIDTH_SEL(x) _SB_GETVALUE(x,S_IO_WIDTH_SEL,M_IO_WIDTH_SEL) 59#define G_IO_WIDTH_SEL(x) _SB_GETVALUE(x,S_IO_WIDTH_SEL,M_IO_WIDTH_SEL)
60 60
61#define S_IO_PARITY_ENA 4 61#define S_IO_PARITY_ENA 4
62#define M_IO_PARITY_ENA _SB_MAKEMASK1(S_IO_PARITY_ENA) 62#define M_IO_PARITY_ENA _SB_MAKEMASK1(S_IO_PARITY_ENA)
63#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 63#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
64 || SIBYTE_HDR_FEATURE_CHIP(1480)
64#define S_IO_BURST_EN 5 65#define S_IO_BURST_EN 5
65#define M_IO_BURST_EN _SB_MAKEMASK1(S_IO_BURST_EN) 66#define M_IO_BURST_EN _SB_MAKEMASK1(S_IO_BURST_EN)
66#endif /* 1250 PASS2 || 112x PASS1 */ 67#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
67#define S_IO_PARITY_ODD 6 68#define S_IO_PARITY_ODD 6
68#define M_IO_PARITY_ODD _SB_MAKEMASK1(S_IO_PARITY_ODD) 69#define M_IO_PARITY_ODD _SB_MAKEMASK1(S_IO_PARITY_ODD)
69#define S_IO_NONMUX 7 70#define S_IO_NONMUX 7
@@ -96,8 +97,11 @@
96 97
97#define S_IO_ADDRBASE 16 /* # bits to shift addr for this reg */ 98#define S_IO_ADDRBASE 16 /* # bits to shift addr for this reg */
98 99
100#define M_IO_BLK_CACHE _SB_MAKEMASK1(15)
101
102
99/* 103/*
100 * Generic Bus Region 0 Timing Registers (Table 11-7) 104 * Generic Bus Timing 0 Registers (Table 11-7)
101 */ 105 */
102 106
103#define S_IO_ALE_WIDTH 0 107#define S_IO_ALE_WIDTH 0
@@ -105,21 +109,23 @@
105#define V_IO_ALE_WIDTH(x) _SB_MAKEVALUE(x,S_IO_ALE_WIDTH) 109#define V_IO_ALE_WIDTH(x) _SB_MAKEVALUE(x,S_IO_ALE_WIDTH)
106#define G_IO_ALE_WIDTH(x) _SB_GETVALUE(x,S_IO_ALE_WIDTH,M_IO_ALE_WIDTH) 110#define G_IO_ALE_WIDTH(x) _SB_GETVALUE(x,S_IO_ALE_WIDTH,M_IO_ALE_WIDTH)
107 111
108#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 112#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
113 || SIBYTE_HDR_FEATURE_CHIP(1480)
109#define M_IO_EARLY_CS _SB_MAKEMASK1(3) 114#define M_IO_EARLY_CS _SB_MAKEMASK1(3)
110#endif /* 1250 PASS2 || 112x PASS1 */ 115#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
111 116
112#define S_IO_ALE_TO_CS 4 117#define S_IO_ALE_TO_CS 4
113#define M_IO_ALE_TO_CS _SB_MAKEMASK(2,S_IO_ALE_TO_CS) 118#define M_IO_ALE_TO_CS _SB_MAKEMASK(2,S_IO_ALE_TO_CS)
114#define V_IO_ALE_TO_CS(x) _SB_MAKEVALUE(x,S_IO_ALE_TO_CS) 119#define V_IO_ALE_TO_CS(x) _SB_MAKEVALUE(x,S_IO_ALE_TO_CS)
115#define G_IO_ALE_TO_CS(x) _SB_GETVALUE(x,S_IO_ALE_TO_CS,M_IO_ALE_TO_CS) 120#define G_IO_ALE_TO_CS(x) _SB_GETVALUE(x,S_IO_ALE_TO_CS,M_IO_ALE_TO_CS)
116 121
117#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 122#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
123 || SIBYTE_HDR_FEATURE_CHIP(1480)
118#define S_IO_BURST_WIDTH _SB_MAKE64(6) 124#define S_IO_BURST_WIDTH _SB_MAKE64(6)
119#define M_IO_BURST_WIDTH _SB_MAKEMASK(2,S_IO_BURST_WIDTH) 125#define M_IO_BURST_WIDTH _SB_MAKEMASK(2,S_IO_BURST_WIDTH)
120#define V_IO_BURST_WIDTH(x) _SB_MAKEVALUE(x,S_IO_BURST_WIDTH) 126#define V_IO_BURST_WIDTH(x) _SB_MAKEVALUE(x,S_IO_BURST_WIDTH)
121#define G_IO_BURST_WIDTH(x) _SB_GETVALUE(x,S_IO_BURST_WIDTH,M_IO_BURST_WIDTH) 127#define G_IO_BURST_WIDTH(x) _SB_GETVALUE(x,S_IO_BURST_WIDTH,M_IO_BURST_WIDTH)
122#endif /* 1250 PASS2 || 112x PASS1 */ 128#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
123 129
124#define S_IO_CS_WIDTH 8 130#define S_IO_CS_WIDTH 8
125#define M_IO_CS_WIDTH _SB_MAKEMASK(5,S_IO_CS_WIDTH) 131#define M_IO_CS_WIDTH _SB_MAKEMASK(5,S_IO_CS_WIDTH)
@@ -141,9 +147,10 @@
141#define V_IO_ALE_TO_WRITE(x) _SB_MAKEVALUE(x,S_IO_ALE_TO_WRITE) 147#define V_IO_ALE_TO_WRITE(x) _SB_MAKEVALUE(x,S_IO_ALE_TO_WRITE)
142#define G_IO_ALE_TO_WRITE(x) _SB_GETVALUE(x,S_IO_ALE_TO_WRITE,M_IO_ALE_TO_WRITE) 148#define G_IO_ALE_TO_WRITE(x) _SB_GETVALUE(x,S_IO_ALE_TO_WRITE,M_IO_ALE_TO_WRITE)
143 149
144#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 150#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
151 || SIBYTE_HDR_FEATURE_CHIP(1480)
145#define M_IO_RDY_SYNC _SB_MAKEMASK1(3) 152#define M_IO_RDY_SYNC _SB_MAKEMASK1(3)
146#endif /* 1250 PASS2 || 112x PASS1 */ 153#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
147 154
148#define S_IO_WRITE_WIDTH 4 155#define S_IO_WRITE_WIDTH 4
149#define M_IO_WRITE_WIDTH _SB_MAKEMASK(4,S_IO_WRITE_WIDTH) 156#define M_IO_WRITE_WIDTH _SB_MAKEMASK(4,S_IO_WRITE_WIDTH)
@@ -183,9 +190,127 @@
183#define M_IO_TIMEOUT_INT _SB_MAKEMASK1(10) 190#define M_IO_TIMEOUT_INT _SB_MAKEMASK1(10)
184#define M_IO_ILL_ADDR_INT _SB_MAKEMASK1(11) 191#define M_IO_ILL_ADDR_INT _SB_MAKEMASK1(11)
185#define M_IO_MULT_CS_INT _SB_MAKEMASK1(12) 192#define M_IO_MULT_CS_INT _SB_MAKEMASK1(12)
186#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 193#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
187#define M_IO_COH_ERR _SB_MAKEMASK1(14) 194#define M_IO_COH_ERR _SB_MAKEMASK1(14)
188#endif /* 1250 PASS2 || 112x PASS1 */ 195#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
196
197
198/*
199 * Generic Bus Output Drive Control Register 0 (Table 14-18)
200 */
201
202#define S_IO_SLEW0 0
203#define M_IO_SLEW0 _SB_MAKEMASK(2,S_IO_SLEW0)
204#define V_IO_SLEW0(x) _SB_MAKEVALUE(x,S_IO_SLEW0)
205#define G_IO_SLEW0(x) _SB_GETVALUE(x,S_IO_SLEW0,M_IO_SLEW0)
206
207#define S_IO_DRV_A 2
208#define M_IO_DRV_A _SB_MAKEMASK(2,S_IO_DRV_A)
209#define V_IO_DRV_A(x) _SB_MAKEVALUE(x,S_IO_DRV_A)
210#define G_IO_DRV_A(x) _SB_GETVALUE(x,S_IO_DRV_A,M_IO_DRV_A)
211
212#define S_IO_DRV_B 6
213#define M_IO_DRV_B _SB_MAKEMASK(2,S_IO_DRV_B)
214#define V_IO_DRV_B(x) _SB_MAKEVALUE(x,S_IO_DRV_B)
215#define G_IO_DRV_B(x) _SB_GETVALUE(x,S_IO_DRV_B,M_IO_DRV_B)
216
217#define S_IO_DRV_C 10
218#define M_IO_DRV_C _SB_MAKEMASK(2,S_IO_DRV_C)
219#define V_IO_DRV_C(x) _SB_MAKEVALUE(x,S_IO_DRV_C)
220#define G_IO_DRV_C(x) _SB_GETVALUE(x,S_IO_DRV_C,M_IO_DRV_C)
221
222#define S_IO_DRV_D 14
223#define M_IO_DRV_D _SB_MAKEMASK(2,S_IO_DRV_D)
224#define V_IO_DRV_D(x) _SB_MAKEVALUE(x,S_IO_DRV_D)
225#define G_IO_DRV_D(x) _SB_GETVALUE(x,S_IO_DRV_D,M_IO_DRV_D)
226
227/*
228 * Generic Bus Output Drive Control Register 1 (Table 14-19)
229 */
230
231#define S_IO_DRV_E 2
232#define M_IO_DRV_E _SB_MAKEMASK(2,S_IO_DRV_E)
233#define V_IO_DRV_E(x) _SB_MAKEVALUE(x,S_IO_DRV_E)
234#define G_IO_DRV_E(x) _SB_GETVALUE(x,S_IO_DRV_E,M_IO_DRV_E)
235
236#define S_IO_DRV_F 6
237#define M_IO_DRV_F _SB_MAKEMASK(2,S_IO_DRV_F)
238#define V_IO_DRV_F(x) _SB_MAKEVALUE(x,S_IO_DRV_F)
239#define G_IO_DRV_F(x) _SB_GETVALUE(x,S_IO_DRV_F,M_IO_DRV_F)
240
241#define S_IO_SLEW1 8
242#define M_IO_SLEW1 _SB_MAKEMASK(2,S_IO_SLEW1)
243#define V_IO_SLEW1(x) _SB_MAKEVALUE(x,S_IO_SLEW1)
244#define G_IO_SLEW1(x) _SB_GETVALUE(x,S_IO_SLEW1,M_IO_SLEW1)
245
246#define S_IO_DRV_G 10
247#define M_IO_DRV_G _SB_MAKEMASK(2,S_IO_DRV_G)
248#define V_IO_DRV_G(x) _SB_MAKEVALUE(x,S_IO_DRV_G)
249#define G_IO_DRV_G(x) _SB_GETVALUE(x,S_IO_DRV_G,M_IO_DRV_G)
250
251#define S_IO_SLEW2 12
252#define M_IO_SLEW2 _SB_MAKEMASK(2,S_IO_SLEW2)
253#define V_IO_SLEW2(x) _SB_MAKEVALUE(x,S_IO_SLEW2)
254#define G_IO_SLEW2(x) _SB_GETVALUE(x,S_IO_SLEW2,M_IO_SLEW2)
255
256#define S_IO_DRV_H 14
257#define M_IO_DRV_H _SB_MAKEMASK(2,S_IO_DRV_H)
258#define V_IO_DRV_H(x) _SB_MAKEVALUE(x,S_IO_DRV_H)
259#define G_IO_DRV_H(x) _SB_GETVALUE(x,S_IO_DRV_H,M_IO_DRV_H)
260
261/*
262 * Generic Bus Output Drive Control Register 2 (Table 14-20)
263 */
264
265#define S_IO_DRV_J 2
266#define M_IO_DRV_J _SB_MAKEMASK(2,S_IO_DRV_J)
267#define V_IO_DRV_J(x) _SB_MAKEVALUE(x,S_IO_DRV_J)
268#define G_IO_DRV_J(x) _SB_GETVALUE(x,S_IO_DRV_J,M_IO_DRV_J)
269
270#define S_IO_DRV_K 6
271#define M_IO_DRV_K _SB_MAKEMASK(2,S_IO_DRV_K)
272#define V_IO_DRV_K(x) _SB_MAKEVALUE(x,S_IO_DRV_K)
273#define G_IO_DRV_K(x) _SB_GETVALUE(x,S_IO_DRV_K,M_IO_DRV_K)
274
275#define S_IO_DRV_L 10
276#define M_IO_DRV_L _SB_MAKEMASK(2,S_IO_DRV_L)
277#define V_IO_DRV_L(x) _SB_MAKEVALUE(x,S_IO_DRV_L)
278#define G_IO_DRV_L(x) _SB_GETVALUE(x,S_IO_DRV_L,M_IO_DRV_L)
279
280#define S_IO_DRV_M 14
281#define M_IO_DRV_M _SB_MAKEMASK(2,S_IO_DRV_M)
282#define V_IO_DRV_M(x) _SB_MAKEVALUE(x,S_IO_DRV_M)
283#define G_IO_DRV_M(x) _SB_GETVALUE(x,S_IO_DRV_M,M_IO_DRV_M)
284
285/*
286 * Generic Bus Output Drive Control Register 3 (Table 14-21)
287 */
288
289#define S_IO_SLEW3 0
290#define M_IO_SLEW3 _SB_MAKEMASK(2,S_IO_SLEW3)
291#define V_IO_SLEW3(x) _SB_MAKEVALUE(x,S_IO_SLEW3)
292#define G_IO_SLEW3(x) _SB_GETVALUE(x,S_IO_SLEW3,M_IO_SLEW3)
293
294#define S_IO_DRV_N 2
295#define M_IO_DRV_N _SB_MAKEMASK(2,S_IO_DRV_N)
296#define V_IO_DRV_N(x) _SB_MAKEVALUE(x,S_IO_DRV_N)
297#define G_IO_DRV_N(x) _SB_GETVALUE(x,S_IO_DRV_N,M_IO_DRV_N)
298
299#define S_IO_DRV_P 6
300#define M_IO_DRV_P _SB_MAKEMASK(2,S_IO_DRV_P)
301#define V_IO_DRV_P(x) _SB_MAKEVALUE(x,S_IO_DRV_P)
302#define G_IO_DRV_P(x) _SB_GETVALUE(x,S_IO_DRV_P,M_IO_DRV_P)
303
304#define S_IO_DRV_Q 10
305#define M_IO_DRV_Q _SB_MAKEMASK(2,S_IO_DRV_Q)
306#define V_IO_DRV_Q(x) _SB_MAKEVALUE(x,S_IO_DRV_Q)
307#define G_IO_DRV_Q(x) _SB_GETVALUE(x,S_IO_DRV_Q,M_IO_DRV_Q)
308
309#define S_IO_DRV_R 14
310#define M_IO_DRV_R _SB_MAKEMASK(2,S_IO_DRV_R)
311#define V_IO_DRV_R(x) _SB_MAKEVALUE(x,S_IO_DRV_R)
312#define G_IO_DRV_R(x) _SB_GETVALUE(x,S_IO_DRV_R,M_IO_DRV_R)
313
189 314
190/* 315/*
191 * PCMCIA configuration register (Table 12-6) 316 * PCMCIA configuration register (Table 12-6)
@@ -202,6 +327,22 @@
202#define M_PCMCIA_CFG_RDYMASK _SB_MAKEMASK1(8) 327#define M_PCMCIA_CFG_RDYMASK _SB_MAKEMASK1(8)
203#define M_PCMCIA_CFG_PWRCTL _SB_MAKEMASK1(9) 328#define M_PCMCIA_CFG_PWRCTL _SB_MAKEMASK1(9)
204 329
330#if SIBYTE_HDR_FEATURE_CHIP(1480)
331#define S_PCMCIA_MODE 16
332#define M_PCMCIA_MODE _SB_MAKEMASK(3,S_PCMCIA_MODE)
333#define V_PCMCIA_MODE(x) _SB_MAKEVALUE(x,S_PCMCIA_MODE)
334#define G_PCMCIA_MODE(x) _SB_GETVALUE(x,S_PCMCIA_MODE,M_PCMCIA_MODE)
335
336#define K_PCMCIA_MODE_PCMA_NOB 0 /* standard PCMCIA "A", no "B" */
337#define K_PCMCIA_MODE_IDEA_NOB 1 /* IDE "A", no "B" */
338#define K_PCMCIA_MODE_PCMIOA_NOB 2 /* PCMCIA with I/O "A", no "B" */
339#define K_PCMCIA_MODE_PCMA_PCMB 4 /* standard PCMCIA "A", standard PCMCIA "B" */
340#define K_PCMCIA_MODE_IDEA_PCMB 5 /* IDE "A", standard PCMCIA "B" */
341#define K_PCMCIA_MODE_PCMA_IDEB 6 /* standard PCMCIA "A", IDE "B" */
342#define K_PCMCIA_MODE_IDEA_IDEB 7 /* IDE "A", IDE "B" */
343#endif
344
345
205/* 346/*
206 * PCMCIA status register (Table 12-7) 347 * PCMCIA status register (Table 12-7)
207 */ 348 */
@@ -272,5 +413,62 @@
272#define V_GPIO_INTR_TYPE14(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE14) 413#define V_GPIO_INTR_TYPE14(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE14)
273#define G_GPIO_INTR_TYPE14(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE14,M_GPIO_INTR_TYPE14) 414#define G_GPIO_INTR_TYPE14(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE14,M_GPIO_INTR_TYPE14)
274 415
416#if SIBYTE_HDR_FEATURE_CHIP(1480)
417
418/*
419 * GPIO Interrupt Additional Type Register
420 */
421
422#define K_GPIO_INTR_BOTHEDGE 0
423#define K_GPIO_INTR_RISEEDGE 1
424#define K_GPIO_INTR_UNPRED1 2
425#define K_GPIO_INTR_UNPRED2 3
426
427#define S_GPIO_INTR_ATYPEX(n) (((n)/2)*2)
428#define M_GPIO_INTR_ATYPEX(n) _SB_MAKEMASK(2,S_GPIO_INTR_ATYPEX(n))
429#define V_GPIO_INTR_ATYPEX(n,x) _SB_MAKEVALUE(x,S_GPIO_INTR_ATYPEX(n))
430#define G_GPIO_INTR_ATYPEX(n,x) _SB_GETVALUE(x,S_GPIO_INTR_ATYPEX(n),M_GPIO_INTR_ATYPEX(n))
431
432#define S_GPIO_INTR_ATYPE0 0
433#define M_GPIO_INTR_ATYPE0 _SB_MAKEMASK(2,S_GPIO_INTR_ATYPE0)
434#define V_GPIO_INTR_ATYPE0(x) _SB_MAKEVALUE(x,S_GPIO_INTR_ATYPE0)
435#define G_GPIO_INTR_ATYPE0(x) _SB_GETVALUE(x,S_GPIO_INTR_ATYPE0,M_GPIO_INTR_ATYPE0)
436
437#define S_GPIO_INTR_ATYPE2 2
438#define M_GPIO_INTR_ATYPE2 _SB_MAKEMASK(2,S_GPIO_INTR_ATYPE2)
439#define V_GPIO_INTR_ATYPE2(x) _SB_MAKEVALUE(x,S_GPIO_INTR_ATYPE2)
440#define G_GPIO_INTR_ATYPE2(x) _SB_GETVALUE(x,S_GPIO_INTR_ATYPE2,M_GPIO_INTR_ATYPE2)
441
442#define S_GPIO_INTR_ATYPE4 4
443#define M_GPIO_INTR_ATYPE4 _SB_MAKEMASK(2,S_GPIO_INTR_ATYPE4)
444#define V_GPIO_INTR_ATYPE4(x) _SB_MAKEVALUE(x,S_GPIO_INTR_ATYPE4)
445#define G_GPIO_INTR_ATYPE4(x) _SB_GETVALUE(x,S_GPIO_INTR_ATYPE4,M_GPIO_INTR_ATYPE4)
446
447#define S_GPIO_INTR_ATYPE6 6
448#define M_GPIO_INTR_ATYPE6 _SB_MAKEMASK(2,S_GPIO_INTR_ATYPE6)
449#define V_GPIO_INTR_ATYPE6(x) _SB_MAKEVALUE(x,S_GPIO_INTR_ATYPE6)
450#define G_GPIO_INTR_ATYPE6(x) _SB_GETVALUE(x,S_GPIO_INTR_ATYPE6,M_GPIO_INTR_ATYPE6)
451
452#define S_GPIO_INTR_ATYPE8 8
453#define M_GPIO_INTR_ATYPE8 _SB_MAKEMASK(2,S_GPIO_INTR_ATYPE8)
454#define V_GPIO_INTR_ATYPE8(x) _SB_MAKEVALUE(x,S_GPIO_INTR_ATYPE8)
455#define G_GPIO_INTR_ATYPE8(x) _SB_GETVALUE(x,S_GPIO_INTR_ATYPE8,M_GPIO_INTR_ATYPE8)
456
457#define S_GPIO_INTR_ATYPE10 10
458#define M_GPIO_INTR_ATYPE10 _SB_MAKEMASK(2,S_GPIO_INTR_ATYPE10)
459#define V_GPIO_INTR_ATYPE10(x) _SB_MAKEVALUE(x,S_GPIO_INTR_ATYPE10)
460#define G_GPIO_INTR_ATYPE10(x) _SB_GETVALUE(x,S_GPIO_INTR_ATYPE10,M_GPIO_INTR_ATYPE10)
461
462#define S_GPIO_INTR_ATYPE12 12
463#define M_GPIO_INTR_ATYPE12 _SB_MAKEMASK(2,S_GPIO_INTR_ATYPE12)
464#define V_GPIO_INTR_ATYPE12(x) _SB_MAKEVALUE(x,S_GPIO_INTR_ATYPE12)
465#define G_GPIO_INTR_ATYPE12(x) _SB_GETVALUE(x,S_GPIO_INTR_ATYPE12,M_GPIO_INTR_ATYPE12)
466
467#define S_GPIO_INTR_ATYPE14 14
468#define M_GPIO_INTR_ATYPE14 _SB_MAKEMASK(2,S_GPIO_INTR_ATYPE14)
469#define V_GPIO_INTR_ATYPE14(x) _SB_MAKEVALUE(x,S_GPIO_INTR_ATYPE14)
470#define G_GPIO_INTR_ATYPE14(x) _SB_GETVALUE(x,S_GPIO_INTR_ATYPE14,M_GPIO_INTR_ATYPE14)
471#endif
472
275 473
276#endif 474#endif
diff --git a/include/asm-mips/sibyte/sb1250_int.h b/include/asm-mips/sibyte/sb1250_int.h
index e173e2ea4c98..05c7b39f1b02 100644
--- a/include/asm-mips/sibyte/sb1250_int.h
+++ b/include/asm-mips/sibyte/sb1250_int.h
@@ -8,8 +8,6 @@
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg
12 *
13 ********************************************************************* 11 *********************************************************************
14 * 12 *
15 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003
@@ -47,6 +45,10 @@
47 * First, the interrupt numbers. 45 * First, the interrupt numbers.
48 */ 46 */
49 47
48#if SIBYTE_HDR_FEATURE_1250_112x
49
50#define K_INT_SOURCES 64
51
50#define K_INT_WATCHDOG_TIMER_0 0 52#define K_INT_WATCHDOG_TIMER_0 0
51#define K_INT_WATCHDOG_TIMER_1 1 53#define K_INT_WATCHDOG_TIMER_1 1
52#define K_INT_TIMER_0 2 54#define K_INT_TIMER_0 2
@@ -244,4 +246,6 @@
244#define M_LDTVECT_RAISEMBOX 0x40 246#define M_LDTVECT_RAISEMBOX 0x40
245 247
246 248
249#endif /* 1250/112x */
250
247#endif 251#endif
diff --git a/include/asm-mips/sibyte/sb1250_l2c.h b/include/asm-mips/sibyte/sb1250_l2c.h
index 8afe8e01581b..842f205094af 100644
--- a/include/asm-mips/sibyte/sb1250_l2c.h
+++ b/include/asm-mips/sibyte/sb1250_l2c.h
@@ -8,8 +8,6 @@
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg
12 *
13 ********************************************************************* 11 *********************************************************************
14 * 12 *
15 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003
@@ -89,8 +87,13 @@
89#define V_L2C_MGMT_WAY(x) _SB_MAKEVALUE(x,S_L2C_MGMT_WAY) 87#define V_L2C_MGMT_WAY(x) _SB_MAKEVALUE(x,S_L2C_MGMT_WAY)
90#define G_L2C_MGMT_WAY(x) _SB_GETVALUE(x,S_L2C_MGMT_WAY,M_L2C_MGMT_WAY) 88#define G_L2C_MGMT_WAY(x) _SB_GETVALUE(x,S_L2C_MGMT_WAY,M_L2C_MGMT_WAY)
91 89
92#define S_L2C_MGMT_TAG 21 90#define S_L2C_MGMT_ECC_DIAG 21
93#define M_L2C_MGMT_TAG _SB_MAKEMASK(6,S_L2C_MGMT_TAG) 91#define M_L2C_MGMT_ECC_DIAG _SB_MAKEMASK(2,S_L2C_MGMT_ECC_DIAG)
92#define V_L2C_MGMT_ECC_DIAG(x) _SB_MAKEVALUE(x,S_L2C_MGMT_ECC_DIAG)
93#define G_L2C_MGMT_ECC_DIAG(x) _SB_GETVALUE(x,S_L2C_MGMT_ECC_DIAG,M_L2C_MGMT_ECC_DIAG)
94
95#define S_L2C_MGMT_TAG 23
96#define M_L2C_MGMT_TAG _SB_MAKEMASK(4,S_L2C_MGMT_TAG)
94#define V_L2C_MGMT_TAG(x) _SB_MAKEVALUE(x,S_L2C_MGMT_TAG) 97#define V_L2C_MGMT_TAG(x) _SB_MAKEVALUE(x,S_L2C_MGMT_TAG)
95#define G_L2C_MGMT_TAG(x) _SB_GETVALUE(x,S_L2C_MGMT_TAG,M_L2C_MGMT_TAG) 98#define G_L2C_MGMT_TAG(x) _SB_GETVALUE(x,S_L2C_MGMT_TAG,M_L2C_MGMT_TAG)
96 99
diff --git a/include/asm-mips/sibyte/sb1250_ldt.h b/include/asm-mips/sibyte/sb1250_ldt.h
index f2617ded0a8f..7092535d1108 100644
--- a/include/asm-mips/sibyte/sb1250_ldt.h
+++ b/include/asm-mips/sibyte/sb1250_ldt.h
@@ -8,8 +8,6 @@
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg
12 *
13 ********************************************************************* 11 *********************************************************************
14 * 12 *
15 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003
diff --git a/include/asm-mips/sibyte/sb1250_mac.h b/include/asm-mips/sibyte/sb1250_mac.h
index 18e74e43f4a2..adfc688fa559 100644
--- a/include/asm-mips/sibyte/sb1250_mac.h
+++ b/include/asm-mips/sibyte/sb1250_mac.h
@@ -8,8 +8,6 @@
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg
12 *
13 ********************************************************************* 11 *********************************************************************
14 * 12 *
15 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003
@@ -81,7 +79,10 @@
81#define M_MAC_RESERVED1 _SB_MAKEMASK(8,9) 79#define M_MAC_RESERVED1 _SB_MAKEMASK(8,9)
82 80
83#define M_MAC_AP_STAT_EN _SB_MAKEMASK1(17) 81#define M_MAC_AP_STAT_EN _SB_MAKEMASK1(17)
84#define M_MAC_RESERVED2 _SB_MAKEMASK1(18) 82
83#if SIBYTE_HDR_FEATURE_CHIP(1480)
84#define M_MAC_TIMESTAMP _SB_MAKEMASK1(18)
85#endif
85#define M_MAC_DRP_ERRPKT_EN _SB_MAKEMASK1(19) 86#define M_MAC_DRP_ERRPKT_EN _SB_MAKEMASK1(19)
86#define M_MAC_DRP_FCSERRPKT_EN _SB_MAKEMASK1(20) 87#define M_MAC_DRP_FCSERRPKT_EN _SB_MAKEMASK1(20)
87#define M_MAC_DRP_CODEERRPKT_EN _SB_MAKEMASK1(21) 88#define M_MAC_DRP_CODEERRPKT_EN _SB_MAKEMASK1(21)
@@ -132,9 +133,9 @@
132#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44) 133#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44)
133#endif /* 1250 PASS2 || 112x PASS1 */ 134#endif /* 1250 PASS2 || 112x PASS1 */
134 135
135#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 136#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
136#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45) 137#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45)
137#endif /* 1250 PASS3 || 112x PASS1 */ 138#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
138 139
139#define S_MAC_BYPASS_IFG _SB_MAKE64(46) 140#define S_MAC_BYPASS_IFG _SB_MAKE64(46)
140#define M_MAC_BYPASS_IFG _SB_MAKEMASK(8,S_MAC_BYPASS_IFG) 141#define M_MAC_BYPASS_IFG _SB_MAKEMASK(8,S_MAC_BYPASS_IFG)
@@ -176,10 +177,22 @@
176 177
177#define M_MAC_PORT_RESET _SB_MAKEMASK1(8) 178#define M_MAC_PORT_RESET _SB_MAKEMASK1(8)
178 179
180#if (SIBYTE_HDR_FEATURE_CHIP(1250) || SIBYTE_HDR_FEATURE_CHIP(112x))
179#define M_MAC_RX_ENABLE _SB_MAKEMASK1(10) 181#define M_MAC_RX_ENABLE _SB_MAKEMASK1(10)
180#define M_MAC_TX_ENABLE _SB_MAKEMASK1(11) 182#define M_MAC_TX_ENABLE _SB_MAKEMASK1(11)
181#define M_MAC_BYP_RX_ENABLE _SB_MAKEMASK1(12) 183#define M_MAC_BYP_RX_ENABLE _SB_MAKEMASK1(12)
182#define M_MAC_BYP_TX_ENABLE _SB_MAKEMASK1(13) 184#define M_MAC_BYP_TX_ENABLE _SB_MAKEMASK1(13)
185#endif
186
187/*
188 * MAC reset information register (1280/1255)
189 */
190#if SIBYTE_HDR_FEATURE_CHIP(1480)
191#define M_MAC_RX_CH0_PAUSE_ON _SB_MAKEMASK1(8)
192#define M_MAC_RX_CH1_PAUSE_ON _SB_MAKEMASK1(16)
193#define M_MAC_TX_CH0_PAUSE_ON _SB_MAKEMASK1(24)
194#define M_MAC_TX_CH1_PAUSE_ON _SB_MAKEMASK1(32)
195#endif
183 196
184/* 197/*
185 * MAC DMA Control Register 198 * MAC DMA Control Register
@@ -267,12 +280,12 @@
267#define V_MAC_IFG_RX(x) _SB_MAKEVALUE(x,S_MAC_IFG_RX) 280#define V_MAC_IFG_RX(x) _SB_MAKEVALUE(x,S_MAC_IFG_RX)
268#define G_MAC_IFG_RX(x) _SB_GETVALUE(x,S_MAC_IFG_RX,M_MAC_IFG_RX) 281#define G_MAC_IFG_RX(x) _SB_GETVALUE(x,S_MAC_IFG_RX,M_MAC_IFG_RX)
269 282
270#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 283#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
271#define S_MAC_PRE_LEN _SB_MAKE64(0) 284#define S_MAC_PRE_LEN _SB_MAKE64(0)
272#define M_MAC_PRE_LEN _SB_MAKEMASK(6,S_MAC_PRE_LEN) 285#define M_MAC_PRE_LEN _SB_MAKEMASK(6,S_MAC_PRE_LEN)
273#define V_MAC_PRE_LEN(x) _SB_MAKEVALUE(x,S_MAC_PRE_LEN) 286#define V_MAC_PRE_LEN(x) _SB_MAKEVALUE(x,S_MAC_PRE_LEN)
274#define G_MAC_PRE_LEN(x) _SB_GETVALUE(x,S_MAC_PRE_LEN,M_MAC_PRE_LEN) 287#define G_MAC_PRE_LEN(x) _SB_GETVALUE(x,S_MAC_PRE_LEN,M_MAC_PRE_LEN)
275#endif /* 1250 PASS3 || 112x PASS1 */ 288#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
276 289
277#define S_MAC_IFG_TX _SB_MAKE64(6) 290#define S_MAC_IFG_TX _SB_MAKE64(6)
278#define M_MAC_IFG_TX _SB_MAKEMASK(6,S_MAC_IFG_TX) 291#define M_MAC_IFG_TX _SB_MAKEMASK(6,S_MAC_IFG_TX)
@@ -458,9 +471,9 @@
458#define V_MAC_COUNTER_ADDR(x) _SB_MAKEVALUE(x,S_MAC_COUNTER_ADDR) 471#define V_MAC_COUNTER_ADDR(x) _SB_MAKEVALUE(x,S_MAC_COUNTER_ADDR)
459#define G_MAC_COUNTER_ADDR(x) _SB_GETVALUE(x,S_MAC_COUNTER_ADDR,M_MAC_COUNTER_ADDR) 472#define G_MAC_COUNTER_ADDR(x) _SB_GETVALUE(x,S_MAC_COUNTER_ADDR,M_MAC_COUNTER_ADDR)
460 473
461#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 474#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
462#define M_MAC_TX_PAUSE_ON _SB_MAKEMASK1(52) 475#define M_MAC_TX_PAUSE_ON _SB_MAKEMASK1(52)
463#endif /* 1250 PASS3 || 112x PASS1 */ 476#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
464 477
465/* 478/*
466 * MAC Fifo Pointer Registers (Table 9-19) [Debug register] 479 * MAC Fifo Pointer Registers (Table 9-19) [Debug register]
@@ -594,7 +607,7 @@
594#define V_MAC_IPHDR_OFFSET(x) _SB_MAKEVALUE(x,S_MAC_IPHDR_OFFSET) 607#define V_MAC_IPHDR_OFFSET(x) _SB_MAKEVALUE(x,S_MAC_IPHDR_OFFSET)
595#define G_MAC_IPHDR_OFFSET(x) _SB_GETVALUE(x,S_MAC_IPHDR_OFFSET,M_MAC_IPHDR_OFFSET) 608#define G_MAC_IPHDR_OFFSET(x) _SB_GETVALUE(x,S_MAC_IPHDR_OFFSET,M_MAC_IPHDR_OFFSET)
596 609
597#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 610#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
598#define S_MAC_RX_CRC_OFFSET _SB_MAKE64(16) 611#define S_MAC_RX_CRC_OFFSET _SB_MAKE64(16)
599#define M_MAC_RX_CRC_OFFSET _SB_MAKEMASK(8,S_MAC_RX_CRC_OFFSET) 612#define M_MAC_RX_CRC_OFFSET _SB_MAKEMASK(8,S_MAC_RX_CRC_OFFSET)
600#define V_MAC_RX_CRC_OFFSET(x) _SB_MAKEVALUE(x,S_MAC_RX_CRC_OFFSET) 613#define V_MAC_RX_CRC_OFFSET(x) _SB_MAKEVALUE(x,S_MAC_RX_CRC_OFFSET)
@@ -612,7 +625,7 @@
612#define M_MAC_RX_CH_MSN_SEL _SB_MAKEMASK(8,S_MAC_RX_CH_MSN_SEL) 625#define M_MAC_RX_CH_MSN_SEL _SB_MAKEMASK(8,S_MAC_RX_CH_MSN_SEL)
613#define V_MAC_RX_CH_MSN_SEL(x) _SB_MAKEVALUE(x,S_MAC_RX_CH_MSN_SEL) 626#define V_MAC_RX_CH_MSN_SEL(x) _SB_MAKEVALUE(x,S_MAC_RX_CH_MSN_SEL)
614#define G_MAC_RX_CH_MSN_SEL(x) _SB_GETVALUE(x,S_MAC_RX_CH_MSN_SEL,M_MAC_RX_CH_MSN_SEL) 627#define G_MAC_RX_CH_MSN_SEL(x) _SB_GETVALUE(x,S_MAC_RX_CH_MSN_SEL,M_MAC_RX_CH_MSN_SEL)
615#endif /* 1250 PASS3 || 112x PASS1 */ 628#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
616 629
617/* 630/*
618 * MAC Receive Channel Select Registers (Table 9-25) 631 * MAC Receive Channel Select Registers (Table 9-25)
diff --git a/include/asm-mips/sibyte/sb1250_mc.h b/include/asm-mips/sibyte/sb1250_mc.h
index 1dd41c927996..26e421498c97 100644
--- a/include/asm-mips/sibyte/sb1250_mc.h
+++ b/include/asm-mips/sibyte/sb1250_mc.h
@@ -8,8 +8,6 @@
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg
12 *
13 ********************************************************************* 11 *********************************************************************
14 * 12 *
15 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003
@@ -324,6 +322,10 @@
324#define K_MC_tRFC_DEFAULT 12 322#define K_MC_tRFC_DEFAULT 12
325#define V_MC_tRFC_DEFAULT V_MC_tRFC(K_MC_tRFC_DEFAULT) 323#define V_MC_tRFC_DEFAULT V_MC_tRFC(K_MC_tRFC_DEFAULT)
326 324
325#if SIBYTE_HDR_FEATURE(1250, PASS3)
326#define M_MC_tRFC_PLUS16 _SB_MAKEMASK1(51) /* 1250C3 and later. */
327#endif
328
327#define S_MC_tCwCr 40 329#define S_MC_tCwCr 40
328#define M_MC_tCwCr _SB_MAKEMASK(4,S_MC_tCwCr) 330#define M_MC_tCwCr _SB_MAKEMASK(4,S_MC_tCwCr)
329#define V_MC_tCwCr(x) _SB_MAKEVALUE(x,S_MC_tCwCr) 331#define V_MC_tCwCr(x) _SB_MAKEVALUE(x,S_MC_tCwCr)
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h
index 9db80cd13a79..bab3a4580a36 100644
--- a/include/asm-mips/sibyte/sb1250_regs.h
+++ b/include/asm-mips/sibyte/sb1250_regs.h
@@ -8,8 +8,6 @@
8 * 8 *
9 * SB1250 specification level: 01/02/2002 9 * SB1250 specification level: 01/02/2002
10 * 10 *
11 * Author: Mitch Lichtenberg
12 *
13 ********************************************************************* 11 *********************************************************************
14 * 12 *
15 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003
@@ -61,6 +59,8 @@
61 * XXX: can't remove MC base 0 if 112x, since it's used by other macros, 59 * XXX: can't remove MC base 0 if 112x, since it's used by other macros,
62 * since there is one reg there (but it could get its addr/offset constant). 60 * since there is one reg there (but it could get its addr/offset constant).
63 */ 61 */
62
63#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
64#define A_MC_BASE_0 0x0010051000 64#define A_MC_BASE_0 0x0010051000
65#define A_MC_BASE_1 0x0010052000 65#define A_MC_BASE_1 0x0010052000
66#define MC_REGISTER_SPACING 0x1000 66#define MC_REGISTER_SPACING 0x1000
@@ -101,10 +101,14 @@
101#define R_MC_TEST_ECC 0x0000000420 101#define R_MC_TEST_ECC 0x0000000420
102#define R_MC_MCLK_CFG 0x0000000500 102#define R_MC_MCLK_CFG 0x0000000500
103 103
104#endif /* 1250 & 112x */
105
104/* ********************************************************************* 106/* *********************************************************************
105 * L2 Cache Control Registers 107 * L2 Cache Control Registers
106 ********************************************************************* */ 108 ********************************************************************* */
107 109
110#if SIBYTE_HDR_FEATURE_1250_112x /* This L2C only on 1250/112x */
111
108#define A_L2_READ_TAG 0x0010040018 112#define A_L2_READ_TAG 0x0010040018
109#define A_L2_ECC_TAG 0x0010040038 113#define A_L2_ECC_TAG 0x0010040038
110#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 114#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
@@ -125,13 +129,16 @@
125#define A_L2_READ_ADDRESS A_L2_READ_TAG 129#define A_L2_READ_ADDRESS A_L2_READ_TAG
126#define A_L2_EEC_ADDRESS A_L2_ECC_TAG 130#define A_L2_EEC_ADDRESS A_L2_ECC_TAG
127 131
132#endif
128 133
129/* ********************************************************************* 134/* *********************************************************************
130 * PCI Interface Registers 135 * PCI Interface Registers
131 ********************************************************************* */ 136 ********************************************************************* */
132 137
138#if SIBYTE_HDR_FEATURE_1250_112x /* This PCI/HT only on 1250/112x */
133#define A_PCI_TYPE00_HEADER 0x00DE000000 139#define A_PCI_TYPE00_HEADER 0x00DE000000
134#define A_PCI_TYPE01_HEADER 0x00DE000800 140#define A_PCI_TYPE01_HEADER 0x00DE000800
141#endif
135 142
136 143
137/* ********************************************************************* 144/* *********************************************************************
@@ -264,15 +271,15 @@
264 ********************************************************************* */ 271 ********************************************************************* */
265 272
266 273
274#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
267#define R_DUART_NUM_PORTS 2 275#define R_DUART_NUM_PORTS 2
268 276
269#define A_DUART 0x0010060000 277#define A_DUART 0x0010060000
270 278
271#define A_DUART_REG(r)
272
273#define DUART_CHANREG_SPACING 0x100 279#define DUART_CHANREG_SPACING 0x100
274#define A_DUART_CHANREG(chan,reg) (A_DUART + DUART_CHANREG_SPACING*(chan) + (reg)) 280#define A_DUART_CHANREG(chan,reg) (A_DUART + DUART_CHANREG_SPACING*(chan) + (reg))
275#define R_DUART_CHANREG(chan,reg) (DUART_CHANREG_SPACING*(chan) + (reg)) 281#define R_DUART_CHANREG(chan,reg) (DUART_CHANREG_SPACING*(chan) + (reg))
282#endif /* 1250 & 112x */
276 283
277#define R_DUART_MODE_REG_1 0x100 284#define R_DUART_MODE_REG_1 0x100
278#define R_DUART_MODE_REG_2 0x110 285#define R_DUART_MODE_REG_2 0x110
@@ -307,11 +314,13 @@
307 314
308#define DUART_IMRISR_SPACING 0x20 315#define DUART_IMRISR_SPACING 0x20
309 316
317#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
310#define R_DUART_IMRREG(chan) (R_DUART_IMR_A + (chan)*DUART_IMRISR_SPACING) 318#define R_DUART_IMRREG(chan) (R_DUART_IMR_A + (chan)*DUART_IMRISR_SPACING)
311#define R_DUART_ISRREG(chan) (R_DUART_ISR_A + (chan)*DUART_IMRISR_SPACING) 319#define R_DUART_ISRREG(chan) (R_DUART_ISR_A + (chan)*DUART_IMRISR_SPACING)
312 320
313#define A_DUART_IMRREG(chan) (A_DUART + R_DUART_IMRREG(chan)) 321#define A_DUART_IMRREG(chan) (A_DUART + R_DUART_IMRREG(chan))
314#define A_DUART_ISRREG(chan) (A_DUART + R_DUART_ISRREG(chan)) 322#define A_DUART_ISRREG(chan) (A_DUART + R_DUART_ISRREG(chan))
323#endif /* 1250 & 112x */
315 324
316 325
317 326
@@ -368,6 +377,8 @@
368 ********************************************************************* */ 377 ********************************************************************* */
369 378
370 379
380#if SIBYTE_HDR_FEATURE_1250_112x /* sync serial only on 1250/112x */
381
371#define A_SER_BASE_0 0x0010060400 382#define A_SER_BASE_0 0x0010060400
372#define A_SER_BASE_1 0x0010060800 383#define A_SER_BASE_1 0x0010060800
373#define SER_SPACING 0x400 384#define SER_SPACING 0x400
@@ -457,6 +468,8 @@
457#define R_SER_RMON_RX_ERRORS 0x000001F0 468#define R_SER_RMON_RX_ERRORS 0x000001F0
458#define R_SER_RMON_RX_BADADDR 0x000001F8 469#define R_SER_RMON_RX_BADADDR 0x000001F8
459 470
471#endif /* 1250/112x */
472
460/* ********************************************************************* 473/* *********************************************************************
461 * Generic Bus Registers 474 * Generic Bus Registers
462 ********************************************************************* */ 475 ********************************************************************* */
@@ -634,12 +647,13 @@
634 647
635#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 648#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
636#define A_SCD_SCRATCH 0x0010020C10 649#define A_SCD_SCRATCH 0x0010020C10
650#endif /* 1250 PASS2 || 112x PASS1 */
637 651
652#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
638#define A_SCD_ZBBUS_CYCLE_COUNT 0x0010030000 653#define A_SCD_ZBBUS_CYCLE_COUNT 0x0010030000
639#define A_SCD_ZBBUS_CYCLE_CP0 0x0010020C00 654#define A_SCD_ZBBUS_CYCLE_CP0 0x0010020C00
640#define A_SCD_ZBBUS_CYCLE_CP1 0x0010020C08 655#define A_SCD_ZBBUS_CYCLE_CP1 0x0010020C08
641#endif /* 1250 PASS2 || 112x PASS1 */ 656#endif
642
643 657
644/* ********************************************************************* 658/* *********************************************************************
645 * System Control Registers 659 * System Control Registers
@@ -667,15 +681,16 @@
667#define A_ADDR_TRAP_CFG_1 0x0010020448 681#define A_ADDR_TRAP_CFG_1 0x0010020448
668#define A_ADDR_TRAP_CFG_2 0x0010020450 682#define A_ADDR_TRAP_CFG_2 0x0010020450
669#define A_ADDR_TRAP_CFG_3 0x0010020458 683#define A_ADDR_TRAP_CFG_3 0x0010020458
670#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 684#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
671#define A_ADDR_TRAP_REG_DEBUG 0x0010020460 685#define A_ADDR_TRAP_REG_DEBUG 0x0010020460
672#endif /* 1250 PASS2 || 112x PASS1 */ 686#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
673 687
674 688
675/* ********************************************************************* 689/* *********************************************************************
676 * System Interrupt Mapper Registers 690 * System Interrupt Mapper Registers
677 ********************************************************************* */ 691 ********************************************************************* */
678 692
693#if SIBYTE_HDR_FEATURE_1250_112x
679#define A_IMR_CPU0_BASE 0x0010020000 694#define A_IMR_CPU0_BASE 0x0010020000
680#define A_IMR_CPU1_BASE 0x0010022000 695#define A_IMR_CPU1_BASE 0x0010022000
681#define IMR_REGISTER_SPACING 0x2000 696#define IMR_REGISTER_SPACING 0x2000
@@ -700,6 +715,7 @@
700#define R_IMR_INTERRUPT_STATUS_COUNT 7 715#define R_IMR_INTERRUPT_STATUS_COUNT 7
701#define R_IMR_INTERRUPT_MAP_BASE 0x0200 716#define R_IMR_INTERRUPT_MAP_BASE 0x0200
702#define R_IMR_INTERRUPT_MAP_COUNT 64 717#define R_IMR_INTERRUPT_MAP_COUNT 64
718#endif /* 1250/112x */
703 719
704/* ********************************************************************* 720/* *********************************************************************
705 * System Performance Counter Registers 721 * System Performance Counter Registers
@@ -718,6 +734,7 @@
718#define A_SCD_BUS_ERR_STATUS 0x0010020880 734#define A_SCD_BUS_ERR_STATUS 0x0010020880
719#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 735#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
720#define A_SCD_BUS_ERR_STATUS_DEBUG 0x00100208D0 736#define A_SCD_BUS_ERR_STATUS_DEBUG 0x00100208D0
737#define A_BUS_ERR_STATUS_DEBUG 0x00100208D0
721#endif /* 1250 PASS2 || 112x PASS1 */ 738#endif /* 1250 PASS2 || 112x PASS1 */
722#define A_BUS_ERR_DATA_0 0x00100208A0 739#define A_BUS_ERR_DATA_0 0x00100208A0
723#define A_BUS_ERR_DATA_1 0x00100208A8 740#define A_BUS_ERR_DATA_1 0x00100208A8
@@ -798,6 +815,7 @@
798 * Physical Address Map 815 * Physical Address Map
799 ********************************************************************* */ 816 ********************************************************************* */
800 817
818#if SIBYTE_HDR_FEATURE_1250_112x
801#define A_PHYS_MEMORY_0 _SB_MAKE64(0x0000000000) 819#define A_PHYS_MEMORY_0 _SB_MAKE64(0x0000000000)
802#define A_PHYS_MEMORY_SIZE _SB_MAKE64((256*1024*1024)) 820#define A_PHYS_MEMORY_SIZE _SB_MAKE64((256*1024*1024))
803#define A_PHYS_SYSTEM_CTL _SB_MAKE64(0x0010000000) 821#define A_PHYS_SYSTEM_CTL _SB_MAKE64(0x0010000000)
@@ -831,6 +849,7 @@
831#define A_PHYS_L2CACHE_WAY1 _SB_MAKE64(0x00D01A0000) 849#define A_PHYS_L2CACHE_WAY1 _SB_MAKE64(0x00D01A0000)
832#define A_PHYS_L2CACHE_WAY2 _SB_MAKE64(0x00D01C0000) 850#define A_PHYS_L2CACHE_WAY2 _SB_MAKE64(0x00D01C0000)
833#define A_PHYS_L2CACHE_WAY3 _SB_MAKE64(0x00D01E0000) 851#define A_PHYS_L2CACHE_WAY3 _SB_MAKE64(0x00D01E0000)
852#endif
834 853
835 854
836#endif 855#endif
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h
index dbbd682fb47e..a667bc14a7cd 100644
--- a/include/asm-mips/sibyte/sb1250_scd.h
+++ b/include/asm-mips/sibyte/sb1250_scd.h
@@ -8,8 +8,6 @@
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg
12 *
13 ********************************************************************* 11 *********************************************************************
14 * 12 *
15 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003
@@ -51,26 +49,70 @@
51#define V_SYS_REVISION(x) _SB_MAKEVALUE(x,S_SYS_REVISION) 49#define V_SYS_REVISION(x) _SB_MAKEVALUE(x,S_SYS_REVISION)
52#define G_SYS_REVISION(x) _SB_GETVALUE(x,S_SYS_REVISION,M_SYS_REVISION) 50#define G_SYS_REVISION(x) _SB_GETVALUE(x,S_SYS_REVISION,M_SYS_REVISION)
53 51
54#if SIBYTE_HDR_FEATURE_CHIP(1250) 52#define K_SYS_REVISION_BCM1250_PASS1 0x01
55#define K_SYS_REVISION_BCM1250_PASS1 1 53
56#define K_SYS_REVISION_BCM1250_PASS2 3 54#define K_SYS_REVISION_BCM1250_PASS2 0x03
57#define K_SYS_REVISION_BCM1250_A10 11 55#define K_SYS_REVISION_BCM1250_A1 0x03 /* Pass 2.0 WB */
58#define K_SYS_REVISION_BCM1250_PASS2_2 16 56#define K_SYS_REVISION_BCM1250_A2 0x04 /* Pass 2.0 FC */
59#define K_SYS_REVISION_BCM1250_B2 17 57#define K_SYS_REVISION_BCM1250_A3 0x05 /* Pass 2.1 FC */
60#define K_SYS_REVISION_BCM1250_PASS3 32 58#define K_SYS_REVISION_BCM1250_A4 0x06 /* Pass 2.1 WB */
61#define K_SYS_REVISION_BCM1250_C1 33 59#define K_SYS_REVISION_BCM1250_A6 0x07 /* OR 0x04 (A2) w/WID != 0 */
60#define K_SYS_REVISION_BCM1250_A8 0x0b /* A8/A10 */
61#define K_SYS_REVISION_BCM1250_A9 0x08
62#define K_SYS_REVISION_BCM1250_A10 K_SYS_REVISION_BCM1250_A8
62 63
64#define K_SYS_REVISION_BCM1250_PASS2_2 0x10
65#define K_SYS_REVISION_BCM1250_B0 K_SYS_REVISION_BCM1250_B1
66#define K_SYS_REVISION_BCM1250_B1 0x10
67#define K_SYS_REVISION_BCM1250_B2 0x11
68
69#define K_SYS_REVISION_BCM1250_C0 0x20
70#define K_SYS_REVISION_BCM1250_C1 0x21
71#define K_SYS_REVISION_BCM1250_C2 0x22
72#define K_SYS_REVISION_BCM1250_C3 0x23
73
74#if SIBYTE_HDR_FEATURE_CHIP(1250)
63/* XXX: discourage people from using these constants. */ 75/* XXX: discourage people from using these constants. */
64#define K_SYS_REVISION_PASS1 K_SYS_REVISION_BCM1250_PASS1 76#define K_SYS_REVISION_PASS1 K_SYS_REVISION_BCM1250_PASS1
65#define K_SYS_REVISION_PASS2 K_SYS_REVISION_BCM1250_PASS2 77#define K_SYS_REVISION_PASS2 K_SYS_REVISION_BCM1250_PASS2
66#define K_SYS_REVISION_PASS2_2 K_SYS_REVISION_BCM1250_PASS2_2 78#define K_SYS_REVISION_PASS2_2 K_SYS_REVISION_BCM1250_PASS2_2
67#define K_SYS_REVISION_PASS3 K_SYS_REVISION_BCM1250_PASS3 79#define K_SYS_REVISION_PASS3 K_SYS_REVISION_BCM1250_PASS3
80#define K_SYS_REVISION_BCM1250_PASS3 K_SYS_REVISION_BCM1250_C0
68#endif /* 1250 */ 81#endif /* 1250 */
69 82
70#if SIBYTE_HDR_FEATURE_CHIP(112x) 83#define K_SYS_REVISION_BCM112x_A1 0x20
71#define K_SYS_REVISION_BCM112x_A1 32 84#define K_SYS_REVISION_BCM112x_A2 0x21
72#define K_SYS_REVISION_BCM112x_A2 33 85#define K_SYS_REVISION_BCM112x_A3 0x22
73#endif /* 112x */ 86#define K_SYS_REVISION_BCM112x_A4 0x23
87
88#define K_SYS_REVISION_BCM1480_S0 0x01
89#define K_SYS_REVISION_BCM1480_A1 0x02
90#define K_SYS_REVISION_BCM1480_A2 0x03
91#define K_SYS_REVISION_BCM1480_A3 0x04
92#define K_SYS_REVISION_BCM1480_B0 0x11
93
94/*Cache size - 23:20 of revision register*/
95#define S_SYS_L2C_SIZE _SB_MAKE64(20)
96#define M_SYS_L2C_SIZE _SB_MAKEMASK(4,S_SYS_L2C_SIZE)
97#define V_SYS_L2C_SIZE(x) _SB_MAKEVALUE(x,S_SYS_L2C_SIZE)
98#define G_SYS_L2C_SIZE(x) _SB_GETVALUE(x,S_SYS_L2C_SIZE,M_SYS_L2C_SIZE)
99
100#define K_SYS_L2C_SIZE_1MB 0
101#define K_SYS_L2C_SIZE_512KB 5
102#define K_SYS_L2C_SIZE_256KB 2
103#define K_SYS_L2C_SIZE_128KB 1
104
105#define K_SYS_L2C_SIZE_BCM1250 K_SYS_L2C_SIZE_512KB
106#define K_SYS_L2C_SIZE_BCM1125 K_SYS_L2C_SIZE_256KB
107#define K_SYS_L2C_SIZE_BCM1122 K_SYS_L2C_SIZE_128KB
108
109
110/* Number of CPU cores, bits 27:24 of revision register*/
111#define S_SYS_NUM_CPUS _SB_MAKE64(24)
112#define M_SYS_NUM_CPUS _SB_MAKEMASK(4,S_SYS_NUM_CPUS)
113#define V_SYS_NUM_CPUS(x) _SB_MAKEVALUE(x,S_SYS_NUM_CPUS)
114#define G_SYS_NUM_CPUS(x) _SB_GETVALUE(x,S_SYS_NUM_CPUS,M_SYS_NUM_CPUS)
115
74 116
75/* XXX: discourage people from using these constants. */ 117/* XXX: discourage people from using these constants. */
76#define S_SYS_PART _SB_MAKE64(16) 118#define S_SYS_PART _SB_MAKE64(16)
@@ -83,6 +125,8 @@
83#define K_SYS_PART_BCM1120 0x1121 125#define K_SYS_PART_BCM1120 0x1121
84#define K_SYS_PART_BCM1125 0x1123 126#define K_SYS_PART_BCM1125 0x1123
85#define K_SYS_PART_BCM1125H 0x1124 127#define K_SYS_PART_BCM1125H 0x1124
128#define K_SYS_PART_BCM1122 0x1113
129
86 130
87/* The "peripheral set" (SOC type) is the low 4 bits of the "part" field. */ 131/* The "peripheral set" (SOC type) is the low 4 bits of the "part" field. */
88#define S_SYS_SOC_TYPE _SB_MAKE64(16) 132#define S_SYS_SOC_TYPE _SB_MAKE64(16)
@@ -96,6 +140,8 @@
96#define K_SYS_SOC_TYPE_BCM1125 0x3 140#define K_SYS_SOC_TYPE_BCM1125 0x3
97#define K_SYS_SOC_TYPE_BCM1125H 0x4 141#define K_SYS_SOC_TYPE_BCM1125H 0x4
98#define K_SYS_SOC_TYPE_BCM1250_ALT2 0x5 /* 1250pass2 w/ 1/2 L2. */ 142#define K_SYS_SOC_TYPE_BCM1250_ALT2 0x5 /* 1250pass2 w/ 1/2 L2. */
143#define K_SYS_SOC_TYPE_BCM1x80 0x6
144#define K_SYS_SOC_TYPE_BCM1x55 0x7
99 145
100/* 146/*
101 * Calculate correct SOC type given a copy of system revision register. 147 * Calculate correct SOC type given a copy of system revision register.
@@ -127,10 +173,12 @@
127#define V_SYS_WID(x) _SB_MAKEVALUE(x,S_SYS_WID) 173#define V_SYS_WID(x) _SB_MAKEVALUE(x,S_SYS_WID)
128#define G_SYS_WID(x) _SB_GETVALUE(x,S_SYS_WID,M_SYS_WID) 174#define G_SYS_WID(x) _SB_GETVALUE(x,S_SYS_WID,M_SYS_WID)
129 175
130/* System Manufacturing Register 176/*
131* Register: SCD_SYSTEM_MANUF 177 * System Manufacturing Register
132*/ 178 * Register: SCD_SYSTEM_MANUF
179 */
133 180
181#if SIBYTE_HDR_FEATURE_1250_112x
134/* Wafer ID: bits 31:0 */ 182/* Wafer ID: bits 31:0 */
135#define S_SYS_WAFERID1_200 _SB_MAKE64(0) 183#define S_SYS_WAFERID1_200 _SB_MAKE64(0)
136#define M_SYS_WAFERID1_200 _SB_MAKEMASK(32,S_SYS_WAFERID1_200) 184#define M_SYS_WAFERID1_200 _SB_MAKEMASK(32,S_SYS_WAFERID1_200)
@@ -139,8 +187,8 @@
139 187
140#define S_SYS_BIN _SB_MAKE64(32) 188#define S_SYS_BIN _SB_MAKE64(32)
141#define M_SYS_BIN _SB_MAKEMASK(4,S_SYS_BIN) 189#define M_SYS_BIN _SB_MAKEMASK(4,S_SYS_BIN)
142#define V_SYS_BIN _SB_MAKEVALUE(x,S_SYS_BIN) 190#define V_SYS_BIN(x) _SB_MAKEVALUE(x,S_SYS_BIN)
143#define G_SYS_BIN _SB_GETVALUE(x,S_SYS_BIN,M_SYS_BIN) 191#define G_SYS_BIN(x) _SB_GETVALUE(x,S_SYS_BIN,M_SYS_BIN)
144 192
145/* Wafer ID: bits 39:36 */ 193/* Wafer ID: bits 39:36 */
146#define S_SYS_WAFERID2_200 _SB_MAKE64(36) 194#define S_SYS_WAFERID2_200 _SB_MAKE64(36)
@@ -163,12 +211,14 @@
163#define M_SYS_YPOS _SB_MAKEMASK(6,S_SYS_YPOS) 211#define M_SYS_YPOS _SB_MAKEMASK(6,S_SYS_YPOS)
164#define V_SYS_YPOS(x) _SB_MAKEVALUE(x,S_SYS_YPOS) 212#define V_SYS_YPOS(x) _SB_MAKEVALUE(x,S_SYS_YPOS)
165#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS) 213#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS)
214#endif
166 215
167/* 216/*
168 * System Config Register (Table 4-2) 217 * System Config Register (Table 4-2)
169 * Register: SCD_SYSTEM_CFG 218 * Register: SCD_SYSTEM_CFG
170 */ 219 */
171 220
221#if SIBYTE_HDR_FEATURE_1250_112x
172#define M_SYS_LDT_PLL_BYP _SB_MAKEMASK1(3) 222#define M_SYS_LDT_PLL_BYP _SB_MAKEMASK1(3)
173#define M_SYS_PCI_SYNC_TEST_MODE _SB_MAKEMASK1(4) 223#define M_SYS_PCI_SYNC_TEST_MODE _SB_MAKEMASK1(4)
174#define M_SYS_IOB0_DIV _SB_MAKEMASK1(5) 224#define M_SYS_IOB0_DIV _SB_MAKEMASK1(5)
@@ -253,6 +303,8 @@
253#define M_SYS_SW_FLAG _SB_MAKEMASK1(63) 303#define M_SYS_SW_FLAG _SB_MAKEMASK1(63)
254#endif /* 1250 PASS2 || 112x PASS1 */ 304#endif /* 1250 PASS2 || 112x PASS1 */
255 305
306#endif
307
256 308
257/* 309/*
258 * Mailbox Registers (Table 4-3) 310 * Mailbox Registers (Table 4-3)
@@ -326,6 +378,7 @@
326 * System Performance Counters 378 * System Performance Counters
327 */ 379 */
328 380
381#if SIBYTE_HDR_FEATURE_1250_112x
329#define S_SPC_CFG_SRC0 0 382#define S_SPC_CFG_SRC0 0
330#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0) 383#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0)
331#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0) 384#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0)
@@ -348,6 +401,7 @@
348 401
349#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32) 402#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32)
350#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33) 403#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33)
404#endif
351 405
352 406
353/* 407/*
@@ -412,6 +466,7 @@
412 * Address Trap Registers 466 * Address Trap Registers
413 */ 467 */
414 468
469#if SIBYTE_HDR_FEATURE_1250_112x
415#define M_ATRAP_INDEX _SB_MAKEMASK(4,0) 470#define M_ATRAP_INDEX _SB_MAKEMASK(4,0)
416#define M_ATRAP_ADDRESS _SB_MAKEMASK(40,0) 471#define M_ATRAP_ADDRESS _SB_MAKEMASK(40,0)
417 472
@@ -436,7 +491,6 @@
436#define K_BUS_AGENT_IOB0 2 491#define K_BUS_AGENT_IOB0 2
437#define K_BUS_AGENT_IOB1 3 492#define K_BUS_AGENT_IOB1 3
438#define K_BUS_AGENT_SCD 4 493#define K_BUS_AGENT_SCD 4
439#define K_BUS_AGENT_RESERVED 5
440#define K_BUS_AGENT_L2C 6 494#define K_BUS_AGENT_L2C 6
441#define K_BUS_AGENT_MC 7 495#define K_BUS_AGENT_MC 7
442 496
@@ -454,10 +508,14 @@
454#define K_ATRAP_CFG_CATTR_NOTNONCOH 6 508#define K_ATRAP_CFG_CATTR_NOTNONCOH 6
455#define K_ATRAP_CFG_CATTR_NOTCOHERENT 7 509#define K_ATRAP_CFG_CATTR_NOTCOHERENT 7
456 510
511#endif /* 1250/112x */
512
457/* 513/*
458 * Trace Buffer Config register 514 * Trace Buffer Config register
459 */ 515 */
460 516
517#if SIBYTE_HDR_FEATURE_1250_112x
518
461#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0) 519#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
462#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1) 520#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
463#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2) 521#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
@@ -475,6 +533,8 @@
475#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR) 533#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR)
476#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR) 534#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR)
477 535
536#endif /* 1250/112x */
537
478/* 538/*
479 * Trace Event registers 539 * Trace Event registers
480 */ 540 */
@@ -578,5 +638,7 @@
578#define M_SCD_TRSEQ_DEBUGPIN _SB_MAKEMASK1(20) 638#define M_SCD_TRSEQ_DEBUGPIN _SB_MAKEMASK1(20)
579#define M_SCD_TRSEQ_DEBUGCPU _SB_MAKEMASK1(21) 639#define M_SCD_TRSEQ_DEBUGCPU _SB_MAKEMASK1(21)
580#define M_SCD_TRSEQ_CLEARUSE _SB_MAKEMASK1(22) 640#define M_SCD_TRSEQ_CLEARUSE _SB_MAKEMASK1(22)
641#define M_SCD_TRSEQ_ALLD_A _SB_MAKEMASK1(23)
642#define M_SCD_TRSEQ_ALL_A _SB_MAKEMASK1(24)
581 643
582#endif 644#endif
diff --git a/include/asm-mips/sibyte/sb1250_smbus.h b/include/asm-mips/sibyte/sb1250_smbus.h
index 335c53e92936..279a912213cd 100644
--- a/include/asm-mips/sibyte/sb1250_smbus.h
+++ b/include/asm-mips/sibyte/sb1250_smbus.h
@@ -6,9 +6,8 @@
6 * This module contains constants and macros useful for 6 * This module contains constants and macros useful for
7 * manipulating the SB1250's SMbus devices. 7 * manipulating the SB1250's SMbus devices.
8 * 8 *
9 * SB1250 specification level: 01/02/2002 9 * SB1250 specification level: 10/21/02
10 * 10 * BCM1280 specification level: 11/24/03
11 * Author: Mitch Lichtenberg
12 * 11 *
13 ********************************************************************* 12 *********************************************************************
14 * 13 *
@@ -47,6 +46,7 @@
47 46
48#define K_SMB_FREQ_400KHZ 0x1F 47#define K_SMB_FREQ_400KHZ 0x1F
49#define K_SMB_FREQ_100KHZ 0x7D 48#define K_SMB_FREQ_100KHZ 0x7D
49#define K_SMB_FREQ_10KHZ 1250
50 50
51#define S_SMB_CMD 0 51#define S_SMB_CMD 0
52#define M_SMB_CMD _SB_MAKEMASK(8,S_SMB_CMD) 52#define M_SMB_CMD _SB_MAKEMASK(8,S_SMB_CMD)
@@ -58,7 +58,11 @@
58 58
59#define M_SMB_ERR_INTR _SB_MAKEMASK1(0) 59#define M_SMB_ERR_INTR _SB_MAKEMASK1(0)
60#define M_SMB_FINISH_INTR _SB_MAKEMASK1(1) 60#define M_SMB_FINISH_INTR _SB_MAKEMASK1(1)
61#define M_SMB_DATA_OUT _SB_MAKEMASK1(4) 61
62#define S_SMB_DATA_OUT 4
63#define M_SMB_DATA_OUT _SB_MAKEMASK1(S_SMB_DATA_OUT)
64#define V_SMB_DATA_OUT(x) _SB_MAKEVALUE(x,S_SMB_DATA_OUT)
65
62#define M_SMB_DATA_DIR _SB_MAKEMASK1(5) 66#define M_SMB_DATA_DIR _SB_MAKEMASK1(5)
63#define M_SMB_DATA_DIR_OUTPUT M_SMB_DATA_DIR 67#define M_SMB_DATA_DIR_OUTPUT M_SMB_DATA_DIR
64#define M_SMB_CLK_OUT _SB_MAKEMASK1(6) 68#define M_SMB_CLK_OUT _SB_MAKEMASK1(6)
@@ -71,8 +75,23 @@
71#define M_SMB_BUSY _SB_MAKEMASK1(0) 75#define M_SMB_BUSY _SB_MAKEMASK1(0)
72#define M_SMB_ERROR _SB_MAKEMASK1(1) 76#define M_SMB_ERROR _SB_MAKEMASK1(1)
73#define M_SMB_ERROR_TYPE _SB_MAKEMASK1(2) 77#define M_SMB_ERROR_TYPE _SB_MAKEMASK1(2)
74#define M_SMB_REF _SB_MAKEMASK1(6) 78
75#define M_SMB_DATA_IN _SB_MAKEMASK1(7) 79#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
80#define S_SMB_SCL_IN 5
81#define M_SMB_SCL_IN _SB_MAKEMASK1(S_SMB_SCL_IN)
82#define V_SMB_SCL_IN(x) _SB_MAKEVALUE(x,S_SMB_SCL_IN)
83#define G_SMB_SCL_IN(x) _SB_GETVALUE(x,S_SMB_SCL_IN,M_SMB_SCL_IN)
84#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
85
86#define S_SMB_REF 6
87#define M_SMB_REF _SB_MAKEMASK1(S_SMB_REF)
88#define V_SMB_REF(x) _SB_MAKEVALUE(x,S_SMB_REF)
89#define G_SMB_REF(x) _SB_GETVALUE(x,S_SMB_REF,M_SMB_REF)
90
91#define S_SMB_DATA_IN 7
92#define M_SMB_DATA_IN _SB_MAKEMASK1(S_SMB_DATA_IN)
93#define V_SMB_DATA_IN(x) _SB_MAKEVALUE(x,S_SMB_DATA_IN)
94#define G_SMB_DATA_IN(x) _SB_GETVALUE(x,S_SMB_DATA_IN,M_SMB_DATA_IN)
76 95
77/* 96/*
78 * SMBus Start/Command registers (Table 14-9) 97 * SMBus Start/Command registers (Table 14-9)
@@ -132,16 +151,14 @@
132#define V_SPEC_MB(x) _SB_MAKEVALUE(x,S_SPEC_PEC) 151#define V_SPEC_MB(x) _SB_MAKEVALUE(x,S_SPEC_PEC)
133 152
134 153
135#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 154#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
136 155
137#define S_SMB_CMDH 8 156#define S_SMB_CMDH 8
138#define M_SMB_CMDH _SB_MAKEMASK(8,S_SMBH_CMD) 157#define M_SMB_CMDH _SB_MAKEMASK(8,S_SMB_CMDH)
139#define V_SMB_CMDH(x) _SB_MAKEVALUE(x,S_SMBH_CMD) 158#define V_SMB_CMDH(x) _SB_MAKEVALUE(x,S_SMB_CMDH)
140 159
141#define M_SMB_EXTEND _SB_MAKEMASK1(14) 160#define M_SMB_EXTEND _SB_MAKEMASK1(14)
142 161
143#define M_SMB_DIR _SB_MAKEMASK1(13)
144
145#define S_SMB_DFMT 8 162#define S_SMB_DFMT 8
146#define M_SMB_DFMT _SB_MAKEMASK(3,S_SMB_DFMT) 163#define M_SMB_DFMT _SB_MAKEMASK(3,S_SMB_DFMT)
147#define V_SMB_DFMT(x) _SB_MAKEVALUE(x,S_SMB_DFMT) 164#define V_SMB_DFMT(x) _SB_MAKEVALUE(x,S_SMB_DFMT)
@@ -165,6 +182,23 @@
165#define V_SMB_DFMT_CMD5BYTE V_SMB_DFMT(K_SMB_DFMT_CMD5BYTE) 182#define V_SMB_DFMT_CMD5BYTE V_SMB_DFMT(K_SMB_DFMT_CMD5BYTE)
166#define V_SMB_DFMT_RESERVED V_SMB_DFMT(K_SMB_DFMT_RESERVED) 183#define V_SMB_DFMT_RESERVED V_SMB_DFMT(K_SMB_DFMT_RESERVED)
167 184
168#endif /* 1250 PASS2 || 112x PASS1 */ 185#define S_SMB_AFMT 11
186#define M_SMB_AFMT _SB_MAKEMASK(2,S_SMB_AFMT)
187#define V_SMB_AFMT(x) _SB_MAKEVALUE(x,S_SMB_AFMT)
188#define G_SMB_AFMT(x) _SB_GETVALUE(x,S_SMB_AFMT,M_SMB_AFMT)
189
190#define K_SMB_AFMT_NONE 0
191#define K_SMB_AFMT_ADDR 1
192#define K_SMB_AFMT_ADDR_CMD1BYTE 2
193#define K_SMB_AFMT_ADDR_CMD2BYTE 3
194
195#define V_SMB_AFMT_NONE V_SMB_AFMT(K_SMB_AFMT_NONE)
196#define V_SMB_AFMT_ADDR V_SMB_AFMT(K_SMB_AFMT_ADDR)
197#define V_SMB_AFMT_ADDR_CMD1BYTE V_SMB_AFMT(K_SMB_AFMT_ADDR_CMD1BYTE)
198#define V_SMB_AFMT_ADDR_CMD2BYTE V_SMB_AFMT(K_SMB_AFMT_ADDR_CMD2BYTE)
199
200#define M_SMB_DIR _SB_MAKEMASK1(13)
201
202#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
169 203
170#endif 204#endif
diff --git a/include/asm-mips/sibyte/sb1250_syncser.h b/include/asm-mips/sibyte/sb1250_syncser.h
index fa2760d38b8b..dd154ac505d8 100644
--- a/include/asm-mips/sibyte/sb1250_syncser.h
+++ b/include/asm-mips/sibyte/sb1250_syncser.h
@@ -8,8 +8,6 @@
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg
12 *
13 ********************************************************************* 11 *********************************************************************
14 * 12 *
15 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003
diff --git a/include/asm-mips/sibyte/sb1250_uart.h b/include/asm-mips/sibyte/sb1250_uart.h
index 923ea4f44e0f..e87045e62bf0 100644
--- a/include/asm-mips/sibyte/sb1250_uart.h
+++ b/include/asm-mips/sibyte/sb1250_uart.h
@@ -8,8 +8,6 @@
8 * 8 *
9 * SB1250 specification level: User's manual 1/02/02 9 * SB1250 specification level: User's manual 1/02/02
10 * 10 *
11 * Author: Mitch Lichtenberg
12 *
13 ********************************************************************* 11 *********************************************************************
14 * 12 *
15 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003
@@ -240,7 +238,12 @@
240 */ 238 */
241 239
242#define M_DUART_ISR_TX_A _SB_MAKEMASK1(0) 240#define M_DUART_ISR_TX_A _SB_MAKEMASK1(0)
243#define M_DUART_ISR_RX_A _SB_MAKEMASK1(1) 241
242#define S_DUART_ISR_RX_A 1
243#define M_DUART_ISR_RX_A _SB_MAKEMASK1(S_DUART_ISR_RX_A)
244#define V_DUART_ISR_RX_A(x) _SB_MAKEVALUE(x,S_DUART_ISR_RX_A)
245#define G_DUART_ISR_RX_A(x) _SB_GETVALUE(x,S_DUART_ISR_RX_A,M_DUART_ISR_RX_A)
246
244#define M_DUART_ISR_BRK_A _SB_MAKEMASK1(2) 247#define M_DUART_ISR_BRK_A _SB_MAKEMASK1(2)
245#define M_DUART_ISR_IN_A _SB_MAKEMASK1(3) 248#define M_DUART_ISR_IN_A _SB_MAKEMASK1(3)
246#define M_DUART_ISR_TX_B _SB_MAKEMASK1(4) 249#define M_DUART_ISR_TX_B _SB_MAKEMASK1(4)
@@ -331,7 +334,7 @@
331#define M_DUART_OUT_PIN_CLR(chan) \ 334#define M_DUART_OUT_PIN_CLR(chan) \
332 (chan == 0 ? M_DUART_OUT_PIN_CLR0 : M_DUART_OUT_PIN_CLR1) 335 (chan == 0 ? M_DUART_OUT_PIN_CLR0 : M_DUART_OUT_PIN_CLR1)
333 336
334#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 337#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
335/* 338/*
336 * Full Interrupt Control Register 339 * Full Interrupt Control Register
337 */ 340 */
@@ -345,7 +348,7 @@
345#define M_DUART_INT_TIME _SB_MAKEMASK(4,S_DUART_INT_TIME) 348#define M_DUART_INT_TIME _SB_MAKEMASK(4,S_DUART_INT_TIME)
346#define V_DUART_INT_TIME(x) _SB_MAKEVALUE(x,S_DUART_INT_TIME) 349#define V_DUART_INT_TIME(x) _SB_MAKEVALUE(x,S_DUART_INT_TIME)
347#define G_DUART_INT_TIME(x) _SB_GETVALUE(x,S_DUART_INT_TIME,M_DUART_INT_TIME) 350#define G_DUART_INT_TIME(x) _SB_GETVALUE(x,S_DUART_INT_TIME,M_DUART_INT_TIME)
348#endif /* 1250 PASS2 || 112x PASS1 */ 351#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
349 352
350 353
351/* ********************************************************************** */ 354/* ********************************************************************** */
diff --git a/include/asm-mips/sibyte/swarm.h b/include/asm-mips/sibyte/swarm.h
index 97fa0494c30c..06e1d528e03a 100644
--- a/include/asm-mips/sibyte/swarm.h
+++ b/include/asm-mips/sibyte/swarm.h
@@ -34,7 +34,7 @@
34#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200" 34#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
35#endif 35#endif
36#ifdef CONFIG_SIBYTE_LITTLESUR 36#ifdef CONFIG_SIBYTE_LITTLESUR
37#define SIBYTE_BOARD_NAME "BCM1250C2 (LittleSur)" 37#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)"
38#define SIBYTE_HAVE_PCMCIA 0 38#define SIBYTE_HAVE_PCMCIA 0
39#define SIBYTE_HAVE_IDE 1 39#define SIBYTE_HAVE_IDE 1
40#define SIBYTE_DEFAULT_CONSOLE "cfe0" 40#define SIBYTE_DEFAULT_CONSOLE "cfe0"
diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h
index f7fbebaa0744..8edabb0be23f 100644
--- a/include/asm-mips/sigcontext.h
+++ b/include/asm-mips/sigcontext.h
@@ -27,14 +27,15 @@ struct sigcontext {
27 unsigned int sc_fpc_csr; 27 unsigned int sc_fpc_csr;
28 unsigned int sc_fpc_eir; /* Unused */ 28 unsigned int sc_fpc_eir; /* Unused */
29 unsigned int sc_used_math; 29 unsigned int sc_used_math;
30 unsigned int sc_ssflags; /* Unused */ 30 unsigned int sc_dsp; /* dsp status, was sc_ssflags */
31 unsigned long long sc_mdhi; 31 unsigned long long sc_mdhi;
32 unsigned long long sc_mdlo; 32 unsigned long long sc_mdlo;
33 33 unsigned long sc_hi1; /* Was sc_cause */
34 unsigned int sc_cause; /* Unused */ 34 unsigned long sc_lo1; /* Was sc_badvaddr */
35 unsigned int sc_badvaddr; /* Unused */ 35 unsigned long sc_hi2; /* Was sc_sigset[4] */
36 36 unsigned long sc_lo2;
37 unsigned long sc_sigset[4]; /* kernel's sigset_t */ 37 unsigned long sc_hi3;
38 unsigned long sc_lo3;
38}; 39};
39 40
40#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 41#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
@@ -48,19 +49,19 @@ struct sigcontext {
48 * Warning: this structure illdefined with sc_badvaddr being just an unsigned 49 * Warning: this structure illdefined with sc_badvaddr being just an unsigned
49 * int so it was changed to unsigned long in 2.6.0-test1. This may break 50 * int so it was changed to unsigned long in 2.6.0-test1. This may break
50 * binary compatibility - no prisoners. 51 * binary compatibility - no prisoners.
52 * DSP ASE in 2.6.12-rc4. Turn sc_mdhi and sc_mdlo into an array of four
53 * entries, add sc_dsp and sc_reserved for padding. No prisoners.
51 */ 54 */
52struct sigcontext { 55struct sigcontext {
53 unsigned long sc_regs[32]; 56 unsigned long sc_regs[32];
54 unsigned long sc_fpregs[32]; 57 unsigned long sc_fpregs[32];
55 unsigned long sc_mdhi; 58 unsigned long sc_hi[4];
56 unsigned long sc_mdlo; 59 unsigned long sc_lo[4];
57 unsigned long sc_pc; 60 unsigned long sc_pc;
58 unsigned long sc_badvaddr;
59 unsigned int sc_status;
60 unsigned int sc_fpc_csr; 61 unsigned int sc_fpc_csr;
61 unsigned int sc_fpc_eir;
62 unsigned int sc_used_math; 62 unsigned int sc_used_math;
63 unsigned int sc_cause; 63 unsigned int sc_dsp;
64 unsigned int sc_reserved;
64}; 65};
65 66
66#ifdef __KERNEL__ 67#ifdef __KERNEL__
@@ -68,23 +69,24 @@ struct sigcontext {
68#include <linux/posix_types.h> 69#include <linux/posix_types.h>
69 70
70struct sigcontext32 { 71struct sigcontext32 {
71 __u32 sc_regmask; /* Unused */ 72 __u32 sc_regmask; /* Unused */
72 __u32 sc_status; 73 __u32 sc_status;
73 __u64 sc_pc; 74 __u64 sc_pc;
74 __u64 sc_regs[32]; 75 __u64 sc_regs[32];
75 __u64 sc_fpregs[32]; 76 __u64 sc_fpregs[32];
76 __u32 sc_ownedfp; /* Unused */ 77 __u32 sc_ownedfp; /* Unused */
77 __u32 sc_fpc_csr; 78 __u32 sc_fpc_csr;
78 __u32 sc_fpc_eir; /* Unused */ 79 __u32 sc_fpc_eir; /* Unused */
79 __u32 sc_used_math; 80 __u32 sc_used_math;
80 __u32 sc_ssflags; /* Unused */ 81 __u32 sc_dsp; /* dsp status, was sc_ssflags */
81 __u64 sc_mdhi; 82 __u64 sc_mdhi;
82 __u64 sc_mdlo; 83 __u64 sc_mdlo;
83 84 __u32 sc_hi1; /* Was sc_cause */
84 __u32 sc_cause; /* Unused */ 85 __u32 sc_lo1; /* Was sc_badvaddr */
85 __u32 sc_badvaddr; /* Unused */ 86 __u32 sc_hi2; /* Was sc_sigset[4] */
86 87 __u32 sc_lo2;
87 __u32 sc_sigset[4]; /* kernel's sigset_t */ 88 __u32 sc_hi3;
89 __u32 sc_lo3;
88}; 90};
89#endif /* __KERNEL__ */ 91#endif /* __KERNEL__ */
90 92
diff --git a/include/asm-mips/siginfo.h b/include/asm-mips/siginfo.h
index 698becab5a9e..2ba313d94a78 100644
--- a/include/asm-mips/siginfo.h
+++ b/include/asm-mips/siginfo.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/config.h> 12#include <linux/config.h>
13 13
14#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2*sizeof(int))
14#undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */ 15#undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */
15 16
16#define HAVE_ARCH_SIGINFO_T 17#define HAVE_ARCH_SIGINFO_T
diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h
index f2c470f1d369..8ca539e80d87 100644
--- a/include/asm-mips/signal.h
+++ b/include/asm-mips/signal.h
@@ -98,12 +98,39 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
98#define MINSIGSTKSZ 2048 98#define MINSIGSTKSZ 2048
99#define SIGSTKSZ 8192 99#define SIGSTKSZ 8192
100 100
101#ifdef __KERNEL__
102
103/*
104 * These values of sa_flags are used only by the kernel as part of the
105 * irq handling routines.
106 *
107 * SA_INTERRUPT is also used by the irq handling routines.
108 * SA_SHIRQ flag is for shared interrupt support on PCI and EISA.
109 */
110#define SA_SAMPLE_RANDOM SA_RESTART
111
112#ifdef CONFIG_TRAD_SIGNALS
113#define sig_uses_siginfo(ka) ((ka)->sa.sa_flags & SA_SIGINFO)
114#else
115#define sig_uses_siginfo(ka) (1)
116#endif
117
118#endif /* __KERNEL__ */
119
101#define SIG_BLOCK 1 /* for blocking signals */ 120#define SIG_BLOCK 1 /* for blocking signals */
102#define SIG_UNBLOCK 2 /* for unblocking signals */ 121#define SIG_UNBLOCK 2 /* for unblocking signals */
103#define SIG_SETMASK 3 /* for setting the signal mask */ 122#define SIG_SETMASK 3 /* for setting the signal mask */
104#define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility: 123#define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility:
105 set only the low 32 bit of the sigset. */ 124 set only the low 32 bit of the sigset. */
106#include <asm-generic/signal.h> 125
126/* Type of a signal handler. */
127typedef void __signalfn_t(int);
128typedef __signalfn_t __user *__sighandler_t;
129
130/* Fake signal functions */
131#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
132#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
133#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
107 134
108struct sigaction { 135struct sigaction {
109 unsigned int sa_flags; 136 unsigned int sa_flags;
diff --git a/include/asm-mips/sn/sn0/arch.h b/include/asm-mips/sn/sn0/arch.h
index 0e00dd474afc..fb78773a5efe 100644
--- a/include/asm-mips/sn/sn0/arch.h
+++ b/include/asm-mips/sn/sn0/arch.h
@@ -74,13 +74,8 @@
74#define MAX_MEM_SLOTS 32 /* max slots per node */ 74#define MAX_MEM_SLOTS 32 /* max slots per node */
75#endif /* defined(N_MODE) */ 75#endif /* defined(N_MODE) */
76 76
77#if SABLE_RTL
78#define SLOT_SHIFT (28)
79#define SLOT_MIN_MEM_SIZE (16*1024*1024)
80#else
81#define SLOT_SHIFT (27) 77#define SLOT_SHIFT (27)
82#define SLOT_MIN_MEM_SIZE (32*1024*1024) 78#define SLOT_MIN_MEM_SIZE (32*1024*1024)
83#endif
84 79
85#define CPUS_PER_NODE 2 /* CPUs on a single hub */ 80#define CPUS_PER_NODE 2 /* CPUs on a single hub */
86#define CPUS_PER_NODE_SHFT 1 /* Bits to shift in the node number */ 81#define CPUS_PER_NODE_SHFT 1 /* Bits to shift in the node number */
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
index 753b6620e6fa..0bb31e5aaca6 100644
--- a/include/asm-mips/socket.h
+++ b/include/asm-mips/socket.h
@@ -37,8 +37,6 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
37#define SO_ERROR 0x1007 /* get error status and clear */ 37#define SO_ERROR 0x1007 /* get error status and clear */
38#define SO_SNDBUF 0x1001 /* Send buffer size. */ 38#define SO_SNDBUF 0x1001 /* Send buffer size. */
39#define SO_RCVBUF 0x1002 /* Receive buffer. */ 39#define SO_RCVBUF 0x1002 /* Receive buffer. */
40#define SO_SNDBUFFORCE 0x100a
41#define SO_RCVBUFFORCE 0x100b
42#define SO_SNDLOWAT 0x1003 /* send low-water mark */ 40#define SO_SNDLOWAT 0x1003 /* send low-water mark */
43#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ 41#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
44#define SO_SNDTIMEO 0x1005 /* send timeout */ 42#define SO_SNDTIMEO 0x1005 /* send timeout */
@@ -69,6 +67,8 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
69#define SCM_TIMESTAMP SO_TIMESTAMP 67#define SCM_TIMESTAMP SO_TIMESTAMP
70 68
71#define SO_PEERSEC 30 69#define SO_PEERSEC 30
70#define SO_SNDBUFFORCE 31
71#define SO_RCVBUFFORCE 33
72 72
73#ifdef __KERNEL__ 73#ifdef __KERNEL__
74 74
@@ -92,6 +92,7 @@ enum sock_type {
92 SOCK_RAW = 3, 92 SOCK_RAW = 3,
93 SOCK_RDM = 4, 93 SOCK_RDM = 4,
94 SOCK_SEQPACKET = 5, 94 SOCK_SEQPACKET = 5,
95 SOCK_DCCP = 6,
95 SOCK_PACKET = 10, 96 SOCK_PACKET = 10,
96}; 97};
97 98
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index 4d0135b11156..669b8e349ff2 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -9,17 +9,16 @@
9#ifndef _ASM_SPINLOCK_H 9#ifndef _ASM_SPINLOCK_H
10#define _ASM_SPINLOCK_H 10#define _ASM_SPINLOCK_H
11 11
12#include <linux/config.h>
13#include <asm/war.h> 12#include <asm/war.h>
14 13
15/* 14/*
16 * Your basic SMP spinlocks, allowing only a single CPU anywhere 15 * Your basic SMP spinlocks, allowing only a single CPU anywhere
17 */ 16 */
18 17
19#define __raw_spin_is_locked(x) ((x)->lock != 0) 18#define __raw_spin_is_locked(x) ((x)->lock != 0)
20#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 19#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
21#define __raw_spin_unlock_wait(x) \ 20#define __raw_spin_unlock_wait(x) \
22 do { cpu_relax(); } while ((x)->lock) 21 do { cpu_relax(); } while ((x)->lock)
23 22
24/* 23/*
25 * Simple spin lock operations. There are two variants, one clears IRQ's 24 * Simple spin lock operations. There are two variants, one clears IRQ's
@@ -119,6 +118,18 @@ static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock)
119 * read-locks. 118 * read-locks.
120 */ 119 */
121 120
121/*
122 * read_can_lock - would read_trylock() succeed?
123 * @lock: the rwlock in question.
124 */
125#define __raw_read_can_lock(rw) ((rw)->lock >= 0)
126
127/*
128 * write_can_lock - would write_trylock() succeed?
129 * @lock: the rwlock in question.
130 */
131#define __raw_write_can_lock(rw) (!(rw)->lock)
132
122static inline void __raw_read_lock(raw_rwlock_t *rw) 133static inline void __raw_read_lock(raw_rwlock_t *rw)
123{ 134{
124 unsigned int tmp; 135 unsigned int tmp;
@@ -197,8 +208,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
197 " lui %1, 0x8000 \n" 208 " lui %1, 0x8000 \n"
198 " sc %1, %0 \n" 209 " sc %1, %0 \n"
199 " beqzl %1, 1b \n" 210 " beqzl %1, 1b \n"
200 " nop \n" 211 " sync \n"
201 " sync \n"
202 " .set reorder \n" 212 " .set reorder \n"
203 : "=m" (rw->lock), "=&r" (tmp) 213 : "=m" (rw->lock), "=&r" (tmp)
204 : "m" (rw->lock) 214 : "m" (rw->lock)
@@ -211,8 +221,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
211 " lui %1, 0x8000 \n" 221 " lui %1, 0x8000 \n"
212 " sc %1, %0 \n" 222 " sc %1, %0 \n"
213 " beqz %1, 1b \n" 223 " beqz %1, 1b \n"
214 " nop \n" 224 " sync \n"
215 " sync \n"
216 " .set reorder \n" 225 " .set reorder \n"
217 : "=m" (rw->lock), "=&r" (tmp) 226 : "=m" (rw->lock), "=&r" (tmp)
218 : "m" (rw->lock) 227 : "m" (rw->lock)
@@ -246,8 +255,7 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
246 " lui %1, 0x8000 \n" 255 " lui %1, 0x8000 \n"
247 " sc %1, %0 \n" 256 " sc %1, %0 \n"
248 " beqzl %1, 1b \n" 257 " beqzl %1, 1b \n"
249 " nop \n" 258 " sync \n"
250 " sync \n"
251 " li %2, 1 \n" 259 " li %2, 1 \n"
252 " .set reorder \n" 260 " .set reorder \n"
253 "2: \n" 261 "2: \n"
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index 7b5e64600bc8..a8919dcc93c8 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -60,7 +60,6 @@
60 mfc0 k0, CP0_CONTEXT 60 mfc0 k0, CP0_CONTEXT
61 lui k1, %hi(kernelsp) 61 lui k1, %hi(kernelsp)
62 srl k0, k0, 23 62 srl k0, k0, 23
63 sll k0, k0, 2
64 addu k1, k0 63 addu k1, k0
65 LONG_L k1, %lo(kernelsp)(k1) 64 LONG_L k1, %lo(kernelsp)(k1)
66#endif 65#endif
@@ -76,9 +75,14 @@
76#endif 75#endif
77#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64) 76#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
78 MFC0 k1, CP0_CONTEXT 77 MFC0 k1, CP0_CONTEXT
78 lui k0, %highest(kernelsp)
79 dsrl k1, 23 79 dsrl k1, 23
80 dsll k1, k1, 3 80 daddiu k0, %higher(kernelsp)
81 LONG_L k1, kernelsp(k1) 81 dsll k0, k0, 16
82 daddiu k0, %hi(kernelsp)
83 dsll k0, k0, 16
84 daddu k1, k1, k0
85 LONG_L k1, %lo(kernelsp)(k1)
82#endif 86#endif
83 .endm 87 .endm
84 88
@@ -86,25 +90,28 @@
86#ifdef CONFIG_32BIT 90#ifdef CONFIG_32BIT
87 mfc0 \temp, CP0_CONTEXT 91 mfc0 \temp, CP0_CONTEXT
88 srl \temp, 23 92 srl \temp, 23
89 sll \temp, 2
90 LONG_S \stackp, kernelsp(\temp)
91#endif 93#endif
92#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) 94#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
93 lw \temp, TI_CPU(gp) 95 lw \temp, TI_CPU(gp)
94 dsll \temp, 3 96 dsll \temp, 3
95 lui \temp2, %hi(kernelsp)
96 daddu \temp, \temp2
97 LONG_S \stackp, %lo(kernelsp)(\temp)
98#endif 97#endif
99#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64) 98#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
100 lw \temp, TI_CPU(gp) 99 MFC0 \temp, CP0_CONTEXT
101 dsll \temp, 3 100 dsrl \temp, 23
102 LONG_S \stackp, kernelsp(\temp)
103#endif 101#endif
102 LONG_S \stackp, kernelsp(\temp)
104 .endm 103 .endm
105#else 104#else
106 .macro get_saved_sp /* Uniprocessor variation */ 105 .macro get_saved_sp /* Uniprocessor variation */
106#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
107 lui k1, %highest(kernelsp)
108 daddiu k1, %higher(kernelsp)
109 dsll k1, k1, 16
110 daddiu k1, %hi(kernelsp)
111 dsll k1, k1, 16
112#else
107 lui k1, %hi(kernelsp) 113 lui k1, %hi(kernelsp)
114#endif
108 LONG_L k1, %lo(kernelsp)(k1) 115 LONG_L k1, %lo(kernelsp)(k1)
109 .endm 116 .endm
110 117
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 6663efd49b27..330c4e497af3 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -17,6 +17,7 @@
17 17
18#include <asm/addrspace.h> 18#include <asm/addrspace.h>
19#include <asm/cpu-features.h> 19#include <asm/cpu-features.h>
20#include <asm/dsp.h>
20#include <asm/ptrace.h> 21#include <asm/ptrace.h>
21#include <asm/war.h> 22#include <asm/war.h>
22#include <asm/interrupt.h> 23#include <asm/interrupt.h>
@@ -70,7 +71,7 @@
70 * does not enforce ordering, since there is no data dependency between 71 * does not enforce ordering, since there is no data dependency between
71 * the read of "a" and the read of "b". Therefore, on some CPUs, such 72 * the read of "a" and the read of "b". Therefore, on some CPUs, such
72 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() 73 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
73 * in cases like thiswhere there are no data dependencies. 74 * in cases like this where there are no data dependencies.
74 */ 75 */
75 76
76#define read_barrier_depends() do { } while(0) 77#define read_barrier_depends() do { } while(0)
@@ -154,15 +155,15 @@ extern asmlinkage void *resume(void *last, void *next, void *next_ti);
154 155
155struct task_struct; 156struct task_struct;
156 157
157#define switch_to(prev,next,last) \ 158#define switch_to(prev,next,last) \
158do { \ 159do { \
159 (last) = resume(prev, next, next->thread_info); \ 160 if (cpu_has_dsp) \
161 __save_dsp(prev); \
162 (last) = resume(prev, next, next->thread_info); \
163 if (cpu_has_dsp) \
164 __restore_dsp(current); \
160} while(0) 165} while(0)
161 166
162#define ROT_IN_PIECES \
163 " .set noreorder \n" \
164 " .set reorder \n"
165
166static inline unsigned long __xchg_u32(volatile int * m, unsigned int val) 167static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
167{ 168{
168 __u32 retval; 169 __u32 retval;
@@ -171,14 +172,17 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
171 unsigned long dummy; 172 unsigned long dummy;
172 173
173 __asm__ __volatile__( 174 __asm__ __volatile__(
175 " .set mips3 \n"
174 "1: ll %0, %3 # xchg_u32 \n" 176 "1: ll %0, %3 # xchg_u32 \n"
177 " .set mips0 \n"
175 " move %2, %z4 \n" 178 " move %2, %z4 \n"
179 " .set mips3 \n"
176 " sc %2, %1 \n" 180 " sc %2, %1 \n"
177 " beqzl %2, 1b \n" 181 " beqzl %2, 1b \n"
178 ROT_IN_PIECES
179#ifdef CONFIG_SMP 182#ifdef CONFIG_SMP
180 " sync \n" 183 " sync \n"
181#endif 184#endif
185 " .set mips0 \n"
182 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 186 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
183 : "R" (*m), "Jr" (val) 187 : "R" (*m), "Jr" (val)
184 : "memory"); 188 : "memory");
@@ -186,13 +190,17 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
186 unsigned long dummy; 190 unsigned long dummy;
187 191
188 __asm__ __volatile__( 192 __asm__ __volatile__(
193 " .set mips3 \n"
189 "1: ll %0, %3 # xchg_u32 \n" 194 "1: ll %0, %3 # xchg_u32 \n"
195 " .set mips0 \n"
190 " move %2, %z4 \n" 196 " move %2, %z4 \n"
197 " .set mips3 \n"
191 " sc %2, %1 \n" 198 " sc %2, %1 \n"
192 " beqz %2, 1b \n" 199 " beqz %2, 1b \n"
193#ifdef CONFIG_SMP 200#ifdef CONFIG_SMP
194 " sync \n" 201 " sync \n"
195#endif 202#endif
203 " .set mips0 \n"
196 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 204 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
197 : "R" (*m), "Jr" (val) 205 : "R" (*m), "Jr" (val)
198 : "memory"); 206 : "memory");
@@ -217,14 +225,15 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
217 unsigned long dummy; 225 unsigned long dummy;
218 226
219 __asm__ __volatile__( 227 __asm__ __volatile__(
228 " .set mips3 \n"
220 "1: lld %0, %3 # xchg_u64 \n" 229 "1: lld %0, %3 # xchg_u64 \n"
221 " move %2, %z4 \n" 230 " move %2, %z4 \n"
222 " scd %2, %1 \n" 231 " scd %2, %1 \n"
223 " beqzl %2, 1b \n" 232 " beqzl %2, 1b \n"
224 ROT_IN_PIECES
225#ifdef CONFIG_SMP 233#ifdef CONFIG_SMP
226 " sync \n" 234 " sync \n"
227#endif 235#endif
236 " .set mips0 \n"
228 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 237 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
229 : "R" (*m), "Jr" (val) 238 : "R" (*m), "Jr" (val)
230 : "memory"); 239 : "memory");
@@ -232,6 +241,7 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
232 unsigned long dummy; 241 unsigned long dummy;
233 242
234 __asm__ __volatile__( 243 __asm__ __volatile__(
244 " .set mips3 \n"
235 "1: lld %0, %3 # xchg_u64 \n" 245 "1: lld %0, %3 # xchg_u64 \n"
236 " move %2, %z4 \n" 246 " move %2, %z4 \n"
237 " scd %2, %1 \n" 247 " scd %2, %1 \n"
@@ -239,6 +249,7 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
239#ifdef CONFIG_SMP 249#ifdef CONFIG_SMP
240 " sync \n" 250 " sync \n"
241#endif 251#endif
252 " .set mips0 \n"
242 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 253 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
243 : "R" (*m), "Jr" (val) 254 : "R" (*m), "Jr" (val)
244 : "memory"); 255 : "memory");
@@ -286,34 +297,41 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
286 297
287 if (cpu_has_llsc && R10000_LLSC_WAR) { 298 if (cpu_has_llsc && R10000_LLSC_WAR) {
288 __asm__ __volatile__( 299 __asm__ __volatile__(
300 " .set push \n"
289 " .set noat \n" 301 " .set noat \n"
302 " .set mips3 \n"
290 "1: ll %0, %2 # __cmpxchg_u32 \n" 303 "1: ll %0, %2 # __cmpxchg_u32 \n"
291 " bne %0, %z3, 2f \n" 304 " bne %0, %z3, 2f \n"
305 " .set mips0 \n"
292 " move $1, %z4 \n" 306 " move $1, %z4 \n"
307 " .set mips3 \n"
293 " sc $1, %1 \n" 308 " sc $1, %1 \n"
294 " beqzl $1, 1b \n" 309 " beqzl $1, 1b \n"
295 ROT_IN_PIECES
296#ifdef CONFIG_SMP 310#ifdef CONFIG_SMP
297 " sync \n" 311 " sync \n"
298#endif 312#endif
299 "2: \n" 313 "2: \n"
300 " .set at \n" 314 " .set pop \n"
301 : "=&r" (retval), "=m" (*m) 315 : "=&r" (retval), "=m" (*m)
302 : "R" (*m), "Jr" (old), "Jr" (new) 316 : "R" (*m), "Jr" (old), "Jr" (new)
303 : "memory"); 317 : "memory");
304 } else if (cpu_has_llsc) { 318 } else if (cpu_has_llsc) {
305 __asm__ __volatile__( 319 __asm__ __volatile__(
320 " .set push \n"
306 " .set noat \n" 321 " .set noat \n"
322 " .set mips3 \n"
307 "1: ll %0, %2 # __cmpxchg_u32 \n" 323 "1: ll %0, %2 # __cmpxchg_u32 \n"
308 " bne %0, %z3, 2f \n" 324 " bne %0, %z3, 2f \n"
325 " .set mips0 \n"
309 " move $1, %z4 \n" 326 " move $1, %z4 \n"
327 " .set mips3 \n"
310 " sc $1, %1 \n" 328 " sc $1, %1 \n"
311 " beqz $1, 1b \n" 329 " beqz $1, 1b \n"
312#ifdef CONFIG_SMP 330#ifdef CONFIG_SMP
313 " sync \n" 331 " sync \n"
314#endif 332#endif
315 "2: \n" 333 "2: \n"
316 " .set at \n" 334 " .set pop \n"
317 : "=&r" (retval), "=m" (*m) 335 : "=&r" (retval), "=m" (*m)
318 : "R" (*m), "Jr" (old), "Jr" (new) 336 : "R" (*m), "Jr" (old), "Jr" (new)
319 : "memory"); 337 : "memory");
@@ -338,24 +356,27 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
338 356
339 if (cpu_has_llsc) { 357 if (cpu_has_llsc) {
340 __asm__ __volatile__( 358 __asm__ __volatile__(
359 " .set push \n"
341 " .set noat \n" 360 " .set noat \n"
361 " .set mips3 \n"
342 "1: lld %0, %2 # __cmpxchg_u64 \n" 362 "1: lld %0, %2 # __cmpxchg_u64 \n"
343 " bne %0, %z3, 2f \n" 363 " bne %0, %z3, 2f \n"
344 " move $1, %z4 \n" 364 " move $1, %z4 \n"
345 " scd $1, %1 \n" 365 " scd $1, %1 \n"
346 " beqzl $1, 1b \n" 366 " beqzl $1, 1b \n"
347 ROT_IN_PIECES
348#ifdef CONFIG_SMP 367#ifdef CONFIG_SMP
349 " sync \n" 368 " sync \n"
350#endif 369#endif
351 "2: \n" 370 "2: \n"
352 " .set at \n" 371 " .set pop \n"
353 : "=&r" (retval), "=m" (*m) 372 : "=&r" (retval), "=m" (*m)
354 : "R" (*m), "Jr" (old), "Jr" (new) 373 : "R" (*m), "Jr" (old), "Jr" (new)
355 : "memory"); 374 : "memory");
356 } else if (cpu_has_llsc) { 375 } else if (cpu_has_llsc) {
357 __asm__ __volatile__( 376 __asm__ __volatile__(
377 " .set push \n"
358 " .set noat \n" 378 " .set noat \n"
379 " .set mips3 \n"
359 "1: lld %0, %2 # __cmpxchg_u64 \n" 380 "1: lld %0, %2 # __cmpxchg_u64 \n"
360 " bne %0, %z3, 2f \n" 381 " bne %0, %z3, 2f \n"
361 " move $1, %z4 \n" 382 " move $1, %z4 \n"
@@ -365,7 +386,7 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
365 " sync \n" 386 " sync \n"
366#endif 387#endif
367 "2: \n" 388 "2: \n"
368 " .set at \n" 389 " .set pop \n"
369 : "=&r" (retval), "=m" (*m) 390 : "=&r" (retval), "=m" (*m)
370 : "R" (*m), "Jr" (old), "Jr" (new) 391 : "R" (*m), "Jr" (old), "Jr" (new)
371 : "memory"); 392 : "memory");
@@ -406,18 +427,20 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
406 427
407#define cmpxchg(ptr,old,new) ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(old), (unsigned long)(new),sizeof(*(ptr)))) 428#define cmpxchg(ptr,old,new) ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(old), (unsigned long)(new),sizeof(*(ptr))))
408 429
430extern void set_handler (unsigned long offset, void *addr, unsigned long len);
431extern void set_uncached_handler (unsigned long offset, void *addr, unsigned long len);
432extern void *set_vi_handler (int n, void *addr);
433extern void *set_vi_srs_handler (int n, void *addr, int regset);
409extern void *set_except_vector(int n, void *addr); 434extern void *set_except_vector(int n, void *addr);
410extern void per_cpu_trap_init(void); 435extern void per_cpu_trap_init(void);
411 436
412extern NORET_TYPE void __die(const char *, struct pt_regs *, const char *file, 437extern NORET_TYPE void die(const char *, struct pt_regs *);
413 const char *func, unsigned long line);
414extern void __die_if_kernel(const char *, struct pt_regs *, const char *file,
415 const char *func, unsigned long line);
416 438
417#define die(msg, regs) \ 439static inline void die_if_kernel(const char *str, struct pt_regs *regs)
418 __die(msg, regs, __FILE__ ":", __FUNCTION__, __LINE__) 440{
419#define die_if_kernel(msg, regs) \ 441 if (unlikely(!user_mode(regs)))
420 __die_if_kernel(msg, regs, __FILE__ ":", __FUNCTION__, __LINE__) 442 die(str, regs);
443}
421 444
422extern int stop_a_enabled; 445extern int stop_a_enabled;
423 446
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index a70cb0854c8a..e6c24472e03f 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -26,6 +26,7 @@ struct thread_info {
26 struct task_struct *task; /* main task structure */ 26 struct task_struct *task; /* main task structure */
27 struct exec_domain *exec_domain; /* execution domain */ 27 struct exec_domain *exec_domain; /* execution domain */
28 unsigned long flags; /* low level flags */ 28 unsigned long flags; /* low level flags */
29 unsigned long tp_value; /* thread pointer */
29 __u32 cpu; /* current CPU */ 30 __u32 cpu; /* current CPU */
30 int preempt_count; /* 0 => preemptable, <0 => BUG */ 31 int preempt_count; /* 0 => preemptable, <0 => BUG */
31 32
@@ -114,6 +115,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
114#define TIF_SIGPENDING 2 /* signal pending */ 115#define TIF_SIGPENDING 2 /* signal pending */
115#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 116#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
116#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */ 117#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
118#define TIF_SECCOMP 5 /* secure computing */
117#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 119#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
118#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 120#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
119#define TIF_MEMDIE 18 121#define TIF_MEMDIE 18
@@ -124,13 +126,14 @@ register struct thread_info *__current_thread_info __asm__("$28");
124#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 126#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
125#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 127#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
126#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 128#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
129#define _TIF_SECCOMP (1<<TIF_SECCOMP)
127#define _TIF_USEDFPU (1<<TIF_USEDFPU) 130#define _TIF_USEDFPU (1<<TIF_USEDFPU)
128#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 131#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
129 132
130#define _TIF_WORK_MASK 0x0000ffef /* work to do on 133/* work to do on interrupt/exception return */
131 interrupt/exception return */ 134#define _TIF_WORK_MASK (0x0000ffef & ~_TIF_SECCOMP)
132#define _TIF_ALLWORK_MASK 0x8000ffff /* work to do on any return to 135/* work to do on any return to u-space */
133 u-space */ 136#define _TIF_ALLWORK_MASK (0x8000ffff & ~_TIF_SECCOMP)
134 137
135#endif /* __KERNEL__ */ 138#endif /* __KERNEL__ */
136 139
diff --git a/include/asm-mips/traps.h b/include/asm-mips/traps.h
index 179012263007..d02e019b0127 100644
--- a/include/asm-mips/traps.h
+++ b/include/asm-mips/traps.h
@@ -21,4 +21,7 @@
21extern void (*board_be_init)(void); 21extern void (*board_be_init)(void);
22extern int (*board_be_handler)(struct pt_regs *regs, int is_fixup); 22extern int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
23 23
24extern void (*board_nmi_handler_setup)(void);
25extern void (*board_ejtag_handler_setup)(void);
26
24#endif /* _ASM_TRAPS_H */ 27#endif /* _ASM_TRAPS_H */
diff --git a/include/asm-mips/tx4938/rbtx4938.h b/include/asm-mips/tx4938/rbtx4938.h
new file mode 100644
index 000000000000..0fbedafdcea8
--- /dev/null
+++ b/include/asm-mips/tx4938/rbtx4938.h
@@ -0,0 +1,207 @@
1/*
2 * linux/include/asm-mips/tx4938/rbtx4938.h
3 * Definitions for TX4937/TX4938
4 *
5 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
6 * terms of the GNU General Public License version 2. This program is
7 * licensed "as is" without any warranty of any kind, whether express
8 * or implied.
9 *
10 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
11 */
12#ifndef __ASM_TX_BOARDS_RBTX4938_H
13#define __ASM_TX_BOARDS_RBTX4938_H
14
15#include <asm/addrspace.h>
16#include <asm/tx4938/tx4938.h>
17
18/* CS */
19#define RBTX4938_CE0 0x1c000000 /* 64M */
20#define RBTX4938_CE2 0x17f00000 /* 1M */
21
22/* Address map */
23#define RBTX4938_FPGA_REG_ADDR (KSEG1 + RBTX4938_CE2 + 0x00000000)
24#define RBTX4938_FPGA_REV_ADDR (KSEG1 + RBTX4938_CE2 + 0x00000002)
25#define RBTX4938_CONFIG1_ADDR (KSEG1 + RBTX4938_CE2 + 0x00000004)
26#define RBTX4938_CONFIG2_ADDR (KSEG1 + RBTX4938_CE2 + 0x00000006)
27#define RBTX4938_CONFIG3_ADDR (KSEG1 + RBTX4938_CE2 + 0x00000008)
28#define RBTX4938_LED_ADDR (KSEG1 + RBTX4938_CE2 + 0x00001000)
29#define RBTX4938_DIPSW_ADDR (KSEG1 + RBTX4938_CE2 + 0x00001002)
30#define RBTX4938_BDIPSW_ADDR (KSEG1 + RBTX4938_CE2 + 0x00001004)
31#define RBTX4938_IMASK_ADDR (KSEG1 + RBTX4938_CE2 + 0x00002000)
32#define RBTX4938_IMASK2_ADDR (KSEG1 + RBTX4938_CE2 + 0x00002002)
33#define RBTX4938_INTPOL_ADDR (KSEG1 + RBTX4938_CE2 + 0x00002004)
34#define RBTX4938_ISTAT_ADDR (KSEG1 + RBTX4938_CE2 + 0x00002006)
35#define RBTX4938_ISTAT2_ADDR (KSEG1 + RBTX4938_CE2 + 0x00002008)
36#define RBTX4938_IMSTAT_ADDR (KSEG1 + RBTX4938_CE2 + 0x0000200a)
37#define RBTX4938_IMSTAT2_ADDR (KSEG1 + RBTX4938_CE2 + 0x0000200c)
38#define RBTX4938_SOFTINT_ADDR (KSEG1 + RBTX4938_CE2 + 0x00003000)
39#define RBTX4938_PIOSEL_ADDR (KSEG1 + RBTX4938_CE2 + 0x00005000)
40#define RBTX4938_SPICS_ADDR (KSEG1 + RBTX4938_CE2 + 0x00005002)
41#define RBTX4938_SFPWR_ADDR (KSEG1 + RBTX4938_CE2 + 0x00005008)
42#define RBTX4938_SFVOL_ADDR (KSEG1 + RBTX4938_CE2 + 0x0000500a)
43#define RBTX4938_SOFTRESET_ADDR (KSEG1 + RBTX4938_CE2 + 0x00007000)
44#define RBTX4938_SOFTRESETLOCK_ADDR (KSEG1 + RBTX4938_CE2 + 0x00007002)
45#define RBTX4938_PCIRESET_ADDR (KSEG1 + RBTX4938_CE2 + 0x00007004)
46#define RBTX4938_ETHER_BASE (KSEG1 + RBTX4938_CE2 + 0x00020000)
47
48/* Ethernet port address (Jumperless Mode (W12:Open)) */
49#define RBTX4938_ETHER_ADDR (RBTX4938_ETHER_BASE + 0x280)
50
51/* bits for ISTAT/IMASK/IMSTAT */
52#define RBTX4938_INTB_PCID 0
53#define RBTX4938_INTB_PCIC 1
54#define RBTX4938_INTB_PCIB 2
55#define RBTX4938_INTB_PCIA 3
56#define RBTX4938_INTB_RTC 4
57#define RBTX4938_INTB_ATA 5
58#define RBTX4938_INTB_MODEM 6
59#define RBTX4938_INTB_SWINT 7
60#define RBTX4938_INTF_PCID (1 << RBTX4938_INTB_PCID)
61#define RBTX4938_INTF_PCIC (1 << RBTX4938_INTB_PCIC)
62#define RBTX4938_INTF_PCIB (1 << RBTX4938_INTB_PCIB)
63#define RBTX4938_INTF_PCIA (1 << RBTX4938_INTB_PCIA)
64#define RBTX4938_INTF_RTC (1 << RBTX4938_INTB_RTC)
65#define RBTX4938_INTF_ATA (1 << RBTX4938_INTB_ATA)
66#define RBTX4938_INTF_MODEM (1 << RBTX4938_INTB_MODEM)
67#define RBTX4938_INTF_SWINT (1 << RBTX4938_INTB_SWINT)
68
69#define rbtx4938_fpga_rev_ptr \
70 ((volatile unsigned char *)RBTX4938_FPGA_REV_ADDR)
71#define rbtx4938_led_ptr \
72 ((volatile unsigned char *)RBTX4938_LED_ADDR)
73#define rbtx4938_dipsw_ptr \
74 ((volatile unsigned char *)RBTX4938_DIPSW_ADDR)
75#define rbtx4938_bdipsw_ptr \
76 ((volatile unsigned char *)RBTX4938_BDIPSW_ADDR)
77#define rbtx4938_imask_ptr \
78 ((volatile unsigned char *)RBTX4938_IMASK_ADDR)
79#define rbtx4938_imask2_ptr \
80 ((volatile unsigned char *)RBTX4938_IMASK2_ADDR)
81#define rbtx4938_intpol_ptr \
82 ((volatile unsigned char *)RBTX4938_INTPOL_ADDR)
83#define rbtx4938_istat_ptr \
84 ((volatile unsigned char *)RBTX4938_ISTAT_ADDR)
85#define rbtx4938_istat2_ptr \
86 ((volatile unsigned char *)RBTX4938_ISTAT2_ADDR)
87#define rbtx4938_imstat_ptr \
88 ((volatile unsigned char *)RBTX4938_IMSTAT_ADDR)
89#define rbtx4938_imstat2_ptr \
90 ((volatile unsigned char *)RBTX4938_IMSTAT2_ADDR)
91#define rbtx4938_softint_ptr \
92 ((volatile unsigned char *)RBTX4938_SOFTINT_ADDR)
93#define rbtx4938_piosel_ptr \
94 ((volatile unsigned char *)RBTX4938_PIOSEL_ADDR)
95#define rbtx4938_spics_ptr \
96 ((volatile unsigned char *)RBTX4938_SPICS_ADDR)
97#define rbtx4938_sfpwr_ptr \
98 ((volatile unsigned char *)RBTX4938_SFPWR_ADDR)
99#define rbtx4938_sfvol_ptr \
100 ((volatile unsigned char *)RBTX4938_SFVOL_ADDR)
101#define rbtx4938_softreset_ptr \
102 ((volatile unsigned char *)RBTX4938_SOFTRESET_ADDR)
103#define rbtx4938_softresetlock_ptr \
104 ((volatile unsigned char *)RBTX4938_SOFTRESETLOCK_ADDR)
105#define rbtx4938_pcireset_ptr \
106 ((volatile unsigned char *)RBTX4938_PCIRESET_ADDR)
107
108/* SPI */
109#define RBTX4938_SEEPROM1_CHIPID 0
110#define RBTX4938_SEEPROM2_CHIPID 1
111#define RBTX4938_SEEPROM3_CHIPID 2
112#define RBTX4938_SRTC_CHIPID 3
113
114/*
115 * IRQ mappings
116 */
117
118#define RBTX4938_SOFT_INT0 0 /* not used */
119#define RBTX4938_SOFT_INT1 1 /* not used */
120#define RBTX4938_IRC_INT 2
121#define RBTX4938_TIMER_INT 7
122
123/* These are the virtual IRQ numbers, we divide all IRQ's into
124 * 'spaces', the 'space' determines where and how to enable/disable
125 * that particular IRQ on an RBTX4938 machine. Add new 'spaces' as new
126 * IRQ hardware is supported.
127 */
128#define RBTX4938_NR_IRQ_LOCAL 8
129#define RBTX4938_NR_IRQ_IRC 32 /* On-Chip IRC */
130#define RBTX4938_NR_IRQ_IOC 8
131
132#define MI8259_IRQ_ISA_RAW_BEG 0 /* optional backplane i8259 */
133#define MI8259_IRQ_ISA_RAW_END 15
134#define TX4938_IRQ_CP0_RAW_BEG 0 /* tx4938 cpu built-in cp0 */
135#define TX4938_IRQ_CP0_RAW_END 7
136#define TX4938_IRQ_PIC_RAW_BEG 0 /* tx4938 cpu build-in pic */
137#define TX4938_IRQ_PIC_RAW_END 31
138
139#define MI8259_IRQ_ISA_BEG MI8259_IRQ_ISA_RAW_BEG /* 0 */
140#define MI8259_IRQ_ISA_END MI8259_IRQ_ISA_RAW_END /* 15 */
141
142#define TX4938_IRQ_CP0_BEG ((MI8259_IRQ_ISA_END+1)+TX4938_IRQ_CP0_RAW_BEG) /* 16 */
143#define TX4938_IRQ_CP0_END ((MI8259_IRQ_ISA_END+1)+TX4938_IRQ_CP0_RAW_END) /* 23 */
144
145#define TX4938_IRQ_PIC_BEG ((TX4938_IRQ_CP0_END+1)+TX4938_IRQ_PIC_RAW_BEG) /* 24 */
146#define TX4938_IRQ_PIC_END ((TX4938_IRQ_CP0_END+1)+TX4938_IRQ_PIC_RAW_END) /* 55 */
147#define TX4938_IRQ_NEST_EXT_ON_PIC (TX4938_IRQ_PIC_BEG+2)
148#define TX4938_IRQ_NEST_PIC_ON_CP0 (TX4938_IRQ_CP0_BEG+2)
149#define TX4938_IRQ_USER0 (TX4938_IRQ_CP0_BEG+0)
150#define TX4938_IRQ_USER1 (TX4938_IRQ_CP0_BEG+1)
151#define TX4938_IRQ_CPU_TIMER (TX4938_IRQ_CP0_BEG+7)
152
153#define TOSHIBA_RBTX4938_IRQ_IOC_RAW_BEG 0
154#define TOSHIBA_RBTX4938_IRQ_IOC_RAW_END 7
155
156#define TOSHIBA_RBTX4938_IRQ_IOC_BEG ((TX4938_IRQ_PIC_END+1)+TOSHIBA_RBTX4938_IRQ_IOC_RAW_BEG) /* 56 */
157#define TOSHIBA_RBTX4938_IRQ_IOC_END ((TX4938_IRQ_PIC_END+1)+TOSHIBA_RBTX4938_IRQ_IOC_RAW_END) /* 63 */
158#define RBTX4938_IRQ_LOCAL TX4938_IRQ_CP0_BEG
159#define RBTX4938_IRQ_IRC (RBTX4938_IRQ_LOCAL + RBTX4938_NR_IRQ_LOCAL)
160#define RBTX4938_IRQ_IOC (RBTX4938_IRQ_IRC + RBTX4938_NR_IRQ_IRC)
161#define RBTX4938_IRQ_END (RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC)
162
163#define RBTX4938_IRQ_LOCAL_SOFT0 (RBTX4938_IRQ_LOCAL + RBTX4938_SOFT_INT0)
164#define RBTX4938_IRQ_LOCAL_SOFT1 (RBTX4938_IRQ_LOCAL + RBTX4938_SOFT_INT1)
165#define RBTX4938_IRQ_LOCAL_IRC (RBTX4938_IRQ_LOCAL + RBTX4938_IRC_INT)
166#define RBTX4938_IRQ_LOCAL_TIMER (RBTX4938_IRQ_LOCAL + RBTX4938_TIMER_INT)
167#define RBTX4938_IRQ_IRC_ECCERR (RBTX4938_IRQ_IRC + TX4938_IR_ECCERR)
168#define RBTX4938_IRQ_IRC_WTOERR (RBTX4938_IRQ_IRC + TX4938_IR_WTOERR)
169#define RBTX4938_IRQ_IRC_INT(n) (RBTX4938_IRQ_IRC + TX4938_IR_INT(n))
170#define RBTX4938_IRQ_IRC_SIO(n) (RBTX4938_IRQ_IRC + TX4938_IR_SIO(n))
171#define RBTX4938_IRQ_IRC_DMA(ch,n) (RBTX4938_IRQ_IRC + TX4938_IR_DMA(ch,n))
172#define RBTX4938_IRQ_IRC_PIO (RBTX4938_IRQ_IRC + TX4938_IR_PIO)
173#define RBTX4938_IRQ_IRC_PDMAC (RBTX4938_IRQ_IRC + TX4938_IR_PDMAC)
174#define RBTX4938_IRQ_IRC_PCIC (RBTX4938_IRQ_IRC + TX4938_IR_PCIC)
175#define RBTX4938_IRQ_IRC_TMR(n) (RBTX4938_IRQ_IRC + TX4938_IR_TMR(n))
176#define RBTX4938_IRQ_IRC_NDFMC (RBTX4938_IRQ_IRC + TX4938_IR_NDFMC)
177#define RBTX4938_IRQ_IRC_PCIERR (RBTX4938_IRQ_IRC + TX4938_IR_PCIERR)
178#define RBTX4938_IRQ_IRC_PCIPME (RBTX4938_IRQ_IRC + TX4938_IR_PCIPME)
179#define RBTX4938_IRQ_IRC_ACLC (RBTX4938_IRQ_IRC + TX4938_IR_ACLC)
180#define RBTX4938_IRQ_IRC_ACLCPME (RBTX4938_IRQ_IRC + TX4938_IR_ACLCPME)
181#define RBTX4938_IRQ_IRC_PCIC1 (RBTX4938_IRQ_IRC + TX4938_IR_PCIC1)
182#define RBTX4938_IRQ_IRC_SPI (RBTX4938_IRQ_IRC + TX4938_IR_SPI)
183#define RBTX4938_IRQ_IOC_PCID (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCID)
184#define RBTX4938_IRQ_IOC_PCIC (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIC)
185#define RBTX4938_IRQ_IOC_PCIB (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIB)
186#define RBTX4938_IRQ_IOC_PCIA (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIA)
187#define RBTX4938_IRQ_IOC_RTC (RBTX4938_IRQ_IOC + RBTX4938_INTB_RTC)
188#define RBTX4938_IRQ_IOC_ATA (RBTX4938_IRQ_IOC + RBTX4938_INTB_ATA)
189#define RBTX4938_IRQ_IOC_MODEM (RBTX4938_IRQ_IOC + RBTX4938_INTB_MODEM)
190#define RBTX4938_IRQ_IOC_SWINT (RBTX4938_IRQ_IOC + RBTX4938_INTB_SWINT)
191
192
193/* IOC (PCI, etc) */
194#define RBTX4938_IRQ_IOCINT (TX4938_IRQ_NEST_EXT_ON_PIC)
195/* Onboard 10M Ether */
196#define RBTX4938_IRQ_ETHER (TX4938_IRQ_NEST_EXT_ON_PIC + 1)
197
198#define RBTX4938_RTL_8019_BASE (RBTX4938_ETHER_ADDR - mips_io_port_base)
199#define RBTX4938_RTL_8019_IRQ (RBTX4938_IRQ_ETHER)
200
201/* IRCR : Int. Control */
202#define TX4938_IRCR_LOW 0x00000000
203#define TX4938_IRCR_HIGH 0x00000001
204#define TX4938_IRCR_DOWN 0x00000002
205#define TX4938_IRCR_UP 0x00000003
206
207#endif /* __ASM_TX_BOARDS_RBTX4938_H */
diff --git a/include/asm-mips/tx4938/spi.h b/include/asm-mips/tx4938/spi.h
new file mode 100644
index 000000000000..0dbbab820a5a
--- /dev/null
+++ b/include/asm-mips/tx4938/spi.h
@@ -0,0 +1,74 @@
1/*
2 * linux/include/asm-mips/tx4938/spi.h
3 * Definitions for TX4937/TX4938 SPI
4 *
5 * Copyright (C) 2000-2001 Toshiba Corporation
6 *
7 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
8 * terms of the GNU General Public License version 2. This program is
9 * licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 *
12 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
13 */
14#ifndef __ASM_TX_BOARDS_TX4938_SPI_H
15#define __ASM_TX_BOARDS_TX4938_SPI_H
16
17/* SPI */
18struct spi_dev_desc {
19 unsigned int baud;
20 unsigned short tcss, tcsh, tcsr; /* CS setup/hold/recovery time */
21 unsigned int byteorder:1; /* 0:LSB-First, 1:MSB-First */
22 unsigned int polarity:1; /* 0:High-Active */
23 unsigned int phase:1; /* 0:Sample-Then-Shift */
24};
25
26extern void txx9_spi_init(unsigned long base, int (*cs_func)(int chipid, int on)) __init;
27extern void txx9_spi_irqinit(int irc_irq) __init;
28extern int txx9_spi_io(int chipid, struct spi_dev_desc *desc,
29 unsigned char **inbufs, unsigned int *incounts,
30 unsigned char **outbufs, unsigned int *outcounts,
31 int cansleep);
32extern int spi_eeprom_write_enable(int chipid, int enable);
33extern int spi_eeprom_read_status(int chipid);
34extern int spi_eeprom_read(int chipid, int address, unsigned char *buf, int len);
35extern int spi_eeprom_write(int chipid, int address, unsigned char *buf, int len);
36extern void spi_eeprom_proc_create(struct proc_dir_entry *dir, int chipid) __init;
37
38#define TXX9_IMCLK (txx9_gbus_clock / 2)
39
40/*
41* SPI
42*/
43
44/* SPMCR : SPI Master Control */
45#define TXx9_SPMCR_OPMODE 0xc0
46#define TXx9_SPMCR_CONFIG 0x40
47#define TXx9_SPMCR_ACTIVE 0x80
48#define TXx9_SPMCR_SPSTP 0x02
49#define TXx9_SPMCR_BCLR 0x01
50
51/* SPCR0 : SPI Status */
52#define TXx9_SPCR0_TXIFL_MASK 0xc000
53#define TXx9_SPCR0_RXIFL_MASK 0x3000
54#define TXx9_SPCR0_SIDIE 0x0800
55#define TXx9_SPCR0_SOEIE 0x0400
56#define TXx9_SPCR0_RBSIE 0x0200
57#define TXx9_SPCR0_TBSIE 0x0100
58#define TXx9_SPCR0_IFSPSE 0x0010
59#define TXx9_SPCR0_SBOS 0x0004
60#define TXx9_SPCR0_SPHA 0x0002
61#define TXx9_SPCR0_SPOL 0x0001
62
63/* SPSR : SPI Status */
64#define TXx9_SPSR_TBSI 0x8000
65#define TXx9_SPSR_RBSI 0x4000
66#define TXx9_SPSR_TBS_MASK 0x3800
67#define TXx9_SPSR_RBS_MASK 0x0700
68#define TXx9_SPSR_SPOE 0x0080
69#define TXx9_SPSR_IFSD 0x0008
70#define TXx9_SPSR_SIDLE 0x0004
71#define TXx9_SPSR_STRDY 0x0002
72#define TXx9_SPSR_SRRDY 0x0001
73
74#endif /* __ASM_TX_BOARDS_TX4938_SPI_H */
diff --git a/include/asm-mips/tx4938/tx4938.h b/include/asm-mips/tx4938/tx4938.h
new file mode 100644
index 000000000000..e25b1a0975cb
--- /dev/null
+++ b/include/asm-mips/tx4938/tx4938.h
@@ -0,0 +1,706 @@
1/*
2 * linux/include/asm-mips/tx4938/tx4938.h
3 * Definitions for TX4937/TX4938
4 * Copyright (C) 2000-2001 Toshiba Corporation
5 *
6 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
7 * terms of the GNU General Public License version 2. This program is
8 * licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 *
11 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
12 */
13#ifndef __ASM_TX_BOARDS_TX4938_H
14#define __ASM_TX_BOARDS_TX4938_H
15
16#include <asm/tx4938/tx4938_mips.h>
17
18#define tx4938_read_nfmc(addr) (*(volatile unsigned int *)(addr))
19#define tx4938_write_nfmc(b,addr) (*(volatile unsigned int *)(addr)) = (b)
20
21#define TX4938_NR_IRQ_LOCAL TX4938_IRQ_PIC_BEG
22
23#define TX4938_IRQ_IRC_PCIC (TX4938_NR_IRQ_LOCAL + TX4938_IR_PCIC)
24#define TX4938_IRQ_IRC_PCIERR (TX4938_NR_IRQ_LOCAL + TX4938_IR_PCIERR)
25
26#define TX4938_PCIIO_0 0x10000000
27#define TX4938_PCIIO_1 0x01010000
28#define TX4938_PCIMEM_0 0x08000000
29#define TX4938_PCIMEM_1 0x11000000
30
31#define TX4938_PCIIO_SIZE_0 0x01000000
32#define TX4938_PCIIO_SIZE_1 0x00010000
33#define TX4938_PCIMEM_SIZE_0 0x08000000
34#define TX4938_PCIMEM_SIZE_1 0x00010000
35
36#define TX4938_REG_BASE 0xff1f0000 /* == TX4937_REG_BASE */
37#define TX4938_REG_SIZE 0x00010000 /* == TX4937_REG_SIZE */
38
39/* NDFMC, SRAMC, PCIC1, SPIC: TX4938 only */
40#define TX4938_NDFMC_REG (TX4938_REG_BASE + 0x5000)
41#define TX4938_SRAMC_REG (TX4938_REG_BASE + 0x6000)
42#define TX4938_PCIC1_REG (TX4938_REG_BASE + 0x7000)
43#define TX4938_SDRAMC_REG (TX4938_REG_BASE + 0x8000)
44#define TX4938_EBUSC_REG (TX4938_REG_BASE + 0x9000)
45#define TX4938_DMA_REG(ch) (TX4938_REG_BASE + 0xb000 + (ch) * 0x800)
46#define TX4938_PCIC_REG (TX4938_REG_BASE + 0xd000)
47#define TX4938_CCFG_REG (TX4938_REG_BASE + 0xe000)
48#define TX4938_NR_TMR 3
49#define TX4938_TMR_REG(ch) ((TX4938_REG_BASE + 0xf000) + (ch) * 0x100)
50#define TX4938_NR_SIO 2
51#define TX4938_SIO_REG(ch) ((TX4938_REG_BASE + 0xf300) + (ch) * 0x100)
52#define TX4938_PIO_REG (TX4938_REG_BASE + 0xf500)
53#define TX4938_IRC_REG (TX4938_REG_BASE + 0xf600)
54#define TX4938_ACLC_REG (TX4938_REG_BASE + 0xf700)
55#define TX4938_SPI_REG (TX4938_REG_BASE + 0xf800)
56
57#ifndef _LANGUAGE_ASSEMBLY
58#include <asm/byteorder.h>
59
60#define TX4938_MKA(x) ((u32)( ((u32)(TX4938_REG_BASE)) | ((u32)(x)) ))
61
62#define TX4938_RD08( reg ) (*(vu08*)(reg))
63#define TX4938_WR08( reg, val ) ((*(vu08*)(reg))=(val))
64
65#define TX4938_RD16( reg ) (*(vu16*)(reg))
66#define TX4938_WR16( reg, val ) ((*(vu16*)(reg))=(val))
67
68#define TX4938_RD32( reg ) (*(vu32*)(reg))
69#define TX4938_WR32( reg, val ) ((*(vu32*)(reg))=(val))
70
71#define TX4938_RD64( reg ) (*(vu64*)(reg))
72#define TX4938_WR64( reg, val ) ((*(vu64*)(reg))=(val))
73
74#define TX4938_RD( reg ) TX4938_RD32( reg )
75#define TX4938_WR( reg, val ) TX4938_WR32( reg, val )
76
77#endif /* !__ASSEMBLY__ */
78
79#ifdef __ASSEMBLY__
80#define _CONST64(c) c
81#else
82#define _CONST64(c) c##ull
83
84#include <asm/byteorder.h>
85
86#ifdef __BIG_ENDIAN
87#define endian_def_l2(e1,e2) \
88 volatile unsigned long e1,e2
89#define endian_def_s2(e1,e2) \
90 volatile unsigned short e1,e2
91#define endian_def_sb2(e1,e2,e3) \
92 volatile unsigned short e1;volatile unsigned char e2,e3
93#define endian_def_b2s(e1,e2,e3) \
94 volatile unsigned char e1,e2;volatile unsigned short e3
95#define endian_def_b4(e1,e2,e3,e4) \
96 volatile unsigned char e1,e2,e3,e4
97#else
98#define endian_def_l2(e1,e2) \
99 volatile unsigned long e2,e1
100#define endian_def_s2(e1,e2) \
101 volatile unsigned short e2,e1
102#define endian_def_sb2(e1,e2,e3) \
103 volatile unsigned char e3,e2;volatile unsigned short e1
104#define endian_def_b2s(e1,e2,e3) \
105 volatile unsigned short e3;volatile unsigned char e2,e1
106#define endian_def_b4(e1,e2,e3,e4) \
107 volatile unsigned char e4,e3,e2,e1
108#endif
109
110
111struct tx4938_sdramc_reg {
112 volatile unsigned long long cr[4];
113 volatile unsigned long long unused0[4];
114 volatile unsigned long long tr;
115 volatile unsigned long long unused1[2];
116 volatile unsigned long long cmd;
117 volatile unsigned long long sfcmd;
118};
119
120struct tx4938_ebusc_reg {
121 volatile unsigned long long cr[8];
122};
123
124struct tx4938_dma_reg {
125 struct tx4938_dma_ch_reg {
126 volatile unsigned long long cha;
127 volatile unsigned long long sar;
128 volatile unsigned long long dar;
129 endian_def_l2(unused0, cntr);
130 endian_def_l2(unused1, sair);
131 endian_def_l2(unused2, dair);
132 endian_def_l2(unused3, ccr);
133 endian_def_l2(unused4, csr);
134 } ch[4];
135 volatile unsigned long long dbr[8];
136 volatile unsigned long long tdhr;
137 volatile unsigned long long midr;
138 endian_def_l2(unused0, mcr);
139};
140
141struct tx4938_pcic_reg {
142 volatile unsigned long pciid;
143 volatile unsigned long pcistatus;
144 volatile unsigned long pciccrev;
145 volatile unsigned long pcicfg1;
146 volatile unsigned long p2gm0plbase; /* +10 */
147 volatile unsigned long p2gm0pubase;
148 volatile unsigned long p2gm1plbase;
149 volatile unsigned long p2gm1pubase;
150 volatile unsigned long p2gm2pbase; /* +20 */
151 volatile unsigned long p2giopbase;
152 volatile unsigned long unused0;
153 volatile unsigned long pcisid;
154 volatile unsigned long unused1; /* +30 */
155 volatile unsigned long pcicapptr;
156 volatile unsigned long unused2;
157 volatile unsigned long pcicfg2;
158 volatile unsigned long g2ptocnt; /* +40 */
159 volatile unsigned long unused3[15];
160 volatile unsigned long g2pstatus; /* +80 */
161 volatile unsigned long g2pmask;
162 volatile unsigned long pcisstatus;
163 volatile unsigned long pcimask;
164 volatile unsigned long p2gcfg; /* +90 */
165 volatile unsigned long p2gstatus;
166 volatile unsigned long p2gmask;
167 volatile unsigned long p2gccmd;
168 volatile unsigned long unused4[24]; /* +a0 */
169 volatile unsigned long pbareqport; /* +100 */
170 volatile unsigned long pbacfg;
171 volatile unsigned long pbastatus;
172 volatile unsigned long pbamask;
173 volatile unsigned long pbabm; /* +110 */
174 volatile unsigned long pbacreq;
175 volatile unsigned long pbacgnt;
176 volatile unsigned long pbacstate;
177 volatile unsigned long long g2pmgbase[3]; /* +120 */
178 volatile unsigned long long g2piogbase;
179 volatile unsigned long g2pmmask[3]; /* +140 */
180 volatile unsigned long g2piomask;
181 volatile unsigned long long g2pmpbase[3]; /* +150 */
182 volatile unsigned long long g2piopbase;
183 volatile unsigned long pciccfg; /* +170 */
184 volatile unsigned long pcicstatus;
185 volatile unsigned long pcicmask;
186 volatile unsigned long unused5;
187 volatile unsigned long long p2gmgbase[3]; /* +180 */
188 volatile unsigned long long p2giogbase;
189 volatile unsigned long g2pcfgadrs; /* +1a0 */
190 volatile unsigned long g2pcfgdata;
191 volatile unsigned long unused6[8];
192 volatile unsigned long g2pintack;
193 volatile unsigned long g2pspc;
194 volatile unsigned long unused7[12]; /* +1d0 */
195 volatile unsigned long long pdmca; /* +200 */
196 volatile unsigned long long pdmga;
197 volatile unsigned long long pdmpa;
198 volatile unsigned long long pdmctr;
199 volatile unsigned long long pdmcfg; /* +220 */
200 volatile unsigned long long pdmsts;
201};
202
203struct tx4938_aclc_reg {
204 volatile unsigned long acctlen;
205 volatile unsigned long acctldis;
206 volatile unsigned long acregacc;
207 volatile unsigned long unused0;
208 volatile unsigned long acintsts;
209 volatile unsigned long acintmsts;
210 volatile unsigned long acinten;
211 volatile unsigned long acintdis;
212 volatile unsigned long acsemaph;
213 volatile unsigned long unused1[7];
214 volatile unsigned long acgpidat;
215 volatile unsigned long acgpodat;
216 volatile unsigned long acslten;
217 volatile unsigned long acsltdis;
218 volatile unsigned long acfifosts;
219 volatile unsigned long unused2[11];
220 volatile unsigned long acdmasts;
221 volatile unsigned long acdmasel;
222 volatile unsigned long unused3[6];
223 volatile unsigned long acaudodat;
224 volatile unsigned long acsurrdat;
225 volatile unsigned long accentdat;
226 volatile unsigned long aclfedat;
227 volatile unsigned long acaudiat;
228 volatile unsigned long unused4;
229 volatile unsigned long acmodoat;
230 volatile unsigned long acmodidat;
231 volatile unsigned long unused5[15];
232 volatile unsigned long acrevid;
233};
234
235
236struct tx4938_tmr_reg {
237 volatile unsigned long tcr;
238 volatile unsigned long tisr;
239 volatile unsigned long cpra;
240 volatile unsigned long cprb;
241 volatile unsigned long itmr;
242 volatile unsigned long unused0[3];
243 volatile unsigned long ccdr;
244 volatile unsigned long unused1[3];
245 volatile unsigned long pgmr;
246 volatile unsigned long unused2[3];
247 volatile unsigned long wtmr;
248 volatile unsigned long unused3[43];
249 volatile unsigned long trr;
250};
251
252struct tx4938_sio_reg {
253 volatile unsigned long lcr;
254 volatile unsigned long dicr;
255 volatile unsigned long disr;
256 volatile unsigned long cisr;
257 volatile unsigned long fcr;
258 volatile unsigned long flcr;
259 volatile unsigned long bgr;
260 volatile unsigned long tfifo;
261 volatile unsigned long rfifo;
262};
263
264struct tx4938_pio_reg {
265 volatile unsigned long dout;
266 volatile unsigned long din;
267 volatile unsigned long dir;
268 volatile unsigned long od;
269 volatile unsigned long flag[2];
270 volatile unsigned long pol;
271 volatile unsigned long intc;
272 volatile unsigned long maskcpu;
273 volatile unsigned long maskext;
274};
275struct tx4938_irc_reg {
276 volatile unsigned long cer;
277 volatile unsigned long cr[2];
278 volatile unsigned long unused0;
279 volatile unsigned long ilr[8];
280 volatile unsigned long unused1[4];
281 volatile unsigned long imr;
282 volatile unsigned long unused2[7];
283 volatile unsigned long scr;
284 volatile unsigned long unused3[7];
285 volatile unsigned long ssr;
286 volatile unsigned long unused4[7];
287 volatile unsigned long csr;
288};
289
290struct tx4938_ndfmc_reg {
291 endian_def_l2(unused0, dtr);
292 endian_def_l2(unused1, mcr);
293 endian_def_l2(unused2, sr);
294 endian_def_l2(unused3, isr);
295 endian_def_l2(unused4, imr);
296 endian_def_l2(unused5, spr);
297 endian_def_l2(unused6, rstr);
298};
299
300struct tx4938_spi_reg {
301 volatile unsigned long mcr;
302 volatile unsigned long cr0;
303 volatile unsigned long cr1;
304 volatile unsigned long fs;
305 volatile unsigned long unused1;
306 volatile unsigned long sr;
307 volatile unsigned long dr;
308 volatile unsigned long unused2;
309};
310
311struct tx4938_sramc_reg {
312 volatile unsigned long long cr;
313};
314
315struct tx4938_ccfg_reg {
316 volatile unsigned long long ccfg;
317 volatile unsigned long long crir;
318 volatile unsigned long long pcfg;
319 volatile unsigned long long tear;
320 volatile unsigned long long clkctr;
321 volatile unsigned long long unused0;
322 volatile unsigned long long garbc;
323 volatile unsigned long long unused1;
324 volatile unsigned long long unused2;
325 volatile unsigned long long ramp;
326 volatile unsigned long long unused3;
327 volatile unsigned long long jmpadr;
328};
329
330#undef endian_def_l2
331#undef endian_def_s2
332#undef endian_def_sb2
333#undef endian_def_b2s
334#undef endian_def_b4
335
336#endif /* __ASSEMBLY__ */
337
338/*
339 * NDFMC
340 */
341
342/* NDFMCR : NDFMC Mode Control */
343#define TX4938_NDFMCR_WE 0x80
344#define TX4938_NDFMCR_ECC_ALL 0x60
345#define TX4938_NDFMCR_ECC_RESET 0x60
346#define TX4938_NDFMCR_ECC_READ 0x40
347#define TX4938_NDFMCR_ECC_ON 0x20
348#define TX4938_NDFMCR_ECC_OFF 0x00
349#define TX4938_NDFMCR_CE 0x10
350#define TX4938_NDFMCR_BSPRT 0x04
351#define TX4938_NDFMCR_ALE 0x02
352#define TX4938_NDFMCR_CLE 0x01
353
354/* NDFMCR : NDFMC Status */
355#define TX4938_NDFSR_BUSY 0x80
356
357/* NDFMCR : NDFMC Reset */
358#define TX4938_NDFRSTR_RST 0x01
359
360/*
361 * IRC
362 */
363
364#define TX4938_IR_ECCERR 0
365#define TX4938_IR_WTOERR 1
366#define TX4938_NUM_IR_INT 6
367#define TX4938_IR_INT(n) (2 + (n))
368#define TX4938_NUM_IR_SIO 2
369#define TX4938_IR_SIO(n) (8 + (n))
370#define TX4938_NUM_IR_DMA 4
371#define TX4938_IR_DMA(ch,n) ((ch ? 27 : 10) + (n)) /* 10-13,27-30 */
372#define TX4938_IR_PIO 14
373#define TX4938_IR_PDMAC 15
374#define TX4938_IR_PCIC 16
375#define TX4938_NUM_IR_TMR 3
376#define TX4938_IR_TMR(n) (17 + (n))
377#define TX4938_IR_NDFMC 21
378#define TX4938_IR_PCIERR 22
379#define TX4938_IR_PCIPME 23
380#define TX4938_IR_ACLC 24
381#define TX4938_IR_ACLCPME 25
382#define TX4938_IR_PCIC1 26
383#define TX4938_IR_SPI 31
384#define TX4938_NUM_IR 32
385/* multiplex */
386#define TX4938_IR_ETH0 TX4938_IR_INT(4)
387#define TX4938_IR_ETH1 TX4938_IR_INT(3)
388
389/*
390 * CCFG
391 */
392/* CCFG : Chip Configuration */
393#define TX4938_CCFG_WDRST _CONST64(0x0000020000000000)
394#define TX4938_CCFG_WDREXEN _CONST64(0x0000010000000000)
395#define TX4938_CCFG_BCFG_MASK _CONST64(0x000000ff00000000)
396#define TX4938_CCFG_TINTDIS 0x01000000
397#define TX4938_CCFG_PCI66 0x00800000
398#define TX4938_CCFG_PCIMODE 0x00400000
399#define TX4938_CCFG_PCI1_66 0x00200000
400#define TX4938_CCFG_DIVMODE_MASK 0x001e0000
401#define TX4938_CCFG_DIVMODE_2 (0x4 << 17)
402#define TX4938_CCFG_DIVMODE_2_5 (0xf << 17)
403#define TX4938_CCFG_DIVMODE_3 (0x5 << 17)
404#define TX4938_CCFG_DIVMODE_4 (0x6 << 17)
405#define TX4938_CCFG_DIVMODE_4_5 (0xd << 17)
406#define TX4938_CCFG_DIVMODE_8 (0x0 << 17)
407#define TX4938_CCFG_DIVMODE_10 (0xb << 17)
408#define TX4938_CCFG_DIVMODE_12 (0x1 << 17)
409#define TX4938_CCFG_DIVMODE_16 (0x2 << 17)
410#define TX4938_CCFG_DIVMODE_18 (0x9 << 17)
411#define TX4938_CCFG_BEOW 0x00010000
412#define TX4938_CCFG_WR 0x00008000
413#define TX4938_CCFG_TOE 0x00004000
414#define TX4938_CCFG_PCIXARB 0x00002000
415#define TX4938_CCFG_PCIDIVMODE_MASK 0x00001c00
416#define TX4938_CCFG_PCIDIVMODE_4 (0x1 << 10)
417#define TX4938_CCFG_PCIDIVMODE_4_5 (0x3 << 10)
418#define TX4938_CCFG_PCIDIVMODE_5 (0x5 << 10)
419#define TX4938_CCFG_PCIDIVMODE_5_5 (0x7 << 10)
420#define TX4938_CCFG_PCIDIVMODE_8 (0x0 << 10)
421#define TX4938_CCFG_PCIDIVMODE_9 (0x2 << 10)
422#define TX4938_CCFG_PCIDIVMODE_10 (0x4 << 10)
423#define TX4938_CCFG_PCIDIVMODE_11 (0x6 << 10)
424#define TX4938_CCFG_PCI1DMD 0x00000100
425#define TX4938_CCFG_SYSSP_MASK 0x000000c0
426#define TX4938_CCFG_ENDIAN 0x00000004
427#define TX4938_CCFG_HALT 0x00000002
428#define TX4938_CCFG_ACEHOLD 0x00000001
429
430/* PCFG : Pin Configuration */
431#define TX4938_PCFG_ETH0_SEL _CONST64(0x8000000000000000)
432#define TX4938_PCFG_ETH1_SEL _CONST64(0x4000000000000000)
433#define TX4938_PCFG_ATA_SEL _CONST64(0x2000000000000000)
434#define TX4938_PCFG_ISA_SEL _CONST64(0x1000000000000000)
435#define TX4938_PCFG_SPI_SEL _CONST64(0x0800000000000000)
436#define TX4938_PCFG_NDF_SEL _CONST64(0x0400000000000000)
437#define TX4938_PCFG_SDCLKDLY_MASK 0x30000000
438#define TX4938_PCFG_SDCLKDLY(d) ((d)<<28)
439#define TX4938_PCFG_SYSCLKEN 0x08000000
440#define TX4938_PCFG_SDCLKEN_ALL 0x07800000
441#define TX4938_PCFG_SDCLKEN(ch) (0x00800000<<(ch))
442#define TX4938_PCFG_PCICLKEN_ALL 0x003f0000
443#define TX4938_PCFG_PCICLKEN(ch) (0x00010000<<(ch))
444#define TX4938_PCFG_SEL2 0x00000200
445#define TX4938_PCFG_SEL1 0x00000100
446#define TX4938_PCFG_DMASEL_ALL 0x0000000f
447#define TX4938_PCFG_DMASEL0_DRQ0 0x00000000
448#define TX4938_PCFG_DMASEL0_SIO1 0x00000001
449#define TX4938_PCFG_DMASEL1_DRQ1 0x00000000
450#define TX4938_PCFG_DMASEL1_SIO1 0x00000002
451#define TX4938_PCFG_DMASEL2_DRQ2 0x00000000
452#define TX4938_PCFG_DMASEL2_SIO0 0x00000004
453#define TX4938_PCFG_DMASEL3_DRQ3 0x00000000
454#define TX4938_PCFG_DMASEL3_SIO0 0x00000008
455
456/* CLKCTR : Clock Control */
457#define TX4938_CLKCTR_NDFCKD _CONST64(0x0001000000000000)
458#define TX4938_CLKCTR_NDFRST _CONST64(0x0000000100000000)
459#define TX4938_CLKCTR_ETH1CKD 0x80000000
460#define TX4938_CLKCTR_ETH0CKD 0x40000000
461#define TX4938_CLKCTR_SPICKD 0x20000000
462#define TX4938_CLKCTR_SRAMCKD 0x10000000
463#define TX4938_CLKCTR_PCIC1CKD 0x08000000
464#define TX4938_CLKCTR_DMA1CKD 0x04000000
465#define TX4938_CLKCTR_ACLCKD 0x02000000
466#define TX4938_CLKCTR_PIOCKD 0x01000000
467#define TX4938_CLKCTR_DMACKD 0x00800000
468#define TX4938_CLKCTR_PCICKD 0x00400000
469#define TX4938_CLKCTR_TM0CKD 0x00100000
470#define TX4938_CLKCTR_TM1CKD 0x00080000
471#define TX4938_CLKCTR_TM2CKD 0x00040000
472#define TX4938_CLKCTR_SIO0CKD 0x00020000
473#define TX4938_CLKCTR_SIO1CKD 0x00010000
474#define TX4938_CLKCTR_ETH1RST 0x00008000
475#define TX4938_CLKCTR_ETH0RST 0x00004000
476#define TX4938_CLKCTR_SPIRST 0x00002000
477#define TX4938_CLKCTR_SRAMRST 0x00001000
478#define TX4938_CLKCTR_PCIC1RST 0x00000800
479#define TX4938_CLKCTR_DMA1RST 0x00000400
480#define TX4938_CLKCTR_ACLRST 0x00000200
481#define TX4938_CLKCTR_PIORST 0x00000100
482#define TX4938_CLKCTR_DMARST 0x00000080
483#define TX4938_CLKCTR_PCIRST 0x00000040
484#define TX4938_CLKCTR_TM0RST 0x00000010
485#define TX4938_CLKCTR_TM1RST 0x00000008
486#define TX4938_CLKCTR_TM2RST 0x00000004
487#define TX4938_CLKCTR_SIO0RST 0x00000002
488#define TX4938_CLKCTR_SIO1RST 0x00000001
489
490/* bits for G2PSTATUS/G2PMASK */
491#define TX4938_PCIC_G2PSTATUS_ALL 0x00000003
492#define TX4938_PCIC_G2PSTATUS_TTOE 0x00000002
493#define TX4938_PCIC_G2PSTATUS_RTOE 0x00000001
494
495/* bits for PCIMASK (see also PCI_STATUS_XXX in linux/pci.h */
496#define TX4938_PCIC_PCISTATUS_ALL 0x0000f900
497
498/* bits for PBACFG */
499#define TX4938_PCIC_PBACFG_FIXPA 0x00000008
500#define TX4938_PCIC_PBACFG_RPBA 0x00000004
501#define TX4938_PCIC_PBACFG_PBAEN 0x00000002
502#define TX4938_PCIC_PBACFG_BMCEN 0x00000001
503
504/* bits for G2PMnGBASE */
505#define TX4938_PCIC_G2PMnGBASE_BSDIS _CONST64(0x0000002000000000)
506#define TX4938_PCIC_G2PMnGBASE_ECHG _CONST64(0x0000001000000000)
507
508/* bits for G2PIOGBASE */
509#define TX4938_PCIC_G2PIOGBASE_BSDIS _CONST64(0x0000002000000000)
510#define TX4938_PCIC_G2PIOGBASE_ECHG _CONST64(0x0000001000000000)
511
512/* bits for PCICSTATUS/PCICMASK */
513#define TX4938_PCIC_PCICSTATUS_ALL 0x000007b8
514#define TX4938_PCIC_PCICSTATUS_PME 0x00000400
515#define TX4938_PCIC_PCICSTATUS_TLB 0x00000200
516#define TX4938_PCIC_PCICSTATUS_NIB 0x00000100
517#define TX4938_PCIC_PCICSTATUS_ZIB 0x00000080
518#define TX4938_PCIC_PCICSTATUS_PERR 0x00000020
519#define TX4938_PCIC_PCICSTATUS_SERR 0x00000010
520#define TX4938_PCIC_PCICSTATUS_GBE 0x00000008
521#define TX4938_PCIC_PCICSTATUS_IWB 0x00000002
522#define TX4938_PCIC_PCICSTATUS_E2PDONE 0x00000001
523
524/* bits for PCICCFG */
525#define TX4938_PCIC_PCICCFG_GBWC_MASK 0x0fff0000
526#define TX4938_PCIC_PCICCFG_HRST 0x00000800
527#define TX4938_PCIC_PCICCFG_SRST 0x00000400
528#define TX4938_PCIC_PCICCFG_IRBER 0x00000200
529#define TX4938_PCIC_PCICCFG_G2PMEN(ch) (0x00000100>>(ch))
530#define TX4938_PCIC_PCICCFG_G2PM0EN 0x00000100
531#define TX4938_PCIC_PCICCFG_G2PM1EN 0x00000080
532#define TX4938_PCIC_PCICCFG_G2PM2EN 0x00000040
533#define TX4938_PCIC_PCICCFG_G2PIOEN 0x00000020
534#define TX4938_PCIC_PCICCFG_TCAR 0x00000010
535#define TX4938_PCIC_PCICCFG_ICAEN 0x00000008
536
537/* bits for P2GMnGBASE */
538#define TX4938_PCIC_P2GMnGBASE_TMEMEN _CONST64(0x0000004000000000)
539#define TX4938_PCIC_P2GMnGBASE_TBSDIS _CONST64(0x0000002000000000)
540#define TX4938_PCIC_P2GMnGBASE_TECHG _CONST64(0x0000001000000000)
541
542/* bits for P2GIOGBASE */
543#define TX4938_PCIC_P2GIOGBASE_TIOEN _CONST64(0x0000004000000000)
544#define TX4938_PCIC_P2GIOGBASE_TBSDIS _CONST64(0x0000002000000000)
545#define TX4938_PCIC_P2GIOGBASE_TECHG _CONST64(0x0000001000000000)
546
547#define TX4938_PCIC_IDSEL_AD_TO_SLOT(ad) ((ad) - 11)
548#define TX4938_PCIC_MAX_DEVNU TX4938_PCIC_IDSEL_AD_TO_SLOT(32)
549
550/* bits for PDMCFG */
551#define TX4938_PCIC_PDMCFG_RSTFIFO 0x00200000
552#define TX4938_PCIC_PDMCFG_EXFER 0x00100000
553#define TX4938_PCIC_PDMCFG_REQDLY_MASK 0x00003800
554#define TX4938_PCIC_PDMCFG_REQDLY_NONE (0 << 11)
555#define TX4938_PCIC_PDMCFG_REQDLY_16 (1 << 11)
556#define TX4938_PCIC_PDMCFG_REQDLY_32 (2 << 11)
557#define TX4938_PCIC_PDMCFG_REQDLY_64 (3 << 11)
558#define TX4938_PCIC_PDMCFG_REQDLY_128 (4 << 11)
559#define TX4938_PCIC_PDMCFG_REQDLY_256 (5 << 11)
560#define TX4938_PCIC_PDMCFG_REQDLY_512 (6 << 11)
561#define TX4938_PCIC_PDMCFG_REQDLY_1024 (7 << 11)
562#define TX4938_PCIC_PDMCFG_ERRIE 0x00000400
563#define TX4938_PCIC_PDMCFG_NCCMPIE 0x00000200
564#define TX4938_PCIC_PDMCFG_NTCMPIE 0x00000100
565#define TX4938_PCIC_PDMCFG_CHNEN 0x00000080
566#define TX4938_PCIC_PDMCFG_XFRACT 0x00000040
567#define TX4938_PCIC_PDMCFG_BSWAP 0x00000020
568#define TX4938_PCIC_PDMCFG_XFRSIZE_MASK 0x0000000c
569#define TX4938_PCIC_PDMCFG_XFRSIZE_1DW 0x00000000
570#define TX4938_PCIC_PDMCFG_XFRSIZE_1QW 0x00000004
571#define TX4938_PCIC_PDMCFG_XFRSIZE_4QW 0x00000008
572#define TX4938_PCIC_PDMCFG_XFRDIRC 0x00000002
573#define TX4938_PCIC_PDMCFG_CHRST 0x00000001
574
575/* bits for PDMSTS */
576#define TX4938_PCIC_PDMSTS_REQCNT_MASK 0x3f000000
577#define TX4938_PCIC_PDMSTS_FIFOCNT_MASK 0x00f00000
578#define TX4938_PCIC_PDMSTS_FIFOWP_MASK 0x000c0000
579#define TX4938_PCIC_PDMSTS_FIFORP_MASK 0x00030000
580#define TX4938_PCIC_PDMSTS_ERRINT 0x00000800
581#define TX4938_PCIC_PDMSTS_DONEINT 0x00000400
582#define TX4938_PCIC_PDMSTS_CHNEN 0x00000200
583#define TX4938_PCIC_PDMSTS_XFRACT 0x00000100
584#define TX4938_PCIC_PDMSTS_ACCMP 0x00000080
585#define TX4938_PCIC_PDMSTS_NCCMP 0x00000040
586#define TX4938_PCIC_PDMSTS_NTCMP 0x00000020
587#define TX4938_PCIC_PDMSTS_CFGERR 0x00000008
588#define TX4938_PCIC_PDMSTS_PCIERR 0x00000004
589#define TX4938_PCIC_PDMSTS_CHNERR 0x00000002
590#define TX4938_PCIC_PDMSTS_DATAERR 0x00000001
591#define TX4938_PCIC_PDMSTS_ALL_CMP 0x000000e0
592#define TX4938_PCIC_PDMSTS_ALL_ERR 0x0000000f
593
594/*
595 * DMA
596 */
597/* bits for MCR */
598#define TX4938_DMA_MCR_EIS(ch) (0x10000000<<(ch))
599#define TX4938_DMA_MCR_DIS(ch) (0x01000000<<(ch))
600#define TX4938_DMA_MCR_RSFIF 0x00000080
601#define TX4938_DMA_MCR_FIFUM(ch) (0x00000008<<(ch))
602#define TX4938_DMA_MCR_RPRT 0x00000002
603#define TX4938_DMA_MCR_MSTEN 0x00000001
604
605/* bits for CCRn */
606#define TX4938_DMA_CCR_IMMCHN 0x20000000
607#define TX4938_DMA_CCR_USEXFSZ 0x10000000
608#define TX4938_DMA_CCR_LE 0x08000000
609#define TX4938_DMA_CCR_DBINH 0x04000000
610#define TX4938_DMA_CCR_SBINH 0x02000000
611#define TX4938_DMA_CCR_CHRST 0x01000000
612#define TX4938_DMA_CCR_RVBYTE 0x00800000
613#define TX4938_DMA_CCR_ACKPOL 0x00400000
614#define TX4938_DMA_CCR_REQPL 0x00200000
615#define TX4938_DMA_CCR_EGREQ 0x00100000
616#define TX4938_DMA_CCR_CHDN 0x00080000
617#define TX4938_DMA_CCR_DNCTL 0x00060000
618#define TX4938_DMA_CCR_EXTRQ 0x00010000
619#define TX4938_DMA_CCR_INTRQD 0x0000e000
620#define TX4938_DMA_CCR_INTENE 0x00001000
621#define TX4938_DMA_CCR_INTENC 0x00000800
622#define TX4938_DMA_CCR_INTENT 0x00000400
623#define TX4938_DMA_CCR_CHNEN 0x00000200
624#define TX4938_DMA_CCR_XFACT 0x00000100
625#define TX4938_DMA_CCR_SMPCHN 0x00000020
626#define TX4938_DMA_CCR_XFSZ(order) (((order) << 2) & 0x0000001c)
627#define TX4938_DMA_CCR_XFSZ_1W TX4938_DMA_CCR_XFSZ(2)
628#define TX4938_DMA_CCR_XFSZ_2W TX4938_DMA_CCR_XFSZ(3)
629#define TX4938_DMA_CCR_XFSZ_4W TX4938_DMA_CCR_XFSZ(4)
630#define TX4938_DMA_CCR_XFSZ_8W TX4938_DMA_CCR_XFSZ(5)
631#define TX4938_DMA_CCR_XFSZ_16W TX4938_DMA_CCR_XFSZ(6)
632#define TX4938_DMA_CCR_XFSZ_32W TX4938_DMA_CCR_XFSZ(7)
633#define TX4938_DMA_CCR_MEMIO 0x00000002
634#define TX4938_DMA_CCR_SNGAD 0x00000001
635
636/* bits for CSRn */
637#define TX4938_DMA_CSR_CHNEN 0x00000400
638#define TX4938_DMA_CSR_STLXFER 0x00000200
639#define TX4938_DMA_CSR_CHNACT 0x00000100
640#define TX4938_DMA_CSR_ABCHC 0x00000080
641#define TX4938_DMA_CSR_NCHNC 0x00000040
642#define TX4938_DMA_CSR_NTRNFC 0x00000020
643#define TX4938_DMA_CSR_EXTDN 0x00000010
644#define TX4938_DMA_CSR_CFERR 0x00000008
645#define TX4938_DMA_CSR_CHERR 0x00000004
646#define TX4938_DMA_CSR_DESERR 0x00000002
647#define TX4938_DMA_CSR_SORERR 0x00000001
648
649/* TX4938 Interrupt Controller (32-bit registers) */
650#define TX4938_IRC_BASE 0xf510
651#define TX4938_IRC_IRFLAG0 0xf510
652#define TX4938_IRC_IRFLAG1 0xf514
653#define TX4938_IRC_IRPOL 0xf518
654#define TX4938_IRC_IRRCNT 0xf51c
655#define TX4938_IRC_IRMASKINT 0xf520
656#define TX4938_IRC_IRMASKEXT 0xf524
657#define TX4938_IRC_IRDEN 0xf600
658#define TX4938_IRC_IRDM0 0xf604
659#define TX4938_IRC_IRDM1 0xf608
660#define TX4938_IRC_IRLVL0 0xf610
661#define TX4938_IRC_IRLVL1 0xf614
662#define TX4938_IRC_IRLVL2 0xf618
663#define TX4938_IRC_IRLVL3 0xf61c
664#define TX4938_IRC_IRLVL4 0xf620
665#define TX4938_IRC_IRLVL5 0xf624
666#define TX4938_IRC_IRLVL6 0xf628
667#define TX4938_IRC_IRLVL7 0xf62c
668#define TX4938_IRC_IRMSK 0xf640
669#define TX4938_IRC_IREDC 0xf660
670#define TX4938_IRC_IRPND 0xf680
671#define TX4938_IRC_IRCS 0xf6a0
672#define TX4938_IRC_LIMIT 0xf6ff
673
674
675#ifndef __ASSEMBLY__
676
677#define tx4938_sdramcptr ((struct tx4938_sdramc_reg *)TX4938_SDRAMC_REG)
678#define tx4938_ebuscptr ((struct tx4938_ebusc_reg *)TX4938_EBUSC_REG)
679#define tx4938_dmaptr(ch) ((struct tx4938_dma_reg *)TX4938_DMA_REG(ch))
680#define tx4938_ndfmcptr ((struct tx4938_ndfmc_reg *)TX4938_NDFMC_REG)
681#define tx4938_ircptr ((struct tx4938_irc_reg *)TX4938_IRC_REG)
682#define tx4938_pcicptr ((struct tx4938_pcic_reg *)TX4938_PCIC_REG)
683#define tx4938_pcic1ptr ((struct tx4938_pcic_reg *)TX4938_PCIC1_REG)
684#define tx4938_ccfgptr ((struct tx4938_ccfg_reg *)TX4938_CCFG_REG)
685#define tx4938_tmrptr(ch) ((struct tx4938_tmr_reg *)TX4938_TMR_REG(ch))
686#define tx4938_sioptr(ch) ((struct tx4938_sio_reg *)TX4938_SIO_REG(ch))
687#define tx4938_pioptr ((struct tx4938_pio_reg *)TX4938_PIO_REG)
688#define tx4938_aclcptr ((struct tx4938_aclc_reg *)TX4938_ACLC_REG)
689#define tx4938_spiptr ((struct tx4938_spi_reg *)TX4938_SPI_REG)
690#define tx4938_sramcptr ((struct tx4938_sramc_reg *)TX4938_SRAMC_REG)
691
692
693#define TX4938_REV_MAJ_MIN() ((unsigned long)tx4938_ccfgptr->crir & 0x00ff)
694#define TX4938_REV_PCODE() ((unsigned long)tx4938_ccfgptr->crir >> 16)
695
696#define TX4938_SDRAMC_BA(ch) ((tx4938_sdramcptr->cr[ch] >> 49) << 21)
697#define TX4938_SDRAMC_SIZE(ch) (((tx4938_sdramcptr->cr[ch] >> 33) + 1) << 21)
698
699#define TX4938_EBUSC_BA(ch) ((tx4938_ebuscptr->cr[ch] >> 48) << 20)
700#define TX4938_EBUSC_SIZE(ch) \
701 (0x00100000 << ((unsigned long)(tx4938_ebuscptr->cr[ch] >> 8) & 0xf))
702
703
704#endif /* !__ASSEMBLY__ */
705
706#endif
diff --git a/include/asm-mips/tx4938/tx4938_mips.h b/include/asm-mips/tx4938/tx4938_mips.h
new file mode 100644
index 000000000000..cf89b205f103
--- /dev/null
+++ b/include/asm-mips/tx4938/tx4938_mips.h
@@ -0,0 +1,54 @@
1/*
2 * linux/include/asm-mips/tx4938/tx4938_bitmask.h
3 * Generic bitmask definitions
4 *
5 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
6 * terms of the GNU General Public License version 2. This program is
7 * licensed "as is" without any warranty of any kind, whether express
8 * or implied.
9 *
10 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
11 */
12
13#ifndef TX4938_TX4938_MIPS_H
14#define TX4938_TX4938_MIPS_H
15#ifndef __ASSEMBLY__
16
17#define reg_rd08(r) ((u8 )(*((vu8 *)(r))))
18#define reg_rd16(r) ((u16)(*((vu16*)(r))))
19#define reg_rd32(r) ((u32)(*((vu32*)(r))))
20#define reg_rd64(r) ((u64)(*((vu64*)(r))))
21
22#define reg_wr08(r,v) ((*((vu8 *)(r)))=((u8 )(v)))
23#define reg_wr16(r,v) ((*((vu16*)(r)))=((u16)(v)))
24#define reg_wr32(r,v) ((*((vu32*)(r)))=((u32)(v)))
25#define reg_wr64(r,v) ((*((vu64*)(r)))=((u64)(v)))
26
27typedef volatile __signed char vs8;
28typedef volatile unsigned char vu8;
29
30typedef volatile __signed short vs16;
31typedef volatile unsigned short vu16;
32
33typedef volatile __signed int vs32;
34typedef volatile unsigned int vu32;
35
36typedef s8 s08;
37typedef vs8 vs08;
38
39typedef u8 u08;
40typedef vu8 vu08;
41
42#if (_MIPS_SZLONG == 64)
43
44typedef volatile __signed__ long vs64;
45typedef volatile unsigned long vu64;
46
47#else
48
49typedef volatile __signed__ long long vs64;
50typedef volatile unsigned long long vu64;
51
52#endif
53#endif
54#endif
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index 5c2c98329012..41bb96bb2120 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -196,63 +196,55 @@
196 __get_user_nocheck((x),(ptr),sizeof(*(ptr))) 196 __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
197 197
198struct __large_struct { unsigned long buf[100]; }; 198struct __large_struct { unsigned long buf[100]; };
199#define __m(x) (*(struct __large_struct *)(x)) 199#define __m(x) (*(struct __large_struct __user *)(x))
200 200
201/* 201/*
202 * Yuck. We need two variants, one for 64bit operation and one 202 * Yuck. We need two variants, one for 64bit operation and one
203 * for 32 bit mode and old iron. 203 * for 32 bit mode and old iron.
204 */ 204 */
205#ifdef __mips64 205#ifdef __mips64
206#define __GET_USER_DW(__gu_err) __get_user_asm("ld", __gu_err) 206#define __GET_USER_DW(ptr) __get_user_asm("ld", ptr)
207#else 207#else
208#define __GET_USER_DW(__gu_err) __get_user_asm_ll32(__gu_err) 208#define __GET_USER_DW(ptr) __get_user_asm_ll32(ptr)
209#endif 209#endif
210 210
211#define __get_user_nocheck(x,ptr,size) \ 211#define __get_user_nocheck(x,ptr,size) \
212({ \ 212({ \
213 __typeof(*(ptr)) __gu_val = 0; \ 213 __typeof(*(ptr)) __gu_val = (__typeof(*(ptr))) 0; \
214 long __gu_addr; \
215 long __gu_err = 0; \ 214 long __gu_err = 0; \
216 \ 215 \
217 might_sleep(); \
218 __gu_addr = (long) (ptr); \
219 switch (size) { \ 216 switch (size) { \
220 case 1: __get_user_asm("lb", __gu_err); break; \ 217 case 1: __get_user_asm("lb", ptr); break; \
221 case 2: __get_user_asm("lh", __gu_err); break; \ 218 case 2: __get_user_asm("lh", ptr); break; \
222 case 4: __get_user_asm("lw", __gu_err); break; \ 219 case 4: __get_user_asm("lw", ptr); break; \
223 case 8: __GET_USER_DW(__gu_err); break; \ 220 case 8: __GET_USER_DW(ptr); break; \
224 default: __get_user_unknown(); break; \ 221 default: __get_user_unknown(); break; \
225 } \ 222 } \
226 x = (__typeof__(*(ptr))) __gu_val; \ 223 (x) = (__typeof__(*(ptr))) __gu_val; \
227 __gu_err; \ 224 __gu_err; \
228}) 225})
229 226
230#define __get_user_check(x,ptr,size) \ 227#define __get_user_check(x,ptr,size) \
231({ \ 228({ \
229 const __typeof__(*(ptr)) __user * __gu_addr = (ptr); \
232 __typeof__(*(ptr)) __gu_val = 0; \ 230 __typeof__(*(ptr)) __gu_val = 0; \
233 long __gu_addr; \ 231 long __gu_err = -EFAULT; \
234 long __gu_err; \
235 \
236 might_sleep(); \
237 __gu_addr = (long) (ptr); \
238 __gu_err = access_ok(VERIFY_READ, (void *) __gu_addr, size) \
239 ? 0 : -EFAULT; \
240 \ 232 \
241 if (likely(!__gu_err)) { \ 233 if (likely(access_ok(VERIFY_READ, __gu_addr, size))) { \
242 switch (size) { \ 234 switch (size) { \
243 case 1: __get_user_asm("lb", __gu_err); break; \ 235 case 1: __get_user_asm("lb", __gu_addr); break; \
244 case 2: __get_user_asm("lh", __gu_err); break; \ 236 case 2: __get_user_asm("lh", __gu_addr); break; \
245 case 4: __get_user_asm("lw", __gu_err); break; \ 237 case 4: __get_user_asm("lw", __gu_addr); break; \
246 case 8: __GET_USER_DW(__gu_err); break; \ 238 case 8: __GET_USER_DW(__gu_addr); break; \
247 default: __get_user_unknown(); break; \ 239 default: __get_user_unknown(); break; \
248 } \ 240 } \
249 } \ 241 } \
250 x = (__typeof__(*(ptr))) __gu_val; \ 242 (x) = (__typeof__(*(ptr))) __gu_val; \
251 __gu_err; \ 243 __gu_err; \
252}) 244})
253 245
254#define __get_user_asm(insn,__gu_err) \ 246#define __get_user_asm(insn, addr) \
255({ \ 247{ \
256 __asm__ __volatile__( \ 248 __asm__ __volatile__( \
257 "1: " insn " %1, %3 \n" \ 249 "1: " insn " %1, %3 \n" \
258 "2: \n" \ 250 "2: \n" \
@@ -264,20 +256,20 @@ struct __large_struct { unsigned long buf[100]; };
264 " "__UA_ADDR "\t1b, 3b \n" \ 256 " "__UA_ADDR "\t1b, 3b \n" \
265 " .previous \n" \ 257 " .previous \n" \
266 : "=r" (__gu_err), "=r" (__gu_val) \ 258 : "=r" (__gu_err), "=r" (__gu_val) \
267 : "0" (__gu_err), "o" (__m(__gu_addr)), "i" (-EFAULT)); \ 259 : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \
268}) 260}
269 261
270/* 262/*
271 * Get a long long 64 using 32 bit registers. 263 * Get a long long 64 using 32 bit registers.
272 */ 264 */
273#define __get_user_asm_ll32(__gu_err) \ 265#define __get_user_asm_ll32(addr) \
274({ \ 266{ \
275 __asm__ __volatile__( \ 267 __asm__ __volatile__( \
276 "1: lw %1, %3 \n" \ 268 "1: lw %1, (%3) \n" \
277 "2: lw %D1, %4 \n" \ 269 "2: lw %D1, 4(%3) \n" \
278 " move %0, $0 \n" \ 270 " move %0, $0 \n" \
279 "3: .section .fixup,\"ax\" \n" \ 271 "3: .section .fixup,\"ax\" \n" \
280 "4: li %0, %5 \n" \ 272 "4: li %0, %4 \n" \
281 " move %1, $0 \n" \ 273 " move %1, $0 \n" \
282 " move %D1, $0 \n" \ 274 " move %D1, $0 \n" \
283 " j 3b \n" \ 275 " j 3b \n" \
@@ -287,9 +279,8 @@ struct __large_struct { unsigned long buf[100]; };
287 " " __UA_ADDR " 2b, 4b \n" \ 279 " " __UA_ADDR " 2b, 4b \n" \
288 " .previous \n" \ 280 " .previous \n" \
289 : "=r" (__gu_err), "=&r" (__gu_val) \ 281 : "=r" (__gu_err), "=&r" (__gu_val) \
290 : "0" (__gu_err), "o" (__m(__gu_addr)), \ 282 : "0" (0), "r" (addr), "i" (-EFAULT)); \
291 "o" (__m(__gu_addr + 4)), "i" (-EFAULT)); \ 283}
292})
293 284
294extern void __get_user_unknown(void); 285extern void __get_user_unknown(void);
295 286
@@ -298,25 +289,22 @@ extern void __get_user_unknown(void);
298 * for 32 bit mode and old iron. 289 * for 32 bit mode and old iron.
299 */ 290 */
300#ifdef __mips64 291#ifdef __mips64
301#define __PUT_USER_DW(__pu_val) __put_user_asm("sd", __pu_val) 292#define __PUT_USER_DW(ptr) __put_user_asm("sd", ptr)
302#else 293#else
303#define __PUT_USER_DW(__pu_val) __put_user_asm_ll32(__pu_val) 294#define __PUT_USER_DW(ptr) __put_user_asm_ll32(ptr)
304#endif 295#endif
305 296
306#define __put_user_nocheck(x,ptr,size) \ 297#define __put_user_nocheck(x,ptr,size) \
307({ \ 298({ \
308 __typeof__(*(ptr)) __pu_val; \ 299 __typeof__(*(ptr)) __pu_val; \
309 long __pu_addr; \
310 long __pu_err = 0; \ 300 long __pu_err = 0; \
311 \ 301 \
312 might_sleep(); \
313 __pu_val = (x); \ 302 __pu_val = (x); \
314 __pu_addr = (long) (ptr); \
315 switch (size) { \ 303 switch (size) { \
316 case 1: __put_user_asm("sb", __pu_val); break; \ 304 case 1: __put_user_asm("sb", ptr); break; \
317 case 2: __put_user_asm("sh", __pu_val); break; \ 305 case 2: __put_user_asm("sh", ptr); break; \
318 case 4: __put_user_asm("sw", __pu_val); break; \ 306 case 4: __put_user_asm("sw", ptr); break; \
319 case 8: __PUT_USER_DW(__pu_val); break; \ 307 case 8: __PUT_USER_DW(ptr); break; \
320 default: __put_user_unknown(); break; \ 308 default: __put_user_unknown(); break; \
321 } \ 309 } \
322 __pu_err; \ 310 __pu_err; \
@@ -324,30 +312,24 @@ extern void __get_user_unknown(void);
324 312
325#define __put_user_check(x,ptr,size) \ 313#define __put_user_check(x,ptr,size) \
326({ \ 314({ \
327 __typeof__(*(ptr)) __pu_val; \ 315 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
328 long __pu_addr; \ 316 __typeof__(*(ptr)) __pu_val = (x); \
329 long __pu_err; \ 317 long __pu_err = -EFAULT; \
330 \ 318 \
331 might_sleep(); \ 319 if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { \
332 __pu_val = (x); \
333 __pu_addr = (long) (ptr); \
334 __pu_err = access_ok(VERIFY_WRITE, (void *) __pu_addr, size) \
335 ? 0 : -EFAULT; \
336 \
337 if (likely(!__pu_err)) { \
338 switch (size) { \ 320 switch (size) { \
339 case 1: __put_user_asm("sb", __pu_val); break; \ 321 case 1: __put_user_asm("sb", __pu_addr); break; \
340 case 2: __put_user_asm("sh", __pu_val); break; \ 322 case 2: __put_user_asm("sh", __pu_addr); break; \
341 case 4: __put_user_asm("sw", __pu_val); break; \ 323 case 4: __put_user_asm("sw", __pu_addr); break; \
342 case 8: __PUT_USER_DW(__pu_val); break; \ 324 case 8: __PUT_USER_DW(__pu_addr); break; \
343 default: __put_user_unknown(); break; \ 325 default: __put_user_unknown(); break; \
344 } \ 326 } \
345 } \ 327 } \
346 __pu_err; \ 328 __pu_err; \
347}) 329})
348 330
349#define __put_user_asm(insn, __pu_val) \ 331#define __put_user_asm(insn, ptr) \
350({ \ 332{ \
351 __asm__ __volatile__( \ 333 __asm__ __volatile__( \
352 "1: " insn " %z2, %3 # __put_user_asm\n" \ 334 "1: " insn " %z2, %3 # __put_user_asm\n" \
353 "2: \n" \ 335 "2: \n" \
@@ -359,18 +341,18 @@ extern void __get_user_unknown(void);
359 " " __UA_ADDR " 1b, 3b \n" \ 341 " " __UA_ADDR " 1b, 3b \n" \
360 " .previous \n" \ 342 " .previous \n" \
361 : "=r" (__pu_err) \ 343 : "=r" (__pu_err) \
362 : "0" (__pu_err), "Jr" (__pu_val), "o" (__m(__pu_addr)), \ 344 : "0" (0), "Jr" (__pu_val), "o" (__m(ptr)), \
363 "i" (-EFAULT)); \ 345 "i" (-EFAULT)); \
364}) 346}
365 347
366#define __put_user_asm_ll32(__pu_val) \ 348#define __put_user_asm_ll32(ptr) \
367({ \ 349{ \
368 __asm__ __volatile__( \ 350 __asm__ __volatile__( \
369 "1: sw %2, %3 # __put_user_asm_ll32 \n" \ 351 "1: sw %2, (%3) # __put_user_asm_ll32 \n" \
370 "2: sw %D2, %4 \n" \ 352 "2: sw %D2, 4(%3) \n" \
371 "3: \n" \ 353 "3: \n" \
372 " .section .fixup,\"ax\" \n" \ 354 " .section .fixup,\"ax\" \n" \
373 "4: li %0, %5 \n" \ 355 "4: li %0, %4 \n" \
374 " j 3b \n" \ 356 " j 3b \n" \
375 " .previous \n" \ 357 " .previous \n" \
376 " .section __ex_table,\"a\" \n" \ 358 " .section __ex_table,\"a\" \n" \
@@ -378,9 +360,9 @@ extern void __get_user_unknown(void);
378 " " __UA_ADDR " 2b, 4b \n" \ 360 " " __UA_ADDR " 2b, 4b \n" \
379 " .previous" \ 361 " .previous" \
380 : "=r" (__pu_err) \ 362 : "=r" (__pu_err) \
381 : "0" (__pu_err), "r" (__pu_val), "o" (__m(__pu_addr)), \ 363 : "0" (0), "r" (__pu_val), "r" (ptr), \
382 "o" (__m(__pu_addr + 4)), "i" (-EFAULT)); \ 364 "i" (-EFAULT)); \
383}) 365}
384 366
385extern void __put_user_unknown(void); 367extern void __put_user_unknown(void);
386 368
@@ -403,7 +385,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
403 385
404#define __invoke_copy_to_user(to,from,n) \ 386#define __invoke_copy_to_user(to,from,n) \
405({ \ 387({ \
406 register void *__cu_to_r __asm__ ("$4"); \ 388 register void __user *__cu_to_r __asm__ ("$4"); \
407 register const void *__cu_from_r __asm__ ("$5"); \ 389 register const void *__cu_from_r __asm__ ("$5"); \
408 register long __cu_len_r __asm__ ("$6"); \ 390 register long __cu_len_r __asm__ ("$6"); \
409 \ 391 \
@@ -435,7 +417,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
435 */ 417 */
436#define __copy_to_user(to,from,n) \ 418#define __copy_to_user(to,from,n) \
437({ \ 419({ \
438 void *__cu_to; \ 420 void __user *__cu_to; \
439 const void *__cu_from; \ 421 const void *__cu_from; \
440 long __cu_len; \ 422 long __cu_len; \
441 \ 423 \
@@ -465,7 +447,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
465 */ 447 */
466#define copy_to_user(to,from,n) \ 448#define copy_to_user(to,from,n) \
467({ \ 449({ \
468 void *__cu_to; \ 450 void __user *__cu_to; \
469 const void *__cu_from; \ 451 const void *__cu_from; \
470 long __cu_len; \ 452 long __cu_len; \
471 \ 453 \
@@ -482,7 +464,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
482#define __invoke_copy_from_user(to,from,n) \ 464#define __invoke_copy_from_user(to,from,n) \
483({ \ 465({ \
484 register void *__cu_to_r __asm__ ("$4"); \ 466 register void *__cu_to_r __asm__ ("$4"); \
485 register const void *__cu_from_r __asm__ ("$5"); \ 467 register const void __user *__cu_from_r __asm__ ("$5"); \
486 register long __cu_len_r __asm__ ("$6"); \ 468 register long __cu_len_r __asm__ ("$6"); \
487 \ 469 \
488 __cu_to_r = (to); \ 470 __cu_to_r = (to); \
@@ -521,7 +503,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
521#define __copy_from_user(to,from,n) \ 503#define __copy_from_user(to,from,n) \
522({ \ 504({ \
523 void *__cu_to; \ 505 void *__cu_to; \
524 const void *__cu_from; \ 506 const void __user *__cu_from; \
525 long __cu_len; \ 507 long __cu_len; \
526 \ 508 \
527 might_sleep(); \ 509 might_sleep(); \
@@ -552,7 +534,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
552#define copy_from_user(to,from,n) \ 534#define copy_from_user(to,from,n) \
553({ \ 535({ \
554 void *__cu_to; \ 536 void *__cu_to; \
555 const void *__cu_from; \ 537 const void __user *__cu_from; \
556 long __cu_len; \ 538 long __cu_len; \
557 \ 539 \
558 might_sleep(); \ 540 might_sleep(); \
@@ -569,8 +551,8 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
569 551
570#define copy_in_user(to,from,n) \ 552#define copy_in_user(to,from,n) \
571({ \ 553({ \
572 void *__cu_to; \ 554 void __user *__cu_to; \
573 const void *__cu_from; \ 555 const void __user *__cu_from; \
574 long __cu_len; \ 556 long __cu_len; \
575 \ 557 \
576 might_sleep(); \ 558 might_sleep(); \
@@ -596,7 +578,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
596 * On success, this will be zero. 578 * On success, this will be zero.
597 */ 579 */
598static inline __kernel_size_t 580static inline __kernel_size_t
599__clear_user(void *addr, __kernel_size_t size) 581__clear_user(void __user *addr, __kernel_size_t size)
600{ 582{
601 __kernel_size_t res; 583 __kernel_size_t res;
602 584
@@ -616,7 +598,7 @@ __clear_user(void *addr, __kernel_size_t size)
616 598
617#define clear_user(addr,n) \ 599#define clear_user(addr,n) \
618({ \ 600({ \
619 void * __cl_addr = (addr); \ 601 void __user * __cl_addr = (addr); \
620 unsigned long __cl_size = (n); \ 602 unsigned long __cl_size = (n); \
621 if (__cl_size && access_ok(VERIFY_WRITE, \ 603 if (__cl_size && access_ok(VERIFY_WRITE, \
622 ((unsigned long)(__cl_addr)), __cl_size)) \ 604 ((unsigned long)(__cl_addr)), __cl_size)) \
@@ -645,7 +627,7 @@ __clear_user(void *addr, __kernel_size_t size)
645 * and returns @count. 627 * and returns @count.
646 */ 628 */
647static inline long 629static inline long
648__strncpy_from_user(char *__to, const char *__from, long __len) 630__strncpy_from_user(char *__to, const char __user *__from, long __len)
649{ 631{
650 long res; 632 long res;
651 633
@@ -682,7 +664,7 @@ __strncpy_from_user(char *__to, const char *__from, long __len)
682 * and returns @count. 664 * and returns @count.
683 */ 665 */
684static inline long 666static inline long
685strncpy_from_user(char *__to, const char *__from, long __len) 667strncpy_from_user(char *__to, const char __user *__from, long __len)
686{ 668{
687 long res; 669 long res;
688 670
@@ -701,7 +683,7 @@ strncpy_from_user(char *__to, const char *__from, long __len)
701} 683}
702 684
703/* Returns: 0 if bad, string length+1 (memory size) of string if ok */ 685/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
704static inline long __strlen_user(const char *s) 686static inline long __strlen_user(const char __user *s)
705{ 687{
706 long res; 688 long res;
707 689
@@ -731,7 +713,7 @@ static inline long __strlen_user(const char *s)
731 * If there is a limit on the length of a valid string, you may wish to 713 * If there is a limit on the length of a valid string, you may wish to
732 * consider using strnlen_user() instead. 714 * consider using strnlen_user() instead.
733 */ 715 */
734static inline long strlen_user(const char *s) 716static inline long strlen_user(const char __user *s)
735{ 717{
736 long res; 718 long res;
737 719
@@ -748,7 +730,7 @@ static inline long strlen_user(const char *s)
748} 730}
749 731
750/* Returns: 0 if bad, string length+1 (memory size) of string if ok */ 732/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
751static inline long __strnlen_user(const char *s, long n) 733static inline long __strnlen_user(const char __user *s, long n)
752{ 734{
753 long res; 735 long res;
754 736
@@ -779,7 +761,7 @@ static inline long __strnlen_user(const char *s, long n)
779 * If there is a limit on the length of a valid string, you may wish to 761 * If there is a limit on the length of a valid string, you may wish to
780 * consider using strnlen_user() instead. 762 * consider using strnlen_user() instead.
781 */ 763 */
782static inline long strnlen_user(const char *s, long n) 764static inline long strnlen_user(const char __user *s, long n)
783{ 765{
784 long res; 766 long res;
785 767
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index ad4d48056307..89ea8b60e945 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -303,16 +303,21 @@
303#define __NR_add_key (__NR_Linux + 280) 303#define __NR_add_key (__NR_Linux + 280)
304#define __NR_request_key (__NR_Linux + 281) 304#define __NR_request_key (__NR_Linux + 281)
305#define __NR_keyctl (__NR_Linux + 282) 305#define __NR_keyctl (__NR_Linux + 282)
306#define __NR_set_thread_area (__NR_Linux + 283)
307#define __NR_inotify_init (__NR_Linux + 284)
308#define __NR_inotify_add_watch (__NR_Linux + 285)
309#define __NR_inotify_rm_watch (__NR_Linux + 286)
310
306 311
307/* 312/*
308 * Offset of the last Linux o32 flavoured syscall 313 * Offset of the last Linux o32 flavoured syscall
309 */ 314 */
310#define __NR_Linux_syscalls 282 315#define __NR_Linux_syscalls 286
311 316
312#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 317#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
313 318
314#define __NR_O32_Linux 4000 319#define __NR_O32_Linux 4000
315#define __NR_O32_Linux_syscalls 282 320#define __NR_O32_Linux_syscalls 283
316 321
317#if _MIPS_SIM == _MIPS_SIM_ABI64 322#if _MIPS_SIM == _MIPS_SIM_ABI64
318 323
@@ -562,16 +567,20 @@
562#define __NR_add_key (__NR_Linux + 239) 567#define __NR_add_key (__NR_Linux + 239)
563#define __NR_request_key (__NR_Linux + 240) 568#define __NR_request_key (__NR_Linux + 240)
564#define __NR_keyctl (__NR_Linux + 241) 569#define __NR_keyctl (__NR_Linux + 241)
570#define __NR_set_thread_area (__NR_Linux + 242)
571#define __NR_inotify_init (__NR_Linux + 243)
572#define __NR_inotify_add_watch (__NR_Linux + 244)
573#define __NR_inotify_rm_watch (__NR_Linux + 245)
565 574
566/* 575/*
567 * Offset of the last Linux 64-bit flavoured syscall 576 * Offset of the last Linux 64-bit flavoured syscall
568 */ 577 */
569#define __NR_Linux_syscalls 241 578#define __NR_Linux_syscalls 245
570 579
571#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 580#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
572 581
573#define __NR_64_Linux 5000 582#define __NR_64_Linux 5000
574#define __NR_64_Linux_syscalls 241 583#define __NR_64_Linux_syscalls 242
575 584
576#if _MIPS_SIM == _MIPS_SIM_NABI32 585#if _MIPS_SIM == _MIPS_SIM_NABI32
577 586
@@ -825,16 +834,20 @@
825#define __NR_add_key (__NR_Linux + 243) 834#define __NR_add_key (__NR_Linux + 243)
826#define __NR_request_key (__NR_Linux + 244) 835#define __NR_request_key (__NR_Linux + 244)
827#define __NR_keyctl (__NR_Linux + 245) 836#define __NR_keyctl (__NR_Linux + 245)
837#define __NR_set_thread_area (__NR_Linux + 246)
838#define __NR_inotify_init (__NR_Linux + 247)
839#define __NR_inotify_add_watch (__NR_Linux + 248)
840#define __NR_inotify_rm_watch (__NR_Linux + 249)
828 841
829/* 842/*
830 * Offset of the last N32 flavoured syscall 843 * Offset of the last N32 flavoured syscall
831 */ 844 */
832#define __NR_Linux_syscalls 245 845#define __NR_Linux_syscalls 249
833 846
834#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 847#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
835 848
836#define __NR_N32_Linux 6000 849#define __NR_N32_Linux 6000
837#define __NR_N32_Linux_syscalls 245 850#define __NR_N32_Linux_syscalls 246
838 851
839#ifndef __ASSEMBLY__ 852#ifndef __ASSEMBLY__
840 853
@@ -1164,7 +1177,6 @@ asmlinkage long sys_mmap2(
1164 unsigned long fd, unsigned long pgoff); 1177 unsigned long fd, unsigned long pgoff);
1165asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs); 1178asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs);
1166asmlinkage int sys_pipe(nabi_no_regargs struct pt_regs regs); 1179asmlinkage int sys_pipe(nabi_no_regargs struct pt_regs regs);
1167asmlinkage int sys_ptrace(long request, long pid, long addr, long data);
1168struct sigaction; 1180struct sigaction;
1169asmlinkage long sys_rt_sigaction(int sig, 1181asmlinkage long sys_rt_sigaction(int sig,
1170 const struct sigaction __user *act, 1182 const struct sigaction __user *act,
diff --git a/include/asm-mips/vga.h b/include/asm-mips/vga.h
index 6b35cf054c79..ca5cec97e167 100644
--- a/include/asm-mips/vga.h
+++ b/include/asm-mips/vga.h
@@ -6,6 +6,8 @@
6#ifndef _ASM_VGA_H 6#ifndef _ASM_VGA_H
7#define _ASM_VGA_H 7#define _ASM_VGA_H
8 8
9#include <asm/byteorder.h>
10
9/* 11/*
10 * On the PC, we can just recalculate addresses and then 12 * On the PC, we can just recalculate addresses and then
11 * access the videoram directly without any black magic. 13 * access the videoram directly without any black magic.
@@ -16,4 +18,27 @@
16#define vga_readb(x) (*(x)) 18#define vga_readb(x) (*(x))
17#define vga_writeb(x,y) (*(y) = (x)) 19#define vga_writeb(x,y) (*(y) = (x))
18 20
21#define VT_BUF_HAVE_RW
22/*
23 * These are only needed for supporting VGA or MDA text mode, which use little
24 * endian byte ordering.
25 * In other cases, we can optimize by using native byte ordering and
26 * <linux/vt_buffer.h> has already done the right job for us.
27 */
28
29static inline void scr_writew(u16 val, volatile u16 *addr)
30{
31 *addr = cpu_to_le16(val);
32}
33
34static inline u16 scr_readw(volatile const u16 *addr)
35{
36 return le16_to_cpu(*addr);
37}
38
39#define scr_memcpyw(d, s, c) memcpy(d, s, c)
40#define scr_memmovew(d, s, c) memmove(d, s, c)
41#define VT_BUF_HAVE_MEMCPYW
42#define VT_BUF_HAVE_MEMMOVEW
43
19#endif /* _ASM_VGA_H */ 44#endif /* _ASM_VGA_H */
diff --git a/include/asm-mips/war.h b/include/asm-mips/war.h
index 04ee53b34c2e..ad374bd3f130 100644
--- a/include/asm-mips/war.h
+++ b/include/asm-mips/war.h
@@ -177,6 +177,17 @@
177#endif 177#endif
178 178
179/* 179/*
180 * The RM9000 has a bug (though PMC-Sierra opposes it being called that)
181 * where invalid instructions in the same I-cache line worth of instructions
182 * being fetched may case spurious exceptions.
183 */
184#if defined(CONFIG_MOMENCO_JAGUAR_ATX) || defined(CONFIG_MOMENCO_OCELOT_3) || \
185 defined(CONFIG_PMC_YOSEMITE)
186#define ICACHE_REFILLS_WORKAROUND_WAR 1
187#endif
188
189
190/*
180 * ON the R10000 upto version 2.6 (not sure about 2.7) there is a bug that 191 * ON the R10000 upto version 2.6 (not sure about 2.7) there is a bug that
181 * may cause ll / sc and lld / scd sequences to execute non-atomically. 192 * may cause ll / sc and lld / scd sequences to execute non-atomically.
182 */ 193 */
@@ -187,6 +198,9 @@
187/* 198/*
188 * Workarounds default to off 199 * Workarounds default to off
189 */ 200 */
201#ifndef ICACHE_REFILLS_WORKAROUND_WAR
202#define ICACHE_REFILLS_WORKAROUND_WAR 0
203#endif
190#ifndef R4600_V1_INDEX_ICACHEOP_WAR 204#ifndef R4600_V1_INDEX_ICACHEOP_WAR
191#define R4600_V1_INDEX_ICACHEOP_WAR 0 205#define R4600_V1_INDEX_ICACHEOP_WAR 0
192#endif 206#endif