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