diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2007-03-14 11:58:28 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-04-27 11:20:23 -0400 |
commit | 2127435e57a15f1fea8d6969e264eeb05b28ba4b (patch) | |
tree | c8ae7407efcfe42309fbab978c931e17042780b8 /arch/mips/jmr3927 | |
parent | 252161eccd1a44f32a506d0fedb424d4ff84e4dc (diff) |
[MIPS] JMR3927 cleanup
* Kill dead codes
* Rearrange irq chip handlers
* Minimize defconfig
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/jmr3927')
-rw-r--r-- | arch/mips/jmr3927/common/prom.c | 12 | ||||
-rw-r--r-- | arch/mips/jmr3927/common/puts.c | 122 | ||||
-rw-r--r-- | arch/mips/jmr3927/rbhma3100/Makefile | 1 | ||||
-rw-r--r-- | arch/mips/jmr3927/rbhma3100/init.c | 16 | ||||
-rw-r--r-- | arch/mips/jmr3927/rbhma3100/irq.c | 312 | ||||
-rw-r--r-- | arch/mips/jmr3927/rbhma3100/kgdb_io.c | 54 | ||||
-rw-r--r-- | arch/mips/jmr3927/rbhma3100/setup.c | 157 |
7 files changed, 65 insertions, 609 deletions
diff --git a/arch/mips/jmr3927/common/prom.c b/arch/mips/jmr3927/common/prom.c index aa481b774c42..5398813e50e6 100644 --- a/arch/mips/jmr3927/common/prom.c +++ b/arch/mips/jmr3927/common/prom.c | |||
@@ -41,16 +41,6 @@ | |||
41 | 41 | ||
42 | #include <asm/bootinfo.h> | 42 | #include <asm/bootinfo.h> |
43 | 43 | ||
44 | extern int prom_argc; | ||
45 | extern char **prom_argv, **prom_envp; | ||
46 | |||
47 | typedef struct | ||
48 | { | ||
49 | char *name; | ||
50 | /* char *val; */ | ||
51 | }t_env_var; | ||
52 | |||
53 | |||
54 | char * __init prom_getcmdline(void) | 44 | char * __init prom_getcmdline(void) |
55 | { | 45 | { |
56 | return &(arcs_cmdline[0]); | 46 | return &(arcs_cmdline[0]); |
@@ -60,6 +50,8 @@ void __init prom_init_cmdline(void) | |||
60 | { | 50 | { |
61 | char *cp; | 51 | char *cp; |
62 | int actr; | 52 | int actr; |
53 | int prom_argc = fw_arg0; | ||
54 | char **prom_argv = (char **) fw_arg1; | ||
63 | 55 | ||
64 | actr = 1; /* Always ignore argv[0] */ | 56 | actr = 1; /* Always ignore argv[0] */ |
65 | 57 | ||
diff --git a/arch/mips/jmr3927/common/puts.c b/arch/mips/jmr3927/common/puts.c index 1c1cad9cd078..c611ab497888 100644 --- a/arch/mips/jmr3927/common/puts.c +++ b/arch/mips/jmr3927/common/puts.c | |||
@@ -32,137 +32,29 @@ | |||
32 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 32 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/types.h> | ||
36 | #include <asm/jmr3927/txx927.h> | ||
37 | #include <asm/jmr3927/tx3927.h> | 35 | #include <asm/jmr3927/tx3927.h> |
38 | #include <asm/jmr3927/jmr3927.h> | ||
39 | 36 | ||
40 | #define TIMEOUT 0xffffff | 37 | #define TIMEOUT 0xffffff |
41 | #define SLOW_DOWN | ||
42 | |||
43 | static const char digits[16] = "0123456789abcdef"; | ||
44 | |||
45 | #ifdef SLOW_DOWN | ||
46 | #define slow_down() { int k; for (k=0; k<10000; k++); } | ||
47 | #else | ||
48 | #define slow_down() | ||
49 | #endif | ||
50 | 38 | ||
51 | void | 39 | void |
52 | putch(const unsigned char c) | 40 | prom_putchar(char c) |
53 | { | 41 | { |
54 | int i = 0; | 42 | int i = 0; |
55 | 43 | ||
56 | do { | 44 | do { |
57 | slow_down(); | ||
58 | i++; | 45 | i++; |
59 | if (i>TIMEOUT) { | 46 | if (i>TIMEOUT) |
60 | break; | 47 | break; |
61 | } | ||
62 | } while (!(tx3927_sioptr(1)->cisr & TXx927_SICISR_TXALS)); | 48 | } while (!(tx3927_sioptr(1)->cisr & TXx927_SICISR_TXALS)); |
63 | tx3927_sioptr(1)->tfifo = c; | 49 | tx3927_sioptr(1)->tfifo = c; |
64 | return; | 50 | return; |
65 | } | 51 | } |
66 | 52 | ||
67 | unsigned char getch(void) | ||
68 | { | ||
69 | int i = 0; | ||
70 | int dicr; | ||
71 | char c; | ||
72 | |||
73 | /* diable RX int. */ | ||
74 | dicr = tx3927_sioptr(1)->dicr; | ||
75 | tx3927_sioptr(1)->dicr = 0; | ||
76 | |||
77 | do { | ||
78 | slow_down(); | ||
79 | i++; | ||
80 | if (i>TIMEOUT) { | ||
81 | break; | ||
82 | } | ||
83 | } while (tx3927_sioptr(1)->disr & TXx927_SIDISR_UVALID) | ||
84 | ; | ||
85 | c = tx3927_sioptr(1)->rfifo; | ||
86 | |||
87 | /* clear RX int. status */ | ||
88 | tx3927_sioptr(1)->disr &= ~TXx927_SIDISR_RDIS; | ||
89 | /* enable RX int. */ | ||
90 | tx3927_sioptr(1)->dicr = dicr; | ||
91 | |||
92 | return c; | ||
93 | } | ||
94 | void | ||
95 | do_jmr3927_led_set(char n) | ||
96 | { | ||
97 | /* and with current leds */ | ||
98 | jmr3927_led_and_set(n); | ||
99 | } | ||
100 | |||
101 | void | 53 | void |
102 | puts(unsigned char *cp) | 54 | puts(const char *cp) |
103 | { | 55 | { |
104 | int i = 0; | 56 | while (*cp) |
105 | 57 | prom_putchar(*cp++); | |
106 | while (*cp) { | 58 | prom_putchar('\r'); |
107 | do { | 59 | prom_putchar('\n'); |
108 | slow_down(); | ||
109 | i++; | ||
110 | if (i>TIMEOUT) { | ||
111 | break; | ||
112 | } | ||
113 | } while (!(tx3927_sioptr(1)->cisr & TXx927_SICISR_TXALS)); | ||
114 | tx3927_sioptr(1)->tfifo = *cp++; | ||
115 | } | ||
116 | putch('\r'); | ||
117 | putch('\n'); | ||
118 | } | ||
119 | |||
120 | void | ||
121 | fputs(unsigned char *cp) | ||
122 | { | ||
123 | int i = 0; | ||
124 | |||
125 | while (*cp) { | ||
126 | do { | ||
127 | slow_down(); | ||
128 | i++; | ||
129 | if (i>TIMEOUT) { | ||
130 | break; | ||
131 | } | ||
132 | } while (!(tx3927_sioptr(1)->cisr & TXx927_SICISR_TXALS)); | ||
133 | tx3927_sioptr(1)->tfifo = *cp++; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | |||
138 | void | ||
139 | put64(uint64_t ul) | ||
140 | { | ||
141 | int cnt; | ||
142 | unsigned ch; | ||
143 | |||
144 | cnt = 16; /* 16 nibbles in a 64 bit long */ | ||
145 | putch('0'); | ||
146 | putch('x'); | ||
147 | do { | ||
148 | cnt--; | ||
149 | ch = (unsigned char)(ul >> cnt * 4) & 0x0F; | ||
150 | putch(digits[ch]); | ||
151 | } while (cnt > 0); | ||
152 | } | ||
153 | |||
154 | void | ||
155 | put32(unsigned u) | ||
156 | { | ||
157 | int cnt; | ||
158 | unsigned ch; | ||
159 | |||
160 | cnt = 8; /* 8 nibbles in a 32 bit long */ | ||
161 | putch('0'); | ||
162 | putch('x'); | ||
163 | do { | ||
164 | cnt--; | ||
165 | ch = (unsigned char)(u >> cnt * 4) & 0x0F; | ||
166 | putch(digits[ch]); | ||
167 | } while (cnt > 0); | ||
168 | } | 60 | } |
diff --git a/arch/mips/jmr3927/rbhma3100/Makefile b/arch/mips/jmr3927/rbhma3100/Makefile index 18fe9a898cb7..8d00ba460cef 100644 --- a/arch/mips/jmr3927/rbhma3100/Makefile +++ b/arch/mips/jmr3927/rbhma3100/Makefile | |||
@@ -3,5 +3,4 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += init.o irq.o setup.o | 5 | obj-y += init.o irq.o setup.o |
6 | obj-$(CONFIG_RUNTIME_DEBUG) += debug.o | ||
7 | obj-$(CONFIG_KGDB) += kgdb_io.o | 6 | obj-$(CONFIG_KGDB) += kgdb_io.o |
diff --git a/arch/mips/jmr3927/rbhma3100/init.c b/arch/mips/jmr3927/rbhma3100/init.c index a55cb4572ded..9169fab1773a 100644 --- a/arch/mips/jmr3927/rbhma3100/init.c +++ b/arch/mips/jmr3927/rbhma3100/init.c | |||
@@ -28,20 +28,10 @@ | |||
28 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 28 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
29 | */ | 29 | */ |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/mm.h> | ||
32 | #include <linux/sched.h> | ||
33 | #include <linux/bootmem.h> | ||
34 | |||
35 | #include <asm/addrspace.h> | ||
36 | #include <asm/bootinfo.h> | 31 | #include <asm/bootinfo.h> |
37 | #include <asm/mipsregs.h> | ||
38 | #include <asm/jmr3927/jmr3927.h> | 32 | #include <asm/jmr3927/jmr3927.h> |
39 | 33 | ||
40 | int prom_argc; | ||
41 | char **prom_argv, **prom_envp; | ||
42 | extern void __init prom_init_cmdline(void); | 34 | extern void __init prom_init_cmdline(void); |
43 | extern char *prom_getenv(char *envname); | ||
44 | unsigned long mips_nofpu = 0; | ||
45 | 35 | ||
46 | const char *get_system_type(void) | 36 | const char *get_system_type(void) |
47 | { | 37 | { |
@@ -52,7 +42,7 @@ const char *get_system_type(void) | |||
52 | ; | 42 | ; |
53 | } | 43 | } |
54 | 44 | ||
55 | extern void puts(unsigned char *cp); | 45 | extern void puts(const char *cp); |
56 | 46 | ||
57 | void __init prom_init(void) | 47 | void __init prom_init(void) |
58 | { | 48 | { |
@@ -61,10 +51,6 @@ void __init prom_init(void) | |||
61 | if ((tx3927_ccfgptr->ccfg & TX3927_CCFG_TLBOFF) == 0) | 51 | if ((tx3927_ccfgptr->ccfg & TX3927_CCFG_TLBOFF) == 0) |
62 | puts("Warning: TX3927 TLB off\n"); | 52 | puts("Warning: TX3927 TLB off\n"); |
63 | #endif | 53 | #endif |
64 | prom_argc = fw_arg0; | ||
65 | prom_argv = (char **) fw_arg1; | ||
66 | prom_envp = (char **) fw_arg2; | ||
67 | |||
68 | mips_machgroup = MACH_GROUP_TOSHIBA; | 54 | mips_machgroup = MACH_GROUP_TOSHIBA; |
69 | 55 | ||
70 | #ifdef CONFIG_TOSHIBA_JMR3927 | 56 | #ifdef CONFIG_TOSHIBA_JMR3927 |
diff --git a/arch/mips/jmr3927/rbhma3100/irq.c b/arch/mips/jmr3927/rbhma3100/irq.c index 7d2c203cb406..1187b44a3dd4 100644 --- a/arch/mips/jmr3927/rbhma3100/irq.c +++ b/arch/mips/jmr3927/rbhma3100/irq.c | |||
@@ -30,53 +30,21 @@ | |||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 30 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
31 | */ | 31 | */ |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | |||
34 | #include <linux/errno.h> | ||
35 | #include <linux/irq.h> | ||
36 | #include <linux/kernel_stat.h> | ||
37 | #include <linux/signal.h> | ||
38 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
39 | #include <linux/types.h> | 34 | #include <linux/types.h> |
40 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
41 | #include <linux/ioport.h> | ||
42 | #include <linux/timex.h> | ||
43 | #include <linux/slab.h> | ||
44 | #include <linux/random.h> | ||
45 | #include <linux/smp.h> | ||
46 | #include <linux/smp_lock.h> | ||
47 | #include <linux/bitops.h> | ||
48 | 36 | ||
49 | #include <asm/irq_regs.h> | ||
50 | #include <asm/io.h> | 37 | #include <asm/io.h> |
51 | #include <asm/mipsregs.h> | 38 | #include <asm/mipsregs.h> |
52 | #include <asm/system.h> | 39 | #include <asm/system.h> |
53 | 40 | ||
54 | #include <asm/ptrace.h> | ||
55 | #include <asm/processor.h> | 41 | #include <asm/processor.h> |
56 | #include <asm/jmr3927/irq.h> | ||
57 | #include <asm/debug.h> | ||
58 | #include <asm/jmr3927/jmr3927.h> | 42 | #include <asm/jmr3927/jmr3927.h> |
59 | 43 | ||
60 | #if JMR3927_IRQ_END > NR_IRQS | 44 | #if JMR3927_IRQ_END > NR_IRQS |
61 | #error JMR3927_IRQ_END > NR_IRQS | 45 | #error JMR3927_IRQ_END > NR_IRQS |
62 | #endif | 46 | #endif |
63 | 47 | ||
64 | struct tb_irq_space* tb_irq_spaces; | ||
65 | |||
66 | static int jmr3927_irq_base = -1; | ||
67 | |||
68 | #ifdef CONFIG_PCI | ||
69 | static int jmr3927_gen_iack(void) | ||
70 | { | ||
71 | /* generate ACK cycle */ | ||
72 | #ifdef __BIG_ENDIAN | ||
73 | return (tx3927_pcicptr->iiadp >> 24) & 0xff; | ||
74 | #else | ||
75 | return tx3927_pcicptr->iiadp & 0xff; | ||
76 | #endif | ||
77 | } | ||
78 | #endif | ||
79 | |||
80 | #define irc_dlevel 0 | 48 | #define irc_dlevel 0 |
81 | #define irc_elevel 1 | 49 | #define irc_elevel 1 |
82 | 50 | ||
@@ -87,89 +55,24 @@ static unsigned char irc_level[TX3927_NUM_IR] = { | |||
87 | 6, 6, 6 /* TMR */ | 55 | 6, 6, 6 /* TMR */ |
88 | }; | 56 | }; |
89 | 57 | ||
90 | static void jmr3927_irq_disable(unsigned int irq_nr); | ||
91 | static void jmr3927_irq_enable(unsigned int irq_nr); | ||
92 | |||
93 | static void jmr3927_irq_ack(unsigned int irq) | ||
94 | { | ||
95 | if (irq == JMR3927_IRQ_IRC_TMR0) | ||
96 | jmr3927_tmrptr->tisr = 0; /* ack interrupt */ | ||
97 | |||
98 | jmr3927_irq_disable(irq); | ||
99 | } | ||
100 | |||
101 | static void jmr3927_irq_end(unsigned int irq) | ||
102 | { | ||
103 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | ||
104 | jmr3927_irq_enable(irq); | ||
105 | } | ||
106 | |||
107 | static void jmr3927_irq_disable(unsigned int irq_nr) | ||
108 | { | ||
109 | struct tb_irq_space* sp; | ||
110 | |||
111 | for (sp = tb_irq_spaces; sp; sp = sp->next) { | ||
112 | if (sp->start_irqno <= irq_nr && | ||
113 | irq_nr < sp->start_irqno + sp->nr_irqs) { | ||
114 | if (sp->mask_func) | ||
115 | sp->mask_func(irq_nr - sp->start_irqno, | ||
116 | sp->space_id); | ||
117 | break; | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | |||
122 | static void jmr3927_irq_enable(unsigned int irq_nr) | ||
123 | { | ||
124 | struct tb_irq_space* sp; | ||
125 | |||
126 | for (sp = tb_irq_spaces; sp; sp = sp->next) { | ||
127 | if (sp->start_irqno <= irq_nr && | ||
128 | irq_nr < sp->start_irqno + sp->nr_irqs) { | ||
129 | if (sp->unmask_func) | ||
130 | sp->unmask_func(irq_nr - sp->start_irqno, | ||
131 | sp->space_id); | ||
132 | break; | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | |||
137 | /* | 58 | /* |
138 | * CP0_STATUS is a thread's resource (saved/restored on context switch). | 59 | * CP0_STATUS is a thread's resource (saved/restored on context switch). |
139 | * So disable_irq/enable_irq MUST handle IOC/ISAC/IRC registers. | 60 | * So disable_irq/enable_irq MUST handle IOC/IRC registers. |
140 | */ | 61 | */ |
141 | static void mask_irq_isac(int irq_nr, int space_id) | 62 | static void mask_irq_ioc(unsigned int irq) |
142 | { | ||
143 | /* 0: mask */ | ||
144 | unsigned char imask = | ||
145 | jmr3927_isac_reg_in(JMR3927_ISAC_INTM_ADDR); | ||
146 | unsigned int bit = 1 << irq_nr; | ||
147 | jmr3927_isac_reg_out(imask & ~bit, JMR3927_ISAC_INTM_ADDR); | ||
148 | /* flush write buffer */ | ||
149 | (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR); | ||
150 | } | ||
151 | static void unmask_irq_isac(int irq_nr, int space_id) | ||
152 | { | ||
153 | /* 0: mask */ | ||
154 | unsigned char imask = jmr3927_isac_reg_in(JMR3927_ISAC_INTM_ADDR); | ||
155 | unsigned int bit = 1 << irq_nr; | ||
156 | jmr3927_isac_reg_out(imask | bit, JMR3927_ISAC_INTM_ADDR); | ||
157 | /* flush write buffer */ | ||
158 | (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR); | ||
159 | } | ||
160 | |||
161 | static void mask_irq_ioc(int irq_nr, int space_id) | ||
162 | { | 63 | { |
163 | /* 0: mask */ | 64 | /* 0: mask */ |
65 | unsigned int irq_nr = irq - JMR3927_IRQ_IOC; | ||
164 | unsigned char imask = jmr3927_ioc_reg_in(JMR3927_IOC_INTM_ADDR); | 66 | unsigned char imask = jmr3927_ioc_reg_in(JMR3927_IOC_INTM_ADDR); |
165 | unsigned int bit = 1 << irq_nr; | 67 | unsigned int bit = 1 << irq_nr; |
166 | jmr3927_ioc_reg_out(imask & ~bit, JMR3927_IOC_INTM_ADDR); | 68 | jmr3927_ioc_reg_out(imask & ~bit, JMR3927_IOC_INTM_ADDR); |
167 | /* flush write buffer */ | 69 | /* flush write buffer */ |
168 | (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR); | 70 | (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR); |
169 | } | 71 | } |
170 | static void unmask_irq_ioc(int irq_nr, int space_id) | 72 | static void unmask_irq_ioc(unsigned int irq) |
171 | { | 73 | { |
172 | /* 0: mask */ | 74 | /* 0: mask */ |
75 | unsigned int irq_nr = irq - JMR3927_IRQ_IOC; | ||
173 | unsigned char imask = jmr3927_ioc_reg_in(JMR3927_IOC_INTM_ADDR); | 76 | unsigned char imask = jmr3927_ioc_reg_in(JMR3927_IOC_INTM_ADDR); |
174 | unsigned int bit = 1 << irq_nr; | 77 | unsigned int bit = 1 << irq_nr; |
175 | jmr3927_ioc_reg_out(imask | bit, JMR3927_IOC_INTM_ADDR); | 78 | jmr3927_ioc_reg_out(imask | bit, JMR3927_IOC_INTM_ADDR); |
@@ -177,8 +80,9 @@ static void unmask_irq_ioc(int irq_nr, int space_id) | |||
177 | (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR); | 80 | (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR); |
178 | } | 81 | } |
179 | 82 | ||
180 | static void mask_irq_irc(int irq_nr, int space_id) | 83 | static void mask_irq_irc(unsigned int irq) |
181 | { | 84 | { |
85 | unsigned int irq_nr = irq - JMR3927_IRQ_IRC; | ||
182 | volatile unsigned long *ilrp = &tx3927_ircptr->ilr[irq_nr / 2]; | 86 | volatile unsigned long *ilrp = &tx3927_ircptr->ilr[irq_nr / 2]; |
183 | if (irq_nr & 1) | 87 | if (irq_nr & 1) |
184 | *ilrp = (*ilrp & 0x00ff) | (irc_dlevel << 8); | 88 | *ilrp = (*ilrp & 0x00ff) | (irc_dlevel << 8); |
@@ -191,8 +95,9 @@ static void mask_irq_irc(int irq_nr, int space_id) | |||
191 | (void)tx3927_ircptr->ssr; | 95 | (void)tx3927_ircptr->ssr; |
192 | } | 96 | } |
193 | 97 | ||
194 | static void unmask_irq_irc(int irq_nr, int space_id) | 98 | static void unmask_irq_irc(unsigned int irq) |
195 | { | 99 | { |
100 | unsigned int irq_nr = irq - JMR3927_IRQ_IRC; | ||
196 | volatile unsigned long *ilrp = &tx3927_ircptr->ilr[irq_nr / 2]; | 101 | volatile unsigned long *ilrp = &tx3927_ircptr->ilr[irq_nr / 2]; |
197 | if (irq_nr & 1) | 102 | if (irq_nr & 1) |
198 | *ilrp = (*ilrp & 0x00ff) | (irc_level[irq_nr] << 8); | 103 | *ilrp = (*ilrp & 0x00ff) | (irc_level[irq_nr] << 8); |
@@ -203,98 +108,14 @@ static void unmask_irq_irc(int irq_nr, int space_id) | |||
203 | tx3927_ircptr->imr = irc_elevel; | 108 | tx3927_ircptr->imr = irc_elevel; |
204 | } | 109 | } |
205 | 110 | ||
206 | struct tb_irq_space jmr3927_isac_irqspace = { | ||
207 | .next = NULL, | ||
208 | .start_irqno = JMR3927_IRQ_ISAC, | ||
209 | nr_irqs : JMR3927_NR_IRQ_ISAC, | ||
210 | .mask_func = mask_irq_isac, | ||
211 | .unmask_func = unmask_irq_isac, | ||
212 | .name = "ISAC", | ||
213 | .space_id = 0, | ||
214 | can_share : 0 | ||
215 | }; | ||
216 | struct tb_irq_space jmr3927_ioc_irqspace = { | ||
217 | .next = NULL, | ||
218 | .start_irqno = JMR3927_IRQ_IOC, | ||
219 | nr_irqs : JMR3927_NR_IRQ_IOC, | ||
220 | .mask_func = mask_irq_ioc, | ||
221 | .unmask_func = unmask_irq_ioc, | ||
222 | .name = "IOC", | ||
223 | .space_id = 0, | ||
224 | can_share : 1 | ||
225 | }; | ||
226 | |||
227 | struct tb_irq_space jmr3927_irc_irqspace = { | ||
228 | .next = NULL, | ||
229 | .start_irqno = JMR3927_IRQ_IRC, | ||
230 | .nr_irqs = JMR3927_NR_IRQ_IRC, | ||
231 | .mask_func = mask_irq_irc, | ||
232 | .unmask_func = unmask_irq_irc, | ||
233 | .name = "on-chip", | ||
234 | .space_id = 0, | ||
235 | .can_share = 0 | ||
236 | }; | ||
237 | |||
238 | |||
239 | #ifdef CONFIG_TX_BRANCH_LIKELY_BUG_WORKAROUND | ||
240 | static int tx_branch_likely_bug_count = 0; | ||
241 | static int have_tx_branch_likely_bug = 0; | ||
242 | |||
243 | static void tx_branch_likely_bug_fixup(void) | ||
244 | { | ||
245 | struct pt_regs *regs = get_irq_regs(); | ||
246 | |||
247 | /* TX39/49-BUG: Under this condition, the insn in delay slot | ||
248 | of the branch likely insn is executed (not nullified) even | ||
249 | the branch condition is false. */ | ||
250 | if (!have_tx_branch_likely_bug) | ||
251 | return; | ||
252 | if ((regs->cp0_epc & 0xfff) == 0xffc && | ||
253 | KSEGX(regs->cp0_epc) != KSEG0 && | ||
254 | KSEGX(regs->cp0_epc) != KSEG1) { | ||
255 | unsigned int insn = *(unsigned int*)(regs->cp0_epc - 4); | ||
256 | /* beql,bnel,blezl,bgtzl */ | ||
257 | /* bltzl,bgezl,blezall,bgezall */ | ||
258 | /* bczfl, bcztl */ | ||
259 | if ((insn & 0xf0000000) == 0x50000000 || | ||
260 | (insn & 0xfc0e0000) == 0x04020000 || | ||
261 | (insn & 0xf3fe0000) == 0x41020000) { | ||
262 | regs->cp0_epc -= 4; | ||
263 | tx_branch_likely_bug_count++; | ||
264 | printk(KERN_INFO | ||
265 | "fix branch-likery bug in %s (insn %08x)\n", | ||
266 | current->comm, insn); | ||
267 | } | ||
268 | } | ||
269 | } | ||
270 | #endif | ||
271 | |||
272 | static void jmr3927_spurious(void) | ||
273 | { | ||
274 | struct pt_regs * regs = get_irq_regs(); | ||
275 | |||
276 | #ifdef CONFIG_TX_BRANCH_LIKELY_BUG_WORKAROUND | ||
277 | tx_branch_likely_bug_fixup(); | ||
278 | #endif | ||
279 | printk(KERN_WARNING "spurious interrupt (cause 0x%lx, pc 0x%lx, ra 0x%lx).\n", | ||
280 | regs->cp0_cause, regs->cp0_epc, regs->regs[31]); | ||
281 | } | ||
282 | |||
283 | asmlinkage void plat_irq_dispatch(void) | 111 | asmlinkage void plat_irq_dispatch(void) |
284 | { | 112 | { |
285 | struct pt_regs * regs = get_irq_regs(); | 113 | unsigned long cp0_cause = read_c0_cause(); |
286 | int irq; | 114 | int irq; |
287 | 115 | ||
288 | #ifdef CONFIG_TX_BRANCH_LIKELY_BUG_WORKAROUND | 116 | if ((cp0_cause & CAUSEF_IP7) == 0) |
289 | tx_branch_likely_bug_fixup(); | ||
290 | #endif | ||
291 | if ((regs->cp0_cause & CAUSEF_IP7) == 0) { | ||
292 | #if 0 | ||
293 | jmr3927_spurious(); | ||
294 | #endif | ||
295 | return; | 117 | return; |
296 | } | 118 | irq = (cp0_cause >> CAUSEB_IP2) & 0x0f; |
297 | irq = (regs->cp0_cause >> CAUSEB_IP2) & 0x0f; | ||
298 | 119 | ||
299 | do_IRQ(irq + JMR3927_IRQ_IRC); | 120 | do_IRQ(irq + JMR3927_IRQ_IRC); |
300 | } | 121 | } |
@@ -317,35 +138,6 @@ static struct irqaction ioc_action = { | |||
317 | jmr3927_ioc_interrupt, 0, CPU_MASK_NONE, "IOC", NULL, NULL, | 138 | jmr3927_ioc_interrupt, 0, CPU_MASK_NONE, "IOC", NULL, NULL, |
318 | }; | 139 | }; |
319 | 140 | ||
320 | static irqreturn_t jmr3927_isac_interrupt(int irq, void *dev_id) | ||
321 | { | ||
322 | unsigned char istat = jmr3927_isac_reg_in(JMR3927_ISAC_INTS2_ADDR); | ||
323 | int i; | ||
324 | |||
325 | for (i = 0; i < JMR3927_NR_IRQ_ISAC; i++) { | ||
326 | if (istat & (1 << i)) { | ||
327 | irq = JMR3927_IRQ_ISAC + i; | ||
328 | do_IRQ(irq); | ||
329 | } | ||
330 | } | ||
331 | return IRQ_HANDLED; | ||
332 | } | ||
333 | |||
334 | static struct irqaction isac_action = { | ||
335 | jmr3927_isac_interrupt, 0, CPU_MASK_NONE, "ISAC", NULL, NULL, | ||
336 | }; | ||
337 | |||
338 | |||
339 | static irqreturn_t jmr3927_isaerr_interrupt(int irq, void *dev_id) | ||
340 | { | ||
341 | printk(KERN_WARNING "ISA error interrupt (irq 0x%x).\n", irq); | ||
342 | |||
343 | return IRQ_HANDLED; | ||
344 | } | ||
345 | static struct irqaction isaerr_action = { | ||
346 | jmr3927_isaerr_interrupt, 0, CPU_MASK_NONE, "ISA error", NULL, NULL, | ||
347 | }; | ||
348 | |||
349 | static irqreturn_t jmr3927_pcierr_interrupt(int irq, void *dev_id) | 141 | static irqreturn_t jmr3927_pcierr_interrupt(int irq, void *dev_id) |
350 | { | 142 | { |
351 | printk(KERN_WARNING "PCI error interrupt (irq 0x%x).\n", irq); | 143 | printk(KERN_WARNING "PCI error interrupt (irq 0x%x).\n", irq); |
@@ -358,54 +150,19 @@ static struct irqaction pcierr_action = { | |||
358 | jmr3927_pcierr_interrupt, 0, CPU_MASK_NONE, "PCI error", NULL, NULL, | 150 | jmr3927_pcierr_interrupt, 0, CPU_MASK_NONE, "PCI error", NULL, NULL, |
359 | }; | 151 | }; |
360 | 152 | ||
361 | int jmr3927_ether1_irq = 0; | 153 | static void __init jmr3927_irq_init(void); |
362 | |||
363 | void jmr3927_irq_init(u32 irq_base); | ||
364 | 154 | ||
365 | void __init arch_init_irq(void) | 155 | void __init arch_init_irq(void) |
366 | { | 156 | { |
367 | /* look for io board's presence */ | ||
368 | int have_isac = jmr3927_have_isac(); | ||
369 | |||
370 | /* Now, interrupt control disabled, */ | 157 | /* Now, interrupt control disabled, */ |
371 | /* all IRC interrupts are masked, */ | 158 | /* all IRC interrupts are masked, */ |
372 | /* all IRC interrupt mode are Low Active. */ | 159 | /* all IRC interrupt mode are Low Active. */ |
373 | 160 | ||
374 | if (have_isac) { | ||
375 | |||
376 | /* ETHER1 (NE2000 compatible 10M-Ether) parameter setup */ | ||
377 | /* temporary enable interrupt control */ | ||
378 | tx3927_ircptr->cer = 1; | ||
379 | /* ETHER1 Int. Is High-Active. */ | ||
380 | if (tx3927_ircptr->ssr & (1 << 0)) | ||
381 | jmr3927_ether1_irq = JMR3927_IRQ_IRC_INT0; | ||
382 | #if 0 /* INT3 may be asserted by ether0 (even after reboot...) */ | ||
383 | else if (tx3927_ircptr->ssr & (1 << 3)) | ||
384 | jmr3927_ether1_irq = JMR3927_IRQ_IRC_INT3; | ||
385 | #endif | ||
386 | /* disable interrupt control */ | ||
387 | tx3927_ircptr->cer = 0; | ||
388 | |||
389 | /* Ether1: High Active */ | ||
390 | if (jmr3927_ether1_irq) { | ||
391 | int ether1_irc = jmr3927_ether1_irq - JMR3927_IRQ_IRC; | ||
392 | tx3927_ircptr->cr[ether1_irc / 8] |= | ||
393 | TX3927_IRCR_HIGH << ((ether1_irc % 8) * 2); | ||
394 | } | ||
395 | } | ||
396 | |||
397 | /* mask all IOC interrupts */ | 161 | /* mask all IOC interrupts */ |
398 | jmr3927_ioc_reg_out(0, JMR3927_IOC_INTM_ADDR); | 162 | jmr3927_ioc_reg_out(0, JMR3927_IOC_INTM_ADDR); |
399 | /* setup IOC interrupt mode (SOFT:High Active, Others:Low Active) */ | 163 | /* setup IOC interrupt mode (SOFT:High Active, Others:Low Active) */ |
400 | jmr3927_ioc_reg_out(JMR3927_IOC_INTF_SOFT, JMR3927_IOC_INTP_ADDR); | 164 | jmr3927_ioc_reg_out(JMR3927_IOC_INTF_SOFT, JMR3927_IOC_INTP_ADDR); |
401 | 165 | ||
402 | if (have_isac) { | ||
403 | /* mask all ISAC interrupts */ | ||
404 | jmr3927_isac_reg_out(0, JMR3927_ISAC_INTM_ADDR); | ||
405 | /* setup ISAC interrupt mode (ISAIRQ3,ISAIRQ5:Low Active ???) */ | ||
406 | jmr3927_isac_reg_out(JMR3927_ISAC_INTF_IRQ3|JMR3927_ISAC_INTF_IRQ5, JMR3927_ISAC_INTP_ADDR); | ||
407 | } | ||
408 | |||
409 | /* clear PCI Soft interrupts */ | 166 | /* clear PCI Soft interrupts */ |
410 | jmr3927_ioc_reg_out(0, JMR3927_IOC_INTS1_ADDR); | 167 | jmr3927_ioc_reg_out(0, JMR3927_IOC_INTS1_ADDR); |
411 | /* clear PCI Reset interrupts */ | 168 | /* clear PCI Reset interrupts */ |
@@ -415,21 +172,11 @@ void __init arch_init_irq(void) | |||
415 | tx3927_ircptr->cer = TX3927_IRCER_ICE; | 172 | tx3927_ircptr->cer = TX3927_IRCER_ICE; |
416 | tx3927_ircptr->imr = irc_elevel; | 173 | tx3927_ircptr->imr = irc_elevel; |
417 | 174 | ||
418 | jmr3927_irq_init(NR_ISA_IRQS); | 175 | jmr3927_irq_init(); |
419 | |||
420 | /* setup irq space */ | ||
421 | add_tb_irq_space(&jmr3927_isac_irqspace); | ||
422 | add_tb_irq_space(&jmr3927_ioc_irqspace); | ||
423 | add_tb_irq_space(&jmr3927_irc_irqspace); | ||
424 | 176 | ||
425 | /* setup IOC interrupt 1 (PCI, MODEM) */ | 177 | /* setup IOC interrupt 1 (PCI, MODEM) */ |
426 | setup_irq(JMR3927_IRQ_IOCINT, &ioc_action); | 178 | setup_irq(JMR3927_IRQ_IOCINT, &ioc_action); |
427 | 179 | ||
428 | if (have_isac) { | ||
429 | setup_irq(JMR3927_IRQ_ISACINT, &isac_action); | ||
430 | setup_irq(JMR3927_IRQ_ISAC_ISAER, &isaerr_action); | ||
431 | } | ||
432 | |||
433 | #ifdef CONFIG_PCI | 180 | #ifdef CONFIG_PCI |
434 | setup_irq(JMR3927_IRQ_IRC_PCI, &pcierr_action); | 181 | setup_irq(JMR3927_IRQ_IRC_PCI, &pcierr_action); |
435 | #endif | 182 | #endif |
@@ -438,21 +185,28 @@ void __init arch_init_irq(void) | |||
438 | set_c0_status(ST0_IM); /* IE bit is still 0. */ | 185 | set_c0_status(ST0_IM); /* IE bit is still 0. */ |
439 | } | 186 | } |
440 | 187 | ||
441 | static struct irq_chip jmr3927_irq_controller = { | 188 | static struct irq_chip jmr3927_irq_ioc = { |
442 | .name = "jmr3927_irq", | 189 | .name = "jmr3927_ioc", |
443 | .ack = jmr3927_irq_ack, | 190 | .ack = mask_irq_ioc, |
444 | .mask = jmr3927_irq_disable, | 191 | .mask = mask_irq_ioc, |
445 | .mask_ack = jmr3927_irq_ack, | 192 | .mask_ack = mask_irq_ioc, |
446 | .unmask = jmr3927_irq_enable, | 193 | .unmask = unmask_irq_ioc, |
447 | .end = jmr3927_irq_end, | ||
448 | }; | 194 | }; |
449 | 195 | ||
450 | void jmr3927_irq_init(u32 irq_base) | 196 | static struct irq_chip jmr3927_irq_irc = { |
197 | .name = "jmr3927_irc", | ||
198 | .ack = mask_irq_irc, | ||
199 | .mask = mask_irq_irc, | ||
200 | .mask_ack = mask_irq_irc, | ||
201 | .unmask = unmask_irq_irc, | ||
202 | }; | ||
203 | |||
204 | static void __init jmr3927_irq_init(void) | ||
451 | { | 205 | { |
452 | u32 i; | 206 | u32 i; |
453 | 207 | ||
454 | for (i= irq_base; i< irq_base + JMR3927_NR_IRQ_IRC + JMR3927_NR_IRQ_IOC; i++) | 208 | for (i = JMR3927_IRQ_IRC; i < JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC; i++) |
455 | set_irq_chip(i, &jmr3927_irq_controller); | 209 | set_irq_chip_and_handler(i, &jmr3927_irq_irc, handle_level_irq); |
456 | 210 | for (i = JMR3927_IRQ_IOC; i < JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC; i++) | |
457 | jmr3927_irq_base = irq_base; | 211 | set_irq_chip_and_handler(i, &jmr3927_irq_ioc, handle_level_irq); |
458 | } | 212 | } |
diff --git a/arch/mips/jmr3927/rbhma3100/kgdb_io.c b/arch/mips/jmr3927/rbhma3100/kgdb_io.c index 269a42deae06..2604f2c9a96e 100644 --- a/arch/mips/jmr3927/rbhma3100/kgdb_io.c +++ b/arch/mips/jmr3927/rbhma3100/kgdb_io.c | |||
@@ -31,23 +31,12 @@ | |||
31 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 31 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/types.h> | ||
35 | #include <asm/jmr3927/txx927.h> | ||
36 | #include <asm/jmr3927/tx3927.h> | ||
37 | #include <asm/jmr3927/jmr3927.h> | 34 | #include <asm/jmr3927/jmr3927.h> |
38 | 35 | ||
39 | #define TIMEOUT 0xffffff | 36 | #define TIMEOUT 0xffffff |
40 | #define SLOW_DOWN | ||
41 | |||
42 | static const char digits[16] = "0123456789abcdef"; | ||
43 | |||
44 | #ifdef SLOW_DOWN | ||
45 | #define slow_down() { int k; for (k=0; k<10000; k++); } | ||
46 | #else | ||
47 | #define slow_down() | ||
48 | #endif | ||
49 | 37 | ||
50 | static int remoteDebugInitialized = 0; | 38 | static int remoteDebugInitialized = 0; |
39 | static void debugInit(int baud) | ||
51 | 40 | ||
52 | int putDebugChar(unsigned char c) | 41 | int putDebugChar(unsigned char c) |
53 | { | 42 | { |
@@ -103,20 +92,8 @@ unsigned char getDebugChar(void) | |||
103 | return c; | 92 | return c; |
104 | } | 93 | } |
105 | 94 | ||
106 | void debugInit(int baud) | 95 | static void debugInit(int baud) |
107 | { | 96 | { |
108 | /* | ||
109 | volatile unsigned long lcr; | ||
110 | volatile unsigned long dicr; | ||
111 | volatile unsigned long disr; | ||
112 | volatile unsigned long cisr; | ||
113 | volatile unsigned long fcr; | ||
114 | volatile unsigned long flcr; | ||
115 | volatile unsigned long bgr; | ||
116 | volatile unsigned long tfifo; | ||
117 | volatile unsigned long rfifo; | ||
118 | */ | ||
119 | |||
120 | tx3927_sioptr(0)->lcr = 0x020; | 97 | tx3927_sioptr(0)->lcr = 0x020; |
121 | tx3927_sioptr(0)->dicr = 0; | 98 | tx3927_sioptr(0)->dicr = 0; |
122 | tx3927_sioptr(0)->disr = 0x4100; | 99 | tx3927_sioptr(0)->disr = 0x4100; |
@@ -125,31 +102,4 @@ void debugInit(int baud) | |||
125 | tx3927_sioptr(0)->flcr = 0x02; | 102 | tx3927_sioptr(0)->flcr = 0x02; |
126 | tx3927_sioptr(0)->bgr = ((JMR3927_BASE_BAUD + baud / 2) / baud) | | 103 | tx3927_sioptr(0)->bgr = ((JMR3927_BASE_BAUD + baud / 2) / baud) | |
127 | TXx927_SIBGR_BCLK_T0; | 104 | TXx927_SIBGR_BCLK_T0; |
128 | #if 0 | ||
129 | /* | ||
130 | * Reset the UART. | ||
131 | */ | ||
132 | tx3927_sioptr(0)->fcr = TXx927_SIFCR_SWRST; | ||
133 | while (tx3927_sioptr(0)->fcr & TXx927_SIFCR_SWRST) | ||
134 | ; | ||
135 | |||
136 | /* | ||
137 | * and set the speed of the serial port | ||
138 | * (currently hardwired to 9600 8N1 | ||
139 | */ | ||
140 | |||
141 | tx3927_sioptr(0)->lcr = TXx927_SILCR_UMODE_8BIT | | ||
142 | TXx927_SILCR_USBL_1BIT | | ||
143 | TXx927_SILCR_SCS_IMCLK_BG; | ||
144 | tx3927_sioptr(0)->bgr = | ||
145 | ((JMR3927_BASE_BAUD + baud / 2) / baud) | | ||
146 | TXx927_SIBGR_BCLK_T0; | ||
147 | |||
148 | /* HW RTS/CTS control */ | ||
149 | if (ser->flags & ASYNC_HAVE_CTS_LINE) | ||
150 | tx3927_sioptr(0)->flcr = TXx927_SIFLCR_RCS | TXx927_SIFLCR_TES | | ||
151 | TXx927_SIFLCR_RTSTL_MAX /* 15 */; | ||
152 | /* Enable RX/TX */ | ||
153 | tx3927_sioptr(0)->flcr &= ~(TXx927_SIFLCR_RSDE | TXx927_SIFLCR_TSDE); | ||
154 | #endif | ||
155 | } | 105 | } |
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c index fc523bda068f..d1ef2895d564 100644 --- a/arch/mips/jmr3927/rbhma3100/setup.c +++ b/arch/mips/jmr3927/rbhma3100/setup.c | |||
@@ -54,87 +54,18 @@ | |||
54 | 54 | ||
55 | #include <asm/addrspace.h> | 55 | #include <asm/addrspace.h> |
56 | #include <asm/time.h> | 56 | #include <asm/time.h> |
57 | #include <asm/bcache.h> | ||
58 | #include <asm/irq.h> | ||
59 | #include <asm/reboot.h> | 57 | #include <asm/reboot.h> |
60 | #include <asm/gdb-stub.h> | ||
61 | #include <asm/jmr3927/jmr3927.h> | 58 | #include <asm/jmr3927/jmr3927.h> |
62 | #include <asm/mipsregs.h> | 59 | #include <asm/mipsregs.h> |
63 | #include <asm/traps.h> | ||
64 | 60 | ||
65 | extern void puts(unsigned char *cp); | 61 | extern void puts(const char *cp); |
66 | 62 | ||
67 | /* Tick Timer divider */ | 63 | /* Tick Timer divider */ |
68 | #define JMR3927_TIMER_CCD 0 /* 1/2 */ | 64 | #define JMR3927_TIMER_CCD 0 /* 1/2 */ |
69 | #define JMR3927_TIMER_CLK (JMR3927_IMCLK / (2 << JMR3927_TIMER_CCD)) | 65 | #define JMR3927_TIMER_CLK (JMR3927_IMCLK / (2 << JMR3927_TIMER_CCD)) |
70 | 66 | ||
71 | unsigned char led_state = 0xf; | ||
72 | |||
73 | struct { | ||
74 | struct resource ram0; | ||
75 | struct resource ram1; | ||
76 | struct resource pcimem; | ||
77 | struct resource iob; | ||
78 | struct resource ioc; | ||
79 | struct resource pciio; | ||
80 | struct resource jmy1394; | ||
81 | struct resource rom1; | ||
82 | struct resource rom0; | ||
83 | struct resource sio0; | ||
84 | struct resource sio1; | ||
85 | } jmr3927_resources = { | ||
86 | { | ||
87 | .start = 0, | ||
88 | .end = 0x01FFFFFF, | ||
89 | .name = "RAM0", | ||
90 | .flags = IORESOURCE_MEM | ||
91 | }, { | ||
92 | .start = 0x02000000, | ||
93 | .end = 0x03FFFFFF, | ||
94 | .name = "RAM1", | ||
95 | .flags = IORESOURCE_MEM | ||
96 | }, { | ||
97 | .start = 0x08000000, | ||
98 | .end = 0x07FFFFFF, | ||
99 | .name = "PCIMEM", | ||
100 | .flags = IORESOURCE_MEM | ||
101 | }, { | ||
102 | .start = 0x10000000, | ||
103 | .end = 0x13FFFFFF, | ||
104 | .name = "IOB" | ||
105 | }, { | ||
106 | .start = 0x14000000, | ||
107 | .end = 0x14FFFFFF, | ||
108 | .name = "IOC" | ||
109 | }, { | ||
110 | .start = 0x15000000, | ||
111 | .end = 0x15FFFFFF, | ||
112 | .name = "PCIIO" | ||
113 | }, { | ||
114 | .start = 0x1D000000, | ||
115 | .end = 0x1D3FFFFF, | ||
116 | .name = "JMY1394" | ||
117 | }, { | ||
118 | .start = 0x1E000000, | ||
119 | .end = 0x1E3FFFFF, | ||
120 | .name = "ROM1" | ||
121 | }, { | ||
122 | .start = 0x1FC00000, | ||
123 | .end = 0x1FFFFFFF, | ||
124 | .name = "ROM0" | ||
125 | }, { | ||
126 | .start = 0xFFFEF300, | ||
127 | .end = 0xFFFEF3FF, | ||
128 | .name = "SIO0" | ||
129 | }, { | ||
130 | .start = 0xFFFEF400, | ||
131 | .end = 0xFFFEF4FF, | ||
132 | .name = "SIO1" | ||
133 | }, | ||
134 | }; | ||
135 | |||
136 | /* don't enable - see errata */ | 67 | /* don't enable - see errata */ |
137 | int jmr3927_ccfg_toeon = 0; | 68 | static int jmr3927_ccfg_toeon; |
138 | 69 | ||
139 | static inline void do_reset(void) | 70 | static inline void do_reset(void) |
140 | { | 71 | { |
@@ -173,9 +104,15 @@ static cycle_t jmr3927_hpt_read(void) | |||
173 | return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr; | 104 | return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr; |
174 | } | 105 | } |
175 | 106 | ||
107 | static void jmr3927_timer_ack(void) | ||
108 | { | ||
109 | jmr3927_tmrptr->tisr = 0; /* ack interrupt */ | ||
110 | } | ||
111 | |||
176 | static void __init jmr3927_time_init(void) | 112 | static void __init jmr3927_time_init(void) |
177 | { | 113 | { |
178 | clocksource_mips.read = jmr3927_hpt_read; | 114 | clocksource_mips.read = jmr3927_hpt_read; |
115 | mips_timer_ack = jmr3927_timer_ack; | ||
179 | mips_hpt_frequency = JMR3927_TIMER_CLK; | 116 | mips_hpt_frequency = JMR3927_TIMER_CLK; |
180 | } | 117 | } |
181 | 118 | ||
@@ -190,9 +127,6 @@ void __init plat_timer_setup(struct irqaction *irq) | |||
190 | setup_irq(JMR3927_IRQ_TICK, irq); | 127 | setup_irq(JMR3927_IRQ_TICK, irq); |
191 | } | 128 | } |
192 | 129 | ||
193 | #define USECS_PER_JIFFY (1000000/HZ) | ||
194 | |||
195 | //#undef DO_WRITE_THROUGH | ||
196 | #define DO_WRITE_THROUGH | 130 | #define DO_WRITE_THROUGH |
197 | #define DO_ENABLE_CACHE | 131 | #define DO_ENABLE_CACHE |
198 | 132 | ||
@@ -224,12 +158,6 @@ void __init plat_mem_setup(void) | |||
224 | /* Reboot on panic */ | 158 | /* Reboot on panic */ |
225 | panic_timeout = 180; | 159 | panic_timeout = 180; |
226 | 160 | ||
227 | { | ||
228 | unsigned int conf; | ||
229 | conf = read_c0_conf(); | ||
230 | } | ||
231 | |||
232 | #if 1 | ||
233 | /* cache setup */ | 161 | /* cache setup */ |
234 | { | 162 | { |
235 | unsigned int conf; | 163 | unsigned int conf; |
@@ -256,16 +184,14 @@ void __init plat_mem_setup(void) | |||
256 | write_c0_conf(conf); | 184 | write_c0_conf(conf); |
257 | write_c0_cache(0); | 185 | write_c0_cache(0); |
258 | } | 186 | } |
259 | #endif | ||
260 | 187 | ||
261 | /* initialize board */ | 188 | /* initialize board */ |
262 | jmr3927_board_init(); | 189 | jmr3927_board_init(); |
263 | 190 | ||
264 | argptr = prom_getcmdline(); | 191 | argptr = prom_getcmdline(); |
265 | 192 | ||
266 | if ((argptr = strstr(argptr, "toeon")) != NULL) { | 193 | if ((argptr = strstr(argptr, "toeon")) != NULL) |
267 | jmr3927_ccfg_toeon = 1; | 194 | jmr3927_ccfg_toeon = 1; |
268 | } | ||
269 | argptr = prom_getcmdline(); | 195 | argptr = prom_getcmdline(); |
270 | if ((argptr = strstr(argptr, "ip=")) == NULL) { | 196 | if ((argptr = strstr(argptr, "ip=")) == NULL) { |
271 | argptr = prom_getcmdline(); | 197 | argptr = prom_getcmdline(); |
@@ -281,7 +207,7 @@ void __init plat_mem_setup(void) | |||
281 | memset(&req, 0, sizeof(req)); | 207 | memset(&req, 0, sizeof(req)); |
282 | req.line = i; | 208 | req.line = i; |
283 | req.iotype = UPIO_MEM; | 209 | req.iotype = UPIO_MEM; |
284 | req.membase = (char *)TX3927_SIO_REG(i); | 210 | req.membase = (unsigned char __iomem *)TX3927_SIO_REG(i); |
285 | req.mapbase = TX3927_SIO_REG(i); | 211 | req.mapbase = TX3927_SIO_REG(i); |
286 | req.irq = i == 0 ? | 212 | req.irq = i == 0 ? |
287 | JMR3927_IRQ_IRC_SIO0 : JMR3927_IRQ_IRC_SIO1; | 213 | JMR3927_IRQ_IRC_SIO0 : JMR3927_IRQ_IRC_SIO1; |
@@ -303,65 +229,33 @@ void __init plat_mem_setup(void) | |||
303 | 229 | ||
304 | static void tx3927_setup(void); | 230 | static void tx3927_setup(void); |
305 | 231 | ||
306 | #ifdef CONFIG_PCI | ||
307 | unsigned long mips_pci_io_base; | ||
308 | unsigned long mips_pci_io_size; | ||
309 | unsigned long mips_pci_mem_base; | ||
310 | unsigned long mips_pci_mem_size; | ||
311 | /* for legacy I/O, PCI I/O PCI Bus address must be 0 */ | ||
312 | unsigned long mips_pci_io_pciaddr = 0; | ||
313 | #endif | ||
314 | |||
315 | static void __init jmr3927_board_init(void) | 232 | static void __init jmr3927_board_init(void) |
316 | { | 233 | { |
317 | char *argptr; | ||
318 | |||
319 | #ifdef CONFIG_PCI | ||
320 | mips_pci_io_base = JMR3927_PCIIO; | ||
321 | mips_pci_io_size = JMR3927_PCIIO_SIZE; | ||
322 | mips_pci_mem_base = JMR3927_PCIMEM; | ||
323 | mips_pci_mem_size = JMR3927_PCIMEM_SIZE; | ||
324 | #endif | ||
325 | |||
326 | tx3927_setup(); | 234 | tx3927_setup(); |
327 | 235 | ||
328 | if (jmr3927_have_isac()) { | ||
329 | |||
330 | #ifdef CONFIG_FB_E1355 | ||
331 | argptr = prom_getcmdline(); | ||
332 | if ((argptr = strstr(argptr, "video=")) == NULL) { | ||
333 | argptr = prom_getcmdline(); | ||
334 | strcat(argptr, " video=e1355fb:crt16h"); | ||
335 | } | ||
336 | #endif | ||
337 | |||
338 | #ifdef CONFIG_BLK_DEV_IDE | ||
339 | /* overrides PCI-IDE */ | ||
340 | #endif | ||
341 | } | ||
342 | |||
343 | /* SIO0 DTR on */ | 236 | /* SIO0 DTR on */ |
344 | jmr3927_ioc_reg_out(0, JMR3927_IOC_DTR_ADDR); | 237 | jmr3927_ioc_reg_out(0, JMR3927_IOC_DTR_ADDR); |
345 | 238 | ||
346 | jmr3927_led_set(0); | 239 | jmr3927_led_set(0); |
347 | 240 | ||
348 | |||
349 | if (jmr3927_have_isac()) | ||
350 | jmr3927_io_led_set(0); | ||
351 | printk("JMR-TX3927 (Rev %d) --- IOC(Rev %d) DIPSW:%d,%d,%d,%d\n", | 241 | printk("JMR-TX3927 (Rev %d) --- IOC(Rev %d) DIPSW:%d,%d,%d,%d\n", |
352 | jmr3927_ioc_reg_in(JMR3927_IOC_BREV_ADDR) & JMR3927_REV_MASK, | 242 | jmr3927_ioc_reg_in(JMR3927_IOC_BREV_ADDR) & JMR3927_REV_MASK, |
353 | jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_REV_MASK, | 243 | jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_REV_MASK, |
354 | jmr3927_dipsw1(), jmr3927_dipsw2(), | 244 | jmr3927_dipsw1(), jmr3927_dipsw2(), |
355 | jmr3927_dipsw3(), jmr3927_dipsw4()); | 245 | jmr3927_dipsw3(), jmr3927_dipsw4()); |
356 | if (jmr3927_have_isac()) | ||
357 | printk("JMI-3927IO2 --- ISAC(Rev %d) DIPSW:%01x\n", | ||
358 | jmr3927_isac_reg_in(JMR3927_ISAC_REV_ADDR) & JMR3927_REV_MASK, | ||
359 | jmr3927_io_dipsw()); | ||
360 | } | 246 | } |
361 | 247 | ||
362 | void __init tx3927_setup(void) | 248 | static void __init tx3927_setup(void) |
363 | { | 249 | { |
364 | int i; | 250 | int i; |
251 | #ifdef CONFIG_PCI | ||
252 | unsigned long mips_pci_io_base = JMR3927_PCIIO; | ||
253 | unsigned long mips_pci_io_size = JMR3927_PCIIO_SIZE; | ||
254 | unsigned long mips_pci_mem_base = JMR3927_PCIMEM; | ||
255 | unsigned long mips_pci_mem_size = JMR3927_PCIMEM_SIZE; | ||
256 | /* for legacy I/O, PCI I/O PCI Bus address must be 0 */ | ||
257 | unsigned long mips_pci_io_pciaddr = 0; | ||
258 | #endif | ||
365 | 259 | ||
366 | /* SDRAMC are configured by PROM */ | 260 | /* SDRAMC are configured by PROM */ |
367 | 261 | ||
@@ -475,10 +369,8 @@ void __init tx3927_setup(void) | |||
475 | tx3927_pcicptr->mbas = ~(mips_pci_mem_size - 1); | 369 | tx3927_pcicptr->mbas = ~(mips_pci_mem_size - 1); |
476 | tx3927_pcicptr->mba = 0; | 370 | tx3927_pcicptr->mba = 0; |
477 | tx3927_pcicptr->tlbmma = 0; | 371 | tx3927_pcicptr->tlbmma = 0; |
478 | #ifndef JMR3927_INIT_INDIRECT_PCI | ||
479 | /* Enable Direct mapping Address Space Decoder */ | 372 | /* Enable Direct mapping Address Space Decoder */ |
480 | tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_ILMDE | TX3927_PCIC_LBC_ILIDE; | 373 | tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_ILMDE | TX3927_PCIC_LBC_ILIDE; |
481 | #endif | ||
482 | 374 | ||
483 | /* Clear All Local Bus Status */ | 375 | /* Clear All Local Bus Status */ |
484 | tx3927_pcicptr->lbstat = TX3927_PCIC_LBIM_ALL; | 376 | tx3927_pcicptr->lbstat = TX3927_PCIC_LBIM_ALL; |
@@ -491,22 +383,15 @@ void __init tx3927_setup(void) | |||
491 | 383 | ||
492 | /* PCIC Int => IRC IRQ10 */ | 384 | /* PCIC Int => IRC IRQ10 */ |
493 | tx3927_pcicptr->il = TX3927_IR_PCI; | 385 | tx3927_pcicptr->il = TX3927_IR_PCI; |
494 | #if 1 | ||
495 | /* Target Control (per errata) */ | 386 | /* Target Control (per errata) */ |
496 | tx3927_pcicptr->tc = TX3927_PCIC_TC_OF8E | TX3927_PCIC_TC_IF8E; | 387 | tx3927_pcicptr->tc = TX3927_PCIC_TC_OF8E | TX3927_PCIC_TC_IF8E; |
497 | #endif | ||
498 | 388 | ||
499 | /* Enable Bus Arbiter */ | 389 | /* Enable Bus Arbiter */ |
500 | #if 0 | ||
501 | tx3927_pcicptr->req_trace = 0x73737373; | ||
502 | #endif | ||
503 | tx3927_pcicptr->pbapmc = TX3927_PCIC_PBAPMC_PBAEN; | 390 | tx3927_pcicptr->pbapmc = TX3927_PCIC_PBAPMC_PBAEN; |
504 | 391 | ||
505 | tx3927_pcicptr->pcicmd = PCI_COMMAND_MASTER | | 392 | tx3927_pcicptr->pcicmd = PCI_COMMAND_MASTER | |
506 | PCI_COMMAND_MEMORY | | 393 | PCI_COMMAND_MEMORY | |
507 | #if 1 | ||
508 | PCI_COMMAND_IO | | 394 | PCI_COMMAND_IO | |
509 | #endif | ||
510 | PCI_COMMAND_PARITY | PCI_COMMAND_SERR; | 395 | PCI_COMMAND_PARITY | PCI_COMMAND_SERR; |
511 | } | 396 | } |
512 | #endif /* CONFIG_PCI */ | 397 | #endif /* CONFIG_PCI */ |
@@ -555,8 +440,6 @@ static int __init jmr3927_rtc_init(void) | |||
555 | .flags = IORESOURCE_MEM, | 440 | .flags = IORESOURCE_MEM, |
556 | }; | 441 | }; |
557 | struct platform_device *dev; | 442 | struct platform_device *dev; |
558 | if (!jmr3927_have_nvram()) | ||
559 | return -ENODEV; | ||
560 | dev = platform_device_register_simple("ds1742", -1, &res, 1); | 443 | dev = platform_device_register_simple("ds1742", -1, &res, 1); |
561 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | 444 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; |
562 | } | 445 | } |