pxa3xx.c 15 KB

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