Resent-Date: Wed, 23 Sep 1998 00:32:10 +0200 (MET DST)
Sender: bharries@vossnet.de
Date: Wed, 23 Sep 1998 00:25:02 +0200
From: Bernd Harries <bha@gmx.de>
Organization: BHA Industries
To: linux-m68k@lists.linux-m68k.org
Subject: atyfb.c 2.1.120 patch Part 2 (summary diff follows)
References: <199809211322.JAA11190@hades.dmi.stevens-tech.edu>
Resent-From: linux-m68k@phil.uni-sb.de

Hi Dudes,

I improved the patch for the atyfb driver a bit:

It should now automatically calculate the clk_wr_offset.
This will however only be sufficient for ATI18818 == ICS2595
Clockchips. I need the numbers on the chips for now.

ABCDFJLMN
Linux version 2.1.120 (root@dose1) (gcc version 2.7.2.3) #8 Wed Sep 23
00:13:55 MEST 1998
Atari hardware found: ST_MFP TT_MFP TT_SCSI_DMA STND_DMA EXTD_DMA
TT_SCSI YM2149 CODEC SCC VME SCU IDE TT_CLK ACSI 
store_video_par() '0x7f400000;0x00400000;0x7F0B0000;accel' 
 stored them all: $7F400000 $00400000 $7F0B0000 
Console: colour dummy device 80x25
Calibrating delay loop... 19.92 BogoMIPS
Memory: 63220k/65536k available (1028k kernel code, 1232k data, 56k
init)
kmem_create: Forcing size word alignment - vm_area_struct
kmem_create: Forcing size word alignment - filp
POSIX conformance testing by UNIFIX
Swansea University Computer Society NET3.039 for Linux 2.1
kmem_create: Forcing size word alignment - skbuff_head_cache
NET3: Unix domain sockets 0.16 for Linux NET3.038.
Swansea University Computer Society TCP/IP for NET3.037
IP Protocols: ICMP, UDP, TCP, IGMP
IPv6 v0.2 for NET3.037
IPv6 over IPv4 tunneling driver
early initialization of device sit0 is deferred
Starting kswapd v 1.5 
atyfb: mach64GX (ATI888GX00) [0x00D7 rev 0x01] 4M 135 MHz PLL, 50 Mhz
MCLK
 aty_init: regbase=$D043FC00, frame_buffer=$D0000000,
total_vram=$003FF000
 types: bus=$00 dac=$05 ram=$05 clk=$01? wr_offset=$02 
 aty_set_dac_DAC_ATI68860_B() bpp=$08 
 aty_set_dac_DAC_ATI68860_B() bpp=$08 
Console: switching to colour frame buffer device 80x30
fb0: ATY Mach64 frame buffer device on ISA bus
pty: 256 Unix98 ptys configured
Atari mouse installed.


--- drivers/video/atyfb.c_21120bha	Sat Sep 19 19:20:25 1998
+++ drivers/video/atyfb.c	Wed Sep 23 00:12:56 1998
@@ -2870,11 +2870,12 @@
     info->ati_regbase,
     info->frame_buffer,
     info->total_vram);
-  printk(" types: bus=$%02X dac=$%02X clk=$%02X ram=$%02X\n",
+  printk(" types: bus=$%02X dac=$%02X ram=$%02X clk=$%02X? wr_offset=$%02lX \n",
     info->bus_type,
     info->dac_type,
+    info->ram_type,
     info->clk_type,
-    info->ram_type);
+    info->clk_wr_offset);
 #endif
 
     }
@@ -2958,16 +2959,21 @@
 	   GET_FB_IDX(info->fb_info.node), atyfb_name, name);
     return 1;
 }
+/*endproc aty_init()*/
+
 
 __initfunc(void atyfb_init(void))
 {
+
 #if defined(CONFIG_FB_OF)
     /* We don't want to be called like this. */
     /* We rely on Open Firmware (offb) instead. */
+
 #elif defined(CONFIG_PCI)
     struct pci_dev *pdev;
     struct fb_info_aty *info;
     unsigned long addr;
+
 #ifdef __sparc__
     extern int con_is_present(void);
     struct pcidev_cookie *pcp;
@@ -3194,9 +3200,11 @@
 #endif /* __sparc__ */
 	}
     }
+
 #elif defined(CONFIG_ATARI)
-    int m64_num;
-    struct fb_info_aty *info;
+  u32   clock_r;
+  int   m64_num;
+  struct fb_info_aty *info;
 
     for (m64_num = 0; m64_num < mach64_count; m64_num++) {
 	if (!phys_vmembase[m64_num] || !phys_size[m64_num] ||
@@ -3224,14 +3232,34 @@
 	info->ati_regbase = kernel_map(phys_guiregbase[m64_num], 0x10000,
 				       KERNELMAP_NOCACHE_SER, NULL)+0xFC00ul;
 	info->ati_regbase_phys = info->ati_regbase;  /* Fake! */
-        if((phys_guiregbase[m64_num] & 0xFF000000) == 0x7F000000)
-        {
-          info->clk_wr_offset = 2;  /* Medusa ST-IO ISA Adapter */
-        }
-        else
+
+        aty_st_le32(CLOCK_CNTL, 0x12345678, info);
+        clock_r = aty_ld_le32(CLOCK_CNTL, info);
+
+        switch(clock_r & 0x003F)
         {
-          info->clk_wr_offset = 0;  /* other Atari ISA Adapters */
+          case 0x12:
+          {
+            info->clk_wr_offset = 3;  /*  */
+            break;
+          }
+          case 0x34:
+          {
+            info->clk_wr_offset = 2;  /* Medusa ST-IO ISA Adapter etc. */
+            break;
+          }
+          case 0x16:
+          {
+            info->clk_wr_offset = 1;  /*  */
+            break;
+          }
+          case 0x38:
+          {
+            info->clk_wr_offset = 0;  /* Panther 1 ISA Adapter (Gerald) */
+            break;
+          }
         }
+        /*endswitch*/
 
 	if (!aty_init(info, "ISA bus")) {
 	    kfree(info);
@@ -3239,8 +3267,10 @@
 	    return;
 	}
     }
-#endif
+#endif  /* defined(CONFIG_ATARI) */
+
 }
+/*endproc atyfb_init()*/
 
 #ifdef CONFIG_FB_OF
 __initfunc(void atyfb_of_init(struct device_node *dp))


-- 
Bernd Harries

bha@gmx.de            http://www.freeyellow.com/members/bharries
bharries@vossnet.de    Tel. +49 421 809 7351 priv.  | MSB First!
harries@stn-atlas.de        +49 421 457 3966 offi.  | Linux-m68k
bernd@linux-m68k.org                                | Medusa T40
           <>_<>      _______                _____
       .---|'"`|---. |  |_|  |_|_|_|_|_|_|_ (_____)  .-----.
______`o"O-OO-OO-O"o'`-o---o-'`-oo-----oo-'`-o---o-'`-o---o-'___

