common.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  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. static int get_tclk(void)
  484. {
  485. /* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
  486. return 166666667;
  487. }
  488. static void dove_timer_init(void)
  489. {
  490. orion_time_init(IRQ_DOVE_BRIDGE, get_tclk());
  491. }
  492. struct sys_timer dove_timer = {
  493. .init = dove_timer_init,
  494. };
  495. /*****************************************************************************
  496. * XOR
  497. ****************************************************************************/
  498. static struct mv_xor_platform_shared_data dove_xor_shared_data = {
  499. .dram = &dove_mbus_dram_info,
  500. };
  501. /*****************************************************************************
  502. * XOR 0
  503. ****************************************************************************/
  504. static u64 dove_xor0_dmamask = DMA_BIT_MASK(32);
  505. static struct resource dove_xor0_shared_resources[] = {
  506. {
  507. .name = "xor 0 low",
  508. .start = DOVE_XOR0_PHYS_BASE,
  509. .end = DOVE_XOR0_PHYS_BASE + 0xff,
  510. .flags = IORESOURCE_MEM,
  511. }, {
  512. .name = "xor 0 high",
  513. .start = DOVE_XOR0_HIGH_PHYS_BASE,
  514. .end = DOVE_XOR0_HIGH_PHYS_BASE + 0xff,
  515. .flags = IORESOURCE_MEM,
  516. },
  517. };
  518. static struct platform_device dove_xor0_shared = {
  519. .name = MV_XOR_SHARED_NAME,
  520. .id = 0,
  521. .dev = {
  522. .platform_data = &dove_xor_shared_data,
  523. },
  524. .num_resources = ARRAY_SIZE(dove_xor0_shared_resources),
  525. .resource = dove_xor0_shared_resources,
  526. };
  527. static struct resource dove_xor00_resources[] = {
  528. [0] = {
  529. .start = IRQ_DOVE_XOR_00,
  530. .end = IRQ_DOVE_XOR_00,
  531. .flags = IORESOURCE_IRQ,
  532. },
  533. };
  534. static struct mv_xor_platform_data dove_xor00_data = {
  535. .shared = &dove_xor0_shared,
  536. .hw_id = 0,
  537. .pool_size = PAGE_SIZE,
  538. };
  539. static struct platform_device dove_xor00_channel = {
  540. .name = MV_XOR_NAME,
  541. .id = 0,
  542. .num_resources = ARRAY_SIZE(dove_xor00_resources),
  543. .resource = dove_xor00_resources,
  544. .dev = {
  545. .dma_mask = &dove_xor0_dmamask,
  546. .coherent_dma_mask = DMA_BIT_MASK(64),
  547. .platform_data = &dove_xor00_data,
  548. },
  549. };
  550. static struct resource dove_xor01_resources[] = {
  551. [0] = {
  552. .start = IRQ_DOVE_XOR_01,
  553. .end = IRQ_DOVE_XOR_01,
  554. .flags = IORESOURCE_IRQ,
  555. },
  556. };
  557. static struct mv_xor_platform_data dove_xor01_data = {
  558. .shared = &dove_xor0_shared,
  559. .hw_id = 1,
  560. .pool_size = PAGE_SIZE,
  561. };
  562. static struct platform_device dove_xor01_channel = {
  563. .name = MV_XOR_NAME,
  564. .id = 1,
  565. .num_resources = ARRAY_SIZE(dove_xor01_resources),
  566. .resource = dove_xor01_resources,
  567. .dev = {
  568. .dma_mask = &dove_xor0_dmamask,
  569. .coherent_dma_mask = DMA_BIT_MASK(64),
  570. .platform_data = &dove_xor01_data,
  571. },
  572. };
  573. void __init dove_xor0_init(void)
  574. {
  575. platform_device_register(&dove_xor0_shared);
  576. /*
  577. * two engines can't do memset simultaneously, this limitation
  578. * satisfied by removing memset support from one of the engines.
  579. */
  580. dma_cap_set(DMA_MEMCPY, dove_xor00_data.cap_mask);
  581. dma_cap_set(DMA_XOR, dove_xor00_data.cap_mask);
  582. platform_device_register(&dove_xor00_channel);
  583. dma_cap_set(DMA_MEMCPY, dove_xor01_data.cap_mask);
  584. dma_cap_set(DMA_MEMSET, dove_xor01_data.cap_mask);
  585. dma_cap_set(DMA_XOR, dove_xor01_data.cap_mask);
  586. platform_device_register(&dove_xor01_channel);
  587. }
  588. /*****************************************************************************
  589. * XOR 1
  590. ****************************************************************************/
  591. static u64 dove_xor1_dmamask = DMA_BIT_MASK(32);
  592. static struct resource dove_xor1_shared_resources[] = {
  593. {
  594. .name = "xor 0 low",
  595. .start = DOVE_XOR1_PHYS_BASE,
  596. .end = DOVE_XOR1_PHYS_BASE + 0xff,
  597. .flags = IORESOURCE_MEM,
  598. }, {
  599. .name = "xor 0 high",
  600. .start = DOVE_XOR1_HIGH_PHYS_BASE,
  601. .end = DOVE_XOR1_HIGH_PHYS_BASE + 0xff,
  602. .flags = IORESOURCE_MEM,
  603. },
  604. };
  605. static struct platform_device dove_xor1_shared = {
  606. .name = MV_XOR_SHARED_NAME,
  607. .id = 1,
  608. .dev = {
  609. .platform_data = &dove_xor_shared_data,
  610. },
  611. .num_resources = ARRAY_SIZE(dove_xor1_shared_resources),
  612. .resource = dove_xor1_shared_resources,
  613. };
  614. static struct resource dove_xor10_resources[] = {
  615. [0] = {
  616. .start = IRQ_DOVE_XOR_10,
  617. .end = IRQ_DOVE_XOR_10,
  618. .flags = IORESOURCE_IRQ,
  619. },
  620. };
  621. static struct mv_xor_platform_data dove_xor10_data = {
  622. .shared = &dove_xor1_shared,
  623. .hw_id = 0,
  624. .pool_size = PAGE_SIZE,
  625. };
  626. static struct platform_device dove_xor10_channel = {
  627. .name = MV_XOR_NAME,
  628. .id = 2,
  629. .num_resources = ARRAY_SIZE(dove_xor10_resources),
  630. .resource = dove_xor10_resources,
  631. .dev = {
  632. .dma_mask = &dove_xor1_dmamask,
  633. .coherent_dma_mask = DMA_BIT_MASK(64),
  634. .platform_data = &dove_xor10_data,
  635. },
  636. };
  637. static struct resource dove_xor11_resources[] = {
  638. [0] = {
  639. .start = IRQ_DOVE_XOR_11,
  640. .end = IRQ_DOVE_XOR_11,
  641. .flags = IORESOURCE_IRQ,
  642. },
  643. };
  644. static struct mv_xor_platform_data dove_xor11_data = {
  645. .shared = &dove_xor1_shared,
  646. .hw_id = 1,
  647. .pool_size = PAGE_SIZE,
  648. };
  649. static struct platform_device dove_xor11_channel = {
  650. .name = MV_XOR_NAME,
  651. .id = 3,
  652. .num_resources = ARRAY_SIZE(dove_xor11_resources),
  653. .resource = dove_xor11_resources,
  654. .dev = {
  655. .dma_mask = &dove_xor1_dmamask,
  656. .coherent_dma_mask = DMA_BIT_MASK(64),
  657. .platform_data = &dove_xor11_data,
  658. },
  659. };
  660. void __init dove_xor1_init(void)
  661. {
  662. platform_device_register(&dove_xor1_shared);
  663. /*
  664. * two engines can't do memset simultaneously, this limitation
  665. * satisfied by removing memset support from one of the engines.
  666. */
  667. dma_cap_set(DMA_MEMCPY, dove_xor10_data.cap_mask);
  668. dma_cap_set(DMA_XOR, dove_xor10_data.cap_mask);
  669. platform_device_register(&dove_xor10_channel);
  670. dma_cap_set(DMA_MEMCPY, dove_xor11_data.cap_mask);
  671. dma_cap_set(DMA_MEMSET, dove_xor11_data.cap_mask);
  672. dma_cap_set(DMA_XOR, dove_xor11_data.cap_mask);
  673. platform_device_register(&dove_xor11_channel);
  674. }
  675. /*****************************************************************************
  676. * SDIO
  677. ****************************************************************************/
  678. static u64 sdio_dmamask = DMA_BIT_MASK(32);
  679. static struct resource dove_sdio0_resources[] = {
  680. {
  681. .start = DOVE_SDIO0_PHYS_BASE,
  682. .end = DOVE_SDIO0_PHYS_BASE + 0xff,
  683. .flags = IORESOURCE_MEM,
  684. }, {
  685. .start = IRQ_DOVE_SDIO0,
  686. .end = IRQ_DOVE_SDIO0,
  687. .flags = IORESOURCE_IRQ,
  688. },
  689. };
  690. static struct platform_device dove_sdio0 = {
  691. .name = "sdhci-mv",
  692. .id = 0,
  693. .dev = {
  694. .dma_mask = &sdio_dmamask,
  695. .coherent_dma_mask = DMA_BIT_MASK(32),
  696. },
  697. .resource = dove_sdio0_resources,
  698. .num_resources = ARRAY_SIZE(dove_sdio0_resources),
  699. };
  700. void __init dove_sdio0_init(void)
  701. {
  702. platform_device_register(&dove_sdio0);
  703. }
  704. static struct resource dove_sdio1_resources[] = {
  705. {
  706. .start = DOVE_SDIO1_PHYS_BASE,
  707. .end = DOVE_SDIO1_PHYS_BASE + 0xff,
  708. .flags = IORESOURCE_MEM,
  709. }, {
  710. .start = IRQ_DOVE_SDIO1,
  711. .end = IRQ_DOVE_SDIO1,
  712. .flags = IORESOURCE_IRQ,
  713. },
  714. };
  715. static struct platform_device dove_sdio1 = {
  716. .name = "sdhci-mv",
  717. .id = 1,
  718. .dev = {
  719. .dma_mask = &sdio_dmamask,
  720. .coherent_dma_mask = DMA_BIT_MASK(32),
  721. },
  722. .resource = dove_sdio1_resources,
  723. .num_resources = ARRAY_SIZE(dove_sdio1_resources),
  724. };
  725. void __init dove_sdio1_init(void)
  726. {
  727. platform_device_register(&dove_sdio1);
  728. }
  729. void __init dove_init(void)
  730. {
  731. int tclk;
  732. tclk = get_tclk();
  733. printk(KERN_INFO "Dove 88AP510 SoC, ");
  734. printk(KERN_INFO "TCLK = %dMHz\n", (tclk + 499999) / 1000000);
  735. #ifdef CONFIG_CACHE_TAUROS2
  736. tauros2_init();
  737. #endif
  738. dove_setup_cpu_mbus();
  739. dove_ge00_shared_data.t_clk = tclk;
  740. dove_uart0_data[0].uartclk = tclk;
  741. dove_uart1_data[0].uartclk = tclk;
  742. dove_uart2_data[0].uartclk = tclk;
  743. dove_uart3_data[0].uartclk = tclk;
  744. dove_spi0_data.tclk = tclk;
  745. dove_spi1_data.tclk = tclk;
  746. /* internal devices that every board has */
  747. dove_rtc_init();
  748. dove_xor0_init();
  749. dove_xor1_init();
  750. }