aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/loongson
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/loongson')
-rw-r--r--arch/mips/loongson/Platform32
-rw-r--r--arch/mips/loongson/common/cs5536/Makefile2
-rw-r--r--arch/mips/loongson/common/irq.c14
-rw-r--r--arch/mips/loongson/fuloong-2e/Makefile2
-rw-r--r--arch/mips/loongson/fuloong-2e/irq.c13
-rw-r--r--arch/mips/loongson/lemote-2f/irq.c16
6 files changed, 46 insertions, 33 deletions
diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
new file mode 100644
index 000000000000..29692e5433b1
--- /dev/null
+++ b/arch/mips/loongson/Platform
@@ -0,0 +1,32 @@
1#
2# Loongson Processors' Support
3#
4
5# Only gcc >= 4.4 have Loongson specific support
6cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
7cflags-$(CONFIG_CPU_LOONGSON2E) += \
8 $(call cc-option,-march=loongson2e,-march=r4600)
9cflags-$(CONFIG_CPU_LOONGSON2F) += \
10 $(call cc-option,-march=loongson2f,-march=r4600)
11# Enable the workarounds for Loongson2f
12ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
13 ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
14 $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop)
15 else
16 cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-nop
17 endif
18 ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-jump,),)
19 $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-jump)
20 else
21 cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-jump
22 endif
23endif
24
25#
26# Loongson Machines' Support
27#
28
29platform-$(CONFIG_MACH_LOONGSON) += loongson/
30cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson -mno-branch-likely
31load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
32load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
diff --git a/arch/mips/loongson/common/cs5536/Makefile b/arch/mips/loongson/common/cs5536/Makefile
index 510d4cdc2378..f12e64007347 100644
--- a/arch/mips/loongson/common/cs5536/Makefile
+++ b/arch/mips/loongson/common/cs5536/Makefile
@@ -9,5 +9,3 @@ obj-$(CONFIG_CS5536) += cs5536_pci.o cs5536_ide.o cs5536_acc.o cs5536_ohci.o \
9# Enable cs5536 mfgpt Timer 9# Enable cs5536 mfgpt Timer
10# 10#
11obj-$(CONFIG_CS5536_MFGPT) += cs5536_mfgpt.o 11obj-$(CONFIG_CS5536_MFGPT) += cs5536_mfgpt.o
12
13EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/loongson/common/irq.c b/arch/mips/loongson/common/irq.c
index 20e732831978..5897471dedca 100644
--- a/arch/mips/loongson/common/irq.c
+++ b/arch/mips/loongson/common/irq.c
@@ -21,19 +21,16 @@ void bonito_irqdispatch(void)
21 21
22 /* workaround the IO dma problem: let cpu looping to allow DMA finish */ 22 /* workaround the IO dma problem: let cpu looping to allow DMA finish */
23 int_status = LOONGSON_INTISR; 23 int_status = LOONGSON_INTISR;
24 if (int_status & (1 << 10)) { 24 while (int_status & (1 << 10)) {
25 while (int_status & (1 << 10)) { 25 udelay(1);
26 udelay(1); 26 int_status = LOONGSON_INTISR;
27 int_status = LOONGSON_INTISR;
28 }
29 } 27 }
30 28
31 /* Get pending sources, masked by current enables */ 29 /* Get pending sources, masked by current enables */
32 int_status = LOONGSON_INTISR & LOONGSON_INTEN; 30 int_status = LOONGSON_INTISR & LOONGSON_INTEN;
33 31
34 if (int_status != 0) { 32 if (int_status) {
35 i = __ffs(int_status); 33 i = __ffs(int_status);
36 int_status &= ~(1 << i);
37 do_IRQ(LOONGSON_IRQ_BASE + i); 34 do_IRQ(LOONGSON_IRQ_BASE + i);
38 } 35 }
39} 36}
@@ -56,9 +53,6 @@ void __init arch_init_irq(void)
56 */ 53 */
57 clear_c0_status(ST0_IM | ST0_BEV); 54 clear_c0_status(ST0_IM | ST0_BEV);
58 55
59 /* setting irq trigger mode */
60 set_irq_trigger_mode();
61
62 /* no steer */ 56 /* no steer */
63 LOONGSON_INTSTEER = 0; 57 LOONGSON_INTSTEER = 0;
64 58
diff --git a/arch/mips/loongson/fuloong-2e/Makefile b/arch/mips/loongson/fuloong-2e/Makefile
index 3aba5fcc09dc..b7622720c1ad 100644
--- a/arch/mips/loongson/fuloong-2e/Makefile
+++ b/arch/mips/loongson/fuloong-2e/Makefile
@@ -3,5 +3,3 @@
3# 3#
4 4
5obj-y += irq.o reset.o 5obj-y += irq.o reset.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/loongson/fuloong-2e/irq.c b/arch/mips/loongson/fuloong-2e/irq.c
index 320e9379bdd7..d61a04222b87 100644
--- a/arch/mips/loongson/fuloong-2e/irq.c
+++ b/arch/mips/loongson/fuloong-2e/irq.c
@@ -30,7 +30,7 @@ asmlinkage void mach_irq_dispatch(unsigned int pending)
30 if (pending & CAUSEF_IP7) 30 if (pending & CAUSEF_IP7)
31 do_IRQ(MIPS_CPU_IRQ_BASE + 7); 31 do_IRQ(MIPS_CPU_IRQ_BASE + 7);
32 else if (pending & CAUSEF_IP6) /* perf counter loverflow */ 32 else if (pending & CAUSEF_IP6) /* perf counter loverflow */
33 do_IRQ(LOONGSON2_PERFCNT_IRQ); 33 do_perfcnt_IRQ();
34 else if (pending & CAUSEF_IP5) 34 else if (pending & CAUSEF_IP5)
35 i8259_irqdispatch(); 35 i8259_irqdispatch();
36 else if (pending & CAUSEF_IP2) 36 else if (pending & CAUSEF_IP2)
@@ -44,13 +44,6 @@ static struct irqaction cascade_irqaction = {
44 .name = "cascade", 44 .name = "cascade",
45}; 45};
46 46
47void __init set_irq_trigger_mode(void)
48{
49 /* most bonito irq should be level triggered */
50 LOONGSON_INTEDGE = LOONGSON_ICU_SYSTEMERR | LOONGSON_ICU_MASTERERR |
51 LOONGSON_ICU_RETRYERR | LOONGSON_ICU_MBOXES;
52}
53
54void __init mach_init_irq(void) 47void __init mach_init_irq(void)
55{ 48{
56 /* init all controller 49 /* init all controller
@@ -59,6 +52,10 @@ void __init mach_init_irq(void)
59 * 32-63 ------> bonito irq 52 * 32-63 ------> bonito irq
60 */ 53 */
61 54
55 /* most bonito irq should be level triggered */
56 LOONGSON_INTEDGE = LOONGSON_ICU_SYSTEMERR | LOONGSON_ICU_MASTERERR |
57 LOONGSON_ICU_RETRYERR | LOONGSON_ICU_MBOXES;
58
62 /* Sets the first-level interrupt dispatcher. */ 59 /* Sets the first-level interrupt dispatcher. */
63 mips_cpu_irq_init(); 60 mips_cpu_irq_init();
64 init_i8259_irqs(); 61 init_i8259_irqs();
diff --git a/arch/mips/loongson/lemote-2f/irq.c b/arch/mips/loongson/lemote-2f/irq.c
index 1d8b4d28a058..081db102bb98 100644
--- a/arch/mips/loongson/lemote-2f/irq.c
+++ b/arch/mips/loongson/lemote-2f/irq.c
@@ -19,7 +19,6 @@
19#include <machine.h> 19#include <machine.h>
20 20
21#define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* cpu timer */ 21#define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* cpu timer */
22#define LOONGSON_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */
23#define LOONGSON_NORTH_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 6) /* bonito */ 22#define LOONGSON_NORTH_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 6) /* bonito */
24#define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 3) /* cpu serial port */ 23#define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 3) /* cpu serial port */
25#define LOONGSON_SOUTH_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 2) /* i8259 */ 24#define LOONGSON_SOUTH_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 2) /* i8259 */
@@ -79,9 +78,7 @@ void mach_irq_dispatch(unsigned int pending)
79 if (pending & CAUSEF_IP7) 78 if (pending & CAUSEF_IP7)
80 do_IRQ(LOONGSON_TIMER_IRQ); 79 do_IRQ(LOONGSON_TIMER_IRQ);
81 else if (pending & CAUSEF_IP6) { /* North Bridge, Perf counter */ 80 else if (pending & CAUSEF_IP6) { /* North Bridge, Perf counter */
82#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE) 81 do_perfcnt_IRQ();
83 do_IRQ(LOONGSON2_PERFCNT_IRQ);
84#endif
85 bonito_irqdispatch(); 82 bonito_irqdispatch();
86 } else if (pending & CAUSEF_IP3) /* CPU UART */ 83 } else if (pending & CAUSEF_IP3) /* CPU UART */
87 do_IRQ(LOONGSON_UART_IRQ); 84 do_IRQ(LOONGSON_UART_IRQ);
@@ -91,13 +88,6 @@ void mach_irq_dispatch(unsigned int pending)
91 spurious_interrupt(); 88 spurious_interrupt();
92} 89}
93 90
94void __init set_irq_trigger_mode(void)
95{
96 /* setup cs5536 as high level trigger */
97 LOONGSON_INTPOL = LOONGSON_INT_BIT_INT0 | LOONGSON_INT_BIT_INT1;
98 LOONGSON_INTEDGE &= ~(LOONGSON_INT_BIT_INT0 | LOONGSON_INT_BIT_INT1);
99}
100
101static irqreturn_t ip6_action(int cpl, void *dev_id) 91static irqreturn_t ip6_action(int cpl, void *dev_id)
102{ 92{
103 return IRQ_HANDLED; 93 return IRQ_HANDLED;
@@ -122,6 +112,10 @@ void __init mach_init_irq(void)
122 * 32-63 ------> bonito irq 112 * 32-63 ------> bonito irq
123 */ 113 */
124 114
115 /* setup cs5536 as high level trigger */
116 LOONGSON_INTPOL = LOONGSON_INT_BIT_INT0 | LOONGSON_INT_BIT_INT1;
117 LOONGSON_INTEDGE &= ~(LOONGSON_INT_BIT_INT0 | LOONGSON_INT_BIT_INT1);
118
125 /* Sets the first-level interrupt dispatcher. */ 119 /* Sets the first-level interrupt dispatcher. */
126 mips_cpu_irq_init(); 120 mips_cpu_irq_init();
127 init_i8259_irqs(); 121 init_i8259_irqs();