diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2007-05-01 16:32:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-04 20:59:06 -0400 |
commit | 6ff5801acbb643e81d3420ac0f37c96089309063 (patch) | |
tree | 2406744e75f7cd06e96d8cd62ba82970a0f79922 /arch/m68k/atari | |
parent | b3e2fd9cebcf4e82d0306fe7e796eeca5aac0614 (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/atari')
-rw-r--r-- | arch/m68k/atari/config.c | 989 | ||||
-rw-r--r-- | arch/m68k/atari/debug.c | 474 |
2 files changed, 706 insertions, 757 deletions
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index ca5cd4344e3d..b10e7addae5c 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c | |||
@@ -50,19 +50,19 @@ int atari_dont_touch_floppy_select; | |||
50 | int atari_rtc_year_offset; | 50 | int atari_rtc_year_offset; |
51 | 51 | ||
52 | /* local function prototypes */ | 52 | /* local function prototypes */ |
53 | static void atari_reset( void ); | 53 | static void atari_reset(void); |
54 | static void atari_get_model(char *model); | 54 | static void atari_get_model(char *model); |
55 | static int atari_get_hardware_list(char *buffer); | 55 | static int atari_get_hardware_list(char *buffer); |
56 | 56 | ||
57 | /* atari specific irq functions */ | 57 | /* atari specific irq functions */ |
58 | extern void atari_init_IRQ (void); | 58 | extern void atari_init_IRQ (void); |
59 | extern void atari_mksound( unsigned int count, unsigned int ticks ); | 59 | extern void atari_mksound(unsigned int count, unsigned int ticks); |
60 | #ifdef CONFIG_HEARTBEAT | 60 | #ifdef CONFIG_HEARTBEAT |
61 | static void atari_heartbeat( int on ); | 61 | static void atari_heartbeat(int on); |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | /* atari specific timer functions (in time.c) */ | 64 | /* atari specific timer functions (in time.c) */ |
65 | extern void atari_sched_init(irq_handler_t ); | 65 | extern void atari_sched_init(irq_handler_t); |
66 | extern unsigned long atari_gettimeoffset (void); | 66 | extern unsigned long atari_gettimeoffset (void); |
67 | extern int atari_mste_hwclk (int, struct rtc_time *); | 67 | extern int atari_mste_hwclk (int, struct rtc_time *); |
68 | extern int atari_tt_hwclk (int, struct rtc_time *); | 68 | extern int atari_tt_hwclk (int, struct rtc_time *); |
@@ -73,48 +73,6 @@ extern int atari_tt_set_clock_mmss (unsigned long); | |||
73 | extern void atari_debug_init(void); | 73 | extern void atari_debug_init(void); |
74 | 74 | ||
75 | 75 | ||
76 | /* I've moved hwreg_present() and hwreg_present_bywrite() out into | ||
77 | * mm/hwtest.c, to avoid having multiple copies of the same routine | ||
78 | * in the kernel [I wanted them in hp300 and they were already used | ||
79 | * in the nubus code. NB: I don't have an Atari so this might (just | ||
80 | * conceivably) break something. | ||
81 | * I've preserved the #if 0 version of hwreg_present_bywrite() here | ||
82 | * for posterity. | ||
83 | * -- Peter Maydell <pmaydell@chiark.greenend.org.uk>, 05/1998 | ||
84 | */ | ||
85 | |||
86 | #if 0 | ||
87 | static int __init | ||
88 | hwreg_present_bywrite(volatile void *regp, unsigned char val) | ||
89 | { | ||
90 | int ret; | ||
91 | long save_sp, save_vbr; | ||
92 | static long tmp_vectors[3] = { [2] = (long)&&after_test }; | ||
93 | |||
94 | __asm__ __volatile__ | ||
95 | ( "movec %/vbr,%2\n\t" /* save vbr value */ | ||
96 | "movec %4,%/vbr\n\t" /* set up temporary vectors */ | ||
97 | "movel %/sp,%1\n\t" /* save sp */ | ||
98 | "moveq #0,%0\n\t" /* assume not present */ | ||
99 | "moveb %5,%3@\n\t" /* write the hardware reg */ | ||
100 | "cmpb %3@,%5\n\t" /* compare it */ | ||
101 | "seq %0" /* comes here only if reg */ | ||
102 | /* is present */ | ||
103 | : "=d&" (ret), "=r&" (save_sp), "=r&" (save_vbr) | ||
104 | : "a" (regp), "r" (tmp_vectors), "d" (val) | ||
105 | ); | ||
106 | after_test: | ||
107 | __asm__ __volatile__ | ||
108 | ( "movel %0,%/sp\n\t" /* restore sp */ | ||
109 | "movec %1,%/vbr" /* restore vbr */ | ||
110 | : : "r" (save_sp), "r" (save_vbr) : "sp" | ||
111 | ); | ||
112 | |||
113 | return( ret ); | ||
114 | } | ||
115 | #endif | ||
116 | |||
117 | |||
118 | /* ++roman: This is a more elaborate test for an SCC chip, since the plain | 76 | /* ++roman: This is a more elaborate test for an SCC chip, since the plain |
119 | * Medusa board generates DTACK at the SCC's standard addresses, but a SCC | 77 | * Medusa board generates DTACK at the SCC's standard addresses, but a SCC |
120 | * board in the Medusa is possible. Also, the addresses where the ST_ESCC | 78 | * board in the Medusa is possible. Also, the addresses where the ST_ESCC |
@@ -123,26 +81,34 @@ hwreg_present_bywrite(volatile void *regp, unsigned char val) | |||
123 | * should be readable without trouble (from channel A!). | 81 | * should be readable without trouble (from channel A!). |
124 | */ | 82 | */ |
125 | 83 | ||
126 | static int __init scc_test( volatile char *ctla ) | 84 | static int __init scc_test(volatile char *ctla) |
127 | { | 85 | { |
128 | if (!hwreg_present( ctla )) | 86 | if (!hwreg_present(ctla)) |
129 | return( 0 ); | 87 | return 0; |
130 | MFPDELAY(); | 88 | MFPDELAY(); |
131 | 89 | ||
132 | *ctla = 2; MFPDELAY(); | 90 | *ctla = 2; |
133 | *ctla = 0x40; MFPDELAY(); | 91 | MFPDELAY(); |
92 | *ctla = 0x40; | ||
93 | MFPDELAY(); | ||
134 | 94 | ||
135 | *ctla = 2; MFPDELAY(); | 95 | *ctla = 2; |
136 | if (*ctla != 0x40) return( 0 ); | 96 | MFPDELAY(); |
97 | if (*ctla != 0x40) | ||
98 | return 0; | ||
137 | MFPDELAY(); | 99 | MFPDELAY(); |
138 | 100 | ||
139 | *ctla = 2; MFPDELAY(); | 101 | *ctla = 2; |
140 | *ctla = 0x60; MFPDELAY(); | 102 | MFPDELAY(); |
103 | *ctla = 0x60; | ||
104 | MFPDELAY(); | ||
141 | 105 | ||
142 | *ctla = 2; MFPDELAY(); | 106 | *ctla = 2; |
143 | if (*ctla != 0x60) return( 0 ); | 107 | MFPDELAY(); |
108 | if (*ctla != 0x60) | ||
109 | return 0; | ||
144 | 110 | ||
145 | return( 1 ); | 111 | return 1; |
146 | } | 112 | } |
147 | 113 | ||
148 | 114 | ||
@@ -152,59 +118,58 @@ static int __init scc_test( volatile char *ctla ) | |||
152 | 118 | ||
153 | int __init atari_parse_bootinfo(const struct bi_record *record) | 119 | int __init atari_parse_bootinfo(const struct bi_record *record) |
154 | { | 120 | { |
155 | int unknown = 0; | 121 | int unknown = 0; |
156 | const u_long *data = record->data; | 122 | const u_long *data = record->data; |
157 | 123 | ||
158 | switch (record->tag) { | 124 | switch (record->tag) { |
159 | case BI_ATARI_MCH_COOKIE: | 125 | case BI_ATARI_MCH_COOKIE: |
160 | atari_mch_cookie = *data; | 126 | atari_mch_cookie = *data; |
161 | break; | 127 | break; |
162 | case BI_ATARI_MCH_TYPE: | 128 | case BI_ATARI_MCH_TYPE: |
163 | atari_mch_type = *data; | 129 | atari_mch_type = *data; |
164 | break; | 130 | break; |
165 | default: | 131 | default: |
166 | unknown = 1; | 132 | unknown = 1; |
167 | } | 133 | break; |
168 | return(unknown); | 134 | } |
135 | return unknown; | ||
169 | } | 136 | } |
170 | 137 | ||
171 | 138 | ||
172 | /* Parse the Atari-specific switches= option. */ | 139 | /* Parse the Atari-specific switches= option. */ |
173 | void __init atari_switches_setup( const char *str, unsigned len ) | 140 | void __init atari_switches_setup(const char *str, unsigned len) |
174 | { | 141 | { |
175 | char switches[len+1]; | 142 | char switches[len+1]; |
176 | char *p; | 143 | char *p; |
177 | int ovsc_shift; | 144 | int ovsc_shift; |
178 | char *args = switches; | 145 | char *args = switches; |
179 | 146 | ||
180 | /* copy string to local array, strsep works destructively... */ | 147 | /* copy string to local array, strsep works destructively... */ |
181 | strlcpy( switches, str, sizeof(switches) ); | 148 | strlcpy(switches, str, sizeof(switches)); |
182 | atari_switches = 0; | 149 | atari_switches = 0; |
183 | 150 | ||
184 | /* parse the options */ | 151 | /* parse the options */ |
185 | while ((p = strsep(&args, ",")) != NULL) { | 152 | while ((p = strsep(&args, ",")) != NULL) { |
186 | if (!*p) continue; | 153 | if (!*p) |
187 | ovsc_shift = 0; | 154 | continue; |
188 | if (strncmp( p, "ov_", 3 ) == 0) { | 155 | ovsc_shift = 0; |
189 | p += 3; | 156 | if (strncmp(p, "ov_", 3) == 0) { |
190 | ovsc_shift = ATARI_SWITCH_OVSC_SHIFT; | 157 | p += 3; |
191 | } | 158 | ovsc_shift = ATARI_SWITCH_OVSC_SHIFT; |
192 | 159 | } | |
193 | if (strcmp( p, "ikbd" ) == 0) { | 160 | |
194 | /* RTS line of IKBD ACIA */ | 161 | if (strcmp(p, "ikbd") == 0) { |
195 | atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift; | 162 | /* RTS line of IKBD ACIA */ |
196 | } | 163 | atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift; |
197 | else if (strcmp( p, "midi" ) == 0) { | 164 | } else if (strcmp(p, "midi") == 0) { |
198 | /* RTS line of MIDI ACIA */ | 165 | /* RTS line of MIDI ACIA */ |
199 | atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift; | 166 | atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift; |
167 | } else if (strcmp(p, "snd6") == 0) { | ||
168 | atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift; | ||
169 | } else if (strcmp(p, "snd7") == 0) { | ||
170 | atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift; | ||
171 | } | ||
200 | } | 172 | } |
201 | else if (strcmp( p, "snd6" ) == 0) { | ||
202 | atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift; | ||
203 | } | ||
204 | else if (strcmp( p, "snd7" ) == 0) { | ||
205 | atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift; | ||
206 | } | ||
207 | } | ||
208 | } | 173 | } |
209 | 174 | ||
210 | 175 | ||
@@ -214,284 +179,283 @@ void __init atari_switches_setup( const char *str, unsigned len ) | |||
214 | 179 | ||
215 | void __init config_atari(void) | 180 | void __init config_atari(void) |
216 | { | 181 | { |
217 | unsigned short tos_version; | 182 | unsigned short tos_version; |
218 | 183 | ||
219 | memset(&atari_hw_present, 0, sizeof(atari_hw_present)); | 184 | memset(&atari_hw_present, 0, sizeof(atari_hw_present)); |
220 | 185 | ||
221 | atari_debug_init(); | 186 | atari_debug_init(); |
222 | 187 | ||
223 | ioport_resource.end = 0xFFFFFFFF; /* Change size of I/O space from 64KB | 188 | /* Change size of I/O space from 64KB to 4GB. */ |
224 | to 4GB. */ | 189 | ioport_resource.end = 0xFFFFFFFF; |
225 | 190 | ||
226 | mach_sched_init = atari_sched_init; | 191 | mach_sched_init = atari_sched_init; |
227 | mach_init_IRQ = atari_init_IRQ; | 192 | mach_init_IRQ = atari_init_IRQ; |
228 | mach_get_model = atari_get_model; | 193 | mach_get_model = atari_get_model; |
229 | mach_get_hardware_list = atari_get_hardware_list; | 194 | mach_get_hardware_list = atari_get_hardware_list; |
230 | mach_gettimeoffset = atari_gettimeoffset; | 195 | mach_gettimeoffset = atari_gettimeoffset; |
231 | mach_reset = atari_reset; | 196 | mach_reset = atari_reset; |
232 | mach_max_dma_address = 0xffffff; | 197 | mach_max_dma_address = 0xffffff; |
233 | #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) | 198 | #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) |
234 | mach_beep = atari_mksound; | 199 | mach_beep = atari_mksound; |
235 | #endif | 200 | #endif |
236 | #ifdef CONFIG_HEARTBEAT | 201 | #ifdef CONFIG_HEARTBEAT |
237 | mach_heartbeat = atari_heartbeat; | 202 | mach_heartbeat = atari_heartbeat; |
238 | #endif | 203 | #endif |
239 | 204 | ||
240 | /* Set switches as requested by the user */ | 205 | /* Set switches as requested by the user */ |
241 | if (atari_switches & ATARI_SWITCH_IKBD) | 206 | if (atari_switches & ATARI_SWITCH_IKBD) |
242 | acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID; | 207 | acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID; |
243 | if (atari_switches & ATARI_SWITCH_MIDI) | 208 | if (atari_switches & ATARI_SWITCH_MIDI) |
244 | acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID; | 209 | acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID; |
245 | if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) { | 210 | if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) { |
246 | sound_ym.rd_data_reg_sel = 14; | 211 | sound_ym.rd_data_reg_sel = 14; |
247 | sound_ym.wd_data = sound_ym.rd_data_reg_sel | | 212 | sound_ym.wd_data = sound_ym.rd_data_reg_sel | |
248 | ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) | | 213 | ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) | |
249 | ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0); | 214 | ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0); |
250 | } | 215 | } |
251 | |||
252 | /* ++bjoern: | ||
253 | * Determine hardware present | ||
254 | */ | ||
255 | 216 | ||
256 | printk( "Atari hardware found: " ); | 217 | /* ++bjoern: |
257 | if (MACH_IS_MEDUSA || MACH_IS_HADES) { | 218 | * Determine hardware present |
258 | /* There's no Atari video hardware on the Medusa, but all the | 219 | */ |
259 | * addresses below generate a DTACK so no bus error occurs! */ | 220 | |
260 | } | 221 | printk("Atari hardware found: "); |
261 | else if (hwreg_present( f030_xreg )) { | 222 | if (MACH_IS_MEDUSA || MACH_IS_HADES) { |
262 | ATARIHW_SET(VIDEL_SHIFTER); | 223 | /* There's no Atari video hardware on the Medusa, but all the |
263 | printk( "VIDEL " ); | 224 | * addresses below generate a DTACK so no bus error occurs! */ |
264 | /* This is a temporary hack: If there is Falcon video | 225 | } else if (hwreg_present(f030_xreg)) { |
265 | * hardware, we assume that the ST-DMA serves SCSI instead of | 226 | ATARIHW_SET(VIDEL_SHIFTER); |
266 | * ACSI. In the future, there should be a better method for | 227 | printk("VIDEL "); |
267 | * this... | 228 | /* This is a temporary hack: If there is Falcon video |
268 | */ | 229 | * hardware, we assume that the ST-DMA serves SCSI instead of |
269 | ATARIHW_SET(ST_SCSI); | 230 | * ACSI. In the future, there should be a better method for |
270 | printk( "STDMA-SCSI " ); | 231 | * this... |
271 | } | 232 | */ |
272 | else if (hwreg_present( tt_palette )) { | 233 | ATARIHW_SET(ST_SCSI); |
273 | ATARIHW_SET(TT_SHIFTER); | 234 | printk("STDMA-SCSI "); |
274 | printk( "TT_SHIFTER " ); | 235 | } else if (hwreg_present(tt_palette)) { |
275 | } | 236 | ATARIHW_SET(TT_SHIFTER); |
276 | else if (hwreg_present( &shifter.bas_hi )) { | 237 | printk("TT_SHIFTER "); |
277 | if (hwreg_present( &shifter.bas_lo ) && | 238 | } else if (hwreg_present(&shifter.bas_hi)) { |
278 | (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) { | 239 | if (hwreg_present(&shifter.bas_lo) && |
279 | ATARIHW_SET(EXTD_SHIFTER); | 240 | (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) { |
280 | printk( "EXTD_SHIFTER " ); | 241 | ATARIHW_SET(EXTD_SHIFTER); |
281 | } | 242 | printk("EXTD_SHIFTER "); |
282 | else { | 243 | } else { |
283 | ATARIHW_SET(STND_SHIFTER); | 244 | ATARIHW_SET(STND_SHIFTER); |
284 | printk( "STND_SHIFTER " ); | 245 | printk("STND_SHIFTER "); |
285 | } | 246 | } |
286 | } | 247 | } |
287 | if (hwreg_present( &mfp.par_dt_reg )) { | 248 | if (hwreg_present(&mfp.par_dt_reg)) { |
288 | ATARIHW_SET(ST_MFP); | 249 | ATARIHW_SET(ST_MFP); |
289 | printk( "ST_MFP " ); | 250 | printk("ST_MFP "); |
290 | } | 251 | } |
291 | if (hwreg_present( &tt_mfp.par_dt_reg )) { | 252 | if (hwreg_present(&tt_mfp.par_dt_reg)) { |
292 | ATARIHW_SET(TT_MFP); | 253 | ATARIHW_SET(TT_MFP); |
293 | printk( "TT_MFP " ); | 254 | printk("TT_MFP "); |
294 | } | 255 | } |
295 | if (hwreg_present( &tt_scsi_dma.dma_addr_hi )) { | 256 | if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) { |
296 | ATARIHW_SET(SCSI_DMA); | 257 | ATARIHW_SET(SCSI_DMA); |
297 | printk( "TT_SCSI_DMA " ); | 258 | printk("TT_SCSI_DMA "); |
298 | } | 259 | } |
299 | if (!MACH_IS_HADES && hwreg_present( &st_dma.dma_hi )) { | 260 | if (!MACH_IS_HADES && hwreg_present(&st_dma.dma_hi)) { |
300 | ATARIHW_SET(STND_DMA); | 261 | ATARIHW_SET(STND_DMA); |
301 | printk( "STND_DMA " ); | 262 | printk("STND_DMA "); |
302 | } | 263 | } |
303 | if (MACH_IS_MEDUSA || /* The ST-DMA address registers aren't readable | 264 | /* |
304 | * on all Medusas, so the test below may fail */ | 265 | * The ST-DMA address registers aren't readable |
305 | (hwreg_present( &st_dma.dma_vhi ) && | 266 | * on all Medusas, so the test below may fail |
306 | (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) && | 267 | */ |
307 | st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa && | 268 | if (MACH_IS_MEDUSA || |
308 | (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) && | 269 | (hwreg_present(&st_dma.dma_vhi) && |
309 | st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) { | 270 | (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) && |
310 | ATARIHW_SET(EXTD_DMA); | 271 | st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa && |
311 | printk( "EXTD_DMA " ); | 272 | (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) && |
312 | } | 273 | st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) { |
313 | if (hwreg_present( &tt_scsi.scsi_data )) { | 274 | ATARIHW_SET(EXTD_DMA); |
314 | ATARIHW_SET(TT_SCSI); | 275 | printk("EXTD_DMA "); |
315 | printk( "TT_SCSI " ); | 276 | } |
316 | } | 277 | if (hwreg_present(&tt_scsi.scsi_data)) { |
317 | if (hwreg_present( &sound_ym.rd_data_reg_sel )) { | 278 | ATARIHW_SET(TT_SCSI); |
318 | ATARIHW_SET(YM_2149); | 279 | printk("TT_SCSI "); |
319 | printk( "YM2149 " ); | 280 | } |
320 | } | 281 | if (hwreg_present(&sound_ym.rd_data_reg_sel)) { |
321 | if (!MACH_IS_MEDUSA && !MACH_IS_HADES && | 282 | ATARIHW_SET(YM_2149); |
322 | hwreg_present( &tt_dmasnd.ctrl )) { | 283 | printk("YM2149 "); |
323 | ATARIHW_SET(PCM_8BIT); | 284 | } |
324 | printk( "PCM " ); | 285 | if (!MACH_IS_MEDUSA && !MACH_IS_HADES && |
325 | } | 286 | hwreg_present(&tt_dmasnd.ctrl)) { |
326 | if (!MACH_IS_HADES && hwreg_present( &falcon_codec.unused5 )) { | 287 | ATARIHW_SET(PCM_8BIT); |
327 | ATARIHW_SET(CODEC); | 288 | printk("PCM "); |
328 | printk( "CODEC " ); | 289 | } |
329 | } | 290 | if (!MACH_IS_HADES && hwreg_present(&falcon_codec.unused5)) { |
330 | if (hwreg_present( &dsp56k_host_interface.icr )) { | 291 | ATARIHW_SET(CODEC); |
331 | ATARIHW_SET(DSP56K); | 292 | printk("CODEC "); |
332 | printk( "DSP56K " ); | 293 | } |
333 | } | 294 | if (hwreg_present(&dsp56k_host_interface.icr)) { |
334 | if (hwreg_present( &tt_scc_dma.dma_ctrl ) && | 295 | ATARIHW_SET(DSP56K); |
296 | printk("DSP56K "); | ||
297 | } | ||
298 | if (hwreg_present(&tt_scc_dma.dma_ctrl) && | ||
335 | #if 0 | 299 | #if 0 |
336 | /* This test sucks! Who knows some better? */ | 300 | /* This test sucks! Who knows some better? */ |
337 | (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) && | 301 | (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) && |
338 | (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0) | 302 | (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0) |
339 | #else | 303 | #else |
340 | !MACH_IS_MEDUSA && !MACH_IS_HADES | 304 | !MACH_IS_MEDUSA && !MACH_IS_HADES |
341 | #endif | 305 | #endif |
342 | ) { | 306 | ) { |
343 | ATARIHW_SET(SCC_DMA); | 307 | ATARIHW_SET(SCC_DMA); |
344 | printk( "SCC_DMA " ); | 308 | printk("SCC_DMA "); |
345 | } | 309 | } |
346 | if (scc_test( &scc.cha_a_ctrl )) { | 310 | if (scc_test(&scc.cha_a_ctrl)) { |
347 | ATARIHW_SET(SCC); | 311 | ATARIHW_SET(SCC); |
348 | printk( "SCC " ); | 312 | printk("SCC "); |
349 | } | 313 | } |
350 | if (scc_test( &st_escc.cha_b_ctrl )) { | 314 | if (scc_test(&st_escc.cha_b_ctrl)) { |
351 | ATARIHW_SET( ST_ESCC ); | 315 | ATARIHW_SET(ST_ESCC); |
352 | printk( "ST_ESCC " ); | 316 | printk("ST_ESCC "); |
353 | } | 317 | } |
354 | if (MACH_IS_HADES) | 318 | if (MACH_IS_HADES) { |
355 | { | 319 | ATARIHW_SET(VME); |
356 | ATARIHW_SET( VME ); | 320 | printk("VME "); |
357 | printk( "VME " ); | 321 | } else if (hwreg_present(&tt_scu.sys_mask)) { |
358 | } | 322 | ATARIHW_SET(SCU); |
359 | else if (hwreg_present( &tt_scu.sys_mask )) { | 323 | /* Assume a VME bus if there's a SCU */ |
360 | ATARIHW_SET(SCU); | 324 | ATARIHW_SET(VME); |
361 | /* Assume a VME bus if there's a SCU */ | 325 | printk("VME SCU "); |
362 | ATARIHW_SET( VME ); | 326 | } |
363 | printk( "VME SCU " ); | 327 | if (hwreg_present((void *)(0xffff9210))) { |
364 | } | 328 | ATARIHW_SET(ANALOG_JOY); |
365 | if (hwreg_present( (void *)(0xffff9210) )) { | 329 | printk("ANALOG_JOY "); |
366 | ATARIHW_SET(ANALOG_JOY); | 330 | } |
367 | printk( "ANALOG_JOY " ); | 331 | if (!MACH_IS_HADES && hwreg_present(blitter.halftone)) { |
368 | } | 332 | ATARIHW_SET(BLITTER); |
369 | if (!MACH_IS_HADES && hwreg_present( blitter.halftone )) { | 333 | printk("BLITTER "); |
370 | ATARIHW_SET(BLITTER); | 334 | } |
371 | printk( "BLITTER " ); | 335 | if (hwreg_present((void *)0xfff00039)) { |
372 | } | 336 | ATARIHW_SET(IDE); |
373 | if (hwreg_present((void *)0xfff00039)) { | 337 | printk("IDE "); |
374 | ATARIHW_SET(IDE); | 338 | } |
375 | printk( "IDE " ); | ||
376 | } | ||
377 | #if 1 /* This maybe wrong */ | 339 | #if 1 /* This maybe wrong */ |
378 | if (!MACH_IS_MEDUSA && !MACH_IS_HADES && | 340 | if (!MACH_IS_MEDUSA && !MACH_IS_HADES && |
379 | hwreg_present( &tt_microwire.data ) && | 341 | hwreg_present(&tt_microwire.data) && |
380 | hwreg_present( &tt_microwire.mask ) && | 342 | hwreg_present(&tt_microwire.mask) && |
381 | (tt_microwire.mask = 0x7ff, | 343 | (tt_microwire.mask = 0x7ff, |
382 | udelay(1), | 344 | udelay(1), |
383 | tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR, | 345 | tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR, |
384 | udelay(1), | 346 | udelay(1), |
385 | tt_microwire.data != 0)) { | 347 | tt_microwire.data != 0)) { |
386 | ATARIHW_SET(MICROWIRE); | 348 | ATARIHW_SET(MICROWIRE); |
387 | while (tt_microwire.mask != 0x7ff) ; | 349 | while (tt_microwire.mask != 0x7ff) |
388 | printk( "MICROWIRE " ); | 350 | ; |
389 | } | 351 | printk("MICROWIRE "); |
352 | } | ||
390 | #endif | 353 | #endif |
391 | if (hwreg_present( &tt_rtc.regsel )) { | 354 | if (hwreg_present(&tt_rtc.regsel)) { |
392 | ATARIHW_SET(TT_CLK); | 355 | ATARIHW_SET(TT_CLK); |
393 | printk( "TT_CLK " ); | 356 | printk("TT_CLK "); |
394 | mach_hwclk = atari_tt_hwclk; | 357 | mach_hwclk = atari_tt_hwclk; |
395 | mach_set_clock_mmss = atari_tt_set_clock_mmss; | 358 | mach_set_clock_mmss = atari_tt_set_clock_mmss; |
396 | } | 359 | } |
397 | if (!MACH_IS_HADES && hwreg_present( &mste_rtc.sec_ones)) { | 360 | if (!MACH_IS_HADES && hwreg_present(&mste_rtc.sec_ones)) { |
398 | ATARIHW_SET(MSTE_CLK); | 361 | ATARIHW_SET(MSTE_CLK); |
399 | printk( "MSTE_CLK "); | 362 | printk("MSTE_CLK "); |
400 | mach_hwclk = atari_mste_hwclk; | 363 | mach_hwclk = atari_mste_hwclk; |
401 | mach_set_clock_mmss = atari_mste_set_clock_mmss; | 364 | mach_set_clock_mmss = atari_mste_set_clock_mmss; |
402 | } | 365 | } |
403 | if (!MACH_IS_MEDUSA && !MACH_IS_HADES && | 366 | if (!MACH_IS_MEDUSA && !MACH_IS_HADES && |
404 | hwreg_present( &dma_wd.fdc_speed ) && | 367 | hwreg_present(&dma_wd.fdc_speed) && |
405 | hwreg_write( &dma_wd.fdc_speed, 0 )) { | 368 | hwreg_write(&dma_wd.fdc_speed, 0)) { |
406 | ATARIHW_SET(FDCSPEED); | 369 | ATARIHW_SET(FDCSPEED); |
407 | printk( "FDC_SPEED "); | 370 | printk("FDC_SPEED "); |
408 | } | 371 | } |
409 | if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) { | 372 | if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) { |
410 | ATARIHW_SET(ACSI); | 373 | ATARIHW_SET(ACSI); |
411 | printk( "ACSI " ); | 374 | printk("ACSI "); |
412 | } | 375 | } |
413 | printk("\n"); | 376 | printk("\n"); |
414 | 377 | ||
415 | if (CPU_IS_040_OR_060) | 378 | if (CPU_IS_040_OR_060) |
416 | /* Now it seems to be safe to turn of the tt0 transparent | 379 | /* Now it seems to be safe to turn of the tt0 transparent |
417 | * translation (the one that must not be turned off in | 380 | * translation (the one that must not be turned off in |
418 | * head.S...) | 381 | * head.S...) |
419 | */ | 382 | */ |
420 | __asm__ volatile ("moveq #0,%/d0\n\t" | 383 | asm volatile ("\n" |
421 | ".chip 68040\n\t" | 384 | " moveq #0,%%d0\n" |
422 | "movec %%d0,%%itt0\n\t" | 385 | " .chip 68040\n" |
423 | "movec %%d0,%%dtt0\n\t" | 386 | " movec %%d0,%%itt0\n" |
424 | ".chip 68k" | 387 | " movec %%d0,%%dtt0\n" |
425 | : /* no outputs */ | 388 | " .chip 68k" |
426 | : /* no inputs */ | 389 | : /* no outputs */ |
427 | : "d0"); | 390 | : /* no inputs */ |
428 | 391 | : "d0"); | |
429 | /* allocator for memory that must reside in st-ram */ | 392 | |
430 | atari_stram_init (); | 393 | /* allocator for memory that must reside in st-ram */ |
431 | 394 | atari_stram_init(); | |
432 | /* Set up a mapping for the VMEbus address region: | 395 | |
433 | * | 396 | /* Set up a mapping for the VMEbus address region: |
434 | * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff | 397 | * |
435 | * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at | 398 | * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff |
436 | * 0xfe000000 virt., because this can be done with a single | 399 | * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at |
437 | * transparent translation. On the 68040, lots of often unused | 400 | * 0xfe000000 virt., because this can be done with a single |
438 | * page tables would be needed otherwise. On a MegaSTE or similar, | 401 | * transparent translation. On the 68040, lots of often unused |
439 | * the highest byte is stripped off by hardware due to the 24 bit | 402 | * page tables would be needed otherwise. On a MegaSTE or similar, |
440 | * design of the bus. | 403 | * the highest byte is stripped off by hardware due to the 24 bit |
441 | */ | 404 | * design of the bus. |
405 | */ | ||
406 | |||
407 | if (CPU_IS_020_OR_030) { | ||
408 | unsigned long tt1_val; | ||
409 | tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache | ||
410 | * inhibit, read and write, FDC mask = 3, | ||
411 | * FDC val = 4 -> Supervisor only */ | ||
412 | asm volatile ("\n" | ||
413 | " .chip 68030\n" | ||
414 | " pmove %0@,%/tt1\n" | ||
415 | " .chip 68k" | ||
416 | : : "a" (&tt1_val)); | ||
417 | } else { | ||
418 | asm volatile ("\n" | ||
419 | " .chip 68040\n" | ||
420 | " movec %0,%%itt1\n" | ||
421 | " movec %0,%%dtt1\n" | ||
422 | " .chip 68k" | ||
423 | : | ||
424 | : "d" (0xfe00a040)); /* Translate 0xfexxxxxx, enable, | ||
425 | * supervisor only, non-cacheable/ | ||
426 | * serialized, writable */ | ||
427 | |||
428 | } | ||
442 | 429 | ||
443 | if (CPU_IS_020_OR_030) { | 430 | /* Fetch tos version at Physical 2 */ |
444 | unsigned long tt1_val; | 431 | /* |
445 | tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache | 432 | * We my not be able to access this address if the kernel is |
446 | * inhibit, read and write, FDC mask = 3, | 433 | * loaded to st ram, since the first page is unmapped. On the |
447 | * FDC val = 4 -> Supervisor only */ | 434 | * Medusa this is always the case and there is nothing we can do |
448 | __asm__ __volatile__ ( ".chip 68030\n\t" | 435 | * about this, so we just assume the smaller offset. For the TT |
449 | "pmove %0@,%/tt1\n\t" | 436 | * we use the fact that in head.S we have set up a mapping |
450 | ".chip 68k" | 437 | * 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible |
451 | : : "a" (&tt1_val) ); | 438 | * in the last 16MB of the address space. |
452 | } | 439 | */ |
453 | else { | 440 | tos_version = (MACH_IS_MEDUSA || MACH_IS_HADES) ? |
454 | __asm__ __volatile__ | 441 | 0xfff : *(unsigned short *)0xff000002; |
455 | ( "movel %0,%/d0\n\t" | 442 | atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68; |
456 | ".chip 68040\n\t" | ||
457 | "movec %%d0,%%itt1\n\t" | ||
458 | "movec %%d0,%%dtt1\n\t" | ||
459 | ".chip 68k" | ||
460 | : | ||
461 | : "g" (0xfe00a040) /* Translate 0xfexxxxxx, enable, | ||
462 | * supervisor only, non-cacheable/ | ||
463 | * serialized, writable */ | ||
464 | : "d0" ); | ||
465 | |||
466 | } | ||
467 | |||
468 | /* Fetch tos version at Physical 2 */ | ||
469 | /* We my not be able to access this address if the kernel is | ||
470 | loaded to st ram, since the first page is unmapped. On the | ||
471 | Medusa this is always the case and there is nothing we can do | ||
472 | about this, so we just assume the smaller offset. For the TT | ||
473 | we use the fact that in head.S we have set up a mapping | ||
474 | 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible | ||
475 | in the last 16MB of the address space. */ | ||
476 | tos_version = (MACH_IS_MEDUSA || MACH_IS_HADES) ? | ||
477 | 0xfff : *(unsigned short *)0xff000002; | ||
478 | atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68; | ||
479 | } | 443 | } |
480 | 444 | ||
481 | #ifdef CONFIG_HEARTBEAT | 445 | #ifdef CONFIG_HEARTBEAT |
482 | static void atari_heartbeat( int on ) | 446 | static void atari_heartbeat(int on) |
483 | { | 447 | { |
484 | unsigned char tmp; | 448 | unsigned char tmp; |
485 | unsigned long flags; | 449 | unsigned long flags; |
486 | 450 | ||
487 | if (atari_dont_touch_floppy_select) | 451 | if (atari_dont_touch_floppy_select) |
488 | return; | 452 | return; |
489 | 453 | ||
490 | local_irq_save(flags); | 454 | local_irq_save(flags); |
491 | sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */ | 455 | sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */ |
492 | tmp = sound_ym.rd_data_reg_sel; | 456 | tmp = sound_ym.rd_data_reg_sel; |
493 | sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02); | 457 | sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02); |
494 | local_irq_restore(flags); | 458 | local_irq_restore(flags); |
495 | } | 459 | } |
496 | #endif | 460 | #endif |
497 | 461 | ||
@@ -526,180 +490,171 @@ static void atari_heartbeat( int on ) | |||
526 | 490 | ||
527 | /* ++andreas: no need for complicated code, just depend on prefetch */ | 491 | /* ++andreas: no need for complicated code, just depend on prefetch */ |
528 | 492 | ||
529 | static void atari_reset (void) | 493 | static void atari_reset(void) |
530 | { | 494 | { |
531 | long tc_val = 0; | 495 | long tc_val = 0; |
532 | long reset_addr; | 496 | long reset_addr; |
533 | 497 | ||
534 | /* On the Medusa, phys. 0x4 may contain garbage because it's no | 498 | /* |
535 | ROM. See above for explanation why we cannot use PTOV(4). */ | 499 | * On the Medusa, phys. 0x4 may contain garbage because it's no |
536 | reset_addr = MACH_IS_HADES ? 0x7fe00030 : | 500 | * ROM. See above for explanation why we cannot use PTOV(4). |
537 | MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 : | 501 | */ |
538 | *(unsigned long *) 0xff000004; | 502 | reset_addr = MACH_IS_HADES ? 0x7fe00030 : |
539 | 503 | MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 : | |
540 | /* reset ACIA for switch off OverScan, if it's active */ | 504 | *(unsigned long *) 0xff000004; |
541 | if (atari_switches & ATARI_SWITCH_OVSC_IKBD) | 505 | |
542 | acia.key_ctrl = ACIA_RESET; | 506 | /* reset ACIA for switch off OverScan, if it's active */ |
543 | if (atari_switches & ATARI_SWITCH_OVSC_MIDI) | 507 | if (atari_switches & ATARI_SWITCH_OVSC_IKBD) |
544 | acia.mid_ctrl = ACIA_RESET; | 508 | acia.key_ctrl = ACIA_RESET; |
545 | 509 | if (atari_switches & ATARI_SWITCH_OVSC_MIDI) | |
546 | /* processor independent: turn off interrupts and reset the VBR; | 510 | acia.mid_ctrl = ACIA_RESET; |
547 | * the caches must be left enabled, else prefetching the final jump | 511 | |
548 | * instruction doesn't work. */ | 512 | /* processor independent: turn off interrupts and reset the VBR; |
549 | local_irq_disable(); | 513 | * the caches must be left enabled, else prefetching the final jump |
550 | __asm__ __volatile__ | 514 | * instruction doesn't work. |
551 | ("moveq #0,%/d0\n\t" | 515 | */ |
552 | "movec %/d0,%/vbr" | 516 | local_irq_disable(); |
553 | : : : "d0" ); | 517 | asm volatile ("movec %0,%%vbr" |
554 | 518 | : : "d" (0)); | |
555 | if (CPU_IS_040_OR_060) { | 519 | |
556 | unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); | 520 | if (CPU_IS_040_OR_060) { |
557 | if (CPU_IS_060) { | 521 | unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); |
558 | /* 68060: clear PCR to turn off superscalar operation */ | 522 | if (CPU_IS_060) { |
559 | __asm__ __volatile__ | 523 | /* 68060: clear PCR to turn off superscalar operation */ |
560 | ("moveq #0,%/d0\n\t" | 524 | asm volatile ("\n" |
561 | ".chip 68060\n\t" | 525 | " .chip 68060\n" |
562 | "movec %%d0,%%pcr\n\t" | 526 | " movec %0,%%pcr\n" |
563 | ".chip 68k" | 527 | " .chip 68k" |
564 | : : : "d0" ); | 528 | : : "d" (0)); |
565 | } | 529 | } |
566 | 530 | ||
567 | __asm__ __volatile__ | 531 | asm volatile ("\n" |
568 | ("movel %0,%/d0\n\t" | 532 | " move.l %0,%%d0\n" |
569 | "andl #0xff000000,%/d0\n\t" | 533 | " and.l #0xff000000,%%d0\n" |
570 | "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */ | 534 | " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */ |
571 | ".chip 68040\n\t" | 535 | " .chip 68040\n" |
572 | "movec %%d0,%%itt0\n\t" | 536 | " movec %%d0,%%itt0\n" |
573 | "movec %%d0,%%dtt0\n\t" | 537 | " movec %%d0,%%dtt0\n" |
574 | ".chip 68k\n\t" | 538 | " .chip 68k\n" |
575 | "jmp %0@\n\t" | 539 | " jmp %0@" |
576 | : /* no outputs */ | 540 | : : "a" (jmp_addr040) |
577 | : "a" (jmp_addr040) | 541 | : "d0"); |
578 | : "d0" ); | 542 | jmp_addr_label040: |
579 | jmp_addr_label040: | 543 | asm volatile ("\n" |
580 | __asm__ __volatile__ | 544 | " moveq #0,%%d0\n" |
581 | ("moveq #0,%/d0\n\t" | 545 | " nop\n" |
582 | "nop\n\t" | 546 | " .chip 68040\n" |
583 | ".chip 68040\n\t" | 547 | " cinva %%bc\n" |
584 | "cinva %%bc\n\t" | 548 | " nop\n" |
585 | "nop\n\t" | 549 | " pflusha\n" |
586 | "pflusha\n\t" | 550 | " nop\n" |
587 | "nop\n\t" | 551 | " movec %%d0,%%tc\n" |
588 | "movec %%d0,%%tc\n\t" | 552 | " nop\n" |
589 | "nop\n\t" | 553 | /* the following setup of transparent translations is needed on the |
590 | /* the following setup of transparent translations is needed on the | 554 | * Afterburner040 to successfully reboot. Other machines shouldn't |
591 | * Afterburner040 to successfully reboot. Other machines shouldn't | 555 | * care about a different tt regs setup, they also didn't care in |
592 | * care about a different tt regs setup, they also didn't care in | 556 | * the past that the regs weren't turned off. */ |
593 | * the past that the regs weren't turned off. */ | 557 | " move.l #0xffc000,%%d0\n" /* whole insn space cacheable */ |
594 | "movel #0xffc000,%%d0\n\t" /* whole insn space cacheable */ | 558 | " movec %%d0,%%itt0\n" |
595 | "movec %%d0,%%itt0\n\t" | 559 | " movec %%d0,%%itt1\n" |
596 | "movec %%d0,%%itt1\n\t" | 560 | " or.w #0x40,%/d0\n" /* whole data space non-cacheable/ser. */ |
597 | "orw #0x40,%/d0\n\t" /* whole data space non-cacheable/ser. */ | 561 | " movec %%d0,%%dtt0\n" |
598 | "movec %%d0,%%dtt0\n\t" | 562 | " movec %%d0,%%dtt1\n" |
599 | "movec %%d0,%%dtt1\n\t" | 563 | " .chip 68k\n" |
600 | ".chip 68k\n\t" | 564 | " jmp %0@" |
601 | "jmp %0@" | 565 | : /* no outputs */ |
602 | : /* no outputs */ | 566 | : "a" (reset_addr) |
603 | : "a" (reset_addr) | 567 | : "d0"); |
604 | : "d0"); | 568 | } else |
605 | } | 569 | asm volatile ("\n" |
606 | else | 570 | " pmove %0@,%%tc\n" |
607 | __asm__ __volatile__ | 571 | " jmp %1@" |
608 | ("pmove %0@,%/tc\n\t" | 572 | : /* no outputs */ |
609 | "jmp %1@" | 573 | : "a" (&tc_val), "a" (reset_addr)); |
610 | : /* no outputs */ | ||
611 | : "a" (&tc_val), "a" (reset_addr)); | ||
612 | } | 574 | } |
613 | 575 | ||
614 | 576 | ||
615 | static void atari_get_model(char *model) | 577 | static void atari_get_model(char *model) |
616 | { | 578 | { |
617 | strcpy(model, "Atari "); | 579 | strcpy(model, "Atari "); |
618 | switch (atari_mch_cookie >> 16) { | 580 | switch (atari_mch_cookie >> 16) { |
619 | case ATARI_MCH_ST: | 581 | case ATARI_MCH_ST: |
620 | if (ATARIHW_PRESENT(MSTE_CLK)) | 582 | if (ATARIHW_PRESENT(MSTE_CLK)) |
621 | strcat (model, "Mega ST"); | 583 | strcat(model, "Mega ST"); |
622 | else | 584 | else |
623 | strcat (model, "ST"); | 585 | strcat(model, "ST"); |
624 | break; | 586 | break; |
625 | case ATARI_MCH_STE: | 587 | case ATARI_MCH_STE: |
626 | if (MACH_IS_MSTE) | 588 | if (MACH_IS_MSTE) |
627 | strcat (model, "Mega STE"); | 589 | strcat(model, "Mega STE"); |
628 | else | 590 | else |
629 | strcat (model, "STE"); | 591 | strcat(model, "STE"); |
630 | break; | 592 | break; |
631 | case ATARI_MCH_TT: | 593 | case ATARI_MCH_TT: |
632 | if (MACH_IS_MEDUSA) | 594 | if (MACH_IS_MEDUSA) |
633 | /* Medusa has TT _MCH cookie */ | 595 | /* Medusa has TT _MCH cookie */ |
634 | strcat (model, "Medusa"); | 596 | strcat(model, "Medusa"); |
635 | else if (MACH_IS_HADES) | 597 | else if (MACH_IS_HADES) |
636 | strcat(model, "Hades"); | 598 | strcat(model, "Hades"); |
637 | else | 599 | else |
638 | strcat (model, "TT"); | 600 | strcat(model, "TT"); |
639 | break; | 601 | break; |
640 | case ATARI_MCH_FALCON: | 602 | case ATARI_MCH_FALCON: |
641 | strcat (model, "Falcon"); | 603 | strcat(model, "Falcon"); |
642 | if (MACH_IS_AB40) | 604 | if (MACH_IS_AB40) |
643 | strcat (model, " (with Afterburner040)"); | 605 | strcat(model, " (with Afterburner040)"); |
644 | break; | 606 | break; |
645 | default: | 607 | default: |
646 | sprintf (model + strlen (model), "(unknown mach cookie 0x%lx)", | 608 | sprintf(model + strlen(model), "(unknown mach cookie 0x%lx)", |
647 | atari_mch_cookie); | 609 | atari_mch_cookie); |
648 | break; | 610 | break; |
649 | } | 611 | } |
650 | } | 612 | } |
651 | 613 | ||
652 | 614 | ||
653 | static int atari_get_hardware_list(char *buffer) | 615 | static int atari_get_hardware_list(char *buffer) |
654 | { | 616 | { |
655 | int len = 0, i; | 617 | int len = 0, i; |
656 | 618 | ||
657 | for (i = 0; i < m68k_num_memory; i++) | 619 | for (i = 0; i < m68k_num_memory; i++) |
658 | len += sprintf (buffer+len, "\t%3ld MB at 0x%08lx (%s)\n", | 620 | len += sprintf(buffer+len, "\t%3ld MB at 0x%08lx (%s)\n", |
659 | m68k_memory[i].size >> 20, m68k_memory[i].addr, | 621 | m68k_memory[i].size >> 20, m68k_memory[i].addr, |
660 | (m68k_memory[i].addr & 0xff000000 ? | 622 | (m68k_memory[i].addr & 0xff000000 ? |
661 | "alternate RAM" : "ST-RAM")); | 623 | "alternate RAM" : "ST-RAM")); |
662 | 624 | ||
663 | #define ATARIHW_ANNOUNCE(name,str) \ | 625 | #define ATARIHW_ANNOUNCE(name, str) \ |
664 | if (ATARIHW_PRESENT(name)) \ | 626 | if (ATARIHW_PRESENT(name)) \ |
665 | len += sprintf (buffer + len, "\t%s\n", str) | 627 | len += sprintf(buffer + len, "\t%s\n", str) |
666 | 628 | ||
667 | len += sprintf (buffer + len, "Detected hardware:\n"); | 629 | len += sprintf(buffer + len, "Detected hardware:\n"); |
668 | ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter"); | 630 | ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter"); |
669 | ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter"); | 631 | ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter"); |
670 | ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter"); | 632 | ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter"); |
671 | ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter"); | 633 | ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter"); |
672 | ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator"); | 634 | ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator"); |
673 | ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound"); | 635 | ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound"); |
674 | ATARIHW_ANNOUNCE(CODEC, "CODEC Sound"); | 636 | ATARIHW_ANNOUNCE(CODEC, "CODEC Sound"); |
675 | ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)"); | 637 | ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)"); |
676 | ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)"); | 638 | ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)"); |
677 | ATARIHW_ANNOUNCE(ACSI, "ACSI Interface"); | 639 | ATARIHW_ANNOUNCE(ACSI, "ACSI Interface"); |
678 | ATARIHW_ANNOUNCE(IDE, "IDE Interface"); | 640 | ATARIHW_ANNOUNCE(IDE, "IDE Interface"); |
679 | ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC"); | 641 | ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC"); |
680 | ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901"); | 642 | ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901"); |
681 | ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901"); | 643 | ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901"); |
682 | ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530"); | 644 | ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530"); |
683 | ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230"); | 645 | ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230"); |
684 | ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface"); | 646 | ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface"); |
685 | ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface"); | 647 | ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface"); |
686 | ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)"); | 648 | ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)"); |
687 | ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)"); | 649 | ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)"); |
688 | ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380"); | 650 | ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380"); |
689 | ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC"); | 651 | ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC"); |
690 | ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A"); | 652 | ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A"); |
691 | ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15"); | 653 | ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15"); |
692 | ATARIHW_ANNOUNCE(SCU, "System Control Unit"); | 654 | ATARIHW_ANNOUNCE(SCU, "System Control Unit"); |
693 | ATARIHW_ANNOUNCE(BLITTER, "Blitter"); | 655 | ATARIHW_ANNOUNCE(BLITTER, "Blitter"); |
694 | ATARIHW_ANNOUNCE(VME, "VME Bus"); | 656 | ATARIHW_ANNOUNCE(VME, "VME Bus"); |
695 | ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); | 657 | ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); |
696 | 658 | ||
697 | return(len); | 659 | return len; |
698 | } | 660 | } |
699 | |||
700 | /* | ||
701 | * Local variables: | ||
702 | * c-indent-level: 4 | ||
703 | * tab-width: 8 | ||
704 | * End: | ||
705 | */ | ||
diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c index 4ae01004d8dd..66983fe87509 100644 --- a/arch/m68k/atari/debug.c +++ b/arch/m68k/atari/debug.c | |||
@@ -30,317 +30,311 @@ int atari_SCC_init_done; | |||
30 | int atari_SCC_reset_done; | 30 | int atari_SCC_reset_done; |
31 | 31 | ||
32 | static struct console atari_console_driver = { | 32 | static struct console atari_console_driver = { |
33 | .name = "debug", | 33 | .name = "debug", |
34 | .flags = CON_PRINTBUFFER, | 34 | .flags = CON_PRINTBUFFER, |
35 | .index = -1, | 35 | .index = -1, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | 38 | ||
39 | static inline void ata_mfp_out (char c) | 39 | static inline void ata_mfp_out(char c) |
40 | { | 40 | { |
41 | while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */ | 41 | while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */ |
42 | barrier (); | 42 | barrier(); |
43 | mfp.usart_dta = c; | 43 | mfp.usart_dta = c; |
44 | } | 44 | } |
45 | 45 | ||
46 | void atari_mfp_console_write (struct console *co, const char *str, | 46 | void atari_mfp_console_write(struct console *co, const char *str, |
47 | unsigned int count) | 47 | unsigned int count) |
48 | { | 48 | { |
49 | while (count--) { | 49 | while (count--) { |
50 | if (*str == '\n') | 50 | if (*str == '\n') |
51 | ata_mfp_out( '\r' ); | 51 | ata_mfp_out('\r'); |
52 | ata_mfp_out( *str++ ); | 52 | ata_mfp_out(*str++); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | static inline void ata_scc_out (char c) | 56 | static inline void ata_scc_out(char c) |
57 | { | 57 | { |
58 | do { | 58 | do { |
59 | MFPDELAY(); | ||
60 | } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ | ||
59 | MFPDELAY(); | 61 | MFPDELAY(); |
60 | } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ | 62 | scc.cha_b_data = c; |
61 | MFPDELAY(); | ||
62 | scc.cha_b_data = c; | ||
63 | } | 63 | } |
64 | 64 | ||
65 | void atari_scc_console_write (struct console *co, const char *str, | 65 | void atari_scc_console_write(struct console *co, const char *str, |
66 | unsigned int count) | 66 | unsigned int count) |
67 | { | 67 | { |
68 | while (count--) { | 68 | while (count--) { |
69 | if (*str == '\n') | 69 | if (*str == '\n') |
70 | ata_scc_out( '\r' ); | 70 | ata_scc_out('\r'); |
71 | ata_scc_out( *str++ ); | 71 | ata_scc_out(*str++); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | static inline void ata_midi_out (char c) | 75 | static inline void ata_midi_out(char c) |
76 | { | 76 | { |
77 | while (!(acia.mid_ctrl & ACIA_TDRE)) /* wait for tx buf empty */ | 77 | while (!(acia.mid_ctrl & ACIA_TDRE)) /* wait for tx buf empty */ |
78 | barrier (); | 78 | barrier(); |
79 | acia.mid_data = c; | 79 | acia.mid_data = c; |
80 | } | 80 | } |
81 | 81 | ||
82 | void atari_midi_console_write (struct console *co, const char *str, | 82 | void atari_midi_console_write(struct console *co, const char *str, |
83 | unsigned int count) | 83 | unsigned int count) |
84 | { | 84 | { |
85 | while (count--) { | 85 | while (count--) { |
86 | if (*str == '\n') | 86 | if (*str == '\n') |
87 | ata_midi_out( '\r' ); | 87 | ata_midi_out('\r'); |
88 | ata_midi_out( *str++ ); | 88 | ata_midi_out(*str++); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | static int ata_par_out (char c) | 92 | static int ata_par_out(char c) |
93 | { | 93 | { |
94 | unsigned char tmp; | 94 | unsigned char tmp; |
95 | /* This a some-seconds timeout in case no printer is connected */ | 95 | /* This a some-seconds timeout in case no printer is connected */ |
96 | unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ; | 96 | unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ; |
97 | 97 | ||
98 | while( (mfp.par_dt_reg & 1) && --i ) /* wait for BUSY == L */ | 98 | while ((mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */ |
99 | ; | 99 | ; |
100 | if (!i) return( 0 ); | 100 | if (!i) |
101 | 101 | return 0; | |
102 | sound_ym.rd_data_reg_sel = 15; /* select port B */ | 102 | |
103 | sound_ym.wd_data = c; /* put char onto port */ | 103 | sound_ym.rd_data_reg_sel = 15; /* select port B */ |
104 | sound_ym.rd_data_reg_sel = 14; /* select port A */ | 104 | sound_ym.wd_data = c; /* put char onto port */ |
105 | tmp = sound_ym.rd_data_reg_sel; | 105 | sound_ym.rd_data_reg_sel = 14; /* select port A */ |
106 | sound_ym.wd_data = tmp & ~0x20; /* set strobe L */ | 106 | tmp = sound_ym.rd_data_reg_sel; |
107 | MFPDELAY(); /* wait a bit */ | 107 | sound_ym.wd_data = tmp & ~0x20; /* set strobe L */ |
108 | sound_ym.wd_data = tmp | 0x20; /* set strobe H */ | 108 | MFPDELAY(); /* wait a bit */ |
109 | return( 1 ); | 109 | sound_ym.wd_data = tmp | 0x20; /* set strobe H */ |
110 | return 1; | ||
110 | } | 111 | } |
111 | 112 | ||
112 | static void atari_par_console_write (struct console *co, const char *str, | 113 | static void atari_par_console_write(struct console *co, const char *str, |
113 | unsigned int count) | 114 | unsigned int count) |
114 | { | 115 | { |
115 | static int printer_present = 1; | 116 | static int printer_present = 1; |
116 | |||
117 | if (!printer_present) | ||
118 | return; | ||
119 | 117 | ||
120 | while (count--) { | 118 | if (!printer_present) |
121 | if (*str == '\n') | ||
122 | if (!ata_par_out( '\r' )) { | ||
123 | printer_present = 0; | ||
124 | return; | 119 | return; |
125 | } | 120 | |
126 | if (!ata_par_out( *str++ )) { | 121 | while (count--) { |
127 | printer_present = 0; | 122 | if (*str == '\n') { |
128 | return; | 123 | if (!ata_par_out('\r')) { |
124 | printer_present = 0; | ||
125 | return; | ||
126 | } | ||
127 | } | ||
128 | if (!ata_par_out(*str++)) { | ||
129 | printer_present = 0; | ||
130 | return; | ||
131 | } | ||
129 | } | 132 | } |
130 | } | ||
131 | } | 133 | } |
132 | 134 | ||
133 | #ifdef CONFIG_SERIAL_CONSOLE | 135 | #ifdef CONFIG_SERIAL_CONSOLE |
134 | int atari_mfp_console_wait_key(struct console *co) | 136 | int atari_mfp_console_wait_key(struct console *co) |
135 | { | 137 | { |
136 | while( !(mfp.rcv_stat & 0x80) ) /* wait for rx buf filled */ | 138 | while (!(mfp.rcv_stat & 0x80)) /* wait for rx buf filled */ |
137 | barrier(); | 139 | barrier(); |
138 | return( mfp.usart_dta ); | 140 | return mfp.usart_dta; |
139 | } | 141 | } |
140 | 142 | ||
141 | int atari_scc_console_wait_key(struct console *co) | 143 | int atari_scc_console_wait_key(struct console *co) |
142 | { | 144 | { |
143 | do { | 145 | do { |
146 | MFPDELAY(); | ||
147 | } while (!(scc.cha_b_ctrl & 0x01)); /* wait for rx buf filled */ | ||
144 | MFPDELAY(); | 148 | MFPDELAY(); |
145 | } while( !(scc.cha_b_ctrl & 0x01) ); /* wait for rx buf filled */ | 149 | return scc.cha_b_data; |
146 | MFPDELAY(); | ||
147 | return( scc.cha_b_data ); | ||
148 | } | 150 | } |
149 | 151 | ||
150 | int atari_midi_console_wait_key(struct console *co) | 152 | int atari_midi_console_wait_key(struct console *co) |
151 | { | 153 | { |
152 | while( !(acia.mid_ctrl & ACIA_RDRF) ) /* wait for rx buf filled */ | 154 | while (!(acia.mid_ctrl & ACIA_RDRF)) /* wait for rx buf filled */ |
153 | barrier(); | 155 | barrier(); |
154 | return( acia.mid_data ); | 156 | return acia.mid_data; |
155 | } | 157 | } |
156 | #endif | 158 | #endif |
157 | 159 | ||
158 | /* The following two functions do a quick'n'dirty initialization of the MFP or | 160 | /* |
161 | * The following two functions do a quick'n'dirty initialization of the MFP or | ||
159 | * SCC serial ports. They're used by the debugging interface, kgdb, and the | 162 | * SCC serial ports. They're used by the debugging interface, kgdb, and the |
160 | * serial console code. */ | 163 | * serial console code. |
164 | */ | ||
161 | #ifndef CONFIG_SERIAL_CONSOLE | 165 | #ifndef CONFIG_SERIAL_CONSOLE |
162 | static void __init atari_init_mfp_port( int cflag ) | 166 | static void __init atari_init_mfp_port(int cflag) |
163 | #else | 167 | #else |
164 | void atari_init_mfp_port( int cflag ) | 168 | void atari_init_mfp_port(int cflag) |
165 | #endif | 169 | #endif |
166 | { | 170 | { |
167 | /* timer values for 1200...115200 bps; > 38400 select 110, 134, or 150 | 171 | /* |
168 | * bps, resp., and work only correct if there's a RSVE or RSSPEED */ | 172 | * timer values for 1200...115200 bps; > 38400 select 110, 134, or 150 |
169 | static int baud_table[9] = { 16, 11, 8, 4, 2, 1, 175, 143, 128 }; | 173 | * bps, resp., and work only correct if there's a RSVE or RSSPEED |
170 | int baud = cflag & CBAUD; | 174 | */ |
171 | int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x04 : 0x06) : 0; | 175 | static int baud_table[9] = { 16, 11, 8, 4, 2, 1, 175, 143, 128 }; |
172 | int csize = ((cflag & CSIZE) == CS7) ? 0x20 : 0x00; | 176 | int baud = cflag & CBAUD; |
173 | 177 | int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x04 : 0x06) : 0; | |
174 | if (cflag & CBAUDEX) | 178 | int csize = ((cflag & CSIZE) == CS7) ? 0x20 : 0x00; |
175 | baud += B38400; | 179 | |
176 | if (baud < B1200 || baud > B38400+2) | 180 | if (cflag & CBAUDEX) |
177 | baud = B9600; /* use default 9600bps for non-implemented rates */ | 181 | baud += B38400; |
178 | baud -= B1200; /* baud_table[] starts at 1200bps */ | 182 | if (baud < B1200 || baud > B38400+2) |
179 | 183 | baud = B9600; /* use default 9600bps for non-implemented rates */ | |
180 | mfp.trn_stat &= ~0x01; /* disable TX */ | 184 | baud -= B1200; /* baud_table[] starts at 1200bps */ |
181 | mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */ | 185 | |
182 | mfp.tim_ct_cd &= 0x70; /* stop timer D */ | 186 | mfp.trn_stat &= ~0x01; /* disable TX */ |
183 | mfp.tim_dt_d = baud_table[baud]; | 187 | mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */ |
184 | mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ | 188 | mfp.tim_ct_cd &= 0x70; /* stop timer D */ |
185 | mfp.trn_stat |= 0x01; /* enable TX */ | 189 | mfp.tim_dt_d = baud_table[baud]; |
186 | 190 | mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ | |
187 | atari_MFP_init_done = 1; | 191 | mfp.trn_stat |= 0x01; /* enable TX */ |
192 | |||
193 | atari_MFP_init_done = 1; | ||
188 | } | 194 | } |
189 | 195 | ||
190 | #define SCC_WRITE(reg,val) \ | 196 | #define SCC_WRITE(reg, val) \ |
191 | do { \ | 197 | do { \ |
192 | scc.cha_b_ctrl = (reg); \ | 198 | scc.cha_b_ctrl = (reg); \ |
193 | MFPDELAY(); \ | 199 | MFPDELAY(); \ |
194 | scc.cha_b_ctrl = (val); \ | 200 | scc.cha_b_ctrl = (val); \ |
195 | MFPDELAY(); \ | 201 | MFPDELAY(); \ |
196 | } while(0) | 202 | } while (0) |
197 | 203 | ||
198 | /* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a | 204 | /* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a |
199 | * delay of ~ 60us. */ | 205 | * delay of ~ 60us. */ |
200 | #define LONG_DELAY() \ | 206 | #define LONG_DELAY() \ |
201 | do { \ | 207 | do { \ |
202 | int i; \ | 208 | int i; \ |
203 | for( i = 100; i > 0; --i ) \ | 209 | for (i = 100; i > 0; --i) \ |
204 | MFPDELAY(); \ | 210 | MFPDELAY(); \ |
205 | } while(0) | 211 | } while (0) |
206 | 212 | ||
207 | #ifndef CONFIG_SERIAL_CONSOLE | 213 | #ifndef CONFIG_SERIAL_CONSOLE |
208 | static void __init atari_init_scc_port( int cflag ) | 214 | static void __init atari_init_scc_port(int cflag) |
209 | #else | 215 | #else |
210 | void atari_init_scc_port( int cflag ) | 216 | void atari_init_scc_port(int cflag) |
211 | #endif | 217 | #endif |
212 | { | 218 | { |
213 | extern int atari_SCC_reset_done; | 219 | extern int atari_SCC_reset_done; |
214 | static int clksrc_table[9] = | 220 | static int clksrc_table[9] = |
215 | /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */ | 221 | /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */ |
216 | { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 }; | 222 | { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 }; |
217 | static int brgsrc_table[9] = | 223 | static int brgsrc_table[9] = |
218 | /* reg 14: 0 = RTxC, 2 = PCLK */ | 224 | /* reg 14: 0 = RTxC, 2 = PCLK */ |
219 | { 2, 2, 2, 2, 2, 2, 0, 2, 2 }; | 225 | { 2, 2, 2, 2, 2, 2, 0, 2, 2 }; |
220 | static int clkmode_table[9] = | 226 | static int clkmode_table[9] = |
221 | /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */ | 227 | /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */ |
222 | { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 }; | 228 | { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 }; |
223 | static int div_table[9] = | 229 | static int div_table[9] = |
224 | /* reg12 (BRG low) */ | 230 | /* reg12 (BRG low) */ |
225 | { 208, 138, 103, 50, 24, 11, 1, 0, 0 }; | 231 | { 208, 138, 103, 50, 24, 11, 1, 0, 0 }; |
226 | 232 | ||
227 | int baud = cflag & CBAUD; | 233 | int baud = cflag & CBAUD; |
228 | int clksrc, clkmode, div, reg3, reg5; | 234 | int clksrc, clkmode, div, reg3, reg5; |
229 | 235 | ||
230 | if (cflag & CBAUDEX) | 236 | if (cflag & CBAUDEX) |
231 | baud += B38400; | 237 | baud += B38400; |
232 | if (baud < B1200 || baud > B38400+2) | 238 | if (baud < B1200 || baud > B38400+2) |
233 | baud = B9600; /* use default 9600bps for non-implemented rates */ | 239 | baud = B9600; /* use default 9600bps for non-implemented rates */ |
234 | baud -= B1200; /* tables starts at 1200bps */ | 240 | baud -= B1200; /* tables starts at 1200bps */ |
235 | 241 | ||
236 | clksrc = clksrc_table[baud]; | 242 | clksrc = clksrc_table[baud]; |
237 | clkmode = clkmode_table[baud]; | 243 | clkmode = clkmode_table[baud]; |
238 | div = div_table[baud]; | 244 | div = div_table[baud]; |
239 | if (ATARIHW_PRESENT(TT_MFP) && baud >= 6) { | 245 | if (ATARIHW_PRESENT(TT_MFP) && baud >= 6) { |
240 | /* special treatment for TT, where rates >= 38400 are done via TRxC */ | 246 | /* special treatment for TT, where rates >= 38400 are done via TRxC */ |
241 | clksrc = 0x28; /* TRxC */ | 247 | clksrc = 0x28; /* TRxC */ |
242 | clkmode = baud == 6 ? 0xc0 : | 248 | clkmode = baud == 6 ? 0xc0 : |
243 | baud == 7 ? 0x80 : /* really 76800bps */ | 249 | baud == 7 ? 0x80 : /* really 76800bps */ |
244 | 0x40; /* really 153600bps */ | 250 | 0x40; /* really 153600bps */ |
245 | div = 0; | 251 | div = 0; |
246 | } | 252 | } |
247 | 253 | ||
248 | reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40; | 254 | reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40; |
249 | reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */; | 255 | reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */; |
250 | 256 | ||
251 | (void)scc.cha_b_ctrl; /* reset reg pointer */ | 257 | (void)scc.cha_b_ctrl; /* reset reg pointer */ |
252 | SCC_WRITE( 9, 0xc0 ); /* reset */ | 258 | SCC_WRITE(9, 0xc0); /* reset */ |
253 | LONG_DELAY(); /* extra delay after WR9 access */ | 259 | LONG_DELAY(); /* extra delay after WR9 access */ |
254 | SCC_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | | 260 | SCC_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) |
255 | 0x04 /* 1 stopbit */ | | 261 | : 0 | 0x04 /* 1 stopbit */ | clkmode); |
256 | clkmode ); | 262 | SCC_WRITE(3, reg3); |
257 | SCC_WRITE( 3, reg3 ); | 263 | SCC_WRITE(5, reg5); |
258 | SCC_WRITE( 5, reg5 ); | 264 | SCC_WRITE(9, 0); /* no interrupts */ |
259 | SCC_WRITE( 9, 0 ); /* no interrupts */ | 265 | LONG_DELAY(); /* extra delay after WR9 access */ |
260 | LONG_DELAY(); /* extra delay after WR9 access */ | 266 | SCC_WRITE(10, 0); /* NRZ mode */ |
261 | SCC_WRITE( 10, 0 ); /* NRZ mode */ | 267 | SCC_WRITE(11, clksrc); /* main clock source */ |
262 | SCC_WRITE( 11, clksrc ); /* main clock source */ | 268 | SCC_WRITE(12, div); /* BRG value */ |
263 | SCC_WRITE( 12, div ); /* BRG value */ | 269 | SCC_WRITE(13, 0); /* BRG high byte */ |
264 | SCC_WRITE( 13, 0 ); /* BRG high byte */ | 270 | SCC_WRITE(14, brgsrc_table[baud]); |
265 | SCC_WRITE( 14, brgsrc_table[baud] ); | 271 | SCC_WRITE(14, brgsrc_table[baud] | (div ? 1 : 0)); |
266 | SCC_WRITE( 14, brgsrc_table[baud] | (div ? 1 : 0) ); | 272 | SCC_WRITE(3, reg3 | 1); |
267 | SCC_WRITE( 3, reg3 | 1 ); | 273 | SCC_WRITE(5, reg5 | 8); |
268 | SCC_WRITE( 5, reg5 | 8 ); | 274 | |
269 | 275 | atari_SCC_reset_done = 1; | |
270 | atari_SCC_reset_done = 1; | 276 | atari_SCC_init_done = 1; |
271 | atari_SCC_init_done = 1; | ||
272 | } | 277 | } |
273 | 278 | ||
274 | #ifndef CONFIG_SERIAL_CONSOLE | 279 | #ifndef CONFIG_SERIAL_CONSOLE |
275 | static void __init atari_init_midi_port( int cflag ) | 280 | static void __init atari_init_midi_port(int cflag) |
276 | #else | 281 | #else |
277 | void atari_init_midi_port( int cflag ) | 282 | void atari_init_midi_port(int cflag) |
278 | #endif | 283 | #endif |
279 | { | 284 | { |
280 | int baud = cflag & CBAUD; | 285 | int baud = cflag & CBAUD; |
281 | int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00; | 286 | int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00; |
282 | /* warning 7N1 isn't possible! (instead 7O2 is used...) */ | 287 | /* warning 7N1 isn't possible! (instead 7O2 is used...) */ |
283 | int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x0c : 0x08) : 0x04; | 288 | int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x0c : 0x08) : 0x04; |
284 | int div; | 289 | int div; |
285 | 290 | ||
286 | /* 4800 selects 7812.5, 115200 selects 500000, all other (incl. 9600 as | 291 | /* 4800 selects 7812.5, 115200 selects 500000, all other (incl. 9600 as |
287 | * default) the standard MIDI speed 31250. */ | 292 | * default) the standard MIDI speed 31250. */ |
288 | if (cflag & CBAUDEX) | 293 | if (cflag & CBAUDEX) |
289 | baud += B38400; | 294 | baud += B38400; |
290 | if (baud == B4800) | 295 | if (baud == B4800) |
291 | div = ACIA_DIV64; /* really 7812.5 bps */ | 296 | div = ACIA_DIV64; /* really 7812.5 bps */ |
292 | else if (baud == B38400+2 /* 115200 */) | 297 | else if (baud == B38400+2 /* 115200 */) |
293 | div = ACIA_DIV1; /* really 500 kbps (does that work??) */ | 298 | div = ACIA_DIV1; /* really 500 kbps (does that work??) */ |
294 | else | 299 | else |
295 | div = ACIA_DIV16; /* 31250 bps, standard for MIDI */ | 300 | div = ACIA_DIV16; /* 31250 bps, standard for MIDI */ |
296 | 301 | ||
297 | /* RTS low, ints disabled */ | 302 | /* RTS low, ints disabled */ |
298 | acia.mid_ctrl = div | csize | parity | | 303 | acia.mid_ctrl = div | csize | parity | |
299 | ((atari_switches & ATARI_SWITCH_MIDI) ? | 304 | ((atari_switches & ATARI_SWITCH_MIDI) ? |
300 | ACIA_RHTID : ACIA_RLTID); | 305 | ACIA_RHTID : ACIA_RLTID); |
301 | } | 306 | } |
302 | 307 | ||
303 | void __init atari_debug_init(void) | 308 | void __init atari_debug_init(void) |
304 | { | 309 | { |
305 | if (!strcmp( m68k_debug_device, "ser" )) { | 310 | if (!strcmp(m68k_debug_device, "ser")) { |
306 | /* defaults to ser2 for a Falcon and ser1 otherwise */ | 311 | /* defaults to ser2 for a Falcon and ser1 otherwise */ |
307 | strcpy( m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1" ); | 312 | strcpy(m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1"); |
308 | 313 | } | |
309 | } | ||
310 | |||
311 | if (!strcmp( m68k_debug_device, "ser1" )) { | ||
312 | /* ST-MFP Modem1 serial port */ | ||
313 | atari_init_mfp_port( B9600|CS8 ); | ||
314 | atari_console_driver.write = atari_mfp_console_write; | ||
315 | } | ||
316 | else if (!strcmp( m68k_debug_device, "ser2" )) { | ||
317 | /* SCC Modem2 serial port */ | ||
318 | atari_init_scc_port( B9600|CS8 ); | ||
319 | atari_console_driver.write = atari_scc_console_write; | ||
320 | } | ||
321 | else if (!strcmp( m68k_debug_device, "midi" )) { | ||
322 | /* MIDI port */ | ||
323 | atari_init_midi_port( B9600|CS8 ); | ||
324 | atari_console_driver.write = atari_midi_console_write; | ||
325 | } | ||
326 | else if (!strcmp( m68k_debug_device, "par" )) { | ||
327 | /* parallel printer */ | ||
328 | atari_turnoff_irq( IRQ_MFP_BUSY ); /* avoid ints */ | ||
329 | sound_ym.rd_data_reg_sel = 7; /* select mixer control */ | ||
330 | sound_ym.wd_data = 0xff; /* sound off, ports are output */ | ||
331 | sound_ym.rd_data_reg_sel = 15; /* select port B */ | ||
332 | sound_ym.wd_data = 0; /* no char */ | ||
333 | sound_ym.rd_data_reg_sel = 14; /* select port A */ | ||
334 | sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */ | ||
335 | atari_console_driver.write = atari_par_console_write; | ||
336 | } | ||
337 | if (atari_console_driver.write) | ||
338 | register_console(&atari_console_driver); | ||
339 | } | ||
340 | 314 | ||
341 | /* | 315 | if (!strcmp(m68k_debug_device, "ser1")) { |
342 | * Local variables: | 316 | /* ST-MFP Modem1 serial port */ |
343 | * c-indent-level: 4 | 317 | atari_init_mfp_port(B9600|CS8); |
344 | * tab-width: 8 | 318 | atari_console_driver.write = atari_mfp_console_write; |
345 | * End: | 319 | } else if (!strcmp(m68k_debug_device, "ser2")) { |
346 | */ | 320 | /* SCC Modem2 serial port */ |
321 | atari_init_scc_port(B9600|CS8); | ||
322 | atari_console_driver.write = atari_scc_console_write; | ||
323 | } else if (!strcmp(m68k_debug_device, "midi")) { | ||
324 | /* MIDI port */ | ||
325 | atari_init_midi_port(B9600|CS8); | ||
326 | atari_console_driver.write = atari_midi_console_write; | ||
327 | } else if (!strcmp(m68k_debug_device, "par")) { | ||
328 | /* parallel printer */ | ||
329 | atari_turnoff_irq(IRQ_MFP_BUSY); /* avoid ints */ | ||
330 | sound_ym.rd_data_reg_sel = 7; /* select mixer control */ | ||
331 | sound_ym.wd_data = 0xff; /* sound off, ports are output */ | ||
332 | sound_ym.rd_data_reg_sel = 15; /* select port B */ | ||
333 | sound_ym.wd_data = 0; /* no char */ | ||
334 | sound_ym.rd_data_reg_sel = 14; /* select port A */ | ||
335 | sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */ | ||
336 | atari_console_driver.write = atari_par_console_write; | ||
337 | } | ||
338 | if (atari_console_driver.write) | ||
339 | register_console(&atari_console_driver); | ||
340 | } | ||