pxa3xx.c 15 KB

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