mx31ads.c 3.7 KB

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