setup-sh73a0.c 16 KB

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