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 ti81xx

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 for ti81xx, also timer1 is of type 2 unlike on am335x
where timer1 is type1 while the rest of the timers are type 2.

Cc: devicetree@vger.kernel.org
Cc: Brian Hutchinson <b.hutchman@gmail.com>
Cc: Graeme Smecher <gsmecher@threespeedlogic.com>
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>

+130 -100
+63 -11
arch/arm/boot/dts/dm814x.dtsi
··· 308 308 ti,hwmods = "mcspi4"; 309 309 }; 310 310 311 - timer1: timer@2e000 { 312 - compatible = "ti,dm814-timer"; 313 - reg = <0x2e000 0x2000>; 314 - interrupts = <67>; 315 - ti,hwmods = "timer1"; 316 - ti,timer-alwon; 311 + timer1_target: target-module@2e000 { 312 + compatible = "ti,sysc-omap4-timer", "ti,sysc"; 313 + reg = <0x2e000 0x4>, 314 + <0x2e010 0x4>; 315 + reg-names = "rev", "sysc"; 316 + ti,sysc-mask = <SYSC_OMAP4_SOFTRESET>; 317 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 318 + <SYSC_IDLE_NO>, 319 + <SYSC_IDLE_SMART>, 320 + <SYSC_IDLE_SMART_WKUP>; 317 321 clocks = <&timer1_fck>; 318 322 clock-names = "fck"; 323 + #address-cells = <1>; 324 + #size-cells = <1>; 325 + ranges = <0x0 0x2e000 0x1000>; 326 + 327 + timer1: timer@0 { 328 + compatible = "ti,am335x-timer-1ms"; 329 + reg = <0x0 0x400>; 330 + interrupts = <67>; 331 + ti,timer-alwon; 332 + clocks = <&timer1_fck>; 333 + clock-names = "fck"; 334 + }; 319 335 }; 320 336 321 337 uart1: uart@20000 { ··· 364 348 dma-names = "tx", "rx"; 365 349 }; 366 350 367 - timer2: timer@40000 { 368 - compatible = "ti,dm814-timer"; 369 - reg = <0x40000 0x2000>; 370 - interrupts = <68>; 371 - ti,hwmods = "timer2"; 351 + timer2_target: target-module@40000 { 352 + compatible = "ti,sysc-omap4-timer", "ti,sysc"; 353 + reg = <0x40000 0x4>, 354 + <0x40010 0x4>; 355 + reg-names = "rev", "sysc"; 356 + ti,sysc-mask = <SYSC_OMAP4_SOFTRESET>; 357 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 358 + <SYSC_IDLE_NO>, 359 + <SYSC_IDLE_SMART>, 360 + <SYSC_IDLE_SMART_WKUP>; 372 361 clocks = <&timer2_fck>; 373 362 clock-names = "fck"; 363 + #address-cells = <1>; 364 + #size-cells = <1>; 365 + ranges = <0x0 0x40000 0x1000>; 366 + 367 + timer2: timer@0 { 368 + compatible = "ti,dm814-timer"; 369 + reg = <0 0x1000>; 370 + interrupts = <68>; 371 + clocks = <&timer2_fck>; 372 + clock-names = "fck"; 373 + }; 374 374 }; 375 375 376 376 timer3: timer@42000 { ··· 767 735 }; 768 736 769 737 #include "dm814x-clocks.dtsi" 738 + 739 + /* Preferred always-on timer for clocksource */ 740 + &timer1_target { 741 + ti,no-reset-on-init; 742 + ti,no-idle; 743 + timer@0 { 744 + assigned-clocks = <&timer1_fck>; 745 + assigned-clock-parents = <&devosc_ck>; 746 + }; 747 + }; 748 + 749 + /* Preferred timer for clockevent */ 750 + &timer2_target { 751 + ti,no-reset-on-init; 752 + ti,no-idle; 753 + timer@0 { 754 + assigned-clocks = <&timer2_fck>; 755 + assigned-clock-parents = <&devosc_ck>; 756 + }; 757 + };
+65 -13
arch/arm/boot/dts/dm816x.dtsi
··· 440 440 dma-names = "tx", "rx"; 441 441 }; 442 442 443 - timer1: timer@4802e000 { 444 - compatible = "ti,dm816-timer"; 445 - reg = <0x4802e000 0x2000>; 446 - interrupts = <67>; 447 - ti,hwmods = "timer1"; 448 - ti,timer-alwon; 449 - clocks = <&timer1_fck>; 443 + timer1_target: target-module@4802e000 { 444 + compatible = "ti,sysc-omap4-timer", "ti,sysc"; 445 + reg = <0x4802e000 0x4>, 446 + <0x4802e010 0x4>; 447 + reg-names = "rev", "sysc"; 448 + ti,sysc-mask = <SYSC_OMAP4_SOFTRESET>; 449 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 450 + <SYSC_IDLE_NO>, 451 + <SYSC_IDLE_SMART>, 452 + <SYSC_IDLE_SMART_WKUP>; 453 + clocks = <&alwon_clkctrl DM816_TIMER1_CLKCTRL 0>; 450 454 clock-names = "fck"; 455 + #address-cells = <1>; 456 + #size-cells = <1>; 457 + ranges = <0x0 0x4802e000 0x1000>; 458 + 459 + timer1: timer@0 { 460 + compatible = "ti,dm816-timer"; 461 + reg = <0 0x1000>; 462 + interrupts = <67>; 463 + ti,timer-alwon; 464 + clocks = <&alwon_clkctrl DM816_TIMER1_CLKCTRL 0>; 465 + clock-names = "fck"; 466 + }; 451 467 }; 452 468 453 - timer2: timer@48040000 { 454 - compatible = "ti,dm816-timer"; 455 - reg = <0x48040000 0x2000>; 456 - interrupts = <68>; 457 - ti,hwmods = "timer2"; 458 - clocks = <&timer2_fck>; 469 + timer2_target: target-module@48040000 { 470 + compatible = "ti,sysc-omap4-timer", "ti,sysc"; 471 + reg = <0x48040000 0x4>, 472 + <0x48040010 0x4>; 473 + reg-names = "rev", "sysc"; 474 + ti,sysc-mask = <SYSC_OMAP4_SOFTRESET>; 475 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 476 + <SYSC_IDLE_NO>, 477 + <SYSC_IDLE_SMART>, 478 + <SYSC_IDLE_SMART_WKUP>; 479 + clocks = <&alwon_clkctrl DM816_TIMER2_CLKCTRL 0>; 459 480 clock-names = "fck"; 481 + #address-cells = <1>; 482 + #size-cells = <1>; 483 + ranges = <0x0 0x48040000 0x1000>; 484 + 485 + timer2: timer@0 { 486 + compatible = "ti,dm816-timer"; 487 + reg = <0 0x1000>; 488 + interrupts = <68>; 489 + clocks = <&alwon_clkctrl DM816_TIMER2_CLKCTRL 0>; 490 + clock-names = "fck"; 491 + }; 460 492 }; 461 493 462 494 timer3: timer@48042000 { ··· 674 642 }; 675 643 676 644 #include "dm816x-clocks.dtsi" 645 + 646 + /* Preferred always-on timer for clocksource */ 647 + &timer1_target { 648 + ti,no-reset-on-init; 649 + ti,no-idle; 650 + timer@0 { 651 + assigned-clocks = <&timer1_fck>; 652 + assigned-clock-parents = <&sys_clkin_ck>; 653 + }; 654 + }; 655 + 656 + /* Preferred timer for clockevent */ 657 + &timer2_target { 658 + ti,no-reset-on-init; 659 + ti,no-idle; 660 + timer@0 { 661 + assigned-clocks = <&timer2_fck>; 662 + assigned-clock-parents = <&sys_clkin_ck>; 663 + }; 664 + };
+2 -2
arch/arm/mach-omap2/board-generic.c
··· 201 201 .init_early = ti814x_init_early, 202 202 .init_machine = omap_generic_init, 203 203 .init_late = ti81xx_init_late, 204 - .init_time = omap3_gptimer_timer_init, 204 + .init_time = omap_init_time_of, 205 205 .dt_compat = ti814x_boards_compat, 206 206 .restart = ti81xx_restart, 207 207 MACHINE_END ··· 218 218 .init_early = ti816x_init_early, 219 219 .init_machine = omap_generic_init, 220 220 .init_late = ti81xx_init_late, 221 - .init_time = omap3_gptimer_timer_init, 221 + .init_time = omap_init_time_of, 222 222 .dt_compat = ti816x_boards_compat, 223 223 .restart = ti81xx_restart, 224 224 MACHINE_END
-74
arch/arm/mach-omap2/omap_hwmod_81xx_data.c
··· 690 690 .sysc = &dm816x_timer_sysc, 691 691 }; 692 692 693 - static struct omap_hwmod dm814x_timer1_hwmod = { 694 - .name = "timer1", 695 - .clkdm_name = "alwon_l3s_clkdm", 696 - .main_clk = "timer1_fck", 697 - .class = &dm816x_timer_hwmod_class, 698 - .flags = HWMOD_NO_IDLEST, 699 - }; 700 - 701 - static struct omap_hwmod_ocp_if dm814x_l4_ls__timer1 = { 702 - .master = &dm81xx_l4_ls_hwmod, 703 - .slave = &dm814x_timer1_hwmod, 704 - .clk = "sysclk6_ck", 705 - .user = OCP_USER_MPU, 706 - }; 707 - 708 - static struct omap_hwmod dm816x_timer1_hwmod = { 709 - .name = "timer1", 710 - .clkdm_name = "alwon_l3s_clkdm", 711 - .main_clk = "timer1_fck", 712 - .prcm = { 713 - .omap4 = { 714 - .clkctrl_offs = DM816X_CM_ALWON_TIMER_1_CLKCTRL, 715 - .modulemode = MODULEMODE_SWCTRL, 716 - }, 717 - }, 718 - .class = &dm816x_timer_hwmod_class, 719 - }; 720 - 721 - static struct omap_hwmod_ocp_if dm816x_l4_ls__timer1 = { 722 - .master = &dm81xx_l4_ls_hwmod, 723 - .slave = &dm816x_timer1_hwmod, 724 - .clk = "sysclk6_ck", 725 - .user = OCP_USER_MPU, 726 - }; 727 - 728 - static struct omap_hwmod dm814x_timer2_hwmod = { 729 - .name = "timer2", 730 - .clkdm_name = "alwon_l3s_clkdm", 731 - .main_clk = "timer2_fck", 732 - .class = &dm816x_timer_hwmod_class, 733 - .flags = HWMOD_NO_IDLEST, 734 - }; 735 - 736 - static struct omap_hwmod_ocp_if dm814x_l4_ls__timer2 = { 737 - .master = &dm81xx_l4_ls_hwmod, 738 - .slave = &dm814x_timer2_hwmod, 739 - .clk = "sysclk6_ck", 740 - .user = OCP_USER_MPU, 741 - }; 742 - 743 - static struct omap_hwmod dm816x_timer2_hwmod = { 744 - .name = "timer2", 745 - .clkdm_name = "alwon_l3s_clkdm", 746 - .main_clk = "timer2_fck", 747 - .prcm = { 748 - .omap4 = { 749 - .clkctrl_offs = DM816X_CM_ALWON_TIMER_2_CLKCTRL, 750 - .modulemode = MODULEMODE_SWCTRL, 751 - }, 752 - }, 753 - .class = &dm816x_timer_hwmod_class, 754 - }; 755 - 756 - static struct omap_hwmod_ocp_if dm816x_l4_ls__timer2 = { 757 - .master = &dm81xx_l4_ls_hwmod, 758 - .slave = &dm816x_timer2_hwmod, 759 - .clk = "sysclk6_ck", 760 - .user = OCP_USER_MPU, 761 - }; 762 - 763 693 static struct omap_hwmod dm816x_timer3_hwmod = { 764 694 .name = "timer3", 765 695 .clkdm_name = "alwon_l3s_clkdm", ··· 1218 1288 &dm814x_l4_ls__mmc1, 1219 1289 &dm814x_l4_ls__mmc2, 1220 1290 &ti81xx_l4_ls__rtc, 1221 - &dm814x_l4_ls__timer1, 1222 - &dm814x_l4_ls__timer2, 1223 1291 &dm81xx_alwon_l3_slow__gpmc, 1224 1292 &dm814x_default_l3_slow__usbss, 1225 1293 &dm814x_alwon_l3_med__mmc3, ··· 1246 1318 &dm81xx_l4_ls__elm, 1247 1319 &ti81xx_l4_ls__rtc, 1248 1320 &dm816x_l4_ls__mmc1, 1249 - &dm816x_l4_ls__timer1, 1250 - &dm816x_l4_ls__timer2, 1251 1321 &dm816x_l4_ls__timer3, 1252 1322 &dm816x_l4_ls__timer4, 1253 1323 &dm816x_l4_ls__timer5,