11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds * linux/arch/m68k/atari/config.c
31da177e4SLinus Torvalds *
41da177e4SLinus Torvalds * Copyright (C) 1994 Bjoern Brauel
51da177e4SLinus Torvalds *
61da177e4SLinus Torvalds * 5/2/94 Roman Hodek:
71da177e4SLinus Torvalds * Added setting of time_adj to get a better clock.
81da177e4SLinus Torvalds *
91da177e4SLinus Torvalds * 5/14/94 Roman Hodek:
101da177e4SLinus Torvalds * gettod() for TT
111da177e4SLinus Torvalds *
121da177e4SLinus Torvalds * 5/15/94 Roman Hodek:
131da177e4SLinus Torvalds * hard_reset_now() for Atari (and others?)
141da177e4SLinus Torvalds *
151da177e4SLinus Torvalds * 94/12/30 Andreas Schwab:
161da177e4SLinus Torvalds * atari_sched_init fixed to get precise clock.
171da177e4SLinus Torvalds *
181da177e4SLinus Torvalds * This file is subject to the terms and conditions of the GNU General Public
191da177e4SLinus Torvalds * License. See the file COPYING in the main directory of this archive
201da177e4SLinus Torvalds * for more details.
211da177e4SLinus Torvalds */
221da177e4SLinus Torvalds
231da177e4SLinus Torvalds /*
241da177e4SLinus Torvalds * Miscellaneous atari stuff
251da177e4SLinus Torvalds */
261da177e4SLinus Torvalds
271da177e4SLinus Torvalds #include <linux/types.h>
281da177e4SLinus Torvalds #include <linux/mm.h>
29813dcf7aSAlexey Dobriyan #include <linux/seq_file.h>
301da177e4SLinus Torvalds #include <linux/console.h>
311da177e4SLinus Torvalds #include <linux/init.h>
321da177e4SLinus Torvalds #include <linux/delay.h>
331da177e4SLinus Torvalds #include <linux/ioport.h>
34736b24dbSMichael Schmitz #include <linux/platform_device.h>
3501a18d16SMichael Schmitz #include <linux/usb/isp116x.h>
361da177e4SLinus Torvalds #include <linux/vt_kern.h>
37a3b2004aSAdrian Bunk #include <linux/module.h>
381da177e4SLinus Torvalds
391da177e4SLinus Torvalds #include <asm/bootinfo.h>
404c3c522bSGeert Uytterhoeven #include <asm/bootinfo-atari.h>
41abe48101SGeert Uytterhoeven #include <asm/byteorder.h>
421da177e4SLinus Torvalds #include <asm/setup.h>
431da177e4SLinus Torvalds #include <asm/atarihw.h>
441da177e4SLinus Torvalds #include <asm/atariints.h>
451da177e4SLinus Torvalds #include <asm/atari_stram.h>
461da177e4SLinus Torvalds #include <asm/machdep.h>
471da177e4SLinus Torvalds #include <asm/hwtest.h>
481da177e4SLinus Torvalds #include <asm/io.h>
49*91d7b75aSLaurent Vivier #include <asm/config.h>
501da177e4SLinus Torvalds
511da177e4SLinus Torvalds u_long atari_mch_cookie;
52a3b2004aSAdrian Bunk EXPORT_SYMBOL(atari_mch_cookie);
53a3b2004aSAdrian Bunk
541da177e4SLinus Torvalds u_long atari_mch_type;
55a3b2004aSAdrian Bunk EXPORT_SYMBOL(atari_mch_type);
56a3b2004aSAdrian Bunk
571da177e4SLinus Torvalds struct atari_hw_present atari_hw_present;
58a3b2004aSAdrian Bunk EXPORT_SYMBOL(atari_hw_present);
59a3b2004aSAdrian Bunk
601da177e4SLinus Torvalds u_long atari_switches;
61a3b2004aSAdrian Bunk EXPORT_SYMBOL(atari_switches);
62a3b2004aSAdrian Bunk
631da177e4SLinus Torvalds int atari_dont_touch_floppy_select;
64a3b2004aSAdrian Bunk EXPORT_SYMBOL(atari_dont_touch_floppy_select);
65a3b2004aSAdrian Bunk
661da177e4SLinus Torvalds int atari_rtc_year_offset;
671da177e4SLinus Torvalds
681da177e4SLinus Torvalds /* local function prototypes */
691da177e4SLinus Torvalds static void atari_reset(void);
701da177e4SLinus Torvalds static void atari_get_model(char *model);
71813dcf7aSAlexey Dobriyan static void atari_get_hardware_list(struct seq_file *m);
721da177e4SLinus Torvalds
731da177e4SLinus Torvalds /* atari specific irq functions */
741da177e4SLinus Torvalds extern void atari_init_IRQ (void);
751da177e4SLinus Torvalds extern void atari_mksound(unsigned int count, unsigned int ticks);
761da177e4SLinus Torvalds #ifdef CONFIG_HEARTBEAT
771da177e4SLinus Torvalds static void atari_heartbeat(int on);
781da177e4SLinus Torvalds #endif
791da177e4SLinus Torvalds
801da177e4SLinus Torvalds /* atari specific timer functions (in time.c) */
81f9a01539SArnd Bergmann extern void atari_sched_init(void);
821da177e4SLinus Torvalds extern int atari_mste_hwclk (int, struct rtc_time *);
831da177e4SLinus Torvalds extern int atari_tt_hwclk (int, struct rtc_time *);
841da177e4SLinus Torvalds
851da177e4SLinus Torvalds /* ++roman: This is a more elaborate test for an SCC chip, since the plain
861da177e4SLinus Torvalds * Medusa board generates DTACK at the SCC's standard addresses, but a SCC
871da177e4SLinus Torvalds * board in the Medusa is possible. Also, the addresses where the ST_ESCC
881da177e4SLinus Torvalds * resides generate DTACK without the chip, too.
891da177e4SLinus Torvalds * The method is to write values into the interrupt vector register, that
901da177e4SLinus Torvalds * should be readable without trouble (from channel A!).
911da177e4SLinus Torvalds */
921da177e4SLinus Torvalds
scc_test(volatile char * ctla)931da177e4SLinus Torvalds static int __init scc_test(volatile char *ctla)
941da177e4SLinus Torvalds {
951da177e4SLinus Torvalds if (!hwreg_present(ctla))
966ff5801aSRoman Zippel return 0;
971da177e4SLinus Torvalds MFPDELAY();
981da177e4SLinus Torvalds
996ff5801aSRoman Zippel *ctla = 2;
1006ff5801aSRoman Zippel MFPDELAY();
1016ff5801aSRoman Zippel *ctla = 0x40;
1021da177e4SLinus Torvalds MFPDELAY();
1031da177e4SLinus Torvalds
1046ff5801aSRoman Zippel *ctla = 2;
1056ff5801aSRoman Zippel MFPDELAY();
1066ff5801aSRoman Zippel if (*ctla != 0x40)
1076ff5801aSRoman Zippel return 0;
1086ff5801aSRoman Zippel MFPDELAY();
1091da177e4SLinus Torvalds
1106ff5801aSRoman Zippel *ctla = 2;
1116ff5801aSRoman Zippel MFPDELAY();
1126ff5801aSRoman Zippel *ctla = 0x60;
1136ff5801aSRoman Zippel MFPDELAY();
1141da177e4SLinus Torvalds
1156ff5801aSRoman Zippel *ctla = 2;
1166ff5801aSRoman Zippel MFPDELAY();
1176ff5801aSRoman Zippel if (*ctla != 0x60)
1186ff5801aSRoman Zippel return 0;
1196ff5801aSRoman Zippel
1206ff5801aSRoman Zippel return 1;
1211da177e4SLinus Torvalds }
1221da177e4SLinus Torvalds
1231da177e4SLinus Torvalds
1241da177e4SLinus Torvalds /*
1251da177e4SLinus Torvalds * Parse an Atari-specific record in the bootinfo
1261da177e4SLinus Torvalds */
1271da177e4SLinus Torvalds
atari_parse_bootinfo(const struct bi_record * record)1281da177e4SLinus Torvalds int __init atari_parse_bootinfo(const struct bi_record *record)
1291da177e4SLinus Torvalds {
1301da177e4SLinus Torvalds int unknown = 0;
131abe48101SGeert Uytterhoeven const void *data = record->data;
1321da177e4SLinus Torvalds
133abe48101SGeert Uytterhoeven switch (be16_to_cpu(record->tag)) {
1341da177e4SLinus Torvalds case BI_ATARI_MCH_COOKIE:
135abe48101SGeert Uytterhoeven atari_mch_cookie = be32_to_cpup(data);
1361da177e4SLinus Torvalds break;
1371da177e4SLinus Torvalds case BI_ATARI_MCH_TYPE:
138abe48101SGeert Uytterhoeven atari_mch_type = be32_to_cpup(data);
1391da177e4SLinus Torvalds break;
1401da177e4SLinus Torvalds default:
1411da177e4SLinus Torvalds unknown = 1;
1426ff5801aSRoman Zippel break;
1431da177e4SLinus Torvalds }
1446ff5801aSRoman Zippel return unknown;
1451da177e4SLinus Torvalds }
1461da177e4SLinus Torvalds
1471da177e4SLinus Torvalds
1481da177e4SLinus Torvalds /* Parse the Atari-specific switches= option. */
atari_switches_setup(char * str)149d6713b40SRoman Zippel static int __init atari_switches_setup(char *str)
1501da177e4SLinus Torvalds {
151c097a39cSGeert Uytterhoeven char switches[COMMAND_LINE_SIZE];
1521da177e4SLinus Torvalds char *p;
1531da177e4SLinus Torvalds int ovsc_shift;
1541da177e4SLinus Torvalds char *args = switches;
1551da177e4SLinus Torvalds
156d6713b40SRoman Zippel if (!MACH_IS_ATARI)
157d6713b40SRoman Zippel return 0;
158d6713b40SRoman Zippel
1591da177e4SLinus Torvalds /* copy string to local array, strsep works destructively... */
160d6713b40SRoman Zippel strcpy(switches, str);
1611da177e4SLinus Torvalds atari_switches = 0;
1621da177e4SLinus Torvalds
1631da177e4SLinus Torvalds /* parse the options */
1641da177e4SLinus Torvalds while ((p = strsep(&args, ",")) != NULL) {
1656ff5801aSRoman Zippel if (!*p)
1666ff5801aSRoman Zippel continue;
1671da177e4SLinus Torvalds ovsc_shift = 0;
1681da177e4SLinus Torvalds if (strncmp(p, "ov_", 3) == 0) {
1691da177e4SLinus Torvalds p += 3;
1701da177e4SLinus Torvalds ovsc_shift = ATARI_SWITCH_OVSC_SHIFT;
1711da177e4SLinus Torvalds }
1721da177e4SLinus Torvalds
1731da177e4SLinus Torvalds if (strcmp(p, "ikbd") == 0) {
1741da177e4SLinus Torvalds /* RTS line of IKBD ACIA */
1751da177e4SLinus Torvalds atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift;
1766ff5801aSRoman Zippel } else if (strcmp(p, "midi") == 0) {
1771da177e4SLinus Torvalds /* RTS line of MIDI ACIA */
1781da177e4SLinus Torvalds atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift;
1796ff5801aSRoman Zippel } else if (strcmp(p, "snd6") == 0) {
1801da177e4SLinus Torvalds atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;
1816ff5801aSRoman Zippel } else if (strcmp(p, "snd7") == 0) {
1821da177e4SLinus Torvalds atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
1831da177e4SLinus Torvalds }
1841da177e4SLinus Torvalds }
185d6713b40SRoman Zippel return 0;
1861da177e4SLinus Torvalds }
1871da177e4SLinus Torvalds
188d6713b40SRoman Zippel early_param("switches", atari_switches_setup);
189d6713b40SRoman Zippel
1901da177e4SLinus Torvalds
1911da177e4SLinus Torvalds /*
1921da177e4SLinus Torvalds * Setup the Atari configuration info
1931da177e4SLinus Torvalds */
1941da177e4SLinus Torvalds
config_atari(void)1951da177e4SLinus Torvalds void __init config_atari(void)
1961da177e4SLinus Torvalds {
1971da177e4SLinus Torvalds unsigned short tos_version;
1981da177e4SLinus Torvalds
1991da177e4SLinus Torvalds memset(&atari_hw_present, 0, sizeof(atari_hw_present));
2001da177e4SLinus Torvalds
2016ff5801aSRoman Zippel /* Change size of I/O space from 64KB to 4GB. */
2026ff5801aSRoman Zippel ioport_resource.end = 0xFFFFFFFF;
2031da177e4SLinus Torvalds
2041da177e4SLinus Torvalds mach_sched_init = atari_sched_init;
2051da177e4SLinus Torvalds mach_init_IRQ = atari_init_IRQ;
2061da177e4SLinus Torvalds mach_get_model = atari_get_model;
2071da177e4SLinus Torvalds mach_get_hardware_list = atari_get_hardware_list;
2081da177e4SLinus Torvalds mach_reset = atari_reset;
209a1a9e88fSGeert Uytterhoeven #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
2101da177e4SLinus Torvalds mach_beep = atari_mksound;
2111da177e4SLinus Torvalds #endif
2121da177e4SLinus Torvalds #ifdef CONFIG_HEARTBEAT
2131da177e4SLinus Torvalds mach_heartbeat = atari_heartbeat;
2141da177e4SLinus Torvalds #endif
2151da177e4SLinus Torvalds
2161da177e4SLinus Torvalds /* Set switches as requested by the user */
2171da177e4SLinus Torvalds if (atari_switches & ATARI_SWITCH_IKBD)
2181da177e4SLinus Torvalds acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID;
2191da177e4SLinus Torvalds if (atari_switches & ATARI_SWITCH_MIDI)
2201da177e4SLinus Torvalds acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID;
2211da177e4SLinus Torvalds if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) {
2221da177e4SLinus Torvalds sound_ym.rd_data_reg_sel = 14;
2231da177e4SLinus Torvalds sound_ym.wd_data = sound_ym.rd_data_reg_sel |
2241da177e4SLinus Torvalds ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) |
2251da177e4SLinus Torvalds ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0);
2261da177e4SLinus Torvalds }
2271da177e4SLinus Torvalds
2281da177e4SLinus Torvalds /* ++bjoern:
2291da177e4SLinus Torvalds * Determine hardware present
2301da177e4SLinus Torvalds */
2311da177e4SLinus Torvalds
2326d7919a7SGeert Uytterhoeven pr_info("Atari hardware found:");
23329c8a246SAdrian Bunk if (MACH_IS_MEDUSA) {
2341da177e4SLinus Torvalds /* There's no Atari video hardware on the Medusa, but all the
2351da177e4SLinus Torvalds * addresses below generate a DTACK so no bus error occurs! */
2366ff5801aSRoman Zippel } else if (hwreg_present(f030_xreg)) {
2371da177e4SLinus Torvalds ATARIHW_SET(VIDEL_SHIFTER);
2386d7919a7SGeert Uytterhoeven pr_cont(" VIDEL");
2391da177e4SLinus Torvalds /* This is a temporary hack: If there is Falcon video
2401da177e4SLinus Torvalds * hardware, we assume that the ST-DMA serves SCSI instead of
2411da177e4SLinus Torvalds * ACSI. In the future, there should be a better method for
2421da177e4SLinus Torvalds * this...
2431da177e4SLinus Torvalds */
2441da177e4SLinus Torvalds ATARIHW_SET(ST_SCSI);
2456d7919a7SGeert Uytterhoeven pr_cont(" STDMA-SCSI");
2466ff5801aSRoman Zippel } else if (hwreg_present(tt_palette)) {
2471da177e4SLinus Torvalds ATARIHW_SET(TT_SHIFTER);
2486d7919a7SGeert Uytterhoeven pr_cont(" TT_SHIFTER");
249053b5142SGeert Uytterhoeven } else if (hwreg_present(&shifter_st.bas_hi)) {
250053b5142SGeert Uytterhoeven if (hwreg_present(&shifter_st.bas_lo) &&
251053b5142SGeert Uytterhoeven (shifter_st.bas_lo = 0x0aau, shifter_st.bas_lo == 0x0aau)) {
2521da177e4SLinus Torvalds ATARIHW_SET(EXTD_SHIFTER);
2536d7919a7SGeert Uytterhoeven pr_cont(" EXTD_SHIFTER");
2546ff5801aSRoman Zippel } else {
2551da177e4SLinus Torvalds ATARIHW_SET(STND_SHIFTER);
2566d7919a7SGeert Uytterhoeven pr_cont(" STND_SHIFTER");
2571da177e4SLinus Torvalds }
2581da177e4SLinus Torvalds }
2593d92e8f3SGeert Uytterhoeven if (hwreg_present(&st_mfp.par_dt_reg)) {
2601da177e4SLinus Torvalds ATARIHW_SET(ST_MFP);
2616d7919a7SGeert Uytterhoeven pr_cont(" ST_MFP");
2621da177e4SLinus Torvalds }
2631da177e4SLinus Torvalds if (hwreg_present(&tt_mfp.par_dt_reg)) {
2641da177e4SLinus Torvalds ATARIHW_SET(TT_MFP);
2656d7919a7SGeert Uytterhoeven pr_cont(" TT_MFP");
2661da177e4SLinus Torvalds }
2671da177e4SLinus Torvalds if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) {
2681da177e4SLinus Torvalds ATARIHW_SET(SCSI_DMA);
2696d7919a7SGeert Uytterhoeven pr_cont(" TT_SCSI_DMA");
2701da177e4SLinus Torvalds }
2716ff5801aSRoman Zippel /*
2726ff5801aSRoman Zippel * The ST-DMA address registers aren't readable
2736ff5801aSRoman Zippel * on all Medusas, so the test below may fail
2746ff5801aSRoman Zippel */
2756ff5801aSRoman Zippel if (MACH_IS_MEDUSA ||
2761da177e4SLinus Torvalds (hwreg_present(&st_dma.dma_vhi) &&
2771da177e4SLinus Torvalds (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) &&
2781da177e4SLinus Torvalds st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa &&
2791da177e4SLinus Torvalds (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) &&
2801da177e4SLinus Torvalds st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) {
2811da177e4SLinus Torvalds ATARIHW_SET(EXTD_DMA);
2826d7919a7SGeert Uytterhoeven pr_cont(" EXTD_DMA");
2831da177e4SLinus Torvalds }
2841da177e4SLinus Torvalds if (hwreg_present(&tt_scsi.scsi_data)) {
2851da177e4SLinus Torvalds ATARIHW_SET(TT_SCSI);
2866d7919a7SGeert Uytterhoeven pr_cont(" TT_SCSI");
2871da177e4SLinus Torvalds }
2881da177e4SLinus Torvalds if (hwreg_present(&sound_ym.rd_data_reg_sel)) {
2891da177e4SLinus Torvalds ATARIHW_SET(YM_2149);
2906d7919a7SGeert Uytterhoeven pr_cont(" YM2149");
2911da177e4SLinus Torvalds }
29229c8a246SAdrian Bunk if (!MACH_IS_MEDUSA && hwreg_present(&tt_dmasnd.ctrl)) {
2931da177e4SLinus Torvalds ATARIHW_SET(PCM_8BIT);
2946d7919a7SGeert Uytterhoeven pr_cont(" PCM");
2951da177e4SLinus Torvalds }
29629c8a246SAdrian Bunk if (hwreg_present(&falcon_codec.unused5)) {
2971da177e4SLinus Torvalds ATARIHW_SET(CODEC);
2986d7919a7SGeert Uytterhoeven pr_cont(" CODEC");
2991da177e4SLinus Torvalds }
3001da177e4SLinus Torvalds if (hwreg_present(&dsp56k_host_interface.icr)) {
3011da177e4SLinus Torvalds ATARIHW_SET(DSP56K);
3026d7919a7SGeert Uytterhoeven pr_cont(" DSP56K");
3031da177e4SLinus Torvalds }
3041da177e4SLinus Torvalds if (hwreg_present(&tt_scc_dma.dma_ctrl) &&
3051da177e4SLinus Torvalds #if 0
3061da177e4SLinus Torvalds /* This test sucks! Who knows some better? */
3071da177e4SLinus Torvalds (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) &&
3081da177e4SLinus Torvalds (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0)
3091da177e4SLinus Torvalds #else
31029c8a246SAdrian Bunk !MACH_IS_MEDUSA
3111da177e4SLinus Torvalds #endif
3121da177e4SLinus Torvalds ) {
3131da177e4SLinus Torvalds ATARIHW_SET(SCC_DMA);
3146d7919a7SGeert Uytterhoeven pr_cont(" SCC_DMA");
3151da177e4SLinus Torvalds }
316de339e4bSGeert Uytterhoeven if (scc_test(&atari_scc.cha_a_ctrl)) {
3171da177e4SLinus Torvalds ATARIHW_SET(SCC);
3186d7919a7SGeert Uytterhoeven pr_cont(" SCC");
3191da177e4SLinus Torvalds }
3201da177e4SLinus Torvalds if (scc_test(&st_escc.cha_b_ctrl)) {
3211da177e4SLinus Torvalds ATARIHW_SET(ST_ESCC);
3226d7919a7SGeert Uytterhoeven pr_cont(" ST_ESCC");
3231da177e4SLinus Torvalds }
32429c8a246SAdrian Bunk if (hwreg_present(&tt_scu.sys_mask)) {
3251da177e4SLinus Torvalds ATARIHW_SET(SCU);
3261da177e4SLinus Torvalds /* Assume a VME bus if there's a SCU */
3271da177e4SLinus Torvalds ATARIHW_SET(VME);
3286d7919a7SGeert Uytterhoeven pr_cont(" VME SCU");
3291da177e4SLinus Torvalds }
3301da177e4SLinus Torvalds if (hwreg_present((void *)(0xffff9210))) {
3311da177e4SLinus Torvalds ATARIHW_SET(ANALOG_JOY);
3326d7919a7SGeert Uytterhoeven pr_cont(" ANALOG_JOY");
3331da177e4SLinus Torvalds }
33429c8a246SAdrian Bunk if (hwreg_present(blitter.halftone)) {
3351da177e4SLinus Torvalds ATARIHW_SET(BLITTER);
3366d7919a7SGeert Uytterhoeven pr_cont(" BLITTER");
3371da177e4SLinus Torvalds }
3381da177e4SLinus Torvalds if (hwreg_present((void *)0xfff00039)) {
3391da177e4SLinus Torvalds ATARIHW_SET(IDE);
3406d7919a7SGeert Uytterhoeven pr_cont(" IDE");
3411da177e4SLinus Torvalds }
3421da177e4SLinus Torvalds #if 1 /* This maybe wrong */
34329c8a246SAdrian Bunk if (!MACH_IS_MEDUSA && hwreg_present(&tt_microwire.data) &&
3441da177e4SLinus Torvalds hwreg_present(&tt_microwire.mask) &&
3451da177e4SLinus Torvalds (tt_microwire.mask = 0x7ff,
3461da177e4SLinus Torvalds udelay(1),
3471da177e4SLinus Torvalds tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR,
3481da177e4SLinus Torvalds udelay(1),
3491da177e4SLinus Torvalds tt_microwire.data != 0)) {
3501da177e4SLinus Torvalds ATARIHW_SET(MICROWIRE);
3516ff5801aSRoman Zippel while (tt_microwire.mask != 0x7ff)
3526ff5801aSRoman Zippel ;
3536d7919a7SGeert Uytterhoeven pr_cont(" MICROWIRE");
3541da177e4SLinus Torvalds }
3551da177e4SLinus Torvalds #endif
3561da177e4SLinus Torvalds if (hwreg_present(&tt_rtc.regsel)) {
3571da177e4SLinus Torvalds ATARIHW_SET(TT_CLK);
3586d7919a7SGeert Uytterhoeven pr_cont(" TT_CLK");
3591da177e4SLinus Torvalds mach_hwclk = atari_tt_hwclk;
3601da177e4SLinus Torvalds }
36129c8a246SAdrian Bunk if (hwreg_present(&mste_rtc.sec_ones)) {
3621da177e4SLinus Torvalds ATARIHW_SET(MSTE_CLK);
3636d7919a7SGeert Uytterhoeven pr_cont(" MSTE_CLK");
3641da177e4SLinus Torvalds mach_hwclk = atari_mste_hwclk;
3651da177e4SLinus Torvalds }
36629c8a246SAdrian Bunk if (!MACH_IS_MEDUSA && hwreg_present(&dma_wd.fdc_speed) &&
3671da177e4SLinus Torvalds hwreg_write(&dma_wd.fdc_speed, 0)) {
3681da177e4SLinus Torvalds ATARIHW_SET(FDCSPEED);
3696d7919a7SGeert Uytterhoeven pr_cont(" FDC_SPEED");
3701da177e4SLinus Torvalds }
37129c8a246SAdrian Bunk if (!ATARIHW_PRESENT(ST_SCSI)) {
3721da177e4SLinus Torvalds ATARIHW_SET(ACSI);
3736d7919a7SGeert Uytterhoeven pr_cont(" ACSI");
3741da177e4SLinus Torvalds }
3756d7919a7SGeert Uytterhoeven pr_cont("\n");
3761da177e4SLinus Torvalds
3771da177e4SLinus Torvalds if (CPU_IS_040_OR_060)
3781da177e4SLinus Torvalds /* Now it seems to be safe to turn of the tt0 transparent
3791da177e4SLinus Torvalds * translation (the one that must not be turned off in
3801da177e4SLinus Torvalds * head.S...)
3811da177e4SLinus Torvalds */
3826ff5801aSRoman Zippel asm volatile ("\n"
3836ff5801aSRoman Zippel " moveq #0,%%d0\n"
3846ff5801aSRoman Zippel " .chip 68040\n"
3856ff5801aSRoman Zippel " movec %%d0,%%itt0\n"
3866ff5801aSRoman Zippel " movec %%d0,%%dtt0\n"
3871da177e4SLinus Torvalds " .chip 68k"
3881da177e4SLinus Torvalds : /* no outputs */
3891da177e4SLinus Torvalds : /* no inputs */
3901da177e4SLinus Torvalds : "d0");
3911da177e4SLinus Torvalds
3921da177e4SLinus Torvalds /* allocator for memory that must reside in st-ram */
3931da177e4SLinus Torvalds atari_stram_init();
3941da177e4SLinus Torvalds
3951da177e4SLinus Torvalds /* Set up a mapping for the VMEbus address region:
3961da177e4SLinus Torvalds *
3971da177e4SLinus Torvalds * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff
3981da177e4SLinus Torvalds * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at
3991da177e4SLinus Torvalds * 0xfe000000 virt., because this can be done with a single
4001da177e4SLinus Torvalds * transparent translation. On the 68040, lots of often unused
4011da177e4SLinus Torvalds * page tables would be needed otherwise. On a MegaSTE or similar,
4021da177e4SLinus Torvalds * the highest byte is stripped off by hardware due to the 24 bit
4031da177e4SLinus Torvalds * design of the bus.
4041da177e4SLinus Torvalds */
4051da177e4SLinus Torvalds
4061da177e4SLinus Torvalds if (CPU_IS_020_OR_030) {
4071da177e4SLinus Torvalds unsigned long tt1_val;
4081da177e4SLinus Torvalds tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache
4091da177e4SLinus Torvalds * inhibit, read and write, FDC mask = 3,
4101da177e4SLinus Torvalds * FDC val = 4 -> Supervisor only */
4116ff5801aSRoman Zippel asm volatile ("\n"
4126ff5801aSRoman Zippel " .chip 68030\n"
4132a353506SAndreas Schwab " pmove %0,%/tt1\n"
4141da177e4SLinus Torvalds " .chip 68k"
4152a353506SAndreas Schwab : : "m" (tt1_val));
4166ff5801aSRoman Zippel } else {
4176ff5801aSRoman Zippel asm volatile ("\n"
4186ff5801aSRoman Zippel " .chip 68040\n"
4196ff5801aSRoman Zippel " movec %0,%%itt1\n"
4206ff5801aSRoman Zippel " movec %0,%%dtt1\n"
4211da177e4SLinus Torvalds " .chip 68k"
4221da177e4SLinus Torvalds :
4236ff5801aSRoman Zippel : "d" (0xfe00a040)); /* Translate 0xfexxxxxx, enable,
4241da177e4SLinus Torvalds * supervisor only, non-cacheable/
4251da177e4SLinus Torvalds * serialized, writable */
4261da177e4SLinus Torvalds
4271da177e4SLinus Torvalds }
4281da177e4SLinus Torvalds
4291da177e4SLinus Torvalds /* Fetch tos version at Physical 2 */
4306ff5801aSRoman Zippel /*
4316ff5801aSRoman Zippel * We my not be able to access this address if the kernel is
4326ff5801aSRoman Zippel * loaded to st ram, since the first page is unmapped. On the
4336ff5801aSRoman Zippel * Medusa this is always the case and there is nothing we can do
4346ff5801aSRoman Zippel * about this, so we just assume the smaller offset. For the TT
4356ff5801aSRoman Zippel * we use the fact that in head.S we have set up a mapping
4366ff5801aSRoman Zippel * 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
4376ff5801aSRoman Zippel * in the last 16MB of the address space.
4386ff5801aSRoman Zippel */
43929c8a246SAdrian Bunk tos_version = (MACH_IS_MEDUSA) ?
4401da177e4SLinus Torvalds 0xfff : *(unsigned short *)0xff000002;
4411da177e4SLinus Torvalds atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
4421da177e4SLinus Torvalds }
4431da177e4SLinus Torvalds
4441da177e4SLinus Torvalds #ifdef CONFIG_HEARTBEAT
atari_heartbeat(int on)4451da177e4SLinus Torvalds static void atari_heartbeat(int on)
4461da177e4SLinus Torvalds {
4471da177e4SLinus Torvalds unsigned char tmp;
4481da177e4SLinus Torvalds unsigned long flags;
4491da177e4SLinus Torvalds
4501da177e4SLinus Torvalds if (atari_dont_touch_floppy_select)
4511da177e4SLinus Torvalds return;
4521da177e4SLinus Torvalds
4531da177e4SLinus Torvalds local_irq_save(flags);
4541da177e4SLinus Torvalds sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */
4551da177e4SLinus Torvalds tmp = sound_ym.rd_data_reg_sel;
4561da177e4SLinus Torvalds sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02);
4571da177e4SLinus Torvalds local_irq_restore(flags);
4581da177e4SLinus Torvalds }
4591da177e4SLinus Torvalds #endif
4601da177e4SLinus Torvalds
4611da177e4SLinus Torvalds /* ++roman:
4621da177e4SLinus Torvalds *
4631da177e4SLinus Torvalds * This function does a reset on machines that lack the ability to
4641da177e4SLinus Torvalds * assert the processor's _RESET signal somehow via hardware. It is
4651da177e4SLinus Torvalds * based on the fact that you can find the initial SP and PC values
4661da177e4SLinus Torvalds * after a reset at physical addresses 0 and 4. This works pretty well
4671da177e4SLinus Torvalds * for Atari machines, since the lowest 8 bytes of physical memory are
4681da177e4SLinus Torvalds * really ROM (mapped by hardware). For other 680x0 machines: don't
4691da177e4SLinus Torvalds * know if it works...
4701da177e4SLinus Torvalds *
4711da177e4SLinus Torvalds * To get the values at addresses 0 and 4, the MMU better is turned
4721da177e4SLinus Torvalds * off first. After that, we have to jump into physical address space
4731da177e4SLinus Torvalds * (the PC before the pmove statement points to the virtual address of
4741da177e4SLinus Torvalds * the code). Getting that physical address is not hard, but the code
4751da177e4SLinus Torvalds * becomes a bit complex since I've tried to ensure that the jump
4761da177e4SLinus Torvalds * statement after the pmove is in the cache already (otherwise the
4771da177e4SLinus Torvalds * processor can't fetch it!). For that, the code first jumps to the
4781da177e4SLinus Torvalds * jump statement with the (virtual) address of the pmove section in
4791da177e4SLinus Torvalds * an address register . The jump statement is surely in the cache
4801da177e4SLinus Torvalds * now. After that, that physical address of the reset code is loaded
4811da177e4SLinus Torvalds * into the same address register, pmove is done and the same jump
4821da177e4SLinus Torvalds * statements goes to the reset code. Since there are not many
4831da177e4SLinus Torvalds * statements between the two jumps, I hope it stays in the cache.
4841da177e4SLinus Torvalds *
4851da177e4SLinus Torvalds * The C code makes heavy use of the GCC features that you can get the
4861da177e4SLinus Torvalds * address of a C label. No hope to compile this with another compiler
4871da177e4SLinus Torvalds * than GCC!
4881da177e4SLinus Torvalds */
4891da177e4SLinus Torvalds
4901da177e4SLinus Torvalds /* ++andreas: no need for complicated code, just depend on prefetch */
4911da177e4SLinus Torvalds
atari_reset(void)4921da177e4SLinus Torvalds static void atari_reset(void)
4931da177e4SLinus Torvalds {
4941da177e4SLinus Torvalds long tc_val = 0;
4951da177e4SLinus Torvalds long reset_addr;
4961da177e4SLinus Torvalds
4976ff5801aSRoman Zippel /*
4986ff5801aSRoman Zippel * On the Medusa, phys. 0x4 may contain garbage because it's no
4996ff5801aSRoman Zippel * ROM. See above for explanation why we cannot use PTOV(4).
5006ff5801aSRoman Zippel */
50129c8a246SAdrian Bunk reset_addr = MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 :
5021da177e4SLinus Torvalds *(unsigned long *) 0xff000004;
5031da177e4SLinus Torvalds
5041da177e4SLinus Torvalds /* reset ACIA for switch off OverScan, if it's active */
5051da177e4SLinus Torvalds if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
5061da177e4SLinus Torvalds acia.key_ctrl = ACIA_RESET;
5071da177e4SLinus Torvalds if (atari_switches & ATARI_SWITCH_OVSC_MIDI)
5081da177e4SLinus Torvalds acia.mid_ctrl = ACIA_RESET;
5091da177e4SLinus Torvalds
5101da177e4SLinus Torvalds /* processor independent: turn off interrupts and reset the VBR;
5111da177e4SLinus Torvalds * the caches must be left enabled, else prefetching the final jump
5126ff5801aSRoman Zippel * instruction doesn't work.
5136ff5801aSRoman Zippel */
5141da177e4SLinus Torvalds local_irq_disable();
5156ff5801aSRoman Zippel asm volatile ("movec %0,%%vbr"
5166ff5801aSRoman Zippel : : "d" (0));
5171da177e4SLinus Torvalds
5181da177e4SLinus Torvalds if (CPU_IS_040_OR_060) {
5191da177e4SLinus Torvalds unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
5201da177e4SLinus Torvalds if (CPU_IS_060) {
5211da177e4SLinus Torvalds /* 68060: clear PCR to turn off superscalar operation */
5226ff5801aSRoman Zippel asm volatile ("\n"
5236ff5801aSRoman Zippel " .chip 68060\n"
5246ff5801aSRoman Zippel " movec %0,%%pcr\n"
5251da177e4SLinus Torvalds " .chip 68k"
5266ff5801aSRoman Zippel : : "d" (0));
5271da177e4SLinus Torvalds }
5281da177e4SLinus Torvalds
5296ff5801aSRoman Zippel asm volatile ("\n"
5306ff5801aSRoman Zippel " move.l %0,%%d0\n"
5316ff5801aSRoman Zippel " and.l #0xff000000,%%d0\n"
5326ff5801aSRoman Zippel " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
5336ff5801aSRoman Zippel " .chip 68040\n"
5346ff5801aSRoman Zippel " movec %%d0,%%itt0\n"
5356ff5801aSRoman Zippel " movec %%d0,%%dtt0\n"
5366ff5801aSRoman Zippel " .chip 68k\n"
5376ff5801aSRoman Zippel " jmp %0@"
5386ff5801aSRoman Zippel : : "a" (jmp_addr040)
5391da177e4SLinus Torvalds : "d0");
5401da177e4SLinus Torvalds jmp_addr_label040:
5416ff5801aSRoman Zippel asm volatile ("\n"
5426ff5801aSRoman Zippel " moveq #0,%%d0\n"
5436ff5801aSRoman Zippel " nop\n"
5446ff5801aSRoman Zippel " .chip 68040\n"
5456ff5801aSRoman Zippel " cinva %%bc\n"
5466ff5801aSRoman Zippel " nop\n"
5476ff5801aSRoman Zippel " pflusha\n"
5486ff5801aSRoman Zippel " nop\n"
5496ff5801aSRoman Zippel " movec %%d0,%%tc\n"
5506ff5801aSRoman Zippel " nop\n"
5511da177e4SLinus Torvalds /* the following setup of transparent translations is needed on the
5521da177e4SLinus Torvalds * Afterburner040 to successfully reboot. Other machines shouldn't
5531da177e4SLinus Torvalds * care about a different tt regs setup, they also didn't care in
5541da177e4SLinus Torvalds * the past that the regs weren't turned off. */
5556ff5801aSRoman Zippel " move.l #0xffc000,%%d0\n" /* whole insn space cacheable */
5566ff5801aSRoman Zippel " movec %%d0,%%itt0\n"
5576ff5801aSRoman Zippel " movec %%d0,%%itt1\n"
5586ff5801aSRoman Zippel " or.w #0x40,%/d0\n" /* whole data space non-cacheable/ser. */
5596ff5801aSRoman Zippel " movec %%d0,%%dtt0\n"
5606ff5801aSRoman Zippel " movec %%d0,%%dtt1\n"
5616ff5801aSRoman Zippel " .chip 68k\n"
5621da177e4SLinus Torvalds " jmp %0@"
5631da177e4SLinus Torvalds : /* no outputs */
5641da177e4SLinus Torvalds : "a" (reset_addr)
5651da177e4SLinus Torvalds : "d0");
5666ff5801aSRoman Zippel } else
5676ff5801aSRoman Zippel asm volatile ("\n"
5682a353506SAndreas Schwab " pmove %0,%%tc\n"
5691da177e4SLinus Torvalds " jmp %1@"
5701da177e4SLinus Torvalds : /* no outputs */
5712a353506SAndreas Schwab : "m" (tc_val), "a" (reset_addr));
5721da177e4SLinus Torvalds }
5731da177e4SLinus Torvalds
5741da177e4SLinus Torvalds
atari_get_model(char * model)5751da177e4SLinus Torvalds static void atari_get_model(char *model)
5761da177e4SLinus Torvalds {
5771da177e4SLinus Torvalds strcpy(model, "Atari ");
5781da177e4SLinus Torvalds switch (atari_mch_cookie >> 16) {
5791da177e4SLinus Torvalds case ATARI_MCH_ST:
5801da177e4SLinus Torvalds if (ATARIHW_PRESENT(MSTE_CLK))
5811da177e4SLinus Torvalds strcat(model, "Mega ST");
5821da177e4SLinus Torvalds else
5831da177e4SLinus Torvalds strcat(model, "ST");
5841da177e4SLinus Torvalds break;
5851da177e4SLinus Torvalds case ATARI_MCH_STE:
5861da177e4SLinus Torvalds if (MACH_IS_MSTE)
5871da177e4SLinus Torvalds strcat(model, "Mega STE");
5881da177e4SLinus Torvalds else
5891da177e4SLinus Torvalds strcat(model, "STE");
5901da177e4SLinus Torvalds break;
5911da177e4SLinus Torvalds case ATARI_MCH_TT:
5921da177e4SLinus Torvalds if (MACH_IS_MEDUSA)
5931da177e4SLinus Torvalds /* Medusa has TT _MCH cookie */
5941da177e4SLinus Torvalds strcat(model, "Medusa");
5951da177e4SLinus Torvalds else
5961da177e4SLinus Torvalds strcat(model, "TT");
5971da177e4SLinus Torvalds break;
5981da177e4SLinus Torvalds case ATARI_MCH_FALCON:
5991da177e4SLinus Torvalds strcat(model, "Falcon");
6001da177e4SLinus Torvalds if (MACH_IS_AB40)
6011da177e4SLinus Torvalds strcat(model, " (with Afterburner040)");
6021da177e4SLinus Torvalds break;
6031da177e4SLinus Torvalds default:
6041da177e4SLinus Torvalds sprintf(model + strlen(model), "(unknown mach cookie 0x%lx)",
6051da177e4SLinus Torvalds atari_mch_cookie);
6061da177e4SLinus Torvalds break;
6071da177e4SLinus Torvalds }
6081da177e4SLinus Torvalds }
6091da177e4SLinus Torvalds
6101da177e4SLinus Torvalds
atari_get_hardware_list(struct seq_file * m)611813dcf7aSAlexey Dobriyan static void atari_get_hardware_list(struct seq_file *m)
6121da177e4SLinus Torvalds {
613813dcf7aSAlexey Dobriyan int i;
6141da177e4SLinus Torvalds
6151da177e4SLinus Torvalds for (i = 0; i < m68k_num_memory; i++)
616813dcf7aSAlexey Dobriyan seq_printf(m, "\t%3ld MB at 0x%08lx (%s)\n",
6171da177e4SLinus Torvalds m68k_memory[i].size >> 20, m68k_memory[i].addr,
6181da177e4SLinus Torvalds (m68k_memory[i].addr & 0xff000000 ?
6191da177e4SLinus Torvalds "alternate RAM" : "ST-RAM"));
6201da177e4SLinus Torvalds
6211da177e4SLinus Torvalds #define ATARIHW_ANNOUNCE(name, str) \
6221da177e4SLinus Torvalds if (ATARIHW_PRESENT(name)) \
623813dcf7aSAlexey Dobriyan seq_printf(m, "\t%s\n", str)
6241da177e4SLinus Torvalds
625ad595b77SMarkus Elfring seq_puts(m, "Detected hardware:\n");
6261da177e4SLinus Torvalds ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter");
6271da177e4SLinus Torvalds ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter");
6281da177e4SLinus Torvalds ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter");
6291da177e4SLinus Torvalds ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter");
6301da177e4SLinus Torvalds ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator");
6311da177e4SLinus Torvalds ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound");
6321da177e4SLinus Torvalds ATARIHW_ANNOUNCE(CODEC, "CODEC Sound");
6331da177e4SLinus Torvalds ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)");
6341da177e4SLinus Torvalds ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)");
6351da177e4SLinus Torvalds ATARIHW_ANNOUNCE(ACSI, "ACSI Interface");
6361da177e4SLinus Torvalds ATARIHW_ANNOUNCE(IDE, "IDE Interface");
6371da177e4SLinus Torvalds ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC");
6381da177e4SLinus Torvalds ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901");
6391da177e4SLinus Torvalds ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901");
6401da177e4SLinus Torvalds ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530");
6411da177e4SLinus Torvalds ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230");
6421da177e4SLinus Torvalds ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface");
6431da177e4SLinus Torvalds ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface");
6441da177e4SLinus Torvalds ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)");
6451da177e4SLinus Torvalds ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)");
6461da177e4SLinus Torvalds ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380");
6471da177e4SLinus Torvalds ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC");
6481da177e4SLinus Torvalds ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A");
6491da177e4SLinus Torvalds ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15");
6501da177e4SLinus Torvalds ATARIHW_ANNOUNCE(SCU, "System Control Unit");
6511da177e4SLinus Torvalds ATARIHW_ANNOUNCE(BLITTER, "Blitter");
6521da177e4SLinus Torvalds ATARIHW_ANNOUNCE(VME, "VME Bus");
6531da177e4SLinus Torvalds ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor");
6541da177e4SLinus Torvalds }
655736b24dbSMichael Schmitz
656736b24dbSMichael Schmitz /*
657736b24dbSMichael Schmitz * MSch: initial platform device support for Atari,
65801a18d16SMichael Schmitz * required for EtherNAT/EtherNEC/NetUSBee drivers
659736b24dbSMichael Schmitz */
660736b24dbSMichael Schmitz
66101a18d16SMichael Schmitz #if defined(CONFIG_ATARI_ETHERNAT) || defined(CONFIG_ATARI_ETHERNEC)
isp1160_delay(struct device * dev,int delay)66201a18d16SMichael Schmitz static void isp1160_delay(struct device *dev, int delay)
66301a18d16SMichael Schmitz {
66401a18d16SMichael Schmitz ndelay(delay);
66501a18d16SMichael Schmitz }
66601a18d16SMichael Schmitz #endif
66701a18d16SMichael Schmitz
668736b24dbSMichael Schmitz #ifdef CONFIG_ATARI_ETHERNAT
669736b24dbSMichael Schmitz /*
670736b24dbSMichael Schmitz * EtherNAT: SMC91C111 Ethernet chipset, handled by smc91x driver
671736b24dbSMichael Schmitz */
672736b24dbSMichael Schmitz
673736b24dbSMichael Schmitz #define ATARI_ETHERNAT_IRQ 140
674736b24dbSMichael Schmitz
675736b24dbSMichael Schmitz static struct resource smc91x_resources[] = {
676736b24dbSMichael Schmitz [0] = {
677736b24dbSMichael Schmitz .name = "smc91x-regs",
678736b24dbSMichael Schmitz .start = ATARI_ETHERNAT_PHYS_ADDR,
679736b24dbSMichael Schmitz .end = ATARI_ETHERNAT_PHYS_ADDR + 0xfffff,
680736b24dbSMichael Schmitz .flags = IORESOURCE_MEM,
681736b24dbSMichael Schmitz },
682736b24dbSMichael Schmitz [1] = {
683736b24dbSMichael Schmitz .name = "smc91x-irq",
684736b24dbSMichael Schmitz .start = ATARI_ETHERNAT_IRQ,
685736b24dbSMichael Schmitz .end = ATARI_ETHERNAT_IRQ,
686736b24dbSMichael Schmitz .flags = IORESOURCE_IRQ,
687736b24dbSMichael Schmitz },
688736b24dbSMichael Schmitz };
689736b24dbSMichael Schmitz
690736b24dbSMichael Schmitz static struct platform_device smc91x_device = {
691736b24dbSMichael Schmitz .name = "smc91x",
692736b24dbSMichael Schmitz .id = -1,
693736b24dbSMichael Schmitz .num_resources = ARRAY_SIZE(smc91x_resources),
694736b24dbSMichael Schmitz .resource = smc91x_resources,
695736b24dbSMichael Schmitz };
696736b24dbSMichael Schmitz
69701a18d16SMichael Schmitz /*
69801a18d16SMichael Schmitz * ISP 1160 - using the isp116x-hcd module
69901a18d16SMichael Schmitz */
70001a18d16SMichael Schmitz
70101a18d16SMichael Schmitz #define ATARI_USB_PHYS_ADDR 0x80000012
70201a18d16SMichael Schmitz #define ATARI_USB_IRQ 139
70301a18d16SMichael Schmitz
70401a18d16SMichael Schmitz static struct resource isp1160_resources[] = {
70501a18d16SMichael Schmitz [0] = {
70601a18d16SMichael Schmitz .name = "isp1160-data",
70701a18d16SMichael Schmitz .start = ATARI_USB_PHYS_ADDR,
70801a18d16SMichael Schmitz .end = ATARI_USB_PHYS_ADDR + 0x1,
70901a18d16SMichael Schmitz .flags = IORESOURCE_MEM,
71001a18d16SMichael Schmitz },
71101a18d16SMichael Schmitz [1] = {
71201a18d16SMichael Schmitz .name = "isp1160-regs",
71301a18d16SMichael Schmitz .start = ATARI_USB_PHYS_ADDR + 0x4,
71401a18d16SMichael Schmitz .end = ATARI_USB_PHYS_ADDR + 0x5,
71501a18d16SMichael Schmitz .flags = IORESOURCE_MEM,
71601a18d16SMichael Schmitz },
71701a18d16SMichael Schmitz [2] = {
71801a18d16SMichael Schmitz .name = "isp1160-irq",
71901a18d16SMichael Schmitz .start = ATARI_USB_IRQ,
72001a18d16SMichael Schmitz .end = ATARI_USB_IRQ,
72101a18d16SMichael Schmitz .flags = IORESOURCE_IRQ,
72201a18d16SMichael Schmitz },
72301a18d16SMichael Schmitz };
72401a18d16SMichael Schmitz
72501a18d16SMichael Schmitz /* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */
72601a18d16SMichael Schmitz static struct isp116x_platform_data isp1160_platform_data = {
72701a18d16SMichael Schmitz /* Enable internal resistors on downstream ports */
72801a18d16SMichael Schmitz .sel15Kres = 1,
72901a18d16SMichael Schmitz /* On-chip overcurrent protection */
73001a18d16SMichael Schmitz .oc_enable = 1,
73101a18d16SMichael Schmitz /* INT output polarity */
73201a18d16SMichael Schmitz .int_act_high = 1,
73301a18d16SMichael Schmitz /* INT edge or level triggered */
73401a18d16SMichael Schmitz .int_edge_triggered = 0,
73501a18d16SMichael Schmitz
73601a18d16SMichael Schmitz /* WAKEUP pin connected - NOT SUPPORTED */
73701a18d16SMichael Schmitz /* .remote_wakeup_connected = 0, */
73801a18d16SMichael Schmitz /* Wakeup by devices on usb bus enabled */
73901a18d16SMichael Schmitz .remote_wakeup_enable = 0,
74001a18d16SMichael Schmitz .delay = isp1160_delay,
74101a18d16SMichael Schmitz };
74201a18d16SMichael Schmitz
74301a18d16SMichael Schmitz static struct platform_device isp1160_device = {
74401a18d16SMichael Schmitz .name = "isp116x-hcd",
74501a18d16SMichael Schmitz .id = 0,
74601a18d16SMichael Schmitz .num_resources = ARRAY_SIZE(isp1160_resources),
74701a18d16SMichael Schmitz .resource = isp1160_resources,
74801a18d16SMichael Schmitz .dev = {
74901a18d16SMichael Schmitz .platform_data = &isp1160_platform_data,
75001a18d16SMichael Schmitz },
75101a18d16SMichael Schmitz };
75201a18d16SMichael Schmitz
753736b24dbSMichael Schmitz static struct platform_device *atari_ethernat_devices[] __initdata = {
75401a18d16SMichael Schmitz &smc91x_device,
75501a18d16SMichael Schmitz &isp1160_device
756736b24dbSMichael Schmitz };
757736b24dbSMichael Schmitz #endif /* CONFIG_ATARI_ETHERNAT */
758736b24dbSMichael Schmitz
7591d87a8f2SMichael Schmitz #ifdef CONFIG_ATARI_ETHERNEC
7601d87a8f2SMichael Schmitz /*
7611d87a8f2SMichael Schmitz * EtherNEC: RTL8019 (NE2000 compatible) Ethernet chipset,
7621d87a8f2SMichael Schmitz * handled by ne.c driver
7631d87a8f2SMichael Schmitz */
7641d87a8f2SMichael Schmitz
7651d87a8f2SMichael Schmitz #define ATARI_ETHERNEC_PHYS_ADDR 0xfffa0000
7661d87a8f2SMichael Schmitz #define ATARI_ETHERNEC_BASE 0x300
7671d87a8f2SMichael Schmitz #define ATARI_ETHERNEC_IRQ IRQ_MFP_TIMER1
7681d87a8f2SMichael Schmitz
7691d87a8f2SMichael Schmitz static struct resource rtl8019_resources[] = {
7701d87a8f2SMichael Schmitz [0] = {
7711d87a8f2SMichael Schmitz .name = "rtl8019-regs",
7721d87a8f2SMichael Schmitz .start = ATARI_ETHERNEC_BASE,
7731d87a8f2SMichael Schmitz .end = ATARI_ETHERNEC_BASE + 0x20 - 1,
7741d87a8f2SMichael Schmitz .flags = IORESOURCE_IO,
7751d87a8f2SMichael Schmitz },
7761d87a8f2SMichael Schmitz [1] = {
7771d87a8f2SMichael Schmitz .name = "rtl8019-irq",
7781d87a8f2SMichael Schmitz .start = ATARI_ETHERNEC_IRQ,
7791d87a8f2SMichael Schmitz .end = ATARI_ETHERNEC_IRQ,
7801d87a8f2SMichael Schmitz .flags = IORESOURCE_IRQ,
7811d87a8f2SMichael Schmitz },
7821d87a8f2SMichael Schmitz };
7831d87a8f2SMichael Schmitz
7841d87a8f2SMichael Schmitz static struct platform_device rtl8019_device = {
7851d87a8f2SMichael Schmitz .name = "ne",
7861d87a8f2SMichael Schmitz .id = -1,
7871d87a8f2SMichael Schmitz .num_resources = ARRAY_SIZE(rtl8019_resources),
7881d87a8f2SMichael Schmitz .resource = rtl8019_resources,
7891d87a8f2SMichael Schmitz };
7901d87a8f2SMichael Schmitz
79101a18d16SMichael Schmitz /*
79201a18d16SMichael Schmitz * NetUSBee: ISP1160 USB host adapter via ROM-port adapter
79301a18d16SMichael Schmitz */
79401a18d16SMichael Schmitz
79501a18d16SMichael Schmitz #define ATARI_NETUSBEE_PHYS_ADDR 0xfffa8000
79601a18d16SMichael Schmitz #define ATARI_NETUSBEE_BASE 0x340
79701a18d16SMichael Schmitz #define ATARI_NETUSBEE_IRQ IRQ_MFP_TIMER2
79801a18d16SMichael Schmitz
79901a18d16SMichael Schmitz static struct resource netusbee_resources[] = {
80001a18d16SMichael Schmitz [0] = {
80101a18d16SMichael Schmitz .name = "isp1160-data",
80201a18d16SMichael Schmitz .start = ATARI_NETUSBEE_BASE,
80301a18d16SMichael Schmitz .end = ATARI_NETUSBEE_BASE + 0x1,
80401a18d16SMichael Schmitz .flags = IORESOURCE_MEM,
80501a18d16SMichael Schmitz },
80601a18d16SMichael Schmitz [1] = {
80701a18d16SMichael Schmitz .name = "isp1160-regs",
80801a18d16SMichael Schmitz .start = ATARI_NETUSBEE_BASE + 0x20,
80901a18d16SMichael Schmitz .end = ATARI_NETUSBEE_BASE + 0x21,
81001a18d16SMichael Schmitz .flags = IORESOURCE_MEM,
81101a18d16SMichael Schmitz },
81201a18d16SMichael Schmitz [2] = {
81301a18d16SMichael Schmitz .name = "isp1160-irq",
81401a18d16SMichael Schmitz .start = ATARI_NETUSBEE_IRQ,
81501a18d16SMichael Schmitz .end = ATARI_NETUSBEE_IRQ,
81601a18d16SMichael Schmitz .flags = IORESOURCE_IRQ,
81701a18d16SMichael Schmitz },
81801a18d16SMichael Schmitz };
81901a18d16SMichael Schmitz
82001a18d16SMichael Schmitz /* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */
82101a18d16SMichael Schmitz static struct isp116x_platform_data netusbee_platform_data = {
82201a18d16SMichael Schmitz /* Enable internal resistors on downstream ports */
82301a18d16SMichael Schmitz .sel15Kres = 1,
82401a18d16SMichael Schmitz /* On-chip overcurrent protection */
82501a18d16SMichael Schmitz .oc_enable = 1,
82601a18d16SMichael Schmitz /* INT output polarity */
82701a18d16SMichael Schmitz .int_act_high = 1,
82801a18d16SMichael Schmitz /* INT edge or level triggered */
82901a18d16SMichael Schmitz .int_edge_triggered = 0,
83001a18d16SMichael Schmitz
83101a18d16SMichael Schmitz /* WAKEUP pin connected - NOT SUPPORTED */
83201a18d16SMichael Schmitz /* .remote_wakeup_connected = 0, */
83301a18d16SMichael Schmitz /* Wakeup by devices on usb bus enabled */
83401a18d16SMichael Schmitz .remote_wakeup_enable = 0,
83501a18d16SMichael Schmitz .delay = isp1160_delay,
83601a18d16SMichael Schmitz };
83701a18d16SMichael Schmitz
83801a18d16SMichael Schmitz static struct platform_device netusbee_device = {
83901a18d16SMichael Schmitz .name = "isp116x-hcd",
84001a18d16SMichael Schmitz .id = 1,
84101a18d16SMichael Schmitz .num_resources = ARRAY_SIZE(netusbee_resources),
84201a18d16SMichael Schmitz .resource = netusbee_resources,
84301a18d16SMichael Schmitz .dev = {
84401a18d16SMichael Schmitz .platform_data = &netusbee_platform_data,
84501a18d16SMichael Schmitz },
84601a18d16SMichael Schmitz };
84701a18d16SMichael Schmitz
84801a18d16SMichael Schmitz static struct platform_device *atari_netusbee_devices[] __initdata = {
84901a18d16SMichael Schmitz &rtl8019_device,
85001a18d16SMichael Schmitz &netusbee_device
8511d87a8f2SMichael Schmitz };
8521d87a8f2SMichael Schmitz #endif /* CONFIG_ATARI_ETHERNEC */
8531d87a8f2SMichael Schmitz
8542d522618SFinn Thain #if IS_ENABLED(CONFIG_ATARI_SCSI)
8553ff228afSFinn Thain static const struct resource atari_scsi_st_rsrc[] __initconst = {
8563ff228afSFinn Thain {
8573ff228afSFinn Thain .flags = IORESOURCE_IRQ,
8583ff228afSFinn Thain .start = IRQ_MFP_FSCSI,
8593ff228afSFinn Thain .end = IRQ_MFP_FSCSI,
8603ff228afSFinn Thain },
8613ff228afSFinn Thain };
8623ff228afSFinn Thain
8633ff228afSFinn Thain static const struct resource atari_scsi_tt_rsrc[] __initconst = {
8643ff228afSFinn Thain {
8653ff228afSFinn Thain .flags = IORESOURCE_IRQ,
8663ff228afSFinn Thain .start = IRQ_TT_MFP_SCSI,
8673ff228afSFinn Thain .end = IRQ_TT_MFP_SCSI,
8683ff228afSFinn Thain },
8693ff228afSFinn Thain };
8703ff228afSFinn Thain #endif
8713ff228afSFinn Thain
8725ed0794cSMichael Schmitz /*
8735ed0794cSMichael Schmitz * Falcon IDE interface
8745ed0794cSMichael Schmitz */
8755ed0794cSMichael Schmitz
8765ed0794cSMichael Schmitz #define FALCON_IDE_BASE 0xfff00000
8775ed0794cSMichael Schmitz
8785ed0794cSMichael Schmitz static const struct resource atari_falconide_rsrc[] __initconst = {
87944b1fbc0SFinn Thain DEFINE_RES_MEM(FALCON_IDE_BASE, 0x38),
88044b1fbc0SFinn Thain DEFINE_RES_MEM(FALCON_IDE_BASE + 0x38, 2),
8815ed0794cSMichael Schmitz };
8825ed0794cSMichael Schmitz
atari_platform_init(void)883736b24dbSMichael Schmitz int __init atari_platform_init(void)
884736b24dbSMichael Schmitz {
8855ed0794cSMichael Schmitz struct platform_device *pdev;
886736b24dbSMichael Schmitz int rv = 0;
887736b24dbSMichael Schmitz
888736b24dbSMichael Schmitz if (!MACH_IS_ATARI)
889736b24dbSMichael Schmitz return -ENODEV;
890736b24dbSMichael Schmitz
891736b24dbSMichael Schmitz #ifdef CONFIG_ATARI_ETHERNAT
892736b24dbSMichael Schmitz {
893736b24dbSMichael Schmitz unsigned char *enatc_virt;
894736b24dbSMichael Schmitz enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf);
895736b24dbSMichael Schmitz if (hwreg_present(enatc_virt)) {
896736b24dbSMichael Schmitz rv = platform_add_devices(atari_ethernat_devices,
897736b24dbSMichael Schmitz ARRAY_SIZE(atari_ethernat_devices));
898736b24dbSMichael Schmitz }
899736b24dbSMichael Schmitz iounmap(enatc_virt);
900736b24dbSMichael Schmitz }
901736b24dbSMichael Schmitz #endif
902736b24dbSMichael Schmitz
9031d87a8f2SMichael Schmitz #ifdef CONFIG_ATARI_ETHERNEC
9041d87a8f2SMichael Schmitz {
9051d87a8f2SMichael Schmitz int error;
9061d87a8f2SMichael Schmitz unsigned char *enec_virt;
9071d87a8f2SMichael Schmitz enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf);
9081d87a8f2SMichael Schmitz if (hwreg_present(enec_virt)) {
90901a18d16SMichael Schmitz error = platform_add_devices(atari_netusbee_devices,
91001a18d16SMichael Schmitz ARRAY_SIZE(atari_netusbee_devices));
9111d87a8f2SMichael Schmitz if (error && !rv)
9121d87a8f2SMichael Schmitz rv = error;
9131d87a8f2SMichael Schmitz }
9141d87a8f2SMichael Schmitz iounmap(enec_virt);
9151d87a8f2SMichael Schmitz }
9161d87a8f2SMichael Schmitz #endif
9171d87a8f2SMichael Schmitz
9182d522618SFinn Thain #if IS_ENABLED(CONFIG_ATARI_SCSI)
9193ff228afSFinn Thain if (ATARIHW_PRESENT(ST_SCSI))
9203ff228afSFinn Thain platform_device_register_simple("atari_scsi", -1,
9213ff228afSFinn Thain atari_scsi_st_rsrc, ARRAY_SIZE(atari_scsi_st_rsrc));
9223ff228afSFinn Thain else if (ATARIHW_PRESENT(TT_SCSI))
9233ff228afSFinn Thain platform_device_register_simple("atari_scsi", -1,
9243ff228afSFinn Thain atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));
9253ff228afSFinn Thain #endif
9263ff228afSFinn Thain
9275ed0794cSMichael Schmitz if (ATARIHW_PRESENT(IDE)) {
9285ed0794cSMichael Schmitz pdev = platform_device_register_simple("atari-falcon-ide", -1,
9295ed0794cSMichael Schmitz atari_falconide_rsrc, ARRAY_SIZE(atari_falconide_rsrc));
9305ed0794cSMichael Schmitz if (IS_ERR(pdev))
9315ed0794cSMichael Schmitz rv = PTR_ERR(pdev);
9325ed0794cSMichael Schmitz }
9335ed0794cSMichael Schmitz
934736b24dbSMichael Schmitz return rv;
935736b24dbSMichael Schmitz }
936736b24dbSMichael Schmitz
937736b24dbSMichael Schmitz arch_initcall(atari_platform_init);
938