diff options
-rw-r--r-- | arch/m68k/Kconfig | 6 | ||||
-rw-r--r-- | arch/m68k/configs/mac_defconfig | 2 | ||||
-rw-r--r-- | arch/m68k/configs/multi_defconfig | 1 | ||||
-rw-r--r-- | arch/m68k/include/asm/machw.h | 25 | ||||
-rw-r--r-- | arch/m68k/include/asm/macints.h | 22 | ||||
-rw-r--r-- | arch/m68k/mac/Makefile | 2 | ||||
-rw-r--r-- | arch/m68k/mac/config.c | 51 | ||||
-rw-r--r-- | arch/m68k/mac/debug.c | 365 | ||||
-rw-r--r-- | arch/m68k/mac/macints.c | 101 | ||||
-rw-r--r-- | arch/m68k/mac/oss.c | 20 | ||||
-rw-r--r-- | arch/m68k/mac/via.c | 7 |
11 files changed, 80 insertions, 522 deletions
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index ecdc19a299b2..b5da298ba61d 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -536,10 +536,6 @@ config GVPIOEXT_PLIP | |||
536 | Say Y to enable doing IP over the parallel port on your GVP | 536 | Say Y to enable doing IP over the parallel port on your GVP |
537 | IO-Extender card, N otherwise. | 537 | IO-Extender card, N otherwise. |
538 | 538 | ||
539 | config MAC_SCC | ||
540 | tristate "Macintosh serial support" | ||
541 | depends on MAC | ||
542 | |||
543 | config MAC_HID | 539 | config MAC_HID |
544 | bool | 540 | bool |
545 | depends on INPUT_ADBHID | 541 | depends on INPUT_ADBHID |
@@ -595,7 +591,7 @@ config DN_SERIAL | |||
595 | 591 | ||
596 | config SERIAL_CONSOLE | 592 | config SERIAL_CONSOLE |
597 | bool "Support for serial port console" | 593 | bool "Support for serial port console" |
598 | depends on (AMIGA || ATARI || MAC || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || MAC_SCC=y || AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y || SERIAL=y || MVME147_SCC || SERIAL167 || MVME162_SCC || BVME6000_SCC || DN_SERIAL) | 594 | depends on (AMIGA || ATARI || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y || SERIAL=y || MVME147_SCC || SERIAL167 || MVME162_SCC || BVME6000_SCC || DN_SERIAL) |
599 | ---help--- | 595 | ---help--- |
600 | If you say Y here, it will be possible to use a serial port as the | 596 | If you say Y here, it will be possible to use a serial port as the |
601 | system console (the system console is the device which receives all | 597 | system console (the system console is the device which receives all |
diff --git a/arch/m68k/configs/mac_defconfig b/arch/m68k/configs/mac_defconfig index 3cbbf880a9e3..c5f3232ff916 100644 --- a/arch/m68k/configs/mac_defconfig +++ b/arch/m68k/configs/mac_defconfig | |||
@@ -839,9 +839,7 @@ CONFIG_HIDRAW=y | |||
839 | # | 839 | # |
840 | # Character devices | 840 | # Character devices |
841 | # | 841 | # |
842 | CONFIG_MAC_SCC=y | ||
843 | CONFIG_MAC_HID=y | 842 | CONFIG_MAC_HID=y |
844 | CONFIG_SERIAL_CONSOLE=y | ||
845 | 843 | ||
846 | # | 844 | # |
847 | # File systems | 845 | # File systems |
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig index 8a2371933beb..a8bfa3fa71cf 100644 --- a/arch/m68k/configs/multi_defconfig +++ b/arch/m68k/configs/multi_defconfig | |||
@@ -987,7 +987,6 @@ CONFIG_ATARI_MIDI=y | |||
987 | CONFIG_ATARI_DSP56K=m | 987 | CONFIG_ATARI_DSP56K=m |
988 | CONFIG_AMIGA_BUILTIN_SERIAL=y | 988 | CONFIG_AMIGA_BUILTIN_SERIAL=y |
989 | CONFIG_MULTIFACE_III_TTY=m | 989 | CONFIG_MULTIFACE_III_TTY=m |
990 | CONFIG_MAC_SCC=y | ||
991 | CONFIG_MAC_HID=y | 990 | CONFIG_MAC_HID=y |
992 | CONFIG_MVME147_SCC=y | 991 | CONFIG_MVME147_SCC=y |
993 | CONFIG_SERIAL167=y | 992 | CONFIG_SERIAL167=y |
diff --git a/arch/m68k/include/asm/machw.h b/arch/m68k/include/asm/machw.h index 2b4de0c2ce4a..a22095164927 100644 --- a/arch/m68k/include/asm/machw.h +++ b/arch/m68k/include/asm/machw.h | |||
@@ -21,29 +21,4 @@ | |||
21 | #define VIDEOMEMSIZE (4096*1024) | 21 | #define VIDEOMEMSIZE (4096*1024) |
22 | #define VIDEOMEMMASK (-4096*1024) | 22 | #define VIDEOMEMMASK (-4096*1024) |
23 | 23 | ||
24 | #ifndef __ASSEMBLY__ | ||
25 | |||
26 | #include <linux/types.h> | ||
27 | |||
28 | #if 0 | ||
29 | /* | ||
30 | ** SCC Z8530 | ||
31 | */ | ||
32 | |||
33 | #define MAC_SCC_BAS (0x50F04000) | ||
34 | struct MAC_SCC | ||
35 | { | ||
36 | u_char cha_a_ctrl; | ||
37 | u_char char_dummy1; | ||
38 | u_char cha_a_data; | ||
39 | u_char char_dummy2; | ||
40 | u_char cha_b_ctrl; | ||
41 | u_char char_dummy3; | ||
42 | u_char cha_b_data; | ||
43 | }; | ||
44 | # define mac_scc ((*(volatile struct SCC*)MAC_SCC_BAS)) | ||
45 | #endif | ||
46 | |||
47 | #endif /* __ASSEMBLY__ */ | ||
48 | |||
49 | #endif /* linux/machw.h */ | 24 | #endif /* linux/machw.h */ |
diff --git a/arch/m68k/include/asm/macints.h b/arch/m68k/include/asm/macints.h index 679c48ab4407..ebe1b70fe90c 100644 --- a/arch/m68k/include/asm/macints.h +++ b/arch/m68k/include/asm/macints.h | |||
@@ -37,7 +37,6 @@ | |||
37 | 37 | ||
38 | #define VIA1_SOURCE_BASE 8 | 38 | #define VIA1_SOURCE_BASE 8 |
39 | #define VIA2_SOURCE_BASE 16 | 39 | #define VIA2_SOURCE_BASE 16 |
40 | #define MAC_SCC_SOURCE_BASE 24 | ||
41 | #define PSC3_SOURCE_BASE 24 | 40 | #define PSC3_SOURCE_BASE 24 |
42 | #define PSC4_SOURCE_BASE 32 | 41 | #define PSC4_SOURCE_BASE 32 |
43 | #define PSC5_SOURCE_BASE 40 | 42 | #define PSC5_SOURCE_BASE 40 |
@@ -96,26 +95,12 @@ | |||
96 | #define IRQ_PSC3_2 (26) | 95 | #define IRQ_PSC3_2 (26) |
97 | #define IRQ_PSC3_3 (27) | 96 | #define IRQ_PSC3_3 (27) |
98 | 97 | ||
99 | /* Level 4 (SCC) interrupts */ | ||
100 | #define IRQ_SCC (32) | ||
101 | #define IRQ_SCCA (33) | ||
102 | #define IRQ_SCCB (34) | ||
103 | #if 0 /* FIXME: are there multiple interrupt conditions on the SCC ?? */ | ||
104 | /* SCC interrupts */ | ||
105 | #define IRQ_SCCB_TX (32) | ||
106 | #define IRQ_SCCB_STAT (33) | ||
107 | #define IRQ_SCCB_RX (34) | ||
108 | #define IRQ_SCCB_SPCOND (35) | ||
109 | #define IRQ_SCCA_TX (36) | ||
110 | #define IRQ_SCCA_STAT (37) | ||
111 | #define IRQ_SCCA_RX (38) | ||
112 | #define IRQ_SCCA_SPCOND (39) | ||
113 | #endif | ||
114 | |||
115 | /* Level 4 (PSC, AV Macs only) interrupts */ | 98 | /* Level 4 (PSC, AV Macs only) interrupts */ |
116 | #define IRQ_PSC4_0 (32) | 99 | #define IRQ_PSC4_0 (32) |
117 | #define IRQ_PSC4_1 (33) | 100 | #define IRQ_PSC4_1 (33) |
101 | #define IRQ_MAC_SCC_A IRQ_PSC4_1 | ||
118 | #define IRQ_PSC4_2 (34) | 102 | #define IRQ_PSC4_2 (34) |
103 | #define IRQ_MAC_SCC_B IRQ_PSC4_2 | ||
119 | #define IRQ_PSC4_3 (35) | 104 | #define IRQ_PSC4_3 (35) |
120 | #define IRQ_MAC_MACE_DMA IRQ_PSC4_3 | 105 | #define IRQ_MAC_MACE_DMA IRQ_PSC4_3 |
121 | 106 | ||
@@ -146,6 +131,9 @@ | |||
146 | #define IRQ_BABOON_2 (66) | 131 | #define IRQ_BABOON_2 (66) |
147 | #define IRQ_BABOON_3 (67) | 132 | #define IRQ_BABOON_3 (67) |
148 | 133 | ||
134 | /* On non-PSC machines, the serial ports share an IRQ */ | ||
135 | #define IRQ_MAC_SCC IRQ_AUTO_4 | ||
136 | |||
149 | #define SLOT2IRQ(x) (x + 47) | 137 | #define SLOT2IRQ(x) (x + 47) |
150 | #define IRQ2SLOT(x) (x - 47) | 138 | #define IRQ2SLOT(x) (x - 47) |
151 | 139 | ||
diff --git a/arch/m68k/mac/Makefile b/arch/m68k/mac/Makefile index daebd80bdef0..b8d4c835f9a2 100644 --- a/arch/m68k/mac/Makefile +++ b/arch/m68k/mac/Makefile | |||
@@ -3,4 +3,4 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := config.o macints.o iop.o via.o oss.o psc.o \ | 5 | obj-y := config.o macints.o iop.o via.o oss.o psc.o \ |
6 | baboon.o macboing.o debug.o misc.o | 6 | baboon.o macboing.o misc.o |
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index e6666a30f24b..c8a4c39cef56 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -792,6 +792,32 @@ static struct mac_model mac_data_table[] = { | |||
792 | } | 792 | } |
793 | }; | 793 | }; |
794 | 794 | ||
795 | static struct resource scc_a_rsrcs[] = { | ||
796 | { .flags = IORESOURCE_MEM }, | ||
797 | { .flags = IORESOURCE_IRQ }, | ||
798 | }; | ||
799 | |||
800 | static struct resource scc_b_rsrcs[] = { | ||
801 | { .flags = IORESOURCE_MEM }, | ||
802 | { .flags = IORESOURCE_IRQ }, | ||
803 | }; | ||
804 | |||
805 | struct platform_device scc_a_pdev = { | ||
806 | .name = "scc", | ||
807 | .id = 0, | ||
808 | .num_resources = ARRAY_SIZE(scc_a_rsrcs), | ||
809 | .resource = scc_a_rsrcs, | ||
810 | }; | ||
811 | EXPORT_SYMBOL(scc_a_pdev); | ||
812 | |||
813 | struct platform_device scc_b_pdev = { | ||
814 | .name = "scc", | ||
815 | .id = 1, | ||
816 | .num_resources = ARRAY_SIZE(scc_b_rsrcs), | ||
817 | .resource = scc_b_rsrcs, | ||
818 | }; | ||
819 | EXPORT_SYMBOL(scc_b_pdev); | ||
820 | |||
795 | static void __init mac_identify(void) | 821 | static void __init mac_identify(void) |
796 | { | 822 | { |
797 | struct mac_model *m; | 823 | struct mac_model *m; |
@@ -814,6 +840,24 @@ static void __init mac_identify(void) | |||
814 | } | 840 | } |
815 | } | 841 | } |
816 | 842 | ||
843 | /* Set up serial port resources for the console initcall. */ | ||
844 | |||
845 | scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2; | ||
846 | scc_a_rsrcs[0].end = scc_a_rsrcs[0].start; | ||
847 | scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase; | ||
848 | scc_b_rsrcs[0].end = scc_b_rsrcs[0].start; | ||
849 | |||
850 | switch (macintosh_config->scc_type) { | ||
851 | case MAC_SCC_PSC: | ||
852 | scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A; | ||
853 | scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B; | ||
854 | break; | ||
855 | default: | ||
856 | scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC; | ||
857 | scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC; | ||
858 | break; | ||
859 | } | ||
860 | |||
817 | /* | 861 | /* |
818 | * We need to pre-init the IOPs, if any. Otherwise | 862 | * We need to pre-init the IOPs, if any. Otherwise |
819 | * the serial console won't work if the user had | 863 | * the serial console won't work if the user had |
@@ -872,6 +916,13 @@ int __init mac_platform_init(void) | |||
872 | u8 *swim_base; | 916 | u8 *swim_base; |
873 | 917 | ||
874 | /* | 918 | /* |
919 | * Serial devices | ||
920 | */ | ||
921 | |||
922 | platform_device_register(&scc_a_pdev); | ||
923 | platform_device_register(&scc_b_pdev); | ||
924 | |||
925 | /* | ||
875 | * Floppy device | 926 | * Floppy device |
876 | */ | 927 | */ |
877 | 928 | ||
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c deleted file mode 100644 index bce074ceb768..000000000000 --- a/arch/m68k/mac/debug.c +++ /dev/null | |||
@@ -1,365 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/m68k/mac/debug.c | ||
3 | * | ||
4 | * Shamelessly stolen (SCC code and general framework) from: | ||
5 | * | ||
6 | * linux/arch/m68k/atari/debug.c | ||
7 | * | ||
8 | * Atari debugging and serial console stuff | ||
9 | * | ||
10 | * Assembled of parts of former atari/config.c 97-12-18 by Roman Hodek | ||
11 | * | ||
12 | * This file is subject to the terms and conditions of the GNU General Public | ||
13 | * License. See the file COPYING in the main directory of this archive | ||
14 | * for more details. | ||
15 | */ | ||
16 | |||
17 | #include <linux/types.h> | ||
18 | #include <linux/sched.h> | ||
19 | #include <linux/tty.h> | ||
20 | #include <linux/console.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/delay.h> | ||
23 | |||
24 | #define BOOTINFO_COMPAT_1_0 | ||
25 | #include <asm/setup.h> | ||
26 | #include <asm/bootinfo.h> | ||
27 | #include <asm/macints.h> | ||
28 | |||
29 | extern unsigned long mac_videobase; | ||
30 | extern unsigned long mac_rowbytes; | ||
31 | |||
32 | extern void mac_serial_print(const char *); | ||
33 | |||
34 | #define DEBUG_HEADS | ||
35 | #undef DEBUG_SCREEN | ||
36 | #define DEBUG_SERIAL | ||
37 | |||
38 | /* | ||
39 | * These two auxiliary debug functions should go away ASAP. Only usage: | ||
40 | * before the console output is up (after head.S come some other crucial | ||
41 | * setup routines :-) it permits writing 'data' to the screen as bit patterns | ||
42 | * (good luck reading those). Helped to figure that the bootinfo contained | ||
43 | * garbage data on the amount and size of memory chunks ... | ||
44 | * | ||
45 | * The 'pos' argument now simply means 'linefeed after print' ... | ||
46 | */ | ||
47 | |||
48 | #ifdef DEBUG_SCREEN | ||
49 | static int peng, line; | ||
50 | #endif | ||
51 | |||
52 | #if 0 | ||
53 | |||
54 | void mac_debugging_short(int pos, short num) | ||
55 | { | ||
56 | #ifdef DEBUG_SCREEN | ||
57 | unsigned char *pengoffset; | ||
58 | unsigned char *pptr; | ||
59 | int i; | ||
60 | #endif | ||
61 | |||
62 | #ifdef DEBUG_SERIAL | ||
63 | printk("debug: %d !\n", num); | ||
64 | #endif | ||
65 | |||
66 | #ifdef DEBUG_SCREEN | ||
67 | if (!MACH_IS_MAC) { | ||
68 | /* printk("debug: %d !\n", num); */ | ||
69 | return; | ||
70 | } | ||
71 | |||
72 | /* calculate current offset */ | ||
73 | pengoffset = (unsigned char *)mac_videobase + | ||
74 | (150+line*2) * mac_rowbytes + 80 * peng; | ||
75 | |||
76 | pptr = pengoffset; | ||
77 | |||
78 | for (i = 0; i < 8 * sizeof(short); i++) { /* # of bits */ | ||
79 | /* value mask for bit i, reverse order */ | ||
80 | *pptr++ = (num & (1 << (8*sizeof(short)-i-1)) ? 0xFF : 0x00); | ||
81 | } | ||
82 | |||
83 | peng++; | ||
84 | |||
85 | if (pos) { | ||
86 | line++; | ||
87 | peng = 0; | ||
88 | } | ||
89 | #endif | ||
90 | } | ||
91 | |||
92 | void mac_debugging_long(int pos, long addr) | ||
93 | { | ||
94 | #ifdef DEBUG_SCREEN | ||
95 | unsigned char *pengoffset; | ||
96 | unsigned char *pptr; | ||
97 | int i; | ||
98 | #endif | ||
99 | |||
100 | #ifdef DEBUG_SERIAL | ||
101 | printk("debug: #%ld !\n", addr); | ||
102 | #endif | ||
103 | |||
104 | #ifdef DEBUG_SCREEN | ||
105 | if (!MACH_IS_MAC) { | ||
106 | /* printk("debug: #%ld !\n", addr); */ | ||
107 | return; | ||
108 | } | ||
109 | |||
110 | pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes) | ||
111 | +80*peng; | ||
112 | |||
113 | pptr = pengoffset; | ||
114 | |||
115 | for (i = 0; i < 8 * sizeof(long); i++) { /* # of bits */ | ||
116 | *pptr++ = (addr & (1 << (8*sizeof(long)-i-1)) ? 0xFF : 0x00); | ||
117 | } | ||
118 | |||
119 | peng++; | ||
120 | |||
121 | if (pos) { | ||
122 | line++; | ||
123 | peng = 0; | ||
124 | } | ||
125 | #endif | ||
126 | } | ||
127 | |||
128 | #endif /* 0 */ | ||
129 | |||
130 | #ifdef DEBUG_SERIAL | ||
131 | /* | ||
132 | * TODO: serial debug code | ||
133 | */ | ||
134 | |||
135 | struct mac_SCC { | ||
136 | u_char cha_b_ctrl; | ||
137 | u_char char_dummy1; | ||
138 | u_char cha_a_ctrl; | ||
139 | u_char char_dummy2; | ||
140 | u_char cha_b_data; | ||
141 | u_char char_dummy3; | ||
142 | u_char cha_a_data; | ||
143 | }; | ||
144 | |||
145 | # define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase)) | ||
146 | |||
147 | static int scc_port = -1; | ||
148 | |||
149 | static struct console mac_console_driver = { | ||
150 | .name = "debug", | ||
151 | .flags = CON_PRINTBUFFER, | ||
152 | .index = -1, | ||
153 | }; | ||
154 | |||
155 | /* | ||
156 | * Crude hack to get console output to the screen before the framebuffer | ||
157 | * is initialized (happens a lot later in 2.1!). | ||
158 | * We just use the console routines declared in head.S, this will interfere | ||
159 | * with regular framebuffer console output and should be used exclusively | ||
160 | * to debug kernel problems manifesting before framebuffer init (aka WSOD) | ||
161 | * | ||
162 | * To keep this hack from interfering with the regular console driver, either | ||
163 | * deregister this driver before/on framebuffer console init, or silence this | ||
164 | * function after the fbcon driver is running (will lose console messages!?). | ||
165 | * To debug real early bugs, need to write a 'mac_register_console_hack()' | ||
166 | * that is called from start_kernel() before setup_arch() and just registers | ||
167 | * this driver if Mac. | ||
168 | */ | ||
169 | |||
170 | static void mac_debug_console_write(struct console *co, const char *str, | ||
171 | unsigned int count) | ||
172 | { | ||
173 | mac_serial_print(str); | ||
174 | } | ||
175 | |||
176 | |||
177 | |||
178 | /* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/ | ||
179 | |||
180 | #define uSEC 1 | ||
181 | |||
182 | static inline void mac_sccb_out(char c) | ||
183 | { | ||
184 | int i; | ||
185 | |||
186 | do { | ||
187 | for (i = uSEC; i > 0; --i) | ||
188 | barrier(); | ||
189 | } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ | ||
190 | for (i = uSEC; i > 0; --i) | ||
191 | barrier(); | ||
192 | scc.cha_b_data = c; | ||
193 | } | ||
194 | |||
195 | static inline void mac_scca_out(char c) | ||
196 | { | ||
197 | int i; | ||
198 | |||
199 | do { | ||
200 | for (i = uSEC; i > 0; --i) | ||
201 | barrier(); | ||
202 | } while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */ | ||
203 | for (i = uSEC; i > 0; --i) | ||
204 | barrier(); | ||
205 | scc.cha_a_data = c; | ||
206 | } | ||
207 | |||
208 | static void mac_sccb_console_write(struct console *co, const char *str, | ||
209 | unsigned int count) | ||
210 | { | ||
211 | while (count--) { | ||
212 | if (*str == '\n') | ||
213 | mac_sccb_out('\r'); | ||
214 | mac_sccb_out(*str++); | ||
215 | } | ||
216 | } | ||
217 | |||
218 | static void mac_scca_console_write(struct console *co, const char *str, | ||
219 | unsigned int count) | ||
220 | { | ||
221 | while (count--) { | ||
222 | if (*str == '\n') | ||
223 | mac_scca_out('\r'); | ||
224 | mac_scca_out(*str++); | ||
225 | } | ||
226 | } | ||
227 | |||
228 | |||
229 | /* The following two functions do a quick'n'dirty initialization of the MFP or | ||
230 | * SCC serial ports. They're used by the debugging interface, kgdb, and the | ||
231 | * serial console code. */ | ||
232 | #define SCCB_WRITE(reg,val) \ | ||
233 | do { \ | ||
234 | int i; \ | ||
235 | scc.cha_b_ctrl = (reg); \ | ||
236 | for (i = uSEC; i > 0; --i) \ | ||
237 | barrier(); \ | ||
238 | scc.cha_b_ctrl = (val); \ | ||
239 | for (i = uSEC; i > 0; --i) \ | ||
240 | barrier(); \ | ||
241 | } while(0) | ||
242 | |||
243 | #define SCCA_WRITE(reg,val) \ | ||
244 | do { \ | ||
245 | int i; \ | ||
246 | scc.cha_a_ctrl = (reg); \ | ||
247 | for (i = uSEC; i > 0; --i) \ | ||
248 | barrier(); \ | ||
249 | scc.cha_a_ctrl = (val); \ | ||
250 | for (i = uSEC; i > 0; --i) \ | ||
251 | barrier(); \ | ||
252 | } while(0) | ||
253 | |||
254 | /* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a | ||
255 | * delay of ~ 60us. */ | ||
256 | /* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/ | ||
257 | #define LONG_DELAY() \ | ||
258 | do { \ | ||
259 | int i; \ | ||
260 | for (i = 60*uSEC; i > 0; --i) \ | ||
261 | barrier(); \ | ||
262 | } while(0) | ||
263 | |||
264 | static void __init mac_init_scc_port(int cflag, int port) | ||
265 | { | ||
266 | /* | ||
267 | * baud rates: 1200, 1800, 2400, 4800, 9600, 19.2k, 38.4k, 57.6k, 115.2k | ||
268 | */ | ||
269 | |||
270 | static int clksrc_table[9] = | ||
271 | /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */ | ||
272 | { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 }; | ||
273 | static int clkmode_table[9] = | ||
274 | /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */ | ||
275 | { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 }; | ||
276 | static int div_table[9] = | ||
277 | /* reg12 (BRG low) */ | ||
278 | { 94, 62, 46, 22, 10, 4, 1, 0, 0 }; | ||
279 | |||
280 | int baud = cflag & CBAUD; | ||
281 | int clksrc, clkmode, div, reg3, reg5; | ||
282 | |||
283 | if (cflag & CBAUDEX) | ||
284 | baud += B38400; | ||
285 | if (baud < B1200 || baud > B38400+2) | ||
286 | baud = B9600; /* use default 9600bps for non-implemented rates */ | ||
287 | baud -= B1200; /* tables starts at 1200bps */ | ||
288 | |||
289 | clksrc = clksrc_table[baud]; | ||
290 | clkmode = clkmode_table[baud]; | ||
291 | div = div_table[baud]; | ||
292 | |||
293 | reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40); | ||
294 | reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */; | ||
295 | |||
296 | if (port == 1) { | ||
297 | (void)scc.cha_b_ctrl; /* reset reg pointer */ | ||
298 | SCCB_WRITE(9, 0xc0); /* reset */ | ||
299 | LONG_DELAY(); /* extra delay after WR9 access */ | ||
300 | SCCB_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | | ||
301 | 0x04 /* 1 stopbit */ | | ||
302 | clkmode); | ||
303 | SCCB_WRITE(3, reg3); | ||
304 | SCCB_WRITE(5, reg5); | ||
305 | SCCB_WRITE(9, 0); /* no interrupts */ | ||
306 | LONG_DELAY(); /* extra delay after WR9 access */ | ||
307 | SCCB_WRITE(10, 0); /* NRZ mode */ | ||
308 | SCCB_WRITE(11, clksrc); /* main clock source */ | ||
309 | SCCB_WRITE(12, div); /* BRG value */ | ||
310 | SCCB_WRITE(13, 0); /* BRG high byte */ | ||
311 | SCCB_WRITE(14, 1); | ||
312 | SCCB_WRITE(3, reg3 | 1); | ||
313 | SCCB_WRITE(5, reg5 | 8); | ||
314 | } else if (port == 0) { | ||
315 | (void)scc.cha_a_ctrl; /* reset reg pointer */ | ||
316 | SCCA_WRITE(9, 0xc0); /* reset */ | ||
317 | LONG_DELAY(); /* extra delay after WR9 access */ | ||
318 | SCCA_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | | ||
319 | 0x04 /* 1 stopbit */ | | ||
320 | clkmode); | ||
321 | SCCA_WRITE(3, reg3); | ||
322 | SCCA_WRITE(5, reg5); | ||
323 | SCCA_WRITE(9, 0); /* no interrupts */ | ||
324 | LONG_DELAY(); /* extra delay after WR9 access */ | ||
325 | SCCA_WRITE(10, 0); /* NRZ mode */ | ||
326 | SCCA_WRITE(11, clksrc); /* main clock source */ | ||
327 | SCCA_WRITE(12, div); /* BRG value */ | ||
328 | SCCA_WRITE(13, 0); /* BRG high byte */ | ||
329 | SCCA_WRITE(14, 1); | ||
330 | SCCA_WRITE(3, reg3 | 1); | ||
331 | SCCA_WRITE(5, reg5 | 8); | ||
332 | } | ||
333 | } | ||
334 | #endif /* DEBUG_SERIAL */ | ||
335 | |||
336 | static int __init mac_debug_setup(char *arg) | ||
337 | { | ||
338 | if (!MACH_IS_MAC) | ||
339 | return 0; | ||
340 | |||
341 | #ifdef DEBUG_SERIAL | ||
342 | if (!strcmp(arg, "ser") || !strcmp(arg, "ser1")) { | ||
343 | /* Mac modem port */ | ||
344 | mac_init_scc_port(B9600|CS8, 0); | ||
345 | mac_console_driver.write = mac_scca_console_write; | ||
346 | scc_port = 0; | ||
347 | } else if (!strcmp(arg, "ser2")) { | ||
348 | /* Mac printer port */ | ||
349 | mac_init_scc_port(B9600|CS8, 1); | ||
350 | mac_console_driver.write = mac_sccb_console_write; | ||
351 | scc_port = 1; | ||
352 | } | ||
353 | #endif | ||
354 | #ifdef DEBUG_HEADS | ||
355 | if (!strcmp(arg, "scn") || !strcmp(arg, "con")) { | ||
356 | /* display, using head.S console routines */ | ||
357 | mac_console_driver.write = mac_debug_console_write; | ||
358 | } | ||
359 | #endif | ||
360 | if (mac_console_driver.write) | ||
361 | register_console(&mac_console_driver); | ||
362 | return 0; | ||
363 | } | ||
364 | |||
365 | early_param("debug", mac_debug_setup); | ||
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c index 23711074e0e2..900d899f3323 100644 --- a/arch/m68k/mac/macints.c +++ b/arch/m68k/mac/macints.c | |||
@@ -34,9 +34,7 @@ | |||
34 | * | 34 | * |
35 | * 3 - unused (?) | 35 | * 3 - unused (?) |
36 | * | 36 | * |
37 | * 4 - SCC (slot number determined by reading RR3 on the SSC itself) | 37 | * 4 - SCC |
38 | * - slot 1: SCC channel A | ||
39 | * - slot 2: SCC channel B | ||
40 | * | 38 | * |
41 | * 5 - unused (?) | 39 | * 5 - unused (?) |
42 | * [serial errors or special conditions seem to raise level 6 | 40 | * [serial errors or special conditions seem to raise level 6 |
@@ -55,8 +53,6 @@ | |||
55 | * - slot 5: Slot $E | 53 | * - slot 5: Slot $E |
56 | * | 54 | * |
57 | * 4 - SCC IOP | 55 | * 4 - SCC IOP |
58 | * - slot 1: SCC channel A | ||
59 | * - slot 2: SCC channel B | ||
60 | * | 56 | * |
61 | * 5 - ISM IOP (ADB?) | 57 | * 5 - ISM IOP (ADB?) |
62 | * | 58 | * |
@@ -136,13 +132,8 @@ | |||
136 | #include <asm/irq_regs.h> | 132 | #include <asm/irq_regs.h> |
137 | #include <asm/mac_oss.h> | 133 | #include <asm/mac_oss.h> |
138 | 134 | ||
139 | #define DEBUG_SPURIOUS | ||
140 | #define SHUTUP_SONIC | 135 | #define SHUTUP_SONIC |
141 | 136 | ||
142 | /* SCC interrupt mask */ | ||
143 | |||
144 | static int scc_mask; | ||
145 | |||
146 | /* | 137 | /* |
147 | * VIA/RBV hooks | 138 | * VIA/RBV hooks |
148 | */ | 139 | */ |
@@ -191,13 +182,6 @@ extern void baboon_irq_disable(int); | |||
191 | extern void baboon_irq_clear(int); | 182 | extern void baboon_irq_clear(int); |
192 | 183 | ||
193 | /* | 184 | /* |
194 | * SCC interrupt routines | ||
195 | */ | ||
196 | |||
197 | static void scc_irq_enable(unsigned int); | ||
198 | static void scc_irq_disable(unsigned int); | ||
199 | |||
200 | /* | ||
201 | * console_loglevel determines NMI handler function | 185 | * console_loglevel determines NMI handler function |
202 | */ | 186 | */ |
203 | 187 | ||
@@ -221,8 +205,6 @@ void __init mac_init_IRQ(void) | |||
221 | #ifdef DEBUG_MACINTS | 205 | #ifdef DEBUG_MACINTS |
222 | printk("mac_init_IRQ(): Setting things up...\n"); | 206 | printk("mac_init_IRQ(): Setting things up...\n"); |
223 | #endif | 207 | #endif |
224 | scc_mask = 0; | ||
225 | |||
226 | m68k_setup_irq_controller(&mac_irq_controller, IRQ_USER, | 208 | m68k_setup_irq_controller(&mac_irq_controller, IRQ_USER, |
227 | NUM_MAC_SOURCES - IRQ_USER); | 209 | NUM_MAC_SOURCES - IRQ_USER); |
228 | /* Make sure the SONIC interrupt is cleared or things get ugly */ | 210 | /* Make sure the SONIC interrupt is cleared or things get ugly */ |
@@ -283,15 +265,16 @@ void mac_enable_irq(unsigned int irq) | |||
283 | via_irq_enable(irq); | 265 | via_irq_enable(irq); |
284 | break; | 266 | break; |
285 | case 3: | 267 | case 3: |
286 | case 4: | ||
287 | case 5: | 268 | case 5: |
288 | case 6: | 269 | case 6: |
289 | if (psc_present) | 270 | if (psc_present) |
290 | psc_irq_enable(irq); | 271 | psc_irq_enable(irq); |
291 | else if (oss_present) | 272 | else if (oss_present) |
292 | oss_irq_enable(irq); | 273 | oss_irq_enable(irq); |
293 | else if (irq_src == 4) | 274 | break; |
294 | scc_irq_enable(irq); | 275 | case 4: |
276 | if (psc_present) | ||
277 | psc_irq_enable(irq); | ||
295 | break; | 278 | break; |
296 | case 8: | 279 | case 8: |
297 | if (baboon_present) | 280 | if (baboon_present) |
@@ -316,15 +299,16 @@ void mac_disable_irq(unsigned int irq) | |||
316 | via_irq_disable(irq); | 299 | via_irq_disable(irq); |
317 | break; | 300 | break; |
318 | case 3: | 301 | case 3: |
319 | case 4: | ||
320 | case 5: | 302 | case 5: |
321 | case 6: | 303 | case 6: |
322 | if (psc_present) | 304 | if (psc_present) |
323 | psc_irq_disable(irq); | 305 | psc_irq_disable(irq); |
324 | else if (oss_present) | 306 | else if (oss_present) |
325 | oss_irq_disable(irq); | 307 | oss_irq_disable(irq); |
326 | else if (irq_src == 4) | 308 | break; |
327 | scc_irq_disable(irq); | 309 | case 4: |
310 | if (psc_present) | ||
311 | psc_irq_disable(irq); | ||
328 | break; | 312 | break; |
329 | case 8: | 313 | case 8: |
330 | if (baboon_present) | 314 | if (baboon_present) |
@@ -347,7 +331,6 @@ void mac_clear_irq(unsigned int irq) | |||
347 | via_irq_clear(irq); | 331 | via_irq_clear(irq); |
348 | break; | 332 | break; |
349 | case 3: | 333 | case 3: |
350 | case 4: | ||
351 | case 5: | 334 | case 5: |
352 | case 6: | 335 | case 6: |
353 | if (psc_present) | 336 | if (psc_present) |
@@ -355,6 +338,10 @@ void mac_clear_irq(unsigned int irq) | |||
355 | else if (oss_present) | 338 | else if (oss_present) |
356 | oss_irq_clear(irq); | 339 | oss_irq_clear(irq); |
357 | break; | 340 | break; |
341 | case 4: | ||
342 | if (psc_present) | ||
343 | psc_irq_clear(irq); | ||
344 | break; | ||
358 | case 8: | 345 | case 8: |
359 | if (baboon_present) | 346 | if (baboon_present) |
360 | baboon_irq_clear(irq); | 347 | baboon_irq_clear(irq); |
@@ -374,13 +361,17 @@ int mac_irq_pending(unsigned int irq) | |||
374 | else | 361 | else |
375 | return via_irq_pending(irq); | 362 | return via_irq_pending(irq); |
376 | case 3: | 363 | case 3: |
377 | case 4: | ||
378 | case 5: | 364 | case 5: |
379 | case 6: | 365 | case 6: |
380 | if (psc_present) | 366 | if (psc_present) |
381 | return psc_irq_pending(irq); | 367 | return psc_irq_pending(irq); |
382 | else if (oss_present) | 368 | else if (oss_present) |
383 | return oss_irq_pending(irq); | 369 | return oss_irq_pending(irq); |
370 | break; | ||
371 | case 4: | ||
372 | if (psc_present) | ||
373 | psc_irq_pending(irq); | ||
374 | break; | ||
384 | } | 375 | } |
385 | return 0; | 376 | return 0; |
386 | } | 377 | } |
@@ -448,59 +439,3 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id) | |||
448 | in_nmi--; | 439 | in_nmi--; |
449 | return IRQ_HANDLED; | 440 | return IRQ_HANDLED; |
450 | } | 441 | } |
451 | |||
452 | /* | ||
453 | * Simple routines for masking and unmasking | ||
454 | * SCC interrupts in cases where this can't be | ||
455 | * done in hardware (only the PSC can do that.) | ||
456 | */ | ||
457 | |||
458 | static void scc_irq_enable(unsigned int irq) | ||
459 | { | ||
460 | int irq_idx = IRQ_IDX(irq); | ||
461 | |||
462 | scc_mask |= (1 << irq_idx); | ||
463 | } | ||
464 | |||
465 | static void scc_irq_disable(unsigned int irq) | ||
466 | { | ||
467 | int irq_idx = IRQ_IDX(irq); | ||
468 | |||
469 | scc_mask &= ~(1 << irq_idx); | ||
470 | } | ||
471 | |||
472 | /* | ||
473 | * SCC master interrupt handler. We have to do a bit of magic here | ||
474 | * to figure out what channel gave us the interrupt; putting this | ||
475 | * here is cleaner than hacking it into drivers/char/macserial.c. | ||
476 | */ | ||
477 | |||
478 | void mac_scc_dispatch(int irq, void *dev_id) | ||
479 | { | ||
480 | volatile unsigned char *scc = (unsigned char *) mac_bi_data.sccbase + 2; | ||
481 | unsigned char reg; | ||
482 | unsigned long flags; | ||
483 | |||
484 | /* Read RR3 from the chip. Always do this on channel A */ | ||
485 | /* This must be an atomic operation so disable irqs. */ | ||
486 | |||
487 | local_irq_save(flags); | ||
488 | *scc = 3; | ||
489 | reg = *scc; | ||
490 | local_irq_restore(flags); | ||
491 | |||
492 | /* Now dispatch. Bits 0-2 are for channel B and */ | ||
493 | /* bits 3-5 are for channel A. We can safely */ | ||
494 | /* ignore the remaining bits here. */ | ||
495 | /* */ | ||
496 | /* Note that we're ignoring scc_mask for now. */ | ||
497 | /* If we actually mask the ints then we tend to */ | ||
498 | /* get hammered by very persistent SCC irqs, */ | ||
499 | /* and since they're autovector interrupts they */ | ||
500 | /* pretty much kill the system. */ | ||
501 | |||
502 | if (reg & 0x38) | ||
503 | m68k_handle_int(IRQ_SCCA); | ||
504 | if (reg & 0x07) | ||
505 | m68k_handle_int(IRQ_SCCB); | ||
506 | } | ||
diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c index f3d23d6ebcf8..a9c0f5ab4cc0 100644 --- a/arch/m68k/mac/oss.c +++ b/arch/m68k/mac/oss.c | |||
@@ -33,7 +33,6 @@ static irqreturn_t oss_irq(int, void *); | |||
33 | static irqreturn_t oss_nubus_irq(int, void *); | 33 | static irqreturn_t oss_nubus_irq(int, void *); |
34 | 34 | ||
35 | extern irqreturn_t via1_irq(int, void *); | 35 | extern irqreturn_t via1_irq(int, void *); |
36 | extern irqreturn_t mac_scc_dispatch(int, void *); | ||
37 | 36 | ||
38 | /* | 37 | /* |
39 | * Initialize the OSS | 38 | * Initialize the OSS |
@@ -69,9 +68,6 @@ void __init oss_register_interrupts(void) | |||
69 | if (request_irq(OSS_IRQLEV_SCSI, oss_irq, IRQ_FLG_LOCK, | 68 | if (request_irq(OSS_IRQLEV_SCSI, oss_irq, IRQ_FLG_LOCK, |
70 | "scsi", (void *) oss)) | 69 | "scsi", (void *) oss)) |
71 | pr_err("Couldn't register %s interrupt\n", "scsi"); | 70 | pr_err("Couldn't register %s interrupt\n", "scsi"); |
72 | if (request_irq(OSS_IRQLEV_IOPSCC, mac_scc_dispatch, IRQ_FLG_LOCK, | ||
73 | "scc", mac_scc_dispatch)) | ||
74 | pr_err("Couldn't register %s interrupt\n", "scc"); | ||
75 | if (request_irq(OSS_IRQLEV_NUBUS, oss_nubus_irq, IRQ_FLG_LOCK, | 71 | if (request_irq(OSS_IRQLEV_NUBUS, oss_nubus_irq, IRQ_FLG_LOCK, |
76 | "nubus", (void *) oss)) | 72 | "nubus", (void *) oss)) |
77 | pr_err("Couldn't register %s interrupt\n", "nubus"); | 73 | pr_err("Couldn't register %s interrupt\n", "nubus"); |
@@ -172,9 +168,7 @@ void oss_irq_enable(int irq) { | |||
172 | printk("oss_irq_enable(%d)\n", irq); | 168 | printk("oss_irq_enable(%d)\n", irq); |
173 | #endif | 169 | #endif |
174 | switch(irq) { | 170 | switch(irq) { |
175 | case IRQ_SCC: | 171 | case IRQ_MAC_SCC: |
176 | case IRQ_SCCA: | ||
177 | case IRQ_SCCB: | ||
178 | oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_IOPSCC; | 172 | oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_IOPSCC; |
179 | break; | 173 | break; |
180 | case IRQ_MAC_ADB: | 174 | case IRQ_MAC_ADB: |
@@ -212,9 +206,7 @@ void oss_irq_disable(int irq) { | |||
212 | printk("oss_irq_disable(%d)\n", irq); | 206 | printk("oss_irq_disable(%d)\n", irq); |
213 | #endif | 207 | #endif |
214 | switch(irq) { | 208 | switch(irq) { |
215 | case IRQ_SCC: | 209 | case IRQ_MAC_SCC: |
216 | case IRQ_SCCA: | ||
217 | case IRQ_SCCB: | ||
218 | oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_DISABLED; | 210 | oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_DISABLED; |
219 | break; | 211 | break; |
220 | case IRQ_MAC_ADB: | 212 | case IRQ_MAC_ADB: |
@@ -250,9 +242,7 @@ void oss_irq_disable(int irq) { | |||
250 | void oss_irq_clear(int irq) { | 242 | void oss_irq_clear(int irq) { |
251 | /* FIXME: how to do this on OSS? */ | 243 | /* FIXME: how to do this on OSS? */ |
252 | switch(irq) { | 244 | switch(irq) { |
253 | case IRQ_SCC: | 245 | case IRQ_MAC_SCC: |
254 | case IRQ_SCCA: | ||
255 | case IRQ_SCCB: | ||
256 | oss->irq_pending &= ~OSS_IP_IOPSCC; | 246 | oss->irq_pending &= ~OSS_IP_IOPSCC; |
257 | break; | 247 | break; |
258 | case IRQ_MAC_ADB: | 248 | case IRQ_MAC_ADB: |
@@ -280,9 +270,7 @@ void oss_irq_clear(int irq) { | |||
280 | int oss_irq_pending(int irq) | 270 | int oss_irq_pending(int irq) |
281 | { | 271 | { |
282 | switch(irq) { | 272 | switch(irq) { |
283 | case IRQ_SCC: | 273 | case IRQ_MAC_SCC: |
284 | case IRQ_SCCA: | ||
285 | case IRQ_SCCB: | ||
286 | return oss->irq_pending & OSS_IP_IOPSCC; | 274 | return oss->irq_pending & OSS_IP_IOPSCC; |
287 | break; | 275 | break; |
288 | case IRQ_MAC_ADB: | 276 | case IRQ_MAC_ADB: |
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c index 11bce3cb6482..e71166daec6a 100644 --- a/arch/m68k/mac/via.c +++ b/arch/m68k/mac/via.c | |||
@@ -84,8 +84,6 @@ void via_irq_enable(int irq); | |||
84 | void via_irq_disable(int irq); | 84 | void via_irq_disable(int irq); |
85 | void via_irq_clear(int irq); | 85 | void via_irq_clear(int irq); |
86 | 86 | ||
87 | extern irqreturn_t mac_scc_dispatch(int, void *); | ||
88 | |||
89 | /* | 87 | /* |
90 | * Initialize the VIAs | 88 | * Initialize the VIAs |
91 | * | 89 | * |
@@ -311,11 +309,6 @@ void __init via_register_interrupts(void) | |||
311 | if (request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, | 309 | if (request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, |
312 | "via2", (void *) via2)) | 310 | "via2", (void *) via2)) |
313 | pr_err("Couldn't register %s interrupt\n", "via2"); | 311 | pr_err("Couldn't register %s interrupt\n", "via2"); |
314 | if (!psc_present) { | ||
315 | if (request_irq(IRQ_AUTO_4, mac_scc_dispatch, IRQ_FLG_LOCK, | ||
316 | "scc", mac_scc_dispatch)) | ||
317 | pr_err("Couldn't register %s interrupt\n", "scc"); | ||
318 | } | ||
319 | if (request_irq(IRQ_MAC_NUBUS, via_nubus_irq, | 312 | if (request_irq(IRQ_MAC_NUBUS, via_nubus_irq, |
320 | IRQ_FLG_LOCK|IRQ_FLG_FAST, "nubus", (void *) via2)) | 313 | IRQ_FLG_LOCK|IRQ_FLG_FAST, "nubus", (void *) via2)) |
321 | pr_err("Couldn't register %s interrupt\n", "nubus"); | 314 | pr_err("Couldn't register %s interrupt\n", "nubus"); |