blob: e6262f31ed8f661547010c0c442a0f4960293285 [file] [log] [blame]
Amit Kucheriaa329b482010-02-04 12:21:53 -08001/*
2 * Copyright 2009 Amit Kucheria <amit.kucheria@canonical.com>
Dinh Nguyene24798e2010-04-22 16:28:42 +03003 * Copyright (C) 2010 Freescale Semiconductor, Inc.
Amit Kucheriaa329b482010-02-04 12:21:53 -08004 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/platform_device.h>
Dinh Nguyenc53bdf12010-04-30 15:48:24 -050014#include <linux/dma-mapping.h>
Dinh Nguyene24798e2010-04-22 16:28:42 +030015#include <linux/gpio.h>
Amit Kucheriaa329b482010-02-04 12:21:53 -080016#include <mach/hardware.h>
17#include <mach/imx-uart.h>
Dinh Nguyene24798e2010-04-22 16:28:42 +030018#include <mach/irqs.h>
Amit Kucheriaa329b482010-02-04 12:21:53 -080019
20static struct resource uart0[] = {
21 {
22 .start = MX51_UART1_BASE_ADDR,
23 .end = MX51_UART1_BASE_ADDR + 0xfff,
24 .flags = IORESOURCE_MEM,
25 }, {
26 .start = MX51_MXC_INT_UART1,
27 .end = MX51_MXC_INT_UART1,
28 .flags = IORESOURCE_IRQ,
29 },
30};
31
32struct platform_device mxc_uart_device0 = {
33 .name = "imx-uart",
34 .id = 0,
35 .resource = uart0,
36 .num_resources = ARRAY_SIZE(uart0),
37};
38
39static struct resource uart1[] = {
40 {
41 .start = MX51_UART2_BASE_ADDR,
42 .end = MX51_UART2_BASE_ADDR + 0xfff,
43 .flags = IORESOURCE_MEM,
44 }, {
45 .start = MX51_MXC_INT_UART2,
46 .end = MX51_MXC_INT_UART2,
47 .flags = IORESOURCE_IRQ,
48 },
49};
50
51struct platform_device mxc_uart_device1 = {
52 .name = "imx-uart",
53 .id = 1,
54 .resource = uart1,
55 .num_resources = ARRAY_SIZE(uart1),
56};
57
58static struct resource uart2[] = {
59 {
60 .start = MX51_UART3_BASE_ADDR,
61 .end = MX51_UART3_BASE_ADDR + 0xfff,
62 .flags = IORESOURCE_MEM,
63 }, {
64 .start = MX51_MXC_INT_UART3,
65 .end = MX51_MXC_INT_UART3,
66 .flags = IORESOURCE_IRQ,
67 },
68};
69
70struct platform_device mxc_uart_device2 = {
71 .name = "imx-uart",
72 .id = 2,
73 .resource = uart2,
74 .num_resources = ARRAY_SIZE(uart2),
75};
76
77static struct resource mxc_fec_resources[] = {
78 {
79 .start = MX51_MXC_FEC_BASE_ADDR,
80 .end = MX51_MXC_FEC_BASE_ADDR + 0xfff,
81 .flags = IORESOURCE_MEM,
82 }, {
83 .start = MX51_MXC_INT_FEC,
84 .end = MX51_MXC_INT_FEC,
85 .flags = IORESOURCE_IRQ,
86 },
87};
88
89struct platform_device mxc_fec_device = {
90 .name = "fec",
91 .id = 0,
92 .num_resources = ARRAY_SIZE(mxc_fec_resources),
93 .resource = mxc_fec_resources,
94};
95
Dinh Nguyenc53bdf12010-04-30 15:48:24 -050096static u64 usb_dma_mask = DMA_BIT_MASK(32);
97
98static struct resource usbotg_resources[] = {
99 {
100 .start = MX51_OTG_BASE_ADDR,
101 .end = MX51_OTG_BASE_ADDR + 0x1ff,
102 .flags = IORESOURCE_MEM,
103 },
104 {
105 .start = MX51_MXC_INT_USB_OTG,
106 .flags = IORESOURCE_IRQ,
107 },
108};
109
110struct platform_device mxc_usbdr_host_device = {
111 .name = "mxc-ehci",
112 .id = 0,
113 .num_resources = ARRAY_SIZE(usbotg_resources),
114 .resource = usbotg_resources,
115 .dev = {
116 .dma_mask = &usb_dma_mask,
117 .coherent_dma_mask = DMA_BIT_MASK(32),
118 },
119};
120
121static struct resource usbh1_resources[] = {
122 {
123 .start = MX51_OTG_BASE_ADDR + 0x200,
124 .end = MX51_OTG_BASE_ADDR + 0x200 + 0x1ff,
125 .flags = IORESOURCE_MEM,
126 },
127 {
128 .start = MX51_MXC_INT_USB_H1,
129 .flags = IORESOURCE_IRQ,
130 },
131};
132
133struct platform_device mxc_usbh1_device = {
134 .name = "mxc-ehci",
135 .id = 1,
136 .num_resources = ARRAY_SIZE(usbh1_resources),
137 .resource = usbh1_resources,
138 .dev = {
139 .dma_mask = &usb_dma_mask,
140 .coherent_dma_mask = DMA_BIT_MASK(32),
141 },
142};
143
Dinh Nguyene24798e2010-04-22 16:28:42 +0300144static struct mxc_gpio_port mxc_gpio_ports[] = {
145 {
146 .chip.label = "gpio-0",
147 .base = MX51_IO_ADDRESS(MX51_GPIO1_BASE_ADDR),
148 .irq = MX51_MXC_INT_GPIO1_LOW,
149 .virtual_irq_start = MXC_GPIO_IRQ_START
150 },
151 {
152 .chip.label = "gpio-1",
153 .base = MX51_IO_ADDRESS(MX51_GPIO2_BASE_ADDR),
154 .irq = MX51_MXC_INT_GPIO2_LOW,
155 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 1
156 },
157 {
158 .chip.label = "gpio-2",
159 .base = MX51_IO_ADDRESS(MX51_GPIO3_BASE_ADDR),
160 .irq = MX51_MXC_INT_GPIO3_LOW,
161 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 2
162 },
163 {
164 .chip.label = "gpio-3",
165 .base = MX51_IO_ADDRESS(MX51_GPIO4_BASE_ADDR),
166 .irq = MX51_MXC_INT_GPIO4_LOW,
167 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 3
168 },
169};
170
Amit Kucheriaa329b482010-02-04 12:21:53 -0800171int __init mxc_register_gpios(void)
172{
Dinh Nguyene24798e2010-04-22 16:28:42 +0300173 return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports));
Amit Kucheriaa329b482010-02-04 12:21:53 -0800174}