sama5.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Setup code for SAMA5
  3. *
  4. * Copyright (C) 2013 Atmel,
  5. * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
  6. *
  7. * Licensed under GPLv2 or later.
  8. */
  9. #include <linux/types.h>
  10. #include <linux/init.h>
  11. #include <linux/module.h>
  12. #include <linux/gpio.h>
  13. #include <linux/of.h>
  14. #include <linux/of_irq.h>
  15. #include <linux/of_platform.h>
  16. #include <linux/clk-provider.h>
  17. #include <mach/hardware.h>
  18. #include <asm/setup.h>
  19. #include <asm/irq.h>
  20. #include <asm/mach/arch.h>
  21. #include <asm/mach/map.h>
  22. #include <asm/mach/irq.h>
  23. #include "generic.h"
  24. static void __init sama5_dt_device_init(void)
  25. {
  26. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  27. at91sam9x5_pm_init();
  28. }
  29. static const char *sama5_dt_board_compat[] __initconst = {
  30. "atmel,sama5",
  31. NULL
  32. };
  33. DT_MACHINE_START(sama5_dt, "Atmel SAMA5")
  34. /* Maintainer: Atmel */
  35. .map_io = at91_map_io,
  36. .init_machine = sama5_dt_device_init,
  37. .dt_compat = sama5_dt_board_compat,
  38. MACHINE_END
  39. static struct map_desc at91_io_desc[] __initdata = {
  40. {
  41. .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_MPDDRC),
  42. .pfn = __phys_to_pfn(SAMA5D4_BASE_MPDDRC),
  43. .length = SZ_512,
  44. .type = MT_DEVICE,
  45. },
  46. {
  47. .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_PMC),
  48. .pfn = __phys_to_pfn(SAMA5D4_BASE_PMC),
  49. .length = SZ_512,
  50. .type = MT_DEVICE,
  51. },
  52. { /* On sama5d4, we use USART3 as serial console */
  53. .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_USART3),
  54. .pfn = __phys_to_pfn(SAMA5D4_BASE_USART3),
  55. .length = SZ_256,
  56. .type = MT_DEVICE,
  57. },
  58. { /* A bunch of peripheral with fine grained IO space */
  59. .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_SYS2),
  60. .pfn = __phys_to_pfn(SAMA5D4_BASE_SYS2),
  61. .length = SZ_2K,
  62. .type = MT_DEVICE,
  63. },
  64. };
  65. static void __init sama5_alt_map_io(void)
  66. {
  67. at91_alt_map_io();
  68. iotable_init(at91_io_desc, ARRAY_SIZE(at91_io_desc));
  69. }
  70. static const char *sama5_alt_dt_board_compat[] __initconst = {
  71. "atmel,sama5d4",
  72. NULL
  73. };
  74. DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5")
  75. /* Maintainer: Atmel */
  76. .map_io = sama5_alt_map_io,
  77. .init_machine = sama5_dt_device_init,
  78. .dt_compat = sama5_alt_dt_board_compat,
  79. .l2c_aux_mask = ~0UL,
  80. MACHINE_END