setup-sh7724.c 34 KB

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