spear1310.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * arch/arm/mach-spear13xx/spear1310.c
  3. *
  4. * SPEAr1310 machine source file
  5. *
  6. * Copyright (C) 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) "SPEAr1310: " fmt
  14. #include <linux/amba/pl022.h>
  15. #include <linux/of_platform.h>
  16. #include <linux/pata_arasan_cf_data.h>
  17. #include <asm/hardware/gic.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach/map.h>
  20. #include <mach/generic.h>
  21. #include <mach/spear.h>
  22. /* Base addresses */
  23. #define SPEAR1310_SSP1_BASE UL(0x5D400000)
  24. #define SPEAR1310_SATA0_BASE UL(0xB1000000)
  25. #define SPEAR1310_SATA1_BASE UL(0xB1800000)
  26. #define SPEAR1310_SATA2_BASE UL(0xB4000000)
  27. #define SPEAR1310_RAS_GRP1_BASE UL(0xD8000000)
  28. #define VA_SPEAR1310_RAS_GRP1_BASE UL(0xFA000000)
  29. #define SPEAR1310_RAS_BASE UL(0xD8400000)
  30. #define VA_SPEAR1310_RAS_BASE IOMEM(UL(0xFA400000))
  31. static struct arasan_cf_pdata cf_pdata = {
  32. .cf_if_clk = CF_IF_CLK_166M,
  33. .quirk = CF_BROKEN_UDMA,
  34. .dma_priv = &cf_dma_priv,
  35. };
  36. /* ssp device registration */
  37. static struct pl022_ssp_controller ssp1_plat_data = {
  38. .enable_dma = 0,
  39. };
  40. /* Add SPEAr1310 auxdata to pass platform data */
  41. static struct of_dev_auxdata spear1310_auxdata_lookup[] __initdata = {
  42. OF_DEV_AUXDATA("arasan,cf-spear1340", MCIF_CF_BASE, NULL, &cf_pdata),
  43. OF_DEV_AUXDATA("snps,dma-spear1340", DMAC0_BASE, NULL, &dmac_plat_data),
  44. OF_DEV_AUXDATA("snps,dma-spear1340", DMAC1_BASE, NULL, &dmac_plat_data),
  45. OF_DEV_AUXDATA("arm,pl022", SSP_BASE, NULL, &pl022_plat_data),
  46. OF_DEV_AUXDATA("arm,pl022", SPEAR1310_SSP1_BASE, NULL, &ssp1_plat_data),
  47. {}
  48. };
  49. static void __init spear1310_dt_init(void)
  50. {
  51. of_platform_populate(NULL, of_default_bus_match_table,
  52. spear1310_auxdata_lookup, NULL);
  53. }
  54. static const char * const spear1310_dt_board_compat[] = {
  55. "st,spear1310",
  56. "st,spear1310-evb",
  57. NULL,
  58. };
  59. /*
  60. * Following will create 16MB static virtual/physical mappings
  61. * PHYSICAL VIRTUAL
  62. * 0xD8000000 0xFA000000
  63. */
  64. struct map_desc spear1310_io_desc[] __initdata = {
  65. {
  66. .virtual = VA_SPEAR1310_RAS_GRP1_BASE,
  67. .pfn = __phys_to_pfn(SPEAR1310_RAS_GRP1_BASE),
  68. .length = SZ_16M,
  69. .type = MT_DEVICE
  70. },
  71. };
  72. static void __init spear1310_map_io(void)
  73. {
  74. iotable_init(spear1310_io_desc, ARRAY_SIZE(spear1310_io_desc));
  75. spear13xx_map_io();
  76. }
  77. DT_MACHINE_START(SPEAR1310_DT, "ST SPEAr1310 SoC with Flattened Device Tree")
  78. .smp = smp_ops(spear13xx_smp_ops),
  79. .map_io = spear1310_map_io,
  80. .init_irq = spear13xx_dt_init_irq,
  81. .handle_irq = gic_handle_irq,
  82. .timer = &spear13xx_timer,
  83. .init_machine = spear1310_dt_init,
  84. .restart = spear_restart,
  85. .dt_compat = spear1310_dt_board_compat,
  86. MACHINE_END