dpmc.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  1. /*
  2. * Miscellaneous IOCTL commands for Dynamic Power Management Controller Driver
  3. *
  4. * Copyright (C) 2004-2009 Analog Device Inc.
  5. *
  6. * Licensed under the GPL-2
  7. */
  8. #ifndef _BLACKFIN_DPMC_H_
  9. #define _BLACKFIN_DPMC_H_
  10. #ifdef __ASSEMBLY__
  11. #define PM_REG0 R7
  12. #define PM_REG1 R6
  13. #define PM_REG2 R5
  14. #define PM_REG3 R4
  15. #define PM_REG4 R3
  16. #define PM_REG5 R2
  17. #define PM_REG6 R1
  18. #define PM_REG7 R0
  19. #define PM_REG8 P5
  20. #define PM_REG9 P4
  21. #define PM_REG10 P3
  22. #define PM_REG11 P2
  23. #define PM_REG12 P1
  24. #define PM_REG13 P0
  25. #define PM_REGSET0 R7:7
  26. #define PM_REGSET1 R7:6
  27. #define PM_REGSET2 R7:5
  28. #define PM_REGSET3 R7:4
  29. #define PM_REGSET4 R7:3
  30. #define PM_REGSET5 R7:2
  31. #define PM_REGSET6 R7:1
  32. #define PM_REGSET7 R7:0
  33. #define PM_REGSET8 R7:0, P5:5
  34. #define PM_REGSET9 R7:0, P5:4
  35. #define PM_REGSET10 R7:0, P5:3
  36. #define PM_REGSET11 R7:0, P5:2
  37. #define PM_REGSET12 R7:0, P5:1
  38. #define PM_REGSET13 R7:0, P5:0
  39. #define _PM_PUSH(n, x, w, base) PM_REG##n = w[FP + ((x) - (base))];
  40. #define _PM_POP(n, x, w, base) w[FP + ((x) - (base))] = PM_REG##n;
  41. #define PM_PUSH_SYNC(n) [--sp] = (PM_REGSET##n);
  42. #define PM_POP_SYNC(n) (PM_REGSET##n) = [sp++];
  43. #define PM_PUSH(n, x) PM_REG##n = [FP++];
  44. #define PM_POP(n, x) [FP--] = PM_REG##n;
  45. #define PM_CORE_PUSH(n, x) _PM_PUSH(n, x, , COREMMR_BASE)
  46. #define PM_CORE_POP(n, x) _PM_POP(n, x, , COREMMR_BASE)
  47. #define PM_SYS_PUSH(n, x) _PM_PUSH(n, x, , SYSMMR_BASE)
  48. #define PM_SYS_POP(n, x) _PM_POP(n, x, , SYSMMR_BASE)
  49. #define PM_SYS_PUSH16(n, x) _PM_PUSH(n, x, w, SYSMMR_BASE)
  50. #define PM_SYS_POP16(n, x) _PM_POP(n, x, w, SYSMMR_BASE)
  51. .macro bfin_init_pm_bench_cycles
  52. #ifdef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH
  53. R4 = 0;
  54. CYCLES = R4;
  55. CYCLES2 = R4;
  56. R4 = SYSCFG;
  57. BITSET(R4, 1);
  58. SYSCFG = R4;
  59. #endif
  60. .endm
  61. .macro bfin_cpu_reg_save
  62. /*
  63. * Save the core regs early so we can blow them away when
  64. * saving/restoring MMR states
  65. */
  66. [--sp] = (R7:0, P5:0);
  67. [--sp] = fp;
  68. [--sp] = usp;
  69. [--sp] = i0;
  70. [--sp] = i1;
  71. [--sp] = i2;
  72. [--sp] = i3;
  73. [--sp] = m0;
  74. [--sp] = m1;
  75. [--sp] = m2;
  76. [--sp] = m3;
  77. [--sp] = l0;
  78. [--sp] = l1;
  79. [--sp] = l2;
  80. [--sp] = l3;
  81. [--sp] = b0;
  82. [--sp] = b1;
  83. [--sp] = b2;
  84. [--sp] = b3;
  85. [--sp] = a0.x;
  86. [--sp] = a0.w;
  87. [--sp] = a1.x;
  88. [--sp] = a1.w;
  89. [--sp] = LC0;
  90. [--sp] = LC1;
  91. [--sp] = LT0;
  92. [--sp] = LT1;
  93. [--sp] = LB0;
  94. [--sp] = LB1;
  95. /* We can't push RETI directly as that'll change IPEND[4] */
  96. r7 = RETI;
  97. [--sp] = RETS;
  98. [--sp] = ASTAT;
  99. #ifndef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH
  100. [--sp] = CYCLES;
  101. [--sp] = CYCLES2;
  102. #endif
  103. [--sp] = SYSCFG;
  104. [--sp] = RETX;
  105. [--sp] = SEQSTAT;
  106. [--sp] = r7;
  107. /* Save first func arg in M3 */
  108. M3 = R0;
  109. .endm
  110. .macro bfin_cpu_reg_restore
  111. /* Restore Core Registers */
  112. RETI = [sp++];
  113. SEQSTAT = [sp++];
  114. RETX = [sp++];
  115. SYSCFG = [sp++];
  116. #ifndef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH
  117. CYCLES2 = [sp++];
  118. CYCLES = [sp++];
  119. #endif
  120. ASTAT = [sp++];
  121. RETS = [sp++];
  122. LB1 = [sp++];
  123. LB0 = [sp++];
  124. LT1 = [sp++];
  125. LT0 = [sp++];
  126. LC1 = [sp++];
  127. LC0 = [sp++];
  128. a1.w = [sp++];
  129. a1.x = [sp++];
  130. a0.w = [sp++];
  131. a0.x = [sp++];
  132. b3 = [sp++];
  133. b2 = [sp++];
  134. b1 = [sp++];
  135. b0 = [sp++];
  136. l3 = [sp++];
  137. l2 = [sp++];
  138. l1 = [sp++];
  139. l0 = [sp++];
  140. m3 = [sp++];
  141. m2 = [sp++];
  142. m1 = [sp++];
  143. m0 = [sp++];
  144. i3 = [sp++];
  145. i2 = [sp++];
  146. i1 = [sp++];
  147. i0 = [sp++];
  148. usp = [sp++];
  149. fp = [sp++];
  150. (R7:0, P5:0) = [sp++];
  151. .endm
  152. .macro bfin_sys_mmr_save
  153. /* Save system MMRs */
  154. FP.H = hi(SYSMMR_BASE);
  155. FP.L = lo(SYSMMR_BASE);
  156. #ifdef SIC_IMASK0
  157. PM_SYS_PUSH(0, SIC_IMASK0)
  158. PM_SYS_PUSH(1, SIC_IMASK1)
  159. # ifdef SIC_IMASK2
  160. PM_SYS_PUSH(2, SIC_IMASK2)
  161. # endif
  162. #else
  163. # ifdef SIC_IMASK
  164. PM_SYS_PUSH(0, SIC_IMASK)
  165. # endif
  166. #endif
  167. #ifdef SIC_IAR0
  168. PM_SYS_PUSH(3, SIC_IAR0)
  169. PM_SYS_PUSH(4, SIC_IAR1)
  170. PM_SYS_PUSH(5, SIC_IAR2)
  171. #endif
  172. #ifdef SIC_IAR3
  173. PM_SYS_PUSH(6, SIC_IAR3)
  174. #endif
  175. #ifdef SIC_IAR4
  176. PM_SYS_PUSH(7, SIC_IAR4)
  177. PM_SYS_PUSH(8, SIC_IAR5)
  178. PM_SYS_PUSH(9, SIC_IAR6)
  179. #endif
  180. #ifdef SIC_IAR7
  181. PM_SYS_PUSH(10, SIC_IAR7)
  182. #endif
  183. #ifdef SIC_IAR8
  184. PM_SYS_PUSH(11, SIC_IAR8)
  185. PM_SYS_PUSH(12, SIC_IAR9)
  186. PM_SYS_PUSH(13, SIC_IAR10)
  187. #endif
  188. PM_PUSH_SYNC(13)
  189. #ifdef SIC_IAR11
  190. PM_SYS_PUSH(0, SIC_IAR11)
  191. #endif
  192. #ifdef SIC_IWR
  193. PM_SYS_PUSH(1, SIC_IWR)
  194. #endif
  195. #ifdef SIC_IWR0
  196. PM_SYS_PUSH(1, SIC_IWR0)
  197. #endif
  198. #ifdef SIC_IWR1
  199. PM_SYS_PUSH(2, SIC_IWR1)
  200. #endif
  201. #ifdef SIC_IWR2
  202. PM_SYS_PUSH(3, SIC_IWR2)
  203. #endif
  204. #ifdef PINT0_ASSIGN
  205. PM_SYS_PUSH(4, PINT0_MASK_SET)
  206. PM_SYS_PUSH(5, PINT1_MASK_SET)
  207. PM_SYS_PUSH(6, PINT2_MASK_SET)
  208. PM_SYS_PUSH(7, PINT3_MASK_SET)
  209. PM_SYS_PUSH(8, PINT0_ASSIGN)
  210. PM_SYS_PUSH(9, PINT1_ASSIGN)
  211. PM_SYS_PUSH(10, PINT2_ASSIGN)
  212. PM_SYS_PUSH(11, PINT3_ASSIGN)
  213. PM_SYS_PUSH(12, PINT0_INVERT_SET)
  214. PM_SYS_PUSH(13, PINT1_INVERT_SET)
  215. PM_PUSH_SYNC(13)
  216. PM_SYS_PUSH(0, PINT2_INVERT_SET)
  217. PM_SYS_PUSH(1, PINT3_INVERT_SET)
  218. PM_SYS_PUSH(2, PINT0_EDGE_SET)
  219. PM_SYS_PUSH(3, PINT1_EDGE_SET)
  220. PM_SYS_PUSH(4, PINT2_EDGE_SET)
  221. PM_SYS_PUSH(5, PINT3_EDGE_SET)
  222. #endif
  223. #ifdef SYSCR
  224. PM_SYS_PUSH16(6, SYSCR)
  225. #endif
  226. #ifdef EBIU_AMGCTL
  227. PM_SYS_PUSH16(7, EBIU_AMGCTL)
  228. PM_SYS_PUSH(8, EBIU_AMBCTL0)
  229. PM_SYS_PUSH(9, EBIU_AMBCTL1)
  230. #endif
  231. #ifdef EBIU_FCTL
  232. PM_SYS_PUSH(10, EBIU_MBSCTL)
  233. PM_SYS_PUSH(11, EBIU_MODE)
  234. PM_SYS_PUSH(12, EBIU_FCTL)
  235. PM_PUSH_SYNC(12)
  236. #else
  237. PM_PUSH_SYNC(9)
  238. #endif
  239. .endm
  240. .macro bfin_sys_mmr_restore
  241. /* Restore System MMRs */
  242. FP.H = hi(SYSMMR_BASE);
  243. FP.L = lo(SYSMMR_BASE);
  244. #ifdef EBIU_FCTL
  245. PM_POP_SYNC(12)
  246. PM_SYS_POP(12, EBIU_FCTL)
  247. PM_SYS_POP(11, EBIU_MODE)
  248. PM_SYS_POP(10, EBIU_MBSCTL)
  249. #else
  250. PM_POP_SYNC(9)
  251. #endif
  252. #ifdef EBIU_AMGCTL
  253. PM_SYS_POP(9, EBIU_AMBCTL1)
  254. PM_SYS_POP(8, EBIU_AMBCTL0)
  255. PM_SYS_POP16(7, EBIU_AMGCTL)
  256. #endif
  257. #ifdef SYSCR
  258. PM_SYS_POP16(6, SYSCR)
  259. #endif
  260. #ifdef PINT0_ASSIGN
  261. PM_SYS_POP(5, PINT3_EDGE_SET)
  262. PM_SYS_POP(4, PINT2_EDGE_SET)
  263. PM_SYS_POP(3, PINT1_EDGE_SET)
  264. PM_SYS_POP(2, PINT0_EDGE_SET)
  265. PM_SYS_POP(1, PINT3_INVERT_SET)
  266. PM_SYS_POP(0, PINT2_INVERT_SET)
  267. PM_POP_SYNC(13)
  268. PM_SYS_POP(13, PINT1_INVERT_SET)
  269. PM_SYS_POP(12, PINT0_INVERT_SET)
  270. PM_SYS_POP(11, PINT3_ASSIGN)
  271. PM_SYS_POP(10, PINT2_ASSIGN)
  272. PM_SYS_POP(9, PINT1_ASSIGN)
  273. PM_SYS_POP(8, PINT0_ASSIGN)
  274. PM_SYS_POP(7, PINT3_MASK_SET)
  275. PM_SYS_POP(6, PINT2_MASK_SET)
  276. PM_SYS_POP(5, PINT1_MASK_SET)
  277. PM_SYS_POP(4, PINT0_MASK_SET)
  278. #endif
  279. #ifdef SIC_IWR2
  280. PM_SYS_POP(3, SIC_IWR2)
  281. #endif
  282. #ifdef SIC_IWR1
  283. PM_SYS_POP(2, SIC_IWR1)
  284. #endif
  285. #ifdef SIC_IWR0
  286. PM_SYS_POP(1, SIC_IWR0)
  287. #endif
  288. #ifdef SIC_IWR
  289. PM_SYS_POP(1, SIC_IWR)
  290. #endif
  291. #ifdef SIC_IAR11
  292. PM_SYS_POP(0, SIC_IAR11)
  293. #endif
  294. PM_POP_SYNC(13)
  295. #ifdef SIC_IAR8
  296. PM_SYS_POP(13, SIC_IAR10)
  297. PM_SYS_POP(12, SIC_IAR9)
  298. PM_SYS_POP(11, SIC_IAR8)
  299. #endif
  300. #ifdef SIC_IAR7
  301. PM_SYS_POP(10, SIC_IAR7)
  302. #endif
  303. #ifdef SIC_IAR6
  304. PM_SYS_POP(9, SIC_IAR6)
  305. PM_SYS_POP(8, SIC_IAR5)
  306. PM_SYS_POP(7, SIC_IAR4)
  307. #endif
  308. #ifdef SIC_IAR3
  309. PM_SYS_POP(6, SIC_IAR3)
  310. #endif
  311. #ifdef SIC_IAR0
  312. PM_SYS_POP(5, SIC_IAR2)
  313. PM_SYS_POP(4, SIC_IAR1)
  314. PM_SYS_POP(3, SIC_IAR0)
  315. #endif
  316. #ifdef SIC_IMASK0
  317. # ifdef SIC_IMASK2
  318. PM_SYS_POP(2, SIC_IMASK2)
  319. # endif
  320. PM_SYS_POP(1, SIC_IMASK1)
  321. PM_SYS_POP(0, SIC_IMASK0)
  322. #else
  323. # ifdef SIC_IMASK
  324. PM_SYS_POP(0, SIC_IMASK)
  325. # endif
  326. #endif
  327. .endm
  328. .macro bfin_core_mmr_save
  329. /* Save Core MMRs */
  330. I0.H = hi(COREMMR_BASE);
  331. I0.L = lo(COREMMR_BASE);
  332. I1 = I0;
  333. I2 = I0;
  334. I3 = I0;
  335. B0 = I0;
  336. B1 = I0;
  337. B2 = I0;
  338. B3 = I0;
  339. I1.L = lo(DCPLB_ADDR0);
  340. I2.L = lo(DCPLB_DATA0);
  341. I3.L = lo(ICPLB_ADDR0);
  342. B0.L = lo(ICPLB_DATA0);
  343. B1.L = lo(EVT2);
  344. B2.L = lo(IMASK);
  345. B3.L = lo(TCNTL);
  346. /* Event Vectors */
  347. FP = B1;
  348. PM_PUSH(0, EVT2)
  349. PM_PUSH(1, EVT3)
  350. FP += 4; /* EVT4 */
  351. PM_PUSH(2, EVT5)
  352. PM_PUSH(3, EVT6)
  353. PM_PUSH(4, EVT7)
  354. PM_PUSH(5, EVT8)
  355. PM_PUSH_SYNC(5)
  356. PM_PUSH(0, EVT9)
  357. PM_PUSH(1, EVT10)
  358. PM_PUSH(2, EVT11)
  359. PM_PUSH(3, EVT12)
  360. PM_PUSH(4, EVT13)
  361. PM_PUSH(5, EVT14)
  362. PM_PUSH(6, EVT15)
  363. /* CEC */
  364. FP = B2;
  365. PM_PUSH(7, IMASK)
  366. FP += 4; /* IPEND */
  367. PM_PUSH(8, ILAT)
  368. PM_PUSH(9, IPRIO)
  369. /* Core Timer */
  370. FP = B3;
  371. PM_PUSH(10, TCNTL)
  372. PM_PUSH(11, TPERIOD)
  373. PM_PUSH(12, TSCALE)
  374. PM_PUSH(13, TCOUNT)
  375. PM_PUSH_SYNC(13)
  376. /* Misc non-contiguous registers */
  377. FP = I0;
  378. PM_CORE_PUSH(0, DMEM_CONTROL);
  379. PM_CORE_PUSH(1, IMEM_CONTROL);
  380. PM_CORE_PUSH(2, TBUFCTL);
  381. PM_PUSH_SYNC(2)
  382. /* DCPLB Addr */
  383. FP = I1;
  384. PM_PUSH(0, DCPLB_ADDR0)
  385. PM_PUSH(1, DCPLB_ADDR1)
  386. PM_PUSH(2, DCPLB_ADDR2)
  387. PM_PUSH(3, DCPLB_ADDR3)
  388. PM_PUSH(4, DCPLB_ADDR4)
  389. PM_PUSH(5, DCPLB_ADDR5)
  390. PM_PUSH(6, DCPLB_ADDR6)
  391. PM_PUSH(7, DCPLB_ADDR7)
  392. PM_PUSH(8, DCPLB_ADDR8)
  393. PM_PUSH(9, DCPLB_ADDR9)
  394. PM_PUSH(10, DCPLB_ADDR10)
  395. PM_PUSH(11, DCPLB_ADDR11)
  396. PM_PUSH(12, DCPLB_ADDR12)
  397. PM_PUSH(13, DCPLB_ADDR13)
  398. PM_PUSH_SYNC(13)
  399. PM_PUSH(0, DCPLB_ADDR14)
  400. PM_PUSH(1, DCPLB_ADDR15)
  401. /* DCPLB Data */
  402. FP = I2;
  403. PM_PUSH(2, DCPLB_DATA0)
  404. PM_PUSH(3, DCPLB_DATA1)
  405. PM_PUSH(4, DCPLB_DATA2)
  406. PM_PUSH(5, DCPLB_DATA3)
  407. PM_PUSH(6, DCPLB_DATA4)
  408. PM_PUSH(7, DCPLB_DATA5)
  409. PM_PUSH(8, DCPLB_DATA6)
  410. PM_PUSH(9, DCPLB_DATA7)
  411. PM_PUSH(10, DCPLB_DATA8)
  412. PM_PUSH(11, DCPLB_DATA9)
  413. PM_PUSH(12, DCPLB_DATA10)
  414. PM_PUSH(13, DCPLB_DATA11)
  415. PM_PUSH_SYNC(13)
  416. PM_PUSH(0, DCPLB_DATA12)
  417. PM_PUSH(1, DCPLB_DATA13)
  418. PM_PUSH(2, DCPLB_DATA14)
  419. PM_PUSH(3, DCPLB_DATA15)
  420. /* ICPLB Addr */
  421. FP = I3;
  422. PM_PUSH(4, ICPLB_ADDR0)
  423. PM_PUSH(5, ICPLB_ADDR1)
  424. PM_PUSH(6, ICPLB_ADDR2)
  425. PM_PUSH(7, ICPLB_ADDR3)
  426. PM_PUSH(8, ICPLB_ADDR4)
  427. PM_PUSH(9, ICPLB_ADDR5)
  428. PM_PUSH(10, ICPLB_ADDR6)
  429. PM_PUSH(11, ICPLB_ADDR7)
  430. PM_PUSH(12, ICPLB_ADDR8)
  431. PM_PUSH(13, ICPLB_ADDR9)
  432. PM_PUSH_SYNC(13)
  433. PM_PUSH(0, ICPLB_ADDR10)
  434. PM_PUSH(1, ICPLB_ADDR11)
  435. PM_PUSH(2, ICPLB_ADDR12)
  436. PM_PUSH(3, ICPLB_ADDR13)
  437. PM_PUSH(4, ICPLB_ADDR14)
  438. PM_PUSH(5, ICPLB_ADDR15)
  439. /* ICPLB Data */
  440. FP = B0;
  441. PM_PUSH(6, ICPLB_DATA0)
  442. PM_PUSH(7, ICPLB_DATA1)
  443. PM_PUSH(8, ICPLB_DATA2)
  444. PM_PUSH(9, ICPLB_DATA3)
  445. PM_PUSH(10, ICPLB_DATA4)
  446. PM_PUSH(11, ICPLB_DATA5)
  447. PM_PUSH(12, ICPLB_DATA6)
  448. PM_PUSH(13, ICPLB_DATA7)
  449. PM_PUSH_SYNC(13)
  450. PM_PUSH(0, ICPLB_DATA8)
  451. PM_PUSH(1, ICPLB_DATA9)
  452. PM_PUSH(2, ICPLB_DATA10)
  453. PM_PUSH(3, ICPLB_DATA11)
  454. PM_PUSH(4, ICPLB_DATA12)
  455. PM_PUSH(5, ICPLB_DATA13)
  456. PM_PUSH(6, ICPLB_DATA14)
  457. PM_PUSH(7, ICPLB_DATA15)
  458. PM_PUSH_SYNC(7)
  459. .endm
  460. .macro bfin_core_mmr_restore
  461. /* Restore Core MMRs */
  462. I0.H = hi(COREMMR_BASE);
  463. I0.L = lo(COREMMR_BASE);
  464. I1 = I0;
  465. I2 = I0;
  466. I3 = I0;
  467. B0 = I0;
  468. B1 = I0;
  469. B2 = I0;
  470. B3 = I0;
  471. I1.L = lo(DCPLB_ADDR15);
  472. I2.L = lo(DCPLB_DATA15);
  473. I3.L = lo(ICPLB_ADDR15);
  474. B0.L = lo(ICPLB_DATA15);
  475. B1.L = lo(EVT15);
  476. B2.L = lo(IPRIO);
  477. B3.L = lo(TCOUNT);
  478. /* ICPLB Data */
  479. FP = B0;
  480. PM_POP_SYNC(7)
  481. PM_POP(7, ICPLB_DATA15)
  482. PM_POP(6, ICPLB_DATA14)
  483. PM_POP(5, ICPLB_DATA13)
  484. PM_POP(4, ICPLB_DATA12)
  485. PM_POP(3, ICPLB_DATA11)
  486. PM_POP(2, ICPLB_DATA10)
  487. PM_POP(1, ICPLB_DATA9)
  488. PM_POP(0, ICPLB_DATA8)
  489. PM_POP_SYNC(13)
  490. PM_POP(13, ICPLB_DATA7)
  491. PM_POP(12, ICPLB_DATA6)
  492. PM_POP(11, ICPLB_DATA5)
  493. PM_POP(10, ICPLB_DATA4)
  494. PM_POP(9, ICPLB_DATA3)
  495. PM_POP(8, ICPLB_DATA2)
  496. PM_POP(7, ICPLB_DATA1)
  497. PM_POP(6, ICPLB_DATA0)
  498. /* ICPLB Addr */
  499. FP = I3;
  500. PM_POP(5, ICPLB_ADDR15)
  501. PM_POP(4, ICPLB_ADDR14)
  502. PM_POP(3, ICPLB_ADDR13)
  503. PM_POP(2, ICPLB_ADDR12)
  504. PM_POP(1, ICPLB_ADDR11)
  505. PM_POP(0, ICPLB_ADDR10)
  506. PM_POP_SYNC(13)
  507. PM_POP(13, ICPLB_ADDR9)
  508. PM_POP(12, ICPLB_ADDR8)
  509. PM_POP(11, ICPLB_ADDR7)
  510. PM_POP(10, ICPLB_ADDR6)
  511. PM_POP(9, ICPLB_ADDR5)
  512. PM_POP(8, ICPLB_ADDR4)
  513. PM_POP(7, ICPLB_ADDR3)
  514. PM_POP(6, ICPLB_ADDR2)
  515. PM_POP(5, ICPLB_ADDR1)
  516. PM_POP(4, ICPLB_ADDR0)
  517. /* DCPLB Data */
  518. FP = I2;
  519. PM_POP(3, DCPLB_DATA15)
  520. PM_POP(2, DCPLB_DATA14)
  521. PM_POP(1, DCPLB_DATA13)
  522. PM_POP(0, DCPLB_DATA12)
  523. PM_POP_SYNC(13)
  524. PM_POP(13, DCPLB_DATA11)
  525. PM_POP(12, DCPLB_DATA10)
  526. PM_POP(11, DCPLB_DATA9)
  527. PM_POP(10, DCPLB_DATA8)
  528. PM_POP(9, DCPLB_DATA7)
  529. PM_POP(8, DCPLB_DATA6)
  530. PM_POP(7, DCPLB_DATA5)
  531. PM_POP(6, DCPLB_DATA4)
  532. PM_POP(5, DCPLB_DATA3)
  533. PM_POP(4, DCPLB_DATA2)
  534. PM_POP(3, DCPLB_DATA1)
  535. PM_POP(2, DCPLB_DATA0)
  536. /* DCPLB Addr */
  537. FP = I1;
  538. PM_POP(1, DCPLB_ADDR15)
  539. PM_POP(0, DCPLB_ADDR14)
  540. PM_POP_SYNC(13)
  541. PM_POP(13, DCPLB_ADDR13)
  542. PM_POP(12, DCPLB_ADDR12)
  543. PM_POP(11, DCPLB_ADDR11)
  544. PM_POP(10, DCPLB_ADDR10)
  545. PM_POP(9, DCPLB_ADDR9)
  546. PM_POP(8, DCPLB_ADDR8)
  547. PM_POP(7, DCPLB_ADDR7)
  548. PM_POP(6, DCPLB_ADDR6)
  549. PM_POP(5, DCPLB_ADDR5)
  550. PM_POP(4, DCPLB_ADDR4)
  551. PM_POP(3, DCPLB_ADDR3)
  552. PM_POP(2, DCPLB_ADDR2)
  553. PM_POP(1, DCPLB_ADDR1)
  554. PM_POP(0, DCPLB_ADDR0)
  555. /* Misc non-contiguous registers */
  556. /* icache & dcache will enable later
  557. drop IMEM_CONTROL, DMEM_CONTROL pop
  558. */
  559. FP = I0;
  560. PM_POP_SYNC(2)
  561. PM_CORE_POP(2, TBUFCTL)
  562. PM_CORE_POP(1, IMEM_CONTROL)
  563. PM_CORE_POP(0, DMEM_CONTROL)
  564. /* Core Timer */
  565. FP = B3;
  566. R0 = 0x1;
  567. [FP - 0xC] = R0;
  568. PM_POP_SYNC(13)
  569. FP = B3;
  570. PM_POP(13, TCOUNT)
  571. PM_POP(12, TSCALE)
  572. PM_POP(11, TPERIOD)
  573. PM_POP(10, TCNTL)
  574. /* CEC */
  575. FP = B2;
  576. PM_POP(9, IPRIO)
  577. PM_POP(8, ILAT)
  578. FP += -4; /* IPEND */
  579. PM_POP(7, IMASK)
  580. /* Event Vectors */
  581. FP = B1;
  582. PM_POP(6, EVT15)
  583. PM_POP(5, EVT14)
  584. PM_POP(4, EVT13)
  585. PM_POP(3, EVT12)
  586. PM_POP(2, EVT11)
  587. PM_POP(1, EVT10)
  588. PM_POP(0, EVT9)
  589. PM_POP_SYNC(5)
  590. PM_POP(5, EVT8)
  591. PM_POP(4, EVT7)
  592. PM_POP(3, EVT6)
  593. PM_POP(2, EVT5)
  594. FP += -4; /* EVT4 */
  595. PM_POP(1, EVT3)
  596. PM_POP(0, EVT2)
  597. .endm
  598. #endif
  599. #include <mach/pll.h>
  600. /* PLL_CTL Masks */
  601. #define DF 0x0001 /* 0: PLL = CLKIN, 1: PLL = CLKIN/2 */
  602. #define PLL_OFF 0x0002 /* PLL Not Powered */
  603. #define STOPCK 0x0008 /* Core Clock Off */
  604. #define PDWN 0x0020 /* Enter Deep Sleep Mode */
  605. #ifdef __ADSPBF539__
  606. # define IN_DELAY 0x0014 /* Add 200ps Delay To EBIU Input Latches */
  607. # define OUT_DELAY 0x00C0 /* Add 200ps Delay To EBIU Output Signals */
  608. #else
  609. # define IN_DELAY 0x0040 /* Add 200ps Delay To EBIU Input Latches */
  610. # define OUT_DELAY 0x0080 /* Add 200ps Delay To EBIU Output Signals */
  611. #endif
  612. #define BYPASS 0x0100 /* Bypass the PLL */
  613. #define MSEL 0x7E00 /* Multiplier Select For CCLK/VCO Factors */
  614. #define SPORT_HYST 0x8000 /* Enable Additional Hysteresis on SPORT Input Pins */
  615. #define SET_MSEL(x) (((x)&0x3F) << 0x9) /* Set MSEL = 0-63 --> VCO = CLKIN*MSEL */
  616. /* PLL_DIV Masks */
  617. #define SSEL 0x000F /* System Select */
  618. #define CSEL 0x0030 /* Core Select */
  619. #define CSEL_DIV1 0x0000 /* CCLK = VCO / 1 */
  620. #define CSEL_DIV2 0x0010 /* CCLK = VCO / 2 */
  621. #define CSEL_DIV4 0x0020 /* CCLK = VCO / 4 */
  622. #define CSEL_DIV8 0x0030 /* CCLK = VCO / 8 */
  623. #define CCLK_DIV1 CSEL_DIV1
  624. #define CCLK_DIV2 CSEL_DIV2
  625. #define CCLK_DIV4 CSEL_DIV4
  626. #define CCLK_DIV8 CSEL_DIV8
  627. #define SET_SSEL(x) ((x) & 0xF) /* Set SSEL = 0-15 --> SCLK = VCO/SSEL */
  628. #define SCLK_DIV(x) (x) /* SCLK = VCO / x */
  629. /* PLL_STAT Masks */
  630. #define ACTIVE_PLLENABLED 0x0001 /* Processor In Active Mode With PLL Enabled */
  631. #define FULL_ON 0x0002 /* Processor In Full On Mode */
  632. #define ACTIVE_PLLDISABLED 0x0004 /* Processor In Active Mode With PLL Disabled */
  633. #define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */
  634. #define RTCWS 0x0400 /* RTC/Reset Wake-Up Status */
  635. #define CANWS 0x0800 /* CAN Wake-Up Status */
  636. #define USBWS 0x2000 /* USB Wake-Up Status */
  637. #define KPADWS 0x4000 /* Keypad Wake-Up Status */
  638. #define ROTWS 0x8000 /* Rotary Wake-Up Status */
  639. #define GPWS 0x1000 /* General-Purpose Wake-Up Status */
  640. /* VR_CTL Masks */
  641. #if defined(__ADSPBF52x__) || defined(__ADSPBF51x__)
  642. #define FREQ 0x3000 /* Switching Oscillator Frequency For Regulator */
  643. #define FREQ_1000 0x3000 /* Switching Frequency Is 1 MHz */
  644. #else
  645. #define FREQ 0x0003 /* Switching Oscillator Frequency For Regulator */
  646. #define FREQ_333 0x0001 /* Switching Frequency Is 333 kHz */
  647. #define FREQ_667 0x0002 /* Switching Frequency Is 667 kHz */
  648. #define FREQ_1000 0x0003 /* Switching Frequency Is 1 MHz */
  649. #endif
  650. #define HIBERNATE 0x0000 /* Powerdown/Bypass On-Board Regulation */
  651. #define GAIN 0x000C /* Voltage Level Gain */
  652. #define GAIN_5 0x0000 /* GAIN = 5 */
  653. #define GAIN_10 0x0004 /* GAIN = 1 */
  654. #define GAIN_20 0x0008 /* GAIN = 2 */
  655. #define GAIN_50 0x000C /* GAIN = 5 */
  656. #define VLEV 0x00F0 /* Internal Voltage Level */
  657. #ifdef __ADSPBF52x__
  658. #define VLEV_085 0x0040 /* VLEV = 0.85 V (-5% - +10% Accuracy) */
  659. #define VLEV_090 0x0050 /* VLEV = 0.90 V (-5% - +10% Accuracy) */
  660. #define VLEV_095 0x0060 /* VLEV = 0.95 V (-5% - +10% Accuracy) */
  661. #define VLEV_100 0x0070 /* VLEV = 1.00 V (-5% - +10% Accuracy) */
  662. #define VLEV_105 0x0080 /* VLEV = 1.05 V (-5% - +10% Accuracy) */
  663. #define VLEV_110 0x0090 /* VLEV = 1.10 V (-5% - +10% Accuracy) */
  664. #define VLEV_115 0x00A0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */
  665. #define VLEV_120 0x00B0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */
  666. #else
  667. #define VLEV_085 0x0060 /* VLEV = 0.85 V (-5% - +10% Accuracy) */
  668. #define VLEV_090 0x0070 /* VLEV = 0.90 V (-5% - +10% Accuracy) */
  669. #define VLEV_095 0x0080 /* VLEV = 0.95 V (-5% - +10% Accuracy) */
  670. #define VLEV_100 0x0090 /* VLEV = 1.00 V (-5% - +10% Accuracy) */
  671. #define VLEV_105 0x00A0 /* VLEV = 1.05 V (-5% - +10% Accuracy) */
  672. #define VLEV_110 0x00B0 /* VLEV = 1.10 V (-5% - +10% Accuracy) */
  673. #define VLEV_115 0x00C0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */
  674. #define VLEV_120 0x00D0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */
  675. #define VLEV_125 0x00E0 /* VLEV = 1.25 V (-5% - +10% Accuracy) */
  676. #define VLEV_130 0x00F0 /* VLEV = 1.30 V (-5% - +10% Accuracy) */
  677. #endif
  678. #ifdef CONFIG_BF60x
  679. #define PA15WE 0x00000001 /* Allow Wake-Up from PA15 */
  680. #define PB15WE 0x00000002 /* Allow Wake-Up from PB15 */
  681. #define PC15WE 0x00000004 /* Allow Wake-Up from PC15 */
  682. #define PD06WE 0x00000008 /* Allow Wake-Up from PD06(ETH0_PHYINT) */
  683. #define PE12WE 0x00000010 /* Allow Wake-Up from PE12(ETH1_PHYINT, PUSH BUTTON) */
  684. #define PG04WE 0x00000020 /* Allow Wake-Up from PG04(CAN0_RX) */
  685. #define PG13WE 0x00000040 /* Allow Wake-Up from PG13 */
  686. #define USBWE 0x00000080 /* Allow Wake-Up from (USB) */
  687. #else
  688. #define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */
  689. #define CANWE 0x0200 /* Enable CAN Wakeup From Hibernate */
  690. #define PHYWE 0x0400 /* Enable PHY Wakeup From Hibernate */
  691. #define GPWE 0x0400 /* General-Purpose Wake-Up Enable */
  692. #define MXVRWE 0x0400 /* Enable MXVR Wakeup From Hibernate */
  693. #define KPADWE 0x1000 /* Keypad Wake-Up Enable */
  694. #define ROTWE 0x2000 /* Rotary Wake-Up Enable */
  695. #define CLKBUFOE 0x4000 /* CLKIN Buffer Output Enable */
  696. #define SCKELOW 0x8000 /* Do Not Drive SCKE High During Reset After Hibernate */
  697. #if defined(__ADSPBF52x__) || defined(__ADSPBF51x__)
  698. #define USBWE 0x0200 /* Enable USB Wakeup From Hibernate */
  699. #else
  700. #define USBWE 0x0800 /* Enable USB Wakeup From Hibernate */
  701. #endif
  702. #endif
  703. #ifndef __ASSEMBLY__
  704. void sleep_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);
  705. void sleep_deeper(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);
  706. void do_hibernate(int wakeup);
  707. void set_dram_srfs(void);
  708. void unset_dram_srfs(void);
  709. #define VRPAIR(vlev, freq) (((vlev) << 16) | ((freq) >> 16))
  710. #ifdef CONFIG_CPU_FREQ
  711. #define CPUFREQ_CPU 0
  712. #endif
  713. struct bfin_dpmc_platform_data {
  714. const unsigned int *tuple_tab;
  715. unsigned short tabsize;
  716. unsigned short vr_settling_time; /* in us */
  717. };
  718. #endif
  719. #endif /*_BLACKFIN_DPMC_H_*/