8 #include <linux/module.h>
9 #include <linux/kernel.h>
10 #include <linux/errno.h>
11 #include <linux/string.h>
19 #include <asm/uaccess.h>
30 static unsigned long fb_regs;
31 static unsigned char fb_bitmask;
33 #define TC_NBLANK 0x4080
36 #define TC_FBEN 0x4090
45 #define RR_COPYINVERTED 0xc
51 #define SOURCE_X 0x40f2
52 #define SOURCE_Y 0x40f6
55 #define WHEIGHT 0x4106
75 static int hpfb_setcolreg(
unsigned regno,
unsigned red,
unsigned green,
80 unsigned char _red =red>>8;
81 unsigned char _green=green>>8;
82 unsigned char _blue =blue>>8;
83 unsigned char _regno=regno;
92 if (regno >= info->
cmap.len)
102 out_be16(fb_regs + 0x60b8, ~_regno);
118 static int hpfb_blank(
int blank,
struct fb_info *info)
125 static void topcat_blit(
int x0,
int y0,
int x1,
int y1,
int w,
int h,
int rr)
128 while (
in_8(fb_regs +
BUSY) & fb_bitmask)
145 static void hpfb_copyarea(
struct fb_info *info,
const struct fb_copyarea *area)
154 clr = region->
color & 0xff;
156 while (
in_8(fb_regs +
BUSY) & fb_bitmask)
167 topcat_blit(region->
dx, region->
dy, region->
dx, region->
dy, region->
width, region->
height, -1);
170 static int hpfb_sync(
struct fb_info *info)
176 while (
in_8(fb_regs +
BUSY) & fb_bitmask)
186 static struct fb_ops hpfb_ops = {
188 .fb_setcolreg = hpfb_setcolreg,
189 .fb_blank = hpfb_blank,
190 .fb_fillrect = hpfb_fillrect,
191 .fb_copyarea = hpfb_copyarea,
193 .fb_sync = hpfb_sync,
197 #define HPFB_FBWMSB 0x05
198 #define HPFB_FBWLSB 0x07
199 #define HPFB_FBHMSB 0x09
200 #define HPFB_FBHLSB 0x0b
201 #define HPFB_DWMSB 0x0d
202 #define HPFB_DWLSB 0x0f
203 #define HPFB_DHMSB 0x11
204 #define HPFB_DHLSB 0x13
205 #define HPFB_NUMPLANES 0x5b
206 #define HPFB_FBOMSB 0x5d
207 #define HPFB_FBOLSB 0x5f
209 static int __devinit hpfb_init_one(
unsigned long phys_base,
212 unsigned long fboff, fb_width, fb_height, fb_start;
218 fb_info.
fix.smem_start = (
in_8(fb_regs + fboff) << 16);
220 if (phys_base >= DIOII_BASE) {
221 fb_info.
fix.smem_start += phys_base;
224 if (DIO_SECID(fb_regs) != DIO_ID2_TOPCAT) {
226 while (
in_be16(fb_regs+0x4800) & 1)
242 fb_info.
fix.line_length = fb_width;
244 fb_info.
fix.smem_len = fb_width * fb_height;
246 fb_info.
fix.smem_len);
253 printk(
KERN_INFO "hpfb: framebuffer at 0x%lx, mapped to 0x%lx, size %dk\n",
254 fb_info.
fix.smem_start, fb_start, fb_info.
fix.smem_len/1024);
265 out_8(fb_start, 0xff);
266 fb_bitmask =
in_8(fb_start);
280 topcat_blit(0, 0, 0, 0, fb_width, fb_height,
RR_CLEAR);
285 if (DIO_SECID(fb_regs) == DIO_ID2_TOPCAT)
289 fb_info.
fbops = &hpfb_ops;
291 fb_info.
var = hpfb_defined;
296 goto unmap_screen_base;
324 #define topcat_sid_ok(x) (((x) == DIO_ID2_LRCATSEYE) || ((x) == DIO_ID2_HRCCATSEYE) \
325 || ((x) == DIO_ID2_HRMCATSEYE) || ((x) == DIO_ID2_TOPCAT))
330 static int __devinit hpfb_dio_probe(
struct dio_dev *
d,
const struct dio_device_id *
ent)
334 paddr = d->resource.start;
338 if (d->scode >= DIOII_SCBASE) {
339 vaddr = (
unsigned long)
ioremap(paddr, resource_size(&d->resource));
341 vaddr = paddr + DIO_VIRADDRBASE;
344 "(secondary id %02x)\n", d->scode, (d->id >> 8) & 0xff);
345 if (hpfb_init_one(paddr, vaddr)) {
346 if (d->scode >= DIOII_SCBASE)
353 static void __devexit hpfb_remove_one(
struct dio_dev *
d)
356 if (d->scode >= DIOII_SCBASE)
364 static struct dio_device_id hpfb_dio_tbl[] = {
365 { DIO_ENCODE_ID(DIO_ID_FBUFFER, DIO_ID2_LRCATSEYE) },
366 { DIO_ENCODE_ID(DIO_ID_FBUFFER, DIO_ID2_HRCCATSEYE) },
367 { DIO_ENCODE_ID(DIO_ID_FBUFFER, DIO_ID2_HRMCATSEYE) },
368 { DIO_ENCODE_ID(DIO_ID_FBUFFER, DIO_ID2_TOPCAT) },
372 static struct dio_driver hpfb_driver = {
374 .id_table = hpfb_dio_tbl,
375 .probe = hpfb_dio_probe,
394 #define INTFBVADDR 0xf0560000
395 #define INTFBPADDR 0x560000