aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/mac
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2007-05-01 16:32:43 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 20:59:06 -0400
commit6ff5801acbb643e81d3420ac0f37c96089309063 (patch)
tree2406744e75f7cd06e96d8cd62ba82970a0f79922 /arch/m68k/mac
parentb3e2fd9cebcf4e82d0306fe7e796eeca5aac0614 (diff)
m68k: reformat various m68k files
Reformat various m68k files, so they actually look like Linux sources. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m68k/mac')
-rw-r--r--arch/m68k/mac/config.c161
-rw-r--r--arch/m68k/mac/debug.c323
2 files changed, 238 insertions, 246 deletions
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 562b38d0018..d2fbf436a1f 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -59,15 +59,15 @@ extern struct mem_info m68k_ramdisk;
59 59
60extern char m68k_command_line[CL_SIZE]; 60extern char m68k_command_line[CL_SIZE];
61 61
62void *mac_env; /* Loaded by the boot asm */ 62void *mac_env; /* Loaded by the boot asm */
63 63
64/* The phys. video addr. - might be bogus on some machines */ 64/* The phys. video addr. - might be bogus on some machines */
65unsigned long mac_orig_videoaddr; 65unsigned long mac_orig_videoaddr;
66 66
67/* Mac specific timer functions */ 67/* Mac specific timer functions */
68extern unsigned long mac_gettimeoffset (void); 68extern unsigned long mac_gettimeoffset(void);
69extern int mac_hwclk (int, struct rtc_time *); 69extern int mac_hwclk(int, struct rtc_time *);
70extern int mac_set_clock_mmss (unsigned long); 70extern int mac_set_clock_mmss(unsigned long);
71extern int show_mac_interrupts(struct seq_file *, void *); 71extern int show_mac_interrupts(struct seq_file *, void *);
72extern void iop_preinit(void); 72extern void iop_preinit(void);
73extern void iop_init(void); 73extern void iop_init(void);
@@ -99,51 +99,52 @@ static void mac_sched_init(irq_handler_t vector)
99 99
100int __init mac_parse_bootinfo(const struct bi_record *record) 100int __init mac_parse_bootinfo(const struct bi_record *record)
101{ 101{
102 int unknown = 0; 102 int unknown = 0;
103 const u_long *data = record->data; 103 const u_long *data = record->data;
104 104
105 switch (record->tag) { 105 switch (record->tag) {
106 case BI_MAC_MODEL: 106 case BI_MAC_MODEL:
107 mac_bi_data.id = *data; 107 mac_bi_data.id = *data;
108 break; 108 break;
109 case BI_MAC_VADDR: 109 case BI_MAC_VADDR:
110 mac_bi_data.videoaddr = *data; 110 mac_bi_data.videoaddr = *data;
111 break; 111 break;
112 case BI_MAC_VDEPTH: 112 case BI_MAC_VDEPTH:
113 mac_bi_data.videodepth = *data; 113 mac_bi_data.videodepth = *data;
114 break; 114 break;
115 case BI_MAC_VROW: 115 case BI_MAC_VROW:
116 mac_bi_data.videorow = *data; 116 mac_bi_data.videorow = *data;
117 break; 117 break;
118 case BI_MAC_VDIM: 118 case BI_MAC_VDIM:
119 mac_bi_data.dimensions = *data; 119 mac_bi_data.dimensions = *data;
120 break; 120 break;
121 case BI_MAC_VLOGICAL: 121 case BI_MAC_VLOGICAL:
122 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK); 122 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
123 mac_orig_videoaddr = *data; 123 mac_orig_videoaddr = *data;
124 break; 124 break;
125 case BI_MAC_SCCBASE: 125 case BI_MAC_SCCBASE:
126 mac_bi_data.sccbase = *data; 126 mac_bi_data.sccbase = *data;
127 break; 127 break;
128 case BI_MAC_BTIME: 128 case BI_MAC_BTIME:
129 mac_bi_data.boottime = *data; 129 mac_bi_data.boottime = *data;
130 break; 130 break;
131 case BI_MAC_GMTBIAS: 131 case BI_MAC_GMTBIAS:
132 mac_bi_data.gmtbias = *data; 132 mac_bi_data.gmtbias = *data;
133 break; 133 break;
134 case BI_MAC_MEMSIZE: 134 case BI_MAC_MEMSIZE:
135 mac_bi_data.memsize = *data; 135 mac_bi_data.memsize = *data;
136 break; 136 break;
137 case BI_MAC_CPUID: 137 case BI_MAC_CPUID:
138 mac_bi_data.cpuid = *data; 138 mac_bi_data.cpuid = *data;
139 break; 139 break;
140 case BI_MAC_ROMBASE: 140 case BI_MAC_ROMBASE:
141 mac_bi_data.rombase = *data; 141 mac_bi_data.rombase = *data;
142 break; 142 break;
143 default: 143 default:
144 unknown = 1; 144 unknown = 1;
145 } 145 break;
146 return(unknown); 146 }
147 return unknown;
147} 148}
148 149
149/* 150/*
@@ -155,6 +156,7 @@ int __init mac_parse_bootinfo(const struct bi_record *record)
155static void mac_cache_card_flush(int writeback) 156static void mac_cache_card_flush(int writeback)
156{ 157{
157 unsigned long flags; 158 unsigned long flags;
159
158 local_irq_save(flags); 160 local_irq_save(flags);
159 via_flush_cache(); 161 via_flush_cache();
160 local_irq_restore(flags); 162 local_irq_restore(flags);
@@ -162,28 +164,27 @@ static void mac_cache_card_flush(int writeback)
162 164
163void __init config_mac(void) 165void __init config_mac(void)
164{ 166{
165 if (!MACH_IS_MAC) { 167 if (!MACH_IS_MAC)
166 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n"); 168 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
167 }
168 169
169 mach_sched_init = mac_sched_init; 170 mach_sched_init = mac_sched_init;
170 mach_init_IRQ = mac_init_IRQ; 171 mach_init_IRQ = mac_init_IRQ;
171 mach_get_model = mac_get_model; 172 mach_get_model = mac_get_model;
172 mach_gettimeoffset = mac_gettimeoffset; 173 mach_gettimeoffset = mac_gettimeoffset;
173#warning move to adb/via init 174#warning move to adb/via init
174#if 0 175#if 0
175 mach_hwclk = mac_hwclk; 176 mach_hwclk = mac_hwclk;
176#endif 177#endif
177 mach_set_clock_mmss = mac_set_clock_mmss; 178 mach_set_clock_mmss = mac_set_clock_mmss;
178 mach_reset = mac_reset; 179 mach_reset = mac_reset;
179 mach_halt = mac_poweroff; 180 mach_halt = mac_poweroff;
180 mach_power_off = mac_poweroff; 181 mach_power_off = mac_poweroff;
181 mach_max_dma_address = 0xffffffff; 182 mach_max_dma_address = 0xffffffff;
182#if 0 183#if 0
183 mach_debug_init = mac_debug_init; 184 mach_debug_init = mac_debug_init;
184#endif 185#endif
185#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 186#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
186 mach_beep = mac_mksound; 187 mach_beep = mac_mksound;
187#endif 188#endif
188#ifdef CONFIG_HEARTBEAT 189#ifdef CONFIG_HEARTBEAT
189#if 0 190#if 0
@@ -199,21 +200,22 @@ void __init config_mac(void)
199 mac_identify(); 200 mac_identify();
200 mac_report_hardware(); 201 mac_report_hardware();
201 202
202 /* AFAIK only the IIci takes a cache card. The IIfx has onboard 203 /*
203 cache ... someone needs to figure out how to tell if it's on or 204 * AFAIK only the IIci takes a cache card. The IIfx has onboard
204 not. */ 205 * cache ... someone needs to figure out how to tell if it's on or
206 * not.
207 */
205 208
206 if (macintosh_config->ident == MAC_MODEL_IICI 209 if (macintosh_config->ident == MAC_MODEL_IICI
207 || macintosh_config->ident == MAC_MODEL_IIFX) { 210 || macintosh_config->ident == MAC_MODEL_IIFX)
208 mach_l2_flush = mac_cache_card_flush; 211 mach_l2_flush = mac_cache_card_flush;
209 }
210 212
211 /* 213 /*
212 * Check for machine specific fixups. 214 * Check for machine specific fixups.
213 */ 215 */
214 216
215#ifdef OLD_NUBUS_CODE 217#ifdef OLD_NUBUS_CODE
216 nubus_sweep_video(); 218 nubus_sweep_video();
217#endif 219#endif
218} 220}
219 221
@@ -233,8 +235,7 @@ void __init config_mac(void)
233struct mac_model *macintosh_config; 235struct mac_model *macintosh_config;
234EXPORT_SYMBOL(macintosh_config); 236EXPORT_SYMBOL(macintosh_config);
235 237
236static struct mac_model mac_data_table[]= 238static struct mac_model mac_data_table[] = {
237{
238 /* 239 /*
239 * We'll pretend to be a Macintosh II, that's pretty safe. 240 * We'll pretend to be a Macintosh II, that's pretty safe.
240 */ 241 */
@@ -784,12 +785,12 @@ void mac_identify(void)
784 if (!model) { 785 if (!model) {
785 /* no bootinfo model id -> NetBSD booter was used! */ 786 /* no bootinfo model id -> NetBSD booter was used! */
786 /* XXX FIXME: breaks for model > 31 */ 787 /* XXX FIXME: breaks for model > 31 */
787 model=(mac_bi_data.cpuid>>2)&63; 788 model = (mac_bi_data.cpuid >> 2) & 63;
788 printk (KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n"); 789 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
789 } 790 }
790 791
791 macintosh_config = mac_data_table; 792 macintosh_config = mac_data_table;
792 for (m = macintosh_config ; m->ident != -1 ; m++) { 793 for (m = macintosh_config; m->ident != -1; m++) {
793 if (m->ident == model) { 794 if (m->ident == model) {
794 macintosh_config = m; 795 macintosh_config = m;
795 break; 796 break;
@@ -803,25 +804,25 @@ void mac_identify(void)
803 iop_preinit(); 804 iop_preinit();
804 mac_debug_init(); 805 mac_debug_init();
805 806
806 printk (KERN_INFO "Detected Macintosh model: %d \n", model); 807 printk(KERN_INFO "Detected Macintosh model: %d \n", model);
807 808
808 /* 809 /*
809 * Report booter data: 810 * Report booter data:
810 */ 811 */
811 printk (KERN_DEBUG " Penguin bootinfo data:\n"); 812 printk(KERN_DEBUG " Penguin bootinfo data:\n");
812 printk (KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n", 813 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
813 mac_bi_data.videoaddr, mac_bi_data.videorow, 814 mac_bi_data.videoaddr, mac_bi_data.videorow,
814 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, 815 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
815 mac_bi_data.dimensions >> 16); 816 mac_bi_data.dimensions >> 16);
816 printk (KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n", 817 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
817 mac_bi_data.videological, mac_orig_videoaddr, 818 mac_bi_data.videological, mac_orig_videoaddr,
818 mac_bi_data.sccbase); 819 mac_bi_data.sccbase);
819 printk (KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n", 820 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
820 mac_bi_data.boottime, mac_bi_data.gmtbias); 821 mac_bi_data.boottime, mac_bi_data.gmtbias);
821 printk (KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n", 822 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
822 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); 823 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
823#if 0 824#if 0
824 printk ("Ramdisk: addr 0x%lx size 0x%lx\n", 825 printk("Ramdisk: addr 0x%lx size 0x%lx\n",
825 m68k_ramdisk.addr, m68k_ramdisk.size); 826 m68k_ramdisk.addr, m68k_ramdisk.size);
826#endif 827#endif
827 828
@@ -830,22 +831,22 @@ void mac_identify(void)
830 */ 831 */
831 switch (macintosh_config->scsi_type) { 832 switch (macintosh_config->scsi_type) {
832 case MAC_SCSI_OLD: 833 case MAC_SCSI_OLD:
833 MACHW_SET(MAC_SCSI_80); 834 MACHW_SET(MAC_SCSI_80);
834 break; 835 break;
835 case MAC_SCSI_QUADRA: 836 case MAC_SCSI_QUADRA:
836 case MAC_SCSI_QUADRA2: 837 case MAC_SCSI_QUADRA2:
837 case MAC_SCSI_QUADRA3: 838 case MAC_SCSI_QUADRA3:
838 MACHW_SET(MAC_SCSI_96); 839 MACHW_SET(MAC_SCSI_96);
839 if ((macintosh_config->ident == MAC_MODEL_Q900) || 840 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
840 (macintosh_config->ident == MAC_MODEL_Q950)) 841 (macintosh_config->ident == MAC_MODEL_Q950))
841 MACHW_SET(MAC_SCSI_96_2); 842 MACHW_SET(MAC_SCSI_96_2);
842 break; 843 break;
843 default: 844 default:
844 printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n"); 845 printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n");
845 MACHW_SET(MAC_SCSI_80); 846 MACHW_SET(MAC_SCSI_80);
846 break; 847 break;
847
848 } 848 }
849
849 iop_init(); 850 iop_init();
850 via_init(); 851 via_init();
851 oss_init(); 852 oss_init();
@@ -860,6 +861,6 @@ void mac_report_hardware(void)
860 861
861static void mac_get_model(char *str) 862static void mac_get_model(char *str)
862{ 863{
863 strcpy(str,"Macintosh "); 864 strcpy(str, "Macintosh ");
864 strcat(str, macintosh_config->name); 865 strcat(str, macintosh_config->name);
865} 866}
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c
index 4eeb09dc0e8..83990326099 100644
--- a/arch/m68k/mac/debug.c
+++ b/arch/m68k/mac/debug.c
@@ -52,7 +52,7 @@ extern void mac_serial_print(const char *);
52 */ 52 */
53 53
54#ifdef DEBUG_SCREEN 54#ifdef DEBUG_SCREEN
55static int peng=0, line=0; 55static int peng, line;
56#endif 56#endif
57 57
58void mac_debugging_short(int pos, short num) 58void mac_debugging_short(int pos, short num)
@@ -74,15 +74,14 @@ void mac_debugging_short(int pos, short num)
74 } 74 }
75 75
76 /* calculate current offset */ 76 /* calculate current offset */
77 pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes) 77 pengoffset = (unsigned char *)mac_videobase +
78 +80*peng; 78 (150+line*2) * mac_rowbytes) + 80 * peng;
79 79
80 pptr=pengoffset; 80 pptr = pengoffset;
81 81
82 for(i=0;i<8*sizeof(short);i++) /* # of bits */ 82 for (i = 0; i < 8 * sizeof(short); i++) { /* # of bits */
83 {
84 /* value mask for bit i, reverse order */ 83 /* value mask for bit i, reverse order */
85 *pptr++ = (num & ( 1 << (8*sizeof(short)-i-1) ) ? 0xFF : 0x00); 84 *pptr++ = (num & (1 << (8*sizeof(short)-i-1)) ? 0xFF : 0x00);
86 } 85 }
87 86
88 peng++; 87 peng++;
@@ -115,11 +114,10 @@ void mac_debugging_long(int pos, long addr)
115 pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes) 114 pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes)
116 +80*peng; 115 +80*peng;
117 116
118 pptr=pengoffset; 117 pptr = pengoffset;
119 118
120 for(i=0;i<8*sizeof(long);i++) /* # of bits */ 119 for (i = 0; i < 8 * sizeof(long); i++) { /* # of bits */
121 { 120 *pptr++ = (addr & (1 << (8*sizeof(long)-i-1)) ? 0xFF : 0x00);
122 *pptr++ = (addr & ( 1 << (8*sizeof(long)-i-1) ) ? 0xFF : 0x00);
123 } 121 }
124 122
125 peng++; 123 peng++;
@@ -136,16 +134,15 @@ void mac_debugging_long(int pos, long addr)
136 * TODO: serial debug code 134 * TODO: serial debug code
137 */ 135 */
138 136
139struct mac_SCC 137struct mac_SCC {
140 { 138 u_char cha_b_ctrl;
141 u_char cha_b_ctrl; 139 u_char char_dummy1;
142 u_char char_dummy1; 140 u_char cha_a_ctrl;
143 u_char cha_a_ctrl; 141 u_char char_dummy2;
144 u_char char_dummy2; 142 u_char cha_b_data;
145 u_char cha_b_data; 143 u_char char_dummy3;
146 u_char char_dummy3; 144 u_char cha_a_data;
147 u_char cha_a_data; 145};
148 };
149 146
150# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase)) 147# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase))
151 148
@@ -158,9 +155,9 @@ int mac_SCC_reset_done;
158static int scc_port = -1; 155static int scc_port = -1;
159 156
160static struct console mac_console_driver = { 157static struct console mac_console_driver = {
161 .name = "debug", 158 .name = "debug",
162 .flags = CON_PRINTBUFFER, 159 .flags = CON_PRINTBUFFER,
163 .index = -1, 160 .index = -1,
164}; 161};
165 162
166/* 163/*
@@ -178,8 +175,8 @@ static struct console mac_console_driver = {
178 * this driver if Mac. 175 * this driver if Mac.
179 */ 176 */
180 177
181void mac_debug_console_write (struct console *co, const char *str, 178void mac_debug_console_write(struct console *co, const char *str,
182 unsigned int count) 179 unsigned int count)
183{ 180{
184 mac_serial_print(str); 181 mac_serial_print(str);
185} 182}
@@ -190,48 +187,50 @@ void mac_debug_console_write (struct console *co, const char *str,
190 187
191#define uSEC 1 188#define uSEC 1
192 189
193static inline void mac_sccb_out (char c) 190static inline void mac_sccb_out(char c)
194{ 191{
195 int i; 192 int i;
196 do { 193
197 for( i = uSEC; i > 0; --i ) 194 do {
195 for (i = uSEC; i > 0; --i)
196 barrier();
197 } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */
198 for (i = uSEC; i > 0; --i)
198 barrier(); 199 barrier();
199 } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ 200 scc.cha_b_data = c;
200 for( i = uSEC; i > 0; --i )
201 barrier();
202 scc.cha_b_data = c;
203} 201}
204 202
205static inline void mac_scca_out (char c) 203static inline void mac_scca_out(char c)
206{ 204{
207 int i; 205 int i;
208 do { 206
209 for( i = uSEC; i > 0; --i ) 207 do {
208 for (i = uSEC; i > 0; --i)
209 barrier();
210 } while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */
211 for (i = uSEC; i > 0; --i)
210 barrier(); 212 barrier();
211 } while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */ 213 scc.cha_a_data = c;
212 for( i = uSEC; i > 0; --i )
213 barrier();
214 scc.cha_a_data = c;
215} 214}
216 215
217void mac_sccb_console_write (struct console *co, const char *str, 216void mac_sccb_console_write(struct console *co, const char *str,
218 unsigned int count) 217 unsigned int count)
219{ 218{
220 while (count--) { 219 while (count--) {
221 if (*str == '\n') 220 if (*str == '\n')
222 mac_sccb_out( '\r' ); 221 mac_sccb_out('\r');
223 mac_sccb_out( *str++ ); 222 mac_sccb_out(*str++);
224 } 223 }
225} 224}
226 225
227void mac_scca_console_write (struct console *co, const char *str, 226void mac_scca_console_write(struct console *co, const char *str,
228 unsigned int count) 227 unsigned int count)
229{ 228{
230 while (count--) { 229 while (count--) {
231 if (*str == '\n') 230 if (*str == '\n')
232 mac_scca_out( '\r' ); 231 mac_scca_out('\r');
233 mac_scca_out( *str++ ); 232 mac_scca_out(*str++);
234 } 233 }
235} 234}
236 235
237 236
@@ -239,41 +238,41 @@ void mac_scca_console_write (struct console *co, const char *str,
239 * SCC serial ports. They're used by the debugging interface, kgdb, and the 238 * SCC serial ports. They're used by the debugging interface, kgdb, and the
240 * serial console code. */ 239 * serial console code. */
241#define SCCB_WRITE(reg,val) \ 240#define SCCB_WRITE(reg,val) \
242 do { \ 241 do { \
243 int i; \ 242 int i; \
244 scc.cha_b_ctrl = (reg); \ 243 scc.cha_b_ctrl = (reg); \
245 for( i = uSEC; i > 0; --i ) \ 244 for (i = uSEC; i > 0; --i) \
246 barrier(); \ 245 barrier(); \
247 scc.cha_b_ctrl = (val); \ 246 scc.cha_b_ctrl = (val); \
248 for( i = uSEC; i > 0; --i ) \ 247 for (i = uSEC; i > 0; --i) \
249 barrier(); \ 248 barrier(); \
250 } while(0) 249 } while(0)
251 250
252#define SCCA_WRITE(reg,val) \ 251#define SCCA_WRITE(reg,val) \
253 do { \ 252 do { \
254 int i; \ 253 int i; \
255 scc.cha_a_ctrl = (reg); \ 254 scc.cha_a_ctrl = (reg); \
256 for( i = uSEC; i > 0; --i ) \ 255 for (i = uSEC; i > 0; --i) \
257 barrier(); \ 256 barrier(); \
258 scc.cha_a_ctrl = (val); \ 257 scc.cha_a_ctrl = (val); \
259 for( i = uSEC; i > 0; --i ) \ 258 for (i = uSEC; i > 0; --i) \
260 barrier(); \ 259 barrier(); \
261 } while(0) 260 } while(0)
262 261
263/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a 262/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a
264 * delay of ~ 60us. */ 263 * delay of ~ 60us. */
265/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/ 264/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/
266#define LONG_DELAY() \ 265#define LONG_DELAY() \
267 do { \ 266 do { \
268 int i; \ 267 int i; \
269 for( i = 60*uSEC; i > 0; --i ) \ 268 for (i = 60*uSEC; i > 0; --i) \
270 barrier(); \ 269 barrier(); \
271 } while(0) 270 } while(0)
272 271
273#ifndef CONFIG_SERIAL_CONSOLE 272#ifndef CONFIG_SERIAL_CONSOLE
274static void __init mac_init_scc_port( int cflag, int port ) 273static void __init mac_init_scc_port(int cflag, int port)
275#else 274#else
276void mac_init_scc_port( int cflag, int port ) 275void mac_init_scc_port(int cflag, int port)
277#endif 276#endif
278{ 277{
279 extern int mac_SCC_reset_done; 278 extern int mac_SCC_reset_done;
@@ -292,71 +291,71 @@ void mac_init_scc_port( int cflag, int port )
292 /* reg12 (BRG low) */ 291 /* reg12 (BRG low) */
293 { 94, 62, 46, 22, 10, 4, 1, 0, 0 }; 292 { 94, 62, 46, 22, 10, 4, 1, 0, 0 };
294 293
295 int baud = cflag & CBAUD; 294 int baud = cflag & CBAUD;
296 int clksrc, clkmode, div, reg3, reg5; 295 int clksrc, clkmode, div, reg3, reg5;
297 296
298 if (cflag & CBAUDEX) 297 if (cflag & CBAUDEX)
299 baud += B38400; 298 baud += B38400;
300 if (baud < B1200 || baud > B38400+2) 299 if (baud < B1200 || baud > B38400+2)
301 baud = B9600; /* use default 9600bps for non-implemented rates */ 300 baud = B9600; /* use default 9600bps for non-implemented rates */
302 baud -= B1200; /* tables starts at 1200bps */ 301 baud -= B1200; /* tables starts at 1200bps */
303 302
304 clksrc = clksrc_table[baud]; 303 clksrc = clksrc_table[baud];
305 clkmode = clkmode_table[baud]; 304 clkmode = clkmode_table[baud];
306 div = div_table[baud]; 305 div = div_table[baud];
307 306
308 reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40); 307 reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40);
309 reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */; 308 reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */;
310 309
311 if (port == 1) { 310 if (port == 1) {
312 (void)scc.cha_b_ctrl; /* reset reg pointer */ 311 (void)scc.cha_b_ctrl; /* reset reg pointer */
313 SCCB_WRITE( 9, 0xc0 ); /* reset */ 312 SCCB_WRITE(9, 0xc0); /* reset */
314 LONG_DELAY(); /* extra delay after WR9 access */ 313 LONG_DELAY(); /* extra delay after WR9 access */
315 SCCB_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | 314 SCCB_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
316 0x04 /* 1 stopbit */ | 315 0x04 /* 1 stopbit */ |
317 clkmode ); 316 clkmode);
318 SCCB_WRITE( 3, reg3 ); 317 SCCB_WRITE(3, reg3);
319 SCCB_WRITE( 5, reg5 ); 318 SCCB_WRITE(5, reg5);
320 SCCB_WRITE( 9, 0 ); /* no interrupts */ 319 SCCB_WRITE(9, 0); /* no interrupts */
321 LONG_DELAY(); /* extra delay after WR9 access */ 320 LONG_DELAY(); /* extra delay after WR9 access */
322 SCCB_WRITE( 10, 0 ); /* NRZ mode */ 321 SCCB_WRITE(10, 0); /* NRZ mode */
323 SCCB_WRITE( 11, clksrc ); /* main clock source */ 322 SCCB_WRITE(11, clksrc); /* main clock source */
324 SCCB_WRITE( 12, div ); /* BRG value */ 323 SCCB_WRITE(12, div); /* BRG value */
325 SCCB_WRITE( 13, 0 ); /* BRG high byte */ 324 SCCB_WRITE(13, 0); /* BRG high byte */
326 SCCB_WRITE( 14, 1 ); 325 SCCB_WRITE(14, 1);
327 SCCB_WRITE( 3, reg3 | 1 ); 326 SCCB_WRITE(3, reg3 | 1);
328 SCCB_WRITE( 5, reg5 | 8 ); 327 SCCB_WRITE(5, reg5 | 8);
329 } else if (port == 0) { 328 } else if (port == 0) {
330 (void)scc.cha_a_ctrl; /* reset reg pointer */ 329 (void)scc.cha_a_ctrl; /* reset reg pointer */
331 SCCA_WRITE( 9, 0xc0 ); /* reset */ 330 SCCA_WRITE(9, 0xc0); /* reset */
332 LONG_DELAY(); /* extra delay after WR9 access */ 331 LONG_DELAY(); /* extra delay after WR9 access */
333 SCCA_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | 332 SCCA_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
334 0x04 /* 1 stopbit */ | 333 0x04 /* 1 stopbit */ |
335 clkmode ); 334 clkmode);
336 SCCA_WRITE( 3, reg3 ); 335 SCCA_WRITE(3, reg3);
337 SCCA_WRITE( 5, reg5 ); 336 SCCA_WRITE(5, reg5);
338 SCCA_WRITE( 9, 0 ); /* no interrupts */ 337 SCCA_WRITE(9, 0); /* no interrupts */
339 LONG_DELAY(); /* extra delay after WR9 access */ 338 LONG_DELAY(); /* extra delay after WR9 access */
340 SCCA_WRITE( 10, 0 ); /* NRZ mode */ 339 SCCA_WRITE(10, 0); /* NRZ mode */
341 SCCA_WRITE( 11, clksrc ); /* main clock source */ 340 SCCA_WRITE(11, clksrc); /* main clock source */
342 SCCA_WRITE( 12, div ); /* BRG value */ 341 SCCA_WRITE(12, div); /* BRG value */
343 SCCA_WRITE( 13, 0 ); /* BRG high byte */ 342 SCCA_WRITE(13, 0); /* BRG high byte */
344 SCCA_WRITE( 14, 1 ); 343 SCCA_WRITE(14, 1);
345 SCCA_WRITE( 3, reg3 | 1 ); 344 SCCA_WRITE(3, reg3 | 1);
346 SCCA_WRITE( 5, reg5 | 8 ); 345 SCCA_WRITE(5, reg5 | 8);
347 } 346 }
348 347
349 mac_SCC_reset_done = 1; 348 mac_SCC_reset_done = 1;
350 mac_SCC_init_done = 1; 349 mac_SCC_init_done = 1;
351} 350}
352#endif /* DEBUG_SERIAL */ 351#endif /* DEBUG_SERIAL */
353 352
354void mac_init_scca_port( int cflag ) 353void mac_init_scca_port(int cflag)
355{ 354{
356 mac_init_scc_port(cflag, 0); 355 mac_init_scc_port(cflag, 0);
357} 356}
358 357
359void mac_init_sccb_port( int cflag ) 358void mac_init_sccb_port(int cflag)
360{ 359{
361 mac_init_scc_port(cflag, 1); 360 mac_init_scc_port(cflag, 1);
362} 361}
@@ -364,34 +363,26 @@ void mac_init_sccb_port( int cflag )
364void __init mac_debug_init(void) 363void __init mac_debug_init(void)
365{ 364{
366#ifdef DEBUG_SERIAL 365#ifdef DEBUG_SERIAL
367 if ( !strcmp( m68k_debug_device, "ser" ) 366 if (!strcmp(m68k_debug_device, "ser") ||
368 || !strcmp( m68k_debug_device, "ser1" )) { 367 !strcmp(m68k_debug_device, "ser1")) {
369 /* Mac modem port */ 368 /* Mac modem port */
370 mac_init_scc_port( B9600|CS8, 0 ); 369 mac_init_scc_port(B9600|CS8, 0);
371 mac_console_driver.write = mac_scca_console_write; 370 mac_console_driver.write = mac_scca_console_write;
372 scc_port = 0; 371 scc_port = 0;
373 } 372 } else if (!strcmp(m68k_debug_device, "ser2")) {
374 else if (!strcmp( m68k_debug_device, "ser2" )) { 373 /* Mac printer port */
375 /* Mac printer port */ 374 mac_init_scc_port(B9600|CS8, 1);
376 mac_init_scc_port( B9600|CS8, 1 ); 375 mac_console_driver.write = mac_sccb_console_write;
377 mac_console_driver.write = mac_sccb_console_write; 376 scc_port = 1;
378 scc_port = 1; 377 }
379 }
380#endif 378#endif
381#ifdef DEBUG_HEADS 379#ifdef DEBUG_HEADS
382 if ( !strcmp( m68k_debug_device, "scn" ) 380 if (!strcmp(m68k_debug_device, "scn") ||
383 || !strcmp( m68k_debug_device, "con" )) { 381 !strcmp(m68k_debug_device, "con")) {
384 /* display, using head.S console routines */ 382 /* display, using head.S console routines */
385 mac_console_driver.write = mac_debug_console_write; 383 mac_console_driver.write = mac_debug_console_write;
386 } 384 }
387#endif 385#endif
388 if (mac_console_driver.write) 386 if (mac_console_driver.write)
389 register_console(&mac_console_driver); 387 register_console(&mac_console_driver);
390} 388}
391
392/*
393 * Local variables:
394 * c-indent-level: 4
395 * tab-width: 8
396 * End:
397 */