mx1ads.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 <asm/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 <asm/arch/mmc.h>
  26. #include <asm/arch/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. };
  66. static struct platform_device imx_uart1_device = {
  67. .name = "imx-uart",
  68. .id = 0,
  69. .num_resources = ARRAY_SIZE(imx_uart1_resources),
  70. .resource = imx_uart1_resources,
  71. .dev = {
  72. .platform_data = &uart_pdata,
  73. }
  74. };
  75. static struct resource imx_uart2_resources[] = {
  76. [0] = {
  77. .start = 0x00207000,
  78. .end = 0x002070FF,
  79. .flags = IORESOURCE_MEM,
  80. },
  81. [1] = {
  82. .start = (UART2_MINT_RX),
  83. .end = (UART2_MINT_RX),
  84. .flags = IORESOURCE_IRQ,
  85. },
  86. [2] = {
  87. .start = (UART2_MINT_TX),
  88. .end = (UART2_MINT_TX),
  89. .flags = IORESOURCE_IRQ,
  90. },
  91. };
  92. static struct platform_device imx_uart2_device = {
  93. .name = "imx-uart",
  94. .id = 1,
  95. .num_resources = ARRAY_SIZE(imx_uart2_resources),
  96. .resource = imx_uart2_resources,
  97. .dev = {
  98. .platform_data = &uart_pdata,
  99. }
  100. };
  101. static struct platform_device *devices[] __initdata = {
  102. &cs89x0_device,
  103. &imx_uart1_device,
  104. &imx_uart2_device,
  105. };
  106. #ifdef CONFIG_MMC_IMX
  107. static int mx1ads_mmc_card_present(void)
  108. {
  109. /* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */
  110. return (SSR(1) & (1 << 20) ? 0 : 1);
  111. }
  112. static struct imxmmc_platform_data mx1ads_mmc_info = {
  113. .card_present = mx1ads_mmc_card_present,
  114. };
  115. #endif
  116. static void __init
  117. mx1ads_init(void)
  118. {
  119. #ifdef CONFIG_LEDS
  120. imx_gpio_mode(GPIO_PORTA | GPIO_OUT | 2);
  121. #endif
  122. #ifdef CONFIG_MMC_IMX
  123. /* SD/MMC card detect */
  124. imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20);
  125. imx_set_mmc_info(&mx1ads_mmc_info);
  126. #endif
  127. imx_gpio_mode(PC9_PF_UART1_CTS);
  128. imx_gpio_mode(PC10_PF_UART1_RTS);
  129. imx_gpio_mode(PC11_PF_UART1_TXD);
  130. imx_gpio_mode(PC12_PF_UART1_RXD);
  131. imx_gpio_mode(PB28_PF_UART2_CTS);
  132. imx_gpio_mode(PB29_PF_UART2_RTS);
  133. imx_gpio_mode(PB30_PF_UART2_TXD);
  134. imx_gpio_mode(PB31_PF_UART2_RXD);
  135. platform_add_devices(devices, ARRAY_SIZE(devices));
  136. }
  137. static void __init
  138. mx1ads_map_io(void)
  139. {
  140. imx_map_io();
  141. }
  142. MACHINE_START(MX1ADS, "Motorola MX1ADS")
  143. /* Maintainer: Sascha Hauer, Pengutronix */
  144. .phys_io = 0x00200000,
  145. .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
  146. .boot_params = 0x08000100,
  147. .map_io = mx1ads_map_io,
  148. .init_irq = imx_init_irq,
  149. .timer = &imx_timer,
  150. .init_machine = mx1ads_init,
  151. MACHINE_END