Home | History | Annotate | Line # | Download | only in ic
igsfb_subr.c revision 1.4.12.1
      1  1.4.12.1  yamt /*	$NetBSD: igsfb_subr.c,v 1.4.12.1 2006/06/21 15:02:55 yamt Exp $ */
      2       1.1   uwe 
      3       1.1   uwe /*
      4       1.1   uwe  * Copyright (c) 2002 Valeriy E. Ushakov
      5       1.1   uwe  * All rights reserved.
      6       1.1   uwe  *
      7       1.1   uwe  * Redistribution and use in source and binary forms, with or without
      8       1.1   uwe  * modification, are permitted provided that the following conditions
      9       1.1   uwe  * are met:
     10       1.1   uwe  * 1. Redistributions of source code must retain the above copyright
     11       1.1   uwe  *    notice, this list of conditions and the following disclaimer.
     12       1.1   uwe  * 2. Redistributions in binary form must reproduce the above copyright
     13       1.1   uwe  *    notice, this list of conditions and the following disclaimer in the
     14       1.1   uwe  *    documentation and/or other materials provided with the distribution.
     15       1.1   uwe  * 3. The name of the author may not be used to endorse or promote products
     16       1.1   uwe  *    derived from this software without specific prior written permission
     17       1.1   uwe  *
     18       1.1   uwe  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19       1.1   uwe  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20       1.1   uwe  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21       1.1   uwe  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22       1.1   uwe  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     23       1.1   uwe  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     24       1.1   uwe  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     25       1.1   uwe  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26       1.1   uwe  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27       1.1   uwe  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28       1.1   uwe  */
     29       1.1   uwe 
     30       1.1   uwe /*
     31       1.1   uwe  * Integraphics Systems IGA 168x and CyberPro series.
     32       1.1   uwe  */
     33       1.1   uwe #include <sys/cdefs.h>
     34  1.4.12.1  yamt __KERNEL_RCSID(0, "$NetBSD: igsfb_subr.c,v 1.4.12.1 2006/06/21 15:02:55 yamt Exp $");
     35       1.1   uwe 
     36       1.1   uwe #include <sys/param.h>
     37       1.1   uwe #include <sys/systm.h>
     38       1.1   uwe #include <sys/kernel.h>
     39       1.1   uwe #include <sys/device.h>
     40       1.1   uwe 
     41       1.1   uwe #include <machine/bus.h>
     42       1.1   uwe 
     43       1.2   uwe #include <dev/wscons/wsdisplayvar.h>
     44       1.1   uwe #include <dev/wscons/wsconsio.h>
     45       1.2   uwe #include <dev/rasops/rasops.h>
     46  1.4.12.1  yamt #include <dev/wscons/wsdisplay_vconsvar.h>
     47       1.1   uwe 
     48       1.1   uwe #include <dev/ic/igsfbreg.h>
     49       1.1   uwe #include <dev/ic/igsfbvar.h>
     50       1.1   uwe 
     51       1.1   uwe 
     52       1.2   uwe static void	igsfb_init_seq(struct igsfb_devconfig *);
     53       1.2   uwe static void	igsfb_init_crtc(struct igsfb_devconfig *);
     54       1.2   uwe static void	igsfb_init_grfx(struct igsfb_devconfig *);
     55       1.2   uwe static void	igsfb_init_attr(struct igsfb_devconfig *);
     56       1.2   uwe static void	igsfb_init_ext(struct igsfb_devconfig *);
     57       1.2   uwe static void	igsfb_init_dac(struct igsfb_devconfig *);
     58       1.1   uwe 
     59       1.2   uwe static void	igsfb_freq_latch(struct igsfb_devconfig *);
     60       1.2   uwe static void	igsfb_video_on(struct igsfb_devconfig *);
     61       1.1   uwe 
     62       1.1   uwe 
     63       1.1   uwe 
     64       1.1   uwe /*
     65       1.1   uwe  * Enable chip.
     66       1.1   uwe  */
     67       1.1   uwe int
     68  1.4.12.1  yamt igsfb_enable(bus_space_tag_t iot, bus_addr_t iobase, int ioflags)
     69       1.1   uwe {
     70       1.1   uwe 	bus_space_handle_t vdoh;
     71       1.1   uwe 	bus_space_handle_t vseh;
     72       1.1   uwe 	bus_space_handle_t regh;
     73       1.1   uwe 	int ret;
     74       1.1   uwe 
     75       1.2   uwe 	ret = bus_space_map(iot, iobase + IGS_VDO, 1, ioflags, &vdoh);
     76       1.1   uwe 	if (ret != 0) {
     77       1.1   uwe 		printf("unable to map VDO register\n");
     78       1.1   uwe 		goto out0;
     79       1.1   uwe 	}
     80       1.1   uwe 
     81       1.2   uwe 	ret = bus_space_map(iot, iobase + IGS_VSE, 1, ioflags, &vseh);
     82       1.1   uwe 	if (ret != 0) {
     83       1.1   uwe 		printf("unable to map VSE register\n");
     84       1.1   uwe 		goto out1;
     85       1.1   uwe 	}
     86       1.1   uwe 
     87       1.2   uwe 	ret = bus_space_map(iot, iobase + IGS_REG_BASE, IGS_REG_SIZE, ioflags,
     88       1.2   uwe 			    &regh);
     89       1.1   uwe 	if (ret != 0) {
     90       1.1   uwe 		printf("unable to map I/O registers\n");
     91       1.1   uwe 		goto out2;
     92       1.1   uwe 	}
     93       1.1   uwe 
     94       1.1   uwe 	/*
     95       1.1   uwe 	 * Start decoding i/o space accesses.
     96       1.1   uwe 	 */
     97       1.1   uwe 	bus_space_write_1(iot, vdoh, 0, IGS_VDO_ENABLE | IGS_VDO_SETUP);
     98       1.1   uwe 	bus_space_write_1(iot, vseh, 0, IGS_VSE_ENABLE);
     99       1.1   uwe 	bus_space_write_1(iot, vdoh, 0, IGS_VDO_ENABLE);
    100       1.1   uwe 
    101       1.1   uwe 	/*
    102       1.1   uwe 	 * Start decoding memory space accesses (XXX: move out of here?
    103       1.1   uwe 	 * we program this register in igsfb_init_ext).
    104       1.1   uwe 	 * While here, enable coprocessor and select IGS_COP_BASE_B.
    105       1.1   uwe 	 */
    106       1.1   uwe 	igs_ext_write(iot, regh, IGS_EXT_BIU_MISC_CTL,
    107       1.1   uwe 		      (IGS_EXT_BIU_LINEAREN
    108       1.1   uwe 		       | IGS_EXT_BIU_COPREN | IGS_EXT_BIU_COPASELB));
    109       1.1   uwe 
    110       1.1   uwe 	bus_space_unmap(iot, regh, IGS_REG_SIZE);
    111       1.1   uwe   out2:	bus_space_unmap(iot, vseh, 1);
    112       1.1   uwe   out1:	bus_space_unmap(iot, vdoh, 1);
    113  1.4.12.1  yamt   out0: return ret;
    114       1.1   uwe }
    115       1.1   uwe 
    116       1.1   uwe 
    117       1.1   uwe /*
    118       1.1   uwe  * Init sequencer.
    119       1.1   uwe  * This is common for all video modes.
    120       1.1   uwe  */
    121       1.1   uwe static void
    122  1.4.12.1  yamt igsfb_init_seq(struct igsfb_devconfig *dc)
    123       1.1   uwe {
    124       1.2   uwe 	bus_space_tag_t iot = dc->dc_iot;
    125       1.2   uwe 	bus_space_handle_t ioh = dc->dc_ioh;
    126       1.1   uwe 
    127       1.1   uwe 	/* start messing with sequencer */
    128       1.1   uwe 	igs_seq_write(iot, ioh, IGS_SEQ_RESET, 0);
    129       1.1   uwe 
    130       1.1   uwe 	igs_seq_write(iot, ioh, 1, 0x01); /* 8 dot clock */
    131       1.1   uwe 	igs_seq_write(iot, ioh, 2, 0x0f); /* enable all maps */
    132       1.1   uwe 	igs_seq_write(iot, ioh, 3, 0x00); /* character generator */
    133       1.1   uwe 	igs_seq_write(iot, ioh, 4, 0x0e); /* memory mode */
    134       1.1   uwe 
    135       1.1   uwe 	/* this selects color mode among other things */
    136       1.1   uwe 	bus_space_write_1(iot, ioh, IGS_MISC_OUTPUT_W, 0xef);
    137       1.1   uwe 
    138       1.1   uwe 	/* normal sequencer operation */
    139       1.1   uwe 	igs_seq_write(iot, ioh, IGS_SEQ_RESET,
    140       1.1   uwe 		      IGS_SEQ_RESET_SYNC | IGS_SEQ_RESET_ASYNC);
    141       1.1   uwe }
    142       1.1   uwe 
    143  1.4.12.1  yamt 
    144       1.1   uwe /*
    145       1.1   uwe  * Init CRTC to 640x480 8bpp at 60Hz
    146       1.1   uwe  */
    147       1.1   uwe static void
    148  1.4.12.1  yamt igsfb_init_crtc(struct igsfb_devconfig *dc)
    149       1.1   uwe {
    150       1.2   uwe 	bus_space_tag_t iot = dc->dc_iot;
    151       1.2   uwe 	bus_space_handle_t ioh = dc->dc_ioh;
    152       1.1   uwe 
    153       1.1   uwe 	igs_crtc_write(iot, ioh, 0x00, 0x5f);
    154       1.1   uwe 	igs_crtc_write(iot, ioh, 0x01, 0x4f);
    155       1.1   uwe 	igs_crtc_write(iot, ioh, 0x02, 0x50);
    156       1.1   uwe 	igs_crtc_write(iot, ioh, 0x03, 0x80);
    157       1.1   uwe 	igs_crtc_write(iot, ioh, 0x04, 0x52);
    158       1.1   uwe 	igs_crtc_write(iot, ioh, 0x05, 0x9d);
    159       1.1   uwe 	igs_crtc_write(iot, ioh, 0x06, 0x0b);
    160       1.1   uwe 	igs_crtc_write(iot, ioh, 0x07, 0x3e);
    161       1.1   uwe 
    162       1.1   uwe 	/* next block is almost constant, only bit 6 in reg 9 differs */
    163       1.1   uwe 	igs_crtc_write(iot, ioh, 0x08, 0x00);
    164       1.1   uwe 	igs_crtc_write(iot, ioh, 0x09, 0x40); /* <- either 0x40 or 0x60 */
    165       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0a, 0x00);
    166       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0b, 0x00);
    167       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0c, 0x00);
    168       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0d, 0x00);
    169       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0e, 0x00);
    170       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0f, 0x00);
    171       1.1   uwe 
    172       1.1   uwe 	igs_crtc_write(iot, ioh, 0x10, 0xe9);
    173       1.1   uwe 	igs_crtc_write(iot, ioh, 0x11, 0x8b);
    174       1.1   uwe 	igs_crtc_write(iot, ioh, 0x12, 0xdf);
    175       1.1   uwe 	igs_crtc_write(iot, ioh, 0x13, 0x50);
    176       1.1   uwe 	igs_crtc_write(iot, ioh, 0x14, 0x00);
    177       1.1   uwe 	igs_crtc_write(iot, ioh, 0x15, 0xe6);
    178       1.1   uwe 	igs_crtc_write(iot, ioh, 0x16, 0x04);
    179       1.1   uwe 	igs_crtc_write(iot, ioh, 0x17, 0xc3);
    180       1.1   uwe 
    181       1.1   uwe 	igs_crtc_write(iot, ioh, 0x18, 0xff);
    182       1.1   uwe }
    183       1.1   uwe 
    184       1.1   uwe 
    185       1.1   uwe /*
    186       1.1   uwe  * Init graphics controller.
    187       1.1   uwe  * This is common for all video modes.
    188       1.1   uwe  */
    189       1.1   uwe static void
    190  1.4.12.1  yamt igsfb_init_grfx(struct igsfb_devconfig *dc)
    191       1.1   uwe {
    192       1.2   uwe 	bus_space_tag_t iot = dc->dc_iot;
    193       1.2   uwe 	bus_space_handle_t ioh = dc->dc_ioh;
    194       1.1   uwe 
    195       1.1   uwe 	igs_grfx_write(iot, ioh, 0, 0x00);
    196       1.1   uwe 	igs_grfx_write(iot, ioh, 1, 0x00);
    197       1.1   uwe 	igs_grfx_write(iot, ioh, 2, 0x00);
    198       1.1   uwe 	igs_grfx_write(iot, ioh, 3, 0x00);
    199       1.1   uwe 	igs_grfx_write(iot, ioh, 4, 0x00);
    200       1.1   uwe 	igs_grfx_write(iot, ioh, 5, 0x60); /* SRMODE, MODE256 */
    201       1.1   uwe 	igs_grfx_write(iot, ioh, 6, 0x05); /* 64k @ a0000, GRAPHICS */
    202       1.1   uwe 	igs_grfx_write(iot, ioh, 7, 0x0f); /* color compare all */
    203       1.1   uwe 	igs_grfx_write(iot, ioh, 8, 0xff); /* bitmask = all bits mutable */
    204       1.1   uwe }
    205       1.1   uwe 
    206       1.1   uwe 
    207       1.1   uwe /*
    208       1.1   uwe  * Init attribute controller.
    209       1.1   uwe  * This is common for all video modes.
    210       1.1   uwe  */
    211       1.1   uwe static void
    212  1.4.12.1  yamt igsfb_init_attr(struct igsfb_devconfig *dc)
    213       1.1   uwe {
    214       1.2   uwe 	bus_space_tag_t iot = dc->dc_iot;
    215       1.2   uwe 	bus_space_handle_t ioh = dc->dc_ioh;
    216       1.1   uwe 	int i;
    217       1.1   uwe 
    218       1.1   uwe 	igs_attr_flip_flop(iot, ioh);	/* reset attr flip-flop to address */
    219       1.1   uwe 
    220       1.1   uwe 	for (i = 0; i < 16; ++i)	/* crt palette */
    221       1.1   uwe 		igs_attr_write(iot, ioh, i, i);
    222       1.1   uwe 
    223       1.1   uwe 	igs_attr_write(iot, ioh, 0x10, 0x01); /* select graphic mode */
    224       1.1   uwe 	igs_attr_write(iot, ioh, 0x11, 0x00); /* crt overscan color */
    225       1.1   uwe 	igs_attr_write(iot, ioh, 0x12, 0x0f); /* color plane enable */
    226       1.1   uwe 	igs_attr_write(iot, ioh, 0x13, 0x00);
    227       1.1   uwe 	igs_attr_write(iot, ioh, 0x14, 0x00);
    228       1.1   uwe }
    229       1.1   uwe 
    230       1.1   uwe 
    231       1.1   uwe /*
    232       1.1   uwe  * When done with ATTR controller, call this to unblank the screen.
    233       1.1   uwe  */
    234       1.1   uwe static void
    235  1.4.12.1  yamt igsfb_video_on(struct igsfb_devconfig *dc)
    236       1.1   uwe {
    237       1.2   uwe 	bus_space_tag_t iot = dc->dc_iot;
    238       1.2   uwe 	bus_space_handle_t ioh = dc->dc_ioh;
    239       1.1   uwe 
    240       1.1   uwe 	igs_attr_flip_flop(iot, ioh);
    241       1.1   uwe 	bus_space_write_1(iot, ioh, IGS_ATTR_IDX, 0x20);
    242       1.1   uwe 	bus_space_write_1(iot, ioh, IGS_ATTR_IDX, 0x20);
    243       1.1   uwe }
    244       1.1   uwe 
    245       1.1   uwe 
    246       1.1   uwe /*
    247       1.1   uwe  * Latch VCLK (b0/b1) and MCLK (b2/b3) values.
    248       1.1   uwe  */
    249       1.1   uwe static void
    250  1.4.12.1  yamt igsfb_freq_latch(struct igsfb_devconfig *dc)
    251       1.1   uwe {
    252       1.2   uwe 	bus_space_tag_t iot = dc->dc_iot;
    253       1.2   uwe 	bus_space_handle_t ioh = dc->dc_ioh;
    254       1.1   uwe 
    255       1.1   uwe 	bus_space_write_1(iot, ioh, IGS_EXT_IDX, 0xb9);
    256       1.1   uwe 	bus_space_write_1(iot, ioh, IGS_EXT_PORT, 0x80);
    257       1.1   uwe 	bus_space_write_1(iot, ioh, IGS_EXT_PORT, 0x00);
    258       1.1   uwe }
    259       1.1   uwe 
    260       1.1   uwe 
    261       1.1   uwe static void
    262  1.4.12.1  yamt igsfb_init_ext(struct igsfb_devconfig *dc)
    263       1.1   uwe {
    264       1.2   uwe 	bus_space_tag_t iot = dc->dc_iot;
    265       1.2   uwe 	bus_space_handle_t ioh = dc->dc_ioh;
    266       1.2   uwe 	int is_cyberpro = (dc->dc_id >= 0x2000);
    267       1.1   uwe 
    268       1.1   uwe 	igs_ext_write(iot, ioh, 0x10, 0x10); /* IGS_EXT_START_ADDR enable */
    269       1.1   uwe 	igs_ext_write(iot, ioh, 0x12, 0x00); /* IGS_EXT_IRQ_CTL disable  */
    270       1.1   uwe 	igs_ext_write(iot, ioh, 0x13, 0x00); /* MBZ for normal operation */
    271       1.1   uwe 
    272       1.1   uwe 	igs_ext_write(iot, ioh, 0x31, 0x00); /* segment write ptr */
    273       1.1   uwe 	igs_ext_write(iot, ioh, 0x32, 0x00); /* segment read ptr */
    274       1.1   uwe 
    275       1.3   uwe 	/* IGS_EXT_BIU_MISC_CTL: linearen, copren, copaselb, segon */
    276       1.3   uwe 	igs_ext_write(iot, ioh, 0x33, 0x1d);
    277       1.1   uwe 
    278       1.1   uwe 	/* sprite location */
    279       1.1   uwe 	igs_ext_write(iot, ioh, 0x50, 0x00);
    280       1.1   uwe 	igs_ext_write(iot, ioh, 0x51, 0x00);
    281       1.1   uwe 	igs_ext_write(iot, ioh, 0x52, 0x00);
    282       1.1   uwe 	igs_ext_write(iot, ioh, 0x53, 0x00);
    283       1.1   uwe 	igs_ext_write(iot, ioh, 0x54, 0x00);
    284       1.1   uwe 	igs_ext_write(iot, ioh, 0x55, 0x00);
    285       1.1   uwe 	igs_ext_write(iot, ioh, 0x56, 0x00); /* sprite control */
    286       1.1   uwe 
    287       1.1   uwe 	/* IGS_EXT_GRFX_MODE */
    288       1.1   uwe 	igs_ext_write(iot, ioh, 0x57, 0x01); /* raster fb */
    289       1.1   uwe 
    290       1.1   uwe 	/* overscan R/G/B */
    291       1.1   uwe 	igs_ext_write(iot, ioh, 0x58, 0x00);
    292       1.1   uwe 	igs_ext_write(iot, ioh, 0x59, 0x00);
    293       1.1   uwe 	igs_ext_write(iot, ioh, 0x5A, 0x00);
    294       1.1   uwe 
    295       1.1   uwe 	/*
    296       1.1   uwe 	 * Video memory size &c.  We rely on firmware to program
    297       1.1   uwe 	 * BUS_CTL(30), MEM_CTL1(71), MEM_CTL2(72) appropriately.
    298       1.1   uwe 	 */
    299       1.1   uwe 
    300       1.1   uwe 	/* ext memory ctl0 */
    301       1.1   uwe 	igs_ext_write(iot, ioh, 0x70, 0x0B); /* enable fifo, seq */
    302       1.1   uwe 
    303       1.1   uwe 	/* ext hidden ctl1 */
    304       1.1   uwe 	igs_ext_write(iot, ioh, 0x73, 0x30); /* XXX: krups: 0x20 */
    305       1.1   uwe 
    306       1.1   uwe 	/* ext fifo control */
    307       1.1   uwe 	igs_ext_write(iot, ioh, 0x74, 0x10); /* XXX: krups: 0x1b */
    308       1.1   uwe 	igs_ext_write(iot, ioh, 0x75, 0x10); /* XXX: krups: 0x1e */
    309       1.1   uwe 
    310       1.1   uwe 	igs_ext_write(iot, ioh, 0x76, 0x00); /* ext seq. */
    311       1.1   uwe 	igs_ext_write(iot, ioh, 0x7A, 0xC8); /* ext. hidden ctl */
    312       1.1   uwe 
    313       1.1   uwe 	/* ext graphics ctl: GCEXTPATH.  krups 1, nettrom 1, docs 3 */
    314       1.1   uwe 	igs_ext_write(iot, ioh, 0x90, 0x01);
    315       1.1   uwe 
    316       1.2   uwe 	if (is_cyberpro)	/* select normal vclk/mclk registers */
    317       1.1   uwe 	    igs_ext_write(iot, ioh, 0xBF, 0x00);
    318       1.1   uwe 
    319       1.1   uwe 	igs_ext_write(iot, ioh, 0xB0, 0xD2); /* VCLK = 25.175MHz */
    320       1.1   uwe 	igs_ext_write(iot, ioh, 0xB1, 0xD3);
    321       1.1   uwe 	igs_ext_write(iot, ioh, 0xB2, 0xDB); /* MCLK = 75MHz*/
    322       1.1   uwe 	igs_ext_write(iot, ioh, 0xB3, 0x54);
    323       1.2   uwe 	igsfb_freq_latch(dc);
    324       1.1   uwe 
    325       1.2   uwe 	if (is_cyberpro)
    326       1.1   uwe 	    igs_ext_write(iot, ioh, 0xF8, 0x04); /* XXX: ??? */
    327       1.1   uwe 
    328       1.1   uwe 	/* 640x480 8bpp at 60Hz */
    329       1.1   uwe 	igs_ext_write(iot, ioh, 0x11, 0x00);
    330       1.1   uwe 	igs_ext_write(iot, ioh, 0x77, 0x01); /* 8bpp, indexed */
    331       1.1   uwe 	igs_ext_write(iot, ioh, 0x14, 0x51);
    332       1.1   uwe 	igs_ext_write(iot, ioh, 0x15, 0x00);
    333       1.1   uwe }
    334       1.1   uwe 
    335       1.1   uwe 
    336       1.1   uwe static void
    337  1.4.12.1  yamt igsfb_init_dac(struct igsfb_devconfig *dc)
    338       1.1   uwe {
    339       1.2   uwe 	bus_space_tag_t iot = dc->dc_iot;
    340       1.2   uwe 	bus_space_handle_t ioh = dc->dc_ioh;
    341       1.4   uwe 	uint8_t reg;
    342       1.1   uwe 
    343       1.1   uwe 	/* RAMDAC address 2 select */
    344       1.1   uwe 	reg = igs_ext_read(iot, ioh, IGS_EXT_SPRITE_CTL);
    345       1.1   uwe 	igs_ext_write(iot, ioh, IGS_EXT_SPRITE_CTL,
    346       1.1   uwe 		      reg | IGS_EXT_SPRITE_DAC_PEL);
    347       1.1   uwe 
    348       1.1   uwe 	/* VREFEN, DAC8 */
    349       1.1   uwe 	bus_space_write_1(iot, ioh, IGS_DAC_CMD, 0x06);
    350       1.1   uwe 
    351       1.1   uwe 	/* restore */
    352       1.1   uwe 	igs_ext_write(iot, ioh, IGS_EXT_SPRITE_CTL, reg);
    353       1.1   uwe 
    354       1.1   uwe 	bus_space_write_1(iot, ioh, IGS_PEL_MASK, 0xff);
    355       1.1   uwe }
    356       1.1   uwe 
    357       1.1   uwe 
    358       1.1   uwe void
    359  1.4.12.1  yamt igsfb_1024x768_8bpp_60Hz(struct igsfb_devconfig *dc)
    360       1.1   uwe {
    361       1.2   uwe 	bus_space_tag_t iot = dc->dc_iot;
    362       1.2   uwe 	bus_space_handle_t ioh = dc->dc_ioh;
    363       1.1   uwe 
    364       1.1   uwe 	igs_crtc_write(iot, ioh, 0x11, 0x00); /* write enable CRTC 0..7 */
    365       1.1   uwe 
    366       1.1   uwe 	igs_crtc_write(iot, ioh, 0x00, 0xa3);
    367       1.1   uwe 	igs_crtc_write(iot, ioh, 0x01, 0x7f);
    368       1.1   uwe 	igs_crtc_write(iot, ioh, 0x02, 0x7f); /* krups: 80 */
    369       1.1   uwe 	igs_crtc_write(iot, ioh, 0x03, 0x85); /* krups: 84 */
    370       1.1   uwe 	igs_crtc_write(iot, ioh, 0x04, 0x84); /* krups: 88 */
    371       1.1   uwe 	igs_crtc_write(iot, ioh, 0x05, 0x95); /* krups: 99 */
    372       1.1   uwe 	igs_crtc_write(iot, ioh, 0x06, 0x24);
    373       1.1   uwe 	igs_crtc_write(iot, ioh, 0x07, 0xfd);
    374       1.1   uwe 
    375       1.1   uwe 	/* next block is almost constant, only bit 6 in reg 9 differs */
    376       1.1   uwe 	igs_crtc_write(iot, ioh, 0x08, 0x00);
    377       1.1   uwe 	igs_crtc_write(iot, ioh, 0x09, 0x60); /* <- either 0x40 or 0x60 */
    378       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0a, 0x00);
    379       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0b, 0x00);
    380       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0c, 0x00);
    381       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0d, 0x00);
    382       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0e, 0x00);
    383       1.1   uwe 	igs_crtc_write(iot, ioh, 0x0f, 0x00);
    384       1.1   uwe 
    385       1.1   uwe 	igs_crtc_write(iot, ioh, 0x10, 0x06);
    386       1.1   uwe 	igs_crtc_write(iot, ioh, 0x11, 0x8c);
    387       1.1   uwe 	igs_crtc_write(iot, ioh, 0x12, 0xff);
    388       1.1   uwe 	igs_crtc_write(iot, ioh, 0x13, 0x80); /* depends on BPP */
    389       1.1   uwe 	igs_crtc_write(iot, ioh, 0x14, 0x0f);
    390       1.1   uwe 	igs_crtc_write(iot, ioh, 0x15, 0x02);
    391       1.1   uwe 	igs_crtc_write(iot, ioh, 0x16, 0x21);
    392       1.1   uwe 	igs_crtc_write(iot, ioh, 0x17, 0xe3);
    393       1.1   uwe 	igs_crtc_write(iot, ioh, 0x18, 0xff);
    394       1.1   uwe 
    395       1.1   uwe 	igs_ext_write(iot, ioh, 0xB0, 0xE2); /* VCLK */
    396       1.1   uwe 	igs_ext_write(iot, ioh, 0xB1, 0x58);
    397       1.1   uwe #if 1
    398       1.1   uwe 	/* XXX: hmm, krups does this */
    399       1.1   uwe 	igs_ext_write(iot, ioh, 0xB2, 0xE2); /* MCLK */
    400       1.1   uwe 	igs_ext_write(iot, ioh, 0xB3, 0x58);
    401       1.1   uwe #endif
    402       1.2   uwe 	igsfb_freq_latch(dc);
    403       1.1   uwe 
    404       1.1   uwe 	igs_ext_write(iot, ioh, 0x11, 0x00);
    405       1.1   uwe 	igs_ext_write(iot, ioh, 0x77, 0x01); /* 8bpp, indexed */
    406       1.1   uwe 	igs_ext_write(iot, ioh, 0x14, 0x81);
    407       1.1   uwe 	igs_ext_write(iot, ioh, 0x15, 0x00);
    408       1.1   uwe }
    409       1.1   uwe 
    410       1.1   uwe 
    411       1.1   uwe /*
    412       1.1   uwe  * igs-video-init from krups prom
    413       1.1   uwe  */
    414       1.1   uwe void
    415  1.4.12.1  yamt igsfb_hw_setup(struct igsfb_devconfig *dc)
    416       1.1   uwe {
    417       1.1   uwe 
    418       1.2   uwe 	igsfb_init_seq(dc);
    419       1.2   uwe 	igsfb_init_crtc(dc);
    420       1.2   uwe 	igsfb_init_attr(dc);
    421       1.2   uwe 	igsfb_init_grfx(dc);
    422       1.2   uwe 	igsfb_init_ext(dc);
    423       1.2   uwe 	igsfb_init_dac(dc);
    424       1.1   uwe 
    425       1.2   uwe 	igsfb_1024x768_8bpp_60Hz(dc);
    426       1.2   uwe 	igsfb_video_on(dc);
    427       1.1   uwe }
    428