devices.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /*
  2. * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  3. * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
  4. * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
  5. * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  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., 51 Franklin Street, Fifth Floor,
  19. * Boston, MA 02110-1301, USA.
  20. */
  21. #include <linux/kernel.h>
  22. #include <linux/init.h>
  23. #include <linux/dma-mapping.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/gpio.h>
  26. #include <mach/irqs.h>
  27. #include <mach/hardware.h>
  28. #include "devices.h"
  29. static struct resource imx1_camera_resources[] = {
  30. {
  31. .start = 0x00224000,
  32. .end = 0x00224010,
  33. .flags = IORESOURCE_MEM,
  34. }, {
  35. .start = MX1_CSI_INT,
  36. .end = MX1_CSI_INT,
  37. .flags = IORESOURCE_IRQ,
  38. },
  39. };
  40. static u64 imx1_camera_dmamask = DMA_BIT_MASK(32);
  41. struct platform_device imx1_camera_device = {
  42. .name = "mx1-camera",
  43. .id = 0, /* This is used to put cameras on this interface */
  44. .dev = {
  45. .dma_mask = &imx1_camera_dmamask,
  46. .coherent_dma_mask = DMA_BIT_MASK(32),
  47. },
  48. .resource = imx1_camera_resources,
  49. .num_resources = ARRAY_SIZE(imx1_camera_resources),
  50. };
  51. static struct resource imx_i2c_resources[] = {
  52. {
  53. .start = 0x00217000,
  54. .end = 0x00217010,
  55. .flags = IORESOURCE_MEM,
  56. }, {
  57. .start = MX1_I2C_INT,
  58. .end = MX1_I2C_INT,
  59. .flags = IORESOURCE_IRQ,
  60. },
  61. };
  62. struct platform_device imx_i2c_device0 = {
  63. .name = "imx-i2c",
  64. .id = 0,
  65. .resource = imx_i2c_resources,
  66. .num_resources = ARRAY_SIZE(imx_i2c_resources),
  67. };
  68. static struct resource imx_uart1_resources[] = {
  69. {
  70. .start = MX1_UART1_BASE_ADDR,
  71. .end = MX1_UART1_BASE_ADDR + 0xD0,
  72. .flags = IORESOURCE_MEM,
  73. }, {
  74. .start = MX1_UART1_MINT_RX,
  75. .end = MX1_UART1_MINT_RX,
  76. .flags = IORESOURCE_IRQ,
  77. }, {
  78. .start = MX1_UART1_MINT_TX,
  79. .end = MX1_UART1_MINT_TX,
  80. .flags = IORESOURCE_IRQ,
  81. }, {
  82. .start = MX1_UART1_MINT_RTS,
  83. .end = MX1_UART1_MINT_RTS,
  84. .flags = IORESOURCE_IRQ,
  85. },
  86. };
  87. struct platform_device imx_uart1_device = {
  88. .name = "imx-uart",
  89. .id = 0,
  90. .num_resources = ARRAY_SIZE(imx_uart1_resources),
  91. .resource = imx_uart1_resources,
  92. };
  93. static struct resource imx_uart2_resources[] = {
  94. {
  95. .start = MX1_UART2_BASE_ADDR,
  96. .end = MX1_UART2_BASE_ADDR + 0xD0,
  97. .flags = IORESOURCE_MEM,
  98. }, {
  99. .start = MX1_UART2_MINT_RX,
  100. .end = MX1_UART2_MINT_RX,
  101. .flags = IORESOURCE_IRQ,
  102. }, {
  103. .start = MX1_UART2_MINT_TX,
  104. .end = MX1_UART2_MINT_TX,
  105. .flags = IORESOURCE_IRQ,
  106. }, {
  107. .start = MX1_UART2_MINT_RTS,
  108. .end = MX1_UART2_MINT_RTS,
  109. .flags = IORESOURCE_IRQ,
  110. },
  111. };
  112. struct platform_device imx_uart2_device = {
  113. .name = "imx-uart",
  114. .id = 1,
  115. .num_resources = ARRAY_SIZE(imx_uart2_resources),
  116. .resource = imx_uart2_resources,
  117. };
  118. static struct resource imx_rtc_resources[] = {
  119. {
  120. .start = 0x00204000,
  121. .end = 0x00204024,
  122. .flags = IORESOURCE_MEM,
  123. }, {
  124. .start = MX1_RTC_INT,
  125. .end = MX1_RTC_INT,
  126. .flags = IORESOURCE_IRQ,
  127. }, {
  128. .start = MX1_RTC_SAMINT,
  129. .end = MX1_RTC_SAMINT,
  130. .flags = IORESOURCE_IRQ,
  131. },
  132. };
  133. struct platform_device imx_rtc_device = {
  134. .name = "rtc-imx",
  135. .id = 0,
  136. .resource = imx_rtc_resources,
  137. .num_resources = ARRAY_SIZE(imx_rtc_resources),
  138. };
  139. static struct resource imx_wdt_resources[] = {
  140. {
  141. .start = 0x00201000,
  142. .end = 0x00201008,
  143. .flags = IORESOURCE_MEM,
  144. }, {
  145. .start = MX1_WDT_INT,
  146. .end = MX1_WDT_INT,
  147. .flags = IORESOURCE_IRQ,
  148. },
  149. };
  150. struct platform_device imx_wdt_device = {
  151. .name = "imx-wdt",
  152. .id = 0,
  153. .resource = imx_wdt_resources,
  154. .num_resources = ARRAY_SIZE(imx_wdt_resources),
  155. };
  156. static struct resource imx_usb_resources[] = {
  157. {
  158. .start = 0x00212000,
  159. .end = 0x00212148,
  160. .flags = IORESOURCE_MEM,
  161. }, {
  162. .start = MX1_USBD_INT0,
  163. .end = MX1_USBD_INT0,
  164. .flags = IORESOURCE_IRQ,
  165. }, {
  166. .start = MX1_USBD_INT1,
  167. .end = MX1_USBD_INT1,
  168. .flags = IORESOURCE_IRQ,
  169. }, {
  170. .start = MX1_USBD_INT2,
  171. .end = MX1_USBD_INT2,
  172. .flags = IORESOURCE_IRQ,
  173. }, {
  174. .start = MX1_USBD_INT3,
  175. .end = MX1_USBD_INT3,
  176. .flags = IORESOURCE_IRQ,
  177. }, {
  178. .start = MX1_USBD_INT4,
  179. .end = MX1_USBD_INT4,
  180. .flags = IORESOURCE_IRQ,
  181. }, {
  182. .start = MX1_USBD_INT5,
  183. .end = MX1_USBD_INT5,
  184. .flags = IORESOURCE_IRQ,
  185. }, {
  186. .start = MX1_USBD_INT6,
  187. .end = MX1_USBD_INT6,
  188. .flags = IORESOURCE_IRQ,
  189. },
  190. };
  191. struct platform_device imx_usb_device = {
  192. .name = "imx_udc",
  193. .id = 0,
  194. .num_resources = ARRAY_SIZE(imx_usb_resources),
  195. .resource = imx_usb_resources,
  196. };
  197. /* GPIO port description */
  198. static struct mxc_gpio_port imx_gpio_ports[] = {
  199. {
  200. .chip.label = "gpio-0",
  201. .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR),
  202. .irq = MX1_GPIO_INT_PORTA,
  203. .virtual_irq_start = MXC_GPIO_IRQ_START,
  204. }, {
  205. .chip.label = "gpio-1",
  206. .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x100),
  207. .irq = MX1_GPIO_INT_PORTB,
  208. .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
  209. }, {
  210. .chip.label = "gpio-2",
  211. .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x200),
  212. .irq = MX1_GPIO_INT_PORTC,
  213. .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
  214. }, {
  215. .chip.label = "gpio-3",
  216. .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x300),
  217. .irq = MX1_GPIO_INT_PORTD,
  218. .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
  219. }
  220. };
  221. int __init imx1_register_gpios(void)
  222. {
  223. return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
  224. }