setup-shx3.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. /*
  2. * SH-X3 Prototype Setup
  3. *
  4. * Copyright (C) 2007 - 2010 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/platform_device.h>
  11. #include <linux/init.h>
  12. #include <linux/serial.h>
  13. #include <linux/serial_sci.h>
  14. #include <linux/io.h>
  15. #include <linux/gpio.h>
  16. #include <linux/sh_timer.h>
  17. #include <linux/sh_intc.h>
  18. #include <cpu/shx3.h>
  19. #include <asm/mmzone.h>
  20. /*
  21. * This intentionally only registers SCIF ports 0, 1, and 3. SCIF 2
  22. * INTEVT values overlap with the FPU EXPEVT ones, requiring special
  23. * demuxing in the exception dispatch path.
  24. *
  25. * As this overlap is something that never should have made it in to
  26. * silicon in the first place, we just refuse to deal with the port at
  27. * all rather than adding infrastructure to hack around it.
  28. */
  29. static struct plat_sci_port scif0_platform_data = {
  30. .mapbase = 0xffc30000,
  31. .flags = UPF_BOOT_AUTOCONF,
  32. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  33. .scbrr_algo_id = SCBRR_ALGO_2,
  34. .type = PORT_SCIF,
  35. .irqs = { evt2irq(0x700),
  36. evt2irq(0x720),
  37. evt2irq(0x760),
  38. evt2irq(0x740) },
  39. };
  40. static struct platform_device scif0_device = {
  41. .name = "sh-sci",
  42. .id = 0,
  43. .dev = {
  44. .platform_data = &scif0_platform_data,
  45. },
  46. };
  47. static struct plat_sci_port scif1_platform_data = {
  48. .mapbase = 0xffc40000,
  49. .flags = UPF_BOOT_AUTOCONF,
  50. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  51. .scbrr_algo_id = SCBRR_ALGO_2,
  52. .type = PORT_SCIF,
  53. .irqs = { evt2irq(0x780),
  54. evt2irq(0x7a0),
  55. evt2irq(0x7e0),
  56. evt2irq(0x7c0) },
  57. };
  58. static struct platform_device scif1_device = {
  59. .name = "sh-sci",
  60. .id = 1,
  61. .dev = {
  62. .platform_data = &scif1_platform_data,
  63. },
  64. };
  65. static struct plat_sci_port scif2_platform_data = {
  66. .mapbase = 0xffc60000,
  67. .flags = UPF_BOOT_AUTOCONF,
  68. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  69. .scbrr_algo_id = SCBRR_ALGO_2,
  70. .type = PORT_SCIF,
  71. .irqs = { evt2irq(0x880),
  72. evt2irq(0x8a0),
  73. evt2irq(0x8e0),
  74. evt2irq(0x8c0) },
  75. };
  76. static struct platform_device scif2_device = {
  77. .name = "sh-sci",
  78. .id = 2,
  79. .dev = {
  80. .platform_data = &scif2_platform_data,
  81. },
  82. };
  83. static struct sh_timer_config tmu0_platform_data = {
  84. .channel_offset = 0x04,
  85. .timer_bit = 0,
  86. .clockevent_rating = 200,
  87. };
  88. static struct resource tmu0_resources[] = {
  89. [0] = {
  90. .start = 0xffc10008,
  91. .end = 0xffc10013,
  92. .flags = IORESOURCE_MEM,
  93. },
  94. [1] = {
  95. .start = evt2irq(0x400),
  96. .flags = IORESOURCE_IRQ,
  97. },
  98. };
  99. static struct platform_device tmu0_device = {
  100. .name = "sh_tmu",
  101. .id = 0,
  102. .dev = {
  103. .platform_data = &tmu0_platform_data,
  104. },
  105. .resource = tmu0_resources,
  106. .num_resources = ARRAY_SIZE(tmu0_resources),
  107. };
  108. static struct sh_timer_config tmu1_platform_data = {
  109. .channel_offset = 0x10,
  110. .timer_bit = 1,
  111. .clocksource_rating = 200,
  112. };
  113. static struct resource tmu1_resources[] = {
  114. [0] = {
  115. .start = 0xffc10014,
  116. .end = 0xffc1001f,
  117. .flags = IORESOURCE_MEM,
  118. },
  119. [1] = {
  120. .start = evt2irq(0x420),
  121. .flags = IORESOURCE_IRQ,
  122. },
  123. };
  124. static struct platform_device tmu1_device = {
  125. .name = "sh_tmu",
  126. .id = 1,
  127. .dev = {
  128. .platform_data = &tmu1_platform_data,
  129. },
  130. .resource = tmu1_resources,
  131. .num_resources = ARRAY_SIZE(tmu1_resources),
  132. };
  133. static struct sh_timer_config tmu2_platform_data = {
  134. .channel_offset = 0x1c,
  135. .timer_bit = 2,
  136. };
  137. static struct resource tmu2_resources[] = {
  138. [0] = {
  139. .start = 0xffc10020,
  140. .end = 0xffc1002f,
  141. .flags = IORESOURCE_MEM,
  142. },
  143. [1] = {
  144. .start = evt2irq(0x440),
  145. .flags = IORESOURCE_IRQ,
  146. },
  147. };
  148. static struct platform_device tmu2_device = {
  149. .name = "sh_tmu",
  150. .id = 2,
  151. .dev = {
  152. .platform_data = &tmu2_platform_data,
  153. },
  154. .resource = tmu2_resources,
  155. .num_resources = ARRAY_SIZE(tmu2_resources),
  156. };
  157. static struct sh_timer_config tmu3_platform_data = {
  158. .channel_offset = 0x04,
  159. .timer_bit = 0,
  160. };
  161. static struct resource tmu3_resources[] = {
  162. [0] = {
  163. .start = 0xffc20008,
  164. .end = 0xffc20013,
  165. .flags = IORESOURCE_MEM,
  166. },
  167. [1] = {
  168. .start = evt2irq(0x460),
  169. .flags = IORESOURCE_IRQ,
  170. },
  171. };
  172. static struct platform_device tmu3_device = {
  173. .name = "sh_tmu",
  174. .id = 3,
  175. .dev = {
  176. .platform_data = &tmu3_platform_data,
  177. },
  178. .resource = tmu3_resources,
  179. .num_resources = ARRAY_SIZE(tmu3_resources),
  180. };
  181. static struct sh_timer_config tmu4_platform_data = {
  182. .channel_offset = 0x10,
  183. .timer_bit = 1,
  184. };
  185. static struct resource tmu4_resources[] = {
  186. [0] = {
  187. .start = 0xffc20014,
  188. .end = 0xffc2001f,
  189. .flags = IORESOURCE_MEM,
  190. },
  191. [1] = {
  192. .start = evt2irq(0x480),
  193. .flags = IORESOURCE_IRQ,
  194. },
  195. };
  196. static struct platform_device tmu4_device = {
  197. .name = "sh_tmu",
  198. .id = 4,
  199. .dev = {
  200. .platform_data = &tmu4_platform_data,
  201. },
  202. .resource = tmu4_resources,
  203. .num_resources = ARRAY_SIZE(tmu4_resources),
  204. };
  205. static struct sh_timer_config tmu5_platform_data = {
  206. .channel_offset = 0x1c,
  207. .timer_bit = 2,
  208. };
  209. static struct resource tmu5_resources[] = {
  210. [0] = {
  211. .start = 0xffc20020,
  212. .end = 0xffc2002b,
  213. .flags = IORESOURCE_MEM,
  214. },
  215. [1] = {
  216. .start = evt2irq(0x4a0),
  217. .flags = IORESOURCE_IRQ,
  218. },
  219. };
  220. static struct platform_device tmu5_device = {
  221. .name = "sh_tmu",
  222. .id = 5,
  223. .dev = {
  224. .platform_data = &tmu5_platform_data,
  225. },
  226. .resource = tmu5_resources,
  227. .num_resources = ARRAY_SIZE(tmu5_resources),
  228. };
  229. static struct platform_device *shx3_early_devices[] __initdata = {
  230. &scif0_device,
  231. &scif1_device,
  232. &scif2_device,
  233. &tmu0_device,
  234. &tmu1_device,
  235. &tmu2_device,
  236. &tmu3_device,
  237. &tmu4_device,
  238. &tmu5_device,
  239. };
  240. static int __init shx3_devices_setup(void)
  241. {
  242. return platform_add_devices(shx3_early_devices,
  243. ARRAY_SIZE(shx3_early_devices));
  244. }
  245. arch_initcall(shx3_devices_setup);
  246. void __init plat_early_device_setup(void)
  247. {
  248. early_platform_add_devices(shx3_early_devices,
  249. ARRAY_SIZE(shx3_early_devices));
  250. }
  251. enum {
  252. UNUSED = 0,
  253. /* interrupt sources */
  254. IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
  255. IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
  256. IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
  257. IRL_HHLL, IRL_HHLH, IRL_HHHL,
  258. IRQ0, IRQ1, IRQ2, IRQ3,
  259. HUDII,
  260. TMU0, TMU1, TMU2, TMU3, TMU4, TMU5,
  261. PCII0, PCII1, PCII2, PCII3, PCII4,
  262. PCII5, PCII6, PCII7, PCII8, PCII9,
  263. SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI,
  264. SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI,
  265. SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI,
  266. SCIF3_ERI, SCIF3_RXI, SCIF3_BRI, SCIF3_TXI,
  267. DMAC0_DMINT0, DMAC0_DMINT1, DMAC0_DMINT2, DMAC0_DMINT3,
  268. DMAC0_DMINT4, DMAC0_DMINT5, DMAC0_DMAE,
  269. DU,
  270. DMAC1_DMINT6, DMAC1_DMINT7, DMAC1_DMINT8, DMAC1_DMINT9,
  271. DMAC1_DMINT10, DMAC1_DMINT11, DMAC1_DMAE,
  272. IIC, VIN0, VIN1, VCORE0, ATAPI,
  273. DTU0, DTU1, DTU2, DTU3,
  274. FE0, FE1,
  275. GPIO0, GPIO1, GPIO2, GPIO3,
  276. PAM, IRM,
  277. INTICI0, INTICI1, INTICI2, INTICI3,
  278. INTICI4, INTICI5, INTICI6, INTICI7,
  279. /* interrupt groups */
  280. IRL, PCII56789, SCIF0, SCIF1, SCIF2, SCIF3,
  281. DMAC0, DMAC1,
  282. };
  283. static struct intc_vect vectors[] __initdata = {
  284. INTC_VECT(HUDII, 0x3e0),
  285. INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
  286. INTC_VECT(TMU2, 0x440), INTC_VECT(TMU3, 0x460),
  287. INTC_VECT(TMU4, 0x480), INTC_VECT(TMU5, 0x4a0),
  288. INTC_VECT(PCII0, 0x500), INTC_VECT(PCII1, 0x520),
  289. INTC_VECT(PCII2, 0x540), INTC_VECT(PCII3, 0x560),
  290. INTC_VECT(PCII4, 0x580), INTC_VECT(PCII5, 0x5a0),
  291. INTC_VECT(PCII6, 0x5c0), INTC_VECT(PCII7, 0x5e0),
  292. INTC_VECT(PCII8, 0x600), INTC_VECT(PCII9, 0x620),
  293. INTC_VECT(SCIF0_ERI, 0x700), INTC_VECT(SCIF0_RXI, 0x720),
  294. INTC_VECT(SCIF0_BRI, 0x740), INTC_VECT(SCIF0_TXI, 0x760),
  295. INTC_VECT(SCIF1_ERI, 0x780), INTC_VECT(SCIF1_RXI, 0x7a0),
  296. INTC_VECT(SCIF1_BRI, 0x7c0), INTC_VECT(SCIF1_TXI, 0x7e0),
  297. INTC_VECT(SCIF3_ERI, 0x880), INTC_VECT(SCIF3_RXI, 0x8a0),
  298. INTC_VECT(SCIF3_BRI, 0x8c0), INTC_VECT(SCIF3_TXI, 0x8e0),
  299. INTC_VECT(DMAC0_DMINT0, 0x900), INTC_VECT(DMAC0_DMINT1, 0x920),
  300. INTC_VECT(DMAC0_DMINT2, 0x940), INTC_VECT(DMAC0_DMINT3, 0x960),
  301. INTC_VECT(DMAC0_DMINT4, 0x980), INTC_VECT(DMAC0_DMINT5, 0x9a0),
  302. INTC_VECT(DMAC0_DMAE, 0x9c0),
  303. INTC_VECT(DU, 0x9e0),
  304. INTC_VECT(DMAC1_DMINT6, 0xa00), INTC_VECT(DMAC1_DMINT7, 0xa20),
  305. INTC_VECT(DMAC1_DMINT8, 0xa40), INTC_VECT(DMAC1_DMINT9, 0xa60),
  306. INTC_VECT(DMAC1_DMINT10, 0xa80), INTC_VECT(DMAC1_DMINT11, 0xaa0),
  307. INTC_VECT(DMAC1_DMAE, 0xac0),
  308. INTC_VECT(IIC, 0xae0),
  309. INTC_VECT(VIN0, 0xb00), INTC_VECT(VIN1, 0xb20),
  310. INTC_VECT(VCORE0, 0xb00), INTC_VECT(ATAPI, 0xb60),
  311. INTC_VECT(DTU0, 0xc00), INTC_VECT(DTU0, 0xc20),
  312. INTC_VECT(DTU0, 0xc40),
  313. INTC_VECT(DTU1, 0xc60), INTC_VECT(DTU1, 0xc80),
  314. INTC_VECT(DTU1, 0xca0),
  315. INTC_VECT(DTU2, 0xcc0), INTC_VECT(DTU2, 0xce0),
  316. INTC_VECT(DTU2, 0xd00),
  317. INTC_VECT(DTU3, 0xd20), INTC_VECT(DTU3, 0xd40),
  318. INTC_VECT(DTU3, 0xd60),
  319. INTC_VECT(FE0, 0xe00), INTC_VECT(FE1, 0xe20),
  320. INTC_VECT(GPIO0, 0xe40), INTC_VECT(GPIO1, 0xe60),
  321. INTC_VECT(GPIO2, 0xe80), INTC_VECT(GPIO3, 0xea0),
  322. INTC_VECT(PAM, 0xec0), INTC_VECT(IRM, 0xee0),
  323. INTC_VECT(INTICI0, 0xf00), INTC_VECT(INTICI1, 0xf20),
  324. INTC_VECT(INTICI2, 0xf40), INTC_VECT(INTICI3, 0xf60),
  325. INTC_VECT(INTICI4, 0xf80), INTC_VECT(INTICI5, 0xfa0),
  326. INTC_VECT(INTICI6, 0xfc0), INTC_VECT(INTICI7, 0xfe0),
  327. };
  328. static struct intc_group groups[] __initdata = {
  329. INTC_GROUP(IRL, IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
  330. IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
  331. IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
  332. IRL_HHLL, IRL_HHLH, IRL_HHHL),
  333. INTC_GROUP(PCII56789, PCII5, PCII6, PCII7, PCII8, PCII9),
  334. INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI),
  335. INTC_GROUP(SCIF1, SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI),
  336. INTC_GROUP(SCIF3, SCIF3_ERI, SCIF3_RXI, SCIF3_BRI, SCIF3_TXI),
  337. INTC_GROUP(DMAC0, DMAC0_DMINT0, DMAC0_DMINT1, DMAC0_DMINT2,
  338. DMAC0_DMINT3, DMAC0_DMINT4, DMAC0_DMINT5, DMAC0_DMAE),
  339. INTC_GROUP(DMAC1, DMAC1_DMINT6, DMAC1_DMINT7, DMAC1_DMINT8,
  340. DMAC1_DMINT9, DMAC1_DMINT10, DMAC1_DMINT11),
  341. };
  342. #define INT2DISTCR0 0xfe4108a0
  343. #define INT2DISTCR1 0xfe4108a4
  344. #define INT2DISTCR2 0xfe4108a8
  345. static struct intc_mask_reg mask_registers[] __initdata = {
  346. { 0xfe410030, 0xfe410050, 32, /* CnINTMSK0 / CnINTMSKCLR0 */
  347. { IRQ0, IRQ1, IRQ2, IRQ3 } },
  348. { 0xfe410040, 0xfe410060, 32, /* CnINTMSK1 / CnINTMSKCLR1 */
  349. { IRL } },
  350. { 0xfe410820, 0xfe410850, 32, /* CnINT2MSK0 / CnINT2MSKCLR0 */
  351. { FE1, FE0, 0, ATAPI, VCORE0, VIN1, VIN0, IIC,
  352. DU, GPIO3, GPIO2, GPIO1, GPIO0, PAM, 0, 0,
  353. 0, 0, 0, 0, 0, 0, 0, 0, /* HUDI bits ignored */
  354. 0, TMU5, TMU4, TMU3, TMU2, TMU1, TMU0, 0, },
  355. INTC_SMP_BALANCING(INT2DISTCR0) },
  356. { 0xfe410830, 0xfe410860, 32, /* CnINT2MSK1 / CnINT2MSKCLR1 */
  357. { 0, 0, 0, 0, DTU3, DTU2, DTU1, DTU0, /* IRM bits ignored */
  358. PCII9, PCII8, PCII7, PCII6, PCII5, PCII4, PCII3, PCII2,
  359. PCII1, PCII0, DMAC1_DMAE, DMAC1_DMINT11,
  360. DMAC1_DMINT10, DMAC1_DMINT9, DMAC1_DMINT8, DMAC1_DMINT7,
  361. DMAC1_DMINT6, DMAC0_DMAE, DMAC0_DMINT5, DMAC0_DMINT4,
  362. DMAC0_DMINT3, DMAC0_DMINT2, DMAC0_DMINT1, DMAC0_DMINT0 },
  363. INTC_SMP_BALANCING(INT2DISTCR1) },
  364. { 0xfe410840, 0xfe410870, 32, /* CnINT2MSK2 / CnINT2MSKCLR2 */
  365. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  366. SCIF3_TXI, SCIF3_BRI, SCIF3_RXI, SCIF3_ERI,
  367. SCIF2_TXI, SCIF2_BRI, SCIF2_RXI, SCIF2_ERI,
  368. SCIF1_TXI, SCIF1_BRI, SCIF1_RXI, SCIF1_ERI,
  369. SCIF0_TXI, SCIF0_BRI, SCIF0_RXI, SCIF0_ERI },
  370. INTC_SMP_BALANCING(INT2DISTCR2) },
  371. };
  372. static struct intc_prio_reg prio_registers[] __initdata = {
  373. { 0xfe410010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
  374. { 0xfe410800, 0, 32, 4, /* INT2PRI0 */ { 0, HUDII, TMU5, TMU4,
  375. TMU3, TMU2, TMU1, TMU0 } },
  376. { 0xfe410804, 0, 32, 4, /* INT2PRI1 */ { DTU3, DTU2, DTU1, DTU0,
  377. SCIF3, SCIF2,
  378. SCIF1, SCIF0 } },
  379. { 0xfe410808, 0, 32, 4, /* INT2PRI2 */ { DMAC1, DMAC0,
  380. PCII56789, PCII4,
  381. PCII3, PCII2,
  382. PCII1, PCII0 } },
  383. { 0xfe41080c, 0, 32, 4, /* INT2PRI3 */ { FE1, FE0, ATAPI, VCORE0,
  384. VIN1, VIN0, IIC, DU} },
  385. { 0xfe410810, 0, 32, 4, /* INT2PRI4 */ { 0, 0, PAM, GPIO3,
  386. GPIO2, GPIO1, GPIO0, IRM } },
  387. { 0xfe410090, 0xfe4100a0, 32, 4, /* CnICIPRI / CnICIPRICLR */
  388. { INTICI7, INTICI6, INTICI5, INTICI4,
  389. INTICI3, INTICI2, INTICI1, INTICI0 }, INTC_SMP(4, 4) },
  390. };
  391. static DECLARE_INTC_DESC(intc_desc, "shx3", vectors, groups,
  392. mask_registers, prio_registers, NULL);
  393. /* Support for external interrupt pins in IRQ mode */
  394. static struct intc_vect vectors_irq[] __initdata = {
  395. INTC_VECT(IRQ0, 0x240), INTC_VECT(IRQ1, 0x280),
  396. INTC_VECT(IRQ2, 0x2c0), INTC_VECT(IRQ3, 0x300),
  397. };
  398. static struct intc_sense_reg sense_registers[] __initdata = {
  399. { 0xfe41001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
  400. };
  401. static DECLARE_INTC_DESC(intc_desc_irq, "shx3-irq", vectors_irq, groups,
  402. mask_registers, prio_registers, sense_registers);
  403. /* External interrupt pins in IRL mode */
  404. static struct intc_vect vectors_irl[] __initdata = {
  405. INTC_VECT(IRL_LLLL, 0x200), INTC_VECT(IRL_LLLH, 0x220),
  406. INTC_VECT(IRL_LLHL, 0x240), INTC_VECT(IRL_LLHH, 0x260),
  407. INTC_VECT(IRL_LHLL, 0x280), INTC_VECT(IRL_LHLH, 0x2a0),
  408. INTC_VECT(IRL_LHHL, 0x2c0), INTC_VECT(IRL_LHHH, 0x2e0),
  409. INTC_VECT(IRL_HLLL, 0x300), INTC_VECT(IRL_HLLH, 0x320),
  410. INTC_VECT(IRL_HLHL, 0x340), INTC_VECT(IRL_HLHH, 0x360),
  411. INTC_VECT(IRL_HHLL, 0x380), INTC_VECT(IRL_HHLH, 0x3a0),
  412. INTC_VECT(IRL_HHHL, 0x3c0),
  413. };
  414. static DECLARE_INTC_DESC(intc_desc_irl, "shx3-irl", vectors_irl, groups,
  415. mask_registers, prio_registers, NULL);
  416. void __init plat_irq_setup_pins(int mode)
  417. {
  418. int ret = 0;
  419. switch (mode) {
  420. case IRQ_MODE_IRQ:
  421. ret |= gpio_request(GPIO_FN_IRQ3, intc_desc_irq.name);
  422. ret |= gpio_request(GPIO_FN_IRQ2, intc_desc_irq.name);
  423. ret |= gpio_request(GPIO_FN_IRQ1, intc_desc_irq.name);
  424. ret |= gpio_request(GPIO_FN_IRQ0, intc_desc_irq.name);
  425. if (unlikely(ret)) {
  426. pr_err("Failed to set IRQ mode\n");
  427. return;
  428. }
  429. register_intc_controller(&intc_desc_irq);
  430. break;
  431. case IRQ_MODE_IRL3210:
  432. ret |= gpio_request(GPIO_FN_IRL3, intc_desc_irl.name);
  433. ret |= gpio_request(GPIO_FN_IRL2, intc_desc_irl.name);
  434. ret |= gpio_request(GPIO_FN_IRL1, intc_desc_irl.name);
  435. ret |= gpio_request(GPIO_FN_IRL0, intc_desc_irl.name);
  436. if (unlikely(ret)) {
  437. pr_err("Failed to set IRL mode\n");
  438. return;
  439. }
  440. register_intc_controller(&intc_desc_irl);
  441. break;
  442. default:
  443. BUG();
  444. }
  445. }
  446. void __init plat_irq_setup(void)
  447. {
  448. register_intc_controller(&intc_desc);
  449. }
  450. void __init plat_mem_setup(void)
  451. {
  452. unsigned int nid = 1;
  453. /* Register CPU#0 URAM space as Node 1 */
  454. setup_bootmem_node(nid++, 0x145f0000, 0x14610000); /* CPU0 */
  455. #if 0
  456. /* XXX: Not yet.. */
  457. setup_bootmem_node(nid++, 0x14df0000, 0x14e10000); /* CPU1 */
  458. setup_bootmem_node(nid++, 0x155f0000, 0x15610000); /* CPU2 */
  459. setup_bootmem_node(nid++, 0x15df0000, 0x15e10000); /* CPU3 */
  460. #endif
  461. setup_bootmem_node(nid++, 0x16000000, 0x16020000); /* CSM */
  462. }