sddf icon indicating copy to clipboard operation
sddf copied to clipboard

drivers:timer:cdns zcu102 timer driver using cadence TTC device

Open Willmish opened this issue 1 year ago • 1 comments

Adds the cadence Triple Timer Counter (TTC) based timer driver.

Caveats:

  • max timeout allowed: ~2min 51.799s (can be extended sacrificing resolution, atm uses 25MHz clock)
  • Clock source not touched, by default uses LSBUS clock, which is downscaled from IOPLL clock (which in turn is upscaled from main source clock) - will need to be changed when clock driver introduced/any clock modifications will be done.

Draft because of the following:

  • [x] TODO: update the drivers.md doc: https://github.com/au-ts/sddf/blob/main/docs/drivers.md
  • [ ] race condition on delivering overflow IRQ when happened during timeout IRQ (see comments) (Separate to #403)
  • [ ] TODO: rename ZCU102_ defines to begin with ZYNQMP_ (SoC specific rather than dev board specific)
  • [x] Done, for now assumes the IOPLL clock is untouched after boot and set to 1.5GHz, and used as source downscaled by factor of 15 for the TTC counters ~~need to ensure Clock used for the counter is always set to 100MHz/use a different one~~
  • [x] Done, downscaled freq to 25MHz (now max timeout is larger and overflowing happens every ~2min 52s) ~~add clock frequency downscaling (for lower resolution but rarer interrupts for 32-bit timer overflow, currently every ~42s)~~
  • [x] Done ~~clean up serial driver skeleton code~~

Willmish avatar Apr 14 '25 06:04 Willmish

I'll wait until we're both in the lab together to review this. It will be much easier/quicker to do it in person.

Ivan-Velickovic avatar May 02 '25 03:05 Ivan-Velickovic

@Ivan-Velickovic , this is ready for review, happy to do it tomorrow/this week in person. Included the fix for jh7110 timeout limit (just keeps repeating max timeouts until reaches desired timeout).

Only thing that I am considering to change is rename #defines to use ZYNQMP_ prefix rather than ZCU102_

What is weird though, is that on the first run of examples.yaml action, the job Build (Linux x86-64 Nix) failed when building serial example for star64 in release mode using make, but succeeded without any code changes on a rerun (first attempt (failed) vs second attempt (success)). EDIT: After consulting with Bill and Krishnan, I think this is due to reordering when an .elf file gets linked (here: client.elf) before the libsddf_util_debug.a archive gets created. And even though the client doesn't use that archive, it is included here: https://github.com/au-ts/sddf/blob/main/examples/serial/serial.mk#L82C48-L82C68 so will still try to link against it?

Don't know what is the exact fix for this, but hopefully the above rant helps narrowing it down. Can open a separate issue.

Willmish avatar Aug 05 '25 04:08 Willmish