aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/au1000/common/clocks.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/au1000/common/clocks.c')
-rw-r--r--arch/mips/au1000/common/clocks.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/arch/mips/au1000/common/clocks.c b/arch/mips/au1000/common/clocks.c
index 3ce6cace0eb0..043429d17c5f 100644
--- a/arch/mips/au1000/common/clocks.c
+++ b/arch/mips/au1000/common/clocks.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Simple Au1000 clocks routines. 3 * Simple Au1xx0 clocks routines.
4 * 4 *
5 * Copyright 2001 MontaVista Software Inc. 5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 * ppopov@mvista.com or source@mvista.com
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -30,8 +29,8 @@
30#include <linux/module.h> 29#include <linux/module.h>
31#include <asm/mach-au1x00/au1000.h> 30#include <asm/mach-au1x00/au1000.h>
32 31
33static unsigned int au1x00_clock; // Hz 32static unsigned int au1x00_clock; /* Hz */
34static unsigned int lcd_clock; // KHz 33static unsigned int lcd_clock; /* KHz */
35static unsigned long uart_baud_base; 34static unsigned long uart_baud_base;
36 35
37/* 36/*
@@ -46,8 +45,7 @@ unsigned int get_au1x00_speed(void)
46{ 45{
47 return au1x00_clock; 46 return au1x00_clock;
48} 47}
49 48EXPORT_SYMBOL(get_au1x00_speed);
50
51 49
52/* 50/*
53 * The UART baud base is not known at compile time ... if 51 * The UART baud base is not known at compile time ... if
@@ -73,24 +71,23 @@ void set_au1x00_uart_baud_base(unsigned long new_baud_base)
73void set_au1x00_lcd_clock(void) 71void set_au1x00_lcd_clock(void)
74{ 72{
75 unsigned int static_cfg0; 73 unsigned int static_cfg0;
76 unsigned int sys_busclk = 74 unsigned int sys_busclk = (get_au1x00_speed() / 1000) /
77 (get_au1x00_speed()/1000) / 75 ((int)(au_readl(SYS_POWERCTRL) & 0x03) + 2);
78 ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2);
79 76
80 static_cfg0 = au_readl(MEM_STCFG0); 77 static_cfg0 = au_readl(MEM_STCFG0);
81 78
82 if (static_cfg0 & (1<<11)) 79 if (static_cfg0 & (1 << 11))
83 lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */ 80 lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */
84 else 81 else
85 lcd_clock = sys_busclk / 4; 82 lcd_clock = sys_busclk / 4;
86 83
87 if (lcd_clock > 50000) /* Epson MAX */ 84 if (lcd_clock > 50000) /* Epson MAX */
88 printk("warning: LCD clock too high (%d KHz)\n", lcd_clock); 85 printk(KERN_WARNING "warning: LCD clock too high (%u KHz)\n",
86 lcd_clock);
89} 87}
90 88
91unsigned int get_au1x00_lcd_clock(void) 89unsigned int get_au1x00_lcd_clock(void)
92{ 90{
93 return lcd_clock; 91 return lcd_clock;
94} 92}
95
96EXPORT_SYMBOL(get_au1x00_lcd_clock); 93EXPORT_SYMBOL(get_au1x00_lcd_clock);