spear3xx.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * arch/arm/mach-spear3xx/spear3xx.c
  4. *
  5. * SPEAr3XX machines common source file
  6. *
  7. * Copyright (C) 2009-2012 ST Microelectronics
  8. * Viresh Kumar <[email protected]>
  9. */
  10. #define pr_fmt(fmt) "SPEAr3xx: " fmt
  11. #include <linux/amba/pl022.h>
  12. #include <linux/amba/pl080.h>
  13. #include <linux/clk.h>
  14. #include <linux/clk/spear.h>
  15. #include <linux/io.h>
  16. #include <asm/mach/map.h>
  17. #include "pl080.h"
  18. #include "generic.h"
  19. #include "spear.h"
  20. #include "misc_regs.h"
  21. /* ssp device registration */
  22. struct pl022_ssp_controller pl022_plat_data = {
  23. .bus_id = 0,
  24. .enable_dma = 1,
  25. .dma_filter = pl08x_filter_id,
  26. .dma_tx_param = "ssp0_tx",
  27. .dma_rx_param = "ssp0_rx",
  28. };
  29. /* dmac device registration */
  30. struct pl08x_platform_data pl080_plat_data = {
  31. .memcpy_burst_size = PL08X_BURST_SZ_16,
  32. .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
  33. .memcpy_prot_buff = true,
  34. .memcpy_prot_cache = true,
  35. .lli_buses = PL08X_AHB1,
  36. .mem_buses = PL08X_AHB1,
  37. .get_xfer_signal = pl080_get_signal,
  38. .put_xfer_signal = pl080_put_signal,
  39. };
  40. /*
  41. * Following will create 16MB static virtual/physical mappings
  42. * PHYSICAL VIRTUAL
  43. * 0xD0000000 0xFD000000
  44. * 0xFC000000 0xFC000000
  45. */
  46. struct map_desc spear3xx_io_desc[] __initdata = {
  47. {
  48. .virtual = (unsigned long)VA_SPEAR_ICM1_2_BASE,
  49. .pfn = __phys_to_pfn(SPEAR_ICM1_2_BASE),
  50. .length = SZ_16M,
  51. .type = MT_DEVICE
  52. }, {
  53. .virtual = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE,
  54. .pfn = __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE),
  55. .length = SZ_16M,
  56. .type = MT_DEVICE
  57. },
  58. };
  59. /* This will create static memory mapping for selected devices */
  60. void __init spear3xx_map_io(void)
  61. {
  62. iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
  63. }
  64. void __init spear3xx_timer_init(void)
  65. {
  66. char pclk_name[] = "pll3_clk";
  67. struct clk *gpt_clk, *pclk;
  68. spear3xx_clk_init(MISC_BASE, VA_SPEAR320_SOC_CONFIG_BASE);
  69. /* get the system timer clock */
  70. gpt_clk = clk_get_sys("gpt0", NULL);
  71. if (IS_ERR(gpt_clk)) {
  72. pr_err("%s:couldn't get clk for gpt\n", __func__);
  73. BUG();
  74. }
  75. /* get the suitable parent clock for timer*/
  76. pclk = clk_get(NULL, pclk_name);
  77. if (IS_ERR(pclk)) {
  78. pr_err("%s:couldn't get %s as parent for gpt\n",
  79. __func__, pclk_name);
  80. BUG();
  81. }
  82. clk_set_parent(gpt_clk, pclk);
  83. clk_put(gpt_clk);
  84. clk_put(pclk);
  85. spear_setup_of_timer();
  86. }