diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/mips-boards/atlas |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/mips/mips-boards/atlas')
-rw-r--r-- | arch/mips/mips-boards/atlas/Makefile | 20 | ||||
-rw-r--r-- | arch/mips/mips-boards/atlas/atlas_gdb.c | 97 | ||||
-rw-r--r-- | arch/mips/mips-boards/atlas/atlas_int.c | 142 | ||||
-rw-r--r-- | arch/mips/mips-boards/atlas/atlas_setup.c | 95 |
4 files changed, 354 insertions, 0 deletions
diff --git a/arch/mips/mips-boards/atlas/Makefile b/arch/mips/mips-boards/atlas/Makefile new file mode 100644 index 000000000000..d8dab75906bf --- /dev/null +++ b/arch/mips/mips-boards/atlas/Makefile | |||
@@ -0,0 +1,20 @@ | |||
1 | # | ||
2 | # Carsten Langgaard, carstenl@mips.com | ||
3 | # Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | ||
4 | # | ||
5 | # This program is free software; you can distribute it and/or modify it | ||
6 | # under the terms of the GNU General Public License (Version 2) as | ||
7 | # published by the Free Software Foundation. | ||
8 | # | ||
9 | # This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | # for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License along | ||
15 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | # 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
17 | # | ||
18 | |||
19 | obj-y := atlas_int.o atlas_setup.o | ||
20 | obj-$(CONFIG_KGDB) += atlas_gdb.o | ||
diff --git a/arch/mips/mips-boards/atlas/atlas_gdb.c b/arch/mips/mips-boards/atlas/atlas_gdb.c new file mode 100644 index 000000000000..fb65280f1780 --- /dev/null +++ b/arch/mips/mips-boards/atlas/atlas_gdb.c | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * Carsten Langgaard, carstenl@mips.com | ||
3 | * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can distribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License (Version 2) as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
17 | * | ||
18 | * This is the interface to the remote debugger stub. | ||
19 | */ | ||
20 | #include <asm/io.h> | ||
21 | #include <asm/mips-boards/atlas.h> | ||
22 | #include <asm/mips-boards/saa9730_uart.h> | ||
23 | |||
24 | #define INB(a) inb((unsigned long)a) | ||
25 | #define OUTB(x,a) outb(x,(unsigned long)a) | ||
26 | |||
27 | /* | ||
28 | * This is the interface to the remote debugger stub | ||
29 | * if the Philips part is used for the debug port, | ||
30 | * called from the platform setup code. | ||
31 | */ | ||
32 | void *saa9730_base = (void *)ATLAS_SAA9730_REG; | ||
33 | |||
34 | static int saa9730_kgdb_active = 0; | ||
35 | |||
36 | #define SAA9730_BAUDCLOCK(baud) (((ATLAS_SAA9730_BAUDCLOCK/(baud))/16)-1) | ||
37 | |||
38 | int saa9730_kgdb_hook(int speed) | ||
39 | { | ||
40 | int baudclock; | ||
41 | t_uart_saa9730_regmap *kgdb_uart = (t_uart_saa9730_regmap *)(saa9730_base + SAA9730_UART_REGS_ADDR); | ||
42 | |||
43 | /* | ||
44 | * Clear all interrupts | ||
45 | */ | ||
46 | (void) INB(&kgdb_uart->Lsr); | ||
47 | (void) INB(&kgdb_uart->Msr); | ||
48 | (void) INB(&kgdb_uart->Thr_Rbr); | ||
49 | (void) INB(&kgdb_uart->Iir_Fcr); | ||
50 | |||
51 | /* | ||
52 | * Now, initialize the UART | ||
53 | */ | ||
54 | /* 8 data bits, one stop bit, no parity */ | ||
55 | OUTB(SAA9730_LCR_DATA8, &kgdb_uart->Lcr); | ||
56 | |||
57 | baudclock = SAA9730_BAUDCLOCK(speed); | ||
58 | |||
59 | OUTB((baudclock >> 16) & 0xff, &kgdb_uart->BaudDivMsb); | ||
60 | OUTB( baudclock & 0xff, &kgdb_uart->BaudDivLsb); | ||
61 | |||
62 | /* Set RTS/DTR active */ | ||
63 | OUTB(SAA9730_MCR_DTR | SAA9730_MCR_RTS, &kgdb_uart->Mcr); | ||
64 | saa9730_kgdb_active = 1; | ||
65 | |||
66 | return speed; | ||
67 | } | ||
68 | |||
69 | int saa9730_putDebugChar(char c) | ||
70 | { | ||
71 | t_uart_saa9730_regmap *kgdb_uart = (t_uart_saa9730_regmap *)(saa9730_base + SAA9730_UART_REGS_ADDR); | ||
72 | |||
73 | if (!saa9730_kgdb_active) { /* need to init device first */ | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | while (!(INB(&kgdb_uart->Lsr) & SAA9730_LSR_THRE)) | ||
78 | ; | ||
79 | OUTB(c, &kgdb_uart->Thr_Rbr); | ||
80 | |||
81 | return 1; | ||
82 | } | ||
83 | |||
84 | char saa9730_getDebugChar(void) | ||
85 | { | ||
86 | t_uart_saa9730_regmap *kgdb_uart = (t_uart_saa9730_regmap *)(saa9730_base + SAA9730_UART_REGS_ADDR); | ||
87 | char c; | ||
88 | |||
89 | if (!saa9730_kgdb_active) { /* need to init device first */ | ||
90 | return 0; | ||
91 | } | ||
92 | while (!(INB(&kgdb_uart->Lsr) & SAA9730_LSR_DR)) | ||
93 | ; | ||
94 | |||
95 | c = INB(&kgdb_uart->Thr_Rbr); | ||
96 | return(c); | ||
97 | } | ||
diff --git a/arch/mips/mips-boards/atlas/atlas_int.c b/arch/mips/mips-boards/atlas/atlas_int.c new file mode 100644 index 000000000000..8f1d875217a2 --- /dev/null +++ b/arch/mips/mips-boards/atlas/atlas_int.c | |||
@@ -0,0 +1,142 @@ | |||
1 | /* | ||
2 | * Carsten Langgaard, carstenl@mips.com | ||
3 | * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | ||
4 | * | ||
5 | * ######################################################################## | ||
6 | * | ||
7 | * This program is free software; you can distribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License (Version 2) as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
14 | * for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
19 | * | ||
20 | * ######################################################################## | ||
21 | * | ||
22 | * Routines for generic manipulation of the interrupts found on the MIPS | ||
23 | * Atlas board. | ||
24 | * | ||
25 | */ | ||
26 | #include <linux/compiler.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/sched.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/interrupt.h> | ||
31 | #include <linux/kernel_stat.h> | ||
32 | |||
33 | #include <asm/irq.h> | ||
34 | #include <asm/io.h> | ||
35 | #include <asm/mips-boards/atlas.h> | ||
36 | #include <asm/mips-boards/atlasint.h> | ||
37 | #include <asm/gdb-stub.h> | ||
38 | |||
39 | |||
40 | static struct atlas_ictrl_regs *atlas_hw0_icregs; | ||
41 | |||
42 | extern asmlinkage void mipsIRQ(void); | ||
43 | |||
44 | #if 0 | ||
45 | #define DEBUG_INT(x...) printk(x) | ||
46 | #else | ||
47 | #define DEBUG_INT(x...) | ||
48 | #endif | ||
49 | |||
50 | void disable_atlas_irq(unsigned int irq_nr) | ||
51 | { | ||
52 | atlas_hw0_icregs->intrsten = (1 << (irq_nr-ATLASINT_BASE)); | ||
53 | iob(); | ||
54 | } | ||
55 | |||
56 | void enable_atlas_irq(unsigned int irq_nr) | ||
57 | { | ||
58 | atlas_hw0_icregs->intseten = (1 << (irq_nr-ATLASINT_BASE)); | ||
59 | iob(); | ||
60 | } | ||
61 | |||
62 | static unsigned int startup_atlas_irq(unsigned int irq) | ||
63 | { | ||
64 | enable_atlas_irq(irq); | ||
65 | return 0; /* never anything pending */ | ||
66 | } | ||
67 | |||
68 | #define shutdown_atlas_irq disable_atlas_irq | ||
69 | |||
70 | #define mask_and_ack_atlas_irq disable_atlas_irq | ||
71 | |||
72 | static void end_atlas_irq(unsigned int irq) | ||
73 | { | ||
74 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | ||
75 | enable_atlas_irq(irq); | ||
76 | } | ||
77 | |||
78 | static struct hw_interrupt_type atlas_irq_type = { | ||
79 | "Atlas", | ||
80 | startup_atlas_irq, | ||
81 | shutdown_atlas_irq, | ||
82 | enable_atlas_irq, | ||
83 | disable_atlas_irq, | ||
84 | mask_and_ack_atlas_irq, | ||
85 | end_atlas_irq, | ||
86 | NULL | ||
87 | }; | ||
88 | |||
89 | static inline int ls1bit32(unsigned int x) | ||
90 | { | ||
91 | int b = 31, s; | ||
92 | |||
93 | s = 16; if (x << 16 == 0) s = 0; b -= s; x <<= s; | ||
94 | s = 8; if (x << 8 == 0) s = 0; b -= s; x <<= s; | ||
95 | s = 4; if (x << 4 == 0) s = 0; b -= s; x <<= s; | ||
96 | s = 2; if (x << 2 == 0) s = 0; b -= s; x <<= s; | ||
97 | s = 1; if (x << 1 == 0) s = 0; b -= s; | ||
98 | |||
99 | return b; | ||
100 | } | ||
101 | |||
102 | void atlas_hw0_irqdispatch(struct pt_regs *regs) | ||
103 | { | ||
104 | unsigned long int_status; | ||
105 | int irq; | ||
106 | |||
107 | int_status = atlas_hw0_icregs->intstatus; | ||
108 | |||
109 | /* if int_status == 0, then the interrupt has already been cleared */ | ||
110 | if (unlikely(int_status == 0)) | ||
111 | return; | ||
112 | |||
113 | irq = ATLASINT_BASE + ls1bit32(int_status); | ||
114 | |||
115 | DEBUG_INT("atlas_hw0_irqdispatch: irq=%d\n", irq); | ||
116 | |||
117 | do_IRQ(irq, regs); | ||
118 | } | ||
119 | |||
120 | void __init arch_init_irq(void) | ||
121 | { | ||
122 | int i; | ||
123 | |||
124 | atlas_hw0_icregs = (struct atlas_ictrl_regs *)ioremap (ATLAS_ICTRL_REGS_BASE, sizeof(struct atlas_ictrl_regs *)); | ||
125 | |||
126 | /* | ||
127 | * Mask out all interrupt by writing "1" to all bit position in | ||
128 | * the interrupt reset reg. | ||
129 | */ | ||
130 | atlas_hw0_icregs->intrsten = 0xffffffff; | ||
131 | |||
132 | /* Now safe to set the exception vector. */ | ||
133 | set_except_vector(0, mipsIRQ); | ||
134 | |||
135 | for (i = ATLASINT_BASE; i <= ATLASINT_END; i++) { | ||
136 | irq_desc[i].status = IRQ_DISABLED; | ||
137 | irq_desc[i].action = 0; | ||
138 | irq_desc[i].depth = 1; | ||
139 | irq_desc[i].handler = &atlas_irq_type; | ||
140 | spin_lock_init(&irq_desc[i].lock); | ||
141 | } | ||
142 | } | ||
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c new file mode 100644 index 000000000000..0a1dd9bbc02e --- /dev/null +++ b/arch/mips/mips-boards/atlas/atlas_setup.c | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * Carsten Langgaard, carstenl@mips.com | ||
3 | * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can distribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License (Version 2) as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
17 | */ | ||
18 | #include <linux/config.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/tty.h> | ||
24 | #include <linux/serial.h> | ||
25 | #include <linux/serial_core.h> | ||
26 | |||
27 | #include <asm/cpu.h> | ||
28 | #include <asm/bootinfo.h> | ||
29 | #include <asm/irq.h> | ||
30 | #include <asm/mips-boards/generic.h> | ||
31 | #include <asm/mips-boards/prom.h> | ||
32 | #include <asm/mips-boards/atlas.h> | ||
33 | #include <asm/mips-boards/atlasint.h> | ||
34 | #include <asm/time.h> | ||
35 | #include <asm/traps.h> | ||
36 | |||
37 | extern void mips_reboot_setup(void); | ||
38 | extern void mips_time_init(void); | ||
39 | extern void mips_timer_setup(struct irqaction *irq); | ||
40 | extern unsigned long mips_rtc_get_time(void); | ||
41 | |||
42 | #ifdef CONFIG_KGDB | ||
43 | extern void kgdb_config(void); | ||
44 | #endif | ||
45 | |||
46 | static void __init serial_init(void); | ||
47 | |||
48 | const char *get_system_type(void) | ||
49 | { | ||
50 | return "MIPS Atlas"; | ||
51 | } | ||
52 | |||
53 | static int __init atlas_setup(void) | ||
54 | { | ||
55 | ioport_resource.end = 0x7fffffff; | ||
56 | |||
57 | serial_init (); | ||
58 | |||
59 | #ifdef CONFIG_KGDB | ||
60 | kgdb_config(); | ||
61 | #endif | ||
62 | mips_reboot_setup(); | ||
63 | |||
64 | board_time_init = mips_time_init; | ||
65 | board_timer_setup = mips_timer_setup; | ||
66 | rtc_get_time = mips_rtc_get_time; | ||
67 | |||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | early_initcall(atlas_setup); | ||
72 | |||
73 | static void __init serial_init(void) | ||
74 | { | ||
75 | #ifdef CONFIG_SERIAL_8250 | ||
76 | struct uart_port s; | ||
77 | |||
78 | memset(&s, 0, sizeof(s)); | ||
79 | |||
80 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | ||
81 | s.iobase = ATLAS_UART_REGS_BASE; | ||
82 | #else | ||
83 | s.iobase = ATLAS_UART_REGS_BASE+3; | ||
84 | #endif | ||
85 | s.irq = ATLASINT_UART; | ||
86 | s.uartclk = ATLAS_BASE_BAUD * 16; | ||
87 | s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; | ||
88 | s.iotype = SERIAL_IO_PORT; | ||
89 | s.regshift = 3; | ||
90 | |||
91 | if (early_serial_setup(&s) != 0) { | ||
92 | printk(KERN_ERR "Serial setup failed!\n"); | ||
93 | } | ||
94 | #endif | ||
95 | } | ||