From: Steve L. <slo...@us...> - 2001-08-30 21:52:42
|
Update of /cvsroot/linux-mips/linux/arch/mips/au1000/common In directory usw-pr-cvs1:/tmp/cvs-serv26386 Modified Files: clocks.c time.c Log Message: Added functions to calculate and return the Au1000 LCD clock frequency based on current CPU frequency. Index: clocks.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/au1000/common/clocks.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** clocks.c 2001/08/28 07:23:54 1.1 --- clocks.c 2001/08/30 21:52:39 1.2 *************** *** 28,32 **** */ ! static unsigned int au1000_clock; static unsigned long uart_baud_base; --- 28,35 ---- */ ! #include <asm/au1000.h> ! ! static unsigned int au1000_clock; // Hz ! static unsigned int lcd_clock; // KHz static unsigned long uart_baud_base; *************** *** 59,61 **** --- 62,100 ---- { uart_baud_base = new_baud_base; + } + + /* + * Calculate the Au1000's LCD clock based on the current + * cpu clock and the system bus clock, and try to keep it + * below 40 MHz (the Pb1000 board can lock-up if the LCD + * clock is over 40 MHz). + */ + void set_au1000_lcd_clock(void) + { + unsigned int static_cfg0; + unsigned int sys_busclk = + (get_au1000_speed()/1000) / + ((int)(inl(PM_POWERUP_CONTROL)&0x03) + 2); + + static_cfg0 = inl(STATIC_CONFIG_0); + if (sys_busclk/4 > 40000) { + static_cfg0 |= (1<<11); + outl(static_cfg0, STATIC_CONFIG_0); + lcd_clock = sys_busclk / 5; + if (lcd_clock > 40000) + printk(__FUNCTION__ + ": warning: LCD clock too high (%d KHz)\n", + lcd_clock); + } else { + static_cfg0 &= ~(1<<11); + outl(static_cfg0, STATIC_CONFIG_0); + lcd_clock = sys_busclk / 4; + } + // some time to allow LCD clock to settle + udelay(100); + } + + unsigned int get_au1000_lcd_clock(void) + { + return lcd_clock; } Index: time.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/au1000/common/time.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** time.c 2001/08/28 07:23:54 1.5 --- time.c 2001/08/30 21:52:39 1.6 *************** *** 45,48 **** --- 45,49 ---- extern void set_au1000_uart_baud_base(unsigned long new_baud_base); extern void set_au1000_speed(unsigned int new_freq); + extern void set_au1000_lcd_clock(void); extern volatile unsigned long wall_jiffies; *************** *** 212,215 **** --- 213,219 ---- (est_freq%1000000)*100/1000000); set_au1000_speed(est_freq); + #ifdef CONFIG_FB_E1356 + set_au1000_lcd_clock(); // program the LCD clock + #endif r4k_cur = (read_32bit_cp0_register(CP0_COUNT) + r4k_offset); |