mm.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
  3. *
  4. * The code contained herein is licensed under the GNU General Public
  5. * License. You may obtain a copy of the GNU General Public License
  6. * Version 2 or later at the following locations:
  7. *
  8. * http://www.opensource.org/licenses/gpl-license.html
  9. * http://www.gnu.org/copyleft/gpl.html
  10. *
  11. * Create static mapping between physical to virtual memory.
  12. */
  13. #include <linux/mm.h>
  14. #include <linux/init.h>
  15. #include <asm/mach/map.h>
  16. #include <mach/hardware.h>
  17. #include <mach/common.h>
  18. #include <mach/iomux-v3.h>
  19. /*
  20. * Define the MX51 memory map.
  21. */
  22. static struct map_desc mxc_io_desc[] __initdata = {
  23. {
  24. .virtual = MX51_IRAM_BASE_ADDR_VIRT,
  25. .pfn = __phys_to_pfn(MX51_IRAM_BASE_ADDR),
  26. .length = MX51_IRAM_SIZE,
  27. .type = MT_DEVICE
  28. }, {
  29. .virtual = MX51_DEBUG_BASE_ADDR_VIRT,
  30. .pfn = __phys_to_pfn(MX51_DEBUG_BASE_ADDR),
  31. .length = MX51_DEBUG_SIZE,
  32. .type = MT_DEVICE
  33. }, {
  34. .virtual = MX51_TZIC_BASE_ADDR_VIRT,
  35. .pfn = __phys_to_pfn(MX51_TZIC_BASE_ADDR),
  36. .length = MX51_TZIC_SIZE,
  37. .type = MT_DEVICE
  38. }, {
  39. .virtual = MX51_AIPS1_BASE_ADDR_VIRT,
  40. .pfn = __phys_to_pfn(MX51_AIPS1_BASE_ADDR),
  41. .length = MX51_AIPS1_SIZE,
  42. .type = MT_DEVICE
  43. }, {
  44. .virtual = MX51_SPBA0_BASE_ADDR_VIRT,
  45. .pfn = __phys_to_pfn(MX51_SPBA0_BASE_ADDR),
  46. .length = MX51_SPBA0_SIZE,
  47. .type = MT_DEVICE
  48. }, {
  49. .virtual = MX51_AIPS2_BASE_ADDR_VIRT,
  50. .pfn = __phys_to_pfn(MX51_AIPS2_BASE_ADDR),
  51. .length = MX51_AIPS2_SIZE,
  52. .type = MT_DEVICE
  53. }, {
  54. .virtual = MX51_NFC_AXI_BASE_ADDR_VIRT,
  55. .pfn = __phys_to_pfn(MX51_NFC_AXI_BASE_ADDR),
  56. .length = MX51_NFC_AXI_SIZE,
  57. .type = MT_DEVICE
  58. },
  59. };
  60. /*
  61. * This function initializes the memory map. It is called during the
  62. * system startup to create static physical to virtual memory mappings
  63. * for the IO modules.
  64. */
  65. void __init mx51_map_io(void)
  66. {
  67. u32 tzic_addr;
  68. if (mx51_revision() < MX51_CHIP_REV_2_0)
  69. tzic_addr = 0x8FFFC000;
  70. else
  71. tzic_addr = 0xE0003000;
  72. mxc_io_desc[2].pfn = __phys_to_pfn(tzic_addr);
  73. mxc_set_cpu_type(MXC_CPU_MX51);
  74. mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
  75. mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG_BASE_ADDR));
  76. iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
  77. }
  78. void __init mx51_init_irq(void)
  79. {
  80. tzic_init_irq(MX51_IO_ADDRESS(MX51_TZIC_BASE_ADDR));
  81. }