patch-2.1.36 linux/arch/m68k/atari/config.c

Next file: linux/arch/m68k/atari/joystick.c
Previous file: linux/arch/m68k/atari/atari_ksyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.35/linux/arch/m68k/atari/config.c linux/arch/m68k/atari/config.c
@@ -45,9 +45,15 @@
 #include <asm/pgtable.h>
 #include <asm/machdep.h>
 
+#ifdef CONFIG_KGDB
+#include <asm/kgdb.h>
+#endif
+
 u_long atari_mch_cookie;
 struct atari_hw_present atari_hw_present;
 
+extern char m68k_debug_device[];
+
 static void atari_sched_init(void (*)(int, void *, struct pt_regs *));
 /* atari specific keyboard functions */
 extern int atari_keyb_init(void);
@@ -57,7 +63,7 @@
 extern void atari_init_IRQ (void);
 extern int atari_request_irq (unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
                               unsigned long flags, const char *devname, void *dev_id);
-extern int atari_free_irq (unsigned int irq, void *dev_id);
+extern void atari_free_irq (unsigned int irq, void *dev_id);
 extern void atari_enable_irq (unsigned int);
 extern void atari_disable_irq (unsigned int);
 extern int atari_get_irq_list (char *buf);
@@ -77,12 +83,17 @@
 extern int atari_floppy_init (void);
 extern void atari_floppy_setup(char *, int *);
 #endif
-static void atari_waitbut (void);
 extern struct consw fb_con;
 extern struct fb_info *atari_fb_init(long *);
-static void atari_debug_init (void);
+static void atari_debug_init(void);
 extern void atari_video_setup(char *, int *);
-extern void atari_syms_export(void);
+
+static struct console atari_console_driver;
+
+/* Can be set somewhere, if a SCC master reset has already be done and should
+ * not be repeated; used by kgdb */
+int atari_SCC_reset_done = 0;
+
 
 extern void (*kd_mksound)(unsigned int, unsigned int);
 
@@ -240,6 +251,8 @@
 {
     memset(&atari_hw_present, 0, sizeof(atari_hw_present));
 
+    atari_debug_init();
+
     mach_sched_init      = atari_sched_init;
     mach_keyb_init       = atari_keyb_init;
     mach_kbdrate         = atari_kbdrate;
@@ -247,25 +260,21 @@
     mach_init_IRQ        = atari_init_IRQ;
     mach_request_irq     = atari_request_irq;
     mach_free_irq        = atari_free_irq;
-    mach_enable_irq      = atari_enable_irq;
-    mach_disable_irq     = atari_disable_irq;
+    enable_irq           = atari_enable_irq;
+    disable_irq          = atari_disable_irq;
     mach_get_model	 = atari_get_model;
     mach_get_hardware_list = atari_get_hardware_list;
     mach_get_irq_list	 = atari_get_irq_list;
     mach_gettimeoffset   = atari_gettimeoffset;
-    mach_mksound         = atari_mksound;
     mach_reset           = atari_reset;
 #ifdef CONFIG_BLK_DEV_FD
     mach_floppy_init	 = atari_floppy_init;
     mach_floppy_setup	 = atari_floppy_setup;
 #endif
     conswitchp	         = &fb_con;
-    waitbut		 = atari_waitbut;
     mach_fb_init         = atari_fb_init;
     mach_max_dma_address = 0xffffff;
-    mach_debug_init	 = atari_debug_init;
     mach_video_setup	 = atari_video_setup;
-    mach_syms_export     = atari_syms_export;
     kd_mksound		 = atari_mksound;
 
     /* ++bjoern: 
@@ -273,7 +282,7 @@
      */
 
     printk( "Atari hardware found: " );
-    if (is_medusa) {
+    if (is_medusa || is_hades) {
         /* There's no Atari video hardware on the Medusa, but all the
          * addresses below generate a DTACK so no bus error occurs! */
     }
@@ -315,7 +324,7 @@
 	ATARIHW_SET(SCSI_DMA);
         printk( "TT_SCSI_DMA " );
     }
-    if (hwreg_present( &st_dma.dma_hi )) {
+    if (!is_hades && hwreg_present( &st_dma.dma_hi )) {
 	ATARIHW_SET(STND_DMA);
         printk( "STND_DMA " );
     }
@@ -337,21 +346,25 @@
 	ATARIHW_SET(YM_2149);
         printk( "YM2149 " );
     }
-    if (!is_medusa && hwreg_present( &tt_dmasnd.ctrl )) {
+    if (!is_medusa && !is_hades && hwreg_present( &tt_dmasnd.ctrl )) {
 	ATARIHW_SET(PCM_8BIT);
         printk( "PCM " );
     }
-    if (hwreg_present( (void *)(0xffff8940) )) {
+    if (!is_hades && hwreg_present( &codec.unused5 )) {
 	ATARIHW_SET(CODEC);
         printk( "CODEC " );
     }
+    if (hwreg_present( &dsp56k_host_interface.icr )) {
+	ATARIHW_SET(DSP56K);
+        printk( "DSP56K " );
+    }
     if (hwreg_present( &tt_scc_dma.dma_ctrl ) &&
 #if 0
 	/* This test sucks! Who knows some better? */
 	(tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) &&
 	(tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0)
 #else
-	!is_medusa
+	!is_medusa && !is_hades
 #endif
 	) {
 	ATARIHW_SET(SCC_DMA);
@@ -365,7 +378,12 @@
 	ATARIHW_SET( ST_ESCC );
 	printk( "ST_ESCC " );
     }
-    if (hwreg_present( &tt_scu.sys_mask )) {
+    if (is_hades)
+    {
+        ATARIHW_SET( VME );
+        printk( "VME " );
+    }
+    else if (hwreg_present( &tt_scu.sys_mask )) {
 	ATARIHW_SET(SCU);
 	/* Assume a VME bus if there's a SCU */
 	ATARIHW_SET( VME );
@@ -375,7 +393,7 @@
 	ATARIHW_SET(ANALOG_JOY);
         printk( "ANALOG_JOY " );
     }
-    if (hwreg_present( blitter.halftone )) {
+    if (!is_hades && hwreg_present( blitter.halftone )) {
 	ATARIHW_SET(BLITTER);
         printk( "BLITTER " );
     }
@@ -384,7 +402,7 @@
         printk( "IDE " );
     }
 #if 1 /* This maybe wrong */
-    if (!is_medusa &&
+    if (!is_medusa && !is_hades &&
 	hwreg_present( &tt_microwire.data ) &&
 	hwreg_present( &tt_microwire.mask ) &&
 	(tt_microwire.mask = 0x7ff,
@@ -402,20 +420,20 @@
         mach_hwclk = atari_hwclk;
         mach_set_clock_mmss = atari_set_clock_mmss;
     }
-    if (hwreg_present( &mste_rtc.sec_ones)) {
+    if (!is_hades && hwreg_present( &mste_rtc.sec_ones)) {
 	ATARIHW_SET(MSTE_CLK);
         printk( "MSTE_CLK ");
         mach_gettod = atari_mste_gettod;
         mach_hwclk = atari_mste_hwclk;
         mach_set_clock_mmss = atari_mste_set_clock_mmss;
     }
-    if (!is_medusa &&
+    if (!is_medusa && !is_hades &&
 	hwreg_present( &dma_wd.fdc_speed ) &&
 	hwreg_write( &dma_wd.fdc_speed, 0 )) {
 	    ATARIHW_SET(FDCSPEED);
 	    printk( "FDC_SPEED ");
     }
-    if (!ATARIHW_PRESENT(ST_SCSI)) {
+    if (!is_hades && !ATARIHW_PRESENT(ST_SCSI)) {
 	ATARIHW_SET(ACSI);
         printk( "ACSI " );
     }
@@ -426,9 +444,11 @@
          * translation (the one that must not be turned off in
          * head.S...)
          */
-        __asm__ volatile ("moveq #0,%/d0;"
-                          ".long 0x4e7b0004;"	/* movec d0,itt0 */
-                          ".long 0x4e7b0006;"	/* movec d0,dtt0 */
+        __asm__ volatile ("moveq #0,%/d0\n\t"
+                          ".chip 68040\n\t"
+			  "movec %%d0,%%itt0\n\t"
+			  "movec %%d0,%%dtt0\n\t"
+			  ".chip 68k"
 						  : /* no outputs */
 						  : /* no inputs */
 						  : "d0");
@@ -452,13 +472,18 @@
         tt1_val = 0xfe008543;	/* Translate 0xfexxxxxx, enable, cache
                                  * inhibit, read and write, FDC mask = 3,
                                  * FDC val = 4 -> Supervisor only */
-        __asm__ __volatile__ ( "pmove	%0@,%/tt1" : : "a" (&tt1_val) );
+        __asm__ __volatile__ ( ".chip 68030\n\t"
+				"pmove	%0@,%/tt1\n\t"
+				".chip 68k"
+				: : "a" (&tt1_val) );
     }
     else {
         __asm__ __volatile__
             ( "movel %0,%/d0\n\t"
-              ".long 0x4e7b0005\n\t"	/* movec d0,itt1 */
-              ".long 0x4e7b0007"	/* movec d0,dtt1 */
+	      ".chip 68040\n\t"
+	      "movec %%d0,%%itt1\n\t"
+	      "movec %%d0,%%dtt1\n\t"
+	      ".chip 68k"
               :
               : "g" (0xfe00a040)	/* Translate 0xfexxxxxx, enable,
                                          * supervisor only, non-cacheable/
@@ -621,7 +646,7 @@
        we use the fact that in head.S we have set up a mapping
        0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
        in the last 16MB of the address space. */
-    tos_version = is_medusa ? 0xfff : *(unsigned short *)0xFF000002;
+    tos_version = (is_medusa || is_hades) ? 0xfff : *(unsigned short *)0xFF000002;
     *yearp += (tos_version < 0x306) ? 70 : 68;
 }
 
@@ -696,7 +721,7 @@
 
     /* Tos version at Physical 2.  See above for explanation why we
        cannot use PTOV(2).  */
-    tos_version = is_medusa ? 0xfff : *(unsigned short *)0xff000002;
+    tos_version = (is_medusa || is_hades) ? 0xfff : *(unsigned short *)0xff000002;
 
     ctrl = RTC_READ(RTC_CONTROL); /* control registers are
                                    * independent from the UIP */
@@ -875,13 +900,6 @@
     return retval;
 }
 
-
-static void atari_waitbut (void)
-{
-    /* sorry, no-op */
-}
-
-
 static inline void ata_mfp_out (char c)
 {
     while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */
@@ -889,12 +907,12 @@
     mfp.usart_dta = c;
 }
 
-void ata_mfp_print (const char *str)
+static void atari_mfp_console_write (const char *str, unsigned int count)
 {
-    for( ; *str; ++str ) {
+    while (count--) {
 	if (*str == '\n')
 	    ata_mfp_out( '\r' );
-	ata_mfp_out( *str );
+	ata_mfp_out( *str++ );
     }
 }
 
@@ -907,12 +925,12 @@
     scc.cha_b_data = c;
 }
 
-void ata_scc_print (const char *str)
+static void atari_scc_console_write (const char *str, unsigned int count)
 {
-    for( ; *str; ++str ) {
+    while (count--) {
 	if (*str == '\n')
 	    ata_scc_out( '\r' );
-	ata_scc_out( *str );
+	ata_scc_out( *str++ );
     }
 }
 
@@ -937,20 +955,20 @@
     return( 1 );
 }
 
-void ata_par_print (const char *str)
+static void atari_par_console_write (const char *str, unsigned int count)
 {
     static int printer_present = 1;
 
     if (!printer_present)
 	return;
 
-    for( ; *str; ++str ) {
+    while (count--) {
 	if (*str == '\n')
 	    if (!ata_par_out( '\r' )) {
 		printer_present = 0;
 		return;
 	    }
-	if (!ata_par_out( *str )) {
+	if (!ata_par_out( *str++ )) {
 	    printer_present = 0;
 	    return;
 	}
@@ -958,11 +976,14 @@
 }
 
 
-static void atari_debug_init( void )
+static void atari_debug_init(void)
 {
-    extern void (*debug_print_proc)(const char *);
-    extern char m68k_debug_device[];
-    
+#ifdef CONFIG_KGDB
+	/* if the m68k_debug_device is used by the GDB stub, do nothing here */
+	if (kgdb_initialized)
+		return(NULL);
+#endif
+
     if (!strcmp( m68k_debug_device, "ser" )) {
 	/* defaults to ser2 for a Falcon and ser1 otherwise */
 	strcpy( m68k_debug_device, 
@@ -979,7 +1000,7 @@
 	mfp.tim_dt_d   = 2;     /* 9600 bps */
 	mfp.tim_ct_cd |= 0x01;  /* start timer D, 1:4 */
 	mfp.trn_stat  |= 0x01;  /* enable TX */
-	debug_print_proc = ata_mfp_print;
+	atari_console_driver.write = atari_mfp_console_write;
     }
     else if (!strcmp( m68k_debug_device, "ser2" )) {
 	/* SCC Modem2 serial port */
@@ -1005,7 +1026,7 @@
 	    scc.cha_b_ctrl = *p++;
 	    MFPDELAY();
 	}
-	debug_print_proc = ata_scc_print;
+	atari_console_driver.write = atari_scc_console_write;
     }
     else if (!strcmp( m68k_debug_device, "par" )) {
 	/* parallel printer */
@@ -1016,29 +1037,10 @@
 	sound_ym.wd_data = 0;          /* no char */
 	sound_ym.rd_data_reg_sel = 14; /* select port A */
 	sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */
-	debug_print_proc = ata_par_print;
-    }
-    else
-	debug_print_proc = NULL;
-}
-
-
-void ata_serial_print (const char *str)
-{
-  int c;
-
-  while (c = *str++, c != 0)
-    {
-      if (c == '\n')
-	{
-	  while (!(mfp.trn_stat & (1 << 7)))
-	    barrier ();
-	  mfp.usart_dta = '\r';
-	}
-      while (!(mfp.trn_stat & (1 << 7)))
-	barrier ();
-      mfp.usart_dta = c;
+	atari_console_driver.write = atari_par_console_write;
     }
+    if (atari_console_driver.write)
+	register_console(&atari_console_driver);
 }
 
 /* ++roman:
@@ -1079,7 +1081,8 @@
 
     /* On the Medusa, phys. 0x4 may contain garbage because it's no
        ROM.  See above for explanation why we cannot use PTOV(4). */
-    reset_addr = is_medusa ? 0xe00030 : *(unsigned long *) 0xff000004;
+    reset_addr = is_hades ? 0x7fe00030 :
+                 (is_medusa ? 0xe00030 : *(unsigned long *) 0xff000004);
 
     acia.key_ctrl = ACIA_RESET;             /* reset ACIA for switch off OverScan, if it's active */
 
@@ -1159,6 +1162,8 @@
 	    if (is_medusa)
 		/* Medusa has TT _MCH cookie */
 		strcat (model, "Medusa");
+	    else if (is_hades)
+		strcat(model, "Hades");
 	    else
 		strcat (model, "TT");
 	    break;
@@ -1215,6 +1220,7 @@
     ATARIHW_ANNOUNCE(SCU, "System Control Unit");
     ATARIHW_ANNOUNCE(BLITTER, "Blitter");
     ATARIHW_ANNOUNCE(VME, "VME Bus");
+    ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor");
 
     return(len);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov