Commit ebaebc68 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] mips: newport driver fixes

From: Ralf Baechle <ralf@linux-mips.org>

Make the driver for Newport aka XL work in 2.6.
parent 2cb5274c
...@@ -19,7 +19,7 @@ font-objs += $(font-objs-y) ...@@ -19,7 +19,7 @@ font-objs += $(font-objs-y)
# Each configuration option enables a list of files. # Each configuration option enables a list of files.
obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o
obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o font.o
obj-$(CONFIG_PROM_CONSOLE) += promcon.o promcon_tbl.o obj-$(CONFIG_PROM_CONSOLE) += promcon.o promcon_tbl.o
obj-$(CONFIG_STI_CONSOLE) += sticon.o sticore.o obj-$(CONFIG_STI_CONSOLE) += sticon.o sticore.o
obj-$(CONFIG_VGA_CONSOLE) += vgacon.o obj-$(CONFIG_VGA_CONSOLE) += vgacon.o
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
extern struct font_desc font_vga_8x16; extern struct font_desc font_vga_8x16;
extern unsigned long sgi_gfxaddr;
#define FONT_DATA ((unsigned char *)font_vga_8x16.data) #define FONT_DATA ((unsigned char *)font_vga_8x16.data)
...@@ -43,7 +44,7 @@ extern struct font_desc font_vga_8x16; ...@@ -43,7 +44,7 @@ extern struct font_desc font_vga_8x16;
static unsigned char *font_data[MAX_NR_CONSOLES]; static unsigned char *font_data[MAX_NR_CONSOLES];
extern struct newport_regs *npregs; static struct newport_regs *npregs;
static int logo_active; static int logo_active;
static int topscan; static int topscan;
...@@ -51,6 +52,8 @@ static int xcurs_correction = 29; ...@@ -51,6 +52,8 @@ static int xcurs_correction = 29;
static int newport_xsize; static int newport_xsize;
static int newport_ysize; static int newport_ysize;
static int newport_set_def_font(int unit, struct console_font_op *op);
#define BMASK(c) (c << 24) #define BMASK(c) (c << 24)
#define RENDER(regs, cp) do { \ #define RENDER(regs, cp) do { \
...@@ -95,11 +98,33 @@ static inline void newport_init_cmap(void) ...@@ -95,11 +98,33 @@ static inline void newport_init_cmap(void)
} }
} }
static void newport_show_logo(void)
{
#ifdef CONFIG_LOGO_SGI_CLUT224 #ifdef CONFIG_LOGO_SGI_CLUT224
static void newport_show_logo(void); const struct linux_logo *logo = fb_find_logo(8);
#else const unsigned char *clut = logo->clut;
#define newport_show_logo() do { } while (0) const unsigned char *data = logo->data;
#endif unsigned long i;
for (i = 0; i < logo->clutsize; i++) {
newport_bfwait();
newport_cmap_setaddr(npregs, i + 0x20);
newport_cmap_setrgb(npregs, clut[0], clut[1], clut[2]);
clut += 3;
}
newport_wait();
npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
NPORT_DMODE0_CHOST);
npregs->set.xystarti = ((newport_xsize - logo->width) << 16) | (0);
npregs->set.xyendi = ((newport_xsize - 1) << 16);
newport_wait();
for (i = 0; i < logo->width*logo->height; i++)
npregs->go.hostrw0 = *data++ << 24;
#endif /* CONFIG_LOGO_SGI_CLUT224 */
}
static inline void newport_clear_screen(int xstart, int ystart, int xend, static inline void newport_clear_screen(int xstart, int ystart, int xend,
int yend, int ci) int yend, int ci)
...@@ -258,26 +283,22 @@ static void newport_get_revisions(void) ...@@ -258,26 +283,22 @@ static void newport_get_revisions(void)
xcurs_correction = 21; xcurs_correction = 21;
} }
#ifdef MODULE /* Can't be __init, take_over_console may call it later */
static const char *newport_startup(void) static const char *newport_startup(void)
#else
static const char *__init newport_startup(void)
#endif
{ {
int i; int i;
struct newport_regs *p;
npregs = (struct newport_regs *) (KSEG1 + 0x1f0f0000); if (!sgi_gfxaddr)
return NULL;
p = npregs; npregs = (struct newport_regs *) (KSEG1 + sgi_gfxaddr);
p->cset.config = NPORT_CFG_GD0; npregs->cset.config = NPORT_CFG_GD0;
if (newport_wait()) { if (newport_wait()) {
return NULL; return NULL;
} }
p->set.xstarti = TESTVAL; npregs->set.xstarti = TESTVAL;
if (p->set._xstart.word != XSTI_TO_FXSTART(TESTVAL)) if (npregs->set._xstart.word != XSTI_TO_FXSTART(TESTVAL))
return NULL; return NULL;
for (i = 0; i < MAX_NR_CONSOLES; i++) for (i = 0; i < MAX_NR_CONSOLES; i++)
...@@ -287,8 +308,6 @@ static const char *__init newport_startup(void) ...@@ -287,8 +308,6 @@ static const char *__init newport_startup(void)
newport_get_revisions(); newport_get_revisions();
newport_get_screensize(); newport_get_screensize();
/* gfx_init (display_desc); */
return "SGI Newport"; return "SGI Newport";
} }
...@@ -299,6 +318,15 @@ static void newport_init(struct vc_data *vc, int init) ...@@ -299,6 +318,15 @@ static void newport_init(struct vc_data *vc, int init)
vc->vc_can_do_color = 1; vc->vc_can_do_color = 1;
} }
static void newport_deinit(struct vc_data *c)
{
int i;
/* free memory used by user font */
for (i = 0; i < MAX_NR_CONSOLES; i++)
newport_set_def_font(i, NULL);
}
static void newport_clear(struct vc_data *vc, int sy, int sx, int height, static void newport_clear(struct vc_data *vc, int sy, int sx, int height,
int width) int width)
{ {
...@@ -679,7 +707,7 @@ static int newport_dummy(struct vc_data *c) ...@@ -679,7 +707,7 @@ static int newport_dummy(struct vc_data *c)
const struct consw newport_con = { const struct consw newport_con = {
.con_startup = newport_startup, .con_startup = newport_startup,
.con_init = newport_init, .con_init = newport_init,
.con_deinit = DUMMY, .con_deinit = newport_deinit,
.con_clear = newport_clear, .con_clear = newport_clear,
.con_putc = newport_putc, .con_putc = newport_putc,
.con_putcs = newport_putcs, .con_putcs = newport_putcs,
...@@ -696,63 +724,20 @@ const struct consw newport_con = { ...@@ -696,63 +724,20 @@ const struct consw newport_con = {
}; };
#ifdef MODULE #ifdef MODULE
MODULE_LICENSE("GPL"); static int __init newport_console_init(void)
int init_module(void)
{ {
if (!newport_startup())
printk("Error loading SGI Newport Console driver\n");
else
printk("Loading SGI Newport Console Driver\n");
take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
return 0; return 0;
} }
int cleanup_module(void) static void __exit newport_console_exit(void)
{ {
int i; give_up_console(&newport_con);
printk("Unloading SGI Newport Console Driver\n");
/* free memory used by user font */
for (i = 0; i < MAX_NR_CONSOLES; i++)
newport_set_def_font(i, NULL);
return 0;
} }
#endif
#ifdef CONFIG_LOGO_SGI_CLUT224 module_init(newport_console_init);
module_exit(newport_console_exit);
#undef __initdata #endif
#define __initdata
#include "../logo/logo_sgi_clut224.c"
static void newport_show_logo(void)
{
const struct linux_logo *logo = &logo_sgi_clut224;
const unsigned char *clut = logo->clut;
const unsigned char *data = logo->data;
unsigned long i;
for (i = 0; i < logo->clutsize; i++) {
newport_bfwait();
newport_cmap_setaddr(npregs, i + 0x20);
newport_cmap_setrgb(npregs, clut[0], clut[1], clut[2]);
clut += 3;
}
newport_wait();
npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
NPORT_DMODE0_CHOST);
npregs->set.xystarti = ((newport_xsize - logo->width) << 16) | (0);
npregs->set.xyendi = ((newport_xsize - 1) << 16);
newport_wait();
for (i = 0; i < logo->width*logo->height; i++)
npregs->go.hostrw0 = *data++ << 24;
}
#endif /* CONFIG_LOGO_SGI_CLUT224 */
MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment