mx31ads.c 3.8 KB

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