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

clocksource/drivers/timer-ti-dm: Fix regression from errata i940 fix

The existing fix for errata i940 causes a conflict for IPU2 which is
using timer 3 and 4. From arch/arm/boot/dts/dra7-ipu-dsp-common.dtsi:

&ipu2 {
mboxes = <&mailbox6 &mbox_ipu2_ipc3x>;
ti,timers = <&timer3>;
ti,watchdog-timers = <&timer4>, <&timer9>;
};

The conflict was noticed when booting mainline on the BeagleBoard X15
which has a TI AM5728 SoC:

remoteproc remoteproc1: 55020000.ipu is available
remoteproc remoteproc1: powering up 55020000.ipu
remoteproc remoteproc1: Booting fw image dra7-ipu2-fw.xem4
omap-rproc 55020000.ipu: could not get timer platform device
omap-rproc 55020000.ipu: omap_rproc_enable_timers failed: -19
remoteproc remoteproc1: can't start rproc 55020000.ipu: -19

This change modifies the errata fix to instead use timer 15 and 16 which
resolves the timer conflict.

It does not appear to introduce any latency regression. Results from
cyclictest with original errata fix using dmtimer 3 and 4:

# cyclictest --mlockall --smp --priority=80 --interval=200 --distance=0
policy: fifo: loadavg: 0.02 0.03 0.05

T: 0 ( 1449) P:80 I:200 C: 800368 Min: 0 Act: 32 Avg: 22 Max: 128
T: 1 ( 1450) P:80 I:200 C: 800301 Min: 0 Act: 12 Avg: 23 Max: 70

The results after the change to dmtimer 15 and 16:

# cyclictest --mlockall --smp --priority=80 --interval=200 --distance=0
policy: fifo: loadavg: 0.36 0.19 0.07

T: 0 ( 1711) P:80 I:200 C: 759599 Min: 0 Act: 6 Avg: 22 Max: 108
T: 1 ( 1712) P:80 I:200 C: 759539 Min: 0 Act: 19 Avg: 23 Max: 79

Fixes: 25de4ce5ed02 ("clocksource/drivers/timer-ti-dm: Handle dra7 timer wrap errata i940")
Link: https://lore.kernel.org/linux-omap/YfWsG0p6to3IJuvE@x1/
Suggested-by: Suman Anna <s-anna@ti.com>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Drew Fustini <dfustini@baylibre.com>
Link: https://lore.kernel.org/r/20220204053503.1409162-1-dfustini@baylibre.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Drew Fustini and committed by
Daniel Lezcano
bceaae3b 10720e12

+8 -9
+2 -3
arch/arm/boot/dts/dra7-l4.dtsi
··· 3482 3482 ti,timer-pwm; 3483 3483 }; 3484 3484 }; 3485 - 3486 - target-module@2c000 { /* 0x4882c000, ap 17 02.0 */ 3485 + timer15_target: target-module@2c000 { /* 0x4882c000, ap 17 02.0 */ 3487 3486 compatible = "ti,sysc-omap4-timer", "ti,sysc"; 3488 3487 reg = <0x2c000 0x4>, 3489 3488 <0x2c010 0x4>; ··· 3510 3511 }; 3511 3512 }; 3512 3513 3513 - target-module@2e000 { /* 0x4882e000, ap 19 14.0 */ 3514 + timer16_target: target-module@2e000 { /* 0x4882e000, ap 19 14.0 */ 3514 3515 compatible = "ti,sysc-omap4-timer", "ti,sysc"; 3515 3516 reg = <0x2e000 0x4>, 3516 3517 <0x2e010 0x4>;
+4 -4
arch/arm/boot/dts/dra7.dtsi
··· 1339 1339 }; 1340 1340 1341 1341 /* Local timers, see ARM architected timer wrap erratum i940 */ 1342 - &timer3_target { 1342 + &timer15_target { 1343 1343 ti,no-reset-on-init; 1344 1344 ti,no-idle; 1345 1345 timer@0 { 1346 - assigned-clocks = <&l4per_clkctrl DRA7_L4PER_TIMER3_CLKCTRL 24>; 1346 + assigned-clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER15_CLKCTRL 24>; 1347 1347 assigned-clock-parents = <&timer_sys_clk_div>; 1348 1348 }; 1349 1349 }; 1350 1350 1351 - &timer4_target { 1351 + &timer16_target { 1352 1352 ti,no-reset-on-init; 1353 1353 ti,no-idle; 1354 1354 timer@0 { 1355 - assigned-clocks = <&l4per_clkctrl DRA7_L4PER_TIMER4_CLKCTRL 24>; 1355 + assigned-clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER16_CLKCTRL 24>; 1356 1356 assigned-clock-parents = <&timer_sys_clk_div>; 1357 1357 }; 1358 1358 };
+2 -2
drivers/clocksource/timer-ti-dm-systimer.c
··· 695 695 return 0; 696 696 } 697 697 698 - if (pa == 0x48034000) /* dra7 dmtimer3 */ 698 + if (pa == 0x4882c000) /* dra7 dmtimer15 */ 699 699 return dmtimer_percpu_timer_init(np, 0); 700 - else if (pa == 0x48036000) /* dra7 dmtimer4 */ 700 + else if (pa == 0x4882e000) /* dra7 dmtimer16 */ 701 701 return dmtimer_percpu_timer_init(np, 1); 702 702 703 703 return 0;