mx31ads.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Copyright (C) 2000 Deep Blue Solutions Ltd
  3. * Copyright (C) 2002 Shane Nay (shane@minirl.com)
  4. * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #include <linux/types.h>
  21. #include <linux/init.h>
  22. #include <linux/clk.h>
  23. #include <linux/serial_8250.h>
  24. #include <asm/hardware.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/time.h>
  28. #include <asm/memory.h>
  29. #include <asm/mach/map.h>
  30. #include <asm/arch/common.h>
  31. #include <asm/arch/board-mx31ads.h>
  32. /*!
  33. * @file mx31ads.c
  34. *
  35. * @brief This file contains the board-specific initialization routines.
  36. *
  37. * @ingroup System
  38. */
  39. #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
  40. /*!
  41. * The serial port definition structure.
  42. */
  43. static struct plat_serial8250_port serial_platform_data[] = {
  44. {
  45. .membase = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTA),
  46. .mapbase = (unsigned long)(CS4_BASE_ADDR + PBC_SC16C652_UARTA),
  47. .irq = EXPIO_INT_XUART_INTA,
  48. .uartclk = 14745600,
  49. .regshift = 0,
  50. .iotype = UPIO_MEM,
  51. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
  52. }, {
  53. .membase = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTB),
  54. .mapbase = (unsigned long)(CS4_BASE_ADDR + PBC_SC16C652_UARTB),
  55. .irq = EXPIO_INT_XUART_INTB,
  56. .uartclk = 14745600,
  57. .regshift = 0,
  58. .iotype = UPIO_MEM,
  59. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
  60. },
  61. {},
  62. };
  63. static struct platform_device serial_device = {
  64. .name = "serial8250",
  65. .id = 0,
  66. .dev = {
  67. .platform_data = serial_platform_data,
  68. },
  69. };
  70. static int __init mxc_init_extuart(void)
  71. {
  72. return platform_device_register(&serial_device);
  73. }
  74. #else
  75. static inline int mxc_init_extuart(void)
  76. {
  77. return 0;
  78. }
  79. #endif
  80. /*!
  81. * This structure defines static mappings for the i.MX31ADS board.
  82. */
  83. static struct map_desc mx31ads_io_desc[] __initdata = {
  84. {
  85. .virtual = AIPS1_BASE_ADDR_VIRT,
  86. .pfn = __phys_to_pfn(AIPS1_BASE_ADDR),
  87. .length = AIPS1_SIZE,
  88. .type = MT_NONSHARED_DEVICE
  89. }, {
  90. .virtual = SPBA0_BASE_ADDR_VIRT,
  91. .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
  92. .length = SPBA0_SIZE,
  93. .type = MT_NONSHARED_DEVICE
  94. }, {
  95. .virtual = AIPS2_BASE_ADDR_VIRT,
  96. .pfn = __phys_to_pfn(AIPS2_BASE_ADDR),
  97. .length = AIPS2_SIZE,
  98. .type = MT_NONSHARED_DEVICE
  99. }, {
  100. .virtual = CS4_BASE_ADDR_VIRT,
  101. .pfn = __phys_to_pfn(CS4_BASE_ADDR),
  102. .length = CS4_SIZE / 2,
  103. .type = MT_DEVICE
  104. },
  105. };
  106. /*!
  107. * Set up static virtual mappings.
  108. */
  109. void __init mx31ads_map_io(void)
  110. {
  111. mxc_map_io();
  112. iotable_init(mx31ads_io_desc, ARRAY_SIZE(mx31ads_io_desc));
  113. }
  114. /*!
  115. * Board specific initialization.
  116. */
  117. static void __init mxc_board_init(void)
  118. {
  119. mxc_init_extuart();
  120. }
  121. static void __init mx31ads_timer_init(void)
  122. {
  123. mxc_clocks_init(26000000);
  124. mxc_timer_init("ipg_clk.0");
  125. }
  126. struct sys_timer mx31ads_timer = {
  127. .init = mx31ads_timer_init,
  128. };
  129. /*
  130. * The following uses standard kernel macros defined in arch.h in order to
  131. * initialize __mach_desc_MX31ADS data structure.
  132. */
  133. MACHINE_START(MX31ADS, "Freescale MX31ADS")
  134. /* Maintainer: Freescale Semiconductor, Inc. */
  135. .phys_io = AIPS1_BASE_ADDR,
  136. .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
  137. .boot_params = PHYS_OFFSET + 0x100,
  138. .map_io = mx31ads_map_io,
  139. .init_irq = mxc_init_irq,
  140. .init_machine = mxc_board_init,
  141. .timer = &mx31ads_timer,
  142. MACHINE_END