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> |
Robert Tivy | 5c71d61 | 2013-03-28 18:41:46 -0700 | [diff] [blame] | 15 | #include <linux/dma-contiguous.h> |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 16 | #include <linux/serial_8250.h> |
Sekhar Nori | cbb2c96 | 2011-07-06 06:01:23 +0000 | [diff] [blame] | 17 | #include <linux/ahci_platform.h> |
| 18 | #include <linux/clk.h> |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 19 | #include <linux/reboot.h> |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 20 | |
| 21 | #include <mach/cputype.h> |
| 22 | #include <mach/common.h> |
| 23 | #include <mach/time.h> |
| 24 | #include <mach/da8xx.h> |
Sekhar Nori | 1960e69 | 2009-10-22 15:12:14 +0530 | [diff] [blame] | 25 | #include <mach/cpuidle.h> |
Matt Porter | 8e0d72d | 2012-10-08 09:53:08 -0400 | [diff] [blame] | 26 | #include <mach/sram.h> |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 27 | |
| 28 | #include "clock.h" |
Hebbar, Gururaja | 896f66b | 2012-08-27 18:56:41 +0530 | [diff] [blame] | 29 | #include "asp.h" |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 30 | |
| 31 | #define DA8XX_TPCC_BASE 0x01c00000 |
| 32 | #define DA8XX_TPTC0_BASE 0x01c08000 |
| 33 | #define DA8XX_TPTC1_BASE 0x01c08400 |
| 34 | #define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */ |
| 35 | #define DA8XX_I2C0_BASE 0x01c22000 |
Sergei Shtylyov | 8ac764e | 2011-04-06 17:29:24 +0000 | [diff] [blame] | 36 | #define DA8XX_RTC_BASE 0x01c23000 |
Matt Porter | 8e0d72d | 2012-10-08 09:53:08 -0400 | [diff] [blame] | 37 | #define DA8XX_PRUSS_MEM_BASE 0x01c30000 |
Sergei Shtylyov | 8ac764e | 2011-04-06 17:29:24 +0000 | [diff] [blame] | 38 | #define DA8XX_MMCSD0_BASE 0x01c40000 |
| 39 | #define DA8XX_SPI0_BASE 0x01c41000 |
| 40 | #define DA830_SPI1_BASE 0x01e12000 |
| 41 | #define DA8XX_LCD_CNTRL_BASE 0x01e13000 |
Sekhar Nori | cbb2c96 | 2011-07-06 06:01:23 +0000 | [diff] [blame] | 42 | #define DA850_SATA_BASE 0x01e18000 |
Sergei Shtylyov | 8ac764e | 2011-04-06 17:29:24 +0000 | [diff] [blame] | 43 | #define DA850_MMCSD1_BASE 0x01e1b000 |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 44 | #define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000 |
| 45 | #define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000 |
| 46 | #define DA8XX_EMAC_CPGMAC_BASE 0x01e23000 |
| 47 | #define DA8XX_EMAC_MDIO_BASE 0x01e24000 |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 48 | #define DA8XX_I2C1_BASE 0x01e28000 |
Sergei Shtylyov | 8ac764e | 2011-04-06 17:29:24 +0000 | [diff] [blame] | 49 | #define DA850_TPCC1_BASE 0x01e30000 |
| 50 | #define DA850_TPTC2_BASE 0x01e38000 |
Sergei Shtylyov | 9e7d24f | 2011-04-06 17:17:21 +0000 | [diff] [blame] | 51 | #define DA850_SPI1_BASE 0x01f0e000 |
Sergei Shtylyov | 8ac764e | 2011-04-06 17:29:24 +0000 | [diff] [blame] | 52 | #define DA8XX_DDR2_CTL_BASE 0xb0000000 |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 53 | |
| 54 | #define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000 |
| 55 | #define DA8XX_EMAC_MOD_REG_OFFSET 0x2000 |
| 56 | #define DA8XX_EMAC_RAM_OFFSET 0x0000 |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 57 | #define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K |
| 58 | |
Michael Williamson | 54ce688 | 2011-02-24 10:18:28 +0530 | [diff] [blame] | 59 | #define DA8XX_DMA_SPI0_RX EDMA_CTLR_CHAN(0, 14) |
| 60 | #define DA8XX_DMA_SPI0_TX EDMA_CTLR_CHAN(0, 15) |
Michael Williamson | e38c2b2 | 2011-02-22 13:36:57 +0000 | [diff] [blame] | 61 | #define DA8XX_DMA_MMCSD0_RX EDMA_CTLR_CHAN(0, 16) |
| 62 | #define DA8XX_DMA_MMCSD0_TX EDMA_CTLR_CHAN(0, 17) |
Michael Williamson | 54ce688 | 2011-02-24 10:18:28 +0530 | [diff] [blame] | 63 | #define DA8XX_DMA_SPI1_RX EDMA_CTLR_CHAN(0, 18) |
| 64 | #define DA8XX_DMA_SPI1_TX EDMA_CTLR_CHAN(0, 19) |
Michael Williamson | e38c2b2 | 2011-02-22 13:36:57 +0000 | [diff] [blame] | 65 | #define DA850_DMA_MMCSD1_RX EDMA_CTLR_CHAN(1, 28) |
| 66 | #define DA850_DMA_MMCSD1_TX EDMA_CTLR_CHAN(1, 29) |
| 67 | |
Sekhar Nori | d2de058 | 2009-11-16 17:21:32 +0530 | [diff] [blame] | 68 | void __iomem *da8xx_syscfg0_base; |
| 69 | void __iomem *da8xx_syscfg1_base; |
Sekhar Nori | 6a28adef | 2009-08-31 15:47:59 +0530 | [diff] [blame] | 70 | |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 71 | static struct plat_serial8250_port da8xx_serial0_pdata[] = { |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 72 | { |
| 73 | .mapbase = DA8XX_UART0_BASE, |
| 74 | .irq = IRQ_DA8XX_UARTINT0, |
| 75 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 76 | UPF_IOREMAP, |
| 77 | .iotype = UPIO_MEM, |
| 78 | .regshift = 2, |
| 79 | }, |
| 80 | { |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 81 | .flags = 0, |
| 82 | } |
| 83 | }; |
| 84 | static struct plat_serial8250_port da8xx_serial1_pdata[] = { |
| 85 | { |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 86 | .mapbase = DA8XX_UART1_BASE, |
| 87 | .irq = IRQ_DA8XX_UARTINT1, |
| 88 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 89 | UPF_IOREMAP, |
| 90 | .iotype = UPIO_MEM, |
| 91 | .regshift = 2, |
| 92 | }, |
| 93 | { |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 94 | .flags = 0, |
| 95 | } |
| 96 | }; |
| 97 | static struct plat_serial8250_port da8xx_serial2_pdata[] = { |
| 98 | { |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 99 | .mapbase = DA8XX_UART2_BASE, |
| 100 | .irq = IRQ_DA8XX_UARTINT2, |
| 101 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 102 | UPF_IOREMAP, |
| 103 | .iotype = UPIO_MEM, |
| 104 | .regshift = 2, |
| 105 | }, |
| 106 | { |
| 107 | .flags = 0, |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 108 | } |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 109 | }; |
| 110 | |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 111 | struct platform_device da8xx_serial_device[] = { |
| 112 | { |
| 113 | .name = "serial8250", |
| 114 | .id = PLAT8250_DEV_PLATFORM, |
| 115 | .dev = { |
| 116 | .platform_data = da8xx_serial0_pdata, |
| 117 | } |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 118 | }, |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 119 | { |
| 120 | .name = "serial8250", |
| 121 | .id = PLAT8250_DEV_PLATFORM1, |
| 122 | .dev = { |
| 123 | .platform_data = da8xx_serial1_pdata, |
| 124 | } |
| 125 | }, |
| 126 | { |
| 127 | .name = "serial8250", |
| 128 | .id = PLAT8250_DEV_PLATFORM2, |
| 129 | .dev = { |
| 130 | .platform_data = da8xx_serial2_pdata, |
| 131 | } |
| 132 | }, |
| 133 | { |
| 134 | } |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 135 | }; |
| 136 | |
Matt Porter | 6cba435 | 2013-06-20 16:06:38 -0500 | [diff] [blame] | 137 | static s8 da8xx_queue_tc_mapping[][2] = { |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 138 | /* {event queue no, TC no} */ |
| 139 | {0, 0}, |
| 140 | {1, 1}, |
| 141 | {-1, -1} |
| 142 | }; |
| 143 | |
Matt Porter | 6cba435 | 2013-06-20 16:06:38 -0500 | [diff] [blame] | 144 | static s8 da8xx_queue_priority_mapping[][2] = { |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 145 | /* {event queue no, Priority} */ |
| 146 | {0, 3}, |
| 147 | {1, 7}, |
| 148 | {-1, -1} |
| 149 | }; |
| 150 | |
Matt Porter | 6cba435 | 2013-06-20 16:06:38 -0500 | [diff] [blame] | 151 | static s8 da850_queue_tc_mapping[][2] = { |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 152 | /* {event queue no, TC no} */ |
| 153 | {0, 0}, |
| 154 | {-1, -1} |
| 155 | }; |
| 156 | |
Matt Porter | 6cba435 | 2013-06-20 16:06:38 -0500 | [diff] [blame] | 157 | static s8 da850_queue_priority_mapping[][2] = { |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 158 | /* {event queue no, Priority} */ |
| 159 | {0, 3}, |
| 160 | {-1, -1} |
| 161 | }; |
| 162 | |
Sekhar Nori | bc3ac9f | 2010-06-29 11:35:12 +0530 | [diff] [blame] | 163 | static struct edma_soc_info da830_edma_cc0_info = { |
| 164 | .n_channel = 32, |
| 165 | .n_region = 4, |
| 166 | .n_slot = 128, |
| 167 | .n_tc = 2, |
| 168 | .n_cc = 1, |
| 169 | .queue_tc_mapping = da8xx_queue_tc_mapping, |
| 170 | .queue_priority_mapping = da8xx_queue_priority_mapping, |
Ido Yariv | f23fe85 | 2011-07-10 16:14:35 +0300 | [diff] [blame] | 171 | .default_queue = EVENTQ_1, |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 172 | }; |
| 173 | |
Sekhar Nori | bc3ac9f | 2010-06-29 11:35:12 +0530 | [diff] [blame] | 174 | static struct edma_soc_info *da830_edma_info[EDMA_MAX_CC] = { |
| 175 | &da830_edma_cc0_info, |
| 176 | }; |
| 177 | |
| 178 | static struct edma_soc_info da850_edma_cc_info[] = { |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 179 | { |
| 180 | .n_channel = 32, |
| 181 | .n_region = 4, |
| 182 | .n_slot = 128, |
| 183 | .n_tc = 2, |
| 184 | .n_cc = 1, |
| 185 | .queue_tc_mapping = da8xx_queue_tc_mapping, |
| 186 | .queue_priority_mapping = da8xx_queue_priority_mapping, |
Ido Yariv | f23fe85 | 2011-07-10 16:14:35 +0300 | [diff] [blame] | 187 | .default_queue = EVENTQ_1, |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 188 | }, |
| 189 | { |
| 190 | .n_channel = 32, |
| 191 | .n_region = 4, |
| 192 | .n_slot = 128, |
| 193 | .n_tc = 1, |
| 194 | .n_cc = 1, |
| 195 | .queue_tc_mapping = da850_queue_tc_mapping, |
| 196 | .queue_priority_mapping = da850_queue_priority_mapping, |
Ido Yariv | f23fe85 | 2011-07-10 16:14:35 +0300 | [diff] [blame] | 197 | .default_queue = EVENTQ_0, |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 198 | }, |
| 199 | }; |
| 200 | |
Sekhar Nori | bc3ac9f | 2010-06-29 11:35:12 +0530 | [diff] [blame] | 201 | static struct edma_soc_info *da850_edma_info[EDMA_MAX_CC] = { |
| 202 | &da850_edma_cc_info[0], |
| 203 | &da850_edma_cc_info[1], |
| 204 | }; |
| 205 | |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 206 | static struct resource da830_edma_resources[] = { |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 207 | { |
| 208 | .name = "edma_cc0", |
| 209 | .start = DA8XX_TPCC_BASE, |
| 210 | .end = DA8XX_TPCC_BASE + SZ_32K - 1, |
| 211 | .flags = IORESOURCE_MEM, |
| 212 | }, |
| 213 | { |
| 214 | .name = "edma_tc0", |
| 215 | .start = DA8XX_TPTC0_BASE, |
| 216 | .end = DA8XX_TPTC0_BASE + SZ_1K - 1, |
| 217 | .flags = IORESOURCE_MEM, |
| 218 | }, |
| 219 | { |
| 220 | .name = "edma_tc1", |
| 221 | .start = DA8XX_TPTC1_BASE, |
| 222 | .end = DA8XX_TPTC1_BASE + SZ_1K - 1, |
| 223 | .flags = IORESOURCE_MEM, |
| 224 | }, |
| 225 | { |
| 226 | .name = "edma0", |
Sudhakar Rajashekhara | 2259bbd | 2009-07-10 06:28:52 -0400 | [diff] [blame] | 227 | .start = IRQ_DA8XX_CCINT0, |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 228 | .flags = IORESOURCE_IRQ, |
| 229 | }, |
| 230 | { |
| 231 | .name = "edma0_err", |
| 232 | .start = IRQ_DA8XX_CCERRINT, |
| 233 | .flags = IORESOURCE_IRQ, |
| 234 | }, |
| 235 | }; |
| 236 | |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 237 | static struct resource da850_edma_resources[] = { |
| 238 | { |
| 239 | .name = "edma_cc0", |
| 240 | .start = DA8XX_TPCC_BASE, |
| 241 | .end = DA8XX_TPCC_BASE + SZ_32K - 1, |
| 242 | .flags = IORESOURCE_MEM, |
| 243 | }, |
| 244 | { |
| 245 | .name = "edma_tc0", |
| 246 | .start = DA8XX_TPTC0_BASE, |
| 247 | .end = DA8XX_TPTC0_BASE + SZ_1K - 1, |
| 248 | .flags = IORESOURCE_MEM, |
| 249 | }, |
| 250 | { |
| 251 | .name = "edma_tc1", |
| 252 | .start = DA8XX_TPTC1_BASE, |
| 253 | .end = DA8XX_TPTC1_BASE + SZ_1K - 1, |
| 254 | .flags = IORESOURCE_MEM, |
| 255 | }, |
| 256 | { |
| 257 | .name = "edma_cc1", |
| 258 | .start = DA850_TPCC1_BASE, |
| 259 | .end = DA850_TPCC1_BASE + SZ_32K - 1, |
| 260 | .flags = IORESOURCE_MEM, |
| 261 | }, |
| 262 | { |
| 263 | .name = "edma_tc2", |
| 264 | .start = DA850_TPTC2_BASE, |
| 265 | .end = DA850_TPTC2_BASE + SZ_1K - 1, |
| 266 | .flags = IORESOURCE_MEM, |
| 267 | }, |
| 268 | { |
| 269 | .name = "edma0", |
| 270 | .start = IRQ_DA8XX_CCINT0, |
| 271 | .flags = IORESOURCE_IRQ, |
| 272 | }, |
| 273 | { |
| 274 | .name = "edma0_err", |
| 275 | .start = IRQ_DA8XX_CCERRINT, |
| 276 | .flags = IORESOURCE_IRQ, |
| 277 | }, |
| 278 | { |
| 279 | .name = "edma1", |
| 280 | .start = IRQ_DA850_CCINT1, |
| 281 | .flags = IORESOURCE_IRQ, |
| 282 | }, |
| 283 | { |
| 284 | .name = "edma1_err", |
| 285 | .start = IRQ_DA850_CCERRINT1, |
| 286 | .flags = IORESOURCE_IRQ, |
| 287 | }, |
| 288 | }; |
| 289 | |
| 290 | static struct platform_device da830_edma_device = { |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 291 | .name = "edma", |
| 292 | .id = -1, |
| 293 | .dev = { |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 294 | .platform_data = da830_edma_info, |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 295 | }, |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 296 | .num_resources = ARRAY_SIZE(da830_edma_resources), |
| 297 | .resource = da830_edma_resources, |
| 298 | }; |
| 299 | |
| 300 | static struct platform_device da850_edma_device = { |
| 301 | .name = "edma", |
| 302 | .id = -1, |
| 303 | .dev = { |
| 304 | .platform_data = da850_edma_info, |
| 305 | }, |
| 306 | .num_resources = ARRAY_SIZE(da850_edma_resources), |
| 307 | .resource = da850_edma_resources, |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 308 | }; |
| 309 | |
Rajashekhara, Sudhakar | a941c50 | 2010-06-29 11:35:14 +0530 | [diff] [blame] | 310 | int __init da830_register_edma(struct edma_rsv_info *rsv) |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 311 | { |
Rajashekhara, Sudhakar | a941c50 | 2010-06-29 11:35:14 +0530 | [diff] [blame] | 312 | da830_edma_cc0_info.rsv = rsv; |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 313 | |
Rajashekhara, Sudhakar | a941c50 | 2010-06-29 11:35:14 +0530 | [diff] [blame] | 314 | return platform_device_register(&da830_edma_device); |
| 315 | } |
Sudhakar Rajashekhara | 3f995f2 | 2010-01-06 17:30:06 +0530 | [diff] [blame] | 316 | |
Rajashekhara, Sudhakar | a941c50 | 2010-06-29 11:35:14 +0530 | [diff] [blame] | 317 | int __init da850_register_edma(struct edma_rsv_info *rsv[2]) |
| 318 | { |
| 319 | if (rsv) { |
| 320 | da850_edma_cc_info[0].rsv = rsv[0]; |
| 321 | da850_edma_cc_info[1].rsv = rsv[1]; |
| 322 | } |
| 323 | |
| 324 | return platform_device_register(&da850_edma_device); |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | static struct resource da8xx_i2c_resources0[] = { |
| 328 | { |
| 329 | .start = DA8XX_I2C0_BASE, |
| 330 | .end = DA8XX_I2C0_BASE + SZ_4K - 1, |
| 331 | .flags = IORESOURCE_MEM, |
| 332 | }, |
| 333 | { |
| 334 | .start = IRQ_DA8XX_I2CINT0, |
| 335 | .end = IRQ_DA8XX_I2CINT0, |
| 336 | .flags = IORESOURCE_IRQ, |
| 337 | }, |
| 338 | }; |
| 339 | |
| 340 | static struct platform_device da8xx_i2c_device0 = { |
| 341 | .name = "i2c_davinci", |
| 342 | .id = 1, |
| 343 | .num_resources = ARRAY_SIZE(da8xx_i2c_resources0), |
| 344 | .resource = da8xx_i2c_resources0, |
| 345 | }; |
| 346 | |
| 347 | static struct resource da8xx_i2c_resources1[] = { |
| 348 | { |
| 349 | .start = DA8XX_I2C1_BASE, |
| 350 | .end = DA8XX_I2C1_BASE + SZ_4K - 1, |
| 351 | .flags = IORESOURCE_MEM, |
| 352 | }, |
| 353 | { |
| 354 | .start = IRQ_DA8XX_I2CINT1, |
| 355 | .end = IRQ_DA8XX_I2CINT1, |
| 356 | .flags = IORESOURCE_IRQ, |
| 357 | }, |
| 358 | }; |
| 359 | |
| 360 | static struct platform_device da8xx_i2c_device1 = { |
| 361 | .name = "i2c_davinci", |
| 362 | .id = 2, |
| 363 | .num_resources = ARRAY_SIZE(da8xx_i2c_resources1), |
| 364 | .resource = da8xx_i2c_resources1, |
| 365 | }; |
| 366 | |
| 367 | int __init da8xx_register_i2c(int instance, |
| 368 | struct davinci_i2c_platform_data *pdata) |
| 369 | { |
| 370 | struct platform_device *pdev; |
| 371 | |
| 372 | if (instance == 0) |
| 373 | pdev = &da8xx_i2c_device0; |
| 374 | else if (instance == 1) |
| 375 | pdev = &da8xx_i2c_device1; |
| 376 | else |
| 377 | return -EINVAL; |
| 378 | |
| 379 | pdev->dev.platform_data = pdata; |
| 380 | return platform_device_register(pdev); |
| 381 | } |
| 382 | |
| 383 | static struct resource da8xx_watchdog_resources[] = { |
| 384 | { |
| 385 | .start = DA8XX_WDOG_BASE, |
| 386 | .end = DA8XX_WDOG_BASE + SZ_4K - 1, |
| 387 | .flags = IORESOURCE_MEM, |
| 388 | }, |
| 389 | }; |
| 390 | |
Kumar, Anil | 19c7c0d | 2013-02-06 09:30:04 +0530 | [diff] [blame] | 391 | static struct platform_device da8xx_wdt_device = { |
Ivan Khoronzhuk | 8437481 | 2013-11-27 15:31:53 +0200 | [diff] [blame] | 392 | .name = "davinci-wdt", |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 393 | .id = -1, |
| 394 | .num_resources = ARRAY_SIZE(da8xx_watchdog_resources), |
| 395 | .resource = da8xx_watchdog_resources, |
| 396 | }; |
| 397 | |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 398 | void da8xx_restart(enum reboot_mode mode, const char *cmd) |
Sekhar Nori | c6121dd | 2011-12-05 11:29:46 +0100 | [diff] [blame] | 399 | { |
Kumar, Anil | 19c7c0d | 2013-02-06 09:30:04 +0530 | [diff] [blame] | 400 | struct device *dev; |
| 401 | |
Ivan Khoronzhuk | 8437481 | 2013-11-27 15:31:53 +0200 | [diff] [blame] | 402 | dev = bus_find_device_by_name(&platform_bus_type, NULL, "davinci-wdt"); |
Kumar, Anil | 19c7c0d | 2013-02-06 09:30:04 +0530 | [diff] [blame] | 403 | if (!dev) { |
| 404 | pr_err("%s: failed to find watchdog device\n", __func__); |
| 405 | return; |
| 406 | } |
| 407 | |
| 408 | davinci_watchdog_reset(to_platform_device(dev)); |
Sekhar Nori | c6121dd | 2011-12-05 11:29:46 +0100 | [diff] [blame] | 409 | } |
| 410 | |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 411 | int __init da8xx_register_watchdog(void) |
| 412 | { |
Cyril Chemparathy | c78a5bc | 2010-05-01 18:38:28 -0400 | [diff] [blame] | 413 | return platform_device_register(&da8xx_wdt_device); |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 414 | } |
| 415 | |
| 416 | static struct resource da8xx_emac_resources[] = { |
| 417 | { |
| 418 | .start = DA8XX_EMAC_CPPI_PORT_BASE, |
Cyril Chemparathy | d22960c | 2010-09-15 10:11:22 -0400 | [diff] [blame] | 419 | .end = DA8XX_EMAC_CPPI_PORT_BASE + SZ_16K - 1, |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 420 | .flags = IORESOURCE_MEM, |
| 421 | }, |
| 422 | { |
| 423 | .start = IRQ_DA8XX_C0_RX_THRESH_PULSE, |
| 424 | .end = IRQ_DA8XX_C0_RX_THRESH_PULSE, |
| 425 | .flags = IORESOURCE_IRQ, |
| 426 | }, |
| 427 | { |
| 428 | .start = IRQ_DA8XX_C0_RX_PULSE, |
| 429 | .end = IRQ_DA8XX_C0_RX_PULSE, |
| 430 | .flags = IORESOURCE_IRQ, |
| 431 | }, |
| 432 | { |
| 433 | .start = IRQ_DA8XX_C0_TX_PULSE, |
| 434 | .end = IRQ_DA8XX_C0_TX_PULSE, |
| 435 | .flags = IORESOURCE_IRQ, |
| 436 | }, |
| 437 | { |
| 438 | .start = IRQ_DA8XX_C0_MISC_PULSE, |
| 439 | .end = IRQ_DA8XX_C0_MISC_PULSE, |
| 440 | .flags = IORESOURCE_IRQ, |
| 441 | }, |
| 442 | }; |
| 443 | |
| 444 | struct emac_platform_data da8xx_emac_pdata = { |
| 445 | .ctrl_reg_offset = DA8XX_EMAC_CTRL_REG_OFFSET, |
| 446 | .ctrl_mod_reg_offset = DA8XX_EMAC_MOD_REG_OFFSET, |
| 447 | .ctrl_ram_offset = DA8XX_EMAC_RAM_OFFSET, |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame] | 448 | .ctrl_ram_size = DA8XX_EMAC_CTRL_RAM_SIZE, |
| 449 | .version = EMAC_VERSION_2, |
| 450 | }; |
| 451 | |
| 452 | static struct platform_device da8xx_emac_device = { |
| 453 | .name = "davinci_emac", |
| 454 | .id = 1, |
| 455 | .dev = { |
| 456 | .platform_data = &da8xx_emac_pdata, |
| 457 | }, |
| 458 | .num_resources = ARRAY_SIZE(da8xx_emac_resources), |
| 459 | .resource = da8xx_emac_resources, |
| 460 | }; |
| 461 | |
Cyril Chemparathy | d22960c | 2010-09-15 10:11:22 -0400 | [diff] [blame] | 462 | static struct resource da8xx_mdio_resources[] = { |
| 463 | { |
| 464 | .start = DA8XX_EMAC_MDIO_BASE, |
| 465 | .end = DA8XX_EMAC_MDIO_BASE + SZ_4K - 1, |
| 466 | .flags = IORESOURCE_MEM, |
| 467 | }, |
| 468 | }; |
| 469 | |
| 470 | static struct platform_device da8xx_mdio_device = { |
| 471 | .name = "davinci_mdio", |
| 472 | .id = 0, |
| 473 | .num_resources = ARRAY_SIZE(da8xx_mdio_resources), |
| 474 | .resource = da8xx_mdio_resources, |
| 475 | }; |
| 476 | |
Mark A. Greer | 31f53cf | 2009-08-28 15:02:54 -0700 | [diff] [blame] | 477 | int __init da8xx_register_emac(void) |
| 478 | { |
Cyril Chemparathy | d22960c | 2010-09-15 10:11:22 -0400 | [diff] [blame] | 479 | int ret; |
| 480 | |
| 481 | ret = platform_device_register(&da8xx_mdio_device); |
| 482 | if (ret < 0) |
| 483 | return ret; |
Lad, Prabhakar | 46c1833 | 2013-08-15 11:31:33 +0530 | [diff] [blame] | 484 | |
| 485 | return platform_device_register(&da8xx_emac_device); |
Mark A. Greer | 31f53cf | 2009-08-28 15:02:54 -0700 | [diff] [blame] | 486 | } |
| 487 | |
Chaithrika U S | e33ef5e | 2009-08-11 17:01:59 -0400 | [diff] [blame] | 488 | static struct resource da830_mcasp1_resources[] = { |
| 489 | { |
Peter Ujfalusi | ee880db | 2013-11-13 16:48:17 +0200 | [diff] [blame] | 490 | .name = "mpu", |
Chaithrika U S | e33ef5e | 2009-08-11 17:01:59 -0400 | [diff] [blame] | 491 | .start = DAVINCI_DA830_MCASP1_REG_BASE, |
| 492 | .end = DAVINCI_DA830_MCASP1_REG_BASE + (SZ_1K * 12) - 1, |
| 493 | .flags = IORESOURCE_MEM, |
| 494 | }, |
| 495 | /* TX event */ |
| 496 | { |
| 497 | .start = DAVINCI_DA830_DMA_MCASP1_AXEVT, |
| 498 | .end = DAVINCI_DA830_DMA_MCASP1_AXEVT, |
| 499 | .flags = IORESOURCE_DMA, |
| 500 | }, |
| 501 | /* RX event */ |
| 502 | { |
| 503 | .start = DAVINCI_DA830_DMA_MCASP1_AREVT, |
| 504 | .end = DAVINCI_DA830_DMA_MCASP1_AREVT, |
| 505 | .flags = IORESOURCE_DMA, |
| 506 | }, |
| 507 | }; |
| 508 | |
| 509 | static struct platform_device da830_mcasp1_device = { |
| 510 | .name = "davinci-mcasp", |
| 511 | .id = 1, |
| 512 | .num_resources = ARRAY_SIZE(da830_mcasp1_resources), |
| 513 | .resource = da830_mcasp1_resources, |
| 514 | }; |
| 515 | |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 516 | static struct resource da850_mcasp_resources[] = { |
| 517 | { |
Peter Ujfalusi | ee880db | 2013-11-13 16:48:17 +0200 | [diff] [blame] | 518 | .name = "mpu", |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 519 | .start = DAVINCI_DA8XX_MCASP0_REG_BASE, |
| 520 | .end = DAVINCI_DA8XX_MCASP0_REG_BASE + (SZ_1K * 12) - 1, |
| 521 | .flags = IORESOURCE_MEM, |
| 522 | }, |
| 523 | /* TX event */ |
| 524 | { |
| 525 | .start = DAVINCI_DA8XX_DMA_MCASP0_AXEVT, |
| 526 | .end = DAVINCI_DA8XX_DMA_MCASP0_AXEVT, |
| 527 | .flags = IORESOURCE_DMA, |
| 528 | }, |
| 529 | /* RX event */ |
| 530 | { |
| 531 | .start = DAVINCI_DA8XX_DMA_MCASP0_AREVT, |
| 532 | .end = DAVINCI_DA8XX_DMA_MCASP0_AREVT, |
| 533 | .flags = IORESOURCE_DMA, |
| 534 | }, |
| 535 | }; |
| 536 | |
| 537 | static struct platform_device da850_mcasp_device = { |
| 538 | .name = "davinci-mcasp", |
| 539 | .id = 0, |
| 540 | .num_resources = ARRAY_SIZE(da850_mcasp_resources), |
| 541 | .resource = da850_mcasp_resources, |
| 542 | }; |
| 543 | |
Mark A. Greer | b8864aa | 2009-08-28 15:05:02 -0700 | [diff] [blame] | 544 | 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] | 545 | { |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 546 | /* DA830/OMAP-L137 has 3 instances of McASP */ |
| 547 | if (cpu_is_davinci_da830() && id == 1) { |
Chaithrika U S | e33ef5e | 2009-08-11 17:01:59 -0400 | [diff] [blame] | 548 | da830_mcasp1_device.dev.platform_data = pdata; |
| 549 | platform_device_register(&da830_mcasp1_device); |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 550 | } else if (cpu_is_davinci_da850()) { |
| 551 | da850_mcasp_device.dev.platform_data = pdata; |
| 552 | platform_device_register(&da850_mcasp_device); |
Chaithrika U S | e33ef5e | 2009-08-11 17:01:59 -0400 | [diff] [blame] | 553 | } |
| 554 | } |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 555 | |
Matt Porter | 8e0d72d | 2012-10-08 09:53:08 -0400 | [diff] [blame] | 556 | static struct resource da8xx_pruss_resources[] = { |
| 557 | { |
| 558 | .start = DA8XX_PRUSS_MEM_BASE, |
| 559 | .end = DA8XX_PRUSS_MEM_BASE + 0xFFFF, |
| 560 | .flags = IORESOURCE_MEM, |
| 561 | }, |
| 562 | { |
| 563 | .start = IRQ_DA8XX_EVTOUT0, |
| 564 | .end = IRQ_DA8XX_EVTOUT0, |
| 565 | .flags = IORESOURCE_IRQ, |
| 566 | }, |
| 567 | { |
| 568 | .start = IRQ_DA8XX_EVTOUT1, |
| 569 | .end = IRQ_DA8XX_EVTOUT1, |
| 570 | .flags = IORESOURCE_IRQ, |
| 571 | }, |
| 572 | { |
| 573 | .start = IRQ_DA8XX_EVTOUT2, |
| 574 | .end = IRQ_DA8XX_EVTOUT2, |
| 575 | .flags = IORESOURCE_IRQ, |
| 576 | }, |
| 577 | { |
| 578 | .start = IRQ_DA8XX_EVTOUT3, |
| 579 | .end = IRQ_DA8XX_EVTOUT3, |
| 580 | .flags = IORESOURCE_IRQ, |
| 581 | }, |
| 582 | { |
| 583 | .start = IRQ_DA8XX_EVTOUT4, |
| 584 | .end = IRQ_DA8XX_EVTOUT4, |
| 585 | .flags = IORESOURCE_IRQ, |
| 586 | }, |
| 587 | { |
| 588 | .start = IRQ_DA8XX_EVTOUT5, |
| 589 | .end = IRQ_DA8XX_EVTOUT5, |
| 590 | .flags = IORESOURCE_IRQ, |
| 591 | }, |
| 592 | { |
| 593 | .start = IRQ_DA8XX_EVTOUT6, |
| 594 | .end = IRQ_DA8XX_EVTOUT6, |
| 595 | .flags = IORESOURCE_IRQ, |
| 596 | }, |
| 597 | { |
| 598 | .start = IRQ_DA8XX_EVTOUT7, |
| 599 | .end = IRQ_DA8XX_EVTOUT7, |
| 600 | .flags = IORESOURCE_IRQ, |
| 601 | }, |
| 602 | }; |
| 603 | |
| 604 | static struct uio_pruss_pdata da8xx_uio_pruss_pdata = { |
| 605 | .pintc_base = 0x4000, |
| 606 | }; |
| 607 | |
| 608 | static struct platform_device da8xx_uio_pruss_dev = { |
| 609 | .name = "pruss_uio", |
| 610 | .id = -1, |
| 611 | .num_resources = ARRAY_SIZE(da8xx_pruss_resources), |
| 612 | .resource = da8xx_pruss_resources, |
| 613 | .dev = { |
| 614 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 615 | .platform_data = &da8xx_uio_pruss_pdata, |
| 616 | } |
| 617 | }; |
| 618 | |
| 619 | int __init da8xx_register_uio_pruss(void) |
| 620 | { |
| 621 | da8xx_uio_pruss_pdata.sram_pool = sram_get_gen_pool(); |
| 622 | return platform_device_register(&da8xx_uio_pruss_dev); |
| 623 | } |
| 624 | |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 625 | static struct lcd_ctrl_config lcd_cfg = { |
Manjunathappa, Prakash | 3b43ad2 | 2012-10-16 10:23:16 +0530 | [diff] [blame] | 626 | .panel_shade = COLOR_ACTIVE, |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 627 | .bpp = 16, |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 628 | }; |
| 629 | |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 630 | struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata = { |
| 631 | .manu_name = "sharp", |
| 632 | .controller_data = &lcd_cfg, |
| 633 | .type = "Sharp_LCD035Q3DG01", |
| 634 | }; |
| 635 | |
| 636 | struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata = { |
| 637 | .manu_name = "sharp", |
| 638 | .controller_data = &lcd_cfg, |
| 639 | .type = "Sharp_LK043T1DG01", |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 640 | }; |
| 641 | |
| 642 | static struct resource da8xx_lcdc_resources[] = { |
| 643 | [0] = { /* registers */ |
| 644 | .start = DA8XX_LCD_CNTRL_BASE, |
| 645 | .end = DA8XX_LCD_CNTRL_BASE + SZ_4K - 1, |
| 646 | .flags = IORESOURCE_MEM, |
| 647 | }, |
| 648 | [1] = { /* interrupt */ |
| 649 | .start = IRQ_DA8XX_LCDINT, |
| 650 | .end = IRQ_DA8XX_LCDINT, |
| 651 | .flags = IORESOURCE_IRQ, |
| 652 | }, |
| 653 | }; |
| 654 | |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 655 | static struct platform_device da8xx_lcdc_device = { |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 656 | .name = "da8xx_lcdc", |
| 657 | .id = 0, |
| 658 | .num_resources = ARRAY_SIZE(da8xx_lcdc_resources), |
| 659 | .resource = da8xx_lcdc_resources, |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 660 | }; |
| 661 | |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 662 | int __init da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata) |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 663 | { |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 664 | da8xx_lcdc_device.dev.platform_data = pdata; |
| 665 | return platform_device_register(&da8xx_lcdc_device); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 666 | } |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 667 | |
KV Sujith | f606d38 | 2013-08-18 10:48:59 +0530 | [diff] [blame] | 668 | static struct resource da8xx_gpio_resources[] = { |
| 669 | { /* registers */ |
| 670 | .start = DA8XX_GPIO_BASE, |
| 671 | .end = DA8XX_GPIO_BASE + SZ_4K - 1, |
| 672 | .flags = IORESOURCE_MEM, |
| 673 | }, |
| 674 | { /* interrupt */ |
| 675 | .start = IRQ_DA8XX_GPIO0, |
| 676 | .end = IRQ_DA8XX_GPIO8, |
| 677 | .flags = IORESOURCE_IRQ, |
| 678 | }, |
| 679 | }; |
| 680 | |
| 681 | static struct platform_device da8xx_gpio_device = { |
| 682 | .name = "davinci_gpio", |
| 683 | .id = -1, |
| 684 | .num_resources = ARRAY_SIZE(da8xx_gpio_resources), |
| 685 | .resource = da8xx_gpio_resources, |
| 686 | }; |
| 687 | |
| 688 | int __init da8xx_register_gpio(void *pdata) |
| 689 | { |
| 690 | da8xx_gpio_device.dev.platform_data = pdata; |
| 691 | return platform_device_register(&da8xx_gpio_device); |
| 692 | } |
| 693 | |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 694 | static struct resource da8xx_mmcsd0_resources[] = { |
| 695 | { /* registers */ |
| 696 | .start = DA8XX_MMCSD0_BASE, |
| 697 | .end = DA8XX_MMCSD0_BASE + SZ_4K - 1, |
| 698 | .flags = IORESOURCE_MEM, |
| 699 | }, |
| 700 | { /* interrupt */ |
| 701 | .start = IRQ_DA8XX_MMCSDINT0, |
| 702 | .end = IRQ_DA8XX_MMCSDINT0, |
| 703 | .flags = IORESOURCE_IRQ, |
| 704 | }, |
| 705 | { /* DMA RX */ |
Michael Williamson | e38c2b2 | 2011-02-22 13:36:57 +0000 | [diff] [blame] | 706 | .start = DA8XX_DMA_MMCSD0_RX, |
| 707 | .end = DA8XX_DMA_MMCSD0_RX, |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 708 | .flags = IORESOURCE_DMA, |
| 709 | }, |
| 710 | { /* DMA TX */ |
Michael Williamson | e38c2b2 | 2011-02-22 13:36:57 +0000 | [diff] [blame] | 711 | .start = DA8XX_DMA_MMCSD0_TX, |
| 712 | .end = DA8XX_DMA_MMCSD0_TX, |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 713 | .flags = IORESOURCE_DMA, |
| 714 | }, |
| 715 | }; |
| 716 | |
| 717 | static struct platform_device da8xx_mmcsd0_device = { |
Manjunathappa, Prakash | d7ca4c7 | 2013-03-28 18:41:59 +0530 | [diff] [blame] | 718 | .name = "da830-mmc", |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 719 | .id = 0, |
| 720 | .num_resources = ARRAY_SIZE(da8xx_mmcsd0_resources), |
| 721 | .resource = da8xx_mmcsd0_resources, |
| 722 | }; |
| 723 | |
| 724 | int __init da8xx_register_mmcsd0(struct davinci_mmc_config *config) |
| 725 | { |
| 726 | da8xx_mmcsd0_device.dev.platform_data = config; |
| 727 | return platform_device_register(&da8xx_mmcsd0_device); |
| 728 | } |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 729 | |
Juha Kuikka | b8241ae | 2010-08-26 12:40:47 -0700 | [diff] [blame] | 730 | #ifdef CONFIG_ARCH_DAVINCI_DA850 |
| 731 | static struct resource da850_mmcsd1_resources[] = { |
| 732 | { /* registers */ |
| 733 | .start = DA850_MMCSD1_BASE, |
| 734 | .end = DA850_MMCSD1_BASE + SZ_4K - 1, |
| 735 | .flags = IORESOURCE_MEM, |
| 736 | }, |
| 737 | { /* interrupt */ |
| 738 | .start = IRQ_DA850_MMCSDINT0_1, |
| 739 | .end = IRQ_DA850_MMCSDINT0_1, |
| 740 | .flags = IORESOURCE_IRQ, |
| 741 | }, |
| 742 | { /* DMA RX */ |
Michael Williamson | e38c2b2 | 2011-02-22 13:36:57 +0000 | [diff] [blame] | 743 | .start = DA850_DMA_MMCSD1_RX, |
| 744 | .end = DA850_DMA_MMCSD1_RX, |
Juha Kuikka | b8241ae | 2010-08-26 12:40:47 -0700 | [diff] [blame] | 745 | .flags = IORESOURCE_DMA, |
| 746 | }, |
| 747 | { /* DMA TX */ |
Michael Williamson | e38c2b2 | 2011-02-22 13:36:57 +0000 | [diff] [blame] | 748 | .start = DA850_DMA_MMCSD1_TX, |
| 749 | .end = DA850_DMA_MMCSD1_TX, |
Juha Kuikka | b8241ae | 2010-08-26 12:40:47 -0700 | [diff] [blame] | 750 | .flags = IORESOURCE_DMA, |
| 751 | }, |
| 752 | }; |
| 753 | |
| 754 | static struct platform_device da850_mmcsd1_device = { |
Manjunathappa, Prakash | d7ca4c7 | 2013-03-28 18:41:59 +0530 | [diff] [blame] | 755 | .name = "da830-mmc", |
Juha Kuikka | b8241ae | 2010-08-26 12:40:47 -0700 | [diff] [blame] | 756 | .id = 1, |
| 757 | .num_resources = ARRAY_SIZE(da850_mmcsd1_resources), |
| 758 | .resource = da850_mmcsd1_resources, |
| 759 | }; |
| 760 | |
| 761 | int __init da850_register_mmcsd1(struct davinci_mmc_config *config) |
| 762 | { |
| 763 | da850_mmcsd1_device.dev.platform_data = config; |
| 764 | return platform_device_register(&da850_mmcsd1_device); |
| 765 | } |
| 766 | #endif |
| 767 | |
Robert Tivy | 5c71d61 | 2013-03-28 18:41:46 -0700 | [diff] [blame] | 768 | static struct resource da8xx_rproc_resources[] = { |
| 769 | { /* DSP boot address */ |
| 770 | .start = DA8XX_SYSCFG0_BASE + DA8XX_HOST1CFG_REG, |
| 771 | .end = DA8XX_SYSCFG0_BASE + DA8XX_HOST1CFG_REG + 3, |
| 772 | .flags = IORESOURCE_MEM, |
| 773 | }, |
| 774 | { /* DSP interrupt registers */ |
| 775 | .start = DA8XX_SYSCFG0_BASE + DA8XX_CHIPSIG_REG, |
| 776 | .end = DA8XX_SYSCFG0_BASE + DA8XX_CHIPSIG_REG + 7, |
| 777 | .flags = IORESOURCE_MEM, |
| 778 | }, |
| 779 | { /* dsp irq */ |
| 780 | .start = IRQ_DA8XX_CHIPINT0, |
| 781 | .end = IRQ_DA8XX_CHIPINT0, |
| 782 | .flags = IORESOURCE_IRQ, |
| 783 | }, |
| 784 | }; |
| 785 | |
| 786 | static struct platform_device da8xx_dsp = { |
| 787 | .name = "davinci-rproc", |
| 788 | .dev = { |
| 789 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 790 | }, |
| 791 | .num_resources = ARRAY_SIZE(da8xx_rproc_resources), |
| 792 | .resource = da8xx_rproc_resources, |
| 793 | }; |
| 794 | |
| 795 | #if IS_ENABLED(CONFIG_DA8XX_REMOTEPROC) |
| 796 | |
| 797 | static phys_addr_t rproc_base __initdata; |
| 798 | static unsigned long rproc_size __initdata; |
| 799 | |
| 800 | static int __init early_rproc_mem(char *p) |
| 801 | { |
| 802 | char *endp; |
| 803 | |
| 804 | if (p == NULL) |
| 805 | return 0; |
| 806 | |
| 807 | rproc_size = memparse(p, &endp); |
| 808 | if (*endp == '@') |
| 809 | rproc_base = memparse(endp + 1, NULL); |
| 810 | |
| 811 | return 0; |
| 812 | } |
| 813 | early_param("rproc_mem", early_rproc_mem); |
| 814 | |
| 815 | void __init da8xx_rproc_reserve_cma(void) |
| 816 | { |
| 817 | int ret; |
| 818 | |
| 819 | if (!rproc_base || !rproc_size) { |
| 820 | pr_err("%s: 'rproc_mem=nn@address' badly specified\n" |
| 821 | " 'nn' and 'address' must both be non-zero\n", |
| 822 | __func__); |
| 823 | |
| 824 | return; |
| 825 | } |
| 826 | |
| 827 | pr_info("%s: reserving 0x%lx @ 0x%lx...\n", |
| 828 | __func__, rproc_size, (unsigned long)rproc_base); |
| 829 | |
| 830 | ret = dma_declare_contiguous(&da8xx_dsp.dev, rproc_size, rproc_base, 0); |
| 831 | if (ret) |
| 832 | pr_err("%s: dma_declare_contiguous failed %d\n", __func__, ret); |
| 833 | } |
| 834 | |
| 835 | #else |
| 836 | |
| 837 | void __init da8xx_rproc_reserve_cma(void) |
| 838 | { |
| 839 | } |
| 840 | |
| 841 | #endif |
| 842 | |
| 843 | int __init da8xx_register_rproc(void) |
| 844 | { |
| 845 | int ret; |
| 846 | |
| 847 | ret = platform_device_register(&da8xx_dsp); |
| 848 | if (ret) |
| 849 | pr_err("%s: can't register DSP device: %d\n", __func__, ret); |
| 850 | |
| 851 | return ret; |
| 852 | }; |
| 853 | |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 854 | static struct resource da8xx_rtc_resources[] = { |
| 855 | { |
| 856 | .start = DA8XX_RTC_BASE, |
| 857 | .end = DA8XX_RTC_BASE + SZ_4K - 1, |
| 858 | .flags = IORESOURCE_MEM, |
| 859 | }, |
| 860 | { /* timer irq */ |
| 861 | .start = IRQ_DA8XX_RTC, |
| 862 | .end = IRQ_DA8XX_RTC, |
| 863 | .flags = IORESOURCE_IRQ, |
| 864 | }, |
| 865 | { /* alarm irq */ |
| 866 | .start = IRQ_DA8XX_RTC, |
| 867 | .end = IRQ_DA8XX_RTC, |
| 868 | .flags = IORESOURCE_IRQ, |
| 869 | }, |
| 870 | }; |
| 871 | |
| 872 | static struct platform_device da8xx_rtc_device = { |
Afzal Mohammed | 852168c | 2012-12-17 16:02:13 -0800 | [diff] [blame] | 873 | .name = "da830-rtc", |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 874 | .id = -1, |
| 875 | .num_resources = ARRAY_SIZE(da8xx_rtc_resources), |
| 876 | .resource = da8xx_rtc_resources, |
| 877 | }; |
| 878 | |
| 879 | int da8xx_register_rtc(void) |
| 880 | { |
Hebbar Gururaja | 79eb163 | 2013-07-03 14:17:03 +0530 | [diff] [blame] | 881 | return platform_device_register(&da8xx_rtc_device); |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 882 | } |
Sekhar Nori | 1960e69 | 2009-10-22 15:12:14 +0530 | [diff] [blame] | 883 | |
Sekhar Nori | 948c66d | 2009-11-16 17:21:37 +0530 | [diff] [blame] | 884 | static void __iomem *da8xx_ddr2_ctlr_base; |
| 885 | void __iomem * __init da8xx_get_mem_ctlr(void) |
| 886 | { |
| 887 | if (da8xx_ddr2_ctlr_base) |
| 888 | return da8xx_ddr2_ctlr_base; |
| 889 | |
| 890 | da8xx_ddr2_ctlr_base = ioremap(DA8XX_DDR2_CTL_BASE, SZ_32K); |
| 891 | if (!da8xx_ddr2_ctlr_base) |
Robert Tivy | d2e0c18 | 2013-01-10 16:23:20 -0800 | [diff] [blame] | 892 | pr_warn("%s: Unable to map DDR2 controller", __func__); |
Sekhar Nori | 948c66d | 2009-11-16 17:21:37 +0530 | [diff] [blame] | 893 | |
| 894 | return da8xx_ddr2_ctlr_base; |
| 895 | } |
| 896 | |
Sekhar Nori | 1960e69 | 2009-10-22 15:12:14 +0530 | [diff] [blame] | 897 | static struct resource da8xx_cpuidle_resources[] = { |
| 898 | { |
| 899 | .start = DA8XX_DDR2_CTL_BASE, |
| 900 | .end = DA8XX_DDR2_CTL_BASE + SZ_32K - 1, |
| 901 | .flags = IORESOURCE_MEM, |
| 902 | }, |
| 903 | }; |
| 904 | |
| 905 | /* DA8XX devices support DDR2 power down */ |
| 906 | static struct davinci_cpuidle_config da8xx_cpuidle_pdata = { |
| 907 | .ddr2_pdown = 1, |
| 908 | }; |
| 909 | |
| 910 | |
| 911 | static struct platform_device da8xx_cpuidle_device = { |
| 912 | .name = "cpuidle-davinci", |
| 913 | .num_resources = ARRAY_SIZE(da8xx_cpuidle_resources), |
| 914 | .resource = da8xx_cpuidle_resources, |
| 915 | .dev = { |
| 916 | .platform_data = &da8xx_cpuidle_pdata, |
| 917 | }, |
| 918 | }; |
| 919 | |
| 920 | int __init da8xx_register_cpuidle(void) |
| 921 | { |
Sekhar Nori | 948c66d | 2009-11-16 17:21:37 +0530 | [diff] [blame] | 922 | da8xx_cpuidle_pdata.ddr2_ctlr_base = da8xx_get_mem_ctlr(); |
| 923 | |
Sekhar Nori | 1960e69 | 2009-10-22 15:12:14 +0530 | [diff] [blame] | 924 | return platform_device_register(&da8xx_cpuidle_device); |
| 925 | } |
Michael Williamson | 54ce688 | 2011-02-24 10:18:28 +0530 | [diff] [blame] | 926 | |
| 927 | static struct resource da8xx_spi0_resources[] = { |
| 928 | [0] = { |
| 929 | .start = DA8XX_SPI0_BASE, |
| 930 | .end = DA8XX_SPI0_BASE + SZ_4K - 1, |
| 931 | .flags = IORESOURCE_MEM, |
| 932 | }, |
| 933 | [1] = { |
| 934 | .start = IRQ_DA8XX_SPINT0, |
| 935 | .end = IRQ_DA8XX_SPINT0, |
| 936 | .flags = IORESOURCE_IRQ, |
| 937 | }, |
| 938 | [2] = { |
| 939 | .start = DA8XX_DMA_SPI0_RX, |
| 940 | .end = DA8XX_DMA_SPI0_RX, |
| 941 | .flags = IORESOURCE_DMA, |
| 942 | }, |
| 943 | [3] = { |
| 944 | .start = DA8XX_DMA_SPI0_TX, |
| 945 | .end = DA8XX_DMA_SPI0_TX, |
| 946 | .flags = IORESOURCE_DMA, |
| 947 | }, |
| 948 | }; |
| 949 | |
| 950 | static struct resource da8xx_spi1_resources[] = { |
| 951 | [0] = { |
Sergei Shtylyov | 9e7d24f | 2011-04-06 17:17:21 +0000 | [diff] [blame] | 952 | .start = DA830_SPI1_BASE, |
| 953 | .end = DA830_SPI1_BASE + SZ_4K - 1, |
Michael Williamson | 54ce688 | 2011-02-24 10:18:28 +0530 | [diff] [blame] | 954 | .flags = IORESOURCE_MEM, |
| 955 | }, |
| 956 | [1] = { |
| 957 | .start = IRQ_DA8XX_SPINT1, |
| 958 | .end = IRQ_DA8XX_SPINT1, |
| 959 | .flags = IORESOURCE_IRQ, |
| 960 | }, |
| 961 | [2] = { |
| 962 | .start = DA8XX_DMA_SPI1_RX, |
| 963 | .end = DA8XX_DMA_SPI1_RX, |
| 964 | .flags = IORESOURCE_DMA, |
| 965 | }, |
| 966 | [3] = { |
| 967 | .start = DA8XX_DMA_SPI1_TX, |
| 968 | .end = DA8XX_DMA_SPI1_TX, |
| 969 | .flags = IORESOURCE_DMA, |
| 970 | }, |
| 971 | }; |
| 972 | |
Vivien Didelot | 0273612 | 2012-09-10 20:29:13 -0400 | [diff] [blame] | 973 | static struct davinci_spi_platform_data da8xx_spi_pdata[] = { |
Michael Williamson | 54ce688 | 2011-02-24 10:18:28 +0530 | [diff] [blame] | 974 | [0] = { |
| 975 | .version = SPI_VERSION_2, |
| 976 | .intr_line = 1, |
| 977 | .dma_event_q = EVENTQ_0, |
| 978 | }, |
| 979 | [1] = { |
| 980 | .version = SPI_VERSION_2, |
| 981 | .intr_line = 1, |
| 982 | .dma_event_q = EVENTQ_0, |
| 983 | }, |
| 984 | }; |
| 985 | |
| 986 | static struct platform_device da8xx_spi_device[] = { |
| 987 | [0] = { |
| 988 | .name = "spi_davinci", |
| 989 | .id = 0, |
| 990 | .num_resources = ARRAY_SIZE(da8xx_spi0_resources), |
| 991 | .resource = da8xx_spi0_resources, |
| 992 | .dev = { |
| 993 | .platform_data = &da8xx_spi_pdata[0], |
| 994 | }, |
| 995 | }, |
| 996 | [1] = { |
| 997 | .name = "spi_davinci", |
| 998 | .id = 1, |
| 999 | .num_resources = ARRAY_SIZE(da8xx_spi1_resources), |
| 1000 | .resource = da8xx_spi1_resources, |
| 1001 | .dev = { |
| 1002 | .platform_data = &da8xx_spi_pdata[1], |
| 1003 | }, |
| 1004 | }, |
| 1005 | }; |
| 1006 | |
Vivien Didelot | 0273612 | 2012-09-10 20:29:13 -0400 | [diff] [blame] | 1007 | int __init da8xx_register_spi_bus(int instance, unsigned num_chipselect) |
Michael Williamson | 54ce688 | 2011-02-24 10:18:28 +0530 | [diff] [blame] | 1008 | { |
Michael Williamson | 54ce688 | 2011-02-24 10:18:28 +0530 | [diff] [blame] | 1009 | if (instance < 0 || instance > 1) |
| 1010 | return -EINVAL; |
| 1011 | |
Vivien Didelot | 0273612 | 2012-09-10 20:29:13 -0400 | [diff] [blame] | 1012 | da8xx_spi_pdata[instance].num_chipselect = num_chipselect; |
Michael Williamson | 54ce688 | 2011-02-24 10:18:28 +0530 | [diff] [blame] | 1013 | |
Sergei Shtylyov | 9e7d24f | 2011-04-06 17:17:21 +0000 | [diff] [blame] | 1014 | if (instance == 1 && cpu_is_davinci_da850()) { |
| 1015 | da8xx_spi1_resources[0].start = DA850_SPI1_BASE; |
| 1016 | da8xx_spi1_resources[0].end = DA850_SPI1_BASE + SZ_4K - 1; |
| 1017 | } |
| 1018 | |
Michael Williamson | 54ce688 | 2011-02-24 10:18:28 +0530 | [diff] [blame] | 1019 | return platform_device_register(&da8xx_spi_device[instance]); |
| 1020 | } |
Sekhar Nori | cbb2c96 | 2011-07-06 06:01:23 +0000 | [diff] [blame] | 1021 | |
| 1022 | #ifdef CONFIG_ARCH_DAVINCI_DA850 |
Sekhar Nori | cbb2c96 | 2011-07-06 06:01:23 +0000 | [diff] [blame] | 1023 | static struct resource da850_sata_resources[] = { |
| 1024 | { |
| 1025 | .start = DA850_SATA_BASE, |
| 1026 | .end = DA850_SATA_BASE + 0x1fff, |
| 1027 | .flags = IORESOURCE_MEM, |
| 1028 | }, |
| 1029 | { |
Bartlomiej Zolnierkiewicz | 080c492 | 2014-03-25 19:51:41 +0100 | [diff] [blame^] | 1030 | .start = DA8XX_SYSCFG1_BASE + DA8XX_PWRDN_REG, |
| 1031 | .end = DA8XX_SYSCFG1_BASE + DA8XX_PWRDN_REG + 0x3, |
| 1032 | .flags = IORESOURCE_MEM, |
| 1033 | }, |
| 1034 | { |
Sekhar Nori | cbb2c96 | 2011-07-06 06:01:23 +0000 | [diff] [blame] | 1035 | .start = IRQ_DA850_SATAINT, |
| 1036 | .flags = IORESOURCE_IRQ, |
| 1037 | }, |
| 1038 | }; |
| 1039 | |
Sekhar Nori | cbb2c96 | 2011-07-06 06:01:23 +0000 | [diff] [blame] | 1040 | static u64 da850_sata_dmamask = DMA_BIT_MASK(32); |
| 1041 | |
| 1042 | static struct platform_device da850_sata_device = { |
Bartlomiej Zolnierkiewicz | 080c492 | 2014-03-25 19:51:41 +0100 | [diff] [blame^] | 1043 | .name = "ahci_da850", |
Sekhar Nori | cbb2c96 | 2011-07-06 06:01:23 +0000 | [diff] [blame] | 1044 | .id = -1, |
| 1045 | .dev = { |
Sekhar Nori | cbb2c96 | 2011-07-06 06:01:23 +0000 | [diff] [blame] | 1046 | .dma_mask = &da850_sata_dmamask, |
| 1047 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1048 | }, |
| 1049 | .num_resources = ARRAY_SIZE(da850_sata_resources), |
| 1050 | .resource = da850_sata_resources, |
| 1051 | }; |
| 1052 | |
| 1053 | int __init da850_register_sata(unsigned long refclkpn) |
| 1054 | { |
Bartlomiej Zolnierkiewicz | 080c492 | 2014-03-25 19:51:41 +0100 | [diff] [blame^] | 1055 | /* please see comment in drivers/ata/ahci_da850.c */ |
| 1056 | BUG_ON(refclkpn != 100 * 1000 * 1000); |
Sekhar Nori | cbb2c96 | 2011-07-06 06:01:23 +0000 | [diff] [blame] | 1057 | |
| 1058 | return platform_device_register(&da850_sata_device); |
| 1059 | } |
| 1060 | #endif |