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

Merge tag 'omap-for-v5.8/timer-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into arm/soc

System timer changes for omaps for v5.8 merge window

This series of changes finally gets the legacy omap dual-mode timer and
32k counter system timer updated to use drivers/clocksource and device
tree data. And we can now remove the unused legacy platform data.

These changes are based on an immutable clocksource branch set up by
Daniel Lezcano.

* tag 'omap-for-v5.8/timer-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
bus: ti-sysc: Timers no longer need legacy quirk handling
ARM: OMAP2+: Drop old timer code for dmtimer and 32k counter
ARM: dts: Configure system timers for omap2
ARM: dts: Configure system timers for ti81xx
ARM: dts: Configure system timers for omap3
ARM: dts: Configure system timers for omap5 and dra7
ARM: dts: Configure system timers for omap4
ARM: dts: Configure system timers for am437x
ARM: dts: Configure system timers for am335x
ARM: OMAP2+: Add omap_init_time_of()
bus: ti-sysc: Ignore timer12 on secure omap3
clk: ti: dm816: enable sysclk6_ck on init
clocksource/drivers/timer-ti-dm: Fix warning for set but not used
clocksource/drivers/timer-ti-dm: Add clockevent and clocksource support
clocksource/drivers/timer-ti-32k: Add support for initializing directly

Link: https://lore.kernel.org/r/pull-1590169577-735045@atomide.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+1368 -1485
+2 -4
arch/arm/boot/dts/am33xx-l4.dtsi
··· 330 330 }; 331 331 }; 332 332 333 - target-module@31000 { /* 0x44e31000, ap 25 40.0 */ 333 + timer1_target: target-module@31000 { /* 0x44e31000, ap 25 40.0 */ 334 334 compatible = "ti,sysc-omap2-timer", "ti,sysc"; 335 - ti,hwmods = "timer1"; 336 335 reg = <0x31000 0x4>, 337 336 <0x31010 0x4>, 338 337 <0x31014 0x4>; ··· 1116 1117 }; 1117 1118 }; 1118 1119 1119 - target-module@40000 { /* 0x48040000, ap 22 1e.0 */ 1120 + timer2_target: target-module@40000 { /* 0x48040000, ap 22 1e.0 */ 1120 1121 compatible = "ti,sysc-omap4-timer", "ti,sysc"; 1121 - ti,hwmods = "timer2"; 1122 1122 reg = <0x40000 0x4>, 1123 1123 <0x40010 0x4>, 1124 1124 <0x40014 0x4>;
+20
arch/arm/boot/dts/am33xx.dtsi
··· 619 619 #reset-cells = <1>; 620 620 }; 621 621 }; 622 + 623 + /* Preferred always-on timer for clocksource */ 624 + &timer1_target { 625 + ti,no-reset-on-init; 626 + ti,no-idle; 627 + timer@0 { 628 + assigned-clocks = <&timer1_fck>; 629 + assigned-clock-parents = <&sys_clkin_ck>; 630 + }; 631 + }; 632 + 633 + /* Preferred timer for clockevent */ 634 + &timer2_target { 635 + ti,no-reset-on-init; 636 + ti,no-idle; 637 + timer@0 { 638 + assigned-clocks = <&timer2_fck>; 639 + assigned-clock-parents = <&sys_clkin_ck>; 640 + }; 641 + };
+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 + };
+20
arch/arm/boot/dts/am4372.dtsi
··· 553 553 #reset-cells = <1>; 554 554 }; 555 555 }; 556 + 557 + /* Preferred always-on timer for clocksource */ 558 + &timer1_target { 559 + ti,no-reset-on-init; 560 + ti,no-idle; 561 + timer@0 { 562 + assigned-clocks = <&timer1_fck>; 563 + assigned-clock-parents = <&sys_clkin_ck>; 564 + }; 565 + }; 566 + 567 + /* Preferred timer for clockevent */ 568 + &timer2_target { 569 + ti,no-reset-on-init; 570 + ti,no-idle; 571 + timer@0 { 572 + assigned-clocks = <&timer2_fck>; 573 + assigned-clock-parents = <&sys_clkin_ck>; 574 + }; 575 + };
+2 -5
arch/arm/boot/dts/am437x-l4.dtsi
··· 328 328 }; 329 329 }; 330 330 331 - target-module@31000 { /* 0x44e31000, ap 24 40.0 */ 331 + timer1_target: target-module@31000 { /* 0x44e31000, ap 24 40.0 */ 332 332 compatible = "ti,sysc-omap2-timer", "ti,sysc"; 333 - ti,hwmods = "timer1"; 334 333 reg = <0x31000 0x4>, 335 334 <0x31010 0x4>, 336 335 <0x31014 0x4>; ··· 449 450 450 451 target-module@86000 { /* 0x44e86000, ap 40 70.0 */ 451 452 compatible = "ti,sysc-omap2", "ti,sysc"; 452 - ti,hwmods = "counter_32k"; 453 453 reg = <0x86000 0x4>, 454 454 <0x86004 0x4>; 455 455 reg-names = "rev", "sysc"; ··· 866 868 }; 867 869 }; 868 870 869 - target-module@40000 { /* 0x48040000, ap 18 1e.0 */ 871 + timer2_target: target-module@40000 { /* 0x48040000, ap 18 1e.0 */ 870 872 compatible = "ti,sysc-omap4-timer", "ti,sysc"; 871 - ti,hwmods = "timer2"; 872 873 reg = <0x40000 0x4>, 873 874 <0x40010 0x4>, 874 875 <0x40014 0x4>;
+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 + };
+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 + };
+26 -5
arch/arm/boot/dts/omap2.dtsi
··· 201 201 clock-frequency = <48000000>; 202 202 }; 203 203 204 - timer2: timer@4802a000 { 205 - compatible = "ti,omap2420-timer"; 206 - reg = <0x4802a000 0x400>; 207 - interrupts = <38>; 208 - ti,hwmods = "timer2"; 204 + timer2_target: target-module@4802a000 { 205 + compatible = "ti,sysc-omap2-timer", "ti,sysc"; 206 + reg = <0x4802a000 0x4>, 207 + <0x4802a010 0x4>, 208 + <0x4802a014 0x4>; 209 + reg-names = "rev", "sysc", "syss"; 210 + ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY | 211 + SYSC_OMAP2_EMUFREE | 212 + SYSC_OMAP2_ENAWAKEUP | 213 + SYSC_OMAP2_SOFTRESET | 214 + SYSC_OMAP2_AUTOIDLE)>; 215 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 216 + <SYSC_IDLE_NO>, 217 + <SYSC_IDLE_SMART>; 218 + ti,syss-mask = <1>; 219 + clocks = <&gpt2_fck>, <&gpt2_ick>; 220 + clock-names = "fck", "ick"; 221 + #address-cells = <1>; 222 + #size-cells = <1>; 223 + ranges = <0x0 0x4802a000 0x1000>; 224 + 225 + timer2: timer@0 { 226 + compatible = "ti,omap2420-timer"; 227 + reg = <0 0x400>; 228 + interrupts = <38>; 229 + }; 209 230 }; 210 231 211 232 timer3: timer@48078000 {
+56 -12
arch/arm/boot/dts/omap2420.dtsi
··· 68 68 }; 69 69 }; 70 70 71 - counter32k: counter@4000 { 72 - compatible = "ti,omap-counter32k"; 73 - reg = <0x4000 0x20>; 74 - ti,hwmods = "counter_32k"; 71 + target-module@4000 { 72 + compatible = "ti,sysc-omap2", "ti,sysc"; 73 + reg = <0x4000 0x4>, 74 + <0x4004 0x4>; 75 + reg-names = "rev", "sysc"; 76 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 77 + <SYSC_IDLE_NO>; 78 + clocks = <&func_32k_ck>; 79 + clock-names = "fck"; 80 + #address-cells = <1>; 81 + #size-cells = <1>; 82 + ranges = <0x0 0x4000 0x1000>; 83 + 84 + counter32k: counter@0 { 85 + compatible = "ti,omap-counter32k"; 86 + reg = <0 0x20>; 87 + }; 75 88 }; 76 89 }; 77 90 ··· 207 194 }; 208 195 }; 209 196 210 - timer1: timer@48028000 { 211 - compatible = "ti,omap2420-timer"; 212 - reg = <0x48028000 0x400>; 213 - interrupts = <37>; 214 - ti,hwmods = "timer1"; 215 - ti,timer-alwon; 197 + timer1_target: target-module@48028000 { 198 + compatible = "ti,sysc-omap2-timer", "ti,sysc"; 199 + reg = <0x48028000 0x4>, 200 + <0x48028010 0x4>, 201 + <0x48028014 0x4>; 202 + reg-names = "rev", "sysc", "syss"; 203 + ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY | 204 + SYSC_OMAP2_EMUFREE | 205 + SYSC_OMAP2_ENAWAKEUP | 206 + SYSC_OMAP2_SOFTRESET | 207 + SYSC_OMAP2_AUTOIDLE)>; 208 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 209 + <SYSC_IDLE_NO>, 210 + <SYSC_IDLE_SMART>; 211 + ti,syss-mask = <1>; 212 + clocks = <&gpt1_fck>, <&gpt1_ick>; 213 + clock-names = "fck", "ick"; 214 + #address-cells = <1>; 215 + #size-cells = <1>; 216 + ranges = <0x0 0x48028000 0x1000>; 217 + 218 + timer1: timer@0 { 219 + compatible = "ti,omap2420-timer"; 220 + reg = <0 0x400>; 221 + interrupts = <37>; 222 + ti,timer-alwon; 223 + }; 216 224 }; 217 225 218 226 wd_timer2: wdt@48022000 { ··· 252 218 compatible = "ti,omap2420-i2c"; 253 219 }; 254 220 255 - /include/ "omap24xx-clocks.dtsi" 256 - /include/ "omap2420-clocks.dtsi" 221 + #include "omap24xx-clocks.dtsi" 222 + #include "omap2420-clocks.dtsi" 223 + 224 + /* Preferred always-on timer for clockevent */ 225 + &timer1_target { 226 + ti,no-reset-on-init; 227 + ti,no-idle; 228 + timer@0 { 229 + assigned-clocks = <&gpt1_fck>; 230 + assigned-clock-parents = <&func_32k_ck>; 231 + }; 232 + };
+56 -12
arch/arm/boot/dts/omap2430.dtsi
··· 81 81 }; 82 82 }; 83 83 84 - counter32k: counter@20000 { 85 - compatible = "ti,omap-counter32k"; 86 - reg = <0x20000 0x20>; 87 - ti,hwmods = "counter_32k"; 84 + target-module@20000 { 85 + compatible = "ti,sysc-omap2", "ti,sysc"; 86 + reg = <0x20000 0x4>, 87 + <0x20004 0x4>; 88 + reg-names = "rev", "sysc"; 89 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 90 + <SYSC_IDLE_NO>; 91 + clocks = <&func_32k_ck>; 92 + clock-names = "fck"; 93 + #address-cells = <1>; 94 + #size-cells = <1>; 95 + ranges = <0x0 0x20000 0x1000>; 96 + 97 + counter32k: counter@0 { 98 + compatible = "ti,omap-counter32k"; 99 + reg = <0 0x20>; 100 + }; 88 101 }; 89 102 }; 90 103 ··· 290 277 }; 291 278 }; 292 279 293 - timer1: timer@49018000 { 294 - compatible = "ti,omap2420-timer"; 295 - reg = <0x49018000 0x400>; 296 - interrupts = <37>; 297 - ti,hwmods = "timer1"; 298 - ti,timer-alwon; 280 + timer1_target: target-module@49018000 { 281 + compatible = "ti,sysc-omap2-timer", "ti,sysc"; 282 + reg = <0x49018000 0x4>, 283 + <0x49018010 0x4>, 284 + <0x49018014 0x4>; 285 + reg-names = "rev", "sysc", "syss"; 286 + ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY | 287 + SYSC_OMAP2_EMUFREE | 288 + SYSC_OMAP2_ENAWAKEUP | 289 + SYSC_OMAP2_SOFTRESET | 290 + SYSC_OMAP2_AUTOIDLE)>; 291 + ti,sysc-sidle = <SYSC_IDLE_FORCE>, 292 + <SYSC_IDLE_NO>, 293 + <SYSC_IDLE_SMART>; 294 + ti,syss-mask = <1>; 295 + clocks = <&gpt1_fck>, <&gpt1_ick>; 296 + clock-names = "fck", "ick"; 297 + #address-cells = <1>; 298 + #size-cells = <1>; 299 + ranges = <0x0 0x49018000 0x1000>; 300 + 301 + timer1: timer@0 { 302 + compatible = "ti,omap2420-timer"; 303 + reg = <0 0x400>; 304 + interrupts = <37>; 305 + ti,timer-alwon; 306 + }; 299 307 }; 300 308 301 309 mcspi3: spi@480b8000 { ··· 355 321 compatible = "ti,omap2430-i2c"; 356 322 }; 357 323 358 - /include/ "omap24xx-clocks.dtsi" 359 - /include/ "omap2430-clocks.dtsi" 324 + #include "omap24xx-clocks.dtsi" 325 + #include "omap2430-clocks.dtsi" 326 + 327 + /* Preferred always-on timer for clockevent */ 328 + &timer1_target { 329 + ti,no-reset-on-init; 330 + ti,no-idle; 331 + timer@0 { 332 + assigned-clocks = <&gpt1_fck>; 333 + assigned-clock-parents = <&func_32k_ck>; 334 + }; 335 + };
+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 + };
+1 -3
arch/arm/boot/dts/omap4-l4.dtsi
··· 974 974 975 975 target-module@4000 { /* 0x4a304000, ap 17 24.0 */ 976 976 compatible = "ti,sysc-omap2", "ti,sysc"; 977 - ti,hwmods = "counter_32k"; 978 977 reg = <0x4000 0x4>, 979 978 <0x4004 0x4>; 980 979 reg-names = "rev", "sysc"; ··· 1138 1139 }; 1139 1140 }; 1140 1141 1141 - target-module@8000 { /* 0x4a318000, ap 9 1c.0 */ 1142 + timer1_target: target-module@8000 { /* 0x4a318000, ap 9 1c.0 */ 1142 1143 compatible = "ti,sysc-omap2-timer", "ti,sysc"; 1143 - ti,hwmods = "timer1"; 1144 1144 reg = <0x8000 0x4>, 1145 1145 <0x8010 0x4>, 1146 1146 <0x8014 0x4>;
+10
arch/arm/boot/dts/omap4.dtsi
··· 655 655 #reset-cells = <1>; 656 656 }; 657 657 }; 658 + 659 + /* Preferred always-on timer for clockevent */ 660 + &timer1_target { 661 + ti,no-reset-on-init; 662 + ti,no-idle; 663 + timer@0 { 664 + assigned-clocks = <&l4_wkup_clkctrl OMAP4_TIMER1_CLKCTRL 24>; 665 + assigned-clock-parents = <&sys_clkin_ck>; 666 + }; 667 + };
+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 + };
+3 -1
arch/arm/mach-omap2/Makefile
··· 7 7 -I$(srctree)/arch/arm/plat-omap/include 8 8 9 9 # Common support 10 - obj-y := id.o io.o control.o devices.o fb.o timer.o pm.o \ 10 + obj-y := id.o io.o control.o devices.o fb.o pm.o \ 11 11 common.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ 12 12 omap_device.o omap-headsmp.o sram.o 13 13 ··· 15 15 omap_hwmod_common_data.o 16 16 clock-common = clock.o 17 17 secure-common = omap-smc.o omap-secure.o 18 + 19 + obj-$(CONFIG_SOC_HAS_REALTIME_COUNTER) += timer.o 18 20 19 21 obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common) 20 22 obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
+20 -12
arch/arm/mach-omap2/board-generic.c
··· 12 12 #include <linux/of_irq.h> 13 13 #include <linux/of_platform.h> 14 14 #include <linux/irqdomain.h> 15 + #include <linux/clocksource.h> 15 16 16 17 #include <asm/setup.h> 17 18 #include <asm/mach/arch.h> ··· 32 31 omap_soc_device_init(); 33 32 } 34 33 34 + /* Clocks are needed early, see drivers/clocksource for the rest */ 35 + void __init __maybe_unused omap_init_time_of(void) 36 + { 37 + omap_clk_init(); 38 + timer_probe(); 39 + } 40 + 35 41 #ifdef CONFIG_SOC_OMAP2420 36 42 static const char *const omap242x_boards_compat[] __initconst = { 37 43 "ti,omap2420", ··· 50 42 .map_io = omap242x_map_io, 51 43 .init_early = omap2420_init_early, 52 44 .init_machine = omap_generic_init, 53 - .init_time = omap_init_time, 45 + .init_time = omap_init_time_of, 54 46 .dt_compat = omap242x_boards_compat, 55 47 .restart = omap2xxx_restart, 56 48 MACHINE_END ··· 67 59 .map_io = omap243x_map_io, 68 60 .init_early = omap2430_init_early, 69 61 .init_machine = omap_generic_init, 70 - .init_time = omap_init_time, 62 + .init_time = omap_init_time_of, 71 63 .dt_compat = omap243x_boards_compat, 72 64 .restart = omap2xxx_restart, 73 65 MACHINE_END ··· 114 106 .init_early = omap3430_init_early, 115 107 .init_machine = omap_generic_init, 116 108 .init_late = omap3_init_late, 117 - .init_time = omap_init_time, 109 + .init_time = omap_init_time_of, 118 110 .dt_compat = n900_boards_compat, 119 111 .restart = omap3xxx_restart, 120 112 MACHINE_END ··· 132 124 .init_early = omap3430_init_early, 133 125 .init_machine = omap_generic_init, 134 126 .init_late = omap3_init_late, 135 - .init_time = omap_init_time, 127 + .init_time = omap_init_time_of, 136 128 .dt_compat = omap3_boards_compat, 137 129 .restart = omap3xxx_restart, 138 130 MACHINE_END ··· 149 141 .init_early = omap3630_init_early, 150 142 .init_machine = omap_generic_init, 151 143 .init_late = omap3_init_late, 152 - .init_time = omap_init_time, 144 + .init_time = omap_init_time_of, 153 145 .dt_compat = omap36xx_boards_compat, 154 146 .restart = omap3xxx_restart, 155 147 MACHINE_END ··· 166 158 .init_early = omap3430_init_early, 167 159 .init_machine = omap_generic_init, 168 160 .init_late = omap3_init_late, 169 - .init_time = omap3_secure_sync32k_timer_init, 161 + .init_time = omap_init_time_of, 170 162 .dt_compat = omap3_gp_boards_compat, 171 163 .restart = omap3xxx_restart, 172 164 MACHINE_END ··· 182 174 .init_early = am35xx_init_early, 183 175 .init_machine = omap_generic_init, 184 176 .init_late = omap3_init_late, 185 - .init_time = omap3_gptimer_timer_init, 177 + .init_time = omap_init_time_of, 186 178 .dt_compat = am3517_boards_compat, 187 179 .restart = omap3xxx_restart, 188 180 MACHINE_END ··· 201 193 .init_early = ti814x_init_early, 202 194 .init_machine = omap_generic_init, 203 195 .init_late = ti81xx_init_late, 204 - .init_time = omap3_gptimer_timer_init, 196 + .init_time = omap_init_time_of, 205 197 .dt_compat = ti814x_boards_compat, 206 198 .restart = ti81xx_restart, 207 199 MACHINE_END ··· 218 210 .init_early = ti816x_init_early, 219 211 .init_machine = omap_generic_init, 220 212 .init_late = ti81xx_init_late, 221 - .init_time = omap3_gptimer_timer_init, 213 + .init_time = omap_init_time_of, 222 214 .dt_compat = ti816x_boards_compat, 223 215 .restart = ti81xx_restart, 224 216 MACHINE_END ··· 236 228 .init_early = am33xx_init_early, 237 229 .init_machine = omap_generic_init, 238 230 .init_late = am33xx_init_late, 239 - .init_time = omap3_gptimer_timer_init, 231 + .init_time = omap_init_time_of, 240 232 .dt_compat = am33xx_boards_compat, 241 233 .restart = am33xx_restart, 242 234 MACHINE_END ··· 261 253 .init_irq = omap_gic_of_init, 262 254 .init_machine = omap_generic_init, 263 255 .init_late = omap4430_init_late, 264 - .init_time = omap4_local_timer_init, 256 + .init_time = omap_init_time_of, 265 257 .dt_compat = omap4_boards_compat, 266 258 .restart = omap44xx_restart, 267 259 MACHINE_END ··· 308 300 .init_late = am43xx_init_late, 309 301 .init_irq = omap_gic_of_init, 310 302 .init_machine = omap_generic_init, 311 - .init_time = omap3_gptimer_timer_init, 303 + .init_time = omap_init_time_of, 312 304 .dt_compat = am43_boards_compat, 313 305 .restart = omap44xx_restart, 314 306 MACHINE_END
+7
arch/arm/mach-omap2/common.h
··· 111 111 #define OMAP_L2C_AUX_CTRL 0 112 112 #define omap4_l2c310_write_sec NULL 113 113 #endif 114 + 115 + #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER 114 116 extern void omap5_realtime_timer_init(void); 117 + #else 118 + static inline void omap5_realtime_timer_init(void) 119 + { 120 + } 121 + #endif 115 122 116 123 void omap2420_init_early(void); 117 124 void omap2430_init_early(void);
-20
arch/arm/mach-omap2/omap_hwmod_2420_data.c
··· 264 264 .user = OCP_USER_MPU | OCP_USER_SDMA, 265 265 }; 266 266 267 - /* l4_wkup -> timer1 */ 268 - static struct omap_hwmod_ocp_if omap2420_l4_wkup__timer1 = { 269 - .master = &omap2xxx_l4_wkup_hwmod, 270 - .slave = &omap2xxx_timer1_hwmod, 271 - .clk = "gpt1_ick", 272 - .user = OCP_USER_MPU | OCP_USER_SDMA, 273 - }; 274 - 275 267 /* l4_wkup -> wd_timer2 */ 276 268 static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = { 277 269 .master = &omap2xxx_l4_wkup_hwmod, ··· 344 352 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE, 345 353 }; 346 354 347 - 348 - /* l4_wkup -> 32ksync_counter */ 349 - static struct omap_hwmod_ocp_if omap2420_l4_wkup__counter_32k = { 350 - .master = &omap2xxx_l4_wkup_hwmod, 351 - .slave = &omap2xxx_counter_32k_hwmod, 352 - .clk = "sync_32k_ick", 353 - .user = OCP_USER_MPU | OCP_USER_SDMA, 354 - }; 355 - 356 355 static struct omap_hwmod_ocp_if omap2420_l3__gpmc = { 357 356 .master = &omap2xxx_l3_main_hwmod, 358 357 .slave = &omap2xxx_gpmc_hwmod, ··· 365 382 &omap2420_l4_core__i2c2, 366 383 &omap2420_l3__iva, 367 384 &omap2420_l3__dsp, 368 - &omap2420_l4_wkup__timer1, 369 - &omap2xxx_l4_core__timer2, 370 385 &omap2xxx_l4_core__timer3, 371 386 &omap2xxx_l4_core__timer4, 372 387 &omap2xxx_l4_core__timer5, ··· 392 411 &omap2xxx_l4_core__sham, 393 412 &omap2xxx_l4_core__aes, 394 413 &omap2420_l4_core__hdq1w, 395 - &omap2420_l4_wkup__counter_32k, 396 414 &omap2420_l3__gpmc, 397 415 NULL, 398 416 };
-19
arch/arm/mach-omap2/omap_hwmod_2430_data.c
··· 436 436 .user = OCP_USER_MPU | OCP_USER_SDMA, 437 437 }; 438 438 439 - /* l4_wkup -> timer1 */ 440 - static struct omap_hwmod_ocp_if omap2430_l4_wkup__timer1 = { 441 - .master = &omap2xxx_l4_wkup_hwmod, 442 - .slave = &omap2xxx_timer1_hwmod, 443 - .clk = "gpt1_ick", 444 - .user = OCP_USER_MPU | OCP_USER_SDMA, 445 - }; 446 - 447 439 /* l4_wkup -> wd_timer2 */ 448 440 static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = { 449 441 .master = &omap2xxx_l4_wkup_hwmod, ··· 540 548 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE, 541 549 }; 542 550 543 - /* l4_wkup -> 32ksync_counter */ 544 - static struct omap_hwmod_ocp_if omap2430_l4_wkup__counter_32k = { 545 - .master = &omap2xxx_l4_wkup_hwmod, 546 - .slave = &omap2xxx_counter_32k_hwmod, 547 - .clk = "sync_32k_ick", 548 - .user = OCP_USER_MPU | OCP_USER_SDMA, 549 - }; 550 - 551 551 static struct omap_hwmod_ocp_if omap2430_l3__gpmc = { 552 552 .master = &omap2xxx_l3_main_hwmod, 553 553 .slave = &omap2xxx_gpmc_hwmod, ··· 565 581 &omap2xxx_l4_core__mcspi2, 566 582 &omap2430_l4_core__mcspi3, 567 583 &omap2430_l3__iva, 568 - &omap2430_l4_wkup__timer1, 569 - &omap2xxx_l4_core__timer2, 570 584 &omap2xxx_l4_core__timer3, 571 585 &omap2xxx_l4_core__timer4, 572 586 &omap2xxx_l4_core__timer5, ··· 595 613 &omap2xxx_l4_core__rng, 596 614 &omap2xxx_l4_core__sham, 597 615 &omap2xxx_l4_core__aes, 598 - &omap2430_l4_wkup__counter_32k, 599 616 &omap2430_l3__gpmc, 600 617 NULL, 601 618 };
-8
arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
··· 95 95 .user = OCP_USER_MPU | OCP_USER_SDMA, 96 96 }; 97 97 98 - /* l4_core -> timer2 */ 99 - struct omap_hwmod_ocp_if omap2xxx_l4_core__timer2 = { 100 - .master = &omap2xxx_l4_core_hwmod, 101 - .slave = &omap2xxx_timer2_hwmod, 102 - .clk = "gpt2_ick", 103 - .user = OCP_USER_MPU | OCP_USER_SDMA, 104 - }; 105 - 106 98 /* l4_core -> timer3 */ 107 99 struct omap_hwmod_ocp_if omap2xxx_l4_core__timer3 = { 108 100 .master = &omap2xxx_l4_core_hwmod,
-47
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
··· 195 195 .class = &iva_hwmod_class, 196 196 }; 197 197 198 - /* timer1 */ 199 - struct omap_hwmod omap2xxx_timer1_hwmod = { 200 - .name = "timer1", 201 - .main_clk = "gpt1_fck", 202 - .prcm = { 203 - .omap2 = { 204 - .module_offs = WKUP_MOD, 205 - .idlest_reg_id = 1, 206 - .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT, 207 - }, 208 - }, 209 - .class = &omap2xxx_timer_hwmod_class, 210 - .flags = HWMOD_SET_DEFAULT_CLOCKACT, 211 - }; 212 - 213 - /* timer2 */ 214 - struct omap_hwmod omap2xxx_timer2_hwmod = { 215 - .name = "timer2", 216 - .main_clk = "gpt2_fck", 217 - .prcm = { 218 - .omap2 = { 219 - .module_offs = CORE_MOD, 220 - .idlest_reg_id = 1, 221 - .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT, 222 - }, 223 - }, 224 - .class = &omap2xxx_timer_hwmod_class, 225 - .flags = HWMOD_SET_DEFAULT_CLOCKACT, 226 - }; 227 - 228 198 /* timer3 */ 229 199 struct omap_hwmod omap2xxx_timer3_hwmod = { 230 200 .name = "timer3", ··· 563 593 }, 564 594 }, 565 595 .class = &omap2xxx_mcspi_class, 566 - }; 567 - 568 - static struct omap_hwmod_class omap2xxx_counter_hwmod_class = { 569 - .name = "counter", 570 - }; 571 - 572 - struct omap_hwmod omap2xxx_counter_32k_hwmod = { 573 - .name = "counter_32k", 574 - .main_clk = "func_32k_ck", 575 - .prcm = { 576 - .omap2 = { 577 - .module_offs = WKUP_MOD, 578 - .idlest_reg_id = 1, 579 - .idlest_idle_bit = OMAP24XX_ST_32KSYNC_SHIFT, 580 - }, 581 - }, 582 - .class = &omap2xxx_counter_hwmod_class, 583 596 }; 584 597 585 598 /* gpmc */
-2
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
··· 44 44 extern struct omap_hwmod am33xx_smartreflex1_hwmod; 45 45 extern struct omap_hwmod am33xx_gpmc_hwmod; 46 46 extern struct omap_hwmod am33xx_rtc_hwmod; 47 - extern struct omap_hwmod am33xx_timer1_hwmod; 48 - extern struct omap_hwmod am33xx_timer2_hwmod; 49 47 50 48 extern struct omap_hwmod_class am33xx_emif_hwmod_class; 51 49 extern struct omap_hwmod_class am33xx_l4_hwmod_class;
-8
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
··· 106 106 .user = OCP_USER_MPU, 107 107 }; 108 108 109 - /* l4 per -> timer2 */ 110 - struct omap_hwmod_ocp_if am33xx_l4_ls__timer2 = { 111 - .master = &am33xx_l4_ls_hwmod, 112 - .slave = &am33xx_timer2_hwmod, 113 - .clk = "l4ls_gclk", 114 - .user = OCP_USER_MPU, 115 - }; 116 - 117 109 /* l3 main -> ocmc */ 118 110 struct omap_hwmod_ocp_if am33xx_l3_main__ocmc = { 119 111 .master = &am33xx_l3_main_hwmod,
-62
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
··· 307 307 }, 308 308 }; 309 309 310 - /* 'timer 2-7' class */ 311 - static struct omap_hwmod_class_sysconfig am33xx_timer_sysc = { 312 - .rev_offs = 0x0000, 313 - .sysc_offs = 0x0010, 314 - .syss_offs = 0x0014, 315 - .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | 316 - SYSC_HAS_RESET_STATUS, 317 - .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 318 - SIDLE_SMART_WKUP), 319 - .sysc_fields = &omap_hwmod_sysc_type2, 320 - }; 321 - 322 - struct omap_hwmod_class am33xx_timer_hwmod_class = { 323 - .name = "timer", 324 - .sysc = &am33xx_timer_sysc, 325 - }; 326 - 327 - /* timer1 1ms */ 328 - static struct omap_hwmod_class_sysconfig am33xx_timer1ms_sysc = { 329 - .rev_offs = 0x0000, 330 - .sysc_offs = 0x0010, 331 - .syss_offs = 0x0014, 332 - .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | 333 - SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE | 334 - SYSS_HAS_RESET_STATUS), 335 - .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 336 - .sysc_fields = &omap_hwmod_sysc_type1, 337 - }; 338 - 339 - static struct omap_hwmod_class am33xx_timer1ms_hwmod_class = { 340 - .name = "timer", 341 - .sysc = &am33xx_timer1ms_sysc, 342 - }; 343 - 344 - struct omap_hwmod am33xx_timer1_hwmod = { 345 - .name = "timer1", 346 - .class = &am33xx_timer1ms_hwmod_class, 347 - .clkdm_name = "l4_wkup_clkdm", 348 - .main_clk = "timer1_fck", 349 - .prcm = { 350 - .omap4 = { 351 - .modulemode = MODULEMODE_SWCTRL, 352 - }, 353 - }, 354 - }; 355 - 356 - struct omap_hwmod am33xx_timer2_hwmod = { 357 - .name = "timer2", 358 - .class = &am33xx_timer_hwmod_class, 359 - .clkdm_name = "l4ls_clkdm", 360 - .main_clk = "timer2_fck", 361 - .prcm = { 362 - .omap4 = { 363 - .modulemode = MODULEMODE_SWCTRL, 364 - }, 365 - }, 366 - }; 367 - 368 310 static void omap_hwmod_am33xx_clkctrl(void) 369 311 { 370 - CLKCTRL(am33xx_timer2_hwmod, AM33XX_CM_PER_TIMER2_CLKCTRL_OFFSET); 371 312 CLKCTRL(am33xx_smartreflex0_hwmod, 372 313 AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET); 373 314 CLKCTRL(am33xx_smartreflex1_hwmod, 374 315 AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET); 375 - CLKCTRL(am33xx_timer1_hwmod, AM33XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET); 376 316 CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET); 377 317 PRCM_FLAGS(am33xx_rtc_hwmod, HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET); 378 318 CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET); ··· 339 399 340 400 static void omap_hwmod_am43xx_clkctrl(void) 341 401 { 342 - CLKCTRL(am33xx_timer2_hwmod, AM43XX_CM_PER_TIMER2_CLKCTRL_OFFSET); 343 402 CLKCTRL(am33xx_smartreflex0_hwmod, 344 403 AM43XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET); 345 404 CLKCTRL(am33xx_smartreflex1_hwmod, 346 405 AM43XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET); 347 - CLKCTRL(am33xx_timer1_hwmod, AM43XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET); 348 406 CLKCTRL(am33xx_rtc_hwmod, AM43XX_CM_RTC_RTC_CLKCTRL_OFFSET); 349 407 CLKCTRL(am33xx_gpmc_hwmod, AM43XX_CM_PER_GPMC_CLKCTRL_OFFSET); 350 408 CLKCTRL(am33xx_l4_ls_hwmod, AM43XX_CM_PER_L4LS_CLKCTRL_OFFSET);
-10
arch/arm/mach-omap2/omap_hwmod_33xx_data.c
··· 265 265 .user = OCP_USER_MPU, 266 266 }; 267 267 268 - /* l4 wkup -> timer1 */ 269 - static struct omap_hwmod_ocp_if am33xx_l4_wkup__timer1 = { 270 - .master = &am33xx_l4_wkup_hwmod, 271 - .slave = &am33xx_timer1_hwmod, 272 - .clk = "dpll_core_m4_div2_ck", 273 - .user = OCP_USER_MPU, 274 - }; 275 - 276 268 static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = { 277 269 &am33xx_l3_main__emif, 278 270 &am33xx_mpu__l3_main, ··· 283 291 &am33xx_l4_wkup__control, 284 292 &am33xx_l4_wkup__smartreflex0, 285 293 &am33xx_l4_wkup__smartreflex1, 286 - &am33xx_l4_wkup__timer1, 287 294 &am33xx_l4_wkup__rtc, 288 - &am33xx_l4_ls__timer2, 289 295 &am33xx_l3_s__gpmc, 290 296 &am33xx_l3_main__ocmc, 291 297 NULL,
+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.
-45
arch/arm/mach-omap2/omap_hwmod_43xx_data.c
··· 85 85 }, 86 86 }; 87 87 88 - static struct omap_hwmod_class_sysconfig am43xx_synctimer_sysc = { 89 - .rev_offs = 0x0, 90 - .sysc_offs = 0x4, 91 - .sysc_flags = SYSC_HAS_SIDLEMODE, 92 - .idlemodes = (SIDLE_FORCE | SIDLE_NO), 93 - .sysc_fields = &omap_hwmod_sysc_type1, 94 - }; 95 - 96 - static struct omap_hwmod_class am43xx_synctimer_hwmod_class = { 97 - .name = "synctimer", 98 - .sysc = &am43xx_synctimer_sysc, 99 - }; 100 - 101 - static struct omap_hwmod am43xx_synctimer_hwmod = { 102 - .name = "counter_32k", 103 - .class = &am43xx_synctimer_hwmod_class, 104 - .clkdm_name = "l4_wkup_aon_clkdm", 105 - .flags = HWMOD_SWSUP_SIDLE, 106 - .main_clk = "synctimer_32kclk", 107 - .prcm = { 108 - .omap4 = { 109 - .clkctrl_offs = AM43XX_CM_WKUP_SYNCTIMER_CLKCTRL_OFFSET, 110 - .modulemode = MODULEMODE_SWCTRL, 111 - }, 112 - }, 113 - }; 114 - 115 - 116 88 static struct omap_hwmod_class_sysconfig am43xx_usb_otg_ss_sysc = { 117 89 .rev_offs = 0x0000, 118 90 .sysc_offs = 0x0010, ··· 178 206 .user = OCP_USER_MPU, 179 207 }; 180 208 181 - static struct omap_hwmod_ocp_if am43xx_l4_wkup__timer1 = { 182 - .master = &am33xx_l4_wkup_hwmod, 183 - .slave = &am33xx_timer1_hwmod, 184 - .clk = "sys_clkin_ck", 185 - .user = OCP_USER_MPU, 186 - }; 187 - 188 - static struct omap_hwmod_ocp_if am33xx_l4_wkup__synctimer = { 189 - .master = &am33xx_l4_wkup_hwmod, 190 - .slave = &am43xx_synctimer_hwmod, 191 - .clk = "sys_clkin_ck", 192 - .user = OCP_USER_MPU, 193 - }; 194 - 195 209 static struct omap_hwmod_ocp_if am43xx_l3_s__usbotgss0 = { 196 210 .master = &am33xx_l3_s_hwmod, 197 211 .slave = &am43xx_usb_otg_ss0_hwmod, ··· 193 235 }; 194 236 195 237 static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = { 196 - &am33xx_l4_wkup__synctimer, 197 238 &am33xx_mpu__l3_main, 198 239 &am33xx_mpu__prcm, 199 240 &am33xx_l3_s__l4_ls, ··· 209 252 &am43xx_l4_wkup__control, 210 253 &am43xx_l4_wkup__smartreflex0, 211 254 &am43xx_l4_wkup__smartreflex1, 212 - &am43xx_l4_wkup__timer1, 213 - &am33xx_l4_ls__timer2, 214 255 &am33xx_l3_s__gpmc, 215 256 &am33xx_l3_main__ocmc, 216 257 &am43xx_l3_s__usbotgss0,
-90
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
··· 232 232 */ 233 233 234 234 /* 235 - * 'counter' class 236 - * 32-bit ordinary counter, clocked by the falling edge of the 32 khz clock 237 - */ 238 - 239 - static struct omap_hwmod_class_sysconfig omap44xx_counter_sysc = { 240 - .rev_offs = 0x0000, 241 - .sysc_offs = 0x0004, 242 - .sysc_flags = SYSC_HAS_SIDLEMODE, 243 - .idlemodes = (SIDLE_FORCE | SIDLE_NO), 244 - .sysc_fields = &omap_hwmod_sysc_type1, 245 - }; 246 - 247 - static struct omap_hwmod_class omap44xx_counter_hwmod_class = { 248 - .name = "counter", 249 - .sysc = &omap44xx_counter_sysc, 250 - }; 251 - 252 - /* counter_32k */ 253 - static struct omap_hwmod omap44xx_counter_32k_hwmod = { 254 - .name = "counter_32k", 255 - .class = &omap44xx_counter_hwmod_class, 256 - .clkdm_name = "l4_wkup_clkdm", 257 - .flags = HWMOD_SWSUP_SIDLE, 258 - .main_clk = "sys_32k_ck", 259 - .prcm = { 260 - .omap4 = { 261 - .clkctrl_offs = OMAP4_CM_WKUP_SYNCTIMER_CLKCTRL_OFFSET, 262 - .context_offs = OMAP4_RM_WKUP_SYNCTIMER_CONTEXT_OFFSET, 263 - }, 264 - }, 265 - }; 266 - 267 - /* 268 235 * 'ctrl_module' class 269 236 * attila core control module + core pad control module + wkup pad control 270 237 * module + attila wkup control module ··· 640 673 }; 641 674 642 675 /* 643 - * 'timer' class 644 - * general purpose timer module with accurate 1ms tick 645 - * This class contains several variants: ['timer_1ms', 'timer'] 646 - */ 647 - 648 - static struct omap_hwmod_class_sysconfig omap44xx_timer_1ms_sysc = { 649 - .rev_offs = 0x0000, 650 - .sysc_offs = 0x0010, 651 - .syss_offs = 0x0014, 652 - .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY | 653 - SYSC_HAS_EMUFREE | SYSC_HAS_ENAWAKEUP | 654 - SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | 655 - SYSS_HAS_RESET_STATUS), 656 - .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 657 - .sysc_fields = &omap_hwmod_sysc_type1, 658 - }; 659 - 660 - static struct omap_hwmod_class omap44xx_timer_1ms_hwmod_class = { 661 - .name = "timer", 662 - .sysc = &omap44xx_timer_1ms_sysc, 663 - }; 664 - 665 - /* timer1 */ 666 - static struct omap_hwmod omap44xx_timer1_hwmod = { 667 - .name = "timer1", 668 - .class = &omap44xx_timer_1ms_hwmod_class, 669 - .clkdm_name = "l4_wkup_clkdm", 670 - .flags = HWMOD_SET_DEFAULT_CLOCKACT, 671 - .main_clk = "dmt1_clk_mux", 672 - .prcm = { 673 - .omap4 = { 674 - .clkctrl_offs = OMAP4_CM_WKUP_TIMER1_CLKCTRL_OFFSET, 675 - .context_offs = OMAP4_RM_WKUP_TIMER1_CONTEXT_OFFSET, 676 - .modulemode = MODULEMODE_SWCTRL, 677 - }, 678 - }, 679 - }; 680 - 681 - /* 682 676 * 'usb_host_fs' class 683 677 * full-speed usb host controller 684 678 */ ··· 991 1063 .user = OCP_USER_MPU | OCP_USER_SDMA, 992 1064 }; 993 1065 994 - /* l4_wkup -> counter_32k */ 995 - static struct omap_hwmod_ocp_if omap44xx_l4_wkup__counter_32k = { 996 - .master = &omap44xx_l4_wkup_hwmod, 997 - .slave = &omap44xx_counter_32k_hwmod, 998 - .clk = "l4_wkup_clk_mux_ck", 999 - .user = OCP_USER_MPU | OCP_USER_SDMA, 1000 - }; 1001 - 1002 1066 /* l4_cfg -> ctrl_module_core */ 1003 1067 static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ctrl_module_core = { 1004 1068 .master = &omap44xx_l4_cfg_hwmod, ··· 1119 1199 .user = OCP_USER_MPU | OCP_USER_SDMA, 1120 1200 }; 1121 1201 1122 - /* l4_wkup -> timer1 */ 1123 - static struct omap_hwmod_ocp_if omap44xx_l4_wkup__timer1 = { 1124 - .master = &omap44xx_l4_wkup_hwmod, 1125 - .slave = &omap44xx_timer1_hwmod, 1126 - .clk = "l4_wkup_clk_mux_ck", 1127 - .user = OCP_USER_MPU | OCP_USER_SDMA, 1128 - }; 1129 - 1130 1202 /* l4_cfg -> usb_host_fs */ 1131 1203 static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_cfg__usb_host_fs = { 1132 1204 .master = &omap44xx_l4_cfg_hwmod, ··· 1185 1273 &omap44xx_l4_cfg__l4_wkup, 1186 1274 &omap44xx_mpu__mpu_private, 1187 1275 &omap44xx_l4_cfg__ocp_wp_noc, 1188 - &omap44xx_l4_wkup__counter_32k, 1189 1276 &omap44xx_l4_cfg__ctrl_module_core, 1190 1277 &omap44xx_l4_cfg__ctrl_module_pad_core, 1191 1278 &omap44xx_l4_wkup__ctrl_module_wkup, ··· 1201 1290 &omap44xx_l4_wkup__prm, 1202 1291 &omap44xx_l4_wkup__scrm, 1203 1292 /* &omap44xx_l3_main_2__sl2if, */ 1204 - &omap44xx_l4_wkup__timer1, 1205 1293 /* &omap44xx_l4_cfg__usb_host_fs, */ 1206 1294 &omap44xx_l4_cfg__usb_host_hs, 1207 1295 &omap44xx_l4_cfg__usb_tll_hs,
-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,
-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,
-3
arch/arm/mach-omap2/omap_hwmod_common_data.h
··· 21 21 extern struct omap_hwmod omap2xxx_l4_wkup_hwmod; 22 22 extern struct omap_hwmod omap2xxx_mpu_hwmod; 23 23 extern struct omap_hwmod omap2xxx_iva_hwmod; 24 - extern struct omap_hwmod omap2xxx_timer1_hwmod; 25 - extern struct omap_hwmod omap2xxx_timer2_hwmod; 26 24 extern struct omap_hwmod omap2xxx_timer3_hwmod; 27 25 extern struct omap_hwmod omap2xxx_timer4_hwmod; 28 26 extern struct omap_hwmod omap2xxx_timer5_hwmod; ··· 45 47 extern struct omap_hwmod omap2xxx_gpio4_hwmod; 46 48 extern struct omap_hwmod omap2xxx_mcspi1_hwmod; 47 49 extern struct omap_hwmod omap2xxx_mcspi2_hwmod; 48 - extern struct omap_hwmod omap2xxx_counter_32k_hwmod; 49 50 extern struct omap_hwmod omap2xxx_gpmc_hwmod; 50 51 extern struct omap_hwmod omap2xxx_rng_hwmod; 51 52 extern struct omap_hwmod omap2xxx_sham_hwmod;
+1 -567
arch/arm/mach-omap2/timer.c
··· 26 26 * License. See the file "COPYING" in the main directory of this archive 27 27 * for more details. 28 28 */ 29 - #include <linux/init.h> 30 - #include <linux/time.h> 31 - #include <linux/interrupt.h> 32 - #include <linux/err.h> 33 29 #include <linux/clk.h> 34 - #include <linux/delay.h> 35 - #include <linux/irq.h> 36 30 #include <linux/clocksource.h> 37 - #include <linux/clockchips.h> 38 - #include <linux/slab.h> 39 - #include <linux/of.h> 40 - #include <linux/of_address.h> 41 - #include <linux/of_irq.h> 42 - #include <linux/platform_device.h> 43 - #include <linux/platform_data/dmtimer-omap.h> 44 - #include <linux/sched_clock.h> 45 - 46 - #include <asm/mach/time.h> 47 - 48 - #include "omap_hwmod.h" 49 - #include "omap_device.h" 50 - #include <plat/counter-32k.h> 51 - #include <clocksource/timer-ti-dm.h> 52 31 53 32 #include "soc.h" 54 33 #include "common.h" 55 34 #include "control.h" 56 - #include "powerdomain.h" 57 35 #include "omap-secure.h" 58 36 59 37 #define REALTIME_COUNTER_BASE 0x48243200 ··· 39 61 #define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 40 62 #define NUMERATOR_DENUMERATOR_MASK 0xfffff000 41 63 42 - /* Clockevent code */ 43 - 44 - static struct omap_dm_timer clkev; 45 - static struct clock_event_device clockevent_gpt; 46 - 47 - /* Clockevent hwmod for am335x and am437x suspend */ 48 - static struct omap_hwmod *clockevent_gpt_hwmod; 49 - 50 - /* Clockesource hwmod for am437x suspend */ 51 - static struct omap_hwmod *clocksource_gpt_hwmod; 52 - 53 - #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER 54 64 static unsigned long arch_timer_freq; 55 65 56 66 void set_cntfreq(void) 57 67 { 58 68 omap_smc1(OMAP5_DRA7_MON_SET_CNTFRQ_INDEX, arch_timer_freq); 59 69 } 60 - #endif 61 - 62 - static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) 63 - { 64 - struct clock_event_device *evt = &clockevent_gpt; 65 - 66 - __omap_dm_timer_write_status(&clkev, OMAP_TIMER_INT_OVERFLOW); 67 - 68 - evt->event_handler(evt); 69 - return IRQ_HANDLED; 70 - } 71 - 72 - static int omap2_gp_timer_set_next_event(unsigned long cycles, 73 - struct clock_event_device *evt) 74 - { 75 - __omap_dm_timer_load_start(&clkev, OMAP_TIMER_CTRL_ST, 76 - 0xffffffff - cycles, OMAP_TIMER_POSTED); 77 - 78 - return 0; 79 - } 80 - 81 - static int omap2_gp_timer_shutdown(struct clock_event_device *evt) 82 - { 83 - __omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate); 84 - return 0; 85 - } 86 - 87 - static int omap2_gp_timer_set_periodic(struct clock_event_device *evt) 88 - { 89 - u32 period; 90 - 91 - __omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate); 92 - 93 - period = clkev.rate / HZ; 94 - period -= 1; 95 - /* Looks like we need to first set the load value separately */ 96 - __omap_dm_timer_write(&clkev, OMAP_TIMER_LOAD_REG, 0xffffffff - period, 97 - OMAP_TIMER_POSTED); 98 - __omap_dm_timer_load_start(&clkev, 99 - OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST, 100 - 0xffffffff - period, OMAP_TIMER_POSTED); 101 - return 0; 102 - } 103 - 104 - static void omap_clkevt_idle(struct clock_event_device *unused) 105 - { 106 - if (!clockevent_gpt_hwmod) 107 - return; 108 - 109 - omap_hwmod_idle(clockevent_gpt_hwmod); 110 - } 111 - 112 - static void omap_clkevt_unidle(struct clock_event_device *unused) 113 - { 114 - if (!clockevent_gpt_hwmod) 115 - return; 116 - 117 - omap_hwmod_enable(clockevent_gpt_hwmod); 118 - __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW); 119 - } 120 - 121 - static struct clock_event_device clockevent_gpt = { 122 - .features = CLOCK_EVT_FEAT_PERIODIC | 123 - CLOCK_EVT_FEAT_ONESHOT, 124 - .rating = 300, 125 - .set_next_event = omap2_gp_timer_set_next_event, 126 - .set_state_shutdown = omap2_gp_timer_shutdown, 127 - .set_state_periodic = omap2_gp_timer_set_periodic, 128 - .set_state_oneshot = omap2_gp_timer_shutdown, 129 - .tick_resume = omap2_gp_timer_shutdown, 130 - }; 131 - 132 - static const struct of_device_id omap_timer_match[] __initconst = { 133 - { .compatible = "ti,omap2420-timer", }, 134 - { .compatible = "ti,omap3430-timer", }, 135 - { .compatible = "ti,omap4430-timer", }, 136 - { .compatible = "ti,omap5430-timer", }, 137 - { .compatible = "ti,dm814-timer", }, 138 - { .compatible = "ti,dm816-timer", }, 139 - { .compatible = "ti,am335x-timer", }, 140 - { .compatible = "ti,am335x-timer-1ms", }, 141 - { } 142 - }; 143 - 144 - static int omap_timer_add_disabled_property(struct device_node *np) 145 - { 146 - struct property *prop; 147 - 148 - prop = kzalloc(sizeof(*prop), GFP_KERNEL); 149 - if (!prop) 150 - return -ENOMEM; 151 - 152 - prop->name = "status"; 153 - prop->value = "disabled"; 154 - prop->length = strlen(prop->value); 155 - 156 - return of_add_property(np, prop); 157 - } 158 - 159 - static int omap_timer_update_dt(struct device_node *np) 160 - { 161 - int error = 0; 162 - 163 - if (!of_device_is_compatible(np, "ti,omap-counter32k")) { 164 - error = omap_timer_add_disabled_property(np); 165 - if (error) 166 - return error; 167 - } 168 - 169 - /* No parent interconnect target module configured? */ 170 - if (of_get_property(np, "ti,hwmods", NULL)) 171 - return error; 172 - 173 - /* Tag parent interconnect target module disabled */ 174 - error = omap_timer_add_disabled_property(np->parent); 175 - if (error) 176 - return error; 177 - 178 - return 0; 179 - } 180 - 181 - /** 182 - * omap_get_timer_dt - get a timer using device-tree 183 - * @match - device-tree match structure for matching a device type 184 - * @property - optional timer property to match 185 - * 186 - * Helper function to get a timer during early boot using device-tree for use 187 - * as kernel system timer. Optionally, the property argument can be used to 188 - * select a timer with a specific property. Once a timer is found then mark 189 - * the timer node in device-tree as disabled, to prevent the kernel from 190 - * registering this timer as a platform device and so no one else can use it. 191 - */ 192 - static struct device_node * __init omap_get_timer_dt(const struct of_device_id *match, 193 - const char *property) 194 - { 195 - struct device_node *np; 196 - int error; 197 - 198 - for_each_matching_node(np, match) { 199 - if (!of_device_is_available(np)) 200 - continue; 201 - 202 - if (property && !of_get_property(np, property, NULL)) 203 - continue; 204 - 205 - if (!property && (of_get_property(np, "ti,timer-alwon", NULL) || 206 - of_get_property(np, "ti,timer-dsp", NULL) || 207 - of_get_property(np, "ti,timer-pwm", NULL) || 208 - of_get_property(np, "ti,timer-secure", NULL))) 209 - continue; 210 - 211 - error = omap_timer_update_dt(np); 212 - WARN(error, "%s: Could not update dt: %i\n", __func__, error); 213 - 214 - return np; 215 - } 216 - 217 - return NULL; 218 - } 219 - 220 - /** 221 - * omap_dmtimer_init - initialisation function when device tree is used 222 - * 223 - * For secure OMAP3/DRA7xx devices, timers with device type "timer-secure" 224 - * cannot be used by the kernel as they are reserved. Therefore, to prevent the 225 - * kernel registering these devices remove them dynamically from the device 226 - * tree on boot. 227 - */ 228 - static void __init omap_dmtimer_init(void) 229 - { 230 - struct device_node *np; 231 - 232 - if (!cpu_is_omap34xx() && !soc_is_dra7xx()) 233 - return; 234 - 235 - /* If we are a secure device, remove any secure timer nodes */ 236 - if ((omap_type() != OMAP2_DEVICE_TYPE_GP)) { 237 - np = omap_get_timer_dt(omap_timer_match, "ti,timer-secure"); 238 - of_node_put(np); 239 - } 240 - } 241 - 242 - /** 243 - * omap_dm_timer_get_errata - get errata flags for a timer 244 - * 245 - * Get the timer errata flags that are specific to the OMAP device being used. 246 - */ 247 - static u32 __init omap_dm_timer_get_errata(void) 248 - { 249 - if (cpu_is_omap24xx()) 250 - return 0; 251 - 252 - return OMAP_TIMER_ERRATA_I103_I767; 253 - } 254 - 255 - static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, 256 - const char *fck_source, 257 - const char *property, 258 - const char **timer_name, 259 - int posted) 260 - { 261 - const char *oh_name = NULL; 262 - struct device_node *np; 263 - struct omap_hwmod *oh; 264 - struct clk *src; 265 - int r = 0; 266 - 267 - np = omap_get_timer_dt(omap_timer_match, property); 268 - if (!np) 269 - return -ENODEV; 270 - 271 - of_property_read_string_index(np, "ti,hwmods", 0, &oh_name); 272 - if (!oh_name) { 273 - of_property_read_string_index(np->parent, "ti,hwmods", 0, 274 - &oh_name); 275 - if (!oh_name) 276 - return -ENODEV; 277 - } 278 - 279 - timer->irq = irq_of_parse_and_map(np, 0); 280 - if (!timer->irq) 281 - return -ENXIO; 282 - 283 - timer->io_base = of_iomap(np, 0); 284 - 285 - timer->fclk = of_clk_get_by_name(np, "fck"); 286 - 287 - of_node_put(np); 288 - 289 - oh = omap_hwmod_lookup(oh_name); 290 - if (!oh) 291 - return -ENODEV; 292 - 293 - *timer_name = oh->name; 294 - 295 - if (!timer->io_base) 296 - return -ENXIO; 297 - 298 - omap_hwmod_setup_one(oh_name); 299 - 300 - /* After the dmtimer is using hwmod these clocks won't be needed */ 301 - if (IS_ERR_OR_NULL(timer->fclk)) 302 - timer->fclk = clk_get(NULL, omap_hwmod_get_main_clk(oh)); 303 - if (IS_ERR(timer->fclk)) 304 - return PTR_ERR(timer->fclk); 305 - 306 - src = clk_get(NULL, fck_source); 307 - if (IS_ERR(src)) 308 - return PTR_ERR(src); 309 - 310 - WARN(clk_set_parent(timer->fclk, src) < 0, 311 - "Cannot set timer parent clock, no PLL clock driver?"); 312 - 313 - clk_put(src); 314 - 315 - omap_hwmod_enable(oh); 316 - __omap_dm_timer_init_regs(timer); 317 - 318 - if (posted) 319 - __omap_dm_timer_enable_posted(timer); 320 - 321 - /* Check that the intended posted configuration matches the actual */ 322 - if (posted != timer->posted) 323 - return -EINVAL; 324 - 325 - timer->rate = clk_get_rate(timer->fclk); 326 - timer->reserved = 1; 327 - 328 - return r; 329 - } 330 70 331 71 #if !defined(CONFIG_SMP) && defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) 332 72 void tick_broadcast(const struct cpumask *mask) 333 73 { 334 - } 335 - #endif 336 - 337 - static void __init omap2_gp_clockevent_init(int gptimer_id, 338 - const char *fck_source, 339 - const char *property) 340 - { 341 - int res; 342 - 343 - clkev.id = gptimer_id; 344 - clkev.errata = omap_dm_timer_get_errata(); 345 - 346 - /* 347 - * For clock-event timers we never read the timer counter and 348 - * so we are not impacted by errata i103 and i767. Therefore, 349 - * we can safely ignore this errata for clock-event timers. 350 - */ 351 - __omap_dm_timer_override_errata(&clkev, OMAP_TIMER_ERRATA_I103_I767); 352 - 353 - res = omap_dm_timer_init_one(&clkev, fck_source, property, 354 - &clockevent_gpt.name, OMAP_TIMER_POSTED); 355 - BUG_ON(res); 356 - 357 - if (request_irq(clkev.irq, omap2_gp_timer_interrupt, 358 - IRQF_TIMER | IRQF_IRQPOLL, "gp_timer", &clkev)) 359 - pr_err("Failed to request irq %d (gp_timer)\n", clkev.irq); 360 - 361 - __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW); 362 - 363 - clockevent_gpt.cpumask = cpu_possible_mask; 364 - clockevent_gpt.irq = omap_dm_timer_get_irq(&clkev); 365 - clockevents_config_and_register(&clockevent_gpt, clkev.rate, 366 - 3, /* Timer internal resynch latency */ 367 - 0xffffffff); 368 - 369 - if (soc_is_am33xx() || soc_is_am43xx()) { 370 - clockevent_gpt.suspend = omap_clkevt_idle; 371 - clockevent_gpt.resume = omap_clkevt_unidle; 372 - 373 - clockevent_gpt_hwmod = 374 - omap_hwmod_lookup(clockevent_gpt.name); 375 - } 376 - 377 - pr_info("OMAP clockevent source: %s at %lu Hz\n", clockevent_gpt.name, 378 - clkev.rate); 379 - } 380 - 381 - /* Clocksource code */ 382 - static struct omap_dm_timer clksrc; 383 - static bool use_gptimer_clksrc __initdata; 384 - 385 - /* 386 - * clocksource 387 - */ 388 - static u64 clocksource_read_cycles(struct clocksource *cs) 389 - { 390 - return (u64)__omap_dm_timer_read_counter(&clksrc, 391 - OMAP_TIMER_NONPOSTED); 392 - } 393 - 394 - static struct clocksource clocksource_gpt = { 395 - .rating = 300, 396 - .read = clocksource_read_cycles, 397 - .mask = CLOCKSOURCE_MASK(32), 398 - .flags = CLOCK_SOURCE_IS_CONTINUOUS, 399 - }; 400 - 401 - static u64 notrace dmtimer_read_sched_clock(void) 402 - { 403 - if (clksrc.reserved) 404 - return __omap_dm_timer_read_counter(&clksrc, 405 - OMAP_TIMER_NONPOSTED); 406 - 407 - return 0; 408 - } 409 - 410 - static const struct of_device_id omap_counter_match[] __initconst = { 411 - { .compatible = "ti,omap-counter32k", }, 412 - { } 413 - }; 414 - 415 - /* Setup free-running counter for clocksource */ 416 - static int __init __maybe_unused omap2_sync32k_clocksource_init(void) 417 - { 418 - int ret; 419 - struct device_node *np = NULL; 420 - struct omap_hwmod *oh; 421 - const char *oh_name = "counter_32k"; 422 - 423 - /* 424 - * See if the 32kHz counter is supported. 425 - */ 426 - np = omap_get_timer_dt(omap_counter_match, NULL); 427 - if (!np) 428 - return -ENODEV; 429 - 430 - of_property_read_string_index(np->parent, "ti,hwmods", 0, &oh_name); 431 - if (!oh_name) { 432 - of_property_read_string_index(np, "ti,hwmods", 0, &oh_name); 433 - if (!oh_name) 434 - return -ENODEV; 435 - } 436 - 437 - /* 438 - * First check hwmod data is available for sync32k counter 439 - */ 440 - oh = omap_hwmod_lookup(oh_name); 441 - if (!oh || oh->slaves_cnt == 0) 442 - return -ENODEV; 443 - 444 - omap_hwmod_setup_one(oh_name); 445 - 446 - ret = omap_hwmod_enable(oh); 447 - if (ret) { 448 - pr_warn("%s: failed to enable counter_32k module (%d)\n", 449 - __func__, ret); 450 - return ret; 451 - } 452 - 453 - return ret; 454 - } 455 - 456 - static unsigned int omap2_gptimer_clksrc_load; 457 - 458 - static void omap2_gptimer_clksrc_suspend(struct clocksource *unused) 459 - { 460 - omap2_gptimer_clksrc_load = 461 - __omap_dm_timer_read_counter(&clksrc, OMAP_TIMER_NONPOSTED); 462 - 463 - omap_hwmod_idle(clocksource_gpt_hwmod); 464 - } 465 - 466 - static void omap2_gptimer_clksrc_resume(struct clocksource *unused) 467 - { 468 - omap_hwmod_enable(clocksource_gpt_hwmod); 469 - 470 - __omap_dm_timer_load_start(&clksrc, 471 - OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 472 - omap2_gptimer_clksrc_load, 473 - OMAP_TIMER_NONPOSTED); 474 - } 475 - 476 - static void __init omap2_gptimer_clocksource_init(int gptimer_id, 477 - const char *fck_source, 478 - const char *property) 479 - { 480 - int res; 481 - 482 - clksrc.id = gptimer_id; 483 - clksrc.errata = omap_dm_timer_get_errata(); 484 - 485 - res = omap_dm_timer_init_one(&clksrc, fck_source, property, 486 - &clocksource_gpt.name, 487 - OMAP_TIMER_NONPOSTED); 488 - 489 - if (soc_is_am43xx()) { 490 - clocksource_gpt.suspend = omap2_gptimer_clksrc_suspend; 491 - clocksource_gpt.resume = omap2_gptimer_clksrc_resume; 492 - 493 - clocksource_gpt_hwmod = 494 - omap_hwmod_lookup(clocksource_gpt.name); 495 - } 496 - 497 - BUG_ON(res); 498 - 499 - __omap_dm_timer_load_start(&clksrc, 500 - OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 501 - OMAP_TIMER_NONPOSTED); 502 - sched_clock_register(dmtimer_read_sched_clock, 32, clksrc.rate); 503 - 504 - if (clocksource_register_hz(&clocksource_gpt, clksrc.rate)) 505 - pr_err("Could not register clocksource %s\n", 506 - clocksource_gpt.name); 507 - else 508 - pr_info("OMAP clocksource: %s at %lu Hz\n", 509 - clocksource_gpt.name, clksrc.rate); 510 - } 511 - 512 - static void __init __omap_sync32k_timer_init(int clkev_nr, const char *clkev_src, 513 - const char *clkev_prop, int clksrc_nr, const char *clksrc_src, 514 - const char *clksrc_prop, bool gptimer) 515 - { 516 - omap_clk_init(); 517 - omap_dmtimer_init(); 518 - omap2_gp_clockevent_init(clkev_nr, clkev_src, clkev_prop); 519 - 520 - /* Enable the use of clocksource="gp_timer" kernel parameter */ 521 - if (clksrc_nr && (use_gptimer_clksrc || gptimer)) 522 - omap2_gptimer_clocksource_init(clksrc_nr, clksrc_src, 523 - clksrc_prop); 524 - else 525 - omap2_sync32k_clocksource_init(); 526 - } 527 - 528 - void __init omap_init_time(void) 529 - { 530 - __omap_sync32k_timer_init(1, "timer_32k_ck", "ti,timer-alwon", 531 - 2, "timer_sys_ck", NULL, false); 532 - 533 - timer_probe(); 534 - } 535 - 536 - #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM43XX) 537 - void __init omap3_secure_sync32k_timer_init(void) 538 - { 539 - __omap_sync32k_timer_init(12, "secure_32k_fck", "ti,timer-secure", 540 - 2, "timer_sys_ck", NULL, false); 541 - 542 - timer_probe(); 543 - } 544 - #endif /* CONFIG_ARCH_OMAP3 */ 545 - 546 - #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) || \ 547 - defined(CONFIG_SOC_AM43XX) 548 - void __init omap3_gptimer_timer_init(void) 549 - { 550 - __omap_sync32k_timer_init(2, "timer_sys_ck", NULL, 551 - 1, "timer_sys_ck", "ti,timer-alwon", true); 552 - if (of_have_populated_dt()) 553 - timer_probe(); 554 - } 555 - #endif 556 - 557 - #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ 558 - defined(CONFIG_SOC_DRA7XX) 559 - static void __init omap4_sync32k_timer_init(void) 560 - { 561 - __omap_sync32k_timer_init(1, "timer_32k_ck", "ti,timer-alwon", 562 - 0, NULL, NULL, false); 563 - } 564 - 565 - void __init omap4_local_timer_init(void) 566 - { 567 - omap4_sync32k_timer_init(); 568 - timer_probe(); 569 74 } 570 75 #endif 571 76 ··· 65 604 */ 66 605 static void __init realtime_counter_init(void) 67 606 { 68 - #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER 69 607 void __iomem *base; 70 608 static struct clk *sys_clk; 71 609 unsigned long rate; ··· 163 703 set_cntfreq(); 164 704 165 705 iounmap(base); 166 - #endif 167 706 } 168 707 169 708 void __init omap5_realtime_timer_init(void) 170 709 { 171 - omap4_sync32k_timer_init(); 710 + omap_clk_init(); 172 711 realtime_counter_init(); 173 712 174 713 timer_probe(); 175 714 } 176 715 #endif /* CONFIG_SOC_OMAP5 || CONFIG_SOC_DRA7XX */ 177 - 178 - /** 179 - * omap2_override_clocksource - clocksource override with user configuration 180 - * 181 - * Allows user to override default clocksource, using kernel parameter 182 - * clocksource="gp_timer" (For all OMAP2PLUS architectures) 183 - * 184 - * Note that, here we are using same standard kernel parameter "clocksource=", 185 - * and not introducing any OMAP specific interface. 186 - */ 187 - static int __init omap2_override_clocksource(char *str) 188 - { 189 - if (!str) 190 - return 0; 191 - /* 192 - * For OMAP architecture, we only have two options 193 - * - sync_32k (default) 194 - * - gp_timer (sys_clk based) 195 - */ 196 - if (!strcmp(str, "gp_timer")) 197 - use_gptimer_clksrc = true; 198 - 199 - return 0; 200 - } 201 - early_param("clocksource", omap2_override_clocksource);
+18 -7
drivers/bus/ti-sysc.c
··· 1275 1275 SYSC_QUIRK_LEGACY_IDLE), 1276 1276 SYSC_QUIRK("smartreflex", 0, -ENODEV, 0x38, -ENODEV, 0x00000000, 0xffffffff, 1277 1277 SYSC_QUIRK_LEGACY_IDLE), 1278 - SYSC_QUIRK("timer", 0, 0, 0x10, 0x14, 0x00000015, 0xffffffff, 1279 - 0), 1280 - /* Some timers on omap4 and later */ 1281 - SYSC_QUIRK("timer", 0, 0, 0x10, -ENODEV, 0x50002100, 0xffffffff, 1282 - 0), 1283 - SYSC_QUIRK("timer", 0, 0, 0x10, -ENODEV, 0x4fff1301, 0xffff00ff, 1284 - 0), 1285 1278 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000046, 0xffffffff, 1286 1279 SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), 1287 1280 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff, ··· 1397 1404 SYSC_QUIRK("slimbus", 0, 0, 0x10, -ENODEV, 0x40002903, 0xffffffff, 0), 1398 1405 SYSC_QUIRK("spinlock", 0, 0, 0x10, -ENODEV, 0x50020000, 0xffffffff, 0), 1399 1406 SYSC_QUIRK("rng", 0, 0x1fe0, 0x1fe4, -ENODEV, 0x00000020, 0xffffffff, 0), 1407 + SYSC_QUIRK("timer", 0, 0, 0x10, 0x14, 0x00000013, 0xffffffff, 0), 1408 + SYSC_QUIRK("timer", 0, 0, 0x10, 0x14, 0x00000015, 0xffffffff, 0), 1409 + /* Some timers on omap4 and later */ 1410 + SYSC_QUIRK("timer", 0, 0, 0x10, -ENODEV, 0x50002100, 0xffffffff, 0), 1411 + SYSC_QUIRK("timer", 0, 0, 0x10, -ENODEV, 0x4fff1301, 0xffff00ff, 0), 1412 + SYSC_QUIRK("timer32k", 0, 0, 0x4, -ENODEV, 0x00000040, 0xffffffff, 0), 1413 + SYSC_QUIRK("timer32k", 0, 0, 0x4, -ENODEV, 0x00000011, 0xffffffff, 0), 1400 1414 SYSC_QUIRK("timer32k", 0, 0, 0x4, -ENODEV, 0x00000060, 0xffffffff, 0), 1401 1415 SYSC_QUIRK("tpcc", 0, 0, -ENODEV, -ENODEV, 0x40014c00, 0xffffffff, 0), 1402 1416 SYSC_QUIRK("usbhstll", 0, 0, 0x10, 0x14, 0x00000004, 0xffffffff, 0), ··· 2743 2743 match = soc_device_match(sysc_soc_match); 2744 2744 if (match && match->data) 2745 2745 sysc_soc->soc = (int)match->data; 2746 + 2747 + /* Ignore devices that are not available on HS and EMU SoCs */ 2748 + if (!sysc_soc->general_purpose) { 2749 + switch (sysc_soc->soc) { 2750 + case SOC_3430 ... SOC_3630: 2751 + sysc_add_disabled(0x48304000); /* timer12 */ 2752 + break; 2753 + default: 2754 + break; 2755 + }; 2756 + } 2746 2757 2747 2758 match = soc_device_match(sysc_soc_feat_match); 2748 2759 if (!match)
+1
drivers/clk/ti/clk-816x.c
··· 73 73 "ddr_pll_clk1", 74 74 "ddr_pll_clk2", 75 75 "ddr_pll_clk3", 76 + "sysclk6_ck", 76 77 }; 77 78 78 79 int __init dm816x_dt_clk_init(void)
+1
drivers/clocksource/Makefile
··· 18 18 obj-$(CONFIG_DAVINCI_TIMER) += timer-davinci.o 19 19 obj-$(CONFIG_DIGICOLOR_TIMER) += timer-digicolor.o 20 20 obj-$(CONFIG_OMAP_DM_TIMER) += timer-ti-dm.o 21 + obj-$(CONFIG_OMAP_DM_TIMER) += timer-ti-dm-systimer.o 21 22 obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o 22 23 obj-$(CONFIG_DW_APB_TIMER_OF) += dw_apb_timer_of.o 23 24 obj-$(CONFIG_FTTMR010_TIMER) += timer-fttmr010.o
+47 -1
drivers/clocksource/timer-ti-32k.c
··· 24 24 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com 25 25 */ 26 26 27 + #include <linux/clk.h> 27 28 #include <linux/init.h> 28 29 #include <linux/time.h> 29 30 #include <linux/sched_clock.h> ··· 77 76 return ti_32k_read_cycles(&ti_32k_timer.cs); 78 77 } 79 78 79 + static void __init ti_32k_timer_enable_clock(struct device_node *np, 80 + const char *name) 81 + { 82 + struct clk *clock; 83 + int error; 84 + 85 + clock = of_clk_get_by_name(np->parent, name); 86 + if (IS_ERR(clock)) { 87 + /* Only some SoCs have a separate interface clock */ 88 + if (PTR_ERR(clock) == -EINVAL && !strncmp("ick", name, 3)) 89 + return; 90 + 91 + pr_warn("%s: could not get clock %s %li\n", 92 + __func__, name, PTR_ERR(clock)); 93 + return; 94 + } 95 + 96 + error = clk_prepare_enable(clock); 97 + if (error) { 98 + pr_warn("%s: could not enable %s: %i\n", 99 + __func__, name, error); 100 + return; 101 + } 102 + } 103 + 104 + static void __init ti_32k_timer_module_init(struct device_node *np, 105 + void __iomem *base) 106 + { 107 + void __iomem *sysc = base + 4; 108 + 109 + if (!of_device_is_compatible(np->parent, "ti,sysc")) 110 + return; 111 + 112 + ti_32k_timer_enable_clock(np, "fck"); 113 + ti_32k_timer_enable_clock(np, "ick"); 114 + 115 + /* 116 + * Force idle module as wkup domain is active with MPU. 117 + * No need to tag the module disabled for ti-sysc probe. 118 + */ 119 + writel_relaxed(0, sysc); 120 + } 121 + 80 122 static int __init ti_32k_timer_init(struct device_node *np) 81 123 { 82 124 int ret; ··· 134 90 ti_32k_timer.cs.flags |= CLOCK_SOURCE_SUSPEND_NONSTOP; 135 91 136 92 ti_32k_timer.counter = ti_32k_timer.base; 93 + ti_32k_timer_module_init(np, ti_32k_timer.base); 137 94 138 95 /* 139 96 * 32k sync Counter IP register offsets vary between the highlander ··· 149 104 else 150 105 ti_32k_timer.counter += OMAP2_32KSYNCNT_CR_OFF_LOW; 151 106 107 + pr_info("OMAP clocksource: 32k_counter at 32768 Hz\n"); 108 + 152 109 ret = clocksource_register_hz(&ti_32k_timer.cs, 32768); 153 110 if (ret) { 154 111 pr_err("32k_counter: can't register clocksource\n"); ··· 158 111 } 159 112 160 113 sched_clock_register(omap_32k_read_sched_clock, 32, 32768); 161 - pr_info("OMAP clocksource: 32k_counter at 32768 Hz\n"); 162 114 163 115 return 0; 164 116 }
+727
drivers/clocksource/timer-ti-dm-systimer.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + #include <linux/clk.h> 3 + #include <linux/clocksource.h> 4 + #include <linux/clockchips.h> 5 + #include <linux/interrupt.h> 6 + #include <linux/io.h> 7 + #include <linux/iopoll.h> 8 + #include <linux/err.h> 9 + #include <linux/of.h> 10 + #include <linux/of_address.h> 11 + #include <linux/of_irq.h> 12 + #include <linux/sched_clock.h> 13 + 14 + #include <linux/clk/clk-conf.h> 15 + 16 + #include <clocksource/timer-ti-dm.h> 17 + #include <dt-bindings/bus/ti-sysc.h> 18 + 19 + /* For type1, set SYSC_OMAP2_CLOCKACTIVITY for fck off on idle, l4 clock on */ 20 + #define DMTIMER_TYPE1_ENABLE ((1 << 9) | (SYSC_IDLE_SMART << 3) | \ 21 + SYSC_OMAP2_ENAWAKEUP | SYSC_OMAP2_AUTOIDLE) 22 + 23 + #define DMTIMER_TYPE2_ENABLE (SYSC_IDLE_SMART_WKUP << 2) 24 + #define DMTIMER_RESET_WAIT 100000 25 + 26 + #define DMTIMER_INST_DONT_CARE ~0U 27 + 28 + static int counter_32k; 29 + static u32 clocksource; 30 + static u32 clockevent; 31 + 32 + /* 33 + * Subset of the timer registers we use. Note that the register offsets 34 + * depend on the timer revision detected. 35 + */ 36 + struct dmtimer_systimer { 37 + void __iomem *base; 38 + u8 sysc; 39 + u8 irq_stat; 40 + u8 irq_ena; 41 + u8 pend; 42 + u8 load; 43 + u8 counter; 44 + u8 ctrl; 45 + u8 wakeup; 46 + u8 ifctrl; 47 + unsigned long rate; 48 + }; 49 + 50 + struct dmtimer_clockevent { 51 + struct clock_event_device dev; 52 + struct dmtimer_systimer t; 53 + u32 period; 54 + }; 55 + 56 + struct dmtimer_clocksource { 57 + struct clocksource dev; 58 + struct dmtimer_systimer t; 59 + unsigned int loadval; 60 + }; 61 + 62 + /* Assumes v1 ip if bits [31:16] are zero */ 63 + static bool dmtimer_systimer_revision1(struct dmtimer_systimer *t) 64 + { 65 + u32 tidr = readl_relaxed(t->base); 66 + 67 + return !(tidr >> 16); 68 + } 69 + 70 + static int __init dmtimer_systimer_type1_reset(struct dmtimer_systimer *t) 71 + { 72 + void __iomem *syss = t->base + OMAP_TIMER_V1_SYS_STAT_OFFSET; 73 + int ret; 74 + u32 l; 75 + 76 + writel_relaxed(BIT(1) | BIT(2), t->base + t->ifctrl); 77 + ret = readl_poll_timeout_atomic(syss, l, l & BIT(0), 100, 78 + DMTIMER_RESET_WAIT); 79 + 80 + return ret; 81 + } 82 + 83 + /* Note we must use io_base instead of func_base for type2 OCP regs */ 84 + static int __init dmtimer_systimer_type2_reset(struct dmtimer_systimer *t) 85 + { 86 + void __iomem *sysc = t->base + t->sysc; 87 + u32 l; 88 + 89 + l = readl_relaxed(sysc); 90 + l |= BIT(0); 91 + writel_relaxed(l, sysc); 92 + 93 + return readl_poll_timeout_atomic(sysc, l, !(l & BIT(0)), 100, 94 + DMTIMER_RESET_WAIT); 95 + } 96 + 97 + static int __init dmtimer_systimer_reset(struct dmtimer_systimer *t) 98 + { 99 + int ret; 100 + 101 + if (dmtimer_systimer_revision1(t)) 102 + ret = dmtimer_systimer_type1_reset(t); 103 + else 104 + ret = dmtimer_systimer_type2_reset(t); 105 + if (ret < 0) { 106 + pr_err("%s failed with %i\n", __func__, ret); 107 + 108 + return ret; 109 + } 110 + 111 + return 0; 112 + } 113 + 114 + static const struct of_device_id counter_match_table[] = { 115 + { .compatible = "ti,omap-counter32k" }, 116 + { /* Sentinel */ }, 117 + }; 118 + 119 + /* 120 + * Check if the SoC als has a usable working 32 KiHz counter. The 32 KiHz 121 + * counter is handled by timer-ti-32k, but we need to detect it as it 122 + * affects the preferred dmtimer system timer configuration. There is 123 + * typically no use for a dmtimer clocksource if the 32 KiHz counter is 124 + * present, except on am437x as described below. 125 + */ 126 + static void __init dmtimer_systimer_check_counter32k(void) 127 + { 128 + struct device_node *np; 129 + 130 + if (counter_32k) 131 + return; 132 + 133 + np = of_find_matching_node(NULL, counter_match_table); 134 + if (!np) { 135 + counter_32k = -ENODEV; 136 + 137 + return; 138 + } 139 + 140 + if (of_device_is_available(np)) 141 + counter_32k = 1; 142 + else 143 + counter_32k = -ENODEV; 144 + 145 + of_node_put(np); 146 + } 147 + 148 + static const struct of_device_id dmtimer_match_table[] = { 149 + { .compatible = "ti,omap2420-timer", }, 150 + { .compatible = "ti,omap3430-timer", }, 151 + { .compatible = "ti,omap4430-timer", }, 152 + { .compatible = "ti,omap5430-timer", }, 153 + { .compatible = "ti,am335x-timer", }, 154 + { .compatible = "ti,am335x-timer-1ms", }, 155 + { .compatible = "ti,dm814-timer", }, 156 + { .compatible = "ti,dm816-timer", }, 157 + { /* Sentinel */ }, 158 + }; 159 + 160 + /* 161 + * Checks that system timers are configured to not reset and idle during 162 + * the generic timer-ti-dm device driver probe. And that the system timer 163 + * source clocks are properly configured. Also, let's not hog any DSP and 164 + * PWM capable timers unnecessarily as system timers. 165 + */ 166 + static bool __init dmtimer_is_preferred(struct device_node *np) 167 + { 168 + if (!of_device_is_available(np)) 169 + return false; 170 + 171 + if (!of_property_read_bool(np->parent, 172 + "ti,no-reset-on-init")) 173 + return false; 174 + 175 + if (!of_property_read_bool(np->parent, "ti,no-idle")) 176 + return false; 177 + 178 + /* Secure gptimer12 is always clocked with a fixed source */ 179 + if (!of_property_read_bool(np, "ti,timer-secure")) { 180 + if (!of_property_read_bool(np, "assigned-clocks")) 181 + return false; 182 + 183 + if (!of_property_read_bool(np, "assigned-clock-parents")) 184 + return false; 185 + } 186 + 187 + if (of_property_read_bool(np, "ti,timer-dsp")) 188 + return false; 189 + 190 + if (of_property_read_bool(np, "ti,timer-pwm")) 191 + return false; 192 + 193 + return true; 194 + } 195 + 196 + /* 197 + * Finds the first available usable always-on timer, and assigns it to either 198 + * clockevent or clocksource depending if the counter_32k is available on the 199 + * SoC or not. 200 + * 201 + * Some omap3 boards with unreliable oscillator must not use the counter_32k 202 + * or dmtimer1 with 32 KiHz source. Additionally, the boards with unreliable 203 + * oscillator should really set counter_32k as disabled, and delete dmtimer1 204 + * ti,always-on property, but let's not count on it. For these quirky cases, 205 + * we prefer using the always-on secure dmtimer12 with the internal 32 KiHz 206 + * clock as the clocksource, and any available dmtimer as clockevent. 207 + * 208 + * For am437x, we are using am335x style dmtimer clocksource. It is unclear 209 + * if this quirk handling is really needed, but let's change it separately 210 + * based on testing as it might cause side effects. 211 + */ 212 + static void __init dmtimer_systimer_assign_alwon(void) 213 + { 214 + struct device_node *np; 215 + u32 pa = 0; 216 + bool quirk_unreliable_oscillator = false; 217 + 218 + /* Quirk unreliable 32 KiHz oscillator with incomplete dts */ 219 + if (of_machine_is_compatible("ti,omap3-beagle") || 220 + of_machine_is_compatible("timll,omap3-devkit8000")) { 221 + quirk_unreliable_oscillator = true; 222 + counter_32k = -ENODEV; 223 + } 224 + 225 + /* Quirk am437x using am335x style dmtimer clocksource */ 226 + if (of_machine_is_compatible("ti,am43")) 227 + counter_32k = -ENODEV; 228 + 229 + for_each_matching_node(np, dmtimer_match_table) { 230 + if (!dmtimer_is_preferred(np)) 231 + continue; 232 + 233 + if (of_property_read_bool(np, "ti,timer-alwon")) { 234 + const __be32 *addr; 235 + 236 + addr = of_get_address(np, 0, NULL, NULL); 237 + pa = of_translate_address(np, addr); 238 + if (pa) { 239 + /* Quirky omap3 boards must use dmtimer12 */ 240 + if (quirk_unreliable_oscillator && 241 + pa == 0x48318000) 242 + continue; 243 + 244 + of_node_put(np); 245 + break; 246 + } 247 + } 248 + } 249 + 250 + /* Usually no need for dmtimer clocksource if we have counter32 */ 251 + if (counter_32k >= 0) { 252 + clockevent = pa; 253 + clocksource = 0; 254 + } else { 255 + clocksource = pa; 256 + clockevent = DMTIMER_INST_DONT_CARE; 257 + } 258 + } 259 + 260 + /* Finds the first usable dmtimer, used for the don't care case */ 261 + static u32 __init dmtimer_systimer_find_first_available(void) 262 + { 263 + struct device_node *np; 264 + const __be32 *addr; 265 + u32 pa = 0; 266 + 267 + for_each_matching_node(np, dmtimer_match_table) { 268 + if (!dmtimer_is_preferred(np)) 269 + continue; 270 + 271 + addr = of_get_address(np, 0, NULL, NULL); 272 + pa = of_translate_address(np, addr); 273 + if (pa) { 274 + if (pa == clocksource || pa == clockevent) { 275 + pa = 0; 276 + continue; 277 + } 278 + 279 + of_node_put(np); 280 + break; 281 + } 282 + } 283 + 284 + return pa; 285 + } 286 + 287 + /* Selects the best clocksource and clockevent to use */ 288 + static void __init dmtimer_systimer_select_best(void) 289 + { 290 + dmtimer_systimer_check_counter32k(); 291 + dmtimer_systimer_assign_alwon(); 292 + 293 + if (clockevent == DMTIMER_INST_DONT_CARE) 294 + clockevent = dmtimer_systimer_find_first_available(); 295 + 296 + pr_debug("%s: counter_32k: %i clocksource: %08x clockevent: %08x\n", 297 + __func__, counter_32k, clocksource, clockevent); 298 + } 299 + 300 + /* Interface clocks are only available on some SoCs variants */ 301 + static int __init dmtimer_systimer_init_clock(struct device_node *np, 302 + const char *name, 303 + unsigned long *rate) 304 + { 305 + struct clk *clock; 306 + unsigned long r; 307 + int error; 308 + 309 + clock = of_clk_get_by_name(np, name); 310 + if ((PTR_ERR(clock) == -EINVAL) && !strncmp(name, "ick", 3)) 311 + return 0; 312 + else if (IS_ERR(clock)) 313 + return PTR_ERR(clock); 314 + 315 + error = clk_prepare_enable(clock); 316 + if (error) 317 + return error; 318 + 319 + r = clk_get_rate(clock); 320 + if (!r) 321 + return -ENODEV; 322 + 323 + *rate = r; 324 + 325 + return 0; 326 + } 327 + 328 + static void dmtimer_systimer_enable(struct dmtimer_systimer *t) 329 + { 330 + u32 val; 331 + 332 + if (dmtimer_systimer_revision1(t)) 333 + val = DMTIMER_TYPE1_ENABLE; 334 + else 335 + val = DMTIMER_TYPE2_ENABLE; 336 + 337 + writel_relaxed(val, t->base + t->sysc); 338 + } 339 + 340 + static void dmtimer_systimer_disable(struct dmtimer_systimer *t) 341 + { 342 + writel_relaxed(0, t->base + t->sysc); 343 + } 344 + 345 + static int __init dmtimer_systimer_setup(struct device_node *np, 346 + struct dmtimer_systimer *t) 347 + { 348 + unsigned long rate; 349 + u8 regbase; 350 + int error; 351 + 352 + if (!of_device_is_compatible(np->parent, "ti,sysc")) 353 + return -EINVAL; 354 + 355 + t->base = of_iomap(np, 0); 356 + if (!t->base) 357 + return -ENXIO; 358 + 359 + /* 360 + * Enable optional assigned-clock-parents configured at the timer 361 + * node level. For regular device drivers, this is done automatically 362 + * by bus related code such as platform_drv_probe(). 363 + */ 364 + error = of_clk_set_defaults(np, false); 365 + if (error < 0) 366 + pr_err("%s: clock source init failed: %i\n", __func__, error); 367 + 368 + /* For ti-sysc, we have timer clocks at the parent module level */ 369 + error = dmtimer_systimer_init_clock(np->parent, "fck", &rate); 370 + if (error) 371 + goto err_unmap; 372 + 373 + t->rate = rate; 374 + 375 + error = dmtimer_systimer_init_clock(np->parent, "ick", &rate); 376 + if (error) 377 + goto err_unmap; 378 + 379 + if (dmtimer_systimer_revision1(t)) { 380 + t->irq_stat = OMAP_TIMER_V1_STAT_OFFSET; 381 + t->irq_ena = OMAP_TIMER_V1_INT_EN_OFFSET; 382 + t->pend = _OMAP_TIMER_WRITE_PEND_OFFSET; 383 + regbase = 0; 384 + } else { 385 + t->irq_stat = OMAP_TIMER_V2_IRQSTATUS; 386 + t->irq_ena = OMAP_TIMER_V2_IRQENABLE_SET; 387 + regbase = OMAP_TIMER_V2_FUNC_OFFSET; 388 + t->pend = regbase + _OMAP_TIMER_WRITE_PEND_OFFSET; 389 + } 390 + 391 + t->sysc = OMAP_TIMER_OCP_CFG_OFFSET; 392 + t->load = regbase + _OMAP_TIMER_LOAD_OFFSET; 393 + t->counter = regbase + _OMAP_TIMER_COUNTER_OFFSET; 394 + t->ctrl = regbase + _OMAP_TIMER_CTRL_OFFSET; 395 + t->wakeup = regbase + _OMAP_TIMER_WAKEUP_EN_OFFSET; 396 + t->ifctrl = regbase + _OMAP_TIMER_IF_CTRL_OFFSET; 397 + 398 + dmtimer_systimer_enable(t); 399 + dmtimer_systimer_reset(t); 400 + pr_debug("dmtimer rev %08x sysc %08x\n", readl_relaxed(t->base), 401 + readl_relaxed(t->base + t->sysc)); 402 + 403 + return 0; 404 + 405 + err_unmap: 406 + iounmap(t->base); 407 + 408 + return error; 409 + } 410 + 411 + /* Clockevent */ 412 + static struct dmtimer_clockevent * 413 + to_dmtimer_clockevent(struct clock_event_device *clockevent) 414 + { 415 + return container_of(clockevent, struct dmtimer_clockevent, dev); 416 + } 417 + 418 + static irqreturn_t dmtimer_clockevent_interrupt(int irq, void *data) 419 + { 420 + struct dmtimer_clockevent *clkevt = data; 421 + struct dmtimer_systimer *t = &clkevt->t; 422 + 423 + writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_stat); 424 + clkevt->dev.event_handler(&clkevt->dev); 425 + 426 + return IRQ_HANDLED; 427 + } 428 + 429 + static int dmtimer_set_next_event(unsigned long cycles, 430 + struct clock_event_device *evt) 431 + { 432 + struct dmtimer_clockevent *clkevt = to_dmtimer_clockevent(evt); 433 + struct dmtimer_systimer *t = &clkevt->t; 434 + void __iomem *pend = t->base + t->pend; 435 + 436 + writel_relaxed(0xffffffff - cycles, t->base + t->counter); 437 + while (readl_relaxed(pend) & WP_TCRR) 438 + cpu_relax(); 439 + 440 + writel_relaxed(OMAP_TIMER_CTRL_ST, t->base + t->ctrl); 441 + while (readl_relaxed(pend) & WP_TCLR) 442 + cpu_relax(); 443 + 444 + return 0; 445 + } 446 + 447 + static int dmtimer_clockevent_shutdown(struct clock_event_device *evt) 448 + { 449 + struct dmtimer_clockevent *clkevt = to_dmtimer_clockevent(evt); 450 + struct dmtimer_systimer *t = &clkevt->t; 451 + void __iomem *ctrl = t->base + t->ctrl; 452 + u32 l; 453 + 454 + l = readl_relaxed(ctrl); 455 + if (l & OMAP_TIMER_CTRL_ST) { 456 + l &= ~BIT(0); 457 + writel_relaxed(l, ctrl); 458 + /* Flush posted write */ 459 + l = readl_relaxed(ctrl); 460 + /* Wait for functional clock period x 3.5 */ 461 + udelay(3500000 / t->rate + 1); 462 + } 463 + writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_stat); 464 + 465 + return 0; 466 + } 467 + 468 + static int dmtimer_set_periodic(struct clock_event_device *evt) 469 + { 470 + struct dmtimer_clockevent *clkevt = to_dmtimer_clockevent(evt); 471 + struct dmtimer_systimer *t = &clkevt->t; 472 + void __iomem *pend = t->base + t->pend; 473 + 474 + dmtimer_clockevent_shutdown(evt); 475 + 476 + /* Looks like we need to first set the load value separately */ 477 + writel_relaxed(clkevt->period, t->base + t->load); 478 + while (readl_relaxed(pend) & WP_TLDR) 479 + cpu_relax(); 480 + 481 + writel_relaxed(clkevt->period, t->base + t->counter); 482 + while (readl_relaxed(pend) & WP_TCRR) 483 + cpu_relax(); 484 + 485 + writel_relaxed(OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST, 486 + t->base + t->ctrl); 487 + while (readl_relaxed(pend) & WP_TCLR) 488 + cpu_relax(); 489 + 490 + return 0; 491 + } 492 + 493 + static void omap_clockevent_idle(struct clock_event_device *evt) 494 + { 495 + struct dmtimer_clockevent *clkevt = to_dmtimer_clockevent(evt); 496 + struct dmtimer_systimer *t = &clkevt->t; 497 + 498 + dmtimer_systimer_disable(t); 499 + } 500 + 501 + static void omap_clockevent_unidle(struct clock_event_device *evt) 502 + { 503 + struct dmtimer_clockevent *clkevt = to_dmtimer_clockevent(evt); 504 + struct dmtimer_systimer *t = &clkevt->t; 505 + 506 + dmtimer_systimer_enable(t); 507 + writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_ena); 508 + writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->wakeup); 509 + } 510 + 511 + static int __init dmtimer_clockevent_init(struct device_node *np) 512 + { 513 + struct dmtimer_clockevent *clkevt; 514 + struct clock_event_device *dev; 515 + struct dmtimer_systimer *t; 516 + int error; 517 + 518 + clkevt = kzalloc(sizeof(*clkevt), GFP_KERNEL); 519 + if (!clkevt) 520 + return -ENOMEM; 521 + 522 + t = &clkevt->t; 523 + dev = &clkevt->dev; 524 + 525 + /* 526 + * We mostly use cpuidle_coupled with ARM local timers for runtime, 527 + * so there's probably no use for CLOCK_EVT_FEAT_DYNIRQ here. 528 + */ 529 + dev->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; 530 + dev->rating = 300; 531 + dev->set_next_event = dmtimer_set_next_event; 532 + dev->set_state_shutdown = dmtimer_clockevent_shutdown; 533 + dev->set_state_periodic = dmtimer_set_periodic; 534 + dev->set_state_oneshot = dmtimer_clockevent_shutdown; 535 + dev->tick_resume = dmtimer_clockevent_shutdown; 536 + dev->cpumask = cpu_possible_mask; 537 + 538 + dev->irq = irq_of_parse_and_map(np, 0); 539 + if (!dev->irq) { 540 + error = -ENXIO; 541 + goto err_out_free; 542 + } 543 + 544 + error = dmtimer_systimer_setup(np, &clkevt->t); 545 + if (error) 546 + goto err_out_free; 547 + 548 + clkevt->period = 0xffffffff - DIV_ROUND_CLOSEST(t->rate, HZ); 549 + 550 + /* 551 + * For clock-event timers we never read the timer counter and 552 + * so we are not impacted by errata i103 and i767. Therefore, 553 + * we can safely ignore this errata for clock-event timers. 554 + */ 555 + writel_relaxed(OMAP_TIMER_CTRL_POSTED, t->base + t->ifctrl); 556 + 557 + error = request_irq(dev->irq, dmtimer_clockevent_interrupt, 558 + IRQF_TIMER, "clockevent", clkevt); 559 + if (error) 560 + goto err_out_unmap; 561 + 562 + writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_ena); 563 + writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->wakeup); 564 + 565 + pr_info("TI gptimer clockevent: %s%lu Hz at %pOF\n", 566 + of_find_property(np, "ti,timer-alwon", NULL) ? 567 + "always-on " : "", t->rate, np->parent); 568 + 569 + clockevents_config_and_register(dev, t->rate, 570 + 3, /* Timer internal resynch latency */ 571 + 0xffffffff); 572 + 573 + if (of_device_is_compatible(np, "ti,am33xx") || 574 + of_device_is_compatible(np, "ti,am43")) { 575 + dev->suspend = omap_clockevent_idle; 576 + dev->resume = omap_clockevent_unidle; 577 + } 578 + 579 + return 0; 580 + 581 + err_out_unmap: 582 + iounmap(t->base); 583 + 584 + err_out_free: 585 + kfree(clkevt); 586 + 587 + return error; 588 + } 589 + 590 + /* Clocksource */ 591 + static struct dmtimer_clocksource * 592 + to_dmtimer_clocksource(struct clocksource *cs) 593 + { 594 + return container_of(cs, struct dmtimer_clocksource, dev); 595 + } 596 + 597 + static u64 dmtimer_clocksource_read_cycles(struct clocksource *cs) 598 + { 599 + struct dmtimer_clocksource *clksrc = to_dmtimer_clocksource(cs); 600 + struct dmtimer_systimer *t = &clksrc->t; 601 + 602 + return (u64)readl_relaxed(t->base + t->counter); 603 + } 604 + 605 + static void __iomem *dmtimer_sched_clock_counter; 606 + 607 + static u64 notrace dmtimer_read_sched_clock(void) 608 + { 609 + return readl_relaxed(dmtimer_sched_clock_counter); 610 + } 611 + 612 + static void dmtimer_clocksource_suspend(struct clocksource *cs) 613 + { 614 + struct dmtimer_clocksource *clksrc = to_dmtimer_clocksource(cs); 615 + struct dmtimer_systimer *t = &clksrc->t; 616 + 617 + clksrc->loadval = readl_relaxed(t->base + t->counter); 618 + dmtimer_systimer_disable(t); 619 + } 620 + 621 + static void dmtimer_clocksource_resume(struct clocksource *cs) 622 + { 623 + struct dmtimer_clocksource *clksrc = to_dmtimer_clocksource(cs); 624 + struct dmtimer_systimer *t = &clksrc->t; 625 + 626 + dmtimer_systimer_enable(t); 627 + writel_relaxed(clksrc->loadval, t->base + t->counter); 628 + writel_relaxed(OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 629 + t->base + t->ctrl); 630 + } 631 + 632 + static int __init dmtimer_clocksource_init(struct device_node *np) 633 + { 634 + struct dmtimer_clocksource *clksrc; 635 + struct dmtimer_systimer *t; 636 + struct clocksource *dev; 637 + int error; 638 + 639 + clksrc = kzalloc(sizeof(*clksrc), GFP_KERNEL); 640 + if (!clksrc) 641 + return -ENOMEM; 642 + 643 + dev = &clksrc->dev; 644 + t = &clksrc->t; 645 + 646 + error = dmtimer_systimer_setup(np, t); 647 + if (error) 648 + goto err_out_free; 649 + 650 + dev->name = "dmtimer"; 651 + dev->rating = 300; 652 + dev->read = dmtimer_clocksource_read_cycles; 653 + dev->mask = CLOCKSOURCE_MASK(32); 654 + dev->flags = CLOCK_SOURCE_IS_CONTINUOUS; 655 + 656 + if (of_device_is_compatible(np, "ti,am33xx") || 657 + of_device_is_compatible(np, "ti,am43")) { 658 + dev->suspend = dmtimer_clocksource_suspend; 659 + dev->resume = dmtimer_clocksource_resume; 660 + } 661 + 662 + writel_relaxed(0, t->base + t->counter); 663 + writel_relaxed(OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 664 + t->base + t->ctrl); 665 + 666 + pr_info("TI gptimer clocksource: %s%pOF\n", 667 + of_find_property(np, "ti,timer-alwon", NULL) ? 668 + "always-on " : "", np->parent); 669 + 670 + if (!dmtimer_sched_clock_counter) { 671 + dmtimer_sched_clock_counter = t->base + t->counter; 672 + sched_clock_register(dmtimer_read_sched_clock, 32, t->rate); 673 + } 674 + 675 + if (clocksource_register_hz(dev, t->rate)) 676 + pr_err("Could not register clocksource %pOF\n", np); 677 + 678 + return 0; 679 + 680 + err_out_free: 681 + kfree(clksrc); 682 + 683 + return -ENODEV; 684 + } 685 + 686 + /* 687 + * To detect between a clocksource and clockevent, we assume the device tree 688 + * has no interrupts configured for a clocksource timer. 689 + */ 690 + static int __init dmtimer_systimer_init(struct device_node *np) 691 + { 692 + const __be32 *addr; 693 + u32 pa; 694 + 695 + /* One time init for the preferred timer configuration */ 696 + if (!clocksource && !clockevent) 697 + dmtimer_systimer_select_best(); 698 + 699 + if (!clocksource && !clockevent) { 700 + pr_err("%s: unable to detectt system timers, update dtb?\n", 701 + __func__); 702 + 703 + return -EINVAL; 704 + } 705 + 706 + addr = of_get_address(np, 0, NULL, NULL); 707 + pa = of_translate_address(np, addr); 708 + if (!pa) 709 + return -EINVAL; 710 + 711 + if (counter_32k <= 0 && clocksource == pa) 712 + return dmtimer_clocksource_init(np); 713 + 714 + if (clockevent == pa) 715 + return dmtimer_clockevent_init(np); 716 + 717 + return 0; 718 + } 719 + 720 + TIMER_OF_DECLARE(systimer_omap2, "ti,omap2420-timer", dmtimer_systimer_init); 721 + TIMER_OF_DECLARE(systimer_omap3, "ti,omap3430-timer", dmtimer_systimer_init); 722 + TIMER_OF_DECLARE(systimer_omap4, "ti,omap4430-timer", dmtimer_systimer_init); 723 + TIMER_OF_DECLARE(systimer_omap5, "ti,omap5430-timer", dmtimer_systimer_init); 724 + TIMER_OF_DECLARE(systimer_am33x, "ti,am335x-timer", dmtimer_systimer_init); 725 + TIMER_OF_DECLARE(systimer_am3ms, "ti,am335x-timer-1ms", dmtimer_systimer_init); 726 + TIMER_OF_DECLARE(systimer_dm814, "ti,dm814-timer", dmtimer_systimer_init); 727 + TIMER_OF_DECLARE(systimer_dm816, "ti,dm816-timer", dmtimer_systimer_init);