static void cg6_imageblit(struct fb_info *, const struct fb_image *);
static void cg6_fillrect(struct fb_info *, const struct fb_fillrect *);
static int cg6_sync(struct fb_info *);
-static int cg6_mmap(struct fb_info *, struct file *, struct vm_area_struct *);
-static int cg6_ioctl(struct inode *, struct file *, unsigned int,
- unsigned long, struct fb_info *);
+static int cg6_mmap(struct fb_info *, struct vm_area_struct *);
+static int cg6_ioctl(struct fb_info *, unsigned int, unsigned long);
/*
* Frame buffer operations
.fb_sync = cg6_sync,
.fb_mmap = cg6_mmap,
.fb_ioctl = cg6_ioctl,
- .fb_cursor = soft_cursor,
+#ifdef CONFIG_COMPAT
+ .fb_compat_ioctl = sbusfb_compat_ioctl,
+#endif
};
/* Offset of interesting structures in the OBIO space */
struct cg6_par {
spinlock_t lock;
- struct bt_regs *bt;
- struct cg6_fbc *fbc;
- struct cg6_thc *thc;
- struct cg6_tec *tec;
- volatile u32 *fhc;
+ struct bt_regs __iomem *bt;
+ struct cg6_fbc __iomem *fbc;
+ struct cg6_thc __iomem *thc;
+ struct cg6_tec __iomem *tec;
+ volatile u32 __iomem *fhc;
u32 flags;
#define CG6_FLAG_BLANKED 0x00000001
unsigned long fbsize;
struct sbus_dev *sdev;
- struct list_head list;
};
static int cg6_sync(struct fb_info *info)
{
struct cg6_par *par = (struct cg6_par *) info->par;
- struct cg6_fbc *fbc = par->fbc;
+ struct cg6_fbc __iomem *fbc = par->fbc;
int limit = 10000;
do {
static void cg6_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{
struct cg6_par *par = (struct cg6_par *) info->par;
- struct cg6_fbc *fbc = par->fbc;
+ struct cg6_fbc __iomem *fbc = par->fbc;
unsigned long flags;
s32 val;
static void cg6_imageblit(struct fb_info *info, const struct fb_image *image)
{
struct cg6_par *par = (struct cg6_par *) info->par;
- struct cg6_fbc *fbc = par->fbc;
+ struct cg6_fbc __iomem *fbc = par->fbc;
const u8 *data = image->data;
unsigned long flags;
u32 x, y;
unsigned transp, struct fb_info *info)
{
struct cg6_par *par = (struct cg6_par *) info->par;
- struct bt_regs *bt = par->bt;
+ struct bt_regs __iomem *bt = par->bt;
unsigned long flags;
if (regno >= 256)
cg6_blank(int blank, struct fb_info *info)
{
struct cg6_par *par = (struct cg6_par *) info->par;
- struct cg6_thc *thc = par->thc;
+ struct cg6_thc __iomem *thc = par->thc;
unsigned long flags;
u32 val;
spin_lock_irqsave(&par->lock, flags);
switch (blank) {
- case 0: /* Unblanking */
+ case FB_BLANK_UNBLANK: /* Unblanking */
val = sbus_readl(&thc->thc_misc);
val |= CG6_THC_MISC_VIDEO;
sbus_writel(val, &thc->thc_misc);
par->flags &= ~CG6_FLAG_BLANKED;
break;
- case 1: /* Normal blanking */
- case 2: /* VESA blank (vsync off) */
- case 3: /* VESA blank (hsync off) */
- case 4: /* Poweroff */
+ case FB_BLANK_NORMAL: /* Normal blanking */
+ case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */
+ case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */
+ case FB_BLANK_POWERDOWN: /* Poweroff */
val = sbus_readl(&thc->thc_misc);
val &= ~CG6_THC_MISC_VIDEO;
sbus_writel(val, &thc->thc_misc);
{ .size = 0 }
};
-static int cg6_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma)
+static int cg6_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
struct cg6_par *par = (struct cg6_par *)info->par;
vma);
}
-static int cg6_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
- unsigned long arg, struct fb_info *info)
+static int cg6_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
{
struct cg6_par *par = (struct cg6_par *) info->par;
/* Initialize Brooktree DAC */
static void cg6_bt_init(struct cg6_par *par)
{
- struct bt_regs *bt = par->bt;
+ struct bt_regs __iomem *bt = par->bt;
sbus_writel(0x04 << 24, &bt->addr); /* color planes */
sbus_writel(0xff << 24, &bt->control);
static void cg6_chip_init(struct fb_info *info)
{
struct cg6_par *par = (struct cg6_par *) info->par;
- struct cg6_tec *tec = par->tec;
- struct cg6_fbc *fbc = par->fbc;
- u32 rev, conf, mode, tmp;
+ struct cg6_tec __iomem *tec = par->tec;
+ struct cg6_fbc __iomem *fbc = par->fbc;
+ u32 rev, conf, mode;
int i;
/* Turn off stuff in the Transform Engine. */
sbus_writel(0, &fbc->clipminy);
sbus_writel(info->var.xres - 1, &fbc->clipmaxx);
sbus_writel(info->var.yres - 1, &fbc->clipmaxy);
-
- /* Disable cursor in Brooktree DAC. */
- sbus_writel(0x06 << 24, &par->bt->addr);
- tmp = sbus_readl(&par->bt->control);
- tmp &= ~(0x03 << 24);
- sbus_writel(tmp, &par->bt->control);
}
struct all_info {
all->par.physbase = sdev->reg_addrs[0].phys_addr;
sbusfb_fill_var(&all->info.var, sdev->prom_node, 8);
+ all->info.var.red.length = 8;
+ all->info.var.green.length = 8;
+ all->info.var.blue.length = 8;
linebytes = prom_getintdefault(sdev->prom_node, "linebytes",
all->info.var.xres);
if (prom_getbool(sdev->prom_node, "dblbuf"))
all->par.fbsize *= 4;
- all->par.fbc = (struct cg6_fbc *)
- sbus_ioremap(&sdev->resource[0], CG6_FBC_OFFSET,
+ all->par.fbc = sbus_ioremap(&sdev->resource[0], CG6_FBC_OFFSET,
4096, "cgsix fbc");
- all->par.tec = (struct cg6_tec *)
- sbus_ioremap(&sdev->resource[0], CG6_TEC_OFFSET,
+ all->par.tec = sbus_ioremap(&sdev->resource[0], CG6_TEC_OFFSET,
sizeof(struct cg6_tec), "cgsix tec");
- all->par.thc = (struct cg6_thc *)
- sbus_ioremap(&sdev->resource[0], CG6_THC_OFFSET,
+ all->par.thc = sbus_ioremap(&sdev->resource[0], CG6_THC_OFFSET,
sizeof(struct cg6_thc), "cgsix thc");
- all->par.bt = (struct bt_regs *)
- sbus_ioremap(&sdev->resource[0], CG6_BROOKTREE_OFFSET,
+ all->par.bt = sbus_ioremap(&sdev->resource[0], CG6_BROOKTREE_OFFSET,
sizeof(struct bt_regs), "cgsix dac");
- all->par.fhc = (u32 *)
- sbus_ioremap(&sdev->resource[0], CG6_FHC_OFFSET,
+ all->par.fhc = sbus_ioremap(&sdev->resource[0], CG6_FHC_OFFSET,
sizeof(u32), "cgsix fhc");
- all->info.flags = FBINFO_FLAG_DEFAULT;
+ all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_IMAGEBLIT |
+ FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT;
all->info.fbops = &cg6_ops;
#ifdef CONFIG_SPARC32
- all->info.screen_base = (char *)
+ all->info.screen_base = (char __iomem *)
prom_getintdefault(sdev->prom_node, "address", 0);
#endif
if (!all->info.screen_base)
- all->info.screen_base = (char *)
+ all->info.screen_base =
sbus_ioremap(&sdev->resource[0], CG6_RAM_OFFSET,
all->par.fbsize, "cgsix ram");
- all->info.currcon = -1;
all->info.par = &all->par;
all->info.var.accel_flags = FB_ACCELF_TEXT;
return;
}
+ fb_set_cmap(&all->info.cmap, &all->info);
cg6_init_fix(&all->info, linebytes);
if (register_framebuffer(&all->info) < 0) {
struct sbus_bus *sbus;
struct sbus_dev *sdev;
+ if (fb_get_options("cg6fb", NULL))
+ return -ENODEV;
+
for_all_sbusdev(sdev, sbus) {
if (!strcmp(sdev->prom_name, "cgsix") ||
!strcmp(sdev->prom_name, "cgthree+"))
return 0;
}
-#ifdef MODULE
module_init(cg6_init);
+
+#ifdef MODULE
module_exit(cg6_exit);
#endif