cg3: use standard fields for framebuffer physical address and length

Use standard fields fbinfo.fix.smem_start and fbinfo.fix.smem_len
for physical address and length of framebuffer.

This also fixes output of the 'fbset -i' command - address and length
of the framebuffer is displayed correctly.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Krzysztof Helt 2009-05-04 10:37:46 +00:00 committed by David S. Miller
parent de4dc48ee2
commit 9fbfd4b8a4

View file

@ -118,9 +118,7 @@ struct cg3_par {
#define CG3_FLAG_BLANKED 0x00000001 #define CG3_FLAG_BLANKED 0x00000001
#define CG3_FLAG_RDI 0x00000002 #define CG3_FLAG_RDI 0x00000002
unsigned long physbase;
unsigned long which_io; unsigned long which_io;
unsigned long fbsize;
}; };
/** /**
@ -231,17 +229,15 @@ static int cg3_mmap(struct fb_info *info, struct vm_area_struct *vma)
struct cg3_par *par = (struct cg3_par *)info->par; struct cg3_par *par = (struct cg3_par *)info->par;
return sbusfb_mmap_helper(cg3_mmap_map, return sbusfb_mmap_helper(cg3_mmap_map,
par->physbase, par->fbsize, info->fix.smem_start, info->fix.smem_len,
par->which_io, par->which_io,
vma); vma);
} }
static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
{ {
struct cg3_par *par = (struct cg3_par *) info->par;
return sbusfb_ioctl_helper(cmd, arg, info, return sbusfb_ioctl_helper(cmd, arg, info,
FBTYPE_SUN3COLOR, 8, par->fbsize); FBTYPE_SUN3COLOR, 8, info->fix.smem_len);
} }
/* /*
@ -368,7 +364,7 @@ static int __devinit cg3_probe(struct of_device *op,
spin_lock_init(&par->lock); spin_lock_init(&par->lock);
par->physbase = op->resource[0].start; info->fix.smem_start = op->resource[0].start;
par->which_io = op->resource[0].flags & IORESOURCE_BITS; par->which_io = op->resource[0].flags & IORESOURCE_BITS;
sbusfb_fill_var(&info->var, dp, 8); sbusfb_fill_var(&info->var, dp, 8);
@ -382,7 +378,7 @@ static int __devinit cg3_probe(struct of_device *op,
linebytes = of_getintprop_default(dp, "linebytes", linebytes = of_getintprop_default(dp, "linebytes",
info->var.xres); info->var.xres);
par->fbsize = PAGE_ALIGN(linebytes * info->var.yres); info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres);
par->regs = of_ioremap(&op->resource[0], CG3_REGS_OFFSET, par->regs = of_ioremap(&op->resource[0], CG3_REGS_OFFSET,
sizeof(struct cg3_regs), "cg3 regs"); sizeof(struct cg3_regs), "cg3 regs");
@ -392,7 +388,7 @@ static int __devinit cg3_probe(struct of_device *op,
info->flags = FBINFO_DEFAULT; info->flags = FBINFO_DEFAULT;
info->fbops = &cg3_ops; info->fbops = &cg3_ops;
info->screen_base = of_ioremap(&op->resource[0], CG3_RAM_OFFSET, info->screen_base = of_ioremap(&op->resource[0], CG3_RAM_OFFSET,
par->fbsize, "cg3 ram"); info->fix.smem_len, "cg3 ram");
if (!info->screen_base) if (!info->screen_base)
goto out_unmap_regs; goto out_unmap_regs;
@ -418,7 +414,7 @@ static int __devinit cg3_probe(struct of_device *op,
dev_set_drvdata(&op->dev, info); dev_set_drvdata(&op->dev, info);
printk(KERN_INFO "%s: cg3 at %lx:%lx\n", printk(KERN_INFO "%s: cg3 at %lx:%lx\n",
dp->full_name, par->which_io, par->physbase); dp->full_name, par->which_io, info->fix.smem_start);
return 0; return 0;
@ -426,7 +422,7 @@ static int __devinit cg3_probe(struct of_device *op,
fb_dealloc_cmap(&info->cmap); fb_dealloc_cmap(&info->cmap);
out_unmap_screen: out_unmap_screen:
of_iounmap(&op->resource[0], info->screen_base, par->fbsize); of_iounmap(&op->resource[0], info->screen_base, info->fix.smem_len);
out_unmap_regs: out_unmap_regs:
of_iounmap(&op->resource[0], par->regs, sizeof(struct cg3_regs)); of_iounmap(&op->resource[0], par->regs, sizeof(struct cg3_regs));
@ -447,7 +443,7 @@ static int __devexit cg3_remove(struct of_device *op)
fb_dealloc_cmap(&info->cmap); fb_dealloc_cmap(&info->cmap);
of_iounmap(&op->resource[0], par->regs, sizeof(struct cg3_regs)); of_iounmap(&op->resource[0], par->regs, sizeof(struct cg3_regs));
of_iounmap(&op->resource[0], info->screen_base, par->fbsize); of_iounmap(&op->resource[0], info->screen_base, info->fix.smem_len);
framebuffer_release(info); framebuffer_release(info);