18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * linux/arch/m68k/atari/config.c 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 1994 Bjoern Brauel 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * 5/2/94 Roman Hodek: 78c2ecf20Sopenharmony_ci * Added setting of time_adj to get a better clock. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * 5/14/94 Roman Hodek: 108c2ecf20Sopenharmony_ci * gettod() for TT 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * 5/15/94 Roman Hodek: 138c2ecf20Sopenharmony_ci * hard_reset_now() for Atari (and others?) 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * 94/12/30 Andreas Schwab: 168c2ecf20Sopenharmony_ci * atari_sched_init fixed to get precise clock. 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 198c2ecf20Sopenharmony_ci * License. See the file COPYING in the main directory of this archive 208c2ecf20Sopenharmony_ci * for more details. 218c2ecf20Sopenharmony_ci */ 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/* 248c2ecf20Sopenharmony_ci * Miscellaneous atari stuff 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include <linux/types.h> 288c2ecf20Sopenharmony_ci#include <linux/mm.h> 298c2ecf20Sopenharmony_ci#include <linux/seq_file.h> 308c2ecf20Sopenharmony_ci#include <linux/console.h> 318c2ecf20Sopenharmony_ci#include <linux/init.h> 328c2ecf20Sopenharmony_ci#include <linux/delay.h> 338c2ecf20Sopenharmony_ci#include <linux/ioport.h> 348c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 358c2ecf20Sopenharmony_ci#include <linux/usb/isp116x.h> 368c2ecf20Sopenharmony_ci#include <linux/vt_kern.h> 378c2ecf20Sopenharmony_ci#include <linux/module.h> 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#include <asm/bootinfo.h> 408c2ecf20Sopenharmony_ci#include <asm/bootinfo-atari.h> 418c2ecf20Sopenharmony_ci#include <asm/byteorder.h> 428c2ecf20Sopenharmony_ci#include <asm/setup.h> 438c2ecf20Sopenharmony_ci#include <asm/atarihw.h> 448c2ecf20Sopenharmony_ci#include <asm/atariints.h> 458c2ecf20Sopenharmony_ci#include <asm/atari_stram.h> 468c2ecf20Sopenharmony_ci#include <asm/machdep.h> 478c2ecf20Sopenharmony_ci#include <asm/hwtest.h> 488c2ecf20Sopenharmony_ci#include <asm/io.h> 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciu_long atari_mch_cookie; 518c2ecf20Sopenharmony_ciEXPORT_SYMBOL(atari_mch_cookie); 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ciu_long atari_mch_type; 548c2ecf20Sopenharmony_ciEXPORT_SYMBOL(atari_mch_type); 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_cistruct atari_hw_present atari_hw_present; 578c2ecf20Sopenharmony_ciEXPORT_SYMBOL(atari_hw_present); 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciu_long atari_switches; 608c2ecf20Sopenharmony_ciEXPORT_SYMBOL(atari_switches); 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ciint atari_dont_touch_floppy_select; 638c2ecf20Sopenharmony_ciEXPORT_SYMBOL(atari_dont_touch_floppy_select); 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ciint atari_rtc_year_offset; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* local function prototypes */ 688c2ecf20Sopenharmony_cistatic void atari_reset(void); 698c2ecf20Sopenharmony_cistatic void atari_get_model(char *model); 708c2ecf20Sopenharmony_cistatic void atari_get_hardware_list(struct seq_file *m); 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* atari specific irq functions */ 738c2ecf20Sopenharmony_ciextern void atari_init_IRQ (void); 748c2ecf20Sopenharmony_ciextern void atari_mksound(unsigned int count, unsigned int ticks); 758c2ecf20Sopenharmony_ci#ifdef CONFIG_HEARTBEAT 768c2ecf20Sopenharmony_cistatic void atari_heartbeat(int on); 778c2ecf20Sopenharmony_ci#endif 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci/* atari specific timer functions (in time.c) */ 808c2ecf20Sopenharmony_ciextern void atari_sched_init(irq_handler_t); 818c2ecf20Sopenharmony_ciextern int atari_mste_hwclk (int, struct rtc_time *); 828c2ecf20Sopenharmony_ciextern int atari_tt_hwclk (int, struct rtc_time *); 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/* ++roman: This is a more elaborate test for an SCC chip, since the plain 858c2ecf20Sopenharmony_ci * Medusa board generates DTACK at the SCC's standard addresses, but a SCC 868c2ecf20Sopenharmony_ci * board in the Medusa is possible. Also, the addresses where the ST_ESCC 878c2ecf20Sopenharmony_ci * resides generate DTACK without the chip, too. 888c2ecf20Sopenharmony_ci * The method is to write values into the interrupt vector register, that 898c2ecf20Sopenharmony_ci * should be readable without trouble (from channel A!). 908c2ecf20Sopenharmony_ci */ 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_cistatic int __init scc_test(volatile char *ctla) 938c2ecf20Sopenharmony_ci{ 948c2ecf20Sopenharmony_ci if (!hwreg_present(ctla)) 958c2ecf20Sopenharmony_ci return 0; 968c2ecf20Sopenharmony_ci MFPDELAY(); 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci *ctla = 2; 998c2ecf20Sopenharmony_ci MFPDELAY(); 1008c2ecf20Sopenharmony_ci *ctla = 0x40; 1018c2ecf20Sopenharmony_ci MFPDELAY(); 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci *ctla = 2; 1048c2ecf20Sopenharmony_ci MFPDELAY(); 1058c2ecf20Sopenharmony_ci if (*ctla != 0x40) 1068c2ecf20Sopenharmony_ci return 0; 1078c2ecf20Sopenharmony_ci MFPDELAY(); 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci *ctla = 2; 1108c2ecf20Sopenharmony_ci MFPDELAY(); 1118c2ecf20Sopenharmony_ci *ctla = 0x60; 1128c2ecf20Sopenharmony_ci MFPDELAY(); 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci *ctla = 2; 1158c2ecf20Sopenharmony_ci MFPDELAY(); 1168c2ecf20Sopenharmony_ci if (*ctla != 0x60) 1178c2ecf20Sopenharmony_ci return 0; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci return 1; 1208c2ecf20Sopenharmony_ci} 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci /* 1248c2ecf20Sopenharmony_ci * Parse an Atari-specific record in the bootinfo 1258c2ecf20Sopenharmony_ci */ 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ciint __init atari_parse_bootinfo(const struct bi_record *record) 1288c2ecf20Sopenharmony_ci{ 1298c2ecf20Sopenharmony_ci int unknown = 0; 1308c2ecf20Sopenharmony_ci const void *data = record->data; 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci switch (be16_to_cpu(record->tag)) { 1338c2ecf20Sopenharmony_ci case BI_ATARI_MCH_COOKIE: 1348c2ecf20Sopenharmony_ci atari_mch_cookie = be32_to_cpup(data); 1358c2ecf20Sopenharmony_ci break; 1368c2ecf20Sopenharmony_ci case BI_ATARI_MCH_TYPE: 1378c2ecf20Sopenharmony_ci atari_mch_type = be32_to_cpup(data); 1388c2ecf20Sopenharmony_ci break; 1398c2ecf20Sopenharmony_ci default: 1408c2ecf20Sopenharmony_ci unknown = 1; 1418c2ecf20Sopenharmony_ci break; 1428c2ecf20Sopenharmony_ci } 1438c2ecf20Sopenharmony_ci return unknown; 1448c2ecf20Sopenharmony_ci} 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci/* Parse the Atari-specific switches= option. */ 1488c2ecf20Sopenharmony_cistatic int __init atari_switches_setup(char *str) 1498c2ecf20Sopenharmony_ci{ 1508c2ecf20Sopenharmony_ci char switches[COMMAND_LINE_SIZE]; 1518c2ecf20Sopenharmony_ci char *p; 1528c2ecf20Sopenharmony_ci int ovsc_shift; 1538c2ecf20Sopenharmony_ci char *args = switches; 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci if (!MACH_IS_ATARI) 1568c2ecf20Sopenharmony_ci return 0; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci /* copy string to local array, strsep works destructively... */ 1598c2ecf20Sopenharmony_ci strcpy(switches, str); 1608c2ecf20Sopenharmony_ci atari_switches = 0; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci /* parse the options */ 1638c2ecf20Sopenharmony_ci while ((p = strsep(&args, ",")) != NULL) { 1648c2ecf20Sopenharmony_ci if (!*p) 1658c2ecf20Sopenharmony_ci continue; 1668c2ecf20Sopenharmony_ci ovsc_shift = 0; 1678c2ecf20Sopenharmony_ci if (strncmp(p, "ov_", 3) == 0) { 1688c2ecf20Sopenharmony_ci p += 3; 1698c2ecf20Sopenharmony_ci ovsc_shift = ATARI_SWITCH_OVSC_SHIFT; 1708c2ecf20Sopenharmony_ci } 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci if (strcmp(p, "ikbd") == 0) { 1738c2ecf20Sopenharmony_ci /* RTS line of IKBD ACIA */ 1748c2ecf20Sopenharmony_ci atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift; 1758c2ecf20Sopenharmony_ci } else if (strcmp(p, "midi") == 0) { 1768c2ecf20Sopenharmony_ci /* RTS line of MIDI ACIA */ 1778c2ecf20Sopenharmony_ci atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift; 1788c2ecf20Sopenharmony_ci } else if (strcmp(p, "snd6") == 0) { 1798c2ecf20Sopenharmony_ci atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift; 1808c2ecf20Sopenharmony_ci } else if (strcmp(p, "snd7") == 0) { 1818c2ecf20Sopenharmony_ci atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift; 1828c2ecf20Sopenharmony_ci } 1838c2ecf20Sopenharmony_ci } 1848c2ecf20Sopenharmony_ci return 0; 1858c2ecf20Sopenharmony_ci} 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ciearly_param("switches", atari_switches_setup); 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci /* 1918c2ecf20Sopenharmony_ci * Setup the Atari configuration info 1928c2ecf20Sopenharmony_ci */ 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_civoid __init config_atari(void) 1958c2ecf20Sopenharmony_ci{ 1968c2ecf20Sopenharmony_ci unsigned short tos_version; 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci memset(&atari_hw_present, 0, sizeof(atari_hw_present)); 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci /* Change size of I/O space from 64KB to 4GB. */ 2018c2ecf20Sopenharmony_ci ioport_resource.end = 0xFFFFFFFF; 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci mach_sched_init = atari_sched_init; 2048c2ecf20Sopenharmony_ci mach_init_IRQ = atari_init_IRQ; 2058c2ecf20Sopenharmony_ci mach_get_model = atari_get_model; 2068c2ecf20Sopenharmony_ci mach_get_hardware_list = atari_get_hardware_list; 2078c2ecf20Sopenharmony_ci mach_reset = atari_reset; 2088c2ecf20Sopenharmony_ci mach_max_dma_address = 0xffffff; 2098c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_INPUT_M68K_BEEP) 2108c2ecf20Sopenharmony_ci mach_beep = atari_mksound; 2118c2ecf20Sopenharmony_ci#endif 2128c2ecf20Sopenharmony_ci#ifdef CONFIG_HEARTBEAT 2138c2ecf20Sopenharmony_ci mach_heartbeat = atari_heartbeat; 2148c2ecf20Sopenharmony_ci#endif 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci /* Set switches as requested by the user */ 2178c2ecf20Sopenharmony_ci if (atari_switches & ATARI_SWITCH_IKBD) 2188c2ecf20Sopenharmony_ci acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID; 2198c2ecf20Sopenharmony_ci if (atari_switches & ATARI_SWITCH_MIDI) 2208c2ecf20Sopenharmony_ci acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID; 2218c2ecf20Sopenharmony_ci if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) { 2228c2ecf20Sopenharmony_ci sound_ym.rd_data_reg_sel = 14; 2238c2ecf20Sopenharmony_ci sound_ym.wd_data = sound_ym.rd_data_reg_sel | 2248c2ecf20Sopenharmony_ci ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) | 2258c2ecf20Sopenharmony_ci ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0); 2268c2ecf20Sopenharmony_ci } 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci /* ++bjoern: 2298c2ecf20Sopenharmony_ci * Determine hardware present 2308c2ecf20Sopenharmony_ci */ 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci pr_info("Atari hardware found:"); 2338c2ecf20Sopenharmony_ci if (MACH_IS_MEDUSA) { 2348c2ecf20Sopenharmony_ci /* There's no Atari video hardware on the Medusa, but all the 2358c2ecf20Sopenharmony_ci * addresses below generate a DTACK so no bus error occurs! */ 2368c2ecf20Sopenharmony_ci } else if (hwreg_present(f030_xreg)) { 2378c2ecf20Sopenharmony_ci ATARIHW_SET(VIDEL_SHIFTER); 2388c2ecf20Sopenharmony_ci pr_cont(" VIDEL"); 2398c2ecf20Sopenharmony_ci /* This is a temporary hack: If there is Falcon video 2408c2ecf20Sopenharmony_ci * hardware, we assume that the ST-DMA serves SCSI instead of 2418c2ecf20Sopenharmony_ci * ACSI. In the future, there should be a better method for 2428c2ecf20Sopenharmony_ci * this... 2438c2ecf20Sopenharmony_ci */ 2448c2ecf20Sopenharmony_ci ATARIHW_SET(ST_SCSI); 2458c2ecf20Sopenharmony_ci pr_cont(" STDMA-SCSI"); 2468c2ecf20Sopenharmony_ci } else if (hwreg_present(tt_palette)) { 2478c2ecf20Sopenharmony_ci ATARIHW_SET(TT_SHIFTER); 2488c2ecf20Sopenharmony_ci pr_cont(" TT_SHIFTER"); 2498c2ecf20Sopenharmony_ci } else if (hwreg_present(&shifter_st.bas_hi)) { 2508c2ecf20Sopenharmony_ci if (hwreg_present(&shifter_st.bas_lo) && 2518c2ecf20Sopenharmony_ci (shifter_st.bas_lo = 0x0aau, shifter_st.bas_lo == 0x0aau)) { 2528c2ecf20Sopenharmony_ci ATARIHW_SET(EXTD_SHIFTER); 2538c2ecf20Sopenharmony_ci pr_cont(" EXTD_SHIFTER"); 2548c2ecf20Sopenharmony_ci } else { 2558c2ecf20Sopenharmony_ci ATARIHW_SET(STND_SHIFTER); 2568c2ecf20Sopenharmony_ci pr_cont(" STND_SHIFTER"); 2578c2ecf20Sopenharmony_ci } 2588c2ecf20Sopenharmony_ci } 2598c2ecf20Sopenharmony_ci if (hwreg_present(&st_mfp.par_dt_reg)) { 2608c2ecf20Sopenharmony_ci ATARIHW_SET(ST_MFP); 2618c2ecf20Sopenharmony_ci pr_cont(" ST_MFP"); 2628c2ecf20Sopenharmony_ci } 2638c2ecf20Sopenharmony_ci if (hwreg_present(&tt_mfp.par_dt_reg)) { 2648c2ecf20Sopenharmony_ci ATARIHW_SET(TT_MFP); 2658c2ecf20Sopenharmony_ci pr_cont(" TT_MFP"); 2668c2ecf20Sopenharmony_ci } 2678c2ecf20Sopenharmony_ci if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) { 2688c2ecf20Sopenharmony_ci ATARIHW_SET(SCSI_DMA); 2698c2ecf20Sopenharmony_ci pr_cont(" TT_SCSI_DMA"); 2708c2ecf20Sopenharmony_ci } 2718c2ecf20Sopenharmony_ci /* 2728c2ecf20Sopenharmony_ci * The ST-DMA address registers aren't readable 2738c2ecf20Sopenharmony_ci * on all Medusas, so the test below may fail 2748c2ecf20Sopenharmony_ci */ 2758c2ecf20Sopenharmony_ci if (MACH_IS_MEDUSA || 2768c2ecf20Sopenharmony_ci (hwreg_present(&st_dma.dma_vhi) && 2778c2ecf20Sopenharmony_ci (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) && 2788c2ecf20Sopenharmony_ci st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa && 2798c2ecf20Sopenharmony_ci (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) && 2808c2ecf20Sopenharmony_ci st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) { 2818c2ecf20Sopenharmony_ci ATARIHW_SET(EXTD_DMA); 2828c2ecf20Sopenharmony_ci pr_cont(" EXTD_DMA"); 2838c2ecf20Sopenharmony_ci } 2848c2ecf20Sopenharmony_ci if (hwreg_present(&tt_scsi.scsi_data)) { 2858c2ecf20Sopenharmony_ci ATARIHW_SET(TT_SCSI); 2868c2ecf20Sopenharmony_ci pr_cont(" TT_SCSI"); 2878c2ecf20Sopenharmony_ci } 2888c2ecf20Sopenharmony_ci if (hwreg_present(&sound_ym.rd_data_reg_sel)) { 2898c2ecf20Sopenharmony_ci ATARIHW_SET(YM_2149); 2908c2ecf20Sopenharmony_ci pr_cont(" YM2149"); 2918c2ecf20Sopenharmony_ci } 2928c2ecf20Sopenharmony_ci if (!MACH_IS_MEDUSA && hwreg_present(&tt_dmasnd.ctrl)) { 2938c2ecf20Sopenharmony_ci ATARIHW_SET(PCM_8BIT); 2948c2ecf20Sopenharmony_ci pr_cont(" PCM"); 2958c2ecf20Sopenharmony_ci } 2968c2ecf20Sopenharmony_ci if (hwreg_present(&falcon_codec.unused5)) { 2978c2ecf20Sopenharmony_ci ATARIHW_SET(CODEC); 2988c2ecf20Sopenharmony_ci pr_cont(" CODEC"); 2998c2ecf20Sopenharmony_ci } 3008c2ecf20Sopenharmony_ci if (hwreg_present(&dsp56k_host_interface.icr)) { 3018c2ecf20Sopenharmony_ci ATARIHW_SET(DSP56K); 3028c2ecf20Sopenharmony_ci pr_cont(" DSP56K"); 3038c2ecf20Sopenharmony_ci } 3048c2ecf20Sopenharmony_ci if (hwreg_present(&tt_scc_dma.dma_ctrl) && 3058c2ecf20Sopenharmony_ci#if 0 3068c2ecf20Sopenharmony_ci /* This test sucks! Who knows some better? */ 3078c2ecf20Sopenharmony_ci (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) && 3088c2ecf20Sopenharmony_ci (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0) 3098c2ecf20Sopenharmony_ci#else 3108c2ecf20Sopenharmony_ci !MACH_IS_MEDUSA 3118c2ecf20Sopenharmony_ci#endif 3128c2ecf20Sopenharmony_ci ) { 3138c2ecf20Sopenharmony_ci ATARIHW_SET(SCC_DMA); 3148c2ecf20Sopenharmony_ci pr_cont(" SCC_DMA"); 3158c2ecf20Sopenharmony_ci } 3168c2ecf20Sopenharmony_ci if (scc_test(&atari_scc.cha_a_ctrl)) { 3178c2ecf20Sopenharmony_ci ATARIHW_SET(SCC); 3188c2ecf20Sopenharmony_ci pr_cont(" SCC"); 3198c2ecf20Sopenharmony_ci } 3208c2ecf20Sopenharmony_ci if (scc_test(&st_escc.cha_b_ctrl)) { 3218c2ecf20Sopenharmony_ci ATARIHW_SET(ST_ESCC); 3228c2ecf20Sopenharmony_ci pr_cont(" ST_ESCC"); 3238c2ecf20Sopenharmony_ci } 3248c2ecf20Sopenharmony_ci if (hwreg_present(&tt_scu.sys_mask)) { 3258c2ecf20Sopenharmony_ci ATARIHW_SET(SCU); 3268c2ecf20Sopenharmony_ci /* Assume a VME bus if there's a SCU */ 3278c2ecf20Sopenharmony_ci ATARIHW_SET(VME); 3288c2ecf20Sopenharmony_ci pr_cont(" VME SCU"); 3298c2ecf20Sopenharmony_ci } 3308c2ecf20Sopenharmony_ci if (hwreg_present((void *)(0xffff9210))) { 3318c2ecf20Sopenharmony_ci ATARIHW_SET(ANALOG_JOY); 3328c2ecf20Sopenharmony_ci pr_cont(" ANALOG_JOY"); 3338c2ecf20Sopenharmony_ci } 3348c2ecf20Sopenharmony_ci if (hwreg_present(blitter.halftone)) { 3358c2ecf20Sopenharmony_ci ATARIHW_SET(BLITTER); 3368c2ecf20Sopenharmony_ci pr_cont(" BLITTER"); 3378c2ecf20Sopenharmony_ci } 3388c2ecf20Sopenharmony_ci if (hwreg_present((void *)0xfff00039)) { 3398c2ecf20Sopenharmony_ci ATARIHW_SET(IDE); 3408c2ecf20Sopenharmony_ci pr_cont(" IDE"); 3418c2ecf20Sopenharmony_ci } 3428c2ecf20Sopenharmony_ci#if 1 /* This maybe wrong */ 3438c2ecf20Sopenharmony_ci if (!MACH_IS_MEDUSA && hwreg_present(&tt_microwire.data) && 3448c2ecf20Sopenharmony_ci hwreg_present(&tt_microwire.mask) && 3458c2ecf20Sopenharmony_ci (tt_microwire.mask = 0x7ff, 3468c2ecf20Sopenharmony_ci udelay(1), 3478c2ecf20Sopenharmony_ci tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR, 3488c2ecf20Sopenharmony_ci udelay(1), 3498c2ecf20Sopenharmony_ci tt_microwire.data != 0)) { 3508c2ecf20Sopenharmony_ci ATARIHW_SET(MICROWIRE); 3518c2ecf20Sopenharmony_ci while (tt_microwire.mask != 0x7ff) 3528c2ecf20Sopenharmony_ci ; 3538c2ecf20Sopenharmony_ci pr_cont(" MICROWIRE"); 3548c2ecf20Sopenharmony_ci } 3558c2ecf20Sopenharmony_ci#endif 3568c2ecf20Sopenharmony_ci if (hwreg_present(&tt_rtc.regsel)) { 3578c2ecf20Sopenharmony_ci ATARIHW_SET(TT_CLK); 3588c2ecf20Sopenharmony_ci pr_cont(" TT_CLK"); 3598c2ecf20Sopenharmony_ci mach_hwclk = atari_tt_hwclk; 3608c2ecf20Sopenharmony_ci } 3618c2ecf20Sopenharmony_ci if (hwreg_present(&mste_rtc.sec_ones)) { 3628c2ecf20Sopenharmony_ci ATARIHW_SET(MSTE_CLK); 3638c2ecf20Sopenharmony_ci pr_cont(" MSTE_CLK"); 3648c2ecf20Sopenharmony_ci mach_hwclk = atari_mste_hwclk; 3658c2ecf20Sopenharmony_ci } 3668c2ecf20Sopenharmony_ci if (!MACH_IS_MEDUSA && hwreg_present(&dma_wd.fdc_speed) && 3678c2ecf20Sopenharmony_ci hwreg_write(&dma_wd.fdc_speed, 0)) { 3688c2ecf20Sopenharmony_ci ATARIHW_SET(FDCSPEED); 3698c2ecf20Sopenharmony_ci pr_cont(" FDC_SPEED"); 3708c2ecf20Sopenharmony_ci } 3718c2ecf20Sopenharmony_ci if (!ATARIHW_PRESENT(ST_SCSI)) { 3728c2ecf20Sopenharmony_ci ATARIHW_SET(ACSI); 3738c2ecf20Sopenharmony_ci pr_cont(" ACSI"); 3748c2ecf20Sopenharmony_ci } 3758c2ecf20Sopenharmony_ci pr_cont("\n"); 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci if (CPU_IS_040_OR_060) 3788c2ecf20Sopenharmony_ci /* Now it seems to be safe to turn of the tt0 transparent 3798c2ecf20Sopenharmony_ci * translation (the one that must not be turned off in 3808c2ecf20Sopenharmony_ci * head.S...) 3818c2ecf20Sopenharmony_ci */ 3828c2ecf20Sopenharmony_ci asm volatile ("\n" 3838c2ecf20Sopenharmony_ci " moveq #0,%%d0\n" 3848c2ecf20Sopenharmony_ci " .chip 68040\n" 3858c2ecf20Sopenharmony_ci " movec %%d0,%%itt0\n" 3868c2ecf20Sopenharmony_ci " movec %%d0,%%dtt0\n" 3878c2ecf20Sopenharmony_ci " .chip 68k" 3888c2ecf20Sopenharmony_ci : /* no outputs */ 3898c2ecf20Sopenharmony_ci : /* no inputs */ 3908c2ecf20Sopenharmony_ci : "d0"); 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ci /* allocator for memory that must reside in st-ram */ 3938c2ecf20Sopenharmony_ci atari_stram_init(); 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_ci /* Set up a mapping for the VMEbus address region: 3968c2ecf20Sopenharmony_ci * 3978c2ecf20Sopenharmony_ci * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff 3988c2ecf20Sopenharmony_ci * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at 3998c2ecf20Sopenharmony_ci * 0xfe000000 virt., because this can be done with a single 4008c2ecf20Sopenharmony_ci * transparent translation. On the 68040, lots of often unused 4018c2ecf20Sopenharmony_ci * page tables would be needed otherwise. On a MegaSTE or similar, 4028c2ecf20Sopenharmony_ci * the highest byte is stripped off by hardware due to the 24 bit 4038c2ecf20Sopenharmony_ci * design of the bus. 4048c2ecf20Sopenharmony_ci */ 4058c2ecf20Sopenharmony_ci 4068c2ecf20Sopenharmony_ci if (CPU_IS_020_OR_030) { 4078c2ecf20Sopenharmony_ci unsigned long tt1_val; 4088c2ecf20Sopenharmony_ci tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache 4098c2ecf20Sopenharmony_ci * inhibit, read and write, FDC mask = 3, 4108c2ecf20Sopenharmony_ci * FDC val = 4 -> Supervisor only */ 4118c2ecf20Sopenharmony_ci asm volatile ("\n" 4128c2ecf20Sopenharmony_ci " .chip 68030\n" 4138c2ecf20Sopenharmony_ci " pmove %0,%/tt1\n" 4148c2ecf20Sopenharmony_ci " .chip 68k" 4158c2ecf20Sopenharmony_ci : : "m" (tt1_val)); 4168c2ecf20Sopenharmony_ci } else { 4178c2ecf20Sopenharmony_ci asm volatile ("\n" 4188c2ecf20Sopenharmony_ci " .chip 68040\n" 4198c2ecf20Sopenharmony_ci " movec %0,%%itt1\n" 4208c2ecf20Sopenharmony_ci " movec %0,%%dtt1\n" 4218c2ecf20Sopenharmony_ci " .chip 68k" 4228c2ecf20Sopenharmony_ci : 4238c2ecf20Sopenharmony_ci : "d" (0xfe00a040)); /* Translate 0xfexxxxxx, enable, 4248c2ecf20Sopenharmony_ci * supervisor only, non-cacheable/ 4258c2ecf20Sopenharmony_ci * serialized, writable */ 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_ci } 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_ci /* Fetch tos version at Physical 2 */ 4308c2ecf20Sopenharmony_ci /* 4318c2ecf20Sopenharmony_ci * We my not be able to access this address if the kernel is 4328c2ecf20Sopenharmony_ci * loaded to st ram, since the first page is unmapped. On the 4338c2ecf20Sopenharmony_ci * Medusa this is always the case and there is nothing we can do 4348c2ecf20Sopenharmony_ci * about this, so we just assume the smaller offset. For the TT 4358c2ecf20Sopenharmony_ci * we use the fact that in head.S we have set up a mapping 4368c2ecf20Sopenharmony_ci * 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible 4378c2ecf20Sopenharmony_ci * in the last 16MB of the address space. 4388c2ecf20Sopenharmony_ci */ 4398c2ecf20Sopenharmony_ci tos_version = (MACH_IS_MEDUSA) ? 4408c2ecf20Sopenharmony_ci 0xfff : *(unsigned short *)0xff000002; 4418c2ecf20Sopenharmony_ci atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68; 4428c2ecf20Sopenharmony_ci} 4438c2ecf20Sopenharmony_ci 4448c2ecf20Sopenharmony_ci#ifdef CONFIG_HEARTBEAT 4458c2ecf20Sopenharmony_cistatic void atari_heartbeat(int on) 4468c2ecf20Sopenharmony_ci{ 4478c2ecf20Sopenharmony_ci unsigned char tmp; 4488c2ecf20Sopenharmony_ci unsigned long flags; 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_ci if (atari_dont_touch_floppy_select) 4518c2ecf20Sopenharmony_ci return; 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_ci local_irq_save(flags); 4548c2ecf20Sopenharmony_ci sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */ 4558c2ecf20Sopenharmony_ci tmp = sound_ym.rd_data_reg_sel; 4568c2ecf20Sopenharmony_ci sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02); 4578c2ecf20Sopenharmony_ci local_irq_restore(flags); 4588c2ecf20Sopenharmony_ci} 4598c2ecf20Sopenharmony_ci#endif 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci/* ++roman: 4628c2ecf20Sopenharmony_ci * 4638c2ecf20Sopenharmony_ci * This function does a reset on machines that lack the ability to 4648c2ecf20Sopenharmony_ci * assert the processor's _RESET signal somehow via hardware. It is 4658c2ecf20Sopenharmony_ci * based on the fact that you can find the initial SP and PC values 4668c2ecf20Sopenharmony_ci * after a reset at physical addresses 0 and 4. This works pretty well 4678c2ecf20Sopenharmony_ci * for Atari machines, since the lowest 8 bytes of physical memory are 4688c2ecf20Sopenharmony_ci * really ROM (mapped by hardware). For other 680x0 machines: don't 4698c2ecf20Sopenharmony_ci * know if it works... 4708c2ecf20Sopenharmony_ci * 4718c2ecf20Sopenharmony_ci * To get the values at addresses 0 and 4, the MMU better is turned 4728c2ecf20Sopenharmony_ci * off first. After that, we have to jump into physical address space 4738c2ecf20Sopenharmony_ci * (the PC before the pmove statement points to the virtual address of 4748c2ecf20Sopenharmony_ci * the code). Getting that physical address is not hard, but the code 4758c2ecf20Sopenharmony_ci * becomes a bit complex since I've tried to ensure that the jump 4768c2ecf20Sopenharmony_ci * statement after the pmove is in the cache already (otherwise the 4778c2ecf20Sopenharmony_ci * processor can't fetch it!). For that, the code first jumps to the 4788c2ecf20Sopenharmony_ci * jump statement with the (virtual) address of the pmove section in 4798c2ecf20Sopenharmony_ci * an address register . The jump statement is surely in the cache 4808c2ecf20Sopenharmony_ci * now. After that, that physical address of the reset code is loaded 4818c2ecf20Sopenharmony_ci * into the same address register, pmove is done and the same jump 4828c2ecf20Sopenharmony_ci * statements goes to the reset code. Since there are not many 4838c2ecf20Sopenharmony_ci * statements between the two jumps, I hope it stays in the cache. 4848c2ecf20Sopenharmony_ci * 4858c2ecf20Sopenharmony_ci * The C code makes heavy use of the GCC features that you can get the 4868c2ecf20Sopenharmony_ci * address of a C label. No hope to compile this with another compiler 4878c2ecf20Sopenharmony_ci * than GCC! 4888c2ecf20Sopenharmony_ci */ 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_ci/* ++andreas: no need for complicated code, just depend on prefetch */ 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_cistatic void atari_reset(void) 4938c2ecf20Sopenharmony_ci{ 4948c2ecf20Sopenharmony_ci long tc_val = 0; 4958c2ecf20Sopenharmony_ci long reset_addr; 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_ci /* 4988c2ecf20Sopenharmony_ci * On the Medusa, phys. 0x4 may contain garbage because it's no 4998c2ecf20Sopenharmony_ci * ROM. See above for explanation why we cannot use PTOV(4). 5008c2ecf20Sopenharmony_ci */ 5018c2ecf20Sopenharmony_ci reset_addr = MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 : 5028c2ecf20Sopenharmony_ci *(unsigned long *) 0xff000004; 5038c2ecf20Sopenharmony_ci 5048c2ecf20Sopenharmony_ci /* reset ACIA for switch off OverScan, if it's active */ 5058c2ecf20Sopenharmony_ci if (atari_switches & ATARI_SWITCH_OVSC_IKBD) 5068c2ecf20Sopenharmony_ci acia.key_ctrl = ACIA_RESET; 5078c2ecf20Sopenharmony_ci if (atari_switches & ATARI_SWITCH_OVSC_MIDI) 5088c2ecf20Sopenharmony_ci acia.mid_ctrl = ACIA_RESET; 5098c2ecf20Sopenharmony_ci 5108c2ecf20Sopenharmony_ci /* processor independent: turn off interrupts and reset the VBR; 5118c2ecf20Sopenharmony_ci * the caches must be left enabled, else prefetching the final jump 5128c2ecf20Sopenharmony_ci * instruction doesn't work. 5138c2ecf20Sopenharmony_ci */ 5148c2ecf20Sopenharmony_ci local_irq_disable(); 5158c2ecf20Sopenharmony_ci asm volatile ("movec %0,%%vbr" 5168c2ecf20Sopenharmony_ci : : "d" (0)); 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci if (CPU_IS_040_OR_060) { 5198c2ecf20Sopenharmony_ci unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); 5208c2ecf20Sopenharmony_ci if (CPU_IS_060) { 5218c2ecf20Sopenharmony_ci /* 68060: clear PCR to turn off superscalar operation */ 5228c2ecf20Sopenharmony_ci asm volatile ("\n" 5238c2ecf20Sopenharmony_ci " .chip 68060\n" 5248c2ecf20Sopenharmony_ci " movec %0,%%pcr\n" 5258c2ecf20Sopenharmony_ci " .chip 68k" 5268c2ecf20Sopenharmony_ci : : "d" (0)); 5278c2ecf20Sopenharmony_ci } 5288c2ecf20Sopenharmony_ci 5298c2ecf20Sopenharmony_ci asm volatile ("\n" 5308c2ecf20Sopenharmony_ci " move.l %0,%%d0\n" 5318c2ecf20Sopenharmony_ci " and.l #0xff000000,%%d0\n" 5328c2ecf20Sopenharmony_ci " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */ 5338c2ecf20Sopenharmony_ci " .chip 68040\n" 5348c2ecf20Sopenharmony_ci " movec %%d0,%%itt0\n" 5358c2ecf20Sopenharmony_ci " movec %%d0,%%dtt0\n" 5368c2ecf20Sopenharmony_ci " .chip 68k\n" 5378c2ecf20Sopenharmony_ci " jmp %0@" 5388c2ecf20Sopenharmony_ci : : "a" (jmp_addr040) 5398c2ecf20Sopenharmony_ci : "d0"); 5408c2ecf20Sopenharmony_ci jmp_addr_label040: 5418c2ecf20Sopenharmony_ci asm volatile ("\n" 5428c2ecf20Sopenharmony_ci " moveq #0,%%d0\n" 5438c2ecf20Sopenharmony_ci " nop\n" 5448c2ecf20Sopenharmony_ci " .chip 68040\n" 5458c2ecf20Sopenharmony_ci " cinva %%bc\n" 5468c2ecf20Sopenharmony_ci " nop\n" 5478c2ecf20Sopenharmony_ci " pflusha\n" 5488c2ecf20Sopenharmony_ci " nop\n" 5498c2ecf20Sopenharmony_ci " movec %%d0,%%tc\n" 5508c2ecf20Sopenharmony_ci " nop\n" 5518c2ecf20Sopenharmony_ci /* the following setup of transparent translations is needed on the 5528c2ecf20Sopenharmony_ci * Afterburner040 to successfully reboot. Other machines shouldn't 5538c2ecf20Sopenharmony_ci * care about a different tt regs setup, they also didn't care in 5548c2ecf20Sopenharmony_ci * the past that the regs weren't turned off. */ 5558c2ecf20Sopenharmony_ci " move.l #0xffc000,%%d0\n" /* whole insn space cacheable */ 5568c2ecf20Sopenharmony_ci " movec %%d0,%%itt0\n" 5578c2ecf20Sopenharmony_ci " movec %%d0,%%itt1\n" 5588c2ecf20Sopenharmony_ci " or.w #0x40,%/d0\n" /* whole data space non-cacheable/ser. */ 5598c2ecf20Sopenharmony_ci " movec %%d0,%%dtt0\n" 5608c2ecf20Sopenharmony_ci " movec %%d0,%%dtt1\n" 5618c2ecf20Sopenharmony_ci " .chip 68k\n" 5628c2ecf20Sopenharmony_ci " jmp %0@" 5638c2ecf20Sopenharmony_ci : /* no outputs */ 5648c2ecf20Sopenharmony_ci : "a" (reset_addr) 5658c2ecf20Sopenharmony_ci : "d0"); 5668c2ecf20Sopenharmony_ci } else 5678c2ecf20Sopenharmony_ci asm volatile ("\n" 5688c2ecf20Sopenharmony_ci " pmove %0,%%tc\n" 5698c2ecf20Sopenharmony_ci " jmp %1@" 5708c2ecf20Sopenharmony_ci : /* no outputs */ 5718c2ecf20Sopenharmony_ci : "m" (tc_val), "a" (reset_addr)); 5728c2ecf20Sopenharmony_ci} 5738c2ecf20Sopenharmony_ci 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_cistatic void atari_get_model(char *model) 5768c2ecf20Sopenharmony_ci{ 5778c2ecf20Sopenharmony_ci strcpy(model, "Atari "); 5788c2ecf20Sopenharmony_ci switch (atari_mch_cookie >> 16) { 5798c2ecf20Sopenharmony_ci case ATARI_MCH_ST: 5808c2ecf20Sopenharmony_ci if (ATARIHW_PRESENT(MSTE_CLK)) 5818c2ecf20Sopenharmony_ci strcat(model, "Mega ST"); 5828c2ecf20Sopenharmony_ci else 5838c2ecf20Sopenharmony_ci strcat(model, "ST"); 5848c2ecf20Sopenharmony_ci break; 5858c2ecf20Sopenharmony_ci case ATARI_MCH_STE: 5868c2ecf20Sopenharmony_ci if (MACH_IS_MSTE) 5878c2ecf20Sopenharmony_ci strcat(model, "Mega STE"); 5888c2ecf20Sopenharmony_ci else 5898c2ecf20Sopenharmony_ci strcat(model, "STE"); 5908c2ecf20Sopenharmony_ci break; 5918c2ecf20Sopenharmony_ci case ATARI_MCH_TT: 5928c2ecf20Sopenharmony_ci if (MACH_IS_MEDUSA) 5938c2ecf20Sopenharmony_ci /* Medusa has TT _MCH cookie */ 5948c2ecf20Sopenharmony_ci strcat(model, "Medusa"); 5958c2ecf20Sopenharmony_ci else 5968c2ecf20Sopenharmony_ci strcat(model, "TT"); 5978c2ecf20Sopenharmony_ci break; 5988c2ecf20Sopenharmony_ci case ATARI_MCH_FALCON: 5998c2ecf20Sopenharmony_ci strcat(model, "Falcon"); 6008c2ecf20Sopenharmony_ci if (MACH_IS_AB40) 6018c2ecf20Sopenharmony_ci strcat(model, " (with Afterburner040)"); 6028c2ecf20Sopenharmony_ci break; 6038c2ecf20Sopenharmony_ci default: 6048c2ecf20Sopenharmony_ci sprintf(model + strlen(model), "(unknown mach cookie 0x%lx)", 6058c2ecf20Sopenharmony_ci atari_mch_cookie); 6068c2ecf20Sopenharmony_ci break; 6078c2ecf20Sopenharmony_ci } 6088c2ecf20Sopenharmony_ci} 6098c2ecf20Sopenharmony_ci 6108c2ecf20Sopenharmony_ci 6118c2ecf20Sopenharmony_cistatic void atari_get_hardware_list(struct seq_file *m) 6128c2ecf20Sopenharmony_ci{ 6138c2ecf20Sopenharmony_ci int i; 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_ci for (i = 0; i < m68k_num_memory; i++) 6168c2ecf20Sopenharmony_ci seq_printf(m, "\t%3ld MB at 0x%08lx (%s)\n", 6178c2ecf20Sopenharmony_ci m68k_memory[i].size >> 20, m68k_memory[i].addr, 6188c2ecf20Sopenharmony_ci (m68k_memory[i].addr & 0xff000000 ? 6198c2ecf20Sopenharmony_ci "alternate RAM" : "ST-RAM")); 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_ci#define ATARIHW_ANNOUNCE(name, str) \ 6228c2ecf20Sopenharmony_ci if (ATARIHW_PRESENT(name)) \ 6238c2ecf20Sopenharmony_ci seq_printf(m, "\t%s\n", str) 6248c2ecf20Sopenharmony_ci 6258c2ecf20Sopenharmony_ci seq_puts(m, "Detected hardware:\n"); 6268c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter"); 6278c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter"); 6288c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter"); 6298c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter"); 6308c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator"); 6318c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound"); 6328c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(CODEC, "CODEC Sound"); 6338c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)"); 6348c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)"); 6358c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(ACSI, "ACSI Interface"); 6368c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(IDE, "IDE Interface"); 6378c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC"); 6388c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901"); 6398c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901"); 6408c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530"); 6418c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230"); 6428c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface"); 6438c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface"); 6448c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)"); 6458c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)"); 6468c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380"); 6478c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC"); 6488c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A"); 6498c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15"); 6508c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(SCU, "System Control Unit"); 6518c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(BLITTER, "Blitter"); 6528c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(VME, "VME Bus"); 6538c2ecf20Sopenharmony_ci ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); 6548c2ecf20Sopenharmony_ci} 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_ci/* 6578c2ecf20Sopenharmony_ci * MSch: initial platform device support for Atari, 6588c2ecf20Sopenharmony_ci * required for EtherNAT/EtherNEC/NetUSBee drivers 6598c2ecf20Sopenharmony_ci */ 6608c2ecf20Sopenharmony_ci 6618c2ecf20Sopenharmony_ci#if defined(CONFIG_ATARI_ETHERNAT) || defined(CONFIG_ATARI_ETHERNEC) 6628c2ecf20Sopenharmony_cistatic void isp1160_delay(struct device *dev, int delay) 6638c2ecf20Sopenharmony_ci{ 6648c2ecf20Sopenharmony_ci ndelay(delay); 6658c2ecf20Sopenharmony_ci} 6668c2ecf20Sopenharmony_ci#endif 6678c2ecf20Sopenharmony_ci 6688c2ecf20Sopenharmony_ci#ifdef CONFIG_ATARI_ETHERNAT 6698c2ecf20Sopenharmony_ci/* 6708c2ecf20Sopenharmony_ci * EtherNAT: SMC91C111 Ethernet chipset, handled by smc91x driver 6718c2ecf20Sopenharmony_ci */ 6728c2ecf20Sopenharmony_ci 6738c2ecf20Sopenharmony_ci#define ATARI_ETHERNAT_IRQ 140 6748c2ecf20Sopenharmony_ci 6758c2ecf20Sopenharmony_cistatic struct resource smc91x_resources[] = { 6768c2ecf20Sopenharmony_ci [0] = { 6778c2ecf20Sopenharmony_ci .name = "smc91x-regs", 6788c2ecf20Sopenharmony_ci .start = ATARI_ETHERNAT_PHYS_ADDR, 6798c2ecf20Sopenharmony_ci .end = ATARI_ETHERNAT_PHYS_ADDR + 0xfffff, 6808c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 6818c2ecf20Sopenharmony_ci }, 6828c2ecf20Sopenharmony_ci [1] = { 6838c2ecf20Sopenharmony_ci .name = "smc91x-irq", 6848c2ecf20Sopenharmony_ci .start = ATARI_ETHERNAT_IRQ, 6858c2ecf20Sopenharmony_ci .end = ATARI_ETHERNAT_IRQ, 6868c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 6878c2ecf20Sopenharmony_ci }, 6888c2ecf20Sopenharmony_ci}; 6898c2ecf20Sopenharmony_ci 6908c2ecf20Sopenharmony_cistatic struct platform_device smc91x_device = { 6918c2ecf20Sopenharmony_ci .name = "smc91x", 6928c2ecf20Sopenharmony_ci .id = -1, 6938c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(smc91x_resources), 6948c2ecf20Sopenharmony_ci .resource = smc91x_resources, 6958c2ecf20Sopenharmony_ci}; 6968c2ecf20Sopenharmony_ci 6978c2ecf20Sopenharmony_ci/* 6988c2ecf20Sopenharmony_ci * ISP 1160 - using the isp116x-hcd module 6998c2ecf20Sopenharmony_ci */ 7008c2ecf20Sopenharmony_ci 7018c2ecf20Sopenharmony_ci#define ATARI_USB_PHYS_ADDR 0x80000012 7028c2ecf20Sopenharmony_ci#define ATARI_USB_IRQ 139 7038c2ecf20Sopenharmony_ci 7048c2ecf20Sopenharmony_cistatic struct resource isp1160_resources[] = { 7058c2ecf20Sopenharmony_ci [0] = { 7068c2ecf20Sopenharmony_ci .name = "isp1160-data", 7078c2ecf20Sopenharmony_ci .start = ATARI_USB_PHYS_ADDR, 7088c2ecf20Sopenharmony_ci .end = ATARI_USB_PHYS_ADDR + 0x1, 7098c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 7108c2ecf20Sopenharmony_ci }, 7118c2ecf20Sopenharmony_ci [1] = { 7128c2ecf20Sopenharmony_ci .name = "isp1160-regs", 7138c2ecf20Sopenharmony_ci .start = ATARI_USB_PHYS_ADDR + 0x4, 7148c2ecf20Sopenharmony_ci .end = ATARI_USB_PHYS_ADDR + 0x5, 7158c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 7168c2ecf20Sopenharmony_ci }, 7178c2ecf20Sopenharmony_ci [2] = { 7188c2ecf20Sopenharmony_ci .name = "isp1160-irq", 7198c2ecf20Sopenharmony_ci .start = ATARI_USB_IRQ, 7208c2ecf20Sopenharmony_ci .end = ATARI_USB_IRQ, 7218c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7228c2ecf20Sopenharmony_ci }, 7238c2ecf20Sopenharmony_ci}; 7248c2ecf20Sopenharmony_ci 7258c2ecf20Sopenharmony_ci/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */ 7268c2ecf20Sopenharmony_cistatic struct isp116x_platform_data isp1160_platform_data = { 7278c2ecf20Sopenharmony_ci /* Enable internal resistors on downstream ports */ 7288c2ecf20Sopenharmony_ci .sel15Kres = 1, 7298c2ecf20Sopenharmony_ci /* On-chip overcurrent protection */ 7308c2ecf20Sopenharmony_ci .oc_enable = 1, 7318c2ecf20Sopenharmony_ci /* INT output polarity */ 7328c2ecf20Sopenharmony_ci .int_act_high = 1, 7338c2ecf20Sopenharmony_ci /* INT edge or level triggered */ 7348c2ecf20Sopenharmony_ci .int_edge_triggered = 0, 7358c2ecf20Sopenharmony_ci 7368c2ecf20Sopenharmony_ci /* WAKEUP pin connected - NOT SUPPORTED */ 7378c2ecf20Sopenharmony_ci /* .remote_wakeup_connected = 0, */ 7388c2ecf20Sopenharmony_ci /* Wakeup by devices on usb bus enabled */ 7398c2ecf20Sopenharmony_ci .remote_wakeup_enable = 0, 7408c2ecf20Sopenharmony_ci .delay = isp1160_delay, 7418c2ecf20Sopenharmony_ci}; 7428c2ecf20Sopenharmony_ci 7438c2ecf20Sopenharmony_cistatic struct platform_device isp1160_device = { 7448c2ecf20Sopenharmony_ci .name = "isp116x-hcd", 7458c2ecf20Sopenharmony_ci .id = 0, 7468c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(isp1160_resources), 7478c2ecf20Sopenharmony_ci .resource = isp1160_resources, 7488c2ecf20Sopenharmony_ci .dev = { 7498c2ecf20Sopenharmony_ci .platform_data = &isp1160_platform_data, 7508c2ecf20Sopenharmony_ci }, 7518c2ecf20Sopenharmony_ci}; 7528c2ecf20Sopenharmony_ci 7538c2ecf20Sopenharmony_cistatic struct platform_device *atari_ethernat_devices[] __initdata = { 7548c2ecf20Sopenharmony_ci &smc91x_device, 7558c2ecf20Sopenharmony_ci &isp1160_device 7568c2ecf20Sopenharmony_ci}; 7578c2ecf20Sopenharmony_ci#endif /* CONFIG_ATARI_ETHERNAT */ 7588c2ecf20Sopenharmony_ci 7598c2ecf20Sopenharmony_ci#ifdef CONFIG_ATARI_ETHERNEC 7608c2ecf20Sopenharmony_ci/* 7618c2ecf20Sopenharmony_ci * EtherNEC: RTL8019 (NE2000 compatible) Ethernet chipset, 7628c2ecf20Sopenharmony_ci * handled by ne.c driver 7638c2ecf20Sopenharmony_ci */ 7648c2ecf20Sopenharmony_ci 7658c2ecf20Sopenharmony_ci#define ATARI_ETHERNEC_PHYS_ADDR 0xfffa0000 7668c2ecf20Sopenharmony_ci#define ATARI_ETHERNEC_BASE 0x300 7678c2ecf20Sopenharmony_ci#define ATARI_ETHERNEC_IRQ IRQ_MFP_TIMER1 7688c2ecf20Sopenharmony_ci 7698c2ecf20Sopenharmony_cistatic struct resource rtl8019_resources[] = { 7708c2ecf20Sopenharmony_ci [0] = { 7718c2ecf20Sopenharmony_ci .name = "rtl8019-regs", 7728c2ecf20Sopenharmony_ci .start = ATARI_ETHERNEC_BASE, 7738c2ecf20Sopenharmony_ci .end = ATARI_ETHERNEC_BASE + 0x20 - 1, 7748c2ecf20Sopenharmony_ci .flags = IORESOURCE_IO, 7758c2ecf20Sopenharmony_ci }, 7768c2ecf20Sopenharmony_ci [1] = { 7778c2ecf20Sopenharmony_ci .name = "rtl8019-irq", 7788c2ecf20Sopenharmony_ci .start = ATARI_ETHERNEC_IRQ, 7798c2ecf20Sopenharmony_ci .end = ATARI_ETHERNEC_IRQ, 7808c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7818c2ecf20Sopenharmony_ci }, 7828c2ecf20Sopenharmony_ci}; 7838c2ecf20Sopenharmony_ci 7848c2ecf20Sopenharmony_cistatic struct platform_device rtl8019_device = { 7858c2ecf20Sopenharmony_ci .name = "ne", 7868c2ecf20Sopenharmony_ci .id = -1, 7878c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(rtl8019_resources), 7888c2ecf20Sopenharmony_ci .resource = rtl8019_resources, 7898c2ecf20Sopenharmony_ci}; 7908c2ecf20Sopenharmony_ci 7918c2ecf20Sopenharmony_ci/* 7928c2ecf20Sopenharmony_ci * NetUSBee: ISP1160 USB host adapter via ROM-port adapter 7938c2ecf20Sopenharmony_ci */ 7948c2ecf20Sopenharmony_ci 7958c2ecf20Sopenharmony_ci#define ATARI_NETUSBEE_PHYS_ADDR 0xfffa8000 7968c2ecf20Sopenharmony_ci#define ATARI_NETUSBEE_BASE 0x340 7978c2ecf20Sopenharmony_ci#define ATARI_NETUSBEE_IRQ IRQ_MFP_TIMER2 7988c2ecf20Sopenharmony_ci 7998c2ecf20Sopenharmony_cistatic struct resource netusbee_resources[] = { 8008c2ecf20Sopenharmony_ci [0] = { 8018c2ecf20Sopenharmony_ci .name = "isp1160-data", 8028c2ecf20Sopenharmony_ci .start = ATARI_NETUSBEE_BASE, 8038c2ecf20Sopenharmony_ci .end = ATARI_NETUSBEE_BASE + 0x1, 8048c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 8058c2ecf20Sopenharmony_ci }, 8068c2ecf20Sopenharmony_ci [1] = { 8078c2ecf20Sopenharmony_ci .name = "isp1160-regs", 8088c2ecf20Sopenharmony_ci .start = ATARI_NETUSBEE_BASE + 0x20, 8098c2ecf20Sopenharmony_ci .end = ATARI_NETUSBEE_BASE + 0x21, 8108c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 8118c2ecf20Sopenharmony_ci }, 8128c2ecf20Sopenharmony_ci [2] = { 8138c2ecf20Sopenharmony_ci .name = "isp1160-irq", 8148c2ecf20Sopenharmony_ci .start = ATARI_NETUSBEE_IRQ, 8158c2ecf20Sopenharmony_ci .end = ATARI_NETUSBEE_IRQ, 8168c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 8178c2ecf20Sopenharmony_ci }, 8188c2ecf20Sopenharmony_ci}; 8198c2ecf20Sopenharmony_ci 8208c2ecf20Sopenharmony_ci/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */ 8218c2ecf20Sopenharmony_cistatic struct isp116x_platform_data netusbee_platform_data = { 8228c2ecf20Sopenharmony_ci /* Enable internal resistors on downstream ports */ 8238c2ecf20Sopenharmony_ci .sel15Kres = 1, 8248c2ecf20Sopenharmony_ci /* On-chip overcurrent protection */ 8258c2ecf20Sopenharmony_ci .oc_enable = 1, 8268c2ecf20Sopenharmony_ci /* INT output polarity */ 8278c2ecf20Sopenharmony_ci .int_act_high = 1, 8288c2ecf20Sopenharmony_ci /* INT edge or level triggered */ 8298c2ecf20Sopenharmony_ci .int_edge_triggered = 0, 8308c2ecf20Sopenharmony_ci 8318c2ecf20Sopenharmony_ci /* WAKEUP pin connected - NOT SUPPORTED */ 8328c2ecf20Sopenharmony_ci /* .remote_wakeup_connected = 0, */ 8338c2ecf20Sopenharmony_ci /* Wakeup by devices on usb bus enabled */ 8348c2ecf20Sopenharmony_ci .remote_wakeup_enable = 0, 8358c2ecf20Sopenharmony_ci .delay = isp1160_delay, 8368c2ecf20Sopenharmony_ci}; 8378c2ecf20Sopenharmony_ci 8388c2ecf20Sopenharmony_cistatic struct platform_device netusbee_device = { 8398c2ecf20Sopenharmony_ci .name = "isp116x-hcd", 8408c2ecf20Sopenharmony_ci .id = 1, 8418c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(netusbee_resources), 8428c2ecf20Sopenharmony_ci .resource = netusbee_resources, 8438c2ecf20Sopenharmony_ci .dev = { 8448c2ecf20Sopenharmony_ci .platform_data = &netusbee_platform_data, 8458c2ecf20Sopenharmony_ci }, 8468c2ecf20Sopenharmony_ci}; 8478c2ecf20Sopenharmony_ci 8488c2ecf20Sopenharmony_cistatic struct platform_device *atari_netusbee_devices[] __initdata = { 8498c2ecf20Sopenharmony_ci &rtl8019_device, 8508c2ecf20Sopenharmony_ci &netusbee_device 8518c2ecf20Sopenharmony_ci}; 8528c2ecf20Sopenharmony_ci#endif /* CONFIG_ATARI_ETHERNEC */ 8538c2ecf20Sopenharmony_ci 8548c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_ATARI_SCSI) 8558c2ecf20Sopenharmony_cistatic const struct resource atari_scsi_st_rsrc[] __initconst = { 8568c2ecf20Sopenharmony_ci { 8578c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 8588c2ecf20Sopenharmony_ci .start = IRQ_MFP_FSCSI, 8598c2ecf20Sopenharmony_ci .end = IRQ_MFP_FSCSI, 8608c2ecf20Sopenharmony_ci }, 8618c2ecf20Sopenharmony_ci}; 8628c2ecf20Sopenharmony_ci 8638c2ecf20Sopenharmony_cistatic const struct resource atari_scsi_tt_rsrc[] __initconst = { 8648c2ecf20Sopenharmony_ci { 8658c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 8668c2ecf20Sopenharmony_ci .start = IRQ_TT_MFP_SCSI, 8678c2ecf20Sopenharmony_ci .end = IRQ_TT_MFP_SCSI, 8688c2ecf20Sopenharmony_ci }, 8698c2ecf20Sopenharmony_ci}; 8708c2ecf20Sopenharmony_ci#endif 8718c2ecf20Sopenharmony_ci 8728c2ecf20Sopenharmony_ci/* 8738c2ecf20Sopenharmony_ci * Falcon IDE interface 8748c2ecf20Sopenharmony_ci */ 8758c2ecf20Sopenharmony_ci 8768c2ecf20Sopenharmony_ci#define FALCON_IDE_BASE 0xfff00000 8778c2ecf20Sopenharmony_ci 8788c2ecf20Sopenharmony_cistatic const struct resource atari_falconide_rsrc[] __initconst = { 8798c2ecf20Sopenharmony_ci { 8808c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 8818c2ecf20Sopenharmony_ci .start = FALCON_IDE_BASE, 8828c2ecf20Sopenharmony_ci .end = FALCON_IDE_BASE + 0x39, 8838c2ecf20Sopenharmony_ci }, 8848c2ecf20Sopenharmony_ci { 8858c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 8868c2ecf20Sopenharmony_ci .start = IRQ_MFP_FSCSI, 8878c2ecf20Sopenharmony_ci .end = IRQ_MFP_FSCSI, 8888c2ecf20Sopenharmony_ci }, 8898c2ecf20Sopenharmony_ci}; 8908c2ecf20Sopenharmony_ci 8918c2ecf20Sopenharmony_ciint __init atari_platform_init(void) 8928c2ecf20Sopenharmony_ci{ 8938c2ecf20Sopenharmony_ci struct platform_device *pdev; 8948c2ecf20Sopenharmony_ci int rv = 0; 8958c2ecf20Sopenharmony_ci 8968c2ecf20Sopenharmony_ci if (!MACH_IS_ATARI) 8978c2ecf20Sopenharmony_ci return -ENODEV; 8988c2ecf20Sopenharmony_ci 8998c2ecf20Sopenharmony_ci#ifdef CONFIG_ATARI_ETHERNAT 9008c2ecf20Sopenharmony_ci { 9018c2ecf20Sopenharmony_ci unsigned char *enatc_virt; 9028c2ecf20Sopenharmony_ci enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf); 9038c2ecf20Sopenharmony_ci if (hwreg_present(enatc_virt)) { 9048c2ecf20Sopenharmony_ci rv = platform_add_devices(atari_ethernat_devices, 9058c2ecf20Sopenharmony_ci ARRAY_SIZE(atari_ethernat_devices)); 9068c2ecf20Sopenharmony_ci } 9078c2ecf20Sopenharmony_ci iounmap(enatc_virt); 9088c2ecf20Sopenharmony_ci } 9098c2ecf20Sopenharmony_ci#endif 9108c2ecf20Sopenharmony_ci 9118c2ecf20Sopenharmony_ci#ifdef CONFIG_ATARI_ETHERNEC 9128c2ecf20Sopenharmony_ci { 9138c2ecf20Sopenharmony_ci int error; 9148c2ecf20Sopenharmony_ci unsigned char *enec_virt; 9158c2ecf20Sopenharmony_ci enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf); 9168c2ecf20Sopenharmony_ci if (hwreg_present(enec_virt)) { 9178c2ecf20Sopenharmony_ci error = platform_add_devices(atari_netusbee_devices, 9188c2ecf20Sopenharmony_ci ARRAY_SIZE(atari_netusbee_devices)); 9198c2ecf20Sopenharmony_ci if (error && !rv) 9208c2ecf20Sopenharmony_ci rv = error; 9218c2ecf20Sopenharmony_ci } 9228c2ecf20Sopenharmony_ci iounmap(enec_virt); 9238c2ecf20Sopenharmony_ci } 9248c2ecf20Sopenharmony_ci#endif 9258c2ecf20Sopenharmony_ci 9268c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_ATARI_SCSI) 9278c2ecf20Sopenharmony_ci if (ATARIHW_PRESENT(ST_SCSI)) 9288c2ecf20Sopenharmony_ci platform_device_register_simple("atari_scsi", -1, 9298c2ecf20Sopenharmony_ci atari_scsi_st_rsrc, ARRAY_SIZE(atari_scsi_st_rsrc)); 9308c2ecf20Sopenharmony_ci else if (ATARIHW_PRESENT(TT_SCSI)) 9318c2ecf20Sopenharmony_ci platform_device_register_simple("atari_scsi", -1, 9328c2ecf20Sopenharmony_ci atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc)); 9338c2ecf20Sopenharmony_ci#endif 9348c2ecf20Sopenharmony_ci 9358c2ecf20Sopenharmony_ci if (ATARIHW_PRESENT(IDE)) { 9368c2ecf20Sopenharmony_ci pdev = platform_device_register_simple("atari-falcon-ide", -1, 9378c2ecf20Sopenharmony_ci atari_falconide_rsrc, ARRAY_SIZE(atari_falconide_rsrc)); 9388c2ecf20Sopenharmony_ci if (IS_ERR(pdev)) 9398c2ecf20Sopenharmony_ci rv = PTR_ERR(pdev); 9408c2ecf20Sopenharmony_ci } 9418c2ecf20Sopenharmony_ci 9428c2ecf20Sopenharmony_ci return rv; 9438c2ecf20Sopenharmony_ci} 9448c2ecf20Sopenharmony_ci 9458c2ecf20Sopenharmony_ciarch_initcall(atari_platform_init); 946