setup-sh7724.c 34 KB

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