The FCLKs (Fabric Clocks, a.k.a. "PS-PL clocks") are crucial for moving data between the Processing System (PS) and Programmable Logic (PL) on Zynq Ultrascale+ (and Zynq-7000 too). Here's how to check their status, enable/disable them, and change their frequencies from Linux:
1. Check Current FCLK Status
The FCLKs are exposed as regular clocks in the Linux clock framework. To see their current rates:
bash
cat /sys/kernel/debug/clk/clk_summary | grep fclk
You'll see something like:
code
fclk0 100 MHz y pl0
fclk1 200 MHz y pl1
fclk2 0 Hz y pl2
fclk3 0 Hz y pl3
Here:
fclk0, fclk1, fclk2, fclk3 are the four available FCLK outputs.
The rate (e.g., 100 MHz, 0 Hz) tells you their current frequency.
y under Changeable means you can adjust them at runtime.
pl0 … pl3 indicates which PL clock domain they're driving.
Note: If an FCLK is 0 Hz, it means it's disabled (gated). The PL logic won't see any clock activity until you enable it.
2. Control FCLKs Using clk_* Sysfs Files
Each FCLK has its own directory under /sys/kernel/debug/clk/zynqmp_clk/ (or just /sys/class/clk/ on some systems). Let's manipulate fclk0 as an example:
bash
# Go to the clk directory (debugfs or sysfs)
cd /sys/kernel/debug/clk/zynqmp_clk/fclk0
# or: cd /sys/class/clk/fclk0 # if your kernel exposes it here
In this directory, you'll find these key files:
clk_rate : Shows the current frequency.
clk_enable : 1 = clock is running, 0 = clock is gated (stopped).
clk_set_rate : Write a new frequency here (in Hz).
clk_set_parent : (Rarely needed) Selects the clock's parent (PLL source).
Need to set FCLKs before Linux boots? Do it in U-Boot:
u-boot
# In U-Boot prompt:
zynqmp_set_boot_freq # Show current config
fclk set 0 150 # Set FCLK0 to 150 MHz
fclk enable 0 # Turn FCLK0 ON
saveenv # Save to boot config
reset
Common Pitfalls:
PL Power Domain: If the PL is powered down (pdpl = 0 in zynqmp_clk_summary), FCLKs won’t work. Check cat /sys/kernel/debug/regulator/PL/ | grep state — it must say enabled.
Bitstream Not Loaded: If there’s no PL bitstream, FCLK changes might not "stick" (the PL isn’t consuming the clock).
Clock Parents: If your FCLK is sourced from pll1 or pll2, those PLLs must be locked/stable.
Now you’re all set to probe, poke, and program your FCLKs from Linux! 🎛️
Bonus Tip: Want a one-liner to set FCLK0 to 200 MHz and enable it?