diff options
Diffstat (limited to 'arch/mips/au1000/common/clocks.c')
-rw-r--r-- | arch/mips/au1000/common/clocks.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/arch/mips/au1000/common/clocks.c b/arch/mips/au1000/common/clocks.c index 3ce6cace0eb0..46f8ee0e2657 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 | ||
33 | static unsigned int au1x00_clock; // Hz | 32 | static unsigned int au1x00_clock; /* Hz */ |
34 | static unsigned int lcd_clock; // KHz | 33 | static unsigned int lcd_clock; /* KHz */ |
35 | static unsigned long uart_baud_base; | 34 | static unsigned long uart_baud_base; |
36 | 35 | ||
37 | /* | 36 | /* |
@@ -47,8 +46,6 @@ unsigned int get_au1x00_speed(void) | |||
47 | return au1x00_clock; | 46 | return au1x00_clock; |
48 | } | 47 | } |
49 | 48 | ||
50 | |||
51 | |||
52 | /* | 49 | /* |
53 | * The UART baud base is not known at compile time ... if | 50 | * The UART baud base is not known at compile time ... if |
54 | * we want to be able to use the same code on different | 51 | * we want to be able to use the same code on different |
@@ -73,24 +70,23 @@ void set_au1x00_uart_baud_base(unsigned long new_baud_base) | |||
73 | void set_au1x00_lcd_clock(void) | 70 | void set_au1x00_lcd_clock(void) |
74 | { | 71 | { |
75 | unsigned int static_cfg0; | 72 | unsigned int static_cfg0; |
76 | unsigned int sys_busclk = | 73 | unsigned int sys_busclk = (get_au1x00_speed() / 1000) / |
77 | (get_au1x00_speed()/1000) / | 74 | ((int)(au_readl(SYS_POWERCTRL) & 0x03) + 2); |
78 | ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2); | ||
79 | 75 | ||
80 | static_cfg0 = au_readl(MEM_STCFG0); | 76 | static_cfg0 = au_readl(MEM_STCFG0); |
81 | 77 | ||
82 | if (static_cfg0 & (1<<11)) | 78 | if (static_cfg0 & (1 << 11)) |
83 | lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */ | 79 | lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */ |
84 | else | 80 | else |
85 | lcd_clock = sys_busclk / 4; | 81 | lcd_clock = sys_busclk / 4; |
86 | 82 | ||
87 | if (lcd_clock > 50000) /* Epson MAX */ | 83 | if (lcd_clock > 50000) /* Epson MAX */ |
88 | printk("warning: LCD clock too high (%d KHz)\n", lcd_clock); | 84 | printk(KERN_WARNING "warning: LCD clock too high (%u KHz)\n", |
85 | lcd_clock); | ||
89 | } | 86 | } |
90 | 87 | ||
91 | unsigned int get_au1x00_lcd_clock(void) | 88 | unsigned int get_au1x00_lcd_clock(void) |
92 | { | 89 | { |
93 | return lcd_clock; | 90 | return lcd_clock; |
94 | } | 91 | } |
95 | |||
96 | EXPORT_SYMBOL(get_au1x00_lcd_clock); | 92 | EXPORT_SYMBOL(get_au1x00_lcd_clock); |