1 /* $Id: leofb.c,v 1.1.1.1 2005/04/11 02:50:42 jack Exp $
2 * leofb.c: Leo (ZX) 24/8bit frame buffer driver
4 * Copyright (C) 1996-1999 Jakub Jelinek (jj@ultra.linux.cz)
5 * Copyright (C) 1997 Michal Rehacek (Michal.Rehacek@st.mff.cuni.cz)
8 #include <linux/module.h>
9 #include <linux/sched.h>
10 #include <linux/kernel.h>
11 #include <linux/errno.h>
12 #include <linux/string.h>
14 #include <linux/tty.h>
15 #include <linux/slab.h>
16 #include <linux/vmalloc.h>
17 #include <linux/delay.h>
18 #include <linux/interrupt.h>
20 #include <linux/init.h>
21 #include <linux/selection.h>
23 #include <video/sbusfb.h>
26 #define LEO_OFF_LC_SS0_KRN 0x00200000UL
27 #define LEO_OFF_LC_SS0_USR 0x00201000UL
28 #define LEO_OFF_LC_SS1_KRN 0x01200000UL
29 #define LEO_OFF_LC_SS1_USR 0x01201000UL
30 #define LEO_OFF_LD_SS0 0x00400000UL
31 #define LEO_OFF_LD_SS1 0x01400000UL
32 #define LEO_OFF_LD_GBL 0x00401000UL
33 #define LEO_OFF_LX_KRN 0x00600000UL
34 #define LEO_OFF_LX_CURSOR 0x00601000UL
35 #define LEO_OFF_SS0 0x00800000UL
36 #define LEO_OFF_SS1 0x01800000UL
37 #define LEO_OFF_UNK 0x00602000UL
38 #define LEO_OFF_UNK2 0x00000000UL
40 #define LEO_CUR_ENABLE 0x00000080
41 #define LEO_CUR_UPDATE 0x00000030
42 #define LEO_CUR_PROGRESS 0x00000006
43 #define LEO_CUR_UPDATECMAP 0x00000003
45 #define LEO_CUR_TYPE_MASK 0x00000000
46 #define LEO_CUR_TYPE_IMAGE 0x00000020
47 #define LEO_CUR_TYPE_CMAP 0x00000050
51 volatile u32 cur_type;
52 volatile u32 cur_misc;
53 volatile u32 cur_cursxy;
54 volatile u32 cur_data;
57 #define LEO_KRN_TYPE_CLUT0 0x00001000
58 #define LEO_KRN_TYPE_CLUT1 0x00001001
59 #define LEO_KRN_TYPE_CLUT2 0x00001002
60 #define LEO_KRN_TYPE_WID 0x00001003
61 #define LEO_KRN_TYPE_UNK 0x00001006
62 #define LEO_KRN_TYPE_VIDEO 0x00002003
63 #define LEO_KRN_TYPE_CLUTDATA 0x00004000
64 #define LEO_KRN_CSR_ENABLE 0x00000008
65 #define LEO_KRN_CSR_PROGRESS 0x00000004
66 #define LEO_KRN_CSR_UNK 0x00000002
67 #define LEO_KRN_CSR_UNK2 0x00000001
70 volatile u32 krn_type;
72 volatile u32 krn_value;
75 struct leo_lc_ss0_krn {
81 struct leo_lc_ss0_usr {
83 volatile u32 addrspace;
93 struct leo_lc_ss1_krn {
97 struct leo_lc_ss1_usr {
106 volatile u32 widclip;
107 volatile u32 vclipmin;
108 volatile u32 vclipmax;
109 volatile u32 pickmin; /* SS1 only */
110 volatile u32 pickmax; /* SS1 only */
113 volatile u32 src; /* Copy/Scroll (SS0 only) */
114 volatile u32 dst; /* Copy/Scroll/Fill (SS0 only) */
115 volatile u32 extent; /* Copy/Scroll/Fill size (SS0 only) */
117 volatile u32 setsem; /* SS1 only */
118 volatile u32 clrsem; /* SS1 only */
119 volatile u32 clrpick; /* SS1 only */
120 volatile u32 clrdat; /* SS1 only */
121 volatile u32 alpha; /* SS1 only */
124 volatile u32 planemask;
127 volatile u32 dczf; /* SS1 only */
128 volatile u32 dczb; /* SS1 only */
129 volatile u32 dcs; /* SS1 only */
130 volatile u32 dczs; /* SS1 only */
131 volatile u32 pickfb; /* SS1 only */
132 volatile u32 pickbb; /* SS1 only */
133 volatile u32 dcfc; /* SS1 only */
134 volatile u32 forcecol; /* SS1 only */
135 volatile u32 door[8]; /* SS1 only */
136 volatile u32 pick[5]; /* SS1 only */
139 #define LEO_SS1_MISC_ENABLE 0x00000001
140 #define LEO_SS1_MISC_STEREO 0x00000002
143 volatile u32 ss1_misc;
150 static struct sbus_mmap_map leo_mmap_map[] = {
151 { LEO_SS0_MAP, LEO_OFF_SS0, 0x800000 },
152 { LEO_LC_SS0_USR_MAP, LEO_OFF_LC_SS0_USR, 0x1000 },
153 { LEO_LD_SS0_MAP, LEO_OFF_LD_SS0, 0x1000 },
154 { LEO_LX_CURSOR_MAP, LEO_OFF_LX_CURSOR, 0x1000 },
155 { LEO_SS1_MAP, LEO_OFF_SS1, 0x800000 },
156 { LEO_LC_SS1_USR_MAP, LEO_OFF_LC_SS1_USR, 0x1000 },
157 { LEO_LD_SS1_MAP, LEO_OFF_LD_SS1, 0x1000 },
158 { LEO_UNK_MAP, LEO_OFF_UNK, 0x1000 },
159 { LEO_LX_KRN_MAP, LEO_OFF_LX_KRN, 0x1000 },
160 { LEO_LC_SS0_KRN_MAP, LEO_OFF_LC_SS0_KRN, 0x1000 },
161 { LEO_LC_SS1_KRN_MAP, LEO_OFF_LC_SS1_KRN, 0x1000 },
162 { LEO_LD_GBL_MAP, LEO_OFF_LD_GBL, 0x1000 },
163 { LEO_UNK2_MAP, LEO_OFF_UNK2, 0x100000 },
167 static void leo_setup(struct display *p)
173 static void leo_clear(struct vc_data *conp, struct display *p, int sy, int sx,
174 int height, int width)
176 struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
177 register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
178 register struct leo_ld *ss = (struct leo_ld *) fb->s.leo.ld_ss0;
183 spin_lock_irqsave(&fb->lock, flags);
185 i = sbus_readl(&us->csr);
186 } while (i & 0x20000000);
187 sbus_writel((attr_bgcol_ec(p,conp)<<24), &ss->fg);
188 if (fontheightlog(p)) {
189 y = sy << fontheightlog(p); h = height << fontheightlog(p);
191 y = sy * fontheight(p); h = height * fontheight(p);
193 if (fontwidthlog(p)) {
194 x = sx << fontwidthlog(p); w = width << fontwidthlog(p);
196 x = sx * fontwidth(p); w = width * fontwidth(p);
198 sbus_writel((w - 1) | ((h - 1) << 11), &us->extent);
199 sbus_writel((x + fb->x_margin) | ((y + fb->y_margin) << 11) | 0x80000000,
201 spin_unlock_irqrestore(&fb->lock, flags);
204 static void leo_fill(struct fb_info_sbusfb *fb, struct display *p, int s,
205 int count, unsigned short *boxes)
208 register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
209 register struct leo_ld *ss = (struct leo_ld *) fb->s.leo.ld_ss0;
212 spin_lock_irqsave(&fb->lock, flags);
213 sbus_writel((attr_bgcol(p,s)<<24), &ss->fg);
214 while (count-- > 0) {
216 i = sbus_readl(&us->csr);
217 } while (i & 0x20000000);
218 sbus_writel((boxes[2] - boxes[0] - 1) |
219 ((boxes[3] - boxes[1] - 1) << 11),
221 sbus_writel(boxes[0] | (boxes[1] << 11) | 0x80000000,
225 spin_unlock_irqrestore(&fb->lock, flags);
228 static void leo_putc(struct vc_data *conp, struct display *p, int c, int yy, int xx)
230 struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
231 register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
232 register struct leo_ld *ss = (struct leo_ld *) fb->s.leo.ld_ss0;
238 spin_lock_irqsave(&fb->lock, flags);
239 if (fontheightlog(p)) {
240 y = yy << (fontheightlog(p) + 11);
241 i = (c & p->charmask) << fontheightlog(p);
243 y = (yy * fontheight(p)) << 11;
244 i = (c & p->charmask) * fontheight(p);
246 if (fontwidth(p) <= 8)
247 fd = p->fontdata + i;
249 fd = p->fontdata + (i << 1);
251 x = xx << fontwidthlog(p);
253 x = xx * fontwidth(p);
255 i = sbus_readl(&us->csr);
256 } while (i & 0x20000000);
257 sbus_writel(attr_fgcol(p,c) << 24, &ss->fg);
258 sbus_writel(attr_bgcol(p,c) << 24, &ss->bg);
259 sbus_writel(0xFFFFFFFF<<(32-fontwidth(p)),
261 u = ((u32 *)p->screen_base) + y + x;
262 if (fontwidth(p) <= 8) {
263 for (i = 0; i < fontheight(p); i++, u += 2048) {
264 u32 val = *fd++ << 24;
269 for (i = 0; i < fontheight(p); i++, u += 2048) {
270 u32 val = *(u16 *)fd << 16;
276 spin_unlock_irqrestore(&fb->lock, flags);
279 static void leo_putcs(struct vc_data *conp, struct display *p, const unsigned short *s,
280 int count, int yy, int xx)
282 struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
283 register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
284 register struct leo_ld *ss = (struct leo_ld *) fb->s.leo.ld_ss0;
287 u8 *fd1, *fd2, *fd3, *fd4;
291 spin_lock_irqsave(&fb->lock, flags);
293 i = sbus_readl(&us->csr);
294 } while (i & 0x20000000);
296 sbus_writel(attr_fgcol(p, c) << 24, &ss->fg);
297 sbus_writel(attr_bgcol(p, c) << 24, &ss->bg);
298 sbus_writel(0xFFFFFFFF<<(32-fontwidth(p)), &us->fontmsk);
300 x = (xx << fontwidthlog(p));
302 x = xx * fontwidth(p);
303 if (fontheightlog(p))
304 y = yy << (fontheightlog(p) + 11);
306 y = (yy * fontheight(p)) << 11;
307 u = ((u32 *)p->screen_base) + y + x;
308 if (fontwidth(p) <= 8) {
309 sbus_writel(0xFFFFFFFF<<(32-4*fontwidth(p)), &us->fontmsk);
310 x = 4*fontwidth(p) - fontheight(p)*2048;
313 if (fontheightlog(p)) {
314 fd1 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
315 fd2 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
316 fd3 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
317 fd4 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
319 fd1 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
320 fd2 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
321 fd3 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
322 fd4 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
324 if (fontwidth(p) == 8) {
325 for (i = 0; i < fontheight(p); i++, u += 2048) {
328 val = ((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++)
334 for (i = 0; i < fontheight(p); i++, u += 2048) {
337 val = (((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++)
338 << fontwidth(p))) << fontwidth(p))) << fontwidth(p))) << (24 - 3 * fontwidth(p));
345 sbus_writel(0xFFFFFFFF<<(32-2*fontwidth(p)), &us->fontmsk);
346 x = 2*fontwidth(p) - fontheight(p)*2048;
349 if (fontheightlog(p)) {
350 fd1 = p->fontdata + ((scr_readw(s++) & p->charmask) << (fontheightlog(p) + 1));
351 fd2 = p->fontdata + ((scr_readw(s++) & p->charmask) << (fontheightlog(p) + 1));
353 fd1 = p->fontdata + (((scr_readw(s++) & p->charmask) * fontheight(p)) << 1);
354 fd2 = p->fontdata + (((scr_readw(s++) & p->charmask) * fontheight(p)) << 1);
356 for (i = 0; i < fontheight(p); i++, u += 2048) {
359 val = ((((u32)*(u16 *)fd1) << fontwidth(p)) | ((u32)*(u16 *)fd2)) << (16 - fontwidth(p));
366 sbus_writel(0xFFFFFFFF<<(32-fontwidth(p)), &us->fontmsk);
367 x = fontwidth(p) - fontheight(p)*2048;
370 if (fontheightlog(p))
371 i = ((scr_readw(s++) & p->charmask) << fontheightlog(p));
373 i = ((scr_readw(s++) & p->charmask) * fontheight(p));
374 if (fontwidth(p) <= 8) {
375 fd1 = p->fontdata + i;
376 for (i = 0; i < fontheight(p); i++, u += 2048) {
377 u32 val = *fd1++ << 24;
382 fd1 = p->fontdata + (i << 1);
383 for (i = 0; i < fontheight(p); i++, u += 2048) {
384 u32 val = *(u16 *)fd1 << 16;
392 spin_unlock_irqrestore(&fb->lock, flags);
395 static void leo_revc(struct display *p, int xx, int yy)
397 /* Not used if hw cursor */
400 static int leo_wait (struct leo_lx_krn *lx_krn)
404 for (i = 0; (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) && i < 300000; i++)
405 udelay (1); /* Busy wait at most 0.3 sec */
407 return -EFAULT; /* Timed out - should we print some message? */
411 static void leo_loadcmap (struct fb_info_sbusfb *fb, struct display *p, int index, int count)
413 struct leo_lx_krn *lx_krn = fb->s.leo.lx_krn;
418 spin_lock_irqsave(&fb->lock, flags);
419 sbus_writel(LEO_KRN_TYPE_CLUT0, &lx_krn->krn_type);
420 i = leo_wait (lx_krn);
423 sbus_writel(LEO_KRN_TYPE_CLUTDATA, &lx_krn->krn_type);
424 for (i = 0; i < 256; i++) {
427 val = fb->color_map CM(i,0) |
428 (fb->color_map CM(i,1) << 8) |
429 (fb->color_map CM(i,2) << 16);
431 sbus_writel(val, &lx_krn->krn_value); /* Throw colors there :)) */
433 sbus_writel(LEO_KRN_TYPE_CLUT0, &lx_krn->krn_type);
434 tmp = sbus_readl(&lx_krn->krn_csr);
435 tmp |= (LEO_KRN_CSR_UNK|LEO_KRN_CSR_UNK2);
436 sbus_writel(tmp, &lx_krn->krn_csr);
438 spin_unlock_irqrestore(&fb->lock, flags);
441 static void leo_restore_palette (struct fb_info_sbusfb *fb)
446 spin_lock_irqsave(&fb->lock, flags);
447 tmp = sbus_readl(&fb->s.leo.ld_ss1->ss1_misc);
448 tmp &= ~(LEO_SS1_MISC_ENABLE);
449 sbus_writel(tmp, &fb->s.leo.ld_ss1->ss1_misc);
450 spin_unlock_irqrestore(&fb->lock, flags);
453 static struct display_switch leo_dispsw __initdata = {
455 bmove: fbcon_redraw_bmove,
460 fontwidthmask: FONTWIDTHRANGE(1,16) /* Allow fontwidths up to 16 */
463 static void leo_setcursormap (struct fb_info_sbusfb *fb, u8 *red, u8 *green, u8 *blue)
465 struct leo_cursor *l = fb->s.leo.cursor;
469 spin_lock_irqsave(&fb->lock, flags);
470 for (i = 0; (sbus_readl(&l->cur_misc) & LEO_CUR_PROGRESS) && i < 300000; i++)
471 udelay (1); /* Busy wait at most 0.3 sec */
473 goto out; /* Timed out - should we print some message? */
474 sbus_writel(LEO_CUR_TYPE_CMAP, &l->cur_type);
475 sbus_writel((red[0] | (green[0]<<8) | (blue[0]<<16)), &l->cur_data);
476 sbus_writel((red[1] | (green[1]<<8) | (blue[1]<<16)), &l->cur_data);
477 sbus_writel(LEO_CUR_UPDATECMAP, &l->cur_misc);
479 spin_unlock_irqrestore(&fb->lock, flags);
482 /* Set cursor shape */
483 static void leo_setcurshape (struct fb_info_sbusfb *fb)
487 struct leo_cursor *l = fb->s.leo.cursor;
491 spin_lock_irqsave(&fb->lock, flags);
492 tmp = sbus_readl(&l->cur_misc);
493 tmp &= ~LEO_CUR_ENABLE;
494 sbus_writel(tmp, &l->cur_misc);
495 for (k = 0; k < 2; k ++) {
496 sbus_writel((k * LEO_CUR_TYPE_IMAGE), &l->cur_type);
497 for (i = 0; i < 32; i++) {
499 m = fb->cursor.bits[k][i];
500 /* mask = m with reversed bit order */
501 for (j = 0, n = 1; j < 32; j++, n <<= 1)
503 mask |= (0x80000000 >> j);
504 sbus_writel(mask, &l->cur_data);
507 tmp = sbus_readl(&l->cur_misc);
508 tmp |= LEO_CUR_ENABLE;
509 sbus_writel(tmp, &l->cur_misc);
510 spin_unlock_irqrestore(&fb->lock, flags);
513 /* Load cursor information */
514 static void leo_setcursor (struct fb_info_sbusfb *fb)
516 struct cg_cursor *c = &fb->cursor;
517 struct leo_cursor *l = fb->s.leo.cursor;
521 spin_lock_irqsave(&fb->lock, flags);
522 tmp = sbus_readl(&l->cur_misc);
523 tmp &= ~LEO_CUR_ENABLE;
524 sbus_writel(tmp, &l->cur_misc);
526 sbus_writel(((c->cpos.fbx - c->chot.fbx) & 0x7ff) |
527 (((c->cpos.fby - c->chot.fby) & 0x7ff) << 11),
530 tmp = sbus_readl(&l->cur_misc);
531 tmp |= LEO_CUR_UPDATE;
533 tmp |= LEO_CUR_ENABLE;
534 sbus_writel(tmp, &l->cur_misc);
535 spin_unlock_irqrestore(&fb->lock, flags);
538 static void leo_blank (struct fb_info_sbusfb *fb)
543 spin_lock_irqsave(&fb->lock, flags);
544 sbus_writel(LEO_KRN_TYPE_VIDEO, &fb->s.leo.lx_krn->krn_type);
546 tmp = sbus_readl(&fb->s.leo.lx_krn->krn_csr);
547 tmp &= ~LEO_KRN_CSR_ENABLE;
548 sbus_writel(tmp, &fb->s.leo.lx_krn->krn_csr);
549 spin_unlock_irqrestore(&fb->lock, flags);
552 static void leo_unblank (struct fb_info_sbusfb *fb)
557 spin_lock_irqsave(&fb->lock, flags);
558 sbus_writel(LEO_KRN_TYPE_VIDEO, &fb->s.leo.lx_krn->krn_type);
560 tmp = sbus_readl(&fb->s.leo.lx_krn->krn_csr);
561 if (!(tmp & LEO_KRN_CSR_ENABLE)) {
562 tmp |= LEO_KRN_CSR_ENABLE;
563 sbus_writel(tmp, &fb->s.leo.lx_krn->krn_csr);
565 spin_unlock_irqrestore(&fb->lock, flags);
569 leo_wid_put (struct fb_info_sbusfb *fb, struct fb_wid_list *wl)
571 struct leo_lx_krn *lx_krn = fb->s.leo.lx_krn;
572 struct fb_wid_item *wi;
575 sbus_writel(LEO_KRN_TYPE_WID, &lx_krn->krn_type);
576 i = leo_wait (lx_krn);
579 for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) {
580 switch (wi->wi_type) {
581 case FB_WID_DBL_8: j = (wi->wi_index & 0xf) + 0x40; break;
582 case FB_WID_DBL_24: j = wi->wi_index & 0x3f; break;
583 default: return -EINVAL;
585 sbus_writel(0x5800 + j, &lx_krn->krn_type);
586 sbus_writel(wi->wi_values[0], &lx_krn->krn_value);
588 sbus_writel(LEO_KRN_TYPE_WID, &lx_krn->krn_type);
589 sbus_writel(3, &lx_krn->krn_csr);
593 static void leo_margins (struct fb_info_sbusfb *fb, struct display *p, int x_margin, int y_margin)
595 p->screen_base += 8192 * (y_margin - fb->y_margin) + 4 * (x_margin - fb->x_margin);
598 static void leo_switch_from_graph (struct fb_info_sbusfb *fb)
600 register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
601 register struct leo_ld *ss = (struct leo_ld *) fb->s.leo.ld_ss0;
604 spin_lock_irqsave(&fb->lock, flags);
605 sbus_writel(0xffffffff, &ss->wid);
606 sbus_writel(0xffff, &ss->wmask);
607 sbus_writel(0, &ss->vclipmin);
608 sbus_writel(fb->s.leo.extent, &ss->vclipmax);
609 sbus_writel(0xff000000, &ss->planemask);
610 sbus_writel(0x310850, &ss->rop);
611 sbus_writel(0, &ss->widclip);
612 sbus_writel(4, &us->addrspace);
613 sbus_writel(0, &us->fontt);
614 spin_unlock_irqrestore(&fb->lock, flags);
617 static int __init leo_rasterimg (struct fb_info *info, int start)
619 struct fb_info_sbusfb *fb = sbusfbinfo(info);
620 register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
621 register struct leo_ld *ss = (struct leo_ld *) fb->s.leo.ld_ss0;
624 sbus_writel(1, &ss->wid);
625 sbus_writel(0xffffff, &ss->planemask);
626 sbus_writel(0x310b90, &ss->rop);
627 sbus_writel(0, &us->addrspace);
629 sbus_writel(0xffffffff, &ss->wid);
630 sbus_writel(0xff000000, &ss->planemask);
631 sbus_writel(0x310850, &ss->rop);
632 sbus_writel(4, &us->addrspace);
637 static char idstring[40] __initdata = { 0 };
639 char * __init leofb_init(struct fb_info_sbusfb *fb)
641 struct fb_fix_screeninfo *fix = &fb->fix;
642 struct fb_var_screeninfo *var = &fb->var;
643 struct display *disp = &fb->disp;
644 struct fbtype *type = &fb->type;
645 struct sbus_dev *sdev = fb->sbdp;
646 unsigned long phys = sdev->reg_addrs[0].phys_addr;
647 struct fb_wid_item wi;
648 struct fb_wid_list wl;
650 register struct leo_lc_ss0_usr *us;
651 register struct leo_ld *ss;
652 struct fb_ops *fbops;
655 strcpy(fb->info.modename, "Leo");
657 strcpy(fix->id, "Leo");
658 fix->visual = FB_VISUAL_TRUECOLOR;
659 fix->line_length = 8192;
660 fix->accel = FB_ACCEL_SUN_LEO;
662 var->bits_per_pixel = 32;
663 var->green.offset = 8;
664 var->blue.offset = 16;
665 var->accel_flags = FB_ACCELF_TEXT;
667 fbops = kmalloc(sizeof(*fbops), GFP_KERNEL);
671 *fbops = *fb->info.fbops;
672 fbops->fb_rasterimg = leo_rasterimg;
673 fb->info.fbops = fbops;
675 disp->scrollmode = SCROLL_YREDRAW;
676 if (!disp->screen_base) {
677 disp->screen_base = (char *)
678 sbus_ioremap(&sdev->resource[0], LEO_OFF_SS0,
679 0x800000, "leo ram");
681 disp->screen_base += 8192 * fb->y_margin + 4 * fb->x_margin;
682 us = fb->s.leo.lc_ss0_usr = (struct leo_lc_ss0_usr *)
683 sbus_ioremap(&sdev->resource[0], LEO_OFF_LC_SS0_USR,
684 0x1000, "leolc ss0usr");
685 fb->s.leo.ld_ss0 = (struct leo_ld_ss0 *)
686 sbus_ioremap(&sdev->resource[0], LEO_OFF_LD_SS0,
687 0x1000, "leold ss0");
688 ss = (struct leo_ld *) fb->s.leo.ld_ss0;
689 fb->s.leo.ld_ss1 = (struct leo_ld_ss1 *)
690 sbus_ioremap(&sdev->resource[0], LEO_OFF_LD_SS1,
691 0x1000, "leold ss1");
692 fb->s.leo.lx_krn = (struct leo_lx_krn *)
693 sbus_ioremap(&sdev->resource[0], LEO_OFF_LX_KRN,
694 0x1000, "leolx krn");
695 fb->s.leo.cursor = (struct leo_cursor *)
696 sbus_ioremap(&sdev->resource[0], LEO_OFF_LX_CURSOR,
697 sizeof(struct leo_cursor), "leolx cursor");
698 fb->dispsw = leo_dispsw;
700 fb->s.leo.extent = (type->fb_width-1) | ((type->fb_height-1) << 16);
704 wi.wi_type = FB_WID_DBL_8;
706 wi.wi_values [0] = 0x2c0;
707 leo_wid_put (fb, &wl);
709 wi.wi_values [0] = 0x30;
710 leo_wid_put (fb, &wl);
712 wi.wi_values [0] = 0x20;
713 leo_wid_put (fb, &wl);
714 wi.wi_type = FB_WID_DBL_24;
716 wi.wi_values [0] = 0x30;
717 leo_wid_put (fb, &wl);
719 tmp = sbus_readl(&fb->s.leo.ld_ss1->ss1_misc);
720 tmp |= LEO_SS1_MISC_ENABLE;
721 sbus_writel(tmp, &fb->s.leo.ld_ss1->ss1_misc);
723 sbus_writel(0xffffffff, &ss->wid);
724 sbus_writel(0xffff, &ss->wmask);
725 sbus_writel(0, &ss->vclipmin);
726 sbus_writel(fb->s.leo.extent, &ss->vclipmax);
727 sbus_writel(0, &ss->fg);
728 sbus_writel(0xff000000, &ss->planemask);
729 sbus_writel(0x310850, &ss->rop);
730 sbus_writel(0, &ss->widclip);
731 sbus_writel((type->fb_width-1) | ((type->fb_height-1) << 11), &us->extent);
732 sbus_writel(4, &us->addrspace);
733 sbus_writel(0x80000000, &us->fill);
734 sbus_writel(0, &us->fontt);
736 i = sbus_readl(&us->csr);
737 } while (i & 0x20000000);
739 fb->margins = leo_margins;
740 fb->loadcmap = leo_loadcmap;
741 fb->setcursor = leo_setcursor;
742 fb->setcursormap = leo_setcursormap;
743 fb->setcurshape = leo_setcurshape;
744 fb->restore_palette = leo_restore_palette;
745 fb->switch_from_graph = leo_switch_from_graph;
747 fb->blank = leo_blank;
748 fb->unblank = leo_unblank;
751 fb->mmap_map = leo_mmap_map;
754 sprintf(idstring, "leo at %016lx", phys);
756 sprintf(idstring, "leo at %x.%08lx", fb->iospace, phys);
762 MODULE_LICENSE("GPL");