spear3xx.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * arch/arm/mach-spear3xx/spear3xx.c
  3. *
  4. * SPEAr3XX machines common source file
  5. *
  6. * Copyright (C) 2009-2012 ST Microelectronics
  7. * Viresh Kumar <viresh.linux@gmail.com>
  8. *
  9. * This file is licensed under the terms of the GNU General Public
  10. * License version 2. This program is licensed "as is" without any
  11. * warranty of any kind, whether express or implied.
  12. */
  13. #define pr_fmt(fmt) "SPEAr3xx: " fmt
  14. #include <linux/amba/pl022.h>
  15. #include <linux/amba/pl08x.h>
  16. #include <linux/irqchip/spear-shirq.h>
  17. #include <linux/of_irq.h>
  18. #include <linux/io.h>
  19. #include <asm/hardware/pl080.h>
  20. #include <asm/hardware/vic.h>
  21. #include <plat/pl080.h>
  22. #include <mach/generic.h>
  23. #include <mach/spear.h>
  24. /* ssp device registration */
  25. struct pl022_ssp_controller pl022_plat_data = {
  26. .bus_id = 0,
  27. .enable_dma = 1,
  28. .dma_filter = pl08x_filter_id,
  29. .dma_tx_param = "ssp0_tx",
  30. .dma_rx_param = "ssp0_rx",
  31. /*
  32. * This is number of spi devices that can be connected to spi. There are
  33. * two type of chipselects on which slave devices can work. One is chip
  34. * select provided by spi masters other is controlled through external
  35. * gpio's. We can't use chipselect provided from spi master (because as
  36. * soon as FIFO becomes empty, CS is disabled and transfer ends). So
  37. * this number now depends on number of gpios available for spi. each
  38. * slave on each master requires a separate gpio pin.
  39. */
  40. .num_chipselect = 2,
  41. };
  42. /* dmac device registration */
  43. struct pl08x_platform_data pl080_plat_data = {
  44. .memcpy_channel = {
  45. .bus_id = "memcpy",
  46. .cctl_memcpy =
  47. (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \
  48. PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \
  49. PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \
  50. PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \
  51. PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \
  52. PL080_CONTROL_PROT_SYS),
  53. },
  54. .lli_buses = PL08X_AHB1,
  55. .mem_buses = PL08X_AHB1,
  56. .get_signal = pl080_get_signal,
  57. .put_signal = pl080_put_signal,
  58. };
  59. /*
  60. * Following will create 16MB static virtual/physical mappings
  61. * PHYSICAL VIRTUAL
  62. * 0xD0000000 0xFD000000
  63. * 0xFC000000 0xFC000000
  64. */
  65. struct map_desc spear3xx_io_desc[] __initdata = {
  66. {
  67. .virtual = VA_SPEAR3XX_ICM1_2_BASE,
  68. .pfn = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE),
  69. .length = SZ_16M,
  70. .type = MT_DEVICE
  71. }, {
  72. .virtual = VA_SPEAR3XX_ICM3_SMI_CTRL_BASE,
  73. .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE),
  74. .length = SZ_16M,
  75. .type = MT_DEVICE
  76. },
  77. };
  78. /* This will create static memory mapping for selected devices */
  79. void __init spear3xx_map_io(void)
  80. {
  81. iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
  82. }
  83. static void __init spear3xx_timer_init(void)
  84. {
  85. char pclk_name[] = "pll3_clk";
  86. struct clk *gpt_clk, *pclk;
  87. spear3xx_clk_init();
  88. /* get the system timer clock */
  89. gpt_clk = clk_get_sys("gpt0", NULL);
  90. if (IS_ERR(gpt_clk)) {
  91. pr_err("%s:couldn't get clk for gpt\n", __func__);
  92. BUG();
  93. }
  94. /* get the suitable parent clock for timer*/
  95. pclk = clk_get(NULL, pclk_name);
  96. if (IS_ERR(pclk)) {
  97. pr_err("%s:couldn't get %s as parent for gpt\n",
  98. __func__, pclk_name);
  99. BUG();
  100. }
  101. clk_set_parent(gpt_clk, pclk);
  102. clk_put(gpt_clk);
  103. clk_put(pclk);
  104. spear_setup_of_timer();
  105. }
  106. struct sys_timer spear3xx_timer = {
  107. .init = spear3xx_timer_init,
  108. };
  109. static const struct of_device_id vic_of_match[] __initconst = {
  110. { .compatible = "arm,pl190-vic", .data = vic_of_init, },
  111. { .compatible = "st,spear300-shirq", .data = spear300_shirq_of_init, },
  112. { .compatible = "st,spear310-shirq", .data = spear310_shirq_of_init, },
  113. { .compatible = "st,spear320-shirq", .data = spear320_shirq_of_init, },
  114. { /* Sentinel */ }
  115. };
  116. void __init spear3xx_dt_init_irq(void)
  117. {
  118. of_irq_init(vic_of_match);
  119. }