aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/cache.h2
-rw-r--r--arch/mips/include/asm/cpu-info.h1
-rw-r--r--arch/mips/include/asm/inst.h14
-rw-r--r--arch/mips/include/asm/jump_label.h48
-rw-r--r--arch/mips/include/asm/mach-ath79/ar71xx_regs.h233
-rw-r--r--arch/mips/include/asm/mach-ath79/ath79.h96
-rw-r--r--arch/mips/include/asm/mach-ath79/ath79_spi_platform.h23
-rw-r--r--arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h56
-rw-r--r--arch/mips/include/asm/mach-ath79/gpio.h26
-rw-r--r--arch/mips/include/asm/mach-ath79/irq.h36
-rw-r--r--arch/mips/include/asm/mach-ath79/kernel-entry-init.h32
-rw-r--r--arch/mips/include/asm/mach-ath79/war.h25
-rw-r--r--arch/mips/include/asm/mips_machine.h54
-rw-r--r--arch/mips/include/asm/mmu_context.h8
-rw-r--r--arch/mips/include/asm/uasm.h7
15 files changed, 654 insertions, 7 deletions
diff --git a/arch/mips/include/asm/cache.h b/arch/mips/include/asm/cache.h
index 37f175c42bb..650ac9ba734 100644
--- a/arch/mips/include/asm/cache.h
+++ b/arch/mips/include/asm/cache.h
@@ -17,4 +17,6 @@
17#define SMP_CACHE_SHIFT L1_CACHE_SHIFT 17#define SMP_CACHE_SHIFT L1_CACHE_SHIFT
18#define SMP_CACHE_BYTES L1_CACHE_BYTES 18#define SMP_CACHE_BYTES L1_CACHE_BYTES
19 19
20#define __read_mostly __attribute__((__section__(".data.read_mostly")))
21
20#endif /* _ASM_CACHE_H */ 22#endif /* _ASM_CACHE_H */
diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h
index b39def3f6e0..c454550eb0c 100644
--- a/arch/mips/include/asm/cpu-info.h
+++ b/arch/mips/include/asm/cpu-info.h
@@ -78,6 +78,7 @@ struct cpuinfo_mips {
78 unsigned int watch_reg_use_cnt; /* Usable by ptrace */ 78 unsigned int watch_reg_use_cnt; /* Usable by ptrace */
79#define NUM_WATCH_REGS 4 79#define NUM_WATCH_REGS 4
80 u16 watch_reg_masks[NUM_WATCH_REGS]; 80 u16 watch_reg_masks[NUM_WATCH_REGS];
81 unsigned int kscratch_mask; /* Usable KScratch mask. */
81} __attribute__((aligned(SMP_CACHE_BYTES))); 82} __attribute__((aligned(SMP_CACHE_BYTES)));
82 83
83extern struct cpuinfo_mips cpu_data[]; 84extern struct cpuinfo_mips cpu_data[];
diff --git a/arch/mips/include/asm/inst.h b/arch/mips/include/asm/inst.h
index 444ff71aa0e..7ebfc392e58 100644
--- a/arch/mips/include/asm/inst.h
+++ b/arch/mips/include/asm/inst.h
@@ -72,6 +72,7 @@ enum spec2_op {
72enum spec3_op { 72enum spec3_op {
73 ext_op, dextm_op, dextu_op, dext_op, 73 ext_op, dextm_op, dextu_op, dext_op,
74 ins_op, dinsm_op, dinsu_op, dins_op, 74 ins_op, dinsm_op, dinsu_op, dins_op,
75 lx_op = 0x0a,
75 bshfl_op = 0x20, 76 bshfl_op = 0x20,
76 dbshfl_op = 0x24, 77 dbshfl_op = 0x24,
77 rdhwr_op = 0x3b 78 rdhwr_op = 0x3b
@@ -179,6 +180,19 @@ enum mad_func {
179}; 180};
180 181
181/* 182/*
183 * func field for special3 lx opcodes (Cavium Octeon).
184 */
185enum lx_func {
186 lwx_op = 0x00,
187 lhx_op = 0x04,
188 lbux_op = 0x06,
189 ldx_op = 0x08,
190 lwux_op = 0x10,
191 lhux_op = 0x14,
192 lbx_op = 0x16,
193};
194
195/*
182 * Damn ... bitfields depend from byteorder :-( 196 * Damn ... bitfields depend from byteorder :-(
183 */ 197 */
184#ifdef __MIPSEB__ 198#ifdef __MIPSEB__
diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h
new file mode 100644
index 00000000000..7622ccf7507
--- /dev/null
+++ b/arch/mips/include/asm/jump_label.h
@@ -0,0 +1,48 @@
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) 2010 Cavium Networks, Inc.
7 */
8#ifndef _ASM_MIPS_JUMP_LABEL_H
9#define _ASM_MIPS_JUMP_LABEL_H
10
11#include <linux/types.h>
12
13#ifdef __KERNEL__
14
15#define JUMP_LABEL_NOP_SIZE 4
16
17#ifdef CONFIG_64BIT
18#define WORD_INSN ".dword"
19#else
20#define WORD_INSN ".word"
21#endif
22
23#define JUMP_LABEL(key, label) \
24 do { \
25 asm goto("1:\tnop\n\t" \
26 "nop\n\t" \
27 ".pushsection __jump_table, \"a\"\n\t" \
28 WORD_INSN " 1b, %l[" #label "], %0\n\t" \
29 ".popsection\n\t" \
30 : : "i" (key) : : label); \
31 } while (0)
32
33
34#endif /* __KERNEL__ */
35
36#ifdef CONFIG_64BIT
37typedef u64 jump_label_t;
38#else
39typedef u32 jump_label_t;
40#endif
41
42struct jump_entry {
43 jump_label_t code;
44 jump_label_t target;
45 jump_label_t key;
46};
47
48#endif /* _ASM_MIPS_JUMP_LABEL_H */
diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
new file mode 100644
index 00000000000..cda1c8070b2
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
@@ -0,0 +1,233 @@
1/*
2 * Atheros AR71XX/AR724X/AR913X SoC register definitions
3 *
4 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * Parts of this file are based on Atheros' 2.6.15 BSP
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 */
13
14#ifndef __ASM_MACH_AR71XX_REGS_H
15#define __ASM_MACH_AR71XX_REGS_H
16
17#include <linux/types.h>
18#include <linux/init.h>
19#include <linux/io.h>
20#include <linux/bitops.h>
21
22#define AR71XX_APB_BASE 0x18000000
23#define AR71XX_SPI_BASE 0x1f000000
24#define AR71XX_SPI_SIZE 0x01000000
25
26#define AR71XX_DDR_CTRL_BASE (AR71XX_APB_BASE + 0x00000000)
27#define AR71XX_DDR_CTRL_SIZE 0x100
28#define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000)
29#define AR71XX_UART_SIZE 0x100
30#define AR71XX_GPIO_BASE (AR71XX_APB_BASE + 0x00040000)
31#define AR71XX_GPIO_SIZE 0x100
32#define AR71XX_PLL_BASE (AR71XX_APB_BASE + 0x00050000)
33#define AR71XX_PLL_SIZE 0x100
34#define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000)
35#define AR71XX_RESET_SIZE 0x100
36
37#define AR913X_WMAC_BASE (AR71XX_APB_BASE + 0x000C0000)
38#define AR913X_WMAC_SIZE 0x30000
39
40/*
41 * DDR_CTRL block
42 */
43#define AR71XX_DDR_REG_PCI_WIN0 0x7c
44#define AR71XX_DDR_REG_PCI_WIN1 0x80
45#define AR71XX_DDR_REG_PCI_WIN2 0x84
46#define AR71XX_DDR_REG_PCI_WIN3 0x88
47#define AR71XX_DDR_REG_PCI_WIN4 0x8c
48#define AR71XX_DDR_REG_PCI_WIN5 0x90
49#define AR71XX_DDR_REG_PCI_WIN6 0x94
50#define AR71XX_DDR_REG_PCI_WIN7 0x98
51#define AR71XX_DDR_REG_FLUSH_GE0 0x9c
52#define AR71XX_DDR_REG_FLUSH_GE1 0xa0
53#define AR71XX_DDR_REG_FLUSH_USB 0xa4
54#define AR71XX_DDR_REG_FLUSH_PCI 0xa8
55
56#define AR724X_DDR_REG_FLUSH_GE0 0x7c
57#define AR724X_DDR_REG_FLUSH_GE1 0x80
58#define AR724X_DDR_REG_FLUSH_USB 0x84
59#define AR724X_DDR_REG_FLUSH_PCIE 0x88
60
61#define AR913X_DDR_REG_FLUSH_GE0 0x7c
62#define AR913X_DDR_REG_FLUSH_GE1 0x80
63#define AR913X_DDR_REG_FLUSH_USB 0x84
64#define AR913X_DDR_REG_FLUSH_WMAC 0x88
65
66/*
67 * PLL block
68 */
69#define AR71XX_PLL_REG_CPU_CONFIG 0x00
70#define AR71XX_PLL_REG_SEC_CONFIG 0x04
71#define AR71XX_PLL_REG_ETH0_INT_CLOCK 0x10
72#define AR71XX_PLL_REG_ETH1_INT_CLOCK 0x14
73
74#define AR71XX_PLL_DIV_SHIFT 3
75#define AR71XX_PLL_DIV_MASK 0x1f
76#define AR71XX_CPU_DIV_SHIFT 16
77#define AR71XX_CPU_DIV_MASK 0x3
78#define AR71XX_DDR_DIV_SHIFT 18
79#define AR71XX_DDR_DIV_MASK 0x3
80#define AR71XX_AHB_DIV_SHIFT 20
81#define AR71XX_AHB_DIV_MASK 0x7
82
83#define AR724X_PLL_REG_CPU_CONFIG 0x00
84#define AR724X_PLL_REG_PCIE_CONFIG 0x18
85
86#define AR724X_PLL_DIV_SHIFT 0
87#define AR724X_PLL_DIV_MASK 0x3ff
88#define AR724X_PLL_REF_DIV_SHIFT 10
89#define AR724X_PLL_REF_DIV_MASK 0xf
90#define AR724X_AHB_DIV_SHIFT 19
91#define AR724X_AHB_DIV_MASK 0x1
92#define AR724X_DDR_DIV_SHIFT 22
93#define AR724X_DDR_DIV_MASK 0x3
94
95#define AR913X_PLL_REG_CPU_CONFIG 0x00
96#define AR913X_PLL_REG_ETH_CONFIG 0x04
97#define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14
98#define AR913X_PLL_REG_ETH1_INT_CLOCK 0x18
99
100#define AR913X_PLL_DIV_SHIFT 0
101#define AR913X_PLL_DIV_MASK 0x3ff
102#define AR913X_DDR_DIV_SHIFT 22
103#define AR913X_DDR_DIV_MASK 0x3
104#define AR913X_AHB_DIV_SHIFT 19
105#define AR913X_AHB_DIV_MASK 0x1
106
107/*
108 * RESET block
109 */
110#define AR71XX_RESET_REG_TIMER 0x00
111#define AR71XX_RESET_REG_TIMER_RELOAD 0x04
112#define AR71XX_RESET_REG_WDOG_CTRL 0x08
113#define AR71XX_RESET_REG_WDOG 0x0c
114#define AR71XX_RESET_REG_MISC_INT_STATUS 0x10
115#define AR71XX_RESET_REG_MISC_INT_ENABLE 0x14
116#define AR71XX_RESET_REG_PCI_INT_STATUS 0x18
117#define AR71XX_RESET_REG_PCI_INT_ENABLE 0x1c
118#define AR71XX_RESET_REG_GLOBAL_INT_STATUS 0x20
119#define AR71XX_RESET_REG_RESET_MODULE 0x24
120#define AR71XX_RESET_REG_PERFC_CTRL 0x2c
121#define AR71XX_RESET_REG_PERFC0 0x30
122#define AR71XX_RESET_REG_PERFC1 0x34
123#define AR71XX_RESET_REG_REV_ID 0x90
124
125#define AR913X_RESET_REG_GLOBAL_INT_STATUS 0x18
126#define AR913X_RESET_REG_RESET_MODULE 0x1c
127#define AR913X_RESET_REG_PERF_CTRL 0x20
128#define AR913X_RESET_REG_PERFC0 0x24
129#define AR913X_RESET_REG_PERFC1 0x28
130
131#define AR724X_RESET_REG_RESET_MODULE 0x1c
132
133#define MISC_INT_DMA BIT(7)
134#define MISC_INT_OHCI BIT(6)
135#define MISC_INT_PERFC BIT(5)
136#define MISC_INT_WDOG BIT(4)
137#define MISC_INT_UART BIT(3)
138#define MISC_INT_GPIO BIT(2)
139#define MISC_INT_ERROR BIT(1)
140#define MISC_INT_TIMER BIT(0)
141
142#define AR71XX_RESET_EXTERNAL BIT(28)
143#define AR71XX_RESET_FULL_CHIP BIT(24)
144#define AR71XX_RESET_CPU_NMI BIT(21)
145#define AR71XX_RESET_CPU_COLD BIT(20)
146#define AR71XX_RESET_DMA BIT(19)
147#define AR71XX_RESET_SLIC BIT(18)
148#define AR71XX_RESET_STEREO BIT(17)
149#define AR71XX_RESET_DDR BIT(16)
150#define AR71XX_RESET_GE1_MAC BIT(13)
151#define AR71XX_RESET_GE1_PHY BIT(12)
152#define AR71XX_RESET_USBSUS_OVERRIDE BIT(10)
153#define AR71XX_RESET_GE0_MAC BIT(9)
154#define AR71XX_RESET_GE0_PHY BIT(8)
155#define AR71XX_RESET_USB_OHCI_DLL BIT(6)
156#define AR71XX_RESET_USB_HOST BIT(5)
157#define AR71XX_RESET_USB_PHY BIT(4)
158#define AR71XX_RESET_PCI_BUS BIT(1)
159#define AR71XX_RESET_PCI_CORE BIT(0)
160
161#define AR724X_RESET_GE1_MDIO BIT(23)
162#define AR724X_RESET_GE0_MDIO BIT(22)
163#define AR724X_RESET_PCIE_PHY_SERIAL BIT(10)
164#define AR724X_RESET_PCIE_PHY BIT(7)
165#define AR724X_RESET_PCIE BIT(6)
166#define AR724X_RESET_OHCI_DLL BIT(3)
167
168#define AR913X_RESET_AMBA2WMAC BIT(22)
169
170#define REV_ID_MAJOR_MASK 0xfff0
171#define REV_ID_MAJOR_AR71XX 0x00a0
172#define REV_ID_MAJOR_AR913X 0x00b0
173#define REV_ID_MAJOR_AR7240 0x00c0
174#define REV_ID_MAJOR_AR7241 0x0100
175#define REV_ID_MAJOR_AR7242 0x1100
176
177#define AR71XX_REV_ID_MINOR_MASK 0x3
178#define AR71XX_REV_ID_MINOR_AR7130 0x0
179#define AR71XX_REV_ID_MINOR_AR7141 0x1
180#define AR71XX_REV_ID_MINOR_AR7161 0x2
181#define AR71XX_REV_ID_REVISION_MASK 0x3
182#define AR71XX_REV_ID_REVISION_SHIFT 2
183
184#define AR913X_REV_ID_MINOR_MASK 0x3
185#define AR913X_REV_ID_MINOR_AR9130 0x0
186#define AR913X_REV_ID_MINOR_AR9132 0x1
187#define AR913X_REV_ID_REVISION_MASK 0x3
188#define AR913X_REV_ID_REVISION_SHIFT 2
189
190#define AR724X_REV_ID_REVISION_MASK 0x3
191
192/*
193 * SPI block
194 */
195#define AR71XX_SPI_REG_FS 0x00 /* Function Select */
196#define AR71XX_SPI_REG_CTRL 0x04 /* SPI Control */
197#define AR71XX_SPI_REG_IOC 0x08 /* SPI I/O Control */
198#define AR71XX_SPI_REG_RDS 0x0c /* Read Data Shift */
199
200#define AR71XX_SPI_FS_GPIO BIT(0) /* Enable GPIO mode */
201
202#define AR71XX_SPI_CTRL_RD BIT(6) /* Remap Disable */
203#define AR71XX_SPI_CTRL_DIV_MASK 0x3f
204
205#define AR71XX_SPI_IOC_DO BIT(0) /* Data Out pin */
206#define AR71XX_SPI_IOC_CLK BIT(8) /* CLK pin */
207#define AR71XX_SPI_IOC_CS(n) BIT(16 + (n))
208#define AR71XX_SPI_IOC_CS0 AR71XX_SPI_IOC_CS(0)
209#define AR71XX_SPI_IOC_CS1 AR71XX_SPI_IOC_CS(1)
210#define AR71XX_SPI_IOC_CS2 AR71XX_SPI_IOC_CS(2)
211#define AR71XX_SPI_IOC_CS_ALL (AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | \
212 AR71XX_SPI_IOC_CS2)
213
214/*
215 * GPIO block
216 */
217#define AR71XX_GPIO_REG_OE 0x00
218#define AR71XX_GPIO_REG_IN 0x04
219#define AR71XX_GPIO_REG_OUT 0x08
220#define AR71XX_GPIO_REG_SET 0x0c
221#define AR71XX_GPIO_REG_CLEAR 0x10
222#define AR71XX_GPIO_REG_INT_MODE 0x14
223#define AR71XX_GPIO_REG_INT_TYPE 0x18
224#define AR71XX_GPIO_REG_INT_POLARITY 0x1c
225#define AR71XX_GPIO_REG_INT_PENDING 0x20
226#define AR71XX_GPIO_REG_INT_ENABLE 0x24
227#define AR71XX_GPIO_REG_FUNC 0x28
228
229#define AR71XX_GPIO_COUNT 16
230#define AR724X_GPIO_COUNT 18
231#define AR913X_GPIO_COUNT 22
232
233#endif /* __ASM_MACH_AR71XX_REGS_H */
diff --git a/arch/mips/include/asm/mach-ath79/ath79.h b/arch/mips/include/asm/mach-ath79/ath79.h
new file mode 100644
index 00000000000..6a9f168506f
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/ath79.h
@@ -0,0 +1,96 @@
1/*
2 * Atheros AR71XX/AR724X/AR913X common definitions
3 *
4 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * Parts of this file are based on Atheros' 2.6.15 BSP
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 */
13
14#ifndef __ASM_MACH_ATH79_H
15#define __ASM_MACH_ATH79_H
16
17#include <linux/types.h>
18#include <linux/io.h>
19
20enum ath79_soc_type {
21 ATH79_SOC_UNKNOWN,
22 ATH79_SOC_AR7130,
23 ATH79_SOC_AR7141,
24 ATH79_SOC_AR7161,
25 ATH79_SOC_AR7240,
26 ATH79_SOC_AR7241,
27 ATH79_SOC_AR7242,
28 ATH79_SOC_AR9130,
29 ATH79_SOC_AR9132
30};
31
32extern enum ath79_soc_type ath79_soc;
33
34static inline int soc_is_ar71xx(void)
35{
36 return (ath79_soc == ATH79_SOC_AR7130 ||
37 ath79_soc == ATH79_SOC_AR7141 ||
38 ath79_soc == ATH79_SOC_AR7161);
39}
40
41static inline int soc_is_ar724x(void)
42{
43 return (ath79_soc == ATH79_SOC_AR7240 ||
44 ath79_soc == ATH79_SOC_AR7241 ||
45 ath79_soc == ATH79_SOC_AR7242);
46}
47
48static inline int soc_is_ar7240(void)
49{
50 return (ath79_soc == ATH79_SOC_AR7240);
51}
52
53static inline int soc_is_ar7241(void)
54{
55 return (ath79_soc == ATH79_SOC_AR7241);
56}
57
58static inline int soc_is_ar7242(void)
59{
60 return (ath79_soc == ATH79_SOC_AR7242);
61}
62
63static inline int soc_is_ar913x(void)
64{
65 return (ath79_soc == ATH79_SOC_AR9130 ||
66 ath79_soc == ATH79_SOC_AR9132);
67}
68
69extern void __iomem *ath79_ddr_base;
70extern void __iomem *ath79_pll_base;
71extern void __iomem *ath79_reset_base;
72
73static inline void ath79_pll_wr(unsigned reg, u32 val)
74{
75 __raw_writel(val, ath79_pll_base + reg);
76}
77
78static inline u32 ath79_pll_rr(unsigned reg)
79{
80 return __raw_readl(ath79_pll_base + reg);
81}
82
83static inline void ath79_reset_wr(unsigned reg, u32 val)
84{
85 __raw_writel(val, ath79_reset_base + reg);
86}
87
88static inline u32 ath79_reset_rr(unsigned reg)
89{
90 return __raw_readl(ath79_reset_base + reg);
91}
92
93void ath79_device_reset_set(u32 mask);
94void ath79_device_reset_clear(u32 mask);
95
96#endif /* __ASM_MACH_ATH79_H */
diff --git a/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h b/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h
new file mode 100644
index 00000000000..aa2283e602f
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h
@@ -0,0 +1,23 @@
1/*
2 * Platform data definition for Atheros AR71XX/AR724X/AR913X SPI controller
3 *
4 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11#ifndef _ATH79_SPI_PLATFORM_H
12#define _ATH79_SPI_PLATFORM_H
13
14struct ath79_spi_platform_data {
15 unsigned bus_num;
16 unsigned num_chipselect;
17};
18
19struct ath79_spi_controller_data {
20 unsigned gpio;
21};
22
23#endif /* _ATH79_SPI_PLATFORM_H */
diff --git a/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h
new file mode 100644
index 00000000000..4476fa03bf3
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h
@@ -0,0 +1,56 @@
1/*
2 * Atheros AR71XX/AR724X/AR913X specific CPU feature overrides
3 *
4 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * This file was derived from: include/asm-mips/cpu-features.h
8 * Copyright (C) 2003, 2004 Ralf Baechle
9 * Copyright (C) 2004 Maciej W. Rozycki
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 2 as published
13 * by the Free Software Foundation.
14 *
15 */
16#ifndef __ASM_MACH_ATH79_CPU_FEATURE_OVERRIDES_H
17#define __ASM_MACH_ATH79_CPU_FEATURE_OVERRIDES_H
18
19#define cpu_has_tlb 1
20#define cpu_has_4kex 1
21#define cpu_has_3k_cache 0
22#define cpu_has_4k_cache 1
23#define cpu_has_tx39_cache 0
24#define cpu_has_sb1_cache 0
25#define cpu_has_fpu 0
26#define cpu_has_32fpr 0
27#define cpu_has_counter 1
28#define cpu_has_watch 1
29#define cpu_has_divec 1
30
31#define cpu_has_prefetch 1
32#define cpu_has_ejtag 1
33#define cpu_has_llsc 1
34
35#define cpu_has_mips16 1
36#define cpu_has_mdmx 0
37#define cpu_has_mips3d 0
38#define cpu_has_smartmips 0
39
40#define cpu_has_mips32r1 1
41#define cpu_has_mips32r2 1
42#define cpu_has_mips64r1 0
43#define cpu_has_mips64r2 0
44
45#define cpu_has_dsp 0
46#define cpu_has_mipsmt 0
47
48#define cpu_has_64bits 0
49#define cpu_has_64bit_zero_reg 0
50#define cpu_has_64bit_gp_regs 0
51#define cpu_has_64bit_addresses 0
52
53#define cpu_dcache_line_size() 32
54#define cpu_icache_line_size() 32
55
56#endif /* __ASM_MACH_ATH79_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ath79/gpio.h b/arch/mips/include/asm/mach-ath79/gpio.h
new file mode 100644
index 00000000000..60dcb62785b
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/gpio.h
@@ -0,0 +1,26 @@
1/*
2 * Atheros AR71XX/AR724X/AR913X GPIO API definitions
3 *
4 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
10 *
11 */
12
13#ifndef __ASM_MACH_ATH79_GPIO_H
14#define __ASM_MACH_ATH79_GPIO_H
15
16#define ARCH_NR_GPIOS 64
17#include <asm-generic/gpio.h>
18
19int gpio_to_irq(unsigned gpio);
20int irq_to_gpio(unsigned irq);
21int gpio_get_value(unsigned gpio);
22void gpio_set_value(unsigned gpio, int value);
23
24#define gpio_cansleep __gpio_cansleep
25
26#endif /* __ASM_MACH_ATH79_GPIO_H */
diff --git a/arch/mips/include/asm/mach-ath79/irq.h b/arch/mips/include/asm/mach-ath79/irq.h
new file mode 100644
index 00000000000..189bc6eb9c1
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/irq.h
@@ -0,0 +1,36 @@
1/*
2 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
3 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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 version 2 as published
7 * by the Free Software Foundation.
8 */
9#ifndef __ASM_MACH_ATH79_IRQ_H
10#define __ASM_MACH_ATH79_IRQ_H
11
12#define MIPS_CPU_IRQ_BASE 0
13#define NR_IRQS 16
14
15#define ATH79_MISC_IRQ_BASE 8
16#define ATH79_MISC_IRQ_COUNT 8
17
18#define ATH79_CPU_IRQ_IP2 (MIPS_CPU_IRQ_BASE + 2)
19#define ATH79_CPU_IRQ_USB (MIPS_CPU_IRQ_BASE + 3)
20#define ATH79_CPU_IRQ_GE0 (MIPS_CPU_IRQ_BASE + 4)
21#define ATH79_CPU_IRQ_GE1 (MIPS_CPU_IRQ_BASE + 5)
22#define ATH79_CPU_IRQ_MISC (MIPS_CPU_IRQ_BASE + 6)
23#define ATH79_CPU_IRQ_TIMER (MIPS_CPU_IRQ_BASE + 7)
24
25#define ATH79_MISC_IRQ_TIMER (ATH79_MISC_IRQ_BASE + 0)
26#define ATH79_MISC_IRQ_ERROR (ATH79_MISC_IRQ_BASE + 1)
27#define ATH79_MISC_IRQ_GPIO (ATH79_MISC_IRQ_BASE + 2)
28#define ATH79_MISC_IRQ_UART (ATH79_MISC_IRQ_BASE + 3)
29#define ATH79_MISC_IRQ_WDOG (ATH79_MISC_IRQ_BASE + 4)
30#define ATH79_MISC_IRQ_PERFC (ATH79_MISC_IRQ_BASE + 5)
31#define ATH79_MISC_IRQ_OHCI (ATH79_MISC_IRQ_BASE + 6)
32#define ATH79_MISC_IRQ_DMA (ATH79_MISC_IRQ_BASE + 7)
33
34#include_next <irq.h>
35
36#endif /* __ASM_MACH_ATH79_IRQ_H */
diff --git a/arch/mips/include/asm/mach-ath79/kernel-entry-init.h b/arch/mips/include/asm/mach-ath79/kernel-entry-init.h
new file mode 100644
index 00000000000..d8d046bccc8
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/kernel-entry-init.h
@@ -0,0 +1,32 @@
1/*
2 * Atheros AR71XX/AR724X/AR913X specific kernel entry setup
3 *
4 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 */
11#ifndef __ASM_MACH_ATH79_KERNEL_ENTRY_H
12#define __ASM_MACH_ATH79_KERNEL_ENTRY_H
13
14 /*
15 * Some bootloaders set the 'Kseg0 coherency algorithm' to
16 * 'Cacheable, noncoherent, write-through, no write allocate'
17 * and this cause performance issues. Let's go and change it to
18 * 'Cacheable, noncoherent, write-back, write allocate'
19 */
20 .macro kernel_entry_setup
21 mfc0 t0, CP0_CONFIG
22 li t1, ~CONF_CM_CMASK
23 and t0, t1
24 ori t0, CONF_CM_CACHABLE_NONCOHERENT
25 mtc0 t0, CP0_CONFIG
26 nop
27 .endm
28
29 .macro smp_slave_setup
30 .endm
31
32#endif /* __ASM_MACH_ATH79_KERNEL_ENTRY_H */
diff --git a/arch/mips/include/asm/mach-ath79/war.h b/arch/mips/include/asm/mach-ath79/war.h
new file mode 100644
index 00000000000..323d9f1d8c4
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/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_MACH_ATH79_WAR_H
9#define __ASM_MACH_ATH79_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_MACH_ATH79_WAR_H */
diff --git a/arch/mips/include/asm/mips_machine.h b/arch/mips/include/asm/mips_machine.h
new file mode 100644
index 00000000000..363bb352c7f
--- /dev/null
+++ b/arch/mips/include/asm/mips_machine.h
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
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 version 2 as published
6 * by the Free Software Foundation.
7 *
8 */
9
10#ifndef __ASM_MIPS_MACHINE_H
11#define __ASM_MIPS_MACHINE_H
12
13#include <linux/init.h>
14#include <linux/stddef.h>
15
16#include <asm/bootinfo.h>
17
18struct mips_machine {
19 unsigned long mach_type;
20 const char *mach_id;
21 const char *mach_name;
22 void (*mach_setup)(void);
23};
24
25#define MIPS_MACHINE(_type, _id, _name, _setup) \
26static const char machine_name_##_type[] __initconst \
27 __aligned(1) = _name; \
28static const char machine_id_##_type[] __initconst \
29 __aligned(1) = _id; \
30static struct mips_machine machine_##_type \
31 __used __section(.mips.machines.init) = \
32{ \
33 .mach_type = _type, \
34 .mach_id = machine_id_##_type, \
35 .mach_name = machine_name_##_type, \
36 .mach_setup = _setup, \
37};
38
39extern long __mips_machines_start;
40extern long __mips_machines_end;
41
42#ifdef CONFIG_MIPS_MACHINE
43int mips_machtype_setup(char *id) __init;
44void mips_machine_setup(void) __init;
45void mips_set_machine_name(const char *name) __init;
46char *mips_get_machine_name(void);
47#else
48static inline int mips_machtype_setup(char *id) { return 1; }
49static inline void mips_machine_setup(void) { }
50static inline void mips_set_machine_name(const char *name) { }
51static inline char *mips_get_machine_name(void) { return NULL; }
52#endif /* CONFIG_MIPS_MACHINE */
53
54#endif /* __ASM_MIPS_MACHINE_H */
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
index d9592733a7b..73c0d45798d 100644
--- a/arch/mips/include/asm/mmu_context.h
+++ b/arch/mips/include/asm/mmu_context.h
@@ -29,13 +29,7 @@
29#define TLBMISS_HANDLER_SETUP_PGD(pgd) \ 29#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
30 tlbmiss_handler_setup_pgd((unsigned long)(pgd)) 30 tlbmiss_handler_setup_pgd((unsigned long)(pgd))
31 31
32static inline void tlbmiss_handler_setup_pgd(unsigned long pgd) 32extern void tlbmiss_handler_setup_pgd(unsigned long pgd);
33{
34 /* Check for swapper_pg_dir and convert to physical address. */
35 if ((pgd & CKSEG3) == CKSEG0)
36 pgd = CPHYSADDR(pgd);
37 write_c0_context(pgd << 11);
38}
39 33
40#define TLBMISS_HANDLER_SETUP() \ 34#define TLBMISS_HANDLER_SETUP() \
41 do { \ 35 do { \
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
index 892062d6d74..dcbd4bb417e 100644
--- a/arch/mips/include/asm/uasm.h
+++ b/arch/mips/include/asm/uasm.h
@@ -115,7 +115,12 @@ Ip_0(_tlbwr);
115Ip_u3u1u2(_xor); 115Ip_u3u1u2(_xor);
116Ip_u2u1u3(_xori); 116Ip_u2u1u3(_xori);
117Ip_u2u1msbu3(_dins); 117Ip_u2u1msbu3(_dins);
118Ip_u2u1msbu3(_dinsm);
118Ip_u1(_syscall); 119Ip_u1(_syscall);
120Ip_u1u2s3(_bbit0);
121Ip_u1u2s3(_bbit1);
122Ip_u3u1u2(_lwx);
123Ip_u3u1u2(_ldx);
119 124
120/* Handle labels. */ 125/* Handle labels. */
121struct uasm_label { 126struct uasm_label {
@@ -153,6 +158,7 @@ static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
153# define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_dsubu(buf, rs, rt, rd) 158# define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_dsubu(buf, rs, rt, rd)
154# define UASM_i_LL(buf, rs, rt, off) uasm_i_lld(buf, rs, rt, off) 159# define UASM_i_LL(buf, rs, rt, off) uasm_i_lld(buf, rs, rt, off)
155# define UASM_i_SC(buf, rs, rt, off) uasm_i_scd(buf, rs, rt, off) 160# define UASM_i_SC(buf, rs, rt, off) uasm_i_scd(buf, rs, rt, off)
161# define UASM_i_LWX(buf, rs, rt, rd) uasm_i_ldx(buf, rs, rt, rd)
156#else 162#else
157# define UASM_i_LW(buf, rs, rt, off) uasm_i_lw(buf, rs, rt, off) 163# define UASM_i_LW(buf, rs, rt, off) uasm_i_lw(buf, rs, rt, off)
158# define UASM_i_SW(buf, rs, rt, off) uasm_i_sw(buf, rs, rt, off) 164# define UASM_i_SW(buf, rs, rt, off) uasm_i_sw(buf, rs, rt, off)
@@ -167,6 +173,7 @@ static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
167# define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_subu(buf, rs, rt, rd) 173# define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_subu(buf, rs, rt, rd)
168# define UASM_i_LL(buf, rs, rt, off) uasm_i_ll(buf, rs, rt, off) 174# define UASM_i_LL(buf, rs, rt, off) uasm_i_ll(buf, rs, rt, off)
169# define UASM_i_SC(buf, rs, rt, off) uasm_i_sc(buf, rs, rt, off) 175# define UASM_i_SC(buf, rs, rt, off) uasm_i_sc(buf, rs, rt, off)
176# define UASM_i_LWX(buf, rs, rt, rd) uasm_i_lwx(buf, rs, rt, rd)
170#endif 177#endif
171 178
172#define uasm_i_b(buf, off) uasm_i_beq(buf, 0, 0, off) 179#define uasm_i_b(buf, off) uasm_i_beq(buf, 0, 0, off)