From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <5ce683189126cadd703b8ca7ed1b9d69.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199706210006.RAA11651@yoda.veritas.com> Date: Fri, 20 Jun 1997 17:06:49 +0800 From: Michael B. Schmitz Subject: Matrox X-Server Startup The following function comes from the XFree86-3.3 source code. I have a Matrox millenium which fails to work with the X server. The server loops forever at the lines marked with an 'X' below. Again, I am puzzled. Could this have anything to do with the preceding message? mbs@veritas.com 415 335 8452 /* * MGATi3026SetMCLK - Set the memory clock (MCLK) PLL. * * HISTORY * January 11, 1997 - [aem] Andrew E. Mileski * Written and tested. */ static void MGATi3026SetMCLK( f_out ) long f_out; { double f_pll; int mclk_m, mclk_n, mclk_p; int pclk_m, pclk_n, pclk_p; int mclk_ctl, rfhcnt; f_pll = MGATi3026CalcClock( f_out, TI_MAX_MCLK_FREQ, & mclk_m, & mclk_n, & mclk_p ); /* Save PCLK settings */ outTi3026( TVP3026_PLL_ADDR, 0, 0xfc ); pclk_n = inTi3026( TVP3026_PIX_CLK_DATA ); outTi3026( TVP3026_PLL_ADDR, 0, 0xfd ); pclk_m = inTi3026( TVP3026_PIX_CLK_DATA ); outTi3026( TVP3026_PLL_ADDR, 0, 0xfe ); pclk_p = inTi3026( TVP3026_PIX_CLK_DATA ); /* Stop PCLK (PLLEN = 0, PCLKEN = 0) */ outTi3026( TVP3026_PLL_ADDR, 0, 0xfe ); outTi3026( TVP3026_PIX_CLK_DATA, 0, 0x00 ); /* Set PCLK to the new MCLK frequency (PLLEN = 1, PCLKEN = 0 ) */ outTi3026( TVP3026_PLL_ADDR, 0, 0xfc ); outTi3026( TVP3026_PIX_CLK_DATA, 0, ( mclk_n & 0x3f ) | 0xc0 ); outTi3026( TVP3026_PIX_CLK_DATA, 0, mclk_m & 0x3f ); outTi3026( TVP3026_PIX_CLK_DATA, 0, ( mclk_p & 0x03 ) | 0xb0 ); /* Loop here forever -- mbs */ /* Wait for PCLK PLL to lock on frequency */ X while (( inTi3026( TVP3026_PIX_CLK_DATA ) & 0x40 ) == 0 ) { X ; X } /* Output PCLK on MCLK pin */ mclk_ctl = inTi3026( TVP3026_MCLK_CTL ); outTi3026( TVP3026_MCLK_CTL, 0, mclk_ctl & 0xe7 ); outTi3026( TVP3026_MCLK_CTL, 0, ( mclk_ctl & 0xe7 ) | 0x08 ); /* Stop MCLK (PLLEN = 0 ) */ outTi3026( TVP3026_PLL_ADDR, 0, 0xfb ); outTi3026( TVP3026_MEM_CLK_DATA, 0, 0x00 ); /* Set MCLK to the new frequency (PLLEN = 1) */ outTi3026( TVP3026_PLL_ADDR, 0, 0xf3 ); outTi3026( TVP3026_MEM_CLK_DATA, 0, ( mclk_n & 0x3f ) | 0xc0 ); outTi3026( TVP3026_MEM_CLK_DATA, 0, mclk_m & 0x3f ); outTi3026( TVP3026_MEM_CLK_DATA, 0, ( mclk_p & 0x03 ) | 0xb0 ); /* Wait for MCLK PLL to lock on frequency */ while (( inTi3026( TVP3026_MEM_CLK_DATA ) & 0x40 ) == 0 ) { ; } /* Set the WRAM refresh divider */ rfhcnt = ( 332.0 * f_pll / 1280000.0 ); if ( rfhcnt > 15 ) rfhcnt = 0; pciWriteLong( MGAPciTag, PCI_OPTION_REG, ( rfhcnt << 16 ) | ( pciReadLong( MGAPciTag, PCI_OPTION_REG ) & ~0xf0000 )); #ifdef DEBUG ErrorF( "rfhcnt=%d\n", rfhcnt ); #endif /* Output MCLK PLL on MCLK pin */ outTi3026( TVP3026_MCLK_CTL, 0, ( mclk_ctl & 0xe7 ) | 0x10 ); outTi3026( TVP3026_MCLK_CTL, 0, ( mclk_ctl & 0xe7 ) | 0x18 ); /* Stop PCLK (PLLEN = 0, PCLKEN = 0 ) */ outTi3026( TVP3026_PLL_ADDR, 0, 0xfe ); outTi3026( TVP3026_PIX_CLK_DATA, 0, 0x00 ); /* Restore PCLK (PLLEN = ?, PCLKEN = ?) */ outTi3026( TVP3026_PLL_ADDR, 0, 0xfc ); outTi3026( TVP3026_PIX_CLK_DATA, 0, pclk_n ); outTi3026( TVP3026_PIX_CLK_DATA, 0, pclk_m ); outTi3026( TVP3026_PIX_CLK_DATA, 0, pclk_p ); /* Wait for PCLK PLL to lock on frequency */ while (( inTi3026( TVP3026_PIX_CLK_DATA ) & 0x40 ) == 0 ) { ; } } -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com