devices.c 5.7 KB
Newer Older
P
Paulius Zaleckas 已提交
1 2 3 4
/*
 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
 * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
D
Darius Augulis 已提交
5
 * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt>
P
Paulius Zaleckas 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
26
#include <mach/irqs.h>
P
Paulius Zaleckas 已提交
27 28
#include <mach/hardware.h>

S
Sascha Hauer 已提交
29 30
#include "devices.h"

D
Darius Augulis 已提交
31
static struct resource imx_csi_resources[] = {
32
	{
D
Darius Augulis 已提交
33 34 35
		.start  = 0x00224000,
		.end    = 0x00224010,
		.flags  = IORESOURCE_MEM,
36
	}, {
D
Darius Augulis 已提交
37 38 39 40 41 42 43 44 45
		.start  = CSI_INT,
		.end    = CSI_INT,
		.flags  = IORESOURCE_IRQ,
	},
};

static u64 imx_csi_dmamask = 0xffffffffUL;

struct platform_device imx_csi_device = {
46
	.name           = "mx1-camera",
D
Darius Augulis 已提交
47 48 49 50 51 52 53 54 55 56
	.id             = 0, /* This is used to put cameras on this interface */
	.dev		= {
		.dma_mask = &imx_csi_dmamask,
		.coherent_dma_mask = 0xffffffff,
	},
	.resource       = imx_csi_resources,
	.num_resources  = ARRAY_SIZE(imx_csi_resources),
};

static struct resource imx_i2c_resources[] = {
57
	{
D
Darius Augulis 已提交
58 59 60
		.start  = 0x00217000,
		.end    = 0x00217010,
		.flags  = IORESOURCE_MEM,
61
	}, {
D
Darius Augulis 已提交
62 63 64 65 66 67 68 69 70 71 72 73 74
		.start  = I2C_INT,
		.end    = I2C_INT,
		.flags  = IORESOURCE_IRQ,
	},
};

struct platform_device imx_i2c_device = {
	.name           = "imx-i2c",
	.id             = 0,
	.resource       = imx_i2c_resources,
	.num_resources  = ARRAY_SIZE(imx_i2c_resources),
};

P
Paulius Zaleckas 已提交
75
static struct resource imx_uart1_resources[] = {
76
	{
P
Paulius Zaleckas 已提交
77 78 79
		.start	= UART1_BASE_ADDR,
		.end	= UART1_BASE_ADDR + 0xD0,
		.flags	= IORESOURCE_MEM,
80
	}, {
P
Paulius Zaleckas 已提交
81 82 83
		.start	= UART1_MINT_RX,
		.end	= UART1_MINT_RX,
		.flags	= IORESOURCE_IRQ,
84
	}, {
P
Paulius Zaleckas 已提交
85 86 87
		.start	= UART1_MINT_TX,
		.end	= UART1_MINT_TX,
		.flags	= IORESOURCE_IRQ,
88
	}, {
P
Paulius Zaleckas 已提交
89 90 91 92 93 94 95 96 97 98 99 100 101 102
		.start	= UART1_MINT_RTS,
		.end	= UART1_MINT_RTS,
		.flags	= IORESOURCE_IRQ,
	},
};

struct platform_device imx_uart1_device = {
	.name		= "imx-uart",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(imx_uart1_resources),
	.resource	= imx_uart1_resources,
};

static struct resource imx_uart2_resources[] = {
103
	{
P
Paulius Zaleckas 已提交
104 105 106
		.start	= UART2_BASE_ADDR,
		.end	= UART2_BASE_ADDR + 0xD0,
		.flags	= IORESOURCE_MEM,
107
	}, {
P
Paulius Zaleckas 已提交
108 109 110
		.start	= UART2_MINT_RX,
		.end	= UART2_MINT_RX,
		.flags	= IORESOURCE_IRQ,
111
	}, {
P
Paulius Zaleckas 已提交
112 113 114
		.start	= UART2_MINT_TX,
		.end	= UART2_MINT_TX,
		.flags	= IORESOURCE_IRQ,
115
	}, {
P
Paulius Zaleckas 已提交
116 117 118 119 120 121 122 123 124 125 126 127 128
		.start	= UART2_MINT_RTS,
		.end	= UART2_MINT_RTS,
		.flags	= IORESOURCE_IRQ,
	},
};

struct platform_device imx_uart2_device = {
	.name		= "imx-uart",
	.id		= 1,
	.num_resources	= ARRAY_SIZE(imx_uart2_resources),
	.resource	= imx_uart2_resources,
};

D
Darius Augulis 已提交
129
static struct resource imx_rtc_resources[] = {
130
	{
D
Darius Augulis 已提交
131 132 133
		.start  = 0x00204000,
		.end    = 0x00204024,
		.flags  = IORESOURCE_MEM,
134
	}, {
D
Darius Augulis 已提交
135 136 137
		.start  = RTC_INT,
		.end    = RTC_INT,
		.flags  = IORESOURCE_IRQ,
138
	}, {
D
Darius Augulis 已提交
139 140 141 142 143 144 145 146 147 148 149 150 151 152
		.start  = RTC_SAMINT,
		.end    = RTC_SAMINT,
		.flags  = IORESOURCE_IRQ,
	},
};

struct platform_device imx_rtc_device = {
	.name           = "rtc-imx",
	.id             = 0,
	.resource       = imx_rtc_resources,
	.num_resources  = ARRAY_SIZE(imx_rtc_resources),
};

static struct resource imx_wdt_resources[] = {
153
	{
D
Darius Augulis 已提交
154 155 156
		.start  = 0x00201000,
		.end    = 0x00201008,
		.flags  = IORESOURCE_MEM,
157
	}, {
D
Darius Augulis 已提交
158 159 160 161 162 163 164 165 166 167 168 169 170 171
		.start  = WDT_INT,
		.end    = WDT_INT,
		.flags  = IORESOURCE_IRQ,
	},
};

struct platform_device imx_wdt_device = {
	.name           = "imx-wdt",
	.id             = 0,
	.resource       = imx_wdt_resources,
	.num_resources  = ARRAY_SIZE(imx_wdt_resources),
};

static struct resource imx_usb_resources[] = {
172
	{
D
Darius Augulis 已提交
173 174 175
		.start	= 0x00212000,
		.end	= 0x00212148,
		.flags	= IORESOURCE_MEM,
176
	}, {
D
Darius Augulis 已提交
177 178 179
		.start	= USBD_INT0,
		.end	= USBD_INT0,
		.flags	= IORESOURCE_IRQ,
180
	}, {
D
Darius Augulis 已提交
181 182 183
		.start	= USBD_INT1,
		.end	= USBD_INT1,
		.flags	= IORESOURCE_IRQ,
184
	}, {
D
Darius Augulis 已提交
185 186 187
		.start	= USBD_INT2,
		.end	= USBD_INT2,
		.flags	= IORESOURCE_IRQ,
188
	}, {
D
Darius Augulis 已提交
189 190 191
		.start	= USBD_INT3,
		.end	= USBD_INT3,
		.flags	= IORESOURCE_IRQ,
192
	}, {
D
Darius Augulis 已提交
193 194 195
		.start	= USBD_INT4,
		.end	= USBD_INT4,
		.flags	= IORESOURCE_IRQ,
196
	}, {
D
Darius Augulis 已提交
197 198 199
		.start	= USBD_INT5,
		.end	= USBD_INT5,
		.flags	= IORESOURCE_IRQ,
200
	}, {
D
Darius Augulis 已提交
201 202 203 204 205 206 207 208 209 210 211 212 213
		.start	= USBD_INT6,
		.end	= USBD_INT6,
		.flags	= IORESOURCE_IRQ,
	},
};

struct platform_device imx_usb_device = {
	.name		= "imx_udc",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(imx_usb_resources),
	.resource	= imx_usb_resources,
};

P
Paulius Zaleckas 已提交
214 215
/* GPIO port description */
static struct mxc_gpio_port imx_gpio_ports[] = {
216
	{
P
Paulius Zaleckas 已提交
217 218 219
		.chip.label = "gpio-0",
		.base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR),
		.irq = GPIO_INT_PORTA,
220 221
		.virtual_irq_start = MXC_GPIO_IRQ_START,
	}, {
P
Paulius Zaleckas 已提交
222 223 224
		.chip.label = "gpio-1",
		.base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100),
		.irq = GPIO_INT_PORTB,
225 226
		.virtual_irq_start = MXC_GPIO_IRQ_START + 32,
	}, {
P
Paulius Zaleckas 已提交
227 228 229
		.chip.label = "gpio-2",
		.base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200),
		.irq = GPIO_INT_PORTC,
230 231
		.virtual_irq_start = MXC_GPIO_IRQ_START + 64,
	}, {
P
Paulius Zaleckas 已提交
232 233 234
		.chip.label = "gpio-3",
		.base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300),
		.irq = GPIO_INT_PORTD,
235
		.virtual_irq_start = MXC_GPIO_IRQ_START + 96,
P
Paulius Zaleckas 已提交
236 237 238 239 240 241 242
	}
};

int __init mxc_register_gpios(void)
{
	return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
}