common.c 20 KB

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