mx31ads.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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 <mach/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 <mach/common.h>
  31. #include <mach/board-mx31ads.h>
  32. #include <mach/imx-uart.h>
  33. #include <mach/iomux-mx3.h>
  34. /*!
  35. * @file mx31ads.c
  36. *
  37. * @brief This file contains the board-specific initialization routines.
  38. *
  39. * @ingroup System
  40. */
  41. #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
  42. /*!
  43. * The serial port definition structure.
  44. */
  45. static struct plat_serial8250_port serial_platform_data[] = {
  46. {
  47. .membase = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTA),
  48. .mapbase = (unsigned long)(CS4_BASE_ADDR + PBC_SC16C652_UARTA),
  49. .irq = EXPIO_INT_XUART_INTA,
  50. .uartclk = 14745600,
  51. .regshift = 0,
  52. .iotype = UPIO_MEM,
  53. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
  54. }, {
  55. .membase = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTB),
  56. .mapbase = (unsigned long)(CS4_BASE_ADDR + PBC_SC16C652_UARTB),
  57. .irq = EXPIO_INT_XUART_INTB,
  58. .uartclk = 14745600,
  59. .regshift = 0,
  60. .iotype = UPIO_MEM,
  61. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
  62. },
  63. {},
  64. };
  65. static struct platform_device serial_device = {
  66. .name = "serial8250",
  67. .id = 0,
  68. .dev = {
  69. .platform_data = serial_platform_data,
  70. },
  71. };
  72. static int __init mxc_init_extuart(void)
  73. {
  74. return platform_device_register(&serial_device);
  75. }
  76. #else
  77. static inline int mxc_init_extuart(void)
  78. {
  79. return 0;
  80. }
  81. #endif
  82. #if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
  83. static struct imxuart_platform_data uart_pdata = {
  84. .flags = IMXUART_HAVE_RTSCTS,
  85. };
  86. static inline void mxc_init_imx_uart(void)
  87. {
  88. mxc_iomux_mode(MX31_PIN_CTS1__CTS1);
  89. mxc_iomux_mode(MX31_PIN_RTS1__RTS1);
  90. mxc_iomux_mode(MX31_PIN_TXD1__TXD1);
  91. mxc_iomux_mode(MX31_PIN_RXD1__RXD1);
  92. mxc_register_device(&mxc_uart_device0, &uart_pdata);
  93. }
  94. #else /* !SERIAL_IMX */
  95. static inline void mxc_init_imx_uart(void)
  96. {
  97. }
  98. #endif /* !SERIAL_IMX */
  99. /*!
  100. * This structure defines static mappings for the i.MX31ADS board.
  101. */
  102. static struct map_desc mx31ads_io_desc[] __initdata = {
  103. {
  104. .virtual = AIPS1_BASE_ADDR_VIRT,
  105. .pfn = __phys_to_pfn(AIPS1_BASE_ADDR),
  106. .length = AIPS1_SIZE,
  107. .type = MT_NONSHARED_DEVICE
  108. }, {
  109. .virtual = SPBA0_BASE_ADDR_VIRT,
  110. .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
  111. .length = SPBA0_SIZE,
  112. .type = MT_NONSHARED_DEVICE
  113. }, {
  114. .virtual = AIPS2_BASE_ADDR_VIRT,
  115. .pfn = __phys_to_pfn(AIPS2_BASE_ADDR),
  116. .length = AIPS2_SIZE,
  117. .type = MT_NONSHARED_DEVICE
  118. }, {
  119. .virtual = CS4_BASE_ADDR_VIRT,
  120. .pfn = __phys_to_pfn(CS4_BASE_ADDR),
  121. .length = CS4_SIZE / 2,
  122. .type = MT_DEVICE
  123. },
  124. };
  125. /*!
  126. * Set up static virtual mappings.
  127. */
  128. void __init mx31ads_map_io(void)
  129. {
  130. mxc_map_io();
  131. iotable_init(mx31ads_io_desc, ARRAY_SIZE(mx31ads_io_desc));
  132. }
  133. /*!
  134. * Board specific initialization.
  135. */
  136. static void __init mxc_board_init(void)
  137. {
  138. mxc_init_extuart();
  139. mxc_init_imx_uart();
  140. }
  141. static void __init mx31ads_timer_init(void)
  142. {
  143. mxc_clocks_init(26000000);
  144. mxc_timer_init("ipg_clk.0");
  145. }
  146. struct sys_timer mx31ads_timer = {
  147. .init = mx31ads_timer_init,
  148. };
  149. /*
  150. * The following uses standard kernel macros defined in arch.h in order to
  151. * initialize __mach_desc_MX31ADS data structure.
  152. */
  153. MACHINE_START(MX31ADS, "Freescale MX31ADS")
  154. /* Maintainer: Freescale Semiconductor, Inc. */
  155. .phys_io = AIPS1_BASE_ADDR,
  156. .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
  157. .boot_params = PHYS_OFFSET + 0x100,
  158. .map_io = mx31ads_map_io,
  159. .init_irq = mxc_init_irq,
  160. .init_machine = mxc_board_init,
  161. .timer = &mx31ads_timer,
  162. MACHINE_END