Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: dts: Configure system timers for omap5 and dra7

We can now init system timers using the dmtimer and 32k counter
based on only devicetree data and drivers/clocksource timers.
Let's configure the clocksource and clockevent, and drop the old
unused platform data.

As we're just dropping platform data, and the early platform data
init is based on the custom ti,hwmods property, we want to drop
both the platform data and ti,hwmods property in a single patch.

Since the dmtimer can use both 32k clock and system clock as the
source, let's also configure the SoC specific default values. The
board specific dts files can reconfigure these with assigned-clocks
and assigned-clock-parents as needed.

Note that similar to omap_init_time_of(), we now need to call
omap_clk_init() also from omap5_realtime_timer_init().

Cc: devicetree@vger.kernel.org
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Keerthy <j-keerthy@ti.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>

+23 -290
+1 -6
arch/arm/boot/dts/dra7-l4.dtsi
··· 1143 1143 1144 1144 target-module@32000 { /* 0x48032000, ap 5 3e.0 */ 1145 1145 compatible = "ti,sysc-omap4-timer", "ti,sysc"; 1146 - ti,hwmods = "timer2"; 1147 1146 reg = <0x32000 0x4>, 1148 1147 <0x32010 0x4>; 1149 1148 reg-names = "rev", "sysc"; ··· 1170 1171 1171 1172 target-module@34000 { /* 0x48034000, ap 7 46.0 */ 1172 1173 compatible = "ti,sysc-omap4-timer", "ti,sysc"; 1173 - ti,hwmods = "timer3"; 1174 1174 reg = <0x34000 0x4>, 1175 1175 <0x34010 0x4>; 1176 1176 reg-names = "rev", "sysc"; ··· 1197 1199 1198 1200 target-module@36000 { /* 0x48036000, ap 9 4e.0 */ 1199 1201 compatible = "ti,sysc-omap4-timer", "ti,sysc"; 1200 - ti,hwmods = "timer4"; 1201 1202 reg = <0x36000 0x4>, 1202 1203 <0x36010 0x4>; 1203 1204 reg-names = "rev", "sysc"; ··· 4292 4295 4293 4296 target-module@4000 { /* 0x4ae04000, ap 15 40.0 */ 4294 4297 compatible = "ti,sysc-omap2", "ti,sysc"; 4295 - ti,hwmods = "counter_32k"; 4296 4298 reg = <0x4000 0x4>, 4297 4299 <0x4010 0x4>; 4298 4300 reg-names = "rev", "sysc"; ··· 4426 4430 }; 4427 4431 }; 4428 4432 4429 - target-module@8000 { /* 0x4ae18000, ap 9 30.0 */ 4433 + timer1_target: target-module@8000 { /* 0x4ae18000, ap 9 30.0 */ 4430 4434 compatible = "ti,sysc-omap4-timer", "ti,sysc"; 4431 - ti,hwmods = "timer1"; 4432 4435 reg = <0x8000 0x4>, 4433 4436 <0x8010 0x4>; 4434 4437 reg-names = "rev", "sysc";
+10
arch/arm/boot/dts/dra7.dtsi
··· 1044 1044 reg = <0x1c00 0x60>; 1045 1045 }; 1046 1046 }; 1047 + 1048 + /* Preferred always-on timer for clockevent */ 1049 + &timer1_target { 1050 + ti,no-reset-on-init; 1051 + ti,no-idle; 1052 + timer@0 { 1053 + assigned-clocks = <&wkupaon_clkctrl DRA7_TIMER1_CLKCTRL 24>; 1054 + assigned-clock-parents = <&sys_32k_ck>; 1055 + }; 1056 + };
+1 -3
arch/arm/boot/dts/omap5-l4.dtsi
··· 2150 2150 2151 2151 target-module@4000 { /* 0x4ae04000, ap 17 20.0 */ 2152 2152 compatible = "ti,sysc-omap2", "ti,sysc"; 2153 - ti,hwmods = "counter_32k"; 2154 2153 reg = <0x4000 0x4>, 2155 2154 <0x4010 0x4>; 2156 2155 reg-names = "rev", "sysc"; ··· 2335 2336 }; 2336 2337 }; 2337 2338 2338 - target-module@8000 { /* 0x4ae18000, ap 9 18.0 */ 2339 + timer1_target: target-module@8000 { /* 0x4ae18000, ap 9 18.0 */ 2339 2340 compatible = "ti,sysc-omap4-timer", "ti,sysc"; 2340 - ti,hwmods = "timer1"; 2341 2341 reg = <0x8000 0x4>, 2342 2342 <0x8010 0x4>; 2343 2343 reg-names = "rev", "sysc";
+10
arch/arm/boot/dts/omap5.dtsi
··· 581 581 #reset-cells = <1>; 582 582 }; 583 583 }; 584 + 585 + /* Preferred always-on timer for clockevent */ 586 + &timer1_target { 587 + ti,no-reset-on-init; 588 + ti,no-idle; 589 + timer@0 { 590 + assigned-clocks = <&wkupaon_clkctrl OMAP5_TIMER1_CLKCTRL 24>; 591 + assigned-clock-parents = <&sys_32k_ck>; 592 + }; 593 + };
-89
arch/arm/mach-omap2/omap_hwmod_54xx_data.c
··· 194 194 }; 195 195 196 196 /* 197 - * 'counter' class 198 - * 32-bit ordinary counter, clocked by the falling edge of the 32 khz clock 199 - */ 200 - 201 - static struct omap_hwmod_class_sysconfig omap54xx_counter_sysc = { 202 - .rev_offs = 0x0000, 203 - .sysc_offs = 0x0010, 204 - .sysc_flags = SYSC_HAS_SIDLEMODE, 205 - .idlemodes = (SIDLE_FORCE | SIDLE_NO), 206 - .sysc_fields = &omap_hwmod_sysc_type1, 207 - }; 208 - 209 - static struct omap_hwmod_class omap54xx_counter_hwmod_class = { 210 - .name = "counter", 211 - .sysc = &omap54xx_counter_sysc, 212 - }; 213 - 214 - /* counter_32k */ 215 - static struct omap_hwmod omap54xx_counter_32k_hwmod = { 216 - .name = "counter_32k", 217 - .class = &omap54xx_counter_hwmod_class, 218 - .clkdm_name = "wkupaon_clkdm", 219 - .flags = HWMOD_SWSUP_SIDLE, 220 - .main_clk = "wkupaon_iclk_mux", 221 - .prcm = { 222 - .omap4 = { 223 - .clkctrl_offs = OMAP54XX_CM_WKUPAON_COUNTER_32K_CLKCTRL_OFFSET, 224 - .context_offs = OMAP54XX_RM_WKUPAON_COUNTER_32K_CONTEXT_OFFSET, 225 - }, 226 - }, 227 - }; 228 - 229 - /* 230 197 * 'emif' class 231 198 * external memory interface no1 (wrapper) 232 199 */ ··· 262 295 .omap4 = { 263 296 .clkctrl_offs = OMAP54XX_CM_MPU_MPU_CLKCTRL_OFFSET, 264 297 .context_offs = OMAP54XX_RM_MPU_MPU_CONTEXT_OFFSET, 265 - }, 266 - }, 267 - }; 268 - 269 - 270 - /* 271 - * 'timer' class 272 - * general purpose timer module with accurate 1ms tick 273 - * This class contains several variants: ['timer_1ms', 'timer'] 274 - */ 275 - 276 - static struct omap_hwmod_class_sysconfig omap54xx_timer_1ms_sysc = { 277 - .rev_offs = 0x0000, 278 - .sysc_offs = 0x0010, 279 - .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_RESET_STATUS | 280 - SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), 281 - .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 282 - SIDLE_SMART_WKUP), 283 - .sysc_fields = &omap_hwmod_sysc_type2, 284 - }; 285 - 286 - static struct omap_hwmod_class omap54xx_timer_1ms_hwmod_class = { 287 - .name = "timer", 288 - .sysc = &omap54xx_timer_1ms_sysc, 289 - }; 290 - 291 - /* timer1 */ 292 - static struct omap_hwmod omap54xx_timer1_hwmod = { 293 - .name = "timer1", 294 - .class = &omap54xx_timer_1ms_hwmod_class, 295 - .clkdm_name = "wkupaon_clkdm", 296 - .main_clk = "timer1_gfclk_mux", 297 - .flags = HWMOD_SET_DEFAULT_CLOCKACT, 298 - .prcm = { 299 - .omap4 = { 300 - .clkctrl_offs = OMAP54XX_CM_WKUPAON_TIMER1_CLKCTRL_OFFSET, 301 - .context_offs = OMAP54XX_RM_WKUPAON_TIMER1_CONTEXT_OFFSET, 302 - .modulemode = MODULEMODE_SWCTRL, 303 298 }, 304 299 }, 305 300 }; ··· 595 666 .user = OCP_USER_MPU | OCP_USER_SDMA, 596 667 }; 597 668 598 - /* l4_wkup -> counter_32k */ 599 - static struct omap_hwmod_ocp_if omap54xx_l4_wkup__counter_32k = { 600 - .master = &omap54xx_l4_wkup_hwmod, 601 - .slave = &omap54xx_counter_32k_hwmod, 602 - .clk = "wkupaon_iclk_mux", 603 - .user = OCP_USER_MPU | OCP_USER_SDMA, 604 - }; 605 - 606 669 /* mpu -> emif1 */ 607 670 static struct omap_hwmod_ocp_if omap54xx_mpu__emif1 = { 608 671 .master = &omap54xx_mpu_hwmod, ··· 616 695 .master = &omap54xx_l4_cfg_hwmod, 617 696 .slave = &omap54xx_mpu_hwmod, 618 697 .clk = "l4_root_clk_div", 619 - .user = OCP_USER_MPU | OCP_USER_SDMA, 620 - }; 621 - 622 - /* l4_wkup -> timer1 */ 623 - static struct omap_hwmod_ocp_if omap54xx_l4_wkup__timer1 = { 624 - .master = &omap54xx_l4_wkup_hwmod, 625 - .slave = &omap54xx_timer1_hwmod, 626 - .clk = "wkupaon_iclk_mux", 627 698 .user = OCP_USER_MPU | OCP_USER_SDMA, 628 699 }; 629 700 ··· 660 747 &omap54xx_l3_main_2__l4_per, 661 748 &omap54xx_l3_main_1__l4_wkup, 662 749 &omap54xx_mpu__mpu_private, 663 - &omap54xx_l4_wkup__counter_32k, 664 750 &omap54xx_mpu__emif1, 665 751 &omap54xx_mpu__emif2, 666 752 &omap54xx_l4_cfg__mpu, 667 - &omap54xx_l4_wkup__timer1, 668 753 &omap54xx_l4_cfg__usb_host_hs, 669 754 &omap54xx_l4_cfg__usb_tll_hs, 670 755 &omap54xx_l4_cfg__usb_otg_ss,
-176
arch/arm/mach-omap2/omap_hwmod_7xx_data.c
··· 222 222 }; 223 223 224 224 /* 225 - * 'counter' class 226 - * 227 - */ 228 - 229 - static struct omap_hwmod_class_sysconfig dra7xx_counter_sysc = { 230 - .rev_offs = 0x0000, 231 - .sysc_offs = 0x0010, 232 - .sysc_flags = SYSC_HAS_SIDLEMODE, 233 - .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 234 - SIDLE_SMART_WKUP), 235 - .sysc_fields = &omap_hwmod_sysc_type1, 236 - }; 237 - 238 - static struct omap_hwmod_class dra7xx_counter_hwmod_class = { 239 - .name = "counter", 240 - .sysc = &dra7xx_counter_sysc, 241 - }; 242 - 243 - /* counter_32k */ 244 - static struct omap_hwmod dra7xx_counter_32k_hwmod = { 245 - .name = "counter_32k", 246 - .class = &dra7xx_counter_hwmod_class, 247 - .clkdm_name = "wkupaon_clkdm", 248 - .flags = HWMOD_SWSUP_SIDLE, 249 - .main_clk = "wkupaon_iclk_mux", 250 - .prcm = { 251 - .omap4 = { 252 - .clkctrl_offs = DRA7XX_CM_WKUPAON_COUNTER_32K_CLKCTRL_OFFSET, 253 - .context_offs = DRA7XX_RM_WKUPAON_COUNTER_32K_CONTEXT_OFFSET, 254 - }, 255 - }, 256 - }; 257 - 258 - /* 259 225 * 'ctrl_module' class 260 226 * 261 227 */ ··· 492 526 }; 493 527 494 528 /* 495 - * 'timer' class 496 - * 497 - * This class contains several variants: ['timer_1ms', 'timer_secure', 498 - * 'timer'] 499 - */ 500 - 501 - static struct omap_hwmod_class_sysconfig dra7xx_timer_1ms_sysc = { 502 - .rev_offs = 0x0000, 503 - .sysc_offs = 0x0010, 504 - .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_RESET_STATUS | 505 - SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), 506 - .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 507 - SIDLE_SMART_WKUP), 508 - .sysc_fields = &omap_hwmod_sysc_type2, 509 - }; 510 - 511 - static struct omap_hwmod_class dra7xx_timer_1ms_hwmod_class = { 512 - .name = "timer", 513 - .sysc = &dra7xx_timer_1ms_sysc, 514 - }; 515 - 516 - static struct omap_hwmod_class_sysconfig dra7xx_timer_sysc = { 517 - .rev_offs = 0x0000, 518 - .sysc_offs = 0x0010, 519 - .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_RESET_STATUS | 520 - SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), 521 - .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 522 - SIDLE_SMART_WKUP), 523 - .sysc_fields = &omap_hwmod_sysc_type2, 524 - }; 525 - 526 - static struct omap_hwmod_class dra7xx_timer_hwmod_class = { 527 - .name = "timer", 528 - .sysc = &dra7xx_timer_sysc, 529 - }; 530 - 531 - /* timer1 */ 532 - static struct omap_hwmod dra7xx_timer1_hwmod = { 533 - .name = "timer1", 534 - .class = &dra7xx_timer_1ms_hwmod_class, 535 - .clkdm_name = "wkupaon_clkdm", 536 - .main_clk = "timer1_gfclk_mux", 537 - .prcm = { 538 - .omap4 = { 539 - .clkctrl_offs = DRA7XX_CM_WKUPAON_TIMER1_CLKCTRL_OFFSET, 540 - .context_offs = DRA7XX_RM_WKUPAON_TIMER1_CONTEXT_OFFSET, 541 - .modulemode = MODULEMODE_SWCTRL, 542 - }, 543 - }, 544 - }; 545 - 546 - /* timer2 */ 547 - static struct omap_hwmod dra7xx_timer2_hwmod = { 548 - .name = "timer2", 549 - .class = &dra7xx_timer_1ms_hwmod_class, 550 - .clkdm_name = "l4per_clkdm", 551 - .main_clk = "timer2_gfclk_mux", 552 - .prcm = { 553 - .omap4 = { 554 - .clkctrl_offs = DRA7XX_CM_L4PER_TIMER2_CLKCTRL_OFFSET, 555 - .context_offs = DRA7XX_RM_L4PER_TIMER2_CONTEXT_OFFSET, 556 - .modulemode = MODULEMODE_SWCTRL, 557 - }, 558 - }, 559 - }; 560 - 561 - /* timer3 */ 562 - static struct omap_hwmod dra7xx_timer3_hwmod = { 563 - .name = "timer3", 564 - .class = &dra7xx_timer_hwmod_class, 565 - .clkdm_name = "l4per_clkdm", 566 - .main_clk = "timer3_gfclk_mux", 567 - .prcm = { 568 - .omap4 = { 569 - .clkctrl_offs = DRA7XX_CM_L4PER_TIMER3_CLKCTRL_OFFSET, 570 - .context_offs = DRA7XX_RM_L4PER_TIMER3_CONTEXT_OFFSET, 571 - .modulemode = MODULEMODE_SWCTRL, 572 - }, 573 - }, 574 - }; 575 - 576 - /* timer4 */ 577 - static struct omap_hwmod dra7xx_timer4_hwmod = { 578 - .name = "timer4", 579 - .class = &dra7xx_timer_hwmod_class, 580 - .clkdm_name = "l4per_clkdm", 581 - .main_clk = "timer4_gfclk_mux", 582 - .prcm = { 583 - .omap4 = { 584 - .clkctrl_offs = DRA7XX_CM_L4PER_TIMER4_CLKCTRL_OFFSET, 585 - .context_offs = DRA7XX_RM_L4PER_TIMER4_CONTEXT_OFFSET, 586 - .modulemode = MODULEMODE_SWCTRL, 587 - }, 588 - }, 589 - }; 590 - 591 - /* 592 529 * 'usb_otg_ss' class 593 530 * 594 531 */ ··· 733 864 .user = OCP_USER_MPU | OCP_USER_SDMA, 734 865 }; 735 866 736 - /* l4_wkup -> counter_32k */ 737 - static struct omap_hwmod_ocp_if dra7xx_l4_wkup__counter_32k = { 738 - .master = &dra7xx_l4_wkup_hwmod, 739 - .slave = &dra7xx_counter_32k_hwmod, 740 - .clk = "wkupaon_iclk_mux", 741 - .user = OCP_USER_MPU | OCP_USER_SDMA, 742 - }; 743 - 744 867 /* l4_wkup -> ctrl_module_wkup */ 745 868 static struct omap_hwmod_ocp_if dra7xx_l4_wkup__ctrl_module_wkup = { 746 869 .master = &dra7xx_l4_wkup_hwmod, ··· 809 948 static struct omap_hwmod_ocp_if dra7xx_l4_cfg__sata = { 810 949 .master = &dra7xx_l4_cfg_hwmod, 811 950 .slave = &dra7xx_sata_hwmod, 812 - .clk = "l3_iclk_div", 813 - .user = OCP_USER_MPU | OCP_USER_SDMA, 814 - }; 815 - 816 - /* l4_wkup -> timer1 */ 817 - static struct omap_hwmod_ocp_if dra7xx_l4_wkup__timer1 = { 818 - .master = &dra7xx_l4_wkup_hwmod, 819 - .slave = &dra7xx_timer1_hwmod, 820 - .clk = "wkupaon_iclk_mux", 821 - .user = OCP_USER_MPU | OCP_USER_SDMA, 822 - }; 823 - 824 - /* l4_per1 -> timer2 */ 825 - static struct omap_hwmod_ocp_if dra7xx_l4_per1__timer2 = { 826 - .master = &dra7xx_l4_per1_hwmod, 827 - .slave = &dra7xx_timer2_hwmod, 828 - .clk = "l3_iclk_div", 829 - .user = OCP_USER_MPU | OCP_USER_SDMA, 830 - }; 831 - 832 - /* l4_per1 -> timer3 */ 833 - static struct omap_hwmod_ocp_if dra7xx_l4_per1__timer3 = { 834 - .master = &dra7xx_l4_per1_hwmod, 835 - .slave = &dra7xx_timer3_hwmod, 836 - .clk = "l3_iclk_div", 837 - .user = OCP_USER_MPU | OCP_USER_SDMA, 838 - }; 839 - 840 - /* l4_per1 -> timer4 */ 841 - static struct omap_hwmod_ocp_if dra7xx_l4_per1__timer4 = { 842 - .master = &dra7xx_l4_per1_hwmod, 843 - .slave = &dra7xx_timer4_hwmod, 844 951 .clk = "l3_iclk_div", 845 952 .user = OCP_USER_MPU | OCP_USER_SDMA, 846 953 }; ··· 891 1062 &dra7xx_l3_main_1__l4_wkup, 892 1063 &dra7xx_l4_per2__atl, 893 1064 &dra7xx_l3_main_1__bb2d, 894 - &dra7xx_l4_wkup__counter_32k, 895 1065 &dra7xx_l4_wkup__ctrl_module_wkup, 896 1066 &dra7xx_l3_main_1__gpmc, 897 1067 &dra7xx_l4_cfg__mpu, ··· 900 1072 &dra7xx_l4_cfg__pciess2, 901 1073 &dra7xx_l3_main_1__qspi, 902 1074 &dra7xx_l4_cfg__sata, 903 - &dra7xx_l4_wkup__timer1, 904 - &dra7xx_l4_per1__timer2, 905 - &dra7xx_l4_per1__timer3, 906 - &dra7xx_l4_per1__timer4, 907 1075 &dra7xx_l4_per3__usb_otg_ss1, 908 1076 &dra7xx_l4_per3__usb_otg_ss2, 909 1077 &dra7xx_l4_per3__usb_otg_ss3,
+1 -16
arch/arm/mach-omap2/timer.c
··· 576 576 } 577 577 #endif 578 578 579 - #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ 580 - defined(CONFIG_SOC_DRA7XX) 581 - static void __init omap4_sync32k_timer_init(void) 582 - { 583 - __omap_sync32k_timer_init(1, "timer_32k_ck", "ti,timer-alwon", 584 - 0, NULL, NULL, false); 585 - } 586 - 587 - void __init omap4_local_timer_init(void) 588 - { 589 - omap4_sync32k_timer_init(); 590 - timer_probe(); 591 - } 592 - #endif 593 - 594 579 #if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX) 595 580 596 581 /* ··· 693 708 694 709 void __init omap5_realtime_timer_init(void) 695 710 { 696 - omap4_sync32k_timer_init(); 711 + omap_clk_init(); 697 712 realtime_counter_init(); 698 713 699 714 timer_probe();