aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c22
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c22
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c27
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c22
-rw-r--r--arch/arm/mach-omap2/timer.c136
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h12
6 files changed, 240 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index b6ea69a5c2f8..6d7206213525 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -269,6 +269,16 @@ static struct omap_hwmod omap2420_iva_hwmod = {
269 .masters_cnt = ARRAY_SIZE(omap2420_iva_masters), 269 .masters_cnt = ARRAY_SIZE(omap2420_iva_masters),
270}; 270};
271 271
272/* always-on timers dev attribute */
273static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
274 .timer_capability = OMAP_TIMER_ALWON,
275};
276
277/* pwm timers dev attribute */
278static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
279 .timer_capability = OMAP_TIMER_HAS_PWM,
280};
281
272/* timer1 */ 282/* timer1 */
273static struct omap_hwmod omap2420_timer1_hwmod; 283static struct omap_hwmod omap2420_timer1_hwmod;
274 284
@@ -309,6 +319,7 @@ static struct omap_hwmod omap2420_timer1_hwmod = {
309 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT, 319 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT,
310 }, 320 },
311 }, 321 },
322 .dev_attr = &capability_alwon_dev_attr,
312 .slaves = omap2420_timer1_slaves, 323 .slaves = omap2420_timer1_slaves,
313 .slaves_cnt = ARRAY_SIZE(omap2420_timer1_slaves), 324 .slaves_cnt = ARRAY_SIZE(omap2420_timer1_slaves),
314 .class = &omap2xxx_timer_hwmod_class, 325 .class = &omap2xxx_timer_hwmod_class,
@@ -345,6 +356,7 @@ static struct omap_hwmod omap2420_timer2_hwmod = {
345 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT, 356 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
346 }, 357 },
347 }, 358 },
359 .dev_attr = &capability_alwon_dev_attr,
348 .slaves = omap2420_timer2_slaves, 360 .slaves = omap2420_timer2_slaves,
349 .slaves_cnt = ARRAY_SIZE(omap2420_timer2_slaves), 361 .slaves_cnt = ARRAY_SIZE(omap2420_timer2_slaves),
350 .class = &omap2xxx_timer_hwmod_class, 362 .class = &omap2xxx_timer_hwmod_class,
@@ -381,6 +393,7 @@ static struct omap_hwmod omap2420_timer3_hwmod = {
381 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT, 393 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
382 }, 394 },
383 }, 395 },
396 .dev_attr = &capability_alwon_dev_attr,
384 .slaves = omap2420_timer3_slaves, 397 .slaves = omap2420_timer3_slaves,
385 .slaves_cnt = ARRAY_SIZE(omap2420_timer3_slaves), 398 .slaves_cnt = ARRAY_SIZE(omap2420_timer3_slaves),
386 .class = &omap2xxx_timer_hwmod_class, 399 .class = &omap2xxx_timer_hwmod_class,
@@ -417,6 +430,7 @@ static struct omap_hwmod omap2420_timer4_hwmod = {
417 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT, 430 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
418 }, 431 },
419 }, 432 },
433 .dev_attr = &capability_alwon_dev_attr,
420 .slaves = omap2420_timer4_slaves, 434 .slaves = omap2420_timer4_slaves,
421 .slaves_cnt = ARRAY_SIZE(omap2420_timer4_slaves), 435 .slaves_cnt = ARRAY_SIZE(omap2420_timer4_slaves),
422 .class = &omap2xxx_timer_hwmod_class, 436 .class = &omap2xxx_timer_hwmod_class,
@@ -453,6 +467,7 @@ static struct omap_hwmod omap2420_timer5_hwmod = {
453 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT, 467 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
454 }, 468 },
455 }, 469 },
470 .dev_attr = &capability_alwon_dev_attr,
456 .slaves = omap2420_timer5_slaves, 471 .slaves = omap2420_timer5_slaves,
457 .slaves_cnt = ARRAY_SIZE(omap2420_timer5_slaves), 472 .slaves_cnt = ARRAY_SIZE(omap2420_timer5_slaves),
458 .class = &omap2xxx_timer_hwmod_class, 473 .class = &omap2xxx_timer_hwmod_class,
@@ -490,6 +505,7 @@ static struct omap_hwmod omap2420_timer6_hwmod = {
490 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT, 505 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
491 }, 506 },
492 }, 507 },
508 .dev_attr = &capability_alwon_dev_attr,
493 .slaves = omap2420_timer6_slaves, 509 .slaves = omap2420_timer6_slaves,
494 .slaves_cnt = ARRAY_SIZE(omap2420_timer6_slaves), 510 .slaves_cnt = ARRAY_SIZE(omap2420_timer6_slaves),
495 .class = &omap2xxx_timer_hwmod_class, 511 .class = &omap2xxx_timer_hwmod_class,
@@ -526,6 +542,7 @@ static struct omap_hwmod omap2420_timer7_hwmod = {
526 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT, 542 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
527 }, 543 },
528 }, 544 },
545 .dev_attr = &capability_alwon_dev_attr,
529 .slaves = omap2420_timer7_slaves, 546 .slaves = omap2420_timer7_slaves,
530 .slaves_cnt = ARRAY_SIZE(omap2420_timer7_slaves), 547 .slaves_cnt = ARRAY_SIZE(omap2420_timer7_slaves),
531 .class = &omap2xxx_timer_hwmod_class, 548 .class = &omap2xxx_timer_hwmod_class,
@@ -562,6 +579,7 @@ static struct omap_hwmod omap2420_timer8_hwmod = {
562 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT, 579 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
563 }, 580 },
564 }, 581 },
582 .dev_attr = &capability_alwon_dev_attr,
565 .slaves = omap2420_timer8_slaves, 583 .slaves = omap2420_timer8_slaves,
566 .slaves_cnt = ARRAY_SIZE(omap2420_timer8_slaves), 584 .slaves_cnt = ARRAY_SIZE(omap2420_timer8_slaves),
567 .class = &omap2xxx_timer_hwmod_class, 585 .class = &omap2xxx_timer_hwmod_class,
@@ -598,6 +616,7 @@ static struct omap_hwmod omap2420_timer9_hwmod = {
598 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT, 616 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT,
599 }, 617 },
600 }, 618 },
619 .dev_attr = &capability_pwm_dev_attr,
601 .slaves = omap2420_timer9_slaves, 620 .slaves = omap2420_timer9_slaves,
602 .slaves_cnt = ARRAY_SIZE(omap2420_timer9_slaves), 621 .slaves_cnt = ARRAY_SIZE(omap2420_timer9_slaves),
603 .class = &omap2xxx_timer_hwmod_class, 622 .class = &omap2xxx_timer_hwmod_class,
@@ -634,6 +653,7 @@ static struct omap_hwmod omap2420_timer10_hwmod = {
634 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT, 653 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT,
635 }, 654 },
636 }, 655 },
656 .dev_attr = &capability_pwm_dev_attr,
637 .slaves = omap2420_timer10_slaves, 657 .slaves = omap2420_timer10_slaves,
638 .slaves_cnt = ARRAY_SIZE(omap2420_timer10_slaves), 658 .slaves_cnt = ARRAY_SIZE(omap2420_timer10_slaves),
639 .class = &omap2xxx_timer_hwmod_class, 659 .class = &omap2xxx_timer_hwmod_class,
@@ -670,6 +690,7 @@ static struct omap_hwmod omap2420_timer11_hwmod = {
670 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT, 690 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT,
671 }, 691 },
672 }, 692 },
693 .dev_attr = &capability_pwm_dev_attr,
673 .slaves = omap2420_timer11_slaves, 694 .slaves = omap2420_timer11_slaves,
674 .slaves_cnt = ARRAY_SIZE(omap2420_timer11_slaves), 695 .slaves_cnt = ARRAY_SIZE(omap2420_timer11_slaves),
675 .class = &omap2xxx_timer_hwmod_class, 696 .class = &omap2xxx_timer_hwmod_class,
@@ -706,6 +727,7 @@ static struct omap_hwmod omap2420_timer12_hwmod = {
706 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT, 727 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT,
707 }, 728 },
708 }, 729 },
730 .dev_attr = &capability_pwm_dev_attr,
709 .slaves = omap2420_timer12_slaves, 731 .slaves = omap2420_timer12_slaves,
710 .slaves_cnt = ARRAY_SIZE(omap2420_timer12_slaves), 732 .slaves_cnt = ARRAY_SIZE(omap2420_timer12_slaves),
711 .class = &omap2xxx_timer_hwmod_class, 733 .class = &omap2xxx_timer_hwmod_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 56de8d616313..a2580d01c3ff 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -343,6 +343,16 @@ static struct omap_hwmod omap2430_iva_hwmod = {
343 .masters_cnt = ARRAY_SIZE(omap2430_iva_masters), 343 .masters_cnt = ARRAY_SIZE(omap2430_iva_masters),
344}; 344};
345 345
346/* always-on timers dev attribute */
347static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
348 .timer_capability = OMAP_TIMER_ALWON,
349};
350
351/* pwm timers dev attribute */
352static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
353 .timer_capability = OMAP_TIMER_HAS_PWM,
354};
355
346/* timer1 */ 356/* timer1 */
347static struct omap_hwmod omap2430_timer1_hwmod; 357static struct omap_hwmod omap2430_timer1_hwmod;
348 358
@@ -383,6 +393,7 @@ static struct omap_hwmod omap2430_timer1_hwmod = {
383 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT, 393 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT,
384 }, 394 },
385 }, 395 },
396 .dev_attr = &capability_alwon_dev_attr,
386 .slaves = omap2430_timer1_slaves, 397 .slaves = omap2430_timer1_slaves,
387 .slaves_cnt = ARRAY_SIZE(omap2430_timer1_slaves), 398 .slaves_cnt = ARRAY_SIZE(omap2430_timer1_slaves),
388 .class = &omap2xxx_timer_hwmod_class, 399 .class = &omap2xxx_timer_hwmod_class,
@@ -419,6 +430,7 @@ static struct omap_hwmod omap2430_timer2_hwmod = {
419 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT, 430 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
420 }, 431 },
421 }, 432 },
433 .dev_attr = &capability_alwon_dev_attr,
422 .slaves = omap2430_timer2_slaves, 434 .slaves = omap2430_timer2_slaves,
423 .slaves_cnt = ARRAY_SIZE(omap2430_timer2_slaves), 435 .slaves_cnt = ARRAY_SIZE(omap2430_timer2_slaves),
424 .class = &omap2xxx_timer_hwmod_class, 436 .class = &omap2xxx_timer_hwmod_class,
@@ -455,6 +467,7 @@ static struct omap_hwmod omap2430_timer3_hwmod = {
455 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT, 467 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
456 }, 468 },
457 }, 469 },
470 .dev_attr = &capability_alwon_dev_attr,
458 .slaves = omap2430_timer3_slaves, 471 .slaves = omap2430_timer3_slaves,
459 .slaves_cnt = ARRAY_SIZE(omap2430_timer3_slaves), 472 .slaves_cnt = ARRAY_SIZE(omap2430_timer3_slaves),
460 .class = &omap2xxx_timer_hwmod_class, 473 .class = &omap2xxx_timer_hwmod_class,
@@ -491,6 +504,7 @@ static struct omap_hwmod omap2430_timer4_hwmod = {
491 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT, 504 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
492 }, 505 },
493 }, 506 },
507 .dev_attr = &capability_alwon_dev_attr,
494 .slaves = omap2430_timer4_slaves, 508 .slaves = omap2430_timer4_slaves,
495 .slaves_cnt = ARRAY_SIZE(omap2430_timer4_slaves), 509 .slaves_cnt = ARRAY_SIZE(omap2430_timer4_slaves),
496 .class = &omap2xxx_timer_hwmod_class, 510 .class = &omap2xxx_timer_hwmod_class,
@@ -527,6 +541,7 @@ static struct omap_hwmod omap2430_timer5_hwmod = {
527 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT, 541 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
528 }, 542 },
529 }, 543 },
544 .dev_attr = &capability_alwon_dev_attr,
530 .slaves = omap2430_timer5_slaves, 545 .slaves = omap2430_timer5_slaves,
531 .slaves_cnt = ARRAY_SIZE(omap2430_timer5_slaves), 546 .slaves_cnt = ARRAY_SIZE(omap2430_timer5_slaves),
532 .class = &omap2xxx_timer_hwmod_class, 547 .class = &omap2xxx_timer_hwmod_class,
@@ -563,6 +578,7 @@ static struct omap_hwmod omap2430_timer6_hwmod = {
563 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT, 578 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
564 }, 579 },
565 }, 580 },
581 .dev_attr = &capability_alwon_dev_attr,
566 .slaves = omap2430_timer6_slaves, 582 .slaves = omap2430_timer6_slaves,
567 .slaves_cnt = ARRAY_SIZE(omap2430_timer6_slaves), 583 .slaves_cnt = ARRAY_SIZE(omap2430_timer6_slaves),
568 .class = &omap2xxx_timer_hwmod_class, 584 .class = &omap2xxx_timer_hwmod_class,
@@ -599,6 +615,7 @@ static struct omap_hwmod omap2430_timer7_hwmod = {
599 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT, 615 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
600 }, 616 },
601 }, 617 },
618 .dev_attr = &capability_alwon_dev_attr,
602 .slaves = omap2430_timer7_slaves, 619 .slaves = omap2430_timer7_slaves,
603 .slaves_cnt = ARRAY_SIZE(omap2430_timer7_slaves), 620 .slaves_cnt = ARRAY_SIZE(omap2430_timer7_slaves),
604 .class = &omap2xxx_timer_hwmod_class, 621 .class = &omap2xxx_timer_hwmod_class,
@@ -635,6 +652,7 @@ static struct omap_hwmod omap2430_timer8_hwmod = {
635 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT, 652 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
636 }, 653 },
637 }, 654 },
655 .dev_attr = &capability_alwon_dev_attr,
638 .slaves = omap2430_timer8_slaves, 656 .slaves = omap2430_timer8_slaves,
639 .slaves_cnt = ARRAY_SIZE(omap2430_timer8_slaves), 657 .slaves_cnt = ARRAY_SIZE(omap2430_timer8_slaves),
640 .class = &omap2xxx_timer_hwmod_class, 658 .class = &omap2xxx_timer_hwmod_class,
@@ -671,6 +689,7 @@ static struct omap_hwmod omap2430_timer9_hwmod = {
671 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT, 689 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT,
672 }, 690 },
673 }, 691 },
692 .dev_attr = &capability_pwm_dev_attr,
674 .slaves = omap2430_timer9_slaves, 693 .slaves = omap2430_timer9_slaves,
675 .slaves_cnt = ARRAY_SIZE(omap2430_timer9_slaves), 694 .slaves_cnt = ARRAY_SIZE(omap2430_timer9_slaves),
676 .class = &omap2xxx_timer_hwmod_class, 695 .class = &omap2xxx_timer_hwmod_class,
@@ -707,6 +726,7 @@ static struct omap_hwmod omap2430_timer10_hwmod = {
707 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT, 726 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT,
708 }, 727 },
709 }, 728 },
729 .dev_attr = &capability_pwm_dev_attr,
710 .slaves = omap2430_timer10_slaves, 730 .slaves = omap2430_timer10_slaves,
711 .slaves_cnt = ARRAY_SIZE(omap2430_timer10_slaves), 731 .slaves_cnt = ARRAY_SIZE(omap2430_timer10_slaves),
712 .class = &omap2xxx_timer_hwmod_class, 732 .class = &omap2xxx_timer_hwmod_class,
@@ -743,6 +763,7 @@ static struct omap_hwmod omap2430_timer11_hwmod = {
743 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT, 763 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT,
744 }, 764 },
745 }, 765 },
766 .dev_attr = &capability_pwm_dev_attr,
746 .slaves = omap2430_timer11_slaves, 767 .slaves = omap2430_timer11_slaves,
747 .slaves_cnt = ARRAY_SIZE(omap2430_timer11_slaves), 768 .slaves_cnt = ARRAY_SIZE(omap2430_timer11_slaves),
748 .class = &omap2xxx_timer_hwmod_class, 769 .class = &omap2xxx_timer_hwmod_class,
@@ -779,6 +800,7 @@ static struct omap_hwmod omap2430_timer12_hwmod = {
779 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT, 800 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT,
780 }, 801 },
781 }, 802 },
803 .dev_attr = &capability_pwm_dev_attr,
782 .slaves = omap2430_timer12_slaves, 804 .slaves = omap2430_timer12_slaves,
783 .slaves_cnt = ARRAY_SIZE(omap2430_timer12_slaves), 805 .slaves_cnt = ARRAY_SIZE(omap2430_timer12_slaves),
784 .class = &omap2xxx_timer_hwmod_class, 806 .class = &omap2xxx_timer_hwmod_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index ab35acbc2d1d..2e4852d9574f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -564,6 +564,21 @@ static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {
564 .rev = OMAP_TIMER_IP_VERSION_1, 564 .rev = OMAP_TIMER_IP_VERSION_1,
565}; 565};
566 566
567/* secure timers dev attribute */
568static struct omap_timer_capability_dev_attr capability_secure_dev_attr = {
569 .timer_capability = OMAP_TIMER_SECURE,
570};
571
572/* always-on timers dev attribute */
573static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
574 .timer_capability = OMAP_TIMER_ALWON,
575};
576
577/* pwm timers dev attribute */
578static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
579 .timer_capability = OMAP_TIMER_HAS_PWM,
580};
581
567/* timer1 */ 582/* timer1 */
568static struct omap_hwmod omap3xxx_timer1_hwmod; 583static struct omap_hwmod omap3xxx_timer1_hwmod;
569 584
@@ -604,6 +619,7 @@ static struct omap_hwmod omap3xxx_timer1_hwmod = {
604 .idlest_idle_bit = OMAP3430_ST_GPT1_SHIFT, 619 .idlest_idle_bit = OMAP3430_ST_GPT1_SHIFT,
605 }, 620 },
606 }, 621 },
622 .dev_attr = &capability_alwon_dev_attr,
607 .slaves = omap3xxx_timer1_slaves, 623 .slaves = omap3xxx_timer1_slaves,
608 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer1_slaves), 624 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer1_slaves),
609 .class = &omap3xxx_timer_1ms_hwmod_class, 625 .class = &omap3xxx_timer_1ms_hwmod_class,
@@ -649,6 +665,7 @@ static struct omap_hwmod omap3xxx_timer2_hwmod = {
649 .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT, 665 .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT,
650 }, 666 },
651 }, 667 },
668 .dev_attr = &capability_alwon_dev_attr,
652 .slaves = omap3xxx_timer2_slaves, 669 .slaves = omap3xxx_timer2_slaves,
653 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer2_slaves), 670 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer2_slaves),
654 .class = &omap3xxx_timer_1ms_hwmod_class, 671 .class = &omap3xxx_timer_1ms_hwmod_class,
@@ -694,6 +711,7 @@ static struct omap_hwmod omap3xxx_timer3_hwmod = {
694 .idlest_idle_bit = OMAP3430_ST_GPT3_SHIFT, 711 .idlest_idle_bit = OMAP3430_ST_GPT3_SHIFT,
695 }, 712 },
696 }, 713 },
714 .dev_attr = &capability_alwon_dev_attr,
697 .slaves = omap3xxx_timer3_slaves, 715 .slaves = omap3xxx_timer3_slaves,
698 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer3_slaves), 716 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer3_slaves),
699 .class = &omap3xxx_timer_hwmod_class, 717 .class = &omap3xxx_timer_hwmod_class,
@@ -739,6 +757,7 @@ static struct omap_hwmod omap3xxx_timer4_hwmod = {
739 .idlest_idle_bit = OMAP3430_ST_GPT4_SHIFT, 757 .idlest_idle_bit = OMAP3430_ST_GPT4_SHIFT,
740 }, 758 },
741 }, 759 },
760 .dev_attr = &capability_alwon_dev_attr,
742 .slaves = omap3xxx_timer4_slaves, 761 .slaves = omap3xxx_timer4_slaves,
743 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer4_slaves), 762 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer4_slaves),
744 .class = &omap3xxx_timer_hwmod_class, 763 .class = &omap3xxx_timer_hwmod_class,
@@ -784,6 +803,7 @@ static struct omap_hwmod omap3xxx_timer5_hwmod = {
784 .idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT, 803 .idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT,
785 }, 804 },
786 }, 805 },
806 .dev_attr = &capability_alwon_dev_attr,
787 .slaves = omap3xxx_timer5_slaves, 807 .slaves = omap3xxx_timer5_slaves,
788 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer5_slaves), 808 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer5_slaves),
789 .class = &omap3xxx_timer_hwmod_class, 809 .class = &omap3xxx_timer_hwmod_class,
@@ -829,6 +849,7 @@ static struct omap_hwmod omap3xxx_timer6_hwmod = {
829 .idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT, 849 .idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT,
830 }, 850 },
831 }, 851 },
852 .dev_attr = &capability_alwon_dev_attr,
832 .slaves = omap3xxx_timer6_slaves, 853 .slaves = omap3xxx_timer6_slaves,
833 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer6_slaves), 854 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer6_slaves),
834 .class = &omap3xxx_timer_hwmod_class, 855 .class = &omap3xxx_timer_hwmod_class,
@@ -874,6 +895,7 @@ static struct omap_hwmod omap3xxx_timer7_hwmod = {
874 .idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT, 895 .idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT,
875 }, 896 },
876 }, 897 },
898 .dev_attr = &capability_alwon_dev_attr,
877 .slaves = omap3xxx_timer7_slaves, 899 .slaves = omap3xxx_timer7_slaves,
878 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer7_slaves), 900 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer7_slaves),
879 .class = &omap3xxx_timer_hwmod_class, 901 .class = &omap3xxx_timer_hwmod_class,
@@ -919,6 +941,7 @@ static struct omap_hwmod omap3xxx_timer8_hwmod = {
919 .idlest_idle_bit = OMAP3430_ST_GPT8_SHIFT, 941 .idlest_idle_bit = OMAP3430_ST_GPT8_SHIFT,
920 }, 942 },
921 }, 943 },
944 .dev_attr = &capability_pwm_dev_attr,
922 .slaves = omap3xxx_timer8_slaves, 945 .slaves = omap3xxx_timer8_slaves,
923 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer8_slaves), 946 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer8_slaves),
924 .class = &omap3xxx_timer_hwmod_class, 947 .class = &omap3xxx_timer_hwmod_class,
@@ -964,6 +987,7 @@ static struct omap_hwmod omap3xxx_timer9_hwmod = {
964 .idlest_idle_bit = OMAP3430_ST_GPT9_SHIFT, 987 .idlest_idle_bit = OMAP3430_ST_GPT9_SHIFT,
965 }, 988 },
966 }, 989 },
990 .dev_attr = &capability_pwm_dev_attr,
967 .slaves = omap3xxx_timer9_slaves, 991 .slaves = omap3xxx_timer9_slaves,
968 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer9_slaves), 992 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer9_slaves),
969 .class = &omap3xxx_timer_hwmod_class, 993 .class = &omap3xxx_timer_hwmod_class,
@@ -1000,6 +1024,7 @@ static struct omap_hwmod omap3xxx_timer10_hwmod = {
1000 .idlest_idle_bit = OMAP3430_ST_GPT10_SHIFT, 1024 .idlest_idle_bit = OMAP3430_ST_GPT10_SHIFT,
1001 }, 1025 },
1002 }, 1026 },
1027 .dev_attr = &capability_pwm_dev_attr,
1003 .slaves = omap3xxx_timer10_slaves, 1028 .slaves = omap3xxx_timer10_slaves,
1004 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer10_slaves), 1029 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer10_slaves),
1005 .class = &omap3xxx_timer_1ms_hwmod_class, 1030 .class = &omap3xxx_timer_1ms_hwmod_class,
@@ -1036,6 +1061,7 @@ static struct omap_hwmod omap3xxx_timer11_hwmod = {
1036 .idlest_idle_bit = OMAP3430_ST_GPT11_SHIFT, 1061 .idlest_idle_bit = OMAP3430_ST_GPT11_SHIFT,
1037 }, 1062 },
1038 }, 1063 },
1064 .dev_attr = &capability_pwm_dev_attr,
1039 .slaves = omap3xxx_timer11_slaves, 1065 .slaves = omap3xxx_timer11_slaves,
1040 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer11_slaves), 1066 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer11_slaves),
1041 .class = &omap3xxx_timer_hwmod_class, 1067 .class = &omap3xxx_timer_hwmod_class,
@@ -1085,6 +1111,7 @@ static struct omap_hwmod omap3xxx_timer12_hwmod = {
1085 .idlest_idle_bit = OMAP3430_ST_GPT12_SHIFT, 1111 .idlest_idle_bit = OMAP3430_ST_GPT12_SHIFT,
1086 }, 1112 },
1087 }, 1113 },
1114 .dev_attr = &capability_secure_dev_attr,
1088 .slaves = omap3xxx_timer12_slaves, 1115 .slaves = omap3xxx_timer12_slaves,
1089 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer12_slaves), 1116 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer12_slaves),
1090 .class = &omap3xxx_timer_hwmod_class, 1117 .class = &omap3xxx_timer_hwmod_class,
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index caaf40911dd4..393afac9caf6 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -29,6 +29,7 @@
29#include <plat/mcbsp.h> 29#include <plat/mcbsp.h>
30#include <plat/mmc.h> 30#include <plat/mmc.h>
31#include <plat/i2c.h> 31#include <plat/i2c.h>
32#include <plat/dmtimer.h>
32 33
33#include "omap_hwmod_common_data.h" 34#include "omap_hwmod_common_data.h"
34 35
@@ -4201,6 +4202,16 @@ static struct omap_hwmod_class omap44xx_timer_hwmod_class = {
4201 .sysc = &omap44xx_timer_sysc, 4202 .sysc = &omap44xx_timer_sysc,
4202}; 4203};
4203 4204
4205/* always-on timers dev attribute */
4206static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
4207 .timer_capability = OMAP_TIMER_ALWON,
4208};
4209
4210/* pwm timers dev attribute */
4211static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
4212 .timer_capability = OMAP_TIMER_HAS_PWM,
4213};
4214
4204/* timer1 */ 4215/* timer1 */
4205static struct omap_hwmod omap44xx_timer1_hwmod; 4216static struct omap_hwmod omap44xx_timer1_hwmod;
4206static struct omap_hwmod_irq_info omap44xx_timer1_irqs[] = { 4217static struct omap_hwmod_irq_info omap44xx_timer1_irqs[] = {
@@ -4244,6 +4255,7 @@ static struct omap_hwmod omap44xx_timer1_hwmod = {
4244 .modulemode = MODULEMODE_SWCTRL, 4255 .modulemode = MODULEMODE_SWCTRL,
4245 }, 4256 },
4246 }, 4257 },
4258 .dev_attr = &capability_alwon_dev_attr,
4247 .slaves = omap44xx_timer1_slaves, 4259 .slaves = omap44xx_timer1_slaves,
4248 .slaves_cnt = ARRAY_SIZE(omap44xx_timer1_slaves), 4260 .slaves_cnt = ARRAY_SIZE(omap44xx_timer1_slaves),
4249}; 4261};
@@ -4291,6 +4303,7 @@ static struct omap_hwmod omap44xx_timer2_hwmod = {
4291 .modulemode = MODULEMODE_SWCTRL, 4303 .modulemode = MODULEMODE_SWCTRL,
4292 }, 4304 },
4293 }, 4305 },
4306 .dev_attr = &capability_alwon_dev_attr,
4294 .slaves = omap44xx_timer2_slaves, 4307 .slaves = omap44xx_timer2_slaves,
4295 .slaves_cnt = ARRAY_SIZE(omap44xx_timer2_slaves), 4308 .slaves_cnt = ARRAY_SIZE(omap44xx_timer2_slaves),
4296}; 4309};
@@ -4338,6 +4351,7 @@ static struct omap_hwmod omap44xx_timer3_hwmod = {
4338 .modulemode = MODULEMODE_SWCTRL, 4351 .modulemode = MODULEMODE_SWCTRL,
4339 }, 4352 },
4340 }, 4353 },
4354 .dev_attr = &capability_alwon_dev_attr,
4341 .slaves = omap44xx_timer3_slaves, 4355 .slaves = omap44xx_timer3_slaves,
4342 .slaves_cnt = ARRAY_SIZE(omap44xx_timer3_slaves), 4356 .slaves_cnt = ARRAY_SIZE(omap44xx_timer3_slaves),
4343}; 4357};
@@ -4385,6 +4399,7 @@ static struct omap_hwmod omap44xx_timer4_hwmod = {
4385 .modulemode = MODULEMODE_SWCTRL, 4399 .modulemode = MODULEMODE_SWCTRL,
4386 }, 4400 },
4387 }, 4401 },
4402 .dev_attr = &capability_alwon_dev_attr,
4388 .slaves = omap44xx_timer4_slaves, 4403 .slaves = omap44xx_timer4_slaves,
4389 .slaves_cnt = ARRAY_SIZE(omap44xx_timer4_slaves), 4404 .slaves_cnt = ARRAY_SIZE(omap44xx_timer4_slaves),
4390}; 4405};
@@ -4451,6 +4466,7 @@ static struct omap_hwmod omap44xx_timer5_hwmod = {
4451 .modulemode = MODULEMODE_SWCTRL, 4466 .modulemode = MODULEMODE_SWCTRL,
4452 }, 4467 },
4453 }, 4468 },
4469 .dev_attr = &capability_alwon_dev_attr,
4454 .slaves = omap44xx_timer5_slaves, 4470 .slaves = omap44xx_timer5_slaves,
4455 .slaves_cnt = ARRAY_SIZE(omap44xx_timer5_slaves), 4471 .slaves_cnt = ARRAY_SIZE(omap44xx_timer5_slaves),
4456}; 4472};
@@ -4518,6 +4534,7 @@ static struct omap_hwmod omap44xx_timer6_hwmod = {
4518 .modulemode = MODULEMODE_SWCTRL, 4534 .modulemode = MODULEMODE_SWCTRL,
4519 }, 4535 },
4520 }, 4536 },
4537 .dev_attr = &capability_alwon_dev_attr,
4521 .slaves = omap44xx_timer6_slaves, 4538 .slaves = omap44xx_timer6_slaves,
4522 .slaves_cnt = ARRAY_SIZE(omap44xx_timer6_slaves), 4539 .slaves_cnt = ARRAY_SIZE(omap44xx_timer6_slaves),
4523}; 4540};
@@ -4584,6 +4601,7 @@ static struct omap_hwmod omap44xx_timer7_hwmod = {
4584 .modulemode = MODULEMODE_SWCTRL, 4601 .modulemode = MODULEMODE_SWCTRL,
4585 }, 4602 },
4586 }, 4603 },
4604 .dev_attr = &capability_alwon_dev_attr,
4587 .slaves = omap44xx_timer7_slaves, 4605 .slaves = omap44xx_timer7_slaves,
4588 .slaves_cnt = ARRAY_SIZE(omap44xx_timer7_slaves), 4606 .slaves_cnt = ARRAY_SIZE(omap44xx_timer7_slaves),
4589}; 4607};
@@ -4650,6 +4668,7 @@ static struct omap_hwmod omap44xx_timer8_hwmod = {
4650 .modulemode = MODULEMODE_SWCTRL, 4668 .modulemode = MODULEMODE_SWCTRL,
4651 }, 4669 },
4652 }, 4670 },
4671 .dev_attr = &capability_pwm_dev_attr,
4653 .slaves = omap44xx_timer8_slaves, 4672 .slaves = omap44xx_timer8_slaves,
4654 .slaves_cnt = ARRAY_SIZE(omap44xx_timer8_slaves), 4673 .slaves_cnt = ARRAY_SIZE(omap44xx_timer8_slaves),
4655}; 4674};
@@ -4697,6 +4716,7 @@ static struct omap_hwmod omap44xx_timer9_hwmod = {
4697 .modulemode = MODULEMODE_SWCTRL, 4716 .modulemode = MODULEMODE_SWCTRL,
4698 }, 4717 },
4699 }, 4718 },
4719 .dev_attr = &capability_pwm_dev_attr,
4700 .slaves = omap44xx_timer9_slaves, 4720 .slaves = omap44xx_timer9_slaves,
4701 .slaves_cnt = ARRAY_SIZE(omap44xx_timer9_slaves), 4721 .slaves_cnt = ARRAY_SIZE(omap44xx_timer9_slaves),
4702}; 4722};
@@ -4744,6 +4764,7 @@ static struct omap_hwmod omap44xx_timer10_hwmod = {
4744 .modulemode = MODULEMODE_SWCTRL, 4764 .modulemode = MODULEMODE_SWCTRL,
4745 }, 4765 },
4746 }, 4766 },
4767 .dev_attr = &capability_pwm_dev_attr,
4747 .slaves = omap44xx_timer10_slaves, 4768 .slaves = omap44xx_timer10_slaves,
4748 .slaves_cnt = ARRAY_SIZE(omap44xx_timer10_slaves), 4769 .slaves_cnt = ARRAY_SIZE(omap44xx_timer10_slaves),
4749}; 4770};
@@ -4791,6 +4812,7 @@ static struct omap_hwmod omap44xx_timer11_hwmod = {
4791 .modulemode = MODULEMODE_SWCTRL, 4812 .modulemode = MODULEMODE_SWCTRL,
4792 }, 4813 },
4793 }, 4814 },
4815 .dev_attr = &capability_pwm_dev_attr,
4794 .slaves = omap44xx_timer11_slaves, 4816 .slaves = omap44xx_timer11_slaves,
4795 .slaves_cnt = ARRAY_SIZE(omap44xx_timer11_slaves), 4817 .slaves_cnt = ARRAY_SIZE(omap44xx_timer11_slaves),
4796}; 4818};
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 69466f388417..b2829ee0c4e4 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -35,6 +35,7 @@
35#include <linux/irq.h> 35#include <linux/irq.h>
36#include <linux/clocksource.h> 36#include <linux/clocksource.h>
37#include <linux/clockchips.h> 37#include <linux/clockchips.h>
38#include <linux/slab.h>
38 39
39#include <asm/mach/time.h> 40#include <asm/mach/time.h>
40#include <plat/dmtimer.h> 41#include <plat/dmtimer.h>
@@ -42,6 +43,7 @@
42#include <asm/sched_clock.h> 43#include <asm/sched_clock.h>
43#include <plat/common.h> 44#include <plat/common.h>
44#include <plat/omap_hwmod.h> 45#include <plat/omap_hwmod.h>
46#include <plat/omap_device.h>
45 47
46/* Parent clocks, eventually these will come from the clock framework */ 48/* Parent clocks, eventually these will come from the clock framework */
47 49
@@ -342,3 +344,137 @@ static void __init omap4_timer_init(void)
342} 344}
343OMAP_SYS_TIMER(4) 345OMAP_SYS_TIMER(4)
344#endif 346#endif
347
348/**
349 * omap2_dm_timer_set_src - change the timer input clock source
350 * @pdev: timer platform device pointer
351 * @source: array index of parent clock source
352 */
353static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
354{
355 int ret;
356 struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
357 struct clk *fclk, *parent;
358 char *parent_name = NULL;
359
360 fclk = clk_get(&pdev->dev, "fck");
361 if (IS_ERR_OR_NULL(fclk)) {
362 dev_err(&pdev->dev, "%s: %d: clk_get() FAILED\n",
363 __func__, __LINE__);
364 return -EINVAL;
365 }
366
367 switch (source) {
368 case OMAP_TIMER_SRC_SYS_CLK:
369 parent_name = "sys_ck";
370 break;
371
372 case OMAP_TIMER_SRC_32_KHZ:
373 parent_name = "32k_ck";
374 break;
375
376 case OMAP_TIMER_SRC_EXT_CLK:
377 if (pdata->timer_ip_version == OMAP_TIMER_IP_VERSION_1) {
378 parent_name = "alt_ck";
379 break;
380 }
381 dev_err(&pdev->dev, "%s: %d: invalid clk src.\n",
382 __func__, __LINE__);
383 clk_put(fclk);
384 return -EINVAL;
385 }
386
387 parent = clk_get(&pdev->dev, parent_name);
388 if (IS_ERR_OR_NULL(parent)) {
389 dev_err(&pdev->dev, "%s: %d: clk_get() %s FAILED\n",
390 __func__, __LINE__, parent_name);
391 clk_put(fclk);
392 return -EINVAL;
393 }
394
395 ret = clk_set_parent(fclk, parent);
396 if (IS_ERR_VALUE(ret)) {
397 dev_err(&pdev->dev, "%s: clk_set_parent() to %s FAILED\n",
398 __func__, parent_name);
399 ret = -EINVAL;
400 }
401
402 clk_put(parent);
403 clk_put(fclk);
404
405 return ret;
406}
407
408struct omap_device_pm_latency omap2_dmtimer_latency[] = {
409 {
410 .deactivate_func = omap_device_idle_hwmods,
411 .activate_func = omap_device_enable_hwmods,
412 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
413 },
414};
415
416/**
417 * omap_timer_init - build and register timer device with an
418 * associated timer hwmod
419 * @oh: timer hwmod pointer to be used to build timer device
420 * @user: parameter that can be passed from calling hwmod API
421 *
422 * Called by omap_hwmod_for_each_by_class to register each of the timer
423 * devices present in the system. The number of timer devices is known
424 * by parsing through the hwmod database for a given class name. At the
425 * end of function call memory is allocated for timer device and it is
426 * registered to the framework ready to be proved by the driver.
427 */
428static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
429{
430 int id;
431 int ret = 0;
432 char *name = "omap_timer";
433 struct dmtimer_platform_data *pdata;
434 struct omap_device *od;
435 struct omap_timer_capability_dev_attr *timer_dev_attr;
436
437 pr_debug("%s: %s\n", __func__, oh->name);
438
439 /* on secure device, do not register secure timer */
440 timer_dev_attr = oh->dev_attr;
441 if (omap_type() != OMAP2_DEVICE_TYPE_GP && timer_dev_attr)
442 if (timer_dev_attr->timer_capability == OMAP_TIMER_SECURE)
443 return ret;
444
445 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
446 if (!pdata) {
447 pr_err("%s: No memory for [%s]\n", __func__, oh->name);
448 return -ENOMEM;
449 }
450
451 /*
452 * Extract the IDs from name field in hwmod database
453 * and use the same for constructing ids' for the
454 * timer devices. In a way, we are avoiding usage of
455 * static variable witin the function to do the same.
456 * CAUTION: We have to be careful and make sure the
457 * name in hwmod database does not change in which case
458 * we might either make corresponding change here or
459 * switch back static variable mechanism.
460 */
461 sscanf(oh->name, "timer%2d", &id);
462
463 pdata->set_timer_src = omap2_dm_timer_set_src;
464 pdata->timer_ip_version = oh->class->rev;
465
466 od = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
467 omap2_dmtimer_latency,
468 ARRAY_SIZE(omap2_dmtimer_latency),
469 0);
470
471 if (IS_ERR(od)) {
472 pr_err("%s: Can't build omap_device for %s: %s.\n",
473 __func__, name, oh->name);
474 ret = -EINVAL;
475 }
476
477 kfree(pdata);
478
479 return ret;
480}
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 1751751862da..9ed08df9d026 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/dmtimer.h 2 * arch/arm/plat-omap/include/plat/dmtimer.h
3 * 3 *
4 * OMAP Dual-Mode Timers 4 * OMAP Dual-Mode Timers
5 * 5 *
@@ -60,6 +60,16 @@
60 * in OMAP4 can be distinguished. 60 * in OMAP4 can be distinguished.
61 */ 61 */
62#define OMAP_TIMER_IP_VERSION_1 0x1 62#define OMAP_TIMER_IP_VERSION_1 0x1
63
64/* timer capabilities used in hwmod database */
65#define OMAP_TIMER_SECURE 0x80000000
66#define OMAP_TIMER_ALWON 0x40000000
67#define OMAP_TIMER_HAS_PWM 0x20000000
68
69struct omap_timer_capability_dev_attr {
70 u32 timer_capability;
71};
72
63struct omap_dm_timer; 73struct omap_dm_timer;
64struct clk; 74struct clk;
65 75