diff options
Diffstat (limited to 'arch/mips/jmr3927')
-rw-r--r-- | arch/mips/jmr3927/common/Makefile | 2 | ||||
-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/common/rtc_ds1742.c | 171 | ||||
-rw-r--r-- | arch/mips/jmr3927/rbhma3100/Makefile | 3 | ||||
-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 | 196 |
9 files changed, 94 insertions, 794 deletions
diff --git a/arch/mips/jmr3927/common/Makefile b/arch/mips/jmr3927/common/Makefile index cb09a8eede15..01e7db19bcbe 100644 --- a/arch/mips/jmr3927/common/Makefile +++ b/arch/mips/jmr3927/common/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # Makefile for the common code of TOSHIBA JMR-TX3927 board | 2 | # Makefile for the common code of TOSHIBA JMR-TX3927 board |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += prom.o puts.o rtc_ds1742.o | 5 | obj-y += prom.o puts.o |
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/common/rtc_ds1742.c b/arch/mips/jmr3927/common/rtc_ds1742.c deleted file mode 100644 index e6561345d12a..000000000000 --- a/arch/mips/jmr3927/common/rtc_ds1742.c +++ /dev/null | |||
@@ -1,171 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2001 MontaVista Software Inc. | ||
3 | * Author: MontaVista Software, Inc. | ||
4 | * ahennessy@mvista.com | ||
5 | * | ||
6 | * arch/mips/jmr3927/common/rtc_ds1742.c | ||
7 | * Based on arch/mips/ddb5xxx/common/rtc_ds1386.c | ||
8 | * low-level RTC hookups for s for Dallas 1742 chip. | ||
9 | * | ||
10 | * Copyright (C) 2000-2001 Toshiba Corporation | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | */ | ||
32 | |||
33 | |||
34 | /* | ||
35 | * This file exports a function, rtc_ds1386_init(), which expects an | ||
36 | * uncached base address as the argument. It will set the two function | ||
37 | * pointers expected by the MIPS generic timer code. | ||
38 | */ | ||
39 | |||
40 | #include <linux/bcd.h> | ||
41 | #include <linux/types.h> | ||
42 | #include <linux/time.h> | ||
43 | #include <linux/rtc.h> | ||
44 | #include <linux/ds1742rtc.h> | ||
45 | |||
46 | #include <asm/time.h> | ||
47 | #include <asm/addrspace.h> | ||
48 | |||
49 | #include <asm/debug.h> | ||
50 | |||
51 | #define EPOCH 2000 | ||
52 | |||
53 | static unsigned long rtc_base; | ||
54 | |||
55 | static unsigned long | ||
56 | rtc_ds1742_get_time(void) | ||
57 | { | ||
58 | unsigned int year, month, day, hour, minute, second; | ||
59 | unsigned int century; | ||
60 | unsigned long flags; | ||
61 | |||
62 | spin_lock_irqsave(&rtc_lock, flags); | ||
63 | rtc_write(RTC_READ, RTC_CONTROL); | ||
64 | second = BCD2BIN(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK); | ||
65 | minute = BCD2BIN(rtc_read(RTC_MINUTES)); | ||
66 | hour = BCD2BIN(rtc_read(RTC_HOURS)); | ||
67 | day = BCD2BIN(rtc_read(RTC_DATE)); | ||
68 | month = BCD2BIN(rtc_read(RTC_MONTH)); | ||
69 | year = BCD2BIN(rtc_read(RTC_YEAR)); | ||
70 | century = BCD2BIN(rtc_read(RTC_CENTURY) & RTC_CENTURY_MASK); | ||
71 | rtc_write(0, RTC_CONTROL); | ||
72 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
73 | |||
74 | year += century * 100; | ||
75 | |||
76 | return mktime(year, month, day, hour, minute, second); | ||
77 | } | ||
78 | extern void to_tm(unsigned long tim, struct rtc_time * tm); | ||
79 | |||
80 | static int | ||
81 | rtc_ds1742_set_time(unsigned long t) | ||
82 | { | ||
83 | struct rtc_time tm; | ||
84 | u8 year, month, day, hour, minute, second; | ||
85 | u8 cmos_year, cmos_month, cmos_day, cmos_hour, cmos_minute, cmos_second; | ||
86 | int cmos_century; | ||
87 | unsigned long flags; | ||
88 | |||
89 | spin_lock_irqsave(&rtc_lock, flags); | ||
90 | rtc_write(RTC_READ, RTC_CONTROL); | ||
91 | cmos_second = (u8)(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK); | ||
92 | cmos_minute = (u8)rtc_read(RTC_MINUTES); | ||
93 | cmos_hour = (u8)rtc_read(RTC_HOURS); | ||
94 | cmos_day = (u8)rtc_read(RTC_DATE); | ||
95 | cmos_month = (u8)rtc_read(RTC_MONTH); | ||
96 | cmos_year = (u8)rtc_read(RTC_YEAR); | ||
97 | cmos_century = rtc_read(RTC_CENTURY) & RTC_CENTURY_MASK; | ||
98 | |||
99 | rtc_write(RTC_WRITE, RTC_CONTROL); | ||
100 | |||
101 | /* convert */ | ||
102 | to_tm(t, &tm); | ||
103 | |||
104 | /* check each field one by one */ | ||
105 | year = BIN2BCD(tm.tm_year - EPOCH); | ||
106 | if (year != cmos_year) { | ||
107 | rtc_write(year,RTC_YEAR); | ||
108 | } | ||
109 | |||
110 | month = BIN2BCD(tm.tm_mon); | ||
111 | if (month != (cmos_month & 0x1f)) { | ||
112 | rtc_write((month & 0x1f) | (cmos_month & ~0x1f),RTC_MONTH); | ||
113 | } | ||
114 | |||
115 | day = BIN2BCD(tm.tm_mday); | ||
116 | if (day != cmos_day) { | ||
117 | |||
118 | rtc_write(day, RTC_DATE); | ||
119 | } | ||
120 | |||
121 | if (cmos_hour & 0x40) { | ||
122 | /* 12 hour format */ | ||
123 | hour = 0x40; | ||
124 | if (tm.tm_hour > 12) { | ||
125 | hour |= 0x20 | (BIN2BCD(hour-12) & 0x1f); | ||
126 | } else { | ||
127 | hour |= BIN2BCD(tm.tm_hour); | ||
128 | } | ||
129 | } else { | ||
130 | /* 24 hour format */ | ||
131 | hour = BIN2BCD(tm.tm_hour) & 0x3f; | ||
132 | } | ||
133 | if (hour != cmos_hour) rtc_write(hour, RTC_HOURS); | ||
134 | |||
135 | minute = BIN2BCD(tm.tm_min); | ||
136 | if (minute != cmos_minute) { | ||
137 | rtc_write(minute, RTC_MINUTES); | ||
138 | } | ||
139 | |||
140 | second = BIN2BCD(tm.tm_sec); | ||
141 | if (second != cmos_second) { | ||
142 | rtc_write(second & RTC_SECONDS_MASK,RTC_SECONDS); | ||
143 | } | ||
144 | |||
145 | /* RTC_CENTURY and RTC_CONTROL share same address... */ | ||
146 | rtc_write(cmos_century, RTC_CONTROL); | ||
147 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | void | ||
153 | rtc_ds1742_init(unsigned long base) | ||
154 | { | ||
155 | u8 cmos_second; | ||
156 | |||
157 | /* remember the base */ | ||
158 | rtc_base = base; | ||
159 | db_assert((rtc_base & 0xe0000000) == KSEG1); | ||
160 | |||
161 | /* set the function pointers */ | ||
162 | rtc_mips_get_time = rtc_ds1742_get_time; | ||
163 | rtc_mips_set_time = rtc_ds1742_set_time; | ||
164 | |||
165 | /* clear oscillator stop bit */ | ||
166 | rtc_write(RTC_READ, RTC_CONTROL); | ||
167 | cmos_second = (u8)(rtc_read(RTC_SECONDS) & RTC_SECONDS_MASK); | ||
168 | rtc_write(RTC_WRITE, RTC_CONTROL); | ||
169 | rtc_write(cmos_second, RTC_SECONDS); /* clear msb */ | ||
170 | rtc_write(0, RTC_CONTROL); | ||
171 | } | ||
diff --git a/arch/mips/jmr3927/rbhma3100/Makefile b/arch/mips/jmr3927/rbhma3100/Makefile index baf5077813c1..8d00ba460cef 100644 --- a/arch/mips/jmr3927/rbhma3100/Makefile +++ b/arch/mips/jmr3927/rbhma3100/Makefile | |||
@@ -3,7 +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 |
8 | |||
9 | EXTRA_AFLAGS := $(CFLAGS) | ||
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 7ca3d6d07b34..d1ef2895d564 100644 --- a/arch/mips/jmr3927/rbhma3100/setup.c +++ b/arch/mips/jmr3927/rbhma3100/setup.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/param.h> /* for HZ */ | 45 | #include <linux/param.h> /* for HZ */ |
46 | #include <linux/delay.h> | 46 | #include <linux/delay.h> |
47 | #include <linux/pm.h> | 47 | #include <linux/pm.h> |
48 | #include <linux/platform_device.h> | ||
48 | #ifdef CONFIG_SERIAL_TXX9 | 49 | #ifdef CONFIG_SERIAL_TXX9 |
49 | #include <linux/tty.h> | 50 | #include <linux/tty.h> |
50 | #include <linux/serial.h> | 51 | #include <linux/serial.h> |
@@ -53,94 +54,21 @@ | |||
53 | 54 | ||
54 | #include <asm/addrspace.h> | 55 | #include <asm/addrspace.h> |
55 | #include <asm/time.h> | 56 | #include <asm/time.h> |
56 | #include <asm/bcache.h> | ||
57 | #include <asm/irq.h> | ||
58 | #include <asm/reboot.h> | 57 | #include <asm/reboot.h> |
59 | #include <asm/gdb-stub.h> | ||
60 | #include <asm/jmr3927/jmr3927.h> | 58 | #include <asm/jmr3927/jmr3927.h> |
61 | #include <asm/mipsregs.h> | 59 | #include <asm/mipsregs.h> |
62 | #include <asm/traps.h> | ||
63 | 60 | ||
64 | extern void puts(unsigned char *cp); | 61 | extern void puts(const char *cp); |
65 | 62 | ||
66 | /* Tick Timer divider */ | 63 | /* Tick Timer divider */ |
67 | #define JMR3927_TIMER_CCD 0 /* 1/2 */ | 64 | #define JMR3927_TIMER_CCD 0 /* 1/2 */ |
68 | #define JMR3927_TIMER_CLK (JMR3927_IMCLK / (2 << JMR3927_TIMER_CCD)) | 65 | #define JMR3927_TIMER_CLK (JMR3927_IMCLK / (2 << JMR3927_TIMER_CCD)) |
69 | 66 | ||
70 | unsigned char led_state = 0xf; | ||
71 | |||
72 | struct { | ||
73 | struct resource ram0; | ||
74 | struct resource ram1; | ||
75 | struct resource pcimem; | ||
76 | struct resource iob; | ||
77 | struct resource ioc; | ||
78 | struct resource pciio; | ||
79 | struct resource jmy1394; | ||
80 | struct resource rom1; | ||
81 | struct resource rom0; | ||
82 | struct resource sio0; | ||
83 | struct resource sio1; | ||
84 | } jmr3927_resources = { | ||
85 | { | ||
86 | .start = 0, | ||
87 | .end = 0x01FFFFFF, | ||
88 | .name = "RAM0", | ||
89 | .flags = IORESOURCE_MEM | ||
90 | }, { | ||
91 | .start = 0x02000000, | ||
92 | .end = 0x03FFFFFF, | ||
93 | .name = "RAM1", | ||
94 | .flags = IORESOURCE_MEM | ||
95 | }, { | ||
96 | .start = 0x08000000, | ||
97 | .end = 0x07FFFFFF, | ||
98 | .name = "PCIMEM", | ||
99 | .flags = IORESOURCE_MEM | ||
100 | }, { | ||
101 | .start = 0x10000000, | ||
102 | .end = 0x13FFFFFF, | ||
103 | .name = "IOB" | ||
104 | }, { | ||
105 | .start = 0x14000000, | ||
106 | .end = 0x14FFFFFF, | ||
107 | .name = "IOC" | ||
108 | }, { | ||
109 | .start = 0x15000000, | ||
110 | .end = 0x15FFFFFF, | ||
111 | .name = "PCIIO" | ||
112 | }, { | ||
113 | .start = 0x1D000000, | ||
114 | .end = 0x1D3FFFFF, | ||
115 | .name = "JMY1394" | ||
116 | }, { | ||
117 | .start = 0x1E000000, | ||
118 | .end = 0x1E3FFFFF, | ||
119 | .name = "ROM1" | ||
120 | }, { | ||
121 | .start = 0x1FC00000, | ||
122 | .end = 0x1FFFFFFF, | ||
123 | .name = "ROM0" | ||
124 | }, { | ||
125 | .start = 0xFFFEF300, | ||
126 | .end = 0xFFFEF3FF, | ||
127 | .name = "SIO0" | ||
128 | }, { | ||
129 | .start = 0xFFFEF400, | ||
130 | .end = 0xFFFEF4FF, | ||
131 | .name = "SIO1" | ||
132 | }, | ||
133 | }; | ||
134 | |||
135 | /* don't enable - see errata */ | 67 | /* don't enable - see errata */ |
136 | int jmr3927_ccfg_toeon = 0; | 68 | static int jmr3927_ccfg_toeon; |
137 | 69 | ||
138 | static inline void do_reset(void) | 70 | static inline void do_reset(void) |
139 | { | 71 | { |
140 | #ifdef CONFIG_TC35815 | ||
141 | extern void tc35815_killall(void); | ||
142 | tc35815_killall(); | ||
143 | #endif | ||
144 | #if 1 /* Resetting PCI bus */ | 72 | #if 1 /* Resetting PCI bus */ |
145 | jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR); | 73 | jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR); |
146 | jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR); | 74 | jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR); |
@@ -176,19 +104,16 @@ static cycle_t jmr3927_hpt_read(void) | |||
176 | return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr; | 104 | return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr; |
177 | } | 105 | } |
178 | 106 | ||
179 | #define USE_RTC_DS1742 | 107 | static void jmr3927_timer_ack(void) |
180 | #ifdef USE_RTC_DS1742 | 108 | { |
181 | extern void rtc_ds1742_init(unsigned long base); | 109 | jmr3927_tmrptr->tisr = 0; /* ack interrupt */ |
182 | #endif | 110 | } |
111 | |||
183 | static void __init jmr3927_time_init(void) | 112 | static void __init jmr3927_time_init(void) |
184 | { | 113 | { |
185 | clocksource_mips.read = jmr3927_hpt_read; | 114 | clocksource_mips.read = jmr3927_hpt_read; |
115 | mips_timer_ack = jmr3927_timer_ack; | ||
186 | mips_hpt_frequency = JMR3927_TIMER_CLK; | 116 | mips_hpt_frequency = JMR3927_TIMER_CLK; |
187 | #ifdef USE_RTC_DS1742 | ||
188 | if (jmr3927_have_nvram()) { | ||
189 | rtc_ds1742_init(JMR3927_IOC_NVRAMB_ADDR); | ||
190 | } | ||
191 | #endif | ||
192 | } | 117 | } |
193 | 118 | ||
194 | void __init plat_timer_setup(struct irqaction *irq) | 119 | void __init plat_timer_setup(struct irqaction *irq) |
@@ -202,9 +127,6 @@ void __init plat_timer_setup(struct irqaction *irq) | |||
202 | setup_irq(JMR3927_IRQ_TICK, irq); | 127 | setup_irq(JMR3927_IRQ_TICK, irq); |
203 | } | 128 | } |
204 | 129 | ||
205 | #define USECS_PER_JIFFY (1000000/HZ) | ||
206 | |||
207 | //#undef DO_WRITE_THROUGH | ||
208 | #define DO_WRITE_THROUGH | 130 | #define DO_WRITE_THROUGH |
209 | #define DO_ENABLE_CACHE | 131 | #define DO_ENABLE_CACHE |
210 | 132 | ||
@@ -236,12 +158,6 @@ void __init plat_mem_setup(void) | |||
236 | /* Reboot on panic */ | 158 | /* Reboot on panic */ |
237 | panic_timeout = 180; | 159 | panic_timeout = 180; |
238 | 160 | ||
239 | { | ||
240 | unsigned int conf; | ||
241 | conf = read_c0_conf(); | ||
242 | } | ||
243 | |||
244 | #if 1 | ||
245 | /* cache setup */ | 161 | /* cache setup */ |
246 | { | 162 | { |
247 | unsigned int conf; | 163 | unsigned int conf; |
@@ -268,16 +184,14 @@ void __init plat_mem_setup(void) | |||
268 | write_c0_conf(conf); | 184 | write_c0_conf(conf); |
269 | write_c0_cache(0); | 185 | write_c0_cache(0); |
270 | } | 186 | } |
271 | #endif | ||
272 | 187 | ||
273 | /* initialize board */ | 188 | /* initialize board */ |
274 | jmr3927_board_init(); | 189 | jmr3927_board_init(); |
275 | 190 | ||
276 | argptr = prom_getcmdline(); | 191 | argptr = prom_getcmdline(); |
277 | 192 | ||
278 | if ((argptr = strstr(argptr, "toeon")) != NULL) { | 193 | if ((argptr = strstr(argptr, "toeon")) != NULL) |
279 | jmr3927_ccfg_toeon = 1; | 194 | jmr3927_ccfg_toeon = 1; |
280 | } | ||
281 | argptr = prom_getcmdline(); | 195 | argptr = prom_getcmdline(); |
282 | if ((argptr = strstr(argptr, "ip=")) == NULL) { | 196 | if ((argptr = strstr(argptr, "ip=")) == NULL) { |
283 | argptr = prom_getcmdline(); | 197 | argptr = prom_getcmdline(); |
@@ -293,7 +207,7 @@ void __init plat_mem_setup(void) | |||
293 | memset(&req, 0, sizeof(req)); | 207 | memset(&req, 0, sizeof(req)); |
294 | req.line = i; | 208 | req.line = i; |
295 | req.iotype = UPIO_MEM; | 209 | req.iotype = UPIO_MEM; |
296 | req.membase = (char *)TX3927_SIO_REG(i); | 210 | req.membase = (unsigned char __iomem *)TX3927_SIO_REG(i); |
297 | req.mapbase = TX3927_SIO_REG(i); | 211 | req.mapbase = TX3927_SIO_REG(i); |
298 | req.irq = i == 0 ? | 212 | req.irq = i == 0 ? |
299 | JMR3927_IRQ_IRC_SIO0 : JMR3927_IRQ_IRC_SIO1; | 213 | JMR3927_IRQ_IRC_SIO0 : JMR3927_IRQ_IRC_SIO1; |
@@ -315,65 +229,33 @@ void __init plat_mem_setup(void) | |||
315 | 229 | ||
316 | static void tx3927_setup(void); | 230 | static void tx3927_setup(void); |
317 | 231 | ||
318 | #ifdef CONFIG_PCI | ||
319 | unsigned long mips_pci_io_base; | ||
320 | unsigned long mips_pci_io_size; | ||
321 | unsigned long mips_pci_mem_base; | ||
322 | unsigned long mips_pci_mem_size; | ||
323 | /* for legacy I/O, PCI I/O PCI Bus address must be 0 */ | ||
324 | unsigned long mips_pci_io_pciaddr = 0; | ||
325 | #endif | ||
326 | |||
327 | static void __init jmr3927_board_init(void) | 232 | static void __init jmr3927_board_init(void) |
328 | { | 233 | { |
329 | char *argptr; | ||
330 | |||
331 | #ifdef CONFIG_PCI | ||
332 | mips_pci_io_base = JMR3927_PCIIO; | ||
333 | mips_pci_io_size = JMR3927_PCIIO_SIZE; | ||
334 | mips_pci_mem_base = JMR3927_PCIMEM; | ||
335 | mips_pci_mem_size = JMR3927_PCIMEM_SIZE; | ||
336 | #endif | ||
337 | |||
338 | tx3927_setup(); | 234 | tx3927_setup(); |
339 | 235 | ||
340 | if (jmr3927_have_isac()) { | ||
341 | |||
342 | #ifdef CONFIG_FB_E1355 | ||
343 | argptr = prom_getcmdline(); | ||
344 | if ((argptr = strstr(argptr, "video=")) == NULL) { | ||
345 | argptr = prom_getcmdline(); | ||
346 | strcat(argptr, " video=e1355fb:crt16h"); | ||
347 | } | ||
348 | #endif | ||
349 | |||
350 | #ifdef CONFIG_BLK_DEV_IDE | ||
351 | /* overrides PCI-IDE */ | ||
352 | #endif | ||
353 | } | ||
354 | |||
355 | /* SIO0 DTR on */ | 236 | /* SIO0 DTR on */ |
356 | jmr3927_ioc_reg_out(0, JMR3927_IOC_DTR_ADDR); | 237 | jmr3927_ioc_reg_out(0, JMR3927_IOC_DTR_ADDR); |
357 | 238 | ||
358 | jmr3927_led_set(0); | 239 | jmr3927_led_set(0); |
359 | 240 | ||
360 | |||
361 | if (jmr3927_have_isac()) | ||
362 | jmr3927_io_led_set(0); | ||
363 | 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", |
364 | jmr3927_ioc_reg_in(JMR3927_IOC_BREV_ADDR) & JMR3927_REV_MASK, | 242 | jmr3927_ioc_reg_in(JMR3927_IOC_BREV_ADDR) & JMR3927_REV_MASK, |
365 | jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_REV_MASK, | 243 | jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_REV_MASK, |
366 | jmr3927_dipsw1(), jmr3927_dipsw2(), | 244 | jmr3927_dipsw1(), jmr3927_dipsw2(), |
367 | jmr3927_dipsw3(), jmr3927_dipsw4()); | 245 | jmr3927_dipsw3(), jmr3927_dipsw4()); |
368 | if (jmr3927_have_isac()) | ||
369 | printk("JMI-3927IO2 --- ISAC(Rev %d) DIPSW:%01x\n", | ||
370 | jmr3927_isac_reg_in(JMR3927_ISAC_REV_ADDR) & JMR3927_REV_MASK, | ||
371 | jmr3927_io_dipsw()); | ||
372 | } | 246 | } |
373 | 247 | ||
374 | void __init tx3927_setup(void) | 248 | static void __init tx3927_setup(void) |
375 | { | 249 | { |
376 | 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 | ||
377 | 259 | ||
378 | /* SDRAMC are configured by PROM */ | 260 | /* SDRAMC are configured by PROM */ |
379 | 261 | ||
@@ -487,10 +369,8 @@ void __init tx3927_setup(void) | |||
487 | tx3927_pcicptr->mbas = ~(mips_pci_mem_size - 1); | 369 | tx3927_pcicptr->mbas = ~(mips_pci_mem_size - 1); |
488 | tx3927_pcicptr->mba = 0; | 370 | tx3927_pcicptr->mba = 0; |
489 | tx3927_pcicptr->tlbmma = 0; | 371 | tx3927_pcicptr->tlbmma = 0; |
490 | #ifndef JMR3927_INIT_INDIRECT_PCI | ||
491 | /* Enable Direct mapping Address Space Decoder */ | 372 | /* Enable Direct mapping Address Space Decoder */ |
492 | tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_ILMDE | TX3927_PCIC_LBC_ILIDE; | 373 | tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_ILMDE | TX3927_PCIC_LBC_ILIDE; |
493 | #endif | ||
494 | 374 | ||
495 | /* Clear All Local Bus Status */ | 375 | /* Clear All Local Bus Status */ |
496 | tx3927_pcicptr->lbstat = TX3927_PCIC_LBIM_ALL; | 376 | tx3927_pcicptr->lbstat = TX3927_PCIC_LBIM_ALL; |
@@ -503,22 +383,15 @@ void __init tx3927_setup(void) | |||
503 | 383 | ||
504 | /* PCIC Int => IRC IRQ10 */ | 384 | /* PCIC Int => IRC IRQ10 */ |
505 | tx3927_pcicptr->il = TX3927_IR_PCI; | 385 | tx3927_pcicptr->il = TX3927_IR_PCI; |
506 | #if 1 | ||
507 | /* Target Control (per errata) */ | 386 | /* Target Control (per errata) */ |
508 | tx3927_pcicptr->tc = TX3927_PCIC_TC_OF8E | TX3927_PCIC_TC_IF8E; | 387 | tx3927_pcicptr->tc = TX3927_PCIC_TC_OF8E | TX3927_PCIC_TC_IF8E; |
509 | #endif | ||
510 | 388 | ||
511 | /* Enable Bus Arbiter */ | 389 | /* Enable Bus Arbiter */ |
512 | #if 0 | ||
513 | tx3927_pcicptr->req_trace = 0x73737373; | ||
514 | #endif | ||
515 | tx3927_pcicptr->pbapmc = TX3927_PCIC_PBAPMC_PBAEN; | 390 | tx3927_pcicptr->pbapmc = TX3927_PCIC_PBAPMC_PBAEN; |
516 | 391 | ||
517 | tx3927_pcicptr->pcicmd = PCI_COMMAND_MASTER | | 392 | tx3927_pcicptr->pcicmd = PCI_COMMAND_MASTER | |
518 | PCI_COMMAND_MEMORY | | 393 | PCI_COMMAND_MEMORY | |
519 | #if 1 | ||
520 | PCI_COMMAND_IO | | 394 | PCI_COMMAND_IO | |
521 | #endif | ||
522 | PCI_COMMAND_PARITY | PCI_COMMAND_SERR; | 395 | PCI_COMMAND_PARITY | PCI_COMMAND_SERR; |
523 | } | 396 | } |
524 | #endif /* CONFIG_PCI */ | 397 | #endif /* CONFIG_PCI */ |
@@ -544,3 +417,30 @@ void __init tx3927_setup(void) | |||
544 | printk("TX3927 D-Cache WriteBack (CWF) .\n"); | 417 | printk("TX3927 D-Cache WriteBack (CWF) .\n"); |
545 | } | 418 | } |
546 | } | 419 | } |
420 | |||
421 | /* This trick makes rtc-ds1742 driver usable as is. */ | ||
422 | unsigned long __swizzle_addr_b(unsigned long port) | ||
423 | { | ||
424 | if ((port & 0xffff0000) != JMR3927_IOC_NVRAMB_ADDR) | ||
425 | return port; | ||
426 | port = (port & 0xffff0000) | (port & 0x7fff << 1); | ||
427 | #ifdef __BIG_ENDIAN | ||
428 | return port; | ||
429 | #else | ||
430 | return port | 1; | ||
431 | #endif | ||
432 | } | ||
433 | EXPORT_SYMBOL(__swizzle_addr_b); | ||
434 | |||
435 | static int __init jmr3927_rtc_init(void) | ||
436 | { | ||
437 | struct resource res = { | ||
438 | .start = JMR3927_IOC_NVRAMB_ADDR - IO_BASE, | ||
439 | .end = JMR3927_IOC_NVRAMB_ADDR - IO_BASE + 0x800 - 1, | ||
440 | .flags = IORESOURCE_MEM, | ||
441 | }; | ||
442 | struct platform_device *dev; | ||
443 | dev = platform_device_register_simple("ds1742", -1, &res, 1); | ||
444 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | ||
445 | } | ||
446 | device_initcall(jmr3927_rtc_init); | ||