setup-sh73a0.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. /*
  2. * sh73a0 processor support
  3. *
  4. * Copyright (C) 2010 Takashi Yoshii
  5. * Copyright (C) 2010 Magnus Damm
  6. * Copyright (C) 2008 Yoshihiro Shimoda
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include <linux/kernel.h>
  22. #include <linux/init.h>
  23. #include <linux/interrupt.h>
  24. #include <linux/irq.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/delay.h>
  27. #include <linux/input.h>
  28. #include <linux/io.h>
  29. #include <linux/serial_sci.h>
  30. #include <linux/sh_dma.h>
  31. #include <linux/sh_intc.h>
  32. #include <linux/sh_timer.h>
  33. #include <mach/hardware.h>
  34. #include <mach/irqs.h>
  35. #include <mach/sh73a0.h>
  36. #include <mach/common.h>
  37. #include <asm/mach-types.h>
  38. #include <asm/mach/map.h>
  39. #include <asm/mach/arch.h>
  40. #include <asm/mach/time.h>
  41. static struct map_desc sh73a0_io_desc[] __initdata = {
  42. /* create a 1:1 entity map for 0xe6xxxxxx
  43. * used by CPGA, INTC and PFC.
  44. */
  45. {
  46. .virtual = 0xe6000000,
  47. .pfn = __phys_to_pfn(0xe6000000),
  48. .length = 256 << 20,
  49. .type = MT_DEVICE_NONSHARED
  50. },
  51. };
  52. void __init sh73a0_map_io(void)
  53. {
  54. iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
  55. }
  56. static struct plat_sci_port scif0_platform_data = {
  57. .mapbase = 0xe6c40000,
  58. .flags = UPF_BOOT_AUTOCONF,
  59. .scscr = SCSCR_RE | SCSCR_TE,
  60. .scbrr_algo_id = SCBRR_ALGO_4,
  61. .type = PORT_SCIFA,
  62. .irqs = { gic_spi(72), gic_spi(72),
  63. gic_spi(72), gic_spi(72) },
  64. };
  65. static struct platform_device scif0_device = {
  66. .name = "sh-sci",
  67. .id = 0,
  68. .dev = {
  69. .platform_data = &scif0_platform_data,
  70. },
  71. };
  72. static struct plat_sci_port scif1_platform_data = {
  73. .mapbase = 0xe6c50000,
  74. .flags = UPF_BOOT_AUTOCONF,
  75. .scscr = SCSCR_RE | SCSCR_TE,
  76. .scbrr_algo_id = SCBRR_ALGO_4,
  77. .type = PORT_SCIFA,
  78. .irqs = { gic_spi(73), gic_spi(73),
  79. gic_spi(73), gic_spi(73) },
  80. };
  81. static struct platform_device scif1_device = {
  82. .name = "sh-sci",
  83. .id = 1,
  84. .dev = {
  85. .platform_data = &scif1_platform_data,
  86. },
  87. };
  88. static struct plat_sci_port scif2_platform_data = {
  89. .mapbase = 0xe6c60000,
  90. .flags = UPF_BOOT_AUTOCONF,
  91. .scscr = SCSCR_RE | SCSCR_TE,
  92. .scbrr_algo_id = SCBRR_ALGO_4,
  93. .type = PORT_SCIFA,
  94. .irqs = { gic_spi(74), gic_spi(74),
  95. gic_spi(74), gic_spi(74) },
  96. };
  97. static struct platform_device scif2_device = {
  98. .name = "sh-sci",
  99. .id = 2,
  100. .dev = {
  101. .platform_data = &scif2_platform_data,
  102. },
  103. };
  104. static struct plat_sci_port scif3_platform_data = {
  105. .mapbase = 0xe6c70000,
  106. .flags = UPF_BOOT_AUTOCONF,
  107. .scscr = SCSCR_RE | SCSCR_TE,
  108. .scbrr_algo_id = SCBRR_ALGO_4,
  109. .type = PORT_SCIFA,
  110. .irqs = { gic_spi(75), gic_spi(75),
  111. gic_spi(75), gic_spi(75) },
  112. };
  113. static struct platform_device scif3_device = {
  114. .name = "sh-sci",
  115. .id = 3,
  116. .dev = {
  117. .platform_data = &scif3_platform_data,
  118. },
  119. };
  120. static struct plat_sci_port scif4_platform_data = {
  121. .mapbase = 0xe6c80000,
  122. .flags = UPF_BOOT_AUTOCONF,
  123. .scscr = SCSCR_RE | SCSCR_TE,
  124. .scbrr_algo_id = SCBRR_ALGO_4,
  125. .type = PORT_SCIFA,
  126. .irqs = { gic_spi(78), gic_spi(78),
  127. gic_spi(78), gic_spi(78) },
  128. };
  129. static struct platform_device scif4_device = {
  130. .name = "sh-sci",
  131. .id = 4,
  132. .dev = {
  133. .platform_data = &scif4_platform_data,
  134. },
  135. };
  136. static struct plat_sci_port scif5_platform_data = {
  137. .mapbase = 0xe6cb0000,
  138. .flags = UPF_BOOT_AUTOCONF,
  139. .scscr = SCSCR_RE | SCSCR_TE,
  140. .scbrr_algo_id = SCBRR_ALGO_4,
  141. .type = PORT_SCIFA,
  142. .irqs = { gic_spi(79), gic_spi(79),
  143. gic_spi(79), gic_spi(79) },
  144. };
  145. static struct platform_device scif5_device = {
  146. .name = "sh-sci",
  147. .id = 5,
  148. .dev = {
  149. .platform_data = &scif5_platform_data,
  150. },
  151. };
  152. static struct plat_sci_port scif6_platform_data = {
  153. .mapbase = 0xe6cc0000,
  154. .flags = UPF_BOOT_AUTOCONF,
  155. .scscr = SCSCR_RE | SCSCR_TE,
  156. .scbrr_algo_id = SCBRR_ALGO_4,
  157. .type = PORT_SCIFA,
  158. .irqs = { gic_spi(156), gic_spi(156),
  159. gic_spi(156), gic_spi(156) },
  160. };
  161. static struct platform_device scif6_device = {
  162. .name = "sh-sci",
  163. .id = 6,
  164. .dev = {
  165. .platform_data = &scif6_platform_data,
  166. },
  167. };
  168. static struct plat_sci_port scif7_platform_data = {
  169. .mapbase = 0xe6cd0000,
  170. .flags = UPF_BOOT_AUTOCONF,
  171. .scscr = SCSCR_RE | SCSCR_TE,
  172. .scbrr_algo_id = SCBRR_ALGO_4,
  173. .type = PORT_SCIFA,
  174. .irqs = { gic_spi(143), gic_spi(143),
  175. gic_spi(143), gic_spi(143) },
  176. };
  177. static struct platform_device scif7_device = {
  178. .name = "sh-sci",
  179. .id = 7,
  180. .dev = {
  181. .platform_data = &scif7_platform_data,
  182. },
  183. };
  184. static struct plat_sci_port scif8_platform_data = {
  185. .mapbase = 0xe6c30000,
  186. .flags = UPF_BOOT_AUTOCONF,
  187. .scscr = SCSCR_RE | SCSCR_TE,
  188. .scbrr_algo_id = SCBRR_ALGO_4,
  189. .type = PORT_SCIFB,
  190. .irqs = { gic_spi(80), gic_spi(80),
  191. gic_spi(80), gic_spi(80) },
  192. };
  193. static struct platform_device scif8_device = {
  194. .name = "sh-sci",
  195. .id = 8,
  196. .dev = {
  197. .platform_data = &scif8_platform_data,
  198. },
  199. };
  200. static struct sh_timer_config cmt10_platform_data = {
  201. .name = "CMT10",
  202. .channel_offset = 0x10,
  203. .timer_bit = 0,
  204. .clockevent_rating = 125,
  205. .clocksource_rating = 125,
  206. };
  207. static struct resource cmt10_resources[] = {
  208. [0] = {
  209. .name = "CMT10",
  210. .start = 0xe6138010,
  211. .end = 0xe613801b,
  212. .flags = IORESOURCE_MEM,
  213. },
  214. [1] = {
  215. .start = gic_spi(65),
  216. .flags = IORESOURCE_IRQ,
  217. },
  218. };
  219. static struct platform_device cmt10_device = {
  220. .name = "sh_cmt",
  221. .id = 10,
  222. .dev = {
  223. .platform_data = &cmt10_platform_data,
  224. },
  225. .resource = cmt10_resources,
  226. .num_resources = ARRAY_SIZE(cmt10_resources),
  227. };
  228. /* TMU */
  229. static struct sh_timer_config tmu00_platform_data = {
  230. .name = "TMU00",
  231. .channel_offset = 0x4,
  232. .timer_bit = 0,
  233. .clockevent_rating = 200,
  234. };
  235. static struct resource tmu00_resources[] = {
  236. [0] = {
  237. .name = "TMU00",
  238. .start = 0xfff60008,
  239. .end = 0xfff60013,
  240. .flags = IORESOURCE_MEM,
  241. },
  242. [1] = {
  243. .start = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */
  244. .flags = IORESOURCE_IRQ,
  245. },
  246. };
  247. static struct platform_device tmu00_device = {
  248. .name = "sh_tmu",
  249. .id = 0,
  250. .dev = {
  251. .platform_data = &tmu00_platform_data,
  252. },
  253. .resource = tmu00_resources,
  254. .num_resources = ARRAY_SIZE(tmu00_resources),
  255. };
  256. static struct sh_timer_config tmu01_platform_data = {
  257. .name = "TMU01",
  258. .channel_offset = 0x10,
  259. .timer_bit = 1,
  260. .clocksource_rating = 200,
  261. };
  262. static struct resource tmu01_resources[] = {
  263. [0] = {
  264. .name = "TMU01",
  265. .start = 0xfff60014,
  266. .end = 0xfff6001f,
  267. .flags = IORESOURCE_MEM,
  268. },
  269. [1] = {
  270. .start = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */
  271. .flags = IORESOURCE_IRQ,
  272. },
  273. };
  274. static struct platform_device tmu01_device = {
  275. .name = "sh_tmu",
  276. .id = 1,
  277. .dev = {
  278. .platform_data = &tmu01_platform_data,
  279. },
  280. .resource = tmu01_resources,
  281. .num_resources = ARRAY_SIZE(tmu01_resources),
  282. };
  283. static struct resource i2c0_resources[] = {
  284. [0] = {
  285. .name = "IIC0",
  286. .start = 0xe6820000,
  287. .end = 0xe6820425 - 1,
  288. .flags = IORESOURCE_MEM,
  289. },
  290. [1] = {
  291. .start = gic_spi(167),
  292. .end = gic_spi(170),
  293. .flags = IORESOURCE_IRQ,
  294. },
  295. };
  296. static struct resource i2c1_resources[] = {
  297. [0] = {
  298. .name = "IIC1",
  299. .start = 0xe6822000,
  300. .end = 0xe6822425 - 1,
  301. .flags = IORESOURCE_MEM,
  302. },
  303. [1] = {
  304. .start = gic_spi(51),
  305. .end = gic_spi(54),
  306. .flags = IORESOURCE_IRQ,
  307. },
  308. };
  309. static struct resource i2c2_resources[] = {
  310. [0] = {
  311. .name = "IIC2",
  312. .start = 0xe6824000,
  313. .end = 0xe6824425 - 1,
  314. .flags = IORESOURCE_MEM,
  315. },
  316. [1] = {
  317. .start = gic_spi(171),
  318. .end = gic_spi(174),
  319. .flags = IORESOURCE_IRQ,
  320. },
  321. };
  322. static struct resource i2c3_resources[] = {
  323. [0] = {
  324. .name = "IIC3",
  325. .start = 0xe6826000,
  326. .end = 0xe6826425 - 1,
  327. .flags = IORESOURCE_MEM,
  328. },
  329. [1] = {
  330. .start = gic_spi(183),
  331. .end = gic_spi(186),
  332. .flags = IORESOURCE_IRQ,
  333. },
  334. };
  335. static struct resource i2c4_resources[] = {
  336. [0] = {
  337. .name = "IIC4",
  338. .start = 0xe6828000,
  339. .end = 0xe6828425 - 1,
  340. .flags = IORESOURCE_MEM,
  341. },
  342. [1] = {
  343. .start = gic_spi(187),
  344. .end = gic_spi(190),
  345. .flags = IORESOURCE_IRQ,
  346. },
  347. };
  348. static struct platform_device i2c0_device = {
  349. .name = "i2c-sh_mobile",
  350. .id = 0,
  351. .resource = i2c0_resources,
  352. .num_resources = ARRAY_SIZE(i2c0_resources),
  353. };
  354. static struct platform_device i2c1_device = {
  355. .name = "i2c-sh_mobile",
  356. .id = 1,
  357. .resource = i2c1_resources,
  358. .num_resources = ARRAY_SIZE(i2c1_resources),
  359. };
  360. static struct platform_device i2c2_device = {
  361. .name = "i2c-sh_mobile",
  362. .id = 2,
  363. .resource = i2c2_resources,
  364. .num_resources = ARRAY_SIZE(i2c2_resources),
  365. };
  366. static struct platform_device i2c3_device = {
  367. .name = "i2c-sh_mobile",
  368. .id = 3,
  369. .resource = i2c3_resources,
  370. .num_resources = ARRAY_SIZE(i2c3_resources),
  371. };
  372. static struct platform_device i2c4_device = {
  373. .name = "i2c-sh_mobile",
  374. .id = 4,
  375. .resource = i2c4_resources,
  376. .num_resources = ARRAY_SIZE(i2c4_resources),
  377. };
  378. /* Transmit sizes and respective CHCR register values */
  379. enum {
  380. XMIT_SZ_8BIT = 0,
  381. XMIT_SZ_16BIT = 1,
  382. XMIT_SZ_32BIT = 2,
  383. XMIT_SZ_64BIT = 7,
  384. XMIT_SZ_128BIT = 3,
  385. XMIT_SZ_256BIT = 4,
  386. XMIT_SZ_512BIT = 5,
  387. };
  388. /* log2(size / 8) - used to calculate number of transfers */
  389. #define TS_SHIFT { \
  390. [XMIT_SZ_8BIT] = 0, \
  391. [XMIT_SZ_16BIT] = 1, \
  392. [XMIT_SZ_32BIT] = 2, \
  393. [XMIT_SZ_64BIT] = 3, \
  394. [XMIT_SZ_128BIT] = 4, \
  395. [XMIT_SZ_256BIT] = 5, \
  396. [XMIT_SZ_512BIT] = 6, \
  397. }
  398. #define TS_INDEX2VAL(i) ((((i) & 3) << 3) | (((i) & 0xc) << (20 - 2)))
  399. #define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL((xmit_sz)))
  400. #define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL((xmit_sz)))
  401. static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = {
  402. {
  403. .slave_id = SHDMA_SLAVE_SCIF0_TX,
  404. .addr = 0xe6c40020,
  405. .chcr = CHCR_TX(XMIT_SZ_8BIT),
  406. .mid_rid = 0x21,
  407. }, {
  408. .slave_id = SHDMA_SLAVE_SCIF0_RX,
  409. .addr = 0xe6c40024,
  410. .chcr = CHCR_RX(XMIT_SZ_8BIT),
  411. .mid_rid = 0x22,
  412. }, {
  413. .slave_id = SHDMA_SLAVE_SCIF1_TX,
  414. .addr = 0xe6c50020,
  415. .chcr = CHCR_TX(XMIT_SZ_8BIT),
  416. .mid_rid = 0x25,
  417. }, {
  418. .slave_id = SHDMA_SLAVE_SCIF1_RX,
  419. .addr = 0xe6c50024,
  420. .chcr = CHCR_RX(XMIT_SZ_8BIT),
  421. .mid_rid = 0x26,
  422. }, {
  423. .slave_id = SHDMA_SLAVE_SCIF2_TX,
  424. .addr = 0xe6c60020,
  425. .chcr = CHCR_TX(XMIT_SZ_8BIT),
  426. .mid_rid = 0x29,
  427. }, {
  428. .slave_id = SHDMA_SLAVE_SCIF2_RX,
  429. .addr = 0xe6c60024,
  430. .chcr = CHCR_RX(XMIT_SZ_8BIT),
  431. .mid_rid = 0x2a,
  432. }, {
  433. .slave_id = SHDMA_SLAVE_SCIF3_TX,
  434. .addr = 0xe6c70020,
  435. .chcr = CHCR_TX(XMIT_SZ_8BIT),
  436. .mid_rid = 0x2d,
  437. }, {
  438. .slave_id = SHDMA_SLAVE_SCIF3_RX,
  439. .addr = 0xe6c70024,
  440. .chcr = CHCR_RX(XMIT_SZ_8BIT),
  441. .mid_rid = 0x2e,
  442. }, {
  443. .slave_id = SHDMA_SLAVE_SCIF4_TX,
  444. .addr = 0xe6c80020,
  445. .chcr = CHCR_TX(XMIT_SZ_8BIT),
  446. .mid_rid = 0x39,
  447. }, {
  448. .slave_id = SHDMA_SLAVE_SCIF4_RX,
  449. .addr = 0xe6c80024,
  450. .chcr = CHCR_RX(XMIT_SZ_8BIT),
  451. .mid_rid = 0x3a,
  452. }, {
  453. .slave_id = SHDMA_SLAVE_SCIF5_TX,
  454. .addr = 0xe6cb0020,
  455. .chcr = CHCR_TX(XMIT_SZ_8BIT),
  456. .mid_rid = 0x35,
  457. }, {
  458. .slave_id = SHDMA_SLAVE_SCIF5_RX,
  459. .addr = 0xe6cb0024,
  460. .chcr = CHCR_RX(XMIT_SZ_8BIT),
  461. .mid_rid = 0x36,
  462. }, {
  463. .slave_id = SHDMA_SLAVE_SCIF6_TX,
  464. .addr = 0xe6cc0020,
  465. .chcr = CHCR_TX(XMIT_SZ_8BIT),
  466. .mid_rid = 0x1d,
  467. }, {
  468. .slave_id = SHDMA_SLAVE_SCIF6_RX,
  469. .addr = 0xe6cc0024,
  470. .chcr = CHCR_RX(XMIT_SZ_8BIT),
  471. .mid_rid = 0x1e,
  472. }, {
  473. .slave_id = SHDMA_SLAVE_SCIF7_TX,
  474. .addr = 0xe6cd0020,
  475. .chcr = CHCR_TX(XMIT_SZ_8BIT),
  476. .mid_rid = 0x19,
  477. }, {
  478. .slave_id = SHDMA_SLAVE_SCIF7_RX,
  479. .addr = 0xe6cd0024,
  480. .chcr = CHCR_RX(XMIT_SZ_8BIT),
  481. .mid_rid = 0x1a,
  482. }, {
  483. .slave_id = SHDMA_SLAVE_SCIF8_TX,
  484. .addr = 0xe6c30040,
  485. .chcr = CHCR_TX(XMIT_SZ_8BIT),
  486. .mid_rid = 0x3d,
  487. }, {
  488. .slave_id = SHDMA_SLAVE_SCIF8_RX,
  489. .addr = 0xe6c30060,
  490. .chcr = CHCR_RX(XMIT_SZ_8BIT),
  491. .mid_rid = 0x3e,
  492. }, {
  493. .slave_id = SHDMA_SLAVE_SDHI0_TX,
  494. .addr = 0xee100030,
  495. .chcr = CHCR_TX(XMIT_SZ_16BIT),
  496. .mid_rid = 0xc1,
  497. }, {
  498. .slave_id = SHDMA_SLAVE_SDHI0_RX,
  499. .addr = 0xee100030,
  500. .chcr = CHCR_RX(XMIT_SZ_16BIT),
  501. .mid_rid = 0xc2,
  502. }, {
  503. .slave_id = SHDMA_SLAVE_SDHI1_TX,
  504. .addr = 0xee120030,
  505. .chcr = CHCR_TX(XMIT_SZ_16BIT),
  506. .mid_rid = 0xc9,
  507. }, {
  508. .slave_id = SHDMA_SLAVE_SDHI1_RX,
  509. .addr = 0xee120030,
  510. .chcr = CHCR_RX(XMIT_SZ_16BIT),
  511. .mid_rid = 0xca,
  512. }, {
  513. .slave_id = SHDMA_SLAVE_SDHI2_TX,
  514. .addr = 0xee140030,
  515. .chcr = CHCR_TX(XMIT_SZ_16BIT),
  516. .mid_rid = 0xcd,
  517. }, {
  518. .slave_id = SHDMA_SLAVE_SDHI2_RX,
  519. .addr = 0xee140030,
  520. .chcr = CHCR_RX(XMIT_SZ_16BIT),
  521. .mid_rid = 0xce,
  522. }, {
  523. .slave_id = SHDMA_SLAVE_MMCIF_TX,
  524. .addr = 0xe6bd0034,
  525. .chcr = CHCR_TX(XMIT_SZ_32BIT),
  526. .mid_rid = 0xd1,
  527. }, {
  528. .slave_id = SHDMA_SLAVE_MMCIF_RX,
  529. .addr = 0xe6bd0034,
  530. .chcr = CHCR_RX(XMIT_SZ_32BIT),
  531. .mid_rid = 0xd2,
  532. },
  533. };
  534. #define DMAE_CHANNEL(_offset) \
  535. { \
  536. .offset = _offset - 0x20, \
  537. .dmars = _offset - 0x20 + 0x40, \
  538. }
  539. static const struct sh_dmae_channel sh73a0_dmae_channels[] = {
  540. DMAE_CHANNEL(0x8000),
  541. DMAE_CHANNEL(0x8080),
  542. DMAE_CHANNEL(0x8100),
  543. DMAE_CHANNEL(0x8180),
  544. DMAE_CHANNEL(0x8200),
  545. DMAE_CHANNEL(0x8280),
  546. DMAE_CHANNEL(0x8300),
  547. DMAE_CHANNEL(0x8380),
  548. DMAE_CHANNEL(0x8400),
  549. DMAE_CHANNEL(0x8480),
  550. DMAE_CHANNEL(0x8500),
  551. DMAE_CHANNEL(0x8580),
  552. DMAE_CHANNEL(0x8600),
  553. DMAE_CHANNEL(0x8680),
  554. DMAE_CHANNEL(0x8700),
  555. DMAE_CHANNEL(0x8780),
  556. DMAE_CHANNEL(0x8800),
  557. DMAE_CHANNEL(0x8880),
  558. DMAE_CHANNEL(0x8900),
  559. DMAE_CHANNEL(0x8980),
  560. };
  561. static const unsigned int ts_shift[] = TS_SHIFT;
  562. static struct sh_dmae_pdata sh73a0_dmae_platform_data = {
  563. .slave = sh73a0_dmae_slaves,
  564. .slave_num = ARRAY_SIZE(sh73a0_dmae_slaves),
  565. .channel = sh73a0_dmae_channels,
  566. .channel_num = ARRAY_SIZE(sh73a0_dmae_channels),
  567. .ts_low_shift = 3,
  568. .ts_low_mask = 0x18,
  569. .ts_high_shift = (20 - 2), /* 2 bits for shifted low TS */
  570. .ts_high_mask = 0x00300000,
  571. .ts_shift = ts_shift,
  572. .ts_shift_num = ARRAY_SIZE(ts_shift),
  573. .dmaor_init = DMAOR_DME,
  574. };
  575. static struct resource sh73a0_dmae_resources[] = {
  576. {
  577. /* Registers including DMAOR and channels including DMARSx */
  578. .start = 0xfe000020,
  579. .end = 0xfe008a00 - 1,
  580. .flags = IORESOURCE_MEM,
  581. },
  582. {
  583. .name = "error_irq",
  584. .start = gic_spi(129),
  585. .end = gic_spi(129),
  586. .flags = IORESOURCE_IRQ,
  587. },
  588. {
  589. /* IRQ for channels 0-19 */
  590. .start = gic_spi(109),
  591. .end = gic_spi(128),
  592. .flags = IORESOURCE_IRQ,
  593. },
  594. };
  595. static struct platform_device dma0_device = {
  596. .name = "sh-dma-engine",
  597. .id = 0,
  598. .resource = sh73a0_dmae_resources,
  599. .num_resources = ARRAY_SIZE(sh73a0_dmae_resources),
  600. .dev = {
  601. .platform_data = &sh73a0_dmae_platform_data,
  602. },
  603. };
  604. static struct platform_device *sh73a0_early_devices[] __initdata = {
  605. &scif0_device,
  606. &scif1_device,
  607. &scif2_device,
  608. &scif3_device,
  609. &scif4_device,
  610. &scif5_device,
  611. &scif6_device,
  612. &scif7_device,
  613. &scif8_device,
  614. &cmt10_device,
  615. &tmu00_device,
  616. &tmu01_device,
  617. };
  618. static struct platform_device *sh73a0_late_devices[] __initdata = {
  619. &i2c0_device,
  620. &i2c1_device,
  621. &i2c2_device,
  622. &i2c3_device,
  623. &i2c4_device,
  624. &dma0_device,
  625. };
  626. #define SRCR2 0xe61580b0
  627. void __init sh73a0_add_standard_devices(void)
  628. {
  629. /* Clear software reset bit on SY-DMAC module */
  630. __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2);
  631. platform_add_devices(sh73a0_early_devices,
  632. ARRAY_SIZE(sh73a0_early_devices));
  633. platform_add_devices(sh73a0_late_devices,
  634. ARRAY_SIZE(sh73a0_late_devices));
  635. }
  636. /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
  637. void __init __weak sh73a0_register_twd(void) { }
  638. static void __init sh73a0_earlytimer_init(void)
  639. {
  640. sh73a0_clock_init();
  641. shmobile_earlytimer_init();
  642. sh73a0_register_twd();
  643. }
  644. void __init sh73a0_add_early_devices(void)
  645. {
  646. early_platform_add_devices(sh73a0_early_devices,
  647. ARRAY_SIZE(sh73a0_early_devices));
  648. /* setup early console here as well */
  649. shmobile_setup_console();
  650. /* override timer setup with soc-specific code */
  651. shmobile_timer.init = sh73a0_earlytimer_init;
  652. }