| .. | .. |
|---|
| 15 | 15 | #include <linux/dma-mapping.h> |
|---|
| 16 | 16 | #include <linux/dmaengine.h> |
|---|
| 17 | 17 | #include <linux/init.h> |
|---|
| 18 | +#include <linux/io.h> |
|---|
| 19 | +#include <linux/irqchip/irq-davinci-aintc.h> |
|---|
| 18 | 20 | #include <linux/platform_data/edma.h> |
|---|
| 19 | 21 | #include <linux/platform_data/gpio-davinci.h> |
|---|
| 20 | 22 | #include <linux/platform_data/spi-davinci.h> |
|---|
| .. | .. |
|---|
| 26 | 28 | |
|---|
| 27 | 29 | #include <mach/common.h> |
|---|
| 28 | 30 | #include <mach/cputype.h> |
|---|
| 29 | | -#include <mach/irqs.h> |
|---|
| 30 | 31 | #include <mach/mux.h> |
|---|
| 31 | 32 | #include <mach/serial.h> |
|---|
| 32 | | -#include <mach/time.h> |
|---|
| 33 | + |
|---|
| 34 | +#include <clocksource/timer-davinci.h> |
|---|
| 33 | 35 | |
|---|
| 34 | 36 | #include "asp.h" |
|---|
| 35 | 37 | #include "davinci.h" |
|---|
| 38 | +#include "irqs.h" |
|---|
| 36 | 39 | #include "mux.h" |
|---|
| 37 | 40 | |
|---|
| 38 | 41 | #define DM355_UART2_BASE (IO_PHYS + 0x206000) |
|---|
| .. | .. |
|---|
| 53 | 56 | .flags = IORESOURCE_MEM, |
|---|
| 54 | 57 | }, |
|---|
| 55 | 58 | { |
|---|
| 56 | | - .start = IRQ_DM355_SPINT0_0, |
|---|
| 59 | + .start = DAVINCI_INTC_IRQ(IRQ_DM355_SPINT0_0), |
|---|
| 57 | 60 | .flags = IORESOURCE_IRQ, |
|---|
| 58 | 61 | }, |
|---|
| 59 | 62 | }; |
|---|
| .. | .. |
|---|
| 273 | 276 | }, |
|---|
| 274 | 277 | { |
|---|
| 275 | 278 | .name = "edma3_ccint", |
|---|
| 276 | | - .start = IRQ_CCINT0, |
|---|
| 279 | + .start = DAVINCI_INTC_IRQ(IRQ_CCINT0), |
|---|
| 277 | 280 | .flags = IORESOURCE_IRQ, |
|---|
| 278 | 281 | }, |
|---|
| 279 | 282 | { |
|---|
| 280 | 283 | .name = "edma3_ccerrint", |
|---|
| 281 | | - .start = IRQ_CCERRINT, |
|---|
| 284 | + .start = DAVINCI_INTC_IRQ(IRQ_CCERRINT), |
|---|
| 282 | 285 | .flags = IORESOURCE_IRQ, |
|---|
| 283 | 286 | }, |
|---|
| 284 | 287 | /* not using (or muxing) TC*_ERR */ |
|---|
| .. | .. |
|---|
| 358 | 361 | |
|---|
| 359 | 362 | static struct resource vpfe_resources[] = { |
|---|
| 360 | 363 | { |
|---|
| 361 | | - .start = IRQ_VDINT0, |
|---|
| 362 | | - .end = IRQ_VDINT0, |
|---|
| 364 | + .start = DAVINCI_INTC_IRQ(IRQ_VDINT0), |
|---|
| 365 | + .end = DAVINCI_INTC_IRQ(IRQ_VDINT0), |
|---|
| 363 | 366 | .flags = IORESOURCE_IRQ, |
|---|
| 364 | 367 | }, |
|---|
| 365 | 368 | { |
|---|
| 366 | | - .start = IRQ_VDINT1, |
|---|
| 367 | | - .end = IRQ_VDINT1, |
|---|
| 369 | + .start = DAVINCI_INTC_IRQ(IRQ_VDINT1), |
|---|
| 370 | + .end = DAVINCI_INTC_IRQ(IRQ_VDINT1), |
|---|
| 368 | 371 | .flags = IORESOURCE_IRQ, |
|---|
| 369 | 372 | }, |
|---|
| 370 | 373 | }; |
|---|
| .. | .. |
|---|
| 422 | 425 | |
|---|
| 423 | 426 | static struct resource dm355_venc_resources[] = { |
|---|
| 424 | 427 | { |
|---|
| 425 | | - .start = IRQ_VENCINT, |
|---|
| 426 | | - .end = IRQ_VENCINT, |
|---|
| 428 | + .start = DAVINCI_INTC_IRQ(IRQ_VENCINT), |
|---|
| 429 | + .end = DAVINCI_INTC_IRQ(IRQ_VENCINT), |
|---|
| 427 | 430 | .flags = IORESOURCE_IRQ, |
|---|
| 428 | 431 | }, |
|---|
| 429 | 432 | /* venc registers io space */ |
|---|
| .. | .. |
|---|
| 442 | 445 | |
|---|
| 443 | 446 | static struct resource dm355_v4l2_disp_resources[] = { |
|---|
| 444 | 447 | { |
|---|
| 445 | | - .start = IRQ_VENCINT, |
|---|
| 446 | | - .end = IRQ_VENCINT, |
|---|
| 448 | + .start = DAVINCI_INTC_IRQ(IRQ_VENCINT), |
|---|
| 449 | + .end = DAVINCI_INTC_IRQ(IRQ_VENCINT), |
|---|
| 447 | 450 | .flags = IORESOURCE_IRQ, |
|---|
| 448 | 451 | }, |
|---|
| 449 | 452 | /* venc registers io space */ |
|---|
| .. | .. |
|---|
| 547 | 550 | .flags = IORESOURCE_MEM, |
|---|
| 548 | 551 | }, |
|---|
| 549 | 552 | { /* interrupt */ |
|---|
| 550 | | - .start = IRQ_DM355_GPIOBNK0, |
|---|
| 551 | | - .end = IRQ_DM355_GPIOBNK0, |
|---|
| 553 | + .start = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK0), |
|---|
| 554 | + .end = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK0), |
|---|
| 552 | 555 | .flags = IORESOURCE_IRQ, |
|---|
| 553 | 556 | }, |
|---|
| 554 | 557 | { |
|---|
| 555 | | - .start = IRQ_DM355_GPIOBNK1, |
|---|
| 556 | | - .end = IRQ_DM355_GPIOBNK1, |
|---|
| 558 | + .start = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK1), |
|---|
| 559 | + .end = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK1), |
|---|
| 557 | 560 | .flags = IORESOURCE_IRQ, |
|---|
| 558 | 561 | }, |
|---|
| 559 | 562 | { |
|---|
| 560 | | - .start = IRQ_DM355_GPIOBNK2, |
|---|
| 561 | | - .end = IRQ_DM355_GPIOBNK2, |
|---|
| 563 | + .start = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK2), |
|---|
| 564 | + .end = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK2), |
|---|
| 562 | 565 | .flags = IORESOURCE_IRQ, |
|---|
| 563 | 566 | }, |
|---|
| 564 | 567 | { |
|---|
| 565 | | - .start = IRQ_DM355_GPIOBNK3, |
|---|
| 566 | | - .end = IRQ_DM355_GPIOBNK3, |
|---|
| 568 | + .start = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK3), |
|---|
| 569 | + .end = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK3), |
|---|
| 567 | 570 | .flags = IORESOURCE_IRQ, |
|---|
| 568 | 571 | }, |
|---|
| 569 | 572 | { |
|---|
| 570 | | - .start = IRQ_DM355_GPIOBNK4, |
|---|
| 571 | | - .end = IRQ_DM355_GPIOBNK4, |
|---|
| 573 | + .start = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK4), |
|---|
| 574 | + .end = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK4), |
|---|
| 572 | 575 | .flags = IORESOURCE_IRQ, |
|---|
| 573 | 576 | }, |
|---|
| 574 | 577 | { |
|---|
| 575 | | - .start = IRQ_DM355_GPIOBNK5, |
|---|
| 576 | | - .end = IRQ_DM355_GPIOBNK5, |
|---|
| 578 | + .start = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK5), |
|---|
| 579 | + .end = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK5), |
|---|
| 577 | 580 | .flags = IORESOURCE_IRQ, |
|---|
| 578 | 581 | }, |
|---|
| 579 | 582 | { |
|---|
| 580 | | - .start = IRQ_DM355_GPIOBNK6, |
|---|
| 581 | | - .end = IRQ_DM355_GPIOBNK6, |
|---|
| 583 | + .start = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK6), |
|---|
| 584 | + .end = DAVINCI_INTC_IRQ(IRQ_DM355_GPIOBNK6), |
|---|
| 582 | 585 | .flags = IORESOURCE_IRQ, |
|---|
| 583 | 586 | }, |
|---|
| 584 | 587 | }; |
|---|
| 585 | 588 | |
|---|
| 586 | 589 | static struct davinci_gpio_platform_data dm355_gpio_platform_data = { |
|---|
| 590 | + .no_auto_base = true, |
|---|
| 591 | + .base = 0, |
|---|
| 587 | 592 | .ngpio = 104, |
|---|
| 588 | 593 | }; |
|---|
| 589 | 594 | |
|---|
| .. | .. |
|---|
| 616 | 621 | }; |
|---|
| 617 | 622 | |
|---|
| 618 | 623 | /* |
|---|
| 619 | | - * T0_BOT: Timer 0, bottom: clockevent source for hrtimers |
|---|
| 620 | | - * T0_TOP: Timer 0, top : clocksource for generic timekeeping |
|---|
| 621 | | - * T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code) |
|---|
| 622 | | - * T1_TOP: Timer 1, top : <unused> |
|---|
| 624 | + * Bottom half of timer0 is used for clockevent, top half is used for |
|---|
| 625 | + * clocksource. |
|---|
| 623 | 626 | */ |
|---|
| 624 | | -static struct davinci_timer_info dm355_timer_info = { |
|---|
| 625 | | - .timers = davinci_timer_instance, |
|---|
| 626 | | - .clockevent_id = T0_BOT, |
|---|
| 627 | | - .clocksource_id = T0_TOP, |
|---|
| 627 | +static const struct davinci_timer_cfg dm355_timer_cfg = { |
|---|
| 628 | + .reg = DEFINE_RES_IO(DAVINCI_TIMER0_BASE, SZ_4K), |
|---|
| 629 | + .irq = { |
|---|
| 630 | + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT12)), |
|---|
| 631 | + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT34)), |
|---|
| 632 | + }, |
|---|
| 628 | 633 | }; |
|---|
| 629 | 634 | |
|---|
| 630 | 635 | static struct plat_serial8250_port dm355_serial0_platform_data[] = { |
|---|
| 631 | 636 | { |
|---|
| 632 | 637 | .mapbase = DAVINCI_UART0_BASE, |
|---|
| 633 | | - .irq = IRQ_UARTINT0, |
|---|
| 638 | + .irq = DAVINCI_INTC_IRQ(IRQ_UARTINT0), |
|---|
| 634 | 639 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
|---|
| 635 | 640 | UPF_IOREMAP, |
|---|
| 636 | 641 | .iotype = UPIO_MEM, |
|---|
| .. | .. |
|---|
| 643 | 648 | static struct plat_serial8250_port dm355_serial1_platform_data[] = { |
|---|
| 644 | 649 | { |
|---|
| 645 | 650 | .mapbase = DAVINCI_UART1_BASE, |
|---|
| 646 | | - .irq = IRQ_UARTINT1, |
|---|
| 651 | + .irq = DAVINCI_INTC_IRQ(IRQ_UARTINT1), |
|---|
| 647 | 652 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
|---|
| 648 | 653 | UPF_IOREMAP, |
|---|
| 649 | 654 | .iotype = UPIO_MEM, |
|---|
| .. | .. |
|---|
| 656 | 661 | static struct plat_serial8250_port dm355_serial2_platform_data[] = { |
|---|
| 657 | 662 | { |
|---|
| 658 | 663 | .mapbase = DM355_UART2_BASE, |
|---|
| 659 | | - .irq = IRQ_DM355_UARTINT2, |
|---|
| 664 | + .irq = DAVINCI_INTC_IRQ(IRQ_DM355_UARTINT2), |
|---|
| 660 | 665 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
|---|
| 661 | 666 | UPF_IOREMAP, |
|---|
| 662 | 667 | .iotype = UPIO_MEM, |
|---|
| .. | .. |
|---|
| 702 | 707 | .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, |
|---|
| 703 | 708 | .pinmux_pins = dm355_pins, |
|---|
| 704 | 709 | .pinmux_pins_num = ARRAY_SIZE(dm355_pins), |
|---|
| 705 | | - .intc_base = DAVINCI_ARM_INTC_BASE, |
|---|
| 706 | | - .intc_type = DAVINCI_INTC_TYPE_AINTC, |
|---|
| 707 | | - .intc_irq_prios = dm355_default_priorities, |
|---|
| 708 | | - .intc_irq_num = DAVINCI_N_AINTC_IRQ, |
|---|
| 709 | | - .timer_info = &dm355_timer_info, |
|---|
| 710 | 710 | .sram_dma = 0x00010000, |
|---|
| 711 | 711 | .sram_len = SZ_32K, |
|---|
| 712 | 712 | }; |
|---|
| .. | .. |
|---|
| 733 | 733 | { |
|---|
| 734 | 734 | void __iomem *pll1, *psc; |
|---|
| 735 | 735 | struct clk *clk; |
|---|
| 736 | + int rv; |
|---|
| 736 | 737 | |
|---|
| 737 | 738 | clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM355_REF_FREQ); |
|---|
| 738 | 739 | |
|---|
| .. | .. |
|---|
| 743 | 744 | dm355_psc_init(NULL, psc); |
|---|
| 744 | 745 | |
|---|
| 745 | 746 | clk = clk_get(NULL, "timer0"); |
|---|
| 747 | + if (WARN_ON(IS_ERR(clk))) { |
|---|
| 748 | + pr_err("Unable to get the timer clock\n"); |
|---|
| 749 | + return; |
|---|
| 750 | + } |
|---|
| 746 | 751 | |
|---|
| 747 | | - davinci_timer_init(clk); |
|---|
| 752 | + rv = davinci_timer_register(clk, &dm355_timer_cfg); |
|---|
| 753 | + WARN(rv, "Unable to register the timer: %d\n", rv); |
|---|
| 748 | 754 | } |
|---|
| 749 | 755 | |
|---|
| 750 | 756 | static struct resource dm355_pll2_resources[] = { |
|---|
| .. | .. |
|---|
| 791 | 797 | return 0; |
|---|
| 792 | 798 | } |
|---|
| 793 | 799 | |
|---|
| 800 | +static const struct davinci_aintc_config dm355_aintc_config = { |
|---|
| 801 | + .reg = { |
|---|
| 802 | + .start = DAVINCI_ARM_INTC_BASE, |
|---|
| 803 | + .end = DAVINCI_ARM_INTC_BASE + SZ_4K - 1, |
|---|
| 804 | + .flags = IORESOURCE_MEM, |
|---|
| 805 | + }, |
|---|
| 806 | + .num_irqs = 64, |
|---|
| 807 | + .prios = dm355_default_priorities, |
|---|
| 808 | +}; |
|---|
| 809 | + |
|---|
| 810 | +void __init dm355_init_irq(void) |
|---|
| 811 | +{ |
|---|
| 812 | + davinci_aintc_init(&dm355_aintc_config); |
|---|
| 813 | +} |
|---|
| 814 | + |
|---|
| 794 | 815 | static int __init dm355_init_devices(void) |
|---|
| 795 | 816 | { |
|---|
| 796 | 817 | struct platform_device *edma_pdev; |
|---|