42 #include <linux/module.h>
43 #include <linux/kernel.h>
44 #include <linux/errno.h>
45 #include <linux/string.h>
47 #include <linux/slab.h>
54 #include <linux/nvram.h>
55 #include <linux/adb.h>
56 #include <linux/cuda.h>
59 #include <asm/bootinfo.h>
64 #include <asm/pgtable.h>
73 static int default_cmode =
CMODE_8;
112 static int valkyriefb_set_par(
struct fb_info *
info);
115 static int valkyriefb_blank(
int blank_mode,
struct fb_info *
info);
118 static void set_valkyrie_clock(
unsigned char *
params);
126 static struct fb_ops valkyriefb_ops = {
128 .fb_check_var = valkyriefb_check_var,
129 .fb_set_par = valkyriefb_set_par,
130 .fb_setcolreg = valkyriefb_setcolreg,
131 .fb_blank = valkyriefb_blank,
138 static int valkyriefb_set_par(
struct fb_info *
info)
146 if ((err = valkyrie_var_to_par(&info->
var, par, info)))
149 valkyrie_par_to_fix(par, &info->
fix);
180 if ((err = valkyrie_var_to_par(var, &par, info)))
182 valkyrie_par_to_var(&par, var);
196 static int valkyriefb_blank(
int blank_mode,
struct fb_info *info)
205 switch (blank_mode) {
250 (regno << 10) | (regno << 5) | regno;
255 static inline int valkyrie_vram_reqd(
int video_mode,
int color_mode)
260 if ((pitch = init->
pitch[color_mode]) == 0)
261 pitch = 2 * init->
pitch[0];
265 static void set_valkyrie_clock(
unsigned char *
params)
270 #ifdef CONFIG_ADB_CUDA
271 for (i = 0; i < 3; ++
i) {
273 0x50, i + 1, params[i]);
274 while (!
req.complete)
282 p->
sense = read_valkyrie_sense(p);
286 #if !defined(CONFIG_MAC) && defined(CONFIG_NVRAM)
289 if (default_vmode <= 0
291 || !valkyrie_reg_init[default_vmode - 1])
297 if (!valkyrie_reg_init[default_vmode - 1])
299 #if !defined(CONFIG_MAC) && defined(CONFIG_NVRAM)
307 if (default_cmode < CMODE_8 || default_cmode >
CMODE_16
308 || valkyrie_reg_init[default_vmode-1]->pitch[default_cmode] == 0
309 || valkyrie_vram_reqd(default_vmode, default_cmode) > p->
total_vram)
313 default_vmode, default_cmode);
336 frame_buffer_phys = 0xf9000000;
337 cmap_regs_phys = 0x50f24000;
338 flags = IOMAP_NOCACHE_SER;
353 frame_buffer_phys = r.
start;
354 cmap_regs_phys = r.
start + 0x304000;
382 valkyrie_choose_mode(p);
384 err = valkyrie_init_info(&p->
info, p);
387 valkyrie_init_fix(&p->
info.fix, p);
388 if (valkyriefb_set_par(&p->
info))
428 sense |= (in & 0x10) >> 2;
478 if (vmode < 1 || vmode >
VMODE_MAX || !valkyrie_reg_init[vmode-1]) {
493 init = valkyrie_reg_init[vmode-1];
494 if (init->
pitch[cmode] == 0) {
496 "cmode %d.\n", vmode, cmode);
500 if (valkyrie_vram_reqd(vmode, cmode) > p->
total_vram) {
502 "cmode %d.\n", vmode, cmode);
519 memset(fix, 0,
sizeof(*fix));
522 fix->
mmio_len =
sizeof(
struct valkyrie_regs);
545 static int __init valkyrie_init_info(
struct fb_info *info,
548 info->
fbops = &valkyriefb_ops;
564 if (!options || !*options)
567 while ((this_opt =
strsep(&options,
",")) !=
NULL) {
568 if (!
strncmp(this_opt,
"vmode:", 6)) {
571 default_vmode = vmode;
573 else if (!
strncmp(this_opt,
"cmode:", 6)) {