spear3xx.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 <vireshk@kernel.org>
  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/pl080.h>
  16. #include <linux/clk.h>
  17. #include <linux/io.h>
  18. #include <asm/mach/map.h>
  19. #include "pl080.h"
  20. #include "generic.h"
  21. #include <mach/spear.h>
  22. #include <mach/misc_regs.h>
  23. /* ssp device registration */
  24. struct pl022_ssp_controller pl022_plat_data = {
  25. .bus_id = 0,
  26. .enable_dma = 1,
  27. .dma_filter = pl08x_filter_id,
  28. .dma_tx_param = "ssp0_tx",
  29. .dma_rx_param = "ssp0_rx",
  30. /*
  31. * This is number of spi devices that can be connected to spi. There are
  32. * two type of chipselects on which slave devices can work. One is chip
  33. * select provided by spi masters other is controlled through external
  34. * gpio's. We can't use chipselect provided from spi master (because as
  35. * soon as FIFO becomes empty, CS is disabled and transfer ends). So
  36. * this number now depends on number of gpios available for spi. each
  37. * slave on each master requires a separate gpio pin.
  38. */
  39. .num_chipselect = 2,
  40. };
  41. /* dmac device registration */
  42. struct pl08x_platform_data pl080_plat_data = {
  43. .memcpy_burst_size = PL08X_BURST_SZ_16,
  44. .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
  45. .memcpy_prot_buff = true,
  46. .memcpy_prot_cache = true,
  47. .lli_buses = PL08X_AHB1,
  48. .mem_buses = PL08X_AHB1,
  49. .get_xfer_signal = pl080_get_signal,
  50. .put_xfer_signal = pl080_put_signal,
  51. };
  52. /*
  53. * Following will create 16MB static virtual/physical mappings
  54. * PHYSICAL VIRTUAL
  55. * 0xD0000000 0xFD000000
  56. * 0xFC000000 0xFC000000
  57. */
  58. struct map_desc spear3xx_io_desc[] __initdata = {
  59. {
  60. .virtual = (unsigned long)VA_SPEAR_ICM1_2_BASE,
  61. .pfn = __phys_to_pfn(SPEAR_ICM1_2_BASE),
  62. .length = SZ_16M,
  63. .type = MT_DEVICE
  64. }, {
  65. .virtual = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE,
  66. .pfn = __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE),
  67. .length = SZ_16M,
  68. .type = MT_DEVICE
  69. },
  70. };
  71. /* This will create static memory mapping for selected devices */
  72. void __init spear3xx_map_io(void)
  73. {
  74. iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
  75. }
  76. void __init spear3xx_timer_init(void)
  77. {
  78. char pclk_name[] = "pll3_clk";
  79. struct clk *gpt_clk, *pclk;
  80. spear3xx_clk_init(MISC_BASE, VA_SPEAR320_SOC_CONFIG_BASE);
  81. /* get the system timer clock */
  82. gpt_clk = clk_get_sys("gpt0", NULL);
  83. if (IS_ERR(gpt_clk)) {
  84. pr_err("%s:couldn't get clk for gpt\n", __func__);
  85. BUG();
  86. }
  87. /* get the suitable parent clock for timer*/
  88. pclk = clk_get(NULL, pclk_name);
  89. if (IS_ERR(pclk)) {
  90. pr_err("%s:couldn't get %s as parent for gpt\n",
  91. __func__, pclk_name);
  92. BUG();
  93. }
  94. clk_set_parent(gpt_clk, pclk);
  95. clk_put(gpt_clk);
  96. clk_put(pclk);
  97. spear_setup_of_timer();
  98. }