blob: 5070ae1f94c6601e850e430ff15398e503e97456 [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 Nguyene24798e2010-04-22 16:28:42 +030014#include <linux/gpio.h>
Amit Kucheriaa329b482010-02-04 12:21:53 -080015#include <mach/hardware.h>
16#include <mach/imx-uart.h>
Dinh Nguyene24798e2010-04-22 16:28:42 +030017#include <mach/irqs.h>
Amit Kucheriaa329b482010-02-04 12:21:53 -080018
19static struct resource uart0[] = {
20 {
21 .start = MX51_UART1_BASE_ADDR,
22 .end = MX51_UART1_BASE_ADDR + 0xfff,
23 .flags = IORESOURCE_MEM,
24 }, {
25 .start = MX51_MXC_INT_UART1,
26 .end = MX51_MXC_INT_UART1,
27 .flags = IORESOURCE_IRQ,
28 },
29};
30
31struct platform_device mxc_uart_device0 = {
32 .name = "imx-uart",
33 .id = 0,
34 .resource = uart0,
35 .num_resources = ARRAY_SIZE(uart0),
36};
37
38static struct resource uart1[] = {
39 {
40 .start = MX51_UART2_BASE_ADDR,
41 .end = MX51_UART2_BASE_ADDR + 0xfff,
42 .flags = IORESOURCE_MEM,
43 }, {
44 .start = MX51_MXC_INT_UART2,
45 .end = MX51_MXC_INT_UART2,
46 .flags = IORESOURCE_IRQ,
47 },
48};
49
50struct platform_device mxc_uart_device1 = {
51 .name = "imx-uart",
52 .id = 1,
53 .resource = uart1,
54 .num_resources = ARRAY_SIZE(uart1),
55};
56
57static struct resource uart2[] = {
58 {
59 .start = MX51_UART3_BASE_ADDR,
60 .end = MX51_UART3_BASE_ADDR + 0xfff,
61 .flags = IORESOURCE_MEM,
62 }, {
63 .start = MX51_MXC_INT_UART3,
64 .end = MX51_MXC_INT_UART3,
65 .flags = IORESOURCE_IRQ,
66 },
67};
68
69struct platform_device mxc_uart_device2 = {
70 .name = "imx-uart",
71 .id = 2,
72 .resource = uart2,
73 .num_resources = ARRAY_SIZE(uart2),
74};
75
76static struct resource mxc_fec_resources[] = {
77 {
78 .start = MX51_MXC_FEC_BASE_ADDR,
79 .end = MX51_MXC_FEC_BASE_ADDR + 0xfff,
80 .flags = IORESOURCE_MEM,
81 }, {
82 .start = MX51_MXC_INT_FEC,
83 .end = MX51_MXC_INT_FEC,
84 .flags = IORESOURCE_IRQ,
85 },
86};
87
88struct platform_device mxc_fec_device = {
89 .name = "fec",
90 .id = 0,
91 .num_resources = ARRAY_SIZE(mxc_fec_resources),
92 .resource = mxc_fec_resources,
93};
94
Dinh Nguyene24798e2010-04-22 16:28:42 +030095static struct mxc_gpio_port mxc_gpio_ports[] = {
96 {
97 .chip.label = "gpio-0",
98 .base = MX51_IO_ADDRESS(MX51_GPIO1_BASE_ADDR),
99 .irq = MX51_MXC_INT_GPIO1_LOW,
100 .virtual_irq_start = MXC_GPIO_IRQ_START
101 },
102 {
103 .chip.label = "gpio-1",
104 .base = MX51_IO_ADDRESS(MX51_GPIO2_BASE_ADDR),
105 .irq = MX51_MXC_INT_GPIO2_LOW,
106 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 1
107 },
108 {
109 .chip.label = "gpio-2",
110 .base = MX51_IO_ADDRESS(MX51_GPIO3_BASE_ADDR),
111 .irq = MX51_MXC_INT_GPIO3_LOW,
112 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 2
113 },
114 {
115 .chip.label = "gpio-3",
116 .base = MX51_IO_ADDRESS(MX51_GPIO4_BASE_ADDR),
117 .irq = MX51_MXC_INT_GPIO4_LOW,
118 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 3
119 },
120};
121
Amit Kucheriaa329b482010-02-04 12:21:53 -0800122int __init mxc_register_gpios(void)
123{
Dinh Nguyene24798e2010-04-22 16:28:42 +0300124 return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports));
Amit Kucheriaa329b482010-02-04 12:21:53 -0800125}