aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/pxa25x.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/pxa25x.c')
-rw-r--r--arch/arm/mach-pxa/pxa25x.c90
1 files changed, 78 insertions, 12 deletions
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 6dfcca72e90f..0d6a72504caa 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -30,6 +30,7 @@
30 30
31#include "generic.h" 31#include "generic.h"
32#include "devices.h" 32#include "devices.h"
33#include "clock.h"
33 34
34/* 35/*
35 * Various clock factors driven by the CCCR register. 36 * Various clock factors driven by the CCCR register.
@@ -53,7 +54,7 @@ static unsigned char N2_clk_mult[8] = { 0, 0, 2, 3, 4, 0, 6, 0 };
53 * We assume these values have been applied via a fcs. 54 * We assume these values have been applied via a fcs.
54 * If info is not 0 we also display the current settings. 55 * If info is not 0 we also display the current settings.
55 */ 56 */
56unsigned int get_clk_frequency_khz(int info) 57unsigned int pxa25x_get_clk_frequency_khz(int info)
57{ 58{
58 unsigned long cccr, turbo; 59 unsigned long cccr, turbo;
59 unsigned int l, L, m, M, n2, N; 60 unsigned int l, L, m, M, n2, N;
@@ -86,27 +87,48 @@ unsigned int get_clk_frequency_khz(int info)
86 return (turbo & 1) ? (N/1000) : (M/1000); 87 return (turbo & 1) ? (N/1000) : (M/1000);
87} 88}
88 89
89EXPORT_SYMBOL(get_clk_frequency_khz);
90
91/* 90/*
92 * Return the current memory clock frequency in units of 10kHz 91 * Return the current memory clock frequency in units of 10kHz
93 */ 92 */
94unsigned int get_memclk_frequency_10khz(void) 93unsigned int pxa25x_get_memclk_frequency_10khz(void)
95{ 94{
96 return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000; 95 return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000;
97} 96}
98 97
99EXPORT_SYMBOL(get_memclk_frequency_10khz); 98static unsigned long clk_pxa25x_lcd_getrate(struct clk *clk)
100
101/*
102 * Return the current LCD clock frequency in units of 10kHz
103 */
104unsigned int get_lcdclk_frequency_10khz(void)
105{ 99{
106 return get_memclk_frequency_10khz(); 100 return pxa25x_get_memclk_frequency_10khz() * 10000;
107} 101}
108 102
109EXPORT_SYMBOL(get_lcdclk_frequency_10khz); 103static const struct clkops clk_pxa25x_lcd_ops = {
104 .enable = clk_cken_enable,
105 .disable = clk_cken_disable,
106 .getrate = clk_pxa25x_lcd_getrate,
107};
108
109/*
110 * 3.6864MHz -> OST, GPIO, SSP, PWM, PLLs (95.842MHz, 147.456MHz)
111 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
112 * 147.456MHz -> UART 14.7456MHz, AC97 12.288MHz, I2S 5.672MHz (allegedly)
113 */
114static struct clk pxa25x_clks[] = {
115 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
116 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev),
117 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
118 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
119 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
120 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa_device_udc.dev),
121 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev),
122 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev),
123 /*
124 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
125 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
126 INIT_CKEN("SSPCLK", SSP, 3686400, 0, NULL),
127 INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL),
128 INIT_CKEN("NSSPCLK", NSSP, 3686400, 0, NULL),
129 */
130 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
131};
110 132
111#ifdef CONFIG_PM 133#ifdef CONFIG_PM
112 134
@@ -205,10 +227,52 @@ static void __init pxa25x_init_pm(void)
205} 227}
206#endif 228#endif
207 229
230/* PXA25x: supports wakeup from GPIO0..GPIO15 and RTC alarm
231 */
232
233static int pxa25x_set_wake(unsigned int irq, unsigned int on)
234{
235 int gpio = IRQ_TO_GPIO(irq);
236 uint32_t gpio_bit, mask = 0;
237
238 if (gpio >= 0 && gpio <= 15) {
239 gpio_bit = GPIO_bit(gpio);
240 mask = gpio_bit;
241 if (on) {
242 if (GRER(gpio) | gpio_bit)
243 PRER |= gpio_bit;
244 else
245 PRER &= ~gpio_bit;
246
247 if (GFER(gpio) | gpio_bit)
248 PFER |= gpio_bit;
249 else
250 PFER &= ~gpio_bit;
251 }
252 goto set_pwer;
253 }
254
255 if (irq == IRQ_RTCAlrm) {
256 mask = PWER_RTC;
257 goto set_pwer;
258 }
259
260 return -EINVAL;
261
262set_pwer:
263 if (on)
264 PWER |= mask;
265 else
266 PWER &=~mask;
267
268 return 0;
269}
270
208void __init pxa25x_init_irq(void) 271void __init pxa25x_init_irq(void)
209{ 272{
210 pxa_init_irq_low(); 273 pxa_init_irq_low();
211 pxa_init_irq_gpio(85); 274 pxa_init_irq_gpio(85);
275 pxa_init_irq_set_wake(pxa25x_set_wake);
212} 276}
213 277
214static struct platform_device *pxa25x_devices[] __initdata = { 278static struct platform_device *pxa25x_devices[] __initdata = {
@@ -229,6 +293,8 @@ static int __init pxa25x_init(void)
229 int ret = 0; 293 int ret = 0;
230 294
231 if (cpu_is_pxa21x() || cpu_is_pxa25x()) { 295 if (cpu_is_pxa21x() || cpu_is_pxa25x()) {
296 clks_register(pxa25x_clks, ARRAY_SIZE(pxa25x_clks));
297
232 if ((ret = pxa_init_dma(16))) 298 if ((ret = pxa_init_dma(16)))
233 return ret; 299 return ret;
234#ifdef CONFIG_PM 300#ifdef CONFIG_PM