Page MenuHomeFreeBSD

sifive_prci: Add support for the FU740 PRCI
ClosedPublic

Authored by jrtc27 on Jul 5 2021, 12:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 16, 8:00 AM
Unknown Object (File)
Sat, Mar 16, 8:00 AM
Unknown Object (File)
Sat, Mar 16, 8:00 AM
Unknown Object (File)
Sat, Mar 16, 7:56 AM
Unknown Object (File)
Sat, Mar 16, 7:44 AM
Unknown Object (File)
Feb 13 2024, 1:29 AM
Unknown Object (File)
Feb 2 2024, 3:30 AM
Unknown Object (File)
Dec 22 2023, 11:39 AM
Subscribers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 40837
Build 37726: arc lint + arc unit

Event Timeline

sys/riscv/sifive/sifive_prci.c
230

Where does the bias of 2 come from?

236

From the clock schematic in the fu740 manual, pcieauxclk is not the child of hfpclk, but rather hfclk. I think the distinction would matter if we ever allow setting the pll clock frequency.

360–362

A lot of blank lines here... maybe lose this one?

369

So, is the generic clk_div class insufficient somehow?

sys/riscv/sifive/sifive_prci.c
230

Short answer: I used the Linux driver to infer the meaning of the register, as the manual is rather lacking in detail (though at least it documents this register unlike some of the others which are undocumented yet referred to by the Linux driver...)

The more elaborate answer is you can sort of infer this from the diagram. clktxclk is 0-250MHz and pclk is 0-125MHz, with pclk being clktxclk/N (ignoring buffers). Given the reset value of hfpclk_div is 0, that implies that 0 must mean 2 (as 250/125), and thus all values have an implicit +2 when used.

236

That's a good point, I suspect I just copied this from the divisor clock and failed to notice the subtle difference. Are we fine to assume the name of the clock in the device tree here, or do we need to make it dynamic?..

360–362

This was to mirror the style in prci_clk_pll_recalc, which I quite like as it separates out the MMIO from the normal calculation from the locking.

369

By default the real divisor is used, and you can also set a flag to have it start from 0, but there's no option to have a bias other than 0/1.

sys/riscv/sifive/sifive_prci.c
230

Yikes! Sounds good though :)

236

I think we can it assume it will be static since it appears to be defined in upstream u-boot and Linux as a fixed "hfclk".

501
513

Fix pcieauxclk parent (hfclk, not hfpclk), use explicit != NULL

This revision is now accepted and ready to land.Aug 4 2021, 2:54 PM
This revision was automatically updated to reflect the committed changes.