Subject: Workaround for /dev/grf3 pixel clock only <29Mhz problem.
To: None <port-amiga@netbsd.org>
From: Petri Koistinen <petri.koistinen@iki.fi>
List: port-amiga
Date: 12/27/2000 20:13:02
Hi!

I found a workaround for the problem with /dev/grf3 that text console
pixel clock could be only under 29Mhz.

Below there is a patch, maybe it could be integrated in the source
tree. It is not complete solution, it just makes it work for me. 
I donīt know if that 58Mhz limit is smart thing, itīs just invented
value.

Are text console modes real hardware text modes, or are they graphics
modes with bitmapped fonts copied on screen. It would explain a lot.

Those who are interessed about Cirrus Logic 5446 databook may look at:
http://iki.fi/thoron/amiga/gd5446trm.lha (pdf, package about 2,3MB).
See page 8-44 (p. 265 in pdf file).

Happy New Year!
Petri Koistinen

--- /sys/arch/amiga/dev/grf_cl.c,old    Wed Dec 20 23:58:03 2000
+++ /sys/arch/amiga/dev/grf_cl.c    Wed Dec 27 17:08:45 2000
@@ -1657,11 +1657,31 @@
         WCrt(ba, CRT_ID_SYNC_ADJ_GENLOCK, 0x00);
         WCrt(ba, CRT_ID_OVERLAY_EXT_CTRL_REG, 0x40);
     }
-    WCrt(ba, CRT_ID_EXT_DISP_CNTL,
-        ((TEXT && gv->pixel_clock > 29000000) ? 0x40 : 0x00) |
-        0x22 |
-        ((HDE > 0xff) ? 0x10 : 0x00));
 
+    /*
+     * Following code tries set fast-page mode after pixel clock
+     * goes over limit. This doesn't work for PicassoIV. Althought
+     * Cirrus Logic claims that 5446 chip can only handle text modes
+     * up to 30Mhz pixel clock, PicassoIV seems to working still with
+     * pixel clock around 58Mhz. After that code will try change to
+     * fast-page mode, but it will fail because there is something
+     * wrong with that code below. (Petri Koistinen, 27.12.2000)
+     *
+     */
+     
+    if ((cltype == PICASSO) && (cl_64bit == 1)) { /* Tested on PIV only. */
+        WCrt(ba, CRT_ID_EXT_DISP_CNTL,
+            ((TEXT && gv->pixel_clock > 58000000) ? 0x40 : 0x00) |
+              0x22 |
+               ((HDE > 0xff) ? 0x10 : 0x00));
+    } 
+    else { /* Other cards may work with original code. */
+        WCrt(ba, CRT_ID_EXT_DISP_CNTL,
+            ((TEXT && gv->pixel_clock > 29000000) ? 0x40 : 0x00) |
+              0x22 |
+               ((HDE > 0xff) ? 0x10 : 0x00));
+    }
+    
     WAttr(ba, ACT_ID_ATTR_MODE_CNTL, (TEXT ? 0x0a : 0x01));
     WAttr(ba, 0x20 | ACT_ID_COLOR_PLANE_ENA,
         (gv->depth == 1) ? 0x01 : 0x0f);