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.

Which DMTimer(s) does Arago Linux use?

Other Parts Discussed in Thread: SYSCONFIG

I'm looking to use a timer in the AM335x device. However before I claim one, I would like to know if Linux or any other kernel modules are using any. So before I claim one, I need to know what the macros are that point at the DMTimers so I can search for the one I want to use to ensure it isn't already being used.

I've done a search through the code for DMTIMER and I get some responses that make reference to timer numbers larger than what this part has.

I also searched for the memory map addresses of the various timers to see if there's a macro out there set to one of the timer's memory address. No luck there.

So, any tips on how to "find" code using DMTimers within the Linux codebase?

  • TImers 1&2 (numbering starting from 0) are used for timekeeping. TImers 5&6 are used by the ethernet driver. I think GFX driver also uses one timer. Will check.

    Regards,

    Vaibhav

  • Thanks for any clarification you can get me.

    In the meantime, I've been looking through the code trying to find anything that may be what I'm looking for. What I've found is the macros in dmtimer.h. Based on the value of the register macros, they appear to be configured for the DMTIMER1_1MS timer, not the other generic timers (0 & 2-7). For example, _OMAP_TIMER_CTRL_OFFSET is equal to 0x24. The generic timer's Control Register is at 0x38. But the 1ms timer's control register IS 0x24. So that led me to believe the Linux OS was using the 1MS timer, not any of the others. It sounds like based on your comment, the Linux OS itself uses both DMTimer0 & 1. Is that correct?

    Although I assumed there'd be other drivers using the various timers, but I don't yet know how Linux passes out these timers or if it allocates them at all. If there isn't a Linux mechanism available to control which drivers use the resources, how are kernel driver developers supposed to coordinate their usage of timer resources? For now, I have the freedom to simply grab the offset memory address for an available timer and just use it. However for production code, I'd like to do things a bit more above-board than that. So if there is an infrastructure I should be using, I'd like to be aware of that. Or at the very least, know how to "find" all usages of the various resources (in this case timers) before grabbing one for my own use.

    For now, I'll proceed by just grabbing DMTIMER2 unless someone tells me its being used by something else. Worst case scenario, I grab one that causes trouble, the processor locks up or does something bad and I have to try a different one and reboot. Linux Opps and Panics at this point aren't disastrous at this point...just annoying.

    Thanks.

  • So, i checked with the GFX folks on the timer that they use. Right now you need to look at the code to figure out which timer is getting used. For someone who has the GFX SDK installed, the path to look at is: Graphics_SDK_a_b_c_d/GFX_Linux_KM/services4/system/ti335/sysconfig.h. GFX is using DMTIMER7 (0x4804_A000).

    I will need to check up on the 1MS timer thing you are referring to but that will perhaps take some time.

    Christopher Grey said:
    how are kernel driver developers supposed to coordinate their usage of timer resources?

    There is some basic infrastructure for drivers to requests for a timer. Have a look at drivers/net/ethernet/ti/cpsw.c for the APIs to be used.

    Christopher Grey said:
    I'll proceed by just grabbing DMTIMER2

    To avoid any confusion due to the numbering convention DMTIMER1 (@0x44E3_1000) and DMTIMER2 (@0x4804_0000) are used by kernel. CPSW driver uses DMTIMER5 and 6. With DMTIMER7 being used by GFX you are left with DMTIMER0, DMTIMER3 and DMTIMER4. DMTIMER0 runs from inaccurate RC OSC and if that is not ok for the use-case that you have in mind you should use the kernel APIs to request for either DMTIMER3 or DMTIMER4.

    Hope this helps.

    Vaibhav

  • Very helpful. And thanks for clarifying your naming with memory offsets.

    As for the GFX stuff, I don't believe we have those as part of our build. But I'll avoid that timer anyway. As for high accuracy, no what I'm doing doesn't require excessive accuracy. I just need a timer tick to increment a value ~1ms...faster than the 10ms timer tick of the OS, but it doesn't need to be μs or ns accurate. I just need to know inter-character delay timing. As long as the inaccuracy isn't so bad that I can't use it for that, I'll be fine. And again, this is just proof-of-concept coding we are doing right now. Ultimately for production code, we'd like to implement this driver as a network driver, not as a character driver so we can make use of things like Wireshark even though the protocol isn't Ethernet-based. I suspect it'll be easier to fake it out like it is Ethernet, even if it isn't.

    Thanks again for the help.