11 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/errno.h>
14 #include <linux/string.h>
30 static int cg6_setcolreg(
unsigned,
unsigned,
unsigned,
unsigned,
32 static int cg6_blank(
int,
struct fb_info *);
37 static int cg6_sync(
struct fb_info *);
39 static int cg6_ioctl(
struct fb_info *,
unsigned int,
unsigned long);
46 static struct fb_ops cg6_ops = {
48 .fb_setcolreg = cg6_setcolreg,
49 .fb_blank = cg6_blank,
50 .fb_pan_display = cg6_pan_display,
51 .fb_fillrect = cg6_fillrect,
52 .fb_copyarea = cg6_copyarea,
53 .fb_imageblit = cg6_imageblit,
56 .fb_ioctl = cg6_ioctl,
69 #define CG6_ROM_OFFSET 0x0UL
70 #define CG6_BROOKTREE_OFFSET 0x200000UL
71 #define CG6_DHC_OFFSET 0x240000UL
72 #define CG6_ALT_OFFSET 0x280000UL
73 #define CG6_FHC_OFFSET 0x300000UL
74 #define CG6_THC_OFFSET 0x301000UL
75 #define CG6_FBC_OFFSET 0x700000UL
76 #define CG6_TEC_OFFSET 0x701000UL
77 #define CG6_RAM_OFFSET 0x800000UL
80 #define CG6_FHC_FBID_SHIFT 24
81 #define CG6_FHC_FBID_MASK 255
82 #define CG6_FHC_REV_SHIFT 20
83 #define CG6_FHC_REV_MASK 15
84 #define CG6_FHC_FROP_DISABLE (1 << 19)
85 #define CG6_FHC_ROW_DISABLE (1 << 18)
86 #define CG6_FHC_SRC_DISABLE (1 << 17)
87 #define CG6_FHC_DST_DISABLE (1 << 16)
88 #define CG6_FHC_RESET (1 << 15)
89 #define CG6_FHC_LITTLE_ENDIAN (1 << 13)
90 #define CG6_FHC_RES_MASK (3 << 11)
91 #define CG6_FHC_1024 (0 << 11)
92 #define CG6_FHC_1152 (1 << 11)
93 #define CG6_FHC_1280 (2 << 11)
94 #define CG6_FHC_1600 (3 << 11)
95 #define CG6_FHC_CPU_MASK (3 << 9)
96 #define CG6_FHC_CPU_SPARC (0 << 9)
97 #define CG6_FHC_CPU_68020 (1 << 9)
98 #define CG6_FHC_CPU_386 (2 << 9)
99 #define CG6_FHC_TEST (1 << 8)
100 #define CG6_FHC_TEST_X_SHIFT 4
101 #define CG6_FHC_TEST_X_MASK 15
102 #define CG6_FHC_TEST_Y_SHIFT 0
103 #define CG6_FHC_TEST_Y_MASK 15
106 #define CG6_FBC_BLIT_IGNORE 0x00000000
107 #define CG6_FBC_BLIT_NOSRC 0x00100000
108 #define CG6_FBC_BLIT_SRC 0x00200000
109 #define CG6_FBC_BLIT_ILLEGAL 0x00300000
110 #define CG6_FBC_BLIT_MASK 0x00300000
112 #define CG6_FBC_VBLANK 0x00080000
114 #define CG6_FBC_MODE_IGNORE 0x00000000
115 #define CG6_FBC_MODE_COLOR8 0x00020000
116 #define CG6_FBC_MODE_COLOR1 0x00040000
117 #define CG6_FBC_MODE_HRMONO 0x00060000
118 #define CG6_FBC_MODE_MASK 0x00060000
120 #define CG6_FBC_DRAW_IGNORE 0x00000000
121 #define CG6_FBC_DRAW_RENDER 0x00008000
122 #define CG6_FBC_DRAW_PICK 0x00010000
123 #define CG6_FBC_DRAW_ILLEGAL 0x00018000
124 #define CG6_FBC_DRAW_MASK 0x00018000
126 #define CG6_FBC_BWRITE0_IGNORE 0x00000000
127 #define CG6_FBC_BWRITE0_ENABLE 0x00002000
128 #define CG6_FBC_BWRITE0_DISABLE 0x00004000
129 #define CG6_FBC_BWRITE0_ILLEGAL 0x00006000
130 #define CG6_FBC_BWRITE0_MASK 0x00006000
132 #define CG6_FBC_BWRITE1_IGNORE 0x00000000
133 #define CG6_FBC_BWRITE1_ENABLE 0x00000800
134 #define CG6_FBC_BWRITE1_DISABLE 0x00001000
135 #define CG6_FBC_BWRITE1_ILLEGAL 0x00001800
136 #define CG6_FBC_BWRITE1_MASK 0x00001800
138 #define CG6_FBC_BREAD_IGNORE 0x00000000
139 #define CG6_FBC_BREAD_0 0x00000200
140 #define CG6_FBC_BREAD_1 0x00000400
141 #define CG6_FBC_BREAD_ILLEGAL 0x00000600
142 #define CG6_FBC_BREAD_MASK 0x00000600
144 #define CG6_FBC_BDISP_IGNORE 0x00000000
145 #define CG6_FBC_BDISP_0 0x00000080
146 #define CG6_FBC_BDISP_1 0x00000100
147 #define CG6_FBC_BDISP_ILLEGAL 0x00000180
148 #define CG6_FBC_BDISP_MASK 0x00000180
150 #define CG6_FBC_INDEX_MOD 0x00000040
151 #define CG6_FBC_INDEX_MASK 0x00000030
154 #define CG6_THC_MISC_REV_SHIFT 16
155 #define CG6_THC_MISC_REV_MASK 15
156 #define CG6_THC_MISC_RESET (1 << 12)
157 #define CG6_THC_MISC_VIDEO (1 << 10)
158 #define CG6_THC_MISC_SYNC (1 << 9)
159 #define CG6_THC_MISC_VSYNC (1 << 8)
160 #define CG6_THC_MISC_SYNC_ENAB (1 << 7)
161 #define CG6_THC_MISC_CURS_RES (1 << 6)
162 #define CG6_THC_MISC_INT_ENAB (1 << 5)
163 #define CG6_THC_MISC_INT (1 << 4)
164 #define CG6_THC_MISC_INIT 0x9f
165 #define CG6_THC_CURSOFF ((65536-32) | ((65536-32) << 16))
263 #define CG6_FLAG_BLANKED 0x00000001
278 }
while (--
limit > 0);
283 static void cg6_switch_from_graph(
struct cg6_par *par)
293 spin_unlock_irqrestore(&par->
lock, flags);
303 cg6_switch_from_graph(par);
341 }
while (
val < 0 && (
val & 0x20000000));
342 spin_unlock_irqrestore(&par->
lock,
flags);
383 }
while (
i < 0 && (
i & 0x20000000));
384 spin_unlock_irqrestore(&par->
lock,
flags);
424 for (i = 0; i < image->
height; i++) {
427 while (
width >= 32) {
453 }
else if (
width <= 16) {
470 spin_unlock_irqrestore(&par->
lock,
flags);
483 static int cg6_setcolreg(
unsigned regno,
505 spin_unlock_irqrestore(&par->
lock,
flags);
516 static int cg6_blank(
int blank,
struct fb_info *info)
542 spin_unlock_irqrestore(&par->
lock,
flags);
596 info->
fix.smem_start, info->
fix.smem_len,
600 static int cg6_ioctl(
struct fb_info *info,
unsigned int cmd,
unsigned long arg)
613 const char *cg6_cpu_name, *cg6_card_name;
619 cg6_cpu_name =
"sparc";
622 cg6_cpu_name =
"68020";
625 cg6_cpu_name =
"i386";
629 if (info->
fix.smem_len <= 0x100000)
630 cg6_card_name =
"TGX";
632 cg6_card_name =
"TGX+";
634 if (info->
fix.smem_len <= 0x100000)
635 cg6_card_name =
"GX";
637 cg6_card_name =
"GX+";
640 sprintf(info->
fix.id,
"%s %s", cg6_card_name, cg6_cpu_name);
641 info->
fix.id[
sizeof(info->
fix.id) - 1] = 0;
646 info->
fix.line_length = linebytes;
701 }
while (i & 0x10000000);
761 info->
var.red.length = 8;
762 info->
var.green.length = 8;
763 info->
var.blue.length = 8;
771 info->
fix.smem_len *= 4;
776 sizeof(
struct cg6_tec),
"cgsix tec");
778 sizeof(
struct cg6_thc),
"cgsix thc");
780 sizeof(
struct bt_regs),
"cgsix dac");
782 sizeof(
u32),
"cgsix fhc");
787 info->
fbops = &cg6_ops;
790 info->
fix.smem_len,
"cgsix ram");
791 if (!par->
fbc || !par->
tec || !par->
thc ||
805 cg6_init_fix(info, linebytes);
809 goto out_dealloc_cmap;
823 cg6_unmap_regs(op, info, par);
838 cg6_unmap_regs(op, info, par);
862 .of_match_table = cg6_match,
868 static int __init cg6_init(
void)
876 static void __exit cg6_exit(
void)