devices.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*
  2. * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  3. * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. #include <linux/module.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/serial.h>
  22. #include <linux/gpio.h>
  23. #include <mach/hardware.h>
  24. #include <mach/irqs.h>
  25. #include <mach/imx-uart.h>
  26. static struct resource uart0[] = {
  27. {
  28. .start = UART1_BASE_ADDR,
  29. .end = UART1_BASE_ADDR + 0x0B5,
  30. .flags = IORESOURCE_MEM,
  31. }, {
  32. .start = MXC_INT_UART1,
  33. .end = MXC_INT_UART1,
  34. .flags = IORESOURCE_IRQ,
  35. },
  36. };
  37. struct platform_device mxc_uart_device0 = {
  38. .name = "imx-uart",
  39. .id = 0,
  40. .resource = uart0,
  41. .num_resources = ARRAY_SIZE(uart0),
  42. };
  43. static struct resource uart1[] = {
  44. {
  45. .start = UART2_BASE_ADDR,
  46. .end = UART2_BASE_ADDR + 0x0B5,
  47. .flags = IORESOURCE_MEM,
  48. }, {
  49. .start = MXC_INT_UART2,
  50. .end = MXC_INT_UART2,
  51. .flags = IORESOURCE_IRQ,
  52. },
  53. };
  54. struct platform_device mxc_uart_device1 = {
  55. .name = "imx-uart",
  56. .id = 1,
  57. .resource = uart1,
  58. .num_resources = ARRAY_SIZE(uart1),
  59. };
  60. static struct resource uart2[] = {
  61. {
  62. .start = UART3_BASE_ADDR,
  63. .end = UART3_BASE_ADDR + 0x0B5,
  64. .flags = IORESOURCE_MEM,
  65. }, {
  66. .start = MXC_INT_UART3,
  67. .end = MXC_INT_UART3,
  68. .flags = IORESOURCE_IRQ,
  69. },
  70. };
  71. struct platform_device mxc_uart_device2 = {
  72. .name = "imx-uart",
  73. .id = 2,
  74. .resource = uart2,
  75. .num_resources = ARRAY_SIZE(uart2),
  76. };
  77. static struct resource uart3[] = {
  78. {
  79. .start = UART4_BASE_ADDR,
  80. .end = UART4_BASE_ADDR + 0x0B5,
  81. .flags = IORESOURCE_MEM,
  82. }, {
  83. .start = MXC_INT_UART4,
  84. .end = MXC_INT_UART4,
  85. .flags = IORESOURCE_IRQ,
  86. },
  87. };
  88. struct platform_device mxc_uart_device3 = {
  89. .name = "imx-uart",
  90. .id = 3,
  91. .resource = uart3,
  92. .num_resources = ARRAY_SIZE(uart3),
  93. };
  94. static struct resource uart4[] = {
  95. {
  96. .start = UART5_BASE_ADDR,
  97. .end = UART5_BASE_ADDR + 0x0B5,
  98. .flags = IORESOURCE_MEM,
  99. }, {
  100. .start = MXC_INT_UART5,
  101. .end = MXC_INT_UART5,
  102. .flags = IORESOURCE_IRQ,
  103. },
  104. };
  105. struct platform_device mxc_uart_device4 = {
  106. .name = "imx-uart",
  107. .id = 4,
  108. .resource = uart4,
  109. .num_resources = ARRAY_SIZE(uart4),
  110. };
  111. /* GPIO port description */
  112. static struct mxc_gpio_port imx_gpio_ports[] = {
  113. [0] = {
  114. .chip.label = "gpio-0",
  115. .base = IO_ADDRESS(GPIO1_BASE_ADDR),
  116. .irq = MXC_INT_GPIO1,
  117. .virtual_irq_start = MXC_GPIO_IRQ_START,
  118. },
  119. [1] = {
  120. .chip.label = "gpio-1",
  121. .base = IO_ADDRESS(GPIO2_BASE_ADDR),
  122. .irq = MXC_INT_GPIO2,
  123. .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
  124. },
  125. [2] = {
  126. .chip.label = "gpio-2",
  127. .base = IO_ADDRESS(GPIO3_BASE_ADDR),
  128. .irq = MXC_INT_GPIO3,
  129. .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
  130. }
  131. };
  132. int __init mxc_register_gpios(void)
  133. {
  134. return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
  135. }
  136. static struct resource mxc_w1_master_resources[] = {
  137. {
  138. .start = OWIRE_BASE_ADDR,
  139. .end = OWIRE_BASE_ADDR + SZ_4K - 1,
  140. .flags = IORESOURCE_MEM,
  141. },
  142. };
  143. struct platform_device mxc_w1_master_device = {
  144. .name = "mxc_w1",
  145. .id = 0,
  146. .num_resources = ARRAY_SIZE(mxc_w1_master_resources),
  147. .resource = mxc_w1_master_resources,
  148. };
  149. static struct resource mxc_nand_resources[] = {
  150. {
  151. .start = NFC_BASE_ADDR,
  152. .end = NFC_BASE_ADDR + 0xfff,
  153. .flags = IORESOURCE_MEM
  154. }, {
  155. .start = MXC_INT_NANDFC,
  156. .end = MXC_INT_NANDFC,
  157. .flags = IORESOURCE_IRQ
  158. },
  159. };
  160. struct platform_device mxc_nand_device = {
  161. .name = "mxc_nand",
  162. .id = 0,
  163. .num_resources = ARRAY_SIZE(mxc_nand_resources),
  164. .resource = mxc_nand_resources,
  165. };