mx1ads.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * arch/arm/mach-imx/mx1ads.c
  3. *
  4. * Initially based on:
  5. * linux-2.6.7-imx/arch/arm/mach-imx/scb9328.c
  6. * Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
  7. *
  8. * 2004 (c) MontaVista Software, Inc.
  9. *
  10. * This file is licensed under the terms of the GNU General Public
  11. * License version 2. This program is licensed "as is" without any
  12. * warranty of any kind, whether express or implied.
  13. */
  14. #include <linux/device.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <asm/system.h>
  18. #include <mach/hardware.h>
  19. #include <asm/irq.h>
  20. #include <asm/pgtable.h>
  21. #include <asm/page.h>
  22. #include <asm/mach/map.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/arch.h>
  25. #include <mach/mmc.h>
  26. #include <mach/imx-uart.h>
  27. #include <linux/interrupt.h>
  28. #include "generic.h"
  29. static struct resource cs89x0_resources[] = {
  30. [0] = {
  31. .start = IMX_CS4_PHYS + 0x300,
  32. .end = IMX_CS4_PHYS + 0x300 + 16,
  33. .flags = IORESOURCE_MEM,
  34. },
  35. [1] = {
  36. .start = IRQ_GPIOC(17),
  37. .end = IRQ_GPIOC(17),
  38. .flags = IORESOURCE_IRQ,
  39. },
  40. };
  41. static struct platform_device cs89x0_device = {
  42. .name = "cirrus-cs89x0",
  43. .num_resources = ARRAY_SIZE(cs89x0_resources),
  44. .resource = cs89x0_resources,
  45. };
  46. static struct imxuart_platform_data uart_pdata = {
  47. .flags = IMXUART_HAVE_RTSCTS,
  48. };
  49. static struct resource imx_uart1_resources[] = {
  50. [0] = {
  51. .start = 0x00206000,
  52. .end = 0x002060FF,
  53. .flags = IORESOURCE_MEM,
  54. },
  55. [1] = {
  56. .start = (UART1_MINT_RX),
  57. .end = (UART1_MINT_RX),
  58. .flags = IORESOURCE_IRQ,
  59. },
  60. [2] = {
  61. .start = (UART1_MINT_TX),
  62. .end = (UART1_MINT_TX),
  63. .flags = IORESOURCE_IRQ,
  64. },
  65. [3] = {
  66. .start = UART1_MINT_RTS,
  67. .end = UART1_MINT_RTS,
  68. .flags = IORESOURCE_IRQ,
  69. },
  70. };
  71. static struct platform_device imx_uart1_device = {
  72. .name = "imx-uart",
  73. .id = 0,
  74. .num_resources = ARRAY_SIZE(imx_uart1_resources),
  75. .resource = imx_uart1_resources,
  76. .dev = {
  77. .platform_data = &uart_pdata,
  78. }
  79. };
  80. static struct resource imx_uart2_resources[] = {
  81. [0] = {
  82. .start = 0x00207000,
  83. .end = 0x002070FF,
  84. .flags = IORESOURCE_MEM,
  85. },
  86. [1] = {
  87. .start = (UART2_MINT_RX),
  88. .end = (UART2_MINT_RX),
  89. .flags = IORESOURCE_IRQ,
  90. },
  91. [2] = {
  92. .start = (UART2_MINT_TX),
  93. .end = (UART2_MINT_TX),
  94. .flags = IORESOURCE_IRQ,
  95. },
  96. [3] = {
  97. .start = UART2_MINT_RTS,
  98. .end = UART2_MINT_RTS,
  99. .flags = IORESOURCE_IRQ,
  100. },
  101. };
  102. static struct platform_device imx_uart2_device = {
  103. .name = "imx-uart",
  104. .id = 1,
  105. .num_resources = ARRAY_SIZE(imx_uart2_resources),
  106. .resource = imx_uart2_resources,
  107. .dev = {
  108. .platform_data = &uart_pdata,
  109. }
  110. };
  111. static struct platform_device *devices[] __initdata = {
  112. &cs89x0_device,
  113. &imx_uart1_device,
  114. &imx_uart2_device,
  115. };
  116. #if defined(CONFIG_MMC_IMX) || defined(CONFIG_MMC_IMX_MODULE)
  117. static int mx1ads_mmc_card_present(struct device *dev)
  118. {
  119. /* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */
  120. return (SSR(1) & (1 << 20) ? 0 : 1);
  121. }
  122. static struct imxmmc_platform_data mx1ads_mmc_info = {
  123. .card_present = mx1ads_mmc_card_present,
  124. };
  125. #endif
  126. static void __init
  127. mx1ads_init(void)
  128. {
  129. #ifdef CONFIG_LEDS
  130. imx_gpio_mode(GPIO_PORTA | GPIO_OUT | 2);
  131. #endif
  132. #if defined(CONFIG_MMC_IMX) || defined(CONFIG_MMC_IMX_MODULE)
  133. /* SD/MMC card detect */
  134. imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20);
  135. imx_set_mmc_info(&mx1ads_mmc_info);
  136. #endif
  137. imx_gpio_mode(PC9_PF_UART1_CTS);
  138. imx_gpio_mode(PC10_PF_UART1_RTS);
  139. imx_gpio_mode(PC11_PF_UART1_TXD);
  140. imx_gpio_mode(PC12_PF_UART1_RXD);
  141. imx_gpio_mode(PB28_PF_UART2_CTS);
  142. imx_gpio_mode(PB29_PF_UART2_RTS);
  143. imx_gpio_mode(PB30_PF_UART2_TXD);
  144. imx_gpio_mode(PB31_PF_UART2_RXD);
  145. platform_add_devices(devices, ARRAY_SIZE(devices));
  146. }
  147. static void __init
  148. mx1ads_map_io(void)
  149. {
  150. imx_map_io();
  151. }
  152. MACHINE_START(MX1ADS, "Motorola MX1ADS")
  153. /* Maintainer: Sascha Hauer, Pengutronix */
  154. .phys_io = 0x00200000,
  155. .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
  156. .boot_params = 0x08000100,
  157. .map_io = mx1ads_map_io,
  158. .init_irq = imx_init_irq,
  159. .timer = &imx_timer,
  160. .init_machine = mx1ads_init,
  161. MACHINE_END