2 * imstt.c: Console support for PowerMac "imstt" display adaptor.
4 * Copyright (C) 1997 Sigurdur Asgeirsson
5 * Modified by Danilo Beuche 1997
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
12 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/sched.h>
16 #include <linux/delay.h>
17 #include <linux/string.h>
18 #include <linux/vc_ioctl.h>
19 #include <linux/pci.h>
20 #include <linux/nvram.h>
23 #include <asm/pgtable.h>
24 #include <asm/pci-bridge.h>
25 #include <linux/selection.h>
26 #include <linux/vt_kern.h>
27 #include "pmac-cons.h"
45 DP_OCTRL
= 5, /* 0x14 */
46 BLTCTL
= 10, /* 0x28 */
48 // Scan Timing Generator Registers
61 STGCTL
= 24, /* 0x60 */
63 // Screen Refresh Generator Registers
68 SRGCTL
= 29, /* 0x74 */
70 // RAM Refresh Generator Registers
71 RRCIV
= 30, /* 0x78 */
79 SSTATUS
= 36, /* 0x90 */
113 // TI TVP 3030 RAMDAC Direct Registers
116 TVPADDRW
= 0x00, // 0 Palette/Cursor RAM Write Adress/Index
117 TVPPDATA
= 0x04, // 1 Palette Data RAM Data
118 TVPPMASK
= 0x08, // 2 Pixel Read-Mask
119 TVPPADRR
= 0x0c, // 3 Palette/Cursor RAM Read Adress
120 TVPCADRW
= 0x10, // 4 Cursor/Overscan Color Write Address
121 TVPCDATA
= 0x14, // 5 Cursor/Overscan Color Data
123 TVPCADRR
= 0x1c, // 7 Cursor/Overscan Color Read Address
125 TVPDCCTL
= 0x24, // 9 Direct Cursor Control
126 TVPIDATA
= 0x28, // 10 Index Data
127 TVPCRDAT
= 0x2c, // 11 Cursor RAM Data
128 TVPCXPOL
= 0x30, // 12 Cursor-Position X LSB
129 TVPCXPOH
= 0x34, // 13 Cursor-Position X MSB
130 TVPCYPOL
= 0x38, // 14 Cursor-Position Y LSB
131 TVPCYPOH
= 0x3c, // 15 Cursor-Position Y MSB
134 // TI TVP 3030 RAMDAC Indirect Registers
137 TVPIRREV
= 0x01, // Silicon Revision [RO]
138 TVPIRICC
= 0x06, // Indirect Cursor Control (0x00)
139 TVPIRBRC
= 0x07, // Byte Router Control (0xe4)
140 TVPIRLAC
= 0x0f, // Latch Control (0x06)
141 TVPIRTCC
= 0x18, // True Color Control (0x80)
142 TVPIRMXC
= 0x19, // Multiplex Control (0x98)
143 TVPIRCLS
= 0x1a, // Clock Selection (0x07)
144 TVPIRPPG
= 0x1c, // Palette Page (0x00)
145 TVPIRGEC
= 0x1d, // General Control (0x00)
146 TVPIRMIC
= 0x1e, // Miscellaneous Control (0x00)
147 TVPIRPLA
= 0x2c, // PLL Address
148 TVPIRPPD
= 0x2d, // Pixel Clock PLL Data
149 TVPIRMPD
= 0x2e, // Memory Clock PLL Data
150 TVPIRLPD
= 0x2f, // Loop Clock PLL Data
151 TVPIRCKL
= 0x30, // Color-Key Overlay Low
152 TVPIRCKH
= 0x31, // Color-Key Overlay High
153 TVPIRCRL
= 0x32, // Color-Key Red Low
154 TVPIRCRH
= 0x33, // Color-Key Red High
155 TVPIRCGL
= 0x34, // Color-Key Green Low
156 TVPIRCGH
= 0x35, // Color-Key Green High
157 TVPIRCBL
= 0x36, // Color-Key Blue Low
158 TVPIRCBH
= 0x37, // Color-Key Blue High
159 TVPIRCKC
= 0x38, // Color-Key Control (0x00)
160 TVPIRMLC
= 0x39, // MCLK/Loop Clock Control (0x18)
161 TVPIRSEN
= 0x3a, // Sense Test (0x00)
162 TVPIRTMD
= 0x3b, // Test Mode Data
163 TVPIRRML
= 0x3c, // CRC Remainder LSB [RO]
164 TVPIRRMM
= 0x3d, // CRC Remainder MSB [RO]
165 TVPIRRMS
= 0x3e, // CRC Bit Select [WO]
166 TVPIRDID
= 0x3f, // Device ID [RO] (0x30)
167 TVPIRRES
= 0xff, // Software Reset [WO]
173 unsigned char addr
, value
;
178 // Values which only depend on resolution not on color mode
179 struct tt_single_rmodevals
191 struct tvp_single_rmodevals
193 unsigned char pclk_n
;
194 unsigned char pclk_m
;
195 unsigned char pclk_p
;
198 struct ibm_single_rmodevals
200 unsigned char pclk_m
;
201 unsigned char pclk_n
;
202 unsigned char pclk_p
;
203 unsigned char pclk_c
;
206 // Values which only depend on color mode not on resolution
207 struct tvp_single_cmodevals
209 unsigned char tcc
; // True Color control
210 unsigned char mxc
; // Multiplexer control
211 unsigned char lckl_n
; // N value of LCKL PLL
214 struct ibm_single_cmodevals
216 unsigned char pformat
; // pixel format
219 // Values of the tvp which change depending on colormode x resolution
220 struct tvp_single_crmodevals
222 unsigned char mlc
; // Memory Loop Config 0x39
223 unsigned char lckl_p
; // P value of LCKL PLL
226 struct ibm_single_crmodevals
228 // oh nothing changes
231 // complete configuration for a resolution in all depths
232 // 0 = 8 Bit, 15/16 bit = 1 , 32 Bit = 2
233 struct ims_crmodevals
236 struct tt_single_rmodevals tt
[2]; // for each ramdac seperate tt config
238 struct tvp_single_rmodevals tvp_clock
; // for each ramdac seperate clock config
239 struct tvp_single_crmodevals tvp
[3]; // for each colormode
241 struct ibm_single_rmodevals ibm_clock
; // for each ramdac seperate clock config
242 // struct ibm_single_crmodevals ibm[3]; // for each color mode
247 int dac
; // which dac do we have
248 int total_vram
; // how much vram is on board
249 int sense
; // what monitor
250 unsigned char* fb
; // frame buffer address
251 unsigned char* fb_phys
; // frame buffer address
252 unsigned char* cmap
; // dac address
253 unsigned char* cmap_phys
; // dac address
254 unsigned int* dc
; // tt address
255 unsigned int* dc_phys
; // tt address
257 struct initvalues
* init
[2]; // initial register settings for each ramdac
259 struct ims_crmodevals
* mode
[20]; // for each possible mode
261 struct tvp_single_cmodevals tvp
[3]; // for each color mode
263 struct ibm_single_cmodevals ibm
[3]; // for each color mode
267 struct ims_crmodevals imsmode_6
=
271 { 0x08, 0x12, 0x62, 0x6C, 0x0003, 0x002A, 0x020A, 0x020C },
272 { 0x04, 0x0009, 0x0031, 0x0036, 0x0003, 0x002a, 0x020a, 0x020d },
274 { 0xef, 0x2e, 0xb2 },
281 { 0x78, 0x13, 0x02, 0x02 },
284 struct ims_crmodevals imsmode_13
=
288 { 0x05, 0x20, 0x88, 0x90, 0x0003, 0x0028, 0x0298, 0x029B },
289 { 0x04, 0x0011, 0x0045, 0x0048, 0x0003, 0x002a, 0x029a, 0x029b},
291 { 0xfe, 0x3e, 0xf1 },
297 { 0x3E, 0x0A, 0x01, 0x02 }
299 struct ims_crmodevals imsmode_17
=
303 { 0x0A, 0x1C, 0x9C, 0xA6, 0x0003, 0x0020, 0x0320, 0x0323 } ,
304 { 0x06, 0x0210, 0x0250, 0x0053, 0x1003, 0x0021, 0x0321, 0x0324 },
306 { 0xfc, 0x3a, 0xf1 },
312 { 0x07, 0x00, 0x01, 0x02 }
314 struct ims_crmodevals imsmode_18
=
318 { 0, 0, 0, 0, 0, 0, 0, 0 },
319 { 0x09, 0x0011, 0x059, 0x5b, 0x0003, 0x0031, 0x0397, 0x039a },
321 { 0xfd, 0x3a, 0xf1 },
329 struct ims_crmodevals imsmode_19
=
333 { 0, 0, 0, 0, 0, 0, 0, 0 },
334 { 0x09, 0x0016, 0x0066, 0x0069, 0x0003, 0x0027, 0x03e7, 0x03e8 },
336 { 0xf7, 0x36, 0xf0 },
344 struct ims_crmodevals imsmode_20
=
348 { 0, 0, 0, 0, 0, 0, 0, 0 },
349 { 0x09, 0x0018, 0x0068, 0x006a, 0x0003, 0x0029, 0x0429, 0x042a },
351 { 0xf0, 0x2d, 0xf0 },
360 // IBM RAMDAC initial register values
362 static struct initvalues ibm_initregs
[] =
364 { 0x02, 0x21 }, /* (0x01) Miscellaneous Clock Control */
365 { 0x03, 0x00 }, /* (0x00) Sync Control */
366 { 0x04, 0x00 }, /* (0x00) Horizontal Sync Position */
367 { 0x05, 0x00 }, /* (0x00) Power Management */
368 { 0x06, 0x0B }, /* (0x02) DAC Operation */
369 { 0x07, 0x00 }, /* (0x00) Palette Control */
370 { 0x08, 0x01 }, /* (0x01) System Clock Control */
371 { 0x0B, 0x00 }, /* (U) 8 BPP Control */
372 { 0x0C, 0xC4 }, /* (U) 16 BPP Control */
373 { 0x0D, 0x00 }, /* (U) 24 BPP Packed Control */
374 { 0x0E, 0x03 }, /* (U) 32 BPP Control */
375 { 0x10, 0x05 }, /* (0x00) Pixel PLL Control 1 */
376 { 0x11, 0x00 }, /* (0x00) Pixel PLL Control 2 */
377 { 0x15, 0x08 }, /* (0x08) SYSCLK N (System PLL Reference Divider) */
378 { 0x16, 0x57 }, /* (0x41) SYSCLK M (System PLL VCO Divider) */
379 { 0x17, 0x00 }, /* (U) SYSCLK P */
380 { 0x18, 0x00 }, /* (U) SYSCLK C */
381 { 0x30, 0x00 }, /* (0x00) Cursor Control */
382 { 0x60, 0xFF }, /* (U) Border Color Red */
383 { 0x61, 0xFF }, /* (U) Border Color Green */
384 { 0x62, 0xFF }, /* (U) Border Color Blue */
385 { 0x70, 0x01 }, /* (0x00) Miscellaneous Control 1 */
386 { 0x71, 0x45 }, /* (0x00) Miscellaneous Control 2 */
387 { 0x72, 0x00 }, /* (0x00) Miscellaneous Control 3 */
388 { 0x78, 0x00 }, /* (0x00) Key Control/DB Operation */
393 static struct initvalues tvp_initregs
[] =
429 static struct ims_modevals ims_info
=
435 0, // Framebuffer_phys
440 { ibm_initregs
, tvp_initregs
},
464 { 0x80, 0x4d, 0xc1 },
465 { 0x44, 0x55, 0xe1 },
478 // static void set_imstt_clock(unsigned char *params);
479 static void map_imstt_display(struct device_node
*, int);
480 static int read_imstt_sense(void);
481 static int imstt_vram_reqd(int vmode
, int cmode
);
485 static int get_tvp_ireg(int iaddr
)
487 ims_info
.cmap
[0] = iaddr
& 0xff; eieio();
488 return ims_info
.cmap
[40];
492 static void set_tvp_ireg(int iaddr
,unsigned char value
)
494 ims_info
.cmap
[0] = iaddr
& 0xff; eieio();
495 ims_info
.cmap
[40] = value
; eieio();
498 * Get the monitor sense value.
499 * Note that this can be called before calibrate_delay,
500 * so we can't use udelay.
509 gio
= ld_le32(ims_info
.dc
+ GIO
) & ~0x0038;
512 out_le32(ims_info
.dc
+ GIOE
, reg
); /* drive all lines high */
514 out_le32(ims_info
.dc
+ GIOE
, 077); /* turn off drivers */
516 sense
= (in_le32(ims_info
.dc
+ GIOE
) & 0x1c0) << 2;
518 /* drive each sense line low in turn and collect the other 2 */
519 out_le32(ims_info
.dc
+ GIOE
, 033); /* drive A low */
521 sense
|= (in_le32(ims_info
.dc
+ GIOE
) & 0xc0) >> 2;
522 out_le32(ims_info
.dc
+ GIOE
, 055); /* drive B low */
524 sense
|= ((in_le32(ims_info
.dc
+ GIOE
) & 0x100) >> 5)
525 | ((in_le32(ims_info
.dc
+ GIOE
) & 0x40) >> 4);
526 out_le32(ims_info
.dc
+ GIOE
, 066); /* drive C low */
528 sense
|= (in_le32(ims_info
.dc
+ GIOE
) & 0x180) >> 7;
530 out_le32(ims_info
.dc
+ GIOE
, 077); /* turn off drivers */
537 static inline int imstt_vram_reqd(int vmode
, int cmode
)
539 return vmode_attrs
[vmode
-1].vres
*
540 (ims_info
.mode
[vmode
-1])->pitch
* ( 1 << cmode
);
544 map_imstt_display_tvp(struct device_node
*dp
)
546 map_imstt_display(dp
,1);
550 map_imstt_display_ibm(struct device_node
*dp
)
552 map_imstt_display(dp
,0);
556 map_imstt_display(struct device_node
*dp
, int which
)
559 unsigned long addr
, size
, tmp
;
560 unsigned char bus
, devfn
;
564 printk("Warning: only using first imstt display device\n");
567 printk("pmac_display_init: node = %p, addrs =", dp
->node
);
568 for (i
= 0; i
< dp
->n_addrs
; ++i
)
569 printk(" %x(%x)", dp
->addrs
[i
].address
, dp
->addrs
[i
].size
);
571 for (i
= 0; i
< dp
->n_intrs
; ++i
)
572 printk(" %x", dp
->intrs
[i
]);
576 /* Map in frame buffer and registers */
577 for (i
= 0; i
< dp
->n_addrs
; ++i
) {
578 addr
= dp
->addrs
[i
].address
;
579 size
= dp
->addrs
[i
].size
;
580 if (size
>= 0x02000000) {
581 ims_info
.fb
= __ioremap(addr
, size
, _PAGE_NO_CACHE
);
582 ims_info
.fb_phys
= (unsigned char*)addr
;
583 ims_info
.dc
= (unsigned*)(ims_info
.fb
+ 0x00800000);
584 ims_info
.dc_phys
= (unsigned*)(ims_info
.fb_phys
+ 0x00800000);
585 ims_info
.cmap
= (unsigned char*)(ims_info
.fb
+ 0x00840000);
586 ims_info
.cmap_phys
= (unsigned char*)(ims_info
.fb_phys
+ 0x00840000);
587 printk("mapped ims_info.fb=%x(%x)", (unsigned)ims_info
.fb
, (unsigned)size
);
588 printk(" ims_info.dc=%x, ims_info.cmap=%x\n", (unsigned)ims_info
.dc
, (unsigned)ims_info
.cmap
);
592 /* enable memory-space accesses using config-space command register */
593 if (pci_device_loc(dp
, &bus
, &devfn
) == 0) {
594 pcibios_read_config_word(bus
, devfn
, PCI_COMMAND
, &cmd
);
596 printk("command word 0x%04X\n", cmd
);
599 cmd
|= PCI_COMMAND_MEMORY
;
600 pcibios_write_config_word(bus
, devfn
, PCI_COMMAND
, cmd
);
604 printk("unable to find pci device\n");
606 tmp
= in_le32(ims_info
.dc
+ SSTATUS
);
607 printk("chip version %ld, ", (tmp
& 0x0F00) >> 8);
609 tmp
= in_le32(ims_info
.dc
+ PRC
);
612 ims_info
.total_vram
= (tmp
& 0x0004) ? 0x000400000L
: 0x000200000L
;
614 ims_info
.total_vram
= 0x000800000L
;
616 printk("VRAM size %ldM\n", ims_info
.total_vram
/ 0x000100000L
);
618 if (ims_info
.total_vram
== 0x000800000L
)
620 ims_info
.dac
= TVPRAMDAC
;
621 printk("Selecting TVP 3030 RAMDAC\n");
625 ims_info
.dac
= IBMRAMDAC
;
626 printk("Selecting IBM RAMDAC\n");
629 sense
= read_imstt_sense();
630 printk("Monitor sense value = 0x%x, ", sense
);
632 if (video_mode
== VMODE_NVRAM
) {
633 video_mode
= nvram_read_byte(NV_VMODE
);
634 if (video_mode
<= 0 || video_mode
> VMODE_MAX
635 || imstt_reg_init
[video_mode
-1] == 0)
636 video_mode
= VMODE_CHOOSE
;
638 if (video_mode
== VMODE_CHOOSE
)
639 video_mode
= map_monitor_sense(sense
);
640 if (imstt_reg_init
[video_mode
-1] == 0)
641 video_mode
= VMODE_640_480_67
;
644 * Reduce the pixel size if we don't have enough VRAM.
646 if (color_mode
== CMODE_NVRAM
)
647 color_mode
= nvram_read_byte(NV_CMODE
);
648 if (color_mode
< CMODE_8
|| color_mode
> CMODE_32
)
649 color_mode
= CMODE_8
;
650 while (color_mode
> CMODE_8
651 && imstt_vram_reqd(video_mode
, color_mode
) > ims_info
.total_vram
)
655 // Hack Hack Hack !!!
656 video_mode
= VMODE_640_480_67
;
657 color_mode
= CMODE_8
;
661 * We dont need it ( all is done in ims_init )
663 set_imstt_clock_tvp(char* tvprv)
668 set_tvp_ireg(TVPIRPLA,(j << 4) | (j << 2) | j); // Select same value for all plls
669 set_tvp_ireg(TVPIRPPD,tvprv[j]);
670 set_tvp_ireg(TVPIRMPD,tvprv[3+j]);
671 set_tvp_ireg(TVPIRLPD,tvprv[6+j]);
676 set_imstt_clock_ibm(unsigned char *params)
678 ims_info.cmap[PIDXHI] = 0; eieio();
679 ims_info.cmap[PIDXLO] = PM0; eieio();
680 ims_info.cmap[PIDXDATA] = params[0]; eieio();
682 ims_info.cmap[PIDXLO] = PN0; eieio();
683 ims_info.cmap[PIDXDATA] = params[1]; eieio();
685 ims_info.cmap[PIDXLO] = PP0; eieio();
686 ims_info.cmap[PIDXDATA] = params[2]; eieio();
688 ims_info.cmap[PIDXLO] = PC0; eieio();
689 ims_info.cmap[PIDXDATA] = params[3]; eieio();
697 unsigned long ctl
, pitch
, tmp
, scrCmode
;
698 struct ims_crmodevals
*init
;
700 if (video_mode
<= 0 || video_mode
> VMODE_MAX
) panic("imstt: display mode %d not supported(not in valid range)", video_mode
);
701 if ((init
= ims_info
.mode
[video_mode
-1]) == 0) panic("imstt: display mode %d not supported(no mode definition)", video_mode
);
702 if (init
->tt
[ims_info
.dac
].vt
== 0) panic("imstt: display mode %d not supported (no timing definition)", video_mode
);
705 n_scanlines
= vmode_attrs
[video_mode
-1].vres
;
706 hres
= vmode_attrs
[video_mode
-1].hres
;
707 pixel_size
= 1 << color_mode
;
708 line_pitch
= init
->pitch
* pixel_size
;
709 row_pitch
= line_pitch
* 16;
711 /* initialize the card */
712 tmp
= in_le32(ims_info
.dc
+ STGCTL
);
713 out_le32(ims_info
.dc
+ STGCTL
, tmp
& ~0x1);
715 out_le32(ims_info
.dc
+ SCR
, 0);
721 ims_info
.cmap
[PPMASK
] = 0xFF; eieio();
722 ims_info
.cmap
[PIDXHI
] = 0x00; eieio();
723 for (i
= 0; ims_info
.init
[IBMRAMDAC
][i
].addr
!= 0 && ims_info
.init
[IBMRAMDAC
][i
].value
!= 0 ;i
++)
725 ims_info
.cmap
[PIDXLO
] = ims_info
.init
[IBMRAMDAC
][i
].addr
; eieio();
726 ims_info
.cmap
[PIDXDATA
] = ims_info
.init
[IBMRAMDAC
][i
].value
; eieio();
729 ims_info
.cmap
[PIDXHI
] = 0; eieio();
730 ims_info
.cmap
[PIDXLO
] = PM0
; eieio();
731 ims_info
.cmap
[PIDXDATA
] = init
->ibm_clock
.pclk_m
; eieio();
733 ims_info
.cmap
[PIDXLO
] = PN0
; eieio();
734 ims_info
.cmap
[PIDXDATA
] = init
->ibm_clock
.pclk_n
; eieio();
736 ims_info
.cmap
[PIDXLO
] = PP0
; eieio();
737 ims_info
.cmap
[PIDXDATA
] = init
->ibm_clock
.pclk_p
; eieio();
739 ims_info
.cmap
[PIDXLO
] = PC0
; eieio();
740 ims_info
.cmap
[PIDXDATA
] = init
->ibm_clock
.pclk_c
; eieio();
742 ims_info
.cmap
[PIDXLO
] = PPIXREP
; eieio();
743 ims_info
.cmap
[PIDXDATA
] = ims_info
.ibm
[color_mode
].pformat
; eieio();
747 for (i
= 0; ims_info
.init
[TVPRAMDAC
][i
].addr
!= 0 && ims_info
.init
[TVPRAMDAC
][i
].value
!= 0 ;i
++)
749 set_tvp_ireg(ims_info
.init
[TVPRAMDAC
][i
].addr
,ims_info
.init
[TVPRAMDAC
][i
].value
);
751 set_tvp_ireg(TVPIRPLA
,0x00);
752 set_tvp_ireg(TVPIRPPD
,init
->tvp_clock
.pclk_n
);
753 set_tvp_ireg(TVPIRPPD
,init
->tvp_clock
.pclk_m
);
754 set_tvp_ireg(TVPIRPPD
,init
->tvp_clock
.pclk_p
);
756 set_tvp_ireg(TVPIRTCC
,ims_info
.tvp
[color_mode
].tcc
);
757 set_tvp_ireg(TVPIRMXC
,ims_info
.tvp
[color_mode
].mxc
);
759 set_tvp_ireg(TVPIRPLA
,0x00);
760 set_tvp_ireg(TVPIRLPD
,ims_info
.tvp
[color_mode
].lckl_n
);
762 set_tvp_ireg(TVPIRPLA
,0x15);
763 set_tvp_ireg(TVPIRMLC
,(init
->tvp
[color_mode
]).mlc
);
765 set_tvp_ireg(TVPIRPLA
,0x2a);
766 set_tvp_ireg(TVPIRLPD
,init
->tvp
[color_mode
].lckl_p
);
779 pitch
= init
->pitch
/ 2;
785 pitch
= init
->pitch
/ 4;
790 out_le32(&ims_info
.dc
[HES
], init
->tt
[ims_info
.dac
].hes
);
791 out_le32(&ims_info
.dc
[HEB
], init
->tt
[ims_info
.dac
].heb
);
792 out_le32(&ims_info
.dc
[HSB
], init
->tt
[ims_info
.dac
].hsb
);
793 out_le32(&ims_info
.dc
[HT
], init
->tt
[ims_info
.dac
].ht
);
794 out_le32(&ims_info
.dc
[VES
], init
->tt
[ims_info
.dac
].ves
);
795 out_le32(&ims_info
.dc
[VEB
], init
->tt
[ims_info
.dac
].veb
);
796 out_le32(&ims_info
.dc
[VSB
], init
->tt
[ims_info
.dac
].vsb
);
797 out_le32(&ims_info
.dc
[VT
], init
->tt
[ims_info
.dac
].vt
);
798 out_le32(&ims_info
.dc
[HCIV
], 1);
799 out_le32(&ims_info
.dc
[VCIV
], 1);
800 out_le32(&ims_info
.dc
[TCDR
], 4);
801 out_le32(&ims_info
.dc
[VIL
], 0);
803 out_le32(&ims_info
.dc
[SSR
], 0);
804 out_le32(&ims_info
.dc
[HRIR
], 0x0200);
805 out_le32(&ims_info
.dc
[CMR
], 0x01FF);
806 out_le32(&ims_info
.dc
[SRGCTL
], 0x0003);
807 switch(ims_info
.total_vram
)
810 out_le32(&ims_info
.dc
[SCR
], 0x0059D| scrCmode
);
814 out_le32(&ims_info
.dc
[SCR
], 0x00D0DC | scrCmode
);
818 out_le32(&ims_info
.dc
[SCR
], 0x0150DD | scrCmode
);
822 out_le32(&ims_info
.dc
[SPR
], pitch
);
824 if (ims_info
.dac
== IBMRAMDAC
)
830 pmac_init_palette(); /* Initialize colormap */
832 out_le32(&ims_info
.dc
[STGCTL
], ctl
);
834 yoff
= (n_scanlines
% 16) / 2;
835 fb_start
= ims_info
.fb
+ yoff
* line_pitch
;
840 p
= (unsigned long*)ims_info
.fb
;
841 for (i
= n_scanlines
* line_pitch
/ sizeof(unsigned); i
!= 0; --i
)
845 display_info
.height
= n_scanlines
;
846 display_info
.width
= hres
;
847 display_info
.depth
= pixel_size
* 8;
848 display_info
.pitch
= line_pitch
;
849 display_info
.mode
= video_mode
;
851 if (ims_info
.dac
== IBMRAMDAC
)
852 strncpy(display_info
.name
, "IMS,tt128mb2/4", sizeof(display_info
.name
));
854 strncpy(display_info
.name
, "IMS,tt128mb8/8A", sizeof(display_info
.name
));
856 display_info
.fb_address
= (unsigned long) ims_info
.fb_phys
;
857 display_info
.cmap_adr_address
= (unsigned long) &ims_info
.cmap_phys
[PADDRW
];
858 display_info
.cmap_data_address
= (unsigned long) &ims_info
.cmap_phys
[PDATA
];
859 display_info
.disp_reg_address
= (unsigned long) NULL
;
863 imstt_setmode(struct vc_mode
*mode
, int doit
)
866 struct ims_crmodevals
*init
;
868 if (video_mode
<= 0 || video_mode
> VMODE_MAX
)
870 if ((init
= ims_info
.mode
[video_mode
-1]) == 0)
872 if (init
->tt
[ims_info
.dac
].vt
== 0)
875 if (mode
->mode
<= 0 || mode
->mode
> VMODE_MAX
876 || (ims_info
.mode
[mode
->mode
-1] == 0))
878 switch (mode
->depth
) {
887 case 0: /* (default) */
893 if (imstt_vram_reqd(mode
->mode
, cmode
) > ims_info
.total_vram
)
896 video_mode
= mode
->mode
;
903 // set palette for TI TVP3030 ramdac (used on 8MB version)
905 imstt_set_palette_tvp(unsigned char red
[], unsigned char green
[],
906 unsigned char blue
[], int index
, int ncolors
)
909 for (i
= 0; i
< ncolors
; ++i
) {
910 ims_info
.cmap
[TVPADDRW
] = index
+ i
; eieio();
911 ims_info
.cmap
[TVPPDATA
] = red
[i
]; eieio();
912 ims_info
.cmap
[TVPPDATA
] = green
[i
]; eieio();
913 ims_info
.cmap
[TVPPDATA
] = blue
[i
]; eieio();
917 // set palette for IBM ramdac (used on 2MB/4MB version)
919 imstt_set_palette_ibm(unsigned char red
[], unsigned char green
[],
920 unsigned char blue
[], int index
, int ncolors
)
924 for (i
= 0; i
< ncolors
; ++i
) {
925 ims_info
.cmap
[PADDRW
] = index
+ i
; eieio();
926 ims_info
.cmap
[PDATA
] = red
[i
]; eieio();
927 ims_info
.cmap
[PDATA
] = green
[i
]; eieio();
928 ims_info
.cmap
[PDATA
] = blue
[i
]; eieio();
933 imstt_set_blanking(int blank_mode
)
937 ctrl
= ld_le32(ims_info
.dc
+ STGCTL
) | 0x0030;
938 if (blank_mode
& VESA_VSYNC_SUSPEND
)
940 if (blank_mode
& VESA_HSYNC_SUSPEND
)
942 out_le32(ims_info
.dc
+ STGCTL
, ctrl
);