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