Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 1 | /* |
| 2 | * TI DaVinci DM355 chip specific setup |
| 3 | * |
| 4 | * Author: Kevin Hilman, Deep Root Systems, LLC |
| 5 | * |
| 6 | * 2007 (c) Deep Root Systems, LLC. This file is licensed under |
| 7 | * the terms of the GNU General Public License version 2. This program |
| 8 | * is licensed "as is" without any warranty of any kind, whether express |
| 9 | * or implied. |
| 10 | */ |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 11 | #include <linux/init.h> |
| 12 | #include <linux/clk.h> |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame] | 13 | #include <linux/serial_8250.h> |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/dma-mapping.h> |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 16 | #include <linux/spi/spi.h> |
Philip Avinash | 9cc1515 | 2013-08-18 10:49:00 +0530 | [diff] [blame] | 17 | #include <linux/platform_data/edma.h> |
| 18 | #include <linux/platform_data/gpio-davinci.h> |
| 19 | #include <linux/platform_data/spi-davinci.h> |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 20 | |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 21 | #include <asm/mach/map.h> |
| 22 | |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 23 | #include <mach/cputype.h> |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 24 | #include <mach/psc.h> |
| 25 | #include <mach/mux.h> |
| 26 | #include <mach/irqs.h> |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 27 | #include <mach/time.h> |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame] | 28 | #include <mach/serial.h> |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 29 | #include <mach/common.h> |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 30 | |
Manjunath Hadli | 39c6d2d | 2011-12-21 19:13:35 +0530 | [diff] [blame] | 31 | #include "davinci.h" |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 32 | #include "clock.h" |
| 33 | #include "mux.h" |
Hebbar, Gururaja | 896f66b | 2012-08-27 18:56:41 +0530 | [diff] [blame] | 34 | #include "asp.h" |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 35 | |
Kevin Hilman | 96ed299 | 2009-04-30 11:20:24 -0700 | [diff] [blame] | 36 | #define DM355_UART2_BASE (IO_PHYS + 0x206000) |
Lad, Prabhakar | 62a2d6c | 2013-04-09 10:35:05 -0300 | [diff] [blame] | 37 | #define DM355_OSD_BASE (IO_PHYS + 0x70200) |
| 38 | #define DM355_VENC_BASE (IO_PHYS + 0x70400) |
Kevin Hilman | 96ed299 | 2009-04-30 11:20:24 -0700 | [diff] [blame] | 39 | |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 40 | /* |
| 41 | * Device specific clocks |
| 42 | */ |
| 43 | #define DM355_REF_FREQ 24000000 /* 24 or 36 MHz */ |
| 44 | |
| 45 | static struct pll_data pll1_data = { |
| 46 | .num = 1, |
| 47 | .phys_base = DAVINCI_PLL1_BASE, |
| 48 | .flags = PLL_HAS_PREDIV | PLL_HAS_POSTDIV, |
| 49 | }; |
| 50 | |
| 51 | static struct pll_data pll2_data = { |
| 52 | .num = 2, |
| 53 | .phys_base = DAVINCI_PLL2_BASE, |
| 54 | .flags = PLL_HAS_PREDIV, |
| 55 | }; |
| 56 | |
| 57 | static struct clk ref_clk = { |
| 58 | .name = "ref_clk", |
| 59 | /* FIXME -- crystal rate is board-specific */ |
| 60 | .rate = DM355_REF_FREQ, |
| 61 | }; |
| 62 | |
| 63 | static struct clk pll1_clk = { |
| 64 | .name = "pll1", |
| 65 | .parent = &ref_clk, |
| 66 | .flags = CLK_PLL, |
| 67 | .pll_data = &pll1_data, |
| 68 | }; |
| 69 | |
| 70 | static struct clk pll1_aux_clk = { |
| 71 | .name = "pll1_aux_clk", |
| 72 | .parent = &pll1_clk, |
| 73 | .flags = CLK_PLL | PRE_PLL, |
| 74 | }; |
| 75 | |
| 76 | static struct clk pll1_sysclk1 = { |
| 77 | .name = "pll1_sysclk1", |
| 78 | .parent = &pll1_clk, |
| 79 | .flags = CLK_PLL, |
| 80 | .div_reg = PLLDIV1, |
| 81 | }; |
| 82 | |
| 83 | static struct clk pll1_sysclk2 = { |
| 84 | .name = "pll1_sysclk2", |
| 85 | .parent = &pll1_clk, |
| 86 | .flags = CLK_PLL, |
| 87 | .div_reg = PLLDIV2, |
| 88 | }; |
| 89 | |
| 90 | static struct clk pll1_sysclk3 = { |
| 91 | .name = "pll1_sysclk3", |
| 92 | .parent = &pll1_clk, |
| 93 | .flags = CLK_PLL, |
| 94 | .div_reg = PLLDIV3, |
| 95 | }; |
| 96 | |
| 97 | static struct clk pll1_sysclk4 = { |
| 98 | .name = "pll1_sysclk4", |
| 99 | .parent = &pll1_clk, |
| 100 | .flags = CLK_PLL, |
| 101 | .div_reg = PLLDIV4, |
| 102 | }; |
| 103 | |
| 104 | static struct clk pll1_sysclkbp = { |
| 105 | .name = "pll1_sysclkbp", |
| 106 | .parent = &pll1_clk, |
| 107 | .flags = CLK_PLL | PRE_PLL, |
| 108 | .div_reg = BPDIV |
| 109 | }; |
| 110 | |
| 111 | static struct clk vpss_dac_clk = { |
| 112 | .name = "vpss_dac", |
| 113 | .parent = &pll1_sysclk3, |
| 114 | .lpsc = DM355_LPSC_VPSS_DAC, |
| 115 | }; |
| 116 | |
| 117 | static struct clk vpss_master_clk = { |
| 118 | .name = "vpss_master", |
| 119 | .parent = &pll1_sysclk4, |
| 120 | .lpsc = DAVINCI_LPSC_VPSSMSTR, |
| 121 | .flags = CLK_PSC, |
| 122 | }; |
| 123 | |
| 124 | static struct clk vpss_slave_clk = { |
| 125 | .name = "vpss_slave", |
| 126 | .parent = &pll1_sysclk4, |
| 127 | .lpsc = DAVINCI_LPSC_VPSSSLV, |
| 128 | }; |
| 129 | |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 130 | static struct clk clkout1_clk = { |
| 131 | .name = "clkout1", |
| 132 | .parent = &pll1_aux_clk, |
| 133 | /* NOTE: clkout1 can be externally gated by muxing GPIO-18 */ |
| 134 | }; |
| 135 | |
| 136 | static struct clk clkout2_clk = { |
| 137 | .name = "clkout2", |
| 138 | .parent = &pll1_sysclkbp, |
| 139 | }; |
| 140 | |
| 141 | static struct clk pll2_clk = { |
| 142 | .name = "pll2", |
| 143 | .parent = &ref_clk, |
| 144 | .flags = CLK_PLL, |
| 145 | .pll_data = &pll2_data, |
| 146 | }; |
| 147 | |
| 148 | static struct clk pll2_sysclk1 = { |
| 149 | .name = "pll2_sysclk1", |
| 150 | .parent = &pll2_clk, |
| 151 | .flags = CLK_PLL, |
| 152 | .div_reg = PLLDIV1, |
| 153 | }; |
| 154 | |
| 155 | static struct clk pll2_sysclkbp = { |
| 156 | .name = "pll2_sysclkbp", |
| 157 | .parent = &pll2_clk, |
| 158 | .flags = CLK_PLL | PRE_PLL, |
| 159 | .div_reg = BPDIV |
| 160 | }; |
| 161 | |
| 162 | static struct clk clkout3_clk = { |
| 163 | .name = "clkout3", |
| 164 | .parent = &pll2_sysclkbp, |
| 165 | /* NOTE: clkout3 can be externally gated by muxing GPIO-16 */ |
| 166 | }; |
| 167 | |
| 168 | static struct clk arm_clk = { |
| 169 | .name = "arm_clk", |
| 170 | .parent = &pll1_sysclk1, |
| 171 | .lpsc = DAVINCI_LPSC_ARM, |
| 172 | .flags = ALWAYS_ENABLED, |
| 173 | }; |
| 174 | |
| 175 | /* |
| 176 | * NOT LISTED below, and not touched by Linux |
| 177 | * - in SyncReset state by default |
| 178 | * .lpsc = DAVINCI_LPSC_TPCC, |
| 179 | * .lpsc = DAVINCI_LPSC_TPTC0, |
| 180 | * .lpsc = DAVINCI_LPSC_TPTC1, |
| 181 | * .lpsc = DAVINCI_LPSC_DDR_EMIF, .parent = &sysclk2_clk, |
| 182 | * .lpsc = DAVINCI_LPSC_MEMSTICK, |
| 183 | * - in Enabled state by default |
| 184 | * .lpsc = DAVINCI_LPSC_SYSTEM_SUBSYS, |
| 185 | * .lpsc = DAVINCI_LPSC_SCR2, // "bus" |
| 186 | * .lpsc = DAVINCI_LPSC_SCR3, // "bus" |
| 187 | * .lpsc = DAVINCI_LPSC_SCR4, // "bus" |
| 188 | * .lpsc = DAVINCI_LPSC_CROSSBAR, // "emulation" |
| 189 | * .lpsc = DAVINCI_LPSC_CFG27, // "test" |
| 190 | * .lpsc = DAVINCI_LPSC_CFG3, // "test" |
| 191 | * .lpsc = DAVINCI_LPSC_CFG5, // "test" |
| 192 | */ |
| 193 | |
| 194 | static struct clk mjcp_clk = { |
| 195 | .name = "mjcp", |
| 196 | .parent = &pll1_sysclk1, |
| 197 | .lpsc = DAVINCI_LPSC_IMCOP, |
| 198 | }; |
| 199 | |
| 200 | static struct clk uart0_clk = { |
| 201 | .name = "uart0", |
| 202 | .parent = &pll1_aux_clk, |
| 203 | .lpsc = DAVINCI_LPSC_UART0, |
| 204 | }; |
| 205 | |
| 206 | static struct clk uart1_clk = { |
| 207 | .name = "uart1", |
| 208 | .parent = &pll1_aux_clk, |
| 209 | .lpsc = DAVINCI_LPSC_UART1, |
| 210 | }; |
| 211 | |
| 212 | static struct clk uart2_clk = { |
| 213 | .name = "uart2", |
| 214 | .parent = &pll1_sysclk2, |
| 215 | .lpsc = DAVINCI_LPSC_UART2, |
| 216 | }; |
| 217 | |
| 218 | static struct clk i2c_clk = { |
| 219 | .name = "i2c", |
| 220 | .parent = &pll1_aux_clk, |
| 221 | .lpsc = DAVINCI_LPSC_I2C, |
| 222 | }; |
| 223 | |
| 224 | static struct clk asp0_clk = { |
| 225 | .name = "asp0", |
| 226 | .parent = &pll1_sysclk2, |
| 227 | .lpsc = DAVINCI_LPSC_McBSP, |
| 228 | }; |
| 229 | |
| 230 | static struct clk asp1_clk = { |
| 231 | .name = "asp1", |
| 232 | .parent = &pll1_sysclk2, |
| 233 | .lpsc = DM355_LPSC_McBSP1, |
| 234 | }; |
| 235 | |
| 236 | static struct clk mmcsd0_clk = { |
| 237 | .name = "mmcsd0", |
| 238 | .parent = &pll1_sysclk2, |
| 239 | .lpsc = DAVINCI_LPSC_MMC_SD, |
| 240 | }; |
| 241 | |
| 242 | static struct clk mmcsd1_clk = { |
| 243 | .name = "mmcsd1", |
| 244 | .parent = &pll1_sysclk2, |
| 245 | .lpsc = DM355_LPSC_MMC_SD1, |
| 246 | }; |
| 247 | |
| 248 | static struct clk spi0_clk = { |
| 249 | .name = "spi0", |
| 250 | .parent = &pll1_sysclk2, |
| 251 | .lpsc = DAVINCI_LPSC_SPI, |
| 252 | }; |
| 253 | |
| 254 | static struct clk spi1_clk = { |
| 255 | .name = "spi1", |
| 256 | .parent = &pll1_sysclk2, |
| 257 | .lpsc = DM355_LPSC_SPI1, |
| 258 | }; |
| 259 | |
| 260 | static struct clk spi2_clk = { |
| 261 | .name = "spi2", |
| 262 | .parent = &pll1_sysclk2, |
| 263 | .lpsc = DM355_LPSC_SPI2, |
| 264 | }; |
| 265 | |
| 266 | static struct clk gpio_clk = { |
| 267 | .name = "gpio", |
| 268 | .parent = &pll1_sysclk2, |
| 269 | .lpsc = DAVINCI_LPSC_GPIO, |
| 270 | }; |
| 271 | |
| 272 | static struct clk aemif_clk = { |
| 273 | .name = "aemif", |
| 274 | .parent = &pll1_sysclk2, |
| 275 | .lpsc = DAVINCI_LPSC_AEMIF, |
| 276 | }; |
| 277 | |
| 278 | static struct clk pwm0_clk = { |
| 279 | .name = "pwm0", |
| 280 | .parent = &pll1_aux_clk, |
| 281 | .lpsc = DAVINCI_LPSC_PWM0, |
| 282 | }; |
| 283 | |
| 284 | static struct clk pwm1_clk = { |
| 285 | .name = "pwm1", |
| 286 | .parent = &pll1_aux_clk, |
| 287 | .lpsc = DAVINCI_LPSC_PWM1, |
| 288 | }; |
| 289 | |
| 290 | static struct clk pwm2_clk = { |
| 291 | .name = "pwm2", |
| 292 | .parent = &pll1_aux_clk, |
| 293 | .lpsc = DAVINCI_LPSC_PWM2, |
| 294 | }; |
| 295 | |
| 296 | static struct clk pwm3_clk = { |
| 297 | .name = "pwm3", |
| 298 | .parent = &pll1_aux_clk, |
| 299 | .lpsc = DM355_LPSC_PWM3, |
| 300 | }; |
| 301 | |
| 302 | static struct clk timer0_clk = { |
| 303 | .name = "timer0", |
| 304 | .parent = &pll1_aux_clk, |
| 305 | .lpsc = DAVINCI_LPSC_TIMER0, |
| 306 | }; |
| 307 | |
| 308 | static struct clk timer1_clk = { |
| 309 | .name = "timer1", |
| 310 | .parent = &pll1_aux_clk, |
| 311 | .lpsc = DAVINCI_LPSC_TIMER1, |
| 312 | }; |
| 313 | |
| 314 | static struct clk timer2_clk = { |
| 315 | .name = "timer2", |
| 316 | .parent = &pll1_aux_clk, |
| 317 | .lpsc = DAVINCI_LPSC_TIMER2, |
Lucas De Marchi | e9c5499 | 2011-04-26 23:28:26 -0700 | [diff] [blame] | 318 | .usecount = 1, /* REVISIT: why can't this be disabled? */ |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 319 | }; |
| 320 | |
| 321 | static struct clk timer3_clk = { |
| 322 | .name = "timer3", |
| 323 | .parent = &pll1_aux_clk, |
| 324 | .lpsc = DM355_LPSC_TIMER3, |
| 325 | }; |
| 326 | |
| 327 | static struct clk rto_clk = { |
| 328 | .name = "rto", |
| 329 | .parent = &pll1_aux_clk, |
| 330 | .lpsc = DM355_LPSC_RTO, |
| 331 | }; |
| 332 | |
| 333 | static struct clk usb_clk = { |
| 334 | .name = "usb", |
| 335 | .parent = &pll1_sysclk2, |
| 336 | .lpsc = DAVINCI_LPSC_USB, |
| 337 | }; |
| 338 | |
Kevin Hilman | 08aca08 | 2010-01-11 08:22:23 -0800 | [diff] [blame] | 339 | static struct clk_lookup dm355_clks[] = { |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 340 | CLK(NULL, "ref", &ref_clk), |
| 341 | CLK(NULL, "pll1", &pll1_clk), |
| 342 | CLK(NULL, "pll1_sysclk1", &pll1_sysclk1), |
| 343 | CLK(NULL, "pll1_sysclk2", &pll1_sysclk2), |
| 344 | CLK(NULL, "pll1_sysclk3", &pll1_sysclk3), |
| 345 | CLK(NULL, "pll1_sysclk4", &pll1_sysclk4), |
| 346 | CLK(NULL, "pll1_aux", &pll1_aux_clk), |
| 347 | CLK(NULL, "pll1_sysclkbp", &pll1_sysclkbp), |
| 348 | CLK(NULL, "vpss_dac", &vpss_dac_clk), |
Lad, Prabhakar | 9a3e89b | 2013-03-22 04:53:12 -0300 | [diff] [blame] | 349 | CLK("vpss", "master", &vpss_master_clk), |
| 350 | CLK("vpss", "slave", &vpss_slave_clk), |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 351 | CLK(NULL, "clkout1", &clkout1_clk), |
| 352 | CLK(NULL, "clkout2", &clkout2_clk), |
| 353 | CLK(NULL, "pll2", &pll2_clk), |
| 354 | CLK(NULL, "pll2_sysclk1", &pll2_sysclk1), |
| 355 | CLK(NULL, "pll2_sysclkbp", &pll2_sysclkbp), |
| 356 | CLK(NULL, "clkout3", &clkout3_clk), |
| 357 | CLK(NULL, "arm", &arm_clk), |
| 358 | CLK(NULL, "mjcp", &mjcp_clk), |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 359 | CLK("serial8250.0", NULL, &uart0_clk), |
| 360 | CLK("serial8250.1", NULL, &uart1_clk), |
| 361 | CLK("serial8250.2", NULL, &uart2_clk), |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 362 | CLK("i2c_davinci.1", NULL, &i2c_clk), |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 363 | CLK("davinci-mcbsp.0", NULL, &asp0_clk), |
| 364 | CLK("davinci-mcbsp.1", NULL, &asp1_clk), |
Manjunathappa, Prakash | d7ca4c7 | 2013-03-28 18:41:59 +0530 | [diff] [blame] | 365 | CLK("dm6441-mmc.0", NULL, &mmcsd0_clk), |
| 366 | CLK("dm6441-mmc.1", NULL, &mmcsd1_clk), |
Sandeep Paulraj | 15e8658 | 2010-02-01 09:51:15 -0500 | [diff] [blame] | 367 | CLK("spi_davinci.0", NULL, &spi0_clk), |
| 368 | CLK("spi_davinci.1", NULL, &spi1_clk), |
| 369 | CLK("spi_davinci.2", NULL, &spi2_clk), |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 370 | CLK(NULL, "gpio", &gpio_clk), |
| 371 | CLK(NULL, "aemif", &aemif_clk), |
| 372 | CLK(NULL, "pwm0", &pwm0_clk), |
| 373 | CLK(NULL, "pwm1", &pwm1_clk), |
| 374 | CLK(NULL, "pwm2", &pwm2_clk), |
| 375 | CLK(NULL, "pwm3", &pwm3_clk), |
| 376 | CLK(NULL, "timer0", &timer0_clk), |
| 377 | CLK(NULL, "timer1", &timer1_clk), |
| 378 | CLK("watchdog", NULL, &timer2_clk), |
| 379 | CLK(NULL, "timer3", &timer3_clk), |
| 380 | CLK(NULL, "rto", &rto_clk), |
| 381 | CLK(NULL, "usb", &usb_clk), |
| 382 | CLK(NULL, NULL, NULL), |
| 383 | }; |
| 384 | |
| 385 | /*----------------------------------------------------------------------*/ |
| 386 | |
| 387 | static u64 dm355_spi0_dma_mask = DMA_BIT_MASK(32); |
| 388 | |
| 389 | static struct resource dm355_spi0_resources[] = { |
| 390 | { |
| 391 | .start = 0x01c66000, |
| 392 | .end = 0x01c667ff, |
| 393 | .flags = IORESOURCE_MEM, |
| 394 | }, |
| 395 | { |
Sandeep Paulraj | 15e8658 | 2010-02-01 09:51:15 -0500 | [diff] [blame] | 396 | .start = IRQ_DM355_SPINT0_0, |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 397 | .flags = IORESOURCE_IRQ, |
| 398 | }, |
Sandeep Paulraj | 15e8658 | 2010-02-01 09:51:15 -0500 | [diff] [blame] | 399 | { |
| 400 | .start = 17, |
| 401 | .flags = IORESOURCE_DMA, |
| 402 | }, |
| 403 | { |
| 404 | .start = 16, |
| 405 | .flags = IORESOURCE_DMA, |
| 406 | }, |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 407 | }; |
| 408 | |
Sandeep Paulraj | 15e8658 | 2010-02-01 09:51:15 -0500 | [diff] [blame] | 409 | static struct davinci_spi_platform_data dm355_spi0_pdata = { |
| 410 | .version = SPI_VERSION_1, |
| 411 | .num_chipselect = 2, |
Brian Niebuhr | c29e3c6 | 2010-09-28 13:59:26 +0530 | [diff] [blame] | 412 | .cshold_bug = true, |
Michael Williamson | 2e3e2a5 | 2011-02-08 07:59:55 -0500 | [diff] [blame] | 413 | .dma_event_q = EVENTQ_1, |
Sandeep Paulraj | 15e8658 | 2010-02-01 09:51:15 -0500 | [diff] [blame] | 414 | }; |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 415 | static struct platform_device dm355_spi0_device = { |
| 416 | .name = "spi_davinci", |
| 417 | .id = 0, |
| 418 | .dev = { |
| 419 | .dma_mask = &dm355_spi0_dma_mask, |
| 420 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Sandeep Paulraj | 15e8658 | 2010-02-01 09:51:15 -0500 | [diff] [blame] | 421 | .platform_data = &dm355_spi0_pdata, |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 422 | }, |
| 423 | .num_resources = ARRAY_SIZE(dm355_spi0_resources), |
| 424 | .resource = dm355_spi0_resources, |
| 425 | }; |
| 426 | |
| 427 | void __init dm355_init_spi0(unsigned chipselect_mask, |
Uwe Kleine-König | d65566e | 2012-03-30 22:13:53 +0200 | [diff] [blame] | 428 | const struct spi_board_info *info, unsigned len) |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 429 | { |
| 430 | /* for now, assume we need MISO */ |
| 431 | davinci_cfg_reg(DM355_SPI0_SDI); |
| 432 | |
| 433 | /* not all slaves will be wired up */ |
| 434 | if (chipselect_mask & BIT(0)) |
| 435 | davinci_cfg_reg(DM355_SPI0_SDENA0); |
| 436 | if (chipselect_mask & BIT(1)) |
| 437 | davinci_cfg_reg(DM355_SPI0_SDENA1); |
| 438 | |
| 439 | spi_register_board_info(info, len); |
| 440 | |
| 441 | platform_device_register(&dm355_spi0_device); |
| 442 | } |
| 443 | |
| 444 | /*----------------------------------------------------------------------*/ |
| 445 | |
Mark A. Greer | 5570078 | 2009-04-15 12:42:06 -0700 | [diff] [blame] | 446 | #define INTMUX 0x18 |
| 447 | #define EVTMUX 0x1c |
| 448 | |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 449 | /* |
| 450 | * Device specific mux setup |
| 451 | * |
| 452 | * soc description mux mode mode mux dbg |
| 453 | * reg offset mask mode |
| 454 | */ |
| 455 | static const struct mux_config dm355_pins[] = { |
Mark A. Greer | 0e58595 | 2009-04-15 12:39:48 -0700 | [diff] [blame] | 456 | #ifdef CONFIG_DAVINCI_MUX |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 457 | MUX_CFG(DM355, MMCSD0, 4, 2, 1, 0, false) |
| 458 | |
| 459 | MUX_CFG(DM355, SD1_CLK, 3, 6, 1, 1, false) |
| 460 | MUX_CFG(DM355, SD1_CMD, 3, 7, 1, 1, false) |
| 461 | MUX_CFG(DM355, SD1_DATA3, 3, 8, 3, 1, false) |
| 462 | MUX_CFG(DM355, SD1_DATA2, 3, 10, 3, 1, false) |
| 463 | MUX_CFG(DM355, SD1_DATA1, 3, 12, 3, 1, false) |
| 464 | MUX_CFG(DM355, SD1_DATA0, 3, 14, 3, 1, false) |
| 465 | |
| 466 | MUX_CFG(DM355, I2C_SDA, 3, 19, 1, 1, false) |
| 467 | MUX_CFG(DM355, I2C_SCL, 3, 20, 1, 1, false) |
| 468 | |
| 469 | MUX_CFG(DM355, MCBSP0_BDX, 3, 0, 1, 1, false) |
| 470 | MUX_CFG(DM355, MCBSP0_X, 3, 1, 1, 1, false) |
| 471 | MUX_CFG(DM355, MCBSP0_BFSX, 3, 2, 1, 1, false) |
| 472 | MUX_CFG(DM355, MCBSP0_BDR, 3, 3, 1, 1, false) |
| 473 | MUX_CFG(DM355, MCBSP0_R, 3, 4, 1, 1, false) |
| 474 | MUX_CFG(DM355, MCBSP0_BFSR, 3, 5, 1, 1, false) |
| 475 | |
| 476 | MUX_CFG(DM355, SPI0_SDI, 4, 1, 1, 0, false) |
| 477 | MUX_CFG(DM355, SPI0_SDENA0, 4, 0, 1, 0, false) |
| 478 | MUX_CFG(DM355, SPI0_SDENA1, 3, 28, 1, 1, false) |
| 479 | |
| 480 | INT_CFG(DM355, INT_EDMA_CC, 2, 1, 1, false) |
| 481 | INT_CFG(DM355, INT_EDMA_TC0_ERR, 3, 1, 1, false) |
| 482 | INT_CFG(DM355, INT_EDMA_TC1_ERR, 4, 1, 1, false) |
| 483 | |
| 484 | EVT_CFG(DM355, EVT8_ASP1_TX, 0, 1, 0, false) |
| 485 | EVT_CFG(DM355, EVT9_ASP1_RX, 1, 1, 0, false) |
| 486 | EVT_CFG(DM355, EVT26_MMC0_RX, 2, 1, 0, false) |
Sandeep Paulraj | 1aebb50 | 2009-08-21 12:38:11 -0400 | [diff] [blame] | 487 | |
| 488 | MUX_CFG(DM355, VOUT_FIELD, 1, 18, 3, 1, false) |
| 489 | MUX_CFG(DM355, VOUT_FIELD_G70, 1, 18, 3, 0, false) |
| 490 | MUX_CFG(DM355, VOUT_HVSYNC, 1, 16, 1, 0, false) |
| 491 | MUX_CFG(DM355, VOUT_COUTL_EN, 1, 0, 0xff, 0x55, false) |
| 492 | MUX_CFG(DM355, VOUT_COUTH_EN, 1, 8, 0xff, 0x55, false) |
Muralidharan Karicheri | 51e68e2 | 2009-09-16 12:02:50 -0400 | [diff] [blame] | 493 | |
| 494 | MUX_CFG(DM355, VIN_PCLK, 0, 14, 1, 1, false) |
| 495 | MUX_CFG(DM355, VIN_CAM_WEN, 0, 13, 1, 1, false) |
| 496 | MUX_CFG(DM355, VIN_CAM_VD, 0, 12, 1, 1, false) |
| 497 | MUX_CFG(DM355, VIN_CAM_HD, 0, 11, 1, 1, false) |
| 498 | MUX_CFG(DM355, VIN_YIN_EN, 0, 10, 1, 1, false) |
| 499 | MUX_CFG(DM355, VIN_CINL_EN, 0, 0, 0xff, 0x55, false) |
| 500 | MUX_CFG(DM355, VIN_CINH_EN, 0, 8, 3, 3, false) |
Mark A. Greer | 0e58595 | 2009-04-15 12:39:48 -0700 | [diff] [blame] | 501 | #endif |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 502 | }; |
| 503 | |
Mark A. Greer | 673dd36 | 2009-04-15 12:40:00 -0700 | [diff] [blame] | 504 | static u8 dm355_default_priorities[DAVINCI_N_AINTC_IRQ] = { |
| 505 | [IRQ_DM355_CCDC_VDINT0] = 2, |
| 506 | [IRQ_DM355_CCDC_VDINT1] = 6, |
| 507 | [IRQ_DM355_CCDC_VDINT2] = 6, |
| 508 | [IRQ_DM355_IPIPE_HST] = 6, |
| 509 | [IRQ_DM355_H3AINT] = 6, |
| 510 | [IRQ_DM355_IPIPE_SDR] = 6, |
| 511 | [IRQ_DM355_IPIPEIFINT] = 6, |
| 512 | [IRQ_DM355_OSDINT] = 7, |
| 513 | [IRQ_DM355_VENCINT] = 6, |
| 514 | [IRQ_ASQINT] = 6, |
| 515 | [IRQ_IMXINT] = 6, |
| 516 | [IRQ_USBINT] = 4, |
| 517 | [IRQ_DM355_RTOINT] = 4, |
| 518 | [IRQ_DM355_UARTINT2] = 7, |
| 519 | [IRQ_DM355_TINT6] = 7, |
| 520 | [IRQ_CCINT0] = 5, /* dma */ |
| 521 | [IRQ_CCERRINT] = 5, /* dma */ |
| 522 | [IRQ_TCERRINT0] = 5, /* dma */ |
| 523 | [IRQ_TCERRINT] = 5, /* dma */ |
| 524 | [IRQ_DM355_SPINT2_1] = 7, |
| 525 | [IRQ_DM355_TINT7] = 4, |
| 526 | [IRQ_DM355_SDIOINT0] = 7, |
| 527 | [IRQ_MBXINT] = 7, |
| 528 | [IRQ_MBRINT] = 7, |
| 529 | [IRQ_MMCINT] = 7, |
| 530 | [IRQ_DM355_MMCINT1] = 7, |
| 531 | [IRQ_DM355_PWMINT3] = 7, |
| 532 | [IRQ_DDRINT] = 7, |
| 533 | [IRQ_AEMIFINT] = 7, |
| 534 | [IRQ_DM355_SDIOINT1] = 4, |
| 535 | [IRQ_TINT0_TINT12] = 2, /* clockevent */ |
| 536 | [IRQ_TINT0_TINT34] = 2, /* clocksource */ |
| 537 | [IRQ_TINT1_TINT12] = 7, /* DSP timer */ |
| 538 | [IRQ_TINT1_TINT34] = 7, /* system tick */ |
| 539 | [IRQ_PWMINT0] = 7, |
| 540 | [IRQ_PWMINT1] = 7, |
| 541 | [IRQ_PWMINT2] = 7, |
| 542 | [IRQ_I2C] = 3, |
| 543 | [IRQ_UARTINT0] = 3, |
| 544 | [IRQ_UARTINT1] = 3, |
| 545 | [IRQ_DM355_SPINT0_0] = 3, |
| 546 | [IRQ_DM355_SPINT0_1] = 3, |
| 547 | [IRQ_DM355_GPIO0] = 3, |
| 548 | [IRQ_DM355_GPIO1] = 7, |
| 549 | [IRQ_DM355_GPIO2] = 4, |
| 550 | [IRQ_DM355_GPIO3] = 4, |
| 551 | [IRQ_DM355_GPIO4] = 7, |
| 552 | [IRQ_DM355_GPIO5] = 7, |
| 553 | [IRQ_DM355_GPIO6] = 7, |
| 554 | [IRQ_DM355_GPIO7] = 7, |
| 555 | [IRQ_DM355_GPIO8] = 7, |
| 556 | [IRQ_DM355_GPIO9] = 7, |
| 557 | [IRQ_DM355_GPIOBNK0] = 7, |
| 558 | [IRQ_DM355_GPIOBNK1] = 7, |
| 559 | [IRQ_DM355_GPIOBNK2] = 7, |
| 560 | [IRQ_DM355_GPIOBNK3] = 7, |
| 561 | [IRQ_DM355_GPIOBNK4] = 7, |
| 562 | [IRQ_DM355_GPIOBNK5] = 7, |
| 563 | [IRQ_DM355_GPIOBNK6] = 7, |
| 564 | [IRQ_COMMTX] = 7, |
| 565 | [IRQ_COMMRX] = 7, |
| 566 | [IRQ_EMUINT] = 7, |
| 567 | }; |
| 568 | |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 569 | /*----------------------------------------------------------------------*/ |
| 570 | |
Matt Porter | 6cba435 | 2013-06-20 16:06:38 -0500 | [diff] [blame] | 571 | static s8 |
Sudhakar Rajashekhara | 60902a2 | 2009-05-21 07:41:35 -0400 | [diff] [blame] | 572 | queue_tc_mapping[][2] = { |
| 573 | /* {event queue no, TC no} */ |
| 574 | {0, 0}, |
| 575 | {1, 1}, |
| 576 | {-1, -1}, |
| 577 | }; |
| 578 | |
Matt Porter | 6cba435 | 2013-06-20 16:06:38 -0500 | [diff] [blame] | 579 | static s8 |
Sudhakar Rajashekhara | 60902a2 | 2009-05-21 07:41:35 -0400 | [diff] [blame] | 580 | queue_priority_mapping[][2] = { |
| 581 | /* {event queue no, Priority} */ |
| 582 | {0, 3}, |
| 583 | {1, 7}, |
| 584 | {-1, -1}, |
| 585 | }; |
| 586 | |
Sekhar Nori | bc3ac9f | 2010-06-29 11:35:12 +0530 | [diff] [blame] | 587 | static struct edma_soc_info edma_cc0_info = { |
| 588 | .n_channel = 64, |
| 589 | .n_region = 4, |
| 590 | .n_slot = 128, |
| 591 | .n_tc = 2, |
| 592 | .n_cc = 1, |
| 593 | .queue_tc_mapping = queue_tc_mapping, |
| 594 | .queue_priority_mapping = queue_priority_mapping, |
Ido Yariv | f23fe85 | 2011-07-10 16:14:35 +0300 | [diff] [blame] | 595 | .default_queue = EVENTQ_1, |
Sekhar Nori | bc3ac9f | 2010-06-29 11:35:12 +0530 | [diff] [blame] | 596 | }; |
| 597 | |
| 598 | static struct edma_soc_info *dm355_edma_info[EDMA_MAX_CC] = { |
| 599 | &edma_cc0_info, |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 600 | }; |
| 601 | |
| 602 | static struct resource edma_resources[] = { |
| 603 | { |
Sudhakar Rajashekhara | 60902a2 | 2009-05-21 07:41:35 -0400 | [diff] [blame] | 604 | .name = "edma_cc0", |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 605 | .start = 0x01c00000, |
| 606 | .end = 0x01c00000 + SZ_64K - 1, |
| 607 | .flags = IORESOURCE_MEM, |
| 608 | }, |
| 609 | { |
| 610 | .name = "edma_tc0", |
| 611 | .start = 0x01c10000, |
| 612 | .end = 0x01c10000 + SZ_1K - 1, |
| 613 | .flags = IORESOURCE_MEM, |
| 614 | }, |
| 615 | { |
| 616 | .name = "edma_tc1", |
| 617 | .start = 0x01c10400, |
| 618 | .end = 0x01c10400 + SZ_1K - 1, |
| 619 | .flags = IORESOURCE_MEM, |
| 620 | }, |
| 621 | { |
Sudhakar Rajashekhara | 60902a2 | 2009-05-21 07:41:35 -0400 | [diff] [blame] | 622 | .name = "edma0", |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 623 | .start = IRQ_CCINT0, |
| 624 | .flags = IORESOURCE_IRQ, |
| 625 | }, |
| 626 | { |
Sudhakar Rajashekhara | 60902a2 | 2009-05-21 07:41:35 -0400 | [diff] [blame] | 627 | .name = "edma0_err", |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 628 | .start = IRQ_CCERRINT, |
| 629 | .flags = IORESOURCE_IRQ, |
| 630 | }, |
| 631 | /* not using (or muxing) TC*_ERR */ |
| 632 | }; |
| 633 | |
| 634 | static struct platform_device dm355_edma_device = { |
| 635 | .name = "edma", |
Sudhakar Rajashekhara | 60902a2 | 2009-05-21 07:41:35 -0400 | [diff] [blame] | 636 | .id = 0, |
| 637 | .dev.platform_data = dm355_edma_info, |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 638 | .num_resources = ARRAY_SIZE(edma_resources), |
| 639 | .resource = edma_resources, |
| 640 | }; |
| 641 | |
Chaithrika U S | 25acf55 | 2009-06-05 06:28:08 -0400 | [diff] [blame] | 642 | static struct resource dm355_asp1_resources[] = { |
| 643 | { |
| 644 | .start = DAVINCI_ASP1_BASE, |
| 645 | .end = DAVINCI_ASP1_BASE + SZ_8K - 1, |
| 646 | .flags = IORESOURCE_MEM, |
| 647 | }, |
| 648 | { |
| 649 | .start = DAVINCI_DMA_ASP1_TX, |
| 650 | .end = DAVINCI_DMA_ASP1_TX, |
| 651 | .flags = IORESOURCE_DMA, |
| 652 | }, |
| 653 | { |
| 654 | .start = DAVINCI_DMA_ASP1_RX, |
| 655 | .end = DAVINCI_DMA_ASP1_RX, |
| 656 | .flags = IORESOURCE_DMA, |
| 657 | }, |
| 658 | }; |
| 659 | |
| 660 | static struct platform_device dm355_asp1_device = { |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 661 | .name = "davinci-mcbsp", |
Kevin Hilman | 61aa073 | 2009-07-15 08:47:48 -0700 | [diff] [blame] | 662 | .id = 1, |
Chaithrika U S | 25acf55 | 2009-06-05 06:28:08 -0400 | [diff] [blame] | 663 | .num_resources = ARRAY_SIZE(dm355_asp1_resources), |
| 664 | .resource = dm355_asp1_resources, |
| 665 | }; |
| 666 | |
Muralidharan Karicheri | 77c8b5f | 2010-01-13 20:27:08 -0300 | [diff] [blame] | 667 | static void dm355_ccdc_setup_pinmux(void) |
| 668 | { |
| 669 | davinci_cfg_reg(DM355_VIN_PCLK); |
| 670 | davinci_cfg_reg(DM355_VIN_CAM_WEN); |
| 671 | davinci_cfg_reg(DM355_VIN_CAM_VD); |
| 672 | davinci_cfg_reg(DM355_VIN_CAM_HD); |
| 673 | davinci_cfg_reg(DM355_VIN_YIN_EN); |
| 674 | davinci_cfg_reg(DM355_VIN_CINL_EN); |
| 675 | davinci_cfg_reg(DM355_VIN_CINH_EN); |
| 676 | } |
| 677 | |
Muralidharan Karicheri | 51e68e2 | 2009-09-16 12:02:50 -0400 | [diff] [blame] | 678 | static struct resource dm355_vpss_resources[] = { |
| 679 | { |
| 680 | /* VPSS BL Base address */ |
| 681 | .name = "vpss", |
| 682 | .start = 0x01c70800, |
| 683 | .end = 0x01c70800 + 0xff, |
| 684 | .flags = IORESOURCE_MEM, |
| 685 | }, |
| 686 | { |
| 687 | /* VPSS CLK Base address */ |
| 688 | .name = "vpss", |
| 689 | .start = 0x01c70000, |
| 690 | .end = 0x01c70000 + 0xf, |
| 691 | .flags = IORESOURCE_MEM, |
| 692 | }, |
| 693 | }; |
| 694 | |
| 695 | static struct platform_device dm355_vpss_device = { |
| 696 | .name = "vpss", |
| 697 | .id = -1, |
| 698 | .dev.platform_data = "dm355_vpss", |
| 699 | .num_resources = ARRAY_SIZE(dm355_vpss_resources), |
| 700 | .resource = dm355_vpss_resources, |
| 701 | }; |
| 702 | |
| 703 | static struct resource vpfe_resources[] = { |
| 704 | { |
| 705 | .start = IRQ_VDINT0, |
| 706 | .end = IRQ_VDINT0, |
| 707 | .flags = IORESOURCE_IRQ, |
| 708 | }, |
| 709 | { |
| 710 | .start = IRQ_VDINT1, |
| 711 | .end = IRQ_VDINT1, |
| 712 | .flags = IORESOURCE_IRQ, |
| 713 | }, |
Muralidharan Karicheri | 77c8b5f | 2010-01-13 20:27:08 -0300 | [diff] [blame] | 714 | }; |
| 715 | |
| 716 | static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32); |
| 717 | static struct resource dm355_ccdc_resource[] = { |
Muralidharan Karicheri | 51e68e2 | 2009-09-16 12:02:50 -0400 | [diff] [blame] | 718 | /* CCDC Base address */ |
| 719 | { |
| 720 | .flags = IORESOURCE_MEM, |
| 721 | .start = 0x01c70600, |
| 722 | .end = 0x01c70600 + 0x1ff, |
| 723 | }, |
| 724 | }; |
Muralidharan Karicheri | 77c8b5f | 2010-01-13 20:27:08 -0300 | [diff] [blame] | 725 | static struct platform_device dm355_ccdc_dev = { |
| 726 | .name = "dm355_ccdc", |
| 727 | .id = -1, |
| 728 | .num_resources = ARRAY_SIZE(dm355_ccdc_resource), |
| 729 | .resource = dm355_ccdc_resource, |
| 730 | .dev = { |
| 731 | .dma_mask = &vpfe_capture_dma_mask, |
| 732 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 733 | .platform_data = dm355_ccdc_setup_pinmux, |
| 734 | }, |
| 735 | }; |
Muralidharan Karicheri | 51e68e2 | 2009-09-16 12:02:50 -0400 | [diff] [blame] | 736 | |
Muralidharan Karicheri | 51e68e2 | 2009-09-16 12:02:50 -0400 | [diff] [blame] | 737 | static struct platform_device vpfe_capture_dev = { |
| 738 | .name = CAPTURE_DRV_NAME, |
| 739 | .id = -1, |
| 740 | .num_resources = ARRAY_SIZE(vpfe_resources), |
| 741 | .resource = vpfe_resources, |
| 742 | .dev = { |
| 743 | .dma_mask = &vpfe_capture_dma_mask, |
| 744 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 745 | }, |
| 746 | }; |
| 747 | |
Lad, Prabhakar | 62a2d6c | 2013-04-09 10:35:05 -0300 | [diff] [blame] | 748 | static struct resource dm355_osd_resources[] = { |
| 749 | { |
| 750 | .start = DM355_OSD_BASE, |
| 751 | .end = DM355_OSD_BASE + 0x17f, |
| 752 | .flags = IORESOURCE_MEM, |
| 753 | }, |
| 754 | }; |
| 755 | |
| 756 | static struct platform_device dm355_osd_dev = { |
| 757 | .name = DM355_VPBE_OSD_SUBDEV_NAME, |
| 758 | .id = -1, |
| 759 | .num_resources = ARRAY_SIZE(dm355_osd_resources), |
| 760 | .resource = dm355_osd_resources, |
| 761 | .dev = { |
| 762 | .dma_mask = &vpfe_capture_dma_mask, |
| 763 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 764 | }, |
| 765 | }; |
| 766 | |
| 767 | static struct resource dm355_venc_resources[] = { |
| 768 | { |
| 769 | .start = IRQ_VENCINT, |
| 770 | .end = IRQ_VENCINT, |
| 771 | .flags = IORESOURCE_IRQ, |
| 772 | }, |
| 773 | /* venc registers io space */ |
| 774 | { |
| 775 | .start = DM355_VENC_BASE, |
| 776 | .end = DM355_VENC_BASE + 0x17f, |
| 777 | .flags = IORESOURCE_MEM, |
| 778 | }, |
| 779 | /* VDAC config register io space */ |
| 780 | { |
| 781 | .start = DAVINCI_SYSTEM_MODULE_BASE + SYSMOD_VDAC_CONFIG, |
| 782 | .end = DAVINCI_SYSTEM_MODULE_BASE + SYSMOD_VDAC_CONFIG + 3, |
| 783 | .flags = IORESOURCE_MEM, |
| 784 | }, |
| 785 | }; |
| 786 | |
| 787 | static struct resource dm355_v4l2_disp_resources[] = { |
| 788 | { |
| 789 | .start = IRQ_VENCINT, |
| 790 | .end = IRQ_VENCINT, |
| 791 | .flags = IORESOURCE_IRQ, |
| 792 | }, |
| 793 | /* venc registers io space */ |
| 794 | { |
| 795 | .start = DM355_VENC_BASE, |
| 796 | .end = DM355_VENC_BASE + 0x17f, |
| 797 | .flags = IORESOURCE_MEM, |
| 798 | }, |
| 799 | }; |
| 800 | |
| 801 | static int dm355_vpbe_setup_pinmux(enum v4l2_mbus_pixelcode if_type, |
| 802 | int field) |
Muralidharan Karicheri | 51e68e2 | 2009-09-16 12:02:50 -0400 | [diff] [blame] | 803 | { |
Lad, Prabhakar | 62a2d6c | 2013-04-09 10:35:05 -0300 | [diff] [blame] | 804 | switch (if_type) { |
| 805 | case V4L2_MBUS_FMT_SGRBG8_1X8: |
| 806 | davinci_cfg_reg(DM355_VOUT_FIELD_G70); |
| 807 | break; |
| 808 | case V4L2_MBUS_FMT_YUYV10_1X20: |
| 809 | if (field) |
| 810 | davinci_cfg_reg(DM355_VOUT_FIELD); |
| 811 | else |
| 812 | davinci_cfg_reg(DM355_VOUT_FIELD_G70); |
| 813 | break; |
| 814 | default: |
| 815 | return -EINVAL; |
| 816 | } |
| 817 | |
| 818 | davinci_cfg_reg(DM355_VOUT_COUTL_EN); |
| 819 | davinci_cfg_reg(DM355_VOUT_COUTH_EN); |
| 820 | |
| 821 | return 0; |
Muralidharan Karicheri | 51e68e2 | 2009-09-16 12:02:50 -0400 | [diff] [blame] | 822 | } |
| 823 | |
Lad, Prabhakar | 62a2d6c | 2013-04-09 10:35:05 -0300 | [diff] [blame] | 824 | static int dm355_venc_setup_clock(enum vpbe_enc_timings_type type, |
| 825 | unsigned int pclock) |
| 826 | { |
| 827 | void __iomem *vpss_clk_ctrl_reg; |
| 828 | |
| 829 | vpss_clk_ctrl_reg = DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL); |
| 830 | |
| 831 | switch (type) { |
| 832 | case VPBE_ENC_STD: |
| 833 | writel(VPSS_DACCLKEN_ENABLE | VPSS_VENCCLKEN_ENABLE, |
| 834 | vpss_clk_ctrl_reg); |
| 835 | break; |
| 836 | case VPBE_ENC_DV_TIMINGS: |
| 837 | if (pclock > 27000000) |
| 838 | /* |
| 839 | * For HD, use external clock source since we cannot |
| 840 | * support HD mode with internal clocks. |
| 841 | */ |
| 842 | writel(VPSS_MUXSEL_EXTCLK_ENABLE, vpss_clk_ctrl_reg); |
| 843 | break; |
| 844 | default: |
| 845 | return -EINVAL; |
| 846 | } |
| 847 | |
| 848 | return 0; |
| 849 | } |
| 850 | |
| 851 | static struct platform_device dm355_vpbe_display = { |
| 852 | .name = "vpbe-v4l2", |
| 853 | .id = -1, |
| 854 | .num_resources = ARRAY_SIZE(dm355_v4l2_disp_resources), |
| 855 | .resource = dm355_v4l2_disp_resources, |
| 856 | .dev = { |
| 857 | .dma_mask = &vpfe_capture_dma_mask, |
| 858 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 859 | }, |
| 860 | }; |
| 861 | |
Sekhar Nori | 9c55970 | 2013-07-12 15:19:03 +0530 | [diff] [blame] | 862 | static struct venc_platform_data dm355_venc_pdata = { |
Lad, Prabhakar | 62a2d6c | 2013-04-09 10:35:05 -0300 | [diff] [blame] | 863 | .setup_pinmux = dm355_vpbe_setup_pinmux, |
| 864 | .setup_clock = dm355_venc_setup_clock, |
| 865 | }; |
| 866 | |
| 867 | static struct platform_device dm355_venc_dev = { |
| 868 | .name = DM355_VPBE_VENC_SUBDEV_NAME, |
| 869 | .id = -1, |
| 870 | .num_resources = ARRAY_SIZE(dm355_venc_resources), |
| 871 | .resource = dm355_venc_resources, |
| 872 | .dev = { |
| 873 | .dma_mask = &vpfe_capture_dma_mask, |
| 874 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 875 | .platform_data = (void *)&dm355_venc_pdata, |
| 876 | }, |
| 877 | }; |
| 878 | |
| 879 | static struct platform_device dm355_vpbe_dev = { |
| 880 | .name = "vpbe_controller", |
| 881 | .id = -1, |
| 882 | .dev = { |
| 883 | .dma_mask = &vpfe_capture_dma_mask, |
| 884 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 885 | }, |
| 886 | }; |
| 887 | |
Philip Avinash | 9cc1515 | 2013-08-18 10:49:00 +0530 | [diff] [blame] | 888 | static struct resource dm355_gpio_resources[] = { |
| 889 | { /* registers */ |
| 890 | .start = DAVINCI_GPIO_BASE, |
| 891 | .end = DAVINCI_GPIO_BASE + SZ_4K - 1, |
| 892 | .flags = IORESOURCE_MEM, |
| 893 | }, |
| 894 | { /* interrupt */ |
| 895 | .start = IRQ_DM355_GPIOBNK0, |
| 896 | .end = IRQ_DM355_GPIOBNK6, |
| 897 | .flags = IORESOURCE_IRQ, |
| 898 | }, |
| 899 | }; |
| 900 | |
| 901 | static struct davinci_gpio_platform_data dm355_gpio_platform_data = { |
| 902 | .ngpio = 104, |
| 903 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, |
| 904 | }; |
| 905 | |
| 906 | int __init dm355_gpio_register(void) |
| 907 | { |
| 908 | return davinci_gpio_register(dm355_gpio_resources, |
| 909 | sizeof(dm355_gpio_resources), |
| 910 | &dm355_gpio_platform_data); |
| 911 | } |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 912 | /*----------------------------------------------------------------------*/ |
| 913 | |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 914 | static struct map_desc dm355_io_desc[] = { |
| 915 | { |
| 916 | .virtual = IO_VIRT, |
| 917 | .pfn = __phys_to_pfn(IO_PHYS), |
| 918 | .length = IO_SIZE, |
| 919 | .type = MT_DEVICE |
| 920 | }, |
| 921 | }; |
| 922 | |
Mark A. Greer | b9ab127 | 2009-04-15 12:39:09 -0700 | [diff] [blame] | 923 | /* Contents of JTAG ID register used to identify exact cpu type */ |
| 924 | static struct davinci_id dm355_ids[] = { |
| 925 | { |
| 926 | .variant = 0x0, |
| 927 | .part_no = 0xb73b, |
| 928 | .manufacturer = 0x00f, |
| 929 | .cpu_id = DAVINCI_CPU_ID_DM355, |
| 930 | .name = "dm355", |
| 931 | }, |
| 932 | }; |
| 933 | |
Cyril Chemparathy | e4c822c | 2010-05-07 17:06:36 -0400 | [diff] [blame] | 934 | static u32 dm355_psc_bases[] = { DAVINCI_PWR_SLEEP_CNTRL_BASE }; |
Mark A. Greer | d81d188 | 2009-04-15 12:39:33 -0700 | [diff] [blame] | 935 | |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 936 | /* |
| 937 | * T0_BOT: Timer 0, bottom: clockevent source for hrtimers |
| 938 | * T0_TOP: Timer 0, top : clocksource for generic timekeeping |
| 939 | * T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code) |
| 940 | * T1_TOP: Timer 1, top : <unused> |
| 941 | */ |
Kevin Hilman | 28552c2 | 2010-02-25 15:36:38 -0800 | [diff] [blame] | 942 | static struct davinci_timer_info dm355_timer_info = { |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 943 | .timers = davinci_timer_instance, |
| 944 | .clockevent_id = T0_BOT, |
| 945 | .clocksource_id = T0_TOP, |
| 946 | }; |
| 947 | |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 948 | static struct plat_serial8250_port dm355_serial0_platform_data[] = { |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame] | 949 | { |
| 950 | .mapbase = DAVINCI_UART0_BASE, |
| 951 | .irq = IRQ_UARTINT0, |
| 952 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 953 | UPF_IOREMAP, |
| 954 | .iotype = UPIO_MEM, |
| 955 | .regshift = 2, |
| 956 | }, |
| 957 | { |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 958 | .flags = 0, |
| 959 | } |
| 960 | }; |
| 961 | static struct plat_serial8250_port dm355_serial1_platform_data[] = { |
| 962 | { |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame] | 963 | .mapbase = DAVINCI_UART1_BASE, |
| 964 | .irq = IRQ_UARTINT1, |
| 965 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 966 | UPF_IOREMAP, |
| 967 | .iotype = UPIO_MEM, |
| 968 | .regshift = 2, |
| 969 | }, |
| 970 | { |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 971 | .flags = 0, |
| 972 | } |
| 973 | }; |
| 974 | static struct plat_serial8250_port dm355_serial2_platform_data[] = { |
| 975 | { |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame] | 976 | .mapbase = DM355_UART2_BASE, |
| 977 | .irq = IRQ_DM355_UARTINT2, |
| 978 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 979 | UPF_IOREMAP, |
| 980 | .iotype = UPIO_MEM, |
| 981 | .regshift = 2, |
| 982 | }, |
| 983 | { |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 984 | .flags = 0, |
| 985 | } |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame] | 986 | }; |
| 987 | |
Manjunathappa, Prakash | fcf7157 | 2013-06-19 14:45:42 +0530 | [diff] [blame] | 988 | struct platform_device dm355_serial_device[] = { |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 989 | { |
| 990 | .name = "serial8250", |
| 991 | .id = PLAT8250_DEV_PLATFORM, |
| 992 | .dev = { |
| 993 | .platform_data = dm355_serial0_platform_data, |
| 994 | } |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame] | 995 | }, |
Manjunathappa, Prakash | 19955c3 | 2013-06-19 14:45:38 +0530 | [diff] [blame] | 996 | { |
| 997 | .name = "serial8250", |
| 998 | .id = PLAT8250_DEV_PLATFORM1, |
| 999 | .dev = { |
| 1000 | .platform_data = dm355_serial1_platform_data, |
| 1001 | } |
| 1002 | }, |
| 1003 | { |
| 1004 | .name = "serial8250", |
| 1005 | .id = PLAT8250_DEV_PLATFORM2, |
| 1006 | .dev = { |
| 1007 | .platform_data = dm355_serial2_platform_data, |
| 1008 | } |
| 1009 | }, |
| 1010 | { |
| 1011 | } |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame] | 1012 | }; |
| 1013 | |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 1014 | static struct davinci_soc_info davinci_soc_info_dm355 = { |
| 1015 | .io_desc = dm355_io_desc, |
| 1016 | .io_desc_num = ARRAY_SIZE(dm355_io_desc), |
Cyril Chemparathy | 3347db8 | 2010-05-07 17:06:34 -0400 | [diff] [blame] | 1017 | .jtag_id_reg = 0x01c40028, |
Mark A. Greer | b9ab127 | 2009-04-15 12:39:09 -0700 | [diff] [blame] | 1018 | .ids = dm355_ids, |
| 1019 | .ids_num = ARRAY_SIZE(dm355_ids), |
Mark A. Greer | 66e0c39 | 2009-04-15 12:39:23 -0700 | [diff] [blame] | 1020 | .cpu_clks = dm355_clks, |
Mark A. Greer | d81d188 | 2009-04-15 12:39:33 -0700 | [diff] [blame] | 1021 | .psc_bases = dm355_psc_bases, |
| 1022 | .psc_bases_num = ARRAY_SIZE(dm355_psc_bases), |
Cyril Chemparathy | 779b0d5 | 2010-05-07 17:06:38 -0400 | [diff] [blame] | 1023 | .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, |
Mark A. Greer | 0e58595 | 2009-04-15 12:39:48 -0700 | [diff] [blame] | 1024 | .pinmux_pins = dm355_pins, |
| 1025 | .pinmux_pins_num = ARRAY_SIZE(dm355_pins), |
Cyril Chemparathy | bd80894 | 2010-05-07 17:06:37 -0400 | [diff] [blame] | 1026 | .intc_base = DAVINCI_ARM_INTC_BASE, |
Mark A. Greer | 673dd36 | 2009-04-15 12:40:00 -0700 | [diff] [blame] | 1027 | .intc_type = DAVINCI_INTC_TYPE_AINTC, |
| 1028 | .intc_irq_prios = dm355_default_priorities, |
| 1029 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 1030 | .timer_info = &dm355_timer_info, |
David Brownell | 0d04eb4 | 2009-04-30 17:35:48 -0700 | [diff] [blame] | 1031 | .sram_dma = 0x00010000, |
| 1032 | .sram_len = SZ_32K, |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 1033 | }; |
| 1034 | |
Chaithrika U S | 25acf55 | 2009-06-05 06:28:08 -0400 | [diff] [blame] | 1035 | void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata) |
| 1036 | { |
| 1037 | /* we don't use ASP1 IRQs, or we'd need to mux them ... */ |
| 1038 | if (evt_enable & ASP1_TX_EVT_EN) |
| 1039 | davinci_cfg_reg(DM355_EVT8_ASP1_TX); |
| 1040 | |
| 1041 | if (evt_enable & ASP1_RX_EVT_EN) |
| 1042 | davinci_cfg_reg(DM355_EVT9_ASP1_RX); |
| 1043 | |
| 1044 | dm355_asp1_device.dev.platform_data = pdata; |
| 1045 | platform_device_register(&dm355_asp1_device); |
| 1046 | } |
| 1047 | |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 1048 | void __init dm355_init(void) |
| 1049 | { |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 1050 | davinci_common_init(&davinci_soc_info_dm355); |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 1051 | davinci_map_sysmod(); |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 1052 | } |
| 1053 | |
Lad, Prabhakar | 62a2d6c | 2013-04-09 10:35:05 -0300 | [diff] [blame] | 1054 | int __init dm355_init_video(struct vpfe_config *vpfe_cfg, |
| 1055 | struct vpbe_config *vpbe_cfg) |
| 1056 | { |
| 1057 | if (vpfe_cfg || vpbe_cfg) |
| 1058 | platform_device_register(&dm355_vpss_device); |
| 1059 | |
| 1060 | if (vpfe_cfg) { |
| 1061 | vpfe_capture_dev.dev.platform_data = vpfe_cfg; |
| 1062 | platform_device_register(&dm355_ccdc_dev); |
| 1063 | platform_device_register(&vpfe_capture_dev); |
| 1064 | } |
| 1065 | |
| 1066 | if (vpbe_cfg) { |
| 1067 | dm355_vpbe_dev.dev.platform_data = vpbe_cfg; |
| 1068 | platform_device_register(&dm355_osd_dev); |
| 1069 | platform_device_register(&dm355_venc_dev); |
| 1070 | platform_device_register(&dm355_vpbe_dev); |
| 1071 | platform_device_register(&dm355_vpbe_display); |
| 1072 | } |
| 1073 | |
| 1074 | return 0; |
| 1075 | } |
| 1076 | |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 1077 | static int __init dm355_init_devices(void) |
| 1078 | { |
| 1079 | if (!cpu_is_davinci_dm355()) |
| 1080 | return 0; |
| 1081 | |
| 1082 | davinci_cfg_reg(DM355_INT_EDMA_CC); |
| 1083 | platform_device_register(&dm355_edma_device); |
Muralidharan Karicheri | 51e68e2 | 2009-09-16 12:02:50 -0400 | [diff] [blame] | 1084 | |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 1085 | return 0; |
| 1086 | } |
| 1087 | postcore_initcall(dm355_init_devices); |