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