mx31lite.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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/kernel.h>
  23. #include <linux/memory.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/gpio.h>
  26. #include <linux/smsc911x.h>
  27. #include <mach/hardware.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/time.h>
  31. #include <asm/mach/map.h>
  32. #include <mach/common.h>
  33. #include <asm/page.h>
  34. #include <asm/setup.h>
  35. #include <mach/board-mx31lite.h>
  36. #include <mach/imx-uart.h>
  37. #include <mach/iomux-mx3.h>
  38. #include <mach/irqs.h>
  39. #include <mach/mxc_nand.h>
  40. #include "devices.h"
  41. /*
  42. * This file contains the board-specific initialization routines.
  43. */
  44. static unsigned int mx31lite_pins[] = {
  45. /* UART1 */
  46. MX31_PIN_CTS1__CTS1,
  47. MX31_PIN_RTS1__RTS1,
  48. MX31_PIN_TXD1__TXD1,
  49. MX31_PIN_RXD1__RXD1,
  50. /* LAN9117 IRQ pin */
  51. IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO),
  52. };
  53. static struct imxuart_platform_data uart_pdata = {
  54. .flags = IMXUART_HAVE_RTSCTS,
  55. };
  56. static struct mxc_nand_platform_data mx31lite_nand_board_info = {
  57. .width = 1,
  58. .hw_ecc = 1,
  59. };
  60. static struct smsc911x_platform_config smsc911x_config = {
  61. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  62. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  63. .flags = SMSC911X_USE_16BIT,
  64. };
  65. static struct resource smsc911x_resources[] = {
  66. {
  67. .start = CS4_BASE_ADDR,
  68. .end = CS4_BASE_ADDR + 0x100,
  69. .flags = IORESOURCE_MEM,
  70. }, {
  71. .start = IOMUX_TO_IRQ(MX31_PIN_SFS6),
  72. .end = IOMUX_TO_IRQ(MX31_PIN_SFS6),
  73. .flags = IORESOURCE_IRQ,
  74. },
  75. };
  76. static struct platform_device smsc911x_device = {
  77. .name = "smsc911x",
  78. .id = -1,
  79. .num_resources = ARRAY_SIZE(smsc911x_resources),
  80. .resource = smsc911x_resources,
  81. .dev = {
  82. .platform_data = &smsc911x_config,
  83. },
  84. };
  85. /*
  86. * This structure defines the MX31 memory map.
  87. */
  88. static struct map_desc mx31lite_io_desc[] __initdata = {
  89. {
  90. .virtual = SPBA0_BASE_ADDR_VIRT,
  91. .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
  92. .length = SPBA0_SIZE,
  93. .type = MT_DEVICE_NONSHARED
  94. }, {
  95. .virtual = CS4_BASE_ADDR_VIRT,
  96. .pfn = __phys_to_pfn(CS4_BASE_ADDR),
  97. .length = CS4_SIZE,
  98. .type = MT_DEVICE
  99. }
  100. };
  101. /*
  102. * Set up static virtual mappings.
  103. */
  104. void __init mx31lite_map_io(void)
  105. {
  106. mx31_map_io();
  107. iotable_init(mx31lite_io_desc, ARRAY_SIZE(mx31lite_io_desc));
  108. }
  109. /*
  110. * Board specific initialization.
  111. */
  112. static void __init mxc_board_init(void)
  113. {
  114. int ret;
  115. mxc_iomux_setup_multiple_pins(mx31lite_pins, ARRAY_SIZE(mx31lite_pins),
  116. "mx31lite");
  117. mxc_register_device(&mxc_uart_device0, &uart_pdata);
  118. mxc_register_device(&mxc_nand_device, &mx31lite_nand_board_info);
  119. /* SMSC9117 IRQ pin */
  120. ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
  121. if (ret)
  122. pr_warning("could not get LAN irq gpio\n");
  123. else {
  124. gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_SFS6));
  125. platform_device_register(&smsc911x_device);
  126. }
  127. }
  128. static void __init mx31lite_timer_init(void)
  129. {
  130. mx31_clocks_init(26000000);
  131. }
  132. struct sys_timer mx31lite_timer = {
  133. .init = mx31lite_timer_init,
  134. };
  135. /*
  136. * The following uses standard kernel macros defined in arch.h in order to
  137. * initialize __mach_desc_MX31LITE data structure.
  138. */
  139. MACHINE_START(MX31LITE, "LogicPD MX31 LITEKIT")
  140. /* Maintainer: Freescale Semiconductor, Inc. */
  141. .phys_io = AIPS1_BASE_ADDR,
  142. .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
  143. .boot_params = PHYS_OFFSET + 0x100,
  144. .map_io = mx31lite_map_io,
  145. .init_irq = mx31_init_irq,
  146. .init_machine = mxc_board_init,
  147. .timer = &mx31lite_timer,
  148. MACHINE_END