common.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936
  1. /*
  2. * arch/arm/plat-orion/common.c
  3. *
  4. * Marvell Orion SoC common setup code used by multiple mach-/common.c
  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/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/dma-mapping.h>
  14. #include <linux/serial_8250.h>
  15. #include <linux/ata_platform.h>
  16. #include <linux/mv643xx_eth.h>
  17. #include <linux/mv643xx_i2c.h>
  18. #include <net/dsa.h>
  19. #include <linux/spi/orion_spi.h>
  20. #include <plat/orion_wdt.h>
  21. #include <plat/mv_xor.h>
  22. #include <plat/ehci-orion.h>
  23. #include <mach/bridge-regs.h>
  24. /* Fill in the resources structure and link it into the platform
  25. device structure. There is always a memory region, and nearly
  26. always an interrupt.*/
  27. static void fill_resources(struct platform_device *device,
  28. struct resource *resources,
  29. resource_size_t mapbase,
  30. resource_size_t size,
  31. unsigned int irq)
  32. {
  33. device->resource = resources;
  34. device->num_resources = 1;
  35. resources[0].flags = IORESOURCE_MEM;
  36. resources[0].start = mapbase;
  37. resources[0].end = mapbase + size;
  38. if (irq != NO_IRQ) {
  39. device->num_resources++;
  40. resources[1].flags = IORESOURCE_IRQ;
  41. resources[1].start = irq;
  42. resources[1].end = irq;
  43. }
  44. }
  45. /*****************************************************************************
  46. * UART
  47. ****************************************************************************/
  48. static void __init uart_complete(
  49. struct platform_device *orion_uart,
  50. struct plat_serial8250_port *data,
  51. struct resource *resources,
  52. unsigned int membase,
  53. resource_size_t mapbase,
  54. unsigned int irq,
  55. unsigned int uartclk)
  56. {
  57. data->mapbase = mapbase;
  58. data->membase = (void __iomem *)membase;
  59. data->irq = irq;
  60. data->uartclk = uartclk;
  61. orion_uart->dev.platform_data = data;
  62. fill_resources(orion_uart, resources, mapbase, 0xff, irq);
  63. platform_device_register(orion_uart);
  64. }
  65. /*****************************************************************************
  66. * UART0
  67. ****************************************************************************/
  68. static struct plat_serial8250_port orion_uart0_data[] = {
  69. {
  70. .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
  71. .iotype = UPIO_MEM,
  72. .regshift = 2,
  73. }, {
  74. },
  75. };
  76. static struct resource orion_uart0_resources[2];
  77. static struct platform_device orion_uart0 = {
  78. .name = "serial8250",
  79. .id = PLAT8250_DEV_PLATFORM,
  80. };
  81. void __init orion_uart0_init(unsigned int membase,
  82. resource_size_t mapbase,
  83. unsigned int irq,
  84. unsigned int uartclk)
  85. {
  86. uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
  87. membase, mapbase, irq, uartclk);
  88. }
  89. /*****************************************************************************
  90. * UART1
  91. ****************************************************************************/
  92. static struct plat_serial8250_port orion_uart1_data[] = {
  93. {
  94. .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
  95. .iotype = UPIO_MEM,
  96. .regshift = 2,
  97. }, {
  98. },
  99. };
  100. static struct resource orion_uart1_resources[2];
  101. static struct platform_device orion_uart1 = {
  102. .name = "serial8250",
  103. .id = PLAT8250_DEV_PLATFORM1,
  104. };
  105. void __init orion_uart1_init(unsigned int membase,
  106. resource_size_t mapbase,
  107. unsigned int irq,
  108. unsigned int uartclk)
  109. {
  110. uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
  111. membase, mapbase, irq, uartclk);
  112. }
  113. /*****************************************************************************
  114. * UART2
  115. ****************************************************************************/
  116. static struct plat_serial8250_port orion_uart2_data[] = {
  117. {
  118. .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
  119. .iotype = UPIO_MEM,
  120. .regshift = 2,
  121. }, {
  122. },
  123. };
  124. static struct resource orion_uart2_resources[2];
  125. static struct platform_device orion_uart2 = {
  126. .name = "serial8250",
  127. .id = PLAT8250_DEV_PLATFORM2,
  128. };
  129. void __init orion_uart2_init(unsigned int membase,
  130. resource_size_t mapbase,
  131. unsigned int irq,
  132. unsigned int uartclk)
  133. {
  134. uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
  135. membase, mapbase, irq, uartclk);
  136. }
  137. /*****************************************************************************
  138. * UART3
  139. ****************************************************************************/
  140. static struct plat_serial8250_port orion_uart3_data[] = {
  141. {
  142. .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
  143. .iotype = UPIO_MEM,
  144. .regshift = 2,
  145. }, {
  146. },
  147. };
  148. static struct resource orion_uart3_resources[2];
  149. static struct platform_device orion_uart3 = {
  150. .name = "serial8250",
  151. .id = 3,
  152. };
  153. void __init orion_uart3_init(unsigned int membase,
  154. resource_size_t mapbase,
  155. unsigned int irq,
  156. unsigned int uartclk)
  157. {
  158. uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
  159. membase, mapbase, irq, uartclk);
  160. }
  161. /*****************************************************************************
  162. * SoC RTC
  163. ****************************************************************************/
  164. static struct resource orion_rtc_resource[2];
  165. void __init orion_rtc_init(unsigned long mapbase,
  166. unsigned long irq)
  167. {
  168. orion_rtc_resource[0].start = mapbase;
  169. orion_rtc_resource[0].end = mapbase + SZ_32 - 1;
  170. orion_rtc_resource[0].flags = IORESOURCE_MEM;
  171. orion_rtc_resource[1].start = irq;
  172. orion_rtc_resource[1].end = irq;
  173. orion_rtc_resource[1].flags = IORESOURCE_IRQ;
  174. platform_device_register_simple("rtc-mv", -1, orion_rtc_resource, 2);
  175. }
  176. /*****************************************************************************
  177. * GE
  178. ****************************************************************************/
  179. static __init void ge_complete(
  180. struct mv643xx_eth_shared_platform_data *orion_ge_shared_data,
  181. int tclk,
  182. struct resource *orion_ge_resource, unsigned long irq,
  183. struct platform_device *orion_ge_shared,
  184. struct mv643xx_eth_platform_data *eth_data,
  185. struct platform_device *orion_ge)
  186. {
  187. orion_ge_shared_data->t_clk = tclk;
  188. orion_ge_resource->start = irq;
  189. orion_ge_resource->end = irq;
  190. eth_data->shared = orion_ge_shared;
  191. orion_ge->dev.platform_data = eth_data;
  192. platform_device_register(orion_ge_shared);
  193. platform_device_register(orion_ge);
  194. }
  195. /*****************************************************************************
  196. * GE00
  197. ****************************************************************************/
  198. struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;
  199. static struct resource orion_ge00_shared_resources[] = {
  200. {
  201. .name = "ge00 base",
  202. }, {
  203. .name = "ge00 err irq",
  204. },
  205. };
  206. static struct platform_device orion_ge00_shared = {
  207. .name = MV643XX_ETH_SHARED_NAME,
  208. .id = 0,
  209. .dev = {
  210. .platform_data = &orion_ge00_shared_data,
  211. },
  212. };
  213. static struct resource orion_ge00_resources[] = {
  214. {
  215. .name = "ge00 irq",
  216. .flags = IORESOURCE_IRQ,
  217. },
  218. };
  219. static struct platform_device orion_ge00 = {
  220. .name = MV643XX_ETH_NAME,
  221. .id = 0,
  222. .num_resources = 1,
  223. .resource = orion_ge00_resources,
  224. .dev = {
  225. .coherent_dma_mask = DMA_BIT_MASK(32),
  226. },
  227. };
  228. void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
  229. unsigned long mapbase,
  230. unsigned long irq,
  231. unsigned long irq_err,
  232. int tclk)
  233. {
  234. fill_resources(&orion_ge00_shared, orion_ge00_shared_resources,
  235. mapbase + 0x2000, SZ_16K - 1, irq_err);
  236. ge_complete(&orion_ge00_shared_data, tclk,
  237. orion_ge00_resources, irq, &orion_ge00_shared,
  238. eth_data, &orion_ge00);
  239. }
  240. /*****************************************************************************
  241. * GE01
  242. ****************************************************************************/
  243. struct mv643xx_eth_shared_platform_data orion_ge01_shared_data = {
  244. .shared_smi = &orion_ge00_shared,
  245. };
  246. static struct resource orion_ge01_shared_resources[] = {
  247. {
  248. .name = "ge01 base",
  249. }, {
  250. .name = "ge01 err irq",
  251. },
  252. };
  253. static struct platform_device orion_ge01_shared = {
  254. .name = MV643XX_ETH_SHARED_NAME,
  255. .id = 1,
  256. .dev = {
  257. .platform_data = &orion_ge01_shared_data,
  258. },
  259. };
  260. static struct resource orion_ge01_resources[] = {
  261. {
  262. .name = "ge01 irq",
  263. .flags = IORESOURCE_IRQ,
  264. },
  265. };
  266. static struct platform_device orion_ge01 = {
  267. .name = MV643XX_ETH_NAME,
  268. .id = 1,
  269. .num_resources = 1,
  270. .resource = orion_ge01_resources,
  271. .dev = {
  272. .coherent_dma_mask = DMA_BIT_MASK(32),
  273. },
  274. };
  275. void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
  276. unsigned long mapbase,
  277. unsigned long irq,
  278. unsigned long irq_err,
  279. int tclk)
  280. {
  281. fill_resources(&orion_ge01_shared, orion_ge01_shared_resources,
  282. mapbase + 0x2000, SZ_16K - 1, irq_err);
  283. ge_complete(&orion_ge01_shared_data, tclk,
  284. orion_ge01_resources, irq, &orion_ge01_shared,
  285. eth_data, &orion_ge01);
  286. }
  287. /*****************************************************************************
  288. * GE10
  289. ****************************************************************************/
  290. struct mv643xx_eth_shared_platform_data orion_ge10_shared_data = {
  291. .shared_smi = &orion_ge00_shared,
  292. };
  293. static struct resource orion_ge10_shared_resources[] = {
  294. {
  295. .name = "ge10 base",
  296. }, {
  297. .name = "ge10 err irq",
  298. },
  299. };
  300. static struct platform_device orion_ge10_shared = {
  301. .name = MV643XX_ETH_SHARED_NAME,
  302. .id = 1,
  303. .dev = {
  304. .platform_data = &orion_ge10_shared_data,
  305. },
  306. };
  307. static struct resource orion_ge10_resources[] = {
  308. {
  309. .name = "ge10 irq",
  310. .flags = IORESOURCE_IRQ,
  311. },
  312. };
  313. static struct platform_device orion_ge10 = {
  314. .name = MV643XX_ETH_NAME,
  315. .id = 1,
  316. .num_resources = 2,
  317. .resource = orion_ge10_resources,
  318. .dev = {
  319. .coherent_dma_mask = DMA_BIT_MASK(32),
  320. },
  321. };
  322. void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
  323. unsigned long mapbase,
  324. unsigned long irq,
  325. unsigned long irq_err,
  326. int tclk)
  327. {
  328. fill_resources(&orion_ge10_shared, orion_ge10_shared_resources,
  329. mapbase + 0x2000, SZ_16K - 1, irq_err);
  330. ge_complete(&orion_ge10_shared_data, tclk,
  331. orion_ge10_resources, irq, &orion_ge10_shared,
  332. eth_data, &orion_ge10);
  333. }
  334. /*****************************************************************************
  335. * GE11
  336. ****************************************************************************/
  337. struct mv643xx_eth_shared_platform_data orion_ge11_shared_data = {
  338. .shared_smi = &orion_ge00_shared,
  339. };
  340. static struct resource orion_ge11_shared_resources[] = {
  341. {
  342. .name = "ge11 base",
  343. }, {
  344. .name = "ge11 err irq",
  345. },
  346. };
  347. static struct platform_device orion_ge11_shared = {
  348. .name = MV643XX_ETH_SHARED_NAME,
  349. .id = 1,
  350. .dev = {
  351. .platform_data = &orion_ge11_shared_data,
  352. },
  353. };
  354. static struct resource orion_ge11_resources[] = {
  355. {
  356. .name = "ge11 irq",
  357. .flags = IORESOURCE_IRQ,
  358. },
  359. };
  360. static struct platform_device orion_ge11 = {
  361. .name = MV643XX_ETH_NAME,
  362. .id = 1,
  363. .num_resources = 2,
  364. .resource = orion_ge11_resources,
  365. .dev = {
  366. .coherent_dma_mask = DMA_BIT_MASK(32),
  367. },
  368. };
  369. void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
  370. unsigned long mapbase,
  371. unsigned long irq,
  372. unsigned long irq_err,
  373. int tclk)
  374. {
  375. fill_resources(&orion_ge11_shared, orion_ge11_shared_resources,
  376. mapbase + 0x2000, SZ_16K - 1, irq_err);
  377. ge_complete(&orion_ge11_shared_data, tclk,
  378. orion_ge11_resources, irq, &orion_ge11_shared,
  379. eth_data, &orion_ge11);
  380. }
  381. /*****************************************************************************
  382. * Ethernet switch
  383. ****************************************************************************/
  384. static struct resource orion_switch_resources[] = {
  385. {
  386. .start = 0,
  387. .end = 0,
  388. .flags = IORESOURCE_IRQ,
  389. },
  390. };
  391. static struct platform_device orion_switch_device = {
  392. .name = "dsa",
  393. .id = 0,
  394. .num_resources = 0,
  395. .resource = orion_switch_resources,
  396. };
  397. void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq)
  398. {
  399. int i;
  400. if (irq != NO_IRQ) {
  401. orion_switch_resources[0].start = irq;
  402. orion_switch_resources[0].end = irq;
  403. orion_switch_device.num_resources = 1;
  404. }
  405. d->netdev = &orion_ge00.dev;
  406. for (i = 0; i < d->nr_chips; i++)
  407. d->chip[i].mii_bus = &orion_ge00_shared.dev;
  408. orion_switch_device.dev.platform_data = d;
  409. platform_device_register(&orion_switch_device);
  410. }
  411. /*****************************************************************************
  412. * I2C
  413. ****************************************************************************/
  414. static struct mv64xxx_i2c_pdata orion_i2c_pdata = {
  415. .freq_n = 3,
  416. .timeout = 1000, /* Default timeout of 1 second */
  417. };
  418. static struct resource orion_i2c_resources[2];
  419. static struct platform_device orion_i2c = {
  420. .name = MV64XXX_I2C_CTLR_NAME,
  421. .id = 0,
  422. .dev = {
  423. .platform_data = &orion_i2c_pdata,
  424. },
  425. };
  426. static struct mv64xxx_i2c_pdata orion_i2c_1_pdata = {
  427. .freq_n = 3,
  428. .timeout = 1000, /* Default timeout of 1 second */
  429. };
  430. static struct resource orion_i2c_1_resources[2];
  431. static struct platform_device orion_i2c_1 = {
  432. .name = MV64XXX_I2C_CTLR_NAME,
  433. .id = 1,
  434. .dev = {
  435. .platform_data = &orion_i2c_1_pdata,
  436. },
  437. };
  438. void __init orion_i2c_init(unsigned long mapbase,
  439. unsigned long irq,
  440. unsigned long freq_m)
  441. {
  442. orion_i2c_pdata.freq_m = freq_m;
  443. fill_resources(&orion_i2c, orion_i2c_resources, mapbase,
  444. SZ_32 - 1, irq);
  445. platform_device_register(&orion_i2c);
  446. }
  447. void __init orion_i2c_1_init(unsigned long mapbase,
  448. unsigned long irq,
  449. unsigned long freq_m)
  450. {
  451. orion_i2c_1_pdata.freq_m = freq_m;
  452. fill_resources(&orion_i2c_1, orion_i2c_1_resources, mapbase,
  453. SZ_32 - 1, irq);
  454. platform_device_register(&orion_i2c_1);
  455. }
  456. /*****************************************************************************
  457. * SPI
  458. ****************************************************************************/
  459. static struct orion_spi_info orion_spi_plat_data;
  460. static struct resource orion_spi_resources;
  461. static struct platform_device orion_spi = {
  462. .name = "orion_spi",
  463. .id = 0,
  464. .dev = {
  465. .platform_data = &orion_spi_plat_data,
  466. },
  467. };
  468. static struct orion_spi_info orion_spi_1_plat_data;
  469. static struct resource orion_spi_1_resources;
  470. static struct platform_device orion_spi_1 = {
  471. .name = "orion_spi",
  472. .id = 1,
  473. .dev = {
  474. .platform_data = &orion_spi_1_plat_data,
  475. },
  476. };
  477. /* Note: The SPI silicon core does have interrupts. However the
  478. * current Linux software driver does not use interrupts. */
  479. void __init orion_spi_init(unsigned long mapbase,
  480. unsigned long tclk)
  481. {
  482. orion_spi_plat_data.tclk = tclk;
  483. fill_resources(&orion_spi, &orion_spi_resources,
  484. mapbase, SZ_512 - 1, NO_IRQ);
  485. platform_device_register(&orion_spi);
  486. }
  487. void __init orion_spi_1_init(unsigned long mapbase,
  488. unsigned long tclk)
  489. {
  490. orion_spi_1_plat_data.tclk = tclk;
  491. fill_resources(&orion_spi_1, &orion_spi_1_resources,
  492. mapbase, SZ_512 - 1, NO_IRQ);
  493. platform_device_register(&orion_spi_1);
  494. }
  495. /*****************************************************************************
  496. * Watchdog
  497. ****************************************************************************/
  498. static struct orion_wdt_platform_data orion_wdt_data;
  499. static struct resource orion_wdt_resource =
  500. DEFINE_RES_MEM(TIMER_VIRT_BASE, 0x28);
  501. static struct platform_device orion_wdt_device = {
  502. .name = "orion_wdt",
  503. .id = -1,
  504. .dev = {
  505. .platform_data = &orion_wdt_data,
  506. },
  507. .resource = &orion_wdt_resource,
  508. .num_resources = 1,
  509. };
  510. void __init orion_wdt_init(unsigned long tclk)
  511. {
  512. orion_wdt_data.tclk = tclk;
  513. platform_device_register(&orion_wdt_device);
  514. }
  515. /*****************************************************************************
  516. * XOR
  517. ****************************************************************************/
  518. static u64 orion_xor_dmamask = DMA_BIT_MASK(32);
  519. void __init orion_xor_init_channels(
  520. struct mv_xor_platform_data *orion_xor0_data,
  521. struct platform_device *orion_xor0_channel,
  522. struct mv_xor_platform_data *orion_xor1_data,
  523. struct platform_device *orion_xor1_channel)
  524. {
  525. /*
  526. * two engines can't do memset simultaneously, this limitation
  527. * satisfied by removing memset support from one of the engines.
  528. */
  529. dma_cap_set(DMA_MEMCPY, orion_xor0_data->cap_mask);
  530. dma_cap_set(DMA_XOR, orion_xor0_data->cap_mask);
  531. platform_device_register(orion_xor0_channel);
  532. dma_cap_set(DMA_MEMCPY, orion_xor1_data->cap_mask);
  533. dma_cap_set(DMA_MEMSET, orion_xor1_data->cap_mask);
  534. dma_cap_set(DMA_XOR, orion_xor1_data->cap_mask);
  535. platform_device_register(orion_xor1_channel);
  536. }
  537. /*****************************************************************************
  538. * XOR0
  539. ****************************************************************************/
  540. static struct resource orion_xor0_shared_resources[] = {
  541. {
  542. .name = "xor 0 low",
  543. .flags = IORESOURCE_MEM,
  544. }, {
  545. .name = "xor 0 high",
  546. .flags = IORESOURCE_MEM,
  547. },
  548. };
  549. static struct platform_device orion_xor0_shared = {
  550. .name = MV_XOR_SHARED_NAME,
  551. .id = 0,
  552. .num_resources = ARRAY_SIZE(orion_xor0_shared_resources),
  553. .resource = orion_xor0_shared_resources,
  554. };
  555. static struct resource orion_xor00_resources[] = {
  556. [0] = {
  557. .flags = IORESOURCE_IRQ,
  558. },
  559. };
  560. static struct mv_xor_platform_data orion_xor00_data = {
  561. .shared = &orion_xor0_shared,
  562. .hw_id = 0,
  563. .pool_size = PAGE_SIZE,
  564. };
  565. static struct platform_device orion_xor00_channel = {
  566. .name = MV_XOR_NAME,
  567. .id = 0,
  568. .num_resources = ARRAY_SIZE(orion_xor00_resources),
  569. .resource = orion_xor00_resources,
  570. .dev = {
  571. .dma_mask = &orion_xor_dmamask,
  572. .coherent_dma_mask = DMA_BIT_MASK(64),
  573. .platform_data = &orion_xor00_data,
  574. },
  575. };
  576. static struct resource orion_xor01_resources[] = {
  577. [0] = {
  578. .flags = IORESOURCE_IRQ,
  579. },
  580. };
  581. static struct mv_xor_platform_data orion_xor01_data = {
  582. .shared = &orion_xor0_shared,
  583. .hw_id = 1,
  584. .pool_size = PAGE_SIZE,
  585. };
  586. static struct platform_device orion_xor01_channel = {
  587. .name = MV_XOR_NAME,
  588. .id = 1,
  589. .num_resources = ARRAY_SIZE(orion_xor01_resources),
  590. .resource = orion_xor01_resources,
  591. .dev = {
  592. .dma_mask = &orion_xor_dmamask,
  593. .coherent_dma_mask = DMA_BIT_MASK(64),
  594. .platform_data = &orion_xor01_data,
  595. },
  596. };
  597. void __init orion_xor0_init(unsigned long mapbase_low,
  598. unsigned long mapbase_high,
  599. unsigned long irq_0,
  600. unsigned long irq_1)
  601. {
  602. orion_xor0_shared_resources[0].start = mapbase_low;
  603. orion_xor0_shared_resources[0].end = mapbase_low + 0xff;
  604. orion_xor0_shared_resources[1].start = mapbase_high;
  605. orion_xor0_shared_resources[1].end = mapbase_high + 0xff;
  606. orion_xor00_resources[0].start = irq_0;
  607. orion_xor00_resources[0].end = irq_0;
  608. orion_xor01_resources[0].start = irq_1;
  609. orion_xor01_resources[0].end = irq_1;
  610. platform_device_register(&orion_xor0_shared);
  611. orion_xor_init_channels(&orion_xor00_data, &orion_xor00_channel,
  612. &orion_xor01_data, &orion_xor01_channel);
  613. }
  614. /*****************************************************************************
  615. * XOR1
  616. ****************************************************************************/
  617. static struct resource orion_xor1_shared_resources[] = {
  618. {
  619. .name = "xor 1 low",
  620. .flags = IORESOURCE_MEM,
  621. }, {
  622. .name = "xor 1 high",
  623. .flags = IORESOURCE_MEM,
  624. },
  625. };
  626. static struct platform_device orion_xor1_shared = {
  627. .name = MV_XOR_SHARED_NAME,
  628. .id = 1,
  629. .num_resources = ARRAY_SIZE(orion_xor1_shared_resources),
  630. .resource = orion_xor1_shared_resources,
  631. };
  632. static struct resource orion_xor10_resources[] = {
  633. [0] = {
  634. .flags = IORESOURCE_IRQ,
  635. },
  636. };
  637. static struct mv_xor_platform_data orion_xor10_data = {
  638. .shared = &orion_xor1_shared,
  639. .hw_id = 0,
  640. .pool_size = PAGE_SIZE,
  641. };
  642. static struct platform_device orion_xor10_channel = {
  643. .name = MV_XOR_NAME,
  644. .id = 2,
  645. .num_resources = ARRAY_SIZE(orion_xor10_resources),
  646. .resource = orion_xor10_resources,
  647. .dev = {
  648. .dma_mask = &orion_xor_dmamask,
  649. .coherent_dma_mask = DMA_BIT_MASK(64),
  650. .platform_data = &orion_xor10_data,
  651. },
  652. };
  653. static struct resource orion_xor11_resources[] = {
  654. [0] = {
  655. .flags = IORESOURCE_IRQ,
  656. },
  657. };
  658. static struct mv_xor_platform_data orion_xor11_data = {
  659. .shared = &orion_xor1_shared,
  660. .hw_id = 1,
  661. .pool_size = PAGE_SIZE,
  662. };
  663. static struct platform_device orion_xor11_channel = {
  664. .name = MV_XOR_NAME,
  665. .id = 3,
  666. .num_resources = ARRAY_SIZE(orion_xor11_resources),
  667. .resource = orion_xor11_resources,
  668. .dev = {
  669. .dma_mask = &orion_xor_dmamask,
  670. .coherent_dma_mask = DMA_BIT_MASK(64),
  671. .platform_data = &orion_xor11_data,
  672. },
  673. };
  674. void __init orion_xor1_init(unsigned long mapbase_low,
  675. unsigned long mapbase_high,
  676. unsigned long irq_0,
  677. unsigned long irq_1)
  678. {
  679. orion_xor1_shared_resources[0].start = mapbase_low;
  680. orion_xor1_shared_resources[0].end = mapbase_low + 0xff;
  681. orion_xor1_shared_resources[1].start = mapbase_high;
  682. orion_xor1_shared_resources[1].end = mapbase_high + 0xff;
  683. orion_xor10_resources[0].start = irq_0;
  684. orion_xor10_resources[0].end = irq_0;
  685. orion_xor11_resources[0].start = irq_1;
  686. orion_xor11_resources[0].end = irq_1;
  687. platform_device_register(&orion_xor1_shared);
  688. orion_xor_init_channels(&orion_xor10_data, &orion_xor10_channel,
  689. &orion_xor11_data, &orion_xor11_channel);
  690. }
  691. /*****************************************************************************
  692. * EHCI
  693. ****************************************************************************/
  694. static struct orion_ehci_data orion_ehci_data;
  695. static u64 ehci_dmamask = DMA_BIT_MASK(32);
  696. /*****************************************************************************
  697. * EHCI0
  698. ****************************************************************************/
  699. static struct resource orion_ehci_resources[2];
  700. static struct platform_device orion_ehci = {
  701. .name = "orion-ehci",
  702. .id = 0,
  703. .dev = {
  704. .dma_mask = &ehci_dmamask,
  705. .coherent_dma_mask = DMA_BIT_MASK(32),
  706. .platform_data = &orion_ehci_data,
  707. },
  708. };
  709. void __init orion_ehci_init(unsigned long mapbase,
  710. unsigned long irq,
  711. enum orion_ehci_phy_ver phy_version)
  712. {
  713. orion_ehci_data.phy_version = phy_version;
  714. fill_resources(&orion_ehci, orion_ehci_resources, mapbase, SZ_4K - 1,
  715. irq);
  716. platform_device_register(&orion_ehci);
  717. }
  718. /*****************************************************************************
  719. * EHCI1
  720. ****************************************************************************/
  721. static struct resource orion_ehci_1_resources[2];
  722. static struct platform_device orion_ehci_1 = {
  723. .name = "orion-ehci",
  724. .id = 1,
  725. .dev = {
  726. .dma_mask = &ehci_dmamask,
  727. .coherent_dma_mask = DMA_BIT_MASK(32),
  728. .platform_data = &orion_ehci_data,
  729. },
  730. };
  731. void __init orion_ehci_1_init(unsigned long mapbase,
  732. unsigned long irq)
  733. {
  734. fill_resources(&orion_ehci_1, orion_ehci_1_resources,
  735. mapbase, SZ_4K - 1, irq);
  736. platform_device_register(&orion_ehci_1);
  737. }
  738. /*****************************************************************************
  739. * EHCI2
  740. ****************************************************************************/
  741. static struct resource orion_ehci_2_resources[2];
  742. static struct platform_device orion_ehci_2 = {
  743. .name = "orion-ehci",
  744. .id = 2,
  745. .dev = {
  746. .dma_mask = &ehci_dmamask,
  747. .coherent_dma_mask = DMA_BIT_MASK(32),
  748. .platform_data = &orion_ehci_data,
  749. },
  750. };
  751. void __init orion_ehci_2_init(unsigned long mapbase,
  752. unsigned long irq)
  753. {
  754. fill_resources(&orion_ehci_2, orion_ehci_2_resources,
  755. mapbase, SZ_4K - 1, irq);
  756. platform_device_register(&orion_ehci_2);
  757. }
  758. /*****************************************************************************
  759. * SATA
  760. ****************************************************************************/
  761. static struct resource orion_sata_resources[2] = {
  762. {
  763. .name = "sata base",
  764. }, {
  765. .name = "sata irq",
  766. },
  767. };
  768. static struct platform_device orion_sata = {
  769. .name = "sata_mv",
  770. .id = 0,
  771. .dev = {
  772. .coherent_dma_mask = DMA_BIT_MASK(32),
  773. },
  774. };
  775. void __init orion_sata_init(struct mv_sata_platform_data *sata_data,
  776. unsigned long mapbase,
  777. unsigned long irq)
  778. {
  779. orion_sata.dev.platform_data = sata_data;
  780. fill_resources(&orion_sata, orion_sata_resources,
  781. mapbase, 0x5000 - 1, irq);
  782. platform_device_register(&orion_sata);
  783. }
  784. /*****************************************************************************
  785. * Cryptographic Engines and Security Accelerator (CESA)
  786. ****************************************************************************/
  787. static struct resource orion_crypto_resources[] = {
  788. {
  789. .name = "regs",
  790. }, {
  791. .name = "crypto interrupt",
  792. }, {
  793. .name = "sram",
  794. .flags = IORESOURCE_MEM,
  795. },
  796. };
  797. static struct platform_device orion_crypto = {
  798. .name = "mv_crypto",
  799. .id = -1,
  800. };
  801. void __init orion_crypto_init(unsigned long mapbase,
  802. unsigned long srambase,
  803. unsigned long sram_size,
  804. unsigned long irq)
  805. {
  806. fill_resources(&orion_crypto, orion_crypto_resources,
  807. mapbase, 0xffff, irq);
  808. orion_crypto.num_resources = 3;
  809. orion_crypto_resources[2].start = srambase;
  810. orion_crypto_resources[2].end = srambase + sram_size - 1;
  811. platform_device_register(&orion_crypto);
  812. }