setup-sh7724.c 35 KB

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