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 | */ |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/clk.h> |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame^] | 14 | #include <linux/serial_8250.h> |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/dma-mapping.h> |
Mark A. Greer | a994955 | 2009-04-15 12:40:35 -0700 | [diff] [blame] | 17 | #include <linux/gpio.h> |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 18 | |
| 19 | #include <linux/spi/spi.h> |
| 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/dm355.h> |
| 24 | #include <mach/clock.h> |
| 25 | #include <mach/cputype.h> |
| 26 | #include <mach/edma.h> |
| 27 | #include <mach/psc.h> |
| 28 | #include <mach/mux.h> |
| 29 | #include <mach/irqs.h> |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 30 | #include <mach/time.h> |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame^] | 31 | #include <mach/serial.h> |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 32 | #include <mach/common.h> |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 33 | |
| 34 | #include "clock.h" |
| 35 | #include "mux.h" |
| 36 | |
| 37 | /* |
| 38 | * Device specific clocks |
| 39 | */ |
| 40 | #define DM355_REF_FREQ 24000000 /* 24 or 36 MHz */ |
| 41 | |
| 42 | static struct pll_data pll1_data = { |
| 43 | .num = 1, |
| 44 | .phys_base = DAVINCI_PLL1_BASE, |
| 45 | .flags = PLL_HAS_PREDIV | PLL_HAS_POSTDIV, |
| 46 | }; |
| 47 | |
| 48 | static struct pll_data pll2_data = { |
| 49 | .num = 2, |
| 50 | .phys_base = DAVINCI_PLL2_BASE, |
| 51 | .flags = PLL_HAS_PREDIV, |
| 52 | }; |
| 53 | |
| 54 | static struct clk ref_clk = { |
| 55 | .name = "ref_clk", |
| 56 | /* FIXME -- crystal rate is board-specific */ |
| 57 | .rate = DM355_REF_FREQ, |
| 58 | }; |
| 59 | |
| 60 | static struct clk pll1_clk = { |
| 61 | .name = "pll1", |
| 62 | .parent = &ref_clk, |
| 63 | .flags = CLK_PLL, |
| 64 | .pll_data = &pll1_data, |
| 65 | }; |
| 66 | |
| 67 | static struct clk pll1_aux_clk = { |
| 68 | .name = "pll1_aux_clk", |
| 69 | .parent = &pll1_clk, |
| 70 | .flags = CLK_PLL | PRE_PLL, |
| 71 | }; |
| 72 | |
| 73 | static struct clk pll1_sysclk1 = { |
| 74 | .name = "pll1_sysclk1", |
| 75 | .parent = &pll1_clk, |
| 76 | .flags = CLK_PLL, |
| 77 | .div_reg = PLLDIV1, |
| 78 | }; |
| 79 | |
| 80 | static struct clk pll1_sysclk2 = { |
| 81 | .name = "pll1_sysclk2", |
| 82 | .parent = &pll1_clk, |
| 83 | .flags = CLK_PLL, |
| 84 | .div_reg = PLLDIV2, |
| 85 | }; |
| 86 | |
| 87 | static struct clk pll1_sysclk3 = { |
| 88 | .name = "pll1_sysclk3", |
| 89 | .parent = &pll1_clk, |
| 90 | .flags = CLK_PLL, |
| 91 | .div_reg = PLLDIV3, |
| 92 | }; |
| 93 | |
| 94 | static struct clk pll1_sysclk4 = { |
| 95 | .name = "pll1_sysclk4", |
| 96 | .parent = &pll1_clk, |
| 97 | .flags = CLK_PLL, |
| 98 | .div_reg = PLLDIV4, |
| 99 | }; |
| 100 | |
| 101 | static struct clk pll1_sysclkbp = { |
| 102 | .name = "pll1_sysclkbp", |
| 103 | .parent = &pll1_clk, |
| 104 | .flags = CLK_PLL | PRE_PLL, |
| 105 | .div_reg = BPDIV |
| 106 | }; |
| 107 | |
| 108 | static struct clk vpss_dac_clk = { |
| 109 | .name = "vpss_dac", |
| 110 | .parent = &pll1_sysclk3, |
| 111 | .lpsc = DM355_LPSC_VPSS_DAC, |
| 112 | }; |
| 113 | |
| 114 | static struct clk vpss_master_clk = { |
| 115 | .name = "vpss_master", |
| 116 | .parent = &pll1_sysclk4, |
| 117 | .lpsc = DAVINCI_LPSC_VPSSMSTR, |
| 118 | .flags = CLK_PSC, |
| 119 | }; |
| 120 | |
| 121 | static struct clk vpss_slave_clk = { |
| 122 | .name = "vpss_slave", |
| 123 | .parent = &pll1_sysclk4, |
| 124 | .lpsc = DAVINCI_LPSC_VPSSSLV, |
| 125 | }; |
| 126 | |
| 127 | |
| 128 | static struct clk clkout1_clk = { |
| 129 | .name = "clkout1", |
| 130 | .parent = &pll1_aux_clk, |
| 131 | /* NOTE: clkout1 can be externally gated by muxing GPIO-18 */ |
| 132 | }; |
| 133 | |
| 134 | static struct clk clkout2_clk = { |
| 135 | .name = "clkout2", |
| 136 | .parent = &pll1_sysclkbp, |
| 137 | }; |
| 138 | |
| 139 | static struct clk pll2_clk = { |
| 140 | .name = "pll2", |
| 141 | .parent = &ref_clk, |
| 142 | .flags = CLK_PLL, |
| 143 | .pll_data = &pll2_data, |
| 144 | }; |
| 145 | |
| 146 | static struct clk pll2_sysclk1 = { |
| 147 | .name = "pll2_sysclk1", |
| 148 | .parent = &pll2_clk, |
| 149 | .flags = CLK_PLL, |
| 150 | .div_reg = PLLDIV1, |
| 151 | }; |
| 152 | |
| 153 | static struct clk pll2_sysclkbp = { |
| 154 | .name = "pll2_sysclkbp", |
| 155 | .parent = &pll2_clk, |
| 156 | .flags = CLK_PLL | PRE_PLL, |
| 157 | .div_reg = BPDIV |
| 158 | }; |
| 159 | |
| 160 | static struct clk clkout3_clk = { |
| 161 | .name = "clkout3", |
| 162 | .parent = &pll2_sysclkbp, |
| 163 | /* NOTE: clkout3 can be externally gated by muxing GPIO-16 */ |
| 164 | }; |
| 165 | |
| 166 | static struct clk arm_clk = { |
| 167 | .name = "arm_clk", |
| 168 | .parent = &pll1_sysclk1, |
| 169 | .lpsc = DAVINCI_LPSC_ARM, |
| 170 | .flags = ALWAYS_ENABLED, |
| 171 | }; |
| 172 | |
| 173 | /* |
| 174 | * NOT LISTED below, and not touched by Linux |
| 175 | * - in SyncReset state by default |
| 176 | * .lpsc = DAVINCI_LPSC_TPCC, |
| 177 | * .lpsc = DAVINCI_LPSC_TPTC0, |
| 178 | * .lpsc = DAVINCI_LPSC_TPTC1, |
| 179 | * .lpsc = DAVINCI_LPSC_DDR_EMIF, .parent = &sysclk2_clk, |
| 180 | * .lpsc = DAVINCI_LPSC_MEMSTICK, |
| 181 | * - in Enabled state by default |
| 182 | * .lpsc = DAVINCI_LPSC_SYSTEM_SUBSYS, |
| 183 | * .lpsc = DAVINCI_LPSC_SCR2, // "bus" |
| 184 | * .lpsc = DAVINCI_LPSC_SCR3, // "bus" |
| 185 | * .lpsc = DAVINCI_LPSC_SCR4, // "bus" |
| 186 | * .lpsc = DAVINCI_LPSC_CROSSBAR, // "emulation" |
| 187 | * .lpsc = DAVINCI_LPSC_CFG27, // "test" |
| 188 | * .lpsc = DAVINCI_LPSC_CFG3, // "test" |
| 189 | * .lpsc = DAVINCI_LPSC_CFG5, // "test" |
| 190 | */ |
| 191 | |
| 192 | static struct clk mjcp_clk = { |
| 193 | .name = "mjcp", |
| 194 | .parent = &pll1_sysclk1, |
| 195 | .lpsc = DAVINCI_LPSC_IMCOP, |
| 196 | }; |
| 197 | |
| 198 | static struct clk uart0_clk = { |
| 199 | .name = "uart0", |
| 200 | .parent = &pll1_aux_clk, |
| 201 | .lpsc = DAVINCI_LPSC_UART0, |
| 202 | }; |
| 203 | |
| 204 | static struct clk uart1_clk = { |
| 205 | .name = "uart1", |
| 206 | .parent = &pll1_aux_clk, |
| 207 | .lpsc = DAVINCI_LPSC_UART1, |
| 208 | }; |
| 209 | |
| 210 | static struct clk uart2_clk = { |
| 211 | .name = "uart2", |
| 212 | .parent = &pll1_sysclk2, |
| 213 | .lpsc = DAVINCI_LPSC_UART2, |
| 214 | }; |
| 215 | |
| 216 | static struct clk i2c_clk = { |
| 217 | .name = "i2c", |
| 218 | .parent = &pll1_aux_clk, |
| 219 | .lpsc = DAVINCI_LPSC_I2C, |
| 220 | }; |
| 221 | |
| 222 | static struct clk asp0_clk = { |
| 223 | .name = "asp0", |
| 224 | .parent = &pll1_sysclk2, |
| 225 | .lpsc = DAVINCI_LPSC_McBSP, |
| 226 | }; |
| 227 | |
| 228 | static struct clk asp1_clk = { |
| 229 | .name = "asp1", |
| 230 | .parent = &pll1_sysclk2, |
| 231 | .lpsc = DM355_LPSC_McBSP1, |
| 232 | }; |
| 233 | |
| 234 | static struct clk mmcsd0_clk = { |
| 235 | .name = "mmcsd0", |
| 236 | .parent = &pll1_sysclk2, |
| 237 | .lpsc = DAVINCI_LPSC_MMC_SD, |
| 238 | }; |
| 239 | |
| 240 | static struct clk mmcsd1_clk = { |
| 241 | .name = "mmcsd1", |
| 242 | .parent = &pll1_sysclk2, |
| 243 | .lpsc = DM355_LPSC_MMC_SD1, |
| 244 | }; |
| 245 | |
| 246 | static struct clk spi0_clk = { |
| 247 | .name = "spi0", |
| 248 | .parent = &pll1_sysclk2, |
| 249 | .lpsc = DAVINCI_LPSC_SPI, |
| 250 | }; |
| 251 | |
| 252 | static struct clk spi1_clk = { |
| 253 | .name = "spi1", |
| 254 | .parent = &pll1_sysclk2, |
| 255 | .lpsc = DM355_LPSC_SPI1, |
| 256 | }; |
| 257 | |
| 258 | static struct clk spi2_clk = { |
| 259 | .name = "spi2", |
| 260 | .parent = &pll1_sysclk2, |
| 261 | .lpsc = DM355_LPSC_SPI2, |
| 262 | }; |
| 263 | |
| 264 | static struct clk gpio_clk = { |
| 265 | .name = "gpio", |
| 266 | .parent = &pll1_sysclk2, |
| 267 | .lpsc = DAVINCI_LPSC_GPIO, |
| 268 | }; |
| 269 | |
| 270 | static struct clk aemif_clk = { |
| 271 | .name = "aemif", |
| 272 | .parent = &pll1_sysclk2, |
| 273 | .lpsc = DAVINCI_LPSC_AEMIF, |
| 274 | }; |
| 275 | |
| 276 | static struct clk pwm0_clk = { |
| 277 | .name = "pwm0", |
| 278 | .parent = &pll1_aux_clk, |
| 279 | .lpsc = DAVINCI_LPSC_PWM0, |
| 280 | }; |
| 281 | |
| 282 | static struct clk pwm1_clk = { |
| 283 | .name = "pwm1", |
| 284 | .parent = &pll1_aux_clk, |
| 285 | .lpsc = DAVINCI_LPSC_PWM1, |
| 286 | }; |
| 287 | |
| 288 | static struct clk pwm2_clk = { |
| 289 | .name = "pwm2", |
| 290 | .parent = &pll1_aux_clk, |
| 291 | .lpsc = DAVINCI_LPSC_PWM2, |
| 292 | }; |
| 293 | |
| 294 | static struct clk pwm3_clk = { |
| 295 | .name = "pwm3", |
| 296 | .parent = &pll1_aux_clk, |
| 297 | .lpsc = DM355_LPSC_PWM3, |
| 298 | }; |
| 299 | |
| 300 | static struct clk timer0_clk = { |
| 301 | .name = "timer0", |
| 302 | .parent = &pll1_aux_clk, |
| 303 | .lpsc = DAVINCI_LPSC_TIMER0, |
| 304 | }; |
| 305 | |
| 306 | static struct clk timer1_clk = { |
| 307 | .name = "timer1", |
| 308 | .parent = &pll1_aux_clk, |
| 309 | .lpsc = DAVINCI_LPSC_TIMER1, |
| 310 | }; |
| 311 | |
| 312 | static struct clk timer2_clk = { |
| 313 | .name = "timer2", |
| 314 | .parent = &pll1_aux_clk, |
| 315 | .lpsc = DAVINCI_LPSC_TIMER2, |
| 316 | .usecount = 1, /* REVISIT: why cant' this be disabled? */ |
| 317 | }; |
| 318 | |
| 319 | static struct clk timer3_clk = { |
| 320 | .name = "timer3", |
| 321 | .parent = &pll1_aux_clk, |
| 322 | .lpsc = DM355_LPSC_TIMER3, |
| 323 | }; |
| 324 | |
| 325 | static struct clk rto_clk = { |
| 326 | .name = "rto", |
| 327 | .parent = &pll1_aux_clk, |
| 328 | .lpsc = DM355_LPSC_RTO, |
| 329 | }; |
| 330 | |
| 331 | static struct clk usb_clk = { |
| 332 | .name = "usb", |
| 333 | .parent = &pll1_sysclk2, |
| 334 | .lpsc = DAVINCI_LPSC_USB, |
| 335 | }; |
| 336 | |
| 337 | static struct davinci_clk dm355_clks[] = { |
| 338 | CLK(NULL, "ref", &ref_clk), |
| 339 | CLK(NULL, "pll1", &pll1_clk), |
| 340 | CLK(NULL, "pll1_sysclk1", &pll1_sysclk1), |
| 341 | CLK(NULL, "pll1_sysclk2", &pll1_sysclk2), |
| 342 | CLK(NULL, "pll1_sysclk3", &pll1_sysclk3), |
| 343 | CLK(NULL, "pll1_sysclk4", &pll1_sysclk4), |
| 344 | CLK(NULL, "pll1_aux", &pll1_aux_clk), |
| 345 | CLK(NULL, "pll1_sysclkbp", &pll1_sysclkbp), |
| 346 | CLK(NULL, "vpss_dac", &vpss_dac_clk), |
| 347 | CLK(NULL, "vpss_master", &vpss_master_clk), |
| 348 | CLK(NULL, "vpss_slave", &vpss_slave_clk), |
| 349 | CLK(NULL, "clkout1", &clkout1_clk), |
| 350 | CLK(NULL, "clkout2", &clkout2_clk), |
| 351 | CLK(NULL, "pll2", &pll2_clk), |
| 352 | CLK(NULL, "pll2_sysclk1", &pll2_sysclk1), |
| 353 | CLK(NULL, "pll2_sysclkbp", &pll2_sysclkbp), |
| 354 | CLK(NULL, "clkout3", &clkout3_clk), |
| 355 | CLK(NULL, "arm", &arm_clk), |
| 356 | CLK(NULL, "mjcp", &mjcp_clk), |
| 357 | CLK(NULL, "uart0", &uart0_clk), |
| 358 | CLK(NULL, "uart1", &uart1_clk), |
| 359 | CLK(NULL, "uart2", &uart2_clk), |
| 360 | CLK("i2c_davinci.1", NULL, &i2c_clk), |
| 361 | CLK("soc-audio.0", NULL, &asp0_clk), |
| 362 | CLK("soc-audio.1", NULL, &asp1_clk), |
| 363 | CLK("davinci_mmc.0", NULL, &mmcsd0_clk), |
| 364 | CLK("davinci_mmc.1", NULL, &mmcsd1_clk), |
| 365 | CLK(NULL, "spi0", &spi0_clk), |
| 366 | CLK(NULL, "spi1", &spi1_clk), |
| 367 | CLK(NULL, "spi2", &spi2_clk), |
| 368 | CLK(NULL, "gpio", &gpio_clk), |
| 369 | CLK(NULL, "aemif", &aemif_clk), |
| 370 | CLK(NULL, "pwm0", &pwm0_clk), |
| 371 | CLK(NULL, "pwm1", &pwm1_clk), |
| 372 | CLK(NULL, "pwm2", &pwm2_clk), |
| 373 | CLK(NULL, "pwm3", &pwm3_clk), |
| 374 | CLK(NULL, "timer0", &timer0_clk), |
| 375 | CLK(NULL, "timer1", &timer1_clk), |
| 376 | CLK("watchdog", NULL, &timer2_clk), |
| 377 | CLK(NULL, "timer3", &timer3_clk), |
| 378 | CLK(NULL, "rto", &rto_clk), |
| 379 | CLK(NULL, "usb", &usb_clk), |
| 380 | CLK(NULL, NULL, NULL), |
| 381 | }; |
| 382 | |
| 383 | /*----------------------------------------------------------------------*/ |
| 384 | |
| 385 | static u64 dm355_spi0_dma_mask = DMA_BIT_MASK(32); |
| 386 | |
| 387 | static struct resource dm355_spi0_resources[] = { |
| 388 | { |
| 389 | .start = 0x01c66000, |
| 390 | .end = 0x01c667ff, |
| 391 | .flags = IORESOURCE_MEM, |
| 392 | }, |
| 393 | { |
| 394 | .start = IRQ_DM355_SPINT0_1, |
| 395 | .flags = IORESOURCE_IRQ, |
| 396 | }, |
| 397 | /* Not yet used, so not included: |
| 398 | * IORESOURCE_IRQ: |
| 399 | * - IRQ_DM355_SPINT0_0 |
| 400 | * IORESOURCE_DMA: |
| 401 | * - DAVINCI_DMA_SPI_SPIX |
| 402 | * - DAVINCI_DMA_SPI_SPIR |
| 403 | */ |
| 404 | }; |
| 405 | |
| 406 | static struct platform_device dm355_spi0_device = { |
| 407 | .name = "spi_davinci", |
| 408 | .id = 0, |
| 409 | .dev = { |
| 410 | .dma_mask = &dm355_spi0_dma_mask, |
| 411 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 412 | }, |
| 413 | .num_resources = ARRAY_SIZE(dm355_spi0_resources), |
| 414 | .resource = dm355_spi0_resources, |
| 415 | }; |
| 416 | |
| 417 | void __init dm355_init_spi0(unsigned chipselect_mask, |
| 418 | struct spi_board_info *info, unsigned len) |
| 419 | { |
| 420 | /* for now, assume we need MISO */ |
| 421 | davinci_cfg_reg(DM355_SPI0_SDI); |
| 422 | |
| 423 | /* not all slaves will be wired up */ |
| 424 | if (chipselect_mask & BIT(0)) |
| 425 | davinci_cfg_reg(DM355_SPI0_SDENA0); |
| 426 | if (chipselect_mask & BIT(1)) |
| 427 | davinci_cfg_reg(DM355_SPI0_SDENA1); |
| 428 | |
| 429 | spi_register_board_info(info, len); |
| 430 | |
| 431 | platform_device_register(&dm355_spi0_device); |
| 432 | } |
| 433 | |
| 434 | /*----------------------------------------------------------------------*/ |
| 435 | |
| 436 | /* |
| 437 | * Device specific mux setup |
| 438 | * |
| 439 | * soc description mux mode mode mux dbg |
| 440 | * reg offset mask mode |
| 441 | */ |
| 442 | static const struct mux_config dm355_pins[] = { |
Mark A. Greer | 0e58595 | 2009-04-15 12:39:48 -0700 | [diff] [blame] | 443 | #ifdef CONFIG_DAVINCI_MUX |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 444 | MUX_CFG(DM355, MMCSD0, 4, 2, 1, 0, false) |
| 445 | |
| 446 | MUX_CFG(DM355, SD1_CLK, 3, 6, 1, 1, false) |
| 447 | MUX_CFG(DM355, SD1_CMD, 3, 7, 1, 1, false) |
| 448 | MUX_CFG(DM355, SD1_DATA3, 3, 8, 3, 1, false) |
| 449 | MUX_CFG(DM355, SD1_DATA2, 3, 10, 3, 1, false) |
| 450 | MUX_CFG(DM355, SD1_DATA1, 3, 12, 3, 1, false) |
| 451 | MUX_CFG(DM355, SD1_DATA0, 3, 14, 3, 1, false) |
| 452 | |
| 453 | MUX_CFG(DM355, I2C_SDA, 3, 19, 1, 1, false) |
| 454 | MUX_CFG(DM355, I2C_SCL, 3, 20, 1, 1, false) |
| 455 | |
| 456 | MUX_CFG(DM355, MCBSP0_BDX, 3, 0, 1, 1, false) |
| 457 | MUX_CFG(DM355, MCBSP0_X, 3, 1, 1, 1, false) |
| 458 | MUX_CFG(DM355, MCBSP0_BFSX, 3, 2, 1, 1, false) |
| 459 | MUX_CFG(DM355, MCBSP0_BDR, 3, 3, 1, 1, false) |
| 460 | MUX_CFG(DM355, MCBSP0_R, 3, 4, 1, 1, false) |
| 461 | MUX_CFG(DM355, MCBSP0_BFSR, 3, 5, 1, 1, false) |
| 462 | |
| 463 | MUX_CFG(DM355, SPI0_SDI, 4, 1, 1, 0, false) |
| 464 | MUX_CFG(DM355, SPI0_SDENA0, 4, 0, 1, 0, false) |
| 465 | MUX_CFG(DM355, SPI0_SDENA1, 3, 28, 1, 1, false) |
| 466 | |
| 467 | INT_CFG(DM355, INT_EDMA_CC, 2, 1, 1, false) |
| 468 | INT_CFG(DM355, INT_EDMA_TC0_ERR, 3, 1, 1, false) |
| 469 | INT_CFG(DM355, INT_EDMA_TC1_ERR, 4, 1, 1, false) |
| 470 | |
| 471 | EVT_CFG(DM355, EVT8_ASP1_TX, 0, 1, 0, false) |
| 472 | EVT_CFG(DM355, EVT9_ASP1_RX, 1, 1, 0, false) |
| 473 | EVT_CFG(DM355, EVT26_MMC0_RX, 2, 1, 0, false) |
Mark A. Greer | 0e58595 | 2009-04-15 12:39:48 -0700 | [diff] [blame] | 474 | #endif |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 475 | }; |
| 476 | |
Mark A. Greer | 673dd36 | 2009-04-15 12:40:00 -0700 | [diff] [blame] | 477 | static u8 dm355_default_priorities[DAVINCI_N_AINTC_IRQ] = { |
| 478 | [IRQ_DM355_CCDC_VDINT0] = 2, |
| 479 | [IRQ_DM355_CCDC_VDINT1] = 6, |
| 480 | [IRQ_DM355_CCDC_VDINT2] = 6, |
| 481 | [IRQ_DM355_IPIPE_HST] = 6, |
| 482 | [IRQ_DM355_H3AINT] = 6, |
| 483 | [IRQ_DM355_IPIPE_SDR] = 6, |
| 484 | [IRQ_DM355_IPIPEIFINT] = 6, |
| 485 | [IRQ_DM355_OSDINT] = 7, |
| 486 | [IRQ_DM355_VENCINT] = 6, |
| 487 | [IRQ_ASQINT] = 6, |
| 488 | [IRQ_IMXINT] = 6, |
| 489 | [IRQ_USBINT] = 4, |
| 490 | [IRQ_DM355_RTOINT] = 4, |
| 491 | [IRQ_DM355_UARTINT2] = 7, |
| 492 | [IRQ_DM355_TINT6] = 7, |
| 493 | [IRQ_CCINT0] = 5, /* dma */ |
| 494 | [IRQ_CCERRINT] = 5, /* dma */ |
| 495 | [IRQ_TCERRINT0] = 5, /* dma */ |
| 496 | [IRQ_TCERRINT] = 5, /* dma */ |
| 497 | [IRQ_DM355_SPINT2_1] = 7, |
| 498 | [IRQ_DM355_TINT7] = 4, |
| 499 | [IRQ_DM355_SDIOINT0] = 7, |
| 500 | [IRQ_MBXINT] = 7, |
| 501 | [IRQ_MBRINT] = 7, |
| 502 | [IRQ_MMCINT] = 7, |
| 503 | [IRQ_DM355_MMCINT1] = 7, |
| 504 | [IRQ_DM355_PWMINT3] = 7, |
| 505 | [IRQ_DDRINT] = 7, |
| 506 | [IRQ_AEMIFINT] = 7, |
| 507 | [IRQ_DM355_SDIOINT1] = 4, |
| 508 | [IRQ_TINT0_TINT12] = 2, /* clockevent */ |
| 509 | [IRQ_TINT0_TINT34] = 2, /* clocksource */ |
| 510 | [IRQ_TINT1_TINT12] = 7, /* DSP timer */ |
| 511 | [IRQ_TINT1_TINT34] = 7, /* system tick */ |
| 512 | [IRQ_PWMINT0] = 7, |
| 513 | [IRQ_PWMINT1] = 7, |
| 514 | [IRQ_PWMINT2] = 7, |
| 515 | [IRQ_I2C] = 3, |
| 516 | [IRQ_UARTINT0] = 3, |
| 517 | [IRQ_UARTINT1] = 3, |
| 518 | [IRQ_DM355_SPINT0_0] = 3, |
| 519 | [IRQ_DM355_SPINT0_1] = 3, |
| 520 | [IRQ_DM355_GPIO0] = 3, |
| 521 | [IRQ_DM355_GPIO1] = 7, |
| 522 | [IRQ_DM355_GPIO2] = 4, |
| 523 | [IRQ_DM355_GPIO3] = 4, |
| 524 | [IRQ_DM355_GPIO4] = 7, |
| 525 | [IRQ_DM355_GPIO5] = 7, |
| 526 | [IRQ_DM355_GPIO6] = 7, |
| 527 | [IRQ_DM355_GPIO7] = 7, |
| 528 | [IRQ_DM355_GPIO8] = 7, |
| 529 | [IRQ_DM355_GPIO9] = 7, |
| 530 | [IRQ_DM355_GPIOBNK0] = 7, |
| 531 | [IRQ_DM355_GPIOBNK1] = 7, |
| 532 | [IRQ_DM355_GPIOBNK2] = 7, |
| 533 | [IRQ_DM355_GPIOBNK3] = 7, |
| 534 | [IRQ_DM355_GPIOBNK4] = 7, |
| 535 | [IRQ_DM355_GPIOBNK5] = 7, |
| 536 | [IRQ_DM355_GPIOBNK6] = 7, |
| 537 | [IRQ_COMMTX] = 7, |
| 538 | [IRQ_COMMRX] = 7, |
| 539 | [IRQ_EMUINT] = 7, |
| 540 | }; |
| 541 | |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 542 | /*----------------------------------------------------------------------*/ |
| 543 | |
| 544 | static const s8 dma_chan_dm355_no_event[] = { |
| 545 | 12, 13, 24, 56, 57, |
| 546 | 58, 59, 60, 61, 62, |
| 547 | 63, |
| 548 | -1 |
| 549 | }; |
| 550 | |
| 551 | static struct edma_soc_info dm355_edma_info = { |
| 552 | .n_channel = 64, |
| 553 | .n_region = 4, |
| 554 | .n_slot = 128, |
| 555 | .n_tc = 2, |
| 556 | .noevent = dma_chan_dm355_no_event, |
| 557 | }; |
| 558 | |
| 559 | static struct resource edma_resources[] = { |
| 560 | { |
| 561 | .name = "edma_cc", |
| 562 | .start = 0x01c00000, |
| 563 | .end = 0x01c00000 + SZ_64K - 1, |
| 564 | .flags = IORESOURCE_MEM, |
| 565 | }, |
| 566 | { |
| 567 | .name = "edma_tc0", |
| 568 | .start = 0x01c10000, |
| 569 | .end = 0x01c10000 + SZ_1K - 1, |
| 570 | .flags = IORESOURCE_MEM, |
| 571 | }, |
| 572 | { |
| 573 | .name = "edma_tc1", |
| 574 | .start = 0x01c10400, |
| 575 | .end = 0x01c10400 + SZ_1K - 1, |
| 576 | .flags = IORESOURCE_MEM, |
| 577 | }, |
| 578 | { |
| 579 | .start = IRQ_CCINT0, |
| 580 | .flags = IORESOURCE_IRQ, |
| 581 | }, |
| 582 | { |
| 583 | .start = IRQ_CCERRINT, |
| 584 | .flags = IORESOURCE_IRQ, |
| 585 | }, |
| 586 | /* not using (or muxing) TC*_ERR */ |
| 587 | }; |
| 588 | |
| 589 | static struct platform_device dm355_edma_device = { |
| 590 | .name = "edma", |
| 591 | .id = -1, |
| 592 | .dev.platform_data = &dm355_edma_info, |
| 593 | .num_resources = ARRAY_SIZE(edma_resources), |
| 594 | .resource = edma_resources, |
| 595 | }; |
| 596 | |
| 597 | /*----------------------------------------------------------------------*/ |
| 598 | |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 599 | static struct map_desc dm355_io_desc[] = { |
| 600 | { |
| 601 | .virtual = IO_VIRT, |
| 602 | .pfn = __phys_to_pfn(IO_PHYS), |
| 603 | .length = IO_SIZE, |
| 604 | .type = MT_DEVICE |
| 605 | }, |
| 606 | }; |
| 607 | |
Mark A. Greer | b9ab127 | 2009-04-15 12:39:09 -0700 | [diff] [blame] | 608 | /* Contents of JTAG ID register used to identify exact cpu type */ |
| 609 | static struct davinci_id dm355_ids[] = { |
| 610 | { |
| 611 | .variant = 0x0, |
| 612 | .part_no = 0xb73b, |
| 613 | .manufacturer = 0x00f, |
| 614 | .cpu_id = DAVINCI_CPU_ID_DM355, |
| 615 | .name = "dm355", |
| 616 | }, |
| 617 | }; |
| 618 | |
Mark A. Greer | d81d188 | 2009-04-15 12:39:33 -0700 | [diff] [blame] | 619 | static void __iomem *dm355_psc_bases[] = { |
| 620 | IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE), |
| 621 | }; |
| 622 | |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 623 | /* |
| 624 | * T0_BOT: Timer 0, bottom: clockevent source for hrtimers |
| 625 | * T0_TOP: Timer 0, top : clocksource for generic timekeeping |
| 626 | * T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code) |
| 627 | * T1_TOP: Timer 1, top : <unused> |
| 628 | */ |
| 629 | struct davinci_timer_info dm355_timer_info = { |
| 630 | .timers = davinci_timer_instance, |
| 631 | .clockevent_id = T0_BOT, |
| 632 | .clocksource_id = T0_TOP, |
| 633 | }; |
| 634 | |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame^] | 635 | static struct plat_serial8250_port dm355_serial_platform_data[] = { |
| 636 | { |
| 637 | .mapbase = DAVINCI_UART0_BASE, |
| 638 | .irq = IRQ_UARTINT0, |
| 639 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 640 | UPF_IOREMAP, |
| 641 | .iotype = UPIO_MEM, |
| 642 | .regshift = 2, |
| 643 | }, |
| 644 | { |
| 645 | .mapbase = DAVINCI_UART1_BASE, |
| 646 | .irq = IRQ_UARTINT1, |
| 647 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 648 | UPF_IOREMAP, |
| 649 | .iotype = UPIO_MEM, |
| 650 | .regshift = 2, |
| 651 | }, |
| 652 | { |
| 653 | .mapbase = DM355_UART2_BASE, |
| 654 | .irq = IRQ_DM355_UARTINT2, |
| 655 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 656 | UPF_IOREMAP, |
| 657 | .iotype = UPIO_MEM, |
| 658 | .regshift = 2, |
| 659 | }, |
| 660 | { |
| 661 | .flags = 0 |
| 662 | }, |
| 663 | }; |
| 664 | |
| 665 | static struct platform_device dm355_serial_device = { |
| 666 | .name = "serial8250", |
| 667 | .id = PLAT8250_DEV_PLATFORM, |
| 668 | .dev = { |
| 669 | .platform_data = dm355_serial_platform_data, |
| 670 | }, |
| 671 | }; |
| 672 | |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 673 | static struct davinci_soc_info davinci_soc_info_dm355 = { |
| 674 | .io_desc = dm355_io_desc, |
| 675 | .io_desc_num = ARRAY_SIZE(dm355_io_desc), |
Mark A. Greer | b9ab127 | 2009-04-15 12:39:09 -0700 | [diff] [blame] | 676 | .jtag_id_base = IO_ADDRESS(0x01c40028), |
| 677 | .ids = dm355_ids, |
| 678 | .ids_num = ARRAY_SIZE(dm355_ids), |
Mark A. Greer | 66e0c39 | 2009-04-15 12:39:23 -0700 | [diff] [blame] | 679 | .cpu_clks = dm355_clks, |
Mark A. Greer | d81d188 | 2009-04-15 12:39:33 -0700 | [diff] [blame] | 680 | .psc_bases = dm355_psc_bases, |
| 681 | .psc_bases_num = ARRAY_SIZE(dm355_psc_bases), |
Mark A. Greer | 0e58595 | 2009-04-15 12:39:48 -0700 | [diff] [blame] | 682 | .pinmux_base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE), |
| 683 | .pinmux_pins = dm355_pins, |
| 684 | .pinmux_pins_num = ARRAY_SIZE(dm355_pins), |
Mark A. Greer | 673dd36 | 2009-04-15 12:40:00 -0700 | [diff] [blame] | 685 | .intc_base = IO_ADDRESS(DAVINCI_ARM_INTC_BASE), |
| 686 | .intc_type = DAVINCI_INTC_TYPE_AINTC, |
| 687 | .intc_irq_prios = dm355_default_priorities, |
| 688 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 689 | .timer_info = &dm355_timer_info, |
Mark A. Greer | 951d6f6 | 2009-04-15 12:40:21 -0700 | [diff] [blame] | 690 | .wdt_base = IO_ADDRESS(DAVINCI_WDOG_BASE), |
Mark A. Greer | a994955 | 2009-04-15 12:40:35 -0700 | [diff] [blame] | 691 | .gpio_base = IO_ADDRESS(DAVINCI_GPIO_BASE), |
| 692 | .gpio_num = 104, |
| 693 | .gpio_irq = IRQ_DM355_GPIOBNK0, |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame^] | 694 | .serial_dev = &dm355_serial_device, |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 695 | }; |
| 696 | |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 697 | void __init dm355_init(void) |
| 698 | { |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 699 | davinci_common_init(&davinci_soc_info_dm355); |
Kevin Hilman | 95a3477 | 2009-04-29 12:10:55 -0700 | [diff] [blame] | 700 | } |
| 701 | |
| 702 | static int __init dm355_init_devices(void) |
| 703 | { |
| 704 | if (!cpu_is_davinci_dm355()) |
| 705 | return 0; |
| 706 | |
| 707 | davinci_cfg_reg(DM355_INT_EDMA_CC); |
| 708 | platform_device_register(&dm355_edma_device); |
| 709 | return 0; |
| 710 | } |
| 711 | postcore_initcall(dm355_init_devices); |