common.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. /*
  2. * arch/arm/mach-dove/common.c
  3. *
  4. * Core functions for Marvell Dove 88AP510 System On Chip
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/delay.h>
  12. #include <linux/init.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/pci.h>
  15. #include <linux/serial_8250.h>
  16. #include <linux/clk.h>
  17. #include <linux/mbus.h>
  18. #include <linux/mv643xx_eth.h>
  19. #include <linux/mv643xx_i2c.h>
  20. #include <linux/ata_platform.h>
  21. #include <linux/spi/orion_spi.h>
  22. #include <linux/gpio.h>
  23. #include <asm/page.h>
  24. #include <asm/setup.h>
  25. #include <asm/timex.h>
  26. #include <asm/mach/map.h>
  27. #include <asm/mach/time.h>
  28. #include <asm/mach/pci.h>
  29. #include <mach/dove.h>
  30. #include <mach/bridge-regs.h>
  31. #include <asm/mach/arch.h>
  32. #include <linux/irq.h>
  33. #include <plat/mv_xor.h>
  34. #include <plat/ehci-orion.h>
  35. #include <plat/time.h>
  36. #include "common.h"
  37. /*****************************************************************************
  38. * I/O Address Mapping
  39. ****************************************************************************/
  40. static struct map_desc dove_io_desc[] __initdata = {
  41. {
  42. .virtual = DOVE_SB_REGS_VIRT_BASE,
  43. .pfn = __phys_to_pfn(DOVE_SB_REGS_PHYS_BASE),
  44. .length = DOVE_SB_REGS_SIZE,
  45. .type = MT_DEVICE,
  46. }, {
  47. .virtual = DOVE_NB_REGS_VIRT_BASE,
  48. .pfn = __phys_to_pfn(DOVE_NB_REGS_PHYS_BASE),
  49. .length = DOVE_NB_REGS_SIZE,
  50. .type = MT_DEVICE,
  51. }, {
  52. .virtual = DOVE_PCIE0_IO_VIRT_BASE,
  53. .pfn = __phys_to_pfn(DOVE_PCIE0_IO_PHYS_BASE),
  54. .length = DOVE_PCIE0_IO_SIZE,
  55. .type = MT_DEVICE,
  56. }, {
  57. .virtual = DOVE_PCIE1_IO_VIRT_BASE,
  58. .pfn = __phys_to_pfn(DOVE_PCIE1_IO_PHYS_BASE),
  59. .length = DOVE_PCIE1_IO_SIZE,
  60. .type = MT_DEVICE,
  61. },
  62. };
  63. void __init dove_map_io(void)
  64. {
  65. iotable_init(dove_io_desc, ARRAY_SIZE(dove_io_desc));
  66. }
  67. /*****************************************************************************
  68. * EHCI
  69. ****************************************************************************/
  70. static struct orion_ehci_data dove_ehci_data = {
  71. .dram = &dove_mbus_dram_info,
  72. .phy_version = EHCI_PHY_NA,
  73. };
  74. static u64 ehci_dmamask = DMA_BIT_MASK(32);
  75. /*****************************************************************************
  76. * EHCI0
  77. ****************************************************************************/
  78. static struct resource dove_ehci0_resources[] = {
  79. {
  80. .start = DOVE_USB0_PHYS_BASE,
  81. .end = DOVE_USB0_PHYS_BASE + SZ_4K - 1,
  82. .flags = IORESOURCE_MEM,
  83. }, {
  84. .start = IRQ_DOVE_USB0,
  85. .end = IRQ_DOVE_USB0,
  86. .flags = IORESOURCE_IRQ,
  87. },
  88. };
  89. static struct platform_device dove_ehci0 = {
  90. .name = "orion-ehci",
  91. .id = 0,
  92. .dev = {
  93. .dma_mask = &ehci_dmamask,
  94. .coherent_dma_mask = DMA_BIT_MASK(32),
  95. .platform_data = &dove_ehci_data,
  96. },
  97. .resource = dove_ehci0_resources,
  98. .num_resources = ARRAY_SIZE(dove_ehci0_resources),
  99. };
  100. void __init dove_ehci0_init(void)
  101. {
  102. platform_device_register(&dove_ehci0);
  103. }
  104. /*****************************************************************************
  105. * EHCI1
  106. ****************************************************************************/
  107. static struct resource dove_ehci1_resources[] = {
  108. {
  109. .start = DOVE_USB1_PHYS_BASE,
  110. .end = DOVE_USB1_PHYS_BASE + SZ_4K - 1,
  111. .flags = IORESOURCE_MEM,
  112. }, {
  113. .start = IRQ_DOVE_USB1,
  114. .end = IRQ_DOVE_USB1,
  115. .flags = IORESOURCE_IRQ,
  116. },
  117. };
  118. static struct platform_device dove_ehci1 = {
  119. .name = "orion-ehci",
  120. .id = 1,
  121. .dev = {
  122. .dma_mask = &ehci_dmamask,
  123. .coherent_dma_mask = DMA_BIT_MASK(32),
  124. .platform_data = &dove_ehci_data,
  125. },
  126. .resource = dove_ehci1_resources,
  127. .num_resources = ARRAY_SIZE(dove_ehci1_resources),
  128. };
  129. void __init dove_ehci1_init(void)
  130. {
  131. platform_device_register(&dove_ehci1);
  132. }
  133. /*****************************************************************************
  134. * GE00
  135. ****************************************************************************/
  136. struct mv643xx_eth_shared_platform_data dove_ge00_shared_data = {
  137. .t_clk = 0,
  138. .dram = &dove_mbus_dram_info,
  139. };
  140. static struct resource dove_ge00_shared_resources[] = {
  141. {
  142. .name = "ge00 base",
  143. .start = DOVE_GE00_PHYS_BASE + 0x2000,
  144. .end = DOVE_GE00_PHYS_BASE + SZ_16K - 1,
  145. .flags = IORESOURCE_MEM,
  146. },
  147. };
  148. static struct platform_device dove_ge00_shared = {
  149. .name = MV643XX_ETH_SHARED_NAME,
  150. .id = 0,
  151. .dev = {
  152. .platform_data = &dove_ge00_shared_data,
  153. },
  154. .num_resources = 1,
  155. .resource = dove_ge00_shared_resources,
  156. };
  157. static struct resource dove_ge00_resources[] = {
  158. {
  159. .name = "ge00 irq",
  160. .start = IRQ_DOVE_GE00_SUM,
  161. .end = IRQ_DOVE_GE00_SUM,
  162. .flags = IORESOURCE_IRQ,
  163. },
  164. };
  165. static struct platform_device dove_ge00 = {
  166. .name = MV643XX_ETH_NAME,
  167. .id = 0,
  168. .num_resources = 1,
  169. .resource = dove_ge00_resources,
  170. .dev = {
  171. .coherent_dma_mask = 0xffffffff,
  172. },
  173. };
  174. void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
  175. {
  176. eth_data->shared = &dove_ge00_shared;
  177. dove_ge00.dev.platform_data = eth_data;
  178. platform_device_register(&dove_ge00_shared);
  179. platform_device_register(&dove_ge00);
  180. }
  181. /*****************************************************************************
  182. * SoC RTC
  183. ****************************************************************************/
  184. static struct resource dove_rtc_resource[] = {
  185. {
  186. .start = DOVE_RTC_PHYS_BASE,
  187. .end = DOVE_RTC_PHYS_BASE + 32 - 1,
  188. .flags = IORESOURCE_MEM,
  189. }, {
  190. .start = IRQ_DOVE_RTC,
  191. .flags = IORESOURCE_IRQ,
  192. }
  193. };
  194. void __init dove_rtc_init(void)
  195. {
  196. platform_device_register_simple("rtc-mv", -1, dove_rtc_resource, 2);
  197. }
  198. /*****************************************************************************
  199. * SATA
  200. ****************************************************************************/
  201. static struct resource dove_sata_resources[] = {
  202. {
  203. .name = "sata base",
  204. .start = DOVE_SATA_PHYS_BASE,
  205. .end = DOVE_SATA_PHYS_BASE + 0x5000 - 1,
  206. .flags = IORESOURCE_MEM,
  207. }, {
  208. .name = "sata irq",
  209. .start = IRQ_DOVE_SATA,
  210. .end = IRQ_DOVE_SATA,
  211. .flags = IORESOURCE_IRQ,
  212. },
  213. };
  214. static struct platform_device dove_sata = {
  215. .name = "sata_mv",
  216. .id = 0,
  217. .dev = {
  218. .coherent_dma_mask = DMA_BIT_MASK(32),
  219. },
  220. .num_resources = ARRAY_SIZE(dove_sata_resources),
  221. .resource = dove_sata_resources,
  222. };
  223. void __init dove_sata_init(struct mv_sata_platform_data *sata_data)
  224. {
  225. sata_data->dram = &dove_mbus_dram_info;
  226. dove_sata.dev.platform_data = sata_data;
  227. platform_device_register(&dove_sata);
  228. }
  229. /*****************************************************************************
  230. * UART0
  231. ****************************************************************************/
  232. static struct plat_serial8250_port dove_uart0_data[] = {
  233. {
  234. .mapbase = DOVE_UART0_PHYS_BASE,
  235. .membase = (char *)DOVE_UART0_VIRT_BASE,
  236. .irq = IRQ_DOVE_UART_0,
  237. .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
  238. .iotype = UPIO_MEM,
  239. .regshift = 2,
  240. .uartclk = 0,
  241. }, {
  242. },
  243. };
  244. static struct resource dove_uart0_resources[] = {
  245. {
  246. .start = DOVE_UART0_PHYS_BASE,
  247. .end = DOVE_UART0_PHYS_BASE + SZ_256 - 1,
  248. .flags = IORESOURCE_MEM,
  249. }, {
  250. .start = IRQ_DOVE_UART_0,
  251. .end = IRQ_DOVE_UART_0,
  252. .flags = IORESOURCE_IRQ,
  253. },
  254. };
  255. static struct platform_device dove_uart0 = {
  256. .name = "serial8250",
  257. .id = 0,
  258. .dev = {
  259. .platform_data = dove_uart0_data,
  260. },
  261. .resource = dove_uart0_resources,
  262. .num_resources = ARRAY_SIZE(dove_uart0_resources),
  263. };
  264. void __init dove_uart0_init(void)
  265. {
  266. platform_device_register(&dove_uart0);
  267. }
  268. /*****************************************************************************
  269. * UART1
  270. ****************************************************************************/
  271. static struct plat_serial8250_port dove_uart1_data[] = {
  272. {
  273. .mapbase = DOVE_UART1_PHYS_BASE,
  274. .membase = (char *)DOVE_UART1_VIRT_BASE,
  275. .irq = IRQ_DOVE_UART_1,
  276. .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
  277. .iotype = UPIO_MEM,
  278. .regshift = 2,
  279. .uartclk = 0,
  280. }, {
  281. },
  282. };
  283. static struct resource dove_uart1_resources[] = {
  284. {
  285. .start = DOVE_UART1_PHYS_BASE,
  286. .end = DOVE_UART1_PHYS_BASE + SZ_256 - 1,
  287. .flags = IORESOURCE_MEM,
  288. }, {
  289. .start = IRQ_DOVE_UART_1,
  290. .end = IRQ_DOVE_UART_1,
  291. .flags = IORESOURCE_IRQ,
  292. },
  293. };
  294. static struct platform_device dove_uart1 = {
  295. .name = "serial8250",
  296. .id = 1,
  297. .dev = {
  298. .platform_data = dove_uart1_data,
  299. },
  300. .resource = dove_uart1_resources,
  301. .num_resources = ARRAY_SIZE(dove_uart1_resources),
  302. };
  303. void __init dove_uart1_init(void)
  304. {
  305. platform_device_register(&dove_uart1);
  306. }
  307. /*****************************************************************************
  308. * UART2
  309. ****************************************************************************/
  310. static struct plat_serial8250_port dove_uart2_data[] = {
  311. {
  312. .mapbase = DOVE_UART2_PHYS_BASE,
  313. .membase = (char *)DOVE_UART2_VIRT_BASE,
  314. .irq = IRQ_DOVE_UART_2,
  315. .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
  316. .iotype = UPIO_MEM,
  317. .regshift = 2,
  318. .uartclk = 0,
  319. }, {
  320. },
  321. };
  322. static struct resource dove_uart2_resources[] = {
  323. {
  324. .start = DOVE_UART2_PHYS_BASE,
  325. .end = DOVE_UART2_PHYS_BASE + SZ_256 - 1,
  326. .flags = IORESOURCE_MEM,
  327. }, {
  328. .start = IRQ_DOVE_UART_2,
  329. .end = IRQ_DOVE_UART_2,
  330. .flags = IORESOURCE_IRQ,
  331. },
  332. };
  333. static struct platform_device dove_uart2 = {
  334. .name = "serial8250",
  335. .id = 2,
  336. .dev = {
  337. .platform_data = dove_uart2_data,
  338. },
  339. .resource = dove_uart2_resources,
  340. .num_resources = ARRAY_SIZE(dove_uart2_resources),
  341. };
  342. void __init dove_uart2_init(void)
  343. {
  344. platform_device_register(&dove_uart2);
  345. }
  346. /*****************************************************************************
  347. * UART3
  348. ****************************************************************************/
  349. static struct plat_serial8250_port dove_uart3_data[] = {
  350. {
  351. .mapbase = DOVE_UART3_PHYS_BASE,
  352. .membase = (char *)DOVE_UART3_VIRT_BASE,
  353. .irq = IRQ_DOVE_UART_3,
  354. .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
  355. .iotype = UPIO_MEM,
  356. .regshift = 2,
  357. .uartclk = 0,
  358. }, {
  359. },
  360. };
  361. static struct resource dove_uart3_resources[] = {
  362. {
  363. .start = DOVE_UART3_PHYS_BASE,
  364. .end = DOVE_UART3_PHYS_BASE + SZ_256 - 1,
  365. .flags = IORESOURCE_MEM,
  366. }, {
  367. .start = IRQ_DOVE_UART_3,
  368. .end = IRQ_DOVE_UART_3,
  369. .flags = IORESOURCE_IRQ,
  370. },
  371. };
  372. static struct platform_device dove_uart3 = {
  373. .name = "serial8250",
  374. .id = 3,
  375. .dev = {
  376. .platform_data = dove_uart3_data,
  377. },
  378. .resource = dove_uart3_resources,
  379. .num_resources = ARRAY_SIZE(dove_uart3_resources),
  380. };
  381. void __init dove_uart3_init(void)
  382. {
  383. platform_device_register(&dove_uart3);
  384. }
  385. /*****************************************************************************
  386. * SPI0
  387. ****************************************************************************/
  388. static struct orion_spi_info dove_spi0_data = {
  389. .tclk = 0,
  390. };
  391. static struct resource dove_spi0_resources[] = {
  392. {
  393. .start = DOVE_SPI0_PHYS_BASE,
  394. .end = DOVE_SPI0_PHYS_BASE + SZ_512 - 1,
  395. .flags = IORESOURCE_MEM,
  396. }, {
  397. .start = IRQ_DOVE_SPI0,
  398. .end = IRQ_DOVE_SPI0,
  399. .flags = IORESOURCE_IRQ,
  400. },
  401. };
  402. static struct platform_device dove_spi0 = {
  403. .name = "orion_spi",
  404. .id = 0,
  405. .resource = dove_spi0_resources,
  406. .dev = {
  407. .platform_data = &dove_spi0_data,
  408. },
  409. .num_resources = ARRAY_SIZE(dove_spi0_resources),
  410. };
  411. void __init dove_spi0_init(void)
  412. {
  413. platform_device_register(&dove_spi0);
  414. }
  415. /*****************************************************************************
  416. * SPI1
  417. ****************************************************************************/
  418. static struct orion_spi_info dove_spi1_data = {
  419. .tclk = 0,
  420. };
  421. static struct resource dove_spi1_resources[] = {
  422. {
  423. .start = DOVE_SPI1_PHYS_BASE,
  424. .end = DOVE_SPI1_PHYS_BASE + SZ_512 - 1,
  425. .flags = IORESOURCE_MEM,
  426. }, {
  427. .start = IRQ_DOVE_SPI1,
  428. .end = IRQ_DOVE_SPI1,
  429. .flags = IORESOURCE_IRQ,
  430. },
  431. };
  432. static struct platform_device dove_spi1 = {
  433. .name = "orion_spi",
  434. .id = 1,
  435. .resource = dove_spi1_resources,
  436. .dev = {
  437. .platform_data = &dove_spi1_data,
  438. },
  439. .num_resources = ARRAY_SIZE(dove_spi1_resources),
  440. };
  441. void __init dove_spi1_init(void)
  442. {
  443. platform_device_register(&dove_spi1);
  444. }
  445. /*****************************************************************************
  446. * I2C
  447. ****************************************************************************/
  448. static struct mv64xxx_i2c_pdata dove_i2c_data = {
  449. .freq_m = 10, /* assumes 166 MHz TCLK gets 94.3kHz */
  450. .freq_n = 3,
  451. .timeout = 1000, /* Default timeout of 1 second */
  452. };
  453. static struct resource dove_i2c_resources[] = {
  454. {
  455. .name = "i2c base",
  456. .start = DOVE_I2C_PHYS_BASE,
  457. .end = DOVE_I2C_PHYS_BASE + 0x20 - 1,
  458. .flags = IORESOURCE_MEM,
  459. }, {
  460. .name = "i2c irq",
  461. .start = IRQ_DOVE_I2C,
  462. .end = IRQ_DOVE_I2C,
  463. .flags = IORESOURCE_IRQ,
  464. },
  465. };
  466. static struct platform_device dove_i2c = {
  467. .name = MV64XXX_I2C_CTLR_NAME,
  468. .id = 0,
  469. .num_resources = ARRAY_SIZE(dove_i2c_resources),
  470. .resource = dove_i2c_resources,
  471. .dev = {
  472. .platform_data = &dove_i2c_data,
  473. },
  474. };
  475. void __init dove_i2c_init(void)
  476. {
  477. platform_device_register(&dove_i2c);
  478. }
  479. /*****************************************************************************
  480. * Time handling
  481. ****************************************************************************/
  482. static int get_tclk(void)
  483. {
  484. /* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
  485. return 166666667;
  486. }
  487. static void dove_timer_init(void)
  488. {
  489. orion_time_init(IRQ_DOVE_BRIDGE, get_tclk());
  490. }
  491. struct sys_timer dove_timer = {
  492. .init = dove_timer_init,
  493. };
  494. /*****************************************************************************
  495. * XOR
  496. ****************************************************************************/
  497. static struct mv_xor_platform_shared_data dove_xor_shared_data = {
  498. .dram = &dove_mbus_dram_info,
  499. };
  500. /*****************************************************************************
  501. * XOR 0
  502. ****************************************************************************/
  503. static u64 dove_xor0_dmamask = DMA_BIT_MASK(32);
  504. static struct resource dove_xor0_shared_resources[] = {
  505. {
  506. .name = "xor 0 low",
  507. .start = DOVE_XOR0_PHYS_BASE,
  508. .end = DOVE_XOR0_PHYS_BASE + 0xff,
  509. .flags = IORESOURCE_MEM,
  510. }, {
  511. .name = "xor 0 high",
  512. .start = DOVE_XOR0_HIGH_PHYS_BASE,
  513. .end = DOVE_XOR0_HIGH_PHYS_BASE + 0xff,
  514. .flags = IORESOURCE_MEM,
  515. },
  516. };
  517. static struct platform_device dove_xor0_shared = {
  518. .name = MV_XOR_SHARED_NAME,
  519. .id = 0,
  520. .dev = {
  521. .platform_data = &dove_xor_shared_data,
  522. },
  523. .num_resources = ARRAY_SIZE(dove_xor0_shared_resources),
  524. .resource = dove_xor0_shared_resources,
  525. };
  526. static struct resource dove_xor00_resources[] = {
  527. [0] = {
  528. .start = IRQ_DOVE_XOR_00,
  529. .end = IRQ_DOVE_XOR_00,
  530. .flags = IORESOURCE_IRQ,
  531. },
  532. };
  533. static struct mv_xor_platform_data dove_xor00_data = {
  534. .shared = &dove_xor0_shared,
  535. .hw_id = 0,
  536. .pool_size = PAGE_SIZE,
  537. };
  538. static struct platform_device dove_xor00_channel = {
  539. .name = MV_XOR_NAME,
  540. .id = 0,
  541. .num_resources = ARRAY_SIZE(dove_xor00_resources),
  542. .resource = dove_xor00_resources,
  543. .dev = {
  544. .dma_mask = &dove_xor0_dmamask,
  545. .coherent_dma_mask = DMA_BIT_MASK(64),
  546. .platform_data = (void *)&dove_xor00_data,
  547. },
  548. };
  549. static struct resource dove_xor01_resources[] = {
  550. [0] = {
  551. .start = IRQ_DOVE_XOR_01,
  552. .end = IRQ_DOVE_XOR_01,
  553. .flags = IORESOURCE_IRQ,
  554. },
  555. };
  556. static struct mv_xor_platform_data dove_xor01_data = {
  557. .shared = &dove_xor0_shared,
  558. .hw_id = 1,
  559. .pool_size = PAGE_SIZE,
  560. };
  561. static struct platform_device dove_xor01_channel = {
  562. .name = MV_XOR_NAME,
  563. .id = 1,
  564. .num_resources = ARRAY_SIZE(dove_xor01_resources),
  565. .resource = dove_xor01_resources,
  566. .dev = {
  567. .dma_mask = &dove_xor0_dmamask,
  568. .coherent_dma_mask = DMA_BIT_MASK(64),
  569. .platform_data = (void *)&dove_xor01_data,
  570. },
  571. };
  572. void __init dove_xor0_init(void)
  573. {
  574. platform_device_register(&dove_xor0_shared);
  575. /*
  576. * two engines can't do memset simultaneously, this limitation
  577. * satisfied by removing memset support from one of the engines.
  578. */
  579. dma_cap_set(DMA_MEMCPY, dove_xor00_data.cap_mask);
  580. dma_cap_set(DMA_XOR, dove_xor00_data.cap_mask);
  581. platform_device_register(&dove_xor00_channel);
  582. dma_cap_set(DMA_MEMCPY, dove_xor01_data.cap_mask);
  583. dma_cap_set(DMA_MEMSET, dove_xor01_data.cap_mask);
  584. dma_cap_set(DMA_XOR, dove_xor01_data.cap_mask);
  585. platform_device_register(&dove_xor01_channel);
  586. }
  587. /*****************************************************************************
  588. * XOR 1
  589. ****************************************************************************/
  590. static u64 dove_xor1_dmamask = DMA_BIT_MASK(32);
  591. static struct resource dove_xor1_shared_resources[] = {
  592. {
  593. .name = "xor 0 low",
  594. .start = DOVE_XOR1_PHYS_BASE,
  595. .end = DOVE_XOR1_PHYS_BASE + 0xff,
  596. .flags = IORESOURCE_MEM,
  597. }, {
  598. .name = "xor 0 high",
  599. .start = DOVE_XOR1_HIGH_PHYS_BASE,
  600. .end = DOVE_XOR1_HIGH_PHYS_BASE + 0xff,
  601. .flags = IORESOURCE_MEM,
  602. },
  603. };
  604. static struct platform_device dove_xor1_shared = {
  605. .name = MV_XOR_SHARED_NAME,
  606. .id = 1,
  607. .dev = {
  608. .platform_data = &dove_xor_shared_data,
  609. },
  610. .num_resources = ARRAY_SIZE(dove_xor1_shared_resources),
  611. .resource = dove_xor1_shared_resources,
  612. };
  613. static struct resource dove_xor10_resources[] = {
  614. [0] = {
  615. .start = IRQ_DOVE_XOR_10,
  616. .end = IRQ_DOVE_XOR_10,
  617. .flags = IORESOURCE_IRQ,
  618. },
  619. };
  620. static struct mv_xor_platform_data dove_xor10_data = {
  621. .shared = &dove_xor1_shared,
  622. .hw_id = 0,
  623. .pool_size = PAGE_SIZE,
  624. };
  625. static struct platform_device dove_xor10_channel = {
  626. .name = MV_XOR_NAME,
  627. .id = 2,
  628. .num_resources = ARRAY_SIZE(dove_xor10_resources),
  629. .resource = dove_xor10_resources,
  630. .dev = {
  631. .dma_mask = &dove_xor1_dmamask,
  632. .coherent_dma_mask = DMA_BIT_MASK(64),
  633. .platform_data = (void *)&dove_xor10_data,
  634. },
  635. };
  636. static struct resource dove_xor11_resources[] = {
  637. [0] = {
  638. .start = IRQ_DOVE_XOR_11,
  639. .end = IRQ_DOVE_XOR_11,
  640. .flags = IORESOURCE_IRQ,
  641. },
  642. };
  643. static struct mv_xor_platform_data dove_xor11_data = {
  644. .shared = &dove_xor1_shared,
  645. .hw_id = 1,
  646. .pool_size = PAGE_SIZE,
  647. };
  648. static struct platform_device dove_xor11_channel = {
  649. .name = MV_XOR_NAME,
  650. .id = 3,
  651. .num_resources = ARRAY_SIZE(dove_xor11_resources),
  652. .resource = dove_xor11_resources,
  653. .dev = {
  654. .dma_mask = &dove_xor1_dmamask,
  655. .coherent_dma_mask = DMA_BIT_MASK(64),
  656. .platform_data = (void *)&dove_xor11_data,
  657. },
  658. };
  659. void __init dove_xor1_init(void)
  660. {
  661. platform_device_register(&dove_xor1_shared);
  662. /*
  663. * two engines can't do memset simultaneously, this limitation
  664. * satisfied by removing memset support from one of the engines.
  665. */
  666. dma_cap_set(DMA_MEMCPY, dove_xor10_data.cap_mask);
  667. dma_cap_set(DMA_XOR, dove_xor10_data.cap_mask);
  668. platform_device_register(&dove_xor10_channel);
  669. dma_cap_set(DMA_MEMCPY, dove_xor11_data.cap_mask);
  670. dma_cap_set(DMA_MEMSET, dove_xor11_data.cap_mask);
  671. dma_cap_set(DMA_XOR, dove_xor11_data.cap_mask);
  672. platform_device_register(&dove_xor11_channel);
  673. }
  674. void __init dove_init(void)
  675. {
  676. int tclk;
  677. tclk = get_tclk();
  678. printk(KERN_INFO "Dove 88AP510 SoC, ");
  679. printk(KERN_INFO "TCLK = %dMHz\n", (tclk + 499999) / 1000000);
  680. dove_setup_cpu_mbus();
  681. dove_ge00_shared_data.t_clk = tclk;
  682. dove_uart0_data[0].uartclk = tclk;
  683. dove_uart1_data[0].uartclk = tclk;
  684. dove_uart2_data[0].uartclk = tclk;
  685. dove_uart3_data[0].uartclk = tclk;
  686. dove_spi0_data.tclk = tclk;
  687. dove_spi1_data.tclk = tclk;
  688. /* internal devices that every board has */
  689. dove_rtc_init();
  690. dove_xor0_init();
  691. dove_xor1_init();
  692. }