forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/arch/arm/mach-davinci/dm644x.c
....@@ -14,6 +14,8 @@
1414 #include <linux/clkdev.h>
1515 #include <linux/dmaengine.h>
1616 #include <linux/init.h>
17
+#include <linux/io.h>
18
+#include <linux/irqchip/irq-davinci-aintc.h>
1719 #include <linux/platform_data/edma.h>
1820 #include <linux/platform_data/gpio-davinci.h>
1921 #include <linux/platform_device.h>
....@@ -23,13 +25,14 @@
2325
2426 #include <mach/common.h>
2527 #include <mach/cputype.h>
26
-#include <mach/irqs.h>
2728 #include <mach/mux.h>
2829 #include <mach/serial.h>
29
-#include <mach/time.h>
30
+
31
+#include <clocksource/timer-davinci.h>
3032
3133 #include "asp.h"
3234 #include "davinci.h"
35
+#include "irqs.h"
3336 #include "mux.h"
3437
3538 /*
....@@ -59,8 +62,8 @@
5962 .flags = IORESOURCE_MEM,
6063 },
6164 {
62
- .start = IRQ_EMACINT,
63
- .end = IRQ_EMACINT,
65
+ .start = DAVINCI_INTC_IRQ(IRQ_EMACINT),
66
+ .end = DAVINCI_INTC_IRQ(IRQ_EMACINT),
6467 .flags = IORESOURCE_IRQ,
6568 },
6669 };
....@@ -260,12 +263,12 @@
260263 },
261264 {
262265 .name = "edma3_ccint",
263
- .start = IRQ_CCINT0,
266
+ .start = DAVINCI_INTC_IRQ(IRQ_CCINT0),
264267 .flags = IORESOURCE_IRQ,
265268 },
266269 {
267270 .name = "edma3_ccerrint",
268
- .start = IRQ_CCERRINT,
271
+ .start = DAVINCI_INTC_IRQ(IRQ_CCERRINT),
269272 .flags = IORESOURCE_IRQ,
270273 },
271274 /* not using TC*_ERR */
....@@ -330,13 +333,13 @@
330333
331334 static struct resource dm644x_vpfe_resources[] = {
332335 {
333
- .start = IRQ_VDINT0,
334
- .end = IRQ_VDINT0,
336
+ .start = DAVINCI_INTC_IRQ(IRQ_VDINT0),
337
+ .end = DAVINCI_INTC_IRQ(IRQ_VDINT0),
335338 .flags = IORESOURCE_IRQ,
336339 },
337340 {
338
- .start = IRQ_VDINT1,
339
- .end = IRQ_VDINT1,
341
+ .start = DAVINCI_INTC_IRQ(IRQ_VDINT1),
342
+ .end = DAVINCI_INTC_IRQ(IRQ_VDINT1),
340343 .flags = IORESOURCE_IRQ,
341344 },
342345 };
....@@ -442,8 +445,8 @@
442445
443446 static struct resource dm644x_v4l2_disp_resources[] = {
444447 {
445
- .start = IRQ_VENCINT,
446
- .end = IRQ_VENCINT,
448
+ .start = DAVINCI_INTC_IRQ(IRQ_VENCINT),
449
+ .end = DAVINCI_INTC_IRQ(IRQ_VENCINT),
447450 .flags = IORESOURCE_IRQ,
448451 },
449452 };
....@@ -491,33 +494,35 @@
491494 .flags = IORESOURCE_MEM,
492495 },
493496 { /* interrupt */
494
- .start = IRQ_GPIOBNK0,
495
- .end = IRQ_GPIOBNK0,
497
+ .start = DAVINCI_INTC_IRQ(IRQ_GPIOBNK0),
498
+ .end = DAVINCI_INTC_IRQ(IRQ_GPIOBNK0),
496499 .flags = IORESOURCE_IRQ,
497500 },
498501 {
499
- .start = IRQ_GPIOBNK1,
500
- .end = IRQ_GPIOBNK1,
502
+ .start = DAVINCI_INTC_IRQ(IRQ_GPIOBNK1),
503
+ .end = DAVINCI_INTC_IRQ(IRQ_GPIOBNK1),
501504 .flags = IORESOURCE_IRQ,
502505 },
503506 {
504
- .start = IRQ_GPIOBNK2,
505
- .end = IRQ_GPIOBNK2,
507
+ .start = DAVINCI_INTC_IRQ(IRQ_GPIOBNK2),
508
+ .end = DAVINCI_INTC_IRQ(IRQ_GPIOBNK2),
506509 .flags = IORESOURCE_IRQ,
507510 },
508511 {
509
- .start = IRQ_GPIOBNK3,
510
- .end = IRQ_GPIOBNK3,
512
+ .start = DAVINCI_INTC_IRQ(IRQ_GPIOBNK3),
513
+ .end = DAVINCI_INTC_IRQ(IRQ_GPIOBNK3),
511514 .flags = IORESOURCE_IRQ,
512515 },
513516 {
514
- .start = IRQ_GPIOBNK4,
515
- .end = IRQ_GPIOBNK4,
517
+ .start = DAVINCI_INTC_IRQ(IRQ_GPIOBNK4),
518
+ .end = DAVINCI_INTC_IRQ(IRQ_GPIOBNK4),
516519 .flags = IORESOURCE_IRQ,
517520 },
518521 };
519522
520523 static struct davinci_gpio_platform_data dm644_gpio_platform_data = {
524
+ .no_auto_base = true,
525
+ .base = 0,
521526 .ngpio = 71,
522527 };
523528
....@@ -557,21 +562,21 @@
557562 };
558563
559564 /*
560
- * T0_BOT: Timer 0, bottom: clockevent source for hrtimers
561
- * T0_TOP: Timer 0, top : clocksource for generic timekeeping
562
- * T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code)
563
- * T1_TOP: Timer 1, top : <unused>
565
+ * Bottom half of timer0 is used for clockevent, top half is used for
566
+ * clocksource.
564567 */
565
-static struct davinci_timer_info dm644x_timer_info = {
566
- .timers = davinci_timer_instance,
567
- .clockevent_id = T0_BOT,
568
- .clocksource_id = T0_TOP,
568
+static const struct davinci_timer_cfg dm644x_timer_cfg = {
569
+ .reg = DEFINE_RES_IO(DAVINCI_TIMER0_BASE, SZ_4K),
570
+ .irq = {
571
+ DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT12)),
572
+ DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT34)),
573
+ },
569574 };
570575
571576 static struct plat_serial8250_port dm644x_serial0_platform_data[] = {
572577 {
573578 .mapbase = DAVINCI_UART0_BASE,
574
- .irq = IRQ_UARTINT0,
579
+ .irq = DAVINCI_INTC_IRQ(IRQ_UARTINT0),
575580 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
576581 UPF_IOREMAP,
577582 .iotype = UPIO_MEM,
....@@ -584,7 +589,7 @@
584589 static struct plat_serial8250_port dm644x_serial1_platform_data[] = {
585590 {
586591 .mapbase = DAVINCI_UART1_BASE,
587
- .irq = IRQ_UARTINT1,
592
+ .irq = DAVINCI_INTC_IRQ(IRQ_UARTINT1),
588593 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
589594 UPF_IOREMAP,
590595 .iotype = UPIO_MEM,
....@@ -597,7 +602,7 @@
597602 static struct plat_serial8250_port dm644x_serial2_platform_data[] = {
598603 {
599604 .mapbase = DAVINCI_UART2_BASE,
600
- .irq = IRQ_UARTINT2,
605
+ .irq = DAVINCI_INTC_IRQ(IRQ_UARTINT2),
601606 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
602607 UPF_IOREMAP,
603608 .iotype = UPIO_MEM,
....@@ -643,11 +648,6 @@
643648 .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE,
644649 .pinmux_pins = dm644x_pins,
645650 .pinmux_pins_num = ARRAY_SIZE(dm644x_pins),
646
- .intc_base = DAVINCI_ARM_INTC_BASE,
647
- .intc_type = DAVINCI_INTC_TYPE_AINTC,
648
- .intc_irq_prios = dm644x_default_priorities,
649
- .intc_irq_num = DAVINCI_N_AINTC_IRQ,
650
- .timer_info = &dm644x_timer_info,
651651 .emac_pdata = &dm644x_emac_pdata,
652652 .sram_dma = 0x00008000,
653653 .sram_len = SZ_16K,
....@@ -669,6 +669,7 @@
669669 {
670670 void __iomem *pll1, *psc;
671671 struct clk *clk;
672
+ int rv;
672673
673674 clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM644X_REF_FREQ);
674675
....@@ -679,8 +680,13 @@
679680 dm644x_psc_init(NULL, psc);
680681
681682 clk = clk_get(NULL, "timer0");
683
+ if (WARN_ON(IS_ERR(clk))) {
684
+ pr_err("Unable to get the timer clock\n");
685
+ return;
686
+ }
682687
683
- davinci_timer_init(clk);
688
+ rv = davinci_timer_register(clk, &dm644x_timer_cfg);
689
+ WARN(rv, "Unable to register the timer: %d\n", rv);
684690 }
685691
686692 static struct resource dm644x_pll2_resources[] = {
....@@ -727,6 +733,21 @@
727733 return 0;
728734 }
729735
736
+static const struct davinci_aintc_config dm644x_aintc_config = {
737
+ .reg = {
738
+ .start = DAVINCI_ARM_INTC_BASE,
739
+ .end = DAVINCI_ARM_INTC_BASE + SZ_4K - 1,
740
+ .flags = IORESOURCE_MEM,
741
+ },
742
+ .num_irqs = 64,
743
+ .prios = dm644x_default_priorities,
744
+};
745
+
746
+void __init dm644x_init_irq(void)
747
+{
748
+ davinci_aintc_init(&dm644x_aintc_config);
749
+}
750
+
730751 void __init dm644x_init_devices(void)
731752 {
732753 struct platform_device *edma_pdev;