Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/m68k/atari/config.c |
| 3 | * |
| 4 | * Copyright (C) 1994 Bjoern Brauel |
| 5 | * |
| 6 | * 5/2/94 Roman Hodek: |
| 7 | * Added setting of time_adj to get a better clock. |
| 8 | * |
| 9 | * 5/14/94 Roman Hodek: |
| 10 | * gettod() for TT |
| 11 | * |
| 12 | * 5/15/94 Roman Hodek: |
| 13 | * hard_reset_now() for Atari (and others?) |
| 14 | * |
| 15 | * 94/12/30 Andreas Schwab: |
| 16 | * atari_sched_init fixed to get precise clock. |
| 17 | * |
| 18 | * This file is subject to the terms and conditions of the GNU General Public |
| 19 | * License. See the file COPYING in the main directory of this archive |
| 20 | * for more details. |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | * Miscellaneous atari stuff |
| 25 | */ |
| 26 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #include <linux/types.h> |
| 28 | #include <linux/mm.h> |
Alexey Dobriyan | 813dcf7 | 2008-10-03 22:42:36 +0400 | [diff] [blame] | 29 | #include <linux/seq_file.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #include <linux/console.h> |
| 31 | #include <linux/init.h> |
| 32 | #include <linux/delay.h> |
| 33 | #include <linux/ioport.h> |
Michael Schmitz | 736b24d | 2013-04-06 13:26:39 +1300 | [diff] [blame] | 34 | #include <linux/platform_device.h> |
Michael Schmitz | 01a18d1 | 2013-04-06 13:26:45 +1300 | [diff] [blame] | 35 | #include <linux/usb/isp116x.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #include <linux/vt_kern.h> |
Adrian Bunk | a3b2004 | 2008-02-04 22:30:26 -0800 | [diff] [blame] | 37 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | #include <asm/bootinfo.h> |
| 40 | #include <asm/setup.h> |
| 41 | #include <asm/atarihw.h> |
| 42 | #include <asm/atariints.h> |
| 43 | #include <asm/atari_stram.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <asm/machdep.h> |
| 45 | #include <asm/hwtest.h> |
| 46 | #include <asm/io.h> |
| 47 | |
| 48 | u_long atari_mch_cookie; |
Adrian Bunk | a3b2004 | 2008-02-04 22:30:26 -0800 | [diff] [blame] | 49 | EXPORT_SYMBOL(atari_mch_cookie); |
| 50 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | u_long atari_mch_type; |
Adrian Bunk | a3b2004 | 2008-02-04 22:30:26 -0800 | [diff] [blame] | 52 | EXPORT_SYMBOL(atari_mch_type); |
| 53 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | struct atari_hw_present atari_hw_present; |
Adrian Bunk | a3b2004 | 2008-02-04 22:30:26 -0800 | [diff] [blame] | 55 | EXPORT_SYMBOL(atari_hw_present); |
| 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | u_long atari_switches; |
Adrian Bunk | a3b2004 | 2008-02-04 22:30:26 -0800 | [diff] [blame] | 58 | EXPORT_SYMBOL(atari_switches); |
| 59 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | int atari_dont_touch_floppy_select; |
Adrian Bunk | a3b2004 | 2008-02-04 22:30:26 -0800 | [diff] [blame] | 61 | EXPORT_SYMBOL(atari_dont_touch_floppy_select); |
| 62 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | int atari_rtc_year_offset; |
| 64 | |
| 65 | /* local function prototypes */ |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 66 | static void atari_reset(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | static void atari_get_model(char *model); |
Alexey Dobriyan | 813dcf7 | 2008-10-03 22:42:36 +0400 | [diff] [blame] | 68 | static void atari_get_hardware_list(struct seq_file *m); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
| 70 | /* atari specific irq functions */ |
| 71 | extern void atari_init_IRQ (void); |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 72 | extern void atari_mksound(unsigned int count, unsigned int ticks); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | #ifdef CONFIG_HEARTBEAT |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 74 | static void atari_heartbeat(int on); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | #endif |
| 76 | |
| 77 | /* atari specific timer functions (in time.c) */ |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 78 | extern void atari_sched_init(irq_handler_t); |
Stephen Warren | c8d5ba1 | 2012-11-08 11:34:55 -0700 | [diff] [blame] | 79 | extern u32 atari_gettimeoffset(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | extern int atari_mste_hwclk (int, struct rtc_time *); |
| 81 | extern int atari_tt_hwclk (int, struct rtc_time *); |
| 82 | extern int atari_mste_set_clock_mmss (unsigned long); |
| 83 | extern int atari_tt_set_clock_mmss (unsigned long); |
| 84 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | /* ++roman: This is a more elaborate test for an SCC chip, since the plain |
| 87 | * Medusa board generates DTACK at the SCC's standard addresses, but a SCC |
| 88 | * board in the Medusa is possible. Also, the addresses where the ST_ESCC |
| 89 | * resides generate DTACK without the chip, too. |
| 90 | * The method is to write values into the interrupt vector register, that |
| 91 | * should be readable without trouble (from channel A!). |
| 92 | */ |
| 93 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 94 | static int __init scc_test(volatile char *ctla) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 96 | if (!hwreg_present(ctla)) |
| 97 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | MFPDELAY(); |
| 99 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 100 | *ctla = 2; |
| 101 | MFPDELAY(); |
| 102 | *ctla = 0x40; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | MFPDELAY(); |
| 104 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 105 | *ctla = 2; |
| 106 | MFPDELAY(); |
| 107 | if (*ctla != 0x40) |
| 108 | return 0; |
| 109 | MFPDELAY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 111 | *ctla = 2; |
| 112 | MFPDELAY(); |
| 113 | *ctla = 0x60; |
| 114 | MFPDELAY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 116 | *ctla = 2; |
| 117 | MFPDELAY(); |
| 118 | if (*ctla != 0x60) |
| 119 | return 0; |
| 120 | |
| 121 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | |
| 125 | /* |
| 126 | * Parse an Atari-specific record in the bootinfo |
| 127 | */ |
| 128 | |
| 129 | int __init atari_parse_bootinfo(const struct bi_record *record) |
| 130 | { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 131 | int unknown = 0; |
| 132 | const u_long *data = record->data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 134 | switch (record->tag) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | case BI_ATARI_MCH_COOKIE: |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 136 | atari_mch_cookie = *data; |
| 137 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | case BI_ATARI_MCH_TYPE: |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 139 | atari_mch_type = *data; |
| 140 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | default: |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 142 | unknown = 1; |
| 143 | break; |
| 144 | } |
| 145 | return unknown; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | |
| 149 | /* Parse the Atari-specific switches= option. */ |
Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 150 | static int __init atari_switches_setup(char *str) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | { |
Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 152 | char switches[strlen(str) + 1]; |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 153 | char *p; |
| 154 | int ovsc_shift; |
| 155 | char *args = switches; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | |
Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 157 | if (!MACH_IS_ATARI) |
| 158 | return 0; |
| 159 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 160 | /* copy string to local array, strsep works destructively... */ |
Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 161 | strcpy(switches, str); |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 162 | atari_switches = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 164 | /* parse the options */ |
| 165 | while ((p = strsep(&args, ",")) != NULL) { |
| 166 | if (!*p) |
| 167 | continue; |
| 168 | ovsc_shift = 0; |
| 169 | if (strncmp(p, "ov_", 3) == 0) { |
| 170 | p += 3; |
| 171 | ovsc_shift = ATARI_SWITCH_OVSC_SHIFT; |
| 172 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 174 | if (strcmp(p, "ikbd") == 0) { |
| 175 | /* RTS line of IKBD ACIA */ |
| 176 | atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift; |
| 177 | } else if (strcmp(p, "midi") == 0) { |
| 178 | /* RTS line of MIDI ACIA */ |
| 179 | atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift; |
| 180 | } else if (strcmp(p, "snd6") == 0) { |
| 181 | atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift; |
| 182 | } else if (strcmp(p, "snd7") == 0) { |
| 183 | atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift; |
| 184 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | } |
Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 186 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | } |
| 188 | |
Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 189 | early_param("switches", atari_switches_setup); |
| 190 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | |
| 192 | /* |
| 193 | * Setup the Atari configuration info |
| 194 | */ |
| 195 | |
| 196 | void __init config_atari(void) |
| 197 | { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 198 | unsigned short tos_version; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 200 | memset(&atari_hw_present, 0, sizeof(atari_hw_present)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 202 | /* Change size of I/O space from 64KB to 4GB. */ |
| 203 | ioport_resource.end = 0xFFFFFFFF; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 205 | mach_sched_init = atari_sched_init; |
| 206 | mach_init_IRQ = atari_init_IRQ; |
| 207 | mach_get_model = atari_get_model; |
| 208 | mach_get_hardware_list = atari_get_hardware_list; |
Stephen Warren | c8d5ba1 | 2012-11-08 11:34:55 -0700 | [diff] [blame] | 209 | arch_gettimeoffset = atari_gettimeoffset; |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 210 | mach_reset = atari_reset; |
| 211 | mach_max_dma_address = 0xffffff; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 213 | mach_beep = atari_mksound; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | #endif |
| 215 | #ifdef CONFIG_HEARTBEAT |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 216 | mach_heartbeat = atari_heartbeat; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | #endif |
| 218 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 219 | /* Set switches as requested by the user */ |
| 220 | if (atari_switches & ATARI_SWITCH_IKBD) |
| 221 | acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID; |
| 222 | if (atari_switches & ATARI_SWITCH_MIDI) |
| 223 | acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID; |
| 224 | if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) { |
| 225 | sound_ym.rd_data_reg_sel = 14; |
| 226 | sound_ym.wd_data = sound_ym.rd_data_reg_sel | |
| 227 | ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) | |
| 228 | ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0); |
| 229 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 231 | /* ++bjoern: |
| 232 | * Determine hardware present |
| 233 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 235 | printk("Atari hardware found: "); |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 236 | if (MACH_IS_MEDUSA) { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 237 | /* There's no Atari video hardware on the Medusa, but all the |
| 238 | * addresses below generate a DTACK so no bus error occurs! */ |
| 239 | } else if (hwreg_present(f030_xreg)) { |
| 240 | ATARIHW_SET(VIDEL_SHIFTER); |
| 241 | printk("VIDEL "); |
| 242 | /* This is a temporary hack: If there is Falcon video |
| 243 | * hardware, we assume that the ST-DMA serves SCSI instead of |
| 244 | * ACSI. In the future, there should be a better method for |
| 245 | * this... |
| 246 | */ |
| 247 | ATARIHW_SET(ST_SCSI); |
| 248 | printk("STDMA-SCSI "); |
| 249 | } else if (hwreg_present(tt_palette)) { |
| 250 | ATARIHW_SET(TT_SHIFTER); |
| 251 | printk("TT_SHIFTER "); |
| 252 | } else if (hwreg_present(&shifter.bas_hi)) { |
| 253 | if (hwreg_present(&shifter.bas_lo) && |
| 254 | (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) { |
| 255 | ATARIHW_SET(EXTD_SHIFTER); |
| 256 | printk("EXTD_SHIFTER "); |
| 257 | } else { |
| 258 | ATARIHW_SET(STND_SHIFTER); |
| 259 | printk("STND_SHIFTER "); |
| 260 | } |
| 261 | } |
Geert Uytterhoeven | 3d92e8f | 2009-02-22 09:38:47 +0100 | [diff] [blame] | 262 | if (hwreg_present(&st_mfp.par_dt_reg)) { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 263 | ATARIHW_SET(ST_MFP); |
| 264 | printk("ST_MFP "); |
| 265 | } |
| 266 | if (hwreg_present(&tt_mfp.par_dt_reg)) { |
| 267 | ATARIHW_SET(TT_MFP); |
| 268 | printk("TT_MFP "); |
| 269 | } |
| 270 | if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) { |
| 271 | ATARIHW_SET(SCSI_DMA); |
| 272 | printk("TT_SCSI_DMA "); |
| 273 | } |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 274 | /* |
| 275 | * The ST-DMA address registers aren't readable |
| 276 | * on all Medusas, so the test below may fail |
| 277 | */ |
| 278 | if (MACH_IS_MEDUSA || |
| 279 | (hwreg_present(&st_dma.dma_vhi) && |
| 280 | (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) && |
| 281 | st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa && |
| 282 | (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) && |
| 283 | st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) { |
| 284 | ATARIHW_SET(EXTD_DMA); |
| 285 | printk("EXTD_DMA "); |
| 286 | } |
| 287 | if (hwreg_present(&tt_scsi.scsi_data)) { |
| 288 | ATARIHW_SET(TT_SCSI); |
| 289 | printk("TT_SCSI "); |
| 290 | } |
| 291 | if (hwreg_present(&sound_ym.rd_data_reg_sel)) { |
| 292 | ATARIHW_SET(YM_2149); |
| 293 | printk("YM2149 "); |
| 294 | } |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 295 | if (!MACH_IS_MEDUSA && hwreg_present(&tt_dmasnd.ctrl)) { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 296 | ATARIHW_SET(PCM_8BIT); |
| 297 | printk("PCM "); |
| 298 | } |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 299 | if (hwreg_present(&falcon_codec.unused5)) { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 300 | ATARIHW_SET(CODEC); |
| 301 | printk("CODEC "); |
| 302 | } |
| 303 | if (hwreg_present(&dsp56k_host_interface.icr)) { |
| 304 | ATARIHW_SET(DSP56K); |
| 305 | printk("DSP56K "); |
| 306 | } |
| 307 | if (hwreg_present(&tt_scc_dma.dma_ctrl) && |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | #if 0 |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 309 | /* This test sucks! Who knows some better? */ |
| 310 | (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) && |
| 311 | (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | #else |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 313 | !MACH_IS_MEDUSA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | #endif |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 315 | ) { |
| 316 | ATARIHW_SET(SCC_DMA); |
| 317 | printk("SCC_DMA "); |
| 318 | } |
Geert Uytterhoeven | de339e4 | 2011-01-16 20:47:47 +0100 | [diff] [blame] | 319 | if (scc_test(&atari_scc.cha_a_ctrl)) { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 320 | ATARIHW_SET(SCC); |
| 321 | printk("SCC "); |
| 322 | } |
| 323 | if (scc_test(&st_escc.cha_b_ctrl)) { |
| 324 | ATARIHW_SET(ST_ESCC); |
| 325 | printk("ST_ESCC "); |
| 326 | } |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 327 | if (hwreg_present(&tt_scu.sys_mask)) { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 328 | ATARIHW_SET(SCU); |
| 329 | /* Assume a VME bus if there's a SCU */ |
| 330 | ATARIHW_SET(VME); |
| 331 | printk("VME SCU "); |
| 332 | } |
| 333 | if (hwreg_present((void *)(0xffff9210))) { |
| 334 | ATARIHW_SET(ANALOG_JOY); |
| 335 | printk("ANALOG_JOY "); |
| 336 | } |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 337 | if (hwreg_present(blitter.halftone)) { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 338 | ATARIHW_SET(BLITTER); |
| 339 | printk("BLITTER "); |
| 340 | } |
| 341 | if (hwreg_present((void *)0xfff00039)) { |
| 342 | ATARIHW_SET(IDE); |
| 343 | printk("IDE "); |
| 344 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | #if 1 /* This maybe wrong */ |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 346 | if (!MACH_IS_MEDUSA && hwreg_present(&tt_microwire.data) && |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 347 | hwreg_present(&tt_microwire.mask) && |
| 348 | (tt_microwire.mask = 0x7ff, |
| 349 | udelay(1), |
| 350 | tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR, |
| 351 | udelay(1), |
| 352 | tt_microwire.data != 0)) { |
| 353 | ATARIHW_SET(MICROWIRE); |
| 354 | while (tt_microwire.mask != 0x7ff) |
| 355 | ; |
| 356 | printk("MICROWIRE "); |
| 357 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | #endif |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 359 | if (hwreg_present(&tt_rtc.regsel)) { |
| 360 | ATARIHW_SET(TT_CLK); |
| 361 | printk("TT_CLK "); |
| 362 | mach_hwclk = atari_tt_hwclk; |
| 363 | mach_set_clock_mmss = atari_tt_set_clock_mmss; |
| 364 | } |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 365 | if (hwreg_present(&mste_rtc.sec_ones)) { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 366 | ATARIHW_SET(MSTE_CLK); |
| 367 | printk("MSTE_CLK "); |
| 368 | mach_hwclk = atari_mste_hwclk; |
| 369 | mach_set_clock_mmss = atari_mste_set_clock_mmss; |
| 370 | } |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 371 | if (!MACH_IS_MEDUSA && hwreg_present(&dma_wd.fdc_speed) && |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 372 | hwreg_write(&dma_wd.fdc_speed, 0)) { |
| 373 | ATARIHW_SET(FDCSPEED); |
| 374 | printk("FDC_SPEED "); |
| 375 | } |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 376 | if (!ATARIHW_PRESENT(ST_SCSI)) { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 377 | ATARIHW_SET(ACSI); |
| 378 | printk("ACSI "); |
| 379 | } |
| 380 | printk("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 382 | if (CPU_IS_040_OR_060) |
| 383 | /* Now it seems to be safe to turn of the tt0 transparent |
| 384 | * translation (the one that must not be turned off in |
| 385 | * head.S...) |
| 386 | */ |
| 387 | asm volatile ("\n" |
| 388 | " moveq #0,%%d0\n" |
| 389 | " .chip 68040\n" |
| 390 | " movec %%d0,%%itt0\n" |
| 391 | " movec %%d0,%%dtt0\n" |
| 392 | " .chip 68k" |
| 393 | : /* no outputs */ |
| 394 | : /* no inputs */ |
| 395 | : "d0"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 397 | /* allocator for memory that must reside in st-ram */ |
| 398 | atari_stram_init(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 400 | /* Set up a mapping for the VMEbus address region: |
| 401 | * |
| 402 | * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff |
| 403 | * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at |
| 404 | * 0xfe000000 virt., because this can be done with a single |
| 405 | * transparent translation. On the 68040, lots of often unused |
| 406 | * page tables would be needed otherwise. On a MegaSTE or similar, |
| 407 | * the highest byte is stripped off by hardware due to the 24 bit |
| 408 | * design of the bus. |
| 409 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 411 | if (CPU_IS_020_OR_030) { |
| 412 | unsigned long tt1_val; |
| 413 | tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache |
| 414 | * inhibit, read and write, FDC mask = 3, |
| 415 | * FDC val = 4 -> Supervisor only */ |
| 416 | asm volatile ("\n" |
| 417 | " .chip 68030\n" |
Andreas Schwab | 2a35350 | 2012-01-09 15:10:15 +0100 | [diff] [blame] | 418 | " pmove %0,%/tt1\n" |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 419 | " .chip 68k" |
Andreas Schwab | 2a35350 | 2012-01-09 15:10:15 +0100 | [diff] [blame] | 420 | : : "m" (tt1_val)); |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 421 | } else { |
| 422 | asm volatile ("\n" |
| 423 | " .chip 68040\n" |
| 424 | " movec %0,%%itt1\n" |
| 425 | " movec %0,%%dtt1\n" |
| 426 | " .chip 68k" |
| 427 | : |
| 428 | : "d" (0xfe00a040)); /* Translate 0xfexxxxxx, enable, |
| 429 | * supervisor only, non-cacheable/ |
| 430 | * serialized, writable */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 432 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 434 | /* Fetch tos version at Physical 2 */ |
| 435 | /* |
| 436 | * We my not be able to access this address if the kernel is |
| 437 | * loaded to st ram, since the first page is unmapped. On the |
| 438 | * Medusa this is always the case and there is nothing we can do |
| 439 | * about this, so we just assume the smaller offset. For the TT |
| 440 | * we use the fact that in head.S we have set up a mapping |
| 441 | * 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible |
| 442 | * in the last 16MB of the address space. |
| 443 | */ |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 444 | tos_version = (MACH_IS_MEDUSA) ? |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 445 | 0xfff : *(unsigned short *)0xff000002; |
| 446 | atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | #ifdef CONFIG_HEARTBEAT |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 450 | static void atari_heartbeat(int on) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 452 | unsigned char tmp; |
| 453 | unsigned long flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 455 | if (atari_dont_touch_floppy_select) |
| 456 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 458 | local_irq_save(flags); |
| 459 | sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */ |
| 460 | tmp = sound_ym.rd_data_reg_sel; |
| 461 | sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02); |
| 462 | local_irq_restore(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | } |
| 464 | #endif |
| 465 | |
| 466 | /* ++roman: |
| 467 | * |
| 468 | * This function does a reset on machines that lack the ability to |
| 469 | * assert the processor's _RESET signal somehow via hardware. It is |
| 470 | * based on the fact that you can find the initial SP and PC values |
| 471 | * after a reset at physical addresses 0 and 4. This works pretty well |
| 472 | * for Atari machines, since the lowest 8 bytes of physical memory are |
| 473 | * really ROM (mapped by hardware). For other 680x0 machines: don't |
| 474 | * know if it works... |
| 475 | * |
| 476 | * To get the values at addresses 0 and 4, the MMU better is turned |
| 477 | * off first. After that, we have to jump into physical address space |
| 478 | * (the PC before the pmove statement points to the virtual address of |
| 479 | * the code). Getting that physical address is not hard, but the code |
| 480 | * becomes a bit complex since I've tried to ensure that the jump |
| 481 | * statement after the pmove is in the cache already (otherwise the |
| 482 | * processor can't fetch it!). For that, the code first jumps to the |
| 483 | * jump statement with the (virtual) address of the pmove section in |
| 484 | * an address register . The jump statement is surely in the cache |
| 485 | * now. After that, that physical address of the reset code is loaded |
| 486 | * into the same address register, pmove is done and the same jump |
| 487 | * statements goes to the reset code. Since there are not many |
| 488 | * statements between the two jumps, I hope it stays in the cache. |
| 489 | * |
| 490 | * The C code makes heavy use of the GCC features that you can get the |
| 491 | * address of a C label. No hope to compile this with another compiler |
| 492 | * than GCC! |
| 493 | */ |
| 494 | |
| 495 | /* ++andreas: no need for complicated code, just depend on prefetch */ |
| 496 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 497 | static void atari_reset(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 499 | long tc_val = 0; |
| 500 | long reset_addr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 502 | /* |
| 503 | * On the Medusa, phys. 0x4 may contain garbage because it's no |
| 504 | * ROM. See above for explanation why we cannot use PTOV(4). |
| 505 | */ |
Adrian Bunk | 29c8a24 | 2008-10-13 21:58:59 +0200 | [diff] [blame] | 506 | reset_addr = MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 : |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 507 | *(unsigned long *) 0xff000004; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 509 | /* reset ACIA for switch off OverScan, if it's active */ |
| 510 | if (atari_switches & ATARI_SWITCH_OVSC_IKBD) |
| 511 | acia.key_ctrl = ACIA_RESET; |
| 512 | if (atari_switches & ATARI_SWITCH_OVSC_MIDI) |
| 513 | acia.mid_ctrl = ACIA_RESET; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 515 | /* processor independent: turn off interrupts and reset the VBR; |
| 516 | * the caches must be left enabled, else prefetching the final jump |
| 517 | * instruction doesn't work. |
| 518 | */ |
| 519 | local_irq_disable(); |
| 520 | asm volatile ("movec %0,%%vbr" |
| 521 | : : "d" (0)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 523 | if (CPU_IS_040_OR_060) { |
| 524 | unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); |
| 525 | if (CPU_IS_060) { |
| 526 | /* 68060: clear PCR to turn off superscalar operation */ |
| 527 | asm volatile ("\n" |
| 528 | " .chip 68060\n" |
| 529 | " movec %0,%%pcr\n" |
| 530 | " .chip 68k" |
| 531 | : : "d" (0)); |
| 532 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 534 | asm volatile ("\n" |
| 535 | " move.l %0,%%d0\n" |
| 536 | " and.l #0xff000000,%%d0\n" |
| 537 | " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */ |
| 538 | " .chip 68040\n" |
| 539 | " movec %%d0,%%itt0\n" |
| 540 | " movec %%d0,%%dtt0\n" |
| 541 | " .chip 68k\n" |
| 542 | " jmp %0@" |
| 543 | : : "a" (jmp_addr040) |
| 544 | : "d0"); |
| 545 | jmp_addr_label040: |
| 546 | asm volatile ("\n" |
| 547 | " moveq #0,%%d0\n" |
| 548 | " nop\n" |
| 549 | " .chip 68040\n" |
| 550 | " cinva %%bc\n" |
| 551 | " nop\n" |
| 552 | " pflusha\n" |
| 553 | " nop\n" |
| 554 | " movec %%d0,%%tc\n" |
| 555 | " nop\n" |
| 556 | /* the following setup of transparent translations is needed on the |
| 557 | * Afterburner040 to successfully reboot. Other machines shouldn't |
| 558 | * care about a different tt regs setup, they also didn't care in |
| 559 | * the past that the regs weren't turned off. */ |
| 560 | " move.l #0xffc000,%%d0\n" /* whole insn space cacheable */ |
| 561 | " movec %%d0,%%itt0\n" |
| 562 | " movec %%d0,%%itt1\n" |
| 563 | " or.w #0x40,%/d0\n" /* whole data space non-cacheable/ser. */ |
| 564 | " movec %%d0,%%dtt0\n" |
| 565 | " movec %%d0,%%dtt1\n" |
| 566 | " .chip 68k\n" |
| 567 | " jmp %0@" |
| 568 | : /* no outputs */ |
| 569 | : "a" (reset_addr) |
| 570 | : "d0"); |
| 571 | } else |
| 572 | asm volatile ("\n" |
Andreas Schwab | 2a35350 | 2012-01-09 15:10:15 +0100 | [diff] [blame] | 573 | " pmove %0,%%tc\n" |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 574 | " jmp %1@" |
| 575 | : /* no outputs */ |
Andreas Schwab | 2a35350 | 2012-01-09 15:10:15 +0100 | [diff] [blame] | 576 | : "m" (tc_val), "a" (reset_addr)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | |
| 580 | static void atari_get_model(char *model) |
| 581 | { |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 582 | strcpy(model, "Atari "); |
| 583 | switch (atari_mch_cookie >> 16) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | case ATARI_MCH_ST: |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 585 | if (ATARIHW_PRESENT(MSTE_CLK)) |
| 586 | strcat(model, "Mega ST"); |
| 587 | else |
| 588 | strcat(model, "ST"); |
| 589 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 590 | case ATARI_MCH_STE: |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 591 | if (MACH_IS_MSTE) |
| 592 | strcat(model, "Mega STE"); |
| 593 | else |
| 594 | strcat(model, "STE"); |
| 595 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 | case ATARI_MCH_TT: |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 597 | if (MACH_IS_MEDUSA) |
| 598 | /* Medusa has TT _MCH cookie */ |
| 599 | strcat(model, "Medusa"); |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 600 | else |
| 601 | strcat(model, "TT"); |
| 602 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | case ATARI_MCH_FALCON: |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 604 | strcat(model, "Falcon"); |
| 605 | if (MACH_IS_AB40) |
| 606 | strcat(model, " (with Afterburner040)"); |
| 607 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 608 | default: |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 609 | sprintf(model + strlen(model), "(unknown mach cookie 0x%lx)", |
| 610 | atari_mch_cookie); |
| 611 | break; |
| 612 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 613 | } |
| 614 | |
| 615 | |
Alexey Dobriyan | 813dcf7 | 2008-10-03 22:42:36 +0400 | [diff] [blame] | 616 | static void atari_get_hardware_list(struct seq_file *m) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 617 | { |
Alexey Dobriyan | 813dcf7 | 2008-10-03 22:42:36 +0400 | [diff] [blame] | 618 | int i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 619 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 620 | for (i = 0; i < m68k_num_memory; i++) |
Alexey Dobriyan | 813dcf7 | 2008-10-03 22:42:36 +0400 | [diff] [blame] | 621 | seq_printf(m, "\t%3ld MB at 0x%08lx (%s)\n", |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 622 | m68k_memory[i].size >> 20, m68k_memory[i].addr, |
| 623 | (m68k_memory[i].addr & 0xff000000 ? |
| 624 | "alternate RAM" : "ST-RAM")); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 625 | |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 626 | #define ATARIHW_ANNOUNCE(name, str) \ |
| 627 | if (ATARIHW_PRESENT(name)) \ |
Alexey Dobriyan | 813dcf7 | 2008-10-03 22:42:36 +0400 | [diff] [blame] | 628 | seq_printf(m, "\t%s\n", str) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | |
Alexey Dobriyan | 813dcf7 | 2008-10-03 22:42:36 +0400 | [diff] [blame] | 630 | seq_printf(m, "Detected hardware:\n"); |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 631 | ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter"); |
| 632 | ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter"); |
| 633 | ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter"); |
| 634 | ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter"); |
| 635 | ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator"); |
| 636 | ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound"); |
| 637 | ATARIHW_ANNOUNCE(CODEC, "CODEC Sound"); |
| 638 | ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)"); |
| 639 | ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)"); |
| 640 | ATARIHW_ANNOUNCE(ACSI, "ACSI Interface"); |
| 641 | ATARIHW_ANNOUNCE(IDE, "IDE Interface"); |
| 642 | ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC"); |
| 643 | ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901"); |
| 644 | ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901"); |
| 645 | ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530"); |
| 646 | ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230"); |
| 647 | ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface"); |
| 648 | ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface"); |
| 649 | ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)"); |
| 650 | ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)"); |
| 651 | ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380"); |
| 652 | ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC"); |
| 653 | ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A"); |
| 654 | ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15"); |
| 655 | ATARIHW_ANNOUNCE(SCU, "System Control Unit"); |
| 656 | ATARIHW_ANNOUNCE(BLITTER, "Blitter"); |
| 657 | ATARIHW_ANNOUNCE(VME, "VME Bus"); |
| 658 | ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | } |
Michael Schmitz | 736b24d | 2013-04-06 13:26:39 +1300 | [diff] [blame] | 660 | |
| 661 | /* |
| 662 | * MSch: initial platform device support for Atari, |
Michael Schmitz | 01a18d1 | 2013-04-06 13:26:45 +1300 | [diff] [blame] | 663 | * required for EtherNAT/EtherNEC/NetUSBee drivers |
Michael Schmitz | 736b24d | 2013-04-06 13:26:39 +1300 | [diff] [blame] | 664 | */ |
| 665 | |
Michael Schmitz | 01a18d1 | 2013-04-06 13:26:45 +1300 | [diff] [blame] | 666 | #if defined(CONFIG_ATARI_ETHERNAT) || defined(CONFIG_ATARI_ETHERNEC) |
| 667 | static void isp1160_delay(struct device *dev, int delay) |
| 668 | { |
| 669 | ndelay(delay); |
| 670 | } |
| 671 | #endif |
| 672 | |
Michael Schmitz | 736b24d | 2013-04-06 13:26:39 +1300 | [diff] [blame] | 673 | #ifdef CONFIG_ATARI_ETHERNAT |
| 674 | /* |
| 675 | * EtherNAT: SMC91C111 Ethernet chipset, handled by smc91x driver |
| 676 | */ |
| 677 | |
| 678 | #define ATARI_ETHERNAT_IRQ 140 |
| 679 | |
| 680 | static struct resource smc91x_resources[] = { |
| 681 | [0] = { |
| 682 | .name = "smc91x-regs", |
| 683 | .start = ATARI_ETHERNAT_PHYS_ADDR, |
| 684 | .end = ATARI_ETHERNAT_PHYS_ADDR + 0xfffff, |
| 685 | .flags = IORESOURCE_MEM, |
| 686 | }, |
| 687 | [1] = { |
| 688 | .name = "smc91x-irq", |
| 689 | .start = ATARI_ETHERNAT_IRQ, |
| 690 | .end = ATARI_ETHERNAT_IRQ, |
| 691 | .flags = IORESOURCE_IRQ, |
| 692 | }, |
| 693 | }; |
| 694 | |
| 695 | static struct platform_device smc91x_device = { |
| 696 | .name = "smc91x", |
| 697 | .id = -1, |
| 698 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 699 | .resource = smc91x_resources, |
| 700 | }; |
| 701 | |
Michael Schmitz | 01a18d1 | 2013-04-06 13:26:45 +1300 | [diff] [blame] | 702 | /* |
| 703 | * ISP 1160 - using the isp116x-hcd module |
| 704 | */ |
| 705 | |
| 706 | #define ATARI_USB_PHYS_ADDR 0x80000012 |
| 707 | #define ATARI_USB_IRQ 139 |
| 708 | |
| 709 | static struct resource isp1160_resources[] = { |
| 710 | [0] = { |
| 711 | .name = "isp1160-data", |
| 712 | .start = ATARI_USB_PHYS_ADDR, |
| 713 | .end = ATARI_USB_PHYS_ADDR + 0x1, |
| 714 | .flags = IORESOURCE_MEM, |
| 715 | }, |
| 716 | [1] = { |
| 717 | .name = "isp1160-regs", |
| 718 | .start = ATARI_USB_PHYS_ADDR + 0x4, |
| 719 | .end = ATARI_USB_PHYS_ADDR + 0x5, |
| 720 | .flags = IORESOURCE_MEM, |
| 721 | }, |
| 722 | [2] = { |
| 723 | .name = "isp1160-irq", |
| 724 | .start = ATARI_USB_IRQ, |
| 725 | .end = ATARI_USB_IRQ, |
| 726 | .flags = IORESOURCE_IRQ, |
| 727 | }, |
| 728 | }; |
| 729 | |
| 730 | /* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */ |
| 731 | static struct isp116x_platform_data isp1160_platform_data = { |
| 732 | /* Enable internal resistors on downstream ports */ |
| 733 | .sel15Kres = 1, |
| 734 | /* On-chip overcurrent protection */ |
| 735 | .oc_enable = 1, |
| 736 | /* INT output polarity */ |
| 737 | .int_act_high = 1, |
| 738 | /* INT edge or level triggered */ |
| 739 | .int_edge_triggered = 0, |
| 740 | |
| 741 | /* WAKEUP pin connected - NOT SUPPORTED */ |
| 742 | /* .remote_wakeup_connected = 0, */ |
| 743 | /* Wakeup by devices on usb bus enabled */ |
| 744 | .remote_wakeup_enable = 0, |
| 745 | .delay = isp1160_delay, |
| 746 | }; |
| 747 | |
| 748 | static struct platform_device isp1160_device = { |
| 749 | .name = "isp116x-hcd", |
| 750 | .id = 0, |
| 751 | .num_resources = ARRAY_SIZE(isp1160_resources), |
| 752 | .resource = isp1160_resources, |
| 753 | .dev = { |
| 754 | .platform_data = &isp1160_platform_data, |
| 755 | }, |
| 756 | }; |
| 757 | |
Michael Schmitz | 736b24d | 2013-04-06 13:26:39 +1300 | [diff] [blame] | 758 | static struct platform_device *atari_ethernat_devices[] __initdata = { |
Michael Schmitz | 01a18d1 | 2013-04-06 13:26:45 +1300 | [diff] [blame] | 759 | &smc91x_device, |
| 760 | &isp1160_device |
Michael Schmitz | 736b24d | 2013-04-06 13:26:39 +1300 | [diff] [blame] | 761 | }; |
| 762 | #endif /* CONFIG_ATARI_ETHERNAT */ |
| 763 | |
Michael Schmitz | 1d87a8f | 2013-04-06 13:26:40 +1300 | [diff] [blame] | 764 | #ifdef CONFIG_ATARI_ETHERNEC |
| 765 | /* |
| 766 | * EtherNEC: RTL8019 (NE2000 compatible) Ethernet chipset, |
| 767 | * handled by ne.c driver |
| 768 | */ |
| 769 | |
| 770 | #define ATARI_ETHERNEC_PHYS_ADDR 0xfffa0000 |
| 771 | #define ATARI_ETHERNEC_BASE 0x300 |
| 772 | #define ATARI_ETHERNEC_IRQ IRQ_MFP_TIMER1 |
| 773 | |
| 774 | static struct resource rtl8019_resources[] = { |
| 775 | [0] = { |
| 776 | .name = "rtl8019-regs", |
| 777 | .start = ATARI_ETHERNEC_BASE, |
| 778 | .end = ATARI_ETHERNEC_BASE + 0x20 - 1, |
| 779 | .flags = IORESOURCE_IO, |
| 780 | }, |
| 781 | [1] = { |
| 782 | .name = "rtl8019-irq", |
| 783 | .start = ATARI_ETHERNEC_IRQ, |
| 784 | .end = ATARI_ETHERNEC_IRQ, |
| 785 | .flags = IORESOURCE_IRQ, |
| 786 | }, |
| 787 | }; |
| 788 | |
| 789 | static struct platform_device rtl8019_device = { |
| 790 | .name = "ne", |
| 791 | .id = -1, |
| 792 | .num_resources = ARRAY_SIZE(rtl8019_resources), |
| 793 | .resource = rtl8019_resources, |
| 794 | }; |
| 795 | |
Michael Schmitz | 01a18d1 | 2013-04-06 13:26:45 +1300 | [diff] [blame] | 796 | /* |
| 797 | * NetUSBee: ISP1160 USB host adapter via ROM-port adapter |
| 798 | */ |
| 799 | |
| 800 | #define ATARI_NETUSBEE_PHYS_ADDR 0xfffa8000 |
| 801 | #define ATARI_NETUSBEE_BASE 0x340 |
| 802 | #define ATARI_NETUSBEE_IRQ IRQ_MFP_TIMER2 |
| 803 | |
| 804 | static struct resource netusbee_resources[] = { |
| 805 | [0] = { |
| 806 | .name = "isp1160-data", |
| 807 | .start = ATARI_NETUSBEE_BASE, |
| 808 | .end = ATARI_NETUSBEE_BASE + 0x1, |
| 809 | .flags = IORESOURCE_MEM, |
| 810 | }, |
| 811 | [1] = { |
| 812 | .name = "isp1160-regs", |
| 813 | .start = ATARI_NETUSBEE_BASE + 0x20, |
| 814 | .end = ATARI_NETUSBEE_BASE + 0x21, |
| 815 | .flags = IORESOURCE_MEM, |
| 816 | }, |
| 817 | [2] = { |
| 818 | .name = "isp1160-irq", |
| 819 | .start = ATARI_NETUSBEE_IRQ, |
| 820 | .end = ATARI_NETUSBEE_IRQ, |
| 821 | .flags = IORESOURCE_IRQ, |
| 822 | }, |
| 823 | }; |
| 824 | |
| 825 | /* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */ |
| 826 | static struct isp116x_platform_data netusbee_platform_data = { |
| 827 | /* Enable internal resistors on downstream ports */ |
| 828 | .sel15Kres = 1, |
| 829 | /* On-chip overcurrent protection */ |
| 830 | .oc_enable = 1, |
| 831 | /* INT output polarity */ |
| 832 | .int_act_high = 1, |
| 833 | /* INT edge or level triggered */ |
| 834 | .int_edge_triggered = 0, |
| 835 | |
| 836 | /* WAKEUP pin connected - NOT SUPPORTED */ |
| 837 | /* .remote_wakeup_connected = 0, */ |
| 838 | /* Wakeup by devices on usb bus enabled */ |
| 839 | .remote_wakeup_enable = 0, |
| 840 | .delay = isp1160_delay, |
| 841 | }; |
| 842 | |
| 843 | static struct platform_device netusbee_device = { |
| 844 | .name = "isp116x-hcd", |
| 845 | .id = 1, |
| 846 | .num_resources = ARRAY_SIZE(netusbee_resources), |
| 847 | .resource = netusbee_resources, |
| 848 | .dev = { |
| 849 | .platform_data = &netusbee_platform_data, |
| 850 | }, |
| 851 | }; |
| 852 | |
| 853 | static struct platform_device *atari_netusbee_devices[] __initdata = { |
| 854 | &rtl8019_device, |
| 855 | &netusbee_device |
Michael Schmitz | 1d87a8f | 2013-04-06 13:26:40 +1300 | [diff] [blame] | 856 | }; |
| 857 | #endif /* CONFIG_ATARI_ETHERNEC */ |
| 858 | |
Michael Schmitz | 736b24d | 2013-04-06 13:26:39 +1300 | [diff] [blame] | 859 | int __init atari_platform_init(void) |
| 860 | { |
| 861 | int rv = 0; |
| 862 | |
| 863 | if (!MACH_IS_ATARI) |
| 864 | return -ENODEV; |
| 865 | |
| 866 | #ifdef CONFIG_ATARI_ETHERNAT |
| 867 | { |
| 868 | unsigned char *enatc_virt; |
| 869 | enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf); |
| 870 | if (hwreg_present(enatc_virt)) { |
| 871 | rv = platform_add_devices(atari_ethernat_devices, |
| 872 | ARRAY_SIZE(atari_ethernat_devices)); |
| 873 | } |
| 874 | iounmap(enatc_virt); |
| 875 | } |
| 876 | #endif |
| 877 | |
Michael Schmitz | 1d87a8f | 2013-04-06 13:26:40 +1300 | [diff] [blame] | 878 | #ifdef CONFIG_ATARI_ETHERNEC |
| 879 | { |
| 880 | int error; |
| 881 | unsigned char *enec_virt; |
| 882 | enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf); |
| 883 | if (hwreg_present(enec_virt)) { |
Michael Schmitz | 01a18d1 | 2013-04-06 13:26:45 +1300 | [diff] [blame] | 884 | error = platform_add_devices(atari_netusbee_devices, |
| 885 | ARRAY_SIZE(atari_netusbee_devices)); |
Michael Schmitz | 1d87a8f | 2013-04-06 13:26:40 +1300 | [diff] [blame] | 886 | if (error && !rv) |
| 887 | rv = error; |
| 888 | } |
| 889 | iounmap(enec_virt); |
| 890 | } |
| 891 | #endif |
| 892 | |
Michael Schmitz | 736b24d | 2013-04-06 13:26:39 +1300 | [diff] [blame] | 893 | return rv; |
| 894 | } |
| 895 | |
| 896 | arch_initcall(atari_platform_init); |