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 omap3

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.

Let's also update the dts file to use #include while at it.

Cc: devicetree@vger.kernel.org
Cc: Adam Ford <aford173@gmail.com>
Cc: Andreas Kemnade <andreas@kemnade.info>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: "H. Nikolaus Schaller" <hns@goldelico.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>

+205 -175
+22 -2
arch/arm/boot/dts/am3517.dtsi
··· 169 169 status = "disabled"; 170 170 }; 171 171 172 - /include/ "am35xx-clocks.dtsi" 173 - /include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi" 172 + #include "am35xx-clocks.dtsi" 173 + #include "omap36xx-am35xx-omap3430es2plus-clocks.dtsi" 174 + 175 + /* Preferred always-on timer for clocksource */ 176 + &timer1_target { 177 + ti,no-reset-on-init; 178 + ti,no-idle; 179 + timer@0 { 180 + assigned-clocks = <&gpt1_fck>; 181 + assigned-clock-parents = <&sys_ck>; 182 + }; 183 + }; 184 + 185 + /* Preferred timer for clockevent */ 186 + &timer2_target { 187 + ti,no-reset-on-init; 188 + ti,no-idle; 189 + timer@0 { 190 + assigned-clocks = <&gpt2_fck>; 191 + assigned-clock-parents = <&sys_ck>; 192 + }; 193 + };
+33
arch/arm/boot/dts/omap3-beagle.dts
··· 304 304 phys = <0 &hsusb2_phy>; 305 305 }; 306 306 307 + /* Unusable as clocksource because of unreliable oscillator */ 308 + &counter32k { 309 + status = "disabled"; 310 + }; 311 + 312 + /* Unusable as clockevent because if unreliable oscillator, allow to idle */ 313 + &timer1_target { 314 + /delete-property/ti,no-reset-on-init; 315 + /delete-property/ti,no-idle; 316 + timer@0 { 317 + /delete-property/ti,timer-alwon; 318 + }; 319 + }; 320 + 321 + /* Preferred always-on timer for clocksource */ 322 + &timer12_target { 323 + ti,no-reset-on-init; 324 + ti,no-idle; 325 + timer@0 { 326 + /* Always clocked by secure_32k_fck */ 327 + }; 328 + }; 329 + 330 + /* Preferred timer for clockevent */ 331 + &timer2_target { 332 + ti,no-reset-on-init; 333 + ti,no-idle; 334 + timer@0 { 335 + assigned-clocks = <&gpt2_fck>; 336 + assigned-clock-parents = <&sys_ck>; 337 + }; 338 + }; 339 + 307 340 &twl_gpio { 308 341 ti,use-leds; 309 342 /* pullups: BIT(1) */
+33
arch/arm/boot/dts/omap3-devkit8000.dts
··· 14 14 display2 = &tv0; 15 15 }; 16 16 }; 17 + 18 + /* Unusable as clocksource because of unreliable oscillator */ 19 + &counter32k { 20 + status = "disabled"; 21 + }; 22 + 23 + /* Unusable as clockevent because if unreliable oscillator, allow to idle */ 24 + &timer1_target { 25 + /delete-property/ti,no-reset-on-init; 26 + /delete-property/ti,no-idle; 27 + timer@0 { 28 + /delete-property/ti,timer-alwon; 29 + }; 30 + }; 31 + 32 + /* Preferred always-on timer for clocksource */ 33 + &timer12_target { 34 + ti,no-reset-on-init; 35 + ti,no-idle; 36 + timer@0 { 37 + /* Always clocked by secure_32k_fck */ 38 + }; 39 + }; 40 + 41 + /* Preferred timer for clockevent */ 42 + &timer2_target { 43 + ti,no-reset-on-init; 44 + ti,no-idle; 45 + timer@0 { 46 + assigned-clocks = <&gpt2_fck>; 47 + assigned-clock-parents = <&sys_ck>; 48 + }; 49 + };
+111 -23
arch/arm/boot/dts/omap3.dtsi
··· 193 193 }; 194 194 }; 195 195 196 - counter32k: counter@48320000 { 197 - compatible = "ti,omap-counter32k"; 198 - reg = <0x48320000 0x20>; 199 - ti,hwmods = "counter_32k"; 196 + target-module@48320000 { 197 + compatible = "ti,sysc-omap2", "ti,sysc"; 198 + reg = <0x48320000 0x4>, 199 + <0x48320004 0x4>; 200 + reg-names = "rev", "sysc"; 201 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 202 + <SYSC_IDLE_NO>; 203 + clocks = <&wkup_32k_fck>, <&omap_32ksync_ick>; 204 + clock-names = "fck", "ick"; 205 + #address-cells = <1>; 206 + #size-cells = <1>; 207 + ranges = <0x0 0x48320000 0x1000>; 208 + 209 + counter32k: counter@0 { 210 + compatible = "ti,omap-counter32k"; 211 + reg = <0x0 0x20>; 212 + }; 200 213 }; 201 214 202 215 intc: interrupt-controller@48200000 { ··· 650 637 dma-names = "rx"; 651 638 }; 652 639 653 - timer1: timer@48318000 { 654 - compatible = "ti,omap3430-timer"; 655 - reg = <0x48318000 0x400>; 656 - interrupts = <37>; 657 - ti,hwmods = "timer1"; 658 - ti,timer-alwon; 640 + timer1_target: target-module@48318000 { 641 + compatible = "ti,sysc-omap2-timer", "ti,sysc"; 642 + reg = <0x48318000 0x4>, 643 + <0x48318010 0x4>, 644 + <0x48318014 0x4>; 645 + reg-names = "rev", "sysc", "syss"; 646 + ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY | 647 + SYSC_OMAP2_EMUFREE | 648 + SYSC_OMAP2_ENAWAKEUP | 649 + SYSC_OMAP2_SOFTRESET | 650 + SYSC_OMAP2_AUTOIDLE)>; 651 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 652 + <SYSC_IDLE_NO>, 653 + <SYSC_IDLE_SMART>; 654 + ti,syss-mask = <1>; 655 + clocks = <&gpt1_fck>, <&gpt1_ick>; 656 + clock-names = "fck", "ick"; 657 + #address-cells = <1>; 658 + #size-cells = <1>; 659 + ranges = <0x0 0x48318000 0x1000>; 660 + 661 + timer1: timer@0 { 662 + compatible = "ti,omap3430-timer"; 663 + reg = <0x0 0x80>; 664 + clocks = <&gpt1_fck>; 665 + clock-names = "fck"; 666 + interrupts = <37>; 667 + ti,timer-alwon; 668 + }; 659 669 }; 660 670 661 - timer2: timer@49032000 { 662 - compatible = "ti,omap3430-timer"; 663 - reg = <0x49032000 0x400>; 664 - interrupts = <38>; 665 - ti,hwmods = "timer2"; 671 + timer2_target: target-module@49032000 { 672 + compatible = "ti,sysc-omap2-timer", "ti,sysc"; 673 + reg = <0x49032000 0x4>, 674 + <0x49032010 0x4>, 675 + <0x49032014 0x4>; 676 + reg-names = "rev", "sysc", "syss"; 677 + ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY | 678 + SYSC_OMAP2_EMUFREE | 679 + SYSC_OMAP2_ENAWAKEUP | 680 + SYSC_OMAP2_SOFTRESET | 681 + SYSC_OMAP2_AUTOIDLE)>; 682 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 683 + <SYSC_IDLE_NO>, 684 + <SYSC_IDLE_SMART>; 685 + ti,syss-mask = <1>; 686 + clocks = <&gpt2_fck>, <&gpt2_ick>; 687 + clock-names = "fck", "ick"; 688 + #address-cells = <1>; 689 + #size-cells = <1>; 690 + ranges = <0x0 0x49032000 0x1000>; 691 + 692 + timer2: timer@0 { 693 + compatible = "ti,omap3430-timer"; 694 + reg = <0 0x400>; 695 + interrupts = <38>; 696 + }; 666 697 }; 667 698 668 699 timer3: timer@49034000 { ··· 780 723 ti,timer-pwm; 781 724 }; 782 725 783 - timer12: timer@48304000 { 784 - compatible = "ti,omap3430-timer"; 785 - reg = <0x48304000 0x400>; 786 - interrupts = <95>; 787 - ti,hwmods = "timer12"; 788 - ti,timer-alwon; 789 - ti,timer-secure; 726 + timer12_target: target-module@48304000 { 727 + compatible = "ti,sysc-omap2-timer", "ti,sysc"; 728 + reg = <0x48304000 0x4>, 729 + <0x48304010 0x4>, 730 + <0x48304014 0x4>; 731 + reg-names = "rev", "sysc", "syss"; 732 + ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY | 733 + SYSC_OMAP2_EMUFREE | 734 + SYSC_OMAP2_ENAWAKEUP | 735 + SYSC_OMAP2_SOFTRESET | 736 + SYSC_OMAP2_AUTOIDLE)>; 737 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 738 + <SYSC_IDLE_NO>, 739 + <SYSC_IDLE_SMART>; 740 + ti,syss-mask = <1>; 741 + clocks = <&gpt12_fck>, <&gpt12_ick>; 742 + clock-names = "fck", "ick"; 743 + #address-cells = <1>; 744 + #size-cells = <1>; 745 + ranges = <0x0 0x48304000 0x1000>; 746 + 747 + timer12: timer@0 { 748 + compatible = "ti,omap3430-timer"; 749 + reg = <0 0x400>; 750 + interrupts = <95>; 751 + ti,timer-alwon; 752 + ti,timer-secure; 753 + }; 790 754 }; 791 755 792 756 usbhstll: usbhstll@48062000 { ··· 964 886 }; 965 887 }; 966 888 967 - /include/ "omap3xxx-clocks.dtsi" 889 + #include "omap3xxx-clocks.dtsi" 890 + 891 + /* Preferred always-on timer for clockevent. Some boards must use dmtimer12 */ 892 + &timer1_target { 893 + ti,no-reset-on-init; 894 + ti,no-idle; 895 + timer@0 { 896 + assigned-clocks = <&gpt1_fck>; 897 + assigned-clock-parents = <&omap_32k_fck>; 898 + }; 899 + };
+5 -5
arch/arm/mach-omap2/board-generic.c
··· 114 114 .init_early = omap3430_init_early, 115 115 .init_machine = omap_generic_init, 116 116 .init_late = omap3_init_late, 117 - .init_time = omap_init_time, 117 + .init_time = omap_init_time_of, 118 118 .dt_compat = n900_boards_compat, 119 119 .restart = omap3xxx_restart, 120 120 MACHINE_END ··· 132 132 .init_early = omap3430_init_early, 133 133 .init_machine = omap_generic_init, 134 134 .init_late = omap3_init_late, 135 - .init_time = omap_init_time, 135 + .init_time = omap_init_time_of, 136 136 .dt_compat = omap3_boards_compat, 137 137 .restart = omap3xxx_restart, 138 138 MACHINE_END ··· 149 149 .init_early = omap3630_init_early, 150 150 .init_machine = omap_generic_init, 151 151 .init_late = omap3_init_late, 152 - .init_time = omap_init_time, 152 + .init_time = omap_init_time_of, 153 153 .dt_compat = omap36xx_boards_compat, 154 154 .restart = omap3xxx_restart, 155 155 MACHINE_END ··· 166 166 .init_early = omap3430_init_early, 167 167 .init_machine = omap_generic_init, 168 168 .init_late = omap3_init_late, 169 - .init_time = omap3_secure_sync32k_timer_init, 169 + .init_time = omap_init_time_of, 170 170 .dt_compat = omap3_gp_boards_compat, 171 171 .restart = omap3xxx_restart, 172 172 MACHINE_END ··· 182 182 .init_early = am35xx_init_early, 183 183 .init_machine = omap_generic_init, 184 184 .init_late = omap3_init_late, 185 - .init_time = omap3_gptimer_timer_init, 185 + .init_time = omap_init_time_of, 186 186 .dt_compat = am3517_boards_compat, 187 187 .restart = omap3xxx_restart, 188 188 MACHINE_END
+1 -145
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
··· 147 147 .sysc = &omap3xxx_timer_sysc, 148 148 }; 149 149 150 - /* timer1 */ 151 - static struct omap_hwmod omap3xxx_timer1_hwmod = { 152 - .name = "timer1", 153 - .main_clk = "gpt1_fck", 154 - .prcm = { 155 - .omap2 = { 156 - .module_offs = WKUP_MOD, 157 - .idlest_reg_id = 1, 158 - .idlest_idle_bit = OMAP3430_ST_GPT1_SHIFT, 159 - }, 160 - }, 161 - .class = &omap3xxx_timer_hwmod_class, 162 - .flags = HWMOD_SET_DEFAULT_CLOCKACT, 163 - }; 164 - 165 - /* timer2 */ 166 - static struct omap_hwmod omap3xxx_timer2_hwmod = { 167 - .name = "timer2", 168 - .main_clk = "gpt2_fck", 169 - .prcm = { 170 - .omap2 = { 171 - .module_offs = OMAP3430_PER_MOD, 172 - .idlest_reg_id = 1, 173 - .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT, 174 - }, 175 - }, 176 - .class = &omap3xxx_timer_hwmod_class, 177 - .flags = HWMOD_SET_DEFAULT_CLOCKACT, 178 - }; 179 - 180 150 /* timer3 */ 181 151 static struct omap_hwmod omap3xxx_timer3_hwmod = { 182 152 .name = "timer3", ··· 276 306 .module_offs = CORE_MOD, 277 307 .idlest_reg_id = 1, 278 308 .idlest_idle_bit = OMAP3430_ST_GPT11_SHIFT, 279 - }, 280 - }, 281 - .class = &omap3xxx_timer_hwmod_class, 282 - .flags = HWMOD_SET_DEFAULT_CLOCKACT, 283 - }; 284 - 285 - /* timer12 */ 286 - static struct omap_hwmod omap3xxx_timer12_hwmod = { 287 - .name = "timer12", 288 - .main_clk = "gpt12_fck", 289 - .prcm = { 290 - .omap2 = { 291 - .module_offs = WKUP_MOD, 292 - .idlest_reg_id = 1, 293 - .idlest_idle_bit = OMAP3430_ST_GPT12_SHIFT, 294 309 }, 295 310 }, 296 311 .class = &omap3xxx_timer_hwmod_class, ··· 1480 1525 }; 1481 1526 1482 1527 /* 1483 - * '32K sync counter' class 1484 - * 32-bit ordinary counter, clocked by the falling edge of the 32 khz clock 1485 - */ 1486 - static struct omap_hwmod_class_sysconfig omap3xxx_counter_sysc = { 1487 - .rev_offs = 0x0000, 1488 - .sysc_offs = 0x0004, 1489 - .sysc_flags = SYSC_HAS_SIDLEMODE, 1490 - .idlemodes = (SIDLE_FORCE | SIDLE_NO), 1491 - .sysc_fields = &omap_hwmod_sysc_type1, 1492 - }; 1493 - 1494 - static struct omap_hwmod_class omap3xxx_counter_hwmod_class = { 1495 - .name = "counter", 1496 - .sysc = &omap3xxx_counter_sysc, 1497 - }; 1498 - 1499 - static struct omap_hwmod omap3xxx_counter_32k_hwmod = { 1500 - .name = "counter_32k", 1501 - .class = &omap3xxx_counter_hwmod_class, 1502 - .clkdm_name = "wkup_clkdm", 1503 - .flags = HWMOD_SWSUP_SIDLE, 1504 - .main_clk = "wkup_32k_fck", 1505 - .prcm = { 1506 - .omap2 = { 1507 - .module_offs = WKUP_MOD, 1508 - .idlest_reg_id = 1, 1509 - .idlest_idle_bit = OMAP3430_ST_32KSYNC_SHIFT, 1510 - }, 1511 - }, 1512 - }; 1513 - 1514 - /* 1515 1528 * 'gpmc' class 1516 1529 * general purpose memory controller 1517 1530 */ ··· 1791 1868 .user = OCP_USER_MPU | OCP_USER_SDMA, 1792 1869 }; 1793 1870 1794 - 1795 - /* l4_wkup -> timer1 */ 1796 - static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__timer1 = { 1797 - .master = &omap3xxx_l4_wkup_hwmod, 1798 - .slave = &omap3xxx_timer1_hwmod, 1799 - .clk = "gpt1_ick", 1800 - .user = OCP_USER_MPU | OCP_USER_SDMA, 1801 - }; 1802 - 1803 - 1804 - /* l4_per -> timer2 */ 1805 - static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer2 = { 1806 - .master = &omap3xxx_l4_per_hwmod, 1807 - .slave = &omap3xxx_timer2_hwmod, 1808 - .clk = "gpt2_ick", 1809 - .user = OCP_USER_MPU | OCP_USER_SDMA, 1810 - }; 1811 - 1812 - 1813 1871 /* l4_per -> timer3 */ 1814 1872 static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer3 = { 1815 1873 .master = &omap3xxx_l4_per_hwmod, ··· 1866 1962 .master = &omap3xxx_l4_core_hwmod, 1867 1963 .slave = &omap3xxx_timer11_hwmod, 1868 1964 .clk = "gpt11_ick", 1869 - .user = OCP_USER_MPU | OCP_USER_SDMA, 1870 - }; 1871 - 1872 - 1873 - /* l4_core -> timer12 */ 1874 - static struct omap_hwmod_ocp_if omap3xxx_l4_sec__timer12 = { 1875 - .master = &omap3xxx_l4_sec_hwmod, 1876 - .slave = &omap3xxx_timer12_hwmod, 1877 - .clk = "gpt12_ick", 1878 1965 .user = OCP_USER_MPU | OCP_USER_SDMA, 1879 1966 }; 1880 1967 ··· 2220 2325 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE, 2221 2326 }; 2222 2327 2223 - /* l4_wkup -> 32ksync_counter */ 2224 - 2225 - 2226 - static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__counter_32k = { 2227 - .master = &omap3xxx_l4_wkup_hwmod, 2228 - .slave = &omap3xxx_counter_32k_hwmod, 2229 - .clk = "omap_32ksync_ick", 2230 - .user = OCP_USER_MPU | OCP_USER_SDMA, 2231 - }; 2232 - 2233 2328 /* am35xx has Davinci MDIO & EMAC */ 2234 2329 static struct omap_hwmod_class am35xx_mdio_class = { 2235 2330 .name = "davinci_mdio", ··· 2436 2551 &omap3_l4_core__i2c2, 2437 2552 &omap3_l4_core__i2c3, 2438 2553 &omap3xxx_l4_wkup__l4_sec, 2439 - &omap3xxx_l4_wkup__timer1, 2440 - &omap3xxx_l4_per__timer2, 2441 2554 &omap3xxx_l4_per__timer3, 2442 2555 &omap3xxx_l4_per__timer4, 2443 2556 &omap3xxx_l4_per__timer5, ··· 2463 2580 &omap34xx_l4_core__mcspi2, 2464 2581 &omap34xx_l4_core__mcspi3, 2465 2582 &omap34xx_l4_core__mcspi4, 2466 - &omap3xxx_l4_wkup__counter_32k, 2467 2583 &omap3xxx_l3_main__gpmc, 2468 - NULL, 2469 - }; 2470 - 2471 - /* GP-only hwmod links */ 2472 - static struct omap_hwmod_ocp_if *omap34xx_gp_hwmod_ocp_ifs[] __initdata = { 2473 - &omap3xxx_l4_sec__timer12, 2474 - NULL, 2475 - }; 2476 - 2477 - static struct omap_hwmod_ocp_if *omap36xx_gp_hwmod_ocp_ifs[] __initdata = { 2478 - &omap3xxx_l4_sec__timer12, 2479 - NULL, 2480 - }; 2481 - 2482 - static struct omap_hwmod_ocp_if *am35xx_gp_hwmod_ocp_ifs[] __initdata = { 2483 - &omap3xxx_l4_sec__timer12, 2484 2584 NULL, 2485 2585 }; 2486 2586 ··· 2640 2774 int __init omap3xxx_hwmod_init(void) 2641 2775 { 2642 2776 int r; 2643 - struct omap_hwmod_ocp_if **h = NULL, **h_gp = NULL, **h_sham = NULL; 2777 + struct omap_hwmod_ocp_if **h = NULL, **h_sham = NULL; 2644 2778 struct omap_hwmod_ocp_if **h_aes = NULL; 2645 2779 struct device_node *bus; 2646 2780 unsigned int rev; ··· 2663 2797 rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 || 2664 2798 rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) { 2665 2799 h = omap34xx_hwmod_ocp_ifs; 2666 - h_gp = omap34xx_gp_hwmod_ocp_ifs; 2667 2800 h_sham = omap34xx_sham_hwmod_ocp_ifs; 2668 2801 h_aes = omap34xx_aes_hwmod_ocp_ifs; 2669 2802 } else if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) { 2670 2803 h = am35xx_hwmod_ocp_ifs; 2671 - h_gp = am35xx_gp_hwmod_ocp_ifs; 2672 2804 h_sham = am35xx_sham_hwmod_ocp_ifs; 2673 2805 h_aes = am35xx_aes_hwmod_ocp_ifs; 2674 2806 } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 || 2675 2807 rev == OMAP3630_REV_ES1_2) { 2676 2808 h = omap36xx_hwmod_ocp_ifs; 2677 - h_gp = omap36xx_gp_hwmod_ocp_ifs; 2678 2809 h_sham = omap36xx_sham_hwmod_ocp_ifs; 2679 2810 h_aes = omap36xx_aes_hwmod_ocp_ifs; 2680 2811 } else { ··· 2682 2819 r = omap_hwmod_register_links(h); 2683 2820 if (r < 0) 2684 2821 return r; 2685 - 2686 - /* Register GP-only hwmod links. */ 2687 - if (h_gp && omap_type() == OMAP2_DEVICE_TYPE_GP) { 2688 - r = omap_hwmod_register_links(h_gp); 2689 - if (r < 0) 2690 - return r; 2691 - } 2692 2822 2693 2823 /* 2694 2824 * Register crypto hwmod links only if they are not disabled in DT.