setup-sh7724.c 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318
  1. /*
  2. * SH7724 Setup
  3. *
  4. * Copyright (C) 2009 Renesas Solutions Corp.
  5. *
  6. * Kuninori Morimoto <morimoto.kuninori@renesas.com>
  7. *
  8. * Based on SH7723 Setup
  9. * Copyright (C) 2008 Paul Mundt
  10. *
  11. * This file is subject to the terms and conditions of the GNU General Public
  12. * License. See the file "COPYING" in the main directory of this archive
  13. * for more details.
  14. */
  15. #include <linux/platform_device.h>
  16. #include <linux/init.h>
  17. #include <linux/serial.h>
  18. #include <linux/mm.h>
  19. #include <linux/serial_sci.h>
  20. #include <linux/uio_driver.h>
  21. #include <linux/sh_timer.h>
  22. #include <linux/io.h>
  23. #include <linux/notifier.h>
  24. #include <asm/suspend.h>
  25. #include <asm/clock.h>
  26. #include <asm/dmaengine.h>
  27. #include <asm/mmzone.h>
  28. #include <cpu/dma-register.h>
  29. #include <cpu/sh7724.h>
  30. /* DMA */
  31. static struct sh_dmae_channel sh7724_dmae0_channels[] = {
  32. {
  33. .offset = 0,
  34. .dmars = 0,
  35. .dmars_bit = 0,
  36. }, {
  37. .offset = 0x10,
  38. .dmars = 0,
  39. .dmars_bit = 8,
  40. }, {
  41. .offset = 0x20,
  42. .dmars = 4,
  43. .dmars_bit = 0,
  44. }, {
  45. .offset = 0x30,
  46. .dmars = 4,
  47. .dmars_bit = 8,
  48. }, {
  49. .offset = 0x50,
  50. .dmars = 8,
  51. .dmars_bit = 0,
  52. }, {
  53. .offset = 0x60,
  54. .dmars = 8,
  55. .dmars_bit = 8,
  56. }
  57. };
  58. static struct sh_dmae_channel sh7724_dmae1_channels[] = {
  59. {
  60. .offset = 0,
  61. .dmars = 0,
  62. .dmars_bit = 0,
  63. }, {
  64. .offset = 0x10,
  65. .dmars = 0,
  66. .dmars_bit = 8,
  67. }, {
  68. .offset = 0x20,
  69. .dmars = 4,
  70. .dmars_bit = 0,
  71. }, {
  72. .offset = 0x30,
  73. .dmars = 4,
  74. .dmars_bit = 8,
  75. }, {
  76. .offset = 0x50,
  77. .dmars = 8,
  78. .dmars_bit = 0,
  79. }, {
  80. .offset = 0x60,
  81. .dmars = 8,
  82. .dmars_bit = 8,
  83. }
  84. };
  85. static unsigned int ts_shift[] = TS_SHIFT;
  86. static struct sh_dmae_pdata dma0_platform_data = {
  87. .channel = sh7724_dmae0_channels,
  88. .channel_num = ARRAY_SIZE(sh7724_dmae0_channels),
  89. .ts_low_shift = CHCR_TS_LOW_SHIFT,
  90. .ts_low_mask = CHCR_TS_LOW_MASK,
  91. .ts_high_shift = CHCR_TS_HIGH_SHIFT,
  92. .ts_high_mask = CHCR_TS_HIGH_MASK,
  93. .ts_shift = ts_shift,
  94. .ts_shift_num = ARRAY_SIZE(ts_shift),
  95. .dmaor_init = DMAOR_INIT,
  96. };
  97. static struct sh_dmae_pdata dma1_platform_data = {
  98. .channel = sh7724_dmae1_channels,
  99. .channel_num = ARRAY_SIZE(sh7724_dmae1_channels),
  100. .ts_low_shift = CHCR_TS_LOW_SHIFT,
  101. .ts_low_mask = CHCR_TS_LOW_MASK,
  102. .ts_high_shift = CHCR_TS_HIGH_SHIFT,
  103. .ts_high_mask = CHCR_TS_HIGH_MASK,
  104. .ts_shift = ts_shift,
  105. .ts_shift_num = ARRAY_SIZE(ts_shift),
  106. .dmaor_init = DMAOR_INIT,
  107. };
  108. /* Resource order important! */
  109. static struct resource sh7724_dmae0_resources[] = {
  110. {
  111. /* Channel registers and DMAOR */
  112. .start = 0xfe008020,
  113. .end = 0xfe00808f,
  114. .flags = IORESOURCE_MEM,
  115. },
  116. {
  117. /* DMARSx */
  118. .start = 0xfe009000,
  119. .end = 0xfe00900b,
  120. .flags = IORESOURCE_MEM,
  121. },
  122. {
  123. /* DMA error IRQ */
  124. .start = 78,
  125. .end = 78,
  126. .flags = IORESOURCE_IRQ,
  127. },
  128. {
  129. /* IRQ for channels 0-3 */
  130. .start = 48,
  131. .end = 51,
  132. .flags = IORESOURCE_IRQ,
  133. },
  134. {
  135. /* IRQ for channels 4-5 */
  136. .start = 76,
  137. .end = 77,
  138. .flags = IORESOURCE_IRQ,
  139. },
  140. };
  141. /* Resource order important! */
  142. static struct resource sh7724_dmae1_resources[] = {
  143. {
  144. /* Channel registers and DMAOR */
  145. .start = 0xfdc08020,
  146. .end = 0xfdc0808f,
  147. .flags = IORESOURCE_MEM,
  148. },
  149. {
  150. /* DMARSx */
  151. .start = 0xfdc09000,
  152. .end = 0xfdc0900b,
  153. .flags = IORESOURCE_MEM,
  154. },
  155. {
  156. /* DMA error IRQ */
  157. .start = 74,
  158. .end = 74,
  159. .flags = IORESOURCE_IRQ,
  160. },
  161. {
  162. /* IRQ for channels 0-3 */
  163. .start = 40,
  164. .end = 43,
  165. .flags = IORESOURCE_IRQ,
  166. },
  167. {
  168. /* IRQ for channels 4-5 */
  169. .start = 72,
  170. .end = 73,
  171. .flags = IORESOURCE_IRQ,
  172. },
  173. };
  174. static struct platform_device dma0_device = {
  175. .name = "sh-dma-engine",
  176. .id = 0,
  177. .resource = sh7724_dmae0_resources,
  178. .num_resources = ARRAY_SIZE(sh7724_dmae0_resources),
  179. .dev = {
  180. .platform_data = &dma0_platform_data,
  181. },
  182. .archdata = {
  183. .hwblk_id = HWBLK_DMAC0,
  184. },
  185. };
  186. static struct platform_device dma1_device = {
  187. .name = "sh-dma-engine",
  188. .id = 1,
  189. .resource = sh7724_dmae1_resources,
  190. .num_resources = ARRAY_SIZE(sh7724_dmae1_resources),
  191. .dev = {
  192. .platform_data = &dma1_platform_data,
  193. },
  194. .archdata = {
  195. .hwblk_id = HWBLK_DMAC1,
  196. },
  197. };
  198. /* Serial */
  199. static struct plat_sci_port scif0_platform_data = {
  200. .mapbase = 0xffe00000,
  201. .flags = UPF_BOOT_AUTOCONF,
  202. .type = PORT_SCIF,
  203. .irqs = { 80, 80, 80, 80 },
  204. .clk = "scif0",
  205. };
  206. static struct platform_device scif0_device = {
  207. .name = "sh-sci",
  208. .id = 0,
  209. .dev = {
  210. .platform_data = &scif0_platform_data,
  211. },
  212. };
  213. static struct plat_sci_port scif1_platform_data = {
  214. .mapbase = 0xffe10000,
  215. .flags = UPF_BOOT_AUTOCONF,
  216. .type = PORT_SCIF,
  217. .irqs = { 81, 81, 81, 81 },
  218. .clk = "scif1",
  219. };
  220. static struct platform_device scif1_device = {
  221. .name = "sh-sci",
  222. .id = 1,
  223. .dev = {
  224. .platform_data = &scif1_platform_data,
  225. },
  226. };
  227. static struct plat_sci_port scif2_platform_data = {
  228. .mapbase = 0xffe20000,
  229. .flags = UPF_BOOT_AUTOCONF,
  230. .type = PORT_SCIF,
  231. .irqs = { 82, 82, 82, 82 },
  232. .clk = "scif2",
  233. };
  234. static struct platform_device scif2_device = {
  235. .name = "sh-sci",
  236. .id = 2,
  237. .dev = {
  238. .platform_data = &scif2_platform_data,
  239. },
  240. };
  241. static struct plat_sci_port scif3_platform_data = {
  242. .mapbase = 0xa4e30000,
  243. .flags = UPF_BOOT_AUTOCONF,
  244. .type = PORT_SCIFA,
  245. .irqs = { 56, 56, 56, 56 },
  246. .clk = "scif3",
  247. };
  248. static struct platform_device scif3_device = {
  249. .name = "sh-sci",
  250. .id = 3,
  251. .dev = {
  252. .platform_data = &scif3_platform_data,
  253. },
  254. };
  255. static struct plat_sci_port scif4_platform_data = {
  256. .mapbase = 0xa4e40000,
  257. .flags = UPF_BOOT_AUTOCONF,
  258. .type = PORT_SCIFA,
  259. .irqs = { 88, 88, 88, 88 },
  260. .clk = "scif4",
  261. };
  262. static struct platform_device scif4_device = {
  263. .name = "sh-sci",
  264. .id = 4,
  265. .dev = {
  266. .platform_data = &scif4_platform_data,
  267. },
  268. };
  269. static struct plat_sci_port scif5_platform_data = {
  270. .mapbase = 0xa4e50000,
  271. .flags = UPF_BOOT_AUTOCONF,
  272. .type = PORT_SCIFA,
  273. .irqs = { 109, 109, 109, 109 },
  274. .clk = "scif5",
  275. };
  276. static struct platform_device scif5_device = {
  277. .name = "sh-sci",
  278. .id = 5,
  279. .dev = {
  280. .platform_data = &scif5_platform_data,
  281. },
  282. };
  283. /* RTC */
  284. static struct resource rtc_resources[] = {
  285. [0] = {
  286. .start = 0xa465fec0,
  287. .end = 0xa465fec0 + 0x58 - 1,
  288. .flags = IORESOURCE_IO,
  289. },
  290. [1] = {
  291. /* Period IRQ */
  292. .start = 69,
  293. .flags = IORESOURCE_IRQ,
  294. },
  295. [2] = {
  296. /* Carry IRQ */
  297. .start = 70,
  298. .flags = IORESOURCE_IRQ,
  299. },
  300. [3] = {
  301. /* Alarm IRQ */
  302. .start = 68,
  303. .flags = IORESOURCE_IRQ,
  304. },
  305. };
  306. static struct platform_device rtc_device = {
  307. .name = "sh-rtc",
  308. .id = -1,
  309. .num_resources = ARRAY_SIZE(rtc_resources),
  310. .resource = rtc_resources,
  311. .archdata = {
  312. .hwblk_id = HWBLK_RTC,
  313. },
  314. };
  315. /* I2C0 */
  316. static struct resource iic0_resources[] = {
  317. [0] = {
  318. .name = "IIC0",
  319. .start = 0x04470000,
  320. .end = 0x04470018 - 1,
  321. .flags = IORESOURCE_MEM,
  322. },
  323. [1] = {
  324. .start = 96,
  325. .end = 99,
  326. .flags = IORESOURCE_IRQ,
  327. },
  328. };
  329. static struct platform_device iic0_device = {
  330. .name = "i2c-sh_mobile",
  331. .id = 0, /* "i2c0" clock */
  332. .num_resources = ARRAY_SIZE(iic0_resources),
  333. .resource = iic0_resources,
  334. .archdata = {
  335. .hwblk_id = HWBLK_IIC0,
  336. },
  337. };
  338. /* I2C1 */
  339. static struct resource iic1_resources[] = {
  340. [0] = {
  341. .name = "IIC1",
  342. .start = 0x04750000,
  343. .end = 0x04750018 - 1,
  344. .flags = IORESOURCE_MEM,
  345. },
  346. [1] = {
  347. .start = 92,
  348. .end = 95,
  349. .flags = IORESOURCE_IRQ,
  350. },
  351. };
  352. static struct platform_device iic1_device = {
  353. .name = "i2c-sh_mobile",
  354. .id = 1, /* "i2c1" clock */
  355. .num_resources = ARRAY_SIZE(iic1_resources),
  356. .resource = iic1_resources,
  357. .archdata = {
  358. .hwblk_id = HWBLK_IIC1,
  359. },
  360. };
  361. /* VPU */
  362. static struct uio_info vpu_platform_data = {
  363. .name = "VPU5F",
  364. .version = "0",
  365. .irq = 60,
  366. };
  367. static struct resource vpu_resources[] = {
  368. [0] = {
  369. .name = "VPU",
  370. .start = 0xfe900000,
  371. .end = 0xfe902807,
  372. .flags = IORESOURCE_MEM,
  373. },
  374. [1] = {
  375. /* place holder for contiguous memory */
  376. },
  377. };
  378. static struct platform_device vpu_device = {
  379. .name = "uio_pdrv_genirq",
  380. .id = 0,
  381. .dev = {
  382. .platform_data = &vpu_platform_data,
  383. },
  384. .resource = vpu_resources,
  385. .num_resources = ARRAY_SIZE(vpu_resources),
  386. .archdata = {
  387. .hwblk_id = HWBLK_VPU,
  388. },
  389. };
  390. /* VEU0 */
  391. static struct uio_info veu0_platform_data = {
  392. .name = "VEU3F0",
  393. .version = "0",
  394. .irq = 83,
  395. };
  396. static struct resource veu0_resources[] = {
  397. [0] = {
  398. .name = "VEU3F0",
  399. .start = 0xfe920000,
  400. .end = 0xfe9200cb,
  401. .flags = IORESOURCE_MEM,
  402. },
  403. [1] = {
  404. /* place holder for contiguous memory */
  405. },
  406. };
  407. static struct platform_device veu0_device = {
  408. .name = "uio_pdrv_genirq",
  409. .id = 1,
  410. .dev = {
  411. .platform_data = &veu0_platform_data,
  412. },
  413. .resource = veu0_resources,
  414. .num_resources = ARRAY_SIZE(veu0_resources),
  415. .archdata = {
  416. .hwblk_id = HWBLK_VEU0,
  417. },
  418. };
  419. /* VEU1 */
  420. static struct uio_info veu1_platform_data = {
  421. .name = "VEU3F1",
  422. .version = "0",
  423. .irq = 54,
  424. };
  425. static struct resource veu1_resources[] = {
  426. [0] = {
  427. .name = "VEU3F1",
  428. .start = 0xfe924000,
  429. .end = 0xfe9240cb,
  430. .flags = IORESOURCE_MEM,
  431. },
  432. [1] = {
  433. /* place holder for contiguous memory */
  434. },
  435. };
  436. static struct platform_device veu1_device = {
  437. .name = "uio_pdrv_genirq",
  438. .id = 2,
  439. .dev = {
  440. .platform_data = &veu1_platform_data,
  441. },
  442. .resource = veu1_resources,
  443. .num_resources = ARRAY_SIZE(veu1_resources),
  444. .archdata = {
  445. .hwblk_id = HWBLK_VEU1,
  446. },
  447. };
  448. static struct sh_timer_config cmt_platform_data = {
  449. .channel_offset = 0x60,
  450. .timer_bit = 5,
  451. .clk = "cmt0",
  452. .clockevent_rating = 125,
  453. .clocksource_rating = 200,
  454. };
  455. static struct resource cmt_resources[] = {
  456. [0] = {
  457. .start = 0x044a0060,
  458. .end = 0x044a006b,
  459. .flags = IORESOURCE_MEM,
  460. },
  461. [1] = {
  462. .start = 104,
  463. .flags = IORESOURCE_IRQ,
  464. },
  465. };
  466. static struct platform_device cmt_device = {
  467. .name = "sh_cmt",
  468. .id = 0,
  469. .dev = {
  470. .platform_data = &cmt_platform_data,
  471. },
  472. .resource = cmt_resources,
  473. .num_resources = ARRAY_SIZE(cmt_resources),
  474. .archdata = {
  475. .hwblk_id = HWBLK_CMT,
  476. },
  477. };
  478. static struct sh_timer_config tmu0_platform_data = {
  479. .channel_offset = 0x04,
  480. .timer_bit = 0,
  481. .clk = "tmu0",
  482. .clockevent_rating = 200,
  483. };
  484. static struct resource tmu0_resources[] = {
  485. [0] = {
  486. .start = 0xffd80008,
  487. .end = 0xffd80013,
  488. .flags = IORESOURCE_MEM,
  489. },
  490. [1] = {
  491. .start = 16,
  492. .flags = IORESOURCE_IRQ,
  493. },
  494. };
  495. static struct platform_device tmu0_device = {
  496. .name = "sh_tmu",
  497. .id = 0,
  498. .dev = {
  499. .platform_data = &tmu0_platform_data,
  500. },
  501. .resource = tmu0_resources,
  502. .num_resources = ARRAY_SIZE(tmu0_resources),
  503. .archdata = {
  504. .hwblk_id = HWBLK_TMU0,
  505. },
  506. };
  507. static struct sh_timer_config tmu1_platform_data = {
  508. .channel_offset = 0x10,
  509. .timer_bit = 1,
  510. .clk = "tmu0",
  511. .clocksource_rating = 200,
  512. };
  513. static struct resource tmu1_resources[] = {
  514. [0] = {
  515. .start = 0xffd80014,
  516. .end = 0xffd8001f,
  517. .flags = IORESOURCE_MEM,
  518. },
  519. [1] = {
  520. .start = 17,
  521. .flags = IORESOURCE_IRQ,
  522. },
  523. };
  524. static struct platform_device tmu1_device = {
  525. .name = "sh_tmu",
  526. .id = 1,
  527. .dev = {
  528. .platform_data = &tmu1_platform_data,
  529. },
  530. .resource = tmu1_resources,
  531. .num_resources = ARRAY_SIZE(tmu1_resources),
  532. .archdata = {
  533. .hwblk_id = HWBLK_TMU0,
  534. },
  535. };
  536. static struct sh_timer_config tmu2_platform_data = {
  537. .channel_offset = 0x1c,
  538. .timer_bit = 2,
  539. .clk = "tmu0",
  540. };
  541. static struct resource tmu2_resources[] = {
  542. [0] = {
  543. .start = 0xffd80020,
  544. .end = 0xffd8002b,
  545. .flags = IORESOURCE_MEM,
  546. },
  547. [1] = {
  548. .start = 18,
  549. .flags = IORESOURCE_IRQ,
  550. },
  551. };
  552. static struct platform_device tmu2_device = {
  553. .name = "sh_tmu",
  554. .id = 2,
  555. .dev = {
  556. .platform_data = &tmu2_platform_data,
  557. },
  558. .resource = tmu2_resources,
  559. .num_resources = ARRAY_SIZE(tmu2_resources),
  560. .archdata = {
  561. .hwblk_id = HWBLK_TMU0,
  562. },
  563. };
  564. static struct sh_timer_config tmu3_platform_data = {
  565. .channel_offset = 0x04,
  566. .timer_bit = 0,
  567. .clk = "tmu1",
  568. };
  569. static struct resource tmu3_resources[] = {
  570. [0] = {
  571. .start = 0xffd90008,
  572. .end = 0xffd90013,
  573. .flags = IORESOURCE_MEM,
  574. },
  575. [1] = {
  576. .start = 57,
  577. .flags = IORESOURCE_IRQ,
  578. },
  579. };
  580. static struct platform_device tmu3_device = {
  581. .name = "sh_tmu",
  582. .id = 3,
  583. .dev = {
  584. .platform_data = &tmu3_platform_data,
  585. },
  586. .resource = tmu3_resources,
  587. .num_resources = ARRAY_SIZE(tmu3_resources),
  588. .archdata = {
  589. .hwblk_id = HWBLK_TMU1,
  590. },
  591. };
  592. static struct sh_timer_config tmu4_platform_data = {
  593. .channel_offset = 0x10,
  594. .timer_bit = 1,
  595. .clk = "tmu1",
  596. };
  597. static struct resource tmu4_resources[] = {
  598. [0] = {
  599. .start = 0xffd90014,
  600. .end = 0xffd9001f,
  601. .flags = IORESOURCE_MEM,
  602. },
  603. [1] = {
  604. .start = 58,
  605. .flags = IORESOURCE_IRQ,
  606. },
  607. };
  608. static struct platform_device tmu4_device = {
  609. .name = "sh_tmu",
  610. .id = 4,
  611. .dev = {
  612. .platform_data = &tmu4_platform_data,
  613. },
  614. .resource = tmu4_resources,
  615. .num_resources = ARRAY_SIZE(tmu4_resources),
  616. .archdata = {
  617. .hwblk_id = HWBLK_TMU1,
  618. },
  619. };
  620. static struct sh_timer_config tmu5_platform_data = {
  621. .channel_offset = 0x1c,
  622. .timer_bit = 2,
  623. .clk = "tmu1",
  624. };
  625. static struct resource tmu5_resources[] = {
  626. [0] = {
  627. .start = 0xffd90020,
  628. .end = 0xffd9002b,
  629. .flags = IORESOURCE_MEM,
  630. },
  631. [1] = {
  632. .start = 57,
  633. .flags = IORESOURCE_IRQ,
  634. },
  635. };
  636. static struct platform_device tmu5_device = {
  637. .name = "sh_tmu",
  638. .id = 5,
  639. .dev = {
  640. .platform_data = &tmu5_platform_data,
  641. },
  642. .resource = tmu5_resources,
  643. .num_resources = ARRAY_SIZE(tmu5_resources),
  644. .archdata = {
  645. .hwblk_id = HWBLK_TMU1,
  646. },
  647. };
  648. /* JPU */
  649. static struct uio_info jpu_platform_data = {
  650. .name = "JPU",
  651. .version = "0",
  652. .irq = 27,
  653. };
  654. static struct resource jpu_resources[] = {
  655. [0] = {
  656. .name = "JPU",
  657. .start = 0xfe980000,
  658. .end = 0xfe9902d3,
  659. .flags = IORESOURCE_MEM,
  660. },
  661. [1] = {
  662. /* place holder for contiguous memory */
  663. },
  664. };
  665. static struct platform_device jpu_device = {
  666. .name = "uio_pdrv_genirq",
  667. .id = 3,
  668. .dev = {
  669. .platform_data = &jpu_platform_data,
  670. },
  671. .resource = jpu_resources,
  672. .num_resources = ARRAY_SIZE(jpu_resources),
  673. .archdata = {
  674. .hwblk_id = HWBLK_JPU,
  675. },
  676. };
  677. /* SPU2DSP0 */
  678. static struct uio_info spu0_platform_data = {
  679. .name = "SPU2DSP0",
  680. .version = "0",
  681. .irq = 86,
  682. };
  683. static struct resource spu0_resources[] = {
  684. [0] = {
  685. .name = "SPU2DSP0",
  686. .start = 0xFE200000,
  687. .end = 0xFE2FFFFF,
  688. .flags = IORESOURCE_MEM,
  689. },
  690. [1] = {
  691. /* place holder for contiguous memory */
  692. },
  693. };
  694. static struct platform_device spu0_device = {
  695. .name = "uio_pdrv_genirq",
  696. .id = 4,
  697. .dev = {
  698. .platform_data = &spu0_platform_data,
  699. },
  700. .resource = spu0_resources,
  701. .num_resources = ARRAY_SIZE(spu0_resources),
  702. .archdata = {
  703. .hwblk_id = HWBLK_SPU,
  704. },
  705. };
  706. /* SPU2DSP1 */
  707. static struct uio_info spu1_platform_data = {
  708. .name = "SPU2DSP1",
  709. .version = "0",
  710. .irq = 87,
  711. };
  712. static struct resource spu1_resources[] = {
  713. [0] = {
  714. .name = "SPU2DSP1",
  715. .start = 0xFE300000,
  716. .end = 0xFE3FFFFF,
  717. .flags = IORESOURCE_MEM,
  718. },
  719. [1] = {
  720. /* place holder for contiguous memory */
  721. },
  722. };
  723. static struct platform_device spu1_device = {
  724. .name = "uio_pdrv_genirq",
  725. .id = 5,
  726. .dev = {
  727. .platform_data = &spu1_platform_data,
  728. },
  729. .resource = spu1_resources,
  730. .num_resources = ARRAY_SIZE(spu1_resources),
  731. .archdata = {
  732. .hwblk_id = HWBLK_SPU,
  733. },
  734. };
  735. static struct platform_device *sh7724_devices[] __initdata = {
  736. &scif0_device,
  737. &scif1_device,
  738. &scif2_device,
  739. &scif3_device,
  740. &scif4_device,
  741. &scif5_device,
  742. &cmt_device,
  743. &tmu0_device,
  744. &tmu1_device,
  745. &tmu2_device,
  746. &tmu3_device,
  747. &tmu4_device,
  748. &tmu5_device,
  749. &dma0_device,
  750. &dma1_device,
  751. &rtc_device,
  752. &iic0_device,
  753. &iic1_device,
  754. &vpu_device,
  755. &veu0_device,
  756. &veu1_device,
  757. &jpu_device,
  758. &spu0_device,
  759. &spu1_device,
  760. };
  761. static int __init sh7724_devices_setup(void)
  762. {
  763. platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
  764. platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
  765. platform_resource_setup_memory(&veu1_device, "veu1", 2 << 20);
  766. platform_resource_setup_memory(&jpu_device, "jpu", 2 << 20);
  767. platform_resource_setup_memory(&spu0_device, "spu0", 2 << 20);
  768. platform_resource_setup_memory(&spu1_device, "spu1", 2 << 20);
  769. return platform_add_devices(sh7724_devices,
  770. ARRAY_SIZE(sh7724_devices));
  771. }
  772. arch_initcall(sh7724_devices_setup);
  773. static struct platform_device *sh7724_early_devices[] __initdata = {
  774. &scif0_device,
  775. &scif1_device,
  776. &scif2_device,
  777. &scif3_device,
  778. &scif4_device,
  779. &scif5_device,
  780. &cmt_device,
  781. &tmu0_device,
  782. &tmu1_device,
  783. &tmu2_device,
  784. &tmu3_device,
  785. &tmu4_device,
  786. &tmu5_device,
  787. };
  788. void __init plat_early_device_setup(void)
  789. {
  790. early_platform_add_devices(sh7724_early_devices,
  791. ARRAY_SIZE(sh7724_early_devices));
  792. }
  793. #define RAMCR_CACHE_L2FC 0x0002
  794. #define RAMCR_CACHE_L2E 0x0001
  795. #define L2_CACHE_ENABLE (RAMCR_CACHE_L2E|RAMCR_CACHE_L2FC)
  796. void l2_cache_init(void)
  797. {
  798. /* Enable L2 cache */
  799. __raw_writel(L2_CACHE_ENABLE, RAMCR);
  800. }
  801. enum {
  802. UNUSED = 0,
  803. ENABLED,
  804. DISABLED,
  805. /* interrupt sources */
  806. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
  807. HUDI,
  808. DMAC1A_DEI0, DMAC1A_DEI1, DMAC1A_DEI2, DMAC1A_DEI3,
  809. _2DG_TRI, _2DG_INI, _2DG_CEI,
  810. DMAC0A_DEI0, DMAC0A_DEI1, DMAC0A_DEI2, DMAC0A_DEI3,
  811. VIO_CEU0, VIO_BEU0, VIO_VEU1, VIO_VOU,
  812. SCIFA3,
  813. VPU,
  814. TPU,
  815. CEU1,
  816. BEU1,
  817. USB0, USB1,
  818. ATAPI,
  819. RTC_ATI, RTC_PRI, RTC_CUI,
  820. DMAC1B_DEI4, DMAC1B_DEI5, DMAC1B_DADERR,
  821. DMAC0B_DEI4, DMAC0B_DEI5, DMAC0B_DADERR,
  822. KEYSC,
  823. SCIF_SCIF0, SCIF_SCIF1, SCIF_SCIF2,
  824. VEU0,
  825. MSIOF_MSIOFI0, MSIOF_MSIOFI1,
  826. SPU_SPUI0, SPU_SPUI1,
  827. SCIFA4,
  828. ICB,
  829. ETHI,
  830. I2C1_ALI, I2C1_TACKI, I2C1_WAITI, I2C1_DTEI,
  831. I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI,
  832. CMT,
  833. TSIF,
  834. FSI,
  835. SCIFA5,
  836. TMU0_TUNI0, TMU0_TUNI1, TMU0_TUNI2,
  837. IRDA,
  838. JPU,
  839. _2DDMAC,
  840. MMC_MMC2I, MMC_MMC3I,
  841. LCDC,
  842. TMU1_TUNI0, TMU1_TUNI1, TMU1_TUNI2,
  843. /* interrupt groups */
  844. DMAC1A, _2DG, DMAC0A, VIO, USB, RTC,
  845. DMAC1B, DMAC0B, I2C0, I2C1, SDHI0, SDHI1, SPU, MMCIF,
  846. };
  847. static struct intc_vect vectors[] __initdata = {
  848. INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
  849. INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
  850. INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
  851. INTC_VECT(IRQ6, 0x6c0), INTC_VECT(IRQ7, 0x6e0),
  852. INTC_VECT(DMAC1A_DEI0, 0x700),
  853. INTC_VECT(DMAC1A_DEI1, 0x720),
  854. INTC_VECT(DMAC1A_DEI2, 0x740),
  855. INTC_VECT(DMAC1A_DEI3, 0x760),
  856. INTC_VECT(_2DG_TRI, 0x780),
  857. INTC_VECT(_2DG_INI, 0x7A0),
  858. INTC_VECT(_2DG_CEI, 0x7C0),
  859. INTC_VECT(DMAC0A_DEI0, 0x800),
  860. INTC_VECT(DMAC0A_DEI1, 0x820),
  861. INTC_VECT(DMAC0A_DEI2, 0x840),
  862. INTC_VECT(DMAC0A_DEI3, 0x860),
  863. INTC_VECT(VIO_CEU0, 0x880),
  864. INTC_VECT(VIO_BEU0, 0x8A0),
  865. INTC_VECT(VIO_VEU1, 0x8C0),
  866. INTC_VECT(VIO_VOU, 0x8E0),
  867. INTC_VECT(SCIFA3, 0x900),
  868. INTC_VECT(VPU, 0x980),
  869. INTC_VECT(TPU, 0x9A0),
  870. INTC_VECT(CEU1, 0x9E0),
  871. INTC_VECT(BEU1, 0xA00),
  872. INTC_VECT(USB0, 0xA20),
  873. INTC_VECT(USB1, 0xA40),
  874. INTC_VECT(ATAPI, 0xA60),
  875. INTC_VECT(RTC_ATI, 0xA80),
  876. INTC_VECT(RTC_PRI, 0xAA0),
  877. INTC_VECT(RTC_CUI, 0xAC0),
  878. INTC_VECT(DMAC1B_DEI4, 0xB00),
  879. INTC_VECT(DMAC1B_DEI5, 0xB20),
  880. INTC_VECT(DMAC1B_DADERR, 0xB40),
  881. INTC_VECT(DMAC0B_DEI4, 0xB80),
  882. INTC_VECT(DMAC0B_DEI5, 0xBA0),
  883. INTC_VECT(DMAC0B_DADERR, 0xBC0),
  884. INTC_VECT(KEYSC, 0xBE0),
  885. INTC_VECT(SCIF_SCIF0, 0xC00),
  886. INTC_VECT(SCIF_SCIF1, 0xC20),
  887. INTC_VECT(SCIF_SCIF2, 0xC40),
  888. INTC_VECT(VEU0, 0xC60),
  889. INTC_VECT(MSIOF_MSIOFI0, 0xC80),
  890. INTC_VECT(MSIOF_MSIOFI1, 0xCA0),
  891. INTC_VECT(SPU_SPUI0, 0xCC0),
  892. INTC_VECT(SPU_SPUI1, 0xCE0),
  893. INTC_VECT(SCIFA4, 0xD00),
  894. INTC_VECT(ICB, 0xD20),
  895. INTC_VECT(ETHI, 0xD60),
  896. INTC_VECT(I2C1_ALI, 0xD80),
  897. INTC_VECT(I2C1_TACKI, 0xDA0),
  898. INTC_VECT(I2C1_WAITI, 0xDC0),
  899. INTC_VECT(I2C1_DTEI, 0xDE0),
  900. INTC_VECT(I2C0_ALI, 0xE00),
  901. INTC_VECT(I2C0_TACKI, 0xE20),
  902. INTC_VECT(I2C0_WAITI, 0xE40),
  903. INTC_VECT(I2C0_DTEI, 0xE60),
  904. INTC_VECT(SDHI0, 0xE80),
  905. INTC_VECT(SDHI0, 0xEA0),
  906. INTC_VECT(SDHI0, 0xEC0),
  907. INTC_VECT(SDHI0, 0xEE0),
  908. INTC_VECT(CMT, 0xF00),
  909. INTC_VECT(TSIF, 0xF20),
  910. INTC_VECT(FSI, 0xF80),
  911. INTC_VECT(SCIFA5, 0xFA0),
  912. INTC_VECT(TMU0_TUNI0, 0x400),
  913. INTC_VECT(TMU0_TUNI1, 0x420),
  914. INTC_VECT(TMU0_TUNI2, 0x440),
  915. INTC_VECT(IRDA, 0x480),
  916. INTC_VECT(SDHI1, 0x4E0),
  917. INTC_VECT(SDHI1, 0x500),
  918. INTC_VECT(SDHI1, 0x520),
  919. INTC_VECT(JPU, 0x560),
  920. INTC_VECT(_2DDMAC, 0x4A0),
  921. INTC_VECT(MMC_MMC2I, 0x5A0),
  922. INTC_VECT(MMC_MMC3I, 0x5C0),
  923. INTC_VECT(LCDC, 0xF40),
  924. INTC_VECT(TMU1_TUNI0, 0x920),
  925. INTC_VECT(TMU1_TUNI1, 0x940),
  926. INTC_VECT(TMU1_TUNI2, 0x960),
  927. };
  928. static struct intc_group groups[] __initdata = {
  929. INTC_GROUP(DMAC1A, DMAC1A_DEI0, DMAC1A_DEI1, DMAC1A_DEI2, DMAC1A_DEI3),
  930. INTC_GROUP(_2DG, _2DG_TRI, _2DG_INI, _2DG_CEI),
  931. INTC_GROUP(DMAC0A, DMAC0A_DEI0, DMAC0A_DEI1, DMAC0A_DEI2, DMAC0A_DEI3),
  932. INTC_GROUP(VIO, VIO_CEU0, VIO_BEU0, VIO_VEU1, VIO_VOU),
  933. INTC_GROUP(USB, USB0, USB1),
  934. INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
  935. INTC_GROUP(DMAC1B, DMAC1B_DEI4, DMAC1B_DEI5, DMAC1B_DADERR),
  936. INTC_GROUP(DMAC0B, DMAC0B_DEI4, DMAC0B_DEI5, DMAC0B_DADERR),
  937. INTC_GROUP(I2C0, I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI),
  938. INTC_GROUP(I2C1, I2C1_ALI, I2C1_TACKI, I2C1_WAITI, I2C1_DTEI),
  939. INTC_GROUP(SPU, SPU_SPUI0, SPU_SPUI1),
  940. INTC_GROUP(MMCIF, MMC_MMC2I, MMC_MMC3I),
  941. };
  942. static struct intc_mask_reg mask_registers[] __initdata = {
  943. { 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
  944. { 0, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0,
  945. 0, DISABLED, ENABLED, ENABLED } },
  946. { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
  947. { VIO_VOU, VIO_VEU1, VIO_BEU0, VIO_CEU0,
  948. DMAC0A_DEI3, DMAC0A_DEI2, DMAC0A_DEI1, DMAC0A_DEI0 } },
  949. { 0xa4080088, 0xa40800c8, 8, /* IMR2 / IMCR2 */
  950. { 0, 0, 0, VPU, ATAPI, ETHI, 0, SCIFA3 } },
  951. { 0xa408008c, 0xa40800cc, 8, /* IMR3 / IMCR3 */
  952. { DMAC1A_DEI3, DMAC1A_DEI2, DMAC1A_DEI1, DMAC1A_DEI0,
  953. SPU_SPUI1, SPU_SPUI0, BEU1, IRDA } },
  954. { 0xa4080090, 0xa40800d0, 8, /* IMR4 / IMCR4 */
  955. { 0, TMU0_TUNI2, TMU0_TUNI1, TMU0_TUNI0,
  956. JPU, 0, 0, LCDC } },
  957. { 0xa4080094, 0xa40800d4, 8, /* IMR5 / IMCR5 */
  958. { KEYSC, DMAC0B_DADERR, DMAC0B_DEI5, DMAC0B_DEI4,
  959. VEU0, SCIF_SCIF2, SCIF_SCIF1, SCIF_SCIF0 } },
  960. { 0xa4080098, 0xa40800d8, 8, /* IMR6 / IMCR6 */
  961. { 0, 0, ICB, SCIFA4,
  962. CEU1, 0, MSIOF_MSIOFI1, MSIOF_MSIOFI0 } },
  963. { 0xa408009c, 0xa40800dc, 8, /* IMR7 / IMCR7 */
  964. { I2C0_DTEI, I2C0_WAITI, I2C0_TACKI, I2C0_ALI,
  965. I2C1_DTEI, I2C1_WAITI, I2C1_TACKI, I2C1_ALI } },
  966. { 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
  967. { DISABLED, DISABLED, ENABLED, ENABLED,
  968. 0, 0, SCIFA5, FSI } },
  969. { 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
  970. { 0, 0, 0, CMT, 0, USB1, USB0, 0 } },
  971. { 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
  972. { 0, DMAC1B_DADERR, DMAC1B_DEI5, DMAC1B_DEI4,
  973. 0, RTC_CUI, RTC_PRI, RTC_ATI } },
  974. { 0xa40800ac, 0xa40800ec, 8, /* IMR11 / IMCR11 */
  975. { 0, _2DG_CEI, _2DG_INI, _2DG_TRI,
  976. 0, TPU, 0, TSIF } },
  977. { 0xa40800b0, 0xa40800f0, 8, /* IMR12 / IMCR12 */
  978. { 0, 0, MMC_MMC3I, MMC_MMC2I, 0, 0, 0, _2DDMAC } },
  979. { 0xa4140044, 0xa4140064, 8, /* INTMSK00 / INTMSKCLR00 */
  980. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  981. };
  982. static struct intc_prio_reg prio_registers[] __initdata = {
  983. { 0xa4080000, 0, 16, 4, /* IPRA */ { TMU0_TUNI0, TMU0_TUNI1,
  984. TMU0_TUNI2, IRDA } },
  985. { 0xa4080004, 0, 16, 4, /* IPRB */ { JPU, LCDC, DMAC1A, BEU1 } },
  986. { 0xa4080008, 0, 16, 4, /* IPRC */ { TMU1_TUNI0, TMU1_TUNI1,
  987. TMU1_TUNI2, SPU } },
  988. { 0xa408000c, 0, 16, 4, /* IPRD */ { 0, MMCIF, 0, ATAPI } },
  989. { 0xa4080010, 0, 16, 4, /* IPRE */ { DMAC0A, VIO, SCIFA3, VPU } },
  990. { 0xa4080014, 0, 16, 4, /* IPRF */ { KEYSC, DMAC0B, USB, CMT } },
  991. { 0xa4080018, 0, 16, 4, /* IPRG */ { SCIF_SCIF0, SCIF_SCIF1,
  992. SCIF_SCIF2, VEU0 } },
  993. { 0xa408001c, 0, 16, 4, /* IPRH */ { MSIOF_MSIOFI0, MSIOF_MSIOFI1,
  994. I2C1, I2C0 } },
  995. { 0xa4080020, 0, 16, 4, /* IPRI */ { SCIFA4, ICB, TSIF, _2DG } },
  996. { 0xa4080024, 0, 16, 4, /* IPRJ */ { CEU1, ETHI, FSI, SDHI1 } },
  997. { 0xa4080028, 0, 16, 4, /* IPRK */ { RTC, DMAC1B, 0, SDHI0 } },
  998. { 0xa408002c, 0, 16, 4, /* IPRL */ { SCIFA5, 0, TPU, _2DDMAC } },
  999. { 0xa4140010, 0, 32, 4, /* INTPRI00 */
  1000. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  1001. };
  1002. static struct intc_sense_reg sense_registers[] __initdata = {
  1003. { 0xa414001c, 16, 2, /* ICR1 */
  1004. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  1005. };
  1006. static struct intc_mask_reg ack_registers[] __initdata = {
  1007. { 0xa4140024, 0, 8, /* INTREQ00 */
  1008. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  1009. };
  1010. static struct intc_desc intc_desc __initdata = {
  1011. .name = "sh7724",
  1012. .force_enable = ENABLED,
  1013. .force_disable = DISABLED,
  1014. .hw = INTC_HW_DESC(vectors, groups, mask_registers,
  1015. prio_registers, sense_registers, ack_registers),
  1016. };
  1017. void __init plat_irq_setup(void)
  1018. {
  1019. register_intc_controller(&intc_desc);
  1020. }
  1021. static struct {
  1022. /* BSC */
  1023. unsigned long mmselr;
  1024. unsigned long cs0bcr;
  1025. unsigned long cs4bcr;
  1026. unsigned long cs5abcr;
  1027. unsigned long cs5bbcr;
  1028. unsigned long cs6abcr;
  1029. unsigned long cs6bbcr;
  1030. unsigned long cs4wcr;
  1031. unsigned long cs5awcr;
  1032. unsigned long cs5bwcr;
  1033. unsigned long cs6awcr;
  1034. unsigned long cs6bwcr;
  1035. /* INTC */
  1036. unsigned short ipra;
  1037. unsigned short iprb;
  1038. unsigned short iprc;
  1039. unsigned short iprd;
  1040. unsigned short ipre;
  1041. unsigned short iprf;
  1042. unsigned short iprg;
  1043. unsigned short iprh;
  1044. unsigned short ipri;
  1045. unsigned short iprj;
  1046. unsigned short iprk;
  1047. unsigned short iprl;
  1048. unsigned char imr0;
  1049. unsigned char imr1;
  1050. unsigned char imr2;
  1051. unsigned char imr3;
  1052. unsigned char imr4;
  1053. unsigned char imr5;
  1054. unsigned char imr6;
  1055. unsigned char imr7;
  1056. unsigned char imr8;
  1057. unsigned char imr9;
  1058. unsigned char imr10;
  1059. unsigned char imr11;
  1060. unsigned char imr12;
  1061. /* RWDT */
  1062. unsigned short rwtcnt;
  1063. unsigned short rwtcsr;
  1064. /* CPG */
  1065. unsigned long irdaclk;
  1066. unsigned long spuclk;
  1067. } sh7724_rstandby_state;
  1068. static int sh7724_pre_sleep_notifier_call(struct notifier_block *nb,
  1069. unsigned long flags, void *unused)
  1070. {
  1071. if (!(flags & SUSP_SH_RSTANDBY))
  1072. return NOTIFY_DONE;
  1073. /* BCR */
  1074. sh7724_rstandby_state.mmselr = __raw_readl(0xff800020); /* MMSELR */
  1075. sh7724_rstandby_state.mmselr |= 0xa5a50000;
  1076. sh7724_rstandby_state.cs0bcr = __raw_readl(0xfec10004); /* CS0BCR */
  1077. sh7724_rstandby_state.cs4bcr = __raw_readl(0xfec10010); /* CS4BCR */
  1078. sh7724_rstandby_state.cs5abcr = __raw_readl(0xfec10014); /* CS5ABCR */
  1079. sh7724_rstandby_state.cs5bbcr = __raw_readl(0xfec10018); /* CS5BBCR */
  1080. sh7724_rstandby_state.cs6abcr = __raw_readl(0xfec1001c); /* CS6ABCR */
  1081. sh7724_rstandby_state.cs6bbcr = __raw_readl(0xfec10020); /* CS6BBCR */
  1082. sh7724_rstandby_state.cs4wcr = __raw_readl(0xfec10030); /* CS4WCR */
  1083. sh7724_rstandby_state.cs5awcr = __raw_readl(0xfec10034); /* CS5AWCR */
  1084. sh7724_rstandby_state.cs5bwcr = __raw_readl(0xfec10038); /* CS5BWCR */
  1085. sh7724_rstandby_state.cs6awcr = __raw_readl(0xfec1003c); /* CS6AWCR */
  1086. sh7724_rstandby_state.cs6bwcr = __raw_readl(0xfec10040); /* CS6BWCR */
  1087. /* INTC */
  1088. sh7724_rstandby_state.ipra = __raw_readw(0xa4080000); /* IPRA */
  1089. sh7724_rstandby_state.iprb = __raw_readw(0xa4080004); /* IPRB */
  1090. sh7724_rstandby_state.iprc = __raw_readw(0xa4080008); /* IPRC */
  1091. sh7724_rstandby_state.iprd = __raw_readw(0xa408000c); /* IPRD */
  1092. sh7724_rstandby_state.ipre = __raw_readw(0xa4080010); /* IPRE */
  1093. sh7724_rstandby_state.iprf = __raw_readw(0xa4080014); /* IPRF */
  1094. sh7724_rstandby_state.iprg = __raw_readw(0xa4080018); /* IPRG */
  1095. sh7724_rstandby_state.iprh = __raw_readw(0xa408001c); /* IPRH */
  1096. sh7724_rstandby_state.ipri = __raw_readw(0xa4080020); /* IPRI */
  1097. sh7724_rstandby_state.iprj = __raw_readw(0xa4080024); /* IPRJ */
  1098. sh7724_rstandby_state.iprk = __raw_readw(0xa4080028); /* IPRK */
  1099. sh7724_rstandby_state.iprl = __raw_readw(0xa408002c); /* IPRL */
  1100. sh7724_rstandby_state.imr0 = __raw_readb(0xa4080080); /* IMR0 */
  1101. sh7724_rstandby_state.imr1 = __raw_readb(0xa4080084); /* IMR1 */
  1102. sh7724_rstandby_state.imr2 = __raw_readb(0xa4080088); /* IMR2 */
  1103. sh7724_rstandby_state.imr3 = __raw_readb(0xa408008c); /* IMR3 */
  1104. sh7724_rstandby_state.imr4 = __raw_readb(0xa4080090); /* IMR4 */
  1105. sh7724_rstandby_state.imr5 = __raw_readb(0xa4080094); /* IMR5 */
  1106. sh7724_rstandby_state.imr6 = __raw_readb(0xa4080098); /* IMR6 */
  1107. sh7724_rstandby_state.imr7 = __raw_readb(0xa408009c); /* IMR7 */
  1108. sh7724_rstandby_state.imr8 = __raw_readb(0xa40800a0); /* IMR8 */
  1109. sh7724_rstandby_state.imr9 = __raw_readb(0xa40800a4); /* IMR9 */
  1110. sh7724_rstandby_state.imr10 = __raw_readb(0xa40800a8); /* IMR10 */
  1111. sh7724_rstandby_state.imr11 = __raw_readb(0xa40800ac); /* IMR11 */
  1112. sh7724_rstandby_state.imr12 = __raw_readb(0xa40800b0); /* IMR12 */
  1113. /* RWDT */
  1114. sh7724_rstandby_state.rwtcnt = __raw_readb(0xa4520000); /* RWTCNT */
  1115. sh7724_rstandby_state.rwtcnt |= 0x5a00;
  1116. sh7724_rstandby_state.rwtcsr = __raw_readb(0xa4520004); /* RWTCSR */
  1117. sh7724_rstandby_state.rwtcsr |= 0xa500;
  1118. __raw_writew(sh7724_rstandby_state.rwtcsr & 0x07, 0xa4520004);
  1119. /* CPG */
  1120. sh7724_rstandby_state.irdaclk = __raw_readl(0xa4150018); /* IRDACLKCR */
  1121. sh7724_rstandby_state.spuclk = __raw_readl(0xa415003c); /* SPUCLKCR */
  1122. return NOTIFY_DONE;
  1123. }
  1124. static int sh7724_post_sleep_notifier_call(struct notifier_block *nb,
  1125. unsigned long flags, void *unused)
  1126. {
  1127. if (!(flags & SUSP_SH_RSTANDBY))
  1128. return NOTIFY_DONE;
  1129. /* BCR */
  1130. __raw_writel(sh7724_rstandby_state.mmselr, 0xff800020); /* MMSELR */
  1131. __raw_writel(sh7724_rstandby_state.cs0bcr, 0xfec10004); /* CS0BCR */
  1132. __raw_writel(sh7724_rstandby_state.cs4bcr, 0xfec10010); /* CS4BCR */
  1133. __raw_writel(sh7724_rstandby_state.cs5abcr, 0xfec10014); /* CS5ABCR */
  1134. __raw_writel(sh7724_rstandby_state.cs5bbcr, 0xfec10018); /* CS5BBCR */
  1135. __raw_writel(sh7724_rstandby_state.cs6abcr, 0xfec1001c); /* CS6ABCR */
  1136. __raw_writel(sh7724_rstandby_state.cs6bbcr, 0xfec10020); /* CS6BBCR */
  1137. __raw_writel(sh7724_rstandby_state.cs4wcr, 0xfec10030); /* CS4WCR */
  1138. __raw_writel(sh7724_rstandby_state.cs5awcr, 0xfec10034); /* CS5AWCR */
  1139. __raw_writel(sh7724_rstandby_state.cs5bwcr, 0xfec10038); /* CS5BWCR */
  1140. __raw_writel(sh7724_rstandby_state.cs6awcr, 0xfec1003c); /* CS6AWCR */
  1141. __raw_writel(sh7724_rstandby_state.cs6bwcr, 0xfec10040); /* CS6BWCR */
  1142. /* INTC */
  1143. __raw_writew(sh7724_rstandby_state.ipra, 0xa4080000); /* IPRA */
  1144. __raw_writew(sh7724_rstandby_state.iprb, 0xa4080004); /* IPRB */
  1145. __raw_writew(sh7724_rstandby_state.iprc, 0xa4080008); /* IPRC */
  1146. __raw_writew(sh7724_rstandby_state.iprd, 0xa408000c); /* IPRD */
  1147. __raw_writew(sh7724_rstandby_state.ipre, 0xa4080010); /* IPRE */
  1148. __raw_writew(sh7724_rstandby_state.iprf, 0xa4080014); /* IPRF */
  1149. __raw_writew(sh7724_rstandby_state.iprg, 0xa4080018); /* IPRG */
  1150. __raw_writew(sh7724_rstandby_state.iprh, 0xa408001c); /* IPRH */
  1151. __raw_writew(sh7724_rstandby_state.ipri, 0xa4080020); /* IPRI */
  1152. __raw_writew(sh7724_rstandby_state.iprj, 0xa4080024); /* IPRJ */
  1153. __raw_writew(sh7724_rstandby_state.iprk, 0xa4080028); /* IPRK */
  1154. __raw_writew(sh7724_rstandby_state.iprl, 0xa408002c); /* IPRL */
  1155. __raw_writeb(sh7724_rstandby_state.imr0, 0xa4080080); /* IMR0 */
  1156. __raw_writeb(sh7724_rstandby_state.imr1, 0xa4080084); /* IMR1 */
  1157. __raw_writeb(sh7724_rstandby_state.imr2, 0xa4080088); /* IMR2 */
  1158. __raw_writeb(sh7724_rstandby_state.imr3, 0xa408008c); /* IMR3 */
  1159. __raw_writeb(sh7724_rstandby_state.imr4, 0xa4080090); /* IMR4 */
  1160. __raw_writeb(sh7724_rstandby_state.imr5, 0xa4080094); /* IMR5 */
  1161. __raw_writeb(sh7724_rstandby_state.imr6, 0xa4080098); /* IMR6 */
  1162. __raw_writeb(sh7724_rstandby_state.imr7, 0xa408009c); /* IMR7 */
  1163. __raw_writeb(sh7724_rstandby_state.imr8, 0xa40800a0); /* IMR8 */
  1164. __raw_writeb(sh7724_rstandby_state.imr9, 0xa40800a4); /* IMR9 */
  1165. __raw_writeb(sh7724_rstandby_state.imr10, 0xa40800a8); /* IMR10 */
  1166. __raw_writeb(sh7724_rstandby_state.imr11, 0xa40800ac); /* IMR11 */
  1167. __raw_writeb(sh7724_rstandby_state.imr12, 0xa40800b0); /* IMR12 */
  1168. /* RWDT */
  1169. __raw_writew(sh7724_rstandby_state.rwtcnt, 0xa4520000); /* RWTCNT */
  1170. __raw_writew(sh7724_rstandby_state.rwtcsr, 0xa4520004); /* RWTCSR */
  1171. /* CPG */
  1172. __raw_writel(sh7724_rstandby_state.irdaclk, 0xa4150018); /* IRDACLKCR */
  1173. __raw_writel(sh7724_rstandby_state.spuclk, 0xa415003c); /* SPUCLKCR */
  1174. return NOTIFY_DONE;
  1175. }
  1176. static struct notifier_block sh7724_pre_sleep_notifier = {
  1177. .notifier_call = sh7724_pre_sleep_notifier_call,
  1178. .priority = SH_MOBILE_PRE(SH_MOBILE_SLEEP_CPU),
  1179. };
  1180. static struct notifier_block sh7724_post_sleep_notifier = {
  1181. .notifier_call = sh7724_post_sleep_notifier_call,
  1182. .priority = SH_MOBILE_POST(SH_MOBILE_SLEEP_CPU),
  1183. };
  1184. static int __init sh7724_sleep_setup(void)
  1185. {
  1186. atomic_notifier_chain_register(&sh_mobile_pre_sleep_notifier_list,
  1187. &sh7724_pre_sleep_notifier);
  1188. atomic_notifier_chain_register(&sh_mobile_post_sleep_notifier_list,
  1189. &sh7724_post_sleep_notifier);
  1190. return 0;
  1191. }
  1192. arch_initcall(sh7724_sleep_setup);