blob: 4c7be87a7c9d17e57857e0376ce2ddc9fd53a6e7 [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
Dinh Nguyen71c2e512010-05-27 10:45:04 -050020static struct resource mxc_hsi2c_resources[] = {
21 {
22 .start = MX51_HSI2C_DMA_BASE_ADDR,
23 .end = MX51_HSI2C_DMA_BASE_ADDR + SZ_16K - 1,
24 .flags = IORESOURCE_MEM,
25 },
26 {
27 .start = MX51_MXC_INT_HS_I2C,
28 .end = MX51_MXC_INT_HS_I2C,
29 .flags = IORESOURCE_IRQ,
30 },
31};
32
33struct platform_device mxc_hsi2c_device = {
34 .name = "imx-i2c",
35 .id = 2,
36 .num_resources = ARRAY_SIZE(mxc_hsi2c_resources),
37 .resource = mxc_hsi2c_resources
38};
39
Dinh Nguyenc53bdf12010-04-30 15:48:24 -050040static u64 usb_dma_mask = DMA_BIT_MASK(32);
41
42static struct resource usbotg_resources[] = {
43 {
44 .start = MX51_OTG_BASE_ADDR,
45 .end = MX51_OTG_BASE_ADDR + 0x1ff,
46 .flags = IORESOURCE_MEM,
47 },
48 {
49 .start = MX51_MXC_INT_USB_OTG,
50 .flags = IORESOURCE_IRQ,
51 },
52};
53
Dinh Nguyen2ba5a2c2010-05-10 13:45:59 -050054/* OTG gadget device */
55struct platform_device mxc_usbdr_udc_device = {
56 .name = "fsl-usb2-udc",
57 .id = -1,
58 .num_resources = ARRAY_SIZE(usbotg_resources),
59 .resource = usbotg_resources,
60 .dev = {
61 .dma_mask = &usb_dma_mask,
62 .coherent_dma_mask = DMA_BIT_MASK(32),
63 },
64};
65
Dinh Nguyenc53bdf12010-04-30 15:48:24 -050066struct platform_device mxc_usbdr_host_device = {
67 .name = "mxc-ehci",
68 .id = 0,
69 .num_resources = ARRAY_SIZE(usbotg_resources),
70 .resource = usbotg_resources,
71 .dev = {
72 .dma_mask = &usb_dma_mask,
73 .coherent_dma_mask = DMA_BIT_MASK(32),
74 },
75};
76
77static struct resource usbh1_resources[] = {
78 {
79 .start = MX51_OTG_BASE_ADDR + 0x200,
80 .end = MX51_OTG_BASE_ADDR + 0x200 + 0x1ff,
81 .flags = IORESOURCE_MEM,
82 },
83 {
84 .start = MX51_MXC_INT_USB_H1,
85 .flags = IORESOURCE_IRQ,
86 },
87};
88
89struct platform_device mxc_usbh1_device = {
90 .name = "mxc-ehci",
91 .id = 1,
92 .num_resources = ARRAY_SIZE(usbh1_resources),
93 .resource = usbh1_resources,
94 .dev = {
95 .dma_mask = &usb_dma_mask,
96 .coherent_dma_mask = DMA_BIT_MASK(32),
97 },
98};
99
Wolfram Sang4a870fc2010-05-17 12:33:43 +0200100static struct resource mxc_wdt_resources[] = {
101 {
102 .start = MX51_WDOG_BASE_ADDR,
103 .end = MX51_WDOG_BASE_ADDR + SZ_16K - 1,
104 .flags = IORESOURCE_MEM,
105 },
106};
107
108struct platform_device mxc_wdt = {
109 .name = "imx2-wdt",
110 .id = 0,
111 .num_resources = ARRAY_SIZE(mxc_wdt_resources),
112 .resource = mxc_wdt_resources,
113};
114
Jason Wanga7ebd932010-07-14 21:24:53 +0800115static struct resource mxc_kpp_resources[] = {
116 {
117 .start = MX51_MXC_INT_KPP,
118 .end = MX51_MXC_INT_KPP,
119 .flags = IORESOURCE_IRQ,
120 } , {
121 .start = MX51_KPP_BASE_ADDR,
122 .end = MX51_KPP_BASE_ADDR + 0x8 - 1,
123 .flags = IORESOURCE_MEM,
124 },
125};
126
127struct platform_device mxc_keypad_device = {
128 .name = "imx-keypad",
129 .id = 0,
130 .num_resources = ARRAY_SIZE(mxc_kpp_resources),
131 .resource = mxc_kpp_resources,
132};
133
Dinh Nguyene24798e2010-04-22 16:28:42 +0300134static struct mxc_gpio_port mxc_gpio_ports[] = {
135 {
136 .chip.label = "gpio-0",
137 .base = MX51_IO_ADDRESS(MX51_GPIO1_BASE_ADDR),
138 .irq = MX51_MXC_INT_GPIO1_LOW,
Eric Bénardaa872142010-07-21 14:46:11 +0200139 .irq_high = MX51_MXC_INT_GPIO1_HIGH,
Dinh Nguyene24798e2010-04-22 16:28:42 +0300140 .virtual_irq_start = MXC_GPIO_IRQ_START
141 },
142 {
143 .chip.label = "gpio-1",
144 .base = MX51_IO_ADDRESS(MX51_GPIO2_BASE_ADDR),
145 .irq = MX51_MXC_INT_GPIO2_LOW,
Eric Bénardaa872142010-07-21 14:46:11 +0200146 .irq_high = MX51_MXC_INT_GPIO2_HIGH,
Dinh Nguyene24798e2010-04-22 16:28:42 +0300147 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 1
148 },
149 {
150 .chip.label = "gpio-2",
151 .base = MX51_IO_ADDRESS(MX51_GPIO3_BASE_ADDR),
152 .irq = MX51_MXC_INT_GPIO3_LOW,
Eric Bénardaa872142010-07-21 14:46:11 +0200153 .irq_high = MX51_MXC_INT_GPIO3_HIGH,
Dinh Nguyene24798e2010-04-22 16:28:42 +0300154 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 2
155 },
156 {
157 .chip.label = "gpio-3",
158 .base = MX51_IO_ADDRESS(MX51_GPIO4_BASE_ADDR),
159 .irq = MX51_MXC_INT_GPIO4_LOW,
Eric Bénardaa872142010-07-21 14:46:11 +0200160 .irq_high = MX51_MXC_INT_GPIO4_HIGH,
Dinh Nguyene24798e2010-04-22 16:28:42 +0300161 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 3
162 },
163};
164
Uwe Kleine-König9a763bf2010-06-10 17:11:06 +0200165int __init imx51_register_gpios(void)
Amit Kucheriaa329b482010-02-04 12:21:53 -0800166{
Dinh Nguyene24798e2010-04-22 16:28:42 +0300167 return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports));
Amit Kucheriaa329b482010-02-04 12:21:53 -0800168}