aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/pxa3xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/pxa3xx.c')
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c77
1 files changed, 59 insertions, 18 deletions
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 35f25fdaeba3..dde355e88fa1 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -110,6 +110,25 @@ unsigned int pxa3xx_get_memclk_frequency_10khz(void)
110} 110}
111 111
112/* 112/*
113 * Return the current AC97 clock frequency.
114 */
115static unsigned long clk_pxa3xx_ac97_getrate(struct clk *clk)
116{
117 unsigned long rate = 312000000;
118 unsigned long ac97_div;
119
120 ac97_div = AC97_DIV;
121
122 /* This may loose precision for some rates but won't for the
123 * standard 24.576MHz.
124 */
125 rate /= (ac97_div >> 12) & 0x7fff;
126 rate *= (ac97_div & 0xfff);
127
128 return rate;
129}
130
131/*
113 * Return the current HSIO bus clock frequency 132 * Return the current HSIO bus clock frequency
114 */ 133 */
115static unsigned long clk_pxa3xx_hsio_getrate(struct clk *clk) 134static unsigned long clk_pxa3xx_hsio_getrate(struct clk *clk)
@@ -156,6 +175,27 @@ static const struct clkops clk_pxa3xx_hsio_ops = {
156 .getrate = clk_pxa3xx_hsio_getrate, 175 .getrate = clk_pxa3xx_hsio_getrate,
157}; 176};
158 177
178static const struct clkops clk_pxa3xx_ac97_ops = {
179 .enable = clk_pxa3xx_cken_enable,
180 .disable = clk_pxa3xx_cken_disable,
181 .getrate = clk_pxa3xx_ac97_getrate,
182};
183
184static void clk_pout_enable(struct clk *clk)
185{
186 OSCC |= OSCC_PEN;
187}
188
189static void clk_pout_disable(struct clk *clk)
190{
191 OSCC &= ~OSCC_PEN;
192}
193
194static const struct clkops clk_pout_ops = {
195 .enable = clk_pout_enable,
196 .disable = clk_pout_disable,
197};
198
159#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \ 199#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \
160 { \ 200 { \
161 .name = _name, \ 201 .name = _name, \
@@ -175,8 +215,16 @@ static const struct clkops clk_pxa3xx_hsio_ops = {
175 } 215 }
176 216
177static struct clk pxa3xx_clks[] = { 217static struct clk pxa3xx_clks[] = {
178 PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev), 218 {
179 PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL), 219 .name = "CLK_POUT",
220 .ops = &clk_pout_ops,
221 .rate = 13000000,
222 .delay = 70,
223 },
224
225 PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev),
226 PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL),
227 PXA3xx_CK("AC97CLK", AC97, &clk_pxa3xx_ac97_ops, NULL),
180 228
181 PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev), 229 PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev),
182 PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev), 230 PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev),
@@ -185,6 +233,7 @@ static struct clk pxa3xx_clks[] = {
185 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), 233 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
186 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), 234 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev),
187 PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev), 235 PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev),
236 PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev),
188 237
189 PXA3xx_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), 238 PXA3xx_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev),
190 PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), 239 PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev),
@@ -305,8 +354,10 @@ static void pxa3xx_cpu_pm_enter(suspend_state_t state)
305 /* 354 /*
306 * Don't sleep if no wakeup sources are defined 355 * Don't sleep if no wakeup sources are defined
307 */ 356 */
308 if (wakeup_src == 0) 357 if (wakeup_src == 0) {
358 printk(KERN_ERR "Not suspending: no wakeup sources\n");
309 return; 359 return;
360 }
310 361
311 switch (state) { 362 switch (state) {
312 case PM_SUSPEND_STANDBY: 363 case PM_SUSPEND_STANDBY:
@@ -446,15 +497,9 @@ static int pxa3xx_set_wake(unsigned int irq, unsigned int on)
446 497
447 return 0; 498 return 0;
448} 499}
449
450static void pxa3xx_init_irq_pm(void)
451{
452 pxa_init_irq_set_wake(pxa3xx_set_wake);
453}
454
455#else 500#else
456static inline void pxa3xx_init_pm(void) {} 501static inline void pxa3xx_init_pm(void) {}
457static inline void pxa3xx_init_irq_pm(void) {} 502#define pxa3xx_set_wake NULL
458#endif 503#endif
459 504
460void __init pxa3xx_init_irq(void) 505void __init pxa3xx_init_irq(void)
@@ -465,10 +510,8 @@ void __init pxa3xx_init_irq(void)
465 value |= (1 << 6); 510 value |= (1 << 6);
466 __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); 511 __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value));
467 512
468 pxa_init_irq_low(); 513 pxa_init_irq(56, pxa3xx_set_wake);
469 pxa_init_irq_high(); 514 pxa_init_gpio(128, NULL);
470 pxa_init_irq_gpio(128);
471 pxa3xx_init_irq_pm();
472} 515}
473 516
474/* 517/*
@@ -490,11 +533,9 @@ static struct platform_device *devices[] __initdata = {
490 533
491static struct sys_device pxa3xx_sysdev[] = { 534static struct sys_device pxa3xx_sysdev[] = {
492 { 535 {
493 .id = 0,
494 .cls = &pxa_irq_sysclass, 536 .cls = &pxa_irq_sysclass,
495 }, { 537 }, {
496 .id = 1, 538 .cls = &pxa3xx_mfp_sysclass,
497 .cls = &pxa_irq_sysclass,
498 }, { 539 }, {
499 .cls = &pxa_gpio_sysclass, 540 .cls = &pxa_gpio_sysclass,
500 }, 541 },
@@ -532,4 +573,4 @@ static int __init pxa3xx_init(void)
532 return ret; 573 return ret;
533} 574}
534 575
535subsys_initcall(pxa3xx_init); 576postcore_initcall(pxa3xx_init);