ARM: pxa: Access SMEMC via virtual addresses
[pandora-kernel.git] / arch / arm / mach-pxa / pxa3xx.c
1 /*
2  * linux/arch/arm/mach-pxa/pxa3xx.c
3  *
4  * code specific to pxa3xx aka Monahans
5  *
6  * Copyright (C) 2006 Marvell International Ltd.
7  *
8  * 2007-09-02: eric miao <eric.miao@marvell.com>
9  *             initial version
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License version 2 as
13  * published by the Free Software Foundation.
14  */
15
16 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/pm.h>
20 #include <linux/platform_device.h>
21 #include <linux/irq.h>
22 #include <linux/io.h>
23 #include <linux/sysdev.h>
24
25 #include <asm/mach/map.h>
26 #include <mach/hardware.h>
27 #include <mach/gpio.h>
28 #include <mach/pxa3xx-regs.h>
29 #include <mach/reset.h>
30 #include <mach/ohci.h>
31 #include <mach/pm.h>
32 #include <mach/dma.h>
33 #include <mach/regs-intc.h>
34 #include <mach/smemc.h>
35 #include <plat/i2c.h>
36
37 #include "generic.h"
38 #include "devices.h"
39 #include "clock.h"
40
41 /* Crystal clock: 13MHz */
42 #define BASE_CLK        13000000
43
44 /* Ring Oscillator Clock: 60MHz */
45 #define RO_CLK          60000000
46
47 #define ACCR_D0CS       (1 << 26)
48 #define ACCR_PCCE       (1 << 11)
49
50 #define PECR_IE(n)      ((1 << ((n) * 2)) << 28)
51 #define PECR_IS(n)      ((1 << ((n) * 2)) << 29)
52
53 /* crystal frequency to static memory controller multiplier (SMCFS) */
54 static unsigned char smcfs_mult[8] = { 6, 0, 8, 0, 0, 16, };
55
56 /* crystal frequency to HSIO bus frequency multiplier (HSS) */
57 static unsigned char hss_mult[4] = { 8, 12, 16, 24 };
58
59 /*
60  * Get the clock frequency as reflected by CCSR and the turbo flag.
61  * We assume these values have been applied via a fcs.
62  * If info is not 0 we also display the current settings.
63  */
64 unsigned int pxa3xx_get_clk_frequency_khz(int info)
65 {
66         unsigned long acsr, xclkcfg;
67         unsigned int t, xl, xn, hss, ro, XL, XN, CLK, HSS;
68
69         /* Read XCLKCFG register turbo bit */
70         __asm__ __volatile__("mrc\tp14, 0, %0, c6, c0, 0" : "=r"(xclkcfg));
71         t = xclkcfg & 0x1;
72
73         acsr = ACSR;
74
75         xl  = acsr & 0x1f;
76         xn  = (acsr >> 8) & 0x7;
77         hss = (acsr >> 14) & 0x3;
78
79         XL = xl * BASE_CLK;
80         XN = xn * XL;
81
82         ro = acsr & ACCR_D0CS;
83
84         CLK = (ro) ? RO_CLK : ((t) ? XN : XL);
85         HSS = (ro) ? RO_CLK : hss_mult[hss] * BASE_CLK;
86
87         if (info) {
88                 pr_info("RO Mode clock: %d.%02dMHz (%sactive)\n",
89                         RO_CLK / 1000000, (RO_CLK % 1000000) / 10000,
90                         (ro) ? "" : "in");
91                 pr_info("Run Mode clock: %d.%02dMHz (*%d)\n",
92                         XL / 1000000, (XL % 1000000) / 10000, xl);
93                 pr_info("Turbo Mode clock: %d.%02dMHz (*%d, %sactive)\n",
94                         XN / 1000000, (XN % 1000000) / 10000, xn,
95                         (t) ? "" : "in");
96                 pr_info("HSIO bus clock: %d.%02dMHz\n",
97                         HSS / 1000000, (HSS % 1000000) / 10000);
98         }
99
100         return CLK / 1000;
101 }
102
103 void pxa3xx_clear_reset_status(unsigned int mask)
104 {
105         /* RESET_STATUS_* has a 1:1 mapping with ARSR */
106         ARSR = mask;
107 }
108
109 /*
110  * Return the current AC97 clock frequency.
111  */
112 static unsigned long clk_pxa3xx_ac97_getrate(struct clk *clk)
113 {
114         unsigned long rate = 312000000;
115         unsigned long ac97_div;
116
117         ac97_div = AC97_DIV;
118
119         /* This may loose precision for some rates but won't for the
120          * standard 24.576MHz.
121          */
122         rate /= (ac97_div >> 12) & 0x7fff;
123         rate *= (ac97_div & 0xfff);
124
125         return rate;
126 }
127
128 /*
129  * Return the current HSIO bus clock frequency
130  */
131 static unsigned long clk_pxa3xx_hsio_getrate(struct clk *clk)
132 {
133         unsigned long acsr;
134         unsigned int hss, hsio_clk;
135
136         acsr = ACSR;
137
138         hss = (acsr >> 14) & 0x3;
139         hsio_clk = (acsr & ACCR_D0CS) ? RO_CLK : hss_mult[hss] * BASE_CLK;
140
141         return hsio_clk;
142 }
143
144 void clk_pxa3xx_cken_enable(struct clk *clk)
145 {
146         unsigned long mask = 1ul << (clk->cken & 0x1f);
147
148         if (clk->cken < 32)
149                 CKENA |= mask;
150         else
151                 CKENB |= mask;
152 }
153
154 void clk_pxa3xx_cken_disable(struct clk *clk)
155 {
156         unsigned long mask = 1ul << (clk->cken & 0x1f);
157
158         if (clk->cken < 32)
159                 CKENA &= ~mask;
160         else
161                 CKENB &= ~mask;
162 }
163
164 const struct clkops clk_pxa3xx_cken_ops = {
165         .enable         = clk_pxa3xx_cken_enable,
166         .disable        = clk_pxa3xx_cken_disable,
167 };
168
169 static const struct clkops clk_pxa3xx_hsio_ops = {
170         .enable         = clk_pxa3xx_cken_enable,
171         .disable        = clk_pxa3xx_cken_disable,
172         .getrate        = clk_pxa3xx_hsio_getrate,
173 };
174
175 static const struct clkops clk_pxa3xx_ac97_ops = {
176         .enable         = clk_pxa3xx_cken_enable,
177         .disable        = clk_pxa3xx_cken_disable,
178         .getrate        = clk_pxa3xx_ac97_getrate,
179 };
180
181 static void clk_pout_enable(struct clk *clk)
182 {
183         OSCC |= OSCC_PEN;
184 }
185
186 static void clk_pout_disable(struct clk *clk)
187 {
188         OSCC &= ~OSCC_PEN;
189 }
190
191 static const struct clkops clk_pout_ops = {
192         .enable         = clk_pout_enable,
193         .disable        = clk_pout_disable,
194 };
195
196 static void clk_dummy_enable(struct clk *clk)
197 {
198 }
199
200 static void clk_dummy_disable(struct clk *clk)
201 {
202 }
203
204 static const struct clkops clk_dummy_ops = {
205         .enable         = clk_dummy_enable,
206         .disable        = clk_dummy_disable,
207 };
208
209 static struct clk clk_pxa3xx_pout = {
210         .ops            = &clk_pout_ops,
211         .rate           = 13000000,
212         .delay          = 70,
213 };
214
215 static struct clk clk_dummy = {
216         .ops            = &clk_dummy_ops,
217 };
218
219 static DEFINE_PXA3_CK(pxa3xx_lcd, LCD, &clk_pxa3xx_hsio_ops);
220 static DEFINE_PXA3_CK(pxa3xx_camera, CAMERA, &clk_pxa3xx_hsio_ops);
221 static DEFINE_PXA3_CK(pxa3xx_ac97, AC97, &clk_pxa3xx_ac97_ops);
222 static DEFINE_PXA3_CKEN(pxa3xx_ffuart, FFUART, 14857000, 1);
223 static DEFINE_PXA3_CKEN(pxa3xx_btuart, BTUART, 14857000, 1);
224 static DEFINE_PXA3_CKEN(pxa3xx_stuart, STUART, 14857000, 1);
225 static DEFINE_PXA3_CKEN(pxa3xx_i2c, I2C, 32842000, 0);
226 static DEFINE_PXA3_CKEN(pxa3xx_udc, UDC, 48000000, 5);
227 static DEFINE_PXA3_CKEN(pxa3xx_usbh, USBH, 48000000, 0);
228 static DEFINE_PXA3_CKEN(pxa3xx_u2d, USB2, 48000000, 0);
229 static DEFINE_PXA3_CKEN(pxa3xx_keypad, KEYPAD, 32768, 0);
230 static DEFINE_PXA3_CKEN(pxa3xx_ssp1, SSP1, 13000000, 0);
231 static DEFINE_PXA3_CKEN(pxa3xx_ssp2, SSP2, 13000000, 0);
232 static DEFINE_PXA3_CKEN(pxa3xx_ssp3, SSP3, 13000000, 0);
233 static DEFINE_PXA3_CKEN(pxa3xx_ssp4, SSP4, 13000000, 0);
234 static DEFINE_PXA3_CKEN(pxa3xx_pwm0, PWM0, 13000000, 0);
235 static DEFINE_PXA3_CKEN(pxa3xx_pwm1, PWM1, 13000000, 0);
236 static DEFINE_PXA3_CKEN(pxa3xx_mmc1, MMC1, 19500000, 0);
237 static DEFINE_PXA3_CKEN(pxa3xx_mmc2, MMC2, 19500000, 0);
238
239 static struct clk_lookup pxa3xx_clkregs[] = {
240         INIT_CLKREG(&clk_pxa3xx_pout, NULL, "CLK_POUT"),
241         /* Power I2C clock is always on */
242         INIT_CLKREG(&clk_dummy, "pxa3xx-pwri2c.1", NULL),
243         INIT_CLKREG(&clk_pxa3xx_lcd, "pxa2xx-fb", NULL),
244         INIT_CLKREG(&clk_pxa3xx_camera, NULL, "CAMCLK"),
245         INIT_CLKREG(&clk_pxa3xx_ac97, NULL, "AC97CLK"),
246         INIT_CLKREG(&clk_pxa3xx_ffuart, "pxa2xx-uart.0", NULL),
247         INIT_CLKREG(&clk_pxa3xx_btuart, "pxa2xx-uart.1", NULL),
248         INIT_CLKREG(&clk_pxa3xx_stuart, "pxa2xx-uart.2", NULL),
249         INIT_CLKREG(&clk_pxa3xx_stuart, "pxa2xx-ir", "UARTCLK"),
250         INIT_CLKREG(&clk_pxa3xx_i2c, "pxa2xx-i2c.0", NULL),
251         INIT_CLKREG(&clk_pxa3xx_udc, "pxa27x-udc", NULL),
252         INIT_CLKREG(&clk_pxa3xx_usbh, "pxa27x-ohci", NULL),
253         INIT_CLKREG(&clk_pxa3xx_u2d, "pxa3xx-u2d", NULL),
254         INIT_CLKREG(&clk_pxa3xx_keypad, "pxa27x-keypad", NULL),
255         INIT_CLKREG(&clk_pxa3xx_ssp1, "pxa27x-ssp.0", NULL),
256         INIT_CLKREG(&clk_pxa3xx_ssp2, "pxa27x-ssp.1", NULL),
257         INIT_CLKREG(&clk_pxa3xx_ssp3, "pxa27x-ssp.2", NULL),
258         INIT_CLKREG(&clk_pxa3xx_ssp4, "pxa27x-ssp.3", NULL),
259         INIT_CLKREG(&clk_pxa3xx_pwm0, "pxa27x-pwm.0", NULL),
260         INIT_CLKREG(&clk_pxa3xx_pwm1, "pxa27x-pwm.1", NULL),
261         INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL),
262         INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL),
263 };
264
265 #ifdef CONFIG_PM
266
267 #define ISRAM_START     0x5c000000
268 #define ISRAM_SIZE      SZ_256K
269
270 static void __iomem *sram;
271 static unsigned long wakeup_src;
272
273 #define SAVE(x)         sleep_save[SLEEP_SAVE_##x] = x
274 #define RESTORE(x)      x = sleep_save[SLEEP_SAVE_##x]
275
276 enum {  SLEEP_SAVE_CKENA,
277         SLEEP_SAVE_CKENB,
278         SLEEP_SAVE_ACCR,
279
280         SLEEP_SAVE_COUNT,
281 };
282
283 static void pxa3xx_cpu_pm_save(unsigned long *sleep_save)
284 {
285         SAVE(CKENA);
286         SAVE(CKENB);
287         SAVE(ACCR);
288 }
289
290 static void pxa3xx_cpu_pm_restore(unsigned long *sleep_save)
291 {
292         RESTORE(ACCR);
293         RESTORE(CKENA);
294         RESTORE(CKENB);
295 }
296
297 /*
298  * Enter a standby mode (S0D1C2 or S0D2C2).  Upon wakeup, the dynamic
299  * memory controller has to be reinitialised, so we place some code
300  * in the SRAM to perform this function.
301  *
302  * We disable FIQs across the standby - otherwise, we might receive a
303  * FIQ while the SDRAM is unavailable.
304  */
305 static void pxa3xx_cpu_standby(unsigned int pwrmode)
306 {
307         extern const char pm_enter_standby_start[], pm_enter_standby_end[];
308         void (*fn)(unsigned int) = (void __force *)(sram + 0x8000);
309
310         memcpy_toio(sram + 0x8000, pm_enter_standby_start,
311                     pm_enter_standby_end - pm_enter_standby_start);
312
313         AD2D0SR = ~0;
314         AD2D1SR = ~0;
315         AD2D0ER = wakeup_src;
316         AD2D1ER = 0;
317         ASCR = ASCR;
318         ARSR = ARSR;
319
320         local_fiq_disable();
321         fn(pwrmode);
322         local_fiq_enable();
323
324         AD2D0ER = 0;
325         AD2D1ER = 0;
326 }
327
328 /*
329  * NOTE:  currently, the OBM (OEM Boot Module) binary comes along with
330  * PXA3xx development kits assumes that the resuming process continues
331  * with the address stored within the first 4 bytes of SDRAM. The PSPR
332  * register is used privately by BootROM and OBM, and _must_ be set to
333  * 0x5c014000 for the moment.
334  */
335 static void pxa3xx_cpu_pm_suspend(void)
336 {
337         volatile unsigned long *p = (volatile void *)0xc0000000;
338         unsigned long saved_data = *p;
339
340         extern void pxa3xx_cpu_suspend(void);
341         extern void pxa3xx_cpu_resume(void);
342
343         /* resuming from D2 requires the HSIO2/BOOT/TPM clocks enabled */
344         CKENA |= (1 << CKEN_BOOT) | (1 << CKEN_TPM);
345         CKENB |= 1 << (CKEN_HSIO2 & 0x1f);
346
347         /* clear and setup wakeup source */
348         AD3SR = ~0;
349         AD3ER = wakeup_src;
350         ASCR = ASCR;
351         ARSR = ARSR;
352
353         PCFR |= (1u << 13);                     /* L1_DIS */
354         PCFR &= ~((1u << 12) | (1u << 1));      /* L0_EN | SL_ROD */
355
356         PSPR = 0x5c014000;
357
358         /* overwrite with the resume address */
359         *p = virt_to_phys(pxa3xx_cpu_resume);
360
361         pxa3xx_cpu_suspend();
362
363         *p = saved_data;
364
365         AD3ER = 0;
366 }
367
368 static void pxa3xx_cpu_pm_enter(suspend_state_t state)
369 {
370         /*
371          * Don't sleep if no wakeup sources are defined
372          */
373         if (wakeup_src == 0) {
374                 printk(KERN_ERR "Not suspending: no wakeup sources\n");
375                 return;
376         }
377
378         switch (state) {
379         case PM_SUSPEND_STANDBY:
380                 pxa3xx_cpu_standby(PXA3xx_PM_S0D2C2);
381                 break;
382
383         case PM_SUSPEND_MEM:
384                 pxa3xx_cpu_pm_suspend();
385                 break;
386         }
387 }
388
389 static int pxa3xx_cpu_pm_valid(suspend_state_t state)
390 {
391         return state == PM_SUSPEND_MEM || state == PM_SUSPEND_STANDBY;
392 }
393
394 static struct pxa_cpu_pm_fns pxa3xx_cpu_pm_fns = {
395         .save_count     = SLEEP_SAVE_COUNT,
396         .save           = pxa3xx_cpu_pm_save,
397         .restore        = pxa3xx_cpu_pm_restore,
398         .valid          = pxa3xx_cpu_pm_valid,
399         .enter          = pxa3xx_cpu_pm_enter,
400 };
401
402 static void __init pxa3xx_init_pm(void)
403 {
404         sram = ioremap(ISRAM_START, ISRAM_SIZE);
405         if (!sram) {
406                 printk(KERN_ERR "Unable to map ISRAM: disabling standby/suspend\n");
407                 return;
408         }
409
410         /*
411          * Since we copy wakeup code into the SRAM, we need to ensure
412          * that it is preserved over the low power modes.  Note: bit 8
413          * is undocumented in the developer manual, but must be set.
414          */
415         AD1R |= ADXR_L2 | ADXR_R0;
416         AD2R |= ADXR_L2 | ADXR_R0;
417         AD3R |= ADXR_L2 | ADXR_R0;
418
419         /*
420          * Clear the resume enable registers.
421          */
422         AD1D0ER = 0;
423         AD2D0ER = 0;
424         AD2D1ER = 0;
425         AD3ER = 0;
426
427         pxa_cpu_pm_fns = &pxa3xx_cpu_pm_fns;
428 }
429
430 static int pxa3xx_set_wake(unsigned int irq, unsigned int on)
431 {
432         unsigned long flags, mask = 0;
433
434         switch (irq) {
435         case IRQ_SSP3:
436                 mask = ADXER_MFP_WSSP3;
437                 break;
438         case IRQ_MSL:
439                 mask = ADXER_WMSL0;
440                 break;
441         case IRQ_USBH2:
442         case IRQ_USBH1:
443                 mask = ADXER_WUSBH;
444                 break;
445         case IRQ_KEYPAD:
446                 mask = ADXER_WKP;
447                 break;
448         case IRQ_AC97:
449                 mask = ADXER_MFP_WAC97;
450                 break;
451         case IRQ_USIM:
452                 mask = ADXER_WUSIM0;
453                 break;
454         case IRQ_SSP2:
455                 mask = ADXER_MFP_WSSP2;
456                 break;
457         case IRQ_I2C:
458                 mask = ADXER_MFP_WI2C;
459                 break;
460         case IRQ_STUART:
461                 mask = ADXER_MFP_WUART3;
462                 break;
463         case IRQ_BTUART:
464                 mask = ADXER_MFP_WUART2;
465                 break;
466         case IRQ_FFUART:
467                 mask = ADXER_MFP_WUART1;
468                 break;
469         case IRQ_MMC:
470                 mask = ADXER_MFP_WMMC1;
471                 break;
472         case IRQ_SSP:
473                 mask = ADXER_MFP_WSSP1;
474                 break;
475         case IRQ_RTCAlrm:
476                 mask = ADXER_WRTC;
477                 break;
478         case IRQ_SSP4:
479                 mask = ADXER_MFP_WSSP4;
480                 break;
481         case IRQ_TSI:
482                 mask = ADXER_WTSI;
483                 break;
484         case IRQ_USIM2:
485                 mask = ADXER_WUSIM1;
486                 break;
487         case IRQ_MMC2:
488                 mask = ADXER_MFP_WMMC2;
489                 break;
490         case IRQ_NAND:
491                 mask = ADXER_MFP_WFLASH;
492                 break;
493         case IRQ_USB2:
494                 mask = ADXER_WUSB2;
495                 break;
496         case IRQ_WAKEUP0:
497                 mask = ADXER_WEXTWAKE0;
498                 break;
499         case IRQ_WAKEUP1:
500                 mask = ADXER_WEXTWAKE1;
501                 break;
502         case IRQ_MMC3:
503                 mask = ADXER_MFP_GEN12;
504                 break;
505         default:
506                 return -EINVAL;
507         }
508
509         local_irq_save(flags);
510         if (on)
511                 wakeup_src |= mask;
512         else
513                 wakeup_src &= ~mask;
514         local_irq_restore(flags);
515
516         return 0;
517 }
518 #else
519 static inline void pxa3xx_init_pm(void) {}
520 #define pxa3xx_set_wake NULL
521 #endif
522
523 static void pxa_ack_ext_wakeup(unsigned int irq)
524 {
525         PECR |= PECR_IS(irq - IRQ_WAKEUP0);
526 }
527
528 static void pxa_mask_ext_wakeup(unsigned int irq)
529 {
530         ICMR2 &= ~(1 << ((irq - PXA_IRQ(0)) & 0x1f));
531         PECR &= ~PECR_IE(irq - IRQ_WAKEUP0);
532 }
533
534 static void pxa_unmask_ext_wakeup(unsigned int irq)
535 {
536         ICMR2 |= 1 << ((irq - PXA_IRQ(0)) & 0x1f);
537         PECR |= PECR_IE(irq - IRQ_WAKEUP0);
538 }
539
540 static int pxa_set_ext_wakeup_type(unsigned int irq, unsigned int flow_type)
541 {
542         if (flow_type & IRQ_TYPE_EDGE_RISING)
543                 PWER |= 1 << (irq - IRQ_WAKEUP0);
544
545         if (flow_type & IRQ_TYPE_EDGE_FALLING)
546                 PWER |= 1 << (irq - IRQ_WAKEUP0 + 2);
547
548         return 0;
549 }
550
551 static struct irq_chip pxa_ext_wakeup_chip = {
552         .name           = "WAKEUP",
553         .ack            = pxa_ack_ext_wakeup,
554         .mask           = pxa_mask_ext_wakeup,
555         .unmask         = pxa_unmask_ext_wakeup,
556         .set_type       = pxa_set_ext_wakeup_type,
557 };
558
559 static void __init pxa_init_ext_wakeup_irq(set_wake_t fn)
560 {
561         int irq;
562
563         for (irq = IRQ_WAKEUP0; irq <= IRQ_WAKEUP1; irq++) {
564                 set_irq_chip(irq, &pxa_ext_wakeup_chip);
565                 set_irq_handler(irq, handle_edge_irq);
566                 set_irq_flags(irq, IRQF_VALID);
567         }
568
569         pxa_ext_wakeup_chip.set_wake = fn;
570 }
571
572 void __init pxa3xx_init_irq(void)
573 {
574         /* enable CP6 access */
575         u32 value;
576         __asm__ __volatile__("mrc p15, 0, %0, c15, c1, 0\n": "=r"(value));
577         value |= (1 << 6);
578         __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value));
579
580         pxa_init_irq(56, pxa3xx_set_wake);
581         pxa_init_ext_wakeup_irq(pxa3xx_set_wake);
582         pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL);
583 }
584
585 static struct map_desc pxa3xx_io_desc[] __initdata = {
586         {       /* Mem Ctl */
587                 .virtual        = SMEMC_VIRT,
588                 .pfn            = __phys_to_pfn(PXA3XX_SMEMC_BASE),
589                 .length         = 0x00200000,
590                 .type           = MT_DEVICE
591         }
592 };
593
594 void __init pxa3xx_map_io(void)
595 {
596         pxa_map_io();
597         iotable_init(ARRAY_AND_SIZE(pxa3xx_io_desc));
598         pxa3xx_get_clk_frequency_khz(1);
599 }
600
601 /*
602  * device registration specific to PXA3xx.
603  */
604
605 void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info)
606 {
607         pxa_register_device(&pxa3xx_device_i2c_power, info);
608 }
609
610 static struct platform_device *devices[] __initdata = {
611         &pxa27x_device_udc,
612         &pxa_device_pmu,
613         &pxa_device_i2s,
614         &pxa_device_asoc_ssp1,
615         &pxa_device_asoc_ssp2,
616         &pxa_device_asoc_ssp3,
617         &pxa_device_asoc_ssp4,
618         &pxa_device_asoc_platform,
619         &sa1100_device_rtc,
620         &pxa_device_rtc,
621         &pxa27x_device_ssp1,
622         &pxa27x_device_ssp2,
623         &pxa27x_device_ssp3,
624         &pxa3xx_device_ssp4,
625         &pxa27x_device_pwm0,
626         &pxa27x_device_pwm1,
627 };
628
629 static struct sys_device pxa3xx_sysdev[] = {
630         {
631                 .cls    = &pxa_irq_sysclass,
632         }, {
633                 .cls    = &pxa3xx_mfp_sysclass,
634         }, {
635                 .cls    = &pxa_gpio_sysclass,
636         },
637 };
638
639 static int __init pxa3xx_init(void)
640 {
641         int i, ret = 0;
642
643         if (cpu_is_pxa3xx()) {
644
645                 reset_status = ARSR;
646
647                 /*
648                  * clear RDH bit every time after reset
649                  *
650                  * Note: the last 3 bits DxS are write-1-to-clear so carefully
651                  * preserve them here in case they will be referenced later
652                  */
653                 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S);
654
655                 clkdev_add_table(pxa3xx_clkregs, ARRAY_SIZE(pxa3xx_clkregs));
656
657                 if ((ret = pxa_init_dma(IRQ_DMA, 32)))
658                         return ret;
659
660                 pxa3xx_init_pm();
661
662                 for (i = 0; i < ARRAY_SIZE(pxa3xx_sysdev); i++) {
663                         ret = sysdev_register(&pxa3xx_sysdev[i]);
664                         if (ret)
665                                 pr_err("failed to register sysdev[%d]\n", i);
666                 }
667
668                 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
669         }
670
671         return ret;
672 }
673
674 postcore_initcall(pxa3xx_init);