NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-arm/60910: am335x: omaptimer0 fails to attach, wrong timer1 clkctrl



>Number:         60910
>Category:       port-arm
>Synopsis:       am335x: omaptimer0 fails to attach, wrong timer1 clkctrl
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-arm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 20 21:10:00 +0000 2026
>Originator:     Elias Howell
>Release:        NetBSD 11.0, NetBSD-current 11.99.9 (20261019)
>Organization:
>Environment:
NetBSD armv7 11.0 NetBSD 11.0 (GENERIC) #0: Thu Jul 30 15:23:12 UTC 2026 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/evbarm/compile/GENERIC evbarm
NetBSD armv7 11.99.9 NetBSD 11.99.9 (GENERIC) #0: Mon Oct 19 09:38:27 UTC 2026  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/evbarm/compile/GENERIC evbarm
>Description:
On the SG-1000 both 11.0 and -current print

  omaptimer0 at tisysc18: couldn't enable module

(tisysc18 with am335x-boneblack.dtb, the number depends on the tree)
timer1 is enabled in the shared am33xx-l4.dtsi so it should be the
same on any AM335x board using the in-tree device trees.

am3_prcm.c has

  AM3_PRCM_HWMOD_WKUP("timer1", 0x10, "FIXED_32K"),

0x10 is CM_WKUP_TIMER0_CLKCTRL (SPRUH73Q 8.1.12.2.5). The dts points
timer1 (the 1ms timer at 0x44e31000) at AM3_L4_WKUP_TIMER1_CLKCTRL,
which is 0xc4 in dt-bindings/clock/am3.h and 0xc4 is
CM_WKUP_TIMER1_CLKCTRL in the TRM (8.1.12.2.50). Nothing in the table
is at 0xc4 so ti_prcm_get_hwmod() returns NULL and the attach fails.

Rev 1.11 renamed timer0 to timer1 and kept 0x10. Since 1.13 the
lookup is by clkctrl offset so now it shows. The other WKUP entries
are right.

ti_omaptimer.c only uses units 1 and 2 so nothing ran on timer1
before or after this. It just gets the attach working and the error
gone, timekeeping doesn't change.

Not changed by the patch. The entry gives timer1 parent FIXED_32K but
CLKSEL_TIMER1MS_CLK resets to 0 which is CLK_M_OSC (TRM 8.1.12.3.9).
The rate isn't used for unit 0 so it doesn't matter right now.
>How-To-Repeat:
Boot any AM335x board and look for omaptimer0 in dmesg
>Fix:
Tested on the SG-1000, -current b91976112 plus this and my fdt_i2c
patch. With am335x-boneblack.dtb (only the Ethernet bits changed)
it now says

  omaptimer0 at tisysc18: Timer

Same with the SG-1000's own dts, there it's tisysc15.

--- a/sys/arch/arm/ti/am3_prcm.c
+++ b/sys/arch/arm/ti/am3_prcm.c
@@ -177,7 +177,7 @@ static struct ti_prcm_clk am3_prcm_clks[] = {
        AM3_PRCM_HWMOD_PER("gpio3", 0xb0, "PERIPH_CLK"),
        AM3_PRCM_HWMOD_PER("gpio4", 0xb4, "PERIPH_CLK"),

-       AM3_PRCM_HWMOD_WKUP("timer1", 0x10, "FIXED_32K"),
+       AM3_PRCM_HWMOD_WKUP("timer1", 0xc4, "FIXED_32K"),
        AM3_PRCM_HWMOD_PER("timer2", 0x80, "FIXED_24MHZ"),
        AM3_PRCM_HWMOD_PER("timer3", 0x84, "FIXED_24MHZ"),
        AM3_PRCM_HWMOD_PER("timer4", 0x88, "FIXED_24MHZ"),




Home | Main Index | Thread Index | Old Index