Commit 8f19e15b authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Linus Torvalds

cirrusfb: set MCLK in one place

A memory clock (MCLK) is set at various places.  Move the setting into one
place.

Set the MCLK only for Zorro cards as the x86 cards should be initialized by
BIOS.

Improve handling of the GD5434 (SD64).

Kill one annoying debug output "virtual offset: ...".
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 614c0dc9
...@@ -146,7 +146,7 @@ static const struct cirrusfb_board_info_rec { ...@@ -146,7 +146,7 @@ static const struct cirrusfb_board_info_rec {
.sr07 = 0xF0, .sr07 = 0xF0,
.sr07_1bpp = 0xF0, .sr07_1bpp = 0xF0,
.sr07_8bpp = 0xF1, .sr07_8bpp = 0xF1,
.sr1f = 0x20 .sr1f = 0x1E
}, },
[BT_PICCOLO] = { [BT_PICCOLO] = {
.name = "CL Piccolo", .name = "CL Piccolo",
...@@ -482,6 +482,7 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var, ...@@ -482,6 +482,7 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var,
if (var->bits_per_pixel == 8) { if (var->bits_per_pixel == 8) {
switch (cinfo->btype) { switch (cinfo->btype) {
case BT_ALPINE: case BT_ALPINE:
case BT_SD64:
case BT_PICASSO4: case BT_PICASSO4:
if (freq > 85500) if (freq > 85500)
cinfo->multiplexing = 1; cinfo->multiplexing = 1;
...@@ -492,10 +493,7 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var, ...@@ -492,10 +493,7 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var,
break; break;
default: default:
dev_err(info->device, break;
"Frequency greater than maxclock (%ld kHz)\n",
maxclock);
return -EINVAL;
} }
} }
#if 0 #if 0
...@@ -847,7 +845,8 @@ static int cirrusfb_set_par_foo(struct fb_info *info) ...@@ -847,7 +845,8 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
/* formula: VClk = (OSC * N) / (D * (1+P)) */ /* formula: VClk = (OSC * N) / (D * (1+P)) */
/* Example: VClk = (14.31818 * 91) / (23 * (1+1)) = 28.325 MHz */ /* Example: VClk = (14.31818 * 91) / (23 * (1+1)) = 28.325 MHz */
if (cinfo->btype == BT_ALPINE || cinfo->btype == BT_PICASSO4) { if (cinfo->btype == BT_ALPINE || cinfo->btype == BT_PICASSO4 ||
cinfo->btype == BT_SD64) {
/* if freq is close to mclk or mclk/2 select mclk /* if freq is close to mclk or mclk/2 select mclk
* as clock source * as clock source
*/ */
...@@ -966,30 +965,19 @@ static int cirrusfb_set_par_foo(struct fb_info *info) ...@@ -966,30 +965,19 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
/* Extended Sequencer Mode */ /* Extended Sequencer Mode */
switch (cinfo->btype) { switch (cinfo->btype) {
case BT_SD64:
/* setting the SEQRF on SD64 is not necessary
* (only during init)
*/
/* MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x1a);
break;
case BT_PICCOLO: case BT_PICCOLO:
case BT_SPECTRUM: case BT_SPECTRUM:
/* ### ueberall 0x22? */
/* ##vorher 1c MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x22);
/* evtl d0 bei 1 bit? avoid FIFO underruns..? */ /* evtl d0 bei 1 bit? avoid FIFO underruns..? */
vga_wseq(regbase, CL_SEQRF, 0xb0); vga_wseq(regbase, CL_SEQRF, 0xb0);
break; break;
case BT_PICASSO: case BT_PICASSO:
/* ##vorher 22 MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x22);
/* ## vorher d0 avoid FIFO underruns..? */ /* ## vorher d0 avoid FIFO underruns..? */
vga_wseq(regbase, CL_SEQRF, 0xd0); vga_wseq(regbase, CL_SEQRF, 0xd0);
break; break;
case BT_SD64:
case BT_PICASSO4: case BT_PICASSO4:
case BT_ALPINE: case BT_ALPINE:
case BT_GD5480: case BT_GD5480:
...@@ -1051,16 +1039,9 @@ static int cirrusfb_set_par_foo(struct fb_info *info) ...@@ -1051,16 +1039,9 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
} }
switch (cinfo->btype) { switch (cinfo->btype) {
case BT_SD64:
/* MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x1d);
break;
case BT_PICCOLO: case BT_PICCOLO:
case BT_PICASSO: case BT_PICASSO:
case BT_SPECTRUM: case BT_SPECTRUM:
/* ### vorher 1c MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x22);
/* Fast Page-Mode writes */ /* Fast Page-Mode writes */
vga_wseq(regbase, CL_SEQRF, 0xb0); vga_wseq(regbase, CL_SEQRF, 0xb0);
break; break;
...@@ -1074,6 +1055,7 @@ static int cirrusfb_set_par_foo(struct fb_info *info) ...@@ -1074,6 +1055,7 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
/* We already set SRF and SR1F */ /* We already set SRF and SR1F */
break; break;
case BT_SD64:
case BT_GD5480: case BT_GD5480:
case BT_LAGUNA: case BT_LAGUNA:
case BT_LAGUNAB: case BT_LAGUNAB:
...@@ -1104,32 +1086,23 @@ static int cirrusfb_set_par_foo(struct fb_info *info) ...@@ -1104,32 +1086,23 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
else if (var->bits_per_pixel == 16) { else if (var->bits_per_pixel == 16) {
dev_dbg(info->device, "preparing for 16 bit deep display\n"); dev_dbg(info->device, "preparing for 16 bit deep display\n");
switch (cinfo->btype) { switch (cinfo->btype) {
case BT_SD64:
/* Extended Sequencer Mode: 256c col. mode */
vga_wseq(regbase, CL_SEQR7, 0xf7);
/* MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x1e);
break;
case BT_PICCOLO: case BT_PICCOLO:
case BT_SPECTRUM: case BT_SPECTRUM:
vga_wseq(regbase, CL_SEQR7, 0x87); vga_wseq(regbase, CL_SEQR7, 0x87);
/* Fast Page-Mode writes */ /* Fast Page-Mode writes */
vga_wseq(regbase, CL_SEQRF, 0xb0); vga_wseq(regbase, CL_SEQRF, 0xb0);
/* MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x22);
break; break;
case BT_PICASSO: case BT_PICASSO:
vga_wseq(regbase, CL_SEQR7, 0x27); vga_wseq(regbase, CL_SEQR7, 0x27);
/* Fast Page-Mode writes */ /* Fast Page-Mode writes */
vga_wseq(regbase, CL_SEQRF, 0xb0); vga_wseq(regbase, CL_SEQRF, 0xb0);
/* MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x22);
break; break;
case BT_SD64:
case BT_PICASSO4: case BT_PICASSO4:
case BT_ALPINE: case BT_ALPINE:
/* Extended Sequencer Mode: 256c col. mode */
vga_wseq(regbase, CL_SEQR7, 0xa7); vga_wseq(regbase, CL_SEQR7, 0xa7);
break; break;
...@@ -1171,32 +1144,23 @@ static int cirrusfb_set_par_foo(struct fb_info *info) ...@@ -1171,32 +1144,23 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
else if (var->bits_per_pixel == 24) { else if (var->bits_per_pixel == 24) {
dev_dbg(info->device, "preparing for 24 bit deep display\n"); dev_dbg(info->device, "preparing for 24 bit deep display\n");
switch (cinfo->btype) { switch (cinfo->btype) {
case BT_SD64:
/* Extended Sequencer Mode: 256c col. mode */
vga_wseq(regbase, CL_SEQR7, 0xf5);
/* MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x1e);
break;
case BT_PICCOLO: case BT_PICCOLO:
case BT_SPECTRUM: case BT_SPECTRUM:
vga_wseq(regbase, CL_SEQR7, 0x85); vga_wseq(regbase, CL_SEQR7, 0x85);
/* Fast Page-Mode writes */ /* Fast Page-Mode writes */
vga_wseq(regbase, CL_SEQRF, 0xb0); vga_wseq(regbase, CL_SEQRF, 0xb0);
/* MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x22);
break; break;
case BT_PICASSO: case BT_PICASSO:
vga_wseq(regbase, CL_SEQR7, 0x25); vga_wseq(regbase, CL_SEQR7, 0x25);
/* Fast Page-Mode writes */ /* Fast Page-Mode writes */
vga_wseq(regbase, CL_SEQRF, 0xb0); vga_wseq(regbase, CL_SEQRF, 0xb0);
/* MCLK select */
vga_wseq(regbase, CL_SEQR1F, 0x22);
break; break;
case BT_SD64:
case BT_PICASSO4: case BT_PICASSO4:
case BT_ALPINE: case BT_ALPINE:
/* Extended Sequencer Mode: 256c col. mode */
vga_wseq(regbase, CL_SEQR7, 0xa5); vga_wseq(regbase, CL_SEQR7, 0xa5);
break; break;
...@@ -1353,9 +1317,6 @@ static int cirrusfb_pan_display(struct fb_var_screeninfo *var, ...@@ -1353,9 +1317,6 @@ static int cirrusfb_pan_display(struct fb_var_screeninfo *var,
unsigned char tmp, xpix; unsigned char tmp, xpix;
struct cirrusfb_info *cinfo = info->par; struct cirrusfb_info *cinfo = info->par;
dev_dbg(info->device,
"virtual offset: (%d,%d)\n", var->xoffset, var->yoffset);
/* no range checks for xoffset and yoffset, */ /* no range checks for xoffset and yoffset, */
/* as fb_pan_display has already done this */ /* as fb_pan_display has already done this */
if (var->vmode & FB_VMODE_YWRAP) if (var->vmode & FB_VMODE_YWRAP)
...@@ -1607,10 +1568,6 @@ static void init_vgachip(struct fb_info *info) ...@@ -1607,10 +1568,6 @@ static void init_vgachip(struct fb_info *info)
vga_wseq(cinfo->regbase, CL_SEQR18, 0x02); vga_wseq(cinfo->regbase, CL_SEQR18, 0x02);
} }
/* MCLK select etc. */
if (bi->init_sr1f)
vga_wseq(cinfo->regbase, CL_SEQR1F, bi->sr1f);
/* Screen A preset row scan: none */ /* Screen A preset row scan: none */
vga_wcrt(cinfo->regbase, VGA_CRTC_PRESET_ROW, 0x00); vga_wcrt(cinfo->regbase, VGA_CRTC_PRESET_ROW, 0x00);
/* Text cursor start: disable text cursor */ /* Text cursor start: disable text cursor */
...@@ -2346,6 +2303,11 @@ static int __devinit cirrusfb_zorro_register(struct zorro_dev *z, ...@@ -2346,6 +2303,11 @@ static int __devinit cirrusfb_zorro_register(struct zorro_dev *z,
zorro_set_drvdata(z, info); zorro_set_drvdata(z, info);
/* MCLK select etc. */
if (cirrusfb_board_info[btype].init_sr1f)
vga_wseq(cinfo->regbase, CL_SEQR1F,
cirrusfb_board_info[btype].sr1f);
ret = cirrusfb_register(info); ret = cirrusfb_register(info);
if (!ret) if (!ret)
return 0; return 0;
......
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