aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/include/asm')
-rw-r--r--arch/mips/include/asm/arch_hweight.h38
-rw-r--r--arch/mips/include/asm/bitops.h5
-rw-r--r--arch/mips/include/asm/bootinfo.h6
-rw-r--r--arch/mips/include/asm/break.h2
-rw-r--r--arch/mips/include/asm/cacheops.h2
-rw-r--r--arch/mips/include/asm/cop2.h12
-rw-r--r--arch/mips/include/asm/cpu-features.h3
-rw-r--r--arch/mips/include/asm/cpu.h9
-rw-r--r--arch/mips/include/asm/elf.h5
-rw-r--r--arch/mips/include/asm/emma/emma2rh.h84
-rw-r--r--arch/mips/include/asm/emma/markeins.h37
-rw-r--r--arch/mips/include/asm/hazards.h4
-rw-r--r--arch/mips/include/asm/inst.h15
-rw-r--r--arch/mips/include/asm/kdebug.h3
-rw-r--r--arch/mips/include/asm/kgdb.h19
-rw-r--r--arch/mips/include/asm/kprobes.h92
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1xxx_eth.h1
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/nvram.h3
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h15
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/irq.h66
-rw-r--r--arch/mips/include/asm/mach-jz4740/base.h26
-rw-r--r--arch/mips/include/asm/mach-jz4740/clock.h28
-rw-r--r--arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h51
-rw-r--r--arch/mips/include/asm/mach-jz4740/dma.h90
-rw-r--r--arch/mips/include/asm/mach-jz4740/gpio.h398
-rw-r--r--arch/mips/include/asm/mach-jz4740/irq.h57
-rw-r--r--arch/mips/include/asm/mach-jz4740/jz4740_fb.h67
-rw-r--r--arch/mips/include/asm/mach-jz4740/jz4740_mmc.h15
-rw-r--r--arch/mips/include/asm/mach-jz4740/jz4740_nand.h34
-rw-r--r--arch/mips/include/asm/mach-jz4740/platform.h36
-rw-r--r--arch/mips/include/asm/mach-jz4740/timer.h22
-rw-r--r--arch/mips/include/asm/mach-jz4740/war.h25
-rw-r--r--arch/mips/include/asm/mach-loongson/loongson.h9
-rw-r--r--arch/mips/include/asm/mach-pb1x00/pb1550.h8
-rw-r--r--arch/mips/include/asm/mach-powertv/asic.h21
-rw-r--r--arch/mips/include/asm/mach-powertv/asic_reg_map.h2
-rw-r--r--arch/mips/include/asm/mach-powertv/asic_regs.h5
-rw-r--r--arch/mips/include/asm/mach-powertv/dma-coherence.h8
-rw-r--r--arch/mips/include/asm/mach-powertv/ioremap.h165
-rw-r--r--arch/mips/include/asm/mach-tx49xx/kmalloc.h4
-rw-r--r--arch/mips/include/asm/mipsregs.h1
-rw-r--r--arch/mips/include/asm/octeon/octeon.h3
-rw-r--r--arch/mips/include/asm/octeon/pci-octeon.h13
-rw-r--r--arch/mips/include/asm/pci.h5
-rw-r--r--arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h4
-rw-r--r--arch/mips/include/asm/processor.h13
-rw-r--r--arch/mips/include/asm/ptrace.h1
-rw-r--r--arch/mips/include/asm/sn/agent.h1
-rw-r--r--arch/mips/include/asm/uasm.h51
49 files changed, 1300 insertions, 284 deletions
diff --git a/arch/mips/include/asm/arch_hweight.h b/arch/mips/include/asm/arch_hweight.h
new file mode 100644
index 000000000000..712a7445ee93
--- /dev/null
+++ b/arch/mips/include/asm/arch_hweight.h
@@ -0,0 +1,38 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 */
7#ifndef _ASM_ARCH_HWEIGHT_H
8#define _ASM_ARCH_HWEIGHT_H
9
10#ifdef ARCH_HAS_USABLE_BUILTIN_POPCOUNT
11
12#include <asm/types.h>
13
14static inline unsigned int __arch_hweight32(unsigned int w)
15{
16 return __builtin_popcount(w);
17}
18
19static inline unsigned int __arch_hweight16(unsigned int w)
20{
21 return __builtin_popcount(w & 0xffff);
22}
23
24static inline unsigned int __arch_hweight8(unsigned int w)
25{
26 return __builtin_popcount(w & 0xff);
27}
28
29static inline unsigned long __arch_hweight64(__u64 w)
30{
31 return __builtin_popcountll(w);
32}
33
34#else
35#include <asm-generic/bitops/arch_hweight.h>
36#endif
37
38#endif /* _ASM_ARCH_HWEIGHT_H */
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
index 9255cfbee459..b0ce7ca2851f 100644
--- a/arch/mips/include/asm/bitops.h
+++ b/arch/mips/include/asm/bitops.h
@@ -700,7 +700,10 @@ static inline int ffs(int word)
700#ifdef __KERNEL__ 700#ifdef __KERNEL__
701 701
702#include <asm-generic/bitops/sched.h> 702#include <asm-generic/bitops/sched.h>
703#include <asm-generic/bitops/hweight.h> 703
704#include <asm/arch_hweight.h>
705#include <asm-generic/bitops/const_hweight.h>
706
704#include <asm-generic/bitops/ext2-non-atomic.h> 707#include <asm-generic/bitops/ext2-non-atomic.h>
705#include <asm-generic/bitops/ext2-atomic.h> 708#include <asm-generic/bitops/ext2-atomic.h>
706#include <asm-generic/bitops/minix.h> 709#include <asm-generic/bitops/minix.h>
diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
index 09eee09780f2..15a8ef0707c6 100644
--- a/arch/mips/include/asm/bootinfo.h
+++ b/arch/mips/include/asm/bootinfo.h
@@ -71,6 +71,12 @@
71#define MACH_LEMOTE_LL2F 7 71#define MACH_LEMOTE_LL2F 7
72#define MACH_LOONGSON_END 8 72#define MACH_LOONGSON_END 8
73 73
74/*
75 * Valid machtype for group INGENIC
76 */
77#define MACH_INGENIC_JZ4730 0 /* JZ4730 SOC */
78#define MACH_INGENIC_JZ4740 1 /* JZ4740 SOC */
79
74extern char *system_type; 80extern char *system_type;
75const char *get_system_type(void); 81const char *get_system_type(void);
76 82
diff --git a/arch/mips/include/asm/break.h b/arch/mips/include/asm/break.h
index 44437ed765e8..9161e684cb4c 100644
--- a/arch/mips/include/asm/break.h
+++ b/arch/mips/include/asm/break.h
@@ -30,6 +30,8 @@
30#define BRK_BUG 512 /* Used by BUG() */ 30#define BRK_BUG 512 /* Used by BUG() */
31#define BRK_KDB 513 /* Used in KDB_ENTER() */ 31#define BRK_KDB 513 /* Used in KDB_ENTER() */
32#define BRK_MEMU 514 /* Used by FPU emulator */ 32#define BRK_MEMU 514 /* Used by FPU emulator */
33#define BRK_KPROBE_BP 515 /* Kprobe break */
34#define BRK_KPROBE_SSTEPBP 516 /* Kprobe single step software implementation */
33#define BRK_MULOVF 1023 /* Multiply overflow */ 35#define BRK_MULOVF 1023 /* Multiply overflow */
34 36
35#endif /* __ASM_BREAK_H */ 37#endif /* __ASM_BREAK_H */
diff --git a/arch/mips/include/asm/cacheops.h b/arch/mips/include/asm/cacheops.h
index 256ad2cc6eb8..8f99c11ab665 100644
--- a/arch/mips/include/asm/cacheops.h
+++ b/arch/mips/include/asm/cacheops.h
@@ -62,6 +62,8 @@
62 * RM7000-specific cacheops 62 * RM7000-specific cacheops
63 */ 63 */
64#define Page_Invalidate_T 0x16 64#define Page_Invalidate_T 0x16
65#define Index_Store_Tag_T 0x0a
66#define Index_Load_Tag_T 0x06
65 67
66/* 68/*
67 * R10000-specific cacheops 69 * R10000-specific cacheops
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h
index 6b04c98b7fad..2cb2f0c2c4f8 100644
--- a/arch/mips/include/asm/cop2.h
+++ b/arch/mips/include/asm/cop2.h
@@ -9,6 +9,8 @@
9#ifndef __ASM_COP2_H 9#ifndef __ASM_COP2_H
10#define __ASM_COP2_H 10#define __ASM_COP2_H
11 11
12#include <linux/notifier.h>
13
12enum cu2_ops { 14enum cu2_ops {
13 CU2_EXCEPTION, 15 CU2_EXCEPTION,
14 CU2_LWC2_OP, 16 CU2_LWC2_OP,
@@ -20,4 +22,14 @@ enum cu2_ops {
20extern int register_cu2_notifier(struct notifier_block *nb); 22extern int register_cu2_notifier(struct notifier_block *nb);
21extern int cu2_notifier_call_chain(unsigned long val, void *v); 23extern int cu2_notifier_call_chain(unsigned long val, void *v);
22 24
25#define cu2_notifier(fn, pri) \
26({ \
27 static struct notifier_block fn##_nb __cpuinitdata = { \
28 .notifier_call = fn, \
29 .priority = pri \
30 }; \
31 \
32 register_cu2_notifier(&fn##_nb); \
33})
34
23#endif /* __ASM_COP2_H */ 35#endif /* __ASM_COP2_H */
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index ac73cede3a0a..ca400f7c3f59 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -159,7 +159,8 @@
159 159
160/* 160/*
161 * MIPS32, MIPS64, VR5500, IDT32332, IDT32334 and maybe a few other 161 * MIPS32, MIPS64, VR5500, IDT32332, IDT32334 and maybe a few other
162 * pre-MIPS32/MIPS53 processors have CLO, CLZ. For 64-bit kernels 162 * pre-MIPS32/MIPS53 processors have CLO, CLZ. The IDT RC64574 is 64-bit and
163 * has CLO and CLZ but not DCLO nor DCLZ. For 64-bit kernels
163 * cpu_has_clo_clz also indicates the availability of DCLO and DCLZ. 164 * cpu_has_clo_clz also indicates the availability of DCLO and DCLZ.
164 */ 165 */
165# ifndef cpu_has_clo_clz 166# ifndef cpu_has_clo_clz
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index a5acda416946..b201a8f5b127 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -34,7 +34,7 @@
34#define PRID_COMP_LSI 0x080000 34#define PRID_COMP_LSI 0x080000
35#define PRID_COMP_LEXRA 0x0b0000 35#define PRID_COMP_LEXRA 0x0b0000
36#define PRID_COMP_CAVIUM 0x0d0000 36#define PRID_COMP_CAVIUM 0x0d0000
37 37#define PRID_COMP_INGENIC 0xd00000
38 38
39/* 39/*
40 * Assigned values for the product ID register. In order to detect a 40 * Assigned values for the product ID register. In order to detect a
@@ -133,6 +133,12 @@
133#define PRID_IMP_CAVIUM_CN52XX 0x0700 133#define PRID_IMP_CAVIUM_CN52XX 0x0700
134 134
135/* 135/*
136 * These are the PRID's for when 23:16 == PRID_COMP_INGENIC
137 */
138
139#define PRID_IMP_JZRISC 0x0200
140
141/*
136 * Definitions for 7:0 on legacy processors 142 * Definitions for 7:0 on legacy processors
137 */ 143 */
138 144
@@ -219,6 +225,7 @@ enum cpu_type_enum {
219 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K, 225 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
220 CPU_ALCHEMY, CPU_PR4450, CPU_BCM3302, CPU_BCM4710, 226 CPU_ALCHEMY, CPU_PR4450, CPU_BCM3302, CPU_BCM4710,
221 CPU_BCM6338, CPU_BCM6345, CPU_BCM6348, CPU_BCM6358, 227 CPU_BCM6338, CPU_BCM6345, CPU_BCM6348, CPU_BCM6358,
228 CPU_JZRISC,
222 229
223 /* 230 /*
224 * MIPS64 class processors 231 * MIPS64 class processors
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
index ea77a42c5f8c..fd1d39eb7431 100644
--- a/arch/mips/include/asm/elf.h
+++ b/arch/mips/include/asm/elf.h
@@ -372,4 +372,9 @@ extern const char *__elf_platform;
372struct linux_binprm; 372struct linux_binprm;
373extern int arch_setup_additional_pages(struct linux_binprm *bprm, 373extern int arch_setup_additional_pages(struct linux_binprm *bprm,
374 int uses_interp); 374 int uses_interp);
375
376struct mm_struct;
377extern unsigned long arch_randomize_brk(struct mm_struct *mm);
378#define arch_randomize_brk arch_randomize_brk
379
375#endif /* _ASM_ELF_H */ 380#endif /* _ASM_ELF_H */
diff --git a/arch/mips/include/asm/emma/emma2rh.h b/arch/mips/include/asm/emma/emma2rh.h
index 2afb2fe11b30..c1449d20ef0e 100644
--- a/arch/mips/include/asm/emma/emma2rh.h
+++ b/arch/mips/include/asm/emma/emma2rh.h
@@ -99,88 +99,22 @@
99#define EMMA2RH_PCI_CONFIG_BASE EMMA2RH_PCI_IO_BASE 99#define EMMA2RH_PCI_CONFIG_BASE EMMA2RH_PCI_IO_BASE
100#define EMMA2RH_PCI_CONFIG_SIZE EMMA2RH_PCI_IO_SIZE 100#define EMMA2RH_PCI_CONFIG_SIZE EMMA2RH_PCI_IO_SIZE
101 101
102#define NUM_CPU_IRQ 8
103#define NUM_EMMA2RH_IRQ 96 102#define NUM_EMMA2RH_IRQ 96
104 103
105#define CPU_EMMA2RH_CASCADE 2 104#define EMMA2RH_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)
106#define CPU_IRQ_BASE MIPS_CPU_IRQ_BASE
107#define EMMA2RH_IRQ_BASE (CPU_IRQ_BASE + NUM_CPU_IRQ)
108 105
109/* 106/*
110 * emma2rh irq defs 107 * emma2rh irq defs
111 */ 108 */
112 109
113#define EMMA2RH_IRQ_INT0 (0 + EMMA2RH_IRQ_BASE) 110#define EMMA2RH_IRQ_INT(n) (EMMA2RH_IRQ_BASE + (n))
114#define EMMA2RH_IRQ_INT1 (1 + EMMA2RH_IRQ_BASE) 111
115#define EMMA2RH_IRQ_INT2 (2 + EMMA2RH_IRQ_BASE) 112#define EMMA2RH_IRQ_PFUR0 EMMA2RH_IRQ_INT(49)
116#define EMMA2RH_IRQ_INT3 (3 + EMMA2RH_IRQ_BASE) 113#define EMMA2RH_IRQ_PFUR1 EMMA2RH_IRQ_INT(50)
117#define EMMA2RH_IRQ_INT4 (4 + EMMA2RH_IRQ_BASE) 114#define EMMA2RH_IRQ_PFUR2 EMMA2RH_IRQ_INT(51)
118#define EMMA2RH_IRQ_INT5 (5 + EMMA2RH_IRQ_BASE) 115#define EMMA2RH_IRQ_PIIC0 EMMA2RH_IRQ_INT(56)
119#define EMMA2RH_IRQ_INT6 (6 + EMMA2RH_IRQ_BASE) 116#define EMMA2RH_IRQ_PIIC1 EMMA2RH_IRQ_INT(57)
120#define EMMA2RH_IRQ_INT7 (7 + EMMA2RH_IRQ_BASE) 117#define EMMA2RH_IRQ_PIIC2 EMMA2RH_IRQ_INT(58)
121#define EMMA2RH_IRQ_INT8 (8 + EMMA2RH_IRQ_BASE)
122#define EMMA2RH_IRQ_INT9 (9 + EMMA2RH_IRQ_BASE)
123#define EMMA2RH_IRQ_INT10 (10 + EMMA2RH_IRQ_BASE)
124#define EMMA2RH_IRQ_INT11 (11 + EMMA2RH_IRQ_BASE)
125#define EMMA2RH_IRQ_INT12 (12 + EMMA2RH_IRQ_BASE)
126#define EMMA2RH_IRQ_INT13 (13 + EMMA2RH_IRQ_BASE)
127#define EMMA2RH_IRQ_INT14 (14 + EMMA2RH_IRQ_BASE)
128#define EMMA2RH_IRQ_INT15 (15 + EMMA2RH_IRQ_BASE)
129#define EMMA2RH_IRQ_INT16 (16 + EMMA2RH_IRQ_BASE)
130#define EMMA2RH_IRQ_INT17 (17 + EMMA2RH_IRQ_BASE)
131#define EMMA2RH_IRQ_INT18 (18 + EMMA2RH_IRQ_BASE)
132#define EMMA2RH_IRQ_INT19 (19 + EMMA2RH_IRQ_BASE)
133#define EMMA2RH_IRQ_INT20 (20 + EMMA2RH_IRQ_BASE)
134#define EMMA2RH_IRQ_INT21 (21 + EMMA2RH_IRQ_BASE)
135#define EMMA2RH_IRQ_INT22 (22 + EMMA2RH_IRQ_BASE)
136#define EMMA2RH_IRQ_INT23 (23 + EMMA2RH_IRQ_BASE)
137#define EMMA2RH_IRQ_INT24 (24 + EMMA2RH_IRQ_BASE)
138#define EMMA2RH_IRQ_INT25 (25 + EMMA2RH_IRQ_BASE)
139#define EMMA2RH_IRQ_INT26 (26 + EMMA2RH_IRQ_BASE)
140#define EMMA2RH_IRQ_INT27 (27 + EMMA2RH_IRQ_BASE)
141#define EMMA2RH_IRQ_INT28 (28 + EMMA2RH_IRQ_BASE)
142#define EMMA2RH_IRQ_INT29 (29 + EMMA2RH_IRQ_BASE)
143#define EMMA2RH_IRQ_INT30 (30 + EMMA2RH_IRQ_BASE)
144#define EMMA2RH_IRQ_INT31 (31 + EMMA2RH_IRQ_BASE)
145#define EMMA2RH_IRQ_INT32 (32 + EMMA2RH_IRQ_BASE)
146#define EMMA2RH_IRQ_INT33 (33 + EMMA2RH_IRQ_BASE)
147#define EMMA2RH_IRQ_INT34 (34 + EMMA2RH_IRQ_BASE)
148#define EMMA2RH_IRQ_INT35 (35 + EMMA2RH_IRQ_BASE)
149#define EMMA2RH_IRQ_INT36 (36 + EMMA2RH_IRQ_BASE)
150#define EMMA2RH_IRQ_INT37 (37 + EMMA2RH_IRQ_BASE)
151#define EMMA2RH_IRQ_INT38 (38 + EMMA2RH_IRQ_BASE)
152#define EMMA2RH_IRQ_INT39 (39 + EMMA2RH_IRQ_BASE)
153#define EMMA2RH_IRQ_INT40 (40 + EMMA2RH_IRQ_BASE)
154#define EMMA2RH_IRQ_INT41 (41 + EMMA2RH_IRQ_BASE)
155#define EMMA2RH_IRQ_INT42 (42 + EMMA2RH_IRQ_BASE)
156#define EMMA2RH_IRQ_INT43 (43 + EMMA2RH_IRQ_BASE)
157#define EMMA2RH_IRQ_INT44 (44 + EMMA2RH_IRQ_BASE)
158#define EMMA2RH_IRQ_INT45 (45 + EMMA2RH_IRQ_BASE)
159#define EMMA2RH_IRQ_INT46 (46 + EMMA2RH_IRQ_BASE)
160#define EMMA2RH_IRQ_INT47 (47 + EMMA2RH_IRQ_BASE)
161#define EMMA2RH_IRQ_INT48 (48 + EMMA2RH_IRQ_BASE)
162#define EMMA2RH_IRQ_INT49 (49 + EMMA2RH_IRQ_BASE)
163#define EMMA2RH_IRQ_INT50 (50 + EMMA2RH_IRQ_BASE)
164#define EMMA2RH_IRQ_INT51 (51 + EMMA2RH_IRQ_BASE)
165#define EMMA2RH_IRQ_INT52 (52 + EMMA2RH_IRQ_BASE)
166#define EMMA2RH_IRQ_INT53 (53 + EMMA2RH_IRQ_BASE)
167#define EMMA2RH_IRQ_INT54 (54 + EMMA2RH_IRQ_BASE)
168#define EMMA2RH_IRQ_INT55 (55 + EMMA2RH_IRQ_BASE)
169#define EMMA2RH_IRQ_INT56 (56 + EMMA2RH_IRQ_BASE)
170#define EMMA2RH_IRQ_INT57 (57 + EMMA2RH_IRQ_BASE)
171#define EMMA2RH_IRQ_INT58 (58 + EMMA2RH_IRQ_BASE)
172#define EMMA2RH_IRQ_INT59 (59 + EMMA2RH_IRQ_BASE)
173#define EMMA2RH_IRQ_INT60 (60 + EMMA2RH_IRQ_BASE)
174#define EMMA2RH_IRQ_INT61 (61 + EMMA2RH_IRQ_BASE)
175#define EMMA2RH_IRQ_INT62 (62 + EMMA2RH_IRQ_BASE)
176#define EMMA2RH_IRQ_INT63 (63 + EMMA2RH_IRQ_BASE)
177
178#define EMMA2RH_IRQ_PFUR0 EMMA2RH_IRQ_INT49
179#define EMMA2RH_IRQ_PFUR1 EMMA2RH_IRQ_INT50
180#define EMMA2RH_IRQ_PFUR2 EMMA2RH_IRQ_INT51
181#define EMMA2RH_IRQ_PIIC0 EMMA2RH_IRQ_INT56
182#define EMMA2RH_IRQ_PIIC1 EMMA2RH_IRQ_INT57
183#define EMMA2RH_IRQ_PIIC2 EMMA2RH_IRQ_INT58
184 118
185/* 119/*
186 * EMMA2RH Register Access 120 * EMMA2RH Register Access
diff --git a/arch/mips/include/asm/emma/markeins.h b/arch/mips/include/asm/emma/markeins.h
index 2618bf230248..bf2d229c2dae 100644
--- a/arch/mips/include/asm/emma/markeins.h
+++ b/arch/mips/include/asm/emma/markeins.h
@@ -25,44 +25,13 @@
25#define NUM_EMMA2RH_IRQ_SW 32 25#define NUM_EMMA2RH_IRQ_SW 32
26#define NUM_EMMA2RH_IRQ_GPIO 32 26#define NUM_EMMA2RH_IRQ_GPIO 32
27 27
28#define EMMA2RH_SW_CASCADE (EMMA2RH_IRQ_INT7 - EMMA2RH_IRQ_INT0) 28#define EMMA2RH_SW_CASCADE (EMMA2RH_IRQ_INT(7) - EMMA2RH_IRQ_INT(0))
29#define EMMA2RH_GPIO_CASCADE (EMMA2RH_IRQ_INT46 - EMMA2RH_IRQ_INT0) 29#define EMMA2RH_GPIO_CASCADE (EMMA2RH_IRQ_INT(46) - EMMA2RH_IRQ_INT(0))
30 30
31#define EMMA2RH_SW_IRQ_BASE (EMMA2RH_IRQ_BASE + NUM_EMMA2RH_IRQ) 31#define EMMA2RH_SW_IRQ_BASE (EMMA2RH_IRQ_BASE + NUM_EMMA2RH_IRQ)
32#define EMMA2RH_GPIO_IRQ_BASE (EMMA2RH_SW_IRQ_BASE + NUM_EMMA2RH_IRQ_SW) 32#define EMMA2RH_GPIO_IRQ_BASE (EMMA2RH_SW_IRQ_BASE + NUM_EMMA2RH_IRQ_SW)
33 33
34#define EMMA2RH_SW_IRQ_INT0 (0+EMMA2RH_SW_IRQ_BASE) 34#define EMMA2RH_SW_IRQ_INT(n) (EMMA2RH_SW_IRQ_BASE + (n))
35#define EMMA2RH_SW_IRQ_INT1 (1+EMMA2RH_SW_IRQ_BASE)
36#define EMMA2RH_SW_IRQ_INT2 (2+EMMA2RH_SW_IRQ_BASE)
37#define EMMA2RH_SW_IRQ_INT3 (3+EMMA2RH_SW_IRQ_BASE)
38#define EMMA2RH_SW_IRQ_INT4 (4+EMMA2RH_SW_IRQ_BASE)
39#define EMMA2RH_SW_IRQ_INT5 (5+EMMA2RH_SW_IRQ_BASE)
40#define EMMA2RH_SW_IRQ_INT6 (6+EMMA2RH_SW_IRQ_BASE)
41#define EMMA2RH_SW_IRQ_INT7 (7+EMMA2RH_SW_IRQ_BASE)
42#define EMMA2RH_SW_IRQ_INT8 (8+EMMA2RH_SW_IRQ_BASE)
43#define EMMA2RH_SW_IRQ_INT9 (9+EMMA2RH_SW_IRQ_BASE)
44#define EMMA2RH_SW_IRQ_INT10 (10+EMMA2RH_SW_IRQ_BASE)
45#define EMMA2RH_SW_IRQ_INT11 (11+EMMA2RH_SW_IRQ_BASE)
46#define EMMA2RH_SW_IRQ_INT12 (12+EMMA2RH_SW_IRQ_BASE)
47#define EMMA2RH_SW_IRQ_INT13 (13+EMMA2RH_SW_IRQ_BASE)
48#define EMMA2RH_SW_IRQ_INT14 (14+EMMA2RH_SW_IRQ_BASE)
49#define EMMA2RH_SW_IRQ_INT15 (15+EMMA2RH_SW_IRQ_BASE)
50#define EMMA2RH_SW_IRQ_INT16 (16+EMMA2RH_SW_IRQ_BASE)
51#define EMMA2RH_SW_IRQ_INT17 (17+EMMA2RH_SW_IRQ_BASE)
52#define EMMA2RH_SW_IRQ_INT18 (18+EMMA2RH_SW_IRQ_BASE)
53#define EMMA2RH_SW_IRQ_INT19 (19+EMMA2RH_SW_IRQ_BASE)
54#define EMMA2RH_SW_IRQ_INT20 (20+EMMA2RH_SW_IRQ_BASE)
55#define EMMA2RH_SW_IRQ_INT21 (21+EMMA2RH_SW_IRQ_BASE)
56#define EMMA2RH_SW_IRQ_INT22 (22+EMMA2RH_SW_IRQ_BASE)
57#define EMMA2RH_SW_IRQ_INT23 (23+EMMA2RH_SW_IRQ_BASE)
58#define EMMA2RH_SW_IRQ_INT24 (24+EMMA2RH_SW_IRQ_BASE)
59#define EMMA2RH_SW_IRQ_INT25 (25+EMMA2RH_SW_IRQ_BASE)
60#define EMMA2RH_SW_IRQ_INT26 (26+EMMA2RH_SW_IRQ_BASE)
61#define EMMA2RH_SW_IRQ_INT27 (27+EMMA2RH_SW_IRQ_BASE)
62#define EMMA2RH_SW_IRQ_INT28 (28+EMMA2RH_SW_IRQ_BASE)
63#define EMMA2RH_SW_IRQ_INT29 (29+EMMA2RH_SW_IRQ_BASE)
64#define EMMA2RH_SW_IRQ_INT30 (30+EMMA2RH_SW_IRQ_BASE)
65#define EMMA2RH_SW_IRQ_INT31 (31+EMMA2RH_SW_IRQ_BASE)
66 35
67#define MARKEINS_PCI_IRQ_INTA EMMA2RH_GPIO_IRQ_BASE+15 36#define MARKEINS_PCI_IRQ_INTA EMMA2RH_GPIO_IRQ_BASE+15
68#define MARKEINS_PCI_IRQ_INTB EMMA2RH_GPIO_IRQ_BASE+16 37#define MARKEINS_PCI_IRQ_INTB EMMA2RH_GPIO_IRQ_BASE+16
diff --git a/arch/mips/include/asm/hazards.h b/arch/mips/include/asm/hazards.h
index 0eaf77ffbc4f..4e332165d7b7 100644
--- a/arch/mips/include/asm/hazards.h
+++ b/arch/mips/include/asm/hazards.h
@@ -87,7 +87,7 @@ do { \
87 : "=r" (tmp)); \ 87 : "=r" (tmp)); \
88} while (0) 88} while (0)
89 89
90#elif defined(CONFIG_CPU_MIPSR1) && !defined(CONFIG_MACH_ALCHEMY) 90#elif defined(CONFIG_CPU_MIPSR1) && !defined(CONFIG_MIPS_ALCHEMY)
91 91
92/* 92/*
93 * These are slightly complicated by the fact that we guarantee R1 kernels to 93 * These are slightly complicated by the fact that we guarantee R1 kernels to
@@ -138,7 +138,7 @@ do { \
138 __instruction_hazard(); \ 138 __instruction_hazard(); \
139} while (0) 139} while (0)
140 140
141#elif defined(CONFIG_MACH_ALCHEMY) || defined(CONFIG_CPU_CAVIUM_OCTEON) || \ 141#elif defined(CONFIG_MIPS_ALCHEMY) || defined(CONFIG_CPU_CAVIUM_OCTEON) || \
142 defined(CONFIG_CPU_LOONGSON2) || defined(CONFIG_CPU_R10000) || \ 142 defined(CONFIG_CPU_LOONGSON2) || defined(CONFIG_CPU_R10000) || \
143 defined(CONFIG_CPU_R5500) 143 defined(CONFIG_CPU_R5500)
144 144
diff --git a/arch/mips/include/asm/inst.h b/arch/mips/include/asm/inst.h
index 6489f00731ca..444ff71aa0e8 100644
--- a/arch/mips/include/asm/inst.h
+++ b/arch/mips/include/asm/inst.h
@@ -247,6 +247,12 @@ struct ma_format { /* FPU multipy and add format (MIPS IV) */
247 unsigned int fmt : 2; 247 unsigned int fmt : 2;
248}; 248};
249 249
250struct b_format { /* BREAK and SYSCALL */
251 unsigned int opcode:6;
252 unsigned int code:20;
253 unsigned int func:6;
254};
255
250#elif defined(__MIPSEL__) 256#elif defined(__MIPSEL__)
251 257
252struct j_format { /* Jump format */ 258struct j_format { /* Jump format */
@@ -314,6 +320,12 @@ struct ma_format { /* FPU multipy and add format (MIPS IV) */
314 unsigned int opcode : 6; 320 unsigned int opcode : 6;
315}; 321};
316 322
323struct b_format { /* BREAK and SYSCALL */
324 unsigned int func:6;
325 unsigned int code:20;
326 unsigned int opcode:6;
327};
328
317#else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */ 329#else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */
318#error "MIPS but neither __MIPSEL__ nor __MIPSEB__?" 330#error "MIPS but neither __MIPSEL__ nor __MIPSEB__?"
319#endif 331#endif
@@ -328,7 +340,8 @@ union mips_instruction {
328 struct c_format c_format; 340 struct c_format c_format;
329 struct r_format r_format; 341 struct r_format r_format;
330 struct f_format f_format; 342 struct f_format f_format;
331 struct ma_format ma_format; 343 struct ma_format ma_format;
344 struct b_format b_format;
332}; 345};
333 346
334/* HACHACHAHCAHC ... */ 347/* HACHACHAHCAHC ... */
diff --git a/arch/mips/include/asm/kdebug.h b/arch/mips/include/asm/kdebug.h
index 5bf62aafc890..6a9af5fcb5d7 100644
--- a/arch/mips/include/asm/kdebug.h
+++ b/arch/mips/include/asm/kdebug.h
@@ -8,6 +8,9 @@ enum die_val {
8 DIE_FP, 8 DIE_FP,
9 DIE_TRAP, 9 DIE_TRAP,
10 DIE_RI, 10 DIE_RI,
11 DIE_PAGE_FAULT,
12 DIE_BREAK,
13 DIE_SSTEPBP
11}; 14};
12 15
13#endif /* _ASM_MIPS_KDEBUG_H */ 16#endif /* _ASM_MIPS_KDEBUG_H */
diff --git a/arch/mips/include/asm/kgdb.h b/arch/mips/include/asm/kgdb.h
index 19002d605ac4..e6c0b0e14ccb 100644
--- a/arch/mips/include/asm/kgdb.h
+++ b/arch/mips/include/asm/kgdb.h
@@ -8,28 +8,27 @@
8#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \ 8#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \
9 (_MIPS_ISA == _MIPS_ISA_MIPS32) 9 (_MIPS_ISA == _MIPS_ISA_MIPS32)
10 10
11#define KGDB_GDB_REG_SIZE 32 11#define KGDB_GDB_REG_SIZE 32
12#define GDB_SIZEOF_REG sizeof(u32)
12 13
13#elif (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \ 14#elif (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
14 (_MIPS_ISA == _MIPS_ISA_MIPS64) 15 (_MIPS_ISA == _MIPS_ISA_MIPS64)
15 16
16#ifdef CONFIG_32BIT 17#ifdef CONFIG_32BIT
17#define KGDB_GDB_REG_SIZE 32 18#define KGDB_GDB_REG_SIZE 32
19#define GDB_SIZEOF_REG sizeof(u32)
18#else /* CONFIG_CPU_32BIT */ 20#else /* CONFIG_CPU_32BIT */
19#define KGDB_GDB_REG_SIZE 64 21#define KGDB_GDB_REG_SIZE 64
22#define GDB_SIZEOF_REG sizeof(u64)
20#endif 23#endif
21#else 24#else
22#error "Need to set KGDB_GDB_REG_SIZE for MIPS ISA" 25#error "Need to set KGDB_GDB_REG_SIZE for MIPS ISA"
23#endif /* _MIPS_ISA */ 26#endif /* _MIPS_ISA */
24 27
25#define BUFMAX 2048 28#define BUFMAX 2048
26#if (KGDB_GDB_REG_SIZE == 32) 29#define DBG_MAX_REG_NUM 72
27#define NUMREGBYTES (90*sizeof(u32)) 30#define NUMREGBYTES (DBG_MAX_REG_NUM * sizeof(GDB_SIZEOF_REG))
28#define NUMCRITREGBYTES (12*sizeof(u32)) 31#define NUMCRITREGBYTES (12 * sizeof(GDB_SIZEOF_REG))
29#else
30#define NUMREGBYTES (90*sizeof(u64))
31#define NUMCRITREGBYTES (12*sizeof(u64))
32#endif
33#define BREAK_INSTR_SIZE 4 32#define BREAK_INSTR_SIZE 4
34#define CACHE_FLUSH_IS_SAFE 0 33#define CACHE_FLUSH_IS_SAFE 0
35 34
diff --git a/arch/mips/include/asm/kprobes.h b/arch/mips/include/asm/kprobes.h
new file mode 100644
index 000000000000..e6ea4d4d7205
--- /dev/null
+++ b/arch/mips/include/asm/kprobes.h
@@ -0,0 +1,92 @@
1/*
2 * Kernel Probes (KProbes)
3 * include/asm-mips/kprobes.h
4 *
5 * Copyright 2006 Sony Corp.
6 * Copyright 2010 Cavium Networks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _ASM_KPROBES_H
23#define _ASM_KPROBES_H
24
25#include <linux/ptrace.h>
26#include <linux/types.h>
27
28#include <asm/cacheflush.h>
29#include <asm/kdebug.h>
30#include <asm/inst.h>
31
32#define __ARCH_WANT_KPROBES_INSN_SLOT
33
34struct kprobe;
35struct pt_regs;
36
37typedef union mips_instruction kprobe_opcode_t;
38
39#define MAX_INSN_SIZE 2
40
41#define flush_insn_slot(p) \
42do { \
43 flush_icache_range((unsigned long)p->addr, \
44 (unsigned long)p->addr + \
45 (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \
46} while (0)
47
48
49#define kretprobe_blacklist_size 0
50
51void arch_remove_kprobe(struct kprobe *p);
52
53/* Architecture specific copy of original instruction*/
54struct arch_specific_insn {
55 /* copy of the original instruction */
56 kprobe_opcode_t *insn;
57};
58
59struct prev_kprobe {
60 struct kprobe *kp;
61 unsigned long status;
62 unsigned long old_SR;
63 unsigned long saved_SR;
64 unsigned long saved_epc;
65};
66
67#define MAX_JPROBES_STACK_SIZE 128
68#define MAX_JPROBES_STACK_ADDR \
69 (((unsigned long)current_thread_info()) + THREAD_SIZE - 32 - sizeof(struct pt_regs))
70
71#define MIN_JPROBES_STACK_SIZE(ADDR) \
72 ((((ADDR) + MAX_JPROBES_STACK_SIZE) > MAX_JPROBES_STACK_ADDR) \
73 ? MAX_JPROBES_STACK_ADDR - (ADDR) \
74 : MAX_JPROBES_STACK_SIZE)
75
76
77/* per-cpu kprobe control block */
78struct kprobe_ctlblk {
79 unsigned long kprobe_status;
80 unsigned long kprobe_old_SR;
81 unsigned long kprobe_saved_SR;
82 unsigned long kprobe_saved_epc;
83 unsigned long jprobe_saved_sp;
84 struct pt_regs jprobe_saved_regs;
85 u8 jprobes_stack[MAX_JPROBES_STACK_SIZE];
86 struct prev_kprobe prev_kprobe;
87};
88
89extern int kprobe_exceptions_notify(struct notifier_block *self,
90 unsigned long val, void *data);
91
92#endif /* _ASM_KPROBES_H */
diff --git a/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
index bae9b758fcde..49dc8d9db186 100644
--- a/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
+++ b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
@@ -9,6 +9,7 @@ struct au1000_eth_platform_data {
9 int phy_addr; 9 int phy_addr;
10 int phy_busid; 10 int phy_busid;
11 int phy_irq; 11 int phy_irq;
12 char mac[6];
12}; 13};
13 14
14void __init au1xxx_override_eth_cfg(unsigned port, 15void __init au1xxx_override_eth_cfg(unsigned port,
diff --git a/arch/mips/include/asm/mach-bcm47xx/nvram.h b/arch/mips/include/asm/mach-bcm47xx/nvram.h
index 0d8cc146f7a4..c58ebd8bc155 100644
--- a/arch/mips/include/asm/mach-bcm47xx/nvram.h
+++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h
@@ -31,6 +31,9 @@ struct nvram_header {
31#define NVRAM_MAX_VALUE_LEN 255 31#define NVRAM_MAX_VALUE_LEN 255
32#define NVRAM_MAX_PARAM_LEN 64 32#define NVRAM_MAX_PARAM_LEN 64
33 33
34#define NVRAM_ERR_INV_PARAM -8
35#define NVRAM_ERR_ENVNOTFOUND -9
36
34extern int nvram_getenv(char *name, char *val, size_t val_len); 37extern int nvram_getenv(char *name, char *val, size_t val_len);
35 38
36#endif 39#endif
diff --git a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
index bbf054042395..b952fc7215e2 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
@@ -61,21 +61,18 @@
61 61
62#define kernel_uses_smartmips_rixi (cpu_data[0].cputype == CPU_CAVIUM_OCTEON_PLUS) 62#define kernel_uses_smartmips_rixi (cpu_data[0].cputype == CPU_CAVIUM_OCTEON_PLUS)
63 63
64#define ARCH_HAS_READ_CURRENT_TIMER 1
65#define ARCH_HAS_IRQ_PER_CPU 1 64#define ARCH_HAS_IRQ_PER_CPU 1
66#define ARCH_HAS_SPINLOCK_PREFETCH 1 65#define ARCH_HAS_SPINLOCK_PREFETCH 1
67#define spin_lock_prefetch(x) prefetch(x) 66#define spin_lock_prefetch(x) prefetch(x)
68#define PREFETCH_STRIDE 128 67#define PREFETCH_STRIDE 128
69 68
70static inline int read_current_timer(unsigned long *result) 69#ifdef __OCTEON__
71{ 70/*
72 asm volatile ("rdhwr %0,$31\n" 71 * All gcc versions that have OCTEON support define __OCTEON__ and have the
73#ifndef CONFIG_64BIT 72 * __builtin_popcount support.
74 "\tsll %0, 0" 73 */
74#define ARCH_HAS_USABLE_BUILTIN_POPCOUNT 1
75#endif 75#endif
76 : "=r" (*result));
77 return 0;
78}
79 76
80static inline int octeon_has_saa(void) 77static inline int octeon_has_saa(void)
81{ 78{
diff --git a/arch/mips/include/asm/mach-cavium-octeon/irq.h b/arch/mips/include/asm/mach-cavium-octeon/irq.h
index d32220fbf4f1..6ddab8aef644 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/irq.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/irq.h
@@ -172,71 +172,9 @@
172#ifdef CONFIG_PCI_MSI 172#ifdef CONFIG_PCI_MSI
173/* 152 - 215 represent the MSI interrupts 0-63 */ 173/* 152 - 215 represent the MSI interrupts 0-63 */
174#define OCTEON_IRQ_MSI_BIT0 152 174#define OCTEON_IRQ_MSI_BIT0 152
175#define OCTEON_IRQ_MSI_BIT1 153 175#define OCTEON_IRQ_MSI_LAST (OCTEON_IRQ_MSI_BIT0 + 255)
176#define OCTEON_IRQ_MSI_BIT2 154
177#define OCTEON_IRQ_MSI_BIT3 155
178#define OCTEON_IRQ_MSI_BIT4 156
179#define OCTEON_IRQ_MSI_BIT5 157
180#define OCTEON_IRQ_MSI_BIT6 158
181#define OCTEON_IRQ_MSI_BIT7 159
182#define OCTEON_IRQ_MSI_BIT8 160
183#define OCTEON_IRQ_MSI_BIT9 161
184#define OCTEON_IRQ_MSI_BIT10 162
185#define OCTEON_IRQ_MSI_BIT11 163
186#define OCTEON_IRQ_MSI_BIT12 164
187#define OCTEON_IRQ_MSI_BIT13 165
188#define OCTEON_IRQ_MSI_BIT14 166
189#define OCTEON_IRQ_MSI_BIT15 167
190#define OCTEON_IRQ_MSI_BIT16 168
191#define OCTEON_IRQ_MSI_BIT17 169
192#define OCTEON_IRQ_MSI_BIT18 170
193#define OCTEON_IRQ_MSI_BIT19 171
194#define OCTEON_IRQ_MSI_BIT20 172
195#define OCTEON_IRQ_MSI_BIT21 173
196#define OCTEON_IRQ_MSI_BIT22 174
197#define OCTEON_IRQ_MSI_BIT23 175
198#define OCTEON_IRQ_MSI_BIT24 176
199#define OCTEON_IRQ_MSI_BIT25 177
200#define OCTEON_IRQ_MSI_BIT26 178
201#define OCTEON_IRQ_MSI_BIT27 179
202#define OCTEON_IRQ_MSI_BIT28 180
203#define OCTEON_IRQ_MSI_BIT29 181
204#define OCTEON_IRQ_MSI_BIT30 182
205#define OCTEON_IRQ_MSI_BIT31 183
206#define OCTEON_IRQ_MSI_BIT32 184
207#define OCTEON_IRQ_MSI_BIT33 185
208#define OCTEON_IRQ_MSI_BIT34 186
209#define OCTEON_IRQ_MSI_BIT35 187
210#define OCTEON_IRQ_MSI_BIT36 188
211#define OCTEON_IRQ_MSI_BIT37 189
212#define OCTEON_IRQ_MSI_BIT38 190
213#define OCTEON_IRQ_MSI_BIT39 191
214#define OCTEON_IRQ_MSI_BIT40 192
215#define OCTEON_IRQ_MSI_BIT41 193
216#define OCTEON_IRQ_MSI_BIT42 194
217#define OCTEON_IRQ_MSI_BIT43 195
218#define OCTEON_IRQ_MSI_BIT44 196
219#define OCTEON_IRQ_MSI_BIT45 197
220#define OCTEON_IRQ_MSI_BIT46 198
221#define OCTEON_IRQ_MSI_BIT47 199
222#define OCTEON_IRQ_MSI_BIT48 200
223#define OCTEON_IRQ_MSI_BIT49 201
224#define OCTEON_IRQ_MSI_BIT50 202
225#define OCTEON_IRQ_MSI_BIT51 203
226#define OCTEON_IRQ_MSI_BIT52 204
227#define OCTEON_IRQ_MSI_BIT53 205
228#define OCTEON_IRQ_MSI_BIT54 206
229#define OCTEON_IRQ_MSI_BIT55 207
230#define OCTEON_IRQ_MSI_BIT56 208
231#define OCTEON_IRQ_MSI_BIT57 209
232#define OCTEON_IRQ_MSI_BIT58 210
233#define OCTEON_IRQ_MSI_BIT59 211
234#define OCTEON_IRQ_MSI_BIT60 212
235#define OCTEON_IRQ_MSI_BIT61 213
236#define OCTEON_IRQ_MSI_BIT62 214
237#define OCTEON_IRQ_MSI_BIT63 215
238 176
239#define OCTEON_IRQ_LAST 216 177#define OCTEON_IRQ_LAST (OCTEON_IRQ_MSI_LAST + 1)
240#else 178#else
241#define OCTEON_IRQ_LAST 152 179#define OCTEON_IRQ_LAST 152
242#endif 180#endif
diff --git a/arch/mips/include/asm/mach-jz4740/base.h b/arch/mips/include/asm/mach-jz4740/base.h
new file mode 100644
index 000000000000..f37318605452
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/base.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_MACH_JZ4740_BASE_H__
2#define __ASM_MACH_JZ4740_BASE_H__
3
4#define JZ4740_CPM_BASE_ADDR 0x10000000
5#define JZ4740_INTC_BASE_ADDR 0x10001000
6#define JZ4740_WDT_BASE_ADDR 0x10002000
7#define JZ4740_TCU_BASE_ADDR 0x10002010
8#define JZ4740_RTC_BASE_ADDR 0x10003000
9#define JZ4740_GPIO_BASE_ADDR 0x10010000
10#define JZ4740_AIC_BASE_ADDR 0x10020000
11#define JZ4740_MSC_BASE_ADDR 0x10021000
12#define JZ4740_UART0_BASE_ADDR 0x10030000
13#define JZ4740_UART1_BASE_ADDR 0x10031000
14#define JZ4740_I2C_BASE_ADDR 0x10042000
15#define JZ4740_SSI_BASE_ADDR 0x10043000
16#define JZ4740_SADC_BASE_ADDR 0x10070000
17#define JZ4740_EMC_BASE_ADDR 0x13010000
18#define JZ4740_DMAC_BASE_ADDR 0x13020000
19#define JZ4740_UHC_BASE_ADDR 0x13030000
20#define JZ4740_UDC_BASE_ADDR 0x13040000
21#define JZ4740_LCD_BASE_ADDR 0x13050000
22#define JZ4740_SLCD_BASE_ADDR 0x13050000
23#define JZ4740_CIM_BASE_ADDR 0x13060000
24#define JZ4740_IPU_BASE_ADDR 0x13080000
25
26#endif
diff --git a/arch/mips/include/asm/mach-jz4740/clock.h b/arch/mips/include/asm/mach-jz4740/clock.h
new file mode 100644
index 000000000000..1b7408dd0e23
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/clock.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * You should have received a copy of the GNU General Public License along
10 * with this program; if not, write to the Free Software Foundation, Inc.,
11 * 675 Mass Ave, Cambridge, MA 02139, USA.
12 *
13 */
14
15#ifndef __ASM_JZ4740_CLOCK_H__
16#define __ASM_JZ4740_CLOCK_H__
17
18enum jz4740_wait_mode {
19 JZ4740_WAIT_MODE_IDLE,
20 JZ4740_WAIT_MODE_SLEEP,
21};
22
23void jz4740_clock_set_wait_mode(enum jz4740_wait_mode mode);
24
25void jz4740_clock_udc_enable_auto_suspend(void);
26void jz4740_clock_udc_disable_auto_suspend(void);
27
28#endif
diff --git a/arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h b/arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h
new file mode 100644
index 000000000000..d12e5c6477b9
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h
@@ -0,0 +1,51 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 */
7#ifndef __ASM_MACH_JZ4740_CPU_FEATURE_OVERRIDES_H
8#define __ASM_MACH_JZ4740_CPU_FEATURE_OVERRIDES_H
9
10#define cpu_has_tlb 1
11#define cpu_has_4kex 1
12#define cpu_has_3k_cache 0
13#define cpu_has_4k_cache 1
14#define cpu_has_tx39_cache 0
15#define cpu_has_fpu 0
16#define cpu_has_32fpr 0
17#define cpu_has_counter 0
18#define cpu_has_watch 1
19#define cpu_has_divec 1
20#define cpu_has_vce 0
21#define cpu_has_cache_cdex_p 0
22#define cpu_has_cache_cdex_s 0
23#define cpu_has_prefetch 1
24#define cpu_has_mcheck 1
25#define cpu_has_ejtag 1
26#define cpu_has_llsc 1
27#define cpu_has_mips16 0
28#define cpu_has_mdmx 0
29#define cpu_has_mips3d 0
30#define cpu_has_smartmips 0
31#define kernel_uses_llsc 1
32#define cpu_has_vtag_icache 1
33#define cpu_has_dc_aliases 0
34#define cpu_has_ic_fills_f_dc 0
35#define cpu_has_pindexed_dcache 0
36#define cpu_has_mips32r1 1
37#define cpu_has_mips32r2 0
38#define cpu_has_mips64r1 0
39#define cpu_has_mips64r2 0
40#define cpu_has_dsp 0
41#define cpu_has_mipsmt 0
42#define cpu_has_userlocal 0
43#define cpu_has_nofpuex 0
44#define cpu_has_64bits 0
45#define cpu_has_64bit_zero_reg 0
46#define cpu_has_inclusive_pcaches 0
47
48#define cpu_dcache_line_size() 32
49#define cpu_icache_line_size() 32
50
51#endif
diff --git a/arch/mips/include/asm/mach-jz4740/dma.h b/arch/mips/include/asm/mach-jz4740/dma.h
new file mode 100644
index 000000000000..a3be12183599
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/dma.h
@@ -0,0 +1,90 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ7420/JZ4740 DMA definitions
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __ASM_MACH_JZ4740_DMA_H__
17#define __ASM_MACH_JZ4740_DMA_H__
18
19struct jz4740_dma_chan;
20
21enum jz4740_dma_request_type {
22 JZ4740_DMA_TYPE_AUTO_REQUEST = 8,
23 JZ4740_DMA_TYPE_UART_TRANSMIT = 20,
24 JZ4740_DMA_TYPE_UART_RECEIVE = 21,
25 JZ4740_DMA_TYPE_SPI_TRANSMIT = 22,
26 JZ4740_DMA_TYPE_SPI_RECEIVE = 23,
27 JZ4740_DMA_TYPE_AIC_TRANSMIT = 24,
28 JZ4740_DMA_TYPE_AIC_RECEIVE = 25,
29 JZ4740_DMA_TYPE_MMC_TRANSMIT = 26,
30 JZ4740_DMA_TYPE_MMC_RECEIVE = 27,
31 JZ4740_DMA_TYPE_TCU = 28,
32 JZ4740_DMA_TYPE_SADC = 29,
33 JZ4740_DMA_TYPE_SLCD = 30,
34};
35
36enum jz4740_dma_width {
37 JZ4740_DMA_WIDTH_32BIT = 0,
38 JZ4740_DMA_WIDTH_8BIT = 1,
39 JZ4740_DMA_WIDTH_16BIT = 2,
40};
41
42enum jz4740_dma_transfer_size {
43 JZ4740_DMA_TRANSFER_SIZE_4BYTE = 0,
44 JZ4740_DMA_TRANSFER_SIZE_1BYTE = 1,
45 JZ4740_DMA_TRANSFER_SIZE_2BYTE = 2,
46 JZ4740_DMA_TRANSFER_SIZE_16BYTE = 3,
47 JZ4740_DMA_TRANSFER_SIZE_32BYTE = 4,
48};
49
50enum jz4740_dma_flags {
51 JZ4740_DMA_SRC_AUTOINC = 0x2,
52 JZ4740_DMA_DST_AUTOINC = 0x1,
53};
54
55enum jz4740_dma_mode {
56 JZ4740_DMA_MODE_SINGLE = 0,
57 JZ4740_DMA_MODE_BLOCK = 1,
58};
59
60struct jz4740_dma_config {
61 enum jz4740_dma_width src_width;
62 enum jz4740_dma_width dst_width;
63 enum jz4740_dma_transfer_size transfer_size;
64 enum jz4740_dma_request_type request_type;
65 enum jz4740_dma_flags flags;
66 enum jz4740_dma_mode mode;
67};
68
69typedef void (*jz4740_dma_complete_callback_t)(struct jz4740_dma_chan *, int, void *);
70
71struct jz4740_dma_chan *jz4740_dma_request(void *dev, const char *name);
72void jz4740_dma_free(struct jz4740_dma_chan *dma);
73
74void jz4740_dma_configure(struct jz4740_dma_chan *dma,
75 const struct jz4740_dma_config *config);
76
77
78void jz4740_dma_enable(struct jz4740_dma_chan *dma);
79void jz4740_dma_disable(struct jz4740_dma_chan *dma);
80
81void jz4740_dma_set_src_addr(struct jz4740_dma_chan *dma, dma_addr_t src);
82void jz4740_dma_set_dst_addr(struct jz4740_dma_chan *dma, dma_addr_t dst);
83void jz4740_dma_set_transfer_count(struct jz4740_dma_chan *dma, uint32_t count);
84
85uint32_t jz4740_dma_get_residue(const struct jz4740_dma_chan *dma);
86
87void jz4740_dma_set_complete_cb(struct jz4740_dma_chan *dma,
88 jz4740_dma_complete_callback_t cb);
89
90#endif /* __ASM_JZ4740_DMA_H__ */
diff --git a/arch/mips/include/asm/mach-jz4740/gpio.h b/arch/mips/include/asm/mach-jz4740/gpio.h
new file mode 100644
index 000000000000..7b74703745bb
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/gpio.h
@@ -0,0 +1,398 @@
1/*
2 * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 GPIO pin definitions
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef _JZ_GPIO_H
17#define _JZ_GPIO_H
18
19#include <linux/types.h>
20
21enum jz_gpio_function {
22 JZ_GPIO_FUNC_NONE,
23 JZ_GPIO_FUNC1,
24 JZ_GPIO_FUNC2,
25 JZ_GPIO_FUNC3,
26};
27
28
29/*
30 Usually a driver for a SoC component has to request several gpio pins and
31 configure them as funcion pins.
32 jz_gpio_bulk_request can be used to ease this process.
33 Usually one would do something like:
34
35 const static struct jz_gpio_bulk_request i2c_pins[] = {
36 JZ_GPIO_BULK_PIN(I2C_SDA),
37 JZ_GPIO_BULK_PIN(I2C_SCK),
38 };
39
40 inside the probe function:
41
42 ret = jz_gpio_bulk_request(i2c_pins, ARRAY_SIZE(i2c_pins));
43 if (ret) {
44 ...
45
46 inside the remove function:
47
48 jz_gpio_bulk_free(i2c_pins, ARRAY_SIZE(i2c_pins));
49
50
51*/
52struct jz_gpio_bulk_request {
53 int gpio;
54 const char *name;
55 enum jz_gpio_function function;
56};
57
58#define JZ_GPIO_BULK_PIN(pin) { \
59 .gpio = JZ_GPIO_ ## pin, \
60 .name = #pin, \
61 .function = JZ_GPIO_FUNC_ ## pin \
62}
63
64int jz_gpio_bulk_request(const struct jz_gpio_bulk_request *request, size_t num);
65void jz_gpio_bulk_free(const struct jz_gpio_bulk_request *request, size_t num);
66void jz_gpio_bulk_suspend(const struct jz_gpio_bulk_request *request, size_t num);
67void jz_gpio_bulk_resume(const struct jz_gpio_bulk_request *request, size_t num);
68void jz_gpio_enable_pullup(unsigned gpio);
69void jz_gpio_disable_pullup(unsigned gpio);
70int jz_gpio_set_function(int gpio, enum jz_gpio_function function);
71
72int jz_gpio_port_direction_input(int port, uint32_t mask);
73int jz_gpio_port_direction_output(int port, uint32_t mask);
74void jz_gpio_port_set_value(int port, uint32_t value, uint32_t mask);
75uint32_t jz_gpio_port_get_value(int port, uint32_t mask);
76
77#include <asm/mach-generic/gpio.h>
78
79#define JZ_GPIO_PORTA(x) ((x) + 32 * 0)
80#define JZ_GPIO_PORTB(x) ((x) + 32 * 1)
81#define JZ_GPIO_PORTC(x) ((x) + 32 * 2)
82#define JZ_GPIO_PORTD(x) ((x) + 32 * 3)
83
84/* Port A function pins */
85#define JZ_GPIO_MEM_DATA0 JZ_GPIO_PORTA(0)
86#define JZ_GPIO_MEM_DATA1 JZ_GPIO_PORTA(1)
87#define JZ_GPIO_MEM_DATA2 JZ_GPIO_PORTA(2)
88#define JZ_GPIO_MEM_DATA3 JZ_GPIO_PORTA(3)
89#define JZ_GPIO_MEM_DATA4 JZ_GPIO_PORTA(4)
90#define JZ_GPIO_MEM_DATA5 JZ_GPIO_PORTA(5)
91#define JZ_GPIO_MEM_DATA6 JZ_GPIO_PORTA(6)
92#define JZ_GPIO_MEM_DATA7 JZ_GPIO_PORTA(7)
93#define JZ_GPIO_MEM_DATA8 JZ_GPIO_PORTA(8)
94#define JZ_GPIO_MEM_DATA9 JZ_GPIO_PORTA(9)
95#define JZ_GPIO_MEM_DATA10 JZ_GPIO_PORTA(10)
96#define JZ_GPIO_MEM_DATA11 JZ_GPIO_PORTA(11)
97#define JZ_GPIO_MEM_DATA12 JZ_GPIO_PORTA(12)
98#define JZ_GPIO_MEM_DATA13 JZ_GPIO_PORTA(13)
99#define JZ_GPIO_MEM_DATA14 JZ_GPIO_PORTA(14)
100#define JZ_GPIO_MEM_DATA15 JZ_GPIO_PORTA(15)
101#define JZ_GPIO_MEM_DATA16 JZ_GPIO_PORTA(16)
102#define JZ_GPIO_MEM_DATA17 JZ_GPIO_PORTA(17)
103#define JZ_GPIO_MEM_DATA18 JZ_GPIO_PORTA(18)
104#define JZ_GPIO_MEM_DATA19 JZ_GPIO_PORTA(19)
105#define JZ_GPIO_MEM_DATA20 JZ_GPIO_PORTA(20)
106#define JZ_GPIO_MEM_DATA21 JZ_GPIO_PORTA(21)
107#define JZ_GPIO_MEM_DATA22 JZ_GPIO_PORTA(22)
108#define JZ_GPIO_MEM_DATA23 JZ_GPIO_PORTA(23)
109#define JZ_GPIO_MEM_DATA24 JZ_GPIO_PORTA(24)
110#define JZ_GPIO_MEM_DATA25 JZ_GPIO_PORTA(25)
111#define JZ_GPIO_MEM_DATA26 JZ_GPIO_PORTA(26)
112#define JZ_GPIO_MEM_DATA27 JZ_GPIO_PORTA(27)
113#define JZ_GPIO_MEM_DATA28 JZ_GPIO_PORTA(28)
114#define JZ_GPIO_MEM_DATA29 JZ_GPIO_PORTA(29)
115#define JZ_GPIO_MEM_DATA30 JZ_GPIO_PORTA(30)
116#define JZ_GPIO_MEM_DATA31 JZ_GPIO_PORTA(31)
117
118#define JZ_GPIO_FUNC_MEM_DATA0 JZ_GPIO_FUNC1
119#define JZ_GPIO_FUNC_MEM_DATA1 JZ_GPIO_FUNC1
120#define JZ_GPIO_FUNC_MEM_DATA2 JZ_GPIO_FUNC1
121#define JZ_GPIO_FUNC_MEM_DATA3 JZ_GPIO_FUNC1
122#define JZ_GPIO_FUNC_MEM_DATA4 JZ_GPIO_FUNC1
123#define JZ_GPIO_FUNC_MEM_DATA5 JZ_GPIO_FUNC1
124#define JZ_GPIO_FUNC_MEM_DATA6 JZ_GPIO_FUNC1
125#define JZ_GPIO_FUNC_MEM_DATA7 JZ_GPIO_FUNC1
126#define JZ_GPIO_FUNC_MEM_DATA8 JZ_GPIO_FUNC1
127#define JZ_GPIO_FUNC_MEM_DATA9 JZ_GPIO_FUNC1
128#define JZ_GPIO_FUNC_MEM_DATA10 JZ_GPIO_FUNC1
129#define JZ_GPIO_FUNC_MEM_DATA11 JZ_GPIO_FUNC1
130#define JZ_GPIO_FUNC_MEM_DATA12 JZ_GPIO_FUNC1
131#define JZ_GPIO_FUNC_MEM_DATA13 JZ_GPIO_FUNC1
132#define JZ_GPIO_FUNC_MEM_DATA14 JZ_GPIO_FUNC1
133#define JZ_GPIO_FUNC_MEM_DATA15 JZ_GPIO_FUNC1
134#define JZ_GPIO_FUNC_MEM_DATA16 JZ_GPIO_FUNC1
135#define JZ_GPIO_FUNC_MEM_DATA17 JZ_GPIO_FUNC1
136#define JZ_GPIO_FUNC_MEM_DATA18 JZ_GPIO_FUNC1
137#define JZ_GPIO_FUNC_MEM_DATA19 JZ_GPIO_FUNC1
138#define JZ_GPIO_FUNC_MEM_DATA20 JZ_GPIO_FUNC1
139#define JZ_GPIO_FUNC_MEM_DATA21 JZ_GPIO_FUNC1
140#define JZ_GPIO_FUNC_MEM_DATA22 JZ_GPIO_FUNC1
141#define JZ_GPIO_FUNC_MEM_DATA23 JZ_GPIO_FUNC1
142#define JZ_GPIO_FUNC_MEM_DATA24 JZ_GPIO_FUNC1
143#define JZ_GPIO_FUNC_MEM_DATA25 JZ_GPIO_FUNC1
144#define JZ_GPIO_FUNC_MEM_DATA26 JZ_GPIO_FUNC1
145#define JZ_GPIO_FUNC_MEM_DATA27 JZ_GPIO_FUNC1
146#define JZ_GPIO_FUNC_MEM_DATA28 JZ_GPIO_FUNC1
147#define JZ_GPIO_FUNC_MEM_DATA29 JZ_GPIO_FUNC1
148#define JZ_GPIO_FUNC_MEM_DATA30 JZ_GPIO_FUNC1
149#define JZ_GPIO_FUNC_MEM_DATA31 JZ_GPIO_FUNC1
150
151/* Port B function pins */
152#define JZ_GPIO_MEM_ADDR0 JZ_GPIO_PORTB(0)
153#define JZ_GPIO_MEM_ADDR1 JZ_GPIO_PORTB(1)
154#define JZ_GPIO_MEM_ADDR2 JZ_GPIO_PORTB(2)
155#define JZ_GPIO_MEM_ADDR3 JZ_GPIO_PORTB(3)
156#define JZ_GPIO_MEM_ADDR4 JZ_GPIO_PORTB(4)
157#define JZ_GPIO_MEM_ADDR5 JZ_GPIO_PORTB(5)
158#define JZ_GPIO_MEM_ADDR6 JZ_GPIO_PORTB(6)
159#define JZ_GPIO_MEM_ADDR7 JZ_GPIO_PORTB(7)
160#define JZ_GPIO_MEM_ADDR8 JZ_GPIO_PORTB(8)
161#define JZ_GPIO_MEM_ADDR9 JZ_GPIO_PORTB(9)
162#define JZ_GPIO_MEM_ADDR10 JZ_GPIO_PORTB(10)
163#define JZ_GPIO_MEM_ADDR11 JZ_GPIO_PORTB(11)
164#define JZ_GPIO_MEM_ADDR12 JZ_GPIO_PORTB(12)
165#define JZ_GPIO_MEM_ADDR13 JZ_GPIO_PORTB(13)
166#define JZ_GPIO_MEM_ADDR14 JZ_GPIO_PORTB(14)
167#define JZ_GPIO_MEM_ADDR15 JZ_GPIO_PORTB(15)
168#define JZ_GPIO_MEM_ADDR16 JZ_GPIO_PORTB(16)
169#define JZ_GPIO_LCD_CLS JZ_GPIO_PORTB(17)
170#define JZ_GPIO_LCD_SPL JZ_GPIO_PORTB(18)
171#define JZ_GPIO_MEM_DCS JZ_GPIO_PORTB(19)
172#define JZ_GPIO_MEM_RAS JZ_GPIO_PORTB(20)
173#define JZ_GPIO_MEM_CAS JZ_GPIO_PORTB(21)
174#define JZ_GPIO_MEM_SDWE JZ_GPIO_PORTB(22)
175#define JZ_GPIO_MEM_CKE JZ_GPIO_PORTB(23)
176#define JZ_GPIO_MEM_CKO JZ_GPIO_PORTB(24)
177#define JZ_GPIO_MEM_CS0 JZ_GPIO_PORTB(25)
178#define JZ_GPIO_MEM_CS1 JZ_GPIO_PORTB(26)
179#define JZ_GPIO_MEM_CS2 JZ_GPIO_PORTB(27)
180#define JZ_GPIO_MEM_CS3 JZ_GPIO_PORTB(28)
181#define JZ_GPIO_MEM_RD JZ_GPIO_PORTB(29)
182#define JZ_GPIO_MEM_WR JZ_GPIO_PORTB(30)
183#define JZ_GPIO_MEM_WE0 JZ_GPIO_PORTB(31)
184
185#define JZ_GPIO_FUNC_MEM_ADDR0 JZ_GPIO_FUNC1
186#define JZ_GPIO_FUNC_MEM_ADDR1 JZ_GPIO_FUNC1
187#define JZ_GPIO_FUNC_MEM_ADDR2 JZ_GPIO_FUNC1
188#define JZ_GPIO_FUNC_MEM_ADDR3 JZ_GPIO_FUNC1
189#define JZ_GPIO_FUNC_MEM_ADDR4 JZ_GPIO_FUNC1
190#define JZ_GPIO_FUNC_MEM_ADDR5 JZ_GPIO_FUNC1
191#define JZ_GPIO_FUNC_MEM_ADDR6 JZ_GPIO_FUNC1
192#define JZ_GPIO_FUNC_MEM_ADDR7 JZ_GPIO_FUNC1
193#define JZ_GPIO_FUNC_MEM_ADDR8 JZ_GPIO_FUNC1
194#define JZ_GPIO_FUNC_MEM_ADDR9 JZ_GPIO_FUNC1
195#define JZ_GPIO_FUNC_MEM_ADDR10 JZ_GPIO_FUNC1
196#define JZ_GPIO_FUNC_MEM_ADDR11 JZ_GPIO_FUNC1
197#define JZ_GPIO_FUNC_MEM_ADDR12 JZ_GPIO_FUNC1
198#define JZ_GPIO_FUNC_MEM_ADDR13 JZ_GPIO_FUNC1
199#define JZ_GPIO_FUNC_MEM_ADDR14 JZ_GPIO_FUNC1
200#define JZ_GPIO_FUNC_MEM_ADDR15 JZ_GPIO_FUNC1
201#define JZ_GPIO_FUNC_MEM_ADDR16 JZ_GPIO_FUNC1
202#define JZ_GPIO_FUNC_LCD_CLS JZ_GPIO_FUNC1
203#define JZ_GPIO_FUNC_LCD_SPL JZ_GPIO_FUNC1
204#define JZ_GPIO_FUNC_MEM_DCS JZ_GPIO_FUNC1
205#define JZ_GPIO_FUNC_MEM_RAS JZ_GPIO_FUNC1
206#define JZ_GPIO_FUNC_MEM_CAS JZ_GPIO_FUNC1
207#define JZ_GPIO_FUNC_MEM_SDWE JZ_GPIO_FUNC1
208#define JZ_GPIO_FUNC_MEM_CKE JZ_GPIO_FUNC1
209#define JZ_GPIO_FUNC_MEM_CKO JZ_GPIO_FUNC1
210#define JZ_GPIO_FUNC_MEM_CS0 JZ_GPIO_FUNC1
211#define JZ_GPIO_FUNC_MEM_CS1 JZ_GPIO_FUNC1
212#define JZ_GPIO_FUNC_MEM_CS2 JZ_GPIO_FUNC1
213#define JZ_GPIO_FUNC_MEM_CS3 JZ_GPIO_FUNC1
214#define JZ_GPIO_FUNC_MEM_RD JZ_GPIO_FUNC1
215#define JZ_GPIO_FUNC_MEM_WR JZ_GPIO_FUNC1
216#define JZ_GPIO_FUNC_MEM_WE0 JZ_GPIO_FUNC1
217
218
219#define JZ_GPIO_MEM_ADDR21 JZ_GPIO_PORTB(17)
220#define JZ_GPIO_MEM_ADDR22 JZ_GPIO_PORTB(18)
221
222#define JZ_GPIO_FUNC_MEM_ADDR21 JZ_GPIO_FUNC2
223#define JZ_GPIO_FUNC_MEM_ADDR22 JZ_GPIO_FUNC2
224
225/* Port C function pins */
226#define JZ_GPIO_LCD_DATA0 JZ_GPIO_PORTC(0)
227#define JZ_GPIO_LCD_DATA1 JZ_GPIO_PORTC(1)
228#define JZ_GPIO_LCD_DATA2 JZ_GPIO_PORTC(2)
229#define JZ_GPIO_LCD_DATA3 JZ_GPIO_PORTC(3)
230#define JZ_GPIO_LCD_DATA4 JZ_GPIO_PORTC(4)
231#define JZ_GPIO_LCD_DATA5 JZ_GPIO_PORTC(5)
232#define JZ_GPIO_LCD_DATA6 JZ_GPIO_PORTC(6)
233#define JZ_GPIO_LCD_DATA7 JZ_GPIO_PORTC(7)
234#define JZ_GPIO_LCD_DATA8 JZ_GPIO_PORTC(8)
235#define JZ_GPIO_LCD_DATA9 JZ_GPIO_PORTC(9)
236#define JZ_GPIO_LCD_DATA10 JZ_GPIO_PORTC(10)
237#define JZ_GPIO_LCD_DATA11 JZ_GPIO_PORTC(11)
238#define JZ_GPIO_LCD_DATA12 JZ_GPIO_PORTC(12)
239#define JZ_GPIO_LCD_DATA13 JZ_GPIO_PORTC(13)
240#define JZ_GPIO_LCD_DATA14 JZ_GPIO_PORTC(14)
241#define JZ_GPIO_LCD_DATA15 JZ_GPIO_PORTC(15)
242#define JZ_GPIO_LCD_DATA16 JZ_GPIO_PORTC(16)
243#define JZ_GPIO_LCD_DATA17 JZ_GPIO_PORTC(17)
244#define JZ_GPIO_LCD_PCLK JZ_GPIO_PORTC(18)
245#define JZ_GPIO_LCD_HSYNC JZ_GPIO_PORTC(19)
246#define JZ_GPIO_LCD_VSYNC JZ_GPIO_PORTC(20)
247#define JZ_GPIO_LCD_DE JZ_GPIO_PORTC(21)
248#define JZ_GPIO_LCD_PS JZ_GPIO_PORTC(22)
249#define JZ_GPIO_LCD_REV JZ_GPIO_PORTC(23)
250#define JZ_GPIO_MEM_WE1 JZ_GPIO_PORTC(24)
251#define JZ_GPIO_MEM_WE2 JZ_GPIO_PORTC(25)
252#define JZ_GPIO_MEM_WE3 JZ_GPIO_PORTC(26)
253#define JZ_GPIO_MEM_WAIT JZ_GPIO_PORTC(27)
254#define JZ_GPIO_MEM_FRE JZ_GPIO_PORTC(28)
255#define JZ_GPIO_MEM_FWE JZ_GPIO_PORTC(29)
256
257#define JZ_GPIO_FUNC_LCD_DATA0 JZ_GPIO_FUNC1
258#define JZ_GPIO_FUNC_LCD_DATA1 JZ_GPIO_FUNC1
259#define JZ_GPIO_FUNC_LCD_DATA2 JZ_GPIO_FUNC1
260#define JZ_GPIO_FUNC_LCD_DATA3 JZ_GPIO_FUNC1
261#define JZ_GPIO_FUNC_LCD_DATA4 JZ_GPIO_FUNC1
262#define JZ_GPIO_FUNC_LCD_DATA5 JZ_GPIO_FUNC1
263#define JZ_GPIO_FUNC_LCD_DATA6 JZ_GPIO_FUNC1
264#define JZ_GPIO_FUNC_LCD_DATA7 JZ_GPIO_FUNC1
265#define JZ_GPIO_FUNC_LCD_DATA8 JZ_GPIO_FUNC1
266#define JZ_GPIO_FUNC_LCD_DATA9 JZ_GPIO_FUNC1
267#define JZ_GPIO_FUNC_LCD_DATA10 JZ_GPIO_FUNC1
268#define JZ_GPIO_FUNC_LCD_DATA11 JZ_GPIO_FUNC1
269#define JZ_GPIO_FUNC_LCD_DATA12 JZ_GPIO_FUNC1
270#define JZ_GPIO_FUNC_LCD_DATA13 JZ_GPIO_FUNC1
271#define JZ_GPIO_FUNC_LCD_DATA14 JZ_GPIO_FUNC1
272#define JZ_GPIO_FUNC_LCD_DATA15 JZ_GPIO_FUNC1
273#define JZ_GPIO_FUNC_LCD_DATA16 JZ_GPIO_FUNC1
274#define JZ_GPIO_FUNC_LCD_DATA17 JZ_GPIO_FUNC1
275#define JZ_GPIO_FUNC_LCD_PCLK JZ_GPIO_FUNC1
276#define JZ_GPIO_FUNC_LCD_VSYNC JZ_GPIO_FUNC1
277#define JZ_GPIO_FUNC_LCD_HSYNC JZ_GPIO_FUNC1
278#define JZ_GPIO_FUNC_LCD_DE JZ_GPIO_FUNC1
279#define JZ_GPIO_FUNC_LCD_PS JZ_GPIO_FUNC1
280#define JZ_GPIO_FUNC_LCD_REV JZ_GPIO_FUNC1
281#define JZ_GPIO_FUNC_MEM_WE1 JZ_GPIO_FUNC1
282#define JZ_GPIO_FUNC_MEM_WE2 JZ_GPIO_FUNC1
283#define JZ_GPIO_FUNC_MEM_WE3 JZ_GPIO_FUNC1
284#define JZ_GPIO_FUNC_MEM_WAIT JZ_GPIO_FUNC1
285#define JZ_GPIO_FUNC_MEM_FRE JZ_GPIO_FUNC1
286#define JZ_GPIO_FUNC_MEM_FWE JZ_GPIO_FUNC1
287
288
289#define JZ_GPIO_MEM_ADDR19 JZ_GPIO_PORTB(22)
290#define JZ_GPIO_MEM_ADDR20 JZ_GPIO_PORTB(23)
291
292#define JZ_GPIO_FUNC_MEM_ADDR19 JZ_GPIO_FUNC2
293#define JZ_GPIO_FUNC_MEM_ADDR20 JZ_GPIO_FUNC2
294
295/* Port D function pins */
296#define JZ_GPIO_CIM_DATA0 JZ_GPIO_PORTD(0)
297#define JZ_GPIO_CIM_DATA1 JZ_GPIO_PORTD(1)
298#define JZ_GPIO_CIM_DATA2 JZ_GPIO_PORTD(2)
299#define JZ_GPIO_CIM_DATA3 JZ_GPIO_PORTD(3)
300#define JZ_GPIO_CIM_DATA4 JZ_GPIO_PORTD(4)
301#define JZ_GPIO_CIM_DATA5 JZ_GPIO_PORTD(5)
302#define JZ_GPIO_CIM_DATA6 JZ_GPIO_PORTD(6)
303#define JZ_GPIO_CIM_DATA7 JZ_GPIO_PORTD(7)
304#define JZ_GPIO_MSC_CMD JZ_GPIO_PORTD(8)
305#define JZ_GPIO_MSC_CLK JZ_GPIO_PORTD(9)
306#define JZ_GPIO_MSC_DATA0 JZ_GPIO_PORTD(10)
307#define JZ_GPIO_MSC_DATA1 JZ_GPIO_PORTD(11)
308#define JZ_GPIO_MSC_DATA2 JZ_GPIO_PORTD(12)
309#define JZ_GPIO_MSC_DATA3 JZ_GPIO_PORTD(13)
310#define JZ_GPIO_CIM_MCLK JZ_GPIO_PORTD(14)
311#define JZ_GPIO_CIM_PCLK JZ_GPIO_PORTD(15)
312#define JZ_GPIO_CIM_VSYNC JZ_GPIO_PORTD(16)
313#define JZ_GPIO_CIM_HSYNC JZ_GPIO_PORTD(17)
314#define JZ_GPIO_SPI_CLK JZ_GPIO_PORTD(18)
315#define JZ_GPIO_SPI_CE0 JZ_GPIO_PORTD(19)
316#define JZ_GPIO_SPI_DT JZ_GPIO_PORTD(20)
317#define JZ_GPIO_SPI_DR JZ_GPIO_PORTD(21)
318#define JZ_GPIO_SPI_CE1 JZ_GPIO_PORTD(22)
319#define JZ_GPIO_PWM0 JZ_GPIO_PORTD(23)
320#define JZ_GPIO_PWM1 JZ_GPIO_PORTD(24)
321#define JZ_GPIO_PWM2 JZ_GPIO_PORTD(25)
322#define JZ_GPIO_PWM3 JZ_GPIO_PORTD(26)
323#define JZ_GPIO_PWM4 JZ_GPIO_PORTD(27)
324#define JZ_GPIO_PWM5 JZ_GPIO_PORTD(28)
325#define JZ_GPIO_PWM6 JZ_GPIO_PORTD(30)
326#define JZ_GPIO_PWM7 JZ_GPIO_PORTD(31)
327
328#define JZ_GPIO_FUNC_CIM_DATA JZ_GPIO_FUNC1
329#define JZ_GPIO_FUNC_CIM_DATA0 JZ_GPIO_FUNC_CIM_DATA
330#define JZ_GPIO_FUNC_CIM_DATA1 JZ_GPIO_FUNC_CIM_DATA
331#define JZ_GPIO_FUNC_CIM_DATA2 JZ_GPIO_FUNC_CIM_DATA
332#define JZ_GPIO_FUNC_CIM_DATA3 JZ_GPIO_FUNC_CIM_DATA
333#define JZ_GPIO_FUNC_CIM_DATA4 JZ_GPIO_FUNC_CIM_DATA
334#define JZ_GPIO_FUNC_CIM_DATA5 JZ_GPIO_FUNC_CIM_DATA
335#define JZ_GPIO_FUNC_CIM_DATA6 JZ_GPIO_FUNC_CIM_DATA
336#define JZ_GPIO_FUNC_CIM_DATA7 JZ_GPIO_FUNC_CIM_DATA
337#define JZ_GPIO_FUNC_MSC_CMD JZ_GPIO_FUNC1
338#define JZ_GPIO_FUNC_MSC_CLK JZ_GPIO_FUNC1
339#define JZ_GPIO_FUNC_MSC_DATA JZ_GPIO_FUNC1
340#define JZ_GPIO_FUNC_MSC_DATA0 JZ_GPIO_FUNC_MSC_DATA
341#define JZ_GPIO_FUNC_MSC_DATA1 JZ_GPIO_FUNC_MSC_DATA
342#define JZ_GPIO_FUNC_MSC_DATA2 JZ_GPIO_FUNC_MSC_DATA
343#define JZ_GPIO_FUNC_MSC_DATA3 JZ_GPIO_FUNC_MSC_DATA
344#define JZ_GPIO_FUNC_CIM_MCLK JZ_GPIO_FUNC1
345#define JZ_GPIO_FUNC_CIM_PCLK JZ_GPIO_FUNC1
346#define JZ_GPIO_FUNC_CIM_VSYNC JZ_GPIO_FUNC1
347#define JZ_GPIO_FUNC_CIM_HSYNC JZ_GPIO_FUNC1
348#define JZ_GPIO_FUNC_SPI_CLK JZ_GPIO_FUNC1
349#define JZ_GPIO_FUNC_SPI_CE0 JZ_GPIO_FUNC1
350#define JZ_GPIO_FUNC_SPI_DT JZ_GPIO_FUNC1
351#define JZ_GPIO_FUNC_SPI_DR JZ_GPIO_FUNC1
352#define JZ_GPIO_FUNC_SPI_CE1 JZ_GPIO_FUNC1
353
354#define JZ_GPIO_FUNC_PWM JZ_GPIO_FUNC1
355#define JZ_GPIO_FUNC_PWM0 JZ_GPIO_FUNC_PWM
356#define JZ_GPIO_FUNC_PWM1 JZ_GPIO_FUNC_PWM
357#define JZ_GPIO_FUNC_PWM2 JZ_GPIO_FUNC_PWM
358#define JZ_GPIO_FUNC_PWM3 JZ_GPIO_FUNC_PWM
359#define JZ_GPIO_FUNC_PWM4 JZ_GPIO_FUNC_PWM
360#define JZ_GPIO_FUNC_PWM5 JZ_GPIO_FUNC_PWM
361#define JZ_GPIO_FUNC_PWM6 JZ_GPIO_FUNC_PWM
362#define JZ_GPIO_FUNC_PWM7 JZ_GPIO_FUNC_PWM
363
364#define JZ_GPIO_MEM_SCLK_RSTN JZ_GPIO_PORTD(18)
365#define JZ_GPIO_MEM_BCLK JZ_GPIO_PORTD(19)
366#define JZ_GPIO_MEM_SDATO JZ_GPIO_PORTD(20)
367#define JZ_GPIO_MEM_SDATI JZ_GPIO_PORTD(21)
368#define JZ_GPIO_MEM_SYNC JZ_GPIO_PORTD(22)
369#define JZ_GPIO_I2C_SDA JZ_GPIO_PORTD(23)
370#define JZ_GPIO_I2C_SCK JZ_GPIO_PORTD(24)
371#define JZ_GPIO_UART0_TXD JZ_GPIO_PORTD(25)
372#define JZ_GPIO_UART0_RXD JZ_GPIO_PORTD(26)
373#define JZ_GPIO_MEM_ADDR17 JZ_GPIO_PORTD(27)
374#define JZ_GPIO_MEM_ADDR18 JZ_GPIO_PORTD(28)
375#define JZ_GPIO_UART0_CTS JZ_GPIO_PORTD(30)
376#define JZ_GPIO_UART0_RTS JZ_GPIO_PORTD(31)
377
378#define JZ_GPIO_FUNC_MEM_SCLK_RSTN JZ_GPIO_FUNC2
379#define JZ_GPIO_FUNC_MEM_BCLK JZ_GPIO_FUNC2
380#define JZ_GPIO_FUNC_MEM_SDATO JZ_GPIO_FUNC2
381#define JZ_GPIO_FUNC_MEM_SDATI JZ_GPIO_FUNC2
382#define JZ_GPIO_FUNC_MEM_SYNC JZ_GPIO_FUNC2
383#define JZ_GPIO_FUNC_I2C_SDA JZ_GPIO_FUNC2
384#define JZ_GPIO_FUNC_I2C_SCK JZ_GPIO_FUNC2
385#define JZ_GPIO_FUNC_UART0_TXD JZ_GPIO_FUNC2
386#define JZ_GPIO_FUNC_UART0_RXD JZ_GPIO_FUNC2
387#define JZ_GPIO_FUNC_MEM_ADDR17 JZ_GPIO_FUNC2
388#define JZ_GPIO_FUNC_MEM_ADDR18 JZ_GPIO_FUNC2
389#define JZ_GPIO_FUNC_UART0_CTS JZ_GPIO_FUNC2
390#define JZ_GPIO_FUNC_UART0_RTS JZ_GPIO_FUNC2
391
392#define JZ_GPIO_UART1_RXD JZ_GPIO_PORTD(30)
393#define JZ_GPIO_UART1_TXD JZ_GPIO_PORTD(31)
394
395#define JZ_GPIO_FUNC_UART1_RXD JZ_GPIO_FUNC3
396#define JZ_GPIO_FUNC_UART1_TXD JZ_GPIO_FUNC3
397
398#endif
diff --git a/arch/mips/include/asm/mach-jz4740/irq.h b/arch/mips/include/asm/mach-jz4740/irq.h
new file mode 100644
index 000000000000..a865c983c70a
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/irq.h
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 IRQ definitions
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __ASM_MACH_JZ4740_IRQ_H__
17#define __ASM_MACH_JZ4740_IRQ_H__
18
19#define MIPS_CPU_IRQ_BASE 0
20#define JZ4740_IRQ_BASE 8
21
22/* 1st-level interrupts */
23#define JZ4740_IRQ(x) (JZ4740_IRQ_BASE + (x))
24#define JZ4740_IRQ_I2C JZ4740_IRQ(1)
25#define JZ4740_IRQ_UHC JZ4740_IRQ(3)
26#define JZ4740_IRQ_UART1 JZ4740_IRQ(8)
27#define JZ4740_IRQ_UART0 JZ4740_IRQ(9)
28#define JZ4740_IRQ_SADC JZ4740_IRQ(12)
29#define JZ4740_IRQ_MSC JZ4740_IRQ(14)
30#define JZ4740_IRQ_RTC JZ4740_IRQ(15)
31#define JZ4740_IRQ_SSI JZ4740_IRQ(16)
32#define JZ4740_IRQ_CIM JZ4740_IRQ(17)
33#define JZ4740_IRQ_AIC JZ4740_IRQ(18)
34#define JZ4740_IRQ_ETH JZ4740_IRQ(19)
35#define JZ4740_IRQ_DMAC JZ4740_IRQ(20)
36#define JZ4740_IRQ_TCU2 JZ4740_IRQ(21)
37#define JZ4740_IRQ_TCU1 JZ4740_IRQ(22)
38#define JZ4740_IRQ_TCU0 JZ4740_IRQ(23)
39#define JZ4740_IRQ_UDC JZ4740_IRQ(24)
40#define JZ4740_IRQ_GPIO3 JZ4740_IRQ(25)
41#define JZ4740_IRQ_GPIO2 JZ4740_IRQ(26)
42#define JZ4740_IRQ_GPIO1 JZ4740_IRQ(27)
43#define JZ4740_IRQ_GPIO0 JZ4740_IRQ(28)
44#define JZ4740_IRQ_IPU JZ4740_IRQ(29)
45#define JZ4740_IRQ_LCD JZ4740_IRQ(30)
46
47/* 2nd-level interrupts */
48#define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(32) + (X))
49
50#define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x))
51#define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(48) + (x))
52
53#define JZ4740_IRQ_ADC_BASE JZ4740_IRQ(176)
54
55#define NR_IRQS (JZ4740_IRQ_ADC_BASE + 6)
56
57#endif
diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_fb.h b/arch/mips/include/asm/mach-jz4740/jz4740_fb.h
new file mode 100644
index 000000000000..6a50e6f7a21a
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/jz4740_fb.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * You should have received a copy of the GNU General Public License along
10 * with this program; if not, write to the Free Software Foundation, Inc.,
11 * 675 Mass Ave, Cambridge, MA 02139, USA.
12 *
13 */
14
15#ifndef __ASM_MACH_JZ4740_JZ4740_FB_H__
16#define __ASM_MACH_JZ4740_JZ4740_FB_H__
17
18#include <linux/fb.h>
19
20enum jz4740_fb_lcd_type {
21 JZ_LCD_TYPE_GENERIC_16_BIT = 0,
22 JZ_LCD_TYPE_GENERIC_18_BIT = 0 | (1 << 4),
23 JZ_LCD_TYPE_SPECIAL_TFT_1 = 1,
24 JZ_LCD_TYPE_SPECIAL_TFT_2 = 2,
25 JZ_LCD_TYPE_SPECIAL_TFT_3 = 3,
26 JZ_LCD_TYPE_NON_INTERLACED_CCIR656 = 5,
27 JZ_LCD_TYPE_INTERLACED_CCIR656 = 7,
28 JZ_LCD_TYPE_SINGLE_COLOR_STN = 8,
29 JZ_LCD_TYPE_SINGLE_MONOCHROME_STN = 9,
30 JZ_LCD_TYPE_DUAL_COLOR_STN = 10,
31 JZ_LCD_TYPE_DUAL_MONOCHROME_STN = 11,
32 JZ_LCD_TYPE_8BIT_SERIAL = 12,
33};
34
35#define JZ4740_FB_SPECIAL_TFT_CONFIG(start, stop) (((start) << 16) | (stop))
36
37/*
38* width: width of the lcd display in mm
39* height: height of the lcd display in mm
40* num_modes: size of modes
41* modes: list of valid video modes
42* bpp: bits per pixel for the lcd
43* lcd_type: lcd type
44*/
45
46struct jz4740_fb_platform_data {
47 unsigned int width;
48 unsigned int height;
49
50 size_t num_modes;
51 struct fb_videomode *modes;
52
53 unsigned int bpp;
54 enum jz4740_fb_lcd_type lcd_type;
55
56 struct {
57 uint32_t spl;
58 uint32_t cls;
59 uint32_t ps;
60 uint32_t rev;
61 } special_tft_config;
62
63 unsigned pixclk_falling_edge:1;
64 unsigned date_enable_active_low:1;
65};
66
67#endif
diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_mmc.h b/arch/mips/include/asm/mach-jz4740/jz4740_mmc.h
new file mode 100644
index 000000000000..8543f432b4b3
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/jz4740_mmc.h
@@ -0,0 +1,15 @@
1#ifndef __LINUX_MMC_JZ4740_MMC
2#define __LINUX_MMC_JZ4740_MMC
3
4struct jz4740_mmc_platform_data {
5 int gpio_power;
6 int gpio_card_detect;
7 int gpio_read_only;
8 unsigned card_detect_active_low:1;
9 unsigned read_only_active_low:1;
10 unsigned power_active_low:1;
11
12 unsigned data_1bit:1;
13};
14
15#endif
diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_nand.h b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h
new file mode 100644
index 000000000000..bb5b9a4e29c8
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC NAND controller driver
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __ASM_MACH_JZ4740_JZ4740_NAND_H__
17#define __ASM_MACH_JZ4740_JZ4740_NAND_H__
18
19#include <linux/mtd/nand.h>
20#include <linux/mtd/partitions.h>
21
22struct jz_nand_platform_data {
23 int num_partitions;
24 struct mtd_partition *partitions;
25
26 struct nand_ecclayout *ecc_layout;
27
28 unsigned int busy_gpio;
29
30 void (*ident_callback)(struct platform_device *, struct nand_chip *,
31 struct mtd_partition **, int *num_partitions);
32};
33
34#endif
diff --git a/arch/mips/include/asm/mach-jz4740/platform.h b/arch/mips/include/asm/mach-jz4740/platform.h
new file mode 100644
index 000000000000..8987a76e9676
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/platform.h
@@ -0,0 +1,36 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform device definitions
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16
17#ifndef __JZ4740_PLATFORM_H
18#define __JZ4740_PLATFORM_H
19
20#include <linux/platform_device.h>
21
22extern struct platform_device jz4740_usb_ohci_device;
23extern struct platform_device jz4740_udc_device;
24extern struct platform_device jz4740_mmc_device;
25extern struct platform_device jz4740_rtc_device;
26extern struct platform_device jz4740_i2c_device;
27extern struct platform_device jz4740_nand_device;
28extern struct platform_device jz4740_framebuffer_device;
29extern struct platform_device jz4740_i2s_device;
30extern struct platform_device jz4740_pcm_device;
31extern struct platform_device jz4740_codec_device;
32extern struct platform_device jz4740_adc_device;
33
34void jz4740_serial_device_register(void);
35
36#endif
diff --git a/arch/mips/include/asm/mach-jz4740/timer.h b/arch/mips/include/asm/mach-jz4740/timer.h
new file mode 100644
index 000000000000..9baa03ce748c
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/timer.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform timer support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __ASM_MACH_JZ4740_TIMER
17#define __ASM_MACH_JZ4740_TIMER
18
19void jz4740_timer_enable_watchdog(void);
20void jz4740_timer_disable_watchdog(void);
21
22#endif
diff --git a/arch/mips/include/asm/mach-jz4740/war.h b/arch/mips/include/asm/mach-jz4740/war.h
new file mode 100644
index 000000000000..3a5bc17e28fe
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/war.h
@@ -0,0 +1,25 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_JZ4740_WAR_H
9#define __ASM_MIPS_MACH_JZ4740_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_JZ4740_WAR_H */
diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson/loongson.h
index fcdbe3a4ce1f..cb6985f24303 100644
--- a/arch/mips/include/asm/mach-loongson/loongson.h
+++ b/arch/mips/include/asm/mach-loongson/loongson.h
@@ -45,7 +45,6 @@ static inline void prom_init_uart_base(void)
45/* irq operation functions */ 45/* irq operation functions */
46extern void bonito_irqdispatch(void); 46extern void bonito_irqdispatch(void);
47extern void __init bonito_irq_init(void); 47extern void __init bonito_irq_init(void);
48extern void __init set_irq_trigger_mode(void);
49extern void __init mach_init_irq(void); 48extern void __init mach_init_irq(void);
50extern void mach_irq_dispatch(unsigned int pending); 49extern void mach_irq_dispatch(unsigned int pending);
51extern int mach_i8259_irq(void); 50extern int mach_i8259_irq(void);
@@ -63,6 +62,14 @@ extern int mach_i8259_irq(void);
63#define LOONGSON_IRQ_BASE 32 62#define LOONGSON_IRQ_BASE 32
64#define LOONGSON2_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */ 63#define LOONGSON2_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */
65 64
65#include <linux/interrupt.h>
66static inline void do_perfcnt_IRQ(void)
67{
68#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
69 do_IRQ(LOONGSON2_PERFCNT_IRQ);
70#endif
71}
72
66#define LOONGSON_FLASH_BASE 0x1c000000 73#define LOONGSON_FLASH_BASE 0x1c000000
67#define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */ 74#define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */
68#define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1) 75#define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1)
diff --git a/arch/mips/include/asm/mach-pb1x00/pb1550.h b/arch/mips/include/asm/mach-pb1x00/pb1550.h
index 58796410bd6e..fc4d766641ce 100644
--- a/arch/mips/include/asm/mach-pb1x00/pb1550.h
+++ b/arch/mips/include/asm/mach-pb1x00/pb1550.h
@@ -40,14 +40,6 @@
40#define SMBUS_PSC_BASE PSC2_BASE_ADDR 40#define SMBUS_PSC_BASE PSC2_BASE_ADDR
41#define I2S_PSC_BASE PSC3_BASE_ADDR 41#define I2S_PSC_BASE PSC3_BASE_ADDR
42 42
43#if defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
44#define PB1550_BOTH_BANKS
45#elif defined(CONFIG_MTD_PB1550_BOOT) && !defined(CONFIG_MTD_PB1550_USER)
46#define PB1550_BOOT_ONLY
47#elif !defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
48#define PB1550_USER_ONLY
49#endif
50
51/* 43/*
52 * Timing values as described in databook, * ns value stripped of 44 * Timing values as described in databook, * ns value stripped of
53 * lower 2 bits. 45 * lower 2 bits.
diff --git a/arch/mips/include/asm/mach-powertv/asic.h b/arch/mips/include/asm/mach-powertv/asic.h
index bcad43a93ebf..c7077a64b9a7 100644
--- a/arch/mips/include/asm/mach-powertv/asic.h
+++ b/arch/mips/include/asm/mach-powertv/asic.h
@@ -20,6 +20,7 @@
20#define _ASM_MACH_POWERTV_ASIC_H 20#define _ASM_MACH_POWERTV_ASIC_H
21 21
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/platform_device.h>
23#include <asm/mach-powertv/asic_regs.h> 24#include <asm/mach-powertv/asic_regs.h>
24 25
25#define DVR_CAPABLE (1<<0) 26#define DVR_CAPABLE (1<<0)
@@ -40,19 +41,23 @@ enum family_type {
40 FAMILY_8600VZB, 41 FAMILY_8600VZB,
41 FAMILY_1500VZE, 42 FAMILY_1500VZE,
42 FAMILY_1500VZF, 43 FAMILY_1500VZF,
44 FAMILY_8700,
43 FAMILIES 45 FAMILIES
44}; 46};
45 47
46/* Register maps for each ASIC */ 48/* Register maps for each ASIC */
47extern const struct register_map calliope_register_map; 49extern const struct register_map calliope_register_map;
48extern const struct register_map cronus_register_map; 50extern const struct register_map cronus_register_map;
51extern const struct register_map gaia_register_map;
49extern const struct register_map zeus_register_map; 52extern const struct register_map zeus_register_map;
50 53
51extern struct resource dvr_cronus_resources[]; 54extern struct resource dvr_cronus_resources[];
55extern struct resource dvr_gaia_resources[];
52extern struct resource dvr_zeus_resources[]; 56extern struct resource dvr_zeus_resources[];
53extern struct resource non_dvr_calliope_resources[]; 57extern struct resource non_dvr_calliope_resources[];
54extern struct resource non_dvr_cronus_resources[]; 58extern struct resource non_dvr_cronus_resources[];
55extern struct resource non_dvr_cronuslite_resources[]; 59extern struct resource non_dvr_cronuslite_resources[];
60extern struct resource non_dvr_gaia_resources[];
56extern struct resource non_dvr_vz_calliope_resources[]; 61extern struct resource non_dvr_vz_calliope_resources[];
57extern struct resource non_dvr_vze_calliope_resources[]; 62extern struct resource non_dvr_vze_calliope_resources[];
58extern struct resource non_dvr_vzf_calliope_resources[]; 63extern struct resource non_dvr_vzf_calliope_resources[];
@@ -67,16 +72,24 @@ extern int platform_supports_ffs(void);
67extern int platform_supports_pcie(void); 72extern int platform_supports_pcie(void);
68extern int platform_supports_display(void); 73extern int platform_supports_display(void);
69extern void configure_platform(void); 74extern void configure_platform(void);
70extern void platform_configure_usb_ehci(void);
71extern void platform_unconfigure_usb_ehci(void);
72extern void platform_configure_usb_ohci(void);
73extern void platform_unconfigure_usb_ohci(void);
74 75
75/* Platform Resources */ 76/* Platform Resources */
76#define ASIC_RESOURCE_GET_EXISTS 1 77#define ASIC_RESOURCE_GET_EXISTS 1
77extern struct resource *asic_resource_get(const char *name); 78extern struct resource *asic_resource_get(const char *name);
78extern void platform_release_memory(void *baddr, int size); 79extern void platform_release_memory(void *baddr, int size);
79 80
81/* USB configuration */
82struct usb_hcd; /* Forward reference */
83extern void platform_configure_usb_ehci(void);
84extern void platform_unconfigure_usb_ehci(void);
85extern void platform_configure_usb_ohci(void);
86extern void platform_unconfigure_usb_ohci(void);
87
88/* Resource for ASIC registers */
89extern struct resource asic_resource;
90extern int platform_usb_devices_init(struct platform_device **echi_dev,
91 struct platform_device **ohci_dev);
92
80/* Reboot Cause */ 93/* Reboot Cause */
81extern void set_reboot_cause(char code, unsigned int data, unsigned int data2); 94extern void set_reboot_cause(char code, unsigned int data, unsigned int data2);
82extern void set_locked_reboot_cause(char code, unsigned int data, 95extern void set_locked_reboot_cause(char code, unsigned int data,
diff --git a/arch/mips/include/asm/mach-powertv/asic_reg_map.h b/arch/mips/include/asm/mach-powertv/asic_reg_map.h
index 6f26cb09828e..20348e817b09 100644
--- a/arch/mips/include/asm/mach-powertv/asic_reg_map.h
+++ b/arch/mips/include/asm/mach-powertv/asic_reg_map.h
@@ -64,7 +64,7 @@ REGISTER_MAP_ELEMENT(int_level_0_1)
64REGISTER_MAP_ELEMENT(int_level_0_0) 64REGISTER_MAP_ELEMENT(int_level_0_0)
65REGISTER_MAP_ELEMENT(int_docsis_en) 65REGISTER_MAP_ELEMENT(int_docsis_en)
66REGISTER_MAP_ELEMENT(mips_pll_setup) 66REGISTER_MAP_ELEMENT(mips_pll_setup)
67REGISTER_MAP_ELEMENT(usb_fs) 67REGISTER_MAP_ELEMENT(fs432x4b4_usb_ctl)
68REGISTER_MAP_ELEMENT(test_bus) 68REGISTER_MAP_ELEMENT(test_bus)
69REGISTER_MAP_ELEMENT(crt_spare) 69REGISTER_MAP_ELEMENT(crt_spare)
70REGISTER_MAP_ELEMENT(usb2_ohci_int_mask) 70REGISTER_MAP_ELEMENT(usb2_ohci_int_mask)
diff --git a/arch/mips/include/asm/mach-powertv/asic_regs.h b/arch/mips/include/asm/mach-powertv/asic_regs.h
index 1e11236c6dbc..deecb26a077e 100644
--- a/arch/mips/include/asm/mach-powertv/asic_regs.h
+++ b/arch/mips/include/asm/mach-powertv/asic_regs.h
@@ -27,7 +27,8 @@ enum asic_type {
27 ASIC_CALLIOPE, 27 ASIC_CALLIOPE,
28 ASIC_CRONUS, 28 ASIC_CRONUS,
29 ASIC_CRONUSLITE, 29 ASIC_CRONUSLITE,
30 ASICS 30 ASIC_GAIA,
31 ASICS /* Number of supported ASICs */
31}; 32};
32 33
33/* hardcoded values read from Chip Version registers */ 34/* hardcoded values read from Chip Version registers */
@@ -37,6 +38,7 @@ enum asic_type {
37 38
38#define NAND_FLASH_BASE 0x03000000 39#define NAND_FLASH_BASE 0x03000000
39#define CALLIOPE_IO_BASE 0x08000000 40#define CALLIOPE_IO_BASE 0x08000000
41#define GAIA_IO_BASE 0x09000000
40#define CRONUS_IO_BASE 0x09000000 42#define CRONUS_IO_BASE 0x09000000
41#define ZEUS_IO_BASE 0x09000000 43#define ZEUS_IO_BASE 0x09000000
42 44
@@ -99,6 +101,7 @@ static inline void register_map_virtualize(struct register_map *map)
99} 101}
100 102
101extern struct register_map _asic_register_map; 103extern struct register_map _asic_register_map;
104extern unsigned long asic_phy_base;
102 105
103/* 106/*
104 * Macros to interface to registers through their ioremapped address 107 * Macros to interface to registers through their ioremapped address
diff --git a/arch/mips/include/asm/mach-powertv/dma-coherence.h b/arch/mips/include/asm/mach-powertv/dma-coherence.h
index 5b8d5ebeb838..f76029c2406e 100644
--- a/arch/mips/include/asm/mach-powertv/dma-coherence.h
+++ b/arch/mips/include/asm/mach-powertv/dma-coherence.h
@@ -65,21 +65,21 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
65 size_t size) 65 size_t size)
66{ 66{
67 if (is_kseg2(addr)) 67 if (is_kseg2(addr))
68 return phys_to_bus(virt_to_phys_from_pte(addr)); 68 return phys_to_dma(virt_to_phys_from_pte(addr));
69 else 69 else
70 return phys_to_bus(virt_to_phys(addr)); 70 return phys_to_dma(virt_to_phys(addr));
71} 71}
72 72
73static inline dma_addr_t plat_map_dma_mem_page(struct device *dev, 73static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
74 struct page *page) 74 struct page *page)
75{ 75{
76 return phys_to_bus(page_to_phys(page)); 76 return phys_to_dma(page_to_phys(page));
77} 77}
78 78
79static inline unsigned long plat_dma_addr_to_phys(struct device *dev, 79static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
80 dma_addr_t dma_addr) 80 dma_addr_t dma_addr)
81{ 81{
82 return bus_to_phys(dma_addr); 82 return dma_to_phys(dma_addr);
83} 83}
84 84
85static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, 85static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
diff --git a/arch/mips/include/asm/mach-powertv/ioremap.h b/arch/mips/include/asm/mach-powertv/ioremap.h
index e6276d5146e8..076f2eeaa575 100644
--- a/arch/mips/include/asm/mach-powertv/ioremap.h
+++ b/arch/mips/include/asm/mach-powertv/ioremap.h
@@ -10,64 +10,101 @@
10#define __ASM_MACH_POWERTV_IOREMAP_H 10#define __ASM_MACH_POWERTV_IOREMAP_H
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/log2.h>
14#include <linux/compiler.h>
13 15
14#define LOW_MEM_BOUNDARY_PHYS 0x20000000 16#include <asm/pgtable-bits.h>
15#define LOW_MEM_BOUNDARY_MASK (~(LOW_MEM_BOUNDARY_PHYS - 1)) 17#include <asm/addrspace.h>
18
19/* We're going to mess with bits, so get sizes */
20#define IOR_BPC 8 /* Bits per char */
21#define IOR_PHYS_BITS (IOR_BPC * sizeof(phys_addr_t))
22#define IOR_DMA_BITS (IOR_BPC * sizeof(dma_addr_t))
16 23
17/* 24/*
18 * The bus addresses are different than the physical addresses that 25 * Define the granularity of physical/DMA mapping in terms of the number
19 * the processor sees by an offset. This offset varies by ASIC 26 * of bits that defines the offset within a grain. These will be the
20 * version. Define a variable to hold the offset and some macros to 27 * least significant bits of the address. The rest of a physical or DMA
21 * make the conversion simpler. */ 28 * address will be used to index into an appropriate table to find the
22extern unsigned long phys_to_bus_offset; 29 * offset to add to the address to yield the corresponding DMA or physical
23 30 * address, respectively.
24#ifdef CONFIG_HIGHMEM 31 */
25#define MEM_GAP_PHYS 0x60000000 32#define IOR_LSBITS 22 /* Bits in a grain */
33
26/* 34/*
27 * TODO: We will use the hard code for conversion between physical and 35 * Compute the number of most significant address bits after removing those
28 * bus until the bootloader releases their device tree to us. 36 * used for the offset within a grain and then compute the number of table
37 * entries for the conversion.
29 */ 38 */
30#define phys_to_bus(x) (((x) < LOW_MEM_BOUNDARY_PHYS) ? \ 39#define IOR_PHYS_MSBITS (IOR_PHYS_BITS - IOR_LSBITS)
31 ((x) + phys_to_bus_offset) : (x)) 40#define IOR_NUM_PHYS_TO_DMA ((phys_addr_t) 1 << IOR_PHYS_MSBITS)
32#define bus_to_phys(x) (((x) < MEM_GAP_PHYS_ADDR) ? \ 41
33 ((x) - phys_to_bus_offset) : (x)) 42#define IOR_DMA_MSBITS (IOR_DMA_BITS - IOR_LSBITS)
34#else 43#define IOR_NUM_DMA_TO_PHYS ((dma_addr_t) 1 << IOR_DMA_MSBITS)
35#define phys_to_bus(x) ((x) + phys_to_bus_offset)
36#define bus_to_phys(x) ((x) - phys_to_bus_offset)
37#endif
38 44
39/* 45/*
40 * Determine whether the address we are given is for an ASIC device 46 * Define data structures used as elements in the arrays for the conversion
41 * Params: addr Address to check 47 * between physical and DMA addresses. We do some slightly fancy math to
42 * Returns: Zero if the address is not for ASIC devices, non-zero 48 * compute the width of the offset element of the conversion tables so
43 * if it is. 49 * that we can have the smallest conversion tables. Next, round up the
50 * sizes to the next higher power of two, i.e. the offset element will have
51 * 8, 16, 32, 64, etc. bits. This eliminates the need to mask off any
52 * bits. Finally, we compute a shift value that puts the most significant
53 * bits of the offset into the most significant bits of the offset element.
54 * This makes it more efficient on processors without barrel shifters and
55 * easier to see the values if the conversion table is dumped in binary.
44 */ 56 */
45static inline int asic_is_device_addr(phys_t addr) 57#define _IOR_OFFSET_WIDTH(n) (1 << order_base_2(n))
58#define IOR_OFFSET_WIDTH(n) \
59 (_IOR_OFFSET_WIDTH(n) < 8 ? 8 : _IOR_OFFSET_WIDTH(n))
60
61#define IOR_PHYS_OFFSET_BITS IOR_OFFSET_WIDTH(IOR_PHYS_MSBITS)
62#define IOR_PHYS_SHIFT (IOR_PHYS_BITS - IOR_PHYS_OFFSET_BITS)
63
64#define IOR_DMA_OFFSET_BITS IOR_OFFSET_WIDTH(IOR_DMA_MSBITS)
65#define IOR_DMA_SHIFT (IOR_DMA_BITS - IOR_DMA_OFFSET_BITS)
66
67struct ior_phys_to_dma {
68 dma_addr_t offset:IOR_DMA_OFFSET_BITS __packed
69 __aligned((IOR_DMA_OFFSET_BITS / IOR_BPC));
70};
71
72struct ior_dma_to_phys {
73 dma_addr_t offset:IOR_PHYS_OFFSET_BITS __packed
74 __aligned((IOR_PHYS_OFFSET_BITS / IOR_BPC));
75};
76
77extern struct ior_phys_to_dma _ior_phys_to_dma[IOR_NUM_PHYS_TO_DMA];
78extern struct ior_dma_to_phys _ior_dma_to_phys[IOR_NUM_DMA_TO_PHYS];
79
80static inline dma_addr_t _phys_to_dma_offset_raw(phys_addr_t phys)
46{ 81{
47 return !((phys_t)addr & (phys_t) LOW_MEM_BOUNDARY_MASK); 82 return (dma_addr_t)_ior_phys_to_dma[phys >> IOR_LSBITS].offset;
48} 83}
49 84
50/* 85static inline dma_addr_t _dma_to_phys_offset_raw(dma_addr_t dma)
51 * Determine whether the address we are given is external RAM mappable
52 * into KSEG1.
53 * Params: addr Address to check
54 * Returns: Zero if the address is not for external RAM and
55 */
56static inline int asic_is_lowmem_ram_addr(phys_t addr)
57{ 86{
58 /* 87 return (dma_addr_t)_ior_dma_to_phys[dma >> IOR_LSBITS].offset;
59 * The RAM always starts at the following address in the processor's 88}
60 * physical address space
61 */
62 static const phys_t phys_ram_base = 0x10000000;
63 phys_t bus_ram_base;
64 89
65 bus_ram_base = phys_to_bus_offset + phys_ram_base; 90/* These are not portable and should not be used in drivers. Drivers should
91 * be using ioremap() and friends to map physical addreses to virtual
92 * addresses and dma_map*() and friends to map virtual addresses into DMA
93 * addresses and back.
94 */
95static inline dma_addr_t phys_to_dma(phys_addr_t phys)
96{
97 return phys + (_phys_to_dma_offset_raw(phys) << IOR_PHYS_SHIFT);
98}
66 99
67 return addr >= bus_ram_base && 100static inline phys_addr_t dma_to_phys(dma_addr_t dma)
68 addr < (bus_ram_base + (LOW_MEM_BOUNDARY_PHYS - phys_ram_base)); 101{
102 return dma + (_dma_to_phys_offset_raw(dma) << IOR_DMA_SHIFT);
69} 103}
70 104
105extern void ioremap_add_map(dma_addr_t phys, phys_addr_t alias,
106 dma_addr_t size);
107
71/* 108/*
72 * Allow physical addresses to be fixed up to help peripherals located 109 * Allow physical addresses to be fixed up to help peripherals located
73 * outside the low 32-bit range -- generic pass-through version. 110 * outside the low 32-bit range -- generic pass-through version.
@@ -77,10 +114,50 @@ static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
77 return phys_addr; 114 return phys_addr;
78} 115}
79 116
80static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size, 117/*
118 * Handle the special case of addresses the area aliased into the first
119 * 512 MiB of the processor's physical address space. These turn into either
120 * kseg0 or kseg1 addresses, depending on flags.
121 */
122static inline void __iomem *plat_ioremap(phys_t start, unsigned long size,
81 unsigned long flags) 123 unsigned long flags)
82{ 124{
83 return NULL; 125 phys_addr_t start_offset;
126 void __iomem *result = NULL;
127
128 /* Start by checking to see whether this is an aliased address */
129 start_offset = _dma_to_phys_offset_raw(start);
130
131 /*
132 * If:
133 * o the memory is aliased into the first 512 MiB, and
134 * o the start and end are in the same RAM bank, and
135 * o we don't have a zero size or wrap around, and
136 * o we are supposed to create an uncached mapping,
137 * handle this is a kseg0 or kseg1 address
138 */
139 if (start_offset != 0) {
140 phys_addr_t last;
141 dma_addr_t dma_to_phys_offset;
142
143 last = start + size - 1;
144 dma_to_phys_offset =
145 _dma_to_phys_offset_raw(last) << IOR_DMA_SHIFT;
146
147 if (dma_to_phys_offset == start_offset &&
148 size != 0 && start <= last) {
149 phys_t adjusted_start;
150 adjusted_start = start + start_offset;
151 if (flags == _CACHE_UNCACHED)
152 result = (void __iomem *) (unsigned long)
153 CKSEG1ADDR(adjusted_start);
154 else
155 result = (void __iomem *) (unsigned long)
156 CKSEG0ADDR(adjusted_start);
157 }
158 }
159
160 return result;
84} 161}
85 162
86static inline int plat_iounmap(const volatile void __iomem *addr) 163static inline int plat_iounmap(const volatile void __iomem *addr)
diff --git a/arch/mips/include/asm/mach-tx49xx/kmalloc.h b/arch/mips/include/asm/mach-tx49xx/kmalloc.h
index 913ff196259d..b74caf65482b 100644
--- a/arch/mips/include/asm/mach-tx49xx/kmalloc.h
+++ b/arch/mips/include/asm/mach-tx49xx/kmalloc.h
@@ -1,8 +1,6 @@
1#ifndef __ASM_MACH_TX49XX_KMALLOC_H 1#ifndef __ASM_MACH_TX49XX_KMALLOC_H
2#define __ASM_MACH_TX49XX_KMALLOC_H 2#define __ASM_MACH_TX49XX_KMALLOC_H
3 3
4/* 4#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
5 * All happy, no need to define ARCH_KMALLOC_MINALIGN
6 */
7 5
8#endif /* __ASM_MACH_TX49XX_KMALLOC_H */ 6#endif /* __ASM_MACH_TX49XX_KMALLOC_H */
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index c6e3c93ce7c7..335474c155f6 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -408,6 +408,7 @@
408#define STATUSB_IP15 7 408#define STATUSB_IP15 7
409#define STATUSF_IP15 (_ULCAST_(1) << 7) 409#define STATUSF_IP15 (_ULCAST_(1) << 7)
410#define ST0_CH 0x00040000 410#define ST0_CH 0x00040000
411#define ST0_NMI 0x00080000
411#define ST0_SR 0x00100000 412#define ST0_SR 0x00100000
412#define ST0_TS 0x00200000 413#define ST0_TS 0x00200000
413#define ST0_BEV 0x00400000 414#define ST0_BEV 0x00400000
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h
index ca6214b5ccb9..917a6c413b1a 100644
--- a/arch/mips/include/asm/octeon/octeon.h
+++ b/arch/mips/include/asm/octeon/octeon.h
@@ -50,6 +50,7 @@ extern void octeon_crypto_disable(struct octeon_cop2_state *state,
50extern asmlinkage void octeon_cop2_restore(struct octeon_cop2_state *task); 50extern asmlinkage void octeon_cop2_restore(struct octeon_cop2_state *task);
51 51
52extern void octeon_init_cvmcount(void); 52extern void octeon_init_cvmcount(void);
53extern void octeon_setup_delays(void);
53 54
54#define OCTEON_ARGV_MAX_ARGS 64 55#define OCTEON_ARGV_MAX_ARGS 64
55#define OCTOEN_SERIAL_LEN 20 56#define OCTOEN_SERIAL_LEN 20
@@ -253,4 +254,6 @@ static inline uint32_t octeon_npi_read32(uint64_t address)
253 254
254extern struct cvmx_bootinfo *octeon_bootinfo; 255extern struct cvmx_bootinfo *octeon_bootinfo;
255 256
257extern uint64_t octeon_bootloader_entry_addr;
258
256#endif /* __ASM_OCTEON_OCTEON_H */ 259#endif /* __ASM_OCTEON_OCTEON_H */
diff --git a/arch/mips/include/asm/octeon/pci-octeon.h b/arch/mips/include/asm/octeon/pci-octeon.h
index 6ac5d3e3398e..ece78043acf6 100644
--- a/arch/mips/include/asm/octeon/pci-octeon.h
+++ b/arch/mips/include/asm/octeon/pci-octeon.h
@@ -15,6 +15,19 @@
15#define PCI_CONFIG_SPACE_DELAY 10000 15#define PCI_CONFIG_SPACE_DELAY 10000
16 16
17/* 17/*
18 * The physical memory base mapped by BAR1. 256MB at the end of the
19 * first 4GB.
20 */
21#define CVMX_PCIE_BAR1_PHYS_BASE ((1ull << 32) - (1ull << 28))
22#define CVMX_PCIE_BAR1_PHYS_SIZE (1ull << 28)
23
24/*
25 * The RC base of BAR1. gen1 has a 39-bit BAR2, gen2 has 41-bit BAR2,
26 * place BAR1 so it is the same for both.
27 */
28#define CVMX_PCIE_BAR1_RC_BASE (1ull << 41)
29
30/*
18 * pcibios_map_irq() is defined inside pci-octeon.c. All it does is 31 * pcibios_map_irq() is defined inside pci-octeon.c. All it does is
19 * call the Octeon specific version pointed to by this variable. This 32 * call the Octeon specific version pointed to by this variable. This
20 * function needs to change for PCI or PCIe based hosts. 33 * function needs to change for PCI or PCIe based hosts.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 3beea1479b43..576397c69920 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -140,6 +140,11 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
140 return channel ? 15 : 14; 140 return channel ? 15 : 14;
141} 141}
142 142
143#ifdef CONFIG_CPU_CAVIUM_OCTEON
144/* MSI arch hook for OCTEON */
145#define arch_setup_msi_irqs arch_setup_msi_irqs
146#endif
147
143extern int pci_probe_only; 148extern int pci_probe_only;
144 149
145extern char * (*pcibios_plat_setup)(char *str); 150extern char * (*pcibios_plat_setup)(char *str);
diff --git a/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h b/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h
index 54ef1a96d7ce..786d82daf8d6 100644
--- a/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h
+++ b/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h
@@ -124,10 +124,6 @@ extern void prom_meminit(void);
124extern void prom_fixup_mem_map(unsigned long start_mem, 124extern void prom_fixup_mem_map(unsigned long start_mem,
125 unsigned long end_mem); 125 unsigned long end_mem);
126 126
127#ifdef CONFIG_MTD_PMC_MSP_RAMROOT
128extern bool get_ramroot(void **start, unsigned long *size);
129#endif
130
131extern int get_ethernet_addr(char *ethaddr_name, char *ethernet_addr); 127extern int get_ethernet_addr(char *ethaddr_name, char *ethernet_addr);
132extern unsigned long get_deviceid(void); 128extern unsigned long get_deviceid(void);
133extern char identify_enet(unsigned long interface_num); 129extern char identify_enet(unsigned long interface_num);
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
index 5d33b727acf5..0d629bb93cbe 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -34,6 +34,11 @@ extern void (*cpu_wait)(void);
34extern unsigned int vced_count, vcei_count; 34extern unsigned int vced_count, vcei_count;
35 35
36/* 36/*
37 * MIPS does have an arch_pick_mmap_layout()
38 */
39#define HAVE_ARCH_PICK_MMAP_LAYOUT 1
40
41/*
37 * A special page (the vdso) is mapped into all processes at the very 42 * A special page (the vdso) is mapped into all processes at the very
38 * top of the virtual memory space. 43 * top of the virtual memory space.
39 */ 44 */
@@ -52,6 +57,9 @@ extern unsigned int vced_count, vcei_count;
52 * space during mmap's. 57 * space during mmap's.
53 */ 58 */
54#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE)) 59#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE))
60
61#define TASK_IS_32BIT_ADDR 1
62
55#endif 63#endif
56 64
57#ifdef CONFIG_64BIT 65#ifdef CONFIG_64BIT
@@ -77,6 +85,9 @@ extern unsigned int vced_count, vcei_count;
77 PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3)) 85 PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3))
78#define TASK_SIZE_OF(tsk) \ 86#define TASK_SIZE_OF(tsk) \
79 (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE) 87 (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE)
88
89#define TASK_IS_32BIT_ADDR test_thread_flag(TIF_32BIT_ADDR)
90
80#endif 91#endif
81 92
82#ifdef __KERNEL__ 93#ifdef __KERNEL__
@@ -218,7 +229,6 @@ struct thread_struct {
218 unsigned long cp0_badvaddr; /* Last user fault */ 229 unsigned long cp0_badvaddr; /* Last user fault */
219 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */ 230 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
220 unsigned long error_code; 231 unsigned long error_code;
221 unsigned long trap_no;
222 unsigned long irix_trampoline; /* Wheee... */ 232 unsigned long irix_trampoline; /* Wheee... */
223 unsigned long irix_oldctx; 233 unsigned long irix_oldctx;
224#ifdef CONFIG_CPU_CAVIUM_OCTEON 234#ifdef CONFIG_CPU_CAVIUM_OCTEON
@@ -290,7 +300,6 @@ struct thread_struct {
290 .cp0_badvaddr = 0, \ 300 .cp0_badvaddr = 0, \
291 .cp0_baduaddr = 0, \ 301 .cp0_baduaddr = 0, \
292 .error_code = 0, \ 302 .error_code = 0, \
293 .trap_no = 0, \
294 .irix_trampoline = 0, \ 303 .irix_trampoline = 0, \
295 .irix_oldctx = 0, \ 304 .irix_oldctx = 0, \
296 /* \ 305 /* \
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index cdc6a46efd98..9f1b8dba2c81 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -137,6 +137,7 @@ extern int ptrace_set_watch_regs(struct task_struct *child,
137 */ 137 */
138#define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER) 138#define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER)
139 139
140#define regs_return_value(_regs) ((_regs)->regs[2])
140#define instruction_pointer(regs) ((regs)->cp0_epc) 141#define instruction_pointer(regs) ((regs)->cp0_epc)
141#define profile_pc(regs) instruction_pointer(regs) 142#define profile_pc(regs) instruction_pointer(regs)
142 143
diff --git a/arch/mips/include/asm/sn/agent.h b/arch/mips/include/asm/sn/agent.h
index ac4ea85c3a5c..dc81114d4742 100644
--- a/arch/mips/include/asm/sn/agent.h
+++ b/arch/mips/include/asm/sn/agent.h
@@ -11,7 +11,6 @@
11#ifndef _ASM_SGI_SN_AGENT_H 11#ifndef _ASM_SGI_SN_AGENT_H
12#define _ASM_SGI_SN_AGENT_H 12#define _ASM_SGI_SN_AGENT_H
13 13
14#include <linux/topology.h>
15#include <asm/sn/addrs.h> 14#include <asm/sn/addrs.h>
16#include <asm/sn/arch.h> 15#include <asm/sn/arch.h>
17 16
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
index 697e40c06497..892062d6d748 100644
--- a/arch/mips/include/asm/uasm.h
+++ b/arch/mips/include/asm/uasm.h
@@ -10,44 +10,55 @@
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12 12
13#ifdef CONFIG_EXPORT_UASM
14#include <linux/module.h>
15#define __uasminit
16#define __uasminitdata
17#define UASM_EXPORT_SYMBOL(sym) EXPORT_SYMBOL(sym)
18#else
19#define __uasminit __cpuinit
20#define __uasminitdata __cpuinitdata
21#define UASM_EXPORT_SYMBOL(sym)
22#endif
23
13#define Ip_u1u2u3(op) \ 24#define Ip_u1u2u3(op) \
14void __cpuinit \ 25void __uasminit \
15uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 26uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
16 27
17#define Ip_u2u1u3(op) \ 28#define Ip_u2u1u3(op) \
18void __cpuinit \ 29void __uasminit \
19uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 30uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
20 31
21#define Ip_u3u1u2(op) \ 32#define Ip_u3u1u2(op) \
22void __cpuinit \ 33void __uasminit \
23uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 34uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
24 35
25#define Ip_u1u2s3(op) \ 36#define Ip_u1u2s3(op) \
26void __cpuinit \ 37void __uasminit \
27uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) 38uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)
28 39
29#define Ip_u2s3u1(op) \ 40#define Ip_u2s3u1(op) \
30void __cpuinit \ 41void __uasminit \
31uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c) 42uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c)
32 43
33#define Ip_u2u1s3(op) \ 44#define Ip_u2u1s3(op) \
34void __cpuinit \ 45void __uasminit \
35uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) 46uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)
36 47
37#define Ip_u2u1msbu3(op) \ 48#define Ip_u2u1msbu3(op) \
38void __cpuinit \ 49void __uasminit \
39uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \ 50uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
40 unsigned int d) 51 unsigned int d)
41 52
42#define Ip_u1u2(op) \ 53#define Ip_u1u2(op) \
43void __cpuinit uasm_i##op(u32 **buf, unsigned int a, unsigned int b) 54void __uasminit uasm_i##op(u32 **buf, unsigned int a, unsigned int b)
44 55
45#define Ip_u1s2(op) \ 56#define Ip_u1s2(op) \
46void __cpuinit uasm_i##op(u32 **buf, unsigned int a, signed int b) 57void __uasminit uasm_i##op(u32 **buf, unsigned int a, signed int b)
47 58
48#define Ip_u1(op) void __cpuinit uasm_i##op(u32 **buf, unsigned int a) 59#define Ip_u1(op) void __uasminit uasm_i##op(u32 **buf, unsigned int a)
49 60
50#define Ip_0(op) void __cpuinit uasm_i##op(u32 **buf) 61#define Ip_0(op) void __uasminit uasm_i##op(u32 **buf)
51 62
52Ip_u2u1s3(_addiu); 63Ip_u2u1s3(_addiu);
53Ip_u3u1u2(_addu); 64Ip_u3u1u2(_addu);
@@ -71,6 +82,7 @@ Ip_u2u1u3(_dsra);
71Ip_u2u1u3(_dsrl); 82Ip_u2u1u3(_dsrl);
72Ip_u2u1u3(_dsrl32); 83Ip_u2u1u3(_dsrl32);
73Ip_u2u1u3(_drotr); 84Ip_u2u1u3(_drotr);
85Ip_u2u1u3(_drotr32);
74Ip_u3u1u2(_dsubu); 86Ip_u3u1u2(_dsubu);
75Ip_0(_eret); 87Ip_0(_eret);
76Ip_u1(_j); 88Ip_u1(_j);
@@ -111,7 +123,7 @@ struct uasm_label {
111 int lab; 123 int lab;
112}; 124};
113 125
114void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid); 126void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid);
115#ifdef CONFIG_64BIT 127#ifdef CONFIG_64BIT
116int uasm_in_compat_space_p(long addr); 128int uasm_in_compat_space_p(long addr);
117#endif 129#endif
@@ -121,7 +133,7 @@ void UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr);
121void UASM_i_LA(u32 **buf, unsigned int rs, long addr); 133void UASM_i_LA(u32 **buf, unsigned int rs, long addr);
122 134
123#define UASM_L_LA(lb) \ 135#define UASM_L_LA(lb) \
124static inline void __cpuinit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ 136static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
125{ \ 137{ \
126 uasm_build_label(lab, addr, label##lb); \ 138 uasm_build_label(lab, addr, label##lb); \
127} 139}
@@ -176,6 +188,15 @@ static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1,
176 uasm_i_dsrl32(p, a1, a2, a3 - 32); 188 uasm_i_dsrl32(p, a1, a2, a3 - 32);
177} 189}
178 190
191static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1,
192 unsigned int a2, unsigned int a3)
193{
194 if (a3 < 32)
195 uasm_i_drotr(p, a1, a2, a3);
196 else
197 uasm_i_drotr32(p, a1, a2, a3 - 32);
198}
199
179static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1, 200static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1,
180 unsigned int a2, unsigned int a3) 201 unsigned int a2, unsigned int a3)
181{ 202{
@@ -213,3 +234,7 @@ void uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1,
213void uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 234void uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
214void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 235void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
215void uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 236void uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
237void uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg,
238 unsigned int bit, int lid);
239void uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg,
240 unsigned int bit, int lid);