setup-sh73a0.c 15 KB

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