Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * DA8XX/OMAP L1XX platform device data |
| 3 | * |
| 4 | * Copyright (c) 2007-2009, MontaVista Software, Inc. <source@mvista.com> |
| 5 | * Derived from code that was: |
| 6 | * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | */ |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 13 | #include <linux/init.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/dma-mapping.h> |
| 16 | #include <linux/serial_8250.h> |
| 17 | |
| 18 | #include <mach/cputype.h> |
| 19 | #include <mach/common.h> |
| 20 | #include <mach/time.h> |
| 21 | #include <mach/da8xx.h> |
Sekhar Nori | 1960e69 | 2009-10-22 15:12:14 +0530 | [diff] [blame] | 22 | #include <mach/cpuidle.h> |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 23 | |
| 24 | #include "clock.h" |
| 25 | |
| 26 | #define DA8XX_TPCC_BASE 0x01c00000 |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 27 | #define DA850_TPCC1_BASE 0x01e30000 |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 28 | #define DA8XX_TPTC0_BASE 0x01c08000 |
| 29 | #define DA8XX_TPTC1_BASE 0x01c08400 |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 30 | #define DA850_TPTC2_BASE 0x01e38000 |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 31 | #define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */ |
| 32 | #define DA8XX_I2C0_BASE 0x01c22000 |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 33 | #define DA8XX_RTC_BASE 0x01C23000 |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 34 | #define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000 |
| 35 | #define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000 |
| 36 | #define DA8XX_EMAC_CPGMAC_BASE 0x01e23000 |
| 37 | #define DA8XX_EMAC_MDIO_BASE 0x01e24000 |
| 38 | #define DA8XX_GPIO_BASE 0x01e26000 |
| 39 | #define DA8XX_I2C1_BASE 0x01e28000 |
| 40 | |
| 41 | #define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000 |
| 42 | #define DA8XX_EMAC_MOD_REG_OFFSET 0x2000 |
| 43 | #define DA8XX_EMAC_RAM_OFFSET 0x0000 |
| 44 | #define DA8XX_MDIO_REG_OFFSET 0x4000 |
| 45 | #define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K |
| 46 | |
Sekhar Nori | d2de058 | 2009-11-16 17:21:32 +0530 | [diff] [blame] | 47 | void __iomem *da8xx_syscfg0_base; |
| 48 | void __iomem *da8xx_syscfg1_base; |
Sekhar Nori | 6a28ade | 2009-08-31 15:47:59 +0530 | [diff] [blame] | 49 | |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 50 | static struct plat_serial8250_port da8xx_serial_pdata[] = { |
| 51 | { |
| 52 | .mapbase = DA8XX_UART0_BASE, |
| 53 | .irq = IRQ_DA8XX_UARTINT0, |
| 54 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 55 | UPF_IOREMAP, |
| 56 | .iotype = UPIO_MEM, |
| 57 | .regshift = 2, |
| 58 | }, |
| 59 | { |
| 60 | .mapbase = DA8XX_UART1_BASE, |
| 61 | .irq = IRQ_DA8XX_UARTINT1, |
| 62 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 63 | UPF_IOREMAP, |
| 64 | .iotype = UPIO_MEM, |
| 65 | .regshift = 2, |
| 66 | }, |
| 67 | { |
| 68 | .mapbase = DA8XX_UART2_BASE, |
| 69 | .irq = IRQ_DA8XX_UARTINT2, |
| 70 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 71 | UPF_IOREMAP, |
| 72 | .iotype = UPIO_MEM, |
| 73 | .regshift = 2, |
| 74 | }, |
| 75 | { |
| 76 | .flags = 0, |
| 77 | }, |
| 78 | }; |
| 79 | |
| 80 | struct platform_device da8xx_serial_device = { |
| 81 | .name = "serial8250", |
| 82 | .id = PLAT8250_DEV_PLATFORM, |
| 83 | .dev = { |
| 84 | .platform_data = da8xx_serial_pdata, |
| 85 | }, |
| 86 | }; |
| 87 | |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 88 | static const s8 da8xx_queue_tc_mapping[][2] = { |
| 89 | /* {event queue no, TC no} */ |
| 90 | {0, 0}, |
| 91 | {1, 1}, |
| 92 | {-1, -1} |
| 93 | }; |
| 94 | |
| 95 | static const s8 da8xx_queue_priority_mapping[][2] = { |
| 96 | /* {event queue no, Priority} */ |
| 97 | {0, 3}, |
| 98 | {1, 7}, |
| 99 | {-1, -1} |
| 100 | }; |
| 101 | |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 102 | static const s8 da850_queue_tc_mapping[][2] = { |
| 103 | /* {event queue no, TC no} */ |
| 104 | {0, 0}, |
| 105 | {-1, -1} |
| 106 | }; |
| 107 | |
| 108 | static const s8 da850_queue_priority_mapping[][2] = { |
| 109 | /* {event queue no, Priority} */ |
| 110 | {0, 3}, |
| 111 | {-1, -1} |
| 112 | }; |
| 113 | |
Sekhar Nori | bc3ac9f | 2010-06-29 11:35:12 +0530 | [diff] [blame^] | 114 | static struct edma_soc_info da830_edma_cc0_info = { |
| 115 | .n_channel = 32, |
| 116 | .n_region = 4, |
| 117 | .n_slot = 128, |
| 118 | .n_tc = 2, |
| 119 | .n_cc = 1, |
| 120 | .queue_tc_mapping = da8xx_queue_tc_mapping, |
| 121 | .queue_priority_mapping = da8xx_queue_priority_mapping, |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 122 | }; |
| 123 | |
Sekhar Nori | bc3ac9f | 2010-06-29 11:35:12 +0530 | [diff] [blame^] | 124 | static struct edma_soc_info *da830_edma_info[EDMA_MAX_CC] = { |
| 125 | &da830_edma_cc0_info, |
| 126 | }; |
| 127 | |
| 128 | static struct edma_soc_info da850_edma_cc_info[] = { |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 129 | { |
| 130 | .n_channel = 32, |
| 131 | .n_region = 4, |
| 132 | .n_slot = 128, |
| 133 | .n_tc = 2, |
| 134 | .n_cc = 1, |
| 135 | .queue_tc_mapping = da8xx_queue_tc_mapping, |
| 136 | .queue_priority_mapping = da8xx_queue_priority_mapping, |
| 137 | }, |
| 138 | { |
| 139 | .n_channel = 32, |
| 140 | .n_region = 4, |
| 141 | .n_slot = 128, |
| 142 | .n_tc = 1, |
| 143 | .n_cc = 1, |
| 144 | .queue_tc_mapping = da850_queue_tc_mapping, |
| 145 | .queue_priority_mapping = da850_queue_priority_mapping, |
| 146 | }, |
| 147 | }; |
| 148 | |
Sekhar Nori | bc3ac9f | 2010-06-29 11:35:12 +0530 | [diff] [blame^] | 149 | static struct edma_soc_info *da850_edma_info[EDMA_MAX_CC] = { |
| 150 | &da850_edma_cc_info[0], |
| 151 | &da850_edma_cc_info[1], |
| 152 | }; |
| 153 | |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 154 | static struct resource da830_edma_resources[] = { |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 155 | { |
| 156 | .name = "edma_cc0", |
| 157 | .start = DA8XX_TPCC_BASE, |
| 158 | .end = DA8XX_TPCC_BASE + SZ_32K - 1, |
| 159 | .flags = IORESOURCE_MEM, |
| 160 | }, |
| 161 | { |
| 162 | .name = "edma_tc0", |
| 163 | .start = DA8XX_TPTC0_BASE, |
| 164 | .end = DA8XX_TPTC0_BASE + SZ_1K - 1, |
| 165 | .flags = IORESOURCE_MEM, |
| 166 | }, |
| 167 | { |
| 168 | .name = "edma_tc1", |
| 169 | .start = DA8XX_TPTC1_BASE, |
| 170 | .end = DA8XX_TPTC1_BASE + SZ_1K - 1, |
| 171 | .flags = IORESOURCE_MEM, |
| 172 | }, |
| 173 | { |
| 174 | .name = "edma0", |
Sudhakar Rajashekhara | 2259bbd | 2009-07-10 06:28:52 -0400 | [diff] [blame] | 175 | .start = IRQ_DA8XX_CCINT0, |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 176 | .flags = IORESOURCE_IRQ, |
| 177 | }, |
| 178 | { |
| 179 | .name = "edma0_err", |
| 180 | .start = IRQ_DA8XX_CCERRINT, |
| 181 | .flags = IORESOURCE_IRQ, |
| 182 | }, |
| 183 | }; |
| 184 | |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 185 | static struct resource da850_edma_resources[] = { |
| 186 | { |
| 187 | .name = "edma_cc0", |
| 188 | .start = DA8XX_TPCC_BASE, |
| 189 | .end = DA8XX_TPCC_BASE + SZ_32K - 1, |
| 190 | .flags = IORESOURCE_MEM, |
| 191 | }, |
| 192 | { |
| 193 | .name = "edma_tc0", |
| 194 | .start = DA8XX_TPTC0_BASE, |
| 195 | .end = DA8XX_TPTC0_BASE + SZ_1K - 1, |
| 196 | .flags = IORESOURCE_MEM, |
| 197 | }, |
| 198 | { |
| 199 | .name = "edma_tc1", |
| 200 | .start = DA8XX_TPTC1_BASE, |
| 201 | .end = DA8XX_TPTC1_BASE + SZ_1K - 1, |
| 202 | .flags = IORESOURCE_MEM, |
| 203 | }, |
| 204 | { |
| 205 | .name = "edma_cc1", |
| 206 | .start = DA850_TPCC1_BASE, |
| 207 | .end = DA850_TPCC1_BASE + SZ_32K - 1, |
| 208 | .flags = IORESOURCE_MEM, |
| 209 | }, |
| 210 | { |
| 211 | .name = "edma_tc2", |
| 212 | .start = DA850_TPTC2_BASE, |
| 213 | .end = DA850_TPTC2_BASE + SZ_1K - 1, |
| 214 | .flags = IORESOURCE_MEM, |
| 215 | }, |
| 216 | { |
| 217 | .name = "edma0", |
| 218 | .start = IRQ_DA8XX_CCINT0, |
| 219 | .flags = IORESOURCE_IRQ, |
| 220 | }, |
| 221 | { |
| 222 | .name = "edma0_err", |
| 223 | .start = IRQ_DA8XX_CCERRINT, |
| 224 | .flags = IORESOURCE_IRQ, |
| 225 | }, |
| 226 | { |
| 227 | .name = "edma1", |
| 228 | .start = IRQ_DA850_CCINT1, |
| 229 | .flags = IORESOURCE_IRQ, |
| 230 | }, |
| 231 | { |
| 232 | .name = "edma1_err", |
| 233 | .start = IRQ_DA850_CCERRINT1, |
| 234 | .flags = IORESOURCE_IRQ, |
| 235 | }, |
| 236 | }; |
| 237 | |
| 238 | static struct platform_device da830_edma_device = { |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 239 | .name = "edma", |
| 240 | .id = -1, |
| 241 | .dev = { |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 242 | .platform_data = da830_edma_info, |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 243 | }, |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 244 | .num_resources = ARRAY_SIZE(da830_edma_resources), |
| 245 | .resource = da830_edma_resources, |
| 246 | }; |
| 247 | |
| 248 | static struct platform_device da850_edma_device = { |
| 249 | .name = "edma", |
| 250 | .id = -1, |
| 251 | .dev = { |
| 252 | .platform_data = da850_edma_info, |
| 253 | }, |
| 254 | .num_resources = ARRAY_SIZE(da850_edma_resources), |
| 255 | .resource = da850_edma_resources, |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 256 | }; |
| 257 | |
| 258 | int __init da8xx_register_edma(void) |
| 259 | { |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 260 | struct platform_device *pdev; |
| 261 | |
| 262 | if (cpu_is_davinci_da830()) |
| 263 | pdev = &da830_edma_device; |
| 264 | else if (cpu_is_davinci_da850()) |
| 265 | pdev = &da850_edma_device; |
| 266 | else |
| 267 | return -ENODEV; |
| 268 | |
| 269 | return platform_device_register(pdev); |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | static struct resource da8xx_i2c_resources0[] = { |
| 273 | { |
| 274 | .start = DA8XX_I2C0_BASE, |
| 275 | .end = DA8XX_I2C0_BASE + SZ_4K - 1, |
| 276 | .flags = IORESOURCE_MEM, |
| 277 | }, |
| 278 | { |
| 279 | .start = IRQ_DA8XX_I2CINT0, |
| 280 | .end = IRQ_DA8XX_I2CINT0, |
| 281 | .flags = IORESOURCE_IRQ, |
| 282 | }, |
| 283 | }; |
| 284 | |
| 285 | static struct platform_device da8xx_i2c_device0 = { |
| 286 | .name = "i2c_davinci", |
| 287 | .id = 1, |
| 288 | .num_resources = ARRAY_SIZE(da8xx_i2c_resources0), |
| 289 | .resource = da8xx_i2c_resources0, |
| 290 | }; |
| 291 | |
| 292 | static struct resource da8xx_i2c_resources1[] = { |
| 293 | { |
| 294 | .start = DA8XX_I2C1_BASE, |
| 295 | .end = DA8XX_I2C1_BASE + SZ_4K - 1, |
| 296 | .flags = IORESOURCE_MEM, |
| 297 | }, |
| 298 | { |
| 299 | .start = IRQ_DA8XX_I2CINT1, |
| 300 | .end = IRQ_DA8XX_I2CINT1, |
| 301 | .flags = IORESOURCE_IRQ, |
| 302 | }, |
| 303 | }; |
| 304 | |
| 305 | static struct platform_device da8xx_i2c_device1 = { |
| 306 | .name = "i2c_davinci", |
| 307 | .id = 2, |
| 308 | .num_resources = ARRAY_SIZE(da8xx_i2c_resources1), |
| 309 | .resource = da8xx_i2c_resources1, |
| 310 | }; |
| 311 | |
| 312 | int __init da8xx_register_i2c(int instance, |
| 313 | struct davinci_i2c_platform_data *pdata) |
| 314 | { |
| 315 | struct platform_device *pdev; |
| 316 | |
| 317 | if (instance == 0) |
| 318 | pdev = &da8xx_i2c_device0; |
| 319 | else if (instance == 1) |
| 320 | pdev = &da8xx_i2c_device1; |
| 321 | else |
| 322 | return -EINVAL; |
| 323 | |
| 324 | pdev->dev.platform_data = pdata; |
| 325 | return platform_device_register(pdev); |
| 326 | } |
| 327 | |
| 328 | static struct resource da8xx_watchdog_resources[] = { |
| 329 | { |
| 330 | .start = DA8XX_WDOG_BASE, |
| 331 | .end = DA8XX_WDOG_BASE + SZ_4K - 1, |
| 332 | .flags = IORESOURCE_MEM, |
| 333 | }, |
| 334 | }; |
| 335 | |
Cyril Chemparathy | c78a5bc | 2010-05-01 18:38:28 -0400 | [diff] [blame] | 336 | struct platform_device da8xx_wdt_device = { |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 337 | .name = "watchdog", |
| 338 | .id = -1, |
| 339 | .num_resources = ARRAY_SIZE(da8xx_watchdog_resources), |
| 340 | .resource = da8xx_watchdog_resources, |
| 341 | }; |
| 342 | |
| 343 | int __init da8xx_register_watchdog(void) |
| 344 | { |
Cyril Chemparathy | c78a5bc | 2010-05-01 18:38:28 -0400 | [diff] [blame] | 345 | return platform_device_register(&da8xx_wdt_device); |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | static struct resource da8xx_emac_resources[] = { |
| 349 | { |
| 350 | .start = DA8XX_EMAC_CPPI_PORT_BASE, |
| 351 | .end = DA8XX_EMAC_CPPI_PORT_BASE + 0x5000 - 1, |
| 352 | .flags = IORESOURCE_MEM, |
| 353 | }, |
| 354 | { |
| 355 | .start = IRQ_DA8XX_C0_RX_THRESH_PULSE, |
| 356 | .end = IRQ_DA8XX_C0_RX_THRESH_PULSE, |
| 357 | .flags = IORESOURCE_IRQ, |
| 358 | }, |
| 359 | { |
| 360 | .start = IRQ_DA8XX_C0_RX_PULSE, |
| 361 | .end = IRQ_DA8XX_C0_RX_PULSE, |
| 362 | .flags = IORESOURCE_IRQ, |
| 363 | }, |
| 364 | { |
| 365 | .start = IRQ_DA8XX_C0_TX_PULSE, |
| 366 | .end = IRQ_DA8XX_C0_TX_PULSE, |
| 367 | .flags = IORESOURCE_IRQ, |
| 368 | }, |
| 369 | { |
| 370 | .start = IRQ_DA8XX_C0_MISC_PULSE, |
| 371 | .end = IRQ_DA8XX_C0_MISC_PULSE, |
| 372 | .flags = IORESOURCE_IRQ, |
| 373 | }, |
| 374 | }; |
| 375 | |
| 376 | struct emac_platform_data da8xx_emac_pdata = { |
| 377 | .ctrl_reg_offset = DA8XX_EMAC_CTRL_REG_OFFSET, |
| 378 | .ctrl_mod_reg_offset = DA8XX_EMAC_MOD_REG_OFFSET, |
| 379 | .ctrl_ram_offset = DA8XX_EMAC_RAM_OFFSET, |
| 380 | .mdio_reg_offset = DA8XX_MDIO_REG_OFFSET, |
| 381 | .ctrl_ram_size = DA8XX_EMAC_CTRL_RAM_SIZE, |
| 382 | .version = EMAC_VERSION_2, |
| 383 | }; |
| 384 | |
| 385 | static struct platform_device da8xx_emac_device = { |
| 386 | .name = "davinci_emac", |
| 387 | .id = 1, |
| 388 | .dev = { |
| 389 | .platform_data = &da8xx_emac_pdata, |
| 390 | }, |
| 391 | .num_resources = ARRAY_SIZE(da8xx_emac_resources), |
| 392 | .resource = da8xx_emac_resources, |
| 393 | }; |
| 394 | |
Mark A. Greer | 31f53cf | 2009-08-28 15:02:54 -0700 | [diff] [blame] | 395 | int __init da8xx_register_emac(void) |
| 396 | { |
| 397 | return platform_device_register(&da8xx_emac_device); |
| 398 | } |
| 399 | |
Chaithrika U S | e33ef5e | 2009-08-11 17:01:59 -0400 | [diff] [blame] | 400 | static struct resource da830_mcasp1_resources[] = { |
| 401 | { |
| 402 | .name = "mcasp1", |
| 403 | .start = DAVINCI_DA830_MCASP1_REG_BASE, |
| 404 | .end = DAVINCI_DA830_MCASP1_REG_BASE + (SZ_1K * 12) - 1, |
| 405 | .flags = IORESOURCE_MEM, |
| 406 | }, |
| 407 | /* TX event */ |
| 408 | { |
| 409 | .start = DAVINCI_DA830_DMA_MCASP1_AXEVT, |
| 410 | .end = DAVINCI_DA830_DMA_MCASP1_AXEVT, |
| 411 | .flags = IORESOURCE_DMA, |
| 412 | }, |
| 413 | /* RX event */ |
| 414 | { |
| 415 | .start = DAVINCI_DA830_DMA_MCASP1_AREVT, |
| 416 | .end = DAVINCI_DA830_DMA_MCASP1_AREVT, |
| 417 | .flags = IORESOURCE_DMA, |
| 418 | }, |
| 419 | }; |
| 420 | |
| 421 | static struct platform_device da830_mcasp1_device = { |
| 422 | .name = "davinci-mcasp", |
| 423 | .id = 1, |
| 424 | .num_resources = ARRAY_SIZE(da830_mcasp1_resources), |
| 425 | .resource = da830_mcasp1_resources, |
| 426 | }; |
| 427 | |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 428 | static struct resource da850_mcasp_resources[] = { |
| 429 | { |
| 430 | .name = "mcasp", |
| 431 | .start = DAVINCI_DA8XX_MCASP0_REG_BASE, |
| 432 | .end = DAVINCI_DA8XX_MCASP0_REG_BASE + (SZ_1K * 12) - 1, |
| 433 | .flags = IORESOURCE_MEM, |
| 434 | }, |
| 435 | /* TX event */ |
| 436 | { |
| 437 | .start = DAVINCI_DA8XX_DMA_MCASP0_AXEVT, |
| 438 | .end = DAVINCI_DA8XX_DMA_MCASP0_AXEVT, |
| 439 | .flags = IORESOURCE_DMA, |
| 440 | }, |
| 441 | /* RX event */ |
| 442 | { |
| 443 | .start = DAVINCI_DA8XX_DMA_MCASP0_AREVT, |
| 444 | .end = DAVINCI_DA8XX_DMA_MCASP0_AREVT, |
| 445 | .flags = IORESOURCE_DMA, |
| 446 | }, |
| 447 | }; |
| 448 | |
| 449 | static struct platform_device da850_mcasp_device = { |
| 450 | .name = "davinci-mcasp", |
| 451 | .id = 0, |
| 452 | .num_resources = ARRAY_SIZE(da850_mcasp_resources), |
| 453 | .resource = da850_mcasp_resources, |
| 454 | }; |
| 455 | |
Mark A. Greer | b8864aa | 2009-08-28 15:05:02 -0700 | [diff] [blame] | 456 | void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata) |
Chaithrika U S | e33ef5e | 2009-08-11 17:01:59 -0400 | [diff] [blame] | 457 | { |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 458 | /* DA830/OMAP-L137 has 3 instances of McASP */ |
| 459 | if (cpu_is_davinci_da830() && id == 1) { |
Chaithrika U S | e33ef5e | 2009-08-11 17:01:59 -0400 | [diff] [blame] | 460 | da830_mcasp1_device.dev.platform_data = pdata; |
| 461 | platform_device_register(&da830_mcasp1_device); |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 462 | } else if (cpu_is_davinci_da850()) { |
| 463 | da850_mcasp_device.dev.platform_data = pdata; |
| 464 | platform_device_register(&da850_mcasp_device); |
Chaithrika U S | e33ef5e | 2009-08-11 17:01:59 -0400 | [diff] [blame] | 465 | } |
| 466 | } |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 467 | |
| 468 | static const struct display_panel disp_panel = { |
| 469 | QVGA, |
| 470 | 16, |
| 471 | 16, |
| 472 | COLOR_ACTIVE, |
| 473 | }; |
| 474 | |
| 475 | static struct lcd_ctrl_config lcd_cfg = { |
| 476 | &disp_panel, |
| 477 | .ac_bias = 255, |
| 478 | .ac_bias_intrpt = 0, |
| 479 | .dma_burst_sz = 16, |
| 480 | .bpp = 16, |
| 481 | .fdd = 255, |
| 482 | .tft_alt_mode = 0, |
| 483 | .stn_565_mode = 0, |
| 484 | .mono_8bit_mode = 0, |
| 485 | .invert_line_clock = 1, |
| 486 | .invert_frm_clock = 1, |
| 487 | .sync_edge = 0, |
| 488 | .sync_ctrl = 1, |
| 489 | .raster_order = 0, |
| 490 | }; |
| 491 | |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 492 | struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata = { |
| 493 | .manu_name = "sharp", |
| 494 | .controller_data = &lcd_cfg, |
| 495 | .type = "Sharp_LCD035Q3DG01", |
| 496 | }; |
| 497 | |
| 498 | struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata = { |
| 499 | .manu_name = "sharp", |
| 500 | .controller_data = &lcd_cfg, |
| 501 | .type = "Sharp_LK043T1DG01", |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 502 | }; |
| 503 | |
| 504 | static struct resource da8xx_lcdc_resources[] = { |
| 505 | [0] = { /* registers */ |
| 506 | .start = DA8XX_LCD_CNTRL_BASE, |
| 507 | .end = DA8XX_LCD_CNTRL_BASE + SZ_4K - 1, |
| 508 | .flags = IORESOURCE_MEM, |
| 509 | }, |
| 510 | [1] = { /* interrupt */ |
| 511 | .start = IRQ_DA8XX_LCDINT, |
| 512 | .end = IRQ_DA8XX_LCDINT, |
| 513 | .flags = IORESOURCE_IRQ, |
| 514 | }, |
| 515 | }; |
| 516 | |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 517 | static struct platform_device da8xx_lcdc_device = { |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 518 | .name = "da8xx_lcdc", |
| 519 | .id = 0, |
| 520 | .num_resources = ARRAY_SIZE(da8xx_lcdc_resources), |
| 521 | .resource = da8xx_lcdc_resources, |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 522 | }; |
| 523 | |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 524 | int __init da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata) |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 525 | { |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 526 | da8xx_lcdc_device.dev.platform_data = pdata; |
| 527 | return platform_device_register(&da8xx_lcdc_device); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 528 | } |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 529 | |
| 530 | static struct resource da8xx_mmcsd0_resources[] = { |
| 531 | { /* registers */ |
| 532 | .start = DA8XX_MMCSD0_BASE, |
| 533 | .end = DA8XX_MMCSD0_BASE + SZ_4K - 1, |
| 534 | .flags = IORESOURCE_MEM, |
| 535 | }, |
| 536 | { /* interrupt */ |
| 537 | .start = IRQ_DA8XX_MMCSDINT0, |
| 538 | .end = IRQ_DA8XX_MMCSDINT0, |
| 539 | .flags = IORESOURCE_IRQ, |
| 540 | }, |
| 541 | { /* DMA RX */ |
| 542 | .start = EDMA_CTLR_CHAN(0, 16), |
| 543 | .end = EDMA_CTLR_CHAN(0, 16), |
| 544 | .flags = IORESOURCE_DMA, |
| 545 | }, |
| 546 | { /* DMA TX */ |
| 547 | .start = EDMA_CTLR_CHAN(0, 17), |
| 548 | .end = EDMA_CTLR_CHAN(0, 17), |
| 549 | .flags = IORESOURCE_DMA, |
| 550 | }, |
| 551 | }; |
| 552 | |
| 553 | static struct platform_device da8xx_mmcsd0_device = { |
| 554 | .name = "davinci_mmc", |
| 555 | .id = 0, |
| 556 | .num_resources = ARRAY_SIZE(da8xx_mmcsd0_resources), |
| 557 | .resource = da8xx_mmcsd0_resources, |
| 558 | }; |
| 559 | |
| 560 | int __init da8xx_register_mmcsd0(struct davinci_mmc_config *config) |
| 561 | { |
| 562 | da8xx_mmcsd0_device.dev.platform_data = config; |
| 563 | return platform_device_register(&da8xx_mmcsd0_device); |
| 564 | } |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 565 | |
| 566 | static struct resource da8xx_rtc_resources[] = { |
| 567 | { |
| 568 | .start = DA8XX_RTC_BASE, |
| 569 | .end = DA8XX_RTC_BASE + SZ_4K - 1, |
| 570 | .flags = IORESOURCE_MEM, |
| 571 | }, |
| 572 | { /* timer irq */ |
| 573 | .start = IRQ_DA8XX_RTC, |
| 574 | .end = IRQ_DA8XX_RTC, |
| 575 | .flags = IORESOURCE_IRQ, |
| 576 | }, |
| 577 | { /* alarm irq */ |
| 578 | .start = IRQ_DA8XX_RTC, |
| 579 | .end = IRQ_DA8XX_RTC, |
| 580 | .flags = IORESOURCE_IRQ, |
| 581 | }, |
| 582 | }; |
| 583 | |
| 584 | static struct platform_device da8xx_rtc_device = { |
| 585 | .name = "omap_rtc", |
| 586 | .id = -1, |
| 587 | .num_resources = ARRAY_SIZE(da8xx_rtc_resources), |
| 588 | .resource = da8xx_rtc_resources, |
| 589 | }; |
| 590 | |
| 591 | int da8xx_register_rtc(void) |
| 592 | { |
Sekhar Nori | 75c99bb | 2009-11-16 17:21:31 +0530 | [diff] [blame] | 593 | int ret; |
Cyril Chemparathy | db6db5d | 2010-05-07 17:06:33 -0400 | [diff] [blame] | 594 | void __iomem *base; |
| 595 | |
| 596 | base = ioremap(DA8XX_RTC_BASE, SZ_4K); |
| 597 | if (WARN_ON(!base)) |
| 598 | return -ENOMEM; |
Sekhar Nori | 75c99bb | 2009-11-16 17:21:31 +0530 | [diff] [blame] | 599 | |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 600 | /* Unlock the rtc's registers */ |
Cyril Chemparathy | db6db5d | 2010-05-07 17:06:33 -0400 | [diff] [blame] | 601 | __raw_writel(0x83e70b13, base + 0x6c); |
| 602 | __raw_writel(0x95a4f1e0, base + 0x70); |
| 603 | |
| 604 | iounmap(base); |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 605 | |
Sekhar Nori | 75c99bb | 2009-11-16 17:21:31 +0530 | [diff] [blame] | 606 | ret = platform_device_register(&da8xx_rtc_device); |
| 607 | if (!ret) |
| 608 | /* Atleast on DA850, RTC is a wakeup source */ |
| 609 | device_init_wakeup(&da8xx_rtc_device.dev, true); |
| 610 | |
| 611 | return ret; |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 612 | } |
Sekhar Nori | 1960e69 | 2009-10-22 15:12:14 +0530 | [diff] [blame] | 613 | |
Sekhar Nori | 948c66d | 2009-11-16 17:21:37 +0530 | [diff] [blame] | 614 | static void __iomem *da8xx_ddr2_ctlr_base; |
| 615 | void __iomem * __init da8xx_get_mem_ctlr(void) |
| 616 | { |
| 617 | if (da8xx_ddr2_ctlr_base) |
| 618 | return da8xx_ddr2_ctlr_base; |
| 619 | |
| 620 | da8xx_ddr2_ctlr_base = ioremap(DA8XX_DDR2_CTL_BASE, SZ_32K); |
| 621 | if (!da8xx_ddr2_ctlr_base) |
| 622 | pr_warning("%s: Unable to map DDR2 controller", __func__); |
| 623 | |
| 624 | return da8xx_ddr2_ctlr_base; |
| 625 | } |
| 626 | |
Sekhar Nori | 1960e69 | 2009-10-22 15:12:14 +0530 | [diff] [blame] | 627 | static struct resource da8xx_cpuidle_resources[] = { |
| 628 | { |
| 629 | .start = DA8XX_DDR2_CTL_BASE, |
| 630 | .end = DA8XX_DDR2_CTL_BASE + SZ_32K - 1, |
| 631 | .flags = IORESOURCE_MEM, |
| 632 | }, |
| 633 | }; |
| 634 | |
| 635 | /* DA8XX devices support DDR2 power down */ |
| 636 | static struct davinci_cpuidle_config da8xx_cpuidle_pdata = { |
| 637 | .ddr2_pdown = 1, |
| 638 | }; |
| 639 | |
| 640 | |
| 641 | static struct platform_device da8xx_cpuidle_device = { |
| 642 | .name = "cpuidle-davinci", |
| 643 | .num_resources = ARRAY_SIZE(da8xx_cpuidle_resources), |
| 644 | .resource = da8xx_cpuidle_resources, |
| 645 | .dev = { |
| 646 | .platform_data = &da8xx_cpuidle_pdata, |
| 647 | }, |
| 648 | }; |
| 649 | |
| 650 | int __init da8xx_register_cpuidle(void) |
| 651 | { |
Sekhar Nori | 948c66d | 2009-11-16 17:21:37 +0530 | [diff] [blame] | 652 | da8xx_cpuidle_pdata.ddr2_ctlr_base = da8xx_get_mem_ctlr(); |
| 653 | |
Sekhar Nori | 1960e69 | 2009-10-22 15:12:14 +0530 | [diff] [blame] | 654 | return platform_device_register(&da8xx_cpuidle_device); |
| 655 | } |