common.c 20 KB

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