Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 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> |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 5 | * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt> |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 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 | |
| 22 | #include <linux/kernel.h> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/platform_device.h> |
| 25 | #include <linux/gpio.h> |
Holger Schurig | ccfe30a | 2009-01-29 10:07:50 +0100 | [diff] [blame] | 26 | #include <mach/irqs.h> |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 27 | #include <mach/hardware.h> |
| 28 | |
Sascha Hauer | 87bbb19 | 2009-01-29 16:00:23 +0100 | [diff] [blame] | 29 | #include "devices.h" |
| 30 | |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 31 | static struct resource imx_csi_resources[] = { |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 32 | { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 33 | .start = 0x00224000, |
| 34 | .end = 0x00224010, |
| 35 | .flags = IORESOURCE_MEM, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 36 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 37 | .start = CSI_INT, |
| 38 | .end = CSI_INT, |
| 39 | .flags = IORESOURCE_IRQ, |
| 40 | }, |
| 41 | }; |
| 42 | |
| 43 | static u64 imx_csi_dmamask = 0xffffffffUL; |
| 44 | |
| 45 | struct platform_device imx_csi_device = { |
Paulius Zaleckas | 6acc81c | 2009-04-03 10:34:05 -0300 | [diff] [blame] | 46 | .name = "mx1-camera", |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 47 | .id = 0, /* This is used to put cameras on this interface */ |
| 48 | .dev = { |
| 49 | .dma_mask = &imx_csi_dmamask, |
| 50 | .coherent_dma_mask = 0xffffffff, |
| 51 | }, |
| 52 | .resource = imx_csi_resources, |
| 53 | .num_resources = ARRAY_SIZE(imx_csi_resources), |
| 54 | }; |
| 55 | |
| 56 | static struct resource imx_i2c_resources[] = { |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 57 | { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 58 | .start = 0x00217000, |
| 59 | .end = 0x00217010, |
| 60 | .flags = IORESOURCE_MEM, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 61 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 62 | .start = I2C_INT, |
| 63 | .end = I2C_INT, |
| 64 | .flags = IORESOURCE_IRQ, |
| 65 | }, |
| 66 | }; |
| 67 | |
| 68 | struct platform_device imx_i2c_device = { |
| 69 | .name = "imx-i2c", |
| 70 | .id = 0, |
| 71 | .resource = imx_i2c_resources, |
| 72 | .num_resources = ARRAY_SIZE(imx_i2c_resources), |
| 73 | }; |
| 74 | |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 75 | static struct resource imx_uart1_resources[] = { |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 76 | { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 77 | .start = UART1_BASE_ADDR, |
| 78 | .end = UART1_BASE_ADDR + 0xD0, |
| 79 | .flags = IORESOURCE_MEM, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 80 | }, { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 81 | .start = UART1_MINT_RX, |
| 82 | .end = UART1_MINT_RX, |
| 83 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 84 | }, { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 85 | .start = UART1_MINT_TX, |
| 86 | .end = UART1_MINT_TX, |
| 87 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 88 | }, { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 89 | .start = UART1_MINT_RTS, |
| 90 | .end = UART1_MINT_RTS, |
| 91 | .flags = IORESOURCE_IRQ, |
| 92 | }, |
| 93 | }; |
| 94 | |
| 95 | struct platform_device imx_uart1_device = { |
| 96 | .name = "imx-uart", |
| 97 | .id = 0, |
| 98 | .num_resources = ARRAY_SIZE(imx_uart1_resources), |
| 99 | .resource = imx_uart1_resources, |
| 100 | }; |
| 101 | |
| 102 | static struct resource imx_uart2_resources[] = { |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 103 | { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 104 | .start = UART2_BASE_ADDR, |
| 105 | .end = UART2_BASE_ADDR + 0xD0, |
| 106 | .flags = IORESOURCE_MEM, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 107 | }, { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 108 | .start = UART2_MINT_RX, |
| 109 | .end = UART2_MINT_RX, |
| 110 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 111 | }, { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 112 | .start = UART2_MINT_TX, |
| 113 | .end = UART2_MINT_TX, |
| 114 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 115 | }, { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 116 | .start = UART2_MINT_RTS, |
| 117 | .end = UART2_MINT_RTS, |
| 118 | .flags = IORESOURCE_IRQ, |
| 119 | }, |
| 120 | }; |
| 121 | |
| 122 | struct platform_device imx_uart2_device = { |
| 123 | .name = "imx-uart", |
| 124 | .id = 1, |
| 125 | .num_resources = ARRAY_SIZE(imx_uart2_resources), |
| 126 | .resource = imx_uart2_resources, |
| 127 | }; |
| 128 | |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 129 | static struct resource imx_rtc_resources[] = { |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 130 | { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 131 | .start = 0x00204000, |
| 132 | .end = 0x00204024, |
| 133 | .flags = IORESOURCE_MEM, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 134 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 135 | .start = RTC_INT, |
| 136 | .end = RTC_INT, |
| 137 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 138 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 139 | .start = RTC_SAMINT, |
| 140 | .end = RTC_SAMINT, |
| 141 | .flags = IORESOURCE_IRQ, |
| 142 | }, |
| 143 | }; |
| 144 | |
| 145 | struct platform_device imx_rtc_device = { |
| 146 | .name = "rtc-imx", |
| 147 | .id = 0, |
| 148 | .resource = imx_rtc_resources, |
| 149 | .num_resources = ARRAY_SIZE(imx_rtc_resources), |
| 150 | }; |
| 151 | |
| 152 | static struct resource imx_wdt_resources[] = { |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 153 | { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 154 | .start = 0x00201000, |
| 155 | .end = 0x00201008, |
| 156 | .flags = IORESOURCE_MEM, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 157 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 158 | .start = WDT_INT, |
| 159 | .end = WDT_INT, |
| 160 | .flags = IORESOURCE_IRQ, |
| 161 | }, |
| 162 | }; |
| 163 | |
| 164 | struct platform_device imx_wdt_device = { |
| 165 | .name = "imx-wdt", |
| 166 | .id = 0, |
| 167 | .resource = imx_wdt_resources, |
| 168 | .num_resources = ARRAY_SIZE(imx_wdt_resources), |
| 169 | }; |
| 170 | |
| 171 | static struct resource imx_usb_resources[] = { |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 172 | { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 173 | .start = 0x00212000, |
| 174 | .end = 0x00212148, |
| 175 | .flags = IORESOURCE_MEM, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 176 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 177 | .start = USBD_INT0, |
| 178 | .end = USBD_INT0, |
| 179 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 180 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 181 | .start = USBD_INT1, |
| 182 | .end = USBD_INT1, |
| 183 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 184 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 185 | .start = USBD_INT2, |
| 186 | .end = USBD_INT2, |
| 187 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 188 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 189 | .start = USBD_INT3, |
| 190 | .end = USBD_INT3, |
| 191 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 192 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 193 | .start = USBD_INT4, |
| 194 | .end = USBD_INT4, |
| 195 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 196 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 197 | .start = USBD_INT5, |
| 198 | .end = USBD_INT5, |
| 199 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 200 | }, { |
Darius Augulis | 219fed7 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 201 | .start = USBD_INT6, |
| 202 | .end = USBD_INT6, |
| 203 | .flags = IORESOURCE_IRQ, |
| 204 | }, |
| 205 | }; |
| 206 | |
| 207 | struct platform_device imx_usb_device = { |
| 208 | .name = "imx_udc", |
| 209 | .id = 0, |
| 210 | .num_resources = ARRAY_SIZE(imx_usb_resources), |
| 211 | .resource = imx_usb_resources, |
| 212 | }; |
| 213 | |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 214 | /* GPIO port description */ |
| 215 | static struct mxc_gpio_port imx_gpio_ports[] = { |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 216 | { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 217 | .chip.label = "gpio-0", |
| 218 | .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR), |
| 219 | .irq = GPIO_INT_PORTA, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 220 | .virtual_irq_start = MXC_GPIO_IRQ_START, |
| 221 | }, { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 222 | .chip.label = "gpio-1", |
| 223 | .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100), |
| 224 | .irq = GPIO_INT_PORTB, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 225 | .virtual_irq_start = MXC_GPIO_IRQ_START + 32, |
| 226 | }, { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 227 | .chip.label = "gpio-2", |
| 228 | .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200), |
| 229 | .irq = GPIO_INT_PORTC, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 230 | .virtual_irq_start = MXC_GPIO_IRQ_START + 64, |
| 231 | }, { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 232 | .chip.label = "gpio-3", |
| 233 | .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300), |
| 234 | .irq = GPIO_INT_PORTD, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 235 | .virtual_irq_start = MXC_GPIO_IRQ_START + 96, |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 236 | } |
| 237 | }; |
| 238 | |
| 239 | int __init mxc_register_gpios(void) |
| 240 | { |
| 241 | return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); |
| 242 | } |