static int __devinit bw2_init_one(struct of_device *op) { struct device_node *dp = op->node; struct all_info *all; int linebytes, err; all = kzalloc(sizeof(*all), GFP_KERNEL); if (!all) return -ENOMEM; spin_lock_init(&all->par.lock); all->par.physbase = op->resource[0].start; all->par.which_io = op->resource[0].flags & IORESOURCE_BITS; sbusfb_fill_var(&all->info.var, dp->node, 1); linebytes = of_getintprop_default(dp, "linebytes", all->info.var.xres); all->info.var.red.length = all->info.var.green.length = all->info.var.blue.length = all->info.var.bits_per_pixel; all->info.var.red.offset = all->info.var.green.offset = all->info.var.blue.offset = 0; all->par.regs = of_ioremap(&op->resource[0], BWTWO_REGISTER_OFFSET, sizeof(struct bw2_regs), "bw2 regs"); if (!of_find_property(dp, "width", NULL)) bw2_do_default_mode(&all->par, &all->info, &linebytes); all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); all->info.flags = FBINFO_DEFAULT; all->info.fbops = &bw2_ops; all->info.screen_base = sbus_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram"); all->info.par = &all->par; bw2_blank(0, &all->info); bw2_init_fix(&all->info, linebytes); err= register_framebuffer(&all->info); if (err < 0) { of_iounmap(all->par.regs, sizeof(struct bw2_regs)); of_iounmap(all->info.screen_base, all->par.fbsize); kfree(all); return err; } dev_set_drvdata(&op->dev, all); printk("%s: bwtwo at %lx:%lx\n", dp->full_name, all->par.which_io, all->par.physbase); return 0; }
static int bw2_probe(struct platform_device *op) { struct device_node *dp = op->dev.of_node; struct fb_info *info; struct bw2_par *par; int linebytes, err; info = framebuffer_alloc(sizeof(struct bw2_par), &op->dev); err = -ENOMEM; if (!info) goto out_err; par = info->par; spin_lock_init(&par->lock); info->fix.smem_start = op->resource[0].start; par->which_io = op->resource[0].flags & IORESOURCE_BITS; sbusfb_fill_var(&info->var, dp, 1); linebytes = of_getintprop_default(dp, "linebytes", info->var.xres); info->var.red.length = info->var.green.length = info->var.blue.length = info->var.bits_per_pixel; info->var.red.offset = info->var.green.offset = info->var.blue.offset = 0; par->regs = of_ioremap(&op->resource[0], BWTWO_REGISTER_OFFSET, sizeof(struct bw2_regs), "bw2 regs"); if (!par->regs) goto out_release_fb; if (!of_find_property(dp, "width", NULL)) { err = bw2_do_default_mode(par, info, &linebytes); if (err) goto out_unmap_regs; } info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres); info->flags = FBINFO_DEFAULT; info->fbops = &bw2_ops; info->screen_base = of_ioremap(&op->resource[0], 0, info->fix.smem_len, "bw2 ram"); if (!info->screen_base) { err = -ENOMEM; goto out_unmap_regs; } bw2_blank(FB_BLANK_UNBLANK, info); bw2_init_fix(info, linebytes); err = register_framebuffer(info); if (err < 0) goto out_unmap_screen; dev_set_drvdata(&op->dev, info); printk(KERN_INFO "%s: bwtwo at %lx:%lx\n", dp->full_name, par->which_io, info->fix.smem_start); return 0; out_unmap_screen: of_iounmap(&op->resource[0], info->screen_base, info->fix.smem_len); out_unmap_regs: of_iounmap(&op->resource[0], par->regs, sizeof(struct bw2_regs)); out_release_fb: framebuffer_release(info); out_err: return err; }
static int tcx_probe(struct platform_device *op) { struct device_node *dp = op->dev.of_node; struct fb_info *info; struct tcx_par *par; int linebytes, i, err; info = framebuffer_alloc(sizeof(struct tcx_par), &op->dev); err = -ENOMEM; if (!info) goto out_err; par = info->par; spin_lock_init(&par->lock); par->lowdepth = (of_find_property(dp, "tcx-8-bit", NULL) != NULL); sbusfb_fill_var(&info->var, dp, 8); info->var.red.length = 8; info->var.green.length = 8; info->var.blue.length = 8; linebytes = of_getintprop_default(dp, "linebytes", info->var.xres); info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres); par->tec = of_ioremap(&op->resource[7], 0, sizeof(struct tcx_tec), "tcx tec"); par->thc = of_ioremap(&op->resource[9], 0, sizeof(struct tcx_thc), "tcx thc"); par->bt = of_ioremap(&op->resource[8], 0, sizeof(struct bt_regs), "tcx dac"); info->screen_base = of_ioremap(&op->resource[0], 0, info->fix.smem_len, "tcx ram"); if (!par->tec || !par->thc || !par->bt || !info->screen_base) goto out_unmap_regs; memcpy(&par->mmap_map, &__tcx_mmap_map, sizeof(par->mmap_map)); if (!par->lowdepth) { par->cplane = of_ioremap(&op->resource[4], 0, info->fix.smem_len * sizeof(u32), "tcx cplane"); if (!par->cplane) goto out_unmap_regs; } else { par->mmap_map[1].size = SBUS_MMAP_EMPTY; par->mmap_map[4].size = SBUS_MMAP_EMPTY; par->mmap_map[5].size = SBUS_MMAP_EMPTY; par->mmap_map[6].size = SBUS_MMAP_EMPTY; } info->fix.smem_start = op->resource[0].start; par->which_io = op->resource[0].flags & IORESOURCE_BITS; for (i = 0; i < TCX_MMAP_ENTRIES; i++) { int j; switch (i) { case 10: j = 12; break; case 11: case 12: j = i - 1; break; default: j = i; break; } par->mmap_map[i].poff = op->resource[j].start; } info->flags = FBINFO_DEFAULT; info->fbops = &tcx_ops; /* Initialize brooktree DAC. */ sbus_writel(0x04 << 24, &par->bt->addr); /* color planes */ sbus_writel(0xff << 24, &par->bt->control); sbus_writel(0x05 << 24, &par->bt->addr); sbus_writel(0x00 << 24, &par->bt->control); sbus_writel(0x06 << 24, &par->bt->addr); /* overlay plane */ sbus_writel(0x73 << 24, &par->bt->control); sbus_writel(0x07 << 24, &par->bt->addr); sbus_writel(0x00 << 24, &par->bt->control); tcx_reset(info); tcx_blank(FB_BLANK_UNBLANK, info); if (fb_alloc_cmap(&info->cmap, 256, 0)) goto out_unmap_regs; fb_set_cmap(&info->cmap, info); tcx_init_fix(info, linebytes); err = register_framebuffer(info); if (err < 0) goto out_dealloc_cmap; dev_set_drvdata(&op->dev, info); printk(KERN_INFO "%s: TCX at %lx:%lx, %s\n", dp->full_name, par->which_io, info->fix.smem_start, par->lowdepth ? "8-bit only" : "24-bit depth"); return 0; out_dealloc_cmap: fb_dealloc_cmap(&info->cmap); out_unmap_regs: tcx_unmap_regs(op, info, par); framebuffer_release(info); out_err: return err; }
static int __devinit leo_probe(struct of_device *op, const struct of_device_id *match) { struct device_node *dp = op->node; struct fb_info *info; struct leo_par *par; int linebytes, err; info = framebuffer_alloc(sizeof(struct leo_par), &op->dev); err = -ENOMEM; if (!info) goto out_err; par = info->par; spin_lock_init(&par->lock); par->physbase = op->resource[0].start; par->which_io = op->resource[0].flags & IORESOURCE_BITS; sbusfb_fill_var(&info->var, dp->node, 32); leo_fixup_var_rgb(&info->var); linebytes = of_getintprop_default(dp, "linebytes", info->var.xres); par->fbsize = PAGE_ALIGN(linebytes * info->var.yres); par->lc_ss0_usr = of_ioremap(&op->resource[0], LEO_OFF_LC_SS0_USR, 0x1000, "leolc ss0usr"); par->ld_ss0 = of_ioremap(&op->resource[0], LEO_OFF_LD_SS0, 0x1000, "leold ss0"); par->ld_ss1 = of_ioremap(&op->resource[0], LEO_OFF_LD_SS1, 0x1000, "leold ss1"); par->lx_krn = of_ioremap(&op->resource[0], LEO_OFF_LX_KRN, 0x1000, "leolx krn"); par->cursor = of_ioremap(&op->resource[0], LEO_OFF_LX_CURSOR, sizeof(struct leo_cursor), "leolx cursor"); info->screen_base = of_ioremap(&op->resource[0], LEO_OFF_SS0, 0x800000, "leo ram"); if (!par->lc_ss0_usr || !par->ld_ss0 || !par->ld_ss1 || !par->lx_krn || !par->cursor || !info->screen_base) goto out_unmap_regs; info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; info->fbops = &leo_ops; leo_init_wids(info); leo_init_hw(info); leo_blank(0, info); if (fb_alloc_cmap(&info->cmap, 256, 0)) goto out_unmap_regs; leo_init_fix(info, dp); err = register_framebuffer(info); if (err < 0) goto out_dealloc_cmap; dev_set_drvdata(&op->dev, info); printk("%s: leo at %lx:%lx\n", dp->full_name, par->which_io, par->physbase); return 0; out_dealloc_cmap: fb_dealloc_cmap(&info->cmap); out_unmap_regs: leo_unmap_regs(op, info, par); framebuffer_release(info); out_err: return err; }
static int __devinit tcx_init_one(struct of_device *op) { struct device_node *dp = op->node; struct all_info *all; int linebytes, i, err; all = kzalloc(sizeof(*all), GFP_KERNEL); if (!all) return -ENOMEM; spin_lock_init(&all->par.lock); all->par.lowdepth = (of_find_property(dp, "tcx-8-bit", NULL) != NULL); sbusfb_fill_var(&all->info.var, dp->node, 8); all->info.var.red.length = 8; all->info.var.green.length = 8; all->info.var.blue.length = 8; linebytes = of_getintprop_default(dp, "linebytes", all->info.var.xres); all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); all->par.tec = of_ioremap(&op->resource[7], 0, sizeof(struct tcx_tec), "tcx tec"); all->par.thc = of_ioremap(&op->resource[9], 0, sizeof(struct tcx_thc), "tcx thc"); all->par.bt = of_ioremap(&op->resource[8], 0, sizeof(struct bt_regs), "tcx dac"); all->info.screen_base = of_ioremap(&op->resource[0], 0, all->par.fbsize, "tcx ram"); if (!all->par.tec || !all->par.thc || !all->par.bt || !all->info.screen_base) { tcx_unmap_regs(all); kfree(all); return -ENOMEM; } memcpy(&all->par.mmap_map, &__tcx_mmap_map, sizeof(all->par.mmap_map)); if (!all->par.lowdepth) { all->par.cplane = of_ioremap(&op->resource[4], 0, all->par.fbsize * sizeof(u32), "tcx cplane"); if (!all->par.cplane) { tcx_unmap_regs(all); kfree(all); return -ENOMEM; } } else { all->par.mmap_map[1].size = SBUS_MMAP_EMPTY; all->par.mmap_map[4].size = SBUS_MMAP_EMPTY; all->par.mmap_map[5].size = SBUS_MMAP_EMPTY; all->par.mmap_map[6].size = SBUS_MMAP_EMPTY; } all->par.physbase = 0; all->par.which_io = op->resource[0].flags & IORESOURCE_BITS; for (i = 0; i < TCX_MMAP_ENTRIES; i++) { int j; switch (i) { case 10: j = 12; break; case 11: case 12: j = i - 1; break; default: j = i; break; }; all->par.mmap_map[i].poff = op->resource[j].start; } all->info.flags = FBINFO_DEFAULT; all->info.fbops = &tcx_ops; all->info.par = &all->par; /* Initialize brooktree DAC. */ sbus_writel(0x04 << 24, &all->par.bt->addr); /* color planes */ sbus_writel(0xff << 24, &all->par.bt->control); sbus_writel(0x05 << 24, &all->par.bt->addr); sbus_writel(0x00 << 24, &all->par.bt->control); sbus_writel(0x06 << 24, &all->par.bt->addr); /* overlay plane */ sbus_writel(0x73 << 24, &all->par.bt->control); sbus_writel(0x07 << 24, &all->par.bt->addr); sbus_writel(0x00 << 24, &all->par.bt->control); tcx_reset(&all->info); tcx_blank(FB_BLANK_UNBLANK, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { tcx_unmap_regs(all); kfree(all); return -ENOMEM; } fb_set_cmap(&all->info.cmap, &all->info); tcx_init_fix(&all->info, linebytes); err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); tcx_unmap_regs(all); kfree(all); return err; } dev_set_drvdata(&op->dev, all); printk("%s: TCX at %lx:%lx, %s\n", dp->full_name, all->par.which_io, op->resource[0].start, all->par.lowdepth ? "8-bit only" : "24-bit depth"); return 0; }
static int __devinit cg14_probe(struct of_device *op, const struct of_device_id *match) { struct device_node *dp = op->dev.of_node; struct fb_info *info; struct cg14_par *par; int is_8mb, linebytes, i, err; info = framebuffer_alloc(sizeof(struct cg14_par), &op->dev); err = -ENOMEM; if (!info) goto out_err; par = info->par; spin_lock_init(&par->lock); sbusfb_fill_var(&info->var, dp, 8); info->var.red.length = 8; info->var.green.length = 8; info->var.blue.length = 8; linebytes = of_getintprop_default(dp, "linebytes", info->var.xres); info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres); if (!strcmp(dp->parent->name, "sbus") || !strcmp(dp->parent->name, "sbi")) { info->fix.smem_start = op->resource[0].start; par->iospace = op->resource[0].flags & IORESOURCE_BITS; } else { info->fix.smem_start = op->resource[1].start; par->iospace = op->resource[0].flags & IORESOURCE_BITS; } par->regs = of_ioremap(&op->resource[0], 0, sizeof(struct cg14_regs), "cg14 regs"); par->clut = of_ioremap(&op->resource[0], CG14_CLUT1, sizeof(struct cg14_clut), "cg14 clut"); par->cursor = of_ioremap(&op->resource[0], CG14_CURSORREGS, sizeof(struct cg14_cursor), "cg14 cursor"); info->screen_base = of_ioremap(&op->resource[1], 0, info->fix.smem_len, "cg14 ram"); if (!par->regs || !par->clut || !par->cursor || !info->screen_base) goto out_unmap_regs; is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) == (8 * 1024 * 1024)); BUILD_BUG_ON(sizeof(par->mmap_map) != sizeof(__cg14_mmap_map)); memcpy(&par->mmap_map, &__cg14_mmap_map, sizeof(par->mmap_map)); for (i = 0; i < CG14_MMAP_ENTRIES; i++) { struct sbus_mmap_map *map = &par->mmap_map[i]; if (!map->size) break; if (map->poff & 0x80000000) map->poff = (map->poff & 0x7fffffff) + (op->resource[0].start - op->resource[1].start); if (is_8mb && map->size >= 0x100000 && map->size <= 0x400000) map->size *= 2; } par->mode = MDI_8_PIX; par->ramsize = (is_8mb ? 0x800000 : 0x400000); info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; info->fbops = &cg14_ops; __cg14_reset(par); if (fb_alloc_cmap(&info->cmap, 256, 0)) goto out_unmap_regs; fb_set_cmap(&info->cmap, info); cg14_init_fix(info, linebytes, dp); err = register_framebuffer(info); if (err < 0) goto out_dealloc_cmap; dev_set_drvdata(&op->dev, info); printk(KERN_INFO "%s: cgfourteen at %lx:%lx, %dMB\n", dp->full_name, par->iospace, info->fix.smem_start, par->ramsize >> 20); return 0; out_dealloc_cmap: fb_dealloc_cmap(&info->cmap); out_unmap_regs: cg14_unmap_regs(op, info, par); out_err: return err; }
static int __devinit cg14_init_one(struct of_device *op) { struct device_node *dp = op->node; struct all_info *all; int is_8mb, linebytes, i, err; all = kzalloc(sizeof(*all), GFP_KERNEL); if (!all) return -ENOMEM; spin_lock_init(&all->par.lock); sbusfb_fill_var(&all->info.var, dp->node, 8); all->info.var.red.length = 8; all->info.var.green.length = 8; all->info.var.blue.length = 8; linebytes = of_getintprop_default(dp, "linebytes", all->info.var.xres); all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); if (!strcmp(dp->parent->name, "sbus") || !strcmp(dp->parent->name, "sbi")) { all->par.physbase = op->resource[0].start; all->par.iospace = op->resource[0].flags & IORESOURCE_BITS; } else { all->par.physbase = op->resource[1].start; all->par.iospace = op->resource[0].flags & IORESOURCE_BITS; } all->par.regs = of_ioremap(&op->resource[0], 0, sizeof(struct cg14_regs), "cg14 regs"); all->par.clut = of_ioremap(&op->resource[0], CG14_CLUT1, sizeof(struct cg14_clut), "cg14 clut"); all->par.cursor = of_ioremap(&op->resource[0], CG14_CURSORREGS, sizeof(struct cg14_cursor), "cg14 cursor"); all->info.screen_base = of_ioremap(&op->resource[1], 0, all->par.fbsize, "cg14 ram"); if (!all->par.regs || !all->par.clut || !all->par.cursor || !all->info.screen_base) cg14_unmap_regs(all); is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) == (8 * 1024 * 1024)); BUILD_BUG_ON(sizeof(all->par.mmap_map) != sizeof(__cg14_mmap_map)); memcpy(&all->par.mmap_map, &__cg14_mmap_map, sizeof(all->par.mmap_map)); for (i = 0; i < CG14_MMAP_ENTRIES; i++) { struct sbus_mmap_map *map = &all->par.mmap_map[i]; if (!map->size) break; if (map->poff & 0x80000000) map->poff = (map->poff & 0x7fffffff) + (op->resource[0].start - op->resource[1].start); if (is_8mb && map->size >= 0x100000 && map->size <= 0x400000) map->size *= 2; } all->par.mode = MDI_8_PIX; all->par.ramsize = (is_8mb ? 0x800000 : 0x400000); all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; all->info.fbops = &cg14_ops; all->info.par = &all->par; __cg14_reset(&all->par); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { cg14_unmap_regs(all); kfree(all); return -ENOMEM; } fb_set_cmap(&all->info.cmap, &all->info); cg14_init_fix(&all->info, linebytes, dp); err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); cg14_unmap_regs(all); kfree(all); return err; } dev_set_drvdata(&op->dev, all); printk("%s: cgfourteen at %lx:%lx, %dMB\n", dp->full_name, all->par.iospace, all->par.physbase, all->par.ramsize >> 20); return 0; }