This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: Timer drivers

Guru 20755 points
Part Number: AM3715
Other Parts Discussed in Thread: AM3517

Tool/software: Linux

Hello,

Does linux support HW timers drivers, or is it required to write a driver for that ?

I checked, but not too much sure about it.

Thank you,

Ran

  • What do you mean by HW timers? The AM572x timers?
  • The timer drivers are located in: arch/arm/plat-omap/dmtimer.c
  • Yes , I mean AM572x timers.
    Is it that linux APIs for timers , such as timer_create actually use these HW timers ?
    If yes - is it a single timer that is expose to userspace ?
  • The timer is exposed as soon as you enable it in dts (add status = "okay" in dts node), see for example Documentation/devicetree/bindings/arm/omap/timer.txt

    The exported symbols available to the kernel are described in the dmtimer.c (path provided by Biser) & arch/arm/plat-omap/include/plat/dmtimer.h. If you need further timer handles you should customize the driver.

    A sample code on how to create custom timer driver is located here:
    e2e.ti.com/.../415079

    However you should modify the code to match the latest TI SDK kernel, so DO NOT copy paste the code, just use it as reference and write your own code for the latest TI kernel.

    Best Regards,
    Yordan
  • Hello Yordan,

    Thank you for the information.

    I see in some older kernel 2.6.37 for am37x:

    In board file:
    MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
    .boot_params = 0x80000100,
    .map_io = omap3_map_io,
    .reserve = omap_reserve,
    .init_irq = am3517_evm_init_irq,
    .init_machine = am3517_evm_init,
    .timer = &omap_timer,
    MACHINE_END

    In dmtimer.c:
    omap_dm_timer_init-> initialize omap2_dm_timers, which contains all the GPTIMER list.

    I think that if the timer are already supported and exposed to userspace, than there is no need for additional kernel driver.
    I just try to understand what is the actual HW timer that is used on calling syscall's such as timer_create.
    Is it using these timers ? All of them or just on of them ?

    Regards,
    Ran

  • I think I now understand.

    It is gptimer #1.
    in timer-gp.c :
    omap2_gp_clockevent_init initialized with gptimer id #1.

    Thanks a lot