setup-sh7757.c 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247
  1. /*
  2. * SH7757 Setup
  3. *
  4. * Copyright (C) 2009, 2011 Renesas Solutions Corp.
  5. *
  6. * based on setup-sh7785.c : Copyright (C) 2007 Paul Mundt
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/platform_device.h>
  13. #include <linux/init.h>
  14. #include <linux/serial.h>
  15. #include <linux/serial_sci.h>
  16. #include <linux/io.h>
  17. #include <linux/mm.h>
  18. #include <linux/dma-mapping.h>
  19. #include <linux/sh_timer.h>
  20. #include <linux/sh_dma.h>
  21. #include <linux/sh_intc.h>
  22. #include <linux/usb/ohci_pdriver.h>
  23. #include <cpu/dma-register.h>
  24. #include <cpu/sh7757.h>
  25. static struct plat_sci_port scif2_platform_data = {
  26. .flags = UPF_BOOT_AUTOCONF,
  27. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  28. .type = PORT_SCIF,
  29. };
  30. static struct resource scif2_resources[] = {
  31. DEFINE_RES_MEM(0xfe4b0000, 0x100), /* SCIF2 */
  32. DEFINE_RES_IRQ(evt2irq(0x700)),
  33. };
  34. static struct platform_device scif2_device = {
  35. .name = "sh-sci",
  36. .id = 0,
  37. .resource = scif2_resources,
  38. .num_resources = ARRAY_SIZE(scif2_resources),
  39. .dev = {
  40. .platform_data = &scif2_platform_data,
  41. },
  42. };
  43. static struct plat_sci_port scif3_platform_data = {
  44. .flags = UPF_BOOT_AUTOCONF,
  45. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  46. .type = PORT_SCIF,
  47. };
  48. static struct resource scif3_resources[] = {
  49. DEFINE_RES_MEM(0xfe4c0000, 0x100), /* SCIF3 */
  50. DEFINE_RES_IRQ(evt2irq(0xb80)),
  51. };
  52. static struct platform_device scif3_device = {
  53. .name = "sh-sci",
  54. .id = 1,
  55. .resource = scif3_resources,
  56. .num_resources = ARRAY_SIZE(scif3_resources),
  57. .dev = {
  58. .platform_data = &scif3_platform_data,
  59. },
  60. };
  61. static struct plat_sci_port scif4_platform_data = {
  62. .flags = UPF_BOOT_AUTOCONF,
  63. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  64. .type = PORT_SCIF,
  65. };
  66. static struct resource scif4_resources[] = {
  67. DEFINE_RES_MEM(0xfe4d0000, 0x100), /* SCIF4 */
  68. DEFINE_RES_IRQ(evt2irq(0xf00)),
  69. };
  70. static struct platform_device scif4_device = {
  71. .name = "sh-sci",
  72. .id = 2,
  73. .resource = scif4_resources,
  74. .num_resources = ARRAY_SIZE(scif4_resources),
  75. .dev = {
  76. .platform_data = &scif4_platform_data,
  77. },
  78. };
  79. static struct sh_timer_config tmu0_platform_data = {
  80. .channels_mask = 3,
  81. };
  82. static struct resource tmu0_resources[] = {
  83. DEFINE_RES_MEM(0xfe430000, 0x20),
  84. DEFINE_RES_IRQ(evt2irq(0x580)),
  85. DEFINE_RES_IRQ(evt2irq(0x5a0)),
  86. };
  87. static struct platform_device tmu0_device = {
  88. .name = "sh-tmu",
  89. .id = 0,
  90. .dev = {
  91. .platform_data = &tmu0_platform_data,
  92. },
  93. .resource = tmu0_resources,
  94. .num_resources = ARRAY_SIZE(tmu0_resources),
  95. };
  96. static struct resource spi0_resources[] = {
  97. [0] = {
  98. .start = 0xfe002000,
  99. .end = 0xfe0020ff,
  100. .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
  101. },
  102. [1] = {
  103. .start = evt2irq(0xcc0),
  104. .flags = IORESOURCE_IRQ,
  105. },
  106. };
  107. /* DMA */
  108. static const struct sh_dmae_slave_config sh7757_dmae0_slaves[] = {
  109. {
  110. .slave_id = SHDMA_SLAVE_SDHI_TX,
  111. .addr = 0x1fe50030,
  112. .chcr = SM_INC | RS_ERS | 0x40000000 |
  113. TS_INDEX2VAL(XMIT_SZ_16BIT),
  114. .mid_rid = 0xc5,
  115. },
  116. {
  117. .slave_id = SHDMA_SLAVE_SDHI_RX,
  118. .addr = 0x1fe50030,
  119. .chcr = DM_INC | RS_ERS | 0x40000000 |
  120. TS_INDEX2VAL(XMIT_SZ_16BIT),
  121. .mid_rid = 0xc6,
  122. },
  123. {
  124. .slave_id = SHDMA_SLAVE_MMCIF_TX,
  125. .addr = 0x1fcb0034,
  126. .chcr = SM_INC | RS_ERS | 0x40000000 |
  127. TS_INDEX2VAL(XMIT_SZ_32BIT),
  128. .mid_rid = 0xd3,
  129. },
  130. {
  131. .slave_id = SHDMA_SLAVE_MMCIF_RX,
  132. .addr = 0x1fcb0034,
  133. .chcr = DM_INC | RS_ERS | 0x40000000 |
  134. TS_INDEX2VAL(XMIT_SZ_32BIT),
  135. .mid_rid = 0xd7,
  136. },
  137. };
  138. static const struct sh_dmae_slave_config sh7757_dmae1_slaves[] = {
  139. {
  140. .slave_id = SHDMA_SLAVE_SCIF2_TX,
  141. .addr = 0x1f4b000c,
  142. .chcr = SM_INC | RS_ERS | 0x40000000 |
  143. TS_INDEX2VAL(XMIT_SZ_8BIT),
  144. .mid_rid = 0x21,
  145. },
  146. {
  147. .slave_id = SHDMA_SLAVE_SCIF2_RX,
  148. .addr = 0x1f4b0014,
  149. .chcr = DM_INC | RS_ERS | 0x40000000 |
  150. TS_INDEX2VAL(XMIT_SZ_8BIT),
  151. .mid_rid = 0x22,
  152. },
  153. {
  154. .slave_id = SHDMA_SLAVE_SCIF3_TX,
  155. .addr = 0x1f4c000c,
  156. .chcr = SM_INC | RS_ERS | 0x40000000 |
  157. TS_INDEX2VAL(XMIT_SZ_8BIT),
  158. .mid_rid = 0x29,
  159. },
  160. {
  161. .slave_id = SHDMA_SLAVE_SCIF3_RX,
  162. .addr = 0x1f4c0014,
  163. .chcr = DM_INC | RS_ERS | 0x40000000 |
  164. TS_INDEX2VAL(XMIT_SZ_8BIT),
  165. .mid_rid = 0x2a,
  166. },
  167. {
  168. .slave_id = SHDMA_SLAVE_SCIF4_TX,
  169. .addr = 0x1f4d000c,
  170. .chcr = SM_INC | RS_ERS | 0x40000000 |
  171. TS_INDEX2VAL(XMIT_SZ_8BIT),
  172. .mid_rid = 0x41,
  173. },
  174. {
  175. .slave_id = SHDMA_SLAVE_SCIF4_RX,
  176. .addr = 0x1f4d0014,
  177. .chcr = DM_INC | RS_ERS | 0x40000000 |
  178. TS_INDEX2VAL(XMIT_SZ_8BIT),
  179. .mid_rid = 0x42,
  180. },
  181. {
  182. .slave_id = SHDMA_SLAVE_RSPI_TX,
  183. .addr = 0xfe480004,
  184. .chcr = SM_INC | RS_ERS | 0x40000000 |
  185. TS_INDEX2VAL(XMIT_SZ_16BIT),
  186. .mid_rid = 0xc1,
  187. },
  188. {
  189. .slave_id = SHDMA_SLAVE_RSPI_RX,
  190. .addr = 0xfe480004,
  191. .chcr = DM_INC | RS_ERS | 0x40000000 |
  192. TS_INDEX2VAL(XMIT_SZ_16BIT),
  193. .mid_rid = 0xc2,
  194. },
  195. };
  196. static const struct sh_dmae_slave_config sh7757_dmae2_slaves[] = {
  197. {
  198. .slave_id = SHDMA_SLAVE_RIIC0_TX,
  199. .addr = 0x1e500012,
  200. .chcr = SM_INC | RS_ERS | 0x40000000 |
  201. TS_INDEX2VAL(XMIT_SZ_8BIT),
  202. .mid_rid = 0x21,
  203. },
  204. {
  205. .slave_id = SHDMA_SLAVE_RIIC0_RX,
  206. .addr = 0x1e500013,
  207. .chcr = DM_INC | RS_ERS | 0x40000000 |
  208. TS_INDEX2VAL(XMIT_SZ_8BIT),
  209. .mid_rid = 0x22,
  210. },
  211. {
  212. .slave_id = SHDMA_SLAVE_RIIC1_TX,
  213. .addr = 0x1e510012,
  214. .chcr = SM_INC | RS_ERS | 0x40000000 |
  215. TS_INDEX2VAL(XMIT_SZ_8BIT),
  216. .mid_rid = 0x29,
  217. },
  218. {
  219. .slave_id = SHDMA_SLAVE_RIIC1_RX,
  220. .addr = 0x1e510013,
  221. .chcr = DM_INC | RS_ERS | 0x40000000 |
  222. TS_INDEX2VAL(XMIT_SZ_8BIT),
  223. .mid_rid = 0x2a,
  224. },
  225. {
  226. .slave_id = SHDMA_SLAVE_RIIC2_TX,
  227. .addr = 0x1e520012,
  228. .chcr = SM_INC | RS_ERS | 0x40000000 |
  229. TS_INDEX2VAL(XMIT_SZ_8BIT),
  230. .mid_rid = 0xa1,
  231. },
  232. {
  233. .slave_id = SHDMA_SLAVE_RIIC2_RX,
  234. .addr = 0x1e520013,
  235. .chcr = DM_INC | RS_ERS | 0x40000000 |
  236. TS_INDEX2VAL(XMIT_SZ_8BIT),
  237. .mid_rid = 0xa2,
  238. },
  239. {
  240. .slave_id = SHDMA_SLAVE_RIIC3_TX,
  241. .addr = 0x1e530012,
  242. .chcr = SM_INC | RS_ERS | 0x40000000 |
  243. TS_INDEX2VAL(XMIT_SZ_8BIT),
  244. .mid_rid = 0xa9,
  245. },
  246. {
  247. .slave_id = SHDMA_SLAVE_RIIC3_RX,
  248. .addr = 0x1e530013,
  249. .chcr = DM_INC | RS_ERS | 0x40000000 |
  250. TS_INDEX2VAL(XMIT_SZ_8BIT),
  251. .mid_rid = 0xaf,
  252. },
  253. {
  254. .slave_id = SHDMA_SLAVE_RIIC4_TX,
  255. .addr = 0x1e540012,
  256. .chcr = SM_INC | RS_ERS | 0x40000000 |
  257. TS_INDEX2VAL(XMIT_SZ_8BIT),
  258. .mid_rid = 0xc5,
  259. },
  260. {
  261. .slave_id = SHDMA_SLAVE_RIIC4_RX,
  262. .addr = 0x1e540013,
  263. .chcr = DM_INC | RS_ERS | 0x40000000 |
  264. TS_INDEX2VAL(XMIT_SZ_8BIT),
  265. .mid_rid = 0xc6,
  266. },
  267. };
  268. static const struct sh_dmae_slave_config sh7757_dmae3_slaves[] = {
  269. {
  270. .slave_id = SHDMA_SLAVE_RIIC5_TX,
  271. .addr = 0x1e550012,
  272. .chcr = SM_INC | RS_ERS | 0x40000000 |
  273. TS_INDEX2VAL(XMIT_SZ_8BIT),
  274. .mid_rid = 0x21,
  275. },
  276. {
  277. .slave_id = SHDMA_SLAVE_RIIC5_RX,
  278. .addr = 0x1e550013,
  279. .chcr = DM_INC | RS_ERS | 0x40000000 |
  280. TS_INDEX2VAL(XMIT_SZ_8BIT),
  281. .mid_rid = 0x22,
  282. },
  283. {
  284. .slave_id = SHDMA_SLAVE_RIIC6_TX,
  285. .addr = 0x1e560012,
  286. .chcr = SM_INC | RS_ERS | 0x40000000 |
  287. TS_INDEX2VAL(XMIT_SZ_8BIT),
  288. .mid_rid = 0x29,
  289. },
  290. {
  291. .slave_id = SHDMA_SLAVE_RIIC6_RX,
  292. .addr = 0x1e560013,
  293. .chcr = DM_INC | RS_ERS | 0x40000000 |
  294. TS_INDEX2VAL(XMIT_SZ_8BIT),
  295. .mid_rid = 0x2a,
  296. },
  297. {
  298. .slave_id = SHDMA_SLAVE_RIIC7_TX,
  299. .addr = 0x1e570012,
  300. .chcr = SM_INC | RS_ERS | 0x40000000 |
  301. TS_INDEX2VAL(XMIT_SZ_8BIT),
  302. .mid_rid = 0x41,
  303. },
  304. {
  305. .slave_id = SHDMA_SLAVE_RIIC7_RX,
  306. .addr = 0x1e570013,
  307. .chcr = DM_INC | RS_ERS | 0x40000000 |
  308. TS_INDEX2VAL(XMIT_SZ_8BIT),
  309. .mid_rid = 0x42,
  310. },
  311. {
  312. .slave_id = SHDMA_SLAVE_RIIC8_TX,
  313. .addr = 0x1e580012,
  314. .chcr = SM_INC | RS_ERS | 0x40000000 |
  315. TS_INDEX2VAL(XMIT_SZ_8BIT),
  316. .mid_rid = 0x45,
  317. },
  318. {
  319. .slave_id = SHDMA_SLAVE_RIIC8_RX,
  320. .addr = 0x1e580013,
  321. .chcr = DM_INC | RS_ERS | 0x40000000 |
  322. TS_INDEX2VAL(XMIT_SZ_8BIT),
  323. .mid_rid = 0x46,
  324. },
  325. {
  326. .slave_id = SHDMA_SLAVE_RIIC9_TX,
  327. .addr = 0x1e590012,
  328. .chcr = SM_INC | RS_ERS | 0x40000000 |
  329. TS_INDEX2VAL(XMIT_SZ_8BIT),
  330. .mid_rid = 0x51,
  331. },
  332. {
  333. .slave_id = SHDMA_SLAVE_RIIC9_RX,
  334. .addr = 0x1e590013,
  335. .chcr = DM_INC | RS_ERS | 0x40000000 |
  336. TS_INDEX2VAL(XMIT_SZ_8BIT),
  337. .mid_rid = 0x52,
  338. },
  339. };
  340. static const struct sh_dmae_channel sh7757_dmae_channels[] = {
  341. {
  342. .offset = 0,
  343. .dmars = 0,
  344. .dmars_bit = 0,
  345. }, {
  346. .offset = 0x10,
  347. .dmars = 0,
  348. .dmars_bit = 8,
  349. }, {
  350. .offset = 0x20,
  351. .dmars = 4,
  352. .dmars_bit = 0,
  353. }, {
  354. .offset = 0x30,
  355. .dmars = 4,
  356. .dmars_bit = 8,
  357. }, {
  358. .offset = 0x50,
  359. .dmars = 8,
  360. .dmars_bit = 0,
  361. }, {
  362. .offset = 0x60,
  363. .dmars = 8,
  364. .dmars_bit = 8,
  365. }
  366. };
  367. static const unsigned int ts_shift[] = TS_SHIFT;
  368. static struct sh_dmae_pdata dma0_platform_data = {
  369. .slave = sh7757_dmae0_slaves,
  370. .slave_num = ARRAY_SIZE(sh7757_dmae0_slaves),
  371. .channel = sh7757_dmae_channels,
  372. .channel_num = ARRAY_SIZE(sh7757_dmae_channels),
  373. .ts_low_shift = CHCR_TS_LOW_SHIFT,
  374. .ts_low_mask = CHCR_TS_LOW_MASK,
  375. .ts_high_shift = CHCR_TS_HIGH_SHIFT,
  376. .ts_high_mask = CHCR_TS_HIGH_MASK,
  377. .ts_shift = ts_shift,
  378. .ts_shift_num = ARRAY_SIZE(ts_shift),
  379. .dmaor_init = DMAOR_INIT,
  380. };
  381. static struct sh_dmae_pdata dma1_platform_data = {
  382. .slave = sh7757_dmae1_slaves,
  383. .slave_num = ARRAY_SIZE(sh7757_dmae1_slaves),
  384. .channel = sh7757_dmae_channels,
  385. .channel_num = ARRAY_SIZE(sh7757_dmae_channels),
  386. .ts_low_shift = CHCR_TS_LOW_SHIFT,
  387. .ts_low_mask = CHCR_TS_LOW_MASK,
  388. .ts_high_shift = CHCR_TS_HIGH_SHIFT,
  389. .ts_high_mask = CHCR_TS_HIGH_MASK,
  390. .ts_shift = ts_shift,
  391. .ts_shift_num = ARRAY_SIZE(ts_shift),
  392. .dmaor_init = DMAOR_INIT,
  393. };
  394. static struct sh_dmae_pdata dma2_platform_data = {
  395. .slave = sh7757_dmae2_slaves,
  396. .slave_num = ARRAY_SIZE(sh7757_dmae2_slaves),
  397. .channel = sh7757_dmae_channels,
  398. .channel_num = ARRAY_SIZE(sh7757_dmae_channels),
  399. .ts_low_shift = CHCR_TS_LOW_SHIFT,
  400. .ts_low_mask = CHCR_TS_LOW_MASK,
  401. .ts_high_shift = CHCR_TS_HIGH_SHIFT,
  402. .ts_high_mask = CHCR_TS_HIGH_MASK,
  403. .ts_shift = ts_shift,
  404. .ts_shift_num = ARRAY_SIZE(ts_shift),
  405. .dmaor_init = DMAOR_INIT,
  406. };
  407. static struct sh_dmae_pdata dma3_platform_data = {
  408. .slave = sh7757_dmae3_slaves,
  409. .slave_num = ARRAY_SIZE(sh7757_dmae3_slaves),
  410. .channel = sh7757_dmae_channels,
  411. .channel_num = ARRAY_SIZE(sh7757_dmae_channels),
  412. .ts_low_shift = CHCR_TS_LOW_SHIFT,
  413. .ts_low_mask = CHCR_TS_LOW_MASK,
  414. .ts_high_shift = CHCR_TS_HIGH_SHIFT,
  415. .ts_high_mask = CHCR_TS_HIGH_MASK,
  416. .ts_shift = ts_shift,
  417. .ts_shift_num = ARRAY_SIZE(ts_shift),
  418. .dmaor_init = DMAOR_INIT,
  419. };
  420. /* channel 0 to 5 */
  421. static struct resource sh7757_dmae0_resources[] = {
  422. [0] = {
  423. /* Channel registers and DMAOR */
  424. .start = 0xff608020,
  425. .end = 0xff60808f,
  426. .flags = IORESOURCE_MEM,
  427. },
  428. [1] = {
  429. /* DMARSx */
  430. .start = 0xff609000,
  431. .end = 0xff60900b,
  432. .flags = IORESOURCE_MEM,
  433. },
  434. {
  435. .name = "error_irq",
  436. .start = evt2irq(0x640),
  437. .end = evt2irq(0x640),
  438. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  439. },
  440. };
  441. /* channel 6 to 11 */
  442. static struct resource sh7757_dmae1_resources[] = {
  443. [0] = {
  444. /* Channel registers and DMAOR */
  445. .start = 0xff618020,
  446. .end = 0xff61808f,
  447. .flags = IORESOURCE_MEM,
  448. },
  449. [1] = {
  450. /* DMARSx */
  451. .start = 0xff619000,
  452. .end = 0xff61900b,
  453. .flags = IORESOURCE_MEM,
  454. },
  455. {
  456. .name = "error_irq",
  457. .start = evt2irq(0x640),
  458. .end = evt2irq(0x640),
  459. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  460. },
  461. {
  462. /* IRQ for channels 4 */
  463. .start = evt2irq(0x7c0),
  464. .end = evt2irq(0x7c0),
  465. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  466. },
  467. {
  468. /* IRQ for channels 5 */
  469. .start = evt2irq(0x7c0),
  470. .end = evt2irq(0x7c0),
  471. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  472. },
  473. {
  474. /* IRQ for channels 6 */
  475. .start = evt2irq(0xd00),
  476. .end = evt2irq(0xd00),
  477. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  478. },
  479. {
  480. /* IRQ for channels 7 */
  481. .start = evt2irq(0xd00),
  482. .end = evt2irq(0xd00),
  483. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  484. },
  485. {
  486. /* IRQ for channels 8 */
  487. .start = evt2irq(0xd00),
  488. .end = evt2irq(0xd00),
  489. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  490. },
  491. {
  492. /* IRQ for channels 9 */
  493. .start = evt2irq(0xd00),
  494. .end = evt2irq(0xd00),
  495. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  496. },
  497. {
  498. /* IRQ for channels 10 */
  499. .start = evt2irq(0xd00),
  500. .end = evt2irq(0xd00),
  501. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  502. },
  503. {
  504. /* IRQ for channels 11 */
  505. .start = evt2irq(0xd00),
  506. .end = evt2irq(0xd00),
  507. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  508. },
  509. };
  510. /* channel 12 to 17 */
  511. static struct resource sh7757_dmae2_resources[] = {
  512. [0] = {
  513. /* Channel registers and DMAOR */
  514. .start = 0xff708020,
  515. .end = 0xff70808f,
  516. .flags = IORESOURCE_MEM,
  517. },
  518. [1] = {
  519. /* DMARSx */
  520. .start = 0xff709000,
  521. .end = 0xff70900b,
  522. .flags = IORESOURCE_MEM,
  523. },
  524. {
  525. .name = "error_irq",
  526. .start = evt2irq(0x2a60),
  527. .end = evt2irq(0x2a60),
  528. .flags = IORESOURCE_IRQ,
  529. },
  530. {
  531. /* IRQ for channels 12 to 16 */
  532. .start = evt2irq(0x2400),
  533. .end = evt2irq(0x2480),
  534. .flags = IORESOURCE_IRQ,
  535. },
  536. {
  537. /* IRQ for channel 17 */
  538. .start = evt2irq(0x24e0),
  539. .end = evt2irq(0x24e0),
  540. .flags = IORESOURCE_IRQ,
  541. },
  542. };
  543. /* channel 18 to 23 */
  544. static struct resource sh7757_dmae3_resources[] = {
  545. [0] = {
  546. /* Channel registers and DMAOR */
  547. .start = 0xff718020,
  548. .end = 0xff71808f,
  549. .flags = IORESOURCE_MEM,
  550. },
  551. [1] = {
  552. /* DMARSx */
  553. .start = 0xff719000,
  554. .end = 0xff71900b,
  555. .flags = IORESOURCE_MEM,
  556. },
  557. {
  558. .name = "error_irq",
  559. .start = evt2irq(0x2a80),
  560. .end = evt2irq(0x2a80),
  561. .flags = IORESOURCE_IRQ,
  562. },
  563. {
  564. /* IRQ for channels 18 to 22 */
  565. .start = evt2irq(0x2500),
  566. .end = evt2irq(0x2580),
  567. .flags = IORESOURCE_IRQ,
  568. },
  569. {
  570. /* IRQ for channel 23 */
  571. .start = evt2irq(0x2600),
  572. .end = evt2irq(0x2600),
  573. .flags = IORESOURCE_IRQ,
  574. },
  575. };
  576. static struct platform_device dma0_device = {
  577. .name = "sh-dma-engine",
  578. .id = 0,
  579. .resource = sh7757_dmae0_resources,
  580. .num_resources = ARRAY_SIZE(sh7757_dmae0_resources),
  581. .dev = {
  582. .platform_data = &dma0_platform_data,
  583. },
  584. };
  585. static struct platform_device dma1_device = {
  586. .name = "sh-dma-engine",
  587. .id = 1,
  588. .resource = sh7757_dmae1_resources,
  589. .num_resources = ARRAY_SIZE(sh7757_dmae1_resources),
  590. .dev = {
  591. .platform_data = &dma1_platform_data,
  592. },
  593. };
  594. static struct platform_device dma2_device = {
  595. .name = "sh-dma-engine",
  596. .id = 2,
  597. .resource = sh7757_dmae2_resources,
  598. .num_resources = ARRAY_SIZE(sh7757_dmae2_resources),
  599. .dev = {
  600. .platform_data = &dma2_platform_data,
  601. },
  602. };
  603. static struct platform_device dma3_device = {
  604. .name = "sh-dma-engine",
  605. .id = 3,
  606. .resource = sh7757_dmae3_resources,
  607. .num_resources = ARRAY_SIZE(sh7757_dmae3_resources),
  608. .dev = {
  609. .platform_data = &dma3_platform_data,
  610. },
  611. };
  612. static struct platform_device spi0_device = {
  613. .name = "sh_spi",
  614. .id = 0,
  615. .dev = {
  616. .dma_mask = NULL,
  617. .coherent_dma_mask = 0xffffffff,
  618. },
  619. .num_resources = ARRAY_SIZE(spi0_resources),
  620. .resource = spi0_resources,
  621. };
  622. static struct resource spi1_resources[] = {
  623. {
  624. .start = 0xffd8ee70,
  625. .end = 0xffd8eeff,
  626. .flags = IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
  627. },
  628. {
  629. .start = evt2irq(0x8c0),
  630. .flags = IORESOURCE_IRQ,
  631. },
  632. };
  633. static struct platform_device spi1_device = {
  634. .name = "sh_spi",
  635. .id = 1,
  636. .num_resources = ARRAY_SIZE(spi1_resources),
  637. .resource = spi1_resources,
  638. };
  639. static struct resource rspi_resources[] = {
  640. {
  641. .start = 0xfe480000,
  642. .end = 0xfe4800ff,
  643. .flags = IORESOURCE_MEM,
  644. },
  645. {
  646. .start = evt2irq(0x1d80),
  647. .flags = IORESOURCE_IRQ,
  648. },
  649. };
  650. static struct platform_device rspi_device = {
  651. .name = "rspi",
  652. .id = 2,
  653. .num_resources = ARRAY_SIZE(rspi_resources),
  654. .resource = rspi_resources,
  655. };
  656. static struct resource usb_ehci_resources[] = {
  657. [0] = {
  658. .start = 0xfe4f1000,
  659. .end = 0xfe4f10ff,
  660. .flags = IORESOURCE_MEM,
  661. },
  662. [1] = {
  663. .start = evt2irq(0x920),
  664. .end = evt2irq(0x920),
  665. .flags = IORESOURCE_IRQ,
  666. },
  667. };
  668. static struct platform_device usb_ehci_device = {
  669. .name = "sh_ehci",
  670. .id = -1,
  671. .dev = {
  672. .dma_mask = &usb_ehci_device.dev.coherent_dma_mask,
  673. .coherent_dma_mask = DMA_BIT_MASK(32),
  674. },
  675. .num_resources = ARRAY_SIZE(usb_ehci_resources),
  676. .resource = usb_ehci_resources,
  677. };
  678. static struct resource usb_ohci_resources[] = {
  679. [0] = {
  680. .start = 0xfe4f1800,
  681. .end = 0xfe4f18ff,
  682. .flags = IORESOURCE_MEM,
  683. },
  684. [1] = {
  685. .start = evt2irq(0x920),
  686. .end = evt2irq(0x920),
  687. .flags = IORESOURCE_IRQ,
  688. },
  689. };
  690. static struct usb_ohci_pdata usb_ohci_pdata;
  691. static struct platform_device usb_ohci_device = {
  692. .name = "ohci-platform",
  693. .id = -1,
  694. .dev = {
  695. .dma_mask = &usb_ohci_device.dev.coherent_dma_mask,
  696. .coherent_dma_mask = DMA_BIT_MASK(32),
  697. .platform_data = &usb_ohci_pdata,
  698. },
  699. .num_resources = ARRAY_SIZE(usb_ohci_resources),
  700. .resource = usb_ohci_resources,
  701. };
  702. static struct platform_device *sh7757_devices[] __initdata = {
  703. &scif2_device,
  704. &scif3_device,
  705. &scif4_device,
  706. &tmu0_device,
  707. &dma0_device,
  708. &dma1_device,
  709. &dma2_device,
  710. &dma3_device,
  711. &spi0_device,
  712. &spi1_device,
  713. &rspi_device,
  714. &usb_ehci_device,
  715. &usb_ohci_device,
  716. };
  717. static int __init sh7757_devices_setup(void)
  718. {
  719. return platform_add_devices(sh7757_devices,
  720. ARRAY_SIZE(sh7757_devices));
  721. }
  722. arch_initcall(sh7757_devices_setup);
  723. static struct platform_device *sh7757_early_devices[] __initdata = {
  724. &scif2_device,
  725. &scif3_device,
  726. &scif4_device,
  727. &tmu0_device,
  728. };
  729. void __init plat_early_device_setup(void)
  730. {
  731. early_platform_add_devices(sh7757_early_devices,
  732. ARRAY_SIZE(sh7757_early_devices));
  733. }
  734. enum {
  735. UNUSED = 0,
  736. /* interrupt sources */
  737. IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH,
  738. IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH,
  739. IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH,
  740. IRL0_HHLL, IRL0_HHLH, IRL0_HHHL,
  741. IRL4_LLLL, IRL4_LLLH, IRL4_LLHL, IRL4_LLHH,
  742. IRL4_LHLL, IRL4_LHLH, IRL4_LHHL, IRL4_LHHH,
  743. IRL4_HLLL, IRL4_HLLH, IRL4_HLHL, IRL4_HLHH,
  744. IRL4_HHLL, IRL4_HHLH, IRL4_HHHL,
  745. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
  746. SDHI, DVC,
  747. IRQ8, IRQ9, IRQ11, IRQ10, IRQ12, IRQ13, IRQ14, IRQ15,
  748. TMU0, TMU1, TMU2, TMU2_TICPI, TMU3, TMU4, TMU5,
  749. HUDI,
  750. ARC4,
  751. DMAC0_5, DMAC6_7, DMAC8_11,
  752. SCIF0, SCIF1, SCIF2, SCIF3, SCIF4,
  753. USB0, USB1,
  754. JMC,
  755. SPI0, SPI1,
  756. TMR01, TMR23, TMR45,
  757. FRT,
  758. LPC, LPC5, LPC6, LPC7, LPC8,
  759. PECI0, PECI1, PECI2, PECI3, PECI4, PECI5,
  760. ETHERC,
  761. ADC0, ADC1,
  762. SIM,
  763. IIC0_0, IIC0_1, IIC0_2, IIC0_3,
  764. IIC1_0, IIC1_1, IIC1_2, IIC1_3,
  765. IIC2_0, IIC2_1, IIC2_2, IIC2_3,
  766. IIC3_0, IIC3_1, IIC3_2, IIC3_3,
  767. IIC4_0, IIC4_1, IIC4_2, IIC4_3,
  768. IIC5_0, IIC5_1, IIC5_2, IIC5_3,
  769. IIC6_0, IIC6_1, IIC6_2, IIC6_3,
  770. IIC7_0, IIC7_1, IIC7_2, IIC7_3,
  771. IIC8_0, IIC8_1, IIC8_2, IIC8_3,
  772. IIC9_0, IIC9_1, IIC9_2, IIC9_3,
  773. ONFICTL,
  774. MMC1, MMC2,
  775. ECCU,
  776. PCIC,
  777. G200,
  778. RSPI,
  779. SGPIO,
  780. DMINT12, DMINT13, DMINT14, DMINT15, DMINT16, DMINT17, DMINT18, DMINT19,
  781. DMINT20, DMINT21, DMINT22, DMINT23,
  782. DDRECC,
  783. TSIP,
  784. PCIE_BRIDGE,
  785. WDT0B, WDT1B, WDT2B, WDT3B, WDT4B, WDT5B, WDT6B, WDT7B, WDT8B,
  786. GETHER0, GETHER1, GETHER2,
  787. PBIA, PBIB, PBIC,
  788. DMAE2, DMAE3,
  789. SERMUX2, SERMUX3,
  790. /* interrupt groups */
  791. TMU012, TMU345,
  792. };
  793. static struct intc_vect vectors[] __initdata = {
  794. INTC_VECT(SDHI, 0x480), INTC_VECT(SDHI, 0x04a0),
  795. INTC_VECT(SDHI, 0x4c0),
  796. INTC_VECT(DVC, 0x4e0),
  797. INTC_VECT(IRQ8, 0x500), INTC_VECT(IRQ9, 0x520),
  798. INTC_VECT(IRQ10, 0x540),
  799. INTC_VECT(TMU0, 0x580), INTC_VECT(TMU1, 0x5a0),
  800. INTC_VECT(TMU2, 0x5c0), INTC_VECT(TMU2_TICPI, 0x5e0),
  801. INTC_VECT(HUDI, 0x600),
  802. INTC_VECT(ARC4, 0x620),
  803. INTC_VECT(DMAC0_5, 0x640), INTC_VECT(DMAC0_5, 0x660),
  804. INTC_VECT(DMAC0_5, 0x680), INTC_VECT(DMAC0_5, 0x6a0),
  805. INTC_VECT(DMAC0_5, 0x6c0),
  806. INTC_VECT(IRQ11, 0x6e0),
  807. INTC_VECT(SCIF2, 0x700), INTC_VECT(SCIF2, 0x720),
  808. INTC_VECT(SCIF2, 0x740), INTC_VECT(SCIF2, 0x760),
  809. INTC_VECT(DMAC0_5, 0x780), INTC_VECT(DMAC0_5, 0x7a0),
  810. INTC_VECT(DMAC6_7, 0x7c0), INTC_VECT(DMAC6_7, 0x7e0),
  811. INTC_VECT(USB0, 0x840),
  812. INTC_VECT(IRQ12, 0x880),
  813. INTC_VECT(JMC, 0x8a0),
  814. INTC_VECT(SPI1, 0x8c0),
  815. INTC_VECT(IRQ13, 0x8e0), INTC_VECT(IRQ14, 0x900),
  816. INTC_VECT(USB1, 0x920),
  817. INTC_VECT(TMR01, 0xa00), INTC_VECT(TMR23, 0xa20),
  818. INTC_VECT(TMR45, 0xa40),
  819. INTC_VECT(FRT, 0xa80),
  820. INTC_VECT(LPC, 0xaa0), INTC_VECT(LPC, 0xac0),
  821. INTC_VECT(LPC, 0xae0), INTC_VECT(LPC, 0xb00),
  822. INTC_VECT(LPC, 0xb20),
  823. INTC_VECT(SCIF0, 0xb40), INTC_VECT(SCIF1, 0xb60),
  824. INTC_VECT(SCIF3, 0xb80), INTC_VECT(SCIF3, 0xba0),
  825. INTC_VECT(SCIF3, 0xbc0), INTC_VECT(SCIF3, 0xbe0),
  826. INTC_VECT(PECI0, 0xc00), INTC_VECT(PECI1, 0xc20),
  827. INTC_VECT(PECI2, 0xc40),
  828. INTC_VECT(IRQ15, 0xc60),
  829. INTC_VECT(ETHERC, 0xc80), INTC_VECT(ETHERC, 0xca0),
  830. INTC_VECT(SPI0, 0xcc0),
  831. INTC_VECT(ADC1, 0xce0),
  832. INTC_VECT(DMAC8_11, 0xd00), INTC_VECT(DMAC8_11, 0xd20),
  833. INTC_VECT(DMAC8_11, 0xd40), INTC_VECT(DMAC8_11, 0xd60),
  834. INTC_VECT(SIM, 0xd80), INTC_VECT(SIM, 0xda0),
  835. INTC_VECT(SIM, 0xdc0), INTC_VECT(SIM, 0xde0),
  836. INTC_VECT(TMU3, 0xe00), INTC_VECT(TMU4, 0xe20),
  837. INTC_VECT(TMU5, 0xe40),
  838. INTC_VECT(ADC0, 0xe60),
  839. INTC_VECT(SCIF4, 0xf00), INTC_VECT(SCIF4, 0xf20),
  840. INTC_VECT(SCIF4, 0xf40), INTC_VECT(SCIF4, 0xf60),
  841. INTC_VECT(IIC0_0, 0x1400), INTC_VECT(IIC0_1, 0x1420),
  842. INTC_VECT(IIC0_2, 0x1440), INTC_VECT(IIC0_3, 0x1460),
  843. INTC_VECT(IIC1_0, 0x1480), INTC_VECT(IIC1_1, 0x14e0),
  844. INTC_VECT(IIC1_2, 0x1500), INTC_VECT(IIC1_3, 0x1520),
  845. INTC_VECT(IIC2_0, 0x1540), INTC_VECT(IIC2_1, 0x1560),
  846. INTC_VECT(IIC2_2, 0x1580), INTC_VECT(IIC2_3, 0x1600),
  847. INTC_VECT(IIC3_0, 0x1620), INTC_VECT(IIC3_1, 0x1640),
  848. INTC_VECT(IIC3_2, 0x16e0), INTC_VECT(IIC3_3, 0x1700),
  849. INTC_VECT(IIC4_0, 0x17c0), INTC_VECT(IIC4_1, 0x1800),
  850. INTC_VECT(IIC4_2, 0x1820), INTC_VECT(IIC4_3, 0x1840),
  851. INTC_VECT(IIC5_0, 0x1860), INTC_VECT(IIC5_1, 0x1880),
  852. INTC_VECT(IIC5_2, 0x18a0), INTC_VECT(IIC5_3, 0x18c0),
  853. INTC_VECT(IIC6_0, 0x18e0), INTC_VECT(IIC6_1, 0x1900),
  854. INTC_VECT(IIC6_2, 0x1920),
  855. INTC_VECT(ONFICTL, 0x1960),
  856. INTC_VECT(IIC6_3, 0x1980),
  857. INTC_VECT(IIC7_0, 0x19a0), INTC_VECT(IIC7_1, 0x1a00),
  858. INTC_VECT(IIC7_2, 0x1a20), INTC_VECT(IIC7_3, 0x1a40),
  859. INTC_VECT(IIC8_0, 0x1a60), INTC_VECT(IIC8_1, 0x1a80),
  860. INTC_VECT(IIC8_2, 0x1aa0), INTC_VECT(IIC8_3, 0x1b40),
  861. INTC_VECT(IIC9_0, 0x1b60), INTC_VECT(IIC9_1, 0x1b80),
  862. INTC_VECT(IIC9_2, 0x1c00), INTC_VECT(IIC9_3, 0x1c20),
  863. INTC_VECT(MMC1, 0x1c60), INTC_VECT(MMC2, 0x1c80),
  864. INTC_VECT(ECCU, 0x1cc0),
  865. INTC_VECT(PCIC, 0x1ce0),
  866. INTC_VECT(G200, 0x1d00),
  867. INTC_VECT(RSPI, 0x1d80), INTC_VECT(RSPI, 0x1da0),
  868. INTC_VECT(RSPI, 0x1dc0), INTC_VECT(RSPI, 0x1de0),
  869. INTC_VECT(PECI3, 0x1ec0), INTC_VECT(PECI4, 0x1ee0),
  870. INTC_VECT(PECI5, 0x1f00),
  871. INTC_VECT(SGPIO, 0x1f80), INTC_VECT(SGPIO, 0x1fa0),
  872. INTC_VECT(SGPIO, 0x1fc0),
  873. INTC_VECT(DMINT12, 0x2400), INTC_VECT(DMINT13, 0x2420),
  874. INTC_VECT(DMINT14, 0x2440), INTC_VECT(DMINT15, 0x2460),
  875. INTC_VECT(DMINT16, 0x2480), INTC_VECT(DMINT17, 0x24e0),
  876. INTC_VECT(DMINT18, 0x2500), INTC_VECT(DMINT19, 0x2520),
  877. INTC_VECT(DMINT20, 0x2540), INTC_VECT(DMINT21, 0x2560),
  878. INTC_VECT(DMINT22, 0x2580), INTC_VECT(DMINT23, 0x2600),
  879. INTC_VECT(DDRECC, 0x2620),
  880. INTC_VECT(TSIP, 0x2640),
  881. INTC_VECT(PCIE_BRIDGE, 0x27c0),
  882. INTC_VECT(WDT0B, 0x2800), INTC_VECT(WDT1B, 0x2820),
  883. INTC_VECT(WDT2B, 0x2840), INTC_VECT(WDT3B, 0x2860),
  884. INTC_VECT(WDT4B, 0x2880), INTC_VECT(WDT5B, 0x28a0),
  885. INTC_VECT(WDT6B, 0x28c0), INTC_VECT(WDT7B, 0x28e0),
  886. INTC_VECT(WDT8B, 0x2900),
  887. INTC_VECT(GETHER0, 0x2960), INTC_VECT(GETHER1, 0x2980),
  888. INTC_VECT(GETHER2, 0x29a0),
  889. INTC_VECT(PBIA, 0x2a00), INTC_VECT(PBIB, 0x2a20),
  890. INTC_VECT(PBIC, 0x2a40),
  891. INTC_VECT(DMAE2, 0x2a60), INTC_VECT(DMAE3, 0x2a80),
  892. INTC_VECT(SERMUX2, 0x2aa0), INTC_VECT(SERMUX3, 0x2b40),
  893. INTC_VECT(LPC5, 0x2b60), INTC_VECT(LPC6, 0x2b80),
  894. INTC_VECT(LPC7, 0x2c00), INTC_VECT(LPC8, 0x2c20),
  895. };
  896. static struct intc_group groups[] __initdata = {
  897. INTC_GROUP(TMU012, TMU0, TMU1, TMU2, TMU2_TICPI),
  898. INTC_GROUP(TMU345, TMU3, TMU4, TMU5),
  899. };
  900. static struct intc_mask_reg mask_registers[] __initdata = {
  901. { 0xffd00044, 0xffd00064, 32, /* INTMSK0 / INTMSKCLR0 */
  902. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  903. { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
  904. { IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH,
  905. IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH,
  906. IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH,
  907. IRL0_HHLL, IRL0_HHLH, IRL0_HHHL, 0,
  908. IRL4_LLLL, IRL4_LLLH, IRL4_LLHL, IRL4_LLHH,
  909. IRL4_LHLL, IRL4_LHLH, IRL4_LHHL, IRL4_LHHH,
  910. IRL4_HLLL, IRL4_HLLH, IRL4_HLHL, IRL4_HLHH,
  911. IRL4_HHLL, IRL4_HHLH, IRL4_HHHL, 0, } },
  912. { 0xffd40038, 0xffd4003c, 32, /* INT2MSKR / INT2MSKCR */
  913. { 0, 0, 0, 0, 0, 0, 0, 0,
  914. 0, DMAC8_11, 0, PECI0, LPC, FRT, 0, TMR45,
  915. TMR23, TMR01, 0, 0, 0, 0, 0, DMAC0_5,
  916. HUDI, 0, 0, SCIF3, SCIF2, SDHI, TMU345, TMU012
  917. } },
  918. { 0xffd400d0, 0xffd400d4, 32, /* INT2MSKR1 / INT2MSKCR1 */
  919. { IRQ15, IRQ14, IRQ13, IRQ12, IRQ11, IRQ10, SCIF4, ETHERC,
  920. IRQ9, IRQ8, SCIF1, SCIF0, USB0, 0, 0, USB1,
  921. ADC1, 0, DMAC6_7, ADC0, SPI0, SIM, PECI2, PECI1,
  922. ARC4, 0, SPI1, JMC, 0, 0, 0, DVC
  923. } },
  924. { 0xffd10038, 0xffd1003c, 32, /* INT2MSKR2 / INT2MSKCR2 */
  925. { IIC4_1, IIC4_2, IIC5_0, ONFICTL, 0, 0, SGPIO, 0,
  926. 0, G200, 0, IIC9_2, IIC8_2, IIC8_1, IIC8_0, IIC7_3,
  927. IIC7_2, IIC7_1, IIC6_3, IIC0_0, IIC0_1, IIC0_2, IIC0_3, IIC3_1,
  928. IIC2_3, 0, IIC2_1, IIC9_1, IIC3_3, IIC1_0, 0, IIC2_2
  929. } },
  930. { 0xffd100d0, 0xffd100d4, 32, /* INT2MSKR3 / INT2MSKCR3 */
  931. { MMC1, IIC6_1, IIC6_0, IIC5_1, IIC3_2, IIC2_0, PECI5, MMC2,
  932. IIC1_3, IIC1_2, IIC9_0, IIC8_3, IIC4_3, IIC7_0, 0, IIC6_2,
  933. PCIC, 0, IIC4_0, 0, ECCU, RSPI, 0, IIC9_3,
  934. IIC3_0, 0, IIC5_3, IIC5_2, 0, 0, 0, IIC1_1
  935. } },
  936. { 0xffd20038, 0xffd2003c, 32, /* INT2MSKR4 / INT2MSKCR4 */
  937. { WDT0B, WDT1B, WDT3B, GETHER0, 0, 0, 0, 0,
  938. 0, 0, 0, LPC7, SERMUX2, DMAE3, DMAE2, PBIC,
  939. PBIB, PBIA, GETHER1, DMINT12, DMINT13, DMINT14, DMINT15, TSIP,
  940. DMINT23, 0, DMINT21, LPC6, 0, DMINT16, 0, DMINT22
  941. } },
  942. { 0xffd200d0, 0xffd200d4, 32, /* INT2MSKR5 / INT2MSKCR5 */
  943. { 0, WDT8B, WDT7B, WDT4B, 0, DMINT20, 0, 0,
  944. DMINT19, DMINT18, LPC5, SERMUX3, WDT2B, GETHER2, 0, 0,
  945. 0, 0, PCIE_BRIDGE, 0, 0, 0, 0, LPC8,
  946. DDRECC, 0, WDT6B, WDT5B, 0, 0, 0, DMINT17
  947. } },
  948. };
  949. #define INTPRI 0xffd00010
  950. #define INT2PRI0 0xffd40000
  951. #define INT2PRI1 0xffd40004
  952. #define INT2PRI2 0xffd40008
  953. #define INT2PRI3 0xffd4000c
  954. #define INT2PRI4 0xffd40010
  955. #define INT2PRI5 0xffd40014
  956. #define INT2PRI6 0xffd40018
  957. #define INT2PRI7 0xffd4001c
  958. #define INT2PRI8 0xffd400a0
  959. #define INT2PRI9 0xffd400a4
  960. #define INT2PRI10 0xffd400a8
  961. #define INT2PRI11 0xffd400ac
  962. #define INT2PRI12 0xffd400b0
  963. #define INT2PRI13 0xffd400b4
  964. #define INT2PRI14 0xffd400b8
  965. #define INT2PRI15 0xffd400bc
  966. #define INT2PRI16 0xffd10000
  967. #define INT2PRI17 0xffd10004
  968. #define INT2PRI18 0xffd10008
  969. #define INT2PRI19 0xffd1000c
  970. #define INT2PRI20 0xffd10010
  971. #define INT2PRI21 0xffd10014
  972. #define INT2PRI22 0xffd10018
  973. #define INT2PRI23 0xffd1001c
  974. #define INT2PRI24 0xffd100a0
  975. #define INT2PRI25 0xffd100a4
  976. #define INT2PRI26 0xffd100a8
  977. #define INT2PRI27 0xffd100ac
  978. #define INT2PRI28 0xffd100b0
  979. #define INT2PRI29 0xffd100b4
  980. #define INT2PRI30 0xffd100b8
  981. #define INT2PRI31 0xffd100bc
  982. #define INT2PRI32 0xffd20000
  983. #define INT2PRI33 0xffd20004
  984. #define INT2PRI34 0xffd20008
  985. #define INT2PRI35 0xffd2000c
  986. #define INT2PRI36 0xffd20010
  987. #define INT2PRI37 0xffd20014
  988. #define INT2PRI38 0xffd20018
  989. #define INT2PRI39 0xffd2001c
  990. #define INT2PRI40 0xffd200a0
  991. #define INT2PRI41 0xffd200a4
  992. #define INT2PRI42 0xffd200a8
  993. #define INT2PRI43 0xffd200ac
  994. #define INT2PRI44 0xffd200b0
  995. #define INT2PRI45 0xffd200b4
  996. #define INT2PRI46 0xffd200b8
  997. #define INT2PRI47 0xffd200bc
  998. static struct intc_prio_reg prio_registers[] __initdata = {
  999. { INTPRI, 0, 32, 4, { IRQ0, IRQ1, IRQ2, IRQ3,
  1000. IRQ4, IRQ5, IRQ6, IRQ7 } },
  1001. { INT2PRI0, 0, 32, 8, { TMU0, TMU1, TMU2, TMU2_TICPI } },
  1002. { INT2PRI1, 0, 32, 8, { TMU3, TMU4, TMU5, SDHI } },
  1003. { INT2PRI2, 0, 32, 8, { SCIF2, SCIF3, 0, IRQ8 } },
  1004. { INT2PRI3, 0, 32, 8, { HUDI, DMAC0_5, ADC0, IRQ9 } },
  1005. { INT2PRI4, 0, 32, 8, { IRQ10, 0, TMR01, TMR23 } },
  1006. { INT2PRI5, 0, 32, 8, { TMR45, 0, FRT, LPC } },
  1007. { INT2PRI6, 0, 32, 8, { PECI0, ETHERC, DMAC8_11, 0 } },
  1008. { INT2PRI7, 0, 32, 8, { SCIF4, 0, IRQ11, IRQ12 } },
  1009. { INT2PRI8, 0, 32, 8, { 0, 0, 0, DVC } },
  1010. { INT2PRI9, 0, 32, 8, { ARC4, 0, SPI1, JMC } },
  1011. { INT2PRI10, 0, 32, 8, { SPI0, SIM, PECI2, PECI1 } },
  1012. { INT2PRI11, 0, 32, 8, { ADC1, IRQ13, DMAC6_7, IRQ14 } },
  1013. { INT2PRI12, 0, 32, 8, { USB0, 0, IRQ15, USB1 } },
  1014. { INT2PRI13, 0, 32, 8, { 0, 0, SCIF1, SCIF0 } },
  1015. { INT2PRI16, 0, 32, 8, { IIC2_2, 0, 0, 0 } },
  1016. { INT2PRI17, 0, 32, 8, { 0, 0, 0, IIC1_0 } },
  1017. { INT2PRI18, 0, 32, 8, { IIC3_3, IIC9_1, IIC2_1, IIC1_2 } },
  1018. { INT2PRI19, 0, 32, 8, { IIC2_3, IIC3_1, 0, IIC1_3 } },
  1019. { INT2PRI20, 0, 32, 8, { IIC2_0, IIC6_3, IIC7_1, IIC7_2 } },
  1020. { INT2PRI21, 0, 32, 8, { IIC7_3, IIC8_0, IIC8_1, IIC8_2 } },
  1021. { INT2PRI22, 0, 32, 8, { IIC9_2, MMC2, G200, 0 } },
  1022. { INT2PRI23, 0, 32, 8, { PECI5, SGPIO, IIC3_2, IIC5_1 } },
  1023. { INT2PRI24, 0, 32, 8, { PECI4, PECI3, 0, IIC1_1 } },
  1024. { INT2PRI25, 0, 32, 8, { IIC3_0, 0, IIC5_3, IIC5_2 } },
  1025. { INT2PRI26, 0, 32, 8, { ECCU, RSPI, 0, IIC9_3 } },
  1026. { INT2PRI27, 0, 32, 8, { PCIC, IIC6_0, IIC4_0, IIC6_1 } },
  1027. { INT2PRI28, 0, 32, 8, { IIC4_3, IIC7_0, MMC1, IIC6_2 } },
  1028. { INT2PRI29, 0, 32, 8, { 0, 0, IIC9_0, IIC8_3 } },
  1029. { INT2PRI30, 0, 32, 8, { IIC4_1, IIC4_2, IIC5_0, ONFICTL } },
  1030. { INT2PRI31, 0, 32, 8, { IIC0_0, IIC0_1, IIC0_2, IIC0_3 } },
  1031. { INT2PRI32, 0, 32, 8, { DMINT22, 0, 0, 0 } },
  1032. { INT2PRI33, 0, 32, 8, { 0, 0, 0, DMINT16 } },
  1033. { INT2PRI34, 0, 32, 8, { 0, LPC6, DMINT21, DMINT18 } },
  1034. { INT2PRI35, 0, 32, 8, { DMINT23, TSIP, 0, DMINT19 } },
  1035. { INT2PRI36, 0, 32, 8, { DMINT20, GETHER1, PBIA, PBIB } },
  1036. { INT2PRI37, 0, 32, 8, { PBIC, DMAE2, DMAE3, SERMUX2 } },
  1037. { INT2PRI38, 0, 32, 8, { LPC7, 0, 0, 0 } },
  1038. { INT2PRI39, 0, 32, 8, { 0, 0, 0, WDT4B } },
  1039. { INT2PRI40, 0, 32, 8, { 0, 0, 0, DMINT17 } },
  1040. { INT2PRI41, 0, 32, 8, { DDRECC, 0, WDT6B, WDT5B } },
  1041. { INT2PRI42, 0, 32, 8, { 0, 0, 0, LPC8 } },
  1042. { INT2PRI43, 0, 32, 8, { 0, WDT7B, PCIE_BRIDGE, WDT8B } },
  1043. { INT2PRI44, 0, 32, 8, { WDT2B, GETHER2, 0, 0 } },
  1044. { INT2PRI45, 0, 32, 8, { 0, 0, LPC5, SERMUX3 } },
  1045. { INT2PRI46, 0, 32, 8, { WDT0B, WDT1B, WDT3B, GETHER0 } },
  1046. { INT2PRI47, 0, 32, 8, { DMINT12, DMINT13, DMINT14, DMINT15 } },
  1047. };
  1048. static struct intc_sense_reg sense_registers_irq8to15[] __initdata = {
  1049. { 0xffd100f8, 32, 2, /* ICR2 */ { IRQ15, IRQ14, IRQ13, IRQ12,
  1050. IRQ11, IRQ10, IRQ9, IRQ8 } },
  1051. };
  1052. static DECLARE_INTC_DESC(intc_desc, "sh7757", vectors, groups,
  1053. mask_registers, prio_registers,
  1054. sense_registers_irq8to15);
  1055. /* Support for external interrupt pins in IRQ mode */
  1056. static struct intc_vect vectors_irq0123[] __initdata = {
  1057. INTC_VECT(IRQ0, 0x200), INTC_VECT(IRQ1, 0x240),
  1058. INTC_VECT(IRQ2, 0x280), INTC_VECT(IRQ3, 0x2c0),
  1059. };
  1060. static struct intc_vect vectors_irq4567[] __initdata = {
  1061. INTC_VECT(IRQ4, 0x300), INTC_VECT(IRQ5, 0x340),
  1062. INTC_VECT(IRQ6, 0x380), INTC_VECT(IRQ7, 0x3c0),
  1063. };
  1064. static struct intc_sense_reg sense_registers[] __initdata = {
  1065. { 0xffd0001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3,
  1066. IRQ4, IRQ5, IRQ6, IRQ7 } },
  1067. };
  1068. static struct intc_mask_reg ack_registers[] __initdata = {
  1069. { 0xffd00024, 0, 32, /* INTREQ */
  1070. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  1071. };
  1072. static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh7757-irq0123",
  1073. vectors_irq0123, NULL, mask_registers,
  1074. prio_registers, sense_registers, ack_registers);
  1075. static DECLARE_INTC_DESC_ACK(intc_desc_irq4567, "sh7757-irq4567",
  1076. vectors_irq4567, NULL, mask_registers,
  1077. prio_registers, sense_registers, ack_registers);
  1078. /* External interrupt pins in IRL mode */
  1079. static struct intc_vect vectors_irl0123[] __initdata = {
  1080. INTC_VECT(IRL0_LLLL, 0x200), INTC_VECT(IRL0_LLLH, 0x220),
  1081. INTC_VECT(IRL0_LLHL, 0x240), INTC_VECT(IRL0_LLHH, 0x260),
  1082. INTC_VECT(IRL0_LHLL, 0x280), INTC_VECT(IRL0_LHLH, 0x2a0),
  1083. INTC_VECT(IRL0_LHHL, 0x2c0), INTC_VECT(IRL0_LHHH, 0x2e0),
  1084. INTC_VECT(IRL0_HLLL, 0x300), INTC_VECT(IRL0_HLLH, 0x320),
  1085. INTC_VECT(IRL0_HLHL, 0x340), INTC_VECT(IRL0_HLHH, 0x360),
  1086. INTC_VECT(IRL0_HHLL, 0x380), INTC_VECT(IRL0_HHLH, 0x3a0),
  1087. INTC_VECT(IRL0_HHHL, 0x3c0),
  1088. };
  1089. static struct intc_vect vectors_irl4567[] __initdata = {
  1090. INTC_VECT(IRL4_LLLL, 0x200), INTC_VECT(IRL4_LLLH, 0x220),
  1091. INTC_VECT(IRL4_LLHL, 0x240), INTC_VECT(IRL4_LLHH, 0x260),
  1092. INTC_VECT(IRL4_LHLL, 0x280), INTC_VECT(IRL4_LHLH, 0x2a0),
  1093. INTC_VECT(IRL4_LHHL, 0x2c0), INTC_VECT(IRL4_LHHH, 0x2e0),
  1094. INTC_VECT(IRL4_HLLL, 0x300), INTC_VECT(IRL4_HLLH, 0x320),
  1095. INTC_VECT(IRL4_HLHL, 0x340), INTC_VECT(IRL4_HLHH, 0x360),
  1096. INTC_VECT(IRL4_HHLL, 0x380), INTC_VECT(IRL4_HHLH, 0x3a0),
  1097. INTC_VECT(IRL4_HHHL, 0x3c0),
  1098. };
  1099. static DECLARE_INTC_DESC(intc_desc_irl0123, "sh7757-irl0123", vectors_irl0123,
  1100. NULL, mask_registers, NULL, NULL);
  1101. static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7757-irl4567", vectors_irl4567,
  1102. NULL, mask_registers, NULL, NULL);
  1103. #define INTC_ICR0 0xffd00000
  1104. #define INTC_INTMSK0 0xffd00044
  1105. #define INTC_INTMSK1 0xffd00048
  1106. #define INTC_INTMSK2 0xffd40080
  1107. #define INTC_INTMSKCLR1 0xffd00068
  1108. #define INTC_INTMSKCLR2 0xffd40084
  1109. void __init plat_irq_setup(void)
  1110. {
  1111. /* disable IRQ3-0 + IRQ7-4 */
  1112. __raw_writel(0xff000000, INTC_INTMSK0);
  1113. /* disable IRL3-0 + IRL7-4 */
  1114. __raw_writel(0xc0000000, INTC_INTMSK1);
  1115. __raw_writel(0xfffefffe, INTC_INTMSK2);
  1116. /* select IRL mode for IRL3-0 + IRL7-4 */
  1117. __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
  1118. /* disable holding function, ie enable "SH-4 Mode" */
  1119. __raw_writel(__raw_readl(INTC_ICR0) | 0x00200000, INTC_ICR0);
  1120. register_intc_controller(&intc_desc);
  1121. }
  1122. void __init plat_irq_setup_pins(int mode)
  1123. {
  1124. switch (mode) {
  1125. case IRQ_MODE_IRQ7654:
  1126. /* select IRQ mode for IRL7-4 */
  1127. __raw_writel(__raw_readl(INTC_ICR0) | 0x00400000, INTC_ICR0);
  1128. register_intc_controller(&intc_desc_irq4567);
  1129. break;
  1130. case IRQ_MODE_IRQ3210:
  1131. /* select IRQ mode for IRL3-0 */
  1132. __raw_writel(__raw_readl(INTC_ICR0) | 0x00800000, INTC_ICR0);
  1133. register_intc_controller(&intc_desc_irq0123);
  1134. break;
  1135. case IRQ_MODE_IRL7654:
  1136. /* enable IRL7-4 but don't provide any masking */
  1137. __raw_writel(0x40000000, INTC_INTMSKCLR1);
  1138. __raw_writel(0x0000fffe, INTC_INTMSKCLR2);
  1139. break;
  1140. case IRQ_MODE_IRL3210:
  1141. /* enable IRL0-3 but don't provide any masking */
  1142. __raw_writel(0x80000000, INTC_INTMSKCLR1);
  1143. __raw_writel(0xfffe0000, INTC_INTMSKCLR2);
  1144. break;
  1145. case IRQ_MODE_IRL7654_MASK:
  1146. /* enable IRL7-4 and mask using cpu intc controller */
  1147. __raw_writel(0x40000000, INTC_INTMSKCLR1);
  1148. register_intc_controller(&intc_desc_irl4567);
  1149. break;
  1150. case IRQ_MODE_IRL3210_MASK:
  1151. /* enable IRL0-3 and mask using cpu intc controller */
  1152. __raw_writel(0x80000000, INTC_INTMSKCLR1);
  1153. register_intc_controller(&intc_desc_irl0123);
  1154. break;
  1155. default:
  1156. BUG();
  1157. }
  1158. }
  1159. void __init plat_mem_setup(void)
  1160. {
  1161. }