~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/drivers/video/cgsixfb.c

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* $Id: cgsixfb.c,v 1.23 2000/07/26 23:02:51 davem Exp $
  2  * cgsixfb.c: CGsix (GX,GXplus) frame buffer driver
  3  *
  4  * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz)
  5  * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
  6  * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
  7  */
  8 
  9 #include <linux/module.h>
 10 #include <linux/sched.h>
 11 #include <linux/kernel.h>
 12 #include <linux/errno.h>
 13 #include <linux/string.h>
 14 #include <linux/mm.h>
 15 #include <linux/tty.h>
 16 #include <linux/malloc.h>
 17 #include <linux/vmalloc.h>
 18 #include <linux/delay.h>
 19 #include <linux/interrupt.h>
 20 #include <linux/fb.h>
 21 #include <linux/init.h>
 22 #include <linux/selection.h>
 23 
 24 #include <video/sbusfb.h>
 25 #include <asm/io.h>
 26 
 27 /* Offset of interesting structures in the OBIO space */
 28 /*
 29  * Brooktree is the video dac and is funny to program on the cg6.
 30  * (it's even funnier on the cg3)
 31  * The FBC could be the frame buffer control
 32  * The FHC could is the frame buffer hardware control.
 33  */
 34 #define CG6_ROM_OFFSET       0x0UL
 35 #define CG6_BROOKTREE_OFFSET 0x200000UL
 36 #define CG6_DHC_OFFSET       0x240000UL
 37 #define CG6_ALT_OFFSET       0x280000UL
 38 #define CG6_FHC_OFFSET       0x300000UL
 39 #define CG6_THC_OFFSET       0x301000UL
 40 #define CG6_FBC_OFFSET       0x700000UL
 41 #define CG6_TEC_OFFSET       0x701000UL
 42 #define CG6_RAM_OFFSET       0x800000UL
 43 
 44 /* FHC definitions */
 45 #define CG6_FHC_FBID_SHIFT           24
 46 #define CG6_FHC_FBID_MASK            255
 47 #define CG6_FHC_REV_SHIFT            20
 48 #define CG6_FHC_REV_MASK             15
 49 #define CG6_FHC_FROP_DISABLE         (1 << 19)
 50 #define CG6_FHC_ROW_DISABLE          (1 << 18)
 51 #define CG6_FHC_SRC_DISABLE          (1 << 17)
 52 #define CG6_FHC_DST_DISABLE          (1 << 16)
 53 #define CG6_FHC_RESET                (1 << 15)
 54 #define CG6_FHC_LITTLE_ENDIAN        (1 << 13)
 55 #define CG6_FHC_RES_MASK             (3 << 11)
 56 #define CG6_FHC_1024                 (0 << 11)
 57 #define CG6_FHC_1152                 (1 << 11)
 58 #define CG6_FHC_1280                 (2 << 11)
 59 #define CG6_FHC_1600                 (3 << 11)
 60 #define CG6_FHC_CPU_MASK             (3 << 9)
 61 #define CG6_FHC_CPU_SPARC            (0 << 9)
 62 #define CG6_FHC_CPU_68020            (1 << 9)
 63 #define CG6_FHC_CPU_386              (2 << 9)
 64 #define CG6_FHC_TEST                 (1 << 8)
 65 #define CG6_FHC_TEST_X_SHIFT         4
 66 #define CG6_FHC_TEST_X_MASK          15
 67 #define CG6_FHC_TEST_Y_SHIFT         0
 68 #define CG6_FHC_TEST_Y_MASK          15
 69 
 70 /* FBC mode definitions */
 71 #define CG6_FBC_BLIT_IGNORE             0x00000000
 72 #define CG6_FBC_BLIT_NOSRC              0x00100000
 73 #define CG6_FBC_BLIT_SRC                0x00200000
 74 #define CG6_FBC_BLIT_ILLEGAL            0x00300000
 75 #define CG6_FBC_BLIT_MASK               0x00300000
 76 
 77 #define CG6_FBC_VBLANK                  0x00080000
 78 
 79 #define CG6_FBC_MODE_IGNORE             0x00000000
 80 #define CG6_FBC_MODE_COLOR8             0x00020000
 81 #define CG6_FBC_MODE_COLOR1             0x00040000
 82 #define CG6_FBC_MODE_HRMONO             0x00060000
 83 #define CG6_FBC_MODE_MASK               0x00060000
 84 
 85 #define CG6_FBC_DRAW_IGNORE             0x00000000
 86 #define CG6_FBC_DRAW_RENDER             0x00008000
 87 #define CG6_FBC_DRAW_PICK               0x00010000
 88 #define CG6_FBC_DRAW_ILLEGAL            0x00018000
 89 #define CG6_FBC_DRAW_MASK               0x00018000
 90 
 91 #define CG6_FBC_BWRITE0_IGNORE          0x00000000
 92 #define CG6_FBC_BWRITE0_ENABLE          0x00002000
 93 #define CG6_FBC_BWRITE0_DISABLE         0x00004000
 94 #define CG6_FBC_BWRITE0_ILLEGAL         0x00006000
 95 #define CG6_FBC_BWRITE0_MASK            0x00006000
 96 
 97 #define CG6_FBC_BWRITE1_IGNORE          0x00000000
 98 #define CG6_FBC_BWRITE1_ENABLE          0x00000800
 99 #define CG6_FBC_BWRITE1_DISABLE         0x00001000
100 #define CG6_FBC_BWRITE1_ILLEGAL         0x00001800
101 #define CG6_FBC_BWRITE1_MASK            0x00001800
102 
103 #define CG6_FBC_BREAD_IGNORE            0x00000000
104 #define CG6_FBC_BREAD_0                 0x00000200
105 #define CG6_FBC_BREAD_1                 0x00000400
106 #define CG6_FBC_BREAD_ILLEGAL           0x00000600
107 #define CG6_FBC_BREAD_MASK              0x00000600
108 
109 #define CG6_FBC_BDISP_IGNORE            0x00000000
110 #define CG6_FBC_BDISP_0                 0x00000080
111 #define CG6_FBC_BDISP_1                 0x00000100
112 #define CG6_FBC_BDISP_ILLEGAL           0x00000180
113 #define CG6_FBC_BDISP_MASK              0x00000180
114 
115 #define CG6_FBC_INDEX_MOD               0x00000040
116 #define CG6_FBC_INDEX_MASK              0x00000030
117 
118 /* THC definitions */
119 #define CG6_THC_MISC_REV_SHIFT       16
120 #define CG6_THC_MISC_REV_MASK        15
121 #define CG6_THC_MISC_RESET           (1 << 12)
122 #define CG6_THC_MISC_VIDEO           (1 << 10)
123 #define CG6_THC_MISC_SYNC            (1 << 9)
124 #define CG6_THC_MISC_VSYNC           (1 << 8)
125 #define CG6_THC_MISC_SYNC_ENAB       (1 << 7)
126 #define CG6_THC_MISC_CURS_RES        (1 << 6)
127 #define CG6_THC_MISC_INT_ENAB        (1 << 5)
128 #define CG6_THC_MISC_INT             (1 << 4)
129 #define CG6_THC_MISC_INIT            0x9f
130 
131 /* The contents are unknown */
132 struct cg6_tec {
133         volatile int tec_matrix;
134         volatile int tec_clip;
135         volatile int tec_vdc;
136 };
137 
138 struct cg6_thc {
139         uint thc_pad0[512];
140         volatile uint thc_hs;           /* hsync timing */
141         volatile uint thc_hsdvs;
142         volatile uint thc_hd;
143         volatile uint thc_vs;           /* vsync timing */
144         volatile uint thc_vd;
145         volatile uint thc_refresh;
146         volatile uint thc_misc;
147         uint thc_pad1[56];
148         volatile uint thc_cursxy;       /* cursor x,y position (16 bits each) */
149         volatile uint thc_cursmask[32]; /* cursor mask bits */
150         volatile uint thc_cursbits[32]; /* what to show where mask enabled */